This commit is contained in:
2026-05-20 17:57:56 +09:00
parent 257ddb6776
commit 378f6495be
14 changed files with 553 additions and 349 deletions
@@ -1,9 +1,9 @@
(function() {
var meta = document.querySelector('meta[name=viewport]');
if (!meta) {
meta = document.createElement('meta');
meta.name = 'viewport';
document.head.appendChild(meta);
}
meta.setAttribute('content', 'width=device-width, initial-scale=1.0');
})();
//(function() {
// var meta = document.querySelector('meta[name=viewport]');
// if (!meta) {
// meta = document.createElement('meta');
// meta.name = 'viewport';
// document.head.appendChild(meta);
// }
// meta.setAttribute('content', 'width=device-width, initial-scale=1.0');
//})();
@@ -13,7 +13,7 @@
},
"content_scripts": [
{
"run_at": "document_end",
"run_at": "document_start",
"matches": ["<all_urls>"],
"js": ["messaging.js","inject-viewport.js"]
}
@@ -1,5 +1,6 @@
function pubDateNumber(tdateTime) {
let date = new Date();
let dateTime = date.getTime();
@@ -55,11 +56,11 @@ port.onMessage.addListener(response => {
var type= response["type"];
switch (type) {
case "GO_TO_SUBTITLE_DETAIL": {
const detailUrl = response["url"];
location.href = detailUrl; // 상세 페이지로 이동
break;
}
case "GO_TO_SUBTITLE_DETAIL": {
const detailUrl = response["url"];
location.href = detailUrl; // 상세 페이지로 이동
break;
}
case "SEARCH_SUBTITLE_CAT": {
const query = response["query"];
const searchUrl = `https://www.subtitlecat.com/index.php?search=${encodeURIComponent(query)}`;
@@ -72,7 +73,7 @@ port.onMessage.addListener(response => {
behavior: 'smooth'
});
}
break;
break;
case "SEEK_NEXT": // 5초 앞으로
{
let btn =
@@ -469,13 +470,9 @@ if(document.querySelector(".list-body") !== null) {
var listBody = null
try {listBody = document.querySelector(".list-body");}catch (e) {}
getList(listBody.children)
} else if(document.querySelector(".novel-eps") !== null) {
//document.querySelector(".novel-eps").children
removeSpecificGifs()
var listBody = null
try {listBody = document.querySelector(".novel-eps");}catch (e) {}
getList2(listBody.children)
} else if(document.querySelector("#novel_content") !== null){
}
if(document.querySelector("#novel_content") !== null){
removeSpecificGifs()
var title = null
var contents = null
@@ -492,24 +489,9 @@ if(document.querySelector(".list-body") !== null) {
}
);
}
} else if(document.querySelector('[style^="--novel"]') !== null){
removeSpecificGifs()
var title = null
var contents = null
try {title = toonTitle(document.querySelector(".page-desc")); }catch (e) {}
try {contents = toonContents(document.querySelector('[style^="--novel"]'))}catch (e) {}
if (toonTitle !== undefined && toonContents !== undefined && toonTitle !== "" && toonContents !=="") {
sendMessage(
{
type: "BookContents",
book : {
chapterTitle : title,
bookContents : contents
}
}
);
}
}
if(document.querySelector("#html_encoder_div")) {
sendMessage(
{
@@ -814,7 +796,9 @@ document.addEventListener('DOMContentLoaded', function () {
if (document.readyState === 'complete') {
sendCookiesToNative();
try{removeSpecificGifs();}catch(e){}
} else {
// 2. 아직 로딩 중이라면 window.onload(모든 리소스 로드 완료) 시점에 실행
window.addEventListener('load', sendCookiesToNative);
}
@@ -860,27 +844,36 @@ function extractSubtitleList() {
}
function scrollToEndAndExtract() {
if (location.host.includes("subtitlecat.com")) {
const scrollStep = 800; // 한 번에 스크롤할 양
const scrollDelay = 500; // 다음 스크롤까지 대기 시간 (ms)
const scrollStep = 800; // 한 번에 스크롤할 양
const scrollDelay = 500; // 다음 스크롤까지 대기 시간 (ms)
function step() {
const prevScrollY = window.scrollY;
window.scrollBy(0, scrollStep);
function step() {
const prevScrollY = window.scrollY;
window.scrollBy(0, scrollStep);
console.log("ONSTEPS");
// 💡 0.5초 대기 후 현재 위치가 이전과 같다면(끝에 도달) 추출 시작
setTimeout(() => {
if (window.scrollY === prevScrollY ||
(window.innerHeight + window.scrollY) >= document.body.scrollHeight) {
if (location.host.includes("subtitlecat.com")) {
console.log("✅ 페이지 끝 도달 - 자막 리스트 추출 시작");
extractSubtitleList(); // 기존에 정의한 추출 함수 호출
} else {
}
// 💡 0.5초 대기 후 현재 위치가 이전과 같다면(끝에 도달) 추출 시작
setTimeout(() => {
if (window.scrollY === prevScrollY ||
(window.innerHeight + window.scrollY) >= document.body.scrollHeight) {
console.log("✅ 페이지 끝 도달 - 자막 리스트 추출 시작");
extractSubtitleList(); // 기존에 정의한 추출 함수 호출
} else {
step(); // 아직 끝이 아니면 다음 스크롤 진행
}
}, scrollDelay);
} else {
step(); // 아직 끝이 아니면 다음 스크롤 진행
}
}, scrollDelay);
}
step()
} else {
console.log(`is FAIL NOVEL ${location.href.includes("/novel/")}`);
}
step();
}
}