<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://mbwiki.stairwaygames.work/w/index.php?action=history&amp;feed=atom&amp;title=MediaWiki%3AModal.js</id>
	<title>MediaWiki:Modal.js - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://mbwiki.stairwaygames.work/w/index.php?action=history&amp;feed=atom&amp;title=MediaWiki%3AModal.js"/>
	<link rel="alternate" type="text/html" href="https://mbwiki.stairwaygames.work/w/index.php?title=MediaWiki:Modal.js&amp;action=history"/>
	<updated>2026-04-07T20:29:51Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://mbwiki.stairwaygames.work/w/index.php?title=MediaWiki:Modal.js&amp;diff=23358&amp;oldid=prev</id>
		<title>Mikevoir at 04:06, 10 July 2024</title>
		<link rel="alternate" type="text/html" href="https://mbwiki.stairwaygames.work/w/index.php?title=MediaWiki:Modal.js&amp;diff=23358&amp;oldid=prev"/>
		<updated>2024-07-10T04:06:05Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 04:06, 10 July 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l13&quot;&gt;Line 13:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 13:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         return;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         return;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     }&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     }&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;    &lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;    importArticle({&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;    	article: &#039;u:dev:MediaWiki:Modal.css&#039;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;    });&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     /**&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     /**&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key new_wiki-coral_islands:diff::1.12:old-23356:rev-23358 --&gt;
&lt;/table&gt;</summary>
		<author><name>Mikevoir</name></author>
	</entry>
	<entry>
		<id>https://mbwiki.stairwaygames.work/w/index.php?title=MediaWiki:Modal.js&amp;diff=23356&amp;oldid=prev</id>
		<title>Mikevoir: Created page with &quot;/**  * Name:        Modal  * Version:     v2.2  * Author:      KockaAdmiralac  * Description: Abstracts modal logic for native Modals and OOUI.  */ /* eslint {&quot;max-statements&quot;: &quot;off&quot;} */ (function() {     &#039;use strict&#039;;     window.dev = window.dev || {};     // Double-load protection.     if (window.dev.modal) {         return;     }          importArticle({     	article: &#039;u:dev:MediaWiki:Modal.css&#039;     });      /**      * Module exports.      */     var module = {...&quot;</title>
		<link rel="alternate" type="text/html" href="https://mbwiki.stairwaygames.work/w/index.php?title=MediaWiki:Modal.js&amp;diff=23356&amp;oldid=prev"/>
		<updated>2024-07-10T04:02:25Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;*  * Name:        Modal  * Version:     v2.2  * Author:      KockaAdmiralac  * Description: Abstracts modal logic for native Modals and OOUI.: &lt;/span&gt; &lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;eslint {&amp;quot;max-statements&amp;quot;: &amp;quot;off&amp;quot;}: &lt;/span&gt; (function() {     &amp;#039;use strict&amp;#039;;     window.dev = window.dev || {};     // Double-load protection.     if (window.dev.modal) {         return;     }          importArticle({     	article: &amp;#039;u:dev:MediaWiki:Modal.css&amp;#039;     });      &lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;*      * Module exports.: &lt;/span&gt;     var module = {...&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;/**&lt;br /&gt;
 * Name:        Modal&lt;br /&gt;
 * Version:     v2.2&lt;br /&gt;
 * Author:      KockaAdmiralac&lt;br /&gt;
 * Description: Abstracts modal logic for native Modals and OOUI.&lt;br /&gt;
 */&lt;br /&gt;
/* eslint {&amp;quot;max-statements&amp;quot;: &amp;quot;off&amp;quot;} */&lt;br /&gt;
(function() {&lt;br /&gt;
    &amp;#039;use strict&amp;#039;;&lt;br /&gt;
    window.dev = window.dev || {};&lt;br /&gt;
    // Double-load protection.&lt;br /&gt;
    if (window.dev.modal) {&lt;br /&gt;
        return;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    importArticle({&lt;br /&gt;
    	article: &amp;#039;u:dev:MediaWiki:Modal.css&amp;#039;&lt;br /&gt;
    });&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Module exports.&lt;br /&gt;
     */&lt;br /&gt;
    var module = {&lt;br /&gt;
        modals: {}&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * All possible sizes a modal can effectively have.&lt;br /&gt;
     * @constant&lt;br /&gt;
     */&lt;br /&gt;
    var MODAL_SIZES = [&lt;br /&gt;
        &amp;#039;small&amp;#039;,&lt;br /&gt;
        &amp;#039;medium&amp;#039;,&lt;br /&gt;
        &amp;#039;large&amp;#039;,&lt;br /&gt;
        &amp;#039;larger&amp;#039;,&lt;br /&gt;
        &amp;#039;content-size&amp;#039;,&lt;br /&gt;
        &amp;#039;full&amp;#039;&lt;br /&gt;
    ];&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * All possible modal button types.&lt;br /&gt;
     * link - Renders as a simple link&lt;br /&gt;
     * input - Renders as &amp;lt;input type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
     * button - Renders as &amp;lt;button&amp;gt;&lt;br /&gt;
     * @constant&lt;br /&gt;
     */&lt;br /&gt;
    var BUTTON_TYPES = [&lt;br /&gt;
        &amp;#039;link&amp;#039;,&lt;br /&gt;
        &amp;#039;input&amp;#039;,&lt;br /&gt;
        &amp;#039;button&amp;#039;&lt;br /&gt;
    ];&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Callback after the modal component has been initialized.&lt;br /&gt;
     * @param {UIComponent} modal Modal component creator&lt;br /&gt;
     */&lt;br /&gt;
    function init(modal) {&lt;br /&gt;
        module._windowManager = new OO.ui.WindowManager({&lt;br /&gt;
            classes: [&amp;#039;modal-js-window&amp;#039;]&lt;br /&gt;
        });&lt;br /&gt;
        $(document.body).append(module._windowManager.$element);&lt;br /&gt;
        mw.hook(&amp;#039;dev.modal&amp;#039;).fire(module);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Modal button constructor.&lt;br /&gt;
     * @constructor&lt;br /&gt;
     * @param {Object} options Button options&lt;br /&gt;
     */&lt;br /&gt;
    function ModalButton(options) {&lt;br /&gt;
        this.primary = Boolean(options.primary);&lt;br /&gt;
        this.safe = Boolean(options.close || options.safe);&lt;br /&gt;
        this.back = Boolean(options.back);&lt;br /&gt;
        this.close = Boolean(options.close);&lt;br /&gt;
        this.setText(options.text || options.value)&lt;br /&gt;
            .setEvent(options.event)&lt;br /&gt;
            .setClasses(options.classes)&lt;br /&gt;
            .setID(options.id)&lt;br /&gt;
            .setDisabled(options.disabled)&lt;br /&gt;
            .setSprite(options.sprite || options.imageClass)&lt;br /&gt;
        // Link-specific methods&lt;br /&gt;
            .setHref(options.href)&lt;br /&gt;
            .setTitle(options.title)&lt;br /&gt;
            .setTarget(options.target)&lt;br /&gt;
        // Input-specific methods&lt;br /&gt;
            .setName(options.name);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Sets button classes, including normal and primary ones.&lt;br /&gt;
     * @param {String|Array} classes Classes to set&lt;br /&gt;
     * @returns {ModalButton} Current instance&lt;br /&gt;
     */&lt;br /&gt;
    ModalButton.prototype.setClasses = function(classes) {&lt;br /&gt;
        this.classes = classes instanceof Array ? classes : [];&lt;br /&gt;
        return this;&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Sets whether the button is disabled or not.&lt;br /&gt;
     * @param {Boolean} disabled Whether the button is disabled&lt;br /&gt;
     * @returns {ModalButton} Current instance&lt;br /&gt;
     */&lt;br /&gt;
    ModalButton.prototype.setDisabled = function(disabled) {&lt;br /&gt;
        this.disabled = Boolean(disabled);&lt;br /&gt;
        return this;&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Sets event data.&lt;br /&gt;
     * @param {String} event Event to assign to the button&lt;br /&gt;
     * @returns {ModalButton} Current instance&lt;br /&gt;
     */&lt;br /&gt;
    ModalButton.prototype.setEvent = function(event) {&lt;br /&gt;
        if (typeof event === &amp;#039;string&amp;#039;) {&lt;br /&gt;
            this.event = event;&lt;br /&gt;
        }&lt;br /&gt;
        return this;&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Sets the location the button links to if it&amp;#039;s a link.&lt;br /&gt;
     * @param {String} href Location the button points to&lt;br /&gt;
     * @returns {ModalButton} Current instance&lt;br /&gt;
     * @throws {Error} If not validly specified when the button is a link&lt;br /&gt;
     */&lt;br /&gt;
    ModalButton.prototype.setHref = function(href) {&lt;br /&gt;
        if (this.type === &amp;#039;link&amp;#039;&amp;amp;&amp;amp; typeof href === &amp;#039;string&amp;#039;) {&lt;br /&gt;
            this.href = href;&lt;br /&gt;
        }&lt;br /&gt;
        return this;&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Sets the button ID.&lt;br /&gt;
     * @param {String} id Button&amp;#039;s ID.&lt;br /&gt;
     * @returns {ModalButton} Current instance&lt;br /&gt;
     */&lt;br /&gt;
    ModalButton.prototype.setID = function(id) {&lt;br /&gt;
        if (typeof id === &amp;#039;string&amp;#039;) {&lt;br /&gt;
            this.id = id;&lt;br /&gt;
        }&lt;br /&gt;
        return this;&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Sets the input name of the button is an input element.&lt;br /&gt;
     * @param {String} name Input button name&lt;br /&gt;
     * @returns {ModalButton} Current instance&lt;br /&gt;
     * @throws {Error} If not validly specified when the button is an input&lt;br /&gt;
     */&lt;br /&gt;
    ModalButton.prototype.setName = function(name) {&lt;br /&gt;
        if (this.type === &amp;#039;input&amp;#039;) {&lt;br /&gt;
            if (typeof name === &amp;#039;string&amp;#039;) {&lt;br /&gt;
                this.name = name;&lt;br /&gt;
            } else {&lt;br /&gt;
                throw new Error(&amp;#039;`name` parameter required!&amp;#039;);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        return this;&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Sets button text.&lt;br /&gt;
     * @param {String} text Text on the button&lt;br /&gt;
     * @returns {ModalButton} Current instance&lt;br /&gt;
     * @throws {Error} If not validly specified&lt;br /&gt;
     */&lt;br /&gt;
    ModalButton.prototype.setText = function(text) {&lt;br /&gt;
        if (typeof text !== &amp;#039;string&amp;#039;) {&lt;br /&gt;
            throw new Error(&amp;#039;No text specified!&amp;#039;);&lt;br /&gt;
        }&lt;br /&gt;
        this.text = text;&lt;br /&gt;
        return this;&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Sets the button type.&lt;br /&gt;
     * @param {String} type Button type&lt;br /&gt;
     * @see BUTTON_TYPES&lt;br /&gt;
     * @returns {ModalButton} Current instance&lt;br /&gt;
     */&lt;br /&gt;
    ModalButton.prototype.setType = function(type) {&lt;br /&gt;
        return this;&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Sets the button&amp;#039;s sprite image. Doesn&amp;#039;t work if it&amp;#039;s an input button.&lt;br /&gt;
     * @param {String} sprite Sprite class of the sprite.&lt;br /&gt;
     * @todo Sprite class validation&lt;br /&gt;
     * @returns {ModalButton} Current instance&lt;br /&gt;
     */&lt;br /&gt;
    ModalButton.prototype.setSprite = function(sprite) {&lt;br /&gt;
        if (&lt;br /&gt;
            (this.type === &amp;#039;link&amp;#039; || this.type === &amp;#039;button&amp;#039;) &amp;amp;&amp;amp;&lt;br /&gt;
            typeof sprite === &amp;#039;string&amp;#039;&lt;br /&gt;
        ) {&lt;br /&gt;
            this.sprite = sprite;&lt;br /&gt;
        }&lt;br /&gt;
        return this;&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Sets the target of the link if the button is a link.&lt;br /&gt;
     * @param {String} target Button&amp;#039;s link target.&lt;br /&gt;
     * @returns {ModalButton} Current instance&lt;br /&gt;
     */&lt;br /&gt;
    ModalButton.prototype.setTarget = function(target) {&lt;br /&gt;
        if (&lt;br /&gt;
            this.type === &amp;#039;link&amp;#039; &amp;amp;&amp;amp;&lt;br /&gt;
            typeof target === &amp;#039;string&amp;#039;&lt;br /&gt;
        ) {&lt;br /&gt;
            this.target = target;&lt;br /&gt;
        }&lt;br /&gt;
        return this;&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Sets the title of the link if the button is a link.&lt;br /&gt;
     * @param {String} title Button&amp;#039;s link title&lt;br /&gt;
     * @returns {ModalButton} Current instance&lt;br /&gt;
     * @throws {Error} If not validly specified when the button is a link&lt;br /&gt;
     */&lt;br /&gt;
    ModalButton.prototype.setTitle = function(title) {&lt;br /&gt;
        if (this.type === &amp;#039;link&amp;#039; &amp;amp;&amp;amp; typeof title === &amp;#039;string&amp;#039;) {&lt;br /&gt;
            this.title = title;&lt;br /&gt;
        }&lt;br /&gt;
        return this;&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Converts instance variables to Mustache variables.&lt;br /&gt;
     * @returns {Object} Mustache variables for rendering the button&lt;br /&gt;
     */&lt;br /&gt;
    ModalButton.prototype.create = function() {&lt;br /&gt;
        var flags = [];&lt;br /&gt;
        [&amp;#039;primary&amp;#039;, &amp;#039;safe&amp;#039;, &amp;#039;back&amp;#039;, &amp;#039;close&amp;#039;].forEach(function(flag) {&lt;br /&gt;
            if (this[flag]) {&lt;br /&gt;
                flags.push(flag);&lt;br /&gt;
            }&lt;br /&gt;
        }, this);&lt;br /&gt;
        return {&lt;br /&gt;
            action: this.event,&lt;br /&gt;
            classes: this.classes,&lt;br /&gt;
            disabled: this.disabled,&lt;br /&gt;
            flags: flags,&lt;br /&gt;
            href: this.href,&lt;br /&gt;
            icon: this.sprite,&lt;br /&gt;
            id: this.id,&lt;br /&gt;
            label: this.text,&lt;br /&gt;
            title: this.title&lt;br /&gt;
        };&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Creates a button out of button configuration.&lt;br /&gt;
     * @param {Object} options Button options&lt;br /&gt;
     * @returns {ModalButton|false} Modal button object&lt;br /&gt;
     */&lt;br /&gt;
    function createButton(options) {&lt;br /&gt;
        if (typeof options !== &amp;#039;object&amp;#039;) {&lt;br /&gt;
            return false;&lt;br /&gt;
        }&lt;br /&gt;
        return new ModalButton(options);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Gets Mustache variables required to render a button.&lt;br /&gt;
     * @param {ModalButton} button Button to get Mustache variables from&lt;br /&gt;
     * @returns {Object} Mustache variables for rendering the button&lt;br /&gt;
     */&lt;br /&gt;
    function buttonComponent(button) {&lt;br /&gt;
        return button.create();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Modal constructor.&lt;br /&gt;
     * @constructor&lt;br /&gt;
     * @param {Object} options Modal options&lt;br /&gt;
     * @throws {Error} If ID is not specified or already used&lt;br /&gt;
     */&lt;br /&gt;
    function Modal(options) {&lt;br /&gt;
        if (typeof options.id !== &amp;#039;string&amp;#039;) {&lt;br /&gt;
            throw new Error(&amp;#039;Modal ID must be specified!&amp;#039;);&lt;br /&gt;
        }&lt;br /&gt;
        if (module.modals[options.id]) {&lt;br /&gt;
            throw new Error(&amp;#039;Modal with same ID already registered!&amp;#039;);&lt;br /&gt;
        }&lt;br /&gt;
        this.id = options.id;&lt;br /&gt;
        this.context = options.context || this;&lt;br /&gt;
        this.setSize(options.size)&lt;br /&gt;
            .setContent(options.content)&lt;br /&gt;
            .setTitle(options.title, options.isHTML)&lt;br /&gt;
            .setCloseTitle(options.closeTitle)&lt;br /&gt;
            .setButtons(options.buttons)&lt;br /&gt;
            .setEvents(options.events)&lt;br /&gt;
            .setClass(options.class || options.classes)&lt;br /&gt;
            .setClose(options.close)&lt;br /&gt;
            .setCloseEscape(options.closeEscape);&lt;br /&gt;
        module.modals[this.id] = this;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Sets the modal&amp;#039;s buttons.&lt;br /&gt;
     * @param {Array} buttons Modal&amp;#039;s buttons&lt;br /&gt;
     * @returns {Modal} Current instance&lt;br /&gt;
     */&lt;br /&gt;
    Modal.prototype.setButtons = function(buttons) {&lt;br /&gt;
        this.buttons = buttons instanceof Array ?&lt;br /&gt;
            buttons&lt;br /&gt;
                .map(createButton)&lt;br /&gt;
                .filter(Boolean) :&lt;br /&gt;
            [];&lt;br /&gt;
        this.buttons.push(new ModalButton({&lt;br /&gt;
            close: true,&lt;br /&gt;
            text: this.closeTitle,&lt;br /&gt;
            title: this.closeTitle&lt;br /&gt;
        }));&lt;br /&gt;
        return this;&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Sets the modal&amp;#039;s class(es).&lt;br /&gt;
     * @param {String|Array} classes Modal&amp;#039;s class(es)&lt;br /&gt;
     * @returns {Modal} Current instance&lt;br /&gt;
     */&lt;br /&gt;
    Modal.prototype.setClass = function(classes) {&lt;br /&gt;
        if (classes instanceof Array) {&lt;br /&gt;
            this.classes = classes;&lt;br /&gt;
        } else if (typeof classes === &amp;#039;string&amp;#039;) {&lt;br /&gt;
            this.classes = [classes];&lt;br /&gt;
        }&lt;br /&gt;
        return this;&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Sets the modal&amp;#039;s class(es).&lt;br /&gt;
     * @param {String|Array} classes Modal&amp;#039;s class(es)&lt;br /&gt;
     * @returns {Modal} Current instance&lt;br /&gt;
     */&lt;br /&gt;
    Modal.prototype.setClasses = Modal.prototype.setClass;&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Sets the function to be executed on closing.&lt;br /&gt;
     * @param {Function} close On close function&lt;br /&gt;
     * @returns {Modal} Current instance&lt;br /&gt;
     */&lt;br /&gt;
    Modal.prototype.setClose = function(close) {&lt;br /&gt;
        if (typeof close === &amp;#039;function&amp;#039;) {&lt;br /&gt;
            this.closeFunc = close;&lt;br /&gt;
        }&lt;br /&gt;
        return this;&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Sets whether the modal should be closed when&lt;br /&gt;
     * the Escape button is pressed.&lt;br /&gt;
     * @param {Boolean} escape Whether the Escape button closes the modal&lt;br /&gt;
     * @returns {Modal} Current instance&lt;br /&gt;
     */&lt;br /&gt;
    Modal.prototype.setCloseEscape = function(escape) {&lt;br /&gt;
        this.closeEscape = escape !== false;&lt;br /&gt;
        return this;&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Sets the title on the closing link (X).&lt;br /&gt;
     * @param {String} title Closing link title&lt;br /&gt;
     * @returns {Modal} Current instance&lt;br /&gt;
     */&lt;br /&gt;
    Modal.prototype.setCloseTitle = function(title) {&lt;br /&gt;
        this.closeTitle = typeof title === &amp;#039;string&amp;#039; ? title : mw.message(&amp;#039;ooui-dialog-message-reject&amp;#039;).plain();&lt;br /&gt;
        return this;&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Sets modal content.&lt;br /&gt;
     * @param {String} content Modal content&lt;br /&gt;
     * @returns {Modal} Current instance&lt;br /&gt;
     * @throws {Error} If not validly specified&lt;br /&gt;
     */&lt;br /&gt;
    Modal.prototype.setContent = function(content) {&lt;br /&gt;
        if (&lt;br /&gt;
            typeof content === &amp;#039;string&amp;#039; ||&lt;br /&gt;
            typeof content === &amp;#039;object&amp;#039; &amp;amp;&amp;amp;&lt;br /&gt;
            content instanceof OO.ui.Layout&lt;br /&gt;
        ) {&lt;br /&gt;
            this.content = content;&lt;br /&gt;
        } else if (content instanceof Node) {&lt;br /&gt;
            this.content = content;&lt;br /&gt;
        } else if (&lt;br /&gt;
            typeof content === &amp;#039;object&amp;#039; &amp;amp;&amp;amp;&lt;br /&gt;
            typeof window.dev.ui === &amp;#039;function&amp;#039;&lt;br /&gt;
        ) {&lt;br /&gt;
            this.content = window.dev.ui(content);&lt;br /&gt;
        } else {&lt;br /&gt;
            throw new Error(&amp;#039;Modal content not specified!&amp;#039;);&lt;br /&gt;
        }&lt;br /&gt;
        if (this._modal) {&lt;br /&gt;
            if (this.content instanceof OO.ui.Layout) {&lt;br /&gt;
                this._modal.content.$element.remove();&lt;br /&gt;
                this._modal.content = this.content;&lt;br /&gt;
                this._modal.$body.append(this.content.$element);&lt;br /&gt;
            } else {&lt;br /&gt;
                this._modal.content.$element.html(this.content);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        return this;&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Sets an event handler.&lt;br /&gt;
     * @param {String} name Event name&lt;br /&gt;
     * @param {Function|String} listener Event listener or its name in context&lt;br /&gt;
     * @returns {Modal} Current instance&lt;br /&gt;
     */&lt;br /&gt;
    Modal.prototype.setEvent = function(name, listener) {&lt;br /&gt;
        this.events[name] = this.events[name] || [];&lt;br /&gt;
        if (typeof listener === &amp;#039;function&amp;#039;) {&lt;br /&gt;
            this.events[name].push(listener.bind(this.context));&lt;br /&gt;
        } else if (&lt;br /&gt;
            typeof listener === &amp;#039;string&amp;#039; &amp;amp;&amp;amp;&lt;br /&gt;
            this.context &amp;amp;&amp;amp;&lt;br /&gt;
            typeof this.context[listener] === &amp;#039;function&amp;#039;&lt;br /&gt;
        ) {&lt;br /&gt;
            this.events[name].push(&lt;br /&gt;
                (this.context[listener]).bind(this.context)&lt;br /&gt;
            );&lt;br /&gt;
        }&lt;br /&gt;
        return this;&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Sets event handlers.&lt;br /&gt;
     * @param {Object} events Event handlers&lt;br /&gt;
     * @returns {Modal} Current instance&lt;br /&gt;
     */&lt;br /&gt;
    Modal.prototype.setEvents = function(events) {&lt;br /&gt;
        this.events = {};&lt;br /&gt;
        if (typeof events !== &amp;#039;object&amp;#039;) {&lt;br /&gt;
            return this;&lt;br /&gt;
        }&lt;br /&gt;
        for (var e in events) {&lt;br /&gt;
            if (events[e] instanceof Array) {&lt;br /&gt;
                for (var i = 0, l = e.length; i &amp;lt; l; ++i) {&lt;br /&gt;
                    this.setEvent(e, events[e][i]);&lt;br /&gt;
                }&lt;br /&gt;
            } else {&lt;br /&gt;
                this.setEvent(e, events[e]);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        return this;&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Sets the modal size.&lt;br /&gt;
     * @param {String} size Modal&amp;#039;s size&lt;br /&gt;
     * @see MODAL_SIZES&lt;br /&gt;
     * @returns {Modal} Current instance&lt;br /&gt;
     */&lt;br /&gt;
    Modal.prototype.setSize = function(size) {&lt;br /&gt;
        if (MODAL_SIZES.indexOf(size) === -1) {&lt;br /&gt;
            this.size = &amp;#039;medium&amp;#039;;&lt;br /&gt;
        } else if (size === &amp;#039;content-size&amp;#039;) {&lt;br /&gt;
            this.size = &amp;#039;full&amp;#039;;&lt;br /&gt;
        } else {&lt;br /&gt;
            this.size = size;&lt;br /&gt;
        }&lt;br /&gt;
        if (this._modal) {&lt;br /&gt;
            this._modal.setSize(this.size);&lt;br /&gt;
        }&lt;br /&gt;
        return this;&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Sets the modal title.&lt;br /&gt;
     * @param {String} title The modal&amp;#039;s title&lt;br /&gt;
     * @param {Boolean} isHTML Whether the modal&amp;#039;s title should be HTML&lt;br /&gt;
     * @returns {Modal} Current instance&lt;br /&gt;
     */&lt;br /&gt;
    Modal.prototype.setTitle = function(title, isHTML) {&lt;br /&gt;
        this.title = typeof title === &amp;#039;string&amp;#039; ?&lt;br /&gt;
            title :&lt;br /&gt;
            &amp;#039;Modal&amp;#039;;&lt;br /&gt;
        this.titleIsHTML = Boolean(isHTML);&lt;br /&gt;
        if (this._modal &amp;amp;&amp;amp; !isHTML) {&lt;br /&gt;
            this._modal.$head&lt;br /&gt;
                .find(&amp;#039;.oo-ui-processDialog-title&amp;#039;)&lt;br /&gt;
                .text(title);&lt;br /&gt;
        }&lt;br /&gt;
        return this;&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Creates a modal component.&lt;br /&gt;
     * @returns {$.Deferred} Promise to wait on for the modal to get created&lt;br /&gt;
     */&lt;br /&gt;
    Modal.prototype.create = function() {&lt;br /&gt;
        this._loading = new $.Deferred();&lt;br /&gt;
        var OOUIModal = function(config) {&lt;br /&gt;
            this._modal = config.modal;&lt;br /&gt;
            delete config.modal;&lt;br /&gt;
            OOUIModal.super.call(this, config);&lt;br /&gt;
        };&lt;br /&gt;
        OO.inheritClass(OOUIModal, OO.ui.ProcessDialog);&lt;br /&gt;
        var superclass = OOUIModal.super.prototype;&lt;br /&gt;
        OOUIModal.static.name = this.id;&lt;br /&gt;
        OOUIModal.static.title = this.title;&lt;br /&gt;
        OOUIModal.static.actions = this.buttons.map(buttonComponent);&lt;br /&gt;
        OOUIModal.prototype.initialize = function() {&lt;br /&gt;
            superclass.initialize.apply(this, arguments);&lt;br /&gt;
            if (this._modal.content instanceof OO.ui.Layout) {&lt;br /&gt;
                this.content = this._modal.content;&lt;br /&gt;
            } else {&lt;br /&gt;
                this.content = new OO.ui.PanelLayout({&lt;br /&gt;
                    expanded: false,&lt;br /&gt;
                    padded: false&lt;br /&gt;
                });&lt;br /&gt;
            }&lt;br /&gt;
            this.content.$element.append(this._modal.content);&lt;br /&gt;
            this.$body.append(this.content.$element);&lt;br /&gt;
        };&lt;br /&gt;
        OOUIModal.prototype.getActionProcess = function(action) {&lt;br /&gt;
            var handlers = this._modal.events[action];&lt;br /&gt;
            if (action === &amp;#039;close&amp;#039;) {&lt;br /&gt;
                return new OO.ui.Process((function() {&lt;br /&gt;
                    this.close();&lt;br /&gt;
                }).bind(this));&lt;br /&gt;
            }&lt;br /&gt;
            if (this._modal.events[action]) {&lt;br /&gt;
                return new OO.ui.Process((function() {&lt;br /&gt;
                    handlers.forEach(function(handle) {&lt;br /&gt;
                        handle();&lt;br /&gt;
                    }, this);&lt;br /&gt;
                }).bind(this));&lt;br /&gt;
            }&lt;br /&gt;
            return superclass.getActionProcess.call(this, action);&lt;br /&gt;
        };&lt;br /&gt;
        this._modal = new OOUIModal({&lt;br /&gt;
            classes: this.classes,&lt;br /&gt;
            id: this.id,&lt;br /&gt;
            modal: this,&lt;br /&gt;
            size: this.size&lt;br /&gt;
        });&lt;br /&gt;
        module._windowManager.addWindows([this._modal]);&lt;br /&gt;
        /*&lt;br /&gt;
         * Close modal when clicked outside of the modal&lt;br /&gt;
         * (by [[User:Noreplyz]] for [[WHAM]]).&lt;br /&gt;
         */&lt;br /&gt;
        this._modal.$frame.parent().prepend(&amp;#039;&amp;lt;div class=&amp;quot;oo-ui-window-backdrop&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;);&lt;br /&gt;
        this._modal.$frame.prev().click((function(event) {&lt;br /&gt;
            if ($(event.target).parent().attr(&amp;#039;id&amp;#039;) === this.id) {&lt;br /&gt;
                this._modal.close();&lt;br /&gt;
            }&lt;br /&gt;
        }).bind(this));&lt;br /&gt;
        this._loading.resolve(this);&lt;br /&gt;
        return this._loading;&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Modal closing handler.&lt;br /&gt;
     * @returns {Boolean} Whether the modal should close&lt;br /&gt;
     * @private&lt;br /&gt;
     */&lt;br /&gt;
    Modal.prototype._close = function() {&lt;br /&gt;
        this._modal = null;&lt;br /&gt;
        this.create();&lt;br /&gt;
        /*&lt;br /&gt;
         * This is a hack around the bug with scrollbar not restoring&lt;br /&gt;
         * upon closing the modal. Modal that should&lt;br /&gt;
         * automatically do this assumes that, when the .modal-blackout&lt;br /&gt;
         * class is present in the document, a modal is still showing&lt;br /&gt;
         * and the scrollbar needs not be removed. However, due to Modal&amp;#039;s&lt;br /&gt;
         * caching behavior, this is no longer true and we have to&lt;br /&gt;
         * supply our own implementation of the code that restores the&lt;br /&gt;
         * scrollbar, as seen below.&lt;br /&gt;
         */&lt;br /&gt;
        if ($(&amp;#039;body&amp;#039;).children(&amp;#039;.modal-blackout.visible&amp;#039;).length) {&lt;br /&gt;
            $(&amp;#039;body&amp;#039;).removeClass(&amp;#039;with-blackout&amp;#039;);&lt;br /&gt;
            $(&amp;#039;.WikiaSiteWrapper&amp;#039;)&lt;br /&gt;
                .removeClass(&amp;#039;fake-scrollbar&amp;#039;)&lt;br /&gt;
                .css(&amp;#039;top&amp;#039;, &amp;#039;auto&amp;#039;);&lt;br /&gt;
            $(window).scrollTop(this.wScrollTop);&lt;br /&gt;
        }&lt;br /&gt;
        if (this.closeFunc) {&lt;br /&gt;
            return this.closeFunc.bind(this.context)();&lt;br /&gt;
        }&lt;br /&gt;
        return true;&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Callback after the modal has been created.&lt;br /&gt;
     * @param {wikia.ui.factory.Modal} modal Created modal&lt;br /&gt;
     * @private&lt;br /&gt;
     */&lt;br /&gt;
    Modal.prototype._created = function(modal) {&lt;br /&gt;
        this._modal = modal;&lt;br /&gt;
        for (var e in this.events) {&lt;br /&gt;
            for (var i = 0, l = this.events[e].length; i &amp;lt; l; ++i) {&lt;br /&gt;
                modal.bind(e, this.events[e][i]);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        this._loading.resolve(this);&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Shows the modal.&lt;br /&gt;
     */&lt;br /&gt;
    Modal.prototype.show = function() {&lt;br /&gt;
        this.wScrollTop = $(window).scrollTop();&lt;br /&gt;
        if (this._modal) {&lt;br /&gt;
            module._windowManager.openWindow(this._modal);&lt;br /&gt;
        } else if (this._loading) {&lt;br /&gt;
            this._loading.then((function() {&lt;br /&gt;
                this._modal.show();&lt;br /&gt;
            }).bind(this));&lt;br /&gt;
        } else {&lt;br /&gt;
            throw new Error(&amp;#039;Modal not created!&amp;#039;);&lt;br /&gt;
        }&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Proxy certain methods to the modal component.&lt;br /&gt;
     */&lt;br /&gt;
    [&amp;#039;activate&amp;#039;, &amp;#039;deactivate&amp;#039;].forEach(function(method) {&lt;br /&gt;
        Modal.prototype[method] = function() {&lt;br /&gt;
            return; // Not supported&lt;br /&gt;
        };&lt;br /&gt;
    });&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Closes the modal&lt;br /&gt;
     */&lt;br /&gt;
    Modal.prototype.close = function() {&lt;br /&gt;
        if (this._modal) {&lt;br /&gt;
            this._modal.close();&lt;br /&gt;
        } else {&lt;br /&gt;
            throw new Error(&amp;#039;Modal not created!&amp;#039;);&lt;br /&gt;
        }&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Closes the modal&lt;br /&gt;
     */&lt;br /&gt;
    Modal.prototype.hide = Modal.prototype.close;&lt;br /&gt;
&lt;br /&gt;
    // Prepare exports.&lt;br /&gt;
    module.Modal = Modal;&lt;br /&gt;
    module.ModalButton = ModalButton;&lt;br /&gt;
    module._init = init;&lt;br /&gt;
    window.dev.modal = module;&lt;br /&gt;
    // This must be done before wikia.ui.modal is loaded in chat&lt;br /&gt;
    if (typeof $.msg !== &amp;#039;function&amp;#039;) {&lt;br /&gt;
        $.msg = function() {&lt;br /&gt;
            return mw.message.call(this, arguments).text();&lt;br /&gt;
        };&lt;br /&gt;
    }&lt;br /&gt;
    // Begin initialization.&lt;br /&gt;
    mw.loader.using([&amp;#039;oojs-ui-windows&amp;#039;]).then(init);&lt;br /&gt;
})();&lt;/div&gt;</summary>
		<author><name>Mikevoir</name></author>
	</entry>
</feed>