4,554
edits
No edit summary Tag: Reverted |
No edit summary Tag: Reverted |
||
Line 1,367: | Line 1,367: | ||
// --- sanitize: kill any inner .print-no-border (when user chose WITH border) --- | // --- sanitize: kill any inner .print-no-border (when user chose WITH border) --- | ||
(function () { | (function () { | ||
var stray = doc.querySelectorAll(".print-no-border"); | var stray = doc.querySelectorAll(".print-no-border"); | ||
console.log( | console.log( | ||
Line 1,384: | Line 1,382: | ||
} | } | ||
console.log( | console.log( | ||
"[swprint] stray .print-no-border count AFTER:", | "[swprint] stray .print-no-border count AFTER:", | ||
Line 1,391: | Line 1,388: | ||
})(); | })(); | ||
// border preference -> <html> class | // border preference -> <html> class | ||
(function () { | (function () { | ||
var htmlEl = doc.documentElement; | var htmlEl = doc.documentElement; | ||
Line 1,409: | Line 1,406: | ||
); | ); | ||
} | } | ||
console.log("[swprint] html class after apply:", htmlEl.className); | console.log( | ||
"[swprint] html class after apply:", | |||
htmlEl.className || "<empty>" | |||
); | |||
})(); | })(); | ||
// | // (optional) enforcement so the user’s choice always wins | ||
(function () { | (function enforceOuterBorderPreference() { | ||
var | var css = | ||
borderPref === "without" | |||
? ".entry-wrapper,.entry-wrapper.print-a4-narrow{border:0!important;box-shadow:none!important;}" | |||
: ".entry-wrapper,.entry-wrapper.print-a4-narrow{border:1px solid #000!important;}"; | |||
var style = doc.createElement("style"); | |||
style.appendChild(doc.createTextNode(css)); | |||
doc.head.appendChild(style); | |||
console.log("[swprint] outer border rule injected for:", borderPref); | |||
console.log("[swprint] | |||
})(); | })(); | ||