Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/hossainemruz/toha.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
authorEmruz Hossain <hossainemruz@gmail.com>2021-03-23 18:46:41 +0300
committerGitHub <noreply@github.com>2021-03-23 18:46:41 +0300
commit2af89479bee6cac2012a7b6c5603dd3712e7fa49 (patch)
treec794750df95a7097e20c67adeee93cf744f9c0d1 /static
parentcf88e957820a2b32c9b4dd9bb29cec68f23ed626 (diff)
Fix courses visibility toggler button (#257)
Signed-off-by: hossainemruz <hossainemruz@gmail.com>
Diffstat (limited to 'static')
-rw-r--r--static/js/main.js15
1 files changed, 8 insertions, 7 deletions
diff --git a/static/js/main.js b/static/js/main.js
index 4975634..1be43a4 100644
--- a/static/js/main.js
+++ b/static/js/main.js
@@ -139,7 +139,7 @@ function toggleTOC() {
}
// Show more rows in the taken courses table
-function showMoreCourses(elem) {
+function toggleCourseVisibility(elem) {
// find the courses
let courses = elem.parentNode.getElementsByClassName("course");
@@ -154,11 +154,12 @@ function showMoreCourses(elem) {
}
}
- // toggle the button text
- let btnText = elem.innerText;
- if (btnText == "Show More") {
- elem.innerText = "Show Less";
- } else {
- elem.innerText = "Show More";
+ // toggle the current button visibility
+ elem.classList.toggle("hidden");
+ // toggle the alternate button visibility
+ if (elem.id === "show-more-btn"){
+ document.getElementById("show-less-btn").classList.toggle("hidden");
+ }else{
+ document.getElementById("show-more-btn").classList.toggle("hidden");
}
}