diff options
-rw-r--r-- | assets/js/index.js | 6 | ||||
-rw-r--r-- | static/js/update.ts | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/assets/js/index.js b/assets/js/index.js index fc1f6c3..7be41db 100644 --- a/assets/js/index.js +++ b/assets/js/index.js @@ -81,10 +81,10 @@ const url = self.location.href.split("#")[0].split("?")[0]; check(url, "HEAD", function(request) { const local = document.querySelector('meta[name="last-modified"]').content; - const remote = request.getResponseHeader("last-modified") || local; + const remote = request.getResponseHeader("last-modified") || ''; const modified = Date.parse(document.lastModified) !== Date.parse(remote); - const drift = Date.parse(remote) - Date.parse(local); - if (modified) { + const drift = Date.parse(remote || local) - Date.parse(local); + if (remote && modified) { const indicator = document.querySelector("a[data-update]"); check(url, "GET"); indicator.href = url; diff --git a/static/js/update.ts b/static/js/update.ts index 2b96751..d7fda45 100644 --- a/static/js/update.ts +++ b/static/js/update.ts @@ -17,11 +17,11 @@ const url = self.location.href.split("#")[0].split("?")[0]; check(url, "HEAD", function (request) { const local = document.querySelector('meta[name="last-modified"]').content; - const remote = request.getResponseHeader("last-modified") || local; + const remote = request.getResponseHeader("last-modified") || ''; const modified = Date.parse(document.lastModified) !== Date.parse(remote); - const drift = Date.parse(remote) - Date.parse(local); + const drift = Date.parse(remote || local) - Date.parse(local); - if (modified) { + if (remote && modified) { const indicator = document.querySelector("a[data-update]"); check(url, "GET"); indicator.href = url; |