Skip to content

Instantly share code, notes, and snippets.

@anantoghosh
Last active April 18, 2022 15:48
Show Gist options
  • Save anantoghosh/dbd35ca9c2e3b691ff4033bc7c4dbee2 to your computer and use it in GitHub Desktop.
Save anantoghosh/dbd35ca9c2e3b691ff4033bc7c4dbee2 to your computer and use it in GitHub Desktop.
Print Coursera Reading Pages
document.querySelector('.rc-PageHeader')?.remove()
document.querySelector('.rc-ItemFeedback')?.remove()
document.querySelector('.ItemPageLayout_navToggle')?.remove()
document.querySelector('.rc-ReadingCompleteButton')?.remove()
document.querySelector('.ItemPageLayout_content_navigation')?.remove()
document.querySelector('.ItemPageLayout_header')?.remove()
document.querySelector('.ItemPageLayout_banner')?.remove()
document.querySelector('.rc-ReadingItem')?.setAttribute('style', 'max-width: unset; margin-top: 0;');
document.querySelector('.ItemPageLayout_container')?.setAttribute('style', 'top: 0;');
document.querySelector('.ItemPageLayout_content_body')?.setAttribute('style', 'padding: 0;');
document.querySelector('.ItemPageLayout_container')?.setAttribute('style', 'position: static;');
document.querySelector('.ItemPageLayout')?.setAttribute('style', 'position: static;');
document.querySelector('.ItemPageLayout_content_body')?.setAttribute('style', 'padding: 0; overflow: unset; display: block;');
document.querySelector('.rc-ReadingItem > div:first-child')?.setAttribute('style', 'margin-bottom: 0;');
document.querySelector('html')?.setAttribute('style', 'font-size: 12px; padding-left: 40px;');
document.querySelectorAll('.rc-ReadingItem img').forEach((item) => {
item.setAttribute('style', 'display: block; max-width: 70% !important; margin-inline: auto');
})
document.querySelectorAll('.rc-ReadingItem li').forEach((item) => {
item.setAttribute('style', 'margin-bottom: 0;');
})
document.querySelectorAll('.rc-ReadingItem p').forEach((item) => {
item.setAttribute('style', 'margin-bottom: 8px; min-height: 0;');
})
document.querySelectorAll('.rc-ReadingItem ul li p').forEach((item) => {
item.setAttribute('style', 'margin-bottom: 0; min-height: 0;');
})
document.querySelectorAll('.rc-ReadingItem h3').forEach((item) => {
item.setAttribute('style', 'margin: 12px 0 8px;');
})
document.querySelectorAll('.rc-ReadingItem h2').forEach((item) => {
item.setAttribute('style', 'margin: 20px 0 10px;');
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment