MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
Tag: Reverted
No edit summary
Tag: Reverted
Line 1,364: Line 1,364:
     // inject HTML
     // inject HTML
     doc.body.innerHTML = printHtml;
     doc.body.innerHTML = printHtml;
    // --- sanitize: kill any inner .print-no-border (when user chose WITH border) ---
    (function () {
      // if the content itself carries print-no-border on any wrapper,
      // it would disable borders regardless of the <html> class. Remove them.
      var stray = doc.querySelectorAll(".print-no-border");
      console.log(
        "[swprint] stray .print-no-border count BEFORE:",
        stray.length
      );
      if (borderPref === "with" && stray.length) {
        Array.prototype.forEach.call(stray, function (el) {
          el.className = el.className
            .replace(/\bprint-no-border\b/g, "")
            .trim();
        });
        console.log("[swprint] stray .print-no-border removed");
      }
      // Double-check after cleanup
      console.log(
        "[swprint] stray .print-no-border count AFTER:",
        doc.querySelectorAll(".print-no-border").length
      );
    })();


     // border preference -> <html> class  (this is your applyBorderPreference)
     // border preference -> <html> class  (this is your applyBorderPreference)

Navigation menu