w/resources/src/mediawiki/mediawiki.notification.js
/**
	 * A Notification object for 1 message.
	 *
	 * The underscore in the name is to avoid a bug <https://github.com/senchalabs/jsduck/issues/304>.
	 * It is not part of the actual class name.
	 *
	 * The constructor is not publicly accessible; use mw.notification#notify instead.
	 * This does not insert anything into the document (see #start).
	 *
	 * @class mw.Notification_
	 * @alternateClassName mw.Notification
	 * @constructor
	 * @private
	 * @param {mw.Message|jQuery|HTMLElement|string} message
	 * @param {Object} options
	 */
A Notification object for 1 message.
The underscore in the name is to avoid a bug .
It is not part of the actual class name.

The constructor is not publicly accessible; use mw.notification#notify instead.
This does not insert anything into the document .


A Notification object for 1 message . The underscore in the name is to avoid a bug . It is not part of the actual class name . The constructor is not publicly accessible ; use mw . notification#notify instead . This does not insert anything into the document .
function Notification( message, options ) {
		var $notification, $notificationContent;
		$notification = $( '<div class="mw-notification"></div>' )
			.data( 'mw.notification', this )
			.addClass( options.autoHide ? 'mw-notification-autohide' : 'mw-notification-noautohide' );
		if ( options.tag ) {
			options.tag = options.tag.replace( /[ _-]+/g, '-' ).replace( /[^-a-z0-9]+/ig, '' );
			if ( options.tag ) {
				$notification.addClass( 'mw-notification-tag-' + options.tag );
			} else {
				delete options.tag;
			}
		}
		if ( options.type ) {
			options.type = options.type.replace( /[ _-]+/g, '-' ).replace( /[^-a-z0-9]+/ig, '' );
			$notification.addClass( 'mw-notification-type-' + options.type );
		}
		if ( options.title ) {
			$( '<div class="mw-notification-title"></div>' )
				.text( options.title )
				.appendTo( $notification );
		}
		$notificationContent = $( '<div class="mw-notification-content"></div>' );
		if ( typeof message === 'object' ) {
			if ( message instanceof mw.Message ) {
				$notificationContent.html( message.parse() );
			} else {
				$notificationContent.append( message );
			}
		} else {
			$notificationContent.text( message );
		}
		$notificationContent.appendTo( $notification );
		this.autoHideSeconds = options.autoHideSeconds &&
			notification.autoHideSeconds[ options.autoHideSeconds ] ||
			notification.autoHideSeconds.short;
		this.isOpen = false;
		this.isPaused = true;
		this.message = message;
		this.options = options;
		this.$notification = $notification;
		if ( options.visibleTimeout ) {
			this.timeout = require( 'mediawiki.visibleTimeout' );
		} else {
			this.timeout = {
				set: setTimeout,
				clear: clearTimeout
			};
		}
	}
function Notification ( message , options ) { var $notification , $notificationContent ; $notification = $ ( '<div class="mw-notification"></div>' ) . data ( 'mw.notification' , this ) . addClass ( options . autoHide ? 'mw-notification-autohide' : 'mw-notification-noautohide' ) ; if ( options . tag ) { options . tag = options . tag . replace ( / [ _-]+ / g , '-' ) . replace ( / [^-a-z0-9]+ / ig , '' ) ; if ( options . tag ) { $notification . addClass ( 'mw-notification-tag-' + options . tag ) ; } else { delete options . tag ; } } if ( options . type ) { options . type = options . type . replace ( / [ _-]+ / g , '-' ) . replace ( / [^-a-z0-9]+ / ig , '' ) ; $notification . addClass ( 'mw-notification-type-' + options . type ) ; } if ( options . title ) { $ ( '<div class="mw-notification-title"></div>' ) . text ( options . title ) . appendTo ( $notification ) ; } $notificationContent = $ ( '<div class="mw-notification-content"></div>' ) ; if ( typeof message === 'object' ) { if ( message instanceof mw . Message ) { $notificationContent . html ( message . parse ( ) ) ; } else { $notificationContent . append ( message ) ; } } else { $notificationContent . text ( message ) ; } $notificationContent . appendTo ( $notification ) ; this . autoHideSeconds = options . autoHideSeconds && notification . autoHideSeconds [ options . autoHideSeconds ] || notification . autoHideSeconds . short ; this . isOpen = false ; this . isPaused = true ; this . message = message ; this . options = options ; this . $notification = $notification ; if ( options . visibleTimeout ) { this . timeout = require ( 'mediawiki.visibleTimeout' ) ; } else { this . timeout = { set : setTimeout , clear : clearTimeout } ; } }
A Notification object for 1 message.
A Notification object for 1 message .
// Sanitize options.tag before it is used by any code. (Including Notification class methods) // Sanitize options.type // Handle mw.Message objects separately from DOM nodes and jQuery objects // Private state parameters, meant for internal use only // autoHideSeconds: String alias for number of seconds for timeout of 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. //           Set to true initially so .start() can call .resume(). // message: The message passed to the notification. Unused now but may be used in the future //          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. // timeout: Holds appropriate methods to set/clear timeouts