Created
August 8, 2025 10:24
-
-
Save ldenoue/d97703e59578e0c31023594370c25301 to your computer and use it in GitHub Desktop.
Printable Gemini Storybook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const title = document.querySelector('.cover-title').textContent | |
| const w = window.open('','_blank') | |
| const doc = w.document | |
| doc.open() | |
| doc.title = title | |
| const body = doc.createElement('body') | |
| doc.appendChild(body) | |
| const divStyle = 'padding: 16pt; box-sizing: border-box; font: 22pt serif' | |
| const div = doc.createElement('div') | |
| div.style = divStyle | |
| body.appendChild(div) | |
| const style = 'margin: auto; max-width: 80%; display: block; padding: 16pt;' | |
| const h2 = doc.createElement('h2') | |
| h2.style = style + ';text-align:center' | |
| h2.textContent = title | |
| div.appendChild(h2) | |
| let pages = document.querySelectorAll('.page:not([class*="cover"])') | |
| if (pages.length < 10) | |
| pages = document.querySelectorAll('.storybook .spread-container') | |
| for (const p of pages) { | |
| const src = p.querySelector('img')?.src | |
| const text = p.querySelector('p')?.textContent | |
| if (src) { | |
| const img = doc.createElement('img') | |
| img.src = src | |
| img.style = style | |
| div.appendChild(img) | |
| } | |
| if (text) { | |
| const p = doc.createElement('p') | |
| p.style = style | |
| p.textContent = text | |
| div.appendChild(p) | |
| } | |
| } | |
| doc.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment