Refactor (3/N): split js/app.js into per-feature files#24
Merged
Conversation
Third step of splitting index.html. js/app.js is divided into 14 cohesive feature files, loaded as classic scripts in the SAME source order, so they share one global scope (the inline onclick handlers keep working) and execute identically. Verified the concatenation of the 14 files in load order is byte-for-byte identical to the previous app.js, so behavior is unchanged. jsmol-setup Info object + JSmol applet config / callbacks image-export PNG/JPEG export molecule-data atom-name preservation, XYZ loading, app startup viewer-controls spin / display mode / zoom search file/sample load + PubChem/database search orbitals MO list + navigation xyz-editor XYZ editor panel selection shared atom-selection state ui draggable panels, wheel zoom, resize observer jsme-2d 2D/3D (JSME) integration elemco ElemCo.jl input generation + Julia runner xtb xtb (g-xTB) energy/optimization app-init panel + application initialization preferences user preferences system (js/**/* is already in the electron-builder files allowlist.) Indentation is left as-is so this stays a pure move; an optional whitespace-only re-indent can follow. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Third step of splitting the large
index.html. This carves the singlejs/app.js(4,121 lines) into 14 cohesive feature files.Safety: provably behavior-preserving
The files are loaded as classic scripts in the same source order as the original code, so:
onclick=handlers and all cross-file function/variable references keep working;var/let/constglobals, theInfoobject, and the$(document).ready/addEventListenerregistrations) execute in the exact same order.I verified mechanically that concatenating the 14 files in load order is byte-for-byte identical to the previous
js/app.js— i.e. this is the same code, just partitioned. Each file also parses independently (node --check), confirming no split lands mid-statement.The files (load order)
jsmol-setup.jsInfoobject (JSmol applet config & callbacks)image-export.jsmolecule-data.js$(document).readystartupviewer-controls.jssearch.jsorbitals.jsxyz-editor.jsselection.jsui.jsjsme-2d.jselemco.jsxtb.jsapp-init.jspreferences.jsjs/**/*is already in thebuild.filesallowlist (from PR #23), so packaging is covered.Notes
renderer.jsstill redefines a few functions (copyElemCoInput,showElemCoPanel, …) that the app overrides — worth consolidating.Testing
app.js(verified).node --checkpasses for all 14 files.npm startsmoke test across the panels (load molecule, XYZ editor, selection both ways, orbitals, ElemCo, xtb).🤖 Generated with Claude Code