bunda1
Блин, ну как всё таки подружить кнопку с этим скриптом - http://rghost.ru/8mLXJZVRS
В 39 нормально было, а теперь выделенное слово не вставляется в поисковик. Или может кнопку вместо скрипта сделать, чтобы при выделении всплывало автоматически контекстное меню без нажатия ПКМ.
Лучше спросить у знающих - чем лезть не зная.
Отсутствует
bunda1
Блин, ну как всё таки подружить кнопку с этим скриптом - http://rghost.ru/8mLXJZVRS
В 39 нормально было, а теперь выделенное слово не вставляется в поисковик. Или может кнопку вместо скрипта сделать, чтобы при выделении всплывало автоматически контекстное меню без нажатия ПКМ.
А ты хочешь что бы скрипт при выделении слова открывал контекстное меню и при этом слово вставлялся в поисковик, как то это не удобно.
Отсутствует
bunda1
А с этим кодом авто-контест-меню можешь подружить Toggle Find, чтобы выделенное вставлялось в поиск.
/*======= Auto context menu on selection =======*/ this.setAttribute("type","checkox"); var prefs=Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch); try{ var cb_autoContextmenu = prefs.getBoolPref("cb_autoContextmenu" ); }catch(e){ prefs.setBoolPref("cb_autoContextmenu",true ); } this.checked = prefs.getBoolPref("cb_autoContextmenu" ); var autoContextmenu = { exec: function(event) { var prefs=Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch); if (event.button != 0) return; if( !prefs.getBoolPref("cb_autoContextmenu" ) ) return; selection = document.commandDispatcher.focusedWindow.getSelection(); if (!selection.isCollapsed && (selection.toString() != autoContextmenuPrevSelection)) { autoContextmenuPrevSelection = document.commandDispatcher.focusedWindow.getSelection().toString(); var mouseEvent = document.createEvent('MouseEvents'); if (mouseEvent) { mouseEvent.initMouseEvent('contextmenu', true, true, window, 1, event.screenX, event.screenY, event.clientX, event.clientY, false, false, false, false, 2, null); event.target.dispatchEvent(mouseEvent); } } } }; var autoContextmenuPrevSelection = null; document.addEventListener('mouseup', function(event) { autoContextmenu.exec(event); }, false);
Отредактировано villa7 (06-11-2015 10:44:32)
Лучше спросить у знающих - чем лезть не зная.
Отсутствует
villa7
А эсли так:
this._handleClick =()=> cbu.setPrefs(s, !cbu.getPrefs(s)); var s = 'CB.autoContextMenu'; cbu.isPref(s, true); toggleImage(); function toggleImage() self.checked = cbu.getPrefs(s); gPrefService.addObserver(s, toggleImage, false); addDestructor(()=> gPrefService.removeObserver(s, toggleImage) ); function autoContextMenu(e) { if ( e.button || !cbu.getPrefs(s) || gBrowser.currentURI.spec.startsWith("about:stylish-edit") || document.commandDispatcher.focusedWindow.getSelection().isCollapsed ) return; var mouseEvent = document.createEvent('MouseEvents'); mouseEvent.initMouseEvent('contextmenu', 1, 1, window, 1, e.screenX, e.screenY, e.clientX, e.clientY, 0, 0, 0, 0, 2, null); e.target.dispatchEvent(mouseEvent); }; addEventListener('mouseup', autoContextMenu, false, gBrowser);
или так: userChrome.js/Dblclick-ContextMenu.uc.js at master · ardiman/userChrome.js · GitHub
Отредактировано bunda1 (13-11-2015 21:10:52)
Отсутствует
bunda1
Ты был прав, оказалось что не работает через поиск Search Context, можно как то это починить? Через дефолтный поиск всё работает, и поиск и автоконтекст. Но и Find и Context Search работают вместе по ПКМ, без автоконтекста, вот как бы их втроём подружить.
(function () { // Context Search mini 2013-10-10 var options = { loadInBackground: false, // true - открывать вкладки в фоне pinnedEngineName: "", // оставить пустым если не нужно закреплять // определенный поисковик // примеры pinnedEngineName: "Google" или pinnedEngineName: "Яндекс" или pinnedEngineName: "" hideDefaultEngineInPopupSubMenu: false, // true - не добавлять поисковик по умолчанию в выпадающий список (подменю) поисковиков campactMenu: true, // true - поисковики в выпадающем списке (подменю) без назаваний campactMenuLengthPerLine: 3, // максимальное количество элементов в одной строке // от 3 до 10, по умолчанию 5 searchBySite: { enable: false, // true - добавить поисковики по сайту iconsOn: true, // true - добавить иконки для поисковиков по сайту useDefaultNamesList: true, // true - использовать список поисковиков по умолчанию addCustomNames: false, // true - добавить свои поисковики по сайту customNamesList: [ ["Rambler", ["Rambler", "Рамблер"]] ] // например ["Rambler", ["Rambler", "Рамблер"]] // первая ячека название на английском // вторая ячека массив с предполагаемыми именами поисковика // может состоять из нескольких значений // ["Name1", ["Name1"]], // ["Name2", ["Name2", "Имя2"]], // ["Name3", ["Name3", "Имя3", "Nev3"]] }, searchImageByText: { enable: false, // true - добавить поиск изображения по тексту useDefaultNamesList: true, addCustomNames: false, customNamesList: [ [ "name", "link", "image" ] ] }, searchByImage: { enable: false, // true - добавить поиск по изображению useDefaultNamesList: true, addCustomNames: false, customNamesList: [ [ "name", "link", "image" ] ] }, searchInCache: { enable: false, // true - добавить поиск в кэше // нужно доработать useDefaultNamesList: true, addCustomNames: false, customNamesList: [ [ "name", "link", "image" ] ] } }; function _localize(sid) { let strings = { en: { searchBySite: "Search this site", searchImageByText: "Search image by text", searchByImage: "Search by image", searchInCache: "Search this page in cache" }, ru: { searchBySite: "Поиск по этому сайту", searchImageByText: "Поиск изображения по тексту", searchByImage: "Поиск по изображению", searchInCache: "Поиск этой страницы в кэше" } }; //let locale = (Application.prefs.getValue("general.useragent.locale", false) || "en").match(/^[a-z]*/)[0]; function getBrowserUILocale() { // Browser UI locale return Components.classes["@mozilla.org/chrome/chrome-registry;1"] .getService(Components.interfaces.nsIXULChromeRegistry) .getSelectedLocale("global"); } let locale = ""; // ru, en if (!locale || locale == "") locale = getBrowserUILocale().match(/^[a-z]*/)[0]; _localize = function (sid) { return strings[locale] && strings[locale][sid] || strings.en[sid] || sid; }; return _localize.apply(this, arguments); } let XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; let XHTMLNS = "http://www.w3.org/1999/xhtml" var contextSearcherObj = { initialized: false, init: function() { if(this.initialized) return; this.initialized = true; this.nodeIds = { searchMenu: "contextSearchMiniByBunda1-menu", searchMenuPopup: "contextSearchMiniByBunda1-popup", searchByImageMenu: "contextSearchMiniByBunda1-image-search-menu", searchByImageMenuPopup: "contextSearchMiniByBunda1-image-search-popup" }; if (document.getElementById(this.nodeIds.searchMenu)) return; var searchService = Cc["@mozilla.org/browser/search-service;1"].getService(Ci.nsIBrowserSearchService); var contextMenu = document.getElementById("contentAreaContextMenu"); var searchSelect = document.getElementById("context-searchselect"); searchSelect.style.display = "none"; var searchMenu = contextMenu.insertBefore(document.createElementNS(XULNS, "menu"), searchSelect); this.searchService = searchService; this.contextMenu = contextMenu; this.searchSelect = searchSelect; this.searchMenu = searchMenu; this.param = { isPinnedEngine: false, pinnedEngineName: "" }; try { this.createSearchMenu(); if (options.searchByImage.enable) this.createSearchByImageMenu(); } catch (ex) { this.destroy(); Components.utils.reportError(ex); return; } if (options.campactMenu) this.loadStyles(); var observeStatus = new MutationObserver(function () { searchMenu.hidden = searchSelect.hidden; }); observeStatus.observe(searchSelect, { attributes: true, attributeFilter: ["hidden"] }); /*var prefService = Components.classes["@mozilla.org/preferences-service;1"] .getService(Components.interfaces.nsIPrefService); this.branch = prefService.getBranch("browser.search."); if (!("addObserver" in this.branch)) this.branch.QueryInterface(Components.interfaces.nsIPrefBranch2); this.branch.addObserver("", this, false);*/ /* var searchPref = "browser.search."; gPrefService.addObserver(searchPref, this, false);*/ /*let os = Cc["@mozilla.org/observer-service;1"]. getService(Ci.nsIObserverService); os.addObserver(this, "browser-search-engine-modified", false);*/ Services.obs.addObserver(this, "browser-search-engine-modified", false); Services.ww.registerNotification(this); addEventListener("popupshowing", this, false, contextMenu); addDestructor(function (reason) { observeStatus.disconnect(); Services.ww.unregisterNotification(this); //this.branch.removeObserver("", this); //gPrefService.removeObserver(searchPref, this, false); //os.removeObserver(this, "browser-search-engine-modified", false); Services.obs.removeObserver(this, "browser-search-engine-modified", false); this.destroy(); if (reason != "destructor") this.unloadStyles(); }, this); }, destroy: function() { if(!this.initialized) return; this.initialized = false; var contextMenu = this.contextMenu; if (!contextMenu) return; if (this.searchMenu) contextMenu.removeChild(this.searchMenu); if (this.searchByImageMenu) contextMenu.removeChild(this.searchByImageMenu); if (this.searchSelect) this.searchSelect.style.removeProperty("display"); }, update: function() { this.searchMenu.textContent = ""; this.createSearchMenu(); delete this.updateTimeoutID; }, get isSeaMonkey() { delete this.isSeaMonkey; return this.isSeaMonkey = Services.appinfo.name == "SeaMonkey"; }, observe: function(subject, topic, data) { switch (topic) { case "domwindowclosed": if (subject.document.documentElement.getAttribute("windowtype") == "Browser:SearchManager") { this.update(); } break; /*case "nsPref:changed": switch (data) { case "defaultenginename": case "browser.search.defaultenginename": this.update(); break; } break;*/ case "browser-search-engine-modified": /*switch (data) { case "engine-default": case "engine-current": // engine-default case "engine-changed": case "engine-removed":*/ if (typeof this.updateTimeoutID == "number") { window.clearTimeout(this.updateTimeoutID); delete this.updateTimeoutID; } let _this = this; this.updateTimeoutID = window.setTimeout(function () { _this.update(); }, 1000); /*break; }*/ break; } }, handleEvent: function(e) { //var contextMenu = this.contextMenu; //var menu = this.menu; //var imageMenu = this.imageMenu; switch (e.type) { case "popupshowing": this.popupshowingEvent(e); break; } }, popupshowingEvent: function(e) { var trgId = e.target.id; if (trgId) { if (trgId == "contentAreaContextMenu") { this.contextMenuPopup(e); if (this.searchByImageMenu) this.searchByImageMenuPopup(e); } else if (trgId == this.nodeIds.searchMenuPopup) this.searchMenuPopup(e); } }, _stylesLoaded: false, loadStyles: function() { if(this._stylesLoaded) return; this._stylesLoaded = true; var sss = this.sss; var cssURI = this.cssURI = this.makeCSSURI(); if(!sss.sheetRegistered(cssURI, sss.USER_SHEET)) sss.loadAndRegisterSheet(cssURI, sss.USER_SHEET); }, unloadStyles: function() { if(!this._stylesLoaded) return; this._stylesLoaded = false; var sss = this.sss; if(sss.sheetRegistered(this.cssURI, sss.USER_SHEET)) sss.unregisterSheet(this.cssURI, sss.USER_SHEET); }, get sss() { delete this.sss; return this.sss = Components.classes["@mozilla.org/content/style-sheet-service;1"] .getService(Components.interfaces.nsIStyleSheetService); }, makeCSSURI: function() { var cssStr = '\ @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");\n\ @-moz-document url("' + window.location.href + '") {\n\ #' + this.nodeIds.searchMenuPopup + ' > hbox > .menuitem-iconic[campactMenu="true"] {\n\ /*width: 2em !important;*/\n\ }\n\ #' + this.nodeIds.searchMenuPopup + ' > hbox > .menuitem-iconic[campactMenu="true"] * {\n\ /*padding-left: 0 !important;\n\ padding-right: 0 !important;\n\ margin-left: 0 !important;\n\ margin-right: 0 !important;*/\n\ }\n\ #' + this.nodeIds.searchMenuPopup + ' > hbox > spacer[campactMenu="true"] {\n\ width: 2em !important;\n\ }\n\ #' + this.nodeIds.searchMenuPopup + ' > hbox > .menuitem-iconic[campactMenu="true"] {\n\ width: 3em !important;\n\ height: 2em !important;\n\ }\n\ #' + this.nodeIds.searchMenuPopup + ' > hbox >.menuitem-iconic[campactMenu="true"] > image {\n\ margin-left: .8em !important;\n\ }\n\ }\n\ '; return Services.io.newURI("data:text/css," + encodeURIComponent(cssStr), null, null); }, searchCommandHandler: function(event, trg) { var inBg = options.loadInBackground || false; if (event.type == "click" && event.button && event.button == 1) { inBg = !inBg; } var searchBySite = ""; if (event.target.hasAttribute("searchBySite")) { searchBySite = " site:" + gBrowser.currentURI.host; } else if (event.target.hasAttribute("searchInCache")) { searchBySite = content.location.href; } let selectedText = this.isSeaMonkey ? content.getSelection().toString() : getBrowserSelection(); if (event.target.engine.imageLink) { gBrowser.loadOneTab(event.target.engine.imageLink + /*getBrowserSelection()*/ selectedText, { relatedToCurrent: true, inBackground: inBg }); } else if (event.target.engine.cacheLink) { gBrowser.loadOneTab(event.target.engine.cacheLink + /*getBrowserSelection()*/ searchBySite, { relatedToCurrent: true, inBackground: inBg }); } else { let submission = event.target.engine.getSubmission(/*getBrowserSelection()*/ selectedText + searchBySite, null); gBrowser.loadOneTab(submission.uri.spec, { relatedToCurrent: true, postData: submission.postData, inBackground: inBg }); } if (trg == "menu") { setTimeout(function () { document.getElementById("contentAreaContextMenu").hidePopup(); }, 0); } }, contextMenuPopup: function(e) { var searchService = this.searchService; var contextMenu = this.contextMenu; var menu = this.searchMenu; var thisIsSM = this.isSeaMonkey; function getMenuLabel(str) { try { if (thisIsSM) { let bundle = document.getElementById("contentAreaCommandsBundle"); return bundle.getFormattedString(str, [engineName, selectedText]); } else return gNavigatorBundle.getFormattedString(str, [engineName, selectedText]); } catch (ex) { return false; } } for(let i in searchFormattedString) { menuLabel = getMenuLabel(searchFormattedString[i]); if (menuLabel) break; else if (!menuLabel && i == searchFormattedString.length-1) menuLabel = engineName; } menu.label = menuLabel; }, searchMenuPopup: function(e) { var popup = e.target; var items; if (!popup.items) { var itemsObj = popup.getElementsByTagName("menuitem"); popup.items = []; Array.slice(itemsObj).forEach(function(elem) { if (typeof elem == "object" && elem.nodeName == "menuitem" && elem.hasAttribute("searchBySite") || elem.hasAttribute("searchInCache")) popup.items.push(elem); }); items = popup.items; } else { items = popup.items; } var menus; if (!popup.menus) { var itemsObj = popup.getElementsByTagName("menu"); popup.menus = []; Array.slice(itemsObj).forEach(function(elem) { if (typeof elem == "object" && elem.nodeName == "menu" && elem.hasAttribute("searchBySite") || elem.hasAttribute("searchInCache")) popup.menus.push(elem); }); menus = popup.menus; } else { menus = popup.menus; } var siteSearchDomain; var gBrowser = gBrowser || getBrowser(); function isDomain() { try { siteSearchDomain = gBrowser.currentURI.host; } catch (ex) { return false; } return true; } if (isDomain()) { items.forEach(function(elem) { //if (elem.hasAttribute("searchBySite")) // elem.setAttribute("tooltiptext", siteSearchDomain); elem.removeAttribute("disabled"); }); menus.forEach(function(elem) { if (elem.hasAttribute("searchBySite")) elem.setAttribute("tooltiptext", siteSearchDomain); else if (elem.hasAttribute("searchInCache")) elem.setAttribute("tooltiptext", content.document.title); elem.removeAttribute("disabled"); }); } else { items.forEach(function(elem) { //if (elem.hasAttribute("searchBySite")) // elem.removeAttribute("tooltiptext"); elem.setAttribute("disabled", "true"); }); menus.forEach(function(elem) { if (elem.hasAttribute("searchBySite") || elem.hasAttribute("searchInCache")) elem.removeAttribute("tooltiptext"); elem.setAttribute("disabled", "true"); }); } }, createSearchMenu: function() { var searchService = this.searchService; var contextMenu = this.contextMenu; var menu = this.searchMenu; var engines = searchService.getVisibleEngines({}); menu.setAttribute("id", this.nodeIds.searchMenu); menu.setAttribute("class", "menu-iconic"); this.param.isPinnedEngine = false; this.param.pinnedEngineName = ""; var pinnedEngineName = options.pinnedEngineName; if (pinnedEngineName != "") { for (let i in engines) { if (engines[i].name != pinnedEngineName) continue; menu.setAttribute("label", engines[i].name); menu.setAttribute("image", engines[i].iconURI.spec); menu.engine = engines[i]; this.param.isPinnedEngine = true; this.param.pinnedEngineName = pinnedEngineName; break; } } let rEngine = this.isSeaMonkey ? "currentEngine" : "defaultEngine"; if (!this.param.isPinnedEngine) { menu.setAttribute("label", searchService[rEngine].name); menu.setAttribute("image", searchService[rEngine].iconURI.spec); menu.engine = searchService[rEngine]; } menu.gObj = this; menu.setAttribute("onclick", "if (event.target == this && event.target.engine) this.gObj.searchCommandHandler(event, 'menu');"); menu.popup = menu.appendChild(document.createElementNS(XULNS, "menupopup")); var popup = this.searchMenu.popup; popup.setAttribute("id", this.nodeIds.searchMenuPopup); popup.setAttribute("position", "after_end"); var counterMaxLength = options.campactMenuLengthPerLine; if (typeof counterMaxLength != "number" || 3 > counterMaxLength || counterMaxLength > 10) counterMaxLength = 5; var counter = 0; var hBox; function itemCreateCampact(engine, last) { if(counter == 0) { hBox = document.createElementNS(XULNS, "hbox"); let item = document.createElementNS(XULNS, "spacer"); //item.setAttribute("style", "width: 2em"); item.setAttribute("campactMenu", "true"); hBox.appendChild(item); } counter++; var item = document.createElementNS(XULNS, "menuitem"); item.engine = engine; item.setAttribute("class", "menuitem-iconic"); item.setAttribute("tooltiptext", engine.name); //item.setAttribute("src", engine.iconURI.spec); var image = document.createElementNS(XULNS, "image"); image.setAttribute("src", engine.iconURI.spec); item.appendChild(image); //item.setAttribute("style", "max-width: 2em"); item.setAttribute("campactMenu", "true"); hBox.appendChild(item); if (counter == counterMaxLength || last) { popup.appendChild(hBox); counter = 0; } } var separator = {}; function itemCreate(engine, reason) { var item = document.createElementNS(XULNS, "menuitem"); item.setAttribute("class", "menuitem-iconic"); item.engine = engine; if (reason && !separator[reason]) { /*let sep = separator[reason] = document.createElementNS(XULNS, "menuseparator"); sep.setAttribute(reason, "true"); popup.appendChild(sep); let item = document.createElementNS(XULNS, "label"); //item.setAttribute("class", "menuitem-iconic"); item.setAttribute("value", _localize(reason) + ":"); item.setAttribute("style", "padding-left: 2em"); popup.appendChild(item);*/ if (!separator["menuseparator"]) { let sep = separator["menuseparator"] = document.createElementNS(XULNS, "menuseparator"); popup.appendChild(sep); } let subMenu = separator[reason] = document.createElementNS(XULNS, "menu"); subMenu.setAttribute("class", "menu-iconic"); subMenu.setAttribute("label", _localize(reason)); subMenu.setAttribute(reason, "true"); subMenu.popup = subMenu.appendChild(document.createElementNS(XULNS, "menupopup")); popup.appendChild(subMenu); } if (reason == "searchBySite") { item.setAttribute("label", engine.name); if (options.searchBySite.iconsOn) { item.setAttribute("src", engine.iconURI.spec); } item.setAttribute(reason, "true"); } else if (reason == "searchImageByText" || reason == "searchInCache") { item.setAttribute("label", engine.name); item.setAttribute("src", engine.iconURI_spec); item.setAttribute(reason, "true"); } else { item.setAttribute("label", engine.name); item.setAttribute("src", engine.iconURI.spec); } //popup.appendChild(item); if (reason) { let subMenu = separator[reason]; subMenu.popup.appendChild(item); } else popup.appendChild(item); } for (let i in engines) { if (options.hideDefaultEngineInPopupSubMenu && this.param.isPinnedEngine && engines[i].name == pinnedEngineName || options.hideDefaultEngineInPopupSubMenu && !this.param.isPinnedEngine && engines[i].name == searchService[rEngine].name) { continue; } if (options.campactMenu) itemCreateCampact(engines[i], i == engines.length-1); else itemCreate(engines[i]); } function searchBySite_itemCreate() { var namesList = []; if (options.searchBySite.useDefaultNamesList) { let defaultNamesList = [ ["Google", ["Google"]], ["Yandex", ["Yandex", "Яндекс"]], ["Yahoo", ["Yahoo"]], ["Bing", ["Bing"]], ["DuckDuckGo", ["DuckDuckGo"]] ]; namesList = namesList.concat(defaultNamesList); } if (options.searchBySite.addCustomNames && Array.isArray(options.searchBySite.customNamesList)) { namesList = namesList.concat(options.searchBySite.customNamesList); } //let i_skips = []; function isNameExist(names, engine) { for (let i in names) { if (names[i] != engine && i != names.length-1) continue; else if (names[i] == engine) return true; return false; } } namesList.forEach(function(elem) { for (let i in engines) { if (/*i_skips.indexOf(i) != -1 ||*/ !(elem[1].some(function(listName) listName == engines[i].name)) /*!isNameExist(elem[1], engines[i].name)*/ /*elem[1].indexOf(engines[i].name) == -1*/) continue; itemCreate(engines[i], "searchBySite"); //i_skips.push(i); break; } }); } if (options.searchBySite.enable) { searchBySite_itemCreate(); } function searchImageByText_itemCreate() { var namesList = []; if (options.searchImageByText.useDefaultNamesList) { let defaultNamesList = [ [ "Google", "https://www.google.ru/search?tbm=isch&q=", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAB41BMVEUAAAB7wUJ6wUJ6wUJ6wUL1nxn1oBn1oBn1nxl6wUJ6wUJ6wUJrvUT1mxr1nxn1nxlfu0Z8wkLznhv0mhp6wUJWuUdaukfLrSv4rhX1nxl5wUJyv0TQrCnyjhz1kyH2pRj1oBl7wkNbukfzjR3zkxv1liHuMDXuGTf2rxN7wUJeu0apuDfzjhz1nBvuNizwZi/3sxP2pBh9wkGvuTbvoRvuJy/xcC33qRhbl7F2uGOMwT94havnRTzuMjjwTTNRislRjcZ5uVpnvU0rk9Fhjr3aTkPuLTVQkM1PgsKHxD9/w0JfnKsAouPtHCTvQDRRkM1Qjstfn6p2jLHvOzDvQDVQkM1Rkc1RjstOh8Z/h6buLirtGyTvOzHvQDXwQDVPkcftPzdRkc1QkMxRkM0xlNLuNSzwQDXvQDVQkM1Rkc1QkM1Rkc3vQDTvQDXvQDXwQDV7wUL2oBr1nxn2oBl6wUJ7wkN9wkF9wkJ6wUP0lRv3qhf1oBn4rhX3qhb1nhp8wkL0nBruGjLuIzf3qRZ/w0JcukbuLCntIzl+wkFkvEbtGyVPhMRyv0QAmNfuLCruMDVRkc1ViccKltTvQDVRhcUA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ALDz/wCw8/8AsPP/ALDz/wCw8/8AsPP/Aa3x/weW4P8Hld8PALDzAACw8wAMmOH///////////////////////////////////////////////////////////8GpOr/DJjhigCy9AAAsvQAEZzk//////8VpOn/Fbr1/xW69f+c4fv/ddb5/xW69f8VuvX/Fbr1/x2o6v//////AbT0/w+f5v8RnOQ8ALX1ABeg5v//////F6bp/xe48/8XuPP/hdf3/4XX9/80wPT/F7jz/xe48/8dqOr//////wC49v8IsPD/F6DmpQC49gAepOn//////wOe6P8DrvD/A67w/1/G8/9fxvP/TsLy/wSu8P8DrvD/CaHo//////8Au/j/ALv4/xep7f8epOlmJKjs//////9GvfD/ft78/37e/P///////////+f5/v+A3/z/ft78/03A8P//////AL75/wC++f8Huvf/JKjszyut7///////OLvw/2Pa/P9j2vz///////////+R5f3/Y9r8/2Pa/P8/vvD//////wDC+v8Awvr/CL74/yut788xsfL//////ya48P9F1fz/RdX8///////N8/7/RdX8/0XV/P9F1fz/Lrnw//////8Axfv/AMX7/yW29P8xsfJmOLX1//////8XtfD/KNH8/yjR/P/8/v//UNr9/yjR/P8o0fz/KNH8/x+48P//////AMn8/xTC+v84tfWlAMn8AD659///////ALHw/wCx8P8AsfD/Gbjw/wCx8P8AsfD/ALHw/wCx8P8JtPD//////wPM/v83u/j/Prn3PADN/gBDvfr///////////////////////////////////////////////////////////8lxvz/Q736igTR/gAE0f4ASMD8/xLV//8S1f//EtX//xLV//8S1f//EtX//xLV//8S1f//EtX//xLV//8Y0///R8D8/0jA/A8S1f8AEtX/AEzD/uRa2f//XNz//1zc//9c3P//XNz//1zc//9c3P//XNz//1zc//9c3P//Ucv+/0zD/nhc3P8AXNz/AFzc/wBPxf97T8X/5E/F//9Pxf//T8X//0/F//9Pxf//T8X//0/F//9Pxf//T8X//0/F/5Zc3P8AXNz/AFzc/wBc3P8AAA8AAAAHAAAAAwAAAAMAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAQAAAAMAAAADAAAABwAAAA8AAA==" ] ]; namesList = namesList.concat(defaultNamesList); } if (options.searchImageByText.addCustomNames && Array.isArray(options.searchImageByText.customNamesList)) { namesList = namesList.concat(options.searchImageByText.customNamesList); } namesList.forEach(function(elem) { let engine = {}; engine.name = elem[0]; engine.imageLink = elem[1]; engine.iconURI_spec = elem[2]; itemCreate(engine, "searchImageByText"); }); } if (options.searchImageByText.enable) { searchImageByText_itemCreate(); } function searchInCache() { var namesList = []; if (options.searchInCache.useDefaultNamesList) { let defaultNamesList = [ [ "Google", "https://www.google.com/search?q=cache:", "data:image/x-icon;base64,AAABAAIAEBAAAAAAAAB9AQAAJgAAACAgAAAAAAAA8gIAAKMBAACJUE5HDQoaCgAAAA1JSERSAAAAEAAAABAIBgAAAB/z/2EAAAFESURBVDjLpZNJSwNBEIXnt4lE4kHxovgT9BDwJHqPy0HEEOJBiAuCRg+KUdC4QS4KrpC4gCBGE3NQ48JsnZ6eZ3UOM6gjaePhQU93v6+qq2q0pqgeJj2S8EdJT1hr0OxBtKCD5iEd8QxDYpvhvOBAuMDKURX9C9aPu4GA1GEVkzvMg10UBfYveWAWgYAP00V01fa+R9M2bA51wJvhIn3qR+ybt3D3JNQBE5sMjCIOLFpoHzOwdsLRO22qA6R6kiZiWwxUvy/PUQZIhYZ1vFM9cvcOOsYNdcBgysISdSJBnZjJMlR0Fw8vAp0xoz5gao/h+NZBy4i/10XGwrPA+hmvDyhVRG2Avu/LwcrkFADZa16L1h330w1RNgc3DiJzCpPYRm1bpveXX11clQR28xwblHpk1vq1iP/5mcoS0CoXDZiL0vsJ+dzfl+3T/VYAAAAASUVORK5CYIKJUE5HDQoaCgAAAA1JSERSAAAAIAAAACAIBgAAAHN6evQAAAK5SURBVFjDxVfrSxRRFJ9/Jta/oyWjF5XQm6D6EkHRgygIIgjUTcueVgqVWSRRkppEUQYWWB8ye1iGWilWlo/Ude489s7M6Zw7D9dlt53dmd29cFiWvXvO77x+51xpaaUsoSxBaUWZQ4ECy5xji2xKZDyCMlMEw6lCNiOSgw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KCj/LCws/zAwMP8rKyv/KSkp/ykpKf8qKir/MDAw/y8vL/8rKyv/ERER/wAAAP8BAQH/AgIC/wICAv8BAQH/AAAA/wEBAf8CAgL/AAAA/wUFBf+rq6v/7Ozs/3V1df8AAAD/AAAA/zs7O//j4+P/4uLi/zo6Ov8AAAD/AAAA/wQEBP+rq6v/7Ozs/4WFhf8AAAD/AAAA/zw8PP/k5OT/4+Pj/zk5Of8AAAD/BQUF/wAAAP8BAQH/AQEB/wAAAP8BAQH/AAAA/wMDA/8AAAD/ISEh/+Hh4f//////uLi4/wkJCf8CAgL/bW1t////////////bW1t/wICAv8CAgL/ISEh/+Hh4f//////wMDA/woKCv8CAgL/bW1t////////////bW1t/wEBAf8HBwf/AgIC/wEBAf8AAAD/AQEB/wEBAf8AAAD/AwMD/wAAAP8cHBz/2NjY//////+4uLj/BwcH/wAAAP9lZWX//f39//////9nZ2f/AAAA/wAAAP8ZGRn/2dnZ//////+3t7f/CAgI/wAAAP9oaGj//Pz8//7+/v9mZmb/AAAA/wYGBv8AAAD/AgIC/wEBAf8BAQH/AwMD/wICAv8BAQH/AAAA/xsbG//Y2Nj//////7i4uP8GBgb/AAAA/2pqav///////v7+/2VlZf8AAAD/AAAA/xsbG//Y2Nj//////7m5uf8HBwf/AAAA/2VlZf///////////2VlZf8AAAD/BQUF/wEBAf8DAwP/AQEB/wAAAP8AAAD/AAAA/wQEBP8AAAD/HR0d/9ra2v//////urq6/wgICP8AAAD/Z2dn////////////aGho/wAAAP8AAAD/HR0d/9vb2///////urq6/wcHB/8AAAD/aGho////////////aWlp/wAAAP8FBQX/AAAA/wEBAf8BAQH/AAAA/wAAAP8AAAD/AgIC/wAAAP8cHBz/29vb//////+4uLj/BgYG/wAAAP9mZmb///////////9nZ2f/AAAA/wAAAP8aGhr/2tra//////+4uLj/BwcH/wAAAP9lZWX///////////9mZmb/AAAA/wUFBf8AAAD/AAAA/wAAAP8AAAD/AAAA/wEBAf8DAwP/AAAA/xwcHP/a2tr//////7i4uP8GBgb/AAAA/2ZmZv///////////2dnZ/8AAAD/AAAA/xsbG//b29v//////7m5uf8JCQn/AAAA/2hoaP///////////2dnZ/8AAAD/BQUF/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wMDA/8AAAD/Ghoa/9nZ2f//////ubm5/wYGBv8AAAD/ZmZm////////////ZmZm/wAAAP8AAAD/Gxsb/9ra2v//////uLi4/wcHB/8AAAD/ZmZm//7+/v/+/v7/ZmZm/wAAAP8EBAT/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AwMD/wAAAP8aGhr/2NjY//////+6urr/BgYG/wAAAP9mZmb///////////9mZmb/AAAA/wAAAP8aGhr/2NjY//////+5ubn/BwcH/wAAAP9nZ2f//v7+//////9nZ2f/AAAA/wQEBP8AAAD/AAAA/wAAAP8AAAD/AAAA/wEBAf8DAwP/AAAA/xwcHP/a2tr//////7q6uv8HBwf/AAAA/2ZmZv///////////2ZmZv8AAAD/AAAA/xoaGv/Y2Nj//////7i4uP8GBgb/AAAA/2ZmZv/9/f3//v7+/2ZmZv8AAAD/BAQE/wAAAP8AAAD/AAAA/wAAAP8AAAD/AQEB/wMDA/8AAAD/HBwc/9vb2///////urq6/wgICP8AAAD/ZmZm////////////Z2dn/wAAAP8AAAD/Gxsb/9nZ2f//////urq6/wcHB/8AAAD/Z2dn////////////Z2dn/wAAAP8EBAT/AAAA/wAAAP8AAAD/AAAA/wAAAP8CAgL/BAQE/wAAAP8dHR3/29vb//////+8vLz/BwcH/wAAAP9nZ2f///////////9mZmb/AAAA/wAAAP8bGxv/29vb//////+6urr/BgYG/wAAAP9nZ2f///////////9mZmb/AAAA/wYGBv8AAAD/AQEB/wEBAf8AAAD/AQEB/wMDA/8DAwP/AAAA/x0dHf/a2tr/+fn5/7CwsP8GBgb/AAAA/2pqav/5+fn/+fn5/2tra/8AAAD/AAAA/xwcHP/Z2dn/+fn5/7m5uf8JCQn/AAAA/2xsbP/5+fn/+fn5/2tra/8AAAD/BwcH/wEBAf8CAgL/AQEB/wEBAf8CAgL/AwMD/wMDA/8AAAD/FxcX/9zc3P//////l5eX/wcHB/8DAwP/YGBg////////////XFxc/wQEBP8FBQX/GBgY/97e3v//////s7Oz/wkJCf8EBAT/XV1d////////////W1tb/wEBAf8EBAT/AQEB/wMDA/8DAwP/AAAA/wEBAf8DAwP/AQEB/wEBAf8AAAD/LS0t/1RUVP8hISH/AAAA/wAAAP8BAQH/TExM/0tLS/8AAAD/AAAA/wAAAP8AAAD/LS0t/1NTU/8bGxv/AAAA/wAAAP8BAQH/TExM/0tLS/8BAQH/AAAA/wEBAf8AAAD/AQEB/wAAAP8CAgL/AQEB/wEBAf8AAAD/BwcH/8XFxf++vr7/tbW1/729vf/Kysr/y8vL/8fHx/+2trb/tra2/8bGxv/Ly8v/yMjI/8rKyv+7u7v/tbW1/8DAwP/Ly8v/y8vL/8XFxf+1tbX/srKy/8nJyf9PT0//AAAA/wYGBv8CAgL/AAAA/wEBAf8AAAD/AQEB/wEBAf8KCgr//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////3Jycv8AAAD/BwcH/wEBAf8DAwP/AQEB/wAAAP8BAQH/AAAA/wgICP95eXn/fX19/319ff9/f3//gICA/4CAgP+BgYH/gICA/39/f/+BgYH/gYGB/4CAgP+AgID/gICA/4GBgf+AgID/gICA/4GBgf9/f3//fX19/3l5ef9+fn7/MjIy/wAAAP8DAwP/AQEB/wEBAf8AAAD/AQEB/wICAv8AAAD/BgYG/4+Pj/+Tk5P/j4+P/4uLi/+Hh4f/hISE/4ODg/+CgoL/gYGB/4KCgv+CgoL/goKC/4KCgv+BgYH/f39//39/f/+EhIT/hoaG/4eHh/+MjIz/kpKS/5WVlf8uLi7/AAAA/wMDA/8AAAD/AAAA/wEBAf8AAAD/AQEB/wQEBP8EBAT/SUlJ/1RUVP+BgYH/wsLC/////////////////////////////////////////////////////////////////////////////f39/6+vr/9iYmL/S0tL/xkZGf8AAAD/AwMD/wEBAf8DAwP/AQEB/wEBAf8BAQH/AAAA/wYGBv8AAAD/AAAA/wAAAP8AAAD/AQEB/wgICP9RUVH/paWl/8rKyv/a2tr/+fn5///////5+fn/2tra/8vLy/+ampr/T09P/xQUFP8DAwP/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AQEB/wEBAf8CAgL/AQEB/wICAv8BAQH/AAAA/wQEBP8EBAT/AwMD/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/xsbG/9nZ2f/i4uL/2dnZ/8ZGRn/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AgIC/wQEBP8CAgL/AgIC/wAAAP8DAwP/AgIC/wEBAf8AAAD/AQEB/wEBAf8AAAD/AgIC/wICAv8BAQH/AgIC/wMDA/8DAwP/AgIC/wQEBP8HBwf/AAAA/wAAAP8AAAD/AAAA/wAAAP8HBwf/BQUF/wMDA/8BAQH/AQEB/wMDA/8CAgL/AQEB/wEBAf8CAgL/AQEB/wAAAP8CAgL/AgIC/wICAv8AAAD/AAAA/wMDA/8CAgL/AwMD/wMDA/8BAQH/AQEB/wUFBf8DAwP/AgIC/wAAAP8EBAT/BwcH/wcHB/8HBwf/BAQE/wICAv8BAQH/AgIC/wEBAf8BAQH/AgIC/wICAv8BAQH/AAAA/wEBAf8AAAD/AgIC/wICAv8AAAD/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=" ] ]; namesList = namesList.concat(defaultNamesList); } if (options.searchInCache.addCustomNames && Array.isArray(options.searchInCache.customNamesList)) { namesList = namesList.concat(options.searchInCache.customNamesList); } namesList.forEach(function(elem) { let engine = {}; engine.name = elem[0]; engine.cacheLink = elem[1]; engine.iconURI_spec = elem[2]; itemCreate(engine, "searchInCache"); }); } if (options.searchInCache.enable) { searchInCache(); } popup.gObj = this; //popup.setAttribute("oncommand", "if (!event.target.engine) return; var csObj = this.gObj || document.getElementById('contextSearchMiniByBunda1-context-popup').gObj; csObj.searchCommandHandler(event);"); popup.setAttribute("oncommand", "if (!event.target.engine || event.target.nodeName == 'menu') return; this.gObj.searchCommandHandler(event);"); popup.setAttribute("onclick", "checkForMiddleClick(this, event);"); }, searchByImageCommandHandler: function(event) { var inBg = options.loadInBackground || false; if (event.type == "click" && event.button && event.button == 1) { inBg = !inBg; } var searchByImageMenu = this.searchByImageMenu; var link = event.target.link; var imageLink = searchByImageMenu.imageSrc; if (imageLink.indexOf("data:") == 0) { this.searchByImageByData(imageLink, inBg); return; } else if (imageLink.indexOf("file:") == 0) { this.searchByImageByFile(imageLink, inBg); return; } else { imageLink = encodeURIComponent(imageLink) } var gBrowser = gBrowser || getBrowser(); gBrowser.loadOneTab(link + imageLink, { relatedToCurrent: true, inBackground: inBg }); }, // searchByImageByData() and searchByImageByFile() based on // Google Image Search 0.5 by Nishan Naseer // https://addons.mozilla.org/ru/firefox/addon/google-similar-images searchByImageByData: function(src, inBg) { var gBrowser = gBrowser || getBrowser(); //var tab = gBrowser.addTab(this.searchByImageMenu.popup.googleURL); var tab = gBrowser.loadOneTab(this.searchByImageMenu.popup.googleURL, { relatedToCurrent: true }); var newTabBrowser = gBrowser.getBrowserForTab(tab); newTabBrowser.addEventListener("load", function byData(e) { newTabBrowser.removeEventListener(e.type, byData, true); if (src) { try { var image_url; var sub; var form = newTabBrowser.contentDocument.getElementById("qbf"); var inputs = form.getElementsByTagName("input"); for (var k = 0; k < inputs.length; k++) { var i = inputs[k]; if (i.name && i.name == "image_url") { image_url = i; } if (i.type && i.type == "submit") { sub = i; } } image_url.value = src; sub.click(); src = null; } catch (ex) { } } }, true); if (!inBg) { getBrowser().selectedTab = tab; } }, searchByImageByFile: function(src, inBg) { //Canvas to get contents in base-64 var canvas = gContextMenu.target.ownerDocument.createElementNS(XHTMLNS, "canvas"); var image = new Image(); image.src = src; canvas.width = image.width; canvas.height = image.height; var ctx = canvas.getContext("2d"); ctx.drawImage(image, 0, 0); var dataURL = canvas.toDataURL("image/png"); var gBrowser = gBrowser || getBrowser(); //var tab = gBrowser.addTab(this.searchByImageMenu.popup.googleURL); var tab = gBrowser.loadOneTab(this.searchByImageMenu.popup.googleURL, { relatedToCurrent: true }); var newTabBrowser = gBrowser.getBrowserForTab(tab); newTabBrowser.addEventListener("load", function byFile(e) { newTabBrowser.removeEventListener(e.type, byFile, true); if (src) { try { var image_url; var sub; var form = newTabBrowser.contentDocument.getElementById("qbf"); var inputs = form.getElementsByTagName("input"); for (var k = 0; k < inputs.length; k++) { var i = inputs[k]; if (i.name && i.name == "image_url") { image_url = i; } if (i.type && i.type == "submit") { sub = i; } } image_url.value = dataURL; sub.click(); src = null; } catch (ex) { } } }, true); if (!inBg) { getBrowser().selectedTab = tab; } }, searchByImageMenuPopup: function(e) { var searchByImageMenu = this.searchByImageMenu; searchByImageMenu.hidden = !gContextMenu.onImage; var src = gContextMenu.mediaURL || gContextMenu.imageURL || gContextMenu.bgImageURL; if (!src || !(/^((ht|f)tps?:\/\/|data:image|file:)/.test(src))) { searchByImageMenu.hidden = true; return; } //var popup = document.getElementById("contextSearchMiniByBunda1-context-image-search-popup"); var popup = searchByImageMenu.popup; var items; if (!popup.items) { var itemsObj = popup.getElementsByTagName("menuitem"); popup.items = []; Array.slice(itemsObj).forEach(function(elem) { if (typeof elem == "object" && elem.nodeName == "menuitem" && elem.getAttribute("label") != "Google") popup.items.push(elem); }); items = popup.items; } else { items = popup.items; } if (/^(data:image|file:)/.test(src)) { items.forEach(function(elem) { elem.setAttribute("disabled", "true"); }); } else { items.forEach(function(elem) { elem.removeAttribute("disabled"); }); } searchByImageMenu.imageSrc = src; }, createSearchByImageMenu: function() { var menu = document.createElement("menu"); var insertMenu = document.getElementById("context-sep-copyimage"); insertMenu.parentNode.insertBefore(menu, insertMenu); this.searchByImageMenu = menu; menu.setAttribute("id", this.nodeIds.searchByImageMenu); menu.setAttribute("class", "menu-iconic"); menu.setAttribute("label", _localize("searchByImage")); menu.setAttribute("image", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAK6wAACusBgosNWgAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNXG14zYAAAElSURBVDiNY/z//z8DJYCRkIKsthv/kRX9Z2BgmFalARdiIcaGKZXqcH5O+01U+ay2G3MYGBiSiXUmmofnsBDSjEUTMkiBe2Eq1JnZ7TcZBHhZGNythBl0lLkZODmYGX7++sdw/sZnhl3H3zF8+voHwwsYFkR5ijNICLMzTF31hOHnr38MHGxMDJlhMgwv3vxkWL7jJYpaJmzu0lTigWtmYGBg+PHrH8P0VU8YtJV5MNRiNYCfmxmuGQZ+/PrHwMmOqRyrAX///WfgYEOV4mBjwjAUpwHHL31iyA6XgRvCwcbEkBUmw3DuxmcMtVgDkYONicHLVoTBSJOXgYONieHHz38Ml+98Ydh88DXDtx//CBtACmBiYGCYS4H+OYyU5kasgUgKAADN8WLFzlj9rgAAAABJRU5ErkJggg=="); this.searchByImageMenu.popup = menu.appendChild(document.createElementNS(XULNS, "menupopup")); var popup = this.searchByImageMenu.popup; popup.setAttribute("id", this.nodeIds.searchByImageMenuPopup); popup.googleURL = "https://www.google.com/searchbyimage"; var namesList = []; if (options.searchByImage.useDefaultNamesList) { let defaultNamesList = [ [ "Google", "https://www.google.com/searchbyimage?image_url=", "data:image/x-icon;base64,AAABAAIAEBAAAAEAIABoBAAAJgAAACAgAAABACAAqBAAAI4EAAAoAAAAEAAAACAAAAABACAAAAAAAAAEAAASCwAAEgsAAAAAAAAAAAAA9IVCSvSFQuf0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hULk9IVCSvSFQub0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQuf0hUL/9IVC//SFQv/0hUL/9Y1O//rIq//+7+f//eXX//vUvf/7z7X/96Fu//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//vYwv/97OH/9ZRZ//SFQv/0hUL/9IhG//zbx//3om7/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/97uX/+buW//SFQv/0hUL/9IVC//SFQv/5upT/+9O6//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/+b6b//zezP/0iEf/9IVC//SFQv/1klf//ezh//vPtP/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/3qXr/+siq//m8lv/5wqD//vTu//3t4//1klb/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0h0b//vbx//zi0//1j1H/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/2nmn/+bmS/////v/4sIX/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/5uJH///v5//eoef/1jU//+82y//afav/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL//vXw//vOs//0hUL/9IVC//ekcf/96+D/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//728v/4sIX/9IVC//SFQv/4s4n///v4//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/6yKn/+byX//SFQv/0hkT//eTV//vWv//0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IZE//m6lP/5u5b//OHQ///+/f/6y6//96d3//SFQv/0hUL/9IVC//SFQv/0hULm9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL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IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//ekcv/+8+z////////////+9fD/+9K5//m9mf/4to7/+buV//vSuf/++PT//OPT//aYYP/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/2l13///r3/////////fv/+b2Z//SIRv/0hUL/9IVC//SFQv/0hUL/9IVC//WNT//84M///vXv//aZYf/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//vPtP////////////i0i//0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//WQUv///Pr//OPU//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL//eTV///////+9O7/9IVD//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//3m2P//////9ppi//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/718H///////3s4f/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL//vDn///////4soj/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//erff////////38//WTWP/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//iziv////////////iwhf/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//rMsP///////eXW//WSVv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/4sYb///z7/////////Pv/9ZFV//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//ixhv/+8Of//vn1//rMsP/4rH//9plh//WQUv/1j1L/+s2x//////////////////m9mf/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SGQ//2nmn/+buW//vNsv/82sb//e3j/////////////////////v/5wZ//9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/83Mj////////////++fb/+K+C//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9ZRZ/////////////vTt//aaYv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/1lFr////////////6xqf/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//ehbf/70bj//end//3o2////v3///////3l1//0iEb/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/5wqD////////////96t7/96Z2//WOUP/2nWf//NvH//zcyP/1i0z/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/96l6/////////////vLr//WPUf/0hUL/9IVC//SFQv/0h0b//end//3k1f/0iUn/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/8387////////////4sYf/9IVC//SFQv/0hUL/9IVC//SFQv/6w6L///////nBn//0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC///69////////vj1//SIR//0hUL/9IVC//SFQv/0hUL/9IVC//m+mv///////e3j//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL///r3///////8387/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/+syw///////++fb/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/95NX///////vUvP/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/97OH///////7y6//0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//i2jv///////N/O//SFQv/0hUL/9IVC//SFQv/0hUL/96Nx////////////+s2x//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IdF//zh0P//+/j/9ZJW//SFQv/0hUL/9IVC//SKSv/96t7///////738v/1k1f/9I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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAB" ], [ "Yandex", "http://images.yandex.ru/yandsearch?rpt=imagedups&text=&img_url=", "data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAABILAAASCwAAAAAAAAAAAAAAkdx+AJHc5wCR3P8Akdz/AJHc/wCR3P8Akdz/AJHc/wCR3P8Akdz/AJHc/wCR3JYArvIAAK7yAACu8gAArvIAA5Pd5wCr8P8ArvL/AK7y/wCu8v8ArvL/AK7y/wCu8v8ArvL/AK7y/wCu8v8CnOT/A5PdewCu8gAArvIAAK7yAAeV3/8AsPP/ALDz/wCw8/8AsPP/ALDz/wCw8/8AsPP/ALDz/wCw8/8AsPP/Aa3x/weW4P8Hld8PALDzAACw8wAMmOH///////////////////////////////////////////////////////////8GpOr/DJjhigCy9AAAsvQAEZzk//////8VpOn/Fbr1/xW69f+c4fv/ddb5/xW69f8VuvX/Fbr1/x2o6v//////AbT0/w+f5v8RnOQ8ALX1ABeg5v//////F6bp/xe48/8XuPP/hdf3/4XX9/80wPT/F7jz/xe48/8dqOr//////wC49v8IsPD/F6DmpQC49gAepOn//////wOe6P8DrvD/A67w/1/G8/9fxvP/TsLy/wSu8P8DrvD/CaHo//////8Au/j/ALv4/xep7f8epOlmJKjs//////9GvfD/ft78/37e/P///////////+f5/v+A3/z/ft78/03A8P//////AL75/wC++f8Huvf/JKjszyut7///////OLvw/2Pa/P9j2vz///////////+R5f3/Y9r8/2Pa/P8/vvD//////wDC+v8Awvr/CL74/yut788xsfL//////ya48P9F1fz/RdX8///////N8/7/RdX8/0XV/P9F1fz/Lrnw//////8Axfv/AMX7/yW29P8xsfJmOLX1//////8XtfD/KNH8/yjR/P/8/v//UNr9/yjR/P8o0fz/KNH8/x+48P//////AMn8/xTC+v84tfWlAMn8AD659///////ALHw/wCx8P8AsfD/Gbjw/wCx8P8AsfD/ALHw/wCx8P8JtPD//////wPM/v83u/j/Prn3PADN/gBDvfr///////////////////////////////////////////////////////////8lxvz/Q736igTR/gAE0f4ASMD8/xLV//8S1f//EtX//xLV//8S1f//EtX//xLV//8S1f//EtX//xLV//8Y0///R8D8/0jA/A8S1f8AEtX/AEzD/uRa2f//XNz//1zc//9c3P//XNz//1zc//9c3P//XNz//1zc//9c3P//Ucv+/0zD/nhc3P8AXNz/AFzc/wBPxf97T8X/5E/F//9Pxf//T8X//0/F//9Pxf//T8X//0/F//9Pxf//T8X//0/F/5Zc3P8AXNz/AFzc/wBc3P8AAA8AAAAHAAAAAwAAAAMAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAQAAAAMAAAADAAAABwAAAA8AAA==" ], [ "TinEye", "http://www.tineye.com/search/?pluginver=firefox-1.0&url=", "data:image/x-icon;base64,AAABAAEAEBAAAAAAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAACxeDVItHk157iAO//WtW7/482G/+XOhv/lzYL/1L98/5mTcf8UKUP/CwsM/xwcG/8AAAD/AAAA/wAAAOcAAA5ItHo25LV7Nv+1ezb/tXs2/8GPSf/EoGj/s5hw/6KPdf93bWT/ZFdK/2daTP9hVEj/XU9C/zIpH/8EAgH/AAAA5LV7Nv+1ezb/tXs2/7V7Nv+1ezb/uIA+/8eea//Wtof/48eU/+PKkv/iyJP/4MeV/9u/kf/HqHz/rI1p/3tmT/+1ezb/tXs2/7V7Nv+1ezb/zKV0/+PKlP/hxXr/zbFk/8esYf/VuW7/3sFz/+LFdf/gw3P/48Z3/+nPjv/dwJD/tXs2/7V7Nv+1ezb/y6Nx/9/Gg/+NekT/V0wv/5uSfP95cmH/JiES/zAqGv86Mh3/W08v/3lpQP+Wg03/zLFn/7V7Nv+1ezb/uoVH/8myg/+VgUr/AAAA/2xpZf/i4+X/+fn5/0JAO/8AAAD/LCkl/768uf+/vr3/Mi8q/x0ZEP+2fDf/tXs2/6WGX/+pklP/JyES/0dFQP96eHX/W1tc//////9ua2X/DAoH/6Wim/+EhIX//////6ejnP8AAAD/wo1F/8GLQ//Conf/tZ1e/wYDAP9pZmH/6+vs/9/f3/////3/Pjoz/zo2Lf/Jycb/UlJT//////+xraX/AAAA/8OORv/Djkb/1bF+/821cf83MSD/MC4s//n49P//////l5OJ/wMCAP9IRDr/////////////////ZGBW/wAAAP/Djkb/w45G/8qkcP+sllr/wKtw/zw5Mf9MSUb/VlNM/wIBAP8AAAD/FxUP/9PQyv/8+/j/rKig/wkHA/8AAAD/w45G/8OORv+1jlj/l4hm/8etZv/QuHf/m4xk/21hSP9PRjX/Mi0j/xsYFf87NzD/VFBK/xUVFf8FBwz/CQsQ/8OORv/Djkb/g2I1/8Oea//Mt4z/uJxU/56hhv92nLj/l6ut/56poP+gpJL/mJeC/5aMbP+bjmv/m49t/52Qbv/Djkb/uItP/05PUP+zjlv/yptc/9C3jP9gYFP/ABVH/wAzc/8IP4T/FUuM/xhSmP99lZ3/5sRv/9S6cf/Lsmr/w45G/1B7rv8bbdT/LWy5/8OORv/Djkf/yqRw/zswIP8AAAD/AAAA/wAAAP8AAAD/Fyk8/5CKZ/+ahU3/modW/8GNReeEj5r/L37g/0Jxqf/Cjkf/w45G/8OORv/Fllb/clYw/zoqFf8hGQ3/IhwU/x4ZFf9HRUD/vaJ5/86pdee+ikU/woxEyZ6HZ/+8jEz/w45G/8OORv/Djkb/w45G/8OORv/Djkb/v4tF/8ORTf/GlFD/xJBJ/8KMRMm+ikU/gAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAE=" ] ]; namesList = namesList.concat(defaultNamesList); } if (options.searchByImage.addCustomNames && Array.isArray(options.searchByImage.customNamesList)) { namesList = namesList.concat(options.searchByImage.customNamesList); } function itemCreate(name, link, image) { var item = document.createElementNS(XULNS, "menuitem"); item.setAttribute("class", "menuitem-iconic"); item.setAttribute("src", image); item.setAttribute("label", name); item.link = link; popup.appendChild(item); } namesList.forEach(function(elem) { itemCreate(elem[0], elem[1], elem[2]); }); var contextMenu = this.contextMenu; popup.gObj = this; popup.setAttribute("oncommand", "this.gObj.searchByImageCommandHandler(event);"); popup.setAttribute("onclick", "checkForMiddleClick(this, event);"); } } contextSearcherObj.init(); })();
Отредактировано villa7 (13-11-2015 20:43:16)
Лучше спросить у знающих - чем лезть не зная.
Отсутствует
villa7
У тебя Context Search mini 2013-10-10 с ошибками, тут он правильный Context Search mini 2013-10-10
Кстати у меня поиск и автоконтекст работает на FF43
Отредактировано bunda1 (14-11-2015 01:04:56)
Отсутствует
bunda1
Хоть убей, не работают у меня всё три кода вместе. Профиль чистый 42. Отключаю автоконтекст, всё работает.
Мне кажется что конфликт автоконтекст с функцией "Запуск поиска выделением текста", потому что если её отключить то поиск работает с автоконтекстом, но не выделяет слова соответственно.
Лучше спросить у знающих - чем лезть не зная.
Отсутствует
Dumby
Второй день мучаюсь коды туда-сюда переставляю, а тут раз, и проблема решена. Спасибо.
bunda1
Пара вопросов. Код автоконтекст что ты дал куда лучше положить в Код или Инициализацию, работает и там и там.
http://forum.mozilla-russia.org/viewtop … 60#p699360
И почему то не работает "Быстрый поиск по мере набора текста", тишина полная. Блин, задолбал я уже всех. Но без нормально работающего поиска хреново.
Код этот использую
http://forum.mozilla-russia.org/viewtop … 68#p550868
Лучше спросить у знающих - чем лезть не зная.
Отсутствует
bunda1
Пара вопросов. Код автоконтекст что ты дал куда лучше положить в Код или Инициализацию, работает и там и там.
http://forum.mozilla-russia.org/viewtop … 60#p699360
В инициализацию тогда можно будет кнопку отключать - включать.
Добавлено 14-11-2015 18:48:11
И почему то не работает "Быстрый поиск по мере набора текста", тишина полная. Блин, задолбал я уже всех. Но без нормально работающего поиска хреново.
Код этот использую
http://forum.mozilla-russia.org/viewtop … 68#p550868
Мда, придётся делать но не вижу компактное решение.
Отредактировано bunda1 (14-11-2015 18:48:11)
Отсутствует
не работает "Быстрый поиск по мере набора текста", тишина полная. Блин, задолбал я уже всех. Но без нормально работающего поиска хреново.
Ну, если прям совсем хреново, то попробуй пока добавить в конец
gFindBar._quickFindTimeoutLength = 4500; function onBrowserKeypress(msg) {msg.target == gBrowser.selectedBrowser && gFindBar._onBrowserKeypress(msg.data);} messageManager.addMessageListener("Findbar:Keypress", onBrowserKeypress); addDestructor(() => messageManager.removeMessageListener("Findbar:Keypress", onBrowserKeypress));
Отсутствует
Dumby
Теперь стало не хреново, а просто охренительно. Наконец то могу полностью перейти на 42 версию, как раз отсутствие нормального поиска и мешало это сделать. Спасибо!!!
Лучше спросить у знающих - чем лезть не зная.
Отсутствует
bunda1
Опять у меня с чем то конфликтует, сейчас проверил на чистом профиле, вроде всё работает. Ладно, буду разбираться. Извини за беспокойство.
Лучше спросить у знающих - чем лезть не зная.
Отсутствует
bunda1
Нашёл. Конфликт с кнопкой автоконтекст, когда её отключаю всё нормально, и выглядит она как то по особому.
можно как то подружить?
/*======= Auto context menu on selection =======*/ this.setAttribute("type","checkox"); var prefs=Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch); try{ var cb_autoContextmenu = prefs.getBoolPref("cb_autoContextmenu" ); }catch(e){ prefs.setBoolPref("cb_autoContextmenu",true ); } this.checked = prefs.getBoolPref("cb_autoContextmenu" ); var autoContextmenu = { exec: function(event) { var prefs=Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch); if (event.button != 0) return; if( !prefs.getBoolPref("cb_autoContextmenu" ) ) return; selection = document.commandDispatcher.focusedWindow.getSelection(); if (!selection.isCollapsed && (selection.toString() != autoContextmenuPrevSelection)) { autoContextmenuPrevSelection = document.commandDispatcher.focusedWindow.getSelection().toString(); var mouseEvent = document.createEvent('MouseEvents'); if (mouseEvent) { mouseEvent.initMouseEvent('contextmenu', true, true, window, 1, event.screenX, event.screenY, event.clientX, event.clientY, false, false, false, false, 2, null); event.target.dispatchEvent(mouseEvent); } } } }; var autoContextmenuPrevSelection = null; document.addEventListener('mouseup', function(event) { autoContextmenu.exec(event); }, false);
Отредактировано villa7 (27-01-2016 23:14:52)
Лучше спросить у знающих - чем лезть не зная.
Отсутствует
villa7
А почему ты не использоваешь Автоматически открывать контекстное меню на странице и Context Search 2 2016-01-10
Отсутствует
bunda1
Опять в не работает кнопочка. Выручай.
Отсутствует