This commit is contained in:
2025-07-23 18:12:30 +09:00
parent f56c43d82b
commit 668d33543c
10 changed files with 211 additions and 82 deletions
@@ -1,4 +1,3 @@
const list = ["?page=2","?page=3","?page=4","?page=5","?page=6"];
const port = browser.runtime.connectNative("browser");
port.onMessage.addListener(response => {
var type= response["type"];
@@ -237,9 +236,9 @@ function sendMessage(msg) {
function toast(msg) {
port.postMessage(JSON.stringify({type:"MSG",msg:msg}));
}
var time1 = null
if (port) {
setTimeout(
time1 = setTimeout(
function(){
if (location.hostname.search("clien") > -1 && document.querySelectorAll('[class^="view_top"]')) {
document.querySelectorAll('[class^="view_top"]').forEach(e => e.remove())
@@ -342,7 +341,11 @@ if (port) {
var title = "";
try {
title = e.querySelector(".name").querySelector("a").querySelector("span").textContent.trim();
e.querySelector(".name").querySelector("a").querySelectorAll("span").forEach(function (e) {
if (e.hasAttribute("class") == false) {
title = e.textContent.trim();
}
})
}catch (e) {
}
@@ -367,10 +370,10 @@ if (port) {
"title" : title,
"description" : desc,
"originPage" : originPage,
"magnet" : magnet,
"magnet_link" : magnet,
"thumbnail" : thumb,
"pubDate" : date,
"screenshots" : screenshots,
"screenshotsUrl" : screenshots,
"chosung" : "",
"category" : "PRIVATE"
});
@@ -387,24 +390,48 @@ if (port) {
},1500)
}
var targetUrl = ""
var time2 = null
function gotoNext() {
if (location.href.search("page") < 0) {
targetUrl = location.protocol + "//" + location.hostname + "/" + list[0]
}else {
var targetUrl = ""
for (i = 0; i < list.length - 1; i++) {
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 {
if (location.href.search(list[i]) > -1) {
targetUrl = location.protocol + "//" + location.hostname + list[i + 1]
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) {
} catch (e) {
console.error(e)
}
}
}
if (targetUrl.length > 5) {
setTimeout(function () {location.href = targetUrl},3000)
console.log("targetUrl :: " + targetUrl);
time2 = setTimeout(function () {
clearTimeout(time2)
if (targetUrl.length > 5) {
console.log("targetUrl :: " + targetUrl);
location.href = targetUrl
}
}, 5000);
} catch (e) {
}
}