From 9a66a9c101f81a83b87efa84c04b0566a5c3c683 Mon Sep 17 00:00:00 2001 From: Neil Brommer Date: Sat, 6 Jan 2018 14:46:39 -0800 Subject: [PATCH] Add a function for easily testing the background timing --- js/main.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/js/main.js b/js/main.js index bd02093..1967854 100644 --- a/js/main.js +++ b/js/main.js @@ -45,3 +45,12 @@ function setBackground(num) { $(".navbar-toggler").removeClass("toggler-bg-light btn-light").addClass("toggler-bg-dark btn-dark"); } } + +function setBackgroundByTime(hours, mins) { + var total = (hours * 60) + mins; + + var period = (24 / backgroundList.length) * 60; // in minutes + + var index = Math.floor(total / period); + setBackground(index); +}