From e2a198c59a78e76cf42363e69cc6f56422b98896 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Fri, 4 Aug 2023 13:35:34 -0400 Subject: [PATCH] fix 0 timeouts --- public/src/client/topic.js | 5 +---- public/src/modules/alerts.js | 10 +++++----- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/public/src/client/topic.js b/public/src/client/topic.js index 79235656dd..30d58e25c6 100644 --- a/public/src/client/topic.js +++ b/public/src/client/topic.js @@ -160,7 +160,7 @@ define('forum/topic', [ alerts.alert({ alert_id: 'bookmark', message: '[[topic:bookmark_instructions]]', - timeout: 0, + timeout: 15000, type: 'info', clickfn: function () { navigator.scrollToIndex(parseInt(bookmark, 10), true); @@ -169,9 +169,6 @@ define('forum/topic', [ storage.removeItem('topic:' + tid + ':bookmark'); }, }); - setTimeout(function () { - alerts.remove('bookmark'); - }, 10000); } } diff --git a/public/src/modules/alerts.js b/public/src/modules/alerts.js index 3cc82137ca..ae30c6c6b3 100644 --- a/public/src/modules/alerts.js +++ b/public/src/modules/alerts.js @@ -23,7 +23,7 @@ export function success(message, timeout) { title: '[[global:alert.success]]', message: message, type: 'success', - timeout: timeout || 5000, + timeout: timeout !== undefined ? timeout : 5000, }); } @@ -33,7 +33,7 @@ export function info(message, timeout) { title: '[[global:alert.info]]', message: message, type: 'info', - timeout: timeout || 5000, + timeout: timeout !== undefined ? timeout : 5000, }); } @@ -43,7 +43,7 @@ export function warning(message, timeout) { title: '[[global:alert.warning]]', message: message, type: 'warning', - timeout: timeout || 5000, + timeout: timeout !== undefined ? timeout : 5000, }); } @@ -118,7 +118,7 @@ function createNew(params) { } }); - if (params.timeout) { + if (parseInt(params.timeout, 10)) { startTimeout(alert, params); } @@ -142,7 +142,7 @@ function close(alert) { } function startTimeout(alert, params) { - const timeout = params.timeout; + const timeout = parseInt(params.timeout, 10); const timeoutId = setTimeout(function () { alert.removeAttr('timeoutId');