right-rails 0.4.4 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. data/init.rb +37 -8
  2. data/javascripts/right-autocompleter-src.js +55 -41
  3. data/javascripts/right-autocompleter.js +2 -2
  4. data/javascripts/right-behavior-src.js +5 -5
  5. data/javascripts/right-behavior.js +2 -2
  6. data/javascripts/right-calendar-src.js +139 -67
  7. data/javascripts/right-calendar.js +2 -2
  8. data/javascripts/right-dnd-src.js +7 -7
  9. data/javascripts/right-dnd.js +2 -2
  10. data/javascripts/right-effects-src.js +9 -9
  11. data/javascripts/right-effects.js +2 -2
  12. data/javascripts/right-events-src.js +8 -8
  13. data/javascripts/right-events.js +2 -2
  14. data/javascripts/right-in-edit-src.js +10 -8
  15. data/javascripts/right-in-edit.js +2 -2
  16. data/javascripts/right-json-src.js +14 -15
  17. data/javascripts/right-json.js +2 -2
  18. data/javascripts/right-lightbox-src.js +141 -86
  19. data/javascripts/right-lightbox.js +3 -3
  20. data/javascripts/right-olds-src.js +26 -48
  21. data/javascripts/right-olds.js +2 -2
  22. data/javascripts/right-rails-src.js +109 -31
  23. data/javascripts/right-rails.js +2 -2
  24. data/javascripts/right-rater-src.js +20 -12
  25. data/javascripts/right-rater.js +2 -2
  26. data/javascripts/right-selectable-src.js +3 -3
  27. data/javascripts/right-selectable.js +1 -1
  28. data/javascripts/right-slider-src.js +3 -3
  29. data/javascripts/right-slider.js +1 -1
  30. data/javascripts/right-sortable-src.js +28 -28
  31. data/javascripts/right-sortable.js +2 -2
  32. data/javascripts/right-src.js +612 -405
  33. data/javascripts/right-tabs-src.js +115 -44
  34. data/javascripts/right-tabs.js +2 -2
  35. data/javascripts/right-tooltips-src.js +131 -74
  36. data/javascripts/right-tooltips.js +2 -2
  37. data/javascripts/right-ui-i18n-fr.js +4 -4
  38. data/javascripts/right-uploader-src.js +170 -0
  39. data/javascripts/right-uploader.js +9 -0
  40. data/javascripts/right.js +2 -4
  41. data/lib/right_rails.rb +1 -1
  42. data/lib/right_rails/helpers/basic.rb +10 -2
  43. data/lib/right_rails/helpers/misc.rb +16 -17
  44. data/lib/right_rails/helpers/rails.rb +0 -7
  45. data/spec/lib/right_rails/helpers/basic_spec.rb +0 -1
  46. data/spec/lib/right_rails/helpers/rails_spec.rb +24 -0
  47. data/spec/spec_helper.rb +9 -1
  48. metadata +14 -5
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Visit http://rightjs.org/ui/rater for details
5
5
  *
6
- * Copyright (C) 2009 Nikolay V. Nemshilov aka St.
6
+ * Copyright (C) 2009-2010 Nikolay V. Nemshilov
7
7
  */
8
8
  if (!self.RightJS) throw "Gimme RightJS";
9
- eval((function(s,d){for(var i=d.length-1;i>-1;i--)if(d[i])s=s.replace(new RegExp(i,'g'),d[i]);return s})("32 39=59 77(Observer,{extend:{EVENTS:$w('53 55 28'),Options:{29:5,19:23,25:23,16:58,26:58,62:23,61:'rate',60:23},51:4(s){($(s)||22).select('21.17-14').44(4(e){if(!e._14)59 39(e)})}},71ialize:4(){32 a=$A(arguments);2.13=(a[0]&&!47(a[0]))?$(a[0]):23;2.$super(47(a.70())?a.70():2.13?eval('('+2.13.get('data-14-12')+')'):23);if(!2.13)2.13=2.63();2.13._14=2.71()},20:4(v){if(!2.16()){v=isString(v)?v.toInt():v;v=isNumber(v)?v.round():0;if(v>2.12.29)v=2.12.29;69 if(v<0)v=0;2.24(v);if(2.19!=v)2.45('53',2.19=v,2)}18 2},getValue:4(){18 2.19},38:4(e,p){2.13.38(e,p);18 2},36:4(b){32 a=4(e,v){if(e=$(e)){if(v===undefined||v===23)v='';e[e.20?'20':'25'](''+v)}}.57(b);32 c=4(e,o){32 e=$(e);if(e&&e.27)e.27(4(){2.20(e.19)}.30(o))}.57(b);if($(b)){a(2.19);c(2)}69 22.41(4(){a(2.19);c(2)}.30(2));18 2.27(a)},28:4(){if(2.12.62){59 60(2.12.62,2.12.60).28(2.12.61+\"=\"+2.19);2.45('28',2.19,2)}18 2},31:4(){2.13.35('17-14-16');18 2},enable:4(){2.13.34('17-14-16');18 2},16:4(){18 2.13.has77('17-14-16')},40:4(i){if(!2.16()){2.24(i+1);2.45('55',i+1,2)}},43:4(i){2.20(i+1);if(2.12.26)2.31();2.28()},54:4(){2.20(2.19)},24:4(n){2.37.44(4(e,a){e[n-1<a?'34':'35']('17-14-74')})},71:4(){2.37=2.13.subNodes();2.37.44(4(e,i){e.onMouseover(2.40.30(2,i)).onClick(2.43.30(2,i))},2);2.13.onMouseout(2.54.30(2));2.20(2.12.19);if(2.12.16)2.31();if(2.12.25)2.36(2.12.25);18 2},63:4(){32 e=$E('21',{'class':'17-14'});2.12.29.times(4(){e.insert($E('21',{html:'&#9733;'}))});18 e}});22.41(4(){39.51()});22.write(\"<65 type=\\\"46/css\\\">21.17-14,21.17-14 21{margin:0;padding:0;background:75;border:75;42:52-block;*42:52;*zoom:1;76-family:Arial;76-29:110%}21.17-14{67:6em;vertical-68:middle}21.17-14 21{67:64;48:64;line-48:64;46-68:center;50:pointer;56:#888}21.17-14 21.17-14-74{56:brown;46-shadow:#666 .72 .72 .15em}21.17-14-16 21{50:default}</65>\");",",,this,,function,,,,,,,,options,element,rater,,disabled,right,return,value,setValue,div,document,null,highlight,update,disableOnVote,onChange,send,size,bind,disable,var,,removeClass,addClass,assignTo,stars,insertTo,Rater,hovered,onReady,display,clicked,each,fire,text,isHash,height,_rater,cursor,rescan,inline,change,leaved,hover,color,curry,false,new,Xhr,param,url,build,1em,style,,width,align,else,last,init,05em,,glow,none,font,Class".split(",")));
9
+ eval((function(s,d){for(var i=d.length-1;i>-1;i--)if(d[i])s=s.replace(new RegExp(i,'g'),d[i]);return s})("23 57=61 Class(Observer,{extend:{EVENTS:$w('54 67 30'),Options:{31:5,18:22,26:22,17:68,25:68,63:22,55:'rate',56:22},rescan:4(s){}},69ialize:4(){23 a=$A(arguments);2.13=(a[0]&&!51(a[0]))?$(a[0]):22;2.$super(51(a.70())?a.70():2.13?eval('('+2.13.get('data-14-12')+')'):22);if(!2.13)2.13=2.64();if(!2.12.18)2.12.18=2.13.select('.16-14-48').length;2.13._14=2.69()},20:4(v){if(!2.17()){v=isString(v)?v.toInt():v;v=isNumber(v)?v.round():0;if(v>2.12.31)v=2.12.31;71 if(v<0)v=0;2.24(v);if(2.18!=v)2.37('54',2.18=v,2)}19 2},getValue:4(){19 2.18},40:4(e,p){2.13.40(e,p);19 2},41:4(b){23 a=4(e,v){if(e=$(e)){if(v===undefined||v===22)v='';e[e.20?'20':'26'](''+v)}}.58(b);23 c=4(e,o){23 e=$(e);if(e&&e.28)e.28(4(){2.20(e.18)}.29(o))}.58(b);if($(b)){a(2.18);c(2)}71 27.onReady(4(){a(2.18);c(2)}.29(2));19 2.28(a)},30:4(){if(2.12.63){61 56(2.12.63,2.12.56).30(2.12.55+\"=\"+2.18);2.37('30',2.18,2)}19 2},35:4(){2.13.42('16-14-17');19 2},enable:4(){2.13.34('16-14-17');19 2},17:4(){19 2.13.38('16-14-17')},46:4(i){if(!2.17()){2.24(i+1);2.37('67',i+1,2)}},44:4(i){2.20(i+1);if(2.12.25)2.35();2.30()},50:4(){2.20(2.18)},24:4(n){2.39.76(4(e,a){e[n-1<a?'34':'42']('16-14-48')})},69:4(){2.39=2.13.subNodes();2.39.76(4(e,i){e.32(2.46.29(2,i)).onClick(2.44.29(2,i))},2);2.13.onMouseout(2.50.29(2));2.20(2.12.18);if(2.12.17)2.35();if(2.12.26)2.41(2.12.26);19 2},64:4(){23 e=$E('21',{'class':'16-14'});2.12.31.times(4(){e.insert($E('21',{html:'&#9733;'}))});19 e}});27.32(4(a){23 t=a.target,e=[t].concat(t.parents()).first('38','16-14');if(e){23 r=e._14||61 57(e);if(t.parentNode===e)t.37('mouseover')}});27.write(\"<59 type=\\\"47/css\\\">21.16-14,21.16-14 21{margin:0;padding:0;background:75;border:75;45:49-block;*45:49;*zoom:1;74-family:Arial;74-31:110%}21.16-14{62:6em;36:43;vertical-65:middle}21.16-14 21{float:left;62:43;36:43;line-36:43;47-65:center;52:pointer;60:#888}21.16-14 21.16-14-48{60:brown;47-shadow:#666 .72 .72 .15em}21.16-14-17 21{52:default}</59>\");",",,this,,function,,,,,,,,options,element,rater,,right,disabled,value,return,setValue,div,null,var,highlight,disableOnVote,update,document,onChange,bind,send,size,onMouseover,,removeClass,disable,height,fire,hasClass,stars,insertTo,assignTo,addClass,1em,clicked,display,hovered,text,glow,inline,leaved,isHash,cursor,_rater,change,param,Xhr,Rater,curry,style,color,new,width,url,build,align,,hover,false,init,last,else,05em,,font,none,each".split(",")));
@@ -1,14 +1,14 @@
1
1
  /**
2
2
  * Selectable unit for RightJS (http://rightjs.org/ui/selectable)
3
3
  *
4
- * Copyright (C) 2009 Nikolay V. Nemshilov aka St.
4
+ * Copyright (C) 2009 Nikolay V. Nemshilov
5
5
  */
6
6
  if (!self.RightJS) throw "Gimme RightJS";
7
7
 
8
8
  /**
9
9
  * Selectable unit main script
10
10
  *
11
- * Copyright (C) 2009 Nikolay V. Nemshilov aka St.
11
+ * Copyright (C) 2009 Nikolay V. Nemshilov
12
12
  */
