chromeworker/chromeproxy/background/capture.js

41 lines
861 B
JavaScript
Raw Normal View History

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;
}
}
try {
if (condition == undefined) {
condition = function () {
return true;
};
}
} catch (error) {
2020-11-24 07:16:37 +00:00
condition = function () {
return true;
};
}
var href = window.location.href;
var content = "";
if(document.contentType == "application/json") {
content = document.documentElement.innerText;
} else {
content = document.documentElement.innerHTML;
}
2020-11-24 07:16:37 +00:00
if (condition()) {
2020-11-27 07:57:24 +00:00
Tell("content", content);
2020-11-24 07:16:37 +00:00
} else {
2020-11-27 07:57:24 +00:00
Tell("notwant", content);
2020-11-24 07:16:37 +00:00
}