mirror of
https://github.com/pi-hole/web.git
synced 2025-12-24 20:55:28 +00:00
Add per-browser boxed layout setting
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
@@ -130,8 +130,24 @@ function applyCheckboxRadioStyle() {
|
||||
if (chkboxStyle === null) {
|
||||
chkboxStyle = "material-blue";
|
||||
}
|
||||
|
||||
$("input[type='radio'],input[type='checkbox']").parent().removeClass();
|
||||
$("input[type='radio'],input[type='checkbox']").parent().addClass("icheck-" + chkboxStyle);
|
||||
$("input[type='radio'],input[type='checkbox']")
|
||||
.parent()
|
||||
.addClass("icheck-" + chkboxStyle);
|
||||
}
|
||||
|
||||
function applyBoxedLayout() {
|
||||
var boxedlayout = localStorage.getItem("boxedlayout");
|
||||
if (boxedlayout === null) {
|
||||
boxedlayout = true;
|
||||
}
|
||||
|
||||
if (boxedlayout === true) {
|
||||
$("body").addClass("layout-boxed");
|
||||
} else {
|
||||
$("body").removeClass("layout-boxed");
|
||||
}
|
||||
}
|
||||
|
||||
$(function () {
|
||||
@@ -146,7 +162,9 @@ $(function () {
|
||||
$("#cookieInfo").show();
|
||||
}
|
||||
|
||||
// Apply per-browser styling settings
|
||||
applyCheckboxRadioStyle();
|
||||
applyBoxedLayout();
|
||||
|
||||
// Run check immediately after page loading ...
|
||||
checkMessages();
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
/* global utils:false */
|
||||
/* global utils:false, applyCheckboxRadioStyle:false, applyBoxedLayout:false */
|
||||
|
||||
$(function () {
|
||||
$("[data-static]").on("click", function () {
|
||||
@@ -281,10 +281,29 @@ $(function () {
|
||||
if (iCheckStyle === null) {
|
||||
iCheckStyle = "material-blue";
|
||||
}
|
||||
|
||||
iCheckSelect.val(iCheckStyle);
|
||||
|
||||
iCheckSelect.change(function () {
|
||||
localStorage.setItem("theme_icheck", iCheckSelect.val());
|
||||
applyCheckboxRadioStyle();
|
||||
});
|
||||
|
||||
// boxed style toggle
|
||||
var boxedlayout = $("#boxedlayout");
|
||||
chkboxData = localStorage.getItem("boxedlayout");
|
||||
|
||||
if (chkboxData !== null) {
|
||||
// Restore checkbox state
|
||||
boxedlayout.prop("checked", chkboxData === "true");
|
||||
} else {
|
||||
// Initialize checkbox
|
||||
boxedlayout.prop("checked", true);
|
||||
localStorage.setItem("boxedlayout", true);
|
||||
}
|
||||
|
||||
boxedlayout.click(function () {
|
||||
localStorage.setItem("boxedlayout", boxedlayout.prop("checked"));
|
||||
applyBoxedLayout();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user