Skip to content

Instantly share code, notes, and snippets.

@CullenChampagne
Created December 7, 2020 03:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CullenChampagne/628f35315cf37ca353b45529df5040eb to your computer and use it in GitHub Desktop.
Save CullenChampagne/628f35315cf37ca353b45529df5040eb to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Edgenuity Addons
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Usefull addons for Egenuity Students
// @author Cullen Champagne
// @match *://*.core.learn.edgenuity.com/*
// @run-at document-idle
// ==/UserScript==
var auto_advance = false;
var guess_questions = false;
var test = false;
//-- function called when page is loaded --//
(function() {
var element_b = document.createElement("li")
element_b.id = "brainly"
var button_b = document.createElement("button");
element_b.append(button_b)
button_b.style = "display:block; padding: 0; border: 2px; background: none; height:45px; width:54px; background-color: rgb(51, 51, 51); color: rgb(249, 166, 25); opacity: 1;"
button_b.innerText = "brainly"
button_b.addEventListener("click", function() {
// opens pop up window with question content
window.open("https://brainly.com/app/ask?q=" + getQuestionContent(), "", "width=500,height=800")
});
jQuery(".toolbar")[0].append(button_b);
})();
/**
* Gets the question currently being displayed in window
*/
getQuestionContent = function() {
var question = "";
try {
var answer_labels = window.frames[0].frames[0].document.getElementsByClassName("answer-choice-label")
var question_body = window.frames[0].frames[0].document.getElementsByTagName("p")
// Adds all question body values to string
Array.prototype.forEach.call(question_body, function(body) {
question = question.concat(body.textContent, '\n')
});
question.concat('\n')
// Adds all asnwer choices to string
Array.prototype.forEach.call(answer_labels, function(label) {
question = question.concat(label.textContent, '\n')
});
} catch {}
return question;
}
setInterval(function(){
//-- Attempts to advance through lessons and videos if avalible --//
function autoAdvance() {
if (!autoAdvance) return;
var blacklisted_options = ["Unit Test", "Unit Test Review", "Quiz", "Assignment"]
if (blacklisted_options.includes($("#activity-title").text)) return;
try {
document.getElementsByClassName("footnav goRight")[0].click()
} catch(TypeError) {}
$("#stageFrame").contents().find(".FrameRight").click()
}
autoAdvance();
//-- Attempts to guess on any questions --//
function guessPractice() {
if (!guess_questions) return;
var blacklisted_options = ["Unit Test", "Unit Test Review", "Quiz"]
try {
if (blacklisted_options.includes(document.getElementById("activity-title").innerText)) return;
window.options = window.frames[0].frames[0].document.getElementsByClassName("answer-choice-button");
window.options[Math.floor(Math.random() * window.options.length)].click();
} catch (TypeError) {}
// submits the form after its guessed an answer
try {
window.frames[0].API.Frame.check()
} catch (TypeError) {}
}
guessPractice();
}, 2000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment