volume load/save nitpicks
This commit is contained in:
parent
2b0ed79d9d
commit
daed10ba44
1 changed files with 6 additions and 2 deletions
8
rot.js
8
rot.js
|
@ -76,7 +76,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function volumeSet(number) {
|
function volumeSet(number) {
|
||||||
localStorage.audiovolume = Math.round((audio.volume = number) * 100);
|
audio.volume = number; //Set
|
||||||
|
localStorage.audiovolume = Math.round(number * 100); //Save
|
||||||
updateVolumeLabel();
|
updateVolumeLabel();
|
||||||
}
|
}
|
||||||
function volumeAdd(number) {
|
function volumeAdd(number) {
|
||||||
|
@ -248,7 +249,10 @@
|
||||||
audio.loop = true;
|
audio.loop = true;
|
||||||
audio.id = "user-music";
|
audio.id = "user-music";
|
||||||
audio.style = "display:none;";
|
audio.style = "display:none;";
|
||||||
localStorage.audiovolume = (audio.volume = localStorage.audiovolume ? localStorage.audiovolume / 100 : 0.5) * 100;
|
if (localStorage.audiovolume)
|
||||||
|
audio.volume = localStorage.audiovolume / 100; //Load volume
|
||||||
|
else
|
||||||
|
audio.volume = 0.2; //Default volume
|
||||||
|
|
||||||
//Initialize audio controls and event listeners
|
//Initialize audio controls and event listeners
|
||||||
waitUntil("#music-controls").then((controls) => {
|
waitUntil("#music-controls").then((controls) => {
|
||||||
|
|
Loading…
Reference in a new issue