summaryrefslogtreecommitdiffstats
path: root/static
diff options
context:
space:
mode:
authorraylu <raylu@mixpanel.com>2011-08-05 02:05:49 -0700
committerraylu <raylu@mixpanel.com>2011-08-05 02:05:49 -0700
commit08268860601f61e0d0d0829e673a7189b7db134e (patch)
tree8379d3b7873517ba5e698621537e76091824efc6 /static
parentc680bce12701298901ccd5cb3f0c366799f6a1c6 (diff)
downloadaudioaxis-08268860601f61e0d0d0829e673a7189b7db134e.tar.xz
add on the page
Diffstat (limited to 'static')
-rw-r--r--static/script.js27
1 files changed, 25 insertions, 2 deletions
diff --git a/static/script.js b/static/script.js
index 4766387..a958a44 100644
--- a/static/script.js
+++ b/static/script.js
@@ -139,15 +139,38 @@ function search(query) {
}
function add(id, title) {
+ var user = $('#user').val();
params = {
'pid': pid,
'yid': id,
'title': title,
- 'user': $('#user').val()
+ 'user': user
}
$.getJSON('/add/', params,
function(data) {
- alert(data);
+ if (data != 1)
+ return;
+ $('article').append('\
+ <section class="song">\
+ <div class="info">\
+ <a href="http://www.youtube.com/watch?v=' + id + '">' + title + '</a>\
+ </div>\
+ <div class="user">' + user + '</div>\
+ <div class="remove">×</div>\
+ <br class="clear">\
+ <div class="thumb">\
+ <img src="http://i.ytimg.com/vi/' + id + '/1.jpg" alt="' + id + '">\
+ </div>\
+ <canvas id="' + id + '" width="700" height="20"></canvas>\
+ <br>\
+ <img src="/static/player_play.png" alt="Play" onclick="play(\'' + id + '\')" id="play_' + id + '">\
+ <img src="/static/player_pause.png" alt="Pause" onclick="pause(\'' + id + '\')" id="pause_' + id + '">\
+ <img src="/static/player_stop.png" alt="Stop" onclick="stop(\'' + id + '\')">\
+ <br class="clear">\
+ </section>\
+ ');
+ ids.push(id);
+ drawBar(id);
}
);
}