Add per-browser boxed layout setting

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2020-05-26 01:16:21 +02:00
committed by Adam Warner
parent 0e4d1e4e7f
commit 7ff5764f95
4 changed files with 48 additions and 36 deletions

View File

@@ -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();

View File

@@ -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();
});
});