Adieee5 commited on
Commit
5febeaf
·
verified ·
1 Parent(s): 4ba8741

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +11 -11
templates/index.html CHANGED
@@ -36,17 +36,17 @@
36
 
37
  <script>
38
  window.addEventListener("message", (event) => {
39
- if (event.origin !== "https://juit-ai-assistant.vercel.app/assistant") return; // security
40
- const {
41
- type,
42
- theme
43
- } = event.data;
44
-
45
- if (type === "set-theme" && (theme === "light" || theme === "dark")) {
46
- document.documentElement.setAttribute("data-theme", theme);
47
- // Or, toggle class if your app uses class-based dark mode:
48
- document.documentElement.classList.toggle("dark", theme === "dark");
49
- }
50
  });
51
 
52
  const API_BASE_URL = window.location.origin;
 
36
 
37
  <script>
38
  window.addEventListener("message", (event) => {
39
+ // Temporarily allow all origins for testing
40
+ // Later: if (event.origin !== "https://juit-ai-assistant.vercel.app") return;
41
+
42
+ const { type, theme } = event.data;
43
+
44
+ if (type === "set-theme" && (theme === "light" || theme === "dark")) {
45
+ // Set theme via class or attribute
46
+ document.documentElement.classList.toggle("dark", theme === "dark");
47
+ document.body.classList.toggle("dark", theme === "dark");
48
+ console.log("Theme set to:", theme);
49
+ }
50
  });
51
 
52
  const API_BASE_URL = window.location.origin;