PageSourceSearch

https://emfa49.fr/wp-content/plugins/jigoshop/assets/js/blockui.js?ver=6.9.9

js emfa49.fr collected 2026-10-03 02:47:00 UTC 18,915 bytes, 587 lines download raw bytes

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

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.