Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
BFergerson committed Nov 15, 2024
1 parent ce4c91f commit cb04c75
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/gmail/context/list_emails/list_emails.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
let emails = [];
for (const tbody of getTbodyWithMultipleRows()) {
for (const tbody of getEmailTables()) {
emails.push(...Array.from(tbody.querySelectorAll('tr')).filter(row => row.id).map(row => {
const email = {};
email["id"] = row.id;
Expand Down
5 changes: 2 additions & 3 deletions src/gmail/shared/gmail.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
function getTbodyWithMultipleRows() {
function getEmailTables() {
const navDiv = document.querySelector('div[role="navigation"]');
const nextDiv = navDiv ? navDiv.nextElementSibling : null;

if (nextDiv && nextDiv.tagName === 'DIV') {
const tbodies = nextDiv.querySelectorAll('tbody');
return Array.from(tbodies);
return Array.from(nextDiv.querySelectorAll('tbody'));
} else {
console.log("Next element is not a div or doesn't exist.");
return [];
Expand Down
2 changes: 1 addition & 1 deletion src/gmail/tools/read_email/read_email.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if (theAction === "") {
if (!actionDefined) {
console.log("finding email to click")
let emails = [];
for (const tbody of getTbodyWithMultipleRows()) {
for (const tbody of getEmailTables()) {
emails.push(...Array.from(tbody.querySelectorAll('tr')).map(row => {
const email = {};
email["id"] = row.id;
Expand Down
2 changes: 1 addition & 1 deletion src/gmail/tools/select_emails/select_emails.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ console.log("Emails to select: " + emailsToSelect);
console.log("Emails to select: " + JSON.stringify(emailsToSelect));

let emails = [];
for (const tbody of getTbodyWithMultipleRows()) {
for (const tbody of getEmailTables()) {
emails.push(...Array.from(tbody.querySelectorAll('tr')).map(row => {
const email = {};
email["id"] = row.id;
Expand Down

0 comments on commit cb04c75

Please sign in to comment.