mirror of
https://github.com/KevinMidboe/zoff.git
synced 2026-02-10 11:29:37 +00:00
Added a rather long and not the best embed code
This commit is contained in:
14
gulpfile.js
14
gulpfile.js
@@ -4,7 +4,7 @@ var gulp = require('gulp'),
|
|||||||
concat = require('gulp-concat');
|
concat = require('gulp-concat');
|
||||||
|
|
||||||
gulp.task('js', function () {
|
gulp.task('js', function () {
|
||||||
gulp.src(['static/js/*.js', '!static/js/nochan*', '!static/js/remotecontroller.js'])
|
gulp.src(['static/js/*.js', '!static/js/embed*', '!static/js/nochan*', '!static/js/remotecontroller.js'])
|
||||||
.pipe(uglify({
|
.pipe(uglify({
|
||||||
mangle: true,
|
mangle: true,
|
||||||
compress: true,
|
compress: true,
|
||||||
@@ -14,6 +14,17 @@ gulp.task('js', function () {
|
|||||||
.pipe(gulp.dest('static/dist'));
|
.pipe(gulp.dest('static/dist'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
gulp.task('embed', function () {
|
||||||
|
gulp.src(['static/js/youtube.js', 'static/js/helpers.js', 'static/js/playercontrols.js', 'static/js/list.js', 'static/js/embed.js', '!static/js/nochan*', '!static/js/remotecontroller.js'])
|
||||||
|
/*.pipe(uglify({
|
||||||
|
mangle: true,
|
||||||
|
compress: true,
|
||||||
|
enclose: true
|
||||||
|
}))*/
|
||||||
|
.pipe(concat('embed.min.js'))
|
||||||
|
.pipe(gulp.dest('static/dist'));
|
||||||
|
});
|
||||||
|
|
||||||
gulp.task('nochan', function () {
|
gulp.task('nochan', function () {
|
||||||
gulp.src(['static/js/nochan.js'])
|
gulp.src(['static/js/nochan.js'])
|
||||||
.pipe(uglify({
|
.pipe(uglify({
|
||||||
@@ -38,6 +49,7 @@ gulp.task('remotecontroller', function () {
|
|||||||
|
|
||||||
gulp.task('default', function(){
|
gulp.task('default', function(){
|
||||||
gulp.watch('static/js/*.js', ['js']);
|
gulp.watch('static/js/*.js', ['js']);
|
||||||
|
gulp.watch('static/js/*.js', ['embed']);
|
||||||
gulp.watch('static/js/nochan.js', ['nochan']);
|
gulp.watch('static/js/nochan.js', ['nochan']);
|
||||||
gulp.watch('static/js/remotecontroller.js', ['remotecontroller']);
|
gulp.watch('static/js/remotecontroller.js', ['remotecontroller']);
|
||||||
});
|
});
|
||||||
10
index.php
10
index.php
@@ -152,6 +152,16 @@
|
|||||||
<p>Also, whenever you're logged in, you'll have two tabs in the top of the playlist thats called "Playlist" and "Suggested". The playlist obviously shows the playlist. But the suggested tab, shows 5 songs that YouTube recommends based on the current song. There might also be user recommended songs. To add any of these, just click them as you'd click a song to vote.</p>
|
<p>Also, whenever you're logged in, you'll have two tabs in the top of the playlist thats called "Playlist" and "Suggested". The playlist obviously shows the playlist. But the suggested tab, shows 5 songs that YouTube recommends based on the current song. There might also be user recommended songs. To add any of these, just click them as you'd click a song to vote.</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="embed" class="modal">
|
||||||
|
<div class="modal-header-fixed">
|
||||||
|
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat">Close</a>
|
||||||
|
</div>
|
||||||
|
<div class="modal-content">
|
||||||
|
<h4>Embed code (in beta)</h4>
|
||||||
|
<p>Copy the code in the textarea, and paste on your website.</p>
|
||||||
|
<textarea id="embed-area"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</header>
|
</header>
|
||||||
<div id="channel-load" class="progress">
|
<div id="channel-load" class="progress">
|
||||||
<div class="indeterminate" id="channel-load-move"></div>
|
<div class="indeterminate" id="channel-load-move"></div>
|
||||||
|
|||||||
@@ -144,6 +144,16 @@
|
|||||||
<p>Also, whenever you're logged in, you'll have two tabs in the top of the playlist thats called "Playlist" and "Suggested". The playlist obviously shows the playlist. But the suggested tab, shows 5 songs that YouTube recommends based on the current song. There might also be user recommended songs. To add any of these, just click them as you'd click a song to vote.</p>
|
<p>Also, whenever you're logged in, you'll have two tabs in the top of the playlist thats called "Playlist" and "Suggested". The playlist obviously shows the playlist. But the suggested tab, shows 5 songs that YouTube recommends based on the current song. There might also be user recommended songs. To add any of these, just click them as you'd click a song to vote.</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="embed" class="modal">
|
||||||
|
<div class="modal-header-fixed">
|
||||||
|
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat">Close</a>
|
||||||
|
</div>
|
||||||
|
<div class="modal-content">
|
||||||
|
<h4>Embed code (in beta)</h4>
|
||||||
|
<p>Copy the code in the textarea, and paste on your website.</p>
|
||||||
|
<textarea id="embed-area"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</header>
|
</header>
|
||||||
<div id="channel-load" class="progress" style="top:52px;">
|
<div id="channel-load" class="progress" style="top:52px;">
|
||||||
<div class="indeterminate" id="channel-load-move"></div>
|
<div class="indeterminate" id="channel-load-move"></div>
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
Enjoy!
|
Enjoy!
|
||||||
</p>
|
</p>
|
||||||
<a class="modal-trigger waves-effect help-button-footer" title="Need help with the site?" onclick="$('#help').openModal()">Help, how does this work?!</a>
|
<a class="modal-trigger waves-effect help-button-footer" title="Need help with the site?" onclick="$('#help').openModal()">Help, how does this work?!</a>
|
||||||
|
<a class="modal-trigger waves-effect help-button-footer" id="embed-button" title="Want to embed? (In beta)" onclick="$('#embed').openModal()">Embed this channel</a>
|
||||||
<p id="latest-commit" class="grey-text text-lighten-4 truncate"></p>
|
<p id="latest-commit" class="grey-text text-lighten-4 truncate"></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="col l4 offset-l2 s12 valign-wrapper">
|
<div class="col l4 offset-l2 s12 valign-wrapper">
|
||||||
|
|||||||
235
static/css/embed.css
Normal file
235
static/css/embed.css
Normal file
@@ -0,0 +1,235 @@
|
|||||||
|
.card-image{
|
||||||
|
height: 100px;
|
||||||
|
width: 100px;
|
||||||
|
background-position: center;
|
||||||
|
background-size: 180%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card{
|
||||||
|
cursor:pointer;
|
||||||
|
background-color: grey !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#list-song-html {
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#song-title{
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-image, .list-suggested-image{
|
||||||
|
width: 34%;
|
||||||
|
height: 66px;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-image:after {
|
||||||
|
font-family: "Material-Design-Icons";
|
||||||
|
speak: none;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: normal;
|
||||||
|
font-variant: normal;
|
||||||
|
text-transform: none;
|
||||||
|
text-rendering: auto;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
content: "\e686";/*"\e800";*/
|
||||||
|
color:white;
|
||||||
|
font-size:65px;
|
||||||
|
position:absolute;
|
||||||
|
width:100%; height:100%;
|
||||||
|
top:0; left:0;
|
||||||
|
background:rgba(0,0,0,0.8);
|
||||||
|
opacity:0;
|
||||||
|
transition: all .1s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-suggested-image:after {
|
||||||
|
font-family: "Material-Design-Icons";
|
||||||
|
speak: none;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: normal;
|
||||||
|
font-variant: normal;
|
||||||
|
text-transform: none;
|
||||||
|
text-rendering: auto;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
content: "\e625";/*"\e800";*/
|
||||||
|
color:white;
|
||||||
|
font-size:65px;
|
||||||
|
position:absolute;
|
||||||
|
width:100%; height:100%;
|
||||||
|
top:0; left:0;
|
||||||
|
background:rgba(0,0,0,0.8);
|
||||||
|
opacity:0;
|
||||||
|
transition: all .1s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vote-container:hover .list-image:after, .add-suggested:hover .list-suggested-image:after {
|
||||||
|
opacity:1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.vote-span{
|
||||||
|
opacity: 0.7;
|
||||||
|
padding: 0 0 0 10px;
|
||||||
|
color:white !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-song{
|
||||||
|
background-color: rgba(255, 255, 255, 0.04);
|
||||||
|
color:white;
|
||||||
|
font:12px Arial,sans-serif;
|
||||||
|
-webkit-transition:height .3s;
|
||||||
|
-moz-transition:height .3s;
|
||||||
|
-o-transition:height .3s;
|
||||||
|
transition:height .3s;
|
||||||
|
height:66px;
|
||||||
|
}
|
||||||
|
.list-song .card-content{padding:0;}
|
||||||
|
.list-title{
|
||||||
|
font-size:13px !important;
|
||||||
|
display:block;
|
||||||
|
color:white;font-size:1em;
|
||||||
|
text-align:left;
|
||||||
|
padding: 0 10px 0 10px;
|
||||||
|
line-height: 2.6rem;
|
||||||
|
}
|
||||||
|
.card-image{cursor:pointer}
|
||||||
|
.card{
|
||||||
|
margin:5px 0 5px 0 !important;
|
||||||
|
}
|
||||||
|
.card:hover{
|
||||||
|
box-shadow: 0 5px 5px 0 rgba(0,0,0,0.16), 0 5px 10px 0 rgba(0,0,0,0.12);
|
||||||
|
}
|
||||||
|
|
||||||
|
#playlist{
|
||||||
|
background-color:grey;
|
||||||
|
height:332px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.progress{background-color:rgba(0,0,0,0) !important;}
|
||||||
|
|
||||||
|
.indeterminate {
|
||||||
|
background-color:white !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
#controls
|
||||||
|
{
|
||||||
|
opacity:0;
|
||||||
|
height:32px;
|
||||||
|
background-color:grey;
|
||||||
|
width:300px;
|
||||||
|
color:white;
|
||||||
|
margin-top:0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#playpause, #duration, #volume-button
|
||||||
|
{
|
||||||
|
float:left;
|
||||||
|
color:white;
|
||||||
|
}
|
||||||
|
|
||||||
|
#playpause, #volume-button
|
||||||
|
{
|
||||||
|
margin-left:10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#playpause:hover, #volume-button:hover, #fullscreen:hover
|
||||||
|
{
|
||||||
|
color:rgba(255,255,255,0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
#fullscreen
|
||||||
|
{
|
||||||
|
float:right;
|
||||||
|
color:white;
|
||||||
|
margin-right:15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#duration, #viewers
|
||||||
|
{
|
||||||
|
margin-top:5px;
|
||||||
|
font-family:"Roboto", sans-serif;
|
||||||
|
font-weight:300;
|
||||||
|
margin-left:15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#viewers{
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
#play, #pause, #volume-button, #fullscreen
|
||||||
|
{
|
||||||
|
font-size:20px;
|
||||||
|
cursor:pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
#volume {
|
||||||
|
cursor:pointer;
|
||||||
|
float:left;
|
||||||
|
position: relative;
|
||||||
|
left: 10px;
|
||||||
|
margin: 13px auto;
|
||||||
|
height:5px;
|
||||||
|
width: 75px;
|
||||||
|
/*background-color:rgba(0, 0, 0, 0.5);*/
|
||||||
|
background:rgba(0, 0, 0, 0.5) 50% 50% repeat-x;
|
||||||
|
border: none;
|
||||||
|
outline: none;
|
||||||
|
/*border-radius: 2px;*/
|
||||||
|
}
|
||||||
|
|
||||||
|
#volume .ui-slider-range-min {
|
||||||
|
height:5px;
|
||||||
|
width: 75px;
|
||||||
|
position: absolute;
|
||||||
|
background-color:rgba(255, 255, 255, 0.8);
|
||||||
|
border: none;
|
||||||
|
outline: none;
|
||||||
|
/*border-radius: 2px;*/
|
||||||
|
}
|
||||||
|
|
||||||
|
#volume .ui-slider-handle {
|
||||||
|
height:15px;
|
||||||
|
width:5px;
|
||||||
|
background:#fff 50% 50% repeat-x;
|
||||||
|
position: absolute;
|
||||||
|
cursor: pointer;
|
||||||
|
outline: none;
|
||||||
|
border: none;
|
||||||
|
display: none;
|
||||||
|
margin-left:-2.5px;
|
||||||
|
margin-top:0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-slider-handle
|
||||||
|
{
|
||||||
|
margin-top:-5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.play
|
||||||
|
{
|
||||||
|
background-size: auto;
|
||||||
|
width: 55px;
|
||||||
|
height: 27px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pause
|
||||||
|
{
|
||||||
|
background-size: auto;
|
||||||
|
width: 55px;
|
||||||
|
height: 27px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hide
|
||||||
|
{
|
||||||
|
display:none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
#bar
|
||||||
|
{
|
||||||
|
height:100%;
|
||||||
|
background-color:rgba(0,0,0,0.5);
|
||||||
|
}
|
||||||
@@ -10,6 +10,10 @@
|
|||||||
|
|
||||||
.snow{-webkit-filter:brightness(100%);-moz-filter:brightness(100%);-o-filter:brightness(100%);filter:brightness(100%);width:5px; height:5px; background-color:white;z-index:1000000;pointer-events:none;position:absolute;border:1px solid white;border-radius:100px;}
|
.snow{-webkit-filter:brightness(100%);-moz-filter:brightness(100%);-o-filter:brightness(100%);filter:brightness(100%);width:5px; height:5px; background-color:white;z-index:1000000;pointer-events:none;position:absolute;border:1px solid white;border-radius:100px;}
|
||||||
|
|
||||||
|
#embed-button{
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
|
|
||||||
/* GLOBAL STYLES */
|
/* GLOBAL STYLES */
|
||||||
|
|
||||||
#playbar{
|
#playbar{
|
||||||
|
|||||||
982
static/dist/embed.min.js
vendored
Normal file
982
static/dist/embed.min.js
vendored
Normal file
@@ -0,0 +1,982 @@
|
|||||||
|
var Youtube = {
|
||||||
|
|
||||||
|
loaded: true,
|
||||||
|
before_load: "",
|
||||||
|
after_load: "",
|
||||||
|
ytplayer: "",
|
||||||
|
stopInterval: false,
|
||||||
|
|
||||||
|
setup_youtube_listener: function(channel)
|
||||||
|
{
|
||||||
|
socket.on("np", function(obj)
|
||||||
|
{
|
||||||
|
Youtube.loaded = false;
|
||||||
|
|
||||||
|
if(obj[0].length == 0){
|
||||||
|
|
||||||
|
document.getElementById('song-title').innerHTML = "Empty channel. Add some songs!";
|
||||||
|
$("#player_overlay").height($("#player").height());
|
||||||
|
|
||||||
|
if(!/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) $("#player_overlay").toggleClass("hide");
|
||||||
|
try{
|
||||||
|
Youtube.ytplayer.stopVideo();
|
||||||
|
}catch(e){}
|
||||||
|
//List.importOldList(channel.toLowerCase());
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
//console.log("gotten new song");
|
||||||
|
if(previous_video_id == undefined)
|
||||||
|
previous_video_id = obj[0][0]["id"];
|
||||||
|
else if(previous_video_id != video_id)
|
||||||
|
previous_video_id = video_id;
|
||||||
|
|
||||||
|
video_id = obj[0][0]["id"];
|
||||||
|
conf = obj[1][0];
|
||||||
|
time = obj[2];
|
||||||
|
seekTo = time - conf["startTime"];
|
||||||
|
song_title = obj[0][0]["title"];
|
||||||
|
|
||||||
|
$("#player_overlay").addClass("hide");
|
||||||
|
|
||||||
|
try{
|
||||||
|
Suggestions.fetchYoutubeSuggests(video_id);
|
||||||
|
}catch(e){}
|
||||||
|
Youtube.getTitle(song_title, viewers);
|
||||||
|
Youtube.setBGimage(video_id);
|
||||||
|
//if(player_ready && !window.mobilecheck())
|
||||||
|
if(player_ready && !/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream)
|
||||||
|
{
|
||||||
|
|
||||||
|
try{
|
||||||
|
if(Youtube.ytplayer.getVideoUrl().split('v=')[1] != video_id)
|
||||||
|
{
|
||||||
|
Youtube.ytplayer.loadVideoById(video_id);
|
||||||
|
Youtube.notifyUser(video_id, song_title);
|
||||||
|
Youtube.ytplayer.seekTo(seekTo);
|
||||||
|
if(paused)
|
||||||
|
Youtube.ytplayer.pauseVideo();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!paused){
|
||||||
|
Youtube.ytplayer.playVideo();
|
||||||
|
Youtube.durationSetter();
|
||||||
|
}
|
||||||
|
if(Youtube.ytplayer.getDuration() > seekTo || Youtube.ytplayer.getDuration() == 0)
|
||||||
|
Youtube.ytplayer.seekTo(seekTo);
|
||||||
|
Youtube.after_load = video_id;
|
||||||
|
setTimeout(function(){Youtube.loaded = true;},500);
|
||||||
|
}catch(e){Youtube.durationSetter();}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Youtube.getTitle(song_title, viewers);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.on("viewers", function(view)
|
||||||
|
{
|
||||||
|
viewers = view;
|
||||||
|
|
||||||
|
if(song_title !== undefined)
|
||||||
|
Youtube.getTitle(song_title, viewers);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
onPlayerStateChange: function(newState) {
|
||||||
|
switch(newState.data)
|
||||||
|
{
|
||||||
|
case -1:
|
||||||
|
break;
|
||||||
|
case 0:
|
||||||
|
playing = false;
|
||||||
|
paused = false;
|
||||||
|
|
||||||
|
socket.emit("end", video_id);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
playing = true;
|
||||||
|
if(beginning && window.mobilecheck()){
|
||||||
|
Youtube.ytplayer.pauseVideo();
|
||||||
|
beginning = false;
|
||||||
|
}
|
||||||
|
if(document.getElementById("play").className.split(" ").length == 1)
|
||||||
|
$("#play").toggleClass("hide");
|
||||||
|
if(document.getElementById("pause").className.split(" ").length == 2)
|
||||||
|
$("#pause").toggleClass("hide");
|
||||||
|
if(paused)
|
||||||
|
{
|
||||||
|
socket.emit('pos');
|
||||||
|
paused = false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
paused = true;
|
||||||
|
|
||||||
|
if(document.getElementById("pause").className.split(" ").length == 1)
|
||||||
|
$("#pause").toggleClass("hide");
|
||||||
|
if(document.getElementById("play").className.split(" ").length == 2)
|
||||||
|
$("#play").toggleClass("hide");
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
getTitle: function(titt, v)
|
||||||
|
{
|
||||||
|
var outPutWord = v > 1 ? "viewers" : "viewer";
|
||||||
|
var title = decodeURIComponent(titt);
|
||||||
|
var elem = document.getElementById('song-title');
|
||||||
|
var viewers = document.getElementById('viewers');
|
||||||
|
|
||||||
|
document.title = title + " • Zöff / "+chan;
|
||||||
|
elem.innerHTML = title;
|
||||||
|
viewers.innerHTML = v + " " + outPutWord;
|
||||||
|
elem.title = title + " • " + v + " " + outPutWord;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
errorHandler: function(newState)
|
||||||
|
{
|
||||||
|
if(newState.data == 5 || newState.data == 100
|
||||||
|
|| newState.data == 101 || newState.data == 150)
|
||||||
|
{
|
||||||
|
/*if(Youtube.count == 2){
|
||||||
|
Youtube.count = 0;*/
|
||||||
|
/*console.log("Before: " + Youtube.before_load);
|
||||||
|
console.log("Now: " + video_id);
|
||||||
|
console.log("After: " + Youtube.after_load);
|
||||||
|
console.log(Youtube.before_load == Youtube.ytplayer.getVideoUrl);*/
|
||||||
|
curr_playing = Youtube.ytplayer.getVideoUrl().replace("https://www.youtube.com/watch?v=", "");
|
||||||
|
|
||||||
|
|
||||||
|
socket.emit("skip", {error: newState.data, id: video_id, pass: adminpass});
|
||||||
|
//console.log(video_id, Youtube.ytplayer.getVideoUrl(), Youtube.ytplayer.getPlayerState());
|
||||||
|
|
||||||
|
/*}else{
|
||||||
|
setTimeout(function(){
|
||||||
|
Youtube.ytplayer.loadVideoById(video_id);
|
||||||
|
Youtube.count ++;
|
||||||
|
}, Math.floor((Math.random() * 100) + 1));
|
||||||
|
}*/
|
||||||
|
}else if(video_id !== undefined)
|
||||||
|
Youtube.ytplayer.loadVideoById(video_id);
|
||||||
|
},
|
||||||
|
|
||||||
|
onPlayerReady: function(event) {
|
||||||
|
$("#channel-load").css("display", "none");
|
||||||
|
try{
|
||||||
|
beginning = true;
|
||||||
|
player_ready = true;
|
||||||
|
if(!/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream)
|
||||||
|
{
|
||||||
|
$("#player").css("opacity", "1");
|
||||||
|
$("#controls").css("opacity", "1");
|
||||||
|
$(".playlist").css("opacity", "1");
|
||||||
|
window.ytplayer = Youtube.ytplayer;
|
||||||
|
Youtube.ytplayer.loadVideoById(video_id);
|
||||||
|
Youtube.ytplayer.playVideo();
|
||||||
|
Youtube.durationSetter();
|
||||||
|
Youtube.ytplayer.seekTo(seekTo);
|
||||||
|
}
|
||||||
|
Youtube.readyLooks();
|
||||||
|
Playercontrols.initYoutubeControls(Youtube.ytplayer);
|
||||||
|
Playercontrols.initSlider();
|
||||||
|
Youtube.ytplayer.setVolume(Crypt.get_volume());
|
||||||
|
}catch(e){}
|
||||||
|
},
|
||||||
|
|
||||||
|
readyLooks: function()
|
||||||
|
{
|
||||||
|
Youtube.setBGimage(video_id);
|
||||||
|
},
|
||||||
|
|
||||||
|
setBGimage: function(id){
|
||||||
|
|
||||||
|
if(id !== undefined && !embed)
|
||||||
|
{
|
||||||
|
var img = new Image();
|
||||||
|
img.onload = function ()
|
||||||
|
{
|
||||||
|
|
||||||
|
var colorThief = new ColorThief();
|
||||||
|
var color = colorThief.getColor(img);
|
||||||
|
|
||||||
|
document.getElementsByTagName("body")[0].style.backgroundColor = Helper.rgbToHsl(color);
|
||||||
|
$("meta[name=theme-color]").attr("content", Helper.rgbToHex(color[0], color[1], color[2]));
|
||||||
|
};
|
||||||
|
|
||||||
|
img.crossOrigin = 'Anonymous';
|
||||||
|
img.src = 'https://zoff.no:8080/https://img.youtube.com/vi/'+id+'/mqdefault.jpg';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
set_width: function(val){
|
||||||
|
$(".video-container").width(val);
|
||||||
|
},
|
||||||
|
|
||||||
|
notifyUser: function(id, title) {
|
||||||
|
title = title.replace(/\\\'/g, "'").replace(/"/g,"'").replace(/&/g,"&");
|
||||||
|
if (Notification.permission === "granted" && document.hidden) {
|
||||||
|
var notification = new Notification("Now Playing", {body: title, icon: "http://i.ytimg.com/vi/"+id+"/mqdefault.jpg", iconUrl: "http://i.ytimg.com/vi/"+id+"/mqdefault.jpg"});
|
||||||
|
notification.onclick = function(x) { window.focus(); this.cancel(); };
|
||||||
|
setTimeout(function(){
|
||||||
|
notification.close();
|
||||||
|
},5000);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
setup_all_listeners: function()
|
||||||
|
{
|
||||||
|
socket.on("get_list", function(){
|
||||||
|
socket.emit('list', chan.toLowerCase());
|
||||||
|
});
|
||||||
|
Youtube.setup_youtube_listener(chan);
|
||||||
|
Admin.admin_listener();
|
||||||
|
Chat.setup_chat_listener(chan);
|
||||||
|
Chat.allchat_listener();
|
||||||
|
List.channel_listener();
|
||||||
|
List.skipping_listener();
|
||||||
|
},
|
||||||
|
|
||||||
|
onYouTubeIframeAPIReady: function() {
|
||||||
|
Youtube.ytplayer = new YT.Player('player', {
|
||||||
|
videoId: "asd",
|
||||||
|
playerVars: { rel:"0", wmode:"transparent", controls: "0" , iv_load_policy: "3", theme:"light", color:"white"},
|
||||||
|
events: {
|
||||||
|
'onReady': Youtube.onPlayerReady,
|
||||||
|
'onStateChange': Youtube.onPlayerStateChange,
|
||||||
|
'onError': Youtube.errorHandler
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//Youtube.durationSetter();
|
||||||
|
},
|
||||||
|
|
||||||
|
durationSetter: function()
|
||||||
|
{
|
||||||
|
try{
|
||||||
|
duration = Youtube.ytplayer.getDuration();
|
||||||
|
}catch(e){duration = 0};
|
||||||
|
if(duration != undefined){
|
||||||
|
try{
|
||||||
|
dMinutes = Math.floor(duration / 60);
|
||||||
|
dSeconds = duration - dMinutes * 60;
|
||||||
|
currDurr = Youtube.ytplayer.getCurrentTime();
|
||||||
|
if(currDurr > duration)
|
||||||
|
currDurr = duration;
|
||||||
|
minutes = Math.floor(currDurr / 60);
|
||||||
|
seconds = currDurr - minutes * 60;
|
||||||
|
document.getElementById("duration").innerHTML = Helper.pad(minutes)+":"+Helper.pad(seconds)+" <span id='dash'>/</span> "+Helper.pad(dMinutes)+":"+Helper.pad(dSeconds);
|
||||||
|
per = (100 / duration) * currDurr;
|
||||||
|
if(per >= 100)
|
||||||
|
per = 100;
|
||||||
|
else if(duration == 0)
|
||||||
|
per = 0;
|
||||||
|
$("#bar").width(per+"%");
|
||||||
|
}catch(e){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!Youtube.stopInterval) setTimeout(Youtube.durationSetter, 1000);
|
||||||
|
},
|
||||||
|
|
||||||
|
loadPlayer: function() {
|
||||||
|
if($("script[src='https://www.youtube.com/iframe_api']")["length"] == 1){
|
||||||
|
Youtube.onYouTubeIframeAPIReady();
|
||||||
|
}else{
|
||||||
|
tag = document.createElement('script');
|
||||||
|
tag.src = "https://www.youtube.com/iframe_api";
|
||||||
|
firstScriptTag = document.getElementsByTagName('script')[0];
|
||||||
|
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
window.mobilecheck = function() {
|
||||||
|
var check = false;
|
||||||
|
(function(a){if(/(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(a)||/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(a.substr(0,4)))check = true;})(navigator.userAgent||navigator.vendor||window.opera);
|
||||||
|
return check;
|
||||||
|
};
|
||||||
|
|
||||||
|
var Helper = {
|
||||||
|
rnd: function(arr)
|
||||||
|
{
|
||||||
|
return arr[Math.floor(Math.random() * arr.length)];
|
||||||
|
},
|
||||||
|
|
||||||
|
predicate: function() {
|
||||||
|
var fields = [],
|
||||||
|
n_fields = arguments.length,
|
||||||
|
field, name, cmp;
|
||||||
|
|
||||||
|
var default_cmp = function (a, b) {
|
||||||
|
if (a === b) return 0;
|
||||||
|
return a < b ? -1 : 1;
|
||||||
|
},
|
||||||
|
getCmpFunc = function (primer, reverse) {
|
||||||
|
var dfc = default_cmp,
|
||||||
|
// closer in scope
|
||||||
|
cmp = default_cmp;
|
||||||
|
if (primer) {
|
||||||
|
cmp = function (a, b) {
|
||||||
|
return dfc(primer(a), primer(b));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (reverse) {
|
||||||
|
return function (a, b) {
|
||||||
|
return -1 * cmp(a, b);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return cmp;
|
||||||
|
};
|
||||||
|
|
||||||
|
// preprocess sorting options
|
||||||
|
for (var i = 0; i < n_fields; i++) {
|
||||||
|
field = arguments[i];
|
||||||
|
if (typeof field === 'string') {
|
||||||
|
name = field;
|
||||||
|
cmp = default_cmp;
|
||||||
|
} else {
|
||||||
|
name = field.name;
|
||||||
|
cmp = getCmpFunc(field.primer, field.reverse);
|
||||||
|
}
|
||||||
|
fields.push({
|
||||||
|
name: name,
|
||||||
|
cmp: cmp
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// final comparison function
|
||||||
|
return function (A, B) {
|
||||||
|
var name, result;
|
||||||
|
for (var i = 0; i < n_fields; i++) {
|
||||||
|
result = 0;
|
||||||
|
field = fields[i];
|
||||||
|
name = field.name;
|
||||||
|
|
||||||
|
result = field.cmp(A[name], B[name]);
|
||||||
|
if (result !== 0) break;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
hashCode: function(str) { // java String#hashCode
|
||||||
|
var hash = 0;
|
||||||
|
for (var i = 0; i < str.length; i++) {
|
||||||
|
hash = str.charCodeAt(i) + ((hash << 5) - hash);
|
||||||
|
}
|
||||||
|
return hash;
|
||||||
|
},
|
||||||
|
|
||||||
|
intToARGB: function(i){
|
||||||
|
return ((i>>24)&0xFF).toString(16) +
|
||||||
|
((i>>16)&0xFF).toString(16) +
|
||||||
|
((i>>8)&0xFF).toString(16) +
|
||||||
|
(i&0xFF).toString(16);
|
||||||
|
},
|
||||||
|
|
||||||
|
pad: function(n)
|
||||||
|
{
|
||||||
|
return n < 10 ? "0"+Math.floor(n) : Math.floor(n);
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
contains: function(a, obj) {
|
||||||
|
var i = a.length;
|
||||||
|
while (i--) {
|
||||||
|
if (a[i] === obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
|
||||||
|
sample: function() {
|
||||||
|
if (Date.now() - lastSample >= SAMPLE_RATE * 2) {
|
||||||
|
socket.removeAllListeners()
|
||||||
|
socket.disconnect();
|
||||||
|
socket.connect();
|
||||||
|
Youtube.setup_all_listeners();
|
||||||
|
}
|
||||||
|
lastSample = Date.now();
|
||||||
|
setTimeout(Helper.sample, SAMPLE_RATE);
|
||||||
|
},
|
||||||
|
|
||||||
|
loadjsfile: function(filename)
|
||||||
|
{
|
||||||
|
if (filesadded.indexOf("["+filename+"]")==-1){
|
||||||
|
var fileref=document.createElement('script');
|
||||||
|
fileref.setAttribute("type","text/javascript");
|
||||||
|
fileref.setAttribute("src", filename);
|
||||||
|
document.getElementsByTagName("head")[0].appendChild(fileref);
|
||||||
|
filesadded+="["+filename+"]";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
msieversion: function() {
|
||||||
|
|
||||||
|
var ua = window.navigator.userAgent;
|
||||||
|
var msie = ua.indexOf("MSIE ");
|
||||||
|
|
||||||
|
if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) // If Internet Explorer, return version number
|
||||||
|
return true;
|
||||||
|
else // If another browser, return 0
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
|
||||||
|
getRandomInt: function(min, max) {
|
||||||
|
return Math.floor(Math.random() * (max - min)) + min;
|
||||||
|
},
|
||||||
|
|
||||||
|
rgbToHsl: function(arr){
|
||||||
|
r = arr[0], g = arr[1], b = arr[2];
|
||||||
|
r /= 255, g /= 255, b /= 255;
|
||||||
|
var max = Math.max(r, g, b), min = Math.min(r, g, b);
|
||||||
|
var h, s, l = (max + min) / 2;
|
||||||
|
|
||||||
|
if(max == min){
|
||||||
|
h = s = 0; // achromatic
|
||||||
|
}else{
|
||||||
|
var d = max - min;
|
||||||
|
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
||||||
|
switch(max){
|
||||||
|
case r: h = (g - b) / d + (g < b ? 6 : 0); break;
|
||||||
|
case g: h = (b - r) / d + 2; break;
|
||||||
|
case b: h = (r - g) / d + 4; break;
|
||||||
|
}
|
||||||
|
h /= 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(l>0.5)l=0.5; //make sure it isnt too light
|
||||||
|
|
||||||
|
return "hsl("+Math.floor(h*360)+", "+Math.floor(s*100)+"%, "+Math.floor(l*100)+"%)";
|
||||||
|
},
|
||||||
|
|
||||||
|
componentToHex: function(c) {
|
||||||
|
var hex = c.toString(16);
|
||||||
|
return hex.length == 1 ? "0" + hex : hex;
|
||||||
|
},
|
||||||
|
|
||||||
|
rgbToHex: function(r, g, b) {
|
||||||
|
return "#" + Helper.componentToHex(r) + Helper.componentToHex(g) + Helper.componentToHex(b);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Element.prototype.remove = function() {
|
||||||
|
this.parentElement.removeChild(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
NodeList.prototype.remove = HTMLCollection.prototype.remove = function() {
|
||||||
|
for(var i = 0, len = this.length; i < len; i++) {
|
||||||
|
if(this[i] && this[i].parentElement) {
|
||||||
|
this[i].parentElement.removeChild(this[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
String.prototype.startsWith = function(searchString, position) {
|
||||||
|
position = position || 0;
|
||||||
|
return this.indexOf(searchString, position) === position;
|
||||||
|
}
|
||||||
|
var Playercontrols = {
|
||||||
|
|
||||||
|
stopInterval: false,
|
||||||
|
|
||||||
|
initYoutubeControls: function()
|
||||||
|
{
|
||||||
|
if(window.mobilecheck() && !/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream){
|
||||||
|
$("#controls").appendTo("#playbar");
|
||||||
|
}
|
||||||
|
Playercontrols.initControls();
|
||||||
|
},
|
||||||
|
|
||||||
|
initControls: function()
|
||||||
|
{
|
||||||
|
document.getElementById("volume-button").addEventListener("click", Playercontrols.mute_video);
|
||||||
|
document.getElementById("playpause").addEventListener("click", Playercontrols.play_pause);
|
||||||
|
document.getElementById("fullscreen").addEventListener("click", Playercontrols.fullscreen);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
initSlider: function()
|
||||||
|
{
|
||||||
|
try{
|
||||||
|
vol = (Crypt.get_volume());
|
||||||
|
}catch(e){}
|
||||||
|
$("#volume").slider({
|
||||||
|
min: 0,
|
||||||
|
max: 100,
|
||||||
|
value: vol,
|
||||||
|
range: "min",
|
||||||
|
animate: true,
|
||||||
|
slide: function(event, ui) {
|
||||||
|
|
||||||
|
Playercontrols.setVolume(ui.value);
|
||||||
|
//localStorage.setItem("volume", ui.value);
|
||||||
|
try{Crypt.set_volume(ui.value);}catch(e){}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Playercontrols.choose_button(vol, false);
|
||||||
|
//$("#volume").slider("value", ytplayer.getVolume());
|
||||||
|
},
|
||||||
|
|
||||||
|
fullscreen: function()
|
||||||
|
{
|
||||||
|
var playerElement = document.getElementById("player");
|
||||||
|
var requestFullScreen = playerElement.requestFullScreen || playerElement.mozRequestFullScreen || playerElement.webkitRequestFullScreen;
|
||||||
|
if (requestFullScreen) {
|
||||||
|
requestFullScreen.bind(playerElement)();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
play_pause: function()
|
||||||
|
{
|
||||||
|
|
||||||
|
if(Youtube.ytplayer.getPlayerState() == 1)
|
||||||
|
{
|
||||||
|
Youtube.ytplayer.pauseVideo();
|
||||||
|
if(window.mobilecheck() && !/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream)
|
||||||
|
document.getElementById("player").style.display = "none";
|
||||||
|
}else if(Youtube.ytplayer.getPlayerState() == 2 || Youtube.ytplayer.getPlayerState() == 0)
|
||||||
|
{
|
||||||
|
Youtube.ytplayer.playVideo();
|
||||||
|
if(window.mobilecheck() && !/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream)
|
||||||
|
document.getElementById("player").style.display = "block";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
settings: function()
|
||||||
|
{
|
||||||
|
$("#qS").toggleClass("hide");
|
||||||
|
},
|
||||||
|
|
||||||
|
changeQuality: function(wantedQ)
|
||||||
|
{
|
||||||
|
if(Youtube.ytplayer.getPlaybackQuality != wantedQ)
|
||||||
|
{
|
||||||
|
Youtube.ytplayer.setPlaybackQuality(wantedQ);
|
||||||
|
Youtube.ytplayer.getPlaybackQuality();
|
||||||
|
}
|
||||||
|
$("#qS").toggleClass("hide");
|
||||||
|
},
|
||||||
|
|
||||||
|
mute_video: function()
|
||||||
|
{
|
||||||
|
if(!Youtube.ytplayer.isMuted())
|
||||||
|
{
|
||||||
|
Playercontrols.choose_button(0, true);
|
||||||
|
Youtube.ytplayer.mute();
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
Youtube.ytplayer.unMute();
|
||||||
|
Playercontrols.choose_button(Youtube.ytplayer.getVolume(), false);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
setVolume: function(vol)
|
||||||
|
{
|
||||||
|
Youtube.ytplayer.setVolume(vol);
|
||||||
|
Playercontrols.choose_button(vol, false);
|
||||||
|
if(Youtube.ytplayer.isMuted())
|
||||||
|
Youtube.ytplayer.unMute();
|
||||||
|
},
|
||||||
|
|
||||||
|
choose_button: function(vol, mute)
|
||||||
|
{
|
||||||
|
if(!mute){
|
||||||
|
if(vol >= 0 && vol <= 33){
|
||||||
|
if(document.getElementById("v-full").className.split(" ").length == 1)
|
||||||
|
$("#v-full").toggleClass("hide");
|
||||||
|
if(document.getElementById("v-medium").className.split(" ").length == 1)
|
||||||
|
$("#v-medium").toggleClass("hide");
|
||||||
|
if(document.getElementById("v-low").className.split(" ").length == 2)
|
||||||
|
$("#v-low").toggleClass("hide");
|
||||||
|
if(document.getElementById("v-mute").className.split(" ").length == 1)
|
||||||
|
$("#v-mute").toggleClass("hide");
|
||||||
|
}else if(vol >= 34 && vol <= 66){
|
||||||
|
if(document.getElementById("v-full").className.split(" ").length == 1)
|
||||||
|
$("#v-full").toggleClass("hide");
|
||||||
|
if(document.getElementById("v-medium").className.split(" ").length == 2)
|
||||||
|
$("#v-medium").toggleClass("hide");
|
||||||
|
if(document.getElementById("v-low").className.split(" ").length == 1)
|
||||||
|
$("#v-low").toggleClass("hide");
|
||||||
|
if(document.getElementById("v-mute").className.split(" ").length == 1)
|
||||||
|
$("#v-mute").toggleClass("hide");
|
||||||
|
}else if(vol >= 67 && vol <= 100){
|
||||||
|
if(document.getElementById("v-full").className.split(" ").length == 2)
|
||||||
|
$("#v-full").toggleClass("hide");
|
||||||
|
if(document.getElementById("v-medium").className.split(" ").length == 1)
|
||||||
|
$("#v-medium").toggleClass("hide");
|
||||||
|
if(document.getElementById("v-low").className.split(" ").length == 1)
|
||||||
|
$("#v-low").toggleClass("hide");
|
||||||
|
if(document.getElementById("v-mute").className.split(" ").length == 1)
|
||||||
|
$("#v-mute").toggleClass("hide");
|
||||||
|
}
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
if(document.getElementById("v-full").className.split(" ").length == 1)
|
||||||
|
$("#v-full").toggleClass("hide");
|
||||||
|
if(document.getElementById("v-medium").className.split(" ").length == 1)
|
||||||
|
$("#v-medium").toggleClass("hide");
|
||||||
|
if(document.getElementById("v-low").className.split(" ").length == 1)
|
||||||
|
$("#v-low").toggleClass("hide");
|
||||||
|
if(document.getElementById("v-mute").className.split(" ").length == 2)
|
||||||
|
$("#v-mute").toggleClass("hide");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
playPause: function()
|
||||||
|
{
|
||||||
|
state = Youtube.ytplayer.getPlayerState();
|
||||||
|
button = document.getElementById("playpause");
|
||||||
|
if(state == 1)
|
||||||
|
{
|
||||||
|
Youtube.ytplayer.pauseVideo();
|
||||||
|
}else if(state == 2)
|
||||||
|
{
|
||||||
|
Youtube.ytplayer.playVideo();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
volumeOptions: function()
|
||||||
|
{
|
||||||
|
if(Youtube.ytplayer.isMuted())
|
||||||
|
{
|
||||||
|
Youtube.ytplayer.unMute();
|
||||||
|
vol = Youtube.ytplayer.getVolume();
|
||||||
|
$("#volume").slider("value", Youtube.ytplayer.getVolume());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Youtube.ytplayer.mute();
|
||||||
|
$("#volume").slider("value", 0);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
hoverMute: function(foo)
|
||||||
|
{
|
||||||
|
vol = Youtube.ytplayer.getVolume();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
var List = {
|
||||||
|
|
||||||
|
channel_listener: function()
|
||||||
|
{
|
||||||
|
socket.on("channel", function(msg){
|
||||||
|
List.channel_function(msg);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
channel_function: function(msg)
|
||||||
|
{
|
||||||
|
|
||||||
|
switch(msg[0])
|
||||||
|
{
|
||||||
|
case "list":
|
||||||
|
List.populate_list(msg[1]);
|
||||||
|
break;
|
||||||
|
case "added":
|
||||||
|
List.added_song(msg[1]);
|
||||||
|
break;
|
||||||
|
case "deleted":
|
||||||
|
List.deleted_song(msg[1]);
|
||||||
|
break;
|
||||||
|
case "vote":
|
||||||
|
List.voted_song(msg[1], msg[2]);
|
||||||
|
break;
|
||||||
|
case "song_change":
|
||||||
|
List.song_change(msg[1]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
populate_list: function(msg)
|
||||||
|
{
|
||||||
|
|
||||||
|
full_playlist = msg;
|
||||||
|
|
||||||
|
List.sortList();
|
||||||
|
$("#wrapper").empty();
|
||||||
|
|
||||||
|
$.each(full_playlist, function(j, current_song){
|
||||||
|
if(!current_song.now_playing){ //check that the song isnt playing
|
||||||
|
$("#wrapper").append(List.generateSong(current_song, false, lazy_load, true));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
if(lazy_load){
|
||||||
|
if(window.mobilecheck()) $(".list-image").lazyload({});
|
||||||
|
else $(".list-image").lazyload({container: $("#wrapper")}).removeClass("lazy");
|
||||||
|
}
|
||||||
|
$("#settings").css("visibility", "visible");
|
||||||
|
$("#settings").css("opacity", "1");
|
||||||
|
$("#wrapper").css("opacity", "1");
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
added_song: function(added){
|
||||||
|
full_playlist.push(added);
|
||||||
|
List.sortList();
|
||||||
|
$("#suggested-"+added.id).remove();
|
||||||
|
List.insertAtIndex(added, true);
|
||||||
|
},
|
||||||
|
|
||||||
|
deleted_song: function(deleted){
|
||||||
|
|
||||||
|
var index = List.getIndexOfSong(deleted);
|
||||||
|
var to_delete = $("#wrapper").children()[index];
|
||||||
|
try{
|
||||||
|
to_delete.style.height = 0;
|
||||||
|
|
||||||
|
setTimeout(function()
|
||||||
|
{
|
||||||
|
$("#"+deleted).remove();
|
||||||
|
full_playlist.splice(List.getIndexOfSong(deleted), 1);
|
||||||
|
}, 305);
|
||||||
|
|
||||||
|
document.getElementById('wrapper').scrollTop += 1;
|
||||||
|
document.getElementById('wrapper').scrollTop += -1;
|
||||||
|
}catch(err){
|
||||||
|
full_playlist.splice(List.getIndexOfSong(deleted), 1);
|
||||||
|
$("#wrapper").children()[$("#wrapper").children().length-1].remove();
|
||||||
|
}
|
||||||
|
$("#suggested-"+deleted).remove();
|
||||||
|
Suggestions.checkUserEmpty();
|
||||||
|
},
|
||||||
|
|
||||||
|
voted_song: function(voted, time){
|
||||||
|
var index_of_song = List.getIndexOfSong(voted);
|
||||||
|
var song_voted_on = full_playlist[index_of_song];
|
||||||
|
|
||||||
|
full_playlist[index_of_song].votes += 1;
|
||||||
|
full_playlist[index_of_song].added = time;
|
||||||
|
|
||||||
|
List.sortList();
|
||||||
|
$("#"+voted).remove();
|
||||||
|
List.insertAtIndex(song_voted_on, false);
|
||||||
|
},
|
||||||
|
|
||||||
|
song_change: function(time){
|
||||||
|
var length = full_playlist.length-1;
|
||||||
|
|
||||||
|
full_playlist[0].now_playing = true;
|
||||||
|
full_playlist[0].votes = 0;
|
||||||
|
full_playlist[0].guids = [];
|
||||||
|
full_playlist[0].added = time;
|
||||||
|
full_playlist[length].now_playing = false;
|
||||||
|
|
||||||
|
full_playlist.push(full_playlist.shift());
|
||||||
|
$("#wrapper").children()[0].remove();
|
||||||
|
|
||||||
|
List.insertAtIndex(full_playlist[length-1], false);
|
||||||
|
document.getElementById('wrapper').scrollTop += 1;
|
||||||
|
document.getElementById('wrapper').scrollTop += -1;
|
||||||
|
},
|
||||||
|
|
||||||
|
vote: function(id, vote){
|
||||||
|
socket.emit('vote', [chan, id, vote, adminpass]);
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
|
skip: function(){
|
||||||
|
socket.emit('skip', {pass: adminpass, id:video_id});
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
|
importOldList: function(chan){
|
||||||
|
var ids="";
|
||||||
|
var num=0;
|
||||||
|
|
||||||
|
playlist_url = "lists/"+chan+".json";
|
||||||
|
|
||||||
|
list = $.parseJSON($.ajax({
|
||||||
|
type: "GET",
|
||||||
|
url: playlist_url,
|
||||||
|
async: false
|
||||||
|
}).responseText);
|
||||||
|
|
||||||
|
$.each(list.songs, function(i,data)
|
||||||
|
{
|
||||||
|
ids+=data.id+",";
|
||||||
|
|
||||||
|
if(num>45){
|
||||||
|
Search.addVideos(ids);
|
||||||
|
|
||||||
|
ids = "";
|
||||||
|
num = 0;
|
||||||
|
}
|
||||||
|
num++;
|
||||||
|
});
|
||||||
|
|
||||||
|
Search.addVideos(ids);
|
||||||
|
document.getElementById("search").value = "";
|
||||||
|
},
|
||||||
|
|
||||||
|
sortList: function()
|
||||||
|
{
|
||||||
|
full_playlist.sort(Helper.predicate({
|
||||||
|
name: 'votes',
|
||||||
|
reverse: true
|
||||||
|
}, 'added'));
|
||||||
|
},
|
||||||
|
|
||||||
|
show: function(){
|
||||||
|
if(!window.mobilecheck())
|
||||||
|
{
|
||||||
|
if(showToggle){
|
||||||
|
showToggle=false;
|
||||||
|
$("#toptitle").empty();
|
||||||
|
$("#chan").addClass("bigChan");
|
||||||
|
//$("#chan").html("zoff.no/"+encodeURI(chan));
|
||||||
|
$("#chan").html("zoff.no/"+chan.toLowerCase());
|
||||||
|
}else{
|
||||||
|
showToggle=true;
|
||||||
|
$("#toptitle").html("Zöff");
|
||||||
|
$("#chan").removeClass("bigChan");
|
||||||
|
$("#chan").html(chan);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
insertAtIndex: function(song_info, transition) {
|
||||||
|
i = List.getIndexOfSong(song_info.id);
|
||||||
|
|
||||||
|
if(i === 0)
|
||||||
|
$("#wrapper").prepend(List.generateSong(song_info, transition, false, true, false));
|
||||||
|
else
|
||||||
|
$("#wrapper > div:nth-child(" + (i) + ")").after(List.generateSong(song_info, transition, false, true, false));
|
||||||
|
|
||||||
|
if(transition)
|
||||||
|
{
|
||||||
|
setTimeout(function(){
|
||||||
|
var added = $("#wrapper").children()[i];
|
||||||
|
$(added).css("height", 66);
|
||||||
|
},5);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
generateSong: function(song_info, transition, lazy, list, user)
|
||||||
|
{
|
||||||
|
var video_id = song_info.id;
|
||||||
|
var video_title = song_info.title;
|
||||||
|
var video_votes = song_info.votes;
|
||||||
|
var video_thumb = "background-image:url('//img.youtube.com/vi/"+video_id+"/mqdefault.jpg');";
|
||||||
|
var song = $("<div>"+list_html+"</div>");
|
||||||
|
var image_attr = "style";
|
||||||
|
|
||||||
|
var attr;
|
||||||
|
var del_attr;
|
||||||
|
|
||||||
|
if(transition) song.find("#list-song").css("height", 0);
|
||||||
|
if(!w_p) song.find(".card-action").removeClass("hide");
|
||||||
|
if(video_votes == 1)song.find(".vote-text").text("vote");
|
||||||
|
if(lazy){
|
||||||
|
video_thumb = "//img.youtube.com/vi/"+video_id+"/mqdefault.jpg";
|
||||||
|
image_attr = "data-original";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(list){
|
||||||
|
song.find(".list-votes").text(video_votes);
|
||||||
|
song.find("#list-song").attr("id", video_id);
|
||||||
|
|
||||||
|
attr = ".vote-container";
|
||||||
|
del_attr = "del";
|
||||||
|
}else if(!list){
|
||||||
|
|
||||||
|
song.find(".vote-text").text(song_info.duration);
|
||||||
|
|
||||||
|
attr = ".add-suggested";
|
||||||
|
if(user)
|
||||||
|
del_attr = "del_user_suggested";
|
||||||
|
else
|
||||||
|
del_attr = "del_suggested";
|
||||||
|
|
||||||
|
song.find(".vote-container").attr("class", "clickable add-suggested");
|
||||||
|
song.find(".add-suggested").attr("title", "Add song!");
|
||||||
|
song.find("#del").attr("id", del_attr);
|
||||||
|
song.find(attr).attr("data-video-title", video_title);
|
||||||
|
song.find(attr).attr("data-video-length", song_info.length);
|
||||||
|
song.find("#list-song").attr("id", "suggested-" + video_id);
|
||||||
|
song.find(".list-image").attr("class", song.find(".list-image").attr("class").replace("list-image", "list-suggested-image"));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
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')");
|
||||||
|
song.find(attr).attr("data-video-id", video_id);
|
||||||
|
song.find(".list-image").attr(image_attr,video_thumb);
|
||||||
|
song.find(".list-suggested-image").attr(image_attr,video_thumb);
|
||||||
|
song.find("#"+del_attr).attr("data-video-id", video_id);
|
||||||
|
//song.find("#del").attr("onclick", "vote('"+video_id+"', 'del')");
|
||||||
|
|
||||||
|
return song.html();
|
||||||
|
},
|
||||||
|
|
||||||
|
getIndexOfSong: function(id)
|
||||||
|
{
|
||||||
|
indexes = $.map(full_playlist, function(obj, index) {
|
||||||
|
if(obj.id == id) {
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return indexes[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var song_title = "";
|
||||||
|
var paused = false;
|
||||||
|
var player_ready = false;
|
||||||
|
var list_html = $("#list-song-html").html();
|
||||||
|
var w_p = true;
|
||||||
|
var lazy_load = false;
|
||||||
|
var embed = true;
|
||||||
|
var vol = 100;
|
||||||
|
var adminpass = "";
|
||||||
|
|
||||||
|
var seekTo;
|
||||||
|
var socket;
|
||||||
|
var video_id;
|
||||||
|
var previous_video_id;
|
||||||
|
var chan = ($("#zoffchannel").html()).toLowerCase();
|
||||||
|
|
||||||
|
var connection_options = {
|
||||||
|
'sync disconnect on unload':true,
|
||||||
|
'secure': true,
|
||||||
|
'force new connection': true
|
||||||
|
};
|
||||||
|
|
||||||
|
$(document).ready(function(){
|
||||||
|
console.log("loadshit");
|
||||||
|
|
||||||
|
$("head").append('<link type="text/css" rel="stylesheet" href="/static/css/embed.css" />');
|
||||||
|
$("head").append('<link type="text/css" rel="stylesheet" href="/static/css/materialize.min.css" />');
|
||||||
|
|
||||||
|
if(window.location.hostname != "zoff.no") add = "https://zoff.no";
|
||||||
|
else add = "localhost";
|
||||||
|
socket = io.connect(''+add+':8880', connection_options);
|
||||||
|
|
||||||
|
socket.on("get_list", function(){
|
||||||
|
setTimeout(function(){socket.emit('list', chan.toLowerCase())},1000);
|
||||||
|
});
|
||||||
|
|
||||||
|
Youtube.setup_youtube_listener(chan);
|
||||||
|
List.channel_listener();
|
||||||
|
|
||||||
|
|
||||||
|
window.onYouTubeIframeAPIReady = Youtube.onYouTubeIframeAPIReady;
|
||||||
|
|
||||||
|
Youtube.loadPlayer();
|
||||||
|
|
||||||
|
Playercontrols.initSlider();
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).on( "click", ".vote-container", function(e){
|
||||||
|
var id = $(this).attr("data-video-id");
|
||||||
|
List.vote(id, "pos");
|
||||||
|
});
|
||||||
4
static/dist/main.min.js
vendored
Normal file → Executable file
4
static/dist/main.min.js
vendored
Normal file → Executable file
File diff suppressed because one or more lines are too long
@@ -45,7 +45,6 @@ var Chat = {
|
|||||||
|
|
||||||
setup_chat_listener: function(channel)
|
setup_chat_listener: function(channel)
|
||||||
{
|
{
|
||||||
document.getElementsByClassName("chat-tab")[0].innerHTML = channel;
|
|
||||||
socket.on("chat", function(data)
|
socket.on("chat", function(data)
|
||||||
{
|
{
|
||||||
if($("#chat-bar").position()["left"] != 0)
|
if($("#chat-bar").position()["left"] != 0)
|
||||||
|
|||||||
52
static/js/embed.js
Normal file
52
static/js/embed.js
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
|
||||||
|
var song_title = "";
|
||||||
|
var paused = false;
|
||||||
|
var player_ready = false;
|
||||||
|
var list_html = $("#list-song-html").html();
|
||||||
|
var w_p = true;
|
||||||
|
var lazy_load = false;
|
||||||
|
var embed = true;
|
||||||
|
var vol = 100;
|
||||||
|
var adminpass = "";
|
||||||
|
|
||||||
|
var seekTo;
|
||||||
|
var socket;
|
||||||
|
var video_id;
|
||||||
|
var previous_video_id;
|
||||||
|
var chan = ($("#zoffchannel").html()).toLowerCase();
|
||||||
|
|
||||||
|
var connection_options = {
|
||||||
|
'sync disconnect on unload':true,
|
||||||
|
'secure': true,
|
||||||
|
'force new connection': true
|
||||||
|
};
|
||||||
|
|
||||||
|
$(document).ready(function(){
|
||||||
|
console.log("loadshit");
|
||||||
|
|
||||||
|
$("head").append('<link type="text/css" rel="stylesheet" href="/static/css/embed.css" />');
|
||||||
|
$("head").append('<link type="text/css" rel="stylesheet" href="/static/css/materialize.min.css" />');
|
||||||
|
|
||||||
|
if(window.location.hostname != "zoff.no") add = "https://zoff.no";
|
||||||
|
else add = "localhost";
|
||||||
|
socket = io.connect(''+add+':8880', connection_options);
|
||||||
|
|
||||||
|
socket.on("get_list", function(){
|
||||||
|
setTimeout(function(){socket.emit('list', chan.toLowerCase())},1000);
|
||||||
|
});
|
||||||
|
|
||||||
|
Youtube.setup_youtube_listener(chan);
|
||||||
|
List.channel_listener();
|
||||||
|
|
||||||
|
|
||||||
|
window.onYouTubeIframeAPIReady = Youtube.onYouTubeIframeAPIReady;
|
||||||
|
|
||||||
|
Youtube.loadPlayer();
|
||||||
|
|
||||||
|
Playercontrols.initSlider();
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).on( "click", ".vote-container", function(e){
|
||||||
|
var id = $(this).attr("data-video-id");
|
||||||
|
List.vote(id, "pos");
|
||||||
|
});
|
||||||
@@ -52,7 +52,7 @@ var Hostcontroller = {
|
|||||||
ytplayer.pauseVideo()
|
ytplayer.pauseVideo()
|
||||||
else if(arr[0] == "play")
|
else if(arr[0] == "play")
|
||||||
ytplayer.playVideo();
|
ytplayer.playVideo();
|
||||||
else if(arr[0] == "skip")
|
else if(arr[0] == "skip")
|
||||||
List.skip();
|
List.skip();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -30,17 +30,6 @@ var List = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
skipping_listener: function(){
|
|
||||||
socket.on("skipping", function(obj)
|
|
||||||
{
|
|
||||||
document.getElementById("pBar").innerHTML = "Vote registrated! "+obj[0]+" of "+obj[1]+" has skipped. "+(Math.ceil(obj[1]/2))+" or more is needed!";
|
|
||||||
$("#pBar").addClass("opacityFull");
|
|
||||||
setTimeout(function(){
|
|
||||||
$("#pBar").removeClass("opacityFull");
|
|
||||||
},1500);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
populate_list: function(msg)
|
populate_list: function(msg)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -51,12 +40,15 @@ var List = {
|
|||||||
|
|
||||||
$.each(full_playlist, function(j, current_song){
|
$.each(full_playlist, function(j, current_song){
|
||||||
if(!current_song.now_playing){ //check that the song isnt playing
|
if(!current_song.now_playing){ //check that the song isnt playing
|
||||||
$("#wrapper").append(List.generateSong(current_song, false, true, true));
|
$("#wrapper").append(List.generateSong(current_song, false, lazy_load, true));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
if(lazy_load){
|
||||||
if(window.mobilecheck()) $(".list-image").lazyload({});
|
if(window.mobilecheck()) $(".list-image").lazyload({});
|
||||||
else $(".list-image").lazyload({container: $("#wrapper")}).removeClass("lazy");
|
else $(".list-image").lazyload({container: $("#wrapper")}).removeClass("lazy");
|
||||||
|
}
|
||||||
$("#settings").css("visibility", "visible");
|
$("#settings").css("visibility", "visible");
|
||||||
$("#settings").css("opacity", "1");
|
$("#settings").css("opacity", "1");
|
||||||
$("#wrapper").css("opacity", "1");
|
$("#wrapper").css("opacity", "1");
|
||||||
|
|||||||
@@ -24,6 +24,9 @@ var SAMPLE_RATE = 6000; // 6 seconds
|
|||||||
var lastSample = Date.now();
|
var lastSample = Date.now();
|
||||||
var began = false;
|
var began = false;
|
||||||
var i = -1;
|
var i = -1;
|
||||||
|
var lazy_load = true;
|
||||||
|
var embed = false;
|
||||||
|
var embed_code = '<div id="song-title"></div><div id="container" style="display:inline-flex;"><div id="player-container"><div id="player" style="width:300px;height:300px;"></div><div id="controls" class="noselect"><div id="playpause"><i id="play" class="mdi-av-play-arrow hide"></i><i id="pause" class="mdi-av-pause"></i></div><div id="duration">00:00 / 00:00</div><div id="fullscreen"><i class="mdi-navigation-fullscreen"></i></div><div id="volume-button"><i id="v-mute" class="mdi-av-volume-off"></i><i id="v-low" class="mdi-av-volume-mute"></i><i id="v-medium" class="mdi-av-volume-down"></i><i id="v-full" class="mdi-av-volume-up"></i></div><div id="volume"></div><div id="viewers"></div><div id="bar"></div></div></div><div id="playlist"><div id="wrapper" style="height:332px;width:300px;overflow-y:scroll;"><div id="preloader" class="progress channel_preloader"><div class="indeterminate"></div></div><div id="list-song-html"><div id="list-song" class="card left-align list-song"><span class="clickable vote-container" title="Vote!"><a class="clickable center-align votebg"><div class="lazy card-image cardbg list-image" style=""></div></a><span class="card-content"><span class="flow-text truncate list-title"></span><span class="vote-span"><span class="list-votes"></span><span class="highlighted vote-text"> votes</span></span></span></span></div></div></div></div></div><script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script><script type="text/javascript" src="//cdn.socket.io/socket.io-1.3.5.js"></script><script src="static/dist/embed.min.js"></script>';
|
||||||
|
|
||||||
var id;
|
var id;
|
||||||
var full_playlist;
|
var full_playlist;
|
||||||
@@ -81,7 +84,6 @@ function init(){
|
|||||||
Youtube.setup_youtube_listener(chan);
|
Youtube.setup_youtube_listener(chan);
|
||||||
Admin.admin_listener();
|
Admin.admin_listener();
|
||||||
List.channel_listener();
|
List.channel_listener();
|
||||||
List.skipping_listener();
|
|
||||||
|
|
||||||
$('ul.tabs').tabs();
|
$('ul.tabs').tabs();
|
||||||
$("#settings").sideNav({
|
$("#settings").sideNav({
|
||||||
@@ -153,7 +155,7 @@ function init(){
|
|||||||
Helper.sample();
|
Helper.sample();
|
||||||
}
|
}
|
||||||
|
|
||||||
$( "#results" ).hover( function() { $("div.result").removeClass("hoverResults"); i = 0; }, function() { });
|
$( "#results" ).hover( function() { $("div.result").removeClass("hoverResults"); i = 0; }, function(){ });
|
||||||
$("#search").focus();
|
$("#search").focus();
|
||||||
|
|
||||||
$('#base').bind("keyup keypress", function(e) {
|
$('#base').bind("keyup keypress", function(e) {
|
||||||
@@ -189,6 +191,8 @@ function init(){
|
|||||||
}, 1);
|
}, 1);
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
|
$("#embed-button").css("display", "inline-block");
|
||||||
|
$("#embed-area").val('<div id="zoffchannel">' + chan.toLowerCase() + '</div>' + embed_code);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -374,6 +378,10 @@ $(document).on('click', '#toast-container', function(){
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(document).on("click", "#embed-area", function(){
|
||||||
|
this.select();
|
||||||
|
});
|
||||||
|
|
||||||
$(document).on("click", ".brand-logo-navigate", function(e){
|
$(document).on("click", ".brand-logo-navigate", function(e){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
@@ -398,6 +406,7 @@ function onepage_load(){
|
|||||||
Admin.display_logged_out();
|
Admin.display_logged_out();
|
||||||
Admin.beginning = true;
|
Admin.beginning = true;
|
||||||
chan = "";
|
chan = "";
|
||||||
|
$("#embed-button").css("display", "none");
|
||||||
|
|
||||||
socket.removeAllListeners();
|
socket.removeAllListeners();
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,9 @@ var Playercontrols = {
|
|||||||
|
|
||||||
initSlider: function()
|
initSlider: function()
|
||||||
{
|
{
|
||||||
|
try{
|
||||||
vol = (Crypt.get_volume());
|
vol = (Crypt.get_volume());
|
||||||
|
}catch(e){}
|
||||||
$("#volume").slider({
|
$("#volume").slider({
|
||||||
min: 0,
|
min: 0,
|
||||||
max: 100,
|
max: 100,
|
||||||
@@ -31,7 +33,7 @@ var Playercontrols = {
|
|||||||
|
|
||||||
Playercontrols.setVolume(ui.value);
|
Playercontrols.setVolume(ui.value);
|
||||||
//localStorage.setItem("volume", ui.value);
|
//localStorage.setItem("volume", ui.value);
|
||||||
Crypt.set_volume(ui.value);
|
try{Crypt.set_volume(ui.value);}catch(e){}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Playercontrols.choose_button(vol, false);
|
Playercontrols.choose_button(vol, false);
|
||||||
|
|||||||
@@ -11,9 +11,7 @@ var Youtube = {
|
|||||||
socket.on("np", function(obj)
|
socket.on("np", function(obj)
|
||||||
{
|
{
|
||||||
Youtube.loaded = false;
|
Youtube.loaded = false;
|
||||||
try{
|
|
||||||
if(video_id != undefined && Youtube.ytplayer !== undefined) Youtube.before_load = Youtube.ytplayer.getVideoUrl();
|
|
||||||
}catch(e){}
|
|
||||||
if(obj[0].length == 0){
|
if(obj[0].length == 0){
|
||||||
|
|
||||||
document.getElementById('song-title').innerHTML = "Empty channel. Add some songs!";
|
document.getElementById('song-title').innerHTML = "Empty channel. Add some songs!";
|
||||||
@@ -40,7 +38,9 @@ var Youtube = {
|
|||||||
|
|
||||||
$("#player_overlay").addClass("hide");
|
$("#player_overlay").addClass("hide");
|
||||||
|
|
||||||
|
try{
|
||||||
Suggestions.fetchYoutubeSuggests(video_id);
|
Suggestions.fetchYoutubeSuggests(video_id);
|
||||||
|
}catch(e){}
|
||||||
Youtube.getTitle(song_title, viewers);
|
Youtube.getTitle(song_title, viewers);
|
||||||
Youtube.setBGimage(video_id);
|
Youtube.setBGimage(video_id);
|
||||||
//if(player_ready && !window.mobilecheck())
|
//if(player_ready && !window.mobilecheck())
|
||||||
@@ -182,7 +182,7 @@ var Youtube = {
|
|||||||
Playercontrols.initYoutubeControls(Youtube.ytplayer);
|
Playercontrols.initYoutubeControls(Youtube.ytplayer);
|
||||||
Playercontrols.initSlider();
|
Playercontrols.initSlider();
|
||||||
Youtube.ytplayer.setVolume(Crypt.get_volume());
|
Youtube.ytplayer.setVolume(Crypt.get_volume());
|
||||||
}catch(e){window.location.reload();};
|
}catch(e){}
|
||||||
},
|
},
|
||||||
|
|
||||||
readyLooks: function()
|
readyLooks: function()
|
||||||
@@ -191,7 +191,8 @@ var Youtube = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
setBGimage: function(id){
|
setBGimage: function(id){
|
||||||
if(id !== undefined)
|
|
||||||
|
if(id !== undefined && !embed)
|
||||||
{
|
{
|
||||||
var img = new Image();
|
var img = new Image();
|
||||||
img.onload = function ()
|
img.onload = function ()
|
||||||
@@ -252,7 +253,6 @@ var Youtube = {
|
|||||||
|
|
||||||
durationSetter: function()
|
durationSetter: function()
|
||||||
{
|
{
|
||||||
//console.log(Youtube.stopInterval);
|
|
||||||
try{
|
try{
|
||||||
duration = Youtube.ytplayer.getDuration();
|
duration = Youtube.ytplayer.getDuration();
|
||||||
}catch(e){duration = 0};
|
}catch(e){duration = 0};
|
||||||
|
|||||||
Reference in New Issue
Block a user