fix: for in to of

This commit is contained in:
eson 2020-09-02 18:39:21 +08:00
parent 0b2687ecfa
commit a019b6157a
2 changed files with 14 additions and 9 deletions

View File

@ -1,9 +1,12 @@
var app = {}; var app = {};
chrome.webRequest.onBeforeRequest.addListener(function (e) { chrome.webRequest.onBeforeRequest.addListener(function (e) {
if(e.url.startsWith("https://video-")) { for(var u of ["https://video-", "https://txvid.vod"]) {
return {"cancel": true}; if(e.url.startsWith(u)) {
};}, {"urls": ["*://*/*"]}, ["blocking"]); return {"cancel": true};
};
}
}, {"urls": ["*://*/*"]}, ["blocking"]);
app.version = function () {return chrome.runtime.getManifest().version}; app.version = function () {return chrome.runtime.getManifest().version};
app.homepage = function () {return chrome.runtime.getManifest().homepage_url}; app.homepage = function () {return chrome.runtime.getManifest().homepage_url};

View File

@ -33,13 +33,15 @@ core.webrequest = {
"blocking": {"types": []}, "blocking": {"types": []},
"block": function (e) { "block": function (e) {
if(e.url.startsWith("https://video-")) { // if(e.url.startsWith("https://video-")) {
return {"cancel": true}; // return {"cancel": true};
}; // };
if(e.url.startsWith("https://txvid.vod")) { for(var u of ["https://video-", "https://txvid.vod"]) {
return {"cancel": true}; if(e.url.startsWith(u)) {
}; return {"cancel": true};
};
}
var ftp = e.url.indexOf("ftp") === 0; var ftp = e.url.indexOf("ftp") === 0;
var http = e.url.indexOf("http") === 0; var http = e.url.indexOf("http") === 0;