Study.com Quiz Answers

Highlights correct answers with a green background on Study.com quizzes and exams

As of 2021-04-07. See the latest version.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

  1. // ==UserScript==
  2. // @name Study.com Quiz Answers
  3. // @namespace Violentmonkey Scripts
  4. // @match *://*.study.com/*
  5. // @include https://study.com/*
  6. // @grant none
  7. // @version 1.1.0
  8. // @author Jonah Lawrence
  9. // @description Highlights correct answers with a green background on Study.com quizzes and exams
  10. // ==/UserScript==
  11.  
  12. /* jshint esversion: 6 */
  13.  
  14. (function () {
  15. const interval = setInterval(function () {
  16. const container = document.querySelector("#practice-exam-container");
  17. // check if practice-exam-container element exists (only on exam pages)
  18. if (container) {
  19. const controller = angular.element(container).controller();
  20. if (controller) {
  21. // get questions
  22. const questions = controller.questionByQuestionInstanceId;
  23. // highlight the answer to each question
  24. Object.values(questions).forEach(function (x) {
  25. const correctAnswer = document.querySelector(`li[ng-class*="${x.correctQuizQuestionOptionId}"]`);
  26. if (correctAnswer) {
  27. correctAnswer.style.background = "#c5ff81";
  28. correctAnswer.style.borderRadius = "2px";
  29. correctAnswer.style.boxShadow = "0 0 0 6px #c5ff81";
  30. // no need to keep checking
  31. clearInterval(interval);
  32. }
  33. });
  34. }
  35. }
  36. else {
  37. // add styling for showing quiz answers
  38. const style = document.createElement('style');
  39. style.innerText = `
  40. label[data-correct="true"] {
  41. background: #c5ff81;
  42. box-shadow: 0 0 0 14px #c5ff81;
  43. }`;
  44. document.head.appendChild(style);
  45. // disable interval since this is not an exam
  46. clearInterval(interval);
  47. }
  48. }, 500);
  49. })();