diff options
Diffstat (limited to 'pydis_site')
| -rw-r--r-- | pydis_site/static/js/resources/resources.js | 22 | 
1 files changed, 14 insertions, 8 deletions
| diff --git a/pydis_site/static/js/resources/resources.js b/pydis_site/static/js/resources/resources.js index 6e4a09ba..d6cc8128 100644 --- a/pydis_site/static/js/resources/resources.js +++ b/pydis_site/static/js/resources/resources.js @@ -108,6 +108,17 @@ function deserializeURLParams() {      });  } +/* Show or hide the duckies, depending on whether or not there are any resources visible. */ +function updateDuckies() { +    let visibleResources = Boolean($(".resource-box:visible").length); +    if (!visibleResources) { +        $(".no-resources-found").show(); +    } else { +        $(".no-resources-found").hide(); +    } +} + +  /* Update the URL with new parameters */  function updateURL() {      let searchQuery = $("#resource-search input").val(); @@ -194,7 +205,7 @@ function updateUI() {          filterTags.hide();          resourceTags.removeClass("active");          $(`.filter-checkbox:checked`).prop("checked", false); -        $(".no-resources-found").hide(); +        updateDuckies();          return;      } else { @@ -265,13 +276,8 @@ function updateUI() {          searchTag.hide();      } -    // If there are no matches, show the no matches message -    let visibleResources = Boolean($(".resource-box:visible").length); -    if (!visibleResources) { -        $(".no-resources-found").show(); -    } else { -        $(".no-resources-found").hide(); -    } +    // Gotta update those duckies! +    updateDuckies();  }  // Executed when the page has finished loading. | 
