This commit is contained in:
quoije
2022-08-20 18:46:46 -04:00
4 changed files with 73 additions and 8 deletions
+26 -7
View File
@@ -67,6 +67,10 @@ jQuery(function($) {
var audio = document.getElementById('player');
console.log(audio.src);
// check if ep is in cache
checkepcache();
// cookie last playback
if (Cookies.get("lastep-title")) {
console.log("playback function")
@@ -78,13 +82,31 @@ jQuery(function($) {
}
audio.addEventListener('timeupdate',function(){
<<<<<<< HEAD
var currentTime = audio.currentTime;
Cookies.set("lastep-time", currentTime);
=======
var currentTime = audio.currentTime;
Cookies.set("lastep-time", currentTime, { expires: 365 });
>>>>>>> 9f36b512a893a4955dde67afea5f1b675cf31c05
},false);
});
function checkepcache(){
if (Cookies.get("lastep-src")){
console.log("yahh");
const epstab = document.getElementById("epstab");
epstab.innerHTML = "<img src='assets/img/spek.icon.svg' width='25px'></img>" + " épisodes";
};
}
// player things
function stopplayer(){
document.getElementById("lienep").innerHTML= title;
document.getElementById("sbody").innerHTML= body + "....";
document.getElementById("lienep").href= linkdec;
}
function play(src, title, date, body) {
var audio = document.getElementById('player');
console.log(src);
@@ -99,15 +121,12 @@ jQuery(function($) {
document.getElementById("player").setAttribute('src', linkdec);
document.getElementById("player").load();
document.getElementById("player").play();
Cookies.set("lastep-title", title)
Cookies.set("lastep-src", audio.src);
Cookies.set("lastep-body", body)
Cookies.set("lastep-title", title, { expires: 365 });
Cookies.set("lastep-src", audio.src, { expires: 365 });
Cookies.set("lastep-body", body, { expires: 365 });
checkepcache();
}
function switchTab() {
$('[href="#ep"]').tab('show');
}