Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(calendar): Fix calendar detail view and hide button from create view #2362

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions src/content/google-calendar.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @name Google Calendar
* @urlAlias calendar.google.com
* @urlRegex *://calendar.google.com/*
*/
'use strict';
/* global $, togglbutton */

Expand Down Expand Up @@ -38,23 +43,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
3 changes: 2 additions & 1 deletion src/origins.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,8 @@ export default {
},
'calendar.google.com': {
url: '*://calendar.google.com/*',
name: 'Google Calendar'
name: 'Google Calendar',
file: 'google-calendar.js'
},
'classroom.google.com': {
url: '*://classroom.google.com/*',
Expand Down