aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--GradeBook.js17
1 files changed, 11 insertions, 6 deletions
diff --git a/GradeBook.js b/GradeBook.js
index 18652c8..4878060 100644
--- a/GradeBook.js
+++ b/GradeBook.js
@@ -1,10 +1,10 @@
-function toggleHTMLClassVisibility(className) {
+function toggleHTMLClassVisibility(className, defaultVisibleStyle) {
var x = document.getElementsByClassName(className);
var i;
- var display_style = "block"; // default
+ var display_style = defaultVisibleStyle; // default
for (i = 0; i < x.length; i++) {
if (x[i].style.display === "none") {
- display_style = "block";
+ display_style = defaultVisibleStyle;
} else {
display_style = "none";
}
@@ -16,7 +16,7 @@ function toggleHTMLClassVisibility(className) {
function setHTMLClassVisibility(className, display_style) {
// use "block" or "none" for display_style
if (display_style === "") {
- display_style = "block"; // default
+ display_style = ""; // default
}
var x = document.getElementsByClassName(className);
var i;
@@ -28,11 +28,15 @@ function setHTMLClassVisibility(className, display_style) {
function toggleHistogramMarker() {
- toggleHTMLClassVisibility("histogram_marker");
+ toggleHTMLClassVisibility("histogram_marker", "block");
};
function toggleGradingScheme() {
- toggleHTMLClassVisibility("grading_scheme");
+ toggleHTMLClassVisibility("grading_scheme", "block");
+};
+
+function toggleControls() {
+ toggleHTMLClassVisibility("controls", "");
};
// getCookie is copied from https://www.w3schools.com/js/js_cookies.asp
@@ -60,6 +64,7 @@ function readAndSetVisibility(className) {
function onPageLoad() {
readAndSetVisibility("histogram_marker");
readAndSetVisibility("grading_scheme");
+ readAndSetVisibility("controls");
return "";
}