Skip to content

Commit 466f0d1

Browse files
committed
V:: v.0.9.2
Data URLs
1 parent 96ed1af commit 466f0d1

File tree

14 files changed

+28
-21
lines changed

14 files changed

+28
-21
lines changed

extension/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"manifest_version": 2,
33
"name": "DjVu.js Viewer",
44
"short_name": "DV",
5-
"version": "0.9.1.0",
5+
"version": "0.9.2.0",
66
"author": "RussCoder",
77
"homepage_url": "https://github.com/RussCoder/djvujs",
88
"description": "Opens links to .djvu files. Allows opening files from a local disk. Processes <object> & <embed> tags.",

viewer/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# DjVu.js Viewer's Changelog
22

3+
## v.0.9.2 (09.04.2023)
4+
5+
- Support for "data:" URLs
6+
37
## v.0.9.1 (01.02.2023)
48

59
- Spanish translation update.

viewer/src/DjVuViewer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const Events = constant({
1717

1818
export default class DjVuViewer extends EventEmitter {
1919

20-
static VERSION = '0.9.1';
20+
static VERSION = '0.9.2';
2121

2222
static Events = Events;
2323
static Constants = Constants;

viewer/src/components/InitialScreen/LinkBlock.jsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,14 @@ const LinkBlock = () => {
4141
return (
4242
<LinkBlockRoot onSubmit={(e) => {
4343
e.preventDefault();
44-
if (/^https?:\/\/.+/.test(url.trim())) {
44+
const trimmedUrl = url.trim();
45+
if (/((^https?:\/\/)|(^data:)).+/.test(trimmedUrl)) {
4546
dispatch({
4647
type: ActionTypes.LOAD_DOCUMENT_BY_URL,
47-
url: url,
48+
url: trimmedUrl,
4849
});
4950
} else {
50-
alert(t('Enter a valid URL (it should start with "http(s)://")'));
51+
alert(t('Enter a valid URL (it should start with "http(s)://" | "data:")'));
5152
}
5253
}}>
5354
<input

viewer/src/hotkeys.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { get } from './reducers';
44

55
export default function initHotkeys(store) {
66
document.addEventListener('keydown', (e) => {
7+
if (!get.isDocumentLoaded(store.getState())) return;
8+
79
if ((e.key === 's' || e.code === 'KeyS') && e.ctrlKey) { // code property isn't supported in Edge yet
810
e.preventDefault();
911
store.dispatch(Actions.tryToSaveDocument());

viewer/src/locales/ChineseSimplified.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ export default {
4646
"在此处粘贴djvu文件的地址",
4747
"Open URL":
4848
"打开地址",
49-
'Enter a valid URL (it should start with "http(s)://")': // an alert shown when you try to open an empty URL
50-
'输入一个有效的地址 (应当以 "http(s)://" 开头)',
49+
'Enter a valid URL (it should start with "http(s)://" | "data:")': // an alert shown when you try to open an empty URL
50+
'输入一个有效的地址 (应当以 "http(s)://" | "data:" 开头)',
5151

5252
// Errors. Usually there is a header and a message for each error type.
5353
// For the web request error there are different types of messages depending on the HTTP status.

viewer/src/locales/English.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ export default {
4646
"Paste a URL to a djvu file here",
4747
"Open URL":
4848
"Open URL",
49-
'Enter a valid URL (it should start with "http(s)://")': // an alert shown when you try to open an empty URL
50-
'Enter a valid URL (it should start with "http(s)://")',
49+
'Enter a valid URL (it should start with "http(s)://" | "data:")': // an alert shown when you try to open an empty URL
50+
'Enter a valid URL (it should start with "http(s)://" | "data:")',
5151

5252
// Errors. Usually there is a header and a message for each error type.
5353
// For the web request error there are different types of messages depending on the HTTP status.

viewer/src/locales/French.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ export default {
4646
"Copier un lien vers un fichier .djvu",
4747
"Open URL":
4848
"Ouvrir le lien",
49-
'Enter a valid URL (it should start with "http(s)://")': // an alert shown when you try to open an empty URL
50-
'Insérer une URL valide (doit commencer par "http(s)://")',
49+
'Enter a valid URL (it should start with "http(s)://" | "data:")': // an alert shown when you try to open an empty URL
50+
'Insérer une URL valide (doit commencer par "http(s)://" | "data:")',
5151

5252
// Errors. Usually there is a header and a message for each error type.
5353
// For the web request error there are different types of messages depending on the HTTP status.

viewer/src/locales/Italian.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ export default {
4646
"Incolla qui l'URL al file DjVu",
4747
"Open URL":
4848
"Apri URL",
49-
'Enter a valid URL (it should start with "http(s)://")': // an alert shown when you try to open an empty URL
50-
'Inserire un URL valido (deve iniziare con "http(s)://")',
49+
'Enter a valid URL (it should start with "http(s)://" | "data:")': // an alert shown when you try to open an empty URL
50+
'Inserire un URL valido (deve iniziare con "http(s)://" | "data:")',
5151

5252
// Errors. Usually there is a header and a message for each error type.
5353
// For the web request error there are different types of messages depending on the HTTP status.

viewer/src/locales/Portuguese.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ export default {
4646
"Colar aqui um URL a um ficheiro djvu",
4747
"Open URL":
4848
"Abrir URL",
49-
'Enter a valid URL (it should start with "http(s)://")': // an alert shown when you try to open an empty URL
50-
'Introduza um URL válido (deve começar com "http(s)://")',
49+
'Enter a valid URL (it should start with "http(s)://" | "data:")': // an alert shown when you try to open an empty URL
50+
'Introduza um URL válido (deve começar com "http(s)://" | "data:")',
5151

5252
// Errors. Usually there is a header and a message for each error type.
5353
// For the web request error there are different types of messages depending on the HTTP status.

0 commit comments

Comments
 (0)