right-rails 1.0.9 → 1.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +13 -0
- data/public/javascripts/right/billboard-src.js +544 -0
- data/public/javascripts/right/billboard.js +17 -0
- data/public/javascripts/right/dialog-src.js +738 -0
- data/public/javascripts/right/dialog.js +21 -0
- data/public/javascripts/right/i18n/de.js +16 -0
- data/public/javascripts/right/i18n/es.js +16 -0
- data/public/javascripts/right/i18n/fi.js +16 -0
- data/public/javascripts/right/i18n/fr.js +16 -0
- data/public/javascripts/right/i18n/hu.js +16 -0
- data/public/javascripts/right/i18n/it.js +16 -0
- data/public/javascripts/right/i18n/jp.js +15 -0
- data/public/javascripts/right/i18n/nl.js +14 -0
- data/public/javascripts/right/i18n/pt-br.js +14 -0
- data/public/javascripts/right/i18n/ru.js +14 -0
- data/public/javascripts/right/i18n/ua.js +14 -1
- data/public/javascripts/right/lightbox-src.js +2 -2
- data/public/javascripts/right/lightbox.js +2 -2
- data/public/javascripts/right/sortable-src.js +52 -30
- data/public/javascripts/right/sortable.js +8 -8
- data/public/javascripts/right/table-src.js +167 -0
- data/public/javascripts/right/table.js +9 -0
- data/public/javascripts/right-src.js +3 -1
- metadata +10 -4
data/CHANGELOG
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
2010-10-24 Nikolay Nemshilov
|
2
|
+
o Version 1.0.10
|
3
|
+
* RightJS builds update
|
4
|
+
* Dialog module
|
5
|
+
* Billboard module
|
6
|
+
* Table module
|
7
|
+
|
8
|
+
2010-10-17 Nikolay Nemshilov
|
9
|
+
o Version 1.0.9
|
10
|
+
* RightJS 2.1.1 build
|
11
|
+
* Selectable module update
|
12
|
+
* tooltip -> tooltips rename
|
13
|
+
|
1
14
|
2010-10-11 Nikolay Nemshilov
|
2
15
|
o Version 1.0.8
|
3
16
|
* RightJS 2.1.0 build
|
@@ -0,0 +1,544 @@
|
|
1
|
+
/**
|
2
|
+
* Standard billboard widget for RightJS
|
3
|
+
* http://rightjs.org/ui/billboard
|
4
|
+
*
|
5
|
+
* Copyright (C) 2010 Nikolay Nemshilov
|
6
|
+
*/
|
7
|
+
var Billboard = RightJS.Billboard = (function(RightJS) {
|
8
|
+
/**
|
9
|
+
* This module defines the basic widgets constructor
|
10
|
+
* it creates an abstract proxy with the common functionality
|
11
|
+
* which then we reuse and override in the actual widgets
|
12
|
+
*
|
13
|
+
* Copyright (C) 2010 Nikolay Nemshilov
|
14
|
+
*/
|
15
|
+
|
16
|
+
/**
|
17
|
+
* Billboard initialization script
|
18
|
+
*
|
19
|
+
* Copyright (C) 2010 Nikolay Nemshilov
|
20
|
+
*/
|
21
|
+
var R = RightJS,
|
22
|
+
$ = RightJS.$,
|
23
|
+
$$ = RightJS.$$,
|
24
|
+
$w = RightJS.$w,
|
25
|
+
$E = RightJS.$E,
|
26
|
+
Fx = RightJS.Fx,
|
27
|
+
Class = RightJS.Class,
|
28
|
+
Object = RightJS.Object;
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
/**
|
34
|
+
* The widget units constructor
|
35
|
+
*
|
36
|
+
* @param String tag-name or Object methods
|
37
|
+
* @param Object methods
|
38
|
+
* @return Widget wrapper
|
39
|
+
*/
|
40
|
+
function Widget(tag_name, methods) {
|
41
|
+
if (!methods) {
|
42
|
+
methods = tag_name;
|
43
|
+
tag_name = 'DIV';
|
44
|
+
}
|
45
|
+
|
46
|
+
/**
|
47
|
+
* An Abstract Widget Unit
|
48
|
+
*
|
49
|
+
* Copyright (C) 2010 Nikolay Nemshilov
|
50
|
+
*/
|
51
|
+
var AbstractWidget = new RightJS.Wrapper(RightJS.Element.Wrappers[tag_name] || RightJS.Element, {
|
52
|
+
/**
|
53
|
+
* The common constructor
|
54
|
+
*
|
55
|
+
* @param Object options
|
56
|
+
* @param String optional tag name
|
57
|
+
* @return void
|
58
|
+
*/
|
59
|
+
initialize: function(key, options) {
|
60
|
+
this.key = key;
|
61
|
+
var args = [{'class': 'rui-' + key}];
|
62
|
+
|
63
|
+
// those two have different constructors
|
64
|
+
if (!(this instanceof RightJS.Input || this instanceof RightJS.Form)) {
|
65
|
+
args.unshift(tag_name);
|
66
|
+
}
|
67
|
+
this.$super.apply(this, args);
|
68
|
+
|
69
|
+
if (RightJS.isString(options)) {
|
70
|
+
options = RightJS.$(options);
|
71
|
+
}
|
72
|
+
|
73
|
+
// if the options is another element then
|
74
|
+
// try to dynamically rewrap it with our widget
|
75
|
+
if (options instanceof RightJS.Element) {
|
76
|
+
this._ = options._;
|
77
|
+
if ('$listeners' in options) {
|
78
|
+
options.$listeners = options.$listeners;
|
79
|
+
}
|
80
|
+
options = {};
|
81
|
+
}
|
82
|
+
this.setOptions(options, this);
|
83
|
+
return this;
|
84
|
+
},
|
85
|
+
|
86
|
+
// protected
|
87
|
+
|
88
|
+
/**
|
89
|
+
* Catches the options
|
90
|
+
*
|
91
|
+
* @param Object user-options
|
92
|
+
* @param Element element with contextual options
|
93
|
+
* @return void
|
94
|
+
*/
|
95
|
+
setOptions: function(options, element) {
|
96
|
+
element = element || this;
|
97
|
+
RightJS.Options.setOptions.call(this,
|
98
|
+
RightJS.Object.merge(options, eval("("+(
|
99
|
+
element.get('data-'+ this.key) || '{}'
|
100
|
+
)+")"))
|
101
|
+
);
|
102
|
+
return this;
|
103
|
+
}
|
104
|
+
});
|
105
|
+
|
106
|
+
/**
|
107
|
+
* Creating the actual widget class
|
108
|
+
*
|
109
|
+
*/
|
110
|
+
var Klass = new RightJS.Wrapper(AbstractWidget, methods);
|
111
|
+
|
112
|
+
// creating the widget related shortcuts
|
113
|
+
RightJS.Observer.createShortcuts(Klass.prototype, Klass.EVENTS || []);
|
114
|
+
|
115
|
+
return Klass;
|
116
|
+
}
|
117
|
+
|
118
|
+
|
119
|
+
/**
|
120
|
+
* Billboards basic class
|
121
|
+
*
|
122
|
+
* Copyright (C) 2010 Nikolay Nemshilov
|
123
|
+
*/
|
124
|
+
var Billboard = new Widget('UL', {
|
125
|
+
extend: {
|
126
|
+
version: '2.0.1',
|
127
|
+
|
128
|
+
EVENTS: $w('change first last'),
|
129
|
+
|
130
|
+
Options: {
|
131
|
+
fxName: 'stripe', // visual effect name
|
132
|
+
fxDuration: 'long', // visual effect duration
|
133
|
+
|
134
|
+
autostart: true, // if it should automatically start rotate things
|
135
|
+
delay: 4000, // delay between item shows
|
136
|
+
loop: true, // loop after reaching the last one
|
137
|
+
|
138
|
+
showButtons: true, // should it show the next/prev buttons or not
|
139
|
+
prevButton: 'native', // prev item button, 'native' or an ID of your own
|
140
|
+
nextButton: 'native', // next item button, 'native' or an ID of your own
|
141
|
+
|
142
|
+
stripes: 10, // the number of stripes
|
143
|
+
|
144
|
+
cssRule: '*.rui-billboard'
|
145
|
+
}
|
146
|
+
},
|
147
|
+
|
148
|
+
/**
|
149
|
+
* Basic constructor
|
150
|
+
*
|
151
|
+
* @param mixed an element reference
|
152
|
+
* @return void
|
153
|
+
*/
|
154
|
+
initialize: function(element) {
|
155
|
+
this.$super('billboard', element);
|
156
|
+
|
157
|
+
// initializing the buttons
|
158
|
+
if (this.options.showButtons) {
|
159
|
+
this.prevButton = this.options.prevButton !== 'native' ? $(this.options.prevButton) :
|
160
|
+
$E('div', {'class': 'rui-billboard-button-prev', 'html': '‹'}).insertTo(this);
|
161
|
+
this.nextButton = this.options.nextButton !== 'native' ? $(this.options.nextButton) :
|
162
|
+
$E('div', {'class': 'rui-billboard-button-next', 'html': '›'}).insertTo(this);
|
163
|
+
|
164
|
+
this.prevButton.onClick(R(function(event) {
|
165
|
+
event.stop(); this.showPrev();
|
166
|
+
}).bind(this));
|
167
|
+
this.nextButton.onClick(R(function(event) {
|
168
|
+
event.stop(); this.showNext();
|
169
|
+
}).bind(this));
|
170
|
+
}
|
171
|
+
|
172
|
+
// catching the 'first'/'last' events
|
173
|
+
this.onChange(function(event) {
|
174
|
+
if (event.item === this.items().first()) {
|
175
|
+
this.fire('first');
|
176
|
+
} else if (event.item === this.items().last()) {
|
177
|
+
this.fire('last');
|
178
|
+
}
|
179
|
+
});
|
180
|
+
|
181
|
+
// stopping/starting the slideshow with mouse over/out events
|
182
|
+
this.on({
|
183
|
+
mouseover: function() {
|
184
|
+
this.stop();
|
185
|
+
},
|
186
|
+
|
187
|
+
mouseout: function(event) {
|
188
|
+
if (this.options.autostart && !event.find('.rui-billboard')) {
|
189
|
+
this.start();
|
190
|
+
}
|
191
|
+
}
|
192
|
+
});
|
193
|
+
|
194
|
+
// autostart
|
195
|
+
if (this.options.autostart) {
|
196
|
+
this.start();
|
197
|
+
}
|
198
|
+
},
|
199
|
+
|
200
|
+
/**
|
201
|
+
* Returns the list of items to swap
|
202
|
+
*
|
203
|
+
* @return Array swappable items
|
204
|
+
*/
|
205
|
+
items: function() {
|
206
|
+
return this.children().without(this.prevButton, this.nextButton);
|
207
|
+
},
|
208
|
+
|
209
|
+
/**
|
210
|
+
* Show next item on the list
|
211
|
+
*
|
212
|
+
* @return Billboard this
|
213
|
+
*/
|
214
|
+
showNext: function() {
|
215
|
+
var items = this.items(), index = items.indexOf(this.current()) + 1;
|
216
|
+
|
217
|
+
if (index == items.length && this.options.loop) {
|
218
|
+
index = 0;
|
219
|
+
}
|
220
|
+
|
221
|
+
return this.current(index);
|
222
|
+
},
|
223
|
+
|
224
|
+
/**
|
225
|
+
* Show prev item on the list
|
226
|
+
*
|
227
|
+
* @return Billboard this
|
228
|
+
*/
|
229
|
+
showPrev: function() {
|
230
|
+
var items = this.items(), index = items.indexOf(this.current()) - 1;
|
231
|
+
|
232
|
+
if (index < 0 && this.options.loop) {
|
233
|
+
index = items.length - 1;
|
234
|
+
}
|
235
|
+
|
236
|
+
return this.current(index);
|
237
|
+
},
|
238
|
+
|
239
|
+
/**
|
240
|
+
* Gets/sets the current item
|
241
|
+
*
|
242
|
+
* @param mixed integer index or a LI element reference
|
243
|
+
* @return Billboard this or current LI element
|
244
|
+
*/
|
245
|
+
current: function(index) {
|
246
|
+
var items = this.items();
|
247
|
+
|
248
|
+
if (arguments.length) {
|
249
|
+
if (index instanceof Element) {
|
250
|
+
index = items.indexOf(index);
|
251
|
+
}
|
252
|
+
|
253
|
+
this.runFx(items[index]);
|
254
|
+
} else {
|
255
|
+
return items.length ? (
|
256
|
+
items.first('hasClass', 'rui-billboard-current') ||
|
257
|
+
items.first().addClass('rui-billboard-current')
|
258
|
+
) : null;
|
259
|
+
}
|
260
|
+
|
261
|
+
return this;
|
262
|
+
},
|
263
|
+
|
264
|
+
/**
|
265
|
+
* Starts the slide show
|
266
|
+
*
|
267
|
+
* @return Billboard this
|
268
|
+
*/
|
269
|
+
start: function() {
|
270
|
+
this.timer = R(this.showNext).bind(this).periodical(this.options.delay);
|
271
|
+
},
|
272
|
+
|
273
|
+
/**
|
274
|
+
* stops the slideshow
|
275
|
+
*
|
276
|
+
* @return Billboard this
|
277
|
+
*/
|
278
|
+
stop: function() {
|
279
|
+
if (this.timer) {
|
280
|
+
this.timer.stop();
|
281
|
+
}
|
282
|
+
},
|
283
|
+
|
284
|
+
/**
|
285
|
+
* Wrapping the event trigger so it always sent the
|
286
|
+
* current element references
|
287
|
+
*
|
288
|
+
* @param String event name
|
289
|
+
* @param Object options
|
290
|
+
* @return Billboard this
|
291
|
+
*/
|
292
|
+
fire: function(name, options) {
|
293
|
+
return this.$super(name, Object.merge({
|
294
|
+
index: this.items().indexOf(this.current()),
|
295
|
+
item: this.current()
|
296
|
+
}, options));
|
297
|
+
},
|
298
|
+
|
299
|
+
// protected
|
300
|
+
|
301
|
+
/**
|
302
|
+
* Runs the fx transition
|
303
|
+
*
|
304
|
+
* @param Element new LI element
|
305
|
+
* @return void
|
306
|
+
*/
|
307
|
+
runFx: function(item) {
|
308
|
+
if (item && !this._running) {
|
309
|
+
var Fx = Billboard.Fx[R(this.options.fxName || '').capitalize()];
|
310
|
+
|
311
|
+
if (Fx) {
|
312
|
+
new Fx(this).start(this.current(), item);
|
313
|
+
} else {
|
314
|
+
this.current().removeClass('rui-billboard-current');
|
315
|
+
item.addClass('rui-billboard-current');
|
316
|
+
}
|
317
|
+
}
|
318
|
+
}
|
319
|
+
});
|
320
|
+
|
321
|
+
/**
|
322
|
+
* Basic billboard visual effect
|
323
|
+
*
|
324
|
+
* Copyright (C) 2010 Nikolay Nemshilov
|
325
|
+
*/
|
326
|
+
Billboard.Fx = new Class(Fx, {
|
327
|
+
|
328
|
+
/**
|
329
|
+
* basic constructor
|
330
|
+
*
|
331
|
+
* @param Billboard billboard
|
332
|
+
* @return void
|
333
|
+
*/
|
334
|
+
initialize: function(billboard) {
|
335
|
+
this.container = $E('div', {'class': 'rui-billboard-fx-container'});
|
336
|
+
|
337
|
+
this.$super(billboard, {
|
338
|
+
duration: billboard.options.fxDuration,
|
339
|
+
onStart: function() {
|
340
|
+
billboard._running = true;
|
341
|
+
billboard.insert(this.container);
|
342
|
+
},
|
343
|
+
onFinish: function() {
|
344
|
+
this.container.remove();
|
345
|
+
billboard._running = false;
|
346
|
+
billboard.fire('change');
|
347
|
+
}
|
348
|
+
});
|
349
|
+
},
|
350
|
+
|
351
|
+
/**
|
352
|
+
* Starts an fx on the given item
|
353
|
+
*
|
354
|
+
* @param {Element} old LI element
|
355
|
+
* @param {Element} new LI element
|
356
|
+
* @return void
|
357
|
+
*/
|
358
|
+
prepare: function(old_item, new_item) {
|
359
|
+
old_item.removeClass('rui-billboard-current');
|
360
|
+
new_item.addClass('rui-billboard-current');
|
361
|
+
|
362
|
+
this.clone = old_item.clone();
|
363
|
+
|
364
|
+
this.container.update(this.clone);
|
365
|
+
}
|
366
|
+
|
367
|
+
});
|
368
|
+
|
369
|
+
/**
|
370
|
+
* Fade visual effects class
|
371
|
+
*
|
372
|
+
* Copyright (C) 2010 Nikolay Nemshilov
|
373
|
+
*/
|
374
|
+
Billboard.Fx.Fade = new Class(Billboard.Fx, {
|
375
|
+
|
376
|
+
/**
|
377
|
+
* Starts an fx on the given item
|
378
|
+
*
|
379
|
+
* @param {Element} old LI element
|
380
|
+
* @param {Element} new LI element
|
381
|
+
* @return void
|
382
|
+
*/
|
383
|
+
prepare: function(old_item, new_item) {
|
384
|
+
this.$super(old_item, new_item);
|
385
|
+
},
|
386
|
+
|
387
|
+
/**
|
388
|
+
* Rendering the effect
|
389
|
+
*
|
390
|
+
* @param Float delta value
|
391
|
+
* @return void
|
392
|
+
*/
|
393
|
+
render: function(delta) {
|
394
|
+
this.container.setStyle({opacity: 1 - delta});
|
395
|
+
}
|
396
|
+
|
397
|
+
});
|
398
|
+
|
399
|
+
/**
|
400
|
+
* The slide visual effects class
|
401
|
+
*
|
402
|
+
* Copyright (C) 2010 Nikolay Nemshilov
|
403
|
+
*/
|
404
|
+
Billboard.Fx.Slide = new Class(Billboard.Fx, {
|
405
|
+
|
406
|
+
/**
|
407
|
+
* overloading the 'prepare' method to add some stuff
|
408
|
+
* to the container depending on which direction do we slide
|
409
|
+
*
|
410
|
+
* @param {Element} old LI element
|
411
|
+
* @param {Element} new LI element
|
412
|
+
* @return void
|
413
|
+
*/
|
414
|
+
prepare: function(old_item, new_item) {
|
415
|
+
this._width = this.element.current().size().x;
|
416
|
+
this._direction = old_item.nextSiblings().include(new_item) ? -1 : 1;
|
417
|
+
|
418
|
+
this.$super(old_item, new_item);
|
419
|
+
|
420
|
+
this.clone.setStyle({width: this._width + 'px'});
|
421
|
+
},
|
422
|
+
|
423
|
+
/**
|
424
|
+
* Rendering the Fx
|
425
|
+
*
|
426
|
+
* @param Float delta
|
427
|
+
* @return void
|
428
|
+
*/
|
429
|
+
render: function(delta) {
|
430
|
+
this.clone._.style.left = this._direction * this._width * delta + 'px';
|
431
|
+
}
|
432
|
+
|
433
|
+
});
|
434
|
+
|
435
|
+
/**
|
436
|
+
* Stripe visual effects class
|
437
|
+
*
|
438
|
+
* Copyright (C) 2010 Nikolay Nemshilov
|
439
|
+
*/
|
440
|
+
Billboard.Fx.Stripe = new Class(Billboard.Fx, {
|
441
|
+
|
442
|
+
directions: ['down', 'up', 'left', 'right'],
|
443
|
+
|
444
|
+
/**
|
445
|
+
* Breaking the original element onto sripes in here
|
446
|
+
*
|
447
|
+
* @param {Element} old LI element
|
448
|
+
* @param {Element} new LI element
|
449
|
+
* @return void
|
450
|
+
*/
|
451
|
+
prepare: function(old_item, new_item) {
|
452
|
+
this.$super(old_item, new_item);
|
453
|
+
|
454
|
+
var length = this.element.options.stripes,
|
455
|
+
width = this.element.items()[0].size().x / length,
|
456
|
+
delay = 100,
|
457
|
+
direction = this.directions.shift();
|
458
|
+
|
459
|
+
this.directions.push(direction);
|
460
|
+
this.container.clean();
|
461
|
+
|
462
|
+
for (var i=0; i < length; i++) {
|
463
|
+
var stripe = $E('div', {
|
464
|
+
'class': 'rui-billboard-stripe',
|
465
|
+
'style': {
|
466
|
+
width: width + 1 + 'px',
|
467
|
+
left: i * width + 'px'
|
468
|
+
}
|
469
|
+
}).insert(old_item.clone().setStyle({
|
470
|
+
width: width * length + 'px',
|
471
|
+
left: - i * width + 'px'
|
472
|
+
}));
|
473
|
+
|
474
|
+
this.container.append(stripe);
|
475
|
+
var options = {
|
476
|
+
duration: this.options.duration
|
477
|
+
};
|
478
|
+
|
479
|
+
if (direction !== 'right' && i === (length - 1) || (direction === 'right' && i === 0)) {
|
480
|
+
options.onFinish = R(this.finish).bind(this);
|
481
|
+
}
|
482
|
+
|
483
|
+
switch (direction) {
|
484
|
+
case 'up':
|
485
|
+
R(function(stripe, options) {
|
486
|
+
stripe.morph({height: '0px'}, options);
|
487
|
+
}).bind(this, stripe, options).delay(i * delay);
|
488
|
+
break;
|
489
|
+
|
490
|
+
case 'down':
|
491
|
+
stripe.setStyle('top: auto; bottom: 0px');
|
492
|
+
R(function(stripe, options) {
|
493
|
+
stripe.morph({height: '0px'}, options);
|
494
|
+
}).bind(this, stripe, options).delay(i * delay);
|
495
|
+
break;
|
496
|
+
|
497
|
+
case 'left':
|
498
|
+
R(function(stripe, options) {
|
499
|
+
stripe.morph({width: '0px'}, options);
|
500
|
+
}).bind(this, stripe, options).delay(i * delay);
|
501
|
+
break;
|
502
|
+
|
503
|
+
case 'right':
|
504
|
+
R(function(stripe, options) {
|
505
|
+
stripe.morph({width: '0px'}, options);
|
506
|
+
}).bind(this, stripe, options).delay((length - i -1) * delay);
|
507
|
+
break;
|
508
|
+
|
509
|
+
default:
|
510
|
+
this.finish();
|
511
|
+
}
|
512
|
+
}
|
513
|
+
},
|
514
|
+
|
515
|
+
|
516
|
+
/**
|
517
|
+
* Stubbing the timer so it didn't count nothing
|
518
|
+
*
|
519
|
+
* @return Fx this
|
520
|
+
*/
|
521
|
+
start: function() {
|
522
|
+
this.$super.apply(this, arguments);
|
523
|
+
return this.pause();
|
524
|
+
}
|
525
|
+
|
526
|
+
});
|
527
|
+
|
528
|
+
/**
|
529
|
+
* Document level hooks for billboards
|
530
|
+
*
|
531
|
+
* Copyright (C) 2010 Nikolay Nemshilov
|
532
|
+
*/
|
533
|
+
$(document).onReady(function() {
|
534
|
+
$$(Billboard.Options.cssRule).each(function(element) {
|
535
|
+
if (!(element instanceof Billboard)) {
|
536
|
+
element = new Billboard(element);
|
537
|
+
}
|
538
|
+
});
|
539
|
+
});
|
540
|
+
|
541
|
+
document.write("<style type=\"text/css\"> *.rui-billboard, *.rui-billboard> *{margin:0;padding:0;list-style:none} *.rui-billboard{display:inline-block; *display:inline; *zoom:1;position:relative} *.rui-billboard> *{display:none;width:100%;height:100%} *.rui-billboard> *:first-child, *.rui-billboard> *.rui-billboard-current:first-child{display:block;position:relative} *.rui-billboard> *>img{margin:0;padding:0} *.rui-billboard-current{position:absolute;left:0;top:0;display:block;z-index:999} *.rui-billboard-button-prev, *.rui-billboard-button-next{position:absolute;z-index:99999;left:.25em;top:auto;bottom:.25em;display:block;width:.5em;height:auto;text-align:center;font-size:200%;font-family:Arial;font-weight:bold;padding:0em .5em .2em .5em;background:white;opacity:0;filter:alpha(opacity:0);cursor:pointer;border:.12em solid #888;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em;user-select:none;-moz-user-select:none;-webkit-user-select:none;transition:opacity .3s ease-in-out;-o-transition:opacity .3s ease-in-out;-moz-transition:opacity .3s ease-in-out;-webkit-transition:opacity .3s ease-in-out} *.rui-billboard-button-next{left:auto;right:.25em;text-align:right} *.rui-billboard-button-prev:active{text-indent:-.1em} *.rui-billboard-button-next:active{text-indent:.2em} *.rui-billboard:hover *.rui-billboard-button-prev, *.rui-billboard:hover *.rui-billboard-button-next{opacity:0.4;filter:alpha(opacity:40)} *.rui-billboard:hover *.rui-billboard-button-prev:hover, *.rui-billboard:hover *.rui-billboard-button-next:hover{opacity:0.7;filter:alpha(opacity:70)}.rui-billboard-fx-container{position:absolute;left:0;top:0;display:block;z-index:9999;overflow:hidden}.rui-billboard-fx-container> *{position:absolute;left:0;top:0}.rui-billboard-stripe{overflow:hidden}.rui-billboard-stripe> *{position:relative}</style>");
|
542
|
+
|
543
|
+
return Billboard;
|
544
|
+
})(RightJS);
|
@@ -0,0 +1,17 @@
|
|
1
|
+
/**
|
2
|
+
* Standard billboard widget for RightJS
|
3
|
+
* http://rightjs.org/ui/billboard
|
4
|
+
*
|
5
|
+
* Copyright (C) 2010 Nikolay Nemshilov
|
6
|
+
*/
|
7
|
+
var Billboard=RightJS.Billboard=function(c){var o=c.$,p=c.$$,q=c.$w,m=c.$E,r=c.Fx,n=c.Class,s=c.Object,f=new (function(a,b){if(!b){b=a;a="DIV"}var g=new c.Wrapper(c.Element.Wrappers[a]||c.Element,{initialize:function(h,d){this.key=h;var e=[{"class":"rui-"+h}];this instanceof c.Input||this instanceof c.Form||e.unshift(a);this.$super.apply(this,e);if(c.isString(d))d=c.$(d);if(d instanceof c.Element){this._=d._;if("$listeners"in d)d.$listeners=d.$listeners;d={}}this.setOptions(d,this);return this},setOptions:function(h,
|
8
|
+
d){d=d||this;c.Options.setOptions.call(this,c.Object.merge(h,eval("("+(d.get("data-"+this.key)||"{}")+")")));return this}});g=new c.Wrapper(g,b);c.Observer.createShortcuts(g.prototype,g.EVENTS||[]);return g})("UL",{extend:{version:"2.0.1",EVENTS:q("change first last"),Options:{fxName:"stripe",fxDuration:"long",autostart:true,delay:4E3,loop:true,showButtons:true,prevButton:"native",nextButton:"native",stripes:10,cssRule:"*.rui-billboard"}},initialize:function(a){this.$super("billboard",a);if(this.options.showButtons){this.prevButton=
|
9
|
+
this.options.prevButton!=="native"?o(this.options.prevButton):m("div",{"class":"rui-billboard-button-prev",html:"‹"}).insertTo(this);this.nextButton=this.options.nextButton!=="native"?o(this.options.nextButton):m("div",{"class":"rui-billboard-button-next",html:"›"}).insertTo(this);this.prevButton.onClick(c(function(b){b.stop();this.showPrev()}).bind(this));this.nextButton.onClick(c(function(b){b.stop();this.showNext()}).bind(this))}this.onChange(function(b){if(b.item===this.items().first())this.fire("first");
|
10
|
+
else b.item===this.items().last()&&this.fire("last")});this.on({mouseover:function(){this.stop()},mouseout:function(b){this.options.autostart&&!b.find(".rui-billboard")&&this.start()}});this.options.autostart&&this.start()},items:function(){return this.children().without(this.prevButton,this.nextButton)},showNext:function(){var a=this.items(),b=a.indexOf(this.current())+1;if(b==a.length&&this.options.loop)b=0;return this.current(b)},showPrev:function(){var a=this.items(),b=a.indexOf(this.current())-
|
11
|
+
1;if(b<0&&this.options.loop)b=a.length-1;return this.current(b)},current:function(a){var b=this.items();if(arguments.length){if(a instanceof Element)a=b.indexOf(a);this.runFx(b[a])}else return b.length?b.first("hasClass","rui-billboard-current")||b.first().addClass("rui-billboard-current"):null;return this},start:function(){this.timer=c(this.showNext).bind(this).periodical(this.options.delay)},stop:function(){this.timer&&this.timer.stop()},fire:function(a,b){return this.$super(a,s.merge({index:this.items().indexOf(this.current()),
|
12
|
+
item:this.current()},b))},runFx:function(a){if(a&&!this._running){var b=f.Fx[c(this.options.fxName||"").capitalize()];if(b)(new b(this)).start(this.current(),a);else{this.current().removeClass("rui-billboard-current");a.addClass("rui-billboard-current")}}}});f.Fx=new n(r,{initialize:function(a){this.container=m("div",{"class":"rui-billboard-fx-container"});this.$super(a,{duration:a.options.fxDuration,onStart:function(){a._running=true;a.insert(this.container)},onFinish:function(){this.container.remove();
|
13
|
+
a._running=false;a.fire("change")}})},prepare:function(a,b){a.removeClass("rui-billboard-current");b.addClass("rui-billboard-current");this.clone=a.clone();this.container.update(this.clone)}});f.Fx.Fade=new n(f.Fx,{prepare:function(a,b){this.$super(a,b)},render:function(a){this.container.setStyle({opacity:1-a})}});f.Fx.Slide=new n(f.Fx,{prepare:function(a,b){this._width=this.element.current().size().x;this._direction=a.nextSiblings().include(b)?-1:1;this.$super(a,b);this.clone.setStyle({width:this._width+
|
14
|
+
"px"})},render:function(a){this.clone._.style.left=this._direction*this._width*a+"px"}});f.Fx.Stripe=new n(f.Fx,{directions:["down","up","left","right"],prepare:function(a,b){this.$super(a,b);var g=this.element.options.stripes,h=this.element.items()[0].size().x/g,d=this.directions.shift();this.directions.push(d);this.container.clean();for(var e=0;e<g;e++){var k=m("div",{"class":"rui-billboard-stripe",style:{width:h+1+"px",left:e*h+"px"}}).insert(a.clone().setStyle({width:h*g+"px",left:-e*h+"px"}));
|
15
|
+
this.container.append(k);var l={duration:this.options.duration};if(d!=="right"&&e===g-1||d==="right"&&e===0)l.onFinish=c(this.finish).bind(this);switch(d){case "up":c(function(i,j){i.morph({height:"0px"},j)}).bind(this,k,l).delay(e*100);break;case "down":k.setStyle("top: auto; bottom: 0px");c(function(i,j){i.morph({height:"0px"},j)}).bind(this,k,l).delay(e*100);break;case "left":c(function(i,j){i.morph({width:"0px"},j)}).bind(this,k,l).delay(e*100);break;case "right":c(function(i,j){i.morph({width:"0px"},
|
16
|
+
j)}).bind(this,k,l).delay((g-e-1)*100);break;default:this.finish()}}},start:function(){this.$super.apply(this,arguments);return this.pause()}});o(document).onReady(function(){p(f.Options.cssRule).each(function(a){a instanceof f||new f(a)})});document.write('<style type="text/css"> *.rui-billboard, *.rui-billboard> *{margin:0;padding:0;list-style:none} *.rui-billboard{display:inline-block; *display:inline; *zoom:1;position:relative} *.rui-billboard> *{display:none;width:100%;height:100%} *.rui-billboard> *:first-child, *.rui-billboard> *.rui-billboard-current:first-child{display:block;position:relative} *.rui-billboard> *>img{margin:0;padding:0} *.rui-billboard-current{position:absolute;left:0;top:0;display:block;z-index:999} *.rui-billboard-button-prev, *.rui-billboard-button-next{position:absolute;z-index:99999;left:.25em;top:auto;bottom:.25em;display:block;width:.5em;height:auto;text-align:center;font-size:200%;font-family:Arial;font-weight:bold;padding:0em .5em .2em .5em;background:white;opacity:0;filter:alpha(opacity:0);cursor:pointer;border:.12em solid #888;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em;user-select:none;-moz-user-select:none;-webkit-user-select:none;transition:opacity .3s ease-in-out;-o-transition:opacity .3s ease-in-out;-moz-transition:opacity .3s ease-in-out;-webkit-transition:opacity .3s ease-in-out} *.rui-billboard-button-next{left:auto;right:.25em;text-align:right} *.rui-billboard-button-prev:active{text-indent:-.1em} *.rui-billboard-button-next:active{text-indent:.2em} *.rui-billboard:hover *.rui-billboard-button-prev, *.rui-billboard:hover *.rui-billboard-button-next{opacity:0.4;filter:alpha(opacity:40)} *.rui-billboard:hover *.rui-billboard-button-prev:hover, *.rui-billboard:hover *.rui-billboard-button-next:hover{opacity:0.7;filter:alpha(opacity:70)}.rui-billboard-fx-container{position:absolute;left:0;top:0;display:block;z-index:9999;overflow:hidden}.rui-billboard-fx-container> *{position:absolute;left:0;top:0}.rui-billboard-stripe{overflow:hidden}.rui-billboard-stripe> *{position:relative}</style>');
|
17
|
+
return f}(RightJS);
|