MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
Tag: Reverted
No edit summary
Tag: Manual revert
Line 1,867: Line 1,867:


   // run filtered batch print
   // run filtered batch print
   jQuery(document)
   jQuery(document).on(
    .off("click.printSelectionFix")
     "click",
     .on(
    ".print-selection-border, .print-selection-no-border",
        "click.printSelectionFix",
    function (e) {
        ".print-selection-border, .print-selection-no-border",
        function (e) {
         e.preventDefault();
         e.preventDefault();
 
         console.log("PRINT BUTTON CLICKED"); // 👈 add this
         console.log("NEW HANDLER RUNNING"); // 👈 debug


         var $btn = jQuery(this);
         var $btn = jQuery(this);


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


        // 👇 UI feedback
         var originalText = $btn.text();
         var originalText = $btn.text();
         $btn.text("[PREPARING]");
         $btn.text("[PREPARING]");
         $btn.prop("disabled", true);
         $btn.prop("disabled", true);
        $btn[0].offsetHeight; // force repaint


         hidePrintSelectionOptions();
         hidePrintSelectionOptions();


        // 👇 allow UI to update before heavy print logic
         setTimeout(function () {
         setTimeout(function () {
            swHandleBatchPrint(borderPref);
        swHandleBatchPrint(borderPref);


            $btn.text(originalText);
        // optional reset (in case user comes back)
            $btn.prop("disabled", false);
        $btn.text(originalText);
         }, 200);
        $btn.prop("disabled", false);
        }
         }, 50);
    );
    }
  );


   /* ---------- /Softwear PRINT ---------- */
   /* ---------- /Softwear PRINT ---------- */

Navigation menu