Last active
May 31, 2023 18:33
-
-
Save Auax/4c1f4b6cf431954201d19421c1167bcf to your computer and use it in GitHub Desktop.
Blinklearning hack for browsers with neither the console enabled nor extensions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Weird code to access the iframe and its variables as this code | |
is intended to run in the 'javascript:' context in the search bar. | |
Used in Chromebook with both dev console and extensions blocked :) */ | |
function run_() { | |
/* Get iframe's document and window (to access the variables of its context) */ | |
const iframe_ = document.getElementById("class_iframe"); | |
const iWindow = iframe_.contentWindow; | |
const iDocument = iWindow.document; | |
/* Get all correction buttons */ | |
let els = iDocument.querySelectorAll(".js-correct, .js-save"); | |
/* Convert the nodearray to a simple array (not sure if this is necessary though) */ | |
els = Array.prototype.slice.call(els); | |
if (els.length > 0) { | |
els.forEach(function (el) { | |
if (el.tagName.toLowerCase() == "button") { | |
/* Enable and change the button's color */ | |
el.disabled = false; | |
el.style.backgroundColor = "red"; | |
$(el).unbind("click").click(function (e) { | |
/* Must get to the slide_ to call the showSolution method */ | |
var slide = el.closest('.js-slide-wrapper'); /* Parent of button element with class .js-slide-wrapper */ | |
var prefix = 't' + $(slide).data('slide-index'); /* Should look like 't2' or something like that */ | |
var slide_ = iWindow.window[prefix + '_slide']; | |
slide_.showSolution(); /* Get answers */ | |
alert(`Reopen the exercice to unblock it and press the reset button (I might fix this some day).\nAttempts: ${slide_.intentos}`); | |
e.preventDefault(); | |
e.stopImmediatePropagation(); | |
}); | |
} | |
}) | |
} | |
else alert("Couldn't find element in 'els' with length 0!"); | |
} | |
run_(); |
I wrote this code, if you found it useful, please leave a star. Also, if your chromebook has extensions enabled, check the other script to use alongside Tampermonkey or other userscript extensions.
is there any specific instruction or is it patched?
You paste it in the URL bar like I showed in the screenshot, and if I remember correctly for this version, it will work automatically, you only have to press the correct button after running the code. I'm not sure if it's parched or not since I haven't used it for a while, although I doubt it.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To run you must type "javascript: " in Chrome's searchbar when you're in the exercice's page. You can also add it as a bookmark to make it easier.
