mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-12 08:55:47 +01:00
closes #1096
This commit is contained in:
@@ -17,8 +17,6 @@ define(function() {
|
|||||||
return pagination.loadPage(pagination.currentPage - 1);
|
return pagination.loadPage(pagination.currentPage - 1);
|
||||||
}).on('click', '.next', function() {
|
}).on('click', '.next', function() {
|
||||||
return pagination.loadPage(pagination.currentPage + 1);
|
return pagination.loadPage(pagination.currentPage + 1);
|
||||||
}).on('click', '.page', function() {
|
|
||||||
return pagination.loadPage($(this).attr('data-page'));
|
|
||||||
}).on('click', '.select_page', function(e) {
|
}).on('click', '.select_page', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
bootbox.prompt('Enter page number:', function(pageNum) {
|
bootbox.prompt('Enter page number:', function(pageNum) {
|
||||||
@@ -77,7 +75,11 @@ define(function() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ajaxify.go(window.location.pathname.slice(1) + '?page=' + page);
|
ajaxify.go(window.location.pathname.slice(1) + '?page=' + page, function() {
|
||||||
|
if (typeof callback === 'function') {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -309,7 +309,7 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {
|
|||||||
var bookmark = localStorage.getItem('topic:' + tid + ':bookmark');
|
var bookmark = localStorage.getItem('topic:' + tid + ':bookmark');
|
||||||
if (window.location.hash) {
|
if (window.location.hash) {
|
||||||
Topic.scrollToPost(window.location.hash.substr(1), true);
|
Topic.scrollToPost(window.location.hash.substr(1), true);
|
||||||
} else if (bookmark) {
|
} else if (bookmark && (!config.usePagination || (config.usePagination && pagination.currentPage === 1))) {
|
||||||
app.alert({
|
app.alert({
|
||||||
alert_id: 'bookmark',
|
alert_id: 'bookmark',
|
||||||
message: '[[topic:bookmark_instructions]]',
|
message: '[[topic:bookmark_instructions]]',
|
||||||
@@ -324,7 +324,9 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
updateHeader();
|
if (!window.location.hash && !config.usePagination) {
|
||||||
|
updateHeader();
|
||||||
|
}
|
||||||
|
|
||||||
$('#post-container').on('mouseenter', '.favourite-tooltip', function(e) {
|
$('#post-container').on('mouseenter', '.favourite-tooltip', function(e) {
|
||||||
if (!$(this).data('users-loaded')) {
|
if (!$(this).data('users-loaded')) {
|
||||||
@@ -1037,26 +1039,29 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {
|
|||||||
if(index > Topic.postCount) {
|
if(index > Topic.postCount) {
|
||||||
index = Topic.postCount;
|
index = Topic.postCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#pagination').html(index + ' out of ' + Topic.postCount);
|
$('#pagination').html(index + ' out of ' + Topic.postCount);
|
||||||
$('.progress-bar').width((index / Topic.postCount * 100) + '%');
|
$('.progress-bar').width((index / Topic.postCount * 100) + '%');
|
||||||
|
|
||||||
if(!parseInt(el.attr('data-index'), 10)) {
|
var currentBookmark = localStorage.getItem('topic:' + templates.get('topic_id') + ':bookmark');
|
||||||
localStorage.removeItem('topic:' + templates.get('topic_id') + ':bookmark');
|
if (!currentBookmark || parseInt(el.attr('data-pid'), 10) > parseInt(currentBookmark, 10)) {
|
||||||
} else {
|
|
||||||
localStorage.setItem('topic:' + templates.get('topic_id') + ':bookmark', el.attr('data-pid'));
|
localStorage.setItem('topic:' + templates.get('topic_id') + ':bookmark', el.attr('data-pid'));
|
||||||
|
}
|
||||||
|
|
||||||
if (!scrollingToPost) {
|
if (!scrollingToPost) {
|
||||||
var newUrl = window.location.protocol + '//' + window.location.host + window.location.pathname + '#' + el.attr('data-pid')
|
|
||||||
if (newUrl !== currentUrl) {
|
var newUrl = window.location.href.replace(window.location.hash, '') + '#' + el.attr('data-pid');
|
||||||
if (history.replaceState) {
|
|
||||||
history.replaceState({
|
if (newUrl !== currentUrl) {
|
||||||
url: window.location.pathname.slice(1) + '#' + el.attr('data-pid')
|
if (history.replaceState) {
|
||||||
}, null, newUrl);
|
history.replaceState({
|
||||||
}
|
url: window.location.pathname.slice(1) + (window.location.search ? window.location.search : '' ) + '#' + el.attr('data-pid')
|
||||||
currentUrl = newUrl;
|
}, null, newUrl);
|
||||||
}
|
}
|
||||||
|
currentUrl = newUrl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -1090,7 +1095,9 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(parseInt(page, 10) !== pagination.currentPage) {
|
if(parseInt(page, 10) !== pagination.currentPage) {
|
||||||
pagination.loadPage(page);
|
pagination.loadPage(page, function() {
|
||||||
|
scrollToPid(pid);
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
scrollToPid(pid);
|
scrollToPid(pid);
|
||||||
}
|
}
|
||||||
@@ -1106,6 +1113,7 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {
|
|||||||
if(after < 0) {
|
if(after < 0) {
|
||||||
after = 0;
|
after = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
loadMorePosts(tid, after, function() {
|
loadMorePosts(tid, after, function() {
|
||||||
scrollToPid(pid);
|
scrollToPid(pid);
|
||||||
});
|
});
|
||||||
@@ -1123,6 +1131,7 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {
|
|||||||
scrollTop: (scrollTo.offset().top - $('#header-menu').height() - offset) + "px"
|
scrollTop: (scrollTo.offset().top - $('#header-menu').height() - offset) + "px"
|
||||||
}, duration !== undefined ? duration : 400, function() {
|
}, duration !== undefined ? duration : 400, function() {
|
||||||
scrollingToPost = false;
|
scrollingToPost = false;
|
||||||
|
updateHeader();
|
||||||
if (highlight) {
|
if (highlight) {
|
||||||
scrollTo.parent().find('.topic-item').addClass('highlight');
|
scrollTo.parent().find('.topic-item').addClass('highlight');
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user