Полезная информация

Общайтесь со знакомыми и друзьями в нашей группе в Контакте.

№5110-10-2013 19:23:05

villa7
Участник
 
Группа: Members
Зарегистрирован: 21-07-2012
Сообщений: 2235
UA: Firefox 25.0

Re: [CB]Context Search

2k1dmg
А можно как то поисковики впихнуть внутрь контекстного меню, чтобы не прыгали слева на право а всегда были на предсказуемом месте, или как нибудь привязать к одной стороне.
8293fdb93743t.jpg


Лучше спросить у знающих - чем лезть не зная.

Отсутствует

 

№5211-10-2013 10:35:21

2k1dmg
Участник
 
Группа: Members
Зарегистрирован: 06-04-2011
Сообщений: 190
UA: Firefox 24.0

Re: [CB]Context Search

PEAKTOP пишет

сделать возможность задать поисковик по умолчанию и сделать его активным - осуществлять поиск этим поисковиком при клике на пункте контекстного меню (без захода в подменю).

как-нибудь потом

villa7

скрытый текст
можно попробовать добавить

Выделить код

Код:

popup.setAttribute("position", "start_before");

после

Выделить код

Код:

popup.setAttribute("id", this.nodeIds.searchMenuPopup);

https://developer.mozilla.org/en-US/doc … ositioning

Отсутствует

 

№5311-10-2013 20:31:01

villa7
Участник
 
Группа: Members
Зарегистрирован: 21-07-2012
Сообщений: 2235
UA: Firefox 25.0

Re: [CB]Context Search

2k1dmg

popup.setAttribute("position", "start_before");

Спасибо, как и хотелось, только значение другое подставить пришлось.


Лучше спросить у знающих - чем лезть не зная.

Отсутствует

 

№5412-12-2013 12:31:14

>ORG@niZM<
Участник
 
Группа: Members
Зарегистрирован: 20-08-2013
Сообщений: 66
UA: Firefox 24.0

Re: [CB]Context Search

bunda1 пишет

Context Search, от 13.10.2013

отвалилось на ESR 24.2.0, но если убрать/закомментировать

Выделить код

Код:

mItem.setAttribute("src", engine.iconURI.spec );

то работает, но в списке поисковиков не отображаются иконки.
Что-то поменялось в этой функции?

Отредактировано >ORG@niZM< (12-12-2013 12:31:58)

Отсутствует

 

№5512-12-2013 19:56:37

bunda1
Moderator
 
Группа: Moderators
Откуда: Латвия
Зарегистрирован: 09-02-2010
Сообщений: 4811
UA: Firefox 3.6

Re: [CB]Context Search

У меня Context Search на ESR 24.2.0 работает :/
Может у тебя конфликт с каким то кодом или расширением, попробуй на чистом профиле.

Отсутствует

 

№5613-12-2013 08:31:40

>ORG@niZM<
Участник
 
Группа: Members
Зарегистрирован: 20-08-2013
Сообщений: 66
UA: Firefox 24.0

Re: [CB]Context Search

