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

Хотите узнать больше о расширениях? Посмотрите ролики, рассказывающие о работе с расширениями Firefox.

№115128-09-2023 17:06:55

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

Re: UCF - ваши кнопки, скрипты…

Dobrov

Восстановить Закрытые вкладки/окна - модификация без подменю

Ваша кнопка вообще не работает, не появляется на панели и в настройках панели инструментов тоже её нет. :/

Отсутствует

 

№115228-09-2023 21:02:05

Dumby
Участник
 
Группа: Members
Зарегистрирован: 12-08-2012
Сообщений: 2201
UA: Firefox 78.0

Re: UCF - ваши кнопки, скрипты…

rubel пишет

кнопка вообще не работает, не появляется на панели и в настройках панели инструментов тоже её нет.

Это потому, что четвёртая строка заканчивается запятой.
Вместо запятой должна быть точка с запятой «;» (ну, или ничего).

Отсутствует

 

№115329-09-2023 01:33:18

Dobrov
Участник
 
Группа: Members
Зарегистрирован: 04-10-2011
Сообщений: 462
UA: Firefox 117.0

Re: UCF - ваши кнопки, скрипты…

Dumby Ошибку исправил! :beer:
кнопка теперь работает на старых и новых Firefox. И вот вопрос по коду: (как обычно) :)


