summaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
Diffstat (limited to 'static')
-rw-r--r--static/init.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/static/init.js b/static/init.js
index 6102e29..6a37be5 100644
--- a/static/init.js
+++ b/static/init.js
@@ -90,4 +90,17 @@ $(document).ready(function() {
preload_images();
load_directory(0);
$('#progress').slider();
+ $('#playlist tbody').sortable({
+ items: 'tr:not(.playing)',
+ cancel: '.playing',
+ update: function() {
+ $('#playlist tbody tr').each(function(i, tr) {
+ var cid = $(tr).attr('id').match(/^cid-(c\d+)$/)[1];
+ var model = items.getByCid(cid);
+ model.attributes.order_id = i+1;
+ model.save();
+ });
+ items.sort({silent: true});
+ }
+ });
});