Last active
October 22, 2017 10:21
-
-
Save phiresky/11082650 to your computer and use it in GitHub Desktop.
export ICS file from KIT Webinscribe. paste into web console
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var a="BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:-//phiresky.de//tools\n",b=$("table.piTable>tbody").children; | |
for(i=0;i<b.length;i++)var c=b[i].children,d=c[0].textContent.trim(),e=c[1].textContent,f=/Tutorium (..) ([-0-9:]+) (.*)/.exec(c[2].textContent.trim()),g=f[1],h=f[2],k=f[3],g=["Mo","Di","Mi","Do","Fr"].indexOf(g),h=/(..):(..)-(..):(..)/.exec(h),l="201410"+(27+g)+"T"+h[1]+h[2]+"00",m="201410"+(27+g)+"T"+h[3]+h[4]+"00",a=a+("BEGIN:VEVENT\nLOCATION:"+k+"\nSUMMARY:Tutorium für "+d.replace(/,/g,"\\,")+"\nDESCRIPTION:"+e+"\nDTSTART:"+l+"\nDTEND:"+m+"\nRRULE:FREQ=WEEKLY;COUNT=16\nEND:VEVENT\n"); | |
var a=a+"END:VCALENDAR\n",n=document.body.appendChild(document.createElement("a"));n.href=URL.createObjectURL(new Blob([a],{type:"text/calendar"}));n.download="Tutorien WS2014 "+$("h3").textContent.match(/.{6}(.*)/)[1]+".ics";n.click(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var out = "BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:-//phiresky.de//tools\n", | |
t = $("table.piTable>tbody").children, | |
month = "201410", | |
startday = 27 | |
for (i = 0; i < t.length; i++) { | |
var e = t[i].children, | |
name = e[0].textContent.trim(), | |
tutor = e[1].textContent, | |
regex = /Tutorium (..) ([-0-9:]+) (.*)/.exec(e[2].textContent.trim()), | |
wd = regex[1], | |
zeit = regex[2], | |
raum = regex[3], | |
wd = ["Mo", "Di", "Mi", "Do", "Fr"].indexOf(wd), | |
zeit = /(..):(..)-(..):(..)/.exec(zeit), | |
start = month + (startday + wd) + "T" + zeit[1] + zeit[2] + "00", | |
end = month + (startday + wd) + "T" + zeit[3] + zeit[4] + "00"; | |
out += "BEGIN:VEVENT"+ | |
"\nLOCATION:" + raum + | |
"\nSUMMARY:Tutorium für " + name.replace(/,/g, "\\,") + | |
"\nDESCRIPTION:" + tutor + | |
"\nDTSTART:" + start + | |
"\nDTEND:" + end + | |
"\nRRULE:FREQ=WEEKLY;COUNT=16\nEND:VEVENT\n"; | |
}; | |
out += "END:VCALENDAR\n"; | |
var a = document.body.appendChild(document.createElement("a")); | |
a.href = URL.createObjectURL(new Blob([out], {type: "text/calendar"})); | |
a.download = "Tutorien WS2014 " + $("h3").textContent.match(/.{6}(.*)/)[1] + ".ics"; | |
a.click(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment