').insertAfter("#wrapper"),$(".prev_page").toggleClass("hide"),$(".next_page").toggleClass("hide"),$(".last_page").toggleClass("hide"),$(".first_page").toggleClass("hide"),$(".next_page_hide").css("display","inline-block"),$(".prev_page_hide").css("display","inline-block")),p.dynamicContentPage(-10)):(p.empty=!0,$("#wrapper").append("The playlist is empty."),$("#pageButtons").length||($('
').insertAfter("#wrapper"),$(".prev_page").toggleClass("hide"),$(".next_page").toggleClass("hide"),$(".last_page").toggleClass("hide"),$(".first_page").toggleClass("hide"),$(".next_page_hide").css("display","inline-block"),$(".prev_page_hide").css("display","inline-block"))),$("#settings").css("visibility","visible"),$("#settings").css("opacity","1"),$("#wrapper").css("opacity","1")},dynamicContentPage:function(e){1==e?($("#wrapper").children().slice(p.page,p.page+p.can_fit).hide(),p.page=p.page+p.can_fit,$("#wrapper").children().slice(p.page,p.page+p.can_fit).show(),p.page>0&&$(".prev_page").hasClass("hide")&&($(".prev_page").toggleClass("hide"),$(".prev_page_hide").css("display","none"),$(".first_page").toggleClass("hide"),$(".first_page_hide").css("display","none")),p.page+p.can_fit>=$("#wrapper").children().length&&($(".next_page_hide").css("display","inline-block"),$(".next_page").css("display","none"),$(".last_page_hide").css("display","inline-block"),$(".last_page").css("display","none"))):10==e?($("#wrapper").children().slice(p.page,p.page+p.can_fit).hide(),p.page=Math.floor(($("#wrapper").children().length-1)/p.can_fit)*p.can_fit,$("#wrapper").children().slice(p.page,p.page+p.can_fit).show(),p.page>0&&$(".prev_page").hasClass("hide")&&($(".prev_page").toggleClass("hide"),$(".prev_page_hide").css("display","none"),$(".first_page").toggleClass("hide"),$(".first_page_hide").css("display","none")),p.page+p.can_fit>=$("#wrapper").children().length&&($(".next_page_hide").css("display","inline-block"),$(".next_page").css("display","none"),$(".last_page_hide").css("display","inline-block"),$(".last_page").css("display","none"))):e==-10?($("#wrapper").children().slice(p.page,p.page+p.can_fit).hide(),p.page=0,$("#wrapper").children().slice(p.page,p.page+p.can_fit).show(),0!=p.page||$(".prev_page").hasClass("hide")?$(".prev_page").hasClass("hide")?($(".prev_page_hide").css("display","inline-block"),$(".first_page_hide").css("display","inline-block")):($(".prev_page_hide").css("display","none"),$(".first_page_hide").css("display","none")):($(".prev_page").toggleClass("hide"),$(".prev_page_hide").css("display","inline-block"),$(".first_page").toggleClass("hide"),$(".first_page_hide").css("display","inline-block")),p.page+p.can_fit<$("#wrapper").children().length&&($(".next_page_hide").css("display","none"),$(".next_page").css("display","inline-block"),$(".last_page_hide").css("display","none"),$(".last_page").css("display","inline-block"))):($("#wrapper").children().slice(p.page-p.can_fit,p.page).show(),$("#wrapper").children().slice(p.page,p.page+p.can_fit).hide(),p.page=p.page-p.can_fit,0!=p.page||$(".prev_page").hasClass("hide")?$(".prev_page").hasClass("hide")?($(".prev_page_hide").css("display","inline-block"),$(".first_page_hide").css("display","inline-block")):($(".prev_page_hide").css("display","none"),$(".first_page_hide").css("display","none")):($(".prev_page").toggleClass("hide"),$(".prev_page_hide").css("display","inline-block"),$(".first_page").toggleClass("hide"),$(".first_page_hide").css("display","inline-block")),p.page+p.can_fit<$("#wrapper").children().length&&($(".next_page_hide").css("display","none"),$(".next_page").css("display","inline-block"),$(".last_page_hide").css("display","none"),$(".last_page").css("display","inline-block"))),$("#pageNumber").html(p.page/p.can_fit+1)},added_song:function(e){var t;0!==full_playlist.length&&(t=full_playlist.pop()),full_playlist.push(e),p.sortList(),t&&full_playlist.push(t),$("#suggested-"+e.id).remove(),p.empty&&(p.empty=!1),$("#empty-channel-message").remove(),p.insertAtIndex(e,!0),$("#wrapper").children().length>p.page+p.can_fit?($(".next_page_hide").css("display","none"),$(".next_page").removeClass("hide"),$(".next_page").css("display","inline-block")):($(".next_page_hide").css("display","inline-block"),$(".next_page").css("display","none"))},deleted_song:function(e){var t=p.getIndexOfSong(e),a=$("#wrapper").children()[t];try{a.style.height=0,setTimeout(function(){$("#"+e).remove(),full_playlist.splice(p.getIndexOfSong(e),1),t=0?$($("#wrapper").children()[p.page-1]).css("display","block"):$("#wrapper").children().length>p.page+(p.can_fit-1)&&$($("#wrapper").children()[p.page+(p.can_fit-1)]).css("display","block"),p.page>=$("#wrapper").children().length?p.dynamicContentPage(-1):p.page+p.can_fit>=$("#wrapper").children().length&&($(".next_page_hide").css("display","inline-block"),$(".next_page").css("display","none")),S&&n.sendNext({title:full_playlist[0].title,videoId:full_playlist[0].id})},305)}catch(a){full_playlist.splice(p.getIndexOfSong(e),1),p.empty||($("#wrapper").children()[$("#wrapper").children().length-1].remove(),t=0?$($("#wrapper").children()[p.page-1]).css("display","block"):$("#wrapper").children().length>p.page+p.can_fit&&$($("#wrapper").children()[p.page+(p.can_fit-1)]).css("display","block"),S&&n.sendNext({title:full_playlist[0].title,videoId:full_playlist[0].id}))}full_playlist.length<=2&&(p.empty=!0,$("#wrapper").append("The playlist is empty.")),$("#suggested-"+e).remove(),p.page+p.can_fit<$("#wrapper").children().length&&($(".next_page_hide").css("display","none"),$(".next_page").css("display","inline-block")),p.page>=$("#wrapper").children().length&&p.dynamicContentPage(-1),Suggestions.checkUserEmpty()},voted_song:function(e,t){var a=p.getIndexOfSong(e),n=full_playlist[a];full_playlist[a].votes+=1,full_playlist[a].added=t,p.sortList(),$("#"+e).remove(),p.insertAtIndex(n,!1)},song_change:function(e){var t=full_playlist.length-1;full_playlist[0].now_playing=!0,full_playlist[0].votes=0,full_playlist[0].guids=[],full_playlist[0].added=e,full_playlist[t].now_playing=!1,o.log("---------------------------"),o.log("---SONG ON FIRST INDEX-----"),o.log(full_playlist[0]),o.log("---------------------------");try{full_playlist.push(full_playlist.shift()),p.empty||$("#wrapper").children()[0].remove(),0===$("#wrapper").children().length&&(p.empty=!0,$("#wrapper").append("The playlist is empty.")),p.insertAtIndex(full_playlist[t-1],!1,!0)}catch(e){}},vote:function(e,t){return s.emit("vote",{channel:T,id:e,type:t,adminpass:k}),!0},skip:function(){return s.emit("skip",{pass:k,id:l,channel:T.toLowerCase()}),!0},exportToYoutube:function(){var e="https://www.googleapis.com/youtube/v3/playlists?part=snippet";$(".exported-list-container").removeClass("hide"),$("#playlist_loader_export").removeClass("hide"),$.ajax({type:"POST",url:e,headers:{Authorization:"Bearer "+access_token_data_youtube.access_token,"Content-Type":"application/json"},data:JSON.stringify({snippet:{title:T.toLowerCase(),description:"Playlist exported from zoff"}}),success:function(e){var t=0,a=e.id;$.each(full_playlist,function(e,n){var i="https://www.googleapis.com/youtube/v3/playlistItems?part=snippet";$.ajax({type:"POST",url:i,headers:{Authorization:"Bearer "+access_token_data_youtube.access_token,"Content-Type":"application/json"},data:JSON.stringify({snippet:{playlistId:a,resourceId:{kind:"youtube#video",videoId:n.id}}}),success:function(e){o.log("Added video: "+n.id+" to playlist id "+a),t==full_playlist.length-1&&(o.log("All videoes added!"),o.log("url: https://www.youtube.com/playlist?list="+a),$(".exported-list").append("
').insertAfter("#wrapper"),$(".prev_page").toggleClass("hide"),$(".next_page").toggleClass("hide"),$(".last_page").toggleClass("hide"),$(".first_page").toggleClass("hide"),$(".next_page_hide").css("display","inline-block"),$(".prev_page_hide").css("display","inline-block")),c.dynamicContentPage(-10)):(c.empty=!0,$("#wrapper").append("The playlist is empty."),$("#pageButtons").length||($('
').insertAfter("#wrapper"),$(".prev_page").toggleClass("hide"),$(".next_page").toggleClass("hide"),$(".last_page").toggleClass("hide"),$(".first_page").toggleClass("hide"),$(".next_page_hide").css("display","inline-block"),$(".prev_page_hide").css("display","inline-block"))),$("#settings").css("visibility","visible"),$("#settings").css("opacity","1"),$("#wrapper").css("opacity","1")},dynamicContentPage:function(e){1==e?($("#wrapper").children().slice(c.page,c.page+c.can_fit).hide(),c.page=c.page+c.can_fit,$("#wrapper").children().slice(c.page,c.page+c.can_fit).show(),c.page>0&&$(".prev_page").hasClass("hide")&&($(".prev_page").toggleClass("hide"),$(".prev_page_hide").css("display","none"),$(".first_page").toggleClass("hide"),$(".first_page_hide").css("display","none")),c.page+c.can_fit>=$("#wrapper").children().length&&($(".next_page_hide").css("display","inline-block"),$(".next_page").css("display","none"),$(".last_page_hide").css("display","inline-block"),$(".last_page").css("display","none"))):10==e?($("#wrapper").children().slice(c.page,c.page+c.can_fit).hide(),c.page=Math.floor(($("#wrapper").children().length-1)/c.can_fit)*c.can_fit,$("#wrapper").children().slice(c.page,c.page+c.can_fit).show(),c.page>0&&$(".prev_page").hasClass("hide")&&($(".prev_page").toggleClass("hide"),$(".prev_page_hide").css("display","none"),$(".first_page").toggleClass("hide"),$(".first_page_hide").css("display","none")),c.page+c.can_fit>=$("#wrapper").children().length&&($(".next_page_hide").css("display","inline-block"),$(".next_page").css("display","none"),$(".last_page_hide").css("display","inline-block"),$(".last_page").css("display","none"))):e==-10?($("#wrapper").children().slice(c.page,c.page+c.can_fit).hide(),c.page=0,$("#wrapper").children().slice(c.page,c.page+c.can_fit).show(),0!=c.page||$(".prev_page").hasClass("hide")?$(".prev_page").hasClass("hide")?($(".prev_page_hide").css("display","inline-block"),$(".first_page_hide").css("display","inline-block")):($(".prev_page_hide").css("display","none"),$(".first_page_hide").css("display","none")):($(".prev_page").toggleClass("hide"),$(".prev_page_hide").css("display","inline-block"),$(".first_page").toggleClass("hide"),$(".first_page_hide").css("display","inline-block")),c.page+c.can_fit<$("#wrapper").children().length&&($(".next_page_hide").css("display","none"),$(".next_page").css("display","inline-block"),$(".last_page_hide").css("display","none"),$(".last_page").css("display","inline-block"))):($("#wrapper").children().slice(c.page-c.can_fit,c.page).show(),$("#wrapper").children().slice(c.page,c.page+c.can_fit).hide(),c.page=c.page-c.can_fit,0!=c.page||$(".prev_page").hasClass("hide")?$(".prev_page").hasClass("hide")?($(".prev_page_hide").css("display","inline-block"),$(".first_page_hide").css("display","inline-block")):($(".prev_page_hide").css("display","none"),$(".first_page_hide").css("display","none")):($(".prev_page").toggleClass("hide"),$(".prev_page_hide").css("display","inline-block"),$(".first_page").toggleClass("hide"),$(".first_page_hide").css("display","inline-block")),c.page+c.can_fit<$("#wrapper").children().length&&($(".next_page_hide").css("display","none"),$(".next_page").css("display","inline-block"),$(".last_page_hide").css("display","none"),$(".last_page").css("display","inline-block"))),$("#pageNumber").html(c.page/c.can_fit+1)},added_song:function(e){var t;0!==full_playlist.length&&(t=full_playlist.pop()),full_playlist.push(e),c.sortList(),t&&full_playlist.push(t),$("#suggested-"+e.id).remove(),c.empty&&(c.empty=!1),$("#empty-channel-message").remove(),c.insertAtIndex(e,!0),$("#wrapper").children().length>c.page+c.can_fit?($(".next_page_hide").css("display","none"),$(".next_page").removeClass("hide"),$(".next_page").css("display","inline-block")):($(".next_page_hide").css("display","inline-block"),$(".next_page").css("display","none"))},deleted_song:function(e){var t=c.getIndexOfSong(e),a=$("#wrapper").children()[t];try{a.style.height=0,setTimeout(function(){$("#"+e).remove(),full_playlist.splice(c.getIndexOfSong(e),1),t=0?$($("#wrapper").children()[c.page-1]).css("display","block"):$("#wrapper").children().length>c.page+(c.can_fit-1)&&$($("#wrapper").children()[c.page+(c.can_fit-1)]).css("display","block"),c.page>=$("#wrapper").children().length?c.dynamicContentPage(-1):c.page+c.can_fit>=$("#wrapper").children().length&&($(".next_page_hide").css("display","inline-block"),$(".next_page").css("display","none")),S&&l.sendNext({title:full_playlist[0].title,videoId:full_playlist[0].id})},305)}catch(a){full_playlist.splice(c.getIndexOfSong(e),1),c.empty||($("#wrapper").children()[$("#wrapper").children().length-1].remove(),t=0?$($("#wrapper").children()[c.page-1]).css("display","block"):$("#wrapper").children().length>c.page+c.can_fit&&$($("#wrapper").children()[c.page+(c.can_fit-1)]).css("display","block"),S&&l.sendNext({title:full_playlist[0].title,videoId:full_playlist[0].id}))}full_playlist.length<=2&&(c.empty=!0,$("#wrapper").append("The playlist is empty.")),$("#suggested-"+e).remove(),c.page+c.can_fit<$("#wrapper").children().length&&($(".next_page_hide").css("display","none"),$(".next_page").css("display","inline-block")),c.page>=$("#wrapper").children().length&&c.dynamicContentPage(-1),Suggestions.checkUserEmpty()},voted_song:function(e,t){var a=c.getIndexOfSong(e),l=full_playlist[a];full_playlist[a].votes+=1,full_playlist[a].added=t,c.sortList(),$("#"+e).remove(),c.insertAtIndex(l,!1)},song_change:function(e){var t=full_playlist.length-1;full_playlist[0].now_playing=!0,full_playlist[0].votes=0,full_playlist[0].guids=[],full_playlist[0].added=e,full_playlist[t].now_playing=!1,n.log("---------------------------"),n.log("---SONG ON FIRST INDEX-----"),n.log(full_playlist[0]),n.log("---------------------------");try{full_playlist.push(full_playlist.shift()),c.empty||$("#wrapper").children()[0].remove(),0===$("#wrapper").children().length&&(c.empty=!0,$("#wrapper").append("The playlist is empty.")),c.insertAtIndex(full_playlist[t-1],!1,!0)}catch(e){}},vote:function(e,t){return s.emit("vote",{channel:T,id:e,type:t,adminpass:C}),!0},skip:function(){return s.emit("skip",{pass:C,id:o,channel:T.toLowerCase()}),!0},exportToYoutube:function(){var e="https://www.googleapis.com/youtube/v3/playlists?part=snippet";$(".exported-list-container").removeClass("hide"),$("#playlist_loader_export").removeClass("hide"),$.ajax({type:"POST",url:e,headers:{Authorization:"Bearer "+access_token_data_youtube.access_token,"Content-Type":"application/json"},data:JSON.stringify({snippet:{title:T.toLowerCase(),description:"Playlist exported from zoff"}}),success:function(e){var t=0,a=e.id;$.each(full_playlist,function(e,l){var i="https://www.googleapis.com/youtube/v3/playlistItems?part=snippet";$.ajax({type:"POST",url:i,headers:{Authorization:"Bearer "+access_token_data_youtube.access_token,"Content-Type":"application/json"},data:JSON.stringify({snippet:{playlistId:a,resourceId:{kind:"youtube#video",videoId:l.id}}}),success:function(e){n.log("Added video: "+l.id+" to playlist id "+a),t==full_playlist.length-1&&(n.log("All videoes added!"),n.log("url: https://www.youtube.com/playlist?list="+a),$(".exported-list").append("
"),m="style";return t?h.find("#list-song").css("height",0):h.find(".list-song").css("height",c.element_height),
+y||h.find(".card-action").removeClass("hide"),1==g&&h.find(".vote-text").text("vote"),a&&(u="//img.youtube.com/vi/"+p+"/mqdefault.jpg",m="data-original"),l?(h.find(".list-votes").text(g),h.find("#list-song").attr("id",p),h.find(".vote-container").attr("title",d),($("#wrapper").children().length>=c.can_fit&&s||"none"==i)&&h.find(".card").css("display","none"),o=".vote-container",r="del"):l||(h.find(".vote-text").text(e.duration),o=".add-suggested",r=n?"del_user_suggested":"del_suggested",h.find(".vote-container").attr("class","clickable add-suggested"),h.find(".add-suggested").attr("title",d),h.find("#del").attr("id",r),h.find(o).attr("data-video-title",d),h.find(o).attr("data-video-length",e.length),h.find("#list-song").attr("id","suggested-"+p),h.find(".list-image").attr("class",h.find(".list-image").attr("class").replace("list-image","list-suggested-image"))),h.find(".list-title").text(d),h.find(".list-title").attr("title",d),h.find(o).attr("data-video-id",p),h.find(".list-image").attr(m,u),h.find(".list-suggested-image").attr(m,u),h.find("#"+r).attr("data-video-id",p),h.html()},getIndexOfSong:function(e){return indexes=$.map(full_playlist,function(t,a){if(t.id==e)return a}),indexes[0]},scrollTop:function(){$("#wrapper").scrollTop(0)},scrollBottom:function(){$("#wrapper").scrollTop($("#wrapper")[0].scrollHeight)}},u="",h=!1,m=!1,f=$("#list-song-html").html(),y=!0,v=!1,_=!0,w=100,C="",k=!1,x=!1,S=!1,I=window.location.hash.substring(1).split("&"),T=I[0],E=!1,B="#808080",M={"sync disconnect on unload":!0,secure:!0,"force new connection":!0};$(document).ready(function(){3==I.length&&"autoplay"==I[2]?E=!0:h=!0,B="#"+I[1],$("head").append(''),$("head").append(''),add="https://zoff.no",s=io.connect(""+add+":8880",M),s.on("get_list",function(){setTimeout(function(){s.emit("list",T.toLowerCase())},1e3)}),s.on("viewers",function(e){viewers=e,void 0!==u&&l.getTitle(u,viewers)}),e(),t(),window.onYouTubeIframeAPIReady=l.onYouTubeIframeAPIReady,l.loadPlayer(),d.initSlider(),window.setVolume=a,$("#controls").css("background-color",B),$("#playlist").css("background-color",B)}),$(document).on("click","#zoffbutton",function(e){window.open("https://zoff.no/"+T.toLowerCase()+"/","_blank")}),$(document).on("click",".vote-container",function(e){var t=$(this).attr("data-video-id");c.vote(t,"pos")}),$(document).on("click",".prev_page",function(e){e.preventDefault(),c.dynamicContentPage(-1)}),$(document).on("click",".next_page",function(e){e.preventDefault(),c.dynamicContentPage(1)})}();
\ No newline at end of file