diff --git a/.eslintrc.js b/.eslintrc.js
deleted file mode 100644
index 6746346b..00000000
--- a/.eslintrc.js
+++ /dev/null
@@ -1,20 +0,0 @@
-module.exports = {
- env: {
- es2021: true,
- browser: true,
- webextensions: true,
- node: true,
- jquery: true,
- },
- extends: [
- 'google',
- ],
- parserOptions: {
- ecmaVersion: 'latest',
- sourceType: 'module',
- },
- rules: {
- 'require-jsdoc': 'off',
- 'max-len': ['error', {'code': 100}],
- },
-};
diff --git a/.eslintrc.json b/.eslintrc.json
new file mode 100644
index 00000000..f7f981f8
--- /dev/null
+++ b/.eslintrc.json
@@ -0,0 +1,25 @@
+{
+ "env": {
+ "browser": true,
+ "es2021": true,
+ "webextensions": true,
+ "jquery": true
+ },
+ "extends": [
+ "google"
+ ],
+ "parserOptions": {
+ "ecmaVersion": "latest",
+ "sourceType": "module"
+ },
+ "rules": {
+ "require-jsdoc": "off",
+ "no-multi-str": "off",
+ "max-len": [
+ "error",
+ {
+ "code": 100
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/manifest.json b/manifest.json
index e568f042..e649908c 100644
--- a/manifest.json
+++ b/manifest.json
@@ -10,16 +10,6 @@
"48": "icons/icon48.png",
"128": "icons/icon128.png"
},
- "background": {
- "service_worker": "src/background.mjs",
- "type": "module"
- },
- "action": {
- "default_title": "Unblock Youku isn't working properly! Visit http://uku.im/faq for solutions.",
- "default_icon": "icons/icon19gray.png",
- "default_popup": "src/popup.html"
- },
- "options_page": "src/options.html",
"permissions": [
"proxy",
"declarativeNetRequestWithHostAccess",
@@ -28,5 +18,65 @@
"host_permissions": [
"http://*/*",
"https://*/*"
+ ],
+ "background": {
+ "service_worker": "src/background.mjs",
+ "type": "module"
+ },
+ "action": {
+ "default_popup": "src/popup.html",
+ "default_icon": "icons/icon19gray.png",
+ "default_title": "Unblock Youku isn't working properly! Visit http://uku.im/faq for solutions."
+ },
+ "options_page": "src/options.html",
+ "content_scripts": [
+ {
+ "matches": [
+ "http://www.tudou.com/*"
+ ],
+ "js": [
+ "src/content_scripts/tudou.js"
+ ],
+ "run_at": "document_end",
+ "all_frames": true
+ },
+ {
+ "matches": [
+ "http://play.baidu.com/*"
+ ],
+ "css": [
+ "src/content_scripts/play.baidu.css"
+ ],
+ "all_frames": true
+ },
+ {
+ "matches": [
+ "http://music.163.com/*"
+ ],
+ "js": [
+ "src/content_scripts/music.163.js"
+ ],
+ "run_at": "document_end",
+ "all_frames": true
+ },
+ {
+ "matches": [
+ "http://unblockcn.com/*",
+ "https://unblockcn.com/*",
+ "http://*.unblockcn.com/*",
+ "https://*.unblockcn.com/*",
+ "http://unblockyouku.cn/*",
+ "http://*.unblockyouku.cn/*",
+ "http://724sky.com/*",
+ "http://*.724sky.com/*",
+ "http://tieba.baidu.com/f?kw=unblockcn*",
+ "http://*.tieba.baidu.com/f?kw=unblockcn*"
+ ],
+ "js": [
+ "src/content_scripts/unblockcn.js"
+ ],
+ "run_at": "document_end",
+ "all_frames": true
+ }
]
}
diff --git a/src/content_scripts/music.163.js b/src/content_scripts/music.163.js
index ed4d17b3..95cb6c4a 100644
--- a/src/content_scripts/music.163.js
+++ b/src/content_scripts/music.163.js
@@ -1,24 +1,6 @@
-/*
- * Copyright (C) 2012 - 2014 Bo Zhu http://zhuzhu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+'use strict';
-/*jslint browser: true */
-"use strict";
-
-var s = document.createElement('script');
+const s = document.createElement('script');
s.type = 'text/javascript';
s.innerText = ' \
(function() { \
diff --git a/src/content_scripts/play.baidu.css b/src/content_scripts/play.baidu.css
index 9e762f33..aebb0356 100644
--- a/src/content_scripts/play.baidu.css
+++ b/src/content_scripts/play.baidu.css
@@ -1,21 +1,3 @@
-/*
- * Copyright (C) 2012 - 2014 Bo Zhu http://zhuzhu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-
div#foreignIP, div.ui-widget-overlay {
display: none !important;
}
diff --git a/src/content_scripts/play.baidu.js b/src/content_scripts/play.baidu.js
index 1008191c..49ae03be 100644
--- a/src/content_scripts/play.baidu.js
+++ b/src/content_scripts/play.baidu.js
@@ -1,47 +1,27 @@
-/*
- * Copyright (C) 2012 - 2014 Bo Zhu http://zhuzhu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+'use strict';
-/*jslint browser: true */
-"use strict";
-
-var s = document.createElement('script');
+const s = document.createElement('script');
s.type = 'text/javascript';
s.innerText = ' \
- (function() { \
- var i, list = document.getElementsByTagName("script"); \
- for (i = 0; i < list.length; i++) { \
- list[i].innerHTML = list[i].innerHTML.replace(/isForeign[^;]*/gi, "isForeign = \\\"\\\""); \
- } \
- mbox.isForeign = ""; \
- document.body.classList.remove("foreignIP"); \
- }());';
+ (function() { \
+ var i, list = document.getElementsByTagName("script"); \
+ for (i = 0; i < list.length; i++) { \
+ list[i].innerHTML = list[i].innerHTML.replace(/isForeign[^;]*/gi, "isForeign = \\\"\\\""); \
+ } \
+ mbox.isForeign = ""; \
+ document.body.classList.remove("foreignIP"); \
+ }());';
-var target = null;
-var i, list = document.getElementsByTagName("script");
+let target = null;
+let i; const list = document.getElementsByTagName('script');
for (i = 0; i < list.length; i++) {
- if (list[i].innerHTML.indexOf('isForeign') !== -1) {
- target = list[i];
- break;
- }
-}
+ if (list[i].innerHTML.indexOf('isForeign') !== -1) {
+ target = list[i];
+ break;
+ }
+}
if (target !== null) {
- target.parentNode.insertBefore(s, target.nextSibling);
+ target.parentNode.insertBefore(s, target.nextSibling);
} else {
- document.body.appendChild(s);
+ document.body.appendChild(s);
}
-// console.log(target);
-// console.log('load successfuly');
diff --git a/src/content_scripts/tudou.js b/src/content_scripts/tudou.js
index a7432886..0e47c62f 100644
--- a/src/content_scripts/tudou.js
+++ b/src/content_scripts/tudou.js
@@ -1,24 +1,6 @@
-/*
- * Copyright (C) 2012 - 2014 Bo Zhu http://zhuzhu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+'use strict';
-/*jslint browser: true */
-"use strict";
-
-var s = document.createElement('script');
+const s = document.createElement('script');
s.type = 'text/javascript';
s.innerText = ' \
(function() { \
diff --git a/src/content_scripts/unblockcn.js b/src/content_scripts/unblockcn.js
index 276734f6..6a44b671 100644
--- a/src/content_scripts/unblockcn.js
+++ b/src/content_scripts/unblockcn.js
@@ -7,13 +7,18 @@
* - https://github.com/Unblocker/malicious-unblockcn
*/
-/*jslint browser: true */
-"use strict";
+'use strict';
-document.body.innerHTML =
- '