mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Add many songs, search category, stuff
This commit is contained in:
11
index.php
11
index.php
@@ -68,10 +68,13 @@
|
||||
<div id="temp-results">
|
||||
<div id="result" class="result">
|
||||
<img class="thumb">
|
||||
<div id="title">
|
||||
<span class="search-title"></span>
|
||||
<div class="result_info"></div>
|
||||
</div>
|
||||
<span id="title">
|
||||
<div class="search-title"></div>
|
||||
<span class="result_info"></span>
|
||||
</span>
|
||||
<a href="#add" class="waves-effect waves-orange btn-flat add-many" title="Add several videos">
|
||||
<i class="mdi-av-playlist-add"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -49,8 +49,11 @@
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>
|
||||
<!--<script type="text/javascript" src="static/js/lib/jquery-2.1.3.min.js"></script>
|
||||
<script type="text/javascript" src="static/js/lib/jquery-ui-1.10.3.min.js"></script>-->
|
||||
<script src="//cdn.socket.io/socket.io-1.2.0.js"></script>
|
||||
<script>
|
||||
var socket = io.connect('http://'+window.location.hostname+':3000');
|
||||
|
||||
@@ -214,6 +214,7 @@ io.on('connection', function(socket){
|
||||
np = false;
|
||||
db.collection(coll).insert({"added":get_time(),"guids":guids,"id":id,"now_playing":np,"title":title,"votes":votes, "duration":duration}, function(err, docs){
|
||||
sort_list(coll, undefined, np, true);
|
||||
socket.emit("toast", "addedsong");
|
||||
});
|
||||
});
|
||||
}else{
|
||||
|
||||
@@ -350,6 +350,14 @@ hide mdi-action-visibility mdi-action-visibility-off
|
||||
margin: 15px 20px;
|
||||
}
|
||||
.result{height:100px;margin-left:40px;}
|
||||
.add-many{
|
||||
float:right;
|
||||
color:white;
|
||||
}
|
||||
.add-many:hover{
|
||||
color:orange;
|
||||
}
|
||||
.add-many i{ line-height: 36px !important;}
|
||||
#results{
|
||||
background-color: rgba(0,0,0,0.6);
|
||||
margin-top: -27px;
|
||||
@@ -359,6 +367,9 @@ hide mdi-action-visibility mdi-action-visibility-off
|
||||
.result:hover {
|
||||
background-color: rgba(0,0,0,0.4);
|
||||
}
|
||||
.search-title{
|
||||
height: 36px;
|
||||
}
|
||||
|
||||
.list-remove{
|
||||
margin-top: 5px;
|
||||
@@ -377,7 +388,9 @@ hide mdi-action-visibility mdi-action-visibility-off
|
||||
cursor: pointer;
|
||||
width:93%;
|
||||
}
|
||||
.result_info{margin-top:-36px;}
|
||||
.result_info{
|
||||
opacity:0.8;
|
||||
}
|
||||
|
||||
|
||||
/** settings **/
|
||||
|
||||
@@ -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
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
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
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user