From cc21682d3b98b62b8db60f53e53910a1184fd8b3 Mon Sep 17 00:00:00 2001 From: tdro Date: Wed, 6 Jul 2022 22:12:59 -0400 Subject: static/js/pager: Bail when under cookie restrictions --- assets/js/index.js | 6 ++++++ static/js/pager.ts | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/assets/js/index.js b/assets/js/index.js index 1c2715b..77c52a6 100644 --- a/assets/js/index.js +++ b/assets/js/index.js @@ -4,9 +4,15 @@ (function() { const url = self.location.href.split("#")[0]; + const cookiesDisabled = !navigator.cookieEnabled; let settings = { pager: {} }; + if (cookiesDisabled) { + document.cookie = "disabled"; + document.cookie.indexOf("disabled"); + return console.log("Pager is disabled due to cookie restrictions."); + } self.addEventListener("DOMContentLoaded", function() { if (history.scrollRestoration) history.scrollRestoration = "manual"; if (localStorage["settings"]) { diff --git a/static/js/pager.ts b/static/js/pager.ts index 49f3b2d..c77ba40 100644 --- a/static/js/pager.ts +++ b/static/js/pager.ts @@ -1,7 +1,14 @@ (function () { const url = self.location.href.split("#")[0]; + const cookiesDisabled = !navigator.cookieEnabled; let settings = { pager: {} }; + if (cookiesDisabled) { + document.cookie = "disabled"; + document.cookie.indexOf("disabled"); + return console.log("Pager is disabled due to cookie restrictions."); + } + self.addEventListener("DOMContentLoaded", function () { if (history.scrollRestoration) history.scrollRestoration = "manual"; if (localStorage["settings"]) { -- cgit v1.2.3