John Factotum
a0acc506c5
Fix footer/header layout
...
Fix regression from 2bcff70450
2023-05-14 23:24:44 +08:00
John Factotum
17fb71943f
Scrolled mode: leave space for top margin when scrolling to position
2023-05-14 22:11:46 +08:00
John Factotum
a41e4b897c
Fix header/footer direction
2023-05-14 13:43:31 +08:00
John Factotum
2bcff70450
Improve layout for vertical writing
...
- Make horizontal padding grow with `gap`
- Make `maxColumnWidth` limit inline width, not horizontal width
2023-05-14 13:02:18 +08:00
John Factotum
20254e30aa
Scroll to anchor when body size changes
...
Also: remove unused private method
2023-05-13 13:22:48 +08:00
John Factotum
1396bd2b89
Yield when search finishes
...
This allows distinguishing between finished and aborted (with `Generator
.prototype.return`) search
2023-05-13 07:18:22 +08:00
John Factotum
5da3be5200
Add destroy method
...
Which revokes all blob URLs and removes the element from document.
2023-05-09 14:02:07 +08:00
John Factotum
a817932b08
Update README.md
2023-05-03 17:33:37 +08:00
John Factotum
41c00942d2
Further reduce header and footer styles
...
Instead, provide classes.
Also: prefix all classes with `foliate-`.
2023-05-03 17:31:22 +08:00
John Factotum
9e4ef02fa8
Rename uri to href
2023-05-03 17:22:55 +08:00
John Factotum
902cd9ad46
Really fix ResizeObserver loop
2023-05-02 19:08:58 +08:00
John Factotum
604a8caf3b
Fix ResizeObserver loop in some situations
...
This is caused by 7486360390 .
Not sure why it happens, and it only occurs in WebKit. Truncating the
padding seems to be the fix.
2023-05-02 01:35:43 +08:00
John Factotum
faaa2f47d4
Reader: update gap to relative
...
Also: use maxColumns
2023-05-01 23:15:58 +08:00
John Factotum
7486360390
Make margin relative to page width
2023-05-01 23:04:53 +08:00
John Factotum
9068d70acc
FB2 improvements
...
- Set title text-align more specifically on h1
- Don't throw when there's no cover
2023-05-01 22:55:59 +08:00
John Factotum
d951497c30
Fix not being able to jump to the very end of the book
2023-04-29 01:39:22 +08:00
John Factotum
649ffa93b8
EPUB: add support for subtitle
2023-04-26 17:31:59 +08:00
John Factotum
8a69caf1dd
Fix CFI for fixed-layout books
2023-04-26 17:27:51 +08:00
John Factotum
b1346280fd
Make range available when reporting current location
2023-04-26 17:26:13 +08:00
John Factotum
abf95a4e9a
Fix text direction info
...
The spec changed and has been implemented in WebKit:
https://bugs.webkit.org/show_bug.cgi?id=252444
But not in Chromium yet:
https://crbug.com/v8/13835
2023-04-23 14:00:17 +08:00
John Factotum
df9822201f
Fix misaligned columns in some situations
2023-04-08 21:23:45 +08:00
John Factotum
06417f763e
Fix misaligned columns at certain fractional widths
...
Fixes #2
2023-04-02 17:13:29 +08:00
John Factotum
182ab10182
Remove getPosition()
...
The original idea of including this function in `./view.js` seems to be
that it's shared between the demo reader and Foliate. But
- It's currently not used in the demo reader any more.
- It works, but it lacks features.
- In any case it's not coupled with anything else in `./view.js`, so at
best it should be a separate module.
Also: remove unused variable and fix indentation
2023-04-02 00:32:33 +08:00
John Factotum
c173f5b523
Paginator: allow injecting CSS *before* the book's stylesheet
...
Before this commit: `setStyle()` takes a single string argument, which
is the stylesheet it will append to head.
After this commit: it optionally accepts two stylesheet strings in an
array, the first of which will be prepended, allowing the reading system
to set default styles that can be overridden by the book.
2023-04-01 23:33:10 +08:00
John Factotum
34973ac032
Update README.md
2023-03-30 17:23:20 +08:00
John Factotum
bc1f799c44
FXL: sandbox the iframes
2023-03-30 16:21:28 +08:00
John Factotum
7d721611fa
Improve handling of links
...
- Remove special handling of footnotes
- Open all links by default
- Reader can return `true` to prevent default action
- Expose link handling as a method, which the reader can use to set up
links outside renderers (e.g. in popup footnotes)
2023-03-28 16:01:51 +08:00
John Factotum
6f29a12426
Reduce header/footer styling in paginator
...
Leave the alignment, font, and color to the reader
2023-03-28 04:52:03 +08:00
John Factotum
5a0c4801cf
Revert "Set header/footer text color from book stylesheet"
...
This reverts commit db5fc0f679 .
Reverting for now as it's incomplete and more broken than before.
A full implementation of this would require watching for `matchMedia()`
changes and getting the computed style again. It needs to either get the
list of media queries from the stylesheet, or just assume color scheme
related media queries.
2023-03-27 03:00:32 +08:00
John Factotum
ca8846b256
Fix scrolled layout when using * { box-sizing: border-box }
2023-03-27 00:32:41 +08:00
John Factotum
db5fc0f679
Set header/footer text color from book stylesheet
2023-03-27 00:30:46 +08:00
John Factotum
6d2caaad5b
FXL: fix container, which should not span whole viewport
2023-03-26 03:58:04 +08:00
John Factotum
42a410571c
Add non-collator/segmenter-based search
2023-03-26 03:53:56 +08:00
John Factotum
45bfe6ee71
Fix whitespace normalization
...
- Normalize ASCII whitespace only
- Collapse sequence of *one* or more consecutive whitespace characters
2023-03-21 12:03:39 +08:00
John Factotum
9949000a9e
Use ES modules for zip.js and fflate
2023-03-20 23:49:33 +08:00
John Factotum
ef5ca72ba6
Fix scrolling to fractions
2023-03-20 15:52:19 +08:00
John Factotum
1511884137
Fix scrolling to range following auto hyphen in different column
2023-03-20 00:33:15 +08:00
John Factotum
c510d83ea2
Use special scheme https when resolving URLs
...
Fixes #8
2023-03-19 04:29:37 +00:00
John Factotum
48d6972525
Add strikethrough
2023-03-15 13:20:30 +08:00
John Factotum
c85aeafe99
Documentation: more detailed overview
2023-03-15 04:36:43 +00:00
John Factotum
514cb81fe6
Reader: allow loading files from URL parameter
...
Fixes #3
2023-03-15 11:00:21 +08:00
John Factotum
c7a4f5ef46
Add squiggly line option for annotations
2023-03-15 00:39:15 +08:00
John Factotum
59971fe343
Fix underline in vertical writing mode
...
Or rather, add the option to fix it. The actual fix is in the reader.
2023-03-14 11:20:21 +08:00
John Factotum
f9ce32b913
Let reader handle storing annotations
...
The view will only:
1. Send a signal to the reader when overlays are created
2. Allow the reader to add or remove annotations for active overlays
only; if the annotations won't be on an overlay, it does nothing
3. It returns the index and label, which helps the reader stores
the annotations.
2023-03-13 22:52:10 +08:00
John Factotum
8ea46671fe
Add method to get a flat array of annotation objects
2023-03-11 22:04:53 +08:00
John Factotum
17ba85b0e5
Typo
2023-03-11 22:04:42 +08:00
John Factotum
99624d013a
Improve invertibility
...
- Don't use multiply
- Set background on separate div
2023-03-10 22:25:17 +08:00
John Factotum
2c452719d0
Paginator: add option for maximum number of columns
...
Also: allow it to be positioned relative to the parent
2023-03-09 23:36:20 +08:00
John Factotum
25909f41a1
Make locations 10x bigger
...
Supposedly Kindle uses 150 bytes. Source:
https://www.mobileread.com/forums/showpost.php?s=6fbd6367bde3031320a271b6e3208445&p=1858934&postcount=3
However, since the way locations are calculated here is not exact
anyway, it seems more useful to use a smaller number that's more in line
with (1) the size of an actual page and (2) Foliate's old location size.
2023-03-09 09:14:46 +00:00
John Factotum
857a94daf3
Add header and footer
...
Also allow getting next location, which is useful for the footer
2023-03-09 16:20:28 +08:00
John Factotum
2c1919c099
Account for scale when getting rect in frame
...
Fixes positions for the fix layout renderer
2023-03-08 13:17:03 +00:00
John Factotum
b6acb4ff5c
FXL: fix onLoad callback
...
Also add deselect method.
2023-03-08 11:40:18 +00:00
John Factotum
1fef33731f
Add methods for clearing selections
2023-03-08 11:02:17 +00:00
John Factotum
ac4e3962df
Add method for getting TOC item for any location
2023-03-07 06:46:28 +00:00
John Factotum
f5bf41def6
CFI: export collapse function
2023-03-07 06:44:36 +00:00
John Factotum
15aa43bd42
Warn about parsing error
...
Falling back to HTML is good, but probably don't do it silently.
2023-03-05 11:39:47 +00:00
John Factotum
dee64c19bb
Fix glyph clipping in WebKit
...
See https://github.com/johnfactotum/foliate/issues/177
2023-02-21 08:08:15 +00:00
John Factotum
b8049952bf
Fix page breaks
...
Replace `page-break-*` with `-webkit-column-break-*`.
See https://github.com/johnfactotum/foliate/issues/962#issuecomment-1437982082
2023-02-21 07:51:34 +00:00
John Factotum
07a8b76d3a
Fixes for non-1:1 zoom levels
...
Hopefully fixes #2
2022-12-25 01:49:20 +00:00
John Factotum
7e5d21ffbe
Fix typo
2022-11-16 10:25:14 +08:00
John Factotum
d76027c00a
FB2: fix handling of non-element nodes
2022-11-10 13:59:23 +00:00
John Factotum
b6f514675b
Reader: open external links
2022-11-04 14:40:44 +00:00
John Factotum
c32e1c8cf1
Create .gitattributes
2022-11-04 14:19:37 +00:00
John Factotum
2b51522c43
Add .eslintrc.json
...
And fix issues
2022-11-04 14:12:07 +00:00
John Factotum
a9805d3e63
EPUB: preliminary work on Media Overlays
2022-11-04 11:47:27 +00:00
John Factotum
b1ac5a943f
Reader: expose the reader object globally
...
Makes it easier for debugging or exploring the API in the console
2022-11-04 11:00:18 +00:00
John Factotum
6b553eb89c
Fix method definition
2022-11-04 10:49:22 +00:00
John Factotum
bc22699bab
EPUB: add a method for getting Calibre bookmarks
...
See https://github.com/johnfactotum/foliate/issues/849
2022-11-04 10:43:30 +00:00
John Factotum
a11fd9637d
FXL: support spread both and portrait
...
Also fix `page-spread-center` in portrait
2022-10-29 16:45:17 +00:00
John Factotum
3aad499696
FXL: page-spread-center and spread none
2022-10-29 16:10:56 +00:00
John Factotum
602c8381c2
Add support for <object>
...
It's sometimes used for SVGs
2022-10-27 18:11:21 +00:00
John Factotum
2a5ccb93d9
Reader: allow opening unzipped EPUBs
2022-10-27 17:41:26 +00:00
John Factotum
60bebc39b4
Remove useless variable
2022-10-27 09:30:47 +00:00
John Factotum
967a00f5b8
Make paginator more self-contained
...
Don't rely on absolute positioning and margin. And set background on
the containing element rather than the document body.
2022-10-27 09:05:29 +00:00
John Factotum
88ac253f30
FB2: fix encoding on Firefox
2022-10-26 08:32:24 +00:00
John Factotum
af0050aba7
MOBI: fix duplicated anchors
2022-10-26 06:07:15 +00:00
John Factotum
750458d4b7
Reader: avoid overriding the align attribute
2022-10-26 04:24:32 +00:00
John Factotum
f2f41e6013
Reader: add unprefixed hyphens
2022-10-25 08:47:52 +00:00
John Factotum
6977ac005d
Get rect in reader instead of view
...
Also expose index in `loaded` event
2022-10-25 05:55:57 +00:00
John Factotum
d63905346c
Add annotations
...
Simplify overlayer API; allow one overlayer only.
2022-10-24 13:11:51 +00:00
John Factotum
37ccb74238
Replace viewport units in CSS
...
In theory it could do something much more complicated. But it seems
better to just say "vh and vw are not supported", and this would just
be failing more gracefully.
I mean, the spec itself says,
> Keep in mind that some Reading Systems will not support all desired
> features of CSS. In particular, the following are known to be
> problematic [...] Pagination is sometimes done using columns, which
> can result in incorrect values for viewport sizes.
Fixes #1
2022-10-22 21:50:47 +00:00
John Factotum
21bf6499a4
Reader: add progress slider
2022-10-22 18:29:52 +00:00
John Factotum
c3598e3c38
Update README.md
2022-10-22 14:17:14 +00:00
John Factotum
5103dc9b90
View: make it possible to do things on load
...
Also refactor reader, and add left/right shortcuts
2022-10-22 12:42:35 +00:00
John Factotum
4def05e741
Reader: fix popover arrow when space is limited
...
Also make the arrow aria-hidden
2022-10-22 10:14:13 +00:00
John Factotum
bf9a2699e0
Update README.md
2022-10-21 23:33:56 +00:00
John Factotum
3c05d0a957
Reader: add footnote popovers
...
Lacks a "go to" button, but at least shows something instead of nothing
2022-10-21 18:57:26 +00:00
John Factotum
e74ad4311f
FXL: fix overflowing
...
Which for some reason only happens in Firefox
2022-10-21 10:39:55 +00:00
John Factotum
9250f47058
EPUB: set content type for cover blob
...
Although the type can often be auto-detected, it's better to set it
explicitly, especially for SVGs.
2022-10-21 10:20:23 +00:00
John Factotum
f39d74f932
Reader: add layout option
2022-10-21 09:53:00 +00:00
John Factotum
fea239a111
Reader: show cover, title, and author in sidebar
2022-10-20 18:16:44 +00:00
John Factotum
6348ca4a9d
EPUB: fixed unload func not added to section
...
Missed it for some reason
2022-10-20 17:00:00 +00:00
John Factotum
759a3b31a7
Fix vertical writing for Firefox
2022-10-20 15:30:49 +00:00
John Factotum
84691787fa
Reader: add title and file chooser button
2022-10-20 14:28:42 +00:00
John Factotum
9a2bb558fd
Reader: add sidebar and TOC
2022-10-20 12:50:37 +00:00
John Factotum
cf9d4cb8a5
Update README.md
2022-10-20 09:32:00 +00:00
John Factotum
2dc424de29
Update README.md
2022-10-19 20:13:03 +00:00
John Factotum
3ac917c706
Add tests for EPUB CFI
2022-10-19 17:03:49 +00:00
John Factotum
8ca6bd5f29
Update README.md
2022-10-19 12:19:51 +00:00
John Factotum
d0cd085a22
Add sample reader
2022-10-19 11:04:43 +00:00