Skip to content

Commit

Permalink
Add docs for Chromium variant and update metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
shivaprsd committed Feb 23, 2023
1 parent 31b8e2f commit e33cf83
Show file tree
Hide file tree
Showing 12 changed files with 65 additions and 25 deletions.
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 Shiva Prasad
Copyright (c) 2022-2023 Shiva Prasad

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
61 changes: 49 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

*doqment* (pronounced as *doc-HUE-ment*) is a custom deployment of the
[PDF.js][1] generic viewer with [*doq*][2] reader mode add-on (that lets you
change the PDF's colors) on top, packaged as an extension for Firefox. It
replaces the built-in PDF.js viewer as the default PDF viewer application.
change the PDF's colors) on top, packaged as a Web Extension.

It also adds some other features like Smart Zoom text and Show/Hide toolbar to
optimize space and assist reading, especially on smaller devices.
Expand All @@ -18,43 +17,80 @@ View [more screenshots](docs/gallery.md#themes).

## Installation

[ ![Get the Add-on](docs/get-addon.png) ][4]
[ ![Get for Firefox](docs/amo-badge.png) ][4]  
[ ![Get for Chrome](docs/cws-badge.png) ][6]

Latest release can be installed from [AMO][4] or downloaded from [Releases][5].
Latest release can be installed from [AMO][4] / [CWS][6], or downloaded from
[Releases][5].

In Firefox, *doqment* replaces the built-in PDF.js viewer as the default PDF
viewer application. In Chrome(ium), it co-exists with the native viewer, and
provides a context menu and toolbar button to open PDFs in it instead.

#### Note for Firefox users:

It is recommended to disable the built-in viewer while this extension is
enabled to avoid funny and weird behaviours while opening/downloading PDFs.
(Go to *Settings* -> *Files and Applications* -> set the *Action* for PDF to
something other than *Open in Firefox*).

## Development and testing
## Development

**Note:** In Firefox, *doqment* uses Manifest Version 2, while in Chromiums it
uses MV3.

1. Clone this repo recursively (to get the submodules)
2. Hack to your heart's content
3. Run the `pack.sh` script from the repo root
4. Install the created Zip file from `about:debugging` (or using `web-ext`)
2. Update the symlink to the correct manifest file:
```
$ cd src
$ ln -sf manifest-v2.json manifest.json # for Firefox (default)
$ ln -sf manifest-v3.json manifest.json # for Chrome, Edge, etc
```
3. Install unpacked via `about:debugging` / `chrome:extensions` (or using
`web-ext`)
4. Hack to your heart's content and submit a PR!

#### Packaging

Run the `pack.sh` script **from the repo root**:
```
$ ./pack.sh [mv2|mv3] # default is mv2
```

## Limitations

### Firefox

Compared with the viewer baked right into Firefox's code, an extension is a lot
less previleged and hence, has certain limitations:

1. Cannot load local files via the `file:///` scheme. The user has to first
open the extension's viewer in a tab and use the viewer's UI to open them.
1. Cannot load local files via the `file:` URL scheme. The user has to first
open the extension's viewer in a tab and use the viewer's UI to open them
(hence a browser toolbar button is provided for this).
2. Cannot use the integrated Findbar to search for text in PDF.
3. The address bar shows an ugly extension URL instead of the original PDF URL.
3. The address bar shows an ugly extension URL instead of the original PDF URL
(hence a popup is provided to quickly show the later).

### Chromium

1. Can open `file:` URLs, only if the user grants access in the extension's
settings.
2. Redirecting links cannot be opened via the context menu; users will have to
first open it in the native viewer, and then use the toolbar button.

## Rationale

As the built-in viewer of Firefox is a previleged page, extensions cannot
modify it. Thus a custom deployment is currently the only way to ship add-ons
to the viewer (other than getting your patch merged into PDF.js).

On the plus side, this also enables users of other browsers to have PDF.js and
*doq*.

This project can also be used as a boilerplate by anyone else wishing to
develop their own awesome crazy add-on for the PDF.js viewer.

For the rationale behind reader mode see the *doq* [Readme][3].
For the rationale behind reader mode see the [*doq* Readme][3].

Happy PDF Reading!

Expand All @@ -65,3 +101,4 @@ Happy PDF Reading!
[3]: https://github.com/shivaprsd/doq#why-doq
[4]: https://addons.mozilla.org/addon/doqment
[5]: https://github.com/shivaprsd/doqment/releases/latest
[6]: https://chrome.google.com/webstore/detail/ajmcpdllaaklaocodbnllhkaflncmlog
File renamed without changes
Binary file added docs/cws-badge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 10 additions & 7 deletions docs/gallery.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,25 @@

## Interface

### Firefox Toolbar Button
### Toolbar Button

![Firefox window showing toolbar button](grabs/toolbar-button.png)

### Reader Mode Toolbar

![Screenshot of the reader mode toolbar](grabs/reader-toolbar.png)

### Smart Zoom with Hidden Toolbar
### Original Link Popup

![PDF in sepia theme, with hidden toolbar and zoomed column of text](grabs/smart-zoom.png)
_Also showing Original Link popup button._
![Firefox window with a popup showing the original PDF URL](grabs/url-popup.png)
_Also showing smart-zoomed text and hidden toolbar._

### Smart Zoom on Mobile
### Chromium Context Menu
![Chromium window showing the context menu on a link to a PDF](grabs/chrome/context-menu.png)

![PDF in dark theme, in a narrow mobile screen, demoing smart zoom](grabs/smart-zoom-mobile.gif)
### Smart Zoom

![Animation of PDF in dark theme, in a narrow mobile screen, demoing smart zoom](grabs/smart-zoom-mobile.gif)

## Themes

Expand All @@ -35,7 +38,7 @@ _Also showing Original Link popup button._

### Safari Reader View

![PDF rendered in Safari gray theme](grabs/safari-gray.png)
![PDF rendered in Safari gray theme](grabs/chrome/sicp-gray.png)

### Invert (Night mode)

Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
2 changes: 1 addition & 1 deletion pack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if [ "$variant" != mv2 ] && [ "$variant" != mv3 ]; then
echo "Unknown target: $variant"
exit
fi
ln -srf "src/manifest-${variant#?}.json" src/manifest.json
ln -sf "manifest-${variant#?}.json" src/manifest.json

version=$(awk -F: '/"version"/ {print $2}' src/manifest.json | tr -d ' ,"')
target=../dist/doqment-v$version-$variant.zip
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "doqment",
"version": "0.3",
"version": "0.4",
"description": "Mozilla's HTML5 PDF Viewer with Reader-mode add-on.",
"homepage": "https://github.com/shivaprsd/doqment",
"repository": "github:shivaprsd/doqment",
"keywords": [ "doq", "pdf.js", "browser extension", "firefox" ],
"keywords": [ "doq", "pdf.js", "browser extension", "firefox", "chromium" ],
"license": "MIT",
"author": "Shiva Prasad <shivapv@pm.me>",
"contributors": [],
Expand Down
2 changes: 1 addition & 1 deletion src/manifest-v2.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"manifest_version": 2,
"version": "0.3",
"version": "0.4",

"name": "doqment PDF Reader",
"short_name": "doqment",
Expand Down
2 changes: 1 addition & 1 deletion src/manifest-v3.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"manifest_version": 3,
"version": "0.3",
"version": "0.4",
"minimum_chrome_version": "102",

"name": "doqment PDF Reader",
Expand Down

0 comments on commit e33cf83

Please sign in to comment.