summaryrefslogtreecommitdiffstatshomepage
path: root/dev/js/timeago_mkdocs_material.js
diff options
context:
space:
mode:
authorGitHub Action <action@github.com>2023-10-06 22:59:21 +0000
committerGitHub Action <action@github.com>2023-10-06 22:59:21 +0000
commitdfa4989a90e3631b7757639d4dccf84fa9ee029c (patch)
tree25f07bef63f9144f664e773d089620fdc0cc705f /dev/js/timeago_mkdocs_material.js
parentfb40e7c2fc5aa00bd7d066abfc9fb25c26c5a299 (diff)
downloadinfini-dfa4989a90e3631b7757639d4dccf84fa9ee029c.tar.gz
infini-dfa4989a90e3631b7757639d4dccf84fa9ee029c.zip
Deployed 77edb63 to dev with MkDocs 1.5.3 and mike 1.1.2
Diffstat (limited to 'dev/js/timeago_mkdocs_material.js')
-rw-r--r--dev/js/timeago_mkdocs_material.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/dev/js/timeago_mkdocs_material.js b/dev/js/timeago_mkdocs_material.js
new file mode 100644
index 00000000..b3c8cdf8
--- /dev/null
+++ b/dev/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);
+ }
+}