diff options
author | Andrew Dolgov <[email protected]> | 2018-11-23 15:10:35 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2018-11-23 15:10:35 +0300 |
commit | 35d9cc340c923b1cd7ec2226980191a0402ddf5a (patch) | |
tree | 669ea93436029bd370578082d9c7dde1fd165151 | |
parent | b9a0f230aeae4e8e1ea6978c164cc6cf66424fa2 (diff) |
worker: implement cache-busting for forced refreshes; remove leftover includes of qtip2
-rw-r--r-- | js/read.js | 2 | ||||
-rw-r--r-- | login.php | 2 | ||||
-rw-r--r-- | offline.html | 2 | ||||
-rw-r--r-- | worker.js | 15 |
4 files changed, 11 insertions, 10 deletions
@@ -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; @@ -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" /> @@ -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); } }); |