right-rails 0.3.2 → 0.4.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/generators/right_rails/right_rails_generator.rb +1 -1
- data/javascripts/right-autocompleter-src.js +5 -3
- data/javascripts/right-autocompleter.js +1 -1
- data/javascripts/right-behavior-src.js +21 -0
- data/javascripts/right-behavior.js +1 -1
- data/javascripts/right-calendar-src.js +3 -3
- data/javascripts/right-calendar.js +1 -1
- data/javascripts/right-dnd-src.js +3 -2
- data/javascripts/right-dnd.js +1 -1
- data/javascripts/right-effects-src.js +30 -18
- data/javascripts/right-effects.js +1 -1
- data/javascripts/right-lightbox-src.js +10 -8
- data/javascripts/right-lightbox.js +1 -1
- data/javascripts/right-olds-src.js +547 -0
- data/javascripts/right-olds.js +9 -0
- data/javascripts/right-rails-min.js +9 -0
- data/javascripts/right-rails-src.js +14 -12
- data/javascripts/right-rails.js +1 -1
- data/javascripts/right-rater-src.js +2 -2
- data/javascripts/right-rater.js +1 -1
- data/javascripts/right-selectable-src.js +3 -3
- data/javascripts/right-selectable.js +1 -1
- data/javascripts/right-slider-src.js +4 -4
- data/javascripts/right-slider.js +1 -1
- data/javascripts/right-sortable-src.js +21 -16
- data/javascripts/right-sortable.js +1 -1
- data/javascripts/right-src.js +755 -1240
- data/javascripts/right-tabs-src.js +2 -2
- data/javascripts/right-tabs.js +1 -1
- data/javascripts/right-tooltips-src.js +3 -3
- data/javascripts/right-tooltips.js +1 -1
- data/javascripts/right-ui-i18n-ru.js +2 -2
- data/javascripts/right.js +3 -2
- metadata +7 -3
@@ -0,0 +1,547 @@
|
|
1
|
+
/**
|
2
|
+
* This is old browsers support patch for RightJS
|
3
|
+
*
|
4
|
+
* The library released under terms of the MIT license
|
5
|
+
* Visit http://rightjs.org for more details
|
6
|
+
*
|
7
|
+
* Copyright (C) 2008-2009 Nikolay V. Nemshilov aka St.
|
8
|
+
*/
|
9
|
+
/**
|
10
|
+
* Old IE browser hacks
|
11
|
+
*
|
12
|
+
* Keep them in one place so they were more compact
|
13
|
+
*
|
14
|
+
* Copyright (C) 2009 Nikolay V. Nemshilov aka St.
|
15
|
+
*/
|
16
|
+
if (Browser.OLD) {
|
17
|
+
// loads DOM element extensions for selected elements
|
18
|
+
$ = (function(old_function) {
|
19
|
+
return function(id) {
|
20
|
+
var element = old_function(id);
|
21
|
+
return element ? Element.prepare(element) : element;
|
22
|
+
}
|
23
|
+
})($);
|
24
|
+
|
25
|
+
|
26
|
+
$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
|
+
/**
|
39
|
+
* Overloading the native method to extend the new elements as it is
|
40
|
+
* in all the other browsers
|
41
|
+
*
|
42
|
+
* @param String tag name
|
43
|
+
* @return Element
|
44
|
+
*/
|
45
|
+
createElement: (function(old_method) {
|
46
|
+
return function(tag) {
|
47
|
+
return Element.prepare(old_method(tag));
|
48
|
+
}
|
49
|
+
})(document.createElement)
|
50
|
+
});
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
$ext(Element, {
|
55
|
+
/**
|
56
|
+
* IE browsers manual elements extending
|
57
|
+
*
|
58
|
+
* @param Element
|
59
|
+
* @return Element
|
60
|
+
*/
|
61
|
+
prepare: function(element) {
|
62
|
+
if (element && element.tagName && !element.set) {
|
63
|
+
$ext(element, Element.Methods, true);
|
64
|
+
|
65
|
+
if (self['Form']) {
|
66
|
+
switch(element.tagName) {
|
67
|
+
case 'FORM':
|
68
|
+
Form.ext(element);
|
69
|
+
break;
|
70
|
+
|
71
|
+
case 'INPUT':
|
72
|
+
case 'SELECT':
|
73
|
+
case 'BUTTON':
|
74
|
+
case 'TEXTAREA':
|
75
|
+
Form.Element.ext(element);
|
76
|
+
break;
|
77
|
+
}
|
78
|
+
}
|
79
|
+
}
|
80
|
+
return element;
|
81
|
+
}
|
82
|
+
});
|
83
|
+
}
|
84
|
+
|
85
|
+
/**
|
86
|
+
* Konqueror browser fixes
|
87
|
+
*
|
88
|
+
* Copyright (C) 2009 Nikolay V. Nemshilov aka St.
|
89
|
+
*/
|
90
|
+
// Konqueror 3 patch for the isHash function
|
91
|
+
if (navigator.userAgent.indexOf('Konqueror/3') != -1) {
|
92
|
+
eval(isHash.toString().replace(';', '&&!(arguments[0] instanceof HTMLElement);'));
|
93
|
+
}
|
94
|
+
|
95
|
+
|
96
|
+
/**
|
97
|
+
* manual position calculator, it works for Konqueror and also
|
98
|
+
* old versions of Opera and FF, so we use a feature check in here
|
99
|
+
*/
|
100
|
+
if (!$E('p').getBoundingClientRect) {
|
101
|
+
Element.addMethods({
|
102
|
+
position: function() {
|
103
|
+
var left = this.offsetLeft, top = this.offsetTop, position = this.getStyle('position'),
|
104
|
+
parent = this.parentNode, body = this.ownerDocument.body;
|
105
|
+
|
106
|
+
// getting the parent node position
|
107
|
+
while (parent && parent.tagName) {
|
108
|
+
if (parent === body || parent.getStyle('position') != 'static') {
|
109
|
+
if (parent !== body || position != 'absolute') {
|
110
|
+
var subset = parent.position();
|
111
|
+
left += subset.x;
|
112
|
+
top += subset.y;
|
113
|
+
}
|
114
|
+
break;
|
115
|
+
}
|
116
|
+
parent = parent.parentNode;
|
117
|
+
}
|
118
|
+
|
119
|
+
return {x: left, y: top};
|
120
|
+
}
|
121
|
+
});
|
122
|
+
}
|
123
|
+
|
124
|
+
|
125
|
+
/**
|
126
|
+
* The manual css-selector feature implementation
|
127
|
+
*
|
128
|
+
* NOTE: this will define the standard css-selectors interface
|
129
|
+
* with the same names as native css-selectors implementation
|
130
|
+
* the actual public Element level methods for the feature
|
131
|
+
* is in the dom/selector.js file
|
132
|
+
*
|
133
|
+
* Credits:
|
134
|
+
* - Sizzle (http://sizzlejs.org) Copyright (C) John Resig
|
135
|
+
* - MooTools (http://mootools.net) Copyright (C) Valerio Proietti
|
136
|
+
*
|
137
|
+
* Copyright (C) 2009 Nikolay V. Nemshilov aka St.
|
138
|
+
*/
|
139
|
+
if (!document.querySelector) {
|
140
|
+
Element.addMethods((function() {
|
141
|
+
/**
|
142
|
+
* The token searchers collection
|
143
|
+
*/
|
144
|
+
var search = {
|
145
|
+
// search for any descendant nodes
|
146
|
+
' ': function(element, tag) {
|
147
|
+
return $A(element.getElementsByTagName(tag));
|
148
|
+
},
|
149
|
+
|
150
|
+
// search for immidate descendant nodes
|
151
|
+
'>': function(element, tag) {
|
152
|
+
var result = [], node = element.firstChild;
|
153
|
+
while (node) {
|
154
|
+
if (tag == '*' || node.tagName == tag)
|
155
|
+
result.push(node);
|
156
|
+
node = node.nextSibling;
|
157
|
+
}
|
158
|
+
return result;
|
159
|
+
},
|
160
|
+
|
161
|
+
// search for immiate sibling nodes
|
162
|
+
'+': function(element, tag) {
|
163
|
+
while (element = element.nextSibling) {
|
164
|
+
if (element.tagName)
|
165
|
+
return (tag == '*' || element.tagName == tag) ? [element] : [];
|
166
|
+
}
|
167
|
+
return [];
|
168
|
+
},
|
169
|
+
|
170
|
+
// search for late sibling nodes
|
171
|
+
'~': function(element, tag) {
|
172
|
+
var result = [];
|
173
|
+
while (element = element.nextSibling)
|
174
|
+
if (tag == '*' || element.tagName == tag)
|
175
|
+
result.push(element);
|
176
|
+
return result;
|
177
|
+
}
|
178
|
+
};
|
179
|
+
|
180
|
+
|
181
|
+
/**
|
182
|
+
* Collection of pseudo selector matchers
|
183
|
+
*/
|
184
|
+
var pseudos = {
|
185
|
+
checked: function() {
|
186
|
+
return this.checked;
|
187
|
+
},
|
188
|
+
|
189
|
+
disabled: function() {
|
190
|
+
return this.disabled;
|
191
|
+
},
|
192
|
+
|
193
|
+
empty: function() {
|
194
|
+
return !(this.innerText || this.innerHTML || this.textContent || '').length;
|
195
|
+
},
|
196
|
+
|
197
|
+
'first-child': function(tag_name) {
|
198
|
+
var node = this;
|
199
|
+
while (node = node.previousSibling) {
|
200
|
+
if (node.tagName && (!tag_name || node.tagName == tag_name)) {
|
201
|
+
return false;
|
202
|
+
}
|
203
|
+
}
|
204
|
+
return true;
|
205
|
+
},
|
206
|
+
|
207
|
+
'first-of-type': function() {
|
208
|
+
return arguments[1]['first-child'].call(this, this.tagName);
|
209
|
+
},
|
210
|
+
|
211
|
+
'last-child': function(tag_name) {
|
212
|
+
var node = this;
|
213
|
+
while (node = node.nextSibling) {
|
214
|
+
if (node.tagName && (!tag_name || node.tagName == tag_name)) {
|
215
|
+
return false;
|
216
|
+
}
|
217
|
+
}
|
218
|
+
return true;
|
219
|
+
},
|
220
|
+
|
221
|
+
'last-of-type': function() {
|
222
|
+
return arguments[1]['last-child'].call(this, this.tagName);
|
223
|
+
},
|
224
|
+
|
225
|
+
'only-child': function(tag_name, matchers) {
|
226
|
+
return matchers['first-child'].call(this, tag_name)
|
227
|
+
&& matchers['last-child'].call(this, tag_name);
|
228
|
+
},
|
229
|
+
|
230
|
+
'only-of-type': function() {
|
231
|
+
return arguments[1]['only-child'].call(this, this.tagName, arguments[1]);
|
232
|
+
},
|
233
|
+
|
234
|
+
'nth-child': function(number, matchers, tag_name) {
|
235
|
+
if (!this.parentNode) return false;
|
236
|
+
number = number.toLowerCase();
|
237
|
+
|
238
|
+
if (number == 'n') return true;
|
239
|
+
|
240
|
+
if (number.includes('n')) {
|
241
|
+
// parsing out the matching expression
|
242
|
+
var a = b = 0;
|
243
|
+
if (m = number.match(/^([+-]?\d*)?n([+-]?\d*)?$/)) {
|
244
|
+
a = m[1] == '-' ? -1 : parseInt(m[1], 10) || 1;
|
245
|
+
b = parseInt(m[2], 10) || 0;
|
246
|
+
}
|
247
|
+
|
248
|
+
// getting the element index
|
249
|
+
var index = 1, node = this;
|
250
|
+
while ((node = node.previousSibling)) {
|
251
|
+
if (node.tagName && (!tag_name || node.tagName == tag_name)) index++;
|
252
|
+
}
|
253
|
+
|
254
|
+
return (index - b) % a == 0 && (index - b) / a >= 0;
|
255
|
+
|
256
|
+
} else {
|
257
|
+
return matchers['index'].call(this, number.toInt() - 1, matchers, tag_name);
|
258
|
+
}
|
259
|
+
},
|
260
|
+
|
261
|
+
'nth-of-type': function(number) {
|
262
|
+
return arguments[1]['nth-child'].call(this, number, arguments[1], this.tagName);
|
263
|
+
},
|
264
|
+
|
265
|
+
// protected
|
266
|
+
index: function(number, matchers, tag_name) {
|
267
|
+
number = isString(number) ? number.toInt() : number;
|
268
|
+
var node = this, count = 0;
|
269
|
+
while ((node = node.previousSibling)) {
|
270
|
+
if (node.tagName && (!tag_name || node.tagName == tag_name) && ++count > number) return false;
|
271
|
+
}
|
272
|
+
return count == number;
|
273
|
+
}
|
274
|
+
};
|
275
|
+
|
276
|
+
// the regexps collection
|
277
|
+
var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g;
|
278
|
+
var id_re = /#([\w\-_]+)/;
|
279
|
+
var tag_re = /^[\w\*]+/;
|
280
|
+
var class_re = /\.([\w\-\._]+)/;
|
281
|
+
var pseudo_re = /:([\w\-]+)(\((.+?)\))*$/;
|
282
|
+
var attrs_re = /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/;
|
283
|
+
|
284
|
+
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
285
|
+
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
286
|
+
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
287
|
+
|
288
|
+
/**
|
289
|
+
* Builds an atom matcher
|
290
|
+
*
|
291
|
+
* @param String atom definition
|
292
|
+
* @return Object atom matcher
|
293
|
+
*/
|
294
|
+
var atoms_cache = {};
|
295
|
+
var build_atom = function(atom) {
|
296
|
+
if (!atoms_cache[atom]) {
|
297
|
+
//
|
298
|
+
// HACK HACK HACK
|
299
|
+
//
|
300
|
+
// I use those tiny variable names, case I'm gonna be nougty
|
301
|
+
// and generate the matching function nasty way via evals and strings
|
302
|
+
// and as the code will be compacted, the real variable names will be lost
|
303
|
+
// unless they shortified to the minimum
|
304
|
+
//
|
305
|
+
// Here what the real variable names are
|
306
|
+
// i - for 'id' string
|
307
|
+
// t - for 'tag' name
|
308
|
+
// c - for 'classes' list
|
309
|
+
// a - for 'attributes' hash
|
310
|
+
// p - for 'pseudo' string
|
311
|
+
// v - for 'value_of_pseudo'
|
312
|
+
//
|
313
|
+
var i, t, c, a, p, v, m, desc = {};
|
314
|
+
|
315
|
+
// grabbing the attributes
|
316
|
+
while(m = atom.match(attrs_re)) {
|
317
|
+
a = a || {};
|
318
|
+
a[m[1]] = { o: m[2], v: m[5] || m[6] };
|
319
|
+
atom = atom.replace(m[0], '');
|
320
|
+
}
|
321
|
+
|
322
|
+
// extracting the pseudos
|
323
|
+
if (m = atom.match(pseudo_re)) {
|
324
|
+
p = m[1];
|
325
|
+
v = m[3] == '' ? null : m[3];
|
326
|
+
atom = atom.replace(m[0], '');
|
327
|
+
}
|
328
|
+
|
329
|
+
// getting all the other options
|
330
|
+
i = (atom.match(id_re) || [1, null])[1];
|
331
|
+
t = (atom.match(tag_re) || '*').toString().toUpperCase();
|
332
|
+
c = (atom.match(class_re) || [1, ''])[1].split('.').without('');
|
333
|
+
|
334
|
+
desc.tag = t;
|
335
|
+
|
336
|
+
// building the matcher function
|
337
|
+
//
|
338
|
+
// NOTE: we kinda compile a cutom filter function in here
|
339
|
+
// the point is to create a maximally optimized method
|
340
|
+
// that will make only this atom checks and will filter
|
341
|
+
// a list of elements in a single call
|
342
|
+
//
|
343
|
+
if (i || c.length || a || p) {
|
344
|
+
var filter = 'function(y){'+
|
345
|
+
'var e,r=[];'+
|
346
|
+
'for(var z=0,x=y.length;z<x;z++){'+
|
347
|
+
'e=y[z];_f_'+
|
348
|
+
'}return r}';
|
349
|
+
var patch_filter = function(code) {
|
350
|
+
filter = filter.replace('_f_', code + '_f_');
|
351
|
+
};
|
352
|
+
|
353
|
+
// adding the ID check conditions
|
354
|
+
if (i) patch_filter('if(e.id!=i)continue;');
|
355
|
+
|
356
|
+
// adding the classes matching code
|
357
|
+
if (c.length) patch_filter(
|
358
|
+
'if(e.className){'+
|
359
|
+
'var n=e.className.split(" ");'+
|
360
|
+
'if(n.length==1&&c.indexOf(n[0])==-1)continue;'+
|
361
|
+
'else{'+
|
362
|
+
'for(var i=0,l=c.length,b=false;i<l;i++)'+
|
363
|
+
'if(n.indexOf(c[i])==-1){'+
|
364
|
+
'b=true;break;}'+
|
365
|
+
|
366
|
+
'if(b)continue;}'+
|
367
|
+
'}else continue;'
|
368
|
+
);
|
369
|
+
|
370
|
+
// adding the attributes matching conditions
|
371
|
+
if (a) patch_filter(
|
372
|
+
'var p,o,v,b=false;'+
|
373
|
+
'for (var k in a){p=e.getAttribute(k)||"";o=a[k].o;v=a[k].v;'+
|
374
|
+
'if('+
|
375
|
+
'(o=="="&&p!=v)||'+
|
376
|
+
'(o=="*="&&!p.includes(v))||'+
|
377
|
+
'(o=="^="&&!p.startsWith(v))||'+
|
378
|
+
'(o=="$="&&!p.endsWith(v))||'+
|
379
|
+
'(o=="~="&&!p.split(" ").includes(v))||'+
|
380
|
+
'(o=="|="&&!p.split("-").includes(v))'+
|
381
|
+
'){b=true;break;}'+
|
382
|
+
'}if(b){continue;}'
|
383
|
+
);
|
384
|
+
|
385
|
+
// adding the pseudo matchers check
|
386
|
+
if (p && pseudos[p]) {
|
387
|
+
var s = pseudos;
|
388
|
+
patch_filter('if(!s[p].call(e,v,s))continue;');
|
389
|
+
}
|
390
|
+
|
391
|
+
desc.filter = eval('({f:'+ filter.replace('_f_', 'r.push(e)') +'})').f;
|
392
|
+
}
|
393
|
+
|
394
|
+
atoms_cache[atom] = desc;
|
395
|
+
}
|
396
|
+
|
397
|
+
return atoms_cache[atom];
|
398
|
+
};
|
399
|
+
|
400
|
+
/**
|
401
|
+
* Builds a single selector out of a simple rule chunk
|
402
|
+
*
|
403
|
+
* @param Array of a single rule tokens
|
404
|
+
* @return Function selector
|
405
|
+
*/
|
406
|
+
var tokens_cache = {};
|
407
|
+
var build_selector = function(rule) {
|
408
|
+
var rule_key = rule.join('');
|
409
|
+
if (!tokens_cache[rule_key]) {
|
410
|
+
for (var i=0; i < rule.length; i++) {
|
411
|
+
rule[i][1] = build_atom(rule[i][1]);
|
412
|
+
}
|
413
|
+
|
414
|
+
// creates a list of uniq nodes
|
415
|
+
var _uid = $uid;
|
416
|
+
var uniq = function(elements) {
|
417
|
+
var uniq = [], uids = [], uid;
|
418
|
+
for (var i=0, length = elements.length; i < length; i++) {
|
419
|
+
uid = _uid(elements[i]);
|
420
|
+
if (!uids[uid]) {
|
421
|
+
uniq.push(elements[i]);
|
422
|
+
uids[uid] = true;
|
423
|
+
}
|
424
|
+
}
|
425
|
+
|
426
|
+
return uniq;
|
427
|
+
};
|
428
|
+
|
429
|
+
// performs the actual search of subnodes
|
430
|
+
var find_subnodes = function(element, atom) {
|
431
|
+
var result = search[atom[0]](element, atom[1].tag);
|
432
|
+
return atom[1].filter ? atom[1].filter(result) : result;
|
433
|
+
};
|
434
|
+
|
435
|
+
// building the actual selector function
|
436
|
+
tokens_cache[rule_key] = function(element) {
|
437
|
+
var founds, sub_founds;
|
438
|
+
|
439
|
+
for (var i=0, i_length = rule.length; i < i_length; i++) {
|
440
|
+
if (i == 0) {
|
441
|
+
founds = find_subnodes(element, rule[i]);
|
442
|
+
|
443
|
+
} else {
|
444
|
+
if (i > 1) founds = uniq(founds);
|
445
|
+
|
446
|
+
for (var j=0; j < founds.length; j++) {
|
447
|
+
sub_founds = find_subnodes(founds[j], rule[i]);
|
448
|
+
|
449
|
+
sub_founds.unshift(1); // <- nuke the parent node out of the list
|
450
|
+
sub_founds.unshift(j); // <- position to insert the subresult
|
451
|
+
|
452
|
+
founds.splice.apply(founds, sub_founds);
|
453
|
+
|
454
|
+
j += sub_founds.length - 3;
|
455
|
+
}
|
456
|
+
}
|
457
|
+
}
|
458
|
+
|
459
|
+
return rule.length > 1 ? uniq(founds) : founds;
|
460
|
+
};
|
461
|
+
}
|
462
|
+
return tokens_cache[rule_key];
|
463
|
+
};
|
464
|
+
|
465
|
+
|
466
|
+
/**
|
467
|
+
* Builds the list of selectors for the css_rule
|
468
|
+
*
|
469
|
+
* @param String raw css-rule
|
470
|
+
* @return Array of selectors
|
471
|
+
*/
|
472
|
+
var selectors_cache = {}, chunks_cache = {};
|
473
|
+
var split_rule_to_selectors = function(css_rule) {
|
474
|
+
if (!selectors_cache[css_rule]) {
|
475
|
+
chunker.lastIndex = 0;
|
476
|
+
|
477
|
+
var rules = [], rule = [], rel = ' ', m, token;
|
478
|
+
while (m = chunker.exec(css_rule)) {
|
479
|
+
token = m[1];
|
480
|
+
|
481
|
+
if (token == '+' || token == '>' || token == '~') {
|
482
|
+
rel = token;
|
483
|
+
} else {
|
484
|
+
rule.push([rel, token]);
|
485
|
+
rel = ' ';
|
486
|
+
}
|
487
|
+
|
488
|
+
if (m[2]) {
|
489
|
+
rules.push(build_selector(rule));
|
490
|
+
rule = [];
|
491
|
+
}
|
492
|
+
}
|
493
|
+
rules.push(build_selector(rule));
|
494
|
+
|
495
|
+
selectors_cache[css_rule] = rules;
|
496
|
+
}
|
497
|
+
return selectors_cache[css_rule];
|
498
|
+
};
|
499
|
+
|
500
|
+
|
501
|
+
/**
|
502
|
+
* The top level method, it just goes throught the css-rule chunks
|
503
|
+
* collect and merge the results that's it
|
504
|
+
*
|
505
|
+
* @param Element context
|
506
|
+
* @param String raw css-rule
|
507
|
+
* @return Array search result
|
508
|
+
*/
|
509
|
+
var select_all = function(element, css_rule) {
|
510
|
+
var selectors = split_rule_to_selectors(css_rule), result = [];
|
511
|
+
for (var i=0, length = selectors.length; i < length; i++)
|
512
|
+
result = result.concat(selectors[i](element));
|
513
|
+
|
514
|
+
if (Browser.OLD) result.forEach(Element.prepare);
|
515
|
+
|
516
|
+
return result;
|
517
|
+
};
|
518
|
+
|
519
|
+
|
520
|
+
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
521
|
+
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
522
|
+
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
523
|
+
|
524
|
+
// the previous dom-selection methods replacement
|
525
|
+
var dom_extension = {
|
526
|
+
first: function(css_rule) {
|
527
|
+
return this.select(css_rule).first();
|
528
|
+
},
|
529
|
+
|
530
|
+
select: function(css_rule) {
|
531
|
+
return select_all(this, css_rule || '*');
|
532
|
+
}
|
533
|
+
};
|
534
|
+
|
535
|
+
// replacing the document-level search methods
|
536
|
+
$ext(document, dom_extension);
|
537
|
+
|
538
|
+
// patching the $$ function to make it more efficient
|
539
|
+
self.$$ = function(css_rule) {
|
540
|
+
return select_all(document, css_rule || '*');
|
541
|
+
};
|
542
|
+
|
543
|
+
// sending the extension to the Element#addMethods
|
544
|
+
return dom_extension;
|
545
|
+
})());
|
546
|
+
}
|
547
|
+
|
@@ -0,0 +1,9 @@
|
|
1
|
+
/**
|
2
|
+
* This is old browsers support patch for RightJS
|
3
|
+
*
|
4
|
+
* The library released under terms of the MIT license
|
5
|
+
* Visit http://rightjs.org for more details
|
6
|
+
*
|
7
|
+
* Copyright (C) 2008-2009 Nikolay V. Nemshilov aka St.
|
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(51.64){$=(7(o){8 7(i){9 e=o(i);8 e?15.33(e):e}})($);45(21,{create15:(7(o){8 7(t){8 15.33(o(t))}})(21.create15)});45(15,{33:7(e){if(e&&e.11&&!e.set){45(e,15.Methods,30);if(62['55'])switch(e.11){36 'FORM':55.65(e);34;36 'INPUT':36 'SELECT':36 'BUTTON':36 'TEXTAREA':55.15.65(e);34}}8 e}})}if(navigator.userAgent.38('Konqueror/3')!=-1)60(isHash.46().22(';','&&!(14[0] instanceof HTML15);'));if(!$E('p').getBoundingClientRect)15.40({24:7(){9 l=12.offsetLeft,t=12.offsetTop,a=12.48('24'),p=12.31,b=12.ownerDocument.body;16(p&&p.11){if(p===b||p.48('24')!='static'){if(p!==b||a!='absolute'){9 s=p.24();l+=s.x;t+=s.y}34}p=p.31}8{x:l,y:t}}});if(!21.querySelector)15.40((7(){9 H={' ':7(e,t){8 $A(e.get15sByTagName(t))},'>':7(e,t){9 r=[],n=e.27Child;16(n){if(t=='*'||n.11==t)r.29(n);n=n.20}8 r},'+':7(e,t){16(e=e.20)if(e.11)8(t=='*'||e.11==t)?[e]:[];8[]},'~':7(e,t){9 r=[];16(e=e.20)if(t=='*'||e.11==t)r.29(e);8 r}};9 G={52:7(){8 12.52},47:7(){8 12.47},empty:7(){8!(12.innerT65||12.innerHTML||12.t65Content||'').13},'27-17':7(t){9 n=12;16(n=n.19)if(n.11&&(!t||n.11==t))8 25;8 30},'27-of-43':7(){8 14[1]['27-17'].23(12,12.11)},'44-17':7(t){9 n=12;16(n=n.20)if(n.11&&(!t||n.11==t))8 25;8 30},'44-of-43':7(){8 14[1]['44-17'].23(12,12.11)},'54-17':7(t,m){8 m['27-17'].23(12,t)&&m['44-17'].23(12,t)},'54-of-43':7(){8 14[1]['54-17'].23(12,12.11,14[1])},'57-17':7(d,c,t){if(!12.31)8 25;d=d.toLower67();if(d=='n')8 30;if(d.26('n')){9 a=b=0;if(m=d.28(/^([+-]?\\d*)?n([+-]?\\d*)?$/)){a=m[1]=='-'?-1:49(m[1],10)||1;b=49(m[2],10)||0}9 i=1,n=12;16((n=n.19))if(n.11&&(!t||n.11==t))i++;8(i-b)% a==0&&(i-b)/a>=0}37 8 c['59'].23(12,d.58()-1,c,t)},'57-of-43':7(n){8 14[1]['57-17'].23(12,n,14[1],12.11)},59:7(a,m,t){a=isString(a)?a.58():a;9 n=12,c=0;16((n=n.19))if(n.11&&(!t||n.11==t)&&++c>a)8 25;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={};9 x=7(b){if(!q[b]){9 i,t,c,a,p,v,m,d={};16(m=b.28(w)){a=a||{};a[m[1]]={o:m[2],v:m[5]||m[6]};b=b.22(m[0],'')}if(m=b.28(F)){p=m[1];v=m[3]==''?61:m[3];b=b.22(m[0],'')}i=(b.28(E)||[1,61])[1];t=(b.28(L)||'*').46().toUpper67();c=(b.28(C)||[1,''])[1].39('.').without('');d.63=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];53'+'}8 r}';9 e=7(c){f=f.22('53',c+'53')};if(i)e('if(e.id!=i)18;');if(c.13)e('if(e.42){'+'9 n=e.42.39(\" \");'+'if(n.13==1&&c.38(n[0])==-1)18;'+'37{'+'32(9 i=0,l=c.13,b=25;i<l;i++)'+'if(n.38(c[i])==-1){'+'b=30;34;}'+'if(b)18;}'+'}37 18;');if(a)e('9 p,o,v,b=25;'+'32 (9 k in a){p=e.getAttribute(k)||\"\";o=a[k].o;v=a[k].v;'+'if('+'(o==\"=\"&&p!=v)||'+'(o==\"*=\"&&!p.26(v))||'+'(o==\"^=\"&&!p.starts66(v))||'+'(o==\"$=\"&&!p.ends66(v))||'+'(o==\"~=\"&&!p.39(\" \").26(v))||'+'(o==\"|=\"&&!p.39(\"-\").26(v))'+'){b=30;34;}'+'}if(b){18;}');if(p&&G[p]){9 s=G;e('if(!s[p].23(e,v,s))18;')}d.41=60('({f:'+f.22('53','r.29(e)')+'})').f}q[b]=d}8 q[b]};9 M={};9 y=7(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.29(e[i]);a[u]=30}}8 b};9 d=7(e,a){9 r=H[a[0]](e,a[1].63);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]);37{if(i>1)f=k(f);32(9 j=0;j<f.13;j++){s=d(f[j],g[i]);s.50(1);s.50(j);f.splice.apply(f,s);j+=s.13-3}}}8 g.13>1?k(f):f}}8 M[h]};9 J={},B={};9 K=7(c){if(!J[c]){A.44Index=0;9 b=[],a=[],r=' ',m,t;16(m=A.exec(c)){t=m[1];if(t=='+'||t=='>'||t=='~')r=t;37{a.29([r,t]);r=' '}if(m[2]){b.29(y(a));a=[]}}b.29(y(a));J[c]=b}8 J[c]};9 I=7(e,c){9 s=K(c),r=[];32(9 i=0,l=s.13;i<l;i++)r=r.concat(s[i](e));if(51.64)r.32Each(15.33);8 r};9 D={27:7(c){8 12.56(c).27()},56:7(c){8 I(12,c||'*')}};45(21,D);62.$$=7(c){8 I(21,c||'*')};8 D})());",",,,,,,,function,return,var,,tagName,this,length,arguments,Element,while,child,continue,previousSibling,nextSibling,document,replace,call,position,false,includes,first,match,push,true,parentNode,for,prepare,break,createElement,case,else,indexOf,split,addMethods,filter,className,type,last,$ext,toString,disabled,getStyle,parseInt,unshift,Browser,checked,_f_,only,Form,select,nth,toInt,index,eval,null,self,tag,OLD,ext,With,Case".split(",")));
|
@@ -0,0 +1,9 @@
|
|
1
|
+
/**
|
2
|
+
* Ruby On Rails common Ajax operations conventional wrapper
|
3
|
+
* and underscored aliases for core methods
|
4
|
+
*
|
5
|
+
* http://github.com/MadRabbit/right-rails
|
6
|
+
*
|
7
|
+
* Copyright (C) Nikolay V. Nemshilov aka St.
|
8
|
+
*/
|
9
|
+
;var RR={Options:{format:'js',flashId:'flashes',flashHideFx:'slide',flashHideDelay:3200,highlightUpdates:true,removeFx:'fade',rescanWithScopes:true},update_flash:function(c){var e=$(this.Options.flashId);if(e)this.replace(e,c).hide_flash();return this},hide_flash:function(){if(this.Options.flashHideDelay>-1){var e=$(this.Options.flashId);if(e&&e.visible())e.hide.bind(e,this.Options.flashHideFx).delay(this.Options.flashHideDelay)}return this},highlight:function(i){if(this.Options.highlightUpdates)$(i).highlight();return this},insert:function(a,w){return this.highlight($(a).insert(w).lastChild).rescan(a)},replace:function(i,s){$(i).replace(s);return this.highlight(i).rescan(i)},remove:function(i){var e=$(i);if(e){var r=e.remove.bind(e).chain(Lightbox.rescan);if(this.Options.removeFx)e.hide(this.Options.removeFx,{onFinish:r});else r}},remotize_form:function(i){var f=$(i);if(f)f.remotize().enable().action+='.'+this.Options.format;return this},replace_form:function(i,s){var f=$(i);if(f){f.replace(s);this.remotize_form(i)}return this.rescan(i)},show_form_for:function(i,s){$(i).select('form').each('remove');$(i).insert(s);return this.remotize_form($(i).first('form')).rescan(i)},hijack_links:function(){this._links=this._links||[];$$('a.edit, a.destroy').each(function(l){var u=$uid(l);if(!this._links[u]){this._links[u]=true;if(l.hasClass('destroy'))l.onclick=eval('({f:'+l.onclick.toString().replace('.submit','.send')+'})').f;else if(l.hasClass('edit')){l.onclick=function(e){e.stop();Xhr.load(l.href+'.'+this.Options.format)}.bind(this)}}},this);return this},rescan:function(s){this.hijack_links();$w('Lightbox Calendar Autocompleter Draggable Droppable Sortable Tabs Slider Rater Selectable').each(function(n){if(self[n])self[n].rescan(this.Options.rescanWithScopes?s:null)},this);return this}};document.onReady(function(){RR.hide_flash().rescan()});[String.prototype,Array.prototype,Function.prototype,Object,Options,Observer,Observer.prototype,window,document].each(function(o){for(var k in o)try{if(/[A-Z]/.test(k)&&typeof(o[k])=='function'){var u=k.underscored();if(o[u]===null||o[u]===undefined)o[u]=o[k]}}catch(e){}});[Element,Event,Form,Form.Element].each(function(o){var a={},m=o.Methods;for(var k in m)if(/[A-Z]/.test(k)&&typeof(m[k])=='function')a[k.underscored()]=m[k];o.addMethods(a)});$alias(String.prototype,{index_of:'indexOf',last_index_of:'lastIndexOf',to_f:'toFloat',to_i:'toInt',gsub:'replace',downcase:'toLowerCase',upcase:'toUpperCase',index:'indexOf',rindex:'lastIndexOf',strip:'trim'});$alias(Array.prototype,{collect:'map',detect:'filter',index_of:'indexOf',last_index_of:'lastIndexOf',index:'indexOf',rindex:'lastIndexOf'});
|
@@ -29,7 +29,9 @@ var RR = {
|
|
29
29
|
|
30
30
|
highlightUpdates: true,
|
31
31
|
|
32
|
-
removeFx: 'fade'
|
32
|
+
removeFx: 'fade',
|
33
|
+
|
34
|
+
rescanWithScopes: true // if it should rescan only updated elements
|
33
35
|
},
|
34
36
|
|
35
37
|
/**
|
@@ -82,7 +84,7 @@ var RR = {
|
|
82
84
|
* @return RR this
|
83
85
|
*/
|
84
86
|
insert: function(where, what) {
|
85
|
-
return this.highlight($(where).insert(what).lastChild).rescan();
|
87
|
+
return this.highlight($(where).insert(what).lastChild).rescan(where);
|
86
88
|
},
|
87
89
|
|
88
90
|
/**
|
@@ -94,7 +96,7 @@ var RR = {
|
|
94
96
|
*/
|
95
97
|
replace: function(id, source) {
|
96
98
|
$(id).replace(source);
|
97
|
-
return this.highlight(id).rescan();
|
99
|
+
return this.highlight(id).rescan(id);
|
98
100
|
},
|
99
101
|
|
100
102
|
/**
|
@@ -106,12 +108,12 @@ var RR = {
|
|
106
108
|
remove: function(id) {
|
107
109
|
var element = $(id);
|
108
110
|
if (element) {
|
111
|
+
var remove_element = element.remove.bind(element).chain(Lightbox.rescan);
|
112
|
+
|
109
113
|
if (this.Options.removeFx) {
|
110
|
-
element.hide(this.Options.removeFx, {
|
111
|
-
onFinish: element.remove.bind(element)
|
112
|
-
});
|
114
|
+
element.hide(this.Options.removeFx, {onFinish: remove_element});
|
113
115
|
} else {
|
114
|
-
|
116
|
+
remove_element;
|
115
117
|
}
|
116
118
|
}
|
117
119
|
},
|
@@ -144,7 +146,7 @@ var RR = {
|
|
144
146
|
this.remotize_form(id);
|
145
147
|
}
|
146
148
|
|
147
|
-
return this.rescan();
|
149
|
+
return this.rescan(id);
|
148
150
|
},
|
149
151
|
|
150
152
|
/**
|
@@ -158,7 +160,7 @@ var RR = {
|
|
158
160
|
$(id).select('form').each('remove'); // removing old forms
|
159
161
|
$(id).insert(source);
|
160
162
|
|
161
|
-
return this.remotize_form($(id).first('form')).rescan();
|
163
|
+
return this.remotize_form($(id).first('form')).rescan(id);
|
162
164
|
},
|
163
165
|
|
164
166
|
/**
|
@@ -192,13 +194,13 @@ var RR = {
|
|
192
194
|
*
|
193
195
|
* @return RR this
|
194
196
|
*/
|
195
|
-
rescan: function() {
|
197
|
+
rescan: function(scope) {
|
196
198
|
this.hijack_links();
|
197
199
|
|
198
200
|
$w('Lightbox Calendar Autocompleter Draggable Droppable Sortable Tabs Slider Rater Selectable'
|
199
201
|
).each(function(name) {
|
200
|
-
if (self[name]) self[name].rescan();
|
201
|
-
});
|
202
|
+
if (self[name]) self[name].rescan(this.Options.rescanWithScopes ? scope : null);
|
203
|
+
}, this);
|
202
204
|
|
203
205
|
|
204
206
|
return this;
|
data/javascripts/right-rails.js
CHANGED
@@ -6,4 +6,4 @@
|
|
6
6
|
*
|
7
7
|
* Copyright (C) Nikolay V. Nemshilov aka St.
|
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})(";12 RR={6:{31:'js',26:'flashes',27:'slide',13:3200,1558:42,23:'fade',96160:42},update_flash:4(c){12 e=$(5.6.26);if(e)5.11(e,c).18();7 5},18:4(){if(5.6.13>-1){12 e=$(5.6.26);if(e&&e.visible())e.53.41(e,5.6.27).delay(5.6.13)}7 5},15:4(i){if(5.6.1558)$(i).15();7 5},33:4(a,w){7 5.15($(a).33(w).lastChild).9(a)},11:4(i,s){$(i).11(s);7 5.15(i).9(i)},30:4(i){12 e=$(i);if(e){12 r=e.30.41(e).chain(36.9);if(5.6.23)e.53(5.6.23,{onFinish:r});54 r}},14:4(i){12 f=$(i);if(f)f.remotize().enable().action+='.'+5.6.31;7 5},11_55:4(i,s){12 f=$(i);if(f){f.11(s);5.14(i)}7 5.9(i)},show_55_57:4(i,s){$(i).select('55').25('30');$(i).33(s);7 5.14($(i).first('55')).9(i)},hijack22:4(){5.22=5.22||[];$$('a.50, a.40').25(4(l){12 u=$uid(l);if(!5.22[u]){5.22[u]=42;if(l.34('40'))l.29=eval('({f:'+l.29.to44().11('.submit','.send')+'})').f;54 if(l.34('50')){l.29=4(e){e.stop();Xhr.load(l.href+'.'+5.6.31)}.41(5)}}},5);7 5},9:4(s){5.hijack22();$w('36 Calendar Autocompleter Draggable Droppable Sortable Tabs Slider Rater Selectable').25(4(n){if(56[n])56[n].9(5.6.96160?s:49)},5);7 5}};37.onReady(4(){RR.18().9()});[44.8,48.8,Function.8,Object,6,35,35.8,window,37].25(4(o){57(12 k in o)try{if(/[A-Z]/.52(k)&&46(o[k])=='4'){12 u=k.28();if(o[u]===49||o[u]===undefined)o[u]=o[k]}}catch(e){}});[39,Event,51,51.39].25(4(o){12 a={},m=o.59;57(12 k in m)if(/[A-Z]/.52(k)&&46(m[k])=='4')a[k.28()]=m[k];o.add59(a)});45(44.8,{38:'19',21:'10',to_f:'toFloat',to_i:'toInt',gsub:'11',downcase:'toLower62',upcase:'toUpper62',47:'19',43:'10',strip:'trim'});45(48.8,{collect:'map',detect:'filter',38:'19',21:'10',47:'19',43:'10'});",",,,,function,this,Options,return,prototype,rescan,lastIndexOf,replace,var,flashHideDelay,remotize_form,highlight,rescanWithScopes,highlightUpdates,hide_flash,indexOf,,last_index_of,_links,removeFx,hijack_links,each,flashId,flashHideFx,underscored,onclick,remove,format,,insert,hasClass,Observer,Lightbox,document,index_of,Element,destroy,bind,true,rindex,String,$alias,typeof,index,Array,null,edit,Form,test,hide,else,form,self,for,Updates,Methods,Scopes,With,Case".split(",")));
|