Created
August 17, 2015 22:32
-
-
Save listenrightmeow/35062a334f3555692ebb to your computer and use it in GitHub Desktop.
Dynamic ICS
This file contains hidden or 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
$(target, this.$el).on('click', function() { | |
var now = new Date(), | |
dtstamp = now.toISOString(), | |
dtend = function() { now.setHours(19,0,0,0); return now; }, | |
dtstart = function() { now.setHours(18,0,0,0); return now; }, | |
meow = 'location', | |
summary = 'summary', | |
icsMSG = 'BEGIN:VCALENDAR\nVERSION:2.0\n' + | |
'PRODID:-//Take Back The Table//NONSGML v1.0//EN\n' + | |
'CALSCALE:GREGORIAN\n' + | |
'BEGIN:VEVENT\n' + | |
'UID:[email protected]\n' + | |
'DTSTAMP:' + dtstamp + '\n' + | |
'ATTENDEE;CN=me;\n' + | |
'ORGANIZER;CN=Me\n' + | |
'DTSTART:' + dtstart +'\n' + | |
'DTEND:' + dtend +'\n' + | |
'LOCATION:' + meow + '\n' + | |
'SUMMARY:' + summary + '\n' + | |
'END:VEVENT\n' + | |
'END:VCALENDAR'; | |
window.open('data:text/calendar;charset=utf8,' + escape(icsMSG)); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment