From fb40e7c2fc5aa00bd7d066abfc9fb25c26c5a299 Mon Sep 17 00:00:00 2001 From: <> Date: Fri, 6 Oct 2023 19:46:53 +0000 Subject: Deployed d629000 with MkDocs version: 1.5.3 --- js/timeago_mkdocs_material.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 js/timeago_mkdocs_material.js (limited to 'js/timeago_mkdocs_material.js') 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); + } +} -- cgit v1.2.3-70-g09d2