Commit Graph
259 Commits
Author SHA1 Message Date
John Factotum 63a5dbf3e3 Don't scroll to anchor if caret's moved by pointer
In Safari, clicking on links triggers `selectionchange`. Since we do not
move the caret when flipping through pages, when you have flipped to the
next or previous pages and click on any link, it would take you back to
the caret instead of activating the link.

Note that the bug occurs in Safari 17 but not in WebKitGTK 2.46.

Not sure if there's a way to fix this and still retain the "set anchor
to caret on click" behavior. But I guess this behavior isn't really that
essential, anyway. So removing it for now.

Fixes #44
2024-12-12 09:35:33 +08:00
John Factotum cc2882ff39 Update README.md
Reflect the changes after 022ea7da87, and
other clarifications.
2024-12-02 18:39:45 +08:00
John Factotum 2e30f3db35 Footnotes: improve superscript detection 2024-12-02 17:57:01 +08:00
John Factotum 6f8eb1b85b Fix missing trailing comma 2024-12-02 09:54:55 +08:00
John Factotum 936c4f78e5 FB2: fix tables
Fixes https://github.com/johnfactotum/foliate/issues/1445
2024-12-02 09:47:58 +08:00
John Factotum b5ae4c22c1 CBZ: remove body margin
Fixes https://github.com/johnfactotum/foliate/issues/1421
2024-11-04 05:37:40 +08:00
John Factotum 24187b79f9 EPUB: fix opf:file-as
Fixes #39
2024-11-03 11:19:14 +08:00
John Factotum 519c0329b2 PDF: improve metadata 2024-10-18 13:42:49 +08:00
Huang Xin f24e611c4e Lazy loading of PDF documents (#37) (#38) 2024-10-18 04:05:31 +00:00
John Factotum 022ea7da87 Make <foliate-view> handle opening files directly 2024-10-12 10:48:51 +08:00
John Factotum 76c15569db Fix linguist-vendored attribute 2024-10-12 07:55:17 +08:00
John Factotum ae61c5e85f Make zip.js, fflate, and PDF.js dev dependencies
Previously, zip.js and fflate were built from the main Foliate repo.
And PDF.js files were copied manually. Now they all build here.

Unfortunately, two CSS files still need to be copied manually.
2024-10-12 07:44:33 +08:00
John Factotum b82ec0b294 FXL: add zoom setting
The value of the `zoom` attribute can be either `"fit-page"` (default),
`"fit-width"`, or a number.
2024-10-11 06:41:32 +08:00
John Factotum 7cbc36b489 Media Overlay: fix skipping
- Fix not seeking when skipping to another section when paused
- Fix not playing when skipping when not paused in WebKit
2024-10-07 11:00:57 +08:00
John Factotum fa85f135df EPUB: fix metadata 2024-10-06 11:29:32 +08:00
John Factotum 2e8b4fab0d OPDS: improve metadata 2024-10-06 10:16:46 +08:00
John Factotum e384aaf6dd Media Overlay: add stop() method
And don't remove highlight when pausing
2024-09-30 19:31:14 +08:00
John Factotum bf9adef636 Paginator: react to selection only on input 2024-09-30 19:00:11 +08:00
John Factotum 916dfb13ac View: don't destroy book on close
The book object is not created by the view class so it has no business
destroying it.

Fix bug caused by 1e952102bd where closing
the footnote view destroys the book, when it should not be destroyed,
being still displayed by another view
2024-09-30 18:50:07 +08:00
John Factotum 4cd2ca2eb3 PDF: fix comment 2024-09-28 19:32:14 +08:00
John Factotum 3409674e66 PDF: set isEvalSupported to false
`eval()` would be blocked by CSP and thus not supported
2024-09-28 19:17:12 +08:00
John Factotum 45d67a0db3 PDF: add CMaps and fonts 2024-09-28 17:41:38 +08:00
John Factotum be76724699 PDF: fix text selection 2024-09-28 17:38:59 +08:00
John Factotum ffb4f7b74e Create FUNDING.yml 2024-09-28 06:39:01 +00:00
John Factotum 693341f008 PDF: fix links 2024-09-28 14:29:47 +08:00
John Factotum 1e952102bd PDF: rerender when scale changes
The fixed-layout renderer now accepts an object for the return value of
`load()` (on the `book.sections` items). If it's an object, the `src`
is the URL of the section, and `onZoom`, if present, will be called
when the viewport is zoomed. With this you can scale the page yourself
rather than relying on the renderer's own scaling with CSS transform.

Also upgraded to PDF.js 4.6.82. And now internal links are broken...
Don't know how to fix that yet.
2024-09-28 12:12:59 +08:00
John Factotum ba403301a2 View: add ability to automatically hide cursor
Controlled by the boolean attribute `autohide-cursor`
2024-09-27 10:24:45 +08:00
John Factotum f3afcabd96 Media Overlay: support playback-active-class 2024-09-26 13:23:40 +08:00
John Factotum 357c129b5d Media Overlay: don't seek in canplaythrough
So this is what was causing the `canplaythrough` loop in Chromium and
Firefox.
2024-09-26 12:56:09 +08:00
John Factotum 22189f184e EPUB: fix media overlay playback
For some reason `canplaythrough` is firing more than once
2024-09-26 12:37:06 +08:00
John Factotum e94b85ce09 FB2: don't throw when image has no xlink:href
Fixes #35
2024-09-25 23:15:02 +08:00
John Factotum dcd4ff403e Paginator: fix scrolling to collapsed ranges that contain elements 2024-09-25 22:41:20 +08:00
John Factotum 02a24ea25c Grammar 2024-09-25 22:33:02 +08:00
John Factotum 59a5aa22a0 Paginator: respond to selection change
The view follows caret when using caret browsing (F7). Also allows
selecting across pages. And if you click on or select some text and
resize the window, the caret/selection always stays visible.

Some quirks regarding caret browsing:
- In Chromium, in paginated mode, it scrolls when changing selection
  (https://issues.chromium.org/issues/40889650)
- In WebKitGTK, in scrolled mode, the view doesn't follow the caret
  (which would be a WebKit bug)
2024-09-24 11:54:47 +08:00
John Factotum 329e22227a Paginator: fix offset
What's `margin` doing here?! It's like this since the first commit, but
it makes no sense... I think I added it incorrectly, being misled by
the getBoundingClientRect bug in Firefox...
2024-09-24 11:36:43 +08:00
John Factotum 59bb647057 Paginator: fix visible range in Firefox 2024-09-24 11:34:57 +08:00
John Factotum 4ef87c2ca7 Paginator: fix caret position when navigating
The effect of this is more obvious if you enable caret browsing (F7 in
all browsers). Previously, if you go to a fragment, the caret isn't
moved. Now it works as expected.
2024-09-23 20:33:46 +08:00
John Factotum b8a0d11910 Paginator: fix changing background in Chromium 2024-09-23 16:48:11 +08:00
Kian-Meng Ang 42ebb0aec4 Fix typos (#34)
Found via `typos --hidden --format brief`
2024-09-23 08:29:28 +00:00
John Factotum 541bc07b6f EPUB: redo metadata parsing
- Support the `prefix` attribute (for the `property` attr on `<meta>`)
- Localized titles, names (including `sortAs`)
- `belongsTo`, including `calibre:series`
- `altIdentifier`, converted to URN where possible
- Remove `producer`. It's now `contributor` with `role: 'bkp'`.

NOTE: this is a breaking change if you assumed that `title` will always
be a string, `author` will always be an array, etc.
2024-09-18 11:28:08 +08:00
John Factotum e6937eed15 Paginator: fix focus lost when loading new section
Also add method for setting focus on the content window
2024-09-15 13:13:44 +08:00
John Factotum c17b542b5c Paginator: needn't fix tabbing in scrolled mode 2024-09-14 23:18:27 +08:00
John Factotum 3b96ddf3e6 Paginator: fix scroll offset when tabbing 2024-09-14 23:14:04 +08:00
John Factotum b5d0453004 FXL: ignore linear & default to odd pages right
This matches the behavior of other reading systems. See
https://github.com/johnfactotum/foliate/issues/1318#issuecomment-2349375230
2024-09-14 01:21:54 +08:00
John Factotum 327031aca1 Paginator: add scroll event
Unlike `relocate`, which is debounced, a scroll event is useful when you
want to do stuff as soon as it scrolls.
2024-09-12 05:30:58 +08:00
John Factotum 3658b19a86 Quote Image: fix overflow
Note: simply setting `display: none` works in Firefox, but not in WebKit
Chromium.
2024-09-12 05:25:42 +08:00
John Factotum 0b9fac8ff3 Add module for generating quote images 2024-09-11 14:12:27 +08:00
John Factotum ffceb8a4aa Reader: update vendored libraries
Note: these are built from running `npm run build` from the main repo
https://github.com/johnfactotum/foliate
2024-09-11 13:50:39 +08:00
John Factotum 9ff893f3e7 Treat XHTML without xmlns as HTML
The XHTML 1.1 spec says

    The start tag of the root element of the document MUST explicitly
    contain an xmlns declaration for the XHTML namespace

There doesn't seem to be such a requirement in the WHATWG spec. But at
any rate browsers won't render it properly without the XHTML namespace.
2024-07-27 09:46:04 +08:00
Balki 835b70a840 Reader: allow book urls to be relative (#29) 2024-07-26 14:00:54 +00:00