AP Score Reveal

Hides AP exam scores, allowing you to reveal your scores one-by-one.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name     AP Score Reveal
// @namespace   dev.josephgeis.apreveal
// @author      Joseph Geis
// @homepageURL https://josephgeis.dev/
// @description Hides AP exam scores, allowing you to reveal your scores one-by-one.
// @license     MIT
// @version     1.0.1
// @grant       none
// @include  https://apscore.collegeboard.org/scores/view-your-scores*
// @run-at      document-start
// ==/UserScript==

var preStyles = document.createElement("style")
preStyles.type = "text/css"
preStyles.appendChild(
  document.createTextNode(".row-fluid.item > .span5:nth-child(2) { opacity: 0; }")
)
document.head.appendChild(preStyles)

document.addEventListener("DOMContentLoaded", () => {
  let scoreFields = document.querySelectorAll(".row-fluid.item > .span5:nth-child(2) > span")

  for (field of scoreFields) {
    let scoreText = field.querySelector("em")

    scoreText.hidden = true

    let button = document.createElement("button")

    let unhide = () => {
      scoreText.hidden = !scoreText.hidden
      button.remove()
    }

    button.addEventListener("click", unhide)
    button.appendChild(
      document.createTextNode("Show")
    )

    field.appendChild(button)
  }
  
  preStyles.remove();
})