Add many songs, search category, stuff

This commit is contained in:
Nicolas A. Tonne
2015-04-27 15:24:15 +02:00
parent 9447c2ff15
commit dba10e2aae
8 changed files with 62 additions and 18 deletions

View File

@@ -6,6 +6,9 @@ socket.on("toast", function(msg)
{
pass_corr = "correct";
switch(msg) {
case "addedsong":
msg=rnd(["I added your song", "Your song has been added", "Yay, more songs!", "Thats a cool song!", "I added that song for you", "I see you like adding songs..."])
break;
case "savedsettings":
msg=rnd(["I've saved your settings", "I stored all your settings", "Your settings have been stored in a safe place"])
break;
@@ -79,6 +82,7 @@ function log_out(){
}
$("#admin-lock").addClass("mdi-action-lock");
$("#admin-lock").removeClass("mdi-action-lock-open clickable");
document.getElementById("password").value = "";
Materialize.toast("Logged out", 4000);
}else{
Materialize.toast("Not logged in", 4000);

4
static/js/lib/jquery-2.1.3.min.js vendored Normal file

File diff suppressed because one or more lines are too long

12
static/js/lib/jquery-ui-1.10.3.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -70,8 +70,9 @@ $(document).ready(function()
{
$.each(response.data.items, function(i,data)
{
submit(data.video.id, data.video.title, true, data.video.duration);
submit(data.video.id, data.video.title, data.video.duration);
});
document.getElementById("search").value = "";
}
});
}
@@ -136,7 +137,7 @@ function search(search_input){
//response= x
var yt_url = "https://www.googleapis.com/youtube/v3/search?key=***REMOVED***&videoEmbeddable=true&part=id&fields=items(id)&type=video&order=viewCount&safeSearch=none&maxResults=25";
yt_url+="&q="+keyword;
if(music)yt_url+="&videoCategoryId=25";
if(music)yt_url+="&videoCategoryId=10";
var vid_url = "https://www.googleapis.com/youtube/v3/videos?part=contentDetails,snippet,id&key=***REMOVED***&id=";
@@ -174,10 +175,17 @@ function search(search_input){
song.find(".search-title").text(title);
song.find(".result_info").text(duration);
song.find(".thumb").attr("src", thumb);
song.find(".add-many").attr("onclick", "submit('"+id+"','"+enc_title+"',"+secs+");");
song.attr("onclick", "submitAndClose('"+id+"','"+enc_title+"',"+secs+");");
song.attr("id",id);
}
});
$(".add-many").click(function(e) {
e.preventDefault();
e.stopPropagation();
return false;
});
}
});
}
@@ -193,23 +201,19 @@ function search(search_input){
}
function submitAndClose(id,title,duration){
submit(id,title, true, duration);
submit(id,title, duration);
$("#results").html('');
showSearch();
console.log("sub&closed");
document.getElementById("search").value = "";
$("#results").html = "";
$(".main").removeClass("blurT");
$("#controls").removeClass("blurT");
$(".main").removeClass("clickthrough");
}
function submit(id,title,type, duration){
function submit(id,title,duration){
socket.emit("add", [id, decodeURIComponent(title), adminpass, duration]);
if(type){
document.getElementById("search").value = "";
$("#results").html = "";
$(".main").removeClass("blurT");
$("#controls").removeClass("blurT");
$(".main").removeClass("clickthrough");
}
}
function durationToSeconds(duration) {