Commit aed78b7
authored
feat : Add JSON‑driven background image support (#316)
* Add background JSON support
- Load background map from JSON
- Store user preference
- Update DOMContentLoaded handler
* Refactor background-switcher.js
- Replace hardcoded BG_MAP with empty object
- Convert loadBackgroundMap to async/await
- Simplify DOMContentLoaded listener using async function
- Improve readability and eliminate data duplication
* Update background-switcher.js path and warning
- Use DOCUMENTATION_OPTIONS.URL_ROOT for robust JSON path
- Clarify warning when JSON fails to load
* Fix pre-commit workflow
- Remove duplicate pre-commit execution
- Keep only standard all-files check
- Fix CI failure caused by redundant hook stages
* Revert: Restore manual hook stage test
- Keep both pre-commit execution stages
- Standard hooks and manual hooks both needed
- Rename second step for clarity
* Apply prettier formatting
- Format background-switcher.js
- Format backgrounds.json
- Ensure code style consistency
* refactor: improve separation of concerns in loadBackgroundMap
- loadBackgroundMap now returns data (or null on failure) instead of
directly modifying the module-level BG_MAP variable
- Added robust data validation in DOMContentLoaded handler to ensure
the loaded JSON is a valid object before populating BG_MAP
- Addresses code review feedback for better maintainability and testability
* refactor: use Object.prototype.toString for robust type checking
- Replace multi-condition object check with more idiomatic approach
- Object.prototype.toString.call() handles edge cases like typeof null
- Addresses code review feedback for cleaner validation logic1 parent b3992fc commit aed78b7
File tree
3 files changed
+56
-26
lines changed- .github/workflows
- doc/source/_static
- data
- js
3 files changed
+56
-26
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
56 | 56 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
| 1 | + | |
20 | 2 | | |
21 | 3 | | |
22 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
23 | 31 | | |
24 | 32 | | |
25 | 33 | | |
| |||
62 | 70 | | |
63 | 71 | | |
64 | 72 | | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
| 73 | + | |
69 | 74 | | |
70 | | - | |
71 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
72 | 84 | | |
73 | 85 | | |
0 commit comments