diff --git a/extensions/chromium/runet-censorship-bypass/src/extension-common/35-pac-kitchen-api.js b/extensions/chromium/runet-censorship-bypass/src/extension-common/35-pac-kitchen-api.js index f77aa9f..2c4eec6 100644 --- a/extensions/chromium/runet-censorship-bypass/src/extension-common/35-pac-kitchen-api.js +++ b/extensions/chromium/runet-censorship-bypass/src/extension-common/35-pac-kitchen-api.js @@ -74,7 +74,7 @@ ifProxyMoreDomains: { ifDisabled: true, dflt: false, - category: 'exceptions', + category: 'ownProxies', label: 'проксировать .onion, .i2p и OpenNIC', desc: 'Проксировать особые домены. Необходима поддержка со стороны СВОИХ прокси.', order: 8, diff --git a/extensions/chromium/runet-censorship-bypass/src/extension-common/70-menu-items.js b/extensions/chromium/runet-censorship-bypass/src/extension-common/70-menu-items.js new file mode 100644 index 0000000..cd34579 --- /dev/null +++ b/extensions/chromium/runet-censorship-bypass/src/extension-common/70-menu-items.js @@ -0,0 +1,63 @@ +'use strict'; + +{ + + window.apis.menus = { + + getItemsAsObject: () => ({ + + googleTranslate: { + title: 'Через Google Translate', + getUrl: (blockedUrl) => ( + 'https://translate.google.com/translate?hl=&sl=en&tl=ru&anno=2&sandbox=1&u=' + blockedUrl), + order: 0, + }, + + hostTracker: { + title: 'Из кэша Google', + getUrl: (blockedUrl) => 'http://webcache.googleusercontent.com/search?q=cache:' + blockedUrl, + order: 1, + }, + + archiveOrg: { + title: 'Из архива archive.org', + getUrl: (blockedUrl) => 'https://web.archive.org/web/*/' + blockedUrl, + order: 2, + }, + + otherUnblock: { + title: 'Разблокировать по-другому', + getUrl: (blockedUrl) => ('https://rebrand.ly/ac-unblock#' + blockedUrl), + order: 3, + }, + + antizapretInfo: { + title: 'Сайт в реестре блокировок?', + getUrl: (blockedUrl) => 'https://antizapret.info/index.php?search=' + new URL(blockedUrl).hostname, + order: 4, + }, + + support: { + title: 'Документация / Помощь / Поддержка', + getUrl: (blockedUrl) => 'https://rebrand.ly/ac-support', + order: 99, + }, + + }), + + getItemsAsArray: function() { + + const itemsObj = this.getItemsAsObject(); + return Object.keys(itemsObj).reduce((acc, key) => { + + acc.push(itemsObj[key]); + return acc; + + }, []) + .sort((a, b) => a.order - b.order); + + }, + + }; + +} diff --git a/extensions/chromium/runet-censorship-bypass/src/extension-common/75-context-menus.js b/extensions/chromium/runet-censorship-bypass/src/extension-common/75-context-menus.js new file mode 100644 index 0000000..87a7d24 --- /dev/null +++ b/extensions/chromium/runet-censorship-bypass/src/extension-common/75-context-menus.js @@ -0,0 +1,45 @@ +'use strict'; + +{ + + const chromified = window.utils.chromified; + + let seqId = 0; + + const createMenuLinkEntry = (title, tab2url) => { + + const id = (++seqId).toString(); + + chrome.contextMenus.create({ + id: id, + title: title, + contexts: ['browser_action'], + }, chromified((err) => { + + if(err) { + console.warn('Context menu error ignored:', err); + } + + })); + + chrome.contextMenus.onClicked.addListener((info, tab) => { + + if(info.menuItemId === id) { + Promise.resolve( tab2url( tab ) ) + .then( (url) => chrome.tabs.create({url: url}) ); + } + + }); + + }; + + window.apis.menus.getItemsAsArray().forEach((item) => { + + createMenuLinkEntry( + item.title, + (tab) => item.getUrl(tab.url), + ); + + }); + +} diff --git a/extensions/chromium/runet-censorship-bypass/src/extension-common/80-context-menus.js b/extensions/chromium/runet-censorship-bypass/src/extension-common/80-context-menus.js deleted file mode 100644 index 66e53e5..0000000 --- a/extensions/chromium/runet-censorship-bypass/src/extension-common/80-context-menus.js +++ /dev/null @@ -1,72 +0,0 @@ -'use strict'; - -{ - - const chromified = window.utils.chromified; - - let seqId = 0; - - const createMenuLinkEntry = (title, tab2url) => { - - const id = (++seqId).toString(); - - chrome.contextMenus.create({ - id: id, - title: title, - contexts: ['browser_action'], - }, chromified((err) => { - - if(err) { - console.warn('Context menu error ignored:', err); - } - - })); - - chrome.contextMenus.onClicked.addListener((info, tab) => { - - if(info.menuItemId === id) { - Promise.resolve( tab2url( tab ) ) - .then( (url) => chrome.tabs.create({url: url}) ); - } - - }); - - }; - - createMenuLinkEntry( - 'Сайт доступен из-за границы? Is up?', - (tab) => `data:text/html;charset=utf8,