mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-14 09:55:47 +01:00
overrideTimeago only needs to be called once
This commit is contained in:
@@ -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() {
|
app.logout = function() {
|
||||||
require(['csrf'], function(csrf) {
|
require(['csrf'], function(csrf) {
|
||||||
$.ajax(RELATIVE_PATH + '/logout', {
|
$.ajax(RELATIVE_PATH + '/logout', {
|
||||||
@@ -271,8 +284,6 @@ app.cacheBuster = null;
|
|||||||
app.processPage = function () {
|
app.processPage = function () {
|
||||||
highlightNavigationLink();
|
highlightNavigationLink();
|
||||||
|
|
||||||
utils.overrideTimeago();
|
|
||||||
|
|
||||||
$('.timeago').timeago();
|
$('.timeago').timeago();
|
||||||
|
|
||||||
utils.makeNumbersHumanReadable($('.human-readable-number'));
|
utils.makeNumbersHumanReadable($('.human-readable-number'));
|
||||||
@@ -559,6 +570,7 @@ app.cacheBuster = null;
|
|||||||
});
|
});
|
||||||
|
|
||||||
overrideBootbox();
|
overrideBootbox();
|
||||||
|
overrideTimeago();
|
||||||
createHeaderTooltips();
|
createHeaderTooltips();
|
||||||
app.showEmailConfirmWarning();
|
app.showEmailConfirmWarning();
|
||||||
|
|
||||||
|
|||||||
@@ -203,19 +203,6 @@
|
|||||||
return text.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,");
|
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) {
|
toISOString: function(timestamp) {
|
||||||
if (!timestamp || !Date.prototype.toISOString) {
|
if (!timestamp || !Date.prototype.toISOString) {
|
||||||
return '';
|
return '';
|
||||||
|
|||||||
Reference in New Issue
Block a user