player can save time after win close
This commit is contained in:
@@ -60,6 +60,14 @@ body {
|
|||||||
font-style: normal;
|
font-style: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#audioplayerdivstop {
|
||||||
|
margin-bottom: 160px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#playicon {
|
||||||
|
margin-bottom: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
#ws:link {
|
#ws:link {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: inherit;
|
color: inherit;
|
||||||
|
|||||||
+66
-1
@@ -49,9 +49,25 @@ jQuery(function($) {
|
|||||||
'top': $("#playerwindow").data('origionalTop')
|
'top': $("#playerwindow").data('origionalTop')
|
||||||
});
|
});
|
||||||
topFunction();
|
topFunction();
|
||||||
document.getElementById("player").pause();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$(".closewin").click(function() {
|
||||||
|
$("#playerwindow").css({
|
||||||
|
'left': $("#playerwindow").data('originalLeft'),
|
||||||
|
'top': $("#playerwindow").data('origionalTop')
|
||||||
|
});
|
||||||
|
topFunction();
|
||||||
|
document.getElementById("sbody").innerHTML= "";
|
||||||
|
document.getElementById("player").pause();
|
||||||
|
keeplastepcache();
|
||||||
|
document.getElementById("player").setAttribute('src', "");
|
||||||
|
document.getElementById("lienep").href = "";
|
||||||
|
document.getElementById("nomep").innerHTML = "<a id='lienep' target='_blank'>Pas d'épisode en cours</a>";
|
||||||
|
document.getElementById("epstab").innerHTML = "épisodes";
|
||||||
|
clearcache();
|
||||||
|
});
|
||||||
|
|
||||||
var audio = document.getElementById('player');
|
var audio = document.getElementById('player');
|
||||||
console.log(audio.src);
|
console.log(audio.src);
|
||||||
|
|
||||||
@@ -73,6 +89,47 @@ jQuery(function($) {
|
|||||||
|
|
||||||
// player things
|
// player things
|
||||||
|
|
||||||
|
function checkepcache(){
|
||||||
|
if (Cookies.get("lastep-src")){
|
||||||
|
console.log("yahh");
|
||||||
|
const epstab = document.getElementById("epstab");
|
||||||
|
playicon();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function keeplastepcache(){
|
||||||
|
Cookies.set("lastep_b4close-title", document.getElementById("lienep").innerHTML, { expires: 365 });
|
||||||
|
Cookies.set("lastep_b4close-time", document.getElementById("player").currentTime, { expires: 365 });
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearcache(){
|
||||||
|
Cookies.remove("lastep-title");
|
||||||
|
Cookies.remove("lastep-body");
|
||||||
|
Cookies.remove("lastep-src");
|
||||||
|
Cookies.remove("lastep-time");
|
||||||
|
}
|
||||||
|
|
||||||
|
// player things
|
||||||
|
|
||||||
|
function playicon(){
|
||||||
|
const epstab = document.getElementById("epstab");
|
||||||
|
if (document.getElementById("lienep").src = "")
|
||||||
|
{
|
||||||
|
epstab.innerHTML = "épisodes";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
console.log("ayyyy");
|
||||||
|
epstab.innerHTML = "<img id='playicon' src='assets/img/spek.icon.svg' width='20px'></img>" + " épisodes";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function stopplayer(){
|
||||||
|
document.getElementById("lienep").innerHTML= title;
|
||||||
|
document.getElementById("sbody").innerHTML= body + "....";
|
||||||
|
document.getElementById("lienep").href= linkdec;
|
||||||
|
}
|
||||||
|
|
||||||
function play(src, title, date, body) {
|
function play(src, title, date, body) {
|
||||||
var audio = document.getElementById('player');
|
var audio = document.getElementById('player');
|
||||||
console.log(src);
|
console.log(src);
|
||||||
@@ -88,6 +145,14 @@ jQuery(function($) {
|
|||||||
document.getElementById("player").load();
|
document.getElementById("player").load();
|
||||||
document.getElementById("player").play();
|
document.getElementById("player").play();
|
||||||
Cookies.set("lastep-title", title, { expires: 365 })
|
Cookies.set("lastep-title", title, { expires: 365 })
|
||||||
|
audio.pause();
|
||||||
|
audio.setAttribute('src', linkdec);
|
||||||
|
if (title == Cookies.get("lastep_b4close-title")){
|
||||||
|
audio.currentTime = Cookies.get("lastep_b4close-time");
|
||||||
|
}
|
||||||
|
audio.load();
|
||||||
|
audio.play();
|
||||||
|
Cookies.set("lastep-title", title, { expires: 365 });
|
||||||
Cookies.set("lastep-src", audio.src, { expires: 365 });
|
Cookies.set("lastep-src", audio.src, { expires: 365 });
|
||||||
Cookies.set("lastep-body", body, { expires: 365 })
|
Cookies.set("lastep-body", body, { expires: 365 })
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user