mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-20 15:30:39 +01:00
handlebookmark func
This commit is contained in:
@@ -56,11 +56,26 @@ define('forum/topic', dependencies, function(pagination, infinitescroll, threadT
|
|||||||
|
|
||||||
addBlockquoteEllipses($('.topic .post-content > blockquote'));
|
addBlockquoteEllipses($('.topic .post-content > blockquote'));
|
||||||
|
|
||||||
|
handleBookmark(tid);
|
||||||
|
|
||||||
|
navigator.init('.posts > .post-row', postCount, Topic.navigatorCallback);
|
||||||
|
|
||||||
|
socket.on('event:new_post', onNewPost);
|
||||||
|
|
||||||
|
$(window).on('scroll', updateTopicTitle);
|
||||||
|
|
||||||
|
$(window).trigger('action:topic.loaded');
|
||||||
|
|
||||||
|
socket.emit('topics.markAsRead', tid);
|
||||||
|
socket.emit('topics.increaseViewCount', tid);
|
||||||
|
};
|
||||||
|
|
||||||
|
function handleBookmark(tid) {
|
||||||
var bookmark = localStorage.getItem('topic:' + tid + ':bookmark');
|
var bookmark = localStorage.getItem('topic:' + tid + ':bookmark');
|
||||||
var postIndex = getPostIndex();
|
var postIndex = getPostIndex();
|
||||||
if (postIndex) {
|
if (postIndex) {
|
||||||
scrollTo.scrollToPost(postIndex - 1, true);
|
scrollTo.scrollToPost(postIndex - 1, true);
|
||||||
} else if (bookmark && (!config.usePagination || (config.usePagination && pagination.currentPage === 1)) && postCount > 1) {
|
} else if (bookmark && (!config.usePagination || (config.usePagination && pagination.currentPage === 1)) && ajaxify.variables.get('postcount') > 1) {
|
||||||
app.alert({
|
app.alert({
|
||||||
alert_id: 'bookmark',
|
alert_id: 'bookmark',
|
||||||
message: '[[topic:bookmark_instructions]]',
|
message: '[[topic:bookmark_instructions]]',
|
||||||
@@ -74,18 +89,12 @@ define('forum/topic', dependencies, function(pagination, infinitescroll, threadT
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
navigator.init('.posts > .post-row', postCount, Topic.navigatorCallback);
|
function getPostIndex() {
|
||||||
|
var parts = window.location.pathname.split('/');
|
||||||
socket.on('event:new_post', onNewPost);
|
return parts[4] ? parseInt(parts[4], 10) : 0;
|
||||||
|
}
|
||||||
$(window).on('scroll', updateTopicTitle);
|
|
||||||
|
|
||||||
$(window).trigger('action:topic.loaded');
|
|
||||||
|
|
||||||
socket.emit('topics.markAsRead', tid);
|
|
||||||
socket.emit('topics.increaseViewCount', tid);
|
|
||||||
};
|
|
||||||
|
|
||||||
function handleSorting() {
|
function handleSorting() {
|
||||||
var threadSort = $('.thread-sort');
|
var threadSort = $('.thread-sort');
|
||||||
@@ -102,11 +111,6 @@ define('forum/topic', dependencies, function(pagination, infinitescroll, threadT
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPostIndex() {
|
|
||||||
var parts = window.location.pathname.split('/');
|
|
||||||
return parts[4] ? parseInt(parts[4], 10) : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
function showBottomPostBar() {
|
function showBottomPostBar() {
|
||||||
if($('#post-container .post-row').length > 1 || !$('#post-container li[data-index="0"]').length) {
|
if($('#post-container .post-row').length > 1 || !$('#post-container li[data-index="0"]').length) {
|
||||||
$('.bottom-post-bar').removeClass('hide');
|
$('.bottom-post-bar').removeClass('hide');
|
||||||
|
|||||||
Reference in New Issue
Block a user