bhf 0.7.5 → 0.7.7

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,2500 +0,0 @@
1
- // MooTools: the javascript framework.
2
- // Load this file's selection again by visiting: http://mootools.net/more/335fff3ee615958016e5569b21c1d4cf
3
- // Or build this file again with packager using: packager build More/Date More/String.Extras More/Sortables More/Assets More/IframeShim 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: Object.Extras.js
43
-
44
- name: Object.Extras
45
-
46
- description: Extra Object generics, like getFromPath which allows a path notation to child elements.
47
-
48
- license: MIT-style license
49
-
50
- authors:
51
- - Aaron Newton
52
-
53
- requires:
54
- - Core/Object
55
- - /MooTools.More
56
-
57
- provides: [Object.Extras]
58
-
59
- ...
60
- */
61
-
62
- (function(){
63
-
64
- var defined = function(value){
65
- return value != null;
66
- };
67
-
68
- var hasOwnProperty = Object.prototype.hasOwnProperty;
69
-
70
- Object.extend({
71
-
72
- getFromPath: function(source, parts){
73
- if (typeof parts == 'string') parts = parts.split('.');
74
- for (var i = 0, l = parts.length; i < l; i++){
75
- if (hasOwnProperty.call(source, parts[i])) source = source[parts[i]];
76
- else return null;
77
- }
78
- return source;
79
- },
80
-
81
- cleanValues: function(object, method){
82
- method = method || defined;
83
- for (var key in object) if (!method(object[key])){
84
- delete object[key];
85
- }
86
- return object;
87
- },
88
-
89
- erase: function(object, key){
90
- if (hasOwnProperty.call(object, key)) delete object[key];
91
- return object;
92
- },
93
-
94
- run: function(object){
95
- var args = Array.slice(arguments, 1);
96
- for (var key in object) if (object[key].apply){
97
- object[key].apply(object, args);
98
- }
99
- return object;
100
- }
101
-
102
- });
103
-
104
- })();
105
-
106
-
107
- /*
108
- ---
109
-
110
- script: Locale.js
111
-
112
- name: Locale
113
-
114
- description: Provides methods for localization.
115
-
116
- license: MIT-style license
117
-
118
- authors:
119
- - Aaron Newton
120
- - Arian Stolwijk
121
-
122
- requires:
123
- - Core/Events
124
- - /Object.Extras
125
- - /MooTools.More
126
-
127
- provides: [Locale, Lang]
128
-
129
- ...
130
- */
131
-
132
- (function(){
133
-
134
- var current = null,
135
- locales = {},
136
- inherits = {};
137
-
138
- var getSet = function(set){
139
- if (instanceOf(set, Locale.Set)) return set;
140
- else return locales[set];
141
- };
142
-
143
- var Locale = this.Locale = {
144
-
145
- define: function(locale, set, key, value){
146
- var name;
147
- if (instanceOf(locale, Locale.Set)){
148
- name = locale.name;
149
- if (name) locales[name] = locale;
150
- } else {
151
- name = locale;
152
- if (!locales[name]) locales[name] = new Locale.Set(name);
153
- locale = locales[name];
154
- }
155
-
156
- if (set) locale.define(set, key, value);
157
-
158
-
159
-
160
- if (!current) current = locale;
161
-
162
- return locale;
163
- },
164
-
165
- use: function(locale){
166
- locale = getSet(locale);
167
-
168
- if (locale){
169
- current = locale;
170
-
171
- this.fireEvent('change', locale);
172
-
173
-
174
- }
175
-
176
- return this;
177
- },
178
-
179
- getCurrent: function(){
180
- return current;
181
- },
182
-
183
- get: function(key, args){
184
- return (current) ? current.get(key, args) : '';
185
- },
186
-
187
- inherit: function(locale, inherits, set){
188
- locale = getSet(locale);
189
-
190
- if (locale) locale.inherit(inherits, set);
191
- return this;
192
- },
193
-
194
- list: function(){
195
- return Object.keys(locales);
196
- }
197
-
198
- };
199
-
200
- Object.append(Locale, new Events);
201
-
202
- Locale.Set = new Class({
203
-
204
- sets: {},
205
-
206
- inherits: {
207
- locales: [],
208
- sets: {}
209
- },
210
-
211
- initialize: function(name){
212
- this.name = name || '';
213
- },
214
-
215
- define: function(set, key, value){
216
- var defineData = this.sets[set];
217
- if (!defineData) defineData = {};
218
-
219
- if (key){
220
- if (typeOf(key) == 'object') defineData = Object.merge(defineData, key);
221
- else defineData[key] = value;
222
- }
223
- this.sets[set] = defineData;
224
-
225
- return this;
226
- },
227
-
228
- get: function(key, args, _base){
229
- var value = Object.getFromPath(this.sets, key);
230
- if (value != null){
231
- var type = typeOf(value);
232
- if (type == 'function') value = value.apply(null, Array.from(args));
233
- else if (type == 'object') value = Object.clone(value);
234
- return value;
235
- }
236
-
237
- // get value of inherited locales
238
- var index = key.indexOf('.'),
239
- set = index < 0 ? key : key.substr(0, index),
240
- names = (this.inherits.sets[set] || []).combine(this.inherits.locales).include('en-US');
241
- if (!_base) _base = [];
242
-
243
- for (var i = 0, l = names.length; i < l; i++){
244
- if (_base.contains(names[i])) continue;
245
- _base.include(names[i]);
246
-
247
- var locale = locales[names[i]];
248
- if (!locale) continue;
249
-
250
- value = locale.get(key, args, _base);
251
- if (value != null) return value;
252
- }
253
-
254
- return '';
255
- },
256
-
257
- inherit: function(names, set){
258
- names = Array.from(names);
259
-
260
- if (set && !this.inherits.sets[set]) this.inherits.sets[set] = [];
261
-
262
- var l = names.length;
263
- while (l--) (set ? this.inherits.sets[set] : this.inherits.locales).unshift(names[l]);
264
-
265
- return this;
266
- }
267
-
268
- });
269
-
270
-
271
-
272
- })();
273
-
274
-
275
- /*
276
- ---
277
-
278
- name: Locale.en-US.Date
279
-
280
- description: Date messages for US English.
281
-
282
- license: MIT-style license
283
-
284
- authors:
285
- - Aaron Newton
286
-
287
- requires:
288
- - /Locale
289
-
290
- provides: [Locale.en-US.Date]
291
-
292
- ...
293
- */
294
-
295
- Locale.define('en-US', 'Date', {
296
-
297
- months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
298
- months_abbr: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
299
- days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
300
- days_abbr: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
301
-
302
- // Culture's date order: MM/DD/YYYY
303
- dateOrder: ['month', 'date', 'year'],
304
- shortDate: '%m/%d/%Y',
305
- shortTime: '%I:%M%p',
306
- AM: 'AM',
307
- PM: 'PM',
308
- firstDayOfWeek: 0,
309
-
310
- // Date.Extras
311
- ordinal: function(dayOfMonth){
312
- // 1st, 2nd, 3rd, etc.
313
- return (dayOfMonth > 3 && dayOfMonth < 21) ? 'th' : ['th', 'st', 'nd', 'rd', 'th'][Math.min(dayOfMonth % 10, 4)];
314
- },
315
-
316
- lessThanMinuteAgo: 'less than a minute ago',
317
- minuteAgo: 'about a minute ago',
318
- minutesAgo: '{delta} minutes ago',
319
- hourAgo: 'about an hour ago',
320
- hoursAgo: 'about {delta} hours ago',
321
- dayAgo: '1 day ago',
322
- daysAgo: '{delta} days ago',
323
- weekAgo: '1 week ago',
324
- weeksAgo: '{delta} weeks ago',
325
- monthAgo: '1 month ago',
326
- monthsAgo: '{delta} months ago',
327
- yearAgo: '1 year ago',
328
- yearsAgo: '{delta} years ago',
329
-
330
- lessThanMinuteUntil: 'less than a minute from now',
331
- minuteUntil: 'about a minute from now',
332
- minutesUntil: '{delta} minutes from now',
333
- hourUntil: 'about an hour from now',
334
- hoursUntil: 'about {delta} hours from now',
335
- dayUntil: '1 day from now',
336
- daysUntil: '{delta} days from now',
337
- weekUntil: '1 week from now',
338
- weeksUntil: '{delta} weeks from now',
339
- monthUntil: '1 month from now',
340
- monthsUntil: '{delta} months from now',
341
- yearUntil: '1 year from now',
342
- yearsUntil: '{delta} years from now'
343
-
344
- });
345
-
346
-
347
- /*
348
- ---
349
-
350
- script: Date.js
351
-
352
- name: Date
353
-
354
- description: Extends the Date native object to include methods useful in managing dates.
355
-
356
- license: MIT-style license
357
-
358
- authors:
359
- - Aaron Newton
360
- - Nicholas Barthelemy - https://svn.nbarthelemy.com/date-js/
361
- - Harald Kirshner - mail [at] digitarald.de; http://digitarald.de
362
- - Scott Kyle - scott [at] appden.com; http://appden.com
363
-
364
- requires:
365
- - Core/Array
366
- - Core/String
367
- - Core/Number
368
- - MooTools.More
369
- - Locale
370
- - Locale.en-US.Date
371
-
372
- provides: [Date]
373
-
374
- ...
375
- */
376
-
377
- (function(){
378
-
379
- var Date = this.Date;
380
-
381
- var DateMethods = Date.Methods = {
382
- ms: 'Milliseconds',
383
- year: 'FullYear',
384
- min: 'Minutes',
385
- mo: 'Month',
386
- sec: 'Seconds',
387
- hr: 'Hours'
388
- };
389
-
390
- ['Date', 'Day', 'FullYear', 'Hours', 'Milliseconds', 'Minutes', 'Month', 'Seconds', 'Time', 'TimezoneOffset',
391
- 'Week', 'Timezone', 'GMTOffset', 'DayOfYear', 'LastMonth', 'LastDayOfMonth', 'UTCDate', 'UTCDay', 'UTCFullYear',
392
- 'AMPM', 'Ordinal', 'UTCHours', 'UTCMilliseconds', 'UTCMinutes', 'UTCMonth', 'UTCSeconds', 'UTCMilliseconds'].each(function(method){
393
- Date.Methods[method.toLowerCase()] = method;
394
- });
395
-
396
- var pad = function(n, digits, string){
397
- if (digits == 1) return n;
398
- return n < Math.pow(10, digits - 1) ? (string || '0') + pad(n, digits - 1, string) : n;
399
- };
400
-
401
- Date.implement({
402
-
403
- set: function(prop, value){
404
- prop = prop.toLowerCase();
405
- var method = DateMethods[prop] && 'set' + DateMethods[prop];
406
- if (method && this[method]) this[method](value);
407
- return this;
408
- }.overloadSetter(),
409
-
410
- get: function(prop){
411
- prop = prop.toLowerCase();
412
- var method = DateMethods[prop] && 'get' + DateMethods[prop];
413
- if (method && this[method]) return this[method]();
414
- return null;
415
- }.overloadGetter(),
416
-
417
- clone: function(){
418
- return new Date(this.get('time'));
419
- },
420
-
421
- increment: function(interval, times){
422
- interval = interval || 'day';
423
- times = times != null ? times : 1;
424
-
425
- switch (interval){
426
- case 'year':
427
- return this.increment('month', times * 12);
428
- case 'month':
429
- var d = this.get('date');
430
- this.set('date', 1).set('mo', this.get('mo') + times);
431
- return this.set('date', d.min(this.get('lastdayofmonth')));
432
- case 'week':
433
- return this.increment('day', times * 7);
434
- case 'day':
435
- return this.set('date', this.get('date') + times);
436
- }
437
-
438
- if (!Date.units[interval]) throw new Error(interval + ' is not a supported interval');
439
-
440
- return this.set('time', this.get('time') + times * Date.units[interval]());
441
- },
442
-
443
- decrement: function(interval, times){
444
- return this.increment(interval, -1 * (times != null ? times : 1));
445
- },
446
-
447
- isLeapYear: function(){
448
- return Date.isLeapYear(this.get('year'));
449
- },
450
-
451
- clearTime: function(){
452
- return this.set({hr: 0, min: 0, sec: 0, ms: 0});
453
- },
454
-
455
- diff: function(date, resolution){
456
- if (typeOf(date) == 'string') date = Date.parse(date);
457
-
458
- return ((date - this) / Date.units[resolution || 'day'](3, 3)).round(); // non-leap year, 30-day month
459
- },
460
-
461
- getLastDayOfMonth: function(){
462
- return Date.daysInMonth(this.get('mo'), this.get('year'));
463
- },
464
-
465
- getDayOfYear: function(){
466
- return (Date.UTC(this.get('year'), this.get('mo'), this.get('date') + 1)
467
- - Date.UTC(this.get('year'), 0, 1)) / Date.units.day();
468
- },
469
-
470
- setDay: function(day, firstDayOfWeek){
471
- if (firstDayOfWeek == null){
472
- firstDayOfWeek = Date.getMsg('firstDayOfWeek');
473
- if (firstDayOfWeek === '') firstDayOfWeek = 1;
474
- }
475
-
476
- day = (7 + Date.parseDay(day, true) - firstDayOfWeek) % 7;
477
- var currentDay = (7 + this.get('day') - firstDayOfWeek) % 7;
478
-
479
- return this.increment('day', day - currentDay);
480
- },
481
-
482
- getWeek: function(firstDayOfWeek){
483
- if (firstDayOfWeek == null){
484
- firstDayOfWeek = Date.getMsg('firstDayOfWeek');
485
- if (firstDayOfWeek === '') firstDayOfWeek = 1;
486
- }
487
-
488
- var date = this,
489
- dayOfWeek = (7 + date.get('day') - firstDayOfWeek) % 7,
490
- dividend = 0,
491
- firstDayOfYear;
492
-
493
- if (firstDayOfWeek == 1){
494
- // ISO-8601, week belongs to year that has the most days of the week (i.e. has the thursday of the week)
495
- var month = date.get('month'),
496
- startOfWeek = date.get('date') - dayOfWeek;
497
-
498
- if (month == 11 && startOfWeek > 28) return 1; // Week 1 of next year
499
-
500
- if (month == 0 && startOfWeek < -2){
501
- // Use a date from last year to determine the week
502
- date = new Date(date).decrement('day', dayOfWeek);
503
- dayOfWeek = 0;
504
- }
505
-
506
- firstDayOfYear = new Date(date.get('year'), 0, 1).get('day') || 7;
507
- if (firstDayOfYear > 4) dividend = -7; // First week of the year is not week 1
508
- } else {
509
- // In other cultures the first week of the year is always week 1 and the last week always 53 or 54.
510
- // Days in the same week can have a different weeknumber if the week spreads across two years.
511
- firstDayOfYear = new Date(date.get('year'), 0, 1).get('day');
512
- }
513
-
514
- dividend += date.get('dayofyear');
515
- dividend += 6 - dayOfWeek; // Add days so we calculate the current date's week as a full week
516
- dividend += (7 + firstDayOfYear - firstDayOfWeek) % 7; // Make up for first week of the year not being a full week
517
-
518
- return (dividend / 7);
519
- },
520
-
521
- getOrdinal: function(day){
522
- return Date.getMsg('ordinal', day || this.get('date'));
523
- },
524
-
525
- getTimezone: function(){
526
- return this.toString()
527
- .replace(/^.*? ([A-Z]{3}).[0-9]{4}.*$/, '$1')
528
- .replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/, '$1$2$3');
529
- },
530
-
531
- getGMTOffset: function(){
532
- var off = this.get('timezoneOffset');
533
- return ((off > 0) ? '-' : '+') + pad((off.abs() / 60).floor(), 2) + pad(off % 60, 2);
534
- },
535
-
536
- setAMPM: function(ampm){
537
- ampm = ampm.toUpperCase();
538
- var hr = this.get('hr');
539
- if (hr > 11 && ampm == 'AM') return this.decrement('hour', 12);
540
- else if (hr < 12 && ampm == 'PM') return this.increment('hour', 12);
541
- return this;
542
- },
543
-
544
- getAMPM: function(){
545
- return (this.get('hr') < 12) ? 'AM' : 'PM';
546
- },
547
-
548
- parse: function(str){
549
- this.set('time', Date.parse(str));
550
- return this;
551
- },
552
-
553
- isValid: function(date){
554
- if (!date) date = this;
555
- return typeOf(date) == 'date' && !isNaN(date.valueOf());
556
- },
557
-
558
- format: function(format){
559
- if (!this.isValid()) return 'invalid date';
560
-
561
- if (!format) format = '%x %X';
562
- if (typeof format == 'string') format = formats[format.toLowerCase()] || format;
563
- if (typeof format == 'function') return format(this);
564
-
565
- var d = this;
566
- return format.replace(/%([a-z%])/gi,
567
- function($0, $1){
568
- switch ($1){
569
- case 'a': return Date.getMsg('days_abbr')[d.get('day')];
570
- case 'A': return Date.getMsg('days')[d.get('day')];
571
- case 'b': return Date.getMsg('months_abbr')[d.get('month')];
572
- case 'B': return Date.getMsg('months')[d.get('month')];
573
- case 'c': return d.format('%a %b %d %H:%M:%S %Y');
574
- case 'd': return pad(d.get('date'), 2);
575
- case 'e': return pad(d.get('date'), 2, ' ');
576
- case 'H': return pad(d.get('hr'), 2);
577
- case 'I': return pad((d.get('hr') % 12) || 12, 2);
578
- case 'j': return pad(d.get('dayofyear'), 3);
579
- case 'k': return pad(d.get('hr'), 2, ' ');
580
- case 'l': return pad((d.get('hr') % 12) || 12, 2, ' ');
581
- case 'L': return pad(d.get('ms'), 3);
582
- case 'm': return pad((d.get('mo') + 1), 2);
583
- case 'M': return pad(d.get('min'), 2);
584
- case 'o': return d.get('ordinal');
585
- case 'p': return Date.getMsg(d.get('ampm'));
586
- case 's': return Math.round(d / 1000);
587
- case 'S': return pad(d.get('seconds'), 2);
588
- case 'T': return d.format('%H:%M:%S');
589
- case 'U': return pad(d.get('week'), 2);
590
- case 'w': return d.get('day');
591
- case 'x': return d.format(Date.getMsg('shortDate'));
592
- case 'X': return d.format(Date.getMsg('shortTime'));
593
- case 'y': return d.get('year').toString().substr(2);
594
- case 'Y': return d.get('year');
595
- case 'z': return d.get('GMTOffset');
596
- case 'Z': return d.get('Timezone');
597
- }
598
- return $1;
599
- }
600
- );
601
- },
602
-
603
- toISOString: function(){
604
- return this.format('iso8601');
605
- }
606
-
607
- }).alias({
608
- toJSON: 'toISOString',
609
- compare: 'diff',
610
- strftime: 'format'
611
- });
612
-
613
- // The day and month abbreviations are standardized, so we cannot use simply %a and %b because they will get localized
614
- var rfcDayAbbr = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
615
- rfcMonthAbbr = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
616
-
617
- var formats = {
618
- db: '%Y-%m-%d %H:%M:%S',
619
- compact: '%Y%m%dT%H%M%S',
620
- 'short': '%d %b %H:%M',
621
- 'long': '%B %d, %Y %H:%M',
622
- rfc822: function(date){
623
- return rfcDayAbbr[date.get('day')] + date.format(', %d ') + rfcMonthAbbr[date.get('month')] + date.format(' %Y %H:%M:%S %Z');
624
- },
625
- rfc2822: function(date){
626
- return rfcDayAbbr[date.get('day')] + date.format(', %d ') + rfcMonthAbbr[date.get('month')] + date.format(' %Y %H:%M:%S %z');
627
- },
628
- iso8601: function(date){
629
- return (
630
- date.getUTCFullYear() + '-' +
631
- pad(date.getUTCMonth() + 1, 2) + '-' +
632
- pad(date.getUTCDate(), 2) + 'T' +
633
- pad(date.getUTCHours(), 2) + ':' +
634
- pad(date.getUTCMinutes(), 2) + ':' +
635
- pad(date.getUTCSeconds(), 2) + '.' +
636
- pad(date.getUTCMilliseconds(), 3) + 'Z'
637
- );
638
- }
639
- };
640
-
641
- var parsePatterns = [],
642
- nativeParse = Date.parse;
643
-
644
- var parseWord = function(type, word, num){
645
- var ret = -1,
646
- translated = Date.getMsg(type + 's');
647
- switch (typeOf(word)){
648
- case 'object':
649
- ret = translated[word.get(type)];
650
- break;
651
- case 'number':
652
- ret = translated[word];
653
- if (!ret) throw new Error('Invalid ' + type + ' index: ' + word);
654
- break;
655
- case 'string':
656
- var match = translated.filter(function(name){
657
- return this.test(name);
658
- }, new RegExp('^' + word, 'i'));
659
- if (!match.length) throw new Error('Invalid ' + type + ' string');
660
- if (match.length > 1) throw new Error('Ambiguous ' + type);
661
- ret = match[0];
662
- }
663
-
664
- return (num) ? translated.indexOf(ret) : ret;
665
- };
666
-
667
- var startCentury = 1900,
668
- startYear = 70;
669
-
670
- Date.extend({
671
-
672
- getMsg: function(key, args){
673
- return Locale.get('Date.' + key, args);
674
- },
675
-
676
- units: {
677
- ms: Function.from(1),
678
- second: Function.from(1000),
679
- minute: Function.from(60000),
680
- hour: Function.from(3600000),
681
- day: Function.from(86400000),
682
- week: Function.from(608400000),
683
- month: function(month, year){
684
- var d = new Date;
685
- return Date.daysInMonth(month != null ? month : d.get('mo'), year != null ? year : d.get('year')) * 86400000;
686
- },
687
- year: function(year){
688
- year = year || new Date().get('year');
689
- return Date.isLeapYear(year) ? 31622400000 : 31536000000;
690
- }
691
- },
692
-
693
- daysInMonth: function(month, year){
694
- return [31, Date.isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
695
- },
696
-
697
- isLeapYear: function(year){
698
- return ((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0);
699
- },
700
-
701
- parse: function(from){
702
- var t = typeOf(from);
703
- if (t == 'number') return new Date(from);
704
- if (t != 'string') return from;
705
- from = from.clean();
706
- if (!from.length) return null;
707
-
708
- var parsed;
709
- parsePatterns.some(function(pattern){
710
- var bits = pattern.re.exec(from);
711
- return (bits) ? (parsed = pattern.handler(bits)) : false;
712
- });
713
-
714
- if (!(parsed && parsed.isValid())){
715
- parsed = new Date(nativeParse(from));
716
- if (!(parsed && parsed.isValid())) parsed = new Date(from.toInt());
717
- }
718
- return parsed;
719
- },
720
-
721
- parseDay: function(day, num){
722
- return parseWord('day', day, num);
723
- },
724
-
725
- parseMonth: function(month, num){
726
- return parseWord('month', month, num);
727
- },
728
-
729
- parseUTC: function(value){
730
- var localDate = new Date(value);
731
- var utcSeconds = Date.UTC(
732
- localDate.get('year'),
733
- localDate.get('mo'),
734
- localDate.get('date'),
735
- localDate.get('hr'),
736
- localDate.get('min'),
737
- localDate.get('sec'),
738
- localDate.get('ms')
739
- );
740
- return new Date(utcSeconds);
741
- },
742
-
743
- orderIndex: function(unit){
744
- return Date.getMsg('dateOrder').indexOf(unit) + 1;
745
- },
746
-
747
- defineFormat: function(name, format){
748
- formats[name] = format;
749
- return this;
750
- },
751
-
752
-
753
-
754
- defineParser: function(pattern){
755
- parsePatterns.push((pattern.re && pattern.handler) ? pattern : build(pattern));
756
- return this;
757
- },
758
-
759
- defineParsers: function(){
760
- Array.flatten(arguments).each(Date.defineParser);
761
- return this;
762
- },
763
-
764
- define2DigitYearStart: function(year){
765
- startYear = year % 100;
766
- startCentury = year - startYear;
767
- return this;
768
- }
769
-
770
- }).extend({
771
- defineFormats: Date.defineFormat.overloadSetter()
772
- });
773
-
774
- var regexOf = function(type){
775
- return new RegExp('(?:' + Date.getMsg(type).map(function(name){
776
- return name.substr(0, 3);
777
- }).join('|') + ')[a-z]*');
778
- };
779
-
780
- var replacers = function(key){
781
- switch (key){
782
- case 'T':
783
- return '%H:%M:%S';
784
- case 'x': // iso8601 covers yyyy-mm-dd, so just check if month is first
785
- return ((Date.orderIndex('month') == 1) ? '%m[-./]%d' : '%d[-./]%m') + '([-./]%y)?';
786
- case 'X':
787
- return '%H([.:]%M)?([.:]%S([.:]%s)?)? ?%p? ?%z?';
788
- }
789
- return null;
790
- };
791
-
792
- var keys = {
793
- d: /[0-2]?[0-9]|3[01]/,
794
- H: /[01]?[0-9]|2[0-3]/,
795
- I: /0?[1-9]|1[0-2]/,
796
- M: /[0-5]?\d/,
797
- s: /\d+/,
798
- o: /[a-z]*/,
799
- p: /[ap]\.?m\.?/,
800
- y: /\d{2}|\d{4}/,
801
- Y: /\d{4}/,
802
- z: /Z|[+-]\d{2}(?::?\d{2})?/
803
- };
804
-
805
- keys.m = keys.I;
806
- keys.S = keys.M;
807
-
808
- var currentLanguage;
809
-
810
- var recompile = function(language){
811
- currentLanguage = language;
812
-
813
- keys.a = keys.A = regexOf('days');
814
- keys.b = keys.B = regexOf('months');
815
-
816
- parsePatterns.each(function(pattern, i){
817
- if (pattern.format) parsePatterns[i] = build(pattern.format);
818
- });
819
- };
820
-
821
- var build = function(format){
822
- if (!currentLanguage) return {format: format};
823
-
824
- var parsed = [];
825
- var re = (format.source || format) // allow format to be regex
826
- .replace(/%([a-z])/gi,
827
- function($0, $1){
828
- return replacers($1) || $0;
829
- }
830
- ).replace(/\((?!\?)/g, '(?:') // make all groups non-capturing
831
- .replace(/ (?!\?|\*)/g, ',? ') // be forgiving with spaces and commas
832
- .replace(/%([a-z%])/gi,
833
- function($0, $1){
834
- var p = keys[$1];
835
- if (!p) return $1;
836
- parsed.push($1);
837
- return '(' + p.source + ')';
838
- }
839
- ).replace(/\[a-z\]/gi, '[a-z\\u00c0-\\uffff;\&]'); // handle unicode words
840
-
841
- return {
842
- format: format,
843
- re: new RegExp('^' + re + '$', 'i'),
844
- handler: function(bits){
845
- bits = bits.slice(1).associate(parsed);
846
- var date = new Date().clearTime(),
847
- year = bits.y || bits.Y;
848
-
849
- if (year != null) handle.call(date, 'y', year); // need to start in the right year
850
- if ('d' in bits) handle.call(date, 'd', 1);
851
- if ('m' in bits || bits.b || bits.B) handle.call(date, 'm', 1);
852
-
853
- for (var key in bits) handle.call(date, key, bits[key]);
854
- return date;
855
- }
856
- };
857
- };
858
-
859
- var handle = function(key, value){
860
- if (!value) return this;
861
-
862
- switch (key){
863
- case 'a': case 'A': return this.set('day', Date.parseDay(value, true));
864
- case 'b': case 'B': return this.set('mo', Date.parseMonth(value, true));
865
- case 'd': return this.set('date', value);
866
- case 'H': case 'I': return this.set('hr', value);
867
- case 'm': return this.set('mo', value - 1);
868
- case 'M': return this.set('min', value);
869
- case 'p': return this.set('ampm', value.replace(/\./g, ''));
870
- case 'S': return this.set('sec', value);
871
- case 's': return this.set('ms', ('0.' + value) * 1000);
872
- case 'w': return this.set('day', value);
873
- case 'Y': return this.set('year', value);
874
- case 'y':
875
- value = +value;
876
- if (value < 100) value += startCentury + (value < startYear ? 100 : 0);
877
- return this.set('year', value);
878
- case 'z':
879
- if (value == 'Z') value = '+00';
880
- var offset = value.match(/([+-])(\d{2}):?(\d{2})?/);
881
- offset = (offset[1] + '1') * (offset[2] * 60 + (+offset[3] || 0)) + this.getTimezoneOffset();
882
- return this.set('time', this - offset * 60000);
883
- }
884
-
885
- return this;
886
- };
887
-
888
- Date.defineParsers(
889
- '%Y([-./]%m([-./]%d((T| )%X)?)?)?', // "1999-12-31", "1999-12-31 11:59pm", "1999-12-31 23:59:59", ISO8601
890
- '%Y%m%d(T%H(%M%S?)?)?', // "19991231", "19991231T1159", compact
891
- '%x( %X)?', // "12/31", "12.31.99", "12-31-1999", "12/31/2008 11:59 PM"
892
- '%d%o( %b( %Y)?)?( %X)?', // "31st", "31st December", "31 Dec 1999", "31 Dec 1999 11:59pm"
893
- '%b( %d%o)?( %Y)?( %X)?', // Same as above with month and day switched
894
- '%Y %b( %d%o( %X)?)?', // Same as above with year coming first
895
- '%o %b %d %X %z %Y', // "Thu Oct 22 08:11:23 +0000 2009"
896
- '%T', // %H:%M:%S
897
- '%H:%M( ?%p)?' // "11:05pm", "11:05 am" and "11:05"
898
- );
899
-
900
- Locale.addEvent('change', function(language){
901
- if (Locale.get('Date')) recompile(language);
902
- }).fireEvent('change', Locale.getCurrent());
903
-
904
- })();
905
-
906
-
907
- /*
908
- ---
909
-
910
- script: String.Extras.js
911
-
912
- name: String.Extras
913
-
914
- description: Extends the String native object to include methods useful in managing various kinds of strings (query strings, urls, html, etc).
915
-
916
- license: MIT-style license
917
-
918
- authors:
919
- - Aaron Newton
920
- - Guillermo Rauch
921
- - Christopher Pitt
922
-
923
- requires:
924
- - Core/String
925
- - Core/Array
926
- - MooTools.More
927
-
928
- provides: [String.Extras]
929
-
930
- ...
931
- */
932
-
933
- (function(){
934
-
935
- var special = {
936
- 'a': /[àáâãäåăą]/g,
937
- 'A': /[ÀÁÂÃÄÅĂĄ]/g,
938
- 'c': /[ćčç]/g,
939
- 'C': /[ĆČÇ]/g,
940
- 'd': /[ďđ]/g,
941
- 'D': /[ĎÐ]/g,
942
- 'e': /[èéêëěę]/g,
943
- 'E': /[ÈÉÊËĚĘ]/g,
944
- 'g': /[ğ]/g,
945
- 'G': /[Ğ]/g,
946
- 'i': /[ìíîï]/g,
947
- 'I': /[ÌÍÎÏ]/g,
948
- 'l': /[ĺľł]/g,
949
- 'L': /[ĹĽŁ]/g,
950
- 'n': /[ñňń]/g,
951
- 'N': /[ÑŇŃ]/g,
952
- 'o': /[òóôõöøő]/g,
953
- 'O': /[ÒÓÔÕÖØ]/g,
954
- 'r': /[řŕ]/g,
955
- 'R': /[ŘŔ]/g,
956
- 's': /[ššş]/g,
957
- 'S': /[ŠŞŚ]/g,
958
- 't': /[ťţ]/g,
959
- 'T': /[ŤŢ]/g,
960
- 'ue': /[ü]/g,
961
- 'UE': /[Ü]/g,
962
- 'u': /[ùúûůµ]/g,
963
- 'U': /[ÙÚÛŮ]/g,
964
- 'y': /[ÿý]/g,
965
- 'Y': /[ŸÝ]/g,
966
- 'z': /[žźż]/g,
967
- 'Z': /[ŽŹŻ]/g,
968
- 'th': /[þ]/g,
969
- 'TH': /[Þ]/g,
970
- 'dh': /[ð]/g,
971
- 'DH': /[Ð]/g,
972
- 'ss': /[ß]/g,
973
- 'oe': /[œ]/g,
974
- 'OE': /[Œ]/g,
975
- 'ae': /[æ]/g,
976
- 'AE': /[Æ]/g
977
- },
978
-
979
- tidy = {
980
- ' ': /[\xa0\u2002\u2003\u2009]/g,
981
- '*': /[\xb7]/g,
982
- '\'': /[\u2018\u2019]/g,
983
- '"': /[\u201c\u201d]/g,
984
- '...': /[\u2026]/g,
985
- '-': /[\u2013]/g,
986
- // '--': /[\u2014]/g,
987
- '&raquo;': /[\uFFFD]/g
988
- };
989
-
990
- var walk = function(string, replacements){
991
- var result = string, key;
992
- for (key in replacements) result = result.replace(replacements[key], key);
993
- return result;
994
- };
995
-
996
- var getRegexForTag = function(tag, contents){
997
- tag = tag || '';
998
- var regstr = contents ? "<" + tag + "(?!\\w)[^>]*>([\\s\\S]*?)<\/" + tag + "(?!\\w)>" : "<\/?" + tag + "([^>]+)?>",
999
- reg = new RegExp(regstr, "gi");
1000
- return reg;
1001
- };
1002
-
1003
- String.implement({
1004
-
1005
- standardize: function(){
1006
- return walk(this, special);
1007
- },
1008
-
1009
- repeat: function(times){
1010
- return new Array(times + 1).join(this);
1011
- },
1012
-
1013
- pad: function(length, str, direction){
1014
- if (this.length >= length) return this;
1015
-
1016
- var pad = (str == null ? ' ' : '' + str)
1017
- .repeat(length - this.length)
1018
- .substr(0, length - this.length);
1019
-
1020
- if (!direction || direction == 'right') return this + pad;
1021
- if (direction == 'left') return pad + this;
1022
-
1023
- return pad.substr(0, (pad.length / 2).floor()) + this + pad.substr(0, (pad.length / 2).ceil());
1024
- },
1025
-
1026
- getTags: function(tag, contents){
1027
- return this.match(getRegexForTag(tag, contents)) || [];
1028
- },
1029
-
1030
- stripTags: function(tag, contents){
1031
- return this.replace(getRegexForTag(tag, contents), '');
1032
- },
1033
-
1034
- tidy: function(){
1035
- return walk(this, tidy);
1036
- },
1037
-
1038
- truncate: function(max, trail, atChar){
1039
- var string = this;
1040
- if (trail == null && arguments.length == 1) trail = '…';
1041
- if (string.length > max){
1042
- string = string.substring(0, max);
1043
- if (atChar){
1044
- var index = string.lastIndexOf(atChar);
1045
- if (index != -1) string = string.substr(0, index);
1046
- }
1047
- if (trail) string += trail;
1048
- }
1049
- return string;
1050
- }
1051
-
1052
- });
1053
-
1054
- })();
1055
-
1056
-
1057
- /*
1058
- ---
1059
-
1060
- script: Drag.js
1061
-
1062
- name: Drag
1063
-
1064
- description: The base Drag Class. Can be used to drag and resize Elements using mouse events.
1065
-
1066
- license: MIT-style license
1067
-
1068
- authors:
1069
- - Valerio Proietti
1070
- - Tom Occhinno
1071
- - Jan Kassens
1072
-
1073
- requires:
1074
- - Core/Events
1075
- - Core/Options
1076
- - Core/Element.Event
1077
- - Core/Element.Style
1078
- - Core/Element.Dimensions
1079
- - /MooTools.More
1080
-
1081
- provides: [Drag]
1082
- ...
1083
-
1084
- */
1085
-
1086
- var Drag = new Class({
1087
-
1088
- Implements: [Events, Options],
1089
-
1090
- options: {/*
1091
- onBeforeStart: function(thisElement){},
1092
- onStart: function(thisElement, event){},
1093
- onSnap: function(thisElement){},
1094
- onDrag: function(thisElement, event){},
1095
- onCancel: function(thisElement){},
1096
- onComplete: function(thisElement, event){},*/
1097
- snap: 6,
1098
- unit: 'px',
1099
- grid: false,
1100
- style: true,
1101
- limit: false,
1102
- handle: false,
1103
- invert: false,
1104
- preventDefault: false,
1105
- stopPropagation: false,
1106
- modifiers: {x: 'left', y: 'top'}
1107
- },
1108
-
1109
- initialize: function(){
1110
- var params = Array.link(arguments, {
1111
- 'options': Type.isObject,
1112
- 'element': function(obj){
1113
- return obj != null;
1114
- }
1115
- });
1116
-
1117
- this.element = document.id(params.element);
1118
- this.document = this.element.getDocument();
1119
- this.setOptions(params.options || {});
1120
- var htype = typeOf(this.options.handle);
1121
- this.handles = ((htype == 'array' || htype == 'collection') ? $$(this.options.handle) : document.id(this.options.handle)) || this.element;
1122
- this.mouse = {'now': {}, 'pos': {}};
1123
- this.value = {'start': {}, 'now': {}};
1124
-
1125
- this.selection = (Browser.ie) ? 'selectstart' : 'mousedown';
1126
-
1127
-
1128
- if (Browser.ie && !Drag.ondragstartFixed){
1129
- document.ondragstart = Function.from(false);
1130
- Drag.ondragstartFixed = true;
1131
- }
1132
-
1133
- this.bound = {
1134
- start: this.start.bind(this),
1135
- check: this.check.bind(this),
1136
- drag: this.drag.bind(this),
1137
- stop: this.stop.bind(this),
1138
- cancel: this.cancel.bind(this),
1139
- eventStop: Function.from(false)
1140
- };
1141
- this.attach();
1142
- },
1143
-
1144
- attach: function(){
1145
- this.handles.addEvent('mousedown', this.bound.start);
1146
- return this;
1147
- },
1148
-
1149
- detach: function(){
1150
- this.handles.removeEvent('mousedown', this.bound.start);
1151
- return this;
1152
- },
1153
-
1154
- start: function(event){
1155
- var options = this.options;
1156
-
1157
- if (event.rightClick) return;
1158
-
1159
- if (options.preventDefault) event.preventDefault();
1160
- if (options.stopPropagation) event.stopPropagation();
1161
- this.mouse.start = event.page;
1162
-
1163
- this.fireEvent('beforeStart', this.element);
1164
-
1165
- var limit = options.limit;
1166
- this.limit = {x: [], y: []};
1167
-
1168
- var z, coordinates;
1169
- for (z in options.modifiers){
1170
- if (!options.modifiers[z]) continue;
1171
-
1172
- var style = this.element.getStyle(options.modifiers[z]);
1173
-
1174
- // Some browsers (IE and Opera) don't always return pixels.
1175
- if (style && !style.match(/px$/)){
1176
- if (!coordinates) coordinates = this.element.getCoordinates(this.element.getOffsetParent());
1177
- style = coordinates[options.modifiers[z]];
1178
- }
1179
-
1180
- if (options.style) this.value.now[z] = (style || 0).toInt();
1181
- else this.value.now[z] = this.element[options.modifiers[z]];
1182
-
1183
- if (options.invert) this.value.now[z] *= -1;
1184
-
1185
- this.mouse.pos[z] = event.page[z] - this.value.now[z];
1186
-
1187
- if (limit && limit[z]){
1188
- var i = 2;
1189
- while (i--){
1190
- var limitZI = limit[z][i];
1191
- if (limitZI || limitZI === 0) this.limit[z][i] = (typeof limitZI == 'function') ? limitZI() : limitZI;
1192
- }
1193
- }
1194
- }
1195
-
1196
- if (typeOf(this.options.grid) == 'number') this.options.grid = {
1197
- x: this.options.grid,
1198
- y: this.options.grid
1199
- };
1200
-
1201
- var events = {
1202
- mousemove: this.bound.check,
1203
- mouseup: this.bound.cancel
1204
- };
1205
- events[this.selection] = this.bound.eventStop;
1206
- this.document.addEvents(events);
1207
- },
1208
-
1209
- check: function(event){
1210
- if (this.options.preventDefault) event.preventDefault();
1211
- 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)));
1212
- if (distance > this.options.snap){
1213
- this.cancel();
1214
- this.document.addEvents({
1215
- mousemove: this.bound.drag,
1216
- mouseup: this.bound.stop
1217
- });
1218
- this.fireEvent('start', [this.element, event]).fireEvent('snap', this.element);
1219
- }
1220
- },
1221
-
1222
- drag: function(event){
1223
- var options = this.options;
1224
-
1225
- if (options.preventDefault) event.preventDefault();
1226
- this.mouse.now = event.page;
1227
-
1228
- for (var z in options.modifiers){
1229
- if (!options.modifiers[z]) continue;
1230
- this.value.now[z] = this.mouse.now[z] - this.mouse.pos[z];
1231
-
1232
- if (options.invert) this.value.now[z] *= -1;
1233
-
1234
- if (options.limit && this.limit[z]){
1235
- if ((this.limit[z][1] || this.limit[z][1] === 0) && (this.value.now[z] > this.limit[z][1])){
1236
- this.value.now[z] = this.limit[z][1];
1237
- } else if ((this.limit[z][0] || this.limit[z][0] === 0) && (this.value.now[z] < this.limit[z][0])){
1238
- this.value.now[z] = this.limit[z][0];
1239
- }
1240
- }
1241
-
1242
- if (options.grid[z]) this.value.now[z] -= ((this.value.now[z] - (this.limit[z][0]||0)) % options.grid[z]);
1243
-
1244
- if (options.style) this.element.setStyle(options.modifiers[z], this.value.now[z] + options.unit);
1245
- else this.element[options.modifiers[z]] = this.value.now[z];
1246
- }
1247
-
1248
- this.fireEvent('drag', [this.element, event]);
1249
- },
1250
-
1251
- cancel: function(event){
1252
- this.document.removeEvents({
1253
- mousemove: this.bound.check,
1254
- mouseup: this.bound.cancel
1255
- });
1256
- if (event){
1257
- this.document.removeEvent(this.selection, this.bound.eventStop);
1258
- this.fireEvent('cancel', this.element);
1259
- }
1260
- },
1261
-
1262
- stop: function(event){
1263
- var events = {
1264
- mousemove: this.bound.drag,
1265
- mouseup: this.bound.stop
1266
- };
1267
- events[this.selection] = this.bound.eventStop;
1268
- this.document.removeEvents(events);
1269
- if (event) this.fireEvent('complete', [this.element, event]);
1270
- }
1271
-
1272
- });
1273
-
1274
- Element.implement({
1275
-
1276
- makeResizable: function(options){
1277
- var drag = new Drag(this, Object.merge({
1278
- modifiers: {
1279
- x: 'width',
1280
- y: 'height'
1281
- }
1282
- }, options));
1283
-
1284
- this.store('resizer', drag);
1285
- return drag.addEvent('drag', function(){
1286
- this.fireEvent('resize', drag);
1287
- }.bind(this));
1288
- }
1289
-
1290
- });
1291
-
1292
-
1293
- /*
1294
- ---
1295
-
1296
- script: Drag.Move.js
1297
-
1298
- name: Drag.Move
1299
-
1300
- description: A Drag extension that provides support for the constraining of draggables to containers and droppables.
1301
-
1302
- license: MIT-style license
1303
-
1304
- authors:
1305
- - Valerio Proietti
1306
- - Tom Occhinno
1307
- - Jan Kassens
1308
- - Aaron Newton
1309
- - Scott Kyle
1310
-
1311
- requires:
1312
- - Core/Element.Dimensions
1313
- - /Drag
1314
-
1315
- provides: [Drag.Move]
1316
-
1317
- ...
1318
- */
1319
-
1320
- Drag.Move = new Class({
1321
-
1322
- Extends: Drag,
1323
-
1324
- options: {/*
1325
- onEnter: function(thisElement, overed){},
1326
- onLeave: function(thisElement, overed){},
1327
- onDrop: function(thisElement, overed, event){},*/
1328
- droppables: [],
1329
- container: false,
1330
- precalculate: false,
1331
- includeMargins: true,
1332
- checkDroppables: true
1333
- },
1334
-
1335
- initialize: function(element, options){
1336
- this.parent(element, options);
1337
- element = this.element;
1338
-
1339
- this.droppables = $$(this.options.droppables);
1340
- this.container = document.id(this.options.container);
1341
-
1342
- if (this.container && typeOf(this.container) != 'element')
1343
- this.container = document.id(this.container.getDocument().body);
1344
-
1345
- if (this.options.style){
1346
- if (this.options.modifiers.x == 'left' && this.options.modifiers.y == 'top'){
1347
- var parent = element.getOffsetParent(),
1348
- styles = element.getStyles('left', 'top');
1349
- if (parent && (styles.left == 'auto' || styles.top == 'auto')){
1350
- element.setPosition(element.getPosition(parent));
1351
- }
1352
- }
1353
-
1354
- if (element.getStyle('position') == 'static') element.setStyle('position', 'absolute');
1355
- }
1356
-
1357
- this.addEvent('start', this.checkDroppables, true);
1358
- this.overed = null;
1359
- },
1360
-
1361
- start: function(event){
1362
- if (this.container) this.options.limit = this.calculateLimit();
1363
-
1364
- if (this.options.precalculate){
1365
- this.positions = this.droppables.map(function(el){
1366
- return el.getCoordinates();
1367
- });
1368
- }
1369
-
1370
- this.parent(event);
1371
- },
1372
-
1373
- calculateLimit: function(){
1374
- var element = this.element,
1375
- container = this.container,
1376
-
1377
- offsetParent = document.id(element.getOffsetParent()) || document.body,
1378
- containerCoordinates = container.getCoordinates(offsetParent),
1379
- elementMargin = {},
1380
- elementBorder = {},
1381
- containerMargin = {},
1382
- containerBorder = {},
1383
- offsetParentPadding = {};
1384
-
1385
- ['top', 'right', 'bottom', 'left'].each(function(pad){
1386
- elementMargin[pad] = element.getStyle('margin-' + pad).toInt();
1387
- elementBorder[pad] = element.getStyle('border-' + pad).toInt();
1388
- containerMargin[pad] = container.getStyle('margin-' + pad).toInt();
1389
- containerBorder[pad] = container.getStyle('border-' + pad).toInt();
1390
- offsetParentPadding[pad] = offsetParent.getStyle('padding-' + pad).toInt();
1391
- }, this);
1392
-
1393
- var width = element.offsetWidth + elementMargin.left + elementMargin.right,
1394
- height = element.offsetHeight + elementMargin.top + elementMargin.bottom,
1395
- left = 0,
1396
- top = 0,
1397
- right = containerCoordinates.right - containerBorder.right - width,
1398
- bottom = containerCoordinates.bottom - containerBorder.bottom - height;
1399
-
1400
- if (this.options.includeMargins){
1401
- left += elementMargin.left;
1402
- top += elementMargin.top;
1403
- } else {
1404
- right += elementMargin.right;
1405
- bottom += elementMargin.bottom;
1406
- }
1407
-
1408
- if (element.getStyle('position') == 'relative'){
1409
- var coords = element.getCoordinates(offsetParent);
1410
- coords.left -= element.getStyle('left').toInt();
1411
- coords.top -= element.getStyle('top').toInt();
1412
-
1413
- left -= coords.left;
1414
- top -= coords.top;
1415
- if (container.getStyle('position') != 'relative'){
1416
- left += containerBorder.left;
1417
- top += containerBorder.top;
1418
- }
1419
- right += elementMargin.left - coords.left;
1420
- bottom += elementMargin.top - coords.top;
1421
-
1422
- if (container != offsetParent){
1423
- left += containerMargin.left + offsetParentPadding.left;
1424
- top += ((Browser.ie6 || Browser.ie7) ? 0 : containerMargin.top) + offsetParentPadding.top;
1425
- }
1426
- } else {
1427
- left -= elementMargin.left;
1428
- top -= elementMargin.top;
1429
- if (container != offsetParent){
1430
- left += containerCoordinates.left + containerBorder.left;
1431
- top += containerCoordinates.top + containerBorder.top;
1432
- }
1433
- }
1434
-
1435
- return {
1436
- x: [left, right],
1437
- y: [top, bottom]
1438
- };
1439
- },
1440
-
1441
- getDroppableCoordinates: function(element){
1442
- var position = element.getCoordinates();
1443
- if (element.getStyle('position') == 'fixed'){
1444
- var scroll = window.getScroll();
1445
- position.left += scroll.x;
1446
- position.right += scroll.x;
1447
- position.top += scroll.y;
1448
- position.bottom += scroll.y;
1449
- }
1450
- return position;
1451
- },
1452
-
1453
- checkDroppables: function(){
1454
- var overed = this.droppables.filter(function(el, i){
1455
- el = this.positions ? this.positions[i] : this.getDroppableCoordinates(el);
1456
- var now = this.mouse.now;
1457
- return (now.x > el.left && now.x < el.right && now.y < el.bottom && now.y > el.top);
1458
- }, this).getLast();
1459
-
1460
- if (this.overed != overed){
1461
- if (this.overed) this.fireEvent('leave', [this.element, this.overed]);
1462
- if (overed) this.fireEvent('enter', [this.element, overed]);
1463
- this.overed = overed;
1464
- }
1465
- },
1466
-
1467
- drag: function(event){
1468
- this.parent(event);
1469
- if (this.options.checkDroppables && this.droppables.length) this.checkDroppables();
1470
- },
1471
-
1472
- stop: function(event){
1473
- this.checkDroppables();
1474
- this.fireEvent('drop', [this.element, this.overed, event]);
1475
- this.overed = null;
1476
- return this.parent(event);
1477
- }
1478
-
1479
- });
1480
-
1481
- Element.implement({
1482
-
1483
- makeDraggable: function(options){
1484
- var drag = new Drag.Move(this, options);
1485
- this.store('dragger', drag);
1486
- return drag;
1487
- }
1488
-
1489
- });
1490
-
1491
-
1492
- /*
1493
- ---
1494
-
1495
- script: Sortables.js
1496
-
1497
- name: Sortables
1498
-
1499
- description: Class for creating a drag and drop sorting interface for lists of items.
1500
-
1501
- license: MIT-style license
1502
-
1503
- authors:
1504
- - Tom Occhino
1505
-
1506
- requires:
1507
- - Core/Fx.Morph
1508
- - /Drag.Move
1509
-
1510
- provides: [Sortables]
1511
-
1512
- ...
1513
- */
1514
-
1515
- var Sortables = new Class({
1516
-
1517
- Implements: [Events, Options],
1518
-
1519
- options: {/*
1520
- onSort: function(element, clone){},
1521
- onStart: function(element, clone){},
1522
- onComplete: function(element){},*/
1523
- opacity: 1,
1524
- clone: false,
1525
- revert: false,
1526
- handle: false,
1527
- dragOptions: {}
1528
- },
1529
-
1530
- initialize: function(lists, options){
1531
- this.setOptions(options);
1532
-
1533
- this.elements = [];
1534
- this.lists = [];
1535
- this.idle = true;
1536
-
1537
- this.addLists($$(document.id(lists) || lists));
1538
-
1539
- if (!this.options.clone) this.options.revert = false;
1540
- if (this.options.revert) this.effect = new Fx.Morph(null, Object.merge({
1541
- duration: 250,
1542
- link: 'cancel'
1543
- }, this.options.revert));
1544
- },
1545
-
1546
- attach: function(){
1547
- this.addLists(this.lists);
1548
- return this;
1549
- },
1550
-
1551
- detach: function(){
1552
- this.lists = this.removeLists(this.lists);
1553
- return this;
1554
- },
1555
-
1556
- addItems: function(){
1557
- Array.flatten(arguments).each(function(element){
1558
- this.elements.push(element);
1559
- var start = element.retrieve('sortables:start', function(event){
1560
- this.start.call(this, event, element);
1561
- }.bind(this));
1562
- (this.options.handle ? element.getElement(this.options.handle) || element : element).addEvent('mousedown', start);
1563
- }, this);
1564
- return this;
1565
- },
1566
-
1567
- addLists: function(){
1568
- Array.flatten(arguments).each(function(list){
1569
- this.lists.include(list);
1570
- this.addItems(list.getChildren());
1571
- }, this);
1572
- return this;
1573
- },
1574
-
1575
- removeItems: function(){
1576
- return $$(Array.flatten(arguments).map(function(element){
1577
- this.elements.erase(element);
1578
- var start = element.retrieve('sortables:start');
1579
- (this.options.handle ? element.getElement(this.options.handle) || element : element).removeEvent('mousedown', start);
1580
-
1581
- return element;
1582
- }, this));
1583
- },
1584
-
1585
- removeLists: function(){
1586
- return $$(Array.flatten(arguments).map(function(list){
1587
- this.lists.erase(list);
1588
- this.removeItems(list.getChildren());
1589
-
1590
- return list;
1591
- }, this));
1592
- },
1593
-
1594
- getClone: function(event, element){
1595
- if (!this.options.clone) return new Element(element.tagName).inject(document.body);
1596
- if (typeOf(this.options.clone) == 'function') return this.options.clone.call(this, event, element, this.list);
1597
- var clone = element.clone(true).setStyles({
1598
- margin: 0,
1599
- position: 'absolute',
1600
- visibility: 'hidden',
1601
- width: element.getStyle('width')
1602
- }).addEvent('mousedown', function(event){
1603
- element.fireEvent('mousedown', event);
1604
- });
1605
- //prevent the duplicated radio inputs from unchecking the real one
1606
- if (clone.get('html').test('radio')){
1607
- clone.getElements('input[type=radio]').each(function(input, i){
1608
- input.set('name', 'clone_' + i);
1609
- if (input.get('checked')) element.getElements('input[type=radio]')[i].set('checked', true);
1610
- });
1611
- }
1612
-
1613
- return clone.inject(this.list).setPosition(element.getPosition(element.getOffsetParent()));
1614
- },
1615
-
1616
- getDroppables: function(){
1617
- var droppables = this.list.getChildren().erase(this.clone).erase(this.element);
1618
- if (!this.options.constrain) droppables.append(this.lists).erase(this.list);
1619
- return droppables;
1620
- },
1621
-
1622
- insert: function(dragging, element){
1623
- var where = 'inside';
1624
- if (this.lists.contains(element)){
1625
- this.list = element;
1626
- this.drag.droppables = this.getDroppables();
1627
- } else {
1628
- where = this.element.getAllPrevious().contains(element) ? 'before' : 'after';
1629
- }
1630
- this.element.inject(element, where);
1631
- this.fireEvent('sort', [this.element, this.clone]);
1632
- },
1633
-
1634
- start: function(event, element){
1635
- if (
1636
- !this.idle ||
1637
- event.rightClick ||
1638
- ['button', 'input', 'a', 'textarea'].contains(event.target.get('tag'))
1639
- ) return;
1640
-
1641
- this.idle = false;
1642
- this.element = element;
1643
- this.opacity = element.getStyle('opacity');
1644
- this.list = element.getParent();
1645
- this.clone = this.getClone(event, element);
1646
-
1647
- this.drag = new Drag.Move(this.clone, Object.merge({
1648
-
1649
- droppables: this.getDroppables()
1650
- }, this.options.dragOptions)).addEvents({
1651
- onSnap: function(){
1652
- event.stop();
1653
- this.clone.setStyle('visibility', 'visible');
1654
- this.element.setStyle('opacity', this.options.opacity || 0);
1655
- this.fireEvent('start', [this.element, this.clone]);
1656
- }.bind(this),
1657
- onEnter: this.insert.bind(this),
1658
- onCancel: this.end.bind(this),
1659
- onComplete: this.end.bind(this)
1660
- });
1661
-
1662
- this.clone.inject(this.element, 'before');
1663
- this.drag.start(event);
1664
- },
1665
-
1666
- end: function(){
1667
- this.drag.detach();
1668
- this.element.setStyle('opacity', this.opacity);
1669
- if (this.effect){
1670
- var dim = this.element.getStyles('width', 'height'),
1671
- clone = this.clone,
1672
- pos = clone.computePosition(this.element.getPosition(this.clone.getOffsetParent()));
1673
-
1674
- var destroy = function(){
1675
- this.removeEvent('cancel', destroy);
1676
- clone.destroy();
1677
- };
1678
-
1679
- this.effect.element = clone;
1680
- this.effect.start({
1681
- top: pos.top,
1682
- left: pos.left,
1683
- width: dim.width,
1684
- height: dim.height,
1685
- opacity: 0.25
1686
- }).addEvent('cancel', destroy).chain(destroy);
1687
- } else {
1688
- this.clone.destroy();
1689
- }
1690
- this.reset();
1691
- },
1692
-
1693
- reset: function(){
1694
- this.idle = true;
1695
- this.fireEvent('complete', this.element);
1696
- },
1697
-
1698
- serialize: function(){
1699
- var params = Array.link(arguments, {
1700
- modifier: Type.isFunction,
1701
- index: function(obj){
1702
- return obj != null;
1703
- }
1704
- });
1705
- var serial = this.lists.map(function(list){
1706
- return list.getChildren().map(params.modifier || function(element){
1707
- return element.get('id');
1708
- }, this);
1709
- }, this);
1710
-
1711
- var index = params.index;
1712
- if (this.lists.length == 1) index = 0;
1713
- return (index || index === 0) && index >= 0 && index < this.lists.length ? serial[index] : serial;
1714
- }
1715
-
1716
- });
1717
-
1718
-
1719
- /*
1720
- ---
1721
-
1722
- script: Assets.js
1723
-
1724
- name: Assets
1725
-
1726
- description: Provides methods to dynamically load JavaScript, CSS, and Image files into the document.
1727
-
1728
- license: MIT-style license
1729
-
1730
- authors:
1731
- - Valerio Proietti
1732
-
1733
- requires:
1734
- - Core/Element.Event
1735
- - /MooTools.More
1736
-
1737
- provides: [Assets]
1738
-
1739
- ...
1740
- */
1741
-
1742
- var Asset = {
1743
-
1744
- javascript: function(source, properties){
1745
- if (!properties) properties = {};
1746
-
1747
- var script = new Element('script', {src: source, type: 'text/javascript'}),
1748
- doc = properties.document || document,
1749
- load = properties.onload || properties.onLoad;
1750
-
1751
- delete properties.onload;
1752
- delete properties.onLoad;
1753
- delete properties.document;
1754
-
1755
- if (load){
1756
- if (typeof script.onreadystatechange != 'undefined'){
1757
- script.addEvent('readystatechange', function(){
1758
- if (['loaded', 'complete'].contains(this.readyState)) load.call(this);
1759
- });
1760
- } else {
1761
- script.addEvent('load', load);
1762
- }
1763
- }
1764
-
1765
- return script.set(properties).inject(doc.head);
1766
- },
1767
-
1768
- css: function(source, properties){
1769
- if (!properties) properties = {};
1770
-
1771
- var link = new Element('link', {
1772
- rel: 'stylesheet',
1773
- media: 'screen',
1774
- type: 'text/css',
1775
- href: source
1776
- });
1777
-
1778
- var load = properties.onload || properties.onLoad,
1779
- doc = properties.document || document;
1780
-
1781
- delete properties.onload;
1782
- delete properties.onLoad;
1783
- delete properties.document;
1784
-
1785
- if (load) link.addEvent('load', load);
1786
- return link.set(properties).inject(doc.head);
1787
- },
1788
-
1789
- image: function(source, properties){
1790
- if (!properties) properties = {};
1791
-
1792
- var image = new Image(),
1793
- element = document.id(image) || new Element('img');
1794
-
1795
- ['load', 'abort', 'error'].each(function(name){
1796
- var type = 'on' + name,
1797
- cap = 'on' + name.capitalize(),
1798
- event = properties[type] || properties[cap] || function(){};
1799
-
1800
- delete properties[cap];
1801
- delete properties[type];
1802
-
1803
- image[type] = function(){
1804
- if (!image) return;
1805
- if (!element.parentNode){
1806
- element.width = image.width;
1807
- element.height = image.height;
1808
- }
1809
- image = image.onload = image.onabort = image.onerror = null;
1810
- event.delay(1, element, element);
1811
- element.fireEvent(name, element, 1);
1812
- };
1813
- });
1814
-
1815
- image.src = element.src = source;
1816
- if (image && image.complete) image.onload.delay(1);
1817
- return element.set(properties);
1818
- },
1819
-
1820
- images: function(sources, options){
1821
- sources = Array.from(sources);
1822
-
1823
- var fn = function(){},
1824
- counter = 0;
1825
-
1826
- options = Object.merge({
1827
- onComplete: fn,
1828
- onProgress: fn,
1829
- onError: fn,
1830
- properties: {}
1831
- }, options);
1832
-
1833
- return new Elements(sources.map(function(source, index){
1834
- return Asset.image(source, Object.append(options.properties, {
1835
- onload: function(){
1836
- counter++;
1837
- options.onProgress.call(this, counter, index, source);
1838
- if (counter == sources.length) options.onComplete();
1839
- },
1840
- onerror: function(){
1841
- counter++;
1842
- options.onError.call(this, counter, index, source);
1843
- if (counter == sources.length) options.onComplete();
1844
- }
1845
- }));
1846
- }));
1847
- }
1848
-
1849
- };
1850
-
1851
-
1852
- /*
1853
- ---
1854
-
1855
- script: Element.Measure.js
1856
-
1857
- name: Element.Measure
1858
-
1859
- description: Extends the Element native object to include methods useful in measuring dimensions.
1860
-
1861
- credits: "Element.measure / .expose methods by Daniel Steigerwald License: MIT-style license. Copyright: Copyright (c) 2008 Daniel Steigerwald, daniel.steigerwald.cz"
1862
-
1863
- license: MIT-style license
1864
-
1865
- authors:
1866
- - Aaron Newton
1867
-
1868
- requires:
1869
- - Core/Element.Style
1870
- - Core/Element.Dimensions
1871
- - /MooTools.More
1872
-
1873
- provides: [Element.Measure]
1874
-
1875
- ...
1876
- */
1877
-
1878
- (function(){
1879
-
1880
- var getStylesList = function(styles, planes){
1881
- var list = [];
1882
- Object.each(planes, function(directions){
1883
- Object.each(directions, function(edge){
1884
- styles.each(function(style){
1885
- list.push(style + '-' + edge + (style == 'border' ? '-width' : ''));
1886
- });
1887
- });
1888
- });
1889
- return list;
1890
- };
1891
-
1892
- var calculateEdgeSize = function(edge, styles){
1893
- var total = 0;
1894
- Object.each(styles, function(value, style){
1895
- if (style.test(edge)) total = total + value.toInt();
1896
- });
1897
- return total;
1898
- };
1899
-
1900
- var isVisible = function(el){
1901
- return !!(!el || el.offsetHeight || el.offsetWidth);
1902
- };
1903
-
1904
-
1905
- Element.implement({
1906
-
1907
- measure: function(fn){
1908
- if (isVisible(this)) return fn.call(this);
1909
- var parent = this.getParent(),
1910
- toMeasure = [];
1911
- while (!isVisible(parent) && parent != document.body){
1912
- toMeasure.push(parent.expose());
1913
- parent = parent.getParent();
1914
- }
1915
- var restore = this.expose(),
1916
- result = fn.call(this);
1917
- restore();
1918
- toMeasure.each(function(restore){
1919
- restore();
1920
- });
1921
- return result;
1922
- },
1923
-
1924
- expose: function(){
1925
- if (this.getStyle('display') != 'none') return function(){};
1926
- var before = this.style.cssText;
1927
- this.setStyles({
1928
- display: 'block',
1929
- position: 'absolute',
1930
- visibility: 'hidden'
1931
- });
1932
- return function(){
1933
- this.style.cssText = before;
1934
- }.bind(this);
1935
- },
1936
-
1937
- getDimensions: function(options){
1938
- options = Object.merge({computeSize: false}, options);
1939
- var dim = {x: 0, y: 0};
1940
-
1941
- var getSize = function(el, options){
1942
- return (options.computeSize) ? el.getComputedSize(options) : el.getSize();
1943
- };
1944
-
1945
- var parent = this.getParent('body');
1946
-
1947
- if (parent && this.getStyle('display') == 'none'){
1948
- dim = this.measure(function(){
1949
- return getSize(this, options);
1950
- });
1951
- } else if (parent){
1952
- try { //safari sometimes crashes here, so catch it
1953
- dim = getSize(this, options);
1954
- }catch(e){}
1955
- }
1956
-
1957
- return Object.append(dim, (dim.x || dim.x === 0) ? {
1958
- width: dim.x,
1959
- height: dim.y
1960
- } : {
1961
- x: dim.width,
1962
- y: dim.height
1963
- }
1964
- );
1965
- },
1966
-
1967
- getComputedSize: function(options){
1968
-
1969
-
1970
- options = Object.merge({
1971
- styles: ['padding','border'],
1972
- planes: {
1973
- height: ['top','bottom'],
1974
- width: ['left','right']
1975
- },
1976
- mode: 'both'
1977
- }, options);
1978
-
1979
- var styles = {},
1980
- size = {width: 0, height: 0},
1981
- dimensions;
1982
-
1983
- if (options.mode == 'vertical'){
1984
- delete size.width;
1985
- delete options.planes.width;
1986
- } else if (options.mode == 'horizontal'){
1987
- delete size.height;
1988
- delete options.planes.height;
1989
- }
1990
-
1991
- getStylesList(options.styles, options.planes).each(function(style){
1992
- styles[style] = this.getStyle(style).toInt();
1993
- }, this);
1994
-
1995
- Object.each(options.planes, function(edges, plane){
1996
-
1997
- var capitalized = plane.capitalize(),
1998
- style = this.getStyle(plane);
1999
-
2000
- if (style == 'auto' && !dimensions) dimensions = this.getDimensions();
2001
-
2002
- style = styles[plane] = (style == 'auto') ? dimensions[plane] : style.toInt();
2003
- size['total' + capitalized] = style;
2004
-
2005
- edges.each(function(edge){
2006
- var edgesize = calculateEdgeSize(edge, styles);
2007
- size['computed' + edge.capitalize()] = edgesize;
2008
- size['total' + capitalized] += edgesize;
2009
- });
2010
-
2011
- }, this);
2012
-
2013
- return Object.append(size, styles);
2014
- }
2015
-
2016
- });
2017
-
2018
- })();
2019
-
2020
-
2021
- /*
2022
- ---
2023
-
2024
- script: Element.Position.js
2025
-
2026
- name: Element.Position
2027
-
2028
- description: Extends the Element native object to include methods useful positioning elements relative to others.
2029
-
2030
- license: MIT-style license
2031
-
2032
- authors:
2033
- - Aaron Newton
2034
- - Jacob Thornton
2035
-
2036
- requires:
2037
- - Core/Options
2038
- - Core/Element.Dimensions
2039
- - Element.Measure
2040
-
2041
- provides: [Element.Position]
2042
-
2043
- ...
2044
- */
2045
-
2046
- (function(original){
2047
-
2048
- var local = Element.Position = {
2049
-
2050
- options: {/*
2051
- edge: false,
2052
- returnPos: false,
2053
- minimum: {x: 0, y: 0},
2054
- maximum: {x: 0, y: 0},
2055
- relFixedPosition: false,
2056
- ignoreMargins: false,
2057
- ignoreScroll: false,
2058
- allowNegative: false,*/
2059
- relativeTo: document.body,
2060
- position: {
2061
- x: 'center', //left, center, right
2062
- y: 'center' //top, center, bottom
2063
- },
2064
- offset: {x: 0, y: 0}
2065
- },
2066
-
2067
- getOptions: function(element, options){
2068
- options = Object.merge({}, local.options, options);
2069
- local.setPositionOption(options);
2070
- local.setEdgeOption(options);
2071
- local.setOffsetOption(element, options);
2072
- local.setDimensionsOption(element, options);
2073
- return options;
2074
- },
2075
-
2076
- setPositionOption: function(options){
2077
- options.position = local.getCoordinateFromValue(options.position);
2078
- },
2079
-
2080
- setEdgeOption: function(options){
2081
- var edgeOption = local.getCoordinateFromValue(options.edge);
2082
- options.edge = edgeOption ? edgeOption :
2083
- (options.position.x == 'center' && options.position.y == 'center') ? {x: 'center', y: 'center'} :
2084
- {x: 'left', y: 'top'};
2085
- },
2086
-
2087
- setOffsetOption: function(element, options){
2088
- var parentOffset = {x: 0, y: 0},
2089
- offsetParent = element.measure(function(){
2090
- return document.id(this.getOffsetParent());
2091
- }),
2092
- parentScroll = offsetParent.getScroll();
2093
-
2094
- if (!offsetParent || offsetParent == element.getDocument().body) return;
2095
- parentOffset = offsetParent.measure(function(){
2096
- var position = this.getPosition();
2097
- if (this.getStyle('position') == 'fixed'){
2098
- var scroll = window.getScroll();
2099
- position.x += scroll.x;
2100
- position.y += scroll.y;
2101
- }
2102
- return position;
2103
- });
2104
-
2105
- options.offset = {
2106
- parentPositioned: offsetParent != document.id(options.relativeTo),
2107
- x: options.offset.x - parentOffset.x + parentScroll.x,
2108
- y: options.offset.y - parentOffset.y + parentScroll.y
2109
- };
2110
- },
2111
-
2112
- setDimensionsOption: function(element, options){
2113
- options.dimensions = element.getDimensions({
2114
- computeSize: true,
2115
- styles: ['padding', 'border', 'margin']
2116
- });
2117
- },
2118
-
2119
- getPosition: function(element, options){
2120
- var position = {};
2121
- options = local.getOptions(element, options);
2122
- var relativeTo = document.id(options.relativeTo) || document.body;
2123
-
2124
- local.setPositionCoordinates(options, position, relativeTo);
2125
- if (options.edge) local.toEdge(position, options);
2126
-
2127
- var offset = options.offset;
2128
- position.left = ((position.x >= 0 || offset.parentPositioned || options.allowNegative) ? position.x : 0).toInt();
2129
- position.top = ((position.y >= 0 || offset.parentPositioned || options.allowNegative) ? position.y : 0).toInt();
2130
-
2131
- local.toMinMax(position, options);
2132
-
2133
- if (options.relFixedPosition || relativeTo.getStyle('position') == 'fixed') local.toRelFixedPosition(relativeTo, position);
2134
- if (options.ignoreScroll) local.toIgnoreScroll(relativeTo, position);
2135
- if (options.ignoreMargins) local.toIgnoreMargins(position, options);
2136
-
2137
- position.left = Math.ceil(position.left);
2138
- position.top = Math.ceil(position.top);
2139
- delete position.x;
2140
- delete position.y;
2141
-
2142
- return position;
2143
- },
2144
-
2145
- setPositionCoordinates: function(options, position, relativeTo){
2146
- var offsetY = options.offset.y,
2147
- offsetX = options.offset.x,
2148
- calc = (relativeTo == document.body) ? window.getScroll() : relativeTo.getPosition(),
2149
- top = calc.y,
2150
- left = calc.x,
2151
- winSize = window.getSize();
2152
-
2153
- switch(options.position.x){
2154
- case 'left': position.x = left + offsetX; break;
2155
- case 'right': position.x = left + offsetX + relativeTo.offsetWidth; break;
2156
- default: position.x = left + ((relativeTo == document.body ? winSize.x : relativeTo.offsetWidth) / 2) + offsetX; break;
2157
- }
2158
-
2159
- switch(options.position.y){
2160
- case 'top': position.y = top + offsetY; break;
2161
- case 'bottom': position.y = top + offsetY + relativeTo.offsetHeight; break;
2162
- default: position.y = top + ((relativeTo == document.body ? winSize.y : relativeTo.offsetHeight) / 2) + offsetY; break;
2163
- }
2164
- },
2165
-
2166
- toMinMax: function(position, options){
2167
- var xy = {left: 'x', top: 'y'}, value;
2168
- ['minimum', 'maximum'].each(function(minmax){
2169
- ['left', 'top'].each(function(lr){
2170
- value = options[minmax] ? options[minmax][xy[lr]] : null;
2171
- if (value != null && ((minmax == 'minimum') ? position[lr] < value : position[lr] > value)) position[lr] = value;
2172
- });
2173
- });
2174
- },
2175
-
2176
- toRelFixedPosition: function(relativeTo, position){
2177
- var winScroll = window.getScroll();
2178
- position.top += winScroll.y;
2179
- position.left += winScroll.x;
2180
- },
2181
-
2182
- toIgnoreScroll: function(relativeTo, position){
2183
- var relScroll = relativeTo.getScroll();
2184
- position.top -= relScroll.y;
2185
- position.left -= relScroll.x;
2186
- },
2187
-
2188
- toIgnoreMargins: function(position, options){
2189
- position.left += options.edge.x == 'right'
2190
- ? options.dimensions['margin-right']
2191
- : (options.edge.x != 'center'
2192
- ? -options.dimensions['margin-left']
2193
- : -options.dimensions['margin-left'] + ((options.dimensions['margin-right'] + options.dimensions['margin-left']) / 2));
2194
-
2195
- position.top += options.edge.y == 'bottom'
2196
- ? options.dimensions['margin-bottom']
2197
- : (options.edge.y != 'center'
2198
- ? -options.dimensions['margin-top']
2199
- : -options.dimensions['margin-top'] + ((options.dimensions['margin-bottom'] + options.dimensions['margin-top']) / 2));
2200
- },
2201
-
2202
- toEdge: function(position, options){
2203
- var edgeOffset = {},
2204
- dimensions = options.dimensions,
2205
- edge = options.edge;
2206
-
2207
- switch(edge.x){
2208
- case 'left': edgeOffset.x = 0; break;
2209
- case 'right': edgeOffset.x = -dimensions.x - dimensions.computedRight - dimensions.computedLeft; break;
2210
- // center
2211
- default: edgeOffset.x = -(Math.round(dimensions.totalWidth / 2)); break;
2212
- }
2213
-
2214
- switch(edge.y){
2215
- case 'top': edgeOffset.y = 0; break;
2216
- case 'bottom': edgeOffset.y = -dimensions.y - dimensions.computedTop - dimensions.computedBottom; break;
2217
- // center
2218
- default: edgeOffset.y = -(Math.round(dimensions.totalHeight / 2)); break;
2219
- }
2220
-
2221
- position.x += edgeOffset.x;
2222
- position.y += edgeOffset.y;
2223
- },
2224
-
2225
- getCoordinateFromValue: function(option){
2226
- if (typeOf(option) != 'string') return option;
2227
- option = option.toLowerCase();
2228
-
2229
- return {
2230
- x: option.test('left') ? 'left'
2231
- : (option.test('right') ? 'right' : 'center'),
2232
- y: option.test(/upper|top/) ? 'top'
2233
- : (option.test('bottom') ? 'bottom' : 'center')
2234
- };
2235
- }
2236
-
2237
- };
2238
-
2239
- Element.implement({
2240
-
2241
- position: function(options){
2242
- if (options && (options.x != null || options.y != null)){
2243
- return (original ? original.apply(this, arguments) : this);
2244
- }
2245
- var position = this.setStyle('position', 'absolute').calculatePosition(options);
2246
- return (options && options.returnPos) ? position : this.setStyles(position);
2247
- },
2248
-
2249
- calculatePosition: function(options){
2250
- return local.getPosition(this, options);
2251
- }
2252
-
2253
- });
2254
-
2255
- })(Element.prototype.position);
2256
-
2257
-
2258
- /*
2259
- ---
2260
-
2261
- script: Class.Occlude.js
2262
-
2263
- name: Class.Occlude
2264
-
2265
- description: Prevents a class from being applied to a DOM element twice.
2266
-
2267
- license: MIT-style license.
2268
-
2269
- authors:
2270
- - Aaron Newton
2271
-
2272
- requires:
2273
- - Core/Class
2274
- - Core/Element
2275
- - /MooTools.More
2276
-
2277
- provides: [Class.Occlude]
2278
-
2279
- ...
2280
- */
2281
-
2282
- Class.Occlude = new Class({
2283
-
2284
- occlude: function(property, element){
2285
- element = document.id(element || this.element);
2286
- var instance = element.retrieve(property || this.property);
2287
- if (instance && !this.occluded)
2288
- return (this.occluded = instance);
2289
-
2290
- this.occluded = false;
2291
- element.store(property || this.property, this);
2292
- return this.occluded;
2293
- }
2294
-
2295
- });
2296
-
2297
-
2298
- /*
2299
- ---
2300
-
2301
- script: IframeShim.js
2302
-
2303
- name: IframeShim
2304
-
2305
- description: Defines IframeShim, a class for obscuring select lists and flash objects in IE.
2306
-
2307
- license: MIT-style license
2308
-
2309
- authors:
2310
- - Aaron Newton
2311
-
2312
- requires:
2313
- - Core/Element.Event
2314
- - Core/Element.Style
2315
- - Core/Options
2316
- - Core/Events
2317
- - /Element.Position
2318
- - /Class.Occlude
2319
-
2320
- provides: [IframeShim]
2321
-
2322
- ...
2323
- */
2324
-
2325
- var IframeShim = new Class({
2326
-
2327
- Implements: [Options, Events, Class.Occlude],
2328
-
2329
- options: {
2330
- className: 'iframeShim',
2331
- src: 'javascript:false;document.write("");',
2332
- display: false,
2333
- zIndex: null,
2334
- margin: 0,
2335
- offset: {x: 0, y: 0},
2336
- browsers: (Browser.ie6 || (Browser.firefox && Browser.version < 3 && Browser.Platform.mac))
2337
- },
2338
-
2339
- property: 'IframeShim',
2340
-
2341
- initialize: function(element, options){
2342
- this.element = document.id(element);
2343
- if (this.occlude()) return this.occluded;
2344
- this.setOptions(options);
2345
- this.makeShim();
2346
- return this;
2347
- },
2348
-
2349
- makeShim: function(){
2350
- if (this.options.browsers){
2351
- var zIndex = this.element.getStyle('zIndex').toInt();
2352
-
2353
- if (!zIndex){
2354
- zIndex = 1;
2355
- var pos = this.element.getStyle('position');
2356
- if (pos == 'static' || !pos) this.element.setStyle('position', 'relative');
2357
- this.element.setStyle('zIndex', zIndex);
2358
- }
2359
- zIndex = ((this.options.zIndex != null || this.options.zIndex === 0) && zIndex > this.options.zIndex) ? this.options.zIndex : zIndex - 1;
2360
- if (zIndex < 0) zIndex = 1;
2361
- this.shim = new Element('iframe', {
2362
- src: this.options.src,
2363
- scrolling: 'no',
2364
- frameborder: 0,
2365
- styles: {
2366
- zIndex: zIndex,
2367
- position: 'absolute',
2368
- border: 'none',
2369
- filter: 'progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)'
2370
- },
2371
- 'class': this.options.className
2372
- }).store('IframeShim', this);
2373
- var inject = (function(){
2374
- this.shim.inject(this.element, 'after');
2375
- this[this.options.display ? 'show' : 'hide']();
2376
- this.fireEvent('inject');
2377
- }).bind(this);
2378
- if (!IframeShim.ready) window.addEvent('load', inject);
2379
- else inject();
2380
- } else {
2381
- this.position = this.hide = this.show = this.dispose = Function.from(this);
2382
- }
2383
- },
2384
-
2385
- position: function(){
2386
- if (!IframeShim.ready || !this.shim) return this;
2387
- var size = this.element.measure(function(){
2388
- return this.getSize();
2389
- });
2390
- if (this.options.margin != undefined){
2391
- size.x = size.x - (this.options.margin * 2);
2392
- size.y = size.y - (this.options.margin * 2);
2393
- this.options.offset.x += this.options.margin;
2394
- this.options.offset.y += this.options.margin;
2395
- }
2396
- this.shim.set({width: size.x, height: size.y}).position({
2397
- relativeTo: this.element,
2398
- offset: this.options.offset
2399
- });
2400
- return this;
2401
- },
2402
-
2403
- hide: function(){
2404
- if (this.shim) this.shim.setStyle('display', 'none');
2405
- return this;
2406
- },
2407
-
2408
- show: function(){
2409
- if (this.shim) this.shim.setStyle('display', 'block');
2410
- return this.position();
2411
- },
2412
-
2413
- dispose: function(){
2414
- if (this.shim) this.shim.dispose();
2415
- return this;
2416
- },
2417
-
2418
- destroy: function(){
2419
- if (this.shim) this.shim.destroy();
2420
- return this;
2421
- }
2422
-
2423
- });
2424
-
2425
- window.addEvent('load', function(){
2426
- IframeShim.ready = true;
2427
- });
2428
-
2429
-
2430
- /*
2431
- ---
2432
-
2433
- name: Locale.de-DE.Date
2434
-
2435
- description: Date messages for German.
2436
-
2437
- license: MIT-style license
2438
-
2439
- authors:
2440
- - Christoph Pojer
2441
- - Frank Rossi
2442
- - Ulrich Petri
2443
- - Fabian Beiner
2444
-
2445
- requires:
2446
- - /Locale
2447
-
2448
- provides: [Locale.de-DE.Date]
2449
-
2450
- ...
2451
- */
2452
-
2453
- Locale.define('de-DE', 'Date', {
2454
-
2455
- months: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
2456
- months_abbr: ['Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'],
2457
- days: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'],
2458
- days_abbr: ['So.', 'Mo.', 'Di.', 'Mi.', 'Do.', 'Fr.', 'Sa.'],
2459
-
2460
- // Culture's date order: DD.MM.YYYY
2461
- dateOrder: ['date', 'month', 'year'],
2462
- shortDate: '%d.%m.%Y',
2463
- shortTime: '%H:%M',
2464
- AM: 'vormittags',
2465
- PM: 'nachmittags',
2466
- firstDayOfWeek: 1,
2467
-
2468
- // Date.Extras
2469
- ordinal: '.',
2470
-
2471
- lessThanMinuteAgo: 'vor weniger als einer Minute',
2472
- minuteAgo: 'vor einer Minute',
2473
- minutesAgo: 'vor {delta} Minuten',
2474
- hourAgo: 'vor einer Stunde',
2475
- hoursAgo: 'vor {delta} Stunden',
2476
- dayAgo: 'vor einem Tag',
2477
- daysAgo: 'vor {delta} Tagen',
2478
- weekAgo: 'vor einer Woche',
2479
- weeksAgo: 'vor {delta} Wochen',
2480
- monthAgo: 'vor einem Monat',
2481
- monthsAgo: 'vor {delta} Monaten',
2482
- yearAgo: 'vor einem Jahr',
2483
- yearsAgo: 'vor {delta} Jahren',
2484
-
2485
- lessThanMinuteUntil: 'in weniger als einer Minute',
2486
- minuteUntil: 'in einer Minute',
2487
- minutesUntil: 'in {delta} Minuten',
2488
- hourUntil: 'in ca. einer Stunde',
2489
- hoursUntil: 'in ca. {delta} Stunden',
2490
- dayUntil: 'in einem Tag',
2491
- daysUntil: 'in {delta} Tagen',
2492
- weekUntil: 'in einer Woche',
2493
- weeksUntil: 'in {delta} Wochen',
2494
- monthUntil: 'in einem Monat',
2495
- monthsUntil: 'in {delta} Monaten',
2496
- yearUntil: 'in einem Jahr',
2497
- yearsUntil: 'in {delta} Jahren'
2498
-
2499
- });
2500
-