кнопка создаётся через onBuild(doc) { …… Восстановить Закрытые вкладки/окна (вариант без dropmarker)
Можно её переделать на onCreated(btn) {……??? (у меня не заработало)


Возможно, это упростит код и сократит объём: не нужны будут return trbn_1 и trim = doc.createXULElement("toolbaritem")…

Отредактировано Dobrov (29-09-2023 02:45:05)

Отсутствует

 

№115429-09-2023 07:34:16

Northtech
Участник
 
Группа: Members
Зарегистрирован: 16-04-2011
Сообщений: 261
UA: Firefox 116.0

Re: UCF - ваши кнопки, скрипты…

Подскажите пожалуйста, что поправить в UCF (см. ссылку) для fx 118, чтобы вернуть интервалы (special_widget), остался только растягивающийся интервал, а пробел и разделитель пропали.

https://www.upload.ee/files/15742086/ucf.rar.html

Отсутствует

 

№115529-09-2023 07:40:43

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

Re: UCF - ваши кнопки, скрипты…

В 115 сломалась иконка кнопки "Загрузки" и "Переключить прокси" .
В 91
c5030804f6aa709957291711c53dc2a5.png
В115
eaadba129e73be4769db9e01792c0c05.png

скрытый текст

Выделить код

Код:

try {
    (() => {
        var id = "ucf-toggle-proxy",
        label = "Переключить прокси",
        tooltiptext = "Переключить прокси",
        tooltiptextbtnmenu = "ЛКМ: Открыть меню\nПКМ: Открыть настройки прокси",
        toggleproxy = 1, // 0, 1, 2, 4 , 5  Первый режим
        toggleproxy2 = 2, // 0, 1, 2, 4 , 5  Второй режим
        doreload = true, // Перезагрузить страницу
        img = "data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' height='80' width='16' viewBox='0 0 48 240'><g><rect x='0' y='0' width='48' height='48' rx='3' ry='3' style='fill:rgb(146, 69, 101);'/><path style='opacity:0.25;fill:black;' d='M 16.8,17.6 23.1,23.9 8,26 6.4,32.2 11.4,37.2 3.7,44.8 6.9,48 45,48 C 46.7,48 48,46.7 48,45 V 20 L 31.4,3.4'/><path style='fill:white;' d='M 17.4,3 C 16.7,3 16.2,3.82 16.2,4.91 V 15.9 C 16.2,17 16.7,17.8 17.4,17.8 H 30.6 C 31.3,17.8 31.8,17 31.8,15.9 V 4.91 C 31.8,3.82 31.3,3 30.6,3 H 17.4 M 22.4,20.5 V 23.7 H 6.41 V 32.2 H 9.35 V 28.2 H 22.4 V 32.4 H 25.5 V 28.2 H 38.5 V 32.4 H 41.5 V 23.7 H 25.5 V 20.5 H 22.4 M 4.23,35.1 C 3.55,35.1 3,35.9 3,37.1 V 43 C 3,44.1 3.55,45 4.23,45 H 12.1 C 12.8,45 13.3,44.1 13.3,43 V 37.1 C 13.3,35.9 12.8,35.1 12.1,35.1 H 4.23 M 19.9,35.1 C 19.2,35.1 18.7,35.9 18.7,37.1 V 43 C 18.7,44.1 19.2,45 19.9,45 H 27.8 C 28.5,45 29,44.1 29,43 V 37.1 C 29,35.9 28.5,35.1 27.8,35.1 H 19.9 M 35.9,35.1 C 35.2,35.1 34.7,35.9 34.7,37.1 V 43 C 34.7,44.1 35.2,45 35.9,45 H 43.7 C 44.4,45 45,44.1 45,43 V 37.1 C 45,35.9 44.4,35.1 43.7,35.1 H 35.9' /><rect x='0' y='48' width='48' height='48' rx='3' ry='3' style='fill:rgb(209, 8, 3);'/><path style='opacity:0.25;fill:black;' d='M 16.8,65.6 23.1,71.9 8,74 6.4,80.2 11.4,85.2 3.7,92.8 6.9,96 45,96 C 46.7,96 48,94.7 48,93 V 68 L 31.4,51.4'/><path style='fill:white;' d='M 17.4,51 C 16.7,51 16.2,51.8 16.2,52.9 V 63.9 C 16.2,65 16.7,65.8 17.4,65.8 H 30.6 C 31.3,65.8 31.8,65 31.8,63.9 V 52.9 C 31.8,51.8 31.3,51 30.6,51 H 17.4 M 22.4,68.5 V 71.7 H 6.41 V 80.2 H 9.35 V 76.2 H 22.4 V 80.4 H 25.5 V 76.2 H 38.5 V 80.4 H 41.5 V 71.7 H 25.5 V 68.5 H 22.4 M 4.23,83.1 C 3.55,83.1 3,83.9 3,85.1 V 91 C 3,92.1 3.55,93 4.23,93 H 12.1 C 12.8,93 13.3,92.1 13.3,91 V 85.1 C 13.3,83.9 12.8,83.1 12.1,83.1 H 4.23 M 19.9,83.1 C 19.2,83.1 18.8,83.9 18.8,85.1 V 91 C 18.8,92.1 19.2,93 19.9,93 H 27.8 C 28.5,93 29,92.1 29,91 V 85.1 C 29,83.9 28.5,83.1 27.8,83.1 H 19.9 M 35.9,83.1 C 35.2,83.1 34.7,83.9 34.7,85.1 V 91 C 34.7,92.1 35.2,93 35.9,93 H 43.7 C 44.4,93 45,92.1 45,91 V 85.1 C 45,83.9 44.4,83.1 43.7,83.1 H 35.9' /><rect x='0' y='96' width='48' height='48' rx='3' ry='3' style='fill:rgb(243, 135, 37);'/><path style='opacity:0.25;fill:black;' d='M 16.8,114 23.1,120 8,122 6.4,128 11.4,133 3.7,141 6.9,144 H 45 C 46.7,144 48,142.7 48,141 V 116 L 31.4,99.4'/><path style='fill:white;' d='M 17.4,99 C 16.7,99 16.2,99.8 16.2,101 V 112 C 16.2,113 16.7,114 17.4,114 H 30.6 C 31.3,114 31.8,113 31.8,112 V 101 C 31.8,99.8 31.3,99 30.6,99 H 17.4 M 22.4,117 V 120 H 6.41 V 128 H 9.35 V 124 H 22.4 V 128 H 25.5 V 124 H 38.5 V 128 H 41.5 V 120 H 25.5 V 117 H 22.4 M 4.23,131 C 3.55,131 3,132 3,133 V 139 C 3,140 3.55,141 4.23,141 H 12.1 C 12.8,141 13.3,140 13.3,139 V 133 C 13.3,132 12.8,131 12.1,131 H 4.23 M 19.9,131 C 19.2,131 18.8,132 18.8,133 V 139 C 18.8,140 19.2,141 19.9,141 H 27.8 C 28.5,141 29,140 29,139 V 133 C 29,132 28.5,131 27.8,131 H 19.9 M 35.9,131 C 35.2,131 34.7,132 34.7,133 V 139 C 34.7,140 35.2,141 35.9,141 H 43.7 C 44.4,141 45,140 45,139 V 133 C 45,132 44.4,131 43.7,131 H 35.9' /><rect x='0' y='144' width='48' height='48' rx='3' ry='3' style='fill:rgb(21, 161, 99);'/><path style='opacity:0.25;fill:black;' d='M 16.8,162 23.1,168 8,170 6.4,176 11.4,181 3.7,189 6.9,192 H 45 C 46.7,192 48,190.7 48,189 V 164 L 31.4,147'/><path style='fill:white;' d='M 17.4,147 C 16.7,147 16.2,148 16.2,149 V 160 C 16.2,161 16.7,162 17.4,162 H 30.6 C 31.3,162 31.8,161 31.8,160 V 149 C 31.8,148 31.3,147 30.6,147 H 17.4 M 22.4,165 V 168 H 6.41 V 176 H 9.35 V 172 H 22.4 V 176 H 25.5 V 172 H 38.5 V 176 H 41.5 V 168 H 25.5 V 165 H 22.4 M 4.23,179 C 3.55,179 3,180 3,181 V 187 C 3,188 3.55,189 4.23,189 H 12.1 C 12.8,189 13.3,188 13.3,187 V 181 C 13.3,180 12.8,179 12.1,179 H 4.23 M 19.9,179 C 19.2,179 18.8,180 18.8,181 V 187 C 18.8,188 19.2,189 19.9,189 H 27.8 C 28.5,189 29,188 29,187 V 181 C 29,180 28.5,179 27.8,179 H 19.9 M 35.9,179 C 35.2,179 34.7,180 34.7,181 V 187 C 34.7,188 35.2,189 35.9,189 H 43.7 C 44.4,189 45,188 45,187 V 181 C 45,180 44.4,179 43.7,179 H 35.9' /><rect x='0' y='192' width='48' height='48' rx='3' ry='3' style='fill:rgb(0, 120, 173);'/><path style='opacity:0.25;fill:black;' d='M 16.8,210 23.1,216 8,218 6.4,224 11.4,229 3.7,237 6.9,240 H 45 C 46.7,240 48,238.7 48,237 L 48,212 31.4,195'/><path style='fill:white;' d='M 17.4,195 C 16.7,195 16.2,196 16.2,197 V 208 C 16.2,209 16.7,210 17.4,210 H 30.6 C 31.3,210 31.8,209 31.8,208 V 197 C 31.8,196 31.3,195 30.6,195 H 17.4 M 22.4,213 V 216 H 6.41 V 224 H 9.4 V 220 H 22.4 V 224 H 25.5 V 220 H 38.5 V 224 H 41.5 V 216 H 25.5 V 213 H 22.4 M 4.23,227 C 3.55,227 3,228 3,229 V 235 C 3,236 3.55,237 4.23,237 H 12.1 C 12.8,237 13.3,236 13.3,235 V 229 C 13.3,228 12.8,227 12.1,227 H 4.23 M 19.9,227 C 19.2,227 18.7,228 18.7,229 V 235 C 18.7,236 19.2,237 19.9,237 H 27.8 C 28.5,237 29,236 29,235 V 229 C 29,228 28.5,227 27.8,227 H 19.9 M 35.9,227 C 35.2,227 34.7,228 34.7,229 V 235 C 34.7,236 35.2,237 35.9,237 H 43.7 C 44.4,237 45,236 45,235 V 229 C 45,228 44.4,227 43.7,227 H 35.9' /></g></svg>",
        imgmenu = "data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' height='80' width='16' viewBox='0 0 48 240'><g><circle cy='24' cx='24' style='fill:rgb(146, 69, 101);' r='20'/><path style='opacity:0.25;fill:black;' d='M 33,41.8 22.3,31.1 36.7,17.9 44,25.2 C 43.5,30.6 41,37.7 33,41.8 Z'/><path style='fill:white;stroke:white;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;' d='M 35,19 H 13 L 24,30 35,19' /><circle cy='72' cx='24' style='fill:rgb(209, 8, 3);' r='20'/><path style='opacity:0.25;fill:black;' d='M 33,89.8 22.3,79.1 36.7,65.9 44,73.2 C 43.5,78.6 41,85.7 33,89.8 Z'/><path style='fill:white;stroke:white;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;' d='M 35,67 H 13 L 24,78 35,67' /><circle cy='120' cx='24' style='fill:rgb(243, 135, 37);' r='20'/><path style='opacity:0.25;fill:black;' d='M 32.8,138 22,127 36.7,114 44,121 C 43.5,127 40.9,134 32.8,138 Z'/><path style='fill:white;stroke:white;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;' d='M 34.9,115 H 13.1 L 24,126 34.9,115' /><circle cy='168' cx='24' style='fill:rgb(21, 161, 99);' r='20'/><path style='opacity:0.25;fill:black;' d='M 32.9,186 22,175 36.7,162 44,169 C 43.5,175 40.9,182 32.9,186 Z'/><path style='fill:white;stroke:white;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;' d='M 35,163 H 13 L 24,174 35,163' /><circle cy='216' cx='24' style='fill:rgb(0, 120, 173);' r='20'/><path style='opacity:0.25;fill:black;' d='M 32.8,234 22,223 36.7,210 44,217 C 43.5,223 40.9,230 32.8,234 Z'/><path style='fill:white;stroke:white;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;' d='M 35,211 H 13 L 24,222 35,211' /></g></svg>";

        var id2 = "ucf-open-downloads",
        label2 = "Загрузки",
        tooltiptext2 = "ЛКМ: Показать загрузки\nСКМ: Открыть папку загрузок\nПКМ: Открыть последнюю папку загрузок",
        img2 = "data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' height='16' width='16' viewBox='0 0 48 48'><g><rect x='0' y='0' width='48' height='48' rx='3' ry='3' style='fill:rgb(0, 120, 173);'/><path style='opacity:0.25;fill:black;' d='M 23.4,33 30,39.6 H 18 L 8.7,30 3.9,44.1 7.8,48 H 45 C 46.7,48 48,46.7 48,45 V 22.5 L 28.8,3.3 Z'/><path style='fill:white;' d='M 20.27,3 C 19,3 19.25,3.798 19.25,3.798 V 17.94 20.23 H 13.75 C 12.13,20.23 13.61,21.58 13.61,21.58 L 23.36,32.85 V 32.85 C 23.36,32.85 24.17,33.75 25.01,32.95 26.16,31.84 34.47,21.3 34.47,21.3 34.47,21.3 35.93,19.89 33.98,19.89 H 28.91 V 17.83 3.672 C 28.91,3.672 28.93,3 28.03,3 Z M 3,29.93 V 42.22 C 3,43.75 4.303,45 5.918,45 H 42.08 C 43.71,45 45,43.75 45,42.22 V 29.93 H 39.16 V 39.43 H 8.837 V 29.93 Z' /></g></svg>";

        var tbarbtns = {
            get network_proxy_type() {
                delete this.network_proxy_type;
                try {
                    return this.network_proxy_type = Services.prefs.getIntPref("network.proxy.type");
                } catch(e) { }
                return this.network_proxy_type = null;
            },
            get btnstyle() {
                delete this.btnstyle;
                return this.btnstyle = "data:text/css;charset=utf-8," + encodeURIComponent(`
                    #${id}-button {
                        list-style-image: url("${img}") !important;
                        -moz-image-region: rect(0px, 16px, 16px, 0px) !important;
                        margin-inline-end: 0 !important;
                    }
                    #${id}-button-menu {
                        list-style-image: url("${imgmenu}") !important;
                        -moz-image-region: rect(0px, 16px, 16px, 0px) !important;
                        margin-inline-start: 0px !important;
                    }
                    #${id}[activated="1"] :-moz-any(#${id}-button,#${id}-button-menu) {
                        -moz-image-region: rect(16px, 16px, 32px, 0px) !important;
                    }
                    #${id}[activated="2"] :-moz-any(#${id}-button,#${id}-button-menu) {
                        -moz-image-region: rect(32px, 16px, 48px, 0px) !important;
                    }
                    #${id}[activated="4"] :-moz-any(#${id}-button,#${id}-button-menu) {
                        -moz-image-region: rect(48px, 16px, 64px, 0px) !important;
                    }
                    #${id}[activated="5"] :-moz-any(#${id}-button,#${id}-button-menu) {
                        -moz-image-region: rect(64px, 16px, 80px, 0px) !important;
                    }
                    toolbarpaletteitem[place="palette"] #${id}-button-menu,
                    #${id}-button-menu dropmarker {
                        display: none !important;
                    }
                    toolbarpaletteitem[place="palette"] #${id} {
                        -moz-box-orient: vertical !important;
                    }
                    #${id}-button-menu > .toolbarbutton-icon {
                        min-width: 0 !important;
                        max-width: none !important;
                        width: auto !important;
                        padding-left: 0 !important;
                        padding-right: 0 !important;
                    }
                `);
            },
            toggleTheProxy: function() {
                Services.prefs.setIntPref("network.proxy.type", (Services.prefs.getIntPref("network.proxy.type") == toggleproxy2) ? toggleproxy : toggleproxy2);
            },
            setProxyMenuItem: function(event) {
                var proxyState = Services.prefs.getIntPref("network.proxy.type"), popup = event.currentTarget;
                for (var menuitem in popup.childNodes) {
                    var childNode = popup.childNodes[menuitem];
                    if (+childNode.getAttribute("value") == proxyState) {
                        childNode.setAttribute("checked", "true");
                        break;
                    }
                }
            },
            setProxyValue: function(event) {
                Services.prefs.setIntPref("network.proxy.type", +event.target.getAttribute("value"));
            },
            checkBrowserReload: function(win) {
                if (doreload)
                    win.BrowserReloadSkipCache();
            },
            openProxyWin: function(win) {
                var _win = Services.wm.getMostRecentWindow("aTaB:ProxyWin");
                if (_win)
                    _win.focus();
                else {
                    _win = win.openDialog("chrome://browser/content/preferences/dialogs/connection.xhtml", "_blank", "chrome,dialog=no,centerscreen,resizable");
                    var DOMLoad = () => {
                        _win.document.documentElement.setAttribute("type", "prefwindow");
                        _win.document.documentElement.setAttribute("windowtype", "aTaB:ProxyWin");
                    };
                    _win.addEventListener("DOMContentLoaded", DOMLoad, { once: true });
                    _win.opener = win;
                    _win.opener.gSubDialog = {
                        _dialogs: []
                    };
                }
            },
        };
        CustomizableUI.createWidget({
            id: id,
            type: "custom",
            label: label,
            tooltiptext: tooltiptext,
            localized: false,
            defaultArea: CustomizableUI.AREA_NAVBAR,
            onBuild: function(document) {
                var win = document.defaultView, toolbaritem = document.createXULElement("toolbaritem");
                toolbaritem.id = id;
                toolbaritem.className = "chromeclass-toolbar-additional";
                toolbaritem.setAttribute("label", label);
                toolbaritem.setAttribute("type", "custom");
                var toolbarbutton_0 = document.createXULElement("toolbarbutton");
                toolbarbutton_0.id = `${id}-button`;
                toolbarbutton_0.className = "toolbarbutton-1";
                toolbarbutton_0.setAttribute("label", label);
                toolbarbutton_0.setAttribute("tooltiptext", tooltiptext);
                toolbarbutton_0.setAttribute("context", "false");
                toolbaritem.append(toolbarbutton_0);
                var toolbarbutton_1 = document.createXULElement("toolbarbutton");
                toolbarbutton_1.id = `${id}-button-menu`;
                toolbarbutton_1.className = "toolbarbutton-1";
                toolbarbutton_1.setAttribute("type", "menu");
                toolbarbutton_1.setAttribute("label", "");
                toolbarbutton_1.setAttribute("tooltiptext", tooltiptextbtnmenu);
                toolbarbutton_1.setAttribute("context", "false");
                toolbarbutton_1.addEventListener("click", function(event) {
                    if (event.button == 2) {
                        event.preventDefault();
                        event.stopPropagation();
                        tbarbtns.openProxyWin(win);
                    }
                });
                var menupopup_0 = document.createXULElement("menupopup");
                menupopup_0.id = `${id}-popup`;
                menupopup_0.addEventListener("click", function(event) {
                    event.stopPropagation();
                });
                var proxy = tbarbtns.network_proxy_type;
                if (proxy !== null) {
                    toolbaritem.setAttribute("activated", tbarbtns.network_proxy_type);
                    toolbarbutton_0.addEventListener("command", function(event) {
                        tbarbtns.toggleTheProxy();
                        tbarbtns.checkBrowserReload(win);
                    });
                    menupopup_0.addEventListener("command", function(event) {
                        event.stopPropagation();
                        tbarbtns.setProxyValue(event);
                        tbarbtns.checkBrowserReload(win);
                    });
                    menupopup_0.addEventListener("popupshowing", function(event) {
                        tbarbtns.setProxyMenuItem(event);
                    });
                }
                var menuitem_0 = document.createXULElement("menuitem");
                menuitem_0.setAttribute("label", "Прямое подключение, без прокси");
                menuitem_0.setAttribute("type", "radio");
                menuitem_0.setAttribute("value", "0");
                menupopup_0.append(menuitem_0);
                var menuitem_1 = document.createXULElement("menuitem");
                menuitem_1.setAttribute("label", "Ручная настройка прокси");
                menuitem_1.setAttribute("type", "radio");
                menuitem_1.setAttribute("value", "1");
                menupopup_0.append(menuitem_1);
                var menuitem_2 = document.createXULElement("menuitem");
                menuitem_2.setAttribute("label", "Автоматическая настройка прокси");
                menuitem_2.setAttribute("type", "radio");
                menuitem_2.setAttribute("value", "2");
                menupopup_0.append(menuitem_2);
                var menuitem_3 = document.createXULElement("menuitem");
                menuitem_3.setAttribute("label", "Автоопределение настроек прокси");
                menuitem_3.setAttribute("type", "radio");
                menuitem_3.setAttribute("value", "4");
                menupopup_0.append(menuitem_3);
                var menuitem_4 = document.createXULElement("menuitem");
                menuitem_4.setAttribute("label", "Использовать системные настройки прокси");
                menuitem_4.setAttribute("type", "radio");
                menuitem_4.setAttribute("value", "5");
                menupopup_0.append(menuitem_4);
                var menuseparator_0 = document.createXULElement("menuseparator");
                menupopup_0.append(menuseparator_0);
                var menuitem_5 = document.createXULElement("menuitem");
                menuitem_5.setAttribute("label", "Открыть настройки прокси");
                menuitem_5.addEventListener("command", function(event) {
                    event.stopPropagation();
                    tbarbtns.openProxyWin(win);
                });
                menupopup_0.append(menuitem_5);
                toolbarbutton_1.append(menupopup_0);
                toolbaritem.append(toolbarbutton_1);
                try {
                    win.windowUtils.loadSheetUsingURIString(tbarbtns.btnstyle, win.windowUtils.USER_SHEET);
                } catch (e) {}
                return toolbaritem;
            }
        });
        Services.prefs.addObserver("network.proxy.type", {
            observe: function(aSubject, aTopic, aData) {
                if (aData == "network.proxy.type") {
                    let network_proxy_type = tbarbtns.network_proxy_type = Services.prefs.getIntPref(aData),
                    getW = CustomizableUI.getWidget(id);
                    if (getW.instances.length)
                        for(let {node} of getW.instances)
                            try {
                                node.setAttribute("activated", network_proxy_type);
                            } catch(e) {}
                    else
                        for (let win of CustomizableUI.windows)
                            try {
                                getW.forWindow(win).node.setAttribute("activated", network_proxy_type);
                            } catch(e) {}
                }
            }
        });
        CustomizableUI.createWidget({
            id: id2,
            type: "custom",
            label: label2,
            tooltiptext: tooltiptext2,
            localized: false,
            defaultArea: CustomizableUI.AREA_NAVBAR,
            onBuild: function(document) {
                var win = document.defaultView, toolbarbutton = document.createXULElement("toolbarbutton");
                toolbarbutton.id = id2;
                toolbarbutton.className = "toolbarbutton-1 chromeclass-toolbar-additional";
                toolbarbutton.setAttribute("label", label2);
                toolbarbutton.setAttribute("context", "false");
                toolbarbutton.setAttribute("tooltiptext", tooltiptext2);
                toolbarbutton.addEventListener("click", function(event) {
                    if (event.button == 0)
                        win.DownloadsPanel.showDownloadsHistory();
                    else if (event.button == 1) {
                        try {
                            Services.prefs.getComplexValue("browser.download.dir", Ci.nsIFile).launch();
                        } catch(e) {
                            Services.dirsvc.get("DfltDwnld", Ci.nsIFile).launch();
                        }
                    } else if (event.button == 2) {
                        event.preventDefault();
                        event.stopPropagation();
                        try {
                            Services.prefs.getComplexValue("browser.download.lastDir", Ci.nsIFile).launch();
                        } catch(e) {
                            Services.dirsvc.get("DfltDwnld", Ci.nsIFile).launch();
                        }
                    }
                });
                toolbarbutton.style.setProperty("list-style-image", `url("${img2}")`, "important");
                return toolbarbutton;
            }
        });
    })();
} catch(e) {}


Как бы это поправить, уважаемые гуру.

Отредактировано rubel (29-09-2023 08:01:19)

Отсутствует

 

№115629-09-2023 08:39:11

xrun1
Участник
 
Группа: Members
Зарегистрирован: 12-12-2013
Сообщений: 1194
UA: Firefox 118.0

Re: UCF - ваши кнопки, скрипты…

Northtech пишет

что поправить в UCF

Это вопрос к автору мода Dobrov. В родном всё работает.

Отсутствует

 

№115729-09-2023 09:58:59

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

Re: UCF - ваши кнопки, скрипты…

Northtech пишет

что поправить в UCF (см. ссылку) для fx 118, чтобы вернуть интервалы (special_widget)

Если что-то не пашет, просто проверьте по ссылке в шапке, может это уже исправлено!
Проще говоря, скачайте новую версию с гитхаба. У вас старый скрипт CustomStylesScripts.jsm от 12 сентября.

Отсутствует

 

№115829-09-2023 21:25:07

kokoss
Участник
 
Группа: Members
Зарегистрирован: 15-02-2018
Сообщений: 1734
UA: Firefox 115.0

Re: UCF - ваши кнопки, скрипты…


Win7

Отсутствует

 

№115930-09-2023 04:27:54

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

Re: UCF - ваши кнопки, скрипты…

kokoss
В ATB  у меня все нормально. Именно в кнопке они сломались.
И что мне делать с тем архивом от Dumby ?
В кнопке иконки прописаны здесь:

Выделить код

Код:

img = "data:image
imgmenu = "data:image

Отредактировано rubel (30-09-2023 04:43:55)

Отсутствует

 

№116030-09-2023 06:44:24

fuchsfan
Участник
 
Группа: Members
Зарегистрирован: 07-08-2023
Сообщений: 115
UA: Firefox 119.0

Re: UCF - ваши кнопки, скрипты…

Northtech пишет

Подскажите пожалуйста, что поправить в UCF (см. ссылку) для fx 118, чтобы вернуть интервалы (special_widget), остался только растягивающийся интервал, а пробел и разделитель пропали.

Встречалось такое на этом форуме

В файле user_chrome_files\custom_scripts\CustomStylesScripts.jsm нужно раскомментировать две строки:
---------------------
// { path: "special_widget.css", type: "USER_SHEET", sheet(f) { preloadSheet(this, f); }, }, // <-- Special Widgets
---------------------
// { path: "scripts3/special_widgets.js", ucfobj: true, }, // <-- Special Widgets
---------------------
В настройках UCF включить опцию Для докум. всех окон [ChromeOnly] и перезапустить с очисткой startupCache.

Еще существует отдельный скрипт, не из состава ucf, создает как раз два пропавших элемента https://forum.ru-board.com/topic.cgi?fo … tart=80#14 , по сути это скрипт от Dumby, в который Farby встроил css-код. Активировать его можно как в ucf, так и без.

Отсутствует

 

№116130-09-2023 07:50:41

Dumby
Участник
 
Группа: Members
Зарегистрирован: 12-08-2012
Сообщений: 2201
UA: Firefox 78.0

Re: UCF - ваши кнопки, скрипты…

Dobrov пишет

Можно её переделать на onCreated(btn) {……???

скрытый текст

Выделить код

Код:

/*
		id: id, label: label, type: "custom", localized: false,
		onBuild(doc) {
			var win = doc.defaultView, trim = doc.createXULElement("toolbaritem");
			trim.id = id;
			trim.className = "toolbaritem-combined-buttons ucf-toolbaritem-combined-buttons chromeclass-toolbar-additional";
			trim.setAttribute("label", label);
			trim.setAttribute("type", "custom");
			trim.style.setProperty("margin-inline","0");
			var trbn_1 = doc.createXULElement("toolbarbutton");
			trbn_1.id = `${id}-button-menu`;
			trbn_1.className = "toolbarbutton-1 ucf-toolbarbutton-combined-buttons-toolbarbutton";
			trbn_1.setAttribute("type", "menu");
			trbn_1.setAttribute("label", "");
*/
		id, label, localized: false,
		onCreated(trbn_1) {
			var win = trbn_1.ownerGlobal, doc = win.document;
			trbn_1.setAttribute("type", "menu");

.......

/*
			trim.append(trbn_1);
			return trim;
*/

rubel пишет

сломалась иконка

скрытый текст

Выделить код

Код:

/*
        img = "data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' height='80' width='16' viewBox='0 0 48 240'><g><rect x='0' y='0' width='48' height='48' rx='3' ry='3' style='fill:rgb(146, 69, 101);'/><path style='opacity:0.25;fill:black;' d='M 16.8,17.6 23.1,23.9 8,26 6.4,32.2 11.4,37.2 3.7,44.8 6.9,48 45,48 C 46.7,48 48,46.7 48,45 V 20 L 31.4,3.4'/><path style='fill:white;' d='M 17.4,3 C 16.7,3 16.2,3.82 16.2,4.91 V 15.9 C 16.2,17 16.7,17.8 17.4,17.8 H 30.6 C 31.3,17.8 31.8,17 31.8,15.9 V 4.91 C 31.8,3.82 31.3,3 30.6,3 H 17.4 M 22.4,20.5 V 23.7 H 6.41 V 32.2 H 9.35 V 28.2 H 22.4 V 32.4 H 25.5 V 28.2 H 38.5 V 32.4 H 41.5 V 23.7 H 25.5 V 20.5 H 22.4 M 4.23,35.1 C 3.55,35.1 3,35.9 3,37.1 V 43 C 3,44.1 3.55,45 4.23,45 H 12.1 C 12.8,45 13.3,44.1 13.3,43 V 37.1 C 13.3,35.9 12.8,35.1 12.1,35.1 H 4.23 M 19.9,35.1 C 19.2,35.1 18.7,35.9 18.7,37.1 V 43 C 18.7,44.1 19.2,45 19.9,45 H 27.8 C 28.5,45 29,44.1 29,43 V 37.1 C 29,35.9 28.5,35.1 27.8,35.1 H 19.9 M 35.9,35.1 C 35.2,35.1 34.7,35.9 34.7,37.1 V 43 C 34.7,44.1 35.2,45 35.9,45 H 43.7 C 44.4,45 45,44.1 45,43 V 37.1 C 45,35.9 44.4,35.1 43.7,35.1 H 35.9' /><rect x='0' y='48' width='48' height='48' rx='3' ry='3' style='fill:rgb(209, 8, 3);'/><path style='opacity:0.25;fill:black;' d='M 16.8,65.6 23.1,71.9 8,74 6.4,80.2 11.4,85.2 3.7,92.8 6.9,96 45,96 C 46.7,96 48,94.7 48,93 V 68 L 31.4,51.4'/><path style='fill:white;' d='M 17.4,51 C 16.7,51 16.2,51.8 16.2,52.9 V 63.9 C 16.2,65 16.7,65.8 17.4,65.8 H 30.6 C 31.3,65.8 31.8,65 31.8,63.9 V 52.9 C 31.8,51.8 31.3,51 30.6,51 H 17.4 M 22.4,68.5 V 71.7 H 6.41 V 80.2 H 9.35 V 76.2 H 22.4 V 80.4 H 25.5 V 76.2 H 38.5 V 80.4 H 41.5 V 71.7 H 25.5 V 68.5 H 22.4 M 4.23,83.1 C 3.55,83.1 3,83.9 3,85.1 V 91 C 3,92.1 3.55,93 4.23,93 H 12.1 C 12.8,93 13.3,92.1 13.3,91 V 85.1 C 13.3,83.9 12.8,83.1 12.1,83.1 H 4.23 M 19.9,83.1 C 19.2,83.1 18.8,83.9 18.8,85.1 V 91 C 18.8,92.1 19.2,93 19.9,93 H 27.8 C 28.5,93 29,92.1 29,91 V 85.1 C 29,83.9 28.5,83.1 27.8,83.1 H 19.9 M 35.9,83.1 C 35.2,83.1 34.7,83.9 34.7,85.1 V 91 C 34.7,92.1 35.2,93 35.9,93 H 43.7 C 44.4,93 45,92.1 45,91 V 85.1 C 45,83.9 44.4,83.1 43.7,83.1 H 35.9' /><rect x='0' y='96' width='48' height='48' rx='3' ry='3' style='fill:rgb(243, 135, 37);'/><path style='opacity:0.25;fill:black;' d='M 16.8,114 23.1,120 8,122 6.4,128 11.4,133 3.7,141 6.9,144 H 45 C 46.7,144 48,142.7 48,141 V 116 L 31.4,99.4'/><path style='fill:white;' d='M 17.4,99 C 16.7,99 16.2,99.8 16.2,101 V 112 C 16.2,113 16.7,114 17.4,114 H 30.6 C 31.3,114 31.8,113 31.8,112 V 101 C 31.8,99.8 31.3,99 30.6,99 H 17.4 M 22.4,117 V 120 H 6.41 V 128 H 9.35 V 124 H 22.4 V 128 H 25.5 V 124 H 38.5 V 128 H 41.5 V 120 H 25.5 V 117 H 22.4 M 4.23,131 C 3.55,131 3,132 3,133 V 139 C 3,140 3.55,141 4.23,141 H 12.1 C 12.8,141 13.3,140 13.3,139 V 133 C 13.3,132 12.8,131 12.1,131 H 4.23 M 19.9,131 C 19.2,131 18.8,132 18.8,133 V 139 C 18.8,140 19.2,141 19.9,141 H 27.8 C 28.5,141 29,140 29,139 V 133 C 29,132 28.5,131 27.8,131 H 19.9 M 35.9,131 C 35.2,131 34.7,132 34.7,133 V 139 C 34.7,140 35.2,141 35.9,141 H 43.7 C 44.4,141 45,140 45,139 V 133 C 45,132 44.4,131 43.7,131 H 35.9' /><rect x='0' y='144' width='48' height='48' rx='3' ry='3' style='fill:rgb(21, 161, 99);'/><path style='opacity:0.25;fill:black;' d='M 16.8,162 23.1,168 8,170 6.4,176 11.4,181 3.7,189 6.9,192 H 45 C 46.7,192 48,190.7 48,189 V 164 L 31.4,147'/><path style='fill:white;' d='M 17.4,147 C 16.7,147 16.2,148 16.2,149 V 160 C 16.2,161 16.7,162 17.4,162 H 30.6 C 31.3,162 31.8,161 31.8,160 V 149 C 31.8,148 31.3,147 30.6,147 H 17.4 M 22.4,165 V 168 H 6.41 V 176 H 9.35 V 172 H 22.4 V 176 H 25.5 V 172 H 38.5 V 176 H 41.5 V 168 H 25.5 V 165 H 22.4 M 4.23,179 C 3.55,179 3,180 3,181 V 187 C 3,188 3.55,189 4.23,189 H 12.1 C 12.8,189 13.3,188 13.3,187 V 181 C 13.3,180 12.8,179 12.1,179 H 4.23 M 19.9,179 C 19.2,179 18.8,180 18.8,181 V 187 C 18.8,188 19.2,189 19.9,189 H 27.8 C 28.5,189 29,188 29,187 V 181 C 29,180 28.5,179 27.8,179 H 19.9 M 35.9,179 C 35.2,179 34.7,180 34.7,181 V 187 C 34.7,188 35.2,189 35.9,189 H 43.7 C 44.4,189 45,188 45,187 V 181 C 45,180 44.4,179 43.7,179 H 35.9' /><rect x='0' y='192' width='48' height='48' rx='3' ry='3' style='fill:rgb(0, 120, 173);'/><path style='opacity:0.25;fill:black;' d='M 16.8,210 23.1,216 8,218 6.4,224 11.4,229 3.7,237 6.9,240 H 45 C 46.7,240 48,238.7 48,237 L 48,212 31.4,195'/><path style='fill:white;' d='M 17.4,195 C 16.7,195 16.2,196 16.2,197 V 208 C 16.2,209 16.7,210 17.4,210 H 30.6 C 31.3,210 31.8,209 31.8,208 V 197 C 31.8,196 31.3,195 30.6,195 H 17.4 M 22.4,213 V 216 H 6.41 V 224 H 9.4 V 220 H 22.4 V 224 H 25.5 V 220 H 38.5 V 224 H 41.5 V 216 H 25.5 V 213 H 22.4 M 4.23,227 C 3.55,227 3,228 3,229 V 235 C 3,236 3.55,237 4.23,237 H 12.1 C 12.8,237 13.3,236 13.3,235 V 229 C 13.3,228 12.8,227 12.1,227 H 4.23 M 19.9,227 C 19.2,227 18.7,228 18.7,229 V 235 C 18.7,236 19.2,237 19.9,237 H 27.8 C 28.5,237 29,236 29,235 V 229 C 29,228 28.5,227 27.8,227 H 19.9 M 35.9,227 C 35.2,227 34.7,228 34.7,229 V 235 C 34.7,236 35.2,237 35.9,237 H 43.7 C 44.4,237 45,236 45,235 V 229 C 45,228 44.4,227 43.7,227 H 35.9' /></g></svg>",
        imgmenu = "data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' height='80' width='16' viewBox='0 0 48 240'><g><circle cy='24' cx='24' style='fill:rgb(146, 69, 101);' r='20'/><path style='opacity:0.25;fill:black;' d='M 33,41.8 22.3,31.1 36.7,17.9 44,25.2 C 43.5,30.6 41,37.7 33,41.8 Z'/><path style='fill:white;stroke:white;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;' d='M 35,19 H 13 L 24,30 35,19' /><circle cy='72' cx='24' style='fill:rgb(209, 8, 3);' r='20'/><path style='opacity:0.25;fill:black;' d='M 33,89.8 22.3,79.1 36.7,65.9 44,73.2 C 43.5,78.6 41,85.7 33,89.8 Z'/><path style='fill:white;stroke:white;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;' d='M 35,67 H 13 L 24,78 35,67' /><circle cy='120' cx='24' style='fill:rgb(243, 135, 37);' r='20'/><path style='opacity:0.25;fill:black;' d='M 32.8,138 22,127 36.7,114 44,121 C 43.5,127 40.9,134 32.8,138 Z'/><path style='fill:white;stroke:white;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;' d='M 34.9,115 H 13.1 L 24,126 34.9,115' /><circle cy='168' cx='24' style='fill:rgb(21, 161, 99);' r='20'/><path style='opacity:0.25;fill:black;' d='M 32.9,186 22,175 36.7,162 44,169 C 43.5,175 40.9,182 32.9,186 Z'/><path style='fill:white;stroke:white;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;' d='M 35,163 H 13 L 24,174 35,163' /><circle cy='216' cx='24' style='fill:rgb(0, 120, 173);' r='20'/><path style='opacity:0.25;fill:black;' d='M 32.8,234 22,223 36.7,210 44,217 C 43.5,223 40.9,230 32.8,234 Z'/><path style='fill:white;stroke:white;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;' d='M 35,211 H 13 L 24,222 35,211' /></g></svg>";
*/
        img = "data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' height='80' width='16' viewBox='0 0 48 48'><view id='1' viewBox='0 48 48 48'/><view id='2' viewBox='0 96 48 48'/><view id='4' viewBox='0 144 48 48'/><view id='5' viewBox='0 192 48 48'/><g><rect x='0' y='0' width='48' height='48' rx='3' ry='3' style='fill:rgb(146, 69, 101);'/><path style='opacity:0.25;fill:black;' d='M 16.8,17.6 23.1,23.9 8,26 6.4,32.2 11.4,37.2 3.7,44.8 6.9,48 45,48 C 46.7,48 48,46.7 48,45 V 20 L 31.4,3.4'/><path style='fill:white;' d='M 17.4,3 C 16.7,3 16.2,3.82 16.2,4.91 V 15.9 C 16.2,17 16.7,17.8 17.4,17.8 H 30.6 C 31.3,17.8 31.8,17 31.8,15.9 V 4.91 C 31.8,3.82 31.3,3 30.6,3 H 17.4 M 22.4,20.5 V 23.7 H 6.41 V 32.2 H 9.35 V 28.2 H 22.4 V 32.4 H 25.5 V 28.2 H 38.5 V 32.4 H 41.5 V 23.7 H 25.5 V 20.5 H 22.4 M 4.23,35.1 C 3.55,35.1 3,35.9 3,37.1 V 43 C 3,44.1 3.55,45 4.23,45 H 12.1 C 12.8,45 13.3,44.1 13.3,43 V 37.1 C 13.3,35.9 12.8,35.1 12.1,35.1 H 4.23 M 19.9,35.1 C 19.2,35.1 18.7,35.9 18.7,37.1 V 43 C 18.7,44.1 19.2,45 19.9,45 H 27.8 C 28.5,45 29,44.1 29,43 V 37.1 C 29,35.9 28.5,35.1 27.8,35.1 H 19.9 M 35.9,35.1 C 35.2,35.1 34.7,35.9 34.7,37.1 V 43 C 34.7,44.1 35.2,45 35.9,45 H 43.7 C 44.4,45 45,44.1 45,43 V 37.1 C 45,35.9 44.4,35.1 43.7,35.1 H 35.9' /><rect x='0' y='48' width='48' height='48' rx='3' ry='3' style='fill:rgb(209, 8, 3);'/><path style='opacity:0.25;fill:black;' d='M 16.8,65.6 23.1,71.9 8,74 6.4,80.2 11.4,85.2 3.7,92.8 6.9,96 45,96 C 46.7,96 48,94.7 48,93 V 68 L 31.4,51.4'/><path style='fill:white;' d='M 17.4,51 C 16.7,51 16.2,51.8 16.2,52.9 V 63.9 C 16.2,65 16.7,65.8 17.4,65.8 H 30.6 C 31.3,65.8 31.8,65 31.8,63.9 V 52.9 C 31.8,51.8 31.3,51 30.6,51 H 17.4 M 22.4,68.5 V 71.7 H 6.41 V 80.2 H 9.35 V 76.2 H 22.4 V 80.4 H 25.5 V 76.2 H 38.5 V 80.4 H 41.5 V 71.7 H 25.5 V 68.5 H 22.4 M 4.23,83.1 C 3.55,83.1 3,83.9 3,85.1 V 91 C 3,92.1 3.55,93 4.23,93 H 12.1 C 12.8,93 13.3,92.1 13.3,91 V 85.1 C 13.3,83.9 12.8,83.1 12.1,83.1 H 4.23 M 19.9,83.1 C 19.2,83.1 18.8,83.9 18.8,85.1 V 91 C 18.8,92.1 19.2,93 19.9,93 H 27.8 C 28.5,93 29,92.1 29,91 V 85.1 C 29,83.9 28.5,83.1 27.8,83.1 H 19.9 M 35.9,83.1 C 35.2,83.1 34.7,83.9 34.7,85.1 V 91 C 34.7,92.1 35.2,93 35.9,93 H 43.7 C 44.4,93 45,92.1 45,91 V 85.1 C 45,83.9 44.4,83.1 43.7,83.1 H 35.9' /><rect x='0' y='96' width='48' height='48' rx='3' ry='3' style='fill:rgb(243, 135, 37);'/><path style='opacity:0.25;fill:black;' d='M 16.8,114 23.1,120 8,122 6.4,128 11.4,133 3.7,141 6.9,144 H 45 C 46.7,144 48,142.7 48,141 V 116 L 31.4,99.4'/><path style='fill:white;' d='M 17.4,99 C 16.7,99 16.2,99.8 16.2,101 V 112 C 16.2,113 16.7,114 17.4,114 H 30.6 C 31.3,114 31.8,113 31.8,112 V 101 C 31.8,99.8 31.3,99 30.6,99 H 17.4 M 22.4,117 V 120 H 6.41 V 128 H 9.35 V 124 H 22.4 V 128 H 25.5 V 124 H 38.5 V 128 H 41.5 V 120 H 25.5 V 117 H 22.4 M 4.23,131 C 3.55,131 3,132 3,133 V 139 C 3,140 3.55,141 4.23,141 H 12.1 C 12.8,141 13.3,140 13.3,139 V 133 C 13.3,132 12.8,131 12.1,131 H 4.23 M 19.9,131 C 19.2,131 18.8,132 18.8,133 V 139 C 18.8,140 19.2,141 19.9,141 H 27.8 C 28.5,141 29,140 29,139 V 133 C 29,132 28.5,131 27.8,131 H 19.9 M 35.9,131 C 35.2,131 34.7,132 34.7,133 V 139 C 34.7,140 35.2,141 35.9,141 H 43.7 C 44.4,141 45,140 45,139 V 133 C 45,132 44.4,131 43.7,131 H 35.9' /><rect x='0' y='144' width='48' height='48' rx='3' ry='3' style='fill:rgb(21, 161, 99);'/><path style='opacity:0.25;fill:black;' d='M 16.8,162 23.1,168 8,170 6.4,176 11.4,181 3.7,189 6.9,192 H 45 C 46.7,192 48,190.7 48,189 V 164 L 31.4,147'/><path style='fill:white;' d='M 17.4,147 C 16.7,147 16.2,148 16.2,149 V 160 C 16.2,161 16.7,162 17.4,162 H 30.6 C 31.3,162 31.8,161 31.8,160 V 149 C 31.8,148 31.3,147 30.6,147 H 17.4 M 22.4,165 V 168 H 6.41 V 176 H 9.35 V 172 H 22.4 V 176 H 25.5 V 172 H 38.5 V 176 H 41.5 V 168 H 25.5 V 165 H 22.4 M 4.23,179 C 3.55,179 3,180 3,181 V 187 C 3,188 3.55,189 4.23,189 H 12.1 C 12.8,189 13.3,188 13.3,187 V 181 C 13.3,180 12.8,179 12.1,179 H 4.23 M 19.9,179 C 19.2,179 18.8,180 18.8,181 V 187 C 18.8,188 19.2,189 19.9,189 H 27.8 C 28.5,189 29,188 29,187 V 181 C 29,180 28.5,179 27.8,179 H 19.9 M 35.9,179 C 35.2,179 34.7,180 34.7,181 V 187 C 34.7,188 35.2,189 35.9,189 H 43.7 C 44.4,189 45,188 45,187 V 181 C 45,180 44.4,179 43.7,179 H 35.9' /><rect x='0' y='192' width='48' height='48' rx='3' ry='3' style='fill:rgb(0, 120, 173);'/><path style='opacity:0.25;fill:black;' d='M 16.8,210 23.1,216 8,218 6.4,224 11.4,229 3.7,237 6.9,240 H 45 C 46.7,240 48,238.7 48,237 L 48,212 31.4,195'/><path style='fill:white;' d='M 17.4,195 C 16.7,195 16.2,196 16.2,197 V 208 C 16.2,209 16.7,210 17.4,210 H 30.6 C 31.3,210 31.8,209 31.8,208 V 197 C 31.8,196 31.3,195 30.6,195 H 17.4 M 22.4,213 V 216 H 6.41 V 224 H 9.4 V 220 H 22.4 V 224 H 25.5 V 220 H 38.5 V 224 H 41.5 V 216 H 25.5 V 213 H 22.4 M 4.23,227 C 3.55,227 3,228 3,229 V 235 C 3,236 3.55,237 4.23,237 H 12.1 C 12.8,237 13.3,236 13.3,235 V 229 C 13.3,228 12.8,227 12.1,227 H 4.23 M 19.9,227 C 19.2,227 18.7,228 18.7,229 V 235 C 18.7,236 19.2,237 19.9,237 H 27.8 C 28.5,237 29,236 29,235 V 229 C 29,228 28.5,227 27.8,227 H 19.9 M 35.9,227 C 35.2,227 34.7,228 34.7,229 V 235 C 34.7,236 35.2,237 35.9,237 H 43.7 C 44.4,237 45,236 45,235 V 229 C 45,228 44.4,227 43.7,227 H 35.9' /></g></svg>",
        imgmenu = "data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' height='80' width='16' viewBox='0 0 48 48'><view id='1' viewBox='0 48 48 48'/><view id='2' viewBox='0 96 48 48'/><view id='4' viewBox='0 144 48 48'/><view id='5' viewBox='0 192 48 48'/><g><circle cy='24' cx='24' style='fill:rgb(146, 69, 101);' r='20'/><path style='opacity:0.25;fill:black;' d='M 33,41.8 22.3,31.1 36.7,17.9 44,25.2 C 43.5,30.6 41,37.7 33,41.8 Z'/><path style='fill:white;stroke:white;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;' d='M 35,19 H 13 L 24,30 35,19' /><circle cy='72' cx='24' style='fill:rgb(209, 8, 3);' r='20'/><path style='opacity:0.25;fill:black;' d='M 33,89.8 22.3,79.1 36.7,65.9 44,73.2 C 43.5,78.6 41,85.7 33,89.8 Z'/><path style='fill:white;stroke:white;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;' d='M 35,67 H 13 L 24,78 35,67' /><circle cy='120' cx='24' style='fill:rgb(243, 135, 37);' r='20'/><path style='opacity:0.25;fill:black;' d='M 32.8,138 22,127 36.7,114 44,121 C 43.5,127 40.9,134 32.8,138 Z'/><path style='fill:white;stroke:white;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;' d='M 34.9,115 H 13.1 L 24,126 34.9,115' /><circle cy='168' cx='24' style='fill:rgb(21, 161, 99);' r='20'/><path style='opacity:0.25;fill:black;' d='M 32.9,186 22,175 36.7,162 44,169 C 43.5,175 40.9,182 32.9,186 Z'/><path style='fill:white;stroke:white;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;' d='M 35,163 H 13 L 24,174 35,163' /><circle cy='216' cx='24' style='fill:rgb(0, 120, 173);' r='20'/><path style='opacity:0.25;fill:black;' d='M 32.8,234 22,223 36.7,210 44,217 C 43.5,223 40.9,230 32.8,234 Z'/><path style='fill:white;stroke:white;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;' d='M 35,211 H 13 L 24,222 35,211' /></g></svg>";

.......

/*
                    #${id}-button {
                        list-style-image: url("${img}") !important;
                        -moz-image-region: rect(0px, 16px, 16px, 0px) !important;
                        margin-inline-end: 0 !important;
                    }
                    #${id}-button-menu {
                        list-style-image: url("${imgmenu}") !important;
                        -moz-image-region: rect(0px, 16px, 16px, 0px) !important;
                        margin-inline-start: 0px !important;
                    }
                    #${id}[activated="1"] :-moz-any(#${id}-button,#${id}-button-menu) {
                        -moz-image-region: rect(16px, 16px, 32px, 0px) !important;
                    }
                    #${id}[activated="2"] :-moz-any(#${id}-button,#${id}-button-menu) {
                        -moz-image-region: rect(32px, 16px, 48px, 0px) !important;
                    }
                    #${id}[activated="4"] :-moz-any(#${id}-button,#${id}-button-menu) {
                        -moz-image-region: rect(48px, 16px, 64px, 0px) !important;
                    }
                    #${id}[activated="5"] :-moz-any(#${id}-button,#${id}-button-menu) {
                        -moz-image-region: rect(64px, 16px, 80px, 0px) !important;
                    }
*/
                    #${id}-button {
                        list-style-image: url("${img}") !important;
                        margin-inline-end: 0 !important;
                    }
                    #${id}[activated="1"] > #${id}-button {
                        list-style-image: url("${img}#1") !important;
                    }
                    #${id}[activated="2"] > #${id}-button {
                        list-style-image: url("${img}#2") !important;
                    }
                    #${id}[activated="4"] > #${id}-button {
                        list-style-image: url("${img}#4") !important;
                    }
                    #${id}[activated="5"] > #${id}-button {
                        list-style-image: url("${img}#5") !important;
                    }

                    #${id}-button-menu {
                        list-style-image: url("${imgmenu}") !important;
                        margin-inline-start: 0px !important;
                    }
                    #${id}[activated="1"] > #${id}-button-menu {
                        list-style-image: url("${imgmenu}#1") !important;
                    }
                    #${id}[activated="2"] > #${id}-button-menu {
                        list-style-image: url("${imgmenu}#2") !important;
                    }
                    #${id}[activated="4"] > #${id}-button-menu {
                        list-style-image: url("${imgmenu}#4") !important;
                    }
                    #${id}[activated="5"] > #${id}-button-menu {
                        list-style-image: url("${imgmenu}#5") !important;
                    }

