Advertisement
Guest User

Untitled

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