From eca83243629e61ee73d4f6b6e88c2e28b47face9 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Wed, 11 Jun 2025 12:40:26 +0200 Subject: =?UTF-8?q?Rename=20=E2=80=9Cage=E2=80=9D=20to=20=E2=80=9Cts?= =?UTF-8?q?=E2=80=9D.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cf. 231d64cbd14c2d1ccb6468dc9666d4433e39834c in tools. --- main.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'main.js') diff --git a/main.js b/main.js index d9df4c0..0d1c7fb 100644 --- a/main.js +++ b/main.js @@ -158,9 +158,9 @@ const age_filter_settings = { } return d; }, - _min_age: null, - _max_age: null, - _date_to_age: function(d) { + _min_ts: null, + _max_ts: null, + _date_to_ts: function(d) { if (d == null) { return null; } @@ -168,17 +168,17 @@ const age_filter_settings = { return Math.floor(Date.UTC(d.getFullYear(), d.getMonth(), d.getDate())/86_400_000); }, setup_minmax: function() { - this._min_age = this._max_age = null; + this._min_ts = this._max_ts = null; switch (this.type) { case 'relative': { const date = this.get_relative_date(this.quantity, this.unit); - const prop = {'<=':'_min_age', '>=':'_max_age'}[this.operator]; - this[prop] = this._date_to_age(date); + const prop = {'<=':'_min_ts', '>=':'_max_ts'}[this.operator]; + this[prop] = this._date_to_ts(date); break; } case 'interval': { - this._min_age = this._date_to_age(this.from); - this._max_age = this._date_to_age(this.to); + this._min_ts = this._date_to_ts(this.from); + this._max_ts = this._date_to_ts(this.to); break; } } @@ -4547,13 +4547,13 @@ const [mapLayers, featureOverlayLayer] = (function() { if (age_filter_settings.active) { /* TODO avoid doing this checks for each feature; instead, set up a * different style function if age_filter_settings.active */ - const age = properties.age; - if (age == null) { + const ts = properties.ts; + if (ts == null) { if (!age_filter_settings.show_unknown) { return null; } - } else if ((age_filter_settings._min_age !== null && age < age_filter_settings._min_age) || - (age_filter_settings._max_age !== null && age > age_filter_settings._max_age)) { + } else if ((age_filter_settings._min_ts !== null && ts < age_filter_settings._min_ts) || + (age_filter_settings._max_ts !== null && ts > age_filter_settings._max_ts)) { return null; } } @@ -5396,7 +5396,7 @@ const infoMetadataAccordions = []; return x.radio.checked; })[0]; let param; - age_filter_settings._min_age = age_filter_settings._max_age = null; + age_filter_settings._min_ts = age_filter_settings._max_ts = null; switch (filter_type) { case 'relative': { const operator = age_filter_settings.operator = filter_settings.operator[0].value; -- cgit v1.2.3