simplified css and js

This commit is contained in:
Patrick Schwarz 2024-01-12 12:14:11 +01:00
parent 29f9d7c880
commit dcf409ea25
2 changed files with 7 additions and 9 deletions

View file

@ -109,12 +109,10 @@ dd {
/* hackcal */ /* hackcal */
#dbkcalendar {border: 1px solid #CCC} #dbkcalendar {border: 1px solid #CCC}
#dbkcalendar div {display: flex; padding: 8px 14px} #dbkcalendar div {display: flex; padding: 8px 14px}
#dbkcalendar div span:first-child {font-weight: bold} #dbkcalendar [data-date] {background: #CCC; font-weight: bold}
#dbkcalendar [data-date] {background: #CCC}
#dbkcalendar [data-date] span:first-child {flex: 1}
#dbkcalendar [data-uid] {font-size: .9em; gap: .5em; line-height: 1.5em} #dbkcalendar [data-uid] {font-size: .9em; gap: .5em; line-height: 1.5em}
#dbkcalendar [data-uid] span:first-child {flex: 0 0 3em} #dbkcalendar [data-uid] span:first-child {flex: 0 0 3em; font-weight: bold}
#dbkcalendar div i {background: #FC0; border-radius: 0.25em; padding: 0 0.25em; font-style: normal; font-weight: bold; color:#000} #dbkcalendar i {background: #FC0; border-radius: 0.25em; padding: 0 0.25em; font-style: normal; font-weight: bold; color:#000}
/* spaceapi */ /* spaceapi */
aside#spaceapi { aside#spaceapi {

View file

@ -14,10 +14,10 @@ function hackcal(p=1) {
items.push("<div data-date='" + date + "'><span>" + day.toLocaleDateString(true, {weekday:'short', day:'numeric', month:'long', year: 'numeric'}) + "</span></div>"); items.push("<div data-date='" + date + "'><span>" + day.toLocaleDateString(true, {weekday:'short', day:'numeric', month:'long', year: 'numeric'}) + "</span></div>");
Object.keys(data[date]).forEach(function (uid) { Object.keys(data[date]).forEach(function (uid) {
var event = data[date][uid]; var event = data[date][uid];
if(event.location) event.location = event.location.replace(/\n/g,"<br>").replace(uri_regex, "<a href='$1' target='_blank'>$1</a>"); var location = (event.location)?event.location.replace(/\n/g,"<br>").replace(uri_regex, "<a href='$1' target='_blank'>$1</a>"):'';
if(event.description) event.description = event.description.replace(/\n/g,"<br>").replace(uri_regex, (url) => {event.summary = `<a href='${url}' target='_blank'>${event.summary}</a>`; return "";}); var description = (event.description)?event.description.replace(/\n/g,"<br>").replace(uri_regex, (url) => {event.summary = `<a href='${url}' target='_blank'>${event.summary}</a>`; return "";}):'';
if(event.categories) event.categories = "<i>" + event.categories.replace(",", "</i> <i>") + "</i>"; var categories = (event.categories)?"<i>" + event.categories.replace(",", "</i> <i>") + "</i>":'';
items.push("<div data-uid='" + uid + "'><span>" + event.datestr + "</span><span><b>" + event.summary + "</b> | " + ((event.location)?event.location:'') + "<br/>" + ((event.description)?event.description:'') + ((event.categories)?event.categories:'') + "</span></div>"); items.push("<div data-uid='" + uid + "'><span>" + event.datestr + "</span><span><b>" + event.summary + "</b> | " + location + "<br/>" + description + categories + "</span></div>");
}); });
}); });
document.querySelector('#dbkcalendar').innerHTML = items.join( "" ); document.querySelector('#dbkcalendar').innerHTML = items.join( "" );