mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46: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');
|
thumb = $('.scroller-thumb');
|
||||||
thumbText = thumb.find('.thumb-text');
|
thumbText = thumb.find('.thumb-text');
|
||||||
|
|
||||||
|
|
||||||
$(window).off('scroll', navigator.delayedUpdate).on('scroll', navigator.delayedUpdate);
|
$(window).off('scroll', navigator.delayedUpdate).on('scroll', navigator.delayedUpdate);
|
||||||
|
|
||||||
paginationBlockEl.find('.dropdown-menu').off('click').on('click', function (e) {
|
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 : '');
|
return parts[1] + '/' + parts[2] + '/' + parts[3] + (index ? '/' + index : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
navigator.getCount = () => count;
|
||||||
|
|
||||||
navigator.setCount = function (value) {
|
navigator.setCount = function (value) {
|
||||||
value = parseInt(value, 10);
|
value = parseInt(value, 10);
|
||||||
if (value === count) {
|
if (value === count) {
|
||||||
@@ -440,6 +441,13 @@ define('navigator', ['forum/pagination', 'components', 'hooks', 'alerts'], funct
|
|||||||
toggle(!!count);
|
toggle(!!count);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
navigator.getIndex = () => index;
|
||||||
|
|
||||||
|
navigator.setIndex = (newIndex) => {
|
||||||
|
index = newIndex + 1;
|
||||||
|
navigator.updateTextAndProgressBar();
|
||||||
|
};
|
||||||
|
|
||||||
navigator.updateTextAndProgressBar = function () {
|
navigator.updateTextAndProgressBar = function () {
|
||||||
if (!utils.isNumber(index)) {
|
if (!utils.isNumber(index)) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user