diff --git a/docs/WebSocket-Implementation-Tutorial.md b/docs/WebSocket-Implementation-Tutorial.md new file mode 100644 index 00000000..e69de29b diff --git a/src/pages/content/index.tsx b/src/pages/content/index.tsx index 58ddfec8..c652f20b 100644 --- a/src/pages/content/index.tsx +++ b/src/pages/content/index.tsx @@ -1,6 +1,7 @@ import CourseCatalogMain from '@views/components/CourseCatalogMain'; import InjectedButton from '@views/components/injected/AddAllButton'; import DaysCheckbox from '@views/components/injected/DaysCheckbox'; +import ShadedResults from '@views/components/injected/SearchResultShader'; import getSiteSupport, { SiteSupport } from '@views/lib/getSiteSupport'; import React from 'react'; import { createRoot } from 'react-dom/client'; @@ -30,3 +31,7 @@ if (support === SiteSupport.MY_UT) { if (support === SiteSupport.COURSE_CATALOG_SEARCH) { renderComponent(DaysCheckbox); } + +if (support === SiteSupport.COURSE_CATALOG_KWS) { + renderComponent(ShadedResults); +} diff --git a/src/views/components/injected/SearchResultShader.tsx b/src/views/components/injected/SearchResultShader.tsx new file mode 100644 index 00000000..c63ad868 --- /dev/null +++ b/src/views/components/injected/SearchResultShader.tsx @@ -0,0 +1,39 @@ +import { useEffect } from 'react'; +// @TODO Get a better name for this class + +/** + * The existing search results (kws), only with alternate shading for easier readability + * + */ +export default function ShadedResults(): null { + useEffect(() => { + const table = document.getElementById('kw_results_table'); + if (!table) { + console.error('Results table not found'); + return; + } + + const tbody = table.querySelector('tbody'); + if (!tbody) { + console.error('Table tbody not found'); + return; + } + + const style = document.createElement('style'); + style.textContent = ` + #kw_results_table tbody tr:nth-child(even) { + background-color: #f0f0f0 !important; + } + #kw_results_table tbody tr:nth-child(even) td { + background-color: #f0f0f0 !important; + } + `; + document.head.appendChild(style); + + return () => { + style.remove(); + }; + }, []); + + return null; +} diff --git a/src/views/components/settings/Settings.tsx b/src/views/components/settings/Settings.tsx index 467d30d1..9706a0b5 100644 --- a/src/views/components/settings/Settings.tsx +++ b/src/views/components/settings/Settings.tsx @@ -1,16 +1,13 @@ // import addCourse from '@pages/background/lib/addCourse'; import { addCourseByURL } from '@pages/background/lib/addCourseByURL'; import { deleteAllSchedules } from '@pages/background/lib/deleteSchedule'; -import exportSchedule from '@pages/background/lib/exportSchedule'; import importSchedule from '@pages/background/lib/importSchedule'; import { CalendarDots, Trash } from '@phosphor-icons/react'; import { background } from '@shared/messages'; import { DevStore } from '@shared/storage/DevStore'; import { initSettings, OptionsStore } from '@shared/storage/OptionsStore'; -import { UserScheduleStore } from '@shared/storage/UserScheduleStore'; import { CRX_PAGES } from '@shared/types/CRXPages'; import MIMEType from '@shared/types/MIMEType'; -import { downloadBlob } from '@shared/util/downloadBlob'; // import { addCourseByUrl } from '@shared/util/courseUtils'; // import { getCourseColors } from '@shared/util/colors'; // import CalendarCourseCell from '@views/components/calendar/CalendarCourseCell'; diff --git a/src/views/lib/getSiteSupport.ts b/src/views/lib/getSiteSupport.ts index 0e769f6c..e5dee841 100644 --- a/src/views/lib/getSiteSupport.ts +++ b/src/views/lib/getSiteSupport.ts @@ -15,6 +15,7 @@ export const SiteSupport = { MY_UT: 'MY_UT', COURSE_CATALOG_SEARCH: 'COURSE_CATALOG_SEARCH', CLASSLIST: 'CLASSLIST', + COURSE_CATALOG_KWS: 'COURSE_CATALOG_KWS', } as const; /** @@ -40,6 +41,9 @@ export default function getSiteSupport(url: string): SiteSupportType | null { return SiteSupport.UT_PLANNER; } if (url.includes('utdirect.utexas.edu/apps/registrar/course_schedule')) { + if (url.includes('kws_results')) { + return SiteSupport.COURSE_CATALOG_KWS; + } if (url.includes('results')) { return SiteSupport.COURSE_CATALOG_LIST; }