Geht denn das in FF 139?+:
EDIT: Quelltext geändert am 19.05.25 02:19 Uhr
JavaScript
// JavaScript Document
// M_NumOfBookmfold+Bookm_light.uc.js
// Fork of @BrokenHeart's code from https://www.camp-firefox.de/forum/thema/136572-nur-die-anzeige-der-ordner-lesezeichenanzahl-in-einer-anderen-farbe-darstellen/?postID=1269879#post1269879
// Das Script erstellt einen Zusatz zu Menüeinträgen in Bookmark-Ordner-Dropdowns.
// Der Zusatz besteht aus der Anzahl der beinhaltenden Ordner sowie aus der Anzahl der beinhaltenden Lesezeichen. Als trennendes Element zwischen Ordner und Lesezeichen wird ein Ordnersymbol als Icon eingefügt.
// Die Anzeige für Ordner oder Bookmarks ist für maximal 2-stellige Werte ausgelegt.
// Sollte kein Ordner sowie kein Lesezeichen vorhanden sein (der Ordner ist leer), erscheint ein Trashsymbol (als Aufforderung zur Löschung des leeren Ordners) und das Pfeil-Symbol (Twisty) wird ausgeblendet.
(function() {
if (!window.gBrowser)
return;
setTimeout(function() {
setFunction();
},50);
function setFunction() {
const
// ■■ START UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
iconFold = '16SWfolder-10_moz.svg',
iconFoldOv = '16SWfolder-12_moz.svg',
iconTrash = '16_Trash-03_moz.svg',
iconFillFold = '#b0b0b0',
iconFillFoldOv = 'currentColor',
iconFillTrash = '#f02228',
iconFillTrashOv = 'currentColor',
fontCol = '#b0b0b0',
fontColOv = 'currentColor',
iconPath = '/chrome/icons/',
// ■■ END UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
curProfDir = PathUtils.toFileURI(PathUtils.join(PathUtils.profileDir))
//const end
const css =`
.countClass {
justify-content: space-between !important;
}
.countClass::after {
content: attr(data-value);
color: ${fontCol};
padding-right: 3px;
background-image: url('${curProfDir}${iconPath}${iconFold}');
fill: ${iconFillFold};
background-repeat: no-repeat;
background-size: 13px 13px;
background-position: right 22px center;
margin-right: -17px !important;
}
menu:hover > .countClass::after {
color: ${fontColOv};
fill: ${iconFillFoldOv};
}
.countClass[data-value^='\xa0']::after {
background-image: none;
}
menu:hover > .countClass:not([data-value^='\xa0'])::after {
background-image: url('${curProfDir}${iconPath}${iconFoldOv}');
}
.countClass[data-value$='\xa0'][data-value^='\xa0'] ~ .menu-right image {
fill-opacity: 1 !important;
list-style-image: url('${curProfDir}${iconPath}${iconTrash}');
fill: ${iconFillTrash};
height: 13px;
width: 13px;
scale: 1.07;
margin-right: 11px !important;
}
menu:hover > .countClass[data-value$='\xa0'][data-value^='\xa0'] ~ .menu-right image {
fill: ${iconFillTrashOv};
}
`;
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);
//----
const bmbMenu = document.getElementById('bookmarks-menu-button');
const bookMenu = document.getElementById('bookmarksMenu');
const 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) {
const 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]; //[1]links [3]rechts
label.classList.add('countClass');
let menuDiv = '\xa0\xa0\xa0';
if (menuCount == 0) {
menuDiv = '\xa0\xa0';
menuCount ='\xa0';
}
if (menuitemCount == 0) {
menuitemCount ='\xa0';
}
if (menuCount > 0 && menuitemCount == 0) {
menuitemCount ='0';
}
if (menuCount > 0 && menuitemCount == '0') {
menuitemCount = '\xa0‒';
}
let strCountOut = String(menuCount).padStart(2,'') + menuDiv + String(menuitemCount).padStart(2,'\xa0');
label.setAttribute('data-value', strCountOut);
}, 100);
}
}
//----
})();
Alles anzeigen