perfectionist-plugins 1.2.0 → 1.3.0
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/ban-blocker.js +26 -24
- package/package.json +30 -30
- package/perfectionist-utils.js +3 -3
package/ban-blocker.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const version = "3.
|
|
1
|
+
export const version = "3.5.0";
|
|
2
2
|
|
|
3
3
|
const PLUGIN_ID = "ban-blocker";
|
|
4
4
|
const STYLE_ID = "perfectionist-ban-blocker-style";
|
|
@@ -8,11 +8,11 @@ const SESSION_URI = "/lol-champ-select/v1/session";
|
|
|
8
8
|
const RESEND_AFTER_MS = 150;
|
|
9
9
|
const RESCHEDULE_MS = RESEND_AFTER_MS + 20;
|
|
10
10
|
const MAX_IN_FLIGHT = 3;
|
|
11
|
-
const FAIL_COOLDOWN_MS =
|
|
12
|
-
const FAIL_COOLDOWN_MAX_MS =
|
|
13
|
-
const POLL_MS =
|
|
11
|
+
const FAIL_COOLDOWN_MS = 400;
|
|
12
|
+
const FAIL_COOLDOWN_MAX_MS = 3000;
|
|
13
|
+
const POLL_MS = 500;
|
|
14
14
|
const ENSURE_MS = 300;
|
|
15
|
-
const DETECT_RETRY_MS =
|
|
15
|
+
const DETECT_RETRY_MS = 250;
|
|
16
16
|
const GONE_RESET_MS = 1500;
|
|
17
17
|
|
|
18
18
|
const BAN_GLYPH_SVG =
|
|
@@ -56,13 +56,13 @@ let removeStyle = null;
|
|
|
56
56
|
let unsubscribe = null;
|
|
57
57
|
let pollTimer = null;
|
|
58
58
|
let ensureTimer = null;
|
|
59
|
-
let detectTimer = null;
|
|
60
59
|
let refreshTimer = null;
|
|
61
60
|
let pumpTimer = null;
|
|
62
61
|
let goneTimer = null;
|
|
63
62
|
let observer = null;
|
|
64
63
|
let pollInFlight = false;
|
|
65
64
|
let uiScheduled = false;
|
|
65
|
+
let lastDetect = -Infinity;
|
|
66
66
|
|
|
67
67
|
const enabled = new Map();
|
|
68
68
|
const alias = new Map();
|
|
@@ -172,24 +172,29 @@ function pump() {
|
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
function fire(id, champ) {
|
|
175
|
-
|
|
176
|
-
if (!send || id == null) return;
|
|
175
|
+
if (id == null) return;
|
|
177
176
|
sent = champ;
|
|
178
177
|
sentAt = performance.now();
|
|
179
178
|
inFlight++;
|
|
180
179
|
clearTimeout(pumpTimer);
|
|
181
180
|
pumpTimer = setTimeout(pump, RESCHEDULE_MS);
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
})
|
|
186
|
-
|
|
181
|
+
fetch(`${SESSION_URI}/actions/${id}`, {
|
|
182
|
+
method: "PATCH",
|
|
183
|
+
headers: { "Content-Type": "application/json" },
|
|
184
|
+
body: JSON.stringify({ championId: champ }),
|
|
185
|
+
})
|
|
186
|
+
.then((r) => {
|
|
187
|
+
if (r.ok) {
|
|
188
|
+
failCount.delete(champ);
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
187
191
|
const n = failCount.get(champ) ?? 0;
|
|
188
192
|
failCount.set(champ, n + 1);
|
|
189
193
|
failedUntil.set(champ, performance.now() + Math.min(FAIL_COOLDOWN_MS * 2 ** n, FAIL_COOLDOWN_MAX_MS));
|
|
190
194
|
if (target === champ) target = undefined;
|
|
191
195
|
if (sent === champ) sent = 0;
|
|
192
196
|
})
|
|
197
|
+
.catch(() => {})
|
|
193
198
|
.finally(() => {
|
|
194
199
|
inFlight--;
|
|
195
200
|
pump();
|
|
@@ -314,11 +319,14 @@ function detectRows() {
|
|
|
314
319
|
}
|
|
315
320
|
|
|
316
321
|
function getRows() {
|
|
322
|
+
const connected = rows.length > 0 && rows.every((r) => r.el.isConnected);
|
|
323
|
+
if (connected) return rows;
|
|
324
|
+
const now = performance.now();
|
|
325
|
+
if (rows.length === 0 && now - lastDetect < DETECT_RETRY_MS) return rows;
|
|
326
|
+
lastDetect = now;
|
|
317
327
|
const found = detectRows();
|
|
318
328
|
if (found.length) rows = found;
|
|
319
329
|
else if (!document.querySelector("div.summoner-object")) rows = [];
|
|
320
|
-
clearTimeout(detectTimer);
|
|
321
|
-
detectTimer = setTimeout(getRows, DETECT_RETRY_MS);
|
|
322
330
|
return rows;
|
|
323
331
|
}
|
|
324
332
|
|
|
@@ -536,13 +544,7 @@ function onEnable(utils) {
|
|
|
536
544
|
}, ENSURE_MS);
|
|
537
545
|
|
|
538
546
|
try {
|
|
539
|
-
observer = new MutationObserver(() =>
|
|
540
|
-
try {
|
|
541
|
-
update();
|
|
542
|
-
} catch (err) {
|
|
543
|
-
logError("ui update failed.", err);
|
|
544
|
-
}
|
|
545
|
-
});
|
|
547
|
+
observer = new MutationObserver(() => scheduleUi());
|
|
546
548
|
observer.observe(document.body, { childList: true, subtree: true });
|
|
547
549
|
} catch (err) {
|
|
548
550
|
logError("observer setup failed.", err);
|
|
@@ -577,10 +579,9 @@ function onDisable() {
|
|
|
577
579
|
clearInterval(pollTimer);
|
|
578
580
|
clearInterval(ensureTimer);
|
|
579
581
|
clearTimeout(refreshTimer);
|
|
580
|
-
clearTimeout(detectTimer);
|
|
581
582
|
clearTimeout(pumpTimer);
|
|
582
583
|
clearTimeout(goneTimer);
|
|
583
|
-
pollTimer = ensureTimer = refreshTimer =
|
|
584
|
+
pollTimer = ensureTimer = refreshTimer = pumpTimer = goneTimer = null;
|
|
584
585
|
observer?.disconnect();
|
|
585
586
|
observer = null;
|
|
586
587
|
|
|
@@ -597,6 +598,7 @@ function onDisable() {
|
|
|
597
598
|
fetchedNames.clear();
|
|
598
599
|
lastSession = null;
|
|
599
600
|
rows = [];
|
|
601
|
+
lastDetect = -Infinity;
|
|
600
602
|
removeButtons();
|
|
601
603
|
|
|
602
604
|
removeStyle?.();
|
package/package.json
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "perfectionist-plugins",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Small plugins that fix the annoying parts of League of Legends champ select. Built for Pengu Loader.",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "perfectionist-utils.js",
|
|
7
|
-
"exports": {
|
|
8
|
-
".": "./perfectionist-utils.js",
|
|
9
|
-
"./perfectionist-utils.js": "./perfectionist-utils.js",
|
|
10
|
-
"./ban-blocker.js": "./ban-blocker.js",
|
|
11
|
-
"./hide-unowned-skins.js": "./hide-unowned-skins.js",
|
|
12
|
-
"./unlock-profile-skins.js": "./unlock-profile-skins.js"
|
|
13
|
-
},
|
|
14
|
-
"files": [
|
|
15
|
-
"perfectionist-utils.js",
|
|
16
|
-
"ban-blocker.js",
|
|
17
|
-
"hide-unowned-skins.js",
|
|
18
|
-
"unlock-profile-skins.js"
|
|
19
|
-
],
|
|
20
|
-
"repository": {
|
|
21
|
-
"type": "git",
|
|
22
|
-
"url": "git+https://github.com/SrKing-9812/Perfectionist-Plugins.git"
|
|
23
|
-
},
|
|
24
|
-
"keywords": [
|
|
25
|
-
"pengu-loader",
|
|
26
|
-
"league-of-legends",
|
|
27
|
-
"plugin"
|
|
28
|
-
],
|
|
29
|
-
"author": "Sr. King"
|
|
30
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "perfectionist-plugins",
|
|
3
|
+
"version": "1.3.0",
|
|
4
|
+
"description": "Small plugins that fix the annoying parts of League of Legends champ select. Built for Pengu Loader.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "perfectionist-utils.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./perfectionist-utils.js",
|
|
9
|
+
"./perfectionist-utils.js": "./perfectionist-utils.js",
|
|
10
|
+
"./ban-blocker.js": "./ban-blocker.js",
|
|
11
|
+
"./hide-unowned-skins.js": "./hide-unowned-skins.js",
|
|
12
|
+
"./unlock-profile-skins.js": "./unlock-profile-skins.js"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"perfectionist-utils.js",
|
|
16
|
+
"ban-blocker.js",
|
|
17
|
+
"hide-unowned-skins.js",
|
|
18
|
+
"unlock-profile-skins.js"
|
|
19
|
+
],
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/SrKing-9812/Perfectionist-Plugins.git"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"pengu-loader",
|
|
26
|
+
"league-of-legends",
|
|
27
|
+
"plugin"
|
|
28
|
+
],
|
|
29
|
+
"author": "Sr. King"
|
|
30
|
+
}
|
package/perfectionist-utils.js
CHANGED
|
@@ -26,21 +26,21 @@ const BUNDLED_MODULES = [
|
|
|
26
26
|
id: "ban-blocker",
|
|
27
27
|
file: "ban-blocker.js",
|
|
28
28
|
name: "Ban Blocker",
|
|
29
|
-
version: "3.
|
|
29
|
+
version: "3.5.0",
|
|
30
30
|
description: "During bans, blocking a teammate instantly claims the champion they hover to ban.",
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
33
|
id: "hide-unowned-skins",
|
|
34
34
|
file: "hide-unowned-skins.js",
|
|
35
35
|
name: "Hide Unowned Skins",
|
|
36
|
-
version: "2.
|
|
36
|
+
version: "2.3.0",
|
|
37
37
|
description: "In champion select, only shows the skins you own for the picked champion.",
|
|
38
38
|
},
|
|
39
39
|
{
|
|
40
40
|
id: "unlock-profile-skins",
|
|
41
41
|
file: "unlock-profile-skins.js",
|
|
42
42
|
name: "Unlock Profile Skins",
|
|
43
|
-
version: "1.
|
|
43
|
+
version: "1.2.0",
|
|
44
44
|
description: "Unlocks every skin in the Set profile background window.",
|
|
45
45
|
},
|
|
46
46
|
];
|