summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2018-11-23 15:10:35 +0300
committerAndrew Dolgov <[email protected]>2018-11-23 15:10:35 +0300
commit35d9cc340c923b1cd7ec2226980191a0402ddf5a (patch)
tree669ea93436029bd370578082d9c7dde1fd165151
parentb9a0f230aeae4e8e1ea6978c164cc6cf66424fa2 (diff)
worker: implement cache-busting for forced refreshes; remove leftover includes of qtip2
-rw-r--r--js/read.js2
-rw-r--r--login.php2
-rw-r--r--offline.html2
-rw-r--r--worker.js15
4 files changed, 11 insertions, 10 deletions
diff --git a/js/read.js b/js/read.js
index 3c0f652..6c960cf 100644
--- a/js/read.js
+++ b/js/read.js
@@ -98,7 +98,7 @@ function prev_page() {
function hotkey_handler(e) {
try {
- //console.log('K:' + e.which, e);
+ //console.log('K3:' + e.which, e);
if ($(".modal").is(":visible"))
return;
diff --git a/login.php b/login.php
index ac2fa9d..28a5a2c 100644
--- a/login.php
+++ b/login.php
@@ -36,13 +36,11 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="lib/bootstrap/v3/css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="lib/bootstrap/v3/css/bootstrap-theme.min.css" rel="stylesheet" media="screen">
- <link href="lib/qtip2/jquery.qtip.min.css" rel="stylesheet" media="screen">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="lib/bootstrap/v3/js/jquery.js"></script>
<script src="lib/bootstrap/v3/js/bootstrap.min.js"></script>
<script src="lib/holder.min.js"></script>
<script src="lib/localforage.min.js"></script>
- <script src="lib/qtip2/jquery.qtip.min.js"></script>
<title>The Epube</title>
<link type="text/css" rel="stylesheet" media="screen" href="css/index.css" />
<link rel="shortcut icon" type="image/png" href="img/favicon.png" />
diff --git a/offline.html b/offline.html
index 30f30fa..62c1efc 100644
--- a/offline.html
+++ b/offline.html
@@ -4,13 +4,11 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="lib/bootstrap/v3/css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="lib/bootstrap/v3/css/bootstrap-theme.min.css" rel="stylesheet" media="screen">
- <link href="lib/qtip2/jquery.qtip.min.css" rel="stylesheet" media="screen">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="lib/bootstrap/v3/js/jquery.js"></script>
<script src="lib/bootstrap/v3/js/bootstrap.min.js"></script>
<script src="lib/holder.min.js"></script>
<script src="lib/localforage.min.js"></script>
- <script src="lib/qtip2/jquery.qtip.min.js"></script>
<title>The Epube</title>
<link type="text/css" rel="stylesheet" media="screen" href="css/index.css" />
<link rel="shortcut icon" type="image/png" href="img/favicon.png" />
diff --git a/worker.js b/worker.js
index 2450407..a18b34c 100644
--- a/worker.js
+++ b/worker.js
@@ -3,6 +3,8 @@
const CACHE_PREFIX = 'epube';
const CACHE_NAME = CACHE_PREFIX + '-v2';
const CACHE_URLS = [
+ 'img/favicon_hires.png',
+ 'img/favicon.png',
'read.html',
'js/common.js',
'js/read.js',
@@ -79,15 +81,18 @@ self.addEventListener('message', function(event){
if (CACHE_URLS[i].match("backend.php"))
continue;
- //console.log(CACHE_URLS[i]);
+ var fetch_url = CACHE_URLS[i] + "?ts=" + Date.now();
- var promise = fetch(CACHE_URLS[i]).then(function(resp) {
- //console.log(resp);
+ var promise = fetch(fetch_url).then(function(resp) {
+ var url = new URL(resp.url);
+ url.searchParams.delete("ts");
+
+ console.log('got', url);
if (resp.status == 200) {
- cache.put(resp.url, resp);
+ cache.put(url, resp);
} else if (resp.status == 404) {
- cache.delete(resp.url);
+ cache.delete(url);
}
});