bunda1
прошу пощения, на чистом профиле и правда работает (

Отсутствует

 

№5713-12-2013 09:23:15

bunda1
Moderator
 
Группа: Moderators
Откуда: Латвия
Зарегистрирован: 09-02-2010
Сообщений: 4811
UA: Firefox 3.6

Re: [CB]Context Search

Evybr пишет
bunda1 пишет

которые и позволяет вам  выбрать

Исправьте.

Хорошо.

Отсутствует

 

№5813-12-2013 17:09:42

rubel
Участник
 
Группа: Members
Откуда: г.Самара
Зарегистрирован: 10-05-2005
Сообщений: 559
UA: Firefox 26.0

Re: [CB]Context Search

bunda1
В FF 26 и custombuttons-0.0.5.7pre3-20131124 эта кнопка Context Search добавляет в контекстное меню свой пункт два раза:
BnOZ6SqF.gif
Можно ли поправить?

Отсутствует

 

№5913-12-2013 20:33:30

Kiril__777
Участник
 
Группа: Members
Зарегистрирован: 13-07-2009
Сообщений: 393
UA: Firefox 20.0

Re: [CB]Context Search

на моем фф вот так работает кнопка.
а на фф 24 нормально. переходить пока не собираюсть. нельзя ли что-то подправить чтобы на фф 20 работало?

Отредактировано Kiril__777 (13-12-2013 20:43:06)

Отсутствует

 

№6014-12-2013 06:39:29

2k1dmg
Участник
 
Группа: Members
Зарегистрирован: 06-04-2011
Сообщений: 190
UA: Firefox 26.0

Re: [CB]Context Search

rubel
Kiril__777
Временно можете попробовать эту версию

Context Search mini 2013-11-22

Выделить код

Код:

(function () {
    // Context Search mini 2013-11-22
    var options = {
        loadInBackground: false,
        // true - открывать вкладки в фоне
        pinnedEngineName: "",
        // оставить пустым если не нужно закреплять
        // определенный поисковик
        // примеры pinnedEngineName: "Google" или pinnedEngineName: "Яндекс" или pinnedEngineName: ""
        hideDefaultEngineInPopupSubMenu: false,
        // true - не добавлять поисковик по умолчанию в выпадающий список (подменю) поисковиков
        campactMenu: true,
        // true - поисковики в выпадающем списке (подменю) без назаваний
        campactMenuLengthPerLine: 5,
        // максимальное количество элементов в одной строке
        // от 3 до 10, по умолчанию 5
        searchBySite: {
            enable: true,
            // true - добавить поисковики по сайту
            iconsOn: true,
            // true - добавить иконки для поисковиков по сайту
            useDefaultNamesList: true,
            // true - использовать список поисковиков по умолчанию
            addCustomNames: false,
            // true - добавить свои поисковики по сайту
            customNamesList: [
                ["Rambler", ["Rambler", "Рамблер"]]
            ]
            // например ["Rambler", ["Rambler", "Рамблер"]]
            // первая ячека название на английском
            // вторая ячека массив с предполагаемыми именами поисковика
            // может состоять из нескольких значений
            // ["Name1", ["Name1"]],
            // ["Name2", ["Name2", "Имя2"]],
            // ["Name3", ["Name3", "Имя3", "Név3"]]
        },
        searchImageByText: {
            enable: true,
            // true - добавить поиск изображения по тексту
            useDefaultNamesList: true,
            addCustomNames: false,
            customNamesList: [
                [
                    "name",
                    "link",
                    "image"
                ]
            ]
        },
        searchByImage: {
            enable: true,
            // true - добавить поиск по изображению
            useDefaultNamesList: true,
            addCustomNames: false,
            customNamesList: [
                [
                    "name",
                    "link",
                    "image"
                ]
            ]
        },
        searchInCache: {
            enable: true,
            // 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() {
            let gPrefService = Services.prefs; // SeaMonkey
            if (!gPrefService.getBoolPref("intl.locale.matchOS")) {
                try {
                    var locale = gPrefService.getCharPref("general.useragent.locale");
                    if (locale.substr(0, 9) == "chrome://") {
                        return gPrefService.getComplexValue("general.useragent.locale",
                            Components.interfaces.nsIPrefLocalizedString).data;
                    }
                    return locale;
                } catch (ex) {}
            }
            try {
                return Components.classes["@mozilla.org/chrome/chrome-registry;1"]
                .getService(Components.interfaces.nsIXULChromeRegistry)
                .getSelectedLocale("global");
            } catch (ex) {
                return "en-US";
            }
        }
        let locale = ""; // ru, en
        if (!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*/26px !important;\n\
        @media (min-resolution: 2dppx) {\n\
            #' + this.nodeIds.searchMenuPopup + ' > hbox > spacer[campactMenu="true"]  {\n\
                width: 52px !important;\n\
            }\n\
        }\n\
    }\n\
    #' + this.nodeIds.searchMenuPopup + ' > hbox > .menuitem-iconic[campactMenu="true"] {\n\
        /*width: 3em !important;\n\
        height: 2em !important;*/\n\
        width: 36px !important;\n\
        height: 26px !important;\n\
        -moz-box-pack: center !important;\n\
        @media (min-resolution: 2dppx) {\n\
            #' + this.nodeIds.searchMenuPopup + ' > hbox > .menuitem-iconic[campactMenu="true"]  {\n\
                width: 72px !important;\n\
                height: 52px !important;\n\
            }\n\
        }\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 selectedText = getBrowserSelection(16);
            var selectedText = this.isSeaMonkey ? content.getSelection(16).toString() : getBrowserSelection(16);
            if (!selectedText)
                return;
            var ellipsis = "\u2026";
            try {
                ellipsis = gPrefService.getComplexValue("intl.ellipsis", Ci.nsIPrefLocalizedString).data;
            } catch (ex) { }
            if (selectedText.length > 15)
                selectedText = selectedText.substr(0,15) + ellipsis;
            let rEngine = this.isSeaMonkey ? "currentEngine" : "defaultEngine";
            var engineName = this.param.isPinnedEngine ? this.param.pinnedEngineName : searchService[rEngine].name;
            var menuLabel;
            var searchFormattedString = [
                "contextMenuSearch",
                "contextMenuSearchText",
                "searchSelected"
            ];
            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);

            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+wkFkvEbtGyVPhMRyv0QAmNfuLCruMDVRkc1ViccKltTvQDVRhcUAmdfvQDRRks5RiskcltTwQzdQkM07k9DtGyPvQzdQkMzvPzSgiRCBAAAAcHRSTlMAM9bsfmzq30TnaEIQF1b390JR9nP98873iO4nsPyvO3Vly1783sVB8T/5j+2SiIXyKITTeqTRY0ThWl/g9jAn2cBPbNfJFWXVrOjTge5EeeC0qPBsYPfUstjGvOP+dnp0+pmBR1GEikvl8paC8etfYXu9TgAAAAlwSFlzAAAASAAAAEgARslrPgAAAQJJREFUGNM1j8VWQzEARAco8NDiLsXdXQvF3d3dIQ2vOBR3CQSCFPtUUg7Mbu5i7hnY2Npp8Bd7B0cFToQQZxdXwE1xN9JVLVRiUsmah6eXNzVKQOFD1PUNXz//za0ASul2IKBRg4IREroThnAt1cmlCFMkoqJ3Y2LjEL+nSJBgTkxK3k9JPThMSz/KsMoyj0+ysoGc07PcvF97fsH5RSFQVHxZUmrt+quycvO1oeKmsur2rlqCGlaLuvqG+4dGNPFmCVpYK9D2+NQOdIhOoKubPff0vrz29Q8MvvGhYTAZC3sfGf34FFwIgTHLFxufmASmpme+OeeYnZtf+L+/uLS88gMT2kW5QAjbFwAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxMi0wNC0wNlQxMDoxMzowNSswNDowMIQ8zwwAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTItMDQtMDZUMTA6MTM6MDUrMDQ6MDD1YXewAAAAAElFTkSuQmCC"
                        ],
                        [
                            "Yandex",
                            "http://images.yandex.ru/yandsearch?text=",
                            "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=="
                        ]
                    ];
                    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/PUQZIhYZ1vFM9cvcOOsYNdcBgysISdSJBnZjJMlR0F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+M5kHFJX+YlPxpVlbCx2mZ5DzPI04k4kUwHHdskU3pH76iftG8yWlkAAAAAElFTkSuQmCC"
                        ],
                        [
                            "Archive.org",
                            "http://web.archive.org/web/*/",
                            "data:image/x-icon;base64,AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAABAAABILAAASCwAAAAAAAAAAAAABAQH/AQEB/wEBAf8BAQH/AgIC/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AQEB/wAAAP8BAQH/AQEB/wAAAP8CAgL/AgIC/wEBAf8CAgL/AQEB/wQEBP8EBAT/BAQE/wQEBP8EBAT/BAQE/wQEBP8EBAT/BQUF/wUFBf8EBAT/BAQE/wQEBP8EBAT/BAQE/wQEBP8EBAT/BAQE/wUFBf8EBAT/BAQE/wQEBP8FBQX/BQUF/wEBAf8AAAD/AQEB/wICAv8BAQH/AAAA/wAAAP8CAgL/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wEBAf8AAAD/AgIC/wEBAf8BAQH/BgYG/wAAAP+ysrL/4uLi/9/f3//g4OD/4ODg/9/f3//g4OD/4eHh/+Hh4f/h4eH/4eHh/+Hh4f/h4eH/4eHh/+Hh4f/h4eH/4ODg/+Hh4f/h4eH/4eHh/+Hh4f/h4eH/3d3d/97e3v8qKir/AQEB/wMDA/8BAQH/AgIC/wAAAP8EBAT/AAAA/7CwsP/Hx8f/w8PD/8fHx//FxcX/xcXF/8XFxf/Gxsb/xsbG/8bGxv/Gxsb/xsbG/8bGxv/Gxsb/xsbG/8bGxv/FxcX/xcXF/8bGxv/FxcX/xcXF/8XFxf/Dw8P/1NTU/ywsLP8AAAD/BAQE/wEBAf8AAAD/AAAA/wEBAf8BAQH/AAAA/0pKSv9NTU3/TExM/0xMTP9LS0v/TExM/01NTf9NTU3/TU1N/01NTf9NTU3/TU1N/01NTf9NTU3/TU1N/0xMTP9NTU3/TU1N/0xMTP9MTEz/SkpK/01NTf8SEhL/AAAA/wICAv8CAgL/BAQE/wEBAf8BAQH/AQEB/wAAAP8NDQ3//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////3l5ef8BAQH/BgYG/wAAAP8CAgL/AQEB/wEBAf8DAwP/AAAA/wMDA/8oKCj/LS0t/zExMf8tLS3/Kioq/ysrK/8sLCz/Ly8v/zAwMP8qKir/LCws/yoqKv8oKCj/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/gIC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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/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IVC//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/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9YxN//vUvf/96+D/96Z0//WNT//3om///ebY/////////Pv/+LKI//WVW//0h0X/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//agbP/7zbL//enc//749P////////////////////////////3r4P/3p3f/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hULx9IVC//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/9IVC//SFQv/0hUL/9IVC8/SFQq30hUL/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/0hUL/9IVC//SFQv/0hUKt9IVCJ/SFQu/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/0hUL/9IVC7/SFQif0hUIA9IVCJfSFQq30hULx9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC8fSFQq30hUIl9IVCAIAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAB"
                    ],
                    [
                        "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();
})();

