Last active
February 2, 2025 23:14
-
-
Save ashtonmeuser/b941181ffb8f8ceee08859f9ea9cc908 to your computer and use it in GitHub Desktop.
Reader view using Mozilla's readability
This file contains 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
// bookmarklet-title: Reader | |
// bookmarklet-about: Mozilla's readability (https://github.com/mozilla/readability) piped into a modal. | |
import Modal from '/ashtonmeuser/0613e3aeff5a4692d8c148d7fcd02f34/raw/d6dd01eaab665a14bded5487a8c03b6bb7197388/Modal.ts'; | |
import { Readability } from 'https://esm.sh/@mozilla/readability'; | |
const id = ''; // bookmarklet-var(uuid): id | |
const reader = new Readability(document.cloneNode(true)).parse(); | |
const content = `<h1>${reader.title}</h1>${reader.content}`; | |
const modal = new Modal(id, { | |
content, | |
style: 'img{display:block;margin:0 auto;max-width:100%;height:auto;}figcaption{font-size:0.8em;}', | |
}); | |
modal.dialogElement.focus(); // Remove focus from first element |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment