MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 1,862: Line 1,862:
   // toggle filtered print options
   // toggle filtered print options
   jQuery(document).on("click", ".print-selection-toggle", function (e) {
   jQuery(document).on("click", ".print-selection-toggle", function (e) {
    e.preventDefault();
        e.preventDefault();
    jQuery("#print-selection-options").toggle();
        jQuery("#print-selection-options").toggle();
  });
    });


  // run filtered batch print
    // run filtered batch print
  jQuery(document).on(
    jQuery(document).on(
     "click",
     "click",
     ".print-selection-border, .print-selection-no-border",
     ".print-selection-border, .print-selection-no-border",
     function (e) {
     function (e) {
      e.preventDefault();
        e.preventDefault();


      var borderPref = jQuery(this).hasClass("print-selection-no-border")
        var $btn = jQuery(this);
 
        var borderPref = $btn.hasClass("print-selection-no-border")
         ? "without"
         ? "without"
         : "with";
         : "with";


      hidePrintSelectionOptions();
        // 👇 UI feedback
      swHandleBatchPrint(borderPref);
        var originalText = $btn.text();
        $btn.text("[PREPARING]");
        $btn.prop("disabled", true);
 
        hidePrintSelectionOptions();
 
        // 👇 allow UI to update before heavy print logic
        setTimeout(function () {
        swHandleBatchPrint(borderPref);
 
        // optional reset (in case user comes back)
        $btn.text(originalText);
        $btn.prop("disabled", false);
        }, 50);
     }
     }
   );
   );

Navigation menu