PageSourceSearch

https://www.ashehabitat.org/wp-content/plugins/ultimate-auction/js/wdm-jquery.blockUI.js?ver=2.66.0-2013.10.09

js ashehabitat.org collected 2026-10-07 19:09:56 UTC 21,028 bytes, 700 lines download raw bytes

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

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.