From 7cb06ca73487b85a29784fb49fdc1131d534e1da Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Tue, 17 Jun 2025 00:47:00 +0200 Subject: Add comments. --- main.js | 4 ++++ 1 file changed, 4 insertions(+) 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; -- cgit v1.2.3