FuchsFan Soooo, verschiebbar und mit Symbol.
JavaScript
// ==UserScript==
// @name XP - Spider.uc.js
// @namespace ithinc#mozine.cn
// @description External Applications
// @include main
// @compatibility Firefox 143.x
// @author ithinc
// @version 20250803 Edited by: Mira
// ==/UserScript==
/* :::: External Applications :::: */
var gExternalApplications = {
type: 'menu', //'menu' or 'button'
insertafter: '',
apps: [
{name: 'Download Firefox', path: 'D:\\Download Firefox'},
{name: 'Ordner Screenshots', path: 'C:\\Users\\Old Man\\Pictures\\Screenshots'},
{name: 'Windows Explorer', path: 'C:\\Windows\\explorer.exe'},
{name: 'Editor', path: 'C:\\Windows\\System32\\notepad.exe'},
{name: 'Ordner Dokumente', path: 'C:\\Users\\Old Man\\Documents'},
{name: 'notepad++', path: 'C:\\notepad++\\notepad++.exe'},
{name: 'Rechner', path: 'C:\\WINDOWS\\system32\\calc.exe'},
{name: 'Ordner Backup ArbeitsFox', path: 'E:\\BackupFirefox\\ArbeitsFox '},
{name: 'Ordner BackupFirefox', path: 'E:\\BackupFirefox'},
{name: 'Ordner ArchiveFirefox', path: 'G:\\ArchiveFirefox'},
{name: 'Firefox Beta 3', path: 'G:\\Portable.Firefox.Updater.3\\Firefox Beta x64 Launcher.exe'},
{name: 'Firefox Nightly 3', path: 'G:\\Portable.Firefox.Updater.3\\Firefox Nightly x64 Launcher.exe'},
{name: 'Firefox Stable 3', path: 'G:\\Portable.Firefox.Updater.3\\Firefox Stable x64 Launcher.exe'},
{name: 'Ordner Portable.Firefox.Updater.1', path: 'G:\\Portable.Firefox.Updater.1'},
{name: 'Ordner Portable.Firefox.Updater.2', path: 'G:\\Portable.Firefox.Updater.2'},
{name: 'Ordner Portable.Firefox.Updater.3', path: 'G:\\Portable.Firefox.Updater.3'},
{name: 'Ordner Portable.Firefox.Updater.4', path: 'G:\\Portable.Firefox.Updater.4'},
{name: 'Portable Start', path: 'G:\\Starter'},
{name: 'Ordner FoxIcons', path: 'C:\\FoxIcons'},
{name: 'Ordner FoxIcons2', path: 'C:\\FoxIcons2'},
{name: 'Installationsordner', path: 'C:\\Program Files\\Mozilla Firefox'},
],
init: function() {
for (var i = 0; i < this.apps.length; i++) {
if (!this.apps[i].path) continue;
if (!this.apps[i].args) this.apps[i].args = [];
this.apps[i].path = this.apps[i].path.replace(/\//g, '\\');
var ffdir = Cc['@mozilla.org/file/directory_service;1'].getService(Ci.nsIProperties).get('CurProcD', Ci.nsIFile).path;
if (/^(\\)/.test(this.apps[i].path)) {
this.apps[i].path = ffdir.substr(0, 2) + this.apps[i].path;
} else if (/^(\.)/.test(this.apps[i].path)) {
this.apps[i].path = ffdir + '\\' + this.apps[i].path;
}
}
if (location.href !== 'chrome://browser/content/browser.xhtml') return;
if (this.type == 'menu') {
var mainmenu = document.getElementById('nav-bar');
var menu = mainmenu.appendChild(document.createXULElement('menu'));
menu.setAttribute('label', 'Start');
menu.setAttribute('accesskey', 'a');
var menupopup = menu.appendChild(document.createXULElement('menupopup'));
for (var i = 0; i < this.apps.length; i++) {
menupopup.appendChild(this.createMenuitem(this.apps[i]));
}
} else {
if (!CustomizableUI.getPlacementOfWidget('ExtAppButton')) {
try {
CustomizableUI.createWidget({
id: 'ExtAppButton',
type: 'custom',
defaultArea: CustomizableUI.AREA_NAVBAR,
onBuild: function(aDocument) {
let toolbarbutton = aDocument.createElementNS('http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul', 'toolbarbutton');
toolbarbutton.id = 'ExtAppButton';
toolbarbutton.setAttribute('label', 'Start');
toolbarbutton.setAttribute('class', 'toolbarbutton-1 chromeclass-toolbar-additional');
toolbarbutton.setAttribute('type', 'menu');
let menupopup = toolbarbutton.appendChild(aDocument.createElementNS('http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul', 'menupopup'));
for (var i = 0; i < gExternalApplications.apps.length; i++) {
menupopup.appendChild(gExternalApplications.createMenuitem(gExternalApplications.apps[i]));
}
return toolbarbutton;
}
});
} catch(e) {
console.error(e);
return;
};
let ProfilePath = PathUtils.toFileURI(PathUtils.join(PathUtils.profileDir, 'chrome', 'icons')); // Pfad zum Profilordner und gleich in den entsprechenden Unterordner
let ButtonIcon = "default-browser-red.svg"; // Name & Dateiendung des anzuzeigenden Symbols!
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(`
#ExtAppButton { list-style-image: url("${ProfilePath}/${ButtonIcon}") }
#ExtAppButton.toolbarbutton-1.chromeclass-toolbar-additional image.toolbarbutton-icon {
width: 28px !important;
height: 28px !important;
fill: #83ee1a !important;
fill-opacity: 1 !important;
}
`), null, null);
sss.loadAndRegisterSheet(uri, sss.AUTHOR_SHEET);
}
}
},
exec: function(path, args) {
for (var i = 0; i < args.length; i++) {
args[i] = args[i].replace(/%u/g, gBrowser.currentURI.spec);
}
var file = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsIFile);
file.initWithPath(path);
if (!file.exists()) {
throw 'File Not Found: ' + path;
}
if (!file.isExecutable() || args.length == 0) {
file.launch();
} else {
var process = Cc['@mozilla.org/process/util;1'].getService(Ci.nsIProcess);
process.init(file);
process.run(false, args, args.length);
}
},
createMenuitem: function(app) {
if (app.name == 'separator')
return document.createXULElement('menuseparator');
var item = document.createXULElement('menuitem');
item.setAttribute('class', 'menuitem-iconic');
item.setAttribute('label', app.name);
item.setAttribute('image', 'moz-icon:file:///' + encodeURIComponent(app.path) + '?size=16');
item.addEventListener('command', function(event) {
if (event.button == 0) {
gExternalApplications.exec(this.path, this.args);
}
});
item.path = app.path;
item.args = app.args;
return item;
}
};
gExternalApplications.init();
Alles anzeigen
Symbol kann ausgetauscht werden und der Pfad dahin sollte auch angepasst werden.
Und putzen müsste man auch mal!