Skip to content

Commit

Permalink
fix(calendar): Fix calendar detail view and hide button from create view
Browse files Browse the repository at this point in the history
  • Loading branch information
with-shrey committed Dec 10, 2024
1 parent 699868a commit 495e4e1
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/content/google-calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down

0 comments on commit 495e4e1

Please # to comment.