MA0301/tools/discrete-extraction-tools/scripts/induction/outer.js

29 lines
666 B
JavaScript
Raw Permalink Normal View History

2021-05-17 00:31:21 +02:00
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;
});