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.
Files changed (162) hide show
  1. package/README.md +85 -0
  2. package/esm/array/ArrayUtil.d.ts +109 -0
  3. package/esm/array/ArrayUtil.js +242 -0
  4. package/esm/array/TreeUtil.d.ts +151 -0
  5. package/esm/array/TreeUtil.js +412 -0
  6. package/esm/base/BaseUtil.d.ts +91 -0
  7. package/esm/base/BaseUtil.js +148 -0
  8. package/esm/browser/BrowserUtil.d.ts +57 -0
  9. package/esm/browser/BrowserUtil.js +337 -0
  10. package/esm/browser/fingerprint.d.ts +120 -0
  11. package/esm/browser/fingerprint.js +1469 -0
  12. package/esm/check/CheckUtil.d.ts +110 -0
  13. package/esm/check/CheckUtil.js +465 -0
  14. package/esm/common.d.ts +43 -0
  15. package/esm/common.js +44 -0
  16. package/esm/config.d.ts +7 -0
  17. package/esm/config.js +7 -0
  18. package/esm/cookie/CookieUtil.d.ts +56 -0
  19. package/esm/cookie/CookieUtil.js +12 -0
  20. package/esm/cookie/cookie.d.ts +2 -0
  21. package/esm/cookie/cookie.js +104 -0
  22. package/esm/date/DateUtil.d.ts +261 -0
  23. package/esm/date/DateUtil.js +763 -0
  24. package/esm/env/EnvUtil.d.ts +27 -0
  25. package/esm/env/EnvUtil.js +29 -0
  26. package/esm/env/env.d.ts +41 -0
  27. package/esm/env/env.js +106 -0
  28. package/esm/func/FunctionUtil.d.ts +77 -0
  29. package/esm/func/FunctionUtil.js +215 -0
  30. package/esm/index.d.ts +19 -0
  31. package/esm/index.js +19 -0
  32. package/esm/number/NumberUtil.d.ts +96 -0
  33. package/esm/number/NumberUtil.js +256 -0
  34. package/esm/object/ObjectUtil.d.ts +41 -0
  35. package/esm/object/ObjectUtil.js +158 -0
  36. package/esm/pwd/PasswordUtil.d.ts +33 -0
  37. package/esm/pwd/PasswordUtil.js +68 -0
  38. package/esm/pwd/crypto.d.ts +6 -0
  39. package/esm/pwd/crypto.js +1824 -0
  40. package/esm/request/RequestUtil.d.ts +52 -0
  41. package/esm/request/RequestUtil.js +53 -0
  42. package/esm/request/jsonp.d.ts +18 -0
  43. package/esm/request/jsonp.js +73 -0
  44. package/esm/request/mgop/env.d.ts +7 -0
  45. package/esm/request/mgop/env.js +15 -0
  46. package/esm/request/mgop/index.d.ts +3 -0
  47. package/esm/request/mgop/index.js +276 -0
  48. package/esm/request/mgop/responseCode.d.ts +20 -0
  49. package/esm/request/mgop/responseCode.js +37 -0
  50. package/esm/request/mgop/type.d.ts +34 -0
  51. package/esm/request/mgop/type.js +1 -0
  52. package/esm/request/uniRquest/index.d.ts +2 -0
  53. package/esm/request/uniRquest/index.js +66 -0
  54. package/esm/request/uniRquest/miniapp/index.d.ts +2 -0
  55. package/esm/request/uniRquest/miniapp/index.js +29 -0
  56. package/esm/request/uniRquest/miniapp-bytedance/index.d.ts +2 -0
  57. package/esm/request/uniRquest/miniapp-bytedance/index.js +41 -0
  58. package/esm/request/uniRquest/types.d.ts +65 -0
  59. package/esm/request/uniRquest/types.js +36 -0
  60. package/esm/request/uniRquest/utils.d.ts +9 -0
  61. package/esm/request/uniRquest/utils.js +69 -0
  62. package/esm/request/uniRquest/web/index.d.ts +2 -0
  63. package/esm/request/uniRquest/web/index.js +85 -0
  64. package/esm/request/uniRquest/wechat-miniprogram/index.d.ts +2 -0
  65. package/esm/request/uniRquest/wechat-miniprogram/index.js +41 -0
  66. package/esm/request/uniRquest/weex/index.d.ts +14 -0
  67. package/esm/request/uniRquest/weex/index.js +59 -0
  68. package/esm/storage/StorageUtil.d.ts +19 -0
  69. package/esm/storage/StorageUtil.js +75 -0
  70. package/esm/string/StringUtil.d.ts +392 -0
  71. package/esm/string/StringUtil.js +556 -0
  72. package/esm/system/SystemUtil.d.ts +46 -0
  73. package/esm/system/SystemUtil.js +122 -0
  74. package/esm/transfer/MapTransferUtil.d.ts +54 -0
  75. package/esm/transfer/MapTransferUtil.js +160 -0
  76. package/esm/transfer/TransferUtil.d.ts +98 -0
  77. package/esm/transfer/TransferUtil.js +323 -0
  78. package/esm/types.d.ts +25 -0
  79. package/esm/types.js +1 -0
  80. package/esm/url/UrlUtil.d.ts +30 -0
  81. package/esm/url/UrlUtil.js +85 -0
  82. package/lib/array/ArrayUtil.d.ts +109 -0
  83. package/lib/array/ArrayUtil.js +252 -0
  84. package/lib/array/TreeUtil.d.ts +151 -0
  85. package/lib/array/TreeUtil.js +422 -0
  86. package/lib/base/BaseUtil.d.ts +91 -0
  87. package/lib/base/BaseUtil.js +153 -0
  88. package/lib/browser/BrowserUtil.d.ts +57 -0
  89. package/lib/browser/BrowserUtil.js +347 -0
  90. package/lib/browser/fingerprint.d.ts +120 -0
  91. package/lib/browser/fingerprint.js +1500 -0
  92. package/lib/check/CheckUtil.d.ts +110 -0
  93. package/lib/check/CheckUtil.js +475 -0
  94. package/lib/common.d.ts +43 -0
  95. package/lib/common.js +50 -0
  96. package/lib/config.d.ts +7 -0
  97. package/lib/config.js +12 -0
  98. package/lib/cookie/CookieUtil.d.ts +56 -0
  99. package/lib/cookie/CookieUtil.js +22 -0
  100. package/lib/cookie/cookie.d.ts +2 -0
  101. package/lib/cookie/cookie.js +109 -0
  102. package/lib/date/DateUtil.d.ts +261 -0
  103. package/lib/date/DateUtil.js +773 -0
  104. package/lib/env/EnvUtil.d.ts +27 -0
  105. package/lib/env/EnvUtil.js +39 -0
  106. package/lib/env/env.d.ts +41 -0
  107. package/lib/env/env.js +112 -0
  108. package/lib/func/FunctionUtil.d.ts +77 -0
  109. package/lib/func/FunctionUtil.js +225 -0
  110. package/lib/index.d.ts +19 -0
  111. package/lib/index.js +144 -0
  112. package/lib/number/NumberUtil.d.ts +96 -0
  113. package/lib/number/NumberUtil.js +266 -0
  114. package/lib/object/ObjectUtil.d.ts +41 -0
  115. package/lib/object/ObjectUtil.js +168 -0
  116. package/lib/pwd/PasswordUtil.d.ts +33 -0
  117. package/lib/pwd/PasswordUtil.js +78 -0
  118. package/lib/pwd/crypto.d.ts +6 -0
  119. package/lib/pwd/crypto.js +1829 -0
  120. package/lib/request/RequestUtil.d.ts +52 -0
  121. package/lib/request/RequestUtil.js +94 -0
  122. package/lib/request/jsonp.d.ts +18 -0
  123. package/lib/request/jsonp.js +80 -0
  124. package/lib/request/mgop/env.d.ts +7 -0
  125. package/lib/request/mgop/env.js +21 -0
  126. package/lib/request/mgop/index.d.ts +3 -0
  127. package/lib/request/mgop/index.js +289 -0
  128. package/lib/request/mgop/responseCode.d.ts +20 -0
  129. package/lib/request/mgop/responseCode.js +42 -0
  130. package/lib/request/mgop/type.d.ts +34 -0
  131. package/lib/request/mgop/type.js +5 -0
  132. package/lib/request/uniRquest/index.d.ts +2 -0
  133. package/lib/request/uniRquest/index.js +77 -0
  134. package/lib/request/uniRquest/miniapp/index.d.ts +2 -0
  135. package/lib/request/uniRquest/miniapp/index.js +35 -0
  136. package/lib/request/uniRquest/miniapp-bytedance/index.d.ts +2 -0
  137. package/lib/request/uniRquest/miniapp-bytedance/index.js +47 -0
  138. package/lib/request/uniRquest/types.d.ts +65 -0
  139. package/lib/request/uniRquest/types.js +42 -0
  140. package/lib/request/uniRquest/utils.d.ts +9 -0
  141. package/lib/request/uniRquest/utils.js +83 -0
  142. package/lib/request/uniRquest/web/index.d.ts +2 -0
  143. package/lib/request/uniRquest/web/index.js +91 -0
  144. package/lib/request/uniRquest/wechat-miniprogram/index.d.ts +2 -0
  145. package/lib/request/uniRquest/wechat-miniprogram/index.js +47 -0
  146. package/lib/request/uniRquest/weex/index.d.ts +14 -0
  147. package/lib/request/uniRquest/weex/index.js +65 -0
  148. package/lib/storage/StorageUtil.d.ts +19 -0
  149. package/lib/storage/StorageUtil.js +85 -0
  150. package/lib/string/StringUtil.d.ts +392 -0
  151. package/lib/string/StringUtil.js +566 -0
  152. package/lib/system/SystemUtil.d.ts +46 -0
  153. package/lib/system/SystemUtil.js +132 -0
  154. package/lib/transfer/MapTransferUtil.d.ts +54 -0
  155. package/lib/transfer/MapTransferUtil.js +165 -0
  156. package/lib/transfer/TransferUtil.d.ts +98 -0
  157. package/lib/transfer/TransferUtil.js +333 -0
  158. package/lib/types.d.ts +25 -0
  159. package/lib/types.js +5 -0
  160. package/lib/url/UrlUtil.d.ts +30 -0
  161. package/lib/url/UrlUtil.js +95 -0
  162. package/package.json +56 -0
