var AIRTIME = (function(AIRTIME){ var mod; if (AIRTIME.library === undefined) { AIRTIME.library = {}; } AIRTIME.library.events = {}; mod = AIRTIME.library.events; mod.enableAddButtonCheck = function() { var selected = $('#library_display tr input[type=checkbox]').filter(":checked"), cursor = $('tr.cursor-selected-row'), check = false; //make sure library items are selected and a cursor is selected. if (selected.length !== 0 && cursor.length !== 0) { check = true; } if (check === true) { AIRTIME.button.enableButton("library_group_add"); } else { AIRTIME.button.disableButton("library_group_add"); } }; mod.fnRowCallback = function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) { var $nRow = $(nRow); $nRow.attr("id", aData["tr_id"]) .data("aData", aData) .data("screen", "timeline"); }; mod.fnDrawCallback = function() { $('#library_display tr:not(:first)').draggable({ helper: function(){ var selected = $('#library_display tr:not(:first) input:checked').parents('tr'), container, thead = $("#show_builder_table thead"), colspan = thead.find("th").length, width = thead.find("tr:first").width(), message; //if nothing is checked select the dragged item. if (selected.length === 0) { selected = $(this); } if (selected.length === 1) { message = "Moving "+selected.length+" Item."; } else { message = "Moving "+selected.length+" Items."; } container = $('
').attr('id', 'draggingContainer') .append('