js tweaks

This commit is contained in:
Duncan Sommerville 2015-09-16 11:26:11 -04:00
parent 8dcea06077
commit 7006b55818
4 changed files with 34 additions and 38 deletions

View file

@ -289,20 +289,18 @@ function getUsabilityHint() {
}); });
} }
function getPanTextFunctions() { function setupTextScrolling(parent, selector) {
return { parent.on("mouseenter", selector, function () {
mousein: function () { var sw = $(this)[0].scrollWidth - parseFloat($(this).css("textIndent")), iw = $(this).innerWidth();
var sw = $(this)[0].scrollWidth-parseFloat($(this).css("textIndent")), iw = $(this).innerWidth(); if (sw > iw) {
if (sw > iw) {
$(this).stop().animate({
textIndent: "-" + (sw + 1 - iw) + "px"
}, sw * 8);
}
},
mouseout: function () {
$(this).stop().animate({ $(this).stop().animate({
textIndent: "0" textIndent: "-" + (sw + 1 - iw) + "px"
}, 500); }, sw * 8);
} }
} });
parent.on("mouseleave", selector, function () {
$(this).stop().animate({
textIndent: "0"
}, 500);
});
} }

View file

@ -710,24 +710,6 @@ var AIRTIME = (function(AIRTIME) {
} else if (!aData.is_playlist) { } else if (!aData.is_playlist) {
$(nRow).find("td.library_is_playlist").html(''); $(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. // remove any selected nodes before the draw.
"fnPreDrawCallback": function (oSettings) { "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) { $libTable.find("tbody").on("mousedown", "tr[class*='lib'] > td:not(.library_checkbox, .dataTables_empty)", function(ev) {
var $tr = $(this).parent(), var $tr = $(this).parent(),
// Get the ID of the selected row // Get the ID of the selected row

View file

@ -161,9 +161,7 @@ $(document).ready(function () {
}); });
}; };
var parent = $("#recent_uploads"),fn = getPanTextFunctions(); setupTextScrolling($("#recent_uploads"), "td");
parent.on("mouseenter", "td", fn.mousein);
parent.on("mouseleave", "td", fn.mouseout);
self.isRecentUploadsRefreshTimerActive = false; self.isRecentUploadsRefreshTimerActive = false;

View file

@ -201,7 +201,5 @@ var AIRTIME = (function(AIRTIME){
}(AIRTIME || {})); }(AIRTIME || {}));
$(document).ready(function() { $(document).ready(function() {
var parent = $("#show_builder"), fn = getPanTextFunctions(); setupTextScrolling($("#show_builder"), ".tab-name");
parent.on("mouseenter", ".tab-name", fn.mousein);
parent.on("mouseleave", ".tab-name", fn.mouseout);
}); });