Here's a new plugin which could be useful for some projects.
It calls the prompt(), alert() and confirm() of the browser, that's why it can't be have the same look.
For now, there's none ID parameter that can be assigned to each dialogs (especially for confirm & input dialogs), I'm working on it but you can use variables instead.
Dialog Box
Version: 1.0 (10th December 2011).
Tried in Internet Explorer 9.0.3 / Opera 11.51 / Chrome 15.0.874 / Safari 5.1.2 (Is Cancel button clicked condition doesn't work since 5.1+) / Firefox 8.0 / Mobile Safari (iOS 4)
Download DialogBox.rar
ACTIONS.
DIALOGS TYPE.
Open an alert dialog(message)? Open an alert dialog. OK button
Open an input dialog(message, input by default) ? Open an input dialog. OK & Cancel buttons.
Open a confirm dialog(message) ? Open a confirmation dialog. OK & Cancel buttons.
CONDITIONS.
CONFIRM DIALOG.
is OK button clicked ? Return true when the user clicked on OK button in the Confirm dialog.
is Cancel button clicked ? Return true when the user clicked on Cancel button in the Confirm dialog.
INPUT DIALOG.
is OK button clicked ? Return true when the user clicked on OK button in the Input dialog.
is Cancel button clicked ? Return true when the user clicked on Cancel button in the Input dialog. Doesn't work in Safari 5.1+
is Input is empty ? Return true if the user doesn't input anything in the Input dialog.
EXPRESSIONS.
TEXT.
getInputText? Return the text that the user wrote in the Input dialog.
TODO List for this plugin.
- Add ID to confirm and input dialogs.
- Add customized non-system dialogs.
- Try to solve the isCancelButtonClicked issue with Safari 5.1+.
- A french version.
Let me know your suggestions, requests and corrections (as about language) as well as any bug report.
Enjoy