mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 03:26:04 +01:00
#3322 properly, @barisusakli so no need to copy pasta everywhere timeago is used
This commit is contained in:
@@ -241,9 +241,9 @@ app.cacheBuster = null;
|
|||||||
app.processPage = function () {
|
app.processPage = function () {
|
||||||
highlightNavigationLink();
|
highlightNavigationLink();
|
||||||
|
|
||||||
$('.timeago').timeago().each(function() {
|
utils.overrideTimeago();
|
||||||
$(this).attr('title', (new Date($(this).attr('title'))).toString());
|
|
||||||
});
|
$('.timeago').timeago();
|
||||||
|
|
||||||
utils.makeNumbersHumanReadable($('.human-readable-number'));
|
utils.makeNumbersHumanReadable($('.human-readable-number'));
|
||||||
|
|
||||||
|
|||||||
@@ -255,9 +255,7 @@ define('forum/topic/posts', [
|
|||||||
app.replaceSelfLinks(posts.find('a'));
|
app.replaceSelfLinks(posts.find('a'));
|
||||||
utils.addCommasToNumbers(posts.find('.formatted-number'));
|
utils.addCommasToNumbers(posts.find('.formatted-number'));
|
||||||
utils.makeNumbersHumanReadable(posts.find('.human-readable-number'));
|
utils.makeNumbersHumanReadable(posts.find('.human-readable-number'));
|
||||||
posts.find('.timeago').timeago().each(function() {
|
posts.find('.timeago').timeago();
|
||||||
$(this).attr('title', (new Date($(this).attr('title'))).toString());
|
|
||||||
});
|
|
||||||
posts.find('[component="post/content"] img:not(.emoji)').each(function() {
|
posts.find('[component="post/content"] img:not(.emoji)').each(function() {
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
if (!$this.parent().is('a')) {
|
if (!$this.parent().is('a')) {
|
||||||
|
|||||||
@@ -203,6 +203,15 @@
|
|||||||
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() {
|
||||||
|
timeagoFn.apply(this, arguments).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