From cf41deedd9d8eb9e8f34af613aecaa5c0eb72a24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Syn=C3=A1=C4=8Dek?= Date: Fri, 17 Jul 2020 22:33:57 +0200 Subject: [PATCH] remove manual "no javascript" switch This was a stupid checkbox made only as an experiment. The page can still be loaded without JavaScript and works, no need to trigger it manually. --- lib/static/app/utils.js | 5 ----- lib/static/index.html | 14 ++++++-------- lib/static/index.js | 32 +++----------------------------- lib/static/style.css | 8 ++++++++ 4 files changed, 17 insertions(+), 42 deletions(-) diff --git a/lib/static/app/utils.js b/lib/static/app/utils.js index 0fe8702..bdd0189 100644 --- a/lib/static/app/utils.js +++ b/lib/static/app/utils.js @@ -1,7 +1,3 @@ -const noJS = () => { - return Boolean(document.querySelector("#nojs").checked) -} - const useStorage = () => Boolean(window.localStorage) // NOTE: Generate random IDs: https://stackoverflow.com/a/2117523/3056783 @@ -28,7 +24,6 @@ const parseStartTimeFromiCalString = (text = '') => { } export { - noJS, uuidv4, parseStartTimeFromiCalString, useStorage, diff --git a/lib/static/index.html b/lib/static/index.html index 31f5c30..415e1ac 100644 --- a/lib/static/index.html +++ b/lib/static/index.html @@ -35,6 +35,12 @@ + +
Fetching file... @@ -50,14 +56,6 @@
- - -
-
-
diff --git a/lib/static/index.js b/lib/static/index.js index 3aecb7f..0f720b1 100644 --- a/lib/static/index.js +++ b/lib/static/index.js @@ -1,4 +1,4 @@ -import { noJS, uuidv4, parseStartTimeFromiCalString, useStorage } from './app/utils' +import { uuidv4, parseStartTimeFromiCalString, useStorage } from './app/utils' import { migrateRecord, getStorage, @@ -199,19 +199,8 @@ import generateICS from '../../lib/services/ics-generator' const link = document.querySelector("#current-download") const table = document.querySelector('#list') const tableBody = table.querySelector('tbody') - const noJScheckbox = document.querySelector('#nojs') - const loadNoJS = () => { - if (!useStorage()) { - return - } - const value = localStorage.getItem('fb-to-ical-nojs') - noJScheckbox.checked = value ? JSON.parse(value) : false - } - - loadNoJS() - - if (window.navigator && window.navigator.serviceWorker && !noJS()) { + if (window.navigator && window.navigator.serviceWorker) { const serviceWorker = window.navigator.serviceWorker serviceWorker.register('sw.js', { scope: './', @@ -245,18 +234,7 @@ import generateICS from '../../lib/services/ics-generator' }) } - if (!noJS()) { - hydrateList() - } - - noJScheckbox.addEventListener('click', (event) => { - if (!useStorage()) { - return - } - - localStorage.setItem('fb-to-ical-nojs', event.target.checked) - }) - + hydrateList() const handleHTMLResponse = (html) => { try { @@ -295,10 +273,6 @@ import generateICS from '../../lib/services/ics-generator' } submitButton.addEventListener('click', (event) => { - if (noJS()) { - return - } - if (!form.reportValidity()) { return } diff --git a/lib/static/style.css b/lib/static/style.css index 48aa384..0aee628 100644 --- a/lib/static/style.css +++ b/lib/static/style.css @@ -158,3 +158,11 @@ td.actions a { a.delete-record { font-size: 1.2rem; } + +.notice { + font-size: 0.9rem; +} + +#nojs { + margin: 5px 0; +}