Fixed a lot of indentations

This commit is contained in:
Kasper Rynning-Tønnesen
2017-05-06 13:21:39 +02:00
parent 60a7610a28
commit f1d4b80636
17 changed files with 4025 additions and 4257 deletions

View File

@@ -1 +1 @@
!function(){function e(e){var t,a=e.substring(1).split("&"),n={};for(var i in a)t=a[i].split("="),2==t.length&&(n[t[0]]=t[1]);return n}window.addEventListener("load",function(){var t,a,n,i=e(window.location.hash),o=window.location.protocol+"//"+window.location.hostname+"/o_callback";if(i.spotify)t="b934ecdd173648f5bcd38738af529d58",a="token",n="playlist-read-private playlist-read-collaborative user-read-private playlist-modify-public",state=i.nonce,window.location.href="https://accounts.spotify.com/authorize?client_id="+t+"&scope="+n+"&show_dialog=false&response_type="+a+"&redirect_uri="+o+"&state="+state;else if(i.youtube)t="944988770273-butsmlr1aotlsskk8lmgvh0etqqekigf.apps.googleusercontent.com",a="token",n="https://www.googleapis.com/auth/youtube",state=i.nonce,window.location.href="https://accounts.google.com/o/oauth2/v2/auth?client_id="+t+"&response_type="+a+"&state="+state+"&redirect_uri="+o+"&scope="+n;else{var s=e(window.location.hash);window.opener.callback(s)}})}();
!function(){function e(e){var t,a=e.substring(1).split("&"),n={};for(var s in a)t=a[s].split("="),2==t.length&&(n[t[0]]=t[1]);return n}window.addEventListener("load",function(){var t,a,n,s=e(window.location.hash),i=window.location.protocol+"//"+window.location.hostname+"/o_callback";if(s.spotify)t="b934ecdd173648f5bcd38738af529d58",a="token",n="playlist-read-private playlist-read-collaborative user-read-private playlist-modify-public",state=s.nonce,window.location.href="https://accounts.spotify.com/authorize?client_id="+t+"&scope="+n+"&show_dialog=false&response_type="+a+"&redirect_uri="+i+"&state="+state;else if(s.youtube)t="944988770273-butsmlr1aotlsskk8lmgvh0etqqekigf.apps.googleusercontent.com",a="token",n="https://www.googleapis.com/auth/youtube",state=s.nonce,window.location.href="https://accounts.google.com/o/oauth2/v2/auth?client_id="+t+"&response_type="+a+"&state="+state+"&redirect_uri="+i+"&scope="+n;else{var o=e(window.location.hash);window.opener.callback(o)}})}();

View File

@@ -124,14 +124,10 @@ var Admin = {
if($(".password_protected").prop("checked")) {
$(".change_user_pass").removeClass("hide");
}
//if(!Helper.mobilecheck()){
if(!Helper.contains($(".playlist-tabs").attr("class").split(" "), "hide")) {
$(".playlist-tabs-loggedIn").removeClass("hide");
$(".playlist-tabs").addClass("hide");
}
//$("#top-button").toggleClass("top-button-with-tabs");
//$("#wrapper").toggleClass("tabs_height");
//}
if($("#admin-lock").html() != "lock_open"){
$("#admin-lock").addClass("clickable");
@@ -230,16 +226,13 @@ var Admin = {
{
$('ul.playlist-tabs').tabs('select_tab', 'wrapper');
$('ul.playlist-tabs-loggedIn').tabs('select_tab', 'wrapper');
//$("#wrapper").removeClass("tabs_height");
} else {
$('ul.playlist-tabs').tabs('select_tab', $(".playlist-tabs-loggedIn li a.active").attr("href").substring(1));
}
$("#admin-lock").removeClass("clickable");
$("#password").attr("placeholder", "Enter admin password");
//$("#top-button").removeClass("top-button-with-tabs");
},
//function used in html onlick
save: function(userpass){
Admin.submitAdmin(document.getElementById("adminForm").elements, userpass);
},
@@ -294,10 +287,6 @@ var Admin = {
$("#description_area").html(conf_array.description);
}
/*if(conf_array.desc !== undefined)
{
document.getElementById("description").innerHTML = conf_array.desc;
}*/
},
submitAdmin: function(form, userpass_changed)

View File

@@ -64,12 +64,13 @@ var Chat = {
}
} else if(data.value.startsWith("/removename")){
Chat.removename();
}
else if($(".chat-tab-li a.active").attr("href") == "#all_chat")
} else if($(".chat-tab-li a.active").attr("href") == "#all_chat"){
socket.emit("all,chat", data.value);
else
} else {
socket.emit("chat", {channel: chan.toLowerCase(), data: data.value, pass: embed ? '' : Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()))});
}
data.value = "";
return;
},

