perf: fix 9 JS inefficiencies across /docs chapter, search, and bookmarks pages; add Devnagri Urdu (Maududi) translation#33
Draft
Copilot wants to merge 5 commits into
Draft
Conversation
…scroll rAF, permalink delegation, search regex/array caching, bookmarks event delegation Co-authored-by: druvx13 <131332414+druvx13@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Identify and suggest improvements to slow or inefficient code
perf: fix 9 JS inefficiencies across /docs chapter, search, and bookmarks pages
Mar 12, 2026
Owner
|
Nice work; @copilot , i have added “quran_devnagri_urdu_maududi.html” in /data directory creates it's output in /output directory like in the format as others are and also include it in /docs website. |
Co-authored-by: druvx13 <131332414+druvx13@users.noreply.github.com>
Contributor
Author
Done in commit
The new "Devnagri Urdu (Maududi)" row now appears in each verse alongside the other translations and is searchable from |
Copilot
AI
changed the title
perf: fix 9 JS inefficiencies across /docs chapter, search, and bookmarks pages
perf: fix 9 JS inefficiencies across /docs chapter, search, and bookmarks pages; add Devnagri Urdu (Maududi) translation
Mar 12, 2026
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.
Several hot-path JS routines in the generated
/docspages had algorithmic and DOM inefficiencies causing measurable jank on filter toggles, scroll, and search operations across all 114 chapter files.Chapter pages (
001.html–114.html)applyAllRows()— replaced O(n×m) nested Set+classList loop withArray.prototype.some.call(tr.classList, c => enabledTypes.has(c)), flipping the iteration to walk the small classList (2–3 items) and hit the Set in O(1)applyFs()— collapsed twoquerySelectorAllpasses into one; also fixes a silent bug wheretd:not(.label)in the second pass overwrote.arabic-textcells with the wrong font size at non-default scale stepsdisplaytoggle behindrequestAnimationFrame+ ticking flag to cap DOM writes at one per frameaddEventListenercalls with a single delegated listener ondocumentcopyVerse— replacedtr.querySelector('.label')with directtr.cells[0]search.htmlhighlight()— movednew RegExp(…)construction out of the per-result-per-field call intobuildHighlightRegexes(), called once per search; previously created 200+ RegExp objects per page renderdoSearch()— pre-computesfieldArraysbefore the 6,236-row loop, eliminating repeatedfieldCache[f[0]]||[]lookups per rowrenderPage()— same pre-cache pattern applied before the results render loopbookmarks.htmlonclick="deleteBm(i)"(fragile stale-index binding) withdata-key="s:a"and a single delegated listener; deletion now resolves by stable surah:ayah identityDevnagri Urdu (Maududi) translation
Added the Devanagari-script Urdu translation by Abul Ala Maududi to the website:
src/gentxtforquran.py— added aDevnagri-Urdu-HTMLparser that strips HTML tags fromdata/quran_devnagri_urdu_maududi.html, normalizes split verse markers (e.g.[ \nS:A]→[S:A]), and extracts all[S:A]verse lines to produceoutput/quran_devnagri_urdu_maududi.txt(6,210 of 6,236 verses; 26 are absent in the upstream source HTML)src/gendocshtml.py— loads the new output file, adds a styleddevnagri-urdurow (light blue-grey background, Devanagari font, indigo text) with dark mode support, adds it to the Content Filter checkbox list, writesdocs/sd/devnagri-urdu.jsonfor search, and registers it insearch.html'sFIELD_MAPApproach
All JS and translation templates live in
src/gendocshtml.py. Changes were made there and the full/docsdirectory regenerated — 114 chapter files +search.html+bookmarks.html+config.html+config.js+docs/sd/devnagri-urdu.json.🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.