Skip to content

Commit

Permalink
v2.30 - added onBlock callback (per request)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike authored and Mike committed Jan 6, 2010
1 parent a1c8e4c commit 7beae56
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions jquery.blockUI.js
@@ -1,6 +1,6 @@
/*!
* jQuery blockUI plugin
* Version 2.29 (10-DEC-2009)
* Version 2.30 (06-JAN-2010)
* @requires jQuery v1.2.3 or later
*
* Examples at: http://malsup.com/jquery/block/
Expand All @@ -21,6 +21,8 @@ if (/1\.(0|1|2)\.(0|1|2)/.test($.fn.jquery) || /^1.1/.test($.fn.jquery)) {

$.fn._fadeIn = $.fn.fadeIn;

var noOp = function() {};

// this bit is to ensure we don't call setExpression when we shouldn't (with extra muscle to handle
// retarded userAgent strings on Vista)
var mode = document.documentMode || 0;
Expand Down Expand Up @@ -63,7 +65,7 @@ $.fn.unblock = function(opts) {
});
};

$.blockUI.version = 2.29; // 2nd generation blocking at no extra cost!
$.blockUI.version = 2.30; // 2nd generation blocking at no extra cost!

// override these in your code to change the default behavior and style
$.blockUI.defaults = {
Expand Down Expand Up @@ -164,6 +166,9 @@ $.blockUI.defaults = {

// suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity)
applyPlatformOpacityRules: true,

// callback method invoked when fadeIn has completed and blocking message is visible
onBlock: null,

// callback method invoked when unblocking has completed; the callback is
// passed the element that has been unblocked (which is the window object for page
Expand Down Expand Up @@ -316,10 +321,13 @@ function install(el, opts) {
if (($.browser.msie || opts.forceIframe) && opts.showOverlay)
lyr1.show(); // opacity is zero
if (opts.fadeIn) {
var cb = opts.onBlock ? opts.onBlock : noOp;
var cb1 = (opts.showOverlay && !msg) ? cb : noOp;
var cb2 = msg ? cb : noOp;
if (opts.showOverlay)
lyr2._fadeIn(opts.fadeIn);
lyr2._fadeIn(opts.fadeIn, cb1);
if (msg)
lyr3._fadeIn(opts.fadeIn);
lyr3._fadeIn(opts.fadeIn, cb2);
}
else {
if (opts.showOverlay)
Expand Down

0 comments on commit 7beae56

Please sign in to comment.