2
0
Fork 0

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

@ -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>");
Object.keys(data[date]).forEach(function (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>");
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 "";});
if(event.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>");
var location = (event.location)?event.location.replace(/\n/g,"<br>").replace(uri_regex, "<a href='$1' target='_blank'>$1</a>"):'';
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 "";}):'';
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> | " + location + "<br/>" + description + categories + "</span></div>");
});
});
document.querySelector('#dbkcalendar').innerHTML = items.join( "" );