'use strict'; { let seqId = 0; const createMenuLinkEntry = (title, tab2url) => { const id = (++seqId).toString(); chrome.runtime.onInstalled.addListener( () => chrome.contextMenus.create({ id: id, title: title, contexts: ['browser_action'] }, timeouted(() => { const err = chrome.runtime.lastError; if(err) { console.warn('CTX MENU ERR', err); throw 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,