mirror of
https://github.com/anticensority/runet-censorship-bypass.git
synced 2024-11-24 02:13:43 +03:00
0.0.0.7 and minor changes
This commit is contained in:
parent
5ea4cb1a25
commit
97669e886d
|
@ -12,7 +12,7 @@ function blockInform(details) {
|
|||
if (details.tabId !== -1 && window.antiCensorRu.pacProvider && window.antiCensorRu.pacProvider.proxyIps && window.antiCensorRu.pacProvider.proxyIps[ details.ip ]) {
|
||||
|
||||
chrome.pageAction.setIcon({
|
||||
path: '/icons/rkn-empty.png',
|
||||
path: '/icons/ribbon32.png',
|
||||
tabId: details.tabId
|
||||
});
|
||||
|
||||
|
|
BIN
extensions/chromium/minimalistic-pac-setter/extnesion/icons/ribbon128.png
Executable file
BIN
extensions/chromium/minimalistic-pac-setter/extnesion/icons/ribbon128.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
BIN
extensions/chromium/minimalistic-pac-setter/extnesion/icons/ribbon32.png
Executable file
BIN
extensions/chromium/minimalistic-pac-setter/extnesion/icons/ribbon32.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 901 B |
Binary file not shown.
Before Width: | Height: | Size: 7.7 KiB |
Binary file not shown.
Before Width: | Height: | Size: 7.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 7.8 KiB |
|
@ -3,9 +3,9 @@
|
|||
|
||||
"name": "Ненавязчивый РосКомНадзор",
|
||||
"description": "Аргументы против цензуры: https://git.io/vEkI9",
|
||||
"version": "0.0.0.5",
|
||||
"version": "0.0.0.7",
|
||||
"icons": {
|
||||
"128": "/icons/rkn-empty.png"
|
||||
"128": "/icons/ribbon128.png"
|
||||
},
|
||||
"author": "ilyaigpetrov@gmail.com",
|
||||
"homepage_url": "https://github.com/ilyaigpetrov/anti-censorship-russia",
|
||||
|
|
|
@ -13,23 +13,23 @@ chrome.runtime.getBackgroundPage( backgroundPage => {
|
|||
|
||||
var ul = document.querySelector('#list-of-providers');
|
||||
var _firstChild = ul.firstChild;
|
||||
for(var providerKey of Object.keys(antiCensorRu.pacProviders)) {
|
||||
for( var providerKey of Object.keys(antiCensorRu.pacProviders) ) {
|
||||
var li = document.createElement('li');
|
||||
li.innerHTML = '<input type="radio" name="pacProvider" id="'+providerKey+'"> <label for="'+providerKey+'">'+providerKey+'</label>';
|
||||
ul.insertBefore( li, _firstChild );
|
||||
}
|
||||
|
||||
var targetRadio = () => {
|
||||
var currentRadio = () => {
|
||||
var id = antiCensorRu.currentPacProviderKey || 'none';
|
||||
return document.querySelector('#'+id);
|
||||
}
|
||||
var checkChosenProvider = () => {
|
||||
targetRadio().checked = true;
|
||||
currentRadio().checked = true;
|
||||
}
|
||||
var triggerChosenProvider = () => {
|
||||
var event = document.createEvent('HTMLEvents');
|
||||
event.initEvent('change', false, true);
|
||||
targetRadio().dispatchEvent(event);
|
||||
currentRadio().dispatchEvent(event);
|
||||
}
|
||||
|
||||
var radios = [].slice.apply( document.querySelectorAll('[name=pacProvider]') );
|
||||
|
@ -39,15 +39,18 @@ chrome.runtime.getBackgroundPage( backgroundPage => {
|
|||
if (pacKey === 'none')
|
||||
return antiCensorRu.clearPac( () => window && window.close() );
|
||||
|
||||
function switchInputs() {
|
||||
function enableDisableInputs() {
|
||||
var inputs = document.querySelectorAll('[name="pacProvider"]');
|
||||
for (var i = 0; i < inputs.length; i++)
|
||||
inputs[i].disabled = !inputs[i].disabled;
|
||||
}
|
||||
|
||||
switchInputs();
|
||||
enableDisableInputs();
|
||||
setStatusTo('Установка...');
|
||||
antiCensorRu.installPac(pacKey, () => { setStatusTo('PAC-скрипт установлен.'); if(window) window.close(); });
|
||||
antiCensorRu.installPac(pacKey, () => {
|
||||
setStatusTo('PAC-скрипт установлен.');
|
||||
if(window) window.close();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -124,29 +124,28 @@ window.antiCensorRu = {
|
|||
};
|
||||
|
||||
window.ifPulled = false;
|
||||
window.onPulled = () => {};
|
||||
window.onPulledFuns = [];
|
||||
function pullFinished() {
|
||||
window.onPulledFuns.map( fun => fun() );
|
||||
window.ifPulled = true;
|
||||
}
|
||||
function execAfterPulled(fun) {
|
||||
if (window.ifPulled)
|
||||
fun();
|
||||
else
|
||||
window.onPulledFuns.push( fun );
|
||||
}
|
||||
|
||||
chrome.runtime.onInstalled.addListener( details => {
|
||||
console.log('Installing, reason:', details.reason);
|
||||
var myOnPulled;
|
||||
switch(details.reason) {
|
||||
case 'update':
|
||||
myOnPulled = () => window.antiCensorRu.installPac();
|
||||
break;
|
||||
return execAfterPulled( () => window.antiCensorRu.installPac() );
|
||||
case 'install':
|
||||
myOnPulled = () => {
|
||||
return execAfterPulled( () => {
|
||||
window.antiCensorRu.ifNotInstalled = true;
|
||||
chrome.runtime.openOptionsPage();
|
||||
};
|
||||
break;
|
||||
default:
|
||||
myOnPulled = () => {};
|
||||
}
|
||||
if (window.ifPulled)
|
||||
myOnPulled();
|
||||
else {
|
||||
var _onPulled = window.onPulled;
|
||||
window.onPulled = () => {_onPulled(); myOnPulled()};
|
||||
} );
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -163,8 +162,7 @@ window.antiCensorRu.pullFromStorage( () => {
|
|||
);
|
||||
console.log('Installed alarm listener.');
|
||||
|
||||
window.onPulled();
|
||||
window.ifPulled = true;
|
||||
return pullFinished();
|
||||
});
|
||||
|
||||
// PRIVATE
|
||||
|
|
Loading…
Reference in New Issue
Block a user