ViannyCruz commited on
Commit
92c7351
·
verified ·
1 Parent(s): 2fc85e6

Update web/diagnosis.html

Browse files
Files changed (1) hide show
  1. web/diagnosis.html +4 -22
web/diagnosis.html CHANGED
@@ -1462,7 +1462,6 @@ if (false) { /* removed */ }
1462
  </script>
1463
  <script>
1464
  (function () {
1465
- // 1. Aplicar tema guardado al cargar
1466
  function applyTheme(theme) {
1467
  const lightTheme = document.getElementById('lightTheme');
1468
  const darkTheme = document.getElementById('darkTheme');
@@ -1473,18 +1472,15 @@ if (false) { /* removed */ }
1473
  lightTheme.disabled = false;
1474
  darkTheme.disabled = true;
1475
  }
 
1476
  }
1477
 
1478
  applyTheme(localStorage.getItem('theme') || 'light');
1479
 
1480
- // 2. Escuchar cambios desde OTRAS pestañas
1481
  window.addEventListener('storage', function(e) {
1482
- if (e.key === 'theme') {
1483
- applyTheme(e.newValue);
1484
- }
1485
  });
1486
 
1487
- // 3. Overlay de transición
1488
  const overlay = document.createElement('div');
1489
  overlay.id = 'theme-overlay';
1490
  overlay.style.cssText = [
@@ -1496,13 +1492,13 @@ if (false) { /* removed */ }
1496
 
1497
  function switchTheme() {
1498
  const darkTheme = document.getElementById('darkTheme');
1499
- const goingDark = darkTheme.disabled; // si está disabled, vamos a dark
1500
  overlay.style.background = goingDark ? '#fff' : '#1a1a2e';
1501
  overlay.style.opacity = '1';
1502
  setTimeout(function () {
1503
  const newTheme = goingDark ? 'dark' : 'light';
1504
  applyTheme(newTheme);
1505
- localStorage.setItem('theme', newTheme); // 👈 esto dispara el evento en otras pestañas
1506
  setTimeout(function () { overlay.style.opacity = '0'; }, 50);
1507
  }, 180);
1508
  }
@@ -1519,20 +1515,6 @@ if (false) { /* removed */ }
1519
  });
1520
  });
1521
  })();
1522
-
1523
- function applyTheme(theme) {
1524
- const lightTheme = document.getElementById('lightTheme');
1525
- const darkTheme = document.getElementById('darkTheme');
1526
- if (theme === 'dark') {
1527
- lightTheme.disabled = true;
1528
- darkTheme.disabled = false;
1529
- } else {
1530
- lightTheme.disabled = false;
1531
- darkTheme.disabled = true;
1532
- }
1533
- // 👇 Revelar la página una vez aplicado el tema
1534
- document.documentElement.style.visibility = 'visible';
1535
- }
1536
  </script>
1537
  </body>
1538
  </html>
 
1462
  </script>
1463
  <script>
1464
  (function () {
 
1465
  function applyTheme(theme) {
1466
  const lightTheme = document.getElementById('lightTheme');
1467
  const darkTheme = document.getElementById('darkTheme');
 
1472
  lightTheme.disabled = false;
1473
  darkTheme.disabled = true;
1474
  }
1475
+ document.documentElement.style.visibility = 'visible';
1476
  }
1477
 
1478
  applyTheme(localStorage.getItem('theme') || 'light');
1479
 
 
1480
  window.addEventListener('storage', function(e) {
1481
+ if (e.key === 'theme') applyTheme(e.newValue);
 
 
1482
  });
1483
 
 
1484
  const overlay = document.createElement('div');
1485
  overlay.id = 'theme-overlay';
1486
  overlay.style.cssText = [
 
1492
 
1493
  function switchTheme() {
1494
  const darkTheme = document.getElementById('darkTheme');
1495
+ const goingDark = darkTheme.disabled;
1496
  overlay.style.background = goingDark ? '#fff' : '#1a1a2e';
1497
  overlay.style.opacity = '1';
1498
  setTimeout(function () {
1499
  const newTheme = goingDark ? 'dark' : 'light';
1500
  applyTheme(newTheme);
1501
+ localStorage.setItem('theme', newTheme);
1502
  setTimeout(function () { overlay.style.opacity = '0'; }, 50);
1503
  }, 180);
1504
  }
 
1515
  });
1516
  });
1517
  })();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1518
  </script>
1519
  </body>
1520
  </html>