Skip to content
Advertisement

EventListener not firing – Dynamically create and download calendar event

I am getting the plain text of outlook calendar events and converting them to an ics for download with Tampermonkey.

The button worked when I wrote this a couple of years ago, but now it is not. I am not sure if I need to grant permissions now or if something else broke it. The button is added just fine, but I can’t get the event listener to fire.

JavaScript

Advertisement

Answer

  1. Used const (ES2015+) instead of var (<= ES5).
  2. Cloned the element in order to remove the div.clearfix in a more reliable way.
  3. Used template strings (`….`).
  4. Used native GM_download method for easier/reliable downloading.
JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement