Skip to content

Instantly share code, notes, and snippets.

@lrakai
Last active November 12, 2021 04:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lrakai/c46fbb626fd4eea7ee553d6543329fca to your computer and use it in GitHub Desktop.
Save lrakai/c46fbb626fd4eea7ee553d6543329fca to your computer and use it in GitHub Desktop.
lab-debug-on
// ==UserScript==
// @name Lab Debug On
// @namespace http://tampermonkey.net/
// @version 0.5
// @description Lab Debug On
// @author You
// @match https://*.cloudacademy.com/*
// @grant none
// @require https://code.jquery.com/jquery-3.6.0.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @downloadURL https://gist.githubusercontent.com/lrakai/c46fbb626fd4eea7ee553d6543329fca/raw/lab-debug-on
// @updateURL https://gist.githubusercontent.com/lrakai/c46fbb626fd4eea7ee553d6543329fca/raw/lab-debug-on
// @run-at document-start
// ==/UserScript==
(function() {
'use strict';
const debug_lab_selector = "#start-lab";
const debug_lab_challenge_selector = "#Start-Button";
waitForKeyElements(debug_lab_selector, debug_lab);
waitForKeyElements(debug_lab_challenge_selector, debug_lab);
function debug_lab() {
const pathElements = window.location.pathname.split('/').filter(e => e);
if (!(pathElements.includes("lab") || pathElements.includes("lab-challenge")) || pathElements.length > 2 /* lab step */) {
return;
}
const url = new URL(window.location.href);
if (!url.searchParams.get('debug_mode')) {
url.searchParams.set('debug_mode', true);
window.location.href = url.href;
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment