From 714c19f55885228aad2dc742ecd2e3bf8ae802a3 Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Mon, 8 Sep 2025 17:31:43 +0200 Subject: [PATCH] Some code cosmetics --- cps/services/worker.py | 2 +- .../js/reading/locationchange-polyfill.js | 21 ------------------- cps/templates/layout.html | 3 +-- cps/templates/read.html | 1 - 4 files changed, 2 insertions(+), 25 deletions(-) delete mode 100644 cps/static/js/reading/locationchange-polyfill.js diff --git a/cps/services/worker.py b/cps/services/worker.py index a804f633..2a0809ca 100644 --- a/cps/services/worker.py +++ b/cps/services/worker.py @@ -235,7 +235,7 @@ class CalibreTask: @property def dead(self): - """Determines whether this task can be garbage collected + """Determines whether or not this task can be garbage collected We have a separate dictating this because there may be certain tasks that want to override this """ diff --git a/cps/static/js/reading/locationchange-polyfill.js b/cps/static/js/reading/locationchange-polyfill.js deleted file mode 100644 index 4845ea84..00000000 --- a/cps/static/js/reading/locationchange-polyfill.js +++ /dev/null @@ -1,21 +0,0 @@ -// register new event emitter locationchange that fires on urlchange -// source: https://stackoverflow.com/a/52809105/21941129 -(() => { - let oldPushState = history.pushState; - history.pushState = function pushState() { - let ret = oldPushState.apply(this, arguments); - window.dispatchEvent(new Event('locationchange')); - return ret; - }; - - let oldReplaceState = history.replaceState; - history.replaceState = function replaceState() { - let ret = oldReplaceState.apply(this, arguments); - window.dispatchEvent(new Event('locationchange')); - return ret; - }; - - window.addEventListener('popstate', () => { - window.dispatchEvent(new Event('locationchange')); - }); -})(); diff --git a/cps/templates/layout.html b/cps/templates/layout.html index d433a5aa..75d12367 100644 --- a/cps/templates/layout.html +++ b/cps/templates/layout.html @@ -41,8 +41,7 @@
{% endif %} {% if current_user.is_authenticated or g.allow_anonymous %} - -