From 9e1bf4930b78c491e36d7e7302bcbd59392a1979 Mon Sep 17 00:00:00 2001 From: Alex Pankratov Date: Tue, 6 Apr 2021 18:37:26 +0200 Subject: [PATCH] rework fs/lh overrides --- nullboard.html | 42 ++++++++++-------------------------------- 1 file changed, 10 insertions(+), 32 deletions(-) diff --git a/nullboard.html b/nullboard.html index 881f5af..ebdf2f9 100644 --- a/nullboard.html +++ b/nullboard.html @@ -904,7 +904,8 @@ text-align: center; } - .config .bulk .ui-prefs .f-prefs tr.custom td.val { + .fs-set .config .bulk .ui-prefs .f-prefs tr.ui-fs td.val, + .lh-set .config .bulk .ui-prefs .f-prefs tr.ui-lh td.val { color: #1489db; cursor: pointer; } @@ -3280,15 +3281,14 @@ function selectFont(font) { - $('html').removeClass('f-' + NB.font).addClass('f-' + font); + var $html = $('html'); + $html.removeClass('f-' + NB.font).addClass('f-' + font); NB.font = font; var $list = $('.config .switch-font'); $list.removeClass('active'); $list.filter('[font="' + font + '"]').addClass('active'); - var f = NB.fonts[NB.font]; - updateFontSize(); updateLineHeight(); } @@ -3299,45 +3299,23 @@ return parseFloat( $('html').css('--fs') ); } - function getFontSize_def() - { - return NB.fonts[NB.font].fs; - } - function getLineHeight() { return parseFloat( $('html').css('--lh') ); } - function getLineHeight_def() - { - return NB.fonts[NB.font].lh; - } - // function updateFontSize() { - var $val = $('.config .f-prefs .ui-fs .val'); - var def = getFontSize_def(); var val = getFontSize(); - - $val.html( val.toFixed(1) ); - if (val == def) $val.parent().removeClass('custom'); - else $val.parent().addClass('custom'); - + $('.config .f-prefs .ui-fs .val').html( val.toFixed(1) ); return val; } function updateLineHeight() { - var $val = $('.config .f-prefs .ui-lh .val'); - var def = getLineHeight_def(); var val = getLineHeight(); - - $val.html( val.toFixed(1) ); - if (val == def) $val.parent().removeClass('custom'); - else $val.parent().addClass('custom'); - + $('.config .f-prefs .ui-lh .val').html( val.toFixed(1) ); return val; } @@ -3346,7 +3324,7 @@ { if (9 <= fs && fs <= 24) { - $('html').css('--fs', fs + ''); + $('html').css('--fs', fs + '').addClass('fs-set'); updateFontSize(); if (getLineHeight() < fs) @@ -3360,7 +3338,7 @@ var fs = getFontSize(); if (fs <= lh && lh <= 3*fs) { - $('html').css('--lh', lh + ''); + $('html').css('--lh', lh + '').addClass('lh-set'); updateLineHeight(); } return getLineHeight(); @@ -3369,13 +3347,13 @@ // function resetFontSize() { - $('html').css('--fs', ''); + $('html').css('--fs', '').removeClass('fs-set'); return updateFontSize(); } function resetLineHeight() { - $('html').css('--lh', ''); + $('html').css('--lh', '').removeClass('lh-set'); return updateLineHeight(); }