diff options
| author | 2024-02-18 11:51:10 +0000 | |
|---|---|---|
| committer | 2024-02-18 11:51:10 +0000 | |
| commit | b31636072338d2879b528258de8accf4a66c68d3 (patch) | |
| tree | a1fa4ba9a199c265bef5239e78b8a1a50edb7ab0 /js/timeago_mkdocs_material.js | |
| download | TRPGNivis-b31636072338d2879b528258de8accf4a66c68d3.tar.gz TRPGNivis-b31636072338d2879b528258de8accf4a66c68d3.zip | |
Deployed 9b916be with MkDocs version: 1.5.3gh-pages
Diffstat (limited to 'js/timeago_mkdocs_material.js')
| -rw-r--r-- | js/timeago_mkdocs_material.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/js/timeago_mkdocs_material.js b/js/timeago_mkdocs_material.js new file mode 100644 index 0000000..b3c8cdf --- /dev/null +++ b/js/timeago_mkdocs_material.js @@ -0,0 +1,18 @@ +// Script to ensure timeago keeps working when +// used with mkdocs-material's instant loading feature + +if (typeof document$ !== "undefined") { + document$.subscribe(function() { + var nodes = document.querySelectorAll('.timeago'); + if (nodes.length > 0) { + var locale = nodes[0].getAttribute('locale'); + timeago.render(nodes, locale); + } + }) +} else { + var nodes = document.querySelectorAll('.timeago'); + if (nodes.length > 0) { + var locale = nodes[0].getAttribute('locale'); + timeago.render(nodes, locale); + } +} |
