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