.......

/*
                        width: auto !important;
*/

Отсутствует

 

№116230-09-2023 16:50:04

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

Re: UCF - ваши кнопки, скрипты…

Dumby
А куда вставлять код стилей после img = и  imgmenu =
Распишите, пожалуйста, подробнее для таких как я любителей.

Отсутствует

 

№116330-09-2023 17:47:30

Dumby
Участник
 
Группа: Members
Зарегистрирован: 12-08-2012
Сообщений: 2201
UA: Firefox 78.0

Re: UCF - ваши кнопки, скрипты…

rubel пишет

А куда вставлять код стилей после img = и  imgmenu =

Значит с img и imgmenu понятно.
Закомментирован кусок из приведённого кода,
а далее идёт кусок кода, который предлагается вместо него.


С кодом стилей — то же самое.
Находишь в коде закомментированый кусок, и меняешь на новый.


Строка width: auto !important; (там в конце) — это третья часть.
Эту строку предлагается просто убрать, без какой-либо замены.

Отсутствует

 

№116430-09-2023 18:24:55

b0ttle
Участник
 
Группа: Members
Зарегистрирован: 22-10-2020
Сообщений: 182
UA: Firefox 117.0

Re: UCF - ваши кнопки, скрипты…

Dumby
Как тут такое же сделать? Как здесь. Иконка прокси, чтобы "Active", "Not Active", было на первые две в иконке.

Выделить код

Код:

data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' height='80' width='16' viewBox='0 0 48 48'><view id='1' viewBox='0 48 48 48'/><view id='2' viewBox='0 96 48 48'/><view id='4' viewBox='0 144 48 48'/><view id='5' viewBox='0 192 48 48'/><g><rect x='0' y='0' width='48' height='48' rx='3' ry='3' style='fill:rgb(146, 69, 101);'/><path style='opacity:0.25;fill:black;' d='M 16.8,17.6 23.1,23.9 8,26 6.4,32.2 11.4,37.2 3.7,44.8 6.9,48 45,48 C 46.7,48 48,46.7 48,45 V 20 L 31.4,3.4'/><path style='fill:white;' d='M 17.4,3 C 16.7,3 16.2,3.82 16.2,4.91 V 15.9 C 16.2,17 16.7,17.8 17.4,17.8 H 30.6 C 31.3,17.8 31.8,17 31.8,15.9 V 4.91 C 31.8,3.82 31.3,3 30.6,3 H 17.4 M 22.4,20.5 V 23.7 H 6.41 V 32.2 H 9.35 V 28.2 H 22.4 V 32.4 H 25.5 V 28.2 H 38.5 V 32.4 H 41.5 V 23.7 H 25.5 V 20.5 H 22.4 M 4.23,35.1 C 3.55,35.1 3,35.9 3,37.1 V 43 C 3,44.1 3.55,45 4.23,45 H 12.1 C 12.8,45 13.3,44.1 13.3,43 V 37.1 C 13.3,35.9 12.8,35.1 12.1,35.1 H 4.23 M 19.9,35.1 C 19.2,35.1 18.7,35.9 18.7,37.1 V 43 C 18.7,44.1 19.2,45 19.9,45 H 27.8 C 28.5,45 29,44.1 29,43 V 37.1 C 29,35.9 28.5,35.1 27.8,35.1 H 19.9 M 35.9,35.1 C 35.2,35.1 34.7,35.9 34.7,37.1 V 43 C 34.7,44.1 35.2,45 35.9,45 H 43.7 C 44.4,45 45,44.1 45,43 V 37.1 C 45,35.9 44.4,35.1 43.7,35.1 H 35.9' /><rect x='0' y='48' width='48' height='48' rx='3' ry='3' style='fill:rgb(209, 8, 3);'/><path style='opacity:0.25;fill:black;' d='M 16.8,65.6 23.1,71.9 8,74 6.4,80.2 11.4,85.2 3.7,92.8 6.9,96 45,96 C 46.7,96 48,94.7 48,93 V 68 L 31.4,51.4'/><path style='fill:white;' d='M 17.4,51 C 16.7,51 16.2,51.8 16.2,52.9 V 63.9 C 16.2,65 16.7,65.8 17.4,65.8 H 30.6 C 31.3,65.8 31.8,65 31.8,63.9 V 52.9 C 31.8,51.8 31.3,51 30.6,51 H 17.4 M 22.4,68.5 V 71.7 H 6.41 V 80.2 H 9.35 V 76.2 H 22.4 V 80.4 H 25.5 V 76.2 H 38.5 V 80.4 H 41.5 V 71.7 H 25.5 V 68.5 H 22.4 M 4.23,83.1 C 3.55,83.1 3,83.9 3,85.1 V 91 C 3,92.1 3.55,93 4.23,93 H 12.1 C 12.8,93 13.3,92.1 13.3,91 V 85.1 C 13.3,83.9 12.8,83.1 12.1,83.1 H 4.23 M 19.9,83.1 C 19.2,83.1 18.8,83.9 18.8,85.1 V 91 C 18.8,92.1 19.2,93 19.9,93 H 27.8 C 28.5,93 29,92.1 29,91 V 85.1 C 29,83.9 28.5,83.1 27.8,83.1 H 19.9 M 35.9,83.1 C 35.2,83.1 34.7,83.9 34.7,85.1 V 91 C 34.7,92.1 35.2,93 35.9,93 H 43.7 C 44.4,93 45,92.1 45,91 V 85.1 C 45,83.9 44.4,83.1 43.7,83.1 H 35.9' /><rect x='0' y='96' width='48' height='48' rx='3' ry='3' style='fill:rgb(243, 135, 37);'/><path style='opacity:0.25;fill:black;' d='M 16.8,114 23.1,120 8,122 6.4,128 11.4,133 3.7,141 6.9,144 H 45 C 46.7,144 48,142.7 48,141 V 116 L 31.4,99.4'/><path style='fill:white;' d='M 17.4,99 C 16.7,99 16.2,99.8 16.2,101 V 112 C 16.2,113 16.7,114 17.4,114 H 30.6 C 31.3,114 31.8,113 31.8,112 V 101 C 31.8,99.8 31.3,99 30.6,99 H 17.4 M 22.4,117 V 120 H 6.41 V 128 H 9.35 V 124 H 22.4 V 128 H 25.5 V 124 H 38.5 V 128 H 41.5 V 120 H 25.5 V 117 H 22.4 M 4.23,131 C 3.55,131 3,132 3,133 V 139 C 3,140 3.55,141 4.23,141 H 12.1 C 12.8,141 13.3,140 13.3,139 V 133 C 13.3,132 12.8,131 12.1,131 H 4.23 M 19.9,131 C 19.2,131 18.8,132 18.8,133 V 139 C 18.8,140 19.2,141 19.9,141 H 27.8 C 28.5,141 29,140 29,139 V 133 C 29,132 28.5,131 27.8,131 H 19.9 M 35.9,131 C 35.2,131 34.7,132 34.7,133 V 139 C 34.7,140 35.2,141 35.9,141 H 43.7 C 44.4,141 45,140 45,139 V 133 C 45,132 44.4,131 43.7,131 H 35.9' /><rect x='0' y='144' width='48' height='48' rx='3' ry='3' style='fill:rgb(21, 161, 99);'/><path style='opacity:0.25;fill:black;' d='M 16.8,162 23.1,168 8,170 6.4,176 11.4,181 3.7,189 6.9,192 H 45 C 46.7,192 48,190.7 48,189 V 164 L 31.4,147'/><path style='fill:white;' d='M 17.4,147 C 16.7,147 16.2,148 16.2,149 V 160 C 16.2,161 16.7,162 17.4,162 H 30.6 C 31.3,162 31.8,161 31.8,160 V 149 C 31.8,148 31.3,147 30.6,147 H 17.4 M 22.4,165 V 168 H 6.41 V 176 H 9.35 V 172 H 22.4 V 176 H 25.5 V 172 H 38.5 V 176 H 41.5 V 168 H 25.5 V 165 H 22.4 M 4.23,179 C 3.55,179 3,180 3,181 V 187 C 3,188 3.55,189 4.23,189 H 12.1 C 12.8,189 13.3,188 13.3,187 V 181 C 13.3,180 12.8,179 12.1,179 H 4.23 M 19.9,179 C 19.2,179 18.8,180 18.8,181 V 187 C 18.8,188 19.2,189 19.9,189 H 27.8 C 28.5,189 29,188 29,187 V 181 C 29,180 28.5,179 27.8,179 H 19.9 M 35.9,179 C 35.2,179 34.7,180 34.7,181 V 187 C 34.7,188 35.2,189 35.9,189 H 43.7 C 44.4,189 45,188 45,187 V 181 C 45,180 44.4,179 43.7,179 H 35.9' /><rect x='0' y='192' width='48' height='48' rx='3' ry='3' style='fill:rgb(0, 120, 173);'/><path style='opacity:0.25;fill:black;' d='M 16.8,210 23.1,216 8,218 6.4,224 11.4,229 3.7,237 6.9,240 H 45 C 46.7,240 48,238.7 48,237 L 48,212 31.4,195'/><path style='fill:white;' d='M 17.4,195 C 16.7,195 16.2,196 16.2,197 V 208 C 16.2,209 16.7,210 17.4,210 H 30.6 C 31.3,210 31.8,209 31.8,208 V 197 C 31.8,196 31.3,195 30.6,195 H 17.4 M 22.4,213 V 216 H 6.41 V 224 H 9.4 V 220 H 22.4 V 224 H 25.5 V 220 H 38.5 V 224 H 41.5 V 216 H 25.5 V 213 H 22.4 M 4.23,227 C 3.55,227 3,228 3,229 V 235 C 3,236 3.55,237 4.23,237 H 12.1 C 12.8,237 13.3,236 13.3,235 V 229 C 13.3,228 12.8,227 12.1,227 H 4.23 M 19.9,227 C 19.2,227 18.7,228 18.7,229 V 235 C 18.7,236 19.2,237 19.9,237 H 27.8 C 28.5,237 29,236 29,235 V 229 C 29,228 28.5,227 27.8,227 H 19.9 M 35.9,227 C 35.2,227 34.7,228 34.7,229 V 235 C 34.7,236 35.2,237 35.9,237 H 43.7 C 44.4,237 45,236 45,235 V 229 C 45,228 44.4,227 43.7,227 H 35.9' /></g></svg>

Можно еще поменять полный путь, чтобы он брал путь с папки chrome? Полный путь не совсем удобно. А так, кнопка рабочая. Можно и по другому запускать прокси. Просто так одним кликом) И на видном месте. Как бы не обязательно.

Upd: Класс. Спасибо.
У меня в голове кроме соломы ничего не откладывается) Похоже я дровосек. А так, примеры какие-то есть, а как работает код не совсем понимаю. Хоть тут и должно бы уже придти какое никакое понимание.

Отредактировано b0ttle (01-10-2023 00:07:28)

Отсутствует

 

№116530-09-2023 18:40:47

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

Re: UCF - ваши кнопки, скрипты…

Dumby
Спасибо за науку. Все получилось. !
41fa8495090ca6c411eb0197df04f8b4.png

Отсутствует

 

№116630-09-2023 21:09:03

Dumby
Участник
 
Группа: Members
Зарегистрирован: 12-08-2012
Сообщений: 2201
UA: Firefox 78.0

Re: UCF - ваши кнопки, скрипты…

b0ttle пишет

Как тут такое же сделать? Как здесь. Иконка прокси, чтобы "Active", "Not Active", было на первые две в иконке.

Не нужно тут такое же делать,
«здесь» под стиль, а «тут» ничего подобного.


Если просто эта svg'шка нравится, тогда берём первый кусок,
и используем в двух экземплярах, только с разным fill
Вот, например, с красным
(в коде заключать в "двойные" или `такие` кавычки, не в 'одинарные')

скрытый текст

Выделить код

Код:

data:image/svg+xml,<svg style='fill: red;' xmlns='http://www.w3.org/2000/svg' height='16' width='16' viewBox='0 0 48 48'><g><rect x='0' y='0' width='48' height='48' rx='3' ry='3'/><path style='opacity:0.25;fill:black;' d='M 16.8,17.6 23.1,23.9 8,26 6.4,32.2 11.4,37.2 3.7,44.8 6.9,48 45,48 C 46.7,48 48,46.7 48,45 V 20 L 31.4,3.4'/><path style='fill:white;' d='M 17.4,3 C 16.7,3 16.2,3.82 16.2,4.91 V 15.9 C 16.2,17 16.7,17.8 17.4,17.8 H 30.6 C 31.3,17.8 31.8,17 31.8,15.9 V 4.91 C 31.8,3.82 31.3,3 30.6,3 H 17.4 M 22.4,20.5 V 23.7 H 6.41 V 32.2 H 9.35 V 28.2 H 22.4 V 32.4 H 25.5 V 28.2 H 38.5 V 32.4 H 41.5 V 23.7 H 25.5 V 20.5 H 22.4 M 4.23,35.1 C 3.55,35.1 3,35.9 3,37.1 V 43 C 3,44.1 3.55,45 4.23,45 H 12.1 C 12.8,45 13.3,44.1 13.3,43 V 37.1 C 13.3,35.9 12.8,35.1 12.1,35.1 H 4.23 M 19.9,35.1 C 19.2,35.1 18.7,35.9 18.7,37.1 V 43 C 18.7,44.1 19.2,45 19.9,45 H 27.8 C 28.5,45 29,44.1 29,43 V 37.1 C 29,35.9 28.5,35.1 27.8,35.1 H 19.9 M 35.9,35.1 C 35.2,35.1 34.7,35.9 34.7,37.1 V 43 C 34.7,44.1 35.2,45 35.9,45 H 43.7 C 44.4,45 45,44.1 45,43 V 37.1 C 45,35.9 44.4,35.1 43.7,35.1 H 35.9' /></g></svg>

Можно еще поменять полный путь, чтобы он брал путь с папки chrome?

Ну сколько можно одно и то же, неужели не откладывается.

скрытый текст

Выделить код

Код:

/*
	var path = ".......\\opera-proxy.windows-386.exe";
*/
	var file = Services.dirsvc.get("UChrm", Ci.nsIFile);
	file.append("opera-proxy.windows-386.exe");
	var {path} = file;


rubel
Вот ещё вариант правки
скрытый текст

Выделить код

Код:

