!function(){function e(){A=$("#chan").html(),m=window.mobilecheck();var e=window.mobilecheck()?"left":"right";window.onpopstate=function(e){n()},o(),"zoff.no"==window.location.hostname?add="https://zoff.no":add=window.location.hostname,void 0!=ge&&(ge.stopInterval=!1),$("ul.playlist-tabs").tabs(),$("ul.playlist-tabs-loggedIn").tabs(),$(".chatTabs").tabs(),$("#settings").sideNav({menuWidth:300,edge:e,closeOnClick:!1}),$(".collapsible").collapsible({accordion:!0}),u=$("#temp-results-container"),p=$("#empty-results-container").html(),$(".video-container").resizable({start:function(e,t){$("iframe").css("pointer-events","none")},stop:function(e,t){$("iframe").css("pointer-events","auto"),c.set_width($(this).width())},handles:"e",minWidth:350}),L=io.connect(""+add+":8880",ce),ge.setup_youtube_listener(A),s.admin_listener(),P.channel_listener(),L.on("get_list",function(){L.emit("list",A.toLowerCase())}),L.on("suggested",function(e){var t=!0;void 0==e.id&&(t=!1),ye.catchUserSuggests(e,t)}),L.on("viewers",function(e){I=e,void 0!==B&&ge.getTitle(B,I)}),/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream?(document.getElementById("search").blur(),$("#channel-load").css("display","none")):(window.onYouTubeIframeAPIReady=ge.onYouTubeIframeAPIReady,ge.loadPlayer()),window.mobilecheck()&&pe.initiate_volume(),l.setup_chat_listener(A),l.allchat_listener(),window.mobilecheck()||z.host_listener(),d.msieversion()||Notification.requestPermission(),$(".search_input").focus(),ue=$.ajax({type:"GET",url:"https://api.github.com/repos/zoff-music/zoff/commits",async:!1}).responseText,ue=$.parseJSON(ue),$("#latest-commit").html("Latest Commit:
"+ue[0].commit.author.date.substring(0,10)+": "+ue[0].committer.login+"
"+ue[0].sha.substring(0,10)+": "+ue[0].commit.message+"'),$("#search").attr("placeholder","Find song on YouTube...")}function t(e){search_input=$(".search_input").val(),code=e.keyCode||e.which,40!=code&&38!=code&&13!=code&&39!=code&&37!=code&&17!=code&&16!=code&&225!=code&&18!=code&&(clearTimeout(h),search_input.length<3&&$("#results").html(""),13==code?fe.search(search_input):h=setTimeout(function(){fe.search(search_input)},1e3))}function o(){$("#facebook-code-link").attr("href","https://www.facebook.com/sharer/sharer.php?u=https://zoff.no/"+A.toLowerCase()),$("#facebook-code-link").attr("onclick","window.open('https://www.facebook.com/sharer/sharer.php?u=https://zoff.no/"+A.toLowerCase()+"', 'Share Playlist','width=600,height=300'); return false;"),$("#twitter-code-link").attr("href","http://twitter.com/intent/tweet?url=https://zoff.no/"+A.toLowerCase()+"&text=Check%20out%20this%20playlist%20"+A.toLowerCase()+"%20on%20Zöff!&via=zoffmusic"),$("#twitter-code-link").attr("onclick","window.open('http://twitter.com/intent/tweet?url=https://zoff.no/"+A.toLowerCase()+"/&text=Check%20out%20this%20playlist%20"+A.toLowerCase()+"%20on%20Zöff!&via=zoffmusic','Share Playlist','width=600,height=300'); return false;"),$("#qr-code-link").attr("href","//chart.googleapis.com/chart?chs=500x500&cht=qr&chl=https://zoff.no/"+A.toLowerCase()+"&choe=UTF-8&chld=L%7C1"),$("#qr-code-image-link").attr("src","//chart.googleapis.com/chart?chs=150x150&cht=qr&chl=https://zoff.no/"+A.toLowerCase()+"&choe=UTF-8&chld=L%7C1")}function n(){var e=window.location.href.split("/");"#!"==e[3].substr(0,1)||""==e[3]||5==e.length&&"#"==e[4].substr(0,1)?""==e[3]&&($("#channel-load").css("display","block"),window.scrollTo(0,0),ge.stopInterval=!0,s.display_logged_out(),s.beginning=!0,A="",ee=!1,ie=!1,$("#embed-button").css("display","none"),L.removeAllListeners(),$.ajax({url:"php/nochan.php",success:function(e){L.disconnect(),document.getElementById("volume-button").removeEventListener("click",he.mute_video),document.getElementById("playpause").removeEventListener("click",he.play_pause),document.getElementById("fullscreen").removeEventListener("click",he.fullscreen),S="",B="",$("meta[name=theme-color]").attr("content","#2D2D2D"),/iPad|iPhone|iPod/.test(navigator.userAgent)||ge.ytplayer.destroy(),$(".drag-target").remove(),$("#sidenav-overlay").remove(),$("main").attr("class","center-align container"),$("body").attr("id",""),$("body").attr("style",""),$("header").html($($(e)[59]).html()),$($(e)[61]).insertAfter("header"),$($(e)[63]).insertAfter(".mega"),$("main").html($($(e)[67]).html()),$(".page-footer").removeClass("padding-bottom-extra"),$(".page-footer").removeClass("padding-bottom-novideo"),$("#favicon").attr("href","static/images/favicon.png"),1==$("#alreadyfp").length?window.initfp():(window.fromChannel=!0,window.initfp()),0==$("#alreadychannel").length&&$("head").append("
ok",1e4);var o=0;document.getElementById("zicon").addEventListener("click",function(){o+=10,document.getElementById("zicon").style.paddingLeft=o+"%",o>=100&&(window.location.href="http://etys.no")}),!window.mobilecheck()&&me.winter&&me.start_snowfall(),ue=$.ajax({type:"GET",url:"https://api.github.com/repos/zoff-music/zoff/commits",async:!1}).responseText,ue=$.parseJSON(ue),$("#latest-commit").html("Latest Commit:
"+ue[0].commit.author.date.substring(0,10)+": "+ue[0].committer.login+"
"+ue[0].sha.substring(0,10)+": "+ue[0].commit.message+"150||(e.value.startsWith("/name ")?l.namechange(e.value.substring(6)):e.value.startsWith("/removename")?l.removename():"#all_chat"==$(".chat-tab-li a.active").attr("href")?L.emit("all,chat",e.value):L.emit("chat",e.value),e.value="")},allchat_listener:function(){L.on("chat.all",function(e){q||":"!=e[1].substring(0,1)||se||($("#favicon").attr("href","static/images/highlogo.png"),q=!0,O=!0,re=!0,le||l.chat_blink()),document.hidden&&$("#favicon").attr("href","static/images/highlogo.png");var t=d.intToARGB(d.hashCode(e[0]));if(t.length<6)for(x=t.length;x<6;x++)t="0"+t;t=d.hexToRgb(t.substring(0,6));var o=d.rgbToHsl([t.r,t.g,t.b],!1);$("#chatall").append("
  • "+e[0]+"
  • ");var n=document.createTextNode(e[1]);$("#chatall li:last")[0].appendChild(n),document.getElementById("chatall").scrollTop=document.getElementById("chatall").scrollHeight})},setup_chat_listener:function(e){L.on("chat",function(e){q||":"!=e[1].substring(0,1)||se||($("#favicon").attr("href","static/images/highlogo.png"),O=!0,re=!0,le||l.chat_blink());var t=d.intToARGB(d.hashCode(e[0]));if(t.length<6)for(x=t.length;x<6;x++)t="0"+t;t=d.hexToRgb(t.substring(0,6));var o=d.rgbToHsl([t.r,t.g,t.b],!1);$("#chatchannel").append("
  • "+e[0]+"
  • ");var n=document.createTextNode(e[1]);$("#chatchannel li:last")[0].appendChild(n),document.getElementById("chatchannel").scrollTop=document.getElementById("chatchannel").scrollHeight})},chat_blink:function(){le=!0,$(".chat-link").attr("style","color: grey !important;"),setTimeout(function(){$(".chat-link").attr("style","color: white !important;"),setTimeout(function(){le&&l.chat_blink()},1e3)},1e3)}},c={conf_pass:void 0,init:function(){document.cookie=A.toLowerCase()+"=; path=/"+A.toLowerCase()+"; expires="+new Date(0).toUTCString();try{conf_arr=c.decrypt(c.getCookie("_opt"),"_opt")}catch(e){conf_arr=c.decrypt(c.create_cookie("_opt"),"_opt")}try{c.conf_pass=c.decrypt(c.getCookie(A.toLowerCase()),A.toLowerCase())}catch(e){c.conf_pass=c.decrypt(c.create_cookie(A.toLowerCase()),A.toLowerCase())}z.change_enabled(conf_arr.remote),100!=conf_arr.width&&ge.set_width(conf_arr.width),void 0!=conf_arr.name&&""!=conf_arr.name&&l.namechange(conf_arr.name)},decrypt:function(e,t){void 0===c.getCookie(t)&&(e=c.create_cookie(t));var o=CryptoJS.AES.decrypt(e,navigator.userAgent+navigator.languages,{mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7});return $.parseJSON(o.toString(CryptoJS.enc.Utf8))},decrypt_pass:function(e){var t=CryptoJS.AES.decrypt(e,L.id,{mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7});return t.toString(CryptoJS.enc.Utf8)},encrypt:function(e,t){var o=JSON.stringify(e),n=CryptoJS.AES.encrypt(o,navigator.userAgent+navigator.languages,{mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7}),a=new Date;a.setFullYear(a.getFullYear()+1),document.cookie=t+"="+n.toString()+";expires="+a.toGMTString()+";path=/;"},encrypt_string:function(e){var t=CryptoJS.AES.encrypt(e,L.id,{mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7});return t.toString()},get_volume:function(){return c.decrypt(c.getCookie("_opt"),"_opt").volume},set_volume:function(e){conf_arr.volume=e,c.encrypt(conf_arr,"_opt")},create_cookie:function(e){"_opt"==e?cookie_object={volume:100,width:100,remote:!0,name:""}:cookie_object={passwords:{}};var t=JSON.stringify(cookie_object),o=CryptoJS.AES.encrypt(t,navigator.userAgent+navigator.languages,{mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7}),n=new Date;return n.setFullYear(n.getFullYear()+1),document.cookie=e+"="+o.toString()+";expires="+n.toGMTString()+";path=/;",c.getCookie(e)},set_pass:function(e,t){c.conf_pass.passwords[e]=t,c.encrypt(c.conf_pass,e)},remove_pass:function(e){delete c.conf_pass.passwords[e],c.encrypt(c.conf_pass,e.toLowerCase())},set_name:function(e){conf_arr.name=e,c.encrypt(conf_arr,"_opt")},remove_name:function(){conf_arr.name="",c.encrypt(conf_arr,"_opt")},get_pass:function(e){return void 0!=c.conf_pass?c.conf_pass.passwords[e]:void 0},set_remote:function(e){conf_arr.remote=e,c.encrypt(conf_arr,"_opt")},get_remote:function(e){return conf_arr.remote},crypt_pass:function(e){var t=CryptoJS.AES.encrypt(e,L.id,{mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7});return t.toString()},get_width:function(){return conf_arr.width},set_width:function(e){conf_arr.width=e,c.encrypt(conf_arr,"_opt")},getCookie:function(e){var t="; "+document.cookie,o=t.split("; "+e+"=");return 2==o.length?o.pop().split(";").shift():void 0}};window.mobilecheck=function(){var e=!1;return function(t){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4)))&&(e=!0)}(navigator.userAgent||navigator.vendor||window.opera),e};var d={rnd:function(e){return e[Math.floor(Math.random()*e.length)]},predicate:function(){for(var e,t,o,n=[],a=arguments.length,i=function(e,t){return e===t?0:t>e?-1:1},s=function(e,t){var o=i,n=i;return e&&(n=function(t,n){return o(e(t),e(n))}),t?function(e,t){return-1*n(e,t)}:n},r=0;a>r;r++)e=arguments[r],"string"==typeof e?(t=e,o=i):(t=e.name,o=s(e.primer,e.reverse)),n.push({name:t,cmp:o});return function(t,o){for(var i,s,r=0;a>r&&(s=0,e=n[r],i=e.name,s=e.cmp(t[i],o[i]),0===s);r++);return s}},hashCode:function(e){for(var t=0,o=0;o>24&255).toString(16)+(e>>16&255).toString(16)+(e>>8&255).toString(16)+(255&e).toString(16)},hexToRgb:function(e){var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null},pad:function(e){return 10>e?"0"+Math.floor(e):Math.floor(e)},contains:function(e,t){for(var o=e.length;o--;)if(e[o]===t)return!0;return!1},sample:function(){Date.now()-X>=2*K&&(L.removeAllListeners(),L.disconnect(),L.connect(),ge.setup_all_listeners()),X=Date.now(),setTimeout(d.sample,K)},loadjsfile:function(e){if(-1==G.indexOf("["+e+"]")){var t=document.createElement("script");t.setAttribute("type","text/javascript"),t.setAttribute("src",e),document.getElementsByTagName("head")[0].appendChild(t),G+="["+e+"]"}},msieversion:function(){var e=window.navigator.userAgent,t=e.indexOf("MSIE ");return t>0||navigator.userAgent.match(/Trident.*rv\:11\./)?!0:!1},getRandomInt:function(e,t){return Math.floor(Math.random()*(t-e))+e},rgbToHsl:function(e,t){r=e[0],g=e[1],b=e[2],r/=255,g/=255,b/=255;var o,n,a=Math.max(r,g,b),i=Math.min(r,g,b),s=(a+i)/2;if(a==i)o=n=0;else{var l=a-i;switch(n=s>.5?l/(2-a-i):l/(a+i),a){case r:o=(g-b)/l+(g.5&&t?s=.5:.65>s&&!t&&(s=.65),"hsl("+Math.floor(360*o)+", "+Math.floor(100*n)+"%, "+Math.floor(100*s)+"%)"},componentToHex:function(e){var t=e.toString(16);return 1==t.length?"0"+t:t},rgbToHex:function(e,t,o){return"#"+d.componentToHex(e)+d.componentToHex(t)+d.componentToHex(o)},upperFirst:function(e){return e.substring(0,1).toUpperCase()+e.substring(1).toLowerCase()},addClass:function(e,t){d.contains($(e).attr("class").split(" "),t)||$(e).addClass(t)},send_mail:function(e,t){if(""!=e&&""!=t){$("#submit-contact-form").addClass("hide"),$("#send-loader").removeClass("hide"),$("#contact-form-from").attr("disabled","true"),$("#contact-form-message").attr("disabled","true");var e=$("#contact-form-from").val(),t=$("#contact-form-message").val();$("#contact-container").empty(),newWindow=window.open("mailto:contact@zoff.no?Subject=Contact%20Zoff&Body="+t,"_blank"),$("#contact-container").html("Something went wrong, sorry about that. You could instead try with your own mail-client: contact@zoff.no"),setTimeout(function(){newWindow.close()},500)}}};$(document).on("submit","#contact-form",function(e){e.preventDefault();var t=$("#contact-form-message").val(),o=$("#contact-form-from").val();d.send_mail(o,t)}),Element.prototype.remove=function(){this.parentElement.removeChild(this)},NodeList.prototype.remove=HTMLCollection.prototype.remove=function(){for(var e=0,t=this.length;t>e;e++)this[e]&&this[e].parentElement&&this[e].parentElement.removeChild(this[e])},String.prototype.startsWith=function(e,t){return t=t||0,this.indexOf(e,t)===t};var u,p,m,h,f,y,v,w,k,_,C,I,S,T,E,B,M,L,z={enabled:!0,host_listener:function(){var e;L.on("id",function(t){void 0===e?e=t:(L.removeAllListeners(t),ee=!1,e=t);var o="https://remote."+window.location.hostname+"/"+t;$("#code-text").text(t),$("#code-qr").attr("src","https://chart.googleapis.com/chart?chs=221x221&cht=qr&choe=UTF-8&chld=L|1&chl="+o),$("#code-link").attr("href",o),ee||(ee=!0,L.on(t,function(e){enabled&&("volume"==e[0]?($("#volume").slider("value",e[1]),ge.ytplayer.setVolume(e[1]),localStorage.setItem("volume",e[1]),he.choose_button(e[1],!1)):"channel"==e[0]?(console.log("changing channel"),L.emit("change_channel"),s.beginning=!0,A=e[1].toLowerCase(),$("#chan").html(d.upperFirst(A)),N=!0,L.emit("list",A.toLowerCase()),window.history.pushState("object or string","Title","/"+A.toLowerCase())):"pause"==e[0]?ge.ytplayer.pauseVideo():"play"==e[0]?ge.ytplayer.playVideo():"skip"==e[0]&&P.skip())}))}),$("input[class=remote_switch_class]").change(function(){enabled=document.getElementsByName("remote_switch")[0].checked,c.set_remote(enabled)})},change_enabled:function(e){enabled=e,document.getElementsByName("remote_switch")[0].checked=enabled}},P={empty:!1,channel_listener:function(){L.on("channel",function(e){P.channel_function(e)})},channel_function:function(e){switch(e[0]){case"list":P.populate_list(e[1]);break;case"added":P.added_song(e[1]);break;case"deleted":P.deleted_song(e[1]);break;case"vote":P.voted_song(e[1],e[2]);break;case"song_change":P.song_change(e[1])}},populate_list:function(e){void 0==D&&(D=$("#list-song-html").html()),y=e,P.sortList(),$("#wrapper").empty(),y.length>1?($.each(y,function(e,t){t.now_playing||$("#wrapper").append(P.generateSong(t,!1,oe,!0))}),oe&&(window.mobilecheck()?$(".list-image").lazyload({}):($(".list-image").lazyload({container:$("#wrapper")}).removeClass("lazy"),document.getElementById("wrapper").scrollTop+=1,document.getElementById("wrapper").scrollTop+=-1))):(P.empty=!0,$("#wrapper").append("The playlist is empty.")),$("#settings").css("visibility","visible"),$("#settings").css("opacity","1"),$("#wrapper").css("opacity","1")},added_song:function(e){y.push(e),P.sortList(),$("#suggested-"+e.id).remove(),P.empty&&($("#empty-channel-message").remove(),P.empty=!1),P.insertAtIndex(e,!0)},deleted_song:function(e){var t=P.getIndexOfSong(e),o=$("#wrapper").children()[t];try{o.style.height=0,setTimeout(function(){$("#"+e).remove(),y.splice(P.getIndexOfSong(e),1)},305),document.getElementById("wrapper").scrollTop+=1,document.getElementById("wrapper").scrollTop+=-1}catch(n){y.splice(P.getIndexOfSong(e),1),P.empty||$("#wrapper").children()[$("#wrapper").children().length-1].remove()}y.length<=2&&(P.empty=!0,$("#wrapper").append("The playlist is empty.")),$("#suggested-"+e).remove(),ye.checkUserEmpty()},voted_song:function(e,t){var o=P.getIndexOfSong(e),n=y[o];y[o].votes+=1,y[o].added=t,P.sortList(),$("#"+e).remove(),P.insertAtIndex(n,!1)},song_change:function(e){var t=y.length-1;y[0].now_playing=!0,y[0].votes=0,y[0].guids=[],y[0].added=e,y[t].now_playing=!1;try{y.push(y.shift()),P.empty||$("#wrapper").children()[0].remove(),P.insertAtIndex(y[t-1],!1),document.getElementById("wrapper").scrollTop+=1,document.getElementById("wrapper").scrollTop+=-1}catch(o){}},vote:function(e,t){return L.emit("vote",[A,e,t,J]),!0},skip:function(){return L.emit("skip",{pass:J,id:S}),!0},importOldList:function(e){var t="",o=0;playlist_url="lists/"+e+".json",T=$.parseJSON($.ajax({type:"GET",url:playlist_url,async:!1}).responseText),$.each(T.songs,function(e,n){t+=n.id+",",o>45&&(fe.addVideos(t),t="",o=0),o++}),fe.addVideos(t),document.getElementById("search").value=""},sortList:function(){y.sort(d.predicate({name:"votes",reverse:!0},"added"))},show:function(){window.mobilecheck()||(V?(V=!1,$("#toptitle").empty(),$("#chan").addClass("bigChan"),$("#chan").html("zoff.no/"+A.toLowerCase())):(V=!0,$("#toptitle").html("Zöff"),$("#chan").removeClass("bigChan"),$("#chan").html(A)))},insertAtIndex:function(e,t){te=P.getIndexOfSong(e.id),0===te?$("#wrapper").prepend(P.generateSong(e,t,!1,!0,!1)):$("#wrapper > div:nth-child("+te+")").after(P.generateSong(e,t,!1,!0,!1));var o=$("#wrapper").children()[te];t&&setTimeout(function(){$(o).css("height",66)},5)},generateSong:function(e,t,o,n,a){var i,s,r=e.id,l=e.title,c=e.votes,d="background-image:url('//img.youtube.com/vi/"+r+"/mqdefault.jpg');",u=$("
    "+D+"
    "),p="style";return t&&u.find("#list-song").css("height",0),N||u.find(".card-action").removeClass("hide"),1==c&&u.find(".vote-text").text("vote"),o&&(d="//img.youtube.com/vi/"+r+"/mqdefault.jpg",p="data-original"),n?(u.find(".list-votes").text(c),u.find("#list-song").attr("id",r),u.find(".vote-container").attr("title",l),i=".vote-container",s="del"):n||(u.find(".vote-text").text(e.duration),i=".add-suggested",s=a?"del_user_suggested":"del_suggested",u.find(".vote-container").attr("class","clickable add-suggested"),u.find(".add-suggested").attr("title",l),u.find("#del").attr("id",s),u.find(i).attr("data-video-title",l),u.find(i).attr("data-video-length",e.length),u.find("#list-song").attr("id","suggested-"+r),u.find(".list-image").attr("class",u.find(".list-image").attr("class").replace("list-image","list-suggested-image"))),u.find(".list-title").text(l),u.find(".list-title").attr("title",l),u.find(i).attr("data-video-id",r),u.find(".list-image").attr(p,d),u.find(".list-suggested-image").attr(p,d),u.find("#"+s).attr("data-video-id",r),u.html()},getIndexOfSong:function(e){return indexes=$.map(y,function(t,o){return t.id==e?o:void 0}),indexes[0]},scrollTop:function(){$("#wrapper").scrollTop(0)},scrollBottom:function(){$("#wrapper").scrollTop($("#wrapper")[0].scrollHeight)}},A=void 0==window.chan?$("#chan").html():window.chan,N=!0,j=0,V=!0,D=$("#list-song-html").html(),q=!1,O=!1,H="***REMOVED***",R=!1,Y=/P((([0-9]*\.?[0-9]*)Y)?(([0-9]*\.?[0-9]*)M)?(([0-9]*\.?[0-9]*)W)?(([0-9]*\.?[0-9]*)D)?)?(T(([0-9]*\.?[0-9]*)H)?(([0-9]*\.?[0-9]*)M)?(([0-9]*\.?[0-9]*)S)?)?/,v=[],F=0,U=1,J="",G="",W=!1,I=1,Z=!1,Q=!1,K=6e3,X=Date.now(),ee=!1,te=-1,oe=!0,ne=!1,ae=!0,ie=!1,se=!1,re=!1,le=!1,ce={"sync disconnect on unload":!0,secure:!0,"force new connection":!0};navigator.serviceWorker?navigator.serviceWorker.register("/service-worker.js",{scope:"/"}).then(function(e){console.log(e)})["catch"](function(e){console.error(e)}):console.log("Service Worker is not supported in this browser."),$().ready(function(){window.fromFront||"/"==window.location.pathname||e()}),window.init=e,$(document).keyup(function(e){27==event.keyCode&&($("#results").html(""),d.contains($("#search-wrapper").attr("class").split(" "),"hide")||$("#search-wrapper").toggleClass("hide"),d.contains($("#song-title").attr("class").split(" "),"hide")&&$("#song-title").toggleClass("hide"),"mdi-navigation-close"==$("#search-btn i").attr("class")&&($("#search-btn i").toggleClass("mdi-navigation-close"),$("#search-btn i").toggleClass("mdi-action-search")),$("#results").toggleClass("hide"))}),$("input[class=conf]").change(function(){s.save()}),$("#clickme").click(function(){ge.ytplayer.playVideo(); }),$(document).on("submit","#listImport",function(){fe.importPlaylist(document.getElementById("import").value)}),$(window).focus(function(){$("#favicon").attr("href","static/images/favicon.png"),O=!1}),$(document).on("change","#autoplay",function(){this.checked?$("#embed-area").val(''):$("#embed-area").val('')}),$(document).on("click","#playbutton_remote",function(e){e.preventDefault(),pe.play_remote()}),$(document).on("click","#pausebutton_remote",function(e){e.preventDefault(),pe.pause_remote()}),$(document).on("click","#skipbutton_remote",function(e){e.preventDefault(),pe.skip_remote()}),$(document).on("submit","#remoteform",function(e){e.preventDefault(),pe.get_input($("#remote_channel").val())}),$(document).on("click","#chat-btn",function(){$("#text-chat-input").focus(),$("#chat-btn i").css("opacity",1),clearInterval(w),q=!1,O=!1,$("#favicon").attr("href","static/images/favicon.png")}),/iPad|iPhone|iPod/.test(navigator.userAgent)?$(document).on("keydown",".search_input",function(e){t(e)}):$(document).on("keyup",".search_input",function(e){t(e)}),$(document).on("click",".chat-tab",function(){$("#text-chat-input").focus()}),$(document).on("click","#skip",function(e){e.preventDefault(),P.skip()}),$(document).on("click","#chan",function(e){e.preventDefault(),P.show()}),$(document).on("submit","#adminForm",function(e){e.preventDefault(),s.pass_save()}),$(document).on("click",".chat-link",function(e){se=!0,O=!1,re=!1,$(".chat-link").attr("style","color: white !important;"),le=!1,$("#favicon").attr("href","static/images/favicon.png"),$("#chatPlaylist").css("display","block"),$("#wrapper").css("display","none"),$("#suggestions").css("display","none"),$("#text-chat-input").focus()}),$(document).on("click",".playlist-link",function(e){se=!1,$("#chatPlaylist").css("display","none"),$("#wrapper").css("display","block"),$("#suggestions").css("display","none")}),$(document).on("click",".suggested-link",function(e){se=!1,$("#chatPlaylist").css("display","none"),$("#wrapper").css("display","none"),$("#suggestions").css("display","block")}),$(document).on("submit","#chatForm",function(e){e.preventDefault(),l.chat(document.getElementById("chatForm").input)}),$(document).on("click","#shuffle",function(e){e.preventDefault(),s.shuffle()}),$(document).on("click","#search-btn",function(e){e.preventDefault(),fe.showSearch()}),$(document).on("click","#song-title",function(e){e.preventDefault(),fe.showSearch()}),$(document).on("click","#admin-lock",function(e){e.preventDefault(),s.log_out()}),$(document).on("click","#closeSettings",function(e){e.preventDefault(),s.hide_settings()}),$(document).on("click",".result-object",function(e){var t=$(e.target),o=t.prop("outerHTML").substring(0,4);if("=t&&""==J||80>=t&&t>=48&&""!=J)&&$("#wrapper").scrollTop()>0?($("#top-button").removeClass("hide"),d.addClass("#bottom-button","hide")):t>=$("#playlist").height()-18&&$("#wrapper").scrollTop()<$("#wrapper")[0].scrollHeight-$("#wrapper").height()-1?($("#bottom-button").removeClass("hide"),d.addClass("#top-button","hide")):(d.addClass("#bottom-button","hide"),d.addClass("#top-button","hide"))}),$(document).on("mouseleave","#playlist",function(){d.addClass("#bottom-button","hide"),d.addClass("#top-button","hide")}),$(document).on("click","#top-button",function(){P.scrollTop()}),$(document).on("click","#bottom-button",function(){P.scrollBottom()});var de,ue,L,pe={id:"",get_input:function(e){""==pe.id?pe.set_id(e):pe.set_channel(e)},set_id:function(e){pe.id=e,$("#pausebutton_remote").attr("disabled",!1),$("#skipbutton_remote").attr("disabled",!1),$("#playbutton_remote").attr("disabled",!1),$("#skipbutton_remote").attr("disabled",!1),$("#remote_channel").val(""),$("#remote_channel").attr("placeholder","Change channel"),$("#remote_header").html("Controlling "+e),$("#volume-control-remote").css("display","block")},set_channel:function(e){L.emit("id",[pe.id,"channel",e])},play_remote:function(){L.emit("id",[pe.id,"play","mock"])},pause_remote:function(){L.emit("id",[pe.id,"pause","mock"])},skip_remote:function(){L.emit("id",[pe.id,"skip","mock"])},initiate_volume:function(){$("#volume-control-remote").slider({min:0,max:100,value:100,range:"min",animate:!0,stop:function(e,t){L.emit("id",[pe.id,"volume",t.value]),console.log("volume")}})}},U=!0;window.mobilecheck=function(){var e=!1;return function(t){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4)))&&(e=!0)}(navigator.userAgent||navigator.vendor||window.opera),e};var me={blob_list:[],winter:!1,times_rotated:0,populate_channels:function(e){var t,o="",n=0;1==e[0][5]&&(t=e.shift()),e.sort(me.sortFunction),void 0!==t&&e.unshift(t),pre_card=$(de),window.mobilecheck()||me.add_backdrop(e,0);for(x in e){var a=e[x][3];if(12>n){var i=e[x][1],s=e[x][0],r="background-image:url('https://img.youtube.com/vi/"+i+"/hqdefault.jpg');",l=e[x][4],c=pre_card;1==e[x][5]?(c.find(".pin").attr("style","display:block;"),c.find(".card").attr("title","Pinned!")):(c.find(".pin").attr("style","display:none;"),c.find(".card").attr("title","")),c.find(".chan-name").text(a),c.find(".chan-name").attr("title",a),c.find(".chan-views").text(s),c.find(".chan-songs").text(l),c.find(".chan-bg").attr("style",r),c.find(".chan-link").attr("href",a),$("#channels").append(c.html())}o+="