From 495e4e135174f0f94f87ca6f9e7ffe35668972c7 Mon Sep 17 00:00:00 2001 From: Shrey Gupta Date: Tue, 10 Dec 2024 16:39:48 +0530 Subject: [PATCH] fix(calendar): Fix calendar detail view and hide button from create view --- src/content/google-calendar.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/content/google-calendar.js b/src/content/google-calendar.js index c959c1d19..79fe619cf 100644 --- a/src/content/google-calendar.js +++ b/src/content/google-calendar.js @@ -38,23 +38,31 @@ togglbutton.render(rootLevelSelectors, { observe: true }, elem => { return; } - const closeButton = $('[aria-label]:first-child', elem); + const closeButton = $('[aria-label="Close"]:first-child', elem); getDescription = () => { const titleSpan = $('span[role="heading"]', elem); return titleSpan ? titleSpan.textContent.trim() : ''; }; target = closeButton.parentElement.parentElement.nextSibling; // Left of the left-most action + if(target.hasAttribute('data-dragsource-type')) { + // This happens for event creation + target = null + } } else if (elemIsDetail) { - const closeButton = $('div[aria-label]', elem); + const closeButton = $('[aria-label^="Cancel event"]', elem); getDescription = () => { const titleInput = $('input[data-initial-value]', elem); return titleInput ? titleInput.value.trim() : ''; }; target = - closeButton.parentElement.nextElementSibling.lastElementChild - .lastElementChild; // Date(s)/All day section + closeButton + .parentElement + .parentElement + .parentElement + .parentElement + .nextElementSibling.lastElementChild.lastElementChild; // Date(s)/All day section } if (!target || target.tagName.toLowerCase() !== 'div') {