This commit is contained in:
2026-03-12 17:09:35 +09:00
parent be016409d7
commit a72b1778a9
7 changed files with 383 additions and 67 deletions
@@ -53,7 +53,7 @@ function afterDay(date, before) {
const port = browser.runtime.connectNative("browser");
port.onMessage.addListener(response => {
var type= response["type"];
switch (type) {
case "fetchAllImages": {
const targetSrc = response["targetSrc"];
@@ -96,6 +96,16 @@ port.onMessage.addListener(response => {
// try {contents = toonContents(document.querySelector("#novel_content"))}catch (e) {}
// console.log("listBody", listBody);
// console.log("title", title);
const keyword = "보안";
const elements = document.querySelectorAll(".main-content"); // 또는 getElementsByClassName("item")
const matched = Array.from(elements).filter(el =>
el.textContent.includes(keyword) // 대소문자 구분
);
if(listBody) {
// getList(listBody.children)
} else if(title && contents) {
@@ -110,6 +120,8 @@ port.onMessage.addListener(response => {
// }
// );
// }
} else if(matched.length > 0){
hideBook()
} else {
loadComplete()
}
@@ -129,7 +141,8 @@ port.onMessage.addListener(response => {
}
break;
case "ViewerTouch": {
if (document.querySelector(".show_viewer")) {
if (document.querySelector(".show_viewer") && document.querySelector(".mcv-visible")) {
var area = response["area"]
var current = Number(document.querySelector("#mcv_currentPageNum").innerHTML)
var total = Number(document.querySelector("#mcv_totalPagesNum").innerHTML)
@@ -146,8 +159,10 @@ port.onMessage.addListener(response => {
}else {
document.querySelector("#goNextBtn").click()
}
document.querySelector(".link_ad")
}
} else if(document.querySelector(".show_viewer")){
document.querySelector(".show_viewer").click();
}
}
break;
@@ -350,8 +365,13 @@ function scrollByPercentUpDown(isToDown , max) {
window.scrollTo({ top: currentScroll + (moveAmount * isToDown) , behavior: "smooth" });
}
function loadComplete() {
// try {port.postMessage(JSON.stringify({type: "NotRegistered"}));}catch (e) {}
try {port.postMessage(JSON.stringify({type: "NotRegistered"}));}catch (e) {}
}
function hideBook() {
try {port.postMessage(JSON.stringify({type: "NotRegistered"}));}catch (e) {}
}
function sendMessage(msg) {
port.postMessage(JSON.stringify(msg));
}