From ffa5bec75b96fc79f4746b4309d0bd74fb34acb6 Mon Sep 17 00:00:00 2001 From: lebr0nli Date: Wed, 14 Jul 2021 16:03:53 +0800 Subject: [PATCH] support to textbook solutions --- slader-limit-bypass/js/quizlet_bypass.js | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/slader-limit-bypass/js/quizlet_bypass.js b/slader-limit-bypass/js/quizlet_bypass.js index b63d45c..6e0a803 100644 --- a/slader-limit-bypass/js/quizlet_bypass.js +++ b/slader-limit-bypass/js/quizlet_bypass.js @@ -31,30 +31,18 @@ function processData(data){ // // I don't want to talk about it. // - var json = data.match(/(?<=window.Quizlet\["questionDetailsPageData"] = ).+?(?=; QLoad\("Quizlet.questionDetailsPageData")/gm); + var json = data.match(/(?<=window.Quizlet\["(questionDetailsPageData|textbookExercisePageData)"] = ).+?(?=; QLoad\("Quizlet.(questionDetailsPageData|textbookExercisePageData)")/gm); if (!json) { - if (window.location.toString().includes('quizlet.com/explanations/textbook-solutions')) - { - var oldlink = getOldTextbookLink(); - expArea.innerHTML = `

Textbooks currently only supported by Slader Bypass on the old website.


Click here to be redirected to the working version of this question. If that doesn't work, try finding it manually on the old site.
`; - document.querySelector('.sladerBypassOldLink').href = oldlink; - } - else - { - // Display ratelimit message - expArea.innerHTML = `

You have been ratelimited by Quizlet


Try clearing your cookies for Quizlet and reloading this page, this usually fixes it.
— Slader Bypass.
`; - } + // Display ratelimit message + expArea.innerHTML = `

You have been ratelimited by Quizlet


Try clearing your cookies for Quizlet and reloading this page, this usually fixes it.
— Slader Bypass.
`; } - // TODO: Handle textbookExercisePageData. - - // Parse JSON data var qDetails = JSON.parse(json[0]); - + var solutions = (qDetails.question || qDetails.exercise).solutions; // Display JSON data as answer - qDetails.question.solutions.forEach(solution => { + solutions.forEach(solution => { const numSteps = solution.steps.length; solution.steps.forEach(step => { const stepNum = step.stepNumber;