...
This commit is contained in:
@@ -13,11 +13,14 @@
|
||||
},
|
||||
"content_scripts": [
|
||||
{
|
||||
"run_at": "document_end",
|
||||
"matches": ["<all_urls>"],
|
||||
"js": ["messaging.js"]
|
||||
}
|
||||
],
|
||||
"permissions": [
|
||||
"cookies",
|
||||
"<all_urls>",
|
||||
"nativeMessaging",
|
||||
"nativeMessagingFromContent",
|
||||
"geckoViewAddons",
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
|
||||
|
||||
const port = browser.runtime.connectNative("browser");
|
||||
port.onMessage.addListener(response => {
|
||||
var type= response["type"];
|
||||
@@ -238,7 +240,13 @@ function toast(msg) {
|
||||
}
|
||||
var time1 = null
|
||||
if (port) {
|
||||
sendMessage({type: "MSG", msg:"connect prot"});
|
||||
|
||||
|
||||
|
||||
time1 = setTimeout(
|
||||
|
||||
|
||||
function(){
|
||||
if (location.hostname.search("clien") > -1 && document.querySelectorAll('[class^="view_top"]')) {
|
||||
document.querySelectorAll('[class^="view_top"]').forEach(e => e.remove())
|
||||
@@ -323,9 +331,17 @@ if (port) {
|
||||
var thumb = ""
|
||||
try {
|
||||
thumb = e.querySelector("td").querySelector("a").getAttribute('data-link')
|
||||
}catch (e) {
|
||||
|
||||
}
|
||||
try {
|
||||
var sets = e.querySelector("td").querySelector("img").getAttribute('srcset')
|
||||
if(sets.search(",") > -1) {
|
||||
var srcSet = sets.split(",")
|
||||
var newT = srcSet[srcSet.length - 1]
|
||||
if (newT != null && newT.length > 5) {
|
||||
thumb = newT
|
||||
}
|
||||
}
|
||||
} catch (e) {}
|
||||
}catch (e) {}
|
||||
var magnet = ""
|
||||
try {
|
||||
e.querySelectorAll("td").forEach(function (e) {
|
||||
@@ -351,7 +367,6 @@ if (port) {
|
||||
}
|
||||
var originPage = ""
|
||||
try {
|
||||
|
||||
originPage = location.protocol + "//" + location.hostname + e.querySelector(".name").querySelector("a").getAttribute("href");
|
||||
}catch (e) {
|
||||
|
||||
@@ -366,6 +381,7 @@ if (port) {
|
||||
}catch (e) {
|
||||
|
||||
}
|
||||
if (thumb.length > 0 || screenshots.length > 0) {}
|
||||
datas.push({
|
||||
"title" : title,
|
||||
"description" : desc,
|
||||
@@ -381,57 +397,52 @@ if (port) {
|
||||
sendMessage(
|
||||
{
|
||||
type: "PRIVATES",
|
||||
privates: datas
|
||||
privates: datas,
|
||||
currentPage : location.href
|
||||
}
|
||||
);
|
||||
|
||||
gotoNext()
|
||||
}
|
||||
|
||||
},1500)
|
||||
|
||||
|
||||
}
|
||||
|
||||
var targetUrl = ""
|
||||
var time2 = null
|
||||
function gotoNext() {
|
||||
clearTimeout(time1)
|
||||
try{
|
||||
|
||||
var url = new URL(location.href);
|
||||
var params = url.searchParams;
|
||||
var keys = Array.from(params.keys());
|
||||
console.log("targetUrl :: " + params);
|
||||
console.log("targetUrl :: " + keys.length);
|
||||
if (keys.length === 0 && location.href.search("page") < 0) {
|
||||
targetUrl = location.protocol + "//" + location.hostname + "/?page=2"
|
||||
} else {
|
||||
try {
|
||||
var lastValue = params.get("page");
|
||||
console.log("targetUrl :: " + lastValue);
|
||||
var numValue = Number(lastValue);
|
||||
console.log("targetUrl :: " + numValue);
|
||||
if (numValue < Number("5")) {
|
||||
params.set("page", (numValue + 1).toString());
|
||||
console.log("targetUrl :: " + params);
|
||||
url.search = params.toString();
|
||||
console.log("targetUrl :: " + url.search);
|
||||
targetUrl = url.toString();
|
||||
} else {
|
||||
console.log("targetUrl :: ");
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
}
|
||||
console.log("targetUrl :: " + targetUrl);
|
||||
time2 = setTimeout(function () {
|
||||
clearTimeout(time2)
|
||||
if (targetUrl.length > 5) {
|
||||
console.log("targetUrl :: " + targetUrl);
|
||||
location.href = targetUrl
|
||||
}
|
||||
}, 5000);
|
||||
console.log("targetUrl :: " + targetUrl);
|
||||
time2 = setTimeout(function () {
|
||||
clearTimeout(time2)
|
||||
document.querySelector('[class="btn-group"]').querySelectorAll('a').forEach(function(e){
|
||||
if(e.hasAttribute("href") &&
|
||||
(
|
||||
(e.getAttribute("href").search("page=2") > -1 && location.href.search("page") < 0) ||
|
||||
(e.getAttribute("href").search("page=3") > -1 && location.href.search("page=2") > 0)
|
||||
)) {
|
||||
e.click()
|
||||
}
|
||||
})
|
||||
}, 5000);
|
||||
|
||||
} catch (e) {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// if (document.readyState === "complete" || document.readyState === "interactive") {
|
||||
// reportCookiesToNative();
|
||||
// } else {
|
||||
// window.addEventListener("DOMContentLoaded", reportCookiesToNative);
|
||||
// }
|
||||
// function reportCookiesToNative() {
|
||||
// // 모든 쿠키를 읽어 네이티브로 전달
|
||||
// sendMessage({type: "MSG", cookies: "DOMContentLoaded try to cookies send"});
|
||||
// window.cookies.getAll({url: window.location.href}).then((cookies) => {
|
||||
// // 쿠키 데이터를 네이티브(Android)로 전송
|
||||
// sendMessage({type: "Cookies", cookies: cookies});
|
||||
// });
|
||||
// }
|
||||
Reference in New Issue
Block a user