29 lines
666 B
JavaScript
29 lines
666 B
JavaScript
|
console.log("induction/outer.js injected successfully!");
|
||
|
|
||
|
const getButtonContainingText = (text) =>
|
||
|
[...document.getElementsByTagName('button')].filter(b => b.innerText === text)[0];
|
||
|
|
||
|
const latexifyPage = () => {
|
||
|
return "";
|
||
|
}
|
||
|
|
||
|
const getContent = async () => {
|
||
|
|
||
|
getButtonContainingText('Step-by-step solution').click();
|
||
|
|
||
|
getButtonContainingText('Show all steps').click();
|
||
|
|
||
|
return latexifyPage();
|
||
|
}
|
||
|
|
||
|
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
|
||
|
console.log("Checking Message Type");
|
||
|
if (message.type !== "induction") return;
|
||
|
|
||
|
getContent()
|
||
|
.then(latex => {
|
||
|
sendResponse({ content: latex });
|
||
|
});
|
||
|
|
||
|
return true;
|
||
|
});
|