- Firefox-Version
- 82.0.2 (64-Bit)
- Betriebssystem
- Win 10 Pro
Hallo,
ich nutze folgendes Script
JavaScript
*********************************************************************************************** */
// ==UserScript==
// @include chrome://mozapps/content/downloads/unknownContentType.xhtml
// @charset UTF-8
// @version Fx78+
// ==/UserScript==
(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:\\xxx\\xxx\\2020', 'G:\\xxx\\xxx\\2020'],
['G:\\xxx\\xxx\\2020', 'G:\\xxx\\xxx\\2020']
];
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 =`
hbox.dialog-button-box button.dialog-button menupopup {
background:#25003e !important;
color:#00c8d7 !important;
}
hbox.dialog-button-box button.dialog-button menupopup menuitem.menuitem-iconic:hover{
background:#00c8d7 !important;
color:#25003e !important;
}
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.saveToDisk(file, 1);
dialog.mLauncher.saveDestinationAvailable(file);
dialog.onCancel = function() {};
close();
});
});
}
}());
Alles anzeigen
beim runterladen einer PDF Datei öffnet sich mein verknüftes Programm (PDF Chance) in windows obwohl ich nur Rrunterladen will aber nicht öffnen.
kann man das eventl im Script ?