Github
This repository
This repository
All repositories
Browse code

Fixed a bunch of endline issues.

  • Loading branch information...
commit dbee06de85859af59591813d3004e6695b8bb278 1 parent 967eec1
authored
612  src/dimensions/dimensions.js
... ... @@ -1,307 +1,307 @@
1   -/** 
2   - * This plugin overrides jQuery's height() and width() functions and
3   - * adds more handy stuff for cross-browser compatibility.
4   - */
5   -
6   -/**
7   - * Returns the css height value for the first matched element.
8   - * If used on document, returns the document's height (innerHeight)
9   - * If used on window, returns the viewport's (window) height
10   - *
11   - * @example $("#testdiv").height()
12   - * @result "200px"
13   - *
14   - * @example $(document).height();
15   - * @result 800
16   - *
17   - * @example $(window).height();
18   - * @result 400
19   - * 
20   - * @name height
21   - * @type Object
22   - * @cat Dimensions
23   - */
24   -jQuery.fn.height = function() {
25   -  if ( this.get(0) == window )
26   -    return self.innerHeight ||
27   -      jQuery.boxModel && document.documentElement.clientHeight ||
28   -      document.body.clientHeight;
29   -  
30   -  if ( this.get(0) == document )
31   -    return Math.max( document.body.scrollHeight, document.body.offsetHeight );
32   -  
33   -  return this.css("height");
34   -};
35   -
36   -/**
37   - * Returns the css width value for the first matched element.
38   - * If used on document, returns the document's width (innerWidth)
39   - * If used on window, returns the viewport's (window) width
40   - *
41   - * @example $("#testdiv").width()
42   - * @result "200px"
43   - *
44   - * @example $(document).width();
45   - * @result 800
46   - *
47   - * @example $(window).width();
48   - * @result 400
49   - * 
50   - * @name width
51   - * @type Object
52   - * @cat Dimensions
53   - */
54   -jQuery.fn.width = function() {
55   -  if ( this.get(0) == window )
56   -    return self.innerWidth ||
57   -      jQuery.boxModel && document.documentElement.clientWidth ||
58   -      document.body.clientWidth;
59   -  
60   -  if ( this.get(0) == document )
61   -    return Math.max( document.body.scrollWidth, document.body.offsetWidth );
62   -  
63   -  return this.css("width");
64   -};
65   -
66   -/**
67   - * Returns the inner height value (without border) for the first matched element.
68   - * If used on document, returns the document's height (innerHeight)
69   - * If used on window, returns the viewport's (window) height
70   - *
71   - * @example $("#testdiv").innerHeight()
72   - * @result 800
73   - * 
74   - * @name innerHeight
75   - * @type Number
76   - * @cat Dimensions
77   - */
78   -jQuery.fn.innerHeight = function() {
79   -  return this.get(0) == window || this.get(0) == document ?
80   -    this.height() :
81   -    this.get(0).offsetHeight - parseInt(this.css("borderTop") || 0) - parseInt(this.css("borderBottom") || 0);
82   -};
83   -
84   -/**
85   - * Returns the inner width value (without border) for the first matched element.
86   - * If used on document, returns the document's Width (innerWidth)
87   - * If used on window, returns the viewport's (window) width
88   - *
89   - * @example $("#testdiv").innerWidth()
90   - * @result 1000
91   - * 
92   - * @name innerWidth
93   - * @type Number
94   - * @cat Dimensions
95   - */
96   -jQuery.fn.innerWidth = function() {
97   -  return this.get(0) == window || this.get(0) == document ?
98   -    this.width() :
99   -    this.get(0).offsetWidth - parseInt(this.css("borderLeft") || 0) - parseInt(this.css("borderRight") || 0);
100   -};
101   -
102   -/**
103   - * Returns the outer height value (including border) for the first matched element.
104   - * Cannot be used on document or window.
105   - *
106   - * @example $("#testdiv").outerHeight()
107   - * @result 1000
108   - * 
109   - * @name outerHeight
110   - * @type Number
111   - * @cat Dimensions
112   - */
113   -jQuery.fn.outerHeight = function() {
114   -  return this.get(0) == window || this.get(0) == document ?
115   -    this.height() :
116   -    this.get(0).offsetHeight;  
117   -};
118   -
119   -/**
120   - * Returns the outer width value (including border) for the first matched element.
121   - * Cannot be used on document or window.
122   - *
123   - * @example $("#testdiv").outerWidth()
124   - * @result 1000
125   - * 
126   - * @name outerWidth
127   - * @type Number
128   - * @cat Dimensions
129   - */
130   -jQuery.fn.outerWidth = function() {
131   -  return this.get(0) == window || this.get(0) == document ?
132   -    this.width() :
133   -    this.get(0).offsetWidth;  
134   -};
135   -
136   -/**
137   - * Returns how many pixels the user has scrolled to the right (scrollLeft).
138   - * Works on containers with overflow: auto and window/document.
139   - *
140   - * @example $("#testdiv").scrollLeft()
141   - * @result 100
142   - * 
143   - * @name scrollLeft
144   - * @type Number
145   - * @cat Dimensions
146   - */
147   -jQuery.fn.scrollLeft = function() {
148   -  if ( this.get(0) == window || this.get(0) == document )
149   -    return self.pageXOffset ||
150   -      jQuery.boxModel && document.documentElement.scrollLeft ||
151   -      document.body.scrollLeft;
152   -  
153   -  return this.get(0).scrollLeft;
154   -};
155   -
156   -/**
157   - * Returns how many pixels the user has scrolled to the bottom (scrollTop).
158   - * Works on containers with overflow: auto and window/document.
159   - *
160   - * @example $("#testdiv").scrollTop()
161   - * @result 100
162   - * 
163   - * @name scrollTop
164   - * @type Number
165   - * @cat Dimensions
166   - */
167   -jQuery.fn.scrollTop = function() {
168   -  if ( this.get(0) == window || this.get(0) == document )
169   -    return self.pageYOffset ||
170   -      jQuery.boxModel && document.documentElement.scrollTop ||
171   -      document.body.scrollTop;
172   -
173   -  return this.get(0).scrollTop;
174   -};
175   -
176   -/**
177   - * This returns an object with top, left, width, height, borderLeft,
178   - * borderTop, marginLeft, marginTop, scrollLeft, scrollTop, 
179   - * pageXOffset, pageYOffset.
180   - *
181   - * The top and left values include the scroll offsets but the
182   - * scrollLeft and scrollTop properties of the returned object
183   - * are the combined scroll offets of the parent elements 
184   - * (not including the window scroll offsets). This is not the
185   - * same as the element's scrollTop and scrollLeft.
186   - * 
187   - * For accurate readings make sure to use pixel values.
188   - *
189   - * @name offset  
190   - * @type Object
191   - * @cat Dimensions
192   - * @author Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
193   - */
194   -/**
195   - * This returns an object with top, left, width, height, borderLeft,
196   - * borderTop, marginLeft, marginTop, scrollLeft, scrollTop, 
197   - * pageXOffset, pageYOffset.
198   - *
199   - * The top and left values include the scroll offsets but the
200   - * scrollLeft and scrollTop properties of the returned object
201   - * are the combined scroll offets of the parent elements 
202   - * (not including the window scroll offsets). This is not the
203   - * same as the element's scrollTop and scrollLeft.
204   - * 
205   - * For accurate readings make sure to use pixel values.
206   - *
207   - * @name offset  
208   - * @type Object
209   - * @param String refElement This is an expression. The offset returned will be relative to the first matched element.
210   - * @cat Dimensions
211   - * @author Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
212   - */
213   -/**
214   - * This returns an object with top, left, width, height, borderLeft,
215   - * borderTop, marginLeft, marginTop, scrollLeft, scrollTop, 
216   - * pageXOffset, pageYOffset.
217   - *
218   - * The top and left values include the scroll offsets but the
219   - * scrollLeft and scrollTop properties of the returned object
220   - * are the combined scroll offets of the parent elements 
221   - * (not including the window scroll offsets). This is not the
222   - * same as the element's scrollTop and scrollLeft.
223   - * 
224   - * For accurate readings make sure to use pixel values.
225   - *
226   - * @name offset  
227   - * @type Object
228   - * @param jQuery refElement The offset returned will be relative to the first matched element.
229   - * @cat Dimensions
230   - * @author Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
231   - */
232   -/**
233   - * This returns an object with top, left, width, height, borderLeft,
234   - * borderTop, marginLeft, marginTop, scrollLeft, scrollTop, 
235   - * pageXOffset, pageYOffset.
236   - *
237   - * The top and left values include the scroll offsets but the
238   - * scrollLeft and scrollTop properties of the returned object
239   - * are the combined scroll offets of the parent elements 
240   - * (not including the window scroll offsets). This is not the
241   - * same as the element's scrollTop and scrollLeft.
242   - * 
243   - * For accurate readings make sure to use pixel values.
244   - *
245   - * @name offset  
246   - * @type Object
247   - * @param HTMLElement refElement The offset returned will be relative to this element.
248   - * @cat Dimensions
249   - * @author Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
250   - */
251   -jQuery.fn.offset = function(refElem) {
252   -  if (!this[0]) throw 'jQuery.fn.offset requires an element.';
253   -  
254   -  refElem = (refElem) ? jQuery(refElem)[0] : null;
255   -  var x = 0, y = 0, elm = this[0], parent = this[0], pos = null, borders = [0,0], isElm = true, sl = 0, st = 0;
256   -  do {
257   -    if (parent.tagName == 'BODY' || parent.tagName == 'HTML') {
258   -      // Safari and IE don't add margin for static and relative
259   -      if ((jQuery.browser.safari || jQuery.browser.msie) && pos != 'absolute') {
260   -        x += parseInt(jQuery.css(parent, 'marginLeft')) || 0;
261   -        y += parseInt(jQuery.css(parent, 'marginTop'))  || 0;
262   -      }
263   -      break;
264   -    }
265   -    
266   -    pos    = jQuery.css(parent, 'position');
267   -    border = [parseInt(jQuery.css(parent, 'borderLeftWidth')) || 0,
268   -              parseInt(jQuery.css(parent, 'borderTopWidth'))  || 0];
269   -    sl = parent.scrollLeft;
270   -    st = parent.scrollTop;
271   -    
272   -    x += (parent.offsetLeft || 0) + border[0] - sl;
273   -    y += (parent.offsetTop  || 0) + border[1] - st;
274   -    
275   -    // Safari and Opera include the border already for parents with position = absolute|relative
276   -    if ((jQuery.browser.safari || jQuery.browser.opera) && !isElm && (pos == 'absolute' || pos == 'relative')) {
277   -      x -= border[0];
278   -      y -= border[1];
279   -    }
280   -    
281   -    parent = parent.offsetParent;
282   -    isElm  = false;
283   -  } while(parent);
284   -  
285   -  if (refElem) {
286   -    var offset = jQuery(refElem).offset();
287   -    x  = x  - offset.left;
288   -    y  = y  - offset.top;
289   -    sl = sl - offset.scrollLeft;
290   -    st = st - offset.scrollTop;
291   -  }
292   -  
293   -  return {
294   -    top:  y,
295   -    left: x,
296   -    width:  elm.offsetWidth,
297   -    height: elm.offsetHeight,
298   -    borderTop:  parseInt(jQuery.css(elm, 'borderTopWidth'))  || 0,
299   -    borderLeft: parseInt(jQuery.css(elm, 'borderLeftWidth')) || 0,
300   -    marginTop:  parseInt(jQuery.css(elm, 'marginTopWidth'))  || 0,
301   -    marginLeft: parseInt(jQuery.css(elm, 'marginLeftWidth')) || 0,
302   -    scrollTop:  st,
303   -    scrollLeft: sl,
304   -    pageYOffset: window.pageYOffset || document.documentElement.scrollTop  || document.body.scrollTop  || 0,
305   -    pageXOffset: window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0
306   -  };
  1 +/** 
  2 + * This plugin overrides jQuery's height() and width() functions and
  3 + * adds more handy stuff for cross-browser compatibility.
  4 + */
  5 +
  6 +/**
  7 + * Returns the css height value for the first matched element.
  8 + * If used on document, returns the document's height (innerHeight)
  9 + * If used on window, returns the viewport's (window) height
  10 + *
  11 + * @example $("#testdiv").height()
  12 + * @result "200px"
  13 + *
  14 + * @example $(document).height();
  15 + * @result 800
  16 + *
  17 + * @example $(window).height();
  18 + * @result 400
  19 + * 
  20 + * @name height
  21 + * @type Object
  22 + * @cat Dimensions
  23 + */
  24 +jQuery.fn.height = function() {
  25 +  if ( this.get(0) == window )
  26 +    return self.innerHeight ||
  27 +      jQuery.boxModel && document.documentElement.clientHeight ||
  28 +      document.body.clientHeight;
  29 +  
  30 +  if ( this.get(0) == document )
  31 +    return Math.max( document.body.scrollHeight, document.body.offsetHeight );
  32 +  
  33 +  return this.css("height");
  34 +};
  35 +
  36 +/**
  37 + * Returns the css width value for the first matched element.
  38 + * If used on document, returns the document's width (innerWidth)
  39 + * If used on window, returns the viewport's (window) width
  40 + *
  41 + * @example $("#testdiv").width()
  42 + * @result "200px"
  43 + *
  44 + * @example $(document).width();
  45 + * @result 800
  46 + *
  47 + * @example $(window).width();
  48 + * @result 400
  49 + * 
  50 + * @name width
  51 + * @type Object
  52 + * @cat Dimensions
  53 + */
  54 +jQuery.fn.width = function() {
  55 +  if ( this.get(0) == window )
  56 +    return self.innerWidth ||
  57 +      jQuery.boxModel && document.documentElement.clientWidth ||
  58 +      document.body.clientWidth;
  59 +  
  60 +  if ( this.get(0) == document )
  61 +    return Math.max( document.body.scrollWidth, document.body.offsetWidth );
  62 +  
  63 +  return this.css("width");
  64 +};
  65 +
  66 +/**
  67 + * Returns the inner height value (without border) for the first matched element.
  68 + * If used on document, returns the document's height (innerHeight)
  69 + * If used on window, returns the viewport's (window) height
  70 + *
  71 + * @example $("#testdiv").innerHeight()
  72 + * @result 800
  73 + * 
  74 + * @name innerHeight
  75 + * @type Number
  76 + * @cat Dimensions
  77 + */
  78 +jQuery.fn.innerHeight = function() {
  79 +  return this.get(0) == window || this.get(0) == document ?
  80 +    this.height() :
  81 +    this.get(0).offsetHeight - parseInt(this.css("borderTop") || 0) - parseInt(this.css("borderBottom") || 0);
  82 +};
  83 +
  84 +/**
  85 + * Returns the inner width value (without border) for the first matched element.
  86 + * If used on document, returns the document's Width (innerWidth)
  87 + * If used on window, returns the viewport's (window) width
  88 + *
  89 + * @example $("#testdiv").innerWidth()
  90 + * @result 1000
  91 + * 
  92 + * @name innerWidth
  93 + * @type Number
  94 + * @cat Dimensions
  95 + */
  96 +jQuery.fn.innerWidth = function() {
  97 +  return this.get(0) == window || this.get(0) == document ?
  98 +    this.width() :
  99 +    this.get(0).offsetWidth - parseInt(this.css("borderLeft") || 0) - parseInt(this.css("borderRight") || 0);
  100 +};
  101 +
  102 +/**
  103 + * Returns the outer height value (including border) for the first matched element.
  104 + * Cannot be used on document or window.
  105 + *
  106 + * @example $("#testdiv").outerHeight()
  107 + * @result 1000
  108 + * 
  109 + * @name outerHeight
  110 + * @type Number
  111 + * @cat Dimensions
  112 + */
  113 +jQuery.fn.outerHeight = function() {
  114 +  return this.get(0) == window || this.get(0) == document ?
  115 +    this.height() :
  116 +    this.get(0).offsetHeight;  
  117 +};
  118 +
  119 +/**
  120 + * Returns the outer width value (including border) for the first matched element.
  121 + * Cannot be used on document or window.
  122 + *
  123 + * @example $("#testdiv").outerWidth()
  124 + * @result 1000
  125 + * 
  126 + * @name outerWidth
  127 + * @type Number
  128 + * @cat Dimensions
  129 + */
  130 +jQuery.fn.outerWidth = function() {
  131 +  return this.get(0) == window || this.get(0) == document ?
  132 +    this.width() :
  133 +    this.get(0).offsetWidth;  
  134 +};
  135 +
  136 +/**
  137 + * Returns how many pixels the user has scrolled to the right (scrollLeft).
  138 + * Works on containers with overflow: auto and window/document.
  139 + *
  140 + * @example $("#testdiv").scrollLeft()
  141 + * @result 100
  142 + * 
  143 + * @name scrollLeft
  144 + * @type Number
  145 + * @cat Dimensions
  146 + */
  147 +jQuery.fn.scrollLeft = function() {
  148 +  if ( this.get(0) == window || this.get(0) == document )
  149 +    return self.pageXOffset ||
  150 +      jQuery.boxModel && document.documentElement.scrollLeft ||
  151 +      document.body.scrollLeft;
  152 +  
  153 +  return this.get(0).scrollLeft;
  154 +};
  155 +
  156 +/**
  157 + * Returns how many pixels the user has scrolled to the bottom (scrollTop).
  158 + * Works on containers with overflow: auto and window/document.
  159 + *
  160 + * @example $("#testdiv").scrollTop()
  161 + * @result 100
  162 + * 
  163 + * @name scrollTop
  164 + * @type Number
  165 + * @cat Dimensions
  166 + */
  167 +jQuery.fn.scrollTop = function() {
  168 +  if ( this.get(0) == window || this.get(0) == document )
  169 +    return self.pageYOffset ||
  170 +      jQuery.boxModel && document.documentElement.scrollTop ||
  171 +      document.body.scrollTop;
  172 +
  173 +  return this.get(0).scrollTop;
  174 +};
  175 +
  176 +/**
  177 + * This returns an object with top, left, width, height, borderLeft,
  178 + * borderTop, marginLeft, marginTop, scrollLeft, scrollTop, 
  179 + * pageXOffset, pageYOffset.
  180 + *
  181 + * The top and left values include the scroll offsets but the
  182 + * scrollLeft and scrollTop properties of the returned object
  183 + * are the combined scroll offets of the parent elements 
  184 + * (not including the window scroll offsets). This is not the
  185 + * same as the element's scrollTop and scrollLeft.
  186 + * 
  187 + * For accurate readings make sure to use pixel values.
  188 + *
  189 + * @name offset  
  190 + * @type Object
  191 + * @cat Dimensions
  192 + * @author Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
  193 + */
  194 +/**
  195 + * This returns an object with top, left, width, height, borderLeft,
  196 + * borderTop, marginLeft, marginTop, scrollLeft, scrollTop, 
  197 + * pageXOffset, pageYOffset.
  198 + *
  199 + * The top and left values include the scroll offsets but the
  200 + * scrollLeft and scrollTop properties of the returned object
  201 + * are the combined scroll offets of the parent elements 
  202 + * (not including the window scroll offsets). This is not the
  203 + * same as the element's scrollTop and scrollLeft.
  204 + * 
  205 + * For accurate readings make sure to use pixel values.
  206 + *
  207 + * @name offset  
  208 + * @type Object
  209 + * @param String refElement This is an expression. The offset returned will be relative to the first matched element.
  210 + * @cat Dimensions
  211 + * @author Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
  212 + */
  213 +/**
  214 + * This returns an object with top, left, width, height, borderLeft,
  215 + * borderTop, marginLeft, marginTop, scrollLeft, scrollTop, 
  216 + * pageXOffset, pageYOffset.
  217 + *
  218 + * The top and left values include the scroll offsets but the
  219 + * scrollLeft and scrollTop properties of the returned object
  220 + * are the combined scroll offets of the parent elements 
  221 + * (not including the window scroll offsets). This is not the
  222 + * same as the element's scrollTop and scrollLeft.
  223 + * 
  224 + * For accurate readings make sure to use pixel values.
  225 + *
  226 + * @name offset  
  227 + * @type Object
  228 + * @param jQuery refElement The offset returned will be relative to the first matched element.
  229 + * @cat Dimensions
  230 + * @author Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
  231 + */
  232 +/**
  233 + * This returns an object with top, left, width, height, borderLeft,
  234 + * borderTop, marginLeft, marginTop, scrollLeft, scrollTop, 
  235 + * pageXOffset, pageYOffset.
  236 + *
  237 + * The top and left values include the scroll offsets but the
  238 + * scrollLeft and scrollTop properties of the returned object
  239 + * are the combined scroll offets of the parent elements 
  240 + * (not including the window scroll offsets). This is not the
  241 + * same as the element's scrollTop and scrollLeft.
  242 + * 
  243 + * For accurate readings make sure to use pixel values.
  244 + *
  245 + * @name offset  
  246 + * @type Object
  247 + * @param HTMLElement refElement The offset returned will be relative to this element.
  248 + * @cat Dimensions
  249 + * @author Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
  250 + */
  251 +jQuery.fn.offset = function(refElem) {
  252 +  if (!this[0]) throw 'jQuery.fn.offset requires an element.';
  253 +  
  254 +  refElem = (refElem) ? jQuery(refElem)[0] : null;
  255 +  var x = 0, y = 0, elm = this[0], parent = this[0], pos = null, borders = [0,0], isElm = true, sl = 0, st = 0;
  256 +  do {
  257 +    if (parent.tagName == 'BODY' || parent.tagName == 'HTML') {
  258 +      // Safari and IE don't add margin for static and relative
  259 +      if ((jQuery.browser.safari || jQuery.browser.msie) && pos != 'absolute') {
  260 +        x += parseInt(jQuery.css(parent, 'marginLeft')) || 0;
  261 +        y += parseInt(jQuery.css(parent, 'marginTop'))  || 0;
  262 +      }
  263 +      break;
  264 +    }
  265 +    
  266 +    pos    = jQuery.css(parent, 'position');
  267 +    border = [parseInt(jQuery.css(parent, 'borderLeftWidth')) || 0,
  268 +              parseInt(jQuery.css(parent, 'borderTopWidth'))  || 0];
  269 +    sl = parent.scrollLeft;
  270 +    st = parent.scrollTop;
  271 +    
  272 +    x += (parent.offsetLeft || 0) + border[0] - sl;
  273 +    y += (parent.offsetTop  || 0) + border[1] - st;
  274 +    
  275 +    // Safari and Opera include the border already for parents with position = absolute|relative
  276 +    if ((jQuery.browser.safari || jQuery.browser.opera) && !isElm && (pos == 'absolute' || pos == 'relative')) {
  277 +      x -= border[0];
  278 +      y -= border[1];
  279 +    }
  280 +    
  281 +    parent = parent.offsetParent;
  282 +    isElm  = false;
  283 +  } while(parent);
  284 +  
  285 +  if (refElem) {
  286 +    var offset = jQuery(refElem).offset();
  287 +    x  = x  - offset.left;
  288 +    y  = y  - offset.top;
  289 +    sl = sl - offset.scrollLeft;
  290 +    st = st - offset.scrollTop;
  291 +  }
  292 +  
  293 +  return {
  294 +    top:  y,
  295 +    left: x,
  296 +    width:  elm.offsetWidth,
  297 +    height: elm.offsetHeight,
  298 +    borderTop:  parseInt(jQuery.css(elm, 'borderTopWidth'))  || 0,
  299 +    borderLeft: parseInt(jQuery.css(elm, 'borderLeftWidth')) || 0,
  300 +    marginTop:  parseInt(jQuery.css(elm, 'marginTopWidth'))  || 0,
  301 +    marginLeft: parseInt(jQuery.css(elm, 'marginLeftWidth')) || 0,
  302 +    scrollTop:  st,
  303 +    scrollLeft: sl,
  304 +    pageYOffset: window.pageYOffset || document.documentElement.scrollTop  || document.body.scrollTop  || 0,
  305 +    pageXOffset: window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0
  306 +  };
307 307  };
3,334  src/event/event.js
1667 additions, 1667 deletions not shown
1,154  src/fx/fx.js
... ... @@ -1,577 +1,577 @@
1   -jQuery.fn.extend({
2   -
3   -  // overwrite the old show method
4   -  _show: jQuery.fn.show,
5   -  
6   -  /**
7   -   * Show all matched elements using a graceful animation.
8   -   * The height, width, and opacity of each of the matched elements 
9   -   * are changed dynamically according to the specified speed.
10   -   *
11   -   * @example $("p").show("slow");
12   -   *
13   -   * @name show
14   -   * @type jQuery
15   -   * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
16   -   * @cat Effects/Animations
17   -   */
18   -   
19   -  /**
20   -   * Show all matched elements using a graceful animation and firing a callback
21   -   * function after completion.
22   -   * The height, width, and opacity of each of the matched elements 
23   -   * are changed dynamically according to the specified speed.
24   -   *
25   -   * @example $("p").show("slow",function(){
26   -   *   alert("Animation Done.");
27   -   * });
28   -   *
29   -   * @name show
30   -   * @type jQuery
31   -   * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
32   -   * @param Function callback A function to be executed whenever the animation completes.
33   -   * @cat Effects/Animations
34   -   */
35   -  show: function(speed,callback){
36   -    return speed ? this.animate({
37   -      height: "show", width: "show", opacity: "show"
38   -    }, speed, callback) : this._show();
39   -  },
40   -  
41   -  // Overwrite the old hide method
42   -  _hide: jQuery.fn.hide,
43   -  
44   -  /**
45   -   * Hide all matched elements using a graceful animation.
46   -   * The height, width, and opacity of each of the matched elements 
47   -   * are changed dynamically according to the specified speed.
48   -   *
49   -   * @example $("p").hide("slow");
50   -   *
51   -   * @name hide
52   -   * @type jQuery
53   -   * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
54   -   * @cat Effects/Animations
55   -   */
56   -   
57   -  /**
58   -   * Hide all matched elements using a graceful animation and firing a callback
59   -   * function after completion.
60   -   * The height, width, and opacity of each of the matched elements 
61   -   * are changed dynamically according to the specified speed.
62   -   *
63   -   * @example $("p").hide("slow",function(){
64   -   *   alert("Animation Done.");
65   -   * });
66   -   *
67   -   * @name hide
68   -   * @type jQuery
69   -   * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
70   -   * @param Function callback A function to be executed whenever the animation completes.
71   -   * @cat Effects/Animations
72   -   */
73   -  hide: function(speed,callback){
74   -    return speed ? this.animate({
75   -      height: "hide", width: "hide", opacity: "hide"
76   -    }, speed, callback) : this._hide();
77   -  },
78   -  
79   -  /**
80   -   * Reveal all matched elements by adjusting their height.
81   -   * Only the height is adjusted for this animation, causing all matched
82   -   * elements to be revealed in a "sliding" manner.
83   -   *
84   -   * @example $("p").slideDown("slow");
85   -   *
86   -   * @name slideDown
87   -   * @type jQuery
88   -   * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
89   -   * @cat Effects/Animations
90   -   */
91   -   
92   -  /**
93   -   * Reveal all matched elements by adjusting their height and firing a callback
94   -   * function after completion.
95   -   * Only the height is adjusted for this animation, causing all matched
96   -   * elements to be revealed in a "sliding" manner.
97   -   *
98   -   * @example $("p").slideDown("slow",function(){
99   -   *   alert("Animation Done.");
100   -   * });
101   -   *
102   -   * @name slideDown
103   -   * @type jQuery
104   -   * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
105   -   * @param Function callback A function to be executed whenever the animation completes.
106   -   * @cat Effects/Animations
107   -   */
108   -  slideDown: function(speed,callback){
109   -    return this.animate({height: "show"}, speed, callback);
110   -  },
111   -  
112   -  /**
113   -   * Hide all matched elements by adjusting their height.
114   -   * Only the height is adjusted for this animation, causing all matched
115   -   * elements to be hidden in a "sliding" manner.
116   -   *
117   -   * @example $("p").slideUp("slow");
118   -   *
119   -   * @name slideUp
120   -   * @type jQuery
121   -   * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
122   -   * @cat Effects/Animations
123   -   */
124   -   
125   -  /**
126   -   * Hide all matched elements by adjusting their height and firing a callback
127   -   * function after completion.
128   -   * Only the height is adjusted for this animation, causing all matched
129   -   * elements to be hidden in a "sliding" manner.
130   -   *
131   -   * @example $("p").slideUp("slow",function(){
132   -   *   alert("Animation Done.");
133   -   * });
134   -   *
135   -   * @name slideUp
136   -   * @type jQuery
137   -   * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
138   -   * @param Function callback A function to be executed whenever the animation completes.
139   -   * @cat Effects/Animations
140   -   */
141   -  slideUp: function(speed,callback){
142   -    return this.animate({height: "hide"}, speed, callback);
143   -  },
144   -
145   -  /**
146   -   * Toggle the visibility of all matched elements by adjusting their height.
147   -   * Only the height is adjusted for this animation, causing all matched
148   -   * elements to be hidden in a "sliding" manner.
149   -   *
150   -   * @example $("p").slideToggle("slow");
151   -   *
152   -   * @name slideToggle
153   -   * @type jQuery
154   -   * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
155   -   * @cat Effects/Animations
156   -   */
157   -   
158   -  /**
159   -   * Toggle the visibility of all matched elements by adjusting their height
160   -   * and firing a callback function after completion.
161   -   * Only the height is adjusted for this animation, causing all matched
162   -   * elements to be hidden in a "sliding" manner.
163   -   *
164   -   * @example $("p").slideToggle("slow",function(){
165   -   *   alert("Animation Done.");
166   -   * });
167   -   *
168   -   * @name slideToggle
169   -   * @type jQuery
170   -   * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
171   -   * @param Function callback A function to be executed whenever the animation completes.
172   -   * @cat Effects/Animations
173   -   */
174   -  slideToggle: function(speed,callback){
175   -    return this.each(function(){
176   -      var state = jQuery(this).is(":hidden") ? "show" : "hide";
177   -      jQuery(this).animate({height: state}, speed, callback);
178   -    });
179   -  },
180   -  
181   -  /**
182   -   * Fade in all matched elements by adjusting their opacity.
183   -   * Only the opacity is adjusted for this animation, meaning that
184   -   * all of the matched elements should already have some form of height
185   -   * and width associated with them.
186   -   *
187   -   * @example $("p").fadeIn("slow");
188   -   *
189   -   * @name fadeIn
190   -   * @type jQuery
191   -   * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
192   -   * @cat Effects/Animations
193   -   */
194   -   
195   -  /**
196   -   * Fade in all matched elements by adjusting their opacity and firing a 
197   -   * callback function after completion.
198   -   * Only the opacity is adjusted for this animation, meaning that
199   -   * all of the matched elements should already have some form of height
200   -   * and width associated with them.
201   -   *
202   -   * @example $("p").fadeIn("slow",function(){
203   -   *   alert("Animation Done.");
204   -   * });
205   -   *
206   -   * @name fadeIn
207   -   * @type jQuery
208   -   * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
209   -   * @param Function callback A function to be executed whenever the animation completes.
210   -   * @cat Effects/Animations
211   -   */
212   -  fadeIn: function(speed,callback){
213   -    return this.animate({opacity: "show"}, speed, callback);
214   -  },
215   -  
216   -  /**
217   -   * Fade out all matched elements by adjusting their opacity.
218   -   * Only the opacity is adjusted for this animation, meaning that
219   -   * all of the matched elements should already have some form of height
220   -   * and width associated with them.
221   -   *
222   -   * @example $("p").fadeOut("slow");
223   -   *
224   -   * @name fadeOut
225   -   * @type jQuery
226   -   * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
227   -   * @cat Effects/Animations
228   -   */
229   -   
230   -  /**
231   -   * Fade out all matched elements by adjusting their opacity and firing a 
232   -   * callback function after completion.
233   -   * Only the opacity is adjusted for this animation, meaning that
234   -   * all of the matched elements should already have some form of height
235   -   * and width associated with them.
236   -   *
237   -   * @example $("p").fadeOut("slow",function(){
238   -   *   alert("Animation Done.");
239   -   * });
240   -   *
241   -   * @name fadeOut
242   -   * @type jQuery
243   -   * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
244   -   * @param Function callback A function to be executed whenever the animation completes.
245   -   * @cat Effects/Animations
246   -   */
247   -  fadeOut: function(speed,callback){
248   -    return this.animate({opacity: "hide"}, speed, callback);
249   -  },
250   -  
251   -  /**
252   -   * Fade the opacity of all matched elements to a specified opacity.
253   -   * Only the opacity is adjusted for this animation, meaning that
254   -   * all of the matched elements should already have some form of height
255   -   * and width associated with them.
256   -   *
257   -   * @example $("p").fadeTo("slow", 0.5);
258   -   *
259   -   * @name fadeTo
260   -   * @type jQuery
261   -   * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
262   -   * @param Number opacity The opacity to fade to (a number from 0 to 1).
263   -   * @cat Effects/Animations
264   -   */
265   -   
266   -  /**
267   -   * Fade the opacity of all matched elements to a specified opacity and 
268   -   * firing a callback function after completion.
269   -   * Only the opacity is adjusted for this animation, meaning that
270   -   * all of the matched elements should already have some form of height
271   -   * and width associated with them.
272   -   *
273   -   * @example $("p").fadeTo("slow", 0.5, function(){
274   -   *   alert("Animation Done.");
275   -   * });
276   -   *
277   -   * @name fadeTo
278   -   * @type jQuery
279   -   * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
280   -   * @param Number opacity The opacity to fade to (a number from 0 to 1).
281   -   * @param Function callback A function to be executed whenever the animation completes.
282   -   * @cat Effects/Animations
283   -   */
284   -  fadeTo: function(speed,to,callback){
285   -    return this.animate({opacity: to}, speed, callback);
286   -  },
287   -  
288   -  /**
289   -   * A function for making your own, custom, animations. The key aspect of
290   -   * this function is the object of style properties that will be animated,
291   -   * and to what end. Each key within the object represents a style property
292   -   * that will also be animated (for example: "height", "top", or "opacity").
293   -   *
294   -   * The value associated with the key represents to what end the property
295   -   * will be animated. If a number is provided as the value, then the style
296   -   * property will be transitioned from its current state to that new number.
297   -   * Oterwise if the string "hide", "show", or "toggle" is provided, a default
298   -   * animation will be constructed for that property.
299   -   *
300   -   * @example $("p").animate({
301   -   *   height: 'toggle', opacity: 'toggle'
302   -   * }, "slow");
303   -   *
304   -   * @example $("p").animate({
305   -   *   left: 50, opacity: 'show'
306   -   * }, 500);
307   -   *
308   -   * @name animate
309   -   * @type jQuery
310   -   * @param Hash params A set of style attributes that you wish to animate, and to what end.
311   -   * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
312   -   * @param Function callback A function to be executed whenever the animation completes.
313   -   * @cat Effects/Animations
314   -   */
315   -  animate: function(prop,speed,callback) {
316   -    return this.queue(function(){
317   -    
318   -      this.curAnim = prop;
319   -      
320   -      for ( var p in prop ) {
321   -        var e = new jQuery.fx( this, jQuery.speed(speed,callback), p );
322   -        if ( prop[p].constructor == Number )
323   -          e.custom( e.cur(), prop[p] );
324   -        else
325   -          e[ prop[p] ]( prop );
326   -      }
327   -      
328   -    });
329   -  },
330   -  
331   -  /**
332   -   *
333   -   * @private
334   -   */
335   -  queue: function(type,fn){
336   -    if ( !fn ) {
337   -      fn = type;
338   -      type = "fx";
339   -    }
340   -  
341   -    return this.each(function(){
342   -      if ( !this.queue )
343   -        this.queue = {};
344   -  
345   -      if ( !this.queue[type] )
346   -        this.queue[type] = [];
347   -  
348   -      this.queue[type].push( fn );
349   -    
350   -      if ( this.queue[type].length == 1 )
351   -        fn.apply(this);
352   -    });
353   -  }
354   -
355   -});
356   -
357   -jQuery.extend({
358   -
359   -  setAuto: function(e,p) {
360   -    if ( e.notAuto ) return;
361   -
362   -    if ( p == "height" && e.scrollHeight != parseInt(jQuery.curCSS(e,p)) ) return;
363   -    if ( p == "width" && e.scrollWidth != parseInt(jQuery.curCSS(e,p)) ) return;
364   -
365   -    // Remember the original height
366   -    var a = e.style[p];
367   -
368   -    // Figure out the size of the height right now
369   -    var o = jQuery.curCSS(e,p,1);
370   -
371   -    if ( p == "height" && e.scrollHeight != o ||
372   -      p == "width" && e.scrollWidth != o ) return;
373   -
374   -    // Set the height to auto
375   -    e.style[p] = e.currentStyle ? "" : "auto";
376   -
377   -    // See what the size of "auto" is
378   -    var n = jQuery.curCSS(e,p,1);
379   -
380   -    // Revert back to the original size
381   -    if ( o != n && n != "auto" ) {
382   -      e.style[p] = a;
383   -      e.notAuto = true;
384   -    }
385   -  },
386   -  
387   -  speed: function(s,o) {
388   -    o = o || {};
389   -    
390   -    if ( o.constructor == Function )
391   -      o = { complete: o };
392   -    
393   -    var ss = { slow: 600, fast: 200 };
394   -    o.duration = (s && s.constructor == Number ? s : ss[s]) || 400;
395   -  
396   -    // Queueing
397   -    o.oldComplete = o.complete;
398   -    o.complete = function(){
399   -      jQuery.dequeue(this, "fx");
400   -      if ( o.oldComplete && o.oldComplete.constructor == Function )
401   -        o.oldComplete.apply( this );
402   -    };
403   -  
404   -    return o;
405   -  },
406   -  
407   -  queue: {},
408   -  
409   -  dequeue: function(elem,type){
410   -    type = type || "fx";
411   -  
412   -    if ( elem.queue && elem.queue[type] ) {
413   -      // Remove self
414   -      elem.queue[type].shift();
415   -  
416   -      // Get next function
417   -      var f = elem.queue[type][0];
418   -    
419   -      if ( f ) f.apply( elem );
420   -    }
421   -  },
422   -
423   -  /*
424   -   * I originally wrote fx() as a clone of moo.fx and in the process
425   -   * of making it small in size the code became illegible to sane
426   -   * people. You've been warned.
427   -   */
428   -  
429   -  fx: function( elem, options, prop ){
430   -  
431   -    var z = this;
432   -  
433   -    // The users options
434   -    z.o = {
435   -      duration: options.duration || 400,
436   -      complete: options.complete,
437   -      step: options.step
438   -    };
439   -  
440   -    // The element
441   -    z.el = elem;
442   -  
443   -    // The styles
444   -    var y = z.el.style;
445   -  
446   -    // Simple function for setting a style value
447   -    z.a = function(){
448   -      if ( options.step )
449   -        options.step.apply( elem, [ z.now ] );
450  
451   -      if ( prop == "opacity" )
452   -        jQuery.attr(y, "opacity", z.now); // Let attr handle opacity
453   -      else if ( parseInt(z.now) ) // My hate for IE will never die
454   -        y[prop] = parseInt(z.now) + "px";
455   -        
456   -      y.display = "block";
457   -    };
458   -  
459   -    // Figure out the maximum number to run to
460   -    z.max = function(){
461   -      return parseFloat( jQuery.css(z.el,prop) );
462   -    };
463   -  
464   -    // Get the current size
465   -    z.cur = function(){
466   -      var r = parseFloat( jQuery.curCSS(z.el, prop) );
467   -      return r && r > -10000 ? r : z.max();
468   -    };
469   -  
470   -    // Start an animation from one number to another
471   -    z.custom = function(from,to){
472   -      z.startTime = (new Date()).getTime();
473   -      z.now = from;
474   -      z.a();
475   -  
476   -      z.timer = setInterval(function(){
477   -        z.step(from, to);
478   -      }, 13);
479   -    };
480   -  
481   -    // Simple 'show' function
482   -    z.show = function( p ){
483   -      if ( !z.el.orig ) z.el.orig = {};
484   -
485   -      // Remember where we started, so that we can go back to it later
486   -      z.el.orig[prop] = this.cur();
487   -      
488   -      // Begin the animation
489   -      if (prop == "opacity")
490   -        z.custom(z.el.orig[prop], 1);
491   -      else
492   -        z.custom(0, z.el.orig[prop]);
493   -
494   -      // Stupid IE, look what you made me do
495   -      if ( prop != "opacity" )
496   -        y[prop] = "1px";
497   -    };
498   -  
499   -    // Simple 'hide' function
500   -    z.hide = function(){
501   -      if ( !z.el.orig ) z.el.orig = {};
502   -
503   -      // Remember where we started, so that we can go back to it later
504   -      z.el.orig[prop] = this.cur();
505   -
506   -      z.o.hide = true;
507   -
508   -      // Begin the animation
509   -      z.custom(z.el.orig[prop], 0);
510   -    };
511   -  
512   -    // Remember  the overflow of the element
513   -    if ( !z.el.oldOverlay )
514   -      z.el.oldOverflow = jQuery.css( z.el, "overflow" );
515   -  
516   -    // Make sure that nothing sneaks out
517   -    y.overflow = "hidden";
518   -  
519   -    // Each step of an animation
520   -    z.step = function(firstNum, lastNum){
521   -      var t = (new Date()).getTime();
522   -  
523   -      if (t > z.o.duration + z.startTime) {
524   -        // Stop the timer
525   -        clearInterval(z.timer);
526   -        z.timer = null;
527   -
528   -        z.now = lastNum;
529   -        z.a();
530   -
531   -        z.el.curAnim[ prop ] = true;
532   -        
533   -        var done = true;
534   -        for ( var i in z.el.curAnim )
535   -          if ( z.el.curAnim[i] !== true )
536   -            done = false;
537   -            
538   -        if ( done ) {
539   -          // Reset the overflow
540   -          y.overflow = z.el.oldOverflow;
541   -        
542   -          // Hide the element if the "hide" operation was done
543   -          if ( z.o.hide ) 
544   -            y.display = 'none';
545   -          
546   -          // Reset the property, if the item has been hidden
547   -          if ( z.o.hide ) {
548   -            for ( var p in z.el.curAnim ) {
549   -              if (p == "opacity" && jQuery.browser.msie)
550   -                jQuery.attr(y, p, z.el.orig[p]);
551   -              else
552   -                y[ p ] = z.el.orig[p] + "px";
553   -  
554   -              // set its height and/or width to auto
555   -              if ( p == 'height' || p == 'width' )
556   -                jQuery.setAuto( z.el, p );
557   -            }
558   -          }
559   -        }
560   -
561   -        // If a callback was provided, execute it
562   -        if( done && z.o.complete && z.o.complete.constructor == Function )
563   -          // Execute the complete function
564   -          z.o.complete.apply( z.el );
565   -      } else {
566   -        // Figure out where in the animation we are and set the number
567   -        var p = (t - this.startTime) / z.o.duration;
568   -        z.now = ((-Math.cos(p*Math.PI)/2) + 0.5) * (lastNum-firstNum) + firstNum;
569   -  
570   -        // Perform the next step of the animation
571   -        z.a();
572   -      }
573   -    };
574   -  
575   -  }
576   -
577   -});
  1 +jQuery.fn.extend({
  2 +
  3 +  // overwrite the old show method
  4 +  _show: jQuery.fn.show,
  5 +  
  6 +  /**
  7 +   * Show all matched elements using a graceful animation.
  8 +   * The height, width, and opacity of each of the matched elements 
  9 +   * are changed dynamically according to the specified speed.
  10 +   *
  11 +   * @example $("p").show("slow");
  12 +   *
  13 +   * @name show
  14 +   * @type jQuery
  15 +   * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
  16 +   * @cat Effects/Animations
  17 +   */
  18 +   
  19 +  /**
  20 +   * Show all matched elements using a graceful animation and firing a callback
  21 +   * function after completion.
  22 +   * The height, width, and opacity of each of the matched elements 
  23 +   * are changed dynamically according to the specified speed.
  24 +   *
  25 +   * @example $("p").show("slow",function(){
  26 +   *   alert("Animation Done.");
  27 +   * });
  28 +   *
  29 +   * @name show
  30 +   * @type jQuery
  31 +   * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
  32 +   * @param Function callback A function to be executed whenever the animation completes.
  33 +   * @cat Effects/Animations
  34 +   */
  35 +  show: function(speed,callback){
  36 +    return speed ? this.animate({
  37 +      height: "show", width: "show", opacity: "show"
  38 +    }, speed, callback) : this._show();
  39 +  },
  40 +  
  41 +  // Overwrite the old hide method
  42 +  _hide: jQuery.fn.hide,
  43 +  
  44 +  /**
  45 +   * Hide all matched elements using a graceful animation.
  46 +   * The height, width, and opacity of each of the matched elements 
  47 +   * are changed dynamically according to the specified speed.
  48 +   *
  49 +   * @example $("p").hide("slow");
  50 +   *
  51 +   * @name hide
  52 +   * @type jQuery
  53 +   * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
  54 +   * @cat Effects/Animations
  55 +   */
  56 +   
  57 +  /**
  58 +   * Hide all matched elements using a graceful animation and firing a callback
  59 +   * function after completion.
  60 +   * The height, width, and opacity of each of the matched elements 
  61 +   * are changed dynamically according to the specified speed.
  62 +   *
  63 +   * @example $("p").hide("slow",function(){
  64 +   *   alert("Animation Done.");
  65 +   * });
  66 +   *
  67 +   * @name hide
  68 +   * @type jQuery
  69 +   * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
  70 +   * @param Function callback A function to be executed whenever the animation completes.
  71 +   * @cat Effects/Animations
  72 +   */
  73 +  hide: function(speed,callback){
  74 +    return speed ? this.animate({
  75 +      height: "hide", width: "hide", opacity: "hide"
  76 +    }, speed, callback) : this._hide();
  77 +  },
  78 +  
  79 +  /**
  80 +   * Reveal all matched elements by adjusting their height.
  81 +   * Only the height is adjusted for this animation, causing all matched
  82 +   * elements to be revealed in a "sliding" manner.
  83 +   *
  84 +   * @example $("p").slideDown("slow");
  85 +   *
  86 +   * @name slideDown
  87 +   * @type jQuery
  88 +   * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
  89 +   * @cat Effects/Animations
  90 +   */
  91 +   
  92 +  /**
  93 +   * Reveal all matched elements by adjusting their height and firing a callback
  94 +   * function after completion.
  95 +   * Only the height is adjusted for this animation, causing all matched
  96 +   * elements to be revealed in a "sliding" manner.
  97 +   *
  98 +   * @example $("p").slideDown("slow",function(){
  99 +   *   alert("Animation Done.");
  100 +   * });
  101 +   *
  102 +   * @name slideDown
  103 +   * @type jQuery
  104 +   * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
  105 +   * @param Function callback A function to be executed whenever the animation completes.
  106 +   * @cat Effects/Animations
  107 +   */
  108 +  slideDown: function(speed,callback){
  109 +    return this.animate({height: "show"}, speed, callback);
  110 +  },
  111 +  
  112 +  /**
  113 +   * Hide all matched elements by adjusting their height.
  114 +   * Only the height is adjusted for this animation, causing all matched
  115 +   * elements to be hidden in a "sliding" manner.
  116 +   *
  117 +   * @example $("p").slideUp("slow");
  118 +   *
  119 +   * @name slideUp
  120 +   * @type jQuery
  121 +   * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
  122 +   * @cat Effects/Animations
  123 +   */
  124 +   
  125 +  /**
  126 +   * Hide all matched elements by adjusting their height and firing a callback
  127 +   * function after completion.
  128 +   * Only the height is adjusted for this animation, causing all matched
  129 +   * elements to be hidden in a "sliding" manner.
  130 +   *
  131 +   * @example $("p").slideUp("slow",function(){
  132 +   *   alert("Animation Done.");
  133 +   * });
  134 +   *
  135 +   * @name slideUp
  136 +   * @type jQuery
  137 +   * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
  138 +   * @param Function callback A function to be executed whenever the animation completes.
  139 +   * @cat Effects/Animations
  140 +   */
  141 +  slideUp: function(speed,callback){
  142 +    return this.animate({height: "hide"}, speed, callback);
  143 +  },
  144 +
  145 +  /**
  146 +   * Toggle the visibility of all matched elements by adjusting their height.
  147 +   * Only the height is adjusted for this animation, causing all matched
  148 +   * elements to be hidden in a "sliding" manner.
  149 +   *
  150 +   * @example $("p").slideToggle("slow");
  151 +   *
  152 +   * @name slideToggle
  153 +   * @type jQuery
  154 +   * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
  155 +   * @cat Effects/Animations
  156 +   */
  157 +   
  158 +  /**
  159 +   * Toggle the visibility of all matched elements by adjusting their height
  160 +   * and firing a callback function after completion.
  161 +   * Only the height is adjusted for this animation, causing all matched
  162 +   * elements to be hidden in a "sliding" manner.
  163 +   *
  164 +   * @example $("p").slideToggle("slow",function(){
  165 +   *   alert("Animation Done.");
  166 +   * });
  167 +   *
  168 +   * @name slideToggle
  169 +   * @type jQuery
  170 +   * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
  171 +   * @param Function callback A function to be executed whenever the animation completes.
  172 +   * @cat Effects/Animations
  173 +   */
  174 +  slideToggle: function(speed,callback){
  175 +    return this.each(function(){
  176 +      var state = jQuery(this).is(":hidden") ? "show" : "hide";
  177 +      jQuery(this).animate({height: state}, speed, callback);
  178 +    });
  179 +  },
  180 +  
  181 +  /**
  182 +   * Fade in all matched elements by adjusting their opacity.
  183 +   * Only the opacity is adjusted for this animation, meaning that
  184 +   * all of the matched elements should already have some form of height
  185 +   * and width associated with them.
  186 +   *
  187 +   * @example $("p").fadeIn("slow");
  188 +   *
  189 +   * @name fadeIn
  190 +   * @type jQuery
  191 +   * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
  192 +   * @cat Effects/Animations
  193 +   */
  194 +   
  195 +  /**
  196 +   * Fade in all matched elements by adjusting their opacity and firing a 
  197 +   * callback function after completion.
  198 +   * Only the opacity is adjusted for this animation, meaning that
  199 +   * all of the matched elements should already have some form of height
  200 +   * and width associated with them.
  201 +   *
  202 +   * @example $("p").fadeIn("slow",function(){
  203 +   *   alert("Animation Done.");
  204 +   * });
  205 +   *
  206 +   * @name fadeIn
  207 +   * @type jQuery
  208 +   * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
  209 +   * @param Function callback A function to be executed whenever the animation completes.
  210 +   * @cat Effects/Animations
  211 +   */
  212 +  fadeIn: function(speed,callback){
  213 +    return this.animate({opacity: "show"}, speed, callback);
  214 +  },
  215 +  
  216 +  /**
  217 +   * Fade out all matched elements by adjusting their opacity.
  218 +   * Only the opacity is adjusted for this animation, meaning that
  219 +   * all of the matched elements should already have some form of height
  220 +   * and width associated with them.
  221 +   *
  222 +   * @example $("p").fadeOut("slow");
  223 +   *
  224 +   * @name fadeOut
  225 +   * @type jQuery
  226 +   * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
  227 +   * @cat Effects/Animations
  228 +   */
  229 +   
  230 +  /**
  231 +   * Fade out all matched elements by adjusting their opacity and firing a 
  232 +   * callback function after completion.
  233 +   * Only the opacity is adjusted for this animation, meaning that
  234 +   * all of the matched elements should already have some form of height
  235 +   * and width associated with them.
  236 +   *
  237 +   * @example $("p").fadeOut("slow",function(){
  238 +   *   alert("Animation Done.");
  239 +   * });
  240 +   *
  241 +   * @name fadeOut
  242 +   * @type jQuery
  243 +   * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
  244 +   * @param Function callback A function to be executed whenever the animation completes.
  245 +   * @cat Effects/Animations
  246 +   */
  247 +  fadeOut: function(speed,callback){
  248 +    return this.animate({opacity: "hide"}, speed, callback);
  249 +  },
  250 +  
  251 +  /**
  252 +   * Fade the opacity of all matched elements to a specified opacity.
  253 +   * Only the opacity is adjusted for this animation, meaning that
  254 +   * all of the matched elements should already have some form of height
  255 +   * and width associated with them.
  256 +   *
  257 +   * @example $("p").fadeTo("slow", 0.5);
  258 +   *
  259 +   * @name fadeTo
  260 +   * @type jQuery
  261 +   * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
  262 +   * @param Number opacity The opacity to fade to (a number from 0 to 1).
  263 +   * @cat Effects/Animations
  264 +   */
  265 +   
  266 +  /**
  267 +   * Fade the opacity of all matched elements to a specified opacity and 
  268 +   * firing a callback function after completion.
  269 +   * Only the opacity is adjusted for this animation, meaning that
  270 +   * all of the matched elements should already have some form of height
  271 +   * and width associated with them.
  272 +   *
  273 +   * @example $("p").fadeTo("slow", 0.5, function(){
  274 +   *   alert("Animation Done.");
  275 +   * });
  276 +   *
  277 +   * @name fadeTo
  278 +   * @type jQuery
  279 +   * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
  280 +   * @param Number opacity The opacity to fade to (a number from 0 to 1).
  281 +   * @param Function callback A function to be executed whenever the animation completes.
  282 +   * @cat Effects/Animations
  283 +   */
  284 +  fadeTo: function(speed,to,callback){
  285 +    return this.animate({opacity: to}, speed, callback);
  286 +  },
  287 +  
  288 +  /**
  289 +   * A function for making your own, custom, animations. The key aspect of
  290 +   * this function is the object of style properties that will be animated,
  291 +   * and to what end. Each key within the object represents a style property
  292 +   * that will also be animated (for example: "height", "top", or "opacity").
  293 +   *
  294 +   * The value associated with the key represents to what end the property
  295 +   * will be animated. If a number is provided as the value, then the style
  296 +   * property will be transitioned from its current state to that new number.
  297 +   * Oterwise if the string "hide", "show", or "toggle" is provided, a default
  298 +   * animation will be constructed for that property.
  299 +   *
  300 +   * @example $("p").animate({
  301 +   *   height: 'toggle', opacity: 'toggle'
  302 +   * }, "slow");
  303 +   *
  304 +   * @example $("p").animate({
  305 +   *   left: 50, opacity: 'show'
  306 +   * }, 500);
  307 +   *
  308 +   * @name animate
  309 +   * @type jQuery
  310 +   * @param Hash params A set of style attributes that you wish to animate, and to what end.
  311 +   * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
  312 +   * @param Function callback A function to be executed whenever the animation completes.
  313 +   * @cat Effects/Animations
  314 +   */
  315 +  animate: function(prop,speed,callback) {
  316 +    return this.queue(function(){
  317 +    
  318 +      this.curAnim = prop;
  319 +      
  320 +      for ( var p in prop ) {
  321 +        var e = new jQuery.fx( this, jQuery.speed(speed,callback), p );
  322 +        if ( prop[p].constructor == Number )
  323 +          e.custom( e.cur(), prop[p] );
  324 +        else
  325 +          e[ prop[p] ]( prop );
  326 +      }
  327 +      
  328 +    });
  329 +  },
  330 +  
  331 +  /**
  332 +   *
  333 +   * @private
  334 +   */
  335 +  queue: function(type,fn){
  336 +    if ( !fn ) {
  337 +      fn = type;
  338 +      type = "fx";
  339 +    }
  340 +  
  341 +    return this.each(function(){
  342 +      if ( !this.queue )
  343 +        this.queue = {};
  344 +  
  345 +      if ( !this.queue[type] )
  346 +        this.queue[type] = [];
  347 +  
  348 +      this.queue[type].push( fn );
  349 +    
  350 +      if ( this.queue[type].length == 1 )
  351 +        fn.apply(this);
  352 +    });
  353 +  }
  354 +
  355 +});
  356 +
  357 +jQuery.extend({
  358 +
  359 +  setAuto: function(e,p) {
  360 +    if ( e.notAuto ) return;
  361 +
  362 +    if ( p == "height" && e.scrollHeight != parseInt(jQuery.curCSS(e,p)) ) return;
  363 +    if ( p == "width" && e.scrollWidth != parseInt(jQuery.curCSS(e,p)) ) return;
  364 +
  365 +    // Remember the original height
  366 +    var a = e.style[p];
  367 +
  368 +    // Figure out the size of the height right now
  369 +    var o = jQuery.curCSS(e,p,1);
  370 +
  371 +    if ( p == "height" && e.scrollHeight != o ||
  372 +      p == "width" && e.scrollWidth != o ) return;
  373 +
  374 +    // Set the height to auto
  375 +    e.style[p] = e.currentStyle ? "" : "auto";
  376 +
  377 +    // See what the size of "auto" is
  378 +    var n = jQuery.curCSS(e,p,1);
  379 +
  380 +    // Revert back to the original size
  381 +    if ( o != n && n != "auto" ) {
  382 +      e.style[p] = a;
  383 +      e.notAuto = true;
  384 +    }
  385 +  },
  386 +  
  387 +  speed: function(s,o) {
  388 +    o = o || {};
  389 +    
  390 +    if ( o.constructor == Function )
  391 +      o = { complete: o };
  392 +    
  393 +    var ss = { slow: 600, fast: 200 };
  394 +    o.duration = (s && s.constructor == Number ? s : ss[s]) || 400;
  395 +  
  396 +    // Queueing
  397 +    o.oldComplete = o.complete;
  398 +    o.complete = function(){
  399 +      jQuery.dequeue(this, "fx");
  400 +      if ( o.oldComplete && o.oldComplete.constructor == Function )
  401 +        o.oldComplete.apply( this );
  402 +    };
  403 +  
  404 +    return o;
  405 +  },
  406 +  
  407 +  queue: {},
  408 +  
  409 +  dequeue: function(elem,type){
  410 +    type = type || "fx";
  411 +  
  412 +    if ( elem.queue && elem.queue[type] ) {
  413 +      // Remove self
  414 +      elem.queue[type].shift();
  415 +  
  416 +      // Get next function
  417 +      var f = elem.queue[type][0];
  418 +    
  419 +      if ( f ) f.apply( elem );
  420 +    }
  421 +  },
  422 +
  423 +  /*
  424 +   * I originally wrote fx() as a clone of moo.fx and in the process
  425 +   * of making it small in size the code became illegible to sane
  426 +   * people. You've been warned.
  427 +   */
  428 +  
  429 +  fx: function( elem, options, prop ){
  430 +  
  431 +    var z = this;
  432 +  
  433 +    // The users options
  434 +    z.o = {
  435 +      duration: options.duration || 400,
  436 +      complete: options.complete,
  437 +      step: options.step
  438 +    };
  439 +  
  440 +    // The element
  441 +    z.el = elem;
  442 +  
  443 +    // The styles
  444 +    var y = z.el.style;
  445 +  
  446 +    // Simple function for setting a style value
  447 +    z.a = function(){
  448 +      if ( options.step )
  449 +        options.step.apply( elem, [ z.now ] );
  450
  451 +      if ( prop == "opacity" )
  452 +        jQuery.attr(y, "opacity", z.now); // Let attr handle opacity
  453 +      else if ( parseInt(z.now) ) // My hate for IE will never die
  454 +        y[prop] = parseInt(z.now) + "px";
  455 +        
  456 +      y.display = "block";
  457 +    };
  458 +  
  459 +    // Figure out the maximum number to run to
  460 +    z.max = function(){
  461 +      return parseFloat( jQuery.css(z.el,prop) );
  462 +    };
  463 +  
  464 +    // Get the current size
  465 +    z.cur = function(){
  466 +      var r = parseFloat( jQuery.curCSS(z.el, prop) );
  467 +      return r && r > -10000 ? r : z.max();
  468 +    };
  469 +  
  470 +    // Start an animation from one number to another
  471 +    z.custom = function(from,to){
  472 +      z.startTime = (new Date()).getTime();
  473 +      z.now = from;
  474 +      z.a();
  475 +  
  476 +      z.timer = setInterval(function(){
  477 +        z.step(from, to);
  478 +      }, 13);
  479 +    };
  480 +  
  481 +    // Simple 'show' function
  482 +    z.show = function( p ){
  483 +      if ( !z.el.orig ) z.el.orig = {};
  484 +
  485 +      // Remember where we started, so that we can go back to it later
  486 +      z.el.orig[prop] = this.cur();
  487 +      
  488 +      // Begin the animation
  489 +      if (prop == "opacity")
  490 +        z.custom(z.el.orig[prop], 1);
  491 +      else
  492 +        z.custom(0, z.el.orig[prop]);
  493 +
  494 +      // Stupid IE, look what you made me do
  495 +      if ( prop != "opacity" )
  496 +        y[prop] = "1px";
  497 +    };
  498 +  
  499 +    // Simple 'hide' function
  500 +    z.hide = function(){
  501 +      if ( !z.el.orig ) z.el.orig = {};
  502 +
  503 +      // Remember where we started, so that we can go back to it later
  504 +      z.el.orig[prop] = this.cur();
  505 +
  506 +      z.o.hide = true;
  507 +
  508 +      // Begin the animation
  509 +      z.custom(z.el.orig[prop], 0);
  510 +    };
  511 +  
  512 +    // Remember  the overflow of the element
  513 +    if ( !z.el.oldOverlay )
  514 +      z.el.oldOverflow = jQuery.css( z.el, "overflow" );
  515 +  
  516 +    // Make sure that nothing sneaks out
  517 +    y.overflow = "hidden";
  518 +  
  519 +    // Each step of an animation
  520 +    z.step = function(firstNum, lastNum){
  521 +      var t = (new Date()).getTime();
  522 +  
  523 +      if (t > z.o.duration + z.startTime) {
  524 +        // Stop the timer
  525 +        clearInterval(z.timer);
  526 +        z.timer = null;
  527 +
  528 +        z.now = lastNum;
  529 +        z.a();
  530 +
  531 +        z.el.curAnim[ prop ] = true;
  532 +        
  533 +        var done = true;
  534 +        for ( var i in z.el.curAnim )
  535 +          if ( z.el.curAnim[i] !== true )
  536 +            done = false;
  537 +            
  538 +        if ( done ) {
  539 +          // Reset the overflow
  540 +          y.overflow = z.el.oldOverflow;
  541 +        
  542 +          // Hide the element if the "hide" operation was done
  543 +          if ( z.o.hide ) 
  544 +            y.display = 'none';
  545 +          
  546 +          // Reset the property, if the item has been hidden
  547 +          if ( z.o.hide ) {
  548 +            for ( var p in z.el.curAnim ) {
  549 +              if (p == "opacity" && jQuery.browser.msie)
  550 +                jQuery.attr(y, p, z.el.orig[p]);
  551 +              else
  552 +                y[ p ] = z.el.orig[p] + "px";
  553 +  
  554 +              // set its height and/or width to auto
  555 +              if ( p == 'height' || p == 'width' )
  556 +                jQuery.setAuto( z.el, p );
  557 +            }
  558 +          }
  559 +        }
  560 +
  561 +        // If a callback was provided, execute it
  562 +        if( done && z.o.complete && z.o.complete.constructor == Function )
  563 +          // Execute the complete function
  564 +          z.o.complete.apply( z.el );
  565 +      } else {
  566 +        // Figure out where in the animation we are and set the number
  567 +        var p = (t - this.startTime) / z.o.duration;
  568 +        z.now = ((-Math.cos(p*Math.PI)/2) + 0.5) * (lastNum-firstNum) + firstNum;
  569 +  
  570 +        // Perform the next step of the animation
  571 +        z.a();
  572 +      }
  573 +    };
  574 +  
  575 +  }
  576 +
  577 +});
4  src/intro.js
... ... @@ -1,2 +1,2 @@
1   -/* prevent execution of jQuery if included more then once */
2   -if(typeof window.jQuery == "undefined") {
  1 +/* prevent execution of jQuery if included more then once */
  2 +if(typeof window.jQuery == "undefined") {
6,842  src/jquery/jquery.js
3421 additions, 3421 deletions not shown
2  src/outro.js
... ... @@ -1 +1 @@
1   -} // close: if(typeof window.jQuery == "undefined") {
  1 +} // close: if(typeof window.jQuery == "undefined") {

0 notes on commit dbee06d

Please sign in to comment.
Something went wrong with that request. Please try again.