summaryrefslogtreecommitdiffstats
path: root/static
diff options
context:
space:
mode:
Diffstat (limited to 'static')
-rw-r--r--static/base.css11
-rw-r--r--static/script.js21
2 files changed, 30 insertions, 2 deletions
diff --git a/static/base.css b/static/base.css
index 656d8ef..c932d6f 100644
--- a/static/base.css
+++ b/static/base.css
@@ -33,7 +33,8 @@ input:focus {
}
input[type="submit"] {
background-color: #111;
- padding: 2px 5px;
+ padding: 1px 5px;
+ line-height: 27px;
}
label {
cursor: pointer;
@@ -70,6 +71,7 @@ header label[for="song"] {
header input#song {
left: 390px;
top: 50px;
+ width: 420px;
text-align: center;
}
header input[type="submit"] {
@@ -100,6 +102,13 @@ div#results ul li {
div#results ul li:hover {
background-color: #024;
}
+div#results ul li a {
+ display: block;
+ height: 100%;
+}
+div#results ul li a:hover {
+ text-decoration: none;
+}
div#results ul li img {
height: 50px;
width: 66px;
diff --git a/static/script.js b/static/script.js
index c55aff6..4766387 100644
--- a/static/script.js
+++ b/static/script.js
@@ -124,7 +124,12 @@ function search(query) {
for (var i = 0; i < entries.length; i++) {
var title = entries[i].title.$t;
var id = entries[i].media$group.yt$videoid.$t;
- items.push('<li id="r_' + id + '"><img src="http://i.ytimg.com/vi/' + id + '/1.jpg" alt="' + id + '">' + title + '</li>');
+ var html = '<li id="r_' + id + '">';
+ html += '<a href="javascript:add(\'' + id + '\', \'' + title + '\')">';
+ html += '<img src="http://i.ytimg.com/vi/' + id + '/1.jpg" alt="' + id + '">';
+ html += title;
+ html += '</a></li>';
+ items.push(html);
}
var results = $('#results ul').html(items.join('\n'));
$('#results').slideDown(100);
@@ -132,3 +137,17 @@ function search(query) {
);
return false;
}
+
+function add(id, title) {
+ params = {
+ 'pid': pid,
+ 'yid': id,
+ 'title': title,
+ 'user': $('#user').val()
+ }
+ $.getJSON('/add/', params,
+ function(data) {
+ alert(data);
+ }
+ );
+}