fix: navigator not properly updating url

remove threshold not used anymore
This commit is contained in:
Barış Soner Uşaklı
2022-09-29 15:13:05 -04:00
parent 5dc74abcf1
commit 375dad8961

View File

@@ -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);
};