Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mobile flag to also generate mobile friendly files #50

Closed
wants to merge 58 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
20cc317
Add mobile.js and mobile.css
ZXY101 Apr 15, 2023
ed2d5f5
Add event listeners for forward and back button
ZXY101 Apr 15, 2023
04f17e5
Add mobile flag
ZXY101 Apr 15, 2023
fecfd23
Still produce the default output when mobile is set to true
ZXY101 Apr 16, 2023
26ce5c0
remove panzoom settings when mobile
ZXY101 Apr 16, 2023
864c923
Remove double page option on mobile
ZXY101 Apr 16, 2023
9903fa8
Update README
ZXY101 Apr 16, 2023
158e9e2
Update page-num styling
ZXY101 Apr 16, 2023
659a6c6
Improve swipe handling
ZXY101 Apr 22, 2023
7487116
Generate .nomedia file if mobile
ZXY101 Apr 22, 2023
adf8ade
Add background color setting
ZXY101 Apr 22, 2023
8037f0e
Reduce default swipe threshold
ZXY101 Apr 27, 2023
dd94333
Remove left & right page buttons on mobile
ZXY101 Apr 27, 2023
a3ea3bf
Allow UI toggling on mobile
ZXY101 Apr 27, 2023
c4c8c21
Add mobile about
ZXY101 Apr 27, 2023
1fbf6d2
Update README
ZXY101 Apr 27, 2023
de696b2
Update README.md
ZXY101 Apr 27, 2023
aac5a13
Update README.md
ZXY101 Apr 27, 2023
666cca1
Update README.md
ZXY101 Apr 30, 2023
4150150
Add convert_to_mobile flag to easily convert existing html files to m…
ZXY101 May 6, 2023
9fdebb8
Merge branch 'master' of github.com:ZXY101/mokuro
ZXY101 May 6, 2023
3be228b
Update README
ZXY101 May 6, 2023
f07741b
Cleanup swipe handling
ZXY101 May 21, 2023
686e545
Merge remote-tracking branch 'upstream/master'
ZXY101 May 21, 2023
7f7b606
Try and improve swiping again
ZXY101 May 27, 2023
43190c0
Add font bold menu option
ZXY101 May 27, 2023
d549786
Another attempt to improve swiping
ZXY101 May 27, 2023
517e068
Fix swipe reset
ZXY101 Jun 2, 2023
6c835e2
Add image preloading
ZXY101 Jun 4, 2023
69184af
Fix preloading
ZXY101 Jun 5, 2023
24d3690
Swipe fixes
ZXY101 Jun 5, 2023
2f85503
Fix preload image css
ZXY101 Jun 13, 2023
d6b28d5
Add preload image at generation instead of in the js
ZXY101 Jun 14, 2023
901c158
Lint files to be consistent
ZXY101 Jun 14, 2023
b5c580c
Initial implementation of anki connect integration
ZXY101 Jun 15, 2023
5c78eb5
Update run defaults
ZXY101 Jun 15, 2023
0f59a0c
Add advanced settings
ZXY101 Jun 17, 2023
829d133
Reduce code duplication
ZXY101 Jun 17, 2023
759cb88
Fix cropper styling on mobile
ZXY101 Jun 17, 2023
2124b1b
Fix? image adding on mobile
ZXY101 Jun 17, 2023
86ab192
Implement asbplayer's method to preserve sentence markup
ZXY101 Jun 17, 2023
72c46a5
Update updateLastCard to use ankiconnect android fixes
ZXY101 Jun 17, 2023
e55824c
Add anki connect settings
ZXY101 Jun 18, 2023
2074098
Show snackbar when note is updated
ZXY101 Jun 18, 2023
dbbe46b
Only update card if it was updated within 5m
ZXY101 Jun 19, 2023
a373b69
Add easier navigation for default files
ZXY101 Jun 19, 2023
1770943
Cleanup easy nav
ZXY101 Jun 19, 2023
1279b71
Cleanup sentence setting, add picture overwrite setting
ZXY101 Jun 20, 2023
122a0f3
Add additional connect buttons for no sentence case
ZXY101 Jun 20, 2023
b80b904
Additional connect button on mobile pages
ZXY101 Jun 20, 2023
4085ac9
Allow specifying how many pages to preload
ZXY101 Jun 20, 2023
72ee34c
Add another zoom default
ZXY101 Jun 20, 2023
464be85
Minor cleanup and QOL improvements
ZXY101 Jun 21, 2023
4c72204
Remove convert_to_mobile flag
ZXY101 Jun 22, 2023
81ac564
Fix inheritHtml in mobile files
ZXY101 Jun 23, 2023
afdf454
Merge pull request #1 from ZXY101/feature/anki-connect-implementation…
ZXY101 Jun 23, 2023
d43cfd1
Update README
ZXY101 Jun 24, 2023
afcba23
Update README.md
ZXY101 Jun 24, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 78 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,73 @@
> This is a fork of [mokuro](https://github.com/kha-white/mokuro) that adds various improvements and featurs to the manga viewer.

# Additions:

## Anki connect integration:

The reader now has an `Advanced settings` modal where you can specify various new settings, including enabling anki connect integration.

When anki connect integration is enabled, it will allow you to instantly add the image and sentence to your last created card. You can configure whether or not to crop the image before adding it to the card as well as various other settings

https://github.com/ZXY101/mokuro/assets/39561296/ade9e655-dcb9-4e99-9244-5df5971cc26b

## Settings importing/exporting:

You can now export your mokuro settings as a `.json` file and import them from any mokuro'd file (that was processed with this fork) to instantly carry your settings over.

This is especially handy so that you do not need to reconfigure your anki connect settings every time you start a new manga.

## Image preloading:

When reading from a server mokuro used to only fetch the image as you navigate to it, this would cause momentary flashes of nothing that would dampen the reading experience.

You can now specify how many pages you would like to preload ahead (up to 10), allowing you to read from a server without worrying about waiting for the page to load.

## `mobile` flag (Default: True):

If true, mokuro will generate additional files that are optimised to be viewed on mobile devices, the default files will still be generated.

In the mobile files:

- panzoom has been stripped out to allow the default pan/zoom behavior
- panning & zooming is limited to the page size, you can't fly off into the void
- you can now swipe to navigate (can adjust swipe threshold)
- easier to access navigation buttons have been added (can be hidden)
- easier to see page count has been added (can be hidden)

### usage:

```bash
$> mokuro my-manga-1 --mobile True --disable_confirmation True
// _ocr, my-manga-1.html, my-manga-1.mobile.html
```

`my-manga-1.html` being exactly the same as normal and `my-manga-1.mobile.html` being the mobile friendly version.

## Misc:

- You can now set the background color.
- You can now toggle bold font.
- Add new "on page turn" zoom mode (Keep zoom level but scroll to the top)
- Easier navigation for normal files (Clicking to the sides of the page will now navigate)

# Installation

```bash
$> pip install git+https://github.com/ZXY101/mokuro.git@master
```

(You may need to uninstall mokuro first)

Or use in [Google colab](https://colab.research.google.com/drive/1i2ESDMmqwjpnOQQZx3vKP8Pd8R_Gtz4W?usp=sharing)

---

### In use with [jidoujisho](https://github.com/lrorpilla/jidoujisho)

https://user-images.githubusercontent.com/39561296/234891290-dcd79ce3-e215-4c3d-8f74-98c27917ac7f.mp4

---

# mokuro

Read Japanese manga with selectable text inside a browser.
Expand All @@ -10,17 +80,19 @@ https://user-images.githubusercontent.com/22717958/164993274-3e8d1650-9be3-457d-

mokuro is aimed towards Japanese learners, who want to read manga in Japanese with a pop-up dictionary like [Yomichan](https://github.com/FooSoft/yomichan).
It works like this:

1. Perform text detection and OCR for each page.
3. After processing a whole volume, generate a HTML file, which you can open in a browser.
4. All processing is done offline (before reading). You can transfer the resulting HTML file together with manga images to
another device (e.g. your mobile phone) and read there.
2. After processing a whole volume, generate a HTML file, which you can open in a browser.
3. All processing is done offline (before reading). You can transfer the resulting HTML file together with manga images to
another device (e.g. your mobile phone) and read there.

mokuro uses [comic-text-detector](https://github.com/dmMaze/comic-text-detector) for text detection
and [manga-ocr](https://github.com/kha-white/manga-ocr) for OCR.

Try running on your manga in Colab: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/kha-white/mokuro/blob/master/notebooks/mokuro_demo.ipynb)

See also:

- [Mokuro2Pdf](https://github.com/Kartoffel0/Mokuro2Pdf), cli Ruby script to generate pdf files with selectable text from Mokuro's html overlay
- [Xelieu's guide](https://rentry.co/lazyXel), a comprehensive guide on setting up a reading and mining workflow with manga-ocr/mokuro (and many other useful tips)

Expand Down Expand Up @@ -68,6 +140,7 @@ For each volume, a separate HTML file will be generated.
## Run on a directory containing multiple volumes

If your directory structure looks somewhat like this:

```
manga_title/
├─vol1/
Expand All @@ -88,9 +161,11 @@ mokuro --parent_dir manga_title/
--force_cpu - disable GPU
--as_one_file - generate separate css and js files instead of embedding everything in html
--disable_confirmation - run without asking for confirmation
--mobile - also generate a mobile optimised html file
```

# Contact

For any inquiries, please feel free to contact me at kha-white@mail.com

# Acknowledgments
Expand Down
9 changes: 9 additions & 0 deletions mokuro/assets/cropper.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions mokuro/assets/cropper.min.js

Large diffs are not rendered by default.

Loading