Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Item14228: upgrade to blockui 2.70
  • Loading branch information
MichaelDaum committed Nov 22, 2016
1 parent 61d5df6 commit 1bbb91f
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 18 deletions.
2 changes: 1 addition & 1 deletion JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin/BLOCKUI.pm
Expand Up @@ -28,7 +28,7 @@ sub new {
my $this = bless(
$class->SUPER::new(
name => 'blockUI',
version => '2.59',
version => '2.70',
author => 'M. Alsup',
homepage => 'http://malsup.com/jquery/block/',
css => ['jquery.blockUI.css'],
Expand Down
@@ -1,7 +1,7 @@
/*!
* jQuery blockUI plugin
* Version 2.59.0-2013.04.05
* @requires jQuery v1.7 or later
* Version 2.70.0-2014.11.23
* Requires jQuery v1.7 or later
*
* Examples at: http://malsup.com/jquery/block/
* Copyright (c) 2007-2013 M. Alsup
Expand All @@ -22,7 +22,7 @@
var noOp = $.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)
// confusing userAgent strings on Vista)
var msie = /MSIE/.test(navigator.userAgent);
var ie6 = /MSIE 6.0/.test(navigator.userAgent) && ! /MSIE 8.0/.test(navigator.userAgent);
var mode = document.documentMode || 0;
Expand All @@ -38,12 +38,38 @@
if (title) $m.append('<h1>'+title+'</h1>');
if (message) $m.append('<h2>'+message+'</h2>');
if (timeout === undefined) timeout = 3000;
$.blockUI({
message: $m, fadeIn: 700, fadeOut: 1000, centerY: false,
timeout: timeout, showOverlay: false,
onUnblock: onClose,
css: $.blockUI.defaults.growlCSS

// Added by konapun: Set timeout to 30 seconds if this growl is moused over, like normal toast notifications
var callBlock = function(opts) {
opts = opts || {};

$.blockUI({
message: $m,
fadeIn : typeof opts.fadeIn !== 'undefined' ? opts.fadeIn : 700,
fadeOut: typeof opts.fadeOut !== 'undefined' ? opts.fadeOut : 1000,
timeout: typeof opts.timeout !== 'undefined' ? opts.timeout : timeout,
centerY: false,
showOverlay: false,
onUnblock: onClose,
css: $.blockUI.defaults.growlCSS
});
};

callBlock();
var nonmousedOpacity = $m.css('opacity');
$m.mouseover(function() {
callBlock({
fadeIn: 0,
timeout: 30000
});

var displayBlock = $('.blockMsg');
displayBlock.stop(); // cancel fadeout if it has started
displayBlock.fadeTo(300, 1); // make it easier to read the message by removing transparency
}).mouseout(function() {
$('.blockMsg').fadeOut(1000);
});
// End konapun additions
};

// plugin method for blocking element content
Expand Down Expand Up @@ -81,7 +107,7 @@
});
};

$.blockUI.version = 2.59; // 2nd generation blocking at no extra cost!
$.blockUI.version = 2.70; // 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 @@ -186,6 +212,9 @@
// page blocking
focusInput: true,

// elements that can receive focus
focusableElements: ':input:enabled:visible',

// suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity)
// no longer needed in 2012
// applyPlatformOpacityRules: true,
Expand Down Expand Up @@ -284,7 +313,7 @@
s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement ui-dialog ui-widget ui-corner-all" style="z-index:'+(z+10)+';display:none;position:absolute">';
if ( opts.title ) {
s += '<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || '&nbsp;')+'</div>';
}
}
s += '<div class="ui-widget-content ui-dialog-content"></div>';
s += '</div>';
}
Expand Down Expand Up @@ -397,21 +426,20 @@
if (msg)
lyr3.show();
if (opts.onBlock)
opts.onBlock();
opts.onBlock.bind(lyr3)();
}

// bind key and mouse events
bind(1, el, opts);

if (full) {
pageBlock = lyr3[0];
pageBlockEls = $(':input:enabled:visible',pageBlock);
pageBlockEls = $(opts.focusableElements,pageBlock);
if (opts.focusInput)
setTimeout(focus, 20);
}
else {
else
center(lyr3[0], opts.centerX, opts.centerY);
}

if (opts.timeout) {
// auto-unblock
Expand Down Expand Up @@ -463,7 +491,7 @@

if (opts.fadeOut) {
count = els.length;
els.fadeOut(opts.fadeOut, function() {
els.stop().fadeOut(opts.fadeOut, function() {
if ( --count === 0)
reset(els,data,opts,el);
});
Expand All @@ -475,6 +503,9 @@
// move blocking element back into the DOM where it started
function reset(els,data,opts,el) {
var $el = $(el);
if ( $el.data('blockUI.isBlocked') )
return;

els.each(function(i,o) {
// remove via DOM calls so we don't lose event handlers
if (this.parentNode)
Expand All @@ -484,6 +515,7 @@
if (data && data.el) {
data.el.style.display = data.display;
data.el.style.position = data.position;
data.el.style.cursor = 'default'; // #59
if (data.parent)
data.parent.appendChild(data.el);
$el.removeData('blockUI.history');
Expand Down Expand Up @@ -531,7 +563,7 @@
// event handler to suppress keyboard/mouse events when blocking
function handler(e) {
// allow tab navigation (conditionally)
if (e.keyCode && e.keyCode == 9) {
if (e.type === 'keydown' && e.keyCode && e.keyCode == 9) {
if (pageBlock && e.data.constrainTabKey) {
var els = pageBlockEls;
var fwd = !e.shiftKey && e.target === els[els.length-1];
Expand All @@ -545,7 +577,7 @@
var opts = e.data;
var target = $(e.target);
if (target.hasClass('blockOverlay') && opts.onOverlayClick)
opts.onOverlayClick();
opts.onOverlayClick(e);

// allow events within the message content
if (target.parents('div.' + opts.blockMsgClass).length > 0)
Expand Down

0 comments on commit 1bbb91f

Please sign in to comment.