Beiträge von Mira_Belle
-
-
Nicht unbedingt, aber mir ist dabei aufgefallen, dass beim Aufruf eines Menüs die Zählung sofort vollständig angezeigt wird. Bei den anderen Scripten wird alles der Reihe nach von oben nach unten geladen.
Echt jetzt?
Daran arbeiten "wir" die ganze Zeit, damit das so nicht mehr ist.
Ok, das bekomme ich hin, denke ich!
Zeilen 197, 200 und 203, da steht doch dahinter, dass 'popupshowing' zu 'popupshown' geändert wurde.
Mach das einfach mal rückgängig, dann sollte es wieder so sein, wie Du das haben möchtest.Also:
bmbMenu.addEventListener('popupshowing', onPopupShowing );bookMenu.addEventListener('popupshowing', onPopupShowing );
und
persToolBar.addEventListener('popupshowing', onPopupShowing );
Sollte das so nicht fruchten, ersetze die Zeilen 196 bis 204
mit diesem Code:JavaScript
Alles anzeigenif(bmbMenu) { let bmbMenuPopup = document.getElementById('BMB_bookmarksPopup'); if(bmbMenuPopup) { bmbMenuPopup.openPopup(); bmbMenuPopup.hidePopup(); bmbMenuPopup.setAttribute("hasbeenopened","true"); } bmbMenu.addEventListener('popupshowing', onPopupShowing ); } if(bookMenu) { let bookMenuPopup = document.getElementById('bookmarksMenuPopup'); if(bookMenuPopup) { bookMenuPopup.openPopup(); bookMenuPopup.hidePopup(); bookMenuPopup.setAttribute("hasbeenopened","true"); } bookMenu.addEventListener('popupshowing', onPopupShowing ); } if(persToolBar) { persToolBar.addEventListener('popupshowing', onPopupShowing ); }
Achtung! Die Klammer Zeile 205 muss bleiben.
-
FuchsFan Du willst unbedingt das Skript von BrokenHeard nutzen?
Und die Symbole sollen wie in der Vorlage eingebettet sein? -
FuchsFan Das Skript war nur für Testzwecke!
Teste mal dieses Skript, und wenn Du da was umstellen willst, frage nach!
Ich helfe Dir gerne.JavaScript
Alles anzeigen// 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 **** */ /* Adjustments for 139 and customized by Mira inspired by Horstmann ********************************************** */ /* Source => https://www.camp-firefox.de/forum/thema/136572/?postID=1270254#post1270254 **** */ /* Bugfixes for 'popupshowing' to 'popupshown'inspired by BrokenHeart & Horstmann ************************************ */ /* Source => https://www.camp-firefox.de/forum/thema/136572/?postID=1274881#post1274881 **** * /* ******************************************************************************************************************* */ /* Version 1.04a => https://www.camp-firefox.de/forum/thema/136572/?postID=1274881#post1274881 **** */ /* ******************************************************************************************************************* */ /* Custom Counter in the Bookmarks for folders and links ************************************************************* */ /* ******************************************************************************************************************* */ (function() { if (!window.gBrowser) return; setTimeout(function() { setFunction(); },10); let ProfilePath = PathUtils.toFileURI(PathUtils.join(PathUtils.profileDir, 'chrome', 'icons')); // ■■ START UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ //Custom icons in profile/chrome/icons folder let icon1 = "folder-fat.svg"; // Custom Folder Icon let icon2 = "bookmark-hollow.svg"; // Custom Link Icon let icon3 = "arrow-right.svg"; // Custom Arrow Icon // Custom settings let bm_font_size = 12; let cs_font_weight = 700; let bm_icon_size = 16; // NEU: Schriftfarbe getrennt definieren //let cs_font_color_1 = "#FFA500"; // Farbe für Folder-Zähler (links) //let cs_font_color_2 = "#00FFFF"; // Farbe für Link-Zähler (rechts) let cs_font_color_1 = "#FFD700"; // Farbe für Folder-Zähler (links) let cs_font_color_2 = "#FFD700"; // Farbe für Link-Zähler (rechts) // NEU: Symbolfarber getrennt definieren //let cs_icon_color_1 = "#5fe575"; // Farbe für "Ordner", 1.Symbol //let cs_icon_color_2 = "#fbf328"; // Farbe für "Link", 2.Symbol //let cs_icon_color_3 = "#bbf700"; // Farbe für den Pfeil let cs_icon_color_1 = "#C0C0C0"; // Farbe für "Ordner", 1.Symbol let cs_icon_color_2 = "#C0C0C0"; // Farbe für "Link", 2.Symbol let cs_icon_color_3 = "#C0C0C0"; // Farbe für den Pfeil // Calculated settings let cs_font_size = `${bm_font_size}px`; let cs_icon_size = `${bm_icon_size}px`; let cs_width_one = `calc(${bm_icon_size}px + 1.4em)`; let cs_width_uno = `calc(${bm_icon_size}px)`; let cs_width_two = `calc(${bm_icon_size}px + 1.4em)`; let cs_width_due = `calc(${bm_icon_size}px)`; //let useStyle1 = true; // <- HIER Weiche setzen: true = Variante 1, false = Variante 2 let useStyle = 1; // <- HIER Weiche setzen: 0 = Symbole hinter den Zählern, 1 = Symbole vor den Zählern // ■■ END UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ // Symbole vor den Zählern let css_one = ` /* Counter #1 Folder */ #bmContent::before { content: attr(data-value1) !important; width: ${cs_width_one} !important; align-items: center !important; display: flex !important; justify-content: end !important; /*margin-inline: 16px 4px; */ /* min. Abstand links für enge Popups, rechts zum 2ten Counter */ margin-left: 16px !important; /* Abstand links minimum für schmale Popus CHANGE */ margin-right: -1px !important; /* Abstand Icon "Ordner" bis zum "Zähler" */ background-image: url("${ProfilePath}/${icon1}")!important; background-position: center right calc(${cs_width_one} - ${cs_icon_size}) !important; background-repeat: no-repeat !important; background-size: ${cs_icon_size} ${cs_icon_size} !important; color: ${cs_font_color_1} !important; /* Farbe der 1. Zahl */ fill: ${cs_icon_color_1} !important; /* Farbe des 1. Symbols */ } /* Counter #2 Links */ #bmContent::after { content: attr(data-value2) !important; width: ${cs_width_two} !important; align-items: center !important; display: flex !important; justify-content: end !important; /*margin-inline: -2px;*/ margin-left: 4px !important; /* Abstand "Zähler 1" zum Icon2 */ margin-right: -1px !important; /* Abstand Icon "Links" bis zum "Zähler" */ background-image: url("${ProfilePath}/${icon2}") !important; background-position: center right calc(${cs_width_two} - ${cs_icon_size}) !important; background-repeat: no-repeat !important; background-size: ${cs_icon_size} ${cs_icon_size} !important; color: ${cs_font_color_2} !important; /* Farbe der 2. Zahl */ fill: ${cs_icon_color_2} !important; /* Farbe des 2. Symbols */ } `; // Symbole hinter den Zählern let css_two = ` /* Counter #1 Folder */ #bmContent::before { content: attr(data-value1) !important; width: ${cs_width_one} !important; align-items: center !important; display: flex !important; justify-content: end !important; background-image: url("${ProfilePath}/${icon1}")!important; background-position: center right calc(${cs_width_uno} - ${cs_icon_size}) !important; background-repeat: no-repeat !important; background-size: ${cs_icon_size} ${cs_icon_size} !important; color: ${cs_font_color_1} !important; /* Farbe der 1. Zahl */ fill: ${cs_icon_color_1} !important; /* Farbe des 1. Symbols */ padding: 2px 20px 0px 10px !important; /* top | right | bottom | left */ /*margin-inline: 0px -10px; */ margin-left: 16px !important; /* Abstand links minimum für schmale Popus CHANGE */ margin-right: 12px !important; /* Abstand Icon "Ordner" bis zum "Zähler" */ } #bmContent::after { content: attr(data-value2) !important; width: ${cs_width_two} !important; align-items: center !important; display: flex !important; justify-content: end !important; /*justify-content: flex-end; */ background-image: url("${ProfilePath}/${icon2}")!important; background-position: center right calc(${cs_width_due} - ${cs_icon_size}) !important; background-repeat: no-repeat !important; background-size: ${cs_icon_size} ${cs_icon_size} !important; color: ${cs_font_color_2} !important; /* Farbe der 2. Zahl */ fill: ${cs_icon_color_2} !important; /* Farbe des 2. Symbols */ padding: 2px 22px 0 0 !important; /* top | right | bottom | left */ margin-left: -14px !important; /* Abstand "Zähler 1" zum Icon2 */ margin-right: -1px !important; /* Abstand Icon "Links" bis zum "Zähler" */ } `; function setFunction() { const css =` /* Counter rechtsbuendig */ #bmContent { display: flex !important; margin-inline: auto 0 !important; font-family: Consolas, "Lucida Console", "Courier New", monospace !important; font-size: ${cs_font_size} !important; font-weight: ${cs_font_weight} !important; height: ${cs_icon_size} !important; } /* Dynamisch gewählter before-Block */ ${useStyle ? css_one : css_two} /* Pfeil */ menupopup > menu::after { content: "" !important; background-image: url("${ProfilePath}/${icon3}")!important; height: ${cs_icon_size} !important; height: ${cs_icon_size} !important; fill: ${cs_icon_color_3} !important; } `; 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'); //--- LesezeichenmenüButton let bookMenu = document.getElementById('bookmarksMenu'); //--- Lesezeichenmenü let persToolBar = document.getElementById('PersonalToolbar'); //--- Lesezeichenleiste if(bmbMenu) { bmbMenu.addEventListener('popupshown', onPopupShowing ); //--- 'popupshowing' -> 'popupshown' } if(bookMenu) { bookMenu.addEventListener('popupshown', onPopupShowing ); //--- 'popupshowing' -> 'popupshown' } if(persToolBar) { persToolBar.addEventListener('popupshown', onPopupShowing ); //--- 'popupshowing' -> 'popupshown' } } 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; // Neues Element für Zaehler let bmCounta = item.childNodes[1]; if (!bmCounta) return; // Falls undefiniert bmCounta.innerHTML = "" let bmContent = document.createElement("bmContent"); bmContent.id = "bmContent"; bmCounta.appendChild(bmContent); //let strCountOut1 = " " + menuCount + " "; // Has no brackets //let strCountOut1 = "(" + menuCount + ")"; // Has round brackets //let strCountOut1 = "[" + menuCount + "]"; // Has square brackets let strCountOut1 = String(menuCount).padEnd(2, " "); bmContent.setAttribute('data-value1', strCountOut1); //let strCountOut2 = " " + menuitemCount + " "; // Has no brackets //let strCountOut2 = "(" + menuitemCount + ")"; // Has round brackets //let strCountOut2 = "[" + menuitemCount + "]"; // Has square brackets // let strCountOut2 = String(menuitemCount).padEnd(2, " "); // bmContent.setAttribute('data-value2', strCountOut2); let strCountOut2 = (useStyle === 0) ? String(menuitemCount).padStart(4, "/ ") : String(menuitemCount).padEnd(2, " "); bmContent.setAttribute('data-value2', strCountOut2); }, 100); } } })();
Was direkt im Skript geändert werden müsste, wenn die Symbole hinter die Zahlen sollen
und wenn es mehr als zweistellige Zahlen sind.
Aber einfach Bescheid geben. -
In #1 werden die Zähler mit Verspätung geladen und angezeigt, und ...
... und ich habe als auf die "dynamische" Breite geachtet!
Oh, Gott. Ja, das "nachladen" der Counter beim ersten Aufruf, egal welcher Lesezeichen, habe ich auch.
Nur geht das so schnell, dass es mich gar nicht stört!
Was die Breite angeht, die habe ich irgendwo festgezurrt, diesen Effekt, "dynamische" Breitenanpassung habe ich gar nicht!Dann kann ich ja die Ursachenforschung beenden, da ich ja nach dem Falschen gesucht habe.
-
-
Horstmann Das von Dir gezeigte Problem in #569 habe ich in meinem aktuellen Profil nicht.
Jedoch tritt genau das Gleiche in meinem Testprofil auf.
Werde der Sache noch auf den Grund gehen.
-
Das wird bestimmt per JS gehen,
aber willst Du wirklich, dass jedes Mal, wenn Du über ein Icon fährst, alle Icons rechts davon, ihre Position verändern?
Da ist doch so ein Popup viel angenehmer, finde ich. -
Es geht um das Script aus #70
Ah, danke!
@all
Kann mir Blondine jemand mit einfachen Sätzen erklären, was dieses Skript tun soll?
Ich habe gelesen, aber ich verstehe es nicht! -
Horstmann Schon gut, aber recht hattest Du ja. (Mit dem zweiten Skript)
Was das mit dem zusätzlichen Code angeht, warte ich jetzt ab, bis es ein allgemein gütliches Codefragment gibt.
Denn ich brauche die zwei Zeilen Code eigentlich nicht. Bei Dir, wenn ich es richtig verstanden habe, aber schon. -
Dharkness
Ändere ganz am Ende den Code!JavaScriptlet strCountOut1 = String(menuCount).padStart(2, " "); bmContent.setAttribute('data-value1', strCountOut1); let strCountOut2 = (useStyle === 0) ? String(menuitemCount).padStart(4, "/ ") : String(menuitemCount).padStart(2, " "); bmContent.setAttribute('data-value2', strCountOut2);
Also let strCountOut1 = String(menuCount).padEnd(2, " "); in
let strCountOut1 = String(menuCount).padStart(2, " ");
und : String(menuitemCount).padEnd(2, " "); in : String(menuitemCount).padStart(2, " ");.
Das ist alles.Meinst du damit diesen Thread?
Wenn ja, der wurde von grisu2099 erstellt:
Oh, hab' ich mich da etwa einfach drauf gehängt?
Habe ich wohl, aber es war meine Frage, richtig?BeitragRE: Nur die Anzeige der Ordner/Lesezeichenanzahl in einer anderen Farbe darstellen
Ist es nur bei mir so, dass beim Öffnen erst einmal nur bei den oberen drei "Einträgen" die "Werte" angezeigt werden
und erst beim zweiten Mal öffnen, dann bei allen Ordner?Mira_Belle3. Juli 2025 um 23:53
Sorry. -
Zweites Skript AutoPopup.uc.js gelöscht, weil gemotzt wurde. Ist ok, ist aber eigentlich mein Thread.
Nimm es bitte nicht so Bierernst, Du hast ja recht.
ZitatDu kannst extra für Mac erforderlich reinschreiben bis die Kühe bellen, aber da gibt es keinen Zusammenhang.
Ist das so? Dann kann ich es auch wieder löschen, komplett!
Denn beidesCodelet bmbMenuPop = document.getElementById('BMB_bookmarksPopup'); //--- extra für Mac erforderlich
und
JavaScriptif(bmbMenuPop) { bmbMenuPop.addEventListener('popupshowing', onPopupShowing ); //--- extra für Mac erforderlich }
brauche ich nicht!
Ich hatte das nur deinetwegen im Code. -
Ich verstehe das mit der "Live-Verbreiterung" nicht!
Mein komplettes Skript in Kombination mit dem Autopopup-Skript.
JavaScript
Alles anzeigen// 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 **** */ /* Adjustments for 139 and customized by Mira inspired by Horstmann ********************************************** */ /* Source => https://www.camp-firefox.de/forum/thema/136572/?postID=1270254#post1270254 **** */ /* Bugfixes for 'popupshowing' to 'popupshown'inspired by BrokenHeart & Horstmann ************************************ */ /* Source => https://www.camp-firefox.de/forum/thema/136572/?postID=1274881#post1274881 **** * /* ******************************************************************************************************************* */ /* Version 1.04a => https://www.camp-firefox.de/forum/thema/136572/?postID=1274881#post1274881 **** */ /* ******************************************************************************************************************* */ /* Custom Counter in the Bookmarks for folders and links ************************************************************* */ /* ******************************************************************************************************************* */ (function() { if (!window.gBrowser) return; setTimeout(function() { setFunction(); },10); let ProfilePath = PathUtils.toFileURI(PathUtils.join(PathUtils.profileDir, 'chrome', 'icons')); // ■■ START UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ //Custom icons in profile/chrome/icons folder let icon1 = "folder-fat.svg"; // Custom Folder Icon let icon2 = "bookmark-hollow.svg"; // Custom Link Icon let icon3 = "arrow-right.svg"; // Custom Arrow Icon // Custom settings let bm_font_size = 12; let cs_font_weight = 700; let bm_icon_size = 16; // NEU: Schriftfarbe getrennt definieren //let cs_font_color_1 = "#FFA500"; // Farbe für Folder-Zähler (links) //let cs_font_color_2 = "#00FFFF"; // Farbe für Link-Zähler (rechts) let cs_font_color_1 = "#FFD700"; // Farbe für Folder-Zähler (links) let cs_font_color_2 = "#FFD700"; // Farbe für Link-Zähler (rechts) // NEU: Symbolfarber getrennt definieren //let cs_icon_color_1 = "#5fe575"; // Farbe für "Ordner", 1.Symbol //let cs_icon_color_2 = "#fbf328"; // Farbe für "Link", 2.Symbol //let cs_icon_color_3 = "#bbf700"; // Farbe für den Pfeil let cs_icon_color_1 = "#C0C0C0"; // Farbe für "Ordner", 1.Symbol let cs_icon_color_2 = "#C0C0C0"; // Farbe für "Link", 2.Symbol let cs_icon_color_3 = "#C0C0C0"; // Farbe für den Pfeil // Calculated settings let cs_font_size = `${bm_font_size}px`; let cs_icon_size = `${bm_icon_size}px`; let cs_width_one = `calc(${bm_icon_size}px + 1.4em)`; let cs_width_uno = `calc(${bm_icon_size}px)`; let cs_width_two = `calc(${bm_icon_size}px + 1.4em)`; let cs_width_due = `calc(${bm_icon_size}px)`; //let useStyle1 = true; // <- HIER Weiche setzen: true = Variante 1, false = Variante 2 let useStyle = 1; // <- HIER Weiche setzen: 0 = Symbole hinter den Zählern, 1 = Symbole vor den Zählern // ■■ END UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ // Symbole vor den Zählern let css_one = ` /* Counter #1 Folder */ #bmContent::before { content: attr(data-value1) !important; width: ${cs_width_one} !important; align-items: center !important; display: flex !important; justify-content: end !important; /*margin-inline: 16px 4px; */ /* min. Abstand links für enge Popups, rechts zum 2ten Counter */ margin-left: 16px !important; /* Abstand links minimum für schmale Popus CHANGE */ margin-right: -1px !important; /* Abstand Icon "Ordner" bis zum "Zähler" */ background-image: url("${ProfilePath}/${icon1}")!important; background-position: center right calc(${cs_width_one} - ${cs_icon_size}) !important; background-repeat: no-repeat !important; background-size: ${cs_icon_size} ${cs_icon_size} !important; color: ${cs_font_color_1} !important; /* Farbe der 1. Zahl */ fill: ${cs_icon_color_1} !important; /* Farbe des 1. Symbols */ } /* Counter #2 Links */ #bmContent::after { content: attr(data-value2) !important; width: ${cs_width_two} !important; align-items: center !important; display: flex !important; justify-content: end !important; /*margin-inline: -2px;*/ margin-left: 4px !important; /* Abstand "Zähler 1" zum Icon2 */ margin-right: -1px !important; /* Abstand Icon "Links" bis zum "Zähler" */ background-image: url("${ProfilePath}/${icon2}") !important; background-position: center right calc(${cs_width_two} - ${cs_icon_size}) !important; background-repeat: no-repeat !important; background-size: ${cs_icon_size} ${cs_icon_size} !important; color: ${cs_font_color_2} !important; /* Farbe der 2. Zahl */ fill: ${cs_icon_color_2} !important; /* Farbe des 2. Symbols */ } `; // Symbole hinter den Zählern let css_two = ` /* Counter #1 Folder */ #bmContent::before { content: attr(data-value1) !important; width: ${cs_width_one} !important; align-items: center !important; display: flex !important; justify-content: end !important; background-image: url("${ProfilePath}/${icon1}")!important; background-position: center right calc(${cs_width_uno} - ${cs_icon_size}) !important; background-repeat: no-repeat !important; background-size: ${cs_icon_size} ${cs_icon_size} !important; color: ${cs_font_color_1} !important; /* Farbe der 1. Zahl */ fill: ${cs_icon_color_1} !important; /* Farbe des 1. Symbols */ padding: 2px 20px 0px 10px !important; /* top | right | bottom | left */ /*margin-inline: 0px -10px; */ margin-left: 16px !important; /* Abstand links minimum für schmale Popus CHANGE */ margin-right: 12px !important; /* Abstand Icon "Ordner" bis zum "Zähler" */ } #bmContent::after { content: attr(data-value2) !important; width: ${cs_width_two} !important; align-items: center !important; display: flex !important; justify-content: end !important; /*justify-content: flex-end; */ background-image: url("${ProfilePath}/${icon2}")!important; background-position: center right calc(${cs_width_due} - ${cs_icon_size}) !important; background-repeat: no-repeat !important; background-size: ${cs_icon_size} ${cs_icon_size} !important; color: ${cs_font_color_2} !important; /* Farbe der 2. Zahl */ fill: ${cs_icon_color_2} !important; /* Farbe des 2. Symbols */ padding: 2px 22px 0 0 !important; /* top | right | bottom | left */ margin-left: -14px !important; /* Abstand "Zähler 1" zum Icon2 */ margin-right: -1px !important; /* Abstand Icon "Links" bis zum "Zähler" */ } `; function setFunction() { const css =` /* Counter rechtsbuendig */ #bmContent { display: flex !important; margin-inline: auto 0 !important; font-family: Consolas, "Lucida Console", "Courier New", monospace !important; font-size: ${cs_font_size} !important; font-weight: ${cs_font_weight} !important; height: ${cs_icon_size} !important; } /* Dynamisch gewählter before-Block */ ${useStyle ? css_one : css_two} /* Pfeil */ menupopup > menu::after { content: "" !important; background-image: url("${ProfilePath}/${icon3}")!important; height: ${cs_icon_size} !important; height: ${cs_icon_size} !important; fill: ${cs_icon_color_3} !important; } `; 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'); //--- LesezeichenmenüButton let bookMenu = document.getElementById('bookmarksMenu'); //--- Lesezeichenmenü let persToolBar = document.getElementById('PersonalToolbar'); //--- Lesezeichenleiste let bmbMenuPop = document.getElementById('BMB_bookmarksPopup'); //--- extra für Mac erforderlich if(bmbMenu) { bmbMenu.addEventListener('popupshown', onPopupShowing ); //--- 'popupshowing' -> 'popupshown' } if(bmbMenuPop) { bmbMenuPop.addEventListener('popupshowing', onPopupShowing ); //--- extra für Mac erforderlich } if(bookMenu) { bookMenu.addEventListener('popupshown', onPopupShowing ); //--- 'popupshowing' -> 'popupshown' } if(persToolBar) { persToolBar.addEventListener('popupshown', onPopupShowing ); //--- 'popupshowing' -> 'popupshown' } /* 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; // Neues Element für Zaehler let bmCounta = item.childNodes[1]; if (!bmCounta) return; // Falls undefiniert bmCounta.innerHTML = "" let bmContent = document.createElement("bmContent"); bmContent.id = "bmContent"; bmCounta.appendChild(bmContent); //let strCountOut1 = " " + menuCount + " "; // Has no brackets //let strCountOut1 = "(" + menuCount + ")"; // Has round brackets //let strCountOut1 = "[" + menuCount + "]"; // Has square brackets let strCountOut1 = String(menuCount).padEnd(2, " "); bmContent.setAttribute('data-value1', strCountOut1); //let strCountOut2 = " " + menuitemCount + " "; // Has no brackets //let strCountOut2 = "(" + menuitemCount + ")"; // Has round brackets //let strCountOut2 = "[" + menuitemCount + "]"; // Has square brackets // let strCountOut2 = String(menuitemCount).padEnd(2, " "); // bmContent.setAttribute('data-value2', strCountOut2); let strCountOut2 = (useStyle === 0) ? String(menuitemCount).padStart(4, "/ ") : String(menuitemCount).padEnd(2, " "); bmContent.setAttribute('data-value2', strCountOut2); }, 100); } } })();
Zweites Skript AutoPopup.uc.js gelöscht, weil gemotzt wurde. Ist ok, ist aber eigentlich mein Thread.
Nimm es bitte nicht so Bierernst, Du hast ja recht. -
Welchen Code genau nutzt Ihr?
Frage, weil ich keine dieser Probleme habe. -
Aber jetzt gibt es gibt es das Problem plötzlich auch in der Lesezeichenleiste?
Nicht Plötzlich. Hatte ich aber auch schon in #535 so.
Und in #542 sogar erwähnt.Hier der derzeitige Code, wie er bei mir, in allen Lesezeichenpopups, funktioniert.
JavaScript
Alles anzeigenlet bmbMenu = document.getElementById('bookmarks-menu-button'); //--- LesezeichenmenüButton let bookMenu = document.getElementById('bookmarksMenu'); //--- Lesezeichenmenü let persToolBar = document.getElementById('PersonalToolbar'); //--- Lesezeichenleiste let bmbMenuPop = document.getElementById('BMB_bookmarksPopup'); //--- extra für Mac erforderlich if(bmbMenu) { bmbMenu.addEventListener('popupshown', onPopupShowing ); //--- 'popupshowing' -> 'popupshown' } if(bmbMenuPop) { bmbMenuPop.addEventListener('popupshowing', onPopupShowing ); //--- extra für Mac erforderlich } if(bookMenu) { bookMenu.addEventListener('popupshown', onPopupShowing ); //--- 'popupshowing' -> 'popupshown' } if(persToolBar) { persToolBar.addEventListener('popupshown', onPopupShowing ); //--- 'popupshowing' -> 'popupshown' }
-
Sören Hentzschel Du hast wie immer recht! Danke.
Bei dem vielen Testen mit Codefragmenten hatte ich eine Klammer, wo gar keine sein sollte.Also Berichtigung
Horstmann
Beide Varianten aus Beitrag #541 funktionieren.
Nur muss es bei mir anstatt persToolBar.addEventListener('popupshowing', onPopupShowing );
persToolBar.addEventListener('popupshown', onPopupShowing ); heißen,
sonst tritt eben genau DAS Problem auf.
Counter wird erst beim zweiten Mal öffnen des Menüs angezeigt. -
Hattest du beide meiner Versionen aus #541 genau so getestet, und ohne eigene Modifikationen in dem Code Block?
Wir reden vermutlich etwas aneinander vorbei.Nein, glaube ich nicht!
Hattest du beide meiner Versionen aus #541 genau so getestet,
Ja, und dann funktioniert die Anzeige der Counter im Popup vom LesezeichenButton, aber auch in der Lesezeichenleiste, nicht.
Mit Klammern schon.
Also noch einmal zusammen gefasst, beide Codes in Beitrag #541 funktionieren so bei mir nicht.
Setze ich die Klammern, funktionieren beide. -
Wir schreiben aber hier ja Code für möglichst alle User und Fälle.
Da will ich Dir auch gar nicht widersprechen
Es ist nur so, dass ich bei allen Events von 'popupshowing' auf 'popupshown' umstellen musste.
Bei bmbMenu funktionierte auch noch alles mit "doppeltem" Aufruf,
jedoch beim Aufruf des Lesezeichenmenüs (bookMenu) schon nicht mehr.
Da wurden die Counter gar nicht mehr angezeigt.
Und nutze ich da nur 'popupshowing', tritt halt das beschriebene Problem auf.
In der Lesezeichenleiste gleiches! Also überall 'popupshown' in Verwendung.
Horstmann Und Du hast den gleichen Fehler wie ich begangen!
BrokenHeart hat mich darauf hingewiesen! Klammern, es fehlen Klammern.Hier noch einmal Deine zweite Version mit diesen Klammern.
JavaScript
Alles anzeigenlet bmbMenu = document.getElementById('bookmarks-menu-button'); let bookMenu = document.getElementById('bookmarksMenu'); let persToolBar = document.getElementById('PersonalToolbar'); let bmbMenuPop = document.getElementById('BMB_bookmarksPopup'); // neu if(bmbMenu) { bmbMenu.addEventListener('popupshown', onPopupShowing ); // popupshowing => popupshown } if(bmbMenuPop) { bmbMenuPop.addEventListener('popupshowing', onPopupShowing ); // neu } if(bookMenu) { bookMenu.addEventListener('popupshown', onPopupShowing ); // popupshowing => popupshown } if(persToolBar) { persToolBar.addEventListener('popupshowing', onPopupShowing ); }
Und da diese Version ohne Nebenwirkungen funktioniert,
werde ich das so übernehmen.
Nur als Kommentar, anstatt /* neu */ schreibe ich da /* extra für Mac erforderlich */
So etwas hatten wir schon einmal in einem Skript, dass es für Mac extra Code sein musste. -
-
Mitleser Es ist durchaus möglich, dass dieses Problem mit dem verzögertem Anzeigen der Counter
[Anzahl der beinhaltenden Ordner sowie aus der Anzahl der beinhaltenden Lesezeichen],
bzw. erst beim zweiten Mal öffnen des betreffenden Popups (z.B. Lesezeichen), nur auf Windowssystemen auftritt.Scheinbar besteht die Lösung darin, das "Event" 'popupshowing' in 'popupshown'.
Das "Event" auszulösen, bevor und nachdem das Popup-Menü vollständig angezeigt wird,
macht meiner Meinung keinen Sinn.Und BrokenHart hat hier ja recht gut erklärt, warum das "Event" erst nach dem vollständigen Anzeigen
des Menüs ausgelöst werden sollte.In beiden FF-Versionen gibt es ein Attribut hasbeenopened des Menü-Popups, welches gesetzt wird, wenn man erstmalig das Popup aufgerufen hat. Deshalb muss hier ein zweites mal der Button betätigt werde, damit das Skript, so wie es jetzt ist, funktioniert.
Da es hier um Millisekunden geht, so denke ich, sieht man das mit der Verzögerung nicht.
Man bekommt es einfach nicht mit.