ViannyCruz commited on
Commit
10b4bde
·
verified ·
1 Parent(s): 3c88e11

Update web/index.html

Browse files
Files changed (1) hide show
  1. web/index.html +41 -27
web/index.html CHANGED
@@ -1986,35 +1986,47 @@
1986
  });
1987
  </script>
1988
  <script>
1989
- function _initFeather() {
1990
- if (typeof feather !== 'undefined') feather.replace({ 'stroke-width': 1.8 });
 
 
 
 
 
 
1991
  }
1992
-
1993
- document.addEventListener('DOMContentLoaded', _initFeather);
1994
-
1995
- var _fObserver = new MutationObserver(function(mutations) {
1996
- var hasNew = mutations.some(function(m) {
1997
- return Array.from(m.addedNodes).some(function(n) {
1998
- return n.nodeType === 1; // solo elementos, no texto
 
 
 
 
 
 
1999
  });
2000
  });
2001
- if (hasNew) _initFeather();
2002
- });
2003
-
2004
- document.addEventListener('DOMContentLoaded', function() {
2005
- _fObserver.observe(document.body, { childList: true, subtree: true });
2006
-
2007
- document.addEventListener('visibilitychange', function() {
2008
- // noop — feather no necesita re-renderizar al focus
2009
- });
2010
  });
 
 
 
2011
  </script>
2012
 
2013
  <script>
2014
  (function () {
2015
  function applyTheme(theme) {
2016
- const lightTheme = document.getElementById('lightTheme');
2017
- const darkTheme = document.getElementById('darkTheme');
 
2018
  if (theme === 'dark') {
2019
  lightTheme.disabled = true;
2020
  darkTheme.disabled = false;
@@ -2024,27 +2036,29 @@
2024
  darkTheme.disabled = true;
2025
  document.documentElement.style.backgroundColor = '';
2026
  }
2027
- document.documentElement.style.visibility = 'visible';
2028
  }
2029
 
 
2030
  applyTheme(localStorage.getItem('theme') || 'light');
2031
 
2032
- window.addEventListener('storage', function(e) {
 
2033
  if (e.key === 'theme') applyTheme(e.newValue);
2034
  });
2035
 
2036
- // ✅ SIN overlay — causa el flash blanco al cambiar pestaña
2037
  function switchTheme() {
2038
- const darkTheme = document.getElementById('darkTheme');
2039
- const newTheme = darkTheme.disabled ? 'dark' : 'light';
 
2040
  applyTheme(newTheme);
2041
  localStorage.setItem('theme', newTheme);
2042
  }
2043
 
2044
  document.addEventListener('DOMContentLoaded', function () {
2045
- const btn = document.getElementById('modeSwitcher');
2046
  if (!btn) return;
2047
- const newBtn = btn.cloneNode(true);
2048
  btn.parentNode.replaceChild(newBtn, btn);
2049
  newBtn.addEventListener('click', function (e) {
2050
  e.preventDefault();
 
1986
  });
1987
  </script>
1988
  <script>
1989
+ (function () {
1990
+ // Feather: reemplazar SOLO íconos que aún son <i>, nunca tocar SVGs ya renderizados
1991
+ function _initFeather() {
1992
+ if (typeof feather === 'undefined') return;
1993
+ // Solo actuar si hay elementos <i data-feather> sin reemplazar todavía
1994
+ var pending = document.querySelectorAll('i[data-feather]');
1995
+ if (pending.length > 0) {
1996
+ feather.replace({ 'stroke-width': 1.8 });
1997
  }
1998
+ }
1999
+
2000
+ document.addEventListener('DOMContentLoaded', _initFeather);
2001
+
2002
+ var _fObserverActive = false;
2003
+ document.addEventListener('DOMContentLoaded', function () {
2004
+ var observer = new MutationObserver(function (mutations) {
2005
+ if (_fObserverActive) return; // evitar loops
2006
+ var hasPendingFeather = mutations.some(function (m) {
2007
+ return Array.from(m.addedNodes).some(function (n) {
2008
+ if (n.nodeType !== 1) return false;
2009
+ // Solo disparar si el nodo agregado tiene <i data-feather> dentro
2010
+ return n.matches('i[data-feather]') || n.querySelector('i[data-feather]');
2011
  });
2012
  });
2013
+ if (hasPendingFeather) {
2014
+ _fObserverActive = true;
2015
+ _initFeather();
2016
+ setTimeout(function () { _fObserverActive = false; }, 50);
2017
+ }
 
 
 
 
2018
  });
2019
+ observer.observe(document.body, { childList: true, subtree: true });
2020
+ });
2021
+ })();
2022
  </script>
2023
 
2024
  <script>
2025
  (function () {
2026
  function applyTheme(theme) {
2027
+ var lightTheme = document.getElementById('lightTheme');
2028
+ var darkTheme = document.getElementById('darkTheme');
2029
+ if (!lightTheme || !darkTheme) return;
2030
  if (theme === 'dark') {
2031
  lightTheme.disabled = true;
2032
  darkTheme.disabled = false;
 
2036
  darkTheme.disabled = true;
2037
  document.documentElement.style.backgroundColor = '';
2038
  }
2039
+ // ✅ NO tocar visibility aquí — solo el script del <head> debe hacerlo al cargar
2040
  }
2041
 
2042
+ // Aplicar tema guardado (sin tocar visibility)
2043
  applyTheme(localStorage.getItem('theme') || 'light');
2044
 
2045
+ // Sincronizar entre pestañas
2046
+ window.addEventListener('storage', function (e) {
2047
  if (e.key === 'theme') applyTheme(e.newValue);
2048
  });
2049
 
 
2050
  function switchTheme() {
2051
+ var darkTheme = document.getElementById('darkTheme');
2052
+ if (!darkTheme) return;
2053
+ var newTheme = darkTheme.disabled ? 'dark' : 'light';
2054
  applyTheme(newTheme);
2055
  localStorage.setItem('theme', newTheme);
2056
  }
2057
 
2058
  document.addEventListener('DOMContentLoaded', function () {
2059
+ var btn = document.getElementById('modeSwitcher');
2060
  if (!btn) return;
2061
+ var newBtn = btn.cloneNode(true);
2062
  btn.parentNode.replaceChild(newBtn, btn);
2063
  newBtn.addEventListener('click', function (e) {
2064
  e.preventDefault();