jQuery Apprise

I contributed to the plugin. Well, sort of. While ago I was digging through my netvibes and found quite interesting jQuery plugin on WebAppers. It is a nice replacement for JavaScript alert/confirm pop-ups. It is lightweight, has its own CSS file, so the appearance can be adjusted. Plugin has been developed and published by Daniel Raftery.

I found that text for buttons was hard-coded and therefore L10n was not supported. This particular problem has been resolved by adding extra options to the configuration. After while, I realized that these options have to be passed each time when plugin needs to be used. This was another opportunity to play around with the code and transform it into proper jQuery plugin.

What gives the transformation? Options can have default values, which can be overwritten (without repetition) once are made public. That also changes the way how the plugin is called, but the core functionality done by Daniel remains the same.

Sample usage

$("#element").click(function () {

    $(this).apprise('Lorem ipsum', { 'verify': true }, function (r) {
        if (r) {
            //do something here when confirmed / verified

    return false;

Overwrite the defaults

$.apprise.defaults.confirm =  false;   // Shows OK and Cancel buttons
$.apprise.defaults.verify = false; // Shows Yes and No buttons
$.apprise.defaults.input = false; // Returns with user inputed text
$.apprise.defaults.animate = false; // Groovy animation (can true or number, default is 400)
$.apprise.defaults.txtOK = 'OK'; // Text for OK
$.apprise.defaults.txtCanel = 'Cancel';// Text for Cancel
$.apprise.defaults.txtYes = 'Yes'; // Text for Yes
$.apprise.defaults.txtNo = 'No'; // Text for No

The final result of my conversion can be found on the bitbucket repository. Original version is available on the plugin home page.

For the record - full credit for the plugin goes to Daniel. 

Got some comments or something to say? Feel free to express your thoughts on twitter, facebook, your blog or somewhere else...