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 ]) {
|
if (details.tabId !== -1 && window.antiCensorRu.pacProvider && window.antiCensorRu.pacProvider.proxyIps && window.antiCensorRu.pacProvider.proxyIps[ details.ip ]) {
|
||||||
|
|
||||||
chrome.pageAction.setIcon({
|
chrome.pageAction.setIcon({
|
||||||
path: '/icons/rkn-empty.png',
|
path: '/icons/ribbon32.png',
|
||||||
tabId: details.tabId
|
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": "Ненавязчивый РосКомНадзор",
|
"name": "Ненавязчивый РосКомНадзор",
|
||||||
"description": "Аргументы против цензуры: https://git.io/vEkI9",
|
"description": "Аргументы против цензуры: https://git.io/vEkI9",
|
||||||
"version": "0.0.0.5",
|
"version": "0.0.0.7",
|
||||||
"icons": {
|
"icons": {
|
||||||
"128": "/icons/rkn-empty.png"
|
"128": "/icons/ribbon128.png"
|
||||||
},
|
},
|
||||||
"author": "ilyaigpetrov@gmail.com",
|
"author": "ilyaigpetrov@gmail.com",
|
||||||
"homepage_url": "https://github.com/ilyaigpetrov/anti-censorship-russia",
|
"homepage_url": "https://github.com/ilyaigpetrov/anti-censorship-russia",
|
||||||
|
|
|
@ -19,17 +19,17 @@ chrome.runtime.getBackgroundPage( backgroundPage => {
|
||||||
ul.insertBefore( li, _firstChild );
|
ul.insertBefore( li, _firstChild );
|
||||||
}
|
}
|
||||||
|
|
||||||
var targetRadio = () => {
|
var currentRadio = () => {
|
||||||
var id = antiCensorRu.currentPacProviderKey || 'none';
|
var id = antiCensorRu.currentPacProviderKey || 'none';
|
||||||
return document.querySelector('#'+id);
|
return document.querySelector('#'+id);
|
||||||
}
|
}
|
||||||
var checkChosenProvider = () => {
|
var checkChosenProvider = () => {
|
||||||
targetRadio().checked = true;
|
currentRadio().checked = true;
|
||||||
}
|
}
|
||||||
var triggerChosenProvider = () => {
|
var triggerChosenProvider = () => {
|
||||||
var event = document.createEvent('HTMLEvents');
|
var event = document.createEvent('HTMLEvents');
|
||||||
event.initEvent('change', false, true);
|
event.initEvent('change', false, true);
|
||||||
targetRadio().dispatchEvent(event);
|
currentRadio().dispatchEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
var radios = [].slice.apply( document.querySelectorAll('[name=pacProvider]') );
|
var radios = [].slice.apply( document.querySelectorAll('[name=pacProvider]') );
|
||||||
|
@ -39,15 +39,18 @@ chrome.runtime.getBackgroundPage( backgroundPage => {
|
||||||
if (pacKey === 'none')
|
if (pacKey === 'none')
|
||||||
return antiCensorRu.clearPac( () => window && window.close() );
|
return antiCensorRu.clearPac( () => window && window.close() );
|
||||||
|
|
||||||
function switchInputs() {
|
function enableDisableInputs() {
|
||||||
var inputs = document.querySelectorAll('[name="pacProvider"]');
|
var inputs = document.querySelectorAll('[name="pacProvider"]');
|
||||||
for (var i = 0; i < inputs.length; i++)
|
for (var i = 0; i < inputs.length; i++)
|
||||||
inputs[i].disabled = !inputs[i].disabled;
|
inputs[i].disabled = !inputs[i].disabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
switchInputs();
|
enableDisableInputs();
|
||||||
setStatusTo('Установка...');
|
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.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 => {
|
chrome.runtime.onInstalled.addListener( details => {
|
||||||
console.log('Installing, reason:', details.reason);
|
console.log('Installing, reason:', details.reason);
|
||||||
var myOnPulled;
|
|
||||||
switch(details.reason) {
|
switch(details.reason) {
|
||||||
case 'update':
|
case 'update':
|
||||||
myOnPulled = () => window.antiCensorRu.installPac();
|
return execAfterPulled( () => window.antiCensorRu.installPac() );
|
||||||
break;
|
|
||||||
case 'install':
|
case 'install':
|
||||||
myOnPulled = () => {
|
return execAfterPulled( () => {
|
||||||
window.antiCensorRu.ifNotInstalled = true;
|
window.antiCensorRu.ifNotInstalled = true;
|
||||||
chrome.runtime.openOptionsPage();
|
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.');
|
console.log('Installed alarm listener.');
|
||||||
|
|
||||||
window.onPulled();
|
return pullFinished();
|
||||||
window.ifPulled = true;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// PRIVATE
|
// PRIVATE
|
||||||
|
|
Loading…
Reference in New Issue
Block a user