Custom toolbars buttons have no icons

  • lenny2, Mira_Belle: Es muss sich um about_button.uc.js oder about_button_generic.uc.js handeln, aber über Anpassungen muss uns tatsächlich der OP Bescheid geben.

    juzzlukin, please, post your actual script, so we can see your (necessary) edits. Do other scripts work?

  • I believe there is a way to edit the buttons to point towards a desired icon, but I can't figure our how to do it.

    For most uses, you can find the buttons ID, and via userChome.css apply an Icon like so:

    CSS
    #Yourbutton_button {
        list-style-image: url("icons/Yourbutton_Icon.png") !important;
        }

    The icon would need to be in a folder called icons, inside your profile's chrome folder.

  • :/

    Habe mir beide Skripte mal genauer angeschaut!
    Das CSS zum einbinden eines eigenen Symbols ist da vorhanden, aber ...

    Code
      var uri = Services.io.newURI("data:text/css;charset=utf-8," + encodeURIComponent('\
    	\
    	  #about-button .toolbarbutton-icon {\
    		list-style-image: url("chrome://global/skin/icons/defaultFavicon.svg"); /* icon / path to icon */ \
    		fill: dimgray; /* icon color name/code */\
    	  }\
    	\
      '), null, null);

    ... mich irritieren die Backslashes.
    Habe es jetzt nicht ausprobiert. Eventuell, sind die das Problem.

    Mit <3lichem Gruß

    Mira

  • Remove this line:

    Yes, these days the resource:// protocol is converted to the moz-src:// protocol for module files (files with the extension .sys.mjs). This is already happened for the file customizableUI.sys.mjs. Additionally, this line is not necessary in this case.

    Übersetzer für Obersorbisch und Niedersorbisch auf pontoon.mozilla.org u.a. für Firefox, Firefox für Android, Firefox für iOS, Firefox Klar/Focus für iOS und Android, Thunderbird, Pootle, Django, LibreOffice, LibreOffice Onlinehilfe, WordPress

  • Es ist ja anders als bei dem, was ich so kenne, wenn CSS eingebunden wird.

    Du kennst wahrscheinlich vor allem das Einschließen des mehrzeiligen Strings in sogenannte Backticks (`). Das ist jedenfalls die Methode, die du bei deinem letzten vergleichbaren Fall verwendest hast. Das ist die modernere Variante, die es einem erspart, in jeder Zeile einen Backslash einzufügen. Das Feature wurde aber „erst“ mit ECMAScript 6 eingeführt. Mittlerweile ist das auch schon über zehn Jahre her. Aber irgendwann war das mal neu und vorher wäre das mit den Backslashes ein guter Weg gewesen, der heute nicht mehr meine erste Wahl wäre, aber immer noch funktioniert. Die Wahrscheinlichkeit ist relativ hoch, solchen Code noch zu sehen, wenn der Ursprung des Codes schon einige Jahre alt ist und der Code im Laufe der Zeit nicht modernisiert worden ist. Und natürlich gibt es auch Entwickler, die ihre Art zu entwickeln nie adaptiert haben und noch genauso Code schreiben wie früher. Und wenn man einen Chatbot nach Code fragt, ist es vermutlich auch ein bisschen Zufall, was für einen Codestil man erhält, und nicht unbedingt konsistent immer der eine oder immer der andere Weg. ;)

  • Hello everyone, and thanks for the wonderful responses.

    Sorry for not getting back here until now, but I've had several other problems with Firefox since, including one related to this thread.

    3-4 weeks ago all but one my custom buttons from CustomJSforFx stopped working, meaning that, although they are listed here, they no longer display in Firefox.

    Only my RestartFirefoxButton_Movable.uc.js, from the following source, still

    operates


    Restart Button for Firefox. An updated version of https://github.com/Endor8/userChrome.js/tree/master/restartfirefoxbutton_movable. Middle click also empties the script cache.
    Restart Button for Firefox. An updated version of https://github.com/Endor8/userChrome.js/tree/master/restartfirefoxbutton_movable. Middle click also empties…
    gist.github.com

    Nothing in my Chrome folder related to these buttons has been altered. I initially thought it had something to do with the CustomJSforFx script_loader, but the one in the repository there is two years old.

    Hi juzzlukin

    Remove this line:

    Code
    ChromeUtils.importESModule("resource:///modules/CustomizableUI.sys.mjs");

    than the script works again.

    Kind Regards
    Endor

    Hi Endor,

    I assume that instruction was for the icon fix? I just tried it, but the button did not appear.


    Einmal editiert, zuletzt von juzzlukin (13. Oktober 2025 um 00:53) aus folgendem Grund: Ein Beitrag von juzzlukin mit diesem Beitrag zusammengefügt.