@whitesev/utils 2.11.3 → 2.11.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.amd.js +54 -3
- package/dist/index.amd.js.map +1 -1
- package/dist/index.amd.min.js +1 -1
- package/dist/index.amd.min.js.map +1 -1
- package/dist/index.cjs.js +54 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs.min.js +1 -1
- package/dist/index.cjs.min.js.map +1 -1
- package/dist/index.esm.js +54 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/dist/index.iife.js +54 -3
- package/dist/index.iife.js.map +1 -1
- package/dist/index.iife.min.js +1 -1
- package/dist/index.iife.min.js.map +1 -1
- package/dist/index.system.js +54 -3
- package/dist/index.system.js.map +1 -1
- package/dist/index.system.min.js +1 -1
- package/dist/index.system.min.js.map +1 -1
- package/dist/index.umd.js +54 -3
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/dist/types/src/Utils.d.ts +20 -0
- package/package.json +1 -1
- package/src/Utils.ts +73 -2
package/dist/index.amd.js
CHANGED
|
@@ -239,7 +239,7 @@ define((function () { 'use strict';
|
|
|
239
239
|
const setInterval$1 = (...args) => loadOrReturnBroker().setInterval(...args);
|
|
240
240
|
const setTimeout$1 = (...args) => loadOrReturnBroker().setTimeout(...args);
|
|
241
241
|
|
|
242
|
-
const version = "2.11.
|
|
242
|
+
const version = "2.11.5";
|
|
243
243
|
|
|
244
244
|
/* eslint-disable */
|
|
245
245
|
// ==UserScript==
|
|
@@ -7513,8 +7513,7 @@ define((function () { 'use strict';
|
|
|
7513
7513
|
}
|
|
7514
7514
|
async init() {
|
|
7515
7515
|
let copyStatus = false;
|
|
7516
|
-
|
|
7517
|
-
console.log(requestPermissionStatus);
|
|
7516
|
+
await this.requestClipboardPermission();
|
|
7518
7517
|
if (this.hasClipboard() && (this.hasClipboardWrite() || this.hasClipboardWriteText())) {
|
|
7519
7518
|
try {
|
|
7520
7519
|
copyStatus = await this.copyDataByClipboard();
|
|
@@ -8482,6 +8481,58 @@ define((function () { 'use strict';
|
|
|
8482
8481
|
}
|
|
8483
8482
|
});
|
|
8484
8483
|
}
|
|
8484
|
+
calcPositionDistance(...args) {
|
|
8485
|
+
let position = {
|
|
8486
|
+
x: 0,
|
|
8487
|
+
y: 0,
|
|
8488
|
+
};
|
|
8489
|
+
let otherPosition = {
|
|
8490
|
+
x: 0,
|
|
8491
|
+
y: 0,
|
|
8492
|
+
};
|
|
8493
|
+
if (typeof args[0] === "object" && args[0] != null && typeof args[1] === "object" && args[1] != null) {
|
|
8494
|
+
position = args[0];
|
|
8495
|
+
otherPosition = args[1];
|
|
8496
|
+
}
|
|
8497
|
+
else if (args.length === 4) {
|
|
8498
|
+
position = {
|
|
8499
|
+
x: args[0],
|
|
8500
|
+
y: args[1],
|
|
8501
|
+
};
|
|
8502
|
+
otherPosition = {
|
|
8503
|
+
x: args[2],
|
|
8504
|
+
y: args[3],
|
|
8505
|
+
};
|
|
8506
|
+
}
|
|
8507
|
+
else {
|
|
8508
|
+
throw new Error("Invalid arguments");
|
|
8509
|
+
}
|
|
8510
|
+
if (typeof position.x === "string") {
|
|
8511
|
+
position.x = Number(position.x);
|
|
8512
|
+
}
|
|
8513
|
+
if (isNaN(position.x)) {
|
|
8514
|
+
throw new Error(`Invalid x: ${position.x}`);
|
|
8515
|
+
}
|
|
8516
|
+
if (typeof position.y === "string") {
|
|
8517
|
+
position.y = Number(position.y);
|
|
8518
|
+
}
|
|
8519
|
+
if (isNaN(position.y)) {
|
|
8520
|
+
throw new Error(`Invalid y: ${position.y}`);
|
|
8521
|
+
}
|
|
8522
|
+
if (typeof otherPosition.x === "string") {
|
|
8523
|
+
otherPosition.x = Number(otherPosition.x);
|
|
8524
|
+
}
|
|
8525
|
+
if (isNaN(otherPosition.x)) {
|
|
8526
|
+
throw new Error(`Invalid x: ${otherPosition.x}`);
|
|
8527
|
+
}
|
|
8528
|
+
if (typeof otherPosition.y === "string") {
|
|
8529
|
+
otherPosition.y = Number(otherPosition.y);
|
|
8530
|
+
}
|
|
8531
|
+
if (isNaN(otherPosition.y)) {
|
|
8532
|
+
throw new Error(`Invalid y: ${otherPosition.y}`);
|
|
8533
|
+
}
|
|
8534
|
+
return Math.sqrt(Math.pow(otherPosition.x - position.x, 2) + Math.pow(otherPosition.y - position.y, 2));
|
|
8535
|
+
}
|
|
8485
8536
|
}
|
|
8486
8537
|
const utils = new Utils();
|
|
8487
8538
|
|