Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const textarea = document.createElement("textarea");
- textarea.rows = 50;
- textarea.style.width = "100%";
- //Put the Text Area at the top of the page
- document.querySelector('body').prepend(textarea);
- // Loop through Each Flash Card
- let timer = setInterval(() => {
- let next = document.querySelector('[aria-label="arrow right"]');
- // If Next Button does not exist the clear timer and exit
- if (next === null) {
- clearInterval(timer);
- return;
- }
- // get flash card values and add them to the text area output
- //Replace New lines with <br> tag
- let card = document.querySelectorAll('[data-testid="Card"]');
- let question = card[0].children[0].children[2].innerText;
- question = question.replace(/(?:\r\n|\r|\n)/g, '<br>');
- let answer = card[1].children[0].children[2].innerText;
- answer = answer.replace(/(?:\r\n|\r|\n)/g, '<br>');
- textarea.value += `<div class='questions'>${question}<hr><div class='answers'>${answer}</div></div>\n`;
- //Click The Next Button
- let button = next.parentElement;
- button.click();
- }, 200);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement