Custom buttons not recognized, do not appear on toolbar

  • Please Post the script in question for reference.

    I figured it out. I downloaded about 40 Alice scripts to test. I have English translations for 15 that I found useful. I can list them if anyone is interested.

    Around 20 others either did not work, or did not display at all. Others were now obsolete, replaced by default buttons.

    I'm going to check our the Aris repository to see if some will now work for me.

    That space problem is fixed. I was doing a trial and error method of testing the button activation files to see which file was responsible, and it fixed itself. I'm still trying to figure out which file it was.

    I now have 2 restart buttons. I prefer this one, because it does not have a cache clearing option

    But this one has the "R" icon I like. If possible, can I post the codes to get instruction on how to do the change?

    Thanks

  • But this one has the "R" icon I like. If possible, can I post the codes to get instruction on how to do the change?

    Of course, post away. ;)

    Please state which button you want to do what, and where inside your chrome folder the icon is located, eg profile-folder -> chrome -> folder "myIcons" -> iconRedR.svg or such.

  • Please state which button you want to do what, and where Inside your Chrome folder the icon is located, eg profile-folder -> chrome -> folder "myIcons" -> iconRedR.svgor search.

    I can't find iconRedR.svg, I believe, because RestartFirefox_plus.uc.js has this type of code:

    style: 'list-style-image: url(data:image/

    I have a favicon.

    The icon for restart_button.uc.js is in chrome\image\icons_fx88\reload.svg. I put the favicon there. I tried to edit like this, but, of course, it did not work

    var icon = "chrome://global/skin/icons/RED.ico";

    // Restart button script for Firefox 60+ by Aris
    //
    // left-click on restart button: normal restart
    // middle-click on restart button: restart + clear caches
    // right-click on restart button: no special function
    //
    // based on 'Quit' button code by 2002Andreas
    // restart code from Classic Theme Restorer add-on
    // invalidate caches from Session Saver add-on

    (function() {

    try {
     var sss = Components.classes["@mozilla.org/content/style-sheet-service;1"].getService(Components.interfaces.nsIStyleSheetService);
     var appversion = parseInt(Services.appinfo.version);

     var button_label = "Restart";

     CustomizableUI.createWidget({
        id: "uc-restart", // button id
        defaultArea: CustomizableUI.AREA_NAVBAR,
        removable: true,
        label: button_label, // button title
        tooltiptext: button_label, // tooltip title
        onClick: function(event) {
          
          var cancelQuit   = Components.classes["@mozilla.org/supports-PRBool;1"].createInstance(Components.interfaces.nsISupportsPRBool);
          var observerSvc  = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
                
          if(event.button=='1') { // middle-click - clear caches
            Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULRuntime).invalidateCachesOnRestart();
          }
          
          if(event.button=='0' || event.button=='1') { // left/middle-click - restart
            observerSvc.notifyObservers(cancelQuit, "quit-application-requested", "restart");
                
            if(cancelQuit.data) return false;
                    
            Services.startup.quit(Services.startup.eRestart | Services.startup.eAttemptQuit);
          }
        },
        onCreated: function(button) {
          return button;
        }
            
     });

     var icon = "chrome://global/skin/icons/reload.svg";

     if(appversion < 92) icon = "chrome://browser/skin/reload.svg";

     // style button icon
     var uri = Services.io.newURI("data:text/css;charset=utf-8," + encodeURIComponent('\
        \
          #uc-restart .toolbarbutton-icon {\
            list-style-image: url("'+icon+'"); /* icon / path to icon */ \
            transform: scaleX(-1); /* icon mirroring */\
            fill: red; /* icon color name/code */\
          }\
        \
     '), null, null);

     sss.loadAndRegisterSheet(uri, sss.AGENT_SHEET);

    } catch (e) {
        Components.utils.reportError(e);
    };

    })();

    //      RestartFirefox_plus.uc.js   2

       (function() {

          if (location != 'chrome://browser/content/browser.xhtml') return;
          
          try {
             CustomizableUI.createWidget({
                id: 'restart-button',
                type: 'custom',
                defaultArea: CustomizableUI.AREA_NAVBAR,
                onBuild: function(aDocument) {         
                   var toolbaritem = aDocument.createElementNS('http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul', 'toolbarbutton');
                   let props = {
                      id: 'restart-button',
                      class: 'toolbarbutton-1 chromeclass-toolbar-additional',
                      removable: false,
                      label: 'RESTART',
                      tooltiptext: 'Restart (right-click and middle-click clear the userChrome.js cache))',
                      style: 'list-style-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8%2F9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333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2RRNwf1FSOzSUAXsCIR4QdP13UPfjhUde2mjuBXUjcXNEabOnJmq7Y4Nd7z1fu%2BJ%2FR2Jpgrm0jauAI8GlnSlBi4I0bO6sLBWHc9esxRdmjOZf5n%2B5CLWzCzOvsbKupBZ1xgmElUoC%2BgoKtRGQfNomoaND8P8XS%2Bby1olO7O6GHTl1DejGDOrNB%2BvpO7I%2Ba31%2FDP9Z28YUmqoqhCKcG2EYD6ZMUTojZ8WHmsqD%2BI6wnWFajugCkuuZaV%2FZS47wp99R7E3LbxPV6rtr7dV1pmyuBWs3hr7dZ380LC2tzseffvUHm86C1JC2A%2FrGcn509cn%2BPvTk9ibc1R06qL91Ms1CadF000ll9rVS2VykLzVr0lHOgtpuJ9yUFyXxqhKZjbH2nJRI9IZwyw2kXjvXV%2FIOWgaBcc2a%2BtjdVXR1J3iBDx8QUpQUJAuJJclseogxz441H5vrPO72cm0VSyVPJq27ZaHm8ST3Y0M9d9Kkr19A1A1x4VIObTGBfNrsJ5XmE9b6KqgvrOGhr1Vns2sgeNIkXiigvHf1liZuHWZYjINSEXRVLewZjN6bYmYbvN4rcDvVzFKLnOpErMLBpvbklClznyyyPDA6DjTX3wJWICr%2Bnb3ffjXSGpl5Nxnn88uh2ORUCBaHfVQU%2BsjVuGhKqJT5lFYShr8fGH4j42bH53EnJ4EtgEEPQOTzHx9mqXLl9AT9TS82RvreOmVcMTXVh4JhIr5kp3LFu6u3Lk%2ByMylQazU3ENYAvw3AFUTimFqj5i7AAAAAElFTkSuQmCC)',
                      /* onclick: 'if (event.button == 0) { \
                                     Services.startup.quit(Ci.nsIAppStartup.eRestart | Ci.nsIAppStartup.eAttemptQuit); \
                                 }; \
                                 if (event.button == 1 || event.button == 2) { \
                                     Services.appinfo.invalidateCachesOnRestart(); \
                                     Services.startup.quit(Ci.nsIAppStartup.eRestart | Ci.nsIAppStartup.eAttemptQuit); \
                                 };' */
                   };            
                   for (var p in props)
                      toolbaritem.setAttribute(p, props[p]);
                   
                   toolbaritem.addEventListener('click', event => {
                       if (event.button == 1) {
                         Services.startup.quit(Ci.nsIAppStartup.eRestart | Ci.nsIAppStartup.eAttemptQuit);
                       }
                   
                       if (event.button == 0 || event.button == 2) {
                         event.preventDefault();
                         Services.appinfo.invalidateCachesOnRestart();
                         Services.startup.quit(Ci.nsIAppStartup.eRestart | Ci.nsIAppStartup.eAttemptQuit);
                       }
                     });               
                   return toolbaritem;
                }      
             });
          } catch(e) { };   
                 
          var menuitem = document.createXULElement('menuitem');   
          var props = {
             id: 'restartfirefox-fileMenu2',
             label: 'RESTART',
           tooltiptext: 'Restart (right-click and middle-click clear the userChrome.js cache))',         
          };

                 menuitem.addEventListener('click', event => {
                            if (event.button == 0) { 
                                     Services.startup.quit(Ci.nsIAppStartup.eRestart | Ci.nsIAppStartup.eAttemptQuit); 
                                 }
                                 if (event.button == 1 || event.button == 2) { 
                                     Services.appinfo.invalidateCachesOnRestart(); 
                                     Services.startup.quit(Ci.nsIAppStartup.eRestart | Ci.nsIAppStartup.eAttemptQuit);
                                 }                              
                        });            
          for (var p in props)
             menuitem.setAttribute(p, props[p]);      
          document.getElementById('menu_FilePopup').insertBefore(menuitem, 
           document.getElementById('menu_FileQuitItem'));

          var menuitem = document.createXULElement('toolbarbutton');
    menuitem.id = 'restartfirefox-fileMenu';
    menuitem.classList.add('subviewbutton', 'subviewbutton-iconic');
    menuitem.setAttribute('label' , 'RESTART');
    menuitem.setAttribute('tooltiptext' , 'RESTART');
    menuitem.style.listStyleImage= 'url(\'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8%2F9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89%2BbN%2FrXXPues852zzwfACAyWSDNRNYAMqUI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CLWzCzOvsbKupBZ1xgmElUoC%2BgoKtRGQfNomoaND8P8XS%2Bby1olO7O6GHTl1DejGDOrNB%2BvpO7I%2Ba31%2FDP9Z28YUmqoqhCKcG2EYD6ZMUTojZ8WHmsqD%2BI6wnWFajugCkuuZaV%2FZS47wp99R7E3LbxPV6rtr7dV1pmyuBWs3hr7dZ380LC2tzseffvUHm86C1JC2A%2FrGcn509cn%2BPvTk9ibc1R06qL91Ms1CadF000ll9rVS2VykLzVr0lHOgtpuJ9yUFyXxqhKZjbH2nJRI9IZwyw2kXjvXV%2FIOWgaBcc2a%2BtjdVXR1J3iBDx8QUpQUJAuJJclseogxz441H5vrPO72cm0VSyVPJq27ZaHm8ST3Y0M9d9Kkr19A1A1x4VIObTGBfNrsJ5XmE9b6KqgvrOGhr1Vns2sgeNIkXiigvHf1liZuHWZYjINSEXRVLewZjN6bYmYbvN4rcDvVzFKLnOpErMLBpvbklClznyyyPDA6DjTX3wJWICr%2Bnb3ffjXSGpl5Nxnn88uh2ORUCBaHfVQU%2BsjVuGhKqJT5lFYShr8fGH4j42bH53EnJ4EtgEEPQOTzHx9mqXLl9AT9TS82RvreOmVcMTXVh4JhIr5kp3LFu6u3Lk%2ByMylQazU3ENYAvw3AFUTimFqj5i7AAAAAElFTkSuQmCC\')';
    menuitem.addEventListener('click', event => {
                            if (event.button == 0) { 
                                     Services.startup.quit(Ci.nsIAppStartup.eRestart | Ci.nsIAppStartup.eAttemptQuit); 
                                 }
                                 if (event.button == 1 || event.button == 2) { 
                                     Services.appinfo.invalidateCachesOnRestart(); 
                                     Services.startup.quit(Ci.nsIAppStartup.eRestart | Ci.nsIAppStartup.eAttemptQuit);
                                 }                              
                        });
    var refItem = document.getElementById('appMenu-viewCache').content.getElementById('appMenu-quit-button2');
    refItem.parentNode.insertBefore(menuitem, refItem);
    })();

  • Autsch.

    Mit <3lichem Gruß

    Mira

  • Please state which button you want to do what, and where Inside your Chrome folder the icon is located, eg profile-folder -> chrome -> folder "myIcons" -> iconRedR.svgor search.

    I can't find iconRedR.svg, I believe, because RestartFirefox_plus.uc.js has this type of code:

    The icon for restart_button.uc.js is in chrome\image\icons_fx88\reload.svg. I put the favicon there. I tried to edit like this, but, of course, it did not work

    iconRedR.svg was just an example for a possible file name.
    ...\icons_fx88\... is part of an old Aris CSS package, no way I'm touching this, or any code using base64 icons.

    If there is a physical icon, and you can locate it, we can use it in a different restart code - if you describe what function which button is supposed to use - as asked. 8)

    Posting properly formatted code would also help. ;)

  • @Horstmann 
    Also das JavaScript von Aris funktioniert bei mir.
    Und das Symbol, das zweimal Verwendung findet, ist dieses hier =>
    Aber wenn ich mit meinem gebrochenen englisch, das richtig verstanden habe, geht es doch um so ein rotes R,
    oder?

    Aber DAS muss doch in einem anderen Skript Verwendung finden, wenn ich das richtig verstanden habe.
    Zumindest verstehe ich das so.

    But this one has the "R" icon I like. If possible, can I post the codes to get instruction on how to do the change?

    I now have 2 restart buttons. I prefer this one, because it does not have a cache clearing option

    Und welches Skript soll das sein?
    Ich bin verwirrt.


    because RestartFirefox_plus.uc.js

    Mit <3lichem Gruß

    Mira

    Einmal editiert, zuletzt von Mira_Belle (6. April 2026 um 23:17) aus folgendem Grund: Ein Beitrag von Mira_Belle mit diesem Beitrag zusammengefügt.

  • Hi Mira ,

    Please allow me to clarify further, to clear up any confusion. This script, restart_button.uc.js, works fine. However, I wish to change it's toolbar button icon.

    // Restart button script for Firefox 60+ by Aris
    //
    // left-click on restart button: normal restart
    // middle-click on restart button: restart + clear caches
    // right-click on restart button: no special function
    //
    // based on 'Quit' button code by 2002Andreas
    // restart code from Classic Theme Restorer add-on
    // invalidate caches from Session Saver add-on

    (function() {

    try {
     var sss = Components.classes["@mozilla.org/content/style-sheet-service;1"].getService(Components.interfaces.nsIStyleSheetService);
     var appversion = parseInt(Services.appinfo.version);

     var button_label = "Restart";

     CustomizableUI.createWidget({
        id: "uc-restart", // button id
        defaultArea: CustomizableUI.AREA_NAVBAR,
        removable: true,
        label: button_label, // button title
        tooltiptext: button_label, // tooltip title
        onClick: function(event) {
          
          var cancelQuit   = Components.classes["@mozilla.org/supports-PRBool;1"].createInstance(Components.interfaces.nsISupportsPRBool);
          var observerSvc  = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
                
          if(event.button=='1') { // middle-click - clear caches
            Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULRuntime).invalidateCachesOnRestart();
          }
          
          if(event.button=='0' || event.button=='1') { // left/middle-click - restart
            observerSvc.notifyObservers(cancelQuit, "quit-application-requested", "restart");
                
            if(cancelQuit.data) return false;
                    
            Services.startup.quit(Services.startup.eRestart | Services.startup.eAttemptQuit);
          }
        },
        onCreated: function(button) {
          return button;
        }
            
     });

     var icon = "chrome://global/skin/icons/reload.svg";

     if(appversion < 92) icon = "chrome://browser/skin/reload.svg";

     // style button icon
     var uri = Services.io.newURI("data:text/css;charset=utf-8," + encodeURIComponent('\
        \
          #uc-restart .toolbarbutton-icon {\
            list-style-image: url("'+icon+'"); /* icon / path to icon */ \
            transform: scaleX(-1); /* icon mirroring */\
            fill: red; /* icon color name/code */\
          }\
        \
     '), null, null);

     sss.loadAndRegisterSheet(uri, sss.AGENT_SHEET);

    } catch (e) {
        Components.utils.reportError(e);
    };

    })();

    The restart_button.uc.js script is the one at the top of this menu.

    The other restart button, RestartFirefox_plus.uc.js, at the bottom of the menu, is the script with the base64 icon.

    I want that red "R" for the restart_button.uc.js icon. As I mentioned earlier, I have this favicon file. I was hoping that we could relocate that favicon file somewhere in the chrome\image folder, or wherever you determine is the best location, in order to edit the script to point to that file location. If you need to have the the file extension changed to make it compatible, please let me know. Perhaps to .svg? I will require instruction to do so.

  • I want that red "R" for the restart_button.uc.js icon. As I mentioned earlier, I have this favicon file. I was hoping that we could relocate that favicon file somewhere in the chrome\image folder, or wherever you determine is the best location, in order to edit the script to point to that file location.

    Alright, I think I got it now.

    I took the liberty to use one of my restart scripts, as it's easier to add the icon code.

    So, here you have a restart script, which, like your restart_button.uc.js, will do a regular restart with left-click, and a restart plus cache clearing with middle-click. That can easily be reversed if you like, just change lines 25 and 31, flip e.button 0 <=> 1.

    The icons I attach below need to go into the chrome\image folder; it is your icon with a fixed file name (no spaces in the name), plus an .svg version (default setting in this script).

    Name and tooltip can be adjusted in lines 19 and 20.

    Icons: R_icons.zip

    As for posting code, please use this button in the reply field, and a new code segment for each separate script:

    Finally, since not all members are fluent in English, and this is a German speaking forum - for the benefit of everybody, and out of courtesy, please consider translating your postings into German.
    We have several foreign speakers on this board, who usually do that.

    4 Mal editiert, zuletzt von Horstmann (7. April 2026 um 15:45)

  • Ah, then please post the code of the second script.

    RestartFirefox_plus.uc.js

    Das ist anscheinend schon in #25/#26 drin, so wie's gepostet war sieht es wohl aus wie 2 Codes in einem. :/