mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-07-07 20:02:26 +02:00
@@ -104,7 +104,9 @@ define('forum/category', [
|
||||
var bookmarkIndex = localStorage.getItem('category:' + cid + ':bookmark');
|
||||
var clickedIndex = localStorage.getItem('category:' + cid + ':bookmark:clicked');
|
||||
|
||||
if (!bookmarkIndex) {
|
||||
bookmarkIndex = Math.max(0, parseInt(bookmarkIndex, 10) || 0);
|
||||
clickedIndex = Math.max(0, parseInt(clickedIndex, 10) || 0);
|
||||
if (!parseInt(bookmarkIndex, 10)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -123,13 +125,9 @@ define('forum/category', [
|
||||
return;
|
||||
}
|
||||
|
||||
if (bookmarkIndex < 0) {
|
||||
bookmarkIndex = 0;
|
||||
}
|
||||
|
||||
$('[component="category"]').empty();
|
||||
|
||||
loadTopicsAfter(bookmarkIndex - 1, 1, function() {
|
||||
loadTopicsAfter(Math.max(0, bookmarkIndex - 1), 1, function() {
|
||||
Category.scrollToTopic(bookmarkIndex, clickedIndex, 0);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -95,11 +95,14 @@ define('navigator', ['forum/pagination', 'components'], function(pagination, com
|
||||
navigator.update = function() {
|
||||
toggle(!!count);
|
||||
|
||||
var middleOfViewport = $(window).scrollTop() + $(window).height() / 2;
|
||||
var els = $(navigator.selector);
|
||||
if (els.length) {
|
||||
index = parseInt(els.first().attr('data-index'), 10) + 1;
|
||||
}
|
||||
|
||||
index = parseInt($(navigator.selector).first().attr('data-index'), 10) + 1;
|
||||
var middleOfViewport = $(window).scrollTop() + $(window).height() / 2;
|
||||
var previousDistance = Number.MAX_VALUE;
|
||||
$(navigator.selector).each(function() {
|
||||
els.each(function() {
|
||||
var distanceToMiddle = Math.abs(middleOfViewport - $(this).offset().top);
|
||||
|
||||
if (distanceToMiddle > previousDistance) {
|
||||
|
||||
Reference in New Issue
Block a user