Now audio volume is stored in localStorage.
This commit is contained in:
parent
60f662109e
commit
8d8ae473ba
@ -6,7 +6,9 @@ const image_formats = ["jpg", "jpeg", "gif", "png", "bmp", "webp"];
|
|||||||
|
|
||||||
const overlay = document.getElementById("overlay");
|
const overlay = document.getElementById("overlay");
|
||||||
let g_scale = 1;
|
let g_scale = 1;
|
||||||
let g_volume = 0.5;
|
|
||||||
|
if (localStorage.getItem('audio_volume') == null)
|
||||||
|
localStorage['audio_volume'] = 0.5;
|
||||||
|
|
||||||
function mousescroll(e) {
|
function mousescroll(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@ -15,7 +17,7 @@ function mousescroll(e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onvolumechange(e) {
|
function onvolumechange(e) {
|
||||||
g_volume = e.target.volume;
|
localStorage['audio_volume'] = e.target.volume;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ext_filter = (ext, pathname) => pathname.toLowerCase().endsWith(ext);
|
const ext_filter = (ext, pathname) => pathname.toLowerCase().endsWith(ext);
|
||||||
@ -28,7 +30,7 @@ function to_overlay(eltyp, pathname) {
|
|||||||
if (eltyp !== "img") {
|
if (eltyp !== "img") {
|
||||||
el.autoplay = el.controls = true;
|
el.autoplay = el.controls = true;
|
||||||
el.addEventListener("volumechange", onvolumechange);
|
el.addEventListener("volumechange", onvolumechange);
|
||||||
el.volume = g_volume;
|
el.volume = localStorage['audio_volume'];
|
||||||
}
|
}
|
||||||
el.src = pathname;
|
el.src = pathname;
|
||||||
overlay.appendChild(el);
|
overlay.appendChild(el);
|
||||||
|
Loading…
Reference in New Issue
Block a user