MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 700: Line 700:
   // Reset function to remove active filters
   // Reset function to remove active filters
   $(".reset-filter").click(function (event) {
   $(".reset-filter").click(function (event) {
     event.stopPropagation(); // Prevent event bubbling
     event.stopPropagation();


    // Remove 'active' class from all filter buttons
     $("#filters .values button").removeClass("active");
     $("#filters .values button").removeClass("active");
     $(".open-filter").removeClass("active-filter");
     $(".open-filter").removeClass("active-filter");
    // Reset and hide the filter counts
     $(".count-filtered-cards").text("").hide();
     $(".count-filtered-cards").text("").hide();


     filterCards(); // Reapply filtering based on the updated active buttons
     filterCards();
 
    // Update other UI elements as needed, excluding the general toggle button
    updateLastVisibleCard();
    updateWidthBlockView();
    processEventCards();
    updateViews();
    updatePrintSelectionUI();
   });
   });


Line 722: Line 712:
     console.log("Filter is clicked!!!");
     console.log("Filter is clicked!!!");
     $(this).toggleClass("active");
     $(this).toggleClass("active");
     filterCards(); // Re-apply the filters based on the updated active buttons
     filterCards();
 
    updateLastVisibleCard();
    updateWidthBlockView();
    processEventCards();
    updateViews();
   });
   });


Line 1,321: Line 1,306:


   function updatePrintSelectionUI() {
   function updatePrintSelectionUI() {
     setTimeout(function () {
     var hasActiveFilters = jQuery("#filters .values button.active").length > 0;
        var allCards = jQuery(".list-container .card").not(".event").length;
        var visibleCards = jQuery(".list-container .card:visible").not(".event").length;
 
        var isFiltered = visibleCards < allCards;


        if (isFiltered && visibleCards > 0) {
    if (hasActiveFilters) {
         jQuery("#print-selection-wrapper").show();
         jQuery("#print-selection-wrapper").show();
        } else {
    } else {
         jQuery("#print-selection-wrapper").hide();
         jQuery("#print-selection-wrapper").hide();
         jQuery("#print-selection-options").hide();
         jQuery("#print-selection-options").hide();
        }
     }
     }, 0);
   }
   }


Navigation menu