fastman2 2.9.0 → 3.0.0-alpha.1
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.
- package/actionsheetman.js +96 -1
- package/alertman.js +79 -1
- package/annotationman.js +2912 -17
- package/baseman.js +115 -1
- package/blankpageman.js +171 -1
- package/cascadepickerman.js +322 -1
- package/confirmman.js +87 -1
- package/coreman.js +2182 -3
- package/cryptoman.js +8931 -2
- package/datetimepickerman.js +181 -1
- package/domman.js +2759 -1
- package/eventemitterman.js +112 -1
- package/fileuploadman.js +2970 -1
- package/formvalidateman.js +335 -1
- package/jsbridgeman.js +992 -1
- package/lazyloadman.js +133 -1
- package/loadingman.js +81 -1
- package/modalman.js +264 -1
- package/mutationobserverman.js +356 -1
- package/package.json +1 -1
- package/passguardman.js +1722 -1
- package/persistman.js +60 -1
- package/pickerman.js +680 -1
- package/popupman.js +61 -1
- package/postman.js +1649 -1
- package/preloadman.js +8760 -2
- package/resultpageman.js +153 -1
- package/routerman.js +1201 -1
- package/scrollman-infiniteRefresh.js +117 -1
- package/scrollman-pullDownRefresh.js +302 -1
- package/scrollman.js +2567 -2
- package/storeman.js +585 -1
- package/swiperman.js +4702 -1
- package/swiperoldman.js +3005 -1
- package/tabman.js +145 -1
- package/tipman.js +110 -1
- package/toastman.js +78 -1
- package/toolman.js +22 -1
- package/whenman.js +774 -1
- package/wsman.js +7624 -1
package/mutationobserverman.js
CHANGED
|
@@ -1 +1,356 @@
|
|
|
1
|
-
|
|
1
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
|
2
|
+
if(typeof exports === 'object' && typeof module === 'object')
|
|
3
|
+
module.exports = factory();
|
|
4
|
+
else if(typeof define === 'function' && define.amd)
|
|
5
|
+
define([], factory);
|
|
6
|
+
else if(typeof exports === 'object')
|
|
7
|
+
exports["fastman"] = factory();
|
|
8
|
+
else
|
|
9
|
+
root["fastman"] = factory();
|
|
10
|
+
})(this, function() {
|
|
11
|
+
return webpackJsonpfastman([8],{
|
|
12
|
+
|
|
13
|
+
/***/ 231:
|
|
14
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
15
|
+
|
|
16
|
+
module.exports = __webpack_require__(51);
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
/***/ }),
|
|
20
|
+
|
|
21
|
+
/***/ 3:
|
|
22
|
+
/***/ (function(module, exports) {
|
|
23
|
+
|
|
24
|
+
var g;
|
|
25
|
+
|
|
26
|
+
// This works in non-strict mode
|
|
27
|
+
g = (function() {
|
|
28
|
+
return this;
|
|
29
|
+
})();
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
// This works if eval is allowed (see CSP)
|
|
33
|
+
g = g || Function("return this")() || (1,eval)("this");
|
|
34
|
+
} catch(e) {
|
|
35
|
+
// This works if the window reference is available
|
|
36
|
+
if(typeof window === "object")
|
|
37
|
+
g = window;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// g can still be undefined, but nothing to do about it...
|
|
41
|
+
// We return undefined, instead of nothing here, so it's
|
|
42
|
+
// easier to handle this case. if(!global) { ...}
|
|
43
|
+
|
|
44
|
+
module.exports = g;
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
/***/ }),
|
|
48
|
+
|
|
49
|
+
/***/ 51:
|
|
50
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
51
|
+
|
|
52
|
+
"use strict";
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
Object.defineProperty(exports, "__esModule", {
|
|
56
|
+
value: true
|
|
57
|
+
});
|
|
58
|
+
/**
|
|
59
|
+
* Created by dfzq on 2017/8/14.
|
|
60
|
+
*/
|
|
61
|
+
var inViewport = __webpack_require__(59);
|
|
62
|
+
exports.default = inViewport;
|
|
63
|
+
|
|
64
|
+
/***/ }),
|
|
65
|
+
|
|
66
|
+
/***/ 59:
|
|
67
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
68
|
+
|
|
69
|
+
/* WEBPACK VAR INJECTION */(function(global) {module.exports = inViewport;
|
|
70
|
+
|
|
71
|
+
var instances = [];
|
|
72
|
+
var supportsMutationObserver = typeof global.MutationObserver === 'function';
|
|
73
|
+
|
|
74
|
+
function inViewport(elt, params, cb) {
|
|
75
|
+
var opts = {
|
|
76
|
+
container: global.document.body,
|
|
77
|
+
offset: 0,
|
|
78
|
+
debounce: 15,
|
|
79
|
+
failsafe: 150
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
if (params === undefined || typeof params === 'function') {
|
|
83
|
+
cb = params;
|
|
84
|
+
params = {};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
var container = opts.container = params.container || opts.container;
|
|
88
|
+
var offset = opts.offset = params.offset || opts.offset;
|
|
89
|
+
var debounceValue = opts.debounce = params.debounce || opts.debounce;
|
|
90
|
+
var failsafe = opts.failsafe = params.failsafe || opts.failsafe;
|
|
91
|
+
|
|
92
|
+
// ensure backward compatibility with failsafe as boolean
|
|
93
|
+
if (failsafe === true) {
|
|
94
|
+
failsafe = 150;
|
|
95
|
+
} else if(failsafe === false) {
|
|
96
|
+
failsafe = 0;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// failsafe check always needs to be higher than debounceValue
|
|
100
|
+
if (failsafe > 0 && failsafe < debounceValue) {
|
|
101
|
+
failsafe = debounceValue + 50;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
for (var i = 0; i < instances.length; i++) {
|
|
105
|
+
if (
|
|
106
|
+
instances[i].container === container &&
|
|
107
|
+
instances[i]._debounce === debounceValue &&
|
|
108
|
+
instances[i]._failsafe === failsafe
|
|
109
|
+
) {
|
|
110
|
+
return instances[i].isInViewport(elt, offset, cb);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return instances[
|
|
115
|
+
instances.push(createInViewport(container, debounceValue, failsafe)) - 1
|
|
116
|
+
].isInViewport(elt, offset, cb);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function addEvent(el, type, fn) {
|
|
120
|
+
if (el.attachEvent) {
|
|
121
|
+
el.attachEvent('on' + type, fn);
|
|
122
|
+
} else {
|
|
123
|
+
el.addEventListener(type, fn, false);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function debounce(func, wait, immediate) {
|
|
128
|
+
var timeout;
|
|
129
|
+
return function () {
|
|
130
|
+
var context = this, args = arguments;
|
|
131
|
+
var callNow = immediate && !timeout;
|
|
132
|
+
clearTimeout(timeout);
|
|
133
|
+
timeout = setTimeout(later, wait);
|
|
134
|
+
if (callNow) func.apply(context, args);
|
|
135
|
+
|
|
136
|
+
function later() {
|
|
137
|
+
timeout = null;
|
|
138
|
+
if (!immediate) func.apply(context, args);
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// https://github.com/jquery/sizzle/blob/3136f48b90e3edc84cbaaa6f6f7734ef03775a07/sizzle.js#L708
|
|
144
|
+
var contains = function() {
|
|
145
|
+
if (!global.document) {
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
148
|
+
return global.document.documentElement.compareDocumentPosition ?
|
|
149
|
+
function (a, b) {
|
|
150
|
+
return !!(a.compareDocumentPosition(b) & 16);
|
|
151
|
+
} :
|
|
152
|
+
global.document.documentElement.contains ?
|
|
153
|
+
function (a, b) {
|
|
154
|
+
return a !== b && ( a.contains ? a.contains(b) : false );
|
|
155
|
+
} :
|
|
156
|
+
function (a, b) {
|
|
157
|
+
while (b = b.parentNode) {
|
|
158
|
+
if (b === a) {
|
|
159
|
+
return true;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return false;
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function createInViewport(container, debounceValue, failsafe) {
|
|
167
|
+
var watches = createWatches();
|
|
168
|
+
|
|
169
|
+
var scrollContainer = container === global.document.body ? global : container;
|
|
170
|
+
var debouncedCheck = debounce(watches.checkAll(watchInViewport), debounceValue);
|
|
171
|
+
|
|
172
|
+
addEvent(scrollContainer, 'scroll', debouncedCheck);
|
|
173
|
+
|
|
174
|
+
if (scrollContainer === global) {
|
|
175
|
+
addEvent(global, 'resize', debouncedCheck);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if (supportsMutationObserver) {
|
|
179
|
+
observeDOM(watches, container, debouncedCheck);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// failsafe check, every X we check for visible images
|
|
183
|
+
// usecase: a hidden parent containing eleements
|
|
184
|
+
// when the parent becomes visible, we have no event that the children
|
|
185
|
+
// became visible
|
|
186
|
+
if (failsafe > 0) {
|
|
187
|
+
setInterval(debouncedCheck, failsafe);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function isInViewport(elt, offset, cb) {
|
|
191
|
+
if (!cb) {
|
|
192
|
+
return isVisible(elt, offset);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
var remote = createRemote(elt, offset, cb);
|
|
196
|
+
remote.watch();
|
|
197
|
+
return remote;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function createRemote(elt, offset, cb) {
|
|
201
|
+
function watch() {
|
|
202
|
+
watches.add(elt, offset, cb);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function dispose() {
|
|
206
|
+
watches.remove(elt);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
return {
|
|
210
|
+
watch: watch,
|
|
211
|
+
dispose: dispose
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function watchInViewport(elt, offset, cb) {
|
|
216
|
+
if (isVisible(elt, offset)) {
|
|
217
|
+
watches.remove(elt);
|
|
218
|
+
cb(elt);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function isVisible(elt, offset) {
|
|
223
|
+
if (!elt) {
|
|
224
|
+
return false;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
if (!contains(global.document.documentElement, elt) || !contains(global.document.documentElement, container)) {
|
|
228
|
+
return false;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// Check if the element is visible
|
|
232
|
+
// https://github.com/jquery/jquery/blob/740e190223d19a114d5373758127285d14d6b71e/src/css/hiddenVisibleSelectors.js
|
|
233
|
+
if (!elt.offsetWidth || !elt.offsetHeight) {
|
|
234
|
+
return false;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
var eltRect = elt.getBoundingClientRect();
|
|
238
|
+
var viewport = {};
|
|
239
|
+
|
|
240
|
+
if (container === global.document.body) {
|
|
241
|
+
viewport = {
|
|
242
|
+
top: -offset,
|
|
243
|
+
left: -offset,
|
|
244
|
+
right: global.document.documentElement.clientWidth + offset,
|
|
245
|
+
bottom: global.document.documentElement.clientHeight + offset
|
|
246
|
+
};
|
|
247
|
+
} else {
|
|
248
|
+
var containerRect = container.getBoundingClientRect();
|
|
249
|
+
viewport = {
|
|
250
|
+
top: containerRect.top - offset,
|
|
251
|
+
left: containerRect.left - offset,
|
|
252
|
+
right: containerRect.right + offset,
|
|
253
|
+
bottom: containerRect.bottom + offset
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// The element must overlap with the visible part of the viewport
|
|
258
|
+
var visible =
|
|
259
|
+
(
|
|
260
|
+
eltRect.right >= viewport.left &&
|
|
261
|
+
eltRect.left <= viewport.right &&
|
|
262
|
+
eltRect.bottom >= viewport.top &&
|
|
263
|
+
eltRect.top <= viewport.bottom
|
|
264
|
+
);
|
|
265
|
+
|
|
266
|
+
return visible;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
return {
|
|
270
|
+
container: container,
|
|
271
|
+
isInViewport: isInViewport,
|
|
272
|
+
_debounce: debounceValue,
|
|
273
|
+
_failsafe: failsafe
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
function createWatches() {
|
|
278
|
+
var watches = [];
|
|
279
|
+
|
|
280
|
+
function add(elt, offset, cb) {
|
|
281
|
+
if (!isWatched(elt)) {
|
|
282
|
+
watches.push([elt, offset, cb]);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
function remove(elt) {
|
|
287
|
+
var pos = indexOf(elt);
|
|
288
|
+
if (pos !== -1) {
|
|
289
|
+
watches.splice(pos, 1);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
function indexOf(elt) {
|
|
294
|
+
for (var i = watches.length - 1; i >= 0; i--) {
|
|
295
|
+
if (watches[i][0] === elt) {
|
|
296
|
+
return i;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
return -1;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
function isWatched(elt) {
|
|
303
|
+
return indexOf(elt) !== -1;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
function checkAll(cb) {
|
|
307
|
+
return function () {
|
|
308
|
+
for (var i = watches.length - 1; i >= 0; i--) {
|
|
309
|
+
cb.apply(this, watches[i]);
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
return {
|
|
315
|
+
add: add,
|
|
316
|
+
remove: remove,
|
|
317
|
+
isWatched: isWatched,
|
|
318
|
+
checkAll: checkAll
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
function observeDOM(watches, container, cb) {
|
|
323
|
+
var observer = new MutationObserver(watch);
|
|
324
|
+
var filter = Array.prototype.filter;
|
|
325
|
+
var concat = Array.prototype.concat;
|
|
326
|
+
|
|
327
|
+
observer.observe(container, {
|
|
328
|
+
childList: true,
|
|
329
|
+
subtree: true,
|
|
330
|
+
// changes like style/width/height/display will be catched
|
|
331
|
+
attributes: true
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
function watch(mutations) {
|
|
335
|
+
// some new DOM nodes where previously watched
|
|
336
|
+
// we should check their positions
|
|
337
|
+
if (mutations.some(knownNodes) === true) {
|
|
338
|
+
setTimeout(cb, 0);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
function knownNodes(mutation) {
|
|
343
|
+
var nodes = concat.call([],
|
|
344
|
+
Array.prototype.slice.call(mutation.addedNodes),
|
|
345
|
+
mutation.target
|
|
346
|
+
);
|
|
347
|
+
return filter.call(nodes, watches.isWatched).length > 0;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
|
|
352
|
+
|
|
353
|
+
/***/ })
|
|
354
|
+
|
|
355
|
+
},[231]);
|
|
356
|
+
});
|