!function(){function e(){$("#facebook-code-link").attr("href","https://www.facebook.com/sharer/sharer.php?u=https://zoff.me/"),$("#facebook-code-link").attr("onclick","window.open('https://www.facebook.com/sharer/sharer.php?u=https://zoff.me/', 'Share Zoff','width=600,height=300'); return false;"),$("#twitter-code-link").attr("href","https://twitter.com/intent/tweet?url=https://zoff.me/&text=Check%20out%20Zoff!&via=zoffmusic"),$("#twitter-code-link").attr("onclick","window.open('https://twitter.com/intent/tweet?url=https://zoff.me/&text=Check%20out%20Zoff!&via=zoffmusic','Share Playlist','width=600,height=300'); return false;"),$("#qr-code-image-link").attr("src","//chart.googleapis.com/chart?chs=150x150&cht=qr&chl=https://zoff.me/&choe=UTF-8&chld=L%7C1")}function t(){var t=new Date;H.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)&&H.to_channel(t[3],!0)},P=$("#channel-list-container").clone().html(),"fb.zoff.me"!=window.location.hostname&&e(),"zoff.me"==window.location.hostname?add="https://zoff.me":add=window.location.hostname,(void 0===V||Y.mobilecheck()||he)&&(V=io.connect(add+":8080",yt),V.on("update_required",function(){window.location.reload(!0)})),(0===$("#alreadyfp").length||Y.mobilecheck()||!V._callbacks.$playlists||he)&&f(),$("#about").modal(),$("#help").modal(),$("#contact").modal(),$("select").material_select(),Y.log("----"),Y.log("Sending frontpage_lists"),Y.log("Socket",V),Y.log("-----"),R.init(),R.get_offline()?T(!0,Je):$("#offline-mode").tooltip({delay:5,position:"bottom",tooltip:"Enable local mode"}),V.emit("frontpage_lists"),V.emit("get_userlists",R.getCookie("_uI")),$("#channel-load").css("display","none"),"#donation"==window.location.hash&&(window.location.hash="#",$("#donation").modal(),$("#donation").modal("open")),localStorage.ok_cookie||(A(),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")}),!Y.mobilecheck()&&H.winter&&$(".mega").prepend('
'),Y.mobilecheck()&&$("input#searchFrontpage").characterCounter(),window.__onGCastApiAvailable=function(e,t){e&&(Ke=!0)}}function a(){Ze=0;var e=!0;Z=$("#chan").html(),it=Y.mobilecheck();var t=Y.mobilecheck()?"left":"right";if(window.onpopstate=function(e){N()},"fb.zoff.me"!=window.location.hostname&&M(),s="zoff.me"==window.location.hostname?"https://zoff.me":window.location.hostname,void 0!==wt&&(wt.stopInterval=!1),$("ul.playlist-tabs").tabs(),$("ul.playlist-tabs-loggedIn").tabs(),$("ul.chatTabs").tabs(),$("#settings").sideNav({menuWidth:310,edge:t,closeOnClick:!1}),$(".collapsible").collapsible({accordion:!0}),$("#help").modal(),$("#contact").modal(),$("#embed").modal(),$("#user_password").modal({dismissible:!1}),I(Pe),nt=$("#temp-results-container"),st=$("#empty-results-container").html(),De=$(".not-imported-container").html(),Ve=$(".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"),R.set_width($(this).width()),C()},handles:"e",minWidth:350,maxWidth:$(window).width()-241}),(void 0===V||Y.mobilecheck())&&(e=!1,V=io.connect(s+":8080",yt),V.on("update_required",function(){window.location.reload(!0)})),R.init(),i(),R.get_offline()&&($(".offline_switch_class")[0].checked=!0,T(!0,Je)),0===$("#alreadychannel").length||Y.mobilecheck())l(),c(),d(),p();else{$("#channel-load").css("display","none"),$("#player").css("opacity","1"),$("#controls").css("opacity","1"),$(".playlist").css("opacity","1"),wt.readyLooks(),bt.initYoutubeControls(wt.player),bt.initSlider(),wt.player.setVolume(R.get_volume()),$(".video-container").removeClass("no-opacity");var a="https://remote."+window.location.hostname+"/"+lt;$("#code-text").text(lt),$("#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)}if(e){var s="";oe&&(s=R.getCookie("_uI")+"_"),V.emit("list",{channel:s+Z.toLowerCase(),pass:Te?"":R.crypt_pass(R.get_userpass(Z.toLowerCase()))})}$("#viewers").tooltip({delay:5,position:"top",tooltip:"Viewers"}),window.onYouTubeIframeAPIReady=wt.onYouTubeIframeAPIReady,(""===wt.player||void 0===wt.player||Y.mobilecheck())&&wt.loadPlayer(),Y.mobilecheck()?$t.initiate_volume():$("input#chan_description").characterCounter(),u(),h(),m(),Y.mobilecheck()||0!==$("#alreadychannel").length||y(),Y.msieversion()||Y.mobilecheck()||Notification.requestPermission(),$(".search_input").focus(),Y.sample(),$(".castButton-unactive").tooltip({delay:5,position:"top",tooltip:"Cast Zoff to TV"}),$(".castButton-active").tooltip({delay:5,position:"top",tooltip:"Stop casting"}),$("#results").hover(function(){$("div.result").removeClass("hoverResults"),xe=0},function(){}),$("#search").focus(),$("#embed-button").css("display","inline-block"),$("#embed-area").val(k(je,Oe,ze,Fe)),$("#search").attr("placeholder","Find song on YouTube..."),/chrom(e|ium)/.test(navigator.userAgent.toLowerCase())||Y.mobilecheck()||$(".castButton-unactive").css("display","none"),Y.log("chromecastAvailable"+Ye),Y.log("chromecastAvailable"+Ke),Ye?n(1):Ke?initializeCastApi():window.__onGCastApiAvailable=function(e,t){e?setTimeout(function(){Ke=!0,initializeCastApi()},1e3):Ke=!0},$.contextMenu({selector:".playlist-element",reposition:!0,autoHide:!0,items:{copy:{name:"Copy link",callback:function(e,t){var a=$(this[0]).attr("id"),n="https://www.youtube.com/watch?v="+a;$(".copy_video_id").css("display","block"),$(".copy_video_id").text(n),document.querySelector(".copy_video_id").select(),document.execCommand("copy")?Materialize.toast("Copied!",2e3,"green lighten"):Materialize.toast("Error copying..",2e3,"red lighten"),$(".copy_video_id").css("display","none")}},similar:{name:"Find Similar",callback:function(e,t){var a=$(this[0]).attr("id");kt.search(a,!1,!0),Y.contains($(".search-container").attr("class").split(" "),"hide")&&kt.showSearch()}},sep1:"---------",delete:{name:"Delete",callback:function(e,t){var a=$(this[0]).attr("id");W.vote(a,"del")},disabled:function(e,t){return X}}}}),Y.mobilecheck()||null!=navigator.userAgent.match(/iPad/i)||setTimeout(function(){C()},100)}function n(e){if($(".castButton-unactive").toggleClass("hide"),$(".castButton-active").toggleClass("hide"),1==e){$("#duration").toggleClass("hide"),$("#fullscreen").toggleClass("hide");try{wt.player.stopVideo()}catch(e){}wt.stopInterval=!0,$("#player_overlay").removeClass("hide"),$("#player_overlay").css("display","block"),Y.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").css("background","url(https://i.ytimg.com/vi/"+ut+"/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"),$("#playing_on").css("display","flex"),$("#chromecast_text").html("Playing on
"+F.La.friendlyName),wt.player.setVolume(100),$("#player_overlay_text").toggleClass("hide")}else 0==e&&($("#duration").toggleClass("hide"),$("#fullscreen").toggleClass("hide"),wt.player.playVideo(),wt.stopInterval=!1,duration=wt.player.getDuration(),wt.durationSetter(),Y.mobilecheck()||(wt.player.setVolume(R.get_volume()),$("#volume").slider("value",R.get_volume())),$("#player_overlay").addClass("hide"),$("#player_overlay_text").toggleClass("hide"),$("#chromecast_text").html(""),$("#playing_on").css("display","none"),Je?wt.loadVideoById(ut):V.emit("pos",{channel:Z.toLowerCase(),pass:Te?"":R.crypt_pass(R.get_userpass(Z.toLowerCase()))}))}function s(e,t){var a=JSON.parse(t);switch(a.type){case-1:Je?wt.playNext():V.emit("end",{id:a.videoId,channel:Z.toLowerCase(),pass:Te?"":R.crypt_pass(R.get_userpass(Z.toLowerCase()))});break;case 0:Je?wt.playNext():V.emit("skip",{error:a.data_code,id:a.videoId,pass:""==re?"":R.crypt_pass(re),channel:Z.toLowerCase(),userpass:Te?"":R.crypt_pass(R.get_userpass(Z.toLowerCase()))})}}function i(){V.on("auth_required",function(){me=!0,$("#player_overlay").removeClass("hide"),$("#player_overlay").css("display","block"),$("#user_password").modal("open"),R.remove_userpass(Z.toLowerCase())}),V.on("auth_accepted",function(e){e.hasOwnProperty("value")&&e.value&&""!=ue&&(Ce=ue,R.set_userpass(Z.toLowerCase(),Ce))})}function o(){V.on("connect_failed",function(){Y.log("Connection Failed"),Re||(Re=!0,Materialize.toast("Error connecting to server, please wait..",1e8,"red lighten connect_error"))}),V.on("connect_error",function(){Y.log("Connection Failed."),Re||(Re=!0,Materialize.toast("Error connecting to server, please wait..",1e8,"red lighten connect_error"))})}function l(){V.on("np",wt.youtube_listener)}function c(){V.on("get_list",function(){var e="";oe&&(e=R.getCookie("_uI")+"_"),V.emit("list",{channel:e+Z.toLowerCase(),pass:Te?"":R.crypt_pass(R.get_userpass(Z.toLowerCase()))})})}function d(){V.on("suggested",function(e){var t=!0;void 0===e.id&&(t=!1),Ct.catchUserSuggests(e,t)})}function p(){V.on("viewers",function(e){pe=e,void 0!==ht&&wt.getTitle(ht,pe)})}function u(){V.on("toast",O.toast),V.on("pw",O.pw),V.on("conf",O.conf)}function m(){V.on("chat.all",j.allchat),V.on("chat",j.channelchat)}function h(){V.on("channel",W.channel_function)}function f(){Y.log("Setting up playlist_listener"),V.on("playlists",H.frontpage_function)}function y(){V.on("id",J.host_listener)}function v(e){V.on(e,J.host_on_action)}function _(){localStorage.debug=!0}function w(){localStorage.debug=!1}function k(e,t,a,n){return'