-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy pathindex.js
More file actions
2896 lines (2526 loc) · 98 KB
/
Copy pathindex.js
File metadata and controls
2896 lines (2526 loc) · 98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* @name ROSE-CustomWheel
* @author Rose Team
* @description Custom mod wheel for Pengu Loader - displays installed mods for hovered skins
* @link https://github.com/Alban1911/ROSE-CustomWheel
*/
(function createCustomWheel() {
const LOG_PREFIX = "[ROSE-CustomWheel]";
console.log(`${LOG_PREFIX} JS Loaded`);
const BUTTON_CLASS = "lu-chroma-button";
const BUTTON_SELECTOR = `.${BUTTON_CLASS}`;
const PANEL_CLASS = "lu-chroma-panel";
const PANEL_ID = "rose-custom-wheel-panel-container";
const REQUEST_TYPE = "request-skin-mods";
const EVENT_SKIN_STATE = "lu-skin-monitor-state";
let isOpen = false;
let panel = null;
let button = null;
let championSelectRoot = null;
let championSelectObserver = null;
let championLocked = false;
let currentSkinData = null;
let selectedModId = null; // Track which mod is currently selected
let selectedModSkinId = null; // Track which skin the selected mod belongs to
let activeTab = "skins"; // Current active tab: "skins", "maps", "fonts", "announcers", "others"
let selectedMapId = null;
let selectedFontId = null;
let selectedAnnouncerId = null;
let hideEmptyCategories = false;
let lastMapsMods = null;
let lastFontsMods = null;
let lastAnnouncersMods = null;
// Per-category multi-selection (UI / Voiceover / Loading Screen / VFX / SFX / Others).
// These are first-class categories in the UI; they just share the same list rendering logic.
let selectedCategoryIds = Object.create(null);
let lastChampionSelectSession = null; // Track current champ select session
let isFirstOpenInSession = true; // Track if this is first open in current session
let lastCategoryModsById = {}; // Cache per category id (ui/voiceover/loading_screen/vfx/sfx/others)
let emittedHistoricSelectionKeys = new Set(); // Avoid re-emitting historic selections across category responses
let rightPaneMode = "summary"; // "summary" | "picker"
const OTHER_CATEGORY_TABS = [
{ id: "ui", label: "UI", prefixes: ["ui/"] },
{ id: "voiceover", label: "Voiceover", prefixes: ["voiceover/", "vo/"] },
{ id: "loading_screen", label: "Loading Screen", prefixes: ["loading_screen/", "loading-screen/", "loading screen/"] },
{ id: "vfx", label: "VFX", prefixes: ["vfx/"] },
{ id: "sfx", label: "SFX", prefixes: ["sfx/"] },
{ id: "others", label: "Others", prefixes: [] }, // fallback bucket
];
/**
* Escape HTML special characters to prevent XSS (CWE-79)
* @param {string} str - String to escape
* @returns {string} Escaped string safe for innerHTML
*/
function escapeHtml(str) {
if (typeof str !== 'string') return String(str);
return str
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"')
.replace(/'/g, ''');
}
const SUMMARY_TABS = [
{ id: "skins", label: "Skins" },
{ id: "maps", label: "Maps" },
{ id: "fonts", label: "Fonts" },
{ id: "announcers", label: "Announcers" },
...OTHER_CATEGORY_TABS.map((t) => ({ id: t.id, label: t.label })),
];
const SUMMARY_ICONS = {
skins: '<svg viewBox="0 0 24 24"><path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M22 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/></svg>',
maps: '<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M2 12h20"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/></svg>',
fonts: '<svg viewBox="0 0 24 24"><polyline points="4 7 4 4 20 4 20 7"/><line x1="9" y1="20" x2="15" y2="20"/><line x1="12" y1="4" x2="12" y2="20"/></svg>',
announcers: '<svg viewBox="0 0 24 24"><path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"/><path d="M13.73 21a2 2 0 0 1-3.46 0"/></svg>',
ui: '<svg viewBox="0 0 24 24"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"/><line x1="3" y1="9" x2="21" y2="9"/><line x1="9" y1="21" x2="9" y2="9"/></svg>',
voiceover: '<svg viewBox="0 0 24 24"><path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"/><path d="M19 10v2a7 7 0 0 1-14 0v-2"/><line x1="12" y1="19" x2="12" y2="23"/><line x1="8" y1="23" x2="16" y2="23"/></svg>',
loading_screen: '<svg viewBox="0 0 24 24"><rect x="2" y="3" width="20" height="14" rx="2" ry="2"/><line x1="8" y1="21" x2="16" y2="21"/><line x1="12" y1="17" x2="12" y2="21"/></svg>',
vfx: '<svg viewBox="0 0 24 24"><path d="M12 3l1.5 4.5L18 9l-4.5 1.5L12 15l-1.5-4.5L6 9l4.5-1.5L12 3z"/><path d="M19 13l.75 2.25L22 16l-2.25.75L19 19l-.75-2.25L16 16l2.25-.75L19 13z"/><path d="M5 17l.75 2.25L8 20l-2.25.75L5 23l-.75-2.25L2 20l2.25-.75L5 17z"/></svg>',
sfx: '<svg viewBox="0 0 24 24"><path d="M9 18V5l12-2v13"/><circle cx="6" cy="18" r="3"/><circle cx="18" cy="16" r="3"/></svg>',
others: '<svg viewBox="0 0 24 24"><path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"/></svg>',
};
function normalizePathLike(value) {
return String(value || "").replace(/\\/g, "/").trim().toLowerCase();
}
function getSelectedIdsForCategory(categoryId) {
const key = String(categoryId || "").trim();
if (!key) return [];
if (!Array.isArray(selectedCategoryIds[key])) {
selectedCategoryIds[key] = [];
}
return selectedCategoryIds[key];
}
function clearAllCategorySelections() {
for (const t of OTHER_CATEGORY_TABS) {
selectedCategoryIds[t.id] = [];
}
}
function getSelectedSummaryForTab(tabId) {
if (tabId === "skins") {
if (!championLocked) return "Waiting for champ lock…";
return selectedModId ? String(selectedModId) : "None";
}
if (tabId === "maps") return selectedMapId ? String(selectedMapId) : "None";
if (tabId === "fonts") return selectedFontId ? String(selectedFontId) : "None";
if (tabId === "announcers") return selectedAnnouncerId ? String(selectedAnnouncerId) : "None";
// UI / Voiceover / Loading Screen / VFX / SFX / Others are their own categories.
const selected = getSelectedIdsForCategory(tabId);
return selected.length ? selected.join(", ") : "None";
}
function cleanModName(raw) {
if (!raw || typeof raw !== "string") return raw;
let name = raw.replace(/\\/g, "/");
// Strip directory prefixes (everything before last /)
const lastSlash = name.lastIndexOf("/");
if (lastSlash >= 0) name = name.substring(lastSlash + 1);
// Strip common file extensions
name = name.replace(/\.(fantome|wad|zip)$/i, "");
// Replace _ and - with spaces
name = name.replace(/[_\-]/g, " ");
// Title-case
name = name.replace(/\b\w/g, (c) => c.toUpperCase());
return name.trim() || raw;
}
function getTabLabel(tabId) {
return SUMMARY_TABS.find((t) => t.id === tabId)?.label || String(tabId || "");
}
function tabHasInstalledMods(tabId) {
if (tabId === "skins") return true;
if (tabId === "maps") return Array.isArray(lastMapsMods) && lastMapsMods.length > 0;
if (tabId === "fonts") return Array.isArray(lastFontsMods) && lastFontsMods.length > 0;
if (tabId === "announcers") return Array.isArray(lastAnnouncersMods) && lastAnnouncersMods.length > 0;
if (OTHER_CATEGORY_TABS.some((t) => t.id === tabId)) {
if (!Object.prototype.hasOwnProperty.call(lastCategoryModsById, tabId)) return false;
const mods = lastCategoryModsById[tabId];
return Array.isArray(mods) && mods.length > 0;
}
return true;
}
function getVisibleSummaryTabs() {
if (!hideEmptyCategories) return SUMMARY_TABS;
return SUMMARY_TABS.filter((tab) => tab.id === "skins" || tabHasInstalledMods(tab.id));
}
function isSummaryTabVisible(tabId) {
return getVisibleSummaryTabs().some((tab) => tab.id === tabId);
}
function ensureActiveTabVisible() {
if (!isSummaryTabVisible(activeTab)) {
activeTab = "skins";
}
}
function syncActiveTabContent() {
if (!panel) return;
panel.querySelectorAll(".tab-content").forEach((content) => {
if (content && content.dataset && content.dataset.tab === activeTab) {
content.classList.add("active");
} else if (content) {
content.classList.remove("active");
}
});
}
function syncSummaryRowVisibility() {
if (!panel || !panel._summaryRowsByTab) return;
const visibleIds = new Set(getVisibleSummaryTabs().map((tab) => tab.id));
for (const tab of SUMMARY_TABS) {
const row = panel._summaryRowsByTab[tab.id];
if (row) {
row.style.display = visibleIds.has(tab.id) ? "" : "none";
}
}
}
function applyVisibleCategoryState() {
syncSummaryRowVisibility();
if (rightPaneMode === "picker" && !isSummaryTabVisible(activeTab)) {
ensureActiveTabVisible();
syncActiveTabContent();
setRightPaneMode("picker");
}
}
function refreshSummaryValues() {
if (!panel || !panel._summaryValuesByTab) return;
for (const tab of SUMMARY_TABS) {
const el = panel._summaryValuesByTab[tab.id];
const raw = getSelectedSummaryForTab(tab.id);
if (el) {
el.textContent = (raw !== "None" && raw !== "Waiting for champ lock…") ? cleanModName(raw) : raw;
}
// Toggle active class on the row
const row = panel._summaryRowsByTab && panel._summaryRowsByTab[tab.id];
if (row) {
if (raw !== "None" && raw !== "Waiting for champ lock…") {
row.classList.add("active");
} else {
row.classList.remove("active");
}
}
}
syncSummaryRowVisibility();
// Keep the button badge in sync even when the panel is closed.
refreshButtonBadgeFromSelections();
}
function setRightPaneMode(mode) {
if (mode === "picker") {
ensureActiveTabVisible();
syncActiveTabContent();
}
rightPaneMode = mode;
if (!panel) return;
if (panel._summaryView) {
panel._summaryView.style.display = mode === "summary" ? "flex" : "none";
}
if (panel._pickerView) {
if (mode === "picker") panel._pickerView.classList.add("active");
else panel._pickerView.classList.remove("active");
}
if (panel._backBtn) {
panel._backBtn.style.display = mode === "picker" ? "inline-block" : "none";
}
if (panel._rightTitle) {
if (mode === "picker") {
const icon = SUMMARY_ICONS[activeTab] || "";
panel._rightTitle.innerHTML = `<span class="rose-wheel-title-icon">${icon}</span> Choose \u2022 ${escapeHtml(getTabLabel(activeTab))}`;
} else {
panel._rightTitle.textContent = "Custom Mods";
}
}
}
// Shared bridge API (provided by ROSE-SkinMonitor)
let bridge = null;
function waitForBridge() {
return new Promise((resolve, reject) => {
const timeout = 10000;
const interval = 50;
let elapsed = 0;
const check = () => {
if (window.__roseBridge) return resolve(window.__roseBridge);
elapsed += interval;
if (elapsed >= timeout) return reject(new Error("Bridge not available"));
setTimeout(check, interval);
};
check();
});
}
function formatTimestamp(ms) {
if (!ms) return "";
try {
return new Date(ms).toLocaleTimeString([], {
hour: "2-digit",
minute: "2-digit",
});
} catch {
return "";
}
}
const CSS_RULES = `
.${BUTTON_CLASS} {
pointer-events: auto;
-webkit-user-select: none;
cursor: pointer;
box-sizing: border-box;
height: 20px;
width: 20px;
position: absolute !important;
display: block !important;
z-index: 1;
margin: 0;
padding: 0;
}
/* Button and Badge Styles */
lol-uikit-flat-button.rose-custom-wheel-button,
.rose-custom-wheel-button {
display: inline-block !important;
white-space: nowrap !important;
/* Keep badge stacking self-contained (prevents weird overlap with other UI) */
isolation: isolate !important;
}
.rose-custom-wheel-button .count-badge.social-count-badge,
lol-uikit-flat-button.rose-custom-wheel-button .count-badge.social-count-badge,
.rose-custom-wheel-button > .count-badge.social-count-badge,
lol-uikit-flat-button.rose-custom-wheel-button > .count-badge.social-count-badge {
position: absolute !important;
/* Positioning: edit these via CSS variables on the element (DevTools-friendly) */
top: var(--rose-badge-top, -4px) !important;
right: var(--rose-badge-right, -17px) !important;
left: var(--rose-badge-left, auto) !important;
min-width: 18px !important;
height: 18px !important;
padding: 0 5px !important;
background: #c89b3c !important;
color: #000 !important;
border-radius: 3px !important;
font-size: 11px !important;
font-weight: 600 !important;
display: flex !important;
align-items: center !important;
justify-content: center !important;
line-height: 1 !important;
box-sizing: border-box !important;
pointer-events: none !important;
/* Above button contents, but not globally "high" */
z-index: 1 !important;
transform: translate(
var(--rose-badge-translate-x, 60%),
var(--rose-badge-translate-y, -60%)
) !important;
margin: 0 !important;
bottom: auto !important;
}
.${BUTTON_CLASS}[data-hidden],
.${BUTTON_CLASS}[data-hidden] * {
pointer-events: none !important;
cursor: default !important;
visibility: hidden !important;
}
.${BUTTON_CLASS} .button-image {
pointer-events: auto;
-webkit-user-select: none;
cursor: pointer;
display: block;
width: 100%;
height: 100%;
background-size: contain;
background-position: center;
background-repeat: no-repeat;
transition: opacity 0.1s ease;
position: absolute;
top: 0;
left: 0;
min-width: 20px;
min-height: 20px;
background-color: transparent !important;
border: none !important;
}
.${BUTTON_CLASS} .button-image.default {
background-color: transparent;
border: none;
border-radius: 2px;
}
.${BUTTON_CLASS} .button-image.default { opacity: 1; }
.${BUTTON_CLASS} .button-image.pressed { opacity: 0; background-color: transparent !important; border: none !important; }
.${BUTTON_CLASS}.pressed .button-image.default { opacity: 0; }
.${BUTTON_CLASS}.pressed .button-image.pressed { opacity: 1; }
.chroma.icon { display: none !important; }
/* Main Panel Container */
.${PANEL_CLASS} {
position: fixed;
z-index: 10000;
pointer-events: all;
-webkit-user-select: none;
font-family: "Spiegel", "LoL Body", Arial, sans-serif;
}
.${PANEL_CLASS}[data-no-button] {
pointer-events: none;
cursor: default !important;
}
/* Modal Content */
.${PANEL_CLASS} .chroma-modal {
background: #010a13;
border-radius: 2px;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
display: flex;
flex-direction: column;
/* Stable size (clamped to viewport) */
width: 980px;
max-width: calc(100vw - 80px);
min-width: 720px;
position: relative;
z-index: 0;
padding: 16px;
box-sizing: border-box;
overflow: hidden;
color: #f0e6d2;
height: 520px !important;
min-height: 420px !important;
max-height: calc(100vh - 120px) !important;
}
.${PANEL_CLASS} .chroma-modal.chroma-view {
/* Height handled in base class to ensure consistency */
overflow: hidden;
}
/* Flyout Reset */
.${PANEL_CLASS} .flyout {
position: absolute;
overflow: visible;
pointer-events: all;
-webkit-user-select: none;
width: auto !important;
filter: drop-shadow(0 0 10px rgba(0,0,0,0.5));
}
.${PANEL_CLASS} .flyout .caret,
.${PANEL_CLASS} .flyout [class*="caret"],
.${PANEL_CLASS} lol-uikit-flyout-frame .caret,
.${PANEL_CLASS} lol-uikit-flyout-frame [class*="caret"],
.${PANEL_CLASS} .flyout .caret::before,
.${PANEL_CLASS} .flyout .caret::after,
.${PANEL_CLASS} .flyout [class*="caret"]::before,
.${PANEL_CLASS} .flyout [class*="caret"]::after,
.${PANEL_CLASS} lol-uikit-flyout-frame .caret::before,
.${PANEL_CLASS} lol-uikit-flyout-frame .caret::after,
.${PANEL_CLASS} lol-uikit-flyout-frame [class*="caret"]::before,
.${PANEL_CLASS} lol-uikit-flyout-frame [class*="caret"]::after,
.${PANEL_CLASS} .flyout::part(caret),
.${PANEL_CLASS} lol-uikit-flyout-frame::part(caret),
.${PANEL_CLASS} lol-uikit-flyout-frame::before,
.${PANEL_CLASS} lol-uikit-flyout-frame::after,
.${PANEL_CLASS} .flyout::before,
.${PANEL_CLASS} .flyout::after {
display: none !important;
visibility: hidden !important;
content: none !important;
}
/* Tab Navigation */
/* ===== Unified Summary rows (category + status + change in one row) ===== */
.${PANEL_CLASS} .rose-wheel-right-header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
padding-bottom: 10px;
border-bottom: 1px solid #3c3c41;
margin-bottom: 10px;
flex-shrink: 0;
}
.${PANEL_CLASS} .rose-wheel-right-title {
font-weight: 700;
color: #f0e6d2;
font-size: 13px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
display: flex;
align-items: center;
gap: 6px;
}
.${PANEL_CLASS} .rose-wheel-right-title .rose-wheel-title-icon {
width: 18px;
height: 18px;
flex-shrink: 0;
}
.${PANEL_CLASS} .rose-wheel-right-title .rose-wheel-title-icon svg {
width: 18px;
height: 18px;
fill: none;
stroke: #c8aa6e;
stroke-width: 2;
stroke-linecap: round;
stroke-linejoin: round;
}
.${PANEL_CLASS} .rose-wheel-summary {
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
justify-content: flex-start;
gap: 6px;
padding: 6px 2px;
overflow-y: auto;
}
.${PANEL_CLASS} .rose-wheel-summary::-webkit-scrollbar { width: 6px; }
.${PANEL_CLASS} .rose-wheel-summary::-webkit-scrollbar-track { background: rgba(0,0,0,0.3); }
.${PANEL_CLASS} .rose-wheel-summary::-webkit-scrollbar-thumb { background: #5b5a56; border-radius: 3px; }
.${PANEL_CLASS} .rose-wheel-summary-row {
display: grid;
grid-template-columns: 1fr auto;
align-items: center;
gap: 12px;
padding: 8px;
border: 1px solid #3c3c41;
border-left: 3px solid transparent;
background: linear-gradient(to right, rgba(30, 35, 40, 0.8), rgba(30, 35, 40, 0.5));
transition: border-left-color 0.2s ease;
}
.${PANEL_CLASS} .rose-wheel-summary-row.active {
border-left: 3px solid #c8aa6e;
}
.${PANEL_CLASS} .rose-wheel-summary-row:hover .rose-wheel-summary-icon {
color: #c8aa6e;
}
.${PANEL_CLASS} .rose-wheel-summary-icon {
width: 18px;
height: 18px;
flex-shrink: 0;
color: #5b5a56;
transition: color 0.2s ease;
}
.${PANEL_CLASS} .rose-wheel-summary-icon svg {
width: 18px;
height: 18px;
fill: none;
stroke: currentColor;
stroke-width: 2;
stroke-linecap: round;
stroke-linejoin: round;
}
.${PANEL_CLASS} .rose-wheel-summary-left {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
gap: 6px;
}
.${PANEL_CLASS} .rose-wheel-summary-label {
color: #a09b8c;
font-size: 12px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.${PANEL_CLASS} .rose-wheel-summary-value {
color: #f0e6d2;
font-size: 13px;
font-weight: 700;
word-break: break-word;
}
.${PANEL_CLASS} .rose-wheel-picker {
flex: 1;
min-height: 0;
display: none;
}
.${PANEL_CLASS} .rose-wheel-picker.active {
display: flex;
flex-direction: column;
min-height: 0;
}
/* (Tab buttons removed from Summary UI; navigation is via per-row Change buttons) */
.${PANEL_CLASS} .tab-content {
display: none;
width: 100%;
background: transparent;
}
.${PANEL_CLASS} .tab-content.active {
display: flex;
flex-direction: column;
height: 100%;
}
/* Mod List Content */
.${PANEL_CLASS} .mod-selection {
pointer-events: all;
flex: 1;
min-height: 0;
overflow-y: auto;
overflow-x: hidden;
padding-right: 4px;
margin-top: 4px;
}
/* Scrollbar */
.${PANEL_CLASS} .mod-selection::-webkit-scrollbar {
width: 6px;
}
.${PANEL_CLASS} .mod-selection::-webkit-scrollbar-track {
background: rgba(0,0,0,0.3);
}
.${PANEL_CLASS} .mod-selection::-webkit-scrollbar-thumb {
background: #5b5a56;
border-radius: 3px;
}
.${PANEL_CLASS} .mod-selection ul {
list-style: none;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
gap: 6px;
}
/* List Items */
.${PANEL_CLASS} .mod-selection li {
background: linear-gradient(to right, rgba(30, 35, 40, 0.9), rgba(30, 35, 40, 0.6));
border: 1px solid #3c3c41;
border-left: 3px solid transparent;
padding: 10px;
transition: all 0.2s ease;
display: flex;
flex-direction: column;
gap: 4px;
border-radius: 0;
}
.${PANEL_CLASS} .mod-selection li:hover {
background: linear-gradient(to right, rgba(40, 45, 50, 0.9), rgba(40, 45, 50, 0.7));
border-color: #5c5c61;
border-left-color: #c8aa6e;
transform: translateX(2px);
}
.${PANEL_CLASS} .mod-selection li.selected-row {
border-left-color: #c8aa6e;
background: linear-gradient(to right, rgba(200, 170, 110, 0.12), rgba(30, 35, 40, 0.6));
}
.${PANEL_CLASS} .mod-selection li .mod-name.none-label {
font-style: italic;
color: #8b8b8b;
}
.${PANEL_CLASS} .mod-name-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
width: 100%;
}
.${PANEL_CLASS} .mod-name {
color: #f0e6d2;
font-size: 13px;
font-weight: 700;
letter-spacing: 0.5px;
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.${PANEL_CLASS} .mod-description {
color: #a09b8c;
font-size: 11px;
font-weight: 400;
line-height: 1.4;
word-wrap: break-word;
}
.${PANEL_CLASS} .mod-meta,
.${PANEL_CLASS} .mod-injection-note {
color: #7a7a7d;
font-size: 10px;
font-style: italic;
}
.${PANEL_CLASS} .mod-loading {
color: #a09b8c;
font-size: 12px;
text-align: center;
padding: 20px;
font-style: italic;
}
/* Action Buttons */
.${PANEL_CLASS} .mod-select-button {
background: transparent;
border: 1px solid #c8aa6e;
color: #c8aa6e;
padding: 4px 10px;
font-size: 11px;
font-weight: 700;
text-transform: uppercase;
cursor: pointer;
transition: all 0.2s;
flex-shrink: 0;
border-radius: 0;
}
.${PANEL_CLASS} .mod-select-button:hover {
background: rgba(200, 170, 110, 0.1);
box-shadow: 0 0 8px rgba(200, 170, 110, 0.2);
}
.${PANEL_CLASS} .mod-select-button.selected {
background: #c8aa6e;
color: #010a13;
box-shadow: 0 0 10px rgba(200, 170, 110, 0.4);
border-color: #c8aa6e;
}
`;
function injectCSS() {
const styleId = "rose-custom-wheel-css";
if (document.getElementById(styleId)) {
return;
}
const styleTag = document.createElement("style");
styleTag.id = styleId;
styleTag.textContent = CSS_RULES;
document.head.appendChild(styleTag);
}
function createButton() {
if (button) {
return button;
}
try {
button = document.createElement("lol-uikit-flat-button");
} catch (e) {
button = document.createElement("div");
}
button.className = "lol-uikit-flat-button idle rose-custom-wheel-button";
button.textContent = "Custom mods";
// Ensure button has relative positioning for badge (only if not already positioned)
const computedStyle = window.getComputedStyle(button);
if (computedStyle.position === "static" || computedStyle.position === "") {
button.style.position = "relative";
}
// Create count badge
const countBadge = document.createElement("div");
countBadge.className = "count-badge social-count-badge";
countBadge.textContent = "0";
countBadge.style.display = "none"; // Hidden by default
// Defaults (can be overridden live in DevTools on the element via CSS variables)
countBadge.style.setProperty("--rose-badge-top", "-4px");
countBadge.style.setProperty("--rose-badge-right", "-17px");
countBadge.style.setProperty("--rose-badge-left", "auto");
countBadge.style.setProperty("--rose-badge-translate-x", "60%");
countBadge.style.setProperty("--rose-badge-translate-y", "-60%");
button.appendChild(countBadge);
button._countBadge = countBadge; // Store reference
button.addEventListener("click", (event) => {
event.stopPropagation();
event.preventDefault();
isOpen ? closePanel() : openPanel();
});
return button;
}
function createPanel() {
if (panel) {
return panel;
}
// Remove existing panel if any
const existingPanel = document.getElementById(PANEL_ID);
if (existingPanel) {
existingPanel.remove();
}
panel = document.createElement("div");
panel.id = PANEL_ID;
panel.className = PANEL_CLASS;
panel.style.position = "fixed";
panel.style.top = "0";
panel.style.left = "0";
panel.style.width = "100%";
panel.style.height = "100%";
panel.style.zIndex = "10000";
panel.style.pointerEvents = "none";
panel.style.display = "none"; // Hidden by default
// Create flyout frame structure
let flyoutFrame;
try {
flyoutFrame = document.createElement("lol-uikit-flyout-frame");
flyoutFrame.className = "flyout";
flyoutFrame.setAttribute("orientation", "top");
flyoutFrame.setAttribute("animated", "false");
flyoutFrame.setAttribute("caretless", "true");
flyoutFrame.setAttribute("show", "true");
} catch (e) {
flyoutFrame = document.createElement("div");
flyoutFrame.className = "flyout";
}
flyoutFrame.style.position = "absolute";
flyoutFrame.style.overflow = "visible";
flyoutFrame.style.pointerEvents = "all";
let flyoutContent;
try {
flyoutContent = document.createElement("lc-flyout-content");
} catch (e) {
flyoutContent = document.createElement("div");
flyoutContent.className = "lc-flyout-content";
}
const modal = document.createElement("div");
modal.className = "champ-select-chroma-modal chroma-modal chroma-view ember-view";
// Header Decoration removed as per user request
const isOtherCategoryTab = (tabName) => OTHER_CATEGORY_TABS.some((t) => t.id === tabName);
const switchTab = (tabName) => {
if (!isSummaryTabVisible(tabName)) {
tabName = "skins";
}
activeTab = tabName;
// Update tab content
syncActiveTabContent();
// Request data for the active tab (always request fresh data)
if (tabName === "skins") {
requestModsForCurrentSkin();
} else if (tabName === "maps") {
requestMaps();
} else if (tabName === "fonts") {
requestFonts();
} else if (tabName === "announcers") {
requestAnnouncers();
} else if (isOtherCategoryTab(tabName)) {
if (lastCategoryModsById[tabName]) {
updateOtherCategoryEntries(tabName, lastCategoryModsById[tabName]);
} else {
requestCategoryMods(tabName);
}
}
// Update header title for picker context
if (panel && panel._rightTitle) {
if (rightPaneMode === "picker") {
const icon = SUMMARY_ICONS[activeTab] || "";
panel._rightTitle.innerHTML = `<span class="rose-wheel-title-icon">${icon}</span> Choose \u2022 ${escapeHtml(getTabLabel(activeTab))}`;
} else {
panel._rightTitle.textContent = "Custom Mods";
}
}
};
// Scrollable area for mod list
let scrollable;
try {
scrollable = document.createElement("lol-uikit-scrollable");
scrollable.className = "mod-selection";
scrollable.setAttribute("overflow-masks", "enabled");
} catch (e) {
scrollable = document.createElement("div");
scrollable.className = "mod-selection";
scrollable.style.overflowY = "auto";
}
// Create tab content containers
const modsContent = document.createElement("div");
modsContent.className = "tab-content active";
modsContent.dataset.tab = "skins";
const mapsContent = document.createElement("div");
mapsContent.className = "tab-content";
mapsContent.dataset.tab = "maps";
const fontsContent = document.createElement("div");
fontsContent.className = "tab-content";
fontsContent.dataset.tab = "fonts";
const announcersContent = document.createElement("div");
announcersContent.className = "tab-content";
announcersContent.dataset.tab = "announcers";
const otherContents = OTHER_CATEGORY_TABS.map((t) => {
const content = document.createElement("div");
content.className = "tab-content";
content.dataset.tab = t.id;
return content;
});
// Create ul lists for each tab
const modList = document.createElement("ul");
modList.style.listStyle = "none";
modList.style.margin = "0";
modList.style.padding = "0";
modList.style.display = "flex";
modList.style.flexDirection = "column";
modList.style.width = "100%";
modList.style.gap = "4px";
const mapsList = document.createElement("ul");
mapsList.style.listStyle = "none";
mapsList.style.margin = "0";
mapsList.style.padding = "0";
mapsList.style.display = "flex";
mapsList.style.flexDirection = "column";
mapsList.style.width = "100%";
mapsList.style.gap = "4px";
const fontsList = document.createElement("ul");
fontsList.style.listStyle = "none";
fontsList.style.margin = "0";
fontsList.style.padding = "0";
fontsList.style.display = "flex";
fontsList.style.flexDirection = "column";
fontsList.style.width = "100%";
fontsList.style.gap = "4px";
const announcersList = document.createElement("ul");
announcersList.style.listStyle = "none";
announcersList.style.margin = "0";
announcersList.style.padding = "0";
announcersList.style.display = "flex";
announcersList.style.flexDirection = "column";
announcersList.style.width = "100%";
announcersList.style.gap = "4px";
const createSimpleList = () => {
const ul = document.createElement("ul");
ul.style.listStyle = "none";
ul.style.margin = "0";
ul.style.padding = "0";
ul.style.display = "flex";
ul.style.flexDirection = "column";
ul.style.width = "100%";
ul.style.gap = "4px";
return ul;
};
const otherLists = OTHER_CATEGORY_TABS.reduce((acc, t) => {
acc[t.id] = createSimpleList();
return acc;
}, {});
// Loading elements for each tab
const modsLoading = document.createElement("div");
modsLoading.className = "mod-loading";
modsLoading.textContent = "Waiting for mods…";
modsLoading.style.display = "none";
const mapsLoading = document.createElement("div");
mapsLoading.className = "mod-loading";
mapsLoading.textContent = "Loading maps…";
mapsLoading.style.display = "none";
const fontsLoading = document.createElement("div");
fontsLoading.className = "mod-loading";
fontsLoading.textContent = "Loading fonts…";
fontsLoading.style.display = "none";
const announcersLoading = document.createElement("div");
announcersLoading.className = "mod-loading";
announcersLoading.textContent = "Loading announcers…";
announcersLoading.style.display = "none";
const otherLoadingEls = OTHER_CATEGORY_TABS.reduce((acc, t) => {
const el = document.createElement("div");
el.className = "mod-loading";
el.textContent = `Loading ${t.label.toLowerCase()}…`;
el.style.display = "none";
acc[t.id] = el;
return acc;
}, {});
// Assemble mods content
modsContent.appendChild(modsLoading);
modsContent.appendChild(modList);
// Assemble other tabs content
mapsContent.appendChild(mapsLoading);