TODO: 回调没反应
This commit is contained in:
@@ -23,20 +23,28 @@ chrome.runtime.onMessage.addListener(function (request) {
|
||||
});
|
||||
|
||||
|
||||
var href = window.location.href;
|
||||
var content = document.documentElement.innerHTML;
|
||||
if (href.startsWith("https://playerduo.com") && content.startsWith('<head></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">')) {
|
||||
// var href = window.location.href;
|
||||
// var content = document.documentElement.innerHTML;
|
||||
|
||||
var condition = PassContentCondition != undefined ? PassContentCondition : DefaultContentCondition;
|
||||
if (condition()) {
|
||||
Tell(BackgroundMsgType.CONTENT, content);
|
||||
} else {
|
||||
Tell(BackgroundMsgType.NOTWANT, content);
|
||||
}
|
||||
|
||||
function Tell(backgroundType, content) {
|
||||
if(content == undefined) {
|
||||
chrome.runtime.sendMessage({type: backgroundType});
|
||||
} else {
|
||||
chrome.runtime.sendMessage({type: backgroundType, content: 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function GetTask() {
|
||||
|
||||
Reference in New Issue
Block a user