From ae8dd6676da0740dbf6f1634aeb9f2488d919769 Mon Sep 17 00:00:00 2001 From: "Ilya Ig. Petrov" Date: Thu, 17 Nov 2016 11:09:10 -0800 Subject: [PATCH] Remove unused code in context menus --- .../extension/3-context-menus.js | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) 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 9417510..9875db4 100755 --- a/extensions/chromium/minimalistic-pac-setter/extension/3-context-menus.js +++ b/extensions/chromium/minimalistic-pac-setter/extension/3-context-menus.js @@ -1,6 +1,6 @@ 'use strict'; -+function() { +{ const createMenuLinkEntry = (title, tab2url) => chrome.contextMenus.create({ title: title, @@ -8,23 +8,16 @@ onclick: (menuInfo, tab) => Promise.resolve( tab2url( tab ) ).then( url => chrome.tabs.create({url: url}) ) }); - const removeProtocol = (url) => { - - const link = new URL(url); - return link.href.replace( link.protocol + '//', '' ); - - }; - createMenuLinkEntry( 'Сайт доступен из-за границы? Is up?', (tab) => 'http://isup.me/'+ new URL(tab.url).hostname ); createMenuLinkEntry( 'Сайт в реестре блокировок?', (tab) => 'https://antizapret.info/index.php?search=' + tab.url ); - createMenuLinkEntry( 'Из кэша Google', (tab) => 'http://webcache.googleusercontent.com/search?q=cache:' + removeProtocol(tab.url) ); - - createMenuLinkEntry( 'Из архива archive.org', (tab) => 'https://web.archive.org/web/*/' + removeProtocol(tab.url) ); + createMenuLinkEntry( 'Из архива archive.org', (tab) => 'https://web.archive.org/web/*/' + tab.url ); createMenuLinkEntry( 'Открыть веб прокси (не наш)', (tab) => 'https://kproxy.com' ); createMenuLinkEntry( 'Другие варианты разблокировки', (tab) => 'https://rebrand.ly/unblock#' + tab.url ); -}(); + createMenuLinkEntry( 'У меня проблемы с расширением!', (tab) => 'https://rebrand.ly/ac-support'); + +};