diff --git a/README.md b/README.md index 037cdebf..a1fe5c2f 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,36 @@ # SCRUM Helper -This chrome extension helps you to write scrums in google groups for FOSSASIA related projects. You need to add your github username, dates, and other options. It fetches your PRs, Issues, and the PRs you reviewed from Github API, and prefills the SCRUM. You can edit the scrum further to meet your needs. +**SCRUM Helper** is a Chrome extension designed to simplify writing scrums in Google Groups for FOSSASIA projects. By adding your GitHub username, date range, and other options, it automatically fetches your PRs, Issues, and reviewed PRs via the GitHub API and pre-fills the scrum. You can then edit the scrum to fit your needs. + ![SCRUMLOGO](docs/images/scrumhelper-png.png) +## Features + +- Fetches your GitHub PRs, Issues, and reviewed PRs +- Auto-generates scrum updates +- Supports Google Groups, Gmail, Yahoo, and Outlook compose windows + ## How to install 1. Clone this repository to your local machine. 2. Go to `chrome://extensions` on your chrome browser. -3. Turn on developer mode if not already on. -4. Load unpacked extension from `src` folder. -5. Click on the Scrum Helper icon you see on your browser toolbar. -6. Fill in the settings in the popup. -7. **For Google Groups:** - - Open https://groups.google.com/forum/#!newtopic/ and start a New Conversation. -8. Refresh the page to apply the new settings. -9. **For Gmail, Yahoo, and Outlook:** - - Open the Compose window. - - Follow Step 8 to ensure the settings take effect. +3. Enable Developer Mode (toggle in the top-right) if not already. +4. Click Load unpacked and select the `src` folder inside the cloned repo +5. Click the Scrum Helper icon on your browser toolbar +6. Fill in your settings in the popup (GitHub username, date range, etc.) + +## Usage +### For Google Groups: +- Open Google Groups New Topic +- Start a New Conversation +- Refresh the page to apply the Scrum Helper settings +- Use the pre-filled scrum and edit as needed + +### For Gmail, Yahoo, and Outlook: +- Open the Compose window. +- Ensure the Scrum Helper settings are applied (follow step 6 above) +- The extension will prefill scrum content for you to edit ## Setting up the code locally diff --git a/docs/images/popup.png b/docs/images/popup.png index 5e368eab..035f3015 100644 Binary files a/docs/images/popup.png and b/docs/images/popup.png differ diff --git a/docs/images/scrum.png b/docs/images/scrum.png index 1603bff2..0cd23dc8 100644 Binary files a/docs/images/scrum.png and b/docs/images/scrum.png differ diff --git a/src/index.css b/src/index.css index 2a5ca72c..ee83783b 100644 --- a/src/index.css +++ b/src/index.css @@ -50,3 +50,17 @@ li { list-style-type: disc !important; margin-left: 1rem; } +.selectedLabel { + font-weight: 400; + color: #333333; +} + +.unselectedLabel { + font-weight: 300; + color: #666666; +} + +.selectedLabel, .unselectedLabel { + transition: color 0.3s ease-in-out, font-weight 0.3s ease-in-out; +} + diff --git a/src/scripts/emailClientAdapter.js b/src/scripts/emailClientAdapter.js index e76fe4b1..2b24f715 100644 --- a/src/scripts/emailClientAdapter.js +++ b/src/scripts/emailClientAdapter.js @@ -34,8 +34,19 @@ class EmailClientAdapter { }, yahoo: { selectors: { - body: '#editor-container [contenteditable="true"][role="textbox"]', - subject: 'input[placeholder="Subject"][type="text"]', + body: [ + '[aria-multiline="true"][aria-label="Message body"][contenteditable="true"][role="textbox"]', + '[aria-label="Message body"][contenteditable="true"]', + '[role="textbox"][contenteditable="true"]', + '[data-test-id*="compose"][contenteditable="true"]', + '.compose-editor [contenteditable="true"]' + ].join(', '), + subject: [ + '#compose-subject-input', + 'input[placeholder="Subject"]', + 'input[aria-label*="subject" i]', + 'input[data-test-id*="subject" i]' + ].join(', ') }, eventTypes: { contentChange: 'input', diff --git a/src/scripts/main.js b/src/scripts/main.js index f1ff385d..590d5796 100644 --- a/src/scripts/main.js +++ b/src/scripts/main.js @@ -22,6 +22,7 @@ function handleBodyOnLoad() { 'userReason', 'lastWeekContribution', 'gsoc', + 'selectedTab', ], (items) => { if (items.githubUsername) { @@ -65,6 +66,15 @@ function handleBodyOnLoad() { } else { handleCodeheatClick(); } + if (items.selectedTab === 'gsoc') { + handleGsocClick(); + } + else { + handleCodeheatClick(); + } + + // initialize materialize tabs + $('.tabs').tabs('select_tab', items.selectedTab === 'gsoc' ? 'gsocBox' : 'codeheatBox' ); }, ); } @@ -82,19 +92,27 @@ function handleEndingDateChange() { } function handleLastWeekContributionChange() { var value = lastWeekContributionElement.checked; + var labelElement = document.querySelector("label[for='lastWeekContribution']"); + if (value) { - startingDateElement.disabled = true; - endingDateElement.disabled = true; - endingDateElement.value = getToday(); - startingDateElement.value = getLastWeek(); - handleEndingDateChange(); - handleStartingDateChange(); + startingDateElement.disabled = true; + endingDateElement.disabled = true; + endingDateElement.value = getToday(); + startingDateElement.value = getLastWeek(); + handleEndingDateChange(); + handleStartingDateChange(); + labelElement.classList.add("selectedLabel"); + labelElement.classList.remove("unselectedLabel"); } else { - startingDateElement.disabled = false; - endingDateElement.disabled = false; + startingDateElement.disabled = false; + endingDateElement.disabled = false; + labelElement.classList.add("unselectedLabel"); + labelElement.classList.remove("selectedLabel"); } + chrome.storage.local.set({ lastWeekContribution: value }); } + function getLastWeek() { var today = new Date(); var noDays_to_goback = gsoc == 0 ? 7 : 1; @@ -135,9 +153,19 @@ function handleProjectNameChange() { } function handleOpenLabelChange() { var value = showOpenLabelElement.checked; + var labelElement = document.querySelector("label[for='showOpenLabel']"); + + if (value) { + labelElement.classList.add("selectedLabel"); + labelElement.classList.remove("unselectedLabel"); + } else { + labelElement.classList.add("unselectedLabel"); + labelElement.classList.remove("selectedLabel"); + } + chrome.storage.local.set({ showOpenLabel: value }); - chrome.storage.local.set({ showClosedLabel: value }); } + function handleUserReasonChange() { var value = userReasonElement.value; chrome.storage.local.set({ userReason: value }); @@ -147,7 +175,7 @@ function handleCodeheatClick() { $('#codeheatTab').addClass('active'); $('.tabs').tabs(); $('#noDays').text('7 days'); - chrome.storage.local.set({ gsoc: 0 }); + chrome.storage.local.set({ gsoc: 0, selectedTab: 'codeheat' }); handleLastWeekContributionChange(); } function handleGsocClick() { @@ -155,7 +183,7 @@ function handleGsocClick() { $('#gsocTab').addClass('active'); $('.tabs').tabs(); $('#noDays').text('1 day'); - chrome.storage.local.set({ gsoc: 1 }); + chrome.storage.local.set({ gsoc: 1, selectedTab: 'gsoc' }); handleLastWeekContributionChange(); } enableToggleElement.addEventListener('change', handleEnableChange);