aboutsummaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
authorArjun Satarkar <me@arjunsatarkar.net>2023-07-29 19:31:15 +0000
committerArjun Satarkar <me@arjunsatarkar.net>2023-07-29 19:41:22 +0000
commitada68d54884cb8ce609d35461bf2ddf3fbcaa120 (patch)
tree0f69e8838a5f456f4f14a8123ee15f61e911031f /static
parent0d06775761e2ea0c6268029ce33422275ba45332 (diff)
downloadtagrss-ada68d54884cb8ce609d35461bf2ddf3fbcaa120.tar
tagrss-ada68d54884cb8ce609d35461bf2ddf3fbcaa120.tar.gz
tagrss-ada68d54884cb8ce609d35461bf2ddf3fbcaa120.zip
Add auto-refresh JS
Diffstat (limited to 'static')
-rw-r--r--static/scripts/auto_refresh.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/static/scripts/auto_refresh.js b/static/scripts/auto_refresh.js
new file mode 100644
index 0000000..dd2bd1d
--- /dev/null
+++ b/static/scripts/auto_refresh.js
@@ -0,0 +1,16 @@
+(() => {
+ const UPDATE_INTERVAL_MILLISECONDS = 1 * 60 * 1000; // 1 minute
+ setInterval(async () => {
+ const response = await fetch(window.location, {
+ credentials: "same-origin",
+ });
+ if (!response.ok) {
+ return;
+ }
+ const responseText = await response.text();
+
+ const parser = new DOMParser();
+ const newDoc = parser.parseFromString(responseText, "text/html");
+ document.querySelector("table").innerHTML = newDoc.querySelector("table").innerHTML;
+ }, UPDATE_INTERVAL_MILLISECONDS);
+})();