Beiträge von grisu2099
-
-
Kann man

Nimmst du diese Version:
Code
Alles anzeigen(function() { if (!window.gBrowser) return; setTimeout(function() { setFunction(); },50); function setFunction() { const css =` .countClass::after { content: attr(data-value); // color: lightgreen; color: yellow; padding-right: 11px; } `; 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 persToolBar = document.getElementById('PersonalToolbar'); let bookMenu = document.getElementById('bookmarksMenu'); persToolBar.addEventListener('popupshowing', onPopupShowing ); bookMenu.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.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++; } } } let label = item.childNodes[3]; //label.menu-iconic-text label.classList.add('countClass'); let strCountOut = + menuCount + " / " + String(menuitemCount).padStart(2, '0') label.setAttribute('data-value', strCountOut); }, 100); } } })(); -
Versuch mal diese Version:
JavaScript
Alles anzeigen// ==UserScript== // @name BackupProfile.uc.js // @namespace BackupProfile.github.com // @description Schaltfläche zum Sichern des Firefoxprofils // @charset UTF-8 // @author ywzhaiqi、defpt // @version v2018.01.10 // @note Vorlage Script von ywzhaiqi (+ Mischung aus diversen Varianten aus dem Fuchsforum 1.11.21) // @note Sicherungsdatei enthaelt auch Profilname // @reviewURL http://bbs.kafan.cn/thread-1758785-1-1.html (function () { ChromeUtils.importESModule("resource:///modules/CustomizableUI.sys.mjs"); CustomizableUI.createWidget({ id : "Backup-button", defaultArea : CustomizableUI.AREA_NAVBAR, label : "Profilsicherung", tooltiptext : "Sichern der aktuellen TEST-Konfiguration", onClick: function(){ // Speicherort - Ordner festlegen - Sichern funktioniert nur wenn Speicherort- bzw. Ordner vorhanden ist!! var path = "F:\\Firefox-Sicherung\\"; // var path = ""; // Ausschlussliste var excludes = 'bookmarkbackups *cache* crashes fftmp *healthreport* minidumps safebrowsing *webapps* saved-telemetry-pings *thumbnails* *session* *Telemetry* *hotfix* *.sqlite-shm *.sqlite-wal *.bak parent.lock blocklist.xml content-prefs.sqlite directoryLinks.json mimeTypes.rdf compatibility.ini parent.lock formhistory.sqlite'; if (!path) { var nsIFilePicker = Ci.nsIFilePicker; var FP = Cc['@mozilla.org/filepicker;1'].createInstance(nsIFilePicker); FP.init(window, 'Sicherungspfad wählen', nsIFilePicker.modeGetFolder); if (FP.show() == nsIFilePicker.returnOK) { path = FP.file.path; } else { return false; } } excludes = excludes.replace(/\./g, '\\.').replace(/\*/g, '.*').replace(/\s+/g, '|'); excludes = new RegExp(excludes, 'i'); var zw = Cc['@mozilla.org/zipwriter;1'].createInstance(Ci.nsIZipWriter); var pr = {PR_RDONLY: 0x01, PR_WRONLY: 0x02, PR_RDWR: 0x04, PR_CREATE_FILE: 0x08, PR_APPEND: 0x10, PR_TRUNCATE: 0x20, PR_SYNC: 0x40, PR_EXCL: 0x80}; var fu = ChromeUtils.importESModule('resource://gre/modules/FileUtils.sys.mjs').FileUtils; var dir = new FileUtils.File(PathUtils.join(PathUtils.profileDir,[])); let d = new Date(); d = d.getDate().toString().padStart(2, '0') + '.' + (d.getMonth() + 1).toString().padStart(2, '0') + '.' + d.getFullYear() + ' - ' + d.getHours().toString().padStart(2, '0') + '\u2236' + d.getMinutes().toString().padStart(2, '0'); // Die folgende Zeile formt den Archivnamen var archiveName = 'Profil RALF ' + AppConstants.MOZ_APP_VERSION_DISPLAY + ' - ' + d + '.zip'; /* 'd' ersetzt 'localnow' */ var xpi = fu.File(path + '\\' + archiveName); zw.open(xpi, pr.PR_RDWR | pr.PR_CREATE_FILE | pr.PR_TRUNCATE); var dirArr = [dir]; for (var i=0; i<dirArr.length; i++) { var dirEntries = dirArr[i].directoryEntries; while (dirEntries.hasMoreElements()) { var entry = dirEntries.getNext().QueryInterface(Ci.nsIFile); if (entry.path == xpi.path) { continue; } if (entry.isDirectory()) { dirArr.push(entry); } var relPath = entry.path.replace(dirArr[0].path, ''); if (relPath.match(excludes)) { continue; } var saveInZipAs = relPath.substr(1); saveInZipAs = saveInZipAs.replace(/\\/g,'/'); // Konfigurationsdateien können gesperrt werden try { zw.addEntryFile(saveInZipAs, Ci.nsIZipWriter.COMPRESSION_FASTEST, entry, false); } catch (e) {} } } zw.close(); alert('Die aktuelle Konfiguration wurde als:\n'+ archiveName +'\ngesichert in:\n' + path); function alert(aString, aTitle) { Cc['@mozilla.org/alerts-service;1'].getService(Ci.nsIAlertsService).showAlertNotification("", aTitle, aString, false, "", null); } function bupgetCurrentProfileName(){ function readFile(aFile){ var stream = Cc["@mozilla.org/network/file-input-stream;1"].createInstance(Ci.nsIFileInputStream); stream.init(aFile, 0x01, 0, 0); var cvstream = Cc["@mozilla.org/intl/converter-input-stream;1"].createInstance(Ci.nsIConverterInputStream); cvstream.init(stream, "UTF-8", 1024, Ci.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER); var content = "", data = {}; while (cvstream.readString(4096, data)) { content += data.value; } cvstream.close(); return content.replace(/\r\n?/g, "\n"); } var PrefD = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("PrefD", Components.interfaces.nsIFile); var ini = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("AppRegD", Components.interfaces.nsIFile); ini.append("profiles.ini"); var ini = readFile(ini); var profiles = ini.match(/Name=.+/g); var profilesD = ini.match(/Path=.+/g); for ( var i = 0; i < profiles.length;i++) { if ((profilesD[i]+"$").indexOf(PrefD.leafName+"$") >= 0) { profiles[i].match(/Name=(.+)$/); return RegExp.$1; } } return null; } }, }); var cssStr = '@-moz-document url("chrome://browser/content/browser.xhtml"){' + '#Backup-button .toolbarbutton-icon {' + 'list-style-image: url("file:///F:/FIREFOX-ICONS/Icons/backupProfile.png")' + '}}'; var sss = Cc["@mozilla.org/content/style-sheet-service;1"].getService(Ci.nsIStyleSheetService); var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService); sss.loadAndRegisterSheet(ios.newURI("data:text/css;base64," + btoa(cssStr), null, null), sss.USER_SHEET); })();Speicherpfad, Archivname und das Icon mußt du dir natürlich anpassen...

-
Ich habe die Anzeige noch mal durchgemischt...

Falls jemand Interesse hat:
JavaScript
Alles anzeigen(function() { if (!window.gBrowser) return; setTimeout(function() { setFunction(); },50); function setFunction() { const css =` .countClass::after { content: attr(data-value); color: yellow; padding-right: 20px; } `; 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 bookMenu = document.getElementById('bookmarksMenu'); let persToolBar = document.getElementById('PersonalToolbar'); bookMenu.addEventListener('popupshowing', onPopupShowing ); 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.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++; } } } let label = item.childNodes[3]; //label.menu-iconic-text label.classList.add('countClass'); let strCountOut = + menuCount + " Ordner / " + String(menuitemCount).padStart(2, '0') + " Links" label.setAttribute('data-value', strCountOut); }, 100); } } })();Nochmal Danke an alle Beteiligten.

-
-
-
-
So, nachdem ich alle neuen Posts durch habe, löse ich auf:
Es war gestern Abend doch schon zu spät. Ich habe den ganzen Abend im Lesezeichen-Menü geschaut - da konnte dann ja noch nix funktionieren..

Sorry für das Durcheinander!

Mit der Version aus #78 ist alles so, wie ich mir das gewünscht habe!
Vielen, vielen Dank an BrokenHeart für die tolle Arbeit!

Danke auch an die, die mitgetestet haben.
-
-
-
-
-
-
-
-
-
-
-
-