Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Askey Router Modern UI
- // @namespace http://tampermonkey.net/
- // @version 6.0
- // @description Rediseño de interfaz 'Kinetic Core' para router Askey en una SPA moderna sin marcos, libre de dependencias externas (cargas externas de JS o CSS) para evitar bloqueos por CSP.
- // @author Antigravity
- // @match http://192.168.1.1/avanzada.asp
- // @grant none
- // @run-at document-start
- // ==/UserScript==
- (function() {
- 'use strict';
- // Inyectar CSS temprano para ocultar el frameset original antes del renderizado
- const hideFramesetCSS = `
- frameset { display: none !important; }
- html, body { overflow: hidden !important; background-color: #0b1326; margin: 0; padding: 0; }
- `;
- const earlyStyle = document.createElement('style');
- earlyStyle.textContent = hideFramesetCSS;
- document.documentElement.appendChild(earlyStyle);
- // Obtener tema inicial guardado
- let currentTheme = localStorage.getItem('askey-theme') || 'dark';
- // Estructura de menú con iconos SVG inline (inmunes a bloqueos CSP de fuentes)
- const menuStructure = [
- {
- category: "General",
- items: [
- {
- title: "Information",
- icon: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" style="width: 20px; height: 20px;"><path stroke-linecap="round" stroke-linejoin="round" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>`,
- url: "summary.asp"
- }
- ]
- },
- {
- category: "Configuration",
- items: [
- {
- title: "LAN Setting",
- icon: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" style="width: 20px; height: 20px;"><path stroke-linecap="round" stroke-linejoin="round" d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10" /></svg>`,
- subItems: [
- { title: "IP Interface", url: "ipv4.asp" },
- { title: "LAN DHCP", url: "dhcp.asp" },
- { title: "IPv6", url: "ipv6.asp" }
- ]
- },
- {
- title: "WAN Setting",
- icon: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" style="width: 20px; height: 20px;"><path stroke-linecap="round" stroke-linejoin="round" d="M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9" /></svg>`,
- subItems: [
- { title: "WAN Interface", url: "wanintf.asp" }
- ]
- },
- {
- title: "Bridging Setup",
- icon: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" style="width: 20px; height: 20px;"><path stroke-linecap="round" stroke-linejoin="round" d="M8 7h12m0 0l-4-4m4 4l-4 4m0 6H4m0 0l4 4m-4-4l4-4" /></svg>`,
- subItems: [
- { title: "Bridging", url: "bridging.asp" },
- { title: "Filtering", url: "filtering.asp" },
- { title: "Marking", url: "marking.asp" }
- ]
- },
- {
- title: "Routing Setup",
- icon: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" style="width: 20px; height: 20px;"><path stroke-linecap="round" stroke-linejoin="round" d="M9 20l-5.447-2.724A1 1 0 013 16.382V5.618a1 1 0 011.447-.894L9 7m0 13l6-3m-6 3V7m6 10l4.553 2.276A1 1 0 0021 18.382V7.618a1 1 0 00-.553-.894L15 4m0 13V4m0 0L9 7" /></svg>`,
- subItems: [
- { title: "Routing Rules", url: "routing_rules.asp" },
- { title: "Default Gateway", url: "default_gateway.asp" },
- { title: "RIP", url: "rip.asp" }
- ]
- },
- {
- title: "NAT Setup",
- icon: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" style="width: 20px; height: 20px;"><path stroke-linecap="round" stroke-linejoin="round" d="M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2m-2-4h.01M17 16h.01" /></svg>`,
- subItems: [
- { title: "Interface Setting", url: "natintf.asp" },
- { title: "DMZ", url: "natdmz.asp" },
- { title: "ALG", url: "natalg.asp" },
- { title: "Loopback", url: "natloopback.asp" },
- { title: "Port Mapping", url: "natportmap.asp" }
- ]
- },
- {
- title: "DNS Setup",
- icon: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" style="width: 20px; height: 20px;"><path stroke-linecap="round" stroke-linejoin="round" d="M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4" /></svg>`,
- subItems: [
- { title: "DNS Relay", url: "dnsrelay.asp" },
- { title: "Dynamic DNS", url: "ddns.asp" }
- ]
- },
- {
- title: "Wireless LAN",
- icon: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" style="width: 20px; height: 20px;"><path stroke-linecap="round" stroke-linejoin="round" d="M12 18.75a.75.75 0 110-1.5.75.75 0 010 1.5zM12 14.25a3.75 3.75 0 00-3.75 3.75.75.75 0 11-1.5 0 5.25 5.25 0 0110.5 0 .75.75 0 11-1.5 0 3.75 3.75 0 00-3.75-3.75zM12 9.75a8.25 8.25 0 00-8.25 8.25.75.75 0 11-1.5 0 9.75 9.75 0 0119.5 0 .75.75 0 11-1.5 0 8.25 8.25 0 00-8.25-8.25z" /></svg>`,
- subItems: [
- { title: "2.4G", url: "wifi.asp" },
- { title: "5G", url: "wifi5g.asp" }
- ]
- },
- {
- title: "Multicast",
- icon: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" style="width: 20px; height: 20px;"><path stroke-linecap="round" stroke-linejoin="round" d="M18.364 5.636a9 9 0 010 12.728m0 0l-2.829-2.829m2.829 2.829L21 21M15.536 8.464a5 5 0 010 7.072m0 0l-2.829-2.829m-4.243 2.829a4.978 4.978 0 01-1.414-3.536 4.978 4.978 0 011.414-3.536m0 0l2.829 2.829M3 21l2.828-2.828M5.636 5.636a9 9 0 0112.728 0M12 12a1 1 0 100-2 1 1 0 000 2z" /></svg>`,
- subItems: [
- { title: "Interface Setting", url: "multicastintf.asp" },
- { title: "IGMP", url: "igmp.asp" }
- ]
- },
- {
- title: "Queue Management",
- icon: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" style="width: 20px; height: 20px;"><path stroke-linecap="round" stroke-linejoin="round" d="M4 6h16M4 12h16M4 18h16" /></svg>`,
- subItems: [
- { title: "Queue", url: "queue.asp" },
- { title: "Classification", url: "classification.asp" }
- ]
- },
- {
- title: "Voice",
- icon: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" style="width: 20px; height: 20px;"><path stroke-linecap="round" stroke-linejoin="round" d="M3 5a2 2 0 012-2h3.28a1 1 0 01.94.725l.548 2.2a1 1 0 01-.321.988l-1.305.98a10.582 10.582 0 004.872 4.872l.98-1.305a1 1 0 01.988-.321l2.2.548a1 1 0 01.725.94V19a2 2 0 01-2 2h-1C9.716 21 3 14.284 3 6V5z" /></svg>`,
- subItems: [
- { title: "Basic", url: "voicebasic.asp" },
- { title: "Advanced", url: "voiceadvance.asp" },
- { title: "PBX SIP Account", url: "pbxstats.asp" }
- ]
- },
- {
- title: "UPnP",
- icon: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" style="width: 20px; height: 20px;"><path stroke-linecap="round" stroke-linejoin="round" d="M11 4a1 1 0 011 1v14a1 1 0 01-1 1H3a1 1 0 01-1-1V5a1 1 0 011-1h8zm0 0h10a1 1 0 011 1v14a1 1 0 01-1 1H11m-7 5v4m6-4v4m8-4v4" /></svg>`,
- subItems: [
- { title: "UPnP Setting", url: "upnp.asp" }
- ]
- }
- ]
- },
- {
- category: "Diagnosis",
- items: [
- {
- title: "WAN Mirror",
- icon: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" style="width: 20px; height: 20px;"><path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" /><path stroke-linecap="round" stroke-linejoin="round" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" /></svg>`,
- url: "diagsw.asp"
- },
- {
- title: "System Log",
- icon: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" style="width: 20px; height: 20px;"><path stroke-linecap="round" stroke-linejoin="round" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /></svg>`,
- url: "syslog.asp"
- }
- ]
- },
- {
- category: "Device Info",
- items: [
- {
- title: "Statistics",
- icon: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" style="width: 20px; height: 20px;"><path stroke-linecap="round" stroke-linejoin="round" d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 002 2h2a2 2 0 002-2z" /></svg>`,
- subItems: [
- { title: "LAN", url: "lanstats.asp" },
- { title: "WAN", url: "wanstats.asp" }
- ]
- },
- {
- title: "Host",
- icon: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" style="width: 20px; height: 20px;"><path stroke-linecap="round" stroke-linejoin="round" d="M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" /></svg>`,
- url: "hoststats.asp"
- },
- {
- title: "ARP",
- icon: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" style="width: 20px; height: 20px;"><path stroke-linecap="round" stroke-linejoin="round" d="M10 6H5a2 2 0 00-2 2v9a2 2 0 002 2h14a2 2 0 002-2V8a2 2 0 00-2-2h-5m-4 0V5a2 2 0 114 0v1m-4 0a2 2 0 104 0m-5 8a2 2 0 100-4 2 2 0 000 4zm0 0c1.333 0 4 .667 4 2v1H5v-1c0-1.333 2.667-2 4-2z" /></svg>`,
- url: "arpstats.asp"
- }
- ]
- },
- {
- category: "Management",
- items: [
- {
- title: "User",
- icon: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" style="width: 20px; height: 20px;"><path stroke-linecap="round" stroke-linejoin="round" d="M12 6V4m0 2a2 2 0 100 4m0-4a2 2 0 110 4m-6 8a6 6 0 00-6 6h12a6 6 0 00-6-6zm12.5-3.5a1.5 1.5 0 11-3 0 1.5 1.5 0 013 0zm0 0c.8 0 2 .5 2 1.5v2h-7v-2c0-1 1.2-1.5 2-1.5z" /></svg>`,
- subItems: [
- { title: "User Account", url: "user_profile.asp" }
- ]
- },
- {
- title: "Maintenance",
- icon: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" style="width: 20px; height: 20px;"><path stroke-linecap="round" stroke-linejoin="round" d="M8 4H6a2 2 0 00-2 2v12a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-2m-4-1v8m0 0l3-3m-3 3L9 8m-5 5h2.586a1 1 0 01.707.293l2.414 2.414a1 1 0 00.707.293h3.172a1 1 0 00.707-.293l2.414-2.414a1 1 0 01.707-.293H20" /></svg>`,
- subItems: [
- { title: "Firmware Upgrade", url: "fw_upgrade.asp" },
- { title: "Save", url: "save.asp" },
- { title: "Backup/Restore", url: "backup_restore.asp" },
- { title: "Restore Default", url: "restore_default.asp" }
- ]
- },
- {
- title: "Reboot",
- icon: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" style="width: 20px; height: 20px;"><path stroke-linecap="round" stroke-linejoin="round" d="M4 4v5h.582m15.356 2A8.001 8.001 0 1121.21 8H17" /></svg>`,
- url: "reboot.asp"
- }
- ]
- }
- ];
- // CSS Puro Nativo Completo del Dashboard (Reemplaza a TailwindCSS por completo)
- const dashboardCSS = `
- ::-webkit-scrollbar {
- width: 4px;
- }
- ::-webkit-scrollbar-track {
- background: #0b1326;
- }
- ::-webkit-scrollbar-thumb {
- background: #3b494b;
- border-radius: 10px;
- }
- :root {
- --bg-app-dark: #0b1326;
- --bg-card-dark: #121b2e;
- --border-dark: #3b494b;
- --sidebar-bg-dark: #171f33;
- --sidebar-text-dark: #b9cacb;
- --sidebar-hover-dark: rgba(255, 255, 255, 0.05);
- --text-main-dark: #dae2fd;
- --text-sub-dark: #b9cacb;
- --accent-dark: #00dbe9;
- --accent-glow-dark: rgba(0, 219, 233, 0.3);
- --primary-btn-bg-dark: #00f0ff;
- --primary-btn-text-dark: #00363a;
- --status-glow-dark: #4edea3;
- --bg-app-light: #f1f5f9;
- --bg-card-light: #ffffff;
- --border-light: #cbd5e1;
- --sidebar-bg-light: #0f172a;
- --sidebar-text-light: #94a3b8;
- --sidebar-hover-light: #1e293b;
- --text-main-light: #0f172a;
- --text-sub-light: #475569;
- --accent-light: #2563eb;
- --accent-glow-light: rgba(37, 99, 235, 0.15);
- --primary-btn-bg-light: #2563eb;
- --primary-btn-text-light: #ffffff;
- --status-glow-light: #22c55e;
- }
- body, html {
- margin: 0;
- padding: 0;
- width: 100%;
- height: 100%;
- overflow: hidden !important;
- background-color: var(--bg-app);
- color: var(--text-main);
- }
- #modern-app-root {
- font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
- position: fixed;
- inset: 0;
- z-index: 9999999;
- display: flex;
- transition: background-color 0.3s ease, color 0.3s ease;
- font-size: 14px;
- }
- #modern-app-root[data-theme="light"] {
- --bg-app: var(--bg-app-light);
- --bg-card: var(--bg-card-light);
- --border: var(--border-light);
- --sidebar-bg: var(--sidebar-bg-light);
- --sidebar-text: var(--sidebar-text-light);
- --sidebar-hover: var(--sidebar-hover-light);
- --text-main: var(--text-main-light);
- --text-sub: var(--text-sub-light);
- --accent: var(--accent-light);
- --accent-glow: var(--accent-glow-light);
- --primary-btn-bg: var(--primary-btn-bg-light);
- --primary-btn-text: var(--primary-btn-text-light);
- --status-glow: var(--status-glow-light);
- background-color: var(--bg-app);
- color: var(--text-main);
- }
- #modern-app-root[data-theme="dark"] {
- --bg-app: var(--bg-app-dark);
- --bg-card: var(--bg-card-dark);
- --border: var(--border-dark);
- --sidebar-bg: var(--sidebar-bg-dark);
- --sidebar-text: var(--sidebar-text-dark);
- --sidebar-hover: var(--sidebar-hover-dark);
- --text-main: var(--text-main-dark);
- --text-sub: var(--text-sub-dark);
- --accent: var(--accent-dark);
- --accent-glow: var(--accent-glow-dark);
- --primary-btn-bg: var(--primary-btn-bg-dark);
- --primary-btn-text: var(--primary-btn-text-dark);
- --status-glow: var(--status-glow-dark);
- background-color: var(--bg-app);
- color: var(--text-main);
- }
- /* Sidebar lateral */
- .modern-sidebar {
- width: 280px;
- background-color: var(--sidebar-bg);
- color: var(--sidebar-text);
- display: flex;
- flex-direction: column;
- height: 100vh;
- padding: 24px 0 0 0;
- border-right: 1px solid var(--border);
- transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
- flex-shrink: 0;
- overflow-y: auto;
- z-index: 50;
- }
- .modern-sidebar.collapsed {
- width: 76px;
- }
- .sidebar-header {
- padding: 0 24px;
- margin-bottom: 28px;
- overflow: hidden;
- white-space: nowrap;
- }
- .sidebar-title {
- font-size: 26px;
- font-weight: 700;
- color: var(--accent);
- letter-spacing: -0.02em;
- margin: 0;
- }
- .sidebar-subtitle {
- font-family: Consolas, Menlo, Monaco, "Lucida Console", monospace;
- font-size: 10px;
- font-weight: 600;
- text-transform: uppercase;
- letter-spacing: 0.05em;
- color: var(--text-sub);
- margin-top: 4px;
- }
- .sidebar-menu {
- flex: 1;
- padding: 0 8px;
- }
- .menu-category-title {
- font-family: Consolas, Menlo, Monaco, "Lucida Console", monospace;
- font-size: 10px;
- font-weight: 600;
- text-transform: uppercase;
- letter-spacing: 0.05em;
- color: var(--text-sub);
- padding: 12px 16px 4px 16px;
- white-space: nowrap;
- opacity: 0.7;
- }
- .modern-sidebar.collapsed .menu-category-title {
- display: none;
- }
- .menu-item-wrapper {
- display: flex;
- flex-direction: column;
- margin-top: 4px;
- }
- .menu-item-single, .menu-item-expandable {
- display: flex;
- align-items: center;
- justify-content: space-between;
- width: 100%;
- padding: 12px 16px;
- border-radius: 4px;
- cursor: pointer;
- color: var(--sidebar-text);
- transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
- background: transparent;
- border: none;
- text-align: left;
- }
- .menu-item-single:hover, .menu-item-expandable:hover {
- background-color: var(--sidebar-hover);
- color: #ffffff;
- }
- .menu-item-single.active {
- border-left: 4px solid var(--accent);
- background-color: rgba(255, 255, 255, 0.05);
- color: var(--accent) !important;
- font-weight: 700;
- padding-left: 12px;
- }
- .menu-item-expandable.active {
- color: var(--accent) !important;
- font-weight: 700;
- }
- .menu-item-content {
- display: flex;
- align-items: center;
- gap: 12px;
- }
- .menu-item-icon {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 20px;
- height: 20px;
- color: currentColor;
- }
- .menu-item-arrow {
- display: flex;
- align-items: center;
- justify-content: center;
- transition: transform 0.25s ease;
- color: var(--text-sub);
- }
- .sub-menu-container {
- display: flex;
- flex-direction: column;
- padding-left: 32px;
- margin-top: 4px;
- gap: 4px;
- max-height: 0;
- overflow: hidden;
- transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
- }
- .sub-menu-item {
- padding: 8px 16px;
- border-radius: 4px;
- cursor: pointer;
- font-size: 12.5px;
- color: var(--sidebar-text);
- transition: all 0.2s ease;
- }
- .sub-menu-item:hover {
- background-color: var(--sidebar-hover);
- color: #ffffff;
- }
- .sub-menu-item.active {
- color: #ffffff;
- font-weight: 600;
- background-color: rgba(255, 255, 255, 0.08);
- border-left: 2px solid var(--accent);
- border-top-left-radius: 0;
- border-bottom-left-radius: 0;
- padding-left: 14px;
- }
- .modern-sidebar.collapsed .sub-menu-container {
- display: none !important;
- }
- .sidebar-footer {
- padding: 16px 16px 24px 16px;
- margin-top: auto;
- flex-shrink: 0;
- border-top: 1px solid var(--border);
- }
- .user-panel {
- display: flex;
- align-items: center;
- gap: 10px;
- padding: 8px 10px;
- border-radius: 8px;
- background-color: rgba(45, 52, 73, 0.2);
- border: 1px solid rgba(132, 148, 149, 0.1);
- }
- .user-avatar-container {
- width: 32px;
- height: 32px;
- border-radius: 6px;
- background-color: rgba(0, 219, 233, 0.1);
- display: flex;
- align-items: center;
- justify-content: center;
- flex-shrink: 0;
- }
- .user-avatar-icon {
- display: flex;
- align-items: center;
- justify-content: center;
- color: var(--accent);
- }
- .user-details {
- display: flex;
- flex-direction: column;
- justify-content: center;
- }
- .user-role-label {
- font-family: Consolas, Menlo, Monaco, "Lucida Console", monospace;
- font-size: 9px;
- font-weight: 600;
- letter-spacing: 0.05em;
- color: var(--text-sub);
- text-transform: uppercase;
- margin: 0 !important;
- padding: 0 !important;
- line-height: 1.2 !important;
- }
- .user-name-text {
- font-family: Consolas, Menlo, Monaco, "Lucida Console", monospace;
- font-size: 13px;
- font-weight: 500;
- color: var(--text-main);
- margin: 0 !important;
- padding: 0 !important;
- line-height: 1.2 !important;
- margin-top: 2px !important;
- }
- /* Layout Principal */
- .modern-main {
- flex: 1;
- display: flex;
- flex-direction: column;
- margin-left: 0;
- height: 100vh;
- overflow: hidden;
- background-color: transparent;
- }
- /* Header Navbar */
- .modern-header {
- position: fixed;
- top: 0;
- right: 0;
- left: 280px;
- height: 64px;
- background-color: rgba(11, 19, 38, 0.85);
- backdrop-filter: blur(24px);
- border-bottom: 1px solid var(--border);
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 0 24px;
- z-index: 40;
- transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s ease;
- }
- #modern-app-root[data-theme="light"] .modern-header {
- background-color: rgba(255, 255, 255, 0.85);
- }
- .header-left {
- display: flex;
- align-items: center;
- gap: 24px;
- }
- .sidebar-toggle-btn {
- color: var(--sidebar-text);
- background: transparent;
- border: none;
- cursor: pointer;
- display: flex;
- align-items: center;
- justify-content: center;
- padding: 4px;
- border-radius: 4px;
- transition: background-color 0.2s;
- }
- .sidebar-toggle-btn:hover {
- background-color: rgba(255, 255, 255, 0.05);
- color: #ffffff;
- }
- .header-title-text {
- font-size: 20px;
- font-weight: 700;
- color: var(--text-main);
- }
- .header-divider {
- width: 1px;
- height: 16px;
- background-color: var(--border);
- }
- .system-status-indicator {
- display: flex;
- align-items: center;
- gap: 16px;
- }
- .status-item {
- display: flex;
- align-items: center;
- gap: 8px;
- }
- .status-dot {
- width: 8px;
- height: 8px;
- border-radius: 50%;
- background-color: var(--status-glow);
- box-shadow: 0 0 8px var(--status-glow);
- }
- .status-text {
- font-family: Consolas, Menlo, Monaco, "Lucida Console", monospace;
- font-size: 13px;
- color: var(--text-sub);
- }
- .header-right {
- display: flex;
- align-items: center;
- gap: 24px;
- }
- .header-actions {
- display: flex;
- align-items: center;
- gap: 16px;
- }
- .action-icon-btn {
- background: transparent;
- border: none;
- cursor: pointer;
- color: var(--text-sub);
- display: flex;
- align-items: center;
- justify-content: center;
- padding: 6px;
- border-radius: 4px;
- transition: color 0.2s, background-color 0.2s;
- }
- .action-icon-btn:hover {
- color: var(--accent);
- background-color: rgba(255, 255, 255, 0.05);
- }
- .logout-icon-btn {
- color: var(--text-sub);
- }
- .logout-icon-btn:hover {
- color: #ffb4ab !important;
- background-color: rgba(255, 180, 171, 0.08) !important;
- }
- /* Contenedor IFrame */
- .main-content-container {
- flex: 1;
- margin-top: 64px;
- padding: 16px 24px 24px 16px;
- display: flex;
- flex-direction: column;
- height: calc(100vh - 64px);
- overflow: hidden;
- }
- .iframe-wrapper {
- flex: 1;
- position: relative;
- width: 100%;
- height: 100%;
- }
- .modern-iframe {
- width: 100%;
- height: 100%;
- border: none;
- background: transparent;
- }
- .status-glow {
- box-shadow: 0 0 8px var(--status-glow);
- }
- .primary-glow {
- box-shadow: 0 0 12px var(--accent-glow);
- }
- `;
- // CSS Modernizador inyectado dinámicamente en el IFrame transparente (Libre de Tailwind y CSP)
- const iframeCSS = `
- /* Scrollbar estilizado idéntico al menú lateral */
- ::-webkit-scrollbar {
- width: 4px;
- height: 4px;
- }
- ::-webkit-scrollbar-track {
- background: #0b1326;
- }
- body[data-theme="light"] ::-webkit-scrollbar-track {
- background: #f1f5f9;
- }
- ::-webkit-scrollbar-thumb {
- background: #3b494b;
- border-radius: 10px;
- }
- body[data-theme="light"] ::-webkit-scrollbar-thumb {
- background: #cbd5e1;
- }
- body, html {
- background-color: transparent !important;
- background: transparent !important;
- color: #dae2fd !important;
- font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
- margin: 0 !important;
- padding: 12px 16px 16px 12px !important;
- line-height: 1.5;
- overflow-x: hidden;
- width: auto !important;
- height: auto !important;
- }
- /* Enlaces */
- a {
- color: #00dbe9 !important;
- text-decoration: none !important;
- transition: color 0.2s ease !important;
- }
- body[data-theme="light"] a {
- color: #2563eb !important;
- }
- a:hover {
- color: #dbfcff !important;
- text-decoration: underline !important;
- }
- body[data-theme="light"] a:hover {
- color: #1d4ed8 !important;
- }
- /* Reseteo para anular desplazamientos a la derecha nativos de base.css del router */
- body > div:not(#askey-modern-summary-container), .tabs_group, .tab_container, .tab_content, form, .container, .tab_container div, fieldset, table {
- margin-left: 0 !important;
- padding-left: 0 !important;
- width: 100% !important;
- max-width: 100% !important;
- box-sizing: border-box !important;
- background-color: transparent !important;
- background: transparent !important;
- }
- /* El container del dashboard SÍ necesita reset de layout pero NO de background */
- #askey-modern-summary-container {
- margin-left: 0 !important;
- padding-left: 0 !important;
- width: 100% !important;
- max-width: 100% !important;
- box-sizing: border-box !important;
- }
- /* Limpieza profunda de fondos heredados en menús y formularios nativos */
- .tabs_group, .tabs_group > *, .tabs_group > * > *,
- .tab_container, .tab_container > *, .tab_container > * > *,
- form > div, form > div > div {
- background-color: transparent;
- }
- /* Preservar estilización en inputs, select, textareas, botones y tablas nativos */
- input, select, textarea, button, table, th, td, legend {
- background-color: initial;
- }
- /* Forzar barras de progreso del dashboard - posición absoluta para relleno garantizado */
- #askey-modern-summary-container .progress-bar-container {
- background: rgba(132, 148, 149, 0.2) !important;
- height: 10px !important;
- border-radius: 5px !important;
- overflow: hidden !important;
- margin-bottom: 6px !important;
- width: 100% !important;
- position: relative !important;
- }
- body[data-theme="light"] #askey-modern-summary-container .progress-bar-container {
- background: rgba(0, 0, 0, 0.1) !important;
- }
- #askey-modern-summary-container .progress-bar-fill {
- background: linear-gradient(90deg, #00dbe9, #7000ff) !important;
- position: absolute !important;
- top: 0 !important;
- left: 0 !important;
- bottom: 0 !important;
- border-radius: 5px !important;
- box-shadow: 0 0 10px rgba(0, 219, 233, 0.6) !important;
- transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1) !important;
- display: block !important;
- }
- body[data-theme="light"] #askey-modern-summary-container .progress-bar-fill {
- background: linear-gradient(90deg, #2563eb, #7c3aed) !important;
- box-shadow: none !important;
- }
- body[data-theme="light"], html[data-theme="light"] {
- color: #0f172a !important;
- }
- /* Estilizar textareas nativos (ej: Digit Map) */
- textarea {
- background-color: #0b1326 !important;
- color: #dae2fd !important;
- border: 1px solid #3b494b !important;
- border-radius: 4px !important;
- padding: 8px 12px !important;
- font-size: 13px !important;
- font-family: Consolas, Menlo, Monaco, monospace !important;
- outline: none !important;
- box-sizing: border-box !important;
- width: 100% !important;
- max-width: 95% !important;
- min-height: 80px;
- }
- body[data-theme="light"] textarea {
- background-color: #ffffff !important;
- color: #0f172a !important;
- border-color: #cbd5e1 !important;
- }
- textarea:focus {
- border-color: #00dbe9 !important;
- box-shadow: 0 0 8px rgba(0, 219, 233, 0.3) !important;
- }
- /* Estilizar pestañas superiores nativas — diseño moderno segmentado */
- .tabs_group {
- border: none !important;
- outline: none !important;
- box-shadow: none !important;
- background: transparent !important;
- background-color: transparent !important;
- margin: 10px 0 !important;
- }
- div.tab_container {
- border: none !important;
- outline: none !important;
- box-shadow: none !important;
- background: transparent !important;
- background-color: transparent !important;
- }
- div.tab_container .tab_content {
- border: none !important;
- background: transparent !important;
- background-color: transparent !important;
- padding: 20px 0 !important;
- }
- .showme, .hideme {
- border: none !important;
- outline: none !important;
- box-shadow: none !important;
- background: transparent !important;
- background-color: transparent !important;
- }
- ul.tabs_control {
- display: flex !important;
- flex-wrap: wrap !important;
- list-style: none !important;
- padding: 4px !important;
- margin: 0 0 24px 0 !important;
- border: none !important;
- border-bottom: none !important;
- border-left: none !important;
- background: rgba(23, 31, 51, 0.6) !important;
- background-color: rgba(23, 31, 51, 0.6) !important;
- border-radius: 10px !important;
- width: fit-content !important;
- max-width: 95% !important;
- gap: 4px !important;
- height: auto !important;
- float: none !important;
- }
- body[data-theme="light"] ul.tabs_control {
- background: rgba(0, 0, 0, 0.05) !important;
- background-color: rgba(0, 0, 0, 0.05) !important;
- }
- ul.tabs_control li {
- margin: 0 !important;
- padding: 0 !important;
- list-style: none !important;
- float: none !important;
- border: none !important;
- background: transparent !important;
- background-color: transparent !important;
- height: auto !important;
- line-height: normal !important;
- overflow: visible !important;
- position: relative !important;
- }
- ul.tabs_control li a {
- display: flex !important;
- align-items: center !important;
- justify-content: center !important;
- padding: 8px 18px !important;
- color: #849495 !important;
- text-decoration: none !important;
- font-weight: 500 !important;
- font-size: 12px !important;
- font-family: system-ui, -apple-system, sans-serif !important;
- text-transform: uppercase !important;
- letter-spacing: 0.05em !important;
- border: none !important;
- border-bottom: none !important;
- background: transparent !important;
- background-color: transparent !important;
- border-radius: 7px !important;
- transition: all 0.2s ease !important;
- white-space: nowrap !important;
- line-height: 1.4 !important;
- cursor: pointer !important;
- outline: none !important;
- box-shadow: none !important;
- height: auto !important;
- }
- body[data-theme="light"] ul.tabs_control li a {
- color: #64748b !important;
- }
- ul.tabs_control li a:hover {
- color: #dae2fd !important;
- background: rgba(255, 255, 255, 0.06) !important;
- background-color: rgba(255, 255, 255, 0.06) !important;
- }
- body[data-theme="light"] ul.tabs_control li a:hover {
- color: #0f172a !important;
- background: rgba(0, 0, 0, 0.04) !important;
- }
- ul.tabs_control li.active,
- ul.tabs_control li.current {
- background: transparent !important;
- background-color: transparent !important;
- border: none !important;
- border-bottom: none !important;
- }
- ul.tabs_control li.active a, ul.tabs_control li a.active,
- ul.tabs_control li.current a, ul.tabs_control li a[class*="current"] {
- background: rgba(0, 219, 233, 0.12) !important;
- background-color: rgba(0, 219, 233, 0.12) !important;
- color: #00f0ff !important;
- font-weight: 600 !important;
- border: none !important;
- border-bottom: none !important;
- box-shadow: 0 0 10px rgba(0, 219, 233, 0.15) !important;
- }
- ul.tabs_control li.active a:hover {
- background: rgba(0, 219, 233, 0.12) !important;
- background-color: rgba(0, 219, 233, 0.12) !important;
- }
- body[data-theme="light"] ul.tabs_control li.active a,
- body[data-theme="light"] ul.tabs_control li a.active,
- body[data-theme="light"] ul.tabs_control li.current a {
- background: rgba(37, 99, 235, 0.1) !important;
- background-color: rgba(37, 99, 235, 0.1) !important;
- color: #2563eb !important;
- box-shadow: none !important;
- }
- h1 {
- display: none !important;
- }
- h2 {
- font-size: 20px !important;
- font-weight: 600 !important;
- color: #dbfcff !important;
- margin: 20px 0 12px 0 !important;
- border-bottom: 1px solid rgba(132, 148, 149, 0.2);
- padding-bottom: 8px;
- }
- body[data-theme="light"] h2 {
- color: #2563eb !important;
- }
- /* Evitar fondos y bordes duplicados en fieldsets/cards anidados */
- .config-card .config-card,
- fieldset fieldset {
- background: rgba(255, 255, 255, 0.02) !important;
- border: 1px solid rgba(132, 148, 149, 0.1) !important;
- margin-left: 0 !important;
- margin-right: 0 !important;
- width: 100% !important;
- max-width: 100% !important;
- box-sizing: border-box !important;
- padding: 16px 20px !important;
- }
- body[data-theme="light"] .config-card .config-card,
- body[data-theme="light"] fieldset fieldset {
- background: rgba(0, 0, 0, 0.02) !important;
- border-color: #cbd5e1 !important;
- }
- /* Fieldsets como tarjetas de vidrio */
- fieldset {
- border: 1px solid rgba(132, 148, 149, 0.2) !important;
- background: rgba(23, 31, 51, 0.6) !important;
- backdrop-filter: blur(16px) !important;
- border-radius: 0.5rem !important;
- padding: 20px 24px !important;
- margin-bottom: 20px !important;
- width: 100% !important;
- max-width: 95% !important;
- }
- body[data-theme="light"] fieldset {
- background: rgba(255, 255, 255, 0.8) !important;
- border-color: #cbd5e1 !important;
- }
- legend {
- font-family: Consolas, Menlo, Monaco, "Lucida Console", monospace !important;
- font-weight: 600 !important;
- font-size: 12px !important;
- letter-spacing: 0.05em !important;
- text-transform: uppercase !important;
- color: #00dbe9 !important;
- padding: 0 10px !important;
- background: transparent !important;
- margin-bottom: 0 !important;
- }
- body[data-theme="light"] legend {
- color: #2563eb !important;
- }
- /* Formularios */
- .label, .labelS, .labelL, .labelXL, .labelAX {
- background-color: transparent !important;
- color: #b9cacb !important;
- font-weight: 500 !important;
- font-size: 13px !important;
- padding: 6px 0 !important;
- float: none !important;
- display: inline-block !important;
- vertical-align: middle;
- margin-bottom: 4px;
- }
- body[data-theme="light"] .label,
- body[data-theme="light"] .labelS,
- body[data-theme="light"] .labelL,
- body[data-theme="light"] .labelXL,
- body[data-theme="light"] .labelAX {
- color: #475569 !important;
- }
- .labelS { width: 100px !important; }
- .label { width: 140px !important; }
- .labelL { width: 180px !important; }
- .labelXL { width: 220px !important; }
- .labelAX { width: 260px !important; }
- br {
- margin-bottom: 6px;
- }
- input[type="text"], input[type="password"], select {
- background-color: #0b1326 !important;
- color: #dae2fd !important;
- border: 1px solid #3b494b !important;
- border-radius: 0.25rem !important;
- padding: 5px 12px !important;
- font-size: 14px !important;
- font-family: Consolas, Menlo, Monaco, "Lucida Console", monospace !important;
- outline: none !important;
- transition: all 0.2s ease !important;
- height: 32px;
- vertical-align: middle;
- margin: 4px 8px 4px 0 !important;
- }
- body[data-theme="light"] input[type="text"],
- body[data-theme="light"] input[type="password"],
- body[data-theme="light"] select {
- background-color: #ffffff !important;
- color: #0f172a !important;
- border-color: #cbd5e1 !important;
- }
- input[type="text"]:focus, input[type="password"]:focus, select:focus {
- border-color: #00dbe9 !important;
- box-shadow: 0 0 8px rgba(0, 219, 233, 0.3) !important;
- }
- input[type="text"].txtIP, input[type="text"].txtMAC {
- width: 44px !important;
- text-align: center;
- padding: 4px 2px !important;
- margin: 2px !important;
- }
- input[type="button"], input[type="submit"], button {
- background-color: #00f0ff !important;
- color: #00363a !important;
- border: none !important;
- border-radius: 4px !important;
- padding: 6px 12px !important;
- font-size: 12px !important;
- font-family: Consolas, Menlo, Monaco, "Lucida Console", monospace !important;
- font-weight: 600 !important;
- text-transform: uppercase !important;
- letter-spacing: 0.05em !important;
- cursor: pointer !important;
- transition: all 0.2s ease !important;
- box-shadow: 0 0 12px rgba(0, 219, 233, 0.3) !important;
- margin: 8px 4px !important;
- display: inline-block !important;
- }
- body[data-theme="light"] input[type="button"],
- body[data-theme="light"] input[type="submit"],
- body[data-theme="light"] button {
- background-color: #2563eb !important;
- color: #ffffff !important;
- box-shadow: none !important;
- }
- input[type="button"]:hover, input[type="submit"]:hover, button:hover {
- opacity: 0.9 !important;
- transform: translateY(-0.5px) !important;
- }
- input[disabled], select[disabled], input:disabled, select:disabled {
- background-color: #131b2e !important;
- border-color: #2d3449 !important;
- color: #64748b !important;
- -webkit-text-fill-color: #64748b !important;
- opacity: 0.55 !important;
- cursor: not-allowed !important;
- }
- body[data-theme="light"] input[disabled],
- body[data-theme="light"] select[disabled],
- body[data-theme="light"] input:disabled,
- body[data-theme="light"] select:disabled {
- background-color: #f1f5f9 !important;
- border-color: #e2e8f0 !important;
- color: #94a3b8 !important;
- -webkit-text-fill-color: #94a3b8 !important;
- }
- /* Tablas */
- .tableV, .tableH {
- border-collapse: collapse !important;
- width: 100% !important;
- max-width: 95% !important;
- margin: 20px 0 !important;
- background: rgba(23, 31, 51, 0.6) !important;
- border: 1px solid rgba(132, 148, 149, 0.2) !important;
- border-radius: 8px !important;
- overflow: hidden;
- }
- body[data-theme="light"] .tableV,
- body[data-theme="light"] .tableH {
- background: #ffffff !important;
- border-color: #cbd5e1 !important;
- }
- .tableV th, .tableV td, .tableH th, .tableH td {
- padding: 10px 14px !important;
- border: none !important;
- border-bottom: 1px solid rgba(132, 148, 149, 0.2) !important;
- font-size: 14px !important;
- font-family: Consolas, Menlo, Monaco, "Lucida Console", monospace !important;
- }
- body[data-theme="light"] .tableV th,
- body[data-theme="light"] .tableV td,
- body[data-theme="light"] .tableH th,
- body[data-theme="light"] .tableH td {
- border-bottom-color: #e2e8f0 !important;
- }
- .tableV th, .tableH th {
- background-color: rgba(45, 52, 73, 0.4) !important;
- color: #b9cacb !important;
- font-family: Consolas, Menlo, Monaco, "Lucida Console", monospace !important;
- font-size: 12px !important;
- letter-spacing: 0.05em !important;
- text-transform: uppercase !important;
- font-weight: 600 !important;
- text-align: left !important;
- }
- body[data-theme="light"] .tableV th,
- body[data-theme="light"] .tableH th {
- background-color: #f1f5f9 !important;
- color: #475569 !important;
- }
- .tableH th {
- text-align: center !important;
- }
- .tableV tr:last-child td, .tableV tr:last-child th,
- .tableH tr:last-child td, .tableH tr:last-child th {
- border-bottom: none !important;
- }
- .tableV tr:hover td, .tableH tr:hover td {
- background-color: rgba(255, 255, 255, 0.03) !important;
- }
- body[data-theme="light"] .tableV tr:hover td,
- body[data-theme="light"] .tableH tr:hover td {
- background-color: #f8fafc !important;
- }
- /* Bloque de pestañas duplicadas eliminado para unificar estilos */
- /* Estilos específicos para la página de información y widgets */
- .summary-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 24px;
- width: 100%;
- max-width: 95%;
- }
- .summary-title-group h1 {
- display: block !important;
- font-size: 28px !important;
- font-weight: 700 !important;
- color: #dae2fd !important;
- margin: 0 !important;
- }
- body[data-theme="light"] .summary-title-group h1 {
- color: #0f172a !important;
- }
- .summary-title-group p {
- font-size: 13px;
- color: #b9cacb;
- margin: 4px 0 0 0;
- }
- body[data-theme="light"] .summary-title-group p {
- color: #475569;
- }
- .refresh-btn {
- background-color: #00f0ff !important;
- color: #00363a !important;
- border: none !important;
- border-radius: 4px !important;
- padding: 8px 16px !important;
- font-size: 12px !important;
- font-family: Consolas, Menlo, Monaco, "Lucida Console", monospace !important;
- font-weight: 600 !important;
- text-transform: uppercase !important;
- letter-spacing: 0.05em !important;
- cursor: pointer !important;
- transition: all 0.2s ease !important;
- box-shadow: 0 0 12px rgba(0, 219, 233, 0.3) !important;
- display: flex;
- align-items: center;
- gap: 8px;
- }
- body[data-theme="light"] .refresh-btn {
- background-color: #2563eb !important;
- color: #ffffff !important;
- box-shadow: none !important;
- }
- .refresh-btn:hover {
- opacity: 0.9 !important;
- transform: translateY(-0.5px) !important;
- }
- .widgets-grid {
- display: grid;
- grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
- gap: 16px;
- width: 100%;
- max-width: 95%;
- margin-bottom: 24px;
- }
- @media (max-width: 1024px) {
- .widgets-grid {
- grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
- }
- }
- @media (max-width: 640px) {
- .widgets-grid {
- grid-template-columns: minmax(0, 1fr) !important;
- }
- }
- .widget-card {
- background: rgba(23, 31, 51, 0.6) !important;
- backdrop-filter: blur(16px) !important;
- border: 1px solid rgba(132, 148, 149, 0.2) !important;
- border-radius: 8px !important;
- padding: 12px 14px !important;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- position: relative;
- min-height: 110px;
- transition: border-color 0.2s, box-shadow 0.2s;
- }
- body[data-theme="light"] .widget-card {
- background: rgba(255, 255, 255, 0.8) !important;
- border-color: #cbd5e1 !important;
- }
- .widget-card.highlight {
- border-left: 4px solid #4edea3 !important;
- }
- .widget-card-header {
- display: flex;
- justify-content: space-between;
- align-items: flex-start;
- margin-bottom: 6px;
- }
- .widget-card-title {
- font-family: Consolas, Menlo, Monaco, "Lucida Console", monospace !important;
- font-size: 11px !important;
- font-weight: 600 !important;
- text-transform: uppercase !important;
- letter-spacing: 0.05em !important;
- color: #b9cacb !important;
- margin: 0;
- }
- body[data-theme="light"] .widget-card-title {
- color: #475569 !important;
- }
- .widget-card-icon {
- color: #b9cacb;
- opacity: 0.8;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- body[data-theme="light"] .widget-card-icon {
- color: #475569;
- }
- .widget-card-value {
- font-size: 24px !important;
- font-weight: 700 !important;
- color: #ffffff !important;
- margin: 0 0 6px 0;
- font-family: system-ui, -apple-system, sans-serif !important;
- }
- body[data-theme="light"] .widget-card-value {
- color: #0f172a !important;
- }
- .widget-card-value.mono {
- font-family: Consolas, Menlo, Monaco, "Lucida Console", monospace !important;
- font-size: 20px !important;
- }
- .widget-card-footer {
- font-size: 11px !important;
- color: #849495 !important;
- font-family: Consolas, Menlo, Monaco, "Lucida Console", monospace !important;
- display: flex;
- justify-content: space-between;
- }
- body[data-theme="light"] .widget-card-footer {
- color: #64748b !important;
- }
- /* Barra de Progreso de Memoria — refuerzo con position absolute */
- .progress-bar-container {
- width: 100%;
- height: 10px;
- background: rgba(132, 148, 149, 0.2) !important;
- border-radius: 5px;
- overflow: hidden;
- margin-bottom: 6px;
- position: relative;
- }
- body[data-theme="light"] .progress-bar-container {
- background: rgba(0, 0, 0, 0.1) !important;
- }
- .progress-bar-fill {
- position: absolute !important;
- top: 0 !important;
- left: 0 !important;
- bottom: 0 !important;
- width: 0%;
- background: linear-gradient(90deg, #00dbe9, #7000ff) !important;
- border-radius: 5px !important;
- box-shadow: 0 0 10px rgba(0, 219, 233, 0.6) !important;
- transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1) !important;
- display: block !important;
- }
- /* Fila de Load Average */
- .load-row {
- display: flex;
- justify-content: space-between;
- padding: 2px 0;
- border-bottom: 1px solid rgba(132, 148, 149, 0.1);
- font-family: Consolas, Menlo, Monaco, "Lucida Console", monospace !important;
- font-size: 12px;
- }
- .load-row:last-child {
- border-bottom: none;
- }
- .load-label {
- color: #b9cacb;
- }
- body[data-theme="light"] .load-label {
- color: #475569;
- }
- .load-val {
- color: #ffffff;
- font-weight: 600;
- }
- body[data-theme="light"] .load-val {
- color: #0f172a;
- }
- /* Estilos específicos para estilización de tarjetas Wi-Fi y DHCP */
- .config-card {
- background: rgba(23, 31, 51, 0.6) !important;
- backdrop-filter: blur(16px) !important;
- border: 1px solid rgba(132, 148, 149, 0.2) !important;
- border-radius: 8px !important;
- padding: 24px !important;
- margin-bottom: 24px !important;
- width: 100% !important;
- max-width: 95% !important;
- }
- body[data-theme="light"] .config-card {
- background: rgba(255, 255, 255, 0.8) !important;
- border-color: #cbd5e1 !important;
- }
- .config-card-title {
- font-family: Consolas, Menlo, Monaco, "Lucida Console", monospace !important;
- font-weight: 600 !important;
- font-size: 13px !important;
- letter-spacing: 0.05em !important;
- text-transform: uppercase !important;
- color: #00dbe9 !important;
- margin: 0 0 16px 0;
- border-bottom: 1px solid rgba(132, 148, 149, 0.2);
- padding-bottom: 8px;
- }
- body[data-theme="light"] .config-card-title {
- color: #2563eb !important;
- border-bottom-color: #cbd5e1;
- }
- .form-row {
- display: flex;
- align-items: center;
- margin-bottom: 14px;
- flex-wrap: wrap;
- }
- .form-row .labelL {
- margin-bottom: 0 !important;
- padding: 0 !important;
- }
- .form-row-content {
- flex: 1;
- min-width: 200px;
- }
- `;
- // Renderizar la SPA moderna
- function buildModernApp() {
- // Inyectar estilos CSS del Dashboard principal en el head para que no se pierdan
- const style = document.createElement('style');
- style.id = 'askey-dashboard-style';
- style.textContent = dashboardCSS;
- document.head.appendChild(style);
- // Crear el contenedor moderno
- const appRoot = document.createElement('div');
- appRoot.id = 'modern-app-root';
- appRoot.setAttribute('data-theme', currentTheme);
- // Estructura HTML de la barra lateral (Sidebar)
- let sidebarHTML = `
- <aside class="modern-sidebar" id="modern-sidebar">
- <div class="sidebar-header">
- <h1 class="sidebar-title">CoreRouter OS</h1>
- <p class="sidebar-subtitle" id="modern-device-ver">v2.4.0-stable</p>
- </div>
- <nav class="sidebar-menu">
- `;
- menuStructure.forEach((cat, catIdx) => {
- sidebarHTML += `<div class="menu-category-title">${cat.category}</div>`;
- cat.items.forEach((item, itemIdx) => {
- const uniqueId = `menu-item-${catIdx}-${itemIdx}`;
- if (item.subItems) {
- sidebarHTML += `
- <div class="menu-item-wrapper">
- <button class="menu-item-expandable" data-target="${uniqueId}">
- <div class="menu-item-content">
- <span class="menu-item-icon">${item.icon}</span>
- <span>${item.title}</span>
- </div>
- <span class="menu-item-arrow">
- <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" style="width: 14px; height: 14px;"><path stroke-linecap="round" stroke-linejoin="round" d="M19 9l-7 7-7-7" /></svg>
- </span>
- </button>
- <div class="sub-menu-container" id="${uniqueId}">
- `;
- item.subItems.forEach(sub => {
- sidebarHTML += `
- <div class="sub-menu-item" data-url="${sub.url}">${sub.title}</div>
- `;
- });
- sidebarHTML += `
- </div>
- </div>
- `;
- } else {
- sidebarHTML += `
- <div class="menu-item-wrapper">
- <button class="menu-item-single" data-url="${item.url}">
- <div class="menu-item-content">
- <span class="menu-item-icon">${item.icon}</span>
- <span>${item.title}</span>
- </div>
- </button>
- </div>
- `;
- }
- });
- });
- sidebarHTML += `
- </nav>
- <div class="sidebar-footer">
- <div class="user-panel">
- <div class="user-avatar-container">
- <span class="user-avatar-icon">
- <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" style="width: 20px; height: 20px;"><path stroke-linecap="round" stroke-linejoin="round" d="M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" /></svg>
- </span>
- </div>
- <div class="user-details">
- <p class="user-role-label">ROOT ACCESS</p>
- <p class="user-name-text" id="user-logged-name">Admin</p>
- </div>
- </div>
- </div>
- </aside>
- `;
- // Cabecera Navbar y contenedor de IFrame HTML
- const mainHTML = `
- <div class="modern-main" id="modern-main-panel">
- <header class="modern-header" id="modern-header">
- <div class="header-left">
- <button class="sidebar-toggle-btn" id="sidebar-toggle-btn" title="Contraer/Expandir Menú">
- <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" style="width: 20px; height: 20px;"><path stroke-linecap="round" stroke-linejoin="round" d="M4 6h16M4 12h16M4 18h16" /></svg>
- </button>
- <span class="header-title-text" id="modern-page-title">System Monitor</span>
- <div class="header-divider"></div>
- <div class="system-status-indicator">
- <div class="status-item">
- <span class="status-dot"></span>
- <span class="status-text" id="device-model-label">Cargando modelo...</span>
- </div>
- <div class="status-item">
- <span class="user-avatar-icon" style="display: flex; align-items: center; justify-content: center; color: var(--accent);">
- <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" style="width: 18px; height: 18px;"><path stroke-linecap="round" stroke-linejoin="round" d="M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9" /></svg>
- </span>
- <span class="status-text">WAN: CONNECTED</span>
- </div>
- </div>
- </div>
- <div class="header-right">
- <div class="header-actions">
- <button class="action-icon-btn" id="theme-switch-btn" title="Cambiar Tema Claro/Oscuro">
- <!-- Icono de Sol / Luna dinámico en JS -->
- </button>
- <button class="action-icon-btn logout-icon-btn" id="logout-btn" title="Cerrar Sesión">
- <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" style="width: 20px; height: 20px;"><path stroke-linecap="round" stroke-linejoin="round" d="M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1" /></svg>
- </button>
- </div>
- </div>
- </header>
- <main class="main-content-container bg-transparent">
- <div class="iframe-wrapper">
- <iframe id="modern-iframe" class="modern-iframe" src="summary.asp"></iframe>
- </div>
- </main>
- </div>
- `;
- appRoot.innerHTML = sidebarHTML + mainHTML;
- document.body.appendChild(appRoot);
- // Enlazar eventos e inicializar información
- setupAppEvents();
- updateThemeControls();
- loadSystemDetails();
- setupAtmosphericGlow();
- }
- // Configurar evento dinámico para efecto radial de fondo HUD
- function setupAtmosphericGlow() {
- document.addEventListener('mousemove', (e) => {
- const appRoot = document.getElementById('modern-app-root');
- if (appRoot) {
- const x = e.clientX;
- const y = e.clientY;
- if (currentTheme === 'dark') {
- appRoot.style.background = `radial-gradient(circle at ${x}px ${y}px, #131b2e 0%, #0b1326 60%)`;
- } else {
- appRoot.style.background = `radial-gradient(circle at ${x}px ${y}px, #f1f5f9 0%, #cbd5e1 80%)`;
- }
- }
- });
- }
- // Sincronizar clases y controles de tema
- function updateThemeControls() {
- const themeBtn = document.getElementById('theme-switch-btn');
- const appRoot = document.getElementById('modern-app-root');
- if (themeBtn && appRoot) {
- if (currentTheme === 'dark') {
- appRoot.setAttribute('data-theme', 'dark');
- themeBtn.innerHTML = `
- <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" style="width: 20px; height: 20px;"><path stroke-linecap="round" stroke-linejoin="round" d="M12 3v1m0 16v1m9-9h-1M4 12H3m15.364-6.364l-.707.707M6.343 17.657l-.707.707m0-12.728l.707.707m12.728 12.728l.707-.707M12 8a4 4 0 100 8 4 4 0 000-8z" /></svg>
- `;
- } else {
- appRoot.setAttribute('data-theme', 'light');
- themeBtn.innerHTML = `
- <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" style="width: 20px; height: 20px;"><path stroke-linecap="round" stroke-linejoin="round" d="M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z" /></svg>
- `;
- }
- }
- }
- // Configurar los manejadores de eventos interactivos
- function setupAppEvents() {
- // Toggle Sidebar
- const sidebarToggle = document.getElementById('sidebar-toggle-btn');
- const sidebar = document.getElementById('modern-sidebar');
- const mainPanel = document.getElementById('modern-main-panel');
- const header = document.getElementById('modern-header');
- if (sidebarToggle && sidebar && mainPanel && header) {
- sidebarToggle.addEventListener('click', function() {
- const isCollapsed = sidebar.classList.contains('collapsed');
- if (isCollapsed) {
- sidebar.classList.remove('collapsed');
- header.style.left = "280px";
- } else {
- sidebar.classList.add('collapsed');
- header.style.left = "76px";
- }
- });
- }
- // Evento switch tema
- const themeBtn = document.getElementById('theme-switch-btn');
- if (themeBtn) {
- themeBtn.addEventListener('click', function() {
- currentTheme = currentTheme === 'dark' ? 'light' : 'dark';
- localStorage.setItem('askey-theme', currentTheme);
- updateThemeControls();
- // Propagar tema al iframe de inmediato
- const iframe = document.getElementById('modern-iframe');
- if (iframe) {
- try {
- const doc = iframe.contentDocument || iframe.contentWindow.document;
- if (doc && doc.body) {
- doc.body.setAttribute('data-theme', currentTheme);
- doc.documentElement.setAttribute('data-theme', currentTheme);
- }
- } catch (e) {}
- }
- });
- }
- // Evento de Logout
- const logoutBtn = document.getElementById('logout-btn');
- if (logoutBtn) {
- logoutBtn.addEventListener('click', function() {
- window.location.href = "logout.asp";
- });
- }
- // Submenús desplegables del sidebar
- const expandables = document.querySelectorAll('.menu-item-expandable');
- expandables.forEach(exp => {
- exp.addEventListener('click', function() {
- const targetId = exp.getAttribute('data-target');
- const subMenu = document.getElementById(targetId);
- const arrow = exp.querySelector('.menu-item-arrow');
- if (subMenu && arrow) {
- const isExpanded = subMenu.style.maxHeight !== '0px' && subMenu.style.maxHeight !== '';
- if (isExpanded) {
- subMenu.style.maxHeight = '0px';
- arrow.style.transform = 'rotate(0deg)';
- } else {
- // Colapsar otros primero
- document.querySelectorAll('.sub-menu-container').forEach(other => {
- other.style.maxHeight = '0px';
- const otherParent = other.previousElementSibling;
- if (otherParent) {
- const otherArrow = otherParent.querySelector('.menu-item-arrow');
- if (otherArrow) otherArrow.style.transform = 'rotate(0deg)';
- }
- });
- subMenu.style.maxHeight = '350px';
- arrow.style.transform = 'rotate(90deg)';
- }
- }
- });
- });
- // Clics de navegación en sidebar
- const iframe = document.getElementById('modern-iframe');
- if (iframe) {
- // Enlaces de primer nivel directos
- const singleLinks = document.querySelectorAll('.menu-item-single');
- singleLinks.forEach(link => {
- link.addEventListener('click', function() {
- const url = link.getAttribute('data-url');
- const text = link.querySelector('span:not(.menu-item-icon)').textContent;
- if (url) {
- clearActiveSidebarStates();
- link.classList.add('active');
- document.getElementById('modern-page-title').textContent = text;
- iframe.src = url;
- }
- });
- });
- // Enlaces de submenú
- const subLinks = document.querySelectorAll('.sub-menu-item');
- subLinks.forEach(sub => {
- sub.addEventListener('click', function() {
- const url = sub.getAttribute('data-url');
- const parentWrapper = sub.closest('.menu-item-wrapper');
- const parentMenu = parentWrapper ? parentWrapper.querySelector('.menu-item-expandable') : null;
- const text = sub.textContent;
- if (url) {
- clearActiveSidebarStates();
- sub.classList.add('active');
- if (parentMenu) {
- parentMenu.classList.add('active');
- }
- document.getElementById('modern-page-title').textContent = text;
- iframe.src = url;
- }
- });
- });
- // Evento load del iframe para modernización
- iframe.addEventListener('load', function() {
- modernizeIFrame(iframe);
- syncActiveSidebarLink(iframe);
- });
- }
- }
- // Limpiar clases activas en sidebar
- function clearActiveSidebarStates() {
- document.querySelectorAll('.menu-item-single').forEach(link => link.classList.remove('active'));
- document.querySelectorAll('.menu-item-expandable').forEach(exp => exp.classList.remove('active'));
- document.querySelectorAll('.sub-menu-item').forEach(sub => sub.classList.remove('active'));
- }
- // Reconstruir summary.asp como un Dashboard HUD Premium interactivo
- function renderSummaryWidgets(iframeDoc) {
- // Evitar doble renderizado si ya se inyectó
- if (iframeDoc.getElementById('askey-modern-summary-container')) return;
- // Ocultar la tabla original pero mantenerla en el DOM
- const originalTable = iframeDoc.getElementById('tbGPONinfo');
- if (originalTable) {
- originalTable.style.display = 'none';
- }
- const originalH1 = iframeDoc.querySelector('h1');
- if (originalH1) {
- originalH1.style.display = 'none';
- }
- // Crear contenedor para los widgets modernos
- const container = iframeDoc.createElement('div');
- container.id = 'askey-modern-summary-container';
- container.style.width = '100%';
- // Estructura HTML del Dashboard (widgets + tabla de parámetros)
- container.innerHTML = `
- <div class="summary-header">
- <div class="summary-title-group">
- <h1>Device Information</h1>
- <p>Real-time hardware status and system environment variables.</p>
- </div>
- <button class="refresh-btn" id="summary-refresh-btn">
- <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" style="width: 16px; height: 16px;"><path stroke-linecap="round" stroke-linejoin="round" d="M4 4v5h.582m15.356 2A8.001 8.001 0 1121.21 8H17" /></svg>
- Refresh Data
- </button>
- </div>
- <div class="widgets-grid">
- <!-- Memory Utilization Card -->
- <div class="widget-card">
- <div class="widget-card-header">
- <span class="widget-card-title">Memory Utilization</span>
- <span class="widget-card-icon">
- <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" style="width: 20px; height: 20px;"><path stroke-linecap="round" stroke-linejoin="round" d="M9 3v2m6-2v2M9 19v2m6-2v2M5 9H3m2 6H3m18-6h-2m2 6h-2M7 5h10a2 2 0 012 2v10a2 2 0 01-2 2H7a2 2 0 01-2-2V7a2 2 0 012-2z" /></svg>
- </span>
- </div>
- <div class="widget-card-value" id="widget-ram-pct">0% <span style="font-size: 14px; font-weight: 500; opacity: 0.6;">/ 0MB</span></div>
- <div class="progress-bar-container">
- <div class="progress-bar-fill" id="widget-ram-bar" style="width: 0%"></div>
- </div>
- <div class="widget-card-footer">
- <span id="widget-ram-free">FREE: 0 KB</span>
- <span id="widget-ram-total">TOTAL: 0 KB</span>
- </div>
- </div>
- <!-- Load Average Card -->
- <div class="widget-card">
- <div class="widget-card-header">
- <span class="widget-card-title">Load Average</span>
- <span class="widget-card-icon" style="color: #4edea3;">
- <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" style="width: 20px; height: 20px;"><path stroke-linecap="round" stroke-linejoin="round" d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 002 2h2a2 2 0 002-2zm0 0v-8a2 2 0 012-2h2a2 2 0 012 2v10" /></svg>
- </span>
- </div>
- <div style="display: flex; flex-direction: column; gap: 2px; justify-content: center; margin: 4px 0 0 0;">
- <div class="load-row"><span class="load-label">1 MIN</span><span class="load-val" id="widget-load-1">0.00</span></div>
- <div class="load-row"><span class="load-label">5 MIN</span><span class="load-val" id="widget-load-5">0.00</span></div>
- <div class="load-row"><span class="load-label">15 MIN</span><span class="load-val" id="widget-load-15">0.00</span></div>
- </div>
- </div>
- <!-- GPON State Card -->
- <div class="widget-card highlight" id="widget-gpon-card">
- <div class="widget-card-header">
- <span class="widget-card-title">GPON State</span>
- <span class="widget-card-icon" style="color: #00f0ff;">
- <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" style="width: 20px; height: 20px;"><path stroke-linecap="round" stroke-linejoin="round" d="M5.121 17.804A13.937 13.937 0 0112 16c2.5 0 4.847.655 6.879 1.804M15 10a3 3 0 11-6 0 3 3 0 016 0zm6 2a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>
- </span>
- </div>
- <div class="widget-card-value" id="widget-gpon-state" style="font-size: 20px !important;">-</div>
- <div class="widget-card-footer" style="color: #4edea3; font-weight: 600;" id="widget-gpon-status-label">LINK SYNCHRONIZED</div>
- <div class="widget-card-footer" style="margin-top: 4px;" id="widget-gpon-sn">SN: -</div>
- </div>
- <!-- System Time Card -->
- <div class="widget-card">
- <div class="widget-card-header">
- <span class="widget-card-title">System Time</span>
- <span class="widget-card-icon">
- <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" style="width: 20px; height: 20px;"><path stroke-linecap="round" stroke-linejoin="round" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>
- </span>
- </div>
- <div class="widget-card-value mono" id="widget-time-clock">00:00:00</div>
- <div class="widget-card-footer" style="font-weight: 500;" id="widget-time-date">0000-00-00</div>
- <div class="widget-card-footer" style="margin-top: 4px;">UTC +02:00 (GMT)</div>
- </div>
- </div>
- <!-- Tabla inferior de Parámetros de Sistema -->
- <div class="config-card" style="margin-top: 24px;">
- <h3 class="config-card-title">System Parameters</h3>
- <table class="tableV" style="width: 100%; max-width: 100%; margin: 0 !important; background: transparent !important; border: none !important;">
- <tbody>
- <tr>
- <td style="width: 40%; font-weight: 600; color: var(--text-sub);">Hardware Version</td>
- <td id="param-hw-ver" style="font-family: Consolas, monospace; color: var(--text-main);">-</td>
- </tr>
- <tr>
- <td style="font-weight: 600; color: var(--text-sub);">Software Version</td>
- <td id="param-sw-ver" style="font-family: Consolas, monospace; color: var(--text-main);">-</td>
- </tr>
- <tr id="param-cfg-row">
- <td style="font-weight: 600; color: var(--text-sub);">Activated Configuration base on</td>
- <td id="param-cfg-ver" style="font-family: Consolas, monospace; color: var(--text-main);">-</td>
- </tr>
- <tr>
- <td style="font-weight: 600; color: var(--text-sub);">System Time</td>
- <td id="param-sys-time" style="font-family: Consolas, monospace; color: var(--text-main);">-</td>
- </tr>
- <tr>
- <td style="font-weight: 600; color: var(--text-sub);">System Uptime</td>
- <td id="param-uptime" style="font-family: Consolas, monospace; color: var(--text-main);">-</td>
- </tr>
- <tr>
- <td style="font-weight: 600; color: var(--text-sub);">Load average</td>
- <td id="param-load-avg" style="font-family: Consolas, monospace; color: var(--text-main);">-</td>
- </tr>
- <tr>
- <td style="font-weight: 600; color: var(--text-sub);">Total RAM (KB)</td>
- <td id="param-total-ram" style="font-family: Consolas, monospace; color: var(--text-main);">-</td>
- </tr>
- <tr>
- <td style="font-weight: 600; color: var(--text-sub);">Free RAM (KB)</td>
- <td id="param-free-ram" style="font-family: Consolas, monospace; color: var(--text-main);">-</td>
- </tr>
- <tr>
- <td style="font-weight: 600; color: var(--text-sub);">GPON Serial Number</td>
- <td id="param-gpon-sn" style="font-family: Consolas, monospace; color: var(--text-main);">-</td>
- </tr>
- <tr>
- <td style="font-weight: 600; color: var(--text-sub);">GPON State</td>
- <td id="param-gpon-state" style="font-family: Consolas, monospace; color: var(--text-main);">-</td>
- </tr>
- </tbody>
- </table>
- </div>
- `;
- // Insertar en la parte superior del body
- iframeDoc.body.insertBefore(container, iframeDoc.body.firstChild);
- // Vincular botón de refresco
- iframeDoc.getElementById('summary-refresh-btn').addEventListener('click', () => {
- iframeDoc.defaultView.location.reload();
- });
- // Bucle de sincronización en tiempo real desde la tabla original
- const syncInterval = setInterval(() => {
- // Si el contenedor ya no está en el DOM (se cargó otra página), limpiar intervalo
- if (!iframeDoc.getElementById('askey-modern-summary-container')) {
- clearInterval(syncInterval);
- return;
- }
- try {
- // Leer datos nativos de la tabla original del router
- const rawHW = iframeDoc.getElementById('td_HWVer')?.textContent || '-';
- const rawSW = iframeDoc.getElementById('td_SWVer')?.textContent || '-';
- const rawCfg = iframeDoc.getElementById('td_CfgVer')?.textContent || '-';
- const rawTime = iframeDoc.getElementById('td_sysTime')?.textContent || '-';
- const rawUptime = iframeDoc.getElementById('td_sysUptime')?.textContent || '-';
- const rawLoad = iframeDoc.getElementById('td_LoadAvg')?.textContent || '-';
- const rawTotalRam = iframeDoc.getElementById('td_totalRam')?.textContent || '-';
- const rawFreeRam = iframeDoc.getElementById('td_freeRam')?.textContent || '-';
- const rawGPONSN = iframeDoc.getElementById('td_GPONSN')?.textContent || '-';
- const rawGPONState = iframeDoc.getElementById('td_GPONState')?.textContent || '-';
- // 1. Sincronizar tabla inferior de parámetros
- iframeDoc.getElementById('param-hw-ver').textContent = rawHW;
- iframeDoc.getElementById('param-sw-ver').textContent = rawSW;
- const cfgRow = iframeDoc.getElementById('param-cfg-row');
- if (cfgRow) {
- const originalCfgRow = iframeDoc.getElementById('act_cfg');
- if (originalCfgRow) {
- iframeDoc.getElementById('param-cfg-ver').textContent = rawCfg;
- } else {
- cfgRow.style.display = 'none';
- }
- }
- iframeDoc.getElementById('param-sys-time').textContent = rawTime;
- iframeDoc.getElementById('param-uptime').textContent = rawUptime;
- iframeDoc.getElementById('param-load-avg').textContent = rawLoad;
- iframeDoc.getElementById('param-total-ram').textContent = rawTotalRam;
- iframeDoc.getElementById('param-free-ram').textContent = rawFreeRam;
- iframeDoc.getElementById('param-gpon-sn').textContent = rawGPONSN;
- iframeDoc.getElementById('param-gpon-state').textContent = rawGPONState;
- // 2. RAM Widget
- const totalKb = parseInt(rawTotalRam.replace(/[^\d]/g, '')) || 0;
- const freeKb = parseInt(rawFreeRam.replace(/[^\d]/g, '')) || 0;
- if (totalKb > 0) {
- const usedKb = totalKb - freeKb;
- const pct = Math.round((usedKb / totalKb) * 100);
- const totalMb = Math.round(totalKb / 1024);
- iframeDoc.getElementById('widget-ram-pct').innerHTML = `${pct}% <span style="font-size: 14px; font-weight: 500; opacity: 0.6;">/ ${totalMb}MB</span>`;
- const barFill = iframeDoc.getElementById('widget-ram-bar');
- if (barFill) barFill.style.setProperty('width', `${pct}%`, 'important');
- iframeDoc.getElementById('widget-ram-free').textContent = `FREE: ${freeKb.toLocaleString()} KB`;
- iframeDoc.getElementById('widget-ram-total').textContent = `TOTAL: ${totalKb.toLocaleString()} KB`;
- }
- // 3. Load Average Widget
- const loads = rawLoad.split(/[\s,]+/);
- if (loads.length >= 3) {
- iframeDoc.getElementById('widget-load-1').textContent = loads[0] || '0.00';
- iframeDoc.getElementById('widget-load-5').textContent = loads[1] || '0.00';
- iframeDoc.getElementById('widget-load-15').textContent = loads[2] || '0.00';
- } else if (rawLoad && rawLoad !== '-') {
- iframeDoc.getElementById('widget-load-1').textContent = rawLoad;
- }
- // 4. GPON State Widget
- iframeDoc.getElementById('widget-gpon-state').textContent = rawGPONState;
- iframeDoc.getElementById('widget-gpon-sn').textContent = `SN: ${rawGPONSN}`;
- const isSynchronized = rawGPONState.toUpperCase().includes('O5') || rawGPONState.toUpperCase().includes('OPER');
- const gponCard = iframeDoc.getElementById('widget-gpon-card');
- const statusLabel = iframeDoc.getElementById('widget-gpon-status-label');
- if (isSynchronized) {
- statusLabel.textContent = 'LINK SYNCHRONIZED';
- statusLabel.style.color = '#4edea3';
- if (gponCard) gponCard.style.borderLeft = '4px solid #4edea3';
- } else {
- statusLabel.textContent = 'LINK DOWN / ERROR';
- statusLabel.style.color = '#ffb4ab';
- if (gponCard) gponCard.style.borderLeft = '4px solid #ffb4ab';
- }
- // 5. System Time Widget
- if (rawTime && rawTime !== '-') {
- const timeParts = rawTime.split(' ');
- if (timeParts.length >= 2) {
- iframeDoc.getElementById('widget-time-clock').textContent = timeParts[1];
- iframeDoc.getElementById('widget-time-date').textContent = timeParts[0];
- } else {
- iframeDoc.getElementById('widget-time-clock').textContent = rawTime;
- }
- }
- } catch (e) {
- console.error("Error sincronizando widgets summary:", e);
- }
- }, 250);
- }
- // Estilizar automáticamente las páginas de configuración para agrupar en tarjetas pro
- function beautifyConfigForms(iframeDoc, pageName) {
- // 1. Transformar fieldsets nativos en tarjetas Premium
- const fieldsets = iframeDoc.querySelectorAll('fieldset');
- fieldsets.forEach(fs => {
- fs.classList.add('config-card');
- const legend = fs.querySelector('legend');
- if (legend) {
- legend.className = 'config-card-title';
- }
- });
- // 2. Buscar bloques div dentro de formularios que tengan etiquetas y controles y darles diseño flexbox
- const divs = iframeDoc.querySelectorAll('form > div, .tab_content > div, fieldset > div');
- divs.forEach(div => {
- const label = div.querySelector('label');
- const control = div.querySelector('input, select, textarea');
- // Excluir si está dentro de una tabla o si ya se procesó
- if (label && control && !div.closest('table') && !div.classList.contains('form-row')) {
- div.classList.add('form-row');
- // Mapear alineación flexbox envolviendo controles
- if (control.parentNode === div) {
- const wrapper = iframeDoc.createElement('div');
- wrapper.className = 'form-row-content';
- // Transferir todos los nodos que no sean el label
- const childs = Array.from(div.childNodes);
- childs.forEach(ch => {
- if (ch !== label) {
- wrapper.appendChild(ch);
- }
- });
- div.appendChild(wrapper);
- }
- }
- });
- }
- // Inyectar CSS y metadatos en el iframe
- function modernizeIFrame(iframe) {
- try {
- const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
- if (!iframeDoc || !iframeDoc.body) return;
- // Inyectar hoja de estilos modernos
- let styleTag = iframeDoc.getElementById('askey-iframe-modern-style');
- if (!styleTag) {
- styleTag = iframeDoc.createElement('style');
- styleTag.id = 'askey-iframe-modern-style';
- styleTag.textContent = iframeCSS;
- iframeDoc.head.appendChild(styleTag);
- }
- // Metadato viewport
- if (!iframeDoc.querySelector('meta[name="viewport"]')) {
- const viewport = iframeDoc.createElement('meta');
- viewport.name = "viewport";
- viewport.content = "width=device-width, initial-scale=1.0";
- iframeDoc.head.appendChild(viewport);
- }
- // Sincronizar tema
- iframeDoc.documentElement.setAttribute('data-theme', currentTheme);
- iframeDoc.body.setAttribute('data-theme', currentTheme);
- // Detectar página actual en el iframe
- const path = iframe.contentWindow.location.pathname;
- const page = path.substring(path.lastIndexOf('/') + 1).toLowerCase();
- if (page === 'summary.asp') {
- renderSummaryWidgets(iframeDoc);
- } else if (page === 'wifi.asp' || page === 'wifi5g.asp' || page === 'dhcp.asp' || page === 'wanintf.asp') {
- beautifyConfigForms(iframeDoc, page);
- }
- } catch (e) {
- // Ignorar errores CORS
- }
- }
- // Sincronizar el enlace activo en sidebar leyendo el iframe
- function syncActiveSidebarLink(iframe) {
- try {
- const path = iframe.contentWindow.location.pathname;
- const page = path.substring(path.lastIndexOf('/') + 1);
- if (!page) return;
- clearActiveSidebarStates();
- // Buscar en sub-menu-items primero
- const subItems = document.querySelectorAll('.sub-menu-item');
- let found = false;
- subItems.forEach(sub => {
- const dataUrl = sub.getAttribute('data-url');
- if (dataUrl && dataUrl.toLowerCase() === page.toLowerCase()) {
- sub.classList.add('active');
- found = true;
- // Título de la página
- document.getElementById('modern-page-title').textContent = sub.textContent;
- // Activar y expandir el menú colapsable superior
- const wrapper = sub.closest('.menu-item-wrapper');
- if (wrapper) {
- const parentMenu = wrapper.querySelector('.menu-item-expandable');
- const subMenu = wrapper.querySelector('.sub-menu-container');
- const arrow = wrapper.querySelector('.menu-item-arrow');
- if (parentMenu) {
- parentMenu.classList.add('active');
- }
- if (subMenu) {
- subMenu.style.maxHeight = '350px';
- }
- if (arrow) {
- arrow.style.transform = 'rotate(90deg)';
- }
- }
- }
- });
- // Si no se encuentra, buscar en enlaces de primer nivel directos
- if (!found) {
- const singleLinks = document.querySelectorAll('.menu-item-single');
- singleLinks.forEach(link => {
- const dataUrl = link.getAttribute('data-url');
- if (dataUrl && dataUrl.toLowerCase() === page.toLowerCase()) {
- link.classList.add('active');
- document.getElementById('modern-page-title').textContent = link.querySelector('span:not(.menu-item-icon)').textContent;
- }
- });
- }
- } catch (e) {
- // Ignorar errores CORS
- }
- }
- // Cargar asíncronamente detalles de sesión y modelo del router
- function loadSystemDetails() {
- // Cargar usuario
- try {
- if (window.readCookie && window.mess_userpass) {
- const user = window.mess_userpass(window.readCookie("LoginName")) || "Admin";
- document.getElementById('user-logged-name').textContent = user;
- }
- } catch (e) {}
- // AJAX para modelo de router
- try {
- const goformCbk = "cbGetSummary";
- const xhr = new XMLHttpRequest();
- xhr.open("POST", "/cgi-bin/" + goformCbk + ".xml", true);
- xhr.setRequestHeader("Content-Type", "application/xml");
- xhr.onreadystatechange = function() {
- if (xhr.readyState === 4 && xhr.status === 200) {
- const xml = xhr.responseXML;
- if (xml) {
- const modelNode = xml.getElementsByTagName("DeviceModel")[0];
- const verNode = xml.getElementsByTagName("SWVersion")[0];
- const model = modelNode ? modelNode.textContent : "Askey Router";
- const ver = verNode ? verNode.textContent : "v1.0.0";
- document.getElementById('device-model-label').textContent = model;
- document.getElementById('modern-device-ver').textContent = "Versión: " + ver;
- }
- }
- };
- xhr.onerror = function() {
- document.getElementById('device-model-label').textContent = "Askey Router";
- document.getElementById('modern-device-ver').textContent = "v1.0.0-stable";
- };
- xhr.send();
- } catch (e) {
- document.getElementById('device-model-label').textContent = "Askey Router";
- document.getElementById('modern-device-ver').textContent = "v1.0.0-stable";
- }
- }
- // Inicializar SPA sustituyendo el DOM del frameset
- function init() {
- // Eliminar frameset antiguo del DOM
- const frameset = document.querySelector('frameset');
- if (frameset) {
- frameset.parentNode.removeChild(frameset);
- }
- // Eliminar noframes
- const noframes = document.querySelector('noframes');
- if (noframes) {
- noframes.parentNode.removeChild(noframes);
- }
- // Asegurar la existencia de un body estándar limpio
- let body = document.querySelector('body');
- if (!body) {
- body = document.createElement('body');
- document.documentElement.appendChild(body);
- } else {
- body.innerHTML = '';
- }
- // Renderizar la SPA
- buildModernApp();
- }
- if (document.readyState === 'complete' || document.readyState === 'interactive') {
- init();
- } else {
- window.addEventListener('DOMContentLoaded', init);
- }
- })();
Advertisement