View File

@@ -6,19 +6,6 @@ var frontpage = true;
var socket;
var rotation_timeout;
/*
function getCookie(cname) {
var name = cname + "=";
var ca = document.cookie.split(';');
for(var i=0; i<ca.length; i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1);
if (c.indexOf(name) == 0) return c.substring(name.length,c.length);
}
return "";
}
*/
var Frontpage = {
blob_list: [],
@@ -29,8 +16,7 @@ var Frontpage = {
all_channels: [],
frontpage_function: function(msg)
{
frontpage_function: function(msg) {
frontpage = true;
Helper.log("-----------");
@@ -63,9 +49,7 @@ var Frontpage = {
}, {
name: 'count',
reverse: true
}
)
);
}));
} else {
lists = lists.sort(Helper.predicate({
name: 'viewers',
@@ -73,9 +57,7 @@ var Frontpage = {
}, {
name: 'count',
reverse: true
}
)
);
}));
}
if(pinned !== undefined){
@@ -410,10 +392,6 @@ function initfp(){
//Materialize.toast('<p id="aprilfools">We suck at pranks..<a class="waves-effect waves-light btn light-green" style="pointer-events:none;">Agreed</a></p>', 100000);
}
/*if(window.location.hostname != "zoff.me"){
console.log("not zoff.me, redirecting"); //redirect
window.location.href = "https://zoff.me";
}*/
window.onpopstate = function(e){
var url_split = window.location.href.split("/");

View File

@@ -7,8 +7,7 @@ var Hostcontroller = {
host_listener: function(id) {
if(Hostcontroller.old_id === null) Hostcontroller.old_id = id;
else
{
else {
socket.removeAllListeners(id);
began = false;
Hostcontroller.old_id = id;
@@ -17,8 +16,7 @@ var Hostcontroller = {
$("#code-text").text(id);
$("#code-qr").attr("src", "https://chart.googleapis.com/chart?chs=221x221&cht=qr&choe=UTF-8&chld=L|1&chl="+codeURL);
$("#code-link").attr("href", codeURL);
if(!began)
{
if(!began) {
began = true;
setup_host_listener(id);
}
@@ -44,16 +42,12 @@ var Hostcontroller = {
if(private_channel) add = Crypt.getCookie("_uI") + "_";
socket.emit("list", {channel: add + chan.toLowerCase(), pass: embed ? '' : Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()))});
/*if(Crypt.get_pass(chan.toLowerCase()) !== undefined && Crypt.get_pass(chan.toLowerCase()) != ""){
socket.emit("password", {password: Crypt.crypt_pass(Crypt.get_pass(chan.toLowerCase())), channel: chan.toLowerCase()});
}*/
window.history.pushState("object or string", "Title", "/"+chan.toLowerCase());
}else if(arr.type == "pause")
} else if(arr.type == "pause") {
Player.pauseVideo();
else if(arr.type == "play")
} else if(arr.type == "play") {
Player.playVideo();
else if(arr.type == "skip")
} else if(arr.type == "skip") {
List.skip();
}
},

View File

@@ -137,12 +137,7 @@ var List = {
$(".first_page").css("display", "none");
$(".next_page_hide").css("display","none");
$(".last_page_hide").css("display","none");
/*if($(".next_page").hasClass("hide")){
$(".next_page").removeClass("hide");
}
if($(".last_page").hasClass("hide")){
$(".last_page").removeClass("hide");
}*/
} else if(!$("#pageButtons").length){
$('<div id="pageButtons"><span class="first_page_hide btn-flat"><i class="material-icons">first_page</i></span><a class="first_page waves-effect waves-light btn-flat"><i class="material-icons">first_page</i></a><span class="prev_page_hide btn-flat"><i class="material-icons">navigate_before</i> prev</span><a class="prev_page waves-effect waves-light btn-flat"><i class="material-icons">navigate_before</i> prev</a> <span id="pageNumber">1</span> <a class="next_page waves-effect waves-light btn-flat">next <i class="material-icons">navigate_next</i></a><span class="next_page_hide btn-flat">next <i class="material-icons">navigate_next</i></span><a class="last_page waves-effect waves-light btn-flat"><i class="material-icons">last_page</i></a><span class="last_page_hide btn-flat"><i class="material-icons">last_page</i></span></div>').insertAfter("#wrapper");
$(".prev_page").css("display", "none");
@@ -155,15 +150,7 @@ var List = {
List.dynamicContentPage(-10);
/*if(lazy_load){
if(Helper.mobilecheck()) $(".list-image").lazyload({});
else{
$(".list-image").lazyload({container: $("#wrapper")}).removeClass("lazy");
document.getElementById('wrapper').scrollTop += 1;
document.getElementById('wrapper').scrollTop += -1;
}
}*/
} else{
List.empty = true;
$("#wrapper").html("<span id='empty-channel-message'>The playlist is empty.</span>");
@@ -370,17 +357,7 @@ var List = {
{
if(!removed) $("#"+deleted).remove();
full_playlist.splice(List.getIndexOfSong(deleted), 1);
/*if(index < List.page && $("#wrapper").children().length - (List.page + 1) >= 0){
$($("#wrapper").children()[List.page - 1]).css("display", "block");
} else if($("#wrapper").children().length > List.page + (List.can_fit-1)){
$($("#wrapper").children()[List.page + (List.can_fit - 1)]).css("display", "block");
}
if(List.page >= $("#wrapper").children().length){
List.dynamicContentPage(-1);
} else if(List.page + List.can_fit >= $("#wrapper").children().length){
$(".next_page_hide").css("display", "flex");
$(".next_page").css("display", "none");
}*/
if(chromecastAvailable){
Player.sendNext({title: full_playlist[0].title, videoId: full_playlist[0].id});
}
@@ -452,13 +429,9 @@ var List = {
Helper.log(full_playlist[0]);
Helper.log("---------------------------");
full_playlist.push(full_playlist.shift());
//if(!List.empty)
if(!remove){
List.insertAtIndex(full_playlist[length-1], false, true);
}
/*if($("#wrapper").children().length >= List.page + List.can_fit){
$($("#wrapper").children()[List.page + List.can_fit - 1]).css("display", "block");
}*/
}catch(e){}
},

View File

@@ -133,7 +133,8 @@ $().ready(function(){
setup_no_connection_listener();
try{
git_info = $.ajax({ type: "GET",
git_info = $.ajax({
type: "GET",
url: "https://api.github.com/users/zoff-music/received_events",
async: false
}).responseText;
@@ -173,12 +174,12 @@ function init(){
$('ul.playlist-tabs-loggedIn').tabs();
$('ul.chatTabs').tabs();
$("#settings").sideNav({
menuWidth: 310, // Default is 240
edge: side, // Choose the horizontal origin
closeOnClick: false // Closes side-nav on <a> clicks, useful for Angular/Meteor
menuWidth: 310,
edge: side,
closeOnClick: false
});
$('.collapsible').collapsible({
accordion : true // A setting that changes the collapsible behavior to expandable instead of the default accordion style
accordion : true
});
$("#help").modal();
$("#contact").modal();
@@ -260,11 +261,7 @@ function init(){
tooltip: "Viewers"
});
//if(/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream){
/*if(!Helper.mobilecheck() && !window.MSStream){
document.getElementById("search").blur();
$("#channel-load").css("display", "none");
} else {*/
window.onYouTubeIframeAPIReady = Player.onYouTubeIframeAPIReady;
if(Player.player === "" || Player.player === undefined || Helper.mobilecheck()) Player.loadPlayer();
//}
@@ -330,20 +327,17 @@ function init(){
if(!Helper.mobilecheck() && navigator.userAgent.match(/iPad/i) == null){
setTimeout(function(){set_title_width();}, 100);
}
}
initializeCastApi = function() {
cast.framework.CastContext.getInstance().setOptions({
receiverApplicationId: "E6856E24",
autoJoinPolicy: chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED});
autoJoinPolicy: chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED
});
var context = cast.framework.CastContext.getInstance();
chromecastReady = true
//$(".castButton-unactive").css("display", "block");
context.addEventListener(
cast.framework.CastContextEventType.SESSION_STATE_CHANGED,
function(event) {
context.addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED, function(event) {
Helper.log("session state");
Helper.log(event.sessionState);
switch (event.sessionState) {
@@ -386,7 +380,6 @@ initializeCastApi = function() {
case cast.framework.SessionState.SESSION_ENDED:
chromecastAvailable = false;
hide_native(0);
// Update locally as necessary
break;
}
});
@@ -431,14 +424,12 @@ function hide_native(way){
}
} else {
$("#volume").slider("value", 100);
//$("#player_overlay").width($("#player").width() + 1);
}
$("#player_overlay").css("background", "url(https://i.ytimg.com/vi/" + video_id + "/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<br>" + castSession.La.friendlyName);
Player.player.setVolume(100);
@@ -625,18 +616,10 @@ function change_offline(enabled, already_offline){
if(enabled){
if(list_html){
list_html = $("<div>" + list_html + "</div>");
//list_html.find(".card-content").css("display", "flex");
//list_html.find(".card-content").css("height", "100%");
//list_html.find(".list-title").css("align-self", "center");
//list_html.find(".vote-span").addClass("hide");
list_html.find(".list-remove").removeClass("hide");
list_html = list_html.html();
}
//$(".card-content").css("display", "flex");
//$(".card-content").css("height", "100%");
//$(".list-title").css("align-self", "center");
$(".list-remove").removeClass("hide");
//$(".vote-span").addClass("hide");
$("#viewers").addClass("hide");
$("#offline-mode").removeClass("waves-cyan");
$("#offline-mode").addClass("cyan");
@@ -691,19 +674,11 @@ function change_offline(enabled, already_offline){
} else {
if(list_html){
list_html = $("<div>" + list_html + "</div>");
//list_html.find(".card-content").css("display", "block");
//list_html.find(".card-content").css("height", "initial");
//list_html.find(".list-title").css("align-self", "center");
//list_html.find(".vote-span").removeClass("hide");
if(hasadmin && w_p){
list_html.find(".list-remove").addClass("hide");
}
list_html = list_html.html();
}
//$(".card-content").css("display", "block");
//$(".card-content").css("height", "initial");
//$(".list-title").css("align-self", "center");
//$(".vote-span").removeClass("hide");
$("#viewers").removeClass("hide");
if(hasadmin && w_p){
$(".list-remove").addClass("hide");
@@ -756,7 +731,6 @@ window.enable_debug = enable_debug;
window.disable_debug = disable_debug;
function seekToMove(e){
//if(!Helper.mobilecheck()) {
var pos_x = e.clientX - Math.ceil($("#seekToDuration").width() / 2) - 8;
if(pos_x < 0) pos_x = 0;
else if(pos_x + $("#seekToDuration").width() > $("#controls").width()) {
@@ -764,7 +738,6 @@ function seekToMove(e){
}
$("#seekToDuration").css("left", pos_x);
try{
//var total = Player.player.getDuration() / $("#controls").width();
var total = full_playlist[full_playlist.length - 1].duration / $("#controls").width();
total = total * e.clientX;
var _time = Helper.secondsToOther(total);
@@ -777,7 +750,6 @@ function seekToMove(e){
$("#bar").width(((100 / Player.player.getDuration()) * total) + "%");
}
} catch(e){}
//}
}
function seekToClick(e){
@@ -821,7 +793,6 @@ $(document).keyup(function(event) {
if($("#search-btn i").html() == "close")
{
//$("#search-btn i").html("mdi-navigation-close");
$("#search-btn i").html("search");
}
if($(".search-container").length != 0 && !Helper.contains($(".search-container").attr("class").split(" "), "hide")){
@@ -838,7 +809,6 @@ $(document).keyup(function(event) {
if($("#search-btn i").html() == "close")
{
//$("#search-btn i").html("mdi-navigation-close");
$("#search-btn i").html("search");
}
if($(".search-container").length != 0 && !Helper.contains($(".search-container").attr("class").split(" "), "hide")){
@@ -920,8 +890,6 @@ $(document).on("click", ".castButton-unactive", function(e){
$(document).on("click", ".castButton-active", function(e){
e.preventDefault();
var castSession = cast.framework.CastContext.getInstance().getCurrentSession();
// End the session and pass 'true' to indicate
// that receiver application should be stopped.
castSession.endSession(true);
});
@@ -986,7 +954,6 @@ $(document).on("click", ".modal-close", function(e){
$(document).on("change", ".password_protected", function(e) {
e.preventDefault();
if(this.checked) {
//alert("kwek");
$("#user_password").modal('open');
$("#user-pass-input").focus();
} else {
@@ -999,8 +966,6 @@ $(document).on("change", ".password_protected", function(e) {
$(document).on("submit", "#user-password-channel-form", function(e) {
e.preventDefault();
if(user_auth_started) {
//user_auth_started = false;
//$("#user_password").modal('close');
temp_user_pass = CryptoJS.SHA256($("#user-pass-input").val()).toString();
$("#user-pass-input").val("");
socket.emit("list", {channel: chan.toLowerCase(), pass: Crypt.crypt_pass(temp_user_pass)});
@@ -1023,8 +988,6 @@ $(document).on("click", ".change_user_pass_btn", function(e) {
$(document).on("click", ".submit-user-password", function(e) {
e.preventDefault();
if(user_auth_started) {
//user_auth_started = false;
//$("#user_password").modal('close');
temp_user_pass = CryptoJS.SHA256($("#user-pass-input").val()).toString();
$("#user-pass-input").val("");
socket.emit("list", {channel: chan.toLowerCase(), pass: Crypt.crypt_pass(temp_user_pass)});
@@ -1132,20 +1095,6 @@ $(document).on("submit", ".channel-finder", function(e){
Frontpage.to_channel($(".room-namer").val());
return false;
});
/*
$(document).off("keyup", "keyup.autocomplete", function(e){
if(e.keyCode == 13){
e.preventDefault();
}
});
$(document).off("keydown", "keydown.autocomplete", function(e){
if(e.keyCode == 13){
e.preventDefault();
}
});*/
$(document).on("submit", ".channel-finder-mobile", function(e){
e.preventDefault();
@@ -1161,7 +1110,6 @@ $(document).on("change", 'input[class=remote_switch_class]', function()
$(document).on("change", 'input[class=offline_switch_class]', function()
{
//Hostcontroller.change_enabled(document.getElementsByName("remote_switch")[0].checked);
offline = document.getElementsByName("offline_switch")[0].checked;
change_offline(offline, !offline);
});
@@ -1248,7 +1196,6 @@ $(document).on("submit", "#listImport", function(e){
$(document).on("submit", "#listImportSpotify", function(e){
e.preventDefault();
if(spotify_authenticated && $("#import_spotify").val() !== ""){
//Helper.log("Import this playlist: " + document.getElementById("import_spotify").value);
var url = $("#import_spotify").val().split("https://open.spotify.com/user/");
if(url.length == 2) {
url = url[1].split("/");
@@ -1302,8 +1249,6 @@ $(document).on("submit", "#remoteform", function(e) {
$(document).on("click", ".chat-link", function(){
$("#text-chat-input").focus();
$("#chat-btn i").css("opacity", 1);
//clearInterval(blink_interval);
//blink_interval_exists = false;
Chat.channel_received = 0;
Chat.all_received = 0;
if(!$(".chat-link span.badge.new.white").hasClass("hide")){
@@ -1328,21 +1273,13 @@ function searchTimeout(event) {
timeout_search = setTimeout(function(){
Search.search(search_input);
}, 1000);
/*i = 0;
timer=100;*/
}
}
}
/*if(/iPad|iPhone|iPod/.test(navigator.userAgent)){
$(document).on('touchend', '.search_input', function(event) {
searchTimeout(event);
});
} else {*/
$(document).on('keyup', ".search_input", function(event) {
searchTimeout(event);
});
//}
$(document).on("click", ".chat-tab", function(){
$("#text-chat-input").focus();
@@ -1575,34 +1512,6 @@ $(document).on("click", "#player_bottom_overlay", function(){
Frontpage.to_channel(chan.toLowerCase(), false);
});
/*$(document).on("mousemove", "#playlist", function(e)
{
var y = e.pageY - this.offsetTop;
if(((y <= 80 && y >= 48)) && $("#wrapper").scrollTop() > 0){
$("#top-button").removeClass("hide");
Helper.addClass("#bottom-button", "hide");
}else if(y >= $("#playlist").height() - 59 && y <= $("#playlist").height() - 32 && $("#wrapper").scrollTop() < $("#wrapper")[0].scrollHeight - $("#wrapper").height() - 1){
$("#bottom-button").removeClass("hide");
Helper.addClass("#top-button", "hide");
}else{
Helper.addClass("#bottom-button", "hide");
Helper.addClass("#top-button", "hide");
}
});
$(document).on("mouseleave", "#playlist", function(){
Helper.addClass("#bottom-button", "hide");
Helper.addClass("#top-button", "hide");
});
$(document).on("click", "#top-button", function(){
List.scrollTop();
});
$(document).on("click", "#bottom-button", function(){
List.scrollBottom();
});*/
$(document).keydown(function(event) {
if(window.location.pathname != "/"){
@@ -1640,9 +1549,6 @@ $(document).on("submit", "#find_form", function(e){
if(found_array.length == 0){
var that = this;
found_array_index = 0;
/*var result = $.grep(full_playlist, function(v,i) {
return v.title.toLowerCase().indexOf(that.find_value.value.toLowerCase()) >= 0;
});*/
found_array = $.map(full_playlist, function(obj, index) {
if(obj.title.toLowerCase().indexOf(that.find_value.value.toLowerCase()) >= 0) {
return index;
@@ -1664,13 +1570,11 @@ $(document).on("submit", "#find_form", function(e){
}
});
function share_link_modifier_channel(){
$("#facebook-code-link").attr("href", "https://www.facebook.com/sharer/sharer.php?u=https://zoff.me/" + chan.toLowerCase());
$("#facebook-code-link").attr("onclick", "window.open('https://www.facebook.com/sharer/sharer.php?u=https://zoff.me/" + chan.toLowerCase() + "', 'Share Playlist','width=600,height=300'); return false;");
$("#twitter-code-link").attr("href", "https://twitter.com/intent/tweet?url=https://zoff.me/" + chan.toLowerCase() + "&amp;text=Check%20out%20this%20playlist%20" + chan.toLowerCase() + "%20on%20Zoff!&amp;via=zoffmusic");
$("#twitter-code-link").attr("onclick", "window.open('https://twitter.com/intent/tweet?url=https://zoff.me/" + chan.toLowerCase() + "/&amp;text=Check%20out%20this%20playlist%20" + chan.toLowerCase() + "%20on%20Zoff!&amp;via=zoffmusic','Share Playlist','width=600,height=300'); return false;");
//$("#qr-code-link").attr("href", "//chart.googleapis.com/chart?chs=500x500&cht=qr&chl=https://zoff.me/" + chan.toLowerCase() + "&choe=UTF-8&chld=L%7C1");
$("#qr-code-image-link").attr("src", "//chart.googleapis.com/chart?chs=150x150&cht=qr&chl=https://zoff.me/" + chan.toLowerCase() + "&choe=UTF-8&chld=L%7C1");
}
@@ -1762,9 +1666,7 @@ function onepage_load(){
} else {
try{
Player.player.destroy();
} catch(error){
//No player to destroy
}
} catch(error){}
Player.player = "";
document.title = "Zoff";
}

View File

@@ -144,7 +144,6 @@ var Player = {
}
break;
case 1:
playing = true;
if(beginning && Helper.mobilecheck() && !chromecastAvailable){
Player.pauseVideo();
@@ -165,24 +164,17 @@ var Player = {
if(document.getElementById("pause").className.split(" ").length == 2)
$("#pause").toggleClass("hide");
}
if(paused && !offline)
{
if(paused && !offline) {
socket.emit('pos', {channel: chan.toLowerCase(), pass: embed ? '' : Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()))});
paused = false;
}
break;
case 2:
/*if(Helper.mobilecheck() || embed)
{*/
if(!chromecastAvailable){
paused = true;
if(window.location.pathname != "/") Playercontrols.play_pause_show();
mobile_beginning = true;
}
/*}
else
Player.player.playVideo();*/
//
break;
case 3:
break;
@@ -305,30 +297,12 @@ var Player = {
},
errorHandler: function(newState)
{
errorHandler: function(newState) {
if(!user_auth_started) {
if(newState.data == 5 || newState.data == 100 ||
newState.data == 101 || newState.data == 150)
{
/*if(Player.count == 2){
Player.count = 0;*/
/*Helper.log("Before: " + Player.before_load);
Helper.log("Now: " + video_id);
Helper.log("After: " + Player.after_load);
Helper.log(Player.before_load == Player.player.getVideoUrl);*/
if(newState.data == 5 || newState.data == 100 || newState.data == 101 || newState.data == 150) {
curr_playing = Player.player.getVideoUrl().replace("https://www.youtube.com/watch?v=", "");
socket.emit("skip", {error: newState.data, id: video_id, pass: adminpass, channel: chan.toLowerCase, userpass: embed ? '' : Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()))});
//Helper.log(video_id, Player.player.getVideoUrl(), Player.player.getPlayerState());
/*}else{
setTimeout(function(){
Player.loadVideoById(video_id);
Player.count ++;
}, Math.floor((Math.random() * 100) + 1));
}*/
}else if(video_id !== undefined) {
Player.loadVideoById(video_id);
}
@@ -339,8 +313,7 @@ var Player = {
try{
beginning = true;
player_ready = true;
if(!window.MSStream)
{
if(!window.MSStream) {
if(Helper.mobilecheck()){
$("#playpause").css("visibility", "hidden");
$("#playpause").css("pointer-events", "none");
@@ -477,9 +450,6 @@ var Player = {
durationSetter: function()
{
/*try{
//duration = Player.player.getDuration();
}catch(e){};*/
try{
if(!user_auth_avoid && duration !== undefined){

View File

@@ -4,7 +4,6 @@ var Playercontrols = {
initYoutubeControls: function()
{
//if(Helper.mobilecheck() && !/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream){
if(Helper.mobilecheck() && !window.MSStream){
$("#controls").appendTo("#playbar");
}

View File

@@ -31,7 +31,8 @@ $(document).ready(function (){
}
try{
git_info = $.ajax({ type: "GET",
git_info = $.ajax({
type: "GET",
url: "https://api.github.com/users/zoff-music/received_events",
async: false
}).responseText;
@@ -64,12 +65,6 @@ $(document).on("click", "#skipbutton", function()
$(document).on("submit", "#remoteform", function(e)
{
e.preventDefault();
/*
if(start)
window.location.href = '/remote/'+document.getElementById("remoteform").chan.value;
else
Remotecontroller.control();
*/
Remotecontroller.control();
});
@@ -101,10 +96,6 @@ var Remotecontroller = {
value: 100,
range: "min",
animate: true,
/*slide: function(event, ui) {
Helper.log(ui.value);
//localStorage.setItem("volume", ui.value);
},*/
stop:function(event, ui) {
socket.emit("id", {id: id, type: "volume", value: ui.value});
}
@@ -116,5 +107,4 @@ var Remotecontroller = {
}
}
};

View File

@@ -10,14 +10,12 @@ var Search = {
$(".search_input").focus();
}
$("#song-title").toggleClass("hide");
//$("#results").toggleClass("hide");
$("#results").empty();
if($("#search-btn i").html() == "close"){
$("#search-btn i").html("search");
} else {
$("#search-btn i").html("close");
}
//$("#search-btn i").html("search");
$("#search").focus();
},
@@ -31,7 +29,6 @@ var Search = {
if(search_input !== ""){
searching = true;
var keyword= encodeURIComponent(search_input);
//response= x
var yt_url = "https://www.googleapis.com/youtube/v3/search?key="+api_key+"&videoEmbeddable=true&part=id&fields=items(id)&type=video&order=viewCount&safeSearch=none&maxResults=25";
yt_url+="&q="+keyword;
if(music)yt_url+="&videoCategoryId=10";
@@ -49,17 +46,14 @@ var Search = {
url: yt_url,
dataType:"jsonp",
success: function(response){
if(response.items.length === 0)
{
if(response.items.length === 0) {
$("<div style='display:none;' id='mock-div'>"+empty_results_html+"</div>").appendTo($("#results")).show("blind", 83.33);
if(Helper.contains($(".search_loader_spinner").attr("class").split(" "), "active"))
$(".search_loader_spinner").removeClass("active");
} else if(response.items){
//get list of IDs and make new request for video info
$.each(response.items, function(i,data)
{
$.each(response.items, function(i,data) {
vid_url += data.id.videoId+",";
});
@@ -122,7 +116,6 @@ var Search = {
}
}
});
} else {
$(".main").removeClass("blurT");
$("#controls").removeClass("blurT");
@@ -191,21 +184,8 @@ var Search = {
return false;
});
if(
(!not_matched //&&
//(duration + 1 > length && duration - 1 < length)
)
){
if((!not_matched)){
matched = true;
/*Helper.log("------------------------------");
Helper.log("MATCH FOR:");
Helper.log("YouTube title: " + data.snippet.title);
Helper.log("YouTube Channel: " + data.snippet.channelTitle);
Helper.log("YouTube duration: " + duration);
Helper.log("Spotify title: " + title + " " + artist.join(" "));
Helper.log("Spotify length: " + length);
Helper.log("------------------------------");*/
//Search.submit(data.id,data.snippet.title, duration, true, current, totalNumber);
Search.readySubmit(true, { id: data.id, title: data.snippet.title, duration: duration, totalLength: totalNumber - 1});
return false;
}
@@ -417,5 +397,4 @@ var Search = {
seconds= parseInt(matches[16])||0;
return hours*60*60+minutes*60+seconds;
}
};

View File

@@ -25,11 +25,6 @@ var Suggestions = {
var duration = Helper.secondsToOther(params.duration);
var video_id = params.id;
var video_title = params.title;
/*var minutes = Math.floor(secs / 60);
var seconds = secs - minutes * 60;
duration = Helper.pad(minutes) + ":" + Helper.pad(seconds);*/
var song = List.generateSong({id: video_id, title: video_title, length: params.duration, duration: duration}, false, false, false, true);
$("#user-suggest-html").append(song);
},
@@ -65,7 +60,6 @@ var Suggestions = {
var video_id = song.id;
var video_title = song.snippet.title;
//duration = duration.replace("PT","").replace("H","h ").replace("M","m ").replace("S","s");
$("#suggest-song-html").append(List.generateSong({id: video_id, title: video_title, length: length, duration: duration}, false, false, false));
});
}
@@ -83,5 +77,4 @@ var Suggestions = {
$("#user_suggests").removeClass("hide");
}
},
};