Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 
 

204 строки
5.3 KiB

  1. /*!
  2. * jQuery UI 1.8
  3. *
  4. * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
  5. * Dual licensed under the MIT (MIT-LICENSE.txt)
  6. * and GPL (GPL-LICENSE.txt) licenses.
  7. *
  8. * http://docs.jquery.com/UI
  9. */
  10. ;jQuery.ui || (function($) {
  11. //Helper functions and ui object
  12. $.ui = {
  13. version: "1.8",
  14. // $.ui.plugin is deprecated. Use the proxy pattern instead.
  15. plugin: {
  16. add: function(module, option, set) {
  17. var proto = $.ui[module].prototype;
  18. for(var i in set) {
  19. proto.plugins[i] = proto.plugins[i] || [];
  20. proto.plugins[i].push([option, set[i]]);
  21. }
  22. },
  23. call: function(instance, name, args) {
  24. var set = instance.plugins[name];
  25. if(!set || !instance.element[0].parentNode) { return; }
  26. for (var i = 0; i < set.length; i++) {
  27. if (instance.options[set[i][0]]) {
  28. set[i][1].apply(instance.element, args);
  29. }
  30. }
  31. }
  32. },
  33. contains: function(a, b) {
  34. return document.compareDocumentPosition
  35. ? a.compareDocumentPosition(b) & 16
  36. : a !== b && a.contains(b);
  37. },
  38. hasScroll: function(el, a) {
  39. //If overflow is hidden, the element might have extra content, but the user wants to hide it
  40. if ($(el).css('overflow') == 'hidden') { return false; }
  41. var scroll = (a && a == 'left') ? 'scrollLeft' : 'scrollTop',
  42. has = false;
  43. if (el[scroll] > 0) { return true; }
  44. // TODO: determine which cases actually cause this to happen
  45. // if the element doesn't have the scroll set, see if it's possible to
  46. // set the scroll
  47. el[scroll] = 1;
  48. has = (el[scroll] > 0);
  49. el[scroll] = 0;
  50. return has;
  51. },
  52. isOverAxis: function(x, reference, size) {
  53. //Determines when x coordinate is over "b" element axis
  54. return (x > reference) && (x < (reference + size));
  55. },
  56. isOver: function(y, x, top, left, height, width) {
  57. //Determines when x, y coordinates is over "b" element
  58. return $.ui.isOverAxis(y, top, height) && $.ui.isOverAxis(x, left, width);
  59. },
  60. keyCode: {
  61. BACKSPACE: 8,
  62. CAPS_LOCK: 20,
  63. COMMA: 188,
  64. CONTROL: 17,
  65. DELETE: 46,
  66. DOWN: 40,
  67. END: 35,
  68. ENTER: 13,
  69. ESCAPE: 27,
  70. HOME: 36,
  71. INSERT: 45,
  72. LEFT: 37,
  73. NUMPAD_ADD: 107,
  74. NUMPAD_DECIMAL: 110,
  75. NUMPAD_DIVIDE: 111,
  76. NUMPAD_ENTER: 108,
  77. NUMPAD_MULTIPLY: 106,
  78. NUMPAD_SUBTRACT: 109,
  79. PAGE_DOWN: 34,
  80. PAGE_UP: 33,
  81. PERIOD: 190,
  82. RIGHT: 39,
  83. SHIFT: 16,
  84. SPACE: 32,
  85. TAB: 9,
  86. UP: 38
  87. }
  88. };
  89. //jQuery plugins
  90. $.fn.extend({
  91. _focus: $.fn.focus,
  92. focus: function(delay, fn) {
  93. return typeof delay === 'number'
  94. ? this.each(function() {
  95. var elem = this;
  96. setTimeout(function() {
  97. $(elem).focus();
  98. (fn && fn.call(elem));
  99. }, delay);
  100. })
  101. : this._focus.apply(this, arguments);
  102. },
  103. enableSelection: function() {
  104. return this
  105. .attr('unselectable', 'off')
  106. .css('MozUserSelect', '')
  107. .unbind('selectstart.ui');
  108. },
  109. disableSelection: function() {
  110. return this
  111. .attr('unselectable', 'on')
  112. .css('MozUserSelect', 'none')
  113. .bind('selectstart.ui', function() { return false; });
  114. },
  115. scrollParent: function() {
  116. var scrollParent;
  117. if(($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
  118. scrollParent = this.parents().filter(function() {
  119. return (/(relative|absolute|fixed)/).test($.curCSS(this,'position',1)) && (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
  120. }).eq(0);
  121. } else {
  122. scrollParent = this.parents().filter(function() {
  123. return (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
  124. }).eq(0);
  125. }
  126. return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent;
  127. },
  128. zIndex: function(zIndex) {
  129. if (zIndex !== undefined) {
  130. return this.css('zIndex', zIndex);
  131. }
  132. if (this.length) {
  133. var elem = $(this[0]), position, value;
  134. while (elem.length && elem[0] !== document) {
  135. // Ignore z-index if position is set to a value where z-index is ignored by the browser
  136. // This makes behavior of this function consistent across browsers
  137. // WebKit always returns auto if the element is positioned
  138. position = elem.css('position');
  139. if (position == 'absolute' || position == 'relative' || position == 'fixed')
  140. {
  141. // IE returns 0 when zIndex is not specified
  142. // other browsers return a string
  143. // we ignore the case of nested elements with an explicit value of 0
  144. // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
  145. value = parseInt(elem.css('zIndex'));
  146. if (!isNaN(value) && value != 0) {
  147. return value;
  148. }
  149. }
  150. elem = elem.parent();
  151. }
  152. }
  153. return 0;
  154. }
  155. });
  156. //Additional selectors
  157. $.extend($.expr[':'], {
  158. data: function(elem, i, match) {
  159. return !!$.data(elem, match[3]);
  160. },
  161. focusable: function(element) {
  162. var nodeName = element.nodeName.toLowerCase(),
  163. tabIndex = $.attr(element, 'tabindex');
  164. return (/input|select|textarea|button|object/.test(nodeName)
  165. ? !element.disabled
  166. : 'a' == nodeName || 'area' == nodeName
  167. ? element.href || !isNaN(tabIndex)
  168. : !isNaN(tabIndex))
  169. // the element and all of its ancestors must be visible
  170. // the browser may report that the area is hidden
  171. && !$(element)['area' == nodeName ? 'parents' : 'closest'](':hidden').length;
  172. },
  173. tabbable: function(element) {
  174. var tabIndex = $.attr(element, 'tabindex');
  175. return (isNaN(tabIndex) || tabIndex >= 0) && $(element).is(':focusable');
  176. }
  177. });
  178. })(jQuery);