- Firefox-Version
- 152.0.3
- Betriebssystem
- Linux Mint 22.1 Xia base: Ubuntu 24.04 noble
Dieses Script könnte für Tester der Nightly 152.0a1 nützlich sein; es erstellt einen Button der das 'Nova-Design' ein/aus -schaltet:
JavaScript
// JavaScript Document
// developed without AI-based applications or tools
// B_UserPrefNovaEnabled.uc.js
// Firefox Nightly 152.0a1
// Quelle: https://www...
// Das Script erstellt einen Button, der in about:config boolsche Werte ändert. In der UserConfiguration unter 'const boolPref' kann die zu ändernde Einstellung (hier: browser.nova.enabled) festgelegt werden. Das icon/label/tooltiptext kann in der UserConfiguration dem jeweiligen Zustand angepasst werden (true/false).
// Der Button blendet das neue Design 'Nova' ein/aus. Eine Änderung des Wertes benötigt keinen Neustart des Browsers.
(function() {
if (!window.gBrowser)
return;
const
// ■■ START UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
id = 'UserPref-bNE-button', // Id des Buttons
boolPref = 'browser.nova.enabled', // Einstellung in about:config deren boolesche Variable geschaltet werden soll
labelT = '"browser.nova.enabled" aktiviert', // Bezeichnung des Buttons bei boolPref=true
labelF = '"browser.nova.enabled" deaktiviert', // Bezeichnung des Buttons bei boolPref=false
tooltiptextT = '"browser.nova.enabled" aktiviert\n[true=>Benutzereinstellung]',
tooltiptextF = '"browser.nova.enabled" deaktiviert\n[false=>Standardeinstellung]',
// Icon-------------------------------------------------------
iconT = '16-control-panel-20_moz.svg', // [Name.Dateiendung] des Symbols für boolPref=true
iconF = '16-control-panel-18_moz.svg', // [Name.Dateiendung] des Symbols für boolPref=false
bgImage = 'darkorange', //'transparent' // Farbe des Indikators (zur Unterscheidung mehrerer UserPref-buttons;)
iconPath = '/chrome/icons/', // Pfad zum Ordner der das Icon enthält
iconColorT = 'forestgreen', // Farbe des Icons (nur .svg-Datei mit [moz-context-properties] für die Standardeinstellung, bei anderen Icons hat const iconColorT keine Funktion)
iconColorF = 'firebrick', // Farbe des Icons (nur .svg-Datei mit [moz-context-properties] für die geänderte Usereinstellung, bei anderen Icons hat const iconColorF keine Funktion)
// ■■ END UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
curProfDir = PathUtils.toFileURI(PathUtils.join(PathUtils.profileDir));
if (Services.prefs.getBoolPref('svg.context-properties.content.enabled') == false) {
Services.prefs.setBoolPref('svg.context-properties.content.enabled', true );
}
//BUTTON
try {
CustomizableUI.createWidget({
id: id,
defaultArea: CustomizableUI.AREA_NAVBAR,
onCreated: (button) => {
button.style.MozContextProperties = 'fill, stroke, fill-opacity, stroke-opacity';
button.style.minWidth = 'fit-content';
//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);';
}
});
} catch(e) {};
setTimeout(() => {
const button = document.getElementById(id);
//start
if (Services.prefs.getBoolPref(boolPref) == false ) {
button.style.fill = iconColorF;
button.style.listStyleImage = 'url("' + curProfDir + iconPath + iconF + '")';
button.style.fontStyle = 'normal';
button.setAttribute('label', labelF);
button.setAttribute('tooltiptext', tooltiptextF);
}
else
if (Services.prefs.getBoolPref(boolPref) == true ) {
button.style.fill = iconColorT;
button.style.listStyleImage = 'url("' + curProfDir + iconPath + iconT + '")';
button.style.fontStyle = 'italic';
button.setAttribute('label', labelT);
button.setAttribute('tooltiptext', tooltiptextT);
}
//contextmenu
button.addEventListener('contextmenu', e => {
if (event.button === 2) {
e.preventDefault();
}
});
//click
button.addEventListener('click', () => {
if (event.button === 0) {
if (Services.prefs.getBoolPref(boolPref) == false ) {
Services.prefs.setBoolPref(boolPref, true);
button.style.fill = iconColorT;
button.style.listStyleImage = 'url("' + curProfDir + iconPath + iconT + '")';
button.style.fontStyle = 'italic';
button.setAttribute('label', labelT);
button.setAttribute('tooltiptext', tooltiptextT);
}
else
if (Services.prefs.getBoolPref(boolPref) == true ) {
Services.prefs.setBoolPref(boolPref, false);
button.style.fill = iconColorF;
button.style.listStyleImage = 'url("' + curProfDir + iconPath + iconF + '")';
button.style.fontStyle = 'normal';
button.setAttribute('label', labelF);
button.setAttribute('tooltiptext', tooltiptextF);
}
}
});
}, 10);
})();
Alles anzeigen