!function(){function e(){$("#facebook-code-link").attr("href","https://www.facebook.com/sharer/sharer.php?u=https://zoff.no/"),$("#facebook-code-link").attr("onclick","window.open('https://www.facebook.com/sharer/sharer.php?u=https://zoff.no/', 'Share Zöff','width=600,height=300'); return false;"),$("#twitter-code-link").attr("href","https://twitter.com/intent/tweet?url=https://zoff.no/&text=Check%20out%20Zöff!&via=zoffmusic"),$("#twitter-code-link").attr("onclick","window.open('https://twitter.com/intent/tweet?url=https://zoff.no/&text=Check%20out%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/&choe=UTF-8&chld=L%7C1"),$("#qr-code-image-link").attr("src","//chart.googleapis.com/chart?chs=150x150&cht=qr&chl=https://zoff.no/&choe=UTF-8&chld=L%7C1")}function t(){var t=new Date;j.blob_list=[],3==t.getMonth()&&1==t.getDate()&&($(".mega").css("-webkit-transform","rotate(180deg)"),$(".mega").css("-moz-transform","rotate(180deg)")),window.onpopstate=function(e){var t=window.location.href.split("/");""!==t[3]&&"#"!=t[3].substring(0,1)&&j.to_channel(t[3],!0)},L=$("#channel-list-container").html(),e(),"zoff.no"==window.location.hostname?add="https://zoff.no":add=window.location.hostname,(void 0===N||O.mobilecheck())&&(N=io.connect(""+add+":8080",nt)),0!==$("#alreadyfp").length&&!O.mobilecheck()&&N._callbacks.$playlists||h(),$("#about").modal(),$("#help").modal(),$("#contact").modal(),O.log("----"),O.log("Sending frontpage_lists"),O.log("Socket",N),O.log("-----"),V.init(),V.get_offline()&&S(!0,Ae),N.emit("frontpage_lists"),$("#channel-load").css("display","none"),"#donation"==window.location.hash&&(window.location.hash="#",$("#donation").modal("open")),localStorage.ok_cookie||Materialize.toast("We're using cookies to enhance your experience! ok",1e4);var a=0;document.getElementById("zicon").addEventListener("click",function(){a+=10,document.getElementById("zicon").style.paddingLeft=a+"%",a>=100&&(window.location.href="http://etys.no")}),!O.mobilecheck()&&j.winter&&$(".mega").prepend('
'),window.__onGCastApiAvailable=function(e,t){e&&(De=!0)}}function a(){var e=!0;U=$("#chan").html(),Ue=O.mobilecheck();var t=O.mobilecheck()?"left":"right";if(window.onpopstate=function(e){B()},E(),"zoff.no"==window.location.hostname?add="https://zoff.no":add=window.location.hostname,void 0!==lt&&(lt.stopInterval=!1),$("ul.playlist-tabs").tabs(),$("ul.playlist-tabs-loggedIn").tabs(),$(".chatTabs").tabs(),$("#settings").sideNav({menuWidth:300,edge:t,closeOnClick:!1}),$(".collapsible").collapsible({accordion:!0}),$("#help").modal(),$("#contact").modal(),$("#embed").modal(),T(we),qe=$("#temp-results-container"),He=$("#empty-results-container").html(),be=$(".not-imported-container").html(),ke=$(".not-exported-container").html(),$(".not-imported-container").empty(),$(".not-exported-container").empty(),$(".video-container").resizable({start:function(e,t){$("iframe").css("pointer-events","none")},stop:function(e,t){$("iframe").css("pointer-events","auto"),V.set_width($(this).width()),k()},handles:"e",minWidth:350,maxWidth:$(window).width()-241}),(void 0===N||O.mobilecheck())&&(e=!1,N=io.connect(""+add+":8080",nt)),V.init(),V.get_offline()&&($(".offline_switch_class")[0].checked=!0,S(!0,Ae)),0===$("#alreadychannel").length||O.mobilecheck())s(),l(),c(),d();else{$("#channel-load").css("display","none"),$("#player").css("opacity","1"),$("#controls").css("opacity","1"),$(".playlist").css("opacity","1"),lt.readyLooks(),rt.initYoutubeControls(lt.player),rt.initSlider(),lt.player.setVolume(V.get_volume()),$(".video-container").removeClass("no-opacity");var a="https://remote."+window.location.hostname+"/"+Ye;$("#code-text").text(Ye),$("#code-qr").attr("src","https://chart.googleapis.com/chart?chs=221x221&cht=qr&choe=UTF-8&chld=L|1&chl="+a),$("#code-link").attr("href",a)}e&&N.emit("list",U.toLowerCase()),window.onYouTubeIframeAPIReady=lt.onYouTubeIframeAPIReady,(""===lt.player||void 0===lt.player||O.mobilecheck())&<.loadPlayer(),O.mobilecheck()&&st.initiate_volume(),p(),m(),u(),O.mobilecheck()||0!==$("#alreadychannel").length||f(),O.msieversion()||O.mobilecheck()||Notification.requestPermission(),$(".search_input").focus(),O.sample(),$(".castButton-unactive").tooltip({delay:5,position:"top",tooltip:"Cast Zöff to TV"}),$(".castButton-active").tooltip({delay:5,position:"top",tooltip:"Stop casting"}),$("#results").hover(function(){$("div.result").removeClass("hoverResults"),pe=0},function(){}),$("#search").focus(),$("#embed-button").css("display","inline-block"),$("#embed-area").val(w(Se,xe,Ce,Le)),$("#search").attr("placeholder","Find song on YouTube..."),/chrom(e|ium)/.test(navigator.userAgent.toLowerCase())||O.mobilecheck()||$(".castButton-unactive").css("display","none"),Be?n(1):De?initializeCastApi():window.__onGCastApiAvailable=function(e,t){e?setTimeout(function(){De=!0,initializeCastApi()},1e3):De=!0},O.mobilecheck()||k()}function n(e){if($(".castButton-unactive").toggleClass("hide"),$(".castButton-active").toggleClass("hide"),1==e){$("#duration").toggleClass("hide"),$("#fullscreen").toggleClass("hide");try{lt.player.stopVideo()}catch(e){}lt.stopInterval=!0,$("#player_overlay").removeClass("hide"),$("#player_overlay").css("display","block"),O.mobilecheck()?$("#pause").hasClass("hide")?($("#play").toggleClass("hide"),$("#pause").toggleClass("hide")):$("#play").hasClass("hide")&&($("#play").toggleClass("hide"),$("#pause").toggleClass("hide")):($("#volume").slider("value",100),$("#player_overlay").width($("#player").width()+1)),$("#player_overlay").css("background","url(https://i.ytimg.com/vi/"+Xe+"/maxresdefault.jpg)"),$("#player_overlay").css("background-position","center"),$("#player_overlay").css("background-size","100%"),$("#player_overlay").css("background-color","black"),$("#player_overlay").css("background-repeat","no-repeat"),$("#player_overlay").css("height","calc(100% - 32px)"),$("#playing_on").css("display","flex"),$("#chromecast_text").html("Playing on
"+R.La.friendlyName),lt.player.setVolume(100),$("#player_overlay_text").toggleClass("hide")}else 0==e&&($("#duration").toggleClass("hide"),$("#fullscreen").toggleClass("hide"),lt.player.playVideo(),lt.stopInterval=!1,duration=lt.player.getDuration(),lt.durationSetter(),O.mobilecheck()||(lt.player.setVolume(V.get_volume()),$("#volume").slider("value",V.get_volume())),$("#player_overlay").addClass("hide"),$("#player_overlay_text").toggleClass("hide"),$("#chromecast_text").html(""),$("#playing_on").css("display","none"),Ae?lt.loadVideoById(Xe):N.emit("pos",{channel:U.toLowerCase()}))}function i(e,t){var a=JSON.parse(t);switch(a.type){case-1:Ae?lt.playNext():N.emit("end",{id:a.videoId,channel:U.toLowerCase()});break;case 0:Ae?lt.playNext():N.emit("skip",{error:a.data_code,id:a.videoId,pass:ae,channel:U.toLowerCase})}}function o(){N.on("connect_failed",function(){O.log("Connection Failed"),Te||(Te=!0,Materialize.toast("Error connecting to server, please wait..",1e8,"red lighten connect_error"))}),N.on("connect_error",function(){O.log("Connection Failed."),Te||(Te=!0,Materialize.toast("Error connecting to server, please wait..",1e8,"red lighten connect_error"))})}function s(){N.on("np",lt.youtube_listener)}function l(){N.on("get_list",function(){N.emit("list",U.toLowerCase())})}function c(){N.on("suggested",function(e){var t=!0;void 0===e.id&&(t=!1),dt.catchUserSuggests(e,t)})}function d(){N.on("viewers",function(e){oe=e,void 0!==tt&<.getTitle(tt,oe)})}function p(){N.on("toast",P.toast),N.on("pw",P.pw),N.on("conf",P.conf)}function u(){N.on("chat.all",z.allchat),N.on("chat",z.channelchat)}function m(){N.on("channel",H.channel_function)}function h(){O.log("Setting up playlist_listener"),N.on("playlists",j.frontpage_function)}function f(){N.on("id",q.host_listener)}function y(e){N.on(e,q.host_on_action)}function v(){localStorage.debug=!0}function _(){localStorage.debug=!1}function w(e,t,a,n){return'