Proyectos de Subversion Moodle

Rev

Autoría | Ultima modificación | Ver Log |

{"version":3,"file":"dialogue.min.js","sources":["../src/dialogue.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Wrapper for the YUI M.core.notification class. Allows us to\n * use the YUI version in AMD code until it is replaced.\n *\n * @module     mod_customcert/dialogue\n * @copyright  2016 Mark Nelson <markn@moodle.com>\n * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['core/yui'], function(Y) {\n\n    /**\n     * Constructor\n     *\n     * @param {String} title Title for the window.\n     * @param {String} content The content for the window.\n     * @param {function} afterShow Callback executed after the window is opened.\n     * @param {function} afterHide Callback executed after the window is closed.\n     * @param {Boolean} wide Specify we want an extra wide dialogue (the size is standard, but wider than the default).\n     */\n    var dialogue = function(title, content, afterShow, afterHide, wide) {\n        this.yuiDialogue = null;\n        var parent = this;\n\n        // Default for wide is false.\n        if (typeof wide == 'undefined') {\n            wide = false;\n        }\n\n        Y.use('moodle-core-notification', 'timers', function() {\n            var width = '480px';\n            if (wide) {\n                width = '800px';\n            }\n\n            parent.yuiDialogue = new M.core.dialogue({\n                headerContent: title,\n                bodyContent: content,\n                draggable: true,\n                visible: false,\n                center: true,\n                modal: true,\n                width: width\n            });\n\n            parent.yuiDialogue.after('visibleChange', function(e) {\n                if (e.newVal) {\n                    // Delay the callback call to the next tick, otherwise it can happen that it is\n                    // executed before the dialogue constructor returns.\n                    if ((typeof afterShow !== 'undefined')) {\n                        Y.soon(function() {\n                            afterShow(parent);\n                            parent.yuiDialogue.centerDialogue();\n                        });\n                    }\n                } else {\n                    if ((typeof afterHide !== 'undefined')) {\n                        Y.soon(function() {\n                            afterHide(parent);\n                        });\n                    }\n                }\n            });\n\n            parent.yuiDialogue.show();\n        });\n    };\n\n    /**\n     * Close this window.\n     */\n    dialogue.prototype.close = function() {\n        this.yuiDialogue.hide();\n        this.yuiDialogue.destroy();\n    };\n\n    /**\n     * Get content.\n     *\n     * @returns {HTMLElement}\n     */\n    dialogue.prototype.getContent = function() {\n        return this.yuiDialogue.bodyNode.getDOMNode();\n    };\n\n    return dialogue;\n});\n"],"names":["define","Y","dialogue","title","content","afterShow","afterHide","wide","yuiDialogue","parent","this","use","width","M","core","headerContent","bodyContent","draggable","visible","center","modal","after","e","newVal","soon","centerDialogue","show","prototype","close","hide","destroy","getContent","bodyNode","getDOMNode"],"mappings":";;;;;;;;AAuBAA,iCAAO,CAAC,aAAa,SAASC,OAWtBC,SAAW,SAASC,MAAOC,QAASC,UAAWC,UAAWC,WACrDC,YAAc,SACfC,OAASC,UAGM,IAARH,OACPA,MAAO,GAGXN,EAAEU,IAAI,2BAA4B,UAAU,eACpCC,MAAQ,QACRL,OACAK,MAAQ,SAGZH,OAAOD,YAAc,IAAIK,EAAEC,KAAKZ,SAAS,CACrCa,cAAeZ,MACfa,YAAaZ,QACba,WAAW,EACXC,SAAS,EACTC,QAAQ,EACRC,OAAO,EACPR,MAAOA,QAGXH,OAAOD,YAAYa,MAAM,iBAAiB,SAASC,GAC3CA,EAAEC,YAGwB,IAAdlB,WACRJ,EAAEuB,MAAK,WACHnB,UAAUI,QACVA,OAAOD,YAAYiB,yBAID,IAAdnB,WACRL,EAAEuB,MAAK,WACHlB,UAAUG,cAM1BA,OAAOD,YAAYkB,kBAO3BxB,SAASyB,UAAUC,MAAQ,gBAClBpB,YAAYqB,YACZrB,YAAYsB,WAQrB5B,SAASyB,UAAUI,WAAa,kBACrBrB,KAAKF,YAAYwB,SAASC,cAG9B/B"}