@@ -0,0 +1,57 @@
1
+ import { WATERMARK_SETTINGS } from '../common';
2
+ /**
3
+ * 浏览器工具
4
+ * @description
5
+ * @author nanshen
6
+ * @creat 2021-09-15 10:30:30
7
+ */
8
+ export type BrowserType = 'Opera' | 'IE' | 'Edge' | 'Firefox' | 'Safari' | 'Chrome' | 'OverIE10' | '';
9
+ declare namespace BrowserUtil {
10
+ /**
11
+ * 获取浏览器id
12
+ */
13
+ const getId: () => Promise<any>;
14
+ /**
15
+ * 获取浏览器类型
16
+ * @returns Opera | IE | Edge | Firefox | Safari | Chrome | OverIE10 | ""
17
+ */
18
+ const browserGetType: () => BrowserType;
19
+ /**
20
+ * 判断是否是移动端浏览器
21
+ * @returns boolean
22
+ */
23
+ const isMobileBrowser: () => boolean;
24
+ /**
25
+ * 判断是否微信内置浏览器
26
+ * @returns boolean
27
+ */
28
+ const isWeixinBrowser: () => any;
29
+ /**
30
+ * 判断是否微信小程序WebView
31
+ * @returns boolean
32
+ */
33
+ const isWeixinMiniWebView: () => boolean;
34
+ /**
35
+ * 判断是否是支付宝浏览器
36
+ * @returns boolean
37
+ */
38
+ const isAlipayBrowser: () => any;
39
+ /**
40
+ * 判断是否是支付宝小程序webview
41
+ * @returns boolean
42
+ */
43
+ const isAlipayMiniWebView: () => any;
44
+ /**
45
+ * 判断是否是浙里办
46
+ * @returns boolean
47
+ */
48
+ const isMgopBrowser: () => any;
49
+ /** 全屏 */
50
+ function fullScreen(root: string | HTMLElement, callback?: (isFull: boolean) => void): void;
51
+ /** 是否全屏 */
52
+ function isFullScreen(): any;
53
+ /** 水印 */
54
+ function waterMark(defaultSettings: typeof WATERMARK_SETTINGS): void;
55
+ function removeMark(): void;
56
+ }
57
+ export default BrowserUtil;
@@ -0,0 +1,347 @@
1
+ "use strict";
2
+
3
+ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
4
+ function adopt(value) {
5
+ return value instanceof P ? value : new P(function (resolve) {
6
+ resolve(value);
7
+ });
8
+ }
9
+ return new (P || (P = Promise))(function (resolve, reject) {
10
+ function fulfilled(value) {
11
+ try {
12
+ step(generator.next(value));
13
+ } catch (e) {
14
+ reject(e);
15
+ }
16
+ }
17
+ function rejected(value) {
18
+ try {
19
+ step(generator["throw"](value));
20
+ } catch (e) {
21
+ reject(e);
22
+ }
23
+ }
24
+ function step(result) {
25
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
26
+ }
27
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
28
+ });
29
+ };
30
+ var __generator = this && this.__generator || function (thisArg, body) {
31
+ var _ = {
32
+ label: 0,
33
+ sent: function sent() {
34
+ if (t[0] & 1) throw t[1];
35
+ return t[1];
36
+ },
37
+ trys: [],
38
+ ops: []
39
+ },
40
+ f,
41
+ y,
42
+ t,
43
+ g;
44
+ return g = {
45
+ next: verb(0),
46
+ "throw": verb(1),
47
+ "return": verb(2)
48
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
49
+ return this;
50
+ }), g;
51
+ function verb(n) {
52
+ return function (v) {
53
+ return step([n, v]);
54
+ };
55
+ }
56
+ function step(op) {
57
+ if (f) throw new TypeError("Generator is already executing.");
58
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
59
+ 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;
60
+ if (y = 0, t) op = [op[0] & 2, t.value];
61
+ switch (op[0]) {
62
+ case 0:
63
+ case 1:
64
+ t = op;
65
+ break;
66
+ case 4:
67
+ _.label++;
68
+ return {
69
+ value: op[1],
70
+ done: false
71
+ };
72
+ case 5:
73
+ _.label++;
74
+ y = op[1];
75
+ op = [0];
76
+ continue;
77
+ case 7:
78
+ op = _.ops.pop();
79
+ _.trys.pop();
80
+ continue;
81
+ default:
82
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
83
+ _ = 0;
84
+ continue;
85
+ }
86
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
87
+ _.label = op[1];
88
+ break;
89
+ }
90
+ if (op[0] === 6 && _.label < t[1]) {
91
+ _.label = t[1];
92
+ t = op;
93
+ break;
94
+ }
95
+ if (t && _.label < t[2]) {
96
+ _.label = t[2];
97
+ _.ops.push(op);
98
+ break;
99
+ }
100
+ if (t[2]) _.ops.pop();
101
+ _.trys.pop();
102
+ continue;
103
+ }
104
+ op = body.call(thisArg, _);
105
+ } catch (e) {
106
+ op = [6, e];
107
+ y = 0;
108
+ } finally {
109
+ f = t = 0;
110
+ }
111
+ if (op[0] & 5) throw op[1];
112
+ return {
113
+ value: op[0] ? op[1] : void 0,
114
+ done: true
115
+ };
116
+ }
117
+ };
118
+ var __importDefault = this && this.__importDefault || function (mod) {
119
+ return mod && mod.__esModule ? mod : {
120
+ "default": mod
121
+ };
122
+ };
123
+ Object.defineProperty(exports, "__esModule", {
124
+ value: true
125
+ });
126
+ var BaseUtil_1 = __importDefault(require("../base/BaseUtil"));
127
+ var env_1 = __importDefault(require("../env/env"));
128
+ var fingerprint_1 = __importDefault(require("./fingerprint"));
129
+ var userAgent = env_1.default.getGlobal().navigator.userAgent;
130
+ var isInUserAgent = function isInUserAgent(v) {
131
+ return userAgent === null || userAgent === void 0 ? void 0 : userAgent.toLowerCase().includes(v);
132
+ };
133
+ var BrowserUtil;
134
+ (function (BrowserUtil) {
135
+ var _this = this;
136
+ /**
137
+ * 获取浏览器id
138
+ */
139
+ BrowserUtil.getId = function () {
140
+ return __awaiter(_this, void 0, void 0, function () {
141
+ var visitorId;
142
+ return __generator(this, function (_a) {
143
+ switch (_a.label) {
144
+ case 0:
145
+ return [4 /*yield*/, fingerprint_1.default.load()];
146
+ case 1:
147
+ return [4 /*yield*/, _a.sent().get()];
148
+ case 2:
149
+ visitorId = _a.sent().visitorId;
150
+ return [2 /*return*/, visitorId];
151
+ }
152
+ });
153
+ });
154
+ };
155
+ /**
156
+ * 获取浏览器类型
157
+ * @returns Opera | IE | Edge | Firefox | Safari | Chrome | OverIE10 | ""
158
+ */
159
+ BrowserUtil.browserGetType = function () {
160
+ if (userAgent.indexOf('Opera') > -1 || userAgent.indexOf('OPR') > -1) {
161
+ return 'Opera';
162
+ } else if (userAgent.indexOf('compatible') > -1 && userAgent.indexOf('MSIE') > -1) {
163
+ return 'IE';
164
+ } else if (userAgent.indexOf('Edge') > -1) {
165
+ return 'Edge';
166
+ } else if (userAgent.indexOf('Firefox') > -1) {
167
+ return 'Firefox';
168
+ } else if (userAgent.indexOf('Safari') > -1 && userAgent.indexOf('Chrome') === -1) {
169
+ return 'Safari';
170
+ } else if (userAgent.indexOf('Chrome') > -1 && userAgent.indexOf('Safari') > -1) {
171
+ return 'Chrome';
172
+ } else if (!!window.window.ActiveXObject || 'ActiveXObject' in window) {
173
+ return 'OverIE10';
174
+ }
175
+ return '';
176
+ };
177
+ /**
178
+ * 判断是否是移动端浏览器
179
+ * @returns boolean
180
+ */
181
+ BrowserUtil.isMobileBrowser = function () {
182
+ 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);
183
+ };
184
+ /**
185
+ * 判断是否微信内置浏览器
186
+ * @returns boolean
187
+ */
188
+ BrowserUtil.isWeixinBrowser = function () {
189
+ return isInUserAgent('micromessenger');
190
+ };
191
+ /**
192
+ * 判断是否微信小程序WebView
193
+ * @returns boolean
194
+ */
195
+ BrowserUtil.isWeixinMiniWebView = function () {
196
+ return (window === null || window === void 0 ? void 0 : window.__wxjs_environment) === 'miniprogram';
197
+ };
198
+ /**
199
+ * 判断是否是支付宝浏览器
200
+ * @returns boolean
201
+ */
202
+ BrowserUtil.isAlipayBrowser = function () {
203
+ return isInUserAgent('alipayclient');
204
+ };
205
+ /**
206
+ * 判断是否是支付宝小程序webview
207
+ * @returns boolean
208
+ */
209
+ BrowserUtil.isAlipayMiniWebView = function () {
210
+ return isInUserAgent('miniprogram') || isInUserAgent('alipay');
211
+ };
212
+ /**
213
+ * 判断是否是浙里办
214
+ * @returns boolean
215
+ */
216
+ BrowserUtil.isMgopBrowser = function () {
217
+ return isInUserAgent('dtdreamweb');
218
+ };
219
+ /** 全屏 */
220
+ function fullScreen(root, callback) {
221
+ var doc = document;
222
+ var docElm = BaseUtil_1.default.isString(root) ? document.getElementById(root) : root;
223
+ var isFull = isFullScreen();
224
+ try {
225
+ if (isFull) {
226
+ // W3C
227
+ if (document.exitFullscreen) {
228
+ document.exitFullscreen();
229
+ } else if (doc.mozCancelFullScreen) {
230
+ // FireFox
231
+ doc.mozCancelFullScreen();
232
+ } else if (doc.webkitCancelFullScreen) {
233
+ // Chrome等
234
+ doc.webkitCancelFullScreen();
235
+ } else if (doc.msExitFullscreen) {
236
+ // IE11
237
+ doc.msExitFullscreen();
238
+ }
239
+ callback === null || callback === void 0 ? void 0 : callback(isFull);
240
+ } else {
241
+ // W3C
242
+ if (!docElm) {
243
+ return;
244
+ }
245
+ if (docElm.requestFullscreen) {
246
+ docElm.requestFullscreen();
247
+ } else if (docElm.mozRequestFullScreen) {
248
+ // FireFox
249
+ docElm.mozRequestFullScreen();
250
+ } else if (docElm.webkitRequestFullScreen) {
251
+ // Chrome等
252
+ docElm.webkitRequestFullScreen();
253
+ } else if (docElm.msRequestFullscreen) {
254
+ // IE11
255
+ docElm.msRequestFullscreen();
256
+ }
257
+ callback === null || callback === void 0 ? void 0 : callback(isFull);
258
+ }
259
+ } catch (error) {
260
+ console.error('浏览器不支持');
261
+ }
262
+ }
263
+ BrowserUtil.fullScreen = fullScreen;
264
+ /** 是否全屏 */
265
+ function isFullScreen() {
266
+ return window.fullScreen || document.webkitIsFullScreen || document.msFullscreenEnabled;
267
+ }
268
+ BrowserUtil.isFullScreen = isFullScreen;
269
+ /** 水印 */
270
+ function waterMark(defaultSettings) {
271
+ if (arguments.length === 1 && typeof arguments[0] === 'object') {
272
+ var src = arguments[0] || {};
273
+ for (var key in src) {
274
+ if (src[key] && defaultSettings[key] && src[key] === defaultSettings[key]) continue;else if (src[key]) defaultSettings[key] = src[key];
275
+ }
276
+ }
277
+ var oTemp = document.createDocumentFragment();
278
+ var maskDiv = document.createElement('div');
279
+ maskDiv.id = 'mask_div';
280
+ oTemp.appendChild(maskDiv);
281
+ // 获取页面最大宽度
282
+ var pagewidth = Math.max(document.body.scrollWidth, document.body.clientWidth);
283
+ var cutWidth = pagewidth * 0.015;
284
+ var pageWidth = pagewidth - cutWidth;
285
+ // 获取页面最大高度
286
+ var pageHeight = Math.max(document.body.scrollHeight, document.body.clientHeight);
287
+ pageHeight = Math.max(pageHeight, window.innerHeight - 30);
288
+ // 如果将水印列数设置为0,或水印列数设置过大,超过页面最大宽度,则重新计算水印列数和水印x轴间隔
289
+ if (defaultSettings.watermark_cols === 0 || Number(defaultSettings.watermark_x + defaultSettings.watermark_width * defaultSettings.watermark_cols + defaultSettings.watermark_x_space * (defaultSettings.watermark_cols - 1)) > pageWidth) {
290
+ defaultSettings.watermark_cols = Number((pageWidth - defaultSettings.watermark_x + defaultSettings.watermark_x_space) / (defaultSettings.watermark_width + defaultSettings.watermark_x_space));
291
+ defaultSettings.watermark_x_space = Number((pageWidth - defaultSettings.watermark_x - defaultSettings.watermark_width * defaultSettings.watermark_cols) / (defaultSettings.watermark_cols - 1));
292
+ }
293
+ // 如果将水印行数设置为0,或水印行数设置过大,超过页面最大长度,则重新计算水印行数和水印y轴间隔
294
+ if (defaultSettings.watermark_rows === 0 || Number(defaultSettings.watermark_y + defaultSettings.watermark_height * defaultSettings.watermark_rows + defaultSettings.watermark_y_space * (defaultSettings.watermark_rows - 1)) > pageHeight) {
295
+ defaultSettings.watermark_rows = Number((defaultSettings.watermark_y_space + pageHeight - defaultSettings.watermark_y) / (defaultSettings.watermark_height + defaultSettings.watermark_y_space));
296
+ defaultSettings.watermark_y_space = Number((pageHeight - defaultSettings.watermark_y - defaultSettings.watermark_height * defaultSettings.watermark_rows) / (defaultSettings.watermark_rows - 1));
297
+ }
298
+ var x;
299
+ var y;
300
+ for (var i = 0; i < defaultSettings.watermark_rows; i += 1) {
301
+ y = defaultSettings.watermark_y + (defaultSettings.watermark_y_space + defaultSettings.watermark_height) * i - 220;
302
+ for (var j = 0; j < defaultSettings.watermark_cols; j += 1) {
303
+ x = defaultSettings.watermark_x + (defaultSettings.watermark_width + defaultSettings.watermark_x_space) * j - 220;
304
+ var maskdiv = document.createElement('div');
305
+ maskdiv.id = "mask_div".concat(i).concat(j);
306
+ maskdiv.className = 'mask_div';
307
+ maskdiv.appendChild(document.createTextNode(defaultSettings.watermark_txt));
308
+ // 设置水印div倾斜显示
309
+ maskdiv.style.webkitTransform = "rotate(-".concat(defaultSettings.watermark_angle, "deg)");
310
+ maskdiv.style.MozTransform = "rotate(-".concat(defaultSettings.watermark_angle, "deg)");
311
+ maskdiv.style.msTransform = "rotate(-".concat(defaultSettings.watermark_angle, "deg)");
312
+ maskdiv.style.OTransform = "rotate(-".concat(defaultSettings.watermark_angle, "deg)");
313
+ maskdiv.style.transform = "rotate(-".concat(defaultSettings.watermark_angle, "deg)");
314
+ maskdiv.style.visibility = '';
315
+ maskdiv.style.position = 'absolute';
316
+ maskdiv.style.left = "".concat(x, "px");
317
+ maskdiv.style.top = "".concat(y, "px");
318
+ maskdiv.style.overflow = 'hidden';
319
+ maskdiv.style.zIndex = '9999';
320
+ // 让水印不遮挡页面的点击事件
321
+ maskdiv.style.pointerEvents = 'none';
322
+ maskdiv.style.opacity = "".concat(defaultSettings.watermark_alpha);
323
+ maskdiv.style.fontSize = defaultSettings.watermark_fontsize;
324
+ maskdiv.style.fontFamily = defaultSettings.watermark_font;
325
+ maskdiv.style.color = defaultSettings.watermark_color;
326
+ maskdiv.style.textAlign = 'center';
327
+ maskdiv.style.width = "".concat(defaultSettings.watermark_width, "px");
328
+ maskdiv.style.height = "".concat(defaultSettings.watermark_height, "px");
329
+ maskdiv.style.display = 'block';
330
+ maskDiv.appendChild(maskdiv);
331
+ }
332
+ }
333
+ document.body.appendChild(oTemp);
334
+ }
335
+ BrowserUtil.waterMark = waterMark;
336
+ /* 移除水印 */
337
+ function removeMark() {
338
+ /* 移除水印 */
339
+ var watermarkElement = document.getElementById('mask_div');
340
+ if (watermarkElement) {
341
+ var parentElement = watermarkElement.parentNode;
342
+ parentElement.removeChild(watermarkElement);
343
+ }
344
+ }
345
+ BrowserUtil.removeMark = removeMark;
346
+ })(BrowserUtil || (BrowserUtil = {}));
347
+ exports.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 };