diff --git a/public/src/app.js b/public/src/app.js index 27a9e12aee..9f6bb7531c 100644 --- a/public/src/app.js +++ b/public/src/app.js @@ -160,6 +160,19 @@ app.cacheBuster = null; } } + function overrideTimeago() { + var timeagoFn = $.fn.timeago; + $.fn.timeago = function() { + var els = timeagoFn.apply(this, arguments); + + if (els) { + els.each(function() { + $(this).attr('title', (new Date($(this).attr('title'))).toString()); + }); + } + }; + } + app.logout = function() { require(['csrf'], function(csrf) { $.ajax(RELATIVE_PATH + '/logout', { @@ -271,8 +284,6 @@ app.cacheBuster = null; app.processPage = function () { highlightNavigationLink(); - utils.overrideTimeago(); - $('.timeago').timeago(); utils.makeNumbersHumanReadable($('.human-readable-number')); @@ -559,6 +570,7 @@ app.cacheBuster = null; }); overrideBootbox(); + overrideTimeago(); createHeaderTooltips(); app.showEmailConfirmWarning(); diff --git a/public/src/utils.js b/public/src/utils.js index 4b3b4464fc..930e03501f 100644 --- a/public/src/utils.js +++ b/public/src/utils.js @@ -203,19 +203,6 @@ return text.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,"); }, - overrideTimeago: function() { - var timeagoFn = $.fn.timeago; - $.fn.timeago = function() { - var els = timeagoFn.apply(this, arguments); - - if (els) { - els.each(function() { - $(this).attr('title', (new Date($(this).attr('title'))).toString()); - }); - } - }; - }, - toISOString: function(timestamp) { if (!timestamp || !Date.prototype.toISOString) { return '';