Skip to content

Instantly share code, notes, and snippets.

@dizys
Created October 20, 2022 02:09
Show Gist options
  • Save dizys/961c75908a4c45b508dac0c429e463c3 to your computer and use it in GitHub Desktop.
Save dizys/961c75908a4c45b508dac0c429e463c3 to your computer and use it in GitHub Desktop.
Toggle printing mode for NVIDIA blog website.
function togglePrintMode() {
let inPrintMode = document.querySelector("header").hidden === true;
document.querySelector("header").hidden = !inPrintMode;
document.querySelector(".subscribe-link-wrapper").hidden = !inPrintMode;
document.querySelector(".card--post-attributes").hidden = !inPrintMode;
document.querySelector(".card--post-attributes-secondary").hidden = !inPrintMode;
// document.querySelector(".card--post-attributes-secondary > .post-tags--list").hidden = !inPrintMode;
document.querySelector("#sidebar").hidden = !inPrintMode;
document.querySelector(".entry-content-author").hidden = !inPrintMode;
document.querySelector(".entry-content-comments").hidden = !inPrintMode;
document.querySelector("#nv-footer").hidden = !inPrintMode;
document.querySelector(".st-sticky-share-buttons").hidden = !inPrintMode;
let byAuthorDiv = document.querySelector(".post-card--single > .row > .col-lg-12");
byAuthorDiv.classList.remove("mb-0");
byAuthorDiv.classList.add("mb-3");
}
togglePrintMode();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment