Skip to content

Commit

Permalink
fix: bookmark scroll doing ajaxify
Browse files Browse the repository at this point in the history
if target post is already on page
fix alerts crash due to double close
  • Loading branch information
barisusakli committed Aug 22, 2023
1 parent a7a266d commit 2e0964e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion public/src/client/topic.js
Expand Up @@ -162,7 +162,7 @@ define('forum/topic', [
timeout: 15000,
type: 'info',
clickfn: function () {
navigator.scrollToIndex(parseInt(bookmark, 10), true);
navigator.scrollToIndex(Math.max(0, parseInt(bookmark, 10) - 1), true);
},
closefn: function () {
storage.removeItem('topic:' + tid + ':bookmark');
Expand Down
4 changes: 2 additions & 2 deletions public/src/modules/alerts.js
Expand Up @@ -90,8 +90,8 @@ function updateAlert(alert, params) {
.on('click', function (e) {
if (!$(e.target).is('.btn-close')) {
params.clickfn();
close(alert);
}
close(alert);
});
}
}
Expand Down Expand Up @@ -128,8 +128,8 @@ function createNew(params) {
.on('click', function (e) {
if (!$(e.target).is('.btn-close')) {
params.clickfn(alert, params);
close(alert);
}
close(alert);
});
}

Expand Down

0 comments on commit 2e0964e

Please sign in to comment.