- Firefox-Version
- 78.0.1
- Betriebssystem
- Windows 10
Hallo Zusammen,
meine 3x Skripte funktionieren nicht mehr, wenn ich auch .xul zu .xhtml ändern, auch nicht:
ContextTranslate.uc.js:
Code
(function () {
if (location != 'chrome://browser/content/browser.xul')
return;
let translate = function () {
let browserMM = gBrowser.selectedBrowser.messageManager;
browserMM.addMessageListener('getSelection', function listener(message) {
let t = (message.data !== '');
let e = (document.charset || document.characterSet);
if (t) {
openWebLinkIn('https://translate.google.com/#view=home&op=translate&sl=auto&tl=de&text=' + encodeURIComponent(message.data), 'tab');
} else {
openWebLinkIn('https://translate.google.com/translate?u=' + encodeURIComponent(gBrowser.currentURI.spec) + '&hl=de-DE&ie=' + e + '&sl=auto&tl=de-DE', 'tab');
};
browserMM.removeMessageListener('getSelection', listener, true);
});
browserMM.loadFrameScript('data:,sendAsyncMessage("getSelection", content.document.getSelection().toString())', true);
}
let menuitem = document.createElement('menuitem');
menuitem.id = 'context-googletranslate';
menuitem.setAttribute('label', 'Übersetzen');
menuitem.setAttribute('tooltiptext', 'Mit GoogleTranslate übersetzen');
menuitem.setAttribute('oncommand', '(' + translate.toString() + ')()');
menuitem.classList.add('menuitem-iconic');
//Wer kein Icon möchte kann die nächsten beiden Zeilen auskommentieren/löschen
//menuitem.style.listStyleImage = 'url("https://translate.google.com/favicon.ico")';
menuitem.style.listStyleImage = ' url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAwCAYAAABT9ym6AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAAZdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuMjHxIGmVAAAHYklEQVRoQ+2Y6U+UVxSH9Xs/NGnSv6et1h1REWOrUEaomiZt2tQqRQFFcNiRImg1rnVBbZUoorhRYNhGZweGfYcBoQ6bn0/Pue+9w7vcGRhpRz94kidDDHn5PZ5z7tyZFR/qfS4AWGkq9ZtiimZGY4vfQO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c/OST1bEPUUBhVUwVpKNEY5MdXrxwMglPaxu0tyvdEOhF9OPFHx/ZSvjh8SSNEkmkqTpht+Pndg+NFHXDy9CL6LtCIti5Mf7oyFZK5rNU0QlLw0toaaHvgHEv3B4cqTYUoY4oMmoR8aoXefS4ycQfHdmi8UozP4Ha2mawWFpQ5CW+Z9BuOHHJ6dsUHC8PSbUaUEvi7/uqHjXswUeuVJ78od7HWrHiXwQB769LvTEjAAAAAElFTkSuQmCC")';
let refItem = document.getElementById('context-inspect');
refItem.parentNode.insertBefore(menuitem, refItem);
})();
Alles anzeigen
printpreview.uc.js:
Code
(function() {
if (location != 'chrome://browser/content/browser.xul')
return;
try {
CustomizableUI.createWidget({
id: 'print-toolbarbutton',
type: 'custom',
defaultArea: CustomizableUI.AREA_NAVBAR,
onBuild: function(aDocument) {
var toolbaritem = aDocument.createElementNS('http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul', 'toolbarbutton');
var attrs = {
id: 'print-toolbarbutton',
class: 'toolbarbutton-1 chromeclass-toolbar-additional',
type: 'menu',
removable: true,
label: 'Drucken',
tooltiptext: 'Drucken'
};
for (var a in attrs)
toolbaritem.setAttribute(a, attrs[a]);
return toolbaritem;
}
});
} catch(e) { };
document.getElementById('home-button').parentNode.insertBefore(document.getElementById('print-toolbarbutton'), document.getElementById('home-button'));
var css = '\
#print-toolbarbutton {list-style-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAYCAYAAADkgu3FAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAAB6JQAAgIMAAPn/AACA6QAAdTAAAOpgAAA6mAAAF2+SX8VGAAAEEElEQVR42mL8//8/Az0AQACxkKJYSNmE30ZbMVRKRPgHsviBYxfv37hx/Cg+vQABxEiMjxRVLSyiIv3UXjx/aeLlYJTNyMjAhCx/9MyNHdz8Aktv3Lj979rlE2uuXLnyC90MgABiAFmED4tKaxvcunnr4r+/v/8Twr9//fxf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C+v73gGpd8c2L2L+85uwj/79BZbuP7/+KWmefB9dDiCAiGozXDu2+cHVo1sEGQmo+8/A+JOB6e8lbHIAAUSURYw/GV2Y2f8J/GMGVkB4a9r/7ALsLA+wyQEEECO9mlsAAQYAq1BA/vIVsYsAAAAASUVORK5CYII=)}\
#print-toolbarbutton > dropmarker {display: none}\
#print-toolbarbutton > image{min-height: 24px}\
#print-toolbarbutton > image{min-width: 26px}\
';
var stylesheet = document.createProcessingInstruction('xml-stylesheet', 'type="text/css" href="data:text/css;utf-8,' + encodeURIComponent(css) + '"');
document.insertBefore(stylesheet, document.documentElement);
var menu, menuitem, menuseparator, menupopup;
// menupopup of toolbarbutton
menupopup = document.createElement('menupopup');
menupopup.id = "print-button-popup";
document.getElementById('print-toolbarbutton').appendChild(menupopup);
menuitem = document.createElement('menuitem');
menuitem.setAttribute('label', "Drucken…");
menuitem.setAttribute('tooltiptext', "Drucken…");
menuitem.setAttribute('accesskey', "D");
menuitem.setAttribute('command', "cmd_print");
menupopup.appendChild(menuitem);
menuitem = document.createElement('menuitem');
menuitem.setAttribute('label', "Druckvorschau");
menuitem.setAttribute('tooltiptext', "Druckvorschau");
menuitem.setAttribute('accesskey', "v");
menuitem.setAttribute('oncommand', "PrintUtils.printPreview(PrintPreviewListener); event.stopPropagation()");
menupopup.appendChild(menuitem);
menuseparator = document.createElement('menuseparator');
menupopup.appendChild(menuseparator);
menuitem = document.createElement('menuitem');
menuitem.setAttribute('label', "Seite einrichten…");
menuitem.setAttribute('tooltiptext', "Seite einrichten…");
menuitem.setAttribute('accesskey', "e");
menuitem.setAttribute('command', "cmd_pageSetup");
menupopup.appendChild(menuitem);
// submenu of context menu
menu = document.createElement('menu');
menu.id = "context-print-menu";
menu.setAttribute('label', "Drucken…");
menu.setAttribute('accesskey', "D");
document.getElementById('contentAreaContextMenu')
.insertBefore(menu, document.getElementById('context-sep-viewbgimage').nextSibling);
menupopup = document.createElement('menupopup');
menu.appendChild(menupopup);
menuitem = document.createElement('menuitem');
menuitem.id = "context-print-menu-print";
menuitem.setAttribute('label', "Drucken…");
menuitem.setAttribute('accesskey', "D");
menuitem.setAttribute('command', "cmd_print");
menupopup.appendChild(menuitem);
menuitem = document.createElement('menuitem');
menuitem.id = "context-print-menu-preview";
menuitem.setAttribute('label', "Druckvorschau");
menuitem.setAttribute('accesskey', "v");
menuitem.setAttribute('oncommand', "PrintUtils.printPreview(PrintPreviewListener)");
menupopup.appendChild(menuitem);
menuseparator = document.createElement('menuseparator');
menupopup.appendChild(menuseparator);
menuitem = document.createElement('menuitem');
menuitem.id = "context-print-menu-printSetup";
menuitem.setAttribute('label', "Seite einrichten…");
menuitem.setAttribute('accesskey', "e");
menuitem.setAttribute('command', "cmd_pageSetup");
menupopup.appendChild(menuitem);
})();
Alles anzeigen
ExtendedCopy.uc.js:
Code
location == "chrome://browser/content/browser.xul" && (function () {
(function (m) {
m.id = "context-copyplain";
m.addEventListener("command", function () {
Components.classes["@mozilla.org/widget/clipboardhelper;1"].getService(Components.interfaces.nsIClipboardHelper).copyString(content.getSelection());
}, false);
m.setAttribute("label", "Nur Text kopieren");
})(document.getElementById("contentAreaContextMenu").insertBefore(document.createElement("menuitem"), document.getElementById("context-paste")));
(function (m) {
m.id = "context-copyHTML";
m.addEventListener("command", function () {
var div = content.document.createElement('div');
div.appendChild(content.getSelection().getRangeAt(0).cloneContents());
Components.classes["@mozilla.org/widget/clipboardhelper;1"].getService(Components.interfaces.nsIClipboardHelper).copyString(div.innerHTML);
}, false);
m.setAttribute("label", "Quellcode kopieren");
})(document.getElementById("contentAreaContextMenu").insertBefore(document.createElement("menuitem"), document.getElementById("context-paste")));
document.getElementById("contentAreaContextMenu").addEventListener("popupshowing", function () {
gContextMenu.showItem("context-copyplain", gContextMenu.isTextSelected);
gContextMenu.showItem("context-copyHTML", gContextMenu.isTextSelected);
}, false);
})()
Alles anzeigen
Kann jemand bitte helfen?
Mfg