right-rails 1.2.2 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +7 -0
- data/README.rdoc +1 -1
- data/Rakefile +1 -1
- data/init.rb +1 -0
- data/lib/generators/right_rails/right_rails_generator.rb +15 -6
- data/lib/right_rails.rb +1 -1
- data/lib/right_rails/controller_extensions.rb +28 -15
- data/lib/right_rails/helpers/misc.rb +38 -38
- data/lib/right_rails/helpers/rails.rb +50 -7
- data/lib/rjs_renderer.rb +26 -0
- data/spec/lib/right_rails/controller_extensions_spec.rb +25 -14
- data/spec/lib/right_rails/helpers/forms_spec.rb +6 -6
- data/spec/lib/right_rails/helpers/rails_spec.rb +44 -45
- data/vendor/assets/images/rightjs-ui/rte.png +0 -0
- data/vendor/assets/javascripts/right-safe-src.js +2 -2
- data/vendor/assets/javascripts/right-safe.js +2 -2
- data/vendor/assets/javascripts/right-src.js +386 -100
- data/vendor/assets/javascripts/right.js +2 -2
- data/vendor/assets/javascripts/right/calendar-src.js +19 -3
- data/vendor/assets/javascripts/right/calendar.js +2 -2
- data/vendor/assets/javascripts/right/colorpicker-src.js +59 -20
- data/vendor/assets/javascripts/right/colorpicker.js +2 -2
- data/vendor/assets/javascripts/right/i18n/de.js +43 -42
- data/vendor/assets/javascripts/right/i18n/es.js +1 -0
- data/vendor/assets/javascripts/right/i18n/fi.js +1 -0
- data/vendor/assets/javascripts/right/i18n/fr.js +1 -0
- data/vendor/assets/javascripts/right/i18n/hu.js +1 -0
- data/vendor/assets/javascripts/right/i18n/it.js +1 -0
- data/vendor/assets/javascripts/right/i18n/jp.js +1 -0
- data/vendor/assets/javascripts/right/i18n/lt.js +96 -0
- data/vendor/assets/javascripts/right/i18n/nl.js +1 -0
- data/vendor/assets/javascripts/right/i18n/pt-br.js +1 -0
- data/vendor/assets/javascripts/right/i18n/ru.js +1 -0
- data/vendor/assets/javascripts/right/i18n/ua.js +1 -0
- data/vendor/assets/javascripts/right/jquerysh-src.js +4 -4
- data/vendor/assets/javascripts/right/jquerysh.js +2 -2
- data/vendor/assets/javascripts/right/rails-src.js +51 -15
- data/vendor/assets/javascripts/right/rails.js +2 -2
- data/vendor/assets/javascripts/right/resizable-src.js +11 -11
- data/vendor/assets/javascripts/right/rte-src.js +33 -13
- data/vendor/assets/javascripts/right/rte.js +2 -2
- data/vendor/assets/javascripts/right/slider-src.js +137 -28
- data/vendor/assets/javascripts/right/slider.js +2 -2
- metadata +24 -126
- data/generators/right_rails/right_rails_generator.rb +0 -46
- data/generators/right_rails/templates/iframed.html.erb +0 -10
- data/generators/right_scaffold/right_scaffold_generator.rb +0 -53
- data/generators/right_scaffold/templates/controller.rb +0 -99
- data/generators/right_scaffold/templates/helper.rb +0 -2
- data/generators/right_scaffold/templates/layout.html.erb +0 -18
- data/generators/right_scaffold/templates/style.css +0 -54
- data/generators/right_scaffold/templates/view__form.html.erb +0 -16
- data/generators/right_scaffold/templates/view__item.html.erb +0 -13
- data/generators/right_scaffold/templates/view_edit.html.erb +0 -6
- data/generators/right_scaffold/templates/view_index.html.erb +0 -9
- data/generators/right_scaffold/templates/view_new.html.erb +0 -5
- data/generators/right_scaffold/templates/view_show.html.erb +0 -10
- data/lib/generators/right_rails/templates/iframed.html.erb +0 -10
- data/public/images/rightjs-ui/colorpicker.png +0 -0
- data/public/images/rightjs-ui/resizable.png +0 -0
- data/public/images/rightjs-ui/rte.png +0 -0
- data/public/javascripts/right-olds-src.js +0 -652
- data/public/javascripts/right-olds.js +0 -9
- data/public/javascripts/right-safe-src.js +0 -68
- data/public/javascripts/right-safe.js +0 -7
- data/public/javascripts/right-src.js +0 -6014
- data/public/javascripts/right.js +0 -7
- data/public/javascripts/right/autocompleter-src.js +0 -625
- data/public/javascripts/right/autocompleter.js +0 -7
- data/public/javascripts/right/billboard-src.js +0 -564
- data/public/javascripts/right/billboard.js +0 -7
- data/public/javascripts/right/calendar-src.js +0 -1464
- data/public/javascripts/right/calendar.js +0 -7
- data/public/javascripts/right/casting-src.js +0 -183
- data/public/javascripts/right/casting.js +0 -7
- data/public/javascripts/right/colorpicker-src.js +0 -981
- data/public/javascripts/right/colorpicker.js +0 -7
- data/public/javascripts/right/dialog-src.js +0 -768
- data/public/javascripts/right/dialog.js +0 -7
- data/public/javascripts/right/dnd-src.js +0 -591
- data/public/javascripts/right/dnd.js +0 -7
- data/public/javascripts/right/effects-src.js +0 -508
- data/public/javascripts/right/effects.js +0 -7
- data/public/javascripts/right/i18n/de.js +0 -95
- data/public/javascripts/right/i18n/en-us.js +0 -11
- data/public/javascripts/right/i18n/es.js +0 -95
- data/public/javascripts/right/i18n/fi.js +0 -96
- data/public/javascripts/right/i18n/fr.js +0 -95
- data/public/javascripts/right/i18n/hu.js +0 -100
- data/public/javascripts/right/i18n/it.js +0 -95
- data/public/javascripts/right/i18n/jp.js +0 -99
- data/public/javascripts/right/i18n/nl.js +0 -95
- data/public/javascripts/right/i18n/pt-br.js +0 -95
- data/public/javascripts/right/i18n/ru.js +0 -95
- data/public/javascripts/right/i18n/ua.js +0 -99
- data/public/javascripts/right/in-edit-src.js +0 -373
- data/public/javascripts/right/in-edit.js +0 -7
- data/public/javascripts/right/jquerysh-src.js +0 -362
- data/public/javascripts/right/jquerysh.js +0 -7
- data/public/javascripts/right/json-src.js +0 -147
- data/public/javascripts/right/json.js +0 -7
- data/public/javascripts/right/keys-src.js +0 -87
- data/public/javascripts/right/keys.js +0 -7
- data/public/javascripts/right/lightbox-src.js +0 -931
- data/public/javascripts/right/lightbox.js +0 -7
- data/public/javascripts/right/rails-src.js +0 -402
- data/public/javascripts/right/rails.js +0 -7
- data/public/javascripts/right/rater-src.js +0 -384
- data/public/javascripts/right/rater.js +0 -7
- data/public/javascripts/right/resizable-src.js +0 -465
- data/public/javascripts/right/resizable.js +0 -7
- data/public/javascripts/right/rte-src.js +0 -2685
- data/public/javascripts/right/rte.js +0 -7
- data/public/javascripts/right/selectable-src.js +0 -725
- data/public/javascripts/right/selectable.js +0 -7
- data/public/javascripts/right/sizzle-src.js +0 -1132
- data/public/javascripts/right/sizzle.js +0 -7
- data/public/javascripts/right/slider-src.js +0 -395
- data/public/javascripts/right/slider.js +0 -7
- data/public/javascripts/right/sortable-src.js +0 -430
- data/public/javascripts/right/sortable.js +0 -7
- data/public/javascripts/right/table-src.js +0 -176
- data/public/javascripts/right/table.js +0 -7
- data/public/javascripts/right/tabs-src.js +0 -1157
- data/public/javascripts/right/tabs.js +0 -7
- data/public/javascripts/right/tags-src.js +0 -745
- data/public/javascripts/right/tags.js +0 -7
- data/public/javascripts/right/tooltips-src.js +0 -331
- data/public/javascripts/right/tooltips.js +0 -7
- data/public/javascripts/right/uploader-src.js +0 -302
- data/public/javascripts/right/uploader.js +0 -7
@@ -1,7 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* RightJS-UI InEdit v2.2.0
|
3
|
-
* http://rightjs.org/ui/in-edit
|
4
|
-
*
|
5
|
-
* Copyright (C) 2009-2011 Nikolay Nemshilov
|
6
|
-
*/
|
7
|
-
var InEdit=RightJS.InEdit=function(a,b){function c(a,c){c||(c=a,a="DIV");var d=new b.Class(b.Element.Wrappers[a]||b.Element,{initialize:function(c,d){this.key=c;var e=[{"class":"rui-"+c}];this instanceof b.Input||this instanceof b.Form||e.unshift(a),this.$super.apply(this,e),b.isString(d)&&(d=b.$(d)),d instanceof b.Element&&(this._=d._,"$listeners"in d&&(d.$listeners=d.$listeners),d={}),this.setOptions(d,this);return b.Wrapper.Cache[b.$uid(this._)]=this},setOptions:function(a,c){c&&(a=b.Object.merge(a,(new Function("return "+(c.get("data-"+this.key)||"{}")))())),a&&b.Options.setOptions.call(this,b.Object.merge(this.options,a));return this}}),e=new b.Class(d,c);b.Observer.createShortcuts(e.prototype,e.EVENTS||b([]));return e}var d=new b.Class(b.Element,{initialize:function(a){this.$super("div",{"class":"rui-spinner"}),this.dots=[];for(var c=0;c<(a||4);c++)this.dots.push(new b.Element("div"));this.dots[0].addClass("glowing"),this.insert(this.dots),b(this.shift).bind(this).periodical(300)},shift:function(){if(this.visible()){var a=this.dots.pop();this.dots.unshift(a),this.insert(a,"top")}}}),e=b,f=b.$,g=b.$w,h=b.Xhr,i=b.Object,j=b.Element,k=b.Input,l=new c("FORM",{extend:{version:"2.2.0",EVENTS:g("show hide send update"),Options:{url:null,name:"text",method:"put",type:"text",toggle:null,update:!0,Xhr:{}},i18n:{Save:"Save",Cancel:"Cancel"},current:null},initialize:function(a,b){this.element=f(a),this.$super("in-edit",b).set("action",this.options.url).insert([this.field=new k({type:this.options.type,name:this.options.name,"class":"field"}),this.spinner=new d(4),this.submit=new k({type:"submit","class":"submit",value:l.i18n.Save}),this.cancel=new j("a",{"class":"cancel",href:"#",html:l.i18n.Cancel})]).onClick(this.clicked).onSubmit(this.send)},show:function(){l.current!==this&&(l.current&&l.current.hide(),this.oldContent=this.element.html(),e(["file","password"]).include(this.options.type)||this.field.setValue(this.oldContent),this.element.update(this),this.spinner.hide(),this.submit.show(),this.options.toggle&&f(this.options.toggle).hide()),this.options.type!=="file"&&this.field.focus(),l.current=this;return this.fire("show")},hide:function(){this.element._.innerHTML=this.oldContent,this.xhr&&this.xhr.cancel();return this.finish()},send:function(a){a&&a.stop(),this.spinner.show().resize(this.submit.size()),this.submit.hide(),this.xhr=(new h(this.options.url,i.merge(this.options.Xhr,{method:this.options.method,spinner:this.spinner,onComplete:e(this.receive).bind(this)}))).send(this);return this.fire("send")},finish:function(){this.options.toggle&&f(this.options.toggle).show(),l.current=null;return this.fire("hide")},receive:function(){this.options.update&&(this.element.update(this.xhr.text),this.fire("update")),this.xhr=null,this.finish()},clicked:function(a){a.target===this.cancel&&(a.stop(),this.hide())}});f(a).onKeydown(function(a){a.keyCode===27&&l.current&&l.current.hide()}),j.include({inEdit:function(a){return(new l(this,a)).show()}});var m=a.createElement("style"),n=a.createTextNode("div.rui-spinner,div.rui-spinner div{margin:0;padding:0;border:none;background:none;list-style:none;font-weight:normal;float:none;display:inline-block; *display:inline; *zoom:1;border-radius:.12em;-moz-border-radius:.12em;-webkit-border-radius:.12em}div.rui-spinner{text-align:center;white-space:nowrap;background:#EEE;border:1px solid #DDD;height:1.2em;padding:0 .2em}div.rui-spinner div{width:.4em;height:70%;background:#BBB;margin-left:1px}div.rui-spinner div:first-child{margin-left:0}div.rui-spinner div.glowing{background:#777}form.rui-in-edit,form.rui-in-edit .cancel{margin:0;padding:0;float:none;position:static}form.rui-in-edit{display:inline-block; *display:inline; *zoom:1;border:none;background:none}form.rui-in-edit div.rui-spinner{margin-right:.2em}form.rui-in-edit div.rui-spinner div{margin-top:.2em}form.rui-in-edit textarea.field{width:100%;margin-bottom:.5em}form.rui-in-edit .field,form.rui-in-edit .submit{margin-right:.2em}form.rui-in-edit,form.rui-in-edit .field,form.rui-in-edit .submit,form.rui-in-edit div.rui-spinner,form.rui-in-edit .cancel{vertical-align:middle}");m.type="text/css",a.getElementsByTagName("head")[0].appendChild(m),m.styleSheet?m.styleSheet.cssText=n.nodeValue:m.appendChild(n);return l}(document,RightJS)
|
@@ -1,362 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* jQuery-like interfaces v2.2.0
|
3
|
-
* http://rightjs.org/plugins/jquerysh
|
4
|
-
*
|
5
|
-
* Copyright (C) 2009-2011 Nikolay Nemshilov
|
6
|
-
*/
|
7
|
-
(function(RightJS) {
|
8
|
-
/**
|
9
|
-
* jquerysh initialization script
|
10
|
-
*
|
11
|
-
* Copyright (C) 2010-2011 Nikolay Nemshilov
|
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
|
-
|
24
|
-
|
25
|
-
/**
|
26
|
-
* The plugin's definition
|
27
|
-
*
|
28
|
-
* Copyright (C) 2011 Nikolay Nemshilov
|
29
|
-
*/
|
30
|
-
RightJS.jQuerysh = {
|
31
|
-
version: '2.2.0',
|
32
|
-
|
33
|
-
// collection methods
|
34
|
-
collectionMethods: {
|
35
|
-
live: function(event, callback) {
|
36
|
-
this.cssRule.on(event, callback);
|
37
|
-
return this;
|
38
|
-
},
|
39
|
-
|
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) {
|
53
|
-
switch(typeof something) {
|
54
|
-
case 'string':
|
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
|
-
|
67
|
-
case 'function':
|
68
|
-
return rjs_$(document).onReady(something);
|
69
|
-
|
70
|
-
default:
|
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() {});
|
148
|
-
}
|
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 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* jQuery-like interfaces v2.2.0
|
3
|
-
* http://rightjs.org/plugins/jquerysh
|
4
|
-
*
|
5
|
-
* Copyright (C) 2009-2011 Nikolay Nemshilov
|
6
|
-
*/
|
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,147 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* JSON support module v2.2.1
|
3
|
-
* http://rightjs.org/plugins/json
|
4
|
-
*
|
5
|
-
* Copyright (C) 2009-2011 Nikolay Nemshilov
|
6
|
-
*/
|
7
|
-
var JSON = function(RightJS, window) {
|
8
|
-
|
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
|
-
/**
|
21
|
-
* The generic JSON interface
|
22
|
-
*
|
23
|
-
* Credits:
|
24
|
-
* Based on the original JSON escaping implementation
|
25
|
-
* http://www.json.org/json2.js
|
26
|
-
*
|
27
|
-
* @copyright (C) 2009-2011 Nikolay V. Nemshilov
|
28
|
-
*/
|
29
|
-
var
|
30
|
-
|
31
|
-
JSON = RightJS.JSON,
|
32
|
-
|
33
|
-
// see the original JSON decoder implementation for descriptions http://www.json.org/json2.js
|
34
|
-
cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
|
35
|
-
specials = {'\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"' : '\\"', '\\': '\\\\'},
|
36
|
-
quotables = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
|
37
|
-
|
38
|
-
|
39
|
-
// quotes the string
|
40
|
-
function quote(string) {
|
41
|
-
return string.replace(quotables, function(chr) {
|
42
|
-
return specials[chr] || '\\u' + ('0000' + chr.charCodeAt(0).toString(16)).slice(-4);
|
43
|
-
});
|
44
|
-
}
|
45
|
-
|
46
|
-
// adds the leading zero symbol
|
47
|
-
function zerofy(num) {
|
48
|
-
return (num < 10 ? '0' : '')+num;
|
49
|
-
}
|
50
|
-
|
51
|
-
/**
|
52
|
-
* Checking if there is the JSON to String method
|
53
|
-
*/
|
54
|
-
if (!('stringify' in JSON)) {
|
55
|
-
JSON.stringify = function(value) {
|
56
|
-
if (value === null) {
|
57
|
-
return 'null';
|
58
|
-
} else if (value.toJSON) {
|
59
|
-
return value.toJSON();
|
60
|
-
} else {
|
61
|
-
|
62
|
-
switch(typeof(value)) {
|
63
|
-
case 'boolean': return String(value);
|
64
|
-
case 'number': return String(value+0);
|
65
|
-
case 'string': return '"'+ quote(value) + '"';
|
66
|
-
case 'object':
|
67
|
-
|
68
|
-
if (value instanceof Array) {
|
69
|
-
return '['+value.map(JSON.stringify).join(',')+']';
|
70
|
-
|
71
|
-
} else if (value instanceof Date) {
|
72
|
-
return '"' + value.getUTCFullYear() + '-' +
|
73
|
-
zerofy(value.getUTCMonth() + 1) + '-' +
|
74
|
-
zerofy(value.getUTCDate()) + 'T' +
|
75
|
-
zerofy(value.getUTCHours()) + ':' +
|
76
|
-
zerofy(value.getUTCMinutes()) + ':' +
|
77
|
-
zerofy(value.getUTCSeconds()) + '.' +
|
78
|
-
zerofy(value.getMilliseconds()) + 'Z' +
|
79
|
-
'"';
|
80
|
-
|
81
|
-
} else {
|
82
|
-
var result = [];
|
83
|
-
for (var key in value) {
|
84
|
-
result.push(JSON.encode(key)+":"+JSON.encode(value[key]));
|
85
|
-
}
|
86
|
-
return '{'+result.join(',')+'}';
|
87
|
-
}
|
88
|
-
}
|
89
|
-
}
|
90
|
-
};
|
91
|
-
}
|
92
|
-
|
93
|
-
/**
|
94
|
-
* Checking if there is the string to JSON method
|
95
|
-
*/
|
96
|
-
if (!('parse' in JSON)) {
|
97
|
-
JSON.parse = function(string) {
|
98
|
-
if (isString(string) && string) {
|
99
|
-
// getting back the UTF-8 symbols
|
100
|
-
string = string.replace(cx, function (a) {
|
101
|
-
return '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
|
102
|
-
});
|
103
|
-
|
104
|
-
// checking the JSON string consistency
|
105
|
-
if (/^[\],:{}\s]*$/.test(string.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
|
106
|
-
.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
|
107
|
-
.replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
|
108
|
-
return new Function('return '+string)();
|
109
|
-
}
|
110
|
-
}
|
111
|
-
|
112
|
-
throw "JSON parse error: "+string;
|
113
|
-
};
|
114
|
-
}
|
115
|
-
|
116
|
-
RightJS.$alias(JSON, {
|
117
|
-
encode: 'stringify',
|
118
|
-
decode: 'parse'
|
119
|
-
});
|
120
|
-
|
121
|
-
|
122
|
-
/**
|
123
|
-
* Wraps up the Cooke set/get methods so that the values
|
124
|
-
* were automatically exported/imported into JSON strings
|
125
|
-
* and it allowed transparent objects and arrays saving
|
126
|
-
*
|
127
|
-
* @copyright (C) 2009-2010 Nikolay V. Nemshilov
|
128
|
-
*/
|
129
|
-
|
130
|
-
if (RightJS.Cookie) {
|
131
|
-
var old_set = RightJS.Cookie.prototype.set,
|
132
|
-
old_get = RightJS.Cookie.prototype.get;
|
133
|
-
|
134
|
-
RightJS.Cookie.include({
|
135
|
-
set: function(value) {
|
136
|
-
return old_set.call(this, JSON.stringify(value));
|
137
|
-
},
|
138
|
-
|
139
|
-
get: function() {
|
140
|
-
return JSON.parse(old_get.call(this) || 'null');
|
141
|
-
}
|
142
|
-
});
|
143
|
-
}
|
144
|
-
|
145
|
-
|
146
|
-
return JSON;
|
147
|
-
}(RightJS, window);
|