!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;V.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)&&V.to_channel(t[3],!0)},E=$("#channel-list-container").html(),e();var a={secure:!0,"force new connection":!0};"zoff.no"==window.location.hostname?add="https://zoff.no":add=window.location.hostname,(void 0===L||j.mobilecheck())&&(L=io.connect(""+add+":8080",a)),0!==$("#alreadyfp").length&&!j.mobilecheck()&&L._callbacks.$playlists||m(),j.log("----"),j.log("Sending frontpage_lists"),j.log("Socket",L),j.log("-----"),L.emit("frontpage_lists"),$("#channel-load").css("display","none"),"#donation"==window.location.hash&&(window.location.hash="#",$("#donation").openModal()),localStorage.ok_cookie||Materialize.toast("We're using cookies to enhance your experience! ok",1e4);var n=0;document.getElementById("zicon").addEventListener("click",function(){n+=10,document.getElementById("zicon").style.paddingLeft=n+"%",n>=100&&(window.location.href="http://etys.no")}),!j.mobilecheck()&&V.winter&&$(".mega").prepend('
'),window.__onGCastApiAvailable=function(e,t){e?Le=!0:console.log(t)}}function a(){var e=!0;q=$("#chan").html(),Ve=j.mobilecheck();var t=j.mobilecheck()?"left":"right";if(window.onpopstate=function(e){I()},T(),"zoff.no"==window.location.hostname?add="https://zoff.no":add=window.location.hostname,void 0!==et&&(et.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}),C(ve),Ne=$("#temp-results-container"),ze=$("#empty-results-container").html(),$e=$(".not-imported-container").html(),_e=$(".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"),N.set_width($(this).width())},handles:"e",minWidth:350,maxWidth:$(window).width()-241}),(void 0===L||j.mobilecheck())&&(e=!1,L=io.connect(""+add+":8080",Ze)),0===$("#alreadychannel").length||j.mobilecheck())s(),l(),c(),d();else{$("#channel-load").css("display","none"),$("#player").css("opacity","1"),$("#controls").css("opacity","1"),$(".playlist").css("opacity","1"),et.readyLooks(),tt.initYoutubeControls(et.player),tt.initSlider(),et.player.setVolume(N.get_volume()),$(".video-container").removeClass("no-opacity");var a="https://remote."+window.location.hostname+"/"+Oe;$("#code-text").text(Oe),$("#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&&L.emit("list",q.toLowerCase()),window.onYouTubeIframeAPIReady=et.onYouTubeIframeAPIReady,(""===et.player||void 0===et.player||j.mobilecheck())&&et.loadPlayer(),j.mobilecheck()&&Ke.initiate_volume(),p(),h(),u(),j.mobilecheck()||0!==$("#alreadychannel").length||f(),j.msieversion()||j.mobilecheck()||Notification.requestPermission(),$(".search_input").focus(),j.sample(),$("#results").hover(function(){$("div.result").removeClass("hoverResults"),ce=0},function(){}),$("#search").focus(),$("#embed-button").css("display","inline-block"),$("#embed-area").val(w(ke,we,be,Ie)),$("#search").attr("placeholder","Find song on YouTube..."),Te||(Le?initializeCastApi():window.__onGCastApiAvailable=function(e,t){e&&setTimeout(function(){initializeCastApi()},1e3)})}function n(e){if($(".castButton").toggleClass("hide"),$(".castButton-active").toggleClass("hide"),1==e){$("#duration").toggleClass("hide"),$("#fullscreen").toggleClass("hide");try{et.player.stopVideo()}catch(e){}et.stopInterval=!0,$("#player_overlay").removeClass("hide"),$("#player_overlay").css("display","block"),j.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/"+Ye+"/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
"+O.La.friendlyName),et.player.setVolume(100),$("#player_overlay_text").toggleClass("hide")}else 0==e&&($("#duration").toggleClass("hide"),$("#fullscreen").toggleClass("hide"),et.player.playVideo(),et.stopInterval=!1,et.durationSetter(),j.mobilecheck()||(et.player.setVolume(N.get_volume()),$("#volume").slider("value",N.get_volume())),$("#player_overlay").addClass("hide"),$("#player_overlay_text").toggleClass("hide"),$("#chromecast_text").html(""),$("#playing_on").css("display","none"),L.emit("pos",{channel:q.toLowerCase()}))}function o(e,t){var a=JSON.parse(t);switch(a.type){case-1:L.emit("end",{id:a.videoId,channel:q.toLowerCase()});break;case 0:L.emit("skip",{error:a.data_code,id:a.videoId,pass:ee,channel:q.toLowerCase})}}function i(){L.on("connect_failed",function(){j.log("Connection Failed"),Ce||(Ce=!0,Materialize.toast("Error connecting to server, please wait..",1e8,"red lighten connect_error"))}),L.on("connect_error",function(){j.log("Connection Failed."),Ce||(Ce=!0,Materialize.toast("Error connecting to server, please wait..",1e8,"red lighten connect_error"))})}function s(){L.on("np",et.youtube_listener)}function l(){L.on("get_list",function(){L.emit("list",q.toLowerCase())})}function c(){L.on("suggested",function(e){var t=!0;void 0===e.id&&(t=!1),nt.catchUserSuggests(e,t)})}function d(){L.on("viewers",function(e){ne=e,void 0!==Je&&et.getTitle(Je,ne)})}function p(){L.on("toast",A.toast),L.on("pw",A.pw),L.on("conf",A.conf)}function u(){L.on("chat.all",P.allchat),L.on("chat",P.channelchat)}function h(){L.on("channel",R.channel_function)}function m(){j.log("Setting up playlist_listener"),L.on("playlists",V.frontpage_function)}function f(){L.on("id",D.host_listener)}function y(e){L.on(e,D.host_on_action)}function v(){localStorage.debug=!0}function _(){localStorage.debug=!1}function w(e,t,a,n){return''}function k(e){for(var t="",a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.-_",n=0;nX"),$("#playbar").remove(),$("#playlist").remove(),$(".ui-resizable-handle").remove(),$("#main_components").remove(),$("#player").addClass("player_bottom"),$("#main-row").addClass("frontpage_modified_heights"),$("#player").css("opacity","1"),$("#video-container").removeClass("no-opacity"),$("#main-row").prepend("
");var a=$("
"+e+"
");$(".drag-target").remove(),$("#sidenav-overlay").remove(),$("main").attr("class","center-align container"),$("body").attr("id",""),$("body").attr("style",""),$("header").html($(a.find("header")).html()),$($(a.find(".section.mega"))).insertAfter("header"),$($(a.find(".section.mobile-search"))).insertAfter(".mega"),j.mobilecheck()?$("main").html($(a.find("main")).html()):$("main").append($(a.find("#main_section_frontpage")).wrap("
").parent().html()),$(".page-footer").removeClass("padding-bottom-extra"),$(".page-footer").removeClass("padding-bottom-novideo"),$("#favicon").attr("href","public/images/favicon.png"),j.log(L),1==$("#alreadyfp").length?t():(Xe=!0,z=!0,t()),0===$("#alreadychannel").length&&$("head").append("
150||(e.value.startsWith("/name ")?P.namechange(e.value.substring(6)):e.value.startsWith("/removename")?P.removename():"#all_chat"==$(".chat-tab-li a.active").attr("href")?L.emit("all,chat",e.value):L.emit("chat",e.value),e.value="")},allchat:function(e){G||":"!=e.msg.substring(0,1)||he||($("#favicon").attr("href","public/images/highlogo.png"),G=!0,J=!0,me=!0,fe||P.chat_blink()),document.hidden&&$("#favicon").attr("href","public/images/highlogo.png");var t=j.intToARGB(j.hashCode(e.from));if(t.length<6)for(x=t.length;x<6;x++)t="0"+t;t=j.hexToRgb(t.substring(0,6));var a=j.rgbToHsl([t.r,t.g,t.b],!1);$("#chatall").append("
  • "+e.from+"
  • ");var n=document.createTextNode(e.msg);$("#chatall li:last")[0].appendChild(n),document.getElementById("chatall").scrollTop=document.getElementById("chatall").scrollHeight},channelchat:function(e){G||":"!=e.msg.substring(0,1)||he||($("#favicon").attr("href","public/images/highlogo.png"),J=!0,me=!0,fe||P.chat_blink());var t=j.intToARGB(j.hashCode(e.from));if(t.length<6)for(x=t.length;x<6;x++)t="0"+t;t=j.hexToRgb(t.substring(0,6));var a=j.rgbToHsl([t.r,t.g,t.b],!1);$("#chatchannel").append("
  • "+e.from+"
  • ");var n=document.createTextNode(e.msg);$("#chatchannel li:last")[0].appendChild(n),document.getElementById("chatchannel").scrollTop=document.getElementById("chatchannel").scrollHeight},chat_blink:function(){fe=!0,$(".chat-link").attr("style","color: grey !important;"),setTimeout(function(){$(".chat-link").attr("style","color: white !important;"),setTimeout(function(){fe&&P.chat_blink()},1e3)},1e3)}},N={conf_pass:void 0,init:function(){"https:"!=location.protocol?document.cookie=q.toLowerCase()+"=;path=/"+q.toLowerCase()+";expires="+new Date(0).toUTCString():document.cookie=q.toLowerCase()+"=;path=/"+q.toLowerCase()+";secure;expires="+new Date(0).toUTCString();try{conf_arr=N.decrypt(N.getCookie("_opt"),"_opt")}catch(e){conf_arr=N.decrypt(N.create_cookie("_opt"),"_opt")}try{N.conf_pass=N.decrypt(N.getCookie(q.toLowerCase()),q.toLowerCase())}catch(e){N.conf_pass=N.decrypt(N.create_cookie(q.toLowerCase()),q.toLowerCase())}D.change_enabled(conf_arr.remote),100!=conf_arr.width&&et.set_width(conf_arr.width),void 0!==conf_arr.name&&""!==conf_arr.name&&P.namechange(conf_arr.name)},decrypt:function(e,t){void 0===N.getCookie(t)&&(e=N.create_cookie(t));var a=CryptoJS.AES.decrypt(e,"0103060703080703080701",{mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7});return $.parseJSON(a.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 a=JSON.stringify(e),n=CryptoJS.AES.encrypt(a,"0103060703080703080701",{mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7}),o=new Date;o.setFullYear(o.getFullYear()+1),"https:"!=location.protocol?document.cookie=t+"="+n.toString()+";expires="+o.toGMTString()+";path=/;":document.cookie=t+"="+n.toString()+";secure;expires="+o.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 N.decrypt(N.getCookie("_opt"),"_opt").volume},set_volume:function(e){conf_arr.volume=e,N.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),a=CryptoJS.AES.encrypt(t,"0103060703080703080701",{mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7}),n=new Date;return n.setFullYear(n.getFullYear()+1),"https:"!=location.protocol?document.cookie=e+"="+a.toString()+";expires="+n.toGMTString()+";path=/;":document.cookie=e+"="+a.toString()+";secure;expires="+n.toGMTString()+";path=/;",N.getCookie(e)},set_pass:function(e,t){N.conf_pass.passwords[e]=t,N.encrypt(N.conf_pass,e)},remove_pass:function(e){delete N.conf_pass.passwords[e],N.encrypt(N.conf_pass,e.toLowerCase())},set_name:function(e){conf_arr.name=encodeURIComponent(e).replace(/\W/g,""),N.encrypt(conf_arr,"_opt")},remove_name:function(){conf_arr.name="",N.encrypt(conf_arr,"_opt")},get_pass:function(e){if(void 0!==N.conf_pass)return N.conf_pass.passwords[e]},set_remote:function(e){conf_arr.remote=e,N.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,N.encrypt(conf_arr,"_opt")},getCookie:function(e){var t="; "+document.cookie,a=t.split("; "+e+"=");if(2==a.length)return a.pop().split(";").shift()}},z=!0,V={blob_list:[],winter:(new Date).getMonth()>=10,times_rotated:0,frontpage_function:function(e){$("#channels").empty(),z=!0,j.log("-----------"),j.log("Frontpage fetch"),j.log(e),j.log("------------"),V.populate_channels(e.channels),V.set_viewers(e.viewers)},populate_channels:function(e){var t,a="",n=0;1==e[0].pinned&&(t=e.shift()),e.sort(V.sortFunction),void 0!==t&&e.unshift(t),pre_card=$(E),j.log("------------"),j.log(pre_card),j.log("-------------"),j.mobilecheck()||V.add_backdrop(e,0);for(var o in e){var i=e[o].channel;if(n<12){var s=e[o].id,l=e[o].viewers,r="background-image:url('https://img.youtube.com/vi/"+s+"/hqdefault.jpg');",c=e[o].count,d=pre_card;1==e[o].pinned?(d.find(".pin").attr("style","display:block;"),d.find(".card").attr("title","Pinned!")):(d.find(".pin").attr("style","display:none;"),d.find(".card").attr("title","")),d.find(".chan-name").text(i),d.find(".chan-name").attr("title",i),d.find(".chan-views").text(l),d.find(".chan-songs").text(c),d.find(".chan-bg").attr("style",r),d.find(".chan-link").attr("href",i),$("#channels").append(d.html())}a+="