Add support for Christmas Eve and New Years Eve on slideshow.html
Signed-off-by: James Ketrenos <james_gitlab@ketrenos.com>
This commit is contained in:
parent
404d934c55
commit
d82ca4982a
@ -214,7 +214,7 @@ document.addEventListener("DOMContentLoaded", function() {
|
|||||||
photoIndex = -1;
|
photoIndex = -1;
|
||||||
nextPhoto();
|
nextPhoto();
|
||||||
} else {
|
} else {
|
||||||
info.textContent = "No photos found for " + holiday + ".";
|
info.textContent = "No photos found for " + data.holiday + ".";
|
||||||
}
|
}
|
||||||
}).catch(function(error) {
|
}).catch(function(error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
@ -551,7 +551,7 @@ router.get("/holiday/:holiday", function(req, res/*, next*/) {
|
|||||||
return res.status(404).send(req.params.holiday + " holiday not found.");
|
return res.status(404).send(req.params.holiday + " holiday not found.");
|
||||||
}
|
}
|
||||||
holidayName = Object.getOwnPropertyNames(lookup)[0];
|
holidayName = Object.getOwnPropertyNames(lookup)[0];
|
||||||
|
console.log("Searching for holiday: " + holidayName);
|
||||||
/* Lookup the date for the holiday on every year from 'startYear' (1990) to today */
|
/* Lookup the date for the holiday on every year from 'startYear' (1990) to today */
|
||||||
for (let year = startYear; year <= moment().year(); year++) {
|
for (let year = startYear; year <= moment().year(); year++) {
|
||||||
console.log("Getting year: " + year);
|
console.log("Getting year: " + year);
|
||||||
@ -564,12 +564,22 @@ router.get("/holiday/:holiday", function(req, res/*, next*/) {
|
|||||||
/*
|
/*
|
||||||
* NOTE: Memorial Day and Labor Day are two special cases -- the holiday is a Monday,
|
* NOTE: Memorial Day and Labor Day are two special cases -- the holiday is a Monday,
|
||||||
* however the entire weekend typically is holidy-esque. Account for that below.
|
* however the entire weekend typically is holidy-esque. Account for that below.
|
||||||
* We (should) could expand this to account for Fri or Mon on the 4th of July, Christmas,
|
*
|
||||||
* or New Years as well. */
|
* For those that have 'eve' celebrations, include those too.
|
||||||
|
*
|
||||||
|
* We (should) could expand this to account for Fri or Mon on the 4th of July or the
|
||||||
|
* entire weekend if it occurs on a Thu or Tues */
|
||||||
|
|
||||||
let extraDays = 0;
|
let extraDays = 0;
|
||||||
if (req.params.holiday.toLowerCase() == 'memorial day') {
|
switch (req.params.holiday.toLowerCase()) {
|
||||||
|
case 'labor day':
|
||||||
|
case 'memorial day':
|
||||||
extraDays = -2; /* Include two days prior */
|
extraDays = -2; /* Include two days prior */
|
||||||
|
break;
|
||||||
|
case 'christmas day':
|
||||||
|
case 'new year\'s day':
|
||||||
|
extraDays = -1; /* Include 'Eve' */
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
let direction = extraDays < 0 ? -1 : 1;
|
let direction = extraDays < 0 ? -1 : 1;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user