Skip to content

Commit

Permalink
E:: v.0.8.0.0
Browse files Browse the repository at this point in the history
Added links with .DJVU extension.
  • Loading branch information
RussCoder committed Sep 6, 2021
1 parent fa8fec3 commit 2cc03ac
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 3 deletions.
21 changes: 20 additions & 1 deletion extension/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ chrome.contextMenus.create({
'*://*/*.djv',
'*://*/*.djvu?*',
'*://*/*.djv?*',

'*://*/*.DJVU',
'*://*/*.DJV',
'*://*/*.DJVU?*',
'*://*/*.DJV?*',
]
});

Expand Down Expand Up @@ -122,6 +127,11 @@ chrome.webRequest.onBeforeRequest.addListener(details => {
'file:///*/*.djvu?*',
'file:///*/*.djv',
'file:///*/*.djv?*',

'file:///*/*.DJVU',
'file:///*/*.DJVU?*',
'file:///*/*.DJV',
'file:///*/*.DJV?*',
],
types: ['main_frame']
},
Expand All @@ -133,7 +143,7 @@ chrome.webRequest.onBeforeRequest.addListener(details => {
const requestInterceptor = details => {
// http://*/*.djvu also corresponds to "http://localhost/page.php?file=doc.djvu"
// so we have to add this additional check, because it's not a link to a file.
if (/\.djvu?$/.test(new URL(details.url).pathname)) {
if (/\.djvu?$/i.test(new URL(details.url).pathname)) {
return { redirectUrl: getViewerUrl(details.url) };
}
}
Expand All @@ -152,6 +162,15 @@ const enableHttpIntercepting = () => {
'http://*/*.djv?*',
'https://*/*.djv',
'https://*/*.djv?*',

'http://*/*.DJVU',
'http://*/*.DJVU?*',
'https://*/*.DJVU',
'https://*/*.DJVU?*',
'http://*/*.DJV',
'http://*/*.DJV?*',
'https://*/*.DJV',
'https://*/*.DJV?*',
],
types: ['main_frame', 'sub_frame'],
},
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.7.1.0",
"version": "0.8.0.0",
"author": "RussCoder",
"homepage_url": "https://github.com/RussCoder/djvujs",
"description": "Opens links to .djvu files. Allows opening files from a local disk. Processes <object> & <embed> tags.",
Expand Down
3 changes: 3 additions & 0 deletions library/tests/embed.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
</head>

<body>
<p><a href="/assets/boy.djvu">boy.djvu</a></p>
<p><a href="/assets/boy.DJVU">boy.DJVU</a></p>

<!-- It should be processed via request interception. This feature is needed for old websites where the main part is an iframe -->
<iframe src="/assets/boy.djvu"></iframe>
<!-- This iframe should be processed by content script, despite that its src ends with ".djvu" -->
Expand Down
6 changes: 6 additions & 0 deletions viewer/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# DjVu.js Viewer's Changelog

## v.0.8.0 (06.09.2021)

- Mobile version.
- Fullscreen mode.
- Image scaling via pinch zoom.

## v.0.7.1 (30.08.2021)

- Toolbar can be pinned and unpinned.
Expand Down
2 changes: 1 addition & 1 deletion viewer/src/DjVuViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const Events = constant({

export default class DjVuViewer extends EventEmitter {

static VERSION = '0.7.1';
static VERSION = '0.8.0';

static Events = Events;

Expand Down

0 comments on commit 2cc03ac

Please sign in to comment.