Files
zoff/static/dist/main.min.js
Kasper Rynning-Tønnesen f9f07e2d6d Added contact-form
2016-02-08 12:41:06 +01:00

2 lines
42 KiB
JavaScript

!function(){function e(){T=$("#chan").html(),"zoff.no"==window.location.hostname?add="https://zoff.no":add="localhost",C=io.connect(""+add+":8880",te),C.on("get_list",function(){setTimeout(function(){C.emit("list",T.toLowerCase())},1e3)}),C.on("suggested",function(e){var t=!0;void 0==e.id&&(t=!1),setTimeout(function(){ae.catchUserSuggests(e,t)},1e3)}),setTimeout(function(){ie.stopInterval=!1,localStorage.list_update&&"13.06.15"==localStorage.list_update||(localStorage.setItem("list_update","13.06.15"),window.location.reload(!0)),ie.setup_youtube_listener(T),n.admin_listener(),I.channel_listener(),$("ul.tabs").tabs(),$("#settings").sideNav({menuWidth:300,edge:"right",closeOnClick:!1}),$(".collapsible").collapsible({accordion:!0}),$(".video-container").resizable({start:function(e,t){$("iframe").css("pointer-events","none")},stop:function(e,t){$("iframe").css("pointer-events","auto"),a.set_width($(this).width())},handles:"e",minWidth:350}),/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream?(document.getElementById("search").blur(),ie.readyLooks()):(o.setup_chat_listener(T),o.allchat_listener(),S.host_listener(),window.onYouTubeIframeAPIReady=ie.onYouTubeIframeAPIReady,ie.loadPlayer(),$("#chat-btn").sideNav({menuWidth:272,edge:"left",closeOnClick:!1}),$(".drag-target")[1].remove(),i.msieversion()||Notification.requestPermission(),navigator.userAgent.toLowerCase().indexOf("firefox")>-1&&$(".main").height(window.innerHeight-64),git_info=$.ajax({type:"GET",url:"https://api.github.com/repos/zoff-music/zoff/commits",async:!1}).responseText,git_info=$.parseJSON(git_info),$("#latest-commit").html("Latest Commit: <br>"+git_info[0].commit.author.date.substring(0,10)+": "+git_info[0].committer.login+"<br><a href='"+git_info[0].html_url+"'>"+git_info[0].sha.substring(0,10)+"</a>: "+git_info[0].commit.message+"<br"),i.sample()),$("#results").hover(function(){$("div.result").removeClass("hoverResults"),Z=0},function(){}),$("#search").focus(),$("#base").bind("keyup keypress",function(e){var t=e.keyCode||e.which;return 13==t?(e.preventDefault(),!1):void 0}),$(".search_input").focus(),$(".search_input").keyup(function(e){search_input=$(this).val(),40!=e.keyCode&&38!=e.keyCode&&13!=e.keyCode&&39!=e.keyCode&&37!=e.keyCode&&(search_input.length<3&&$("#results").html(""),13==e.keyCode?oe.search(search_input):(Z=0,z=100))}),setInterval(function(){z--,0===z&&oe.search($(".search_input").val())},1)},1e3),$("#embed-button").css("display","inline-block"),$("#embed-area").val('<embed src="https://zoff.no/embed.html#'+T.toLowerCase()+'&autplay" width="600px" height="300px">')}function t(){var e=window.location.href.split("/");""==e[3]&&($("#channel-load").css("display","block"),window.scrollTo(0,0),ie.stopInterval=!0,n.display_logged_out(),n.beginning=!0,T="",$("#embed-button").css("display","none"),C.removeAllListeners(),$.ajax({url:"php/nochan.php",success:function(e){C.disconnect(),document.getElementById("volume-button").removeEventListener("click",ne.mute_video),document.getElementById("playpause").removeEventListener("click",ne.play_pause),document.getElementById("fullscreen").removeEventListener("click",ne.fullscreen),setTimeout(function(){y="",k="",$("meta[name=theme-color]").attr("content","#2D2D2D"),ie.ytplayer.destroy(),$(".drag-target").remove(),$("#sidenav-overlay").remove(),$("main").attr("class","center-align container"),$("body").attr("id",""),$("body").attr("style",""),$("header").html($($(e)[35]).html()),$($(e)[37]).insertAfter("header"),$($(e)[39]).insertAfter(".mega"),$("main").html($($(e)[43]).html()),0==$("#alreadychannel").length&&$("head").append("<div id='alreadychannel'></div"),1==$("#alreadyfp").length?window.initfp():$("#scripts").append($($(e)[63]).html()),$("#channel-load").css("display","none")},1e3),document.title="Zöff"}}))}var n={beginning:!0,admin_listener:function(){C.on("toast",function(e){switch(e){case"addedsong":e=i.rnd(["I added your song","Your song has been added","Yay, more songs!","Thats a cool song!","I added that song for you","I see you like adding songs..."]);break;case"savedsettings":e=i.rnd(["I've saved your settings","I stored all your settings","Your settings have been stored in a safe place"]);break;case"wrongpass":e=i.rnd(["That's not the right password!","Wrong! Better luck next time...","You seem to have mistyped the password","Incorrect. Have you tried meditating?","Nope, wrong password!","Wrong password. The authorities have been notified."]),a.remove_pass(T.toLowerCase()),n.display_logged_out(),E=!0;break;case"shuffled":e=i.rnd(["♫ You stir me right round, baby. ♫","♫ Stir, stir, stir my boat ♫","I vigorously stirred your playlist!","I hope you like your list stirred, not shaken.","I shuffled your playlist with the cosmic background radiation as a seed. Enjoy.","100% randomized, for your listening pleasure!","I hope you enjoy your fresh playlist!"]);break;case"deletesong":e=i.rnd(["Your song is now in a better place...","You won't be seeing any more of that video...","EXTERMINATE! EXTERMINATE! EXTERMINATE!","I killed it with fire","Thanks for deleting that song. I didn't like it anyways...","Removed song securely."]);break;case"voted":e=i.rnd(["You voted!","You vote like a boss","Voting is the key to democracy","May you get your song to the very top!","I love that song! I vouch for you.","Only you vote that good","I like the way you vote...","Up the video goes!","Voted Zöff for president","Only 999 more to go!"]);break;case"alreadyvoted":e=i.rnd(["You can't vote twice on that song!","I see you have voted on that song before","One vote per person!","I know you want to hear your song, but have patience!","I'm sorry, but I can't let you vote twice, Dave."]);break;case"skip":e=i.rnd(["The song was skipped","I have skipped a song","Skipped to the beat","Skipmaster3000","They see me skippin', they hatin'"]);break;case"listhaspass":e=i.rnd(["I'm sorry, but you have to be an admin to do that!","Only admins can do that","You're not allowed to do that, try logging in!","I can't let you do that","Please log in to do that"]);break;case"noskip":e=i.rnd(["Only Admins can skip songs, peasant!","You have to log in to skip songs on this channel","Try clicking the settings icon and logging in before you skip"]);break;case"alreadyskip":e=i.rnd(["Skipping is democratic, only one vote per person!","More people have to vote to skip, not just you!","Get someone else to skip too! You can't do it on yourself."]);break;case"notyetskip":e="Skipping is disabled the first 10 seconds.";break;case"correctpass":e="Correct password. You now have access to the sacred realm of The Admin.";break;case"changedpass":e="Your password has been changed!";break;case"suggested":e="Your song was suggested!";break;case"alreadyplay":e="Seems the song you want is already playing. No fooling the system!"}Materialize.toast(e,4e3)}),C.on("pw",function(e){E=!1,H=e,names=["vote","addsongs","longsongs","frontpage","allvideos","removeplay","skip","shuffle"],a.set_pass(T.toLowerCase(),a.decrypt_pass(e));for(var t=0;t<names.length;t++)$("input[name="+names[t]+"]").attr("disabled",!1);$(".card-action").removeClass("hide"),$("#admin-lock").removeClass("mdi-action-lock"),$("#password").val(""),$("#password").attr("placeholder","Change channel password"),$(".playlist-tabs").removeClass("hide"),$("#wrapper").toggleClass("tabs_height"),i.contains($("#admin-lock").attr("class").split(" "),"mdi-action-lock-open")||$("#admin-lock").addClass("mdi-action-lock-open clickable")}),C.on("conf",function(e){a.init(),n.set_conf(e[0]),void 0!==a.get_pass(T.toLowerCase())&&n.beginning&&""!=a.get_pass(T.toLowerCase())&&(C.emit("password",[a.crypt_pass(a.get_pass(T.toLowerCase())),T.toLowerCase()]),n.beginning=!1)})},pass_save:function(){E?C.emit("password",[a.crypt_pass(CryptoJS.SHA256(document.getElementById("password").value).toString()),T.toLowerCase()]):C.emit("password",[a.crypt_pass(CryptoJS.SHA256(document.getElementById("password").value).toString()),T.toLowerCase(),a.crypt_pass(a.get_pass(T.toLowerCase()))])},log_out:function(){a.get_pass(T.toLowerCase())?(a.remove_pass(T.toLowerCase()),n.display_logged_out(),Materialize.toast("Logged out",4e3)):Materialize.toast("Not logged in",4e3)},display_logged_out:function(){for(E=!0,H="",names=["vote","addsongs","longsongs","frontpage","allvideos","removeplay","skip","shuffle"],document.getElementById("password").value="",Z=0;Z<names.length;Z++)$("input[name="+names[Z]+"]").attr("disabled",!0);i.contains($("#admin-lock").attr("class").split(" "),"mdi-action-lock")||$("#admin-lock").addClass("mdi-action-lock"),i.contains($(".playlist-tabs").attr("class").split(" "),"hide")||($(".playlist-tabs").addClass("hide"),$("#wrapper").toggleClass("tabs_height")),0==$(".card-action").length||i.contains($(".card-action").attr("class").split(" "),"hide")||$(".card-action").addClass("hide"),$("ul.tabs").tabs("select_tab","wrapper"),$("#admin-lock").removeClass("mdi-action-lock-open clickable"),$("#password").attr("placeholder","Enter channel password")},save:function(){n.submitAdmin(document.getElementById("adminForm").elements)},set_conf:function(e){R=e.allvideos,longsongs=e.longsongs,names=["vote","addsongs","longsongs","frontpage","allvideos","removeplay","skip","shuffle"],""!=e.adminpass&&E?B=!0:(B=!1,$(".playlist-tabs").removeClass("hide"),$("#wrapper").toggleClass("tabs_height"));for(var t=0;t<names.length;t++)document.getElementsByName(names[t])[0].checked=e[names[t]]===!0,$("input[name="+names[t]+"]").attr("disabled",B);B?n.display_logged_out():B||void 0!==a.get_pass(T.toLowerCase())||$("#password").attr("placeholder","Create channel password")},submitAdmin:function(e){voting=e.vote.checked,addsongs=e.addsongs.checked,longsongs=e.longsongs.checked,q=e.frontpage.checked,allvideos=e.allvideos.checked,removeplay=e.removeplay.checked,skipping=e.skip.checked,shuffling=e.shuffle.checked,configs=[voting,addsongs,longsongs,q,allvideos,removeplay,H,skipping,shuffling],C.emit("conf",configs)},hide_settings:function(){$("#settings").sideNav("hide")},shuffle:function(){C.emit("shuffle",void 0!==H?H:"")},get_admin:function(){return[E,B]}},o={chat:function(e){e.value.length>150||(e.value.startsWith("/name ")?C.emit("namechange",e.value.substring(6)):"#all_chat"==$(".tab a.active").attr("href")?C.emit("all,chat",e.value):C.emit("chat",e.value),e.value="")},allchat_listener:function(){C.on("chat.all",function(e){0!=$("#chat-bar").position().left?A||($("#favicon").attr("href","static/images/highlogo.png"),A=!0,L=!0,d=setInterval(o.chat_blink,2e3)):document.hidden&&($("#favicon").attr("href","static/images/highlogo.png"),L=!0);var t=i.intToARGB(i.hashCode(e[0])).substring(0,6);$("#chatall").append("<li title='"+e[2]+"'><span style='color:#"+t+";'>"+e[0]+"</span></li>");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){C.on("chat",function(e){0!=$("#chat-bar").position().left&&e[1].indexOf(":")>=0&&(A||($("#favicon").attr("href","static/images/highlogo.png"),A=!0,d=setInterval(o.chat_blink,2e3)));var t=i.intToARGB(i.hashCode(e[0])).substring(0,6);$("#chatchannel").append("<li><span style='color:#"+t+";'>"+e[0]+"</span></li>");var n=document.createTextNode(e[1]);$("#chatchannel li:last")[0].appendChild(n),document.getElementById("chatchannel").scrollTop=document.getElementById("chatchannel").scrollHeight})},chat_blink:function(){$("#chat-btn i").css("opacity",.5),setTimeout(function(){$("#chat-btn i").css("opacity",1)},1e3)}},a={conf_arr:{},init:function(){document.cookie=T.toLowerCase()+"=; path=/"+T.toLowerCase()+"; expires="+new Date(0).toUTCString();try{conf_arr=a.decrypt(a.getCookie("_opt"),"_opt")}catch(e){conf_arr=a.decrypt(a.create_cookie("_opt"),"_opt")}try{conf_pass=a.decrypt(a.getCookie(T.toLowerCase()),T.toLowerCase())}catch(e){conf_pass=a.decrypt(a.create_cookie(T.toLowerCase()),T.toLowerCase())}S.change_enabled(conf_arr.remote),100!=conf_arr.width&&ie.set_width(conf_arr.width)},decrypt:function(e,t){void 0===a.getCookie(t)&&(e=a.create_cookie(t));var n=CryptoJS.AES.decrypt(e,navigator.userAgent+navigator.languages,{mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7});return $.parseJSON(n.toString(CryptoJS.enc.Utf8))},decrypt_pass:function(e){var t=CryptoJS.AES.decrypt(e,C.id,{mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7});return t.toString(CryptoJS.enc.Utf8)},encrypt:function(e,t){var n=JSON.stringify(e),o=CryptoJS.AES.encrypt(n,navigator.userAgent+navigator.languages,{mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7}),a=new Date;a.setFullYear(a.getFullYear()+1),document.cookie=t+"="+o.toString()+";expires="+a.toGMTString()+";path=/;"},encrypt_string:function(e){var t=CryptoJS.AES.encrypt(e,C.id,{mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7});return t.toString()},get_volume:function(){return a.decrypt(a.getCookie("_opt"),"_opt").volume},set_volume:function(e){conf_arr.volume=e,a.encrypt(conf_arr,"_opt")},create_cookie:function(e){"_opt"==e?cookie_object={volume:100,width:100,remote:!0}:cookie_object={passwords:{}};var t=JSON.stringify(cookie_object),n=CryptoJS.AES.encrypt(t,navigator.userAgent+navigator.languages,{mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7}),o=new Date;return o.setFullYear(o.getFullYear()+1),document.cookie=e+"="+n.toString()+";expires="+o.toGMTString()+";path=/;",a.getCookie(e)},set_pass:function(e,t){conf_pass.passwords[e]=t,a.encrypt(conf_pass,e)},remove_pass:function(e){delete conf_pass.passwords[e],a.encrypt(conf_pass,e.toLowerCase())},get_pass:function(e){return conf_pass.passwords[e]},set_remote:function(e){conf_arr.remote=e,a.encrypt(conf_arr,"_opt")},get_remote:function(e){return conf_arr.remote},crypt_pass:function(e){var t=CryptoJS.AES.encrypt(e,C.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,a.encrypt(conf_arr,"_opt")},getCookie:function(e){var t="; "+document.cookie,n=t.split("; "+e+"=");return 2==n.length?n.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 i={rnd:function(e){return e[Math.floor(Math.random()*e.length)]},predicate:function(){for(var e,t,n,o=[],a=arguments.length,i=function(e,t){return e===t?0:t>e?-1:1},s=function(e,t){var n=i,o=i;return e&&(o=function(t,o){return n(e(t),e(o))}),t?function(e,t){return-1*o(e,t)}:o},r=0;a>r;r++)e=arguments[r],"string"==typeof e?(t=e,n=i):(t=e.name,n=s(e.primer,e.reverse)),o.push({name:t,cmp:n});return function(t,n){for(var i,s,r=0;a>r&&(s=0,e=o[r],i=e.name,s=e.cmp(t[i],n[i]),0===s);r++);return s}},hashCode:function(e){for(var t=0,n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);return t},intToARGB:function(e){return(e>>24&255).toString(16)+(e>>16&255).toString(16)+(e>>8&255).toString(16)+(255&e).toString(16)},pad:function(e){return 10>e?"0"+Math.floor(e):Math.floor(e)},contains:function(e,t){for(var n=e.length;n--;)if(e[n]===t)return!0;return!1},sample:function(){Date.now()-W>=2*F&&(C.removeAllListeners(),C.disconnect(),C.connect(),ie.setup_all_listeners()),W=Date.now(),setTimeout(i.sample,F)},loadjsfile:function(e){if(-1==Y.indexOf("["+e+"]")){var t=document.createElement("script");t.setAttribute("type","text/javascript"),t.setAttribute("src",e),document.getElementsByTagName("head")[0].appendChild(t),Y+="["+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){r=e[0],g=e[1],b=e[2],r/=255,g/=255,b/=255;var t,n,o=Math.max(r,g,b),a=Math.min(r,g,b),i=(o+a)/2;if(o==a)t=n=0;else{var s=o-a;switch(n=i>.5?s/(2-o-a):s/(o+a),o){case r:t=(g-b)/s+(g<b?6:0);break;case g:t=(b-r)/s+2;break;case b:t=(r-g)/s+4}t/=6}return i>.5&&(i=.5),"hsl("+Math.floor(360*t)+", "+Math.floor(100*n)+"%, "+Math.floor(100*i)+"%)"},componentToHex:function(e){var t=e.toString(16);return 1==t.length?"0"+t:t},rgbToHex:function(e,t,n){return"#"+i.componentToHex(e)+i.componentToHex(t)+i.componentToHex(n)},send_mail:function(e,t){$.ajax({type:"POST",data:{from:e,message:t},url:"/php/mail.php",success:function(e){"success"==e?($("#contact-container").empty(),$("#contact-container").html("Mail has been sent, we'll be back with you shortly.")):($("#contact-container").empty(),$("#contact-container").html("Something went wrong, sorry about that. You could instead try with your own mail-client: <a title='Open in client' href='mailto:contact@zoff.no?Subject=Contact%20Zoff'>contact@zoff.no</a>"))}})}};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 s,l,c,d,u,m,p,h,f,y,v,w,k,_,C,S={enabled:!0,host_listener:function(){var e;C.on("id",function(t){void 0===e?e=t:(C.removeAllListeners(t),Q=!1,e=t);var n="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="+n),$("#code-link").attr("href",n),Q||(Q=!0,C.on(t,function(e){enabled&&("volume"==e[0]?($("#volume").slider("value",e[1]),p.setVolume(e[1]),localStorage.setItem("volume",e[1]),ne.choose_button(e[1],!1)):"channel"==e[0]?(C.emit("change_channel"),T=e[1].toLowerCase(),$("#chan").html(T.substring(0,1).toUpperCase()+T.substring(1).toLowerCase()),E=!0,C.emit("list",T.toLowerCase()),localStorage[T.toLowerCase()]&&(64!=localStorage[T.toLowerCase()].length?localStorage.removeItem(T.toLowerCase()):C.emit("password",[localStorage[T.toLowerCase()],T.toLowerCase()])),window.history.pushState("object or string","Title","/"+T.toLowerCase())):"pause"==e[0]?p.pauseVideo():"play"==e[0]?p.playVideo():"skip"==e[0]&&I.skip())}))}),$("input[class=remote_switch_class]").change(function(){enabled=document.getElementsByName("remote_switch")[0].checked,a.set_remote(enabled)})},change_enabled:function(e){enabled=e,document.getElementsByName("remote_switch")[0].checked=enabled}},I={channel_listener:function(){C.on("channel",function(e){I.channel_function(e)})},channel_function:function(e){switch(e[0]){case"list":I.populate_list(e[1]);break;case"added":I.added_song(e[1]);break;case"deleted":I.deleted_song(e[1]);break;case"vote":I.voted_song(e[1],e[2]);break;case"song_change":I.song_change(e[1])}},populate_list:function(e){l=e,I.sortList(),$("#wrapper").empty(),$.each(l,function(e,t){t.now_playing||$("#wrapper").append(I.generateSong(t,!1,K,!0))}),K&&(window.mobilecheck()?$(".list-image").lazyload({}):$(".list-image").lazyload({container:$("#wrapper")}).removeClass("lazy")),$("#settings").css("visibility","visible"),$("#settings").css("opacity","1"),$("#wrapper").css("opacity","1")},added_song:function(e){l.push(e),I.sortList(),$("#suggested-"+e.id).remove(),I.insertAtIndex(e,!0)},deleted_song:function(e){var t=I.getIndexOfSong(e),n=$("#wrapper").children()[t];try{n.style.height=0,setTimeout(function(){$("#"+e).remove(),l.splice(I.getIndexOfSong(e),1)},305),document.getElementById("wrapper").scrollTop+=1,document.getElementById("wrapper").scrollTop+=-1}catch(o){l.splice(I.getIndexOfSong(e),1),$("#wrapper").children()[$("#wrapper").children().length-1].remove()}$("#suggested-"+e).remove(),ae.checkUserEmpty()},voted_song:function(e,t){var n=I.getIndexOfSong(e),o=l[n];l[n].votes+=1,l[n].added=t,I.sortList(),$("#"+e).remove(),I.insertAtIndex(o,!1)},song_change:function(e){var t=l.length-1;l[0].now_playing=!0,l[0].votes=0,l[0].guids=[],l[0].added=e,l[t].now_playing=!1,l.push(l.shift()),$("#wrapper").children()[0].remove(),I.insertAtIndex(l[t-1],!1),document.getElementById("wrapper").scrollTop+=1,document.getElementById("wrapper").scrollTop+=-1},vote:function(e,t){return C.emit("vote",[T,e,t,H]),!0},skip:function(){return C.emit("skip",{pass:H,id:y}),!0},importOldList:function(e){var t="",n=0;playlist_url="lists/"+e+".json",v=$.parseJSON($.ajax({type:"GET",url:playlist_url,async:!1}).responseText),$.each(v.songs,function(e,o){t+=o.id+",",n>45&&(oe.addVideos(t),t="",n=0),n++}),oe.addVideos(t),document.getElementById("search").value=""},sortList:function(){l.sort(i.predicate({name:"votes",reverse:!0},"added"))},show:function(){window.mobilecheck()||(M?(M=!1,$("#toptitle").empty(),$("#chan").addClass("bigChan"),$("#chan").html("zoff.no/"+T.toLowerCase())):(M=!0,$("#toptitle").html("Zöff"),$("#chan").removeClass("bigChan"),$("#chan").html(T)))},insertAtIndex:function(e,t){Z=I.getIndexOfSong(e.id),0===Z?$("#wrapper").prepend(I.generateSong(e,t,!1,!0,!1)):$("#wrapper > div:nth-child("+Z+")").after(I.generateSong(e,t,!1,!0,!1)),t&&setTimeout(function(){var e=$("#wrapper").children()[Z];$(e).css("height",66)},5)},generateSong:function(e,t,n,o,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=$("<div>"+P+"</div>"),m="style";return t&&u.find("#list-song").css("height",0),E||u.find(".card-action").removeClass("hide"),1==c&&u.find(".vote-text").text("vote"),n&&(d="//img.youtube.com/vi/"+r+"/mqdefault.jpg",m="data-original"),o?(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"):o||(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(m,d),u.find(".list-suggested-image").attr(m,d),u.find("#"+s).attr("data-video-id",r),u.html()},getIndexOfSong:function(e){return indexes=$.map(l,function(t,n){return t.id==e?n:void 0}),indexes[0]}},T=$("#chan").html(),E=!0,B=0,M=!0,P=$("#list-song-html").html(),A=!1,L=!1,z=0,N="***REMOVED***",j=$("#temp-results-container"),V=$("#empty-results-container").html(),D=!1,O=/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)?)?/,c=[],R=0,q=1,H="",Y="",U=!1,f=1,J=!1,G=!1,F=6e3,W=Date.now(),Q=!1,Z=-1,K=!0,X=!1,ee=!0,te={"sync disconnect on unload":!0,secure:!0,"force new connection":!0};$().ready(function(){e()}),window.init=e,$(document).keyup(function(e){if(27==event.keyCode)$("#results").html(""),i.contains($("#search-wrapper").attr("class").split(" "),"hide")||$("#search-wrapper").toggleClass("hide"),i.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");else if($("div.result").length>2)if(children=$("#mock-div").children(),40==e.keyCode)$(children[Z-1]).removeClass("hoverResults"),$(children[Z]).addClass("hoverResults"),Z<children.length-2&&Z++;else if(38==e.keyCode)Z>1&&Z--,$(children[Z]).removeClass("hoverResults"),$(children[Z-1]).addClass("hoverResults");else if(13==e.keyCode){Z=0;var t=document.getElementsByClassName("hoverResults")[0];"function"==typeof t.onclick&&t.onclick.apply(t),$("div.hoverResults").removeClass("hoverResults"),$("#results").html(""),document.getElementById("search").value=""}}),$("input[class=conf]").change(function(){n.save()}),$("#clickme").click(function(){ie.ytplayer.playVideo()}),$("#listImport").on("submit",function(){oe.importPlaylist(document.getElementById("import").value)}),$(window).focus(function(){L&&($("#favicon").attr("href","static/images/favicon.png"),L=!1)}),$(document).on("click","#chat-btn",function(){$("#text-chat-input").focus(),$("#chat-btn i").css("opacity",1),clearInterval(d),A=!1,L=!1,$("#favicon").attr("href","static/images/favicon.png")}),$(document).on("click",".chat-tab",function(){$("#text-chat-input").focus()}),$(document).on("click","#skip",function(e){e.preventDefault(),I.skip()}),$(document).on("click","#chan",function(e){e.preventDefault(),I.show()}),$(document).on("submit","#adminForm",function(e){e.preventDefault(),n.pass_save()}),$(document).on("submit","#chatForm",function(){o.chat(document.getElementById("chatForm").input)}),$(document).on("click","#shuffle",function(e){e.preventDefault(),n.shuffle()}),$(document).on("click","#search-btn",function(e){e.preventDefault(),oe.showSearch()}),$(document).on("click","#song-title",function(e){e.preventDefault(),oe.showSearch()}),$(document).on("click","#admin-lock",function(e){e.preventDefault(),n.log_out()}),$(document).on("click","#closeSettings",function(e){e.preventDefault(),n.hide_settings()}),$(document).on("click","#temp-results",function(e){if($(e.target).html()!=$("<i class='mdi-av-playlist-add'></i>").html()){var t=$(this).attr("data-video-id"),n=$(this).attr("data-video-title"),o=$(this).attr("data-video-length");oe.submitAndClose(t,n,o)}}),$(document).on("click","#add-many",function(e){var t=$(this).attr("data-video-id"),n=$(this).attr("data-video-title"),o=$(this).attr("data-video-length");oe.submit(t,n,o)}),$(document).on("click",".vote-container",function(e){var t=$(this).attr("data-video-id");I.vote(t,"pos")}),$(document).on("click","#del",function(e){var t=$(this).attr("data-video-id");I.vote(t,"del")}),$(document).on("click",".add-suggested",function(e){var t=$(this).attr("data-video-id"),n=$(this).attr("data-video-title"),o=$(this).attr("data-video-length");oe.submit(t,n,o),$("#suggested-"+t).remove()}),$(document).on("click","#del_suggested",function(e){var t=$(this).attr("data-video-id");$("#suggested-"+t).remove()}),$(document).on("click","#del_user_suggested",function(e){var t=$(this).attr("data-video-id");$("#suggested-"+t).remove(),I.vote(t,"del")}),$(document).on("click","#toast-container",function(){$(this).fadeOut(function(){$(this).remove()})}),$(document).on("click","#embed-area",function(){this.select()}),$(document).on("click",".brand-logo-navigate",function(e){e.preventDefault(),window.history.pushState("to the frontpage!","Title","/"),t()}),window.onpopstate=function(e){t()};var ne={stopInterval:!1,initYoutubeControls:function(){!window.mobilecheck()||/iPad|iPhone|iPod/.test(navigator.userAgent)||window.MSStream||$("#controls").appendTo("#playbar"),ne.initControls()},initControls:function(){document.getElementById("volume-button").addEventListener("click",ne.mute_video),document.getElementById("playpause").addEventListener("click",ne.play_pause),document.getElementById("fullscreen").addEventListener("click",ne.fullscreen)},initSlider:function(){try{vol=a.get_volume()}catch(e){}$("#volume").slider({min:0,max:100,value:vol,range:"min",animate:!0,slide:function(e,t){ne.setVolume(t.value);try{a.set_volume(t.value)}catch(n){}}}),ne.choose_button(vol,!1)},fullscreen:function(){var e=document.getElementById("player"),t=e.requestFullScreen||e.mozRequestFullScreen||e.webkitRequestFullScreen;t&&t.bind(e)()},play_pause:function(){1==ie.ytplayer.getPlayerState()?(ie.ytplayer.pauseVideo(),!window.mobilecheck()||/iPad|iPhone|iPod/.test(navigator.userAgent)||window.MSStream||(document.getElementById("player").style.display="none",$(".page-footer").toggleClass("padding-bottom-extra"))):(2==ie.ytplayer.getPlayerState()||0==ie.ytplayer.getPlayerState())&&(ie.ytplayer.playVideo(),!window.mobilecheck()||/iPad|iPhone|iPod/.test(navigator.userAgent)||window.MSStream||(document.getElementById("player").style.display="block",$(".page-footer").toggleClass("padding-bottom-extra")))},play_pause_show:function(){1==document.getElementById("pause").className.split(" ").length&&$("#pause").toggleClass("hide"),2==document.getElementById("play").className.split(" ").length&&$("#play").toggleClass("hide")},settings:function(){$("#qS").toggleClass("hide")},changeQuality:function(e){ie.ytplayer.getPlaybackQuality!=e&&(ie.ytplayer.setPlaybackQuality(e),ie.ytplayer.getPlaybackQuality()),$("#qS").toggleClass("hide")},mute_video:function(){ie.ytplayer.isMuted()?(ie.ytplayer.unMute(),ne.choose_button(ie.ytplayer.getVolume(),!1)):(ne.choose_button(0,!0),ie.ytplayer.mute())},setVolume:function(e){ie.ytplayer.setVolume(e),ne.choose_button(e,!1),ie.ytplayer.isMuted()&&ie.ytplayer.unMute()},choose_button:function(e,t){t?(1==document.getElementById("v-full").className.split(" ").length&&$("#v-full").toggleClass("hide"),1==document.getElementById("v-medium").className.split(" ").length&&$("#v-medium").toggleClass("hide"),1==document.getElementById("v-low").className.split(" ").length&&$("#v-low").toggleClass("hide"),2==document.getElementById("v-mute").className.split(" ").length&&$("#v-mute").toggleClass("hide")):e>=0&&33>=e?(1==document.getElementById("v-full").className.split(" ").length&&$("#v-full").toggleClass("hide"),1==document.getElementById("v-medium").className.split(" ").length&&$("#v-medium").toggleClass("hide"),2==document.getElementById("v-low").className.split(" ").length&&$("#v-low").toggleClass("hide"),1==document.getElementById("v-mute").className.split(" ").length&&$("#v-mute").toggleClass("hide")):e>=34&&66>=e?(1==document.getElementById("v-full").className.split(" ").length&&$("#v-full").toggleClass("hide"),2==document.getElementById("v-medium").className.split(" ").length&&$("#v-medium").toggleClass("hide"),1==document.getElementById("v-low").className.split(" ").length&&$("#v-low").toggleClass("hide"),1==document.getElementById("v-mute").className.split(" ").length&&$("#v-mute").toggleClass("hide")):e>=67&&100>=e&&(2==document.getElementById("v-full").className.split(" ").length&&$("#v-full").toggleClass("hide"),
1==document.getElementById("v-medium").className.split(" ").length&&$("#v-medium").toggleClass("hide"),1==document.getElementById("v-low").className.split(" ").length&&$("#v-low").toggleClass("hide"),1==document.getElementById("v-mute").className.split(" ").length&&$("#v-mute").toggleClass("hide"))},playPause:function(){state=ie.ytplayer.getPlayerState(),button=document.getElementById("playpause"),1==state?ie.ytplayer.pauseVideo():2==state&&ie.ytplayer.playVideo()},volumeOptions:function(){ie.ytplayer.isMuted()?(ie.ytplayer.unMute(),vol=ie.ytplayer.getVolume(),$("#volume").slider("value",ie.ytplayer.getVolume())):(ie.ytplayer.mute(),$("#volume").slider("value",0))},hoverMute:function(e){vol=ie.ytplayer.getVolume()}},oe={showSearch:function(){$("#search-wrapper").toggleClass("hide"),window.mobilecheck()&&$(".search_input").focus(),$("#song-title").toggleClass("hide"),$("#results").toggleClass("hide"),$("#results").empty(),$("#search-btn i").toggleClass("mdi-navigation-close"),$("#search-btn i").toggleClass("mdi-action-search"),$("#search").focus()},search:function(e){if($(".search_results").html(""),""!==window.search_input){D=!0;var t=encodeURIComponent(window.search_input),n="https://www.googleapis.com/youtube/v3/search?key="+N+"&videoEmbeddable=true&part=id&fields=items(id)&type=video&order=viewCount&safeSearch=none&maxResults=25";n+="&q="+t,R&&(n+="&videoCategoryId=10");var o="https://www.googleapis.com/youtube/v3/videos?part=contentDetails,snippet,id&key="+N+"&id=";i.contains($("#search_loader").attr("class").split(" "),"hide")&&$("#search_loader").removeClass("hide"),i.contains($("#results").attr("class").split(" "),"hide")&&$("#results").removeClass("hide"),$.ajax({type:"GET",url:n,dataType:"jsonp",success:function(e){0==e.items.length?($("<div style='display:none;' id='mock-div'>"+V+"</div>").appendTo($("#results")).show("blind",83.33),i.contains($("#search_loader").attr("class").split(" "),"hide")||$("#search_loader").addClass("hide")):e.items&&($.each(e.items,function(e,t){o+=t.id.videoId+","}),$.ajax({type:"GET",url:o,dataType:"jsonp",success:function(e){var t="",n=$(j);$.each(e.items,function(e,o){var a=o.contentDetails.duration;if(secs=oe.durationToSeconds(a),!longsongs||secs<720){h=o.snippet.title,enc_title=encodeURIComponent(h).replace(/'/g,"\\'"),s=o.id,a=a.replace("PT","").replace("H","h ").replace("M","m ").replace("S","s"),thumb=o.snippet.thumbnails.medium.url;var i=n;i.find(".search-title").text(h),i.find(".result_info").text(a),i.find(".thumb").attr("data-original",thumb),i.find("#add-many").attr("data-video-id",s),i.find("#add-many").attr("data-video-title",enc_title),i.find("#add-many").attr("data-video-length",secs),i.find("#temp-results").attr("data-video-id",s),i.find("#temp-results").attr("data-video-title",enc_title),i.find("#temp-results").attr("data-video-length",secs),t+=i.html()}}),$("<div style='display:none;' id='mock-div'>"+t+"</div>").appendTo($("#results")).show("blind",83.33*(e.items.length-1)),setTimeout(function(){$(".thumb").lazyload({container:$("#results")})},250),i.contains($("#search_loader").attr("class").split(" "),"hide")||$("#search_loader").addClass("hide"),$(".add-many").click(function(e){return e.preventDefault(),e.stopPropagation(),!1})}}))}})}else $(".main").removeClass("blurT"),$("#controls").removeClass("blurT"),$(".main").removeClass("clickthrough")},submitAndClose:function(e,t,n){oe.submit(e,t,n),$("#results").html(""),oe.showSearch(),document.getElementById("search").value="",$("#results").html="",$(".main").removeClass("blurT"),$("#controls").removeClass("blurT"),$(".main").removeClass("clickthrough")},importPlaylist:function(e,t){token="",void 0!==t&&(token="&pageToken="+t),playlist_url="https://www.googleapis.com/youtube/v3/playlistItems?part=contentDetails&maxResults=49&key="+N+"&playlistId="+e+token,$.ajax({type:"GET",url:playlist_url,dataType:"jsonp",success:function(t){var n="";oe.addVideos(t.items[0].contentDetails.videoId),$.each(t.items,function(e,t){n+=t.contentDetails.videoId+","}),oe.addVideos(n),t.nextPageToken&&oe.importPlaylist(e,t.nextPageToken),document.getElementById("import").value=""}})},addVideos:function(e){var t="https://www.googleapis.com/youtube/v3/videos?part=contentDetails,snippet,id&key=***REMOVED***&id=";t+=e,$.ajax({type:"POST",url:t,dataType:"jsonp",success:function(e){$.each(e.items,function(e,t){var n=oe.durationToSeconds(t.contentDetails.duration);(!longsongs||720>n)&&(enc_title=encodeURIComponent(t.snippet.title),oe.submit(t.id,enc_title,n))})}})},submit:function(e,t,n){C.emit("add",[e,decodeURIComponent(t),H,n])},durationToSeconds:function(e){var t=e.match(O);return hours=parseInt(t[12])||0,minutes=parseInt(t[14])||0,seconds=parseInt(t[16])||0,60*hours*60+60*minutes+seconds}},ae={catchUserSuggests:function(e,t){if(t)ae.createSuggested(e);else for(x in e)ae.createSuggested(e[x]);ae.checkUserEmpty()},createSuggested:function(e){var t=e.duration,n=e.id,o=e.title,a=Math.floor(t/60),i=t-60*a;duration=a+"m "+i+"s";var s=I.generateSong({id:n,title:o,length:t,duration:duration},!1,!1,!1,!0);$("#user-suggest-html").append(s)},fetchYoutubeSuggests:function(e){var t="https://www.googleapis.com/youtube/v3/search?part=snippet&relatedToVideoId="+e+"&type=video&key="+N,n="https://www.googleapis.com/youtube/v3/videos?part=contentDetails,snippet,id&key="+N+"&id=";$.ajax({type:"GET",url:t,dataType:"jsonp",success:function(e){$.each(e.items.slice(0,5),function(e,t){n+=t.id.videoId+","}),$.ajax({type:"GET",url:n,dataType:"jsonp",success:function(e){$("#suggest-song-html").empty(),$.each(e.items,function(e,t){var n=t.contentDetails.duration,o=oe.durationToSeconds(n),a=t.id,i=t.snippet.title;n=n.replace("PT","").replace("H","h ").replace("M","m ").replace("S","s"),$("#suggest-song-html").append(I.generateSong({id:a,title:i,length:o,duration:n},!1,!1,!1))})}})}})},checkUserEmpty:function(){var e=$("#user-suggest-html").children().length;0==e?i.contains($("#user_suggests").attr("class").split(" "),"hide")||$("#user_suggests").addClass("hide"):$("#user_suggests").removeClass("hide")}},ie={loaded:!0,before_load:"",after_load:"",ytplayer:"",stopInterval:!1,setup_youtube_listener:function(e){C.on("np",function(e){if(ie.loaded=!1,0==e[0].length){document.getElementById("song-title").innerHTML="Empty channel. Add some songs!",$("#player_overlay").height($("#player").height()),/iPad|iPhone|iPod/.test(navigator.userAgent)||window.MSStream||$("#player_overlay").toggleClass("hide");try{ie.ytplayer.stopVideo()}catch(t){}}else{void 0==_?_=e[0][0].id:_!=y&&(_=y),y=e[0][0].id,c=e[1][0],time=e[2],w=time-c.startTime,k=e[0][0].title,$("#player_overlay").addClass("hide");try{ae.fetchYoutubeSuggests(y)}catch(t){}if(ie.getTitle(k,f),ie.setBGimage(y),!U||/iPad|iPhone|iPod/.test(navigator.userAgent)||window.MSStream)ie.getTitle(k,f);else try{ie.ytplayer.getVideoUrl().split("v=")[1]!=y&&(ie.ytplayer.loadVideoById(y),ie.notifyUser(y,k),ie.ytplayer.seekTo(w),J&&ie.ytplayer.pauseVideo()),J||(ie.ytplayer.playVideo(),ie.durationSetter()),(ie.ytplayer.getDuration()>w||0==ie.ytplayer.getDuration())&&ie.ytplayer.seekTo(w),ie.after_load=y,setTimeout(function(){ie.loaded=!0},500)}catch(t){ie.durationSetter()}}}),C.on("viewers",function(e){f=e,void 0!==k&&ie.getTitle(k,f)})},onPlayerStateChange:function(e){switch(e.data){case-1:break;case 0:G=!1,J=!1,C.emit("end",y);break;case 1:G=!0,beginning&&window.mobilecheck()&&(ie.ytplayer.pauseVideo(),beginning=!1),1==document.getElementById("play").className.split(" ").length&&$("#play").toggleClass("hide"),2==document.getElementById("pause").className.split(" ").length&&$("#pause").toggleClass("hide"),J&&(C.emit("pos"),J=!1);break;case 2:J=!0,ne.play_pause_show();break;case 3:}},getTitle:function(e,t){var n=t>1?"viewers":"viewer",o=decodeURIComponent(e),a=document.getElementById("song-title"),i=document.getElementById("viewers");document.title=o+" • Zöff / "+T,a.innerHTML=o,i.innerHTML=t+" "+n,a.title=o+" • "+t+" "+n},errorHandler:function(e){5==e.data||100==e.data||101==e.data||150==e.data?(curr_playing=ie.ytplayer.getVideoUrl().replace("https://www.youtube.com/watch?v=",""),C.emit("skip",{error:e.data,id:y,pass:H})):void 0!==y&&ie.ytplayer.loadVideoById(y)},onPlayerReady:function(e){$("#channel-load").css("display","none");try{beginning=!0,U=!0,/iPad|iPhone|iPod/.test(navigator.userAgent)||window.MSStream||($("#player").css("opacity","1"),$("#controls").css("opacity","1"),$(".playlist").css("opacity","1"),ie.ytplayer.loadVideoById(y),ee&&ie.ytplayer.playVideo(),ie.durationSetter(),X?setTimeout(function(){ie.ytplayer.seekTo(w),ee||(ie.ytplayer.pauseVideo(),ne.play_pause_show())},1e3):ie.ytplayer.seekTo(w)),ie.readyLooks(),ne.initYoutubeControls(ie.ytplayer),ne.initSlider(),ie.ytplayer.setVolume(a.get_volume())}catch(t){}},readyLooks:function(){ie.setBGimage(y)},setBGimage:function(e){if(void 0!==e&&!X){var t=new Image;t.onload=function(){var e=new ColorThief,n=e.getColor(t);document.getElementsByTagName("body")[0].style.backgroundColor=i.rgbToHsl(n),$("meta[name=theme-color]").attr("content",i.rgbToHex(n[0],n[1],n[2]))},t.crossOrigin="Anonymous",t.src="https://zoff.no:8080/https://img.youtube.com/vi/"+e+"/mqdefault.jpg"}},set_width:function(e){$(".video-container").width(e)},notifyUser:function(e,t){if(t=t.replace(/\\\'/g,"'").replace(/&quot;/g,"'").replace(/&amp;/g,"&"),"granted"===Notification.permission&&document.hidden){var n=new Notification("Now Playing",{body:t,icon:"http://i.ytimg.com/vi/"+e+"/mqdefault.jpg",iconUrl:"http://i.ytimg.com/vi/"+e+"/mqdefault.jpg"});n.onclick=function(e){window.focus(),this.cancel()},setTimeout(function(){n.close()},5e3)}},setup_all_listeners:function(){C.on("get_list",function(){C.emit("list",T.toLowerCase())}),ie.setup_youtube_listener(T),n.admin_listener(),o.setup_chat_listener(T),o.allchat_listener(),I.channel_listener(),I.skipping_listener()},onYouTubeIframeAPIReady:function(){ie.ytplayer=new YT.Player("player",{videoId:y,playerVars:{rel:"0",wmode:"transparent",controls:"0",iv_load_policy:"3",theme:"light",color:"white"},events:{onReady:ie.onPlayerReady,onStateChange:ie.onPlayerStateChange,onError:ie.errorHandler}})},durationSetter:function(){try{duration=ie.ytplayer.getDuration()}catch(e){duration=0}if(void 0!=duration)try{dMinutes=Math.floor(duration/60),dSeconds=duration-60*dMinutes,currDurr=ie.ytplayer.getCurrentTime(),currDurr>duration&&(currDurr=duration),minutes=Math.floor(currDurr/60),seconds=currDurr-60*minutes,document.getElementById("duration").innerHTML=i.pad(minutes)+":"+i.pad(seconds)+" <span id='dash'>/</span> "+i.pad(dMinutes)+":"+i.pad(dSeconds),per=100/duration*currDurr,per>=100?per=100:0==duration&&(per=0),$("#bar").width(per+"%")}catch(e){}ie.stopInterval||setTimeout(ie.durationSetter,1e3)},loadPlayer:function(){1==$("script[src='https://www.youtube.com/iframe_api']").length?ie.onYouTubeIframeAPIReady():(u=document.createElement("script"),u.src="https://www.youtube.com/iframe_api",m=document.getElementsByTagName("script")[0],m.parentNode.insertBefore(u,m))}}}();