aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/static
diff options
context:
space:
mode:
authorGravatar Leon Sandøy <[email protected]>2022-02-13 20:03:46 +0100
committerGravatar Leon Sandøy <[email protected]>2022-02-13 20:04:42 +0100
commitfbea3ccd4e7bf90c6efa67f4a5b98148eb4af23f (patch)
tree5bd0a53ce9025f1b6f95d0141db22e8af2dd9e25 /pydis_site/static
parentFix bug with search tag taking up too much width. (diff)
Edge cases: Show duckies when no visible resources
Diffstat (limited to 'pydis_site/static')
-rw-r--r--pydis_site/static/js/resources/resources.js22
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.