From 2e306aae9452bae193689e164dd7fa86679e6049 Mon Sep 17 00:00:00 2001 From: Tyler Hill Date: Thu, 4 Jan 2024 14:48:19 -0600 Subject: [PATCH] Layout fix and cleanup --- src/background.ts | 4 ---- src/content.ts | 8 ++++++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/background.ts b/src/background.ts index 51e89c9..93a8e05 100644 --- a/src/background.ts +++ b/src/background.ts @@ -16,7 +16,6 @@ const storage = new Storage(); /** Injects the content script if we hit a course page */ chrome.webNavigation.onHistoryStateUpdated.addListener((details) => { - console.log('hello'); if ( /^.*:\/\/utdallas\.collegescheduler\.com\/terms\/.*\/courses\/.+$/.test( details.url, @@ -58,14 +57,11 @@ chrome.webNavigation.onHistoryStateUpdated.addListener((details) => { chrome.runtime.onMessage.addListener(function (message) { if (message === 'tableChange') { - console.log('hi'); chrome.scripting.executeScript( { target: { tabId: courseTabId, }, - // content script injection only works reliably on the prod packaged extension - // b/c of the plasmo dev server connections func: scrapeCourseData, }, async function (resolve) { diff --git a/src/content.ts b/src/content.ts index 2fb3b45..4d9beb1 100644 --- a/src/content.ts +++ b/src/content.ts @@ -85,6 +85,11 @@ export async function scrapeCourseData() { }); const courseRowCells = courseRow.querySelector('tr'); courseRowCells.insertBefore(newTd, courseRowCells.children[7]); + //Increase Disabled Reasons row colspan if necessary + const sectionDisabled = courseRow.querySelector('tr:nth-child(3) > td'); + if (sectionDisabled !== null) { + sectionDisabled.colSpan = sectionDisabled.colSpan + 1; + } // collapse section details sectionDetailsButton.click(); }); @@ -92,7 +97,7 @@ export async function scrapeCourseData() { } } -export async function listenForTableChange() { +export function listenForTableChange() { const observer = new MutationObserver((mutationsList) => { for (const mutation of mutationsList) { if ( @@ -100,7 +105,6 @@ export async function listenForTableChange() { mutation.attributeName === 'class' ) { if (mutation.target.classList.contains('active')) { - console.log(mutation.target.innerText.split(' ')[0]); chrome.runtime.sendMessage('tableChange'); } }