instead of including the entire jquery ui lib for a single function, just load the single function

This commit is contained in:
Daku 2016-05-13 17:13:31 +01:00
parent ba6ab8fb16
commit 428d1285e0
2 changed files with 27 additions and 9 deletions

File diff suppressed because one or more lines are too long

View file

@ -1,8 +1,32 @@
/*jshint bitwise:false, curly:true, eqeqeq:true, evil:true, forin:false, noarg:true, noempty:true, nonew:true, undef:false, strict:false, browser:true */
$(document).ready(function() {
/** Load jQuery extensions **/
//Code via: http://stackoverflow.com/a/13106698
$.fn.highlight = function (fadeOut) {
fadeOut = typeof fadeOut !== 'undefined' ? fadeOut : 5000;
$(this).each(function () {
var el = $(this);
$("<div/>")
.width(el.outerWidth())
.height(el.outerHeight())
.css({
"position": "absolute",
"left": el.offset().left,
"top": el.offset().top,
"background-color": "#ffff99",
"opacity": ".7",
"z-index": "9999999",
"border-top-left-radius": parseInt(el.css("borderTopLeftRadius"), 10),
"border-top-right-radius": parseInt(el.css("borderTopRightRadius"), 10),
"border-bottom-left-radius": parseInt(el.css("borderBottomLeftRadius"), 10),
"border-bottom-right-radius": parseInt(el.css("borderBottomRightRadius"), 10)
}).appendTo('body').fadeOut(fadeOut).queue(function () { $(this).remove(); });
});
};
/** Setup jQuery.timeago **/
jQuery.timeago.settings.cutoff = 365 * 24 * 60 * 60 * 1000; // Display original dates older than 1 year
$.timeago.settings.cutoff = 365 * 24 * 60 * 60 * 1000; // Display original dates older than 1 year
$("time").timeago();
/** Setup tablesorter **/
@ -17,7 +41,7 @@ $(document).ready(function() {
// highlight it when clicked
$(elm).click(function(e) {
// This needs jQuery UI
$(target_id).effect('highlight', {}, 5000);
$(target_id).highlight();
});
// vanilla target name should already be in the URL tag, but this
// will include the anon ID as displayed on screen
@ -124,5 +148,5 @@ function replyTo(imageId, commentId, userId) {
box.focus();
box.val(box.val() + text);
$("#c"+commentId).effect("highlight", {}, 5000);
$("#c"+commentId).highlight();
}