From caa7874bb36f3cc75423bce7b26cfde60eb8bc3d Mon Sep 17 00:00:00 2001 From: eraiza0816 <10572974+eraiza0816@users.noreply.github.com> Date: Tue, 11 Aug 2026 05:40:01 +0900 Subject: [PATCH] feat(webui): consolidate the page scripts into a single main.js bundle All 17 page scripts (i18n, shared helpers, navigation and the per-page scripts) are merged into one html/main.js that every page loads as its only script, so the browser fetches it once and gzip can compress across all of it. The page-specific initialisation is guarded by the presence of the matching page elements (it used to be selected implicitly by which script a page loaded); the sidebar fill and the stat popup wiring moved into DOMContentLoaded handlers because the bundle loads in
, before the body exists. tools/httpd_sim.h: BUFFER_SIZE 24000 -> 131072 so the simulator can serve the larger bundle (the firmware is unaffected, it serves the gzip'd bundle of ~17 KB). Measured (make MACHINE=KP_9000_6XHML_X2): the JS drops from 23,302 to 16,948 bytes gzip; the whole Web UI from 34,784 to 28,200 bytes (25.3 % of the raw 111,280); the data block ends at 0x46e28. Verified with a headless browser against httpd_sim and against a real PCB-K0402WS-V3: all pages render, the sidebar and the port strip are drawn, no JavaScript errors. --- html/bandwidth.html | 3 - html/bandwidth.js | 138 --- html/config.js | 111 --- html/eee.html | 4 - html/eee.js | 52 -- html/eee_sub.js | 18 - html/i18n.js | 603 ------------ html/index.html | 3 - html/l2.html | 3 - html/l2.js | 194 ---- html/lag.html | 3 - html/lag.js | 81 -- html/login.html | 2 +- html/main.js | 2166 +++++++++++++++++++++++++++++++++++++++++++ html/main_info.js | 22 - html/mirror.html | 4 - html/mirror.js | 64 -- html/mirror_sub.js | 43 - html/navigation.js | 20 - html/ports.html | 3 - html/ports.js | 149 --- html/stat.html | 3 - html/stat.js | 207 ----- html/system.html | 5 +- html/system.js | 208 ----- html/update.html | 3 +- html/vlan.html | 4 - html/vlan.js | 211 ----- html/vlan_sub.js | 36 - tools/httpd_sim.h | 2 +- 30 files changed, 2170 insertions(+), 2195 deletions(-) delete mode 100644 html/bandwidth.js delete mode 100644 html/config.js delete mode 100644 html/eee.js delete mode 100644 html/eee_sub.js delete mode 100644 html/i18n.js delete mode 100644 html/l2.js delete mode 100644 html/lag.js delete mode 100644 html/main_info.js delete mode 100644 html/mirror.js delete mode 100644 html/mirror_sub.js delete mode 100644 html/navigation.js delete mode 100644 html/ports.js delete mode 100644 html/stat.js delete mode 100644 html/system.js delete mode 100644 html/vlan.js delete mode 100644 html/vlan_sub.js diff --git a/html/bandwidth.html b/html/bandwidth.html index 9b6b96f8..57ce9459 100644 --- a/html/bandwidth.html +++ b/html/bandwidth.html @@ -1,7 +1,6 @@ -