From d6bf6510b4119911b1d6ee2d74aad51a52e4596b Mon Sep 17 00:00:00 2001 From: "Ilya Ig. Petrov" Date: Wed, 16 Nov 2016 10:12:53 -0800 Subject: [PATCH] Fix URL() errors in context-menus --- .../extension/1-sync-pac-script-with-pac-provider.js | 7 +++++++ .../minimalistic-pac-setter/extension/3-context-menus.js | 7 ++++--- .../extension/pages/other-unblocks/index.js | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/extensions/chromium/minimalistic-pac-setter/extension/1-sync-pac-script-with-pac-provider.js b/extensions/chromium/minimalistic-pac-setter/extension/1-sync-pac-script-with-pac-provider.js index 2157e93..f77e425 100755 --- a/extensions/chromium/minimalistic-pac-setter/extension/1-sync-pac-script-with-pac-provider.js +++ b/extensions/chromium/minimalistic-pac-setter/extension/1-sync-pac-script-with-pac-provider.js @@ -221,6 +221,13 @@ chrome.storage.local.get(null, (oldStorage) => { ); console.log('Alarm listener installed. We won\'t miss any PAC update.'); + window.addEventListener('online', () => { + + console.log('We are online, checking periodic updates...'); + antiCensorRu.setAlarms(); + + }); + if (antiCensorRu.ifFirstInstall) { // INSTALL console.log('Installing...'); diff --git a/extensions/chromium/minimalistic-pac-setter/extension/3-context-menus.js b/extensions/chromium/minimalistic-pac-setter/extension/3-context-menus.js index 8de0e16..66602a0 100755 --- a/extensions/chromium/minimalistic-pac-setter/extension/3-context-menus.js +++ b/extensions/chromium/minimalistic-pac-setter/extension/3-context-menus.js @@ -10,18 +10,19 @@ const removeProtocol = (url) => { - const link = createLink(url); + const link = new URL(url); return link.href.replace( link.protocol + '//', '' ); + }; - createMenuLinkEntry( 'Сайт доступен из-за границы? Is up?', (tab) => 'http://isup.me/'+ createLink(tab.url).hostname ); + createMenuLinkEntry( 'Сайт доступен из-за границы? Is up?', (tab) => 'http://isup.me/'+ new URL(tab.url).hostname ); window.reestrUrl = 'http://reestr.rublacklist.net/search/?q='; createMenuLinkEntry( 'Сайт в реестре блокировок?', (tab) => { const ifHost = confirm('Да — искать по домену\nНет — искать по IP (зависит от местоположения)'); - const hostname = createLink( tab.url ).hostname; + const hostname = new URL( tab.url ).hostname; if (ifHost) { return reestrUrl + hostname; } diff --git a/extensions/chromium/minimalistic-pac-setter/extension/pages/other-unblocks/index.js b/extensions/chromium/minimalistic-pac-setter/extension/pages/other-unblocks/index.js index 403071d..22a5f3c 100755 --- a/extensions/chromium/minimalistic-pac-setter/extension/pages/other-unblocks/index.js +++ b/extensions/chromium/minimalistic-pac-setter/extension/pages/other-unblocks/index.js @@ -27,7 +27,7 @@ document.body.innerHTML = ` site2pic [COPY]
brow shot [COPY]

Инструменты

- Сайт доступен из-за границы? isup.me
+ Сайт доступен из-за границы? isup.me