Mal von dem kleinen Fehler abgesehen,
aber der ganze Code bewirkt hier bei mir gar nichts.
Mal von dem kleinen Fehler abgesehen,
aber der ganze Code bewirkt hier bei mir gar nichts.
...
Danke übrigens, sieht für mich besser aus rechtsbündig.
Gern geschehen. Sieht nicht nur für dich besser aus, wenn die Zahlen rechtsbündig sind...
Über solche Dinge kann man ja vortrefflich streiten.
Ich habe die Symbole vor den Zählern stehen und finde es schrecklich,
wenn da zwischen Symbol und Zähler eine Lücke klafft.
Und wenn der Wert des Zählers auch noch dreistellig sein soll, uuha, grauslig.
Aber es ist ja schön, dass die Geschmäcker verschieden sind.
So. ![]()
// 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
...Alles anzeigenNoch 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.
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.
Sooo,
nach einigen Anregungen und weiterem Code eine weitere neue Version des Skriptes.
// 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.
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?
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.
Hmm, seltsam, bei mir muss ich das noch zu deinem Script hinzufügen , damit das Textfeld gesamt niedriger und damit der Text zentriert wird:
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?
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!
// 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
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.
// 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
(Ü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.
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
/* 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?
@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?
Danke für die Rückmeldung.
Version 1.01
Code bereinigt und kommentiert!
// 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
Bitte Testen.
(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
Windows 7 ![]()
Meinst Du nicht, es würde mal Zeit für ein Update?