/*
        doreload = true, // Перезагрузить страницу
        img = "data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' height='80' width='16' viewBox='0 0 48 240'><g><rect x='0' y='0' width='48' height='48' rx='3' ry='3' style='fill:rgb(146, 69, 101);'/><path style='opacity:0.25;fill:black;' d='M 16.8,17.6 23.1,23.9 8,26 6.4,32.2 11.4,37.2 3.7,44.8 6.9,48 45,48 C 46.7,48 48,46.7 48,45 V 20 L 31.4,3.4'/><path style='fill:white;' d='M 17.4,3 C 16.7,3 16.2,3.82 16.2,4.91 V 15.9 C 16.2,17 16.7,17.8 17.4,17.8 H 30.6 C 31.3,17.8 31.8,17 31.8,15.9 V 4.91 C 31.8,3.82 31.3,3 30.6,3 H 17.4 M 22.4,20.5 V 23.7 H 6.41 V 32.2 H 9.35 V 28.2 H 22.4 V 32.4 H 25.5 V 28.2 H 38.5 V 32.4 H 41.5 V 23.7 H 25.5 V 20.5 H 22.4 M 4.23,35.1 C 3.55,35.1 3,35.9 3,37.1 V 43 C 3,44.1 3.55,45 4.23,45 H 12.1 C 12.8,45 13.3,44.1 13.3,43 V 37.1 C 13.3,35.9 12.8,35.1 12.1,35.1 H 4.23 M 19.9,35.1 C 19.2,35.1 18.7,35.9 18.7,37.1 V 43 C 18.7,44.1 19.2,45 19.9,45 H 27.8 C 28.5,45 29,44.1 29,43 V 37.1 C 29,35.9 28.5,35.1 27.8,35.1 H 19.9 M 35.9,35.1 C 35.2,35.1 34.7,35.9 34.7,37.1 V 43 C 34.7,44.1 35.2,45 35.9,45 H 43.7 C 44.4,45 45,44.1 45,43 V 37.1 C 45,35.9 44.4,35.1 43.7,35.1 H 35.9' /><rect x='0' y='48' width='48' height='48' rx='3' ry='3' style='fill:rgb(209, 8, 3);'/><path style='opacity:0.25;fill:black;' d='M 16.8,65.6 23.1,71.9 8,74 6.4,80.2 11.4,85.2 3.7,92.8 6.9,96 45,96 C 46.7,96 48,94.7 48,93 V 68 L 31.4,51.4'/><path style='fill:white;' d='M 17.4,51 C 16.7,51 16.2,51.8 16.2,52.9 V 63.9 C 16.2,65 16.7,65.8 17.4,65.8 H 30.6 C 31.3,65.8 31.8,65 31.8,63.9 V 52.9 C 31.8,51.8 31.3,51 30.6,51 H 17.4 M 22.4,68.5 V 71.7 H 6.41 V 80.2 H 9.35 V 76.2 H 22.4 V 80.4 H 25.5 V 76.2 H 38.5 V 80.4 H 41.5 V 71.7 H 25.5 V 68.5 H 22.4 M 4.23,83.1 C 3.55,83.1 3,83.9 3,85.1 V 91 C 3,92.1 3.55,93 4.23,93 H 12.1 C 12.8,93 13.3,92.1 13.3,91 V 85.1 C 13.3,83.9 12.8,83.1 12.1,83.1 H 4.23 M 19.9,83.1 C 19.2,83.1 18.8,83.9 18.8,85.1 V 91 C 18.8,92.1 19.2,93 19.9,93 H 27.8 C 28.5,93 29,92.1 29,91 V 85.1 C 29,83.9 28.5,83.1 27.8,83.1 H 19.9 M 35.9,83.1 C 35.2,83.1 34.7,83.9 34.7,85.1 V 91 C 34.7,92.1 35.2,93 35.9,93 H 43.7 C 44.4,93 45,92.1 45,91 V 85.1 C 45,83.9 44.4,83.1 43.7,83.1 H 35.9' /><rect x='0' y='96' width='48' height='48' rx='3' ry='3' style='fill:rgb(243, 135, 37);'/><path style='opacity:0.25;fill:black;' d='M 16.8,114 23.1,120 8,122 6.4,128 11.4,133 3.7,141 6.9,144 H 45 C 46.7,144 48,142.7 48,141 V 116 L 31.4,99.4'/><path style='fill:white;' d='M 17.4,99 C 16.7,99 16.2,99.8 16.2,101 V 112 C 16.2,113 16.7,114 17.4,114 H 30.6 C 31.3,114 31.8,113 31.8,112 V 101 C 31.8,99.8 31.3,99 30.6,99 H 17.4 M 22.4,117 V 120 H 6.41 V 128 H 9.35 V 124 H 22.4 V 128 H 25.5 V 124 H 38.5 V 128 H 41.5 V 120 H 25.5 V 117 H 22.4 M 4.23,131 C 3.55,131 3,132 3,133 V 139 C 3,140 3.55,141 4.23,141 H 12.1 C 12.8,141 13.3,140 13.3,139 V 133 C 13.3,132 12.8,131 12.1,131 H 4.23 M 19.9,131 C 19.2,131 18.8,132 18.8,133 V 139 C 18.8,140 19.2,141 19.9,141 H 27.8 C 28.5,141 29,140 29,139 V 133 C 29,132 28.5,131 27.8,131 H 19.9 M 35.9,131 C 35.2,131 34.7,132 34.7,133 V 139 C 34.7,140 35.2,141 35.9,141 H 43.7 C 44.4,141 45,140 45,139 V 133 C 45,132 44.4,131 43.7,131 H 35.9' /><rect x='0' y='144' width='48' height='48' rx='3' ry='3' style='fill:rgb(21, 161, 99);'/><path style='opacity:0.25;fill:black;' d='M 16.8,162 23.1,168 8,170 6.4,176 11.4,181 3.7,189 6.9,192 H 45 C 46.7,192 48,190.7 48,189 V 164 L 31.4,147'/><path style='fill:white;' d='M 17.4,147 C 16.7,147 16.2,148 16.2,149 V 160 C 16.2,161 16.7,162 17.4,162 H 30.6 C 31.3,162 31.8,161 31.8,160 V 149 C 31.8,148 31.3,147 30.6,147 H 17.4 M 22.4,165 V 168 H 6.41 V 176 H 9.35 V 172 H 22.4 V 176 H 25.5 V 172 H 38.5 V 176 H 41.5 V 168 H 25.5 V 165 H 22.4 M 4.23,179 C 3.55,179 3,180 3,181 V 187 C 3,188 3.55,189 4.23,189 H 12.1 C 12.8,189 13.3,188 13.3,187 V 181 C 13.3,180 12.8,179 12.1,179 H 4.23 M 19.9,179 C 19.2,179 18.8,180 18.8,181 V 187 C 18.8,188 19.2,189 19.9,189 H 27.8 C 28.5,189 29,188 29,187 V 181 C 29,180 28.5,179 27.8,179 H 19.9 M 35.9,179 C 35.2,179 34.7,180 34.7,181 V 187 C 34.7,188 35.2,189 35.9,189 H 43.7 C 44.4,189 45,188 45,187 V 181 C 45,180 44.4,179 43.7,179 H 35.9' /><rect x='0' y='192' width='48' height='48' rx='3' ry='3' style='fill:rgb(0, 120, 173);'/><path style='opacity:0.25;fill:black;' d='M 16.8,210 23.1,216 8,218 6.4,224 11.4,229 3.7,237 6.9,240 H 45 C 46.7,240 48,238.7 48,237 L 48,212 31.4,195'/><path style='fill:white;' d='M 17.4,195 C 16.7,195 16.2,196 16.2,197 V 208 C 16.2,209 16.7,210 17.4,210 H 30.6 C 31.3,210 31.8,209 31.8,208 V 197 C 31.8,196 31.3,195 30.6,195 H 17.4 M 22.4,213 V 216 H 6.41 V 224 H 9.4 V 220 H 22.4 V 224 H 25.5 V 220 H 38.5 V 224 H 41.5 V 216 H 25.5 V 213 H 22.4 M 4.23,227 C 3.55,227 3,228 3,229 V 235 C 3,236 3.55,237 4.23,237 H 12.1 C 12.8,237 13.3,236 13.3,235 V 229 C 13.3,228 12.8,227 12.1,227 H 4.23 M 19.9,227 C 19.2,227 18.7,228 18.7,229 V 235 C 18.7,236 19.2,237 19.9,237 H 27.8 C 28.5,237 29,236 29,235 V 229 C 29,228 28.5,227 27.8,227 H 19.9 M 35.9,227 C 35.2,227 34.7,228 34.7,229 V 235 C 34.7,236 35.2,237 35.9,237 H 43.7 C 44.4,237 45,236 45,235 V 229 C 45,228 44.4,227 43.7,227 H 35.9' /></g></svg>",
        imgmenu = "data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' height='80' width='16' viewBox='0 0 48 240'><g><circle cy='24' cx='24' style='fill:rgb(146, 69, 101);' r='20'/><path style='opacity:0.25;fill:black;' d='M 33,41.8 22.3,31.1 36.7,17.9 44,25.2 C 43.5,30.6 41,37.7 33,41.8 Z'/><path style='fill:white;stroke:white;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;' d='M 35,19 H 13 L 24,30 35,19' /><circle cy='72' cx='24' style='fill:rgb(209, 8, 3);' r='20'/><path style='opacity:0.25;fill:black;' d='M 33,89.8 22.3,79.1 36.7,65.9 44,73.2 C 43.5,78.6 41,85.7 33,89.8 Z'/><path style='fill:white;stroke:white;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;' d='M 35,67 H 13 L 24,78 35,67' /><circle cy='120' cx='24' style='fill:rgb(243, 135, 37);' r='20'/><path style='opacity:0.25;fill:black;' d='M 32.8,138 22,127 36.7,114 44,121 C 43.5,127 40.9,134 32.8,138 Z'/><path style='fill:white;stroke:white;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;' d='M 34.9,115 H 13.1 L 24,126 34.9,115' /><circle cy='168' cx='24' style='fill:rgb(21, 161, 99);' r='20'/><path style='opacity:0.25;fill:black;' d='M 32.9,186 22,175 36.7,162 44,169 C 43.5,175 40.9,182 32.9,186 Z'/><path style='fill:white;stroke:white;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;' d='M 35,163 H 13 L 24,174 35,163' /><circle cy='216' cx='24' style='fill:rgb(0, 120, 173);' r='20'/><path style='opacity:0.25;fill:black;' d='M 32.8,234 22,223 36.7,210 44,217 C 43.5,223 40.9,230 32.8,234 Z'/><path style='fill:white;stroke:white;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;' d='M 35,211 H 13 L 24,222 35,211' /></g></svg>";
*/
        doreload = true; // Перезагрузить страницу

        var rph = Services.io.getProtocolHandler("resource").QueryInterface(Ci.nsIResProtocolHandler);
        var r = (name, svg) => {
            var subst = id + "-" + name;
            rph.setSubstitution(subst, Services.io.newURI("data:image/svg+xml;charset=utf-8," + svg));
            return `resource://${subst}/`;
        }
        var img = r("img", "<svg style='fill: context-fill;' xmlns='http://www.w3.org/2000/svg' height='16' width='16' viewBox='0 0 48 48'><g><rect x='0' y='0' width='48' height='48' rx='3' ry='3'/><path style='opacity:0.25;fill:black;' d='M 16.8,17.6 23.1,23.9 8,26 6.4,32.2 11.4,37.2 3.7,44.8 6.9,48 45,48 C 46.7,48 48,46.7 48,45 V 20 L 31.4,3.4'/><path style='fill:white;' d='M 17.4,3 C 16.7,3 16.2,3.82 16.2,4.91 V 15.9 C 16.2,17 16.7,17.8 17.4,17.8 H 30.6 C 31.3,17.8 31.8,17 31.8,15.9 V 4.91 C 31.8,3.82 31.3,3 30.6,3 H 17.4 M 22.4,20.5 V 23.7 H 6.41 V 32.2 H 9.35 V 28.2 H 22.4 V 32.4 H 25.5 V 28.2 H 38.5 V 32.4 H 41.5 V 23.7 H 25.5 V 20.5 H 22.4 M 4.23,35.1 C 3.55,35.1 3,35.9 3,37.1 V 43 C 3,44.1 3.55,45 4.23,45 H 12.1 C 12.8,45 13.3,44.1 13.3,43 V 37.1 C 13.3,35.9 12.8,35.1 12.1,35.1 H 4.23 M 19.9,35.1 C 19.2,35.1 18.7,35.9 18.7,37.1 V 43 C 18.7,44.1 19.2,45 19.9,45 H 27.8 C 28.5,45 29,44.1 29,43 V 37.1 C 29,35.9 28.5,35.1 27.8,35.1 H 19.9 M 35.9,35.1 C 35.2,35.1 34.7,35.9 34.7,37.1 V 43 C 34.7,44.1 35.2,45 35.9,45 H 43.7 C 44.4,45 45,44.1 45,43 V 37.1 C 45,35.9 44.4,35.1 43.7,35.1 H 35.9' /></g></svg>");
        var imgmenu = r("imgmenu", "<svg style='fill: context-fill;' xmlns='http://www.w3.org/2000/svg' height='16' width='16' viewBox='0 0 48 48'><g><circle cy='24' cx='24' r='20'/><path style='opacity:0.25;fill:black;' d='M 33,41.8 22.3,31.1 36.7,17.9 44,25.2 C 43.5,30.6 41,37.7 33,41.8 Z'/><path style='fill:white;stroke:white;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;' d='M 35,19 H 13 L 24,30 35,19' /></g></svg>");

.......

