ArtDialog prompt box, dialog box, artdialog dialog box

Source: Internet
Author: User

ArtDialog prompt box, dialog box, artdialog dialog box
/**
* Warning
* @ Param {String} message content
*/
ArtDialog. alert = function (content, callback ){
Return artDialog ({
Id: 'alert ',
Icon: 'warning ',
Fixed: true,
// Lock: true,
Width: 250,
Height: 50,
Content: content,
OK: true,
Close: callback
});
};




/**
* Confirm
* @ Param {String} message content
* @ Param {Function}: Click OK to call back the Function.
* @ Param {Function} cancels the button callback Function
*/
ArtDialog. confirm = function (content, yes, no ){
Return artDialog ({
Id: 'Confirm ',
Icon: 'Question ',
Fixed: true,
// Lock: true,
Opacity:. 1,
Width: 250,
Height: 50,
Content: content,
OK: function (here ){
Return yes. call (this, here );
},
Cancel: function (here ){
Return no & no. call (this, here );
}
});
};




/**
* Question
* @ Param {String} Question content
* @ Param {Function} callback Function. Receiving parameter: input value
* @ Param {String} Default Value
*/
ArtDialog. prompt = function (content, yes, value ){
Value = value | '';
Var input;

Return artDialog ({
Id: 'mpt ',
Icon: 'Question ',
Fixed: true,
// Lock: true,
Width: 250,
Height: 50,
Opacity:. 1,
Content :[
'<Div style = "margin-bottom: 5px; font-size: 12px"> ',
Content,
'</Div> ',
'<Div> ',
'<Input value = "',
Value,
'"Style =" width: 18em; padding: 6px 4px "/> ',
'</Div>'
]. Join (''),
Init: function (){
Input = this. DOM. content. find ('input') [0];
Input. select ();
Input. focus ();
},
OK: function (here ){
Return yes & yes. call (this, input. value, here );
},
Cancel: true
});
};




/**
* Short Message
* @ Param {String} content
* @ Param {Number} display time (1.5 seconds by default)
*/
ArtDialog. tips = function (content, time ){
Return artDialog ({
Id: 'tids ',
Title: false,
Cancel: false,
Fixed: true,
// Lock: true,
Width: 250,
Height: 50
})
. Content ('<div style = "padding: 0 1em;">' + content + '</div> ')
. Time (time | 1 );
};


// Sliding notification in the lower right corner
ArtDialog. notice = function (options ){
Var opt = options | | {},
Api, aConfig, hide, wrap, top,
Duration= 800;

Var config = {
Id: 'notice ',
Left: '20140901 ',
Top: '123 ',
Fixed: true,
Drag: false,
Width: 250,
Height: 50,
Resize: false,
Follow: null,
Lock: false,
Init: function (here ){
Api = this;
AConfig = api. config;
Wrap = api. DOM. wrap;
Top = parseInt (wrap [0]. style. top );
Hide = top + wrap [0]. offsetHeight;

Wrap.css ('top', hide + 'px ')
. Animate ({top: top + 'px '}, duration, function (){
Opt. init & opt. init. call (api, here );
});
},
Close: function (here ){
Wrap. animate ({top: hide + 'px '}, duration, function (){
Opt. close & opt. close. call (this, here );
AConfig. close = $. noop;
Api. close ();
});

Return false;
}
};

For (var I in opt ){
If (config [I] === undefined) config [I] = opt [I];
};

Return artDialog (config );
};


// Call example:
Art. dialog. alert ('the character is getting less and less stable. Please check it! ');


Art. dialog. confirm ('Are you sure you want to delete this message? ', Function (){
Art. dialog. tips ('execute the confirm operation ');
}, Function (){
Art. dialog. tips ('cancel the Action ');
});


Art. dialog. prompt ('Enter the image URL ', function (val ){
Art. dialog. tips (val );
}, 'HTTP ://');




Art. dialog. tips ('data is being submitted... ', 2 );
// [More code...]
Art. dialog. tips ('success! Saved on server ');

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.