├── .c9settings.xml
├── .nfs6FF14
├── .project
├── Examples
├── img1.jpg
├── img2.jpg
├── index.html
├── mootools-core-1.3-full-nocompat.js
├── mootools-more-1.3.2.1.js
├── test.html
├── test1.html
├── test2.html
└── test3.html
├── README.md
├── Source
├── .nfs9FF14
└── Fx.CSS3.js
├── license
├── package.yml
└── screen.png
/.c9settings.xml:
--------------------------------------------------------------------------------
1 | {"ext/editors/editors":{"parent":{"visible":2,"flex":1},"visible":2,"flex":1},"ext/tree/tree":{"parent":{"visible":2,"width":"200"},"visible":true,"flex":3,"state":"normal"},"ext/console/console":{"parent":{"visible":2,"height":200},"visible":true,"flex":1}}["folder[1]","folder[1]/folder[2]","folder[1]/folder[2]/file[2]","folder[1]/folder[1]","folder[1]/folder[1]/file[3]","folder[1]/folder[2]/file[1]"]
--------------------------------------------------------------------------------
/.nfs6FF14:
--------------------------------------------------------------------------------
1 | {"ext/editors/editors":{"parent":{"visible":2,"flex":1},"visible":2,"flex":1},"ext/tree/tree":{"parent":{"visible":2,"width":"200"},"visible":true,"flex":3,"state":"normal"},"ext/console/console":{"parent":{"visible":2,"height":"41"},"visible":false,"flex":1}}
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | Mootools - Fx.Tween.CSS3
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Examples/img1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunboX/mootools-fx-tween-css3/87ff7a71b512ebeb78de4dd46744a18de9720add/Examples/img1.jpg
--------------------------------------------------------------------------------
/Examples/img2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunboX/mootools-fx-tween-css3/87ff7a71b512ebeb78de4dd46744a18de9720add/Examples/img2.jpg
--------------------------------------------------------------------------------
/Examples/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Fx.Tween.CSS3 Demo
6 |
7 |
19 |
20 |
21 |
22 |
23 |
82 |
83 |
84 |
85 |
86 | click here to test tween
87 |
88 |
89 | click here to test morph
90 |
91 |
92 | click here to test elements
93 |
94 |
95 | click here to test elements
96 |
97 |
98 |
--------------------------------------------------------------------------------
/Examples/mootools-core-1.3-full-nocompat.js:
--------------------------------------------------------------------------------
1 | /*
2 | ---
3 | MooTools: the javascript framework
4 |
5 | web build:
6 | - http://mootools.net/core/7c56cfef9dddcf170a5d68e3fb61cfd7
7 |
8 | packager build:
9 | - packager build Core/Core Core/Array Core/String Core/Number Core/Function Core/Object Core/Event Core/Browser Core/Class Core/Class.Extras Core/Slick.Parser Core/Slick.Finder Core/Element Core/Element.Style Core/Element.Event Core/Element.Dimensions Core/Fx Core/Fx.CSS Core/Fx.Tween Core/Fx.Morph Core/Fx.Transitions Core/Request Core/Request.HTML Core/Request.JSON Core/Cookie Core/JSON Core/DOMReady Core/Swiff
10 |
11 | /*
12 | ---
13 |
14 | name: Core
15 |
16 | description: The heart of MooTools.
17 |
18 | license: MIT-style license.
19 |
20 | copyright: Copyright (c) 2006-2010 [Valerio Proietti](http://mad4milk.net/).
21 |
22 | authors: The MooTools production team (http://mootools.net/developers/)
23 |
24 | inspiration:
25 | - Class implementation inspired by [Base.js](http://dean.edwards.name/weblog/2006/03/base/) Copyright (c) 2006 Dean Edwards, [GNU Lesser General Public License](http://opensource.org/licenses/lgpl-license.php)
26 | - Some functionality inspired by [Prototype.js](http://prototypejs.org) Copyright (c) 2005-2007 Sam Stephenson, [MIT License](http://opensource.org/licenses/mit-license.php)
27 |
28 | provides: [Core, MooTools, Type, typeOf, instanceOf, Native]
29 |
30 | ...
31 | */
32 |
33 | (function(){
34 |
35 | this.MooTools = {
36 | version: '1.3',
37 | build: 'a3eed692dd85050d80168ec2c708efe901bb7db3'
38 | };
39 |
40 | // typeOf, instanceOf
41 |
42 | var typeOf = this.typeOf = function(item){
43 | if (item == null) return 'null';
44 | if (item.$family) return item.$family();
45 |
46 | if (item.nodeName){
47 | if (item.nodeType == 1) return 'element';
48 | if (item.nodeType == 3) return (/\S/).test(item.nodeValue) ? 'textnode' : 'whitespace';
49 | } else if (typeof item.length == 'number'){
50 | if (item.callee) return 'arguments';
51 | if ('item' in item) return 'collection';
52 | }
53 |
54 | return typeof item;
55 | };
56 |
57 | var instanceOf = this.instanceOf = function(item, object){
58 | if (item == null) return false;
59 | var constructor = item.$constructor || item.constructor;
60 | while (constructor){
61 | if (constructor === object) return true;
62 | constructor = constructor.parent;
63 | }
64 | return item instanceof object;
65 | };
66 |
67 | // Function overloading
68 |
69 | var Function = this.Function;
70 |
71 | var enumerables = true;
72 | for (var i in {toString: 1}) enumerables = null;
73 | if (enumerables) enumerables = ['hasOwnProperty', 'valueOf', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'constructor'];
74 |
75 | Function.prototype.overloadSetter = function(usePlural){
76 | var self = this;
77 | return function(a, b){
78 | if (a == null) return this;
79 | if (usePlural || typeof a != 'string'){
80 | for (var k in a) self.call(this, k, a[k]);
81 | if (enumerables) for (var i = enumerables.length; i--;){
82 | k = enumerables[i];
83 | if (a.hasOwnProperty(k)) self.call(this, k, a[k]);
84 | }
85 | } else {
86 | self.call(this, a, b);
87 | }
88 | return this;
89 | };
90 | };
91 |
92 | Function.prototype.overloadGetter = function(usePlural){
93 | var self = this;
94 | return function(a){
95 | var args, result;
96 | if (usePlural || typeof a != 'string') args = a;
97 | else if (arguments.length > 1) args = arguments;
98 | if (args){
99 | result = {};
100 | for (var i = 0; i < args.length; i++) result[args[i]] = self.call(this, args[i]);
101 | } else {
102 | result = self.call(this, a);
103 | }
104 | return result;
105 | };
106 | };
107 |
108 | Function.prototype.extend = function(key, value){
109 | this[key] = value;
110 | }.overloadSetter();
111 |
112 | Function.prototype.implement = function(key, value){
113 | this.prototype[key] = value;
114 | }.overloadSetter();
115 |
116 | // From
117 |
118 | var slice = Array.prototype.slice;
119 |
120 | Function.from = function(item){
121 | return (typeOf(item) == 'function') ? item : function(){
122 | return item;
123 | };
124 | };
125 |
126 | Array.from = function(item){
127 | if (item == null) return [];
128 | return (Type.isEnumerable(item) && typeof item != 'string') ? (typeOf(item) == 'array') ? item : slice.call(item) : [item];
129 | };
130 |
131 | Number.from = function(item){
132 | var number = parseFloat(item);
133 | return isFinite(number) ? number : null;
134 | };
135 |
136 | String.from = function(item){
137 | return item + '';
138 | };
139 |
140 | // hide, protect
141 |
142 | Function.implement({
143 |
144 | hide: function(){
145 | this.$hidden = true;
146 | return this;
147 | },
148 |
149 | protect: function(){
150 | this.$protected = true;
151 | return this;
152 | }
153 |
154 | });
155 |
156 | // Type
157 |
158 | var Type = this.Type = function(name, object){
159 | if (name){
160 | var lower = name.toLowerCase();
161 | var typeCheck = function(item){
162 | return (typeOf(item) == lower);
163 | };
164 |
165 | Type['is' + name] = typeCheck;
166 | if (object != null){
167 | object.prototype.$family = (function(){
168 | return lower;
169 | }).hide();
170 |
171 | }
172 | }
173 |
174 | if (object == null) return null;
175 |
176 | object.extend(this);
177 | object.$constructor = Type;
178 | object.prototype.$constructor = object;
179 |
180 | return object;
181 | };
182 |
183 | var toString = Object.prototype.toString;
184 |
185 | Type.isEnumerable = function(item){
186 | return (item != null && typeof item.length == 'number' && toString.call(item) != '[object Function]' );
187 | };
188 |
189 | var hooks = {};
190 |
191 | var hooksOf = function(object){
192 | var type = typeOf(object.prototype);
193 | return hooks[type] || (hooks[type] = []);
194 | };
195 |
196 | var implement = function(name, method){
197 | if (method && method.$hidden) return this;
198 |
199 | var hooks = hooksOf(this);
200 |
201 | for (var i = 0; i < hooks.length; i++){
202 | var hook = hooks[i];
203 | if (typeOf(hook) == 'type') implement.call(hook, name, method);
204 | else hook.call(this, name, method);
205 | }
206 |
207 | var previous = this.prototype[name];
208 | if (previous == null || !previous.$protected) this.prototype[name] = method;
209 |
210 | if (this[name] == null && typeOf(method) == 'function') extend.call(this, name, function(item){
211 | return method.apply(item, slice.call(arguments, 1));
212 | });
213 |
214 | return this;
215 | };
216 |
217 | var extend = function(name, method){
218 | if (method && method.$hidden) return this;
219 | var previous = this[name];
220 | if (previous == null || !previous.$protected) this[name] = method;
221 | return this;
222 | };
223 |
224 | Type.implement({
225 |
226 | implement: implement.overloadSetter(),
227 |
228 | extend: extend.overloadSetter(),
229 |
230 | alias: function(name, existing){
231 | implement.call(this, name, this.prototype[existing]);
232 | }.overloadSetter(),
233 |
234 | mirror: function(hook){
235 | hooksOf(this).push(hook);
236 | return this;
237 | }
238 |
239 | });
240 |
241 | new Type('Type', Type);
242 |
243 | // Default Types
244 |
245 | var force = function(name, object, methods){
246 | var isType = (object != Object),
247 | prototype = object.prototype;
248 |
249 | if (isType) object = new Type(name, object);
250 |
251 | for (var i = 0, l = methods.length; i < l; i++){
252 | var key = methods[i],
253 | generic = object[key],
254 | proto = prototype[key];
255 |
256 | if (generic) generic.protect();
257 |
258 | if (isType && proto){
259 | delete prototype[key];
260 | prototype[key] = proto.protect();
261 | }
262 | }
263 |
264 | if (isType) object.implement(prototype);
265 |
266 | return force;
267 | };
268 |
269 | force('String', String, [
270 | 'charAt', 'charCodeAt', 'concat', 'indexOf', 'lastIndexOf', 'match', 'quote', 'replace', 'search',
271 | 'slice', 'split', 'substr', 'substring', 'toLowerCase', 'toUpperCase'
272 | ])('Array', Array, [
273 | 'pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift', 'concat', 'join', 'slice',
274 | 'indexOf', 'lastIndexOf', 'filter', 'forEach', 'every', 'map', 'some', 'reduce', 'reduceRight'
275 | ])('Number', Number, [
276 | 'toExponential', 'toFixed', 'toLocaleString', 'toPrecision'
277 | ])('Function', Function, [
278 | 'apply', 'call', 'bind'
279 | ])('RegExp', RegExp, [
280 | 'exec', 'test'
281 | ])('Object', Object, [
282 | 'create', 'defineProperty', 'defineProperties', 'keys',
283 | 'getPrototypeOf', 'getOwnPropertyDescriptor', 'getOwnPropertyNames',
284 | 'preventExtensions', 'isExtensible', 'seal', 'isSealed', 'freeze', 'isFrozen'
285 | ])('Date', Date, ['now']);
286 |
287 | Object.extend = extend.overloadSetter();
288 |
289 | Date.extend('now', function(){
290 | return +(new Date);
291 | });
292 |
293 | new Type('Boolean', Boolean);
294 |
295 | // fixes NaN returning as Number
296 |
297 | Number.prototype.$family = function(){
298 | return isFinite(this) ? 'number' : 'null';
299 | }.hide();
300 |
301 | // Number.random
302 |
303 | Number.extend('random', function(min, max){
304 | return Math.floor(Math.random() * (max - min + 1) + min);
305 | });
306 |
307 | // forEach, each
308 |
309 | Object.extend('forEach', function(object, fn, bind){
310 | for (var key in object){
311 | if (object.hasOwnProperty(key)) fn.call(bind, object[key], key, object);
312 | }
313 | });
314 |
315 | Object.each = Object.forEach;
316 |
317 | Array.implement({
318 |
319 | forEach: function(fn, bind){
320 | for (var i = 0, l = this.length; i < l; i++){
321 | if (i in this) fn.call(bind, this[i], i, this);
322 | }
323 | },
324 |
325 | each: function(fn, bind){
326 | Array.forEach(this, fn, bind);
327 | return this;
328 | }
329 |
330 | });
331 |
332 | // Array & Object cloning, Object merging and appending
333 |
334 | var cloneOf = function(item){
335 | switch (typeOf(item)){
336 | case 'array': return item.clone();
337 | case 'object': return Object.clone(item);
338 | default: return item;
339 | }
340 | };
341 |
342 | Array.implement('clone', function(){
343 | var i = this.length, clone = new Array(i);
344 | while (i--) clone[i] = cloneOf(this[i]);
345 | return clone;
346 | });
347 |
348 | var mergeOne = function(source, key, current){
349 | switch (typeOf(current)){
350 | case 'object':
351 | if (typeOf(source[key]) == 'object') Object.merge(source[key], current);
352 | else source[key] = Object.clone(current);
353 | break;
354 | case 'array': source[key] = current.clone(); break;
355 | default: source[key] = current;
356 | }
357 | return source;
358 | };
359 |
360 | Object.extend({
361 |
362 | merge: function(source, k, v){
363 | if (typeOf(k) == 'string') return mergeOne(source, k, v);
364 | for (var i = 1, l = arguments.length; i < l; i++){
365 | var object = arguments[i];
366 | for (var key in object) mergeOne(source, key, object[key]);
367 | }
368 | return source;
369 | },
370 |
371 | clone: function(object){
372 | var clone = {};
373 | for (var key in object) clone[key] = cloneOf(object[key]);
374 | return clone;
375 | },
376 |
377 | append: function(original){
378 | for (var i = 1, l = arguments.length; i < l; i++){
379 | var extended = arguments[i] || {};
380 | for (var key in extended) original[key] = extended[key];
381 | }
382 | return original;
383 | }
384 |
385 | });
386 |
387 | // Object-less types
388 |
389 | ['Object', 'WhiteSpace', 'TextNode', 'Collection', 'Arguments'].each(function(name){
390 | new Type(name);
391 | });
392 |
393 | // Unique ID
394 |
395 | var UID = Date.now();
396 |
397 | String.extend('uniqueID', function(){
398 | return (UID++).toString(36);
399 | });
400 |
401 |
402 |
403 | })();
404 |
405 |
406 | /*
407 | ---
408 |
409 | name: Array
410 |
411 | description: Contains Array Prototypes like each, contains, and erase.
412 |
413 | license: MIT-style license.
414 |
415 | requires: Type
416 |
417 | provides: Array
418 |
419 | ...
420 | */
421 |
422 | Array.implement({
423 |
424 | invoke: function(methodName){
425 | var args = Array.slice(arguments, 1);
426 | return this.map(function(item){
427 | return item[methodName].apply(item, args);
428 | });
429 | },
430 |
431 | every: function(fn, bind){
432 | for (var i = 0, l = this.length; i < l; i++){
433 | if ((i in this) && !fn.call(bind, this[i], i, this)) return false;
434 | }
435 | return true;
436 | },
437 |
438 | filter: function(fn, bind){
439 | var results = [];
440 | for (var i = 0, l = this.length; i < l; i++){
441 | if ((i in this) && fn.call(bind, this[i], i, this)) results.push(this[i]);
442 | }
443 | return results;
444 | },
445 |
446 | clean: function(){
447 | return this.filter(function(item){
448 | return item != null;
449 | });
450 | },
451 |
452 | indexOf: function(item, from){
453 | var len = this.length;
454 | for (var i = (from < 0) ? Math.max(0, len + from) : from || 0; i < len; i++){
455 | if (this[i] === item) return i;
456 | }
457 | return -1;
458 | },
459 |
460 | map: function(fn, bind){
461 | var results = [];
462 | for (var i = 0, l = this.length; i < l; i++){
463 | if (i in this) results[i] = fn.call(bind, this[i], i, this);
464 | }
465 | return results;
466 | },
467 |
468 | some: function(fn, bind){
469 | for (var i = 0, l = this.length; i < l; i++){
470 | if ((i in this) && fn.call(bind, this[i], i, this)) return true;
471 | }
472 | return false;
473 | },
474 |
475 | associate: function(keys){
476 | var obj = {}, length = Math.min(this.length, keys.length);
477 | for (var i = 0; i < length; i++) obj[keys[i]] = this[i];
478 | return obj;
479 | },
480 |
481 | link: function(object){
482 | var result = {};
483 | for (var i = 0, l = this.length; i < l; i++){
484 | for (var key in object){
485 | if (object[key](this[i])){
486 | result[key] = this[i];
487 | delete object[key];
488 | break;
489 | }
490 | }
491 | }
492 | return result;
493 | },
494 |
495 | contains: function(item, from){
496 | return this.indexOf(item, from) != -1;
497 | },
498 |
499 | append: function(array){
500 | this.push.apply(this, array);
501 | return this;
502 | },
503 |
504 | getLast: function(){
505 | return (this.length) ? this[this.length - 1] : null;
506 | },
507 |
508 | getRandom: function(){
509 | return (this.length) ? this[Number.random(0, this.length - 1)] : null;
510 | },
511 |
512 | include: function(item){
513 | if (!this.contains(item)) this.push(item);
514 | return this;
515 | },
516 |
517 | combine: function(array){
518 | for (var i = 0, l = array.length; i < l; i++) this.include(array[i]);
519 | return this;
520 | },
521 |
522 | erase: function(item){
523 | for (var i = this.length; i--;){
524 | if (this[i] === item) this.splice(i, 1);
525 | }
526 | return this;
527 | },
528 |
529 | empty: function(){
530 | this.length = 0;
531 | return this;
532 | },
533 |
534 | flatten: function(){
535 | var array = [];
536 | for (var i = 0, l = this.length; i < l; i++){
537 | var type = typeOf(this[i]);
538 | if (type == 'null') continue;
539 | array = array.concat((type == 'array' || type == 'collection' || type == 'arguments' || instanceOf(this[i], Array)) ? Array.flatten(this[i]) : this[i]);
540 | }
541 | return array;
542 | },
543 |
544 | pick: function(){
545 | for (var i = 0, l = this.length; i < l; i++){
546 | if (this[i] != null) return this[i];
547 | }
548 | return null;
549 | },
550 |
551 | hexToRgb: function(array){
552 | if (this.length != 3) return null;
553 | var rgb = this.map(function(value){
554 | if (value.length == 1) value += value;
555 | return value.toInt(16);
556 | });
557 | return (array) ? rgb : 'rgb(' + rgb + ')';
558 | },
559 |
560 | rgbToHex: function(array){
561 | if (this.length < 3) return null;
562 | if (this.length == 4 && this[3] == 0 && !array) return 'transparent';
563 | var hex = [];
564 | for (var i = 0; i < 3; i++){
565 | var bit = (this[i] - 0).toString(16);
566 | hex.push((bit.length == 1) ? '0' + bit : bit);
567 | }
568 | return (array) ? hex : '#' + hex.join('');
569 | }
570 |
571 | });
572 |
573 |
574 |
575 |
576 | /*
577 | ---
578 |
579 | name: String
580 |
581 | description: Contains String Prototypes like camelCase, capitalize, test, and toInt.
582 |
583 | license: MIT-style license.
584 |
585 | requires: Type
586 |
587 | provides: String
588 |
589 | ...
590 | */
591 |
592 | String.implement({
593 |
594 | test: function(regex, params){
595 | return ((typeOf(regex) == 'regexp') ? regex : new RegExp('' + regex, params)).test(this);
596 | },
597 |
598 | contains: function(string, separator){
599 | return (separator) ? (separator + this + separator).indexOf(separator + string + separator) > -1 : this.indexOf(string) > -1;
600 | },
601 |
602 | trim: function(){
603 | return this.replace(/^\s+|\s+$/g, '');
604 | },
605 |
606 | clean: function(){
607 | return this.replace(/\s+/g, ' ').trim();
608 | },
609 |
610 | camelCase: function(){
611 | return this.replace(/-\D/g, function(match){
612 | return match.charAt(1).toUpperCase();
613 | });
614 | },
615 |
616 | hyphenate: function(){
617 | return this.replace(/[A-Z]/g, function(match){
618 | return ('-' + match.charAt(0).toLowerCase());
619 | });
620 | },
621 |
622 | capitalize: function(){
623 | return this.replace(/\b[a-z]/g, function(match){
624 | return match.toUpperCase();
625 | });
626 | },
627 |
628 | escapeRegExp: function(){
629 | return this.replace(/([-.*+?^${}()|[\]\/\\])/g, '\\$1');
630 | },
631 |
632 | toInt: function(base){
633 | return parseInt(this, base || 10);
634 | },
635 |
636 | toFloat: function(){
637 | return parseFloat(this);
638 | },
639 |
640 | hexToRgb: function(array){
641 | var hex = this.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/);
642 | return (hex) ? hex.slice(1).hexToRgb(array) : null;
643 | },
644 |
645 | rgbToHex: function(array){
646 | var rgb = this.match(/\d{1,3}/g);
647 | return (rgb) ? rgb.rgbToHex(array) : null;
648 | },
649 |
650 | substitute: function(object, regexp){
651 | return this.replace(regexp || (/\\?\{([^{}]+)\}/g), function(match, name){
652 | if (match.charAt(0) == '\\') return match.slice(1);
653 | return (object[name] != null) ? object[name] : '';
654 | });
655 | }
656 |
657 | });
658 |
659 |
660 | /*
661 | ---
662 |
663 | name: Number
664 |
665 | description: Contains Number Prototypes like limit, round, times, and ceil.
666 |
667 | license: MIT-style license.
668 |
669 | requires: Type
670 |
671 | provides: Number
672 |
673 | ...
674 | */
675 |
676 | Number.implement({
677 |
678 | limit: function(min, max){
679 | return Math.min(max, Math.max(min, this));
680 | },
681 |
682 | round: function(precision){
683 | precision = Math.pow(10, precision || 0).toFixed(precision < 0 ? -precision : 0);
684 | return Math.round(this * precision) / precision;
685 | },
686 |
687 | times: function(fn, bind){
688 | for (var i = 0; i < this; i++) fn.call(bind, i, this);
689 | },
690 |
691 | toFloat: function(){
692 | return parseFloat(this);
693 | },
694 |
695 | toInt: function(base){
696 | return parseInt(this, base || 10);
697 | }
698 |
699 | });
700 |
701 | Number.alias('each', 'times');
702 |
703 | (function(math){
704 | var methods = {};
705 | math.each(function(name){
706 | if (!Number[name]) methods[name] = function(){
707 | return Math[name].apply(null, [this].concat(Array.from(arguments)));
708 | };
709 | });
710 | Number.implement(methods);
711 | })(['abs', 'acos', 'asin', 'atan', 'atan2', 'ceil', 'cos', 'exp', 'floor', 'log', 'max', 'min', 'pow', 'sin', 'sqrt', 'tan']);
712 |
713 |
714 | /*
715 | ---
716 |
717 | name: Function
718 |
719 | description: Contains Function Prototypes like create, bind, pass, and delay.
720 |
721 | license: MIT-style license.
722 |
723 | requires: Type
724 |
725 | provides: Function
726 |
727 | ...
728 | */
729 |
730 | Function.extend({
731 |
732 | attempt: function(){
733 | for (var i = 0, l = arguments.length; i < l; i++){
734 | try {
735 | return arguments[i]();
736 | } catch (e){}
737 | }
738 | return null;
739 | }
740 |
741 | });
742 |
743 | Function.implement({
744 |
745 | attempt: function(args, bind){
746 | try {
747 | return this.apply(bind, Array.from(args));
748 | } catch (e){}
749 |
750 | return null;
751 | },
752 |
753 | bind: function(bind){
754 | var self = this,
755 | args = (arguments.length > 1) ? Array.slice(arguments, 1) : null;
756 |
757 | return function(){
758 | if (!args && !arguments.length) return self.call(bind);
759 | if (args && arguments.length) return self.apply(bind, args.concat(Array.from(arguments)));
760 | return self.apply(bind, args || arguments);
761 | };
762 | },
763 |
764 | pass: function(args, bind){
765 | var self = this;
766 | if (args != null) args = Array.from(args);
767 | return function(){
768 | return self.apply(bind, args || arguments);
769 | };
770 | },
771 |
772 | delay: function(delay, bind, args){
773 | return setTimeout(this.pass(args, bind), delay);
774 | },
775 |
776 | periodical: function(periodical, bind, args){
777 | return setInterval(this.pass(args, bind), periodical);
778 | }
779 |
780 | });
781 |
782 |
783 |
784 |
785 | /*
786 | ---
787 |
788 | name: Object
789 |
790 | description: Object generic methods
791 |
792 | license: MIT-style license.
793 |
794 | requires: Type
795 |
796 | provides: [Object, Hash]
797 |
798 | ...
799 | */
800 |
801 |
802 | Object.extend({
803 |
804 | subset: function(object, keys){
805 | var results = {};
806 | for (var i = 0, l = keys.length; i < l; i++){
807 | var k = keys[i];
808 | results[k] = object[k];
809 | }
810 | return results;
811 | },
812 |
813 | map: function(object, fn, bind){
814 | var results = {};
815 | for (var key in object){
816 | if (object.hasOwnProperty(key)) results[key] = fn.call(bind, object[key], key, object);
817 | }
818 | return results;
819 | },
820 |
821 | filter: function(object, fn, bind){
822 | var results = {};
823 | Object.each(object, function(value, key){
824 | if (fn.call(bind, value, key, object)) results[key] = value;
825 | });
826 | return results;
827 | },
828 |
829 | every: function(object, fn, bind){
830 | for (var key in object){
831 | if (object.hasOwnProperty(key) && !fn.call(bind, object[key], key)) return false;
832 | }
833 | return true;
834 | },
835 |
836 | some: function(object, fn, bind){
837 | for (var key in object){
838 | if (object.hasOwnProperty(key) && fn.call(bind, object[key], key)) return true;
839 | }
840 | return false;
841 | },
842 |
843 | keys: function(object){
844 | var keys = [];
845 | for (var key in object){
846 | if (object.hasOwnProperty(key)) keys.push(key);
847 | }
848 | return keys;
849 | },
850 |
851 | values: function(object){
852 | var values = [];
853 | for (var key in object){
854 | if (object.hasOwnProperty(key)) values.push(object[key]);
855 | }
856 | return values;
857 | },
858 |
859 | getLength: function(object){
860 | return Object.keys(object).length;
861 | },
862 |
863 | keyOf: function(object, value){
864 | for (var key in object){
865 | if (object.hasOwnProperty(key) && object[key] === value) return key;
866 | }
867 | return null;
868 | },
869 |
870 | contains: function(object, value){
871 | return Object.keyOf(object, value) != null;
872 | },
873 |
874 | toQueryString: function(object, base){
875 | var queryString = [];
876 |
877 | Object.each(object, function(value, key){
878 | if (base) key = base + '[' + key + ']';
879 | var result;
880 | switch (typeOf(value)){
881 | case 'object': result = Object.toQueryString(value, key); break;
882 | case 'array':
883 | var qs = {};
884 | value.each(function(val, i){
885 | qs[i] = val;
886 | });
887 | result = Object.toQueryString(qs, key);
888 | break;
889 | default: result = key + '=' + encodeURIComponent(value);
890 | }
891 | if (value != null) queryString.push(result);
892 | });
893 |
894 | return queryString.join('&');
895 | }
896 |
897 | });
898 |
899 |
900 |
901 |
902 |
903 | /*
904 | ---
905 |
906 | name: Browser
907 |
908 | description: The Browser Object. Contains Browser initialization, Window and Document, and the Browser Hash.
909 |
910 | license: MIT-style license.
911 |
912 | requires: [Array, Function, Number, String]
913 |
914 | provides: [Browser, Window, Document]
915 |
916 | ...
917 | */
918 |
919 | (function(){
920 |
921 | var document = this.document;
922 | var window = document.window = this;
923 |
924 | var UID = 1;
925 |
926 | this.$uid = (window.ActiveXObject) ? function(item){
927 | return (item.uid || (item.uid = [UID++]))[0];
928 | } : function(item){
929 | return item.uid || (item.uid = UID++);
930 | };
931 |
932 | $uid(window);
933 | $uid(document);
934 |
935 | var ua = navigator.userAgent.toLowerCase(),
936 | platform = navigator.platform.toLowerCase(),
937 | UA = ua.match(/(opera|ie|firefox|chrome|version)[\s\/:]([\w\d\.]+)?.*?(safari|version[\s\/:]([\w\d\.]+)|$)/) || [null, 'unknown', 0],
938 | mode = UA[1] == 'ie' && document.documentMode;
939 |
940 | var Browser = this.Browser = {
941 |
942 | extend: Function.prototype.extend,
943 |
944 | name: (UA[1] == 'version') ? UA[3] : UA[1],
945 |
946 | version: mode || parseFloat((UA[1] == 'opera' && UA[4]) ? UA[4] : UA[2]),
947 |
948 | Platform: {
949 | name: ua.match(/ip(?:ad|od|hone)/) ? 'ios' : (ua.match(/(?:webos|android)/) || platform.match(/mac|win|linux/) || ['other'])[0]
950 | },
951 |
952 | Features: {
953 | xpath: !!(document.evaluate),
954 | air: !!(window.runtime),
955 | query: !!(document.querySelector),
956 | json: !!(window.JSON)
957 | },
958 |
959 | Plugins: {}
960 |
961 | };
962 |
963 | Browser[Browser.name] = true;
964 | Browser[Browser.name + parseInt(Browser.version, 10)] = true;
965 | Browser.Platform[Browser.Platform.name] = true;
966 |
967 | // Request
968 |
969 | Browser.Request = (function(){
970 |
971 | var XMLHTTP = function(){
972 | return new XMLHttpRequest();
973 | };
974 |
975 | var MSXML2 = function(){
976 | return new ActiveXObject('MSXML2.XMLHTTP');
977 | };
978 |
979 | var MSXML = function(){
980 | return new ActiveXObject('Microsoft.XMLHTTP');
981 | };
982 |
983 | return Function.attempt(function(){
984 | XMLHTTP();
985 | return XMLHTTP;
986 | }, function(){
987 | MSXML2();
988 | return MSXML2;
989 | }, function(){
990 | MSXML();
991 | return MSXML;
992 | });
993 |
994 | })();
995 |
996 | Browser.Features.xhr = !!(Browser.Request);
997 |
998 | // Flash detection
999 |
1000 | var version = (Function.attempt(function(){
1001 | return navigator.plugins['Shockwave Flash'].description;
1002 | }, function(){
1003 | return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version');
1004 | }) || '0 r0').match(/\d+/g);
1005 |
1006 | Browser.Plugins.Flash = {
1007 | version: Number(version[0] || '0.' + version[1]) || 0,
1008 | build: Number(version[2]) || 0
1009 | };
1010 |
1011 | // String scripts
1012 |
1013 | Browser.exec = function(text){
1014 | if (!text) return text;
1015 | if (window.execScript){
1016 | window.execScript(text);
1017 | } else {
1018 | var script = document.createElement('script');
1019 | script.setAttribute('type', 'text/javascript');
1020 | script.text = text;
1021 | document.head.appendChild(script);
1022 | document.head.removeChild(script);
1023 | }
1024 | return text;
1025 | };
1026 |
1027 | String.implement('stripScripts', function(exec){
1028 | var scripts = '';
1029 | var text = this.replace(/
34 |
35 |
133 |
134 |
135 |
136 |
139 |
140 |

141 |

142 |
143 |
144 |