mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-10 07:55:46 +01:00
Fixing viewport shuffling due to image load
Introduced new method ".loadImages()" in posts client side lib to handle viewport height changes when loading images. Requires nodebb-plugin-markdown@5.0.0 @BenLubar @boomzillawtf
This commit is contained in:
@@ -61,12 +61,12 @@ define('forum/topic', [
|
||||
|
||||
addParentHandler();
|
||||
|
||||
handleBookmark(tid);
|
||||
|
||||
handleKeys();
|
||||
|
||||
navigator.init('[component="post/anchor"]', ajaxify.data.postcount, Topic.toTop, Topic.toBottom, Topic.navigatorCallback, Topic.calculateIndex);
|
||||
|
||||
handleBookmark(tid);
|
||||
|
||||
$(window).on('scroll', updateTopicTitle);
|
||||
|
||||
handleTopicSearch();
|
||||
@@ -141,6 +141,7 @@ define('forum/topic', [
|
||||
return navigator.scrollToPostIndex(postIndex, true);
|
||||
}
|
||||
} else if (bookmark && (!config.usePagination || (config.usePagination && ajaxify.data.pagination.currentPage === 1)) && ajaxify.data.postcount > 5) {
|
||||
navigator.update();
|
||||
app.alert({
|
||||
alert_id: 'bookmark',
|
||||
message: '[[topic:bookmark_instructions]]',
|
||||
@@ -156,6 +157,8 @@ define('forum/topic', [
|
||||
setTimeout(function() {
|
||||
app.removeAlert('bookmark');
|
||||
}, 10000);
|
||||
} else {
|
||||
navigator.update();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,7 +236,7 @@ define('forum/topic', [
|
||||
return index;
|
||||
};
|
||||
|
||||
Topic.navigatorCallback = function(index, elementCount) {
|
||||
Topic.navigatorCallback = function(index, elementCount, threshold) {
|
||||
var path = ajaxify.removeRelativePath(window.location.pathname.slice(1));
|
||||
if (!path.startsWith('topic')) {
|
||||
return 1;
|
||||
@@ -248,13 +251,13 @@ define('forum/topic', [
|
||||
newUrl += '/' + index;
|
||||
}
|
||||
|
||||
posts.loadImages(threshold);
|
||||
|
||||
if (newUrl !== currentUrl) {
|
||||
if (Topic.replaceURLTimeout) {
|
||||
clearTimeout(Topic.replaceURLTimeout);
|
||||
}
|
||||
|
||||
Topic.replaceURLTimeout = setTimeout(function() {
|
||||
|
||||
updateUserBookmark(index);
|
||||
|
||||
Topic.replaceURLTimeout = 0;
|
||||
|
||||
Reference in New Issue
Block a user