right-rails 0.4.3 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,7 +12,7 @@
12
12
  * Copyright (C) 2008-2009 Nikolay V. Nemshilov aka St. <nemshilov#gma-ilc-om>
13
13
  */
14
14
  var RightJS = {
15
- version: "1.5.2",
15
+ version: "1.5.3",
16
16
  modules: ["core", "form", "cookie", "xhr", "fx"]
17
17
  };
18
18
 
@@ -848,7 +848,7 @@ $alias(Array.prototype, {
848
848
  * The trim function taken from work of Steven Levithan
849
849
  * - http://blog.stevenlevithan.com/archives/faster-trim-javascript
850
850
  *
851
- * Copyright (C) 2008-2009 Nikolay V. Nemshilov aka St. <nemshilov#gma-il>
851
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov aka St. <nemshilov#gma-il>
852
852
  */
853
853
  $ext(String.prototype, {
854
854
  /**
@@ -895,9 +895,8 @@ $ext(String.prototype, {
895
895
  * @return String without scripts
896
896
  */
897
897
  stripScripts: function(option) {
898
- var scripts = '';
899
- var text = this.replace(/<script[^>]*>([\s\S]*?)<\/script>/img, function(match, source) {
900
- scripts += source.trim() + "\n";
898
+ var scripts = '', text = this.replace(/<script[^>]*>([\s\S]*?)<\/script>/img, function(match, source) {
899
+ scripts += source + "\n";
901
900
  return '';
902
901
  });
903
902
 
@@ -905,8 +904,6 @@ $ext(String.prototype, {
905
904
  $eval(scripts);
906
905
  else if (isFunction(option))
907
906
  option(scripts, text);
908
- else if (isNumber(option))
909
- $eval.bind(scripts).delay(options);
910
907
 
911
908
  return text;
912
909
  },
@@ -1447,7 +1444,7 @@ var Options = {
1447
1444
  * The naming principle is inspired by
1448
1445
  * - Prototype (http://prototypejs.org) Copyright (C) Sam Stephenson
1449
1446
  *
1450
- * Copyright (C) 2008-2009 Nikolay V. Nemshilov aka St. <nemshilov#gma-il>
1447
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov aka St. <nemshilov#gma-il>
1451
1448
  */
1452
1449
  var Observer = new Class({
1453
1450
  include: Options,
@@ -1463,16 +1460,16 @@ var Observer = new Class({
1463
1460
  },
1464
1461
 
1465
1462
  /**
1466
- * starts observing an event
1463
+ * binds an event listener
1467
1464
  *
1468
1465
  * USAGE:
1469
- * observe(String event, Function callback[, arguments, ...]);
1470
- * observe(String event, String method_name[, arguments, ...]);
1471
- * observe(Object events_hash);
1466
+ * on(String event, Function callback[, arguments, ...]);
1467
+ * on(String event, String method_name[, arguments, ...]);
1468
+ * on(Object events_hash);
1472
1469
  *
1473
1470
  * @return Observer self
1474
1471
  */
1475
- observe: function() {
1472
+ on: function() {
1476
1473
  var args = $A(arguments), event = args.shift();
1477
1474
 
1478
1475
  if (isString(event)) {
@@ -1529,7 +1526,7 @@ var Observer = new Class({
1529
1526
  * observes(Function callback)
1530
1527
  * observes(String event, Function callback)
1531
1528
  *
1532
- * @retun Observer self
1529
+ * @retun boolean check result
1533
1530
  */
1534
1531
  observes: function(event, callback) {
1535
1532
  if (this.$listeners) {
@@ -1624,14 +1621,12 @@ var Observer = new Class({
1624
1621
  */
1625
1622
  createShortcuts: function(object, names) {
1626
1623
  (names || []).each(function(name) {
1627
- var shortcuts = {}, method_name = name.replace(/:/g, '_').camelize();
1628
- shortcuts[method_name] = function() {
1629
- return this.fire.apply(this, [name].concat($A(arguments)));
1630
- };
1631
- shortcuts['on'+method_name.capitalize()] = function() {
1632
- return this.on.apply(this, [name].concat($A(arguments)));
1633
- };
1634
- $ext(object, shortcuts, true);
1624
+ var method_name = 'on'+name.replace(/:/g, '_').camelize().capitalize();
1625
+ if (!defined(object[method_name])) {
1626
+ object[method_name] = function() {
1627
+ return this.on.apply(this, [name].concat($A(arguments)));
1628
+ };
1629
+ }
1635
1630
  });
1636
1631
 
1637
1632
  return object;
@@ -1639,7 +1634,7 @@ var Observer = new Class({
1639
1634
  }
1640
1635
  });
1641
1636
 
1642
- $alias(Observer.prototype, { on: 'observe' });
1637
+ $alias(Observer.prototype, { observe: 'on' });
1643
1638
 
1644
1639
  /**
1645
1640
  * iterators in-callbacks break exception
@@ -1659,7 +1654,7 @@ var Break = new Class(Error, {
1659
1654
  * The additional method names are inspired by
1660
1655
  * - Prototype (http://prototypejs.org) Copyright (C) Sam Stephenson
1661
1656
  *
1662
- * Copyright (C) 2008-2009 Nikolay V. Nemshilov aka St. <nemshilov#gma-ilc-om>
1657
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov aka St. <nemshilov#gma-ilc-om>
1663
1658
  */
1664
1659
  var Event = new Class(Event, {
1665
1660
  extend: {
@@ -1667,35 +1662,30 @@ var Event = new Class(Event, {
1667
1662
  * extends a native object with additional functionality
1668
1663
  *
1669
1664
  * @param Event event
1665
+ * @param Element bounding element
1670
1666
  * @return Event same event but extended
1671
1667
  */
1672
- ext: function(event) {
1668
+ ext: function(event, bound_element) {
1673
1669
  if (!event.stop) {
1674
1670
  $ext(event, this.Methods, true);
1675
1671
 
1676
1672
  if (Browser.IE) {
1677
1673
  // faking the which button
1678
- if (event.type == 'click' || event.type == 'dblclick') {
1679
- event.which = 1;
1680
- } else if (event.type == 'contextmenu') {
1681
- event.which = 3;
1682
- } else {
1683
- event.which = event.button == 2 ? 3 : event.button == 4 ? 2 : 1;
1684
- }
1674
+ event.which = event.button == 2 ? 3 : event.button == 4 ? 2 : 1;
1685
1675
 
1686
1676
  // faking the mouse position
1687
1677
  var scrolls = window.scrolls();
1688
1678
 
1689
1679
  event.pageX = event.clientX + scrolls.x;
1690
1680
  event.pageY = event.clientY + scrolls.y;
1691
-
1692
-
1693
- // faking the relatedTarget
1694
- event.relatedTarget = event.type == 'mouseover' ? event.fromEvent :
1695
- event.type == 'mouseout' ? event.toEvent : null;
1696
-
1681
+
1697
1682
  // faking the target property
1698
- event.target = event.srcElement;
1683
+ event.target = event.srcElement || bound_element;
1684
+
1685
+ // faking the relatedTarget, currentTarget and other targets
1686
+ event.relatedTarget = event[(event.target == event.fromElement ? 'to' : 'from') + 'Element'];
1687
+ event.currentTarget = bound_element;
1688
+ event.eventPhase = 3; // bubbling phase
1699
1689
  }
1700
1690
  }
1701
1691
 
@@ -1731,20 +1721,6 @@ var Event = new Class(Event, {
1731
1721
  return name;
1732
1722
  },
1733
1723
 
1734
- /**
1735
- * Registers some additional event extendsions
1736
- *
1737
- * @param Object methods
1738
- * @return void
1739
- */
1740
- addMethods: function(methods) {
1741
- $ext(this.Methods, methods);
1742
-
1743
- try { // extending the events prototype
1744
- $ext(Event.parent.prototype, methods, true);
1745
- } catch(e) {};
1746
- },
1747
-
1748
1724
  // the additional methods registry
1749
1725
  Methods: {}
1750
1726
  },
@@ -1761,8 +1737,23 @@ var Event = new Class(Event, {
1761
1737
  }
1762
1738
  });
1763
1739
 
1740
+
1741
+ /**
1742
+ * Registers some additional event extendsions
1743
+ *
1744
+ * @param Object methods
1745
+ * @return void
1746
+ */
1747
+ Event.addMethods = Event.include = function(methods) {
1748
+ $ext(this.Methods, methods);
1749
+
1750
+ try { // extending the events prototype
1751
+ $ext(Event.parent.prototype, methods, true);
1752
+ } catch(e) {};
1753
+ };
1754
+
1764
1755
  // hooking up the standard extendsions
1765
- Event.addMethods({
1756
+ Event.include({
1766
1757
  stopPropagation: function() {
1767
1758
  this.cancelBubble = true;
1768
1759
  },
@@ -1799,7 +1790,7 @@ Event.Custom = function(name, options) {
1799
1790
  /**
1800
1791
  * The DOM Element unit handling
1801
1792
  *
1802
- * Copyright (C) 2008-2009 Nikolay V. Nemshilov aka St. <nemshilov#gma-ilc-om>
1793
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov aka St. <nemshilov#gma-ilc-om>
1803
1794
  */
1804
1795
  self.Element = (function(old_Element) {
1805
1796
 
@@ -1845,7 +1836,7 @@ $ext(Element, {
1845
1836
  * will add them to prototype and will generate a non extensive static mirror
1846
1837
  *
1847
1838
  * USAGE:
1848
- * Element.addMethods({
1839
+ * Element.include({
1849
1840
  * foo: function(bar) {}
1850
1841
  * });
1851
1842
  *
@@ -1856,7 +1847,7 @@ $ext(Element, {
1856
1847
  * @param Boolean flag if the method should keep the existing methods alive
1857
1848
  * @return Element the global Element object
1858
1849
  */
1859
- addMethods: function(methods, dont_overwrite) {
1850
+ include: function(methods, dont_overwrite) {
1860
1851
  $ext(this.Methods, methods, dont_overwrite);
1861
1852
 
1862
1853
  try { // busting up the basic element prototypes
@@ -1870,9 +1861,12 @@ $ext(Element, {
1870
1861
  return this;
1871
1862
  },
1872
1863
 
1873
- Methods: {} // DO NOT Extend this object manually unless you really need it, use Element#addMethods
1864
+ Methods: {} // DO NOT Extend this object manually unless you really need it, use Element#include
1874
1865
  });
1875
1866
 
1867
+ // the old interface alias, NOTE will be nuked
1868
+ Element.addMethods = Element.include;
1869
+
1876
1870
  /**
1877
1871
  * The DOM Element unit structures handling module
1878
1872
  *
@@ -1890,9 +1884,9 @@ $ext(Element, {
1890
1884
  * The insertions system implementation is inspired by
1891
1885
  * - MooTools (http://mootools.net) Copyright (C) Valerio Proietti
1892
1886
  *
1893
- * Copyright (C) 2008 Nikolay V. Nemshilov aka St. <nemshilov#gma-ilc-om>
1887
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov aka St. <nemshilov#gma-ilc-om>
1894
1888
  */
1895
- Element.addMethods({
1889
+ Element.include({
1896
1890
  parent: function(css_rule) {
1897
1891
  return css_rule ? this.parents(css_rule)[0] : $(this.parentNode);
1898
1892
  },
@@ -1902,8 +1896,8 @@ Element.addMethods({
1902
1896
  },
1903
1897
 
1904
1898
  subNodes: function(css_rule) {
1905
- var first_child = this.firstChild;
1906
- return first_child ? (first_child.tagName ? [$(first_child)] : []
1899
+ var first_child = $(this.firstChild);
1900
+ return first_child ? (first_child.tagName && (!css_rule || first_child.match(css_rule)) ? [first_child] : []
1907
1901
  ).concat(this.rCollect.call(first_child, 'nextSibling', css_rule)) : [];
1908
1902
  },
1909
1903
 
@@ -1962,8 +1956,8 @@ Element.addMethods({
1962
1956
  var scripts, insertions = Element.insertions;
1963
1957
  position = isString(position) ? position.toLowerCase() : 'bottom';
1964
1958
 
1965
- if (isString(content)) {
1966
- content = content.stripScripts(function(s) { scripts = s; });
1959
+ if (isString(content) || isNumber(content)) {
1960
+ content = (''+content).stripScripts(function(s) { scripts = s; });
1967
1961
  }
1968
1962
 
1969
1963
  insertions[position](this, content.tagName ? content :
@@ -2006,9 +2000,9 @@ Element.addMethods({
2006
2000
  * @return Element self
2007
2001
  */
2008
2002
  update: function(content) {
2009
- if (isString(content)) {
2003
+ if (isString(content) || isNumber(content)) {
2010
2004
  var scripts;
2011
- this.innerHTML = content.stripScripts(function(s) { scripts = s; });
2005
+ this.innerHTML = (''+content).stripScripts(function(s) { scripts = s; });
2012
2006
  if (scripts) $eval(scripts);
2013
2007
  } else {
2014
2008
  this.clean().insert(content);
@@ -2161,9 +2155,9 @@ $alias(Element.insertions.wraps, {
2161
2155
  * - MooTools (http://mootools.net) Copyright (C) Valerio Proietti
2162
2156
  * - Dojo (www.dojotoolkit.org) Copyright (C) The Dojo Foundation
2163
2157
  *
2164
- * Copyright (C) 2008-2009 Nikolay V. Nemshilov aka St. <nemshilov#gma-ilc-om>
2158
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov aka St. <nemshilov#gma-ilc-om>
2165
2159
  */
2166
- Element.addMethods({
2160
+ Element.include({
2167
2161
  /**
2168
2162
  * assigns styles out of the hash to the element
2169
2163
  *
@@ -2329,9 +2323,9 @@ Element.addMethods({
2329
2323
  * Most of the naming system in the module inspired by
2330
2324
  * - Prototype (http://prototypejs.org) Copyright (C) Sam Stephenson
2331
2325
  *
2332
- * Copyright (C) 2008 Nikolay V. Nemshilov aka St. <nemshilov#gma-il>
2326
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov aka St. <nemshilov#gma-il>
2333
2327
  */
2334
- Element.addMethods({
2328
+ Element.include({
2335
2329
  /**
2336
2330
  * sets the element attributes
2337
2331
  *
@@ -2340,7 +2334,7 @@ Element.addMethods({
2340
2334
  * @return Element self
2341
2335
  */
2342
2336
  set: function(hash, value) {
2343
- if (value) { var val = {}; val[hash] = value; hash = val; }
2337
+ if (typeof(hash) === 'string') { var val = {}; val[hash] = value; hash = val; }
2344
2338
 
2345
2339
  for (var key in hash) {
2346
2340
  // some attributes are not available as properties
@@ -2426,9 +2420,11 @@ Element.addMethods({
2426
2420
  * @return Element self
2427
2421
  */
2428
2422
  show: function(effect, options) {
2429
- // setting 'block' for the divs and 'inline' for the other elements hidden on the css-level
2430
- var value = this.tagName == 'DIV' ? 'block' : 'inline';
2431
- this.style.display = this._$pd == 'none' ? value : this._$pd || value;
2423
+ if (this.getStyle('display') == 'none') {
2424
+ // setting 'block' for the divs and 'inline' for the other elements hidden on the css-level
2425
+ var value = this.tagName == 'DIV' ? 'block' : 'inline';
2426
+ this.style.display = this._$pd == 'none' ? value : this._$pd || value;
2427
+ }
2432
2428
  return this;
2433
2429
  },
2434
2430
 
@@ -2460,9 +2456,9 @@ Element.addMethods({
2460
2456
  * this module contains the Element's part of functionality
2461
2457
  * responsible for the dimensions and positions getting/setting
2462
2458
  *
2463
- * Copyright (C) 2008-2009 Nikolay V. Nemshilov aka St. <nemshilov#gma-il>
2459
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov aka St. <nemshilov#gma-il>
2464
2460
  */
2465
- Element.addMethods({
2461
+ Element.include({
2466
2462
  /**
2467
2463
  * Returns the element sizes as a hash
2468
2464
  *
@@ -2619,9 +2615,9 @@ Element.addMethods({
2619
2615
  /**
2620
2616
  * DOM Element events handling methods
2621
2617
  *
2622
- * Copyright (C) 2008-2009 Nikolay V. Nemshilov aka St. <nemshilov#gma-il>
2618
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov aka St. <nemshilov#gma-il>
2623
2619
  */
2624
- Element.addMethods((function() {
2620
+ Element.include((function() {
2625
2621
  var observer = Observer.create({},
2626
2622
  $w('click rightclick contextmenu mousedown mouseup mouseover mouseout mousemove keypress keydown keyup')
2627
2623
  );
@@ -2636,7 +2632,7 @@ Element.addMethods((function() {
2636
2632
  observer.observe.toString().replace(/(\$listeners\.push\((\w+?)\);)/, '$1'+
2637
2633
  '$2.e=Event.cleanName($2.e);$2.n=Event.realName($2.e);'+
2638
2634
 
2639
- '$2.w=function(){var a=$A(arguments),e=($2.r&&$2.r!=="stopEvent")?a.shift():Event.ext(a[0]);'+
2635
+ '$2.w=function(){var a=$A(arguments),e=($2.r&&$2.r!=="stopEvent")?a.shift():Event.ext(a[0],this);'+
2640
2636
  'return $2.f.apply(this,a.concat($2.a))};'+(
2641
2637
 
2642
2638
  self.attachEvent ?
@@ -2669,6 +2665,8 @@ Element.addMethods((function() {
2669
2665
  $ext(window, observer);
2670
2666
  $ext(document, observer);
2671
2667
 
2668
+ Observer.createShortcuts(window, $w('blur focus scroll'));
2669
+
2672
2670
  return observer;
2673
2671
  })());
2674
2672
 
@@ -2679,9 +2677,9 @@ Element.addMethods((function() {
2679
2677
  * NOTE: this module is just a wrap over the native CSS-selectors feature
2680
2678
  * see the olds/css.js file for the manual selector code
2681
2679
  *
2682
- * Copyright (C) 2008-2009 Nikolay V. Nemshilov aka St. <nemshilov#gma-ilc-om>
2680
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov aka St. <nemshilov#gma-ilc-om>
2683
2681
  */
2684
- Element.addMethods((function() {
2682
+ Element.include((function() {
2685
2683
  /**
2686
2684
  * Native css-selectors include the current element into the search context
2687
2685
  * and as we actually search only inside of the element we add it's tag
@@ -2815,7 +2813,7 @@ return {
2815
2813
  */
2816
2814
  [window, document].each(function(object) {
2817
2815
  Observer.createShortcuts(object, ['ready']);
2818
- var ready = object.ready.bind(object);
2816
+ var ready = object.fire.bind(object, 'ready');
2819
2817
 
2820
2818
  // IE and Konqueror browsers
2821
2819
  if (document.readyState !== undefined) {
@@ -2835,7 +2833,7 @@ return {
2835
2833
  * The basic principles of the module are inspired by
2836
2834
  * - Prototype (http://prototypejs.org) Copyright (C) Sam Stephenson
2837
2835
  *
2838
- * Copyright (C) 2009 Nikolay V. Nemshilov aka St. <nemshilov#gma-ilc-om>
2836
+ * Copyright (C) 2009-2010 Nikolay V. Nemshilov aka St. <nemshilov#gma-ilc-om>
2839
2837
  */
2840
2838
  var Form = function(options) {
2841
2839
  var options = options || {}, remote = options.remote,
@@ -2865,7 +2863,7 @@ $ext(Form, {
2865
2863
  * @param Object methods hash
2866
2864
  * @return void
2867
2865
  */
2868
- addMethods: function(methods, dont_overwrite) {
2866
+ include: function(methods, dont_overwrite) {
2869
2867
  $ext(Form.Methods, methods, dont_overwrite);
2870
2868
 
2871
2869
  try { // trying to extend the form element prototype
@@ -2874,7 +2872,8 @@ $ext(Form, {
2874
2872
  }
2875
2873
  });
2876
2874
 
2877
- Form.addMethods({
2875
+ Form.addMethods = Form.include;
2876
+ Form.include({
2878
2877
  /**
2879
2878
  * returns the form elements as an array of extended units
2880
2879
  *
@@ -2963,7 +2962,7 @@ Form.addMethods({
2963
2962
  });
2964
2963
 
2965
2964
  // creating the shortcuts
2966
- Form.addMethods(Observer.createShortcuts({}, $w('submit reset focus')), true);
2965
+ Form.include(Observer.createShortcuts({}, $w('submit reset focus')), true);
2967
2966
 
2968
2967
 
2969
2968
 
@@ -2974,7 +2973,7 @@ Form.addMethods(Observer.createShortcuts({}, $w('submit reset focus')), true);
2974
2973
  * The basic ideas are taken from
2975
2974
  * - Prototype (http://prototypejs.org) Copyright (C) Sam Stephenson
2976
2975
  *
2977
- * Copyright (C) 2009 Nikolay V. Nemshilov aka St. <nemshilov#gma-ilc-om>
2976
+ * Copyright (C) 2009-2010 Nikolay V. Nemshilov aka St. <nemshilov#gma-ilc-om>
2978
2977
  */
2979
2978
  (function() {
2980
2979
  // trying to get the input element classes list
@@ -3006,7 +3005,7 @@ Form.addMethods(Observer.createShortcuts({}, $w('submit reset focus')), true);
3006
3005
  * @param Object methods list
3007
3006
  * @return void
3008
3007
  */
3009
- addMethods: function(methods, dont_overwrite) {
3008
+ include: function(methods, dont_overwrite) {
3010
3009
  $ext(this.Methods, methods, dont_overwrite);
3011
3010
 
3012
3011
  // extending the input element prototypes
@@ -3025,8 +3024,8 @@ Form.addMethods(Observer.createShortcuts({}, $w('submit reset focus')), true);
3025
3024
  });
3026
3025
  });
3027
3026
  })();
3028
-
3029
- Form.Element.addMethods({
3027
+ Form.Element.addMethods = Form.Element.include;
3028
+ Form.Element.include({
3030
3029
  /**
3031
3030
  * uniform access to the element values
3032
3031
  *
@@ -3119,7 +3118,7 @@ Form.Element.addMethods({
3119
3118
  });
3120
3119
 
3121
3120
  // creating the common event shortcuts
3122
- Form.Element.addMethods(Observer.createShortcuts({}, $w('disable enable focus blur change')), true);
3121
+ Form.Element.include(Observer.createShortcuts({}, $w('disable enable focus blur change')), true);
3123
3122
 
3124
3123
 
3125
3124
  /**
@@ -3445,15 +3444,20 @@ var Xhr = new Class(Observer, {
3445
3444
 
3446
3445
  // sanitizes the json-response texts
3447
3446
  sanitizedJSON: function() {
3448
- // checking the JSON response formatting
3449
- if (!(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(this.text.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, ''))) {
3450
- if (this.secureJSON) {
3451
- throw "JSON parse error: "+this.text;
3452
- } else {
3453
- return null;
3447
+ try {
3448
+ return JSON.parse(this.text);
3449
+ } catch(e) {
3450
+ // manual json consistancy check
3451
+ if (self.JSON || !(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(this.text.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, ''))) {
3452
+ if (this.secureJSON) {
3453
+ throw "JSON parse error: "+this.text;
3454
+ } else {
3455
+ return null;
3456
+ }
3454
3457
  }
3455
3458
  }
3456
3459
 
3460
+ // the fallback JSON extraction
3457
3461
  return eval("("+this.text+")");
3458
3462
  },
3459
3463
 
@@ -3520,9 +3524,9 @@ Xhr.onCreate(function() {
3520
3524
  * - Prototype (http://prototypejs.org) Copyright (C) Sam Stephenson
3521
3525
  * - jQuery (http://jquery.com) Copyright (C) John Resig
3522
3526
  *
3523
- * Copyright (C) 2009 Nikolay V. Nemshilov aka St. <nemshilov#gma-ilc-om>
3527
+ * Copyright (C) 2009-2010 Nikolay V. Nemshilov aka St. <nemshilov#gma-ilc-om>
3524
3528
  */
3525
- Form.addMethods({
3529
+ Form.include({
3526
3530
  /**
3527
3531
  * sends the form via xhr request
3528
3532
  *
@@ -3576,9 +3580,9 @@ Form.addMethods({
3576
3580
  * Credits:
3577
3581
  * - jQuery (http://jquery.com) Copyright (C) John Resig
3578
3582
  *
3579
- * Copyright (C) 2008-2009 Nikolay V. Nemshilov aka St. <nemshilov#gma-il>
3583
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov aka St. <nemshilov#gma-il>
3580
3584
  */
3581
- Element.addMethods({
3585
+ Element.include({
3582
3586
  /**
3583
3587
  * performs an Xhr request to the given url
3584
3588
  * and updates the element internals with the responseText
@@ -4313,9 +4317,9 @@ Fx.Scroll = new Class(Fx, {
4313
4317
  * Some ideas are inspired by
4314
4318
  * - MooTools (http://mootools.net) Copyright (C) Valerio Proietti
4315
4319
  *
4316
- * Copyright (C) 2008-2009 Nikolay V. Nemshilov aka St. <nemshilov#gma-ilc-om>
4320
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov aka St. <nemshilov#gma-ilc-om>
4317
4321
  */
4318
- Element.addMethods((function(methods) {
4322
+ Element.include((function(methods) {
4319
4323
  var old_hide = methods.hide,
4320
4324
  old_show = methods.show,
4321
4325
  old_scroll = methods.scrollTo;
@@ -314,7 +314,7 @@ Tabs.Panel = new Class(Observer, {
314
314
 
315
315
  var controller = this.tab.controller;
316
316
  var options = controller.options;
317
- var prev_panel = controller.element.subNodes().first('hasClass', 'right-tabs-panel-current');
317
+ var prev_panel = controller.element.first('.right-tabs-panel-current');
318
318
  var this_panel = this.element;
319
319
  var swapping = prev_panel != this_panel;
320
320
  var loading = this.element.first('div.right-tabs-panel-locker');
@@ -347,19 +347,23 @@ Tabs.Panel = new Class(Observer, {
347
347
  // wrapping the element with an overflowed element to visualize the resize
348
348
  var fx_wrapper = $E('div', {'class': 'right-tabs-resizer'});
349
349
  var set_back = fx_wrapper.replace.bind(fx_wrapper, this_panel);
350
- this_panel.wrap(fx_wrapper);
351
- fx_wrapper.setHeight(prev_panel_height);
350
+ fx_wrapper.style.height = prev_panel_height + 'px';
352
351
 
353
352
  // in case of harmonica nicely hidding the previous panel
354
353
  if (controller.isHarmonica && swapping) {
355
354
  prev_panel.addClass('right-tabs-panel-current');
356
- var hide_wrapper = $E('div', {'class': 'right-tabs-resizer'}).setHeight(prev_panel.offsetHeight);
355
+ var hide_wrapper = $E('div', {'class': 'right-tabs-resizer'});
356
+ hide_wrapper.style.height = prev_panel.offsetHeight + 'px';
357
357
  var prev_back = function() {
358
358
  hide_wrapper.replace(prev_panel.removeClass('right-tabs-panel-current'));
359
359
  };
360
360
  prev_panel.wrap(hide_wrapper);
361
+
362
+ fx_wrapper.style.height = '0px';
361
363
  }
362
364
 
365
+ this_panel.wrap(fx_wrapper);
366
+
363
367
  // getting back the auto-size so we could resize it
364
368
  controller.element.style.height = 'auto';
365
369
 
@@ -794,20 +798,17 @@ return {
794
798
  * @return Tabs this
795
799
  */
796
800
  startLoop: function(delay) {
797
- if (isNumber(delay)) this.options.loop = delay;
801
+ if (!delay && !this.options.loop) return this;
798
802
 
799
803
  // attaching the loop pause feature
800
804
  if (this.options.loopPause) {
801
- this._stopLoop = this._stopLoop || this.stopLoop.bind(this);
802
- this._startLoop = this._startLoop || this.startLoop.bind(this);
805
+ this._stopLoop = this._stopLoop || this.stopLoop.bind(this, true);
806
+ this._startLoop = this._startLoop || this.startLoop.bind(this, delay);
803
807
 
804
- this.element
805
- .stopObserving('mouseover', this._stopLoop)
806
- .stopObserving('mouseout', this._startLoop)
807
- .on({
808
- mouseover: this._stopLoop,
809
- mouseout: this._startLoop
810
- });
808
+ this.forgetHovers().on({
809
+ mouseover: this._stopLoop,
810
+ mouseout: this._startLoop
811
+ });
811
812
  }
812
813
 
813
814
  if (this.timer) this.timer.stop();
@@ -819,7 +820,7 @@ return {
819
820
 
820
821
  this.show(next || enabled.first());
821
822
 
822
- }.bind(this).periodical(this.options.loop);
823
+ }.bind(this).periodical(this.options.loop || delay);
823
824
 
824
825
  return this;
825
826
  },
@@ -829,13 +830,23 @@ return {
829
830
  *
830
831
  * @return Tabs this
831
832
  */
832
- stopLoop: function() {
833
+ stopLoop: function(event, pause) {
833
834
  if (this.timer) {
834
835
  this.timer.stop();
835
836
  this.timer = null;
836
837
  }
838
+ if (!pause && this._startLoop)
839
+ this.forgetHovers();
840
+ },
841
+
842
+ // private
843
+ forgetHovers: function() {
844
+ return this.element
845
+ .stopObserving('mouseover', this._stopLoop)
846
+ .stopObserving('mouseout', this._startLoop);
837
847
  }
838
848
 
849
+
839
850
  }})());
840
851
 
841
852
  /**