Skip to content

Instantly share code, notes, and snippets.

@Auax
Last active May 31, 2023 18:33
Show Gist options
  • Save Auax/4c1f4b6cf431954201d19421c1167bcf to your computer and use it in GitHub Desktop.
Save Auax/4c1f4b6cf431954201d19421c1167bcf to your computer and use it in GitHub Desktop.
Blinklearning hack for browsers with neither the console enabled nor extensions.
/* 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_();
@Auax
Copy link
Author

Auax commented Apr 5, 2022

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.
image

@Auax
Copy link
Author

Auax commented Aug 25, 2022

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.

@garzap841
Copy link

is there any specific instruction or is it patched?

@Auax
Copy link
Author

Auax commented May 31, 2023

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