191 lines
8.8 KiB
JavaScript
191 lines
8.8 KiB
JavaScript
/*! amazing animations bootstrap ayy */
|
|
$(document).ready((function(){$("[data-bss-hover-animate]").mouseenter((function(){var a=$(this);a.addClass("animated "+a.attr("data-bss-hover-animate"))})).mouseleave((function(){var a=$(this);a.removeClass("animated "+a.attr("data-bss-hover-animate"))}))}));
|
|
|
|
/*! 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:"/"})}));
|
|
|
|
jQuery(function($) {
|
|
$("#rss-feeds").rss("https://anchor.fm/s/af11b98/podcast/rss", {
|
|
limit: 1000,
|
|
tokens: {
|
|
enclosure: function (entry, tokens) {
|
|
if (entry.enclosure) {
|
|
return `${entry.enclosure.url}`;
|
|
}
|
|
return "";
|
|
},
|
|
},
|
|
layoutTemplate: "{entries}",
|
|
entryTemplate:"<table class=\"entry\" style=\"overflow:hidden;word-wrap:break-word;border-width:2; border-style:solid; max-width: 100%; width: 100%; border-color: transparent;\"cellpadding=\"3\"><tr><td class=\"entry\"style=\"background-color: #0FF404; color: #0FF00; \"><b><a href=\"{enclosure}\" onclick=\"play('{enclosure}',`{title}`,'{date}', `{shortBodyPlain}`); return false;\" style=\"color: #0FF00;\" target=\"_blank\">{title}</a></b></td></tr>\n<tr><td class=\"entry\"style=\"width:100%; overflow: hidden; word-wrap: break-word;background-color: transparent; color: #ffffff; padding-top: 10px;\"><i><b>{date}</b></i><br><p>{bodyPlain}</p></td></tr><tr>",
|
|
dateFormat: 'DD/MM/YYYY',
|
|
dateLocale: 'fr-ca',
|
|
});
|
|
$("#lastephome").rss("https://anchor.fm/s/af11b98/podcast/rss", {
|
|
limit: 1,
|
|
tokens: {
|
|
enclosure: function (entry, tokens) {
|
|
if (entry.enclosure) {
|
|
return `${entry.enclosure.url}`;
|
|
}
|
|
return "";
|
|
},
|
|
},
|
|
layoutTemplate: "{entries}",
|
|
entryTemplate:"<table class=\"entry\" style=\"overflow:hidden;word-wrap:break-word;border-width:2; border-style:solid; max-width: 100%; width: 100%; border-color: transparent;\"cellpadding=\"3\"><tr><td class=\"entry\"style=\"background-color: #0FF404; color: #0FF00; \"><b><a href=\"{enclosure}\" onclick=\"play('{enclosure}',`{title}`,'{date}', `{shortBodyPlain}`); switchTab(); return false;\" style=\"color: #0FF00;\" target=\"_blank\">{title}</a></b></td></tr>\n<tr><td class=\"entry\"style=\"width:100%; overflow: hidden; word-wrap: break-word;background-color: transparent; color: #ffffff; padding-top: 10px;\"><i><b>{date}</b></i><br><p>{bodyPlain}</p></td></tr><tr>",
|
|
dateFormat: 'DD/MM/YYYY',
|
|
dateLocale: 'fr-ca',
|
|
});
|
|
|
|
$("#playerwindow").draggable();
|
|
|
|
$("#playerwindow").data({
|
|
'originalLeft': $("#playerwindow").css('left'),
|
|
'origionalTop': $("#playerwindow").css('top')
|
|
});
|
|
$(".reset").click(function() {
|
|
$("#playerwindow").css({
|
|
'left': $("#playerwindow").data('originalLeft'),
|
|
'top': $("#playerwindow").data('origionalTop')
|
|
});
|
|
topFunction();
|
|
});
|
|
|
|
$(".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');
|
|
console.log(audio.src);
|
|
|
|
// check if ep is in cache
|
|
|
|
checkepcache();
|
|
|
|
// cookie last playback
|
|
if (Cookies.get("lastep-title")) {
|
|
console.log("playback function")
|
|
document.getElementById("lienep").innerHTML= Cookies.get("lastep-title");
|
|
document.getElementById("sbody").innerHTML= Cookies.get("lastep-body") + "....";
|
|
document.getElementById("player").setAttribute('src', Cookies.get("lastep-src"));
|
|
document.getElementById("lienep").href = Cookies.get("lastep-src");
|
|
document.getElementById("player").currentTime =Cookies.get("lastep-time");
|
|
}
|
|
|
|
audio.addEventListener('timeupdate',function(){
|
|
var currentTime = audio.currentTime;
|
|
Cookies.set("lastep-time", currentTime);
|
|
var currentTime = audio.currentTime;
|
|
Cookies.set("lastep-time", currentTime, { expires: 365 });
|
|
},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
|
|
|
|
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) {
|
|
var audio = document.getElementById('player');
|
|
console.log(src);
|
|
console.log(title);
|
|
var linkenc = src.substring(src.lastIndexOf('/')+1);
|
|
var linkdec = decodeURIComponent(linkenc);
|
|
console.log(linkdec)
|
|
document.getElementById("lienep").innerHTML= title;
|
|
document.getElementById("sbody").innerHTML= body + "....";
|
|
document.getElementById("lienep").href= linkdec;
|
|
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-body", body, { expires: 365 });
|
|
checkepcache();
|
|
}
|
|
|
|
function switchTab() {
|
|
$('[href="#ep"]').tab('show');
|
|
}
|
|
|
|
function topFunction() {
|
|
document.body.scrollTop = 0; // safari
|
|
document.documentElement.scrollTop = 0; // webkit
|
|
}
|
|
|
|
function imagewow() {
|
|
var imlocation = "assets/img/maymay/";
|
|
|
|
function ImageArray(n) {
|
|
this.length = n;
|
|
for (var i = 1; i <= n; i++) {
|
|
this[i] = ' '
|
|
}
|
|
}
|
|
image = new ImageArray(7);
|
|
image[0] = 'dimanche.png';
|
|
image[1] = 'lundi.jpg';
|
|
image[2] = 'mardi.png';
|
|
image[3] = 'mercredi.png';
|
|
image[4] = 'jeudi.jpg';
|
|
image[5] = 'vendredi.jpg';
|
|
image[6] = 'samedi.jpg';
|
|
var currentdate = new Date();
|
|
var imagenumber = currentdate.getDay();
|
|
document.getElementById("meme").src = imlocation + image[imagenumber];
|
|
}
|
|
|
|
|
|
|
|
|