diff options
| author | 2023-07-27 14:00:50 +0800 | |
|---|---|---|
| committer | 2023-07-27 14:00:50 +0800 | |
| commit | 2e56832f4c6cabf9bb475d8c8bef345d32881512 (patch) | |
| tree | 78728f9ba69a225ec4fae39019dc3f30e246f545 /docs/site/js/timeago_mkdocs_material.js | |
| parent | 610e826c7848db4f3b0b22ee23e4a2543723594b (diff) | |
| parent | 913b5eaad25b9ba1cf0ad8d9b25633ec454c74e5 (diff) | |
| download | infini-2e56832f4c6cabf9bb475d8c8bef345d32881512.tar.gz infini-2e56832f4c6cabf9bb475d8c8bef345d32881512.zip | |
Merge pull request #9 from HydroRoll-Team/mkdocs
mkdocs
Diffstat (limited to 'docs/site/js/timeago_mkdocs_material.js')
| -rw-r--r-- | docs/site/js/timeago_mkdocs_material.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/docs/site/js/timeago_mkdocs_material.js b/docs/site/js/timeago_mkdocs_material.js new file mode 100644 index 00000000..b3c8cdf8 --- /dev/null +++ b/docs/site/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); + } +} |
