From 93bfc062f1ebbf58f24ddf73388b2b499516bc30 Mon Sep 17 00:00:00 2001 From: Miguel Avila Date: Sat, 14 Aug 2021 11:47:18 -0500 Subject: [PATCH] :art: Comments and titles --- assets/js/cards.js | 5 ++++- assets/js/lists.js | 16 +++++++++------- assets/js/time.js | 9 +++++---- assets/js/weather.js | 10 +++++++--- config.js | 1 + 5 files changed, 26 insertions(+), 15 deletions(-) diff --git a/assets/js/cards.js b/assets/js/cards.js index 863b224..7eaee81 100644 --- a/assets/js/cards.js +++ b/assets/js/cards.js @@ -1,4 +1,7 @@ -console.log("Connected cards"); +// ┌─┐┌─┐┬─┐┌┬┐┌─┐ +// │ ├─┤├┬┘ ││└─┐ +// └─┘┴ ┴┴└──┴┘└─┘ + const printCards = () => { for (const card of CONFIG.cards) { diff --git a/assets/js/lists.js b/assets/js/lists.js index 4c99f58..ca21111 100644 --- a/assets/js/lists.js +++ b/assets/js/lists.js @@ -1,37 +1,39 @@ -console.log("Connected lists"); +// ┬ ┬┌─┐┌┬┐┌─┐ +// │ │└─┐ │ └─┐ +// ┴─┘┴└─┘ ┴ └─┘ const printFirstList = () => { let icon = ``; - const position = "beforeend"; + const position = 'beforeend'; list_1.insertAdjacentHTML(position, icon); for (const link of CONFIG.lists.firstList) { let item = ` ${link.name} `; - const position = "beforeend"; + const position = 'beforeend'; list_1.insertAdjacentHTML(position, item); } }; const printSecondList = () => { let icon = ``; - const position = "beforeend"; + const position = 'beforeend'; list_2.insertAdjacentHTML(position, icon); for (const link of CONFIG.lists.secondList) { let item = ` ${link.name} `; - const position = "beforeend"; + const position = 'beforeend'; list_2.insertAdjacentHTML(position, item); } }; diff --git a/assets/js/time.js b/assets/js/time.js index f213600..7df9a12 100644 --- a/assets/js/time.js +++ b/assets/js/time.js @@ -1,3 +1,7 @@ +// ┌┬┐┬┌┬┐┌─┐ +// │ ││││├┤ +// ┴ ┴┴ ┴└─┘ + window.onload = displayClock(); function displayClock() { const monthNames = [ @@ -15,9 +19,6 @@ function displayClock() { 'Dec', ]; - // Set to true to use a 12 hour date format - var format_12hour = false; - var d = new Date(); var mm = monthNames[d.getMonth()]; var dd = d.getDate(); @@ -25,7 +26,7 @@ function displayClock() { var hh = d.getHours(); var ampm = ''; - if (format_12hour) { + if (CONFIG.twelveHourFormat) { ampm = hh >= 12 ? ' pm' : ' am'; hh = hh % 12; hh = hh ? hh : 12; //show mod 0 as 12 diff --git a/assets/js/weather.js b/assets/js/weather.js index 38d09ee..8aba353 100644 --- a/assets/js/weather.js +++ b/assets/js/weather.js @@ -1,6 +1,12 @@ +// ┬ ┬┌─┐┌─┐┌┬┐┬ ┬┌─┐┬─┐ +// │││├┤ ├─┤ │ ├─┤├┤ ├┬┘ +// └┴┘└─┘┴ ┴ ┴ ┴ ┴└─┘┴└─ + const iconElement = document.querySelector('.weather-icon'); const tempElement = document.querySelector('.temperature-value p'); -const descElement = document.querySelector('.temperature-description p'); +const descElement = document.querySelector( + '.temperature-description p' +); // App data const weather = {}; @@ -8,7 +14,6 @@ weather.temperature = { unit: 'celsius', }; -// Change to 'F' for Fahrenheit var tempUnit = CONFIG.weatherUnit; const KELVIN = 273.15; @@ -19,7 +24,6 @@ const key = `${CONFIG.weatherKey}`; setPosition(); function setPosition(position) { - getWeather(CONFIG.weatherLatitude, CONFIG.weatherLongitude); } diff --git a/config.js b/config.js index 561fa4a..acf0cee 100644 --- a/config.js +++ b/config.js @@ -14,6 +14,7 @@ const CONFIG = { name: 'John', imageBackground: false, openInNewTab: true, + twelveHourFormat: false, // Greetings greetingMorning: 'Good morning!',