auf der Suche nach ExtraConfigMenu.uc.js, welches mir passt.
-
omar1979 -
4. November 2026 um 14:02 -
Erledigt
-
-
Das Script ist jetzt auf dein System (Ordner chrome) zugeschnitten. Alle Funktionen für about-Seiten sind entfernt, können hier also nicht mehr aufgerufen werden. Wenn du noch Zusätze wünscht dann sag an, wir helfen dir. So, dann teste erst einmal das Script.
JavaScript
Alles anzeigen// ==UserScript== // @name config_menu_pro.uc.js // @compatibility Firefox 155+ // @include main // @version 1.5.2.1 // @description Konfigurationsmenü für Firefox 155+, Spezielles Menü für User omar1979 // ==/UserScript== /* ======================================================================== * 1. Konfiguration * ====================================================================== */ var uProfMenu = { TextOpenExe: 'C:\\Program Files\\Microsoft VS Code\\Code.exe', vFileManager: '', // leer = System-Dateimanager showAsButton: 1, // 1 = Toolbarbutton, 0 = Menü unter Extras cssOrdner: 1, jsSubfolder: 'Scripte', cssFolderName: 'CSS', cssShadowFolderName: 'CSSShadow', cssWebFolderName: 'CSSWeb', enableScriptsToClip: 2, // 0 = aus, 1 = ohne Nummer, 2 = nummeriert enableRestart: 0, // Interner Status, nicht ändern buttonInitRetry: false, initialized: false, customUI: null, /* ====================================================================== * 2. Start * ====================================================================== */ init() { if (this.initialized) return; const menu = this.showAsButton ? this.initAsButton() : this.initAsExtrasMenu(); if (!menu) return; if (menu.querySelector('#ExtraConfigMenu-popup')) { this.initialized = true; return; } this.installStyle(); const popup = menu.appendChild( this.createME('menupopup', null, null, null, 'ExtraConfigMenu-popup') ); popup.addEventListener('popupshowing', () => uProfMenu.refresh(), true); this.buildMenu(popup); this.initialized = true; }, initAsButton() { if (!this.loadCustomizableUI()) { this.retryInit(); return null; } if (!this.customUI.getWidget('ExtraConfigMenu-button')) { try { this.customUI.createWidget({ id: 'ExtraConfigMenu-button', type: 'custom', defaultArea: this.customUI.AREA_NAVBAR, label: 'Extra Config Menü', tooltiptext: 'Extra Config Menü\nRechtsklick öffnet about:config', onBuild: doc => { const btn = doc.createXULElement('toolbarbutton'); btn.setAttribute('id', 'ExtraConfigMenu-button'); btn.setAttribute('label', 'Extra Config Menü'); btn.setAttribute('tooltiptext', 'Extra Config Menü\nRechtsklick öffnet about:config'); btn.setAttribute('type', 'menu'); btn.setAttribute('class', 'toolbarbutton-1'); btn.setAttribute('removable', 'true'); btn.setAttribute('chromeclass', 'toolbar-additional'); return btn; } }); } catch (e) { this.log('CustomizableUI.createWidget fehlgeschlagen: ' + e); return null; } } const btn = document.getElementById('ExtraConfigMenu-button'); if (!btn) { this.retryInit(); return null; } if (!btn.hasAttribute('data-uProfMenu-context')) { btn.addEventListener('contextmenu', e => { e.preventDefault(); e.stopPropagation(); uProfMenu.openURL('about:config'); }, true); btn.setAttribute('data-uProfMenu-context', 'true'); } return btn; }, initAsExtrasMenu() { const toolsPopup = document.getElementById('menu_ToolsPopup'); if (!toolsPopup) { this.log('Das Extras-Menü wurde nicht gefunden.'); return null; } let menu = document.getElementById('ExtraConfigMenu'); if (!menu) { menu = toolsPopup.appendChild( this.createME('menu', 'Extra Config Menü', null, 'menu-iconic', 'ExtraConfigMenu') ); menu.addEventListener('dblclick', () => uProfMenu.openURL('about:config'), true); } return menu; }, retryInit() { if (this.buttonInitRetry) return; this.buttonInitRetry = true; setTimeout(() => { uProfMenu.buttonInitRetry = false; uProfMenu.init(); }, 500); }, refresh() { this.getScripts(0); if (this.cssOrdner) { [3, 4, 5].forEach(t => this.getCss(t)); } }, /* ====================================================================== * 3. Menüaufbau * ====================================================================== */ buildMenu(popup) { this.buildScriptMenu(popup); if (this.cssOrdner) this.buildCssMenus(popup); this.buildExtraFoldersMenu(popup); this.buildClipboardEntry(popup); this.buildConfigFiles(popup); this.buildChromeFolders(popup); this.buildPrefsRestart(popup); }, buildScriptMenu(popup) { this.createSubmenu(popup, 'Meine Scripte', 'submenu-ucjs', 'submenu-ucjs-items'); }, buildCssMenus(popup) { this.createSubmenu(popup, 'CSS', 'submenu-css', 'submenu-css-items'); this.createSubmenu(popup, 'CSSWeb', 'submenu-cssweb', 'submenu-cssweb-items'); this.createSubmenu(popup, 'CSSShadow', 'submenu-CSSShadow', 'submenu-CSSShadow-items'); }, buildExtraFoldersMenu(popup) { this.createSubmenu(popup, 'Weitere Ordner öffnen', 'submenu-weitere-ordner', 'submenu-weitere-ordner-items'); const fp = document.getElementById('submenu-weitere-ordner-items'); if (!fp) return; const folders = [ ['Installationsordner', this.getPrefPath('CurProcD')], ['Profilordner', this.getPrefPath('ProfD')], ['Startup-Cache-Ordner', this.getPrefPath('ProfLD') + this.getSep() + 'startupCache'], ['Add-ons-Ordner', this.getPrefPath('ProfD') + this.getSep() + 'extensions'], ['Icons-Ordner', this.getChromePath('icons')], ['Ordner HamburgerMenu', this.getChromePath('HamburgerMenu')], ['Ordner Leisten', this.getChromePath('Leisten')], ['Ordner Menuleiste', this.getChromePath('Menuleiste')] ]; folders.forEach(([label, path]) => this.addFolderItem(fp, label, path)); }, buildClipboardEntry(popup) { if (!this.enableScriptsToClip) return; this.addCommandItem(popup, 'Skriptliste in Zwischenablage', () => uProfMenu.getScripts(1), 'uProfMenu_clipboard'); }, buildConfigFiles(popup) { popup.appendChild(document.createXULElement('menuseparator')); const files = [ ['userChrome.css', 0], ['userContent.css', 0], ['userChromeShadow.css', 0], ['userChrome.js', 0], ['user.js', 1] ]; files.forEach(([name, mode]) => { this.addCommandItem(popup, name, () => uProfMenu.edit(mode, name), 'uProfMenu_edit'); }); popup.appendChild(document.createXULElement('menuseparator')); }, buildChromeFolders(popup) { this.addCommandItem(popup, 'Chrome-Ordner öffnen', () => uProfMenu.openPrefDir('UChrm'), 'uProfMenu_folder'); this.addFolderItem(popup, 'Scripte-Ordner öffnen', this.getChromePath(this.jsSubfolder)); if (!this.cssOrdner) return; this.addFolderItem(popup, 'CSS-Ordner öffnen', this.getChromePath(this.cssFolderName)); this.addFolderItem(popup, 'CSSWeb-Ordner öffnen', this.getChromePath(this.cssWebFolderName)); this.addFolderItem(popup, 'CSSshadow-Ordner öffnen', this.getChromePath(this.cssShadowFolderName)); }, buildPrefsRestart(popup) { if (this.enableRestart) { popup.appendChild(document.createXULElement('menuseparator')); this.addCommandItem(popup, 'Neustart', () => { try { if (typeof ToolRstartMod !== 'undefined' && ToolRstartMod && ToolRstartMod.restartApp) { ToolRstartMod.restartApp(false); } else { Services.startup.quit(Ci.nsIAppStartup.eRestart | Ci.nsIAppStartup.eAttemptQuit); } } catch (e) { alert('Neustart nicht möglich:\n' + e); } }, 'uProfMenu_restart'); } }, /* ====================================================================== * 4. Mappings für CSS und Zähler * ====================================================================== */ cssInfo(type) { const map = { 3: [this.cssFolderName, 'submenu-css', 'submenu-css-items', 'Meine CSS-Dateien'], 4: [this.cssWebFolderName, 'submenu-cssweb', 'submenu-cssweb-items', 'Meine CSSWeb-Dateien'], 5: [this.cssShadowFolderName, 'submenu-CSSShadow', 'submenu-CSSShadow-items', 'Meine CSSShadow-Dateien'] }; return map[type]; }, countClassFor(type) { const map = { 0: 'uProfMenu-count-scripts', 3: 'uProfMenu-count-css', 4: 'uProfMenu-count-cssweb', 5: 'uProfMenu-count-cssshadow' }; return map[type] || ''; }, /* ====================================================================== * 5. Basis-Helfer für XUL * ====================================================================== */ createME(type, label, command, cls, id) { const el = document.createXULElement(type); if (label) el.setAttribute('label', label); if (cls) el.setAttribute('class', cls); if (id) el.setAttribute('id', id); if (type === 'menuitem' && typeof command === 'function') { el.addEventListener('command', command, true); } return el; }, createSubmenu(parent, label, menuId, popupId) { const menu = parent.appendChild(this.createME('menu', label, null, null, menuId)); menu.appendChild(this.createME('menupopup', null, null, null, popupId)); return menu; }, addCommandItem(parent, label, command, cls, attrs) { const item = this.createME('menuitem', label, command, cls, null); if (attrs) for (const n in attrs) item.setAttribute(n, attrs[n]); parent.appendChild(item); return item; }, addFolderItem(parent, label, path) { return this.addCommandItem( parent, label, e => uProfMenu.dirOpen(e.currentTarget.getAttribute('data-path')), 'uProfMenu_folder', { 'data-path': path } ); }, /* ====================================================================== * 6. Pfade, Öffnen, Bearbeiten * ====================================================================== */ getSep() { return Services.appinfo.OS === 'WINNT' ? '\\' : '/'; }, getPrefPath(name) { const f = Services.dirsvc.get(name, Ci.nsIFile); if (name === 'CurProcD') return f.parent.path; return f.path; }, getChromePath(sub) { const base = this.getPrefPath('UChrm'); return sub ? base + this.getSep() + sub : base; }, openPrefDir(name) { this.dirOpen(this.getPrefPath(name)); }, openURL(url) { try { openTrustedLinkIn(url, 'tab'); } catch (e) { try { gBrowser.addTrustedTab(url); } catch (e2) { openLinkIn(url, 'tab', { triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal() }); } } }, dirOpen(path) { if (this.vFileManager) { try { const fm = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsIFile); const pr = Cc['@mozilla.org/process/util;1'].createInstance(Ci.nsIProcess); fm.initWithPath(this.vFileManager); pr.init(fm); pr.run(false, [path], 1); return; } catch (e) { alert('Dateimanager konnte nicht gestartet werden:\n' + e); return; } } try { const f = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsIFile); f.initWithPath(path); if (f.exists()) f.launch(); else alert('Ordner nicht gefunden:\n' + path); } catch (e) { alert('Ordner konnte nicht geöffnet werden:\n' + e); } }, edit(mode, filename) { const sep = this.getSep(); // Pfad mit Unterordner, z.B. Scripte/test.uc.js if (/[\/]/.test(filename)) { this.launch(this.TextOpenExe, this.getChromePath(null) + sep + filename.replace(/[\/]/g, sep)); return; } let path = null; if (mode === 0) path = this.getChromePath(null) + sep + filename; else if (mode === 1) path = this.getPrefPath('ProfD') + sep + filename; else if (mode === 2) path = filename; else { const info = this.cssInfo(mode); if (!info) return; path = this.getChromePath(info[0]) + sep + filename; } this.launch(this.TextOpenExe, path); }, launch(editorPath, filePath) { try { const ed = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsIFile); const pr = Cc['@mozilla.org/process/util;1'].createInstance(Ci.nsIProcess); ed.initWithPath(editorPath); if (!ed.exists()) { try { editorPath = Services.prefs.getStringPref('view_source.editor.path'); } catch (e) { alert('Editor nicht gefunden und view_source.editor.path ist nicht gesetzt.'); return; } ed.initWithPath(editorPath); } if (!ed.exists()) { alert('Editor nicht gefunden:\n' + editorPath); return; } pr.init(ed); pr.run(false, [filePath], 1); } catch (e) { alert('Datei konnte nicht geöffnet werden:\n' + e); } }, loadCustomizableUI() { if (this.customUI) return true; try { const m = ChromeUtils.importESModule('moz-src:///browser/components/customizableui/CustomizableUI.sys.mjs'); if (!m || !m.CustomizableUI) throw new Error('CustomizableUI-Export nicht vorhanden.'); this.customUI = m.CustomizableUI; return true; } catch (e) { this.customUI = null; Cu.reportError('config_menu_pro.uc.js: CustomizableUI konnte nicht geladen werden.\n' + e); return false; } }, /* ====================================================================== * 7. Script- und CSS-Listen * ====================================================================== */ getScripts(type) { const scripts = []; this.collectScripts(Services.dirsvc.get('UChrm', Ci.nsIFile), '', scripts); if (this.jsSubfolder) { const sf = Services.dirsvc.get('UChrm', Ci.nsIFile); sf.append(this.jsSubfolder); this.collectScripts(sf, this.jsSubfolder, scripts); } if (type === 0) { this.fillMenu('submenu-ucjs', 'submenu-ucjs-items', 'Meine Scripte', scripts, 'uProfMenu_ucjs', 0); return; } const names = scripts.map(s => s.split(/[\/]/).pop()); try { Cc['@mozilla.org/widget/clipboardhelper;1'] .getService(Ci.nsIClipboardHelper) .copyString(this.fillClipboardValue(names)); } catch (e) { alert('Zwischenablage konnte nicht gesetzt werden:\n' + e); } }, collectScripts(folder, rel, out) { if (!folder.exists() || !folder.isDirectory()) return; const en = folder.directoryEntries; while (en.hasMoreElements()) { const f = en.getNext().QueryInterface(Ci.nsIFile); if (f.isFile() && /.uc.js$/i.test(f.leafName)) { out.push(rel ? rel + '/' + f.leafName : f.leafName); } } }, getCss(type) { const info = this.cssInfo(type); if (!info) return; const folder = Services.dirsvc.get('UChrm', Ci.nsIFile); folder.append(info[0]); const files = []; if (folder.exists() && folder.isDirectory()) { const en = folder.directoryEntries; while (en.hasMoreElements()) { const f = en.getNext().QueryInterface(Ci.nsIFile); if (f.isFile() && /.css$/i.test(f.leafName)) files.push(f.leafName); } } this.fillMenu(info[1], info[2], info[3], files, 'uProfMenu_css', type); }, fillMenu(subId, popId, label, files, cls, type) { const sub = document.getElementById(subId); const pop = document.getElementById(popId); if (!sub || !pop) return; sub.classList.add('count-menu'); sub.setAttribute('label', label); sub.setAttribute('tooltiptext', label + ': ' + files.length + ' Einträge'); const old = sub.querySelector('.uProfMenu-count'); if (old) old.remove(); const counter = document.createXULElement('label'); counter.setAttribute('value', '(' + files.length + ')'); counter.classList.add('uProfMenu-count', this.countClassFor(type)); sub.appendChild(counter); while (pop.firstChild) pop.firstChild.remove(); for (let i = files.length - 1; i >= 0; i--) { const fn = files[i]; const item = this.createME('menuitem', fn.split(/[\/]/).pop(), null, cls, null); if (type === 0) { item.setAttribute('tooltiptext', 'Linksklick: Bearbeiten'); item.addEventListener('command', () => uProfMenu.edit(0, fn), true); } else { item.addEventListener('command', () => uProfMenu.edit(type, fn), true); } pop.insertBefore(item, pop.firstChild); } }, fillClipboardValue(scripts) { const head = 'Meine Skripte (' + scripts.length + '):\n------------------------'; if (this.enableScriptsToClip === 1) return head + '\n' + scripts.join('\n'); return head + scripts.map((s, i) => '\n' + (i + 1) + '. ' + s).join(''); }, /* ====================================================================== * 8. Stil und Protokoll * ====================================================================== */ installStyle() { const css = ` #ExtraConfigMenu, #ExtraConfigMenu-button { list-style-image: url("file:///C:/FoxIcons/1206.png") !important; margin-right: 10px !important; margin-bottom: 2px !important; margin-top: 2px !important; } #ExtraConfigMenu-button > dropmarker, #ExtraConfigMenu-button > hbox > .toolbarbutton-menu-dropmarker, #ExtraConfigMenu-button > .toolbarbutton-menu-dropmarker { display: none !important; } #ExtraConfigMenu-popup > menu.count-menu { min-width: 260px !important; } #ExtraConfigMenu-popup .uProfMenu-count { color: #ff9800 !important; font-weight: 600 !important; font-size: 13px !important; margin-inline-start: auto !important; margin-inline-end: 10px !important; min-width: 32px !important; text-align: right !important; } #ExtraConfigMenu-popup .uProfMenu-count-scripts { color: #b4292a !important; } #ExtraConfigMenu-popup .uProfMenu-count-css { color: #336634 !important; } #ExtraConfigMenu-popup .uProfMenu-count-cssweb { color: #85467b !important; } #ExtraConfigMenu-popup .uProfMenu-count-cssshadow { color: #004d33 !important; } #ExtraConfigMenu-popup menu.count-menu .menu-text { flex: 1 1 auto !important; } #ExtraConfigMenu-popup menu.count-menu > label.uProfMenu-count { margin-left: auto !important; margin-right: 8px !important; } `; try { const sss = Cc['@mozilla.org/content/style-sheet-service;1'].getService(Ci.nsIStyleSheetService); const uri = Services.io.newURI('data:text/css;charset=UTF-8,' + encodeURIComponent(css)); if (!sss.sheetRegistered(uri, sss.AGENT_SHEET)) sss.loadAndRegisterSheet(uri, sss.AGENT_SHEET); } catch (e) { Cu.reportError('config_menu_pro.uc.js: CSS konnte nicht installiert werden:\n' + e); } }, log(msg) { if (typeof userChrome !== 'undefined' && typeof userChrome.log === 'function') { userChrome.log('config_menu_pro.uc.js: ' + msg); } else { try { console.log('config_menu_pro.uc.js: ' + msg); } catch (e) {} } } }; uProfMenu.init(); -