diff --git a/extensions/chromium/minimalistic-pac-setter/extnesion/block-informer.js b/extensions/chromium/minimalistic-pac-setter/extnesion/block-informer.js index 66a9d07..c01dfba 100755 --- a/extensions/chromium/minimalistic-pac-setter/extnesion/block-informer.js +++ b/extensions/chromium/minimalistic-pac-setter/extnesion/block-informer.js @@ -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 }); diff --git a/extensions/chromium/minimalistic-pac-setter/extnesion/icons/ribbon128.png b/extensions/chromium/minimalistic-pac-setter/extnesion/icons/ribbon128.png new file mode 100755 index 0000000..6dcadf1 Binary files /dev/null and b/extensions/chromium/minimalistic-pac-setter/extnesion/icons/ribbon128.png differ diff --git a/extensions/chromium/minimalistic-pac-setter/extnesion/icons/ribbon32.png b/extensions/chromium/minimalistic-pac-setter/extnesion/icons/ribbon32.png new file mode 100755 index 0000000..4133d55 Binary files /dev/null and b/extensions/chromium/minimalistic-pac-setter/extnesion/icons/ribbon32.png differ diff --git a/extensions/chromium/minimalistic-pac-setter/extnesion/icons/rkn-empty.png b/extensions/chromium/minimalistic-pac-setter/extnesion/icons/rkn-empty.png deleted file mode 100755 index 54574f9..0000000 Binary files a/extensions/chromium/minimalistic-pac-setter/extnesion/icons/rkn-empty.png and /dev/null differ diff --git a/extensions/chromium/minimalistic-pac-setter/extnesion/icons/rkn-warn.png b/extensions/chromium/minimalistic-pac-setter/extnesion/icons/rkn-warn.png deleted file mode 100755 index fb96ce3..0000000 Binary files a/extensions/chromium/minimalistic-pac-setter/extnesion/icons/rkn-warn.png and /dev/null differ diff --git a/extensions/chromium/minimalistic-pac-setter/extnesion/icons/rkn.png b/extensions/chromium/minimalistic-pac-setter/extnesion/icons/rkn.png deleted file mode 100755 index cc68ac3..0000000 Binary files a/extensions/chromium/minimalistic-pac-setter/extnesion/icons/rkn.png and /dev/null differ diff --git a/extensions/chromium/minimalistic-pac-setter/extnesion/manifest.json b/extensions/chromium/minimalistic-pac-setter/extnesion/manifest.json index 300a0b1..2d6e80f 100755 --- a/extensions/chromium/minimalistic-pac-setter/extnesion/manifest.json +++ b/extensions/chromium/minimalistic-pac-setter/extnesion/manifest.json @@ -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", diff --git a/extensions/chromium/minimalistic-pac-setter/extnesion/pages/choose-pac-provider/index.js b/extensions/chromium/minimalistic-pac-setter/extnesion/pages/choose-pac-provider/index.js index 3f990c6..7ffd79f 100755 --- a/extensions/chromium/minimalistic-pac-setter/extnesion/pages/choose-pac-provider/index.js +++ b/extensions/chromium/minimalistic-pac-setter/extnesion/pages/choose-pac-provider/index.js @@ -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 = ' '; 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(); + }); } } diff --git a/extensions/chromium/minimalistic-pac-setter/extnesion/sync-pac-script-with-pac-provider.js b/extensions/chromium/minimalistic-pac-setter/extnesion/sync-pac-script-with-pac-provider.js index c12813f..567ae0f 100755 --- a/extensions/chromium/minimalistic-pac-setter/extnesion/sync-pac-script-with-pac-provider.js +++ b/extensions/chromium/minimalistic-pac-setter/extnesion/sync-pac-script-with-pac-provider.js @@ -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