🎨 Comments and titles

This commit is contained in:
Miguel Avila 2021-08-14 11:47:18 -05:00
parent 764b93951b
commit 93bfc062f1
5 changed files with 26 additions and 15 deletions

View File

@ -1,4 +1,7 @@
console.log("Connected cards"); // ┌─┐┌─┐┬─┐┌┬┐┌─┐
// │ ├─┤├┬┘ ││└─┐
// └─┘┴ ┴┴└──┴┘└─┘
const printCards = () => { const printCards = () => {
for (const card of CONFIG.cards) { for (const card of CONFIG.cards) {

View File

@ -1,37 +1,39 @@
console.log("Connected lists"); // ┬ ┬┌─┐┌┬┐┌─┐
// │ │└─┐ │ └─┐
// ┴─┘┴└─┘ ┴ └─┘
const printFirstList = () => { const printFirstList = () => {
let icon = `<i class="list__head" data-feather="${CONFIG.firstListIcon}"></i>`; let icon = `<i class="list__head" data-feather="${CONFIG.firstListIcon}"></i>`;
const position = "beforeend"; const position = 'beforeend';
list_1.insertAdjacentHTML(position, icon); list_1.insertAdjacentHTML(position, icon);
for (const link of CONFIG.lists.firstList) { for (const link of CONFIG.lists.firstList) {
let item = ` let item = `
<a <a
target="${CONFIG.openInNewTab ? "_blank" : ""}" target="${CONFIG.openInNewTab ? '_blank' : ''}"
href="${link.link}" href="${link.link}"
class="list__link" class="list__link"
>${link.name}</a >${link.name}</a
> >
`; `;
const position = "beforeend"; const position = 'beforeend';
list_1.insertAdjacentHTML(position, item); list_1.insertAdjacentHTML(position, item);
} }
}; };
const printSecondList = () => { const printSecondList = () => {
let icon = `<i class="list__head" data-feather="${CONFIG.secondListIcon}"></i>`; let icon = `<i class="list__head" data-feather="${CONFIG.secondListIcon}"></i>`;
const position = "beforeend"; const position = 'beforeend';
list_2.insertAdjacentHTML(position, icon); list_2.insertAdjacentHTML(position, icon);
for (const link of CONFIG.lists.secondList) { for (const link of CONFIG.lists.secondList) {
let item = ` let item = `
<a <a
target="${CONFIG.openInNewTab ? "_blank" : ""}" target="${CONFIG.openInNewTab ? '_blank' : ''}"
href="${link.link}" href="${link.link}"
class="list__link" class="list__link"
>${link.name}</a >${link.name}</a
> >
`; `;
const position = "beforeend"; const position = 'beforeend';
list_2.insertAdjacentHTML(position, item); list_2.insertAdjacentHTML(position, item);
} }
}; };

View File

@ -1,3 +1,7 @@
// ┌┬┐┬┌┬┐┌─┐
// │ ││││├┤
// ┴ ┴┴ ┴└─┘
window.onload = displayClock(); window.onload = displayClock();
function displayClock() { function displayClock() {
const monthNames = [ const monthNames = [
@ -15,9 +19,6 @@ function displayClock() {
'Dec', 'Dec',
]; ];
// Set to true to use a 12 hour date format
var format_12hour = false;
var d = new Date(); var d = new Date();
var mm = monthNames[d.getMonth()]; var mm = monthNames[d.getMonth()];
var dd = d.getDate(); var dd = d.getDate();
@ -25,7 +26,7 @@ function displayClock() {
var hh = d.getHours(); var hh = d.getHours();
var ampm = ''; var ampm = '';
if (format_12hour) { if (CONFIG.twelveHourFormat) {
ampm = hh >= 12 ? ' pm' : ' am'; ampm = hh >= 12 ? ' pm' : ' am';
hh = hh % 12; hh = hh % 12;
hh = hh ? hh : 12; //show mod 0 as 12 hh = hh ? hh : 12; //show mod 0 as 12

View File

@ -1,6 +1,12 @@
// ┬ ┬┌─┐┌─┐┌┬┐┬ ┬┌─┐┬─┐
// │││├┤ ├─┤ │ ├─┤├┤ ├┬┘
// └┴┘└─┘┴ ┴ ┴ ┴ ┴└─┘┴└─
const iconElement = document.querySelector('.weather-icon'); const iconElement = document.querySelector('.weather-icon');
const tempElement = document.querySelector('.temperature-value p'); const tempElement = document.querySelector('.temperature-value p');
const descElement = document.querySelector('.temperature-description p'); const descElement = document.querySelector(
'.temperature-description p'
);
// App data // App data
const weather = {}; const weather = {};
@ -8,7 +14,6 @@ weather.temperature = {
unit: 'celsius', unit: 'celsius',
}; };
// Change to 'F' for Fahrenheit
var tempUnit = CONFIG.weatherUnit; var tempUnit = CONFIG.weatherUnit;
const KELVIN = 273.15; const KELVIN = 273.15;
@ -19,7 +24,6 @@ const key = `${CONFIG.weatherKey}`;
setPosition(); setPosition();
function setPosition(position) { function setPosition(position) {
getWeather(CONFIG.weatherLatitude, CONFIG.weatherLongitude); getWeather(CONFIG.weatherLatitude, CONFIG.weatherLongitude);
} }

View File

@ -14,6 +14,7 @@ const CONFIG = {
name: 'John', name: 'John',
imageBackground: false, imageBackground: false,
openInNewTab: true, openInNewTab: true,
twelveHourFormat: false,
// Greetings // Greetings
greetingMorning: 'Good morning!', greetingMorning: 'Good morning!',