Compare commits

..

No commits in common. "934e2956778553ebbf40699619b1cd47a4703063" and "c47cc073c9e9a106d2a3cd07af5a2efcfa758c25" have entirely different histories.

1 changed files with 5 additions and 18 deletions

View File

@ -1,6 +1,6 @@
const calRefresh=function () { document.addEventListener("DOMContentLoaded", function () {
let url = let url =
"https://ical2json.c3re.de/api/?url=https%3A%2F%2Fcloud.c3re.de%2Fremote.php%2Fdav%2Fpublic-calendars%2FRLKKkdjNYgXH8yEz%3Fexport&start=today&end=next+month&maxitems=10"; "https://ical2json.c3re.de/api/?url=https%3A%2F%2Fcloud.c3re.de%2Fremote.php%2Fdav%2Fpublic-calendars%2FRLKKkdjNYgXH8yEz%3Fexport&start=today&end=next+month&maxitems=10";
let xmlHttp = new XMLHttpRequest(); let xmlHttp = new XMLHttpRequest();
let zeropad = function (i) { let zeropad = function (i) {
let o = ""; let o = "";
@ -13,20 +13,15 @@ const calRefresh=function () {
let cal = JSON.parse(xmlHttp.responseText); let cal = JSON.parse(xmlHttp.responseText);
let $ = jQuery; let $ = jQuery;
let box = $("#calendar"); let box = $("#calendar");
box.removeClass("loading"); box.removeClass("loading");
try{
for( el of document.querySelectorAll("#calendar li")){
el.remove()
}
}catch(e){}
for (let item of cal) { for (let item of cal) {
let li = $("<li/>"); let li = $("<li/>");
//li.text(item.summary) //li.text(item.summary)
let startDate = new Date(item.start * 1000); let startDate = new Date(item.start * 1000);
let date = $("<span class='date row'/>"); let date = $("<span class='date row'/>");
date.text( date.text(
zeropad(startDate.getDate()) + zeropad(startDate.getDate()) +
"." + "." +
zeropad(1 + startDate.getMonth()) + zeropad(1 + startDate.getMonth()) +
"." + "." +
@ -59,10 +54,7 @@ const calRefresh=function () {
li.attr("title", item.description); li.attr("title", item.description);
li.appendTo(box); li.appendTo(box);
} }
try{
document.querySelector("#calendar .loading").remove(); document.querySelector("#calendar .loading").remove();
}catch(e){}
$(".location", box).click(function () { $(".location", box).click(function () {
navigator.clipboard.writeText($(this).attr("data-loc")); navigator.clipboard.writeText($(this).attr("data-loc"));
}); });
@ -70,9 +62,4 @@ const calRefresh=function () {
}; };
xmlHttp.open("GET", url, true); // true for asynchronous xmlHttp.open("GET", url, true); // true for asynchronous
xmlHttp.send(); xmlHttp.send();
}
document.addEventListener("DOMContentLoaded", function(){
calRefresh();
setInterval(calRefresh, 1000*60*15);
}); });