Use ** exponentiation operator
This commit is contained in:
parent
36c3a614c5
commit
8bab5329cb
2
js/application.min.js
vendored
2
js/application.min.js
vendored
File diff suppressed because one or more lines are too long
2
js/chapter.min.js
vendored
2
js/chapter.min.js
vendored
File diff suppressed because one or more lines are too long
2
js/utility.min.js
vendored
2
js/utility.min.js
vendored
File diff suppressed because one or more lines are too long
@ -939,7 +939,7 @@ function fcn_updateDarken(value = null) {
|
||||
fcn_settingDarkenTexts.forEach(element => { element.value = parseInt(value * 100); });
|
||||
|
||||
// Calculate property
|
||||
const d = value >= 0 ? 1 + Math.pow(value, 2) : 1 - Math.pow(value, 2);
|
||||
const d = value >= 0 ? 1 + value ** 2 : 1 - value ** 2;
|
||||
|
||||
// Update property in DOM
|
||||
fcn_theRoot.style.setProperty('--darken', `(${d} + var(--lightness-offset))`);
|
||||
@ -1011,7 +1011,7 @@ function fcn_updateSaturation(value = null) {
|
||||
fcn_settingSaturationTexts.forEach(element => { element.value = parseInt(value * 100); });
|
||||
|
||||
// Calculate property
|
||||
const s = value >= 0 ? 1 + Math.pow(value, 2) : 1 - Math.pow(value, 2);
|
||||
const s = value >= 0 ? 1 + value ** 2 : 1 - value ** 2;
|
||||
|
||||
// Update property in DOM
|
||||
fcn_theRoot.style.setProperty('--saturation', `(${s} + var(--saturation-offset))`);
|
||||
@ -1083,10 +1083,10 @@ function fcn_updateFontLightness(value = null) {
|
||||
fcn_settingFontLightnessTexts.forEach(element => { element.value = parseInt(value * 100); });
|
||||
|
||||
// Calculate property
|
||||
const s = value >= 0 ? 1 + Math.pow(value, 2) : 1 - Math.pow(value, 2);
|
||||
const l = value >= 0 ? 1 + value ** 2 : 1 - value ** 2;
|
||||
|
||||
// Update property in DOM
|
||||
fcn_theRoot.style.setProperty('--font-lightness', `(${s} + var(--font-lightness-offset))`);
|
||||
fcn_theRoot.style.setProperty('--font-lightness', `(${l} + var(--font-lightness-offset))`);
|
||||
|
||||
// Update local storage
|
||||
fcn_siteSettings['font-lightness'] = value;
|
||||
|
@ -652,7 +652,7 @@ function fcn_setFormatting(value) {
|
||||
// Update font saturation property (squared for smooth progression)
|
||||
fcn_chapterFormatting.style.setProperty(
|
||||
'--font-saturation',
|
||||
`(${value >= 0 ? 1 + Math.pow(value, 2) : 1 - Math.pow(value, 2)} + var(--font-saturation-offset))`
|
||||
`(${value >= 0 ? 1 + value ** 2 : 1 - value ** 2} + var(--font-saturation-offset))`
|
||||
);
|
||||
|
||||
// Update local storage
|
||||
|
@ -311,8 +311,8 @@ function fcn_updateThemeColor(color = false) {
|
||||
const darken = fcn_siteSettings['darken'] ? fcn_siteSettings['darken'] : 0;
|
||||
const saturation = fcn_siteSettings['saturation'] ? fcn_siteSettings['saturation'] : 0;
|
||||
const hueRotate = fcn_siteSettings['hue-rotate'] ? fcn_siteSettings['hue-rotate'] : 0;
|
||||
const d = darken >= 0 ? 1 + Math.pow(darken, 2) : 1 - Math.pow(darken, 2);
|
||||
const s = saturation >= 0 ? 1 + Math.pow(saturation, 2) : 1 - Math.pow(saturation, 2);
|
||||
const d = darken >= 0 ? 1 + darken ** 2 : 1 - darken ** 2;
|
||||
const s = saturation >= 0 ? 1 + saturation ** 2 : 1 - saturation ** 2;
|
||||
|
||||
let themeColor = getComputedStyle(document.documentElement).getPropertyValue('--theme-color-base').trim().split(' ');
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user