diff options
author | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2020-02-12 16:34:10 -0500 |
---|---|---|
committer | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2020-02-12 16:34:10 -0500 |
commit | 5159803fc5263007572a6972ab9d42429a178e58 (patch) | |
tree | 93784d12cadc563d0f8697dfb3948b8dd7dbacfc /GradeBook.js | |
parent | badd44b76a27874c3469c925f8083b23565b10bf (diff) | |
download | GradeBook-5159803fc5263007572a6972ab9d42429a178e58.tar.gz GradeBook-5159803fc5263007572a6972ab9d42429a178e58.zip |
javascript for hiding controls
Diffstat (limited to 'GradeBook.js')
-rw-r--r-- | GradeBook.js | 17 |
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 ""; } |