Update web/index.html
Browse files- web/index.html +49 -26
web/index.html
CHANGED
|
@@ -1986,39 +1986,62 @@
|
|
| 1986 |
_fObserver.observe(document.body, { childList: true, subtree: true });
|
| 1987 |
});
|
| 1988 |
</script>
|
| 1989 |
-
|
| 1990 |
(function () {
|
| 1991 |
|
| 1992 |
-
//
|
| 1993 |
-
const
|
| 1994 |
-
|
| 1995 |
-
|
| 1996 |
-
'
|
| 1997 |
-
'
|
| 1998 |
-
'
|
| 1999 |
-
'
|
| 2000 |
-
'
|
| 2001 |
-
'
|
| 2002 |
-
'
|
| 2003 |
-
|
| 2004 |
-
|
| 2005 |
-
|
| 2006 |
-
|
| 2007 |
-
|
| 2008 |
-
|
| 2009 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2010 |
setTimeout(function () {
|
| 2011 |
-
|
| 2012 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2013 |
}
|
| 2014 |
|
| 2015 |
-
//
|
| 2016 |
document.addEventListener('DOMContentLoaded', function () {
|
| 2017 |
const btn = document.getElementById('modeSwitcher');
|
| 2018 |
-
if (btn)
|
| 2019 |
-
|
| 2020 |
-
|
| 2021 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2022 |
});
|
| 2023 |
|
| 2024 |
})();
|
|
|
|
| 1986 |
_fObserver.observe(document.body, { childList: true, subtree: true });
|
| 1987 |
});
|
| 1988 |
</script>
|
| 1989 |
+
<script>
|
| 1990 |
(function () {
|
| 1991 |
|
| 1992 |
+
// Crea un overlay negro/blanco que hace fade sobre toda la página
|
| 1993 |
+
const overlay = document.createElement('div');
|
| 1994 |
+
overlay.id = 'theme-overlay';
|
| 1995 |
+
overlay.style.cssText = [
|
| 1996 |
+
'position:fixed',
|
| 1997 |
+
'inset:0',
|
| 1998 |
+
'z-index:99999',
|
| 1999 |
+
'pointer-events:none',
|
| 2000 |
+
'opacity:0',
|
| 2001 |
+
'transition:opacity 0.18s ease',
|
| 2002 |
+
'background:#fff'
|
| 2003 |
+
].join(';');
|
| 2004 |
+
document.body.appendChild(overlay);
|
| 2005 |
+
|
| 2006 |
+
function switchTheme() {
|
| 2007 |
+
const lightTheme = document.getElementById('lightTheme');
|
| 2008 |
+
const darkTheme = document.getElementById('darkTheme');
|
| 2009 |
+
const goingDark = !darkTheme.disabled;
|
| 2010 |
+
|
| 2011 |
+
// El overlay es blanco al ir a dark, negro al ir a light
|
| 2012 |
+
overlay.style.background = goingDark ? '#fff' : '#1a1a2e';
|
| 2013 |
+
|
| 2014 |
+
// 1. Fade IN del overlay (tapa la página)
|
| 2015 |
+
overlay.style.opacity = '1';
|
| 2016 |
+
|
| 2017 |
setTimeout(function () {
|
| 2018 |
+
|
| 2019 |
+
// 2. Cambia el tema mientras está tapado
|
| 2020 |
+
lightTheme.disabled = !lightTheme.disabled;
|
| 2021 |
+
darkTheme.disabled = !darkTheme.disabled;
|
| 2022 |
+
|
| 2023 |
+
// 3. Fade OUT del overlay (revela el nuevo tema)
|
| 2024 |
+
setTimeout(function () {
|
| 2025 |
+
overlay.style.opacity = '0';
|
| 2026 |
+
}, 50);
|
| 2027 |
+
|
| 2028 |
+
}, 180);
|
| 2029 |
}
|
| 2030 |
|
| 2031 |
+
// Reemplaza el comportamiento del botón existente
|
| 2032 |
document.addEventListener('DOMContentLoaded', function () {
|
| 2033 |
const btn = document.getElementById('modeSwitcher');
|
| 2034 |
+
if (!btn) return;
|
| 2035 |
+
|
| 2036 |
+
// Clona el botón para eliminar listeners anteriores de apps.js
|
| 2037 |
+
const newBtn = btn.cloneNode(true);
|
| 2038 |
+
btn.parentNode.replaceChild(newBtn, btn);
|
| 2039 |
+
|
| 2040 |
+
newBtn.addEventListener('click', function (e) {
|
| 2041 |
+
e.preventDefault();
|
| 2042 |
+
e.stopPropagation();
|
| 2043 |
+
switchTheme();
|
| 2044 |
+
});
|
| 2045 |
});
|
| 2046 |
|
| 2047 |
})();
|