Отсутствует

 

№6114-12-2013 08:21:48

Kiril__777
Участник
 
Группа: Members
Зарегистрирован: 13-07-2009
Сообщений: 393
UA: Firefox 20.0

Re: [CB]Context Search

2k1dmg
Мне нравится ваш вариант, спасибо.

Отсутствует

 

№6214-12-2013 08:47:44

rubel
Участник
 
Группа: Members
Откуда: г.Самара
Зарегистрирован: 10-05-2005
Сообщений: 559
UA: Firefox 26.0

Re: [CB]Context Search

2k1dmg
Да это и не мини, а вообще расширенное меню! Спасибо. :)

Отсутствует

 

№6314-12-2013 09:04:28

villi311
Участник
 
Группа: Members
Зарегистрирован: 31-08-2013
Сообщений: 39
UA: Firefox 25.0

Re: [CB]Context Search

2k1dmg пишет

Временно можете попробовать эту версию

Мне ваш вариант понравился больше. Огромное спасибо.

Отсутствует

 

№6415-12-2013 14:45:14

Ader
Участник
 
Группа: Members
Зарегистрирован: 05-04-2013
Сообщений: 7
UA: Firefox 25.0

Re: [CB]Context Search

villa7 пишет

2k1dmg

popup.setAttribute("position", "start_before");

