mirror of
https://github.com/wisemapping/wisemapping-open-source.git
synced 2025-04-07 13:34:30 +08:00
46 lines
778 B
JavaScript
46 lines
778 B
JavaScript
|
/*
|
||
|
---
|
||
|
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('input[type=button]', {
|
||
|
events: {
|
||
|
click: this.close.bind(this)
|
||
|
},
|
||
|
value: 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()
|
||
|
});
|
||
|
|
||
|
}
|
||
|
});
|
||
|
|