Making Rebrickable parts list printable

Printing the parts list for a set by default prints a lot of unnecessary elements on the first page and breaks across some of the grid tiles. I fixed the breaking with this style: .js-part { page-break-inside: avoid; } Which I can inject with javascript: const style = document.createElement('style'); style.textContent = ` .js-part { page-break-inside: avoid; } `; document.head.appendChild(style); Next, I needed to remove all the unnecessary elements in the page. Of course, if this is just a one-off print then it’s probably easier to remove the elements by inspecting them with the browser devtools. But since I’ll be doing this several times I turned to javascript to make it repeatable: ...