Update settings.js to ES6
This commit is contained in:
parent
4280c816fa
commit
3c95c0bd62
@ -1,4 +1,7 @@
|
|||||||
// Local js definitions:
|
// Local js definitions:
|
||||||
|
/* eslint-env es6 */
|
||||||
|
/* eslint no-var: "error" */
|
||||||
|
/* eslint prefer-const: "error" */
|
||||||
/* global getSettingValue, getVirtualKey, onEachLazy, updateLocalStorage, updateSystemTheme */
|
/* global getSettingValue, getVirtualKey, onEachLazy, updateLocalStorage, updateSystemTheme */
|
||||||
/* global addClass, removeClass */
|
/* global addClass, removeClass */
|
||||||
|
|
||||||
@ -55,9 +58,9 @@
|
|||||||
function setEvents() {
|
function setEvents() {
|
||||||
updateLightAndDark();
|
updateLightAndDark();
|
||||||
onEachLazy(document.getElementsByClassName("slider"), function(elem) {
|
onEachLazy(document.getElementsByClassName("slider"), function(elem) {
|
||||||
var toggle = elem.previousElementSibling;
|
const toggle = elem.previousElementSibling;
|
||||||
var settingId = toggle.id;
|
const settingId = toggle.id;
|
||||||
var settingValue = getSettingValue(settingId);
|
const settingValue = getSettingValue(settingId);
|
||||||
if (settingValue !== null) {
|
if (settingValue !== null) {
|
||||||
toggle.checked = settingValue === "true";
|
toggle.checked = settingValue === "true";
|
||||||
}
|
}
|
||||||
@ -68,9 +71,9 @@
|
|||||||
toggle.onkeyrelease = handleKey;
|
toggle.onkeyrelease = handleKey;
|
||||||
});
|
});
|
||||||
onEachLazy(document.getElementsByClassName("select-wrapper"), function(elem) {
|
onEachLazy(document.getElementsByClassName("select-wrapper"), function(elem) {
|
||||||
var select = elem.getElementsByTagName("select")[0];
|
const select = elem.getElementsByTagName("select")[0];
|
||||||
var settingId = select.id;
|
const settingId = select.id;
|
||||||
var settingValue = getSettingValue(settingId);
|
const settingValue = getSettingValue(settingId);
|
||||||
if (settingValue !== null) {
|
if (settingValue !== null) {
|
||||||
select.value = settingValue;
|
select.value = settingValue;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user