trying to fix the date slider save thing arggg

This commit is contained in:
mattiapezzotti
2024-07-06 14:47:05 +02:00
parent 86023c0bea
commit fee3d4a3f7
2 changed files with 10 additions and 10 deletions

View File

@@ -90,7 +90,7 @@ export function rendererPhotos(context) {
}
};
photos.setFromDateFilter = function(date){
photos.setFromDateFilter = function(date, updateUrl){
if (date !== -1){
var fromDate = new Date();
fromDate.setDate(fromDate.getDate() - date);
@@ -99,21 +99,20 @@ export function rendererPhotos(context) {
var yyyy = fromDate.getFullYear();
fromDate = mm + '/' + dd + '/' + yyyy;
photos.setDateFilter('fromDate', fromDate);
photos.setDateFilter('fromDate', fromDate, updateUrl);
_maxPhotoDate = date;
} else {
photos.setDateFilter('fromDate', null);
photos.setDateFilter('fromDate', null, updateUrl);
}
};
photos.setFromYearFilter = function(year){
if (year !== null){
var fromDate = new Date();
fromDate = '01/01/' + year;
photos.setDateFilter('fromDate', fromDate);
photos.setFromYearFilter = function(year, updateUrl){
if (year){
var fromDate = new Date(year, 0, 1);
photos.setDateFilter('fromDate', fromDate, updateUrl);
_maxPhotoYear = year;
} else {
photos.setDateFilter('fromDate', null);
photos.setDateFilter('fromDate', null, updateUrl);
}
};
@@ -221,6 +220,7 @@ export function rendererPhotos(context) {
var parts = /^(.*)[_](.*)$/g.exec(hash.photo_dates.trim());
this.setDateFilter('fromDate', parts && parts.length >= 2 && parts[1], false);
this.setDateFilter('toDate', parts && parts.length >= 3 && parts[2], false);
this.setFromYearFilter(parts && parts.length >= 2 && parts[1], false);
}
if (hash.photo_username) {
this.setUsernameFilter(hash.photo_username, false);

View File

@@ -402,7 +402,7 @@ export function uiSectionPhotoOverlays(context) {
let value = parseInt(d3_select(this).property('value'), 10);
let minYear = parseInt(d3_select(this).property('min'), 10);
value = minYear + (currYear - value);
context.photos().setFromYearFilter(value);
context.photos().setFromYearFilter(value, true);
output.html(value + ' - ' + currYear);
});