Спасибо, как и хотелось, только значение другое подставить пришлось.

А можно узнать, какое значение Вы поставили, и как это выглядит?

Отсутствует

 

№6515-12-2013 15:42:36

bunda1
Moderator
 
Группа: Moderators
Откуда: Латвия
Зарегистрирован: 09-02-2010
Сообщений: 4811
UA: Firefox 3.6

Re: [CB]Context Search

2k1dmg
Может лучше создай новую тему для Context Search mini 2013-11-22
И я думаю что это уже не mini а full.

Отсутствует

 

№6615-12-2013 18:02:01

villa7
Участник
 
Группа: Members
Зарегистрирован: 21-07-2012
Сообщений: 2235
UA: Firefox 26.0

Re: [CB]Context Search

Ader
start_before поменял на after_end

скрытый текст
f1fd0c3a2e71t.jpg

Отредактировано villa7 (15-12-2013 18:02:55)


Лучше спросить у знающих - чем лезть не зная.

Отсутствует

 

№6720-12-2013 09:07:54

LBra
Участник
 
Группа: Members
Зарегистрирован: 20-10-2011
Сообщений: 40
UA: unknown 0.0

Re: [CB]Context Search

2k1dmg пишет

Временно можете попробовать эту версию

2k1dmg,
мне тоже очень понравиась эта кнопка, спасибо!

Я добавил:
                var defImg = "chrome://global/skin/icons/question-16.png";
