From d9b09af59e3a1899a529cab28c299feb8a4c7e41 Mon Sep 17 00:00:00 2001 From: alexh555 Date: Tue, 12 Mar 2024 17:27:34 -0700 Subject: [PATCH] moved functions to js file --- .../media/scripts/program/modules/catalog.js | 23 +++++++++++++++---- .../studentclassregmodule/catalog.html | 22 +++--------------- 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/esp/public/media/scripts/program/modules/catalog.js b/esp/public/media/scripts/program/modules/catalog.js index 741b87f630..448c8a888b 100644 --- a/esp/public/media/scripts/program/modules/catalog.js +++ b/esp/public/media/scripts/program/modules/catalog.js @@ -12,11 +12,6 @@ const MODIFIED_COLOR = "#0066ff22"; const FILTER_IDS = ["grade_filter", "difficulty_filter", "status_filter", "duration_filter"]; -const materialIconsLink = document.createElement("link"); -materialIconsLink.rel = "stylesheet"; -materialIconsLink.href = "https://fonts.googleapis.com/icon?family=Material+Icons"; -document.head.appendChild(materialIconsLink); - /** Converts from hours to a formatted duration (eg. "0.05" -> "3 mins", "1.5" -> "1 hour 30 mins") @param {string} numString - a duration as a float in a string (eg. "0.05") @@ -171,4 +166,22 @@ function configure_addbuttons() $j("input.addbutton").show(); } } +function topFunction() +{ + document.body.scrollTop = 0; // For Safari + document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera +} + +window.onscroll = function() {scrollFunction()}; + +function scrollFunction() { + if (document.body.scrollTop > 100 || document.documentElement.scrollTop > 100) { + document.getElementById("topBtn").style.display = "block"; + document.getElementById("topBtn").style.position = "fixed"; + document.getElementById("topBtn").style.bottom = "20px"; + } else { + document.getElementById("topBtn").style.display = "none"; + } +} + $j(document).ready(configure_addbuttons); diff --git a/esp/templates/program/modules/studentclassregmodule/catalog.html b/esp/templates/program/modules/studentclassregmodule/catalog.html index 54e63c8ee8..78d040a2d1 100644 --- a/esp/templates/program/modules/studentclassregmodule/catalog.html +++ b/esp/templates/program/modules/studentclassregmodule/catalog.html @@ -7,7 +7,9 @@ {% block stylesheets %} {{ block.super }} - + +