privateuserh commited on
Commit
d774e4e
·
verified ·
1 Parent(s): 5f0a446

Update main.js

Browse files
Files changed (1) hide show
  1. main.js +29 -9
main.js CHANGED
@@ -25,22 +25,42 @@ document.addEventListener('DOMContentLoaded', () => {
25
  console.log('The settings button element is:', settingsBtn); // <-- ADD THIS LINE
26
  const settingsModal = document.getElementById('settingsModal');
27
  const closeSettingsModal = document.getElementById('closeSettingsModal');
28
- // --- NEW ON-SCREEN DEBUG CODE ---
29
- // This will test if the settings button was found correctly.
30
 
31
  const debugLog = document.getElementById('debug-log');
 
 
 
 
 
 
32
  if (settingsBtn) {
33
- // SUCCESS! The button was found.
34
- debugLog.textContent = "DEBUG LOG:\n\n'settingsBtn' was FOUND successfully.";
35
- // Change style to green to show success
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  debugLog.style.borderColor = '#4F8A10';
37
  debugLog.style.color = '#4F8A10';
38
  debugLog.style.backgroundColor = '#DFF2BF';
39
- } else {
40
- // ERROR! The button was not found.
41
- debugLog.textContent = "DEBUG LOG:\n\n'settingsBtn' was NOT FOUND.\n\nJavaScript got 'null' when searching for the element with id='settingsBtn'.\n\nThis means there is a typo in the 'id' attribute of the settings button in your index.html file.";
42
  }
43
- // --- END OF NEW DEBUG CODE ---
44
 
45
  // --- CORE FUNCTIONS (for AR and Data) ---
46
 
 
25
  console.log('The settings button element is:', settingsBtn); // <-- ADD THIS LINE
26
  const settingsModal = document.getElementById('settingsModal');
27
  const closeSettingsModal = document.getElementById('closeSettingsModal');
28
+ // --- ADVANCED ON-SCREEN DEBUG CODE ---
29
+ // This will test for BOTH the button and the modal window.
30
 
31
  const debugLog = document.getElementById('debug-log');
32
+ debugLog.style.display = 'block'; // Make sure the box is visible
33
+
34
+ let debugMessage = "DEBUG LOG:\n\n";
35
+ let testsPassed = true;
36
+
37
+ // Test 1: Check for the settings button
38
  if (settingsBtn) {
39
+ debugMessage += "✅ Test 1: 'settingsBtn' was FOUND successfully.\n";
40
+ } else {
41
+ debugMessage += "❌ Test 1: 'settingsBtn' was NOT FOUND (is null).\n";
42
+ testsPassed = false;
43
+ }
44
+
45
+ // Test 2: Check for the settings modal window itself
46
+ if (settingsModal) {
47
+ debugMessage += "✅ Test 2: 'settingsModal' was FOUND successfully.\n";
48
+ } else {
49
+ debugMessage += "❌ Test 2: 'settingsModal' was NOT FOUND (is null).\n\n";
50
+ debugMessage += "This is the problem. Please check your index.html file for an element with id='settingsModal' and fix any typos.";
51
+ testsPassed = false;
52
+ }
53
+
54
+ // Display the final results and set the color
55
+ debugLog.textContent = debugMessage;
56
+
57
+ if (testsPassed) {
58
+ // If everything passed, turn the box green
59
  debugLog.style.borderColor = '#4F8A10';
60
  debugLog.style.color = '#4F8A10';
61
  debugLog.style.backgroundColor = '#DFF2BF';
 
 
 
62
  }
63
+ // --- END OF ADVANCED DEBUG CODE ---
64
 
65
  // --- CORE FUNCTIONS (for AR and Data) ---
66