1. Nachrichten
  2. Forum
    1. Unerledigte Themen
    2. Forenregeln
  3. Spenden
  • Anmelden
  • Registrieren
  • Suche
Alles
  • Alles
  • Artikel
  • Seiten
  • Forum
  • Erweiterte Suche
  1. camp-firefox.de
  2. Mira_Belle

Beiträge von Mira_Belle

  • Nur die Anzeige der Ordner/Lesezeichenanzahl in einer anderen Farbe darstellen

    • Mira_Belle
    • 15. Juli 2023 um 23:48
    Zitat von Dharkness

    Und wie, wenn man das ↓ als Basis nimmt?

    JavaScript
    // BookmarkCount.uc.js
    
    ...

    So. ;)

    JavaScript
    // BookmarkCount.uc.js
    
    /* ******************************************************************************************************************* */
    /* Author BrokenHeart               => https://www.camp-firefox.de/forum/thema/136572/?postID=1229536#post1229536 **** */
    /* Correction from BrokenHeart      => https://www.camp-firefox.de/forum/thema/136572/?postID=1229696#post1229696 **** */
    /* Extension from Sören Henschel    => https://www.camp-firefox.de/forum/thema/136572/?postID=1229555#post1229555 **** */
    /* Customized by Mira inspired by grisu2099     ********************************************************************** */
    /* Source                           => https://www.camp-firefox.de/forum/thema/136572/?postID=1229875#post1229883 **** */
    /* Customized by Mira inspired by Horstmann     ********************************************************************** */
    /* Source                           => https://www.camp-firefox.de/forum/thema/136572/?postID=1229993#post1229993 **** */
    /* ******************************************************************************************************************* */
    /* Version 1.01                     => https://www.camp-firefox.de/forum/thema/136572/?postID=1230128#post1230128 **** */
    /* Version 1.02                     => https://www.camp-firefox.de/forum/thema/136572/?postID=1230334#post1230334 **** */
    /* ******************************************************************************************************************* */
    /* Custom Counter in the Bookmarks for folders and links ************************************************************* */
    /* ******************************************************************************************************************* */
    /* rechtsbündig                     => https://www.camp-firefox.de/forum/thema/136572/?postID=1230360#post1230360 **** */
    
    (function() {
    
        if (!window.gBrowser) return;
        
        setTimeout(function() {
            setFunction();
        },50);
    
        let profilePath = PathUtils.toFileURI(PathUtils.join(PathUtils.profileDir, 'chrome', 'icons'))
        let icon1 = "folder_org.svg"
        let icon2 = "bookmark-hollow.svg"
    
        function setFunction() {
    
            const css =`
                .countClass1::before {
                    content: "";
                    background-image: url(${profilePath}/${icon1});     /*  Custom icon  */ 
                    background-repeat: no-repeat;
                    background-size: 16px;                              /* icon size */
                    background-position: center;
                    margin-left: 16px !important;                       /* Abstand links minimum für schmale Popus  CHANGE  */
                    margin-right: -1px !important;                      /* Abstand Icon "Ordner" bis zum "Zähler" */ 
                    height: 16px;
                    width: 16px;
                    fill: #c0c0c0;
                    fill-opacity: 1;
                }
    
                /* Default FX left margin ist 16px !! -->  CHANGE  */ 
    
                .countClass1 label {
                    margin-inline: 0px !important;
                }
                /* Ordner container Inhalt zentriert -->  CHANGE  */
    
                hbox.menu-accel-container.countClass1 {
                    align-items: center !important;
    
                }
                .countClass1::after {
                    content: attr(data-value1) !important;
                    font-family:  Consolas, "Lucida Console", "Courier New", monospace !important;
                    font-size: 12px !important;
                    font-weight: 900 !important;
                    color: #FFD700 !important;                          /* Farbe des 1. Textes */
                    height: 14px;                                       /* height = font size Text zentriert CHANGE  */
                    width: 15px !important;                             /* Platzhalter für Anzahl der Stellen */
                    padding-left: 4px !important;                       /* height = font size Text zentriert CHANGE  */
                    margin-right: 0px !important;                      /* Abstand zum Icon "Links" rechts */
    
                /*    background-color: lightblue; */           /*  TEST  */
                }
                .countClass2::before {
                    content: "";
                    background-image: url(${profilePath}/${icon2});     /*  Custom icon  */
                    background-repeat: no-repeat;
                    background-size: 16px;                              /* icon size */
                    background-position: center;
                    margin-left: 4px !important;                        /* Abstand "Zähler 1" zum Icon2 */
                    margin-right: -1px !important;                      /* Abstand Icon "Links" bis zum "Zähler" */
                    height: 16px;
                    width: 16px;
                    fill: #c0c0c0;
                    fill-opacity: 1;
                }
                .countClass2::after {
                    content: attr(data-value2);
                    font-family:  Consolas, "Lucida Console", "Courier New", monospace !important;
                    font-size: 12px !important;
                    font-weight: 900 !important; 
                    color: #FFD700 !important;                          /* Farbe des 2. Textes */
                    height: 14px;                                       /* height = font size Text zentriert CHANGE  */
                    width: 15px !important;                             /* Platzhalter für Anzahl der Stellen (25px für 3 Stellen) */
                    padding-left: 4px !important;                       /* height = font size Text zentriert CHANGE  */
                    margin-right: 6px !important;                      /* Abstand zum Pfeil recht */
    
                /*    background-color: lightblue; */           /*  TEST  */
                }
                .countClass2 image {
                    order: 1;                                           /* Pfeil ganz nach rechts */
                }
            `;
    
            const sss = Cc['@mozilla.org/content/style-sheet-service;1'].getService(Ci.nsIStyleSheetService);
            const uri = Services.io.newURI('data:text/css,' + encodeURIComponent(css));
            sss.loadAndRegisterSheet(uri, sss.AGENT_SHEET);
    
            let bmbMenu = document.getElementById('bookmarks-menu-button');
            let bookMenu = document.getElementById('bookmarksMenu');
            let persToolBar = document.getElementById('PersonalToolbar');
            
            if(bmbMenu)
                bmbMenu.addEventListener('popupshowing', onPopupShowing ); 
            if(bookMenu)
                bookMenu.addEventListener('popupshowing', onPopupShowing ); 
            if(persToolBar)
                persToolBar.addEventListener('popupshowing', onPopupShowing ); 
        }
        
        function onPopupShowing(aEvent) {
            
            let popup = aEvent.originalTarget;
    
            for (let item of popup.children) {
                if (item.localName != 'menu' || item.id?.startsWith('history')) {
                    continue;
                }    
                setTimeout(() => {
                  let itemPopup = item.menupopup;
                  itemPopup.hidden = true;
                  itemPopup.collapsed = true;
                  itemPopup.openPopup();
                  itemPopup.hidePopup();
                  let menuitemCount = 0;
                  let menuCount = 0;
                  for (let subitem of itemPopup.children) {
                    if (subitem.classList.contains('bookmark-item') && !subitem.disabled && !subitem.hidden) {
                      if (subitem.localName == 'menuitem') {
                        menuitemCount++;
                      } else if (subitem.localName == 'menu') {
                        menuCount++;
                      }
                    }
                  }
                  itemPopup.hidden = false;
                  itemPopup.collapsed = false;
                  item.style.color = '#c0c0c0';
                  
                  let label1 = item.childNodes[3];
      
                  label1.classList.add('countClass1');
                  let strCountOut1 = String(menuCount).padStart(2, '\xa0');
     
                  label1.setAttribute('data-value1', strCountOut1);
    
                  let label2 = item.childNodes[4];
      
                  label2.classList.add('countClass2');
                  let strCountOut2 = String(menuitemCount).padStart(3, '\xa0');
    
                  label2.setAttribute('data-value2', strCountOut2);
    
                }, 100);
            }
        }    
    })();
    Alles anzeigen

    Zitat von Mira_Belle
    ...

    Noch eine Anmerkung.

    Ich habe nun auch mit so einigen Fonts unter Windows 10 herumexperimentiert,

    habe dabei auch festgestellt, dass so mancher Font quasi hochgestellt wird.

    Darum, bzw., welcher Wert es genau ist um den Font dann mittig zu bekommen,

    kümmere ich mich noch.

    Eventuell weiß es ja auch schon jemand, ich brauch’ aber jetzt erst einmal 'ne Pause.

    Alles anzeigen

    Habe mich damit ein wenig beschäftigt und habe festgestellt, dass es prinzipiell an den Fonts liegt.

    Leider habe ich keine befriedigte Lösung gefunden, die allgemein greift,

    so bleibt als einfachste Lösung nur

    padding-bottom für zu tief gestellte Ziffern

    oder

    padding-top für zu hoch gestellte Ziffern zu nutzen,

    um diese Auszurichten.

  • Nur die Anzeige der Ordner/Lesezeichenanzahl in einer anderen Farbe darstellen

    • Mira_Belle
    • 15. Juli 2023 um 15:02
    Zitat von Dharkness

    Wo ist sie denn?

    Man bist Du ungeduldig. ^^

    Musste doch erst den Link auf den Beitrag generieren und dann in das zu kopierende Skript einfügen,

    dabei fiel mir ein kleiner Fehler im Skript auf, den ich natürlich erst korrigieren musste.

  • Nur die Anzeige der Ordner/Lesezeichenanzahl in einer anderen Farbe darstellen

    • Mira_Belle
    • 15. Juli 2023 um 14:54

    Sooo,

    nach einigen Anregungen und weiterem Code eine weitere neue Version des Skriptes.

    JavaScript
    // BookmarkCount.uc.js
    
    /* ******************************************************************************************************************* */
    /* Author BrokenHeart               => https://www.camp-firefox.de/forum/thema/136572/?postID=1229536#post1229536 **** */
    /* Correction from BrokenHeart      => https://www.camp-firefox.de/forum/thema/136572/?postID=1229696#post1229696 **** */
    /* Extension from Sören Henschel    => https://www.camp-firefox.de/forum/thema/136572/?postID=1229555#post1229555 **** */
    /* Customized by Mira inspired by grisu2099     ********************************************************************** */
    /* Source                           => https://www.camp-firefox.de/forum/thema/136572/?postID=1229875#post1229883 **** */
    /* Customized by Mira inspired by Horstmann     ********************************************************************** */
    /* Source                           => https://www.camp-firefox.de/forum/thema/136572/?postID=1229993#post1229993 **** */
    /* ******************************************************************************************************************* */
    /* Version 1.01                     => https://www.camp-firefox.de/forum/thema/136572/?postID=1230128#post1230128 **** */
    /* Version 1.02                     => https://www.camp-firefox.de/forum/thema/136572/?postID=1230334#post1230334 **** */
    /* ******************************************************************************************************************* */
    /* Custom Counter in the Bookmarks for folders and links ************************************************************* */
    /* ******************************************************************************************************************* */
    
    (function() {
    
        if (!window.gBrowser) return;
        
        setTimeout(function() {
            setFunction();
        },50);
    
        let profilePath = PathUtils.toFileURI(PathUtils.join(PathUtils.profileDir, 'chrome', 'icons'))
        let icon1 = "folder_org.svg"
        let icon2 = "bookmark-hollow.svg"
    
        function setFunction() {
    
            const css =`
                .countClass1::before {
                    content: "";
                    background-image: url(${profilePath}/${icon1}); 
                    background-repeat: no-repeat;
                    background-size: 16px;                  /* icon size */
                    background-position: center;
                    margin-left: 16px !important;           /* Abstand links minimum für schmale Popus  CHANGE  */
                    margin-right: -1px !important;           /* Abstand bis zum "Wert" der Ordner */ 
                    height: 16px;
                    width: 16px;
                    fill: #c0c0c0;
                    fill-opacity: 1;
                }
    
                /* Default FX left margin ist 16px !! -->  CHANGE  */ 
    
                .countClass1 label {
                    margin-inline: 0px !important;
                }
                /* Ordner container Inhalt zentriert -->  CHANGE  */
    
                hbox.menu-accel-container.countClass1 {
                    align-items: center !important;
    
                }
                .countClass1::after {
                    content: attr(data-value1) !important;
                    font-family:  Consolas, "Lucida Console", "Courier New", monospace !important;
                    font-size: 12px !important;
                    font-weight: 900 !important;
                    color: #FFD700 !important;
                    height: 14px;                           /* height = font size Text zentriert CHANGE  */
                    width: 15px !important;                 /* Platzhalter für Anzahl der Stellen */
                    padding-left: 4px !important;           /* height = font size Text zentriert CHANGE  */
                    margin-right: -4px !important;          /* Abstand zum Symbol rechts */
    
                /*    background-color: lightblue; */           /*  TEST  */
                }
                .countClass2::before {
                    content: "";
                    background-image: url(${profilePath}/${icon2});
                    background-repeat: no-repeat;
                    background-size: 16px;                  /* icon size */
                    background-position: center;
                    margin-left: 4px !important;            /* Abstand bis zum Icon der Links */
                    margin-right: -1px !important;           /* Abstand bis zum "Wert" der Links */
                    height: 16px;
                    width: 16px;
                    fill: #c0c0c0;
                    fill-opacity: 1;
                }
                .countClass2::after {
                    content: attr(data-value2);
                    font-family:  Consolas, "Lucida Console", "Courier New", monospace !important;
                    font-size: 12px !important;
                    font-weight: 900 !important; 
                    color: #FFD700 !important;
                    height: 14px;                           /* height = font size Text zentriert CHANGE  */
                    width: 15px !important;                 /* Platzhalter für Anzahl der Stellen (25px für 3 Stellen) */
                    padding-left: 4px !important;           /* height = font size Text zentriert CHANGE  */
                    margin-right: -4px !important;          /* Abstand zum Pfeil recht */
    
                /*    background-color: lightblue; */           /*  TEST  */
                }
                .countClass2 image {
                    order: 1;                               /* Pfeil hinter dem "Wert" der Links */
                }
            `;
    
            const sss = Cc['@mozilla.org/content/style-sheet-service;1'].getService(Ci.nsIStyleSheetService);
            const uri = Services.io.newURI('data:text/css,' + encodeURIComponent(css));
            sss.loadAndRegisterSheet(uri, sss.AGENT_SHEET);
    
            let bmbMenu = document.getElementById('bookmarks-menu-button');
            let bookMenu = document.getElementById('bookmarksMenu');
            let persToolBar = document.getElementById('PersonalToolbar');
            
            if(bmbMenu)
                bmbMenu.addEventListener('popupshowing', onPopupShowing ); 
            if(bookMenu)
                bookMenu.addEventListener('popupshowing', onPopupShowing ); 
            if(persToolBar)
                persToolBar.addEventListener('popupshowing', onPopupShowing ); 
        }
        
        function onPopupShowing(aEvent) {
            
            let popup = aEvent.originalTarget;
    
            for (let item of popup.children) {
                if (item.localName != 'menu' || item.id?.startsWith('history')) {
                    continue;
                }    
                setTimeout(() => {
                  let itemPopup = item.menupopup;
                  itemPopup.hidden = true;
                  itemPopup.collapsed = true;
                  itemPopup.openPopup();
                  itemPopup.hidePopup();
                  let menuitemCount = 0;
                  let menuCount = 0;
                  for (let subitem of itemPopup.children) {
                    if (subitem.classList.contains('bookmark-item') && !subitem.disabled && !subitem.hidden) {
                      if (subitem.localName == 'menuitem') {
                        menuitemCount++;
                      } else if (subitem.localName == 'menu') {
                        menuCount++;
                      }
                    }
                  }
                  itemPopup.hidden = false;
                  itemPopup.collapsed = false;
                  item.style.color = '#c0c0c0';
                  
                  let label1 = item.childNodes[3];
      
                  label1.classList.add('countClass1');
    //              let strCountOut1 = String(menuCount).padEnd(2) + '\xa0';     // padEnd2 => zwei Stellen, plus Abstand
                  let strCountOut1 = + menuCount + '\xa0' 
                  label1.setAttribute('data-value1', strCountOut1);
    
                  let label2 = item.childNodes[4];
      
                  label2.classList.add('countClass2');
    //              let strCountOut2 = String(menuitemCount).padEnd(3, '\xa0');  // padEnd3 => drei Stellen, Abstand bei nur einer Ziffer
                  let strCountOut2 = + menuitemCount + '\xa0'
                  label2.setAttribute('data-value2', strCountOut2);
    
                }, 100);
            }
        }    
    })();
    Alles anzeigen

    Noch eine Anmerkung.

    Ich habe nun auch mit so einigen Fonts unter Windows 10 herumexperimentiert,

    habe dabei auch festgestellt, dass so mancher Font quasi hochgestellt wird.

    Darum, bzw., welcher Wert es genau ist um den Font dann mittig zu bekommen,

    kümmere ich mich noch.

    Eventuell weiß es ja auch schon jemand, ich brauch’ aber jetzt erst einmal 'ne Pause.

  • Nur die Anzeige der Ordner/Lesezeichenanzahl in einer anderen Farbe darstellen

    • Mira_Belle
    • 15. Juli 2023 um 10:30

    Sören Hentzschel

    Es ging um diesen Code aus Beitrag #231

    und das Problem, dass die Ausrichtung genau mit diesem Code

    in Windows wohl passt, aber auf dem Mac anders dargestellt wird.

    Für "uns" stellt sich nun die Frage, woran das liegen könnte.

    Ist es der Code, oder ist es BS abhängig?

    Wie kann man das verhindern?

  • Nur die Anzeige der Ordner/Lesezeichenanzahl in einer anderen Farbe darstellen

    • Mira_Belle
    • 15. Juli 2023 um 08:56
    Zitat von omar1979

    Bedeutet das, dass man in diesem Script keine Icons laden kann? ich hab versucht das Folder.png Icon zu ändern

    background-image: url("C:\Users\Ramo\AppData\Roaming\Mozilla\Firefox\Profiles\g4mso52s.default-release\chrome\Icons\Folder.png");

    nimmt aber leider nicht an. :)

    Wenn Du interessiert bist an diesem Skript, dann nutze doch bitte erst einmal das aus #230.

    Alle Versionen danach sind erst einmal nur zum Testen und div. Fehler ausmerzen.

    Denn es scheint wohl so, dass sich das Skript unter Mac anders verhält als unter Windows.

    Dem wollen wir, Horstmann und ich auf dem Grund gehen.

    Wenn Du zur Fehleranalyse beitragen möchtest, musst Du die Skripte erst einmal so nutzen, wie sie sind.

  • Nur die Anzeige der Ordner/Lesezeichenanzahl in einer anderen Farbe darstellen

    • Mira_Belle
    • 14. Juli 2023 um 22:54
    Zitat von Horstmann

    Hmm, seltsam, bei mir muss ich das noch zu deinem Script hinzufügen , damit das Textfeld gesamt niedriger und damit der Text zentriert wird:

    CSS
                .countClass1::after, .countClass2::after {
                    height: 12px;                       /* height gleich = font-size */
                }

    Im ersten Bild dein letzter Code ohne, im zweiten Bild mit der Ergänzung, sonst nur die Icons getauscht.

    Vielleicht tatsächlich ein OS Dingens, und diese Schrift wird auf meinem Mac anders plaziert als bei dir.

    Kopfkratz.

    Vielleicht kann Sören Hentzschel uns ja was dazu sagen?

  • Nur die Anzeige der Ordner/Lesezeichenanzahl in einer anderen Farbe darstellen

    • Mira_Belle
    • 14. Juli 2023 um 22:26
    Zitat von omar1979

    Ok sorry.

    Wieso Sorry, war doch eine korrekte Feststellung und Frage.

  • Nur die Anzeige der Ordner/Lesezeichenanzahl in einer anderen Farbe darstellen

    • Mira_Belle
    • 14. Juli 2023 um 22:17
    Zitat von omar1979

    Sorry wenn ich mich irre, aber auf deinem Letzten Bild sehe ich das blaue Feld mit dem Anzahl und das Stern-Icon überschneiden sich. Ist das evtl extra gemacht?

    Das blaue Feld ist nur zu Testzwecken!

    Horstmann

    Und so schaut es in meinem Testprofil aus.

    Mit diesem Code!

    JavaScript
    // BookmarkCount.uc.js
    
    /* ******************************************************************************************************************* */
    /* Author BrokenHeart               => https://www.camp-firefox.de/forum/thema/136572/?postID=1229536#post1229536 **** */
    /* Correction from BrokenHeart      => https://www.camp-firefox.de/forum/thema/136572/?postID=1229696#post1229696 **** */
    /* Extension from Sören Henschel    => https://www.camp-firefox.de/forum/thema/136572/?postID=1229555#post1229555 **** */
    /* Customized by Mira inspired by grisu2099     ********************************************************************** */
    /* Source                           => https://www.camp-firefox.de/forum/thema/136572/?postID=1229875#post1229883 **** */
    /* Customized by Mira inspired by Horstmann     ********************************************************************** */
    /* Source                           => https://www.camp-firefox.de/forum/thema/136572/?postID=1229993#post1229993 **** */
    /* ******************************************************************************************************************* */
    /* Finaly Source                    => https://www.camp-firefox.de/forum/thema/136572/?postID=1230128#post1230128 **** */
    /* ******************************************************************************************************************* */
    /* Custom Counter in the Bookmarks for folders and links ************************************************************* */
    /* ******************************************************************************************************************* */
    
    (function() {
    
        if (!window.gBrowser) return;
        
        setTimeout(function() {
            setFunction();
        },50);
    
        let profilePath = PathUtils.toFileURI(PathUtils.join(PathUtils.profileDir, 'chrome', 'icons'))
        let icon1 = "folder.svg"
        let icon2 = "faviconfull.svg"
    
        function setFunction() {
    
            const css =`
                .countClass1::before {
                    content: "";
                    background-image: url(${profilePath}/${icon1}); 
                    background-repeat: no-repeat;
                    background-size: 16px;  /* icon size */
                    background-position: center;
                    /*margin-left: 16px !important; */   /* Abstand links minimum für schmale Popus  CHANGE  */ 
                    margin-right: 2px !important;    /* Abstand bis zum "Wert" der Ordner CHANGE  */ 
                    height: 16px;
                    width: 16px;
                    /*fill: #c0c0c0;*/         /*  TEST  */
                    fill-opacity: 1;
                }
    
                /* Default FX left margin ist 16px !! -->  CHANGE  */ 
                .countClass1 label {
                    margin-inline: 0px !important;
                }
    
                /* Ordner container Inhalt zentriert -->  CHANGE  */ 
    
                hbox.menu-accel-container.countClass1 {
                    align-items: center !important;
                }
    
                .countClass1::after {
                    content: attr(data-value1) !important;
                    font-family:  Consolas, "Lucida Console", "Courier New", monospace !important;
                    font-size: 12px !important;
                    font-weight: 900 !important;
                    color: red !important;                     /*  TEST  */  
                    background-color: lightblue;          /*  TEST  */
                    /*height: 12px;       */                          /* height = font size Text zentriert CHANGE  */
                }
    
    
                .countClass2::before {
                    content: "";
                    /*background-image: url(${profilePath}/${icon2});*/        /*  TEST  */
                    background-image: url("chrome://browser/skin/bookmark-hollow.svg");
                    background-repeat: no-repeat;
                    background-size: 16px;  /* icon size */
                    background-position: center;
                    margin-right: 2px !important;   /* Abstand bis zum "Wert" der Links */
                    margin-left: 1px !important;   /* Abstand bis zum Icon der (Links) ORDNER  CHANGE */
                    height: 16px;
                    width: 16px;
                    /*fill: #c0c0c0;*/         /*  TEST  */
                    fill-opacity: 1;
                }
    
                .countClass2::after {
                    content: attr(data-value2);
                    font-family:  Consolas, "Lucida Console", "Courier New", monospace !important;
                    font-size: 12px !important;
                    font-weight: 900 !important; 
                    color: red !important;                     /*  TEST  */
                    margin-right: -6px !important;  /* Abstand zum Pfeil rechts CHANGE */
                    background-color: lightblue;         /*  TEST  */
                    /*height: 12px;       */                          /* height = font size Text zentriert CHANGE  */
                }
    
    
                .countClass2 image {
                    order: 1;                       /* Pfeil hinter dem "Wert" der Links */
                }
            `;
    
            const sss = Cc['@mozilla.org/content/style-sheet-service;1'].getService(Ci.nsIStyleSheetService);
            const uri = Services.io.newURI('data:text/css,' + encodeURIComponent(css));
            sss.loadAndRegisterSheet(uri, sss.AGENT_SHEET);
    
            let bmbMenu = document.getElementById('bookmarks-menu-button');
            let bookMenu = document.getElementById('bookmarksMenu');
            let persToolBar = document.getElementById('PersonalToolbar');
            
            if(bmbMenu)
                bmbMenu.addEventListener('popupshowing', onPopupShowing ); 
            if(bookMenu)
                bookMenu.addEventListener('popupshowing', onPopupShowing ); 
            if(persToolBar)
                persToolBar.addEventListener('popupshowing', onPopupShowing ); 
        }
        
        function onPopupShowing(aEvent) {
            
            let popup = aEvent.originalTarget;
    
            for (let item of popup.children) {
                if (item.localName != 'menu' || item.id?.startsWith('history')) {
                    continue;
                }    
                setTimeout(() => {
                  let itemPopup = item.menupopup;
                  itemPopup.hidden = true;
                  itemPopup.collapsed = true;
                  itemPopup.openPopup();
                  itemPopup.hidePopup();
                  let menuitemCount = 0;
                  let menuCount = 0;
                  for (let subitem of itemPopup.children) {
                    if (subitem.classList.contains('bookmark-item') && !subitem.disabled && !subitem.hidden) {
                      if (subitem.localName == 'menuitem') {
                        menuitemCount++;
                      } else if (subitem.localName == 'menu') {
                        menuCount++;
                      }
                    }
                  }
                  itemPopup.hidden = false;
                  itemPopup.collapsed = false;
                  //item.style.color = '#c0c0c0';
                  
                  let label1 = item.childNodes[3];
      
                  label1.classList.add('countClass1');
                  //let strCountOut1 = String(menuCount).padEnd(2, '\xa0');  //  TEST CHANGE?
    //              let strCountOut1 = String(menuCount).padEnd(2) + '\xa0';     // padEnd2 => zwei Stellen, plus Abstand 
                  let strCountOut1 = + menuCount + '\xa0'
                  label1.setAttribute('data-value1', strCountOut1);
    
                  let label2 = item.childNodes[4];
      
                  label2.classList.add('countClass2');
    //              let strCountOut2 = String(menuitemCount).padEnd(3, '\xa0');  // padEnd3 => drei Stellen, Abstand bei nur einer Ziffer 
                  let strCountOut2 = + menuitemCount + '\xa0'+ '\xa0'   
                  label2.setAttribute('data-value2', strCountOut2);
    
                }, 100);
            }
        }    
    })();
    Alles anzeigen
  • Nur die Anzeige der Ordner/Lesezeichenanzahl in einer anderen Farbe darstellen

    • Mira_Belle
    • 14. Juli 2023 um 22:03
    Zitat von Horstmann

    Der Text der Zählereinheiten ist allerdings immer noch zur oberen Kante hin ausgerichtet, statt mittig.

    Der blaue Kasten ist das Textfeld, man sieht dass der Text nicht vertikal zentriert ist wie der Rest der Zeile.

    Ist aber kein Drama, das kann man bestimmt leicht verschieben wenn's stört.

    Was wirklich hilft sind Screenshots zu den Codes - mach ich auch nicht immer - aber dann hat man einen besseren Vergleich.

    Also bei mir ist es mit Deinem ergänzendem Code mittig!

    Und hier der Code dazu.

    JavaScript
    // BookmarkCount.uc.js
    
    /* ******************************************************************************************************************* */
    /* Author BrokenHeart               => https://www.camp-firefox.de/forum/thema/136572/?postID=1229536#post1229536 **** */
    /* Correction from BrokenHeart      => https://www.camp-firefox.de/forum/thema/136572/?postID=1229696#post1229696 **** */
    /* Extension from Sören Henschel    => https://www.camp-firefox.de/forum/thema/136572/?postID=1229555#post1229555 **** */
    /* Customized by Mira inspired by grisu2099     ********************************************************************** */
    /* Source                           => https://www.camp-firefox.de/forum/thema/136572/?postID=1229875#post1229883 **** */
    /* Customized by Mira inspired by Horstmann     ********************************************************************** */
    /* Source                           => https://www.camp-firefox.de/forum/thema/136572/?postID=1229993#post1229993 **** */
    /* ******************************************************************************************************************* */
    /* Finaly Source                    => https://www.camp-firefox.de/forum/thema/136572/?postID=1230128#post1230128 **** */
    /* ******************************************************************************************************************* */
    /* Custom Counter in the Bookmarks for folders and links ************************************************************* */
    /* ******************************************************************************************************************* */
    
    (function() {
    
        if (!window.gBrowser) return;
        
        setTimeout(function() {
            setFunction();
        },50);
    
        let profilePath = PathUtils.toFileURI(PathUtils.join(PathUtils.profileDir, 'chrome', 'icons'))
        let icon1 = "folder_org.svg"
        let icon2 = "bookmark-hollow.svg"
    
        function setFunction() {
    
            const css =`
                .countClass1::before {
                    content: "";
                    background-image: url(${profilePath}/${icon1}); 
                    background-repeat: no-repeat;
                    background-size: 16px;  /* icon size */
                    background-position: center;
                    margin-right: 4px !important; /* Abstand bis zum "Wert" der Ordner */ 
                    height: 16px;
                    width: 16px;
                    fill: #c0c0c0;
                    fill-opacity: 1;
                }
        /* Default FX left margin ist 16px !! -->  CHANGE  */ 
                .countClass1 label {
                    margin-inline: 0px !important;
                }
        /* Ordner container Inhalt zentriert -->  CHANGE  */ 
                hbox.menu-accel-container.countClass1 {
                    align-items: center !important;
                }
                .countClass1::after {
                    content: attr(data-value1) !important;
                    font-family:  Consolas, "Lucida Console", "Courier New", monospace !important;
                    font-size: 12px !important;
                    font-weight: 900 !important;
                    /*color: #FFD700 !important;    */          /*  TEST  */
                    color: red !important;
                    background-color: lightblue;          /*  TEST  */
                }
                .countClass2::before {
                    content: "";
                    background-image: url(${profilePath}/${icon2});
                    background-repeat: no-repeat;
                    background-size: 16px;  /* icon size */
                    background-position: center;
                    margin-right: 4px !important;   /* Abstand bis zum "Wert" der Links */
                    margin-left: -6px !important;   /* Abstand bis zum Icon der Links */
                    height: 16px;
                    width: 16px;
                    fill: #c0c0c0;
                    fill-opacity: 1;
                }
                .countClass2::after {
                    content: attr(data-value2);
                    font-family:  Consolas, "Lucida Console", "Courier New", monospace !important;
                    font-size: 12px !important;
                    font-weight: 900 !important; 
                    /*color: #FFD700 !important;    */          /*  TEST  */
                    color: red !important;
                    margin-right: -6px !important;  /* Abstand zum Pfeil rechts */
                    background-color: lightblue;          /*  TEST  */
                }
                .countClass2 image {
                    order: 1;                       /* Pfeil hinter dem "Wert" der Links */
                }
            `;
    
            const sss = Cc['@mozilla.org/content/style-sheet-service;1'].getService(Ci.nsIStyleSheetService);
            const uri = Services.io.newURI('data:text/css,' + encodeURIComponent(css));
            sss.loadAndRegisterSheet(uri, sss.AGENT_SHEET);
    
            let bmbMenu = document.getElementById('bookmarks-menu-button');
            let bookMenu = document.getElementById('bookmarksMenu');
            let persToolBar = document.getElementById('PersonalToolbar');
            
            if(bmbMenu)
                bmbMenu.addEventListener('popupshowing', onPopupShowing ); 
            if(bookMenu)
                bookMenu.addEventListener('popupshowing', onPopupShowing ); 
            if(persToolBar)
                persToolBar.addEventListener('popupshowing', onPopupShowing ); 
        }
        
        function onPopupShowing(aEvent) {
            
            let popup = aEvent.originalTarget;
    
            for (let item of popup.children) {
                if (item.localName != 'menu' || item.id?.startsWith('history')) {
                    continue;
                }    
                setTimeout(() => {
                  let itemPopup = item.menupopup;
                  itemPopup.hidden = true;
                  itemPopup.collapsed = true;
                  itemPopup.openPopup();
                  itemPopup.hidePopup();
                  let menuitemCount = 0;
                  let menuCount = 0;
                  for (let subitem of itemPopup.children) {
                    if (subitem.classList.contains('bookmark-item') && !subitem.disabled && !subitem.hidden) {
                      if (subitem.localName == 'menuitem') {
                        menuitemCount++;
                      } else if (subitem.localName == 'menu') {
                        menuCount++;
                      }
                    }
                  }
                  itemPopup.hidden = false;
                  itemPopup.collapsed = false;
                  item.style.color = '#c0c0c0';
                  
                  let label1 = item.childNodes[3];
      
                  label1.classList.add('countClass1');
                  let strCountOut1 = String(menuCount).padEnd(2) + '\xa0';     // padEnd2 => zwei Stellen, plus Abstand 
                  label1.setAttribute('data-value1', strCountOut1);
    
                  let label2 = item.childNodes[4];
      
                  label2.classList.add('countClass2');
                  let strCountOut2 = String(menuitemCount).padEnd(3, '\xa0');  // padEnd3 => drei Stellen, Abstand bei nur einer Ziffer    
                  label2.setAttribute('data-value2', strCountOut2);
    
                }, 100);
            }
        }    
    })();
    Alles anzeigen
  • Nur die Anzeige der Ordner/Lesezeichenanzahl in einer anderen Farbe darstellen

    • Mira_Belle
    • 14. Juli 2023 um 16:42
    Zitat von Horstmann

    (Übrigens: wenn du einem Usernamen ein @ vorstellst (rote Outline als Ergebnis), bekommt dieser User (evtl.) eine Mitteilung darüber erwähnt worden zu sein.

    Wenn du nur einen Link zum Userprofil einstellst, dann nicht. ;)

    Mira_Belle vs. Mira_Belle . )

    Verstehe ich nicht.

    Bist Du benachrichtigt worden?

    OK, bei Sören hatte ich das @ vergessen.

    Aber bei mir schaut das dann immer anders aus, ohne rote Umrandung.

  • Nur die Anzeige der Ordner/Lesezeichenanzahl in einer anderen Farbe darstellen

    • Mira_Belle
    • 14. Juli 2023 um 16:27
    Zitat von Horstmann

    In deinem Screenshot von #225 sind die Zahlen allerdings genauso vertikal versetzt, wie bei meinem Test deiner letzten Version. :/

    Stimmt, habe ich gerade auch gemerkt, ist zwar nur 1px, aber halt doch versetzt!

    Danke für den Hinweis.

    Habe also auch

    CSS
        /* Default FX left margin ist 16px !! -->  CHANGE  */ 
                .countClass1 label {
                    margin-inline: 0px !important;
                }
        /* Ordner container Inhalt zentriert -->  CHANGE  */ 
                hbox.menu-accel-container.countClass1 {
                    align-items: center !important;
                }

    hinzugefügt.

    Ist's mit den neuen Variablen besser?

  • Nur die Anzeige der Ordner/Lesezeichenanzahl in einer anderen Farbe darstellen

    • Mira_Belle
    • 14. Juli 2023 um 16:08

    Horstmann

    Dein Skript in einem neuen Profil getestet!

    Konnte das mit b nachvollziehen!

    Ich habe das mit dem margin-inline auf 0 setzen rausgenommen, damit nicht so viele Stellen zum Rumschrauben da sind!

    Was a angeht, war alles i.O., so wie von mir gedacht.

    Warum bei Dir auf dem Mac mit den Grüßen und den Positionen so komisch ist :?:

    Vielleicht kann ja Sören Hentzschel das noch mal gegenchecken?

    Hast Du mal versucht, die Variablen mit

    let strCountOut1 = + menuCount + '\xa0'
    und

    let strCountOut2 = + menuitemCount + '\xa0'+ '\xa0' zu ersetzen?

  • Anzeige Reihenfolge in zwei Skripten ändern

    • Mira_Belle
    • 14. Juli 2023 um 00:16

    Danke für die Rückmeldung.

  • Nur die Anzeige der Ordner/Lesezeichenanzahl in einer anderen Farbe darstellen

    • Mira_Belle
    • 13. Juli 2023 um 23:44

    Version 1.01

    Code bereinigt und kommentiert!

    JavaScript
    // BookmarkCount.uc.js
    
    /* ******************************************************************************************************************* */
    /* Author BrokenHeart               => https://www.camp-firefox.de/forum/thema/136572/?postID=1229536#post1229536 **** */
    /* Correction from BrokenHeart      => https://www.camp-firefox.de/forum/thema/136572/?postID=1229696#post1229696 **** */
    /* Extension from Sören Henschel    => https://www.camp-firefox.de/forum/thema/136572/?postID=1229555#post1229555 **** */
    /* Customized by Mira inspired by grisu2099     ********************************************************************** */
    /* Source                           => https://www.camp-firefox.de/forum/thema/136572/?postID=1229875#post1229883 **** */
    /* Customized by Mira inspired by Horstmann     ********************************************************************** */
    /* Source                           => https://www.camp-firefox.de/forum/thema/136572/?postID=1229993#post1229993 **** */
    /* ******************************************************************************************************************* */
    /* Finaly Source                    => https://www.camp-firefox.de/forum/thema/136572/?postID=1230128#post1230128 **** */
    /* ******************************************************************************************************************* */
    /* Custom Counter in the Bookmarks for folders and links ************************************************************* */
    /* ******************************************************************************************************************* */
    
    (function() {
    
        if (!window.gBrowser) return;
        
        setTimeout(function() {
            setFunction();
        },50);
    
        let profilePath = PathUtils.toFileURI(PathUtils.join(PathUtils.profileDir, 'chrome', 'icons'))
        let icon1 = "folder_org.svg"
        let icon2 = "bookmark-hollow.svg"
    
        function setFunction() {
    
            const css =`
                .countClass1::before {
                    content: "";
                    background-image: url(${profilePath}/${icon1}); 
                    background-repeat: no-repeat;
                    background-size: 16px;  /* icon size */
                    background-position: center;
                    margin-right: -20px !important; /* Abstand bis zum "Wert" der Ordner */ 
                    height: 16px;
                    width: 16px;
                    fill: #c0c0c0;
                    fill-opacity: 1;
                }
                .countClass1::after {
                    content: attr(data-value1) !important;
                    font-family:  Consolas, "Lucida Console", "Courier New", monospace !important;
                    font-size: 12px !important;
                    font-weight: 900 !important;
                    color: #FFB90F !important;
                }
                .countClass2::before {
                    content: "";
                    background-image: url(${profilePath}/${icon2});
                    background-repeat: no-repeat;
                    background-size: 16px;  /* icon size */
                    background-position: center;
                    margin-right: 4px !important;   /* Abstand bis zum "Wert" der Links */
                    margin-left: -6px !important;   /* Abstand bis zum Icon der Links */
                    height: 16px;
                    width: 16px;
                    fill: #c0c0c0;
                    fill-opacity: 1;
                }
                .countClass2::after {
                    content: attr(data-value2);
                    font-family:  Consolas, "Lucida Console", "Courier New", monospace !important;
                    font-size: 12px !important;
                    font-weight: 900 !important; 
                    color: #FFD700 !important;
                    margin-right: -6px !important;  /* Abstand zum Pfeil rechts */
                }
                .countClass2 image {
                    order: 1;                       /* Pfeil hinter dem "Wert" der Links */
                }
            `;
    
            const sss = Cc['@mozilla.org/content/style-sheet-service;1'].getService(Ci.nsIStyleSheetService);
            const uri = Services.io.newURI('data:text/css,' + encodeURIComponent(css));
            sss.loadAndRegisterSheet(uri, sss.AGENT_SHEET);
    
            let bmbMenu = document.getElementById('bookmarks-menu-button');
            let bookMenu = document.getElementById('bookmarksMenu');
            let persToolBar = document.getElementById('PersonalToolbar');
            
            if(bmbMenu)
                bmbMenu.addEventListener('popupshowing', onPopupShowing ); 
            if(bookMenu)
                bookMenu.addEventListener('popupshowing', onPopupShowing ); 
            if(persToolBar)
                persToolBar.addEventListener('popupshowing', onPopupShowing ); 
        }
        
        function onPopupShowing(aEvent) {
            
            let popup = aEvent.originalTarget;
    
            for (let item of popup.children) {
                if (item.localName != 'menu' || item.id?.startsWith('history')) {
                    continue;
                }    
                setTimeout(() => {
                  let itemPopup = item.menupopup;
                  itemPopup.hidden = true;
                  itemPopup.collapsed = true;
                  itemPopup.openPopup();
                  itemPopup.hidePopup();
                  let menuitemCount = 0;
                  let menuCount = 0;
                  for (let subitem of itemPopup.children) {
                    if (subitem.classList.contains('bookmark-item') && !subitem.disabled && !subitem.hidden) {
                      if (subitem.localName == 'menuitem') {
                        menuitemCount++;
                      } else if (subitem.localName == 'menu') {
                        menuCount++;
                      }
                    }
                  }
                  itemPopup.hidden = false;
                  itemPopup.collapsed = false;
                  item.style.color = '#c0c0c0';
                  
                  let label1 = item.childNodes[3];
      
                  label1.classList.add('countClass1');
                  let strCountOut1 = String(menuCount).padEnd(2) + '\xa0';     // padEnd2 => zwei Stellen, plus Abstand 
                  label1.setAttribute('data-value1', strCountOut1);
    
                  let label2 = item.childNodes[4];
      
                  label2.classList.add('countClass2');
                  let strCountOut2 = String(menuitemCount).padEnd(3, '\xa0');  // padEnd3 => drei Stellen, Abstand bei nur einer Ziffer    
                  label2.setAttribute('data-value2', strCountOut2);
    
                }, 100);
            }
        }    
    })();
    Alles anzeigen
  • Anzeige Reihenfolge in zwei Skripten ändern

    • Mira_Belle
    • 13. Juli 2023 um 22:23

    Bitte Testen.

    JavaScript
    (function() {
    
      if (!window.gBrowser)
        return;
    
      function setFunction() {
        PlacesViewBase.prototype._mayAddCommandsItems =
        function PVB__mayAddCommandsItems(aPopup) {
          let hasMultipleURIs = false;
          let menuitemCount = 0;
          let menuCount = 0;
          if (aPopup._placesNode.childCount > 0) {
            for (let item of aPopup.children) {
              if (item._placesNode) {
                if (item.localName == 'menuitem') {
                  menuitemCount++;
                } else if (item.localName == 'menu') {
                  menuCount++;
                }
              }
            }
            if (menuitemCount > 0 || menuCount > 0) {
              hasMultipleURIs = true;
            }
          }
          if (!hasMultipleURIs)  {
            aPopup.setAttribute("nofooterpopup", "true");
            if (aPopup._endOptOpenAllInTabs) {
              aPopup.removeChild(aPopup._endOptOpenAllInTabs);
              aPopup._endOptOpenAllInTabs = null;
              aPopup.removeChild(aPopup._endOptSeparator);
              aPopup._endOptSeparator = null;
            }
            return;
          }
    
          aPopup.removeAttribute("nofooterpopup");
          if (!aPopup._endOptOpenAllInTabs) {
            aPopup._endOptSeparator = document.createXULElement("menuseparator");
            aPopup._endOptSeparator.className = "bookmarks-actions-menuseparator";
            aPopup.insertBefore(aPopup._endOptSeparator, aPopup.firstChild);
            aPopup._endOptOpenAllInTabs = document.createXULElement("menuitem");
            aPopup._endOptOpenAllInTabs.className = "openintabs-menuitem";
            if (this.options?.extraClasses?.entry) {
              aPopup._endOptOpenAllInTabs.classList.add(
                this.options.extraClasses.entry
              );
            }
            aPopup._endOptOpenAllInTabs.setAttribute(
              "oncommand",
              "PlacesUIUtils.openMultipleLinksInTabs(this.parentNode._placesNode, event, " +
                "PlacesUIUtils.getViewForNode(this));"
            );
            aPopup._endOptOpenAllInTabs.setAttribute(
              "onclick",
              "checkForMiddleClick(this, event); event.stopPropagation();"
            );
            aPopup.insertBefore(aPopup._endOptOpenAllInTabs, aPopup.firstChild);
          }
    
          let label = menuCount + " Ordner";
          label += " / " + menuitemCount + " Link"
          if (menuitemCount != 1) {
            label += "s";
          }
          if (menuitemCount == 1) {
            label += " -> Link in Tab öffnen."
          } else if (menuitemCount > 1) {
            label += " -> Links in Tabs öffnen."
          }
    
          aPopup._endOptOpenAllInTabs.setAttribute("label", label);
        }
      }
    
      setTimeout(function() {
          setFunction();
      },50);
      
    })();
    Alles anzeigen
  • Unerwünschte Nachricht beim Starten

    • Mira_Belle
    • 13. Juli 2023 um 15:51

    Windows 7 :?:

    Meinst Du nicht, es würde mal Zeit für ein Update?

  • Nur die Anzeige der Ordner/Lesezeichenanzahl in einer anderen Farbe darstellen

    • Mira_Belle
    • 13. Juli 2023 um 15:47
    Zitat von Horstmann

    Mir reicht's jetzt auch, vor allem für ein Script das ich wahrscheinlich eh wieder rausschmeisse. ;)

    Aber - wieder dazugelernt! :)

    Deine Lösung funktioniert viel besser als meine bzgl. Flexibilität, schlau mit dem Text und den Puffern, auch wenn ich nicht gerne die Fonts ändere - und das etwas über meine Kompetenz hinausgeht... ;)

    Danke für die Anregungen und Lösungen. :thumbup:

    Danke für das Lob, aber das mit den Fonts und den Puffern stammt ja nicht von mir,

    sondern von Sören Hentzschel, und ohne Deine Anregungen und Codeschnipsel wäre das auch nichts geworden.

    Im Übrigen stammt das mit den Fonts von unserem Guru und Meister BrokenHeart.

    Ich habe nur alle Zutaten zusammen geschüttet und ein neues Gericht daraus kreiert,

    die Küche ist halt doch mein zu Hause, gelle .DeJaVu. ;)

    :D Sorry, der musste jetzt raus, habe wohl 'nen Clown gefrühstückt.

  • Nur die Anzeige der Ordner/Lesezeichenanzahl in einer anderen Farbe darstellen

    • Mira_Belle
    • 13. Juli 2023 um 13:54
    Zitat von Horstmann

    Mooooment, junge Dame, einen hab ich noch. ;)

    Nachdem du auf die Ausrichtung hingewiesen hast, musste ich natürlich auch nochmal ran...

    Das sollte den gleichen Look ergeben wie dein Script, wobei hier alle Elemente verschiebbar sind.

    Die beiden Einträge für min-width sind entscheidend, und basieren auf der tatsächlichen Breite der Zählereinheit (in den Browser-Werkzeugen ausgelesen).

    Breiter geht immer, kostet aber Platz, schmaler macht dann die saubere Ausrichtung wieder kaputt.

    Wenn also Text, Sonderzeichen etc. dazukommen, muss man diese Breitenwerte wieder anpassen; ich vermute das ist in deinem Script ähnlich.

    Alles anzeigen

    Nee nee, ich mag einfach nicht mehr.

    Ich habe das mit den 2 Ziffern in der Ordneraufzählung und 3 Ziffern in der Linkaufzählung so gelößt:

    let strCountOut1 = '\xa0' + String(menuCount).padEnd(2) + '\xa0';

    und

    let strCountOut2 = '\xa0' + String(menuitemCount).padEnd(3, '\xa0');
    gelößt.

    Die Ausrichtung aller einzelnen Elemente lässt sich per CSS steuern.

    Sollte ich dennoch mal wirklich über hundert Links in einem Ordner haben,

    muss ich aber dennoch mal ran. :/

  • Nur die Anzeige der Ordner/Lesezeichenanzahl in einer anderen Farbe darstellen

    • Mira_Belle
    • 13. Juli 2023 um 10:18

    Es hat mir einfach keine Ruhe gelassen.

    JavaScript
    // JavaScript Document
    // BookmarkCount.uc.js
    // Author BrokenHeart
    // Source file https://www.camp-firefox.de/forum/thema/136572/?postID=1229536#post1229536
    //
    // Korrektur von BrokenHeart
    // Source file https://www.camp-firefox.de/forum/thema/136572/?postID=1229696#post1229696
    // 
    // Erweiterung von Sören Henschel
    // Source file https://www.camp-firefox.de/forum/thema/136572/?postID=1229555#post1229555
    //
    // Anpassung von Mira_Belle inspiriert durch grisu2099
    // Source file https://www.camp-firefox.de/forum/thema/136572/?postID=1229875#post1229883
    //
    // Anpassung von Mira_Belle inspiriert durch Horstmann
    // Source file https://www.camp-firefox.de/forum/thema/136572/?postID=1229875#post1229883
    
    
    (function() {
    
        if (!window.gBrowser) return;
        
        setTimeout(function() {
            setFunction();
        },50);
    
        let profilePath = PathUtils.toFileURI(PathUtils.join(PathUtils.profileDir, 'chrome', 'icons'))
        let icon1 = "folder_sv_as.svg"
        let icon2 = "bookmark-hollow_sv_as.svg"
    
        function setFunction() {
    
            const css =`
                .countClass1::before {
                    content: "";
                    background-image: url(${profilePath}/${icon1}); 
                    background-repeat: no-repeat;
                    background-size: 16px;  /* icon size */
                    background-position: center;
                    margin-right: -4px !important;
                    height: 16px;
                    width: 16px;
                }
                .countClass1 label {
                    margin-inline: 0px !important;
                }
                .countClass1::after {
                    content: attr(data-value1) !important;
                    font-family:  Consolas, "Lucida Console", "Courier New", monospace !important;
                    font-size: 12px !important;
                    font-weight: 900 !important;
                    color: #FFB90F !important;
                    margin-inline: 0px !important;
                }
                .countClass2::before {
                    content: "";
                    background-image: url(${profilePath}/${icon2});
                    background-repeat: no-repeat;
                    background-size: 16px;  /* icon size */
                    background-position: center;
                    margin-right: -4px !important;
                    margin-left: -6px !important;
                    height: 16px;
                    width: 16px;
                }
                .countClass2::after {
                    content: attr(data-value2);
                    font-family:  Consolas, "Lucida Console", "Courier New", monospace !important;
                    font-size: 12px !important;
                    font-weight: 900 !important; 
                    color: #FFD700 !important;
                }
                .countClass2 image {
                    order: 1;
                }
            `;
    
            const sss = Cc['@mozilla.org/content/style-sheet-service;1'].getService(Ci.nsIStyleSheetService);
            const uri = Services.io.newURI('data:text/css,' + encodeURIComponent(css));
            sss.loadAndRegisterSheet(uri, sss.AGENT_SHEET);
    
            let bmbMenu = document.getElementById('bookmarks-menu-button');
            let bookMenu = document.getElementById('bookmarksMenu');
            let persToolBar = document.getElementById('PersonalToolbar');
            
            if(bmbMenu)
                bmbMenu.addEventListener('popupshowing', onPopupShowing ); 
            if(bookMenu)
                bookMenu.addEventListener('popupshowing', onPopupShowing ); 
            if(persToolBar)
                persToolBar.addEventListener('popupshowing', onPopupShowing ); 
        }
        
        function onPopupShowing(aEvent) {
            
            let popup = aEvent.originalTarget;
    
            for (let item of popup.children) {
                if (item.localName != 'menu' || item.id?.startsWith('history'))
                    continue;
                setTimeout(() => {
                  let itemPopup = item.menupopup;
                  itemPopup.hidden = true;
                  itemPopup.collapsed = true;
                  itemPopup.openPopup();
                  itemPopup.hidePopup();
                  let menuitemCount = 0;
                  let menuCount = 0;
                  for (let subitem of itemPopup.children) {
                    if (subitem.classList.contains('bookmark-item') && !subitem.disabled && !subitem.hidden) {
                      if (subitem.localName == 'menuitem') {
                        menuitemCount++;
                      } else if (subitem.localName == 'menu') {
                        menuCount++;
                      }
                    }
                  }
                  itemPopup.hidden = false;
                  itemPopup.collapsed = false;
                  item.style.color = '#c0c0c0';
                  
                  let label1 = item.childNodes[3];
      
                  label1.classList.add('countClass1');
                  let strCountOut1 = '\xa0' + String(menuCount).padEnd(2) + '\xa0'; 
                  label1.setAttribute('data-value1', strCountOut1);
    
                  let label2 = item.childNodes[4];
      
                  label2.classList.add('countClass2');
                  let strCountOut2 = '\xa0' + String(menuitemCount).padEnd(3, '\xa0'); 
                  label2.setAttribute('data-value2', strCountOut2);
    
                }, 100);
            }
        }  
    })();
    Alles anzeigen

    So passt es jetzt!

    Nur mit dem Einfärben der Symbole, da habe ich so meine Probleme.

    Daher habe ich die entsprechenden Symbole direkt bearbeitet.


    --------------------------------------------------------------------------------------------------------------------------------------------------------

    :!: Nachtrag

    Auch das Problem ist gelöst.

    Es lag wohl an den von mir verwendeten Symbolen.

    Die wollten sich einfach nicht färben lassen.

    Also habe ich andere genommen und es noch einmal probiert, und siehe da, es klappt.

    Habe nach den Zeilen 42 & 64 einfach fill: #c0c0c0; & fill-opacity: 1; wieder eingefügt!

    Ich danke Dir, Horstmann, für die wunderbare Inspiration und Hilfe.

  • Nur die Anzeige der Ordner/Lesezeichenanzahl in einer anderen Farbe darstellen

    • Mira_Belle
    • 12. Juli 2023 um 23:00
    Zitat von Horstmann

    Edit: Oder probier mal diese Version mit background-image, ich hab das auch für mich selber so umgestellt.

    JavaScript
    // JavaScript Document
    // BookmarkCount.uc.js - modified #2
    // Author BrokenHeart
    // Source file https://www.camp-firefox.de/forum/thema/136572/?postID=1229536#post1229536
    // Endor Repository Link https://github.com/Endor8/userChrome.js/blob/master/Firefox%20115/BookmarkCount.uc.js
    
    
    (function() {
    
        if (!window.gBrowser)
            return;
        
        setTimeout(function() {
            setFunction();
        },50);
    
    
        //Custom icons in profile/chrome/icons folder, code shared by Mira_Belle
        let profilePath = PathUtils.toFileURI(PathUtils.join(PathUtils.profileDir, 'chrome', 'icons'))
        let ico1 = "iconfolder.png"
        let ico2 = "iconitems.png"
    
        function setFunction() {
    
            const css =`
    
                 /*  First icon  /  folder count  /  second icon  /  item count  */
    
                .countClass1::before {
                    content: "";
                    background-image: url(${profilePath}/${ico1}); 
                    background-repeat: no-repeat;
                    background-size: 16px;  /* icon size */
                    background-position: center;
                    margin-inline: 16px 2px;  /* icon 1 distance left right */
                    height: 16px;
                    width: 16px;
                    /*fill: black;
                    fill-opacity: 1;*/
                }
    
                .countClass1 label {
                    margin-inline: 0px !important;
               }
    
                .countClass1::after {
                    content: attr(data-value1); 
                    /*color: black;*/
                }
    
                .countClass2::before {
                    content: "";
                    background-image: url(${profilePath}/${ico2});
                    /*background-image: url("chrome://browser/skin/bookmark-hollow.svg");*/
                    background-repeat: no-repeat;
                    background-size: 16px;  /* icon size */
                    background-position: center;
                    margin-inline: 2px 2px;  /* icon 2 distance left right */
                    height: 16px;
                    width: 16px;
                    /*fill: black;
                    fill-opacity: 1;*/
                }
    
                .countClass2::after {
                    content: attr(data-value2); 
                    /*color: black;*/
                    margin-inline: 0 4px !important;  /* distance right */
                }
    
                .countClass2 image {
                    order: 1;
                }
            `;
    
            const sss = Cc['@mozilla.org/content/style-sheet-service;1'].getService(Ci.nsIStyleSheetService);
            const uri = Services.io.newURI('data:text/css,' + encodeURIComponent(css));
            sss.loadAndRegisterSheet(uri, sss.AGENT_SHEET);
    
            let bmbMenu = document.getElementById('bookmarks-menu-button');
            let bookMenu = document.getElementById('bookmarksMenu');
            let persToolBar = document.getElementById('PersonalToolbar');
            
            if(bmbMenu)
                bmbMenu.addEventListener('popupshowing', onPopupShowing ); 
            if(bookMenu)
                bookMenu.addEventListener('popupshowing', onPopupShowing ); 
            if(persToolBar)
                persToolBar.addEventListener('popupshowing', onPopupShowing ); 
        }
        
        function onPopupShowing(aEvent) {
            
            let popup = aEvent.originalTarget;
    
            for (let item of popup.children) {
                if (item.localName != 'menu' || item.id?.startsWith('history'))
                    continue;
                setTimeout(() => {
                  let itemPopup = item.menupopup;
                  itemPopup.hidden = true;
                  itemPopup.collapsed = true;
                  itemPopup.openPopup();
                  itemPopup.hidePopup();
                  let menuitemCount = 0;
                  let menuCount = 0;
                  for (let subitem of itemPopup.children) {
                    if (subitem.classList.contains('bookmark-item') && !subitem.disabled && !subitem.hidden) {
                      if (subitem.localName == 'menuitem') {
                        menuitemCount++;
                      } else if (subitem.localName == 'menu') {
                        menuCount++;
                      }
                    }
                  }
                  itemPopup.hidden = false;
                  itemPopup.collapsed = false;
                  
                  let label1 = item.childNodes[3];
      
                  label1.classList.add('countClass1');
                  let strCountOut1 = "(" + menuCount + ")"
                  label1.setAttribute('data-value1', strCountOut1);
    
                  let label2 = item.childNodes[4];
      
                  label2.classList.add('countClass2');
                  let strCountOut2 = "(" + menuitemCount + ")"
                  label2.setAttribute('data-value2', strCountOut2);
    
    
                }, 100);
            }
        }
        
    })();
    Alles anzeigen

    Sehr nette Spielerei!

    Ich finde nur, es ist unglücklich, dass sich die Symbole am Lable rechts ausrichten.

    Ich habe teilw. zweistellige Ziffern für Links und so wird das ganze dann für mich recht "unordentlich".

    Auch habe ich in einem kurzen Test nicht herausgefunden, wie ich die SVG-Dateien einfärben kann.

    Was ich schön finde, die Lable lassen sich separat ansprechen und entsprechend unterschiedliche Farben zuweisen.

    Ich danke Dir für's teilen, aber ich denke, ich bleibe vorerst bei "meinem" Skript.

    Was mich jetzt juckt, ist, dass bei mir das Lable beide "Zahlen" sind.

    Mal schauen, ob ich es anders hinbekomme.

Unterstütze uns!

Jährlich (2025)

105,8 %

105,8% (687,41 von 650 EUR)

Jetzt spenden
  1. Kontakt
  2. Datenschutz
  3. Impressum
Community-Software: WoltLab Suite™
Mastodon