From 4b9992a06dd9d486d282044a24f063db8010f492 Mon Sep 17 00:00:00 2001 From: rlot Date: Fri, 13 Jan 2017 17:46:17 +0100 Subject: [PATCH] Added "autoHideSeconds" setting in mw.notify() "autoHideSeconds" is now option of Notification, instead of global variable. Bug: T155228 Change-Id: If0d141b67515546f1605f24c2f4a50a05d5f2ba4 --- resources/src/mediawiki/mediawiki.notification.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/resources/src/mediawiki/mediawiki.notification.js b/resources/src/mediawiki/mediawiki.notification.js index e1287dbc56..7a3fb0a09e 100644 --- a/resources/src/mediawiki/mediawiki.notification.js +++ b/resources/src/mediawiki/mediawiki.notification.js @@ -71,6 +71,7 @@ $notificationContent.appendTo( $notification ); // Private state parameters, meant for internal use only + // autoHideSeconds: Number of seconds to wait before auto-hiding notifications. // isOpen: Set to true after .start() is called to avoid double calls. // Set back to false after .close() to avoid duplicating the close animation. // isPaused: false after .resume(), true after .pause(). Avoids duplicating or breaking the hide timeouts. @@ -79,6 +80,8 @@ // to stop replacement of a tagged notification with another notification using the same message. // options: The options passed to the notification with a little sanitization. Used by various methods. // $notification: jQuery object containing the notification DOM node. + // Set hide delay + this.autoHideSeconds = options.autoHideSeconds; this.isOpen = false; this.isPaused = true; this.message = message; @@ -190,7 +193,7 @@ // Already finished, so don't try to re-clear it delete notif.timeout; notif.close(); - }, notification.autoHideSeconds * 1000 ); + }, this.autoHideSeconds * 1000 ); } }; @@ -370,6 +373,9 @@ * A boolean indicating whether the notifification should automatically * be hidden after shown. Or if it should persist. * + * - autoHideSeconds: + * Number of seconds to wait before auto-hiding notifications. + * * - tag: * An optional string. When a notification is tagged only one message * with that tag will be displayed. Trying to display a new notification @@ -387,17 +393,12 @@ */ defaults: { autoHide: true, + autoHideSeconds: 5, tag: false, title: undefined, type: false }, - /** - * @property {number} - * Number of seconds to wait before auto-hiding notifications. - */ - autoHideSeconds: 5, - /** * @property {number} * Maximum number of notifications to count down auto-hide timers for. -- 2.20.1