Skip to content

Commit

Permalink
E:: v.0.5.1.0
Browse files Browse the repository at this point in the history
Handle djvu in sub frames.
Show context menu for links with query parameters.
  • Loading branch information
RussCoder committed Nov 19, 2020
1 parent 95c3329 commit 307e758
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
12 changes: 9 additions & 3 deletions extension/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ chrome.contextMenus.create({
id: "open_with",
title: "Open with DjVu.js Viewer",
contexts: ["link"],
targetUrlPatterns: ['*://*/*.djvu', '*://*/*.djv']
targetUrlPatterns: [
'*://*/*.djvu',
'*://*/*.djv',
'*://*/*.djvu?*',
'*://*/*.djv?*',
]
});

function promisify(func) {
Expand Down Expand Up @@ -121,6 +126,7 @@ const requestInterceptor = details => {

const onBeforeRequest = chrome.webRequest.onBeforeRequest;

// Detect djvu only by URL
const enableHttpIntercepting = () => {
!onBeforeRequest.hasListener(requestInterceptor) && onBeforeRequest.addListener(requestInterceptor, {
urls: [
Expand All @@ -133,7 +139,7 @@ const enableHttpIntercepting = () => {
'https://*/*.djv',
'https://*/*.djv?*',
],
types: ['main_frame']
types: ['main_frame', 'sub_frame'],
},
["blocking"]
);
Expand Down Expand Up @@ -175,7 +181,7 @@ const enableHeadersAnalysis = () => {
'http://*/*',
'https://*/*',
],
types: ['main_frame'],
types: ['main_frame', 'sub_frame'],
}, ['blocking', 'responseHeaders']);
};

Expand Down
2 changes: 1 addition & 1 deletion extension/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "DjVu.js Viewer",
"short_name": "DV",
"version": "0.5.0.0",
"version": "0.5.1.0",
"author": "RussCoder",
"homepage_url": "https://github.com/RussCoder/djvujs",
"description": "Opens links to .djvu files. Allows to open .djvu files from a local disk. Processes djvu <object> & <embed> tags.",
Expand Down
2 changes: 1 addition & 1 deletion library/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,6 @@ If you want more practical examples of the library usage, you can take a look at
`viewer/src/sagas` files. There are real examples of the async API usage.

If you want to know more about the inner DjVu structure, it's worth reading the
[DjVu Specification](./assets/DjVu3Spec.djvu).
[DjVu Specification](./assets/DjVu3Spec.djvu?raw=true).

If something isn't intelligible enough, feel free to create an issue.

0 comments on commit 307e758

Please sign in to comment.