Comments (7)
Works amazingly, nice. I don't have a clue how to navigate git to get dev branch updates, so I just kept sticking files together until it compiled the Chrome extension, and it worked at last.
from doqment.
@Adr0it Thanks for stopping by! Can you explain how automatically opening offline PDFs would help your bookmarking extension? I am not able to see any connection there. 😕
Can you also show me how you are injecting your content script? My main concerns here are permissions and consistency. We would need wide host permissions to run content scripts in all file://
urls, and auto-opening only offline PDFs creates different behaviours for offline v/s online.
In Firefox doqment auto-opens all URLs. This is because there the intent is to replace the default viewer (as doqment is only a modified version of it). In Chrome the design is different both due to technical limitations of MV3 and for letting users use doqment as a second PDF viewer without invading their privacy.
from doqment.
The feature of automatically opening offline PDFs is just convenient in my opinion. It doesn't have anything to do with my extension.
Here is what I did. Just put pdf file in manifest (you can also add https:///.pdf for online sources) for when the content script runs. The content script then sends really any random message to the service worker, and the service worker simply opens the viewer and closes current tab (which has default pdf viewer). Not really the best solution, but it's convenient.
from doqment.
Thanks, I got your intent now. I guess this could be done a bit more neatly with Declarative Net Requests redirect rule, or even chrome.tabs.update()
instead of opening a new tab.
The problem with this is that we are relying on the .pdf
extension to detect PDFs, which may not always be the case. This is why currently we check document.contentType
(Chrome) or MIME type in response headers (Firefox). This is something that neither match patterns nor DNR rules can currently handle.
Even if we find a way, this will inevitably need a permission escalation, that can result in the extension being temporarily blocked on the Chrome Web Store, pending a manual review. Yet I understand the desire for convenience, so let me edit the title to better reflect the general case. This has to be implemented thoughtfully.
from doqment.
I figured out a way to do this with dynamic content scripts so that the permissions can remain optional. Now on dev branch: 85f740e.
@Adr0it It is loosely based on your idea, so thank you! Can you please try it out and get back? Just right click on the extension action and switch it on via the menus (first the "Always allow..." menu followed by the other).
from doqment.
@Adr0it Thanks! Can you give your feedback on the interface, i.e. having to go through two menus to enable it? I did it that way to make the code cleaner, and enabling it requires enabling the first menu anyway. Did you find it cumbersome? Would you find it confusing if I had not told you exactly what to do?
P.S.
For your future reference, you can check out the dev branch like this in git:
$ git clone https://github.com/shivaprsd/doqment.git
$ cd doqment
$ git checkout dev
Or, if you don't use command line, you can first select dev
in branches on the GitHub website interface and go to <> Code
➡️
Download Zip
to get the dev branch files.
from doqment.
Fixed in v0.6.
from doqment.
Related Issues (12)
- Add support for annotation HOT 4
- Need to set PDF.js preferences HOT 15
- Port to Chrome browser HOT 7
- How to set defaults? HOT 6
- Incompatibility with Zotero Connector HOT 4
- Lagging in viewer version compared to PDF.js upstream HOT 7
- [Firefox] Extension breaks the Print/Download feature of Google Docs suite HOT 6
- Custom overlays? HOT 4
- (please delete)
- Two questions HOT 3
- Dark theme not working properly for some PDFs HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from doqment.