и изменил строчки:
                item.setAttribute("src", (engine.iconURI ? engine.iconURI.spec : defImg));
...
                image.setAttribute("src", (engine.iconURI ? engine.iconURI.spec : defImg));
Это - для поисковиков, не имеющих собственных иконок, чтобы не вылезала ошибка...

Пожелания:
1. Изменить сортировку иконок поисковиков. Не "слева направо, сверху вниз", а "сверху вниз, слева направо", так привычнее и удобнее.
2. Добавить возможность (например, по правому клику по иконке поисковика defImg) назначать иконки поисковикам, не имеющих собственных иконок.
3. Добавить возможность ручной сортировки поисковиков в подменю путем перетаскивания (в том числе - "перетаскивания" наиболее часто употребляемых поисковиков из подменю в основное контекстное меню). :)

Отредактировано LBra (20-12-2013 09:13:47)

Отсутствует

 

№6822-01-2014 16:43:08

1fesFFFF
Участник
 
Группа: Members
Зарегистрирован: 22-01-2010
Сообщений: 252
UA: Firefox 26.0

Re: [CB]Context Search

bunda1
Пользуюсь версией от 13.10.2013, CB 0.0.5.7, но почему-то часто не срабатывает поиск, когда из контекстного меню я щёлкаю по другому поисковику. Приходится снова нажимать.

Отсутствует

 

№6922-01-2014 23:02:32

bunda1
Moderator
 
Группа: Moderators
Откуда: Латвия
Зарегистрирован: 09-02-2010
Сообщений: 4811
UA: Firefox 3.6

Re: [CB]Context Search

Что значит не срабатывает поиск, когда из контекстного меню я щёлкаю по другому поисковику, вообще ничего не происходит или что?

Отредактировано bunda1 (22-01-2014 23:04:34)

Отсутствует

 

№7022-01-2014 23:21:37

feas
Участник
 
Группа: Extensions
Откуда: от DNS
Зарегистрирован: 25-08-2011
Сообщений: 5213
UA: Seamonkey 2.23
Веб-сайт

Re: [CB]Context Search

bunda1 пишет

вообще ничего не происходит

Возможно именно это имеет ввиду, однако я не вижу такой проблемы, хоть убей и левой и правой и все поисковики перебрал.
Кстати отлично в [seamonkey] работает =)

Добавлено 22-01-2014 23:22:01
кажись какое-то расширение ему мешает...

Отредактировано feas (22-01-2014 23:22:01)


Добро пожаловать на форум mozilla-russia.org. Здесь вы можете посоветоваться или обратиться за помощью к фанатам и пользователям продуктов Мозиллы. Если не знаете как правильно оформить пост специально для вас расписан пункт 2.2 правил форума
Сброс на примере Firefox – лёгкое решение большинства проблем
Починка браузера. Перенос своих настроек на новый профиль.

Отсутствует

 

№7122-01-2014 23:33:44

bunda1
Moderator
 
Группа: Moderators
Откуда: Латвия
Зарегистрирован: 09-02-2010
Сообщений: 4811
UA: Firefox 3.6

Re: [CB]Context Search

feas
Да я тоже не вижу такой проблемы.

Отсутствует

 

№7223-01-2014 04:12:35

1fesFFFF
Участник
 
Группа: Members
Зарегистрирован: 22-01-2010
Сообщений: 252
UA: Firefox 26.0

Re: [CB]Context Search

Да, ничего не происходит. Ладно, буду дальше копать.

Отсутствует

 

№7323-01-2014 06:40:24

>ORG@niZM<
Участник
 
Группа: Members
Зарегистрирован: 20-08-2013
Сообщений: 66
UA: Firefox 24.0

Re: [CB]Context Search

1fesFFFF
на чистом профиле пробуйте - однозначно мешается что-то. Аналогичная проблема. Пока забил...

Отсутствует

 

№7429-01-2014 17:35:55

1fesFFFF
Участник
 
Группа: Members
Зарегистрирован: 22-01-2010
Сообщений: 252
UA: Firefox 26.0

Re: [CB]Context Search

В 90% случаев не срабатывает при таком алгоритме: открывается список поисковиков, нажимаю левой кнопкой по одному из них, но кнопку не отпускаю, потом вожу курсор вверх-вниз (ищу нужный) и отпускаю кнопку напротив того, который нужен, но не над тем, над которым я зажал кнопку. В итоге не срабатывает поиск.

