diff --git a/index.php b/index.php
index ed4ed47..db2ec5d 100644
--- a/index.php
+++ b/index.php
@@ -4,8 +4,8 @@
error_reporting( 0 );
/*
-Noctifer Music 0.6.1
-Copyright 2019 Laurens R Krol
+Noctifer Music 0.7.0
+Copyright 2019, 2022 Laurens R. Krol
noctifer.net, lrkrol.com
This program is free software: you can redistribute it and/or modify
@@ -81,6 +81,10 @@
# | C H A N G E L O G |
# +---------------------------+
+2022-10-27 0.7.0
+- Added cookie to maintain volume when changed
+- Minor cleanup
+
2019-04-08 0.6.1
- Added keyboard shortcuts and swipe events
- Also password-protected playlist view
@@ -218,7 +222,7 @@
-';
+
PASSWORDREQUEST;
} else {
@@ -839,15 +843,27 @@ function getCookie(cname) {
};
document.addEventListener("DOMContentLoaded", function() {
- document.getElementById('audio').addEventListener('error', function() {
+ var audio = document.getElementById('audio');
+
+ audio.addEventListener('error', function() {
document.getElementById('error').innerHTML = 'Playback error';
document.getElementById('error').style.display = 'block';
setTimeout(function(){ advance('next'); }, 2000);
});
- document.getElementById('audio').addEventListener('ended', function() {
+ audio.addEventListener('ended', function() {
advance('next');
});
+
+
+ audio.addEventListener('volumechange', function() {
+ setCookie('nm_volume', audio.volume, 14);
+ });
+
+ var volume = getCookie('nm_volume');
+ if (volume != null && volume) {
+ audio.volume = volume;
+ }
{$onloadgoto}
}, false);
@@ -882,9 +898,6 @@ function getCookie(cname) {
case 39: // right
advance('next');
break;
- case 13: // enter
- toggleView('$photoUrl');
- break;
}
};
@@ -926,6 +939,15 @@ function swipedetect(el, callback){
advance('previous');
}
})
+ // Get and set volume with cookie
+ var audio = document.getElementById('audio');
+ audio.addEventListener('volumechange', function() {
+ setCookie('volume', audio.volume, 14);
+ });
+ var volume = getCookie('volume');
+ if (volume != null && volume) {
+ audio.volume = volume;
+ }
}, false);
@@ -1217,4 +1239,4 @@ function swipedetect(el, callback){
HTML;
}
-?>
\ No newline at end of file
+?>