Danke.
Du kannst den Code auch direkt in das Skript einfügen, wenn noch nicht gemacht.
JavaScript
(function() {
const Cu = Components.utils;
if (!window.FileUtils) Cu.import('resource://gre/modules/FileUtils.jsm');
if (!window.Services) Cu.import('resource://gre/modules/Services.jsm');
setTimeout(function() {
saveTo()
}, 200);
function saveTo() {
// Config
var dirArray = [
['G:\\Kontoauszug\\Sparkasse\\2023', 'G:\\Kontoauszug\\Sparkasse\\2023'] // ,
['G:\\Kontoauszug\\Volksbank\\2021', 'G:\\Kontoauszug\\Volksbank\\2023']
];
let button = document.getElementById("unknownContentType").getButton("cancel");
let saveTo = button.parentNode.insertBefore(document.createXULElement("button"), button);
var saveToMenu = saveTo.appendChild(document.createXULElement("menupopup"));
saveTo.classList.toggle("dialog-button");
saveTo.label = "Speichern nach";
saveTo.type = "menu";
var css =`
/* Hintergrund der einzelnen Button */
hbox.dialog-button-box button[label="Speichern nach"]{
appearance: none!important;
color: white !important;
background: dodgerblue !important;
border: 1px solid black !important;
border-radius: 7px !important;
padding-left: 4px !important;
padding-right: 4px !important;
padding-bottom: 3px !important;
}
hbox.dialog-button-box button[label="Speichern nach"]:hover {
color: white !important;
background: blue !important;
border: 1px solid red !important;
}
/* wenn Schriftfarbe anders für DropDown */
hbox.dialog-button-box button.dialog-button menupopup {
border-radius:4px !important;
background: #6200a4 !important;
color:#f9f9fa !important; /* Grey 10 */
}
hbox.dialog-button-box button.dialog-button menupopup menuitem.menuitem-iconic:hover {
background: #6200a4 !important; /* Purple 70 */
color: #ffe900 !important; /* Yellow 50 */
}
hbox.dialog-button-box button.dialog-button menupopup menuitem.menuitem-iconic hbox.menu-iconic-left {
padding-left:5px !important;
}
hbox.dialog-button-box button.dialog-button menupopup menuitem.menuitem-iconic label.menu-iconic-text{
font-weight: 700 !important;
padding:5px 10px 5px 5px !important;
}
`;
var sss = Cc['@mozilla.org/content/style-sheet-service;1'].getService(Ci.nsIStyleSheetService);
var uri = Services.io.newURI('data:text/css,' + encodeURIComponent(css))
sss.loadAndRegisterSheet(uri, sss.AGENT_SHEET);
dirArray.forEach(function(dir) {
var [name, dir] = [dir[1], dir[0]];
var mi = document.createXULElement("menuitem");
var item = saveToMenu.appendChild(mi);
item.setAttribute("label", (name || (dir.match(/[^\\/]+$/) || [dir])[0]));
item.setAttribute("image", "moz-icon:file:///" + dir + "\\");
item.setAttribute("class", "menuitem-iconic");
item.addEventListener("command", function() {
var file = new FileUtils.File(dir.replace(/\\/g, '\\\\') + '\\\\' + (document.getElementById('locationtext') ? document.getElementById('locationtext').value : document.getElementById('location').value));
dialog.mLauncher.saveDestinationAvailable(file);
dialog.onCancel = function() {};
close();
});
});
}
}());
Alles anzeigen