2020-11-25 09:44:52 +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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-25 04:23:46 +00:00
|
|
|
try {
|
2020-11-25 08:34:15 +00:00
|
|
|
if (condition == undefined) {
|
|
|
|
condition = function () {
|
|
|
|
return true;
|
|
|
|
};
|
2020-11-25 04:23:46 +00:00
|
|
|
}
|
|
|
|
} catch (error) {
|
2020-11-24 07:16:37 +00:00
|
|
|
condition = function () {
|
|
|
|
return true;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2020-11-25 09:44:52 +00:00
|
|
|
var href = window.location.href;
|
|
|
|
var content = "";
|
|
|
|
if(document.contentType == "application/json") {
|
|
|
|
content = document.documentElement.innerText;
|
|
|
|
} else {
|
|
|
|
content = document.documentElement.innerHTML;
|
|
|
|
}
|
2020-11-25 08:34:15 +00:00
|
|
|
|
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
|
|
|
}
|
|
|
|
|