layout has more widget-like setup now. side playlist reused in search.
This commit is contained in:
parent
565d789baa
commit
5795871bcc
12 changed files with 196 additions and 141 deletions
|
@ -1,19 +1,3 @@
|
|||
function contextMenu(action, el, pos) {
|
||||
var method = action.split('/').pop(),
|
||||
url;
|
||||
|
||||
if (method === 'delete') {
|
||||
url = action + '/format/json';
|
||||
url = url + '/id/' + $(el).attr('id');
|
||||
$.post(url, deleteItem);
|
||||
}
|
||||
else if (method === 'add-item') {
|
||||
url = action + '/format/json';
|
||||
url = url + '/id/' + $(el).attr('id');
|
||||
$.post(url, setSPLContent);
|
||||
}
|
||||
}
|
||||
|
||||
function deleteItem(json){
|
||||
var id;
|
||||
|
||||
|
@ -35,75 +19,6 @@ function setLibraryContents(data){
|
|||
);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------------
|
||||
//Side Playlist Functions
|
||||
//--------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function setSPLContent(json) {
|
||||
|
||||
if(json.message) {
|
||||
alert(json.message);
|
||||
return;
|
||||
}
|
||||
|
||||
$('#spl_name').empty()
|
||||
.append(json.name);
|
||||
$('#spl_length').empty()
|
||||
.append(json.length);
|
||||
$('#spl_sortable').empty()
|
||||
.append(json.html);
|
||||
}
|
||||
|
||||
function addSPLItem(event, ui){
|
||||
|
||||
var url, tr, id;
|
||||
|
||||
tr = ui.helper;
|
||||
|
||||
if(tr.get(0).tagName === 'LI')
|
||||
return;
|
||||
|
||||
id = tr.attr('id');
|
||||
|
||||
url = '/Playlist/add-item/format/json';
|
||||
url = url + '/id/'+id;
|
||||
|
||||
$.post(url, setSPLContent);
|
||||
}
|
||||
|
||||
function deleteSPLItem(){
|
||||
|
||||
var url, pos;
|
||||
|
||||
url = '/Playlist/delete-item/format/json/view/spl';
|
||||
|
||||
pos = $('form[name="SPL"]').find(':checked').not('input[name="all"]').map(function() {
|
||||
return "/pos/" + $(this).attr('name');
|
||||
}).get().join("");
|
||||
|
||||
url = url + pos;
|
||||
|
||||
$.post(url, setSPLContent);
|
||||
}
|
||||
|
||||
function moveSPLItem(event, ui) {
|
||||
var li, newPos, oldPos, url;
|
||||
|
||||
li = ui.item;
|
||||
|
||||
newPos = li.index();
|
||||
oldPos = li.attr('id').split("_").pop();
|
||||
|
||||
url = '/Playlist/move-item'
|
||||
url = url + '/format/json';
|
||||
url = url + '/view/spl';
|
||||
url = url + '/oldPos/' + oldPos;
|
||||
url = url + '/newPos/' + newPos;
|
||||
|
||||
$.post(url, setSPLContent);
|
||||
}
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$("#library_display tr:first-child span.title").data({'ob': 'dc:title', 'order' : 'asc'});
|
||||
|
@ -139,15 +54,6 @@ $(document).ready(function() {
|
|||
helper: 'clone'
|
||||
});
|
||||
|
||||
$("#spl_sortable").sortable();
|
||||
$("#spl_sortable" ).bind( "sortstop", moveSPLItem);
|
||||
$("#spl_remove_selected").click(deleteSPLItem);
|
||||
|
||||
$("#side_playlist").droppable();
|
||||
$("#side_playlist" ).bind( "drop", addSPLItem);
|
||||
|
||||
$('input[name="all"]').click(function(){
|
||||
$('form[name="SPL"]').find('input').attr("checked", $(this).attr("checked"));
|
||||
});
|
||||
setUpSPL();
|
||||
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue