diff --git a/server/public/assets/css/style.css b/server/public/assets/css/style.css index 151fff47..77f4b45a 100755 --- a/server/public/assets/css/style.css +++ b/server/public/assets/css/style.css @@ -2147,6 +2147,10 @@ nav ul li:hover, nav ul li.active { z-index: 99; } +.mobile-delete { + display: none; +} + /*************************************************************************** **************************************************************************** ********************* Screen size specific rules *************************** @@ -2176,6 +2180,27 @@ nav ul li:hover, nav ul li.active { width:95vw !important; } + .list-song { + overflow: visible; + } + + #main-row { + margin-right: -3px !important; + } + + .mobile-delete { + height: 100%; + position: absolute; + display: flex; + justify-content: center; + align-items: center; + width: 60px; + top: 0px; + right: -60px; + /* overflow: visible; */ + z-index: -99999999; + } + #main-container { padding-bottom: 20px; } @@ -2430,8 +2455,9 @@ nav ul li:hover, nav ul li.active { } #playlist { - margin-left: 8px; - width: calc(100% - 8px); + margin-left: 10px; + width: calc(100% - 10px); + overflow: hidden; } #player{ diff --git a/server/public/assets/dist/embed.min.js b/server/public/assets/dist/embed.min.js index a878df11..773c25f7 100755 --- a/server/public/assets/dist/embed.min.js +++ b/server/public/assets/dist/embed.min.js @@ -1 +1 @@ -!function(){function e(e){"parent"==e.data&&(window.parentWindow=e.source,window.parentOrigin=e.origin),"lower"==e.data?window.setVolume(10):"reset"==e.data?window.setVolume(100):"get_info"==e.data&&(window.parentWindow.postMessage({type:"np",title:f},window.parentOrigin),window.parentWindow.postMessage({type:"controller",id:Y.old_id},window.parentOrigin),full_playlist.length>0&&o.sendNext({title:full_playlist[0].title,videoId:full_playlist[0].id}))}function t(e){d.on(e,Y.host_on_action)}function a(){d.on("id",Y.host_listener)}function n(){d.on("np",o.youtube_listener)}function s(){d.on("channel",h.channel_function)}function i(e){$("#volume").slider("value",e),m.setVolume(e)}var o={loaded:!0,before_load:"",after_load:"",player:"",stopInterval:!1,fireplace:"",youtube_listener:function(e){var t;C&&e.np&&window.parentWindow&&window.parentOrigin&&(window.parentWindow.postMessage({type:"np",title:e.np[0].title},window.parentOrigin),full_playlist.length>0&&o.sendNext({title:full_playlist[0].title,videoId:full_playlist[0].id}));try{t=o.player.getPlayerState()}catch(e){t=null}if((!B&&(null!=t||A)||B&&(null==t||A)||!B&&(null==t||A)||B&&-1==t)&&(!B||prev_chan_player!=P)||B&&void 0==p){prev_chan_player=P,A=!1,o.loaded=!1,l.log("--------youtube_listener--------"),l.log("Received: "),l.log(e),l.log("paused variable: "+y),l.log("mobile_beginning variable: "+S);try{l.log("getVideoUrl(): "+o.player.getVideoUrl().split("v=")[1])}catch(e){}if(l.log("video_id variable: "+p),l.log("---------------------------------"),e.np){if(y)o.getTitle(e.np[0].title,viewers),l.mobilecheck()||o.notifyUser(e.np[0].id,e.np[0].title),E||o.stopVideo(),p=e.np[0].id,conf=e.conf[0],time=e.time,c=time-conf.startTime,f=e.np[0].title,duration=e.np[0].duration,o.setBGimage(p);else if(!y){void 0===u?u=e.np[0].id:u!=p&&(u=p),p=e.np[0].id,conf=e.conf[0],time=e.time,c=time-conf.startTime,f=e.np[0].title,duration=e.np[0].duration,S&&l.mobilecheck()&&0===c&&!E&&(c=1);try{full_playlist[0].id!=p||S||h.song_change(full_playlist[0].added),Suggestions.fetchYoutubeSuggests(p)}catch(e){}if(o.getTitle(f,viewers),o.setBGimage(p),v&&!window.MSStream)try{(o.player.getVideoUrl().split("v=")[1]!=p||E)&&(o.loadVideoById(p,duration),l.mobilecheck()||o.notifyUser(p,f),o.seekTo(c),y&&!E&&o.pauseVideo()),y||(S&&!E||o.playVideo(),I||o.durationSetter()),(o.player.getDuration()>c||0===o.player.getDuration()||E||o.player.getCurrentTime()!=c)&&o.seekTo(c),o.after_load=p,o.loaded||setTimeout(function(){o.loaded=!0},500)}catch(e){E&&(o.loadVideoById(p,duration),o.seekTo(c)),I||E||o.durationSetter()}else o.getTitle(f,viewers)}}else{document.getElementById("song-title").innerHTML="Empty channel. Add some songs!",document.title="Zoff - the shared YouTube based radio",window.MSStream||E||$("#player_overlay").hasClass("hide")&&$("#player_overlay").removeClass("hide");try{E||o.stopVideo()}catch(e){}}}else I||o.durationSetter(),duration=o.player.getDuration()},onPlayerStateChange:function(e){l.log("-------onPlayerStateChange------"),l.log("New state\nState: "),l.log(e);try{l.log("Duration: "+o.player.getDuration(),"Current time: "+o.player.getCurrentTime()),l.log("getVideoUrl(): "+o.player.getVideoUrl().split("v=")[1])}catch(e){}switch(l.log("video_id variable: "+p),l.log("---------------------------------"),e.data){case-1:break;case 0:playing=!1,y=!1,B?o.playNext():d.emit("end",{id:p,channel:P.toLowerCase(),pass:C?"":q.crypt_pass(q.get_userpass(P.toLowerCase()))});break;case 1:playing=!0,beginning&&l.mobilecheck()&&!E&&(o.pauseVideo(),beginning=!1,S=!1,setTimeout(function(){l.mobilecheck()&&($("#playpause").css("visibility","visible"),$("#playpause").css("pointer-events","all"),$("#channel-load").css("display","none"))},100)),C||"/"==window.location.pathname||E||l.addClass("#player_overlay","hide"),"/"!=window.location.pathname&&(1==document.getElementById("play").className.split(" ").length&&$("#play").toggleClass("hide"),2==document.getElementById("pause").className.split(" ").length&&$("#pause").toggleClass("hide")),y&&!B&&(d.emit("pos",{channel:P.toLowerCase(),pass:C?"":q.crypt_pass(q.get_userpass(P.toLowerCase()))}),y=!1);break;case 2:E||(y=!0,"/"!=window.location.pathname&&m.play_pause_show(),S=!0)}},playVideo:function(){E?(castSession.sendMessage("urn:x-cast:zoff.me",{type:"playVideo"}),chrome.cast.media.GenericMediaMetadata({metadataType:"GENERIC",title:f,image:"https://img.youtube.com/vi/"+p+"/mqdefault.jpg"}),chrome.cast.Image("https://img.youtube.com/vi/"+p+"/mqdefault.jpg"),$("#pause").hasClass("hide")&&($("#play").toggleClass("hide"),$("#pause").toggleClass("hide"))):o.player.playVideo()},pauseVideo:function(){E?(castSession.sendMessage("urn:x-cast:zoff.me",{type:"pauseVideo"}),$("#play").hasClass("hide")&&($("#play").toggleClass("hide"),$("#pause").toggleClass("hide"))):o.player.pauseVideo()},seekTo:function(e){E?castSession.sendMessage("urn:x-cast:zoff.me",{type:"seekTo",seekTo:e}):B?o.player.seekTo(0):o.player.seekTo(e)},loadVideoById:function(e,t){E?(castSession.sendMessage("urn:x-cast:zoff.me",{type:"loadVideo",videoId:e}),chrome.cast.media.GenericMediaMetadata({metadataType:"GENERIC",title:f,image:"https://img.youtube.com/vi/"+e+"/mqdefault.jpg"}),chrome.cast.Image("https://img.youtube.com/vi/"+e+"/mqdefault.jpg")):o.player.loadVideoById({videoId:e,startSeconds:0,endSeconds:t})},stopVideo:function(){if(E)castSession.sendMessage("urn:x-cast:zoff.me",{type:"stopVideo"});else try{o.player.stopVideo()}catch(e){}},setVolume:function(e){E?castSession.setVolume(e/100):o.player.setVolume(e)},playNext:function(){var e=full_playlist[0];p=e.id,time=(new Date).getTime(),f=e.title,duration=e.duration,o.getTitle(f,viewers),o.setBGimage(p),E?(castSession.sendMessage("urn:x-cast:zoff.me",{type:"loadVideo",videoId:p}),chrome.cast.media.GenericMediaMetadata({metadataType:"GENERIC",title:f,image:"https://img.youtube.com/vi/"+p+"/mqdefault.jpg"}),chrome.cast.Image("https://img.youtube.com/vi/"+p+"/mqdefault.jpg")):o.loadVideoById(p,duration),h.channel_function({type:"song_change",time:time})},sendNext:function(e){E&&castSession.sendMessage("urn:x-cast:zoff.me",{type:"nextVideo",title:e.title,videoId:e.videoId}),C&&window.parentWindow&&window.parentOrigin&&window.parentWindow.postMessage({type:"nextVideo",title:e.title},window.parentOrigin)},getTitle:function(e,t){var a=decodeURIComponent(e);if("/"!=window.location.pathname){var n=document.getElementById("song-title"),s=document.getElementById("viewers");n.innerHTML=a,s.innerHTML="visibility "+t,n.title=a,E&&($("#player_overlay").css("background","url(https://img.youtube.com/vi/"+p+"/hqdefault.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"))}document.title=a+" • Zoff / "+P},errorHandler:function(e){z||(5==e.data||100==e.data||101==e.data||150==e.data?(curr_playing=o.player.getVideoUrl().replace("https://www.youtube.com/watch?v=",""),d.emit("skip",{error:e.data,id:p,pass:""==T?"":q.crypt_pass(T),channel:P.toLowerCase(),userpass:C?"":q.crypt_pass(q.get_userpass(P.toLowerCase()))})):void 0!==p&&o.loadVideoById(p,duration))},onPlayerReady:function(e){try{beginning=!0,v=!0,window.MSStream||(l.mobilecheck()?($("#playpause").css("visibility","hidden"),$("#playpause").css("pointer-events","none")):$("#channel-load").css("display","none"),$("#player").css("opacity","1"),$("#controls").css("opacity","1"),$(".playlist").css("opacity","1"),o.loadVideoById(p,duration),!D||l.mobilecheck()&&!E||o.playVideo(),I||o.durationSetter(),C?setTimeout(function(){o.player.seekTo(c),D||(o.player.pauseVideo(),m.play_pause_show())},1e3):o.seekTo(c)),o.readyLooks(),m.initYoutubeControls(o.player),m.initSlider(),o.player.setVolume(q.get_volume()),$(".video-container").removeClass("no-opacity")}catch(e){}},readyLooks:function(){o.setBGimage(p)},setBGimage:function(e){if(void 0!==e&&!C){var t=new Image;t.onload=function(){var e=new ColorThief,a=e.getColor(t);"/"!=window.location.pathname&&(document.getElementById("main-container").style.backgroundColor=l.rgbToHsl(a,!0),$("meta[name=theme-color]").attr("content",l.rgbToHex(a[0],a[1],a[2])))},t.crossOrigin="Anonymous",t.src="https://zoff.me:8081/https://img.youtube.com/vi/"+e+"/mqdefault.jpg"}},set_width:function(e){if($(".video-container").width(e),!l.mobilecheck())if($(window).width()>769){var t=$(window).width()-$(".control-list").width()-$(".zbrand").outerWidth()-$(".brand-logo-navigate").outerWidth()-66;title_width=t,$(".title-container").width(title_width)}else $(".title-container").width("100%")},notifyUser:function(e,t){if(t=t.replace(/\\\'/g,"'").replace(/"/g,"'").replace(/&/g,"&"),"granted"===Notification.permission&&document.hidden&&!C){var a=new Notification("Now Playing",{body:t,icon:"https://i.ytimg.com/vi/"+e+"/mqdefault.jpg",iconUrl:"http://i.ytimg.com/vi/"+e+"/mqdefault.jpg"});a.onclick=function(e){window.focus(),this.cancel()},setTimeout(function(){a.close()},5e3)}},setup_all_listeners:function(){get_list_listener(),n(),setup_admin_listener(),setup_chat_listener(),s()},onYouTubeIframeAPIReady:function(){o.player=new YT.Player("player",{videoId:p,playerVars:{rel:"0",wmode:"transparent",controls:"0",fs:"0",iv_load_policy:"3",theme:"light",color:"white",showinfo:0},events:{onReady:o.onPlayerReady,onStateChange:o.onPlayerStateChange,onError:o.errorHandler}})},createFireplacePlayer:function(){o.fireplace=new YT.Player("fireplace_player",{videoId:"L_LUpnjgPso",playerVars:{rel:"0",wmode:"transparent",controls:"0",fs:"0",iv_load_policy:"3",theme:"light",color:"white",showinfo:0},events:{onReady:o.onFireplaceReady,onStateChange:o.onFireplaceChange}})},onFireplaceReady:function(){o.fireplace.playVideo()},onFireplaceChange:function(e){switch(e.data){case 0:o.fireplace.seekTo(0),o.fireplace.playVideo();break;case 2:o.fireplace.playVideo()}},durationSetter:function(){try{j||void 0===duration||(o.stopInterval||(I=!0),dMinutes=Math.floor(duration/60),dSeconds=duration-60*dMinutes,currDurr=void 0!==o.player.getCurrentTime()?Math.floor(o.player.getCurrentTime()):c,currDurr>duration&&(currDurr=duration),minutes=Math.floor(currDurr/60),seconds=currDurr-60*minutes,document.getElementById("duration").innerHTML=l.pad(minutes)+":"+l.pad(seconds)+" / "+l.pad(dMinutes)+":"+l.pad(dSeconds),per=100/duration*currDurr,per>=100?per=100:0===duration&&(per=0),C&&window.parentWindow&&window.parentOrigin&&window.parentWindow.postMessage({type:"duration",duration:o.player.getCurrentTime(),full_duration:o.player.getDuration(),percent:per},window.parentOrigin),O||$("#bar").width(per+"%"))}catch(e){}o.stopInterval||setTimeout(o.durationSetter,1e3)},loadPlayer:function(){if(1==$("script[src='https://www.youtube.com/iframe_api']").length)try{o.onYouTubeIframeAPIReady()}catch(e){console.error("Seems YouTube iFrame script isn't correctly loaded. Please reload the page.")}else tag=document.createElement("script"),tag.src="https://www.youtube.com/iframe_api",firstScriptTag=document.getElementsByTagName("script")[0],firstScriptTag.parentNode.insertBefore(tag,firstScriptTag)}},l={log:function(e){"true"===localStorage.debug&&console.log(e)},rnd:function(e){return e[Math.floor(Math.random()*e.length)]},mobilecheck:function(){var e=!1;return(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|Android|Silk|lge |maemo|midp|mmp|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|phone)|xda|xiino/i.test(navigator.userAgent)||/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(navigator.userAgent.substr(0,4)))&&(e=!0),e},predicate:function(){for(var e,t,a,n=[],s=arguments.length,i=function(e,t){return e===t?0:e>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 e<10?"0"+Math.floor(e):Math.floor(e)},contains:function(e,t){for(var a=e.length;a--;)if(e[a]===t)return!0;return!1},sample:function(){Date.now()-lastSample>=2*SAMPLE_RATE&&(d.removeAllListeners(),d.disconnect(),d.connect(),o.setup_all_listeners()),lastSample=Date.now(),setTimeout(l.sample,SAMPLE_RATE)},loadjsfile:function(e){if(-1==filesadded.indexOf("["+e+"]")){var t=document.createElement("script");t.setAttribute("type","text/javascript"),t.setAttribute("src",e),document.getElementsByTagName("head")[0].appendChild(t),filesadded+="["+e+"]"}},msieversion:function(){return!!(window.navigator.userAgent.indexOf("MSIE ")>0||navigator.userAgent.match(/Trident.*rv\:11\./))},getRandomInt:function(e,t){return Math.floor(Math.random()*(t-e))+e},secondsToOther:function(e){var t=e,a=Math.floor(t/60);return t-=60*a,[a,t]},rgbToHsl:function(e,t){r=e[0],g=e[1],b=e[2],r/=255,g/=255,b/=255;var a,n,s=Math.max(r,g,b),i=Math.min(r,g,b),o=(s+i)/2;if(s==i)a=n=0;else{var l=s-i;switch(n=o>.5?l/(2-s-i):l/(s+i),s){case r:a=(g-b)/l+(g.5&&t?o=.4:o<.65&&!t&&(o=.65),"hsl("+Math.floor(360*a)+", "+Math.floor(100*n)+"%, "+Math.floor(100*o)+"%)"},componentToHex:function(e){var t=e.toString(16);return 1==t.length?"0"+t:t},rgbToHex:function(e,t,a){return"#"+l.componentToHex(e)+l.componentToHex(t)+l.componentToHex(a)},upperFirst:function(e){return e.substring(0,1).toUpperCase()+e.substring(1).toLowerCase()},addClass:function(e,t){l.contains($(e).attr("class").split(" "),t)||$(e).addClass(t)},send_mail:function(e,t){""!==e&&""!==t&&($("#submit-contact-form").addClass("hide"),$("#send-loader").removeClass("hide"),$("#contact-form-from").attr("disabled","true"),$("#contact-form-message").attr("disabled","true"),$.ajax({type:"POST",data:{from:e,message:t},url:"/api/mail",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: contact@zoff.no"))}}))}};Element.prototype.remove=function(){this.parentElement.removeChild(this)},NodeList.prototype.remove=HTMLCollection.prototype.remove=function(){for(var e=0,t=this.length;e=0&&e<=33?(1==document.getElementById("v-full").className.split(" ").length&&($("#v-full").toggleClass("hide"),$("#v-full-overlay").toggleClass("hide")),1==document.getElementById("v-medium").className.split(" ").length&&($("#v-medium").toggleClass("hide"),$("#v-medium-overlay").toggleClass("hide")),2==document.getElementById("v-low").className.split(" ").length&&($("#v-low").toggleClass("hide"),$("#v-low-overlay").toggleClass("hide")),1==document.getElementById("v-mute").className.split(" ").length&&($("#v-mute").toggleClass("hide"),$("#v-mute-overlay").toggleClass("hide"))):e>=34&&e<=66?(1==document.getElementById("v-full").className.split(" ").length&&($("#v-full").toggleClass("hide"),$("#v-full-overlay").toggleClass("hide")),2==document.getElementById("v-medium").className.split(" ").length&&($("#v-medium").toggleClass("hide"),$("#v-medium-overlay").toggleClass("hide")),1==document.getElementById("v-low").className.split(" ").length&&($("#v-low").toggleClass("hide"),$("#v-low-overlay").toggleClass("hide")),1==document.getElementById("v-mute").className.split(" ").length&&($("#v-mute").toggleClass("hide"),$("#v-mute-overlay").toggleClass("hide"))):e>=67&&e<=100&&(2==document.getElementById("v-full").className.split(" ").length&&($("#v-full").toggleClass("hide"),$("#v-full-overlay").toggleClass("hide")),1==document.getElementById("v-medium").className.split(" ").length&&($("#v-medium").toggleClass("hide"),$("#v-medium-overlay").toggleClass("hide")),1==document.getElementById("v-low").className.split(" ").length&&($("#v-low").toggleClass("hide"),$("#v-low-overlay").toggleClass("hide")),1==document.getElementById("v-mute").className.split(" ").length&&($("#v-mute").toggleClass("hide"),$("#v-mute-overlay").toggleClass("hide")))},playPause:function(){state=o.player.getPlayerState(),button=document.getElementById("playpause"),1==state?o.pauseVideo():2==state&&o.playVideo()},volumeOptions:function(){E||(o.player.isMuted()?(o.player.unMute(),x=o.player.getVolume(),$("#volume").slider("value",o.player.getVolume())):(o.player.mute(),$("#volume").slider("value",0)))},hoverMute:function(e){x=o.player.getVolume()}},h={empty:!1,page:0,can_fit:Math.round($("#wrapper").height()/71),element_height:$("#wrapper").height()/Math.round($("#wrapper").height()/71)-25,uris:[],not_found:[],num_songs:0,channel_function:function(e){switch(z&&(z=!1,$("#user_password").modal("close")),e.type){case"list":B&&(!B||e.shuffled)||B&&prev_chan_list==P?B&&prev_chan_list==P&&void 0!=full_playlist&&!e.shuffled&&(h.populate_list(full_playlist,!0),o.sendNext({title:full_playlist[0].title,videoId:full_playlist[0].id})):(prev_chan_list=P,h.populate_list(e.playlist),o.sendNext({title:full_playlist[0].title,videoId:full_playlist[0].id}));break;case"added":h.added_song(e.value),o.sendNext({title:full_playlist[0].title,videoId:full_playlist[0].id});break;case"deleted":h.deleted_song(e.value,e.removed);break;case"vote":B||(h.voted_song(e.value,e.time),o.sendNext({title:full_playlist[0].title,videoId:full_playlist[0].id}));break;case"song_change":"/"!=window.location.pathname&&h.song_change(e.time,e.remove),o.sendNext({title:full_playlist[0].title,videoId:full_playlist[0].id})}},insertAtBeginning:function(e,t){var a=0==h.page?"":"none",n=h.generateSong(e,t,!1,!0,!1,a,!1);$("#wrapper").append(n)},insertAtIndex:function(e,t,a){var n=h.getIndexOfSong(e.id),s="none";if(!e.now_playing){n>=h.page&&n div:nth-child("+n+")").after(i);var o=$("#wrapper").children()[n];$(o).css("display",s),"inline-block"==s&&$("#wrapper").children().length>=h.page+h.can_fit+1?$($("#wrapper").children()[h.page+h.can_fit]).css("display","none"):n=0?$($("#wrapper").children()[h.page]).css("display","inline-block"):$("#wrapper").children().length>h.page+h.can_fit&&$($("#wrapper").children()[h.page+h.can_fit-1]).css("display","inline-block"),a&&h.page>0&&$($("#wrapper").children()[h.page-1]).css("display","none"),t&&setTimeout(function(){$(o).css("transform","translateX(0%)"),setTimeout(function(){$(o).removeClass("side_away")},300)},5)}},populate_list:function(e,t){if(l.mobilecheck()||C?C?(h.can_fit=Math.round($("#wrapper").height()/91)+1,h.element_height=$("#wrapper").height()/h.can_fit-4):(h.can_fit=Math.round(($(window).height()-$(".tabs").height()-$("header").height()-64-8)/71)+1,h.element_height=($(window).height()-$(".tabs").height()-$("header").height()-64-8)/h.can_fit-5):(h.can_fit=Math.round($("#wrapper").height()/71)+1,h.element_height=$("#wrapper").height()/h.can_fit-5.3),h.element_height<55.2&&(h.element_height=55.2),void 0===_&&(_=$("#list-song-html").html()),full_playlist=e,B&&!t)for(var a=0;a1?($.each(full_playlist,function(e,t){if(!t.now_playing){var a=h.generateSong(t,!1,k,!0,!1,"",!0);$("#wrapper").append(a)}}),$("#wrapper").children().length>h.can_fit&&!$("#pageButtons").length?($('
first_pagefirst_pagenavigate_before prevnavigate_before prev 1 next navigate_nextnext navigate_nextlast_pagelast_page
').insertAfter("#wrapper"),$(".prev_page").css("display","none"),$(".first_page").css("display","none"),$(".next_page_hide").css("display","none"),$(".last_page_hide").css("display","none")):$("#pageButtons").length||($('
first_pagefirst_pagenavigate_before prevnavigate_before prev 1 next navigate_nextnext navigate_nextlast_pagelast_page
').insertAfter("#wrapper"),$(".prev_page").css("display","none"),$(".next_page").css("display","none"),$(".last_page").css("display","none"),$(".first_page").css("display","none"),$(".next_page_hide").css("display","inline-flex"),$(".prev_page_hide").css("display","inline-flex")),h.dynamicContentPage(-10)):(h.empty=!0,$("#wrapper").html("The playlist is empty."),$("#pageButtons").length||$('
first_pagefirst_pagenavigate_before prevnavigate_before prev 1 next navigate_nextnext navigate_nextlast_pagelast_page
').insertAfter("#wrapper"),$(".prev_page").css("display","none"),$(".next_page").css("display","none"),$(".last_page").css("display","none"),$(".last_page_hide").css("display","inline-flex"),$(".first_page").css("display","none"),$(".next_page_hide").css("display","inline-flex"),$(".prev_page_hide").css("display","inline-flex")),$("#settings").css("visibility","visible"),$("#settings").css("opacity","1"),$("#wrapper").css("opacity","1")},dynamicContentPageJumpTo:function(e){((e*=h.can_fit)>h.page||e0&&"none"==$(".prev_page").css("display")&&($(".prev_page").css("display","inline-flex"),$(".prev_page_hide").css("display","none"),$(".first_page").css("display","inline-flex"),$(".first_page_hide").css("display","none")),h.page+h.can_fit>=$("#wrapper").children().length&&($(".next_page_hide").css("display","inline-flex"),$(".next_page").css("display","none"),$(".last_page_hide").css("display","inline-flex"),$(".last_page").css("display","none")),$("#pageNumber").html(h.page/h.can_fit+1))},dynamicContentPage:function(e){1==e?($("#wrapper").children().slice(h.page,h.page+h.can_fit).hide(),h.page=h.page+h.can_fit,$("#wrapper").children().slice(h.page,h.page+h.can_fit).css("display","inline-block"),h.page>0&&"none"==$(".prev_page").css("display")&&($(".prev_page").css("display","inline-flex"),$(".prev_page_hide").css("display","none"),$(".first_page").css("display","inline-flex"),$(".first_page_hide").css("display","none")),h.page+h.can_fit>=$("#wrapper").children().length&&($(".next_page_hide").css("display","inline-flex"),$(".next_page").css("display","none"),$(".last_page_hide").css("display","inline-flex"),$(".last_page").css("display","none"))):10==e?($("#wrapper").children().slice(h.page,h.page+h.can_fit).hide(),h.page=Math.floor(($("#wrapper").children().length-1)/h.can_fit)*h.can_fit,$("#wrapper").children().slice(h.page,h.page+h.can_fit).css("display","inline-block"),h.page>0&&"none"==$(".prev_page").css("display")&&($(".prev_page").css("display","inline-flex"),$(".prev_page_hide").css("display","none"),$(".first_page").css("display","inline-flex"),$(".first_page_hide").css("display","none")),h.page+h.can_fit>=$("#wrapper").children().length&&($(".next_page_hide").css("display","inline-flex"),$(".next_page").css("display","none"),$(".last_page_hide").css("display","inline-flex"),$(".last_page").css("display","none"))):-10==e?($("#wrapper").children().slice(h.page,h.page+h.can_fit).hide(),h.page=0,$("#wrapper").children().slice(h.page,h.page+h.can_fit).css("display","inline-block"),0==h.page&&"none"!=$(".prev_page").css("display")?($(".prev_page").css("display","none"),$(".prev_page_hide").css("display","inline-flex"),$(".first_page").css("display","none"),$(".first_page_hide").css("display","inline-flex")):"none"==$(".prev_page").css("display")?($(".prev_page_hide").css("display","inline-flex"),$(".first_page_hide").css("display","inline-flex")):($(".prev_page_hide").css("display","none"),$(".first_page_hide").css("display","none")),h.page+h.can_fit<$("#wrapper").children().length&&($(".next_page_hide").css("display","none"),$(".next_page").css("display","inline-flex"),$(".last_page_hide").css("display","none"),$(".last_page").css("display","inline-flex"))):($("#wrapper").children().slice(h.page-h.can_fit,h.page).css("display","inline-block"),$("#wrapper").children().slice(h.page,h.page+h.can_fit).hide(),h.page=h.page-h.can_fit<0?0:h.page-h.can_fit,0==h.page&&"none"!=$(".prev_page").css("display")?($(".prev_page").css("display","none"),$(".prev_page_hide").css("display","inline-flex"),$(".first_page").css("display","none"),$(".first_page_hide").css("display","inline-flex")):"none"==$(".prev_page").css("display")?($(".prev_page_hide").css("display","inline-flex"),$(".first_page_hide").css("display","inline-flex")):($(".prev_page_hide").css("display","none"),$(".first_page_hide").css("display","none")),h.page+h.can_fit<$("#wrapper").children().length&&($(".next_page_hide").css("display","none"),$(".next_page").css("display","inline-flex"),$(".last_page_hide").css("display","none"),$(".last_page").css("display","inline-flex"))),$("#pageNumber").html(h.page/h.can_fit+1)},added_song:function(e){var t;if(void 0!=e){if(0!==full_playlist.length&&(t=full_playlist.pop()),full_playlist.push(e),h.sortList(),t&&full_playlist.push(t),$("#suggested-"+e.id).length>0){number_suggested-=1,number_suggested<0&&(number_suggested=0);var a=number_suggested>9?"9+":number_suggested;$(".suggested-link span.badge.new.white").hasClass("hide")||0!=a||$(".suggested-link span.badge.new.white").addClass("hide"),$(".suggested-link span.badge.new.white").text(a)}$("#suggested-"+e.id).remove(),h.empty&&(h.empty=!1),$("#empty-channel-message").remove(),h.insertAtIndex(e,!0),$($("#wrapper").children()[h.page+h.can_fit]).css("display","none"),$("#wrapper").children().length>h.page+h.can_fit?($(".next_page_hide").css("display","none"),$(".next_page").removeClass("hide"),$(".last_page_hide").css("display","none"),$(".next_page").css("display","inline-flex"),$(".last_page").css("display","inline-flex")):($(".next_page_hide").css("display","inline-flex"),$(".next_page").css("display","none"))}},deleted_song:function(e,t){try{var a=h.getIndexOfSong(e);$("#wrapper").children()[a];a=0?($($("#wrapper").children()[h.page]).css("height",0),$($("#wrapper").children()[h.page]).css("display","inline-block"),$($("#wrapper").children()[h.page]).css("height",h.element_height)):$("#wrapper").children().length>h.page+h.can_fit&&($($("#wrapper").children()[h.page+h.can_fit]).css("height",0),$($("#wrapper").children()[h.page+h.can_fit]).css("display","inline-block"),$($("#wrapper").children()[h.page+h.can_fit]).css("height",h.element_height)),h.page>=$("#wrapper").children().length-1?(h.dynamicContentPage(-1),$(".next_page_hide").css("display","inline-flex"),$(".next_page").css("display","none"),$(".last_page_hide").css("display","inline-flex"),$(".last_page").css("display","none")):h.page+h.can_fit+1>=$("#wrapper").children().length-1&&($(".next_page_hide").css("display","inline-flex"),$(".next_page").css("display","none"),$(".last_page_hide").css("display","inline-flex"),$(".last_page").css("display","none")),h.page<=a&&h.page-h.can_fit<=a?($("#"+e).addClass("side_away"),$("#"+e).css("transform","translateX(-100%)"),setTimeout(function(){$("#"+e).remove()},300)):$("#"+e).remove(),full_playlist.splice(h.getIndexOfSong(e),1),o.sendNext({title:full_playlist[0].title,videoId:full_playlist[0].id})}catch(t){full_playlist.splice(h.getIndexOfSong(e),1),h.empty||($("#"+e).remove(),a=0?$($("#wrapper").children()[h.page-1]).css("display","inline-block"):$("#wrapper").children().length>h.page+h.can_fit&&$($("#wrapper").children()[h.page+(h.can_fit-1)]).css("display","inline-block"),o.sendNext({title:full_playlist[0].title,videoId:full_playlist[0].id}))}full_playlist.length<=2&&(h.empty=!0,$("#wrapper").html("The playlist is empty.")),$("#suggested-"+e).remove(),h.page,h.can_fit,$("#wrapper").children().length,h.page>=$("#wrapper").children().length&&h.dynamicContentPage(-1),Suggestions.checkUserEmpty()},voted_song:function(e,t){var a=h.getIndexOfSong(e),n=full_playlist[a];full_playlist[a].votes+=1,full_playlist[a].added=t,h.sortList(),$("#"+e).remove(),h.insertAtIndex(n,!1)},song_change:function(e,t){try{var a=full_playlist.length-1;$("#wrapper").children()[0].remove(),0===$("#wrapper").children().length&&(h.empty=!0,$("#wrapper").html("The playlist is empty.")),full_playlist[0].now_playing=!0,full_playlist[0].votes=0,full_playlist[0].guids=[],full_playlist[0].added=e,t?delete full_playlist[a]:full_playlist[a].now_playing=!1,l.log("---------------------------"),l.log("---SONG ON FIRST INDEX-----"),l.log(full_playlist[0]),l.log("---------------------------"),full_playlist.push(full_playlist.shift()),t||h.insertAtIndex(full_playlist[a-1],!1,!0)}catch(e){}},vote:function(e,t){return!B||"del"==t&&hasadmin&&!w&&""!=T?d.emit("vote",{channel:P,id:e,type:t,adminpass:""==T?"":q.crypt_pass(T),pass:C?"":q.crypt_pass(q.get_userpass(P.toLowerCase()))}):"pos"==t?h.voted_song(e,(new Date).getTime()/1e3):h.deleted_song(e),!0},skip:function(){return B?o.playNext():d.emit("skip",{pass:""==T?"":q.crypt_pass(T),id:p,channel:P.toLowerCase(),userpass:C?"":q.crypt_pass(q.get_userpass(P.toLowerCase()))}),!0},exportToSpotify:function(){$.ajax({type:"GET",url:"https://api.spotify.com/v1/me",headers:{Authorization:"Bearer "+access_token_data.access_token},success:function(e){var t=e.id;$("#playlist_loader_export").removeClass("hide"),$(".exported-list-container").removeClass("hide"),$.ajax({type:"POST",url:"https://api.spotify.com/v1/users/"+t+"/playlists",headers:{Authorization:"Bearer "+access_token_data.access_token,"Content-Type":"application/json"},data:JSON.stringify({name:P.toLowerCase()+" - Zoff",public:!0}),success:function(e){var a=e.id;$.each(full_playlist,function(e,n){h.searchSpotify(n,a,t)})}})}})},searchSpotify:function(e,t,a){var n=e.title,s=e.title.toLowerCase().replace("-"," ");s.startsWith("the")&&(s=s.replace("the","")),s=s.replace(" hd",""),s=s.replace("official hd video",""),s=s.replace("unofficial video",""),s=s.replace("studio footage",""),s=s.replace("great song",""),s=s.replace("-"," "),s=s.replace("-"," "),s=s.replace(" hq"," "),s=s.replace("lyric video",""),s=s.replace("lyrics video",""),s=s.replace("album version",""),s=s.replace("drive original movie soundtrack",""),s=s.replace("original movie soundtrack",""),s=s.replace("live sessions",""),s=s.replace("audio only",""),s=s.replace("audio",""),s=s.replace("(new)",""),s=s.replace(" by "," "),s=s.replace(" vs "," "),s=s.replace("(full)"," "),s=s.replace("(video)"," "),s=s.replace("&"," "),s=s.replace("with lyrics",""),s=s.replace("lyrics",""),s=s.replace("w/",""),s=s.replace("w/",""),s=s.replace("official video",""),s=s.replace("studio version",""),s=s.replace("official music video",""),s=s.replace("music video",""),s=s.replace("musicvideo",""),s=s.replace("original video",""),s=s.replace("full version",""),s=s.replace("full song",""),s=s.replace("(official)",""),s=s.replace("official",""),s=s.replace("(original)",""),s=s.replace("("," "),s=s.replace(")"," "),s=s.replace("|",""),s=s.replace("feat."," "),s=s.replace("feat"," "),s=s.replace("ft."," "),s=s.replace("["," "),s=s.replace("]"," "),s=s.replace(" free ",""),s=s.replace(" hd",""),s=s.replace("original mix"," "),s=s.replace("radio edit"," "),s=s.replace("pop version"," "),s=s.replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," "),s=encodeURIComponent(s),$.ajax({type:"GET",url:"https://api.spotify.com/v1/search?q="+s+"&type=track",headers:{Authorization:"Bearer "+access_token_data.access_token},async:!0,statusCode:{429:function(n){console.log(n.getAllResponseHeaders());var s=n.getResponseHeader("Retry-After");console.log(s),s||(s=5),s=parseInt(s,10),l.log("Retry-After",s),setTimeout(function(){h.searchSpotify(e,t,a)},1e3*s)}},error:function(n){if(429==n.status){console.log(n.getAllResponseHeaders());var s=n.getResponseHeader("Retry-After");console.log(s),s||(s=5),s=parseInt(s,10),l.log("Retry-After",s),setTimeout(function(){h.searchSpotify(e,t,a)},1e3*s)}},success:function(e){var i=!1;if($.each(e.tracks.items,function(e,t){if(t.name=t.name.toLowerCase(),t.name=t.name.replace("("," "),t.name=t.name.replace(")"," "),t.name=t.name.replace("["," "),t.name=t.name.replace("]"," "),t.name=t.name.replace("-"," "),t.name=t.name.replace("-"," "),t.name=t.name.replace("-"," "),t.name=t.name.replace("original mix"," "),t.name=t.name.replace("album version"," "),t.name=t.name.replace("abum version"," "),t.name=t.name.replace("feat."," "),t.artists[0].name=t.artists[0].name.replace("feat."," "),t.artists[0].name=t.artists[0].name.replace("feat"," "),t.name=t.name.replace("feat"," "),t.name=t.name.replace("ft."," "),t.name=t.name.replace("radio edit"," "),t.name=t.name.replace("pop version"," "),t.name=t.name.replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," "),t.artists[0].name=t.artists[0].name.replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ")," "==t.name.substring(t.name.length-1)&&(t.name=t.name.substring(0,t.name.length-1)),"."==t.name.substring(t.name.length-1)&&"."!=s.substring(s.length-1)&&(t.name=t.name.substring(0,t.name.length-1)),decodeURIComponent(s).indexOf(t.artists[0].name.toLowerCase())>=0&&decodeURIComponent(s).indexOf(t.name.toLowerCase())>=0)return i=!0,h.uris.push(t.uri),l.log("Found",s),!1;for(var a=t.name.split(" "),e=0;e=0||"&"==a[e]&&s.indexOf("and")>=0)&&s.indexOf(a[e])<0)return!0;return i=!0,h.uris.push(t.uri),l.log("Found",s),!1}),i||(h.not_found.push(n),h.num_songs=h.num_songs+1,l.log("Didn't find",n)),h.num_songs+h.uris.length==full_playlist.length){if(h.uris.length>100){for(;h.uris.length>100;)h.addToSpotifyPlaylist(h.uris.slice(0,100),t,a),h.uris=h.uris.slice(100,h.uris.length);h.addToSpotifyPlaylist(h.uris,t,a),$("#playlist_loader_export").addClass("hide")}else h.addToSpotifyPlaylist(h.uris,t,a),$("#playlist_loader_export").addClass("hide");0==$(".exported-spotify-list").length&&$(".exported-list").append(""+P+""),$.each(h.not_found,function(e,t){var a=$("
"+not_export_html+"
");a.find(".extra-add-text").attr("value",t),a.find(".extra-add-text").attr("title",t),$(".not-exported-container").append(a.html())}),$(".not-exported").removeClass("hide"),$(".spotify_export_button").css("display","block")}}})},addToSpotifyPlaylist:function(e,t,a){$.ajax({type:"POST",url:"https://api.spotify.com/v1/users/"+a+"/playlists/"+t+"/tracks",headers:{Authorization:"Bearer "+access_token_data.access_token,"Content-Type":"application/json"},data:JSON.stringify({uris:e}),error:function(n){var s=t,i=e,o=a;setTimeout(function(){h.addToSpotifyPlaylist(i,s,o)},3e3)},success:function(e){l.log("Added songs")}})},exportToYoutube:function(){$(".exported-list-container").removeClass("hide"),$("#playlist_loader_export").removeClass("hide"),$.ajax({type:"POST",url:"https://www.googleapis.com/youtube/v3/playlists?part=snippet",headers:{Authorization:"Bearer "+access_token_data_youtube.access_token,"Content-Type":"application/json"},data:JSON.stringify({snippet:{title:l.upperFirst(P.toLowerCase()),description:"Playlist exported from zoff"}}),success:function(e){var t=e.id;h.addToYoutubePlaylist(t,full_playlist,0,"https://www.googleapis.com/youtube/v3/playlistItems?part=snippet")},error:function(e){l.log(e)}})},addToYoutubePlaylist:function(e,t,a,n){var s=JSON.stringify({snippet:{playlistId:e,resourceId:{kind:"youtube#video",videoId:t[a].id}}});$.ajax({type:"POST",url:n,headers:{Authorization:"Bearer "+access_token_data_youtube.access_token,"Content-Type":"application/json"},data:s,success:function(s){l.log("Added video: "+t[a].id+" to playlist id "+e),a==t.length-1?(l.log("All videoes added!"),l.log("url: https://www.youtube.com/playlist?list="+e),$(".exported-list").append(""+P+""),$("#playlist_loader_export").addClass("hide"),$(".current_number").addClass("hide")):($(".current_number").removeClass("hide"),$(".current_number").text(a+1+" of "+t.length),h.addToYoutubePlaylist(e,t,a+1,n))}})},importOldList:function(e){var t="",a=0;playlist_url="lists/"+e+".json",list=$.parseJSON($.ajax({type:"GET",url:playlist_url,async:!1}).responseText),$.each(list.songs,function(e,n){t+=n.id+",",a>45&&(Search.addVideos(t),t="",a=0),a++}),Search.addVideos(t),document.getElementById("search").value=""},sortList:function(){full_playlist.sort(l.predicate({name:"votes",reverse:!0},{name:"added",reverse:!1},{name:"title",reverse:!1}))},show:function(){l.mobilecheck()||(showToggle?(showToggle=!1,$("#toptitle").empty(),$("#chan").addClass("bigChan"),$("#chan").html("zoff.me/"+P.toLowerCase())):(showToggle=!0,$("#toptitle").html("Zoff"),$("#chan").removeClass("bigChan"),$("#chan").html(P)))},generateSong:function(e,t,a,n,s,i,o){void 0===_&&(_=$("#list-song-html").html());var r,c,d=e.id,p=e.title,u=e.votes,g="background-image:url('//img.youtube.com/vi/"+d+"/mqdefault.jpg');",m=$("
"+_+"
"),f="style";if(t&&(m.find(".list-song").css("transform","translateX(100%)"),m.find(".list-song").addClass("side_away")),m.find(".list-song").css("height",h.element_height),w||m.find(".card-action").removeClass("hide"),1==u&&m.find(".vote-text").text("vote"),a&&(g="//img.youtube.com/vi/"+d+"/mqdefault.jpg",f="data-original"),n){m.find(".list-votes").text(u),m.find("#list-song").attr("data-video-id",d),m.find("#list-song").attr("data-video-type","song"),m.find("#list-song").attr("id",d),m.find(".vote-container").attr("title",p),($("#wrapper").children().length>=h.can_fit&&o||"none"==i)&&m.find(".card").css("display","none"),r=".vote-container",c="delete_button";var y=l.secondsToOther(e.duration);m.find(".card-duration").text(l.pad(y[0])+":"+l.pad(y[1]))}else if(!n){m.find(".suggested_remove").removeClass("hide"),m.find(".vote-text").text(""),m.find(".card-duration").text(l.pad(e.duration[0])+":"+l.pad(e.duration[1]));var v="user";r=".add-suggested",s?c="del_user_suggested":(c="del_suggested",v="system"),m.find(".vote-container").attr("class","clickable add-suggested"),m.find(".add-suggested").attr("title",p),m.find(".delete_button").addClass(c),m.find(r).attr("data-video-title",p),m.find(r).attr("data-video-length",e.length),m.find(r).attr("data-added-by",v),m.find("#list-song").attr("data-video-type","suggested"),m.find("#list-song").attr("data-video-id",d),m.find("#list-song").attr("id","suggested-"+d),m.find(".list-image").attr("class",m.find(".list-image").attr("class").replace("list-image","list-suggested-image"))}return m.find(".list-title").text(p),m.find(".list-title").attr("title",p),m.find(r).attr("data-video-id",d),m.find(".list-image").attr(f,g),m.find(".list-suggested-image").attr(f,g),m.find("."+c).attr("data-video-id",d),m.html()},getIndexOfSong:function(e){try{return indexes=$.map(full_playlist,function(t,a){if(t.id==e)return a}),indexes[0]}catch(e){}},scrollTop:function(){$("#wrapper").scrollTop(0)},scrollBottom:function(){$("#wrapper").scrollTop($("#wrapper")[0].scrollHeight)}},f="",y=!1,v=!1,_=$("#list-song-html").html(),w=!0,k=!1,C=!0,x=100,T="",S=!1,I=!1,E=!1,L=!1,B=!1,M=!1,A=!1,N=window.location.hash.substring(1).split("&"),P=N[0],D=!1,V="#808080",O=!1,z=!1,j=!1,R={"sync disconnect on unload":!0,secure:!0,"force new connection":!0},q={crypt_pass:function(e){return e}};window.addEventListener("message",e,!1),$(document).ready(function(){N.length>=3&&"autoplay"==N[2]?D=!0:y=!0,N.indexOf("videoonly")>-1&&($("#playlist").addClass("hide"),$("#controls").addClass("hide"),$("#player").addClass("video_only")),$("#locked_channel").modal({dismissible:!1}),V="#"+N[1],add="https://zoff.me",d=io.connect(add+":8080",R),d.on("auth_required",function(){$("#locked_channel").modal("open")}),d.on("get_list",function(){setTimeout(function(){d.emit("list",{channel:P.toLowerCase(),pass:""})},1e3)}),d.on("viewers",function(e){viewers=e,void 0!==f&&o.getTitle(f,viewers)}),a(),n(),s(),window.onYouTubeIframeAPIReady=o.onYouTubeIframeAPIReady,o.loadPlayer(),m.initSlider(),window.setVolume=i,$("#controls").css("background-color",V),$("#playlist").css("background-color",V),N.indexOf("controll")>-1?Y.change_enabled(!0):Y.change_enabled(!1)}),$(document).on("click","#zoffbutton",function(e){window.open("https://zoff.me/"+P.toLowerCase()+"/","_blank")}),$(document).on("click",".vote-container",function(e){var t=$(this).attr("data-video-id");h.vote(t,"pos")}),$(document).on("click",".prev_page",function(e){e.preventDefault(),h.dynamicContentPage(-1)}),$(document).on("click",".next_page",function(e){e.preventDefault(),h.dynamicContentPage(1)});var Y={enabled:!0,old_id:null,host_listener:function(e){null===Y.old_id?Y.old_id=e:(d.removeAllListeners(e),M=!1,Y.old_id=e),C&&window.parentWindow&&window.parentOrigin&&window.parentWindow.postMessage({type:"controller",id:e},window.parentOrigin);var a="https://remote."+window.location.hostname+"/"+e;$("#code-text").text(e),$("#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),M||(M=!0,t(e))},host_on_action:function(e){if(enabled)if("volume"==e.type)$("#volume").slider("value",e.value),o.player.setVolume(e.value),localStorage.setItem("volume",e.value),m.choose_button(e.value,!1);else if("channel"==e.type){d.emit("change_channel"),Admin.beginning=!0,P=e.value.toLowerCase(),$("#chan").html(l.upperFirst(P)),w=!0;var t="";L&&(t=q.getCookie("_uI")+"_"),d.emit("list",{channel:t+P.toLowerCase(),pass:C?"":q.crypt_pass(q.get_userpass(P.toLowerCase()))}),window.history.pushState("object or string","Title","/"+P.toLowerCase())}else"pause"==e.type?o.pauseVideo():"play"==e.type?o.playVideo():"skip"==e.type&&h.skip()},change_enabled:function(e){enabled=e,$(".remote_switch_class").prop("checked",enabled)}}}(); \ No newline at end of file +!function(){function e(e){"parent"==e.data&&(window.parentWindow=e.source,window.parentOrigin=e.origin),"lower"==e.data?window.setVolume(10):"reset"==e.data?window.setVolume(100):"get_info"==e.data&&(window.parentWindow.postMessage({type:"np",title:f},window.parentOrigin),window.parentWindow.postMessage({type:"controller",id:q.old_id},window.parentOrigin),full_playlist.length>0&&o.sendNext({title:full_playlist[0].title,videoId:full_playlist[0].id}))}function t(e){d.on(e,q.host_on_action)}function a(){d.on("id",q.host_listener)}function n(){d.on("np",o.youtube_listener)}function s(){d.on("channel",m.channel_function)}function i(e){$("#volume").slider("value",e),h.setVolume(e)}var o={loaded:!0,before_load:"",after_load:"",player:"",stopInterval:!1,fireplace:"",youtube_listener:function(e){var t;C&&e.np&&window.parentWindow&&window.parentOrigin&&(window.parentWindow.postMessage({type:"np",title:e.np[0].title},window.parentOrigin),full_playlist.length>0&&o.sendNext({title:full_playlist[0].title,videoId:full_playlist[0].id}));try{t=o.player.getPlayerState()}catch(e){t=null}if((!B&&(null!=t||A)||B&&(null==t||A)||!B&&(null==t||A)||B&&-1==t)&&(!B||prev_chan_player!=V)||B&&void 0==p){prev_chan_player=V,A=!1,o.loaded=!1,l.log("--------youtube_listener--------"),l.log("Received: "),l.log(e),l.log("paused variable: "+y),l.log("mobile_beginning variable: "+S);try{l.log("getVideoUrl(): "+o.player.getVideoUrl().split("v=")[1])}catch(e){}if(l.log("video_id variable: "+p),l.log("---------------------------------"),e.np){if(y)o.getTitle(e.np[0].title,viewers),l.mobilecheck()||o.notifyUser(e.np[0].id,e.np[0].title),E||o.stopVideo(),p=e.np[0].id,conf=e.conf[0],time=e.time,c=time-conf.startTime,f=e.np[0].title,duration=e.np[0].duration,o.setBGimage(p);else if(!y){void 0===u?u=e.np[0].id:u!=p&&(u=p),p=e.np[0].id,conf=e.conf[0],time=e.time,c=time-conf.startTime,f=e.np[0].title,duration=e.np[0].duration,S&&l.mobilecheck()&&0===c&&!E&&(c=1);try{full_playlist[0].id!=p||S||m.song_change(full_playlist[0].added),Suggestions.fetchYoutubeSuggests(p)}catch(e){}if(o.getTitle(f,viewers),o.setBGimage(p),v&&!window.MSStream)try{(o.player.getVideoUrl().split("v=")[1]!=p||E)&&(o.loadVideoById(p,duration),l.mobilecheck()||o.notifyUser(p,f),o.seekTo(c),y&&!E&&o.pauseVideo()),y||(S&&!E||o.playVideo(),I||o.durationSetter()),(o.player.getDuration()>c||0===o.player.getDuration()||E||o.player.getCurrentTime()!=c)&&o.seekTo(c),o.after_load=p,o.loaded||setTimeout(function(){o.loaded=!0},500)}catch(e){E&&(o.loadVideoById(p,duration),o.seekTo(c)),I||E||o.durationSetter()}else o.getTitle(f,viewers)}}else{document.getElementById("song-title").innerHTML="Empty channel. Add some songs!",document.title="Zoff - the shared YouTube based radio",window.MSStream||E||$("#player_overlay").hasClass("hide")&&$("#player_overlay").removeClass("hide");try{E||o.stopVideo()}catch(e){}}}else I||o.durationSetter(),duration=o.player.getDuration()},onPlayerStateChange:function(e){l.log("-------onPlayerStateChange------"),l.log("New state\nState: "),l.log(e);try{l.log("Duration: "+o.player.getDuration(),"Current time: "+o.player.getCurrentTime()),l.log("getVideoUrl(): "+o.player.getVideoUrl().split("v=")[1])}catch(e){}switch(l.log("video_id variable: "+p),l.log("---------------------------------"),e.data){case-1:break;case 0:playing=!1,y=!1,B?o.playNext():d.emit("end",{id:p,channel:V.toLowerCase(),pass:C?"":Y.crypt_pass(Y.get_userpass(V.toLowerCase()))});break;case 1:playing=!0,beginning&&l.mobilecheck()&&!E&&(o.pauseVideo(),beginning=!1,S=!1,setTimeout(function(){l.mobilecheck()&&($("#playpause").css("visibility","visible"),$("#playpause").css("pointer-events","all"),$("#channel-load").css("display","none"))},100)),C||"/"==window.location.pathname||E||l.addClass("#player_overlay","hide"),"/"!=window.location.pathname&&(1==document.getElementById("play").className.split(" ").length&&$("#play").toggleClass("hide"),2==document.getElementById("pause").className.split(" ").length&&$("#pause").toggleClass("hide")),y&&!B&&(d.emit("pos",{channel:V.toLowerCase(),pass:C?"":Y.crypt_pass(Y.get_userpass(V.toLowerCase()))}),y=!1);break;case 2:E||(y=!0,"/"!=window.location.pathname&&h.play_pause_show(),S=!0)}},playVideo:function(){E?(castSession.sendMessage("urn:x-cast:zoff.me",{type:"playVideo"}),chrome.cast.media.GenericMediaMetadata({metadataType:"GENERIC",title:f,image:"https://img.youtube.com/vi/"+p+"/mqdefault.jpg"}),chrome.cast.Image("https://img.youtube.com/vi/"+p+"/mqdefault.jpg"),$("#pause").hasClass("hide")&&($("#play").toggleClass("hide"),$("#pause").toggleClass("hide"))):o.player.playVideo()},pauseVideo:function(){E?(castSession.sendMessage("urn:x-cast:zoff.me",{type:"pauseVideo"}),$("#play").hasClass("hide")&&($("#play").toggleClass("hide"),$("#pause").toggleClass("hide"))):o.player.pauseVideo()},seekTo:function(e){E?castSession.sendMessage("urn:x-cast:zoff.me",{type:"seekTo",seekTo:e}):B?o.player.seekTo(0):o.player.seekTo(e)},loadVideoById:function(e,t){E?(castSession.sendMessage("urn:x-cast:zoff.me",{type:"loadVideo",videoId:e}),chrome.cast.media.GenericMediaMetadata({metadataType:"GENERIC",title:f,image:"https://img.youtube.com/vi/"+e+"/mqdefault.jpg"}),chrome.cast.Image("https://img.youtube.com/vi/"+e+"/mqdefault.jpg")):o.player.loadVideoById({videoId:e,startSeconds:0,endSeconds:t})},stopVideo:function(){if(E)castSession.sendMessage("urn:x-cast:zoff.me",{type:"stopVideo"});else try{o.player.stopVideo()}catch(e){}},setVolume:function(e){E?castSession.setVolume(e/100):o.player.setVolume(e)},playNext:function(){var e=full_playlist[0];p=e.id,time=(new Date).getTime(),f=e.title,duration=e.duration,o.getTitle(f,viewers),o.setBGimage(p),E?(castSession.sendMessage("urn:x-cast:zoff.me",{type:"loadVideo",videoId:p}),chrome.cast.media.GenericMediaMetadata({metadataType:"GENERIC",title:f,image:"https://img.youtube.com/vi/"+p+"/mqdefault.jpg"}),chrome.cast.Image("https://img.youtube.com/vi/"+p+"/mqdefault.jpg")):o.loadVideoById(p,duration),m.channel_function({type:"song_change",time:time})},sendNext:function(e){E&&castSession.sendMessage("urn:x-cast:zoff.me",{type:"nextVideo",title:e.title,videoId:e.videoId}),C&&window.parentWindow&&window.parentOrigin&&window.parentWindow.postMessage({type:"nextVideo",title:e.title},window.parentOrigin)},getTitle:function(e,t){var a=decodeURIComponent(e);if("/"!=window.location.pathname){var n=document.getElementById("song-title"),s=document.getElementById("viewers");n.innerHTML=a,s.innerHTML="visibility "+t,n.title=a,E&&($("#player_overlay").css("background","url(https://img.youtube.com/vi/"+p+"/hqdefault.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"))}document.title=a+" • Zoff / "+V},errorHandler:function(e){z||(5==e.data||100==e.data||101==e.data||150==e.data?(curr_playing=o.player.getVideoUrl().replace("https://www.youtube.com/watch?v=",""),d.emit("skip",{error:e.data,id:p,pass:""==T?"":Y.crypt_pass(T),channel:V.toLowerCase(),userpass:C?"":Y.crypt_pass(Y.get_userpass(V.toLowerCase()))})):void 0!==p&&o.loadVideoById(p,duration))},onPlayerReady:function(e){try{beginning=!0,v=!0,window.MSStream||(l.mobilecheck()?($("#playpause").css("visibility","hidden"),$("#playpause").css("pointer-events","none")):$("#channel-load").css("display","none"),$("#player").css("opacity","1"),$("#controls").css("opacity","1"),$(".playlist").css("opacity","1"),o.loadVideoById(p,duration),!P||l.mobilecheck()&&!E||o.playVideo(),I||o.durationSetter(),C?setTimeout(function(){o.player.seekTo(c),P||(o.player.pauseVideo(),h.play_pause_show())},1e3):o.seekTo(c)),o.readyLooks(),h.initYoutubeControls(o.player),h.initSlider(),o.player.setVolume(Y.get_volume()),$(".video-container").removeClass("no-opacity")}catch(e){}},readyLooks:function(){o.setBGimage(p)},setBGimage:function(e){if(void 0!==e&&!C){var t=new Image;t.onload=function(){var e=new ColorThief,a=e.getColor(t);"/"!=window.location.pathname&&(document.getElementById("main-container").style.backgroundColor=l.rgbToHsl(a,!0),$("meta[name=theme-color]").attr("content",l.rgbToHex(a[0],a[1],a[2])))},t.crossOrigin="Anonymous",t.src="https://zoff.me:8081/https://img.youtube.com/vi/"+e+"/mqdefault.jpg"}},set_width:function(e){if($(".video-container").width(e),!l.mobilecheck())if($(window).width()>769){var t=$(window).width()-$(".control-list").width()-$(".zbrand").outerWidth()-$(".brand-logo-navigate").outerWidth()-66;title_width=t,$(".title-container").width(title_width)}else $(".title-container").width("100%")},notifyUser:function(e,t){if(t=t.replace(/\\\'/g,"'").replace(/"/g,"'").replace(/&/g,"&"),"granted"===Notification.permission&&document.hidden&&!C){var a=new Notification("Now Playing",{body:t,icon:"https://i.ytimg.com/vi/"+e+"/mqdefault.jpg",iconUrl:"http://i.ytimg.com/vi/"+e+"/mqdefault.jpg"});a.onclick=function(e){window.focus(),this.cancel()},setTimeout(function(){a.close()},5e3)}},setup_all_listeners:function(){get_list_listener(),n(),setup_admin_listener(),setup_chat_listener(),s()},onYouTubeIframeAPIReady:function(){o.player=new YT.Player("player",{videoId:p,playerVars:{rel:"0",wmode:"transparent",controls:"0",fs:"0",iv_load_policy:"3",theme:"light",color:"white",showinfo:0},events:{onReady:o.onPlayerReady,onStateChange:o.onPlayerStateChange,onError:o.errorHandler}})},createFireplacePlayer:function(){o.fireplace=new YT.Player("fireplace_player",{videoId:"L_LUpnjgPso",playerVars:{rel:"0",wmode:"transparent",controls:"0",fs:"0",iv_load_policy:"3",theme:"light",color:"white",showinfo:0},events:{onReady:o.onFireplaceReady,onStateChange:o.onFireplaceChange}})},onFireplaceReady:function(){o.fireplace.playVideo()},onFireplaceChange:function(e){switch(e.data){case 0:o.fireplace.seekTo(0),o.fireplace.playVideo();break;case 2:o.fireplace.playVideo()}},durationSetter:function(){try{j||void 0===duration||(o.stopInterval||(I=!0),dMinutes=Math.floor(duration/60),dSeconds=duration-60*dMinutes,currDurr=void 0!==o.player.getCurrentTime()?Math.floor(o.player.getCurrentTime()):c,currDurr>duration&&(currDurr=duration),minutes=Math.floor(currDurr/60),seconds=currDurr-60*minutes,document.getElementById("duration").innerHTML=l.pad(minutes)+":"+l.pad(seconds)+" / "+l.pad(dMinutes)+":"+l.pad(dSeconds),per=100/duration*currDurr,per>=100?per=100:0===duration&&(per=0),C&&window.parentWindow&&window.parentOrigin&&window.parentWindow.postMessage({type:"duration",duration:o.player.getCurrentTime(),full_duration:o.player.getDuration(),percent:per},window.parentOrigin),O||$("#bar").width(per+"%"))}catch(e){}o.stopInterval||setTimeout(o.durationSetter,1e3)},loadPlayer:function(){if(1==$("script[src='https://www.youtube.com/iframe_api']").length)try{o.onYouTubeIframeAPIReady()}catch(e){console.error("Seems YouTube iFrame script isn't correctly loaded. Please reload the page.")}else tag=document.createElement("script"),tag.src="https://www.youtube.com/iframe_api",firstScriptTag=document.getElementsByTagName("script")[0],firstScriptTag.parentNode.insertBefore(tag,firstScriptTag)}},l={log:function(e){"true"===localStorage.debug&&console.log(e)},rnd:function(e){return e[Math.floor(Math.random()*e.length)]},mobilecheck:function(){var e=!1;return(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|Android|Silk|lge |maemo|midp|mmp|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|phone)|xda|xiino/i.test(navigator.userAgent)||/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(navigator.userAgent.substr(0,4)))&&(e=!0),e},predicate:function(){for(var e,t,a,n=[],s=arguments.length,i=function(e,t){return e===t?0:e>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 e<10?"0"+Math.floor(e):Math.floor(e)},contains:function(e,t){for(var a=e.length;a--;)if(e[a]===t)return!0;return!1},sample:function(){Date.now()-lastSample>=2*SAMPLE_RATE&&(d.removeAllListeners(),d.disconnect(),d.connect(),o.setup_all_listeners()),lastSample=Date.now(),setTimeout(l.sample,SAMPLE_RATE)},loadjsfile:function(e){if(-1==filesadded.indexOf("["+e+"]")){var t=document.createElement("script");t.setAttribute("type","text/javascript"),t.setAttribute("src",e),document.getElementsByTagName("head")[0].appendChild(t),filesadded+="["+e+"]"}},msieversion:function(){return!!(window.navigator.userAgent.indexOf("MSIE ")>0||navigator.userAgent.match(/Trident.*rv\:11\./))},getRandomInt:function(e,t){return Math.floor(Math.random()*(t-e))+e},secondsToOther:function(e){var t=e,a=Math.floor(t/60);return t-=60*a,[a,t]},rgbToHsl:function(e,t){r=e[0],g=e[1],b=e[2],r/=255,g/=255,b/=255;var a,n,s=Math.max(r,g,b),i=Math.min(r,g,b),o=(s+i)/2;if(s==i)a=n=0;else{var l=s-i;switch(n=o>.5?l/(2-s-i):l/(s+i),s){case r:a=(g-b)/l+(g.5&&t?o=.4:o<.65&&!t&&(o=.65),"hsl("+Math.floor(360*a)+", "+Math.floor(100*n)+"%, "+Math.floor(100*o)+"%)"},componentToHex:function(e){var t=e.toString(16);return 1==t.length?"0"+t:t},rgbToHex:function(e,t,a){return"#"+l.componentToHex(e)+l.componentToHex(t)+l.componentToHex(a)},upperFirst:function(e){return e.substring(0,1).toUpperCase()+e.substring(1).toLowerCase()},addClass:function(e,t){l.contains($(e).attr("class").split(" "),t)||$(e).addClass(t)},send_mail:function(e,t){""!==e&&""!==t&&($("#submit-contact-form").addClass("hide"),$("#send-loader").removeClass("hide"),$("#contact-form-from").attr("disabled","true"),$("#contact-form-message").attr("disabled","true"),$.ajax({type:"POST",data:{from:e,message:t},url:"/api/mail",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: contact@zoff.no"))}}))},firstY:null,lastY:null,currentY:null,vertScroll:!1,initAdjustment:0,touchstart:function(e){l.lastY=l.currentY=l.firstY=e.originalEvent.touches[0].pageY},touchmove:function(e){l.currentY=e.originalEvent.touches[0].pageY;var t=l.lastY-l.currentY;!l.vertScroll&&Math.abs(l.currentY-l.firstY)>30&&(l.vertScroll=!0,l.initAdjustment=l.currentY-l.firstY),l.vertScroll&&(window.scrollBy(0,t+l.initAdjustment),l.lastY=l.currentY+t)},touchend:function(e){l.vertScroll=!1,l.firstY=null,l.currentY=null,l.vertScroll=!1,l.initAdjustment=0,l.currentY=null}};Element.prototype.remove=function(){this.parentElement.removeChild(this)},NodeList.prototype.remove=HTMLCollection.prototype.remove=function(){for(var e=0,t=this.length;e=0&&e<=33?(1==document.getElementById("v-full").className.split(" ").length&&($("#v-full").toggleClass("hide"),$("#v-full-overlay").toggleClass("hide")),1==document.getElementById("v-medium").className.split(" ").length&&($("#v-medium").toggleClass("hide"),$("#v-medium-overlay").toggleClass("hide")),2==document.getElementById("v-low").className.split(" ").length&&($("#v-low").toggleClass("hide"),$("#v-low-overlay").toggleClass("hide")),1==document.getElementById("v-mute").className.split(" ").length&&($("#v-mute").toggleClass("hide"),$("#v-mute-overlay").toggleClass("hide"))):e>=34&&e<=66?(1==document.getElementById("v-full").className.split(" ").length&&($("#v-full").toggleClass("hide"),$("#v-full-overlay").toggleClass("hide")),2==document.getElementById("v-medium").className.split(" ").length&&($("#v-medium").toggleClass("hide"),$("#v-medium-overlay").toggleClass("hide")),1==document.getElementById("v-low").className.split(" ").length&&($("#v-low").toggleClass("hide"),$("#v-low-overlay").toggleClass("hide")),1==document.getElementById("v-mute").className.split(" ").length&&($("#v-mute").toggleClass("hide"),$("#v-mute-overlay").toggleClass("hide"))):e>=67&&e<=100&&(2==document.getElementById("v-full").className.split(" ").length&&($("#v-full").toggleClass("hide"),$("#v-full-overlay").toggleClass("hide")),1==document.getElementById("v-medium").className.split(" ").length&&($("#v-medium").toggleClass("hide"),$("#v-medium-overlay").toggleClass("hide")),1==document.getElementById("v-low").className.split(" ").length&&($("#v-low").toggleClass("hide"),$("#v-low-overlay").toggleClass("hide")),1==document.getElementById("v-mute").className.split(" ").length&&($("#v-mute").toggleClass("hide"),$("#v-mute-overlay").toggleClass("hide")))},playPause:function(){state=o.player.getPlayerState(),button=document.getElementById("playpause"),1==state?o.pauseVideo():2==state&&o.playVideo()},volumeOptions:function(){E||(o.player.isMuted()?(o.player.unMute(),x=o.player.getVolume(),$("#volume").slider("value",o.player.getVolume())):(o.player.mute(),$("#volume").slider("value",0)))},hoverMute:function(e){x=o.player.getVolume()}},m={empty:!1,page:0,can_fit:Math.round($("#wrapper").height()/71),element_height:$("#wrapper").height()/Math.round($("#wrapper").height()/71)-25,uris:[],not_found:[],num_songs:0,dragging:function(e){if(e){if(l.mobilecheck()){var t=$(".list-song");try{$(".list-song").draggable("destroy")}catch(e){}t.off("touchstart",l.touchstart),t.off("touchmove",l.touchmove),t.off("touchend",l.touchend),$(".list-song").draggable({axis:"x",containment:[-50,0,10,0],scroll:!0,stop:function(e,t){if(-50==t.offset.left){try{navigator.vibrate=navigator.vibrate||navigator.webkitVibrate||navigator.mozVibrate||navigator.msVibrate,navigator.vibrate&&navigator.vibrate(100)}catch(e){}$(".accept-delete").attr("data-video-id",$(this).attr("data-video-id")),$("#delete_song_title").html($(this).find(".list-title").html()),$("#delete_song_alert").modal("open");var a=this;$(this).addClass("side_away"),$(this).css("left","0px"),setTimeout(function(){$(a).removeClass("side_away")},300)}else{var a=this;$(this).addClass("side_away"),$(this).css("left","0px"),setTimeout(function(){$(a).removeClass("side_away")},300)}}}),t.on("touchstart",l.touchstart),t.on("touchmove",l.touchmove),t.on("touchend",l.touchend)}}else{var t=$(".list-song");try{$(".list-song").draggable("destroy")}catch(e){}t.off("touchstart",l.touchstart),t.off("touchmove",l.touchmove),t.off("touchend",l.touchend)}},channel_function:function(e){switch(z&&(z=!1,$("#user_password").modal("close")),e.type){case"list":B&&(!B||e.shuffled)||B&&prev_chan_list==V?B&&prev_chan_list==V&&void 0!=full_playlist&&!e.shuffled&&(m.populate_list(full_playlist,!0),o.sendNext({title:full_playlist[0].title,videoId:full_playlist[0].id})):(prev_chan_list=V,m.populate_list(e.playlist),o.sendNext({title:full_playlist[0].title,videoId:full_playlist[0].id})),w||m.dragging(!0);break;case"added":m.added_song(e.value),o.sendNext({title:full_playlist[0].title,videoId:full_playlist[0].id}),w||m.dragging(!0);break;case"deleted":m.deleted_song(e.value,e.removed);break;case"vote":B||(m.voted_song(e.value,e.time),o.sendNext({title:full_playlist[0].title,videoId:full_playlist[0].id})),w||m.dragging(!0);break;case"song_change":"/"!=window.location.pathname&&m.song_change(e.time,e.remove),o.sendNext({title:full_playlist[0].title,videoId:full_playlist[0].id}),w||m.dragging(!0)}},insertAtBeginning:function(e,t){var a=0==m.page?"":"none",n=m.generateSong(e,t,!1,!0,!1,a,!1);$("#wrapper").append(n)},insertAtIndex:function(e,t,a){var n=m.getIndexOfSong(e.id),s="none";if(!e.now_playing){n>=m.page&&n div:nth-child("+n+")").after(i);var o=$("#wrapper").children()[n];$(o).css("display",s),"inline-block"==s&&$("#wrapper").children().length>=m.page+m.can_fit+1?$($("#wrapper").children()[m.page+m.can_fit]).css("display","none"):n=0?$($("#wrapper").children()[m.page]).css("display","inline-block"):$("#wrapper").children().length>m.page+m.can_fit&&$($("#wrapper").children()[m.page+m.can_fit-1]).css("display","inline-block"),a&&m.page>0&&$($("#wrapper").children()[m.page-1]).css("display","none"),t&&setTimeout(function(){$(o).css("transform","translateX(0%)"),setTimeout(function(){$(o).removeClass("side_away")},300)},5)}},populate_list:function(e,t){if(l.mobilecheck()||C?C?(m.can_fit=Math.round($("#wrapper").height()/91)+1,m.element_height=$("#wrapper").height()/m.can_fit-4):(m.can_fit=Math.round(($(window).height()-$(".tabs").height()-$("header").height()-64-8)/71)+1,m.element_height=($(window).height()-$(".tabs").height()-$("header").height()-64-8)/m.can_fit-5):(m.can_fit=Math.round($("#wrapper").height()/71)+1,m.element_height=$("#wrapper").height()/m.can_fit-5.3),m.element_height<55.2&&(m.can_fit=m.can_fit-1,m.element_height=55.2,m.can_fit=Math.round(($(window).height()-$(".tabs").height()-$("header").height()-64-8)/71),m.element_height=($(window).height()-$(".tabs").height()-$("header").height()-64-8)/m.can_fit-5),void 0===_&&(_=$("#list-song-html").html()),full_playlist=e,B&&!t)for(var a=0;a1?($.each(full_playlist,function(e,t){if(!t.now_playing){var a=m.generateSong(t,!1,k,!0,!1,"",!0);$("#wrapper").append(a)}}),$("#wrapper").children().length>m.can_fit&&!$("#pageButtons").length?($('
first_pagefirst_pagenavigate_before prevnavigate_before prev 1 next navigate_nextnext navigate_nextlast_pagelast_page
').insertAfter("#wrapper"),$(".prev_page").css("display","none"),$(".first_page").css("display","none"),$(".next_page_hide").css("display","none"),$(".last_page_hide").css("display","none")):$("#pageButtons").length||($('
first_pagefirst_pagenavigate_before prevnavigate_before prev 1 next navigate_nextnext navigate_nextlast_pagelast_page
').insertAfter("#wrapper"),$(".prev_page").css("display","none"),$(".next_page").css("display","none"),$(".last_page").css("display","none"),$(".first_page").css("display","none"),$(".next_page_hide").css("display","inline-flex"),$(".prev_page_hide").css("display","inline-flex")),m.dynamicContentPage(-10)):(m.empty=!0,$("#wrapper").html("The playlist is empty."),$("#pageButtons").length||$('
first_pagefirst_pagenavigate_before prevnavigate_before prev 1 next navigate_nextnext navigate_nextlast_pagelast_page
').insertAfter("#wrapper"),$(".prev_page").css("display","none"),$(".next_page").css("display","none"),$(".last_page").css("display","none"),$(".last_page_hide").css("display","inline-flex"),$(".first_page").css("display","none"),$(".next_page_hide").css("display","inline-flex"),$(".prev_page_hide").css("display","inline-flex")),$("#settings").css("visibility","visible"),$("#settings").css("opacity","1"),$("#wrapper").css("opacity","1")},dynamicContentPageJumpTo:function(e){((e*=m.can_fit)>m.page||e0&&"none"==$(".prev_page").css("display")&&($(".prev_page").css("display","inline-flex"),$(".prev_page_hide").css("display","none"),$(".first_page").css("display","inline-flex"),$(".first_page_hide").css("display","none")),m.page+m.can_fit>=$("#wrapper").children().length&&($(".next_page_hide").css("display","inline-flex"),$(".next_page").css("display","none"),$(".last_page_hide").css("display","inline-flex"),$(".last_page").css("display","none")),$("#pageNumber").html(m.page/m.can_fit+1))},dynamicContentPage:function(e){1==e?($("#wrapper").children().slice(m.page,m.page+m.can_fit).hide(),m.page=m.page+m.can_fit,$("#wrapper").children().slice(m.page,m.page+m.can_fit).css("display","inline-block"),m.page>0&&"none"==$(".prev_page").css("display")&&($(".prev_page").css("display","inline-flex"),$(".prev_page_hide").css("display","none"),$(".first_page").css("display","inline-flex"),$(".first_page_hide").css("display","none")),m.page+m.can_fit>=$("#wrapper").children().length&&($(".next_page_hide").css("display","inline-flex"),$(".next_page").css("display","none"),$(".last_page_hide").css("display","inline-flex"),$(".last_page").css("display","none"))):10==e?($("#wrapper").children().slice(m.page,m.page+m.can_fit).hide(),m.page=Math.floor(($("#wrapper").children().length-1)/m.can_fit)*m.can_fit,$("#wrapper").children().slice(m.page,m.page+m.can_fit).css("display","inline-block"),m.page>0&&"none"==$(".prev_page").css("display")&&($(".prev_page").css("display","inline-flex"),$(".prev_page_hide").css("display","none"),$(".first_page").css("display","inline-flex"),$(".first_page_hide").css("display","none")),m.page+m.can_fit>=$("#wrapper").children().length&&($(".next_page_hide").css("display","inline-flex"),$(".next_page").css("display","none"),$(".last_page_hide").css("display","inline-flex"),$(".last_page").css("display","none"))):-10==e?($("#wrapper").children().slice(m.page,m.page+m.can_fit).hide(),m.page=0,$("#wrapper").children().slice(m.page,m.page+m.can_fit).css("display","inline-block"),0==m.page&&"none"!=$(".prev_page").css("display")?($(".prev_page").css("display","none"),$(".prev_page_hide").css("display","inline-flex"),$(".first_page").css("display","none"),$(".first_page_hide").css("display","inline-flex")):"none"==$(".prev_page").css("display")?($(".prev_page_hide").css("display","inline-flex"),$(".first_page_hide").css("display","inline-flex")):($(".prev_page_hide").css("display","none"),$(".first_page_hide").css("display","none")),m.page+m.can_fit<$("#wrapper").children().length&&($(".next_page_hide").css("display","none"),$(".next_page").css("display","inline-flex"),$(".last_page_hide").css("display","none"),$(".last_page").css("display","inline-flex"))):($("#wrapper").children().slice(m.page-m.can_fit,m.page).css("display","inline-block"),$("#wrapper").children().slice(m.page,m.page+m.can_fit).hide(),m.page=m.page-m.can_fit<0?0:m.page-m.can_fit,0==m.page&&"none"!=$(".prev_page").css("display")?($(".prev_page").css("display","none"),$(".prev_page_hide").css("display","inline-flex"),$(".first_page").css("display","none"),$(".first_page_hide").css("display","inline-flex")):"none"==$(".prev_page").css("display")?($(".prev_page_hide").css("display","inline-flex"),$(".first_page_hide").css("display","inline-flex")):($(".prev_page_hide").css("display","none"),$(".first_page_hide").css("display","none")),m.page+m.can_fit<$("#wrapper").children().length&&($(".next_page_hide").css("display","none"),$(".next_page").css("display","inline-flex"),$(".last_page_hide").css("display","none"),$(".last_page").css("display","inline-flex"))),$("#pageNumber").html(m.page/m.can_fit+1)},added_song:function(e){var t;if(void 0!=e){if(0!==full_playlist.length&&(t=full_playlist.pop()),full_playlist.push(e),m.sortList(),t&&full_playlist.push(t),$("#suggested-"+e.id).length>0){number_suggested-=1,number_suggested<0&&(number_suggested=0);var a=number_suggested>9?"9+":number_suggested;$(".suggested-link span.badge.new.white").hasClass("hide")||0!=a||$(".suggested-link span.badge.new.white").addClass("hide"),$(".suggested-link span.badge.new.white").text(a)}$("#suggested-"+e.id).remove(),m.empty&&(m.empty=!1),$("#empty-channel-message").remove(),m.insertAtIndex(e,!0),$($("#wrapper").children()[m.page+m.can_fit]).css("display","none"),$("#wrapper").children().length>m.page+m.can_fit?($(".next_page_hide").css("display","none"),$(".next_page").removeClass("hide"),$(".last_page_hide").css("display","none"),$(".next_page").css("display","inline-flex"),$(".last_page").css("display","inline-flex")):($(".next_page_hide").css("display","inline-flex"),$(".next_page").css("display","none"))}},deleted_song:function(e,t){try{var a=m.getIndexOfSong(e);$("#wrapper").children()[a];a=0?($($("#wrapper").children()[m.page]).css("height",0),$($("#wrapper").children()[m.page]).css("display","inline-block"),$($("#wrapper").children()[m.page]).css("height",m.element_height)):$("#wrapper").children().length>m.page+m.can_fit&&($($("#wrapper").children()[m.page+m.can_fit]).css("height",0),$($("#wrapper").children()[m.page+m.can_fit]).css("display","inline-block"),$($("#wrapper").children()[m.page+m.can_fit]).css("height",m.element_height)),m.page>=$("#wrapper").children().length-1?(m.dynamicContentPage(-1),$(".next_page_hide").css("display","inline-flex"),$(".next_page").css("display","none"),$(".last_page_hide").css("display","inline-flex"),$(".last_page").css("display","none")):m.page+m.can_fit+1>=$("#wrapper").children().length-1&&($(".next_page_hide").css("display","inline-flex"),$(".next_page").css("display","none"),$(".last_page_hide").css("display","inline-flex"),$(".last_page").css("display","none")),m.page<=a&&m.page-m.can_fit<=a?($("#"+e).addClass("side_away"),$("#"+e).find(".mobile-delete").remove(),$("#"+e).css("transform","translateX(-100%)"),setTimeout(function(){$("#"+e).remove()},300)):$("#"+e).remove(),full_playlist.splice(m.getIndexOfSong(e),1),o.sendNext({title:full_playlist[0].title,videoId:full_playlist[0].id})}catch(t){full_playlist.splice(m.getIndexOfSong(e),1),m.empty||($("#"+e).remove(),a=0?$($("#wrapper").children()[m.page-1]).css("display","inline-block"):$("#wrapper").children().length>m.page+m.can_fit&&$($("#wrapper").children()[m.page+(m.can_fit-1)]).css("display","inline-block"),o.sendNext({title:full_playlist[0].title,videoId:full_playlist[0].id}))}full_playlist.length<=2&&(m.empty=!0,$("#wrapper").html("The playlist is empty.")),$("#suggested-"+e).remove(),m.page,m.can_fit,$("#wrapper").children().length,m.page>=$("#wrapper").children().length&&m.dynamicContentPage(-1),Suggestions.checkUserEmpty()},voted_song:function(e,t){var a=m.getIndexOfSong(e),n=full_playlist[a];full_playlist[a].votes+=1,full_playlist[a].added=t,m.sortList(),$("#"+e).remove(),m.insertAtIndex(n,!1)},song_change:function(e,t){try{var a=full_playlist.length-1;$("#wrapper").children()[0].remove(),0===$("#wrapper").children().length&&(m.empty=!0,$("#wrapper").html("The playlist is empty.")),full_playlist[0].now_playing=!0,full_playlist[0].votes=0,full_playlist[0].guids=[],full_playlist[0].added=e,t?delete full_playlist[a]:full_playlist[a].now_playing=!1,l.log("---------------------------"),l.log("---SONG ON FIRST INDEX-----"),l.log(full_playlist[0]),l.log("---------------------------"),full_playlist.push(full_playlist.shift()),t||m.insertAtIndex(full_playlist[a-1],!1,!0)}catch(e){}},vote:function(e,t){return!B||"del"==t&&hasadmin&&!w&&""!=T?d.emit("vote",{channel:V,id:e,type:t,adminpass:""==T?"":Y.crypt_pass(T),pass:C?"":Y.crypt_pass(Y.get_userpass(V.toLowerCase()))}):"pos"==t?m.voted_song(e,(new Date).getTime()/1e3):m.deleted_song(e),!0},skip:function(){return B?o.playNext():d.emit("skip",{pass:""==T?"":Y.crypt_pass(T),id:p,channel:V.toLowerCase(),userpass:C?"":Y.crypt_pass(Y.get_userpass(V.toLowerCase()))}),!0},exportToSpotify:function(){$.ajax({type:"GET",url:"https://api.spotify.com/v1/me",headers:{Authorization:"Bearer "+access_token_data.access_token},success:function(e){var t=e.id;$("#playlist_loader_export").removeClass("hide"),$(".exported-list-container").removeClass("hide"),$.ajax({type:"POST",url:"https://api.spotify.com/v1/users/"+t+"/playlists",headers:{Authorization:"Bearer "+access_token_data.access_token,"Content-Type":"application/json"},data:JSON.stringify({name:V.toLowerCase()+" - Zoff",public:!0}),success:function(e){var a=e.id;$.each(full_playlist,function(e,n){m.searchSpotify(n,a,t)})}})}})},searchSpotify:function(e,t,a){var n=e.title,s=e.title.toLowerCase().replace("-"," ");s.startsWith("the")&&(s=s.replace("the","")),s=s.replace(" hd",""),s=s.replace("official hd video",""),s=s.replace("unofficial video",""),s=s.replace("studio footage",""),s=s.replace("great song",""),s=s.replace("-"," "),s=s.replace("-"," "),s=s.replace(" hq"," "),s=s.replace("lyric video",""),s=s.replace("lyrics video",""),s=s.replace("album version",""),s=s.replace("drive original movie soundtrack",""),s=s.replace("original movie soundtrack",""),s=s.replace("live sessions",""),s=s.replace("audio only",""),s=s.replace("audio",""),s=s.replace("(new)",""),s=s.replace(" by "," "),s=s.replace(" vs "," "),s=s.replace("(full)"," "),s=s.replace("(video)"," "),s=s.replace("&"," "),s=s.replace("with lyrics",""),s=s.replace("lyrics",""),s=s.replace("w/",""),s=s.replace("w/",""),s=s.replace("official video",""),s=s.replace("studio version",""),s=s.replace("official music video",""),s=s.replace("music video",""),s=s.replace("musicvideo",""),s=s.replace("original video",""),s=s.replace("full version",""),s=s.replace("full song",""),s=s.replace("(official)",""),s=s.replace("official",""),s=s.replace("(original)",""),s=s.replace("("," "),s=s.replace(")"," "),s=s.replace("|",""),s=s.replace("feat."," "),s=s.replace("feat"," "),s=s.replace("ft."," "),s=s.replace("["," "),s=s.replace("]"," "),s=s.replace(" free ",""),s=s.replace(" hd",""),s=s.replace("original mix"," "),s=s.replace("radio edit"," "),s=s.replace("pop version"," "),s=s.replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," "),s=encodeURIComponent(s),$.ajax({type:"GET",url:"https://api.spotify.com/v1/search?q="+s+"&type=track",headers:{Authorization:"Bearer "+access_token_data.access_token},async:!0,statusCode:{429:function(n){console.log(n.getAllResponseHeaders());var s=n.getResponseHeader("Retry-After");console.log(s),s||(s=5),s=parseInt(s,10),l.log("Retry-After",s),setTimeout(function(){m.searchSpotify(e,t,a)},1e3*s)}},error:function(n){if(429==n.status){console.log(n.getAllResponseHeaders());var s=n.getResponseHeader("Retry-After");console.log(s),s||(s=5),s=parseInt(s,10),l.log("Retry-After",s),setTimeout(function(){m.searchSpotify(e,t,a)},1e3*s)}},success:function(e){var i=!1;if($.each(e.tracks.items,function(e,t){if(t.name=t.name.toLowerCase(),t.name=t.name.replace("("," "),t.name=t.name.replace(")"," "),t.name=t.name.replace("["," "),t.name=t.name.replace("]"," "),t.name=t.name.replace("-"," "),t.name=t.name.replace("-"," "),t.name=t.name.replace("-"," "),t.name=t.name.replace("original mix"," "),t.name=t.name.replace("album version"," "),t.name=t.name.replace("abum version"," "),t.name=t.name.replace("feat."," "),t.artists[0].name=t.artists[0].name.replace("feat."," "),t.artists[0].name=t.artists[0].name.replace("feat"," "),t.name=t.name.replace("feat"," "),t.name=t.name.replace("ft."," "),t.name=t.name.replace("radio edit"," "),t.name=t.name.replace("pop version"," "),t.name=t.name.replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," "),t.artists[0].name=t.artists[0].name.replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ")," "==t.name.substring(t.name.length-1)&&(t.name=t.name.substring(0,t.name.length-1)),"."==t.name.substring(t.name.length-1)&&"."!=s.substring(s.length-1)&&(t.name=t.name.substring(0,t.name.length-1)),decodeURIComponent(s).indexOf(t.artists[0].name.toLowerCase())>=0&&decodeURIComponent(s).indexOf(t.name.toLowerCase())>=0)return i=!0,m.uris.push(t.uri),l.log("Found",s),!1;for(var a=t.name.split(" "),e=0;e=0||"&"==a[e]&&s.indexOf("and")>=0)&&s.indexOf(a[e])<0)return!0;return i=!0,m.uris.push(t.uri),l.log("Found",s),!1}),i||(m.not_found.push(n),m.num_songs=m.num_songs+1,l.log("Didn't find",n)),m.num_songs+m.uris.length==full_playlist.length){if(m.uris.length>100){for(;m.uris.length>100;)m.addToSpotifyPlaylist(m.uris.slice(0,100),t,a),m.uris=m.uris.slice(100,m.uris.length);m.addToSpotifyPlaylist(m.uris,t,a),$("#playlist_loader_export").addClass("hide")}else m.addToSpotifyPlaylist(m.uris,t,a),$("#playlist_loader_export").addClass("hide");0==$(".exported-spotify-list").length&&$(".exported-list").append(""+V+""),$.each(m.not_found,function(e,t){var a=$("
"+not_export_html+"
");a.find(".extra-add-text").attr("value",t),a.find(".extra-add-text").attr("title",t),$(".not-exported-container").append(a.html())}),$(".not-exported").removeClass("hide"),$(".spotify_export_button").css("display","block")}}})},addToSpotifyPlaylist:function(e,t,a){$.ajax({type:"POST",url:"https://api.spotify.com/v1/users/"+a+"/playlists/"+t+"/tracks",headers:{Authorization:"Bearer "+access_token_data.access_token,"Content-Type":"application/json"},data:JSON.stringify({uris:e}),error:function(n){var s=t,i=e,o=a;setTimeout(function(){m.addToSpotifyPlaylist(i,s,o)},3e3)},success:function(e){l.log("Added songs")}})},exportToYoutube:function(){$(".exported-list-container").removeClass("hide"),$("#playlist_loader_export").removeClass("hide"),$.ajax({type:"POST",url:"https://www.googleapis.com/youtube/v3/playlists?part=snippet",headers:{Authorization:"Bearer "+access_token_data_youtube.access_token,"Content-Type":"application/json"},data:JSON.stringify({snippet:{title:l.upperFirst(V.toLowerCase()),description:"Playlist exported from zoff"}}),success:function(e){var t=e.id;m.addToYoutubePlaylist(t,full_playlist,0,"https://www.googleapis.com/youtube/v3/playlistItems?part=snippet")},error:function(e){l.log(e)}})},addToYoutubePlaylist:function(e,t,a,n){var s=JSON.stringify({snippet:{playlistId:e,resourceId:{kind:"youtube#video",videoId:t[a].id}}});$.ajax({type:"POST",url:n,headers:{Authorization:"Bearer "+access_token_data_youtube.access_token,"Content-Type":"application/json"},data:s,success:function(s){l.log("Added video: "+t[a].id+" to playlist id "+e),a==t.length-1?(l.log("All videoes added!"),l.log("url: https://www.youtube.com/playlist?list="+e),$(".exported-list").append(""+V+""),$("#playlist_loader_export").addClass("hide"),$(".current_number").addClass("hide")):($(".current_number").removeClass("hide"),$(".current_number").text(a+1+" of "+t.length),m.addToYoutubePlaylist(e,t,a+1,n))}})},importOldList:function(e){var t="",a=0;playlist_url="lists/"+e+".json",list=$.parseJSON($.ajax({type:"GET",url:playlist_url,async:!1}).responseText),$.each(list.songs,function(e,n){t+=n.id+",",a>45&&(Search.addVideos(t),t="",a=0),a++}),Search.addVideos(t),document.getElementById("search").value=""},sortList:function(){full_playlist.sort(l.predicate({name:"votes",reverse:!0},{name:"added",reverse:!1},{name:"title",reverse:!1}))},show:function(){l.mobilecheck()||(showToggle?(showToggle=!1,$("#toptitle").empty(),$("#chan").addClass("bigChan"),$("#chan").html("zoff.me/"+V.toLowerCase())):(showToggle=!0,$("#toptitle").html("Zoff"),$("#chan").removeClass("bigChan"),$("#chan").html(V)))},generateSong:function(e,t,a,n,s,i,o){void 0===_&&(_=$("#list-song-html").html());var r,c,d=e.id,p=e.title,u=e.votes,g="background-image:url('//img.youtube.com/vi/"+d+"/mqdefault.jpg');",h=$("
"+_+"
"),f="style";if(t&&(h.find(".list-song").css("transform","translateX(100%)"),h.find(".list-song").addClass("side_away")),h.find(".list-song").css("height",m.element_height),w||h.find(".card-action").removeClass("hide"),1==u&&h.find(".vote-text").text("vote"),a&&(g="//img.youtube.com/vi/"+d+"/mqdefault.jpg",f="data-original"),n){h.find(".list-votes").text(u),h.find("#list-song").attr("data-video-id",d),h.find("#list-song").attr("data-video-type","song"),h.find("#list-song").attr("id",d),h.find(".vote-container").attr("title",p),($("#wrapper").children().length>=m.can_fit&&o||"none"==i)&&h.find(".card").css("display","none"),r=".vote-container",c="delete_button";var y=l.secondsToOther(e.duration);h.find(".card-duration").text(l.pad(y[0])+":"+l.pad(y[1]))}else if(!n){h.find(".suggested_remove").removeClass("hide"),h.find(".vote-text").text(""),h.find(".card-duration").text(l.pad(e.duration[0])+":"+l.pad(e.duration[1]));var v="user";r=".add-suggested",s?c="del_user_suggested":(c="del_suggested",v="system"),h.find(".vote-container").attr("class","clickable add-suggested"),h.find(".add-suggested").attr("title",p),h.find(".delete_button").addClass(c),h.find(r).attr("data-video-title",p),h.find(r).attr("data-video-length",e.length),h.find(r).attr("data-added-by",v),h.find("#list-song").attr("data-video-type","suggested"),h.find("#list-song").attr("data-video-id",d),h.find("#list-song").attr("id","suggested-"+d),h.find(".list-image").attr("class",h.find(".list-image").attr("class").replace("list-image","list-suggested-image"))}return l.mobilecheck()&&(h.find(".waves-effect").removeClass("waves-effect"),h.find(".waves-light").removeClass("waves-light")),h.find(".list-title").text(p),h.find(".list-title").attr("title",p),h.find(r).attr("data-video-id",d),h.find(".list-image").attr(f,g),h.find(".list-suggested-image").attr(f,g),h.find("."+c).attr("data-video-id",d),h.html()},getIndexOfSong:function(e){try{return indexes=$.map(full_playlist,function(t,a){if(t.id==e)return a}),indexes[0]}catch(e){}},scrollTop:function(){$("#wrapper").scrollTop(0)},scrollBottom:function(){$("#wrapper").scrollTop($("#wrapper")[0].scrollHeight)}},f="",y=!1,v=!1,_=$("#list-song-html").html(),w=!0,k=!1,C=!0,x=100,T="",S=!1,I=!1,E=!1,L=!1,B=!1,M=!1,A=!1,N=window.location.hash.substring(1).split("&"),V=N[0],P=!1,D="#808080",O=!1,z=!1,j=!1,R={"sync disconnect on unload":!0,secure:!0,"force new connection":!0},Y={crypt_pass:function(e){return e}};window.addEventListener("message",e,!1),$(document).ready(function(){N.length>=3&&"autoplay"==N[2]?P=!0:y=!0,N.indexOf("videoonly")>-1&&($("#playlist").addClass("hide"),$("#controls").addClass("hide"),$("#player").addClass("video_only")),$("#locked_channel").modal({dismissible:!1}),D="#"+N[1],add="https://zoff.me",d=io.connect(add+":8080",R),d.on("auth_required",function(){$("#locked_channel").modal("open")}),d.on("get_list",function(){setTimeout(function(){d.emit("list",{channel:V.toLowerCase(),pass:""})},1e3)}),d.on("viewers",function(e){viewers=e,void 0!==f&&o.getTitle(f,viewers)}),a(),n(),s(),window.onYouTubeIframeAPIReady=o.onYouTubeIframeAPIReady,o.loadPlayer(),h.initSlider(),window.setVolume=i,$("#controls").css("background-color",D),$("#playlist").css("background-color",D),N.indexOf("controll")>-1?q.change_enabled(!0):q.change_enabled(!1)}),$(document).on("click","#zoffbutton",function(e){window.open("https://zoff.me/"+V.toLowerCase()+"/","_blank")}),$(document).on("click",".vote-container",function(e){var t=$(this).attr("data-video-id");m.vote(t,"pos")}),$(document).on("click",".prev_page",function(e){e.preventDefault(),m.dynamicContentPage(-1)}),$(document).on("click",".next_page",function(e){e.preventDefault(),m.dynamicContentPage(1)});var q={enabled:!0,old_id:null,host_listener:function(e){null===q.old_id?q.old_id=e:(d.removeAllListeners(e),M=!1,q.old_id=e),C&&window.parentWindow&&window.parentOrigin&&window.parentWindow.postMessage({type:"controller",id:e},window.parentOrigin);var a="https://remote."+window.location.hostname+"/"+e;$("#code-text").text(e),$("#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),M||(M=!0,t(e))},host_on_action:function(e){if(enabled)if("volume"==e.type)$("#volume").slider("value",e.value),o.player.setVolume(e.value),localStorage.setItem("volume",e.value),h.choose_button(e.value,!1);else if("channel"==e.type){d.emit("change_channel"),Admin.beginning=!0,V=e.value.toLowerCase(),$("#chan").html(l.upperFirst(V)),w=!0;var t="";L&&(t=Y.getCookie("_uI")+"_"),d.emit("list",{channel:t+V.toLowerCase(),pass:C?"":Y.crypt_pass(Y.get_userpass(V.toLowerCase()))}),window.history.pushState("object or string","Title","/"+V.toLowerCase())}else"pause"==e.type?o.pauseVideo():"play"==e.type?o.playVideo():"skip"==e.type&&m.skip()},change_enabled:function(e){enabled=e,$(".remote_switch_class").prop("checked",enabled)}}}(); \ No newline at end of file diff --git a/server/public/assets/dist/lib/jquery-ui.min.js b/server/public/assets/dist/lib/jquery-ui.min.js new file mode 100644 index 00000000..51b14b2e --- /dev/null +++ b/server/public/assets/dist/lib/jquery-ui.min.js @@ -0,0 +1,8 @@ +/*! jQuery UI - v1.12.1 - 2017-06-18 +* http://jqueryui.com +* Includes: widget.js, position.js, data.js, disable-selection.js, focusable.js, form-reset-mixin.js, jquery-1-7.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/draggable.js, widgets/resizable.js, widgets/mouse.js, widgets/slider.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js +* Copyright jQuery Foundation and other contributors; Licensed MIT */ + +(function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)})(function(t){function e(t){for(var e=t.css("visibility");"inherit"===e;)t=t.parent(),e=t.css("visibility");return"hidden"!==e}t.ui=t.ui||{},t.ui.version="1.12.1";var i=0,s=Array.prototype.slice;t.cleanData=function(e){return function(i){var s,n,o;for(o=0;null!=(n=i[o]);o++)try{s=t._data(n,"events"),s&&s.remove&&t(n).triggerHandler("remove")}catch(a){}e(i)}}(t.cleanData),t.widget=function(e,i,s){var n,o,a,r={},l=e.split(".")[0];e=e.split(".")[1];var h=l+"-"+e;return s||(s=i,i=t.Widget),t.isArray(s)&&(s=t.extend.apply(null,[{}].concat(s))),t.expr[":"][h.toLowerCase()]=function(e){return!!t.data(e,h)},t[l]=t[l]||{},n=t[l][e],o=t[l][e]=function(t,e){return this._createWidget?(arguments.length&&this._createWidget(t,e),void 0):new o(t,e)},t.extend(o,n,{version:s.version,_proto:t.extend({},s),_childConstructors:[]}),a=new i,a.options=t.widget.extend({},a.options),t.each(s,function(e,s){return t.isFunction(s)?(r[e]=function(){function t(){return i.prototype[e].apply(this,arguments)}function n(t){return i.prototype[e].apply(this,t)}return function(){var e,i=this._super,o=this._superApply;return this._super=t,this._superApply=n,e=s.apply(this,arguments),this._super=i,this._superApply=o,e}}(),void 0):(r[e]=s,void 0)}),o.prototype=t.widget.extend(a,{widgetEventPrefix:n?a.widgetEventPrefix||e:e},r,{constructor:o,namespace:l,widgetName:e,widgetFullName:h}),n?(t.each(n._childConstructors,function(e,i){var s=i.prototype;t.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete n._childConstructors):i._childConstructors.push(o),t.widget.bridge(e,o),o},t.widget.extend=function(e){for(var i,n,o=s.call(arguments,1),a=0,r=o.length;r>a;a++)for(i in o[a])n=o[a][i],o[a].hasOwnProperty(i)&&void 0!==n&&(e[i]=t.isPlainObject(n)?t.isPlainObject(e[i])?t.widget.extend({},e[i],n):t.widget.extend({},n):n);return e},t.widget.bridge=function(e,i){var n=i.prototype.widgetFullName||e;t.fn[e]=function(o){var a="string"==typeof o,r=s.call(arguments,1),l=this;return a?this.length||"instance"!==o?this.each(function(){var i,s=t.data(this,n);return"instance"===o?(l=s,!1):s?t.isFunction(s[o])&&"_"!==o.charAt(0)?(i=s[o].apply(s,r),i!==s&&void 0!==i?(l=i&&i.jquery?l.pushStack(i.get()):i,!1):void 0):t.error("no such method '"+o+"' for "+e+" widget instance"):t.error("cannot call methods on "+e+" prior to initialization; "+"attempted to call method '"+o+"'")}):l=void 0:(r.length&&(o=t.widget.extend.apply(null,[o].concat(r))),this.each(function(){var e=t.data(this,n);e?(e.option(o||{}),e._init&&e._init()):t.data(this,n,new i(o,this))})),l}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"
",options:{classes:{},disabled:!1,create:null},_createWidget:function(e,s){s=t(s||this.defaultElement||this)[0],this.element=t(s),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=t(),this.hoverable=t(),this.focusable=t(),this.classesElementLookup={},s!==this&&(t.data(s,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===s&&this.destroy()}}),this.document=t(s.style?s.ownerDocument:s.document||s),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this.options=t.widget.extend({},this.options,this._getCreateOptions(),e),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){var e=this;this._destroy(),t.each(this.classesElementLookup,function(t,i){e._removeClass(i,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:t.noop,widget:function(){return this.element},option:function(e,i){var s,n,o,a=e;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof e)if(a={},s=e.split("."),e=s.shift(),s.length){for(n=a[e]=t.widget.extend({},this.options[e]),o=0;s.length-1>o;o++)n[s[o]]=n[s[o]]||{},n=n[s[o]];if(e=s.pop(),1===arguments.length)return void 0===n[e]?null:n[e];n[e]=i}else{if(1===arguments.length)return void 0===this.options[e]?null:this.options[e];a[e]=i}return this._setOptions(a),this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(e){var i,s,n;for(i in e)n=this.classesElementLookup[i],e[i]!==this.options.classes[i]&&n&&n.length&&(s=t(n.get()),this._removeClass(n,i),s.addClass(this._classes({element:s,keys:i,classes:e,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(e){function i(i,o){var a,r;for(r=0;i.length>r;r++)a=n.classesElementLookup[i[r]]||t(),a=e.add?t(t.unique(a.get().concat(e.element.get()))):t(a.not(e.element).get()),n.classesElementLookup[i[r]]=a,s.push(i[r]),o&&e.classes[i[r]]&&s.push(e.classes[i[r]])}var s=[],n=this;return e=t.extend({element:this.element,classes:this.options.classes||{}},e),this._on(e.element,{remove:"_untrackClassesElement"}),e.keys&&i(e.keys.match(/\S+/g)||[],!0),e.extra&&i(e.extra.match(/\S+/g)||[]),s.join(" ")},_untrackClassesElement:function(e){var i=this;t.each(i.classesElementLookup,function(s,n){-1!==t.inArray(e.target,n)&&(i.classesElementLookup[s]=t(n.not(e.target).get()))})},_removeClass:function(t,e,i){return this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,s){s="boolean"==typeof s?s:i;var n="string"==typeof t||null===t,o={extra:n?e:i,keys:n?t:e,element:n?this.element:t,add:s};return o.element.toggleClass(this._classes(o),s),this},_on:function(e,i,s){var n,o=this;"boolean"!=typeof e&&(s=i,i=e,e=!1),s?(i=n=t(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),t.each(s,function(s,a){function r(){return e||o.options.disabled!==!0&&!t(this).hasClass("ui-state-disabled")?("string"==typeof a?o[a]:a).apply(o,arguments):void 0}"string"!=typeof a&&(r.guid=a.guid=a.guid||r.guid||t.guid++);var l=s.match(/^([\w:-]*)\s*(.*)$/),h=l[1]+o.eventNamespace,c=l[2];c?n.on(h,c,r):i.on(h,r)})},_off:function(e,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.off(i).off(i),this.bindings=t(this.bindings.not(e).get()),this.focusable=t(this.focusable.not(e).get()),this.hoverable=t(this.hoverable.not(e).get())},_delay:function(t,e){function i(){return("string"==typeof t?s[t]:t).apply(s,arguments)}var s=this;return setTimeout(i,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){this._addClass(t(e.currentTarget),null,"ui-state-hover")},mouseleave:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){this._addClass(t(e.currentTarget),null,"ui-state-focus")},focusout:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-focus")}})},_trigger:function(e,i,s){var n,o,a=this.options[e];if(s=s||{},i=t.Event(i),i.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(n in o)n in i||(i[n]=o[n]);return this.element.trigger(i,s),!(t.isFunction(a)&&a.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},t.each({show:"fadeIn",hide:"fadeOut"},function(e,i){t.Widget.prototype["_"+e]=function(s,n,o){"string"==typeof n&&(n={effect:n});var a,r=n?n===!0||"number"==typeof n?i:n.effect||i:e;n=n||{},"number"==typeof n&&(n={duration:n}),a=!t.isEmptyObject(n),n.complete=o,n.delay&&s.delay(n.delay),a&&t.effects&&t.effects.effect[r]?s[e](n):r!==e&&s[r]?s[r](n.duration,n.easing,o):s.queue(function(i){t(this)[e](),o&&o.call(s[0]),i()})}}),t.widget,function(){function e(t,e,i){return[parseFloat(t[0])*(u.test(t[0])?e/100:1),parseFloat(t[1])*(u.test(t[1])?i/100:1)]}function i(e,i){return parseInt(t.css(e,i),10)||0}function s(e){var i=e[0];return 9===i.nodeType?{width:e.width(),height:e.height(),offset:{top:0,left:0}}:t.isWindow(i)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()}}var n,o=Math.max,a=Math.abs,r=/left|center|right/,l=/top|center|bottom/,h=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,u=/%$/,d=t.fn.position;t.position={scrollbarWidth:function(){if(void 0!==n)return n;var e,i,s=t("
"),o=s.children()[0];return t("body").append(s),e=o.offsetWidth,s.css("overflow","scroll"),i=o.offsetWidth,e===i&&(i=s[0].clientWidth),s.remove(),n=e-i},getScrollInfo:function(e){var i=e.isWindow||e.isDocument?"":e.element.css("overflow-x"),s=e.isWindow||e.isDocument?"":e.element.css("overflow-y"),n="scroll"===i||"auto"===i&&e.widthi?"left":e>0?"right":"center",vertical:0>r?"top":s>0?"bottom":"middle"};h>p&&p>a(e+i)&&(u.horizontal="center"),c>f&&f>a(s+r)&&(u.vertical="middle"),u.important=o(a(e),a(i))>o(a(s),a(r))?"horizontal":"vertical",n.using.call(this,t,u)}),l.offset(t.extend(D,{using:r}))})},t.ui.position={fit:{left:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollLeft:s.offset.left,a=s.width,r=t.left-e.collisionPosition.marginLeft,l=n-r,h=r+e.collisionWidth-a-n;e.collisionWidth>a?l>0&&0>=h?(i=t.left+l+e.collisionWidth-a-n,t.left+=l-i):t.left=h>0&&0>=l?n:l>h?n+a-e.collisionWidth:n:l>0?t.left+=l:h>0?t.left-=h:t.left=o(t.left-r,t.left)},top:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollTop:s.offset.top,a=e.within.height,r=t.top-e.collisionPosition.marginTop,l=n-r,h=r+e.collisionHeight-a-n;e.collisionHeight>a?l>0&&0>=h?(i=t.top+l+e.collisionHeight-a-n,t.top+=l-i):t.top=h>0&&0>=l?n:l>h?n+a-e.collisionHeight:n:l>0?t.top+=l:h>0?t.top-=h:t.top=o(t.top-r,t.top)}},flip:{left:function(t,e){var i,s,n=e.within,o=n.offset.left+n.scrollLeft,r=n.width,l=n.isWindow?n.scrollLeft:n.offset.left,h=t.left-e.collisionPosition.marginLeft,c=h-l,u=h+e.collisionWidth-r-l,d="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,p="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,f=-2*e.offset[0];0>c?(i=t.left+d+p+f+e.collisionWidth-r-o,(0>i||a(c)>i)&&(t.left+=d+p+f)):u>0&&(s=t.left-e.collisionPosition.marginLeft+d+p+f-l,(s>0||u>a(s))&&(t.left+=d+p+f))},top:function(t,e){var i,s,n=e.within,o=n.offset.top+n.scrollTop,r=n.height,l=n.isWindow?n.scrollTop:n.offset.top,h=t.top-e.collisionPosition.marginTop,c=h-l,u=h+e.collisionHeight-r-l,d="top"===e.my[1],p=d?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,f="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,g=-2*e.offset[1];0>c?(s=t.top+p+f+g+e.collisionHeight-r-o,(0>s||a(c)>s)&&(t.top+=p+f+g)):u>0&&(i=t.top-e.collisionPosition.marginTop+p+f+g-l,(i>0||u>a(i))&&(t.top+=p+f+g))}},flipfit:{left:function(){t.ui.position.flip.left.apply(this,arguments),t.ui.position.fit.left.apply(this,arguments)},top:function(){t.ui.position.flip.top.apply(this,arguments),t.ui.position.fit.top.apply(this,arguments)}}}}(),t.ui.position,t.extend(t.expr[":"],{data:t.expr.createPseudo?t.expr.createPseudo(function(e){return function(i){return!!t.data(i,e)}}):function(e,i,s){return!!t.data(e,s[3])}}),t.fn.extend({disableSelection:function(){var t="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.on(t+".ui-disableSelection",function(t){t.preventDefault()})}}(),enableSelection:function(){return this.off(".ui-disableSelection")}}),t.ui.focusable=function(i,s){var n,o,a,r,l,h=i.nodeName.toLowerCase();return"area"===h?(n=i.parentNode,o=n.name,i.href&&o&&"map"===n.nodeName.toLowerCase()?(a=t("img[usemap='#"+o+"']"),a.length>0&&a.is(":visible")):!1):(/^(input|select|textarea|button|object)$/.test(h)?(r=!i.disabled,r&&(l=t(i).closest("fieldset")[0],l&&(r=!l.disabled))):r="a"===h?i.href||s:s,r&&t(i).is(":visible")&&e(t(i)))},t.extend(t.expr[":"],{focusable:function(e){return t.ui.focusable(e,null!=t.attr(e,"tabindex"))}}),t.ui.focusable,t.fn.form=function(){return"string"==typeof this[0].form?this.closest("form"):t(this[0].form)},t.ui.formResetMixin={_formResetHandler:function(){var e=t(this);setTimeout(function(){var i=e.data("ui-form-reset-instances");t.each(i,function(){this.refresh()})})},_bindFormResetHandler:function(){if(this.form=this.element.form(),this.form.length){var t=this.form.data("ui-form-reset-instances")||[];t.length||this.form.on("reset.ui-form-reset",this._formResetHandler),t.push(this),this.form.data("ui-form-reset-instances",t)}},_unbindFormResetHandler:function(){if(this.form.length){var e=this.form.data("ui-form-reset-instances");e.splice(t.inArray(this,e),1),e.length?this.form.data("ui-form-reset-instances",e):this.form.removeData("ui-form-reset-instances").off("reset.ui-form-reset")}}},"1.7"===t.fn.jquery.substring(0,3)&&(t.each(["Width","Height"],function(e,i){function s(e,i,s,o){return t.each(n,function(){i-=parseFloat(t.css(e,"padding"+this))||0,s&&(i-=parseFloat(t.css(e,"border"+this+"Width"))||0),o&&(i-=parseFloat(t.css(e,"margin"+this))||0)}),i}var n="Width"===i?["Left","Right"]:["Top","Bottom"],o=i.toLowerCase(),a={innerWidth:t.fn.innerWidth,innerHeight:t.fn.innerHeight,outerWidth:t.fn.outerWidth,outerHeight:t.fn.outerHeight};t.fn["inner"+i]=function(e){return void 0===e?a["inner"+i].call(this):this.each(function(){t(this).css(o,s(this,e)+"px")})},t.fn["outer"+i]=function(e,n){return"number"!=typeof e?a["outer"+i].call(this,e):this.each(function(){t(this).css(o,s(this,e,!0,n)+"px")})}}),t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},t.ui.escapeSelector=function(){var t=/([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g;return function(e){return e.replace(t,"\\$1")}}(),t.fn.labels=function(){var e,i,s,n,o;return this[0].labels&&this[0].labels.length?this.pushStack(this[0].labels):(n=this.eq(0).parents("label"),s=this.attr("id"),s&&(e=this.eq(0).parents().last(),o=e.add(e.length?e.siblings():this.siblings()),i="label[for='"+t.ui.escapeSelector(s)+"']",n=n.add(o.find(i).addBack(i))),this.pushStack(n))},t.fn.scrollParent=function(e){var i=this.css("position"),s="absolute"===i,n=e?/(auto|scroll|hidden)/:/(auto|scroll)/,o=this.parents().filter(function(){var e=t(this);return s&&"static"===e.css("position")?!1:n.test(e.css("overflow")+e.css("overflow-y")+e.css("overflow-x"))}).eq(0);return"fixed"!==i&&o.length?o:t(this[0].ownerDocument||document)},t.extend(t.expr[":"],{tabbable:function(e){var i=t.attr(e,"tabindex"),s=null!=i;return(!s||i>=0)&&t.ui.focusable(e,s)}}),t.fn.extend({uniqueId:function(){var t=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++t)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&t(this).removeAttr("id")})}}),t.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());var n=!1;t(document).on("mouseup",function(){n=!1}),t.widget("ui.mouse",{version:"1.12.1",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.on("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).on("click."+this.widgetName,function(i){return!0===t.data(i.target,e.widgetName+".preventClickEvent")?(t.removeData(i.target,e.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.off("."+this.widgetName),this._mouseMoveDelegate&&this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(e){if(!n){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(e),this._mouseDownEvent=e;var i=this,s=1===e.which,o="string"==typeof this.options.cancel&&e.target.nodeName?t(e.target).closest(this.options.cancel).length:!1;return s&&!o&&this._mouseCapture(e)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(e)!==!1,!this._mouseStarted)?(e.preventDefault(),!0):(!0===t.data(e.target,this.widgetName+".preventClickEvent")&&t.removeData(e.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(t){return i._mouseMove(t)},this._mouseUpDelegate=function(t){return i._mouseUp(t)},this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate),e.preventDefault(),n=!0,!0)):!0}},_mouseMove:function(e){if(this._mouseMoved){if(t.ui.ie&&(!document.documentMode||9>document.documentMode)&&!e.button)return this._mouseUp(e);if(!e.which)if(e.originalEvent.altKey||e.originalEvent.ctrlKey||e.originalEvent.metaKey||e.originalEvent.shiftKey)this.ignoreMissingWhich=!0;else if(!this.ignoreMissingWhich)return this._mouseUp(e)}return(e.which||e.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,e)!==!1,this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&t.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),this._mouseDelayTimer&&(clearTimeout(this._mouseDelayTimer),delete this._mouseDelayTimer),this.ignoreMissingWhich=!1,n=!1,e.preventDefault()},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),t.ui.plugin={add:function(e,i,s){var n,o=t.ui[e].prototype;for(n in s)o.plugins[n]=o.plugins[n]||[],o.plugins[n].push([i,s[n]])},call:function(t,e,i,s){var n,o=t.plugins[e];if(o&&(s||t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType))for(n=0;o.length>n;n++)t.options[o[n][0]]&&o[n][1].apply(t.element,i)}},t.ui.safeActiveElement=function(t){var e;try{e=t.activeElement}catch(i){e=t.body}return e||(e=t.body),e.nodeName||(e=t.body),e},t.ui.safeBlur=function(e){e&&"body"!==e.nodeName.toLowerCase()&&t(e).trigger("blur")},t.widget("ui.draggable",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"===this.options.helper&&this._setPositionRelative(),this.options.addClasses&&this._addClass("ui-draggable"),this._setHandleClassName(),this._mouseInit()},_setOption:function(t,e){this._super(t,e),"handle"===t&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){return(this.helper||this.element).is(".ui-draggable-dragging")?(this.destroyOnClear=!0,void 0):(this._removeHandleClassName(),this._mouseDestroy(),void 0)},_mouseCapture:function(e){var i=this.options;return this.helper||i.disabled||t(e.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(e),this.handle?(this._blurActiveElement(e),this._blockFrames(i.iframeFix===!0?"iframe":i.iframeFix),!0):!1)},_blockFrames:function(e){this.iframeBlocks=this.document.find(e).map(function(){var e=t(this);return t("
").css("position","absolute").appendTo(e.parent()).outerWidth(e.outerWidth()).outerHeight(e.outerHeight()).offset(e.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(e){var i=t.ui.safeActiveElement(this.document[0]),s=t(e.target);s.closest(i).length||t.ui.safeBlur(i)},_mouseStart:function(e){var i=this.options;return this.helper=this._createHelper(e),this._addClass(this.helper,"ui-draggable-dragging"),this._cacheHelperProportions(),t.ui.ddmanager&&(t.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=this.helper.parents().filter(function(){return"fixed"===t(this).css("position")}).length>0,this.positionAbs=this.element.offset(),this._refreshOffsets(e),this.originalPosition=this.position=this._generatePosition(e,!1),this.originalPageX=e.pageX,this.originalPageY=e.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),this._trigger("start",e)===!1?(this._clear(),!1):(this._cacheHelperProportions(),t.ui.ddmanager&&!i.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this._mouseDrag(e,!0),t.ui.ddmanager&&t.ui.ddmanager.dragStart(this,e),!0)},_refreshOffsets:function(t){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:!1,parent:this._getParentOffset(),relative:this._getRelativeOffset()},this.offset.click={left:t.pageX-this.offset.left,top:t.pageY-this.offset.top}},_mouseDrag:function(e,i){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(e,!0),this.positionAbs=this._convertPositionTo("absolute"),!i){var s=this._uiHash();if(this._trigger("drag",e,s)===!1)return this._mouseUp(new t.Event("mouseup",e)),!1;this.position=s.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),!1},_mouseStop:function(e){var i=this,s=!1;return t.ui.ddmanager&&!this.options.dropBehaviour&&(s=t.ui.ddmanager.drop(this,e)),this.dropped&&(s=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||this.options.revert===!0||t.isFunction(this.options.revert)&&this.options.revert.call(this.element,s)?t(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",e)!==!1&&i._clear()}):this._trigger("stop",e)!==!1&&this._clear(),!1},_mouseUp:function(e){return this._unblockFrames(),t.ui.ddmanager&&t.ui.ddmanager.dragStop(this,e),this.handleElement.is(e.target)&&this.element.trigger("focus"),t.ui.mouse.prototype._mouseUp.call(this,e)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp(new t.Event("mouseup",{target:this.element[0]})):this._clear(),this},_getHandle:function(e){return this.options.handle?!!t(e.target).closest(this.element.find(this.options.handle)).length:!0},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this._addClass(this.handleElement,"ui-draggable-handle")},_removeHandleClassName:function(){this._removeClass(this.handleElement,"ui-draggable-handle")},_createHelper:function(e){var i=this.options,s=t.isFunction(i.helper),n=s?t(i.helper.apply(this.element[0],[e])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return n.parents("body").length||n.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),s&&n[0]===this.element[0]&&this._setPositionRelative(),n[0]===this.element[0]||/(fixed|absolute)/.test(n.css("position"))||n.css("position","absolute"),n},_setPositionRelative:function(){/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative")},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_isRootNode:function(t){return/(html|body)/i.test(t.tagName)||t===this.document[0]},_getParentOffset:function(){var e=this.offsetParent.offset(),i=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==i&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),this._isRootNode(this.offsetParent[0])&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var t=this.element.position(),e=this._isRootNode(this.scrollParent[0]);return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+(e?0:this.scrollParent.scrollTop()),left:t.left-(parseInt(this.helper.css("left"),10)||0)+(e?0:this.scrollParent.scrollLeft())}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,s,n=this.options,o=this.document[0];return this.relativeContainer=null,n.containment?"window"===n.containment?(this.containment=[t(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,t(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,t(window).scrollLeft()+t(window).width()-this.helperProportions.width-this.margins.left,t(window).scrollTop()+(t(window).height()||o.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):"document"===n.containment?(this.containment=[0,0,t(o).width()-this.helperProportions.width-this.margins.left,(t(o).height()||o.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):n.containment.constructor===Array?(this.containment=n.containment,void 0):("parent"===n.containment&&(n.containment=this.helper[0].parentNode),i=t(n.containment),s=i[0],s&&(e=/(scroll|auto)/.test(i.css("overflow")),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(e?Math.max(s.scrollWidth,s.offsetWidth):s.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(e?Math.max(s.scrollHeight,s.offsetHeight):s.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=i),void 0):(this.containment=null,void 0)},_convertPositionTo:function(t,e){e||(e=this.position);var i="absolute"===t?1:-1,s=this._isRootNode(this.scrollParent[0]);return{top:e.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.offset.scroll.top:s?0:this.offset.scroll.top)*i,left:e.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.offset.scroll.left:s?0:this.offset.scroll.left)*i}},_generatePosition:function(t,e){var i,s,n,o,a=this.options,r=this._isRootNode(this.scrollParent[0]),l=t.pageX,h=t.pageY;return r&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),e&&(this.containment&&(this.relativeContainer?(s=this.relativeContainer.offset(),i=[this.containment[0]+s.left,this.containment[1]+s.top,this.containment[2]+s.left,this.containment[3]+s.top]):i=this.containment,t.pageX-this.offset.click.lefti[2]&&(l=i[2]+this.offset.click.left),t.pageY-this.offset.click.top>i[3]&&(h=i[3]+this.offset.click.top)),a.grid&&(n=a.grid[1]?this.originalPageY+Math.round((h-this.originalPageY)/a.grid[1])*a.grid[1]:this.originalPageY,h=i?n-this.offset.click.top>=i[1]||n-this.offset.click.top>i[3]?n:n-this.offset.click.top>=i[1]?n-a.grid[1]:n+a.grid[1]:n,o=a.grid[0]?this.originalPageX+Math.round((l-this.originalPageX)/a.grid[0])*a.grid[0]:this.originalPageX,l=i?o-this.offset.click.left>=i[0]||o-this.offset.click.left>i[2]?o:o-this.offset.click.left>=i[0]?o-a.grid[0]:o+a.grid[0]:o),"y"===a.axis&&(l=this.originalPageX),"x"===a.axis&&(h=this.originalPageY)),{top:h-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:r?0:this.offset.scroll.top),left:l-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:r?0:this.offset.scroll.left)} +},_clear:function(){this._removeClass(this.helper,"ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_trigger:function(e,i,s){return s=s||this._uiHash(),t.ui.plugin.call(this,e,[i,s,this],!0),/^(drag|start|stop)/.test(e)&&(this.positionAbs=this._convertPositionTo("absolute"),s.offset=this.positionAbs),t.Widget.prototype._trigger.call(this,e,i,s)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),t.ui.plugin.add("draggable","connectToSortable",{start:function(e,i,s){var n=t.extend({},i,{item:s.element});s.sortables=[],t(s.options.connectToSortable).each(function(){var i=t(this).sortable("instance");i&&!i.options.disabled&&(s.sortables.push(i),i.refreshPositions(),i._trigger("activate",e,n))})},stop:function(e,i,s){var n=t.extend({},i,{item:s.element});s.cancelHelperRemoval=!1,t.each(s.sortables,function(){var t=this;t.isOver?(t.isOver=0,s.cancelHelperRemoval=!0,t.cancelHelperRemoval=!1,t._storedCSS={position:t.placeholder.css("position"),top:t.placeholder.css("top"),left:t.placeholder.css("left")},t._mouseStop(e),t.options.helper=t.options._helper):(t.cancelHelperRemoval=!0,t._trigger("deactivate",e,n))})},drag:function(e,i,s){t.each(s.sortables,function(){var n=!1,o=this;o.positionAbs=s.positionAbs,o.helperProportions=s.helperProportions,o.offset.click=s.offset.click,o._intersectsWith(o.containerCache)&&(n=!0,t.each(s.sortables,function(){return this.positionAbs=s.positionAbs,this.helperProportions=s.helperProportions,this.offset.click=s.offset.click,this!==o&&this._intersectsWith(this.containerCache)&&t.contains(o.element[0],this.element[0])&&(n=!1),n})),n?(o.isOver||(o.isOver=1,s._parent=i.helper.parent(),o.currentItem=i.helper.appendTo(o.element).data("ui-sortable-item",!0),o.options._helper=o.options.helper,o.options.helper=function(){return i.helper[0]},e.target=o.currentItem[0],o._mouseCapture(e,!0),o._mouseStart(e,!0,!0),o.offset.click.top=s.offset.click.top,o.offset.click.left=s.offset.click.left,o.offset.parent.left-=s.offset.parent.left-o.offset.parent.left,o.offset.parent.top-=s.offset.parent.top-o.offset.parent.top,s._trigger("toSortable",e),s.dropped=o.element,t.each(s.sortables,function(){this.refreshPositions()}),s.currentItem=s.element,o.fromOutside=s),o.currentItem&&(o._mouseDrag(e),i.position=o.position)):o.isOver&&(o.isOver=0,o.cancelHelperRemoval=!0,o.options._revert=o.options.revert,o.options.revert=!1,o._trigger("out",e,o._uiHash(o)),o._mouseStop(e,!0),o.options.revert=o.options._revert,o.options.helper=o.options._helper,o.placeholder&&o.placeholder.remove(),i.helper.appendTo(s._parent),s._refreshOffsets(e),i.position=s._generatePosition(e,!0),s._trigger("fromSortable",e),s.dropped=!1,t.each(s.sortables,function(){this.refreshPositions()}))})}}),t.ui.plugin.add("draggable","cursor",{start:function(e,i,s){var n=t("body"),o=s.options;n.css("cursor")&&(o._cursor=n.css("cursor")),n.css("cursor",o.cursor)},stop:function(e,i,s){var n=s.options;n._cursor&&t("body").css("cursor",n._cursor)}}),t.ui.plugin.add("draggable","opacity",{start:function(e,i,s){var n=t(i.helper),o=s.options;n.css("opacity")&&(o._opacity=n.css("opacity")),n.css("opacity",o.opacity)},stop:function(e,i,s){var n=s.options;n._opacity&&t(i.helper).css("opacity",n._opacity)}}),t.ui.plugin.add("draggable","scroll",{start:function(t,e,i){i.scrollParentNotHidden||(i.scrollParentNotHidden=i.helper.scrollParent(!1)),i.scrollParentNotHidden[0]!==i.document[0]&&"HTML"!==i.scrollParentNotHidden[0].tagName&&(i.overflowOffset=i.scrollParentNotHidden.offset())},drag:function(e,i,s){var n=s.options,o=!1,a=s.scrollParentNotHidden[0],r=s.document[0];a!==r&&"HTML"!==a.tagName?(n.axis&&"x"===n.axis||(s.overflowOffset.top+a.offsetHeight-e.pageY=0;d--)l=s.snapElements[d].left-s.margins.left,h=l+s.snapElements[d].width,c=s.snapElements[d].top-s.margins.top,u=c+s.snapElements[d].height,l-g>_||m>h+g||c-g>b||v>u+g||!t.contains(s.snapElements[d].item.ownerDocument,s.snapElements[d].item)?(s.snapElements[d].snapping&&s.options.snap.release&&s.options.snap.release.call(s.element,e,t.extend(s._uiHash(),{snapItem:s.snapElements[d].item})),s.snapElements[d].snapping=!1):("inner"!==f.snapMode&&(n=g>=Math.abs(c-b),o=g>=Math.abs(u-v),a=g>=Math.abs(l-_),r=g>=Math.abs(h-m),n&&(i.position.top=s._convertPositionTo("relative",{top:c-s.helperProportions.height,left:0}).top),o&&(i.position.top=s._convertPositionTo("relative",{top:u,left:0}).top),a&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l-s.helperProportions.width}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h}).left)),p=n||o||a||r,"outer"!==f.snapMode&&(n=g>=Math.abs(c-v),o=g>=Math.abs(u-b),a=g>=Math.abs(l-m),r=g>=Math.abs(h-_),n&&(i.position.top=s._convertPositionTo("relative",{top:c,left:0}).top),o&&(i.position.top=s._convertPositionTo("relative",{top:u-s.helperProportions.height,left:0}).top),a&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h-s.helperProportions.width}).left)),!s.snapElements[d].snapping&&(n||o||a||r||p)&&s.options.snap.snap&&s.options.snap.snap.call(s.element,e,t.extend(s._uiHash(),{snapItem:s.snapElements[d].item})),s.snapElements[d].snapping=n||o||a||r||p)}}),t.ui.plugin.add("draggable","stack",{start:function(e,i,s){var n,o=s.options,a=t.makeArray(t(o.stack)).sort(function(e,i){return(parseInt(t(e).css("zIndex"),10)||0)-(parseInt(t(i).css("zIndex"),10)||0)});a.length&&(n=parseInt(t(a[0]).css("zIndex"),10)||0,t(a).each(function(e){t(this).css("zIndex",n+e)}),this.css("zIndex",n+a.length))}}),t.ui.plugin.add("draggable","zIndex",{start:function(e,i,s){var n=t(i.helper),o=s.options;n.css("zIndex")&&(o._zIndex=n.css("zIndex")),n.css("zIndex",o.zIndex)},stop:function(e,i,s){var n=s.options;n._zIndex&&t(i.helper).css("zIndex",n._zIndex)}}),t.ui.draggable,t.widget("ui.resizable",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,classes:{"ui-resizable-se":"ui-icon ui-icon-gripsmall-diagonal-se"},containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(t){return parseFloat(t)||0},_isNumber:function(t){return!isNaN(parseFloat(t))},_hasScroll:function(e,i){if("hidden"===t(e).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",n=!1;return e[s]>0?!0:(e[s]=1,n=e[s]>0,e[s]=0,n)},_create:function(){var e,i=this.options,s=this;this._addClass("ui-resizable"),t.extend(this,{_aspectRatio:!!i.aspectRatio,aspectRatio:i.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:i.helper||i.ghost||i.animate?i.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)&&(this.element.wrap(t("
").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,e={marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom"),marginLeft:this.originalElement.css("marginLeft")},this.element.css(e),this.originalElement.css("margin",0),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css(e),this._proportionallyResize()),this._setupHandles(),i.autoHide&&t(this.element).on("mouseenter",function(){i.disabled||(s._removeClass("ui-resizable-autohide"),s._handles.show())}).on("mouseleave",function(){i.disabled||s.resizing||(s._addClass("ui-resizable-autohide"),s._handles.hide())}),this._mouseInit()},_destroy:function(){this._mouseDestroy();var e,i=function(e){t(e).removeData("resizable").removeData("ui-resizable").off(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),e=this.element,this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")}).insertAfter(e),e.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_setOption:function(t,e){switch(this._super(t,e),t){case"handles":this._removeHandles(),this._setupHandles();break;default:}},_setupHandles:function(){var e,i,s,n,o,a=this.options,r=this;if(this.handles=a.handles||(t(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this._handles=t(),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),s=this.handles.split(","),this.handles={},i=0;s.length>i;i++)e=t.trim(s[i]),n="ui-resizable-"+e,o=t("
"),this._addClass(o,"ui-resizable-handle "+n),o.css({zIndex:a.zIndex}),this.handles[e]=".ui-resizable-"+e,this.element.append(o);this._renderAxis=function(e){var i,s,n,o;e=e||this.element;for(i in this.handles)this.handles[i].constructor===String?this.handles[i]=this.element.children(this.handles[i]).first().show():(this.handles[i].jquery||this.handles[i].nodeType)&&(this.handles[i]=t(this.handles[i]),this._on(this.handles[i],{mousedown:r._mouseDown})),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(s=t(this.handles[i],this.element),o=/sw|ne|nw|se|n|s/.test(i)?s.outerHeight():s.outerWidth(),n=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),e.css(n,o),this._proportionallyResize()),this._handles=this._handles.add(this.handles[i])},this._renderAxis(this.element),this._handles=this._handles.add(this.element.find(".ui-resizable-handle")),this._handles.disableSelection(),this._handles.on("mouseover",function(){r.resizing||(this.className&&(o=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),r.axis=o&&o[1]?o[1]:"se")}),a.autoHide&&(this._handles.hide(),this._addClass("ui-resizable-autohide"))},_removeHandles:function(){this._handles.remove()},_mouseCapture:function(e){var i,s,n=!1;for(i in this.handles)s=t(this.handles[i])[0],(s===e.target||t.contains(s,e.target))&&(n=!0);return!this.options.disabled&&n},_mouseStart:function(e){var i,s,n,o=this.options,a=this.element;return this.resizing=!0,this._renderProxy(),i=this._num(this.helper.css("left")),s=this._num(this.helper.css("top")),o.containment&&(i+=t(o.containment).scrollLeft()||0,s+=t(o.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:i,top:s},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:a.width(),height:a.height()},this.originalSize=this._helper?{width:a.outerWidth(),height:a.outerHeight()}:{width:a.width(),height:a.height()},this.sizeDiff={width:a.outerWidth()-a.width(),height:a.outerHeight()-a.height()},this.originalPosition={left:i,top:s},this.originalMousePosition={left:e.pageX,top:e.pageY},this.aspectRatio="number"==typeof o.aspectRatio?o.aspectRatio:this.originalSize.width/this.originalSize.height||1,n=t(".ui-resizable-"+this.axis).css("cursor"),t("body").css("cursor","auto"===n?this.axis+"-resize":n),this._addClass("ui-resizable-resizing"),this._propagate("start",e),!0},_mouseDrag:function(e){var i,s,n=this.originalMousePosition,o=this.axis,a=e.pageX-n.left||0,r=e.pageY-n.top||0,l=this._change[o];return this._updatePrevProperties(),l?(i=l.apply(this,[e,a,r]),this._updateVirtualBoundaries(e.shiftKey),(this._aspectRatio||e.shiftKey)&&(i=this._updateRatio(i,e)),i=this._respectSize(i,e),this._updateCache(i),this._propagate("resize",e),s=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),t.isEmptyObject(s)||(this._updatePrevProperties(),this._trigger("resize",e,this.ui()),this._applyChanges()),!1):!1},_mouseStop:function(e){this.resizing=!1;var i,s,n,o,a,r,l,h=this.options,c=this;return this._helper&&(i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),n=s&&this._hasScroll(i[0],"left")?0:c.sizeDiff.height,o=s?0:c.sizeDiff.width,a={width:c.helper.width()-o,height:c.helper.height()-n},r=parseFloat(c.element.css("left"))+(c.position.left-c.originalPosition.left)||null,l=parseFloat(c.element.css("top"))+(c.position.top-c.originalPosition.top)||null,h.animate||this.element.css(t.extend(a,{top:l,left:r})),c.helper.height(c.size.height),c.helper.width(c.size.width),this._helper&&!h.animate&&this._proportionallyResize()),t("body").css("cursor","auto"),this._removeClass("ui-resizable-resizing"),this._propagate("stop",e),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var t={};return this.position.top!==this.prevPosition.top&&(t.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(t.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(t.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(t.height=this.size.height+"px"),this.helper.css(t),t},_updateVirtualBoundaries:function(t){var e,i,s,n,o,a=this.options;o={minWidth:this._isNumber(a.minWidth)?a.minWidth:0,maxWidth:this._isNumber(a.maxWidth)?a.maxWidth:1/0,minHeight:this._isNumber(a.minHeight)?a.minHeight:0,maxHeight:this._isNumber(a.maxHeight)?a.maxHeight:1/0},(this._aspectRatio||t)&&(e=o.minHeight*this.aspectRatio,s=o.minWidth/this.aspectRatio,i=o.maxHeight*this.aspectRatio,n=o.maxWidth/this.aspectRatio,e>o.minWidth&&(o.minWidth=e),s>o.minHeight&&(o.minHeight=s),o.maxWidth>i&&(o.maxWidth=i),o.maxHeight>n&&(o.maxHeight=n)),this._vBoundaries=o},_updateCache:function(t){this.offset=this.helper.offset(),this._isNumber(t.left)&&(this.position.left=t.left),this._isNumber(t.top)&&(this.position.top=t.top),this._isNumber(t.height)&&(this.size.height=t.height),this._isNumber(t.width)&&(this.size.width=t.width)},_updateRatio:function(t){var e=this.position,i=this.size,s=this.axis;return this._isNumber(t.height)?t.width=t.height*this.aspectRatio:this._isNumber(t.width)&&(t.height=t.width/this.aspectRatio),"sw"===s&&(t.left=e.left+(i.width-t.width),t.top=null),"nw"===s&&(t.top=e.top+(i.height-t.height),t.left=e.left+(i.width-t.width)),t},_respectSize:function(t){var e=this._vBoundaries,i=this.axis,s=this._isNumber(t.width)&&e.maxWidth&&e.maxWidtht.width,a=this._isNumber(t.height)&&e.minHeight&&e.minHeight>t.height,r=this.originalPosition.left+this.originalSize.width,l=this.originalPosition.top+this.originalSize.height,h=/sw|nw|w/.test(i),c=/nw|ne|n/.test(i);return o&&(t.width=e.minWidth),a&&(t.height=e.minHeight),s&&(t.width=e.maxWidth),n&&(t.height=e.maxHeight),o&&h&&(t.left=r-e.minWidth),s&&h&&(t.left=r-e.maxWidth),a&&c&&(t.top=l-e.minHeight),n&&c&&(t.top=l-e.maxHeight),t.width||t.height||t.left||!t.top?t.width||t.height||t.top||!t.left||(t.left=null):t.top=null,t},_getPaddingPlusBorderDimensions:function(t){for(var e=0,i=[],s=[t.css("borderTopWidth"),t.css("borderRightWidth"),t.css("borderBottomWidth"),t.css("borderLeftWidth")],n=[t.css("paddingTop"),t.css("paddingRight"),t.css("paddingBottom"),t.css("paddingLeft")];4>e;e++)i[e]=parseFloat(s[e])||0,i[e]+=parseFloat(n[e])||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var t,e=0,i=this.helper||this.element;this._proportionallyResizeElements.length>e;e++)t=this._proportionallyResizeElements[e],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(t)),t.css({height:i.height()-this.outerDimensions.height||0,width:i.width()-this.outerDimensions.width||0})},_renderProxy:function(){var e=this.element,i=this.options;this.elementOffset=e.offset(),this._helper?(this.helper=this.helper||t("
"),this._addClass(this.helper,this._helper),this.helper.css({width:this.element.outerWidth(),height:this.element.outerHeight(),position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(t,e){return{width:this.originalSize.width+e}},w:function(t,e){var i=this.originalSize,s=this.originalPosition;return{left:s.left+e,width:i.width-e}},n:function(t,e,i){var s=this.originalSize,n=this.originalPosition;return{top:n.top+i,height:s.height-i}},s:function(t,e,i){return{height:this.originalSize.height+i}},se:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},sw:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[e,i,s]))},ne:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},nw:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[e,i,s]))}},_propagate:function(e,i){t.ui.plugin.call(this,e,[i,this.ui()]),"resize"!==e&&this._trigger(e,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),t.ui.plugin.add("resizable","animate",{stop:function(e){var i=t(this).resizable("instance"),s=i.options,n=i._proportionallyResizeElements,o=n.length&&/textarea/i.test(n[0].nodeName),a=o&&i._hasScroll(n[0],"left")?0:i.sizeDiff.height,r=o?0:i.sizeDiff.width,l={width:i.size.width-r,height:i.size.height-a},h=parseFloat(i.element.css("left"))+(i.position.left-i.originalPosition.left)||null,c=parseFloat(i.element.css("top"))+(i.position.top-i.originalPosition.top)||null;i.element.animate(t.extend(l,c&&h?{top:c,left:h}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function(){var s={width:parseFloat(i.element.css("width")),height:parseFloat(i.element.css("height")),top:parseFloat(i.element.css("top")),left:parseFloat(i.element.css("left"))};n&&n.length&&t(n[0]).css({width:s.width,height:s.height}),i._updateCache(s),i._propagate("resize",e)}})}}),t.ui.plugin.add("resizable","containment",{start:function(){var e,i,s,n,o,a,r,l=t(this).resizable("instance"),h=l.options,c=l.element,u=h.containment,d=u instanceof t?u.get(0):/parent/.test(u)?c.parent().get(0):u;d&&(l.containerElement=t(d),/document/.test(u)||u===document?(l.containerOffset={left:0,top:0},l.containerPosition={left:0,top:0},l.parentData={element:t(document),left:0,top:0,width:t(document).width(),height:t(document).height()||document.body.parentNode.scrollHeight}):(e=t(d),i=[],t(["Top","Right","Left","Bottom"]).each(function(t,s){i[t]=l._num(e.css("padding"+s))}),l.containerOffset=e.offset(),l.containerPosition=e.position(),l.containerSize={height:e.innerHeight()-i[3],width:e.innerWidth()-i[1]},s=l.containerOffset,n=l.containerSize.height,o=l.containerSize.width,a=l._hasScroll(d,"left")?d.scrollWidth:o,r=l._hasScroll(d)?d.scrollHeight:n,l.parentData={element:d,left:s.left,top:s.top,width:a,height:r}))},resize:function(e){var i,s,n,o,a=t(this).resizable("instance"),r=a.options,l=a.containerOffset,h=a.position,c=a._aspectRatio||e.shiftKey,u={top:0,left:0},d=a.containerElement,p=!0;d[0]!==document&&/static/.test(d.css("position"))&&(u=l),h.left<(a._helper?l.left:0)&&(a.size.width=a.size.width+(a._helper?a.position.left-l.left:a.position.left-u.left),c&&(a.size.height=a.size.width/a.aspectRatio,p=!1),a.position.left=r.helper?l.left:0),h.top<(a._helper?l.top:0)&&(a.size.height=a.size.height+(a._helper?a.position.top-l.top:a.position.top),c&&(a.size.width=a.size.height*a.aspectRatio,p=!1),a.position.top=a._helper?l.top:0),n=a.containerElement.get(0)===a.element.parent().get(0),o=/relative|absolute/.test(a.containerElement.css("position")),n&&o?(a.offset.left=a.parentData.left+a.position.left,a.offset.top=a.parentData.top+a.position.top):(a.offset.left=a.element.offset().left,a.offset.top=a.element.offset().top),i=Math.abs(a.sizeDiff.width+(a._helper?a.offset.left-u.left:a.offset.left-l.left)),s=Math.abs(a.sizeDiff.height+(a._helper?a.offset.top-u.top:a.offset.top-l.top)),i+a.size.width>=a.parentData.width&&(a.size.width=a.parentData.width-i,c&&(a.size.height=a.size.width/a.aspectRatio,p=!1)),s+a.size.height>=a.parentData.height&&(a.size.height=a.parentData.height-s,c&&(a.size.width=a.size.height*a.aspectRatio,p=!1)),p||(a.position.left=a.prevPosition.left,a.position.top=a.prevPosition.top,a.size.width=a.prevSize.width,a.size.height=a.prevSize.height)},stop:function(){var e=t(this).resizable("instance"),i=e.options,s=e.containerOffset,n=e.containerPosition,o=e.containerElement,a=t(e.helper),r=a.offset(),l=a.outerWidth()-e.sizeDiff.width,h=a.outerHeight()-e.sizeDiff.height;e._helper&&!i.animate&&/relative/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:l,height:h}),e._helper&&!i.animate&&/static/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:l,height:h})}}),t.ui.plugin.add("resizable","alsoResize",{start:function(){var e=t(this).resizable("instance"),i=e.options;t(i.alsoResize).each(function(){var e=t(this);e.data("ui-resizable-alsoresize",{width:parseFloat(e.width()),height:parseFloat(e.height()),left:parseFloat(e.css("left")),top:parseFloat(e.css("top"))})})},resize:function(e,i){var s=t(this).resizable("instance"),n=s.options,o=s.originalSize,a=s.originalPosition,r={height:s.size.height-o.height||0,width:s.size.width-o.width||0,top:s.position.top-a.top||0,left:s.position.left-a.left||0};t(n.alsoResize).each(function(){var e=t(this),s=t(this).data("ui-resizable-alsoresize"),n={},o=e.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];t.each(o,function(t,e){var i=(s[e]||0)+(r[e]||0);i&&i>=0&&(n[e]=i||null)}),e.css(n)})},stop:function(){t(this).removeData("ui-resizable-alsoresize")}}),t.ui.plugin.add("resizable","ghost",{start:function(){var e=t(this).resizable("instance"),i=e.size;e.ghost=e.originalElement.clone(),e.ghost.css({opacity:.25,display:"block",position:"relative",height:i.height,width:i.width,margin:0,left:0,top:0}),e._addClass(e.ghost,"ui-resizable-ghost"),t.uiBackCompat!==!1&&"string"==typeof e.options.ghost&&e.ghost.addClass(this.options.ghost),e.ghost.appendTo(e.helper)},resize:function(){var e=t(this).resizable("instance");e.ghost&&e.ghost.css({position:"relative",height:e.size.height,width:e.size.width})},stop:function(){var e=t(this).resizable("instance");e.ghost&&e.helper&&e.helper.get(0).removeChild(e.ghost.get(0))}}),t.ui.plugin.add("resizable","grid",{resize:function(){var e,i=t(this).resizable("instance"),s=i.options,n=i.size,o=i.originalSize,a=i.originalPosition,r=i.axis,l="number"==typeof s.grid?[s.grid,s.grid]:s.grid,h=l[0]||1,c=l[1]||1,u=Math.round((n.width-o.width)/h)*h,d=Math.round((n.height-o.height)/c)*c,p=o.width+u,f=o.height+d,g=s.maxWidth&&p>s.maxWidth,m=s.maxHeight&&f>s.maxHeight,_=s.minWidth&&s.minWidth>p,v=s.minHeight&&s.minHeight>f;s.grid=l,_&&(p+=h),v&&(f+=c),g&&(p-=h),m&&(f-=c),/^(se|s|e)$/.test(r)?(i.size.width=p,i.size.height=f):/^(ne)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.top=a.top-d):/^(sw)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.left=a.left-u):((0>=f-c||0>=p-h)&&(e=i._getPaddingPlusBorderDimensions(this)),f-c>0?(i.size.height=f,i.position.top=a.top-d):(f=c-e.height,i.size.height=f,i.position.top=a.top+o.height-f),p-h>0?(i.size.width=p,i.position.left=a.left-u):(p=h-e.width,i.size.width=p,i.position.left=a.left+o.width-p))}}),t.ui.resizable,t.widget("ui.slider",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"slide",options:{animate:!1,classes:{"ui-slider":"ui-corner-all","ui-slider-handle":"ui-corner-all","ui-slider-range":"ui-corner-all ui-widget-header"},distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},numPages:5,_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this._calculateNewMax(),this._addClass("ui-slider ui-slider-"+this.orientation,"ui-widget ui-widget-content"),this._refresh(),this._animateOff=!1},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var e,i,s=this.options,n=this.element.find(".ui-slider-handle"),o="",a=[];for(i=s.values&&s.values.length||1,n.length>i&&(n.slice(i).remove(),n=n.slice(0,i)),e=n.length;i>e;e++)a.push(o);this.handles=n.add(t(a.join("")).appendTo(this.element)),this._addClass(this.handles,"ui-slider-handle","ui-state-default"),this.handle=this.handles.eq(0),this.handles.each(function(e){t(this).data("ui-slider-handle-index",e).attr("tabIndex",0)})},_createRange:function(){var e=this.options;e.range?(e.range===!0&&(e.values?e.values.length&&2!==e.values.length?e.values=[e.values[0],e.values[0]]:t.isArray(e.values)&&(e.values=e.values.slice(0)):e.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?(this._removeClass(this.range,"ui-slider-range-min ui-slider-range-max"),this.range.css({left:"",bottom:""})):(this.range=t("
").appendTo(this.element),this._addClass(this.range,"ui-slider-range")),("min"===e.range||"max"===e.range)&&this._addClass(this.range,"ui-slider-range-"+e.range)):(this.range&&this.range.remove(),this.range=null)},_setupEvents:function(){this._off(this.handles),this._on(this.handles,this._handleEvents),this._hoverable(this.handles),this._focusable(this.handles)},_destroy:function(){this.handles.remove(),this.range&&this.range.remove(),this._mouseDestroy()},_mouseCapture:function(e){var i,s,n,o,a,r,l,h,c=this,u=this.options;return u.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),i={x:e.pageX,y:e.pageY},s=this._normValueFromMouse(i),n=this._valueMax()-this._valueMin()+1,this.handles.each(function(e){var i=Math.abs(s-c.values(e));(n>i||n===i&&(e===c._lastChangedValue||c.values(e)===u.min))&&(n=i,o=t(this),a=e)}),r=this._start(e,a),r===!1?!1:(this._mouseSliding=!0,this._handleIndex=a,this._addClass(o,null,"ui-state-active"),o.trigger("focus"),l=o.offset(),h=!t(e.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=h?{left:0,top:0}:{left:e.pageX-l.left-o.width()/2,top:e.pageY-l.top-o.height()/2-(parseInt(o.css("borderTopWidth"),10)||0)-(parseInt(o.css("borderBottomWidth"),10)||0)+(parseInt(o.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(e,a,s),this._animateOff=!0,!0))},_mouseStart:function(){return!0},_mouseDrag:function(t){var e={x:t.pageX,y:t.pageY},i=this._normValueFromMouse(e);return this._slide(t,this._handleIndex,i),!1},_mouseStop:function(t){return this._removeClass(this.handles,null,"ui-state-active"),this._mouseSliding=!1,this._stop(t,this._handleIndex),this._change(t,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(t){var e,i,s,n,o;return"horizontal"===this.orientation?(e=this.elementSize.width,i=t.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(e=this.elementSize.height,i=t.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),s=i/e,s>1&&(s=1),0>s&&(s=0),"vertical"===this.orientation&&(s=1-s),n=this._valueMax()-this._valueMin(),o=this._valueMin()+s*n,this._trimAlignValue(o)},_uiHash:function(t,e,i){var s={handle:this.handles[t],handleIndex:t,value:void 0!==e?e:this.value()};return this._hasMultipleValues()&&(s.value=void 0!==e?e:this.values(t),s.values=i||this.values()),s},_hasMultipleValues:function(){return this.options.values&&this.options.values.length},_start:function(t,e){return this._trigger("start",t,this._uiHash(e))},_slide:function(t,e,i){var s,n,o=this.value(),a=this.values();this._hasMultipleValues()&&(n=this.values(e?0:1),o=this.values(e),2===this.options.values.length&&this.options.range===!0&&(i=0===e?Math.min(n,i):Math.max(n,i)),a[e]=i),i!==o&&(s=this._trigger("slide",t,this._uiHash(e,i,a)),s!==!1&&(this._hasMultipleValues()?this.values(e,i):this.value(i)))},_stop:function(t,e){this._trigger("stop",t,this._uiHash(e))},_change:function(t,e){this._keySliding||this._mouseSliding||(this._lastChangedValue=e,this._trigger("change",t,this._uiHash(e)))},value:function(t){return arguments.length?(this.options.value=this._trimAlignValue(t),this._refreshValue(),this._change(null,0),void 0):this._value()},values:function(e,i){var s,n,o;if(arguments.length>1)return this.options.values[e]=this._trimAlignValue(i),this._refreshValue(),this._change(null,e),void 0;if(!arguments.length)return this._values();if(!t.isArray(arguments[0]))return this._hasMultipleValues()?this._values(e):this.value();for(s=this.options.values,n=arguments[0],o=0;s.length>o;o+=1)s[o]=this._trimAlignValue(n[o]),this._change(null,o);this._refreshValue()},_setOption:function(e,i){var s,n=0;switch("range"===e&&this.options.range===!0&&("min"===i?(this.options.value=this._values(0),this.options.values=null):"max"===i&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),t.isArray(this.options.values)&&(n=this.options.values.length),this._super(e,i),e){case"orientation":this._detectOrientation(),this._removeClass("ui-slider-horizontal ui-slider-vertical")._addClass("ui-slider-"+this.orientation),this._refreshValue(),this.options.range&&this._refreshRange(i),this.handles.css("horizontal"===i?"bottom":"left","");break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),s=n-1;s>=0;s--)this._change(null,s); +this._animateOff=!1;break;case"step":case"min":case"max":this._animateOff=!0,this._calculateNewMax(),this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1}},_setOptionDisabled:function(t){this._super(t),this._toggleClass(null,"ui-state-disabled",!!t)},_value:function(){var t=this.options.value;return t=this._trimAlignValue(t)},_values:function(t){var e,i,s;if(arguments.length)return e=this.options.values[t],e=this._trimAlignValue(e);if(this._hasMultipleValues()){for(i=this.options.values.slice(),s=0;i.length>s;s+=1)i[s]=this._trimAlignValue(i[s]);return i}return[]},_trimAlignValue:function(t){if(this._valueMin()>=t)return this._valueMin();if(t>=this._valueMax())return this._valueMax();var e=this.options.step>0?this.options.step:1,i=(t-this._valueMin())%e,s=t-i;return 2*Math.abs(i)>=e&&(s+=i>0?e:-e),parseFloat(s.toFixed(5))},_calculateNewMax:function(){var t=this.options.max,e=this._valueMin(),i=this.options.step,s=Math.round((t-e)/i)*i;t=s+e,t>this.options.max&&(t-=i),this.max=parseFloat(t.toFixed(this._precision()))},_precision:function(){var t=this._precisionOf(this.options.step);return null!==this.options.min&&(t=Math.max(t,this._precisionOf(this.options.min))),t},_precisionOf:function(t){var e=""+t,i=e.indexOf(".");return-1===i?0:e.length-i-1},_valueMin:function(){return this.options.min},_valueMax:function(){return this.max},_refreshRange:function(t){"vertical"===t&&this.range.css({width:"",left:""}),"horizontal"===t&&this.range.css({height:"",bottom:""})},_refreshValue:function(){var e,i,s,n,o,a=this.options.range,r=this.options,l=this,h=this._animateOff?!1:r.animate,c={};this._hasMultipleValues()?this.handles.each(function(s){i=100*((l.values(s)-l._valueMin())/(l._valueMax()-l._valueMin())),c["horizontal"===l.orientation?"left":"bottom"]=i+"%",t(this).stop(1,1)[h?"animate":"css"](c,r.animate),l.options.range===!0&&("horizontal"===l.orientation?(0===s&&l.range.stop(1,1)[h?"animate":"css"]({left:i+"%"},r.animate),1===s&&l.range[h?"animate":"css"]({width:i-e+"%"},{queue:!1,duration:r.animate})):(0===s&&l.range.stop(1,1)[h?"animate":"css"]({bottom:i+"%"},r.animate),1===s&&l.range[h?"animate":"css"]({height:i-e+"%"},{queue:!1,duration:r.animate}))),e=i}):(s=this.value(),n=this._valueMin(),o=this._valueMax(),i=o!==n?100*((s-n)/(o-n)):0,c["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[h?"animate":"css"](c,r.animate),"min"===a&&"horizontal"===this.orientation&&this.range.stop(1,1)[h?"animate":"css"]({width:i+"%"},r.animate),"max"===a&&"horizontal"===this.orientation&&this.range.stop(1,1)[h?"animate":"css"]({width:100-i+"%"},r.animate),"min"===a&&"vertical"===this.orientation&&this.range.stop(1,1)[h?"animate":"css"]({height:i+"%"},r.animate),"max"===a&&"vertical"===this.orientation&&this.range.stop(1,1)[h?"animate":"css"]({height:100-i+"%"},r.animate))},_handleEvents:{keydown:function(e){var i,s,n,o,a=t(e.target).data("ui-slider-handle-index");switch(e.keyCode){case t.ui.keyCode.HOME:case t.ui.keyCode.END:case t.ui.keyCode.PAGE_UP:case t.ui.keyCode.PAGE_DOWN:case t.ui.keyCode.UP:case t.ui.keyCode.RIGHT:case t.ui.keyCode.DOWN:case t.ui.keyCode.LEFT:if(e.preventDefault(),!this._keySliding&&(this._keySliding=!0,this._addClass(t(e.target),null,"ui-state-active"),i=this._start(e,a),i===!1))return}switch(o=this.options.step,s=n=this._hasMultipleValues()?this.values(a):this.value(),e.keyCode){case t.ui.keyCode.HOME:n=this._valueMin();break;case t.ui.keyCode.END:n=this._valueMax();break;case t.ui.keyCode.PAGE_UP:n=this._trimAlignValue(s+(this._valueMax()-this._valueMin())/this.numPages);break;case t.ui.keyCode.PAGE_DOWN:n=this._trimAlignValue(s-(this._valueMax()-this._valueMin())/this.numPages);break;case t.ui.keyCode.UP:case t.ui.keyCode.RIGHT:if(s===this._valueMax())return;n=this._trimAlignValue(s+o);break;case t.ui.keyCode.DOWN:case t.ui.keyCode.LEFT:if(s===this._valueMin())return;n=this._trimAlignValue(s-o)}this._slide(e,a,n)},keyup:function(e){var i=t(e.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(e,i),this._change(e,i),this._removeClass(t(e.target),null,"ui-state-active"))}}});var o="ui-effects-",a="ui-effects-style",r="ui-effects-animated",l=t;t.effects={effect:{}},function(t,e){function i(t,e,i){var s=u[e.type]||{};return null==t?i||!e.def?null:e.def:(t=s.floor?~~t:parseFloat(t),isNaN(t)?e.def:s.mod?(t+s.mod)%s.mod:0>t?0:t>s.max?s.max:t)}function s(i){var s=h(),n=s._rgba=[];return i=i.toLowerCase(),f(l,function(t,o){var a,r=o.re.exec(i),l=r&&o.parse(r),h=o.space||"rgba";return l?(a=s[h](l),s[c[h].cache]=a[c[h].cache],n=s._rgba=a._rgba,!1):e}),n.length?("0,0,0,0"===n.join()&&t.extend(n,o.transparent),s):o[i]}function n(t,e,i){return i=(i+1)%1,1>6*i?t+6*(e-t)*i:1>2*i?e:2>3*i?t+6*(e-t)*(2/3-i):t}var o,a="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",r=/^([\-+])=\s*(\d+\.?\d*)/,l=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[t[1],t[2],t[3],t[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[2.55*t[1],2.55*t[2],2.55*t[3],t[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(t){return[t[1],t[2]/100,t[3]/100,t[4]]}}],h=t.Color=function(e,i,s,n){return new t.Color.fn.parse(e,i,s,n)},c={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},u={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},d=h.support={},p=t("

")[0],f=t.each;p.style.cssText="background-color:rgba(1,1,1,.5)",d.rgba=p.style.backgroundColor.indexOf("rgba")>-1,f(c,function(t,e){e.cache="_"+t,e.props.alpha={idx:3,type:"percent",def:1}}),h.fn=t.extend(h.prototype,{parse:function(n,a,r,l){if(n===e)return this._rgba=[null,null,null,null],this;(n.jquery||n.nodeType)&&(n=t(n).css(a),a=e);var u=this,d=t.type(n),p=this._rgba=[];return a!==e&&(n=[n,a,r,l],d="array"),"string"===d?this.parse(s(n)||o._default):"array"===d?(f(c.rgba.props,function(t,e){p[e.idx]=i(n[e.idx],e)}),this):"object"===d?(n instanceof h?f(c,function(t,e){n[e.cache]&&(u[e.cache]=n[e.cache].slice())}):f(c,function(e,s){var o=s.cache;f(s.props,function(t,e){if(!u[o]&&s.to){if("alpha"===t||null==n[t])return;u[o]=s.to(u._rgba)}u[o][e.idx]=i(n[t],e,!0)}),u[o]&&0>t.inArray(null,u[o].slice(0,3))&&(u[o][3]=1,s.from&&(u._rgba=s.from(u[o])))}),this):e},is:function(t){var i=h(t),s=!0,n=this;return f(c,function(t,o){var a,r=i[o.cache];return r&&(a=n[o.cache]||o.to&&o.to(n._rgba)||[],f(o.props,function(t,i){return null!=r[i.idx]?s=r[i.idx]===a[i.idx]:e})),s}),s},_space:function(){var t=[],e=this;return f(c,function(i,s){e[s.cache]&&t.push(i)}),t.pop()},transition:function(t,e){var s=h(t),n=s._space(),o=c[n],a=0===this.alpha()?h("transparent"):this,r=a[o.cache]||o.to(a._rgba),l=r.slice();return s=s[o.cache],f(o.props,function(t,n){var o=n.idx,a=r[o],h=s[o],c=u[n.type]||{};null!==h&&(null===a?l[o]=h:(c.mod&&(h-a>c.mod/2?a+=c.mod:a-h>c.mod/2&&(a-=c.mod)),l[o]=i((h-a)*e+a,n)))}),this[n](l)},blend:function(e){if(1===this._rgba[3])return this;var i=this._rgba.slice(),s=i.pop(),n=h(e)._rgba;return h(t.map(i,function(t,e){return(1-s)*n[e]+s*t}))},toRgbaString:function(){var e="rgba(",i=t.map(this._rgba,function(t,e){return null==t?e>2?1:0:t});return 1===i[3]&&(i.pop(),e="rgb("),e+i.join()+")"},toHslaString:function(){var e="hsla(",i=t.map(this.hsla(),function(t,e){return null==t&&(t=e>2?1:0),e&&3>e&&(t=Math.round(100*t)+"%"),t});return 1===i[3]&&(i.pop(),e="hsl("),e+i.join()+")"},toHexString:function(e){var i=this._rgba.slice(),s=i.pop();return e&&i.push(~~(255*s)),"#"+t.map(i,function(t){return t=(t||0).toString(16),1===t.length?"0"+t:t}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),h.fn.parse.prototype=h.fn,c.hsla.to=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e,i,s=t[0]/255,n=t[1]/255,o=t[2]/255,a=t[3],r=Math.max(s,n,o),l=Math.min(s,n,o),h=r-l,c=r+l,u=.5*c;return e=l===r?0:s===r?60*(n-o)/h+360:n===r?60*(o-s)/h+120:60*(s-n)/h+240,i=0===h?0:.5>=u?h/c:h/(2-c),[Math.round(e)%360,i,u,null==a?1:a]},c.hsla.from=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e=t[0]/360,i=t[1],s=t[2],o=t[3],a=.5>=s?s*(1+i):s+i-s*i,r=2*s-a;return[Math.round(255*n(r,a,e+1/3)),Math.round(255*n(r,a,e)),Math.round(255*n(r,a,e-1/3)),o]},f(c,function(s,n){var o=n.props,a=n.cache,l=n.to,c=n.from;h.fn[s]=function(s){if(l&&!this[a]&&(this[a]=l(this._rgba)),s===e)return this[a].slice();var n,r=t.type(s),u="array"===r||"object"===r?s:arguments,d=this[a].slice();return f(o,function(t,e){var s=u["object"===r?t:e.idx];null==s&&(s=d[e.idx]),d[e.idx]=i(s,e)}),c?(n=h(c(d)),n[a]=d,n):h(d)},f(o,function(e,i){h.fn[e]||(h.fn[e]=function(n){var o,a=t.type(n),l="alpha"===e?this._hsla?"hsla":"rgba":s,h=this[l](),c=h[i.idx];return"undefined"===a?c:("function"===a&&(n=n.call(this,c),a=t.type(n)),null==n&&i.empty?this:("string"===a&&(o=r.exec(n),o&&(n=c+parseFloat(o[2])*("+"===o[1]?1:-1))),h[i.idx]=n,this[l](h)))})})}),h.hook=function(e){var i=e.split(" ");f(i,function(e,i){t.cssHooks[i]={set:function(e,n){var o,a,r="";if("transparent"!==n&&("string"!==t.type(n)||(o=s(n)))){if(n=h(o||n),!d.rgba&&1!==n._rgba[3]){for(a="backgroundColor"===i?e.parentNode:e;(""===r||"transparent"===r)&&a&&a.style;)try{r=t.css(a,"backgroundColor"),a=a.parentNode}catch(l){}n=n.blend(r&&"transparent"!==r?r:"_default")}n=n.toRgbaString()}try{e.style[i]=n}catch(l){}}},t.fx.step[i]=function(e){e.colorInit||(e.start=h(e.elem,i),e.end=h(e.end),e.colorInit=!0),t.cssHooks[i].set(e.elem,e.start.transition(e.end,e.pos))}})},h.hook(a),t.cssHooks.borderColor={expand:function(t){var e={};return f(["Top","Right","Bottom","Left"],function(i,s){e["border"+s+"Color"]=t}),e}},o=t.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(l),function(){function e(e){var i,s,n=e.ownerDocument.defaultView?e.ownerDocument.defaultView.getComputedStyle(e,null):e.currentStyle,o={};if(n&&n.length&&n[0]&&n[n[0]])for(s=n.length;s--;)i=n[s],"string"==typeof n[i]&&(o[t.camelCase(i)]=n[i]);else for(i in n)"string"==typeof n[i]&&(o[i]=n[i]);return o}function i(e,i){var s,o,a={};for(s in i)o=i[s],e[s]!==o&&(n[s]||(t.fx.step[s]||!isNaN(parseFloat(o)))&&(a[s]=o));return a}var s=["add","remove","toggle"],n={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};t.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(e,i){t.fx.step[i]=function(t){("none"!==t.end&&!t.setAttr||1===t.pos&&!t.setAttr)&&(l.style(t.elem,i,t.end),t.setAttr=!0)}}),t.fn.addBack||(t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t.effects.animateClass=function(n,o,a,r){var l=t.speed(o,a,r);return this.queue(function(){var o,a=t(this),r=a.attr("class")||"",h=l.children?a.find("*").addBack():a;h=h.map(function(){var i=t(this);return{el:i,start:e(this)}}),o=function(){t.each(s,function(t,e){n[e]&&a[e+"Class"](n[e])})},o(),h=h.map(function(){return this.end=e(this.el[0]),this.diff=i(this.start,this.end),this}),a.attr("class",r),h=h.map(function(){var e=this,i=t.Deferred(),s=t.extend({},l,{queue:!1,complete:function(){i.resolve(e)}});return this.el.animate(this.diff,s),i.promise()}),t.when.apply(t,h.get()).done(function(){o(),t.each(arguments,function(){var e=this.el;t.each(this.diff,function(t){e.css(t,"")})}),l.complete.call(a[0])})})},t.fn.extend({addClass:function(e){return function(i,s,n,o){return s?t.effects.animateClass.call(this,{add:i},s,n,o):e.apply(this,arguments)}}(t.fn.addClass),removeClass:function(e){return function(i,s,n,o){return arguments.length>1?t.effects.animateClass.call(this,{remove:i},s,n,o):e.apply(this,arguments)}}(t.fn.removeClass),toggleClass:function(e){return function(i,s,n,o,a){return"boolean"==typeof s||void 0===s?n?t.effects.animateClass.call(this,s?{add:i}:{remove:i},n,o,a):e.apply(this,arguments):t.effects.animateClass.call(this,{toggle:i},s,n,o)}}(t.fn.toggleClass),switchClass:function(e,i,s,n,o){return t.effects.animateClass.call(this,{add:i,remove:e},s,n,o)}})}(),function(){function e(e,i,s,n){return t.isPlainObject(e)&&(i=e,e=e.effect),e={effect:e},null==i&&(i={}),t.isFunction(i)&&(n=i,s=null,i={}),("number"==typeof i||t.fx.speeds[i])&&(n=s,s=i,i={}),t.isFunction(s)&&(n=s,s=null),i&&t.extend(e,i),s=s||i.duration,e.duration=t.fx.off?0:"number"==typeof s?s:s in t.fx.speeds?t.fx.speeds[s]:t.fx.speeds._default,e.complete=n||i.complete,e}function i(e){return!e||"number"==typeof e||t.fx.speeds[e]?!0:"string"!=typeof e||t.effects.effect[e]?t.isFunction(e)?!0:"object"!=typeof e||e.effect?!1:!0:!0}function s(t,e){var i=e.outerWidth(),s=e.outerHeight(),n=/^rect\((-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto)\)$/,o=n.exec(t)||["",0,i,s,0];return{top:parseFloat(o[1])||0,right:"auto"===o[2]?i:parseFloat(o[2]),bottom:"auto"===o[3]?s:parseFloat(o[3]),left:parseFloat(o[4])||0}}t.expr&&t.expr.filters&&t.expr.filters.animated&&(t.expr.filters.animated=function(e){return function(i){return!!t(i).data(r)||e(i)}}(t.expr.filters.animated)),t.uiBackCompat!==!1&&t.extend(t.effects,{save:function(t,e){for(var i=0,s=e.length;s>i;i++)null!==e[i]&&t.data(o+e[i],t[0].style[e[i]])},restore:function(t,e){for(var i,s=0,n=e.length;n>s;s++)null!==e[s]&&(i=t.data(o+e[s]),t.css(e[s],i))},setMode:function(t,e){return"toggle"===e&&(e=t.is(":hidden")?"show":"hide"),e},createWrapper:function(e){if(e.parent().is(".ui-effects-wrapper"))return e.parent();var i={width:e.outerWidth(!0),height:e.outerHeight(!0),"float":e.css("float")},s=t("

").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),n={width:e.width(),height:e.height()},o=document.activeElement;try{o.id}catch(a){o=document.body}return e.wrap(s),(e[0]===o||t.contains(e[0],o))&&t(o).trigger("focus"),s=e.parent(),"static"===e.css("position")?(s.css({position:"relative"}),e.css({position:"relative"})):(t.extend(i,{position:e.css("position"),zIndex:e.css("z-index")}),t.each(["top","left","bottom","right"],function(t,s){i[s]=e.css(s),isNaN(parseInt(i[s],10))&&(i[s]="auto")}),e.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),e.css(n),s.css(i).show()},removeWrapper:function(e){var i=document.activeElement;return e.parent().is(".ui-effects-wrapper")&&(e.parent().replaceWith(e),(e[0]===i||t.contains(e[0],i))&&t(i).trigger("focus")),e}}),t.extend(t.effects,{version:"1.12.1",define:function(e,i,s){return s||(s=i,i="effect"),t.effects.effect[e]=s,t.effects.effect[e].mode=i,s},scaledDimensions:function(t,e,i){if(0===e)return{height:0,width:0,outerHeight:0,outerWidth:0};var s="horizontal"!==i?(e||100)/100:1,n="vertical"!==i?(e||100)/100:1;return{height:t.height()*n,width:t.width()*s,outerHeight:t.outerHeight()*n,outerWidth:t.outerWidth()*s}},clipToBox:function(t){return{width:t.clip.right-t.clip.left,height:t.clip.bottom-t.clip.top,left:t.clip.left,top:t.clip.top}},unshift:function(t,e,i){var s=t.queue();e>1&&s.splice.apply(s,[1,0].concat(s.splice(e,i))),t.dequeue()},saveStyle:function(t){t.data(a,t[0].style.cssText)},restoreStyle:function(t){t[0].style.cssText=t.data(a)||"",t.removeData(a)},mode:function(t,e){var i=t.is(":hidden");return"toggle"===e&&(e=i?"show":"hide"),(i?"hide"===e:"show"===e)&&(e="none"),e},getBaseline:function(t,e){var i,s;switch(t[0]){case"top":i=0;break;case"middle":i=.5;break;case"bottom":i=1;break;default:i=t[0]/e.height}switch(t[1]){case"left":s=0;break;case"center":s=.5;break;case"right":s=1;break;default:s=t[1]/e.width}return{x:s,y:i}},createPlaceholder:function(e){var i,s=e.css("position"),n=e.position();return e.css({marginTop:e.css("marginTop"),marginBottom:e.css("marginBottom"),marginLeft:e.css("marginLeft"),marginRight:e.css("marginRight")}).outerWidth(e.outerWidth()).outerHeight(e.outerHeight()),/^(static|relative)/.test(s)&&(s="absolute",i=t("<"+e[0].nodeName+">").insertAfter(e).css({display:/^(inline|ruby)/.test(e.css("display"))?"inline-block":"block",visibility:"hidden",marginTop:e.css("marginTop"),marginBottom:e.css("marginBottom"),marginLeft:e.css("marginLeft"),marginRight:e.css("marginRight"),"float":e.css("float")}).outerWidth(e.outerWidth()).outerHeight(e.outerHeight()).addClass("ui-effects-placeholder"),e.data(o+"placeholder",i)),e.css({position:s,left:n.left,top:n.top}),i},removePlaceholder:function(t){var e=o+"placeholder",i=t.data(e);i&&(i.remove(),t.removeData(e))},cleanUp:function(e){t.effects.restoreStyle(e),t.effects.removePlaceholder(e)},setTransition:function(e,i,s,n){return n=n||{},t.each(i,function(t,i){var o=e.cssUnit(i);o[0]>0&&(n[i]=o[0]*s+o[1])}),n}}),t.fn.extend({effect:function(){function i(e){function i(){l.removeData(r),t.effects.cleanUp(l),"hide"===s.mode&&l.hide(),a()}function a(){t.isFunction(h)&&h.call(l[0]),t.isFunction(e)&&e()}var l=t(this);s.mode=u.shift(),t.uiBackCompat===!1||o?"none"===s.mode?(l[c](),a()):n.call(l[0],s,i):(l.is(":hidden")?"hide"===c:"show"===c)?(l[c](),a()):n.call(l[0],s,a)}var s=e.apply(this,arguments),n=t.effects.effect[s.effect],o=n.mode,a=s.queue,l=a||"fx",h=s.complete,c=s.mode,u=[],d=function(e){var i=t(this),s=t.effects.mode(i,c)||o;i.data(r,!0),u.push(s),o&&("show"===s||s===o&&"hide"===s)&&i.show(),o&&"none"===s||t.effects.saveStyle(i),t.isFunction(e)&&e()};return t.fx.off||!n?c?this[c](s.duration,h):this.each(function(){h&&h.call(this)}):a===!1?this.each(d).each(i):this.queue(l,d).queue(l,i)},show:function(t){return function(s){if(i(s))return t.apply(this,arguments);var n=e.apply(this,arguments);return n.mode="show",this.effect.call(this,n)}}(t.fn.show),hide:function(t){return function(s){if(i(s))return t.apply(this,arguments);var n=e.apply(this,arguments);return n.mode="hide",this.effect.call(this,n)}}(t.fn.hide),toggle:function(t){return function(s){if(i(s)||"boolean"==typeof s)return t.apply(this,arguments);var n=e.apply(this,arguments);return n.mode="toggle",this.effect.call(this,n)}}(t.fn.toggle),cssUnit:function(e){var i=this.css(e),s=[];return t.each(["em","px","%","pt"],function(t,e){i.indexOf(e)>0&&(s=[parseFloat(i),e])}),s},cssClip:function(t){return t?this.css("clip","rect("+t.top+"px "+t.right+"px "+t.bottom+"px "+t.left+"px)"):s(this.css("clip"),this)},transfer:function(e,i){var s=t(this),n=t(e.to),o="fixed"===n.css("position"),a=t("body"),r=o?a.scrollTop():0,l=o?a.scrollLeft():0,h=n.offset(),c={top:h.top-r,left:h.left-l,height:n.innerHeight(),width:n.innerWidth()},u=s.offset(),d=t("
").appendTo("body").addClass(e.className).css({top:u.top-r,left:u.left-l,height:s.innerHeight(),width:s.innerWidth(),position:o?"fixed":"absolute"}).animate(c,e.duration,e.easing,function(){d.remove(),t.isFunction(i)&&i()})}}),t.fx.step.clip=function(e){e.clipInit||(e.start=t(e.elem).cssClip(),"string"==typeof e.end&&(e.end=s(e.end,e.elem)),e.clipInit=!0),t(e.elem).cssClip({top:e.pos*(e.end.top-e.start.top)+e.start.top,right:e.pos*(e.end.right-e.start.right)+e.start.right,bottom:e.pos*(e.end.bottom-e.start.bottom)+e.start.bottom,left:e.pos*(e.end.left-e.start.left)+e.start.left})}}(),function(){var e={};t.each(["Quad","Cubic","Quart","Quint","Expo"],function(t,i){e[i]=function(e){return Math.pow(e,t+2)}}),t.extend(e,{Sine:function(t){return 1-Math.cos(t*Math.PI/2)},Circ:function(t){return 1-Math.sqrt(1-t*t)},Elastic:function(t){return 0===t||1===t?t:-Math.pow(2,8*(t-1))*Math.sin((80*(t-1)-7.5)*Math.PI/15)},Back:function(t){return t*t*(3*t-2)},Bounce:function(t){for(var e,i=4;((e=Math.pow(2,--i))-1)/11>t;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*e-2)/22-t,2)}}),t.each(e,function(e,i){t.easing["easeIn"+e]=i,t.easing["easeOut"+e]=function(t){return 1-i(1-t)},t.easing["easeInOut"+e]=function(t){return.5>t?i(2*t)/2:1-i(-2*t+2)/2}})}();var h=t.effects;t.effects.define("blind","hide",function(e,i){var s={up:["bottom","top"],vertical:["bottom","top"],down:["top","bottom"],left:["right","left"],horizontal:["right","left"],right:["left","right"]},n=t(this),o=e.direction||"up",a=n.cssClip(),r={clip:t.extend({},a)},l=t.effects.createPlaceholder(n);r.clip[s[o][0]]=r.clip[s[o][1]],"show"===e.mode&&(n.cssClip(r.clip),l&&l.css(t.effects.clipToBox(r)),r.clip=a),l&&l.animate(t.effects.clipToBox(r),e.duration,e.easing),n.animate(r,{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("bounce",function(e,i){var s,n,o,a=t(this),r=e.mode,l="hide"===r,h="show"===r,c=e.direction||"up",u=e.distance,d=e.times||5,p=2*d+(h||l?1:0),f=e.duration/p,g=e.easing,m="up"===c||"down"===c?"top":"left",_="up"===c||"left"===c,v=0,b=a.queue().length;for(t.effects.createPlaceholder(a),o=a.css(m),u||(u=a["top"===m?"outerHeight":"outerWidth"]()/3),h&&(n={opacity:1},n[m]=o,a.css("opacity",0).css(m,_?2*-u:2*u).animate(n,f,g)),l&&(u/=Math.pow(2,d-1)),n={},n[m]=o;d>v;v++)s={},s[m]=(_?"-=":"+=")+u,a.animate(s,f,g).animate(n,f,g),u=l?2*u:u/2;l&&(s={opacity:0},s[m]=(_?"-=":"+=")+u,a.animate(s,f,g)),a.queue(i),t.effects.unshift(a,b,p+1)}),t.effects.define("clip","hide",function(e,i){var s,n={},o=t(this),a=e.direction||"vertical",r="both"===a,l=r||"horizontal"===a,h=r||"vertical"===a;s=o.cssClip(),n.clip={top:h?(s.bottom-s.top)/2:s.top,right:l?(s.right-s.left)/2:s.right,bottom:h?(s.bottom-s.top)/2:s.bottom,left:l?(s.right-s.left)/2:s.left},t.effects.createPlaceholder(o),"show"===e.mode&&(o.cssClip(n.clip),n.clip=s),o.animate(n,{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("drop","hide",function(e,i){var s,n=t(this),o=e.mode,a="show"===o,r=e.direction||"left",l="up"===r||"down"===r?"top":"left",h="up"===r||"left"===r?"-=":"+=",c="+="===h?"-=":"+=",u={opacity:0};t.effects.createPlaceholder(n),s=e.distance||n["top"===l?"outerHeight":"outerWidth"](!0)/2,u[l]=h+s,a&&(n.css(u),u[l]=c+s,u.opacity=1),n.animate(u,{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("explode","hide",function(e,i){function s(){b.push(this),b.length===u*d&&n()}function n(){p.css({visibility:"visible"}),t(b).remove(),i()}var o,a,r,l,h,c,u=e.pieces?Math.round(Math.sqrt(e.pieces)):3,d=u,p=t(this),f=e.mode,g="show"===f,m=p.show().css("visibility","hidden").offset(),_=Math.ceil(p.outerWidth()/d),v=Math.ceil(p.outerHeight()/u),b=[];for(o=0;u>o;o++)for(l=m.top+o*v,c=o-(u-1)/2,a=0;d>a;a++)r=m.left+a*_,h=a-(d-1)/2,p.clone().appendTo("body").wrap("
").css({position:"absolute",visibility:"visible",left:-a*_,top:-o*v}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:_,height:v,left:r+(g?h*_:0),top:l+(g?c*v:0),opacity:g?0:1}).animate({left:r+(g?0:h*_),top:l+(g?0:c*v),opacity:g?1:0},e.duration||500,e.easing,s)}),t.effects.define("fade","toggle",function(e,i){var s="show"===e.mode;t(this).css("opacity",s?0:1).animate({opacity:s?1:0},{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("fold","hide",function(e,i){var s=t(this),n=e.mode,o="show"===n,a="hide"===n,r=e.size||15,l=/([0-9]+)%/.exec(r),h=!!e.horizFirst,c=h?["right","bottom"]:["bottom","right"],u=e.duration/2,d=t.effects.createPlaceholder(s),p=s.cssClip(),f={clip:t.extend({},p)},g={clip:t.extend({},p)},m=[p[c[0]],p[c[1]]],_=s.queue().length;l&&(r=parseInt(l[1],10)/100*m[a?0:1]),f.clip[c[0]]=r,g.clip[c[0]]=r,g.clip[c[1]]=0,o&&(s.cssClip(g.clip),d&&d.css(t.effects.clipToBox(g)),g.clip=p),s.queue(function(i){d&&d.animate(t.effects.clipToBox(f),u,e.easing).animate(t.effects.clipToBox(g),u,e.easing),i()}).animate(f,u,e.easing).animate(g,u,e.easing).queue(i),t.effects.unshift(s,_,4)}),t.effects.define("highlight","show",function(e,i){var s=t(this),n={backgroundColor:s.css("backgroundColor")};"hide"===e.mode&&(n.opacity=0),t.effects.saveStyle(s),s.css({backgroundImage:"none",backgroundColor:e.color||"#ffff99"}).animate(n,{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("size",function(e,i){var s,n,o,a=t(this),r=["fontSize"],l=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],h=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],c=e.mode,u="effect"!==c,d=e.scale||"both",p=e.origin||["middle","center"],f=a.css("position"),g=a.position(),m=t.effects.scaledDimensions(a),_=e.from||m,v=e.to||t.effects.scaledDimensions(a,0);t.effects.createPlaceholder(a),"show"===c&&(o=_,_=v,v=o),n={from:{y:_.height/m.height,x:_.width/m.width},to:{y:v.height/m.height,x:v.width/m.width}},("box"===d||"both"===d)&&(n.from.y!==n.to.y&&(_=t.effects.setTransition(a,l,n.from.y,_),v=t.effects.setTransition(a,l,n.to.y,v)),n.from.x!==n.to.x&&(_=t.effects.setTransition(a,h,n.from.x,_),v=t.effects.setTransition(a,h,n.to.x,v))),("content"===d||"both"===d)&&n.from.y!==n.to.y&&(_=t.effects.setTransition(a,r,n.from.y,_),v=t.effects.setTransition(a,r,n.to.y,v)),p&&(s=t.effects.getBaseline(p,m),_.top=(m.outerHeight-_.outerHeight)*s.y+g.top,_.left=(m.outerWidth-_.outerWidth)*s.x+g.left,v.top=(m.outerHeight-v.outerHeight)*s.y+g.top,v.left=(m.outerWidth-v.outerWidth)*s.x+g.left),a.css(_),("content"===d||"both"===d)&&(l=l.concat(["marginTop","marginBottom"]).concat(r),h=h.concat(["marginLeft","marginRight"]),a.find("*[width]").each(function(){var i=t(this),s=t.effects.scaledDimensions(i),o={height:s.height*n.from.y,width:s.width*n.from.x,outerHeight:s.outerHeight*n.from.y,outerWidth:s.outerWidth*n.from.x},a={height:s.height*n.to.y,width:s.width*n.to.x,outerHeight:s.height*n.to.y,outerWidth:s.width*n.to.x};n.from.y!==n.to.y&&(o=t.effects.setTransition(i,l,n.from.y,o),a=t.effects.setTransition(i,l,n.to.y,a)),n.from.x!==n.to.x&&(o=t.effects.setTransition(i,h,n.from.x,o),a=t.effects.setTransition(i,h,n.to.x,a)),u&&t.effects.saveStyle(i),i.css(o),i.animate(a,e.duration,e.easing,function(){u&&t.effects.restoreStyle(i)})})),a.animate(v,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){var e=a.offset();0===v.opacity&&a.css("opacity",_.opacity),u||(a.css("position","static"===f?"relative":f).offset(e),t.effects.saveStyle(a)),i()}})}),t.effects.define("scale",function(e,i){var s=t(this),n=e.mode,o=parseInt(e.percent,10)||(0===parseInt(e.percent,10)?0:"effect"!==n?0:100),a=t.extend(!0,{from:t.effects.scaledDimensions(s),to:t.effects.scaledDimensions(s,o,e.direction||"both"),origin:e.origin||["middle","center"]},e);e.fade&&(a.from.opacity=1,a.to.opacity=0),t.effects.effect.size.call(this,a,i)}),t.effects.define("puff","hide",function(e,i){var s=t.extend(!0,{},e,{fade:!0,percent:parseInt(e.percent,10)||150});t.effects.effect.scale.call(this,s,i)}),t.effects.define("pulsate","show",function(e,i){var s=t(this),n=e.mode,o="show"===n,a="hide"===n,r=o||a,l=2*(e.times||5)+(r?1:0),h=e.duration/l,c=0,u=1,d=s.queue().length;for((o||!s.is(":visible"))&&(s.css("opacity",0).show(),c=1);l>u;u++)s.animate({opacity:c},h,e.easing),c=1-c;s.animate({opacity:c},h,e.easing),s.queue(i),t.effects.unshift(s,d,l+1)}),t.effects.define("shake",function(e,i){var s=1,n=t(this),o=e.direction||"left",a=e.distance||20,r=e.times||3,l=2*r+1,h=Math.round(e.duration/l),c="up"===o||"down"===o?"top":"left",u="up"===o||"left"===o,d={},p={},f={},g=n.queue().length;for(t.effects.createPlaceholder(n),d[c]=(u?"-=":"+=")+a,p[c]=(u?"+=":"-=")+2*a,f[c]=(u?"-=":"+=")+2*a,n.animate(d,h,e.easing);r>s;s++)n.animate(p,h,e.easing).animate(f,h,e.easing);n.animate(p,h,e.easing).animate(d,h/2,e.easing).queue(i),t.effects.unshift(n,g,l+1)}),t.effects.define("slide","show",function(e,i){var s,n,o=t(this),a={up:["bottom","top"],down:["top","bottom"],left:["right","left"],right:["left","right"]},r=e.mode,l=e.direction||"left",h="up"===l||"down"===l?"top":"left",c="up"===l||"left"===l,u=e.distance||o["top"===h?"outerHeight":"outerWidth"](!0),d={};t.effects.createPlaceholder(o),s=o.cssClip(),n=o.position()[h],d[h]=(c?-1:1)*u+n,d.clip=o.cssClip(),d.clip[a[l][1]]=d.clip[a[l][0]],"show"===r&&(o.cssClip(d.clip),o.css(h,d[h]),d.clip=s,d[h]=n),o.animate(d,{queue:!1,duration:e.duration,easing:e.easing,complete:i})});var h;t.uiBackCompat!==!1&&(h=t.effects.define("transfer",function(e,i){t(this).transfer(e,i)}))}); \ No newline at end of file diff --git a/server/public/assets/dist/main.min.js b/server/public/assets/dist/main.min.js index 645d664b..1bc3f058 100755 --- a/server/public/assets/dist/main.min.js +++ b/server/public/assets/dist/main.min.js @@ -1 +1 @@ -!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;q.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)&&q.to_channel(t[3],!0)},D=$("#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===P||Y.mobilecheck()||fe)&&(P=io.connect(add+":8080",_t),P.on("update_required",function(){window.location.reload(!0)})),(0===$("#alreadyfp").length||Y.mobilecheck()||!P._callbacks.$playlists||fe)&&f(),$("#about").modal(),$("#help").modal(),$("#contact").modal(),$("select").material_select(),Y.log("----"),Y.log("Sending frontpage_lists"),Y.log("Socket",P),Y.log("-----"),j.init(),j.get_offline()?S(!0,We):$("#offline-mode").tooltip({delay:5,position:"bottom",tooltip:"Enable local mode"}),$("#frontpage-viewer-counter").tooltip({delay:5,position:"bottom",tooltip:"Total Viewers"}),P.emit("frontpage_lists"),P.emit("get_userlists",j.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()&&q.winter&&$(".mega").prepend('
'),Y.mobilecheck()&&$("input#searchFrontpage").characterCounter(),window.__onGCastApiAvailable=function(e,t){e&&(et=!0)}}function a(){Xe=0;var e=!0;W=$("#chan").html(),lt=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!==kt&&(kt.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),it=$("#temp-results-container"),ot=$("#empty-results-container").html(),Ve=$(".not-imported-container").html(),Oe=$(".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"),j.set_width($(this).width()),C()},handles:"e",minWidth:350,maxWidth:$(window).width()-241}),(void 0===P||Y.mobilecheck())&&(e=!1,P=io.connect(s+":8080",_t),P.on("update_required",function(){window.location.reload(!0)})),j.init(),i(),j.get_offline()&&($(".offline_switch_class")[0].checked=!0,S(!0,We)),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"),kt.readyLooks(),Ct.initYoutubeControls(kt.player),Ct.initSlider(),kt.player.setVolume(j.get_volume()),$(".video-container").removeClass("no-opacity");var a="https://remote."+window.location.hostname+"/"+ct;$("#code-text").text(ct),$("#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="";ie&&(s=j.getCookie("_uI")+"_"),P.emit("list",{channel:s+W.toLowerCase(),pass:Ie?"":j.crypt_pass(j.get_userpass(W.toLowerCase()))})}$("#viewers").tooltip({delay:5,position:"top",tooltip:"Viewers"}),$("#fullscreen").tooltip({delay:5,position:"top",tooltip:"Fullscreen"}),window.onYouTubeIframeAPIReady=kt.onYouTubeIframeAPIReady,(""===kt.player||void 0===kt.player||Y.mobilecheck())&&kt.loadPlayer(),Y.mobilecheck()?bt.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").tooltip({delay:5,position:"top",tooltip:"Cast Zoff to TV"}),$("#results").hover(function(){$("div.result").removeClass("hoverResults"),Te=0},function(){}),$("#search").focus(),$("#embed-button").css("display","inline-block"),$("#embed-area").val(k(Re,je,ze,Ge)),$("#search").attr("placeholder","Find song on YouTube..."),/chrom(e|ium)/.test(navigator.userAgent.toLowerCase())||Y.mobilecheck()||$(".castButton").css("display","none"),Y.log("chromecastAvailable"+Fe),Y.log("chromecastAvailable"+et),Fe?n(1):et?initializeCastApi():window.__onGCastApiAvailable=function(e,t){e?setTimeout(function(){et=!0,initializeCastApi()},1e3):et=!0},$.contextMenu({selector:".playlist-element",reposition:!0,autoHide:!0,items:{copy:{name:"Copy link",callback:function(e,t){var a=$(this[0]).attr("data-video-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("data-video-id");xt.search(a,!1,!0),Y.contains($(".search-container").attr("class").split(" "),"hide")&&xt.showSearch()}},sep1:"---------",delete:{name:"Delete",callback:function(e,t){var a=$(this[0]).attr("data-video-id");if("suggested"==$(this[0]).attr("data-video-type")){(Xe-=1)<0&&(Xe=0);var n=Xe>9?"9+":Xe;$(".suggested-link span.badge.new.white").hasClass("hide")||0!=n||$(".suggested-link span.badge.new.white").addClass("hide"),$(".suggested-link span.badge.new.white").text(n)}J.vote(a,"del")},disabled:function(e,t){return Z}}}}),Y.mobilecheck()||null!=navigator.userAgent.match(/iPad/i)||setTimeout(function(){C()},100)}function n(e){if(1==e){$(".castButton").tooltip("remove"),$(".castButton").hasClass("castButton-white-active")||$(".castButton").addClass("castButton-white-active"),$(".castButton").tooltip({delay:5,position:"top",tooltip:"Stop casting"}),$("#duration").toggleClass("hide"),$("#fullscreen").toggleClass("hide");try{kt.player.stopVideo()}catch(e){}kt.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/"+mt+"/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
"+H.La.friendlyName),kt.player.setVolume(100),$("#player_overlay_text").toggleClass("hide")}else 0==e&&($(".castButton").tooltip("remove"),$(".castButton").removeClass("castButton-white-active"),$(".castButton").tooltip({delay:5,position:"top",tooltip:"Cast Zoff to TV"}),$("#duration").toggleClass("hide"),$("#fullscreen").toggleClass("hide"),kt.player.playVideo(),kt.stopInterval=!1,duration=kt.player.getDuration(),kt.durationSetter(),Y.mobilecheck()||(kt.player.setVolume(j.get_volume()),$("#volume").slider("value",j.get_volume())),$("#player_overlay").addClass("hide"),$("#player_overlay_text").toggleClass("hide"),$("#chromecast_text").html(""),$("#playing_on").css("display","none"),We?kt.loadVideoById(mt):P.emit("pos",{channel:W.toLowerCase(),pass:Ie?"":j.crypt_pass(j.get_userpass(W.toLowerCase()))}))}function s(e,t){var a=JSON.parse(t);switch(a.type){case-1:We?kt.playNext():P.emit("end",{id:a.videoId,channel:W.toLowerCase(),pass:Ie?"":j.crypt_pass(j.get_userpass(W.toLowerCase()))});break;case 0:We?kt.playNext():P.emit("skip",{error:a.data_code,id:a.videoId,pass:""==le?"":j.crypt_pass(le),channel:W.toLowerCase(),userpass:Ie?"":j.crypt_pass(j.get_userpass(W.toLowerCase()))})}}function i(){P.on("auth_required",function(){he=!0,$("#player_overlay").removeClass("hide"),$("#player_overlay").css("display","block"),$("#user_password").modal("open"),j.remove_userpass(W.toLowerCase())}),P.on("auth_accepted",function(e){e.hasOwnProperty("value")&&e.value&&""!=ue&&(xe=ue,j.set_userpass(W.toLowerCase(),xe))})}function o(){P.on("connect_failed",function(){Y.log("Connection Failed"),qe||(qe=!0,Materialize.toast("Error connecting to server, please wait..",1e8,"red lighten connect_error"))}),P.on("connect_error",function(){Y.log("Connection Failed."),qe||(qe=!0,Materialize.toast("Error connecting to server, please wait..",1e8,"red lighten connect_error"))})}function l(){P.on("np",kt.youtube_listener)}function c(){P.on("get_list",function(){var e="";ie&&(e=j.getCookie("_uI")+"_"),P.emit("list",{channel:e+W.toLowerCase(),pass:Ie?"":j.crypt_pass(j.get_userpass(W.toLowerCase()))})})}function d(){P.on("suggested",function(e){var t=!0;void 0===e.id&&(t=!1),Tt.catchUserSuggests(e,t)})}function p(){P.on("viewers",function(e){pe=e,$("#viewers").html("visibility "+e),void 0!==yt&&kt.getTitle(yt,pe)})}function u(){P.on("toast",O.toast),P.on("pw",O.pw),P.on("conf",O.conf)}function m(){P.on("chat.all",z.allchat),P.on("chat",z.channelchat)}function h(){P.on("channel",J.channel_function)}function f(){Y.log("Setting up playlist_listener"),P.on("playlists",q.frontpage_function)}function y(){P.on("id",U.host_listener)}function v(e){P.on(e,U.host_on_action)}function _(){localStorage.debug=!0}function w(){localStorage.debug=!1}function k(e,t,a,n){return''}function C(e){if($(window).width()>760){var t=$(".brand-logo").outerWidth();e&&(t=.15*$(window).width());var a=$(window).width()-$(".control-list").width()-t-66;title_width=a,$(".title-container").width(title_width)}else $(".title-container").width("100%")}function T(e){for(var t="",a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.-_",n=0;n"+K+"
"),K=K.html()),$("#viewers").addClass("hide"),$("#offline-mode").removeClass("waves-cyan"),$("#offline-mode").addClass("cyan"),$("#offline-mode").tooltip({delay:5,position:"bottom",tooltip:"Disable local mode"}),"/"!=window.location.pathname?($("#controls").on("mouseenter",function(e){$("#seekToDuration").hasClass("hide")&&$("#seekToDuration").removeClass("hide")}),$("#controls").on("mouseleave",function(e){me=!1,$("#seekToDuration").hasClass("hide")||$("#seekToDuration").addClass("hide")}),$("#controls").on("mousedown",function(e){["bar","controls","duration"].indexOf($(e.target).attr("id"))>=0&&(me=!0)}),$("#controls").on("mouseup",function(e){me=!1}),$("#controls").on("mousemove",E),$("#controls").on("click",L),$("#main_components").append("
00:00/01:00
"),Y.mobilecheck()?Y.mobilecheck()&&$("#seekToDuration").css("top",$("#controls").position().top-20):$("#seekToDuration").css("top",$("#controls").position().top-55),$("#controls").hasClass("ewresize")||$("#controls").addClass("ewresize")):($("#controls").off("mouseenter"),$("#controls").off("mouseleave"),$("#controls").off("mousemove"),$("#controls").off("click")),void 0!=dt&&!t){for(var a=0;a"+K+"
"),K=K.html()),$("#viewers").removeClass("hide"),$("#offline-mode").addClass("waves-cyan"),$("#offline-mode").removeClass("cyan"),$("#offline-mode").tooltip({delay:5,position:"bottom",tooltip:"Enable local mode"}),$("#controls").off("mouseleave"),$("#controls").off("mouseenter"),$("#controls").off("mousedown"),$("#controls").off("mouseup"),$("#controls").off("mousemove",E),$("#controls").off("click",L),$("#seekToDuration").remove(),"/"!=window.location.pathname){P.emit("pos",{channel:W.toLowerCase(),pass:Ie?"":j.crypt_pass(j.get_userpass(W.toLowerCase()))});var n="";ie&&(n=j.getCookie("_uI")+"_"),P.emit("list",{channel:n+W.toLowerCase(),pass:Ie?"":j.crypt_pass(j.get_userpass(W.toLowerCase()))}),$("#controls").hasClass("ewresize")&&$("#controls").removeClass("ewresize")}}function I(e){e?(Y.log("------------------------"),Y.log("Spotify is authenticated"),Y.log("access_token: "+De.access_token),Y.log("token_type:"+De.token_type),Y.log("expires_in: "+De.expires_in),Y.log("------------------------"),$(".spotify_authenticated").css("display","block"),$(".spotify_unauthenticated").css("display","none")):(Y.log("----------------------------"),Y.log("Spotify is not authenticated"),Y.log("----------------------------"),$(".spotify_authenticated").css("display","none"),$(".spotify_unauthenticated").css("display","block"))}function E(e){var t=e.clientX-Math.ceil($("#seekToDuration").width()/2)-8;t<0?t=0:t+$("#seekToDuration").width()>$("#controls").width()&&(t=$("#controls").width()-$("#seekToDuration").width()),$("#seekToDuration").css("left",t);try{var a=dt[dt.length-1].duration/$("#controls").width();a*=e.clientX;var n=Y.secondsToOther(a),s=Y.pad(n[0]),i=Y.pad(Math.ceil(n[1]));$("#seekToDuration").text(s+":"+i);["bar","controls","duration"].indexOf($(e.target).attr("id"))>=0&&me&&$("#bar").width(100/kt.player.getDuration()*a+"%")}catch(e){}}function L(e){if(["bar","controls","duration"].indexOf($(e.target).attr("id"))>=0){var t=dt[dt.length-1].duration/$("#controls").width();t*=e.clientX,Y.log(t),Fe?H.sendMessage("urn:x-cast:zoff.me",{type:"seekTo",seekTo:t}):(kt.player.seekTo(t),dMinutes=Math.floor(duration/60),dSeconds=duration-60*dMinutes,currDurr=t,currDurr>duration&&(currDurr=duration),minutes=Math.floor(currDurr/60),seconds=currDurr-60*minutes,document.getElementById("duration").innerHTML=Y.pad(minutes)+":"+Y.pad(seconds)+" / "+Y.pad(dMinutes)+":"+Y.pad(dSeconds),per=100/duration*currDurr,per>=100?per=100:0===duration&&(per=0),$("#bar").width(per+"%"))}}function B(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&&27!=code&&(clearTimeout(rt),search_input.length<3&&$("#results").html(""),13==code?xt.search(search_input):rt=setTimeout(function(){xt.search(search_input)},1e3))}function M(){$("#facebook-code-link").attr("href","https://www.facebook.com/sharer/sharer.php?u=https://zoff.me/"+W.toLowerCase()),$("#facebook-code-link").attr("onclick","window.open('https://www.facebook.com/sharer/sharer.php?u=https://zoff.me/"+W.toLowerCase()+"', 'Share Playlist','width=600,height=300'); return false;"),$("#twitter-code-link").attr("href","https://twitter.com/intent/tweet?url=https://zoff.me/"+W.toLowerCase()+"&text=Check%20out%20this%20playlist%20"+W.toLowerCase()+"%20on%20Zoff!&via=zoffmusic"),$("#twitter-code-link").attr("onclick","window.open('https://twitter.com/intent/tweet?url=https://zoff.me/"+W.toLowerCase()+"/&text=Check%20out%20this%20playlist%20"+W.toLowerCase()+"%20on%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/"+W.toLowerCase()+"&choe=UTF-8&chld=L%7C1")}function A(){$("#toast-container").remove()}function N(){var e=window.location.href.split("/");if("#!"==e[3].substr(0,1)||""===e[3]||5==e.length&&"#"==e[4].substr(0,1))""===e[3]&&($.contextMenu("destroy",".playlist-element"),ye=!1,clearTimeout(F),ke&&(ke=!1,kt.fireplace.destroy(),$("#fireplace_player").css("display","none")),$("#channel-load").css("display","block"),window.scrollTo(0,0),kt.stopInterval=!0,O.display_logged_out(),O.beginning=!0,Ce=!1,Le=!1,$("#embed-button").css("display","none"),$(".castButton").tooltip("remove"),$("#viewers").tooltip("remove"),$("#offline-mode").tooltip("remove"),$("#chan_thumbnail").tooltip("remove"),$("#fullscreen").tooltip("remove"),$("#admin-lock").tooltip("remove"),$("#seekToDuration").remove(),$(".tap-target").tapTarget("close"),clearTimeout(G),$.ajax({url:"/",success:function(e){if(Y.mobilecheck()||fe?(Y.log("Removing all listeners"),P.removeAllListeners(),P.disconnect()):(P.removeEventListener("chat.all"),P.removeEventListener("chat"),P.removeEventListener("conf"),P.removeEventListener("pw"),P.removeEventListener("toast"),P.removeEventListener("channel")),document.getElementById("volume-button").removeEventListener("click",Ct.mute_video),document.getElementById("playpause").removeEventListener("click",Ct.play_pause),document.getElementById("fullscreen").removeEventListener("click",Ct.fullscreen),(Y.mobilecheck()||fe)&&(mt="",yt=""),$("meta[name=theme-color]").attr("content","#2D2D2D"),Y.mobilecheck()||fe){try{kt.player.destroy()}catch(e){}kt.player="",document.title="Zoff"}else $(".video-container").resizable("destroy"),$("main").append("X"),$("#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"),$("#main-container").removeClass("channelpage"),$("#main-container").attr("style",""),$("header").html($(a.find("header")).html()),$($(a.find(".section.mega"))).insertAfter("header"),$($(a.find(".section.mobile-search"))).insertAfter(".mega"),Y.mobilecheck()||fe?$("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","/assets/images/favicon.png"),$(".context-menu-list").remove(),Y.log(P),1==$("#alreadyfp").length?t():(wt=!0,R=!0,t()),0!==$("#alreadychannel").length||fe?fe&&$("#alreadychannel").remove():$("head").append("
"),void 0!=e.description&&""!=e.description&&$("#description_area").html(e.description)},submitAdmin:function(e,t){voting=e.vote.checked,addsongs=e.addsongs.checked,longsongs=e.longsongs.checked,R=e.frontpage.checked,allvideos=e.allvideos.checked,removeplay=e.removeplay.checked,skipping=e.skip.checked,shuffling=e.shuffle.checked;var a=""==xe?xe:CryptoJS.SHA256(xe).toString();configs={channel:W.toLowerCase(),voting:voting,addsongs:addsongs,longsongs:longsongs,frontpage:R,allvideos:allvideos,removeplay:removeplay,adminpass:""==le?"":j.crypt_pass(le),skipping:skipping,shuffling:shuffling,userpass:j.crypt_pass(a),userpass_changed:t},j.set_userpass(W.toLowerCase(),CryptoJS.SHA256(xe).toString()),P.emit("conf",configs)},hide_settings:function(){$("#settings").sideNav("hide")},shuffle:function(){if(We){for(var e=0;e to change name","/removename to remove name"],namechange:function(e){P.emit("namechange",e),j.set_name(e)},removename:function(){P.emit("removename"),j.remove_name()},chat:function(e){if(!(e.value.length>150)){if(e.value.startsWith("/name "))z.namechange(e.value.substring(6));else if(e.value.startsWith("/help"))if("#all_chat"==$(".chat-tab-li a.active").attr("href")){$("#chatall").children().length>100&&$("#chatall").children()[0].remove();for(var t=0;tSystem: ");var s=document.createTextNode(z.chat_help[t]);$("#chatall li:last")[0].appendChild(s),document.getElementById("chatall").scrollTop=document.getElementById("chatall").scrollHeight}}else{$("#chatchannel").children().length>100&&$("#chatchannel").children()[0].remove();for(var t=0;tSystem: ");var s=document.createTextNode(z.chat_help[t]);$("#chatchannel li:last")[0].appendChild(s),document.getElementById("chatchannel").scrollTop=document.getElementById("chatchannel").scrollHeight}}else e.value.startsWith("/removename")?z.removename():"#all_chat"==$(".chat-tab-li a.active").attr("href")?P.emit("all,chat",e.value):P.emit("chat",{channel:W.toLowerCase(),data:e.value,pass:Ie?"":j.crypt_pass(j.get_userpass(W.toLowerCase()))});e.value=""}},allchat:function(e){if(":"==e.msg.substring(0,1)&&!Be){z.all_received+=1,$("#favicon").attr("href","/assets/images/highlogo.png"),ee=!0,Me=!0,$(".chat-link span.badge.new.white").hasClass("hide")&&$(".chat-link span.badge.new.white").removeClass("hide");var t=z.channel_received+z.all_received>9?"9+":z.channel_received+z.all_received;$(".chat-link span.badge.new.white").html(t)}document.hidden&&$("#favicon").attr("href","/assets/images/highlogo.png"),$("#chatall").children().length>100&&$("#chatall").children()[0].remove();var a=Y.intToARGB(Y.hashCode(e.from));if(a.length<6)for(x=a.length;x<6;x++)a="0"+a;a=Y.hexToRgb(a.substring(0,6));var n=Y.rgbToHsl([a.r,a.g,a.b],!1);$("#chatall").append("
  • "+e.from+"
  • ");var s=document.createTextNode(e.msg);$("#chatall li:last")[0].appendChild(s),document.getElementById("chatall").scrollTop=document.getElementById("chatall").scrollHeight},channelchat:function(e){if(":"==e.msg.substring(0,1)&&!Be){$("#favicon").attr("href","/assets/images/highlogo.png"),ee=!0,Me=!0,z.channel_received+=1,$(".chat-link span.badge.new.white").hasClass("hide")&&$(".chat-link span.badge.new.white").removeClass("hide");var t=z.channel_received+z.all_received>9?"9+":z.channel_received+z.all_received;$(".chat-link span.badge.new.white").html(t)}$("#chatchannel").children().length>100&&$("#chatchannel").children()[0].remove();var a=Y.intToARGB(Y.hashCode(e.from));if(a.length<6)for(x=a.length;x<6;x++)a="0"+a;a=Y.hexToRgb(a.substring(0,6));var n=Y.rgbToHsl([a.r,a.g,a.b],!1);$("#chatchannel").append("
  • "+e.from+"
  • ");var s=document.createTextNode(e.msg);$("#chatchannel li:last")[0].appendChild(s),document.getElementById("chatchannel").scrollTop=document.getElementById("chatchannel").scrollHeight},chat_blink:function(){Ae=!0,$(".chat-link").attr("style","color: grey !important;"),setTimeout(function(){$(".chat-link").attr("style","color: white !important;"),setTimeout(function(){Ae&&z.chat_blink()},1e3)},1e3)}},j={conf_pass:void 0,user_pass:void 0,tmp_pass:"",init:function(){"/"!=window.location.pathname&&("https:"!=location.protocol?document.cookie=W.toLowerCase()+"=;path=/"+W.toLowerCase()+";expires="+new Date(0).toUTCString():document.cookie=W.toLowerCase()+"=;path=/"+W.toLowerCase()+";secure;expires="+new Date(0).toUTCString());try{conf_arr=j.decrypt(j.getCookie("_opt"),"_opt")}catch(e){conf_arr=j.decrypt(j.create_cookie("_opt"),"_opt")}if("/"!=window.location.pathname){try{j.conf_pass=j.decrypt(j.getCookie(W.toLowerCase()),W.toLowerCase())}catch(e){j.conf_pass=j.decrypt(j.create_cookie(W.toLowerCase()),W.toLowerCase())}U.change_enabled(conf_arr.remote),100!=conf_arr.width&&kt.set_width(conf_arr.width),void 0!==conf_arr.name&&""!==conf_arr.name&&z.namechange(conf_arr.name)}},decrypt:function(e,t){void 0===j.getCookie(t)&&(e=j.create_cookie(t));var a=btoa("0103060703080703080701")+btoa("0103060703080703080701");a=a.substring(0,32),a=btoa(a);var n=CryptoJS.AES.decrypt(e,a,{mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7});return $.parseJSON(n.toString(CryptoJS.enc.Utf8))},decrypt_pass:function(e){var t=btoa(P.id)+btoa(P.id);return t=t.substring(0,32),t=btoa(t),CryptoJS.AES.decrypt(e,t,{mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7}).toString(CryptoJS.enc.Utf8)},encrypt:function(e,t){var a=JSON.stringify(e),n=btoa("0103060703080703080701")+btoa("0103060703080703080701");n=n.substring(0,32),n=btoa(n);var s=CryptoJS.AES.encrypt(a,n,{mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7}),i=new Date;i.setFullYear(i.getFullYear()+1),"https:"!=location.protocol?document.cookie=t+"="+s.toString()+";expires="+i.toGMTString()+";path=/;":document.cookie=t+"="+s.toString()+";secure;expires="+i.toGMTString()+";path=/;"},get_volume:function(){return j.decrypt(j.getCookie("_opt"),"_opt").volume},get_offline:function(){return void 0!=j.decrypt(j.getCookie("_opt"),"_opt").offline?j.decrypt(j.getCookie("_opt"),"_opt").offline:(j.set_offline(!1),!1)},set_volume:function(e){conf_arr.volume=e,j.encrypt(conf_arr,"_opt")},create_cookie:function(e){cookie_object="_opt"==e?{volume:100,width:100,remote:!0,name:"",offline:!1}:{passwords:{}};var t=JSON.stringify(cookie_object),a=btoa("0103060703080703080701")+btoa("0103060703080703080701");a=a.substring(0,32),a=btoa(a);var n=CryptoJS.AES.encrypt(t,a,{mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7}),s=new Date;return s.setFullYear(s.getFullYear()+1),"https:"!=location.protocol?document.cookie=e+"="+n.toString()+";expires="+s.toGMTString()+";path=/;":document.cookie=e+"="+n.toString()+";secure;expires="+s.toGMTString()+";path=/;",j.getCookie(e)},set_pass:function(e,t){j.conf_pass.passwords[e]=t,j.encrypt(j.conf_pass,e)},remove_pass:function(e){delete j.conf_pass.passwords[e],j.encrypt(j.conf_pass,e.toLowerCase())},set_userpass:function(e,t){j.conf_pass.passwords.userpass=t,j.encrypt(j.conf_pass,e)},remove_userpass:function(e){delete j.conf_pass.passwords.userpass,j.encrypt(j.conf_pass,e.toLowerCase())},set_name:function(e){conf_arr.name=encodeURIComponent(e).replace(/\W/g,""),j.encrypt(conf_arr,"_opt")},set_offline:function(e){conf_arr.offline=e,j.encrypt(conf_arr,"_opt")},remove_name:function(){conf_arr.name="",j.encrypt(conf_arr,"_opt")},get_pass:function(e){if(void 0!==j.conf_pass)return j.conf_pass.passwords[e]},get_userpass:function(e){return void 0!==j.conf_pass?j.conf_pass.passwords.userpass:""},set_remote:function(e){conf_arr.remote=e,j.encrypt(conf_arr,"_opt")},get_remote:function(e){return conf_arr.remote},crypt_pass:function(e){j.tmp_pass=e;var t=btoa(P.id)+btoa(P.id);t=t.substring(0,32),t=btoa(t);var a=btoa(j.makeiv()),n=CryptoJS.AES.encrypt(e,CryptoJS.enc.Base64.parse(t),{mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7,iv:CryptoJS.enc.Base64.parse(a)});return window.encrypted=n,n.toString()+"$"+a},makeiv:function(){for(var e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",a=0;a<16;a++)e+=t.charAt(Math.floor(Math.random()*t.length));return e},get_width:function(){return conf_arr.width},set_width:function(e){conf_arr.width=e,j.encrypt(conf_arr,"_opt")},getCookie:function(e){var t="; "+document.cookie,a=t.split("; "+e+"=");if(2==a.length)return a.pop().split(";").shift()}},R=!0,q={blob_list:[],winter:(new Date).getMonth()>=10,times_rotated:0,all_channels:[],frontpage_function:function(e){R=!0,Y.log("-----------"),Y.log("Frontpage fetch"),Y.log(e),Y.log("------------"),q.all_channels=e.channels,q.populate_channels(e.channels,!0),q.set_viewers(e.viewers)},populate_channels:function(e,t){$("#channels").empty();var a,n=0;1==e[0].pinned&&(a=e.shift()),e=t?e.sort(Y.predicate({name:"viewers",reverse:!0},{name:"accessed",reverse:!0},{name:"count",reverse:!0})):e.sort(Y.predicate({name:"viewers",reverse:!0},{name:"count",reverse:!0})),void 0!==a&&e.unshift(a),Y.mobilecheck()||(clearTimeout(V),q.add_backdrop(e,0)),pre_card=$(D),Y.log("------------"),Y.log(pre_card),Y.log("-------------");for(var s in e){var i=e[s].channel;if(n<12||!t){var o=e[s].id,l=e[s].viewers,r=e[s].description,c="background-image:url('https://img.youtube.com/vi/"+o+"/hqdefault.jpg');";e[s].thumbnail&&(c="background-image:url('"+e[s].thumbnail+"');");var d=e[s].count,p=pre_card.clone();1==e[s].pinned?(p.find(".pin").attr("style","display:block;"),p.find(".card").attr("title","Pinned!")):(p.find(".pin").attr("style","display:none;"),p.find(".card").attr("title","")),p.find(".chan-name").text(i),p.find(".chan-name").attr("title",i),p.find(".chan-views").text(l),p.find(".chan-songs").text(d),p.find(".chan-bg").attr("style",c),p.find(".chan-link").attr("href",i+"/"),""==r||Y.mobilecheck()?(p.find(".card-reveal").remove(),p.find(".card").removeClass("sticky-action")):(p.find(".card-title").text(i),p.find(".description_text").text(r),r=""),$("#channels").append(p.html())}n++}var u=e.slice();u=u.sort(q.sortFunction_active);var g={};for(var s in u)g[u[s].channel]=null;var m="input.desktop-search";Y.mobilecheck()&&(m="input.mobile-search"),$(m).autocomplete({data:g,limit:5,onAutocomplete:function(e){q.to_channel(e,!1)}}),document.getElementById("preloader").style.display="none",$("#channels").fadeIn(800),$("#searchFrontpage").focus(),n=0},sortFunction:function(e,t){var a=e.viewers,n=t.viewers,s=e.count,i=t.count;return an?-1:si?-1:0},sortFunction_active:function(e,t){var a=e.accessed,n=t.accessed,s=e.count,i=t.count;return an?-1:si?-1:0},getCookie:function(e){for(var t=e+"=",a=document.cookie.split(";"),n=0;n=e.length||t>=20)&&(t=0);var a=e[t].id;if(void 0!==q.blob_list[t])setTimeout(function(){R&&($("#mega-background").css("background","url(data:image/png;base64,"+q.blob_list[t]+")"),$("#mega-background").css("background-size","200%"),$("#mega-background").css("opacity",1),$(".desktop-search").attr("placeholder",e[t].channel))},500);else{var n=new Image;n.src="/assets/images/thumbnails/"+a+".jpg",n.onerror=function(){$.ajax({type:"POST",data:{id:a},url:"/api/imageblob",success:function(a){setTimeout(function(){$("#mega-background").css("background","url(/assets/images/thumbnails/"+a+")"),$("#mega-background").css("background-size","200%"),$("#mega-background").css("opacity",1),$(".desktop-search").attr("placeholder",e[t].channel)},500)}})},n.onload=function(){$("#mega-background").css("background","url("+n.src+")"),$("#mega-background").css("background-size","200%"),$("#mega-background").css("opacity",1),$(".desktop-search").attr("placeholder",e[t].channel)}}V=setTimeout(function(){50==q.times_rotated&&R?(q.times_rotated=0,t=0,P.emit("frontpage_lists"),P.emit("get_userlists",j.getCookie("_uI"))):R&&(q.times_rotated+=1,q.add_backdrop(e,t+1))},6e3)},start_snowfall:function(){setTimeout(function(){var e=Math.floor(Math.random()*window.innerWidth+1),t=document.createElement("div"),a=document.getElementsByClassName("mega")[0];t.className="snow",t.style.left=e+"px",t.style.top="0px",a.appendChild(t),q.fall_snow(t),q.start_snowfall()},800)},fall_snow:function(e){e.style.top=parseInt(e.style.top.replace("px",""))+2+"px",parseInt(e.style.top.replace("px",""))visibility"+e)},to_channel:function(e,t){$("#channel-load").css("display","block"),window.scrollTo(0,0),R=!1,clearTimeout(V),Y.mobilecheck()&&(Y.log("removing all listeners"),P.removeAllListeners()),$("#main-container").css("background-color","#2d2d2d"),$("#frontpage-viewer-counter").tooltip("remove"),$("#offline-mode").tooltip("remove"),_e=1,$.ajax({url:"/"+e,method:"get",data:{channel:e},success:function(n){""!==kt.player&&P.emit("change_channel",{channel:W.toLowerCase()}),$("#frontpage_player").empty(),Y.mobilecheck()&&(Y.log("disconnecting"),P.disconnect()),t||(window.history.pushState("to the channel!","Title","/"+e),""==Qe&&(Qe=e),""==Ke&&(Ke=e),window.chan=e);var s=$("
    "+n+"
    ");$("select").material_select("destroy"),$(".mega").remove(),$(".mobile-search").remove(),$("main").attr("class","container center-align main"),$("#main-container").addClass("channelpage"),$("header").html($(s.find("header")).html()),0===$("#alreadychannel").length||Y.mobilecheck()||void 0===kt.player?$("main").html($(s.find("main")).html()):($("#main-row").append($(s.find("#playlist").wrap("
    ").parent().html())),$("#video-container").append($(s.find("#main_components").wrap("
    ").parent().html())),$("#main-row").append("
    "),$("#player").removeClass("player_bottom"),$("#main-row").removeClass("frontpage_modified_heights"),$("#main_section_frontpage").remove(),$("#closePlayer").remove(),$("#player_bottom_overlay").remove()),$("#search").attr("placeholder","Find song on YouTube..."),$(".page-footer").addClass("padding-bottom-novideo"),Ne=!0,1==$("#alreadychannel").length?a():($t=!0,a()),0===$("#alreadyfp").length&&$("head").append("
    ")}})}};String.prototype.capitalizeFirstLetter=function(){return this.charAt(0).toUpperCase()+this.slice(1)};var Y={log:function(e){"true"===localStorage.debug&&console.log(e)},rnd:function(e){return e[Math.floor(Math.random()*e.length)]},mobilecheck:function(){var e=!1;return(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|Android|Silk|lge |maemo|midp|mmp|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|phone)|xda|xiino/i.test(navigator.userAgent)||/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(navigator.userAgent.substr(0,4)))&&(e=!0),e},predicate:function(){for(var e,t,a,n=[],s=arguments.length,i=function(e,t){return e===t?0:e>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 e<10?"0"+Math.floor(e):Math.floor(e)},contains:function(e,t){for(var a=e.length;a--;)if(e[a]===t)return!0;return!1},sample:function(){Date.now()-be>=2*we&&(P.removeAllListeners(),P.disconnect(),P.connect(),kt.setup_all_listeners()),be=Date.now(),setTimeout(Y.sample,we)},loadjsfile:function(e){if(-1==ce.indexOf("["+e+"]")){var t=document.createElement("script");t.setAttribute("type","text/javascript"),t.setAttribute("src",e),document.getElementsByTagName("head")[0].appendChild(t),ce+="["+e+"]"}},msieversion:function(){return!!(window.navigator.userAgent.indexOf("MSIE ")>0||navigator.userAgent.match(/Trident.*rv\:11\./))},getRandomInt:function(e,t){return Math.floor(Math.random()*(t-e))+e},secondsToOther:function(e){var t=e,a=Math.floor(t/60);return t-=60*a,[a,t]},rgbToHsl:function(e,t){r=e[0],g=e[1],b=e[2],r/=255,g/=255,b/=255;var a,n,s=Math.max(r,g,b),i=Math.min(r,g,b),o=(s+i)/2;if(s==i)a=n=0;else{var l=s-i;switch(n=o>.5?l/(2-s-i):l/(s+i),s){case r:a=(g-b)/l+(g.5&&t?o=.4:o<.65&&!t&&(o=.65),"hsl("+Math.floor(360*a)+", "+Math.floor(100*n)+"%, "+Math.floor(100*o)+"%)"},componentToHex:function(e){var t=e.toString(16);return 1==t.length?"0"+t:t},rgbToHex:function(e,t,a){return"#"+Y.componentToHex(e)+Y.componentToHex(t)+Y.componentToHex(a)},upperFirst:function(e){return e.substring(0,1).toUpperCase()+e.substring(1).toLowerCase()},addClass:function(e,t){Y.contains($(e).attr("class").split(" "),t)||$(e).addClass(t)},send_mail:function(e,t){""!==e&&""!==t&&($("#submit-contact-form").addClass("hide"),$("#send-loader").removeClass("hide"),$("#contact-form-from").attr("disabled","true"),$("#contact-form-message").attr("disabled","true"),$.ajax({type:"POST",data:{from:e,message:t},url:"/api/mail",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: contact@zoff.no"))}}))}};Element.prototype.remove=function(){this.parentElement.removeChild(this)},NodeList.prototype.remove=HTMLCollection.prototype.remove=function(){for(var e=0,t=this.length;e=J.page&&n div:nth-child("+n+")").after(i);var o=$("#wrapper").children()[n];$(o).css("display",s),"inline-block"==s&&$("#wrapper").children().length>=J.page+J.can_fit+1?$($("#wrapper").children()[J.page+J.can_fit]).css("display","none"):n=0?$($("#wrapper").children()[J.page]).css("display","inline-block"):$("#wrapper").children().length>J.page+J.can_fit&&$($("#wrapper").children()[J.page+J.can_fit-1]).css("display","inline-block"),a&&J.page>0&&$($("#wrapper").children()[J.page-1]).css("display","none"),t&&setTimeout(function(){$(o).css("transform","translateX(0%)"),setTimeout(function(){$(o).removeClass("side_away")},300)},5)}},populate_list:function(e,t){if(Y.mobilecheck()||Ie?Ie?(J.can_fit=Math.round($("#wrapper").height()/91)+1,J.element_height=$("#wrapper").height()/J.can_fit-4):(J.can_fit=Math.round(($(window).height()-$(".tabs").height()-$("header").height()-64-8)/71)+1,J.element_height=($(window).height()-$(".tabs").height()-$("header").height()-64-8)/J.can_fit-5):(J.can_fit=Math.round($("#wrapper").height()/71)+1,J.element_height=$("#wrapper").height()/J.can_fit-5.3),J.element_height<55.2&&(J.element_height=55.2),void 0===K&&(K=$("#list-song-html").html()),dt=e,We&&!t)for(var a=0;a1?($.each(dt,function(e,t){if(!t.now_playing){var a=J.generateSong(t,!1,Se,!0,!1,"",!0);$("#wrapper").append(a)}}),$("#wrapper").children().length>J.can_fit&&!$("#pageButtons").length?($('
    first_pagefirst_pagenavigate_before prevnavigate_before prev 1 next navigate_nextnext navigate_nextlast_pagelast_page
    ').insertAfter("#wrapper"),$(".prev_page").css("display","none"),$(".first_page").css("display","none"),$(".next_page_hide").css("display","none"),$(".last_page_hide").css("display","none")):$("#pageButtons").length||($('
    first_pagefirst_pagenavigate_before prevnavigate_before prev 1 next navigate_nextnext navigate_nextlast_pagelast_page
    ').insertAfter("#wrapper"),$(".prev_page").css("display","none"),$(".next_page").css("display","none"),$(".last_page").css("display","none"),$(".first_page").css("display","none"),$(".next_page_hide").css("display","inline-flex"),$(".prev_page_hide").css("display","inline-flex")),J.dynamicContentPage(-10)):(J.empty=!0,$("#wrapper").html("The playlist is empty."),$("#pageButtons").length||$('
    first_pagefirst_pagenavigate_before prevnavigate_before prev 1 next navigate_nextnext navigate_nextlast_pagelast_page
    ').insertAfter("#wrapper"),$(".prev_page").css("display","none"),$(".next_page").css("display","none"),$(".last_page").css("display","none"),$(".last_page_hide").css("display","inline-flex"),$(".first_page").css("display","none"),$(".next_page_hide").css("display","inline-flex"),$(".prev_page_hide").css("display","inline-flex")),$("#settings").css("visibility","visible"),$("#settings").css("opacity","1"),$("#wrapper").css("opacity","1")},dynamicContentPageJumpTo:function(e){((e*=J.can_fit)>J.page||e0&&"none"==$(".prev_page").css("display")&&($(".prev_page").css("display","inline-flex"),$(".prev_page_hide").css("display","none"),$(".first_page").css("display","inline-flex"),$(".first_page_hide").css("display","none")),J.page+J.can_fit>=$("#wrapper").children().length&&($(".next_page_hide").css("display","inline-flex"),$(".next_page").css("display","none"),$(".last_page_hide").css("display","inline-flex"),$(".last_page").css("display","none")),$("#pageNumber").html(J.page/J.can_fit+1))},dynamicContentPage:function(e){1==e?($("#wrapper").children().slice(J.page,J.page+J.can_fit).hide(),J.page=J.page+J.can_fit,$("#wrapper").children().slice(J.page,J.page+J.can_fit).css("display","inline-block"),J.page>0&&"none"==$(".prev_page").css("display")&&($(".prev_page").css("display","inline-flex"),$(".prev_page_hide").css("display","none"),$(".first_page").css("display","inline-flex"),$(".first_page_hide").css("display","none")),J.page+J.can_fit>=$("#wrapper").children().length&&($(".next_page_hide").css("display","inline-flex"),$(".next_page").css("display","none"),$(".last_page_hide").css("display","inline-flex"),$(".last_page").css("display","none"))):10==e?($("#wrapper").children().slice(J.page,J.page+J.can_fit).hide(),J.page=Math.floor(($("#wrapper").children().length-1)/J.can_fit)*J.can_fit,$("#wrapper").children().slice(J.page,J.page+J.can_fit).css("display","inline-block"),J.page>0&&"none"==$(".prev_page").css("display")&&($(".prev_page").css("display","inline-flex"),$(".prev_page_hide").css("display","none"),$(".first_page").css("display","inline-flex"),$(".first_page_hide").css("display","none")),J.page+J.can_fit>=$("#wrapper").children().length&&($(".next_page_hide").css("display","inline-flex"),$(".next_page").css("display","none"),$(".last_page_hide").css("display","inline-flex"),$(".last_page").css("display","none"))):-10==e?($("#wrapper").children().slice(J.page,J.page+J.can_fit).hide(),J.page=0,$("#wrapper").children().slice(J.page,J.page+J.can_fit).css("display","inline-block"),0==J.page&&"none"!=$(".prev_page").css("display")?($(".prev_page").css("display","none"),$(".prev_page_hide").css("display","inline-flex"),$(".first_page").css("display","none"),$(".first_page_hide").css("display","inline-flex")):"none"==$(".prev_page").css("display")?($(".prev_page_hide").css("display","inline-flex"),$(".first_page_hide").css("display","inline-flex")):($(".prev_page_hide").css("display","none"),$(".first_page_hide").css("display","none")),J.page+J.can_fit<$("#wrapper").children().length&&($(".next_page_hide").css("display","none"),$(".next_page").css("display","inline-flex"),$(".last_page_hide").css("display","none"),$(".last_page").css("display","inline-flex"))):($("#wrapper").children().slice(J.page-J.can_fit,J.page).css("display","inline-block"),$("#wrapper").children().slice(J.page,J.page+J.can_fit).hide(),J.page=J.page-J.can_fit<0?0:J.page-J.can_fit,0==J.page&&"none"!=$(".prev_page").css("display")?($(".prev_page").css("display","none"),$(".prev_page_hide").css("display","inline-flex"),$(".first_page").css("display","none"),$(".first_page_hide").css("display","inline-flex")):"none"==$(".prev_page").css("display")?($(".prev_page_hide").css("display","inline-flex"),$(".first_page_hide").css("display","inline-flex")):($(".prev_page_hide").css("display","none"),$(".first_page_hide").css("display","none")),J.page+J.can_fit<$("#wrapper").children().length&&($(".next_page_hide").css("display","none"),$(".next_page").css("display","inline-flex"),$(".last_page_hide").css("display","none"),$(".last_page").css("display","inline-flex"))),$("#pageNumber").html(J.page/J.can_fit+1)},added_song:function(e){var t;if(void 0!=e){if(0!==dt.length&&(t=dt.pop()),dt.push(e),J.sortList(),t&&dt.push(t),$("#suggested-"+e.id).length>0){Xe-=1,Xe<0&&(Xe=0);var a=Xe>9?"9+":Xe;$(".suggested-link span.badge.new.white").hasClass("hide")||0!=a||$(".suggested-link span.badge.new.white").addClass("hide"),$(".suggested-link span.badge.new.white").text(a)}$("#suggested-"+e.id).remove(),J.empty&&(J.empty=!1),$("#empty-channel-message").remove(),J.insertAtIndex(e,!0),$($("#wrapper").children()[J.page+J.can_fit]).css("display","none"),$("#wrapper").children().length>J.page+J.can_fit?($(".next_page_hide").css("display","none"),$(".next_page").removeClass("hide"),$(".last_page_hide").css("display","none"),$(".next_page").css("display","inline-flex"),$(".last_page").css("display","inline-flex")):($(".next_page_hide").css("display","inline-flex"),$(".next_page").css("display","none"))}},deleted_song:function(e,t){try{var a=J.getIndexOfSong(e);$("#wrapper").children()[a];a=0?($($("#wrapper").children()[J.page]).css("height",0),$($("#wrapper").children()[J.page]).css("display","inline-block"),$($("#wrapper").children()[J.page]).css("height",J.element_height)):$("#wrapper").children().length>J.page+J.can_fit&&($($("#wrapper").children()[J.page+J.can_fit]).css("height",0),$($("#wrapper").children()[J.page+J.can_fit]).css("display","inline-block"),$($("#wrapper").children()[J.page+J.can_fit]).css("height",J.element_height)),J.page>=$("#wrapper").children().length-1?(J.dynamicContentPage(-1),$(".next_page_hide").css("display","inline-flex"),$(".next_page").css("display","none"),$(".last_page_hide").css("display","inline-flex"),$(".last_page").css("display","none")):J.page+J.can_fit+1>=$("#wrapper").children().length-1&&($(".next_page_hide").css("display","inline-flex"),$(".next_page").css("display","none"),$(".last_page_hide").css("display","inline-flex"),$(".last_page").css("display","none")),J.page<=a&&J.page-J.can_fit<=a?($("#"+e).addClass("side_away"),$("#"+e).css("transform","translateX(-100%)"),setTimeout(function(){$("#"+e).remove()},300)):$("#"+e).remove(),dt.splice(J.getIndexOfSong(e),1),kt.sendNext({title:dt[0].title,videoId:dt[0].id})}catch(t){dt.splice(J.getIndexOfSong(e),1),J.empty||($("#"+e).remove(),a=0?$($("#wrapper").children()[J.page-1]).css("display","inline-block"):$("#wrapper").children().length>J.page+J.can_fit&&$($("#wrapper").children()[J.page+(J.can_fit-1)]).css("display","inline-block"),kt.sendNext({title:dt[0].title,videoId:dt[0].id}))}dt.length<=2&&(J.empty=!0,$("#wrapper").html("The playlist is empty.")),$("#suggested-"+e).remove(),J.page,J.can_fit,$("#wrapper").children().length,J.page>=$("#wrapper").children().length&&J.dynamicContentPage(-1),Tt.checkUserEmpty()},voted_song:function(e,t){var a=J.getIndexOfSong(e),n=dt[a];dt[a].votes+=1,dt[a].added=t,J.sortList(),$("#"+e).remove(),J.insertAtIndex(n,!1)},song_change:function(e,t){try{var a=dt.length-1;$("#wrapper").children()[0].remove(),0===$("#wrapper").children().length&&(J.empty=!0,$("#wrapper").html("The playlist is empty.")),dt[0].now_playing=!0,dt[0].votes=0,dt[0].guids=[],dt[0].added=e,t?delete dt[a]:dt[a].now_playing=!1,Y.log("---------------------------"),Y.log("---SONG ON FIRST INDEX-----"),Y.log(dt[0]),Y.log("---------------------------"),dt.push(dt.shift()),t||J.insertAtIndex(dt[a-1],!1,!0)}catch(e){}},vote:function(e,t){return!We||"del"==t&&X&&!Z&&""!=le?P.emit("vote",{channel:W,id:e,type:t,adminpass:""==le?"":j.crypt_pass(le),pass:Ie?"":j.crypt_pass(j.get_userpass(W.toLowerCase()))}):"pos"==t?J.voted_song(e,(new Date).getTime()/1e3):J.deleted_song(e),!0},skip:function(){return We?kt.playNext():P.emit("skip",{pass:""==le?"":j.crypt_pass(le),id:mt,channel:W.toLowerCase(),userpass:Ie?"":j.crypt_pass(j.get_userpass(W.toLowerCase()))}),!0},exportToSpotify:function(){$.ajax({type:"GET",url:"https://api.spotify.com/v1/me",headers:{Authorization:"Bearer "+De.access_token},success:function(e){var t=e.id;$("#playlist_loader_export").removeClass("hide"),$(".exported-list-container").removeClass("hide"),$.ajax({type:"POST",url:"https://api.spotify.com/v1/users/"+t+"/playlists",headers:{Authorization:"Bearer "+De.access_token,"Content-Type":"application/json"},data:JSON.stringify({name:W.toLowerCase()+" - Zoff",public:!0}),success:function(e){var a=e.id;$.each(dt,function(e,n){J.searchSpotify(n,a,t)})}})}})},searchSpotify:function(e,t,a){var n=e.title,s=e.title.toLowerCase().replace("-"," ");s.startsWith("the")&&(s=s.replace("the","")),s=s.replace(" hd",""),s=s.replace("official hd video",""),s=s.replace("unofficial video",""),s=s.replace("studio footage",""),s=s.replace("great song",""),s=s.replace("-"," "),s=s.replace("-"," "),s=s.replace(" hq"," "),s=s.replace("lyric video",""),s=s.replace("lyrics video",""),s=s.replace("album version",""),s=s.replace("drive original movie soundtrack",""),s=s.replace("original movie soundtrack",""),s=s.replace("live sessions",""),s=s.replace("audio only",""),s=s.replace("audio",""),s=s.replace("(new)",""),s=s.replace(" by "," "),s=s.replace(" vs "," "),s=s.replace("(full)"," "),s=s.replace("(video)"," "),s=s.replace("&"," "),s=s.replace("with lyrics",""),s=s.replace("lyrics",""),s=s.replace("w/",""),s=s.replace("w/",""),s=s.replace("official video",""),s=s.replace("studio version",""),s=s.replace("official music video",""),s=s.replace("music video",""),s=s.replace("musicvideo",""),s=s.replace("original video",""),s=s.replace("full version",""),s=s.replace("full song",""),s=s.replace("(official)",""),s=s.replace("official",""),s=s.replace("(original)",""),s=s.replace("("," "),s=s.replace(")"," "),s=s.replace("|",""),s=s.replace("feat."," "),s=s.replace("feat"," "),s=s.replace("ft."," "),s=s.replace("["," "),s=s.replace("]"," "),s=s.replace(" free ",""),s=s.replace(" hd",""),s=s.replace("original mix"," "),s=s.replace("radio edit"," "),s=s.replace("pop version"," "),s=s.replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," "),s=encodeURIComponent(s),$.ajax({type:"GET",url:"https://api.spotify.com/v1/search?q="+s+"&type=track",headers:{Authorization:"Bearer "+De.access_token},async:!0,statusCode:{429:function(n){console.log(n.getAllResponseHeaders());var s=n.getResponseHeader("Retry-After");console.log(s),s||(s=5),s=parseInt(s,10),Y.log("Retry-After",s),setTimeout(function(){J.searchSpotify(e,t,a)},1e3*s)}},error:function(n){if(429==n.status){console.log(n.getAllResponseHeaders());var s=n.getResponseHeader("Retry-After");console.log(s),s||(s=5),s=parseInt(s,10),Y.log("Retry-After",s),setTimeout(function(){J.searchSpotify(e,t,a)},1e3*s)}},success:function(e){var i=!1;if($.each(e.tracks.items,function(e,t){if(t.name=t.name.toLowerCase(),t.name=t.name.replace("("," "),t.name=t.name.replace(")"," "),t.name=t.name.replace("["," "),t.name=t.name.replace("]"," "),t.name=t.name.replace("-"," "),t.name=t.name.replace("-"," "),t.name=t.name.replace("-"," "),t.name=t.name.replace("original mix"," "),t.name=t.name.replace("album version"," "),t.name=t.name.replace("abum version"," "),t.name=t.name.replace("feat."," "),t.artists[0].name=t.artists[0].name.replace("feat."," "),t.artists[0].name=t.artists[0].name.replace("feat"," "),t.name=t.name.replace("feat"," "),t.name=t.name.replace("ft."," "),t.name=t.name.replace("radio edit"," "),t.name=t.name.replace("pop version"," "),t.name=t.name.replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," "),t.artists[0].name=t.artists[0].name.replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ")," "==t.name.substring(t.name.length-1)&&(t.name=t.name.substring(0,t.name.length-1)),"."==t.name.substring(t.name.length-1)&&"."!=s.substring(s.length-1)&&(t.name=t.name.substring(0,t.name.length-1)),decodeURIComponent(s).indexOf(t.artists[0].name.toLowerCase())>=0&&decodeURIComponent(s).indexOf(t.name.toLowerCase())>=0)return i=!0,J.uris.push(t.uri),Y.log("Found",s),!1;for(var a=t.name.split(" "),e=0;e=0||"&"==a[e]&&s.indexOf("and")>=0)&&s.indexOf(a[e])<0)return!0;return i=!0,J.uris.push(t.uri),Y.log("Found",s),!1}),i||(J.not_found.push(n),J.num_songs=J.num_songs+1,Y.log("Didn't find",n)),J.num_songs+J.uris.length==dt.length){if(J.uris.length>100){for(;J.uris.length>100;)J.addToSpotifyPlaylist(J.uris.slice(0,100),t,a),J.uris=J.uris.slice(100,J.uris.length);J.addToSpotifyPlaylist(J.uris,t,a),$("#playlist_loader_export").addClass("hide")}else J.addToSpotifyPlaylist(J.uris,t,a),$("#playlist_loader_export").addClass("hide");0==$(".exported-spotify-list").length&&$(".exported-list").append(""+W+""),$.each(J.not_found,function(e,t){var a=$("
    "+Oe+"
    ");a.find(".extra-add-text").attr("value",t),a.find(".extra-add-text").attr("title",t),$(".not-exported-container").append(a.html())}),$(".not-exported").removeClass("hide"),$(".spotify_export_button").css("display","block")}}})},addToSpotifyPlaylist:function(e,t,a){$.ajax({type:"POST",url:"https://api.spotify.com/v1/users/"+a+"/playlists/"+t+"/tracks",headers:{Authorization:"Bearer "+De.access_token,"Content-Type":"application/json"},data:JSON.stringify({uris:e}),error:function(n){var s=t,i=e,o=a;setTimeout(function(){J.addToSpotifyPlaylist(i,s,o)},3e3)},success:function(e){Y.log("Added songs")}})},exportToYoutube:function(){$(".exported-list-container").removeClass("hide"),$("#playlist_loader_export").removeClass("hide"),$.ajax({type:"POST",url:"https://www.googleapis.com/youtube/v3/playlists?part=snippet",headers:{Authorization:"Bearer "+Ye.access_token,"Content-Type":"application/json"},data:JSON.stringify({snippet:{title:Y.upperFirst(W.toLowerCase()),description:"Playlist exported from zoff"}}),success:function(e){var t=e.id;J.addToYoutubePlaylist(t,dt,0,"https://www.googleapis.com/youtube/v3/playlistItems?part=snippet")},error:function(e){Y.log(e)}})},addToYoutubePlaylist:function(e,t,a,n){var s=JSON.stringify({snippet:{playlistId:e,resourceId:{kind:"youtube#video",videoId:t[a].id}}});$.ajax({type:"POST",url:n,headers:{Authorization:"Bearer "+Ye.access_token,"Content-Type":"application/json"},data:s,success:function(s){Y.log("Added video: "+t[a].id+" to playlist id "+e),a==t.length-1?(Y.log("All videoes added!"),Y.log("url: https://www.youtube.com/playlist?list="+e),$(".exported-list").append(""+W+""),$("#playlist_loader_export").addClass("hide"),$(".current_number").addClass("hide")):($(".current_number").removeClass("hide"),$(".current_number").text(a+1+" of "+t.length),J.addToYoutubePlaylist(e,t,a+1,n))}})},importOldList:function(e){var t="",a=0;playlist_url="lists/"+e+".json",ht=$.parseJSON($.ajax({type:"GET",url:playlist_url,async:!1}).responseText),$.each(ht.songs,function(e,n){t+=n.id+",",a>45&&(xt.addVideos(t),t="",a=0),a++}),xt.addVideos(t),document.getElementById("search").value=""},sortList:function(){dt.sort(Y.predicate({name:"votes",reverse:!0},{name:"added",reverse:!1},{name:"title",reverse:!1}))},show:function(){Y.mobilecheck()||(Q?(Q=!1,$("#toptitle").empty(),$("#chan").addClass("bigChan"),$("#chan").html("zoff.me/"+W.toLowerCase())):(Q=!0,$("#toptitle").html("Zoff"),$("#chan").removeClass("bigChan"),$("#chan").html(W)))},generateSong:function(e,t,a,n,s,i,o){void 0===K&&(K=$("#list-song-html").html());var l,r,c=e.id,d=e.title,p=e.votes,u="background-image:url('//img.youtube.com/vi/"+c+"/mqdefault.jpg');",g=$("
    "+K+"
    "),m="style";if(t&&(g.find(".list-song").css("transform","translateX(100%)"),g.find(".list-song").addClass("side_away")),g.find(".list-song").css("height",J.element_height),Z||g.find(".card-action").removeClass("hide"),1==p&&g.find(".vote-text").text("vote"),a&&(u="//img.youtube.com/vi/"+c+"/mqdefault.jpg",m="data-original"),n){g.find(".list-votes").text(p),g.find("#list-song").attr("data-video-id",c),g.find("#list-song").attr("data-video-type","song"),g.find("#list-song").attr("id",c),g.find(".vote-container").attr("title",d),($("#wrapper").children().length>=J.can_fit&&o||"none"==i)&&g.find(".card").css("display","none"),l=".vote-container",r="delete_button";var h=Y.secondsToOther(e.duration);g.find(".card-duration").text(Y.pad(h[0])+":"+Y.pad(h[1]))}else if(!n){g.find(".suggested_remove").removeClass("hide"),g.find(".vote-text").text(""),g.find(".card-duration").text(Y.pad(e.duration[0])+":"+Y.pad(e.duration[1]));var f="user";l=".add-suggested",s?r="del_user_suggested":(r="del_suggested",f="system"),g.find(".vote-container").attr("class","clickable add-suggested"),g.find(".add-suggested").attr("title",d),g.find(".delete_button").addClass(r),g.find(l).attr("data-video-title",d),g.find(l).attr("data-video-length",e.length),g.find(l).attr("data-added-by",f),g.find("#list-song").attr("data-video-type","suggested"),g.find("#list-song").attr("data-video-id",c),g.find("#list-song").attr("id","suggested-"+c),g.find(".list-image").attr("class",g.find(".list-image").attr("class").replace("list-image","list-suggested-image"))}return g.find(".list-title").text(d),g.find(".list-title").attr("title",d),g.find(l).attr("data-video-id",c),g.find(".list-image").attr(m,u),g.find(".list-suggested-image").attr(m,u),g.find("."+r).attr("data-video-id",c),g.html()},getIndexOfSong:function(e){try{return indexes=$.map(dt,function(t,a){if(t.id==e)return a}),indexes[0]}catch(e){}},scrollTop:function(){$("#wrapper").scrollTop(0)},scrollBottom:function(){$("#wrapper").scrollTop($("#wrapper")[0].scrollHeight)}},W=void 0===window.chan?$("#chan").html():window.chan,Z=!0,X=0,Q=!0,K=$("#list-song-html").html(),ee=!1,te="***REMOVED***",ae=!1,ne=/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)?)?/,se=[],ie=!1,oe=0,R=1,le="",re=!1,ce="",de=!1,pe=1,ue="",ge=!1,me=!1,he=!1,fe=!1,ye=!1,ve=!1,_e=1,$e=!1,we=6e3,be=Date.now(),ke=!1,Ce=!1,xe="",Te=-1,Se=!1,Ie=!1,Ee=!0,Le=!1,Be=!1,Me=!1,Ae=!1,Ne=!1,De={},Pe=!1,Ve="",Oe="",ze=300,je=600,Re="&autoplay",qe=!1,Ye={},He=!1,Fe=!1,Ge="808080",Ue=!1,Je=!1,We=!1,Ze=!1,Xe=0,Qe="",Ke="",et=!1,tt=[],at=0,nt="";if(void 0===localStorage.debug){localStorage.debug=!1}var st,it,ot,lt,rt,ct,dt,se,pt,ut,gt,pe,mt,ht,ft,yt,vt,P,_t={"sync disconnect on unload":!0,secure:!0,"force new connection":!0},$t=!1,wt=!1;try{navigator.serviceWorker.getRegistration("/").then(function(e){e&&e.unregister()})}catch(e){}$.ajaxPrefilter(function(e,t,a){e.async=!0}),$().ready(function(){$t||"/"==window.location.pathname?wt||"/"!=window.location.pathname||t():a(),Y.mobilecheck()&&P.on("guid",function(e){nt=e}),P.on("connect",function(){qe&&(qe=!1,$(".connect_error").fadeOut(function(){$(".connect_error").remove(),Materialize.toast("Connected!",2e3,"green lighten"),We&&P.emit("offline",{status:!0,channel:void 0!=W?W.toLowerCase():""}),void 0!==j.get_pass(W.toLowerCase())&&""!==j.get_pass(W.toLowerCase())&&P.emit("password",{password:j.crypt_pass(j.get_pass(W.toLowerCase())),channel:W.toLowerCase()})}))}),o();try{$.ajax({type:"GET",url:"https://api.github.com/users/zoff-music/received_events",success:function(e){for(var t=0;t"+e[0].created_at.substring(0,10)+": "+e[0].actor.display_login+"
    "+e[0].payload.commits[0].sha.substring(0,10)+": "+e[0].payload.commits[0].message+"J.can_fit||ee&&$($("#wrapper").children()[J.page+e]).css("display","none"),J.can_fit=e,J.element_height=$("#wrapper").height()/J.can_fit-5.3,$(".list-song").css("height",J.element_height+"px"),C(),$("#controls").length>0&&!Y.mobilecheck()?$("#seekToDuration").css("top",$("#controls").position().top-55):$("#controls").length>0&&$("#seekToDuration").css("top",$("#controls").position().top-20)}}),$(document).on("click",".result-object",function(e){var t=$(e.target);if("9?"9+":Xe;$(".suggested-link span.badge.new.white").hasClass("hide")||0!=i||$(".suggested-link span.badge.new.white").addClass("hide"),$(".suggested-link span.badge.new.white").text(i)}$("#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(),(Xe-=1)<0&&(Xe=0);var a=Xe>9?"9+":Xe;$(".suggested-link span.badge.new.white").hasClass("hide")||0!=a||$(".suggested-link span.badge.new.white").addClass("hide"),$(".suggested-link span.badge.new.white").text(a),J.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","/"),N()}),$(document).on("click","#player_bottom_overlay",function(){q.to_channel(W.toLowerCase(),!1)}),$(document).keydown(function(e){if("/"!=window.location.pathname)if(91==e.keyCode||17==e.keyCode)Ue=!0;else if(Ue&&70==e.keyCode)Ue=!1,Je=!Je,e.preventDefault(),Je?($("#find_div").toggleClass("hide"),$("#find_input").focus()):($("#find_div").toggleClass("hide"),$("#find_input").val(""),$("#find_input").blur(),$(".highlight").removeClass("highlight"),tt=[],at=0);else if(32!=e.keyCode||!$(".search-container").hasClass("hide")||"/"==window.location.pathname||$("#text-chat-input").is(":focus")||$("#password").is(":focus")||$("#user-pass-input").is(":focus")||$("#chan_thumbnail").is(":focus")||$("#chan_description").is(":focus")||$("#contact-form-from").is(":focus")||$("#contact-form-message").is(":focus")||$("#remote_channel").is(":focus")||$("#import").is(":focus")||$("#import_spotify").is(":focus"))Ue=!1;else{if(1==kt.player.getPlayerState())return e.preventDefault(),kt.player.pauseVideo(),!1;if(2==kt.player.getPlayerState()||5==kt.player.getPlayerState())return e.preventDefault(),kt.player.playVideo(),!1}}),$(document).keyup(function(e){91!=e.keyCode&&17!=e.keyCode||Je||(Ue=!1)}),$(document).on("submit","#find_form",function(e){if(e.preventDefault(),0==tt.length){var t=this;at=0,tt=$.map(dt,function(e,a){if(e.title.toLowerCase().indexOf(t.find_value.value.toLowerCase())>=0)return a})}else at+=1,tt.length-10&&tt[at]!=dt.length-1){$(".highlight").removeClass("highlight");var a=Math.floor(tt[at]/J.can_fit);$($("#wrapper").children()[tt[at]]).addClass("highlight"),J.dynamicContentPageJumpTo(a)}else Y.log("none found")});var bt={id:"",get_input:function(e){""===bt.id?bt.set_id(e.toLowerCase()):bt.set_channel(e.toLowerCase())},set_id:function(e){bt.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","inline-block"),$(".slider-vol-mobile").attr("style","display: inline-block !important")},set_channel:function(e){P.emit("id",{id:bt.id,type:"channel",value:e})},play_remote:function(){P.emit("id",{id:bt.id,type:"play",value:"mock"})},pause_remote:function(){P.emit("id",{id:bt.id,type:"pause",value:"mock"})},skip_remote:function(){P.emit("id",{id:bt.id,type:"skip",value:"mock"})},initiate_volume:function(){$("#volume-control-remote").slider({min:0,max:100,value:100,range:"min",animate:!0,stop:function(e,t){P.emit("id",{id:bt.id,type:"volume",value:t.value}),Y.log("volume")}})}},kt={loaded:!0,before_load:"",after_load:"",player:"",stopInterval:!1,fireplace:"",youtube_listener:function(e){var t;Ie&&e.np&&window.parentWindow&&window.parentOrigin&&(window.parentWindow.postMessage({type:"np",title:e.np[0].title},window.parentOrigin),dt.length>0&&kt.sendNext({title:dt[0].title,videoId:dt[0].id}));try{t=kt.player.getPlayerState()}catch(e){t=null}if((!We&&(null!=t||Ne)||We&&(null==t||Ne)||!We&&(null==t||Ne)||We&&-1==t)&&(!We||Ke!=W)||We&&void 0==mt){Ke=W,Ne=!1,kt.loaded=!1,Y.log("--------youtube_listener--------"),Y.log("Received: "),Y.log(e),Y.log("paused variable: "+ve),Y.log("mobile_beginning variable: "+lt);try{Y.log("getVideoUrl(): "+kt.player.getVideoUrl().split("v=")[1])}catch(e){}if(Y.log("video_id variable: "+mt),Y.log("---------------------------------"),e.np){if(ve)kt.getTitle(e.np[0].title,pe),Y.mobilecheck()||kt.notifyUser(e.np[0].id,e.np[0].title),Fe||kt.stopVideo(),mt=e.np[0].id,se=e.conf[0],time=e.time,ft=time-se.startTime,yt=e.np[0].title,duration=e.np[0].duration,kt.setBGimage(mt);else if(!ve){void 0===vt?vt=e.np[0].id:vt!=mt&&(vt=mt),mt=e.np[0].id,se=e.conf[0],time=e.time,ft=time-se.startTime,yt=e.np[0].title,duration=e.np[0].duration,lt&&Y.mobilecheck()&&0===ft&&!Fe&&(ft=1);try{dt[0].id!=mt||lt||J.song_change(dt[0].added),Tt.fetchYoutubeSuggests(mt)}catch(e){}if(kt.getTitle(yt,pe),kt.setBGimage(mt),de&&!window.MSStream)try{(kt.player.getVideoUrl().split("v=")[1]!=mt||Fe)&&(kt.loadVideoById(mt,duration),Y.mobilecheck()||kt.notifyUser(mt,yt),kt.seekTo(ft),ve&&!Fe&&kt.pauseVideo()),ve||(lt&&!Fe||kt.playVideo(),Le||kt.durationSetter()),(kt.player.getDuration()>ft||0===kt.player.getDuration()||Fe||kt.player.getCurrentTime()!=ft)&&kt.seekTo(ft),kt.after_load=mt,kt.loaded||setTimeout(function(){kt.loaded=!0},500)}catch(e){Fe&&(kt.loadVideoById(mt,duration),kt.seekTo(ft)),Le||Fe||kt.durationSetter()}else kt.getTitle(yt,pe)}}else{document.getElementById("song-title").innerHTML="Empty channel. Add some songs!",document.title="Zoff - the shared YouTube based radio",window.MSStream||Fe||$("#player_overlay").hasClass("hide")&&$("#player_overlay").removeClass("hide");try{Fe||kt.stopVideo()}catch(e){}}}else Le||kt.durationSetter(),duration=kt.player.getDuration()},onPlayerStateChange:function(e){Y.log("-------onPlayerStateChange------"),Y.log("New state\nState: "),Y.log(e);try{Y.log("Duration: "+kt.player.getDuration(),"Current time: "+kt.player.getCurrentTime()),Y.log("getVideoUrl(): "+kt.player.getVideoUrl().split("v=")[1])}catch(e){}switch(Y.log("video_id variable: "+mt),Y.log("---------------------------------"),e.data){case-1:break;case 0:$e=!1,ve=!1,We?kt.playNext():P.emit("end",{id:mt,channel:W.toLowerCase(),pass:Ie?"":j.crypt_pass(j.get_userpass(W.toLowerCase()))});break;case 1:$e=!0,beginning&&Y.mobilecheck()&&!Fe&&(kt.pauseVideo(),beginning=!1,lt=!1,setTimeout(function(){Y.mobilecheck()&&($("#playpause").css("visibility","visible"),$("#playpause").css("pointer-events","all"),$("#channel-load").css("display","none"))},100)),Ie||"/"==window.location.pathname||Fe||Y.addClass("#player_overlay","hide"),"/"!=window.location.pathname&&(1==document.getElementById("play").className.split(" ").length&&$("#play").toggleClass("hide"),2==document.getElementById("pause").className.split(" ").length&&$("#pause").toggleClass("hide")),ve&&!We&&(P.emit("pos",{channel:W.toLowerCase(),pass:Ie?"":j.crypt_pass(j.get_userpass(W.toLowerCase()))}),ve=!1);break;case 2:Fe||(ve=!0,"/"!=window.location.pathname&&Ct.play_pause_show(),lt=!0)}},playVideo:function(){Fe?(H.sendMessage("urn:x-cast:zoff.me",{type:"playVideo"}),chrome.cast.media.GenericMediaMetadata({metadataType:"GENERIC",title:yt,image:"https://img.youtube.com/vi/"+mt+"/mqdefault.jpg"}),chrome.cast.Image("https://img.youtube.com/vi/"+mt+"/mqdefault.jpg"),$("#pause").hasClass("hide")&&($("#play").toggleClass("hide"),$("#pause").toggleClass("hide"))):kt.player.playVideo()},pauseVideo:function(){Fe?(H.sendMessage("urn:x-cast:zoff.me",{type:"pauseVideo"}),$("#play").hasClass("hide")&&($("#play").toggleClass("hide"),$("#pause").toggleClass("hide"))):kt.player.pauseVideo()},seekTo:function(e){Fe?H.sendMessage("urn:x-cast:zoff.me",{type:"seekTo",seekTo:e}):We?kt.player.seekTo(0):kt.player.seekTo(e)},loadVideoById:function(e,t){Fe?(H.sendMessage("urn:x-cast:zoff.me",{type:"loadVideo",videoId:e}),chrome.cast.media.GenericMediaMetadata({metadataType:"GENERIC",title:yt,image:"https://img.youtube.com/vi/"+e+"/mqdefault.jpg"}),chrome.cast.Image("https://img.youtube.com/vi/"+e+"/mqdefault.jpg")):kt.player.loadVideoById({videoId:e,startSeconds:0,endSeconds:t})},stopVideo:function(){if(Fe)H.sendMessage("urn:x-cast:zoff.me",{type:"stopVideo"});else try{kt.player.stopVideo()}catch(e){}},setVolume:function(e){Fe?H.setVolume(e/100):kt.player.setVolume(e)},playNext:function(){var e=dt[0];mt=e.id,time=(new Date).getTime(),yt=e.title,duration=e.duration,kt.getTitle(yt,pe),kt.setBGimage(mt),Fe?(H.sendMessage("urn:x-cast:zoff.me",{type:"loadVideo",videoId:mt}),chrome.cast.media.GenericMediaMetadata({metadataType:"GENERIC",title:yt,image:"https://img.youtube.com/vi/"+mt+"/mqdefault.jpg"}),chrome.cast.Image("https://img.youtube.com/vi/"+mt+"/mqdefault.jpg")):kt.loadVideoById(mt,duration),J.channel_function({type:"song_change",time:time})},sendNext:function(e){Fe&&H.sendMessage("urn:x-cast:zoff.me",{type:"nextVideo",title:e.title,videoId:e.videoId}),Ie&&window.parentWindow&&window.parentOrigin&&window.parentWindow.postMessage({type:"nextVideo",title:e.title},window.parentOrigin)},getTitle:function(e,t){var a=decodeURIComponent(e);if("/"!=window.location.pathname){var n=document.getElementById("song-title"),s=document.getElementById("viewers");n.innerHTML=a,s.innerHTML="visibility "+t,n.title=a,Fe&&($("#player_overlay").css("background","url(https://img.youtube.com/vi/"+mt+"/hqdefault.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"))}document.title=a+" • Zoff / "+W},errorHandler:function(e){he||(5==e.data||100==e.data||101==e.data||150==e.data?(curr_playing=kt.player.getVideoUrl().replace("https://www.youtube.com/watch?v=",""),P.emit("skip",{error:e.data,id:mt,pass:""==le?"":j.crypt_pass(le),channel:W.toLowerCase(),userpass:Ie?"":j.crypt_pass(j.get_userpass(W.toLowerCase()))})):void 0!==mt&&kt.loadVideoById(mt,duration))},onPlayerReady:function(e){try{beginning=!0,de=!0,window.MSStream||(Y.mobilecheck()?($("#playpause").css("visibility","hidden"),$("#playpause").css("pointer-events","none")):$("#channel-load").css("display","none"),$("#player").css("opacity","1"),$("#controls").css("opacity","1"),$(".playlist").css("opacity","1"),kt.loadVideoById(mt,duration),!Ee||Y.mobilecheck()&&!Fe||kt.playVideo(),Le||kt.durationSetter(),Ie?setTimeout(function(){kt.player.seekTo(ft),Ee||(kt.player.pauseVideo(),Ct.play_pause_show())},1e3):kt.seekTo(ft)),kt.readyLooks(),Ct.initYoutubeControls(kt.player),Ct.initSlider(),kt.player.setVolume(j.get_volume()),$(".video-container").removeClass("no-opacity")}catch(e){}},readyLooks:function(){kt.setBGimage(mt)},setBGimage:function(e){if(void 0!==e&&!Ie){var t=new Image;t.onload=function(){var e=new ColorThief,a=e.getColor(t);"/"!=window.location.pathname&&(document.getElementById("main-container").style.backgroundColor=Y.rgbToHsl(a,!0),$("meta[name=theme-color]").attr("content",Y.rgbToHex(a[0],a[1],a[2])))},t.crossOrigin="Anonymous",t.src="https://zoff.me:8081/https://img.youtube.com/vi/"+e+"/mqdefault.jpg"}},set_width:function(e){if($(".video-container").width(e),!Y.mobilecheck())if($(window).width()>769){var t=$(window).width()-$(".control-list").width()-$(".zbrand").outerWidth()-$(".brand-logo-navigate").outerWidth()-66;title_width=t,$(".title-container").width(title_width)}else $(".title-container").width("100%")},notifyUser:function(e,t){if(t=t.replace(/\\\'/g,"'").replace(/"/g,"'").replace(/&/g,"&"),"granted"===Notification.permission&&document.hidden&&!Ie){var a=new Notification("Now Playing",{body:t,icon:"https://i.ytimg.com/vi/"+e+"/mqdefault.jpg",iconUrl:"http://i.ytimg.com/vi/"+e+"/mqdefault.jpg"});a.onclick=function(e){window.focus(),this.cancel()},setTimeout(function(){a.close()},5e3)}},setup_all_listeners:function(){c(),l(),u(),m(),h()},onYouTubeIframeAPIReady:function(){kt.player=new YT.Player("player",{videoId:mt,playerVars:{rel:"0",wmode:"transparent",controls:"0",fs:"0",iv_load_policy:"3",theme:"light",color:"white",showinfo:0},events:{onReady:kt.onPlayerReady,onStateChange:kt.onPlayerStateChange,onError:kt.errorHandler}})},createFireplacePlayer:function(){kt.fireplace=new YT.Player("fireplace_player",{videoId:"L_LUpnjgPso",playerVars:{rel:"0",wmode:"transparent",controls:"0",fs:"0",iv_load_policy:"3",theme:"light",color:"white",showinfo:0},events:{onReady:kt.onFireplaceReady,onStateChange:kt.onFireplaceChange}})},onFireplaceReady:function(){kt.fireplace.playVideo()},onFireplaceChange:function(e){switch(e.data){case 0:kt.fireplace.seekTo(0),kt.fireplace.playVideo();break;case 2:kt.fireplace.playVideo()}},durationSetter:function(){try{fe||void 0===duration||(kt.stopInterval||(Le=!0),dMinutes=Math.floor(duration/60),dSeconds=duration-60*dMinutes,currDurr=void 0!==kt.player.getCurrentTime()?Math.floor(kt.player.getCurrentTime()):ft,currDurr>duration&&(currDurr=duration),minutes=Math.floor(currDurr/60),seconds=currDurr-60*minutes,document.getElementById("duration").innerHTML=Y.pad(minutes)+":"+Y.pad(seconds)+" / "+Y.pad(dMinutes)+":"+Y.pad(dSeconds),per=100/duration*currDurr,per>=100?per=100:0===duration&&(per=0),Ie&&window.parentWindow&&window.parentOrigin&&window.parentWindow.postMessage({type:"duration",duration:kt.player.getCurrentTime(),full_duration:kt.player.getDuration(),percent:per},window.parentOrigin),me||$("#bar").width(per+"%"))}catch(e){}kt.stopInterval||setTimeout(kt.durationSetter,1e3)},loadPlayer:function(){if(1==$("script[src='https://www.youtube.com/iframe_api']").length)try{kt.onYouTubeIframeAPIReady()}catch(e){console.error("Seems YouTube iFrame script isn't correctly loaded. Please reload the page.")}else pt=document.createElement("script"),pt.src="https://www.youtube.com/iframe_api",ut=document.getElementsByTagName("script")[0],ut.parentNode.insertBefore(pt,ut)}},Ct={stopInterval:!1,initYoutubeControls:function(){Y.mobilecheck()&&!window.MSStream&&$("#controls").appendTo("#playbar"),Ct.initControls()},initControls:function(){document.getElementById("volume-button").addEventListener("click",Ct.mute_video),document.getElementById("playpause").addEventListener("click",Ct.play_pause),document.getElementById("volume-button-overlay").addEventListener("click",Ct.mute_video),document.getElementById("playpause-overlay").addEventListener("click",Ct.play_pause),document.getElementById("fullscreen").addEventListener("click",Ct.fullscreen)},initSlider:function(){try{vol=j.get_volume()}catch(e){}$("#volume").slider({min:0,max:100,value:vol,range:"min",animate:!0,slide:function(e,t){Ct.setVolume(t.value);try{j.set_volume(t.value)}catch(e){}}}),Ct.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(){Fe?Ct.play_pause_show():(console.log(kt.player.getPlayerState()),1==kt.player.getPlayerState()?(kt.pauseVideo(),Y.mobilecheck()&&!window.MSStream&&(document.getElementById("player").style.display="none",$(".video-container").toggleClass("click-through"),$(".page-footer").toggleClass("padding-bottom-extra"))):2!=kt.player.getPlayerState()&&0!==kt.player.getPlayerState()&&5!==kt.player.getPlayerState()||(kt.playVideo(),Y.mobilecheck()&&!window.MSStream&&(document.getElementById("player").style.display="block",$(".video-container").toggleClass("click-through"),$(".page-footer").toggleClass("padding-bottom-extra"))))},play_pause_show:function(){Fe?$("#play").hasClass("hide")?kt.pauseVideo():$("#pause").hasClass("hide")&&kt.playVideo():(1==document.getElementById("pause").className.split(" ").length&&($("#pause").toggleClass("hide"),$("#pause-overlay").toggleClass("hide")),2==document.getElementById("play").className.split(" ").length&&($("#play").toggleClass("hide"),$("#play-overlay").toggleClass("hide")))},settings:function(){$("#qS").toggleClass("hide")},changeQuality:function(e){kt.player.getPlaybackQuality!=e&&(kt.player.setPlaybackQuality(e),kt.player.getPlaybackQuality()),$("#qS").toggleClass("hide")},mute_video:function(){kt.player.isMuted()?(Fe&&H.sendMessage("urn:x-cast:zoff.me",{type:"unMute"}),kt.player.unMute(),Ct.choose_button(kt.player.getVolume(),!1)):(Fe&&H.sendMessage("urn:x-cast:zoff.me",{type:"mute"}),Ct.choose_button(0,!0),kt.player.mute())},setVolume:function(e){kt.setVolume(e),Ct.choose_button(e,!1),kt.player.isMuted()&&kt.player.unMute()},choose_button:function(e,t){t?(1==document.getElementById("v-full").className.split(" ").length&&($("#v-full").toggleClass("hide"),$("#v-full-overlay").toggleClass("hide")),1==document.getElementById("v-medium").className.split(" ").length&&($("#v-medium").toggleClass("hide"),$("#v-medium-overlay").toggleClass("hide")),1==document.getElementById("v-low").className.split(" ").length&&($("#v-low").toggleClass("hide"),$("#v-low-overlay").toggleClass("hide")),2==document.getElementById("v-mute").className.split(" ").length&&($("#v-mute").toggleClass("hide"),$("#v-mute-overlay").toggleClass("hide"))):e>=0&&e<=33?(1==document.getElementById("v-full").className.split(" ").length&&($("#v-full").toggleClass("hide"),$("#v-full-overlay").toggleClass("hide")),1==document.getElementById("v-medium").className.split(" ").length&&($("#v-medium").toggleClass("hide"),$("#v-medium-overlay").toggleClass("hide")),2==document.getElementById("v-low").className.split(" ").length&&($("#v-low").toggleClass("hide"),$("#v-low-overlay").toggleClass("hide")),1==document.getElementById("v-mute").className.split(" ").length&&($("#v-mute").toggleClass("hide"),$("#v-mute-overlay").toggleClass("hide"))):e>=34&&e<=66?(1==document.getElementById("v-full").className.split(" ").length&&($("#v-full").toggleClass("hide"),$("#v-full-overlay").toggleClass("hide")),2==document.getElementById("v-medium").className.split(" ").length&&($("#v-medium").toggleClass("hide"),$("#v-medium-overlay").toggleClass("hide")),1==document.getElementById("v-low").className.split(" ").length&&($("#v-low").toggleClass("hide"),$("#v-low-overlay").toggleClass("hide")),1==document.getElementById("v-mute").className.split(" ").length&&($("#v-mute").toggleClass("hide"),$("#v-mute-overlay").toggleClass("hide"))):e>=67&&e<=100&&(2==document.getElementById("v-full").className.split(" ").length&&($("#v-full").toggleClass("hide"),$("#v-full-overlay").toggleClass("hide")),1==document.getElementById("v-medium").className.split(" ").length&&($("#v-medium").toggleClass("hide"),$("#v-medium-overlay").toggleClass("hide")),1==document.getElementById("v-low").className.split(" ").length&&($("#v-low").toggleClass("hide"),$("#v-low-overlay").toggleClass("hide")),1==document.getElementById("v-mute").className.split(" ").length&&($("#v-mute").toggleClass("hide"),$("#v-mute-overlay").toggleClass("hide")))},playPause:function(){state=kt.player.getPlayerState(),button=document.getElementById("playpause"),1==state?kt.pauseVideo():2==state&&kt.playVideo()},volumeOptions:function(){Fe||(kt.player.isMuted()?(kt.player.unMute(),vol=kt.player.getVolume(),$("#volume").slider("value",kt.player.getVolume())):(kt.player.mute(),$("#volume").slider("value",0)))},hoverMute:function(e){vol=kt.player.getVolume()}},xt={submitArray:[],submitArrayExpected:null,showSearch:function(){$("#search-wrapper").toggleClass("hide"),Y.mobilecheck()&&$(".search_input").focus(),$("#song-title").toggleClass("hide"),$("#results").empty(),"close"==$("#search-btn i").html()?$("#search-btn i").html("search"):$("#search-btn i").html("close"),$("#search").focus()},search:function(e,t,a){if(void 0!==it&&void 0!==ot||(it=$("#temp-results-container"),ot=$("#empty-results-container").html()),$(".search_results").html(""),""!==e){ae=!0;var n=encodeURIComponent(e),s="https://www.googleapis.com/youtube/v3/search?key="+te+"&videoEmbeddable=true&part=id&fields=items(id)&type=video&order=viewCount&safeSearch=none&maxResults=25";s+="&q="+n,oe&&(s+="&videoCategoryId=10");var i="https://www.googleapis.com/youtube/v3/videos?part=contentDetails,snippet,id&key="+te+"&id=";if(a)var s="https://www.googleapis.com/youtube/v3/search?part=snippet&maxResults=25&relatedToVideoId="+n+"&type=video&key="+te,i="https://www.googleapis.com/youtube/v3/videos?part=contentDetails,snippet,id&key="+te+"&id=";Y.contains($(".search_loader_spinner").attr("class").split(" "),"active")||$(".search_loader_spinner").addClass("active"),Y.contains($("#results").attr("class").split(" "),"hide")&&$("#results").removeClass("hide"),$.ajax({type:"GET",url:s,dataType:"jsonp",success:function(a){0===a.items.length?($("").appendTo($("#results")).show("blind",83.33),Y.contains($(".search_loader_spinner").attr("class").split(" "),"active")&&$(".search_loader_spinner").removeClass("active")):a.items&&($.each(a.items,function(e,t){i+=t.id.videoId+","}),$.ajax({type:"GET",url:i,dataType:"jsonp",success:function(a){var n="",s=$(it);$.each(a.items,function(e,t){var a=t.contentDetails.duration;if(secs=xt.durationToSeconds(a),!longsongs||secs<720){gt=t.snippet.title,enc_title=gt,ct=t.id,a=a.replace("PT","").replace("H","h ").replace("M","m ").replace("S","s"),thumb=t.snippet.thumbnails.medium.url;var i=s;i.find(".search-title").text(gt),i.find(".result_info").text(a),i.find(".thumb").attr("src",thumb),i.find("#add-many").attr("data-video-id",ct),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",ct),i.find("#temp-results").attr("data-video-title",enc_title),i.find("#temp-results").attr("data-video-length",secs),i.find(".open-externally").attr("href","https://www.youtube.com/watch?v="+ct),void 0!=i.html()&&(n+=i.html())}}),n.length>0?($("").appendTo($("#results")).show("blind",83.33*(a.items.length-1)),Y.contains($(".search_loader_spinner").attr("class").split(" "),"active")&&$(".search_loader_spinner").removeClass("active"),$(".add-many").click(function(e){return e.preventDefault(),e.stopPropagation(),!1})):t?($("").appendTo($("#results")).show("blind",83.33),Y.contains($(".search_loader_spinner").attr("class").split(" "),"active")&&$(".search_loader_spinner").removeClass("active")):xt.search(e,!0)}}))}})}else $(".main").removeClass("blurT"),$("#controls").removeClass("blurT"),$(".main").removeClass("clickthrough")},backgroundSearch:function(e,t,a,n,s){var i=encodeURIComponent(e+" "+t),o="https://www.googleapis.com/youtube/v3/search?key="+te+"&videoEmbeddable=true&part=id,snippet&fields=items(id,snippet)&type=video&order=relevance&safeSearch=none&maxResults=10&videoCategoryId=10";o+="&q="+i;var l="https://www.googleapis.com/youtube/v3/videos?part=contentDetails,snippet,id&key="+te+"&id=";t=t.split(" ");var r=e.split("-");r=r.join(" ").split(" "),$.ajax({type:"GET",url:o,dataType:"jsonp",success:function(s){if(0===s.items.length){xt.readySubmit(!1,{totalLength:n-1}),Y.log("------------------------------"),Y.log("NO MATCH FOR:"),Y.log("Spotify title: "+e+" "+t.join(" ")),Y.log("Spotify length: "+a),Y.log("------------------------------");var i=$("
    "+Ve+"
    ");i.find(".extra-add-text").text(e+" - "+t.join(" ")),i.find(".extra-add-text").attr("title",e+" - "+t.join(" ")),i.find(".extra-button-search").attr("data-text",e+" - "+t.join(" ")),$(".not-imported-container").append(i.html()),$(".not-imported").removeClass("hide")}else s.items.length>0&&($.each(s.items,function(e,t){l+=t.id.videoId+","}),$.ajax({type:"GET",url:l,dataType:"jsonp",success:function(s){if(s.items.length>0){var i=!1;if($.each(s.items,function(a,s){var o=xt.durationToSeconds(s.contentDetails.duration),l=!1;if($.each(r,function(a,n){return-1!=s.snippet.title.toLowerCase().indexOf(n.toLowerCase())&&-1==s.snippet.title.toLowerCase().indexOf("cover")&&-1==e.toLowerCase().indexOf("cover")&&(-1==s.snippet.title.toLowerCase().indexOf("remix")&&-1==e.toLowerCase().indexOf("remix")||-1!=s.snippet.title.toLowerCase().indexOf("remix")&&-1!=e.toLowerCase().indexOf("remix")||-1!=s.snippet.title.toLowerCase().indexOf(t[0].toLowerCase())||-1!=s.snippet.channelTitle.toLowerCase().indexOf(t[0].toLowerCase())||-1!=s.snippet.channelTitle.toLowerCase().indexOf("vevo"))||(l=!0),!1}),!l)return i=!0,xt.readySubmit(!0,{id:s.id,title:s.snippet.title,duration:o,totalLength:n-1}),!1}),!i){xt.readySubmit(!1,{totalLength:n-1}),Y.log("------------------------------"),Y.log("NO MATCH FOR:"),Y.log("Spotify title: "+e+" "+t.join(" ")),Y.log("Spotify length: "+a),Y.log("------------------------------");var o=$("
    "+Ve+"
    ");o.find(".extra-add-text").text(e+" - "+t.join(" ")),o.find(".extra-add-text").attr("title",e+" - "+t.join(" ")),o.find(".extra-button-search").attr("data-text",e+" - "+t.join(" ")),$(".not-imported-container").append(o.html()),$(".not-imported").removeClass("hide")}}}}))}})},readySubmit:function(e,t){null===xt.submitArrayExpected&&(xt.submitArrayExpected=t.totalLength),e?xt.submitArray.push(t):xt.submitArrayExpected-=1,xt.submitArray.length-1==xt.submitArrayExpected&&($.each(xt.submitArray,function(e,t){xt.submit(t.id,t.title,t.duration,!0,e,xt.submitArray.length-1)}),document.getElementById("import_spotify").disabled=!1,$("#import_spotify").removeClass("hide"),$("#playlist_loader_spotify").addClass("hide"),xt.submitArray=[],xt.submitArrayExpected=null)},submitAndClose:function(e,t,a){xt.submit(e,t,a,!1,0,1),$("#results").html(""),xt.showSearch(),document.getElementById("search").value="",$("#results").html="",$(".main").removeClass("blurT"),$("#controls").removeClass("blurT"),$(".main").removeClass("clickthrough")},importPlaylist:function(e,t){token="";var a,n;void 0!==t&&(token="&pageToken="+t),playlist_url="https://www.googleapis.com/youtube/v3/playlistItems?part=contentDetails&maxResults=49&key="+te+"&playlistId="+e+token,He?(n="html",a={"Content-Type":"application/json",Authorization:"Bearer "+Ye.access_token}):(a={},n="jsonp"),$.ajax({type:"GET",url:playlist_url,dataType:n,headers:a,success:function(a){if(a.error)if("playlistItemsNotAccessible"==a.error.errors[0].reason){var n=T(29);window.callback=function(a){Ye=a,Ye.state==n?(He=!0,setTimeout(function(){He=!1,Ye={}},1e3*Ye.expires_in),xt.importPlaylist(e,t)):(Ye="",console.error("Nonce doesn't match")),youtube_window.close(),window.callback=""},youtube_window=window.open("/o_callback#youtube=true&nonce="+n,"","width=600, height=600")}else Y.log(a.error),document.getElementById("import").disabled=!1,$("#playlist_loader").addClass("hide"),$("#import").removeClass("hide"),A(),Materialize.toast("It seems you've entered a invalid url.",4e3);else{var s="";"string"==typeof a&&(a=$.parseJSON(a)),$.each(a.items,function(e,t){s+=t.contentDetails.videoId+","}),xt.addVideos(s,!0),a.nextPageToken&&xt.importPlaylist(e,a.nextPageToken),document.getElementById("import").value=""}}})},importSpotifyPlaylist:function(e){$.ajax({url:e,headers:{Authorization:"Bearer "+De.access_token},success:function(e){$.each(e.items,function(t,a){xt.backgroundSearch(a.track.name,a.track.artists.map(function(e){return e.name}).join(" "),Math.floor(a.track.duration_ms/1e3),e.total,t+e.offset)}),e.next&&xt.importSpotifyPlaylist(e.next)},error:function(){document.getElementById("import_spotify").disabled=!1,$("#import_spotify").removeClass("hide"),$("#playlist_loader_spotify").addClass("hide"),A(),Materialize.toast("It seems you've entered a invalid url.",4e3)}})},addVideos:function(e,t){var a="https://www.googleapis.com/youtube/v3/videos?part=contentDetails,snippet,id&key=***REMOVED***&id=";a+=e,$.ajax({type:"POST",url:a,dataType:"jsonp",success:function(e){var a=0,n=[];$.each(e.items,function(e,s){var i=xt.durationToSeconds(s.contentDetails.duration);(!longsongs||i<720)&&(enc_title=s.snippet.title,a+=1,n.push({id:s.id,enc_title:enc_title,duration:i,playlist:t}))}),$.each(n,function(e,t){xt.submit(t.id,t.enc_title,t.duration,t.playlist,e,a)})}})},submit:function(e,t,a,n,s,i){if(We&&document.getElementsByName("addsongs")[0].checked&&document.getElementsByName("addsongs")[0].disabled){var o=[];o=$.map(dt,function(t,a){if(t.id==e)return a}),0==o.length?J.channel_function({type:"added",value:{added:(new Date).getTime()/1e3,guids:[1],id:e,title:t,duration:a,playlist:!1,now_playing:!1,votes:1}}):J.vote(e,"pos")}else P.emit("add",{id:e,title:decodeURIComponent(t),adminpass:""==le?"":j.crypt_pass(le),list:W.toLowerCase(),duration:a,playlist:n,num:s,total:i,pass:Ie?"":j.crypt_pass(j.get_userpass(W.toLowerCase()))})},durationToSeconds:function(e){var t=e.match(ne);return hours=parseInt(t[12])||0,minutes=parseInt(t[14])||0,seconds=parseInt(t[16])||0,60*hours*60+60*minutes+seconds}},Tt={catchUserSuggests:function(e,t){Xe+=t?1:e.length;var a=Xe>9?"9+":Xe;if($(".suggested-link span.badge.new.white").hasClass("hide")&&Xe>0&&$(".suggested-link span.badge.new.white").removeClass("hide"),$(".suggested-link span.badge.new.white").text(a),t)Tt.createSuggested(e);else for(var n in e)Tt.createSuggested(e[n]);Tt.checkUserEmpty()},createSuggested:function(e){var t=Y.secondsToOther(e.duration),a=e.id,n=e.title,s=J.generateSong({id:a,title:n,length:e.duration,duration:t},!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="+te,a="https://www.googleapis.com/youtube/v3/videos?part=contentDetails,snippet,id&key="+te+"&id=";$.ajax({type:"GET",url:t,dataType:"jsonp",success:function(e){$.each(e.items.slice(0,5),function(e,t){a+=t.id.videoId+","}),$.ajax({type:"GET",url:a,dataType:"jsonp",success:function(e){$("#suggest-song-html").empty(),$.each(e.items,function(e,t){var a=t.contentDetails.duration,n=xt.durationToSeconds(a);a=Y.secondsToOther(xt.durationToSeconds(a));var s=t.id,i=t.snippet.title;$("#suggest-song-html").append(J.generateSong({id:s,title:i,length:n,duration:a},!1,!1,!1))})}})}})},checkUserEmpty:function(){0===$("#user-suggest-html").children().length?Y.contains($("#user_suggests").attr("class").split(" "),"hide")||$("#user_suggests").addClass("hide"):$("#user_suggests").removeClass("hide")}}}(); \ No newline at end of file +!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;Y.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)&&Y.to_channel(t[3],!0)},V=$("#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===D||q.mobilecheck()||fe)&&(D=io.connect(add+":8080",_t),D.on("update_required",function(){window.location.reload(!0)})),(0===$("#alreadyfp").length||q.mobilecheck()||!D._callbacks.$playlists||fe)&&f(),$("#about").modal(),$("#help").modal(),$("#contact").modal(),$("select").material_select(),q.log("----"),q.log("Sending frontpage_lists"),q.log("Socket",D),q.log("-----"),j.init(),j.get_offline()?S(!0,We):$("#offline-mode").tooltip({delay:5,position:"bottom",tooltip:"Enable local mode"}),$("#frontpage-viewer-counter").tooltip({delay:5,position:"bottom",tooltip:"Total Viewers"}),D.emit("frontpage_lists"),D.emit("get_userlists",j.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")}),!q.mobilecheck()&&Y.winter&&$(".mega").prepend('
    '),q.mobilecheck()&&$("input#searchFrontpage").characterCounter(),window.__onGCastApiAvailable=function(e,t){e&&(et=!0)}}function a(){Xe=0;var e=!0;W=$("#chan").html(),lt=q.mobilecheck();var t=q.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!==kt&&(kt.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(),$("#delete_song_alert").modal({dismissible:!1}),$("#user_password").modal({dismissible:!1}),I(De),it=$("#temp-results-container"),ot=$("#empty-results-container").html(),Pe=$(".not-imported-container").html(),Oe=$(".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"),j.set_width($(this).width()),C()},handles:"e",minWidth:350,maxWidth:$(window).width()-241}),(void 0===D||q.mobilecheck())&&(e=!1,D=io.connect(s+":8080",_t),D.on("update_required",function(){window.location.reload(!0)})),j.init(),i(),j.get_offline()&&($(".offline_switch_class")[0].checked=!0,S(!0,We)),0===$("#alreadychannel").length||q.mobilecheck())l(),c(),d(),p();else{$("#channel-load").css("display","none"),$("#player").css("opacity","1"),$("#controls").css("opacity","1"),$(".playlist").css("opacity","1"),kt.readyLooks(),Ct.initYoutubeControls(kt.player),Ct.initSlider(),kt.player.setVolume(j.get_volume()),$(".video-container").removeClass("no-opacity");var a="https://remote."+window.location.hostname+"/"+ct;$("#code-text").text(ct),$("#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="";ie&&(s=j.getCookie("_uI")+"_"),D.emit("list",{channel:s+W.toLowerCase(),pass:Ie?"":j.crypt_pass(j.get_userpass(W.toLowerCase()))})}$("#viewers").tooltip({delay:5,position:"top",tooltip:"Viewers"}),$("#fullscreen").tooltip({delay:5,position:"top",tooltip:"Fullscreen"}),window.onYouTubeIframeAPIReady=kt.onYouTubeIframeAPIReady,(""===kt.player||void 0===kt.player||q.mobilecheck())&&kt.loadPlayer(),q.mobilecheck()?bt.initiate_volume():$("input#chan_description").characterCounter(),u(),m(),h(),q.mobilecheck()||0!==$("#alreadychannel").length||y(),q.msieversion()||q.mobilecheck()||Notification.requestPermission(),$(".search_input").focus(),q.sample(),$(".castButton").tooltip({delay:5,position:"top",tooltip:"Cast Zoff to TV"}),$("#results").hover(function(){$("div.result").removeClass("hoverResults"),Te=0},function(){}),$("#search").focus(),$("#embed-button").css("display","inline-block"),$("#embed-area").val(k(Re,je,ze,Ge)),$("#search").attr("placeholder","Find song on YouTube..."),/chrom(e|ium)/.test(navigator.userAgent.toLowerCase())||q.mobilecheck()||$(".castButton").css("display","none"),q.log("chromecastAvailable"+Fe),q.log("chromecastAvailable"+et),Fe?n(1):et?initializeCastApi():window.__onGCastApiAvailable=function(e,t){e?setTimeout(function(){et=!0,initializeCastApi()},1e3):et=!0},$.contextMenu({selector:".playlist-element",reposition:!0,autoHide:!0,items:{copy:{name:"Copy link",callback:function(e,t){var a=$(this[0]).attr("data-video-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("data-video-id");xt.search(a,!1,!0),q.contains($(".search-container").attr("class").split(" "),"hide")&&xt.showSearch()}},sep1:"---------",delete:{name:"Delete",callback:function(e,t){var a=$(this[0]).attr("data-video-id");if("suggested"==$(this[0]).attr("data-video-type")){(Xe-=1)<0&&(Xe=0);var n=Xe>9?"9+":Xe;$(".suggested-link span.badge.new.white").hasClass("hide")||0!=n||$(".suggested-link span.badge.new.white").addClass("hide"),$(".suggested-link span.badge.new.white").text(n)}J.vote(a,"del")},disabled:function(e,t){return Z}}}}),q.mobilecheck()||null!=navigator.userAgent.match(/iPad/i)||setTimeout(function(){C()},100)}function n(e){if(1==e){$(".castButton").tooltip("remove"),$(".castButton").hasClass("castButton-white-active")||$(".castButton").addClass("castButton-white-active"),$(".castButton").tooltip({delay:5,position:"top",tooltip:"Stop casting"}),$("#duration").toggleClass("hide"),$("#fullscreen").toggleClass("hide");try{kt.player.stopVideo()}catch(e){}kt.stopInterval=!0,$("#player_overlay").removeClass("hide"),$("#player_overlay").css("display","block"),q.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/"+ht+"/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
    "+H.La.friendlyName),kt.player.setVolume(100),$("#player_overlay_text").toggleClass("hide")}else 0==e&&($(".castButton").tooltip("remove"),$(".castButton").removeClass("castButton-white-active"),$(".castButton").tooltip({delay:5,position:"top",tooltip:"Cast Zoff to TV"}),$("#duration").toggleClass("hide"),$("#fullscreen").toggleClass("hide"),kt.player.playVideo(),kt.stopInterval=!1,duration=kt.player.getDuration(),kt.durationSetter(),q.mobilecheck()||(kt.player.setVolume(j.get_volume()),$("#volume").slider("value",j.get_volume())),$("#player_overlay").addClass("hide"),$("#player_overlay_text").toggleClass("hide"),$("#chromecast_text").html(""),$("#playing_on").css("display","none"),We?kt.loadVideoById(ht):D.emit("pos",{channel:W.toLowerCase(),pass:Ie?"":j.crypt_pass(j.get_userpass(W.toLowerCase()))}))}function s(e,t){var a=JSON.parse(t);switch(a.type){case-1:We?kt.playNext():D.emit("end",{id:a.videoId,channel:W.toLowerCase(),pass:Ie?"":j.crypt_pass(j.get_userpass(W.toLowerCase()))});break;case 0:We?kt.playNext():D.emit("skip",{error:a.data_code,id:a.videoId,pass:""==le?"":j.crypt_pass(le),channel:W.toLowerCase(),userpass:Ie?"":j.crypt_pass(j.get_userpass(W.toLowerCase()))})}}function i(){D.on("auth_required",function(){me=!0,$("#player_overlay").removeClass("hide"),$("#player_overlay").css("display","block"),$("#user_password").modal("open"),j.remove_userpass(W.toLowerCase())}),D.on("auth_accepted",function(e){e.hasOwnProperty("value")&&e.value&&""!=ue&&(xe=ue,j.set_userpass(W.toLowerCase(),xe))})}function o(){D.on("connect_failed",function(){q.log("Connection Failed"),Ye||(Ye=!0,Materialize.toast("Error connecting to server, please wait..",1e8,"red lighten connect_error"))}),D.on("connect_error",function(){q.log("Connection Failed."),Ye||(Ye=!0,Materialize.toast("Error connecting to server, please wait..",1e8,"red lighten connect_error"))})}function l(){D.on("np",kt.youtube_listener)}function c(){D.on("get_list",function(){var e="";ie&&(e=j.getCookie("_uI")+"_"),D.emit("list",{channel:e+W.toLowerCase(),pass:Ie?"":j.crypt_pass(j.get_userpass(W.toLowerCase()))})})}function d(){D.on("suggested",function(e){var t=!0;void 0===e.id&&(t=!1),Tt.catchUserSuggests(e,t)})}function p(){D.on("viewers",function(e){pe=e,$("#viewers").html("visibility "+e),void 0!==yt&&kt.getTitle(yt,pe)})}function u(){D.on("toast",O.toast),D.on("pw",O.pw),D.on("conf",O.conf)}function h(){D.on("chat.all",z.allchat),D.on("chat",z.channelchat)}function m(){D.on("channel",J.channel_function)}function f(){q.log("Setting up playlist_listener"),D.on("playlists",Y.frontpage_function)}function y(){D.on("id",U.host_listener)}function v(e){D.on(e,U.host_on_action)}function _(){localStorage.debug=!0}function w(){localStorage.debug=!1}function k(e,t,a,n){return''}function C(e){if($(window).width()>760){var t=$(".brand-logo").outerWidth();e&&(t=.15*$(window).width());var a=$(window).width()-$(".control-list").width()-t-66;title_width=a,$(".title-container").width(title_width)}else $(".title-container").width("100%")}function T(e){for(var t="",a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.-_",n=0;n"+K+"
    "),K=K.html()),$("#viewers").addClass("hide"),$("#offline-mode").removeClass("waves-cyan"),$("#offline-mode").addClass("cyan"),$("#offline-mode").tooltip({delay:5,position:"bottom",tooltip:"Disable local mode"}),"/"!=window.location.pathname?($("#controls").on("mouseenter",function(e){$("#seekToDuration").hasClass("hide")&&$("#seekToDuration").removeClass("hide")}),$("#controls").on("mouseleave",function(e){he=!1,$("#seekToDuration").hasClass("hide")||$("#seekToDuration").addClass("hide")}),$("#controls").on("mousedown",function(e){["bar","controls","duration"].indexOf($(e.target).attr("id"))>=0&&(he=!0)}),$("#controls").on("mouseup",function(e){he=!1}),$("#controls").on("mousemove",E),$("#controls").on("click",L),$("#main_components").append("
    00:00/01:00
    "),q.mobilecheck()?q.mobilecheck()&&$("#seekToDuration").css("top",$("#controls").position().top-20):$("#seekToDuration").css("top",$("#controls").position().top-55),$("#controls").hasClass("ewresize")||$("#controls").addClass("ewresize")):($("#controls").off("mouseenter"),$("#controls").off("mouseleave"),$("#controls").off("mousemove"),$("#controls").off("click")),void 0!=dt&&!t){for(var a=0;a"+K+"
    "),K=K.html()),$("#viewers").removeClass("hide"),$("#offline-mode").addClass("waves-cyan"),$("#offline-mode").removeClass("cyan"),$("#offline-mode").tooltip({delay:5,position:"bottom",tooltip:"Enable local mode"}),$("#controls").off("mouseleave"),$("#controls").off("mouseenter"),$("#controls").off("mousedown"),$("#controls").off("mouseup"),$("#controls").off("mousemove",E),$("#controls").off("click",L),$("#seekToDuration").remove(),"/"!=window.location.pathname){D.emit("pos",{channel:W.toLowerCase(),pass:Ie?"":j.crypt_pass(j.get_userpass(W.toLowerCase()))});var n="";ie&&(n=j.getCookie("_uI")+"_"),D.emit("list",{channel:n+W.toLowerCase(),pass:Ie?"":j.crypt_pass(j.get_userpass(W.toLowerCase()))}),$("#controls").hasClass("ewresize")&&$("#controls").removeClass("ewresize")}}function I(e){e?(q.log("------------------------"),q.log("Spotify is authenticated"),q.log("access_token: "+Ve.access_token),q.log("token_type:"+Ve.token_type),q.log("expires_in: "+Ve.expires_in),q.log("------------------------"),$(".spotify_authenticated").css("display","block"),$(".spotify_unauthenticated").css("display","none")):(q.log("----------------------------"),q.log("Spotify is not authenticated"),q.log("----------------------------"),$(".spotify_authenticated").css("display","none"),$(".spotify_unauthenticated").css("display","block"))}function E(e){var t=e.clientX-Math.ceil($("#seekToDuration").width()/2)-8;t<0?t=0:t+$("#seekToDuration").width()>$("#controls").width()&&(t=$("#controls").width()-$("#seekToDuration").width()),$("#seekToDuration").css("left",t);try{var a=dt[dt.length-1].duration/$("#controls").width();a*=e.clientX;var n=q.secondsToOther(a),s=q.pad(n[0]),i=q.pad(Math.ceil(n[1]));$("#seekToDuration").text(s+":"+i);["bar","controls","duration"].indexOf($(e.target).attr("id"))>=0&&he&&$("#bar").width(100/kt.player.getDuration()*a+"%")}catch(e){}}function L(e){if(["bar","controls","duration"].indexOf($(e.target).attr("id"))>=0){var t=dt[dt.length-1].duration/$("#controls").width();t*=e.clientX,q.log(t),Fe?H.sendMessage("urn:x-cast:zoff.me",{type:"seekTo",seekTo:t}):(kt.player.seekTo(t),dMinutes=Math.floor(duration/60),dSeconds=duration-60*dMinutes,currDurr=t,currDurr>duration&&(currDurr=duration),minutes=Math.floor(currDurr/60),seconds=currDurr-60*minutes,document.getElementById("duration").innerHTML=q.pad(minutes)+":"+q.pad(seconds)+" / "+q.pad(dMinutes)+":"+q.pad(dSeconds),per=100/duration*currDurr,per>=100?per=100:0===duration&&(per=0),$("#bar").width(per+"%"))}}function B(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&&27!=code&&(clearTimeout(rt),search_input.length<3&&$("#results").html(""),13==code?xt.search(search_input):rt=setTimeout(function(){xt.search(search_input)},1e3))}function M(){$("#facebook-code-link").attr("href","https://www.facebook.com/sharer/sharer.php?u=https://zoff.me/"+W.toLowerCase()),$("#facebook-code-link").attr("onclick","window.open('https://www.facebook.com/sharer/sharer.php?u=https://zoff.me/"+W.toLowerCase()+"', 'Share Playlist','width=600,height=300'); return false;"),$("#twitter-code-link").attr("href","https://twitter.com/intent/tweet?url=https://zoff.me/"+W.toLowerCase()+"&text=Check%20out%20this%20playlist%20"+W.toLowerCase()+"%20on%20Zoff!&via=zoffmusic"),$("#twitter-code-link").attr("onclick","window.open('https://twitter.com/intent/tweet?url=https://zoff.me/"+W.toLowerCase()+"/&text=Check%20out%20this%20playlist%20"+W.toLowerCase()+"%20on%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/"+W.toLowerCase()+"&choe=UTF-8&chld=L%7C1")}function A(){$("#toast-container").remove()}function N(){var e=window.location.href.split("/");if("#!"==e[3].substr(0,1)||""===e[3]||5==e.length&&"#"==e[4].substr(0,1))""===e[3]&&($.contextMenu("destroy",".playlist-element"),ye=!1,clearTimeout(F),ke&&(ke=!1,kt.fireplace.destroy(),$("#fireplace_player").css("display","none")),$("#channel-load").css("display","block"),window.scrollTo(0,0),kt.stopInterval=!0,O.display_logged_out(),O.beginning=!0,Ce=!1,Le=!1,$("#embed-button").css("display","none"),$(".castButton").tooltip("remove"),$("#viewers").tooltip("remove"),$("#offline-mode").tooltip("remove"),$("#chan_thumbnail").tooltip("remove"),$("#fullscreen").tooltip("remove"),$("#admin-lock").tooltip("remove"),$("#seekToDuration").remove(),$(".tap-target").tapTarget("close"),clearTimeout(G),$.ajax({url:"/",success:function(e){if(q.mobilecheck()||fe?(q.log("Removing all listeners"),D.removeAllListeners(),D.disconnect()):(D.removeEventListener("chat.all"),D.removeEventListener("chat"),D.removeEventListener("conf"),D.removeEventListener("pw"),D.removeEventListener("toast"),D.removeEventListener("channel")),document.getElementById("volume-button").removeEventListener("click",Ct.mute_video),document.getElementById("playpause").removeEventListener("click",Ct.play_pause),document.getElementById("fullscreen").removeEventListener("click",Ct.fullscreen),(q.mobilecheck()||fe)&&(ht="",yt=""),$("meta[name=theme-color]").attr("content","#2D2D2D"),q.mobilecheck()||fe){try{kt.player.destroy()}catch(e){}kt.player="",document.title="Zoff"}else $(".video-container").resizable("destroy"),$("main").append("X"),$("#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"),$("#main-container").removeClass("channelpage"),$("#main-container").attr("style",""),$("header").html($(a.find("header")).html()),$($(a.find(".section.mega"))).insertAfter("header"),$($(a.find(".section.mobile-search"))).insertAfter(".mega"),q.mobilecheck()||fe?$("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","/assets/images/favicon.png"),$(".context-menu-list").remove(),q.log(D),1==$("#alreadyfp").length?t():(wt=!0,R=!0,t()),0!==$("#alreadychannel").length||fe?fe&&$("#alreadychannel").remove():$("head").append("
    "),void 0!=e.description&&""!=e.description&&$("#description_area").html(e.description)},submitAdmin:function(e,t){voting=e.vote.checked,addsongs=e.addsongs.checked,longsongs=e.longsongs.checked,R=e.frontpage.checked,allvideos=e.allvideos.checked,removeplay=e.removeplay.checked,skipping=e.skip.checked,shuffling=e.shuffle.checked;var a=""==xe?xe:CryptoJS.SHA256(xe).toString();configs={channel:W.toLowerCase(),voting:voting,addsongs:addsongs,longsongs:longsongs,frontpage:R,allvideos:allvideos,removeplay:removeplay,adminpass:""==le?"":j.crypt_pass(le),skipping:skipping,shuffling:shuffling,userpass:j.crypt_pass(a),userpass_changed:t},j.set_userpass(W.toLowerCase(),CryptoJS.SHA256(xe).toString()),D.emit("conf",configs)},hide_settings:function(){$("#settings").sideNav("hide")},shuffle:function(){if(We){for(var e=0;e to change name","/removename to remove name"],namechange:function(e){D.emit("namechange",e),j.set_name(e)},removename:function(){D.emit("removename"),j.remove_name()},chat:function(e){if(!(e.value.length>150)){if(e.value.startsWith("/name "))z.namechange(e.value.substring(6));else if(e.value.startsWith("/help"))if("#all_chat"==$(".chat-tab-li a.active").attr("href")){$("#chatall").children().length>100&&$("#chatall").children()[0].remove();for(var t=0;tSystem: ");var s=document.createTextNode(z.chat_help[t]);$("#chatall li:last")[0].appendChild(s),document.getElementById("chatall").scrollTop=document.getElementById("chatall").scrollHeight}}else{$("#chatchannel").children().length>100&&$("#chatchannel").children()[0].remove();for(var t=0;tSystem: ");var s=document.createTextNode(z.chat_help[t]);$("#chatchannel li:last")[0].appendChild(s),document.getElementById("chatchannel").scrollTop=document.getElementById("chatchannel").scrollHeight}}else e.value.startsWith("/removename")?z.removename():"#all_chat"==$(".chat-tab-li a.active").attr("href")?D.emit("all,chat",e.value):D.emit("chat",{channel:W.toLowerCase(),data:e.value,pass:Ie?"":j.crypt_pass(j.get_userpass(W.toLowerCase()))});e.value=""}},allchat:function(e){if(":"==e.msg.substring(0,1)&&!Be){z.all_received+=1,$("#favicon").attr("href","/assets/images/highlogo.png"),ee=!0,Me=!0,$(".chat-link span.badge.new.white").hasClass("hide")&&$(".chat-link span.badge.new.white").removeClass("hide");var t=z.channel_received+z.all_received>9?"9+":z.channel_received+z.all_received;$(".chat-link span.badge.new.white").html(t)}document.hidden&&$("#favicon").attr("href","/assets/images/highlogo.png"),$("#chatall").children().length>100&&$("#chatall").children()[0].remove();var a=q.intToARGB(q.hashCode(e.from));if(a.length<6)for(x=a.length;x<6;x++)a="0"+a;a=q.hexToRgb(a.substring(0,6));var n=q.rgbToHsl([a.r,a.g,a.b],!1);$("#chatall").append("
  • "+e.from+"
  • ");var s=document.createTextNode(e.msg);$("#chatall li:last")[0].appendChild(s),document.getElementById("chatall").scrollTop=document.getElementById("chatall").scrollHeight},channelchat:function(e){if(":"==e.msg.substring(0,1)&&!Be){$("#favicon").attr("href","/assets/images/highlogo.png"),ee=!0,Me=!0,z.channel_received+=1,$(".chat-link span.badge.new.white").hasClass("hide")&&$(".chat-link span.badge.new.white").removeClass("hide");var t=z.channel_received+z.all_received>9?"9+":z.channel_received+z.all_received;$(".chat-link span.badge.new.white").html(t)}$("#chatchannel").children().length>100&&$("#chatchannel").children()[0].remove();var a=q.intToARGB(q.hashCode(e.from));if(a.length<6)for(x=a.length;x<6;x++)a="0"+a;a=q.hexToRgb(a.substring(0,6));var n=q.rgbToHsl([a.r,a.g,a.b],!1);$("#chatchannel").append("
  • "+e.from+"
  • ");var s=document.createTextNode(e.msg);$("#chatchannel li:last")[0].appendChild(s),document.getElementById("chatchannel").scrollTop=document.getElementById("chatchannel").scrollHeight},chat_blink:function(){Ae=!0,$(".chat-link").attr("style","color: grey !important;"),setTimeout(function(){$(".chat-link").attr("style","color: white !important;"),setTimeout(function(){Ae&&z.chat_blink()},1e3)},1e3)}},j={conf_pass:void 0,user_pass:void 0,tmp_pass:"",init:function(){"/"!=window.location.pathname&&("https:"!=location.protocol?document.cookie=W.toLowerCase()+"=;path=/"+W.toLowerCase()+";expires="+new Date(0).toUTCString():document.cookie=W.toLowerCase()+"=;path=/"+W.toLowerCase()+";secure;expires="+new Date(0).toUTCString());try{conf_arr=j.decrypt(j.getCookie("_opt"),"_opt")}catch(e){conf_arr=j.decrypt(j.create_cookie("_opt"),"_opt")}if("/"!=window.location.pathname){try{j.conf_pass=j.decrypt(j.getCookie(W.toLowerCase()),W.toLowerCase())}catch(e){j.conf_pass=j.decrypt(j.create_cookie(W.toLowerCase()),W.toLowerCase())}U.change_enabled(conf_arr.remote),100!=conf_arr.width&&kt.set_width(conf_arr.width),void 0!==conf_arr.name&&""!==conf_arr.name&&z.namechange(conf_arr.name)}},decrypt:function(e,t){void 0===j.getCookie(t)&&(e=j.create_cookie(t));var a=btoa("0103060703080703080701")+btoa("0103060703080703080701");a=a.substring(0,32),a=btoa(a);var n=CryptoJS.AES.decrypt(e,a,{mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7});return $.parseJSON(n.toString(CryptoJS.enc.Utf8))},decrypt_pass:function(e){var t=btoa(D.id)+btoa(D.id);return t=t.substring(0,32),t=btoa(t),CryptoJS.AES.decrypt(e,t,{mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7}).toString(CryptoJS.enc.Utf8)},encrypt:function(e,t){var a=JSON.stringify(e),n=btoa("0103060703080703080701")+btoa("0103060703080703080701");n=n.substring(0,32),n=btoa(n);var s=CryptoJS.AES.encrypt(a,n,{mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7}),i=new Date;i.setFullYear(i.getFullYear()+1),"https:"!=location.protocol?document.cookie=t+"="+s.toString()+";expires="+i.toGMTString()+";path=/;":document.cookie=t+"="+s.toString()+";secure;expires="+i.toGMTString()+";path=/;"},get_volume:function(){return j.decrypt(j.getCookie("_opt"),"_opt").volume},get_offline:function(){return void 0!=j.decrypt(j.getCookie("_opt"),"_opt").offline?j.decrypt(j.getCookie("_opt"),"_opt").offline:(j.set_offline(!1),!1)},set_volume:function(e){conf_arr.volume=e,j.encrypt(conf_arr,"_opt")},create_cookie:function(e){cookie_object="_opt"==e?{volume:100,width:100,remote:!0,name:"",offline:!1}:{passwords:{}};var t=JSON.stringify(cookie_object),a=btoa("0103060703080703080701")+btoa("0103060703080703080701");a=a.substring(0,32),a=btoa(a);var n=CryptoJS.AES.encrypt(t,a,{mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7}),s=new Date;return s.setFullYear(s.getFullYear()+1),"https:"!=location.protocol?document.cookie=e+"="+n.toString()+";expires="+s.toGMTString()+";path=/;":document.cookie=e+"="+n.toString()+";secure;expires="+s.toGMTString()+";path=/;",j.getCookie(e)},set_pass:function(e,t){j.conf_pass.passwords[e]=t,j.encrypt(j.conf_pass,e)},remove_pass:function(e){delete j.conf_pass.passwords[e],j.encrypt(j.conf_pass,e.toLowerCase())},set_userpass:function(e,t){j.conf_pass.passwords.userpass=t,j.encrypt(j.conf_pass,e)},remove_userpass:function(e){delete j.conf_pass.passwords.userpass,j.encrypt(j.conf_pass,e.toLowerCase())},set_name:function(e){conf_arr.name=encodeURIComponent(e).replace(/\W/g,""),j.encrypt(conf_arr,"_opt")},set_offline:function(e){conf_arr.offline=e,j.encrypt(conf_arr,"_opt")},remove_name:function(){conf_arr.name="",j.encrypt(conf_arr,"_opt")},get_pass:function(e){if(void 0!==j.conf_pass)return j.conf_pass.passwords[e]},get_userpass:function(e){return void 0!==j.conf_pass?j.conf_pass.passwords.userpass:""},set_remote:function(e){conf_arr.remote=e,j.encrypt(conf_arr,"_opt")},get_remote:function(e){return conf_arr.remote},crypt_pass:function(e){j.tmp_pass=e;var t=btoa(D.id)+btoa(D.id);t=t.substring(0,32),t=btoa(t);var a=btoa(j.makeiv()),n=CryptoJS.AES.encrypt(e,CryptoJS.enc.Base64.parse(t),{mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7,iv:CryptoJS.enc.Base64.parse(a)});return window.encrypted=n,n.toString()+"$"+a},makeiv:function(){for(var e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",a=0;a<16;a++)e+=t.charAt(Math.floor(Math.random()*t.length));return e},get_width:function(){return conf_arr.width},set_width:function(e){conf_arr.width=e,j.encrypt(conf_arr,"_opt")},getCookie:function(e){var t="; "+document.cookie,a=t.split("; "+e+"=");if(2==a.length)return a.pop().split(";").shift()}},R=!0,Y={blob_list:[],winter:(new Date).getMonth()>=10,times_rotated:0,all_channels:[],frontpage_function:function(e){R=!0,q.log("-----------"),q.log("Frontpage fetch"),q.log(e),q.log("------------"),Y.all_channels=e.channels,Y.populate_channels(e.channels,!0),Y.set_viewers(e.viewers)},populate_channels:function(e,t){$("#channels").empty();var a,n=0;1==e[0].pinned&&(a=e.shift()),e=t?e.sort(q.predicate({name:"viewers",reverse:!0},{name:"accessed",reverse:!0},{name:"count",reverse:!0})):e.sort(q.predicate({name:"viewers",reverse:!0},{name:"count",reverse:!0})),void 0!==a&&e.unshift(a),q.mobilecheck()||(clearTimeout(P),Y.add_backdrop(e,0)),pre_card=$(V),q.log("------------"),q.log(pre_card),q.log("-------------");for(var s in e){var i=e[s].channel;if(n<12||!t){var o=e[s].id,l=e[s].viewers,r=e[s].description,c="background-image:url('https://img.youtube.com/vi/"+o+"/hqdefault.jpg');";e[s].thumbnail&&(c="background-image:url('"+e[s].thumbnail+"');");var d=e[s].count,p=pre_card.clone();1==e[s].pinned?(p.find(".pin").attr("style","display:block;"),p.find(".card").attr("title","Pinned!")):(p.find(".pin").attr("style","display:none;"),p.find(".card").attr("title","")),p.find(".chan-name").text(i),p.find(".chan-name").attr("title",i),p.find(".chan-views").text(l),p.find(".chan-songs").text(d),p.find(".chan-bg").attr("style",c),p.find(".chan-link").attr("href",i+"/"),""==r||q.mobilecheck()?(p.find(".card-reveal").remove(),p.find(".card").removeClass("sticky-action")):(p.find(".card-title").text(i),p.find(".description_text").text(r),r=""),$("#channels").append(p.html())}n++}var u=e.slice();u=u.sort(Y.sortFunction_active);var g={};for(var s in u)g[u[s].channel]=null;var h="input.desktop-search";q.mobilecheck()&&(h="input.mobile-search"),$(h).autocomplete({data:g,limit:5,onAutocomplete:function(e){Y.to_channel(e,!1)}}),document.getElementById("preloader").style.display="none",$("#channels").fadeIn(800),$("#searchFrontpage").focus(),n=0},sortFunction:function(e,t){var a=e.viewers,n=t.viewers,s=e.count,i=t.count;return an?-1:si?-1:0},sortFunction_active:function(e,t){var a=e.accessed,n=t.accessed,s=e.count,i=t.count;return an?-1:si?-1:0},getCookie:function(e){for(var t=e+"=",a=document.cookie.split(";"),n=0;n=e.length||t>=20)&&(t=0);var a=e[t].id;if(void 0!==Y.blob_list[t])setTimeout(function(){R&&($("#mega-background").css("background","url(data:image/png;base64,"+Y.blob_list[t]+")"),$("#mega-background").css("background-size","200%"),$("#mega-background").css("opacity",1),$(".desktop-search").attr("placeholder",e[t].channel))},500);else{var n=new Image;n.src="/assets/images/thumbnails/"+a+".jpg",n.onerror=function(){$.ajax({type:"POST",data:{id:a},url:"/api/imageblob",success:function(a){setTimeout(function(){$("#mega-background").css("background","url(/assets/images/thumbnails/"+a+")"),$("#mega-background").css("background-size","200%"),$("#mega-background").css("opacity",1),$(".desktop-search").attr("placeholder",e[t].channel)},500)}})},n.onload=function(){$("#mega-background").css("background","url("+n.src+")"),$("#mega-background").css("background-size","200%"),$("#mega-background").css("opacity",1),$(".desktop-search").attr("placeholder",e[t].channel)}}P=setTimeout(function(){50==Y.times_rotated&&R?(Y.times_rotated=0,t=0,D.emit("frontpage_lists"),D.emit("get_userlists",j.getCookie("_uI"))):R&&(Y.times_rotated+=1,Y.add_backdrop(e,t+1))},6e3)},start_snowfall:function(){setTimeout(function(){var e=Math.floor(Math.random()*window.innerWidth+1),t=document.createElement("div"),a=document.getElementsByClassName("mega")[0];t.className="snow",t.style.left=e+"px",t.style.top="0px",a.appendChild(t),Y.fall_snow(t),Y.start_snowfall()},800)},fall_snow:function(e){e.style.top=parseInt(e.style.top.replace("px",""))+2+"px",parseInt(e.style.top.replace("px",""))visibility
    "+e)},to_channel:function(e,t){$("#channel-load").css("display","block"),window.scrollTo(0,0),R=!1,clearTimeout(P),q.mobilecheck()&&(q.log("removing all listeners"),D.removeAllListeners()),$("#main-container").css("background-color","#2d2d2d"),$("#frontpage-viewer-counter").tooltip("remove"),$("#offline-mode").tooltip("remove"),_e=1,$.ajax({url:"/"+e,method:"get",data:{channel:e},success:function(n){""!==kt.player&&D.emit("change_channel",{channel:W.toLowerCase()}),$("#frontpage_player").empty(),q.mobilecheck()&&(q.log("disconnecting"),D.disconnect()),t||(window.history.pushState("to the channel!","Title","/"+e),""==Qe&&(Qe=e),""==Ke&&(Ke=e),window.chan=e);var s=$("
    "+n+"
    ");$("select").material_select("destroy"),$(".mega").remove(),$(".mobile-search").remove(),$("main").attr("class","container center-align main"),$("#main-container").addClass("channelpage"),$("header").html($(s.find("header")).html()),0===$("#alreadychannel").length||q.mobilecheck()||void 0===kt.player?$("main").html($(s.find("main")).html()):($("#main-row").append($(s.find("#playlist").wrap("
    ").parent().html())),$("#video-container").append($(s.find("#main_components").wrap("
    ").parent().html())),$("#main-row").append("
    "),$("#player").removeClass("player_bottom"),$("#main-row").removeClass("frontpage_modified_heights"),$("#main_section_frontpage").remove(),$("#closePlayer").remove(),$("#player_bottom_overlay").remove()),$("#search").attr("placeholder","Find song on YouTube..."),$(".page-footer").addClass("padding-bottom-novideo"),Ne=!0,1==$("#alreadychannel").length?a():($t=!0,a()),0===$("#alreadyfp").length&&$("head").append("
    ")}})}};String.prototype.capitalizeFirstLetter=function(){return this.charAt(0).toUpperCase()+this.slice(1)};var q={log:function(e){"true"===localStorage.debug&&console.log(e)},rnd:function(e){return e[Math.floor(Math.random()*e.length)]},mobilecheck:function(){var e=!1;return(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|Android|Silk|lge |maemo|midp|mmp|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|phone)|xda|xiino/i.test(navigator.userAgent)||/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(navigator.userAgent.substr(0,4)))&&(e=!0),e},predicate:function(){for(var e,t,a,n=[],s=arguments.length,i=function(e,t){return e===t?0:e>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 e<10?"0"+Math.floor(e):Math.floor(e)},contains:function(e,t){for(var a=e.length;a--;)if(e[a]===t)return!0;return!1},sample:function(){Date.now()-be>=2*we&&(D.removeAllListeners(),D.disconnect(),D.connect(),kt.setup_all_listeners()),be=Date.now(),setTimeout(q.sample,we)},loadjsfile:function(e){if(-1==ce.indexOf("["+e+"]")){var t=document.createElement("script");t.setAttribute("type","text/javascript"),t.setAttribute("src",e),document.getElementsByTagName("head")[0].appendChild(t),ce+="["+e+"]"}},msieversion:function(){return!!(window.navigator.userAgent.indexOf("MSIE ")>0||navigator.userAgent.match(/Trident.*rv\:11\./))},getRandomInt:function(e,t){return Math.floor(Math.random()*(t-e))+e},secondsToOther:function(e){var t=e,a=Math.floor(t/60);return t-=60*a,[a,t]},rgbToHsl:function(e,t){r=e[0],g=e[1],b=e[2],r/=255,g/=255,b/=255;var a,n,s=Math.max(r,g,b),i=Math.min(r,g,b),o=(s+i)/2;if(s==i)a=n=0;else{var l=s-i;switch(n=o>.5?l/(2-s-i):l/(s+i),s){case r:a=(g-b)/l+(g.5&&t?o=.4:o<.65&&!t&&(o=.65),"hsl("+Math.floor(360*a)+", "+Math.floor(100*n)+"%, "+Math.floor(100*o)+"%)"},componentToHex:function(e){var t=e.toString(16);return 1==t.length?"0"+t:t},rgbToHex:function(e,t,a){return"#"+q.componentToHex(e)+q.componentToHex(t)+q.componentToHex(a)},upperFirst:function(e){return e.substring(0,1).toUpperCase()+e.substring(1).toLowerCase()},addClass:function(e,t){q.contains($(e).attr("class").split(" "),t)||$(e).addClass(t)},send_mail:function(e,t){""!==e&&""!==t&&($("#submit-contact-form").addClass("hide"),$("#send-loader").removeClass("hide"),$("#contact-form-from").attr("disabled","true"),$("#contact-form-message").attr("disabled","true"),$.ajax({type:"POST",data:{from:e,message:t},url:"/api/mail",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: contact@zoff.no"))}}))},firstY:null,lastY:null,currentY:null,vertScroll:!1,initAdjustment:0,touchstart:function(e){q.lastY=q.currentY=q.firstY=e.originalEvent.touches[0].pageY},touchmove:function(e){q.currentY=e.originalEvent.touches[0].pageY;var t=q.lastY-q.currentY;!q.vertScroll&&Math.abs(q.currentY-q.firstY)>30&&(q.vertScroll=!0,q.initAdjustment=q.currentY-q.firstY),q.vertScroll&&(window.scrollBy(0,t+q.initAdjustment),q.lastY=q.currentY+t)},touchend:function(e){q.vertScroll=!1,q.firstY=null,q.currentY=null,q.vertScroll=!1,q.initAdjustment=0,q.currentY=null}};Element.prototype.remove=function(){this.parentElement.removeChild(this)},NodeList.prototype.remove=HTMLCollection.prototype.remove=function(){for(var e=0,t=this.length;e=J.page&&n div:nth-child("+n+")").after(i);var o=$("#wrapper").children()[n];$(o).css("display",s),"inline-block"==s&&$("#wrapper").children().length>=J.page+J.can_fit+1?$($("#wrapper").children()[J.page+J.can_fit]).css("display","none"):n=0?$($("#wrapper").children()[J.page]).css("display","inline-block"):$("#wrapper").children().length>J.page+J.can_fit&&$($("#wrapper").children()[J.page+J.can_fit-1]).css("display","inline-block"),a&&J.page>0&&$($("#wrapper").children()[J.page-1]).css("display","none"),t&&setTimeout(function(){$(o).css("transform","translateX(0%)"),setTimeout(function(){$(o).removeClass("side_away")},300)},5)}},populate_list:function(e,t){if(q.mobilecheck()||Ie?Ie?(J.can_fit=Math.round($("#wrapper").height()/91)+1,J.element_height=$("#wrapper").height()/J.can_fit-4):(J.can_fit=Math.round(($(window).height()-$(".tabs").height()-$("header").height()-64-8)/71)+1,J.element_height=($(window).height()-$(".tabs").height()-$("header").height()-64-8)/J.can_fit-5):(J.can_fit=Math.round($("#wrapper").height()/71)+1,J.element_height=$("#wrapper").height()/J.can_fit-5.3),J.element_height<55.2&&(J.can_fit=J.can_fit-1,J.element_height=55.2,J.can_fit=Math.round(($(window).height()-$(".tabs").height()-$("header").height()-64-8)/71),J.element_height=($(window).height()-$(".tabs").height()-$("header").height()-64-8)/J.can_fit-5),void 0===K&&(K=$("#list-song-html").html()),dt=e,We&&!t)for(var a=0;a1?($.each(dt,function(e,t){if(!t.now_playing){var a=J.generateSong(t,!1,Se,!0,!1,"",!0);$("#wrapper").append(a)}}),$("#wrapper").children().length>J.can_fit&&!$("#pageButtons").length?($('
    first_pagefirst_pagenavigate_before prevnavigate_before prev 1 next navigate_nextnext navigate_nextlast_pagelast_page
    ').insertAfter("#wrapper"),$(".prev_page").css("display","none"),$(".first_page").css("display","none"),$(".next_page_hide").css("display","none"),$(".last_page_hide").css("display","none")):$("#pageButtons").length||($('
    first_pagefirst_pagenavigate_before prevnavigate_before prev 1 next navigate_nextnext navigate_nextlast_pagelast_page
    ').insertAfter("#wrapper"),$(".prev_page").css("display","none"),$(".next_page").css("display","none"),$(".last_page").css("display","none"),$(".first_page").css("display","none"),$(".next_page_hide").css("display","inline-flex"),$(".prev_page_hide").css("display","inline-flex")),J.dynamicContentPage(-10)):(J.empty=!0,$("#wrapper").html("The playlist is empty."),$("#pageButtons").length||$('
    first_pagefirst_pagenavigate_before prevnavigate_before prev 1 next navigate_nextnext navigate_nextlast_pagelast_page
    ').insertAfter("#wrapper"),$(".prev_page").css("display","none"),$(".next_page").css("display","none"),$(".last_page").css("display","none"),$(".last_page_hide").css("display","inline-flex"),$(".first_page").css("display","none"),$(".next_page_hide").css("display","inline-flex"),$(".prev_page_hide").css("display","inline-flex")),$("#settings").css("visibility","visible"),$("#settings").css("opacity","1"),$("#wrapper").css("opacity","1")},dynamicContentPageJumpTo:function(e){((e*=J.can_fit)>J.page||e0&&"none"==$(".prev_page").css("display")&&($(".prev_page").css("display","inline-flex"),$(".prev_page_hide").css("display","none"),$(".first_page").css("display","inline-flex"),$(".first_page_hide").css("display","none")),J.page+J.can_fit>=$("#wrapper").children().length&&($(".next_page_hide").css("display","inline-flex"),$(".next_page").css("display","none"),$(".last_page_hide").css("display","inline-flex"),$(".last_page").css("display","none")),$("#pageNumber").html(J.page/J.can_fit+1))},dynamicContentPage:function(e){1==e?($("#wrapper").children().slice(J.page,J.page+J.can_fit).hide(),J.page=J.page+J.can_fit,$("#wrapper").children().slice(J.page,J.page+J.can_fit).css("display","inline-block"),J.page>0&&"none"==$(".prev_page").css("display")&&($(".prev_page").css("display","inline-flex"),$(".prev_page_hide").css("display","none"),$(".first_page").css("display","inline-flex"),$(".first_page_hide").css("display","none")),J.page+J.can_fit>=$("#wrapper").children().length&&($(".next_page_hide").css("display","inline-flex"),$(".next_page").css("display","none"),$(".last_page_hide").css("display","inline-flex"),$(".last_page").css("display","none"))):10==e?($("#wrapper").children().slice(J.page,J.page+J.can_fit).hide(),J.page=Math.floor(($("#wrapper").children().length-1)/J.can_fit)*J.can_fit,$("#wrapper").children().slice(J.page,J.page+J.can_fit).css("display","inline-block"),J.page>0&&"none"==$(".prev_page").css("display")&&($(".prev_page").css("display","inline-flex"),$(".prev_page_hide").css("display","none"),$(".first_page").css("display","inline-flex"),$(".first_page_hide").css("display","none")),J.page+J.can_fit>=$("#wrapper").children().length&&($(".next_page_hide").css("display","inline-flex"),$(".next_page").css("display","none"),$(".last_page_hide").css("display","inline-flex"),$(".last_page").css("display","none"))):-10==e?($("#wrapper").children().slice(J.page,J.page+J.can_fit).hide(),J.page=0,$("#wrapper").children().slice(J.page,J.page+J.can_fit).css("display","inline-block"),0==J.page&&"none"!=$(".prev_page").css("display")?($(".prev_page").css("display","none"),$(".prev_page_hide").css("display","inline-flex"),$(".first_page").css("display","none"),$(".first_page_hide").css("display","inline-flex")):"none"==$(".prev_page").css("display")?($(".prev_page_hide").css("display","inline-flex"),$(".first_page_hide").css("display","inline-flex")):($(".prev_page_hide").css("display","none"),$(".first_page_hide").css("display","none")),J.page+J.can_fit<$("#wrapper").children().length&&($(".next_page_hide").css("display","none"),$(".next_page").css("display","inline-flex"),$(".last_page_hide").css("display","none"),$(".last_page").css("display","inline-flex"))):($("#wrapper").children().slice(J.page-J.can_fit,J.page).css("display","inline-block"),$("#wrapper").children().slice(J.page,J.page+J.can_fit).hide(),J.page=J.page-J.can_fit<0?0:J.page-J.can_fit,0==J.page&&"none"!=$(".prev_page").css("display")?($(".prev_page").css("display","none"),$(".prev_page_hide").css("display","inline-flex"),$(".first_page").css("display","none"),$(".first_page_hide").css("display","inline-flex")):"none"==$(".prev_page").css("display")?($(".prev_page_hide").css("display","inline-flex"),$(".first_page_hide").css("display","inline-flex")):($(".prev_page_hide").css("display","none"),$(".first_page_hide").css("display","none")),J.page+J.can_fit<$("#wrapper").children().length&&($(".next_page_hide").css("display","none"),$(".next_page").css("display","inline-flex"),$(".last_page_hide").css("display","none"),$(".last_page").css("display","inline-flex"))),$("#pageNumber").html(J.page/J.can_fit+1)},added_song:function(e){var t;if(void 0!=e){if(0!==dt.length&&(t=dt.pop()),dt.push(e),J.sortList(),t&&dt.push(t),$("#suggested-"+e.id).length>0){Xe-=1,Xe<0&&(Xe=0);var a=Xe>9?"9+":Xe;$(".suggested-link span.badge.new.white").hasClass("hide")||0!=a||$(".suggested-link span.badge.new.white").addClass("hide"),$(".suggested-link span.badge.new.white").text(a)}$("#suggested-"+e.id).remove(),J.empty&&(J.empty=!1),$("#empty-channel-message").remove(),J.insertAtIndex(e,!0),$($("#wrapper").children()[J.page+J.can_fit]).css("display","none"),$("#wrapper").children().length>J.page+J.can_fit?($(".next_page_hide").css("display","none"),$(".next_page").removeClass("hide"),$(".last_page_hide").css("display","none"),$(".next_page").css("display","inline-flex"),$(".last_page").css("display","inline-flex")):($(".next_page_hide").css("display","inline-flex"),$(".next_page").css("display","none"))}},deleted_song:function(e,t){try{var a=J.getIndexOfSong(e);$("#wrapper").children()[a];a=0?($($("#wrapper").children()[J.page]).css("height",0),$($("#wrapper").children()[J.page]).css("display","inline-block"),$($("#wrapper").children()[J.page]).css("height",J.element_height)):$("#wrapper").children().length>J.page+J.can_fit&&($($("#wrapper").children()[J.page+J.can_fit]).css("height",0),$($("#wrapper").children()[J.page+J.can_fit]).css("display","inline-block"),$($("#wrapper").children()[J.page+J.can_fit]).css("height",J.element_height)),J.page>=$("#wrapper").children().length-1?(J.dynamicContentPage(-1),$(".next_page_hide").css("display","inline-flex"),$(".next_page").css("display","none"),$(".last_page_hide").css("display","inline-flex"),$(".last_page").css("display","none")):J.page+J.can_fit+1>=$("#wrapper").children().length-1&&($(".next_page_hide").css("display","inline-flex"),$(".next_page").css("display","none"),$(".last_page_hide").css("display","inline-flex"),$(".last_page").css("display","none")),J.page<=a&&J.page-J.can_fit<=a?($("#"+e).addClass("side_away"),$("#"+e).find(".mobile-delete").remove(),$("#"+e).css("transform","translateX(-100%)"),setTimeout(function(){$("#"+e).remove()},300)):$("#"+e).remove(),dt.splice(J.getIndexOfSong(e),1),kt.sendNext({title:dt[0].title,videoId:dt[0].id})}catch(t){dt.splice(J.getIndexOfSong(e),1),J.empty||($("#"+e).remove(),a=0?$($("#wrapper").children()[J.page-1]).css("display","inline-block"):$("#wrapper").children().length>J.page+J.can_fit&&$($("#wrapper").children()[J.page+(J.can_fit-1)]).css("display","inline-block"),kt.sendNext({title:dt[0].title,videoId:dt[0].id}))}dt.length<=2&&(J.empty=!0,$("#wrapper").html("The playlist is empty.")),$("#suggested-"+e).remove(),J.page,J.can_fit,$("#wrapper").children().length,J.page>=$("#wrapper").children().length&&J.dynamicContentPage(-1),Tt.checkUserEmpty()},voted_song:function(e,t){var a=J.getIndexOfSong(e),n=dt[a];dt[a].votes+=1,dt[a].added=t,J.sortList(),$("#"+e).remove(),J.insertAtIndex(n,!1)},song_change:function(e,t){try{var a=dt.length-1;$("#wrapper").children()[0].remove(),0===$("#wrapper").children().length&&(J.empty=!0,$("#wrapper").html("The playlist is empty.")),dt[0].now_playing=!0,dt[0].votes=0,dt[0].guids=[],dt[0].added=e,t?delete dt[a]:dt[a].now_playing=!1,q.log("---------------------------"),q.log("---SONG ON FIRST INDEX-----"),q.log(dt[0]),q.log("---------------------------"),dt.push(dt.shift()),t||J.insertAtIndex(dt[a-1],!1,!0)}catch(e){}},vote:function(e,t){return!We||"del"==t&&X&&!Z&&""!=le?D.emit("vote",{channel:W,id:e,type:t,adminpass:""==le?"":j.crypt_pass(le),pass:Ie?"":j.crypt_pass(j.get_userpass(W.toLowerCase()))}):"pos"==t?J.voted_song(e,(new Date).getTime()/1e3):J.deleted_song(e),!0},skip:function(){return We?kt.playNext():D.emit("skip",{pass:""==le?"":j.crypt_pass(le),id:ht,channel:W.toLowerCase(),userpass:Ie?"":j.crypt_pass(j.get_userpass(W.toLowerCase()))}),!0},exportToSpotify:function(){$.ajax({type:"GET",url:"https://api.spotify.com/v1/me",headers:{Authorization:"Bearer "+Ve.access_token},success:function(e){var t=e.id;$("#playlist_loader_export").removeClass("hide"),$(".exported-list-container").removeClass("hide"),$.ajax({type:"POST",url:"https://api.spotify.com/v1/users/"+t+"/playlists",headers:{Authorization:"Bearer "+Ve.access_token,"Content-Type":"application/json"},data:JSON.stringify({name:W.toLowerCase()+" - Zoff",public:!0}),success:function(e){var a=e.id;$.each(dt,function(e,n){J.searchSpotify(n,a,t)})}})}})},searchSpotify:function(e,t,a){var n=e.title,s=e.title.toLowerCase().replace("-"," ");s.startsWith("the")&&(s=s.replace("the","")),s=s.replace(" hd",""),s=s.replace("official hd video",""),s=s.replace("unofficial video",""),s=s.replace("studio footage",""),s=s.replace("great song",""),s=s.replace("-"," "),s=s.replace("-"," "),s=s.replace(" hq"," "),s=s.replace("lyric video",""),s=s.replace("lyrics video",""),s=s.replace("album version",""),s=s.replace("drive original movie soundtrack",""),s=s.replace("original movie soundtrack",""),s=s.replace("live sessions",""),s=s.replace("audio only",""),s=s.replace("audio",""),s=s.replace("(new)",""),s=s.replace(" by "," "),s=s.replace(" vs "," "),s=s.replace("(full)"," "),s=s.replace("(video)"," "),s=s.replace("&"," "),s=s.replace("with lyrics",""),s=s.replace("lyrics",""),s=s.replace("w/",""),s=s.replace("w/",""),s=s.replace("official video",""),s=s.replace("studio version",""),s=s.replace("official music video",""),s=s.replace("music video",""),s=s.replace("musicvideo",""),s=s.replace("original video",""),s=s.replace("full version",""),s=s.replace("full song",""),s=s.replace("(official)",""),s=s.replace("official",""),s=s.replace("(original)",""),s=s.replace("("," "),s=s.replace(")"," "),s=s.replace("|",""),s=s.replace("feat."," "),s=s.replace("feat"," "),s=s.replace("ft."," "),s=s.replace("["," "),s=s.replace("]"," "),s=s.replace(" free ",""),s=s.replace(" hd",""),s=s.replace("original mix"," "),s=s.replace("radio edit"," "),s=s.replace("pop version"," "),s=s.replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," "),s=encodeURIComponent(s),$.ajax({type:"GET",url:"https://api.spotify.com/v1/search?q="+s+"&type=track",headers:{Authorization:"Bearer "+Ve.access_token},async:!0,statusCode:{429:function(n){console.log(n.getAllResponseHeaders());var s=n.getResponseHeader("Retry-After");console.log(s),s||(s=5),s=parseInt(s,10),q.log("Retry-After",s),setTimeout(function(){J.searchSpotify(e,t,a)},1e3*s)}},error:function(n){if(429==n.status){console.log(n.getAllResponseHeaders());var s=n.getResponseHeader("Retry-After");console.log(s),s||(s=5),s=parseInt(s,10),q.log("Retry-After",s),setTimeout(function(){J.searchSpotify(e,t,a)},1e3*s)}},success:function(e){var i=!1;if($.each(e.tracks.items,function(e,t){if(t.name=t.name.toLowerCase(),t.name=t.name.replace("("," "),t.name=t.name.replace(")"," "),t.name=t.name.replace("["," "),t.name=t.name.replace("]"," "),t.name=t.name.replace("-"," "),t.name=t.name.replace("-"," "),t.name=t.name.replace("-"," "),t.name=t.name.replace("original mix"," "),t.name=t.name.replace("album version"," "),t.name=t.name.replace("abum version"," "),t.name=t.name.replace("feat."," "),t.artists[0].name=t.artists[0].name.replace("feat."," "),t.artists[0].name=t.artists[0].name.replace("feat"," "),t.name=t.name.replace("feat"," "),t.name=t.name.replace("ft."," "),t.name=t.name.replace("radio edit"," "),t.name=t.name.replace("pop version"," "),t.name=t.name.replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," "),t.artists[0].name=t.artists[0].name.replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ")," "==t.name.substring(t.name.length-1)&&(t.name=t.name.substring(0,t.name.length-1)),"."==t.name.substring(t.name.length-1)&&"."!=s.substring(s.length-1)&&(t.name=t.name.substring(0,t.name.length-1)),decodeURIComponent(s).indexOf(t.artists[0].name.toLowerCase())>=0&&decodeURIComponent(s).indexOf(t.name.toLowerCase())>=0)return i=!0,J.uris.push(t.uri),q.log("Found",s),!1;for(var a=t.name.split(" "),e=0;e=0||"&"==a[e]&&s.indexOf("and")>=0)&&s.indexOf(a[e])<0)return!0;return i=!0,J.uris.push(t.uri),q.log("Found",s),!1}),i||(J.not_found.push(n),J.num_songs=J.num_songs+1,q.log("Didn't find",n)),J.num_songs+J.uris.length==dt.length){if(J.uris.length>100){for(;J.uris.length>100;)J.addToSpotifyPlaylist(J.uris.slice(0,100),t,a),J.uris=J.uris.slice(100,J.uris.length);J.addToSpotifyPlaylist(J.uris,t,a),$("#playlist_loader_export").addClass("hide")}else J.addToSpotifyPlaylist(J.uris,t,a),$("#playlist_loader_export").addClass("hide");0==$(".exported-spotify-list").length&&$(".exported-list").append(""+W+""),$.each(J.not_found,function(e,t){var a=$("
    "+Oe+"
    ");a.find(".extra-add-text").attr("value",t),a.find(".extra-add-text").attr("title",t),$(".not-exported-container").append(a.html())}),$(".not-exported").removeClass("hide"),$(".spotify_export_button").css("display","block")}}})},addToSpotifyPlaylist:function(e,t,a){$.ajax({type:"POST",url:"https://api.spotify.com/v1/users/"+a+"/playlists/"+t+"/tracks",headers:{Authorization:"Bearer "+Ve.access_token,"Content-Type":"application/json"},data:JSON.stringify({uris:e}),error:function(n){var s=t,i=e,o=a;setTimeout(function(){J.addToSpotifyPlaylist(i,s,o)},3e3)},success:function(e){q.log("Added songs")}})},exportToYoutube:function(){$(".exported-list-container").removeClass("hide"),$("#playlist_loader_export").removeClass("hide"),$.ajax({type:"POST",url:"https://www.googleapis.com/youtube/v3/playlists?part=snippet",headers:{Authorization:"Bearer "+qe.access_token,"Content-Type":"application/json"},data:JSON.stringify({snippet:{title:q.upperFirst(W.toLowerCase()),description:"Playlist exported from zoff"}}),success:function(e){var t=e.id;J.addToYoutubePlaylist(t,dt,0,"https://www.googleapis.com/youtube/v3/playlistItems?part=snippet")},error:function(e){q.log(e)}})},addToYoutubePlaylist:function(e,t,a,n){var s=JSON.stringify({snippet:{playlistId:e,resourceId:{kind:"youtube#video",videoId:t[a].id}}});$.ajax({type:"POST",url:n,headers:{Authorization:"Bearer "+qe.access_token,"Content-Type":"application/json"},data:s,success:function(s){q.log("Added video: "+t[a].id+" to playlist id "+e),a==t.length-1?(q.log("All videoes added!"),q.log("url: https://www.youtube.com/playlist?list="+e),$(".exported-list").append(""+W+""),$("#playlist_loader_export").addClass("hide"),$(".current_number").addClass("hide")):($(".current_number").removeClass("hide"),$(".current_number").text(a+1+" of "+t.length),J.addToYoutubePlaylist(e,t,a+1,n))}})},importOldList:function(e){var t="",a=0;playlist_url="lists/"+e+".json",mt=$.parseJSON($.ajax({type:"GET",url:playlist_url,async:!1}).responseText),$.each(mt.songs,function(e,n){t+=n.id+",",a>45&&(xt.addVideos(t),t="",a=0),a++}),xt.addVideos(t),document.getElementById("search").value=""},sortList:function(){dt.sort(q.predicate({name:"votes",reverse:!0},{name:"added",reverse:!1},{name:"title",reverse:!1}))},show:function(){q.mobilecheck()||(Q?(Q=!1,$("#toptitle").empty(),$("#chan").addClass("bigChan"),$("#chan").html("zoff.me/"+W.toLowerCase())):(Q=!0,$("#toptitle").html("Zoff"),$("#chan").removeClass("bigChan"),$("#chan").html(W)))},generateSong:function(e,t,a,n,s,i,o){void 0===K&&(K=$("#list-song-html").html());var l,r,c=e.id,d=e.title,p=e.votes,u="background-image:url('//img.youtube.com/vi/"+c+"/mqdefault.jpg');",g=$("
    "+K+"
    "),h="style";if(t&&(g.find(".list-song").css("transform","translateX(100%)"),g.find(".list-song").addClass("side_away")),g.find(".list-song").css("height",J.element_height),Z||g.find(".card-action").removeClass("hide"),1==p&&g.find(".vote-text").text("vote"),a&&(u="//img.youtube.com/vi/"+c+"/mqdefault.jpg",h="data-original"),n){g.find(".list-votes").text(p),g.find("#list-song").attr("data-video-id",c),g.find("#list-song").attr("data-video-type","song"),g.find("#list-song").attr("id",c),g.find(".vote-container").attr("title",d),($("#wrapper").children().length>=J.can_fit&&o||"none"==i)&&g.find(".card").css("display","none"),l=".vote-container",r="delete_button";var m=q.secondsToOther(e.duration);g.find(".card-duration").text(q.pad(m[0])+":"+q.pad(m[1]))}else if(!n){g.find(".suggested_remove").removeClass("hide"),g.find(".vote-text").text(""),g.find(".card-duration").text(q.pad(e.duration[0])+":"+q.pad(e.duration[1]));var f="user";l=".add-suggested",s?r="del_user_suggested":(r="del_suggested",f="system"),g.find(".vote-container").attr("class","clickable add-suggested"),g.find(".add-suggested").attr("title",d),g.find(".delete_button").addClass(r),g.find(l).attr("data-video-title",d),g.find(l).attr("data-video-length",e.length),g.find(l).attr("data-added-by",f),g.find("#list-song").attr("data-video-type","suggested"),g.find("#list-song").attr("data-video-id",c),g.find("#list-song").attr("id","suggested-"+c),g.find(".list-image").attr("class",g.find(".list-image").attr("class").replace("list-image","list-suggested-image"))}return q.mobilecheck()&&(g.find(".waves-effect").removeClass("waves-effect"),g.find(".waves-light").removeClass("waves-light")),g.find(".list-title").text(d),g.find(".list-title").attr("title",d),g.find(l).attr("data-video-id",c),g.find(".list-image").attr(h,u),g.find(".list-suggested-image").attr(h,u),g.find("."+r).attr("data-video-id",c),g.html()},getIndexOfSong:function(e){try{return indexes=$.map(dt,function(t,a){if(t.id==e)return a}),indexes[0]}catch(e){}},scrollTop:function(){$("#wrapper").scrollTop(0)},scrollBottom:function(){$("#wrapper").scrollTop($("#wrapper")[0].scrollHeight)}},W=void 0===window.chan?$("#chan").html():window.chan,Z=!0,X=0,Q=!0,K=$("#list-song-html").html(),ee=!1,te="***REMOVED***",ae=!1,ne=/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)?)?/,se=[],ie=!1,oe=0,R=1,le="",re=!1,ce="",de=!1,pe=1,ue="",ge=!1,he=!1,me=!1,fe=!1,ye=!1,ve=!1,_e=1,$e=!1,we=6e3,be=Date.now(),ke=!1,Ce=!1,xe="",Te=-1,Se=!1,Ie=!1,Ee=!0,Le=!1,Be=!1,Me=!1,Ae=!1,Ne=!1,Ve={},De=!1,Pe="",Oe="",ze=300,je=600,Re="&autoplay",Ye=!1,qe={},He=!1,Fe=!1,Ge="808080",Ue=!1,Je=!1,We=!1,Ze=!1,Xe=0,Qe="",Ke="",et=!1,tt=[],at=0,nt="";if(void 0===localStorage.debug){localStorage.debug=!1}var st,it,ot,lt,rt,ct,dt,se,pt,ut,gt,pe,ht,mt,ft,yt,vt,D,_t={"sync disconnect on unload":!0,secure:!0,"force new connection":!0},$t=!1,wt=!1;try{navigator.serviceWorker.getRegistration("/").then(function(e){e&&e.unregister()})}catch(e){}$.ajaxPrefilter(function(e,t,a){e.async=!0}),$().ready(function(){$t||"/"==window.location.pathname?wt||"/"!=window.location.pathname||t():a(),q.mobilecheck()&&D.on("guid",function(e){nt=e}),D.on("connect",function(){Ye&&(Ye=!1,$(".connect_error").fadeOut(function(){$(".connect_error").remove(),Materialize.toast("Connected!",2e3,"green lighten"),We&&D.emit("offline",{status:!0,channel:void 0!=W?W.toLowerCase():""}),void 0!==j.get_pass(W.toLowerCase())&&""!==j.get_pass(W.toLowerCase())&&D.emit("password",{password:j.crypt_pass(j.get_pass(W.toLowerCase())),channel:W.toLowerCase()})}))}),o();try{$.ajax({type:"GET",url:"https://api.github.com/users/zoff-music/received_events",success:function(e){for(var t=0;t"+e[0].created_at.substring(0,10)+": "+e[0].actor.display_login+"
    "+e[0].payload.commits[0].sha.substring(0,10)+": "+e[0].payload.commits[0].message+"J.can_fit||ee&&$($("#wrapper").children()[J.page+e]).css("display","none"),J.can_fit=e,J.element_height=$("#wrapper").height()/J.can_fit-5.3,$(".list-song").css("height",J.element_height+"px"),C(),$("#controls").length>0&&!q.mobilecheck()?$("#seekToDuration").css("top",$("#controls").position().top-55):$("#controls").length>0&&$("#seekToDuration").css("top",$("#controls").position().top-20)}}),$(document).on("click",".result-object",function(e){var t=$(e.target);if("9?"9+":Xe;$(".suggested-link span.badge.new.white").hasClass("hide")||0!=i||$(".suggested-link span.badge.new.white").addClass("hide"),$(".suggested-link span.badge.new.white").text(i)}$("#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(),(Xe-=1)<0&&(Xe=0);var a=Xe>9?"9+":Xe;$(".suggested-link span.badge.new.white").hasClass("hide")||0!=a||$(".suggested-link span.badge.new.white").addClass("hide"),$(".suggested-link span.badge.new.white").text(a),J.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","/"),N()}),$(document).on("click","#player_bottom_overlay",function(){Y.to_channel(W.toLowerCase(),!1)}),$(document).keydown(function(e){if("/"!=window.location.pathname)if(91==e.keyCode||17==e.keyCode)Ue=!0;else if(Ue&&70==e.keyCode)Ue=!1,Je=!Je,e.preventDefault(),Je?($("#find_div").toggleClass("hide"),$("#find_input").focus()):($("#find_div").toggleClass("hide"),$("#find_input").val(""),$("#find_input").blur(),$(".highlight").removeClass("highlight"),tt=[],at=0);else if(32!=e.keyCode||!$(".search-container").hasClass("hide")||"/"==window.location.pathname||$("#text-chat-input").is(":focus")||$("#password").is(":focus")||$("#user-pass-input").is(":focus")||$("#chan_thumbnail").is(":focus")||$("#chan_description").is(":focus")||$("#contact-form-from").is(":focus")||$("#contact-form-message").is(":focus")||$("#remote_channel").is(":focus")||$("#import").is(":focus")||$("#import_spotify").is(":focus"))Ue=!1;else{if(1==kt.player.getPlayerState())return e.preventDefault(),kt.player.pauseVideo(),!1;if(2==kt.player.getPlayerState()||5==kt.player.getPlayerState())return e.preventDefault(),kt.player.playVideo(),!1}}),$(document).keyup(function(e){91!=e.keyCode&&17!=e.keyCode||Je||(Ue=!1)}),$(document).on("submit","#find_form",function(e){if(e.preventDefault(),0==tt.length){var t=this;at=0,tt=$.map(dt,function(e,a){if(e.title.toLowerCase().indexOf(t.find_value.value.toLowerCase())>=0)return a})}else at+=1,tt.length-10&&tt[at]!=dt.length-1){$(".highlight").removeClass("highlight");var a=Math.floor(tt[at]/J.can_fit);$($("#wrapper").children()[tt[at]]).addClass("highlight"),J.dynamicContentPageJumpTo(a)}else q.log("none found")});var bt={id:"",get_input:function(e){""===bt.id?bt.set_id(e.toLowerCase()):bt.set_channel(e.toLowerCase())},set_id:function(e){bt.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","inline-block"),$(".slider-vol-mobile").attr("style","display: inline-block !important")},set_channel:function(e){D.emit("id",{id:bt.id,type:"channel",value:e})},play_remote:function(){D.emit("id",{id:bt.id,type:"play",value:"mock"})},pause_remote:function(){D.emit("id",{id:bt.id,type:"pause",value:"mock"})},skip_remote:function(){D.emit("id",{id:bt.id,type:"skip",value:"mock"})},initiate_volume:function(){$("#volume-control-remote").slider({min:0,max:100,value:100,range:"min",animate:!0,stop:function(e,t){D.emit("id",{id:bt.id,type:"volume",value:t.value}),q.log("volume")}})}},kt={loaded:!0,before_load:"",after_load:"",player:"",stopInterval:!1,fireplace:"",youtube_listener:function(e){var t;Ie&&e.np&&window.parentWindow&&window.parentOrigin&&(window.parentWindow.postMessage({type:"np",title:e.np[0].title},window.parentOrigin),dt.length>0&&kt.sendNext({title:dt[0].title,videoId:dt[0].id}));try{t=kt.player.getPlayerState()}catch(e){t=null}if((!We&&(null!=t||Ne)||We&&(null==t||Ne)||!We&&(null==t||Ne)||We&&-1==t)&&(!We||Ke!=W)||We&&void 0==ht){Ke=W,Ne=!1,kt.loaded=!1,q.log("--------youtube_listener--------"),q.log("Received: "),q.log(e),q.log("paused variable: "+ve),q.log("mobile_beginning variable: "+lt);try{q.log("getVideoUrl(): "+kt.player.getVideoUrl().split("v=")[1])}catch(e){}if(q.log("video_id variable: "+ht),q.log("---------------------------------"),e.np){if(ve)kt.getTitle(e.np[0].title,pe),q.mobilecheck()||kt.notifyUser(e.np[0].id,e.np[0].title),Fe||kt.stopVideo(),ht=e.np[0].id,se=e.conf[0],time=e.time,ft=time-se.startTime,yt=e.np[0].title,duration=e.np[0].duration,kt.setBGimage(ht);else if(!ve){void 0===vt?vt=e.np[0].id:vt!=ht&&(vt=ht),ht=e.np[0].id,se=e.conf[0],time=e.time,ft=time-se.startTime,yt=e.np[0].title,duration=e.np[0].duration,lt&&q.mobilecheck()&&0===ft&&!Fe&&(ft=1);try{dt[0].id!=ht||lt||J.song_change(dt[0].added),Tt.fetchYoutubeSuggests(ht)}catch(e){}if(kt.getTitle(yt,pe),kt.setBGimage(ht),de&&!window.MSStream)try{(kt.player.getVideoUrl().split("v=")[1]!=ht||Fe)&&(kt.loadVideoById(ht,duration),q.mobilecheck()||kt.notifyUser(ht,yt),kt.seekTo(ft),ve&&!Fe&&kt.pauseVideo()),ve||(lt&&!Fe||kt.playVideo(),Le||kt.durationSetter()),(kt.player.getDuration()>ft||0===kt.player.getDuration()||Fe||kt.player.getCurrentTime()!=ft)&&kt.seekTo(ft),kt.after_load=ht,kt.loaded||setTimeout(function(){kt.loaded=!0},500)}catch(e){Fe&&(kt.loadVideoById(ht,duration),kt.seekTo(ft)),Le||Fe||kt.durationSetter()}else kt.getTitle(yt,pe)}}else{document.getElementById("song-title").innerHTML="Empty channel. Add some songs!",document.title="Zoff - the shared YouTube based radio",window.MSStream||Fe||$("#player_overlay").hasClass("hide")&&$("#player_overlay").removeClass("hide");try{Fe||kt.stopVideo()}catch(e){}}}else Le||kt.durationSetter(),duration=kt.player.getDuration()},onPlayerStateChange:function(e){q.log("-------onPlayerStateChange------"),q.log("New state\nState: "),q.log(e);try{q.log("Duration: "+kt.player.getDuration(),"Current time: "+kt.player.getCurrentTime()),q.log("getVideoUrl(): "+kt.player.getVideoUrl().split("v=")[1])}catch(e){}switch(q.log("video_id variable: "+ht),q.log("---------------------------------"),e.data){case-1:break;case 0:$e=!1,ve=!1,We?kt.playNext():D.emit("end",{id:ht,channel:W.toLowerCase(),pass:Ie?"":j.crypt_pass(j.get_userpass(W.toLowerCase()))});break;case 1:$e=!0,beginning&&q.mobilecheck()&&!Fe&&(kt.pauseVideo(),beginning=!1,lt=!1,setTimeout(function(){q.mobilecheck()&&($("#playpause").css("visibility","visible"),$("#playpause").css("pointer-events","all"),$("#channel-load").css("display","none"))},100)),Ie||"/"==window.location.pathname||Fe||q.addClass("#player_overlay","hide"),"/"!=window.location.pathname&&(1==document.getElementById("play").className.split(" ").length&&$("#play").toggleClass("hide"),2==document.getElementById("pause").className.split(" ").length&&$("#pause").toggleClass("hide")),ve&&!We&&(D.emit("pos",{channel:W.toLowerCase(),pass:Ie?"":j.crypt_pass(j.get_userpass(W.toLowerCase()))}),ve=!1);break;case 2:Fe||(ve=!0,"/"!=window.location.pathname&&Ct.play_pause_show(),lt=!0)}},playVideo:function(){Fe?(H.sendMessage("urn:x-cast:zoff.me",{type:"playVideo"}),chrome.cast.media.GenericMediaMetadata({metadataType:"GENERIC",title:yt,image:"https://img.youtube.com/vi/"+ht+"/mqdefault.jpg"}),chrome.cast.Image("https://img.youtube.com/vi/"+ht+"/mqdefault.jpg"),$("#pause").hasClass("hide")&&($("#play").toggleClass("hide"),$("#pause").toggleClass("hide"))):kt.player.playVideo()},pauseVideo:function(){Fe?(H.sendMessage("urn:x-cast:zoff.me",{type:"pauseVideo"}),$("#play").hasClass("hide")&&($("#play").toggleClass("hide"),$("#pause").toggleClass("hide"))):kt.player.pauseVideo()},seekTo:function(e){Fe?H.sendMessage("urn:x-cast:zoff.me",{type:"seekTo",seekTo:e}):We?kt.player.seekTo(0):kt.player.seekTo(e)},loadVideoById:function(e,t){Fe?(H.sendMessage("urn:x-cast:zoff.me",{type:"loadVideo",videoId:e}),chrome.cast.media.GenericMediaMetadata({metadataType:"GENERIC",title:yt,image:"https://img.youtube.com/vi/"+e+"/mqdefault.jpg"}),chrome.cast.Image("https://img.youtube.com/vi/"+e+"/mqdefault.jpg")):kt.player.loadVideoById({videoId:e,startSeconds:0,endSeconds:t})},stopVideo:function(){if(Fe)H.sendMessage("urn:x-cast:zoff.me",{type:"stopVideo"});else try{kt.player.stopVideo()}catch(e){}},setVolume:function(e){Fe?H.setVolume(e/100):kt.player.setVolume(e)},playNext:function(){var e=dt[0];ht=e.id,time=(new Date).getTime(),yt=e.title,duration=e.duration,kt.getTitle(yt,pe),kt.setBGimage(ht),Fe?(H.sendMessage("urn:x-cast:zoff.me",{type:"loadVideo",videoId:ht}),chrome.cast.media.GenericMediaMetadata({metadataType:"GENERIC",title:yt,image:"https://img.youtube.com/vi/"+ht+"/mqdefault.jpg"}),chrome.cast.Image("https://img.youtube.com/vi/"+ht+"/mqdefault.jpg")):kt.loadVideoById(ht,duration),J.channel_function({type:"song_change",time:time})},sendNext:function(e){Fe&&H.sendMessage("urn:x-cast:zoff.me",{type:"nextVideo",title:e.title,videoId:e.videoId}),Ie&&window.parentWindow&&window.parentOrigin&&window.parentWindow.postMessage({type:"nextVideo",title:e.title},window.parentOrigin)},getTitle:function(e,t){var a=decodeURIComponent(e);if("/"!=window.location.pathname){var n=document.getElementById("song-title"),s=document.getElementById("viewers");n.innerHTML=a,s.innerHTML="visibility "+t,n.title=a,Fe&&($("#player_overlay").css("background","url(https://img.youtube.com/vi/"+ht+"/hqdefault.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"))}document.title=a+" • Zoff / "+W},errorHandler:function(e){me||(5==e.data||100==e.data||101==e.data||150==e.data?(curr_playing=kt.player.getVideoUrl().replace("https://www.youtube.com/watch?v=",""),D.emit("skip",{error:e.data,id:ht,pass:""==le?"":j.crypt_pass(le),channel:W.toLowerCase(),userpass:Ie?"":j.crypt_pass(j.get_userpass(W.toLowerCase()))})):void 0!==ht&&kt.loadVideoById(ht,duration))},onPlayerReady:function(e){try{beginning=!0,de=!0,window.MSStream||(q.mobilecheck()?($("#playpause").css("visibility","hidden"),$("#playpause").css("pointer-events","none")):$("#channel-load").css("display","none"),$("#player").css("opacity","1"),$("#controls").css("opacity","1"),$(".playlist").css("opacity","1"),kt.loadVideoById(ht,duration),!Ee||q.mobilecheck()&&!Fe||kt.playVideo(),Le||kt.durationSetter(),Ie?setTimeout(function(){kt.player.seekTo(ft),Ee||(kt.player.pauseVideo(),Ct.play_pause_show())},1e3):kt.seekTo(ft)),kt.readyLooks(),Ct.initYoutubeControls(kt.player),Ct.initSlider(),kt.player.setVolume(j.get_volume()),$(".video-container").removeClass("no-opacity")}catch(e){}},readyLooks:function(){kt.setBGimage(ht)},setBGimage:function(e){if(void 0!==e&&!Ie){var t=new Image;t.onload=function(){var e=new ColorThief,a=e.getColor(t);"/"!=window.location.pathname&&(document.getElementById("main-container").style.backgroundColor=q.rgbToHsl(a,!0),$("meta[name=theme-color]").attr("content",q.rgbToHex(a[0],a[1],a[2])))},t.crossOrigin="Anonymous",t.src="https://zoff.me:8081/https://img.youtube.com/vi/"+e+"/mqdefault.jpg"}},set_width:function(e){if($(".video-container").width(e),!q.mobilecheck())if($(window).width()>769){var t=$(window).width()-$(".control-list").width()-$(".zbrand").outerWidth()-$(".brand-logo-navigate").outerWidth()-66;title_width=t,$(".title-container").width(title_width)}else $(".title-container").width("100%")},notifyUser:function(e,t){if(t=t.replace(/\\\'/g,"'").replace(/"/g,"'").replace(/&/g,"&"),"granted"===Notification.permission&&document.hidden&&!Ie){var a=new Notification("Now Playing",{body:t,icon:"https://i.ytimg.com/vi/"+e+"/mqdefault.jpg",iconUrl:"http://i.ytimg.com/vi/"+e+"/mqdefault.jpg"});a.onclick=function(e){window.focus(),this.cancel()},setTimeout(function(){a.close()},5e3)}},setup_all_listeners:function(){c(),l(),u(),h(),m()},onYouTubeIframeAPIReady:function(){kt.player=new YT.Player("player",{videoId:ht,playerVars:{rel:"0",wmode:"transparent",controls:"0",fs:"0",iv_load_policy:"3",theme:"light",color:"white",showinfo:0},events:{onReady:kt.onPlayerReady,onStateChange:kt.onPlayerStateChange,onError:kt.errorHandler}})},createFireplacePlayer:function(){kt.fireplace=new YT.Player("fireplace_player",{videoId:"L_LUpnjgPso",playerVars:{rel:"0",wmode:"transparent",controls:"0",fs:"0",iv_load_policy:"3",theme:"light",color:"white",showinfo:0},events:{onReady:kt.onFireplaceReady,onStateChange:kt.onFireplaceChange}})},onFireplaceReady:function(){kt.fireplace.playVideo()},onFireplaceChange:function(e){switch(e.data){case 0:kt.fireplace.seekTo(0),kt.fireplace.playVideo();break;case 2:kt.fireplace.playVideo()}},durationSetter:function(){try{fe||void 0===duration||(kt.stopInterval||(Le=!0),dMinutes=Math.floor(duration/60),dSeconds=duration-60*dMinutes,currDurr=void 0!==kt.player.getCurrentTime()?Math.floor(kt.player.getCurrentTime()):ft,currDurr>duration&&(currDurr=duration),minutes=Math.floor(currDurr/60),seconds=currDurr-60*minutes,document.getElementById("duration").innerHTML=q.pad(minutes)+":"+q.pad(seconds)+" / "+q.pad(dMinutes)+":"+q.pad(dSeconds),per=100/duration*currDurr,per>=100?per=100:0===duration&&(per=0),Ie&&window.parentWindow&&window.parentOrigin&&window.parentWindow.postMessage({type:"duration",duration:kt.player.getCurrentTime(),full_duration:kt.player.getDuration(),percent:per},window.parentOrigin),he||$("#bar").width(per+"%"))}catch(e){}kt.stopInterval||setTimeout(kt.durationSetter,1e3)},loadPlayer:function(){if(1==$("script[src='https://www.youtube.com/iframe_api']").length)try{kt.onYouTubeIframeAPIReady()}catch(e){console.error("Seems YouTube iFrame script isn't correctly loaded. Please reload the page.")}else pt=document.createElement("script"),pt.src="https://www.youtube.com/iframe_api",ut=document.getElementsByTagName("script")[0],ut.parentNode.insertBefore(pt,ut)}},Ct={stopInterval:!1,initYoutubeControls:function(){q.mobilecheck()&&!window.MSStream&&$("#controls").appendTo("#playbar"),Ct.initControls()},initControls:function(){document.getElementById("volume-button").addEventListener("click",Ct.mute_video),document.getElementById("playpause").addEventListener("click",Ct.play_pause),document.getElementById("volume-button-overlay").addEventListener("click",Ct.mute_video),document.getElementById("playpause-overlay").addEventListener("click",Ct.play_pause),document.getElementById("fullscreen").addEventListener("click",Ct.fullscreen)},initSlider:function(){try{vol=j.get_volume()}catch(e){}$("#volume").slider({min:0,max:100,value:vol,range:"min",animate:!0,slide:function(e,t){Ct.setVolume(t.value);try{j.set_volume(t.value)}catch(e){}}}),Ct.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(){Fe?Ct.play_pause_show():(console.log(kt.player.getPlayerState()),1==kt.player.getPlayerState()?(kt.pauseVideo(),q.mobilecheck()&&!window.MSStream&&(document.getElementById("player").style.display="none",$(".video-container").toggleClass("click-through"),$(".page-footer").toggleClass("padding-bottom-extra"))):2!=kt.player.getPlayerState()&&0!==kt.player.getPlayerState()&&5!==kt.player.getPlayerState()||(kt.playVideo(),q.mobilecheck()&&!window.MSStream&&(document.getElementById("player").style.display="block",$(".video-container").toggleClass("click-through"),$(".page-footer").toggleClass("padding-bottom-extra"))))},play_pause_show:function(){Fe?$("#play").hasClass("hide")?kt.pauseVideo():$("#pause").hasClass("hide")&&kt.playVideo():(1==document.getElementById("pause").className.split(" ").length&&($("#pause").toggleClass("hide"),$("#pause-overlay").toggleClass("hide")),2==document.getElementById("play").className.split(" ").length&&($("#play").toggleClass("hide"),$("#play-overlay").toggleClass("hide")))},settings:function(){$("#qS").toggleClass("hide")},changeQuality:function(e){kt.player.getPlaybackQuality!=e&&(kt.player.setPlaybackQuality(e),kt.player.getPlaybackQuality()),$("#qS").toggleClass("hide")},mute_video:function(){kt.player.isMuted()?(Fe&&H.sendMessage("urn:x-cast:zoff.me",{type:"unMute"}),kt.player.unMute(),Ct.choose_button(kt.player.getVolume(),!1)):(Fe&&H.sendMessage("urn:x-cast:zoff.me",{type:"mute"}),Ct.choose_button(0,!0),kt.player.mute())},setVolume:function(e){kt.setVolume(e),Ct.choose_button(e,!1),kt.player.isMuted()&&kt.player.unMute()},choose_button:function(e,t){t?(1==document.getElementById("v-full").className.split(" ").length&&($("#v-full").toggleClass("hide"),$("#v-full-overlay").toggleClass("hide")),1==document.getElementById("v-medium").className.split(" ").length&&($("#v-medium").toggleClass("hide"),$("#v-medium-overlay").toggleClass("hide")),1==document.getElementById("v-low").className.split(" ").length&&($("#v-low").toggleClass("hide"),$("#v-low-overlay").toggleClass("hide")),2==document.getElementById("v-mute").className.split(" ").length&&($("#v-mute").toggleClass("hide"),$("#v-mute-overlay").toggleClass("hide"))):e>=0&&e<=33?(1==document.getElementById("v-full").className.split(" ").length&&($("#v-full").toggleClass("hide"),$("#v-full-overlay").toggleClass("hide")),1==document.getElementById("v-medium").className.split(" ").length&&($("#v-medium").toggleClass("hide"),$("#v-medium-overlay").toggleClass("hide")),2==document.getElementById("v-low").className.split(" ").length&&($("#v-low").toggleClass("hide"),$("#v-low-overlay").toggleClass("hide")),1==document.getElementById("v-mute").className.split(" ").length&&($("#v-mute").toggleClass("hide"),$("#v-mute-overlay").toggleClass("hide"))):e>=34&&e<=66?(1==document.getElementById("v-full").className.split(" ").length&&($("#v-full").toggleClass("hide"),$("#v-full-overlay").toggleClass("hide")),2==document.getElementById("v-medium").className.split(" ").length&&($("#v-medium").toggleClass("hide"),$("#v-medium-overlay").toggleClass("hide")),1==document.getElementById("v-low").className.split(" ").length&&($("#v-low").toggleClass("hide"),$("#v-low-overlay").toggleClass("hide")),1==document.getElementById("v-mute").className.split(" ").length&&($("#v-mute").toggleClass("hide"),$("#v-mute-overlay").toggleClass("hide"))):e>=67&&e<=100&&(2==document.getElementById("v-full").className.split(" ").length&&($("#v-full").toggleClass("hide"),$("#v-full-overlay").toggleClass("hide")),1==document.getElementById("v-medium").className.split(" ").length&&($("#v-medium").toggleClass("hide"),$("#v-medium-overlay").toggleClass("hide")),1==document.getElementById("v-low").className.split(" ").length&&($("#v-low").toggleClass("hide"),$("#v-low-overlay").toggleClass("hide")),1==document.getElementById("v-mute").className.split(" ").length&&($("#v-mute").toggleClass("hide"),$("#v-mute-overlay").toggleClass("hide")))},playPause:function(){state=kt.player.getPlayerState(),button=document.getElementById("playpause"),1==state?kt.pauseVideo():2==state&&kt.playVideo()},volumeOptions:function(){Fe||(kt.player.isMuted()?(kt.player.unMute(),vol=kt.player.getVolume(),$("#volume").slider("value",kt.player.getVolume())):(kt.player.mute(),$("#volume").slider("value",0)))},hoverMute:function(e){vol=kt.player.getVolume()}},xt={submitArray:[],submitArrayExpected:null,showSearch:function(){$("#search-wrapper").toggleClass("hide"),q.mobilecheck()&&$(".search_input").focus(),$("#song-title").toggleClass("hide"),$("#results").empty(),"close"==$("#search-btn i").html()?$("#search-btn i").html("search"):$("#search-btn i").html("close"),$("#search").focus()},search:function(e,t,a){if(void 0!==it&&void 0!==ot||(it=$("#temp-results-container"),ot=$("#empty-results-container").html()),$(".search_results").html(""),""!==e){ae=!0;var n=encodeURIComponent(e),s="https://www.googleapis.com/youtube/v3/search?key="+te+"&videoEmbeddable=true&part=id&fields=items(id)&type=video&order=viewCount&safeSearch=none&maxResults=25";s+="&q="+n,oe&&(s+="&videoCategoryId=10");var i="https://www.googleapis.com/youtube/v3/videos?part=contentDetails,snippet,id&key="+te+"&id=";if(a)var s="https://www.googleapis.com/youtube/v3/search?part=snippet&maxResults=25&relatedToVideoId="+n+"&type=video&key="+te,i="https://www.googleapis.com/youtube/v3/videos?part=contentDetails,snippet,id&key="+te+"&id=";q.contains($(".search_loader_spinner").attr("class").split(" "),"active")||$(".search_loader_spinner").addClass("active"),q.contains($("#results").attr("class").split(" "),"hide")&&$("#results").removeClass("hide"),$.ajax({type:"GET",url:s,dataType:"jsonp",success:function(a){0===a.items.length?($("").appendTo($("#results")).show("blind",83.33),q.contains($(".search_loader_spinner").attr("class").split(" "),"active")&&$(".search_loader_spinner").removeClass("active")):a.items&&($.each(a.items,function(e,t){i+=t.id.videoId+","}),$.ajax({type:"GET",url:i,dataType:"jsonp",success:function(a){var n="",s=$(it);$.each(a.items,function(e,t){var a=t.contentDetails.duration;if(secs=xt.durationToSeconds(a),!longsongs||secs<720){gt=t.snippet.title,enc_title=gt,ct=t.id,a=a.replace("PT","").replace("H","h ").replace("M","m ").replace("S","s"),thumb=t.snippet.thumbnails.medium.url;var i=s;i.find(".search-title").text(gt),i.find(".result_info").text(a),i.find(".thumb").attr("src",thumb),i.find("#add-many").attr("data-video-id",ct),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",ct),i.find("#temp-results").attr("data-video-title",enc_title),i.find("#temp-results").attr("data-video-length",secs),i.find(".open-externally").attr("href","https://www.youtube.com/watch?v="+ct),void 0!=i.html()&&(n+=i.html())}}),n.length>0?($("").appendTo($("#results")).show("blind",83.33*(a.items.length-1)),q.contains($(".search_loader_spinner").attr("class").split(" "),"active")&&$(".search_loader_spinner").removeClass("active"),$(".add-many").click(function(e){return e.preventDefault(),e.stopPropagation(),!1})):t?($("").appendTo($("#results")).show("blind",83.33),q.contains($(".search_loader_spinner").attr("class").split(" "),"active")&&$(".search_loader_spinner").removeClass("active")):xt.search(e,!0)}}))}})}else $(".main").removeClass("blurT"),$("#controls").removeClass("blurT"),$(".main").removeClass("clickthrough")},backgroundSearch:function(e,t,a,n,s){var i=encodeURIComponent(e+" "+t),o="https://www.googleapis.com/youtube/v3/search?key="+te+"&videoEmbeddable=true&part=id,snippet&fields=items(id,snippet)&type=video&order=relevance&safeSearch=none&maxResults=10&videoCategoryId=10";o+="&q="+i;var l="https://www.googleapis.com/youtube/v3/videos?part=contentDetails,snippet,id&key="+te+"&id=";t=t.split(" ");var r=e.split("-");r=r.join(" ").split(" "),$.ajax({type:"GET",url:o,dataType:"jsonp",success:function(s){if(0===s.items.length){xt.readySubmit(!1,{totalLength:n-1}),q.log("------------------------------"),q.log("NO MATCH FOR:"),q.log("Spotify title: "+e+" "+t.join(" ")),q.log("Spotify length: "+a),q.log("------------------------------");var i=$("
    "+Pe+"
    ");i.find(".extra-add-text").text(e+" - "+t.join(" ")),i.find(".extra-add-text").attr("title",e+" - "+t.join(" ")),i.find(".extra-button-search").attr("data-text",e+" - "+t.join(" ")),$(".not-imported-container").append(i.html()),$(".not-imported").removeClass("hide")}else s.items.length>0&&($.each(s.items,function(e,t){l+=t.id.videoId+","}),$.ajax({type:"GET",url:l,dataType:"jsonp",success:function(s){if(s.items.length>0){var i=!1;if($.each(s.items,function(a,s){var o=xt.durationToSeconds(s.contentDetails.duration),l=!1;if($.each(r,function(a,n){return-1!=s.snippet.title.toLowerCase().indexOf(n.toLowerCase())&&-1==s.snippet.title.toLowerCase().indexOf("cover")&&-1==e.toLowerCase().indexOf("cover")&&(-1==s.snippet.title.toLowerCase().indexOf("remix")&&-1==e.toLowerCase().indexOf("remix")||-1!=s.snippet.title.toLowerCase().indexOf("remix")&&-1!=e.toLowerCase().indexOf("remix")||-1!=s.snippet.title.toLowerCase().indexOf(t[0].toLowerCase())||-1!=s.snippet.channelTitle.toLowerCase().indexOf(t[0].toLowerCase())||-1!=s.snippet.channelTitle.toLowerCase().indexOf("vevo"))||(l=!0),!1}),!l)return i=!0,xt.readySubmit(!0,{id:s.id,title:s.snippet.title,duration:o,totalLength:n-1}),!1}),!i){xt.readySubmit(!1,{totalLength:n-1}),q.log("------------------------------"),q.log("NO MATCH FOR:"),q.log("Spotify title: "+e+" "+t.join(" ")),q.log("Spotify length: "+a),q.log("------------------------------");var o=$("
    "+Pe+"
    ");o.find(".extra-add-text").text(e+" - "+t.join(" ")),o.find(".extra-add-text").attr("title",e+" - "+t.join(" ")),o.find(".extra-button-search").attr("data-text",e+" - "+t.join(" ")),$(".not-imported-container").append(o.html()),$(".not-imported").removeClass("hide")}}}}))}})},readySubmit:function(e,t){null===xt.submitArrayExpected&&(xt.submitArrayExpected=t.totalLength),e?xt.submitArray.push(t):xt.submitArrayExpected-=1,xt.submitArray.length-1==xt.submitArrayExpected&&($.each(xt.submitArray,function(e,t){xt.submit(t.id,t.title,t.duration,!0,e,xt.submitArray.length-1)}),document.getElementById("import_spotify").disabled=!1,$("#import_spotify").removeClass("hide"),$("#playlist_loader_spotify").addClass("hide"),xt.submitArray=[],xt.submitArrayExpected=null)},submitAndClose:function(e,t,a){xt.submit(e,t,a,!1,0,1),$("#results").html(""),xt.showSearch(),document.getElementById("search").value="",$("#results").html="",$(".main").removeClass("blurT"),$("#controls").removeClass("blurT"),$(".main").removeClass("clickthrough")},importPlaylist:function(e,t){token="";var a,n;void 0!==t&&(token="&pageToken="+t),playlist_url="https://www.googleapis.com/youtube/v3/playlistItems?part=contentDetails&maxResults=49&key="+te+"&playlistId="+e+token,He?(n="html",a={"Content-Type":"application/json",Authorization:"Bearer "+qe.access_token}):(a={},n="jsonp"),$.ajax({type:"GET",url:playlist_url,dataType:n,headers:a,success:function(a){if(a.error)if("playlistItemsNotAccessible"==a.error.errors[0].reason){var n=T(29);window.callback=function(a){qe=a,qe.state==n?(He=!0,setTimeout(function(){He=!1,qe={}},1e3*qe.expires_in),xt.importPlaylist(e,t)):(qe="",console.error("Nonce doesn't match")),youtube_window.close(),window.callback=""},youtube_window=window.open("/o_callback#youtube=true&nonce="+n,"","width=600, height=600")}else q.log(a.error),document.getElementById("import").disabled=!1,$("#playlist_loader").addClass("hide"),$("#import").removeClass("hide"),A(),Materialize.toast("It seems you've entered a invalid url.",4e3);else{var s="";"string"==typeof a&&(a=$.parseJSON(a)),$.each(a.items,function(e,t){s+=t.contentDetails.videoId+","}),xt.addVideos(s,!0),a.nextPageToken&&xt.importPlaylist(e,a.nextPageToken),document.getElementById("import").value=""}}})},importSpotifyPlaylist:function(e){$.ajax({url:e,headers:{Authorization:"Bearer "+Ve.access_token},success:function(e){$.each(e.items,function(t,a){xt.backgroundSearch(a.track.name,a.track.artists.map(function(e){return e.name}).join(" "),Math.floor(a.track.duration_ms/1e3),e.total,t+e.offset)}),e.next&&xt.importSpotifyPlaylist(e.next)},error:function(){document.getElementById("import_spotify").disabled=!1,$("#import_spotify").removeClass("hide"),$("#playlist_loader_spotify").addClass("hide"),A(),Materialize.toast("It seems you've entered a invalid url.",4e3)}})},addVideos:function(e,t){var a="https://www.googleapis.com/youtube/v3/videos?part=contentDetails,snippet,id&key=***REMOVED***&id=";a+=e,$.ajax({type:"POST",url:a,dataType:"jsonp",success:function(e){var a=0,n=[];$.each(e.items,function(e,s){var i=xt.durationToSeconds(s.contentDetails.duration);(!longsongs||i<720)&&(enc_title=s.snippet.title,a+=1,n.push({id:s.id,enc_title:enc_title,duration:i,playlist:t}))}),$.each(n,function(e,t){xt.submit(t.id,t.enc_title,t.duration,t.playlist,e,a)})}})},submit:function(e,t,a,n,s,i){if(We&&document.getElementsByName("addsongs")[0].checked&&document.getElementsByName("addsongs")[0].disabled){var o=[];o=$.map(dt,function(t,a){if(t.id==e)return a}),0==o.length?J.channel_function({type:"added",value:{added:(new Date).getTime()/1e3,guids:[1],id:e,title:t,duration:a,playlist:!1,now_playing:!1,votes:1}}):J.vote(e,"pos")}else D.emit("add",{id:e,title:decodeURIComponent(t),adminpass:""==le?"":j.crypt_pass(le),list:W.toLowerCase(),duration:a,playlist:n,num:s,total:i,pass:Ie?"":j.crypt_pass(j.get_userpass(W.toLowerCase()))})},durationToSeconds:function(e){var t=e.match(ne);return hours=parseInt(t[12])||0,minutes=parseInt(t[14])||0,seconds=parseInt(t[16])||0,60*hours*60+60*minutes+seconds}},Tt={catchUserSuggests:function(e,t){Xe+=t?1:e.length;var a=Xe>9?"9+":Xe;if($(".suggested-link span.badge.new.white").hasClass("hide")&&Xe>0&&$(".suggested-link span.badge.new.white").removeClass("hide"),$(".suggested-link span.badge.new.white").text(a),t)Tt.createSuggested(e);else for(var n in e)Tt.createSuggested(e[n]);Tt.checkUserEmpty()},createSuggested:function(e){var t=q.secondsToOther(e.duration),a=e.id,n=e.title,s=J.generateSong({id:a,title:n,length:e.duration,duration:t},!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="+te,a="https://www.googleapis.com/youtube/v3/videos?part=contentDetails,snippet,id&key="+te+"&id=";$.ajax({type:"GET",url:t,dataType:"jsonp",success:function(e){$.each(e.items.slice(0,5),function(e,t){a+=t.id.videoId+","}),$.ajax({type:"GET",url:a,dataType:"jsonp",success:function(e){$("#suggest-song-html").empty(),$.each(e.items,function(e,t){var a=t.contentDetails.duration,n=xt.durationToSeconds(a);a=q.secondsToOther(xt.durationToSeconds(a));var s=t.id,i=t.snippet.title;$("#suggest-song-html").append(J.generateSong({id:s,title:i,length:n,duration:a},!1,!1,!1))})}})}})},checkUserEmpty:function(){0===$("#user-suggest-html").children().length?q.contains($("#user_suggests").attr("class").split(" "),"hide")||$("#user_suggests").addClass("hide"):$("#user_suggests").removeClass("hide")}}}(); \ No newline at end of file diff --git a/server/public/assets/js/admin.js b/server/public/assets/js/admin.js index 3afc2f19..67c14e0f 100755 --- a/server/public/assets/js/admin.js +++ b/server/public/assets/js/admin.js @@ -146,6 +146,7 @@ var Admin = { }); } } + List.dragging(true); $('ul.playlist-tabs-loggedIn').tabs('select_tab', $(".playlist-tabs li a.active").attr("href").substring(1)); }, @@ -227,6 +228,8 @@ var Admin = { $(".playlist-tabs").removeClass("hide"); } + List.dragging(false); + /*if($(".card-action").length !== 0 && !Helper.contains($(".card-action").attr("class").split(" "), "hide") && !offline){ $(".card-action").addClass("hide"); diff --git a/server/public/assets/js/helpers.js b/server/public/assets/js/helpers.js index bdc0fde0..ce9d124f 100755 --- a/server/public/assets/js/helpers.js +++ b/server/public/assets/js/helpers.js @@ -240,7 +240,45 @@ var Helper = { $("#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);*/ } - } + }, + + firstY: null, + lastY: null, + currentY: null, + vertScroll: false, + initAdjustment: 0, + + touchstart: function(event) { + Helper.lastY = Helper.currentY = Helper.firstY = event.originalEvent.touches[0].pageY; + }, + + touchmove: function(event) { + Helper.currentY = event.originalEvent.touches[0].pageY; + var adjustment = Helper.lastY-Helper.currentY; + + // Mimic native vertical scrolling where scrolling only starts after the + // cursor has moved up or down from its original position by ~30 pixels. + if (!Helper.vertScroll && Math.abs(Helper.currentY-Helper.firstY) > 30) { + Helper.vertScroll = true; + Helper.initAdjustment = Helper.currentY-Helper.firstY; + } + + // only apply the adjustment if the user has met the threshold for vertical scrolling + if (Helper.vertScroll) { + window.scrollBy(0,adjustment + Helper.initAdjustment); + Helper.lastY = Helper.currentY + adjustment; + } + + }, + + touchend: function(event) { + Helper.vertScroll = false; + Helper.firstY = null; + Helper.currentY = null; + Helper.vertScroll = false; + Helper.initAdjustment = 0; + Helper.currentY = null; + }, }; diff --git a/server/public/assets/js/list.js b/server/public/assets/js/list.js index 105b0305..581d4847 100755 --- a/server/public/assets/js/list.js +++ b/server/public/assets/js/list.js @@ -8,6 +8,76 @@ var List = { not_found: [], num_songs: 0, + dragging: function(enabled) { + if(!enabled) { + var jqDraggableItem = $(".list-song"); + try { + $(".list-song").draggable("destroy"); + } catch(e) {} + + jqDraggableItem.off("touchstart", Helper.touchstart); + jqDraggableItem.off("touchmove", Helper.touchmove); + jqDraggableItem.off("touchend", Helper.touchend); + } else { + if(Helper.mobilecheck()) { + var jqDraggableItem = $(".list-song"); + try { + $(".list-song").draggable("destroy"); + } catch(e) {} + + jqDraggableItem.off("touchstart", Helper.touchstart); + jqDraggableItem.off("touchmove", Helper.touchmove); + jqDraggableItem.off("touchend", Helper.touchend); + $( ".list-song" ).draggable({ + axis:"x", + containment: [-50, 0, 10, 0], + scroll: true, + stop: function(event, ui) { + if(ui.offset.left == -50) { + try { + navigator.vibrate = navigator.vibrate || navigator.webkitVibrate || navigator.mozVibrate || navigator.msVibrate; + + if (navigator.vibrate) { + navigator.vibrate(100); + } + } catch(e) { + //console.log(e); + } + $(".accept-delete").attr("data-video-id", $(this).attr("data-video-id")); + $("#delete_song_title").html($(this).find(".list-title").html()); + $("#delete_song_alert").modal("open"); + + var that = this; + $(this).addClass("side_away"); + $(this).css("left", "0px"); + setTimeout(function() { + $(that).removeClass("side_away"); + }, 300); + + } else { + var that = this; + $(this).addClass("side_away"); + $(this).css("left", "0px"); + setTimeout(function() { + $(that).removeClass("side_away"); + }, 300); + } + } + }); + + // record the initial position of the cursor on start of the touch + jqDraggableItem.on("touchstart", Helper.touchstart); + + // fires whenever the cursor moves + jqDraggableItem.on("touchmove", Helper.touchmove); + + // when the user lifts their finger, they will again need to meet the + // threshold before vertical scrolling starts. + jqDraggableItem.on("touchend", Helper.touchend); + } + } + }, + channel_function: function(msg) { if(user_auth_started) { @@ -18,31 +88,35 @@ var List = { { case "list": //if(full_playlist == undefined || !offline){ - if((!offline || (offline && !msg.shuffled)) && !(offline && prev_chan_list == chan)){ - prev_chan_list = chan; - List.populate_list(msg.playlist); - Player.sendNext({title: full_playlist[0].title, videoId: full_playlist[0].id}); - } else if(offline && prev_chan_list == chan && full_playlist != undefined && !msg.shuffled){ - List.populate_list(full_playlist, true); + if((!offline || (offline && !msg.shuffled)) && !(offline && prev_chan_list == chan)){ + prev_chan_list = chan; + List.populate_list(msg.playlist); Player.sendNext({title: full_playlist[0].title, videoId: full_playlist[0].id}); - } - break; + } else if(offline && prev_chan_list == chan && full_playlist != undefined && !msg.shuffled){ + List.populate_list(full_playlist, true); + Player.sendNext({title: full_playlist[0].title, videoId: full_playlist[0].id}); + } + if(!w_p) List.dragging(true); + break; case "added": - List.added_song(msg.value); - Player.sendNext({title: full_playlist[0].title, videoId: full_playlist[0].id}); - break; - case "deleted": - List.deleted_song(msg.value, msg.removed); - break; - case "vote": - if(!offline){ - List.voted_song(msg.value, msg.time); + List.added_song(msg.value); Player.sendNext({title: full_playlist[0].title, videoId: full_playlist[0].id}); - } - break; + if(!w_p) List.dragging(true); + break; + case "deleted": + List.deleted_song(msg.value, msg.removed); + break; + case "vote": + if(!offline){ + List.voted_song(msg.value, msg.time); + Player.sendNext({title: full_playlist[0].title, videoId: full_playlist[0].id}); + } + if(!w_p) List.dragging(true); + break; case "song_change": - if(window.location.pathname != "/") List.song_change(msg.time, msg.remove); - Player.sendNext({title: full_playlist[0].title, videoId: full_playlist[0].id}); + if(window.location.pathname != "/") List.song_change(msg.time, msg.remove); + Player.sendNext({title: full_playlist[0].title, videoId: full_playlist[0].id}); + if(!w_p) List.dragging(true); break; } }, @@ -95,12 +169,15 @@ var List = { } else if(embed) { List.can_fit = Math.round(($("#wrapper").height()) / 91) + 1; List.element_height = (($("#wrapper").height()) / List.can_fit)-4; - }else { + } else { List.can_fit = Math.round(($(window).height() - $(".tabs").height() - $("header").height() - 64 - 8) / 71)+1; List.element_height = (($(window).height() - $(".tabs").height() - $("header").height() - 64 - 8) / List.can_fit)-5; } if(List.element_height < 55.2){ + List.can_fit = List.can_fit - 1; List.element_height = 55.2; + List.can_fit = Math.round(($(window).height() - $(".tabs").height() - $("header").height() - 64 - 8) / 71); + List.element_height = (($(window).height() - $(".tabs").height() - $("header").height() - 64 - 8) / List.can_fit)-5; } if(list_html === undefined) list_html = $("#list-song-html").html(); full_playlist = msg; @@ -358,6 +435,7 @@ var List = { //if(removed) { if(List.page <= index && List.page - List.can_fit <= index) { $("#" + deleted).addClass("side_away"); + $("#" + deleted).find(".mobile-delete").remove(); $("#" + deleted).css("transform", "translateX(-100%)"); setTimeout(function() { $("#" + deleted).remove(); @@ -890,6 +968,12 @@ var List = { } + if(Helper.mobilecheck()) { + song.find(".waves-effect").removeClass("waves-effect"); + song.find(".waves-light").removeClass("waves-light"); + + } + song.find(".list-title").text(video_title); song.find(".list-title").attr("title", video_title); //song.find(".vote-container").attr("onclick", "vote('"+video_id+"','pos')"); diff --git a/server/public/assets/js/listeners.js b/server/public/assets/js/listeners.js index feb7c574..30842195 100755 --- a/server/public/assets/js/listeners.js +++ b/server/public/assets/js/listeners.js @@ -208,6 +208,9 @@ function init(){ $("#help").modal(); $("#contact").modal(); $("#embed").modal(); + $("#delete_song_alert").modal({ + dismissible: false + }); $("#user_password").modal({ dismissible: false }); @@ -296,8 +299,9 @@ function init(){ if(Player.player === "" || Player.player === undefined || Helper.mobilecheck()) Player.loadPlayer(); //} - if(Helper.mobilecheck()) Mobile_remote.initiate_volume(); - else { + if(Helper.mobilecheck()) { + Mobile_remote.initiate_volume(); + } else { $('input#chan_description').characterCounter(); } @@ -912,6 +916,15 @@ function seekToClick(e){ } } +$(document).on("click", ".accept-delete", function(e) { + e.preventDefault(); + var delete_id = $(this).attr("data-video-id"); + if(delete_id) { + List.vote(delete_id, 'del'); + } + $("#delete_song_alert").modal("close"); +}); + $(document).keyup(function(event) { if(event.keyCode == 27){ $("#results").html(""); diff --git a/server/public/layouts/channel.handlebars b/server/public/layouts/channel.handlebars index d4a0843b..3b535c39 100755 --- a/server/public/layouts/channel.handlebars +++ b/server/public/layouts/channel.handlebars @@ -106,6 +106,16 @@ Submit
    +