- Firefox-Version
- 142.0.1 (64-Bit)
- Betriebssystem
- Windows 10 Version 22H2 (Build 19044.6216)
Stelle hier mal meine Version des Appmenu.uc.js vor.
JavaScript
// ==UserScript==
// @name Appmenu.uc.js
// @namespace Appmenu@gmail.com
// @description Basiert auf dem Script externalFuncButtonM.uc.js, Wiederherstellung der Orangenen FF-Menü Schaltfläche
// @include main
// @version update for Firefox 68+ by aborix
// @author defpt
// @charset UTF-8
// @version 2020.07.13 Weitere Menüs und Funktionen ergänzt by bege
// @version 2024.08.10 alle Einstellungen im Abschnitt Konfiguration vornehmen
// @version 2024.08.18 einige Veränderungen am Skript, Symbole, Funktionen & Menüs by Mira Bellenbaum
// @version 2025.01.15 EventListener korrigiert und angepasst, by Mira Bellenbaum
// @version 2025.04.03 Zeile 340 "eval()" ersetzt. Nachfolgend Zeilen 381-416 ergänzt und Parameter (command:) angepasst
// @version 2025.07.21 Zeile 239 geändert! Button weiter nach rechts!
// ==/UserScript==
// Definiere den Profilpfad
let ProfilePath = PathUtils.toFileURI(
PathUtils.join(PathUtils.profileDir, 'chrome', 'icons')
);
var Appmenu = {
// ■■ START UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
// Editor mit angegebenem Pfad verwenden
// editor: 'C:\\Program Files\\Notepad++\\notepad++.exe',
editor: "C:\\Program Files\\Microsoft VS Code\\Code.exe",
// oder
// in 'view_source.editor.path' eingetragenen Editor verwenden
editor: Services.prefs.getCharPref('view_source.editor.path'),
// Dateimanager mit angegebenem Pfad verwenden oder leer ('') wenn System-Dateimanager verwenden
//fileManager: 'C:\\Program files\\FreeCommander XE\\FreeCommander.exe',
fileManager: "",
// Parameter für Dateimanager oder leer ('')
//FMParameter: '/T',
FMParameter: "",
// Submenüs ohne Inhalt im Hauptmenü automatisch ausblenden
autohideEmptySubDirs: true,
// Submenüs im Hauptmenü nach unten verschieben
moveSubDirstoBottom: false,
// Ort und Aussehen des Menü-Buttons einstellen
isUrlbar: 2, // 0: TabsToolbar; 1: navbar; 2: toolbar-menubar
isButton: 0, // 0: Hamburger,klein; 1: Firefox,groß,
// Hotkey zum Öffnen des Appmenüs oder leer ('')
hotkey: "f",
hotkeyModifier: "alt",
// ■■ END UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
// Submenüs im Hauptmenü nach unten verschieben
subdirPopupHash: [],
subdirMenuHash: [],
toolbar: {
// Submenüs des Hauptmenüs definieren; Separator einfügen mit {name: 'separator'}
subdirs: [
{
name: 'Firefox Verzeichnisse',
image: `${ProfilePath}/folder_currentColor.svg`, // Der Pfad wird direkt verwendet, ohne `url()`
},
{
name: 'Firefox Funktionen',
image: `${ProfilePath}/settings_currentColor.svg`, // Der Pfad wird direkt verwendet, ohne 'url()'
},
{
name: 'separator',
},
],
apps: [
// Untermenü Firefox Verzeichnisse
{
name: 'Profil-Verzeichniss',
id: 'AMProfil',
root: 'ProfD',
path: '\\',
subdir: 'Firefox Verzeichnisse',
},
{
name: 'Chrome-Ordner',
id: 'AMchrome',
root: 'ProfD',
path: '\\chrome',
subdir: 'Firefox Verzeichnisse',
},
{
name: 'CSS-Ordner',
id: 'AMCSS',
root: 'ProfD',
path: '\\chrome\\css',
subdir: 'Firefox Verzeichnisse',
},
{
name: 'JS-Ordner',
id: 'AMJS',
root: 'ProfD',
path: '\\chrome\\scripts',
subdir: 'Firefox Verzeichnisse',
},
{
name: 'Addon-Verzeichniss',
id: 'AMAddons',
root: 'ProfD',
path: '\\extensions',
subdir: 'Firefox Verzeichnisse',
},
{
name: 'Programm-Verzeichniss',
id: 'AMProgramm',
root: 'CurProcD',
path: '\\',
subdir: 'Firefox Verzeichnisse',
},
{
name: 'Startup-Cache',
id: 'AMCache',
root: 'ProfLD',
path: '\\startupCache',
subdir: 'Firefox Verzeichnisse',
},
],
configs: [
// Untermenü Firefox Funktionen
{
name: 'Anpassen',
id: 'AMAnpassen',
command: 'gCustomizeMode.enter()',
subdir: 'Firefox Funktionen',
},
{
name: 'Neustart im abgesicherten Modus',
id: 'AMModus',
command: 'safeModeRestart();',
subdir: 'Firefox Funktionen',
},
{
name: 'Browser-Konsole',
id: 'AMKonsole',
command: 'goKonsole',
subdir: 'Firefox Funktionen',
},
{
name: 'Browser-Werkzeuge',
id: 'AMWerkzeuge',
command: 'goWerkzeuge',
subdir: 'Firefox Funktionen',
},
{
name: 'Web-Entwickler',
id: 'AMEntwickler',
command: 'goEntwickler',
subdir: 'Firefox Funktionen',
},
{
name: 'Firefox synchronisieren',
id: 'AMsynchron',
command: 'gSync',
subdir: 'Firefox Funktione',
},
{
name: 'Zugangsdaten und Passwörter',
id: 'AMdaten',
command:
'LoginHelper.openPasswordManager(window, { entryPoint: "mainmenu" })',
tooltiptext: 'about:logins',
subdir: 'Firefox Funktionen',
},
{
name: 'Task Manager',
id: 'AMManager',
command: 'switchToTabHavingURI("about:processes", true)',
tooltiptext: 'about:processes',
subdir: 'Firefox Funktionen',
},
{
name: 'Offline arbeiten',
id: 'AMOffline',
command: 'BrowserOffline.toggleOfflineStatus();',
subdir: 'Firefox Funktionen',
},
/*
{
name: 'separator',
},
*/
{
name: 'Neustart',
id: 'AMreboot',
tooltiptext: 'userChrome.js-Cache wird geleert',
command: 'goReeboot',
},
{
name: 'Beenden',
id: 'AMquit',
command: 'goQuitApplication(event);',
},
]
},
_externalAppPopup: null,
_isready: false,
init: function() {
this.handleRelativePath(this.toolbar.apps);
const XULNS = 'http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul';
var ExternalAppBtn = document.createElementNS(XULNS, 'toolbarbutton');
ExternalAppBtn.id = 'AppMenuButton';
ExternalAppBtn.setAttribute('label', 'AppButton');
ExternalAppBtn.addEventListener('click', event => {
event.preventDefault();
event.stopPropagation();
});
ExternalAppBtn.setAttribute('tooltiptext', 'Firefox Menü');
ExternalAppBtn.setAttribute('type', 'menu');
ExternalAppBtn.setAttribute('removable', 'true');
// Definiere den Profilpfad
let ProfilePath = PathUtils.toFileURI(
PathUtils.join(PathUtils.profileDir, 'chrome', 'image')
);
// Symbole
let DefaultIcon = 'Button_groß.png';
let AlternateIcon = 'Button_klein-5.png';
// Wenn Appmenu.isButton true ist, benutze das große Symbol, sonst das kleine
if (Appmenu.isButton) {
ExternalAppBtn.style.listStyleImage = `url('${ProfilePath}/${DefaultIcon}')`; // Großes Symbol
ExternalAppBtn.style.width = '94px'; // Feste Breite für großes Symbol
ExternalAppBtn.style.height = '24px'; // Feste Höhe für großes Symbol
} else {
ExternalAppBtn.style.listStyleImage = `url('${ProfilePath}/${AlternateIcon}')`; // Kleines Symbol
//ExternalAppBtn.style.width = "16px"; // Feste Breite für kleines Symbol
//ExternalAppBtn.style.width = '26px';
ExternalAppBtn.style.width = '50px';
ExternalAppBtn.style.height = '21px'; // Feste Höhe für kleines Symbol
}
// Button in die richtige Toolbar einfügen
if (Appmenu.isUrlbar === 1) {
var navBar = document.getElementById('nav-bar-customization-target');
navBar.insertBefore(ExternalAppBtn, navBar.firstChild);
} else if (Appmenu.isUrlbar === 2) {
var menubar = document.getElementById('toolbar-menubar');
menubar.insertBefore(ExternalAppBtn, menubar.firstChild);
} else {
var TabsToolbar = document.getElementById('TabsToolbar');
TabsToolbar.insertBefore(ExternalAppBtn, TabsToolbar.firstChild);
}
var ExternalAppPopup = document.createElementNS(XULNS, 'menupopup');
ExternalAppPopup.addEventListener('click', event => {
event.stopPropagation();
});
ExternalAppPopup.setAttribute('id', 'AMpopup');
this._externalAppPopup = ExternalAppPopup;
ExternalAppBtn.appendChild(ExternalAppPopup);
Appmenu.onpopupshowing();
// Menü mit Tastaturkürzel öffnen
if (Appmenu.hotkey) {
let key = document.createXULElement('key');
key.id = 'key_AppMenuPopup';
key.setAttribute('key', Appmenu.hotkey);
if (Appmenu.hotkeyModifier)
key.setAttribute('modifiers', Appmenu.hotkeyModifier);
key.addEventListener('command', function () {
document.getElementById('AMpopup').openPopup();
});
document.getElementById('mainKeyset').appendChild(key);
}
},
onpopupshowing: function() {
if (this._isready) return;
if (this._externalAppPopup === null) return;
var ExternalAppPopup = this._externalAppPopup;
// Verarbeitung der Subdirs
for (let subdir of this.toolbar.subdirs) {
if (subdir.name == 'separator') {
ExternalAppPopup.appendChild(document.createXULElement('menuseparator'));
} else {
var subdirItem = ExternalAppPopup.appendChild(document.createXULElement('menu'));
var subdirItemPopup = subdirItem.appendChild(document.createXULElement('menupopup'));
subdirItem.setAttribute('class', 'menu-iconic');
subdirItem.setAttribute('label', subdir.name);
subdirItem.setAttribute('image', subdir.image);
Appmenu.subdirPopupHash[subdir.name] = subdirItemPopup;
Appmenu.subdirMenuHash[subdir.name] = subdirItem;
}
}
// Verarbeitung der Apps
for (let app of this.toolbar.apps) {
var appItem;
if (app.name == 'separator') {
appItem = document.createXULElement('menuseparator');
} else {
appItem = document.createXULElement('menuitem');
appItem.setAttribute('class', 'menuitem-iconic');
appItem.setAttribute('label', app.name);
appItem.setAttribute('image', app.image);
appItem.addEventListener('command', function () {
Appmenu.exec(this.path, this.args);
});
appItem.setAttribute('tooltiptext', app.name);
appItem.path = app.path;
appItem.args = app.args;
}
if (app.subdir && Appmenu.subdirPopupHash[app.subdir])
Appmenu.subdirPopupHash[app.subdir].appendChild(appItem);
else ExternalAppPopup.appendChild(appItem);
}
// Verarbeitung der Configs
for (let config of this.toolbar.configs) {
var configItem;
if (config.name == 'separator') {
configItem = document.createXULElement('menuseparator');
} else {
configItem = ExternalAppPopup.appendChild(document.createXULElement('menuitem'));
configItem.setAttribute('class', 'menuitem-iconic');
configItem.setAttribute('label', config.name);
configItem.setAttribute('image', config.image);
configItem.addEventListener('command', () => {
Appmenu.executeCommand(config.command);
});
if (config.tooltiptext) {
configItem.setAttribute('tooltiptext', config.tooltiptext);
} else {
configItem.setAttribute('tooltiptext', config.name);
}
configItem.setAttribute('id', config.id);
}
if (config.subdir && Appmenu.subdirPopupHash[config.subdir]) {
Appmenu.subdirPopupHash[config.subdir].appendChild(configItem);
} else {
ExternalAppPopup.appendChild(configItem);
}
}
if (this.autohideEmptySubDirs) {
for (let i = 0; i < Appmenu.subdirPopupHash.length; i++) {
if (Appmenu.subdirPopupHash[i].hasChildNodes()) {
continue;
} else {
Appmenu.subdirMenuHash[i].setAttribute('hidden', 'true');
}
}
}
if (this.moveSubDirstoBottom) {
let i = ExternalAppPopup.childNodes.length;
while (ExternalAppPopup.firstChild.getAttribute('class') != 'menuitem-iconic' && i-- != 0) {
ExternalAppPopup.appendChild(ExternalAppPopup.firstChild);
}
}
this._isready = true;
},
executeCommand: function(command) {
const commandMap = {
'gCustomizeMode.enter()': () => gCustomizeMode.enter(),
'safeModeRestart();': () => safeModeRestart(),
'goKonsole': () => {
var { require } = ChromeUtils.importESModule('resource://devtools/shared/loader/Loader.sys.mjs', {});
var { BrowserConsoleManager } = require('resource://devtools/client/webconsole/browser-console-manager');
BrowserConsoleManager.openBrowserConsoleOrFocus();
},
'goWerkzeuge': () => {
var { require } = ChromeUtils.importESModule('resource://devtools/shared/loader/Loader.sys.mjs', {});
var { BrowserToolboxLauncher } = require('resource://devtools/client/framework/browser-toolbox/Launcher.sys.mjs');
BrowserToolboxLauncher.init();
},
'goEntwickler': () => {
var { require } = ChromeUtils.importESModule('resource://devtools/shared/loader/Loader.sys.mjs', {});
var { gDevToolsBrowser } = require('resource://devtools/client/framework/devtools-browser');
gDevToolsBrowser.toggleToolboxCommand(window.gBrowser, Cu.now());
},
'gSync': () => gSync.openPrefs('menubar'),
'LoginHelper.openPasswordManager(window, { entryPoint: "mainmenu" })': () => LoginHelper.openPasswordManager(window, { entryPoint: 'mainmenu' }),
'switchToTabHavingURI("about:processes", true)': () => switchToTabHavingURI('about:processes', true),
'BrowserOffline.toggleOfflineStatus();': () => BrowserOffline.toggleOfflineStatus(),
'goReeboot': () => {
Services.appinfo.invalidateCachesOnRestart();
Services.startup.quit(Ci.nsIAppStartup.eRestart | Ci.nsIAppStartup.eAttemptQuit);
},
'goQuitApplication(event);': () => goQuitApplication(event),
};
if (commandMap[command]) {
commandMap[command]();
} else {
console.warn('Unbekannter Befehl: ', command);
}
},
handleRelativePath: function(apps) {
for (let app of apps) {
if (app.path) {
app.path = app.path.replace(/\//g, '\\');
var ffdir = Cc['@mozilla.org/file/directory_service;1'].getService(Ci.nsIProperties).get(app.root, Ci.nsIFile).path;
if (/^(\\)/.test(app.path)) {
app.path = ffdir + app.path;
}
}
}
},
exec: function(path, args) {
args = args || [];
var args_t = args.slice(0);
for (let arg of args_t) {
arg = arg.replace(/%u/g, gBrowser.currentURI.spec);
}
var file = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsIFile);
file.initWithPath(path);
if (!file.exists()) {
alert('Datei nicht gefunden: ' + path);
return;
}
if (file.isExecutable() && !path.endsWith('.js')) {
var process = Cc['@mozilla.org/process/util;1'].createInstance(Ci.nsIProcess);
process.init(file);
process.run(false, args_t, args_t.length);
} else if (file.isFile()) {
if (this.editor) {
let UI = Cc['@mozilla.org/intl/scriptableunicodeconverter'].createInstance(Ci.nsIScriptableUnicodeConverter);
UI.charset = window.navigator.platform.toLowerCase().includes('win') ? 'Shift_JIS' : 'UTF-8';
let path = UI.ConvertFromUnicode(file.path);
let app = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsIFile);
app.initWithPath(this.editor);
let process = Cc['@mozilla.org/process/util;1'].createInstance(Ci.nsIProcess);
process.init(app);
process.run(false, [path], 1);
} else {
file.launch();
}
} else if (file.isDirectory()) {
if (this.fileManager) {
let args=[this.FMParameter,path];
let app = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsIFile);
app.initWithPath(this.fileManager);
let process = Cc['@mozilla.org/process/util;1'].createInstance(Ci.nsIProcess);
process.init(app);
process.run(false, args, args.length);
} else {
file.launch();
}
}
},
};
(function () {
// Definiere den Profilpfad für die Symbole
let ProfilePath = PathUtils.toFileURI(
PathUtils.join(PathUtils.profileDir, 'chrome', 'icons')
);
// Standard-Symbol-Dateiname
let ButtonIcon01 = 'restart.svg';
let ButtonIcon02 = 'quit.svg';
let Icon01 = 'profile.svg';
let Icon02 = 'chrome.svg';
let Icon03 = 'css4.svg';
let Icon04 = 'js.svg';
let Icon05 = 'addons.svg';
let Icon06 = 'folder.svg';
let Icon07 = 'folder-1.svg';
let Icon11 = 'Themes.svg';
let Icon12 = 'debugging-workers.svg';
let Icon13 = 'command-console.svg';
let Icon14 = 'window-dev-tools.svg';
let Icon15 = 'developer.svg';
let Icon16 = 'sync.svg';
let Icon17 = 'passwords.svg';
let Icon18 = 'performance.svg';
let Icon19 = 'plug-disconnected.svg';
// StyleSheetService zum Hinzufügen der CSS-Regeln
let sss = Components.classes['@mozilla.org/content/style-sheet-service;1'].getService(Components.interfaces.nsIStyleSheetService);
let uri = Services.io.newURI(
'data:text/css;charset=utf-8,' +
encodeURIComponent(`
#AMpopup { margin-left: 8px !important; }
menuitem[label='Profil-Verzeichniss'] { background-image: url('${ProfilePath}/${Icon01}');
background-repeat: no-repeat !important;
background-position: 11px 3px !important;
background-size: 16px 16px !important; /* Größe des Symbols anpassen */
-moz-context-properties: fill, fill-opacity;
fill: currentColor;
}
menuitem[label='Chrome-Ordner'] { background-image: url('${ProfilePath}/${Icon02}');
background-repeat: no-repeat !important;
background-position: 11px 3px !important;
background-size: 16px 16px !important; /* Größe des Symbols anpassen */
-moz-context-properties: fill, fill-opacity;
fill: currentColor;
}
menuitem[label='CSS-Ordner'] { background-image: url('${ProfilePath}/${Icon03}');
background-repeat: no-repeat !important;
background-position: 11px 3px !important;
background-size: 16px 16px !important; /* Größe des Symbols anpassen */
-moz-context-properties: fill, fill-opacity;
fill: currentColor;
}
menuitem[label='JS-Ordner'] { background-image: url('${ProfilePath}/${Icon04}');
background-repeat: no-repeat !important;
background-position: 11px 3px !important;
background-size: 16px 16px !important; /* Größe des Symbols anpassen */
-moz-context-properties: fill, fill-opacity;
fill: currentColor;
}
menuitem[label='Addon-Verzeichniss'] { background-image: url('${ProfilePath}/${Icon05}');
background-repeat: no-repeat !important;
background-position: 11px 3px !important;
background-size: 16px 16pxx !important; /* Größe des Symbols anpassen */
-moz-context-properties: fill, fill-opacity;
fill: currentColor;
}
menuitem[label='Programm-Verzeichniss'] { background-image: url('${ProfilePath}/${Icon06}');
background-repeat: no-repeat !important;
background-position: 11px 3px !important;
background-size: 16px 16px !important; /* Größe des Symbols anpassen */
-moz-context-properties: fill, fill-opacity;
fill: currentColor;
}
menuitem[label='Startup-Cache'] { background-image: url('${ProfilePath}/${Icon07}');
background-repeat: no-repeat !important;
background-position: 11px 3px !important;
background-size: 16px 16px !important; /* Größe des Symbols anpassen */
-moz-context-properties: fill, fill-opacity;
fill: currentColor;
}
#AMAnpassen { background-image: url('${ProfilePath}/${Icon11}');
background-repeat: no-repeat !important;
background-position: 11px 3px !important;
background-size: 16px 16px !important;
-moz-context-properties: fill, fill-opacity;
fill: currentColor;
}
#AMModus { background-image: url('${ProfilePath}/${Icon12}');
background-repeat: no-repeat !important;
background-position: 11px 3px !important;
background-size: 16px 16px !important;
-moz-context-properties: fill, fill-opacity;
fill: currentColor;
}
#AMKonsole { background-image: url('${ProfilePath}/${Icon13}');
background-repeat: no-repeat !important;
background-position: 11px 3px !important;
background-size: 16px 16px !important;
-moz-context-properties: fill, fill-opacity;
fill: currentColor;
}
#AMWerkzeuge { background-image: url('${ProfilePath}/${Icon14}');
background-repeat: no-repeat !important;
background-position: 11px 3px !important;
background-size: 16px 16px !important;
-moz-context-properties: fill, fill-opacity;
fill: currentColor;
}
#AMEntwickler { background-image: url('${ProfilePath}/${Icon15}');
background-repeat: no-repeat !important;
background-position: 11px 3px !important;
background-size: 16px 16px !important;
-moz-context-properties: fill, fill-opacity;
fill: currentColor;
}
#AMsynchron { background-image: url('${ProfilePath}/${Icon16}');
background-repeat: no-repeat !important;
background-position: 11px 3px !important;
background-size: 16px 16px !important;
-moz-context-properties: fill, fill-opacity;
fill: currentColor;
}
#AMdaten { background-image: url('${ProfilePath}/${Icon17}');
background-repeat: no-repeat !important;
background-position: 11px 3px !important;
background-size: 16px 16px !important;
-moz-context-properties: fill, fill-opacity;
fill: currentColor;
}
#AMManager { background-image: url('${ProfilePath}/${Icon18}');
background-repeat: no-repeat !important;
background-position: 11px 3px !important;
background-size: 16px 16px !important;
-moz-context-properties: fill, fill-opacity;
fill: currentColor;
}
#AMOffline { background-image: url('${ProfilePath}/${Icon19}');
background-repeat: no-repeat !important;
background-position: 11px 3px !important;
background-size: 16px 16px !important;
-moz-context-properties: fill, fill-opacity;
fill: currentColor;
}
/* Neustart-Button */
#AMreboot {
background-image: url('${ProfilePath}/${ButtonIcon01}');
background-repeat: no-repeat !important;
background-position: 10px 2px !important;
background-size: 20px 20px !important; /* Größe des Symbols anpassen */
padding-left: 10px !important; /* Platz für das Symbol lassen */
-moz-context-properties: fill, fill-opacity !important;
fill: #fbc96e !important;
}
/* Beenden-Button */
#AMquit {
background-image: url('${ProfilePath}/${ButtonIcon02}');
background-repeat: no-repeat !important;
background-position: 12px 3px !important;
background-size: 16px 16px !important; /* Größe des Symbols anpassen */
padding-left: 10px !important; /* Platz für das Symbol lassen */
-moz-context-properties: fill, fill-opacity !important;
fill: red !important;
}
`),
null,
null
);
// CSS-Regeln registrieren
sss.loadAndRegisterSheet(uri, sss.AUTHOR_SHEET);
})();
if (window.gBrowser) Appmenu.init();
Alles anzeigen