GlobalTools

挂载到window下一级属性集合-常用工具函数

当前为 2023-12-27 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name GlobalTools
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2.5
  5. // @description 挂载到window下一级属性集合-常用工具函数
  6. // @author Enjoy
  7. // @match *://*/*
  8. // @match file:///*
  9. // @homepage https://greasyfork.org/zh-CN/scripts/468302-%E5%B7%A5%E5%85%B7%E5%87%BD%E6%95%B0tls
  10. // @license MIT
  11. // @icon https://foruda.gitee.com/avatar/1698283059572409586/4867929_enjoy_li_1698283059.png!avatar200
  12. // @grant none
  13. // ==/UserScript==
  14.  
  15. /******/ (() => { // webpackBootstrap
  16. /******/ var __webpack_modules__ = ({
  17.  
  18. /***/ 61:
  19. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  20.  
  21. var _typeof = (__webpack_require__(698)["default"]);
  22. function _regeneratorRuntime() {
  23. "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
  24. module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
  25. return e;
  26. }, module.exports.__esModule = true, module.exports["default"] = module.exports;
  27. var t,
  28. e = {},
  29. r = Object.prototype,
  30. n = r.hasOwnProperty,
  31. o = Object.defineProperty || function (t, e, r) {
  32. t[e] = r.value;
  33. },
  34. i = "function" == typeof Symbol ? Symbol : {},
  35. a = i.iterator || "@@iterator",
  36. c = i.asyncIterator || "@@asyncIterator",
  37. u = i.toStringTag || "@@toStringTag";
  38. function define(t, e, r) {
  39. return Object.defineProperty(t, e, {
  40. value: r,
  41. enumerable: !0,
  42. configurable: !0,
  43. writable: !0
  44. }), t[e];
  45. }
  46. try {
  47. define({}, "");
  48. } catch (t) {
  49. define = function define(t, e, r) {
  50. return t[e] = r;
  51. };
  52. }
  53. function wrap(t, e, r, n) {
  54. var i = e && e.prototype instanceof Generator ? e : Generator,
  55. a = Object.create(i.prototype),
  56. c = new Context(n || []);
  57. return o(a, "_invoke", {
  58. value: makeInvokeMethod(t, r, c)
  59. }), a;
  60. }
  61. function tryCatch(t, e, r) {
  62. try {
  63. return {
  64. type: "normal",
  65. arg: t.call(e, r)
  66. };
  67. } catch (t) {
  68. return {
  69. type: "throw",
  70. arg: t
  71. };
  72. }
  73. }
  74. e.wrap = wrap;
  75. var h = "suspendedStart",
  76. l = "suspendedYield",
  77. f = "executing",
  78. s = "completed",
  79. y = {};
  80. function Generator() {}
  81. function GeneratorFunction() {}
  82. function GeneratorFunctionPrototype() {}
  83. var p = {};
  84. define(p, a, function () {
  85. return this;
  86. });
  87. var d = Object.getPrototypeOf,
  88. v = d && d(d(values([])));
  89. v && v !== r && n.call(v, a) && (p = v);
  90. var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
  91. function defineIteratorMethods(t) {
  92. ["next", "throw", "return"].forEach(function (e) {
  93. define(t, e, function (t) {
  94. return this._invoke(e, t);
  95. });
  96. });
  97. }
  98. function AsyncIterator(t, e) {
  99. function invoke(r, o, i, a) {
  100. var c = tryCatch(t[r], t, o);
  101. if ("throw" !== c.type) {
  102. var u = c.arg,
  103. h = u.value;
  104. return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
  105. invoke("next", t, i, a);
  106. }, function (t) {
  107. invoke("throw", t, i, a);
  108. }) : e.resolve(h).then(function (t) {
  109. u.value = t, i(u);
  110. }, function (t) {
  111. return invoke("throw", t, i, a);
  112. });
  113. }
  114. a(c.arg);
  115. }
  116. var r;
  117. o(this, "_invoke", {
  118. value: function value(t, n) {
  119. function callInvokeWithMethodAndArg() {
  120. return new e(function (e, r) {
  121. invoke(t, n, e, r);
  122. });
  123. }
  124. return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
  125. }
  126. });
  127. }
  128. function makeInvokeMethod(e, r, n) {
  129. var o = h;
  130. return function (i, a) {
  131. if (o === f) throw new Error("Generator is already running");
  132. if (o === s) {
  133. if ("throw" === i) throw a;
  134. return {
  135. value: t,
  136. done: !0
  137. };
  138. }
  139. for (n.method = i, n.arg = a;;) {
  140. var c = n.delegate;
  141. if (c) {
  142. var u = maybeInvokeDelegate(c, n);
  143. if (u) {
  144. if (u === y) continue;
  145. return u;
  146. }
  147. }
  148. if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
  149. if (o === h) throw o = s, n.arg;
  150. n.dispatchException(n.arg);
  151. } else "return" === n.method && n.abrupt("return", n.arg);
  152. o = f;
  153. var p = tryCatch(e, r, n);
  154. if ("normal" === p.type) {
  155. if (o = n.done ? s : l, p.arg === y) continue;
  156. return {
  157. value: p.arg,
  158. done: n.done
  159. };
  160. }
  161. "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
  162. }
  163. };
  164. }
  165. function maybeInvokeDelegate(e, r) {
  166. var n = r.method,
  167. o = e.iterator[n];
  168. if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
  169. var i = tryCatch(o, e.iterator, r.arg);
  170. if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
  171. var a = i.arg;
  172. return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
  173. }
  174. function pushTryEntry(t) {
  175. var e = {
  176. tryLoc: t[0]
  177. };
  178. 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
  179. }
  180. function resetTryEntry(t) {
  181. var e = t.completion || {};
  182. e.type = "normal", delete e.arg, t.completion = e;
  183. }
  184. function Context(t) {
  185. this.tryEntries = [{
  186. tryLoc: "root"
  187. }], t.forEach(pushTryEntry, this), this.reset(!0);
  188. }
  189. function values(e) {
  190. if (e || "" === e) {
  191. var r = e[a];
  192. if (r) return r.call(e);
  193. if ("function" == typeof e.next) return e;
  194. if (!isNaN(e.length)) {
  195. var o = -1,
  196. i = function next() {
  197. for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
  198. return next.value = t, next.done = !0, next;
  199. };
  200. return i.next = i;
  201. }
  202. }
  203. throw new TypeError(_typeof(e) + " is not iterable");
  204. }
  205. return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
  206. value: GeneratorFunctionPrototype,
  207. configurable: !0
  208. }), o(GeneratorFunctionPrototype, "constructor", {
  209. value: GeneratorFunction,
  210. configurable: !0
  211. }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
  212. var e = "function" == typeof t && t.constructor;
  213. return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
  214. }, e.mark = function (t) {
  215. return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
  216. }, e.awrap = function (t) {
  217. return {
  218. __await: t
  219. };
  220. }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
  221. return this;
  222. }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
  223. void 0 === i && (i = Promise);
  224. var a = new AsyncIterator(wrap(t, r, n, o), i);
  225. return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
  226. return t.done ? t.value : a.next();
  227. });
  228. }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
  229. return this;
  230. }), define(g, "toString", function () {
  231. return "[object Generator]";
  232. }), e.keys = function (t) {
  233. var e = Object(t),
  234. r = [];
  235. for (var n in e) r.push(n);
  236. return r.reverse(), function next() {
  237. for (; r.length;) {
  238. var t = r.pop();
  239. if (t in e) return next.value = t, next.done = !1, next;
  240. }
  241. return next.done = !0, next;
  242. };
  243. }, e.values = values, Context.prototype = {
  244. constructor: Context,
  245. reset: function reset(e) {
  246. if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
  247. },
  248. stop: function stop() {
  249. this.done = !0;
  250. var t = this.tryEntries[0].completion;
  251. if ("throw" === t.type) throw t.arg;
  252. return this.rval;
  253. },
  254. dispatchException: function dispatchException(e) {
  255. if (this.done) throw e;
  256. var r = this;
  257. function handle(n, o) {
  258. return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
  259. }
  260. for (var o = this.tryEntries.length - 1; o >= 0; --o) {
  261. var i = this.tryEntries[o],
  262. a = i.completion;
  263. if ("root" === i.tryLoc) return handle("end");
  264. if (i.tryLoc <= this.prev) {
  265. var c = n.call(i, "catchLoc"),
  266. u = n.call(i, "finallyLoc");
  267. if (c && u) {
  268. if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
  269. if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
  270. } else if (c) {
  271. if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
  272. } else {
  273. if (!u) throw new Error("try statement without catch or finally");
  274. if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
  275. }
  276. }
  277. }
  278. },
  279. abrupt: function abrupt(t, e) {
  280. for (var r = this.tryEntries.length - 1; r >= 0; --r) {
  281. var o = this.tryEntries[r];
  282. if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
  283. var i = o;
  284. break;
  285. }
  286. }
  287. i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
  288. var a = i ? i.completion : {};
  289. return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
  290. },
  291. complete: function complete(t, e) {
  292. if ("throw" === t.type) throw t.arg;
  293. return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
  294. },
  295. finish: function finish(t) {
  296. for (var e = this.tryEntries.length - 1; e >= 0; --e) {
  297. var r = this.tryEntries[e];
  298. if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
  299. }
  300. },
  301. "catch": function _catch(t) {
  302. for (var e = this.tryEntries.length - 1; e >= 0; --e) {
  303. var r = this.tryEntries[e];
  304. if (r.tryLoc === t) {
  305. var n = r.completion;
  306. if ("throw" === n.type) {
  307. var o = n.arg;
  308. resetTryEntry(r);
  309. }
  310. return o;
  311. }
  312. }
  313. throw new Error("illegal catch attempt");
  314. },
  315. delegateYield: function delegateYield(e, r, n) {
  316. return this.delegate = {
  317. iterator: values(e),
  318. resultName: r,
  319. nextLoc: n
  320. }, "next" === this.method && (this.arg = t), y;
  321. }
  322. }, e;
  323. }
  324. module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;
  325.  
  326. /***/ }),
  327.  
  328. /***/ 698:
  329. /***/ ((module) => {
  330.  
  331. function _typeof(o) {
  332. "@babel/helpers - typeof";
  333.  
  334. return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
  335. return typeof o;
  336. } : function (o) {
  337. return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
  338. }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(o);
  339. }
  340. module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
  341.  
  342. /***/ }),
  343.  
  344. /***/ 687:
  345. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  346.  
  347. // TODO(Babel 8): Remove this file.
  348.  
  349. var runtime = __webpack_require__(61)();
  350. module.exports = runtime;
  351.  
  352. // Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736=
  353. try {
  354. regeneratorRuntime = runtime;
  355. } catch (accidentalStrictMode) {
  356. if (typeof globalThis === "object") {
  357. globalThis.regeneratorRuntime = runtime;
  358. } else {
  359. Function("r", "regeneratorRuntime = r")(runtime);
  360. }
  361. }
  362.  
  363.  
  364. /***/ })
  365.  
  366. /******/ });
  367. /************************************************************************/
  368. /******/ // The module cache
  369. /******/ var __webpack_module_cache__ = {};
  370. /******/
  371. /******/ // The require function
  372. /******/ function __webpack_require__(moduleId) {
  373. /******/ // Check if module is in cache
  374. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  375. /******/ if (cachedModule !== undefined) {
  376. /******/ return cachedModule.exports;
  377. /******/ }
  378. /******/ // Create a new module (and put it into the cache)
  379. /******/ var module = __webpack_module_cache__[moduleId] = {
  380. /******/ // no module.id needed
  381. /******/ // no module.loaded needed
  382. /******/ exports: {}
  383. /******/ };
  384. /******/
  385. /******/ // Execute the module function
  386. /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
  387. /******/
  388. /******/ // Return the exports of the module
  389. /******/ return module.exports;
  390. /******/ }
  391. /******/
  392. /************************************************************************/
  393. /******/ /* webpack/runtime/compat get default export */
  394. /******/ (() => {
  395. /******/ // getDefaultExport function for compatibility with non-harmony modules
  396. /******/ __webpack_require__.n = (module) => {
  397. /******/ var getter = module && module.__esModule ?
  398. /******/ () => (module['default']) :
  399. /******/ () => (module);
  400. /******/ __webpack_require__.d(getter, { a: getter });
  401. /******/ return getter;
  402. /******/ };
  403. /******/ })();
  404. /******/
  405. /******/ /* webpack/runtime/define property getters */
  406. /******/ (() => {
  407. /******/ // define getter functions for harmony exports
  408. /******/ __webpack_require__.d = (exports, definition) => {
  409. /******/ for(var key in definition) {
  410. /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  411. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  412. /******/ }
  413. /******/ }
  414. /******/ };
  415. /******/ })();
  416. /******/
  417. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  418. /******/ (() => {
  419. /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
  420. /******/ })();
  421. /******/
  422. /************************************************************************/
  423. var __webpack_exports__ = {};
  424. // This entry need to be wrapped in an IIFE because it need to be in strict mode.
  425. (() => {
  426. "use strict";
  427.  
  428. ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js
  429. function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
  430. try {
  431. var info = gen[key](arg);
  432. var value = info.value;
  433. } catch (error) {
  434. reject(error);
  435. return;
  436. }
  437. if (info.done) {
  438. resolve(value);
  439. } else {
  440. Promise.resolve(value).then(_next, _throw);
  441. }
  442. }
  443. function _asyncToGenerator(fn) {
  444. return function () {
  445. var self = this,
  446. args = arguments;
  447. return new Promise(function (resolve, reject) {
  448. var gen = fn.apply(self, args);
  449. function _next(value) {
  450. asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
  451. }
  452. function _throw(err) {
  453. asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
  454. }
  455. _next(undefined);
  456. });
  457. };
  458. }
  459. ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
  460. function typeof_typeof(o) {
  461. "@babel/helpers - typeof";
  462.  
  463. return typeof_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
  464. return typeof o;
  465. } : function (o) {
  466. return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
  467. }, typeof_typeof(o);
  468. }
  469. ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toPrimitive.js
  470.  
  471. function _toPrimitive(input, hint) {
  472. if (typeof_typeof(input) !== "object" || input === null) return input;
  473. var prim = input[Symbol.toPrimitive];
  474. if (prim !== undefined) {
  475. var res = prim.call(input, hint || "default");
  476. if (typeof_typeof(res) !== "object") return res;
  477. throw new TypeError("@@toPrimitive must return a primitive value.");
  478. }
  479. return (hint === "string" ? String : Number)(input);
  480. }
  481. ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
  482.  
  483.  
  484. function _toPropertyKey(arg) {
  485. var key = _toPrimitive(arg, "string");
  486. return typeof_typeof(key) === "symbol" ? key : String(key);
  487. }
  488. ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
  489.  
  490. function defineProperty_defineProperty(obj, key, value) {
  491. key = _toPropertyKey(key);
  492. if (key in obj) {
  493. Object.defineProperty(obj, key, {
  494. value: value,
  495. enumerable: true,
  496. configurable: true,
  497. writable: true
  498. });
  499. } else {
  500. obj[key] = value;
  501. }
  502. return obj;
  503. }
  504. ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
  505. function _arrayWithHoles(arr) {
  506. if (Array.isArray(arr)) return arr;
  507. }
  508. ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
  509. function _iterableToArrayLimit(r, l) {
  510. var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
  511. if (null != t) {
  512. var e,
  513. n,
  514. i,
  515. u,
  516. a = [],
  517. f = !0,
  518. o = !1;
  519. try {
  520. if (i = (t = t.call(r)).next, 0 === l) {
  521. if (Object(t) !== t) return;
  522. f = !1;
  523. } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
  524. } catch (r) {
  525. o = !0, n = r;
  526. } finally {
  527. try {
  528. if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
  529. } finally {
  530. if (o) throw n;
  531. }
  532. }
  533. return a;
  534. }
  535. }
  536. ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
  537. function _arrayLikeToArray(arr, len) {
  538. if (len == null || len > arr.length) len = arr.length;
  539. for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
  540. return arr2;
  541. }
  542. ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
  543.  
  544. function _unsupportedIterableToArray(o, minLen) {
  545. if (!o) return;
  546. if (typeof o === "string") return _arrayLikeToArray(o, minLen);
  547. var n = Object.prototype.toString.call(o).slice(8, -1);
  548. if (n === "Object" && o.constructor) n = o.constructor.name;
  549. if (n === "Map" || n === "Set") return Array.from(o);
  550. if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
  551. }
  552. ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
  553. function _nonIterableRest() {
  554. throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  555. }
  556. ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js
  557.  
  558.  
  559.  
  560.  
  561. function _slicedToArray(arr, i) {
  562. return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
  563. }
  564. ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
  565.  
  566. function _arrayWithoutHoles(arr) {
  567. if (Array.isArray(arr)) return _arrayLikeToArray(arr);
  568. }
  569. ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js
  570. function _iterableToArray(iter) {
  571. if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
  572. }
  573. ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
  574. function _nonIterableSpread() {
  575. throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  576. }
  577. ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
  578.  
  579.  
  580.  
  581.  
  582. function _toConsumableArray(arr) {
  583. return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
  584. }
  585. // EXTERNAL MODULE: ./node_modules/@babel/runtime/regenerator/index.js
  586. var regenerator = __webpack_require__(687);
  587. var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator);
  588. ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js
  589.  
  590. function _defineProperties(target, props) {
  591. for (var i = 0; i < props.length; i++) {
  592. var descriptor = props[i];
  593. descriptor.enumerable = descriptor.enumerable || false;
  594. descriptor.configurable = true;
  595. if ("value" in descriptor) descriptor.writable = true;
  596. Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
  597. }
  598. }
  599. function createClass_createClass(Constructor, protoProps, staticProps) {
  600. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  601. if (staticProps) _defineProperties(Constructor, staticProps);
  602. Object.defineProperty(Constructor, "prototype", {
  603. writable: false
  604. });
  605. return Constructor;
  606. }
  607. ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js
  608. function classCallCheck_classCallCheck(instance, Constructor) {
  609. if (!(instance instanceof Constructor)) {
  610. throw new TypeError("Cannot call a class as a function");
  611. }
  612. }
  613. ;// CONCATENATED MODULE: ./tools/GM.js
  614.  
  615.  
  616.  
  617.  
  618. function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
  619. function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { defineProperty_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
  620. /** @描述 函数文档 https://www.tampermonkey.net/documentation.php#api:GM_addElement */
  621.  
  622. /**
  623. * @description 创建element
  624. * @export
  625. * @param {*} tag
  626. * @param {*} [options={}]
  627. * @param {*} [win=window]
  628. * @returns {*}
  629. */
  630. function createElement(tag) {
  631. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  632. var win = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : window;
  633. if (!win.GM_createElement) {
  634. win.GM_createElement = GM_createElement;
  635. }
  636. return GM_createElement(tag, options);
  637. /**
  638. * @param {*} tag
  639. * @param {*} options {
  640. * idPrefix = `enjoy_${ENV_CRX}_${tag}`,
  641. * el = 'html',
  642. * autoInsert = true,
  643. * randomType = 'single',
  644. * id = '',
  645. * addPrefix = true,
  646. * insertType = tag === 'style' ? 'appendChild' : 'prepend',
  647. * }
  648. * @returns {*} dom
  649. */
  650. function GM_createElement(tag, options) {
  651. var _options$idPrefix = options.idPrefix,
  652. idPrefix = _options$idPrefix === void 0 ? "enjoy_".concat("GlobalTools", "_").concat(tag, "_") : _options$idPrefix,
  653. _options$el = options.el,
  654. el = _options$el === void 0 ? 'html' : _options$el,
  655. _options$autoInsert = options.autoInsert,
  656. autoInsert = _options$autoInsert === void 0 ? true : _options$autoInsert,
  657. _options$randomType = options.randomType,
  658. randomType = _options$randomType === void 0 ? 'single' : _options$randomType,
  659. _options$id = options.id,
  660. id = _options$id === void 0 ? '' : _options$id,
  661. _options$addPrefix = options.addPrefix,
  662. addPrefix = _options$addPrefix === void 0 ? true : _options$addPrefix,
  663. _options$insertType = options.insertType,
  664. insertType = _options$insertType === void 0 ? tag === 'style' ? 'appendChild' : 'prepend' : _options$insertType;
  665. if (addPrefix) {
  666. id = "".concat(idPrefix).concat(id);
  667. }
  668. if (randomType !== 'single') {
  669. id = "".concat(id, "_").concat(Math.floor(Math.random() * 1000));
  670. }
  671. options.id = id;
  672. var dom = document.querySelector("#".concat(id));
  673. if (!dom) {
  674. dom = document.createElement(tag);
  675. }
  676. for (var key in options) {
  677. if (Object.hasOwnProperty.call(options, key) && key !== 'el') {
  678. dom[key] = options[key];
  679. }
  680. }
  681. if (autoInsert) {
  682. if (typeof el === 'string') {
  683. el = document.querySelector(el);
  684. }
  685.  
  686. //insertType prepend | appendChild
  687. el[insertType](dom);
  688. }
  689. return dom;
  690. }
  691. }
  692.  
  693. /** @描述 是否匹配到目标url */
  694. function isMatched() {
  695. var urls = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  696. var currentUrl = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : location.href;
  697. if (typeof urls === 'string') {
  698. urls = [urls];
  699. }
  700. return !!urls.find(function (regUrl) {
  701. return new RegExp(regUrl).test(currentUrl);
  702. });
  703. }
  704. function prependMetaUF8() {
  705. return document.querySelector('meta[charset="UTF-8"]') || createElement('meta', {
  706. charset: 'utf-8'
  707. });
  708. }
  709.  
  710. /**
  711. * @description doCopy 复制文本到剪贴板
  712. * @export
  713. * @param {*} text
  714. */
  715. function doCopy(text) {
  716. var _navigator;
  717. if (document.hasFocus() && (_navigator = navigator) !== null && _navigator !== void 0 && (_navigator = _navigator.clipboard) !== null && _navigator !== void 0 && _navigator.writeText) {
  718. // 读取剪贴板
  719. // navigator.clipboard.readText().then((clipText) => {console.log('clipText=',clipText)})
  720.  
  721. // 写入剪贴板
  722. navigator.clipboard.writeText(text)["catch"](function (err) {
  723. return console.error("clipboard.writeText\uFF1A".concat(err));
  724. });
  725. return;
  726. }
  727. var textarea = document.createElement('textarea');
  728. textarea.value = text;
  729. textarea.select();
  730. document.execCommand('Copy');
  731. }
  732.  
  733. /**
  734. * 检测element元素的可见性,即 非display:none
  735. * @param {*} element
  736. * @returns {*} {Boolean}
  737. */
  738. function checkVisibility(element) {
  739. if (element.checkVisibility) {
  740. return element.checkVisibility();
  741. }
  742. return !!element.offsetParent;
  743. }
  744. /**
  745. * @description 创建element的提示
  746. * @export
  747. * @param {*} [options={}]
  748. * @returns {*}
  749. */
  750. function createElementTipFn() {
  751. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  752. var _options$setTimeoutSt = options.setTimeoutStep,
  753. setTimeoutStep = _options$setTimeoutSt === void 0 ? 1000 : _options$setTimeoutSt,
  754. _options$backgroundCo = options.backgroundColors,
  755. backgroundColors = _options$backgroundCo === void 0 ? {
  756. warn: 'rgb(181 156 51 / 60%)',
  757. success: 'rgb(3 113 3 / 60%)',
  758. error: 'rgb(165 2 2 / 60%)',
  759. info: 'rgb(67 62 62 / 60%)'
  760. } : _options$backgroundCo,
  761. _options$color = options.color,
  762. color = _options$color === void 0 ? '#ffffff' : _options$color,
  763. _options$opacity = options.opacity,
  764. opacity = _options$opacity === void 0 ? 1 : _options$opacity;
  765. var setTimeoutStamp = 0;
  766. return function createElementTip() {
  767. var configs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  768. var content = configs.content,
  769. e = configs.e,
  770. _configs$type = configs.type,
  771. type = _configs$type === void 0 ? 'info' : _configs$type,
  772. _configs$tagType = configs.tagType,
  773. tagType = _configs$tagType === void 0 ? 'span' : _configs$tagType;
  774. if (!content) return;
  775. console.log("content => %O ", content);
  776. clearTimeout(setTimeoutStamp);
  777. var contentDom = createElement(tagType, {
  778. id: 'createElementTip',
  779. innerText: content,
  780. style: "\n font-size:14px;\n font-weight:600;\n color:".concat(color, ";\n position: fixed;\n left: ").concat(numbericalInterval(e.clientX - 46), "px;\n top: ").concat(numbericalInterval(e.clientY - 30, [5, window.innerHeight - 35]), "px;\n background-color:").concat(backgroundColors[type], ";\n opacity: ").concat(opacity, ";\n border-radius: 4px;\n padding: 4px 8px;\n box-shadow:0 0 5px 0 rgb(255 255 255 / 60%) inset;\n pointer-event:none;\n z-index:").concat((Math.floor(Date.now() / 1000) + '').slice(-5), ";\n ")
  781. });
  782. setTimeoutStamp = setTimeout(function () {
  783. contentDom.remove();
  784. }, setTimeoutStep);
  785. };
  786. }
  787. /**
  788. * @description dom是否可编辑
  789. * @param {*} [dom=document.activeElement]
  790. * @returns {*} {boolean}
  791. */
  792.  
  793. function isContentEditableOfDOM() {
  794. var dom = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.activeElement;
  795. if (dom.tagName === 'INPUT' || dom.tagName === 'TEXTAREA') {
  796. return !dom.disabled;
  797. } else {
  798. return !!findParentElement(dom, function (dom) {
  799. return dom.contentEditable === 'true';
  800. }, null);
  801. }
  802. }
  803.  
  804. /**
  805. * @description 数字区间
  806. * @param {*} val
  807. * @param {*} [interval=[10, window.innerWidth]]
  808. * @returns {*}
  809. */
  810. function numbericalInterval(val) {
  811. var interval = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [5, window.innerWidth - 130];
  812. var indexStart = interval[0];
  813. var indexEnd = interval[1];
  814. if (val < indexStart) return indexStart;
  815. if (val > indexEnd) return indexEnd;
  816. return val;
  817. }
  818.  
  819. /**
  820. * @description 可滚动的dom
  821. * @param {*} dom
  822. * @returns {*}
  823. */
  824. function findHasScrollbarDom(dom) {
  825. if (!(dom instanceof HTMLElement)) {
  826. console.warn("\u53EF\u6EDA\u52A8\u7684dom\u51FD\u6570 findHasScrollbarDom:\u53C2\u6570dom\u5FC5\u987B\u4E3Aelement\u5143\u7D20 ");
  827. return void 0;
  828. }
  829. while (dom) {
  830. if (dom.offsetHeight < dom.scrollHeight && window.getComputedStyle(dom).overflowY !== 'visible') {
  831. break;
  832. }
  833. dom = dom.parentElement;
  834. }
  835. if (!dom || dom === document.body) {
  836. // 始终是 documentElement等同于window
  837. dom = document.documentElement;
  838. }
  839. console.warn("\u9875\u9762\u6EDA\u52A8\u5143\u7D20\u7684tagName: ", dom.tagName.toLocaleLowerCase());
  840. return dom;
  841. }
  842.  
  843. /**
  844. * @description 获取方法配置
  845. * @param {string} [key='']
  846. * @param {*} [defaultOpt={ includedUrls: [] }]
  847. * @returns {*} {Object}
  848. **/
  849. function getSettingFromLocalStorage() {
  850. var _localStorage, _localStorage2;
  851. var fileName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
  852. var defaultOpt = arguments.length > 1 ? arguments[1] : undefined;
  853. var mergedSettingOpt = _objectSpread({
  854. runType: '0',
  855. includedUrls: [],
  856. excludeUrls: []
  857. }, defaultOpt);
  858. var fullSettingKey = "enjoy_setting";
  859. var fullSettings = (_localStorage = localStorage) !== null && _localStorage !== void 0 && _localStorage[fullSettingKey] ? JSON.parse((_localStorage2 = localStorage) === null || _localStorage2 === void 0 ? void 0 : _localStorage2[fullSettingKey]) : {};
  860. var SETTING = _objectSpread(_objectSpread({}, mergedSettingOpt), fullSettings === null || fullSettings === void 0 ? void 0 : fullSettings[fileName]);
  861. fullSettings[fileName] = SETTING;
  862. fullSettings.runTypeDest = undefined;
  863. fullSettings.instructions = "\n\u4E00\u3001\u5339\u914D\u89C4\u5219\u4F18\u5148\u7EA7\uFF1Aruntype > * > excludedUrls > includedUrls\n\u4E8C\u3001runType\u662F\u9488\u5BF9\u5728\u5F53\u524D\u57DF\u540D\u89C4\u5219\uFF1A0(\u9ED8\u8BA4\u6267\u884C\u5339\u914D\u89C4\u5219)\uFF1B1(\u5F3A\u5236\u6267\u884C,\u5373\u8DF3\u8FC7\u5339\u914D\u89C4\u5219)\uFF1B2(\u4E0D\u6267\u884C)\n";
  864. localStorage[fullSettingKey] = JSON.stringify(fullSettings || {});
  865. return SETTING;
  866. }
  867.  
  868. /**
  869. * @description 是否执行该方法
  870. * @param {*} [settingOpt={}]
  871. * @returns {*} {Boolean}
  872. */
  873. function isExcutableBySetting() {
  874. var settingOpt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  875. var runType = settingOpt.runType,
  876. _settingOpt$excludeUr = settingOpt.excludeUrls,
  877. excludeUrls = _settingOpt$excludeUr === void 0 ? [] : _settingOpt$excludeUr,
  878. _settingOpt$includedU = settingOpt.includedUrls,
  879. includedUrls = _settingOpt$includedU === void 0 ? [] : _settingOpt$includedU;
  880. if (runType == '1') return true;
  881. if (runType == '2') return false;
  882. var HREF = location.href;
  883. if (excludeUrls !== null && excludeUrls !== void 0 && excludeUrls.length && isMatched(excludeUrls, HREF)) {
  884. return false;
  885. }
  886. if ((includedUrls === null || includedUrls === void 0 ? void 0 : includedUrls.length) === 0) return true;
  887. var findOne = isMatched(includedUrls, HREF);
  888. return !!findOne;
  889. }
  890.  
  891. /**
  892. * @description 是否不执行
  893. * @param {String} fileName
  894. * @param {Object} settingOpt
  895. * @returns {Boolean}
  896. */
  897. function codeIsNotExcutable(fileName, settingOpt) {
  898. // logSettingOptWithColor()
  899. var setting = getSettingFromLocalStorage(fileName, settingOpt);
  900. return _objectSpread({
  901. notExcutable: !isExcutableBySetting(setting)
  902. }, setting);
  903. }
  904.  
  905. /**
  906. * @description 彩色打印
  907. * @param {string} [key='enjoy_setting']
  908. */
  909. function logSettingOptWithColor(key) {
  910. var dataKey = 'is-log-of-enjoy';
  911. if (true) return;
  912. // if (document.body.getAttribute(dataKey)) return
  913. document.body.setAttribute(dataKey, '1');
  914.  
  915. // clearTimeout(window.EnjoyColorLogTimer || 0)
  916. window.EnjoyColorLogTimer = setTimeout(function () {
  917. var _key;
  918. (_key = key) !== null && _key !== void 0 ? _key : key = 'enjoy_setting';
  919. var SETTINGS = JSON.parse(localStorage[key] || '{}');
  920. console.log("%c\uD83D\uDC47 ".concat(key, " \u8BBE\u7F6E\u53C2\u6570\uFF1A"), 'background:#4e0ab780;color:#fff;', '\n', SETTINGS, "\n\nkeyNameList:", Object.keys(SETTINGS));
  921. console.log("%c\uD83D\uDC47\u81EA\u5B9A\u4E49\u914D\u7F6E\uFF0C\u4EE3\u7801\u5982\u4E0B\uFF1A", 'background:#4e0ab747;color:#fff;', "\n\u5F53\u524D\u57DF\u540D\u4E0B\u662F\u5426\u8FD0\u884C\u76F8\u5E94\u51FD\u6570,", "\n\u8BBE\u7F6ErunType(1\u3001\u5F3A\u5236\u8FD0\u884C\uFF1B2\u3001\u4E0D\u8FD0\u884C)\u3002", '\n\n', modifyRuntype.toString(), "\nmodifyRuntype('keyName',2)");
  922. }, 3 * 1000);
  923. }
  924. /**
  925. * @description 修改运行机制
  926. * @export
  927. * @param {string} keyName
  928. * @param {0|1|2} runType
  929. */
  930. function modifyRuntype(keyName, runType) {
  931. var keyOfSETTINGS = 'enjoy_setting';
  932. var SETTINGS = JSON.parse(localStorage[keyOfSETTINGS] || '{}');
  933. if (!SETTINGS[keyName]) return;
  934. SETTINGS[keyName].runType = runType || 2;
  935. localStorage[keyOfSETTINGS] = JSON.stringify(SETTINGS);
  936. }
  937.  
  938. /**
  939. * @description 查找特定条件的父级元素
  940. * @export
  941. * @param {Element} dom
  942. * @param {Function} callback
  943. * @param {Element} [defaultVal=document.documentElement]
  944. * @returns {Element}
  945. */
  946. function findParentElement(dom, callback) {
  947. var defaultVal = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : document.documentElement;
  948. if (!(dom instanceof HTMLElement)) {
  949. console.warn("\u67E5\u627E\u7279\u5B9A\u6761\u4EF6\u7684\u7236\u7EA7\u5143\u7D20\u51FD\u6570 findParentElement:\u53C2\u6570dom\u5FC5\u987B\u4E3Aelement\u5143\u7D20 ");
  950. return void 0;
  951. }
  952. while (dom) {
  953. if (callback(dom)) {
  954. break;
  955. }
  956. dom = dom.parentElement;
  957. }
  958. if (!dom || dom === document.body) {
  959. // 始终是 documentElement等同于window
  960. dom = defaultVal;
  961. }
  962. return dom;
  963. }
  964.  
  965. /** 原生横向滚动条 吸附 页面底部 */
  966. var StickyHorizontalNativeScrollBar = /*#__PURE__*/(/* unused pure expression or super */ null && (_createClass(function StickyHorizontalNativeScrollBar() {
  967. var _this = this;
  968. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  969. _classCallCheck(this, StickyHorizontalNativeScrollBar);
  970. /** 创建滚轴组件元素 */
  971. _defineProperty(this, "createScrollbar", function () {
  972. var style = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
  973. if (_this.scrollbar) return _this.scrollbar;
  974. var timer = Date.now();
  975. _this.thumbId = "thumb".concat(timer);
  976. _this.scrollbarId = "scrollbar".concat(timer);
  977. _this.scrollbar = document.createElement('div');
  978. _this.scrollbar.setAttribute('id', _this.scrollbarId);
  979. _this.scrollbar.innerHTML = "\n\t\t\t<style>\n\t\t\t\t#".concat(_this.scrollbarId, " {\n\t\t\t\t\tposition: sticky;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\tbox-shadow: 0 15px 0 0 #fff;\n\t\t\t\t\tbottom: 8px;\n\t\t\t\t\tleft: 0;\n\t\t\t\t\theight: 17px;\n\t\t\t\t\toverflow-x: auto;\n\t\t\t\t\toverflow-y: hidden;\n\t\t\t\t\tmargin-top: -17px;\n\t\t\t\t\tz-index: 3;\n\t\t\t\t\t").concat(style, "\n\t\t\t\t}\n\t\t\t</style>\n\t\t\t<div id=\"").concat(_this.thumbId, "\" style=\"height: 1px;\"></div>\n\t\t");
  980. });
  981. /** 把滚轴组件元素插入目标元素的后面 */
  982. _defineProperty(this, "insertScrollbar", function (el) {
  983. _this.target = el;
  984. if (typeof el === 'string') {
  985. _this.target = document.querySelector(el);
  986. }
  987. if (!_this.target) throw Error('el Dom do not exit');
  988. _this.targetParentElement = document.querySelector(el).parentElement;
  989. if (!_this.targetParentElement.querySelector("#".concat(_this.scrollbarId))) {
  990. _this.targetParentElement.insertBefore(_this.scrollbar, _this.target.nextSibling);
  991. }
  992. return _this.target;
  993. });
  994. /** 设置 滚轴组件元素尺寸 */
  995. _defineProperty(this, "setScrollbarSize", throttle(function () {
  996. _this.scrollbar.style.width = _this.target.clientWidth + 'px';
  997. _this.scrollbar.querySelector("#".concat(_this.thumbId)).style.width = _this.target.scrollWidth + 'px';
  998. }, 100));
  999. /** 监听目标元素和滚轴元素的scroll和页面resize事件 */
  1000. _defineProperty(this, "onEvent", function () {
  1001. _this.target.addEventListener('scroll', _this.onScrollTarget);
  1002. _this.scrollbar.addEventListener('scroll', _this.onScrollScrollbar);
  1003. window.addEventListener('resize', _this.setScrollbarSize);
  1004. });
  1005. /** 移除事件 */
  1006. _defineProperty(this, "removeEvent", function () {
  1007. _this.target.removeEventListener('scroll', _this.onScrollTarget);
  1008. _this.scrollbar.removeEventListener('scroll', _this.onScrollScrollbar);
  1009. window.removeEventListener('resize', _this.setScrollbarSize);
  1010. });
  1011. _defineProperty(this, "onScrollTarget", throttle(function (e) {
  1012. _this.scrollbar.scrollLeft = e.target.scrollLeft;
  1013. }, 100));
  1014. _defineProperty(this, "onScrollScrollbar", throttle(function (e) {
  1015. _this.target.scrollLeft = e.target.scrollLeft;
  1016. }, 100));
  1017. var _el = options.el,
  1018. _options$style = options.style,
  1019. _style = _options$style === void 0 ? '' : _options$style;
  1020. this.createScrollbar(_style);
  1021. this.insertScrollbar(_el);
  1022. this.setScrollbarSize();
  1023. this.onEvent();
  1024. })));
  1025.  
  1026. /** 插入横向滚动条 */
  1027. var HorizontalScrollBar = /*#__PURE__*/(/* unused pure expression or super */ null && (function () {
  1028. function HorizontalScrollBar() {
  1029. var _this2 = this;
  1030. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1031. _classCallCheck(this, HorizontalScrollBar);
  1032. /** 创建滚轴组件元素 */
  1033. _defineProperty(this, "createScrollbar", function (setStyle) {
  1034. if (_this2.scrollbar) return _this2.scrollbar;
  1035. var timer = Date.now();
  1036. _this2.scrollbarId = "scrollbar".concat(timer);
  1037. _this2.scrollbar = document.createElement('div');
  1038. _this2.scrollbar.setAttribute('data-part', 'scrollbar');
  1039. _this2.scrollbar.setAttribute('id', _this2.scrollbarId);
  1040. _this2.scrollbar.innerHTML = "\n\t\t".concat(setStyle(_this2.scrollbarId) || _this2.setDefaultStyle(_this2.scrollbarId), "\n\t\t<div data-part=\"thumb\"></div>\n\t\t");
  1041. });
  1042. /** 把滚轴组件元素插入目标元素的后面 */
  1043. _defineProperty(this, "insertScrollbar", function (el) {
  1044. _this2.target = el;
  1045. if (typeof el === 'string') {
  1046. _this2.target = document.querySelector(el);
  1047. }
  1048. if (!_this2.target) throw Error('el Dom do not exit');
  1049. _this2.targetParentElement = document.querySelector(el).parentElement;
  1050. if (!_this2.targetParentElement.querySelector("#".concat(_this2.scrollbarId))) {
  1051. _this2.targetParentElement.insertBefore(_this2.scrollbar, _this2.target.nextSibling);
  1052. }
  1053. return _this2.target;
  1054. });
  1055. /** 根据目标元素 设置 滚轴组件元素尺寸 */
  1056. _defineProperty(this, "setScrollbarSize", function () {
  1057. _this2.scrollbar.style.width = _this2.target.clientWidth + 'px';
  1058. _this2.thumb = _this2.scrollbar.querySelector('[data-part="thumb"]');
  1059. _this2.thumb.style.width = _this2.scrollbar.clientWidth * _this2.target.clientWidth / _this2.target.scrollWidth + 'px';
  1060. _this2.offsetMax = _this2.scrollbar.clientWidth - _this2.thumb.clientWidth;
  1061. _this2.rate = (_this2.target.scrollWidth - _this2.target.clientWidth) / _this2.offsetMax;
  1062. });
  1063. /** */
  1064. _defineProperty(this, "onMouseDownOfThumb", function (e) {
  1065. console.log("mousedown => %O ");
  1066. _this2.prePageX = e.pageX;
  1067. _this2.isMousedown = true;
  1068. });
  1069. /** */
  1070. _defineProperty(this, "onMouseUpOfWindow", function (e) {
  1071. _this2.isMousedown = false;
  1072. });
  1073. /** */
  1074. _defineProperty(this, "requestAnimationFrameCallback", function (offsetLeft) {
  1075. _this2.thumb.style.left = offsetLeft + 'px';
  1076. _this2.target.scrollLeft = offsetLeft * _this2.rate;
  1077. });
  1078. /** */
  1079. _defineProperty(this, "onMousemoveOfWindow", function (e) {
  1080. if (_this2.isMousedown) {
  1081. var offsetLeft = Number(_this2.thumb.style.left.replace('px', '')) + Number(e.pageX - _this2.prePageX);
  1082. offsetLeft = Math.max(0, offsetLeft);
  1083. offsetLeft = Math.min(offsetLeft, _this2.offsetMax);
  1084. _this2.requestAnimationFrameCallback(offsetLeft);
  1085. _this2.prePageX = e.pageX;
  1086. }
  1087. });
  1088. /** 监听目标元素和滚轴元素的scroll和页面resize事件 */
  1089. _defineProperty(this, "onEvent", function () {
  1090. _this2.thumb.addEventListener('mousedown', _this2.onMouseDownOfThumb);
  1091. window.addEventListener('mouseup', _this2.onMouseUpOfWindow);
  1092. window.addEventListener('mousemove', _this2.onMousemoveOfWindow);
  1093. window.addEventListener('resize', _this2.setScrollbarSize);
  1094. });
  1095. /** 移除事件 */
  1096. _defineProperty(this, "removeEvent", function () {
  1097. _this2.thumb.removeEventListener('mousedown', _this2.onMouseDownOfThumb);
  1098. window.removeEventListener('mouseup', _this2.onMouseUpOfWindow);
  1099. window.removeEventListener('mousemove', _this2.onMousemoveOfWindow);
  1100. window.removeEventListener('resize', _this2.setScrollbarSize);
  1101. });
  1102. var _el2 = options.el,
  1103. _options$setStyle = options.setStyle,
  1104. _setStyle = _options$setStyle === void 0 ? function () {
  1105. return null;
  1106. } : _options$setStyle;
  1107. this.createScrollbar(_setStyle);
  1108. this.insertScrollbar(_el2);
  1109. this.setScrollbarSize();
  1110. this.onEvent();
  1111. }
  1112. _createClass(HorizontalScrollBar, [{
  1113. key: "setDefaultStyle",
  1114. value: function setDefaultStyle(scrollbarId) {
  1115. return "\n\t\t<style>\n\t\t\t#".concat(scrollbarId, " {\n\t\t\t\theight: 17px;\n\t\t\t\tbackground-color: #f1f1f1;\n\t\t\t\tposition: relative;\n\t\t\t}\n\t\t\t#").concat(scrollbarId, ">[data-part=\"thumb\"] {\n\t\t\t\theight: 100%;\n\t\t\t\tbackground-color: #c1c1c1;\n\t\t\t\tposition: absolute;\n\t\t\t}\n\t\t\t#").concat(scrollbarId, ">[data-part=\"thumb\"]:active {\n\t\t\t\tbackground-color: #787878;\n\t\t\t}\n\t\t</style>\n\t");
  1116. }
  1117. }]);
  1118. return HorizontalScrollBar;
  1119. }()));
  1120.  
  1121. /** 持久化数据状态 */
  1122. var PersistentStorage = /*#__PURE__*/(/* unused pure expression or super */ null && (function () {
  1123. function PersistentStorage() {
  1124. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1125. _classCallCheck(this, PersistentStorage);
  1126. var _options$valKey = options.valKey,
  1127. valKey = _options$valKey === void 0 ? 'valKey' : _options$valKey,
  1128. _options$storageType = options.storageType,
  1129. storageType = _options$storageType === void 0 ? 'sessionStorage' : _options$storageType;
  1130. this.valKey = valKey;
  1131. this.storageType = storageType;
  1132. }
  1133. _createClass(PersistentStorage, [{
  1134. key: "write",
  1135. value: function write(val) {
  1136. val = _typeof(val) === 'object' ? JSON.stringify(val) : val;
  1137. val && window[this.storageType].setItem(this.valKey, val);
  1138. }
  1139. }, {
  1140. key: "read",
  1141. value: function read() {
  1142. var val = window[this.storageType].getItem(this.valKey);
  1143. return val ? JSON.parse(val) : val;
  1144. }
  1145. }, {
  1146. key: "remove",
  1147. value: function remove() {
  1148. window[this.storageType].removeItem(this.valKey);
  1149. }
  1150. }]);
  1151. return PersistentStorage;
  1152. }()));
  1153.  
  1154. /**
  1155. * @description 节流函数
  1156. * @export
  1157. * @param {Function} func
  1158. * @param {Number} [wait=100]
  1159. * @returns {Function}
  1160. */
  1161. function throttle(func) {
  1162. var wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100;
  1163. var isDoing = false;
  1164. return function () {
  1165. if (isDoing) return;
  1166. isDoing = true;
  1167. func.apply(void 0, arguments);
  1168. setTimeout(function () {
  1169. isDoing = false;
  1170. }, wait);
  1171. };
  1172. }
  1173.  
  1174. /**
  1175. * @description 防抖函数
  1176. * @export
  1177. * @param {Function} func
  1178. * @param {Number} [wait=100]
  1179. * @param {'end'|'front'} type
  1180. * @returns {Function}
  1181. */
  1182. function debounce(func) {
  1183. var wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100;
  1184. var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'end';
  1185. var timer = 0;
  1186. return function () {
  1187. clearTimeout(timer);
  1188. for (var _len = arguments.length, rest = new Array(_len), _key2 = 0; _key2 < _len; _key2++) {
  1189. rest[_key2] = arguments[_key2];
  1190. }
  1191. timer = setTimeout.apply(void 0, [func, wait].concat(rest));
  1192. };
  1193. }
  1194.  
  1195. /**
  1196. * @description 等候
  1197. * @export
  1198. * @param {number} [interval=17]
  1199. * @returns {Promise}
  1200. */
  1201. function awaitTime() {
  1202. var interval = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 17;
  1203. return new Promise(function (resolve) {
  1204. setTimeout(resolve, interval);
  1205. });
  1206. }
  1207.  
  1208. /**
  1209. * @description 打开已在窗口仅激活,不刷新
  1210. * @export
  1211. * @class OpenPlus
  1212. */
  1213. var OpenPlus = /*#__PURE__*/(/* unused pure expression or super */ null && (_createClass(function OpenPlus() {
  1214. var _this3 = this;
  1215. var opt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1216. _classCallCheck(this, OpenPlus);
  1217. _defineProperty(this, "openPre", function () {
  1218. var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {
  1219. return null;
  1220. };
  1221. for (var _len2 = arguments.length, rest = new Array(_len2 > 1 ? _len2 - 1 : 0), _key3 = 1; _key3 < _len2; _key3++) {
  1222. rest[_key3 - 1] = arguments[_key3];
  1223. }
  1224. var win = _this3.open.apply(_this3, rest);
  1225. callback === null || callback === void 0 || callback();
  1226. return win;
  1227. });
  1228. _defineProperty(this, "open", function (href) {
  1229. var willOpenTab = _this3.win.tabsCacheOfOpenPlus[href];
  1230. for (var _len3 = arguments.length, rest = new Array(_len3 > 1 ? _len3 - 1 : 0), _key4 = 1; _key4 < _len3; _key4++) {
  1231. rest[_key4 - 1] = arguments[_key4];
  1232. }
  1233. if (willOpenTab === undefined) {
  1234. var _this3$win;
  1235. willOpenTab = (_this3$win = _this3.win).open.apply(_this3$win, [href].concat(rest));
  1236. _this3.win.nextOfOpenPlus.forEach(function (item) {
  1237. return item === null || item === void 0 ? void 0 : item();
  1238. });
  1239. return _this3.win.tabsCacheOfOpenPlus[href] = willOpenTab;
  1240. } else if (willOpenTab.closed === true) {
  1241. var _this3$win2;
  1242. return (_this3$win2 = _this3.win).open.apply(_this3$win2, [href].concat(rest));
  1243. } else if (willOpenTab.closed === false) {
  1244. willOpenTab.focus();
  1245. return willOpenTab;
  1246. }
  1247. });
  1248. var _opt$win = opt.win,
  1249. _win = _opt$win === void 0 ? window : _opt$win,
  1250. _opt$next = opt.next,
  1251. next = _opt$next === void 0 ? function () {
  1252. return null;
  1253. } : _opt$next;
  1254. this.win = _win;
  1255. this.win.tabsCacheOfOpenPlus = this.win.tabsCacheOfOpenPlus || {};
  1256. this.win.nextOfOpenPlus = this.win.nextOfOpenPlus || [];
  1257. this.win.nextOfOpenPlus.push(next);
  1258. })));
  1259. function modifyStorage() {
  1260. var opt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1261. var _opt$storageName = opt.storageName,
  1262. storageName = _opt$storageName === void 0 ? 'localStorage' : _opt$storageName,
  1263. chainKeys = opt.chainKeys,
  1264. _opt$doType = opt.doType,
  1265. doType = _opt$doType === void 0 ? 'get' : _opt$doType,
  1266. val = opt.val,
  1267. _opt$prefix = opt.prefix,
  1268. prefix = _opt$prefix === void 0 ? 'enjoy_setting' : _opt$prefix;
  1269. if (prefix) {
  1270. chainKeys = "".concat(prefix, ".").concat(chainKeys);
  1271. }
  1272. chainKeys = chainKeys.split('.');
  1273. var keyOfLevel1 = chainKeys.shift();
  1274. var keyOfEnd = chainKeys.pop();
  1275. var isObject = true;
  1276. var storage = null;
  1277. try {
  1278. storage = JSON.parse(window[storageName][keyOfLevel1]);
  1279. } catch (error) {
  1280. isObject = false;
  1281. storage = window[storageName][keyOfLevel1];
  1282. console.error("".concat(storageName, " ").concat(chainKeys, " \u4E00\u7EA7\u5C5E\u6027\u503C\u4E3A\u57FA\u672C\u7C7B\u578B"));
  1283. return;
  1284. }
  1285. var obj = storage;
  1286. chainKeys.forEach(function (key) {
  1287. obj = obj[key];
  1288. });
  1289. if (doType === 'set') {
  1290. obj[keyOfEnd] = val;
  1291. window[storageName][keyOfLevel1] = JSON.stringify(storage);
  1292. } else {
  1293. return obj[keyOfEnd];
  1294. }
  1295. }
  1296.  
  1297. /**
  1298. * @description 简便的Storage SimpleStorage({ prefix: 'prefix' })
  1299. * @param {*} opt
  1300. */
  1301. function storagex(opt) {
  1302. var Storage = /*#__PURE__*/createClass_createClass(function Storage() {
  1303. var _this4 = this;
  1304. var opt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1305. classCallCheck_classCallCheck(this, Storage);
  1306. defineProperty_defineProperty(this, "storage", null);
  1307. defineProperty_defineProperty(this, "setItem", function (keys, val) {
  1308. _this4.formatChainKeys(keys);
  1309. _this4.getFirstLevelVal();
  1310. _this4.chainVal('set', val);
  1311. return void 0;
  1312. });
  1313. defineProperty_defineProperty(this, "getItem", function (keys) {
  1314. _this4.formatChainKeys(keys);
  1315. _this4.getFirstLevelVal();
  1316. return _this4.chainVal('get');
  1317. });
  1318. defineProperty_defineProperty(this, "removeItem", function (keys) {
  1319. _this4.formatChainKeys(keys);
  1320. _this4.getFirstLevelVal();
  1321. return _this4.chainVal('remove');
  1322. });
  1323. defineProperty_defineProperty(this, "clear", function () {
  1324. var keysWithPrefix = Object.keys(_this4.storage).filter(function (item) {
  1325. return item.startsWith(_this4.prefix);
  1326. });
  1327. keysWithPrefix.forEach(function (key) {
  1328. return _this4.storage.removeItem(key);
  1329. });
  1330. return void 0;
  1331. });
  1332. defineProperty_defineProperty(this, "getFirstLevelVal", function () {
  1333. var state = _this4.storage[_this4.prefix + _this4.startKey];
  1334. try {
  1335. state = JSON.parse(state);
  1336. } catch (error) {}
  1337. _this4.cache = state;
  1338. return state;
  1339. });
  1340. defineProperty_defineProperty(this, "formatChainKeys", function (keys) {
  1341. keys = keys.split('.');
  1342. _this4.startKey = keys.shift();
  1343. _this4.endKey = keys.pop();
  1344. _this4.middlekeys = keys;
  1345. return keys;
  1346. });
  1347. defineProperty_defineProperty(this, "chainVal", function (doType, val) {
  1348. var obj = _this4.cache;
  1349. _this4.middlekeys.forEach(function (key) {
  1350. obj = obj[key];
  1351. });
  1352. if (doType === 'set') {
  1353. if (_this4.endKey) {
  1354. obj[_this4.endKey] = val;
  1355. } else {
  1356. _this4.cache = val;
  1357. }
  1358. _this4.storage.setItem(_this4.prefix + _this4.startKey, _this4.isObject(_this4.cache) ? JSON.stringify(_this4.cache) : _this4.cache);
  1359. } else if (doType === 'get') {
  1360. if (_this4.endKey) {
  1361. return obj[_this4.endKey];
  1362. }
  1363. return _this4.cache;
  1364. } else if (doType === 'remove') {
  1365. if (_this4.endKey) {
  1366. var isDeleted = delete obj[_this4.endKey];
  1367. isDeleted && _this4.setItem(_this4.startKey, _this4.cache);
  1368. return isDeleted;
  1369. }
  1370. _this4.storage.removeItem(_this4.prefix + _this4.startKey);
  1371. }
  1372. });
  1373. defineProperty_defineProperty(this, "isObject", function (value) {
  1374. var type = typeof_typeof(value);
  1375. return value != null && (type === 'object' || type === 'function');
  1376. });
  1377. var prefix = opt.prefix,
  1378. storage = opt.storage;
  1379. this.prefix = prefix ? "".concat(prefix, "_") : '';
  1380. this.storage = storage;
  1381. });
  1382. if (opt.storage && sessionStorage.__proto__.setItemX) return opt.storage;
  1383. var storage = new Storage(opt);
  1384. if (opt.storage) return storage;
  1385. if (sessionStorage.__proto__.setItemX) return;
  1386. sessionStorage.__proto__.setItemX = function (key, val) {
  1387. storage.storage = this;
  1388. storage.setItem(key, val);
  1389. };
  1390. sessionStorage.__proto__.getItemX = function (key) {
  1391. storage.storage = this;
  1392. return storage.getItem(key);
  1393. };
  1394. sessionStorage.__proto__.removeItemX = function (key) {
  1395. storage.storage = this;
  1396. return storage.removeItem(key);
  1397. };
  1398. sessionStorage.__proto__.clearX = function () {
  1399. storage.storage = this;
  1400. return storage.clear();
  1401. };
  1402. }
  1403.  
  1404. /**
  1405. * @description 处理标记内容
  1406. * @param {*} opt
  1407. * @returns {*}
  1408. */
  1409. function operateComment(opt) {
  1410. var _opt$text = opt.text,
  1411. text = _opt$text === void 0 ? '' : _opt$text,
  1412. _opt$S = opt.S,
  1413. S = _opt$S === void 0 ? '/*' : _opt$S,
  1414. _opt$E = opt.E,
  1415. E = _opt$E === void 0 ? '*/' : _opt$E,
  1416. _opt$modify = opt.modify,
  1417. modify = _opt$modify === void 0 ? function (val) {
  1418. return val;
  1419. } : _opt$modify;
  1420. var stack = [];
  1421. var index = text.indexOf(S);
  1422. if (index === -1) return text;
  1423. while (index <= text.length - 1) {
  1424. if (text[index] + text[index + 1] == S) {
  1425. stack.push(index);
  1426. } else if (text[index] + text[index + 1] == E) {
  1427. var latestIndex = stack.pop();
  1428. if (latestIndex !== undefined) {
  1429. var middle = modify(text.slice(latestIndex + S.length, index));
  1430. text = text.slice(0, latestIndex) + middle + text.slice(index + S.length);
  1431. index = latestIndex + middle.length;
  1432. }
  1433. }
  1434. index++;
  1435. }
  1436. return text;
  1437. }
  1438. ;// CONCATENATED MODULE: ./src/tool/vimport.js
  1439.  
  1440.  
  1441.  
  1442. function run() {
  1443. return _run.apply(this, arguments);
  1444. }
  1445.  
  1446. /**
  1447. * @description
  1448. * @export
  1449. * @param {'dayjs@1.11.9'|dayjs} moduleAndVersion
  1450. */
  1451. function _run() {
  1452. _run = _asyncToGenerator( /*#__PURE__*/regenerator_default().mark(function _callee() {
  1453. var setting;
  1454. return regenerator_default().wrap(function _callee$(_context) {
  1455. while (1) switch (_context.prev = _context.next) {
  1456. case 0:
  1457. setting = codeIsNotExcutable('vimport', {
  1458. name: '快捷导入js模块cdn版本包',
  1459. feature: '快捷导入js模块cdn版本包',
  1460. importQueue: [],
  1461. // 单击时,按网站设计的方式跳转 ['dayjs','vue']
  1462. usage: "importQueue= ['dayjs','vue'],会一次导入dayjs,vue"
  1463. });
  1464. if (!setting.notExcutable) {
  1465. _context.next = 3;
  1466. break;
  1467. }
  1468. return _context.abrupt("return");
  1469. case 3:
  1470. window.vimport = bootcdn;
  1471. autoImport(setting.importQueue);
  1472. case 5:
  1473. case "end":
  1474. return _context.stop();
  1475. }
  1476. }, _callee);
  1477. }));
  1478. return _run.apply(this, arguments);
  1479. }
  1480. function bootcdn(_x) {
  1481. return _bootcdn.apply(this, arguments);
  1482. }
  1483. function _bootcdn() {
  1484. _bootcdn = _asyncToGenerator( /*#__PURE__*/regenerator_default().mark(function _callee2(moduleAndVersion) {
  1485. var setting, serializerOfDocument;
  1486. return regenerator_default().wrap(function _callee2$(_context2) {
  1487. while (1) switch (_context2.prev = _context2.next) {
  1488. case 0:
  1489. if (moduleAndVersion) {
  1490. _context2.next = 2;
  1491. break;
  1492. }
  1493. return _context2.abrupt("return");
  1494. case 2:
  1495. collectQueue(moduleAndVersion);
  1496. setting = formatParams(moduleAndVersion);
  1497. console.log("setting => %O ", setting);
  1498. _context2.next = 7;
  1499. return fetch("https://unpkg.com/".concat(moduleAndVersion), {
  1500. method: 'GET'
  1501. });
  1502. case 7:
  1503. _context2.next = 9;
  1504. return _context2.sent.text();
  1505. case 9:
  1506. serializerOfDocument = _context2.sent;
  1507. if (serializerOfDocument) {
  1508. _context2.next = 12;
  1509. break;
  1510. }
  1511. return _context2.abrupt("return", console.warn('${moduleAndVersion} 引入失败,未找到相应版'));
  1512. case 12:
  1513. console.warn('${moduleAndVersion} 引入成功');
  1514. console.warn('引入地址:https://unpkg.com/${moduleAndVersion}');
  1515. console.warn('请用window.${setting.rename}访问');
  1516. createElement('script', {
  1517. randomType: 'new',
  1518. el: 'body',
  1519. src: "https://unpkg.com/".concat(moduleAndVersion)
  1520. });
  1521. case 16:
  1522. case "end":
  1523. return _context2.stop();
  1524. }
  1525. }, _callee2);
  1526. }));
  1527. return _bootcdn.apply(this, arguments);
  1528. }
  1529. function formatParams(moduleAndVersion) {
  1530. moduleAndVersion = moduleAndVersion.split('@');
  1531. return {
  1532. name: moduleAndVersion[0],
  1533. version: moduleAndVersion[1] || '',
  1534. url: moduleAndVersion.join('/') + '/',
  1535. rename: moduleAndVersion[0] + (moduleAndVersion[1] || '').replace(/\./g, '_')
  1536. };
  1537. }
  1538.  
  1539. // 栈 stack 队列 queue
  1540. function collectQueue(moduleAndVersion) {
  1541. var importQueue = JSON.parse(sessionStorage.importcdn || '[]');
  1542. var importQueueSet = new Set(importQueue);
  1543. console.log("moduleAndVersion => %O ", moduleAndVersion);
  1544. importQueueSet.add(moduleAndVersion);
  1545. importQueue = Array.from(importQueueSet);
  1546. console.log("importQueue => %O ", importQueue);
  1547. sessionStorage.importQueue = JSON.stringify(importQueue);
  1548. }
  1549. function autoImport(importQueue) {
  1550. var importQueueSet = new Set(importQueue);
  1551. importQueue = Array.from(importQueueSet);
  1552. importQueue.forEach(function (moduleName) {
  1553. window.importcdn(moduleName);
  1554. });
  1555. console.warn('当前tab页,一次导入包', importQueue);
  1556. }
  1557. ;// CONCATENATED MODULE: ./src/GlobalTools.js
  1558.  
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564. function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = GlobalTools_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  1565. function GlobalTools_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return GlobalTools_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return GlobalTools_arrayLikeToArray(o, minLen); }
  1566. function GlobalTools_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
  1567. function GlobalTools_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
  1568. function GlobalTools_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? GlobalTools_ownKeys(Object(t), !0).forEach(function (r) { defineProperty_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : GlobalTools_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
  1569.  
  1570.  
  1571. run();
  1572. storagex();
  1573. GlobalTools_run(window);
  1574. function GlobalTools_run(win) {
  1575. getLogObjectValue(['$0', 'temp1']);
  1576. windowProxy();
  1577. var tools = {
  1578. backPrototype: backPrototype,
  1579. createPlainFile: createPlainFile,
  1580. getRegMobile: getRegMobile,
  1581. phoneFormat: phoneFormat,
  1582. getRegName: getRegName,
  1583. getRegEmail: getRegEmail,
  1584. getRegIDCard: getRegIDCard,
  1585. getQuery: getQuery,
  1586. toSearch: toSearch,
  1587. transformThousandth: transformThousandth,
  1588. deleteProperty: deleteProperty,
  1589. asyncRequire: asyncRequire,
  1590. transformData: transformData,
  1591. previewFile: previewFile,
  1592. dateUtil: dateUtil,
  1593. toWithOpener: toWithOpener,
  1594. downloadFile: downloadFile,
  1595. base64ToBlob: base64ToBlob,
  1596. base64ImgtoFile: base64ImgtoFile,
  1597. isHasBtnPower: isHasBtnPower,
  1598. getBrowerEnv: getBrowerEnv,
  1599. formatReportDataToStr: formatReportDataToStr,
  1600. copyStrToClipboard: copyStrToClipboard,
  1601. getPropertiesOfObj: getPropertiesOfObj,
  1602. lgd: lgd,
  1603. lgd0: lgd0,
  1604. lgdt1: lgdt1,
  1605. getPrototypeChainOfObject: getPrototypeChainOfObject,
  1606. getLogObjectValue: getLogObjectValue,
  1607. storagex: storagex,
  1608. pickFileDom: pickFileDom
  1609. };
  1610. /**
  1611. * 获取文件
  1612. */
  1613. function pickFileDom() {
  1614. var pickFileDom = createElement('input', {
  1615. el: 'body',
  1616. id: 'pickFileDom',
  1617. addPrefix: false,
  1618. autoInsert: true,
  1619. type: 'file',
  1620. style: 'position:fixed;top:-100px'
  1621. });
  1622. pickFileDom.addEventListener('change', function (e) {
  1623. var _e$target;
  1624. if ((_e$target = e.target) !== null && _e$target !== void 0 && _e$target.files) {
  1625. console.log(e.target.files[0]);
  1626. }
  1627. });
  1628. pickFileDom.click();
  1629. }
  1630. function getPrototypeChainOfObject(Obj) {
  1631. /** @描述 对象原型链 */
  1632.  
  1633. var idx = 0;
  1634. var str = "".concat(Obj.name || '参数', "\u7684\u539F\u578B\u94FE\u662F\uFF1A ");
  1635. next(Obj);
  1636. return str;
  1637.  
  1638. /** @描述 递归 */
  1639. function next(obj) {
  1640. var _ObjType$match;
  1641. var ObjType = Object.toLocaleString.call(obj);
  1642. var ObjFlag = ((_ObjType$match = ObjType.match(/^\[object ([a-zA-Z]+)\]/)) === null || _ObjType$match === void 0 ? void 0 : _ObjType$match[1]) || typeof_typeof(ObjType);
  1643. str += "\u7B2C ".concat(idx, " \u7EA7\u3010").concat(ObjFlag, "\u3011.__proto__ \u25B6\uFE0F ");
  1644. idx++;
  1645. if (obj.__proto__) {
  1646. next(obj.__proto__);
  1647. } else {
  1648. str += "\u7B2C ".concat(idx, " \u7EA7\u3010null\u3011");
  1649. }
  1650. }
  1651. }
  1652. function lgdt1() {
  1653. var _console;
  1654. for (var _len = arguments.length, rest = new Array(_len), _key = 0; _key < _len; _key++) {
  1655. rest[_key] = arguments[_key];
  1656. }
  1657. /** @描述 以对象形式打印 $0 */
  1658. (_console = console).log.apply(_console, ["temp1 ==%O", temp1].concat(rest));
  1659. }
  1660. function lgd() {
  1661. var _console3;
  1662. for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  1663. args[_key2] = arguments[_key2];
  1664. }
  1665. /** @描述 以对象形式打印 temp1 */
  1666.  
  1667. var desc = args[0],
  1668. rest = args.slice(1);
  1669. if (rest.length && typeof desc === 'string') {
  1670. var _console2;
  1671. return (_console2 = console).log.apply(_console2, ["".concat(desc, " %O")].concat(_toConsumableArray(rest)));
  1672. }
  1673. (_console3 = console).log.apply(_console3, ["%O"].concat(args));
  1674. }
  1675. function lgd0() {
  1676. var _console4;
  1677. for (var _len3 = arguments.length, rest = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
  1678. rest[_key3] = arguments[_key3];
  1679. }
  1680. /** @描述 以对象形式打印 $0 */
  1681. (_console4 = console).log.apply(_console4, ["$0 ==%O", $0].concat(rest));
  1682. }
  1683. function backPrototype(resourceObj) {
  1684. /**
  1685. * @description 对象原型链:继承谁的属性和方法
  1686. * @param {*} resourceObj
  1687. * @returns {*} string
  1688. */
  1689.  
  1690. var str = '';
  1691. next(resourceObj);
  1692. str = str + 'null';
  1693. console.log("%c \u8BE5\u5BF9\u8C61\u539F\u578B\u94FE\u662F\uFF1A", 'color:red', str);
  1694. return str;
  1695. function next(obj) {
  1696. var _ObjType$match2;
  1697. var ObjType = Object.toLocaleString.call(obj);
  1698. var ObjFlag = ((_ObjType$match2 = ObjType.match(/^\[object ([a-zA-Z]+)\]/)) === null || _ObjType$match2 === void 0 ? void 0 : _ObjType$match2[1]) || '无';
  1699. str = str + ObjFlag + ' + .__proto__ >> ';
  1700. if (obj.__proto__) {
  1701. next(obj.__proto__);
  1702. }
  1703. }
  1704. }
  1705. function createPlainFile() {
  1706. var content = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
  1707. a: 'a'
  1708. };
  1709. var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'name';
  1710. /**
  1711. * @description 创建文本文件
  1712. * @param {string} [content={ a: 'a' }]
  1713. * @param {string} [name='name']
  1714. */
  1715.  
  1716. // 下载保存json文件
  1717. var eleLink = document.createElement('a');
  1718. eleLink.download = name + '.json';
  1719. // 字符内容转变成blob地址
  1720. var data = JSON.stringify(content, undefined, 4);
  1721. var blob = new Blob([data], {
  1722. type: 'text/json'
  1723. });
  1724. eleLink.href = URL.createObjectURL(blob);
  1725. // 触发点击
  1726. eleLink.click();
  1727. // 然后移除
  1728. }
  1729.  
  1730. function getRegMobile() {
  1731. /** @描述 正则 - 手机号 */
  1732. return /^1[2|3|4|5|6|7|8|9][\d]{9}$/;
  1733. }
  1734. function phoneFormat() {
  1735. var phone = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
  1736. /** @描述 格式化 - 手机号 */
  1737. if (!phone || !/^(?:(?:\+|00)86)?1[3-9]\d{9}$/.test(phone)) return;
  1738. phone = phone.replace(/\D/g, '').slice(0, 11);
  1739. phone = phone.replace(/^(\d{3})/, '$1 ').replace(/(\d{4})/, '$1 ').replace(/[\s]+$/, '');
  1740. return phone;
  1741. }
  1742. function getRegName() {
  1743. /** @描述 正则 - 姓名 */
  1744.  
  1745. return /^[0-9|A-Za-z|\u4e00-\u9fa5|\s]+$/;
  1746. }
  1747. function getRegEmail() {
  1748. /** @描述 正则 - 邮箱 */
  1749.  
  1750. return /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/i;
  1751. }
  1752. function getRegIDCard() {
  1753. /** @描述 正则 - 大陆身份证号码 */
  1754. return /^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/;
  1755. }
  1756. function getQuery() {
  1757. var search = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.location.search;
  1758. /** @描述 获取 url 参数 */
  1759.  
  1760. var query = {};
  1761. search.substr(1).split('&').forEach(function (str) {
  1762. var strArr = str.split('=');
  1763. var key = strArr[0];
  1764. if (!key) return;
  1765. var val = decodeURIComponent(strArr[1]);
  1766. try {
  1767. val = JSON.parse(val);
  1768. } catch (err) {}
  1769. query[key] = val;
  1770. });
  1771. return query;
  1772. }
  1773. function toSearch() {
  1774. var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1775. /** @描述 转换成 url search */
  1776. var arr = Object.keys(obj).map(function (key) {
  1777. var val = obj[key];
  1778. if (typeof val !== 'string') {
  1779. try {
  1780. val = JSON.stringify(val);
  1781. } catch (err) {
  1782. console.error(err);
  1783. }
  1784. }
  1785. return "".concat(key, "=").concat(encodeURIComponent(val));
  1786. });
  1787. return '?' + arr.join('&');
  1788. }
  1789. function transformThousandth(value, fixed) {
  1790. /**
  1791. * 格式化金额 千分符
  1792. * @param value
  1793. * @param fixed
  1794. */
  1795.  
  1796. var needFixed = fixed != null;
  1797. var num = Number(value);
  1798. if (isNaN(num)) {
  1799. return needFixed ? 0 .toFixed(fixed) : '0';
  1800. }
  1801. // return (needFixed ? num.toFixed(fixed) : num.toString()).replace(/(\d{1,3})(?=(\d{3})+(?:$|\.))/g, '$1,')
  1802. var str = needFixed ? num.toFixed(fixed) : num.toString();
  1803. var arr = str.split('.');
  1804. var result = arr[0] ? arr[0].replace(/(?=(?!\b)(\d{3})+$)/g, ',') : '0';
  1805. if (arr[1] != null) {
  1806. result += ".".concat(arr[1]);
  1807. }
  1808. return result;
  1809. }
  1810. function deleteProperty() {
  1811. var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1812. var v = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [undefined, null, ''];
  1813. /**
  1814. * 删除指定值的属性
  1815. * @param obj
  1816. */
  1817.  
  1818. var res = {};
  1819. var isArray = Array.isArray(v);
  1820. for (var key in obj) {
  1821. if (isArray) {
  1822. if (!v.includes(obj[key])) res[key] = obj[key];
  1823. } else {
  1824. if (obj[key] !== v) res[key] = obj[key];
  1825. }
  1826. }
  1827. return res;
  1828. }
  1829. function asyncRequire(url, name, type) {
  1830. /**
  1831. * 通过插入标签以加载 js/css 文件
  1832. * @param {String} url 需要载入的 js/css url
  1833. * @param {String} name 文件载入后挂载到 window 下的变量名
  1834. * @param {String} type 文件类型 默认取后缀名
  1835. */
  1836.  
  1837. return new Promise(function (resolve, reject) {
  1838. var head = document.head || document.getElementsByTagName('head')[0] || document.body;
  1839. var filePath = url.split('?')[0];
  1840. var ext = filePath.substring(filePath.lastIndexOf('.') + 1);
  1841. if (document.getElementById("async-require-".concat(name || 'unknown'))) {
  1842. return resolve(name ? window[name] : 'loaded');
  1843. }
  1844. var element;
  1845. if (ext == 'js' || type == 'js') {
  1846. element = document.createElement('script');
  1847. element.src = url;
  1848. element.onload = function (e) {
  1849. return resolve(name ? window[name] : e);
  1850. };
  1851. } else if (ext == 'css' || type == 'css') {
  1852. element = document.createElement('link');
  1853. element.rel = 'stylesheet';
  1854. element.type = 'text/css';
  1855. element.href = url;
  1856. element.onload = resolve;
  1857. } else {
  1858. return console.warn('好像有点不对劲...请指定文件类型: js | css');
  1859. }
  1860. element.id = "async-require-".concat(name);
  1861. element.onerror = reject;
  1862. head.appendChild(element);
  1863. });
  1864. }
  1865. function transformData(sourceData, relation) {
  1866. /**
  1867. * 返回数据
  1868. * @param {Array} sourceData 原数组
  1869. * @param {Array} 映射字段
  1870. */
  1871.  
  1872. return sourceData.map(function (item) {
  1873. var _relation = _slicedToArray(relation, 2),
  1874. key = _relation[0],
  1875. name = _relation[1];
  1876. return {
  1877. label: item[name],
  1878. value: item[key]
  1879. };
  1880. });
  1881. }
  1882. function previewFile(fileUrl) {
  1883. /**
  1884. * 在线预览文件
  1885. * @param {String} fileUrl 静态资源地址
  1886. */
  1887.  
  1888. var link = document.createElement('a');
  1889. link.href = fileUrl;
  1890. var ext = (link.pathname.split('.')[1] || '').toLowerCase();
  1891. var allowedExt = {
  1892. bmp: 1,
  1893. gif: 1,
  1894. jpg: 1,
  1895. jpeg: 1,
  1896. png: 1,
  1897. apng: 1,
  1898. webp: 1,
  1899. htm: 1,
  1900. html: 1,
  1901. pdf: 1
  1902. };
  1903. if (ext && allowedExt[ext]) {
  1904. var _window;
  1905. var url = "https://static.hrwork.com/tools/pdfviewer/index.html?file=".concat(encodeURIComponent(fileUrl));
  1906. if ((_window = window) !== null && _window !== void 0 && _window.__ZPA_CRX) {
  1907. return void dispatchEvent(new CustomEvent('$create_tab', {
  1908. detail: url
  1909. }));
  1910. }
  1911. window.open(url);
  1912. } else {
  1913. alert("\u4E0D\u652F\u6301\u5728\u7EBF\u9884\u89C8\u6B64\u7C7B\u578B(".concat(ext !== null && ext !== void 0 ? ext : '', ")\u6587\u4EF6"));
  1914. }
  1915. }
  1916. function dateUtil() {
  1917. var time = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Date();
  1918. /**
  1919. * 获取特定格式日期
  1920. * date: 可以为日期字符串、日期对象,不传参数默认当前系统时间
  1921. * format: 输出日期时间格式, 不传参数默认 YYYY-MM-DD HH:mm:ss 格式
  1922. * 例:
  1923. * dateUtil().format()
  1924. * // 2022-06-16 11:56:02
  1925. *
  1926. * // 不传入日期,默认以当前日期,格式化为特定格式日期
  1927. * dateUtil().format('YYYY年MM月DD日 (周W) HH时mm分ss秒')
  1928. * // 2022年06月16日 (周四) 12时01分51秒
  1929. *
  1930. * // 传入指定日期(string | date),格式化为指定格式日期(string)
  1931. * dateUtil('2015.7.12').format('YYYY年MM月DD日 HH时mm秒ss分 星期W')
  1932. * // 2015年07月12日 00时00分00秒 星期三
  1933. */
  1934.  
  1935. time = typeof time === 'string' ? time.replace(/-/g, '/') : time;
  1936. var date = isNaN(new Date(time)) ? time : new Date(time);
  1937. return {
  1938. date: date,
  1939. format: format
  1940. };
  1941. function format() {
  1942. var rule = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'YYYY-MM-DD HH:mm:ss';
  1943. var weeks = ['日', '一', '二', '三', '四', '五', '六'];
  1944. var padStart = function padStart(d) {
  1945. return (d + '').padStart(2, '0');
  1946. };
  1947. var M = date.getMonth() + 1 + '';
  1948. var D = date.getDate() + '';
  1949. var H = date.getHours() + '';
  1950. var m = date.getMinutes() + '';
  1951. var s = date.getSeconds() + '';
  1952. return rule.replace('YYYY', date.getFullYear()).replace('MM', padStart(M)).replace('M', M).replace('DD', padStart(D)).replace('D', D).replace('HH', padStart(H)).replace('H', H).replace('mm', padStart(m)).replace('m', m).replace('ss', padStart(s)).replace('s', s).replace(/W/, weeks[date.getDay()]).replace(/w/, date.getDay());
  1953. }
  1954. }
  1955. function toWithOpener(href) {
  1956. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  1957. /**
  1958. * 共享opener跳转
  1959. * @param { Object } router 如:
  1960. * @param { Object } options 如:
  1961. */
  1962.  
  1963. var _options$target = options.target,
  1964. target = _options$target === void 0 ? '_blank' : _options$target,
  1965. routes = options.routes;
  1966. var win = window.open(href, target);
  1967. // 设置新打开页面的面包屑
  1968. if (routes && Array.isArray(routes)) {
  1969. var cloneRoutes = _toConsumableArray(routes);
  1970. cloneRoutes.shift();
  1971. cloneRoutes[cloneRoutes.length - 1] = GlobalTools_objectSpread(GlobalTools_objectSpread({}, cloneRoutes[cloneRoutes.length - 1]), {}, {
  1972. a: true,
  1973. path: '/zhaopintong/' + location.hash
  1974. });
  1975. win.sessionStorage.parent_routes = JSON.stringify(cloneRoutes);
  1976. }
  1977. return win;
  1978. }
  1979. function downloadFile(href) {
  1980. var fileName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
  1981. /**
  1982. * 通过url一键下载图片
  1983. * @param { String } href 如:
  1984. * @param { String } fileName 如:
  1985. */
  1986.  
  1987. if (!href) {
  1988. return;
  1989. }
  1990. var aLink = document.createElement('a');
  1991. aLink.download = fileName + Date.now();
  1992. aLink.href = href;
  1993. aLink.click();
  1994. }
  1995. function base64ToBlob(base64Code) {
  1996. /**
  1997. * base64转Blob对象
  1998. * @param { String } code 如:
  1999. */
  2000.  
  2001. var parts = base64Code.split(';base64,');
  2002. var contentType = parts[0].split(':')[1];
  2003. var raw = window.atob(parts[1]);
  2004. var rawLength = raw.length;
  2005. var uint8Array = new Uint8Array(rawLength);
  2006. for (var i = 0; i < rawLength; i++) {
  2007. uint8Array[i] = raw.charCodeAt(i);
  2008. }
  2009. return new Blob([uint8Array], {
  2010. type: contentType
  2011. });
  2012. }
  2013. function base64ImgtoFile(base64Code) {
  2014. var filename = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'file';
  2015. /**
  2016. * base64转文件对象
  2017. * @param { String } base64Code 如:
  2018. * @param { String } filename 如:
  2019. */
  2020.  
  2021. var arr = base64Code.split(',');
  2022. var mime = arr[0].match(/:(.*?);/)[1];
  2023. var suffix = mime.split('/')[1];
  2024. var bstr = atob(arr[1]);
  2025. var n = bstr.length;
  2026. var u8arr = new Uint8Array(n);
  2027. while (n--) {
  2028. u8arr[n] = bstr.charCodeAt(n);
  2029. }
  2030. return new File([u8arr], "".concat(filename, ".").concat(suffix), {
  2031. type: mime
  2032. });
  2033. }
  2034. function isHasBtnPower() {
  2035. var powerList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  2036. var code = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
  2037. /**
  2038. * @description 判断角色是否有页面级按钮的权限
  2039. * @param {*} [powerList=[]]
  2040. * @param {string} [code='']
  2041. * @returns {*} {boolean}
  2042. */
  2043.  
  2044. if (!code) return false;
  2045. if (typeof code === 'string') code = [code];
  2046. var _iterator = _createForOfIteratorHelper(code),
  2047. _step;
  2048. try {
  2049. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  2050. var _powerList$includes;
  2051. var value = _step.value;
  2052. if (powerList !== null && powerList !== void 0 && (_powerList$includes = powerList.includes) !== null && _powerList$includes !== void 0 && _powerList$includes.call(powerList, value)) return true;
  2053. }
  2054. } catch (err) {
  2055. _iterator.e(err);
  2056. } finally {
  2057. _iterator.f();
  2058. }
  2059. return false;
  2060. }
  2061. function getBrowerEnv() {
  2062. /** @描述 判断当前浏览器运行环境 */
  2063.  
  2064. var userAgent = window.navigator.userAgent.toLowerCase();
  2065. var agents = ['Android', 'iPhone', 'SymbianOS', 'Windows Phone', 'iPad', 'iPod'];
  2066. // 是否为支付宝环境
  2067. var isAliPay = /alipayclient/.test(userAgent);
  2068. // 是否为淘宝环境
  2069. var isTaoBao = /windvane/.test(userAgent);
  2070. // 是否为企业微信环境
  2071. var isWxWork = /wxwork/.test(userAgent);
  2072. // 是否为微信环境
  2073. var isWeChat = /micromessenger/.test(userAgent) && !isWxWork;
  2074. // 是否为移动端
  2075. var isPhone = agents.some(function (x) {
  2076. return new RegExp(x.toLocaleLowerCase()).test(userAgent);
  2077. });
  2078. return {
  2079. isAliPay: isAliPay,
  2080. isTaoBao: isTaoBao,
  2081. isWxWork: isWxWork,
  2082. isWeChat: isWeChat,
  2083. isPhone: isPhone
  2084. };
  2085. }
  2086.  
  2087. //
  2088. function formatReportDataToStr() {
  2089. var arr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  2090. var headerLabel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  2091. /** @描述 格式化报表数据拼接成字符串,以便复制到剪贴板 */
  2092.  
  2093. return arr.reduce(function (pre, cur) {
  2094. return pre + headerLabel.reduceRight(function (pre2, cur2) {
  2095. return "".concat(cur[cur2.key], "\t").concat(pre2);
  2096. }, '\n');
  2097. }, headerLabel.reduceRight(function (pre, cur) {
  2098. return "".concat(cur.title, "\t").concat(pre);
  2099. }, '\n'));
  2100. }
  2101. function copyStrToClipboard(value) {
  2102. /** @描述 把字符串复制到剪贴板 */
  2103.  
  2104. var textarea = document.createElement('textarea');
  2105. textarea.value = value;
  2106. document.body.appendChild(textarea);
  2107. textarea.select();
  2108. document.execCommand('Copy');
  2109. document.body.removeChild(textarea);
  2110. }
  2111. function copyStrToClipboardOfNavigator(_x) {
  2112. return _copyStrToClipboardOfNavigator.apply(this, arguments);
  2113. }
  2114. function _copyStrToClipboardOfNavigator() {
  2115. _copyStrToClipboardOfNavigator = _asyncToGenerator( /*#__PURE__*/regenerator_default().mark(function _callee(value) {
  2116. return regenerator_default().wrap(function _callee$(_context) {
  2117. while (1) switch (_context.prev = _context.next) {
  2118. case 0:
  2119. _context.next = 2;
  2120. return navigator.clipboard.writeText(value);
  2121. case 2:
  2122. return _context.abrupt("return", _context.sent);
  2123. case 3:
  2124. case "end":
  2125. return _context.stop();
  2126. }
  2127. }, _callee);
  2128. }));
  2129. return _copyStrToClipboardOfNavigator.apply(this, arguments);
  2130. }
  2131. function getPropertiesOfObj(_ref) {
  2132. var _ref$obj = _ref.obj,
  2133. obj = _ref$obj === void 0 ? {} : _ref$obj,
  2134. _ref$keys = _ref.keys,
  2135. keys = _ref$keys === void 0 ? [] : _ref$keys;
  2136. /**
  2137. * @描述 获取对象的指定属性集合
  2138. * @param {*} { obj = {}, keys = [] }
  2139. * @returns {*}
  2140. */
  2141.  
  2142. var newObj = {};
  2143. keys.forEach(function (key) {
  2144. newObj[key] = obj[key];
  2145. });
  2146. return newObj;
  2147. }
  2148.  
  2149. /** @描述 定义以对象形式 获取window属性值 */
  2150. function getLogObjectValue(arr) {
  2151. var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
  2152. var suffix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '_o';
  2153. var win2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : win;
  2154. /** @描述 定义以对象形式 获取window属性值 */
  2155. arr.forEach(function (newKey) {
  2156. Object.defineProperty(win2, "".concat(newKey), {
  2157. get: function get() {
  2158. console.log('%O', win2[newKey]);
  2159. return win2[newKey];
  2160. }
  2161. });
  2162. });
  2163. }
  2164.  
  2165. /** @描述 代理window,读取属性时,即打印对象 */
  2166. function windowProxy() {
  2167. var win2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : win;
  2168. /** @描述 代理window,读取属性时,即打印对象 */
  2169. var result;
  2170. win2.enjoy_wp6 = new Proxy(win2, {
  2171. get: function get(obj, prop) {
  2172. result = obj[prop];
  2173. console.log("\uD83C\uDF8F ".concat(prop, "=%O"), result);
  2174. return result;
  2175. }
  2176. });
  2177. }
  2178. if (win.enjoy_tl6) {
  2179. // console.error('win.enjoy_tl已经存在,请使用win.enjoy_tls')
  2180. if (!win.enjoy_tls6) win.enjoy_tls6 = tools;
  2181. return;
  2182. }
  2183. win.enjoy_tl6 = tools;
  2184. Object.defineProperty(tools, 'fns', {
  2185. /** @描述 对象下的函数名列表 */get: function get() {
  2186. return Object.keys(tools);
  2187. }
  2188. });
  2189. }
  2190. })();
  2191.  
  2192. /******/ })()
  2193. ;