Unit 12: widget partials — extract inline JS, add SRI, i18n labels#14
Open
stradichenko wants to merge 1 commit intomainfrom
Open
Unit 12: widget partials — extract inline JS, add SRI, i18n labels#14stradichenko wants to merge 1 commit intomainfrom
stradichenko wants to merge 1 commit intomainfrom
Conversation
For each of: zipfs-law, lda-analysis, knowledge-graph, filters,
gallery-slider, contribution-calendar:
- Move inline <script> blocks into the corresponding
assets/js/<widget>.js (created where missing). Pass per-page data via
inline <script type=application/json id=<widget>-data> blocks read by
the JS on init.
- Bundle each widget JS with js.Build | minify | fingerprint and defer.
- Add SRI integrity (or self-host) for D3, TensorFlow.js, mermaid.
- i18n widget labels (Activity Calendar, Less / More, Physics Controls,
Repulsion, Reset to Default, All Nodes, Save as PNG/SVG/JPEG, LDA and
Zipf labels) with English fallback.
- zipfs-law: replace the template-driven allWords.push("...") loop
(~36 lines) with a single jsonify dump in a
<script type=application/json> block.
- gallery-slider: extract the 460-LOC inline GallerySlider ES6 class
into assets/js/gallery-slider.js.
- Wire assets/js/contribution-calendar.js back in (it was effectively
dead before).
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.
Summary
For each of:
zipfs-law,lda-analysis,knowledge-graph,filters,gallery-slider,contribution-calendar:<script>blocks intoassets/js/<widget>.js(created where missing). Pass per-page data via inline<script type="application/json" id="<widget>-data">blocks read by the JS on init.js.Build | minify | fingerprintanddefer. Add SRI integrity (or self-host) for D3, TensorFlow.js, mermaid.zipfs-law: replace the template-drivenallWords.push("...")loop (~36 lines) with a singlejsonifydump in a<script type="application/json">block.gallery-slider: extract the 460-LOC inlineGallerySliderES6 class intoassets/js/gallery-slider.js.assets/js/contribution-calendar.jsback in (it was effectively dead before).Notes for reviewer
assets/js/contribution-calendar.jsthinking it's dead. Resolve by keeping the file (Unit 12 wires it).Test plan
<script src="...fingerprint...">referencing the widget JS./about/(zipf), any post (sidenote/citation), and a knowledge-graph-enabled page still load.Part of the PKB-theme modernization batch (15 units).