From 89b503ed68e9607ec6fd286451f79de7f944245a Mon Sep 17 00:00:00 2001 From: EthanHarv Date: Tue, 13 Jul 2021 05:54:55 -0500 Subject: [PATCH] Make images work --- slader-limit-bypass/js/quizlet_bypass.js | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/slader-limit-bypass/js/quizlet_bypass.js b/slader-limit-bypass/js/quizlet_bypass.js index 0f46923..5f6a2dc 100644 --- a/slader-limit-bypass/js/quizlet_bypass.js +++ b/slader-limit-bypass/js/quizlet_bypass.js @@ -32,7 +32,16 @@ function renderBypass() var b = data.match(/(?<=window.Quizlet\["questionDetailsPageData"] = ).+?(?=; QLoad\("Quizlet.questionDetailsPageData")/gm); if (!b) { - expArea.innerHTML = `

You have been ratelimited by Quizlet


Try clearing your cookies for Quizlet.
— Slader Bypass
`; + if (window.location.toString().includes('quizlet.com/explanations/textbook-solutions')) + { + // TODO: Redirect to old site + 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.
`; + } + 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.
`; + } } // TODO: Branch off to handle textbookExercisePageData. See line 1349 in "deleteme.html". @@ -59,9 +68,15 @@ function renderBypass() // It seems that only one column is ever used. I'll iterate anyways, because I can't trust that. step.columns.forEach(column => { // Insert inner text - div.querySelector('.sladerBypassKatex').textContent = column.text.replaceAll('\n\n\n', '\n\n'); // The replace call is a bit funky but it works. - - // TODO: Handle column.images.additional + if (column.text) + div.querySelector('.sladerBypassKatex').textContent = column.text.replaceAll('\n\n\n', '\n\n'); // The replace call is a bit funky but it works. + // Insert image, if applicable + if (column.images.additional) + { + var image = document.createElement('img'); + image.setAttribute('src', column.images.additional.regular.srcUrl); + div.querySelector('.sladerBypassKatex').appendChild(image); + } }); // Append card to explanation area.