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() {
return {
mousein: function () {
var sw = $(this)[0].scrollWidth-parseFloat($(this).css("textIndent")), iw = $(this).innerWidth();
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: "-" + (sw + 1 - iw) + "px"
}, sw * 8);
}
},
mouseout: function () {
});
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) {
$(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

View file

@ -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;

View file

@ -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");
});