This commit is contained in:
Peter Jaszkowiak
2017-04-19 20:33:03 -06:00
parent 1028327f0a
commit 30b47d39f3
8 changed files with 117 additions and 30 deletions

View File

@@ -12,7 +12,8 @@ define('forum/topic', [
'navigator',
'sort',
'components',
], function (infinitescroll, threadTools, postTools, events, posts, images, replies, navigator, sort, components) {
'storage',
], function (infinitescroll, threadTools, postTools, events, posts, images, replies, navigator, sort, components, storage) {
var Topic = {};
var currentUrl = '';
@@ -142,7 +143,7 @@ define('forum/topic', [
function handleBookmark(tid) {
// use the user's bookmark data if available, fallback to local if available
var bookmark = ajaxify.data.bookmark || localStorage.getItem('topic:' + tid + ':bookmark');
var bookmark = ajaxify.data.bookmark || storage.getItem('topic:' + tid + ':bookmark');
var postIndex = getPostIndex();
if (postIndex && window.location.search.indexOf('page=') === -1) {
@@ -160,7 +161,7 @@ define('forum/topic', [
navigator.scrollToPost(parseInt(bookmark - 1, 10), true);
},
closefn: function () {
localStorage.removeItem('topic:' + tid + ':bookmark');
storage.removeItem('topic:' + tid + ':bookmark');
},
});
setTimeout(function () {
@@ -273,7 +274,7 @@ define('forum/topic', [
function updateUserBookmark(index) {
var bookmarkKey = 'topic:' + ajaxify.data.tid + ':bookmark';
var currentBookmark = ajaxify.data.bookmark || localStorage.getItem(bookmarkKey);
var currentBookmark = ajaxify.data.bookmark || storage.getItem(bookmarkKey);
if (ajaxify.data.postcount > ajaxify.data.bookmarkThreshold && (!currentBookmark || parseInt(index, 10) > parseInt(currentBookmark, 10))) {
if (app.user.uid) {
@@ -287,7 +288,7 @@ define('forum/topic', [
ajaxify.data.bookmark = index;
});
} else {
localStorage.setItem(bookmarkKey, index);
storage.setItem(bookmarkKey, index);
}
}