aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/static/js/resources
diff options
context:
space:
mode:
authorGravatar Leon Sandøy <[email protected]>2022-02-01 22:43:15 +0100
committerGravatar Leon Sandøy <[email protected]>2022-02-01 22:43:15 +0100
commite144d4d1b4d1ef2ec2f9f8b771b3606b581ace34 (patch)
tree13c057809298c4f6ce6b16985e762df5a96e4107 /pydis_site/static/js/resources
parentRefactor as_css_class to 'to_kebabcase'. (diff)
Complete refactor of collapsibles.
This is now a completely self-contained feature, which can be used in the same way on every page. I've moved all the collapsible-related logics out of the resources.js file and into collapsibles.js, and added documentation and other quality-of-life features that will apply to other pages, as well. Changes: - The icon will now always change when the collapsible opens or closes. - By adding the "collapsed" class, you can tell the collapsible to be collapsed by default.
Diffstat (limited to 'pydis_site/static/js/resources')
-rw-r--r--pydis_site/static/js/resources/resources.js15
1 files changed, 1 insertions, 14 deletions
diff --git a/pydis_site/static/js/resources/resources.js b/pydis_site/static/js/resources/resources.js
index 00bc6ad8..e45233b3 100644
--- a/pydis_site/static/js/resources/resources.js
+++ b/pydis_site/static/js/resources/resources.js
@@ -217,20 +217,7 @@ document.addEventListener("DOMContentLoaded", function () {
deserializeURLParams();
updateUI();
- // If you collapse or uncollapse a filter group, swap the icon.
- $('button.collapsible').on("click", function() {
- let icon = $(this).find(".card-header-icon i");
-
- if ($(icon).hasClass("fa-window-minimize")) {
- $(icon).removeClass(["far", "fa-window-minimize"]);
- $(icon).addClass(["fas", "fa-angle-down"]);
- } else {
- $(icon).removeClass(["fas", "fa-angle-down"]);
- $(icon).addClass(["far", "fa-window-minimize"]);
- }
- });
-
- // If this is a mobile device, collapse the categories to win back some screen real estate.
+ // If this is a mobile device, collapse all the categories to win back some screen real estate.
if (screen.width < 480) {
let categoryHeaders = $(".filter-category-header .collapsible-content");
let icons = $('.filter-category-header button .card-header-icon i');