Отсутствует

 

№7529-01-2014 20:33:33

bunda1
Moderator
 
Группа: Moderators
Откуда: Латвия
Зарегистрирован: 09-02-2010
Сообщений: 4811
UA: Firefox 3.6

Re: [CB]Context Search

1fesFFFF пишет

В 90% случаев не срабатывает при таком алгоритме: открывается список поисковиков, нажимаю левой кнопкой по одному из них, но кнопку не отпускаю, потом вожу курсор вверх-вниз (ищу нужный) и отпускаю кнопку напротив того, который нужен, но не над тем, над которым я зажал кнопку. В итоге не срабатывает поиск.

Попробуй:

Выделить код

Код:

// Context Search, от 29.01.2014. ................................
(function () {
   var searchService = Cc["@mozilla.org/browser/search-service;1"].getService(Ci.nsIBrowserSearchService); 

   var searchSelect = document.getElementById('context-searchselect');  
   searchSelect.collapsed = true; // удалить стандартный пункт меню для поиска

   
   // Создать новый пункт меню для поиска ....
   var contextMenu = document.getElementById("contentAreaContextMenu");
   var menu = contextMenu.insertBefore( document.createElement('menu'), searchSelect ); // над каким пунктом меню показывать
   menu.setAttribute("class", "menu-iconic");
   
   // устанавливать иконку, название и поисковик для нового пункта меню
   function setMenu() {  
      menu.engine = searchService.currentEngine;
      menu.setAttribute("label", "Искать в " + menu.engine.name + " или в ...");
      menu.setAttribute("image", menu.engine.iconURI.spec );
   };
   setMenu();   
 
   // наблюдатель за стандартным пунктом меню 'Копировать' прячет меню поиска
   var copy = document.getElementById('context-copy');  
   var setHiddenMenu = new MutationObserver(function() {
          menu.hidden = copy.hidden || copy.disabled;          
   });
   setHiddenMenu.observe( copy, { attributes: true, attributeFilter: ["hidden", "disabled"] } );
   
   
   // Создать подменю с поисковиками .... 
   var menuPopup = menu.appendChild( document.createElement("menupopup") ); 
   menuPopup.setAttribute('style', 'overflow: scroll'); 
    
   // создать пункты в подменю
   function setItemsToMenuPopup(e) {
      menuPopup.textContent = "";      

      var engines = searchService.getVisibleEngines({});
      engines.forEach(function( engine ) {
         var mItem = document.createElement("menuitem");
         mItem.setAttribute("label", engine.name );
         mItem.setAttribute("class", "menuitem-iconic");
         mItem.setAttribute("src", engine.iconURI.spec );
         mItem.engine = engine;
         menuPopup.appendChild( mItem );
      });

   };  
   setItemsToMenuPopup();
   
   
   // Установить действие для клика на меню и подменю ....
   menu.setAttribute("onmouseup", "\
      var background = ( event.button == 0 ) ? false : true;\
      var clip = gClipboard.read();\
      goDoCommand('cmd_copy');\
      setTimeout(function() {\
         document.getElementById('contentAreaContextMenu').hidePopup();\
         var submission = event.target.engine.getSubmission( gClipboard.read(), null );\
         gBrowser.loadOneTab( submission.uri.spec, null, null, submission.postData, background, false );\
         gClipboard.write( clip );\
      }, 0);\
   ");      
      
   
   // Наблюдатель за изменениями в поисковиках пересоздаёт меню и подменю .... 
   var getEngineModified = {
      observe: function(subject, topic, data) { 
         if ( /changed|removed|current/.test( data ) ) { setMenu(); setItemsToMenuPopup() };             
      }
   };
   Services.obs.addObserver( getEngineModified, "browser-search-engine-modified", false );   
   
   
   // Удалять наблюдатели и меню, показать стандартный пункт ....
   addDestructor(function() {
      contextMenu.removeChild( menu );           
      setHiddenMenu.disconnect();
      Services.obs.removeObserver( getEngineModified, "browser-search-engine-modified", false );
      
      searchSelect.collapsed = false; 
   });   
})();

Отредактировано bunda1 (29-01-2014 22:33:58)

Отсутствует

 

Board footer

Powered by PunBB
Modified by Mozilla Russia
Copyright © 2004–2020 Mozilla Russia GitHub mark
Язык отображения форума: [Русский] [English]