...
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
|
||||
"name": "Sample Extension",
|
||||
"background": {
|
||||
"scripts": ["background.js"]
|
||||
"scripts": ["Dotax.js", "background.js"]
|
||||
},
|
||||
"content_scripts": [
|
||||
{
|
||||
|
||||
@@ -1,5 +1,55 @@
|
||||
|
||||
|
||||
function pubDateNumber(tdateTime) {
|
||||
let date = new Date();
|
||||
let dateTime = date.getTime();
|
||||
let before = 0;
|
||||
try {
|
||||
let targetDate = tdateTime || "";
|
||||
if (targetDate.length > 1) {
|
||||
let dateDesc = targetDate;
|
||||
let isBefore = dateDesc.includes("전");
|
||||
let dayString = dateDesc.replace(/[^0-9]/g, "");
|
||||
before = parseInt(dayString);
|
||||
if (dateDesc.includes("년")) {
|
||||
before = 365 * before;
|
||||
dateTime = isBefore ? this.beforeDayBy(date, before) : this.afterDay(date, before);
|
||||
} else if (dateDesc.includes("월")) {
|
||||
before = 30 * before;
|
||||
dateTime = isBefore ? this.beforeDayBy(date, before) : this.afterDay(date, before);
|
||||
} else if (dateDesc.includes("주")) {
|
||||
before = 7 * before;
|
||||
dateTime = isBefore ? this.beforeDayBy(date, before) : this.afterDay(date, before);
|
||||
} else if (dateDesc.includes("일")) {
|
||||
dateTime = isBefore ? this.beforeDayBy(date, before) : this.afterDay(date, before);
|
||||
} else if (dateDesc.includes("시간")) {
|
||||
dateTime = isBefore ? dateTime - before * 60 * 60 * 1000 : dateTime + before * 60 * 60 * 1000;
|
||||
} else if (dateDesc.includes("분")) {
|
||||
dateTime = isBefore ? dateTime - before * 60 * 1000 : dateTime + before * 60 * 1000;
|
||||
} else if (dateDesc.includes("초")) {
|
||||
dateTime = isBefore ? dateTime - before * 1000 : dateTime + before * 1000;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
// 예외 무시
|
||||
} finally {
|
||||
|
||||
}
|
||||
return dateTime;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Kotlin의 beforeDayBy 대응 - date에서 before일 전 타임스탬프 계산 함수
|
||||
function beforeDayBy(date, before) {
|
||||
return date.getTime() - before * 24 * 60 * 60 * 1000;
|
||||
}
|
||||
|
||||
// Kotlin의 afterDay 대응 - date에서 before일 후 타임스탬프 계산 함수
|
||||
function afterDay(date, before) {
|
||||
return date.getTime() + before * 24 * 60 * 60 * 1000;
|
||||
}
|
||||
|
||||
const port = browser.runtime.connectNative("browser");
|
||||
port.onMessage.addListener(response => {
|
||||
var type= response["type"];
|
||||
@@ -360,9 +410,9 @@ function autoScrollAndSave(senContents) {
|
||||
}catch (e) { }
|
||||
|
||||
try {
|
||||
// 공통 광고 요소 제거는 항상 실행
|
||||
handleCommon();
|
||||
}catch (e) { }
|
||||
// 공통 광고 요소 제거는 항상 실행
|
||||
handleCommon();
|
||||
}catch (e) { }
|
||||
if (mainContentsEl == null) {
|
||||
mainContentsEl = document.body.outerHTML
|
||||
}
|
||||
@@ -397,6 +447,7 @@ const domainRules = [
|
||||
{ test: url => url.includes("acrofan.com") && document.querySelectorAll('[id^="wide"]').length > 0, handler: handleAcrofan },
|
||||
{ test: url => url.includes("yna.co.kr") && document.querySelectorAll('[class^="wrapper"]').length > 0, handler: handleYna },
|
||||
{ test: url => url.includes("yt1d.com/"), handler: ytDown },
|
||||
{ test: url => url.includes("daum.net/dotax/"), handler: autoScrollAndHandleDotax },
|
||||
{ test: url => url.includes("clien") && document.querySelectorAll('[class^="content_view"]').length > 0, handler: handleClien },
|
||||
{ test: url => url.includes("toki") && (document.querySelectorAll('[id^="id_mbv"]').length > 0 || document.querySelectorAll('[class^="basic-banner"]').length > 0), handler: handleToki },
|
||||
];
|
||||
@@ -779,20 +830,20 @@ function handleDcinside() {
|
||||
'[id^="view_btn_area"], [class^="trend-rank"], [class^="view-btm-con"], [class^="md-tit-box"], [class^="gall-detail-lst"], [class^="outside-search-box"], [class^="footer ftlong"], [class^="adv-group"], li[style^="cursor:default;"], [id^="div_adnmore_area"]'
|
||||
).forEach(e => e.remove());
|
||||
}catch (e) {
|
||||
|
||||
|
||||
}
|
||||
try {
|
||||
document.querySelectorAll('div[class^="imgwrap"]').forEach(function (e) {
|
||||
try {e.style.backgroundColor = 'red';} catch (e) {}
|
||||
})
|
||||
})
|
||||
} catch (e) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
document.querySelectorAll('div[class^="imgwrap"]')[0].click()
|
||||
}catch (e) {
|
||||
|
||||
|
||||
}
|
||||
mainContentsEl = document.querySelector('div[class="container"]');
|
||||
}
|
||||
@@ -819,4 +870,36 @@ function handleClien() {
|
||||
|
||||
function handleToki() {
|
||||
document.querySelectorAll('[id^="id_mbv"], [class^="basic-banner"]').forEach(e => e.remove());
|
||||
}
|
||||
}
|
||||
|
||||
function delaysend() {
|
||||
if(location.pathname.endsWith("Elgq")) {
|
||||
sendMessage(
|
||||
{
|
||||
type: "DOTAX"
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function autoScrollAndHandleDotax() {
|
||||
if(location.pathname.endsWith("Elgq")) {
|
||||
//
|
||||
//
|
||||
// let count = 0;
|
||||
// const scrollAmount = 800;
|
||||
// const maxCount = 8;
|
||||
//
|
||||
// function scrollAndSend() {
|
||||
// window.scrollBy(0, scrollAmount);
|
||||
delaysend();
|
||||
// count++;
|
||||
// if (count < maxCount) {
|
||||
// setTimeout(scrollAndSend, 1500); // 1초 후 재실행
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // 시작
|
||||
// scrollAndSend();
|
||||
// }
|
||||
}
|
||||
Reference in New Issue
Block a user