PageSourceSearch

https://www.deruedas.com.ar/scripts/blockUI/blockui_2024.js

js deruedas.com.ar collected 2026-10-01 16:36:54 UTC 20,881 bytes, 514 lines download raw bytes

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

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.