ruslanmv commited on
Commit
c4d1a07
·
1 Parent(s): 08b1d69
Files changed (2) hide show
  1. index.html +0 -3
  2. script.js +20 -0
index.html CHANGED
@@ -48,7 +48,6 @@
48
  }
49
  });
50
 
51
- // Fetch the list of question sets from the PHP script
52
  async function fetchQuestionSets() {
53
  try {
54
  const response = await fetch("get_questions.php");
@@ -69,10 +68,8 @@
69
  });
70
  }
71
 
72
- // Call the fetchQuestionSets function when the page loads
73
  window.addEventListener("load", fetchQuestionSets);
74
 
75
- // Add event listeners for theme switcher and font size buttons
76
  const darkModeSwitch = document.getElementById("darkModeSwitch");
77
  const increaseFontSizeBtn = document.getElementById("increaseFontSize");
78
  const decreaseFontSizeBtn = document.getElementById("decreaseFontSize");
 
48
  }
49
  });
50
 
 
51
  async function fetchQuestionSets() {
52
  try {
53
  const response = await fetch("get_questions.php");
 
68
  });
69
  }
70
 
 
71
  window.addEventListener("load", fetchQuestionSets);
72
 
 
73
  const darkModeSwitch = document.getElementById("darkModeSwitch");
74
  const increaseFontSizeBtn = document.getElementById("increaseFontSize");
75
  const decreaseFontSizeBtn = document.getElementById("decreaseFontSize");
script.js CHANGED
@@ -368,3 +368,23 @@ increaseFontSizeBtn.addEventListener("click", () => {
368
  decreaseFontSizeBtn.addEventListener("click", () => {
369
  document.body.style.fontSize = "smaller";
370
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
368
  decreaseFontSizeBtn.addEventListener("click", () => {
369
  document.body.style.fontSize = "smaller";
370
  });
371
+
372
+ document.addEventListener("DOMContentLoaded", () => {
373
+ const darkModeSwitch = document.getElementById("darkModeSwitch");
374
+ const increaseFontSizeBtn = document.getElementById("increaseFontSize");
375
+ const decreaseFontSizeBtn = document.getElementById("decreaseFontSize");
376
+
377
+ darkModeSwitch.addEventListener("change", () => {
378
+ document.body.classList.toggle("dark-mode", darkModeSwitch.checked);
379
+ });
380
+
381
+ increaseFontSizeBtn.addEventListener("click", () => {
382
+ document.body.style.fontSize = "larger";
383
+ });
384
+
385
+ decreaseFontSizeBtn.addEventListener("click", () => {
386
+ document.body.style.fontSize = "smaller";
387
+ });
388
+
389
+ // Add other functionalities as required
390
+ });