Use recommended way of access localStorage using setItem/getItem funcs.
This commit is contained in:
parent
1d956a8430
commit
23bfb9ad4d
@ -18,7 +18,7 @@ let g_current_row = g_back_row;
|
||||
|
||||
|
||||
if (localStorage.getItem("audio_volume") == null)
|
||||
localStorage["audio_volume"] = 0.5;
|
||||
localStorage.setItem("audio_volume", 0.5);
|
||||
|
||||
|
||||
function overlayClose() {
|
||||
@ -80,8 +80,8 @@ function overlaySet(pathname, media_type_element) {
|
||||
if (media_type_element !== "img") {
|
||||
media_element.autoplay = media_element.controls = true;
|
||||
media_element.addEventListener("volumechange", e => {
|
||||
localStorage["audio_volume"] = e.target.volume; });
|
||||
media_element.volume = localStorage["audio_volume"];
|
||||
localStorage.setItem("audio_volume", e.target.volume); });
|
||||
media_element.volume = localStorage.getItem("audio_volume");
|
||||
media_element.addEventListener("ended", e => { if (overlay_autoplay.checked) b_next.click(); });
|
||||
}
|
||||
|
||||
@ -143,13 +143,13 @@ Array.from(g_tbody.children)
|
||||
|
||||
overlay_autoplay = document.getElementsByName("autoplay")[0];
|
||||
|
||||
if (localStorage.getItem("autoplay") == null)
|
||||
localStorage["autoplay"] = overlay_autoplay.checked = false;
|
||||
else
|
||||
overlay_autoplay.checked = localStorage["autoplay"];
|
||||
if (localStorage.getItem("autoplay") == null) {
|
||||
localStorage.setItem("autoplay", overlay_autoplay.checked = false);
|
||||
} else
|
||||
overlay_autoplay.checked = localStorage.getItem("autoplay");
|
||||
|
||||
overlay_autoplay.addEventListener("change", e => {
|
||||
localStorage["autoplay"] = e.target.checked;
|
||||
localStorage.setItem("autoplay", overlay_autoplay.checked);
|
||||
const media_element = overlay_content.firstChild;
|
||||
if (e.target.checked && media_element !== undefined)
|
||||
if (media_element.tagName === "AUDIO" || media_element.tagName === "VIDEO")
|
||||
@ -270,7 +270,7 @@ thead_name.addEventListener("click", e => {
|
||||
}, null, null, thead_name, [thead_date, thead_size]);
|
||||
g_first_row = g_tbody.firstChild;
|
||||
g_last_row = g_tbody.lastChild;
|
||||
localStorage["sort_column"] = "name";
|
||||
localStorage.setItem("sort_column", "name");
|
||||
});
|
||||
|
||||
thead_date.classList.toggle("clickable");
|
||||
@ -283,7 +283,7 @@ thead_date.addEventListener("click", e => {
|
||||
}, null, null, thead_date, [thead_name, thead_size]);
|
||||
g_first_row = g_tbody.firstChild;
|
||||
g_last_row = g_tbody.lastChild;
|
||||
localStorage["sort_column"] = "date";
|
||||
localStorage.setItem("sort_column", "date");
|
||||
});
|
||||
|
||||
|
||||
@ -312,11 +312,11 @@ thead_size.addEventListener("click", e => {
|
||||
thead_size, [thead_name, thead_date]);
|
||||
g_first_row = g_tbody.firstChild;
|
||||
g_last_row = g_tbody.lastChild;
|
||||
localStorage["sort_column"] = "size";
|
||||
localStorage.setItem("sort_column", "size");
|
||||
});
|
||||
|
||||
localStorage.setItem("sort_reverse", !(localStorage.getItem("sort_reverse") == "true"));
|
||||
switch (localStorage["sort_column"]) {
|
||||
switch (localStorage.getItem("sort_column")) {
|
||||
case "name": thead_name.click(); break;
|
||||
case "date": thead_date.click(); break;
|
||||
case "size": thead_size.click(); break;
|
||||
|
Loading…
Reference in New Issue
Block a user