MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Tag: Reverted
Line 1,629: Line 1,629:
       e.preventDefault();
       e.preventDefault();
       swHandlePrintChoice($choice.attr("id"), $choice);
       swHandlePrintChoice($choice.attr("id"), $choice);
    }
  );
  // --- extra safety bindings for Entry page / widgets ---
  // 1) Directly bind the anchors (works even if container delegation misses)
  jQuery(document).on(
    "click.swprintChoice",
    "a#print-with-border, a#print-no-border, #print-with-border, #print-no-border",
    function (e) {
      console.log("[print] direct anchor handler fired:", this.id);
      e.preventDefault();
      swHandlePrintChoice(this.id, jQuery(this));
    }
  );
  // 2) If using the Button widget (<a id=...><button>...</button></a>),
  //    capture clicks on the <button> and route via its parent <a>.
  jQuery(document).on(
    "click.swprintChoiceBtn",
    "#print-options button",
    function (e) {
      var $a = jQuery(this).closest("a[id]");
      if (!$a.length) return;
      console.log(
        "[print] widget button handler fired; parent anchor id:",
        $a.attr("id")
      );
      e.preventDefault();
      swHandlePrintChoice($a.attr("id"), $a);
     }
     }
   );
   );

Navigation menu