0

I am making a Chrome extension that changes the display of the schedule view in google calendar. I am now happy with the way it displays the events but what I have not addressed yet is the mechanism for entering new events and or editing existing ones. I could potentially do that entirely myself but I suspect it may be possible for me to simply bring up google's existing event creating/editing dialogs. Unfortunately my lack of experience as a web developer means I don't really know where to begin with this task. I guess step one is to somehow find out what JavaScript functions are being called when you make a click that brings up one of the dialogs in the first place and then write some code to make this call directly myself. Am I on the right track? Are there any articles on how to do such things? Is this approach even possible?

Mick
  • 8,284
  • 22
  • 81
  • 173
  • 1
    A good first thing to check is if calling `.click()` on the DOM element that represents one of those buttons, triggers the function, something like `document.querySelector('[selector of add event button]').click()`. – Titus Mar 21 '23 at 09:16
  • Yes I just tried that with one of the (many) classes involved and an event editing dialog popped up... so that feels like a good start... now I need to figure out how to identify exactly which event is being edited. One extra issue I have is that I am displaying more events (i.e. further into the future) than google normally displays, so I can't rely entirely on the existing elements. – Mick Mar 21 '23 at 09:26
  • 1
    You can check if the editing dialog is already in the DOM and it is hidden. If that is the case, you can just show it when one of the custom events is accessed. – Titus Mar 21 '23 at 10:27
  • I just did a few checks and as far as I can tell, the dialog is not already in the DOM :-( – Mick Mar 21 '23 at 10:34
  • 1
    That is unfortunate. A more complicated way to go will be to check the click event listeners of a google calendar created event to figure out what function generates the dialog. You can find a couple of ways of doing that [here](https://stackoverflow.com/questions/10213703/how-do-i-view-events-fired-on-an-element-in-chrome-devtools). But, I'm pretty sure that will be an inner function that you can't easily access. – Titus Mar 21 '23 at 10:44

0 Answers0