From 38806fe07fd0c29fa2644b2b0fcfcb5291d245e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Mon, 12 Jun 2017 12:53:12 -0400 Subject: [PATCH] closes #5752 --- public/src/client/category.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/public/src/client/category.js b/public/src/client/category.js index 4cdd18ca2b..fd757e7803 100644 --- a/public/src/client/category.js +++ b/public/src/client/category.js @@ -15,8 +15,8 @@ define('forum/category', [ ], function (infinitescroll, share, navigator, categoryTools, sort, components, translator, topicSelect, pagination, storage) { var Category = {}; - $(window).on('action:ajaxify.start', function (ev, data) { - if (ajaxify.currentPage !== data.url) { + $(window).on('action:ajaxify.end', function (ev, data) { + if (data.tpl_url !== 'category') { navigator.disable(); removeListeners(); @@ -113,11 +113,14 @@ define('forum/category', [ return bottomIndex; }; - $(window).on('action:ajaxify.contentLoaded', function () { + $(window).on('action:popstate', function () { if (ajaxify.data.template.category && ajaxify.data.cid) { var bookmarkIndex = storage.getItem('category:' + ajaxify.data.cid + ':bookmark'); var clickedIndex = storage.getItem('category:' + ajaxify.data.cid + ':bookmark:clicked'); + storage.removeItem('category:' + ajaxify.data.cid + ':bookmark'); + storage.removeItem('category:' + ajaxify.data.cid + ':bookmark:clicked'); + bookmarkIndex = Math.max(0, parseInt(bookmarkIndex, 10) || 0); clickedIndex = Math.max(0, parseInt(clickedIndex, 10) || 0); if (!parseInt(bookmarkIndex, 10)) { @@ -128,10 +131,10 @@ define('forum/category', [ var page = Math.ceil((parseInt(bookmarkIndex, 10) + 1) / config.topicsPerPage); if (parseInt(page, 10) !== ajaxify.data.pagination.currentPage) { pagination.loadPage(page, function () { - Category.scrollToTopic(bookmarkIndex, clickedIndex, 400); + Category.scrollToTopic(bookmarkIndex, clickedIndex, 0); }); } else { - Category.scrollToTopic(bookmarkIndex, clickedIndex, 400); + Category.scrollToTopic(bookmarkIndex, clickedIndex, 0); } } else { if (bookmarkIndex === 0) {