diff --git a/airtime_mvc/public/js/airtime/common/common.js b/airtime_mvc/public/js/airtime/common/common.js index 8b9de0804..4fe28eae7 100644 --- a/airtime_mvc/public/js/airtime/common/common.js +++ b/airtime_mvc/public/js/airtime/common/common.js @@ -289,20 +289,18 @@ function getUsabilityHint() { }); } -function getPanTextFunctions() { - return { - mousein: function () { - var sw = $(this)[0].scrollWidth-parseFloat($(this).css("textIndent")), iw = $(this).innerWidth(); - if (sw > iw) { - $(this).stop().animate({ - textIndent: "-" + (sw + 1 - iw) + "px" - }, sw * 8); - } - }, - mouseout: function () { +function setupTextScrolling(parent, selector) { + parent.on("mouseenter", selector, function () { + var sw = $(this)[0].scrollWidth - parseFloat($(this).css("textIndent")), iw = $(this).innerWidth(); + if (sw > iw) { $(this).stop().animate({ - textIndent: "0" - }, 500); + textIndent: "-" + (sw + 1 - iw) + "px" + }, sw * 8); } - } + }); + parent.on("mouseleave", selector, function () { + $(this).stop().animate({ + textIndent: "0" + }, 500); + }); } \ No newline at end of file diff --git a/airtime_mvc/public/js/airtime/library/library.js b/airtime_mvc/public/js/airtime/library/library.js index 2569c6f5e..b79ebbdd0 100644 --- a/airtime_mvc/public/js/airtime/library/library.js +++ b/airtime_mvc/public/js/airtime/library/library.js @@ -710,24 +710,6 @@ var AIRTIME = (function(AIRTIME) { } else if (!aData.is_playlist) { $(nRow).find("td.library_is_playlist").html(''); } - - // add the play function to the library_type td - $(nRow).find('td.library_type').click(function () { - if (aData.ftype === 'playlist' && aData.length !== '0.0') { - open_playlist_preview(aData.audioFile, 0); - } else if (aData.ftype === 'audioclip') { - if (isAudioSupported(aData.mime)) { - open_audio_preview(aData.ftype, aData.id); - } - } else if (aData.ftype == 'stream') { - if (isAudioSupported(aData.mime)) { - open_audio_preview(aData.ftype, aData.id); - } - } else if (aData.ftype == 'block' && aData.bl_type == 'static') { - open_block_preview(aData.audioFile, 0); - } - return false; - }); }, // remove any selected nodes before the draw. "fnPreDrawCallback": function (oSettings) { @@ -985,6 +967,26 @@ var AIRTIME = (function(AIRTIME) { } }); + // add the play function to the library_type td + $libTable.on("click", "td.library_type", function () { + var aData = $(this).parent().data().aData; + + if (aData.ftype === 'playlist' && aData.length !== '0.0') { + open_playlist_preview(aData.audioFile, 0); + } else if (aData.ftype === 'audioclip') { + if (isAudioSupported(aData.mime)) { + open_audio_preview(aData.ftype, aData.id); + } + } else if (aData.ftype == 'stream') { + if (isAudioSupported(aData.mime)) { + open_audio_preview(aData.ftype, aData.id); + } + } else if (aData.ftype == 'block' && aData.bl_type == 'static') { + open_block_preview(aData.audioFile, 0); + } + return false; + }); + $libTable.find("tbody").on("mousedown", "tr[class*='lib'] > td:not(.library_checkbox, .dataTables_empty)", function(ev) { var $tr = $(this).parent(), // Get the ID of the selected row diff --git a/airtime_mvc/public/js/airtime/library/plupload.js b/airtime_mvc/public/js/airtime/library/plupload.js index 055dda7e0..01b9fefe2 100644 --- a/airtime_mvc/public/js/airtime/library/plupload.js +++ b/airtime_mvc/public/js/airtime/library/plupload.js @@ -161,9 +161,7 @@ $(document).ready(function () { }); }; - var parent = $("#recent_uploads"),fn = getPanTextFunctions(); - parent.on("mouseenter", "td", fn.mousein); - parent.on("mouseleave", "td", fn.mouseout); + setupTextScrolling($("#recent_uploads"), "td"); self.isRecentUploadsRefreshTimerActive = false; diff --git a/airtime_mvc/public/js/airtime/showbuilder/tabs.js b/airtime_mvc/public/js/airtime/showbuilder/tabs.js index 45ef1a2f3..5b1d84691 100644 --- a/airtime_mvc/public/js/airtime/showbuilder/tabs.js +++ b/airtime_mvc/public/js/airtime/showbuilder/tabs.js @@ -201,7 +201,5 @@ var AIRTIME = (function(AIRTIME){ }(AIRTIME || {})); $(document).ready(function() { - var parent = $("#show_builder"), fn = getPanTextFunctions(); - parent.on("mouseenter", ".tab-name", fn.mousein); - parent.on("mouseleave", ".tab-name", fn.mouseout); + setupTextScrolling($("#show_builder"), ".tab-name"); }); \ No newline at end of file