right-rails 1.0.3 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +8 -2
- data/Rakefile +28 -28
- data/lib/right_rails/java_script_generator.rb +59 -51
- data/public/images/{colorpicker.png → rightjs-ui/colorpicker.png} +0 -0
- data/public/images/{resizable.png → rightjs-ui/resizable.png} +0 -0
- data/public/javascripts/right-olds-src.js +47 -46
- data/public/javascripts/right-safe-src.js +103 -102
- data/public/javascripts/right-safe.js +1 -1
- data/public/javascripts/right-src.js +611 -541
- data/public/javascripts/right.js +86 -85
- data/public/javascripts/right/autocompleter-src.js +81 -77
- data/public/javascripts/right/autocompleter.js +1 -1
- data/public/javascripts/right/calendar-src.js +209 -197
- data/public/javascripts/right/calendar.js +6 -6
- data/public/javascripts/right/colorpicker-src.js +127 -117
- data/public/javascripts/right/colorpicker.js +6 -6
- data/public/javascripts/right/dnd-src.js +63 -63
- data/public/javascripts/right/dnd.js +2 -2
- data/public/javascripts/right/in-edit-src.js +53 -48
- data/public/javascripts/right/in-edit.js +2 -2
- data/public/javascripts/right/lightbox-src.js +107 -99
- data/public/javascripts/right/lightbox.js +2 -2
- data/public/javascripts/right/rater-src.js +48 -46
- data/public/javascripts/right/rater.js +3 -3
- data/public/javascripts/right/resizable-src.js +53 -61
- data/public/javascripts/right/resizable.js +4 -4
- data/public/javascripts/right/selectable-src.js +97 -95
- data/public/javascripts/right/selectable.js +2 -2
- data/public/javascripts/right/slider-src.js +47 -45
- data/public/javascripts/right/slider.js +8 -8
- data/public/javascripts/right/sortable-src.js +54 -52
- data/public/javascripts/right/tabs-src.js +181 -171
- data/public/javascripts/right/tooltip-src.js +39 -37
- data/public/javascripts/right/uploader-src.js +21 -19
- data/spec/lib/right_rails/java_script_generator_spec.rb +61 -56
- metadata +9 -7
@@ -8,6 +8,6 @@ var InEdit=RightJS.InEdit=function(i,a){var g=a.$,m=a.$w,n=a.Xhr,o=a.Object,j=a.
|
|
8
8
|
"DIV"}var f=new a.Wrapper(a.Element.Wrappers[b]||a.Element,{initialize:function(h,c){this.key=h;var l=[{"class":"rui-"+h}];this instanceof a.Input||this instanceof a.Form||l.unshift(b);this.$super.apply(this,l);if(a.isString(c))c=a.$(c);if(c instanceof a.Element){this._=c._;if("$listeners"in c)c.$listeners=c.$listeners;c={}}this.setOptions(c,this);return this},setOptions:function(h,c){c=c||this;a.Options.setOptions.call(this,a.Object.merge(h,eval("("+(c.get("data-"+this.key)||"{}")+")")));return this}});
|
9
9
|
f=new a.Wrapper(f,e);a.Observer.createShortcuts(f.prototype,f.EVENTS||[]);return f})("FORM",{extend:{version:"2.0.0",EVENTS:m("show hide send update"),Options:{url:null,name:"text",method:"put",type:"text",toggle:null,update:true,Xhr:{}},i18n:{Save:"Save",Cancel:"Cancel"},current:null},initialize:function(b,e){this.element=g(b);this.$super("in-edit",e).set("action",this.options.url).insert([this.field=new k({type:this.options.type,name:this.options.name,"class":"field"}),this.spinner=new p(4),this.submit=
|
10
10
|
new k({type:"submit","class":"submit",value:d.i18n.Save}),this.cancel=new j("a",{"class":"cancel",href:"#",html:d.i18n.Cancel})]).onClick(this.clicked).onSubmit(this.send)},show:function(){if(d.current!==this){d.current&&d.current.hide();this.oldContent=this.element.html();a(["file","password"]).include(this.options.type)||this.field.setValue(this.oldContent);this.element.update(this);this.spinner.hide();this.submit.show();this.options.toggle&&g(this.options.toggle).hide()}this.options.type!=="file"&&
|
11
|
-
this.field.focus();d.current=this;return this.fire("show"
|
12
|
-
d.current=null;return this.fire("hide"
|
11
|
+
this.field.focus();d.current=this;return this.fire("show")},hide:function(){this.element._.innerHTML=this.oldContent;this.xhr&&this.xhr.cancel();return this.finish()},send:function(b){b&&b.stop();this.spinner.show().resize(this.submit.size());this.submit.hide();this.xhr=(new n(this.options.url,o.merge(this.options.Xhr,{method:this.options.method,spinner:this.spinner,onComplete:a(this.receive).bind(this)}))).send(this);return this.fire("send")},finish:function(){this.options.toggle&&g(this.options.toggle).show();
|
12
|
+
d.current=null;return this.fire("hide")},receive:function(){if(this.options.update){this.element.update(this.xhr.text);this.fire("update")}this.xhr=null;this.finish()},clicked:function(b){if(b.target===this.cancel){b.stop();this.hide()}}});g(i).onKeydown(function(b){b.keyCode===27&&d.current&&d.current.hide()});j.include({inEdit:function(b){return(new d(this,b)).show()}});i.write('<style type="text/css">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}</style>');
|
13
13
|
return d}(document,RightJS);
|
@@ -40,19 +40,20 @@ Browser.IE6 = Browser.OLD && navigator.userAgent.indexOf("MSIE 6") > 0;
|
|
40
40
|
|
41
41
|
|
42
42
|
|
43
|
+
|
43
44
|
/**
|
44
45
|
* The widget units constructor
|
45
46
|
*
|
46
47
|
* @param String tag-name or Object methods
|
47
48
|
* @param Object methods
|
48
49
|
* @return Widget wrapper
|
49
|
-
*/
|
50
|
+
*/
|
50
51
|
function Widget(tag_name, methods) {
|
51
52
|
if (!methods) {
|
52
53
|
methods = tag_name;
|
53
54
|
tag_name = 'DIV';
|
54
55
|
}
|
55
|
-
|
56
|
+
|
56
57
|
/**
|
57
58
|
* An Abstract Widget Unit
|
58
59
|
*
|
@@ -69,17 +70,17 @@ function Widget(tag_name, methods) {
|
|
69
70
|
initialize: function(key, options) {
|
70
71
|
this.key = key;
|
71
72
|
var args = [{'class': 'rui-' + key}];
|
72
|
-
|
73
|
+
|
73
74
|
// those two have different constructors
|
74
75
|
if (!(this instanceof RightJS.Input || this instanceof RightJS.Form)) {
|
75
76
|
args.unshift(tag_name);
|
76
77
|
}
|
77
78
|
this.$super.apply(this, args);
|
78
|
-
|
79
|
+
|
79
80
|
if (RightJS.isString(options)) {
|
80
81
|
options = RightJS.$(options);
|
81
82
|
}
|
82
|
-
|
83
|
+
|
83
84
|
// if the options is another element then
|
84
85
|
// try to dynamically rewrap it with our widget
|
85
86
|
if (options instanceof RightJS.Element) {
|
@@ -112,16 +113,16 @@ function Widget(tag_name, methods) {
|
|
112
113
|
return this;
|
113
114
|
}
|
114
115
|
});
|
115
|
-
|
116
|
+
|
116
117
|
/**
|
117
118
|
* Creating the actual widget class
|
118
119
|
*
|
119
120
|
*/
|
120
121
|
var Klass = new RightJS.Wrapper(AbstractWidget, methods);
|
121
|
-
|
122
|
+
|
122
123
|
// creating the widget related shortcuts
|
123
124
|
RightJS.Observer.createShortcuts(Klass.prototype, Klass.EVENTS || []);
|
124
|
-
|
125
|
+
|
125
126
|
return Klass;
|
126
127
|
}
|
127
128
|
|
@@ -139,18 +140,18 @@ var Spinner = new RightJS.Wrapper(RightJS.Element, {
|
|
139
140
|
* @return void
|
140
141
|
*/
|
141
142
|
initialize: function(size) {
|
142
|
-
this.$super('div', {'class': 'rui-spinner'});
|
143
|
+
this.$super('div', {'class': 'rui-spinner'});
|
143
144
|
this.dots = [];
|
144
|
-
|
145
|
+
|
145
146
|
for (var i=0; i < (size || 4); i++) {
|
146
147
|
this.dots.push(new RightJS.Element('div'));
|
147
148
|
}
|
148
|
-
|
149
|
+
|
149
150
|
this.dots[0].addClass('glowing');
|
150
151
|
this.insert(this.dots);
|
151
152
|
RightJS(this.shift).bind(this).periodical(300);
|
152
153
|
},
|
153
|
-
|
154
|
+
|
154
155
|
/**
|
155
156
|
* Shifts the spinner elements
|
156
157
|
*
|
@@ -165,44 +166,45 @@ var Spinner = new RightJS.Wrapper(RightJS.Element, {
|
|
165
166
|
}
|
166
167
|
});
|
167
168
|
|
169
|
+
|
168
170
|
/**
|
169
171
|
* The lightbox widget
|
170
172
|
*
|
171
173
|
* Copyright (C) 2009-2010 Nikolay Nemshilov
|
172
174
|
*/
|
173
175
|
var Lightbox = new Widget({
|
174
|
-
|
176
|
+
|
175
177
|
extend: {
|
176
178
|
version: '2.0.0',
|
177
|
-
|
179
|
+
|
178
180
|
EVENTS: $w('show hide load'),
|
179
|
-
|
181
|
+
|
180
182
|
Options: {
|
181
183
|
fxName: 'fade',
|
182
|
-
fxDuration:
|
183
|
-
|
184
|
+
fxDuration: 200,
|
185
|
+
|
184
186
|
group: null, // a group marker
|
185
|
-
|
187
|
+
|
186
188
|
hideOnEsc: true,
|
187
189
|
hideOnOutClick: true,
|
188
190
|
showCloseButton: true,
|
189
|
-
|
191
|
+
|
190
192
|
cssRule: "a[data-lightbox]", // all lightbox links css-rule
|
191
|
-
|
193
|
+
|
192
194
|
// video links default size
|
193
195
|
mediaWidth: 425,
|
194
196
|
mediaHeight: 350
|
195
197
|
},
|
196
|
-
|
198
|
+
|
197
199
|
i18n: {
|
198
200
|
Close: 'Close',
|
199
201
|
Prev: 'Previous Image',
|
200
202
|
Next: 'Next Image'
|
201
203
|
},
|
202
|
-
|
204
|
+
|
203
205
|
// the supported image-urls regexp
|
204
206
|
Images: /\.(jpg|jpeg|gif|png|bmp)/,
|
205
|
-
|
207
|
+
|
206
208
|
// media content sources
|
207
209
|
Medias: [
|
208
210
|
[/(http:\/\/.*?youtube\.[a-z]+)\/watch\?v=([^&]+)/, '$1/v/$2', 'swf'],
|
@@ -210,7 +212,7 @@ var Lightbox = new Widget({
|
|
210
212
|
[/(http:\/\/vimeo\.[a-z]+)\/([0-9]+).*?/, '$1/moogaloop.swf?clip_id=$2', 'swf']
|
211
213
|
]
|
212
214
|
},
|
213
|
-
|
215
|
+
|
214
216
|
/**
|
215
217
|
* basic constructor
|
216
218
|
*
|
@@ -232,7 +234,7 @@ var Lightbox = new Widget({
|
|
232
234
|
prev: this._prev
|
233
235
|
});
|
234
236
|
},
|
235
|
-
|
237
|
+
|
236
238
|
/**
|
237
239
|
* Extracting the rel="lightboux[groupname]" attributes
|
238
240
|
*
|
@@ -242,17 +244,17 @@ var Lightbox = new Widget({
|
|
242
244
|
*/
|
243
245
|
setOptions: function(options, context) {
|
244
246
|
this.$super(options, context);
|
245
|
-
|
247
|
+
|
246
248
|
if (context) {
|
247
249
|
var rel = context.get('rel');
|
248
250
|
if (rel && (rel = rel.match(/lightbox\[(.+?)\]/))) {
|
249
251
|
this.options.group = rel[1];
|
250
252
|
}
|
251
253
|
}
|
252
|
-
|
254
|
+
|
253
255
|
return this;
|
254
256
|
},
|
255
|
-
|
257
|
+
|
256
258
|
/**
|
257
259
|
* Sets the popup's title
|
258
260
|
*
|
@@ -261,10 +263,10 @@ var Lightbox = new Widget({
|
|
261
263
|
*/
|
262
264
|
setTitle: function(text) {
|
263
265
|
this.dialog.setTitle(text);
|
264
|
-
|
266
|
+
|
265
267
|
return this;
|
266
268
|
},
|
267
|
-
|
269
|
+
|
268
270
|
/**
|
269
271
|
* Shows the lightbox
|
270
272
|
*
|
@@ -276,7 +278,7 @@ var Lightbox = new Widget({
|
|
276
278
|
this.dialog.show(content, !content);
|
277
279
|
});
|
278
280
|
},
|
279
|
-
|
281
|
+
|
280
282
|
/**
|
281
283
|
* Hides the lightbox
|
282
284
|
*
|
@@ -284,7 +286,7 @@ var Lightbox = new Widget({
|
|
284
286
|
*/
|
285
287
|
hide: function() {
|
286
288
|
Lightbox.current = null;
|
287
|
-
|
289
|
+
|
288
290
|
return this.$super(this.options.fxName, {
|
289
291
|
duration: this.options.fxDuration/3,
|
290
292
|
onFinish: R(function() {
|
@@ -293,7 +295,7 @@ var Lightbox = new Widget({
|
|
293
295
|
}).bind(this)
|
294
296
|
});
|
295
297
|
},
|
296
|
-
|
298
|
+
|
297
299
|
/**
|
298
300
|
* Loads up the data from url or a link
|
299
301
|
*
|
@@ -306,7 +308,7 @@ var Lightbox = new Widget({
|
|
306
308
|
this.dialog.load(link, options);
|
307
309
|
});
|
308
310
|
},
|
309
|
-
|
311
|
+
|
310
312
|
/**
|
311
313
|
* Resizes the content block to the given size
|
312
314
|
*
|
@@ -317,7 +319,7 @@ var Lightbox = new Widget({
|
|
317
319
|
this.dialog.resize(size);
|
318
320
|
return this;
|
319
321
|
},
|
320
|
-
|
322
|
+
|
321
323
|
// protected
|
322
324
|
|
323
325
|
// handles the 'close' event
|
@@ -325,30 +327,30 @@ var Lightbox = new Widget({
|
|
325
327
|
event.stop();
|
326
328
|
this.hide();
|
327
329
|
},
|
328
|
-
|
330
|
+
|
329
331
|
// handles the 'prev' event
|
330
332
|
_prev: function(event) {
|
331
333
|
event.stop();
|
332
334
|
Pager.prev();
|
333
335
|
},
|
334
|
-
|
336
|
+
|
335
337
|
// handles the 'next' event
|
336
338
|
_next: function(event) {
|
337
339
|
event.stop();
|
338
340
|
Pager.next();
|
339
341
|
},
|
340
|
-
|
342
|
+
|
341
343
|
// shows the lightbox element and then calls back
|
342
344
|
_showAnd: function(callback) {
|
343
345
|
if (Lightbox.current !== this) {
|
344
346
|
Lightbox.current = this;
|
345
|
-
|
347
|
+
|
346
348
|
// hidding all the hanging around lightboxes
|
347
349
|
$$('div.rui-lightbox').each('remove');
|
348
|
-
|
350
|
+
|
349
351
|
this.insertTo(document.body);
|
350
352
|
this.dialog.show('', true);
|
351
|
-
|
353
|
+
|
352
354
|
if (Browser.OLD) { // IE's get screwed by the transparency tricks
|
353
355
|
this.reposition();
|
354
356
|
Element.prototype.show.call(this);
|
@@ -366,15 +368,15 @@ var Lightbox = new Widget({
|
|
366
368
|
} else {
|
367
369
|
callback.call(this);
|
368
370
|
}
|
369
|
-
|
371
|
+
|
370
372
|
return this;
|
371
373
|
},
|
372
|
-
|
374
|
+
|
373
375
|
// manually repositioning under IE6 browser
|
374
376
|
reposition: function() {
|
375
377
|
if (Browser.IE6) {
|
376
378
|
var win = $(window);
|
377
|
-
|
379
|
+
|
378
380
|
this.setStyle({
|
379
381
|
top: win.scrolls().y + 'px',
|
380
382
|
width: win.size().x + 'px',
|
@@ -397,11 +399,11 @@ Lightbox.extend({
|
|
397
399
|
Lightbox.current.hide();
|
398
400
|
}
|
399
401
|
},
|
400
|
-
|
402
|
+
|
401
403
|
show: function() {
|
402
404
|
return this.inst('show', arguments);
|
403
405
|
},
|
404
|
-
|
406
|
+
|
405
407
|
load: function() {
|
406
408
|
return this.inst('load', arguments);
|
407
409
|
},
|
@@ -414,6 +416,7 @@ Lightbox.extend({
|
|
414
416
|
}
|
415
417
|
});
|
416
418
|
|
419
|
+
|
417
420
|
/**
|
418
421
|
* Lightbox background locker element
|
419
422
|
*
|
@@ -422,13 +425,14 @@ Lightbox.extend({
|
|
422
425
|
var Locker = new Wrapper(Element, {
|
423
426
|
initialize: function(options) {
|
424
427
|
this.$super('div', {'class': 'rui-lightbox-locker'});
|
425
|
-
|
428
|
+
|
426
429
|
if (options.hideOnOutClick) {
|
427
430
|
this.onClick('fire', 'close');
|
428
431
|
}
|
429
432
|
}
|
430
433
|
});
|
431
434
|
|
435
|
+
|
432
436
|
/**
|
433
437
|
* The dialog element wrapper
|
434
438
|
*
|
@@ -443,14 +447,14 @@ var Dialog = new Wrapper(Element, {
|
|
443
447
|
*/
|
444
448
|
initialize: function(options) {
|
445
449
|
var i18n = Lightbox.i18n;
|
446
|
-
|
450
|
+
|
447
451
|
this.options = options;
|
448
452
|
this.$super('div', {'class': 'rui-lightbox-dialog'});
|
449
|
-
|
450
|
-
// building up the
|
453
|
+
|
454
|
+
// building up the
|
451
455
|
this.insert([
|
452
456
|
this.title = $E('div', {'class': 'rui-lightbox-title'}),
|
453
|
-
|
457
|
+
|
454
458
|
$E('div', {'class': 'rui-lightbox-body'}).insert(
|
455
459
|
$E('div', {'class': 'rui-lightbox-body-inner'}).insert([
|
456
460
|
this.locker = $E('div', {'class': 'rui-lightbox-body-locker'}).insert(new Spinner(4)),
|
@@ -459,23 +463,23 @@ var Dialog = new Wrapper(Element, {
|
|
459
463
|
)
|
460
464
|
])
|
461
465
|
),
|
462
|
-
|
466
|
+
|
463
467
|
$E('div', {'class': 'rui-lightbox-navigation'}).insert([
|
464
468
|
this.closeButton = $E('div', {'class': 'close', html: '×', title: i18n.Close}).onClick('fire', 'close'),
|
465
469
|
this.prevLink = $E('div', {'class': 'prev', html: '←', title: i18n.Prev}).onClick('fire', 'prev'),
|
466
470
|
this.nextLink = $E('div', {'class': 'next', html: '→', title: i18n.Next}).onClick('fire', 'next')
|
467
471
|
])
|
468
472
|
]);
|
469
|
-
|
473
|
+
|
470
474
|
// presetting the navigation state
|
471
475
|
this.prevLink.hide();
|
472
476
|
this.nextLink.hide();
|
473
|
-
|
477
|
+
|
474
478
|
if (!options.showCloseButton) {
|
475
479
|
this.closeButton.hide();
|
476
480
|
}
|
477
481
|
},
|
478
|
-
|
482
|
+
|
479
483
|
/**
|
480
484
|
* Sets the dialogue caption
|
481
485
|
*
|
@@ -485,7 +489,7 @@ var Dialog = new Wrapper(Element, {
|
|
485
489
|
setTitle: function(title) {
|
486
490
|
this.title.update(title||'');
|
487
491
|
},
|
488
|
-
|
492
|
+
|
489
493
|
/**
|
490
494
|
* Nicely resize the dialog box
|
491
495
|
*
|
@@ -498,11 +502,11 @@ var Dialog = new Wrapper(Element, {
|
|
498
502
|
cur_size = this.scroller.size(),
|
499
503
|
cur_top = (win_size.y - this.size().y)/2,
|
500
504
|
dlg_diff = this.size().x - cur_size.x; // <- use for IE6 fixes
|
501
|
-
|
505
|
+
|
502
506
|
if (end_size) {
|
503
507
|
// getting the actual end-size
|
504
508
|
end_size = this.scroller.setStyle(end_size).size();
|
505
|
-
|
509
|
+
|
506
510
|
this.scroller.setStyle({
|
507
511
|
width: cur_size.x + 'px',
|
508
512
|
height: cur_size.y + 'px'
|
@@ -511,46 +515,46 @@ var Dialog = new Wrapper(Element, {
|
|
511
515
|
// using the content block size
|
512
516
|
end_size = this.content.size();
|
513
517
|
}
|
514
|
-
|
518
|
+
|
515
519
|
// checking the constraints
|
516
520
|
var threshold = 100; // px
|
517
521
|
if ((end_size.x + threshold) > win_size.x) { end_size.x = win_size.x - threshold; }
|
518
522
|
if ((end_size.y + threshold) > win_size.y) { end_size.y = win_size.y - threshold; }
|
519
|
-
|
523
|
+
|
520
524
|
// the actual resize and reposition
|
521
525
|
var end_top = (cur_top * 2 + cur_size.y - end_size.y) / 2;
|
522
526
|
var dialog = this._.style, content = this.scroller._.style;
|
523
|
-
|
527
|
+
|
524
528
|
if (RightJS.Fx && with_fx && (end_size.x != cur_size.x || end_size.y != cur_size.y)) {
|
525
|
-
|
529
|
+
|
526
530
|
$ext(new RightJS.Fx(this, {duration: this.options.fxDuration, transition: 'Lin'}), {
|
527
531
|
render: function(delta) {
|
528
532
|
content.width = (cur_size.x + (end_size.x - cur_size.x) * delta) + 'px';
|
529
533
|
content.height = (cur_size.y + (end_size.y - cur_size.y) * delta) + 'px';
|
530
534
|
dialog.top = (cur_top + (end_top - cur_top) * delta) + 'px';
|
531
|
-
|
535
|
+
|
532
536
|
if (Browser.IE6) {
|
533
537
|
dialog.width = (dlg_diff + cur_size.y + (end_size.y - cur_size.y) * delta) + 'px';
|
534
538
|
}
|
535
539
|
}
|
536
540
|
}).onFinish(R(this.unlock).bind(this)).start();
|
537
|
-
|
541
|
+
|
538
542
|
} else {
|
539
543
|
// no-fx direct assignment
|
540
544
|
content.width = end_size.x + 'px';
|
541
545
|
content.height = end_size.y + 'px';
|
542
546
|
dialog.top = end_top + 'px';
|
543
|
-
|
547
|
+
|
544
548
|
if (Browser.IE6) {
|
545
549
|
dialog.width = (dlg_diff + end_size.x) + 'px';
|
546
550
|
}
|
547
|
-
|
551
|
+
|
548
552
|
if (!this.request) { this.unlock(); }
|
549
553
|
}
|
550
|
-
|
554
|
+
|
551
555
|
return this;
|
552
556
|
},
|
553
|
-
|
557
|
+
|
554
558
|
/**
|
555
559
|
* Shows the content
|
556
560
|
*
|
@@ -561,7 +565,7 @@ var Dialog = new Wrapper(Element, {
|
|
561
565
|
this.content.update(content || '');
|
562
566
|
this.resize(null, !no_fx);
|
563
567
|
},
|
564
|
-
|
568
|
+
|
565
569
|
/**
|
566
570
|
* Loads up the data from the link
|
567
571
|
*
|
@@ -574,19 +578,19 @@ var Dialog = new Wrapper(Element, {
|
|
574
578
|
this.setTitle(url.get('title'));
|
575
579
|
url = url.get('href');
|
576
580
|
}
|
577
|
-
|
581
|
+
|
578
582
|
Pager.show(this, url);
|
579
583
|
this.lock().cancel();
|
580
|
-
|
584
|
+
|
581
585
|
// defined in the loader.js file
|
582
586
|
this.request = new Loader(url, options, R(function(content, no_fx) {
|
583
587
|
this.request = null;
|
584
588
|
this.show(content, no_fx);
|
585
589
|
}).bind(this));
|
586
|
-
|
590
|
+
|
587
591
|
return this.resize(); // the look might be changed for a media-type
|
588
592
|
},
|
589
|
-
|
593
|
+
|
590
594
|
/**
|
591
595
|
* Cancels a currently loading request
|
592
596
|
*
|
@@ -596,10 +600,10 @@ var Dialog = new Wrapper(Element, {
|
|
596
600
|
if (this.request) {
|
597
601
|
this.request.cancel();
|
598
602
|
}
|
599
|
-
|
603
|
+
|
600
604
|
return this;
|
601
605
|
},
|
602
|
-
|
606
|
+
|
603
607
|
/**
|
604
608
|
* Shows the loading lock
|
605
609
|
*
|
@@ -609,7 +613,7 @@ var Dialog = new Wrapper(Element, {
|
|
609
613
|
this.locker.setStyle('opacity:1');
|
610
614
|
return this;
|
611
615
|
},
|
612
|
-
|
616
|
+
|
613
617
|
/**
|
614
618
|
* Hides the loading lock
|
615
619
|
*
|
@@ -619,11 +623,12 @@ var Dialog = new Wrapper(Element, {
|
|
619
623
|
this.locker.morph({opacity: 0}, {
|
620
624
|
duration: this.options.fxDuration * 2/3
|
621
625
|
});
|
622
|
-
|
626
|
+
|
623
627
|
return this;
|
624
628
|
}
|
625
629
|
});
|
626
630
|
|
631
|
+
|
627
632
|
/**
|
628
633
|
* Xhr/images/medias loading module
|
629
634
|
*
|
@@ -651,7 +656,7 @@ var Loader = new Class({
|
|
651
656
|
}).send();
|
652
657
|
}
|
653
658
|
},
|
654
|
-
|
659
|
+
|
655
660
|
/**
|
656
661
|
* Cancels the request
|
657
662
|
*
|
@@ -666,7 +671,7 @@ var Loader = new Class({
|
|
666
671
|
},
|
667
672
|
|
668
673
|
// protected
|
669
|
-
|
674
|
+
|
670
675
|
// tries to initialize it as an image loading
|
671
676
|
isImage: function(url, on_finish) {
|
672
677
|
if (url.match(Lightbox.Images)) {
|
@@ -678,20 +683,20 @@ var Loader = new Class({
|
|
678
683
|
return true;
|
679
684
|
}
|
680
685
|
},
|
681
|
-
|
686
|
+
|
682
687
|
// tries to initialize it as a flash-element
|
683
688
|
isMedia: function(url, on_finish) {
|
684
689
|
var media = R(Lightbox.Medias).map(function(desc) {
|
685
690
|
return url.match(desc[0]) ? this.buildEmbed(
|
686
691
|
url.replace(desc[0], desc[1]), desc[2]) : null;
|
687
692
|
}, this).compact()[0];
|
688
|
-
|
693
|
+
|
689
694
|
if (media) {
|
690
695
|
on_finish(media, true);
|
691
696
|
return true;
|
692
697
|
}
|
693
698
|
},
|
694
|
-
|
699
|
+
|
695
700
|
// builds an embedded media block
|
696
701
|
buildEmbed: function(url, type) {
|
697
702
|
var media_types = {
|
@@ -710,9 +715,10 @@ var Loader = new Class({
|
|
710
715
|
'<embed src="'+ url +'" type="'+ media_types[type][2]+'"'+ sizes + ' />' +
|
711
716
|
'</object>';
|
712
717
|
}
|
713
|
-
|
718
|
+
|
714
719
|
});
|
715
720
|
|
721
|
+
|
716
722
|
/**
|
717
723
|
* Processes the link-groups showing things in a single Lightbox
|
718
724
|
*
|
@@ -733,16 +739,16 @@ var Pager = {
|
|
733
739
|
this.link = this.links.first(function(link) {
|
734
740
|
return link.get('href') === url;
|
735
741
|
});
|
736
|
-
|
742
|
+
|
737
743
|
var index = this.links.indexOf(this.link), size = this.links.length;
|
738
|
-
|
744
|
+
|
739
745
|
dialog.prevLink[size && index > 0 ? 'show' : 'hide']();
|
740
746
|
dialog.nextLink[size && index < size - 1 ? 'show' : 'hide']();
|
741
747
|
} else {
|
742
748
|
this.dialog = null;
|
743
749
|
}
|
744
750
|
},
|
745
|
-
|
751
|
+
|
746
752
|
/**
|
747
753
|
* Shows the prev link
|
748
754
|
*
|
@@ -752,14 +758,14 @@ var Pager = {
|
|
752
758
|
if (this.dialog && !this.timer) {
|
753
759
|
var id = this.links.indexOf(this.link),
|
754
760
|
link = this.links[id - 1];
|
755
|
-
|
761
|
+
|
756
762
|
if (link) {
|
757
763
|
this.dialog.load(link);
|
758
764
|
this.timeout();
|
759
765
|
}
|
760
766
|
}
|
761
767
|
},
|
762
|
-
|
768
|
+
|
763
769
|
/**
|
764
770
|
* Shows the next link
|
765
771
|
*
|
@@ -769,14 +775,14 @@ var Pager = {
|
|
769
775
|
if (this.dialog && !this.timer) {
|
770
776
|
var id = this.links.indexOf(this.link),
|
771
777
|
link = this.links[id + 1];
|
772
|
-
|
778
|
+
|
773
779
|
if (link) {
|
774
780
|
this.dialog.load(link);
|
775
781
|
this.timeout();
|
776
782
|
}
|
777
783
|
}
|
778
784
|
},
|
779
|
-
|
785
|
+
|
780
786
|
// private
|
781
787
|
|
782
788
|
// finding the links list
|
@@ -784,12 +790,12 @@ var Pager = {
|
|
784
790
|
return $$('a').filter(function(link) {
|
785
791
|
var data = link.get('data-lightbox');
|
786
792
|
var rel = link.get('rel');
|
787
|
-
|
793
|
+
|
788
794
|
return (data && eval("("+ data + ")").group === group) ||
|
789
795
|
(rel && rel.indexOf('lightbox['+ group + ']') > -1);
|
790
796
|
});
|
791
797
|
},
|
792
|
-
|
798
|
+
|
793
799
|
// having a little nap to prevent ugly quick scrolling
|
794
800
|
timeout: function() {
|
795
801
|
this.timer = R(function() {
|
@@ -798,6 +804,7 @@ var Pager = {
|
|
798
804
|
}
|
799
805
|
};
|
800
806
|
|
807
|
+
|
801
808
|
/**
|
802
809
|
* document level hooks
|
803
810
|
*
|
@@ -813,13 +820,13 @@ $(document).on({
|
|
813
820
|
*/
|
814
821
|
click: function(event) {
|
815
822
|
var target = event.find(Lightbox.Options.cssRule) || event.find('a[rel^=lightbox]');
|
816
|
-
|
823
|
+
|
817
824
|
if (target) {
|
818
825
|
event.stop();
|
819
826
|
new Lightbox({}, target).load(target);
|
820
827
|
}
|
821
828
|
},
|
822
|
-
|
829
|
+
|
823
830
|
/**
|
824
831
|
* Catches the mousewheel event and tries to scroll
|
825
832
|
* the list of objects on the lightbox
|
@@ -833,7 +840,7 @@ $(document).on({
|
|
833
840
|
Lightbox.current.fire((event._.detail || -event._.wheelDelta) < 0 ? 'prev' : 'next');
|
834
841
|
}
|
835
842
|
},
|
836
|
-
|
843
|
+
|
837
844
|
/**
|
838
845
|
* Handles the navigation form a keyboard
|
839
846
|
*
|
@@ -850,7 +857,7 @@ $(document).on({
|
|
850
857
|
40: 'next', // Down
|
851
858
|
34: 'next' // PageDown
|
852
859
|
})[event.keyCode];
|
853
|
-
|
860
|
+
|
854
861
|
if (lightbox && name) {
|
855
862
|
if (name !== 'close' || lightbox.options.hideOnEsc) {
|
856
863
|
event.stop();
|
@@ -867,7 +874,7 @@ $(window).on({
|
|
867
874
|
Lightbox.current.dialog.resize();
|
868
875
|
}
|
869
876
|
},
|
870
|
-
|
877
|
+
|
871
878
|
scroll: function(event) {
|
872
879
|
if (Lightbox.current && Browser.IE6) {
|
873
880
|
Lightbox.current.reposition();
|
@@ -875,7 +882,8 @@ $(window).on({
|
|
875
882
|
}
|
876
883
|
});
|
877
884
|
|
878
|
-
|
885
|
+
|
886
|
+
document.write("<style type=\"text/css\">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}div.rui-lightbox{position:fixed;top:0;left:0;z-index:9999;float:none;width:100%;height:100%;margin:0;padding:0;background:none;border:none;text-align:center}div.rui-lightbox-locker{position:absolute;top:0px;left:0px;width:100%;height:100%;background-color:#000;opacity:0.8;filter:alpha(opacity=80);cursor:default}div.rui-lightbox-dialog{display:inline-block; *display:inline; *zoom:1;position:relative;text-align:left}div.rui-lightbox-title{height:1.2em;margin-bottom:.1em;white-space:nowrap;color:#DDD;font-weight:bold;font-size:1.6em;font-family:Helvetica;text-shadow:#000 .05em .1em .2em}div.rui-lightbox-body{background-color:white;padding:1em;border-radius:.5em;-moz-border-radius:.5em;-webkit-border-radius:.5em}div.rui-lightbox-body-inner{position:relative}div.rui-lightbox-scroller{overflow:hidden}div.rui-lightbox-content{display:inline-block; *display:inline; *zoom:1;min-height:10em;min-width:10em;_height:10em;_width:10em}div.rui-lightbox-body-locker{background-color:white;position:absolute;left:0px;top:0px;width:100%;height:100%;z-index:999;opacity:0;filter:alpha(opacity=0)}div.rui-lightbox-body-locker div.rui-spinner{position:absolute;right:0;bottom:0;border:none;background:none;font-size:150%}div.rui-lightbox-navigation{color:#888;font-size:150%;font-family:Arial;height:1em;user-select:none;-moz-user-select:none;-webkit-user-select:none}div.rui-lightbox-navigation div{cursor:pointer;position:absolute}div.rui-lightbox-navigation div:hover{color:white}div.rui-lightbox-navigation div.next{left:2em}div.rui-lightbox-navigation div.close{right:0}div.rui-lightbox-image div.rui-lightbox-body,div.rui-lightbox-media div.rui-lightbox-body{padding:0;border:1px solid #777;border-radius:0px;-moz-border-radius:0px;-webkit-border-radius:0px}div.rui-lightbox-image div.rui-lightbox-content,div.rui-lightbox-media div.rui-lightbox-content{min-height:12em;min-width:12em;_height:12em;_width:12em}div.rui-lightbox-image div.rui-lightbox-content img{vertical-align:middle}div.rui-lightbox-image div.rui-lightbox-body,div.rui-lightbox-image div.rui-lightbox-body-locker,div.rui-lightbox-media div.rui-lightbox-body,div.rui-lightbox-media div.rui-lightbox-body-locker{background-color:#D8D8D8}div.rui-lightbox-image div.rui-lightbox-body-locker div.rui-spinner,div.rui-lightbox-media div.rui-lightbox-body-locker div.rui-spinner{bottom:.5em;right:.5em}</style>");
|
879
887
|
|
880
888
|
return Lightbox;
|
881
|
-
})(document, RightJS);
|
889
|
+
})(document, RightJS);
|