* feat: enable TS strict mode * fix: strict TS errors * fix: strict TS errors * fix: strict TS errors * fix: strict TS errors * fix: strict TS errors * fix: strict TS errors * fix: strict TS errors * fix: strict TS errors * fix: colors bug with default * fix: strict TS errors * fix: strict TS errors * fix: strict TS errors * fix: strict TS errors * fix: strict TS errors * fix: strict TS errors * fix: strict TS errors * fix: strict TS errors * fix: strict TS errors * fix: strict TS errors * fix: strict TS errors * fix: text type errors * fix: strict TS errors * fix: strict TS errors * fix: strict TS errors - add definite assignment assertion * fix: strict TS errors - add definite assignment assertion * fix: strict TS errors * fix: strict TS errors * fix: strict TS errors * fix: strict TS errors * fix: strict TS errors * fix: strict TS errors * fix(ESLint): error on no-explicit-any * fix: type annotations for any types * fix: strict TS errors * fix: strict TS errors * fix: strict TS errors * fix: strict TS errors (and remove packages) * fix: strict TS errors * fix: strict TS errors * fix: strict TS errors * fix: strict TS errors * fix: strict TS errors * fix: strict TS errors * fix: strict TS errors * feat: enable React.StrictMode * fix: strict TS errors (done!) * fix: build error * fix: replace no-explicit-any assertions * refactor: cleanup * refactor: more cleanup * style: prettier --------- Co-authored-by: Lukas Zenick <lukas@utexas.edu> Co-authored-by: Razboy20 <razboy20@gmail.com>
40 lines
1.7 KiB
TypeScript
40 lines
1.7 KiB
TypeScript
import openNewTab from '@background/util/openNewTab';
|
|
import type CESMessage from '@shared/messages/CESMessage';
|
|
import type { MessageHandler } from 'chrome-extension-toolkit';
|
|
|
|
const CESFall2023Url = 'https://utexas.bluera.com/utexas/rpvl.aspx?rid=d3db767b-049f-46c5-9a67-29c21c29c580®l=en-US';
|
|
|
|
const CESHandler: MessageHandler<CESMessage> = {
|
|
openCESPage({ data, sendResponse }) {
|
|
const { instructorFirstName, instructorLastName } = data;
|
|
openNewTab(CESFall2023Url).then(tab => {
|
|
const instructorFirstAndLastName = [instructorFirstName, instructorLastName];
|
|
chrome.scripting.executeScript({
|
|
target: { tabId: tab.id },
|
|
func: (...instructorFirstAndLastName: string[]) => {
|
|
const inputElement = document.getElementById(
|
|
'ctl00_ContentPlaceHolder1_ViewList_tbxValue'
|
|
) as HTMLInputElement | null;
|
|
const [instructorFirstName, instructorLastName] = instructorFirstAndLastName;
|
|
if (inputElement) {
|
|
inputElement.value = `${instructorFirstName} ${instructorLastName}`;
|
|
inputElement.focus();
|
|
const enterKeyEvent = new KeyboardEvent('keydown', {
|
|
key: 'Enter',
|
|
code: 'Enter',
|
|
keyCode: 13,
|
|
which: 13,
|
|
bubbles: true,
|
|
});
|
|
inputElement.dispatchEvent(enterKeyEvent);
|
|
}
|
|
},
|
|
args: instructorFirstAndLastName,
|
|
});
|
|
sendResponse(tab);
|
|
});
|
|
},
|
|
};
|
|
|
|
export default CESHandler;
|