right-rails 0.4.4 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/init.rb +37 -8
- data/javascripts/right-autocompleter-src.js +55 -41
- data/javascripts/right-autocompleter.js +2 -2
- data/javascripts/right-behavior-src.js +5 -5
- data/javascripts/right-behavior.js +2 -2
- data/javascripts/right-calendar-src.js +139 -67
- data/javascripts/right-calendar.js +2 -2
- data/javascripts/right-dnd-src.js +7 -7
- data/javascripts/right-dnd.js +2 -2
- data/javascripts/right-effects-src.js +9 -9
- data/javascripts/right-effects.js +2 -2
- data/javascripts/right-events-src.js +8 -8
- data/javascripts/right-events.js +2 -2
- data/javascripts/right-in-edit-src.js +10 -8
- data/javascripts/right-in-edit.js +2 -2
- data/javascripts/right-json-src.js +14 -15
- data/javascripts/right-json.js +2 -2
- data/javascripts/right-lightbox-src.js +141 -86
- data/javascripts/right-lightbox.js +3 -3
- data/javascripts/right-olds-src.js +26 -48
- data/javascripts/right-olds.js +2 -2
- data/javascripts/right-rails-src.js +109 -31
- data/javascripts/right-rails.js +2 -2
- data/javascripts/right-rater-src.js +20 -12
- data/javascripts/right-rater.js +2 -2
- data/javascripts/right-selectable-src.js +3 -3
- data/javascripts/right-selectable.js +1 -1
- data/javascripts/right-slider-src.js +3 -3
- data/javascripts/right-slider.js +1 -1
- data/javascripts/right-sortable-src.js +28 -28
- data/javascripts/right-sortable.js +2 -2
- data/javascripts/right-src.js +612 -405
- data/javascripts/right-tabs-src.js +115 -44
- data/javascripts/right-tabs.js +2 -2
- data/javascripts/right-tooltips-src.js +131 -74
- data/javascripts/right-tooltips.js +2 -2
- data/javascripts/right-ui-i18n-fr.js +4 -4
- data/javascripts/right-uploader-src.js +170 -0
- data/javascripts/right-uploader.js +9 -0
- data/javascripts/right.js +2 -4
- data/lib/right_rails.rb +1 -1
- data/lib/right_rails/helpers/basic.rb +10 -2
- data/lib/right_rails/helpers/misc.rb +16 -17
- data/lib/right_rails/helpers/rails.rb +0 -7
- data/spec/lib/right_rails/helpers/basic_spec.rb +0 -1
- data/spec/lib/right_rails/helpers/rails_spec.rb +24 -0
- data/spec/spec_helper.rb +9 -1
- metadata +14 -5
@@ -3,7 +3,7 @@
|
|
3
3
|
*
|
4
4
|
* Home page: http://rightjs.org/ui/lightbox
|
5
5
|
*
|
6
|
-
*
|
6
|
+
* Copyright (C) 2009-2010 Nikolay V. Nemshilov
|
7
7
|
*/
|
8
|
-
if (!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})("
|
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.140(\"MSIE 6\")!=-1;22 21=175 Class({81:154,extend:{Version:\"1.0.0\",154:{endOpacity:0.8,65:200,49OnEsc:119,49OnOutClick:119,38Close186:119,b33Content:145,113:\"a[rel^=14]\",116Width:425,116185:350},110:{174:'×',157:'Close',188Text:'&159;&159;&159;',170:'188ious Image',183Text:'&160;&160;&160;',167:'183 Image'},Medias:[[/(163:\\/\\/.*?youtube\\.[a-z]+)\\/watch\\?v=([^&]+)/,'$1/v/$2','139'],[/(163:\\/\\/video.google.com)\\/videoplay\\?docid=([^&]+)/,'$1/googleplayer.139?docId=$2','139'],[/(163:\\/\\/vimeo\\.[a-z]+)\\/([0-9]+).*?/,'$1/moogaloop.139?clip_id=$2','139']],141:[],rescan:16(){}},initialize:16(o){13.set154(o).97().63();21.141.push(13)},103:16(t){(16(){13.75.59(t)}).36(13).delay(13.31.65);17 13},49:16(){13.26.49('fade',{131:13.31.65/2,179:13.26.remove.36(13.26)});17 13},38:16(c,s){17 13.38ing184(16(){13.33();13.32.59(c||'');13.62(s)}.36(13))},62:16(s,n){13.29.72.86=(126.52().y-13.29.52().y)/2+'px';22 a=13.32Size(s);22 h=13.29.52().y-13.24.52().y;22 b=a.41.78()||13.128();22 d={86:(13.26.52().y-b-h)/2+'px'};if(92.IE6){22 p=13.24187.getStyle('80').78()>0?15:0;13.24187.71('80: '+p+'px');d.48=(a.48.78()+p*2)+'px'}if(n===119){13.24.71(a);13.29.71(d);13.56=145}172 13.62Fx(a,d);17 13},33:16(){13.24182.76('14-24-33-102').76('14-24-33-56').38();if(92.OLD)13.24182.71(\"151: 1\");17 13},un33:16(){if(13.31.b33Content)13.24182.105('14-24-33-102');172 13.24182.49();17 13},62182:16(){13.33().32.49()},62Un33:16(){13.un33().32.38('fade',{131:13.31.65/2});13.56=145},32Size:16(s){22 s=s===13.$listeners?173:s,a=13.26.offsetWidth*0.8,m=13.26.offset185*0.8;if(s)13.32.71(s);s=13.32.52();17{48:(s.x>a?a:s.x)+\"px\",41:(s.y>m?m:s.y)+\"px\"}},120:16(r){13.26.62(126.52());if(92.IE6){13.33er.62(126.52());13.26.72.46='57';13.26.72.86=51.51Element.scrollTop+'px'}17 13.62(145,119)},38ing184:16(c){21.141.without(13).each('49');if(13.26.hidden()){13.26.85(51.24).38();13.120()}c();17 13},97:16(){13.26=13.E('14').71('83: 166');13.33er=13.E('14-33er',13.26);13.29=13.E('14-29',13.26);13.75=13.E('14-75',13.29);13.24187=13.E('14-24-124',13.29);13.24=13.E('14-24',13.24187);13.32=13.E('14-32',13.24);13.24182=13.E('14-24-33',13.24).49();if(13.31.38Close186)13.122186=13.E('14-122-107',13.29).91(13.49.36(13)).59(21.110.174).set('94',21.110.157);if(13.31.49OnOutClick)13.33er.91(13.49.36(13));51.on('mousewheel',16(a){if(13.26.143()){a.s86();13[(a.detail||-a.wheelDelta)<0?'38188':'38183']()}}.36(13));17 13},63:16(){if(13.31.49OnEsc)51.176(16(e){if(e.149==27){e.s86();13.49()}}.36AsEventListener(13));126.on('62',13.120.36(13));17 13},128:16(){22 e=$E('19',{'180':'14-24',72:'30: 166; 46: 57'}).85(51.24),h=e.52().y;e.remove();17 h},62Fx:16(f,k){13.62182();22 e=13.24.52().x;22 a=f.48.78();22 c=13.24.52().y;22 b=f.41.78();22 i=13.29.72.86.78();22 g=k.86.78();22 j=13.29.52().x;22 h=(k.48||'0').78();22 f=13.24.72;22 k=13.29.72;$ext(175 Fx(13.29,{131:13.31.65}),{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'}}).179(13.62Un33.36(13)).start()},E:16(k,p){22 e=$E('19',{'180':k});if(p)e.85(p);17 e}});21.81((16(p){22 f=p.38;22 e=p.97;17{38:16(c){if(c&&c.93)17 13.135(c.93,{67:16(r){13.73(c).103(c.94).32.59(r.133)}.36(13)});172 17 f.82(13,43)},135:16(u,o){22 o=o||{};$w('onCreate 67').each(16(n){o[n]=o[n]?isArray(o[n])?o[n]:[o[n]]:[]});if(o.67.empty()&&!o.onSuccess)o.67.push(16(r){13.32.59(r.133)}.36(13));o.onCreate.unshift(13.130.36(13));o.67.push(13.62.36(13));o.method=o.method||'get';17 13.38ing184(Xhr.135.36(Xhr,u,o))},130:16(){13.56=119;13.33().24182.105('14-24-33-56');17 13},97:16(){22 r=e.82(13,43);22 s=13.E('14-24-33-79',13.24182);22 b='1234'.87('').map(16(a){17 $E('19',{'180':a==1?'glow':173}).85(s)});(16(){22 d=b.pop();d.85(s,'86');b.unshift(d)}).periodical(400);17 r}}})(21.90));21.81((16(p){22 d=p.38;22 o=p.97;22 b=p.63;17{38:16(c){13.28=(c&&c.47)?c:173;17 d.82(13,43)},97:16(){22 r=o.82(13,43);13.117189=13.E('14-117-68',13.29).91(13.38188.36(13)).59(21.110.188Text).set('94',21.110.170).49();13.137189=13.E('14-137-68',13.29).91(13.38183.36(13)).59(21.110.183Text).set('94',21.110.167).49();17 r},63:16(){22 r=b.82(13,43);51.176(16(e){if(e.149==37){e.s86();13.38188()}if(e.149==39){e.s86();13.38183()}}.36(13));17 r},38188:16(){if(13.153()&&13.26.143()&&!13.56)13.38(13.28.47[13.28.47.140(13.28)-1]);17 13},38183:16(){if(13.147()&&13.26.143()&&!13.56)13.38(13.28.47[13.28.47.140(13.28)+1]);17 13},129:16(){13.117189[13.153()?'38':'49']();13.137189[13.147()?'38':'49']();17 13},153:16(){17 13.28&&13.28.47&&13.28.47.118()!=13.28},147:16(){17 13.28&&13.28.47&&13.28.47.168()!=13.28},73:16(l){if(171(l)){22 r=13.31.113.87('[').168(),v=l.get(r.87('^=').118())||'',a=v.match(/\\[(.+?)\\]/);if(a){22 m=r.87('^=').168().87(']').118();l.47=$$(13.31.113.replace(m,\"'\"+m+\"[\"+a[1]+\"]'\"))}}13.28=l;17 13}}})(21.90));21.81((16(){22 o=21.90.38;17{127:$w('jpg jpeg gif png bmp'),38:16(c){13.26[(c&&(c.tagName=='IMG'||13.111(c.93)))?'105':'76']('14-70');if(c&&c.93&&13.111(c.93))17 13.38ing184(16(){13.73(c).130();22 i=175 Image();i.on135=13.59Image.36(13,i,c);i.src=c.93}.36(13));172 17 o.82(13,43)},59Image:16(i,l){13.32.59(i);13.129().103(l.94).62()},111:16(u){17 13.127.81(String(u).toLowerCase().87('?').118().87('.').168())}}})());21.81((16(p){22 o=p.38;22 e={139:['D27CDB6E-AE6D-11cf-96B8-444553540000','163://down135.macro116.com/pub/165/cabs/flash/139lash.cab#version=6,0,40,0','application/x-165-flash']};16 b(a,t){22 s=' 48=\"'+13.31.116Width+'\" 41=\"'+13.31.116185+'\"';17 '<object 180id=\"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(171(l)&&l.93){22 a=l.93;17 21.Medias.map(16(d){17 a.match(d[0])?b.call(13,a.replace(d[0],d[1]),d[2]):173},13).compact()[0]}}17{38:16(l){22 m=c.call(13,l);13.26[m?'105':'76']('14-116');if(m){13.32.59(m);17 13.38ing184(16(){13.73(l).103(l.94)}.36(13))}17 o.82(13,43)}}})(21.90));21.extend({49:16(){13.141.each('49')},38:16(){17 13.inst('38',43)},135:16(){17 13.inst('135',43)},inst:16(n,a){22 i=175 21();17 i[n].82(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).118('match',21.154.113);if(l){e.s86();175 21(eval('('+l.get('data-14-31')+')')).38(l)}});51.write(\"<72 type=\\\"178/css\\\">19.14{46:fixed;86:104;74:104;48:169%;178-155:center;z-index:9999}19.14 19{line-41:normal}19.14-33er{46:57;86:104;74:104;48:169%;41:169%;30-69:#000;151:0.84;filter:alpha(151=84)}19.14-29{83:125-b33;*83:125;*zoom:1;46:relative;178-155:74;80-89:1.177}19.14-24-124{30-69:101;80:146;58-64:.177;-moz-58-64:.177;-161-58-64:.177}19.14-24{46:relative;41:162;48:162;min-41:162;min-48:162;overflow:hidden;*30-69:101}19.14-32{46:57;*30-69:101}19.14-24-33{30-69:101;46:57;74:104;86:104;48:169%;41:169%;178-155:center}19.14-24-33-79{83:166;46:57;89:0;142:0}19.14-24-33-79 19{float:74;48:.5em;41:.9em;30:#AAA;108-74:.146;-moz-58-64:.15em;-161-58-64:.15em}19.14-24-33-79 19.glow{30:#666;41:146;108-86:-0.05em}19.14-24-33-56 19.14-24-33-79{83:125-b33;*83:125;*zoom:1}19.14-24-33-102{30:166}19.14-75{41:1.138;108:0 .7em;108-89:.146;101-space:no124;69:#DDD;121-weight:bold;121-size:1.177;121-family:Helvetica}19.14-122-107,19.14-117-68,19.14-137-68{46:57;89:0;69:#888;cursor:pointer;121-size:150%;121-weight:bold;121-family:Arial}19.14-122-107:hover,19.14-117-68:hover,19.14-137-68:hover{69:101}19.14-122-107{142:.5em}19.14-117-68,19.14-137-68{80:0 .138;89:2px}19.14-117-68{74:.138}19.14-137-68{74:138}19.14-70 19.14-24-124,19.14-116 19.14-24-124{80:0;58:1px solid #777;58-64:104;-moz-58-64:104;-161-58-64:104}19.14-70 19.14-32 img{vertical-155:middle}19.14-70 19.14-75,19.14-116 19.14-75{108-74:.138}19.14-70 19.14-24-124,19.14-70 19.14-24-33,19.14-116 19.14-24-124,19.14-116 19.14-24-33{30-69:#DDD}19.14-70 19.14-24-33-79{89:146;142:146}19.14-70 19.14-122-107{142:.138}19.14-70 19.14-117-68{74:0}</72>\");",",,,,,,,,,,,,,this,lightbox,,function,return,,div,,Lightbox,var,,body,,element,,roadLink,dialog,background,options,content,lock,,,bind,,show,,,height,,arguments,,,position,roadtrip,width,hide,,document,sizes,,,,loading,absolute,border,update,bodyLock,showingSelf,resize,connectEvents,radius,fxDuration,,onComplete,link,color,image,setStyle,style,checkTheRoad,left,caption,removeClass,,toInt,spinner,padding,include,apply,display,,insertTo,top,split,,bottom,prototype,onClick,Browser,href,title,showNext,,build,showPrev,,,white,transparent,setTitle,0px,addClass,bodyWrap,button,margin,locker,i18n,isImageUrl,showCloseButton,cssRule,documentElement,hideOnOutClick,media,prev,first,true,boxResize,font,close,,wrap,inline,window,IMAGE_FORMATS,minBodyHeight,checkRoadtrip,loadLock,duration,blockContent,responseText,resizeUnlock,load,stop,next,2em,swf,indexOf,boxes,right,visible,contentSize,false,1em,hasNext,mediaHeight,keyCode,,opacity,updateImage,hasPrev,Options,align,resizeLock,CloseTitle,mediaWidth,lsaquo,rsaquo,webkit,10em,http,hideOnEsc,shockwave,none,NextTitle,last,100,PrevTitle,isElement,else,null,CloseText,new,onKeydown,6em,text,onFinish,class,resizeFx,Lock,Next,Self,Height,Button,Wrap,Prev,Link".split(",")));
|
@@ -4,37 +4,31 @@
|
|
4
4
|
* The library released under terms of the MIT license
|
5
5
|
* Visit http://rightjs.org for more details
|
6
6
|
*
|
7
|
-
* Copyright (C) 2008-
|
7
|
+
* Copyright (C) 2008-2010 Nikolay V. Nemshilov
|
8
8
|
*/
|
9
9
|
/**
|
10
10
|
* Old IE browser hacks
|
11
11
|
*
|
12
12
|
* Keep them in one place so they were more compact
|
13
13
|
*
|
14
|
-
* Copyright (C) 2009-2010 Nikolay V. Nemshilov
|
14
|
+
* Copyright (C) 2009-2010 Nikolay V. Nemshilov
|
15
15
|
*/
|
16
16
|
if (Browser.OLD) {
|
17
17
|
// loads DOM element extensions for selected elements
|
18
18
|
$ = (function(old_function) {
|
19
19
|
return function(id) {
|
20
20
|
var element = old_function(id);
|
21
|
+
|
22
|
+
// old IE browses match both, ID and NAME
|
23
|
+
if (element !== null && isString(id) && element.id !== id)
|
24
|
+
element = $$('#'+id)[0];
|
25
|
+
|
21
26
|
return element ? Element.prepare(element) : element;
|
22
27
|
}
|
23
28
|
})($);
|
24
29
|
|
25
30
|
|
26
31
|
$ext(document, {
|
27
|
-
/* TODO Not sure about this thing for now
|
28
|
-
It's kinda makes sense, but it will perform
|
29
|
-
double check in node search operations
|
30
|
-
|
31
|
-
getElementById: (function(old_method) {
|
32
|
-
return function(id) {
|
33
|
-
return Element.prepare(old_method(id));
|
34
|
-
};
|
35
|
-
})(document.getElementById),
|
36
|
-
*/
|
37
|
-
|
38
32
|
/**
|
39
33
|
* Overloading the native method to extend the new elements as it is
|
40
34
|
* in all the other browsers
|
@@ -62,7 +56,7 @@ if (Browser.OLD) {
|
|
62
56
|
if (element && element.tagName && !element.set) {
|
63
57
|
$ext(element, Element.Methods, true);
|
64
58
|
|
65
|
-
if (
|
59
|
+
if (window.Form) {
|
66
60
|
switch(element.tagName) {
|
67
61
|
case 'FORM':
|
68
62
|
Form.ext(element);
|
@@ -95,7 +89,7 @@ if (Browser.OLD) {
|
|
95
89
|
/**
|
96
90
|
* Konqueror browser fixes
|
97
91
|
*
|
98
|
-
* Copyright (C) 2009-2010 Nikolay V. Nemshilov
|
92
|
+
* Copyright (C) 2009-2010 Nikolay V. Nemshilov
|
99
93
|
*/
|
100
94
|
|
101
95
|
/**
|
@@ -124,6 +118,13 @@ if (!$E('p').getBoundingClientRect) {
|
|
124
118
|
return {x: left, y: top};
|
125
119
|
}
|
126
120
|
});
|
121
|
+
|
122
|
+
// Konq doesn't have the Form#elements reference
|
123
|
+
Form.include({
|
124
|
+
getElements: function() {
|
125
|
+
return this.select('input,select,textarea,button');
|
126
|
+
}
|
127
|
+
})
|
127
128
|
}
|
128
129
|
|
129
130
|
|
@@ -139,7 +140,7 @@ if (!$E('p').getBoundingClientRect) {
|
|
139
140
|
* - Sizzle (http://sizzlejs.org) Copyright (C) John Resig
|
140
141
|
* - MooTools (http://mootools.net) Copyright (C) Valerio Proietti
|
141
142
|
*
|
142
|
-
* Copyright (C) 2009-2010 Nikolay V. Nemshilov
|
143
|
+
* Copyright (C) 2009-2010 Nikolay V. Nemshilov
|
143
144
|
*/
|
144
145
|
if (!document.querySelector) {
|
145
146
|
Element.include((function() {
|
@@ -297,7 +298,7 @@ if (!document.querySelector) {
|
|
297
298
|
* @return Object atom matcher
|
298
299
|
*/
|
299
300
|
var atoms_cache = {};
|
300
|
-
|
301
|
+
function build_atom(atom) {
|
301
302
|
if (!atoms_cache[atom]) {
|
302
303
|
//
|
303
304
|
// HACK HACK HACK
|
@@ -346,11 +347,7 @@ if (!document.querySelector) {
|
|
346
347
|
// a list of elements in a single call
|
347
348
|
//
|
348
349
|
if (i || c.length || a || p) {
|
349
|
-
var filter = 'function(y){'
|
350
|
-
'var e,r=[];'+
|
351
|
-
'for(var z=0,x=y.length;z<x;z++){'+
|
352
|
-
'e=y[z];_f_'+
|
353
|
-
'}return r}';
|
350
|
+
var filter = 'function(y){var e,r=[];for(var z=0,x=y.length;z<x;z++){e=y[z];_f_}return r}';
|
354
351
|
var patch_filter = function(code) {
|
355
352
|
filter = filter.replace('_f_', code + '_f_');
|
356
353
|
};
|
@@ -360,31 +357,12 @@ if (!document.querySelector) {
|
|
360
357
|
|
361
358
|
// adding the classes matching code
|
362
359
|
if (c.length) patch_filter(
|
363
|
-
'if(e.className){'
|
364
|
-
'var n=e.className.split(" ");'+
|
365
|
-
'if(n.length==1&&c.indexOf(n[0])==-1)continue;'+
|
366
|
-
'else{'+
|
367
|
-
'for(var i=0,l=c.length,b=false;i<l;i++)'+
|
368
|
-
'if(n.indexOf(c[i])==-1){'+
|
369
|
-
'b=true;break;}'+
|
370
|
-
|
371
|
-
'if(b)continue;}'+
|
372
|
-
'}else continue;'
|
360
|
+
'if(e.className){var n=e.className.split(" ");if(n.length==1&&c.indexOf(n[0])==-1)continue;else{for(var i=0,l=c.length,b=false;i<l;i++)if(n.indexOf(c[i])==-1){b=true;break;}if(b)continue;}}else continue;'
|
373
361
|
);
|
374
362
|
|
375
363
|
// adding the attributes matching conditions
|
376
364
|
if (a) patch_filter(
|
377
|
-
'var p,o,v,b=false;'
|
378
|
-
'for (var k in a){p=e.getAttribute(k)||"";o=a[k].o;v=a[k].v;'+
|
379
|
-
'if('+
|
380
|
-
'(o=="="&&p!=v)||'+
|
381
|
-
'(o=="*="&&!p.includes(v))||'+
|
382
|
-
'(o=="^="&&!p.startsWith(v))||'+
|
383
|
-
'(o=="$="&&!p.endsWith(v))||'+
|
384
|
-
'(o=="~="&&!p.split(" ").includes(v))||'+
|
385
|
-
'(o=="|="&&!p.split("-").includes(v))'+
|
386
|
-
'){b=true;break;}'+
|
387
|
-
'}if(b){continue;}'
|
365
|
+
'var p,o,v,b=false;for (var k in a){p=e.getAttribute(k)||"";o=a[k].o;v=a[k].v;if((o=="="&&p!=v)||(o=="*="&&!p.includes(v))||(o=="^="&&!p.startsWith(v))||(o=="$="&&!p.endsWith(v))||(o=="~="&&!p.split(" ").includes(v))||(o=="|="&&!p.split("-").includes(v))){b=true;break;}}if(b){continue;}'
|
388
366
|
);
|
389
367
|
|
390
368
|
// adding the pseudo matchers check
|
@@ -393,7 +371,7 @@ if (!document.querySelector) {
|
|
393
371
|
patch_filter('if(!s[p].call(e,v,s))continue;');
|
394
372
|
}
|
395
373
|
|
396
|
-
desc.filter = eval('
|
374
|
+
desc.filter = eval('['+ filter.replace('_f_', 'r.push(e)') +']')[0];
|
397
375
|
}
|
398
376
|
|
399
377
|
atoms_cache[atom] = desc;
|
@@ -409,7 +387,7 @@ if (!document.querySelector) {
|
|
409
387
|
* @return Function selector
|
410
388
|
*/
|
411
389
|
var tokens_cache = {};
|
412
|
-
|
390
|
+
function build_selector(rule) {
|
413
391
|
var rule_key = rule.join('');
|
414
392
|
if (!tokens_cache[rule_key]) {
|
415
393
|
for (var i=0; i < rule.length; i++) {
|
@@ -475,7 +453,7 @@ if (!document.querySelector) {
|
|
475
453
|
* @return Array of selectors
|
476
454
|
*/
|
477
455
|
var selectors_cache = {}, chunks_cache = {};
|
478
|
-
|
456
|
+
function split_rule_to_selectors(css_rule) {
|
479
457
|
if (!selectors_cache[css_rule]) {
|
480
458
|
chunker.lastIndex = 0;
|
481
459
|
|
@@ -511,7 +489,7 @@ if (!document.querySelector) {
|
|
511
489
|
* @param String raw css-rule
|
512
490
|
* @return Array search result
|
513
491
|
*/
|
514
|
-
|
492
|
+
function select_all(element, css_rule) {
|
515
493
|
var selectors = split_rule_to_selectors(css_rule), result = [];
|
516
494
|
for (var i=0, length = selectors.length; i < length; i++)
|
517
495
|
result = result.concat(selectors[i](element));
|
@@ -541,7 +519,7 @@ if (!document.querySelector) {
|
|
541
519
|
$ext(document, dom_extension);
|
542
520
|
|
543
521
|
// patching the $$ function to make it more efficient
|
544
|
-
|
522
|
+
window.$$ = function(css_rule) {
|
545
523
|
return select_all(document, css_rule || '*');
|
546
524
|
};
|
547
525
|
|
data/javascripts/right-olds.js
CHANGED
@@ -4,6 +4,6 @@
|
|
4
4
|
* The library released under terms of the MIT license
|
5
5
|
* Visit http://rightjs.org for more details
|
6
6
|
*
|
7
|
-
* Copyright (C) 2008-
|
7
|
+
* Copyright (C) 2008-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})("if(
|
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})("if(56.66){$=(7(o){8 7(i){9 e=o(i);if(e!==58&&50(i)&&e.id!==i)e=$$('#'+i)[0];8 e?14.23(e):e}})($);46(21,{create14:(7(o){8 7(t){8 14.23(o(t))}})(21.create14)});46(14,{23:7(e){if(e&&e.11&&!e.set){46(e,14.53,29);if(60.45)switch(e.11){39 'FORM':45.64(e);35;39 'INPUT':39 'SELECT':39 'BUTTON':39 'TEXTAREA':45.14.64(e);35}}8 e}});14.34((7(){9 o=14.53.49;8{49:7(a,c){8 o.22(12,a,c).each(14.23)}}})())}if(!$E('p').getBoundingClientRect){14.34({27:7(){9 l=12.offsetLeft,t=12.offsetTop,a=12.51('27'),p=12.31,b=12.ownerDocument.body;15(p&&p.11){if(p===b||p.51('27')!='static'){if(p!==b||a!='absolute'){9 s=p.27();l+=s.x;t+=s.y}35}p=p.31}8{x:l,y:t}}});45.34({get14s:7(){8 12.37('input,37,t64area,button')}})}if(!21.querySelector)14.34((7(){9 H={' ':7(e,t){8 $A(e.get14sByTagName(t))},'>':7(e,t){9 r=[],n=e.26Child;15(n){if(t=='*'||n.11==t)r.30(n);n=n.19}8 r},'+':7(e,t){15(e=e.19)if(e.11)8(t=='*'||e.11==t)?[e]:[];8[]},'~':7(e,t){9 r=[];15(e=e.19)if(t=='*'||e.11==t)r.30(e);8 r}};9 G={57:7(){8 12.57},47:7(){8 12.47},empty:7(){8!(12.innerT64||12.innerHTML||12.t64Content||'').13},'26-16':7(t){9 n=12;15(n=n.20)if(n.11&&(!t||n.11==t))8 24;8 29},'26-of-44':7(){8 17[1]['26-16'].22(12,12.11)},'42-16':7(t){9 n=12;15(n=n.19)if(n.11&&(!t||n.11==t))8 24;8 29},'42-of-44':7(){8 17[1]['42-16'].22(12,12.11)},'59-16':7(t,m){8 m['26-16'].22(12,t)&&m['42-16'].22(12,t)},'59-of-44':7(){8 17[1]['59-16'].22(12,12.11,17[1])},'63-16':7(d,c,t){if(!12.31)8 24;d=d.toLower68();if(d=='n')8 29;if(d.25('n')){9 a=b=0;if(m=d.28(/^([+-]?\\d*)?n([+-]?\\d*)?$/)){a=m[1]=='-'?-1:48(m[1],10)||1;b=48(m[2],10)||0}9 i=1,n=12;15((n=n.20))if(n.11&&(!t||n.11==t))i++;8(i-b)% a==0&&(i-b)/a>=0}38 8 c['61'].22(12,d.62()-1,c,t)},'63-of-44':7(n){8 17[1]['63-16'].22(12,n,17[1],12.11)},61:7(a,m,t){a=50(a)?a.62():a;9 n=12,c=0;15((n=n.20))if(n.11&&(!t||n.11==t)&&++c>a)8 24;8 c==a}};9 A=/((?:\\((?:\\([^()]+\\)|[^()]+)+\\)|\\[(?:\\[[^[\\]]*\\]|['\"][^'\"]*['\"]|[^[\\]'\"]+)+\\]|\\\\.|[^ >+~,(\\[\\\\]+)+|[>+~])(\\s*,\\s*)?/g;9 E=/#([\\w\\-_]+)/;9 L=/^[\\w\\*]+/;9 C=/\\.([\\w\\-\\._]+)/;9 F=/:([\\w\\-]+)(\\((.+?)\\))*$/;9 w=/\\[((?:[\\w-]*:)?[\\w-]+)\\s*(?:([!^$*~|]?=)\\s*((['\"])([^\\4]*?)\\4|([^'\"][^\\]]*?)))?\\]/;9 q={};7 x(b){if(!q[b]){9 i,t,c,a,p,v,m,d={};15(m=b.28(w)){a=a||{};a[m[1]]={o:m[2],v:m[5]||m[6]};b=b.33(m[0],'')}if(m=b.28(F)){p=m[1];v=m[3]==''?58:m[3];b=b.33(m[0],'')}i=(b.28(E)||[1,58])[1];t=(b.28(L)||'*').toString().toUpper68();c=(b.28(C)||[1,''])[1].40('.').without('');d.65=t;if(i||c.13||a||p){9 f='7(y){9 e,r=[];32(9 z=0,x=y.13;z<x;z++){e=y[z];55}8 r}';9 e=7(c){f=f.33('55',c+'55')};if(i)e('if(e.id!=i)18;');if(c.13)e('if(e.43){9 n=e.43.40(\" \");if(n.13==1&&c.54(n[0])==-1)18;38{32(9 i=0,l=c.13,b=24;i<l;i++)if(n.54(c[i])==-1){b=29;35;}if(b)18;}}38 18;');if(a)e('9 p,o,v,b=24;32 (9 k in a){p=e.getAttribute(k)||\"\";o=a[k].o;v=a[k].v;if((o==\"=\"&&p!=v)||(o==\"*=\"&&!p.25(v))||(o==\"^=\"&&!p.starts67(v))||(o==\"$=\"&&!p.ends67(v))||(o==\"~=\"&&!p.40(\" \").25(v))||(o==\"|=\"&&!p.40(\"-\").25(v))){b=29;35;}}if(b){18;}');if(p&&G[p]){9 s=G;e('if(!s[p].22(e,v,s))18;')}d.41=eval('['+f.33('55','r.30(e)')+']')[0]}q[b]=d}8 q[b]};9 M={};7 y(g){9 h=g.join('');if(!M[h]){32(9 i=0;i<g.13;i++)g[i][1]=x(g[i][1]);9 c=$uid;9 k=7(e){9 b=[],a=[],u;32(9 i=0,l=e.13;i<l;i++){u=c(e[i]);if(!a[u]){b.30(e[i]);a[u]=29}}8 b};9 d=7(e,a){9 r=H[a[0]](e,a[1].65);8 a[1].41?a[1].41(r):r};M[h]=7(e){9 f,s;32(9 i=0,a=g.13;i<a;i++){if(i==0)f=d(e,g[i]);38{if(i>1)f=k(f);32(9 j=0;j<f.13;j++){s=d(f[j],g[i]);s.52(1);s.52(j);f.splice.apply(f,s);j+=s.13-3}}}8 g.13>1?k(f):f}}8 M[h]};9 J={},B={};7 K(c){if(!J[c]){A.42Index=0;9 b=[],a=[],r=' ',m,t;15(m=A.exec(c)){t=m[1];if(t=='+'||t=='>'||t=='~')r=t;38{a.30([r,t]);r=' '}if(m[2]){b.30(y(a));a=[]}}b.30(y(a));J[c]=b}8 J[c]};7 I(e,c){9 s=K(c),r=[];32(9 i=0,l=s.13;i<l;i++)r=r.concat(s[i](e));if(56.66)r.32Each(14.23);8 r};9 D={26:7(c){8 12.37(c).26()},37:7(c){8 I(12,c||'*')}};46(21,D);60.$$=7(c){8 I(21,c||'*')};8 D})());",",,,,,,,function,return,var,,tagName,this,length,Element,while,child,arguments,continue,nextSibling,previousSibling,document,call,prepare,false,includes,first,position,match,true,push,parentNode,for,replace,include,break,createElement,select,else,case,split,filter,last,className,type,Form,$ext,disabled,parseInt,rCollect,isString,getStyle,unshift,Methods,indexOf,_f_,Browser,checked,null,only,window,index,toInt,nth,ext,tag,OLD,With,Case".split(",")));
|
@@ -4,15 +4,14 @@
|
|
4
4
|
*
|
5
5
|
* http://github.com/MadRabbit/right-rails
|
6
6
|
*
|
7
|
-
* Copyright (C) Nikolay V. Nemshilov
|
7
|
+
* Copyright (C) 2009-2010 Nikolay V. Nemshilov
|
8
8
|
*/
|
9
9
|
|
10
10
|
/**
|
11
11
|
* RR is the common ajax operations wrapper for ruby on rails
|
12
12
|
*
|
13
|
-
* Copyright (C) 2009 Nikolay V. Nemshilov
|
13
|
+
* Copyright (C) 2009-2010 Nikolay V. Nemshilov
|
14
14
|
*/
|
15
|
-
;
|
16
15
|
var RR = {
|
17
16
|
/**
|
18
17
|
* Basic options
|
@@ -31,6 +30,9 @@ var RR = {
|
|
31
30
|
|
32
31
|
removeFx: 'fade',
|
33
32
|
|
33
|
+
linkToAjaxEdit: '.ajax_edit',
|
34
|
+
linkToAjaxDelete: '.ajax_delete',
|
35
|
+
|
34
36
|
rescanWithScopes: true // if it should rescan only updated elements
|
35
37
|
},
|
36
38
|
|
@@ -164,29 +166,23 @@ var RR = {
|
|
164
166
|
},
|
165
167
|
|
166
168
|
/**
|
167
|
-
*
|
169
|
+
* watches link clicks and processes the ajax edit/delete operations
|
168
170
|
*
|
169
|
-
* @
|
171
|
+
* @param Event event
|
170
172
|
*/
|
171
|
-
|
172
|
-
|
173
|
+
process_click: function(event) {
|
174
|
+
var target = event.target, link = [target].concat(target.parents()).first('match', 'a');
|
173
175
|
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
176
|
+
if (link) {
|
177
|
+
if (link.match(this.Options.linkToAjaxEdit)) {
|
178
|
+
event.stop();
|
179
|
+
Xhr.load(link.href + '.' + this.Options.format);
|
178
180
|
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
link.onclick = function(event) { event.stop();
|
183
|
-
Xhr.load(link.href + '.' + this.Options.format);
|
184
|
-
}.bind(this);
|
185
|
-
}
|
181
|
+
} else if (link.match(this.Options.linkToAjaxDelete) && link.has('onclick')) {
|
182
|
+
event.stop();
|
183
|
+
eval('({f:'+ link.onclick.toString().replace('.submit', '.send')+'})').f.call(link);
|
186
184
|
}
|
187
|
-
}
|
188
|
-
|
189
|
-
return this;
|
185
|
+
}
|
190
186
|
},
|
191
187
|
|
192
188
|
/**
|
@@ -195,10 +191,7 @@ var RR = {
|
|
195
191
|
* @return RR this
|
196
192
|
*/
|
197
193
|
rescan: function(scope) {
|
198
|
-
|
199
|
-
|
200
|
-
$w('Lightbox Calendar Autocompleter Draggable Droppable Sortable Tabs Slider Rater Selectable'
|
201
|
-
).each(function(name) {
|
194
|
+
$w('Draggable Droppable Tabs Slider Selectable').each(function(name) {
|
202
195
|
if (self[name]) self[name].rescan(this.Options.rescanWithScopes ? scope : null);
|
203
196
|
}, this);
|
204
197
|
|
@@ -207,14 +200,99 @@ var RR = {
|
|
207
200
|
}
|
208
201
|
};
|
209
202
|
|
203
|
+
/**
|
204
|
+
* Rails 3 UJS support module
|
205
|
+
*
|
206
|
+
* Copyright (C) 2010 Nikolay V. Nemshilov
|
207
|
+
*/
|
208
|
+
(function() {
|
209
|
+
// tries to cancel the event via confirmation
|
210
|
+
var user_cancels = function(event, element) {
|
211
|
+
var message = element.get('data-confirm');
|
212
|
+
if (message && !confirm(message)) {
|
213
|
+
event.stop();
|
214
|
+
return true;
|
215
|
+
}
|
216
|
+
};
|
217
|
+
|
218
|
+
// adds XHR events to the element
|
219
|
+
var add_xhr_events = function(element, options) {
|
220
|
+
return Object.merge({
|
221
|
+
onCreate: function() { element.fire('ajax:loading', this) },
|
222
|
+
onComplete: function() { element.fire('ajax:complete', this) },
|
223
|
+
onSuccess: function() { element.fire('ajax:success', this) },
|
224
|
+
onFailure: function() { element.fire('ajax:failure', this) }
|
225
|
+
}, options);
|
226
|
+
};
|
227
|
+
|
228
|
+
// processes link clicks
|
229
|
+
var try_link_submit = function(event, link) {
|
230
|
+
var method = link.get('data-method'), remote = link.get('data-remote');
|
231
|
+
|
232
|
+
if (user_cancels(event, link)) return;
|
233
|
+
if (method || remote) event.stop();
|
234
|
+
|
235
|
+
if (remote)
|
236
|
+
Xhr.load(link.href, add_xhr_events(link, {
|
237
|
+
method: method || 'get',
|
238
|
+
spinner: link.get('data-spinner')
|
239
|
+
}));
|
240
|
+
|
241
|
+
else if (method) {
|
242
|
+
var param = $$('meta[name=csrf-param]')[0],
|
243
|
+
token = $$('meta[name=csrf-token]')[0],
|
244
|
+
form = $E('form', {action: link.href, method: 'post'});
|
245
|
+
|
246
|
+
if (param && token)
|
247
|
+
form.insert('<input type="hidden" name="'+param.get('content')+'" value="'+token.get('content')+'" />');
|
248
|
+
form.insert('<input type="hidden" name="_method" value="'+method+'"/>')
|
249
|
+
.insertTo(document.body).submit();
|
250
|
+
}
|
251
|
+
};
|
252
|
+
|
253
|
+
// processes form submits
|
254
|
+
var try_form_submit = function(event, button) {
|
255
|
+
if (!user_cancels(event, button) && $(button.form).has('data-remote')) {
|
256
|
+
event.stop();
|
257
|
+
button.form.send(add_xhr_events(button.form));
|
258
|
+
}
|
259
|
+
};
|
260
|
+
|
261
|
+
// global events listeners
|
262
|
+
document.on({
|
263
|
+
click: function (event) {
|
264
|
+
var target = event.target, form = target.form,
|
265
|
+
link = [target].concat(target.parents()).first('match', 'a');
|
266
|
+
|
267
|
+
if (form && ['submit', 'image'].include(target.type))
|
268
|
+
try_form_submit(event, target);
|
269
|
+
else if (link)
|
270
|
+
try_link_submit(event, link);
|
271
|
+
},
|
272
|
+
|
273
|
+
keydown: function(event) {
|
274
|
+
var target = event.target, form = target.form;
|
275
|
+
if (form && target.tagName === 'INPUT' && event.keyCode == 13) {
|
276
|
+
try_form_submit(event, target);
|
277
|
+
}
|
278
|
+
}
|
279
|
+
});
|
280
|
+
})();
|
281
|
+
|
210
282
|
// the document onload hook
|
211
|
-
document.
|
212
|
-
|
283
|
+
document.on({
|
284
|
+
ready: function() {
|
285
|
+
RR.hide_flash();
|
286
|
+
},
|
287
|
+
|
288
|
+
click: function(event) {
|
289
|
+
RR.process_click(event);
|
290
|
+
}
|
213
291
|
});
|
214
292
|
/**
|
215
293
|
* Underscored aliases for Ruby On Rails
|
216
294
|
*
|
217
|
-
* Copyright (C) 2009 Nikolay V. Nemshilov
|
295
|
+
* Copyright (C) 2009-2010 Nikolay V. Nemshilov
|
218
296
|
*/
|
219
297
|
|
220
298
|
// the language and window level aliases
|
@@ -222,7 +300,7 @@ document.onReady(function() {
|
|
222
300
|
for (var key in object) {
|
223
301
|
try { // some keys are not accessable
|
224
302
|
|
225
|
-
if (/[A-Z]/.test(key) && typeof(object[key])
|
303
|
+
if (/[A-Z]/.test(key) && typeof(object[key]) === 'function') {
|
226
304
|
var u_key = key.underscored();
|
227
305
|
if (object[u_key] === null || object[u_key] === undefined) {
|
228
306
|
object[u_key] = object[key];
|
@@ -238,12 +316,12 @@ document.onReady(function() {
|
|
238
316
|
var aliases = {}, methods = object.Methods;
|
239
317
|
|
240
318
|
for (var key in methods) {
|
241
|
-
if (/[A-Z]/.test(key) && typeof(methods[key])
|
319
|
+
if (/[A-Z]/.test(key) && typeof(methods[key]) === 'function') {
|
242
320
|
aliases[key.underscored()] = methods[key];
|
243
321
|
}
|
244
322
|
}
|
245
323
|
|
246
|
-
object.
|
324
|
+
object.include(aliases);
|
247
325
|
});
|
248
326
|
|
249
327
|
|
data/javascripts/right-rails.js
CHANGED
@@ -4,6 +4,6 @@
|
|
4
4
|
*
|
5
5
|
* http://github.com/MadRabbit/right-rails
|
6
6
|
*
|
7
|
-
* Copyright (C) Nikolay V. Nemshilov
|
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})("8 RR={6:{17at:'js',36:'flashes',37:'slide',14:3200,1688:59,30:'fade',26:'.45_edit',23:'.45_delete',109089:59},update_flash:4(c){8 e=$(5.6.36);if(e)5.11(e,c).24();7 5},24:4(){if(5.6.14>-1){8 e=$(5.6.36);if(e&&e.visible())e.79.82(e,5.6.37).delay(5.6.14)}7 5},16:4(i){if(5.6.1688)$(i).16();7 5},19:4(a,w){7 5.16($(a).19(w).lastChild).10(a)},11:4(i,s){$(i).11(s);7 5.16(i).10(i)},41:4(i){8 e=$(i);if(e){8 r=e.41.82(e).chain(Lightbox.10);if(5.6.30)e.79(5.6.30,{onFinish:r});47 r}},15:4(i){8 f=$(i);if(f)f.remotize().enable().65+='.'+5.6.17at;7 5},11_17:4(i,s){8 f=$(i);if(f){f.11(s);5.15(i)}7 5.10(i)},show_17_86:4(i,s){$(i).select('17').46('41');$(i).19(s);7 5.15($(i).50('17')).10(i)},28:4(e){8 t=e.tar29,l=[t].68(t.53()).50('34','a');if(l){if(l.34(5.6.26)){e.33();85.81(l.58+'.'+5.6.17at)}47 if(l.34(5.6.23)&&l.87('52')){e.33();eval('({f:'+l.52.to66().11('.39','.78')+'})').f.call(l)}}},10:4(s){$w('Draggable Droppable Tabs Slider Selectable').46(4(n){if(84[n])84[n].10(5.6.109089?s:80)},5);7 5}};(4(){8 u=4(a,e){8 m=e.29('31-57');if(m&&!57(m)){a.33();7 59}};8 c=4(e,o){7 63.merge({onCreate:4(){e.43('45:81ing',5)},onComplete:4(){e.43('45:complete',5)},onSuccess:4(){e.43('45:success',5)},onFailure:4(){e.43('45:failure',5)}},o)};8 g=4(e,l){8 m=l.29('31-38'),r=l.29('31-69');if(u(e,l))7;if(m||r)e.33();if(r)85.81(l.58,c(l,{38:m||'29',55:l.29('31-55')}));47 if(m){8 p=$$('83[44=77-param]')[0],t=$$('83[44=77-token]')[0],f=$E('17',{65:l.58,38:'post'});if(p&&t)f.19('<73 60=\"62\" 44=\"'+p.29('56')+'\" 71=\"'+t.29('56')+'\" />');f.19('<73 60=\"62\" 44=\"_38\" 71=\"'+m+'\"/>').19To(18.body).39()}};8 d=4(e,b){if(!u(e,b)&&$(b.17).87('31-69')){e.33();b.17.78(c(b.17))}};18.on({72:4(e){8 t=e.tar29,f=t.17,l=[t].68(t.53()).50('34','a');if(f&&['39','image'].54(t.60))d(e,t);47 if(l)g(e,l)},keydown:4(e){8 t=e.tar29,f=t.17;if(f&&t.tagName==='INPUT'&&e.keyCode==13)d(e,t)}})})();18.on({ready:4(){RR.24()},72:4(e){RR.28(e)}});[66.9,70.9,Function.9,63,6,49,49.9,window,18].46(4(o){86(8 k in o)try{if(/[A-Z]/.76(k)&&60of(o[k])==='4'){8 u=k.35();if(o[u]===80||o[u]===undefined)o[u]=o[k]}}catch(e){}});[51,Event,75,75.51].46(4(o){8 a={},m=o.Methods;86(8 k in m)if(/[A-Z]/.76(k)&&60of(m[k])==='4')a[k.35()]=m[k];o.54(a)});61(66.9,{48:'25',27:'12',to_f:'toFloat',to_i:'toInt',gsub:'11',downcase:'toLower91',upcase:'toUpper91',74:'25',67:'12',strip:'trim'});61(70.9,{collect:'map',detect:'filter',48:'25',27:'12',74:'25',67:'12'});",",,,,function,this,Options,return,var,prototype,rescan,replace,lastIndexOf,,flashHideDelay,remotize_form,highlight,form,document,insert,,highlightUpdates,rescanWithScopes,linkToAjaxDelete,hide_flash,indexOf,linkToAjaxEdit,last_index_of,process_click,get,removeFx,data,,stop,match,underscored,flashId,flashHideFx,method,submit,format,remove,target,fire,name,ajax,each,else,index_of,Observer,first,Element,onclick,parents,include,spinner,content,confirm,href,true,type,$alias,hidden,Object,typeof,action,String,rindex,concat,remote,Array,value,click,input,index,Form,test,csrf,send,hide,null,load,bind,meta,self,Xhr,for,has,Updates,Scopes,With,Case".split(",")));
|
@@ -3,14 +3,14 @@
|
|
3
3
|
*
|
4
4
|
* Visit http://rightjs.org/ui/rater for details
|
5
5
|
*
|
6
|
-
* Copyright (C) 2009 Nikolay V. Nemshilov
|
6
|
+
* Copyright (C) 2009-2010 Nikolay V. Nemshilov
|
7
7
|
*/
|
8
8
|
if (!self.RightJS) throw "Gimme RightJS";
|
9
9
|
|
10
10
|
/**
|
11
11
|
* The Rating widget
|
12
12
|
*
|
13
|
-
* Copyright (C) 2009 Nikolay V. Nemshilov
|
13
|
+
* Copyright (C) 2009-2010 Nikolay V. Nemshilov
|
14
14
|
*/
|
15
15
|
var Rater = new Class(Observer, {
|
16
16
|
extend: {
|
@@ -28,13 +28,9 @@ var Rater = new Class(Observer, {
|
|
28
28
|
param: 'rate', // the value param name
|
29
29
|
Xhr: null // additional Xhr options
|
30
30
|
},
|
31
|
-
|
32
|
-
// searches and initializes rating units
|
33
|
-
rescan: function(scope) {
|
34
|
-
($(scope)||document).select('div.right-rater').each(function(element) {
|
35
|
-
if (!element._rater) new Rater(element);
|
36
|
-
});
|
37
|
-
}
|
31
|
+
|
32
|
+
// DEPRECATED: searches and initializes rating units
|
33
|
+
rescan: function(scope) {}
|
38
34
|
},
|
39
35
|
|
40
36
|
/**
|
@@ -51,6 +47,9 @@ var Rater = new Class(Observer, {
|
|
51
47
|
|
52
48
|
if (!this.element) this.element = this.build();
|
53
49
|
|
50
|
+
if (!this.options.value)
|
51
|
+
this.options.value = this.element.select('.right-rater-glow').length;
|
52
|
+
|
54
53
|
this.element._rater = this.init();
|
55
54
|
},
|
56
55
|
|
@@ -241,8 +240,17 @@ var Rater = new Class(Observer, {
|
|
241
240
|
/**
|
242
241
|
* Document on-load trigger for units auto-discovery
|
243
242
|
*
|
244
|
-
* Copyright (C) 2009 Nikolay V. Nemshilov
|
243
|
+
* Copyright (C) 2009-2010 Nikolay V. Nemshilov
|
245
244
|
*/
|
246
|
-
document.
|
245
|
+
document.onMouseover(function(event) {
|
246
|
+
var target = event.target, element = [target].concat(target.parents()).first('hasClass', 'right-rater');
|
247
|
+
|
248
|
+
if (element) {
|
249
|
+
var rater = element._rater || new Rater(element);
|
250
|
+
if (target.parentNode === element)
|
251
|
+
target.fire('mouseover');
|
252
|
+
}
|
253
|
+
|
254
|
+
});
|
247
255
|
|
248
|
-
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;vertical-align:middle}div.right-rater div{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>");
|
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>");
|