right-rails 1.0.10 → 1.0.12
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +4 -4
- data/Rakefile +4 -4
- data/lib/right_rails.rb +1 -1
- data/public/javascripts/right/autocompleter-src.js +115 -106
- data/public/javascripts/right/autocompleter.js +3 -14
- data/public/javascripts/right/billboard-src.js +58 -38
- data/public/javascripts/right/billboard.js +3 -13
- data/public/javascripts/right/calendar-src.js +136 -133
- data/public/javascripts/right/calendar.js +4 -33
- data/public/javascripts/right/colorpicker-src.js +128 -125
- data/public/javascripts/right/colorpicker.js +4 -23
- data/public/javascripts/right/dialog-src.js +67 -37
- data/public/javascripts/right/dialog.js +3 -17
- data/public/javascripts/right/dnd-src.js +44 -43
- data/public/javascripts/right/dnd.js +3 -16
- data/public/javascripts/right/effects-src.js +125 -98
- data/public/javascripts/right/effects.js +3 -13
- data/public/javascripts/right/in-edit-src.js +54 -38
- data/public/javascripts/right/in-edit.js +4 -10
- data/public/javascripts/right/jquerysh-src.js +344 -20
- data/public/javascripts/right/jquerysh.js +3 -3
- data/public/javascripts/right/json-src.js +22 -35
- data/public/javascripts/right/json.js +4 -7
- data/public/javascripts/right/keys-src.js +87 -0
- data/public/javascripts/right/keys.js +7 -0
- data/public/javascripts/right/lightbox-src.js +76 -58
- data/public/javascripts/right/lightbox.js +3 -20
- data/public/javascripts/right/rails-src.js +108 -107
- data/public/javascripts/right/rails.js +4 -11
- data/public/javascripts/right/rater-src.js +47 -31
- data/public/javascripts/right/rater.js +3 -9
- data/public/javascripts/right/resizable-src.js +60 -33
- data/public/javascripts/right/resizable.js +3 -11
- data/public/javascripts/right/selectable-src.js +87 -51
- data/public/javascripts/right/selectable.js +3 -18
- data/public/javascripts/right/sizzle-src.js +15 -10
- data/public/javascripts/right/sizzle.js +4 -27
- data/public/javascripts/right/slider-src.js +49 -33
- data/public/javascripts/right/slider.js +3 -10
- data/public/javascripts/right/sortable-src.js +46 -32
- data/public/javascripts/right/sortable.js +4 -13
- data/public/javascripts/right/table-src.js +19 -10
- data/public/javascripts/right/table.js +4 -6
- data/public/javascripts/right/tabs-src.js +69 -47
- data/public/javascripts/right/tabs.js +4 -26
- data/public/javascripts/right/tooltips-src.js +78 -56
- data/public/javascripts/right/tooltips.js +4 -9
- data/public/javascripts/right/uploader-src.js +50 -34
- data/public/javascripts/right/uploader.js +3 -9
- data/public/javascripts/right-olds-src.js +528 -355
- data/public/javascripts/right-olds.js +4 -13
- data/public/javascripts/right-safe-src.js +4 -99
- data/public/javascripts/right-safe.js +3 -4
- data/public/javascripts/right-src.js +1618 -1245
- data/public/javascripts/right.js +4 -91
- metadata +8 -6
@@ -1,38 +1,362 @@
|
|
1
1
|
/**
|
2
|
-
* jQuery-like
|
2
|
+
* jQuery-like interfaces v2.2.0
|
3
3
|
* http://rightjs.org/plugins/jquerysh
|
4
4
|
*
|
5
|
-
* Copyright (C)
|
5
|
+
* Copyright (C) 2009-2011 Nikolay Nemshilov
|
6
6
|
*/
|
7
|
+
(function(RightJS) {
|
7
8
|
/**
|
8
|
-
*
|
9
|
+
* jquerysh initialization script
|
9
10
|
*
|
10
|
-
* Copyright (C) 2010 Nikolay Nemshilov
|
11
|
+
* Copyright (C) 2010-2011 Nikolay Nemshilov
|
11
12
|
*/
|
13
|
+
var rjs_$ = RightJS.$,
|
14
|
+
$$ = RightJS.$$,
|
15
|
+
$E = RightJS.$E,
|
16
|
+
$A = RightJS.$A,
|
17
|
+
$ext = RightJS.$ext,
|
18
|
+
Xhr = RightJS.Xhr,
|
19
|
+
Browser = RightJS.Browser,
|
20
|
+
Object = RightJS.Object;
|
21
|
+
|
22
|
+
|
23
|
+
|
12
24
|
|
13
25
|
/**
|
14
|
-
*
|
26
|
+
* The plugin's definition
|
15
27
|
*
|
16
|
-
* Copyright (C)
|
28
|
+
* Copyright (C) 2011 Nikolay Nemshilov
|
17
29
|
*/
|
30
|
+
RightJS.jQuerysh = {
|
31
|
+
version: '2.2.0',
|
18
32
|
|
33
|
+
// collection methods
|
34
|
+
collectionMethods: {
|
35
|
+
live: function(event, callback) {
|
36
|
+
this.cssRule.on(event, callback);
|
37
|
+
return this;
|
38
|
+
},
|
19
39
|
|
20
|
-
|
40
|
+
die: function(event, callback) {
|
41
|
+
this.cssRule.stopObserving(event, callback);
|
42
|
+
return this;
|
43
|
+
}
|
44
|
+
}
|
45
|
+
};
|
46
|
+
|
47
|
+
/**
|
48
|
+
* jQuery-like '$' function behavior
|
49
|
+
*
|
50
|
+
* Copyright (C) 2010-2011 Nikolay Nemshilov
|
51
|
+
*/
|
52
|
+
var $ = function(something) {
|
21
53
|
switch(typeof something) {
|
22
54
|
case 'string':
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
55
|
+
var hash = something[0], id = something.substr(1);
|
56
|
+
|
57
|
+
if (hash === '#' && (/^[\w\-]+$/).test(id)) {
|
58
|
+
return rjs_$(id);
|
59
|
+
} else if (hash === '<') {
|
60
|
+
return $E('div', {html: something}).first();
|
61
|
+
} else {
|
62
|
+
hash = $$(something);
|
63
|
+
hash.cssRule = RightJS(something);
|
64
|
+
return $ext(hash, RightJS.jQuerysh.collectionMethods);
|
65
|
+
}
|
66
|
+
|
28
67
|
case 'function':
|
29
|
-
|
30
|
-
|
31
|
-
|
68
|
+
return rjs_$(document).onReady(something);
|
69
|
+
|
32
70
|
default:
|
33
|
-
|
34
|
-
|
71
|
+
return rjs_$(something);
|
72
|
+
}
|
73
|
+
};
|
74
|
+
|
75
|
+
/**
|
76
|
+
* jQuery core methods emulation
|
77
|
+
*
|
78
|
+
* Copyright (C) 2011 Nikolay Nemshilov
|
79
|
+
*/
|
80
|
+
$ext($, {
|
81
|
+
|
82
|
+
browser: {
|
83
|
+
webkit: Browser.WebKit,
|
84
|
+
opera: Browser.Opera,
|
85
|
+
msie: Browser.IE,
|
86
|
+
mozilla: Browser.Gecko
|
87
|
+
},
|
88
|
+
|
89
|
+
// Type checks
|
90
|
+
|
91
|
+
isFunction: function(value) {
|
92
|
+
return RightJS.isFunction(value);
|
93
|
+
},
|
94
|
+
|
95
|
+
isArray: function(value) {
|
96
|
+
return RightJS.isArray(value);
|
97
|
+
},
|
98
|
+
|
99
|
+
isPlainObject: function(value) {
|
100
|
+
return RightJS.isHash(value);
|
101
|
+
},
|
102
|
+
|
103
|
+
isEmptyObject: function(value) {
|
104
|
+
return Object.empty(value);
|
105
|
+
},
|
106
|
+
|
107
|
+
globalEval: function(script) {
|
108
|
+
return RightJS.$eval(script);
|
109
|
+
},
|
110
|
+
|
111
|
+
// Array stuff
|
112
|
+
|
113
|
+
makeArray: function(value) {
|
114
|
+
return $A(value);
|
115
|
+
},
|
116
|
+
|
117
|
+
each: function(list, callback) {
|
118
|
+
return $A(list, function(item, index) {
|
119
|
+
callback(index, item);
|
120
|
+
});
|
121
|
+
},
|
122
|
+
|
123
|
+
map: function(callback) {
|
124
|
+
return $A(value).map(callback);
|
125
|
+
},
|
126
|
+
|
127
|
+
unique: function(array) {
|
128
|
+
return $A(array).uniq();
|
129
|
+
},
|
130
|
+
|
131
|
+
merge: function(first, second) {
|
132
|
+
return $A(first).merge(second);
|
133
|
+
},
|
134
|
+
|
135
|
+
|
136
|
+
// the rest of the things
|
137
|
+
|
138
|
+
extend: function() {
|
139
|
+
return Object.merge.apply(Object, arguments);
|
140
|
+
},
|
141
|
+
|
142
|
+
proxy: function(func, context) {
|
143
|
+
return RightJS(func).bind(context);
|
144
|
+
},
|
145
|
+
|
146
|
+
noop: function() {
|
147
|
+
return RightJS(function() {});
|
35
148
|
}
|
36
|
-
|
37
|
-
|
38
|
-
|
149
|
+
|
150
|
+
});
|
151
|
+
|
152
|
+
/**
|
153
|
+
* Element level jQuery like aliases
|
154
|
+
*
|
155
|
+
* Copyright (C) 2011 Nikolay Nemshilov
|
156
|
+
*/
|
157
|
+
RightJS.Element.include({
|
158
|
+
|
159
|
+
appendTo: function(target) {
|
160
|
+
return this.insertTo(target);
|
161
|
+
},
|
162
|
+
|
163
|
+
prepend: function(content) {
|
164
|
+
return this.insert(content, 'top');
|
165
|
+
},
|
166
|
+
|
167
|
+
before: function(content) {
|
168
|
+
return this.insert(content, 'before');
|
169
|
+
},
|
170
|
+
|
171
|
+
after: function(content) {
|
172
|
+
return this.insert(content, 'after');
|
173
|
+
},
|
174
|
+
|
175
|
+
insertBefore: function(target) {
|
176
|
+
return this.insertTo(target, 'before');
|
177
|
+
},
|
178
|
+
|
179
|
+
attr: function(name, value) {
|
180
|
+
return value === undefined ? this.get(name) : this.set(name, value);
|
181
|
+
},
|
182
|
+
|
183
|
+
css: function(name, value) {
|
184
|
+
return (typeof(name) === 'string' && value === undefined) ?
|
185
|
+
this.getStyle(name) : this.setStyle(name, value);
|
186
|
+
},
|
187
|
+
|
188
|
+
offset: function() {
|
189
|
+
var position = this.position();
|
190
|
+
return {
|
191
|
+
left: position.x,
|
192
|
+
top: position.y
|
193
|
+
};
|
194
|
+
},
|
195
|
+
|
196
|
+
width: function() {
|
197
|
+
return this.size().x;
|
198
|
+
},
|
199
|
+
|
200
|
+
height: function() {
|
201
|
+
return this.size().y;
|
202
|
+
},
|
203
|
+
|
204
|
+
scrollLeft: function() {
|
205
|
+
return this.scrolls().x;
|
206
|
+
},
|
207
|
+
|
208
|
+
scrollTop: function() {
|
209
|
+
return this.scrolls().y;
|
210
|
+
},
|
211
|
+
|
212
|
+
bind: function() {
|
213
|
+
return this.on.apply(this, arguments);
|
214
|
+
},
|
215
|
+
|
216
|
+
unbind: function() {
|
217
|
+
return this.stopObserving.apply(this, arguments);
|
218
|
+
},
|
219
|
+
|
220
|
+
trigger: function(name, options) {
|
221
|
+
return this.fire(name, options);
|
222
|
+
},
|
223
|
+
|
224
|
+
animate: function(style, time, finish) {
|
225
|
+
return this.morph(style, {duration: time, onFinish: finish});
|
226
|
+
},
|
227
|
+
|
228
|
+
fadeIn: function() {
|
229
|
+
return this.fade('in');
|
230
|
+
},
|
231
|
+
|
232
|
+
fadeOut: function() {
|
233
|
+
return this.fade('out');
|
234
|
+
},
|
235
|
+
|
236
|
+
slideIn: function() {
|
237
|
+
return this.slide('in');
|
238
|
+
},
|
239
|
+
|
240
|
+
slideOut: function() {
|
241
|
+
return this.slide('out');
|
242
|
+
}
|
243
|
+
|
244
|
+
});
|
245
|
+
|
246
|
+
/**
|
247
|
+
* jQuery like ajax interfaces
|
248
|
+
*
|
249
|
+
* Copyright (C) 2011 Nikolay Nemshilov
|
250
|
+
*/
|
251
|
+
$ext($, {
|
252
|
+
|
253
|
+
param: function(object) {
|
254
|
+
return Object.toQueryString(object);
|
255
|
+
},
|
256
|
+
|
257
|
+
ajax: function(url, options) {
|
258
|
+
options = options || {};
|
259
|
+
|
260
|
+
if (typeof(url) === 'string') {
|
261
|
+
options.url = url;
|
262
|
+
} else {
|
263
|
+
options = url;
|
264
|
+
}
|
265
|
+
|
266
|
+
var xhr_options = {};
|
267
|
+
|
268
|
+
function callback(original, xhr) {
|
269
|
+
original(
|
270
|
+
options.dataType === 'json' ? xhr.json : xhr.text,
|
271
|
+
xhr.successful() ? 'success' : 'error',
|
272
|
+
xhr
|
273
|
+
);
|
274
|
+
}
|
275
|
+
|
276
|
+
if (options.success) {
|
277
|
+
xhr_options.onSuccess = function() {
|
278
|
+
callback(options.success, this);
|
279
|
+
};
|
280
|
+
}
|
281
|
+
|
282
|
+
if (options.error) {
|
283
|
+
xhr_options.onFailure = function() {
|
284
|
+
callback(options.error, this);
|
285
|
+
};
|
286
|
+
}
|
287
|
+
|
288
|
+
if (options.complete) {
|
289
|
+
xhr_options.onComplete = function() {
|
290
|
+
callback(options.complete, this);
|
291
|
+
};
|
292
|
+
}
|
293
|
+
|
294
|
+
xhr_options.method = options.type;
|
295
|
+
|
296
|
+
if (options.headers) {
|
297
|
+
xhr_options.headers = options.headers;
|
298
|
+
}
|
299
|
+
if (options.jsonp) {
|
300
|
+
xhr_options.jsonp = options.jsonp;
|
301
|
+
}
|
302
|
+
if (options.url.indexOf('callback=?') > 0) {
|
303
|
+
xhr_options.jsonp = true;
|
304
|
+
options.url = options.url.replace(/(\?|\&)callback=\?/, '');
|
305
|
+
}
|
306
|
+
|
307
|
+
return new Xhr(options.url, xhr_options).send(options.data);
|
308
|
+
},
|
309
|
+
|
310
|
+
get: function() {
|
311
|
+
return make_ajax_call({type: 'get'}, arguments);
|
312
|
+
},
|
313
|
+
|
314
|
+
post: function(url, data, success, data_type) {
|
315
|
+
return make_ajax_call({type: 'post'}, arguments);
|
316
|
+
},
|
317
|
+
|
318
|
+
getJSON: function(url, data, success) {
|
319
|
+
return make_ajax_call({dataType: 'json'}, arguments);
|
320
|
+
},
|
321
|
+
|
322
|
+
getScript: function(url, success) {
|
323
|
+
return make_ajax_call({dataType: 'script'}, arguments);
|
324
|
+
}
|
325
|
+
|
326
|
+
});
|
327
|
+
|
328
|
+
function make_ajax_call(opts, args) {
|
329
|
+
return $.ajax($ext(ajax_options.apply(this, args), opts));
|
330
|
+
}
|
331
|
+
|
332
|
+
function ajax_options(url, data, success, data_type) {
|
333
|
+
if (typeof(data) === 'function') {
|
334
|
+
data_type = success;
|
335
|
+
success = data;
|
336
|
+
data = undefined;
|
337
|
+
}
|
338
|
+
|
339
|
+
return {
|
340
|
+
url: url,
|
341
|
+
data: data,
|
342
|
+
success: success,
|
343
|
+
dataType: data_type
|
344
|
+
};
|
345
|
+
}
|
346
|
+
|
347
|
+
Xhr.include({
|
348
|
+
success: function(callback) {
|
349
|
+
return this.on('success', callback);
|
350
|
+
},
|
351
|
+
|
352
|
+
error: function(callback) {
|
353
|
+
return this.on('failure', callback);
|
354
|
+
},
|
355
|
+
|
356
|
+
complete: function(callback) {
|
357
|
+
return this.on('complete', callback);
|
358
|
+
}
|
359
|
+
});
|
360
|
+
|
361
|
+
window.$ = window.jQuery = $;
|
362
|
+
})(RightJS);
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/**
|
2
|
-
* jQuery-like
|
2
|
+
* jQuery-like interfaces v2.2.0
|
3
3
|
* http://rightjs.org/plugins/jquerysh
|
4
4
|
*
|
5
|
-
* Copyright (C)
|
5
|
+
* Copyright (C) 2009-2011 Nikolay Nemshilov
|
6
6
|
*/
|
7
|
-
|
7
|
+
(function(a){function l(a,b,c,d){typeof b==="function"&&(d=c,c=b,b=undefined);return{url:a,data:b,success:c,dataType:d}}function k(a,b){return j.ajax(f(l.apply(this,b),a))}var b=a.$,c=a.$$,d=a.$E,e=a.$A,f=a.$ext,g=a.Xhr,h=a.Browser,i=a.Object;a.jQuerysh={version:"2.2.0",collectionMethods:{live:function(a,b){this.cssRule.on(a,b);return this},die:function(a,b){this.cssRule.stopObserving(a,b);return this}}};var j=function(e){switch(typeof e){case"string":var g=e[0],h=e.substr(1);if(g==="#"&&/^[\w\-]+$/.test(h))return b(h);if(g==="<")return d("div",{html:e}).first();g=c(e),g.cssRule=a(e);return f(g,a.jQuerysh.collectionMethods);case"function":return b(document).onReady(e);default:return b(e)}};f(j,{browser:{webkit:h.WebKit,opera:h.Opera,msie:h.IE,mozilla:h.Gecko},isFunction:function(b){return a.isFunction(b)},isArray:function(b){return a.isArray(b)},isPlainObject:function(b){return a.isHash(b)},isEmptyObject:function(a){return i.empty(a)},globalEval:function(b){return a.$eval(b)},makeArray:function(a){return e(a)},each:function(a,b){return e(a,function(a,c){b(c,a)})},map:function(a){return e(value).map(a)},unique:function(a){return e(a).uniq()},merge:function(a,b){return e(a).merge(b)},extend:function(){return i.merge.apply(i,arguments)},proxy:function(b,c){return a(b).bind(c)},noop:function(){return a(function(){})}}),a.Element.include({appendTo:function(a){return this.insertTo(a)},prepend:function(a){return this.insert(a,"top")},before:function(a){return this.insert(a,"before")},after:function(a){return this.insert(a,"after")},insertBefore:function(a){return this.insertTo(a,"before")},attr:function(a,b){return b===undefined?this.get(a):this.set(a,b)},css:function(a,b){return typeof a==="string"&&b===undefined?this.getStyle(a):this.setStyle(a,b)},offset:function(){var a=this.position();return{left:a.x,top:a.y}},width:function(){return this.size().x},height:function(){return this.size().y},scrollLeft:function(){return this.scrolls().x},scrollTop:function(){return this.scrolls().y},bind:function(){return this.on.apply(this,arguments)},unbind:function(){return this.stopObserving.apply(this,arguments)},trigger:function(a,b){return this.fire(a,b)},animate:function(a,b,c){return this.morph(a,{duration:b,onFinish:c})},fadeIn:function(){return this.fade("in")},fadeOut:function(){return this.fade("out")},slideIn:function(){return this.slide("in")},slideOut:function(){return this.slide("out")}}),f(j,{param:function(a){return i.toQueryString(a)},ajax:function(a,b){function d(a,c){a(b.dataType==="json"?c.json:c.text,c.successful()?"success":"error",c)}b=b||{},typeof a==="string"?b.url=a:b=a;var c={};b.success&&(c.onSuccess=function(){d(b.success,this)}),b.error&&(c.onFailure=function(){d(b.error,this)}),b.complete&&(c.onComplete=function(){d(b.complete,this)}),c.method=b.type,b.headers&&(c.headers=b.headers),b.jsonp&&(c.jsonp=b.jsonp),b.url.indexOf("callback=?")>0&&(c.jsonp=!0,b.url=b.url.replace(/(\?|\&)callback=\?/,""));return(new g(b.url,c)).send(b.data)},get:function(){return k({type:"get"},arguments)},post:function(a,b,c,d){return k({type:"post"},arguments)},getJSON:function(a,b,c){return k({dataType:"json"},arguments)},getScript:function(a,b){return k({dataType:"script"},arguments)}}),g.include({success:function(a){return this.on("success",a)},error:function(a){return this.on("failure",a)},complete:function(a){return this.on("complete",a)}}),window.$=window.jQuery=j})(RightJS)
|
@@ -1,37 +1,41 @@
|
|
1
1
|
/**
|
2
|
-
*
|
3
|
-
*
|
2
|
+
* JSON support module v2.2.1
|
3
|
+
* http://rightjs.org/plugins/json
|
4
4
|
*
|
5
|
-
* Copyright (C) 2009-
|
5
|
+
* Copyright (C) 2009-2011 Nikolay Nemshilov
|
6
6
|
*/
|
7
7
|
var JSON = function(RightJS, window) {
|
8
8
|
|
9
9
|
/**
|
10
|
+
* Initialization script
|
11
|
+
*
|
12
|
+
* Copyright (C) 2010-2011 Nikolay Nemshilov
|
13
|
+
*/
|
14
|
+
RightJS.JSON = window.JSON || {};
|
15
|
+
|
16
|
+
RightJS.JSON.version = '2.2.1';
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
/**
|
10
21
|
* The generic JSON interface
|
11
22
|
*
|
12
23
|
* Credits:
|
13
24
|
* Based on the original JSON escaping implementation
|
14
25
|
* http://www.json.org/json2.js
|
15
26
|
*
|
16
|
-
* @copyright (C) 2009-
|
17
|
-
*/
|
18
|
-
|
19
|
-
/**
|
20
|
-
* Initialization script
|
21
|
-
*
|
22
|
-
* Copyright (C) 2010 Nikolay Nemshilov
|
27
|
+
* @copyright (C) 2009-2011 Nikolay V. Nemshilov
|
23
28
|
*/
|
24
|
-
|
25
29
|
var
|
26
30
|
|
27
|
-
JSON =
|
31
|
+
JSON = RightJS.JSON,
|
28
32
|
|
29
33
|
// see the original JSON decoder implementation for descriptions http://www.json.org/json2.js
|
30
34
|
cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
|
31
35
|
specials = {'\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"' : '\\"', '\\': '\\\\'},
|
32
36
|
quotables = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
|
33
|
-
|
34
|
-
|
37
|
+
|
38
|
+
|
35
39
|
// quotes the string
|
36
40
|
function quote(string) {
|
37
41
|
return string.replace(quotables, function(chr) {
|
@@ -101,7 +105,7 @@ if (!('parse' in JSON)) {
|
|
101
105
|
if (/^[\],:{}\s]*$/.test(string.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
|
102
106
|
.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
|
103
107
|
.replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
|
104
|
-
return
|
108
|
+
return new Function('return '+string)();
|
105
109
|
}
|
106
110
|
}
|
107
111
|
|
@@ -126,35 +130,18 @@ RightJS.$alias(JSON, {
|
|
126
130
|
if (RightJS.Cookie) {
|
127
131
|
var old_set = RightJS.Cookie.prototype.set,
|
128
132
|
old_get = RightJS.Cookie.prototype.get;
|
129
|
-
|
133
|
+
|
130
134
|
RightJS.Cookie.include({
|
131
135
|
set: function(value) {
|
132
136
|
return old_set.call(this, JSON.stringify(value));
|
133
137
|
},
|
134
|
-
|
138
|
+
|
135
139
|
get: function() {
|
136
|
-
return JSON.parse(old_get.call(this));
|
140
|
+
return JSON.parse(old_get.call(this) || 'null');
|
137
141
|
}
|
138
142
|
});
|
139
143
|
}
|
140
144
|
|
141
|
-
|
142
|
-
/**
|
143
|
-
* Better JSON sanitizing for the Xhr requests
|
144
|
-
*
|
145
|
-
* Copyright (C) 2009-2010 Nikolay Nemshilov
|
146
|
-
*/
|
147
|
-
if (RightJS.Xhr) {
|
148
|
-
RightJS.Xhr.prototype.sanitizedJSON = function() {
|
149
|
-
try {
|
150
|
-
return JSON.decode(this.text);
|
151
|
-
} catch(e) {
|
152
|
-
if (this.secureJSON) { throw e; }
|
153
|
-
return null;
|
154
|
-
}
|
155
|
-
};
|
156
|
-
}
|
157
|
-
|
158
145
|
|
159
146
|
return JSON;
|
160
147
|
}(RightJS, window);
|
@@ -1,10 +1,7 @@
|
|
1
1
|
/**
|
2
|
-
*
|
3
|
-
*
|
2
|
+
* JSON support module v2.2.1
|
3
|
+
* http://rightjs.org/plugins/json
|
4
4
|
*
|
5
|
-
* Copyright (C) 2009-
|
5
|
+
* Copyright (C) 2009-2011 Nikolay Nemshilov
|
6
6
|
*/
|
7
|
-
var JSON=function(
|
8
|
-
if(!("stringify"in b))b.stringify=function(a){if(a===null)return"null";else if(a.toJSON)return a.toJSON();else switch(typeof a){case "boolean":return String(a);case "number":return String(a+0);case "string":return'"'+h(a)+'"';case "object":if(a instanceof Array)return"["+a.map(b.stringify).join(",")+"]";else if(a instanceof Date)return'"'+a.getUTCFullYear()+"-"+e(a.getUTCMonth()+1)+"-"+e(a.getUTCDate())+"T"+e(a.getUTCHours())+":"+e(a.getUTCMinutes())+":"+e(a.getUTCSeconds())+"."+e(a.getMilliseconds())+
|
9
|
-
'Z"';else{var d=[];for(var f in a)d.push(b.encode(f)+":"+b.encode(a[f]));return"{"+d.join(",")+"}"}}};if(!("parse"in b))b.parse=function(a){if(isString(a)&&a){a=a.replace(k,function(d){return"\\u"+("0000"+d.charCodeAt(0).toString(16)).slice(-4)});if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return eval("("+a+")")}throw"JSON parse error: "+a;};c.$alias(b,
|
10
|
-
{encode:"stringify",decode:"parse"});if(c.Cookie){var l=c.Cookie.prototype.set,m=c.Cookie.prototype.get;c.Cookie.include({set:function(a){return l.call(this,b.stringify(a))},get:function(){return b.parse(m.call(this))}})}if(c.Xhr)c.Xhr.prototype.sanitizedJSON=function(){try{return b.decode(this.text)}catch(a){if(this.secureJSON)throw a;return null}};return b}(RightJS,window);
|
7
|
+
var JSON=function(a,b){function h(a){return(a<10?"0":"")+a}function g(a){return a.replace(f,function(a){return e[a]||"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}a.JSON=b.JSON||{},a.JSON.version="2.2.1";var c=a.JSON,d=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,e={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},f=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;"stringify"in c||(c.stringify=function(a){if(a===null)return"null";if(a.toJSON)return a.toJSON();switch(typeof a){case"boolean":return String(a);case"number":return String(a+0);case"string":return'"'+g(a)+'"';case"object":if(a instanceof Array)return"["+a.map(c.stringify).join(",")+"]";if(a instanceof Date)return'"'+a.getUTCFullYear()+"-"+h(a.getUTCMonth()+1)+"-"+h(a.getUTCDate())+"T"+h(a.getUTCHours())+":"+h(a.getUTCMinutes())+":"+h(a.getUTCSeconds())+"."+h(a.getMilliseconds())+'Z"';var b=[];for(var d in a)b.push(c.encode(d)+":"+c.encode(a[d]));return"{"+b.join(",")+"}"}}),"parse"in c||(c.parse=function(a){if(isString(a)&&a){a=a.replace(d,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)});if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return(new Function("return "+a))()}throw"JSON parse error: "+a}),a.$alias(c,{encode:"stringify",decode:"parse"});if(a.Cookie){var i=a.Cookie.prototype.set,j=a.Cookie.prototype.get;a.Cookie.include({set:function(a){return i.call(this,c.stringify(a))},get:function(){return c.parse(j.call(this)||"null")}})}return c}(RightJS,window)
|
@@ -0,0 +1,87 @@
|
|
1
|
+
/**
|
2
|
+
* Pretty Keyboard Events v2.2.1
|
3
|
+
* http://rightjs.org/plugins/keys
|
4
|
+
*
|
5
|
+
* Copyright (C) 2009-2011 Nikolay Nemshilov
|
6
|
+
*/
|
7
|
+
(function(RightJS) {
|
8
|
+
/**
|
9
|
+
* The keys plugin initialization
|
10
|
+
*
|
11
|
+
* Copyright (C) 2010-2011 Nikolay Nemshilov
|
12
|
+
*/
|
13
|
+
RightJS.Keys = {
|
14
|
+
version: '2.2.1'
|
15
|
+
};
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
/**
|
20
|
+
* The Event level keyboard keycodes and stuff
|
21
|
+
*
|
22
|
+
* Copyright (C) 2010 Nikolay Nemshilov
|
23
|
+
*/
|
24
|
+
RightJS.Event.Keys = {
|
25
|
+
BACKSPACE: 8,
|
26
|
+
TAB: 9,
|
27
|
+
ENTER: 13,
|
28
|
+
ESC: 27,
|
29
|
+
SPACE: 32,
|
30
|
+
PAGEUP: 33,
|
31
|
+
PAGEDOWN: 34,
|
32
|
+
END: 35,
|
33
|
+
HOME: 36,
|
34
|
+
LEFT: 37,
|
35
|
+
UP: 38,
|
36
|
+
RIGHT: 39,
|
37
|
+
DOWN: 40,
|
38
|
+
INSERT: 45,
|
39
|
+
DELETE: 46
|
40
|
+
};
|
41
|
+
|
42
|
+
|
43
|
+
/**
|
44
|
+
* Overloading the Element#on method to handle those fancy names
|
45
|
+
*
|
46
|
+
* Copyright (C) 2010-2011 Nikolay Nemshilov
|
47
|
+
*/
|
48
|
+
[RightJS.Document, RightJS.Element, RightJS.Window].each('include', {
|
49
|
+
on: function() {
|
50
|
+
var args = RightJS.$A(arguments), name = args[0];
|
51
|
+
|
52
|
+
if (typeof(name) === 'string') {
|
53
|
+
var key = name.split(/[\+\-\_ ]+/);
|
54
|
+
key = (key[key.length - 1] || '').toUpperCase();
|
55
|
+
|
56
|
+
if (key in RightJS.Event.Keys || /^[A-Z0-9]$/.test(key)) {
|
57
|
+
var meta = /(^|\+|\-| )(meta|alt)(\+|\-| )/i.test(name),
|
58
|
+
ctrl = /(^|\+|\-| )(ctl|ctrl)(\+|\-| )/i.test(name),
|
59
|
+
shift = /(^|\+|\-| )(shift)(\+|\-| )/i.test(name),
|
60
|
+
code = RightJS.Event.Keys[key] || key.charCodeAt(0),
|
61
|
+
orig = args.slice(1),
|
62
|
+
method = orig.shift();
|
63
|
+
|
64
|
+
if (typeof(method) === 'string') {
|
65
|
+
method = this[method] || function() {};
|
66
|
+
}
|
67
|
+
|
68
|
+
// replacing the arguments
|
69
|
+
args = ['keydown', function(event) {
|
70
|
+
var raw = event._;
|
71
|
+
if (
|
72
|
+
(raw.keyCode === code) &&
|
73
|
+
(!meta || raw.metaKey || raw.altKey) &&
|
74
|
+
(!ctrl || raw.ctrlKey) &&
|
75
|
+
(!shift || raw.shiftKey)
|
76
|
+
) {
|
77
|
+
return method.call(this, [event].concat(orig));
|
78
|
+
}
|
79
|
+
}];
|
80
|
+
}
|
81
|
+
}
|
82
|
+
|
83
|
+
return this.$super.apply(this, args);
|
84
|
+
}
|
85
|
+
});
|
86
|
+
|
87
|
+
})(RightJS);
|
@@ -0,0 +1,7 @@
|
|
1
|
+
/**
|
2
|
+
* Pretty Keyboard Events v2.2.1
|
3
|
+
* http://rightjs.org/plugins/keys
|
4
|
+
*
|
5
|
+
* Copyright (C) 2009-2011 Nikolay Nemshilov
|
6
|
+
*/
|
7
|
+
(function(a){a.Keys={version:"2.2.1"},a.Event.Keys={BACKSPACE:8,TAB:9,ENTER:13,ESC:27,SPACE:32,PAGEUP:33,PAGEDOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,INSERT:45,DELETE:46},[a.Document,a.Element,a.Window].each("include",{on:function(){var b=a.$A(arguments),c=b[0];if(typeof c==="string"){var d=c.split(/[\+\-\_ ]+/);d=(d[d.length-1]||"").toUpperCase();if(d in a.Event.Keys||/^[A-Z0-9]$/.test(d)){var e=/(^|\+|\-| )(meta|alt)(\+|\-| )/i.test(c),f=/(^|\+|\-| )(ctl|ctrl)(\+|\-| )/i.test(c),g=/(^|\+|\-| )(shift)(\+|\-| )/i.test(c),h=a.Event.Keys[d]||d.charCodeAt(0),i=b.slice(1),j=i.shift();typeof j==="string"&&(j=this[j]||function(){}),b=["keydown",function(a){var b=a._;if(b.keyCode===h&&(!e||b.metaKey||b.altKey)&&(!f||b.ctrlKey)&&(!g||b.shiftKey))return j.call(this,[a].concat(i))}]}}return this.$super.apply(this,b)}})})(RightJS)
|