diff options
| author | 2023-10-06 19:46:53 +0000 | |
|---|---|---|
| committer | 2023-10-06 19:46:53 +0000 | |
| commit | fb40e7c2fc5aa00bd7d066abfc9fb25c26c5a299 (patch) | |
| tree | 7353615c17953be7dd1110d6dcdb81ebd013de77 /js/timeago_mkdocs_material.js | |
| download | infini-fb40e7c2fc5aa00bd7d066abfc9fb25c26c5a299.tar.gz infini-fb40e7c2fc5aa00bd7d066abfc9fb25c26c5a299.zip | |
Deployed d629000 with MkDocs version: 1.5.3
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 00000000..b3c8cdf8 --- /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); + } +} |
