bhf 0.4.3 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  //= require mootools-compat
2
- //= require ./mootools-more-1.3.2.1-custom.js
2
+ //= require ./mootools-more-1.4.0.1.js
3
3
  //= require mootools_ujs
4
4
  //= require_tree ./classes/
5
5
 
@@ -278,5 +278,5 @@ window.addEvent('domready', function(){
278
278
  fm.addClass('show').removeClass.delay(4000, fm, 'show');
279
279
  }
280
280
 
281
- new BrowserUpdate({vs:{i:8,f:3,o:10.01,s:2,n:9}});
281
+ new BrowserUpdate({vs:{i:8,f:7,o:10.01,s:4,n:9}});
282
282
  });
@@ -0,0 +1,1229 @@
1
+ // MooTools: the javascript framework.
2
+ // Load this file's selection again by visiting: http://mootools.net/more/9a67e76ac21beb650c34657e727bc592
3
+ // Or build this file again with packager using: packager build More/String.Extras More/Sortables More/Locale More/Locale.en-US.Date More/Locale.de-DE.Date
4
+ /*
5
+ ---
6
+
7
+ script: More.js
8
+
9
+ name: More
10
+
11
+ description: MooTools More
12
+
13
+ license: MIT-style license
14
+
15
+ authors:
16
+ - Guillermo Rauch
17
+ - Thomas Aylott
18
+ - Scott Kyle
19
+ - Arian Stolwijk
20
+ - Tim Wienk
21
+ - Christoph Pojer
22
+ - Aaron Newton
23
+ - Jacob Thornton
24
+
25
+ requires:
26
+ - Core/MooTools
27
+
28
+ provides: [MooTools.More]
29
+
30
+ ...
31
+ */
32
+
33
+ MooTools.More = {
34
+ 'version': '1.4.0.1',
35
+ 'build': 'a4244edf2aa97ac8a196fc96082dd35af1abab87'
36
+ };
37
+
38
+
39
+ /*
40
+ ---
41
+
42
+ script: String.Extras.js
43
+
44
+ name: String.Extras
45
+
46
+ description: Extends the String native object to include methods useful in managing various kinds of strings (query strings, urls, html, etc).
47
+
48
+ license: MIT-style license
49
+
50
+ authors:
51
+ - Aaron Newton
52
+ - Guillermo Rauch
53
+ - Christopher Pitt
54
+
55
+ requires:
56
+ - Core/String
57
+ - Core/Array
58
+ - MooTools.More
59
+
60
+ provides: [String.Extras]
61
+
62
+ ...
63
+ */
64
+
65
+ (function(){
66
+
67
+ var special = {
68
+ 'a': /[àáâãäåăą]/g,
69
+ 'A': /[ÀÁÂÃÄÅĂĄ]/g,
70
+ 'c': /[ćčç]/g,
71
+ 'C': /[ĆČÇ]/g,
72
+ 'd': /[ďđ]/g,
73
+ 'D': /[ĎÐ]/g,
74
+ 'e': /[èéêëěę]/g,
75
+ 'E': /[ÈÉÊËĚĘ]/g,
76
+ 'g': /[ğ]/g,
77
+ 'G': /[Ğ]/g,
78
+ 'i': /[ìíîï]/g,
79
+ 'I': /[ÌÍÎÏ]/g,
80
+ 'l': /[ĺľł]/g,
81
+ 'L': /[ĹĽŁ]/g,
82
+ 'n': /[ñňń]/g,
83
+ 'N': /[ÑŇŃ]/g,
84
+ 'o': /[òóôõöøő]/g,
85
+ 'O': /[ÒÓÔÕÖØ]/g,
86
+ 'r': /[řŕ]/g,
87
+ 'R': /[ŘŔ]/g,
88
+ 's': /[ššş]/g,
89
+ 'S': /[ŠŞŚ]/g,
90
+ 't': /[ťţ]/g,
91
+ 'T': /[ŤŢ]/g,
92
+ 'ue': /[ü]/g,
93
+ 'UE': /[Ü]/g,
94
+ 'u': /[ùúûůµ]/g,
95
+ 'U': /[ÙÚÛŮ]/g,
96
+ 'y': /[ÿý]/g,
97
+ 'Y': /[ŸÝ]/g,
98
+ 'z': /[žźż]/g,
99
+ 'Z': /[ŽŹŻ]/g,
100
+ 'th': /[þ]/g,
101
+ 'TH': /[Þ]/g,
102
+ 'dh': /[ð]/g,
103
+ 'DH': /[Ð]/g,
104
+ 'ss': /[ß]/g,
105
+ 'oe': /[œ]/g,
106
+ 'OE': /[Œ]/g,
107
+ 'ae': /[æ]/g,
108
+ 'AE': /[Æ]/g
109
+ },
110
+
111
+ tidy = {
112
+ ' ': /[\xa0\u2002\u2003\u2009]/g,
113
+ '*': /[\xb7]/g,
114
+ '\'': /[\u2018\u2019]/g,
115
+ '"': /[\u201c\u201d]/g,
116
+ '...': /[\u2026]/g,
117
+ '-': /[\u2013]/g,
118
+ // '--': /[\u2014]/g,
119
+ '»': /[\uFFFD]/g
120
+ };
121
+
122
+ var walk = function(string, replacements){
123
+ var result = string, key;
124
+ for (key in replacements) result = result.replace(replacements[key], key);
125
+ return result;
126
+ };
127
+
128
+ var getRegexForTag = function(tag, contents){
129
+ tag = tag || '';
130
+ var regstr = contents ? "<" + tag + "(?!\\w)[^>]*>([\\s\\S]*?)<\/" + tag + "(?!\\w)>" : "<\/?" + tag + "([^>]+)?>",
131
+ reg = new RegExp(regstr, "gi");
132
+ return reg;
133
+ };
134
+
135
+ String.implement({
136
+
137
+ standardize: function(){
138
+ return walk(this, special);
139
+ },
140
+
141
+ repeat: function(times){
142
+ return new Array(times + 1).join(this);
143
+ },
144
+
145
+ pad: function(length, str, direction){
146
+ if (this.length >= length) return this;
147
+
148
+ var pad = (str == null ? ' ' : '' + str)
149
+ .repeat(length - this.length)
150
+ .substr(0, length - this.length);
151
+
152
+ if (!direction || direction == 'right') return this + pad;
153
+ if (direction == 'left') return pad + this;
154
+
155
+ return pad.substr(0, (pad.length / 2).floor()) + this + pad.substr(0, (pad.length / 2).ceil());
156
+ },
157
+
158
+ getTags: function(tag, contents){
159
+ return this.match(getRegexForTag(tag, contents)) || [];
160
+ },
161
+
162
+ stripTags: function(tag, contents){
163
+ return this.replace(getRegexForTag(tag, contents), '');
164
+ },
165
+
166
+ tidy: function(){
167
+ return walk(this, tidy);
168
+ },
169
+
170
+ truncate: function(max, trail, atChar){
171
+ var string = this;
172
+ if (trail == null && arguments.length == 1) trail = '…';
173
+ if (string.length > max){
174
+ string = string.substring(0, max);
175
+ if (atChar){
176
+ var index = string.lastIndexOf(atChar);
177
+ if (index != -1) string = string.substr(0, index);
178
+ }
179
+ if (trail) string += trail;
180
+ }
181
+ return string;
182
+ }
183
+
184
+ });
185
+
186
+ })();
187
+
188
+
189
+ /*
190
+ ---
191
+
192
+ script: Drag.js
193
+
194
+ name: Drag
195
+
196
+ description: The base Drag Class. Can be used to drag and resize Elements using mouse events.
197
+
198
+ license: MIT-style license
199
+
200
+ authors:
201
+ - Valerio Proietti
202
+ - Tom Occhinno
203
+ - Jan Kassens
204
+
205
+ requires:
206
+ - Core/Events
207
+ - Core/Options
208
+ - Core/Element.Event
209
+ - Core/Element.Style
210
+ - Core/Element.Dimensions
211
+ - /MooTools.More
212
+
213
+ provides: [Drag]
214
+ ...
215
+
216
+ */
217
+
218
+ var Drag = new Class({
219
+
220
+ Implements: [Events, Options],
221
+
222
+ options: {/*
223
+ onBeforeStart: function(thisElement){},
224
+ onStart: function(thisElement, event){},
225
+ onSnap: function(thisElement){},
226
+ onDrag: function(thisElement, event){},
227
+ onCancel: function(thisElement){},
228
+ onComplete: function(thisElement, event){},*/
229
+ snap: 6,
230
+ unit: 'px',
231
+ grid: false,
232
+ style: true,
233
+ limit: false,
234
+ handle: false,
235
+ invert: false,
236
+ preventDefault: false,
237
+ stopPropagation: false,
238
+ modifiers: {x: 'left', y: 'top'}
239
+ },
240
+
241
+ initialize: function(){
242
+ var params = Array.link(arguments, {
243
+ 'options': Type.isObject,
244
+ 'element': function(obj){
245
+ return obj != null;
246
+ }
247
+ });
248
+
249
+ this.element = document.id(params.element);
250
+ this.document = this.element.getDocument();
251
+ this.setOptions(params.options || {});
252
+ var htype = typeOf(this.options.handle);
253
+ this.handles = ((htype == 'array' || htype == 'collection') ? $$(this.options.handle) : document.id(this.options.handle)) || this.element;
254
+ this.mouse = {'now': {}, 'pos': {}};
255
+ this.value = {'start': {}, 'now': {}};
256
+
257
+ this.selection = (Browser.ie) ? 'selectstart' : 'mousedown';
258
+
259
+
260
+ if (Browser.ie && !Drag.ondragstartFixed){
261
+ document.ondragstart = Function.from(false);
262
+ Drag.ondragstartFixed = true;
263
+ }
264
+
265
+ this.bound = {
266
+ start: this.start.bind(this),
267
+ check: this.check.bind(this),
268
+ drag: this.drag.bind(this),
269
+ stop: this.stop.bind(this),
270
+ cancel: this.cancel.bind(this),
271
+ eventStop: Function.from(false)
272
+ };
273
+ this.attach();
274
+ },
275
+
276
+ attach: function(){
277
+ this.handles.addEvent('mousedown', this.bound.start);
278
+ return this;
279
+ },
280
+
281
+ detach: function(){
282
+ this.handles.removeEvent('mousedown', this.bound.start);
283
+ return this;
284
+ },
285
+
286
+ start: function(event){
287
+ var options = this.options;
288
+
289
+ if (event.rightClick) return;
290
+
291
+ if (options.preventDefault) event.preventDefault();
292
+ if (options.stopPropagation) event.stopPropagation();
293
+ this.mouse.start = event.page;
294
+
295
+ this.fireEvent('beforeStart', this.element);
296
+
297
+ var limit = options.limit;
298
+ this.limit = {x: [], y: []};
299
+
300
+ var z, coordinates;
301
+ for (z in options.modifiers){
302
+ if (!options.modifiers[z]) continue;
303
+
304
+ var style = this.element.getStyle(options.modifiers[z]);
305
+
306
+ // Some browsers (IE and Opera) don't always return pixels.
307
+ if (style && !style.match(/px$/)){
308
+ if (!coordinates) coordinates = this.element.getCoordinates(this.element.getOffsetParent());
309
+ style = coordinates[options.modifiers[z]];
310
+ }
311
+
312
+ if (options.style) this.value.now[z] = (style || 0).toInt();
313
+ else this.value.now[z] = this.element[options.modifiers[z]];
314
+
315
+ if (options.invert) this.value.now[z] *= -1;
316
+
317
+ this.mouse.pos[z] = event.page[z] - this.value.now[z];
318
+
319
+ if (limit && limit[z]){
320
+ var i = 2;
321
+ while (i--){
322
+ var limitZI = limit[z][i];
323
+ if (limitZI || limitZI === 0) this.limit[z][i] = (typeof limitZI == 'function') ? limitZI() : limitZI;
324
+ }
325
+ }
326
+ }
327
+
328
+ if (typeOf(this.options.grid) == 'number') this.options.grid = {
329
+ x: this.options.grid,
330
+ y: this.options.grid
331
+ };
332
+
333
+ var events = {
334
+ mousemove: this.bound.check,
335
+ mouseup: this.bound.cancel
336
+ };
337
+ events[this.selection] = this.bound.eventStop;
338
+ this.document.addEvents(events);
339
+ },
340
+
341
+ check: function(event){
342
+ if (this.options.preventDefault) event.preventDefault();
343
+ var distance = Math.round(Math.sqrt(Math.pow(event.page.x - this.mouse.start.x, 2) + Math.pow(event.page.y - this.mouse.start.y, 2)));
344
+ if (distance > this.options.snap){
345
+ this.cancel();
346
+ this.document.addEvents({
347
+ mousemove: this.bound.drag,
348
+ mouseup: this.bound.stop
349
+ });
350
+ this.fireEvent('start', [this.element, event]).fireEvent('snap', this.element);
351
+ }
352
+ },
353
+
354
+ drag: function(event){
355
+ var options = this.options;
356
+
357
+ if (options.preventDefault) event.preventDefault();
358
+ this.mouse.now = event.page;
359
+
360
+ for (var z in options.modifiers){
361
+ if (!options.modifiers[z]) continue;
362
+ this.value.now[z] = this.mouse.now[z] - this.mouse.pos[z];
363
+
364
+ if (options.invert) this.value.now[z] *= -1;
365
+
366
+ if (options.limit && this.limit[z]){
367
+ if ((this.limit[z][1] || this.limit[z][1] === 0) && (this.value.now[z] > this.limit[z][1])){
368
+ this.value.now[z] = this.limit[z][1];
369
+ } else if ((this.limit[z][0] || this.limit[z][0] === 0) && (this.value.now[z] < this.limit[z][0])){
370
+ this.value.now[z] = this.limit[z][0];
371
+ }
372
+ }
373
+
374
+ if (options.grid[z]) this.value.now[z] -= ((this.value.now[z] - (this.limit[z][0]||0)) % options.grid[z]);
375
+
376
+ if (options.style) this.element.setStyle(options.modifiers[z], this.value.now[z] + options.unit);
377
+ else this.element[options.modifiers[z]] = this.value.now[z];
378
+ }
379
+
380
+ this.fireEvent('drag', [this.element, event]);
381
+ },
382
+
383
+ cancel: function(event){
384
+ this.document.removeEvents({
385
+ mousemove: this.bound.check,
386
+ mouseup: this.bound.cancel
387
+ });
388
+ if (event){
389
+ this.document.removeEvent(this.selection, this.bound.eventStop);
390
+ this.fireEvent('cancel', this.element);
391
+ }
392
+ },
393
+
394
+ stop: function(event){
395
+ var events = {
396
+ mousemove: this.bound.drag,
397
+ mouseup: this.bound.stop
398
+ };
399
+ events[this.selection] = this.bound.eventStop;
400
+ this.document.removeEvents(events);
401
+ if (event) this.fireEvent('complete', [this.element, event]);
402
+ }
403
+
404
+ });
405
+
406
+ Element.implement({
407
+
408
+ makeResizable: function(options){
409
+ var drag = new Drag(this, Object.merge({
410
+ modifiers: {
411
+ x: 'width',
412
+ y: 'height'
413
+ }
414
+ }, options));
415
+
416
+ this.store('resizer', drag);
417
+ return drag.addEvent('drag', function(){
418
+ this.fireEvent('resize', drag);
419
+ }.bind(this));
420
+ }
421
+
422
+ });
423
+
424
+
425
+ /*
426
+ ---
427
+
428
+ script: Drag.Move.js
429
+
430
+ name: Drag.Move
431
+
432
+ description: A Drag extension that provides support for the constraining of draggables to containers and droppables.
433
+
434
+ license: MIT-style license
435
+
436
+ authors:
437
+ - Valerio Proietti
438
+ - Tom Occhinno
439
+ - Jan Kassens
440
+ - Aaron Newton
441
+ - Scott Kyle
442
+
443
+ requires:
444
+ - Core/Element.Dimensions
445
+ - /Drag
446
+
447
+ provides: [Drag.Move]
448
+
449
+ ...
450
+ */
451
+
452
+ Drag.Move = new Class({
453
+
454
+ Extends: Drag,
455
+
456
+ options: {/*
457
+ onEnter: function(thisElement, overed){},
458
+ onLeave: function(thisElement, overed){},
459
+ onDrop: function(thisElement, overed, event){},*/
460
+ droppables: [],
461
+ container: false,
462
+ precalculate: false,
463
+ includeMargins: true,
464
+ checkDroppables: true
465
+ },
466
+
467
+ initialize: function(element, options){
468
+ this.parent(element, options);
469
+ element = this.element;
470
+
471
+ this.droppables = $$(this.options.droppables);
472
+ this.container = document.id(this.options.container);
473
+
474
+ if (this.container && typeOf(this.container) != 'element')
475
+ this.container = document.id(this.container.getDocument().body);
476
+
477
+ if (this.options.style){
478
+ if (this.options.modifiers.x == 'left' && this.options.modifiers.y == 'top'){
479
+ var parent = element.getOffsetParent(),
480
+ styles = element.getStyles('left', 'top');
481
+ if (parent && (styles.left == 'auto' || styles.top == 'auto')){
482
+ element.setPosition(element.getPosition(parent));
483
+ }
484
+ }
485
+
486
+ if (element.getStyle('position') == 'static') element.setStyle('position', 'absolute');
487
+ }
488
+
489
+ this.addEvent('start', this.checkDroppables, true);
490
+ this.overed = null;
491
+ },
492
+
493
+ start: function(event){
494
+ if (this.container) this.options.limit = this.calculateLimit();
495
+
496
+ if (this.options.precalculate){
497
+ this.positions = this.droppables.map(function(el){
498
+ return el.getCoordinates();
499
+ });
500
+ }
501
+
502
+ this.parent(event);
503
+ },
504
+
505
+ calculateLimit: function(){
506
+ var element = this.element,
507
+ container = this.container,
508
+
509
+ offsetParent = document.id(element.getOffsetParent()) || document.body,
510
+ containerCoordinates = container.getCoordinates(offsetParent),
511
+ elementMargin = {},
512
+ elementBorder = {},
513
+ containerMargin = {},
514
+ containerBorder = {},
515
+ offsetParentPadding = {};
516
+
517
+ ['top', 'right', 'bottom', 'left'].each(function(pad){
518
+ elementMargin[pad] = element.getStyle('margin-' + pad).toInt();
519
+ elementBorder[pad] = element.getStyle('border-' + pad).toInt();
520
+ containerMargin[pad] = container.getStyle('margin-' + pad).toInt();
521
+ containerBorder[pad] = container.getStyle('border-' + pad).toInt();
522
+ offsetParentPadding[pad] = offsetParent.getStyle('padding-' + pad).toInt();
523
+ }, this);
524
+
525
+ var width = element.offsetWidth + elementMargin.left + elementMargin.right,
526
+ height = element.offsetHeight + elementMargin.top + elementMargin.bottom,
527
+ left = 0,
528
+ top = 0,
529
+ right = containerCoordinates.right - containerBorder.right - width,
530
+ bottom = containerCoordinates.bottom - containerBorder.bottom - height;
531
+
532
+ if (this.options.includeMargins){
533
+ left += elementMargin.left;
534
+ top += elementMargin.top;
535
+ } else {
536
+ right += elementMargin.right;
537
+ bottom += elementMargin.bottom;
538
+ }
539
+
540
+ if (element.getStyle('position') == 'relative'){
541
+ var coords = element.getCoordinates(offsetParent);
542
+ coords.left -= element.getStyle('left').toInt();
543
+ coords.top -= element.getStyle('top').toInt();
544
+
545
+ left -= coords.left;
546
+ top -= coords.top;
547
+ if (container.getStyle('position') != 'relative'){
548
+ left += containerBorder.left;
549
+ top += containerBorder.top;
550
+ }
551
+ right += elementMargin.left - coords.left;
552
+ bottom += elementMargin.top - coords.top;
553
+
554
+ if (container != offsetParent){
555
+ left += containerMargin.left + offsetParentPadding.left;
556
+ top += ((Browser.ie6 || Browser.ie7) ? 0 : containerMargin.top) + offsetParentPadding.top;
557
+ }
558
+ } else {
559
+ left -= elementMargin.left;
560
+ top -= elementMargin.top;
561
+ if (container != offsetParent){
562
+ left += containerCoordinates.left + containerBorder.left;
563
+ top += containerCoordinates.top + containerBorder.top;
564
+ }
565
+ }
566
+
567
+ return {
568
+ x: [left, right],
569
+ y: [top, bottom]
570
+ };
571
+ },
572
+
573
+ getDroppableCoordinates: function(element){
574
+ var position = element.getCoordinates();
575
+ if (element.getStyle('position') == 'fixed'){
576
+ var scroll = window.getScroll();
577
+ position.left += scroll.x;
578
+ position.right += scroll.x;
579
+ position.top += scroll.y;
580
+ position.bottom += scroll.y;
581
+ }
582
+ return position;
583
+ },
584
+
585
+ checkDroppables: function(){
586
+ var overed = this.droppables.filter(function(el, i){
587
+ el = this.positions ? this.positions[i] : this.getDroppableCoordinates(el);
588
+ var now = this.mouse.now;
589
+ return (now.x > el.left && now.x < el.right && now.y < el.bottom && now.y > el.top);
590
+ }, this).getLast();
591
+
592
+ if (this.overed != overed){
593
+ if (this.overed) this.fireEvent('leave', [this.element, this.overed]);
594
+ if (overed) this.fireEvent('enter', [this.element, overed]);
595
+ this.overed = overed;
596
+ }
597
+ },
598
+
599
+ drag: function(event){
600
+ this.parent(event);
601
+ if (this.options.checkDroppables && this.droppables.length) this.checkDroppables();
602
+ },
603
+
604
+ stop: function(event){
605
+ this.checkDroppables();
606
+ this.fireEvent('drop', [this.element, this.overed, event]);
607
+ this.overed = null;
608
+ return this.parent(event);
609
+ }
610
+
611
+ });
612
+
613
+ Element.implement({
614
+
615
+ makeDraggable: function(options){
616
+ var drag = new Drag.Move(this, options);
617
+ this.store('dragger', drag);
618
+ return drag;
619
+ }
620
+
621
+ });
622
+
623
+
624
+ /*
625
+ ---
626
+
627
+ script: Sortables.js
628
+
629
+ name: Sortables
630
+
631
+ description: Class for creating a drag and drop sorting interface for lists of items.
632
+
633
+ license: MIT-style license
634
+
635
+ authors:
636
+ - Tom Occhino
637
+
638
+ requires:
639
+ - Core/Fx.Morph
640
+ - /Drag.Move
641
+
642
+ provides: [Sortables]
643
+
644
+ ...
645
+ */
646
+
647
+ var Sortables = new Class({
648
+
649
+ Implements: [Events, Options],
650
+
651
+ options: {/*
652
+ onSort: function(element, clone){},
653
+ onStart: function(element, clone){},
654
+ onComplete: function(element){},*/
655
+ opacity: 1,
656
+ clone: false,
657
+ revert: false,
658
+ handle: false,
659
+ dragOptions: {}
660
+ },
661
+
662
+ initialize: function(lists, options){
663
+ this.setOptions(options);
664
+
665
+ this.elements = [];
666
+ this.lists = [];
667
+ this.idle = true;
668
+
669
+ this.addLists($$(document.id(lists) || lists));
670
+
671
+ if (!this.options.clone) this.options.revert = false;
672
+ if (this.options.revert) this.effect = new Fx.Morph(null, Object.merge({
673
+ duration: 250,
674
+ link: 'cancel'
675
+ }, this.options.revert));
676
+ },
677
+
678
+ attach: function(){
679
+ this.addLists(this.lists);
680
+ return this;
681
+ },
682
+
683
+ detach: function(){
684
+ this.lists = this.removeLists(this.lists);
685
+ return this;
686
+ },
687
+
688
+ addItems: function(){
689
+ Array.flatten(arguments).each(function(element){
690
+ this.elements.push(element);
691
+ var start = element.retrieve('sortables:start', function(event){
692
+ this.start.call(this, event, element);
693
+ }.bind(this));
694
+ (this.options.handle ? element.getElement(this.options.handle) || element : element).addEvent('mousedown', start);
695
+ }, this);
696
+ return this;
697
+ },
698
+
699
+ addLists: function(){
700
+ Array.flatten(arguments).each(function(list){
701
+ this.lists.include(list);
702
+ this.addItems(list.getChildren());
703
+ }, this);
704
+ return this;
705
+ },
706
+
707
+ removeItems: function(){
708
+ return $$(Array.flatten(arguments).map(function(element){
709
+ this.elements.erase(element);
710
+ var start = element.retrieve('sortables:start');
711
+ (this.options.handle ? element.getElement(this.options.handle) || element : element).removeEvent('mousedown', start);
712
+
713
+ return element;
714
+ }, this));
715
+ },
716
+
717
+ removeLists: function(){
718
+ return $$(Array.flatten(arguments).map(function(list){
719
+ this.lists.erase(list);
720
+ this.removeItems(list.getChildren());
721
+
722
+ return list;
723
+ }, this));
724
+ },
725
+
726
+ getClone: function(event, element){
727
+ if (!this.options.clone) return new Element(element.tagName).inject(document.body);
728
+ if (typeOf(this.options.clone) == 'function') return this.options.clone.call(this, event, element, this.list);
729
+ var clone = element.clone(true).setStyles({
730
+ margin: 0,
731
+ position: 'absolute',
732
+ visibility: 'hidden',
733
+ width: element.getStyle('width')
734
+ }).addEvent('mousedown', function(event){
735
+ element.fireEvent('mousedown', event);
736
+ });
737
+ //prevent the duplicated radio inputs from unchecking the real one
738
+ if (clone.get('html').test('radio')){
739
+ clone.getElements('input[type=radio]').each(function(input, i){
740
+ input.set('name', 'clone_' + i);
741
+ if (input.get('checked')) element.getElements('input[type=radio]')[i].set('checked', true);
742
+ });
743
+ }
744
+
745
+ return clone.inject(this.list).setPosition(element.getPosition(element.getOffsetParent()));
746
+ },
747
+
748
+ getDroppables: function(){
749
+ var droppables = this.list.getChildren().erase(this.clone).erase(this.element);
750
+ if (!this.options.constrain) droppables.append(this.lists).erase(this.list);
751
+ return droppables;
752
+ },
753
+
754
+ insert: function(dragging, element){
755
+ var where = 'inside';
756
+ if (this.lists.contains(element)){
757
+ this.list = element;
758
+ this.drag.droppables = this.getDroppables();
759
+ } else {
760
+ where = this.element.getAllPrevious().contains(element) ? 'before' : 'after';
761
+ }
762
+ this.element.inject(element, where);
763
+ this.fireEvent('sort', [this.element, this.clone]);
764
+ },
765
+
766
+ start: function(event, element){
767
+ if (
768
+ !this.idle ||
769
+ event.rightClick ||
770
+ ['button', 'input', 'a', 'textarea'].contains(event.target.get('tag'))
771
+ ) return;
772
+
773
+ this.idle = false;
774
+ this.element = element;
775
+ this.opacity = element.getStyle('opacity');
776
+ this.list = element.getParent();
777
+ this.clone = this.getClone(event, element);
778
+
779
+ this.drag = new Drag.Move(this.clone, Object.merge({
780
+
781
+ droppables: this.getDroppables()
782
+ }, this.options.dragOptions)).addEvents({
783
+ onSnap: function(){
784
+ event.stop();
785
+ this.clone.setStyle('visibility', 'visible');
786
+ this.element.setStyle('opacity', this.options.opacity || 0);
787
+ this.fireEvent('start', [this.element, this.clone]);
788
+ }.bind(this),
789
+ onEnter: this.insert.bind(this),
790
+ onCancel: this.end.bind(this),
791
+ onComplete: this.end.bind(this)
792
+ });
793
+
794
+ this.clone.inject(this.element, 'before');
795
+ this.drag.start(event);
796
+ },
797
+
798
+ end: function(){
799
+ this.drag.detach();
800
+ this.element.setStyle('opacity', this.opacity);
801
+ if (this.effect){
802
+ var dim = this.element.getStyles('width', 'height'),
803
+ clone = this.clone,
804
+ pos = clone.computePosition(this.element.getPosition(this.clone.getOffsetParent()));
805
+
806
+ var destroy = function(){
807
+ this.removeEvent('cancel', destroy);
808
+ clone.destroy();
809
+ };
810
+
811
+ this.effect.element = clone;
812
+ this.effect.start({
813
+ top: pos.top,
814
+ left: pos.left,
815
+ width: dim.width,
816
+ height: dim.height,
817
+ opacity: 0.25
818
+ }).addEvent('cancel', destroy).chain(destroy);
819
+ } else {
820
+ this.clone.destroy();
821
+ }
822
+ this.reset();
823
+ },
824
+
825
+ reset: function(){
826
+ this.idle = true;
827
+ this.fireEvent('complete', this.element);
828
+ },
829
+
830
+ serialize: function(){
831
+ var params = Array.link(arguments, {
832
+ modifier: Type.isFunction,
833
+ index: function(obj){
834
+ return obj != null;
835
+ }
836
+ });
837
+ var serial = this.lists.map(function(list){
838
+ return list.getChildren().map(params.modifier || function(element){
839
+ return element.get('id');
840
+ }, this);
841
+ }, this);
842
+
843
+ var index = params.index;
844
+ if (this.lists.length == 1) index = 0;
845
+ return (index || index === 0) && index >= 0 && index < this.lists.length ? serial[index] : serial;
846
+ }
847
+
848
+ });
849
+
850
+
851
+ /*
852
+ ---
853
+
854
+ script: Object.Extras.js
855
+
856
+ name: Object.Extras
857
+
858
+ description: Extra Object generics, like getFromPath which allows a path notation to child elements.
859
+
860
+ license: MIT-style license
861
+
862
+ authors:
863
+ - Aaron Newton
864
+
865
+ requires:
866
+ - Core/Object
867
+ - /MooTools.More
868
+
869
+ provides: [Object.Extras]
870
+
871
+ ...
872
+ */
873
+
874
+ (function(){
875
+
876
+ var defined = function(value){
877
+ return value != null;
878
+ };
879
+
880
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
881
+
882
+ Object.extend({
883
+
884
+ getFromPath: function(source, parts){
885
+ if (typeof parts == 'string') parts = parts.split('.');
886
+ for (var i = 0, l = parts.length; i < l; i++){
887
+ if (hasOwnProperty.call(source, parts[i])) source = source[parts[i]];
888
+ else return null;
889
+ }
890
+ return source;
891
+ },
892
+
893
+ cleanValues: function(object, method){
894
+ method = method || defined;
895
+ for (var key in object) if (!method(object[key])){
896
+ delete object[key];
897
+ }
898
+ return object;
899
+ },
900
+
901
+ erase: function(object, key){
902
+ if (hasOwnProperty.call(object, key)) delete object[key];
903
+ return object;
904
+ },
905
+
906
+ run: function(object){
907
+ var args = Array.slice(arguments, 1);
908
+ for (var key in object) if (object[key].apply){
909
+ object[key].apply(object, args);
910
+ }
911
+ return object;
912
+ }
913
+
914
+ });
915
+
916
+ })();
917
+
918
+
919
+ /*
920
+ ---
921
+
922
+ script: Locale.js
923
+
924
+ name: Locale
925
+
926
+ description: Provides methods for localization.
927
+
928
+ license: MIT-style license
929
+
930
+ authors:
931
+ - Aaron Newton
932
+ - Arian Stolwijk
933
+
934
+ requires:
935
+ - Core/Events
936
+ - /Object.Extras
937
+ - /MooTools.More
938
+
939
+ provides: [Locale, Lang]
940
+
941
+ ...
942
+ */
943
+
944
+ (function(){
945
+
946
+ var current = null,
947
+ locales = {},
948
+ inherits = {};
949
+
950
+ var getSet = function(set){
951
+ if (instanceOf(set, Locale.Set)) return set;
952
+ else return locales[set];
953
+ };
954
+
955
+ var Locale = this.Locale = {
956
+
957
+ define: function(locale, set, key, value){
958
+ var name;
959
+ if (instanceOf(locale, Locale.Set)){
960
+ name = locale.name;
961
+ if (name) locales[name] = locale;
962
+ } else {
963
+ name = locale;
964
+ if (!locales[name]) locales[name] = new Locale.Set(name);
965
+ locale = locales[name];
966
+ }
967
+
968
+ if (set) locale.define(set, key, value);
969
+
970
+
971
+
972
+ if (!current) current = locale;
973
+
974
+ return locale;
975
+ },
976
+
977
+ use: function(locale){
978
+ locale = getSet(locale);
979
+
980
+ if (locale){
981
+ current = locale;
982
+
983
+ this.fireEvent('change', locale);
984
+
985
+
986
+ }
987
+
988
+ return this;
989
+ },
990
+
991
+ getCurrent: function(){
992
+ return current;
993
+ },
994
+
995
+ get: function(key, args){
996
+ return (current) ? current.get(key, args) : '';
997
+ },
998
+
999
+ inherit: function(locale, inherits, set){
1000
+ locale = getSet(locale);
1001
+
1002
+ if (locale) locale.inherit(inherits, set);
1003
+ return this;
1004
+ },
1005
+
1006
+ list: function(){
1007
+ return Object.keys(locales);
1008
+ }
1009
+
1010
+ };
1011
+
1012
+ Object.append(Locale, new Events);
1013
+
1014
+ Locale.Set = new Class({
1015
+
1016
+ sets: {},
1017
+
1018
+ inherits: {
1019
+ locales: [],
1020
+ sets: {}
1021
+ },
1022
+
1023
+ initialize: function(name){
1024
+ this.name = name || '';
1025
+ },
1026
+
1027
+ define: function(set, key, value){
1028
+ var defineData = this.sets[set];
1029
+ if (!defineData) defineData = {};
1030
+
1031
+ if (key){
1032
+ if (typeOf(key) == 'object') defineData = Object.merge(defineData, key);
1033
+ else defineData[key] = value;
1034
+ }
1035
+ this.sets[set] = defineData;
1036
+
1037
+ return this;
1038
+ },
1039
+
1040
+ get: function(key, args, _base){
1041
+ var value = Object.getFromPath(this.sets, key);
1042
+ if (value != null){
1043
+ var type = typeOf(value);
1044
+ if (type == 'function') value = value.apply(null, Array.from(args));
1045
+ else if (type == 'object') value = Object.clone(value);
1046
+ return value;
1047
+ }
1048
+
1049
+ // get value of inherited locales
1050
+ var index = key.indexOf('.'),
1051
+ set = index < 0 ? key : key.substr(0, index),
1052
+ names = (this.inherits.sets[set] || []).combine(this.inherits.locales).include('en-US');
1053
+ if (!_base) _base = [];
1054
+
1055
+ for (var i = 0, l = names.length; i < l; i++){
1056
+ if (_base.contains(names[i])) continue;
1057
+ _base.include(names[i]);
1058
+
1059
+ var locale = locales[names[i]];
1060
+ if (!locale) continue;
1061
+
1062
+ value = locale.get(key, args, _base);
1063
+ if (value != null) return value;
1064
+ }
1065
+
1066
+ return '';
1067
+ },
1068
+
1069
+ inherit: function(names, set){
1070
+ names = Array.from(names);
1071
+
1072
+ if (set && !this.inherits.sets[set]) this.inherits.sets[set] = [];
1073
+
1074
+ var l = names.length;
1075
+ while (l--) (set ? this.inherits.sets[set] : this.inherits.locales).unshift(names[l]);
1076
+
1077
+ return this;
1078
+ }
1079
+
1080
+ });
1081
+
1082
+
1083
+
1084
+ })();
1085
+
1086
+
1087
+ /*
1088
+ ---
1089
+
1090
+ name: Locale.en-US.Date
1091
+
1092
+ description: Date messages for US English.
1093
+
1094
+ license: MIT-style license
1095
+
1096
+ authors:
1097
+ - Aaron Newton
1098
+
1099
+ requires:
1100
+ - /Locale
1101
+
1102
+ provides: [Locale.en-US.Date]
1103
+
1104
+ ...
1105
+ */
1106
+
1107
+ Locale.define('en-US', 'Date', {
1108
+
1109
+ months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
1110
+ months_abbr: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
1111
+ days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
1112
+ days_abbr: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
1113
+
1114
+ // Culture's date order: MM/DD/YYYY
1115
+ dateOrder: ['month', 'date', 'year'],
1116
+ shortDate: '%m/%d/%Y',
1117
+ shortTime: '%I:%M%p',
1118
+ AM: 'AM',
1119
+ PM: 'PM',
1120
+ firstDayOfWeek: 0,
1121
+
1122
+ // Date.Extras
1123
+ ordinal: function(dayOfMonth){
1124
+ // 1st, 2nd, 3rd, etc.
1125
+ return (dayOfMonth > 3 && dayOfMonth < 21) ? 'th' : ['th', 'st', 'nd', 'rd', 'th'][Math.min(dayOfMonth % 10, 4)];
1126
+ },
1127
+
1128
+ lessThanMinuteAgo: 'less than a minute ago',
1129
+ minuteAgo: 'about a minute ago',
1130
+ minutesAgo: '{delta} minutes ago',
1131
+ hourAgo: 'about an hour ago',
1132
+ hoursAgo: 'about {delta} hours ago',
1133
+ dayAgo: '1 day ago',
1134
+ daysAgo: '{delta} days ago',
1135
+ weekAgo: '1 week ago',
1136
+ weeksAgo: '{delta} weeks ago',
1137
+ monthAgo: '1 month ago',
1138
+ monthsAgo: '{delta} months ago',
1139
+ yearAgo: '1 year ago',
1140
+ yearsAgo: '{delta} years ago',
1141
+
1142
+ lessThanMinuteUntil: 'less than a minute from now',
1143
+ minuteUntil: 'about a minute from now',
1144
+ minutesUntil: '{delta} minutes from now',
1145
+ hourUntil: 'about an hour from now',
1146
+ hoursUntil: 'about {delta} hours from now',
1147
+ dayUntil: '1 day from now',
1148
+ daysUntil: '{delta} days from now',
1149
+ weekUntil: '1 week from now',
1150
+ weeksUntil: '{delta} weeks from now',
1151
+ monthUntil: '1 month from now',
1152
+ monthsUntil: '{delta} months from now',
1153
+ yearUntil: '1 year from now',
1154
+ yearsUntil: '{delta} years from now'
1155
+
1156
+ });
1157
+
1158
+
1159
+ /*
1160
+ ---
1161
+
1162
+ name: Locale.de-DE.Date
1163
+
1164
+ description: Date messages for German.
1165
+
1166
+ license: MIT-style license
1167
+
1168
+ authors:
1169
+ - Christoph Pojer
1170
+ - Frank Rossi
1171
+ - Ulrich Petri
1172
+ - Fabian Beiner
1173
+
1174
+ requires:
1175
+ - /Locale
1176
+
1177
+ provides: [Locale.de-DE.Date]
1178
+
1179
+ ...
1180
+ */
1181
+
1182
+ Locale.define('de-DE', 'Date', {
1183
+
1184
+ months: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
1185
+ months_abbr: ['Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'],
1186
+ days: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'],
1187
+ days_abbr: ['So.', 'Mo.', 'Di.', 'Mi.', 'Do.', 'Fr.', 'Sa.'],
1188
+
1189
+ // Culture's date order: DD.MM.YYYY
1190
+ dateOrder: ['date', 'month', 'year'],
1191
+ shortDate: '%d.%m.%Y',
1192
+ shortTime: '%H:%M',
1193
+ AM: 'vormittags',
1194
+ PM: 'nachmittags',
1195
+ firstDayOfWeek: 1,
1196
+
1197
+ // Date.Extras
1198
+ ordinal: '.',
1199
+
1200
+ lessThanMinuteAgo: 'vor weniger als einer Minute',
1201
+ minuteAgo: 'vor einer Minute',
1202
+ minutesAgo: 'vor {delta} Minuten',
1203
+ hourAgo: 'vor einer Stunde',
1204
+ hoursAgo: 'vor {delta} Stunden',
1205
+ dayAgo: 'vor einem Tag',
1206
+ daysAgo: 'vor {delta} Tagen',
1207
+ weekAgo: 'vor einer Woche',
1208
+ weeksAgo: 'vor {delta} Wochen',
1209
+ monthAgo: 'vor einem Monat',
1210
+ monthsAgo: 'vor {delta} Monaten',
1211
+ yearAgo: 'vor einem Jahr',
1212
+ yearsAgo: 'vor {delta} Jahren',
1213
+
1214
+ lessThanMinuteUntil: 'in weniger als einer Minute',
1215
+ minuteUntil: 'in einer Minute',
1216
+ minutesUntil: 'in {delta} Minuten',
1217
+ hourUntil: 'in ca. einer Stunde',
1218
+ hoursUntil: 'in ca. {delta} Stunden',
1219
+ dayUntil: 'in einem Tag',
1220
+ daysUntil: 'in {delta} Tagen',
1221
+ weekUntil: 'in einer Woche',
1222
+ weeksUntil: 'in {delta} Wochen',
1223
+ monthUntil: 'in einem Monat',
1224
+ monthsUntil: 'in {delta} Monaten',
1225
+ yearUntil: 'in einem Jahr',
1226
+ yearsUntil: 'in {delta} Jahren'
1227
+
1228
+ });
1229
+