-
Notifications
You must be signed in to change notification settings - Fork 0
/
gmail2cal_cz.bookmarklet
1 lines (1 loc) · 2.84 KB
/
gmail2cal_cz.bookmarklet
1
javascript:void%20function(){url=window.location,window.getSelection%3Fselection=window.getSelection():document.getSelection%3Fselection=document.getSelection():document.selection%26%26(selection=document.selection.createRange().text),selection+=%22%22,str=selection,str=str.replace(/([0-9]{1,2})%20%3Fh/g,%22$1:00%22),str=str.replace(/([0-9]{1,2})\.%20%3F([0-9]{1,2})/g,%22$1.$2.%22),str=str.replace(/([0-9]{1,2})\.%20%3Fled[^%20]*/g,%22$1.01.%22),str=str.replace(/([0-9]{1,2})\.%20%3Fúno/g,%22$1.02.%22),str=str.replace(/([0-9]{1,2})\.%20%3Fbře/g,%22$1.03.%22),str=str.replace(/([0-9]{1,2})\.%20%3Fdub/g,%22$1.04.%22),str=str.replace(/([0-9]{1,2})\.%20%3Fkvě/g,%22$1.05.%22),str=str.replace(/([0-9]{1,2})\.%20%3Fčerven[^%20]*/g,%22$1.07.%22),str=str.replace(/([0-9]{1,2})\.%20%3Fčer/g,%22$1.06.%22),str=str.replace(/([0-9]{1,2})\.%20%3Fsrp/g,%22$1.08.%22),str=str.replace(/([0-9]{1,2})\.%20%3Fzář/g,%22$1.09.%22),str=str.replace(/([0-9]{1,2})\.%20%3Fříj/g,%22$1.10.%22),str=str.replace(/([0-9]{1,2})\.%20%3Flis/g,%22$1.11.%22),str=str.replace(/([0-9]{1,2})\.%20%3Fpro/g,%22$1.12.%22),date=str.match(/([0-9]{1,2})\.([0-9]{1,2})\./g),time=str.match(/[0-9]{1,2}:[0-9]{2}/g),map=str.match(/http:\/\/[^%20]+/g),null==map%26%26(map=%22%22),today=new%20Date,time_from=(%220%22+today.getHours()).slice(-2)+(%220%22+today.getMinutes()).slice(-2),date_from=(%220%22+(today.getMonth()+1)).slice(-2)+(%220%22+today.getDate()).slice(-2),time_to=time_from,date_to=date_from,year=today.getFullYear(),null!=time%26%26(time.length%3E=2%3F(tmp=time[0].split(%22:%22),1==tmp[0].length%26%26(tmp[0]=%220%22+tmp[0]),1==tmp[0].length%26%26(tmp[1]=%220%22+tmp[1]),time_from=tmp[0]+tmp[1],tmp=time[1].split(%22:%22),1==tmp[0].length%26%26(tmp[0]=%220%22+tmp[0]),1==tmp[1].length%26%26(tmp[1]=%220%22+tmp[1]),time_to=tmp[0]+tmp[1]):(tmp=time[0].split(%22:%22),1==tmp[0].length%26%26(tmp[0]=%220%22+tmp[0]),1==tmp[1].length%26%26(tmp[1]=%220%22+tmp[1]),time_from=tmp[0]+tmp[1],time_to=time_from)),null!=date%26%26(date.length%3E=2%3F(tmp=date[0].split(%22.%22),1==tmp[0].length%26%26(tmp[0]=%220%22+tmp[0]),1==tmp[1].length%26%26(tmp[1]=%220%22+tmp[1]),date_from=tmp[1]+tmp[0],tmp=date[1].split(%22.%22),1==tmp[0].length%26%26(tmp[0]=%220%22+tmp[0]),1==tmp[1].length%26%26(tmp[1]=%220%22+tmp[1]),date_to=tmp[1]+tmp[0]):(tmp=date[0].split(%22.%22),1==tmp[0].length%26%26(tmp[0]=%220%22+tmp[0]),1==tmp[1].length%26%26(tmp[1]=%220%22+tmp[1]),date_from=tmp[1]+tmp[0],date_to=date_from)),selection.length%3E25%3Ftext=selection.substring(0,24):text=selection,from=year+date_from+%22T%22+time_from+%2200%22,to=year+date_to+%22T%22+time_to+%2200%22,calendar=%22%22,urlopen=%22https://www.google.com/calendar/render%3Faction=TEMPLATE%26dates=%22+from+%22/%22+to+%22%26text=%22+text+%22%26location=%22+map+%22%26details=%22+encodeURIComponent(selection+%22\n\nmail%20link\n%22+url)+%22%26src=%22+calendar,void%20window.open(urlopen)}();