diff --git a/.gitignore b/.gitignore index 1eae34cf..70253697 100755 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -static/images/thumbnails/ +public/images/thumbnails/ node_modules/ scripts/ .DS_Store diff --git a/.htaccess b/.htaccess index 64caf4ed..ea8871cc 100755 --- a/.htaccess +++ b/.htaccess @@ -10,24 +10,31 @@ RewriteCond %{HTTPS} !=on RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [L] RewriteCond %{HTTP_HOST} ^remote.zoff.no -RewriteCond %{REQUEST_URI} !/static -RewriteRule ^(.*)$ php/controller.php [L,NC,QSA] +#RewriteCond %{REQUEST_URI} !/public +RewriteRule ^(.*)$ /public/php/controller.php [L,NC,QSA] RewriteCond %{HTTP_HOST} ^bot.zoff.no -RewriteCond %{REQUEST_URI} !/static -RewriteRule ^(.*)$ php/bot.php [L,NC,QSA] +#RewriteCond %{REQUEST_URI} !/public +RewriteRule ^(.*)$ /public/php/bot.php [L,NC,QSA] RewriteCond %{HTTP_HOST} ^zoff.no RewriteCond %{REQUEST_URI} /o_callback -RewriteRule ^(.*)$ php/callback.html [L,NC,QSA] +RewriteRule ^(.*)$ public/html/callback.html [L,NC,QSA] + +RewriteCond %{HTTP_HOST} ^zoff.no +RewriteCond %{REQUEST_URI} /_embed +RewriteRule ^(.*)$ public/html/embed.html [L,NC,QSA] RewriteCond %{HTTP_HOST} ^localhost RewriteCond %{REQUEST_URI} /o_callback -RewriteRule ^(.*)$ php/callback.html [L,NC,QSA] +RewriteRule ^(.*)$ /public/html/callback.html [L,NC,QSA] +RewriteCond %{HTTP_HOST} ^localhost +RewriteCond %{REQUEST_URI} /_embed +RewriteRule ^(.*)$ /public/html/embed.html [L,NC,QSA] -#RewriteRule (?i)^remote/(.*) php/controller.php?id=$1 [L] -#RewriteRule (?i)^remote php/controller.php [L] +#RewriteRule (?i)^remote/(.*) /public/php/controller.php?id=$1 [L] +#RewriteRule (?i)^remote /public/php/controller.php [L] RewriteCond %{REQUEST_URI} !(/$|\.) RewriteRule (.*) %{REQUEST_URI}/ [R=301,L] diff --git a/gulpfile.js b/gulpfile.js index c814f15f..55e16dd5 100755 --- a/gulpfile.js +++ b/gulpfile.js @@ -4,65 +4,65 @@ var gulp = require('gulp'), concat = require('gulp-concat'); gulp.task('js', function () { - gulp.src(['static/js/*.js', '!static/js/embed*', '!static/js/remotecontroller.js', '!static/js/callback.js']) + gulp.src(['public/js/*.js', '!public/js/embed*', '!public/js/remotecontroller.js', '!public/js/callback.js']) .pipe(uglify({ mangle: true, compress: true, enclose: true })) .pipe(concat('main.min.js')) - .pipe(gulp.dest('static/dist')); + .pipe(gulp.dest('public/dist')); }); gulp.task('embed', function () { - gulp.src(['static/js/player.js', 'static/js/helpers.js', 'static/js/playercontrols.js', 'static/js/list.js', 'static/js/embed.js', '!static/js/nochan*', '!static/js/remotecontroller.js']) + gulp.src(['public/js/player.js', 'public/js/helpers.js', 'public/js/playercontrols.js', 'public/js/list.js', 'public/js/embed.js', '!public/js/nochan*', '!public/js/remotecontroller.js']) .pipe(uglify({ mangle: true, compress: true, enclose: true })) .pipe(concat('embed.min.js')) - .pipe(gulp.dest('static/dist')); + .pipe(gulp.dest('public/dist')); }); gulp.task('callback', function () { - gulp.src(['static/js/callback.js']) + gulp.src(['public/js/callback.js']) .pipe(uglify({ mangle: true, compress: true, enclose: true })) .pipe(concat('callback.min.js')) - .pipe(gulp.dest('static/dist')); + .pipe(gulp.dest('public/dist')); }); /* gulp.task('nochan', function () { - gulp.src(['static/js/nochan.js', 'static/js/helpers.js']) + gulp.src(['public/js/nochan.js', 'public/js/helpers.js']) .pipe(uglify({ mangle: true, compress: true, enclose: true })) .pipe(concat('frontpage.min.js')) - .pipe(gulp.dest('static/dist')); + .pipe(gulp.dest('public/dist')); });*/ gulp.task('remotecontroller', function () { - gulp.src(['static/js/remotecontroller.js']) + gulp.src(['public/js/remotecontroller.js']) .pipe(uglify({ mangle: true, compress: true, enclose: true })) .pipe(concat('remote.min.js')) - .pipe(gulp.dest('static/dist')); + .pipe(gulp.dest('public/dist')); }); gulp.task('default', function(){ - gulp.watch('static/js/*.js', ['js']); - gulp.watch('static/js/*.js', ['embed']); - gulp.watch(['static/js/callback.js', 'static/js/helpers.js'], ['callback']); - //gulp.watch('static/js/*.js', ['nochan']); - gulp.watch('static/js/remotecontroller.js', ['remotecontroller']); + gulp.watch('public/js/*.js', ['js']); + gulp.watch('public/js/*.js', ['embed']); + gulp.watch(['public/js/callback.js', 'public/js/helpers.js'], ['callback']); + //gulp.watch('public/js/*.js', ['nochan']); + gulp.watch('public/js/remotecontroller.js', ['remotecontroller']); }); diff --git a/index.php b/index.php old mode 100755 new mode 100644 index 220c078d..28e359d6 --- a/index.php +++ b/index.php @@ -3,304 +3,6 @@ $guid=substr(base64_encode(crc32($_SERVER['HTTP_USER_AGENT'].$_SERVER['REMOTE_ADDR'].$_SERVER['HTTP_ACCEPT_LANGUAGE'])), 0, 8); if(isset($_GET['chan'])) {header('Location: '.$_GET['chan']); exit;} $list = explode("/", htmlspecialchars(strtolower($_SERVER["REQUEST_URI"]))); - if($list[1]==""||!isset($list[1])||count($list)<=1){$list="";include('php/nochan.php');die();} - else $list=preg_replace("/[^A-Za-z0-9 ]/", '', $list[1]); + if($list[1]==""||!isset($list[1])||count($list)<=1){$list="";include('public/php/nochan.php');die();} + else{$list=preg_replace("/[^A-Za-z0-9 ]/", '', $list[1]);include('public/php/channel.php');die();} ?> - - - - - - - -
- - - -
-
-
-
-
-
-
- -
-
-
-
- -
-
-
-
- Waiting for Video -
-
-
- - -
-
- - - - -
-
-
-
-
- - -
-
-
- -
- - -
- - - - -
-
-
-
-
-
-
-
-
Top
-
Bottom
- - -
-
-
-
- - - - - - - -  votes - - -
-
- Delete -
-
-
-
- - -
-
-
-
-
- - - - diff --git a/manifest.json b/manifest.json index 115bdcfd..37c7bd0f 100755 --- a/manifest.json +++ b/manifest.json @@ -3,7 +3,7 @@ "name": "Zöff", "icons": [ { - "src": "static/images/144x144.png", + "src": "public/images/144x144.png", "sizes": "144x144", "type": "image/png" } diff --git a/static/css/embed.css b/public/css/embed.css similarity index 98% rename from static/css/embed.css rename to public/css/embed.css index fa058f20..95c19223 100755 --- a/static/css/embed.css +++ b/public/css/embed.css @@ -150,7 +150,7 @@ position: absolute; top: -47px; left: 10px; - background-image: url('static/images/squareicon_small.png'); + background-image: url('public/images/squareicon_small.png'); width: 50px; height: 50px; background-position: center; diff --git a/static/css/materialize.css b/public/css/materialize.css similarity index 100% rename from static/css/materialize.css rename to public/css/materialize.css diff --git a/static/css/materialize.min.css b/public/css/materialize.min.css similarity index 100% rename from static/css/materialize.min.css rename to public/css/materialize.min.css diff --git a/static/css/style.css b/public/css/style.css similarity index 99% rename from static/css/style.css rename to public/css/style.css index 982cc37c..4e21e49f 100755 --- a/static/css/style.css +++ b/public/css/style.css @@ -1996,7 +1996,7 @@ nav ul li:hover, nav ul li.active { pointer-events: none; background: none; font-family: Androgyne; - background-image: url('static/images/s1.png'), url('static/images/s2.png'), url('static/images/s3.png'); + background-image: url('public/images/s1.png'), url('public/images/s2.png'), url('public/images/s3.png'); height: 100%; left: 0; position: absolute; diff --git a/static/dist/callback.min.js b/public/dist/callback.min.js similarity index 100% rename from static/dist/callback.min.js rename to public/dist/callback.min.js diff --git a/public/dist/embed.min.js b/public/dist/embed.min.js new file mode 100755 index 00000000..8a8925e7 --- /dev/null +++ b/public/dist/embed.min.js @@ -0,0 +1,2 @@ +!function(){function e(){s.on("np",n.youtube_listener)}function t(){s.on("channel",p.channel_function)}function a(e){$("#volume").slider("value",e),d.setVolume(e)}var n={loaded:!0,before_load:"",after_load:"",player:"",stopInterval:!1,youtube_listener:function(e){n.loaded=!1,o.log("--------youtube_listener--------"),o.log("Received: "),o.log(e),o.log("paused variable: "+h),o.log("mobile_beginning variable: "+C);try{o.log("getVideoUrl(): "+n.player.getVideoUrl().split("v=")[1])}catch(e){}if(o.log("video_id variable: "+l),o.log("---------------------------------"),e.np){if(h)n.getTitle(e.np[0].title,viewers),o.mobilecheck()||n.notifyUser(e.np[0].id,e.np[0].title),console.log("trying to stop"),S||n.stopVideo();else if(!h){void 0===c?c=e.np[0].id:c!=l&&(c=l),l=e.np[0].id,conf=e.conf[0],time=e.time,i=time-conf.startTime,u=e.np[0].title,duration=e.np[0].duration,C&&o.mobilecheck()&&0===i&&!S&&(i=1);try{full_playlist[0].id==l&&p.song_change(full_playlist[0].added),Suggestions.fetchYoutubeSuggests(l)}catch(e){}if(n.getTitle(u,viewers),n.setBGimage(l),m&&!window.MSStream)try{(n.player.getVideoUrl().split("v=")[1]!=l||S)&&(n.loadVideoById(l),o.mobilecheck()||n.notifyUser(l,u),n.seekTo(i),h&&!S&&n.pauseVideo()),h||(C&&!S||n.playVideo(),x||n.durationSetter()),(n.player.getDuration()>i||0===n.player.getDuration()||S)&&n.seekTo(i),n.after_load=l,n.loaded||setTimeout(function(){n.loaded=!0},500)}catch(e){S&&(n.loadVideoById(l),n.seekTo(i)),x||S||n.durationSetter()}else n.getTitle(u,viewers)}}else{document.getElementById("song-title").innerHTML="Empty channel. Add some songs!",$("#player_overlay").height($("#player").height()),window.MSStream||S||$("#player_overlay").toggleClass("hide");try{S||n.stopVideo()}catch(e){}}},onPlayerStateChange:function(e){o.log("-------onPlayerStateChange------"),o.log("New state\nState: "),o.log(e);try{o.log("Duration: "+n.player.getDuration(),"Current time: "+n.player.getCurrentTime()),o.log("getVideoUrl(): "+n.player.getVideoUrl().split("v=")[1])}catch(e){}switch(o.log("video_id variable: "+l),o.log("---------------------------------"),e.data){case-1:break;case 0:playing=!1,h=!1,s.emit("end",{id:l,channel:T.toLowerCase()});break;case 1:playing=!0,beginning&&o.mobilecheck()&&!S&&(n.pauseVideo(),beginning=!1,C=!1),_||"/"==window.location.pathname||S||o.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")),h&&(s.emit("pos",{channel:T.toLowerCase()}),h=!1);break;case 2:S||(h=!0,"/"!=window.location.pathname&&d.play_pause_show(),C=!0);break;case 3:}},playVideo:function(){S?(castSession.sendMessage("urn:x-cast:zoff.no",{type:"playVideo"}),$("#pause").hasClass("hide")&&($("#play").toggleClass("hide"),$("#pause").toggleClass("hide"))):n.player.playVideo()},pauseVideo:function(){S?(castSession.sendMessage("urn:x-cast:zoff.no",{type:"pauseVideo"}),$("#play").hasClass("hide")&&($("#play").toggleClass("hide"),$("#pause").toggleClass("hide"))):n.player.pauseVideo()},seekTo:function(e){S?castSession.sendMessage("urn:x-cast:zoff.no",{type:"seekTo",seekTo:e}):n.player.seekTo(e)},loadVideoById:function(e){S?castSession.sendMessage("urn:x-cast:zoff.no",{type:"loadVideo",videoId:e}):n.player.loadVideoById(e)},stopVideo:function(){S?castSession.sendMessage("urn:x-cast:zoff.no",{type:"stopVideo"}):n.player.stopVideo()},setVolume:function(e){S?castSession.setVolume(e/100):n.player.setVolume(e)},sendNext:function(e){S&&castSession.sendMessage("urn:x-cast:zoff.no",{type:"nextVideo",title:e.title,videoId:e.videoId})},getTitle:function(e,t){var a=t>1?"viewers":"viewer",n=decodeURIComponent(e);if("/"!=window.location.pathname){var o=document.getElementById("song-title"),i=document.getElementById("viewers");o.innerHTML=n,i.innerHTML=t+" "+a,o.title=n,S&&($("#player_overlay").css("background","url(https://img.youtube.com/vi/"+l+"/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"),$("#player_overlay").css("height","calc(100% - 32px)"))}document.title=n+" • Zöff / "+T},errorHandler:function(e){5==e.data||100==e.data||101==e.data||150==e.data?(curr_playing=n.player.getVideoUrl().replace("https://www.youtube.com/watch?v=",""),s.emit("skip",{error:e.data,id:l,pass:k,channel:T.toLowerCase})):void 0!==l&&n.loadVideoById(l)},onPlayerReady:function(e){$("#channel-load").css("display","none");try{beginning=!0,m=!0,window.MSStream||($("#player").css("opacity","1"),$("#controls").css("opacity","1"),$(".playlist").css("opacity","1"),n.loadVideoById(l),!E||o.mobilecheck()&&!S||n.playVideo(),x||n.durationSetter(),_?setTimeout(function(){n.player.seekTo(i),E||(n.player.pauseVideo(),d.play_pause_show())},1e3):n.seekTo(i)),n.readyLooks(),d.initYoutubeControls(n.player),d.initSlider(),n.player.setVolume(Crypt.get_volume()),$(".video-container").removeClass("no-opacity")}catch(e){}},readyLooks:function(){n.setBGimage(l)},setBGimage:function(e){if(void 0!==e&&!_){var t=new Image;t.onload=function(){var e=new ColorThief,a=e.getColor(t);"/"!=window.location.pathname&&(document.getElementsByTagName("body")[0].style.backgroundColor=o.rgbToHsl(a,!0),$("meta[name=theme-color]").attr("content",o.rgbToHex(a[0],a[1],a[2])))},t.crossOrigin="Anonymous",t.src="https://zoff.no:8080/https://img.youtube.com/vi/"+e+"/mqdefault.jpg"}},set_width:function(e){$(".video-container").width(e)},notifyUser:function(e,t){if(t=t.replace(/\\\'/g,"'").replace(/"/g,"'").replace(/&/g,"&"),"granted"===Notification.permission&&document.hidden){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(),e(),setup_admin_listener(),setup_chat_listener(),t()},onYouTubeIframeAPIReady:function(){n.player=new YT.Player("player",{videoId:l,playerVars:{rel:"0",wmode:"transparent",controls:"0",fs:"0",iv_load_policy:"3",theme:"light",color:"white",showinfo:0},events:{onReady:n.onPlayerReady,onStateChange:n.onPlayerStateChange,onError:n.errorHandler}})},durationSetter:function(){if(void 0!==duration)try{n.stopInterval||(x=!0),dMinutes=Math.floor(duration/60),dSeconds=duration-60*dMinutes,currDurr=void 0!==n.player.getCurrentTime()?Math.floor(n.player.getCurrentTime()):i,currDurr>duration&&(currDurr=duration),minutes=Math.floor(currDurr/60),seconds=currDurr-60*minutes,document.getElementById("duration").innerHTML=o.pad(minutes)+":"+o.pad(seconds)+" / "+o.pad(dMinutes)+":"+o.pad(dSeconds),per=100/duration*currDurr,per>=100?per=100:0===duration&&(per=0),$("#bar").width(per+"%")}catch(e){}n.stopInterval||setTimeout(n.durationSetter,1e3)},loadPlayer:function(){if(1==$("script[src='https://www.youtube.com/iframe_api']").length)try{n.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)}},o={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 function(t){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4)))&&(e=!0)}(navigator.userAgent||navigator.vendor||window.opera),e},predicate:function(){for(var e,t,a,n=[],o=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&&(s.removeAllListeners(),s.disconnect(),s.connect(),n.setup_all_listeners()),lastSample=Date.now(),setTimeout(o.sample,SAMPLE_RATE)},loadjsfile:function(e){if(filesadded.indexOf("["+e+"]")==-1){var t=document.createElement("script");t.setAttribute("type","text/javascript"),t.setAttribute("src",e),document.getElementsByTagName("head")[0].appendChild(t),filesadded+="["+e+"]"}},msieversion:function(){var e=window.navigator.userAgent,t=e.indexOf("MSIE ");return!!(t>0||navigator.userAgent.match(/Trident.*rv\:11\./))},getRandomInt:function(e,t){return Math.floor(Math.random()*(t-e))+e},rgbToHsl:function(e,t){r=e[0],g=e[1],b=e[2],r/=255,g/=255,b/=255;var a,n,o=Math.max(r,g,b),i=Math.min(r,g,b),s=(o+i)/2;if(o==i)a=n=0;else{var l=o-i;switch(n=s>.5?l/(2-o-i):l/(o+i),o){case r:a=(g-b)/l+(g.5&&t?s=.5:s<.65&&!t&&(s=.65),"hsl("+Math.floor(360*a)+", "+Math.floor(100*n)+"%, "+Math.floor(100*s)+"%)"},componentToHex:function(e){var t=e.toString(16);return 1==t.length?"0"+t:t},rgbToHex:function(e,t,a){return"#"+o.componentToHex(e)+o.componentToHex(t)+o.componentToHex(a)},upperFirst:function(e){return e.substring(0,1).toUpperCase()+e.substring(1).toLowerCase()},addClass:function(e,t){o.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:"/public/php/mail.php",success:function(e){"success"==e?($("#contact-container").empty(),$("#contact-container").html("Mail has been sent, we'll be back with you shortly.")):($("#contact-container").empty(),$("#contact-container").html("Something went wrong, sorry about that. You could instead try with your own mail-client: contact@zoff.no"))}}))}};$(document).on("submit","#contact-form",function(e){e.preventDefault();var t=$("#contact-form-message").val(),a=$("#contact-form-from").val();o.send_mail(a,t)}),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=n.player.getPlayerState(),button=document.getElementById("playpause"),1==state?n.pauseVideo():2==state&&n.playVideo()},volumeOptions:function(){S||(n.player.isMuted()?(n.player.unMute(),w=n.player.getVolume(),$("#volume").slider("value",n.player.getVolume())):(n.player.mute(),$("#volume").slider("value",0)))},hoverMute:function(e){w=n.player.getVolume()}},p={empty:!1,page:0,can_fit:Math.round($("#wrapper").height()/71),element_height:$("#wrapper").height()/Math.round($("#wrapper").height()/71)-25,channel_function:function(e){switch(e.type){case"list":p.populate_list(e.playlist),S&&n.sendNext({title:full_playlist[0].title,videoId:full_playlist[0].id});break;case"added":p.added_song(e.value),S&&n.sendNext({title:full_playlist[0].title,videoId:full_playlist[0].id});break;case"deleted":p.deleted_song(e.value);break;case"vote":p.voted_song(e.value,e.time),S&&n.sendNext({title:full_playlist[0].title,videoId:full_playlist[0].id});break;case"song_change":"/"!=window.location.pathname&&p.song_change(e.time),S&&n.sendNext({title:full_playlist[0].title,videoId:full_playlist[0].id})}},insertAtBeginning:function(e,t){var a=0==p.page?"":"none",n=p.generateSong(e,t,!1,!0,!1,a,!1);$("#wrapper").append(n)},insertAtIndex:function(e,t,a){var n=p.getIndexOfSong(e.id),o="none";if(!e.now_playing){n>=p.page&&n div:nth-child("+n+")").after(i);var s=$("#wrapper").children()[n];$(s).css("display",o),"block"==o&&$("#wrapper").children().length>=p.page+p.can_fit+1?$($("#wrapper").children()[p.page+p.can_fit]).css("display","none"):n=0?$($("#wrapper").children()[p.page]).css("display","block"):$("#wrapper").children().length>p.page+p.can_fit&&$($("#wrapper").children()[p.page+p.can_fit-1]).css("display","block"),a&&p.page>0&&$($("#wrapper").children()[p.page-1]).css("display","none"),t&&setTimeout(function(){$(s).css("height",p.element_height)},5)}},populate_list:function(e){o.mobilecheck()||_?_?(p.can_fit=Math.round($("#wrapper").height()/91)+1,p.element_height=$("#wrapper").height()/p.can_fit-4,console.log("anal")):(p.can_fit=Math.round(($(window).height()-$(".tabs").height()-$("header").height()-66)/71)+1,p.element_height=($(window).height()-$(".tabs").height()-$("header").height()-66)/p.can_fit-6):(p.can_fit=Math.round($("#wrapper").height()/71)+1,p.element_height=$("#wrapper").height()/p.can_fit-6),void 0===f&&(f=$("#list-song-html").html()),full_playlist=e,p.sortList(),$("#wrapper").empty(),o.log("---------------------------"),o.log("---------FULL PLAYLIST-----"),o.log(full_playlist),o.log("---------------------------"),full_playlist.length>1?($.each(full_playlist,function(e,t){t.now_playing||$("#wrapper").append(p.generateSong(t,!1,v,!0,!1,"",!0))}),$("#wrapper").children().length>p.can_fit&&!$("#pageButtons").length?($('
|<|<< prev< prev 1 >|>|next >next >
').insertAfter("#wrapper"),$(".prev_page").toggleClass("hide"),$(".first_page").toggleClass("hide"),$(".next_page_hide").css("display","none"),$(".last_page_hide").css("display","none")):$("#pageButtons").length||($('
|<|<< prev< prev 1 >|>|next >next >
').insertAfter("#wrapper"),$(".prev_page").toggleClass("hide"),$(".next_page").toggleClass("hide"),$(".last_page").toggleClass("hide"),$(".first_page").toggleClass("hide"),$(".next_page_hide").css("display","inline-block"),$(".prev_page_hide").css("display","inline-block")),p.dynamicContentPage(-10)):(p.empty=!0,$("#wrapper").append("The playlist is empty."),$("#pageButtons").length||($('
|<|<< prev< prev 1 >|>|next >next >
').insertAfter("#wrapper"),$(".prev_page").toggleClass("hide"),$(".next_page").toggleClass("hide"),$(".last_page").toggleClass("hide"),$(".first_page").toggleClass("hide"),$(".next_page_hide").css("display","inline-block"),$(".prev_page_hide").css("display","inline-block"))),$("#settings").css("visibility","visible"),$("#settings").css("opacity","1"),$("#wrapper").css("opacity","1")},dynamicContentPage:function(e){1==e?($("#wrapper").children().slice(p.page,p.page+p.can_fit).hide(),p.page=p.page+p.can_fit,$("#wrapper").children().slice(p.page,p.page+p.can_fit).show(),p.page>0&&$(".prev_page").hasClass("hide")&&($(".prev_page").toggleClass("hide"),$(".prev_page_hide").css("display","none"),$(".first_page").toggleClass("hide"),$(".first_page_hide").css("display","none")),p.page+p.can_fit>=$("#wrapper").children().length&&($(".next_page_hide").css("display","inline-block"),$(".next_page").css("display","none"),$(".last_page_hide").css("display","inline-block"),$(".last_page").css("display","none"))):10==e?($("#wrapper").children().slice(p.page,p.page+p.can_fit).hide(),p.page=Math.floor(($("#wrapper").children().length-1)/p.can_fit)*p.can_fit,$("#wrapper").children().slice(p.page,p.page+p.can_fit).show(),p.page>0&&$(".prev_page").hasClass("hide")&&($(".prev_page").toggleClass("hide"),$(".prev_page_hide").css("display","none"),$(".first_page").toggleClass("hide"),$(".first_page_hide").css("display","none")),p.page+p.can_fit>=$("#wrapper").children().length&&($(".next_page_hide").css("display","inline-block"),$(".next_page").css("display","none"),$(".last_page_hide").css("display","inline-block"),$(".last_page").css("display","none"))):e==-10?($("#wrapper").children().slice(p.page,p.page+p.can_fit).hide(),p.page=0,$("#wrapper").children().slice(p.page,p.page+p.can_fit).show(),0!=p.page||$(".prev_page").hasClass("hide")?$(".prev_page").hasClass("hide")?($(".prev_page_hide").css("display","inline-block"),$(".first_page_hide").css("display","inline-block")):($(".prev_page_hide").css("display","none"),$(".first_page_hide").css("display","none")):($(".prev_page").toggleClass("hide"),$(".prev_page_hide").css("display","inline-block"),$(".first_page").toggleClass("hide"),$(".first_page_hide").css("display","inline-block")),p.page+p.can_fit<$("#wrapper").children().length&&($(".next_page_hide").css("display","none"),$(".next_page").css("display","inline-block"),$(".last_page_hide").css("display","none"),$(".last_page").css("display","inline-block"))):($("#wrapper").children().slice(p.page-p.can_fit,p.page).show(),$("#wrapper").children().slice(p.page,p.page+p.can_fit).hide(),p.page=p.page-p.can_fit,0!=p.page||$(".prev_page").hasClass("hide")?$(".prev_page").hasClass("hide")?($(".prev_page_hide").css("display","inline-block"),$(".first_page_hide").css("display","inline-block")):($(".prev_page_hide").css("display","none"),$(".first_page_hide").css("display","none")):($(".prev_page").toggleClass("hide"),$(".prev_page_hide").css("display","inline-block"),$(".first_page").toggleClass("hide"),$(".first_page_hide").css("display","inline-block")),p.page+p.can_fit<$("#wrapper").children().length&&($(".next_page_hide").css("display","none"),$(".next_page").css("display","inline-block"),$(".last_page_hide").css("display","none"),$(".last_page").css("display","inline-block"))),$("#pageNumber").html(p.page/p.can_fit+1)},added_song:function(e){var t;0!==full_playlist.length&&(t=full_playlist.pop()),full_playlist.push(e),p.sortList(),t&&full_playlist.push(t),$("#suggested-"+e.id).remove(),p.empty&&(p.empty=!1),$("#empty-channel-message").remove(),p.insertAtIndex(e,!0),$("#wrapper").children().length>p.page+p.can_fit?($(".next_page_hide").css("display","none"),$(".next_page").removeClass("hide"),$(".next_page").css("display","inline-block")):($(".next_page_hide").css("display","inline-block"),$(".next_page").css("display","none"))},deleted_song:function(e){var t=p.getIndexOfSong(e),a=$("#wrapper").children()[t];try{a.style.height=0,setTimeout(function(){$("#"+e).remove(),full_playlist.splice(p.getIndexOfSong(e),1),t=0?$($("#wrapper").children()[p.page-1]).css("display","block"):$("#wrapper").children().length>p.page+(p.can_fit-1)&&$($("#wrapper").children()[p.page+(p.can_fit-1)]).css("display","block"),p.page>=$("#wrapper").children().length?p.dynamicContentPage(-1):p.page+p.can_fit>=$("#wrapper").children().length&&($(".next_page_hide").css("display","inline-block"),$(".next_page").css("display","none")),S&&n.sendNext({title:full_playlist[0].title,videoId:full_playlist[0].id})},305)}catch(a){full_playlist.splice(p.getIndexOfSong(e),1),p.empty||($("#wrapper").children()[$("#wrapper").children().length-1].remove(),t=0?$($("#wrapper").children()[p.page-1]).css("display","block"):$("#wrapper").children().length>p.page+p.can_fit&&$($("#wrapper").children()[p.page+(p.can_fit-1)]).css("display","block"),S&&n.sendNext({title:full_playlist[0].title,videoId:full_playlist[0].id}))}full_playlist.length<=2&&(p.empty=!0,$("#wrapper").append("The playlist is empty.")),$("#suggested-"+e).remove(),p.page+p.can_fit<$("#wrapper").children().length&&($(".next_page_hide").css("display","none"),$(".next_page").css("display","inline-block")),p.page>=$("#wrapper").children().length&&p.dynamicContentPage(-1),Suggestions.checkUserEmpty()},voted_song:function(e,t){var a=p.getIndexOfSong(e),n=full_playlist[a];full_playlist[a].votes+=1,full_playlist[a].added=t,p.sortList(),$("#"+e).remove(),p.insertAtIndex(n,!1)},song_change:function(e){var t=full_playlist.length-1;full_playlist[0].now_playing=!0,full_playlist[0].votes=0,full_playlist[0].guids=[],full_playlist[0].added=e,full_playlist[t].now_playing=!1,o.log("---------------------------"),o.log("---SONG ON FIRST INDEX-----"),o.log(full_playlist[0]),o.log("---------------------------");try{full_playlist.push(full_playlist.shift()),p.empty||$("#wrapper").children()[0].remove(),0===$("#wrapper").children().length&&(p.empty=!0,$("#wrapper").append("The playlist is empty.")),p.insertAtIndex(full_playlist[t-1],!1,!0)}catch(e){}},vote:function(e,t){return s.emit("vote",{channel:T,id:e,type:t,adminpass:k}),!0},skip:function(){return s.emit("skip",{pass:k,id:l,channel:T.toLowerCase()}),!0},exportToYoutube:function(){var e="https://www.googleapis.com/youtube/v3/playlists?part=snippet";$(".exported-list-container").removeClass("hide"),$("#playlist_loader_export").removeClass("hide"),$.ajax({type:"POST",url:e,headers:{Authorization:"Bearer "+access_token_data_youtube.access_token,"Content-Type":"application/json"},data:JSON.stringify({snippet:{title:T.toLowerCase(),description:"Playlist exported from zoff"}}),success:function(e){var t=0,a=e.id;$.each(full_playlist,function(e,n){var i="https://www.googleapis.com/youtube/v3/playlistItems?part=snippet";$.ajax({type:"POST",url:i,headers:{Authorization:"Bearer "+access_token_data_youtube.access_token,"Content-Type":"application/json"},data:JSON.stringify({snippet:{playlistId:a,resourceId:{kind:"youtube#video",videoId:n.id}}}),success:function(e){o.log("Added video: "+n.id+" to playlist id "+a),t==full_playlist.length-1&&(o.log("All videoes added!"),o.log("url: https://www.youtube.com/playlist?list="+a),$(".exported-list").append("
Exported list
"),$(".exported-list").append(""+T+""),$("#playlist_loader_export").addClass("hide")),t+=1}})})},error:function(e){o.log(e)}})},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(o.predicate({name:"votes",reverse:!0},{name:"added",reverse:!1},{name:"title",reverse:!1}))},show:function(){o.mobilecheck()||(showToggle?(showToggle=!1,$("#toptitle").empty(),$("#chan").addClass("bigChan"),$("#chan").html("zoff.no/"+T.toLowerCase())):(showToggle=!0,$("#toptitle").html("Zöff"),$("#chan").removeClass("bigChan"),$("#chan").html(T)))},generateSong:function(e,t,a,n,o,i,s){void 0===f&&(f=$("#list-song-html").html());var l,r,c=e.id,d=e.title,g=e.votes,u="background-image:url('//img.youtube.com/vi/"+c+"/mqdefault.jpg');",h=$("
"+f+"
"),m="style";return t?h.find("#list-song").css("height",0):h.find(".list-song").css("height",p.element_height),y||h.find(".card-action").removeClass("hide"), +1==g&&h.find(".vote-text").text("vote"),a&&(u="//img.youtube.com/vi/"+c+"/mqdefault.jpg",m="data-original"),n?(h.find(".list-votes").text(g),h.find("#list-song").attr("id",c),h.find(".vote-container").attr("title",d),($("#wrapper").children().length>=p.can_fit&&s||"none"==i)&&h.find(".card").css("display","none"),l=".vote-container",r="del"):n||(h.find(".vote-text").text(e.duration),l=".add-suggested",r=o?"del_user_suggested":"del_suggested",h.find(".vote-container").attr("class","clickable add-suggested"),h.find(".add-suggested").attr("title",d),h.find("#del").attr("id",r),h.find(l).attr("data-video-title",d),h.find(l).attr("data-video-length",e.length),h.find("#list-song").attr("id","suggested-"+c),h.find(".list-image").attr("class",h.find(".list-image").attr("class").replace("list-image","list-suggested-image"))),h.find(".list-title").text(d),h.find(".list-title").attr("title",d),h.find(l).attr("data-video-id",c),h.find(".list-image").attr(m,u),h.find(".list-suggested-image").attr(m,u),h.find("#"+r).attr("data-video-id",c),h.html()},getIndexOfSong:function(e){return indexes=$.map(full_playlist,function(t,a){if(t.id==e)return a}),indexes[0]},scrollTop:function(){$("#wrapper").scrollTop(0)},scrollBottom:function(){$("#wrapper").scrollTop($("#wrapper")[0].scrollHeight)}},u="",h=!1,m=!1,f=$("#list-song-html").html(),y=!0,v=!1,_=!0,w=100,k="",C=!1,x=!1,S=!1,I=window.location.hash.substring(1).split("&"),T=I[0],E=!1,B="#808080",L={"sync disconnect on unload":!0,secure:!0,"force new connection":!0};$(document).ready(function(){3==I.length&&"autoplay"==I[2]?E=!0:h=!0,B="#"+I[1],$("head").append(''),$("head").append(''),add="https://zoff.no",s=io.connect(""+add+":8880",L),s.on("get_list",function(){setTimeout(function(){s.emit("list",T.toLowerCase())},1e3)}),s.on("viewers",function(e){viewers=e,void 0!==u&&n.getTitle(u,viewers)}),e(),t(),window.onYouTubeIframeAPIReady=n.onYouTubeIframeAPIReady,n.loadPlayer(),d.initSlider(),window.setVolume=a,$("#controls").css("background-color",B),$("#playlist").css("background-color",B)}),$(document).on("click","#zoffbutton",function(e){window.open("https://zoff.no/"+T.toLowerCase()+"/","_blank")}),$(document).on("click",".vote-container",function(e){var t=$(this).attr("data-video-id");p.vote(t,"pos")}),$(document).on("click",".prev_page",function(e){e.preventDefault(),p.dynamicContentPage(-1)}),$(document).on("click",".next_page",function(e){e.preventDefault(),p.dynamicContentPage(1)})}(); \ No newline at end of file diff --git a/static/dist/lib/aes.js b/public/dist/lib/aes.js similarity index 100% rename from static/dist/lib/aes.js rename to public/dist/lib/aes.js diff --git a/static/dist/lib/cache-polyfill.js b/public/dist/lib/cache-polyfill.js similarity index 100% rename from static/dist/lib/cache-polyfill.js rename to public/dist/lib/cache-polyfill.js diff --git a/static/dist/lib/color-thief.js b/public/dist/lib/color-thief.js similarity index 100% rename from static/dist/lib/color-thief.js rename to public/dist/lib/color-thief.js diff --git a/static/dist/lib/jquery-2.1.3.min.js b/public/dist/lib/jquery-2.1.3.min.js similarity index 100% rename from static/dist/lib/jquery-2.1.3.min.js rename to public/dist/lib/jquery-2.1.3.min.js diff --git a/static/dist/lib/jquery-ui-1.10.3.min.js b/public/dist/lib/jquery-ui-1.10.3.min.js similarity index 100% rename from static/dist/lib/jquery-ui-1.10.3.min.js rename to public/dist/lib/jquery-ui-1.10.3.min.js diff --git a/static/dist/lib/jquery.lazyload.js b/public/dist/lib/jquery.lazyload.js similarity index 100% rename from static/dist/lib/jquery.lazyload.js rename to public/dist/lib/jquery.lazyload.js diff --git a/static/dist/lib/jquery.scrollstop.js b/public/dist/lib/jquery.scrollstop.js similarity index 100% rename from static/dist/lib/jquery.scrollstop.js rename to public/dist/lib/jquery.scrollstop.js diff --git a/static/dist/lib/materialize.js b/public/dist/lib/materialize.js similarity index 100% rename from static/dist/lib/materialize.js rename to public/dist/lib/materialize.js diff --git a/static/dist/lib/materialize.min.js b/public/dist/lib/materialize.min.js similarity index 100% rename from static/dist/lib/materialize.min.js rename to public/dist/lib/materialize.min.js diff --git a/static/dist/lib/sha256.js b/public/dist/lib/sha256.js similarity index 100% rename from static/dist/lib/sha256.js rename to public/dist/lib/sha256.js diff --git a/static/dist/lib/socket.io-1.4.5.js b/public/dist/lib/socket.io-1.4.5.js similarity index 100% rename from static/dist/lib/socket.io-1.4.5.js rename to public/dist/lib/socket.io-1.4.5.js diff --git a/static/dist/main.min.js b/public/dist/main.min.js similarity index 69% rename from static/dist/main.min.js rename to public/dist/main.min.js index 4f54c7f1..cbe25131 100755 --- a/static/dist/main.min.js +++ b/public/dist/main.min.js @@ -1,3 +1,3 @@ -!function(){function e(){var e=!0;V=$("#chan").html(),Ie=M.mobilecheck();var a=M.mobilecheck()?"left":"right";if(window.onpopstate=function(e){S()},C(),"zoff.no"==window.location.hostname?add="https://zoff.no":add=window.location.hostname,void 0!==We&&(We.stopInterval=!1),$("ul.playlist-tabs").tabs(),$("ul.playlist-tabs-loggedIn").tabs(),$(".chatTabs").tabs(),$("#settings").sideNav({menuWidth:300,edge:a,closeOnClick:!1}),$(".collapsible").collapsible({accordion:!0}),w(ue),xe=$("#temp-results-container"),Se=$("#empty-results-container").html(),he=$(".not-imported-container").html(),$(".not-imported-container").empty(),$(".video-container").resizable({start:function(e,t){$("iframe").css("pointer-events","none")},stop:function(e,t){$("iframe").css("pointer-events","auto"),L.set_width($(this).width())},handles:"e",minWidth:350,maxWidth:$(window).width()-241}),(void 0===Oe||M.mobilecheck())&&(e=!1,Oe=io.connect(""+add+":8880",Re)),0===$("#alreadychannel").length||M.mobilecheck())o(),i(),s(),l();else{$("#channel-load").css("display","none"),$("#player").css("opacity","1"),$("#controls").css("opacity","1"),$(".playlist").css("opacity","1"),We.readyLooks(),Ze.initYoutubeControls(We.player),Ze.initSlider(),We.player.setVolume(L.get_volume()),$(".video-container").removeClass("no-opacity");var n="https://remote."+window.location.hostname+"/"+Ee;$("#code-text").text(Ee),$("#code-qr").attr("src","https://chart.googleapis.com/chart?chs=221x221&cht=qr&choe=UTF-8&chld=L|1&chl="+n),$("#code-link").attr("href",n)}e&&Oe.emit("list",V.toLowerCase()),/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream?(document.getElementById("search").blur(),$("#channel-load").css("display","none")):(window.onYouTubeIframeAPIReady=We.onYouTubeIframeAPIReady,(""===We.player||void 0===We.player||M.mobilecheck())&&We.loadPlayer()),M.mobilecheck()&&Je.initiate_volume(),c(),p(),d(),M.mobilecheck()||0!==$("#alreadychannel").length||h(),M.msieversion()||M.mobilecheck()||Notification.requestPermission(),$(".search_input").focus(),M.sample(),$("#results").hover(function(){$("div.result").removeClass("hoverResults"),oe=0},function(){}),$("#search").focus(),$("#embed-button").css("display","inline-block"),$("#embed-area").val(v(ye,fe,me,be)),$("#search").attr("placeholder","Find song on YouTube..."),we?t(1):ke?initializeCastApi():window.__onGCastApiAvailable=function(e,t){e&&initializeCastApi()}}function t(e){if($(".castButton").toggleClass("hide"),$(".castButton-active").toggleClass("hide"),1==e){$("#duration").toggleClass("hide"),$("#fullscreen").toggleClass("hide");try{We.player.stopVideo()}catch(e){}We.stopInterval=!0,$("#player_overlay").removeClass("hide"),$("#player_overlay").css("display","block"),window.mobilecheck()&&($("#pause").hasClass("hide")?($("#play").toggleClass("hide"),$("#pause").toggleClass("hide")):$("#play").hasClass("hide")&&($("#play").toggleClass("hide"),$("#pause").toggleClass("hide"))),$("#player_overlay").css("background","url(https://i.ytimg.com/vi/"+Ae+"/maxresdefault.jpg)"),$("#player_overlay").css("background-position","center"),$("#player_overlay").css("background-size","100%"),$("#player_overlay").css("background-color","black"),$("#player_overlay").css("background-repeat","no-repeat"),$("#player_overlay").css("height","calc(100% - 32px)"),$("#playing_on").css("display","flex"),$("#chromecast_text").html("Playing on
"+P.La.friendlyName),We.player.setVolume(100),$("#volume").slider("value",100),$("#player_overlay_text").toggleClass("hide")}else 0==e&&($("#duration").toggleClass("hide"),$("#fullscreen").toggleClass("hide"),We.player.playVideo(),We.stopInterval=!1,We.durationSetter(),We.player.setVolume(L.get_volume()),$("#volume").slider("value",L.get_volume()),$("#player_overlay").addClass("hide"),$("#player_overlay_text").toggleClass("hide"),$("#chromecast_text").html(""),$("#playing_on").css("display","none"),Oe.emit("pos",{channel:V.toLowerCase()}))}function a(e,t){var a=JSON.parse(t);switch(a.type){case-1:Oe.emit("end",{id:a.videoId,channel:V.toLowerCase()});break;case 0:Oe.emit("skip",{error:a.data_code,id:a.videoId,pass:W,channel:V.toLowerCase})}}function n(){Oe.on("connect_failed",function(){M.log("Connection Failed"),ve||(ve=!0,Materialize.toast("Error connecting to server, please wait..",1e8,"red lighten connect_error"))}),Oe.on("connect_error",function(){M.log("Connection Failed."),ve||(ve=!0,Materialize.toast("Error connecting to server, please wait..",1e8,"red lighten connect_error"))})}function o(){Oe.on("np",We.youtube_listener)}function i(){Oe.on("get_list",function(){Oe.emit("list",V.toLowerCase())})}function s(){Oe.on("suggested",function(e){var t=!0;void 0===e.id&&(t=!1),Xe.catchUserSuggests(e,t)})}function l(){Oe.on("viewers",function(e){X=e,void 0!==De&&We.getTitle(De,X)})}function c(){Oe.on("toast",E.toast),Oe.on("pw",E.pw),Oe.on("conf",E.conf)}function d(){Oe.on("chat.all",B.allchat),Oe.on("chat",B.channelchat)}function p(){Oe.on("channel",A.channel_function)}function u(){M.log("Setting up playlist_listener"),Oe.on("playlists",Ge.frontpage_function)}function h(){Oe.on("id",N.host_listener)}function m(e){Oe.on(e,N.host_on_action)}function f(){localStorage.debug=!0}function y(){localStorage.debug=!1}function v(e,t,a,n){return''}function _(e){for(var t="",a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.-_",n=0;nX"),$("#playbar").remove(),$("#playlist").remove(),$(".ui-resizable-handle").remove(),$("#main_components").remove(),$("#player").addClass("player_bottom"),$("#main-row").addClass("frontpage_modified_heights"),$("#player").css("opacity","1"),$("#video-container").removeClass("no-opacity"),$("#main-row").prepend("
");$(".drag-target").remove(),$("#sidenav-overlay").remove(),$("main").attr("class","center-align container"),$("body").attr("id",""),$("body").attr("style",""),$("header").html($($(e)[63]).html()),$($(e)[65]).insertAfter("header"),$($(e)[67]).insertAfter(".mega"),M.mobilecheck()?$("main").html($($(e)[71]).html()):$("main").append($($($(e)[71]).html())[0]),$(".page-footer").removeClass("padding-bottom-extra"),$(".page-footer").removeClass("padding-bottom-novideo"),$("#favicon").attr("href","static/images/favicon.png"),M.log(Oe),1==$("#alreadyfp").length?T():(qe=!0,G=!0,T()),0===$("#alreadychannel").length&&$("head").append("
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")}),!M.mobilecheck()&&Ge.winter&&$(".mega").prepend('
'),window.__onGCastApiAvailable=function(e,t){e?ke=!0:console.log(t)}}var E={beginning:!0,toast:function(e){switch(e){case"addedsong":e=M.rnd(["I added your song","Your song has been added","Yay, more songs!","Thats a cool song!","I added that song for you","I see you like adding songs..."]);break;case"addedplaylist":e=M.rnd(["I added the playlist","Your playlist has been added","Yay, many more songs!","Thats a cool playlist!","I added all the songs for you","I see you like adding songs.."]),document.getElementById("import").disabled=!1,$("#playlist_loader").addClass("hide"),$("#import").removeClass("hide");break;case"savedsettings":e=M.rnd(["I've saved your settings","I stored all your settings","Your settings have been stored in a safe place"]);break;case"wrongpass":e=M.rnd(["That's not the right password!","Wrong! Better luck next time...","You seem to have mistyped the password","Incorrect. Have you tried meditating?","Nope, wrong password!","Wrong password. The authorities have been notified."]),L.remove_pass(V.toLowerCase()),E.display_logged_out(),z=!0;break;case"shuffled":e=M.rnd(["♫ You stir me right round, baby. ♫","♫ Stir, stir, stir my boat ♫","I vigorously stirred your playlist!","I hope you like your list stirred, not shaken.","I shuffled your playlist with the cosmic background radiation as a seed. Enjoy.","100% randomized, for your listening pleasure!","I hope you enjoy your fresh playlist!"]);break;case"deletesong":e=M.rnd(["Your song is now in a better place...","You won't be seeing any more of that video...","EXTERMINATE! EXTERMINATE! EXTERMINATE!","I killed it with fire","Thanks for deleting that song. I didn't like it anyways...","Removed song securely."]);break;case"voted":e=M.rnd(["You voted!","You vote like a boss","Voting is the key to democracy","May you get your song to the very top!","I love that song! I vouch for you.","Only you vote that good","I like the way you vote...","Up the video goes!","Voted Zöff for president","Only 999 more to go!"]);break;case"alreadyvoted":e=M.rnd(["You can't vote twice on that song!","I see you have voted on that song before","One vote per person!","I know you want to hear your song, but have patience!","I'm sorry, but I can't let you vote twice, Dave."]);break;case"skip":e=M.rnd(["The song was skipped","I have skipped a song","Skipped to the beat","Skipmaster3000","They see me skippin', they hatin'"]);break;case"listhaspass":e=M.rnd(["I'm sorry, but you have to be an admin to do that!","Only admins can do that","You're not allowed to do that, try logging in!","I can't let you do that","Please log in to do that"]),L.remove_pass(V.toLowerCase()),E.display_logged_out(),z=!0;break;case"noskip":e=M.rnd(["Only Admins can skip songs, peasant!","You have to log in to skip songs on this channel","Try clicking the settings icon and logging in before you skip"]);break;case"alreadyskip":e=M.rnd(["Skipping is democratic, only one vote per person!","More people have to vote to skip, not just you!","Get someone else to skip too! You can't do it on yourself."]);break;case"notyetskip":e="Skipping is disabled the first 10 seconds.";break;case"correctpass":e="Correct password. You now have access to the sacred realm of The Admin.";break;case"changedpass":e="Your password has been changed!";break;case"suggested":e="Your song was suggested!";break;case"alreadyplay":e="Seems the song you want is already playing. No fooling the system!"}Materialize.toast(e,4e3)},pw:function(e){z=!1,W=e,names=["vote","addsongs","longsongs","frontpage","allvideos","removeplay","skip","shuffle"],L.set_pass(V.toLowerCase(),L.decrypt_pass(e));for(var t=0;t150||(e.value.startsWith("/name ")?B.namechange(e.value.substring(6)):e.value.startsWith("/removename")?B.removename():"#all_chat"==$(".chat-tab-li a.active").attr("href")?Oe.emit("all,chat",e.value):Oe.emit("chat",e.value),e.value="")},allchat:function(e){R||":"!=e.msg.substring(0,1)||ce||($("#favicon").attr("href","static/images/highlogo.png"),R=!0,Y=!0,de=!0,pe||B.chat_blink()),document.hidden&&$("#favicon").attr("href","static/images/highlogo.png");var t=M.intToARGB(M.hashCode(e.from));if(t.length<6)for(x=t.length;x<6;x++)t="0"+t;t=M.hexToRgb(t.substring(0,6));var a=M.rgbToHsl([t.r,t.g,t.b],!1);$("#chatall").append("
  • "+e.from+"
  • ");var n=document.createTextNode(e.msg);$("#chatall li:last")[0].appendChild(n),document.getElementById("chatall").scrollTop=document.getElementById("chatall").scrollHeight},channelchat:function(e){R||":"!=e.msg.substring(0,1)||ce||($("#favicon").attr("href","static/images/highlogo.png"),Y=!0,de=!0,pe||B.chat_blink());var t=M.intToARGB(M.hashCode(e.from));if(t.length<6)for(x=t.length;x<6;x++)t="0"+t;t=M.hexToRgb(t.substring(0,6));var a=M.rgbToHsl([t.r,t.g,t.b],!1);$("#chatchannel").append("
  • "+e.from+"
  • ");var n=document.createTextNode(e.msg);$("#chatchannel li:last")[0].appendChild(n),document.getElementById("chatchannel").scrollTop=document.getElementById("chatchannel").scrollHeight},chat_blink:function(){pe=!0,$(".chat-link").attr("style","color: grey !important;"),setTimeout(function(){$(".chat-link").attr("style","color: white !important;"),setTimeout(function(){pe&&B.chat_blink()},1e3)},1e3)}},L={conf_pass:void 0,init:function(){document.cookie=V.toLowerCase()+"=; path=/"+V.toLowerCase()+";secure;expires="+new Date(0).toUTCString();try{conf_arr=L.decrypt(L.getCookie("_opt"),"_opt")}catch(e){conf_arr=L.decrypt(L.create_cookie("_opt"),"_opt")}try{L.conf_pass=L.decrypt(L.getCookie(V.toLowerCase()),V.toLowerCase())}catch(e){L.conf_pass=L.decrypt(L.create_cookie(V.toLowerCase()),V.toLowerCase())}N.change_enabled(conf_arr.remote),100!=conf_arr.width&&We.set_width(conf_arr.width),void 0!==conf_arr.name&&""!==conf_arr.name&&B.namechange(conf_arr.name)},decrypt:function(e,t){void 0===L.getCookie(t)&&(e=L.create_cookie(t));var a=CryptoJS.AES.decrypt(e,"0103060703080703080701",{mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7});return $.parseJSON(a.toString(CryptoJS.enc.Utf8))},decrypt_pass:function(e){var t=CryptoJS.AES.decrypt(e,Oe.id,{mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7});return t.toString(CryptoJS.enc.Utf8)},encrypt:function(e,t){var a=JSON.stringify(e),n=CryptoJS.AES.encrypt(a,"0103060703080703080701",{mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7}),o=new Date;o.setFullYear(o.getFullYear()+1),document.cookie=t+"="+n.toString()+";secure;expires="+o.toGMTString()+";path=/;"},encrypt_string:function(e){var t=CryptoJS.AES.encrypt(e,Oe.id,{mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7});return t.toString()},get_volume:function(){return L.decrypt(L.getCookie("_opt"),"_opt").volume},set_volume:function(e){conf_arr.volume=e,L.encrypt(conf_arr,"_opt")},create_cookie:function(e){"_opt"==e?cookie_object={volume:100,width:100,remote:!0,name:""}:cookie_object={passwords:{}};var t=JSON.stringify(cookie_object),a=CryptoJS.AES.encrypt(t,"0103060703080703080701",{mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7}),n=new Date;return n.setFullYear(n.getFullYear()+1),document.cookie=e+"="+a.toString()+";secure;expires="+n.toGMTString()+";path=/;",L.getCookie(e)},set_pass:function(e,t){L.conf_pass.passwords[e]=t,L.encrypt(L.conf_pass,e)},remove_pass:function(e){delete L.conf_pass.passwords[e],L.encrypt(L.conf_pass,e.toLowerCase())},set_name:function(e){conf_arr.name=encodeURIComponent(e).replace(/\W/g,""),L.encrypt(conf_arr,"_opt")},remove_name:function(){conf_arr.name="",L.encrypt(conf_arr,"_opt")},get_pass:function(e){if(void 0!==L.conf_pass)return L.conf_pass.passwords[e]},set_remote:function(e){conf_arr.remote=e,L.encrypt(conf_arr,"_opt")},get_remote:function(e){return conf_arr.remote},crypt_pass:function(e){var t=CryptoJS.AES.encrypt(e,Oe.id,{mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7});return t.toString()},get_width:function(){return conf_arr.width},set_width:function(e){conf_arr.width=e,L.encrypt(conf_arr,"_opt")},getCookie:function(e){var t="; "+document.cookie,a=t.split("; "+e+"=");if(2==a.length)return a.pop().split(";").shift()}},M={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 function(t){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4)))&&(e=!0)}(navigator.userAgent||navigator.vendor||window.opera),e},predicate:function(){for(var e,t,a,n=[],o=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()-ae>=2*te&&(Oe.removeAllListeners(),Oe.disconnect(),Oe.connect(),We.setup_all_listeners()),ae=Date.now(),setTimeout(M.sample,te)},loadjsfile:function(e){if(Z.indexOf("["+e+"]")==-1){var t=document.createElement("script");t.setAttribute("type","text/javascript"),t.setAttribute("src",e),document.getElementsByTagName("head")[0].appendChild(t),Z+="["+e+"]"}},msieversion:function(){var e=window.navigator.userAgent,t=e.indexOf("MSIE ");return!!(t>0||navigator.userAgent.match(/Trident.*rv\:11\./))},getRandomInt:function(e,t){return Math.floor(Math.random()*(t-e))+e},rgbToHsl:function(e,t){r=e[0],g=e[1],b=e[2],r/=255,g/=255,b/=255;var a,n,o=Math.max(r,g,b),i=Math.min(r,g,b),s=(o+i)/2;if(o==i)a=n=0;else{var l=o-i;switch(n=s>.5?l/(2-o-i):l/(o+i),o){case r:a=(g-b)/l+(g.5&&t?s=.5:s<.65&&!t&&(s=.65),"hsl("+Math.floor(360*a)+", "+Math.floor(100*n)+"%, "+Math.floor(100*s)+"%)"},componentToHex:function(e){var t=e.toString(16);return 1==t.length?"0"+t:t},rgbToHex:function(e,t,a){return"#"+M.componentToHex(e)+M.componentToHex(t)+M.componentToHex(a)},upperFirst:function(e){return e.substring(0,1).toUpperCase()+e.substring(1).toLowerCase()},addClass:function(e,t){M.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:"/php/mail.php",success:function(e){"success"==e?($("#contact-container").empty(),$("#contact-container").html("Mail has been sent, we'll be back with you shortly.")):($("#contact-container").empty(),$("#contact-container").html("Something went wrong, sorry about that. You could instead try with your own mail-client: contact@zoff.no"))}}))}};$(document).on("submit","#contact-form",function(e){e.preventDefault();var t=$("#contact-form-message").val(),a=$("#contact-form-from").val();M.send_mail(a,t)}),Element.prototype.remove=function(){this.parentElement.removeChild(this)},NodeList.prototype.remove=HTMLCollection.prototype.remove=function(){for(var e=0,t=this.length;e=A.page&&n div:nth-child("+n+")").after(i);var s=$("#wrapper").children()[n];$(s).css("display",o),"block"==o&&$("#wrapper").children().length>=A.page+A.can_fit+1?$($("#wrapper").children()[A.page+A.can_fit]).css("display","none"):n=0?$($("#wrapper").children()[A.page]).css("display","block"):$("#wrapper").children().length>A.page+A.can_fit&&$($("#wrapper").children()[A.page+A.can_fit-1]).css("display","block"), -a&&A.page>0&&$($("#wrapper").children()[A.page-1]).css("display","none"),t&&setTimeout(function(){$(s).css("height",A.element_height)},5)}},populate_list:function(e){M.mobilecheck()||se?se?(A.can_fit=Math.round($("#wrapper").height()/91)+1,A.element_height=$("#wrapper").height()/A.can_fit-4,console.log("anal")):(A.can_fit=Math.round(($(window).height()-$(".tabs").height()-$("header").height()-66)/71)+1,A.element_height=($(window).height()-$(".tabs").height()-$("header").height()-66)/A.can_fit-6):(A.can_fit=Math.round($("#wrapper").height()/71)+1,A.element_height=$("#wrapper").height()/A.can_fit-6),void 0===O&&(O=$("#list-song-html").html()),Be=e,A.sortList(),$("#wrapper").empty(),M.log("---------------------------"),M.log("---------FULL PLAYLIST-----"),M.log(Be),M.log("---------------------------"),Be.length>1?($.each(Be,function(e,t){t.now_playing||$("#wrapper").append(A.generateSong(t,!1,ie,!0,!1,"",!0))}),$("#wrapper").children().length>A.can_fit&&!$("#pageButtons").length?($('
    |<|<< prev< prev 1 >|>|next >next >
    ').insertAfter("#wrapper"),$(".prev_page").toggleClass("hide"),$(".first_page").toggleClass("hide"),$(".next_page_hide").css("display","none"),$(".last_page_hide").css("display","none")):$("#pageButtons").length||($('
    |<|<< prev< prev 1 >|>|next >next >
    ').insertAfter("#wrapper"),$(".prev_page").toggleClass("hide"),$(".next_page").toggleClass("hide"),$(".last_page").toggleClass("hide"),$(".first_page").toggleClass("hide"),$(".next_page_hide").css("display","inline-block"),$(".prev_page_hide").css("display","inline-block")),A.dynamicContentPage(-10)):(A.empty=!0,$("#wrapper").append("The playlist is empty."),$("#pageButtons").length||($('
    |<|<< prev< prev 1 >|>|next >next >
    ').insertAfter("#wrapper"),$(".prev_page").toggleClass("hide"),$(".next_page").toggleClass("hide"),$(".last_page").toggleClass("hide"),$(".first_page").toggleClass("hide"),$(".next_page_hide").css("display","inline-block"),$(".prev_page_hide").css("display","inline-block"))),$("#settings").css("visibility","visible"),$("#settings").css("opacity","1"),$("#wrapper").css("opacity","1")},dynamicContentPage:function(e){1==e?($("#wrapper").children().slice(A.page,A.page+A.can_fit).hide(),A.page=A.page+A.can_fit,$("#wrapper").children().slice(A.page,A.page+A.can_fit).show(),A.page>0&&$(".prev_page").hasClass("hide")&&($(".prev_page").toggleClass("hide"),$(".prev_page_hide").css("display","none"),$(".first_page").toggleClass("hide"),$(".first_page_hide").css("display","none")),A.page+A.can_fit>=$("#wrapper").children().length&&($(".next_page_hide").css("display","inline-block"),$(".next_page").css("display","none"),$(".last_page_hide").css("display","inline-block"),$(".last_page").css("display","none"))):10==e?($("#wrapper").children().slice(A.page,A.page+A.can_fit).hide(),A.page=Math.floor(($("#wrapper").children().length-1)/A.can_fit)*A.can_fit,$("#wrapper").children().slice(A.page,A.page+A.can_fit).show(),A.page>0&&$(".prev_page").hasClass("hide")&&($(".prev_page").toggleClass("hide"),$(".prev_page_hide").css("display","none"),$(".first_page").toggleClass("hide"),$(".first_page_hide").css("display","none")),A.page+A.can_fit>=$("#wrapper").children().length&&($(".next_page_hide").css("display","inline-block"),$(".next_page").css("display","none"),$(".last_page_hide").css("display","inline-block"),$(".last_page").css("display","none"))):e==-10?($("#wrapper").children().slice(A.page,A.page+A.can_fit).hide(),A.page=0,$("#wrapper").children().slice(A.page,A.page+A.can_fit).show(),0!=A.page||$(".prev_page").hasClass("hide")?$(".prev_page").hasClass("hide")?($(".prev_page_hide").css("display","inline-block"),$(".first_page_hide").css("display","inline-block")):($(".prev_page_hide").css("display","none"),$(".first_page_hide").css("display","none")):($(".prev_page").toggleClass("hide"),$(".prev_page_hide").css("display","inline-block"),$(".first_page").toggleClass("hide"),$(".first_page_hide").css("display","inline-block")),A.page+A.can_fit<$("#wrapper").children().length&&($(".next_page_hide").css("display","none"),$(".next_page").css("display","inline-block"),$(".last_page_hide").css("display","none"),$(".last_page").css("display","inline-block"))):($("#wrapper").children().slice(A.page-A.can_fit,A.page).show(),$("#wrapper").children().slice(A.page,A.page+A.can_fit).hide(),A.page=A.page-A.can_fit,0!=A.page||$(".prev_page").hasClass("hide")?$(".prev_page").hasClass("hide")?($(".prev_page_hide").css("display","inline-block"),$(".first_page_hide").css("display","inline-block")):($(".prev_page_hide").css("display","none"),$(".first_page_hide").css("display","none")):($(".prev_page").toggleClass("hide"),$(".prev_page_hide").css("display","inline-block"),$(".first_page").toggleClass("hide"),$(".first_page_hide").css("display","inline-block")),A.page+A.can_fit<$("#wrapper").children().length&&($(".next_page_hide").css("display","none"),$(".next_page").css("display","inline-block"),$(".last_page_hide").css("display","none"),$(".last_page").css("display","inline-block"))),$("#pageNumber").html(A.page/A.can_fit+1)},added_song:function(e){var t;0!==Be.length&&(t=Be.pop()),Be.push(e),A.sortList(),t&&Be.push(t),$("#suggested-"+e.id).remove(),A.empty&&(A.empty=!1),$("#empty-channel-message").remove(),A.insertAtIndex(e,!0),$("#wrapper").children().length>A.page+A.can_fit?($(".next_page_hide").css("display","none"),$(".next_page").removeClass("hide"),$(".next_page").css("display","inline-block")):($(".next_page_hide").css("display","inline-block"),$(".next_page").css("display","none"))},deleted_song:function(e){var t=A.getIndexOfSong(e),a=$("#wrapper").children()[t];try{a.style.height=0,setTimeout(function(){$("#"+e).remove(),Be.splice(A.getIndexOfSong(e),1),t=0?$($("#wrapper").children()[A.page-1]).css("display","block"):$("#wrapper").children().length>A.page+(A.can_fit-1)&&$($("#wrapper").children()[A.page+(A.can_fit-1)]).css("display","block"),A.page>=$("#wrapper").children().length?A.dynamicContentPage(-1):A.page+A.can_fit>=$("#wrapper").children().length&&($(".next_page_hide").css("display","inline-block"),$(".next_page").css("display","none")),we&&We.sendNext({title:Be[0].title,videoId:Be[0].id})},305)}catch(a){Be.splice(A.getIndexOfSong(e),1),A.empty||($("#wrapper").children()[$("#wrapper").children().length-1].remove(),t=0?$($("#wrapper").children()[A.page-1]).css("display","block"):$("#wrapper").children().length>A.page+A.can_fit&&$($("#wrapper").children()[A.page+(A.can_fit-1)]).css("display","block"),we&&We.sendNext({title:Be[0].title,videoId:Be[0].id}))}Be.length<=2&&(A.empty=!0,$("#wrapper").append("The playlist is empty.")),$("#suggested-"+e).remove(),A.page+A.can_fit<$("#wrapper").children().length&&($(".next_page_hide").css("display","none"),$(".next_page").css("display","inline-block")),A.page>=$("#wrapper").children().length&&A.dynamicContentPage(-1),Xe.checkUserEmpty()},voted_song:function(e,t){var a=A.getIndexOfSong(e),n=Be[a];Be[a].votes+=1,Be[a].added=t,A.sortList(),$("#"+e).remove(),A.insertAtIndex(n,!1)},song_change:function(e){var t=Be.length-1;Be[0].now_playing=!0,Be[0].votes=0,Be[0].guids=[],Be[0].added=e,Be[t].now_playing=!1,M.log("---------------------------"),M.log("---SONG ON FIRST INDEX-----"),M.log(Be[0]),M.log("---------------------------");try{Be.push(Be.shift()),A.empty||$("#wrapper").children()[0].remove(),0===$("#wrapper").children().length&&(A.empty=!0,$("#wrapper").append("The playlist is empty.")),A.insertAtIndex(Be[t-1],!1,!0)}catch(e){}},vote:function(e,t){return Oe.emit("vote",{channel:V,id:e,type:t,adminpass:W}),!0},skip:function(){return Oe.emit("skip",{pass:W,id:Ae,channel:V.toLowerCase()}),!0},exportToYoutube:function(){var e="https://www.googleapis.com/youtube/v3/playlists?part=snippet";$(".exported-list-container").removeClass("hide"),$("#playlist_loader_export").removeClass("hide"),$.ajax({type:"POST",url:e,headers:{Authorization:"Bearer "+$e.access_token,"Content-Type":"application/json"},data:JSON.stringify({snippet:{title:V.toLowerCase(),description:"Playlist exported from zoff"}}),success:function(e){var t=0,a=e.id;$.each(Be,function(e,n){var o="https://www.googleapis.com/youtube/v3/playlistItems?part=snippet";$.ajax({type:"POST",url:o,headers:{Authorization:"Bearer "+$e.access_token,"Content-Type":"application/json"},data:JSON.stringify({snippet:{playlistId:a,resourceId:{kind:"youtube#video",videoId:n.id}}}),success:function(e){M.log("Added video: "+n.id+" to playlist id "+a),t==Be.length-1&&(M.log("All videoes added!"),M.log("url: https://www.youtube.com/playlist?list="+a),$(".exported-list").append("
    Exported list
    "),$(".exported-list").append(""+V+""),$("#playlist_loader_export").addClass("hide")),t+=1}})})},error:function(e){M.log(e)}})},importOldList:function(e){var t="",a=0;playlist_url="lists/"+e+".json",Ve=$.parseJSON($.ajax({type:"GET",url:playlist_url,async:!1}).responseText),$.each(Ve.songs,function(e,n){t+=n.id+",",a>45&&(Qe.addVideos(t),t="",a=0),a++}),Qe.addVideos(t),document.getElementById("search").value=""},sortList:function(){Be.sort(M.predicate({name:"votes",reverse:!0},{name:"added",reverse:!1},{name:"title",reverse:!1}))},show:function(){M.mobilecheck()||(j?(j=!1,$("#toptitle").empty(),$("#chan").addClass("bigChan"),$("#chan").html("zoff.no/"+V.toLowerCase())):(j=!0,$("#toptitle").html("Zöff"),$("#chan").removeClass("bigChan"),$("#chan").html(V)))},generateSong:function(e,t,a,n,o,i,s){void 0===O&&(O=$("#list-song-html").html());var l,r,c=e.id,d=e.title,p=e.votes,g="background-image:url('//img.youtube.com/vi/"+c+"/mqdefault.jpg');",u=$("
    "+O+"
    "),h="style";return t?u.find("#list-song").css("height",0):u.find(".list-song").css("height",A.element_height),z||u.find(".card-action").removeClass("hide"),1==p&&u.find(".vote-text").text("vote"),a&&(g="//img.youtube.com/vi/"+c+"/mqdefault.jpg",h="data-original"),n?(u.find(".list-votes").text(p),u.find("#list-song").attr("id",c),u.find(".vote-container").attr("title",d),($("#wrapper").children().length>=A.can_fit&&s||"none"==i)&&u.find(".card").css("display","none"),l=".vote-container",r="del"):n||(u.find(".vote-text").text(e.duration),l=".add-suggested",r=o?"del_user_suggested":"del_suggested",u.find(".vote-container").attr("class","clickable add-suggested"),u.find(".add-suggested").attr("title",d),u.find("#del").attr("id",r),u.find(l).attr("data-video-title",d),u.find(l).attr("data-video-length",e.length),u.find("#list-song").attr("id","suggested-"+c),u.find(".list-image").attr("class",u.find(".list-image").attr("class").replace("list-image","list-suggested-image"))),u.find(".list-title").text(d),u.find(".list-title").attr("title",d),u.find(l).attr("data-video-id",c),u.find(".list-image").attr(h,g),u.find(".list-suggested-image").attr(h,g),u.find("#"+r).attr("data-video-id",c),u.html()},getIndexOfSong:function(e){return indexes=$.map(Be,function(t,a){if(t.id==e)return a}),indexes[0]},scrollTop:function(){$("#wrapper").scrollTop(0)},scrollBottom:function(){$("#wrapper").scrollTop($("#wrapper")[0].scrollHeight)}},V=void 0===window.chan?$("#chan").html():window.chan,z=!0,D=0,j=!0,O=$("#list-song-html").html(),R=!1,Y=!1,q="***REMOVED***",H=!1,U=/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)?)?/,F=[],J=0,G=1,W="",Z="",Q=!1,X=1,K=!1,ee=!1,te=6e3,ae=Date.now(),ne=!1,oe=-1,ie=!1,se=!1,le=!0,re=!1,ce=!1,de=!1,pe=!1,ge={},ue=!1,he="",me=300,fe=600,ye="&autoplay",ve=!1,$e={},_e=!1,we=!1,be="808080",ke=!1;if(void 0===localStorage.debug){var Ce=!1;localStorage.debug=Ce}var xe,Se,Ie,Te,Ee,Be,F,Le,Me,Pe,Ne,X,Ae,Ve,ze,De,je,Oe,Re={"sync disconnect on unload":!0,secure:!0,"force new connection":!0},Ye=!1,qe=!1;navigator.serviceWorker?navigator.serviceWorker.register("/service-worker.js",{scope:"/"}).then(function(e){M.log(e)}).catch(function(e){console.error(e)}):M.log("Service Worker is not supported in this browser."),$().ready(function(){Ye||"/"==window.location.pathname?qe||"/"!=window.location.pathname||T():e(),Oe.on("connect",function(){ve&&(ve=!1,$(".connect_error").fadeOut(function(){$(".connect_error").remove(),Materialize.toast("Connected!",2e3,"green lighten")}))}),n();try{Ue=$.ajax({type:"GET",url:"https://api.github.com/repos/zoff-music/zoff/commits",async:!1}).responseText,Ue=$.parseJSON(Ue),$("#latest-commit").html("Latest Commit:
    "+Ue[0].commit.author.date.substring(0,10)+": "+Ue[0].committer.login+"
    "+Ue[0].sha.substring(0,10)+": "+Ue[0].commit.message+"A.can_fit||e=48&&$("#wrapper").scrollTop()>0?($("#top-button").removeClass("hide"),M.addClass("#bottom-button","hide")):t>=$("#playlist").height()-59&&t<=$("#playlist").height()-32&&$("#wrapper").scrollTop()<$("#wrapper")[0].scrollHeight-$("#wrapper").height()-1?($("#bottom-button").removeClass("hide"),M.addClass("#top-button","hide")):(M.addClass("#bottom-button","hide"),M.addClass("#top-button","hide"))}),$(document).on("mouseleave","#playlist",function(){M.addClass("#bottom-button","hide"),M.addClass("#top-button","hide")}),$(document).on("click","#top-button",function(){A.scrollTop()}),$(document).on("click","#bottom-button",function(){A.scrollBottom()});var He,Ue,Oe,Fe,Je={id:"",get_input:function(e){""===Je.id?Je.set_id(e.toLowerCase()):Je.set_channel(e.toLowerCase())},set_id:function(e){Je.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","block")},set_channel:function(e){Oe.emit("id",{id:Je.id,type:"channel",value:e})},play_remote:function(){Oe.emit("id",{id:Je.id,type:"play",value:"mock"})},pause_remote:function(){Oe.emit("id",{id:Je.id,type:"pause",value:"mock"})},skip_remote:function(){Oe.emit("id",{id:Je.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){Oe.emit("id",{id:Je.id,type:"volume",value:t.value}),M.log("volume")}})}},G=!0,Ge={blob_list:[],winter:(new Date).getMonth()>=10||(new Date).getMonth()<=1,times_rotated:0,frontpage_function:function(e){$("#channels").empty(),G=!0,M.log("-----------"),M.log("Frontpage fetch"),M.log(e),M.log("------------"),Ge.populate_channels(e.channels),Ge.set_viewers(e.viewers)},populate_channels:function(e){var t,a="",n=0;1==e[0].pinned&&(t=e.shift()),e.sort(Ge.sortFunction),void 0!==t&&e.unshift(t),pre_card=$(He),M.log("------------"),M.log(pre_card),M.log("-------------"),M.mobilecheck()||Ge.add_backdrop(e,0);for(var o in e){var i=e[o].channel;if(n<12){var s=e[o].id,l=e[o].viewers,r="background-image:url('https://img.youtube.com/vi/"+s+"/hqdefault.jpg');",c=e[o].count,d=pre_card;1==e[o].pinned?(d.find(".pin").attr("style","display:block;"),d.find(".card").attr("title","Pinned!")):(d.find(".pin").attr("style","display:none;"),d.find(".card").attr("title","")),d.find(".chan-name").text(i),d.find(".chan-name").attr("title",i),d.find(".chan-views").text(l),d.find(".chan-songs").text(c),d.find(".chan-bg").attr("style",r),d.find(".chan-link").attr("href",i),$("#channels").append(d.html())}a+="