Html #3

Closed
quoije wants to merge 10 commits from html into nodejs
2 changed files with 83 additions and 20 deletions
Showing only changes of commit 11d33ea2ba - Show all commits
+9 -1
View File
@@ -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;
@@ -78,4 +86,4 @@ body {
#ws:active { #ws:active {
text-decoration: none; text-decoration: none;
color: inherit; color: inherit;
} }
+74 -19
View File
@@ -4,7 +4,6 @@ $(document).ready((function(){$("[data-bss-hover-animate]").mouseenter((function
/*! js-cookie v3.0.1 | MIT */ /*! js-cookie v3.0.1 | MIT */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self,function(){var n=e.Cookies,o=e.Cookies=t();o.noConflict=function(){return e.Cookies=n,o}}())}(this,(function(){"use strict";function e(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)e[o]=n[o]}return e}return function t(n,o){function r(t,r,i){if("undefined"!=typeof document){"number"==typeof(i=e({},o,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),t=encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var c="";for(var u in i)i[u]&&(c+="; "+u,!0!==i[u]&&(c+="="+i[u].split(";")[0]));return document.cookie=t+"="+n.write(r,t)+c}}return Object.create({set:r,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var t=document.cookie?document.cookie.split("; "):[],o={},r=0;r<t.length;r++){var i=t[r].split("="),c=i.slice(1).join("=");try{var u=decodeURIComponent(i[0]);if(o[u]=n.read(c,u),e===u)break}catch(e){}}return e?o[e]:o}},remove:function(t,n){r(t,"",e({},n,{expires:-1}))},withAttributes:function(n){return t(this.converter,e({},this.attributes,n))},withConverter:function(n){return t(e({},this.converter,n),this.attributes)}},{attributes:{value:Object.freeze(o)},converter:{value:Object.freeze(n)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"})})); !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self,function(){var n=e.Cookies,o=e.Cookies=t();o.noConflict=function(){return e.Cookies=n,o}}())}(this,(function(){"use strict";function e(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)e[o]=n[o]}return e}return function t(n,o){function r(t,r,i){if("undefined"!=typeof document){"number"==typeof(i=e({},o,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),t=encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var c="";for(var u in i)i[u]&&(c+="; "+u,!0!==i[u]&&(c+="="+i[u].split(";")[0]));return document.cookie=t+"="+n.write(r,t)+c}}return Object.create({set:r,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var t=document.cookie?document.cookie.split("; "):[],o={},r=0;r<t.length;r++){var i=t[r].split("="),c=i.slice(1).join("=");try{var u=decodeURIComponent(i[0]);if(o[u]=n.read(c,u),e===u)break}catch(e){}}return e?o[e]:o}},remove:function(t,n){r(t,"",e({},n,{expires:-1}))},withAttributes:function(n){return t(this.converter,e({},this.attributes,n))},withConverter:function(n){return t(e({},this.converter,n),this.attributes)}},{attributes:{value:Object.freeze(o)},converter:{value:Object.freeze(n)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"})}));
jQuery(function($) { jQuery(function($) {
$("#rss-feeds").rss("https://anchor.fm/s/af11b98/podcast/rss", { $("#rss-feeds").rss("https://anchor.fm/s/af11b98/podcast/rss", {
limit: 1000, limit: 1000,
@@ -49,12 +48,31 @@ 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);
// check if ep is in cache
checkepcache();
// cookie last playback // cookie last playback
if (Cookies.get("lastep-title")) { if (Cookies.get("lastep-title")) {
console.log("playback function") console.log("playback function")
@@ -66,13 +84,54 @@ jQuery(function($) {
} }
audio.addEventListener('timeupdate',function(){ audio.addEventListener('timeupdate',function(){
var currentTime = audio.currentTime;
Cookies.set("lastep-time", currentTime);
var currentTime = audio.currentTime; var currentTime = audio.currentTime;
Cookies.set("lastep-time", currentTime); Cookies.set("lastep-time", currentTime, { expires: 365 });
},false); },false);
}); });
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 // 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);
@@ -83,18 +142,18 @@ jQuery(function($) {
document.getElementById("lienep").innerHTML= title; document.getElementById("lienep").innerHTML= title;
document.getElementById("sbody").innerHTML= body + "...."; document.getElementById("sbody").innerHTML= body + "....";
document.getElementById("lienep").href= linkdec; document.getElementById("lienep").href= linkdec;
document.getElementById("player").pause(); audio.pause();
document.getElementById("player").setAttribute('src', linkdec); audio.setAttribute('src', linkdec);
document.getElementById("player").load(); if (title == Cookies.get("lastep_b4close-title")){
document.getElementById("player").play(); audio.currentTime = Cookies.get("lastep_b4close-time");
Cookies.set("lastep-title", title) }
Cookies.set("lastep-src", audio.src); audio.load();
Cookies.set("lastep-body", body) audio.play();
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() { function switchTab() {
$('[href="#ep"]').tab('show'); $('[href="#ep"]').tab('show');
@@ -125,8 +184,4 @@ jQuery(function($) {
var currentdate = new Date(); var currentdate = new Date();
var imagenumber = currentdate.getDay(); var imagenumber = currentdate.getDay();
document.getElementById("meme").src = imlocation + image[imagenumber]; document.getElementById("meme").src = imlocation + image[imagenumber];
} }