diff --git a/airtime_mvc/public/js/airtime/library/events/library_playlistbuilder.js b/airtime_mvc/public/js/airtime/library/events/library_playlistbuilder.js index 249af5d55..4f93a02b0 100644 --- a/airtime_mvc/public/js/airtime/library/events/library_playlistbuilder.js +++ b/airtime_mvc/public/js/airtime/library/events/library_playlistbuilder.js @@ -88,6 +88,18 @@ var AIRTIME = (function(AIRTIME){ }); }; + mod.dblClickAdd = function(id, type) { + var i, + aMediaIds = []; + + //process selected files/playlists. + if (type === "audioclip") { + aMediaIds.push(id); + } + + AIRTIME.playlist.fnAddItems(aMediaIds, undefined, 'after'); + }; + mod.setupLibraryToolbar = function() { var $toolbar = $(".lib-content .fg-toolbar:first"); diff --git a/airtime_mvc/public/js/airtime/library/events/library_showbuilder.js b/airtime_mvc/public/js/airtime/library/events/library_showbuilder.js index 7d841c56d..15ec22f66 100644 --- a/airtime_mvc/public/js/airtime/library/events/library_showbuilder.js +++ b/airtime_mvc/public/js/airtime/library/events/library_showbuilder.js @@ -87,6 +87,35 @@ var AIRTIME = (function(AIRTIME){ }); }; + mod.dblClickAdd = function(id, type) { + + var i, + length, + temp, + aMediaIds = [], + aSchedIds = [], + aData = []; + + //process selected files/playlists. + aMediaIds.push({"id": id, "type": type}); + + $("#show_builder_table tr.cursor-selected-row").each(function(i, el){ + aData.push($(el).prev().data("aData")); + }); + + //process selected schedule rows to add media after. + for (i=0, length = aData.length; i < length; i++) { + temp = aData[i]; + aSchedIds.push({"id": temp.id, "instance": temp.instance, "timestamp": temp.timestamp}); + } + + if(aSchedIds.length == 0){ + alert("Please select a cursor position on timeline."); + return false; + } + AIRTIME.showbuilder.fnAdd(aMediaIds, aSchedIds); + }; + mod.setupLibraryToolbar = function() { var $toolbar = $(".lib-content .fg-toolbar:first"); diff --git a/airtime_mvc/public/js/airtime/library/library.js b/airtime_mvc/public/js/airtime/library/library.js index 2f6910978..3f623484b 100644 --- a/airtime_mvc/public/js/airtime/library/library.js +++ b/airtime_mvc/public/js/airtime/library/library.js @@ -428,11 +428,32 @@ var AIRTIME = (function(AIRTIME) { return false; }); + alreadyclicked=false; //call the context menu so we can prevent the event from propagating. $(nRow).find('td:not(.library_checkbox, .library_type)').click(function(e){ - - $(this).contextMenu({x: e.pageX, y: e.pageY}); - + var el=$(this); + if (alreadyclicked) + { + alreadyclicked=false; // reset + clearTimeout(alreadyclickedTimeout); // prevent this from happening + // do what needs to happen on double click. + + $tr = $(el).parent(); + data = $tr.data("aData"); + AIRTIME.library.dblClickAdd(data.id, data.ftype); + //AIRTIME.playlist.fnAddItems([data.id], undefined, 'after'); + } + else + { + alreadyclicked=true; + alreadyclickedTimeout=setTimeout(function(){ + alreadyclicked=false; // reset when it happens + // do what needs to happen on single click. + // use el instead of $(this) because $(this) is + // no longer the element + el.contextMenu({x: e.pageX, y: e.pageY}); + },300); // <-- dblclick tolerance here + } return false; });