X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/ddb7f33868ea499ab8f48a7062f145e8c0fbe02f..refs/pull/2023/head:/resources/js/components/notification.js diff --git a/resources/js/components/notification.js b/resources/js/components/notification.js index f7edb08aa..35bab4ea6 100644 --- a/resources/js/components/notification.js +++ b/resources/js/components/notification.js @@ -28,7 +28,11 @@ class Notification { this.elem.classList.add('showing'); }, 1); - if (this.autohide) setTimeout(this.hide.bind(this), 2000); + if (this.autohide) { + const words = textToShow.split(' ').length; + const timeToShow = Math.max(2000, 1000 + (250 * words)); + setTimeout(this.hide.bind(this), timeToShow); + } } hide() {