Ha, danke
@Horstmann
War ein verdammt guter Ansatz.
Wenn ich jetzt nur noch wüsste, wie ich
a. die Symbole (Icons) fett bekomme und
b. vor die Ziffern, wäre ich wunschlos glücklich,
bis .... ![]()
Hier mein Skript:
CSS
//bmcount testa neu
(function() {
if (!window.gBrowser)
return;
setTimeout(function() {
setFunction();
},50);
//Custom icons in profile/chrome/icons folder
let ProfilePath = PathUtils.toFileURI(PathUtils.join(PathUtils.profileDir, 'chrome', 'icons'));
let icon1 = "Z.Z nichts" // Custom Folder Icon
let icon2 = "Z.Z. nichts" // Custom Link Icon
let cs_font_size = 12
let cs_font_weight = 900
let cs_font_color = "#FFD700"
let cs_icon_color = "#C0C0C0"
function setFunction() {
const css =`
.countClass {
justify-content: space-between !important;
}
.countClass::after {
content: attr(data-value1)
url("chrome://global/skin/icons/folder.svg")
/*url("${ProfilePath}/${icon1}")*/
attr(data-value2)
url("chrome://browser/skin/bookmark-hollow.svg")
/*url("${ProfilePath}/${icon2}")*/ !important;
font-family: Consolas, "Lucida Console", "Courier New", monospace !important;
font-size: ${cs_font_size}px !important;
font-weight: ${cs_font_weight} !important;
color: ${cs_font_color} !important;
align-items: center !important;
display: flex !important;
fill: ${cs_icon_color} !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');
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 label = item.childNodes[1];
label.classList.add('countClass');
let strCountOut1 = ` ${menuCount.toString().padStart(2, " ")} `; // Has square brackets
label.setAttribute('data-value1', strCountOut1);
let strCountOut2 = ` ${menuitemCount.toString().padStart(2, " ")} `; // Has square brackets
label.setAttribute('data-value2', strCountOut2);
}, 100);
}
}
})();
Alles anzeigen
Wenn die Icons, also die SVG-Dateien doch irgendwie in der Größe beeinflussbar wären,
das wäre toll.