From dcf409ea25e3b9969788533b826e58e75c19619e Mon Sep 17 00:00:00 2001 From: Patrick Schwarz Date: Fri, 12 Jan 2024 12:14:11 +0100 Subject: [PATCH] simplified css and js --- css/style.css | 8 +++----- js/vanilla.dbkcalendar.js | 8 ++++---- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/css/style.css b/css/style.css index a9f2a48..0255598 100644 --- a/css/style.css +++ b/css/style.css @@ -109,12 +109,10 @@ dd { /* hackcal */ #dbkcalendar {border: 1px solid #CCC} #dbkcalendar div {display: flex; padding: 8px 14px} -#dbkcalendar div span:first-child {font-weight: bold} -#dbkcalendar [data-date] {background: #CCC} -#dbkcalendar [data-date] span:first-child {flex: 1} +#dbkcalendar [data-date] {background: #CCC; font-weight: bold} #dbkcalendar [data-uid] {font-size: .9em; gap: .5em; line-height: 1.5em} -#dbkcalendar [data-uid] span:first-child {flex: 0 0 3em} -#dbkcalendar div i {background: #FC0; border-radius: 0.25em; padding: 0 0.25em; font-style: normal; font-weight: bold; color:#000} +#dbkcalendar [data-uid] span:first-child {flex: 0 0 3em; font-weight: bold} +#dbkcalendar i {background: #FC0; border-radius: 0.25em; padding: 0 0.25em; font-style: normal; font-weight: bold; color:#000} /* spaceapi */ aside#spaceapi { diff --git a/js/vanilla.dbkcalendar.js b/js/vanilla.dbkcalendar.js index 4dc2470..463b980 100644 --- a/js/vanilla.dbkcalendar.js +++ b/js/vanilla.dbkcalendar.js @@ -14,10 +14,10 @@ function hackcal(p=1) { items.push("
" + day.toLocaleDateString(true, {weekday:'short', day:'numeric', month:'long', year: 'numeric'}) + "
"); Object.keys(data[date]).forEach(function (uid) { var event = data[date][uid]; - if(event.location) event.location = event.location.replace(/\n/g,"
").replace(uri_regex, "$1"); - if(event.description) event.description = event.description.replace(/\n/g,"
").replace(uri_regex, (url) => {event.summary = `${event.summary}`; return "";}); - if(event.categories) event.categories = "" + event.categories.replace(",", " ") + ""; - items.push("
" + event.datestr + "" + event.summary + " | " + ((event.location)?event.location:'') + "
" + ((event.description)?event.description:'') + ((event.categories)?event.categories:'') + "
"); + var location = (event.location)?event.location.replace(/\n/g,"
").replace(uri_regex, "$1"):''; + var description = (event.description)?event.description.replace(/\n/g,"
").replace(uri_regex, (url) => {event.summary = `${event.summary}`; return "";}):''; + var categories = (event.categories)?"" + event.categories.replace(",", " ") + "":''; + items.push("
" + event.datestr + "" + event.summary + " | " + location + "
" + description + categories + "
"); }); }); document.querySelector('#dbkcalendar').innerHTML = items.join( "" );