diff --git a/.eslintrc.json b/.eslintrc.json
index 88bbf599..b211b9d3 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -3,6 +3,7 @@
"browser": true,
"webextensions": true,
"node": true,
+ "jquery": true,
"es2021": true
},
"extends": [
diff --git a/_locales/en/messages.json b/_locales/en/messages.json
index eff02c3e..4e7e82cf 100644
--- a/_locales/en/messages.json
+++ b/_locales/en/messages.json
@@ -45,12 +45,12 @@
"message": "https://www.uku.im/index.html"
},
"support_title": {
- "message": "We Need Your Support"
+ "message": "We Need Your Donation"
},
"support_message": {
- "message": "Please support us to make Unblock Youku better."
+ "message": "Please donate to us to make Unblock Youku more usable."
},
"support_button": {
- "message": " Please Support Us"
+ "message": " Donate to us "
}
}
diff --git a/_locales/zh_CN/messages.json b/_locales/zh_CN/messages.json
index fa980573..b544ca59 100644
--- a/_locales/zh_CN/messages.json
+++ b/_locales/zh_CN/messages.json
@@ -45,12 +45,12 @@
"message": "https://www.uku.im/index.html"
},
"support_title": {
- "message": "我们需要您的支持"
+ "message": "我们需要您的捐款"
},
"support_message": {
"message": "请帮助 Unblock Youku 长久稳定和免费地运行下去"
},
"support_button": {
- "message": " 请支持我们"
+ "message": " 向我们捐款 "
}
}
diff --git a/_locales/zh_TW/messages.json b/_locales/zh_TW/messages.json
index 0c4bf0e1..6df8163a 100644
--- a/_locales/zh_TW/messages.json
+++ b/_locales/zh_TW/messages.json
@@ -45,12 +45,12 @@
"message": "https://www.uku.im/index_zht.html"
},
"support_title": {
- "message": "我們需要您的支持"
+ "message": "我們需要您的捐款"
},
"support_message": {
"message": "請幫助 Unblock Youku 長久穩定和免費地運行下去"
},
"support_button": {
- "message": " 請支持我們"
+ "message": " 向我們捐款 "
}
}
diff --git a/chrome/config.js b/chrome/config.js
index 968df776..b84aa605 100644
--- a/chrome/config.js
+++ b/chrome/config.js
@@ -15,7 +15,7 @@
* along with this program. If not, see .
*/
-/*global setup_redirect: false, setup_header: false, setup_proxy: false */
+/*global setup_header: false, setup_proxy: false */
/*global clear_redirect: false, clear_header: false, clear_proxy: false */
/*global ga_report_event: false, ga_report_ratio: false, ga_report_error: false */
"use strict";
@@ -23,18 +23,15 @@
// ====== Constant and Variable Settings ======
var unblock_youku = unblock_youku || {}; // namespace
-// only for proxy mode
+// Default proxy server settings
unblock_youku.default_proxy_server_proc = 'HTTPS';
unblock_youku.default_proxy_server_addr = 'secure.uku.im:8443';
unblock_youku.backup_proxy_server_proc = 'HTTPS';
unblock_youku.backup_proxy_server_addr = 'secure.uku.im:993';
-// only for redirect mode
-unblock_youku.default_redirect_server = 'www.yōukù.com/proxy';
-unblock_youku.backup_redirect_server = 'bak.yōukù.com/proxy';
unblock_youku.ip_addr = new_random_ip();
-console.log('ip addr: ' + unblock_youku.ip_addr);
+console.log('generated random ip addr: ' + unblock_youku.ip_addr);
// ====== Configuration Functions ======
@@ -45,7 +42,7 @@ function set_mode_name(mode_name, callback) {
ga_report_error('Unexpected Error', err_msg);
}
- if (mode_name === 'off' || mode_name === 'lite') {
+ if (mode_name === 'off') {
set_storage('unblock_youku_mode', mode_name, callback);
} else {
set_storage('unblock_youku_mode', 'normal', callback);
@@ -60,10 +57,8 @@ function get_mode_name(callback) {
}
get_storage('unblock_youku_mode', function(current_mode) {
- if (typeof current_mode === 'undefined' || (
- current_mode !== 'off' &&
- current_mode !== 'lite' )) {
- set_mode_name('normal', function() {
+ if (typeof current_mode === 'undefined' || current_mode !== 'off') {
+ set_mode_name('normal', function () {
callback('normal');
});
} else {
@@ -74,24 +69,20 @@ function get_mode_name(callback) {
function clear_mode_settings(mode_name) {
switch (mode_name) {
- case 'off':
- console.log('cleared settings for off');
- break;
- case 'lite':
- clear_header();
- clear_redirect();
- console.log('cleared settings for lite');
- break;
- case 'normal':
- clear_header();
- clear_proxy();
- console.log('cleared settings for normal');
- break;
- default:
- var err_msg = 'clear_mode_settings: should never come here';
- console.error(err_msg);
- ga_report_error('Unexpected Error', err_msg);
- break;
+ case 'off':
+ console.log('cleared settings for off');
+ break;
+ case 'normal':
+ clear_header();
+ clear_redirect();
+ clear_proxy();
+ console.log('cleared settings for normal');
+ break;
+ default:
+ var err_msg = 'clear_mode_settings: should never come here';
+ console.error(err_msg);
+ ga_report_error('Unexpected Error', err_msg);
+ break;
}
console.log('cleared the settings for the mode: ' + mode_name);
@@ -99,29 +90,27 @@ function clear_mode_settings(mode_name) {
function setup_mode_settings(mode_name) {
switch (mode_name) {
- case 'off':
- chrome.browserAction.setBadgeText({text: 'OFF'});
- chrome.browserAction.setTitle({title: 'Unblock Youku has been turned off.'});
- change_browser_icon('off');
- break;
- case 'lite':
- setup_header();
- setup_redirect();
- chrome.browserAction.setBadgeText({text: 'LITE'});
- chrome.browserAction.setTitle({title: 'Unblock Youku is running in the lite mode.'});
- change_browser_icon('off');
- break;
- case 'normal':
- // setup_header();
- setup_proxy();
- chrome.browserAction.setBadgeText({text: ''});
- change_browser_icon('normal');
- break;
- default:
- var err_msg = 'setup_mode_settings: should never come here';
- console.error(err_msg);
- ga_report_error('Unexpected Error', err_msg);
- break;
+ case 'off':
+ chrome.browserAction.setBadgeText({ text: 'OFF' });
+ chrome.browserAction.setTitle({ title: 'Unblock Youku has been turned off.' });
+ change_browser_icon('off');
+ break;
+ case 'lite':
+ set_mode_name('normal', function() {
+ console.log('migrate lite mode to normal mode');
+ });
+ // fall through
+ case 'normal':
+ setup_header();
+ setup_proxy();
+ chrome.browserAction.setBadgeText({ text: '' });
+ change_browser_icon('normal');
+ break;
+ default:
+ var err_msg = 'setup_mode_settings: should never come here';
+ console.error(err_msg);
+ ga_report_error('Unexpected Error', err_msg);
+ break;
}
console.log('initialized the settings for the mode: ' + mode_name);
@@ -139,23 +128,23 @@ function change_browser_icon(option) {
var d = today.getDate();
var m = today.getMonth() + 1;
- // hard-coded spring festivals
+ // hard-coded spring festival dates
var is_spring = false;
switch (y) {
- case 2016: // February 8, 2016
- if ((m === 1 && d >= 29) || (m === 2 && d <= 18)) {
- is_spring = true;
- }
+ case 2023: // Jan. 22, 2023
+ is_spring = m === 1;
+ break;
+ case 2024: // Feb. 10, 2024
+ is_spring = m === 2;
break;
- case 2017: // January 28, 2017
- if ((m === 1 && d >= 18) || (m === 2 && d <= 7)) {
- is_spring = true;
- }
+ case 2025: // Jan. 29, 2025
+ is_spring = m === 1;
break;
- case 2018: // February 16, 2018
- if (m === 2 && (6 <= d && d <= 26)) {
- is_spring = true;
- }
+ case 2026: // Feb. 17, 2026
+ is_spring = m === 2;
+ break;
+ case 2027: // Feb. 7, 2027
+ is_spring = m === 2;
break;
}
if (is_spring) {
@@ -209,19 +198,6 @@ function storage_monitor(changes, area) {
}
}
- if (typeof changes.custom_redirect_server !== 'undefined') {
- var redirect_server_change = changes.custom_redirect_server;
-
- if (typeof redirect_server_change.newValue !== 'undefined') {
- // have to use a localStorage cache for using in the blocking webRequest listener
- localStorage.custom_redirect_server = redirect_server_change.newValue;
- } else {
- if (typeof localStorage.custom_redirect_server !== 'undefined') {
- localStorage.removeItem('custom_redirect_server');
- }
- }
- }
-
if (typeof changes.custom_proxy_server !== 'undefined') {
var proxy_server_change = changes.custom_proxy_server;
if (typeof proxy_server_change.newValue !== 'undefined'
diff --git a/chrome/pages/js/options-proxy.js b/chrome/pages/js/options-proxy.js
index a4a2c201..d1afc14d 100644
--- a/chrome/pages/js/options-proxy.js
+++ b/chrome/pages/js/options-proxy.js
@@ -15,8 +15,6 @@
* along with this program. If not, see .
*/
-/*global chrome: false, $: false, localStorage: false */
-
var background = background || chrome.extension.getBackgroundPage();
var default_proxy_server_proc = background.unblock_youku.default_proxy_server_proc;
var default_proxy_server_addr = background.unblock_youku.default_proxy_server_addr;
@@ -79,6 +77,7 @@ function get_custom_proxy_server(callback) {
function test_custom_proxy_server(callback) {
"use strict";
+ // TODO: Change this URL to a new one. It stopped working a while ago.
var test_url = 'http://ipservice.163.com/isFromMainland';
show_proxy_test_message('info', 'Testing connection & Unblock...');
$.get(test_url, function(data) {
@@ -131,12 +130,12 @@ $(document).ready(function() {
background.setup_proxy();
$('#custom_proxy_reset').attr('disabled', false);
show_proxy_message('info', 'Enabled custom proxy server.');
- test_custom_proxy_server();
+ // test_custom_proxy_server();
} else {
background.set_mode_name('normal', function() {
$('#custom_proxy_reset').attr("disabled", false);
show_proxy_message('warning', 'Enabled custom proxy server, and changed to proxy mode.');
- test_custom_proxy_server();
+ // test_custom_proxy_server();
});
}
});
@@ -154,14 +153,14 @@ $(document).ready(function() {
$('#custom_proxy_addr').attr('disabled', false);
$('#custom_proxy_enable').attr('disabled', false);
show_proxy_message('warning', 'Reset custom proxy server.');
- test_custom_proxy_server();
+ // test_custom_proxy_server();
} else {
background.set_mode_name('normal', function() {
$('#custom_proxy_proc').attr('disabled', false);
$('#custom_proxy_addr').attr('disabled', false);
$('#custom_proxy_enable').attr('disabled', false);
show_proxy_message('warning', 'Reset custom proxy server, and changed to proxy mode.');
- test_custom_proxy_server();
+ // test_custom_proxy_server();
});
}
});
diff --git a/chrome/pages/js/options-redirect.js b/chrome/pages/js/options-redirect.js
deleted file mode 100644
index a82c1535..00000000
--- a/chrome/pages/js/options-redirect.js
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (C) 2012 - 2016 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 .
- */
-
-/*global $: false, btoa: false */
-
-var background = background || chrome.extension.getBackgroundPage();
-var default_redirect_server = background.unblock_youku.default_redirect_server;
-
-function remove_custom_redirect_server(callback) {
- "use strict";
- // localStorage.removeItem('custom_redirect_server');
- background.remove_storage('custom_redirect_server', callback);
-}
-
-function get_custom_redirect_server(callback) {
- "use strict";
- background.get_storage('custom_redirect_server', function(server_addr) {
- if (typeof server_addr === 'undefined') {
- callback(default_redirect_server);
- } else {
- callback(server_addr);
- }
- });
-}
-
-function set_custom_redirect_server(server_addr, callback) {
- "use strict";
- if (server_addr === default_redirect_server) {
- // must remove, otherwise the post server won't be invoked
- remove_custom_redirect_server(callback);
- } else {
- // chrome.storage.sync.onChange listener will change localStorage as well
- // localStorage.custom_redirect_server = server_addr;
- background.set_storage('custom_redirect_server', server_addr, callback);
- }
-}
-
-
-function show_redirect_message(type, content) {
- "use strict";
- var alert_type = 'info';
- if (type === 'success' || type === 'warning') {
- alert_type = type; // success, info, or warning
- }
-
- $('#redirect_message').html('
' + content + '
');
-}
-
-
-function show_redirect_error(content) {
- $('#redirect_message').html('' + content + '
');
-}
-
-
-$('document').ready(function() {
- "use strict";
- get_custom_redirect_server(function(server_addr) {
- $('input#custom_redirect_server').val(server_addr);
- });
-
-
- $('button#custom_redirect_test').click(function() {
- var test_url = 'http://' + $('input#custom_redirect_server').val() + '?url=' + btoa('http://ipservice.163.com/isFromMainland');
- show_redirect_message('info', 'Waiting...');
- $.get(test_url, function(data) {
- if (data === 'true') {
- show_redirect_message('success', 'Test passed. Please remember to save the new configuration.');
- } else {
- show_redirect_error('Test failed! Perhaps your server isn\'t located in mainland China.');
- }
- }).error(function() {
- show_redirect_error('Test failed! Perhaps the server isn\'t working properly.');
- });
- });
-
- $('button#custom_redirect_save').click(function() {
- set_custom_redirect_server($('input#custom_redirect_server').val(), function() {
- show_redirect_message('info', 'The new backend server is set.');
- });
- });
-
-
- $('button#custom_redirect_reset').click(function() {
- remove_custom_redirect_server(function() {
- $('input#custom_redirect_server').val(default_redirect_server);
- show_redirect_message('warning', 'Reset to the default backend server.');
- });
- });
-
- $('#form_custom_redirect_server').submit(function(event) {
- // prevent the default action of submitting a form
- event.preventDefault();
- });
-});
-
diff --git a/chrome/pages/js/popup.js b/chrome/pages/js/popup.js
index 83e0050e..c068f441 100644
--- a/chrome/pages/js/popup.js
+++ b/chrome/pages/js/popup.js
@@ -15,8 +15,6 @@
* along with this program. If not, see .
*/
-/*jslint browser: true */
-/*global $: false, chrome: false, ga_report_event: false */
function set_i18n_text() {
"use strict";
@@ -33,14 +31,9 @@ function set_i18n_text() {
$('span.mode_off_name').html(get_msg('mode_off'));
$('span.mode_off_desc').html(get_msg('mode_off_description'));
- $('span.mode_lite_name').html(get_msg('mode_lite'));
- $('span.mode_lite_desc').html(get_msg('mode_lite_description'));
$('span.mode_normal_name').html(get_msg('mode_normal'));
$('span.mode_normal_desc').html(get_msg('mode_normal_description'));
- //$('span.mode_redirect_name').html(get_msg('mode_redirect'));
- //$('span.mode_redirect_desc').html(get_msg('mode_redirect_description'));
- //$('div#help_text').html(get_msg('help'));
$('div#faq').html(get_msg('faq'));
$('div#feedback').html(get_msg('feedback'));
$('div#rating').html(get_msg('rating'));
@@ -58,12 +51,6 @@ $(document).ready(function() {
case 'off':
$('label#off').addClass('active');
break;
- case 'lite':
- $('label#lite').addClass('active');
- break;
- case 'redirect':
- $('label#redirect').addClass('active');
- break;
default:
$('label#normal').addClass('active');
break;
@@ -85,32 +72,12 @@ $(document).ready(function() {
console.log('to change mode to off');
background.change_mode('off');
});
- $('input#input_lite').change(function() {
- console.log('to change mode to lite');
- background.change_mode('lite');
- });
$('input#input_normal').change(function() {
console.log('to change mode to normal');
background.change_mode('normal');
});
- //$('input#input_redirect').change(function() {
- // console.log('to change mode to redirect');
- // background.change_mode('redirect');
- //});
// enable tooltip
$('#tooltip').tooltip();
-
- var my_date = new Date();
- if (typeof localStorage.first_time === 'undefined') {
- localStorage.first_time = my_date.getTime();
- } else if (my_date.getTime() > parseInt(localStorage.first_time, 10) + 1000 * 60 * 60 * 24 * 3) {
- $('div#rating').show(); // delay 3 days for the rating div to show up, hahaha
- }
-
- $('#support_button').click(function() {
- // Make sure the donation page is only shown once
- background.localStorage.showed_donation_page = new Date().getTime();
- });
});
diff --git a/chrome/pages/options.html b/chrome/pages/options.html
index 71177cf5..d8b543f5 100644
--- a/chrome/pages/options.html
+++ b/chrome/pages/options.html
@@ -6,7 +6,6 @@
-
@@ -43,29 +42,6 @@
-
-