/*
                    #${id}-button {
                        list-style-image: url("${img}") !important;
                        -moz-image-region: rect(0px, 16px, 16px, 0px) !important;
                        margin-inline-end: 0 !important;
                    }
                    #${id}-button-menu {
                        list-style-image: url("${imgmenu}") !important;
                        -moz-image-region: rect(0px, 16px, 16px, 0px) !important;
                        margin-inline-start: 0px !important;
                    }
                    #${id}[activated="1"] :-moz-any(#${id}-button,#${id}-button-menu) {
                        -moz-image-region: rect(16px, 16px, 32px, 0px) !important;
                    }
                    #${id}[activated="2"] :-moz-any(#${id}-button,#${id}-button-menu) {
                        -moz-image-region: rect(32px, 16px, 48px, 0px) !important;
                    }
                    #${id}[activated="4"] :-moz-any(#${id}-button,#${id}-button-menu) {
                        -moz-image-region: rect(48px, 16px, 64px, 0px) !important;
                    }
                    #${id}[activated="5"] :-moz-any(#${id}-button,#${id}-button-menu) {
                        -moz-image-region: rect(64px, 16px, 80px, 0px) !important;
                    }
*/
                    #${id}-button {
                        list-style-image: url("${img}") !important;
                        margin-inline-end: 0 !important;
                    }
                    #${id}-button-menu {
                        list-style-image: url("${imgmenu}") !important;
                        margin-inline-start: 0px !important;
                    }
                    #${id}[activated="0"] :is(#${id}-button,#${id}-button-menu) {
                        fill: rgb(146,69,101) !important;
                    }
                    #${id}[activated="1"] :is(#${id}-button,#${id}-button-menu) {
                        fill: rgb(209,8,3) !important;
                    }
                    #${id}[activated="2"] :is(#${id}-button,#${id}-button-menu) {
                        fill: rgb(243,135,37) !important;
                    }
                    #${id}[activated="4"] :is(#${id}-button,#${id}-button-menu) {
                        fill: rgb(21,161,99) !important;
                    }
                    #${id}[activated="5"] :is(#${id}-button,#${id}-button-menu) {
                        fill: rgb(0,120,173) !important;
                    }

Отсутствует

 

№116730-09-2023 23:31:44

b0ttle
Участник
 
Группа: Members
Зарегистрирован: 22-10-2020
Сообщений: 182
UA: Firefox 117.0

Re: UCF - ваши кнопки, скрипты…

Dumby
А как прописать такой путь "\\user_chrome_files\\_\\opera-proxy.windows-386.exe", и желательно все прописать где "var run = ...", а "var path = ..." убрать, он путает. Нашел такое решение в одном из ваших примеров.

скрытый текст

Выделить код

Код:

var file = Services.dirsvc.get("UChrm", Ci.nsIFile);
	["user_chrome_files","_","opera-proxy.windows-386.exe"].forEach(file.append);
	var {path} = file;

Отредактировано b0ttle (01-10-2023 09:31:47)

Отсутствует

 

№116830-09-2023 23:53:41

kokoss
Участник
 
Группа: Members
Зарегистрирован: 15-02-2018
Сообщений: 1734
UA: Firefox 115.0

Re: UCF - ваши кнопки, скрипты…

rubel пишет

В ATB  у меня все нормально. Именно в кнопке они сломались.
И что мне делать с тем архивом от Dumby ?

Ну если с ATB всё нормально, то ничего.


Win7

Отсутствует

 

№116901-10-2023 07:34:18

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

Re: UCF - ваши кнопки, скрипты…

Dumby

rubel
Вот ещё вариант правки

Этот вариант лучше. Значок Меню стал ближе к значку Переключить прокси. Спасибо. :)

Отсутствует

 

№117001-10-2023 09:49:39

Dumby
Участник
 
Группа: Members
Зарегистрирован: 12-08-2012
Сообщений: 2201
UA: Firefox 78.0

Re: UCF - ваши кнопки, скрипты…

b0ttle пишет

желательно все прописать где "var run = ...", а "var path = ..." убрать

Да, действительно, так и надо было сделать,
а то получается перегон из пустого в порожнее.

скрытый текст

Выделить код

Код:

/*
				var file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
				file.initWithPath(path);
*/
				var file = Services.dirsvc.get("UChrm", Ci.nsIFile);
				["user_chrome_files", "_", "opera-proxy.windows-386.exe"].forEach(file.append);

Отсутствует

 

№117101-10-2023 22:02:47

b0ttle
Участник
 
Группа: Members
Зарегистрирован: 22-10-2020
Сообщений: 182
UA: Firefox 117.0

Re: UCF - ваши кнопки, скрипты…

Dumby
Во то что надо. Спасибо.
А что так тихо в теме?)

Отредактировано b0ttle (03-10-2023 21:46:20)

Отсутствует

 

№117207-10-2023 05:59:31

Dobrov
Участник
 
Группа: Members
Зарегистрирован: 04-10-2011
Сообщений: 462
UA: Firefox 118.0

Re: UCF - ваши кнопки, скрипты…

Как переделать загрузчик AttributesInspector.js, чтобы вместо левой кнопки мыши код выполнялся при клике правой кнопкой ? Или колёсиком ?

Выделить код

Код:

(async (id) => CustomizableUI.createWidget({
	label:id, id:id, localized: false,
	onCreated(btn) {
		btn.setAttribute("image","data:image/webp;base64,UklGRjwAAABXRUJQVlA4TC8AAAAvD8ADAAoGbSM5Ov6k774XCPFP/0/03/8JGPxzroIzuOW06Ih60Genn1S/gHe+BgA=");
		btn.onmouseenter = btn.onmouseleave = this.onmouse;
		btn.setAttribute("oncommand","handleCommand(this)"); btn.handleCommand = this.handleCommand;
	},
	onmouse: e => e.target.focusedWindow = e.type.endsWith("r") && Services.wm.getMostRecentWindow(null),
	get handleCommand() {
		delete this.handleCommand;
		return this.handleCommand = btn => {(btn.handleCommand = new btn.ownerGlobal.Function(this.code).bind(btn))();}
	},
	get code() {
		delete this.code; var s = Ff.c +"custom_scripts/AttributesInspector.js";
		try { id = 'this.focusedWindow && this.focusedWindow.focus();\n' +
			Cu.readUTF8URI(Services.io.newURI(s))
		} catch {}
		return this.code = id;
	}
}))("AttributesInspector");

Отсутствует

 

№117308-10-2023 09:31:12

Dumby
Участник
 
Группа: Members
Зарегистрирован: 12-08-2012
Сообщений: 2201
UA: Firefox 78.0

Re: UCF - ваши кнопки, скрипты…

Dobrov пишет

Как переделать загрузчик AttributesInspector.js, чтобы вместо левой кнопки мыши код выполнялся при клике правой кнопкой ?

скрытый текст

Выделить код

Код:

/*
		btn.setAttribute("oncommand","handleCommand(this)"); btn.handleCommand = this.handleCommand;
*/
		btn.setAttribute("oncontextmenu", "return event.ctrlKey || (handleCommand(this), false)"); btn.handleCommand = this.handleCommand;

Или колёсиком ?

скрытый текст

Выделить код

Код:

/*
		btn.setAttribute("oncommand","handleCommand(this)"); btn.handleCommand = this.handleCommand;
*/
		btn.setAttribute("onauxclick", "if (event.button == 1) handleCommand(this)"); btn.handleCommand = this.handleCommand;

.......

/*
		return this.code = id;
*/
		return this.code = id.replace("canInspect: function(e) {\n", "$&\t\t\tif(e.button == 1 && e.target == context.button) return false;\n");

Отсутствует

 

№117413-10-2023 15:20:17

xrun1
Участник
 
Группа: Members
Зарегистрирован: 12-12-2013
Сообщений: 1194
UA: Firefox 118.0

Re: UCF - ваши кнопки, скрипты…

Выложу здесь свой код google-translate.js. Ссылка на источник, ничего не удалял. Ненужное закомментировано, изменения прокомментированы и ссылки присутствуют.

скрытый текст

Выделить код

Код:

