MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 1,874: Line 1,874:


         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";


         // 👇 add global "working" state
         // disable all related buttons
         document.body.classList.add("printing");
        jQuery(".print-selection-border, .print-selection-no-border, .print-selection-toggle")
         .prop("disabled", true)
        .css("opacity", "0.5");


         // optional: disable clicked button
         // change ONLY clicked button text (native feeling)
         $btn.prop("disabled", true);
        var originalText = $btn.text();
         $btn.text("working…");


         swHandleBatchPrint(borderPref);
         swHandleBatchPrint(borderPref);
        // optional reset (if user comes back)
        setTimeout(function () {
        $btn.text(originalText);
        jQuery(".print-selection-border, .print-selection-no-border, .print-selection-toggle")
            .prop("disabled", false)
            .css("opacity", "");
        }, 2000);
     }
     }
   );
   );

Navigation menu