Category:SVG created with JavaScript
Jump to navigation
Jump to search
Self-generating SVG pioneered by TilmannR (talk · contribs) and further developed by cmglee (talk · contribs) which uses JavaScript to replace itself with static SVG, and embed itself as a comment.
This avoids users needing any software except a web browser and a text editor to update and rerun the script.
Editing workflow:
- Open a template file or existing file to be amended in a text editor.
- Amend code in user-editable parts as needed.
- Delete the "!--" and "--" on lines indicated.
- Save as a new file or file to be amended.
- Open the file in Firefox or Chrome.
- In the web browser, save as another file.
- Upload this file to Commons.
Drawbacks of this method:
- Escaped non-ASCII characters are converted to their UTF-8 equivalents so the file may no longer be ASCII (giving mojibake in some text editors).
- The JavaScript must not have two consecutive hyphens (--).
- Errors may be difficult to debug for editors unfamiliar with JavaScript; pressing F12 and selecting the Console tab may give clues.
Media in category "SVG created with JavaScript"
The following 9 files are in this category, out of 9 total.
-
Template map of US states and District of Columbia.svg 512 × 341; 52 KB
-
Binomial trial dice.svg 512 × 512; 14 KB
-
Cognitive bias codex en uk.svg 1,900 × 1,500; 178 KB
-
Cognitive bias codex en.svg 1,900 × 1,500; 167 KB
-
Gabriel horn 2d.svg 512 × 384; 4 KB
-
Phyllotaxis golden angle.svg 512 × 512; 11 KB
-
Pythagorean tuning geometric.svg 512 × 512; 6 KB
-
Visual cryptography stenography.svg 512 × 512; 240 KB
-
Visual proof harmonic series diverges.svg 512 × 512; 11 KB