tools-min-ns 1.5.2
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/README.md +85 -0
- package/esm/array/ArrayUtil.d.ts +109 -0
- package/esm/array/ArrayUtil.js +242 -0
- package/esm/array/TreeUtil.d.ts +151 -0
- package/esm/array/TreeUtil.js +412 -0
- package/esm/base/BaseUtil.d.ts +91 -0
- package/esm/base/BaseUtil.js +148 -0
- package/esm/browser/BrowserUtil.d.ts +57 -0
- package/esm/browser/BrowserUtil.js +337 -0
- package/esm/browser/fingerprint.d.ts +120 -0
- package/esm/browser/fingerprint.js +1469 -0
- package/esm/check/CheckUtil.d.ts +110 -0
- package/esm/check/CheckUtil.js +465 -0
- package/esm/common.d.ts +43 -0
- package/esm/common.js +44 -0
- package/esm/config.d.ts +7 -0
- package/esm/config.js +7 -0
- package/esm/cookie/CookieUtil.d.ts +56 -0
- package/esm/cookie/CookieUtil.js +12 -0
- package/esm/cookie/cookie.d.ts +2 -0
- package/esm/cookie/cookie.js +104 -0
- package/esm/date/DateUtil.d.ts +261 -0
- package/esm/date/DateUtil.js +763 -0
- package/esm/env/EnvUtil.d.ts +27 -0
- package/esm/env/EnvUtil.js +29 -0
- package/esm/env/env.d.ts +41 -0
- package/esm/env/env.js +106 -0
- package/esm/func/FunctionUtil.d.ts +77 -0
- package/esm/func/FunctionUtil.js +215 -0
- package/esm/index.d.ts +19 -0
- package/esm/index.js +19 -0
- package/esm/number/NumberUtil.d.ts +96 -0
- package/esm/number/NumberUtil.js +256 -0
- package/esm/object/ObjectUtil.d.ts +41 -0
- package/esm/object/ObjectUtil.js +158 -0
- package/esm/pwd/PasswordUtil.d.ts +33 -0
- package/esm/pwd/PasswordUtil.js +68 -0
- package/esm/pwd/crypto.d.ts +6 -0
- package/esm/pwd/crypto.js +1824 -0
- package/esm/request/RequestUtil.d.ts +52 -0
- package/esm/request/RequestUtil.js +53 -0
- package/esm/request/jsonp.d.ts +18 -0
- package/esm/request/jsonp.js +73 -0
- package/esm/request/mgop/env.d.ts +7 -0
- package/esm/request/mgop/env.js +15 -0
- package/esm/request/mgop/index.d.ts +3 -0
- package/esm/request/mgop/index.js +276 -0
- package/esm/request/mgop/responseCode.d.ts +20 -0
- package/esm/request/mgop/responseCode.js +37 -0
- package/esm/request/mgop/type.d.ts +34 -0
- package/esm/request/mgop/type.js +1 -0
- package/esm/request/uniRquest/index.d.ts +2 -0
- package/esm/request/uniRquest/index.js +66 -0
- package/esm/request/uniRquest/miniapp/index.d.ts +2 -0
- package/esm/request/uniRquest/miniapp/index.js +29 -0
- package/esm/request/uniRquest/miniapp-bytedance/index.d.ts +2 -0
- package/esm/request/uniRquest/miniapp-bytedance/index.js +41 -0
- package/esm/request/uniRquest/types.d.ts +65 -0
- package/esm/request/uniRquest/types.js +36 -0
- package/esm/request/uniRquest/utils.d.ts +9 -0
- package/esm/request/uniRquest/utils.js +69 -0
- package/esm/request/uniRquest/web/index.d.ts +2 -0
- package/esm/request/uniRquest/web/index.js +85 -0
- package/esm/request/uniRquest/wechat-miniprogram/index.d.ts +2 -0
- package/esm/request/uniRquest/wechat-miniprogram/index.js +41 -0
- package/esm/request/uniRquest/weex/index.d.ts +14 -0
- package/esm/request/uniRquest/weex/index.js +59 -0
- package/esm/storage/StorageUtil.d.ts +19 -0
- package/esm/storage/StorageUtil.js +75 -0
- package/esm/string/StringUtil.d.ts +392 -0
- package/esm/string/StringUtil.js +556 -0
- package/esm/system/SystemUtil.d.ts +46 -0
- package/esm/system/SystemUtil.js +122 -0
- package/esm/transfer/MapTransferUtil.d.ts +54 -0
- package/esm/transfer/MapTransferUtil.js +160 -0
- package/esm/transfer/TransferUtil.d.ts +98 -0
- package/esm/transfer/TransferUtil.js +323 -0
- package/esm/types.d.ts +25 -0
- package/esm/types.js +1 -0
- package/esm/url/UrlUtil.d.ts +30 -0
- package/esm/url/UrlUtil.js +85 -0
- package/lib/array/ArrayUtil.d.ts +109 -0
- package/lib/array/ArrayUtil.js +252 -0
- package/lib/array/TreeUtil.d.ts +151 -0
- package/lib/array/TreeUtil.js +422 -0
- package/lib/base/BaseUtil.d.ts +91 -0
- package/lib/base/BaseUtil.js +153 -0
- package/lib/browser/BrowserUtil.d.ts +57 -0
- package/lib/browser/BrowserUtil.js +347 -0
- package/lib/browser/fingerprint.d.ts +120 -0
- package/lib/browser/fingerprint.js +1500 -0
- package/lib/check/CheckUtil.d.ts +110 -0
- package/lib/check/CheckUtil.js +475 -0
- package/lib/common.d.ts +43 -0
- package/lib/common.js +50 -0
- package/lib/config.d.ts +7 -0
- package/lib/config.js +12 -0
- package/lib/cookie/CookieUtil.d.ts +56 -0
- package/lib/cookie/CookieUtil.js +22 -0
- package/lib/cookie/cookie.d.ts +2 -0
- package/lib/cookie/cookie.js +109 -0
- package/lib/date/DateUtil.d.ts +261 -0
- package/lib/date/DateUtil.js +773 -0
- package/lib/env/EnvUtil.d.ts +27 -0
- package/lib/env/EnvUtil.js +39 -0
- package/lib/env/env.d.ts +41 -0
- package/lib/env/env.js +112 -0
- package/lib/func/FunctionUtil.d.ts +77 -0
- package/lib/func/FunctionUtil.js +225 -0
- package/lib/index.d.ts +19 -0
- package/lib/index.js +144 -0
- package/lib/number/NumberUtil.d.ts +96 -0
- package/lib/number/NumberUtil.js +266 -0
- package/lib/object/ObjectUtil.d.ts +41 -0
- package/lib/object/ObjectUtil.js +168 -0
- package/lib/pwd/PasswordUtil.d.ts +33 -0
- package/lib/pwd/PasswordUtil.js +78 -0
- package/lib/pwd/crypto.d.ts +6 -0
- package/lib/pwd/crypto.js +1829 -0
- package/lib/request/RequestUtil.d.ts +52 -0
- package/lib/request/RequestUtil.js +94 -0
- package/lib/request/jsonp.d.ts +18 -0
- package/lib/request/jsonp.js +80 -0
- package/lib/request/mgop/env.d.ts +7 -0
- package/lib/request/mgop/env.js +21 -0
- package/lib/request/mgop/index.d.ts +3 -0
- package/lib/request/mgop/index.js +289 -0
- package/lib/request/mgop/responseCode.d.ts +20 -0
- package/lib/request/mgop/responseCode.js +42 -0
- package/lib/request/mgop/type.d.ts +34 -0
- package/lib/request/mgop/type.js +5 -0
- package/lib/request/uniRquest/index.d.ts +2 -0
- package/lib/request/uniRquest/index.js +77 -0
- package/lib/request/uniRquest/miniapp/index.d.ts +2 -0
- package/lib/request/uniRquest/miniapp/index.js +35 -0
- package/lib/request/uniRquest/miniapp-bytedance/index.d.ts +2 -0
- package/lib/request/uniRquest/miniapp-bytedance/index.js +47 -0
- package/lib/request/uniRquest/types.d.ts +65 -0
- package/lib/request/uniRquest/types.js +42 -0
- package/lib/request/uniRquest/utils.d.ts +9 -0
- package/lib/request/uniRquest/utils.js +83 -0
- package/lib/request/uniRquest/web/index.d.ts +2 -0
- package/lib/request/uniRquest/web/index.js +91 -0
- package/lib/request/uniRquest/wechat-miniprogram/index.d.ts +2 -0
- package/lib/request/uniRquest/wechat-miniprogram/index.js +47 -0
- package/lib/request/uniRquest/weex/index.d.ts +14 -0
- package/lib/request/uniRquest/weex/index.js +65 -0
- package/lib/storage/StorageUtil.d.ts +19 -0
- package/lib/storage/StorageUtil.js +85 -0
- package/lib/string/StringUtil.d.ts +392 -0
- package/lib/string/StringUtil.js +566 -0
- package/lib/system/SystemUtil.d.ts +46 -0
- package/lib/system/SystemUtil.js +132 -0
- package/lib/transfer/MapTransferUtil.d.ts +54 -0
- package/lib/transfer/MapTransferUtil.js +165 -0
- package/lib/transfer/TransferUtil.d.ts +98 -0
- package/lib/transfer/TransferUtil.js +333 -0
- package/lib/types.d.ts +25 -0
- package/lib/types.js +5 -0
- package/lib/url/UrlUtil.d.ts +30 -0
- package/lib/url/UrlUtil.js +95 -0
- package/package.json +56 -0
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) {
|
|
3
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
4
|
+
resolve(value);
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
8
|
+
function fulfilled(value) {
|
|
9
|
+
try {
|
|
10
|
+
step(generator.next(value));
|
|
11
|
+
} catch (e) {
|
|
12
|
+
reject(e);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function rejected(value) {
|
|
16
|
+
try {
|
|
17
|
+
step(generator["throw"](value));
|
|
18
|
+
} catch (e) {
|
|
19
|
+
reject(e);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function step(result) {
|
|
23
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
24
|
+
}
|
|
25
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
var __generator = this && this.__generator || function (thisArg, body) {
|
|
29
|
+
var _ = {
|
|
30
|
+
label: 0,
|
|
31
|
+
sent: function sent() {
|
|
32
|
+
if (t[0] & 1) throw t[1];
|
|
33
|
+
return t[1];
|
|
34
|
+
},
|
|
35
|
+
trys: [],
|
|
36
|
+
ops: []
|
|
37
|
+
},
|
|
38
|
+
f,
|
|
39
|
+
y,
|
|
40
|
+
t,
|
|
41
|
+
g;
|
|
42
|
+
return g = {
|
|
43
|
+
next: verb(0),
|
|
44
|
+
"throw": verb(1),
|
|
45
|
+
"return": verb(2)
|
|
46
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
47
|
+
return this;
|
|
48
|
+
}), g;
|
|
49
|
+
function verb(n) {
|
|
50
|
+
return function (v) {
|
|
51
|
+
return step([n, v]);
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function step(op) {
|
|
55
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
56
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
57
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
58
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
59
|
+
switch (op[0]) {
|
|
60
|
+
case 0:
|
|
61
|
+
case 1:
|
|
62
|
+
t = op;
|
|
63
|
+
break;
|
|
64
|
+
case 4:
|
|
65
|
+
_.label++;
|
|
66
|
+
return {
|
|
67
|
+
value: op[1],
|
|
68
|
+
done: false
|
|
69
|
+
};
|
|
70
|
+
case 5:
|
|
71
|
+
_.label++;
|
|
72
|
+
y = op[1];
|
|
73
|
+
op = [0];
|
|
74
|
+
continue;
|
|
75
|
+
case 7:
|
|
76
|
+
op = _.ops.pop();
|
|
77
|
+
_.trys.pop();
|
|
78
|
+
continue;
|
|
79
|
+
default:
|
|
80
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
81
|
+
_ = 0;
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
85
|
+
_.label = op[1];
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
89
|
+
_.label = t[1];
|
|
90
|
+
t = op;
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
if (t && _.label < t[2]) {
|
|
94
|
+
_.label = t[2];
|
|
95
|
+
_.ops.push(op);
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
if (t[2]) _.ops.pop();
|
|
99
|
+
_.trys.pop();
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
op = body.call(thisArg, _);
|
|
103
|
+
} catch (e) {
|
|
104
|
+
op = [6, e];
|
|
105
|
+
y = 0;
|
|
106
|
+
} finally {
|
|
107
|
+
f = t = 0;
|
|
108
|
+
}
|
|
109
|
+
if (op[0] & 5) throw op[1];
|
|
110
|
+
return {
|
|
111
|
+
value: op[0] ? op[1] : void 0,
|
|
112
|
+
done: true
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
import BaseUtil from '../base/BaseUtil';
|
|
117
|
+
import env from '../env/env';
|
|
118
|
+
import fingerprint from './fingerprint';
|
|
119
|
+
var userAgent = env.getGlobal().navigator.userAgent;
|
|
120
|
+
var isInUserAgent = function isInUserAgent(v) {
|
|
121
|
+
return userAgent === null || userAgent === void 0 ? void 0 : userAgent.toLowerCase().includes(v);
|
|
122
|
+
};
|
|
123
|
+
var BrowserUtil;
|
|
124
|
+
(function (BrowserUtil) {
|
|
125
|
+
var _this = this;
|
|
126
|
+
/**
|
|
127
|
+
* 获取浏览器id
|
|
128
|
+
*/
|
|
129
|
+
BrowserUtil.getId = function () {
|
|
130
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
131
|
+
var visitorId;
|
|
132
|
+
return __generator(this, function (_a) {
|
|
133
|
+
switch (_a.label) {
|
|
134
|
+
case 0:
|
|
135
|
+
return [4 /*yield*/, fingerprint.load()];
|
|
136
|
+
case 1:
|
|
137
|
+
return [4 /*yield*/, _a.sent().get()];
|
|
138
|
+
case 2:
|
|
139
|
+
visitorId = _a.sent().visitorId;
|
|
140
|
+
return [2 /*return*/, visitorId];
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* 获取浏览器类型
|
|
147
|
+
* @returns Opera | IE | Edge | Firefox | Safari | Chrome | OverIE10 | ""
|
|
148
|
+
*/
|
|
149
|
+
BrowserUtil.browserGetType = function () {
|
|
150
|
+
if (userAgent.indexOf('Opera') > -1 || userAgent.indexOf('OPR') > -1) {
|
|
151
|
+
return 'Opera';
|
|
152
|
+
} else if (userAgent.indexOf('compatible') > -1 && userAgent.indexOf('MSIE') > -1) {
|
|
153
|
+
return 'IE';
|
|
154
|
+
} else if (userAgent.indexOf('Edge') > -1) {
|
|
155
|
+
return 'Edge';
|
|
156
|
+
} else if (userAgent.indexOf('Firefox') > -1) {
|
|
157
|
+
return 'Firefox';
|
|
158
|
+
} else if (userAgent.indexOf('Safari') > -1 && userAgent.indexOf('Chrome') === -1) {
|
|
159
|
+
return 'Safari';
|
|
160
|
+
} else if (userAgent.indexOf('Chrome') > -1 && userAgent.indexOf('Safari') > -1) {
|
|
161
|
+
return 'Chrome';
|
|
162
|
+
} else if (!!window.window.ActiveXObject || 'ActiveXObject' in window) {
|
|
163
|
+
return 'OverIE10';
|
|
164
|
+
}
|
|
165
|
+
return '';
|
|
166
|
+
};
|
|
167
|
+
/**
|
|
168
|
+
* 判断是否是移动端浏览器
|
|
169
|
+
* @returns boolean
|
|
170
|
+
*/
|
|
171
|
+
BrowserUtil.isMobileBrowser = function () {
|
|
172
|
+
return !!userAgent.toLowerCase().match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|SymbianOS|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i);
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* 判断是否微信内置浏览器
|
|
176
|
+
* @returns boolean
|
|
177
|
+
*/
|
|
178
|
+
BrowserUtil.isWeixinBrowser = function () {
|
|
179
|
+
return isInUserAgent('micromessenger');
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* 判断是否微信小程序WebView
|
|
183
|
+
* @returns boolean
|
|
184
|
+
*/
|
|
185
|
+
BrowserUtil.isWeixinMiniWebView = function () {
|
|
186
|
+
return (window === null || window === void 0 ? void 0 : window.__wxjs_environment) === 'miniprogram';
|
|
187
|
+
};
|
|
188
|
+
/**
|
|
189
|
+
* 判断是否是支付宝浏览器
|
|
190
|
+
* @returns boolean
|
|
191
|
+
*/
|
|
192
|
+
BrowserUtil.isAlipayBrowser = function () {
|
|
193
|
+
return isInUserAgent('alipayclient');
|
|
194
|
+
};
|
|
195
|
+
/**
|
|
196
|
+
* 判断是否是支付宝小程序webview
|
|
197
|
+
* @returns boolean
|
|
198
|
+
*/
|
|
199
|
+
BrowserUtil.isAlipayMiniWebView = function () {
|
|
200
|
+
return isInUserAgent('miniprogram') || isInUserAgent('alipay');
|
|
201
|
+
};
|
|
202
|
+
/**
|
|
203
|
+
* 判断是否是浙里办
|
|
204
|
+
* @returns boolean
|
|
205
|
+
*/
|
|
206
|
+
BrowserUtil.isMgopBrowser = function () {
|
|
207
|
+
return isInUserAgent('dtdreamweb');
|
|
208
|
+
};
|
|
209
|
+
/** 全屏 */
|
|
210
|
+
function fullScreen(root, callback) {
|
|
211
|
+
var doc = document;
|
|
212
|
+
var docElm = BaseUtil.isString(root) ? document.getElementById(root) : root;
|
|
213
|
+
var isFull = isFullScreen();
|
|
214
|
+
try {
|
|
215
|
+
if (isFull) {
|
|
216
|
+
// W3C
|
|
217
|
+
if (document.exitFullscreen) {
|
|
218
|
+
document.exitFullscreen();
|
|
219
|
+
} else if (doc.mozCancelFullScreen) {
|
|
220
|
+
// FireFox
|
|
221
|
+
doc.mozCancelFullScreen();
|
|
222
|
+
} else if (doc.webkitCancelFullScreen) {
|
|
223
|
+
// Chrome等
|
|
224
|
+
doc.webkitCancelFullScreen();
|
|
225
|
+
} else if (doc.msExitFullscreen) {
|
|
226
|
+
// IE11
|
|
227
|
+
doc.msExitFullscreen();
|
|
228
|
+
}
|
|
229
|
+
callback === null || callback === void 0 ? void 0 : callback(isFull);
|
|
230
|
+
} else {
|
|
231
|
+
// W3C
|
|
232
|
+
if (!docElm) {
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
if (docElm.requestFullscreen) {
|
|
236
|
+
docElm.requestFullscreen();
|
|
237
|
+
} else if (docElm.mozRequestFullScreen) {
|
|
238
|
+
// FireFox
|
|
239
|
+
docElm.mozRequestFullScreen();
|
|
240
|
+
} else if (docElm.webkitRequestFullScreen) {
|
|
241
|
+
// Chrome等
|
|
242
|
+
docElm.webkitRequestFullScreen();
|
|
243
|
+
} else if (docElm.msRequestFullscreen) {
|
|
244
|
+
// IE11
|
|
245
|
+
docElm.msRequestFullscreen();
|
|
246
|
+
}
|
|
247
|
+
callback === null || callback === void 0 ? void 0 : callback(isFull);
|
|
248
|
+
}
|
|
249
|
+
} catch (error) {
|
|
250
|
+
console.error('浏览器不支持');
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
BrowserUtil.fullScreen = fullScreen;
|
|
254
|
+
/** 是否全屏 */
|
|
255
|
+
function isFullScreen() {
|
|
256
|
+
return window.fullScreen || document.webkitIsFullScreen || document.msFullscreenEnabled;
|
|
257
|
+
}
|
|
258
|
+
BrowserUtil.isFullScreen = isFullScreen;
|
|
259
|
+
/** 水印 */
|
|
260
|
+
function waterMark(defaultSettings) {
|
|
261
|
+
if (arguments.length === 1 && typeof arguments[0] === 'object') {
|
|
262
|
+
var src = arguments[0] || {};
|
|
263
|
+
for (var key in src) {
|
|
264
|
+
if (src[key] && defaultSettings[key] && src[key] === defaultSettings[key]) continue;else if (src[key]) defaultSettings[key] = src[key];
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
var oTemp = document.createDocumentFragment();
|
|
268
|
+
var maskDiv = document.createElement('div');
|
|
269
|
+
maskDiv.id = 'mask_div';
|
|
270
|
+
oTemp.appendChild(maskDiv);
|
|
271
|
+
// 获取页面最大宽度
|
|
272
|
+
var pagewidth = Math.max(document.body.scrollWidth, document.body.clientWidth);
|
|
273
|
+
var cutWidth = pagewidth * 0.015;
|
|
274
|
+
var pageWidth = pagewidth - cutWidth;
|
|
275
|
+
// 获取页面最大高度
|
|
276
|
+
var pageHeight = Math.max(document.body.scrollHeight, document.body.clientHeight);
|
|
277
|
+
pageHeight = Math.max(pageHeight, window.innerHeight - 30);
|
|
278
|
+
// 如果将水印列数设置为0,或水印列数设置过大,超过页面最大宽度,则重新计算水印列数和水印x轴间隔
|
|
279
|
+
if (defaultSettings.watermark_cols === 0 || Number(defaultSettings.watermark_x + defaultSettings.watermark_width * defaultSettings.watermark_cols + defaultSettings.watermark_x_space * (defaultSettings.watermark_cols - 1)) > pageWidth) {
|
|
280
|
+
defaultSettings.watermark_cols = Number((pageWidth - defaultSettings.watermark_x + defaultSettings.watermark_x_space) / (defaultSettings.watermark_width + defaultSettings.watermark_x_space));
|
|
281
|
+
defaultSettings.watermark_x_space = Number((pageWidth - defaultSettings.watermark_x - defaultSettings.watermark_width * defaultSettings.watermark_cols) / (defaultSettings.watermark_cols - 1));
|
|
282
|
+
}
|
|
283
|
+
// 如果将水印行数设置为0,或水印行数设置过大,超过页面最大长度,则重新计算水印行数和水印y轴间隔
|
|
284
|
+
if (defaultSettings.watermark_rows === 0 || Number(defaultSettings.watermark_y + defaultSettings.watermark_height * defaultSettings.watermark_rows + defaultSettings.watermark_y_space * (defaultSettings.watermark_rows - 1)) > pageHeight) {
|
|
285
|
+
defaultSettings.watermark_rows = Number((defaultSettings.watermark_y_space + pageHeight - defaultSettings.watermark_y) / (defaultSettings.watermark_height + defaultSettings.watermark_y_space));
|
|
286
|
+
defaultSettings.watermark_y_space = Number((pageHeight - defaultSettings.watermark_y - defaultSettings.watermark_height * defaultSettings.watermark_rows) / (defaultSettings.watermark_rows - 1));
|
|
287
|
+
}
|
|
288
|
+
var x;
|
|
289
|
+
var y;
|
|
290
|
+
for (var i = 0; i < defaultSettings.watermark_rows; i += 1) {
|
|
291
|
+
y = defaultSettings.watermark_y + (defaultSettings.watermark_y_space + defaultSettings.watermark_height) * i - 220;
|
|
292
|
+
for (var j = 0; j < defaultSettings.watermark_cols; j += 1) {
|
|
293
|
+
x = defaultSettings.watermark_x + (defaultSettings.watermark_width + defaultSettings.watermark_x_space) * j - 220;
|
|
294
|
+
var maskdiv = document.createElement('div');
|
|
295
|
+
maskdiv.id = "mask_div".concat(i).concat(j);
|
|
296
|
+
maskdiv.className = 'mask_div';
|
|
297
|
+
maskdiv.appendChild(document.createTextNode(defaultSettings.watermark_txt));
|
|
298
|
+
// 设置水印div倾斜显示
|
|
299
|
+
maskdiv.style.webkitTransform = "rotate(-".concat(defaultSettings.watermark_angle, "deg)");
|
|
300
|
+
maskdiv.style.MozTransform = "rotate(-".concat(defaultSettings.watermark_angle, "deg)");
|
|
301
|
+
maskdiv.style.msTransform = "rotate(-".concat(defaultSettings.watermark_angle, "deg)");
|
|
302
|
+
maskdiv.style.OTransform = "rotate(-".concat(defaultSettings.watermark_angle, "deg)");
|
|
303
|
+
maskdiv.style.transform = "rotate(-".concat(defaultSettings.watermark_angle, "deg)");
|
|
304
|
+
maskdiv.style.visibility = '';
|
|
305
|
+
maskdiv.style.position = 'absolute';
|
|
306
|
+
maskdiv.style.left = "".concat(x, "px");
|
|
307
|
+
maskdiv.style.top = "".concat(y, "px");
|
|
308
|
+
maskdiv.style.overflow = 'hidden';
|
|
309
|
+
maskdiv.style.zIndex = '9999';
|
|
310
|
+
// 让水印不遮挡页面的点击事件
|
|
311
|
+
maskdiv.style.pointerEvents = 'none';
|
|
312
|
+
maskdiv.style.opacity = "".concat(defaultSettings.watermark_alpha);
|
|
313
|
+
maskdiv.style.fontSize = defaultSettings.watermark_fontsize;
|
|
314
|
+
maskdiv.style.fontFamily = defaultSettings.watermark_font;
|
|
315
|
+
maskdiv.style.color = defaultSettings.watermark_color;
|
|
316
|
+
maskdiv.style.textAlign = 'center';
|
|
317
|
+
maskdiv.style.width = "".concat(defaultSettings.watermark_width, "px");
|
|
318
|
+
maskdiv.style.height = "".concat(defaultSettings.watermark_height, "px");
|
|
319
|
+
maskdiv.style.display = 'block';
|
|
320
|
+
maskDiv.appendChild(maskdiv);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
document.body.appendChild(oTemp);
|
|
324
|
+
}
|
|
325
|
+
BrowserUtil.waterMark = waterMark;
|
|
326
|
+
/* 移除水印 */
|
|
327
|
+
function removeMark() {
|
|
328
|
+
/* 移除水印 */
|
|
329
|
+
var watermarkElement = document.getElementById('mask_div');
|
|
330
|
+
if (watermarkElement) {
|
|
331
|
+
var parentElement = watermarkElement.parentNode;
|
|
332
|
+
parentElement.removeChild(watermarkElement);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
BrowserUtil.removeMark = removeMark;
|
|
336
|
+
})(BrowserUtil || (BrowserUtil = {}));
|
|
337
|
+
export default BrowserUtil;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
declare function Fe(n: any): string;
|
|
2
|
+
declare namespace Xe {
|
|
3
|
+
export { je as load };
|
|
4
|
+
export { Ge as hashComponents };
|
|
5
|
+
export { Fe as componentsToDebugString };
|
|
6
|
+
}
|
|
7
|
+
declare function z(): boolean;
|
|
8
|
+
declare function A(): any;
|
|
9
|
+
declare function _(): any;
|
|
10
|
+
declare function K(e: any): any;
|
|
11
|
+
declare function re(): () => any;
|
|
12
|
+
declare function ee(): any[];
|
|
13
|
+
declare function ke(e: any): any;
|
|
14
|
+
declare function be(e: any): -2 | -3;
|
|
15
|
+
declare function Ge(e: any): string;
|
|
16
|
+
declare function N(): boolean;
|
|
17
|
+
declare function j(): boolean;
|
|
18
|
+
declare function P(): boolean;
|
|
19
|
+
declare function Y(): boolean;
|
|
20
|
+
declare function C(): boolean;
|
|
21
|
+
declare function I(): boolean;
|
|
22
|
+
declare function X(): boolean;
|
|
23
|
+
declare function je(e: any): any;
|
|
24
|
+
declare function F(e: any, r: any, o: any): () => any;
|
|
25
|
+
declare function Pe(e: any, n: any): string;
|
|
26
|
+
declare function Ie(e: any): Promise<any>;
|
|
27
|
+
declare function O(e: any): Promise<any>;
|
|
28
|
+
declare namespace Me {
|
|
29
|
+
function fonts(): any;
|
|
30
|
+
function domBlockers(e: any): any;
|
|
31
|
+
function fontPreferences(): any;
|
|
32
|
+
function audio(): any;
|
|
33
|
+
function screenFrame(): () => any;
|
|
34
|
+
function canvas(): any;
|
|
35
|
+
function osCpu(): any;
|
|
36
|
+
function languages(): any[];
|
|
37
|
+
function colorDepth(): number;
|
|
38
|
+
function deviceMemory(): any;
|
|
39
|
+
function screenResolution(): any[] | undefined;
|
|
40
|
+
function hardwareConcurrency(): any;
|
|
41
|
+
function timezone(): string;
|
|
42
|
+
function sessionStorage(): boolean;
|
|
43
|
+
function localStorage(): boolean;
|
|
44
|
+
function indexedDB(): true | undefined;
|
|
45
|
+
function openDatabase(): boolean;
|
|
46
|
+
function cpuClass(): any;
|
|
47
|
+
function platform(): string;
|
|
48
|
+
function plugins(): {
|
|
49
|
+
name: string;
|
|
50
|
+
description: string;
|
|
51
|
+
mimeTypes: {
|
|
52
|
+
type: string;
|
|
53
|
+
suffixes: string;
|
|
54
|
+
}[];
|
|
55
|
+
}[] | undefined;
|
|
56
|
+
function touchSupport(): {
|
|
57
|
+
maxTouchPoints: number;
|
|
58
|
+
touchEvent: boolean;
|
|
59
|
+
touchStart: boolean;
|
|
60
|
+
};
|
|
61
|
+
function vendor(): string;
|
|
62
|
+
function vendorFlavors(): string[];
|
|
63
|
+
function cookiesEnabled(): boolean;
|
|
64
|
+
function colorGamut(): string | undefined;
|
|
65
|
+
function invertedColors(): boolean | undefined;
|
|
66
|
+
function forcedColors(): boolean | undefined;
|
|
67
|
+
function monochrome(): number | undefined;
|
|
68
|
+
function contrast(): 0 | 10 | 1 | -1 | undefined;
|
|
69
|
+
function reducedMotion(): boolean | undefined;
|
|
70
|
+
function reducedTransparency(): boolean | undefined;
|
|
71
|
+
function hdr(): boolean | undefined;
|
|
72
|
+
function math(): {
|
|
73
|
+
acos: number;
|
|
74
|
+
acosh: number;
|
|
75
|
+
acoshPf: number;
|
|
76
|
+
asin: number;
|
|
77
|
+
asinh: number;
|
|
78
|
+
asinhPf: number;
|
|
79
|
+
atanh: number;
|
|
80
|
+
atanhPf: number;
|
|
81
|
+
atan: number;
|
|
82
|
+
sin: number;
|
|
83
|
+
sinh: number;
|
|
84
|
+
sinhPf: number;
|
|
85
|
+
cos: number;
|
|
86
|
+
cosh: number;
|
|
87
|
+
coshPf: number;
|
|
88
|
+
tan: number;
|
|
89
|
+
tanh: number;
|
|
90
|
+
tanhPf: number;
|
|
91
|
+
exp: number;
|
|
92
|
+
expm1: number;
|
|
93
|
+
expm1Pf: number;
|
|
94
|
+
log1p: number;
|
|
95
|
+
log1pPf: number;
|
|
96
|
+
powPI: number;
|
|
97
|
+
};
|
|
98
|
+
function pdfViewerEnabled(): boolean;
|
|
99
|
+
function architecture(): number;
|
|
100
|
+
function applePay(): 0 | 1 | -1 | -2 | -3;
|
|
101
|
+
function privateClickMeasurement(): string | undefined;
|
|
102
|
+
function webGlBasics(e: any): -1 | -2 | {
|
|
103
|
+
version: any;
|
|
104
|
+
vendor: any;
|
|
105
|
+
vendorUnmasked: any;
|
|
106
|
+
renderer: any;
|
|
107
|
+
rendererUnmasked: any;
|
|
108
|
+
shadingLanguageVersion: any;
|
|
109
|
+
};
|
|
110
|
+
function webGlExtensions(e: any): -1 | -2 | {
|
|
111
|
+
contextAttributes: string[];
|
|
112
|
+
parameters: string[];
|
|
113
|
+
shaderPrecisions: string[];
|
|
114
|
+
extensions: any;
|
|
115
|
+
extensionParameters: string[];
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
declare function G(e: any, n: any): (n: any) => any;
|
|
119
|
+
declare function J(e: any, r: any, i: any): any;
|
|
120
|
+
export { Fe as componentsToDebugString, Xe as default, z as doesBrowserSuspendAudioContext, A as getFullscreenElement, _ as getUnstableAudioFingerprint, K as getUnstableCanvasFingerprint, re as getUnstableScreenFrame, ee as getUnstableScreenResolution, ke as getWebGLContext, be as handleApplePayError, Ge as hashComponents, N as isAndroid, j as isChromium, P as isDesktopWebKit, Y as isEdgeHTML, C as isGecko, I as isTrident, X as isWebKit, je as load, F as loadSources, Pe as murmurX64Hash128, Ie as prepareForSources, O as renderAudio, Me as sources, G as transformSource, J as withIframe };
|