1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
|
diff -urN web2/locale/bn/viewer.properties web/locale/bn/viewer.properties
diff -urN web2/locale/bo/viewer.properties web/locale/bo/viewer.properties
diff -urN web2/locale/dsb/viewer.properties web/locale/dsb/viewer.properties
diff -urN web2/locale/trs/viewer.properties web/locale/trs/viewer.properties
diff -urN web2/viewer.css web/viewer.css
--- web2/viewer.css 2019-10-03 23:09:02.000000000 +0200
+++ web/viewer.css 2020-01-02 00:24:02.404916203 +0100
@@ -1,4 +1,5 @@
/* Copyright 2014 Mozilla Foundation
+ * Modifications made for Epiphany by Jan-Michael Brummer <jan.brummer@tabos.org>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -1189,6 +1190,7 @@
}
.dropdownToolbarButton > select {
+ -webkit-appearance: none;
min-width: 140px;
font-size: 12px;
color: hsl(0,0%,95%);
@@ -1523,6 +1525,7 @@
}
.toolbarField.pageNumber {
+ -webkit-appearance: none;
-moz-appearance: textfield; /* hides the spinner in moz */
min-width: 16px;
text-align: right;
diff -urN web2/viewer.html web/viewer.html
--- web2/viewer.html 2019-10-03 23:09:02.000000000 +0200
+++ web/viewer.html 2020-01-03 10:26:10.089369058 +0100
@@ -1,6 +1,7 @@
<!DOCTYPE html>
<!--
Copyright 2012 Mozilla Foundation
+* Modifications made for Epiphany by Jan-Michael Brummer <jan.brummer@tabos.org>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -21,7 +22,7 @@
See https://github.com/adobe-type-tools/cmap-resources
-->
<html dir="ltr" mozdisallowselectionprint>
- <head>
+ <head pdf_data="%s" pdf_name="%s">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="google" content="notranslate">
@@ -29,6 +30,7 @@
<title>PDF.js viewer</title>
+ <base href="ephy-resource:///org/gnome/epiphany/pdfjs/web/">
<link rel="stylesheet" href="viewer.css">
diff -urN web2/viewer.js web/viewer.js
--- web2/viewer.js 2019-10-03 23:09:32.000000000 +0200
+++ web/viewer.js 2020-01-03 12:10:34.247711756 +0100
@@ -3,6 +3,7 @@
* Javascript code in this page
*
* Copyright 2019 Mozilla Foundation
+ * Modifications made for Epiphany by Jan-Michael Brummer <jan.brummer@tabos.org>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -1829,8 +1830,7 @@
var file;
var queryString = document.location.search.substring(1);
var params = (0, _ui_utils.parseQueryString)(queryString);
- file = 'file' in params ? params.file : _app_options.AppOptions.get('defaultUrl');
- validateFileURL(file);
+ file = ''
var fileInput = document.createElement('input');
fileInput.id = appConfig.openFileInputName;
fileInput.className = 'fileInput';
@@ -1838,12 +1838,10 @@
fileInput.oncontextmenu = _ui_utils.noContextMenuHandler;
document.body.appendChild(fileInput);
- if (!window.File || !window.FileReader || !window.FileList || !window.Blob) {
- appConfig.toolbar.openFile.setAttribute('hidden', 'true');
- appConfig.secondaryToolbar.openFileButton.setAttribute('hidden', 'true');
- } else {
- fileInput.value = null;
- }
+ appConfig.toolbar.openFile.setAttribute('hidden', 'true');
+ appConfig.secondaryToolbar.openFileButton.setAttribute('hidden', 'true');
+
+ appConfig.toolbar.viewBookmark.setAttribute('hidden', 'true');
fileInput.addEventListener('change', function (evt) {
var files = evt.target.files;
@@ -1897,8 +1895,18 @@
}
}, true);
+ var file_name = document.head.getAttribute('pdf_name')
+ var raw = atob(document.head.getAttribute('pdf_data'));
+ var raw_length = raw.length;
+ var array = new Uint8Array(new ArrayBuffer(raw_length));
+
+ for(var i = 0; i < raw_length; i++) {
+ array[i] = raw.charCodeAt(i);
+ }
+
try {
- webViewerOpenFileViaURL(file);
+ PDFViewerApplication.open(array);
+ PDFViewerApplication.setTitleUsingUrl(file_name);
} catch (reason) {
PDFViewerApplication.l10n.get('loading_error', null, 'An error occurred while loading the PDF.').then(function (msg) {
PDFViewerApplication.error(msg, reason);
@@ -7785,6 +7793,8 @@
}
}
+ // FIXME: This currently breaks Epiphany due to rewriting history with baseUrl
+ return;
if (shouldReplace) {
if (newUrl) {
window.history.replaceState(newState, '', newUrl);
|