Added expand on hover for tabs!

This commit is contained in:
Mauro Balades
2024-08-19 17:25:00 +02:00
parent 66d8d4bd71
commit 1b5881c0fb
7 changed files with 145 additions and 5 deletions

View File

@@ -144,10 +144,42 @@ var gZenLooksAndFeel = {
init() {
this._initializeColorPicker(this._getInitialAccentColor());
window.zenPageAccentColorChanged = this._handleAccentColorChange.bind(this);
this._initializeTabbarExpandForm();
gZenThemeBuilder.init();
gZenMarketplaceManager.init();
},
_initializeTabbarExpandForm() {
const form = document.getElementById("zen-expand-tabbar-strat");
const radios = form.querySelectorAll("input[type=radio]");
const onHoverPref = "zen.view.sidebar-expanded.on-hover";
const defaultExpandPref = "zen.view.sidebar-expanded";
if (Services.prefs.getBoolPref(onHoverPref)) {
form.querySelector("input[value=\"hover\"]").checked = true;
} else if (Services.prefs.getBoolPref(defaultExpandPref)) {
form.querySelector("input[value=\"expand\"]").checked = true;
} else {
form.querySelector("input[value=\"none\"]").checked = true;
}
for (let radio of radios) {
radio.addEventListener("change", e => {
switch (e.target.value) {
case "expand":
Services.prefs.setBoolPref(onHoverPref, false);
Services.prefs.setBoolPref(defaultExpandPref, true);
break;
case "none":
Services.prefs.setBoolPref(onHoverPref, false);
Services.prefs.setBoolPref(defaultExpandPref, false);
case "hover":
Services.prefs.setBoolPref(onHoverPref, true);
Services.prefs.setBoolPref(defaultExpandPref, false);
break;
}
});
}
},
_initializeColorPicker(accentColor) {
let elem = document.getElementById("zenLooksAndFeelColorOptions");
elem.innerHTML = "";