// https://forum.mozilla-russia.org/viewtopic.php?pid=780231#p780231
(this.googletranslate = {
            init(that) {
                var lc = navigator.lastClick = {}, w = null, xhtmlns = 'http://www.w3.org/1999/xhtml';
                var mouseUp = (e) => {
                    if (e.button) return;
                    lc.X = e.screenX - mozInnerScreenX;
                    lc.Y = e.screenY - mozInnerScreenY;
                };
                gBrowser.tabpanels.addEventListener('mouseup', mouseUp, false);
                this.destructor = () => {
                    gBrowser.tabpanels.removeEventListener('mouseup', mouseUp, false);
                    if (w)
                        w.closeWin();
                };
                that.unloadlisteners.push("googletranslate");
                var createWindow = function(text, status, title, id, pos, size) {
                    var win = window, doc = win.document, wId = 'ujs_window'+(id || '');
                    w = doc.getElementById(wId);
                    var keyDown = function(e) {if (!e.shiftKey && !e.ctrlKey && !e.altKey && e.keyCode == 27)doc.getElementById(wId).closeWin();};
                    var mouseDown = function() {doc.getElementById(wId).closeWin();};

                    if (w)
                        w.closeWin();
                    w = doc.createElementNS(xhtmlns, 'div');
                    w.setAttribute('style', 'position:fixed;display:block;visibility:hidden;left:0;top:0;width:auto;height:auto;border:1px solid gray;padding:2px;margin:0;z-index:99999;overflow:hidden;cursor:move;'+(typeof w.style.borderRadius === 'string' ? 'background-color:#eaeaea;padding-top:0px;border-radius:4px;box-shadow:0 0 15px rgba(0,0,0,.4);' : 'background:-o-skin("Window Skin");'));
                    w.id = wId;
                    w.closeWin = function() {
                        doc.removeEventListener('keydown', keyDown, false);
                        gBrowser.tabpanels.removeEventListener('mousedown', mouseDown, false);
                        this.parentNode.removeChild(this);
                        w = null;
                    };
                    w.addEle = function(str, style) {
                        var ele = doc.createElementNS(xhtmlns, 'div');
                        ele.setAttribute('style', style);
                        if (str) {
                            ele.innerHTML = str;
                            for (var el, all = ele.getElementsByTagName('*'), i = all.length; i--;) {
                                el = all[i];
                                if (/^(script|frame|iframe|applet|embed|object)$/i.test(el.nodeName)) {
                                    el.parentNode.removeChild(el);
                                } else {
                                    for (var att = el.attributes, j = att.length; j--;) {
                                        if (/^on[a-z]+$/i.test(att[j].name))att[j].value = '';
                                    }
                                }
                            }
                        }
                        return this.appendChild(ele);
                    };
/* https://forum.mozilla-russia.org/viewtopic.php?pid=807299#p807299
                    w.addEle1 = function(str, style) {
                        var ele = doc.createElementNS(xhtmlns, 'textarea');
                        ele.setAttribute('style', style);
                        if (str) {
                            ele.innerHTML = str;
                            for (var el, all = ele.getElementsByTagName('*'), i = all.length; i--;) {
                                el = all[i];
                                if (/^(script|frame|iframe|applet|embed|object)$/i.test(el.nodeName)) {
                                    el.parentNode.removeChild(el);
                                } else {
                                    for (var att = el.attributes, j = att.length; j--;) {
                                        if (/^on[a-z]+$/i.test(att[j].name))att[j].value = '';
                                    }
                                }
                            }
                        }
                        return this.appendChild(ele);
                    };
*/
                    var img = doc.createElementNS(xhtmlns, 'div');
                    img.setAttribute('style', 'display:block;float:right;width:16px;height:16px;padding:0;margin-top:2px;margin-right:1px;border:none;cursor:pointer;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACQUlEQVR4Xm2SPUhbURTHfzfNJ4nU0Axx7CJCN2kQtIgVCtq6OdQuBUftWIQqFNsKDo6iHTqIqN3a0kklUKTS2AZrcOjioFtRjFWUfH+803cS9GHwB4dzcu75/+8L9xgaSEDbLXhaASzAyXAMn5/DHxwwjeJgKLRxd3Q0atxuLhGgWqmQmp9PJ7LZJ5Ow3WhQFweDG20LC1FfRwc3kUsm+T48fPIzl3s8VTdxxLt+/2FhdlZkc1MkmdR8Pba2ajlrz3z1+9OvIOaIfb7DwsSEyNKSyM6OSLksEo/rbw2ttadntV7Gnv3k86VfqskvmDzv7hZ580Zkelrk4kJqFIsii4satVrRs+rYmBQHBuRvS4u8g/fuCmDOz+HgAIWpKRgfh3AYhoZQ8Hqxjo4o9PdT3d1FcQEl8KoBnJ7C/j6KZkZGYG4OIhEUFed7erD29q69jGrd1qVBqcQVKgwEuMSEQhjtXRk4JvW/kM1i2WGMga4uzMoKBIOIfbNiolEC6+uU+/qQRALFA1QBlwVYxmBcLmhuxqytQSgEKu7t1dBavwKvbeINh/Has2IMqnXpem4bky6qWLdvZgaOj2FwEHNyoqG19vRMZ8jZs1+NOfsNcZS3EFvzeNL51laRe/dEYrFadsLpZeyZDx7P6QN4Btwx1OE1xO4HAquP2tsjAZ+Pm8gWi3xMpc6W8/kXPyAO/DM4oOsZa2pafdjZGXF7PAgOpXKZL4nE2XImcyUGMDSg63kbhgvgtYCq8+akIL4J3y7Fyn+DokZOnLlMyQAAAABJRU5ErkJggg==");background:-o-skin("Caption Close Button Skin");');
                    img.title = (win.navigator.language.indexOf('ru') == 0) ? '\u0417\u0430\u043A\u0440\u044B\u0442\u044C' : 'Close';
                    img.addEventListener('click', function() {this.parentNode.closeWin();}, false);
                    w.appendChild(img);
                    var title = w.addEle(title, 'display:table;color:#000;font:17px Times New Roman;width:auto;height:auto;padding:0;margin:0 2px;cursor:text;');
                    title.onclick = e => {
                        e.preventDefault();
                        var url = e.target.href;
                        // Здесь открываем url как хотим.
                        var ctabpos = gBrowser.selectedTab._tPos +1;
                        gBrowser.moveTabTo(gBrowser.selectedTab = gBrowser.addWebTab(url), ctabpos);
                        doc.getElementById(wId).closeWin();
                    };
/* https://forum.mozilla-russia.org/viewtopic.php?pid=807299#p807299
                    var cnt = w.addEle1(text, 'display:block;border:1px solid #aaa;padding-bottom:3px;padding-left:3px;background-color:#fafcfe;color:#000;font:16px Times New Roman;width:310px;height:160px;overflow:auto;cursor:text;-moz-user-focus:normal;-moz-user-select:text;');
                    cnt.contentEditable="true";
                    cnt.context="contentAreaContextMenu";
*/
                    var cnt = doc.createElement("textarea");
                    cnt.style.cssText = `
                        color: #000;
                        width: 310px;
                        height: 160px;
                        outline: none;
                        padding-left: 3px;
                        padding-bottom: 3px;
                        border: 1px solid #aaa;
                        background-color: #fafcfe;
                        font: 17px Times New Roman;
                    `;
// if (text) cnt.value = text; --> if (text) cnt.value = text.trim();
                    if (text) cnt.value = text.trim();
                    w.append(cnt);
                    w.addEle(status, 'display:table;font:12px Times New Roman;font-weight:bold;color:blue;width:auto;height:auto;padding-top:2px;margin:0 3px;cursor:pointer;');
                    w.addEventListener('mousedown', function(e) {
                        if (e.target == w) {
                            e.preventDefault();
/* https://forum.mozilla-russia.org/viewtopic.php?pid=807257#p807257
                            var grabX = e.clientX, grabY = e.clientY, origX = parseInt(w.style.left), origY = parseInt(w.style.top);
                            var mouseMove = function(ev) {
                                w.style.left = origX+ev.clientX-grabX+'px';
                                w.style.top = origY+ev.clientY-grabY+'px';
                            };
*/
                            var st = w.style;
                            var mouseMove = e => {
                                st.top = parseInt(st.top) + e.movementY + "px";
                                st.left = parseInt(st.left) + e.movementX + "px";
                            }
                            doc.addEventListener('mousemove', mouseMove, false);
                            doc.addEventListener('mouseup', function() {doc.removeEventListener('mousemove', mouseMove, false);}, false);
                        }
                    }, false);
                    doc.documentElement.appendChild(w);

                    if (size) {
                        cnt.style.height = size.height;
                        cnt.style.width = size.width;
                    } else {
                        for (var i = 3; i < 10; i++) {
                            if (cnt.scrollHeight > cnt.offsetHeight || cnt.scrollWidth > cnt.offsetWidth) {
                                cnt.style.height = 80*i+'px';
                                cnt.style.width = 160*i+'px';
                            } else
                                break;
                        }
                    }

                    var docEle = (doc.compatMode == 'CSS1Compat' && win.postMessage) ? doc.documentElement : doc.body;
                    var mX = docEle.clientWidth-w.offsetWidth, mY = docEle.clientHeight-w.offsetHeight;
                    if (mX < 0) {cnt.style.width = parseInt(cnt.style.width)+mX+'px'; mX = 0;}
                    if (mY < 0) {cnt.style.height = parseInt(cnt.style.height)+mY+'px'; mY =0;}
                    var hW = parseInt(w.offsetWidth/2);
                    w.style.left = (pos && pos.X < mX+hW ? (pos.X > hW ? pos.X-hW : 0) : mX)+'px';
                    w.style.top = (pos && pos.Y+10 < mY ? pos.Y+10 : mY)+'px';
                    w.style.visibility = 'visible';
                    doc.addEventListener('keydown', keyDown, false);
                    gBrowser.tabpanels.addEventListener('mousedown', mouseDown, false);
// https://forum.mozilla-russia.org/viewtopic.php?pid=807326#p807326
                    if (text) {
                        var st = cnt.style;
                        var div = cnt.editor.rootElement;

                        var range = new Range();
                        range.selectNode(div.firstChild);
                        var rect = range.getBoundingClientRect();

                        let w = Math.ceil(rect.width);
                        if (cnt.scrollTopMax) {
                            if (!matchMedia("(-moz-overlay-scrollbars)").matches) // ???
                                w += InspectorUtils.getChildrenForNode(div, true, false).at(-1).clientWidth;
                        }
                        else st.height = Math.max(50, Math.ceil(rect.height) + 1) + "px";
// к строке выше; изменить, если font-size > 22 https://forum.mozilla-russia.org/viewtopic.php?pid=807332#p807332
                        st.width = Math.max(200, w) + "px";
                    }
                    return w;
                };

                var getHash = function (txt) {
                    TKK=eval('((function(){var a\x3d817046147;var b\x3d-335196159;return 410049+\x27.\x27+(a+b)})())');
                    function sM(a) {
                        var b;
                        if (null !== yr)
                            b = yr;
                        else {
                            b = wr(String.fromCharCode(84));
                            var c = wr(String.fromCharCode(75));
                            b = [b(), b()];
                            b[1] = c();
                            b = (yr = window[b.join(c())] || "") || "";
                        }
                        var d = wr(String.fromCharCode(116)), c = wr(String.fromCharCode(107)), d = [d(), d()];
                        d[1] = c();
                        c = "&" + d.join("") + "=";
                        d = b.split(".");
                        b = Number(d[0]) || 0;
                        for (var e = [], f = 0, g = 0; g < a.length; g++) {
                            var l = a.charCodeAt(g);
                            128 > l ? e[f++] = l : (2048 > l ? e[f++] = l >> 6 | 192 : (55296 == (l & 64512) && g + 1 < a.length && 56320 == (a.charCodeAt(g + 1) & 64512) ? (l = 65536 + ((l & 1023) << 10) + (a.charCodeAt(++g) & 1023),
                            e[f++] = l >> 18 | 240,
                            e[f++] = l >> 12 & 63 | 128) : e[f++] = l >> 12 | 224,
                            e[f++] = l >> 6 & 63 | 128),
                            e[f++] = l & 63 | 128);
                        }
                        a = b;
                        for (f = 0; f < e.length; f++)
                            a += e[f],
                        a = xr(a, "+-a^+6");
                        a = xr(a, "+-3^+b+-f");
                        a ^= Number(d[1]) || 0;
                        0 > a && (a = (a & 2147483647) + 2147483648);
                        a %= 1E6;
                        return c + (a.toString() + "." + (a ^ b));
                    }

                    var yr = null;
                    var wr = function(a) {
                        return function() {
                            return a;
                        };
                    }, xr = function(a, b) {
                        for (var c = 0; c < b.length - 2; c += 3) {
                            var d = b.charAt(c + 2), d = "a" <= d ? d.charCodeAt(0) - 87 : Number(d), d = "+" == b.charAt(c + 1) ? a >>> d : a << d;
                            a = "+" == b.charAt(c) ? a + d & 4294967295 : a ^ d;
                        }
                        return a;
                    };
                    return sM(txt);
                };

                var ujs_google_translate = function (dir) {
                    var lng = window.navigator.language.slice(0, 2), txt = gContextMenu.selectionInfo.fullText, l = dir.split('|');
                    var encTxt = encodeURIComponent(txt);
                    var winWait = function(lng) {createWindow('', (lng == 'ru' ? 'Подождите идет перевод' : 'Wait, is going Translating')+'\u2026', 'Google Translate', '_gt', window.navigator.lastClick);};
                    if (txt) {
                        winWait(lng);
                        var xhr = new XMLHttpRequest();
                        var url = 'https://translate.google.com/translate_a/single?client=gtx&sl=' + l[0] + '&tl=' + l[1] + '&hl=' + lng + '&eotf=0&dt=at&dt=bd&dt=ex&dt=ld&dt=md&dt=qca&dt=rw&dt=rm&dt=ss&dt=t' + getHash(txt);
// для urlt изменил http --> https (14.10.2023); тестирую
                        var urlt = "https://translate.google.com/translate_t?text=" + encTxt + "&sl=' + langFrom_google_text + '&tl=' + langTo_google_text +'&hl=' + lng + '&eotf=0&ujs=gtt";
                        xhr.open('POST', url, true);
                        xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;charset=utf-8');
                        xhr.onreadystatechange = function() {
                            try {
                                if (xhr.readyState == 4 && xhr.status == 200) {
//                                    var result = '', status = '', tmp = JSON.parse(xhr.responseText.replace(/\[(?=,)/g, '[0').replace(/,(?=,|\])/g, ',0').replace(/\\n/g, "<br />"));
                                    var result = '', status = '', tmp = JSON.parse(xhr.responseText.replace(/\[(?=,)/g, '[0').replace(/,(?=,|\])/g, ',0').replace(/\\n/g, ""));
                                    for (var i = 0, n; n = tmp[0][i]; i++) {
                                        if (n[0])result += n[0].toString();
                                    };
                                   status = tmp[8][0][0].toUpperCase() + ' -\u203A ' + l[1].toUpperCase();
                                   createWindow(result, status, '<a href="'+urlt.replace(/&/g,'&amp;')+'" target="_blank" style="display:inline;padding:0;margin:0;text-decoration:none;border:none;color:#009;font:16px Times New Roman;">Google Translate</a>', '_gt', window.navigator.lastClick);
                                }
                            } catch(e) {};
                        };
                        xhr.send('q=' + encodeURIComponent(txt));
                    } else {
                        var urlt = gBrowser.currentURI.spec;
// Изменил строку ниже. Добавил параметр '&tl='+l[1] https://forum.mozilla-russia.org/viewtopic.php?pid=796999#p796999 & http --> https (14.10.2023)
                        var url = "https://translate.google.com/translate?u=" + encodeURIComponent(urlt) + '&tl=' + l[1] + "&hl=" + lng + "&langpair=" + dir + "&tbb=1";
                        var ctabpos = gBrowser.selectedTab._tPos +1;
                        gBrowser.moveTabTo(gBrowser.selectedTab = gBrowser.addWebTab(url), ctabpos);
                    };
                };
                var contextMenu = document.getElementById("contentAreaContextMenu");
                var nextEleMenu = document.getElementById("context-inspect");

                var menuItem = document.createXULElement("menuitem");
                menuItem.setAttribute("id", "context-ru-google-translate");
                menuItem.setAttribute("label", "Перевести на русский");
                menuItem.setAttribute("class", "menuitem-iconic");
                menuItem.setAttribute("image", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAABnRSTlMAAAAAAABupgeRAAABBUlEQVR4Ac2RMU4DMRREB2MqihQpAkUaqnAduuQw4Sx03CGcJYIiDYqQ0lCsZ77535ZFcgAkRuPvV7zd/dLiz3N1PFb8hmRckrfELZrF9ONQ1B6Yz0MyM7S0O6zGkVprh/3+Kw/JzkHSpRpJKZkpr9fYbOx0cjVsCbWG31oHBM9mtt0q73ZcrdLhAMlYQKkUI22aqsNo8HKZAMQhvVaKSHWj2Q2aPU3mJQFY7nuHyvYFduP83WF3AJRfcPNYnr/Lp1G1uK4m9sno1LaUbnX/htf8BNzoneUD5NhjvLCMhURQSQ93QCZwXYjFwg3I0NZKrvoknQPMIHkt/jRAQKMeG2yX89/mB4EJbKbZxIhFAAAAAElFTkSuQmCC");
                menuItem.addEventListener("command", function() {ujs_google_translate('auto|ru');}, false);
                contextMenu.insertBefore(menuItem, nextEleMenu);

                menuItem = document.createXULElement("menuitem");
                menuItem.setAttribute("id", "context-en-google-translate");
                menuItem.setAttribute("label", "Перевести на английский");
                menuItem.setAttribute("class", "menuitem-iconic");
                menuItem.setAttribute("image", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAABnRSTlMAAAAAAABupgeRAAAB5UlEQVR4AWOgPZg0c9+Oq2+qpx9LaQaiw4mNB27efbs2uXFNQh2Q4Zm9zSNth23MhqjGnXMC86vnHmUS4udxv7OvOd2yPE7PTlfCTk9GVVEoyJA7WI8dyPA0k3U1l+jJMV7CeThpTZeoKDdDUsvBPSff/V+6/P/Bvf///2+bdvU/EKRm/k9IBNIlfZe+LFrzvbsbyJ636pKkyQyQhoUb7tZNvPpw3/0/TfX/ISAm5n94BIiRm/n/xYsLd946ei4vajoiqDuRAejQf//+o4PQ0P9+fmhiQGVnrr1kXJNYG2zEzXDxDsPv3wy/fkFJoOTPn39+/fr/69e/37//AUX+/mXRkO458wWHDba2f8wswCyQ3N+/f//8/fP7z5+TV18w2Mdt6plzPiptx5Wr7/+/ffMzOR6kysjkt74hWMPfp06O+2dulZCeFZKwnkE4m8E8bN3i9aCQ+dxY96GrK6bkGJD9R1v3l6Y20NVW9kt+/v//ZdbcFwkxTVPPMQimM8XEqkb7a/zoqLxkH9v4zVyI5+///wyMmtKMmhJAnbLqQjHxaw5r2orOmZN5uj470Zahat6BKS7JzpmLBHXm8GhM5lCdcP7ai1ZpixZxk9NXXjKIFzOIFjAI54oY1vXuue5qmscw+AAAW0tKxtPoicEAAAAASUVORK5CYII=");
                menuItem.addEventListener("command", function() {ujs_google_translate('auto|en');}, false);
                contextMenu.insertBefore(menuItem, nextEleMenu);

                contextMenu.insertBefore(document.createXULElement("menuseparator"), nextEleMenu);
            }
        }).init(this);


UPD: Заменил http --> https (2 правки, см. по дате 14.10.2023).

Отредактировано xrun1 (14-10-2023 11:48:48)

Отсутствует

 

№117514-10-2023 09:46:32

unter_officer
Участник
 
Группа: Members
Откуда: Санкт-Петербург
Зарегистрирован: 27-03-2011
Сообщений: 564
UA: Firefox 115.0

Re: UCF - ваши кнопки, скрипты…

xrun1 пишет

Выложу здесь свой код google-translate.js.

Спасибо.


И у меня вопросик.
Возможно ли в этом скрипте использовать не Гугл, а другой переводчик?
Мне, например, больше нравиться DeepL.


«The Truth Is Out There»

Отсутствует

 

Board footer

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