TB: 115.5.0
BS: Win11
Hab eben mal Lust gehabt, ein Script von meinem FF für TB umzubasteln:
JavaScript
// 19_TB_ugs-menu.uc.js
//
// basiert auf: External-Aplication.uc.js
// Herkunft:
// https://github.com/ardiman/userChrome.js/tree/master/externalapplications
//
// CFF-Herkunft: https://www.camp-firefox.de/forum/thema/126871 #13
//
// 231125: @harff182: will "ugs-Menu" im TB haben
//var currentProfileDirectory = Services.dirsvc.get("ProfD", Ci.nsIFile).path;
var TBProfDir = Services.dirsvc.get("ProfD", Ci.nsIFile).path;
var ugsmenu = {
type: 'menu',
insertafter: 'helpMenu',
apps: [
{name: 'this menu', path: TBProfDir + '/chrome/ugs_js/19_TB_ugs-menu.uc.js'},
{name: 'separator'},
{name: 'Icon-Dir', path: TBProfDir + '/chrome/icons'},
{name: 'CSS-Dir', path: TBProfDir + '/chrome/ugs_css'},
{name: 'JS-Dir', path: TBProfDir + '/chrome/ugs_js'},
{name: 'Thunderbird_wissen', path: 'D:\\___Stickware\\comm\\TB-Wissen'},
{name: 'separator'},
{name: 'FF-LeistenBezeichnungen', path: 'D:\\___Stickware\\comm\\FirefoxPortable_wissen\\FF_LeistenBezeichnungen in Firefox.png'},
{name: 'FF-wichtig', path: 'D:\\___Stickware\\comm\\FirefoxPortable_wissen\\0_wichtig.txt'},
{name: 'Html-Farben', path: 'D:\\___Stickware\\comm\\FirefoxPortable_wissen\\html-farben (10.11.2023 14_54_29).html'},
{name: 'TB-Tastatur', path: 'D:\\___Stickware\\comm\\TB-Wissen\\TB-Tastatur.url'},
],
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 (this.type == 'menu') {
var mainmenu = document.getElementById('mail-menubar');
var menu = mainmenu.appendChild(document.createXULElement('menu'));
menu.setAttribute('label', 'ugs-menu');
menu.setAttribute('accesskey', 'u');
menu.setAttribute('id', 'ugsmenu');
var menupopup = menu.appendChild(document.createXULElement('menupopup'));
for (var i=0; i<this.apps.length; i++) {
menupopup.appendChild(this.createMenuitem(this.apps[i]));
}
}
else {
var menubarItems = document.getElementById(this.insertafter);
var toolbaritem = menubarItems.parentNode.insertBefore(document.createXULElement('toolbaritem'), menubarItems.nextSibling);
toolbaritem.id = 'ExtAppButtons';
toolbaritem.setAttribute("class", "chromeclass-toolbar-additional");
toolbaritem.setAttribute("orient", "horizontal");
for (var i=0; i<this.apps.length; i++) {
toolbaritem.appendChild(this.createButton(this.apps[i]));
}
}
},
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);
}
},
createButton: function(app) {
if (app.name == 'separator')
return document.createXULElement('toolbarseparator');
var item = document.createXULElement('toolbarbutton');
item.setAttribute('class', 'toolbarbutton-1 chromeclass-toolbar-additional');
item.setAttribute('label', app.name);
item.setAttribute('image', 'moz-icon:file:///' + app.path + '?size=16');
item.setAttribute('oncommand', 'ugsmenu.exec(this.path, this.args);');
// item.setAttribute('tooltiptext', app.name);
item.path = app.path;
item.args = app.args;
return item;
},
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:///' + app.path + '?size=16');
item.setAttribute('oncommand', 'ugsmenu.exec(this.path, this.args);');
item.setAttribute('tooltiptext', app.name);
item.path = app.path;
item.args = app.args;
return item;
}
};
ugsmenu.init();
Alles anzeigen
Es ist bestimmt nicht perfekt und mag den ein oder anderen Fehler beinhalten, aber vielleicht interessierts ja den ein oder anderen von Euch...
Guuts nächtle...