aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2025-06-17 00:47:00 +0200
committerGuilhem Moulin <guilhem@fripost.org>2025-06-17 00:47:00 +0200
commit7cb06ca73487b85a29784fb49fdc1131d534e1da (patch)
tree498974ef83c3b7102d802e7028e3c6c2b3a93f9b
parentc2458cdca0df1147e12e4dd75a28c712d898cee3 (diff)
Add comments.
-rw-r--r--main.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/main.js b/main.js
index c0a3186..0a2449c 100644
--- a/main.js
+++ b/main.js
@@ -2656,6 +2656,9 @@ const STYLES = {};
/* eslint-disable-next-line no-useless-escape */
const m0 = /^([ +\-]?)([0-9]+)([dwmy])$/.exec(value);
if (m0 != null) {
+ /* handling relative parameter values add some complexity, but it's worth doing since
+ * users can bookmark the URL with e.g., age-filter=-1y and visit it later with the
+ * timeframe shifted forward, thus not having to reconfigure the age filter */
ageFilterSettings.type = 'relative';
ageFilterSettings.operator = (m0[1] === ' ' || m0[1] === '+' || m0[1] === '') ? '>='
: m0[1] === '-' ? '<='
@@ -5318,6 +5321,7 @@ const ageFilterSetActive = (function() {
ageFilterSettings._min_ts = ageFilterSettings._max_ts = null;
switch (filter_type) {
case 'relative': {
+ /* save relative value so it can be autoshifted later */
const operator = ageFilterSettings.operator = filter_settings.operator[0].value;
ageFilterSettings.quantity = parseInt(filter_settings.quantity.value, 10);
ageFilterSettings.unit = filter_settings.unit[0].value;