diff options
Diffstat (limited to 'pyload/webui/themes/Default/lib/MooTools/MooDialog/MooDialog.Alert.js')
-rw-r--r-- | pyload/webui/themes/Default/lib/MooTools/MooDialog/MooDialog.Alert.js | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/pyload/webui/themes/Default/lib/MooTools/MooDialog/MooDialog.Alert.js b/pyload/webui/themes/Default/lib/MooTools/MooDialog/MooDialog.Alert.js new file mode 100644 index 000000000..1e2d4180b --- /dev/null +++ b/pyload/webui/themes/Default/lib/MooTools/MooDialog/MooDialog.Alert.js @@ -0,0 +1,45 @@ +/* +--- +name: MooDialog.Alert +description: Creates an Alert dialog +authors: Arian Stolwijk +license: MIT-style license +requires: MooDialog +provides: MooDialog.Alert +... +*/ + + +MooDialog.Alert = new Class({ + + Extends: MooDialog, + + options: { + okText: 'Ok', + focus: true, + textPClass: 'MooDialogAlert' + }, + + initialize: function(msg, options){ + this.parent(options); + + var okButton = new Element('button', { + events: { + click: this.close.bind(this) + }, + text: this.options.okText + }); + + this.setContent( + new Element('p.' + this.options.textPClass, {text: msg}), + new Element('div.buttons').adopt(okButton) + ); + if (this.options.autoOpen) this.open(); + + if (this.options.focus) this.addEvent('show', function(){ + okButton.focus() + }); + + } +}); + |