Great find with resetting the values. I’ve updated this slightly to take in words instead instead of resetting all known words. I don’t know if you were planning to do something with “headers”, but think this works a little better. Let me know what you think. I’ve done minimal testing, but also minimally editing your functions.
async function processLessonWords(words, headers) {
...
for (const wordObj of Object.values(data.words)) {
if (wordObj.status === "known" && words.has(wordObj.text)) {
...
...
}
async function main(words) {
await processLessonWords(new Set(words.trim().split(" ")))
console.log("All fixed!")
}
main("abc def ghi")
If you have more than one line of known words on the “Lessons Complete” page,
- Click “Show all”
- right click and click “Search Google” (or whatever your browser equivalent is) to get rid of new lines
- copy all words in your search box
- run as main(“words you copied”)
Otherwise, copy the words selectively as you wish
- In the console, main(“space delimited list of words you wish to reset”)
It has an issue with the stats for the story, but I think that’s okay until LingQ figures something out.