Gib uns mal genauere Infos zu deinem System: about:support in die Adreßleiste eingeben. Auf der Seite, die sich dann öffnet, klickst du auf "Text in Zwischenablage kopieren" und fügst das in deinem nächsten Post hier mittels des Buttons "Code" (3. Button von rechts oben im Editor) ein.
Beiträge von grisu2099
-
-
Lad mal bitte einen Screenshot von about:profiles hier hoch...
-
Normalerweise müsste man in einem solchen Fall mehr verändern, weil sich ein Pfad vermutlich geändert hat oder man jetzt eine andere Funktion aus einer anderen Datei verwenden muss.
Und genau da ist dann das Ende der Fahnenstange (bei meinen mangelhaften Java-Skript-Kenntnissen).
Deshalb lieber hier kurz gefragt...
-
-
Das folgende Skript funktioniert im aktuellen Nightly nicht mehr (richtig?).
Aussehen im Firefox115.0.2:
Aussehen im aktuellen Nightly 117.0a1:
Nicht nur die Optik ist anders, auch wird das Suchfeld nicht mehr geleert, so wie es vorher war...
Die notwendigen Änderungen .jsm->.mjs habe ich gemacht (fehlerhaft???)
Kann das jemand bestätigen, bzw. mir sagen, wo es hakt?
JavaScript
Alles anzeigen// 'Alternative search bar' script for Firefox 102+ by Aris // // Thanks to UndeadStar (aka BoomerangAide) for Fx 69+ improvements // https://github.com/Aris-t2/CustomJSforFx/issues/11 // // Thanks to samehb (aka Sameh Barakat) for Fx 68-75+ improvements // https://github.com/Aris-t2/CustomJSforFx/issues/11 // // Thanks to anomiex for the setIcon workaround on Fx 77+ // https://github.com/Aris-t2/CustomJSforFx/issues/33 // // Thanks to 117649 for the Fx107+ fix // https://github.com/Aris-t2/CustomJSforFx/pull/73 // // Idea based on 'search revert' script by '2002Andreas': // https://www.camp-firefox.de/forum/viewtopic.php?f=16&t=112673&start=2010#p1099758 // // Initial "old search" script ported from old Firefox versions by Aris // // // Feature (not optional): search glass is always visible at search bars end (like with "old" search) // Feature (not optional): search button shows current search engines icon (like with "old" search) // Feature (not optional): search buttons dropmarker is always visible (like with "old" search) // // Option: clear search input after search // Option: revert to first search engine in list after search // Option: old search engine selection popup // Option: hide 'add engines' '+' indicator // Option: hide 'oneoff' search engines (engines at popups bottom) // Option: hide placeholder text 'Search' // Option: swap the icons of search engine button and go button // Option: show icons and search engine names instead of only icons // Option: select search engine by scrolling mouse wheel over search bars button // [!] Default browser feature: search engine can be changed inside default/modern popup by right-clicking // search icon and selecting 'Set As Default Search Engine' menuitem. // Configuration area - start (all 'false' by default) var clear_searchbar_after_search = true; // clear input after search (true) or not (false) var revert_to_first_engine_after_search = false; // revert to first engine (true) or not (false) var old_search_engine_selection_popup = false; // show old search engine selection popup (true) or not (false) var select_engine_by_scrolling_over_button = false; // select search engine by scrolling mouse wheel over search bars button (true) or not (false) var select_engine_by_click_oneoffs_button = false; // select search engine by left-clicking search icon (true) or not (false) var hide_oneoff_search_engines = false; // hide 'one off' search engines (true) or not (false) var hide_addengines_plus_indicator = false; // hide add engines '+' sign (true) or not (false) var hide_placeholder = false; // hide placeholder (true) or not (false) var switch_glass_and_engine_icon = false; // swap icons of search engine button and go button (true) or not (false) var show_search_engine_names = false; // show search engine names (true) or not (false) var show_search_engine_names_with_scrollbar = false; // show search engine names with scrollbars (true) or not (false) var show_search_engine_names_with_scrollbar_height = '170px'; // higher values show more search engines var initialization_delay_value = 0; // some systems might require a higher value than '1' second (=1000ms) and on some even '0' is enough var searchsettingslabel = "Change Search Settings"; // Configuration area - end var isInCustomize = 1; //start at 1 to set it once at startup var appversion = parseInt(Services.appinfo.version); Cu.import('resource://gre/modules/Services.jsm'); var AltSearchbar = { init: async function() { await Services.search.wrappedJSObject.init(); if (location != 'chrome://browser/content/browser.xhtml') return; window.removeEventListener("load", AltSearchbar.init, false); try { var searchbar = document.getElementById("searchbar"); var appversion = parseInt(Services.appinfo.version); if(!old_search_engine_selection_popup) updateStyleSheet(); if(hide_placeholder) hideSearchbarsPlaceholder(); if(select_engine_by_scrolling_over_button) selectEngineByScrollingOverButton(); if(old_search_engine_selection_popup) createOldSelectionPopup(); if (select_engine_by_click_oneoffs_button) selectEngineByClickOneoffsButton(); // select search engine by scrolling mouse wheel over search bars button function selectEngineByScrollingOverButton() { searchbar.addEventListener("DOMMouseScroll", (event) => { if (event.originalTarget.classList.contains("searchbar-search-button")) { searchbar.selectEngine(event, event.detail > 0); } }, true); }; // left click on off select engine function selectEngineByClickOneoffsButton() { var searchoneoffs = searchbar.textbox.popup.oneOffButtons; searchoneoffs.container.addEventListener("click", (event) => { if (!(event instanceof KeyboardEvent) && (event.button == 0)) { event.stopPropagation(); event.target.classList.add("search-one-offs-context-set-default"); searchoneoffs._contextEngine = event.target.engine; searchoneoffs._on_command(event); searchoneoffs._contextEngine = null; // let contextEngine = event.target.engine; // let currentEngine = searchbar.currentEngine; // if (!searchoneoffs.getAttribute("includecurrentengine")) { // // Make the target button of the context menu reflect the current // // search engine first. Doing this as opposed to rebuilding all the // // one-off buttons avoids flicker. // let button = searchoneoffs._buttonForEngine(contextEngine); // button.id = searchoneoffs._buttonIDForEngine(currentEngine); // let uri = "chrome://browser/skin/search-engine-placeholder.png"; // if (currentEngine.iconURI) { // uri = currentEngine.iconURI.spec; // } // button.setAttribute("image", uri); // button.setAttribute("tooltiptext", currentEngine.name); // button.engine = currentEngine; // } // searchbar.currentEngine = contextEngine; } }, true); }; // hide placeholder function hideSearchbarsPlaceholder() { searchbar.getElementsByClassName('searchbar-textbox')[0].removeAttribute("placeholder"); }; function attachOldPopupToButton(e) { if(isInCustomize == 1) { setTimeout(function () { searchbar.getElementsByClassName("searchbar-search-button")[0].setAttribute("popup", "searchbuttonpopup"); }, initialization_delay_value); } if(isInCustomize > 0) isInCustomize--; } // old search selection popup async function createOldSelectionPopup() { searchbar.engines = await Services.search.getVisibleEngines(); window.addEventListener("beforecustomization", function(e) { isInCustomize++; }, false); window.addEventListener("aftercustomization", attachOldPopupToButton, false); // set new search engine searchbar.setNewSearchEngine = function(index) { searchbar.currentEngine = searchbar.engines[index]; updateStyleSheet(); }; // create search popup searchbuttonpopup = document.createXULElement("menupopup"); searchbuttonpopup.setAttribute("id", "searchbuttonpopup"); searchbuttonpopup.setAttribute("width", searchbar.getBoundingClientRect().width - 6 ); searchbuttonpopup.setAttribute("position", "after_start"); try { var hidden_list = Services.prefs.getStringPref("browser.search.hiddenOneOffs"); hidden_list = hidden_list ? hidden_list.split(",") : []; for (var i = 0; i <= searchbar.engines.length - 1; ++i) { if(!hidden_list.includes(searchbar.engines[i].name)) { menuitem = document.createXULElement("menuitem");; menuitem.setAttribute("label", searchbar.engines[i].name); menuitem.setAttribute("tooltiptext", searchbar.engines[i].name); menuitem.setAttribute("class", "menuitem-iconic searchbar-engine-menuitem menuitem-with-favicon"); if (searchbar.engines[i] == searchbar.currentEngine) menuitem.setAttribute("selected", "true"); if (searchbar.engines[i].iconURI) menuitem.setAttribute("image",searchbar.engines[i].iconURI.spec); menuitem.setAttribute("oncommand", "document.getElementById('searchbar').setNewSearchEngine("+i+")"); searchbuttonpopup.appendChild(menuitem); } } menuseparator_om = document.createXULElement("menuseparator"); searchbuttonpopup.appendChild(menuseparator_om); menuitem_om = document.createXULElement("menuitem"); menuitem_om.setAttribute("label", searchsettingslabel); menuitem_om.setAttribute("class", "open-engine-manager"); menuitem_om.setAttribute("oncommand", "openPreferences('search');"); searchbuttonpopup.appendChild(menuitem_om); updateStyleSheet(); } catch(exc) { console.log("Exception AltSearchbar: " + exc); } document.getElementById("mainPopupSet").appendChild(searchbuttonpopup); // adjust popup width setTimeout(function(){ document.getElementById('searchbuttonpopup').setAttribute("width", document.getElementById("searchbar").getBoundingClientRect().width); },1000); var observer_width = new MutationObserver(function(mutations,observer) { observer.disconnect(); try { document.getElementById('searchbuttonpopup').setAttribute("width", document.getElementById("searchbar").getBoundingClientRect().width ); } catch(e){} observer.observe(document.getElementById('search-container'), { attributes: true, attributeFilter: ['width'] }); observer.observe(document.getElementById('main-window'), { attributes: true, attributeFilter: ['sizemode'] }); }); try { observer_width.observe(document.getElementById('search-container'), { attributes: true, attributeFilter: ['width'] }); observer_width.observe(document.getElementById('main-window'), { attributes: true, attributeFilter: ['sizemode'] }); } catch(e){} // restore "add search engine" menuitem // attach new popup to search bars search button try { attachOldPopupToButton(); } catch(e) { console.log("AltSearchbar: Failed to attach new popup to search bar search button"); } // Refresh the script's search popup (searchbuttonpopup) with any changes made to search engines/options. async function updateEngines() { var i; try { searchbuttonpopup = document.getElementById("searchbuttonpopup"); searchbar.engines = await Services.search.getVisibleEngines(); try { while (searchbuttonpopup.childNodes[0].tagName.toLowerCase() != "menuseparator") searchbuttonpopup.removeChild(searchbuttonpopup.firstChild); var separator = searchbuttonpopup.childNodes[0]; var hidden_list = Services.prefs.getStringPref("browser.search.hiddenOneOffs"); hidden_list = hidden_list ? hidden_list.split(",") : []; for (i = 0; i <= searchbar.engines.length - 1; ++i) { if (!hidden_list.includes(searchbar.engines[i].name)) { menuitem = document.createXULElement("menuitem");; menuitem.setAttribute("label", searchbar.engines[i].name); menuitem.setAttribute("class", "menuitem-iconic searchbar-engine-menuitem menuitem-with-favicon"); menuitem.setAttribute("tooltiptext", searchbar.engines[i].name); if (searchbar.engines[i] == searchbar.currentEngine) menuitem.setAttribute("selected", "true"); if (searchbar.engines[i].iconURI) menuitem.setAttribute("image", searchbar.engines[i].iconURI.spec); menuitem.setAttribute("oncommand", "document.getElementById('searchbar').setNewSearchEngine(" + i + ")"); searchbuttonpopup.insertBefore(menuitem, separator); } } updateStyleSheet(); } catch (exc) { console.log(exc); } } catch (exc) { console.log("update altbar exc: " + exc); } } // Used to observe modifications made to search engines. We are only interested in the addition and removal of engines. Services.obs.addObserver(function observer(subject, topic, data) { // If a search engine/option is added or removed, we need to refresh the script's popup. We use updateEngines() to do that. if (data == "engine-added" || data == "engine-removed" || data == "engine-changed") { updateEngines(); } }, "browser-search-engine-modified"); // Observe the enabling and disabling of search engines, and update the search popup. Services.prefs.addObserver("browser.search.hiddenOneOffs", function observer(subject, topic, data) { updateEngines(); }); // Used to create an add engine item and append it into the script's search popup (searchbuttonpopup). This is the option // that is displayed as "Add enginename" e.g. Add DuckDuckGo. function createAddEngineItem(e) { try { e.target.removeEventListener(e.type, arguments.callee); searchbuttonpopup = document.getElementById("searchbuttonpopup"); while (searchbuttonpopup.lastChild.classList.contains("custom-addengine-item")) { searchbuttonpopup.removeChild(searchbuttonpopup.lastChild); } setTimeout(function () { //setTimeout fix an issue where labels don't get displayed let native_popup_search_add_items_collection = document.getElementsByClassName("searchbar-engine-one-off-add-engine"); var native_popup_search_add_items = new Array(); for(i = 0; i < native_popup_search_add_items_collection.length; i++) { if(!native_popup_search_add_items_collection[i].parentElement.parentElement.parentElement.parentElement.hasAttribute("class")) { native_popup_search_add_items.push(native_popup_search_add_items_collection[i]); } } if (native_popup_search_add_items.length != 0) { if (searchbuttonpopup.lastChild.tagName.toLowerCase() != "menuseparator") { searchbuttonpopup.appendChild(document.createXULElement("menuseparator")); searchbuttonpopup.appendChild(document.createXULElement("menuseparator")); } for(i = 0; i < native_popup_search_add_items.length; i++) { menuitem = document.createXULElement("menuitem"); menuitem.setAttribute("label", native_popup_search_add_items[i].getAttribute("label")); menuitem.setAttribute("class", "menuitem-iconic searchbar-engine-menuitem menuitem-with-favicon custom-addengine-item"); menuitem.setAttribute("tooltiptext", native_popup_search_add_items[i].getAttribute("label")); menuitem.setAttribute("uri", native_popup_search_add_items[i].getAttribute("uri")); menuitem.setAttribute("data-id", native_popup_search_add_items[i].id); menuitem.setAttribute("oncommand", "document.getElementById(\"" + native_popup_search_add_items[i].id + "\").click();"); if (native_popup_search_add_items[i].hasAttribute("image")) menuitem.setAttribute("image", native_popup_search_add_items[i].getAttribute("image")); searchbuttonpopup.appendChild(menuitem); }; } else { while (searchbuttonpopup.lastChild.tagName.toLowerCase() == "menuseparator") searchbuttonpopup.removeChild(searchbuttonpopup.lastChild); } }, 0 ); } catch (exc) { console.log("custom addengine exc: " + exc); } } searchbar.addEventListener("mousedown", (event) => { var defaultPopup = document.getElementById("PopupSearchAutoComplete"); // Browser's default search popup. var scriptPopup = document.getElementById("searchbuttonpopup"); var addEngineItem = document.getElementsByClassName("custom-addengine-item")[0]; var searchButton = document.getElementsByClassName("searchbar-search-button")[0]; // hasAddEnginesAttribute == true means there is a search engine provided by the page, for us to add using "Add enginename." // You will see a green plus badge on the search button icon, if that is the case. var hasAddEnginesAttribute = searchButton.hasAttribute("addengines"); // Skip clicks on the search button until searchbuttonpopup is available. Disable propagation, too. if (!scriptPopup) { event.stopPropagation(); return; } defaultPopup.style.visibility = "visible"; // If the user clicks on any element on the search bar except the search text. if (event.target.getAttribute("class") != "searchbar-textbox") { // In case the default search popup is shown, hide it. defaultPopup.hidePopup(); // Propagation causes PopupSearchAutoComplete to be shown, which in turn causes search-add-engines to be populated. // We monitor the PopupSearchAutoComplete and after it is shown, we use createAddEngineItem() to create the add // engine item and populate the script's popup (searchbuttonpopup). Propagation causes PopupSearchAutoComplete to be // displayed with searchbuttonpopup, at the same time (when the user clicks the search button). Displaying // PopupSearchAutoComplete with every search button click is inefficient. We allow propagation only when it is needed, // and we set the PopupSearchAutoComplete visibility to collapse, so we do not see it with the script's popup. // If there are no changes to be done to the searchbuttonpopup, go ahead and skip propagation. // If there is an engine to be added, and the engine item is already available on the script's popup, there are no changes. // If there is no engine to be added, and there is no engine item, that also means that there are no changes needed. // On the other hand, if hasAddEnginesAttribute and addEngineItem are not synchronized, we need to apply propagation // to refresh the searchbuttonpopup. We set the addEngineItem visibility to collapse, and allow propagation. if ((hasAddEnginesAttribute && addEngineItem && addEngineItem.hasAttribute("image") && document.getElementById(addEngineItem.getAttribute("data-id")) && gBrowser.currentURI.spec.includes(addEngineItem.getAttribute("uri").match(/.+:\/\/([^\/]+)\//)[1])) || (!hasAddEnginesAttribute && !addEngineItem)) event.stopPropagation(); else { defaultPopup.style.visibility = "collapse"; defaultPopup.addEventListener("popupshown", createAddEngineItem, false); } } /*searchbar.focus();*/ }, true); }; //createOldSelectionPopup ChromeUtils.defineESModuleGetters(lazy, { SearchSuggestionController: "resource://gre/modules/SearchSuggestionController.sys.mjs", }); ChromeUtils.defineESModuleGetters(lazy, { FormHistory: "resource://gre/modules/FormHistory.sys.mjs", }); var _doSearch = searchbar.doSearch.toString(); searchbar.doSearch = Cu.getGlobalForObject(this)["ev"+"al"]( "(" +(_doSearch.startsWith("function")? "":"function ") + _doSearch.slice(0,-2) + ` if(clear_searchbar_after_search) this.value = ''; if(revert_to_first_engine_after_search) { searchbar.currentEngine = searchbar.engines[0]; updateStyleSheet(); } ` + _doSearch.slice(-2) + ")" ); // Workaround for the deprecated setIcon funtion var oldUpdateDisplay = searchbar.updateDisplay; searchbar.updateDisplay = function() { oldUpdateDisplay.call(this); updateStyleSheet(); }; // main style sheet function updateStyleSheet() { var sss = Components.classes["@mozilla.org/content/style-sheet-service;1"].getService(Components.interfaces.nsIStyleSheetService); var hide_oneoff_search_engines_code = ''; var show_search_engine_names_code = ''; var show_search_engine_names_code102 = ''; var show_search_engine_names_with_scrollbar_code = ''; var hide_addengines_plus_indicator_code = ''; var switch_glass_and_engine_icon_code = ''; if(hide_oneoff_search_engines) hide_oneoff_search_engines_code=` #PopupSearchAutoComplete .search-panel-header, #PopupSearchAutoComplete .search-one-offs { display: none !important; } `; if(hide_addengines_plus_indicator) hide_addengines_plus_indicator_code=` .searchbar-search-button[addengines=true]::after { visibility: hidden !important; } `; if(show_search_engine_names && !hide_oneoff_search_engines) show_search_engine_names_code=` #PopupSearchAutoComplete .search-panel-one-offs .searchbar-engine-one-off-item { appearance: none !important; min-width: 0 !important; width: 100% !important; border: unset !important; height: 18px !important; background-image: unset !important; padding-inline-start: 2px !important; margin-inline-start: 5px !important; margin-inline-end: 0 !important; } #PopupSearchAutoComplete .search-panel-one-offs .searchbar-engine-one-off-item::after { appearance: none !important; display: block !important; content: attr(tooltiptext) !important; position: relative !important; padding-inline-start: 6px !important; min-width: 0 !important; width: 100% !important; white-space: nowrap !important; } #PopupSearchAutoComplete .search-panel-one-offs { min-height: unset !important; height: unset !important; max-height: unset !important; line-height: unset !important; } #PopupSearchAutoComplete .search-panel-one-offs .searchbar-engine-one-off-item .button-box { display: inline !important; } #PopupSearchAutoComplete .search-setting-button { z-index: 1000 !important; } #PopupSearchAutoComplete .search-panel-one-offs .searchbar-engine-one-off-item .button-box .button-icon { margin-top: 1px !important; padding-inline-start: 0px !important; margin-inline-start: 0px !important; position: relative !important; } `; if(appversion < 106) show_search_engine_names_code102=` #PopupSearchAutoComplete .search-panel-one-offs .searchbar-engine-one-off-item::after { display: inline !important; top: -3px !important; bottom: 4px !important; } `; if(show_search_engine_names_with_scrollbar && !hide_oneoff_search_engines && show_search_engine_names) show_search_engine_names_with_scrollbar_code=` #PopupSearchAutoComplete .search-one-offs { height: `+show_search_engine_names_with_scrollbar_height+` !important; max-height: `+show_search_engine_names_with_scrollbar_height+` !important; overflow-y: scroll !important; overflow-x: hidden !important; } `; if(switch_glass_and_engine_icon) switch_glass_and_engine_icon_code=` .search-go-button { list-style-image: url(`+document.getElementById("searchbar").currentEngine.iconURI.spec+`) !important; transform: scaleX(1) !important; } .searchbar-search-button .searchbar-search-icon { list-style-image: url("file:///F:/FIREFOX-ICONS/Icons/Lupe.png") !important; } `; var uri = Services.io.newURI("data:text/css;charset=utf-8," + encodeURIComponent(` #search-container{ min-width: 20px !important } #searchbuttonpopup { margin-inline-start: -1px; } .searchbar-search-button .searchbar-search-icon { list-style-image: url(`+document.getElementById("searchbar").currentEngine.iconURI.spec+`) !important; } .search-go-button { list-style-image: url("file:///F:/FIREFOX-ICONS/Icons/Lupe.png") !important; transform: unset !important; background: unset !important; margin-inline-end: 4px !important; } .search-go-button[hidden="true"] { display: block !important; } .searchbar-search-button[addengines=true] > .searchbar-search-icon-overlay, .searchbar-search-button:not([addengines=true]) > .searchbar-search-icon-overlay { list-style-image: url("chrome://global/skin/icons/arrow-down-12.svg") !important; -moz-context-properties: fill !important; visibility: hidden !important; margin-inline-start: -6px !important; margin-inline-end: 2px !important; width: 11px !important; height: 11px !important; } .searchbar-search-button[addengines=true] > .searchbar-search-icon-overlay { margin-top: 0px !important; } .searchbar-search-button[addengines=true]::after { content: " " !important; background: url("chrome://browser/skin/search-indicator-badge-add.svg") center no-repeat !important; display: block !important; visibility: visible !important; width: 11px !important; height: 11px !important; margin-inline-start: 18px !important; margin-top: 4px !important; position: absolute !important; } .searchbar-search-button[addengines=true] > .searchbar-search-icon-overlay { visibility: visible !important; } .custom-addengine-item > .menu-iconic-left::after { position: absolute !important; display: block; !important; content: "" !important; background: url("chrome://browser/skin/search-indicator-badge-add.svg") no-repeat center !important; box-shadow: none !important; margin-top: -12px !important; margin-inline-start: -4px !important; width: 11px; !important; height: 11px; !important; min-width: 11px; !important; min-height: 11px; !important; } `+hide_addengines_plus_indicator_code+` `+hide_oneoff_search_engines_code+` `+show_search_engine_names_code+` `+show_search_engine_names_code102+` `+show_search_engine_names_with_scrollbar_code+` `+switch_glass_and_engine_icon_code+` `), null, null); // remove old style sheet if (sss.sheetRegistered(uri,sss.AGENT_SHEET)) { sss.unregisterSheet(uri,sss.AGENT_SHEET); } sss.loadAndRegisterSheet(uri, sss.AGENT_SHEET); }; } catch(e) {} } } /* if search is not hidden on current window, wait for searchbar loading and then initialize 'alternative search' (with delay) */ if(!document.firstElementChild.hasAttribute("chromehidden") || !document.firstElementChild.getAttribute("chromehidden").includes("toolbar")) { if (document.readyState === "complete") { setTimeout(AltSearchbar.init, initialization_delay_value); } else { window.addEventListener("load", AltSearchbar.init, false); } }
-
-
-
Habe fertig...
Basis ist der CSS-Code aus #198 und ein gegenüber der gestrigen Version minimal verändertes Skript:
JavaScript
Alles anzeigen(function() { if (!window.gBrowser) return; setTimeout(function() { setFunction(); },50); function setFunction() { const css =` .countClass::after { content: attr(data-value); font-family: Consolas, "Lucida Console", "Courier New", monospace; font-size: 16px; color: lightgreen; padding-right: 26px; } `; 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[3]; //label.menu-iconic-text label.classList.add('countClass'); // let strCountOut = + String(menuCount) + " 📂" + " / " + String(menuitemCount).padStart(2, '\xa0') + " ⭐" ; let strCountOut = + String(menuCount) + '\xa0' + '\xa0' + " / " + String(menuitemCount).padStart(2, '0'); label.setAttribute('data-value', strCountOut); }, 100); } } })();
CSS.countClass { background-image: url("file:///F:/FIREFOX-ICONS/Icons/folder-blue.png"), url("file:///F:/FIREFOX-ICONS/Icons/Stern-blau.png") !important; background-size: 16px 16px !important; background-repeat: no-repeat !important; background-position: 35px, right 5px center !important; }
Edit: Bei Zeilen mit mehr als 10 Unterordnern müssen diese noch individuell angepaßt werden...
Da das bei mir nur 1 Zeile betrifft, ist es (für mich) nicht so schlimm.
-
-
-
Die Emojis/Icons können z.B. direkt in den Editor (NP++) über [Windows-Taste]+[.] in den Code kopiert werden.
Muß man nur wissen...
Funktioniert auch andersrum:
Finde ich sogar noch besser (logischer)
Geht dann mit dieser "Zauberzeile":
let strCountOut = + String(menuCount) + "📁" + " / " + String(menuitemCount).padStart(2, '\xa0') + "⭐" ;
-
-
-
-
-
-
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.
-