Welchen Befehl müßte man in dieses Script einfügen, um die angezeigte Seite neu zu laden (wahlweise unter Umgehung des Caches)? Es schaltet die Bilderanzeige um.
Code
// ImageToggle.uc.js
(function() {
if (location != 'chrome://browser/content/browser.xul')
return;
try {
CustomizableUI.createWidget({
id: 'toolbar-button-img',
type: 'custom',
defaultArea: CustomizableUI.AREA_NAVBAR,
onBuild: function(aDocument) {
var button = aDocument.createElementNS('http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul', 'toolbarbutton');
var attributes = {
id: 'toolbar-button-img',
class: 'toolbarbutton-1 chromeclass-toolbar-additional',
removable: 'true',
label: 'Bilder ein-/ausschalten',
tooltiptext: (Services.prefs.getIntPref('permissions.default.image')==1) ?
'Bilder sind eingeschaltet' : 'Bilder sind ausgeschaltet',
oncommand: '(' + onCommand.toString() + ')()'
};
for (var a in attributes) {
button.setAttribute(a, attributes[a]);
};
function onCommand() {
var isEnabled = Services.prefs.getIntPref('permissions.default.image') ^ 3;
Services.prefs.setIntPref('permissions.default.image', isEnabled);
var windows = Services.wm.getEnumerator('navigator:browser');
while (windows.hasMoreElements()) {
let button = windows.getNext().document.getElementById('toolbar-button-img');
if (isEnabled==1)
button.setAttribute('tooltiptext', 'Bilder sind eingeschaltet')
else
button.setAttribute('tooltiptext', 'Bilder sind ausgeschaltet');
};
};
return button;
}
});
} catch(e) { };
var css =
'#toolbar-button-img[tooltiptext="Bilder sind eingeschaltet"] {list-style-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABbklEQVQ4jdXUsUuVURjH8Y9OgdAkUUmDFhWBS4ENLTno0tIqOEoaXlJoElwSpFlpcmvoH2gKd1HwkqBDWwaVpGQKcfGKWQ7nefHt4n17L7j0g2d5z+98Oef3POflf9YdrOCgoVZirSXdxCr+NKnV8DTVIMbwNGq5AJbVcs4/FgwwgVoJwL+qhmfw5RxgWX2GwwLDLmZwD3fxAt8L/HVS585a3MnnEurAywLgQTPgb7xqgHXjbfirWMJGWWAdQznYJbzHJwzjYny/jAq2ywCHc8CFyPN2w6nb0IXH+IFfRRkuxKZObGG6AdYeng/oxevY1xS4LzXlvtTZW3gY2fVjLnxVqVnj2ZWLxuYb3gXwGkakhtVjfQ034sSj0nCXGuxjPIqNzwO6juu5COakpqngZwnoYm7zZOSW6WrcZjb7MOD0oZ9VUziKU1zwt7I/0yauaEFPpOyq0muZkIb/I77iQSuwTH14I2W1F7B59GSGE0Hn2GFuKJeRAAAAAElFTkSuQmCC");}' +
'#toolbar-button-img[tooltiptext="Bilder sind ausgeschaltet"] {list-style-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABcElEQVQ4jdXUvUtWYRjH8Q84BLlFFOEgiUQILQY5OCf+AyqCS4sohIkE4Zgguonl5N4gODnp6CCPoNTQnAqpWPhShKnl23Bfhx7U53SEln5wccN9/e4vXC/n8D+rAYs4uBCLkbuWHmAJZxViKTwV1YIe9EaUcmBZlMr8PcEAL7BfAPC32EcfrP8DWBaf4SjHsIMhPEYjXmM7x39ImtxVya/lfQlVYyQHeFAJeIqJC7D7mAn/MhbwsSjwEJ1lsDt4jzW040bc38JLfCkC7CoDTmJX2r1q3I37h3F2RP44r4eTYb6NTbxCFabwAf1YiXuYjncVgd+koTRJk30UwNHI/8LvaAEMZCXnrc0WZqOc2gC24XvkP6E+gN3Schda7BO0Rv/m8TPOM4wFcEwamuf4UQA6Fw9b8Qw3MYga3ItqhsPjqT8f+lUxGP0ad1m10t9nNcCF1S2t07I0mH68lSa9gebrwDI9wTupV3sBe4O6zHAODFnbpYY8UzIAAAAASUVORK5CYII=");}';
var stylesheet = document.createProcessingInstruction('xml-stylesheet', 'type="text/css" href="data:text/css;utf-8,' + encodeURIComponent(css) + '"');
document.insertBefore(stylesheet, document.documentElement);
})();
Alles anzeigen