1/*! 2 * jQuery blockUI plugin 3 * Version 2.42 (11-MAY-2012) 4 * @requires jQuery v1.2.3 or later 5 * 6 * Examples at: http://malsup.com/jquery/block/ 7 * Copyright (c) 2007-2010 M. Alsup 8 * Dual licensed under the MIT and GPL licenses: 9 * http://www.opensource.org/licenses/mit-license.php 10 * http://www.gnu.org/licenses/gpl.html 11 * 12 * Thanks to Amir-Hossein Sobhi for some excellent contributions! 13 */ 14 15;(function() { 16 17 function setup($) { 18 /*if (/1\.(0|1|2)\.(0|1|2)/.test($.fn.jquery) || /^1.1/.test($.fn.jquery)) { 19 alert('blockUI requires jQuery v1.2.3 or later! You are using v' + $.fn.jquery); 20 return; 21 }*/ 22 23 $.fn._fadeIn = $.fn.fadeIn; 24 25 var noOp = function() {}; 26 27 // this bit is to ensure we don't call setExpression when we shouldn't (with extra muscle to handle 28 // retarded userAgent strings on Vista) 29 var mode = document.documentMode || 0; 30 var setExpr = $.browser.msie && (($.browser.version < 8 && !mode) || mode < 8); 31 var ie6 = $.browser.msie && /MSIE 6.0/.test(navigator.userAgent) && !mode; 32 33 // global $ methods for blocking/unblocking the entire page 34 $.blockUI = function(opts) { install(window, opts); }; 35 $.unblockUI = function(opts) { remove(window, opts); }; 36 37 // convenience method for quick growl-like notifications (http://www.google.com/search?q=growl) 38 $.growlUI = function(title, message, timeout, onClose) { 39 var $m = $('<div class="growlUI"></div>'); 40 if (title) $m.append('<h1>'+title+'</h1>'); 41 if (message) $m.append('<h2>'+message+'</h2>'); 42 if (timeout == undefined) timeout = 3000; 43 $.blockUI({ 44 message: $m, fadeIn: 700, fadeOut: 1000, centerY: false, 45 timeout: timeout, showOverlay: false, 46 onUnblock: onClose, 47 css: $.blockUI.defaults.growlCSS 48 }); 49 }; 50 51 // plugin method for blocking element content 52 $.fn.block = function(opts) { 53 var fullOpts = $.extend({}, $.blockUI.defaults, opts || {}); 54 this.each(function() { 55 var $el = $(this); 56 if (fullOpts.ignoreIfBlocked && $el.data('blockUI.isBlocked')) 57 return; 58 $el.unblock({ fadeOut: 0 }); 59 }); 60 61 return this.each(function() { 62 if ($.css(this,'position') == 'static') 63 this.style.position = 'relative'; 64 if ($.browser.msie) 65 this.style.zoom = 1; // force 'hasLayout' 66 install(this, opts); 67 }); 68 }; 69 70 // plugin method for unblocking element content 71 $.fn.unblock = function(opts) { 72 return this.each(function() { 73 remove(this, opts); 74 }); 75 }; 76 77 $.blockUI.version = 2.42; // 2nd generation blocking at no extra cost! 78 79 // override these in your code to change the default behavior and style 80 $.blockUI.defaults = { 81 // message displayed when blocking (use null for no message) 82 message: '<h1>Please wait...</h1>', 83 84 title: null, // title string; only used when theme == true 85 draggable: true, // only used when theme == true (requires jquery-ui.js to be loaded) 86 87 theme: false, // set to true to use with jQuery UI themes 88 89 // styles for the message when blocking; if you wish to disable 90 // these and use an external stylesheet then do this in your code: 91 // $.blockUI.defaults.css = {}; 92 css: { 93 padding: 0, 94 margin: 0, 95 width: '30%', 96 top: '40%', 97 left: '35%', 98 textAlign: 'center', 99 color: '#000', 100 border: '3px solid #aaa', 101 backgroundColor:'#fff', 102 cursor: 'wait' 103 }, 104 105 // minimal style set used when themes are used 106 themedCSS: { 107 width: '30%', 108 top: '40%', 109 left: '35%' 110 }, 111 112 // styles for the overlay 113 overlayCSS: { 114 backgroundColor: '#000', 115 opacity: 0.6, 116 cursor: 'wait' 117 }, 118 119 // styles applied when using $.growlUI 120 growlCSS: { 121 width: '350px', 122 top: '10px', 123 left: '', 124 right: '10px', 125 border: 'none', 126 padding: '5px', 127 opacity: 0.6, 128 cursor: 'default', 129 color: '#fff', 130 backgroundColor: '#000', 131 '-webkit-border-radius': '10px', 132 '-moz-border-radius': '10px', 133 'border-radius': '10px' 134 }, 135 136 // IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w 137 // (hat tip to Jorge H. N. de Vasconcelos) 138 iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank', 139 140 // force usage of iframe in non-IE browsers (handy for blocking applets) 141 forceIframe: false, 142 143 // z-index for the blocking overlay 144 baseZ: 1000, 145 146 // set these to true to have the message automatically centered 147 centerX: true, // <-- only effects element blocking (page block controlled via css above) 148 centerY: true, 149 150 // allow body element to be stetched in ie6; this makes blocking look better 151 // on "short" pages. disable if you wish to prevent changes to the body height 152 allowBodyStretch: true, 153 154 // enable if you want key and mouse events to be disabled for content that is blocked 155 bindEvents: true, 156 157 // be default blockUI will supress tab navigation from leaving blocking content 158 // (if bindEvents is true) 159 constrainTabKey: true, 160 161 // fadeIn time in millis; set to 0 to disable fadeIn on block 162 fadeIn: 200, 163 164 // fadeOut time in millis; set to 0 to disable fadeOut on unblock 165 fadeOut: 400, 166 167 // time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock 168 timeout: 0, 169 170 // disable if you don't want to show the overlay 171 showOverlay: true, 172 173 // if true, focus will be placed in the first available input field when 174 // page blocking 175 focusInput: true, 176 177 // suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity) 178 applyPlatformOpacityRules: true, 179 180 // callback method invoked when fadeIn has completed and blocking message is visible 181 onBlock: null, 182 183 // callback method invoked when unblocking has completed; the callback is 184 // passed the element that has been unblocked (which is the window object for page 185 // blocks) and the options that were passed to the unblock call: 186 // onUnblock(element, options) 187 onUnblock: null, 188 189 // don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493
190 quirksmodeOffsetHack: 4, 191 192 // class name of the message block 193 blockMsgClass: 'blockMsg', 194 195 // if it is already blocked, then ignore it (don't unblock and reblock) 196 ignoreIfBlocked: false 197 }; 198 199 // private data and functions follow... 200 201 var pageBlock = null; 202 var pageBlockEls = []; 203 204 function install(el, opts) { 205 var css, themedCSS; 206 var full = (el == window); 207 var msg = (opts && opts.message !== undefined ? opts.message : undefined); 208 opts = $.extend({}, $.blockUI.defaults, opts || {}); 209 210 if (opts.ignoreIfBlocked && $(el).data('blockUI.isBlocked')) 211 return; 212 213 opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {}); 214 css = $.extend({}, $.blockUI.defaults.css, opts.css || {}); 215 themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {}); 216 msg = msg === undefined ? opts.message : msg; 217 218 // remove the current block (if there is one) 219 if (full && pageBlock) 220 remove(window, {fadeOut:0}); 221 222 // if an existing element is being used as the blocking content then we capture 223 // its current place in the DOM (and current display style) so we can restore 224 // it when we unblock 225 if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) { 226 var node = msg.jquery ? msg[0] : msg; 227 var data = {}; 228 $(el).data('blockUI.history', data); 229 data.el = node; 230 data.parent = node.parentNode; 231 data.display = node.style.display; 232 data.position = node.style.position; 233 if (data.parent) 234 data.parent.removeChild(node); 235 } 236 237 $(el).data('blockUI.onUnblock', opts.onUnblock); 238 var z = opts.baseZ; 239 240 // blockUI uses 3 layers for blocking, for simplicity they are all used on every platform; 241 // layer1 is the iframe layer which is used to supress bleed through of underlying content 242 // layer2 is the overlay layer which has opacity and a wait cursor (by default) 243 // layer3 is the message content that is displayed while blocking 244 245 var lyr1 = ($.browser.msie || opts.forceIframe) 246 ? $('<iframe class="blockUI" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+opts.iframeSrc+'"></iframe>') 247 : $('<div class="blockUI" style="display:none"></div>'); 248 249 var lyr2 = opts.theme 250 ? $('<div class="blockUI blockOverlay ui-widget-overlay" style="z-index:'+ (z++) +';display:none"></div>') 251 : $('<div class="blockUI blockOverlay" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>'); 252 253 var lyr3, s; 254 if (opts.theme && full) { 255 s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+(z+10)+';display:none;position:fixed">' + 256 '<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || ' ')+'</div>' + 257 '<div class="ui-widget-content ui-dialog-content"></div>' + 258 '</div>'; 259 } 260 else if (opts.theme) { 261 s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement ui-dialog ui-widget ui-corner-all" style="z-index:'+(z+10)+';display:none;position:absolute">' + 262 '<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || ' ')+'</div>' + 263 '<div class="ui-widget-content ui-dialog-content"></div>' + 264 '</div>'; 265 } 266 else if (full) { 267 s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage" style="z-index:'+(z+10)+';display:none;position:fixed"></div>'; 268 } 269 else { 270 s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement" style="z-index:'+(z+10)+';display:none;position:absolute"></div>'; 271 } 272 lyr3 = $(s); 273 274 // if we have a message, style it 275 if (msg) { 276 if (opts.theme) { 277 lyr3.css(themedCSS); 278 lyr3.addClass('ui-widget-content'); 279 } 280 else 281 lyr3.css(css); 282 } 283 284 // style the overlay 285 if (!opts.theme && (!opts.applyPlatformOpacityRules || !($.browser.mozilla && /Linux/.test(navigator.platform)))) 286 lyr2.css(opts.overlayCSS); 287 lyr2.css('position', full ? 'fixed' : 'absolute'); 288 289 // make iframe layer transparent in IE 290 if ($.browser.msie || opts.forceIframe) 291 lyr1.css('opacity',0.0); 292 293 //$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el); 294 var layers = [lyr1,lyr2,lyr3], $par = full ? $('body') : $(el); 295 $.each(layers, function() { 296 this.appendTo($par); 297 }); 298 299 if (opts.theme && opts.draggable && $.fn.draggable) { 300 lyr3.draggable({ 301 handle: '.ui-dialog-titlebar', 302 cancel: 'li' 303 }); 304 } 305 306 // ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling) 307 var expr = setExpr && (!$.boxModel || $('object,embed', full ? null : el).length > 0); 308 if (ie6 || expr) { 309 // give body 100% height 310 if (full && opts.allowBodyStretch && $.boxModel) 311 $('html,body').css('height','100%'); 312 313 // fix ie6 issue when blocked element has a border width 314 if ((ie6 || !$.boxModel) && !full) { 315 var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth'); 316 var fixT = t ? '(0 - '+t+')' : 0; 317 var fixL = l ? '(0 - '+l+')' : 0; 318 } 319 320 // simulate fixed position 321 $.each([lyr1,lyr2,lyr3], function(i,o) { 322 var s = o[0].style; 323 s.position = 'absolute'; 324 if (i < 2) { 325 full ? s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:'+opts.quir
325ksmodeOffsetHack+') + "px"') 326 : s.setExpression('height','this.parentNode.offsetHeight + "px"'); 327 full ? s.setExpression('width','jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"') 328 : s.setExpression('width','this.parentNode.offsetWidth + "px"'); 329 if (fixL) s.setExpression('left', fixL); 330 if (fixT) s.setExpression('top', fixT); 331 } 332 else if (opts.centerY) { 333 if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"'); 334 s.marginTop = 0; 335 } 336 else if (!opts.centerY && full) { 337 var top = (opts.css && opts.css.top) ? parseInt(opts.css.top) : 0; 338 var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"'; 339 s.setExpression('top',expression); 340 } 341 }); 342 } 343 344 // show the message 345 if (msg) { 346 if (opts.theme) 347 lyr3.find('.ui-widget-content').append(msg); 348 else 349 lyr3.append(msg); 350 if (msg.jquery || msg.nodeType) 351 $(msg).show(); 352 } 353 354 if (($.browser.msie || opts.forceIframe) && opts.showOverlay) 355 lyr1.show(); // opacity is zero 356 if (opts.fadeIn) { 357 var cb = opts.onBlock ? opts.onBlock : noOp; 358 var cb1 = (opts.showOverlay && !msg) ? cb : noOp; 359 var cb2 = msg ? cb : noOp; 360 if (opts.showOverlay) 361 lyr2._fadeIn(opts.fadeIn, cb1); 362 if (msg) 363 lyr3._fadeIn(opts.fadeIn, cb2); 364 } 365 else { 366 if (opts.showOverlay) 367 lyr2.show(); 368 if (msg) 369 lyr3.show(); 370 if (opts.onBlock) 371 opts.onBlock(); 372 } 373 374 // bind key and mouse events 375 bind(1, el, opts); 376 377 if (full) { 378 pageBlock = lyr3[0]; 379 pageBlockEls = $(':input:enabled:visible',pageBlock); 380 if (opts.focusInput) 381 setTimeout(focus, 20); 382 } 383 else 384 center(lyr3[0], opts.centerX, opts.centerY); 385 386 if (opts.timeout) { 387 // auto-unblock 388 var to = setTimeout(function() { 389 full ? $.unblockUI(opts) : $(el).unblock(opts); 390 }, opts.timeout); 391 $(el).data('blockUI.timeout', to); 392 } 393 }; 394 395 // remove the block 396 function remove(el, opts) { 397 var full = (el == window); 398 var $el = $(el); 399 var data = $el.data('blockUI.history'); 400 var to = $el.data('blockUI.timeout'); 401 if (to) { 402 clearTimeout(to); 403 $el.removeData('blockUI.timeout'); 404 } 405 opts = $.extend({}, $.blockUI.defaults, opts || {}); 406 bind(0, el, opts); // unbind events 407 408 if (opts.onUnblock === null) { 409 opts.onUnblock = $el.data('blockUI.onUnblock'); 410 $el.removeData('blockUI.onUnblock'); 411 } 412 413 var els; 414 if (full) // crazy selector to handle odd field errors in ie6/7 415 els = $('body').children().filter('.blockUI').add('body > .blockUI'); 416 else 417 els = $('.blockUI', el); 418 419 if (full) 420 pageBlock = pageBlockEls = null; 421 422 if (opts.fadeOut) { 423 els.fadeOut(opts.fadeOut); 424 setTimeout(function() { reset(els,data,opts,el); }, opts.fadeOut); 425 } 426 else 427 reset(els, data, opts, el); 428 }; 429 430 // move blocking element back into the DOM where it started 431 function reset(els,data,opts,el) { 432 els.each(function(i,o) { 433 // remove via DOM calls so we don't lose event handlers 434 if (this.parentNode) 435 this.parentNode.removeChild(this); 436 }); 437 438 if (data && data.el) { 439 data.el.style.display = data.display; 440 data.el.style.position = data.position; 441 if (data.parent) 442 data.parent.appendChild(data.el); 443 $(el).removeData('blockUI.history'); 444 } 445 446 if (typeof opts.onUnblock == 'function') 447 opts.onUnblock(el,opts); 448 }; 449 450 // bind/unbind the handler 451 function bind(b, el, opts) { 452 var full = el == window, $el = $(el); 453 454 // don't bother unbinding if there is nothing to unbind 455 if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked'))) 456 return; 457 458 $el.data('blockUI.isBlocked', b); 459 460 // don't bind events when overlay is not in use or if bindEvents is false 461 if (!opts.bindEvents || (b && !opts.showOverlay)) 462 return; 463
464 // bind anchors and inputs for mouse and key events 465 var events = 'mousedown mouseup keydown keypress'; 466 b ? $(document).bind(events, opts, handler) : $(document).unbind(events, handler); 467 468 // former impl... 469 // var $e = $('a,:input'); 470 // b ? $e.bind(events, opts, handler) : $e.unbind(events, handler); 471 }; 472 473 // event handler to suppress keyboard/mouse events when blocking 474 function handler(e) { 475 // allow tab navigation (conditionally) 476 if (e.keyCode && e.keyCode == 9) { 477 if (pageBlock && e.data.constrainTabKey) { 478 var els = pageBlockEls; 479 var fwd = !e.shiftKey && e.target === els[els.length-1]; 480 var back = e.shiftKey && e.target === els[0]; 481 if (fwd || back) { 482 setTimeout(function(){focus(back)},10); 483 return false; 484 } 485 } 486 } 487 var opts = e.data; 488 // allow events within the message content 489 if ($(e.target).parents('div.' + opts.blockMsgClass).length > 0) 490 return true; 491 492 // allow events for content that is not being blocked 493 return $(e.target).parents().children().filter('div.blockUI').length == 0; 494 }; 495 496 function focus(back) { 497 if (!pageBlockEls) 498 return; 499 var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0]; 500 if (e) 501 e.focus(); 502 }; 503 504 function center(el, x, y) { 505 var p = el.parentNode, s = el.style; 506 var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth'); 507 var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth'); 508 if (x) s.left = l > 0 ? (l+'px') : '0'; 509 if (y) s.top = t > 0 ? (t+'px') : '0'; 510 }; 511 512 function sz(el, p) { 513 return parseInt($.css(el,p))||0; 514 }; 515 516 }; 517 518 519 if (typeof define === 'function' && define.amd && define.amd.jQuery) { 520 define(['jquery'], setup); 521 } else { 522 setup(jQuery); 523 } 524 525})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.