mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-20 22:43:01 +01:00
fix: navigator not properly updating url
remove threshold not used anymore
This commit is contained in:
@@ -373,12 +373,7 @@ define('navigator', ['forum/pagination', 'components', 'hooks', 'alerts'], funct
|
||||
}
|
||||
};
|
||||
|
||||
navigator.update = function (threshold) {
|
||||
/*
|
||||
The "threshold" is defined as the distance from the top of the page to
|
||||
a spot where a user is expecting to begin reading.
|
||||
*/
|
||||
threshold = typeof threshold === 'number' ? threshold : undefined;
|
||||
navigator.update = function () {
|
||||
let newIndex = index;
|
||||
const els = $(navigator.selector);
|
||||
if (els.length) {
|
||||
@@ -415,21 +410,8 @@ define('navigator', ['forum/pagination', 'components', 'hooks', 'alerts'], funct
|
||||
newIndex = count;
|
||||
}
|
||||
|
||||
// If a threshold is undefined, try to determine one based on new index
|
||||
if (threshold === undefined && ajaxify.data.template.topic) {
|
||||
if (atTop) {
|
||||
threshold = 0;
|
||||
} else {
|
||||
const anchorEl = components.get('post/anchor', index - 1);
|
||||
if (anchorEl.length) {
|
||||
const anchorRect = anchorEl.get(0).getBoundingClientRect();
|
||||
threshold = anchorRect.top;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof navigator.callback === 'function') {
|
||||
navigator.callback(newIndex, count, threshold);
|
||||
navigator.callback(newIndex, count);
|
||||
}
|
||||
|
||||
if (newIndex !== index) {
|
||||
@@ -445,6 +427,9 @@ define('navigator', ['forum/pagination', 'components', 'hooks', 'alerts'], funct
|
||||
|
||||
navigator.setIndex = (newIndex) => {
|
||||
index = newIndex + 1;
|
||||
if (typeof navigator.callback === 'function') {
|
||||
navigator.callback(index, count);
|
||||
}
|
||||
navigator.updateTextAndProgressBar();
|
||||
setThumbToIndex(index);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user