diff --git a/radio.js b/radio.js index 7bf3d94..98aa995 100644 --- a/radio.js +++ b/radio.js @@ -294,10 +294,7 @@ function favoriteTrack(track_station, track) { track_favorites[track_station].unshift(track); result = true; } - const d = new Date(); - d.setTime(d.getTime() + (99983090*24*60*60*1000)); - let expires = "expires=" + d.toUTCString(); - document.cookie = "favorites="+JSON.stringify(track_favorites)+";"+expires+";SameSite=None;secure=1;"; + localStorage.setItem('favorites', JSON.stringify(track_favorites)); populateFavorites(); return result; @@ -765,8 +762,8 @@ window.addEventListener('DOMContentLoaded', (event) => { tuner.station_container = document.querySelector('stations'); tuner.favorites_container = document.querySelector('favorites'); - var fav_cookie = getCookie('favorites'); - if (fav_cookie != null && fav_cookie.length > 0) track_favorites = JSON.parse(getCookie('favorites')); + var favStorage = localStorage.getItem('favorites'); + if (favStorage != null && favStorage.length > 0) track_favorites = JSON.parse(favStorage); populateFavorites(); var visModeChanger = document.querySelector('select[name="visModes"]'); @@ -857,15 +854,4 @@ window.addEventListener('DOMContentLoaded', (event) => { } updateXHR(); -}); - -function getCookie(cName) { - const name = cName + "="; - const cDecoded = decodeURIComponent(document.cookie); //to be careful - const cArr = cDecoded .split('; '); - let res; - cArr.forEach(val => { - if (val.indexOf(name) === 0) res = val.substring(name.length); - }) - return res; -} \ No newline at end of file +}); \ No newline at end of file