FOSDEM2GCal - Tampermonkey/Greasemonkey script to save FOSDEM event in Google Calendar
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
| // ==UserScript== | |
| // @name FOSDEM2GCal | |
| // @namespace https://github.com/totomz | |
| // @version 0.1 | |
| // @description Add talks to your google calendar | |
| // @author Tommaso Doninelli | |
| // @match https://fosdem.org/2021/schedule/event/* | |
| // @grant GM_xmlhttpRequest | |
| // @require https://code.jquery.com/jquery-3.5.1.slim.min.js | |
| // ==/UserScript== | |
| /* | |
| README | |
| */ | |
| (function() { | |
| 'use strict'; | |
| const start = $('li:contains("Start") > a').attr('title').replaceAll("-","").replaceAll(":","").split("+")[0]; | |
| const end = $('li:contains("End") > a').attr('title').replaceAll("-","").replaceAll(":","").split("+")[0]; | |
| const video_qa = $('li:contains("Video with Q&A") > a').attr('href'); | |
| const video_only = $('li:contains("Video only") > a').attr('href'); | |
| const title = $('#pagetitles > h1').text(); | |
| const subtitle = $('#pagetitles > h2').text(); | |
| const abstract = $('.event-abstract').text(); | |
| const description = encodeURIComponent([`Video with Q&A: ${video_qa}`, `Video only: ${video_only}`, ' ', subtitle, ' ', `Event Link: ${window.location.href}`].join("\n")) | |
| const link = `https://www.google.com/calendar/render?action=TEMPLATE&text=[FOSDEM] ${title}&details=${description}&location=&dates=${start}/${end}&ctz=CET`; | |
| $('ul.side-box').prepend(`<li><i class="icon-calendar"></i> <strong>Google Calendar</strong>: <a target="_blank" href="${link}">Save</a></li>`) | |
| })(); | |