Skip to content

Commit

Permalink
Update index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
moshiax committed Jan 24, 2025
1 parent fd0d8b3 commit 952fa80
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1216,13 +1216,14 @@ <h2>Region & Settings</h2>


function saveVolumeToCookie(volume) {
document.cookie = `audioVolume=${volume}; path=/; expires=Sun, 31 Dec 11944 23:59:59 GMT`;
const roundedVolume = parseFloat(volume.toFixed(2));
document.cookie = `audioVolume=${roundedVolume}; path=/; expires=Sun, 31 Dec 11944 23:59:59 GMT`;
}

function loadVolumeFromCookie() {
const cookies = document.cookie.split('; ');
const volumeCookie = cookies.find(row => row.startsWith('audioVolume='));
return volumeCookie ? parseFloat(volumeCookie.split('=')[1]) : null;
return volumeCookie ? parseFloat(parseFloat(volumeCookie.split('=')[1]).toFixed(2)) : null;
}

const volumeText = document.createElement('span');
Expand Down

0 comments on commit 952fa80

Please sign in to comment.