diff --git a/404.html b/404.html index 48b4cc3..2de611f 100644 --- a/404.html +++ b/404.html @@ -4,6 +4,7 @@ + 404 Not Found | HouseLearning diff --git a/also.js b/also.js new file mode 100644 index 0000000..dd72f79 --- /dev/null +++ b/also.js @@ -0,0 +1,279 @@ +// also.js โ€” FULL PLUGIN + +/* ============================== + ๐Ÿ“ฆ FIREBASE IMPORTS + ============================== */ +import { + initializeApp, + getApps, + getApp +} from "https://www.gstatic.com/firebasejs/9.23.0/firebase-app.js"; + +import { + getAuth, + onAuthStateChanged +} from "https://www.gstatic.com/firebasejs/9.23.0/firebase-auth.js"; + +import { + getDatabase, + ref, + push +} from "https://www.gstatic.com/firebasejs/9.23.0/firebase-database.js"; + +/* ============================== + ๐Ÿ”ฅ FALLBACK FIREBASE CONFIG + ============================== */ +const fallbackFirebaseConfig = { + apiKey: "AIzaSyDoXSwni65CuY1_32ZE8B1nwfQO_3VNpTw", + authDomain: "contract-center-llc-10.firebaseapp.com", + projectId: "contract-center-llc-10", + storageBucket: "contract-center-llc-10.firebasestorage.app", + messagingSenderId: "323221512767", + appId: "1:323221512767:web:6421260f875997dbf64e8a", +}; + +/* ============================== + ๐Ÿง  GLOBAL STATE + ============================== */ +const state = { + loggedIn: false, + uuid: "anonymous", + devtoolsOpen: false +}; + +/* ============================== + ๐Ÿ”ฅ FIREBASE INIT (SMART) + ============================== */ +let app; + +if (getApps().length > 0) { + app = getApp(); + console.log("[ALSO] Using existing Firebase app"); +} else { + app = initializeApp(fallbackFirebaseConfig); + console.log("[ALSO] Initialized Firebase internally"); +} + +const auth = getAuth(app); +const db = getDatabase(app); + +/* ============================== + ๐Ÿ” AUTH STATE TRACKING + ============================== */ +onAuthStateChanged(auth, (user) => { + if (user) { + state.loggedIn = true; + state.uuid = user.uid; + console.log("[ALSO] User is LOGGED IN:", user.uid); + } else { + state.loggedIn = false; + state.uuid = "anonymous"; + console.log("[ALSO] User is NOT LOGGED IN"); + } +}); + +/* ============================== + ๐Ÿงพ FIREBASE LOGGER + ============================== */ +function logToFirebase(payload) { + try { + push(ref(db, "WarnedTickedDevTools"), { + ...payload, + userUUID: state.uuid, + loggedIn: state.loggedIn, + time: Date.now() + }); + } catch (e) { + console.warn("[ALSO] Firebase logging failed"); + } +} + +/* ============================== + ๐Ÿง  DEVTOOLS DETECTION + ============================== */ +function detectDevTools() { + const threshold = 160; + const opened = + window.outerWidth - window.innerWidth > threshold || + window.outerHeight - window.innerHeight > threshold; + + if (opened && !state.devtoolsOpen) { + state.devtoolsOpen = true; + + console.warn( + "โš ๏ธ WARNING: The Developer Console is not to be used. Misuse may result in punishment." + ); + + console.error("โŒ Your DevTools attempt was logged"); + + logToFirebase({ + attemptID: crypto.randomUUID(), + event: "DevToolsOpened" + }); + } +} + +setInterval(detectDevTools, 1000); + +/* ============================== + ๐Ÿชค CONSOLE INTERCEPT (BEST-EFFORT) + ============================== */ +["log", "warn", "error"].forEach((method) => { + const original = console[method]; + + console[method] = (...args) => { + if (state.devtoolsOpen) { + const text = args.join(" ").slice(0, 300); + logToFirebase({ + attemptID: crypto.randomUUID(), + pastedContent: text + }); + } + original.apply(console, args); + }; +}); + +/* ============================== + ๐ŸŒ LANGUAGE SETTINGS (ALT + L) + ============================== */ +document.addEventListener("keydown", (e) => { + if (e.altKey && e.key.toLowerCase() === "l") { + openLanguageModal(); + } +}); + +function openLanguageModal() { + if (document.getElementById("also-lang-modal")) return; + + const modal = document.createElement("div"); + modal.id = "also-lang-modal"; + modal.innerHTML = ` +
+
+ +

Language Settings

+ + +
+
+ `; + document.body.appendChild(modal); + + document.getElementById("also-close").onclick = () => modal.remove(); + + document.getElementById("also-save").onclick = () => { + const lang = document.getElementById("also-lang-select").value; + localStorage.setItem("also-lang", lang); + applyTranslation(lang); + modal.remove(); + }; +} + +/* ============================== + ๐ŸŒ FULL PAGE GOOGLE TRANSLATE + TAB + ============================== */ +function applyTranslation(lang) { + if (lang === "en") { + removeTranslationTab(); + return; + } + + let container = document.getElementById("google_translate_element"); + if (!container) { + container = document.createElement("div"); + container.id = "google_translate_element"; + container.style.display = "none"; + document.body.appendChild(container); + } + + if (!window.googleTranslateScriptLoaded) { + const script = document.createElement("script"); + script.src = + "https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"; + document.body.appendChild(script); + window.googleTranslateScriptLoaded = true; + } + + window.googleTranslateElementInit = function () { + new google.translate.TranslateElement( + { pageLanguage: "en", includedLanguages: lang, autoDisplay: true }, + "google_translate_element" + ); + + setTimeout(() => { + const select = document.querySelector(".goog-te-combo"); + if (select) { + select.value = lang; + select.dispatchEvent(new Event("change")); + createTranslationTab(); + } + }, 1000); + }; +} + +/* ============================== + ๐ŸŸข TRANSLATION TAB + ============================== */ +function createTranslationTab() { + if (document.getElementById("also-translation-tab")) return; + + const tab = document.createElement("div"); + tab.id = "also-translation-tab"; + tab.innerText = "Page Translated"; + Object.assign(tab.style, { + position: "fixed", + bottom: "16px", + right: "16px", + background: "#007bff", + color: "#fff", + padding: "8px 12px", + borderRadius: "6px", + cursor: "pointer", + zIndex: "999999", + fontFamily: "sans-serif", + fontSize: "14px", + boxShadow: "0 2px 6px rgba(0,0,0,0.3)" + }); + + tab.addEventListener("click", () => { + const el = document.getElementById("google_translate_element"); + if (el) el.scrollIntoView({ behavior: "smooth", block: "center" }); + }); + + document.body.appendChild(tab); +} + +function removeTranslationTab() { + const tab = document.getElementById("also-translation-tab"); + if (tab) tab.remove(); +} + +/* ============================== + ๐Ÿ” AUTO-APPLY SAVED LANGUAGE + ============================== */ +const savedLang = localStorage.getItem("also-lang"); +if (savedLang) applyTranslation(savedLang); diff --git a/assets/ampler-launcher/index.html b/assets/ampler-launcher/index.html index 5e41388..3545c2b 100644 --- a/assets/ampler-launcher/index.html +++ b/assets/ampler-launcher/index.html @@ -16,6 +16,7 @@ + diff --git a/blog.html b/blog.html index ccb117d..805b0f0 100644 --- a/blog.html +++ b/blog.html @@ -9,6 +9,7 @@ + HouseLearning | Blog