4,554
edits
No edit summary Tag: Reverted |
No edit summary Tag: Reverted |
||
Line 1,365: | Line 1,365: | ||
doc.body.innerHTML = printHtml; | doc.body.innerHTML = printHtml; | ||
// border preference -> <html> class | // border preference -> <html> class (this is your applyBorderPreference) | ||
(function () { | (function () { | ||
var htmlEl = doc.documentElement; | var htmlEl = doc.documentElement; | ||
Line 1,383: | Line 1,383: | ||
); | ); | ||
} | } | ||
console.log("[swprint] html class after apply:", htmlEl.className); | |||
})(); | |||
// border preference -> <html> class (this is your applyBorderPreference) | |||
(function () { | |||
var htmlEl = doc.documentElement; | |||
if (borderPref === "without") { | |||
if (htmlEl.classList) htmlEl.classList.add("print-no-border"); | |||
else if ( | |||
(" " + htmlEl.className + " ").indexOf(" print-no-border ") === -1 | |||
) { | |||
htmlEl.className += " print-no-border"; | |||
} | |||
} else { | |||
if (htmlEl.classList) htmlEl.classList.remove("print-no-border"); | |||
else | |||
htmlEl.className = htmlEl.className.replace( | |||
/\bprint-no-border\b/g, | |||
"" | |||
); | |||
} | |||
console.log("[swprint] html class after apply:", htmlEl.className); | |||
})(); | })(); | ||