Bez popisu
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

blockUI.js 20KB

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