chromeworker/chromeproxy/background/capture.js

32 lines
711 B
JavaScript
Raw Normal View History

2020-11-24 07:16:37 +00:00
var href = window.location.href;
var content = document.documentElement.innerHTML;
setTimeout(function(){
window.close();
}, 15000)
if (condition == undefined) {
condition = function () {
return true;
};
}
if (condition()) {
Tell(BackgroundMsgType.CONTENT, content);
} else {
Tell(BackgroundMsgType.NOTWANT, content);
}
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;
}
}