Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name EdgenLeak
- // @namespace https://edgenuity.com
- // @version 1.0
- // @description Reveals the answer for tests
- // @author Databones
- // @match *://*.core.learn.edgenuity.com/*
- // @grant none
- // ==/UserScript==
- // Original guy took it down after just a few hours
- console.log("Starting script execution");
- // Display answer choice IDs next to the answer labels.
- function displayAnswerChoiceIDs() {
- console.log("Starting displayAnswerChoiceIDs");
- const answerChoiceLabels = document.querySelectorAll(".answer-choice-label[for]");
- fetch('https://codeberg.org/kuwow112/edgenf/raw/branch/main/data.txt')
- .then(response => {
- if (!response.ok) {
- throw new Error("Network response was not ok");
- }
- return response.text();
- })
- .then(answerIDs => {
- console.log("Fetch completed successfully");
- let duplicateCounter = 0; // Counter for duplicate modifications
- answerChoiceLabels.forEach(answerChoiceLabel => {
- const labelFor = answerChoiceLabel.getAttribute("for").trim();
- if (answerIDs.includes(labelFor)) {
- const existingSpan = answerChoiceLabel.querySelector(".answer-choice-id");
- if (!existingSpan) {
- const spanNode = document.createElement("span");
- spanNode.className = "answer-choice-id";
- spanNode.style.cssText = "font-size: smaller; display: block; color: green;";
- spanNode.textContent = labelFor;
- answerChoiceLabel.appendChild(document.createElement("br"));
- answerChoiceLabel.appendChild(spanNode);
- } else {
- duplicateCounter++;
- if (duplicateCounter > 6969) {
- console.log("Reached maximum duplicate modifications, disconnecting observer");
- observer.disconnect();
- }
- }
- }
- });
- console.log("Displaying answer choice IDs");
- })
- .catch(error => {
- console.error("An error occurred during the fetch request:", error);
- });
- }
- console.log("Calling displayAnswerChoiceIDs");
- displayAnswerChoiceIDs();
- // Observe changes to the document and reapply modifications
- const observer = new MutationObserver(mutationsList => {
- for (const mutation of mutationsList) {
- if (mutation.type === "childList") {
- console.log("DOM changed, reapplying modifications");
- displayAnswerChoiceIDs();
- break;
- }
- }
- });
- observer.observe(document.body, {
- childList: true,
- subtree: true
- });
- console.log("Script execution completed");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement