function playAudio5(target){if($('#'+target).hasClass('playing')==true){$('#'+target).removeClass('playing');$('#'+target+'_button').removeClass('playing');document.getElementById(target).pause();}else{$('audio.playing').each(function(){thisid=$(this).attr('id');document.getElementById(thisid).pause();$('#'+thisid+'_button').removeClass('playing');$('#'+thisid).removeClass('playing');});document.getElementById(target).play();$('#'+target).addClass('playing');$('#'+target+'_button').addClass('playing');}}
function slabAudioTracks3x(element,id,prefix){let thisid=0;let player=new Audio();$('#'+element).load('/common/songs/tracks.php',{'prefix':prefix,'elementid':id,},function(){player.id='audio'+id;$('.audiotracks li.hasaudio a.playpause').click(function(){if($(this).parent().hasClass('playing')){$('.audiotracks li.hasaudio.playing').removeClass('playing').addClass('paused');productPlayPauseAudio(player,'stop');}else{$('.audiotracks li.hasaudio').removeClass('playing').addClass('paused');$(this).parent().addClass('playing').removeClass('paused');productPlayPauseAudio(player,'start');}});});}
function slabPodcastTracksLoad3x(prefix){let player=new Audio();slabPodcastTracks3x(player,prefix);}
function slabPodcastTracks3x(player,prefix){let thisid=0;$('.podcasttracks').each(function(){let element=$(this).attr('id');let id=$(this).attr('data-id');$('#'+element).load('/common/podcast/track.php',{'prefix':prefix,'elementid':id,},function(){$('#'+element+' .audiotracks li.hasaudio a.playpause').click(function(){thisid=$(this).parent().attr('id');if($('#'+thisid).hasClass('playing')){$('#'+thisid).removeClass('playing').addClass('paused');playPauseAudioTrack(player,'audio'+id,'stop');}else{$('#main li.hasaudio.playing').removeClass('playing').addClass('paused');$('#'+thisid).removeClass('paused').addClass('playing');playPauseAudioTrack(player,'audio'+id,'start');}});});});}
function slabPodcastTracksEmbed(element,entryid,prefix){let player=new Audio();let thisid=0;$('#'+element).load('/common/podcast/track_embed.php',{'prefix':prefix,'entryid':entryid,},function(){$('#'+element+' .audiotracks li.hasaudio a.playpause').click(function(){thisid=$(this).parent().attr('id');console.log(thisid);if($('#'+thisid).hasClass('playing')){$('#'+thisid).removeClass('playing').addClass('paused');playPauseAudioTrack(player,'audio'+thisid,'stop');}else{$('#main li.hasaudio.playing').removeClass('playing').addClass('paused');$('#'+thisid).removeClass('paused').addClass('playing');playPauseAudioTrack(player,'audio'+thisid,'start');}});});}
function slabAudioTrack3x(element,id,prefix){let thisid=0;let player=new Audio();$('#'+element).load('/common/songs/track.php',{'prefix':prefix,'elementid':id,},function(){$('.audiotracks li.hasaudio a.playpause').click(function(){if($(this).parent().hasClass('playing')){$('.audiotracks li.hasaudio.playing').removeClass('playing').addClass('paused');productPlayPauseAudio(player,'stop');}else{$('.audiotracks li.hasaudio').removeClass('playing').addClass('paused');$(this).parent().addClass('playing').removeClass('paused');productPlayPauseAudio(player,'start');}});});}
function productPlayPauseAudio(player,startstop){let thisid=$('.audiotracks li.hasaudio.playing').attr('id');let asource;let durationvalue=0;let isended;let s;let m;let leftOffset;let leftOffsetxy;let songPercents;$('.audiotracks li.hasaudio.playing .duration').html('');$('.audiotracks li.hasaudio.playing .progress').css('width',0);player.pause();if(startstop=='start'){if($('.audiotracks li.next').hasClass('noaudio')){$('.audiotracks li#'+thisid).next().addClass('skip').removeClass('next paused');productPlayPauseAudio(player,'start');}else{$('.audiotracks li#'+thisid).removeClass('next paused').addClass('playing');$('.audiotracks li#'+thisid).next().addClass('next');asource=$('.audiotracks li#'+thisid).attr('data-src');player.setAttribute('src',asource);player.load();player.play();if(!player.currentTime){$('.audiotracks li.hasaudio.playing .duration').html('0:00');}
$(player).on('timeupdate',function(){s=parseInt(player.currentTime%60);m=parseInt((player.currentTime)/60)%60;if(s<10){s='0'+s;}
$('.audiotracks li.hasaudio.playing .duration').html(m+':'+s);if(player.currentTime>0){durationvalue=((100 / player.duration)*player.currentTime);}
$('.audiotracks li.hasaudio.playing .progress').css('width',durationvalue+'%');});$('.audiotracks li.hasaudio.playing .progress_env').click(function(e){leftOffsetxy=e.target.getBoundingClientRect();leftOffset=e.clientX-leftOffsetxy.left;songPercents=leftOffset / $('.audiotracks li.hasaudio.playing .progress_env').width();player.currentTime=songPercents*player.duration;});player.onended=function(){$('.audiotracks li.hasaudio').removeClass('playing').addClass('paused');$('.audiotracks li.hasaudio.next').addClass('playing').removeClass('paused next');productPlayPauseAudio(player,'start');};}}else{$('.audiotracks li.hasaudio').removeClass('playing').addClass('paused');$('.audiotracks li.hasaudio.next').removeClass('next');player.pause();}}
function playPauseAudioTrack(player,playerid,startstop){let thisid=$('.audiotracks li.hasaudio.playing').parent().attr('id');let asource;let durationvalue=0;let isended;let s;let m;let leftOffset;let leftOffsetxy;let songPercents;let nextaudio;$('.audiotracks li.hasaudio.playing .duration').html('');$('.audiotracks li.hasaudio.playing .progress').css('width',0);if(startstop=='start'){$('.audiotracks#'+thisid+' li').removeClass('next paused').addClass('playing');nextaudio=$('.audiotracks#'+thisid).next().attr('id');asource=$('.audiotracks#'+thisid+' li').attr('data-src');player.setAttribute('src',asource);player.load();player.play();if(!player.currentTime){$('.audiotracks li.hasaudio.playing .duration').html('0:00');}
$(player).on('timeupdate',function(){s=parseInt(player.currentTime%60);m=parseInt((player.currentTime)/60)%60;h=parseInt((player.currentTime)/3600)%3600;if(m<10){m='0'+m;}
if(s<10){s='0'+s;}
$('.audiotracks li.hasaudio.playing .duration').html(h+':'+m+':'+s);if(player.currentTime>0){durationvalue=((100 / player.duration)*player.currentTime);}
$('.audiotracks li.hasaudio.playing .progress').css('width',durationvalue+'%');});$('.audiotracks li.hasaudio.playing .progress_env').click(function(e){leftOffsetxy=e.target.getBoundingClientRect();leftOffset=e.clientX-leftOffsetxy.left;songPercents=leftOffset / $('.audiotracks li.hasaudio.playing .progress_env').width();player.currentTime=songPercents*player.duration;});player.onended=function(){$('.audiotracks li.hasaudio').removeClass('playing').addClass('paused');$('.audiotracks li.hasaudio.next').addClass('playing').removeClass('paused next');productPlayPauseAudio(player,'start');};}else{$('.audiotracks li.hasaudio').removeClass('playing').addClass('paused');$('.audiotracks li.hasaudio.next').removeClass('next');player.pause();}}
function slabResourcePlayPauseAudio(id){let player=new Audio();$('#audiotracks'+id+' li.hasaudio a.playpause').click(function(){if($(this).parent().hasClass('playing')){$('#audiotracks'+id+' li.hasaudio.playing').removeClass('playing').addClass('paused');productPlayPauseAudio(player,'stop');}else{$('#audiotracks'+id+' li.hasaudio').removeClass('playing').addClass('paused');$(this).parent().addClass('playing').removeClass('paused');productPlayPauseAudio(player,'start');}});}