13
13
  var Selectable = new Class(Observer, {
14
14
  extend: {
@@ -536,7 +536,7 @@ var Selectable = new Class(Observer, {
536
536
  /**
537
537
  * The document on-load hook for Selectable
538
538
  *
539
- * Copyright (C) 2009 Nikolay V. Nemshilov aka St.
539
+ * Copyright (C) 2009 Nikolay V. Nemshilov
540
540
  */
541
541
  document.onReady(function() { Selectable.rescan(); });
542
542
 
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Selectable unit for RightJS (http://rightjs.org/ui/selectable)
3
3
  *
4
- * Copyright (C) 2009 Nikolay V. Nemshilov aka St.
4
+ * Copyright (C) 2009 Nikolay V. Nemshilov
5
5
  */
6
6
  if (!self.RightJS) throw "Gimme RightJS";
7
7
  eval((function(s,d){for(var i=d.length-1;i>-1;i--)if(d[i])s=s.replace(new RegExp(i,'g'),d[i]);return s})("24 69=new 164(Observer,{extend:{EVENTS:$w('140 25 un25 72 111 81 149 113 116'),Options:{15:46,19:46,23:46,49:96,68:'slide',70:'short',36:46,129:148,155:'&bull;',54:96},139:11(s){($(s)||42).25('*.13-12').32(11(e){if(!e._12)new 69(e)})}},118:'13-12',59:'13-12-142',17:'13-12-19',23164:'13-12-23',18164:'13-12-18',160ialize:11(){24 a=$A(76);if(a[0]&&!144(a[0]))9.16=$(a[0]);9.104(144(a.157())?a.157():9.16?eval('('+9.16.get('data-12-15')+')'):46);if(!9.16)9.16=9.130();47 if(9.16.136=='SELECT'){9.25box=9.82(9.16);9.16=9.130().45(9.25box,'105');9.90(9.95(9.25box))}9.16._12=9.160()},destroy:11(){9.21.32(11(i){i.28('99',9.55).28('65',9.71).28('57',9.62).28('53',9.58).28('74',9.83)},9);delete(9.16._12)},61:11(v){if(92(v))v=v.split(',').117('trim').106(11(a){14!a.blank()});9.21.32('37',9.17);24 i=9.34(v).32('48',9.17);if(9.22)9.93(i[0]);14 9.52()},getValue:11(){14 9.39},45:11(e,p){9.16.45(e,p);if(9.22)9.18.45(9.16,'105');14 9},90:11(b){24 a=11(e,v){if(e=$(e)){if(v===undefined||v===46)v='';e[e.61?'61':'36'](e.156=='25-49'?v:''+v)}}.151(b);24 c=11(e,o){24 e=$(e);if(e&&e.89)e.89(11(){9.61(e.39)}.31(o))}.151(b);if($(b)){a(9.39);c(9)}47 42.133(11(){a(9.39);c(9)}.31(9));14 9.89(a)},72:11(k){9.43(k).32(11(i){9.33('72',i.48(9.23164))},9);14 9},111:11(k){9.43(k).32(11(i){9.33('111',i.37(9.23164))},9);14 9},23:11(k){14 9.43(k).150('30',9.23164)},25:11(k){24 a=9.34(k);if(9.22&&a){9.21.32('37',9.17);a=[a[0]]}a.32(11(i){9.33('25',i.48(9.17))},9);14 9},un25:11(k){9.34(k).32(11(i){9.33('un25',i.37(9.17))},9);14 9},19:11(k){14 9.34(k).150('30',9.17)},54:11(){9.21=9.16.25('li').32(11(i){if(!9.21||!9.21.include(i))i.on({99:9.55,74:9.83,53:9.58,57:9.62,65:9.71})},9);14 9},160:11(){9.16.48(9.118);if(9.22=!9.15.49||9.16.30(9.59))9.101().16.48(9.59);9.58=9.53.31(9);9.83=9.74.31(9);9.62=9.57.31(9);9.71=9.65.31(9);9.55=9.99.31(9);9.39=46;9.54().94('52').onUn25('52');if(9.22)9.94('93');if(9.15.23)9.72(9.15.23);if(9.15.19)9.25(9.15.19);if(9.15.36)9.90(9.15.36);if(9.22){if(9.15.19===46)9.25(9.21[0]);9.94('91')}if(9.15.54){24 o=9.16.36;9.16.36=11(){24 r=o.153(9.16,76);9.54();14 r}.31(9)}14 9},52:11(){if(9.22){24 a=9.21.128('30',9.17);24 v=a?9.80(a):46}47 24 v=9.21.106('30',9.17).117(11(i){14 9.80(i)},9);if(v!=9.39){9.39=v;9.33('140',v,9)}14 9},80:11(i){14 i.id?9.15.129?i.id.match(/\\d+/):i.id:9.21.73(i)},33:11(n,i){if(i&&i.136)9.104(n,i,9.21.73(i),9);47 9.104.153(9,76);14 9},117:11(c){if(!135(c))c=[c];14 c.117(11(k){24 i=(92(k)&&/^\\d+$/.test(k))?k.toInt():k,b=k;if(isNumber(i))b=9.21[i];47 if(92(k))b=9.21.128(11(a){14 a.id==k});14 b},9).compact()},43:11(k){14 k?9.117(k):9.21},34:11(k){14 9.43(k).106(11(i){14!i.30(9.23164)},9)},53:11(e){e.121();24 c=e.107;if(!9.23(c)){if(9.22)9.25(c);47 if(9.19(c)){9.un25(c);9.63=96}47{9.25(c);9.67=96}if((e.shiftKey||e.metaKey)&&9.56){24 a=9.21.73(9.56);24 b=9.21.73(c);if(a!=b){if(a>b){24 t=a;a=b;b=a}for(24 i=a;i<b;i++)9[9.56.30(9.17)?'25':'un25'](9.21[i])}}9.56=c}},74:11(e){e.121();9.63=9.67=148},57:11(e){24 i=e.107;9.33('81',i);if(!9.22){if(9.67)9.25(i);47 if(9.63)9.un25(i)}},65:11(e){9.33('149',e.107)},99:11(e){e.121()},130:11(){24 e=$E('ul'),a=9.15.15;if(135(a))a.32(11(o){e.108($E('li',{137:o}))});47 for(24 k in a)e.108($E('li',{id:k,137:a[k]}));14 e},101:11(){9.18=$E('41',{'152':9.18164}).108([$E('41',{'137':9.15.155,'152':'13-12-141'}),$E('ul')]).45(9.16,'105').55(9.113165.31(9));42.55(9.91.31(9));14 9},113165:11(e){e.121();if(9.22){24 d=9.18.dimensions();9.16.setStyle({top:(d.top+d.50)+'px',119:d.119+'px',38:d.38+'px'}).113(9.15.68,{126:9.15.70,124:9.33.31(9,'113',9)});if(!9.15.68)9.33('113',9)}},91:11(){if(9.22&&9.16.visible()){9.16.116(9.15.68,{126:9.15.70,124:9.33.31(9,'116',9)});if(!9.15.68)9.33('116',9)}},93:11(i){9.18.128('ul').36(i?i.cloneNode(96):'<li>&nbsp;</li>')},82:11(b){24 a=9.15;if(b){a.49=b.has('49');a.15={};a.19=[];a.23=[];$A(b.getElementsByTagName('OPTION')).32(11(o,i){a.15[o.get('39')||o.120]=o.120;if(o.19)a.19.159(i);if(o.23)a.23.159(i)});if(a.19.empty())a.19=0}14 b},95:11(e){14 e.wrap($E('41',{78:'131:125;z-index:-1;visibility:109;38:0;50:0;123:109'}))}});42.133(11(){69.139()});42.write(\"<78 156=\\\"162/css\\\">*.13-12,*.13-12 li,*.13-12 dt,*.13-12 dd,*.13-12 ul,41.13-12-18 ul,41.13-12-18 ul li{146:0;51:0;27:98;26:98;list-78:98}*.13-12{27:114 79 #103;27-110:98;40:86-122;*40:86;*163:1;min-38:138;-154-27-85:.60;-112-27-85:.60}*.13-12 li{51:.3em 1em;87:134;27-110:114 79 #103}*.13-12 li:81{26:#EEE}*.13-12 li.13-12-19{97-143:161;26:#DDD}*.13-12 li.13-12-23,*.13-12 li.13-12-23:81{26:#103;102:#777;87:132}dl.13-12 dt{51:.3em .115;87:132;97-143:161;97-78:italic;102:#444;26:#EEE;27-110:114 79 #103}dl.13-12 dd li{51-119:1.115}*.13-12-142{-154-box-145:#AAA .60 .60 .115;-112-box-145:#AAA .60 .60 .115;40:98;131:125;26:#FFF}41.13-12-18{27:114 79 #103;-154-27-85:.60;-112-27-85:.60;40:86-122;*40:86;*163:1;*38:138;vertical-147:middle;min-38:138;87:134;50:1.6em}41.13-12-18 41.13-12-141{97-family:Arial;float:13;38:0.8em;26:#DDD;162-147:center;50:100%;158-50:0.8em;97-size:200%;102:#888;27-119:114 79 #103}41.13-12-18:81 41{102:#666}41.13-12-18 ul{40:122;38:auto;146-13:60;123:109}41.13-12-18 ul li{158-50:1.6em;51:0 .115}</78>\");",",,,,,,,,,this,,function,selectable,right,return,options,element,selectedClass,container,selected,,items,isSingle,disabled,var,select,background,border,stopObserving,disabledClass,hasClass,bind,each,fire,mapEnabled,unselect,update,removeClass,width,value,display,div,document,mapOrAll,,insertTo,null,else,addClass,multiple,height,padding,calcValue,mousedown,refresh,onClick,_prevItem,mouseover,onMousedown,singleClass,2em,setValue,onMouseover,_massRemove,_selectable,mouseout,,_massSelect,fxName,Selectable,fxDuration,onMouseout,disable,indexOf,mouseup,containerClass,arguments,,style,solid,itemValue,hover,harvestOptions,onMouseup,selectbox,radius,inline,cursor,,onChange,assignTo,hideList,isString,showItem,onSelect,hideOriginal,true,font,none,click,,buildSingle,color,CCC,$super,before,filter,target,insert,hidden,bottom,enable,webkit,show,1px,5em,hide,map,baseClass,left,innerHTML,stop,block,overflow,onFinish,absolute,duration,showList,first,parseIds,build,position,default,onReady,pointer,isArray,tagName,html,10em,rescan,change,handle,single,weight,isHash,shadow,margin,align,false,leave,every,curry,class,apply,moz,hCont,type,last,line,push,init,bold,text,zoom,Class,List".split(",")));
@@ -1,14 +1,14 @@
1
1
  /**
2
2
  * RightJS UI Slider unit (http://rightjs.org/ui/slider)
3
3
  *
4
- * Copyright (C) 2009 Nikolay V. Nemshilov aka St.
4
+ * Copyright (C) 2009 Nikolay V. Nemshilov
5
5
  */
6
6
  if (!self.RightJS || !self.Draggable) throw "Gimme RightJS w/ DnD";
7
7
 
8
8
  /**
9
9
  * RightJS UI Slider unit
10
10
  *
11
- * Copyright (C) 2009 Nikolay V. Nemshilov aka St.
11
+ * Copyright (C) 2009 Nikolay V. Nemshilov
12
12
  */
13
13
  var Slider = new Class(Observer, {
14
14
  extend: {
@@ -284,7 +284,7 @@ var Slider = new Class(Observer, {
284
284
  /**
285
285
  * Document onReady hook for sliders
286
286
  *
287
- * Copyright (C) 2009 Nikolay V. Nemshilov aka St.
287
+ * Copyright (C) 2009 Nikolay V. Nemshilov
288
288
  */
289
289
  document.onReady(function() { Slider.rescan(); });
290
290
 
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * RightJS UI Slider unit (http://rightjs.org/ui/slider)
3
3
  *
4
- * Copyright (C) 2009 Nikolay V. Nemshilov aka St.
4
+ * Copyright (C) 2009 Nikolay V. Nemshilov
5
5
  */
6
6
  if (!self.RightJS || !self.Draggable) throw "Gimme RightJS w/ DnD";
7
7
  eval((function(s,d){for(var i=d.length-1;i>-1;i--)if(d[i])s=s.replace(new RegExp(i,'g'),d[i]);return s})("14 50=78 83(Observer,{extend:{EVENTS:$w('69'),Options:{32:0,47:100,38:0,21:65,25:'x',39:65,55:0},67:9(s){($(s)||33).select('30.17-12').each(9(e){if(!e._12)78 50(e)})}},75ialize:9(){14 a=$A(arguments);7.13=(a[0]&&!70(a[0]))?$(a.shift()):7.74();7.$super(70(a[0])?a[0]:eval('('+7.13.get('data-12-8')+')'));if(7.8.39)7.54(7.8.39);7.13._12=7.75()},destroy:9(){7.16.undo82();delete(7.13._12);18 7},24:9(v){14 v=isString(v)?v.64():v;14 b=Math.pow(10,7.8.55);v=(v*b).55()/b;if(7.8.38){14 s=7.8.38;14 d=v % s;v=d<s/2?v-d:v-d+s}if(v<7.8.32)v=7.8.32;if(v>7.8.47)v=7.8.47;7.40(v);if(v!==7.21)7.fire('69',7.21=v);18 7},getValue:9(){18 7.21},53:9(v){18 7.36().24([v,7.8.21,7.8.32].compact()[0])},52:9(e,p){7.13.52(e,p);18 7.53(7.21)},54:9(b){14 a=9(e,v){if(e=$(e)){if(v===undefined||v===65)v='';e[e.24?'24':'39'](''+v)}}.72(b);14 c=9(e,o){14 e=$(e);if(e&&e.43)e.43(9(){7.24(e.21)}.45(o))}.72(b);if($(b)){a(7.21);c(7)}51 33.60(9(){a(7.21);c(7)}.45(7));18 7.43(a)},75:9(){7.16=7.13.first('30.17-12-16').make82({onBefore:7.63.45(7),onDrag:7.59.45(7)});7.13.onClick(7.61.45(7));if(7.8.25=='y')7.13.add83('17-12-29');51 7.8.25=7.13.has83('17-12-29')?'y':'x';if(7.46=(RightJS.version<'1.5.0'&&!7.16.getBoundingClientRect)){14 p=7.13;14 o=7.16.11;7.16.11=9(){14 d=o.call(7);14 s=p.11();d.22+=s.22;d.19+=s.19;18 d}}18 7.53()},74:9(){18 $E('30',{'71':'17-12'}).insert($E('30',{'71':'17-12-16'}))},61:9(a){a.s22();7.36().40(7.21);14 p=a.44();14 e=7.11;14 p=(7.15?p.x-e.19:p.y-e.22)-7.42;if(p>7.28)p=7.28;51 if(p<0)p=0;7.34(p)},59:9(d,e){7.34(d.13.48[7.15?'19':'22'].64())},63:9(d){7.36().40(7.21);14 o=7.42;14 e=7.11;14 a=d.8;a.37={};if((a.axis=7.8.25)=='x'){a.37.x=[e.19+o,e.19+e.31-o];if(7.46)a.37.x[0]-=e.19}51{a.37.y=[e.22+o,e.22+e.27-o];if(7.46)a.37.y[0]-=e.22}if(7.8.38)a.38=7.28/(7.8.47-7.8.32)*7.8.38},34:9(p){if(!7.15)p=7.28-p;14 v=p/7.28*(7.8.47-7.8.32)+7.8.32;7.24(v)},40:9(v){14 p=7.28/(7.8.47-7.8.32)*(v-7.8.32);if(!7.15)p=7.28-p;7.16.48[7.15?'19':'22']=p+'px';18 7},36:9(){14 h=7.16.setStyle({19:'0',22:'0'}).11();7.11=7.13.11();7.15=7.8.25=='x';7.42=7.15?h.19-7.11.19:h.22-7.11.22;7.28=(7.15?7.11.31-h.31:7.11.27-h.27)-7.42*2;18 7}});33.60(9(){50.67()});33.write(\"<48 type=\\\"text/css\\\">30.17-12,30.17-12-16{23:0;padding:0;26:76;35:76}30.17-12{27:0.62;31:20em;26:81 73 #77;35:#EEE;-79-26-41:.56;-66-26-41:.56;44:relative;23:.6em 0;58:68-block;*58:68;*zoom:1;29-align:middle}30.17-12-16{44:absolute;19:0;22:0;cursor:pointer;31:80;27:57;23-22:-0.62;23-19:0.57;35:#77;26:81 73 #AAA;-79-26-41:.56;-66-26-41:.56}30.17-12-29{27:10em;31:0.62;23:0 .3em}30.17-12-29 30.17-12-16{23:0;23-19:-0.62;23-22:0.57;27:80;31:57}</48>\");",",,,,,,,this,options,function,,dimensions,slider,element,var,horizontal,handle,right,return,left,,value,top,margin,setValue,direction,border,height,space,vertical,div,width,min,document,setPosition,background,precalc,range,snap,update,moveTo,radius,offset,onChange,position,bind,konqFix,max,style,_slider,Slider,else,insertTo,reset,assignTo,round,2em,1em,display,dragged,onReady,clicked,4em,prepare,toFloat,null,webkit,rescan,inline,change,isHash,class,curry,solid,build,init,none,CCC,new,moz,4pt,1px,Draggable,Class".split(",")));
@@ -3,14 +3,14 @@
3
3
  *
4
4
  * See http://rightjs.org/ui/sortable
5
5
  *
6
- * Copyright (C) Nikolay V. Nemshilov aka St.
6
+ * Copyright (C) 2009-2010 Nikolay V. Nemshilov
7
7
  */
8
8
  if (!Draggable) throw "Gimme Draggable";
9
9
 
10
10
  /**
11
11
  * The Sortable unit
12
12
  *
13
- * Copyright (C) Nikolay V. Nemshilov aka St.
13
+ * Copyright (C) 2009-2010 Nikolay V. Nemshilov
14
14
  */
15
15
  var Sortable = new Class(Observer, {
16
16
  extend: {
@@ -29,29 +29,12 @@ var Sortable = new Class(Observer, {
29
29
  idParam: 'id', // the id value name
30
30
  posParam: 'position', // the position value name
31
31
  parseId: true, // if the id attribute should be converted into an integer before sending
32
-
33
- relName: 'sortable' // the auto-discovery feature key
32
+
33
+ cssRule: '[rel^=sortable]' // css-rule for automatically processable sortables
34
34
  },
35
35
 
36
- // scans through the page for auto-discoverable sortables
37
- rescan: function(scope) {
38
- var key = Sortable.Options.relName;
39
- var reg = new RegExp('^'+key+'\\[(.+?)\\]');
40
-
41
- ($(scope) || document).select('ul[rel^="'+key+'"], ol[rel^="'+key+'"]').each(function(element) {
42
- if (!element._sortable) {
43
- var data = element.get('data-'+key+'-options');
44
- var options = eval('('+data+')') || {};
45
-
46
- var url = element.get('rel').match(reg);
47
- if (url) {
48
- options.url = url[1];
49
- }
50
-
51
- new Sortable(element, options);
52
- }
53
- });
54
- }
36
+ // DEPRECATED: scans through the page for auto-discoverable sortables
37
+ rescan: function(scope) { }
55
38
  },
56
39
 
57
40
  /**
@@ -62,7 +45,14 @@ var Sortable = new Class(Observer, {
62
45
  */
63
46
  initialize: function(element, options) {
64
47
  this.element = $(element);
65
- this.$super(options);
48
+ this.$super(Object.merge(options, eval('('+this.element.get('data-sortable-options')+')')));
49
+
50
+ // trying to get the embedded Xhr url address
51
+ var rule = this.options.cssRule.split('[').last(),
52
+ attr = this.element.get(rule.split('^=').first()) || '',
53
+ url = attr.match(/\[(.+?)\]/);
54
+
55
+ if (url) this.options.url = url[1];
66
56
 
67
57
  this.element._sortable = this.init().onUpdate('tryXhr');
68
58
  },
@@ -193,16 +183,26 @@ var Sortable = new Class(Observer, {
193
183
  /**
194
184
  * Document level hooks for sortables
195
185
  *
196
- * Copyright (C) 2009 Nikolay V. Nemshilov aka St.
186
+ * Copyright (C) 2009-2010 Nikolay V. Nemshilov
197
187
  */
198
- document.onReady(function() { Sortable.rescan(); });
188
+ document.onMousedown(function(event) {
189
+ var target = event.target, element = [target].concat(target.parents()).first('match', Sortable.Options.cssRule);
190
+
191
+ if (element) {
192
+ var sortable = element._srotable || new Sortable(element);
193
+
194
+ if (target._draggable) {
195
+ target._draggable.dragStart(event);
196
+ }
197
+ };
198
+ });
199
199
 
200
200
  /**
201
201
  * Element level features for the Sortable unit
202
202
  *
203
- * Copyright (C) Nikolay V. Nemshilov aka St.
203
+ * Copyright (C) 2009-2010 Nikolay V. Nemshilov
204
204
  */
205
- Element.addMethods({
205
+ Element.include({
206
206
  /**
207
207
  * Tries to make a sortable unit out of the element
208
208
  *
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * See http://rightjs.org/ui/sortable
5
5
  *
6
- * Copyright (C) Nikolay V. Nemshilov aka St.
6
+ * Copyright (C) 2009-2010 Nikolay V. Nemshilov
7
7
  */
8
8
  if (!Draggable) throw "Gimme Draggable";
9
- eval((function(s,d){for(var i=d.length-1;i>-1;i--)if(d[i])s=s.replace(new RegExp(i,'g'),d[i]);return s})("6 9=26 Class(Observer,{extend:{EVENTS:$w('32'),24:{13:'20',39:'li',23:null,16:'put',37:{},28:'id',22:'position',29:42,27:'sortable'},31:3(s){6 k=9.24.27;6 r=26 RegExp('^'+k+'\\\\[(.+?)\\\\]');($(s)||21).select('ul[35^=\"'+k+'\"], ol[35^=\"'+k+'\"]').18(3(e){if(!e.8){6 d=e.43('data-'+k+'-4');6 o=eval('('+d+')')||{};6 u=e.43('35').36(r);if(u)o.23=u[1];26 9(e,o)}})}},41ialize:3(e,o){2.5=$(e);2.$super(o);2.5.8=2.41().onUpdate('30')},25:3(){2.10.18(3(i){i.undo44().undo45()});delete(2.5.8);12 2},34:3(e){6 b=2.10();6 p=b.indexOf(e);if(p>-1&&p!=e.7){2.fire('32',e,p);b.18(3(a,i){a.7=i})}e.set47({19:'20',38:'20'})},30:3(e,a){if(2.4.23){6 u=2.4.23,p={};6 o=17.33({16:2.4.16,11:{}},2.4.37);6 i=e.id||'';if(2.4.29&&i)i=i.36(/\\d+/)||'';if(u.14('%{id}'))u=u.replace('%{id}',i);40 p[2.4.28]=i;p[2.4.22]=a;if(is46(o.11))o.11+='&'+17.toQuery46(p);40 o.11=17.33(o.11,p);37.load(u,o)}},41:3(){6 h=2.10();if(h.length){6 c=2.34.bind(2);6 e=2.4.13!='20'?2.4.13:['19','right'].14(h[0].4347('float'))?'x':'y';6 f={range:2.5,axis:e,revert:42,revertDuration:0,onS38:3(){c(2.5)}};6 g={overlap:e,containment:h,onHover:3(a){if(h.14(a.5)){6 d=a.5.15();6 t=2.5.15();6 b=a.axisY?(d.38>t.38):(d.19>t.19);2.5.insert(a.clone,b?'before':'after')}}};h.18(3(a,i){a.make44(f).make45(g).7=i})}12 2},10:3(){12 2.5.subNodes(2.4.39)}});21.onReady(3(){9.31()});Element.addMethods({make9:3(o){26 9(2,o);12 2},undo9:3(){if(2.8)2.8.25();12 2}});",",,this,function,options,element,var,current_position,_sortable,Sortable,getItems,params,return,direction,include,dimensions,method,Object,each,left,auto,document,posParam,url,Options,destroy,new,relName,idParam,parseId,tryXhr,rescan,update,merge,moved,rel,match,Xhr,top,tags,else,init,true,get,Draggable,Droppable,String,Style".split(",")));
9
+ eval((function(s,d){for(var i=d.length-1;i>-1;i--)if(d[i])s=s.replace(new RegExp(i,'g'),d[i]);return s})("6 9=39 Class(Observer,{extend:{EVENTS:$w('32'),27:{14:'21',40:'li',30:null,19:'put',34:{},29:'id',23:'position',28:42,16:'[rel^=24]'},rescan:3(s){}},43ialize:3(e,o){2.5=$(e);2.$super(15.25(o,eval('('+2.5.44('data-24-4')+')')));6 r=2.4.16.38('[').last(),a=2.5.44(r.38('^=').37())||'',u=a.22(/\\[(.+?)\\]/);if(u)2.4.30=u[1];2.5.8=2.43().onUpdate('33')},26:3(){2.10.31(3(i){i.undo45().undo46()});delete(2.5.8);12 2},35:3(e){6 b=2.10();6 p=b.indexOf(e);if(p>-1&&p!=e.7){2.fire('32',e,p);b.31(3(a,i){a.7=i})}e.set48({20:'21',36:'21'})},33:3(e,a){if(2.4.30){6 u=2.4.30,p={};6 o=15.25({19:2.4.19,11:{}},2.4.34);6 i=e.id||'';if(2.4.28&&i)i=i.22(/\\d+/)||'';if(u.13('%{id}'))u=u.replace('%{id}',i);41 p[2.4.29]=i;p[2.4.23]=a;if(is47(o.11))o.11+='&'+15.toQuery47(p);41 o.11=15.25(o.11,p);34.load(u,o)}},43:3(){6 h=2.10();if(h.length){6 c=2.35.bind(2);6 e=2.4.14!='21'?2.4.14:['20','right'].13(h[0].4448('float'))?'x':'y';6 f={range:2.5,axis:e,revert:42,revertDuration:0,onS36:3(){c(2.5)}};6 g={overlap:e,containment:h,onHover:3(a){if(h.13(a.5)){6 d=a.5.17();6 t=2.5.17();6 b=a.axisY?(d.36>t.36):(d.20>t.20);2.5.insert(a.clone,b?'before':'after')}}};h.31(3(a,i){a.make45(f).make46(g).7=i})}12 2},10:3(){12 2.5.subNodes(2.4.40)}});document.onMousedown(3(a){6 t=a.tar44,e=[t].concat(t.parents()).37('22',9.27.16);if(e){6 s=e._srotable||39 9(e);if(t.18)t.18.dragStart(a)}});Element.13({make9:3(o){39 9(2,o);12 2},undo9:3(){if(2.8)2.8.26();12 2}});",",,this,function,options,element,var,current_position,_sortable,Sortable,getItems,params,return,include,direction,Object,cssRule,dimensions,_draggable,method,left,auto,match,posParam,sortable,merge,destroy,Options,parseId,idParam,url,each,update,tryXhr,Xhr,moved,top,first,split,new,tags,else,true,init,get,Draggable,Droppable,String,Style".split(",")));
@@ -2,40 +2,18 @@
2
2
  * RightJS, http://rightjs.org
3
3
  * Released under the MIT license
4
4
  *
5
- * Custom build with options: no-olds
6
- *
7
- * Copyright (C) 2008-2009 Nikolay Nemshilov
5
+ * Copyright (C) 2008-2010 Nikolay Nemshilov
8
6
  */
9
7
  /**
10
8
  * The framework description object
11
9
  *
12
- * Copyright (C) 2008-2009 Nikolay V. Nemshilov aka St. <nemshilov#gma-ilc-om>
10
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov
13
11
  */
14
- var RightJS = {
15
- version: "1.5.3",
16
- modules: ["core", "form", "cookie", "xhr", "fx"]
12
+ RightJS = {
13
+ version: "1.5.6",
14
+ modules: ["core", "dom", "form", "cookie", "xhr", "fx"]
17
15
  };
18
16
 
19
- /**
20
- * this object will contain info about the current browser
21
- *
22
- * Copyright (C) 2008 Nikolay V. Nemshilov aka St. <nemshilov#gma-il>
23
- */
24
- var Browser = (function(agent) {
25
- return {
26
- IE: !!(window.attachEvent && !window.opera),
27
- Opera: !!window.opera,
28
- WebKit: agent.indexOf('AppleWebKit/') > -1,
29
- Gecko: agent.indexOf('Gecko') > -1 && agent.indexOf('KHTML') < 0,
30
- MobileSafari: !!agent.match(/Apple.*Mobile.*Safari/),
31
- Konqueror: agent.indexOf('Konqueror') > -1,
32
-
33
- // marker for the browsers which don't give access to the HTMLElement unit
34
- OLD: agent.indexOf('MSIE 6') > -1 || agent.indexOf('MSIE 7') > -1,
35
- IE8: agent.indexOf('MSIE 8') > -1
36
- }
37
- })(navigator.userAgent);
38
-
39
17
  /**
40
18
  * There are some util methods
41
19
  *
@@ -44,7 +22,7 @@ var Browser = (function(agent) {
44
22
  * - Prototype (http://prototypejs.org) Copyright (C) Sam Stephenson
45
23
  * - MooTools (http://mootools.net) Copyright (C) Valerio Proietti
46
24
  *
47
- * Copyright (C) 2008-2009 Nikolay V. Nemshilov aka St. <nemshilov#gma-il>
25
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov
48
26
  */
49
27
 
50
28
  /**
@@ -59,10 +37,10 @@ var Browser = (function(agent) {
59
37
  * @return Objecte extended destination object
60
38
  */
61
39
  function $ext(dest, src, dont_overwrite) {
62
- var src = src || {};
40
+ var src = src || {}, key;
63
41
 
64
- for (var key in src)
65
- if (dont_overwrite === undefined || dest[key] === undefined)
42
+ for (key in src)
43
+ if (dont_overwrite !== true || typeof(dest[key]) === 'undefined')
66
44
  dest[key] = src[key];
67
45
 
68
46
  return dest;
@@ -85,7 +63,7 @@ function $try() {
85
63
  }
86
64
  };
87
65
 
88
- /**
66
+ /** !#server
89
67
  * evals the given javascript text in the context of the current window
90
68
  *
91
69
  * @param String javascript
@@ -142,23 +120,9 @@ function $alias(object, names) {
142
120
  * @return boolean check result
143
121
  */
144
122
  function defined(value) {
145
- return value !== undefined;
123
+ return typeof(value) !== 'undefined';
146
124
  };
147
125
 
148
- /**
149
- * checks if the given value is a hash-like object
150
- *
151
- * @param mixed value
152
- * @return boolean check result
153
- */
154
- function isHash(value) {
155
- return typeof(value) === 'object' && value !== null && value.constructor === Object;
156
- };
157
-
158
- // Opera 10.00 and Konqueror 3 heed some extra care with that
159
- if (isHash(document.createElement('p'))) {
160
- eval(isHash.toString().replace(';', '&&!(arguments[0] instanceof HTMLElement);'));
161
- }
162
126
 
163
127
  /**
164
128
  * checks if the given value is a function
@@ -180,15 +144,6 @@ function isString(value) {
180
144
  return typeof(value) === 'string';
181
145
  };
182
146
 
183
- /**
184
- * checks if the given value is an array
185
- *
186
- * @param mixed value to check
187
- * @return boolean check result
188
- */
189
- function isArray(value) {
190
- return value instanceof Array;
191
- };
192
147
 
193
148
  /**
194
149
  * checks if the given value is a number
@@ -200,7 +155,7 @@ function isNumber(value) {
200
155
  return typeof(value) === 'number';
201
156
  };
202
157
 
203
- /**
158
+ /** !#server
204
159
  * checks if the given value is an element
205
160
  *
206
161
  * @param mixed value to check
@@ -210,7 +165,7 @@ function isElement(value) {
210
165
  return value && value.tagName;
211
166
  };
212
167
 
213
- /**
168
+ /** !#server
214
169
  * checks if the given value is a DOM-node
215
170
  *
216
171
  * @param mixed value to check
@@ -220,25 +175,7 @@ function isNode(value) {
220
175
  return value && value.nodeType;
221
176
  };
222
177
 
223
- /**
224
- * converts any iterables into an array
225
- *
226
- * @param Object iterable
227
- * @return Array list
228
- */
229
- var $A = (function(slice) {
230
- return function (it) {
231
- try {
232
- return slice.call(it);
233
- } catch(e) {
234
- for (var a=[], i=0, length = it.length; i < length; i++)
235
- a[i] = it[i];
236
- return a;
237
- }
238
- };
239
- })(Array.prototype.slice);
240
-
241
- /**
178
+ /** !#server
242
179
  * shortcut to instance new elements
243
180
  *
244
181
  * @param String tag name
@@ -249,7 +186,7 @@ function $E(tag_name, options) {
249
186
  return new Element(tag_name, options);
250
187
  };
251
188
 
252
- /**
189
+ /** !#server
253
190
  * searches an element by id and/or extends it with the framework extentions
254
191
  *
255
192
  * @param String element id or Element to extend
@@ -259,7 +196,7 @@ function $(element) {
259
196
  return typeof(element) === 'string' ? document.getElementById(element) : element;
260
197
  };
261
198
 
262
- /**
199
+ /** !#server
263
200
  * searches for elements in the document which matches the given css-rule
264
201
  *
265
202
  * @param String css-rule
@@ -277,19 +214,81 @@ function $$(css_rule) {
277
214
  */
278
215
  function $w(string) {
279
216
  return string.trim().split(/\s+/);
280
- }
217
+ };
281
218
 
282
- /**
283
- * generates an unique id for an object
284
- *
285
- * @param Object object
286
- * @return Integer uniq id
287
- */
288
- var $uid = (function(UID) {
289
- return function(item) {
219
+ // we need to generate those functions in an anonymous scope
220
+ (function() {
221
+ var to_s = Object.prototype.toString, slice = Array.prototype.slice, UID = 1;
222
+
223
+ /**
224
+ * checks if the given value is a hash-like object
225
+ *
226
+ * @param mixed value
227
+ * @return boolean check result
228
+ */
229
+ isHash = function(value) {
230
+ return to_s.call(value) === '[object Object]';
231
+ };
232
+
233
+ /** !#server
234
+ * Internet Explorer needs some additional mumbo-jumbo in here
235
+ */
236
+ if (isHash(document.documentElement)) {
237
+ isHash = function(value) {
238
+ return to_s.call(value) === '[object Object]' &&
239
+ value !== null && typeof(value) !== 'undefined' &&
240
+ typeof(value.hasOwnProperty) !== 'undefined';
241
+ };
242
+ }
243
+
244
+ /**
245
+ * checks if the given value is an array
246
+ *
247
+ * @param mixed value to check
248
+ * @return boolean check result
249
+ */
250
+ isArray = function(value) {
251
+ return to_s.call(value) === '[object Array]';
252
+ };
253
+
254
+ /**
255
+ * converts any iterables into an array
256
+ *
257
+ * @param Object iterable
258
+ * @return Array list
259
+ */
260
+ $A = function (it) {
261
+ try {
262
+ return slice.call(it);
263
+ } catch(e) {
264
+ for (var a=[], i=0, length = it.length; i < length; i++)
265
+ a[i] = it[i];
266
+ return a;
267
+ }
268
+ };
269
+
270
+ /**
271
+ * generates an unique id for an object
272
+ *
273
+ * @param Object object
274
+ * @return Integer uniq id
275
+ */
276
+ $uid = function(item) {
290
277
  return item.uid || (item.uid = UID++);
291
278
  };
292
- })(1);
279
+
280
+ /**
281
+ * Generating methods for native units extending
282
+ */
283
+ for (var i=0, natives = [Array, Function, Number, String, Date, RegExp]; i < natives.length; i++) {
284
+ natives[i].include = function(module, dont_overwrite) {
285
+ $ext(this.prototype, module, dont_overwrite);
286
+ return this;
287
+ };
288
+ }
289
+ })();
290
+
291
+
293
292
 
294
293
 
295
294
  /**
@@ -299,7 +298,7 @@ var $uid = (function(UID) {
299
298
  * Some functionality is inspired by
300
299
  * - Prototype (http://prototypejs.org) Copyright (C) Sam Stephenson
301
300
  *
302
- * Copyright (C) 2008-2009 Nikolay V. Nemshilov aka St. <nemshilov#gma-il>
301
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov
303
302
  */
304
303
  $ext(Object, {
305
304
  /**
@@ -309,8 +308,8 @@ $ext(Object, {
309
308
  * @return Array keys list
310
309
  */
311
310
  keys: function(object) {
312
- var keys = [];
313
- for (var key in object)
311
+ var keys = [], key;
312
+ for (key in object)
314
313
  keys.push(key);
315
314
  return keys;
316
315
  },
@@ -322,8 +321,8 @@ $ext(Object, {
322
321
  * @return Array values list
323
322
  */
324
323
  values: function(object) {
325
- var values = [];
326
- for (var key in object)
324
+ var values = [], key;
325
+ for (key in object)
327
326
  values.push(object[key]);
328
327
  return values;
329
328
  },
@@ -350,9 +349,9 @@ $ext(Object, {
350
349
  * @return Object filtered copy
351
350
  */
352
351
  without: function() {
353
- var filter = $A(arguments), object = filter.shift(), copy = {};
352
+ var filter = $A(arguments), object = filter.shift(), copy = {}, key;
354
353
 
355
- for (var key in object)
354
+ for (key in object)
356
355
  if (!filter.includes(key))
357
356
  copy[key] = object[key];
358
357
 
@@ -371,9 +370,10 @@ $ext(Object, {
371
370
  * @return Object filtered copy
372
371
  */
373
372
  only: function() {
374
- var filter = $A(arguments), object = filter.shift(), copy = {};
373
+ var filter = $A(arguments), object = filter.shift(), copy = {},
374
+ i=0, length = filter.length;
375
375
 
376
- for (var i=0, length = filter.length; i < length; i++) {
376
+ for (; i < length; i++) {
377
377
  if (defined(object[filter[i]]))
378
378
  copy[filter[i]] = object[filter[i]];
379
379
  }
@@ -395,8 +395,8 @@ $ext(Object, {
395
395
  * @return Object merged object
396
396
  */
397
397
  merge: function() {
398
- var object = {};
399
- for (var i=0, length = arguments.length; i < length; i++) {
398
+ var object = {}, i=0, length = arguments.length;
399
+ for (; i < length; i++) {
400
400
  if (isHash(arguments[i])) {
401
401
  $ext(object, arguments[i]);
402
402
  }
@@ -411,13 +411,13 @@ $ext(Object, {
411
411
  * @return String query
412
412
  */
413
413
  toQueryString: function(object) {
414
- var tokens = [];
415
- for (var key in object) {
414
+ var tokens = [], key;
415
+ for (key in object) {
416
416
  tokens.push(key+'='+encodeURIComponent(object[key]))
417
417
  }
418
418
  return tokens.join('&');
419
419
  }
420
- });
420
+ }, true);
421
421
 
422
422
  /**
423
423
  * here are the starndard Math object extends
@@ -426,7 +426,7 @@ $ext(Object, {
426
426
  * The idea of random mehtod is taken from
427
427
  * - Ruby (http://www.ruby-lang.org) Copyright (C) Yukihiro Matsumoto
428
428
  *
429
- * Copyright (C) 2008 Nikolay V. Nemshilov aka St. <nemshilov#gma-il>
429
+ * Copyright (C) 2008 Nikolay V. Nemshilov
430
430
  */
431
431
  $ext(Math, {
432
432
  /**
@@ -462,9 +462,9 @@ $ext(Math, {
462
462
  * - Prototype (http://prototypejs.org) Copyright (C) Sam Stephenson
463
463
  * - Ruby (http://www.ruby-lang.org) Copyright (C) Yukihiro Matsumoto
464
464
  *
465
- * Copyright (C) 2008-2009 Nikolay V. Nemshilov aka St. <nemshilov#gma-il>
465
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov
466
466
  */
467
- $ext(Array.prototype, (function(A_proto) {
467
+ (function(A_proto) {
468
468
 
469
469
  // JavaScript 1.6 methods recatching up or faking
470
470
  var for_each = A_proto.forEach || function(callback, scope) {
@@ -503,20 +503,20 @@ $ext(Array.prototype, (function(A_proto) {
503
503
  return true;
504
504
  };
505
505
 
506
- var first = function(callback, scope) {
506
+ function first(callback, scope) {
507
507
  for (var i=0, length = this.length; i < length; i++) {
508
508
  if (callback.call(scope, this[i], i, this))
509
509
  return this[i];
510
510
  }
511
- return undefined;
511
+ return this._$u; // <- undefined, see #191
512
512
  };
513
513
 
514
- var last = function(callback, scope) {
514
+ function last(callback, scope) {
515
515
  for (var i=this.length-1; i > -1; i--) {
516
516
  if (callback.call(scope, this[i], i, this))
517
517
  return this[i];
518
518
  }
519
- return undefined;
519
+ return this._$u; // <- undefined, see #191
520
520
  };
521
521
 
522
522
 
@@ -525,7 +525,7 @@ $ext(Array.prototype, (function(A_proto) {
525
525
  //
526
526
 
527
527
  // prepares a correct callback function
528
- var guess_callback = function(args, array) {
528
+ function guess_callback(args, array) {
529
529
  var callback = args[0], args = A_proto.slice.call(args, 1), scope = array;
530
530
 
531
531
  if (isString(callback)) {
@@ -543,13 +543,18 @@ $ext(Array.prototype, (function(A_proto) {
543
543
  };
544
544
 
545
545
  // calls the given method with preprocessing the arguments
546
- var call_method = function(func, scope, args) {
546
+ function call_method(func, scope, args) {
547
547
  try {
548
548
  return func.apply(scope, guess_callback(args, scope));
549
549
  } catch(e) { if (!(e instanceof Break)) throw(e); }
550
550
  };
551
551
 
552
- return {
552
+ // checks the value as a boolean
553
+ function boolean_check(i) {
554
+ return !!i;
555
+ };
556
+
557
+ Array.include({
553
558
  /**
554
559
  * IE fix
555
560
  * returns the index of the value in the array
@@ -684,8 +689,8 @@ return {
684
689
  * @param Object optional scope for the callback
685
690
  * @return boolean check result
686
691
  */
687
- some: function() {
688
- return call_method(some, this, arguments.length ? arguments : [function(i) { return !!i; }]);
692
+ some: function(value) {
693
+ return call_method(some, this, value ? arguments : [boolean_check]);
689
694
  },
690
695
 
691
696
  /**
@@ -695,8 +700,8 @@ return {
695
700
  * @param Object optional scope for the callback
696
701
  * @return Boolean check result
697
702
  */
698
- every: function() {
699
- return call_method(every, this, arguments.length ? arguments : [function(i) { return !!i; }]);
703
+ every: function(value) {
704
+ return call_method(every, this, value ? arguments : [boolean_check]);
700
705
  },
701
706
 
702
707
  /**
@@ -721,10 +726,10 @@ return {
721
726
  * @return Array new merged
722
727
  */
723
728
  merge: function() {
724
- for (var copy = this.clone(), arg, i=0, length = arguments.length; i < length; i++) {
729
+ for (var copy = this.clone(), arg, i=0, j, length = arguments.length; i < length; i++) {
725
730
  arg = arguments[i];
726
731
  if (isArray(arg)) {
727
- for (var j=0; j < arg.length; j++) {
732
+ for (j=0; j < arg.length; j++) {
728
733
  if (copy.indexOf(arg[j]) == -1)
729
734
  copy.push(arg[j]);
730
735
  }
@@ -758,7 +763,7 @@ return {
758
763
  * @return Array filtered version
759
764
  */
760
765
  compact: function() {
761
- return this.without(null, undefined);
766
+ return this.without(null, this._$u); // <- this._u === undefined, see #191
762
767
  },
763
768
 
764
769
  /**
@@ -805,10 +810,9 @@ return {
805
810
  * @return Array shuffled version
806
811
  */
807
812
  shuffle: function() {
808
- var shuff = this.clone();
813
+ var shuff = this.clone(), j, x, i = shuff.length;
809
814
 
810
- for (var j, x, i = shuff.length; i;
811
- j = Math.random(i-1), x = shuff[--i], shuff[i] = shuff[j], shuff[j] = x);
815
+ for (; i; j = Math.random(i-1), x = shuff[--i], shuff[i] = shuff[j], shuff[j] = x);
812
816
 
813
817
  return shuff;
814
818
  },
@@ -831,14 +835,18 @@ return {
831
835
  return a.value > b.value ? 1 : a.value < b.value ? -1 : 0;
832
836
  }).map('item');
833
837
  }
834
- }})(Array.prototype));
838
+ });
835
839
 
836
- $alias(Array.prototype, {
840
+ $alias(A_proto, {
837
841
  include: 'includes',
838
842
  all: 'every',
839
843
  any: 'some'
840
844
  });
841
845
 
846
+ })(Array.prototype);
847
+
848
+
849
+
842
850
  /**
843
851
  * The String class extentions
844
852
  *
@@ -848,9 +856,9 @@ $alias(Array.prototype, {
848
856
  * The trim function taken from work of Steven Levithan
849
857
  * - http://blog.stevenlevithan.com/archives/faster-trim-javascript
850
858
  *
851
- * Copyright (C) 2008-2010 Nikolay V. Nemshilov aka St. <nemshilov#gma-il>
859
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov
852
860
  */
853
- $ext(String.prototype, {
861
+ String.include({
854
862
  /**
855
863
  * checks if the string is an empty string
856
864
  *
@@ -925,7 +933,7 @@ $ext(String.prototype, {
925
933
  * @return String self (unchanged version with scripts still in their place)
926
934
  */
927
935
  evalScripts: function() {
928
- $eval(this.extractScripts());
936
+ this.stripScripts(true);
929
937
  return this;
930
938
  },
931
939
 
@@ -1027,13 +1035,9 @@ $alias(String.prototype, {include: 'includes'});
1027
1035
  * Some of the functionality inspired by
1028
1036
  * - Prototype (http://prototypejs.org) Copyright (C) Sam Stephenson
1029
1037
  *
1030
- * Copyright (C) 2008 Nikolay V. Nemshilov aka St. <nemshilov#gma-il>
1038
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov
1031
1039
  */
1032
- $ext(Function.prototype, (function() {
1033
- // creating a local reference to the method for a faster access
1034
- var _A = Array.prototype.slice;
1035
-
1036
- return {
1040
+ Function.include({
1037
1041
  /**
1038
1042
  * binds the function to be executed in the given scope
1039
1043
  *
@@ -1043,11 +1047,9 @@ return {
1043
1047
  * @return Function binded function
1044
1048
  */
1045
1049
  bind: function() {
1046
- if (arguments.length < 2 && !arguments[0]) return this;
1047
-
1048
- var slice = _A, args = slice.call(arguments), scope = args.shift(), func = this;
1050
+ var args = $A(arguments), scope = args.shift(), func = this;
1049
1051
  return function() {
1050
- return func.apply(scope, (args.length != 0 || arguments.length != 0) ? args.concat(slice.call(arguments)) : args);
1052
+ return func.apply(scope, (args.length || arguments.length) ? args.concat($A(arguments)) : args);
1051
1053
  };
1052
1054
  },
1053
1055
 
@@ -1060,9 +1062,9 @@ return {
1060
1062
  * @return Function binded function
1061
1063
  */
1062
1064
  bindAsEventListener: function() {
1063
- var slice = _A, args = slice.call(arguments), scope = args.shift(), func = this;
1065
+ var args = $A(arguments), scope = args.shift(), func = this;
1064
1066
  return function(event) {
1065
- return func.apply(scope, [event || window.event].concat(args).concat(slice.call(arguments)));
1067
+ return func.apply(scope, [event || window.event].concat(args).concat($A(arguments)));
1066
1068
  };
1067
1069
  },
1068
1070
 
@@ -1074,7 +1076,7 @@ return {
1074
1076
  * @return Function curried function
1075
1077
  */
1076
1078
  curry: function() {
1077
- return this.bind.apply(this, [this].concat(_A.call(arguments)));
1079
+ return this.bind.apply(this, [this].concat($A(arguments)));
1078
1080
  },
1079
1081
 
1080
1082
  /**
@@ -1085,9 +1087,9 @@ return {
1085
1087
  * @return Function curried function
1086
1088
  */
1087
1089
  rcurry: function() {
1088
- var curry = _A.call(arguments), func = this;
1090
+ var curry = $A(arguments), func = this;
1089
1091
  return function() {
1090
- return func.apply(func, _A.call(arguments).concat(curry));
1092
+ return func.apply(func, $A(arguments).concat(curry));
1091
1093
  }
1092
1094
  },
1093
1095
 
@@ -1100,8 +1102,8 @@ return {
1100
1102
  * @return Integer timeout marker
1101
1103
  */
1102
1104
  delay: function() {
1103
- var args = _A.call(arguments), timeout = args.shift();
1104
- var timer = new Number(window.setTimeout(this.bind.apply(this, [this].concat(args)), timeout));
1105
+ var args = $A(arguments), timeout = args.shift(),
1106
+ timer = new Number(window.setTimeout(this.bind.apply(this, [this].concat(args)), timeout));
1105
1107
 
1106
1108
  timer.cancel = function() { window.clearTimeout(this); };
1107
1109
 
@@ -1117,8 +1119,8 @@ return {
1117
1119
  * @return Ineger interval marker
1118
1120
  */
1119
1121
  periodical: function() {
1120
- var args = _A.call(arguments), timeout = args.shift();
1121
- var timer = new Number(window.setInterval(this.bind.apply(this, [this].concat(args)), timeout));
1122
+ var args = $A(arguments), timeout = args.shift(),
1123
+ timer = new Number(window.setInterval(this.bind.apply(this, [this].concat(args)), timeout));
1122
1124
 
1123
1125
  timer.stop = function() { window.clearInterval(this); };
1124
1126
 
@@ -1134,14 +1136,14 @@ return {
1134
1136
  * @return Function chained function
1135
1137
  */
1136
1138
  chain: function() {
1137
- var args = _A.call(arguments), func = args.shift(), current = this;
1139
+ var args = $A(arguments), func = args.shift(), current = this;
1138
1140
  return function() {
1139
1141
  var result = current.apply(current, arguments);
1140
1142
  func.apply(func, args);
1141
1143
  return result;
1142
1144
  };
1143
1145
  }
1144
- }})());
1146
+ });
1145
1147
 
1146
1148
  /**
1147
1149
  * The Number class extentions
@@ -1150,9 +1152,9 @@ return {
1150
1152
  * Some methods inspired by
1151
1153
  * - Ruby (http://www.ruby-lang.org) Copyright (C) Yukihiro Matsumoto
1152
1154
  *
1153
- * Copyright (C) 2008 Nikolay V. Nemshilov aka St. <nemshilov#gma-il>
1155
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov
1154
1156
  */
1155
- $ext(Number.prototype, {
1157
+ Number.include({
1156
1158
  /**
1157
1159
  * executes the given callback the given number of times
1158
1160
  *
@@ -1207,19 +1209,19 @@ $ext(Number.prototype, {
1207
1209
  * Inspired by
1208
1210
  * - Prototype (http://prototypejs.org) Copyright (C) Sam Stephenson
1209
1211
  *
1210
- * Copyright (C) 2008-2009 Nikolay V. Nemshilov aka St. <nemshilov#gma-il>
1212
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov
1211
1213
  */
1212
- $ext(RegExp, {
1213
- /**
1214
- * Escapes the string for safely use as a regular expression
1215
- *
1216
- * @param String raw string
1217
- * @return String escaped string
1218
- */
1219
- escape: function(string) {
1220
- return String(string).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
1221
- }
1222
- });
1214
+
1215
+
1216
+ /**
1217
+ * Escapes the string for safely use as a regular expression
1218
+ *
1219
+ * @param String raw string
1220
+ * @return String escaped string
1221
+ */
1222
+ RegExp.escape = function(string) {
1223
+ return (''+string).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
1224
+ };
1223
1225
 
1224
1226
  /**
1225
1227
  * The basic Class unit
@@ -1230,21 +1232,21 @@ $ext(RegExp, {
1230
1232
  * - MooTools (http://mootools.net) Copyright (C) Valerio Proietti
1231
1233
  * - Ruby (http://www.ruby-lang.org) Copyright (C) Yukihiro Matsumoto
1232
1234
  *
1233
- * Copyright (C) 2008 Nikolay V. Nemshilov aka St. <nemshilov#gma-ilc-om>
1235
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov
1234
1236
  */
1235
1237
  var Class = function() {
1236
1238
  var args = $A(arguments), properties = args.pop() || {}, parent = args.pop();
1239
+
1240
+ // basic class object definition
1241
+ function klass() {
1242
+ return this.initialize ? this.initialize.apply(this, arguments) : this;
1243
+ };
1237
1244
 
1238
1245
  // if only the parent class has been specified
1239
1246
  if (!args.length && !isHash(properties)) {
1240
1247
  parent = properties; properties = {};
1241
1248
  }
1242
-
1243
- // basic class object definition
1244
- var klass = function() {
1245
- return this.initialize ? this.initialize.apply(this, arguments) : this;
1246
- };
1247
-
1249
+
1248
1250
  // attaching main class-level methods
1249
1251
  $ext(klass, Class.Methods).inherit(parent);
1250
1252
 
@@ -1275,7 +1277,7 @@ var Class = function() {
1275
1277
  Class.findSet = function(object, property) {
1276
1278
  var upcased = property.toUpperCase(), capcased = property.capitalize(),
1277
1279
  candidates = [object, object.constructor].concat(object.constructor.ancestors),
1278
- holder = candidates.first(function(o) { return o[upcased] || o[capcased]});
1280
+ holder = candidates.first(function(o) { return o && (o[upcased] || o[capcased]) });
1279
1281
 
1280
1282
  return holder ? holder[upcased] || holder[capcased] : null;
1281
1283
  };
@@ -1285,14 +1287,14 @@ Class.findSet = function(object, property) {
1285
1287
  * will be extended. It provides basic and standard way to work
1286
1288
  * with the classes.
1287
1289
  *
1288
- * Copyright (C) 2008-2009 Nikolay V. Nemshilov aka St. <nemshilov#gma-ilc-om>
1290
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov
1289
1291
  */
1290
1292
  Class.Methods = (function() {
1291
- var commons = $w('selfExtended self_extended selfIncluded self_included');
1292
- var extend = commons.concat($w('prototype parent extend include'));
1293
- var include = commons.concat(['constructor']);
1293
+ var commons = $w('selfExtended self_extended selfIncluded self_included'),
1294
+ extend = commons.concat($w('prototype parent extend include')),
1295
+ include = commons.concat(['constructor']);
1294
1296
 
1295
- var clean_module = function(module, what) {
1297
+ function clean_module(module, what) {
1296
1298
  return Object.without.apply(Object, [module].concat(what == 'e' ? extend : include));
1297
1299
  };
1298
1300
 
@@ -1394,9 +1396,9 @@ return {
1394
1396
  * The idea of the module is inspired by
1395
1397
  * - MooTools (http://mootools.net) Copyright (C) Valerio Proietti
1396
1398
  *
1397
- * Copyright (C) 2008-2009 Nikolay V. Nemshilov aka St. <nemshilov#gma-ilc-om>
1399
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov
1398
1400
  */
1399
- var Options = {
1401
+ Options = {
1400
1402
  /**
1401
1403
  * assigns the options by merging them with the default ones
1402
1404
  *
@@ -1404,12 +1406,11 @@ var Options = {
1404
1406
  * @return Object current instance
1405
1407
  */
1406
1408
  setOptions: function(options) {
1407
- var options = this.options = Object.merge(Class.findSet(this, 'options'), options);
1409
+ var options = this.options = Object.merge(Class.findSet(this, 'options'), options), match, key;
1408
1410
 
1409
1411
  // hooking up the observer options
1410
1412
  if (isFunction(this.on)) {
1411
- var match;
1412
- for (var key in options) {
1413
+ for (key in options) {
1413
1414
  if (match = key.match(/on([A-Z][A-Za-z]+)/)) {
1414
1415
  this.on(match[1].toLowerCase(), options[key]);
1415
1416
  delete(options[key]);
@@ -1444,9 +1445,9 @@ var Options = {
1444
1445
  * The naming principle is inspired by
1445
1446
  * - Prototype (http://prototypejs.org) Copyright (C) Sam Stephenson
1446
1447
  *
1447
- * Copyright (C) 2008-2010 Nikolay V. Nemshilov aka St. <nemshilov#gma-il>
1448
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov
1448
1449
  */
1449
- var Observer = new Class({
1450
+ Observer = new Class({
1450
1451
  include: Options,
1451
1452
 
1452
1453
  /**
@@ -1496,18 +1497,18 @@ var Observer = new Class({
1496
1497
 
1497
1498
  default:
1498
1499
  if (isArray(callback)) {
1499
- callback.each(function(params) {
1500
- this.observe.apply(this, [event].concat(
1501
- isArray(params) ? params : [params]
1500
+ for (var i=0; i < callback.length; i++) {
1501
+ this.on.apply(this, [event].concat(
1502
+ isArray(callback[i]) ? callback[i] : [callback[i]]
1502
1503
  ).concat(args));
1503
- }, this);
1504
+ }
1504
1505
  }
1505
1506
  }
1506
1507
 
1507
1508
  } else {
1508
1509
  // assuming it's a hash of key-value pairs
1509
1510
  for (var name in event) {
1510
- this.observe.apply(this, [name].concat(
1511
+ this.on.apply(this, [name].concat(
1511
1512
  isArray(event[name]) ? event[name] : [event[name]]
1512
1513
  ).concat(args));
1513
1514
  }
@@ -1529,17 +1530,13 @@ var Observer = new Class({
1529
1530
  * @retun boolean check result
1530
1531
  */
1531
1532
  observes: function(event, callback) {
1532
- if (this.$listeners) {
1533
- if (!isString(event)) { callback = event; event = null; }
1534
- if (isString(callback)) callback = this[callback];
1535
-
1536
- return this.$listeners.some(function(i) {
1537
- return (event && callback) ? i.e == event && i.f == callback :
1538
- event ? i.e == event : i.f == callback;
1539
- });
1540
- }
1533
+ if (!isString(event)) { callback = event; event = null; }
1534
+ if (isString(callback)) callback = this[callback];
1541
1535
 
1542
- return false;
1536
+ return (this.$listeners || []).some(function(i) {
1537
+ return (event && callback) ? i.e === event && i.f === callback :
1538
+ event ? i.e === event : i.f === callback;
1539
+ });
1543
1540
  },
1544
1541
 
1545
1542
  /**
@@ -1553,11 +1550,15 @@ var Observer = new Class({
1553
1550
  * @return Observer self
1554
1551
  */
1555
1552
  stopObserving: function(event, callback) {
1556
- if (this.$listeners) {
1553
+ if (isHash(event)) {
1554
+ for (var key in event) {
1555
+ this.stopObserving(key, event[key]);
1556
+ }
1557
+ } else {
1557
1558
  if (!isString(event)) { callback = event; event = null; }
1558
1559
  if (isString(callback)) callback = this[callback];
1559
1560
 
1560
- this.$listeners = this.$listeners.filter(function(i) {
1561
+ this.$listeners = (this.$listeners || []).filter(function(i) {
1561
1562
  return (event && callback) ? (i.e !== event || i.f !== callback) :
1562
1563
  (event ? i.e !== event : i.f !== callback);
1563
1564
  }, this);
@@ -1639,12 +1640,31 @@ $alias(Observer.prototype, { observe: 'on' });
1639
1640
  /**
1640
1641
  * iterators in-callbacks break exception
1641
1642
  *
1642
- * Copyright (C) 2009 Nikolay V. Nemshilov aka St. <nemshilov#gma-il>
1643
+ * Copyright (C) 2009-2010 Nikolay V. Nemshilov
1643
1644
  */
1644
- var Break = new Class(Error, {
1645
+ Break = new Class(Error, {
1645
1646
  message: "Manual iterator break"
1646
1647
  });
1647
1648
 
1649
+ /**
1650
+ * this object will contain info about the current browser
1651
+ *
1652
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov
1653
+ */
1654
+ Browser = (function(agent) {
1655
+ return {
1656
+ IE: !!(window.attachEvent && !window.opera),
1657
+ Opera: !!window.opera,
1658
+ WebKit: agent.indexOf('AppleWebKit/') > -1,
1659
+ Gecko: agent.indexOf('Gecko') > -1 && agent.indexOf('KHTML') < 0,
1660
+ MobileSafari: !!agent.match(/Apple.*Mobile.*Safari/),
1661
+ Konqueror: agent.indexOf('Konqueror') > -1,
1662
+
1663
+ // marker for the browsers which don't give access to the HTMLElement unit
1664
+ OLD: !!(window.attachEvent && !window.opera) && !document.querySelector
1665
+ }
1666
+ })(navigator.userAgent);
1667
+
1648
1668
  /**
1649
1669
  * represents some additional functionality for the Event class
1650
1670
  *
@@ -1654,9 +1674,9 @@ var Break = new Class(Error, {
1654
1674
  * The additional method names are inspired by
1655
1675
  * - Prototype (http://prototypejs.org) Copyright (C) Sam Stephenson
1656
1676
  *
1657
- * Copyright (C) 2008-2010 Nikolay V. Nemshilov aka St. <nemshilov#gma-ilc-om>
1677
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov
1658
1678
  */
1659
- var Event = new Class(Event, {
1679
+ Event = new Class(window.Event, {
1660
1680
  extend: {
1661
1681
  /**
1662
1682
  * extends a native object with additional functionality
@@ -1668,25 +1688,25 @@ var Event = new Class(Event, {
1668
1688
  ext: function(event, bound_element) {
1669
1689
  if (!event.stop) {
1670
1690
  $ext(event, this.Methods, true);
1691
+ }
1692
+
1693
+ if (!event.target && event.srcElement) {
1694
+ // faking the which button
1695
+ event.which = event.button == 2 ? 3 : event.button == 4 ? 2 : 1;
1671
1696
 
1672
- if (Browser.IE) {
1673
- // faking the which button
1674
- event.which = event.button == 2 ? 3 : event.button == 4 ? 2 : 1;
1675
-
1676
- // faking the mouse position
1677
- var scrolls = window.scrolls();
1697
+ // faking the mouse position
1698
+ var scrolls = window.scrolls();
1678
1699
 
1679
- event.pageX = event.clientX + scrolls.x;
1680
- event.pageY = event.clientY + scrolls.y;
1681
-
1682
- // faking the target property
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
1689
- }
1700
+ event.pageX = event.clientX + scrolls.x;
1701
+ event.pageY = event.clientY + scrolls.y;
1702
+
1703
+ // faking the target property
1704
+ event.target = $(event.srcElement) || bound_element;
1705
+
1706
+ // faking the relatedTarget, currentTarget and other targets
1707
+ event.relatedTarget = event.target === event.fromElement ? $(event.toElement) : event.target;
1708
+ event.currentTarget = bound_element;
1709
+ event.eventPhase = 3; // bubbling phase
1690
1710
  }
1691
1711
 
1692
1712
  // Safari bug fix
@@ -1744,7 +1764,7 @@ var Event = new Class(Event, {
1744
1764
  * @param Object methods
1745
1765
  * @return void
1746
1766
  */
1747
- Event.addMethods = Event.include = function(methods) {
1767
+ Event.include = function(methods) {
1748
1768
  $ext(this.Methods, methods);
1749
1769
 
1750
1770
  try { // extending the events prototype
@@ -1779,7 +1799,7 @@ Event.include({
1779
1799
  /**
1780
1800
  * custom events unit, used as a mediator for the artificial events handling in the generic observer
1781
1801
  *
1782
- * Copyright (C) 2008-2009 Nikolay V. Nemshilov aka St. <nemshilov#gma-ilc-om>
1802
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov
1783
1803
  */
1784
1804
  Event.Custom = function(name, options) {
1785
1805
  this.type = name;
@@ -1787,24 +1807,177 @@ Event.Custom = function(name, options) {
1787
1807
  $ext(this, options || {});
1788
1808
  };
1789
1809
 
1810
+ /**
1811
+ * This module contains the basic events-delegation feature support
1812
+ *
1813
+ * Copyright (C) 2010 Nikolay V. Nemshilov
1814
+ */
1815
+ Event.extend({
1816
+ /**
1817
+ * Creates an event delegation handler
1818
+ *
1819
+ * USAGE:
1820
+ *
1821
+ * var delegation = Event.delegate({
1822
+ * "css_rule_1": function() { do_something_usual(); },
1823
+ * "css_rule_2": function() { do_something_another(); },
1824
+ *
1825
+ * // us also can use references by name with or without options
1826
+ * "css_rule_3": ['addClass', 'that-class'],
1827
+ * "css_rule_4": 'hide'
1828
+ * });
1829
+ *
1830
+ * $(element).on('click', delegation);
1831
+ *
1832
+ * NOTE:
1833
+ * your delegation handler will be called in contexts of matching _targets_
1834
+ * not in the context of the element where it was attached
1835
+ *
1836
+ * @param Object delegation rules
1837
+ * @return Function delegation handler
1838
+ */
1839
+ delegate: function(options) {
1840
+ return function(event) {
1841
+ var target = event.target, css_rule, args, callback;
1842
+
1843
+ for (css_rule in options) {
1844
+ if ($(this).select(css_rule).include(target)) {
1845
+ args = options[css_rule];
1846
+ args = isArray(args) ? args : [args];
1847
+ callback = args[0];
1848
+ args = args.slice(1);
1849
+
1850
+ if (isString(callback))
1851
+ target[callback].apply(target, args);
1852
+ else
1853
+ callback.apply(target, [event].concat(args));
1854
+ }
1855
+ }
1856
+ };
1857
+ },
1858
+
1859
+ /**
1860
+ * Creates a document-level events delegations catcher
1861
+ *
1862
+ * USAGE:
1863
+ * Event.behave("ul#main-menu li", "click", function() { alert('clicked'); });
1864
+ * Event.behave("ul#main-menu li", "mouseover", "addClass", "hovered");
1865
+ * Event.behave("ul#main-menu li", {
1866
+ * click: function() { alert('clicked'); },
1867
+ * mouseover: ['addClass', 'hovered'],
1868
+ * mouseout: ['removeClass', 'hovered'],
1869
+ * dblclick: 'hide'
1870
+ * });
1871
+ *
1872
+ * @param String css-rule
1873
+ * @param mixed String event name or a Hash of events
1874
+ * @param mixed Function callback or String method name
1875
+ * @param mixed optional curried arguments
1876
+ * @return Object with event handlers description the document.on() function will receive
1877
+ */
1878
+ behave: function(css_rule, options) {
1879
+ var events = {}, hash = {}, args = $A(arguments).slice(1),
1880
+ focus = 'focus', blur = 'blur', focus_blur = [focus, blur];
1881
+
1882
+ if (isString(options)) {
1883
+ hash[args.shift()] = args;
1884
+ options = hash;
1885
+ }
1886
+
1887
+ for (var event in options) {
1888
+ var hash = {}; hash[css_rule] = options[event];
1889
+
1890
+ if (Browser.IE) {
1891
+ // fancy IE browsers have different names for bubbling versions of those events
1892
+ if (event == focus) event = focus + 'in';
1893
+ if (event == blur) event = focus + 'out';
1894
+ }
1895
+
1896
+ events[event] = Event.delegate(hash);
1897
+
1898
+ if (focus_blur.include(event) && !Browser.IE) {
1899
+ // HACK! HACK! HACK!
1900
+ // by default, method #on uses a non-captive events attachment
1901
+ // but for focus and blur effects we need the opposite
1902
+ // so we calling the method directly and pushing the listeners manually
1903
+
1904
+ document.addEventListener(event, events[event], true);
1905
+
1906
+ (document.$listeners = document.$listeners || []).push({
1907
+ e: event, f: events[event], a: []
1908
+ });
1909
+
1910
+ } else {
1911
+ document.on(event, events[event]);
1912
+ }
1913
+ }
1914
+
1915
+ return events;
1916
+ }
1917
+ });
1918
+
1919
+
1920
+ String.include({
1921
+ /**
1922
+ * A shortcut for document-level events delegation handler attaching
1923
+ *
1924
+ * USAGE:
1925
+ *
1926
+ * "ul#main-menu li".on("click", function() { alert('clicked'); });
1927
+ * "ul#main-menu li".on("mouseover", "addClass", "hovered");
1928
+ * "ul#main-menu li".on("mouseout", "removeClass", "hovered");
1929
+ *
1930
+ * // or like that in a shash
1931
+ * "ul#main-menu li".on({
1932
+ * click: function() { alert('clicked'); },
1933
+ * mouseover: ['addClass', 'hovered'],
1934
+ * mouseout: ['removeClass', 'hovered'],
1935
+ * dblclick: 'hide'
1936
+ * });
1937
+ *
1938
+ * ...
1939
+ * @return String this
1940
+ */
1941
+ on: function() {
1942
+ Event.behave.apply(Event, [''+this].concat($A(arguments)));
1943
+ return this;
1944
+ }
1945
+ });
1946
+
1947
+ $alias(String.prototype, {behave: 'on'});
1948
+
1949
+
1790
1950
  /**
1791
1951
  * The DOM Element unit handling
1792
1952
  *
1793
- * Copyright (C) 2008-2010 Nikolay V. Nemshilov aka St. <nemshilov#gma-ilc-om>
1953
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov
1794
1954
  */
1795
- self.Element = (function(old_Element) {
1955
+ Element = (function(old_Element) {
1956
+
1957
+ // Element constructor options mapper
1958
+ var options_map = {
1959
+ id: ['id', 0],
1960
+ html: ['innerHTML', 0],
1961
+ 'class': ['className', 0],
1962
+ style: ['setStyle', 1],
1963
+ observe: ['on', 1],
1964
+ on: ['on', 1]
1965
+ };
1796
1966
 
1797
- var new_Element = function(tag, options) {
1798
- var element = document.createElement(tag), options = options || {};
1967
+ function new_Element(tag, options) {
1968
+ var element = document.createElement(tag);
1799
1969
 
1800
- if (options.id) { element.id = options.id; delete(options.id); }
1801
- if (options.html) { element.innerHTML = options.html; delete(options.html); }
1802
- if (options['class']) { element.className = options['class']; delete(options['class']); }
1803
- if (options.style) { element.setStyle(options.style); delete(options.style); }
1804
- if (options.observe) { element.observe(options.observe); delete(options.observe); }
1970
+ if (options) {
1971
+ for (var key in options) {
1972
+ if (options_map[key]) {
1973
+ if (options_map[key][1]) element[options_map[key][0]](options[key]);
1974
+ else element[options_map[key][0]] = options[key];
1975
+ } else {
1976
+ element.set(key, options[key]);
1977
+ }
1978
+ }
1979
+ }
1805
1980
 
1806
- for (var key in options) // a filter in case there is no keys in the options left
1807
- return element.set(options);
1808
1981
  return element;
1809
1982
  };
1810
1983
 
@@ -1815,9 +1988,9 @@ self.Element = (function(old_Element) {
1815
1988
  // and we kinda hacking the Element constructor so that
1816
1989
  // it affected IE browsers only
1817
1990
  //
1818
- new_Element = eval('({f:'+new_Element.toString().replace(/(\((\w+), (\w+)\) \{)/,
1819
- '$1if($2=="input"&&$3&&$3.checked)$2="<input checked=true/>";'
1820
- )+'})').f;
1991
+ new_Element = eval('['+new_Element.toString().replace(/(\((\w+),\s*(\w+)\)\s*\{)/,
1992
+ '$1if($2==="input"&&$3)$2="<input name="+$3.name+" type="+$3.type+($3.checked?" checked":"")+"/>";'
1993
+ )+']')[0];
1821
1994
  }
1822
1995
 
1823
1996
  // connecting the old Element instance to the new one for IE browsers
@@ -1827,13 +2000,13 @@ self.Element = (function(old_Element) {
1827
2000
  }
1828
2001
 
1829
2002
  return new_Element;
1830
- })(self.Element);
2003
+ })(window.Element);
1831
2004
 
1832
2005
 
1833
2006
  $ext(Element, {
1834
2007
  /**
1835
2008
  * registeres the methods on the custom element methods list
1836
- * will add them to prototype and will generate a non extensive static mirror
2009
+ * will add them to prototype and register at the Element.Methods hash
1837
2010
  *
1838
2011
  * USAGE:
1839
2012
  * Element.include({
@@ -1841,7 +2014,6 @@ $ext(Element, {
1841
2014
  * });
1842
2015
  *
1843
2016
  * $(element).foo(bar);
1844
- * Element.foo(element, bar);
1845
2017
  *
1846
2018
  * @param Object new methods list
1847
2019
  * @param Boolean flag if the method should keep the existing methods alive
@@ -1851,12 +2023,8 @@ $ext(Element, {
1851
2023
  $ext(this.Methods, methods, dont_overwrite);
1852
2024
 
1853
2025
  try { // busting up the basic element prototypes
1854
- $ext(HTMLElement.prototype, methods, dont_overwrite);
1855
- } catch(e) {
1856
- try { // IE8 native element extension
1857
- $ext(this.parent.prototype, methods, dont_overwrite);
1858
- } catch(e) {}
1859
- }
2026
+ $ext((window.HTMLElement || this.parent).prototype, methods, dont_overwrite);
2027
+ } catch(e) {}
1860
2028
 
1861
2029
  return this;
1862
2030
  },
@@ -1864,9 +2032,6 @@ $ext(Element, {
1864
2032
  Methods: {} // DO NOT Extend this object manually unless you really need it, use Element#include
1865
2033
  });
1866
2034
 
1867
- // the old interface alias, NOTE will be nuked
1868
- Element.addMethods = Element.include;
1869
-
1870
2035
  /**
1871
2036
  * The DOM Element unit structures handling module
1872
2037
  *
@@ -1876,15 +2041,13 @@ Element.addMethods = Element.include;
1876
2041
  * NOTE: if a css-rule was specified then the result of the method
1877
2042
  * will be filtered/adjusted depends on the rule
1878
2043
  *
1879
- * the css-rule might be a string or a Selector instance
1880
- *
1881
2044
  * Credits:
1882
2045
  * The naming principle and most of the names are taken from
1883
2046
  * - Prototype (http://prototypejs.org) Copyright (C) Sam Stephenson
1884
2047
  * The insertions system implementation is inspired by
1885
2048
  * - MooTools (http://mootools.net) Copyright (C) Valerio Proietti
1886
2049
  *
1887
- * Copyright (C) 2008-2010 Nikolay V. Nemshilov aka St. <nemshilov#gma-ilc-om>
2050
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov
1888
2051
  */
1889
2052
  Element.include({
1890
2053
  parent: function(css_rule) {
@@ -1896,9 +2059,9 @@ Element.include({
1896
2059
  },
1897
2060
 
1898
2061
  subNodes: function(css_rule) {
1899
- var first_child = $(this.firstChild);
1900
- return first_child ? (first_child.tagName && (!css_rule || first_child.match(css_rule)) ? [first_child] : []
1901
- ).concat(this.rCollect.call(first_child, 'nextSibling', css_rule)) : [];
2062
+ return this.select(css_rule).filter(function(element) {
2063
+ return element.parentNode === this;
2064
+ }, this);
1902
2065
  },
1903
2066
 
1904
2067
  siblings: function(css_rule) {
@@ -2000,7 +2163,7 @@ Element.include({
2000
2163
  * @return Element self
2001
2164
  */
2002
2165
  update: function(content) {
2003
- if (isString(content) || isNumber(content)) {
2166
+ if ((isString(content) || isNumber(content)) && !Element.insertions.wraps[this.tagName]) {
2004
2167
  var scripts;
2005
2168
  this.innerHTML = (''+content).stripScripts(function(s) { scripts = s; });
2006
2169
  if (scripts) $eval(scripts);
@@ -2155,7 +2318,7 @@ $alias(Element.insertions.wraps, {
2155
2318
  * - MooTools (http://mootools.net) Copyright (C) Valerio Proietti
2156
2319
  * - Dojo (www.dojotoolkit.org) Copyright (C) The Dojo Foundation
2157
2320
  *
2158
- * Copyright (C) 2008-2010 Nikolay V. Nemshilov aka St. <nemshilov#gma-ilc-om>
2321
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov
2159
2322
  */
2160
2323
  Element.include({
2161
2324
  /**
@@ -2168,9 +2331,10 @@ Element.include({
2168
2331
  * @return Element self
2169
2332
  */
2170
2333
  setStyle: function(hash, value) {
2171
- if (value) { var style = {}; style[hash] = value; hash = style; }
2334
+ var key, c_key, style = {};
2335
+
2336
+ if (value) { style[hash] = value; hash = style; }
2172
2337
  else if(isString(hash)) {
2173
- var style = {};
2174
2338
  hash.split(';').each(function(option) {
2175
2339
  var els = option.split(':').map('trim');
2176
2340
  if (els[0] && els[1]) {
@@ -2180,15 +2344,15 @@ Element.include({
2180
2344
  hash = style;
2181
2345
  }
2182
2346
 
2183
- var c_key;
2184
- for (var key in hash) {
2347
+
2348
+ for (key in hash) {
2185
2349
  c_key = key.indexOf('-') != -1 ? key.camelize() : key;
2186
2350
 
2187
2351
  if (key === 'opacity') {
2188
2352
  if (Browser.IE) {
2189
- this.style.filter = 'alpha(opacity='+ value * 100 +')';
2353
+ this.style.filter = 'alpha(opacity='+ hash[key] * 100 +')';
2190
2354
  } else {
2191
- this.style.opacity = value;
2355
+ this.style.opacity = hash[key];
2192
2356
  }
2193
2357
  } else if (key === 'float') {
2194
2358
  c_key = Browser.IE ? 'styleFloat' : 'cssFloat';
@@ -2323,7 +2487,7 @@ Element.include({
2323
2487
  * Most of the naming system in the module inspired by
2324
2488
  * - Prototype (http://prototypejs.org) Copyright (C) Sam Stephenson
2325
2489
  *
2326
- * Copyright (C) 2008-2010 Nikolay V. Nemshilov aka St. <nemshilov#gma-il>
2490
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov
2327
2491
  */
2328
2492
  Element.include({
2329
2493
  /**
@@ -2338,7 +2502,7 @@ Element.include({
2338
2502
 
2339
2503
  for (var key in hash) {
2340
2504
  // some attributes are not available as properties
2341
- if (this[key] === undefined) {
2505
+ if (typeof(this[key]) === 'undefined') {
2342
2506
  this.setAttribute(key, ''+hash[key]);
2343
2507
  }
2344
2508
  this[key] = hash[key];
@@ -2456,7 +2620,7 @@ Element.include({
2456
2620
  * this module contains the Element's part of functionality
2457
2621
  * responsible for the dimensions and positions getting/setting
2458
2622
  *
2459
- * Copyright (C) 2008-2010 Nikolay V. Nemshilov aka St. <nemshilov#gma-il>
2623
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov
2460
2624
  */
2461
2625
  Element.include({
2462
2626
  /**
@@ -2604,10 +2768,11 @@ Element.include({
2604
2768
  /**
2605
2769
  * makes the window be scrolled to the element
2606
2770
  *
2771
+ * @param Object fx options
2607
2772
  * @return Element self
2608
2773
  */
2609
- scrollThere: function() {
2610
- window.scrollTo(this);
2774
+ scrollThere: function(options) {
2775
+ window.scrollTo(this, options);
2611
2776
  return this;
2612
2777
  }
2613
2778
  });
@@ -2615,7 +2780,7 @@ Element.include({
2615
2780
  /**
2616
2781
  * DOM Element events handling methods
2617
2782
  *
2618
- * Copyright (C) 2008-2010 Nikolay V. Nemshilov aka St. <nemshilov#gma-il>
2783
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov
2619
2784
  */
2620
2785
  Element.include((function() {
2621
2786
  var observer = Observer.create({},
@@ -2628,38 +2793,35 @@ Element.include((function() {
2628
2793
  // I'm kinda patching the observer methods manually in here
2629
2794
  // the reason is in building flat and fast functions
2630
2795
  //
2631
- observer.observe = observer.on = eval('({f:'+
2632
- observer.observe.toString().replace(/(\$listeners\.push\((\w+?)\);)/, '$1'+
2633
- '$2.e=Event.cleanName($2.e);$2.n=Event.realName($2.e);'+
2634
-
2635
- '$2.w=function(){var a=$A(arguments),e=($2.r&&$2.r!=="stopEvent")?a.shift():Event.ext(a[0],this);'+
2636
- 'return $2.f.apply(this,a.concat($2.a))};'+(
2637
-
2638
- self.attachEvent ?
2639
- '$2.w=$2.w.bind(this);this.attachEvent("on"+$2.n,$2.w);' :
2640
- 'this.addEventListener($2.n,$2.w,false);'
2641
- )
2642
- )+
2643
- '})').f;
2644
-
2645
- observer.stopObserving = eval('({f:'+
2646
- observer.stopObserving.toString().replace(/(function\s*\((\w+)\)\s*\{\s*)(return\s*)([^}]+)/m,
2647
- '$1var r=$4;'+
2648
- 'if(!r)' + (self.attachEvent ?
2649
- 'this.detachEvent("on"+$2.n,$2.w);' :
2650
- 'this.removeEventListener($2.n,$2.w,false);'
2651
- )+'$3 r')+
2652
- '})').f;
2653
-
2654
-
2655
- observer.fire = eval('({f:'+
2656
- observer.fire.toString().replace(/(\w+)\.f\.apply.*?\.concat\((\w+)\)[^}]/,
2657
- '$1.f.apply(this,[new Event($1.e,$2.shift())].concat($1.a).concat($2))'
2658
- )+
2659
- '})').f;
2660
-
2661
- // a simple events terminator method to be hooked like
2662
- // this.onClick('stopEvent');
2796
+ function hack(name, re, text) {
2797
+ observer[name] = eval('['+ observer[name].toString().replace(re, text) +']')[0];
2798
+ };
2799
+
2800
+ hack('on',
2801
+ /(\$listeners\.push\((\w+?)\);)/,
2802
+
2803
+ '$1$2.e=Event.cleanName($2.e);$2.n=Event.realName($2.e);$2.w=function(){var a=$A(arguments),e=($2.r&&$2.r!=="stopEvent")?a.shift():Event.ext(a[0],this);return $2.f.apply(this,a.concat($2.a))};' + (
2804
+ window.attachEvent ?
2805
+ '$2.w=$2.w.bind(this);this.attachEvent("on"+$2.n,$2.w);' :
2806
+ 'this.addEventListener($2.n,$2.w,false);'
2807
+ )
2808
+ );
2809
+ observer.observe = observer.on;
2810
+
2811
+ hack('stopObserving',
2812
+ /(function\s*\((\w+)\)\s*\{\s*)(return\s*)([^}]+)/m,
2813
+ '$1var r=$4;if(!r)' + (window.attachEvent ?
2814
+ 'this.detachEvent("on"+$2.n,$2.w);' :
2815
+ 'this.removeEventListener($2.n,$2.w,false);'
2816
+ )+'$3 r'
2817
+ );
2818
+
2819
+ hack('fire',
2820
+ /(\w+)\.f\.apply.*?\.concat\((\w+)\)\)/,
2821
+ '$1.f.apply(this,(($1.r&&$1.r!=="stopEvent")?[]:[new Event($1.e,$2.shift())]).concat($1.a).concat($2))'
2822
+ );
2823
+
2824
+ // a simple events terminator method to be hooked like this.onClick('stopEvent');
2663
2825
  observer.stopEvent = function(e) { e.stop(); };
2664
2826
 
2665
2827
  $ext(window, observer);
@@ -2677,7 +2839,7 @@ Element.include((function() {
2677
2839
  * NOTE: this module is just a wrap over the native CSS-selectors feature
2678
2840
  * see the olds/css.js file for the manual selector code
2679
2841
  *
2680
- * Copyright (C) 2008-2010 Nikolay V. Nemshilov aka St. <nemshilov#gma-ilc-om>
2842
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov
2681
2843
  */
2682
2844
  Element.include((function() {
2683
2845
  /**
@@ -2685,7 +2847,7 @@ Element.include((function() {
2685
2847
  * and as we actually search only inside of the element we add it's tag
2686
2848
  * as a scope for the search
2687
2849
  */
2688
- var stub_rule = function(css_rule, tag) {
2850
+ function stub_rule(css_rule, tag) {
2689
2851
  return css_rule ? css_rule.replace(/(^|,)/g, '$1'+ tag + ' ') : '*';
2690
2852
  };
2691
2853
 
@@ -2714,18 +2876,18 @@ return {
2714
2876
  /**
2715
2877
  * checks if the element matches this css-rule
2716
2878
  *
2879
+ * NOTE: the element should be attached to the page
2880
+ *
2717
2881
  * @param String css-rule
2718
2882
  * @return Boolean check result
2719
2883
  */
2720
2884
  match: function(css_rule) {
2721
- if (!css_rule || css_rule == '*') return true;
2722
-
2723
- var fake, result, parent, parents = this.parents();
2885
+ var result, parent = this.tagName === 'HTML' ? this.ownerDocument : this.parents().last();
2724
2886
 
2725
- parent = parents.length ? parents.last() : fake = $E('div').insert(this);
2726
- result = parent.select(css_rule).include(this);
2887
+ // if it's a single node putting it into the context
2888
+ result = $(parent || $E('p').insert(this)).select(css_rule).include(this);
2727
2889
 
2728
- if (fake) { this.remove(); }
2890
+ if (!parent) this.remove();
2729
2891
 
2730
2892
  return result;
2731
2893
  }
@@ -2734,21 +2896,22 @@ return {
2734
2896
  // document-level hooks
2735
2897
  $ext(document, {
2736
2898
  first: function(css_rule) {
2737
- return this.querySelector(css_rule || '*');
2899
+ return this.querySelector(css_rule);
2738
2900
  },
2739
2901
 
2740
2902
  select: function(css_rule) {
2741
- return $A(this.querySelectorAll(css_rule || '*'));
2903
+ return $A(this.querySelectorAll(css_rule));
2742
2904
  }
2743
2905
  });
2744
2906
 
2907
+
2745
2908
  /**
2746
2909
  * the window object extensions
2747
2910
  *
2748
- * Copyright (C) 2008-2009 Nikolay V. Nemshilov aka St. <nemshilov#gma-il>
2911
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov
2749
2912
  */
2750
- $ext(self, (function() {
2751
- var old_scroll = window.scrollTo;
2913
+ $ext(window, (function() {
2914
+ var native_scroll = window.scrollTo;
2752
2915
 
2753
2916
  return {
2754
2917
  /**
@@ -2782,19 +2945,27 @@ return {
2782
2945
  *
2783
2946
  * @param mixed number left position, a hash position, element or a string element id
2784
2947
  * @param number top position
2948
+ * @param Object fx options
2785
2949
  * @return window self
2786
2950
  */
2787
- scrollTo: function(left, top) {
2951
+ scrollTo: function(left, top, fx_options) {
2952
+ var left_pos = left, top_pos = top; // moving the values into new vars so they didn't get screwed later on
2953
+
2788
2954
  if(isElement(left) || (isString(left) && $(left))) {
2789
2955
  left = $(left).position();
2790
2956
  }
2791
2957
 
2792
2958
  if (isHash(left)) {
2793
- top = left.y;
2794
- left = left.x;
2959
+ top_pos = left.y;
2960
+ left_pos = left.x;
2795
2961
  }
2796
2962
 
2797
- old_scroll(left, top);
2963
+ // checking if a smooth scroll was requested
2964
+ if (isHash(fx_options = fx_options || top) && window.Fx) {
2965
+ new Fx.Scroll(this, fx_options).start({x: left_pos, y: top_pos});
2966
+ } else {
2967
+ native_scroll(left_pos, top_pos);
2968
+ }
2798
2969
 
2799
2970
  return this;
2800
2971
  }
@@ -2809,14 +2980,14 @@ return {
2809
2980
  * The basic principles of the module are originated from
2810
2981
  * - MooTools (http://mootools.net) Copyright (C) Valerio Proietti
2811
2982
  *
2812
- * Copyright (C) 2009 Nikolay V. Nemshilov aka St. <nemshilov#gma-ilc-om>
2983
+ * Copyright (C) 2009-2010 Nikolay V. Nemshilov
2813
2984
  */
2814
2985
  [window, document].each(function(object) {
2815
2986
  Observer.createShortcuts(object, ['ready']);
2816
2987
  var ready = object.fire.bind(object, 'ready');
2817
2988
 
2818
2989
  // IE and Konqueror browsers
2819
- if (document.readyState !== undefined) {
2990
+ if (typeof(document.readyState) !== 'undefined') {
2820
2991
  (function() {
2821
2992
  ['loaded','complete'].includes(document.readyState) ? ready() : arguments.callee.delay(50);
2822
2993
  })();
@@ -2833,9 +3004,9 @@ return {
2833
3004
  * The basic principles of the module are inspired by
2834
3005
  * - Prototype (http://prototypejs.org) Copyright (C) Sam Stephenson
2835
3006
  *
2836
- * Copyright (C) 2009-2010 Nikolay V. Nemshilov aka St. <nemshilov#gma-ilc-om>
3007
+ * Copyright (C) 2009-2010 Nikolay V. Nemshilov
2837
3008
  */
2838
- var Form = function(options) {
3009
+ function Form(options) {
2839
3010
  var options = options || {}, remote = options.remote,
2840
3011
  form = new Element('form', Object.without(options, 'remote'));
2841
3012
 
@@ -2872,7 +3043,6 @@ $ext(Form, {
2872
3043
  }
2873
3044
  });
2874
3045
 
2875
- Form.addMethods = Form.include;
2876
3046
  Form.include({
2877
3047
  /**
2878
3048
  * returns the form elements as an array of extended units
@@ -2880,7 +3050,7 @@ Form.include({
2880
3050
  * @return Array of elements
2881
3051
  */
2882
3052
  getElements: function() {
2883
- return this.select('input,select,textarea,button');
3053
+ return $A(this.elements).map($);
2884
3054
  },
2885
3055
 
2886
3056
  /**
@@ -2973,7 +3143,7 @@ Form.include(Observer.createShortcuts({}, $w('submit reset focus')), true);
2973
3143
  * The basic ideas are taken from
2974
3144
  * - Prototype (http://prototypejs.org) Copyright (C) Sam Stephenson
2975
3145
  *
2976
- * Copyright (C) 2009-2010 Nikolay V. Nemshilov aka St. <nemshilov#gma-ilc-om>
3146
+ * Copyright (C) 2009-2010 Nikolay V. Nemshilov
2977
3147
  */
2978
3148
  (function() {
2979
3149
  // trying to get the input element classes list
@@ -3024,7 +3194,7 @@ Form.include(Observer.createShortcuts({}, $w('submit reset focus')), true);
3024
3194
  });
3025
3195
  });
3026
3196
  })();
3027
- Form.Element.addMethods = Form.Element.include;
3197
+
3028
3198
  Form.Element.include({
3029
3199
  /**
3030
3200
  * uniform access to the element values
@@ -3049,7 +3219,7 @@ Form.Element.include({
3049
3219
  */
3050
3220
  setValue: function(value) {
3051
3221
  if (this.type == 'select-multiple') {
3052
- value = (isArray(value) ? value : [value]).map(String);
3222
+ value = $A(isArray(value) ? value : [value]).map(String);
3053
3223
  $A(this.getElementsByTagName('option')).each(function(option) {
3054
3224
  option.selected = value.includes(option.value);
3055
3225
  });
@@ -3128,9 +3298,9 @@ Form.Element.include(Observer.createShortcuts({}, $w('disable enable focus blur
3128
3298
  * Most things in the unit are take from
3129
3299
  * - MooTools (http://mootools.net) Copyright (C) Valerio Proietti
3130
3300
  *
3131
- * Copyright (C) 2008-2009 Nikolay V. Nemshilov aka St. <nemshilov#gma-il>
3301
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov
3132
3302
  */
3133
- var Cookie = new Class({
3303
+ Cookie = new Class({
3134
3304
  include: Options,
3135
3305
 
3136
3306
  extend: {
@@ -3221,9 +3391,9 @@ var Cookie = new Class({
3221
3391
  * - MooTools (http://mootools.net) Copyright (C) Valerio Proietti
3222
3392
  * - jQuery (http://jquery.com) Copyright (C) John Resig
3223
3393
  *
3224
- * Copyright (C) 2008-2009 Nikolay V. Nemshilov aka St. <nemshilov#gma-il>
3394
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov
3225
3395
  */
3226
- var Xhr = new Class(Observer, {
3396
+ Xhr = new Class(Observer, {
3227
3397
  extend: {
3228
3398
  // supported events list
3229
3399
  EVENTS: $w('success failure complete request cancel create'),
@@ -3318,7 +3488,7 @@ var Xhr = new Class(Observer, {
3318
3488
  * @return Xhr self
3319
3489
  */
3320
3490
  send: function(params) {
3321
- var add_params = {}, url = this.url, method = this.method.toLowerCase();
3491
+ var add_params = {}, url = this.url, method = this.method.toLowerCase(), key;
3322
3492
 
3323
3493
  if (method == 'put' || method == 'delete') {
3324
3494
  add_params['_method'] = method;
@@ -3332,7 +3502,7 @@ var Xhr = new Class(Observer, {
3332
3502
  }
3333
3503
 
3334
3504
  if (method == 'get') {
3335
- url += (url.includes('?') ? '&' : '?') + data;
3505
+ if (data) url += (url.includes('?') ? '&' : '?') + data;
3336
3506
  data = null;
3337
3507
  }
3338
3508
 
@@ -3343,7 +3513,7 @@ var Xhr = new Class(Observer, {
3343
3513
 
3344
3514
  this.xhr.onreadystatechange = this.stateChanged.bind(this);
3345
3515
 
3346
- for (var key in this.headers) {
3516
+ for (key in this.headers) {
3347
3517
  this.xhr.setRequestHeader(key, this.headers[key]);
3348
3518
  }
3349
3519
 
@@ -3448,7 +3618,7 @@ var Xhr = new Class(Observer, {
3448
3618
  return JSON.parse(this.text);
3449
3619
  } catch(e) {
3450
3620
  // manual json consistancy check
3451
- if (self.JSON || !(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(this.text.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, ''))) {
3621
+ if (window.JSON || !(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(this.text.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, ''))) {
3452
3622
  if (this.secureJSON) {
3453
3623
  throw "JSON parse error: "+this.text;
3454
3624
  } else {
@@ -3524,7 +3694,7 @@ Xhr.onCreate(function() {
3524
3694
  * - Prototype (http://prototypejs.org) Copyright (C) Sam Stephenson
3525
3695
  * - jQuery (http://jquery.com) Copyright (C) John Resig
3526
3696
  *
3527
- * Copyright (C) 2009-2010 Nikolay V. Nemshilov aka St. <nemshilov#gma-ilc-om>
3697
+ * Copyright (C) 2009-2010 Nikolay V. Nemshilov
3528
3698
  */
3529
3699
  Form.include({
3530
3700
  /**
@@ -3580,7 +3750,7 @@ Form.include({
3580
3750
  * Credits:
3581
3751
  * - jQuery (http://jquery.com) Copyright (C) John Resig
3582
3752
  *
3583
- * Copyright (C) 2008-2010 Nikolay V. Nemshilov aka St. <nemshilov#gma-il>
3753
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov
3584
3754
  */
3585
3755
  Element.include({
3586
3756
  /**
@@ -3601,7 +3771,7 @@ Element.include({
3601
3771
  * This unit presents a fake drop in replacement for the XmlHTTPRequest unit
3602
3772
  * but works with an iframe targeting in the background
3603
3773
  *
3604
- * Copyright (C) 2008-2009 Nikolay V. Nemshilov aka St. <nemshilov#gma-il>
3774
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov
3605
3775
  */
3606
3776
  Xhr.IFramed = new Class({
3607
3777
  /**
@@ -3638,8 +3808,9 @@ Xhr.IFramed = new Class({
3638
3808
  this.status = 200;
3639
3809
  this.readyState = 4;
3640
3810
 
3641
- var doc = window[this.iframe.id].document.documentElement;
3642
- this.responseText = doc ? doc.innerHTML : null;
3811
+ try {
3812
+ this.responseText = window[this.iframe.id].document.documentElement.innerHTML;
3813
+ } catch(e) { }
3643
3814
 
3644
3815
  this.onreadystatechange();
3645
3816
  },
@@ -3658,9 +3829,9 @@ Xhr.IFramed = new Class({
3658
3829
  * The basic principles, structures and naming system are inspired by
3659
3830
  * - MooTools (http://mootools.net) Copyright (C) Valerio Proietti
3660
3831
  *
3661
- * Copyright (C) 2008-2009 Nikolay V. Nemshilov aka St. <nemshilov#gma-ilc-om>
3832
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov
3662
3833
  */
3663
- var Fx = new Class(Observer, {
3834
+ Fx = new Class(Observer, {
3664
3835
  extend: {
3665
3836
  EVENTS: $w('start finish cancel'),
3666
3837
 
@@ -3700,7 +3871,10 @@ var Fx = new Class(Observer, {
3700
3871
  Lin: function(i) {
3701
3872
  return i;
3702
3873
  }
3703
- }
3874
+ },
3875
+
3876
+ ch: [], // scheduled effects registries
3877
+ cr: [] // currently running effects registries
3704
3878
  },
3705
3879
 
3706
3880
  /**
@@ -3710,7 +3884,12 @@ var Fx = new Class(Observer, {
3710
3884
  */
3711
3885
  initialize: function(element, options) {
3712
3886
  this.$super(options);
3713
- this.element = $(element);
3887
+
3888
+ if (this.element = element = $(element)) {
3889
+ var uid = $uid(element);
3890
+ this.ch = (Fx.ch[uid] = Fx.ch[uid] || []);
3891
+ this.cr = (Fx.cr[uid] = Fx.cr[uid] || []);
3892
+ }
3714
3893
  },
3715
3894
 
3716
3895
  /**
@@ -3729,6 +3908,8 @@ var Fx = new Class(Observer, {
3729
3908
  this.steps = (duration / 1000 * this.options.fps).ceil();
3730
3909
  this.number = 1;
3731
3910
 
3911
+ if (this.cr) this.cr.push(this); // adding this effect to the list of currently active
3912
+
3732
3913
  return this.fire('start', this).startTimer();
3733
3914
  },
3734
3915
 
@@ -3738,16 +3919,21 @@ var Fx = new Class(Observer, {
3738
3919
  * @return Fx this
3739
3920
  */
3740
3921
  finish: function() {
3741
- return this.stopTimer().fire('finish').next();
3922
+ return this.stopTimer().unreg().fire('finish').next();
3742
3923
  },
3743
3924
 
3744
3925
  /**
3745
3926
  * interrupts the transition
3746
3927
  *
3928
+ * NOTE:
3929
+ * this method cancels all the scheduled effects
3930
+ * in the element chain
3931
+ *
3747
3932
  * @return Fx this
3748
3933
  */
3749
3934
  cancel: function() {
3750
- return this.stopTimer().fire('cancel').next();
3935
+ this.ch.clean();
3936
+ return this.stopTimer().unreg().fire('cancel');
3751
3937
  },
3752
3938
 
3753
3939
  /**
@@ -3788,12 +3974,14 @@ var Fx = new Class(Observer, {
3788
3974
  that.number ++;
3789
3975
  }
3790
3976
  },
3791
-
3977
+
3978
+ // starts the effect timer
3792
3979
  startTimer: function() {
3793
3980
  this.timer = this.step.periodical((1000 / this.options.fps).round(), this);
3794
3981
  return this;
3795
3982
  },
3796
3983
 
3984
+ // stops the effect timer
3797
3985
  stopTimer: function() {
3798
3986
  if (this.timer) {
3799
3987
  this.timer.stop();
@@ -3804,39 +3992,40 @@ var Fx = new Class(Observer, {
3804
3992
  // handles effects queing
3805
3993
  // should return false if there's no queue and true if there is a queue
3806
3994
  queue: function(args) {
3807
- if (!this.element) return false;
3808
- if (this.$ch) return this.$ch = false;
3809
-
3810
- var uid = $uid(this.element), chain;
3811
- Fx.$ch = Fx.$ch || [];
3812
- chain = (Fx.$ch[uid] = Fx.$ch[uid] || []);
3995
+ var chain = this.ch, queue = this.options.queue;
3996
+
3997
+ if (!chain || this.$ch)
3998
+ return this.$ch = false;
3813
3999
 
3814
- if (this.options.queue)
4000
+ if (queue)
3815
4001
  chain.push([args, this]);
3816
4002
 
3817
- this.next = function() {
3818
- var next = chain.shift(); next = chain[0];
3819
- if (next) {
3820
- next[1].$ch = true;
3821
- next[1].start.apply(next[1], next[0]);
3822
- }
3823
- return this;
3824
- };
3825
-
3826
- return this.options.queue && chain[0][1] !== this;
4003
+ return queue && chain[0][1] !== this;
3827
4004
  },
3828
4005
 
4006
+ // calls for the next effect in the queue
3829
4007
  next: function() {
4008
+ var chain = this.ch, next = chain.shift(), next = chain[0];
4009
+ if (next) {
4010
+ next[1].$ch = true;
4011
+ next[1].start.apply(next[1], next[0]);
4012
+ }
3830
4013
  return this;
3831
- }
4014
+ },
3832
4015
 
4016
+ // unregisters this effect out of the currently running list
4017
+ unreg: function() {
4018
+ var currents = this.cr;
4019
+ if (currents) currents.splice(currents.indexOf(this), 1);
4020
+ return this;
4021
+ }
3833
4022
 
3834
4023
  });
3835
4024
 
3836
4025
  /**
3837
4026
  * There are the String unit extensions for the effects library
3838
4027
  *
3839
- * Copyright (C) 2008-2009 Nikolay V. Nemshilov aka St. <nemshilov#gma-il>
4028
+ * Copyright (C) 2008-2009 Nikolay V. Nemshilov
3840
4029
  */
3841
4030
  String.COLORS = {
3842
4031
  maroon: '#800000',
@@ -3859,7 +4048,7 @@ String.COLORS = {
3859
4048
  brown: '#a52a2a'
3860
4049
  };
3861
4050
 
3862
- $ext(String.prototype, {
4051
+ String.include({
3863
4052
  /**
3864
4053
  * converts a #XXX or rgb(X, X, X) sring into standard #XXXXXX color string
3865
4054
  *
@@ -3907,7 +4096,7 @@ $ext(String.prototype, {
3907
4096
  * The idea is inspired by the Morph effect from
3908
4097
  * - MooTools (http://mootools.net) Copyright (C) Valerio Proietti
3909
4098
  *
3910
- * Copyright (C) 2008-2009 Nikolay V. Nemshilov aka St. <nemshilov#gma-ilc-om>
4099
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov
3911
4100
  */
3912
4101
  Fx.Morph = new Class(Fx, (function() {
3913
4102
  // a list of common style names to compact the code a bit
@@ -3917,13 +4106,13 @@ Fx.Morph = new Class(Fx, (function() {
3917
4106
 
3918
4107
 
3919
4108
  // adds variants to the style names list
3920
- var add_variants = function(keys, key, variants) {
4109
+ function add_variants(keys, key, variants) {
3921
4110
  for (var i=0; i < variants.length; i++)
3922
4111
  keys.push(key + variants[i]);
3923
4112
  };
3924
4113
 
3925
4114
  // adjusts the border-styles
3926
- var check_border_styles = function(before, after) {
4115
+ function check_border_styles(before, after) {
3927
4116
  for (var i=0; i < 4; i++) {
3928
4117
  var direction = directions[i],
3929
4118
  bd_style = Border + direction + Style,
@@ -3946,17 +4135,19 @@ Fx.Morph = new Class(Fx, (function() {
3946
4135
  };
3947
4136
 
3948
4137
  // parses the style hash into a processable format
3949
- var parse_style = function(values) {
3950
- var result = {}, re = /[\d\.\-]+/g, m;
4138
+ function parse_style(values) {
4139
+ var result = {}, re = /[\d\.\-]+/g, m, key, value, i;
3951
4140
 
3952
- for (var key in values) {
4141
+ for (key in values) {
3953
4142
  m = values[key].match(re);
3954
- var value = m.map('toFloat');
4143
+ value = m.map('toFloat');
3955
4144
  value.t = values[key].split(re);
3956
4145
  value.r = value.t[0] === 'rgb(';
3957
- if (value.t[0] === '' || value.r) value.t.shift();
3958
- for (var i=0; i < value.length; i++) {
3959
- value.t.splice(i*2, 0, value[i]);
4146
+
4147
+ if (value.t.length == 1) value.t.unshift('');
4148
+
4149
+ for (i=0; i < value.length; i++) {
4150
+ value.t.splice(i*2 + 1, 0, value[i]);
3960
4151
  }
3961
4152
  result[key] = value;
3962
4153
  }
@@ -3981,19 +4172,18 @@ return {
3981
4172
  },
3982
4173
 
3983
4174
  render: function(delta) {
3984
- var before, after, value, style = this.element.style;
3985
- for (var key in this.after) {
4175
+ var before, after, value, style = this.element.style, key, i;
4176
+ for (key in this.after) {
3986
4177
  before = this.before[key];
3987
4178
  after = this.after[key];
3988
4179
 
3989
- for (var i=0; i < after.length; i++) {
4180
+ for (i=0; i < after.length; i++) {
3990
4181
  value = before[i] + (after[i] - before[i]) * delta;
3991
4182
  if (after.r) value = Math.round(value);
3992
- after.t[i*2] = value;
4183
+ after.t[i*2 + 1] = value;
3993
4184
  }
3994
- value = after.t.join('');
3995
- if (after.r) value = 'rgb('+value;
3996
- style[key] = value;
4185
+
4186
+ style[key] = after.t.join('');
3997
4187
  }
3998
4188
  },
3999
4189
 
@@ -4008,9 +4198,9 @@ return {
4008
4198
  .setStyle('position:absolute;z-index:-1;visibility:hidden')
4009
4199
  .insertTo(this.element, 'before')
4010
4200
  .setWidth(this.element.sizes().x)
4011
- .setStyle(style);
4201
+ .setStyle(style),
4012
4202
 
4013
- var after = this._cloneStyle(dummy, keys);
4203
+ after = this._cloneStyle(dummy, keys);
4014
4204
 
4015
4205
  dummy.remove();
4016
4206
 
@@ -4038,12 +4228,12 @@ return {
4038
4228
  * @return Array of clean style keys list
4039
4229
  */
4040
4230
  _styleKeys: function(style) {
4041
- var keys = [], border_types = [Style, Color, Width];
4231
+ var keys = [], border_types = [Style, Color, Width], key, i, j;
4042
4232
 
4043
- for (var key in style) {
4233
+ for (key in style) {
4044
4234
  if (key.startsWith(Border))
4045
- for (var i=0; i < border_types.length; i++)
4046
- for (var j=0; j < directions.length; j++)
4235
+ for (i=0; i < border_types.length; i++)
4236
+ for (j=0; j < directions.length; j++)
4047
4237
  keys.push(Border + directions[j] + border_types[i]);
4048
4238
  else if (key == 'margin' || key == 'padding')
4049
4239
  add_variants(keys, key, directions);
@@ -4066,9 +4256,9 @@ return {
4066
4256
  * @return void
4067
4257
  */
4068
4258
  _cleanStyles: function(before, after) {
4069
- var remove = [];
4259
+ var remove = [], key;
4070
4260
 
4071
- for (var key in after) {
4261
+ for (key in after) {
4072
4262
  // checking the height/width options
4073
4263
  if ((key == 'width' || key == 'height') && before[key] == 'auto') {
4074
4264
  before[key] = this.element['offset'+key.capitalize()] + 'px';
@@ -4082,7 +4272,7 @@ return {
4082
4272
  check_border_styles.call(this, before, after);
4083
4273
 
4084
4274
  // cleaing up the list
4085
- for (var key in after) {
4275
+ for (key in after) {
4086
4276
  // proprocessing colors
4087
4277
  if (after[key] !== before[key] && !remove.includes(key) && /color/i.test(key)) {
4088
4278
  if (Browser.Opera) {
@@ -4128,7 +4318,7 @@ return {
4128
4318
  /**
4129
4319
  * the elements hightlighting effect
4130
4320
  *
4131
- * Copyright (C) 2008-2009 Nikolay V. Nemshilov aka St. <nemshilov#gma-ilc-om>
4321
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov
4132
4322
  */
4133
4323
  Fx.Highlight = new Class(Fx.Morph, {
4134
4324
  extend: {
@@ -4164,7 +4354,7 @@ Fx.Highlight = new Class(Fx.Morph, {
4164
4354
  /**
4165
4355
  * this is a superclass for the bidirectional effects
4166
4356
  *
4167
- * Copyright (C) 2008-2009 Nikolay V. Nemshilov aka St. <nemshilov#gma-ilc-om>
4357
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov
4168
4358
  */
4169
4359
  Fx.Twin = new Class(Fx.Morph, {
4170
4360
 
@@ -4199,7 +4389,7 @@ Fx.Twin = new Class(Fx.Morph, {
4199
4389
  /**
4200
4390
  * the slide effects wrapper
4201
4391
  *
4202
- * Copyright (C) 2008-2009 Nikolay V. Nemshilov aka St. <nemshilov#gma-ilc-om>
4392
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov
4203
4393
  */
4204
4394
  Fx.Slide = new Class(Fx.Twin, {
4205
4395
  extend: {
@@ -4275,7 +4465,7 @@ Fx.Slide = new Class(Fx.Twin, {
4275
4465
  /**
4276
4466
  * The opacity effects wrapper
4277
4467
  *
4278
- * Copyright (C) 2008-2009 Nikolay V. Nemshilov aka St. <nemshilov#gma-ilc-om>
4468
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov
4279
4469
  */
4280
4470
  Fx.Fade = new Class(Fx.Twin, {
4281
4471
  prepare: function(how) {
@@ -4291,9 +4481,15 @@ Fx.Fade = new Class(Fx.Twin, {
4291
4481
  /**
4292
4482
  * A smooth scrolling visual effect
4293
4483
  *
4294
- * Copyright (C) 2009 Nikolay V. Nemshilov aka St.
4484
+ * Copyright (C) 2009-2010 Nikolay V. Nemshilov
4295
4485
  */
4296
4486
  Fx.Scroll = new Class(Fx, {
4487
+
4488
+ initialize: function(element, options) {
4489
+ // swapping the actual scrollable when it's the window
4490
+ this.$super(element.prompt ? element.document[Browser.WebKit ? 'body' : 'documentElement'] : element, options);
4491
+ },
4492
+
4297
4493
  prepare: function(value) {
4298
4494
  this.before = {};
4299
4495
  this.after = value;
@@ -4303,8 +4499,8 @@ Fx.Scroll = new Class(Fx, {
4303
4499
  },
4304
4500
 
4305
4501
  render: function(delta) {
4306
- var before = this.before;
4307
- for (var key in before) {
4502
+ var before = this.before, key;
4503
+ for (key in before) {
4308
4504
  this.element['scroll' + (key == 'x' ? 'Left' : 'Top')] = before[key] + (this.after[key] - before[key]) * delta;
4309
4505
  }
4310
4506
  }
@@ -4317,7 +4513,7 @@ Fx.Scroll = new Class(Fx, {
4317
4513
  * Some ideas are inspired by
4318
4514
  * - MooTools (http://mootools.net) Copyright (C) Valerio Proietti
4319
4515
  *
4320
- * Copyright (C) 2008-2010 Nikolay V. Nemshilov aka St. <nemshilov#gma-ilc-om>
4516
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov
4321
4517
  */
4322
4518
  Element.include((function(methods) {
4323
4519
  var old_hide = methods.hide,
@@ -4325,12 +4521,22 @@ Element.include((function(methods) {
4325
4521
  old_scroll = methods.scrollTo;
4326
4522
 
4327
4523
  return {
4524
+ /**
4525
+ * Stops all the visual effects on the element
4526
+ *
4527
+ * @return Element this
4528
+ */
4529
+ stop: function() {
4530
+ (Fx.cr[$uid(this)] || []).each('cancel');
4531
+ return this;
4532
+ },
4328
4533
 
4329
4534
  /**
4330
4535
  * hides the element with given visual effect
4331
4536
  *
4332
4537
  * @param String fx name
4333
4538
  * @param Object fx options
4539
+ * @return Element this
4334
4540
  */
4335
4541
  hide: function(fx, options) {
4336
4542
  return fx ? this.fx(fx, ['out', options]) : old_hide.call(this);
@@ -4341,6 +4547,7 @@ return {
4341
4547
  *
4342
4548
  * @param String fx name
4343
4549
  * @param Object fx options
4550
+ * @return Element this
4344
4551
  */
4345
4552
  show: function(fx, options) {
4346
4553
  return fx ? this.fx(fx, ['in', options]) : old_show.call(this);
@@ -4437,14 +4644,14 @@ return {
4437
4644
  * finds the core inclusion tag and uses it's src attribute
4438
4645
  * to dynamically load the olds patch
4439
4646
  *
4440
- * Copyright (C) 2009 Nikolay V. Nemshilov aka St.
4647
+ * Copyright (C) 2009-2010 Nikolay V. Nemshilov
4441
4648
  */
4442
4649
  if (!document.querySelector) {
4443
4650
  (function() {
4444
- var rigth_src_re = /(\/right)([^\/]+)$/;
4445
- var core_src = $A(document.getElementsByTagName('script')).map('src').compact().first('match', rigth_src_re);
4651
+ var rigth_src_re = /(^|\/)(right)([^\/]+)$/,
4652
+ core_src = $A(document.getElementsByTagName('script')).map('src').compact().first('match', rigth_src_re);
4446
4653
  if (core_src)
4447
- document.write('<scr'+'ipt src="'+core_src.replace(rigth_src_re, '$1-olds$2')+'"></scr'+'ipt>');
4654
+ document.write('<scr'+'ipt src="'+core_src.replace(rigth_src_re, '$1$2-olds$3')+'"></scr'+'ipt>');
4448
4655
  })();
4449
4656
  }
4450
4657