right-rails 0.5.3 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +7 -3
- data/Rakefile +19 -0
- data/generators/right_rails/right_rails_generator.rb +8 -0
- data/images/colorpicker.png +0 -0
- data/images/resizable.png +0 -0
- data/javascripts/right-autocompleter-src.js +1 -4
- data/javascripts/right-calendar-src.js +0 -3
- data/javascripts/right-colorpicker-src.js +635 -0
- data/javascripts/right-colorpicker.js +9 -0
- data/javascripts/right-in-edit-src.js +1 -4
- data/javascripts/right-lightbox-src.js +2 -5
- data/javascripts/right-lightbox.js +1 -1
- data/javascripts/right-rails-src.js +29 -5
- data/javascripts/right-rails.js +1 -1
- data/javascripts/right-rater-src.js +1 -4
- data/javascripts/right-resizable-src.js +336 -0
- data/javascripts/right-resizable.js +9 -0
- data/javascripts/right-selectable-src.js +13 -11
- data/javascripts/right-selectable.js +1 -1
- data/javascripts/right-slider-src.js +1 -4
- data/javascripts/right-sortable-src.js +0 -1
- data/javascripts/right-tabs-src.js +2 -5
- data/javascripts/right-tooltips-src.js +19 -11
- data/javascripts/right-tooltips.js +1 -1
- data/javascripts/right-ui-i18n-de.js +8 -2
- data/javascripts/right-ui-i18n-es.js +7 -1
- data/javascripts/right-ui-i18n-fr.js +7 -1
- data/javascripts/right-ui-i18n-hu.js +6 -1
- data/javascripts/right-ui-i18n-jp.js +8 -1
- data/javascripts/right-ui-i18n-nl.js +8 -1
- data/javascripts/right-ui-i18n-pt-br.js +43 -0
- data/javascripts/right-ui-i18n-ru.js +8 -1
- data/javascripts/right-ui-i18n-ua.js +8 -1
- data/javascripts/right-uploader-src.js +1 -4
- data/lib/right_rails/helpers/basic.rb +7 -0
- data/lib/right_rails/helpers/forms.rb +44 -3
- data/lib/right_rails/helpers/misc.rb +55 -16
- data/lib/right_rails/java_script_generator.rb +4 -4
- data/spec/lib/right_rails/helpers/basic_spec.rb +4 -1
- data/spec/lib/right_rails/helpers/forms_spec.rb +10 -0
- data/spec/lib/right_rails/helpers/misc_spec.rb +39 -8
- metadata +11 -4
@@ -0,0 +1,9 @@
|
|
1
|
+
/**
|
2
|
+
* RightJS UI Colorpicker widget
|
3
|
+
*
|
4
|
+
* See http://rightjs.org/ui/colorpicker
|
5
|
+
*
|
6
|
+
* Copyright (C) 2010 Nikolay Nemshilov
|
7
|
+
*/
|
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})("34 14=new 172(Observer,{extend:{EVENTS:$w('147 64 49 167'),76:{117:'hex',46:98,46Bg:98,118:'fade',74:'short',77:'*[rel^=12]'},168:{146:'146'},144:13(e){34 u=$uid(e),b=14.125;if(!b[u]){34 p=b[u]=new 14(eval('('+e.151('data-12-33')+')'));if(e.78=='103')p.68(e);39{34 a=14.76.77.106('[').165().106('^=').150(),m=/\\[(.+?)\\]/.101(e.151(a)),i;if(m&&(i=$(m[1])))p.68(i,e)}}23 b[u]},125:[]},164ialize:13(o){11.$super(o);11.164()},69:13(a){34 c=isArray(a)?a:11.108(a);if(c&&c.length==3){c=c.119(13(v){23 11.62((''+v).133(),0,82)},11);11.30=c;11.30271().46()}23 11},151Value:13(a){23 a?11.30:11[11.33.117==='61'?'111':'104']()},31:13(e,p){11.28.add172('19-12-44').31(e,p);23 11},164:13(){11.161();[11.29,11.27].140(13(e){e.110(11.113.41(11))},11);[11.22,11.96,11.93,11.90].140('on',{keyup:11.86.41(11),145:11.46.41(11),134:11.56.41(11)});11.51.135(11.120.41(11,'167'));11.28.110(13(e){if(e.35.78!=='103'){e.s48();11.56()}}.41(11));11.on146('49').129(13(c){if(11.35)11.35[11.35.78=='103'?'47':'innerHTML']=11[11.33.117=='61'?'111':'104']()}.41(11));if(11.33.46)11.68(11.33.46);if(11.33.46Bg)11.46Bg(11.33.46Bg);11.71=[1,0,0];11.80=0;11.b19=1;11.30=[82,82,82];11.86().46()},161:13(){34 b=11.28=$E('21',{'45':'19-12 19-ui-panel'});11.29=$E('21',{'45':'29'}).31(b);11.29169=$E('21',{'45':'29-36'}).31(11.29);11.27=$E('21',{'45':'27'}).31(b);11.27169=$E('21',{'45':'27-36'}).31(11.27);$E('21',{'45':'91'}).72([11.53=$E('21',{'45':'53','127':' '}).31(b),11.22=$E('37',{'142':'121','45':'22',63:7}).31(b),$E('21',{'45':'61-22'}).72([$E('21').72([$E('107',{127:'R:'}),11.96=$E('37',{63:3,85:0})]),$E('21').72([$E('107',{127:'G:'}),11.93=$E('37',{63:3,85:1})]),$E('21').72([$E('107',{127:'B:'}),11.90=$E('37',{63:3,85:2})])]),11.51=$E('37',{'142':'51','45':'19-ui-51',47:14.168.146})]).31(b)},46:13(){11.29.54.26171='61('+11.71.119(13(a){23(a*82).149()})+')';11.53.54.26171=11.22.47=11.104();34 c=11.30;11.96.47=c[0];11.93.47=c[1];11.90.47=c[2];34 p=11.29169.54,f=11.29.157(),d=f.y-11.b19*f.y-2,l=11.80*f.x-2;p.48=11.62(d,0,f.y-5)+'px';p.59=11.62(l,0,f.x-5)+'px';34 f=11.27.157(),t=11.71,b;if(t[1]==0)b=t[0]==1?t[2]:(2-t[0]);39 if(t[0]==0)b=2+(t[2]==1?t[1]:(2-t[2]));39 b=4+(t[1]==1?t[0]:(2-t[1]));b=b/6*f.y;11.27169.54.48=11.62(b,0,f.y-4)+'px';if(11.122!==''+11.30){11.120('147',11.30);11.122=''+11.30}23 11},86:13(e){if(e){34 f=e.35,v=f.47,a=11.30.156(),c=105;if(f==11.22&&/#\\w{6}/.143(v))c=a=11.108(v);39 if(/^\\d+$/.143(v)){a[f.85]=v;c=true}if(c)11.69(a)}39 11.71230();23 11},113:13(e){e.s48();11.s48170();11.56();14.24=11;e.35.24=true;11.81(e)},s48170:13(){14.24=105;11.29.24=105;11.27.24=105},81:13(e){34 f,p=e.32(),b,l;if(11.29.24)f=11.29.75();39 if(11.27.24)f=11.27.75();if(f){b=11.62(p.y-f.48,0,f.40);l=11.62(p.x-f.59,0,f.42);if(11.29.24){11.80=l/f.42;11.b19=1-b/f.40}39 if(11.27.24){if(b==f.40)b=f.40-0.1;34 s=f.40/6,t=11.71=[0,0,0],a=b % s/s,r=1-a;if(b<s){t[0]=1;t[2]=a}39 if(b<s*2){t[0]=r;t[2]=1}39 if(b<s*3){t[2]=1;t[1]=a}39 if(b<s*4){t[2]=r;t[1]=1}39 if(b<s*5){t[1]=1;t[0]=a}39{t[1]=r;t[0]=1}}11.86().46()}}});14.102({111:13(c){23 '61('+11.30.166(',')+')'},104:13(c){23 '#'+11.30.119(13(a){23(a<16?'0':'')+a.toString(16)}).166('')},108:13(i){34 v=i.toLowerCase(),m;if(m=/61\\((\\d+),(\\d+),(\\d+)\\)/.101(v))23[m[1],m[2],m[3]].119('133');39 if(/#[\\da-f]+/.143(v)){if(m=/^#([\\da-f])([\\da-f])([\\da-f])$/.101(v))v='#'+m[1]+m[1]+m[2]+m[2]+m[3]+m[3];if(m=/#([\\da-f]{2})([\\da-f]{2})([\\da-f]{2})/.101(v))23[m[1],m[2],m[3]].119('133',16)}},30271:13(){34 b=11.30.156().sort(13(c,d){23 c-d}),e=b[0],m=b[2];11.b19=m/82;11.80=1-e/(m||1);11.71.140(13(v,a){23 11.71[a]=((!e&&!m)||e==m)?a==0?1:0:(11.30[a]-e)/(m-e)},11);23 11},71230:13(){34 t=11.71,c=11.30;for(34 i=0;i<3;i++){c[i]=1+11.80*(t[i]-1);c[i]=(82*c[i]*11.b19).149()}23 11},62:13(i,a,m){34 v=i;if(a<m)v=v<a?a:v>m?m:v;39{if(v>m)v=m;if(v<a)v=a}23 v}});14.102({49:13(){if(!11.28.has172('19-12-44')){11.35=98;14.57=98;11.28.49(11.33.118,{131:11.33.74});11.120('49')}23 11},64:13(t){if(t){34 e=$(t).75(),s=11.28.54;if(e){s.59=e.59+'px';s.48=e.48+e.40+'px';11.35=$(t)}}if(14.57&&14.57!==11)14.57.28.49();11.28.31(95.body);if(!11.28.136()){11.28.64(11.33.118,{131:11.33.74});11.120('64')}if(11.35)11.69(11.35.47);23 14.57=11},148:13(t){23 11[11.28.136()?'49':'64'](t)},68:13(i,t){34 i=$(i),t=$(t);if(t)t.135(13(a){a.s48();11.148(i.134())}.41(11));39 i.onFocus(11.64.41(11,i));i.on({145:13(){11.109=(13(){11.49()}).41(11).158(153)}.41(11),keyUp:13(){11.69(i.47)}.41(11)});11.28.49();23 11},46Bg:13(a){34 e=$(a);if(e)11.129(13(c){e.54.26171=11.111()}.41(11));23 11},56:13(){(13(){if(11.109){11.109.cancel();11.109=98}}).41(11).158(10)}});95.on({mouseup:13(){if(14.24)14.24.s48170()},mousemove:13(e){if(14.24)14.24.81(e)},mousedown:13(e){34 p=14.57,t=e.35;if(p&&t!=p.35&&![t].concat(t.parents()).102(p.28))p.49()}});window.on('145',13(){if(14.24)14.24.s48170()});14.76.77.on({134:13(e){if(11.78=='103')14.144(11).64(11)},click:13(e){34 a=14.76.77.106('[').165().106('^=').150(),m=/\\[(.+?)\\]/.101(11.151(a)),i;if(m&&(i=$(m[1]))){e.s48();14.144(11).64(i)}}});95.write(\"<54 142=\\\"121/css\\\">21.19-12,21.19-12*{43:58;26:58;42:128;40:128;32:static;float:58;48:58;59:58;19:58;116:58;38:0;67:0;22:112;141-weight:normal;94-79:center}21.19-12{32:92;67:.6em;26:#EEE;43:160 155 #CCC;-138-43-84:.65;-83-43-84:.65;-138-139-87:#152 .137 .137 .4em;-83-139-87:#152 .137 .137 .4em;z-159:9999}21.19-12 21.29,21.19-12 21.29-36,21.19-12 21.27,21.19-12 21.27-36{26:url(/images/rightjs-ui/12.png) no-repeat 0 0}21.19-12 21.29,21.19-12 21.27,21.19-12 21.91{22:44-112;*22:44;*162:1;32:132;94-79:48;40:130}21.19-12 21.29-36,21.19-12 21.27-36{32:92;48:0px;59:0;42:9px;40:9px}21.19-12 37.22,21.19-12 21.53,21.19-12 21.61-22,21.19-12 37.19-ui-51{141-163:153%;22:112;42:128;67:0 .65}21.19-12 37.22,21.19-12 21.53,21.19-12 21.61-22 37,21.19-12 37.19-ui-51{43:160 155 #152;-138-43-84:.65;-83-43-84:.65}21.19-12 21.29{42:130;26-30:red;89:crosshair;38-19:1.65}21.19-12 21.29-36{26-32:-154 0;38-59:-2px;38-48:-2px}21.19-12 21.27{42:16px;26-32:-130 0;43-30:#EEE;89:36;38-19:.6em}21.19-12 21.27-36{89:default;26-32:-154 -20px;38-59:-8px;38-48:-3px}21.19-12 21.91{42:124}21.19-12 21.53{40:65;26:white;43-30:#BBB}21.19-12 37.22{38-48:.124;26:#FFF;42:4.124}21.19-12 21.61-22{67:0;121-79:19;38-48:.124}21.19-12 21.61-22 107{22:44}21.19-12 21.61-22 37{94-79:48;141-163:153%;42:65;121-79:19;38-59:.65;67:0 .65;26:#FFF;38-116:160;22:44}21.19-12 37.19-ui-51{89:36;32:92;116:0;42:124;26:#CCC}21.19-12-44{22:44-112;*22:44;*162:1;32:132;-138-139-87:58;-83-139-87:58;z-159:128}</54>\");",",,,,,,,,,,,this,colorpicker,function,Colorpicker,,,,,right,,div,display,return,tracking,,background,colors,element,field,color,insertTo,position,options,var,target,pointer,input,margin,else,height,bind,width,border,inline,class,update,value,top,hide,,button,backgroundColor,preview,style,,cancelTimer,current,none,left,updateBg,rgb,bound,maxlength,show,2em,stopTrack,padding,assignTo,setValue,,tint,insert,bright,fxDuration,dimensions,Options,cssRule,tagName,align,satur,trackMove,255,webkit,radius,cIndex,recalc,shadow,colorsPointer,cursor,bDisplay,controls,absolute,gDisplay,vertical,document,rDisplay,fieldPointer,null,,,exec,include,INPUT,toHex,false,split,label,toColor,timer,onMousedown,toRgb,block,startTrack,tint2color,color2tint,bottom,format,fxName,map,fire,text,prevColor,,5em,instances,stop,html,auto,onChange,150px,duration,relative,toInt,focus,onClick,visible,3em,moz,box,each,font,type,test,find,blur,Done,change,toggle,round,first,get,AAA,100,170px,solid,clone,sizes,delay,index,1px,build,zoom,size,init,last,join,done,i18n,Pointer,Track,Color,Class".split(",")));
|
@@ -3,7 +3,6 @@
|
|
3
3
|
*
|
4
4
|
* Copyright (C) 2009-2010 Nikolay V. Nemshilov
|
5
5
|
*/
|
6
|
-
|
7
6
|
/**
|
8
7
|
* An inline editor feature
|
9
8
|
*
|
@@ -192,6 +191,4 @@ Element.include({
|
|
192
191
|
inEdit: function(options) {
|
193
192
|
return new InEdit(this, options).show();
|
194
193
|
}
|
195
|
-
});
|
196
|
-
|
197
|
-
document.write("<style type=\"text/css\">form.right-in-edit,*.right-in-edit-field,*.right-in-edit-submit,*.right-in-edit-cancel,*.right-in-edit-spinner,*.right-in-edit-spinner div{margin:0;padding:0}form.right-in-edit,*.right-in-edit-spinner,*.right-in-edit-spinner div{display:inline-block;*display:inline;*zoom:1;border:none;background:none}textarea.right-in-edit-field{width:100%;margin-bottom:.5em}*.right-in-edit-field,*.right-in-edit-submit,*.right-in-edit-spinner{margin-right:.2em}*.right-in-edit-spinner{background:#EEE;border:1px solid #DDD;-moz-border-radius:.2em;-webkit-border-radius:.2em;text-align:center;line-height:100%}*.right-in-edit-spinner div{width:.3em;height:.7em;margin-top:.3em;background:#BBB;margin-right:2px;-moz-border-radius:.1em;-webkit-border-radius:.1em}*.right-in-edit-spinner div.glow{background:#777}</style>");
|
194
|
+
});document.write("<style type=\"text/css\">form.right-in-edit,*.right-in-edit-field,*.right-in-edit-submit,*.right-in-edit-cancel,*.right-in-edit-spinner,*.right-in-edit-spinner div{margin:0;padding:0}form.right-in-edit,*.right-in-edit-spinner,*.right-in-edit-spinner div{display:inline-block;*display:inline;*zoom:1;border:none;background:none}textarea.right-in-edit-field{width:100%;margin-bottom:.5em}*.right-in-edit-field,*.right-in-edit-submit,*.right-in-edit-spinner{margin-right:.2em}*.right-in-edit-spinner{background:#EEE;border:1px solid #DDD;-moz-border-radius:.2em;-webkit-border-radius:.2em;text-align:center;line-height:100%}*.right-in-edit-spinner div{width:.3em;height:.7em;margin-top:.3em;background:#BBB;margin-right:2px;-moz-border-radius:.1em;-webkit-border-radius:.1em}*.right-in-edit-spinner div.glow{background:#777}</style>");
|
@@ -6,7 +6,6 @@
|
|
6
6
|
* Copyright (C) 2009-2010 Nikolay V. Nemshilov
|
7
7
|
*/
|
8
8
|
if (!RightJS) { throw "Gimme RightJS please." };
|
9
|
-
|
10
9
|
/**
|
11
10
|
* The lightbox widget
|
12
11
|
*
|
@@ -22,7 +21,7 @@ var Lightbox = new Class({
|
|
22
21
|
include: Options,
|
23
22
|
|
24
23
|
extend: {
|
25
|
-
Version: "
|
24
|
+
Version: "#{version}",
|
26
25
|
|
27
26
|
Options: {
|
28
27
|
endOpacity: 0.8,
|
@@ -649,6 +648,4 @@ $(document.documentElement).onClick(function(event) {
|
|
649
648
|
event.stop();
|
650
649
|
new Lightbox(eval('('+link.get('data-lightbox-options')+')')).show(link);
|
651
650
|
}
|
652
|
-
});
|
653
|
-
|
654
|
-
document.write("<style type=\"text/css\">div.lightbox{position:fixed;top:0px;left:0px;width:100%;text-align:center;z-index:9999}div.ligthbox div.right-calendar{z-index:99999}div.lightbox div{line-height:normal}div.lightbox-locker{position:absolute;top:0px;left:0px;width:100%;height:100%;background-color:#000;opacity:0.84;filter:alpha(opacity=84)}div.lightbox-dialog{display:inline-block;*display:inline;*zoom:1;position:relative;text-align:left;padding-bottom:1.6em}div.lightbox-body-wrap{background-color:white;padding:1em;border-radius:.6em;-moz-border-radius:.6em;-webkit-border-radius:.6em}div.lightbox-body{position:relative;height:10em;width:10em;min-height:10em;min-width:10em;overflow:hidden;*background-color:white}div.lightbox-content{position:absolute;*background-color:white}div.lightbox-body-lock{background-color:white;position:absolute;left:0px;top:0px;width:100%;height:100%;text-align:center}div.lightbox-body-lock-spinner{display:none;position:absolute;bottom:0;right:0}div.lightbox-body-lock-spinner div{float:left;width:.5em;height:.9em;background:#AAA;margin-left:.1em;-moz-border-radius:.15em;-webkit-border-radius:.15em}div.lightbox-body-lock-spinner div.glow{background:#666;height:1em;margin-top:-0.05em}div.lightbox-body-lock-loading div.lightbox-body-lock-spinner{display:inline-block;*display:inline;*zoom:1}div.lightbox-body-lock-transparent{background:none}div.lightbox-caption{height:1.2em;margin:0 .7em;margin-bottom:.1em;white-space:nowrap;color:#DDD;font-weight:bold;font-size:1.6em;font-family:Helvetica}div.lightbox-close-button,div.lightbox-prev-link,div.lightbox-next-link{position:absolute;bottom:0;color:#888;cursor:pointer;font-size:150%;font-weight:bold;font-family:Arial}div.lightbox-close-button:hover,div.lightbox-prev-link:hover,div.lightbox-next-link:hover{color:white}div.lightbox-close-button{right:.5em}div.lightbox-prev-link,div.lightbox-next-link{padding:0 .2em;bottom:2px}div.lightbox-prev-link{left:.2em}div.lightbox-next-link{left:2em}div.lightbox-image div.lightbox-body-wrap,div.lightbox-media div.lightbox-body-wrap{padding:0;border:1px solid #777;border-radius:0px;-moz-border-radius:0px;-webkit-border-radius:0px}div.lightbox-image div.lightbox-content img{vertical-align:middle}div.lightbox-image div.lightbox-caption,div.lightbox-media div.lightbox-caption{margin-left:.2em}div.lightbox-image div.lightbox-body-wrap,div.lightbox-image div.lightbox-body-lock,div.lightbox-media div.lightbox-body-wrap,div.lightbox-media div.lightbox-body-lock{background-color:#DDD}div.lightbox-image div.lightbox-body-lock-spinner{bottom:1em;right:1em}div.lightbox-image div.lightbox-close-button{right:.2em}div.lightbox-image div.lightbox-prev-link{left:0}</style>");
|
651
|
+
});document.write("<style type=\"text/css\">div.lightbox{position:fixed;top:0px;left:0px;width:100%;text-align:center;z-index:9999}div.ligthbox div.right-calendar{z-index:99999}div.lightbox div{line-height:normal}div.lightbox-locker{position:absolute;top:0px;left:0px;width:100%;height:100%;background-color:#000;opacity:0.84;filter:alpha(opacity=84)}div.lightbox-dialog{display:inline-block;*display:inline;*zoom:1;position:relative;text-align:left;padding-bottom:1.6em}div.lightbox-body-wrap{background-color:white;padding:1em;border-radius:.6em;-moz-border-radius:.6em;-webkit-border-radius:.6em}div.lightbox-body{position:relative;height:10em;width:10em;min-height:10em;min-width:10em;overflow:hidden;*background-color:white}div.lightbox-content{position:absolute;*background-color:white}div.lightbox-body-lock{background-color:white;position:absolute;left:0px;top:0px;width:100%;height:100%;text-align:center}div.lightbox-body-lock-spinner{display:none;position:absolute;bottom:0;right:0}div.lightbox-body-lock-spinner div{float:left;width:.5em;height:.9em;background:#AAA;margin-left:.1em;-moz-border-radius:.15em;-webkit-border-radius:.15em}div.lightbox-body-lock-spinner div.glow{background:#666;height:1em;margin-top:-0.05em}div.lightbox-body-lock-loading div.lightbox-body-lock-spinner{display:inline-block;*display:inline;*zoom:1}div.lightbox-body-lock-transparent{background:none}div.lightbox-caption{height:1.2em;margin:0 .7em;margin-bottom:.1em;white-space:nowrap;color:#DDD;font-weight:bold;font-size:1.6em;font-family:Helvetica}div.lightbox-close-button,div.lightbox-prev-link,div.lightbox-next-link{position:absolute;bottom:0;color:#888;cursor:pointer;font-size:150%;font-weight:bold;font-family:Arial}div.lightbox-close-button:hover,div.lightbox-prev-link:hover,div.lightbox-next-link:hover{color:white}div.lightbox-close-button{right:.5em}div.lightbox-prev-link,div.lightbox-next-link{padding:0 .2em;bottom:2px}div.lightbox-prev-link{left:.2em}div.lightbox-next-link{left:2em}div.lightbox-image div.lightbox-body-wrap,div.lightbox-media div.lightbox-body-wrap{padding:0;border:1px solid #777;border-radius:0px;-moz-border-radius:0px;-webkit-border-radius:0px}div.lightbox-image div.lightbox-content img{vertical-align:middle}div.lightbox-image div.lightbox-caption,div.lightbox-media div.lightbox-caption{margin-left:.2em}div.lightbox-image div.lightbox-body-wrap,div.lightbox-image div.lightbox-body-lock,div.lightbox-media div.lightbox-body-wrap,div.lightbox-media div.lightbox-body-lock{background-color:#DDD}div.lightbox-image div.lightbox-body-lock-spinner{bottom:1em;right:1em}div.lightbox-image div.lightbox-close-button{right:.2em}div.lightbox-image div.lightbox-prev-link{left:0}</style>");
|
@@ -6,4 +6,4 @@
|
|
6
6
|
* Copyright (C) 2009-2010 Nikolay V. Nemshilov
|
7
7
|
*/
|
8
8
|
if (!RightJS) { throw "Gimme RightJS please." };
|
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})("92.IE6=navigator.userAgent.
|
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})("92.IE6=navigator.userAgent.148(\"MSIE 6\")!=-1;22 21=172 Class({83:144,extend:{Version:\"#{version}\",144:{endOpacity:0.8,68:200,49OnEsc:125,49OnOutClick:125,38Close186:125,b33Content:140,113:\"a[rel^=14]\",115Width:425,115185:350},107:{162:'×',156:'Close',188Text:'&161;&161;&161;',163:'188ious Image',183Text:'&159;&159;&159;',168:'183 Image'},Medias:[[/(175:\\/\\/.*?youtube\\.[a-z]+)\\/watch\\?v=([^&]+)/,'$1/v/$2','154'],[/(175:\\/\\/video.google.com)\\/videoplay\\?docid=([^&]+)/,'$1/googleplayer.154?docId=$2','154'],[/(175:\\/\\/vimeo\\.[a-z]+)\\/([0-9]+).*?/,'$1/moogaloop.154?clip_id=$2','154']],145:[],rescan:16(){}},initialize:16(o){13.set144(o).105().62();21.145.push(13)},94:16(t){(16(){13.78.60(t)}).36(13).delay(13.32.68);17 13},49:16(){13.26.49('fade',{132:13.32.68/2,onFinish:13.26.remove.36(13.26)});17 13},38:16(c,s){17 13.38ing184(16(){13.33();13.31.60(c||'');13.63(s)}.36(13))},63:16(s,n){13.29.69.86=(126.52().y-13.29.52().y)/2+'px';22 a=13.31Size(s);22 h=13.29.52().y-13.24.52().y;22 b=a.41.80()||13.130();22 d={86:(13.26.52().y-b-h)/2+'px'};if(92.IE6){22 p=13.24187.getStyle('75').80()>0?15:0;13.24187.71('75: '+p+'px');d.48=(a.48.80()+p*2)+'px'}if(n===125){13.24.71(a);13.29.71(d);13.56=140}167 13.63Fx(a,d);17 13},33:16(){13.24182.79('14-24-33-95').79('14-24-33-56').38();if(92.OLD)13.24182.71(\"153: 1\");17 13},un33:16(){if(13.32.b33Content)13.24182.97('14-24-33-95');167 13.24182.49();17 13},63182:16(){13.33().31.49()},63Un33:16(){13.un33().31.38('fade',{132:13.32.68/2});13.56=140},31Size:16(s){22 s=s===13.$listeners?171:s,a=13.26.offsetWidth*0.8,m=13.26.offset185*0.8;if(s)13.31.71(s);s=13.31.52();17{48:(s.x>a?a:s.x)+\"px\",41:(s.y>m?m:s.y)+\"px\"}},120:16(r){13.26.63(126.52());if(92.IE6){13.33er.63(126.52());13.26.69.43='57';13.26.69.86=51.51Element.scrollTop+'px'}17 13.63(140,125)},38ing184:16(c){21.145.without(13).each('49');if(13.26.hidden()){13.26.85(51.24).38();13.120()}c();17 13},105:16(){13.26=13.E('14').71('82: 173');13.33er=13.E('14-33er',13.26);13.29=13.E('14-29',13.26);13.78=13.E('14-78',13.29);13.24187=13.E('14-24-121',13.29);13.24=13.E('14-24',13.24187);13.31=13.E('14-31',13.24);13.24182=13.E('14-24-33',13.24).49();if(13.32.38Close186)13.119186=13.E('14-119-109',13.29).91(13.49.36(13)).60(21.107.162).set('98',21.107.156);if(13.32.49OnOutClick)13.33er.91(13.49.36(13));51.on('mousewheel',16(a){if(13.26.139()){a.s86();13[(a.detail||-a.wheelDelta)<0?'38188':'38183']()}}.36(13));17 13},62:16(){if(13.32.49OnEsc)51.174(16(e){if(e.152==27){e.s86();13.49()}}.36AsEventListener(13));126.on('63',13.120.36(13));17 13},130:16(){22 e=$E('19',{'class':'14-24',69:'30: 173; 43: 57'}).85(51.24),h=e.52().y;e.remove();17 h},63Fx:16(f,k){13.63182();22 e=13.24.52().x;22 a=f.48.80();22 c=13.24.52().y;22 b=f.41.80();22 i=13.29.69.86.80();22 g=k.86.80();22 j=13.29.52().x;22 h=(k.48||'0').80();22 f=13.24.69;22 k=13.29.69;$ext(172 Fx(13.29,{132:13.32.68}),{render:16(d){f.48=(e+(a-e)*d)+'px';f.41=(c+(b-c)*d)+'px';k.86=(i+(g-i)*d)+'px';if(92.IE6)k.48=(j+(h-j)*d)+'px'}}).onFinish(13.63Un33.36(13)).start()},E:16(k,p){22 e=$E('19',{'class':k});if(p)e.85(p);17 e}});21.83((16(p){22 f=p.38;22 e=p.105;17{38:16(c){if(c&&c.90)17 13.138(c.90,{65:16(r){13.73(c).94(c.98).31.60(r.134)}.36(13)});167 17 f.76(13,46)},138:16(u,o){22 o=o||{};$w('179 65').each(16(n){o[n]=o[n]?isArray(o[n])?o[n]:[o[n]]:[]});if(o.65.empty()&&!o.onSuccess)o.65.push(16(r){13.31.60(r.134)}.36(13));o.179.unshift(13.131.36(13));o.65.push(13.63.36(13));o.method=o.method||'get';17 13.38ing184(Xhr.138.36(Xhr,u,o))},131:16(){13.56=125;13.33().24182.97('14-24-33-56');17 13},105:16(){22 r=e.76(13,46);22 s=13.E('14-24-33-81',13.24182);22 b='1234'.87('').map(16(a){17 $E('19',{'class':a==1?'glow':171}).85(s)});(16(){22 d=b.pop();d.85(s,'86');b.unshift(d)}).periodical(400);17 r}}})(21.93));21.83((16(p){22 d=p.38;22 o=p.105;22 b=p.62;17{38:16(c){13.28=(c&&c.47)?c:171;17 d.76(13,46)},105:16(){22 r=o.76(13,46);13.117189=13.E('14-117-67',13.29).91(13.38188.36(13)).60(21.107.188Text).set('98',21.107.163).49();13.136189=13.E('14-136-67',13.29).91(13.38183.36(13)).60(21.107.183Text).set('98',21.107.168).49();17 r},62:16(){22 r=b.76(13,46);51.174(16(e){if(e.152==37){e.s86();13.38188()}if(e.152==39){e.s86();13.38183()}}.36(13));17 r},38188:16(){if(13.142()&&13.26.139()&&!13.56)13.38(13.28.47[13.28.47.148(13.28)-1]);17 13},38183:16(){if(13.141()&&13.26.139()&&!13.56)13.38(13.28.47[13.28.47.148(13.28)+1]);17 13},128:16(){13.117189[13.142()?'38':'49']();13.136189[13.141()?'38':'49']();17 13},142:16(){17 13.28&&13.28.47&&13.28.47.116()!=13.28},141:16(){17 13.28&&13.28.47&&13.28.47.165()!=13.28},73:16(l){if(177(l)){22 r=13.32.113.87('[').165(),v=l.get(r.87('^=').116())||'',a=v.match(/\\[(.+?)\\]/);if(a){22 m=r.87('^=').165().87(']').116();l.47=$$(13.32.113.replace(m,\"'\"+m+\"[\"+a[1]+\"]'\"))}}13.28=l;17 13}}})(21.93));21.83((16(){22 o=21.93.38;17{127:$w('jpg jpeg gif png bmp'),38:16(c){13.26[(c&&(c.tagName=='IMG'||13.111(c.90)))?'97':'79']('14-72');if(c&&c.90&&13.111(c.90))17 13.38ing184(16(){13.73(c).131();22 i=172 Image();i.on138=13.60Image.36(13,i,c);i.src=c.90}.36(13));167 17 o.76(13,46)},60Image:16(i,l){13.31.60(i);13.128().94(l.98).63()},111:16(u){17 13.127.83(String(u).toLowerCase().87('?').116().87('.').165())}}})());21.83((16(p){22 o=p.38;22 e={154:['D27CDB6E-AE6D-11cf-96B8-444553540000','175://down138.macro115.com/pub/164/cabs/flash/154lash.cab#version=6,0,40,0','application/x-164-flash']};16 b(a,t){22 s=' 48=\"'+13.32.115Width+'\" 41=\"'+13.32.115185+'\"';17 '<object classid=\"clsid:'+e[t][0]+'\" codebase=\"'+e[t][1]+'\"'+s+'>'+'<param name=\"src\" value=\"'+a+'\" />'+'<embed src=\"'+a+'\" type=\"'+e[t][2]+'\"'+s+' />'+'</object>'};16 c(l){if(177(l)&&l.90){22 a=l.90;17 21.Medias.map(16(d){17 a.match(d[0])?b.call(13,a.replace(d[0],d[1]),d[2]):171},13).compact()[0]}}17{38:16(l){22 m=c.call(13,l);13.26[m?'97':'79']('14-115');if(m){13.31.60(m);17 13.38ing184(16(){13.73(l).94(l.98)}.36(13))}17 o.76(13,46)}}})(21.93));21.extend({49:16(){13.145.each('49')},38:16(){17 13.inst('38',46)},138:16(){17 13.inst('138',46)},inst:16(n,a){22 i=172 21();17 i[n].76(i,a)}});$(51.51Element).91(16(e){22 t=$(e.target);22 s=[t].concat(t.parents());22 l=s.slice(0,s.length-2).116('match',21.144.113);if(l){e.s86();172 21(eval('('+l.get('data-14-32')+')')).38(l)}});51.write(\"<69 type=\\\"176/css\\\">19.14{43:fixed;86:104;74:104;48:170%;176-155:center;z-index:9999}19.ligthbox 19.124-calendar{z-index:99999}19.14 19{line-41:normal}19.14-33er{43:57;86:104;74:104;48:170%;41:170%;30-70:#000;153:0.84;filter:alpha(153=84)}19.14-29{82:129-b33;*82:129;*zoom:1;43:relative;176-155:74;75-89:1.178}19.14-24-121{30-70:102;75:147;59-64:.178;-moz-59-64:.178;-160-59-64:.178}19.14-24{43:relative;41:166;48:166;min-41:166;min-48:166;overflow:hidden;*30-70:102}19.14-31{43:57;*30-70:102}19.14-24-33{30-70:102;43:57;74:104;86:104;48:170%;41:170%;176-155:center}19.14-24-33-81{82:173;43:57;89:0;124:0}19.14-24-33-81 19{float:74;48:.5em;41:.9em;30:#AAA;108-74:.147;-moz-59-64:.15em;-160-59-64:.15em}19.14-24-33-81 19.glow{30:#666;41:147;108-86:-0.05em}19.14-24-33-56 19.14-24-33-81{82:129-b33;*82:129;*zoom:1}19.14-24-33-95{30:173}19.14-78{41:1.146;108:0 .7em;108-89:.147;102-space:no121;70:#DDD;118-weight:bold;118-size:1.178;118-family:Helvetica}19.14-119-109,19.14-117-67,19.14-136-67{43:57;89:0;70:#888;cursor:pointer;118-size:150%;118-weight:bold;118-family:Arial}19.14-119-109:hover,19.14-117-67:hover,19.14-136-67:hover{70:102}19.14-119-109{124:.5em}19.14-117-67,19.14-136-67{75:0 .146;89:2px}19.14-117-67{74:.146}19.14-136-67{74:146}19.14-72 19.14-24-121,19.14-115 19.14-24-121{75:0;59:1px solid #777;59-64:104;-moz-59-64:104;-160-59-64:104}19.14-72 19.14-31 img{vertical-155:middle}19.14-72 19.14-78,19.14-115 19.14-78{108-74:.146}19.14-72 19.14-24-121,19.14-72 19.14-24-33,19.14-115 19.14-24-121,19.14-115 19.14-24-33{30-70:#DDD}19.14-72 19.14-24-33-81{89:147;124:147}19.14-72 19.14-119-109{124:.146}19.14-72 19.14-117-67{74:0}</69>\");",",,,,,,,,,,,,,this,lightbox,,function,return,,div,,Lightbox,var,,body,,element,,roadLink,dialog,background,content,options,lock,,,bind,,show,,,height,,position,,,arguments,roadtrip,width,hide,,document,sizes,,,,loading,absolute,bodyLock,border,update,showingSelf,connectEvents,resize,radius,onComplete,,link,fxDuration,style,color,setStyle,image,checkTheRoad,left,padding,apply,,caption,removeClass,toInt,spinner,display,include,,insertTo,top,split,,bottom,href,onClick,Browser,prototype,setTitle,transparent,,addClass,title,,,showPrev,white,showNext,0px,build,bodyWrap,i18n,margin,button,locker,isImageUrl,documentElement,cssRule,showCloseButton,media,first,prev,font,close,boxResize,wrap,hideOnOutClick,,right,true,window,IMAGE_FORMATS,checkRoadtrip,inline,minBodyHeight,loadLock,duration,resizeUnlock,responseText,blockContent,next,stop,load,visible,false,hasNext,hasPrev,contentSize,Options,boxes,2em,1em,indexOf,updateImage,,mediaHeight,keyCode,opacity,swf,align,CloseTitle,mediaWidth,resizeLock,rsaquo,webkit,lsaquo,CloseText,PrevTitle,shockwave,last,10em,else,NextTitle,hideOnEsc,100,null,new,none,onKeydown,http,text,isElement,6em,onCreate,resizeFx,nextLink,Lock,Next,Self,Height,Button,Wrap,Prev,Link".split(",")));
|
@@ -28,7 +28,10 @@ var RR = {
|
|
28
28
|
|
29
29
|
highlightUpdates: true,
|
30
30
|
|
31
|
-
removeFx: 'fade',
|
31
|
+
removeFx: 'fade', // blocks removing fx
|
32
|
+
insertFx: 'fade', // blocks insertion fx
|
33
|
+
|
34
|
+
insertPosition: 'bottom', // default insert position
|
32
35
|
|
33
36
|
linkToAjaxEdit: '.ajax_edit',
|
34
37
|
linkToAjaxDelete: '.ajax_delete',
|
@@ -72,7 +75,7 @@ var RR = {
|
|
72
75
|
* @return RR this
|
73
76
|
*/
|
74
77
|
highlight: function(id) {
|
75
|
-
if (this.Options.highlightUpdates) {
|
78
|
+
if ($(id) && this.Options.highlightUpdates) {
|
76
79
|
$(id).highlight();
|
77
80
|
}
|
78
81
|
return this;
|
@@ -83,10 +86,31 @@ var RR = {
|
|
83
86
|
*
|
84
87
|
* @param String destination id
|
85
88
|
* @param String content
|
89
|
+
* @param String position
|
86
90
|
* @return RR this
|
87
91
|
*/
|
88
|
-
insert: function(where, what) {
|
89
|
-
|
92
|
+
insert: function(where, what, in_position) {
|
93
|
+
var position = in_position || this.Options.insertPosition, new_element,
|
94
|
+
container = $(where).insert(what, position);
|
95
|
+
|
96
|
+
// trying to find the new block
|
97
|
+
switch (position) {
|
98
|
+
case 'bottom': new_element = container.subNodes().last(); break;
|
99
|
+
case 'top': new_element = container.first(); break;
|
100
|
+
case 'before': new_element = container.prev(); break;
|
101
|
+
case 'after': new_element = container.next(); break;
|
102
|
+
}
|
103
|
+
|
104
|
+
// necely displaying the new block
|
105
|
+
if (new_element && this.Options.insertFx) {
|
106
|
+
new_element.hide().show(this.Options.insertFx, {
|
107
|
+
onFinish: this.highlight.bind(this, new_element)
|
108
|
+
});
|
109
|
+
} else {
|
110
|
+
this.highlight(new_element);
|
111
|
+
}
|
112
|
+
|
113
|
+
return this.rescan(where);
|
90
114
|
},
|
91
115
|
|
92
116
|
/**
|
@@ -192,7 +216,7 @@ var RR = {
|
|
192
216
|
*/
|
193
217
|
rescan: function(scope) {
|
194
218
|
$w('Draggable Droppable Tabs Slider Selectable').each(function(name) {
|
195
|
-
if (self
|
219
|
+
if (name in self) self[name].rescan(this.Options.rescanWithScopes ? scope : null);
|
196
220
|
}, this);
|
197
221
|
|
198
222
|
|
data/javascripts/right-rails.js
CHANGED
@@ -6,4 +6,4 @@
|
|
6
6
|
*
|
7
7
|
* Copyright (C) 2009-2010 Nikolay V. Nemshilov
|
8
8
|
*/
|
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})("
|
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})("7 RR={6:{17at:'js',37:'flashes',42:'slide',14:3200,1096:65,31:'86',19Fx:'86',1995:'73',27:'.52_edit',23:'.52_delete',1510097:65},update_flash:4(c){7 e=$(5.6.37);if(e)5.11(e,c).24();8 5},24:4(){if(5.6.14>-1){7 e=$(5.6.37);if(e&&e.visible())e.67.64(e,5.6.42).delay(5.6.14)}8 5},10:4(i){if($(i)&&5.6.1096)$(i).10();8 5},19:4(a,w,i){7 p=i||5.6.1995,n,c=$(a).19(w,p);switch(p){51 '73':n=c.subNodes().last();40;51 'top':n=c.39();40;51 'be93e':n=c.prev();40;51 'after':n=c.next();40}if(n&&5.6.19Fx)n.67().show(5.6.19Fx,{55:5.10.64(5,n)});34 5.10(n);8 5.15(a)},11:4(i,s){$(i).11(s);8 5.10(i).15(i)},43:4(i){7 e=$(i);if(e){7 r=e.43.64(e);if(5.6.31)e.67(5.6.31,{55:r});34 r()}},16:4(i){7 f=$(i);if(f)f.remotize().enable().71+='.'+5.6.17at;8 5},11_17:4(i,s){7 f=$(i);if(f){f.11(s);5.16(i)}8 5.15(i)},show_17_93:4(i,s){$(i).select('17').49('43');$(i).19(s);8 5.16($(i).39('17')).15(i)},30:4(e){7 t=e.tar29,l=[t].75(t.56()).39('38','a');if(l){if(l.38(5.6.27)){e.36();92.83(l.66+'.'+5.6.17at)}34 if(l.38(5.6.23)&&l.94('59')){e.36();eval('({f:'+l.59.to68().11('.45','.85')+'})').f.call(l)}}},15:4(s){$w('Draggable Droppable Tabs Slider Selectable').49(4(n){if(n in 89)89[n].15(5.6.1510097?s:90)},5);8 5}};(4(){7 u=4(a,e){7 m=e.29('35-58');if(m&&!58(m)){a.36();8 65}};7 c=4(e,o){8 70.merge({onCreate:4(){e.50('52:83ing',5)},onComplete:4(){e.50('52:complete',5)},onSuccess:4(){e.50('52:success',5)},onFailure:4(){e.50('52:failure',5)}},o)};7 g=4(e,l){7 m=l.29('35-44'),r=l.29('35-76');if(u(e,l))8;if(m||r)e.36();if(r)92.83(l.66,c(l,{44:m||'29',57:l.29('35-57')}));34 if(m){7 p=$$('84[48=88-param]')[0],t=$$('84[48=88-token]')[0],f=$E('17',{71:l.66,44:'post'});if(p&&t)f.19('<79 63=\"74\" 48=\"'+p.29('62')+'\" 81=\"'+t.29('62')+'\" />');f.19('<79 63=\"74\" 48=\"_44\" 81=\"'+m+'\"/>').19To(18.body).45()}};7 d=4(e,b){if(!u(e,b)&&$(b.17).94('35-76')){e.36();b.17.85(c(b.17))}};18.on({80:4(e){7 t=e.tar29,f=t.17,l=[t].75(t.56()).39('38','a');if(f&&['45','image'].60(t.63))d(e,t);34 if(l)g(e,l)},keydown:4(e){7 t=e.tar29,f=t.17;if(f&&t.tagName==='INPUT'&&e.keyCode==13)d(e,t)}})})();18.on({ready:4(){RR.24()},80:4(e){RR.30(e)}});[68.9,78.9,Function.9,70,6,53,53.9,window,18].49(4(o){93(7 k in o)try{if(/[A-Z]/.87(k)&&63of(o[k])==='4'){7 u=k.41();if(o[u]===90||o[u]===undefined)o[u]=o[k]}}catch(e){}});[61,Event,91,91.61].49(4(o){7 a={},m=o.Methods;93(7 k in m)if(/[A-Z]/.87(k)&&63of(m[k])==='4')a[k.41()]=m[k];o.60(a)});69(68.9,{54:'25',28:'12',to_f:'toFloat',to_i:'toInt',gsub:'11',down51:'toLower98',up51:'toUpper98',82:'25',77:'12',strip:'trim'});69(78.9,{collect:'map',detect:'filter',54:'25',28:'12',82:'25',77:'12'});",",,,,function,this,Options,var,return,prototype,highlight,replace,lastIndexOf,,flashHideDelay,rescan,remotize_form,form,document,insert,,highlightUpdates,rescanWithScopes,linkToAjaxDelete,hide_flash,indexOf,insertPosition,linkToAjaxEdit,last_index_of,get,process_click,removeFx,,insertFx,else,data,stop,flashId,match,first,break,underscored,flashHideFx,remove,method,submit,target,format,name,each,fire,case,ajax,Observer,index_of,onFinish,parents,spinner,confirm,onclick,include,Element,content,type,bind,true,href,hide,String,$alias,Object,action,typeof,bottom,hidden,concat,remote,rindex,Array,input,click,value,index,load,meta,send,fade,test,csrf,self,null,Form,Xhr,for,has,Position,Updates,Scopes,Case,,With".split(",")));
|
@@ -6,7 +6,6 @@
|
|
6
6
|
* Copyright (C) 2009-2010 Nikolay V. Nemshilov
|
7
7
|
*/
|
8
8
|
if (!self.RightJS) throw "Gimme RightJS";
|
9
|
-
|
10
9
|
/**
|
11
10
|
* The Rating widget
|
12
11
|
*
|
@@ -251,6 +250,4 @@ document.onMouseover(function(event) {
|
|
251
250
|
target.fire('mouseover');
|
252
251
|
}
|
253
252
|
|
254
|
-
});
|
255
|
-
|
256
|
-
document.write("<style type=\"text/css\">div.right-rater,div.right-rater div{margin:0;padding:0;background:none;border:none;display:inline-block;*display:inline;*zoom:1;font-family:Arial;font-size:110%}div.right-rater{width:6em;height:1em;vertical-align:middle}div.right-rater div{float:left;width:1em;height:1em;line-height:1em;text-align:center;cursor:pointer;color:#888}div.right-rater div.right-rater-glow{color:brown;text-shadow:#666 .05em .05em .15em}div.right-rater-disabled div{cursor:default}</style>");
|
253
|
+
});document.write("<style type=\"text/css\">div.right-rater,div.right-rater div{margin:0;padding:0;background:none;border:none;display:inline-block;*display:inline;*zoom:1;font-family:Arial;font-size:110%}div.right-rater{width:6em;height:1em;vertical-align:middle}div.right-rater div{float:left;width:1em;height:1em;line-height:1em;text-align:center;cursor:pointer;color:#888}div.right-rater div.right-rater-glow{color:brown;text-shadow:#666 .05em .05em .15em}div.right-rater-disabled div{cursor:default}</style>");
|
@@ -0,0 +1,336 @@
|
|
1
|
+
/**
|
2
|
+
* Resizable unit for RightJS
|
3
|
+
*
|
4
|
+
* See: http://rightjs.org/ui/resizable
|
5
|
+
*
|
6
|
+
* Copyright (C) 2010 Nikolay Nemshilov
|
7
|
+
*/
|
8
|
+
if (!RightJS) throw "Gimme RightJS";
|
9
|
+
/**
|
10
|
+
* The resizable unit main file
|
11
|
+
*
|
12
|
+
* Copyright (C) 2010 Nikolay Nemshilov
|
13
|
+
*/
|
14
|
+
var Resizable = new Class(Observer, {
|
15
|
+
extend: {
|
16
|
+
EVENTS: $('resize initialize destroy start release'),
|
17
|
+
|
18
|
+
Options: {
|
19
|
+
direction: null, // 'top', 'left', 'right', 'bottom', null for bidrectional
|
20
|
+
|
21
|
+
minWidth: null,
|
22
|
+
maxWidth: null,
|
23
|
+
minHeight: null,
|
24
|
+
maxHeight: null
|
25
|
+
},
|
26
|
+
|
27
|
+
instances: [],
|
28
|
+
|
29
|
+
/**
|
30
|
+
* Tries to find or instanciate the resizable unit
|
31
|
+
* by the mouse event
|
32
|
+
*
|
33
|
+
* @param Event mouse event
|
34
|
+
* @return Resizable instance or null
|
35
|
+
*/
|
36
|
+
findBy: function(event) {
|
37
|
+
var target = event.target, element;
|
38
|
+
if (target.hasClass('right-resizable-handle')) {
|
39
|
+
element = target.parent();
|
40
|
+
return Resizable.instances[$uid(element)] || new Resizable(element);
|
41
|
+
}
|
42
|
+
}
|
43
|
+
},
|
44
|
+
|
45
|
+
/**
|
46
|
+
* Basic constructor
|
47
|
+
*
|
48
|
+
* @param Element reference
|
49
|
+
* @param Object options
|
50
|
+
*/
|
51
|
+
initialize: function(element, options) {
|
52
|
+
this.element = $(element);
|
53
|
+
this.$super(Object.merge(options,
|
54
|
+
eval('('+ this.element.get('data-resizable-options') +')')
|
55
|
+
));
|
56
|
+
|
57
|
+
Resizable.instances[$uid(this.element)] = this.init();
|
58
|
+
this.fire('initialize');
|
59
|
+
},
|
60
|
+
|
61
|
+
/**
|
62
|
+
* destructor
|
63
|
+
*
|
64
|
+
* @return Resizable this
|
65
|
+
*/
|
66
|
+
destroy: function() {
|
67
|
+
this.element
|
68
|
+
.removeClass('right-resizable')
|
69
|
+
.removeClass('right-resizable-top')
|
70
|
+
.removeClass('right-resizable-left')
|
71
|
+
.removeClass('right-resizable-right')
|
72
|
+
.removeClass('right-resizable-bottom')
|
73
|
+
.insert(this.content.childNodes);
|
74
|
+
|
75
|
+
this.content.remove();
|
76
|
+
this.handle.remove();
|
77
|
+
|
78
|
+
Resizable.instances = Resizable.instances.without($uid(this.element));
|
79
|
+
|
80
|
+
this.fire('destroy');
|
81
|
+
},
|
82
|
+
|
83
|
+
/**
|
84
|
+
* Overriding the method to recognize the direction
|
85
|
+
* option from the element class-name
|
86
|
+
*
|
87
|
+
* @param Object options
|
88
|
+
* @return Resizable this
|
89
|
+
*/
|
90
|
+
setOptions: function(options) {
|
91
|
+
// trying to recognize the direction
|
92
|
+
$w('top left right bottom').each(function(direction) {
|
93
|
+
if (this.element.hasClass('right-resizable-'+direction))
|
94
|
+
options.direction = direction;
|
95
|
+
}, this);
|
96
|
+
|
97
|
+
return this.$super(options);
|
98
|
+
},
|
99
|
+
|
100
|
+
/**
|
101
|
+
* Starts the resizing process
|
102
|
+
*
|
103
|
+
* @param Event mouse event
|
104
|
+
*/
|
105
|
+
start: function(event) {
|
106
|
+
this.prevSizes = this.element.sizes();
|
107
|
+
this.prevEvPos = event.position();
|
108
|
+
|
109
|
+
// trying to recognize the boundaries
|
110
|
+
$w('minWidth maxWidth minHeight maxHeight').each(function(dimension) {
|
111
|
+
this[dimension] = this.findDim(dimension);
|
112
|
+
}, this);
|
113
|
+
|
114
|
+
return Resizable.current = this.fire('start', event);
|
115
|
+
},
|
116
|
+
|
117
|
+
/**
|
118
|
+
* Tracks the event during the resize process
|
119
|
+
*
|
120
|
+
* @param Event mouse event
|
121
|
+
*/
|
122
|
+
track: function(event) {
|
123
|
+
var event_pos = event.position(), prev_pos = this.prevEvPos,
|
124
|
+
handle = this.handle.dimensions(),
|
125
|
+
prev_size = this.prevSizes, width = prev_size.x, height = prev_size.y,
|
126
|
+
x_diff = prev_pos.x - event_pos.x,
|
127
|
+
y_diff = prev_pos.y - event_pos.y,
|
128
|
+
min_x = this.minWidth,
|
129
|
+
max_x = this.maxWidth,
|
130
|
+
min_y = this.minHeight,
|
131
|
+
max_y = this.maxHeight,
|
132
|
+
options = this.options,
|
133
|
+
direction = options.direction;
|
134
|
+
|
135
|
+
// calculating the new size
|
136
|
+
width += (direction == 'left' ? 1 : -1) * x_diff;
|
137
|
+
height += (direction == 'top' ? 1 : -1) * y_diff;
|
138
|
+
|
139
|
+
// applying the boundaries
|
140
|
+
if (width < min_x) width = min_x;
|
141
|
+
if (width > max_x) width = max_x;
|
142
|
+
if (height < min_y) height = min_y;
|
143
|
+
if (height > max_y) height = max_y;
|
144
|
+
|
145
|
+
// applying the sizes
|
146
|
+
if (prev_size.x != width && direction != 'top' && direction != 'bottom') {
|
147
|
+
this.setWidth(width);
|
148
|
+
}
|
149
|
+
if (prev_size.y != height && direction != 'left' && direction != 'right') {
|
150
|
+
this.setHeight(height);
|
151
|
+
}
|
152
|
+
|
153
|
+
// adjusting the previous cursor position so that it didn't had a shift
|
154
|
+
if (width == min_x || width == max_x)
|
155
|
+
event_pos.x = handle.left + handle.width / 2;
|
156
|
+
if (height == min_y || height == max_y)
|
157
|
+
event_pos.y = handle.top + handle.height / 2;
|
158
|
+
|
159
|
+
this.prevEvPos = event_pos;
|
160
|
+
this.prevSizes = this.element.sizes();
|
161
|
+
|
162
|
+
this.fire('resize', event);
|
163
|
+
},
|
164
|
+
|
165
|
+
/**
|
166
|
+
* Sets the widget size
|
167
|
+
*
|
168
|
+
* @param Number width or Object {x:NN, y:NN}
|
169
|
+
* @param Number height
|
170
|
+
* @return Resizable this
|
171
|
+
*/
|
172
|
+
setSize: function(in_width, in_height) {
|
173
|
+
var width = in_width, height = in_height;
|
174
|
+
if (isHash(in_width)) {
|
175
|
+
width = in_width.x;
|
176
|
+
height = in_width.y;
|
177
|
+
}
|
178
|
+
return this.setWidth(width).setHeight(height);
|
179
|
+
},
|
180
|
+
|
181
|
+
/**
|
182
|
+
* Sets the width of the widget
|
183
|
+
*
|
184
|
+
* @param Number width
|
185
|
+
* @return Resizable this
|
186
|
+
*/
|
187
|
+
setWidth: function(width) {
|
188
|
+
this.element.setWidth(width);
|
189
|
+
this.content.setWidth(width - this.contXDiff);
|
190
|
+
},
|
191
|
+
|
192
|
+
/**
|
193
|
+
* Sets the height of the widget
|
194
|
+
*
|
195
|
+
* @param Number height
|
196
|
+
* @return Resizable this
|
197
|
+
*/
|
198
|
+
setHeight: function(height) {
|
199
|
+
this.element.setHeight(height);
|
200
|
+
this.content.setHeight(height - this.contYDiff);
|
201
|
+
},
|
202
|
+
|
203
|
+
/**
|
204
|
+
* Marks it the end of the action
|
205
|
+
*
|
206
|
+
* @return Resizable this
|
207
|
+
*/
|
208
|
+
release: function(event) {
|
209
|
+
Resizable.current = null;
|
210
|
+
return this.fire('release', event);
|
211
|
+
},
|
212
|
+
|
213
|
+
/**
|
214
|
+
* Overloading the standard method so that it was sending
|
215
|
+
* current instance as an argument
|
216
|
+
*
|
217
|
+
* @param String event name
|
218
|
+
* @return Resizable this
|
219
|
+
*/
|
220
|
+
fire: function(event, dom_event) {
|
221
|
+
return this.$super(event, this, dom_event);
|
222
|
+
},
|
223
|
+
|
224
|
+
// protected
|
225
|
+
|
226
|
+
init: function() {
|
227
|
+
var class_name = 'right-resizable',
|
228
|
+
handle_class_name = 'right-resizable-handle',
|
229
|
+
content_class_name = 'right-resizable-content';
|
230
|
+
|
231
|
+
// assigning the main element class
|
232
|
+
if (this.options.direction) class_name += '-'+ this.options.direction;
|
233
|
+
this.element.addClass(class_name);
|
234
|
+
|
235
|
+
// checking for the content block
|
236
|
+
this.content = this.element.first('*.'+ content_class_name) || $E('div', {
|
237
|
+
'class': content_class_name
|
238
|
+
}).insert(this.element.childNodes).insertTo(this.element);
|
239
|
+
|
240
|
+
// checking for the handle element
|
241
|
+
this.handle = (this.element.first('*.'+ handle_class_name) || $E('div', {
|
242
|
+
'class': handle_class_name
|
243
|
+
})).insertTo(this.element);
|
244
|
+
|
245
|
+
// used later during the resize process
|
246
|
+
this.contXDiff = this.element.offsetWidth - this.content.offsetWidth;
|
247
|
+
this.contYDiff = this.element.offsetHeight - this.content.offsetHeight;
|
248
|
+
|
249
|
+
return this;
|
250
|
+
},
|
251
|
+
|
252
|
+
// finds dimensions of the element
|
253
|
+
findDim: function(dimension) {
|
254
|
+
var style = this.options[dimension] || this.element.getStyle(dimension);
|
255
|
+
|
256
|
+
if (style && /\d+/.test(style) && style.toFloat() > 0) {
|
257
|
+
var what = dimension.include('Width') ? 'width' : 'height',
|
258
|
+
dummy = (this.dummy || (this.dummy = $E('div', {
|
259
|
+
style: 'visibility:hidden;z-index:-1'
|
260
|
+
})))
|
261
|
+
.setStyle(what, style)
|
262
|
+
.insertTo(this.element, 'before');
|
263
|
+
|
264
|
+
var size = dummy['offset' + what.capitalize()];
|
265
|
+
dummy.remove();
|
266
|
+
|
267
|
+
return size;
|
268
|
+
}
|
269
|
+
}
|
270
|
+
});
|
271
|
+
|
272
|
+
/**
|
273
|
+
* Document level hooks for resizables
|
274
|
+
*
|
275
|
+
* Copyright (C) 2010 Nikolay Nemshilov
|
276
|
+
*/
|
277
|
+
document.on({
|
278
|
+
mousedown: function(event) {
|
279
|
+
var resizable = Resizable.findBy(event);
|
280
|
+
if (resizable) {
|
281
|
+
event.stop();
|
282
|
+
Resizable.current = resizable.start(event);
|
283
|
+
}
|
284
|
+
},
|
285
|
+
|
286
|
+
mousemove: function(event) {
|
287
|
+
var resizable = Resizable.current;
|
288
|
+
if (resizable) {
|
289
|
+
event.stop();
|
290
|
+
resizable.track(event);
|
291
|
+
}
|
292
|
+
},
|
293
|
+
|
294
|
+
mouseup: function(event) {
|
295
|
+
var resizable = Resizable.current;
|
296
|
+
if (resizable) {
|
297
|
+
resizable.release(event);
|
298
|
+
}
|
299
|
+
}
|
300
|
+
});
|
301
|
+
|
302
|
+
window.on('blur', function(event) {
|
303
|
+
var resizable = Resizable.current;
|
304
|
+
if (resizable) {
|
305
|
+
resizable.release(event);
|
306
|
+
}
|
307
|
+
});
|
308
|
+
|
309
|
+
/**
|
310
|
+
* Element level hook to make things resizable
|
311
|
+
*
|
312
|
+
* Copyright (C) 2010 Nikolay Nemshilov
|
313
|
+
*/
|
314
|
+
Element.include({
|
315
|
+
/**
|
316
|
+
* Makes a resizeable out of the element
|
317
|
+
*
|
318
|
+
* @param Object options
|
319
|
+
* @return Element this
|
320
|
+
*/
|
321
|
+
makeResizable: function(options) {
|
322
|
+
new Resizable(this, options);
|
323
|
+
return this;
|
324
|
+
},
|
325
|
+
|
326
|
+
/**
|
327
|
+
* Destroys a resizable functionality
|
328
|
+
*
|
329
|
+
* @return Element this
|
330
|
+
*/
|
331
|
+
undoResizable: function() {
|
332
|
+
var resizable = Resizable.instances[$uid(this)];
|
333
|
+
if (resizable) resizable.destroy();
|
334
|
+
return this;
|
335
|
+
}
|
336
|
+
});document.write("<style type=\"text/css\">.right-resizable,.right-resizable-top,.right-resizable-left,.right-resizable-right,.right-resizable-bottom,.right-resizable-content .right-resizable-handle{margin:0;padding:0;overflow:none;border:none;background:none;width:auto;height:auto;min-width:none;max-width:none;min-height:none;max-height:none}.right-resizable,.right-resizable-top,.right-resizable-left,.right-resizable-right,.right-resizable-bottom{position:relative;min-width:8em;min-height:8em;border:1px solid #DDD}.right-resizable-content{overflow:auto;padding:.5em;position:relative}.right-resizable-handle{position:absolute;background-image:url(/images/rightjs-ui/resizable.png);background-repeat: no-repeat;background-color:#DDD;cursor:move}.right-resizable .right-resizable-handle{right:0;bottom:0;background-position:-2px -2px;background-color:transparent;width:16px;height:16px}.right-resizable-top .right-resizable-handle,.right-resizable-bottom .right-resizable-handle{height:8px;width:100%;background-position:center -26px;cursor:row-resize}.right-resizable-left .right-resizable-handle,.right-resizable-right .right-resizable-handle{top:0px;width:8px;height:100%;background-position:-26px center;cursor:col-resize}.right-resizable-top .right-resizable-content{padding-top:1em}.right-resizable-top .right-resizable-handle{top:0}.right-resizable-bottom .right-resizable-content{padding-bottom:1em}.right-resizable-bottom .right-resizable-handle{bottom:0}.right-resizable-left .right-resizable-content{padding-left:1em}.right-resizable-left .right-resizable-handle{left:0}.right-resizable-right .right-resizable-content{padding-right:1em}.right-resizable-right .right-resizable-handle{right:0}</style>");
|