1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | (function webpackUniversalModuleDefinition(root, factory) {
|
11 | if(typeof exports === 'object' && typeof module === 'object')
|
12 | module.exports = factory(require("jquery"));
|
13 | else if(typeof define === 'function' && define.amd)
|
14 | define(["jquery"], factory);
|
15 | else {
|
16 | var a = typeof exports === 'object' ? factory(require("jquery")) : factory(root["jQuery"]);
|
17 | for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
18 | }
|
19 | })(this, function(__WEBPACK_EXTERNAL_MODULE_0__) {
|
20 | return (function(modules) {
|
21 |
|
22 | var installedModules = {};
|
23 |
|
24 |
|
25 | function __webpack_require__(moduleId) {
|
26 |
|
27 |
|
28 | if(installedModules[moduleId]) {
|
29 | return installedModules[moduleId].exports;
|
30 | }
|
31 |
|
32 | var module = installedModules[moduleId] = {
|
33 | i: moduleId,
|
34 | l: false,
|
35 | exports: {}
|
36 | };
|
37 |
|
38 |
|
39 | modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
40 |
|
41 |
|
42 | module.l = true;
|
43 |
|
44 |
|
45 | return module.exports;
|
46 | }
|
47 |
|
48 |
|
49 |
|
50 | __webpack_require__.m = modules;
|
51 |
|
52 |
|
53 | __webpack_require__.c = installedModules;
|
54 |
|
55 |
|
56 | __webpack_require__.d = function(exports, name, getter) {
|
57 | if(!__webpack_require__.o(exports, name)) {
|
58 | Object.defineProperty(exports, name, {
|
59 | configurable: false,
|
60 | enumerable: true,
|
61 | get: getter
|
62 | /******/ });
|
63 | /******/ }
|
64 | /******/ };
|
65 | /******/
|
66 | /******/ // getDefaultExport function for compatibility with non-harmony modules
|
67 | /******/ __webpack_require__.n = function(module) {
|
68 | var getter = module && module.__esModule ?
|
69 | function getDefault() { return module['default']; } :
|
70 | function getModuleExports() { return module; };
|
71 | __webpack_require__.d(getter, 'a', getter);
|
72 | return getter;
|
73 | };
|
74 |
|
75 |
|
76 | __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
77 |
|
78 |
|
79 | __webpack_require__.p = "";
|
80 |
|
81 |
|
82 | return __webpack_require__(__webpack_require__.s = 1);
|
83 | })
|
84 |
|
85 | ([
|
86 |
|
87 | (function(module, exports) {
|
88 |
|
89 | module.exports = __WEBPACK_EXTERNAL_MODULE_0__;
|
90 |
|
91 | }),
|
92 |
|
93 | (function(module, exports, __webpack_require__) {
|
94 |
|
95 | "use strict";
|
96 |
|
97 |
|
98 | exports.__esModule = true;
|
99 |
|
100 | var _jquery = __webpack_require__(0);
|
101 |
|
102 | var _jquery2 = _interopRequireDefault(_jquery);
|
103 |
|
104 | var _AniPropertyManager = __webpack_require__(2);
|
105 |
|
106 | var _AniPropertyManager2 = _interopRequireDefault(_AniPropertyManager);
|
107 |
|
108 | var _MathUtil = __webpack_require__(4);
|
109 |
|
110 | var _MathUtil2 = _interopRequireDefault(_MathUtil);
|
111 |
|
112 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
113 |
|
114 |
|
115 |
|
116 |
|
117 | exports["default"] = function ($) {
|
118 | var animateFn = $.fn.animate;
|
119 | var stopFn = $.fn.stop;
|
120 | var delayFn = $.fn.delay;
|
121 |
|
122 | |
123 |
|
124 |
|
125 |
|
126 |
|
127 | function generateNewEasingFunc(resumePercent, remainPercent, scale, originalEasing) {
|
128 | return function easingFunc(percent) {
|
129 | var newPercent = resumePercent + remainPercent * percent;
|
130 |
|
131 | return scale(originalEasing(newPercent));
|
132 | };
|
133 | }
|
134 |
|
135 | $.fn.animate = function (prop, speed, easing, callback) {
|
136 | return this.each(function () {
|
137 |
|
138 | var optall = $.speed(speed, easing, callback);
|
139 |
|
140 |
|
141 | optall.complete = function () {
|
142 | _AniPropertyManager2["default"].prepareNextAniProp(this);
|
143 | };
|
144 |
|
145 |
|
146 | _AniPropertyManager2["default"].addAniProperty("animate", this, prop, optall);
|
147 | animateFn.call($(this), prop, optall);
|
148 | });
|
149 |
|
150 |
|
151 |
|
152 | };
|
153 |
|
154 | |
155 |
|
156 |
|
157 |
|
158 |
|
159 |
|
160 |
|
161 | $.fn.delay = function (time, type) {
|
162 | var t = void 0;
|
163 | var isCallByResume = arguments.length <= 2 ? undefined : arguments[2];
|
164 |
|
165 | if (type && type !== "fx") {
|
166 | return delayFn.call(this, time, type);
|
167 | }
|
168 |
|
169 | t = parseInt(time, 10);
|
170 | t = isNaN(t) ? 0 : t;
|
171 |
|
172 | return this.each(function () {
|
173 | var _this = this;
|
174 |
|
175 | if (!isCallByResume) {
|
176 |
|
177 |
|
178 | _AniPropertyManager2["default"].addAniProperty("delay", this, null, { duration: t });
|
179 | }
|
180 |
|
181 | delayFn.call($(this), time).queue(function (next) {
|
182 | next();
|
183 |
|
184 |
|
185 | _AniPropertyManager2["default"].removeAniProperty(_this);
|
186 | });
|
187 | });
|
188 | };
|
189 |
|
190 | |
191 |
|
192 |
|
193 |
|
194 |
|
195 |
|
196 |
|
197 |
|
198 |
|
199 |
|
200 | $.fn.pause = function () {
|
201 | return this.each(function () {
|
202 | var p = void 0;
|
203 |
|
204 | if (_AniPropertyManager2["default"].getStatus(this) !== "inprogress") {
|
205 | return;
|
206 | }
|
207 |
|
208 |
|
209 | $.queue(this, "fx", [$.noop]);
|
210 | stopFn.call($(this));
|
211 |
|
212 |
|
213 | p = this.__aniProps[0];
|
214 | if (p) {
|
215 | p.elapsed += $.now() - p.start;
|
216 |
|
217 |
|
218 |
|
219 | if (p.elapsed >= p.opt.duration) {
|
220 | p = _AniPropertyManager2["default"].prepareNextAniProp(this);
|
221 | }
|
222 |
|
223 | p && (p.paused = true);
|
224 | }
|
225 | });
|
226 | };
|
227 |
|
228 | |
229 |
|
230 |
|
231 |
|
232 |
|
233 |
|
234 |
|
235 |
|
236 |
|
237 |
|
238 |
|
239 | $.fn.resume = function () {
|
240 | return this.each(function () {
|
241 | var type = "fx";
|
242 | var p = void 0;
|
243 | var i = void 0;
|
244 |
|
245 | if (_AniPropertyManager2["default"].getStatus(this) !== "paused") {
|
246 | return;
|
247 | }
|
248 |
|
249 |
|
250 |
|
251 | $.queue(this, type || "fx", []);
|
252 |
|
253 |
|
254 | i = 0;
|
255 | p = this.__aniProps[i];
|
256 |
|
257 | while (p) {
|
258 |
|
259 | if (p.elapsed > 0 && p.opt.easing) {
|
260 | var resumePercent = p.elapsed / p.opt.duration;
|
261 | var remainPercent = 1 - resumePercent;
|
262 | var originalEasing = $.easing[p.opt.easing];
|
263 | var startEasingValue = originalEasing(resumePercent);
|
264 | var scale = _MathUtil2["default"].scaler([startEasingValue, 1], [0, 1]);
|
265 | var newEasingName = p.opt.easing + "_" + p.uuid;
|
266 |
|
267 |
|
268 | $.easing[newEasingName] = generateNewEasingFunc(resumePercent, remainPercent, scale, originalEasing);
|
269 | p.opt.easing = newEasingName;
|
270 |
|
271 |
|
272 | p.addEasingFn(newEasingName);
|
273 | }
|
274 |
|
275 | p.paused = false;
|
276 | p.opt.duration -= p.elapsed;
|
277 |
|
278 |
|
279 | if (p.opt.duration > 0 || p.elapsed === 0) {
|
280 | i === 0 && p.init();
|
281 |
|
282 | if (p.type === "delay") {
|
283 |
|
284 | $(this).delay(p.opt.duration, "fx", true);
|
285 | } else {
|
286 | animateFn.call($(this), p.prop, p.opt);
|
287 | }
|
288 | }
|
289 |
|
290 | i++;
|
291 | p = this.__aniProps[i];
|
292 | }
|
293 | });
|
294 | };
|
295 |
|
296 | $.fn.stop = function () {
|
297 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
298 | args[_key] = arguments[_key];
|
299 | }
|
300 |
|
301 | var type = args[0];
|
302 | var clearQ = args[1];
|
303 |
|
304 | stopFn.apply(this, args);
|
305 |
|
306 | if (typeof type !== "string") {
|
307 | clearQ = type;
|
308 | }
|
309 |
|
310 | return this.each(function () {
|
311 | var p = void 0;
|
312 |
|
313 |
|
314 | if (_AniPropertyManager2["default"].getStatus(this) === "empty") {
|
315 | return;
|
316 | }
|
317 |
|
318 | if (!clearQ) {
|
319 | p = this.__aniProps.shift();
|
320 | p && p.clearEasingFn();
|
321 | } else {
|
322 |
|
323 |
|
324 |
|
325 | p = this.__aniProps.shift();
|
326 | while (p) {
|
327 | p.clearEasingFn();
|
328 | p = this.__aniProps.shift();
|
329 | }
|
330 | this.__aniProps = [];
|
331 | }
|
332 | });
|
333 | };
|
334 |
|
335 | $.expr.filters.paused = function (elem) {
|
336 | return _AniPropertyManager2["default"].getStatus(elem) === "paused";
|
337 | };
|
338 | }(_jquery2["default"]);
|
339 |
|
340 | module.exports = exports["default"];
|
341 |
|
342 | }),
|
343 |
|
344 | (function(module, exports, __webpack_require__) {
|
345 |
|
346 | "use strict";
|
347 |
|
348 |
|
349 | exports.__esModule = true;
|
350 |
|
351 | var _AniProperty = __webpack_require__(3);
|
352 |
|
353 | var _AniProperty2 = _interopRequireDefault(_AniProperty);
|
354 |
|
355 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
356 |
|
357 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
358 |
|
359 | var AniPropertyManager = function () {
|
360 | function AniPropertyManager() {
|
361 | _classCallCheck(this, AniPropertyManager);
|
362 | }
|
363 |
|
364 | AniPropertyManager.addAniProperty = function addAniProperty(type, el, prop, optall) {
|
365 | var newProp = new _AniProperty2["default"](type, el, prop, optall);
|
366 |
|
367 | el.__aniProps = el.__aniProps || [];
|
368 |
|
369 |
|
370 | if (el.__aniProps.length === 0) {
|
371 | newProp.init();
|
372 | }
|
373 | el.__aniProps.push(newProp);
|
374 | };
|
375 |
|
376 | AniPropertyManager.removeAniProperty = function removeAniProperty(el) {
|
377 | var removeProp = el.__aniProps.shift();
|
378 |
|
379 | removeProp && removeProp.clearEasingFn();
|
380 | el.__aniProps[0] && el.__aniProps[0].init();
|
381 | };
|
382 |
|
383 | AniPropertyManager.prepareNextAniProp = function prepareNextAniProp(el) {
|
384 |
|
385 | var removeProp = el.__aniProps.shift();
|
386 | var userCallback = removeProp.opt.old;
|
387 |
|
388 | removeProp.clearEasingFn();
|
389 |
|
390 |
|
391 | if (userCallback && typeof userCallback === "function") {
|
392 | userCallback.call(el);
|
393 | }
|
394 |
|
395 |
|
396 | el.__aniProps[0] && el.__aniProps[0].init();
|
397 | return el.__aniProps[0];
|
398 | };
|
399 |
|
400 |
|
401 |
|
402 |
|
403 | AniPropertyManager.getStatus = function getStatus(el) {
|
404 | if (!el.__aniProps || el.__aniProps.length === 0) {
|
405 |
|
406 |
|
407 | return "empty";
|
408 | }
|
409 |
|
410 | return el.__aniProps[0].paused ? "paused" : "inprogress";
|
411 | };
|
412 |
|
413 | return AniPropertyManager;
|
414 | }();
|
415 |
|
416 | exports["default"] = AniPropertyManager;
|
417 | module.exports = exports["default"];
|
418 |
|
419 | }),
|
420 |
|
421 | (function(module, exports, __webpack_require__) {
|
422 |
|
423 | "use strict";
|
424 |
|
425 |
|
426 | exports.__esModule = true;
|
427 |
|
428 | var _jquery = __webpack_require__(0);
|
429 |
|
430 | var _jquery2 = _interopRequireDefault(_jquery);
|
431 |
|
432 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
433 |
|
434 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
435 |
|
436 | var $ = _jquery2["default"];
|
437 | var uuid = 1;
|
438 |
|
439 | var AniProperty = function () {
|
440 | function AniProperty(type, el, prop, optall) {
|
441 | _classCallCheck(this, AniProperty);
|
442 |
|
443 | this.el = el;
|
444 | this.opt = optall;
|
445 | this.start = -1;
|
446 | this.elapsed = 0;
|
447 | this.paused = false;
|
448 | this.uuid = uuid++;
|
449 | this.easingNames = [];
|
450 | this.prop = prop;
|
451 | this.type = type;
|
452 | }
|
453 |
|
454 | AniProperty.prototype.init = function init() {
|
455 | this.start = $.now();
|
456 | this.elapsed = 0;
|
457 |
|
458 | for (var propName in this.prop) {
|
459 | var propValue = this.prop[propName];
|
460 |
|
461 |
|
462 |
|
463 | if (propName === "transform") {
|
464 | continue;
|
465 | }
|
466 |
|
467 | if (typeof propValue !== "string") {
|
468 | continue;
|
469 | }
|
470 |
|
471 |
|
472 | var markIndex = propValue.search(/[+|-]=/);
|
473 |
|
474 | if (markIndex < 0) {
|
475 |
|
476 | continue;
|
477 | }
|
478 |
|
479 |
|
480 | var sign = propValue.charAt(markIndex) === "-" ? -1 : 1;
|
481 |
|
482 |
|
483 | var currValue = $.css(this.el, propName);
|
484 |
|
485 |
|
486 | this.prop[propName] = propValue.replace(/([-|+])*([\d|.])+/g, AniProperty.generateAbsoluteValMaker(currValue, propName, sign)).replace(/[-|+]+=/g, "");
|
487 | }
|
488 | };
|
489 |
|
490 | AniProperty.prototype.addEasingFn = function addEasingFn(easingName) {
|
491 | this.easingNames.push(easingName);
|
492 | };
|
493 |
|
494 | AniProperty.prototype.clearEasingFn = function clearEasingFn() {
|
495 | var easing = void 0;
|
496 |
|
497 | easing = this.easingNames.shift();
|
498 | while (easing) {
|
499 | delete $.easing[easing];
|
500 | easing = this.easingNames.shift();
|
501 | }
|
502 | this.easingNames = [];
|
503 | };
|
504 |
|
505 | |
506 |
|
507 |
|
508 |
|
509 |
|
510 |
|
511 |
|
512 | AniProperty.generateAbsoluteValMaker = function generateAbsoluteValMaker(prevValue, propName, sign) {
|
513 | var prev = prevValue;
|
514 |
|
515 | return function absoluteValMaker(match) {
|
516 | if (!prev || prev === "auto") {
|
517 |
|
518 |
|
519 |
|
520 | prev = 0;
|
521 | } else {
|
522 | prev = parseFloat(prev);
|
523 | }
|
524 | return prev + match * sign;
|
525 | };
|
526 | };
|
527 |
|
528 | return AniProperty;
|
529 | }();
|
530 |
|
531 | exports["default"] = AniProperty;
|
532 | module.exports = exports["default"];
|
533 |
|
534 | }),
|
535 |
|
536 | (function(module, exports, __webpack_require__) {
|
537 |
|
538 | "use strict";
|
539 |
|
540 |
|
541 | exports.__esModule = true;
|
542 |
|
543 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
544 |
|
545 | var MathUtil = function () {
|
546 | function MathUtil() {
|
547 | _classCallCheck(this, MathUtil);
|
548 | }
|
549 |
|
550 | MathUtil.interpolateNumber = function interpolateNumber(a, b) {
|
551 | var numA = +a;
|
552 | var numB = +b;
|
553 |
|
554 | return function (t) {
|
555 | return numA * (1 - t) + numB * t;
|
556 | };
|
557 | };
|
558 |
|
559 | MathUtil.uninterpolateNumber = function uninterpolateNumber(a, b) {
|
560 | var numA = +a;
|
561 | var numB = b - numA;
|
562 |
|
563 | numB = numB || 1 / numB;
|
564 |
|
565 | return function (x) {
|
566 | return (x - numA) / numB;
|
567 | };
|
568 | };
|
569 |
|
570 |
|
571 |
|
572 |
|
573 | MathUtil.scaler = function scaler(domain, range) {
|
574 | var u = MathUtil.uninterpolateNumber(domain[0], domain[1]);
|
575 | var i = MathUtil.interpolateNumber(range[0], range[1]);
|
576 |
|
577 | return function (x) {
|
578 | return i(u(x));
|
579 | };
|
580 | };
|
581 |
|
582 | return MathUtil;
|
583 | }();
|
584 |
|
585 | exports["default"] = MathUtil;
|
586 | module.exports = exports["default"];
|
587 |
|
588 | })
|
589 | ]);
|
590 | }); |
\ | No newline at end of file |