Speravir, könnte es auch sein, dass einfach nur der Reload im falschen Fenster stattfindet? Dass z.b.: event.target.ownerGlobal.BrowserCommands.reloadSkipCache();statt BrowserCommands.reloadSkipCache(); schon reichen würde? Über dieses Script diskutierten wir schon mal, und hier geht es:
JavaScript
// JavaScript Document
// B_UserPrefAnimationMode.uc.js
// Das Script erstellt einen Button, der in about:config character/string-Variablen ändert. In der UserConfiguration unter 'const charPref' kann die zu ändernde Einstellung festgelegt werden. Das icon/label/tooltiptext kann in der UserConfiguration dem jeweiligen Zustand angepasst werden (normal/once/none).
// Für das mitgelieferte Icon als .svg-Datei mit [moz-context-properties] ändert das Script die Einstellung [svg.context-properties.content.enabled] in about:config auf 'true'.
// In einem neuen Profil ist die Einstellung in about:config 'image.animation_mode, normal' gesetzt. Der Button schaltet per Linksklick einen Zustand weiter (von 'image.animation_mode, normal' auf 'once', von 'once' auf 'none' und von 'none' auf 'normal'. Beim Umschalten wird der Seiteninhalt des AKTIVEN Tabs neu geladen.
(function() {
if (!window.gBrowser)
return;
const
// ■■ START UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
id = 'UserPref-iA_m-button', // Id des neuen Buttons
charPref = 'image.animation_mode', // Einstellung in about:config deren character-Variable geschaltet werden soll
labelNorm = 'Normale Gifanimation (Schleife)', // Bezeichnung des neuen Buttons bei charPref=normal
labelOnce = 'Einmalige Gifanimation', // Bezeichnung des neuen Buttons bei charPref=once
labelNone = 'Keine Gifanimation', // Bezeichnung des neuen Buttons bei charPref=none
ttTextNorm = 'Normale Gifanimation (Schleife)', // Tooltiptext
ttTextOnce = 'Einmalige Gifanimation',
ttTextNone = 'Keine Gifanimation',
// Icon-------------------------------------------------------
iconNorm = '16-control-panel-20_moz.svg', // [Name.Dateiendung] des anzuzeigenden Symbols für charPref=normal
iconOnce = '16-control-panel-19_moz.svg', // [Name.Dateiendung] des anzuzeigenden Symbols charPref=once
iconNone = '16-control-panel-18_moz.svg', // [Name.Dateiendung] des anzuzeigenden Symbols für charPref=none
bgImage = '#f9f9f9', // Farbe des Indikators (zur Unterscheidung mehrerer UserPref-buttons)
iconPath = '/chrome/icons/', // Pfad zum Ordner der das Icon beinhaltet
iconColNorm = 'forestgreen', // Farbe des Icons (nur .svg-Datei mit [moz-context-properties] für charPref=normal, bei anderen Icons hat const iconColNorm keine Funktion)
iconColOnce = 'goldenrod', // Farbe des Icons (nur .svg-Datei mit [moz-context-properties] für charPref=once, bei anderen Icons hat const iconColOnce keine Funktion)
iconColNone = 'firebrick', // Farbe des Icons (nur .svg-Datei mit [moz-context-properties] für charPref=none, bei anderen Icons hat const iconColNone keine Funktion)
// ■■ END UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
curProfDir = PathUtils.toFileURI(PathUtils.join(PathUtils.profileDir));
//const end
if (Services.prefs.getBoolPref('svg.context-properties.content.enabled') == false) {
Services.prefs.setBoolPref('svg.context-properties.content.enabled', true );
}
//----
CustomizableUI.createWidget({
id: id,
type: 'button',
defaultArea: CustomizableUI.AREA_NAVBAR,
onCreated: (button) => {
button.style.MozContextProperties = 'fill, stroke, fill-opacity';
//bgImage
button.style = 'background-image:linear-gradient('+bgImage+','+bgImage+'); background-repeat: no-repeat; background-size: 4px 4px; background-position: left 2px top calc(50% - 8px);';
//start
if (Services.prefs.getCharPref(charPref) == 'normal' ) {
button.style.fill = iconColNorm;
button.style.listStyleImage = 'url("' + curProfDir + iconPath + iconNorm + '")';
button.setAttribute('label', labelNorm);
button.setAttribute('tooltiptext', ttTextNorm);
}
else
if (Services.prefs.getCharPref(charPref) == 'once' ) {
button.style.fill = iconColOnce;
button.style.listStyleImage = 'url("' + curProfDir + iconPath + iconOnce + '")';
button.setAttribute('label', labelOnce);
button.setAttribute('tooltiptext', ttTextOnce);
}
else
if (Services.prefs.getCharPref(charPref) == 'none' ) {
button.style.fill = iconColNone;
button.style.listStyleImage = 'url("' + curProfDir + iconPath + iconNone + '")';
button.setAttribute('label', labelNone);
button.setAttribute('tooltiptext', ttTextNone);
}
//click
button.addEventListener('click', () => {
if (event.button == 0) {
event.target.ownerGlobal.BrowserCommands.reloadSkipCache();
if (Services.prefs.getCharPref(charPref) == 'normal' ) {
Services.prefs.setCharPref(charPref, 'once');
button.style.fill = iconColOnce;
button.style.listStyleImage = 'url("' + curProfDir + iconPath + iconOnce + '")';
button.setAttribute('label', labelOnce);
button.setAttribute('tooltiptext', ttTextOnce);
}
else
if (Services.prefs.getCharPref(charPref) == 'once' ) {
Services.prefs.setCharPref(charPref, 'none');
button.style.fill = iconColNone;
button.style.listStyleImage = 'url("' + curProfDir + iconPath + iconNone + '")';
button.setAttribute('label', labelNone);
button.setAttribute('tooltiptext', ttTextNone);
}
else
if (Services.prefs.getCharPref(charPref) == 'none' ) {
Services.prefs.setCharPref(charPref, 'normal');
button.style.fill = iconColNorm;
button.style.listStyleImage = 'url("' + curProfDir + iconPath + iconNorm + '")';
button.setAttribute('label', labelNorm);
button.setAttribute('tooltiptext', ttTextNorm);
}
}
});
//----
}
});
//----
})();
Alles anzeigen