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