jquery.blockUI.js 20 KB

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