2020-11-24 07:16:37 +00:00
|
|
|
var href = window.location.href;
|
|
|
|
var content = document.documentElement.innerHTML;
|
|
|
|
|
2020-11-25 04:23:46 +00:00
|
|
|
try {
|
|
|
|
if(waittime === undefined) {
|
|
|
|
waittime = 6000
|
|
|
|
}
|
|
|
|
} catch (error) {
|
|
|
|
waittime = 6000
|
|
|
|
}
|
|
|
|
|
2020-11-24 07:16:37 +00:00
|
|
|
|
|
|
|
if (condition == undefined) {
|
|
|
|
condition = function () {
|
|
|
|
return true;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
if (condition()) {
|
|
|
|
Tell(BackgroundMsgType.CONTENT, content);
|
|
|
|
} else {
|
2020-11-25 04:23:46 +00:00
|
|
|
setTimeout(function () {
|
|
|
|
if (condition()) {
|
|
|
|
Tell(BackgroundMsgType.CONTENT, content);
|
|
|
|
} else {
|
|
|
|
Tell(BackgroundMsgType.NOTWANT, content);
|
|
|
|
}
|
|
|
|
}, waittime)
|
2020-11-24 07:16:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function Tell(backgroundType, content) {
|
|
|
|
try {
|
|
|
|
if (content == undefined) {
|
|
|
|
chrome.runtime.sendMessage({ type: backgroundType });
|
|
|
|
} else {
|
|
|
|
chrome.runtime.sendMessage({ type: backgroundType, content: content });
|
|
|
|
}
|
|
|
|
} catch (error) {
|
|
|
|
console.log(error);
|
|
|
|
window.location.href = Host;
|
|
|
|
}
|
|
|
|
}
|