right-rails 0.6.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. data/CHANGELOG +8 -0
  2. data/README.rdoc +71 -0
  3. data/Rakefile +144 -14
  4. data/generators/right_rails/right_rails_generator.rb +18 -21
  5. data/init.rb +11 -32
  6. data/lib/generators/right_rails/right_rails_generator.rb +27 -0
  7. data/lib/generators/right_rails/templates/iframed.html.erb +10 -0
  8. data/lib/right-rails.rb +1 -1
  9. data/lib/right_rails/config.rb +278 -0
  10. data/lib/right_rails/controller_extensions.rb +10 -5
  11. data/lib/right_rails/helpers/basic.rb +10 -66
  12. data/lib/right_rails/helpers/forms.rb +141 -139
  13. data/lib/right_rails/helpers/misc.rb +45 -67
  14. data/lib/right_rails/helpers/rails.rb +40 -105
  15. data/lib/right_rails/helpers.rb +364 -1
  16. data/lib/right_rails/java_script_generator.rb +34 -24
  17. data/lib/right_rails.rb +6 -1
  18. data/{images → public/images}/colorpicker.png +0 -0
  19. data/{images → public/images}/resizable.png +0 -0
  20. data/public/javascripts/right/autocompleter-src.js +612 -0
  21. data/public/javascripts/right/autocompleter.js +18 -0
  22. data/public/javascripts/right/calendar-src.js +1448 -0
  23. data/public/javascripts/right/calendar.js +36 -0
  24. data/public/javascripts/right/colorpicker-src.js +967 -0
  25. data/public/javascripts/right/colorpicker.js +26 -0
  26. data/{javascripts/right-dnd-src.js → public/javascripts/right/dnd-src.js} +86 -52
  27. data/public/javascripts/right/dnd.js +20 -0
  28. data/{javascripts/right-effects-src.js → public/javascripts/right/effects-src.js} +90 -45
  29. data/public/javascripts/right/effects.js +17 -0
  30. data/{javascripts/right-ui-i18n-de.js → public/javascripts/right/i18n/de.js} +7 -7
  31. data/{javascripts/right-ui-i18n-en-us.js → public/javascripts/right/i18n/en-us.js} +1 -1
  32. data/{javascripts/right-ui-i18n-es.js → public/javascripts/right/i18n/es.js} +7 -7
  33. data/{javascripts/right-ui-i18n-fr.js → public/javascripts/right/i18n/fr.js} +7 -7
  34. data/{javascripts/right-ui-i18n-hu.js → public/javascripts/right/i18n/hu.js} +7 -7
  35. data/{javascripts/right-ui-i18n-jp.js → public/javascripts/right/i18n/jp.js} +7 -7
  36. data/{javascripts/right-ui-i18n-nl.js → public/javascripts/right/i18n/nl.js} +7 -7
  37. data/{javascripts/right-ui-i18n-pt-br.js → public/javascripts/right/i18n/pt-br.js} +7 -7
  38. data/{javascripts/right-ui-i18n-ru.js → public/javascripts/right/i18n/ru.js} +7 -7
  39. data/{javascripts/right-ui-i18n-ua.js → public/javascripts/right/i18n/ua.js} +17 -12
  40. data/public/javascripts/right/in-edit-src.js +352 -0
  41. data/public/javascripts/right/in-edit.js +13 -0
  42. data/public/javascripts/right/json-src.js +160 -0
  43. data/public/javascripts/right/json.js +10 -0
  44. data/public/javascripts/right/lightbox-src.js +881 -0
  45. data/public/javascripts/right/lightbox.js +24 -0
  46. data/{javascripts/right-rails-src.js → public/javascripts/right/rails-src.js} +195 -171
  47. data/public/javascripts/right/rails.js +14 -0
  48. data/public/javascripts/right/rater-src.js +366 -0
  49. data/public/javascripts/right/rater.js +13 -0
  50. data/public/javascripts/right/resizable-src.js +420 -0
  51. data/public/javascripts/right/resizable.js +15 -0
  52. data/public/javascripts/right/selectable-src.js +687 -0
  53. data/public/javascripts/right/selectable.js +22 -0
  54. data/public/javascripts/right/slider-src.js +377 -0
  55. data/public/javascripts/right/slider.js +14 -0
  56. data/public/javascripts/right/sortable-src.js +392 -0
  57. data/public/javascripts/right/sortable.js +16 -0
  58. data/public/javascripts/right/tabs-src.js +1123 -0
  59. data/public/javascripts/right/tabs.js +29 -0
  60. data/public/javascripts/right/tooltip-src.js +307 -0
  61. data/public/javascripts/right/tooltip.js +12 -0
  62. data/public/javascripts/right/uploader-src.js +283 -0
  63. data/public/javascripts/right/uploader.js +13 -0
  64. data/{javascripts → public/javascripts}/right-olds-src.js +134 -186
  65. data/public/javascripts/right-olds.js +18 -0
  66. data/public/javascripts/right-safe-src.js +161 -0
  67. data/public/javascripts/right-safe.js +8 -0
  68. data/{javascripts → public/javascripts}/right-src.js +2558 -1750
  69. data/public/javascripts/right.js +92 -0
  70. data/spec/lib/right_rails/config_spec.rb +133 -0
  71. data/spec/lib/right_rails/controller_extensions_spec.rb +1 -1
  72. data/spec/lib/right_rails/helpers/basic_spec.rb +77 -66
  73. data/spec/lib/right_rails/helpers/forms_spec.rb +231 -33
  74. data/spec/lib/right_rails/helpers/misc_spec.rb +94 -26
  75. data/spec/lib/right_rails/helpers/rails_spec.rb +42 -7
  76. data/spec/lib/right_rails/helpers_spec.rb +125 -0
  77. data/spec/lib/right_rails/java_script_generator_spec.rb +30 -0
  78. data/spec/rcov.opts +3 -0
  79. data/spec/spec_helper.rb +12 -7
  80. metadata +70 -61
  81. data/README.textile +0 -69
  82. data/javascripts/right-autocompleter-src.js +0 -318
  83. data/javascripts/right-autocompleter.js +0 -9
  84. data/javascripts/right-behavior-src.js +0 -261
  85. data/javascripts/right-behavior.js +0 -8
  86. data/javascripts/right-calendar-src.js +0 -946
  87. data/javascripts/right-calendar.js +0 -9
  88. data/javascripts/right-colorpicker-src.js +0 -635
  89. data/javascripts/right-colorpicker.js +0 -9
  90. data/javascripts/right-dnd.js +0 -9
  91. data/javascripts/right-effects.js +0 -6
  92. data/javascripts/right-events-src.js +0 -321
  93. data/javascripts/right-events.js +0 -6
  94. data/javascripts/right-in-edit-src.js +0 -194
  95. data/javascripts/right-in-edit.js +0 -6
  96. data/javascripts/right-json-src.js +0 -141
  97. data/javascripts/right-json.js +0 -6
  98. data/javascripts/right-lightbox-src.js +0 -651
  99. data/javascripts/right-lightbox.js +0 -9
  100. data/javascripts/right-olds.js +0 -9
  101. data/javascripts/right-rails.js +0 -9
  102. data/javascripts/right-rater-src.js +0 -253
  103. data/javascripts/right-rater.js +0 -9
  104. data/javascripts/right-resizable-src.js +0 -336
  105. data/javascripts/right-resizable.js +0 -9
  106. data/javascripts/right-selectable-src.js +0 -565
  107. data/javascripts/right-selectable.js +0 -7
  108. data/javascripts/right-slider-src.js +0 -288
  109. data/javascripts/right-slider.js +0 -7
  110. data/javascripts/right-sortable-src.js +0 -225
  111. data/javascripts/right-sortable.js +0 -9
  112. data/javascripts/right-tabs-src.js +0 -937
  113. data/javascripts/right-tabs.js +0 -6
  114. data/javascripts/right-tooltips-src.js +0 -195
  115. data/javascripts/right-tooltips.js +0 -9
  116. data/javascripts/right-uploader-src.js +0 -167
  117. data/javascripts/right-uploader.js +0 -9
  118. data/javascripts/right.js +0 -7
@@ -1,318 +0,0 @@
1
- /**
2
- * The autocompletion feature implemented with RightJS
3
- *
4
- * Home page: http://rightjs.org/ui/autocompleter
5
- *
6
- * @copyright (C) 2009-2010 Nikolay V. Nemshilov
7
- */
8
- if (!RightJS) { throw "Gimme RightJS. Please." };
9
- /**
10
- * The RightJS UI Autocompleter unit base class
11
- *
12
- * Copyright (C) 2009-2010 Nikolay V. Nemshilov
13
- */
14
- var Autocompleter = new Class(Observer, {
15
- extend: {
16
- EVENTS: $w('show hide update load select done'),
17
-
18
- Options: {
19
- url: document.location.href,
20
- param: 'search',
21
- method: 'get',
22
-
23
- minLength: 1, // the minimal length when it starts work
24
- threshold: 200, // the typing pause threshold
25
-
26
- cache: true, // the use the results cache
27
- local: null, // an optional local search results list
28
-
29
- fxName: 'slide', // list appearance fx name
30
- fxDuration: 'short', // list appearance fx duration
31
-
32
- spinner: 'native', // spinner element reference
33
-
34
- cssRule: '[rel^=autocompleter]'
35
- },
36
-
37
- current: null, // reference to the currently active options list
38
- instances: {}, // the input <-> instance map
39
-
40
- // finds/instances an autocompleter for the event
41
- find: function(event) {
42
- var input = event.target;
43
- if (input.match(Autocompleter.Options.cssRule)) {
44
- var uid = $uid(input);
45
- if (!Autocompleter.instances[uid])
46
- new Autocompleter(input);
47
- }
48
- },
49
-
50
- // DEPRECATED scans the document for autocompletion fields
51
- rescan: function(scope) { }
52
- },
53
-
54
- /**
55
- * basic constructor
56
- *
57
- * @param mixed the input element reference, a string id or the element instance
58
- * @param Object options
59
- */
60
- initialize: function(input, options) {
61
- this.input = $(input); // don't low it down!
62
- this.$super(options);
63
-
64
- // storing the callbacks so we could detach them later
65
- this._watch = this.watch.bind(this);
66
- this._hide = this.hide.bind(this);
67
-
68
- this.input.onKeyup(this._watch).onBlur(this._hide);
69
-
70
- this.holder = $E('div', {'class': 'right-autocompleter'}).insertTo(this.input, 'after');
71
- this.container = $E('div', {'class': 'autocompleter'}).insertTo(this.holder);
72
-
73
- this.input.autocompleter = Autocompleter.instances[$uid(input)] = this;
74
- },
75
-
76
- // kills the autocompleter
77
- destroy: function() {
78
- this.input.stopObserving('keyup', this._watch).stopObserving('blur', this._hide);
79
- delete(this.input.autocompleter);
80
- return this;
81
- },
82
-
83
- // catching up with some additonal options
84
- setOptions: function(options) {
85
- this.$super(this.grabOptions(options));
86
-
87
- // building the correct url template with a placeholder
88
- if (!this.options.url.includes('%{search}')) {
89
- this.options.url += (this.options.url.includes('?') ? '&' : '?') + this.options.param + '=%{search}';
90
- }
91
- },
92
-
93
- // handles the list appearance
94
- show: function() {
95
- if (this.container.hidden()) {
96
- var dims = this.input.dimensions(), pos = this.holder.position();
97
-
98
- this.container.setStyle({
99
- top: (dims.top + dims.height - pos.y) + 'px',
100
- left: (dims.left - pos.x) + 'px',
101
- width: dims.width + 'px'
102
- }).show(this.options.fxName, {
103
- duration: this.options.fxDuration,
104
- onFinish: this.fire.bind(this, 'show')
105
- });
106
- }
107
-
108
- return Autocompleter.current = this;
109
- },
110
-
111
- // handles the list hidding
112
- hide: function() {
113
- if (this.container.visible()) {
114
- this.container.hide();
115
- this.fire.bind(this, 'hide');
116
- }
117
-
118
- Autocompleter.current = null;
119
-
120
- return this;
121
- },
122
-
123
- // selects the next item on the list
124
- prev: function() {
125
- return this.select('prev', this.container.select('li').last());
126
- },
127
-
128
- // selects the next item on the list
129
- next: function() {
130
- return this.select('next', this.container.first('li'));
131
- },
132
-
133
- // marks it done
134
- done: function(current) {
135
- var current = current || this.container.first('li.current');
136
- if (current) {
137
- this.input.value = current.innerHTML.stripTags();
138
- }
139
-
140
- return this.fire('done').hide();
141
- },
142
-
143
- // protected
144
-
145
- // trying to extract the input element options
146
- grabOptions: function(options) {
147
- var input = this.input;
148
- var options = options || eval('('+input.get('data-autocompleter-options')+')') || {};
149
- var keys = Autocompleter.Options.cssRule.split('[').last().split(']')[0].split('^='),
150
- key = keys[1], value = input.get(keys[0]), match;
151
-
152
- // trying to extract options
153
- if (value && (match = value.match(new RegExp('^'+ key +'+\\[(.*?)\\]$')))) {
154
- match = match[1];
155
-
156
- // deciding whether it's a list of local options or an url
157
- if (match.match(/^['"].*?['"]$/)) {
158
- options.local = eval('['+ match +']');
159
- } else if (!match.blank()) {
160
- options.url = match;
161
- }
162
- }
163
-
164
- return options;
165
- },
166
-
167
- // works with the 'prev' and 'next' methods
168
- select: function(what, fallback) {
169
- var current = this.container.first('li.current');
170
- if (current) {
171
- current = current[what]('li') || current;
172
- }
173
-
174
- return this.fire('select', (current || fallback).radioClass('current'));
175
- },
176
-
177
- // receives the keyboard events out of the input element
178
- watch: function(event) {
179
- // skip the overlaping key codes that are already watched in the document.js
180
- if ([27,37,38,39,40,13].include(event.keyCode)) return;
181
-
182
- if (this.input.value.length >= this.options.minLength) {
183
- if (this.timeout) {
184
- this.timeout.cancel();
185
- }
186
- this.timeout = this.trigger.bind(this).delay(this.options.threshold);
187
- } else {
188
- return this.hide();
189
- }
190
- },
191
-
192
- // triggers the actual action
193
- trigger: function() {
194
- this.timeout = null;
195
-
196
- this.cache = this.cache || {};
197
- var search = this.input.value;
198
-
199
- if (search.length < this.options.minLength) return this.hide();
200
-
201
- if (this.cache[search]) {
202
- this.suggest(this.cache[search], search);
203
- } else if (this.options.local) {
204
- this.suggest(this.findLocal(search), search);
205
- } else {
206
- this.request = Xhr.load(this.options.url.replace('%{search}', encodeURIComponent(search)), {
207
- method: this.options.method,
208
- spinner: this.getSpinner(),
209
- onComplete: function(response) {
210
- this.fire('load').suggest(response.responseText, search);
211
- }.bind(this)
212
- });
213
- }
214
- },
215
-
216
- // updates the suggestions list
217
- suggest: function(result, search) {
218
- this.container.update(result).select('li').each(function(li) {
219
- // we reassiging the events each time so the were no doublecalls
220
- li.onmouseover = function() { li.radioClass('current'); };
221
- li.onmousedown = function() { this.done(li); }.bind(this);
222
- }, this);
223
-
224
- // saving the result in cache
225
- if (this.options.cache) {
226
- this.cache[search] = result;
227
- }
228
-
229
- return this.fire('update').show();
230
- },
231
-
232
- // performs the locals search
233
- findLocal: function(search) {
234
- var regexp = new RegExp("("+RegExp.escape(search)+")", 'ig');
235
- return $E('ul').insert(
236
- this.options.local.map(function(option) {
237
- if (regexp.test(option)) {
238
- return $E('li', {html:
239
- option.replace(regexp, '<strong>$1</strong>')
240
- });
241
- }
242
- }).compact()
243
- );
244
- },
245
-
246
- // builds a native textual spinner if necessary
247
- getSpinner: function() {
248
- this._spinner = this._spinner || this.options.spinner;
249
-
250
- // building the native spinner
251
- if (this._spinner == 'native') {
252
- this._spinner = $E('div', {
253
- 'class': 'autocompleter-spinner'
254
- }).insertTo(this.holder);
255
-
256
- var dots = '123'.split('').map(function(i) {
257
- return $E('div', {'class': 'dot-'+i, html: '&raquo;'});
258
- });
259
-
260
- (function() {
261
- var dot = dots.shift();
262
- dots.push(dot);
263
- this._spinner.update(dot);
264
- }.bind(this)).periodical(400);
265
- }
266
-
267
- // repositioning the native spinner
268
- if (this.options.spinner == 'native') {
269
- var dims = this.input.dimensions(), pos = this.holder.position();
270
-
271
- this._spinner.setStyle('visiblity: hidden').show();
272
-
273
- this._spinner.setStyle({
274
- visibility: 'visible',
275
- top: (dims.top + 1 - pos.y) + 'px',
276
- height: (dims.height - 2) + 'px',
277
- lineHeight: (dims.height - 2) + 'px',
278
- left: (dims.left + dims.width - this._spinner.offsetWidth - 1 - pos.x) + 'px'
279
- }).hide();
280
- }
281
-
282
- return this._spinner;
283
- }
284
- });
285
-
286
- /**
287
- * The document events hooking
288
- *
289
- * Copyright (C) 2009-2010 Nikolay V. Nemshilov
290
- */
291
- document.on({
292
- // the autocompletion list navigation
293
- keydown: function(event) {
294
- // if there is an active options list, hijacking the navigation buttons
295
- if (Autocompleter.current) {
296
- var name;
297
-
298
- switch (event.keyCode) {
299
- case 27: name = 'hide'; break;
300
- case 37: name = 'prev'; break;
301
- case 39: name = 'next'; break;
302
- case 38: name = 'prev'; break;
303
- case 40: name = 'next'; break;
304
- case 13: name = 'done'; break;
305
- }
306
-
307
- if (name) {
308
- Autocompleter.current[name]();
309
- event.stop();
310
- }
311
- }
312
-
313
- // otherwise trying to find/instanciate an autocompliter
314
- else {
315
- Autocompleter.find(event);
316
- }
317
- }
318
- });document.write("<style type=\"text/css\">div.right-autocompleter,div.autocompleter,div.autocompleter ul,div.autocompleter ul li,div.autocompleter-spinner,div.autocompleter-spinner div{border:none;background:none;margin:0;padding:0;list-style:none;font-weight:normal}div.right-autocompleter{position:absolute;display:inline}div.autocompleter{display:none;position:absolute;z-index:9999999;background:white;-moz-box-shadow:#BBB .2em .2em .4em;-webkit-box-shadow:#BBB .2em .2em .4em;overflow:hidden}div.autocompleter ul{*border-bottom:1px solid #CCC}div.autocompleter ul li{padding:.2em .4em;border:1px solid #CCC;border-top:none;border-bottom:none;cursor:pointer}div.autocompleter ul li:first-child{border-top:1px solid #CCC}div.autocompleter ul li:last-child{border-bottom:1px solid #CCC;*border-bottom:none}div.autocompleter ul li.current{background:#DDD}div.autocompleter-spinner{position:absolute;z-index:100000000;text-align:center;font-size:140%;font-family:Georgia;background:#DDD;color:#666;display:none;width:1em}div.autocompleter-spinner div.dot-1{margin-left:-4px}div.autocompleter-spinner div.dot-2{}div.autocompleter-spinner div.dot-3{margin-left:4px}</style>");
@@ -1,9 +0,0 @@
1
- /**
2
- * The autocompletion feature implemented with RightJS
3
- *
4
- * Home page: http://rightjs.org/ui/autocompleter
5
- *
6
- * @copyright (C) 2009-2010 Nikolay V. Nemshilov
7
- */
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})("28 16=105 Class(Observer,{extend:{EVENTS:$w('50 30 54 108 31 61'),67:{70:57.location.href,118:'51',81:'120',45:1,89:200,34:true,63:88,112:'slide',78:'short',22:'83',64:'[rel^=11]'},25:88,49:{},122:15(e){28 i=e.tar120;if(i.96(16.67.64)){28 u=127(i);if(!16.49[u])105 16(i)}},rescan:15(s){}},initialize:15(i,o){5.26=$(i);5.113(o);5.84=5.121.35(5);5._30=5.30.35(5);5.26.onKeyup(5.84).onBlur(5._30);5.42=$E('21',{'62':'95-11'}).56(5.26,'after');5.19=$E('21',{'62':'11'}).56(5.42);5.26.11=16.49[127(i)]=5},destroy:15(){5.26.52('keyup',5.84).52('blur',5._30);delete(5.26.11);18 5},set67:15(o){5.113(5.grab67(o));if(!5.17.70.91('%{51}'))5.17.70+=(5.17.70.91('?')?'&':'?')+5.17.118+'=%{51}'},50:15(){if(5.19.79()){28 d=5.26.75(),p=5.42.32();5.19.59({65:(d.65+d.53-p.y)+'px',46:(d.46-p.x)+'px',69:d.69+'px'}).50(5.17.112,{duration:5.17.78,onFinish:5.47.35(5,'50')})}18 16.25=5},30:15(){if(5.19.107()){5.19.30();5.47.35(5,'30')}16.25=88;18 5},86:15(){18 5.31('86',5.19.31('li').109())},90:15(){18 5.31('90',5.19.72('li'))},61:15(c){28 c=c||5.19.72('li.25');if(c)5.26.93=c.innerHTML.stripTags();18 5.47('61').30()},grab67:15(o){28 i=5.26;28 o=o||126('('+i.120('data-11-17')+')')||{};28 a=16.67.64.68('[').109().68(']')[0].68('^='),k=a[1],v=i.120(a[0]),m;if(v&&(m=v.96(105 82('^'+k+'+\\\\[(.*?)\\\\]$')))){m=m[1];if(m.96(/^['\"].*?['\"]$/))o.63=126('['+m+']');60 if(!m.blank())o.70=m}18 o},31:15(w,f){28 c=5.19.72('li.25');if(c)c=c[w]('li')||c;18 5.47('31',(c||f).77('25'))},121:15(e){if([27,37,38,39,40,13].include(e.101))18;if(5.26.93.114>=5.17.45){if(5.43)5.43.cancel();5.43=5.106.35(5).delay(5.17.89)}60 18 5.30()},106:15(){5.43=88;5.34=5.34||{};28 s=5.26.93;if(s.114<5.17.45)18 5.30();if(5.34[s])5.44(5.34[s],s);60 if(5.17.63)5.44(5.85(s),s);60 5.request=Xhr.108(5.17.70.102('%{51}',encodeURIComponent(s)),{81:5.17.81,22:5.76(),onComplete:15(r){5.47('108').44(r.responseText,s)}.35(5)})},44:15(r,s){5.19.54(r).31('li').each(15(l){l.onmouseover=15(){l.77('25')};l.onmousedown=15(){5.61(l)}.35(5)},5);if(5.17.34)5.34[s]=r;18 5.47('54').50()},85:15(s){28 r=105 82(\"(\"+82.escape(s)+\")\",'ig');18 $E('ul').insert(5.17.63.132(15(o){if(r.test(o))18 $E('li',{124:o.102(r,'<111>$1</111>')})}).compact())},76:15(){5._22=5._22||5.17.22;if(5._22=='83'){5._22=$E('21',{'62':'11-22'}).56(5.42);28 c='123'.68('').132(15(a){18 $E('21',{'62':'104-'+a,124:'&raquo;'})});(15(){28 d=c.shift();c.push(d);5._22.54(d)}.35(5)).periodical(400)}if(5.17.22=='83'){28 b=5.26.75(),p=5.42.32();5._22.59('visiblity: 79').50();5._22.59({visibility:'107',65:(b.65+1-p.y)+'px',53:(b.53-2)+'px',lineHeight:(b.53-2)+'px',46:(b.46+b.69-5._22.offsetWidth-1-p.x)+'px'}).30()}18 5._22}});57.on({keydown:15(e){if(16.25){28 n;switch(e.101){48 27:n='30';41;48 37:n='86';41;48 39:n='90';41;48 38:n='86';41;48 40:n='90';41;48 13:n='61';41}if(n){16.25[n]();e.s65()}}60 16.122(e)}});57.write(\"<94 type=\\\"125/css\\\">21.95-11,21.11,21.11 ul,21.11 ul li,21.11-22,21.11-22 21{29:36;33:36;80:0;98:0;list-94:36;110-weight:normal}21.95-11{32:58;73:inline}21.11{73:36;32:58;z-119:9999999;33:white;-moz-130-115:#128 .87 .87 .117;-webkit-130-115:#128 .87 .87 .117;overflow:79}21.11 ul{*29-55:103 71 #97}21.11 ul li{98:.87 .117;29:103 71 #97;29-65:36;29-55:36;cursor:pointer}21.11 ul li:72-116{29-65:103 71 #97}21.11 ul li:109-116{29-55:103 71 #97;*29-55:36}21.11 ul li.25{33:#129}21.11-22{32:58;z-119:100000000;125-align:center;110-size:140%;110-family:Georgia;33:#129;color:#666;73:36;69:1em}21.11-22 21.104-1{80-46:-131}21.11-22 21.104-2{}21.11-22 21.104-3{80-46:131}</94>\");",",,,,,this,,,,,,autocompleter,,,,function,Autocompleter,options,return,container,,div,spinner,,_spinner,current,input,,var,border,hide,select,position,background,cache,bind,none,,,,,break,holder,timeout,suggest,minLength,left,fire,case,instances,show,search,stopObserving,height,update,bottom,insertTo,document,absolute,setStyle,else,done,class,local,cssRule,top,,Options,split,width,url,solid,first,display,grabOptions,dimensions,getSpinner,radioClass,fxDuration,hidden,margin,method,RegExp,native,_watch,findLocal,prev,2em,null,threshold,next,includes,_hide,value,style,right,match,CCC,padding,,,keyCode,replace,1px,dot,new,trigger,visible,load,last,font,strong,fxName,$super,length,shadow,child,4em,param,index,get,watch,find,,html,text,eval,$uid,BBB,DDD,box,4px,map".split(",")));
@@ -1,261 +0,0 @@
1
- /**
2
- * The behavior definitions library for RightJS
3
- *
4
- * See http://rightjs.org/goods/behave for more details
5
- *
6
- * Copyright (C) 2009-2010 Nikolay V. Nemshilov
7
- */
8
-
9
- /**
10
- * The behavior definition unit
11
- *
12
- * Once created will have two methods #start and #stop
13
- * Once started will be added to all the matching elemnts
14
- * on the page, and will watch any updates on the page
15
- * and refresh the behaves automatically
16
- *
17
- * Copyright (C) 2009-2010 Nikolay V. Nemshilov
18
- */
19
- var Behavior = new Class({
20
- extend: {
21
- /**
22
- * Class level behavior creator
23
- *
24
- * @param String css-selector
25
- * @param String event name or a hash of events
26
- * @param Function callback or a method name or a list of callbacks/names
27
- * @param mixed optional argument
28
- * ....
29
- * @return Behavior instance
30
- */
31
- add: function() {
32
- var args = $A(arguments);
33
- var behavior = new Behavior(args.shift());
34
-
35
- return behavior.on.apply(behavior, args).start();
36
- },
37
-
38
- /**
39
- * makes a certain behavior stop
40
- *
41
- * @param String css-selector
42
- * @return Behavior stopped behavior or null if there weren't any
43
- */
44
- stop: function(rule) {
45
- var behavior = Behavior.active[rule];
46
- if (behavior) behavior.stop();
47
-
48
- return behavior;
49
- },
50
-
51
- /**
52
- * Events handling delegation method
53
- *
54
- * USAGE:
55
- * ".something".behave('click', Behavior.delegate({
56
- * ".foo": function() { return 'foo'; },
57
- * ".bar": function() { return 'bar'; }
58
- * }));
59
- *
60
- * @param Object delegations description
61
- * @return Object delegated event handlers
62
- */
63
- delegate: function(rules) {
64
- return function(event) {
65
- var element = $(event.target);
66
- for (var selector in rules)
67
- if (element.match(selector))
68
- return rules[selector].apply(this, arguments);
69
- }
70
- },
71
-
72
- /**
73
- * applies all the active behaviors to the page
74
- *
75
- * @return void
76
- */
77
- refresh: function() {
78
- for (var key in Behavior.active) {
79
- Behavior.active[key].refresh();
80
- }
81
- },
82
-
83
- // a hash of active behaviors
84
- active: {}
85
- },
86
-
87
-
88
- rule: null, // the css rule
89
- args: null, // the received arguments
90
- regs: null, // the list of UID of elements that are already processed
91
-
92
- /**
93
- * The basic constructor
94
- *
95
- * @param String css-rule
96
- * @param String event name or a hash of event definitions
97
- * @return void
98
- */
99
- initialize: function() {
100
- var args = $A(arguments);
101
- this.rule = args.shift();
102
- this.on.apply(this, args);
103
-
104
- this.regs = [];
105
- },
106
-
107
- /**
108
- * makes the behavior active
109
- *
110
- * @return Behavior self
111
- */
112
- start: function() {
113
- return Behavior.active[this.rule] = this.refresh();
114
- },
115
-
116
- /**
117
- * Deactivates the behavior
118
- *
119
- * @return Behavior self
120
- */
121
- stop: function() {
122
- var args = this.args;
123
-
124
- // converting a non-hash args into a hash
125
- if (!isHash(args[0])) {
126
- var hash = {};
127
- hash[args.shift()] = args;
128
- args = hash;
129
- } else {
130
- args = args[0];
131
- }
132
-
133
- // unregistering the listeners
134
- $$(this.rule).each(function(element) {
135
- var uid = $uid(element);
136
- if (this.regs[uid]) {
137
- for (var key in args) {
138
-
139
- // if the definition had some nauty arrays and call-by name definitions
140
- if (isArray(args[key])) {
141
- args[key].each(function(option) {
142
- if (isArray(option)) {
143
- element.stopObserving.apply(element, [key].concat(options[0]));
144
- }
145
- });
146
- if (!isArray(args[key][0])) {
147
- element.stopObserving.apply(element, [key].concat(args[key][0]));
148
- }
149
- } else {
150
- element.stopObserving.apply(element, [key].concat(args[key]));
151
- }
152
- }
153
- }
154
- }, this);
155
-
156
- this.regs = [];
157
-
158
- delete(Behavior.active[this.rule]);
159
-
160
- return this;
161
- },
162
-
163
- /**
164
- * Checks if the given behavior is active
165
- *
166
- * @return boolean check result
167
- */
168
- active: function() {
169
- return Behavior.active[this.rule] === this;
170
- },
171
-
172
- // private
173
-
174
- /**
175
- * Defines the behavior options
176
- *
177
- * Takes all the same type of options as the {Observer#on} method
178
- *
179
- * @param String event name or anevents definition hash
180
- * @param Function callback or method name to call
181
- * @return Behavior self
182
- */
183
- on: function() {
184
- this.args = $A(arguments);
185
- return this;
186
- },
187
-
188
- /**
189
- * refreshes the behavior applying on the page elements
190
- *
191
- * @return Behavior self
192
- */
193
- refresh: function() {
194
- $$(this.rule).each(function(element) {
195
- var uid = $uid(element);
196
- if (!this.regs[uid]) {
197
- element.on.apply(element, this.args);
198
- this.regs[uid] = 1;
199
- }
200
- }, this);
201
-
202
- return this;
203
- }
204
- });
205
-
206
- document.onReady(Behavior.refresh);
207
- /**
208
- * The Element unit wrapups for automaticall behaves processing on the page updates
209
- *
210
- * Copyright (C) 2009-2010 Nikolay V. Nemshilov
211
- */
212
- Element.include((function(old_methods) {
213
- var old_insert = old_methods.insert;
214
- var old_update = old_methods.update;
215
-
216
- return {
217
- insert: function() {
218
- old_insert.apply(this, arguments);
219
- Behavior.refresh();
220
-
221
- return this;
222
- },
223
-
224
- update: function(content) {
225
- old_update.apply(this, arguments);
226
- if (isString(content)) Behavior.refresh();
227
-
228
- return this;
229
- }
230
- };
231
-
232
- })(Element.Methods));
233
- /**
234
- * The bahave library string level shortcuts, mean to create behaviors like that
235
- *
236
- * USAGE:
237
- * "div#sidebar ul li".behave('click', function() {...});
238
- *
239
- * "div#sidebar ul li".stopBehave('click', function() {...});
240
- *
241
- * Copyright (C) 2009-2010 Nikolay V Nemshilov
242
- */
243
- $ext(String.prototype, {
244
- /**
245
- * Starts behavior
246
- *
247
- * Takes all the same params as the {Behavior#on} method
248
- */
249
- behave: function() {
250
- return Behavior.add.apply(Behavior, [''+this].concat($A(arguments)));
251
- },
252
-
253
- /**
254
- * Stops a behavior
255
- *
256
- * Takes all the same params as the {Behavior#stop} method
257
- */
258
- stopBehave: function() {
259
- return Behavior.stop.apply(Behavior, [''+this].concat($A(arguments)));
260
- }
261
- });
@@ -1,8 +0,0 @@
1
- /**
2
- * The behavior definitions library for RightJS
3
- *
4
- * See http://rightjs.org/goods/behave for more details
5
- *
6
- * Copyright (C) 2009-2010 Nikolay V. Nemshilov
7
- */
8
- 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 4=28 Class({extend:{29:2(){8 a=$A(6);8 b=28 4(a.18());5 b.on.7(b,a).25()},16:2(r){8 b=4.10[r];if(b)b.16();5 b},delegate:2(r){5 2(a){8 e=$(a.target);24(8 s in r)if(e.match(s))5 r[s].7(3,6)}},9:2(){24(8 k in 4.10)4.10[k].9()},10:{}},12:21,17:21,14:21,initialize:2(){8 a=$A(6);3.12=a.18();3.on.7(3,a);3.14=[]},25:2(){5 4.10[3.12]=3.9()},16:2(){8 a=3.17;if(!isHash(a[0])){8 h={};h[a.18()]=a;a=h}27 a=a[0];$$(3.12).20(2(e){8 u=26(e);if(3.14[u])24(8 k in a){if(15(a[k])){a[k].20(2(o){if(15(o))e.11.7(e,[k].13(options[0]))});if(!15(a[k][0]))e.11.7(e,[k].13(a[k][0]))}27 e.11.7(e,[k].13(a[k]))}},3);3.14=[];delete(4.10[3.12]);5 3},10:2(){5 4.10[3.12]===3},on:2(){3.17=$A(6);5 3},9:2(){$$(3.12).20(2(e){8 u=26(e);if(!3.14[u]){e.on.7(e,3.17);3.14[u]=1}},3);5 3}});document.onReady(4.9);19.include((2(a){8 o=a.23;8 b=a.22;5{23:2(){o.7(3,6);4.9();5 3},22:2(c){b.7(3,6);if(is30(c))4.9();5 3}}})(19.Methods));$ext(30.prototype,{behave:2(){5 4.29.7(4,[''+3].13($A(6)))},16Behave:2(){5 4.16.7(4,[''+3].13($A(6)))}});",",,function,this,Behavior,return,arguments,apply,var,refresh,active,stopObserving,rule,concat,regs,isArray,stop,args,shift,Element,each,null,update,insert,for,start,$uid,else,new,add,String".split(",")));