4sp-dv 1.0.21 → 1.0.22
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/4simpleproblems_v5.html +53 -4
- package/logged-in/soundboard.html +13 -1
- package/package.json +1 -1
package/4simpleproblems_v5.html
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<title>4SP - VERSION 5 CLIENT</title>
|
|
7
7
|
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/npm/4sp-dv@latest/images/logo.png">
|
|
8
8
|
|
|
9
|
-
<base href="https://cdn.jsdelivr.net/npm/4sp-dv@1.0.
|
|
9
|
+
<base href="https://cdn.jsdelivr.net/npm/4sp-dv@1.0.21/logged-in/">
|
|
10
10
|
<script src="https://cdn.tailwindcss.com"></script>
|
|
11
11
|
<link href="https://fonts.googleapis.com/css2?family=Geist:wght@100..900&display=swap" rel="stylesheet">
|
|
12
12
|
|
|
@@ -759,7 +759,7 @@
|
|
|
759
759
|
const displayUsername = document.getElementById('display-username');
|
|
760
760
|
const displayEmail = document.getElementById('display-email');
|
|
761
761
|
|
|
762
|
-
const BASE_URL = 'https://cdn.jsdelivr.net/npm/4sp-dv@1.0.
|
|
762
|
+
const BASE_URL = 'https://cdn.jsdelivr.net/npm/4sp-dv@1.0.21/logged-in/';
|
|
763
763
|
const STORAGE_KEY = 'local_access_code';
|
|
764
764
|
const USER_DATA_KEY = 'local_user_data';
|
|
765
765
|
const LAST_PAGE_KEY = 'local_last_page';
|
|
@@ -785,7 +785,9 @@
|
|
|
785
785
|
function initAdminKeybinds(db, auth, user) {
|
|
786
786
|
console.log("[Admin Keybinds] Initializing for", user.uid);
|
|
787
787
|
let explicitEnabled = true;
|
|
788
|
+
let thirdPartyEnabled = true; // Track third party state
|
|
788
789
|
let lastEnablePressTime = 0;
|
|
790
|
+
let lastThirdPartyEnablePressTime = 0; // Separate timer for third party
|
|
789
791
|
let configUnsubscribe = null;
|
|
790
792
|
|
|
791
793
|
// Visual Feedback Helper
|
|
@@ -857,9 +859,14 @@
|
|
|
857
859
|
explicitEnabled = data.explicitEnabled;
|
|
858
860
|
console.log(`[Admin Keybinds] Explicit Enabled: ${explicitEnabled}`);
|
|
859
861
|
}
|
|
862
|
+
if (data.thirdPartyEnabled !== undefined) {
|
|
863
|
+
thirdPartyEnabled = data.thirdPartyEnabled;
|
|
864
|
+
console.log(`[Admin Keybinds] Third Party Enabled: ${thirdPartyEnabled}`);
|
|
865
|
+
}
|
|
860
866
|
} else {
|
|
861
867
|
console.log("[Admin Keybinds] Config doc missing. Defaulting to TRUE.");
|
|
862
868
|
explicitEnabled = true;
|
|
869
|
+
thirdPartyEnabled = true;
|
|
863
870
|
}
|
|
864
871
|
}, (error) => console.error("Config Listen Error:", error));
|
|
865
872
|
}
|
|
@@ -867,7 +874,7 @@
|
|
|
867
874
|
// Init Listener
|
|
868
875
|
subscribeToConfig();
|
|
869
876
|
|
|
870
|
-
// EXPOSE GLOBAL
|
|
877
|
+
// EXPOSE GLOBAL TRIGGERS
|
|
871
878
|
window.triggerAdminKeybind = async () => {
|
|
872
879
|
console.log("[Admin Keybinds] Triggered via global function.");
|
|
873
880
|
if (explicitEnabled) {
|
|
@@ -901,14 +908,50 @@
|
|
|
901
908
|
}
|
|
902
909
|
}
|
|
903
910
|
};
|
|
911
|
+
|
|
912
|
+
window.triggerThirdPartyKeybind = async () => {
|
|
913
|
+
console.log("[Admin Keybinds] Triggered Third Party toggle.");
|
|
914
|
+
if (thirdPartyEnabled) {
|
|
915
|
+
// Disable (Immediate)
|
|
916
|
+
try {
|
|
917
|
+
await setDoc(doc(db, 'config', 'soundboard'), { thirdPartyEnabled: false }, { merge: true });
|
|
918
|
+
showAdminToast("Third Party Sounds: HIDDEN", "red");
|
|
919
|
+
lastThirdPartyEnablePressTime = 0;
|
|
920
|
+
} catch (err) {
|
|
921
|
+
console.error("[Admin Keybinds] Failed to disable:", err);
|
|
922
|
+
showAdminToast("Error: Check Console", "red");
|
|
923
|
+
}
|
|
924
|
+
} else {
|
|
925
|
+
// Enable (Double Press Safety)
|
|
926
|
+
const now = Date.now();
|
|
927
|
+
if (now - lastThirdPartyEnablePressTime < 1500) {
|
|
928
|
+
try {
|
|
929
|
+
await setDoc(doc(db, 'config', 'soundboard'), { thirdPartyEnabled: true }, { merge: true });
|
|
930
|
+
showAdminToast("Third Party Sounds: SHOWN", "green");
|
|
931
|
+
lastThirdPartyEnablePressTime = 0;
|
|
932
|
+
} catch (err) {
|
|
933
|
+
console.error("[Admin Keybinds] Failed to enable:", err);
|
|
934
|
+
showAdminToast("Error: Check Console", "red");
|
|
935
|
+
}
|
|
936
|
+
} else {
|
|
937
|
+
showAdminToast("Press Ctrl+Shift+T again to SHOW", "blue");
|
|
938
|
+
lastThirdPartyEnablePressTime = now;
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
};
|
|
904
942
|
|
|
905
943
|
// Key Listener (Parent Window)
|
|
906
944
|
document.addEventListener('keydown', async (e) => {
|
|
907
|
-
//
|
|
945
|
+
// Trigger is Ctrl + Shift + E
|
|
908
946
|
if (e.ctrlKey && e.shiftKey && (e.key.toLowerCase() === 'e' || e.code === 'KeyE')) {
|
|
909
947
|
e.preventDefault();
|
|
910
948
|
window.triggerAdminKeybind();
|
|
911
949
|
}
|
|
950
|
+
// Trigger is Ctrl + Shift + T
|
|
951
|
+
if (e.ctrlKey && e.shiftKey && (e.key.toLowerCase() === 't' || e.code === 'KeyT')) {
|
|
952
|
+
e.preventDefault();
|
|
953
|
+
window.triggerThirdPartyKeybind();
|
|
954
|
+
}
|
|
912
955
|
});
|
|
913
956
|
}
|
|
914
957
|
|
|
@@ -1463,6 +1506,12 @@
|
|
|
1463
1506
|
if (window.parent.triggerAdminKeybind) window.parent.triggerAdminKeybind();
|
|
1464
1507
|
}
|
|
1465
1508
|
|
|
1509
|
+
// Forward Admin Keybind (Ctrl + Shift + T) - Third Party Check
|
|
1510
|
+
if (e.ctrlKey && e.shiftKey && (e.key.toLowerCase() === 't' || e.code === 'KeyT')) {
|
|
1511
|
+
e.preventDefault();
|
|
1512
|
+
if (window.parent.triggerThirdPartyKeybind) window.parent.triggerThirdPartyKeybind();
|
|
1513
|
+
}
|
|
1514
|
+
|
|
1466
1515
|
// Typing Sound (Standard Inputs)
|
|
1467
1516
|
const target = e.target;
|
|
1468
1517
|
const isInput = target.tagName === 'INPUT' || target.tagName === 'TEXTAREA';
|
|
@@ -341,7 +341,7 @@ body:not(.no-animations) .btn-toolbar-style:active, body:not(.no-animations) .bt
|
|
|
341
341
|
<div id="explicitSoundsContainer" class="sound-grid"></div>
|
|
342
342
|
</div>
|
|
343
343
|
|
|
344
|
-
<div class="mb-10">
|
|
344
|
+
<div class="mb-10" id="thirdPartySectionWrapper">
|
|
345
345
|
<h2 class="section-header text-blue-400/80 border-blue-900/30">Third Party Sounds</h2>
|
|
346
346
|
<div id="thirdPartySoundsContainer" class="sound-grid">
|
|
347
347
|
<div class="text-gray-500 italic col-span-full text-center p-10">Loading sounds from CDN...</div>
|
|
@@ -429,6 +429,7 @@ body:not(.no-animations) .btn-toolbar-style:active, body:not(.no-animations) .bt
|
|
|
429
429
|
const explicitSoundsContainer = document.getElementById('explicitSoundsContainer');
|
|
430
430
|
const thirdPartySoundsContainer = document.getElementById('thirdPartySoundsContainer');
|
|
431
431
|
const explicitSectionWrapper = document.getElementById('explicitSectionWrapper');
|
|
432
|
+
const thirdPartySectionWrapper = document.getElementById('thirdPartySectionWrapper');
|
|
432
433
|
|
|
433
434
|
// --- Soundboard Logic State ---
|
|
434
435
|
let playingAudios = [];
|
|
@@ -466,14 +467,25 @@ body:not(.no-animations) .btn-toolbar-style:active, body:not(.no-animations) .bt
|
|
|
466
467
|
// Optional: Ensure any "explicit" sounds stop playing if they were active?
|
|
467
468
|
// For now we just hide the section as per typical admin toggle logic
|
|
468
469
|
}
|
|
470
|
+
|
|
471
|
+
// Admin toggle logic for "thirdPartyEnabled". Default to true.
|
|
472
|
+
const isThirdPartyEnabled = data.thirdPartyEnabled !== false;
|
|
473
|
+
|
|
474
|
+
if (isThirdPartyEnabled) {
|
|
475
|
+
thirdPartySectionWrapper.style.display = 'block';
|
|
476
|
+
} else {
|
|
477
|
+
thirdPartySectionWrapper.style.display = 'none';
|
|
478
|
+
}
|
|
469
479
|
} else {
|
|
470
480
|
// Doc doesn't exist? Default to true.
|
|
471
481
|
explicitSectionWrapper.style.display = 'block';
|
|
482
|
+
thirdPartySectionWrapper.style.display = 'block';
|
|
472
483
|
}
|
|
473
484
|
}, (error) => {
|
|
474
485
|
console.warn("Config listener error:", error);
|
|
475
486
|
// Fallback to visible on error
|
|
476
487
|
explicitSectionWrapper.style.display = 'block';
|
|
488
|
+
thirdPartySectionWrapper.style.display = 'block';
|
|
477
489
|
});
|
|
478
490
|
}
|
|
479
491
|
|