Skip to content

Node.js based forum software built for the modern web

feat: a couple utility methods in navigator module to get and set count and index

Julian Lam9f9a835fcbc5
diff --git a/public/src/modules/navigator.js b/public/src/modules/navigator.js
index 824f55434a..2dcbdb6aec 100644
--- a/public/src/modules/navigator.js
+++ b/public/src/modules/navigator.js
@@ -47,7 +47,6 @@ define('navigator', ['forum/pagination', 'components', 'hooks', 'alerts'], funct
thumb = $('.scroller-thumb');
thumbText = thumb.find('.thumb-text');
-
$(window).off('scroll', navigator.delayedUpdate).on('scroll', navigator.delayedUpdate);
paginationBlockEl.find('.dropdown-menu').off('click').on('click', function (e) {
@@ -331,6 +330,8 @@ define('navigator', ['forum/pagination', 'components', 'hooks', 'alerts'], funct
return parts[1] + '/' + parts[2] + '/' + parts[3] + (index ? '/' + index : '');
}
+ navigator.getCount = () => count;
+
navigator.setCount = function (value) {
value = parseInt(value, 10);
if (value === count) {
@@ -440,6 +441,13 @@ define('navigator', ['forum/pagination', 'components', 'hooks', 'alerts'], funct
toggle(!!count);
};
+ navigator.getIndex = () => index;
+
+ navigator.setIndex = (newIndex) => {
+ index = newIndex + 1;
+ navigator.updateTextAndProgressBar();
+ };
+
navigator.updateTextAndProgressBar = function () {
if (!utils.isNumber(index)) {
return;