Node.js based forum software built for the modern web
https://github.com/NodeBB/NodeBB/issues/11818
Barış Soner Uşaklıf7ae8963cef1
diff --git a/public/src/admin/dashboard.js b/public/src/admin/dashboard.jsindex afead1ff13..ef80204127 100644--- a/public/src/admin/dashboard.js+++ b/public/src/admin/dashboard.js@@ -436,12 +436,9 @@ define('admin/dashboard', [} else {graphs.traffic.data.xLabels = utils.getHoursArray();- $('#pageViewsThirty').html(data.summary.thirty);- $('#pageViewsSeven').html(data.summary.seven);- $('#pageViewsPastDay').html(data.pastDay);- utils.addCommasToNumbers($('#pageViewsThirty'));- utils.addCommasToNumbers($('#pageViewsSeven'));- utils.addCommasToNumbers($('#pageViewsPastDay'));+ $('#pageViewsThirty').html(helpers.formattedNumber(data.summary.thirty));+ $('#pageViewsSeven').html(helpers.formattedNumber(data.summary.seven));+ $('#pageViewsPastDay').html(helpers.formattedNumber(data.pastDay));}graphs.traffic.data.datasets[0].data = data.pageviews;diff --git a/public/src/admin/manage/tags.js b/public/src/admin/manage/tags.jsindex ea6ab15c59..aba143ddf7 100644--- a/public/src/admin/manage/tags.js+++ b/public/src/admin/manage/tags.js@@ -59,7 +59,6 @@ define('admin/manage/tags', [tags: tags,}, function (html) {$('.tag-list').html(html);- utils.makeNumbersHumanReadable(html.find('.human-readable-number'));selectable.enable('.tag-management', '.tag-row');});}diff --git a/public/src/app.js b/public/src/app.jsindex c457ae89f6..599792838f 100644--- a/public/src/app.js+++ b/public/src/app.js@@ -253,8 +253,6 @@ if (document.readyState === 'loading') {highlightNavigationLink();overrides.overrideTimeagoCutoff();$('.timeago').timeago();- utils.makeNumbersHumanReadable($('.human-readable-number'));- utils.addCommasToNumbers($('.formatted-number'));app.createUserTooltips($('#content'));app.createStatusTooltips();};diff --git a/public/src/client/account/posts.js b/public/src/client/account/posts.jsindex fbd7f555c7..deea51d851 100644--- a/public/src/client/account/posts.js+++ b/public/src/client/account/posts.js@@ -45,7 +45,6 @@ define('forum/account/posts', ['forum/account/header', 'forum/infinitescroll', '$('[component="posts"]').append(html);html.find('img:not(.not-responsive)').addClass('img-fluid');html.find('.timeago').timeago();- utils.makeNumbersHumanReadable(html.find('.human-readable-number'));hooks.fire('action:posts.loaded', { posts: posts });callback();});diff --git a/public/src/client/account/topics.js b/public/src/client/account/topics.jsindex 565bb9b170..7a95d01ceb 100644--- a/public/src/client/account/topics.js+++ b/public/src/client/account/topics.js@@ -46,7 +46,6 @@ define('forum/account/topics', [app.parseAndTranslate(template, 'topics', { topics: topics }, function (html) {$('[component="category"]').append(html);html.find('.timeago').timeago();- utils.makeNumbersHumanReadable(html.find('.human-readable-number'));hooks.fire('action:topics.loaded', { topics: topics });callback();});diff --git a/public/src/client/category.js b/public/src/client/category.jsindex 86f76381ab..a69ef64616 100644--- a/public/src/client/category.js+++ b/public/src/client/category.js@@ -104,7 +104,6 @@ define('forum/category', [app.parseAndTranslate('category', 'children', { children: data }, function (html) {html.find('.timeago').timeago();$('[component="category/subcategory/container"]').append(html);- utils.makeNumbersHumanReadable(html.find('.human-readable-number'));ajaxify.data.nextSubCategoryStart += ajaxify.data.subCategoriesPerPage;ajaxify.data.subCategoriesLeft -= data.length;btn.toggleClass('hidden', ajaxify.data.subCategoriesLeft <= 0)diff --git a/public/src/client/tags.js b/public/src/client/tags.jsindex ca8036ee76..c754e7bbb9 100644--- a/public/src/client/tags.js+++ b/public/src/client/tags.js@@ -54,7 +54,6 @@ define('forum/tags', ['forum/infinitescroll', 'alerts'], function (infinitescrolcallback = callback || function () {};app.parseAndTranslate('tags', 'tags', { tags: tags }, function (html) {$('.tag-list')[replace ? 'html' : 'append'](html);- utils.makeNumbersHumanReadable(html.find('.human-readable-number'));callback();});}diff --git a/public/src/client/topic/postTools.js b/public/src/client/topic/postTools.jsindex 72de7164b3..5cf95d9374 100644--- a/public/src/client/topic/postTools.js+++ b/public/src/client/topic/postTools.js@@ -11,7 +11,8 @@ define('forum/topic/postTools', ['bootbox','alerts','hooks',-], function (share, navigator, components, translator, votes, api, bootbox, alerts, hooks) {+ 'helpers',+], function (share, navigator, components, translator, votes, api, bootbox, alerts, hooks, helpers) {const PostTools = {};let staleReplyAnyway = false;@@ -85,8 +86,8 @@ define('forum/topic/postTools', [PostTools.updatePostCount = function (postCount) {const postCountEl = components.get('topic/post-count');- postCountEl.html(postCount).attr('title', postCount);- utils.makeNumbersHumanReadable(postCountEl);+ postCountEl.attr('title', postCount)+ .html(helpers.humanReadableNumber(postCount));navigator.setCount(postCount);};diff --git a/public/src/client/topic/posts.js b/public/src/client/topic/posts.jsindex e0c09cb96e..d9ce0c613b 100644--- a/public/src/client/topic/posts.js+++ b/public/src/client/topic/posts.js@@ -10,7 +10,8 @@ define('forum/topic/posts', ['components','translator','hooks',-], function (pagination, infinitescroll, postTools, images, navigator, components, translator, hooks) {+ 'helpers',+], function (pagination, infinitescroll, postTools, images, navigator, components, translator, hooks, helpers) {const Posts = { };Posts.signaturesShown = {};@@ -76,8 +77,7 @@ define('forum/topic/posts', [function updatePostCounts(posts) {for (let i = 0; i < posts.length; i += 1) {const cmp = components.get('user/postcount', posts[i].uid);- cmp.html(parseInt(cmp.attr('data-postcount'), 10) + 1);- utils.addCommasToNumbers(cmp);+ cmp.html(helpers.formattedNumber(parseInt(cmp.attr('data-postcount'), 10) + 1));}}@@ -410,8 +410,6 @@ define('forum/topic/posts', [Posts.onNewPostsAddedToDom = async function (posts) {await Posts.onTopicPageLoad(posts);- utils.addCommasToNumbers(posts.find('.formatted-number'));- utils.makeNumbersHumanReadable(posts.find('.human-readable-number'));posts.find('.timeago').timeago();};diff --git a/public/src/modules/topicList.js b/public/src/modules/topicList.jsindex 5d1ea52a62..f771eca47c 100644--- a/public/src/modules/topicList.js+++ b/public/src/modules/topicList.js@@ -242,7 +242,6 @@ define('topicList', [}html.find('.timeago').timeago();- utils.makeNumbersHumanReadable(html.find('.human-readable-number'));hooks.fire('action:topics.loaded', { topics: topics, template: templateName });callback();});