1 | ;(function(){var require = function (file, cwd) {
|
2 | var resolved = require.resolve(file, cwd || '/');
|
3 | var mod = require.modules[resolved];
|
4 | if (!mod) throw new Error(
|
5 | 'Failed to resolve module ' + file + ', tried ' + resolved
|
6 | );
|
7 | var res = mod._cached ? mod._cached : mod();
|
8 | return res;
|
9 | }
|
10 | var __require = require;
|
11 |
|
12 | require.paths = [];
|
13 | require.modules = {};
|
14 | require.extensions = [".js",".coffee"];
|
15 |
|
16 | require._core = {
|
17 | 'assert': true,
|
18 | 'events': true,
|
19 | 'fs': true,
|
20 | 'path': true,
|
21 | 'vm': true
|
22 | };
|
23 |
|
24 | require.resolve = (function () {
|
25 | return function (x, cwd) {
|
26 | if (!cwd) cwd = '/';
|
27 |
|
28 | if (require._core[x]) return x;
|
29 | var path = require.modules.path();
|
30 | var y = cwd || '.';
|
31 |
|
32 | if (x.match(/^(?:\.\.?\/|\/)/)) {
|
33 | var m = loadAsFileSync(path.resolve(y, x))
|
34 | || loadAsDirectorySync(path.resolve(y, x));
|
35 | if (m) return m;
|
36 | }
|
37 |
|
38 | var n = loadNodeModulesSync(x, y);
|
39 | if (n) return n;
|
40 |
|
41 | throw new Error("Cannot find module '" + x + "'");
|
42 |
|
43 | function loadAsFileSync (x) {
|
44 | if (require.modules[x]) {
|
45 | return x;
|
46 | }
|
47 |
|
48 | for (var i = 0; i < require.extensions.length; i++) {
|
49 | var ext = require.extensions[i];
|
50 | if (require.modules[x + ext]) return x + ext;
|
51 | }
|
52 | }
|
53 |
|
54 | function loadAsDirectorySync (x) {
|
55 | x = x.replace(/\/+$/, '');
|
56 | var pkgfile = x + '/package.json';
|
57 | if (require.modules[pkgfile]) {
|
58 | var pkg = require.modules[pkgfile]();
|
59 | var b = pkg.browserify;
|
60 | if (typeof b === 'object' && b.main) {
|
61 | var m = loadAsFileSync(path.resolve(x, b.main));
|
62 | if (m) return m;
|
63 | }
|
64 | else if (typeof b === 'string') {
|
65 | var m = loadAsFileSync(path.resolve(x, b));
|
66 | if (m) return m;
|
67 | }
|
68 | else if (pkg.main) {
|
69 | var m = loadAsFileSync(path.resolve(x, pkg.main));
|
70 | if (m) return m;
|
71 | }
|
72 | }
|
73 |
|
74 | return loadAsFileSync(x + '/index');
|
75 | }
|
76 |
|
77 | function loadNodeModulesSync (x, start) {
|
78 | var dirs = nodeModulesPathsSync(start);
|
79 | for (var i = 0; i < dirs.length; i++) {
|
80 | var dir = dirs[i];
|
81 | var m = loadAsFileSync(dir + '/' + x);
|
82 | if (m) return m;
|
83 | var n = loadAsDirectorySync(dir + '/' + x);
|
84 | if (n) return n;
|
85 | }
|
86 |
|
87 | var m = loadAsFileSync(x);
|
88 | if (m) return m;
|
89 | }
|
90 |
|
91 | function nodeModulesPathsSync (start) {
|
92 | var parts;
|
93 | if (start === '/') parts = [ '' ];
|
94 | else parts = path.normalize(start).split('/');
|
95 |
|
96 | var dirs = [];
|
97 | for (var i = parts.length - 1; i >= 0; i--) {
|
98 | if (parts[i] === 'node_modules') continue;
|
99 | var dir = parts.slice(0, i + 1).join('/') + '/node_modules';
|
100 | dirs.push(dir);
|
101 | }
|
102 |
|
103 | return dirs;
|
104 | }
|
105 | };
|
106 | })();
|
107 |
|
108 | require.alias = function (from, to) {
|
109 | var path = require.modules.path();
|
110 | var res = null;
|
111 | try {
|
112 | res = require.resolve(from + '/package.json', '/');
|
113 | }
|
114 | catch (err) {
|
115 | res = require.resolve(from, '/');
|
116 | }
|
117 | var basedir = path.dirname(res);
|
118 |
|
119 | var keys = Object_keys(require.modules);
|
120 |
|
121 | for (var i = 0; i < keys.length; i++) {
|
122 | var key = keys[i];
|
123 | if (key.slice(0, basedir.length + 1) === basedir + '/') {
|
124 | var f = key.slice(basedir.length);
|
125 | require.modules[to + f] = require.modules[basedir + f];
|
126 | }
|
127 | else if (key === basedir) {
|
128 | require.modules[to] = require.modules[basedir];
|
129 | }
|
130 | }
|
131 | };
|
132 |
|
133 | require.define = function (filename, fn) {
|
134 | var dirname = require._core[filename]
|
135 | ? ''
|
136 | : require.modules.path().dirname(filename)
|
137 | ;
|
138 |
|
139 | var require_ = function (file) { return require(file, dirname) };
|
140 | require_.resolve = function (name) {
|
141 | return require.resolve(name, dirname);
|
142 | };
|
143 | require_.modules = require.modules;
|
144 | var module_ = { exports : {} };
|
145 |
|
146 | require.modules[filename] = function () {
|
147 | fn.call(
|
148 | module_.exports,
|
149 | require_,
|
150 | module_,
|
151 | module_.exports,
|
152 | dirname,
|
153 | filename
|
154 | );
|
155 | require.modules[filename]._cached = module_.exports;
|
156 | return module_.exports;
|
157 | };
|
158 | };
|
159 |
|
160 | var Object_keys = Object.keys || function (obj) {
|
161 | var res = [];
|
162 | for (var key in obj) res.push(key)
|
163 | return res;
|
164 | };
|
165 |
|
166 | if (typeof process === 'undefined') process = {};
|
167 |
|
168 | if (!process.nextTick) process.nextTick = function (fn) {
|
169 | setTimeout(fn, 0);
|
170 | };
|
171 |
|
172 | if (!process.title) process.title = 'browser';
|
173 |
|
174 | if (!process.binding) process.binding = function (name) {
|
175 | if (name === 'evals') return require('vm')
|
176 | else throw new Error('No such module')
|
177 | };
|
178 |
|
179 | if (!process.cwd) process.cwd = function () { return '.' };
|
180 |
|
181 | require.define("path", function (require, module, exports, __dirname, __filename) {
|
182 | function filter (xs, fn) {
|
183 | var res = [];
|
184 | for (var i = 0; i < xs.length; i++) {
|
185 | if (fn(xs[i], i, xs)) res.push(xs[i]);
|
186 | }
|
187 | return res;
|
188 | }
|
189 |
|
190 |
|
191 |
|
192 |
|
193 |
|
194 | function normalizeArray(parts, allowAboveRoot) {
|
195 |
|
196 | var up = 0;
|
197 | for (var i = parts.length; i >= 0; i--) {
|
198 | var last = parts[i];
|
199 | if (last == '.') {
|
200 | parts.splice(i, 1);
|
201 | } else if (last === '..') {
|
202 | parts.splice(i, 1);
|
203 | up++;
|
204 | } else if (up) {
|
205 | parts.splice(i, 1);
|
206 | up--;
|
207 | }
|
208 | }
|
209 |
|
210 |
|
211 | if (allowAboveRoot) {
|
212 | for (; up--; up) {
|
213 | parts.unshift('..');
|
214 | }
|
215 | }
|
216 |
|
217 | return parts;
|
218 | }
|
219 |
|
220 |
|
221 |
|
222 | var splitPathRe = /^(.+\/(?!$)|\/)?((?:.+?)?(\.[^.]*)?)$/;
|
223 |
|
224 |
|
225 |
|
226 | exports.resolve = function() {
|
227 | var resolvedPath = '',
|
228 | resolvedAbsolute = false;
|
229 |
|
230 | for (var i = arguments.length; i >= -1 && !resolvedAbsolute; i--) {
|
231 | var path = (i >= 0)
|
232 | ? arguments[i]
|
233 | : process.cwd();
|
234 |
|
235 |
|
236 | if (typeof path !== 'string' || !path) {
|
237 | continue;
|
238 | }
|
239 |
|
240 | resolvedPath = path + '/' + resolvedPath;
|
241 | resolvedAbsolute = path.charAt(0) === '/';
|
242 | }
|
243 |
|
244 |
|
245 |
|
246 |
|
247 |
|
248 | resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
|
249 | return !!p;
|
250 | }), !resolvedAbsolute).join('/');
|
251 |
|
252 | return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
|
253 | };
|
254 |
|
255 |
|
256 |
|
257 | exports.normalize = function(path) {
|
258 | var isAbsolute = path.charAt(0) === '/',
|
259 | trailingSlash = path.slice(-1) === '/';
|
260 |
|
261 |
|
262 | path = normalizeArray(filter(path.split('/'), function(p) {
|
263 | return !!p;
|
264 | }), !isAbsolute).join('/');
|
265 |
|
266 | if (!path && !isAbsolute) {
|
267 | path = '.';
|
268 | }
|
269 | if (path && trailingSlash) {
|
270 | path += '/';
|
271 | }
|
272 |
|
273 | return (isAbsolute ? '/' : '') + path;
|
274 | };
|
275 |
|
276 |
|
277 |
|
278 | exports.join = function() {
|
279 | var paths = Array.prototype.slice.call(arguments, 0);
|
280 | return exports.normalize(filter(paths, function(p, index) {
|
281 | return p && typeof p === 'string';
|
282 | }).join('/'));
|
283 | };
|
284 |
|
285 |
|
286 | exports.dirname = function(path) {
|
287 | var dir = splitPathRe.exec(path)[1] || '';
|
288 | var isWindows = false;
|
289 | if (!dir) {
|
290 |
|
291 | return '.';
|
292 | } else if (dir.length === 1 ||
|
293 | (isWindows && dir.length <= 3 && dir.charAt(1) === ':')) {
|
294 |
|
295 | return dir;
|
296 | } else {
|
297 |
|
298 | return dir.substring(0, dir.length - 1);
|
299 | }
|
300 | };
|
301 |
|
302 |
|
303 | exports.basename = function(path, ext) {
|
304 | var f = splitPathRe.exec(path)[2] || '';
|
305 |
|
306 | if (ext && f.substr(-1 * ext.length) === ext) {
|
307 | f = f.substr(0, f.length - ext.length);
|
308 | }
|
309 | return f;
|
310 | };
|
311 |
|
312 |
|
313 | exports.extname = function(path) {
|
314 | return splitPathRe.exec(path)[3] || '';
|
315 | };
|
316 |
|
317 | });
|
318 |
|
319 | require.define("/dt-dom.js", function (require, module, exports, __dirname, __filename) {
|
320 | (function() {
|
321 | var Animation, DOMAdapter, EVENTS, delay, domify, isArray, release, removed;
|
322 |
|
323 | Animation = require('animation').Animation;
|
324 |
|
325 | isArray = Array.isArray;
|
326 |
|
327 | EVENTS = ['add', 'close', 'end', 'show', 'hide', 'attr', 'text', 'raw', 'remove', 'replace'];
|
328 |
|
329 | removed = function(el) {
|
330 | return el.closed === "removed";
|
331 | };
|
332 |
|
333 | delay = function(job) {
|
334 | var _ref;
|
335 | if (removed(this)) return;
|
336 | if (this._dom != null) {
|
337 | return job();
|
338 | } else {
|
339 | if ((_ref = this._dom_delay) == null) this._dom_delay = [];
|
340 | return this._dom_delay.push(job);
|
341 | }
|
342 | };
|
343 |
|
344 | release = function() {
|
345 | var job, _i, _len, _ref;
|
346 | if (this._dom_delay != null) {
|
347 | _ref = this._dom_delay;
|
348 | for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
349 | job = _ref[_i];
|
350 | job();
|
351 | }
|
352 | return delete this._dom_delay;
|
353 | }
|
354 | };
|
355 |
|
356 | DOMAdapter = (function() {
|
357 |
|
358 | function DOMAdapter(template, opts) {
|
359 | var _ref, _ref2, _ref3, _ref4, _ref5;
|
360 | this.template = template;
|
361 | if (opts == null) opts = {};
|
362 | this.builder = (_ref = this.template.xml) != null ? _ref : this.template;
|
363 | if ((_ref2 = opts.timeoutexecution) == null) opts.timeoutexecution = '20ms';
|
364 | if ((_ref3 = opts.execution) == null) opts.execution = '4ms';
|
365 | if ((_ref4 = opts.timeout) == null) opts.timeout = '120ms';
|
366 | if ((_ref5 = opts.toggle) == null) opts.toggle = true;
|
367 | this.animation = new Animation(opts);
|
368 | this.animation.start();
|
369 | this.initialize();
|
370 | }
|
371 |
|
372 | DOMAdapter.prototype.initialize = function() {
|
373 | var old_query;
|
374 | this.listen();
|
375 | old_query = this.builder.query;
|
376 | this.builder.query = function(type, tag, key) {
|
377 | if (tag._dom == null) return old_query.call(this, type, tag, key);
|
378 | if (type === 'attr') {
|
379 | return tag._dom.getAttribute(key);
|
380 | } else if (type === 'text') {
|
381 | return tag._dom.text || tag._dom.textContent || tag._dom.innerHTML || "";
|
382 | } else if (type === 'tag') {
|
383 | if (key._dom != null) {
|
384 | return key;
|
385 | } else {
|
386 | return {
|
387 | _dom: key
|
388 | };
|
389 | }
|
390 | }
|
391 | };
|
392 | return this.template.register('ready', function(tag, next) {
|
393 | if (tag._dom_ready === true) {
|
394 | return next(tag);
|
395 | } else {
|
396 | return tag._dom_ready = function() {
|
397 | return next(tag);
|
398 | };
|
399 | }
|
400 | });
|
401 | };
|
402 |
|
403 | DOMAdapter.prototype.listen = function() {
|
404 | var _this = this;
|
405 | return EVENTS.forEach(function(event) {
|
406 | return _this.template.on(event, _this["on" + event].bind(_this));
|
407 | });
|
408 | };
|
409 |
|
410 | DOMAdapter.prototype.onadd = function(parent, el) {
|
411 | var _this = this;
|
412 | return delay.call(parent, function() {
|
413 | var done;
|
414 | if (parent === parent.builder) {
|
415 | parent._dom.push(el._dom);
|
416 | if (typeof el._dom_ready === "function") el._dom_ready();
|
417 | return el._dom_ready = true;
|
418 | } else {
|
419 | done = function() {
|
420 | return _this.animation.push(function() {
|
421 | var e, pardom, _i, _len, _ref;
|
422 | pardom = parent._dom;
|
423 | if (isArray(el._dom)) {
|
424 | _ref = el._dom;
|
425 | for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
426 | e = _ref[_i];
|
427 | if (pardom != null) pardom.appendChild(e);
|
428 | }
|
429 | } else {
|
430 | if (pardom != null) pardom.appendChild(el._dom);
|
431 | }
|
432 | if (typeof el._dom_ready === "function") el._dom_ready();
|
433 | return el._dom_ready = true;
|
434 | });
|
435 | };
|
436 | if (el === el.builder) {
|
437 | return el.ready(done);
|
438 | } else {
|
439 | return done();
|
440 | }
|
441 | }
|
442 | });
|
443 | };
|
444 |
|
445 | DOMAdapter.prototype.onclose = function(el) {
|
446 | var key, value, _ref, _ref2, _ref3;
|
447 | if (el === el.builder) {
|
448 | el._dom = [];
|
449 | return release.call(el);
|
450 | }
|
451 | el._namespace = el.attrs['xmlns'];
|
452 | if (el._namespace != null) {
|
453 | if ((_ref = el._dom) == null) {
|
454 | el._dom = document.createElementNS(el._namespace, el.name);
|
455 | }
|
456 | } else {
|
457 | if ((_ref2 = el._dom) == null) el._dom = document.createElement(el.name);
|
458 | }
|
459 | _ref3 = el.attrs;
|
460 | for (key in _ref3) {
|
461 | value = _ref3[key];
|
462 | el._dom.setAttribute(key, value);
|
463 | }
|
464 | return release.call(el);
|
465 | };
|
466 |
|
467 | DOMAdapter.prototype.ontext = function(el, text) {
|
468 | var _this = this;
|
469 | return delay.call(el, function() {
|
470 | return _this.animation.push(function() {
|
471 | return el._dom.textContent = text;
|
472 | });
|
473 | });
|
474 | };
|
475 |
|
476 | DOMAdapter.prototype.onraw = function(el, html) {
|
477 | var _this = this;
|
478 | return delay.call(el, function() {
|
479 | return _this.animation.push(function() {
|
480 | var _ref;
|
481 | return (_ref = el._dom) != null ? _ref.innerHTML = html : void 0;
|
482 | });
|
483 | });
|
484 | };
|
485 |
|
486 | DOMAdapter.prototype.onshow = function(el) {
|
487 | return delay.call(el, function() {});
|
488 | };
|
489 |
|
490 | DOMAdapter.prototype.onhide = function(el) {
|
491 | return delay.call(el, function() {});
|
492 | };
|
493 |
|
494 | DOMAdapter.prototype.onattr = function(el, key, value) {
|
495 | var _this = this;
|
496 | return delay.call(el, function() {
|
497 | return _this.animation.push(function() {
|
498 | if (value === void 0) {
|
499 | return el._dom.removeAttribute(key);
|
500 | } else {
|
501 | return el._dom.setAttribute(key, value);
|
502 | }
|
503 | });
|
504 | });
|
505 | };
|
506 |
|
507 | DOMAdapter.prototype.onreplace = function(el, tag) {
|
508 | var _this = this;
|
509 | return delay.call(el, function() {
|
510 | return _this.animation.push(function() {
|
511 | var _dom, _ref, _ref2, _ref3;
|
512 | if (removed(el)) return;
|
513 | _dom = (_ref = tag._dom) != null ? _ref : tag;
|
514 | if (!((_dom != null ? _dom.length : void 0) > 0)) return;
|
515 | if ((_ref2 = el.parent) != null) {
|
516 | if ((_ref3 = _ref2._dom) != null) _ref3.replaceChild(_dom);
|
517 | }
|
518 | el._dom = _dom;
|
519 | if (el === _this.builder) return el.dom = _dom;
|
520 | });
|
521 | });
|
522 | };
|
523 |
|
524 | DOMAdapter.prototype.onremove = function(el) {
|
525 | var _this = this;
|
526 | return delay.call(el.parent, function() {
|
527 | return _this.animation.push(function() {
|
528 | var _ref, _ref2;
|
529 | if (el._dom != null) {
|
530 | if ((_ref = el.parent) != null) {
|
531 | if ((_ref2 = _ref._dom) != null) _ref2.removeChild(el._dom);
|
532 | }
|
533 | }
|
534 | return delete el._dom;
|
535 | });
|
536 | });
|
537 | };
|
538 |
|
539 | DOMAdapter.prototype.onend = function() {
|
540 | return this.template.dom = this.builder._dom;
|
541 | };
|
542 |
|
543 | return DOMAdapter;
|
544 |
|
545 | })();
|
546 |
|
547 | domify = function(tpl, opts) {
|
548 | new DOMAdapter(tpl, opts);
|
549 | return tpl;
|
550 | };
|
551 |
|
552 | domify.Adapter = DOMAdapter;
|
553 |
|
554 | module.exports = domify;
|
555 |
|
556 | if (process.title === 'browser') {
|
557 | (function() {
|
558 | if (this.dynamictemplate != null) {
|
559 | return this.dynamictemplate.domify = domify;
|
560 | } else {
|
561 | return this.dynamictemplate = {
|
562 | domify: domify
|
563 | };
|
564 | }
|
565 | }).call(window);
|
566 | }
|
567 |
|
568 | }).call(this);
|
569 |
|
570 | });
|
571 |
|
572 | require.define("/node_modules/animation/package.json", function (require, module, exports, __dirname, __filename) {
|
573 | module.exports = {"name":"animation","description":"animation timing & handling","version":"0.1.0","homepage":"https://github.com/dodo/node-animation","author":"dodo (https://github.com/dodo)","repository":{"type":"git","url":"git://github.com/dodo/node-animation.git"},"main":"animation.js","engines":{"node":">= 0.4.x"},"keywords":["request","animation","frame","interval","node","browser"],"scripts":{"prepublish":"cake build"},"dependencies":{"ms":">= 0.1.0","request-animation-frame":">= 0.1.0"},"devDependencies":{"muffin":">= 0.2.6","coffee-script":">= 1.1.2"}}
|
574 | });
|
575 |
|
576 | require.define("/node_modules/animation/animation.js", function (require, module, exports, __dirname, __filename) {
|
577 |
|
578 | module.exports = require('./lib/animation')
|
579 |
|
580 | });
|
581 |
|
582 | require.define("/node_modules/animation/lib/animation.js", function (require, module, exports, __dirname, __filename) {
|
583 | (function() {
|
584 | var EventEmitter, cancelAnimationFrame, ms, now, requestAnimationFrame, _ref;
|
585 | var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
|
586 |
|
587 | EventEmitter = require('events').EventEmitter;
|
588 |
|
589 | _ref = require('request-animation-frame'), requestAnimationFrame = _ref.requestAnimationFrame, cancelAnimationFrame = _ref.cancelAnimationFrame;
|
590 |
|
591 | ms = require('ms');
|
592 |
|
593 | now = function() {
|
594 | return new Date().getTime();
|
595 | };
|
596 |
|
597 | this.Animation = (function() {
|
598 |
|
599 | __extends(Animation, EventEmitter);
|
600 |
|
601 | function Animation(opts) {
|
602 | var _ref2, _ref3, _ref4;
|
603 | if (opts == null) opts = {};
|
604 | this.nextTick = __bind(this.nextTick, this);
|
605 | this.timoutexecutiontime = ms((_ref2 = opts.timeoutexecution) != null ? _ref2 : 20);
|
606 | this.executiontime = ms((_ref3 = opts.execution) != null ? _ref3 : 5);
|
607 | this.timeouttime = opts.timeout;
|
608 | if (this.timeouttime != null) this.timeouttime = ms(this.timeouttime);
|
609 | this.autotoggle = (_ref4 = opts.toggle) != null ? _ref4 : false;
|
610 | this.frametime = opts.frame;
|
611 | if (this.frametime != null) this.frametime = ms(this.frametime);
|
612 | this.queue = [];
|
613 | this.running = false;
|
614 | this.paused = false;
|
615 | Animation.__super__.constructor.apply(this, arguments);
|
616 | }
|
617 |
|
618 | Animation.prototype.work_queue = function(started, dt, executiontime) {
|
619 | var t, _base, _results;
|
620 | t = now();
|
621 | _results = [];
|
622 | while (this.queue.length && t - started < executiontime) {
|
623 | if (typeof (_base = this.queue.shift()) === "function") _base();
|
624 | _results.push(t = now());
|
625 | }
|
626 | return _results;
|
627 | };
|
628 |
|
629 | Animation.prototype.push = function(callback) {
|
630 | this.queue.push(callback);
|
631 | if (this.running && this.autotoggle) return this.resume();
|
632 | };
|
633 |
|
634 | Animation.prototype.nextTick = function(callback) {
|
635 | var request, t, tick, timeout, _ref2;
|
636 | _ref2 = [null, null], timeout = _ref2[0], request = _ref2[1];
|
637 | t = now();
|
638 | tick = function(success) {
|
639 | var dt, executiontime, started;
|
640 | started = now();
|
641 | dt = started - t;
|
642 | if (success) {
|
643 | executiontime = this.executiontime;
|
644 | } else {
|
645 | executiontime = this.timoutexecutiontime;
|
646 | }
|
647 | if (success) {
|
648 | clearTimeout(timeout);
|
649 | } else {
|
650 | cancelAnimationFrame(request);
|
651 | }
|
652 | this.emit('tick', dt);
|
653 | if (typeof callback === "function") callback(dt);
|
654 | this.work_queue(started, dt, executiontime);
|
655 | if (this.running && !this.paused) {
|
656 | if (this.queue.length) {
|
657 | return this.nextTick();
|
658 | } else {
|
659 | if (this.autotoggle) {
|
660 | return this.pause();
|
661 | } else {
|
662 | return this.nextTick();
|
663 | }
|
664 | }
|
665 | }
|
666 | };
|
667 | request = requestAnimationFrame(tick.bind(this, true), this.frametime);
|
668 | if (this.timeouttime != null) {
|
669 | return timeout = setTimeout(tick.bind(this, false), this.timeouttime);
|
670 | }
|
671 | };
|
672 |
|
673 | Animation.prototype.start = function() {
|
674 | if (this.running) return;
|
675 | this.running = true;
|
676 | this.emit('start');
|
677 | if (!this.paused) {
|
678 | if (this.autotoggle) {
|
679 | if (this.queue.length) {
|
680 | return this.nextTick();
|
681 | } else {
|
682 | return this.pause();
|
683 | }
|
684 | } else {
|
685 | return this.nextTick();
|
686 | }
|
687 | }
|
688 | };
|
689 |
|
690 | Animation.prototype.stop = function() {
|
691 | if (!this.running) return;
|
692 | this.running = false;
|
693 | return this.emit('stop');
|
694 | };
|
695 |
|
696 | Animation.prototype.pause = function() {
|
697 | if (this.paused) return;
|
698 | this.paused = true;
|
699 | return this.emit('pause');
|
700 | };
|
701 |
|
702 | Animation.prototype.resume = function() {
|
703 | if (!this.paused) return;
|
704 | this.paused = false;
|
705 | this.emit('resume');
|
706 | if (this.running && (!this.autotoggle || this.queue.length === 1)) {
|
707 | return this.nextTick();
|
708 | }
|
709 | };
|
710 |
|
711 | return Animation;
|
712 |
|
713 | })();
|
714 |
|
715 | }).call(this);
|
716 |
|
717 | });
|
718 |
|
719 | require.define("events", function (require, module, exports, __dirname, __filename) {
|
720 | if (!process.EventEmitter) process.EventEmitter = function () {};
|
721 |
|
722 | var EventEmitter = exports.EventEmitter = process.EventEmitter;
|
723 | var isArray = typeof Array.isArray === 'function'
|
724 | ? Array.isArray
|
725 | : function (xs) {
|
726 | return Object.toString.call(xs) === '[object Array]'
|
727 | }
|
728 | ;
|
729 |
|
730 |
|
731 |
|
732 |
|
733 |
|
734 |
|
735 |
|
736 | var defaultMaxListeners = 10;
|
737 | EventEmitter.prototype.setMaxListeners = function(n) {
|
738 | if (!this._events) this._events = {};
|
739 | this._events.maxListeners = n;
|
740 | };
|
741 |
|
742 |
|
743 | EventEmitter.prototype.emit = function(type) {
|
744 |
|
745 | if (type === 'error') {
|
746 | if (!this._events || !this._events.error ||
|
747 | (isArray(this._events.error) && !this._events.error.length))
|
748 | {
|
749 | if (arguments[1] instanceof Error) {
|
750 | throw arguments[1];
|
751 | } else {
|
752 | throw new Error("Uncaught, unspecified 'error' event.");
|
753 | }
|
754 | return false;
|
755 | }
|
756 | }
|
757 |
|
758 | if (!this._events) return false;
|
759 | var handler = this._events[type];
|
760 | if (!handler) return false;
|
761 |
|
762 | if (typeof handler == 'function') {
|
763 | switch (arguments.length) {
|
764 |
|
765 | case 1:
|
766 | handler.call(this);
|
767 | break;
|
768 | case 2:
|
769 | handler.call(this, arguments[1]);
|
770 | break;
|
771 | case 3:
|
772 | handler.call(this, arguments[1], arguments[2]);
|
773 | break;
|
774 |
|
775 | default:
|
776 | var args = Array.prototype.slice.call(arguments, 1);
|
777 | handler.apply(this, args);
|
778 | }
|
779 | return true;
|
780 |
|
781 | } else if (isArray(handler)) {
|
782 | var args = Array.prototype.slice.call(arguments, 1);
|
783 |
|
784 | var listeners = handler.slice();
|
785 | for (var i = 0, l = listeners.length; i < l; i++) {
|
786 | listeners[i].apply(this, args);
|
787 | }
|
788 | return true;
|
789 |
|
790 | } else {
|
791 | return false;
|
792 | }
|
793 | };
|
794 |
|
795 |
|
796 |
|
797 | EventEmitter.prototype.addListener = function(type, listener) {
|
798 | if ('function' !== typeof listener) {
|
799 | throw new Error('addListener only takes instances of Function');
|
800 | }
|
801 |
|
802 | if (!this._events) this._events = {};
|
803 |
|
804 |
|
805 |
|
806 | this.emit('newListener', type, listener);
|
807 |
|
808 | if (!this._events[type]) {
|
809 |
|
810 | this._events[type] = listener;
|
811 | } else if (isArray(this._events[type])) {
|
812 |
|
813 |
|
814 | if (!this._events[type].warned) {
|
815 | var m;
|
816 | if (this._events.maxListeners !== undefined) {
|
817 | m = this._events.maxListeners;
|
818 | } else {
|
819 | m = defaultMaxListeners;
|
820 | }
|
821 |
|
822 | if (m && m > 0 && this._events[type].length > m) {
|
823 | this._events[type].warned = true;
|
824 | console.error('(node) warning: possible EventEmitter memory ' +
|
825 | 'leak detected. %d listeners added. ' +
|
826 | 'Use emitter.setMaxListeners() to increase limit.',
|
827 | this._events[type].length);
|
828 | console.trace();
|
829 | }
|
830 | }
|
831 |
|
832 |
|
833 | this._events[type].push(listener);
|
834 | } else {
|
835 |
|
836 | this._events[type] = [this._events[type], listener];
|
837 | }
|
838 |
|
839 | return this;
|
840 | };
|
841 |
|
842 | EventEmitter.prototype.on = EventEmitter.prototype.addListener;
|
843 |
|
844 | EventEmitter.prototype.once = function(type, listener) {
|
845 | var self = this;
|
846 | self.on(type, function g() {
|
847 | self.removeListener(type, g);
|
848 | listener.apply(this, arguments);
|
849 | });
|
850 |
|
851 | return this;
|
852 | };
|
853 |
|
854 | EventEmitter.prototype.removeListener = function(type, listener) {
|
855 | if ('function' !== typeof listener) {
|
856 | throw new Error('removeListener only takes instances of Function');
|
857 | }
|
858 |
|
859 |
|
860 | if (!this._events || !this._events[type]) return this;
|
861 |
|
862 | var list = this._events[type];
|
863 |
|
864 | if (isArray(list)) {
|
865 | var i = list.indexOf(listener);
|
866 | if (i < 0) return this;
|
867 | list.splice(i, 1);
|
868 | if (list.length == 0)
|
869 | delete this._events[type];
|
870 | } else if (this._events[type] === listener) {
|
871 | delete this._events[type];
|
872 | }
|
873 |
|
874 | return this;
|
875 | };
|
876 |
|
877 | EventEmitter.prototype.removeAllListeners = function(type) {
|
878 |
|
879 | if (type && this._events && this._events[type]) this._events[type] = null;
|
880 | return this;
|
881 | };
|
882 |
|
883 | EventEmitter.prototype.listeners = function(type) {
|
884 | if (!this._events) this._events = {};
|
885 | if (!this._events[type]) this._events[type] = [];
|
886 | if (!isArray(this._events[type])) {
|
887 | this._events[type] = [this._events[type]];
|
888 | }
|
889 | return this._events[type];
|
890 | };
|
891 |
|
892 | });
|
893 |
|
894 | require.define("/node_modules/animation/node_modules/request-animation-frame/package.json", function (require, module, exports, __dirname, __filename) {
|
895 | module.exports = {"name":"request-animation-frame","description":"requestAnimationFrame shim","version":"0.1.0","homepage":"https://github.com/dodo/requestAnimationFrame.js","author":"dodo (https://github.com/dodo)","repository":{"type":"git","url":"git://github.com/dodo/requestAnimationFrame.js.git"},"main":"shim.js","engines":{"node":">= 0.4.x"},"keywords":["request","animation","frame","shim","browser","polyfill"],"scripts":{"prepublish":"cake build"},"devDependencies":{"muffin":">= 0.2.6","coffee-script":">= 1.1.2"}}
|
896 | });
|
897 |
|
898 | require.define("/node_modules/animation/node_modules/request-animation-frame/shim.js", function (require, module, exports, __dirname, __filename) {
|
899 |
|
900 | module.exports = require('./lib/shim')
|
901 |
|
902 | });
|
903 |
|
904 | require.define("/node_modules/animation/node_modules/request-animation-frame/lib/shim.js", function (require, module, exports, __dirname, __filename) {
|
905 | (function() {
|
906 | var _ref;
|
907 |
|
908 | _ref = (function() {
|
909 | var cancel, isNative, last, request, vendor, _i, _len, _ref;
|
910 | last = 0;
|
911 | request = typeof window !== "undefined" && window !== null ? window.requestAnimationFrame : void 0;
|
912 | cancel = typeof window !== "undefined" && window !== null ? window.cancelAnimationFrame : void 0;
|
913 | _ref = ["webkit", "moz", "o", "ms"];
|
914 | for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
915 | vendor = _ref[_i];
|
916 | if (cancel == null) {
|
917 | cancel = (typeof window !== "undefined" && window !== null ? window["" + vendor + "cancelAnimationFrame"] : void 0) || (typeof window !== "undefined" && window !== null ? window["" + vendor + "cancelRequestAnimationFrame"] : void 0);
|
918 | }
|
919 | if ((request != null ? request : request = typeof window !== "undefined" && window !== null ? window["" + vendor + "RequestAnimationFrame"] : void 0)) {
|
920 | break;
|
921 | }
|
922 | }
|
923 | isNative = request != null;
|
924 | request = request != null ? request : function(callback, timeout) {
|
925 | var cur, id, time;
|
926 | if (timeout == null) timeout = 16;
|
927 | cur = new Date().getTime();
|
928 | time = Math.max(0, timeout + last - cur);
|
929 | id = setTimeout(function() {
|
930 | return typeof callback === "function" ? callback(cur + time) : void 0;
|
931 | }, time);
|
932 | last = cur + time;
|
933 | return id;
|
934 | };
|
935 | request.isNative = isNative;
|
936 | isNative = cancel != null;
|
937 | cancel = cancel != null ? cancel : function(id) {
|
938 | return clearTimeout(id);
|
939 | };
|
940 | cancel.isNative = isNative;
|
941 | return [request, cancel];
|
942 | })(), this.requestAnimationFrame = _ref[0], this.cancelAnimationFrame = _ref[1];
|
943 |
|
944 | }).call(this);
|
945 |
|
946 | });
|
947 |
|
948 | require.define("/node_modules/animation/node_modules/ms/package.json", function (require, module, exports, __dirname, __filename) {
|
949 | module.exports = {"name":"ms","version":"0.1.0","description":"Tiny ms conversion utility","main":"./ms","devDependencies":{"mocha":"*","expect.js":"*","serve":"*"}}
|
950 | });
|
951 |
|
952 | require.define("/node_modules/animation/node_modules/ms/ms.js", function (require, module, exports, __dirname, __filename) {
|
953 | |
954 |
|
955 |
|
956 |
|
957 |
|
958 |
|
959 |
|
960 |
|
961 |
|
962 |
|
963 |
|
964 |
|
965 |
|
966 |
|
967 |
|
968 |
|
969 |
|
970 | (function (g) {
|
971 | var r = /(\d*.?\d+)([mshd]+)/
|
972 | , _ = {}
|
973 |
|
974 | _.ms = 1;
|
975 | _.s = 1000;
|
976 | _.m = _.s * 60;
|
977 | _.h = _.m * 60;
|
978 | _.d = _.h * 24;
|
979 |
|
980 | function ms (s) {
|
981 | if (s == Number(s)) return Number(s);
|
982 | r.exec(s.toLowerCase());
|
983 | return RegExp.$1 * _[RegExp.$2];
|
984 | }
|
985 |
|
986 | g.top ? g.ms = ms : module.exports = ms;
|
987 | })(this);
|
988 |
|
989 | });
|
990 | ;require('./dt-dom');}).call(this); |
\ | No newline at end of file |