mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
feat: a couple utility methods in navigator module to get and set count and index
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user