PDF-Previews in file-lists now working (#3000)
|
@ -522,3 +522,11 @@ func IsImageFile(data []byte) (string, bool) {
|
||||||
}
|
}
|
||||||
return contentType, false
|
return contentType, false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func IsPDFFile(data []byte) (string, bool) {
|
||||||
|
contentType := http.DetectContentType(data)
|
||||||
|
if strings.Index(contentType, "application/pdf") != -1 {
|
||||||
|
return contentType, true
|
||||||
|
}
|
||||||
|
return contentType, false
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,177 @@
|
||||||
|
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
|
@ -0,0 +1,593 @@
|
||||||
|
/* Copyright 2012 Mozilla Foundation
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
/* globals VBArray, PDFJS */
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
// Initializing PDFJS global object here, it case if we need to change/disable
|
||||||
|
// some PDF.js features, e.g. range requests
|
||||||
|
if (typeof PDFJS === 'undefined') {
|
||||||
|
(typeof window !== 'undefined' ? window : this).PDFJS = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Checking if the typed arrays are supported
|
||||||
|
// Support: iOS<6.0 (subarray), IE<10, Android<4.0
|
||||||
|
(function checkTypedArrayCompatibility() {
|
||||||
|
if (typeof Uint8Array !== 'undefined') {
|
||||||
|
// Support: iOS<6.0
|
||||||
|
if (typeof Uint8Array.prototype.subarray === 'undefined') {
|
||||||
|
Uint8Array.prototype.subarray = function subarray(start, end) {
|
||||||
|
return new Uint8Array(this.slice(start, end));
|
||||||
|
};
|
||||||
|
Float32Array.prototype.subarray = function subarray(start, end) {
|
||||||
|
return new Float32Array(this.slice(start, end));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Support: Android<4.1
|
||||||
|
if (typeof Float64Array === 'undefined') {
|
||||||
|
window.Float64Array = Float32Array;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
function subarray(start, end) {
|
||||||
|
return new TypedArray(this.slice(start, end));
|
||||||
|
}
|
||||||
|
|
||||||
|
function setArrayOffset(array, offset) {
|
||||||
|
if (arguments.length < 2) {
|
||||||
|
offset = 0;
|
||||||
|
}
|
||||||
|
for (var i = 0, n = array.length; i < n; ++i, ++offset) {
|
||||||
|
this[offset] = array[i] & 0xFF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function TypedArray(arg1) {
|
||||||
|
var result, i, n;
|
||||||
|
if (typeof arg1 === 'number') {
|
||||||
|
result = [];
|
||||||
|
for (i = 0; i < arg1; ++i) {
|
||||||
|
result[i] = 0;
|
||||||
|
}
|
||||||
|
} else if ('slice' in arg1) {
|
||||||
|
result = arg1.slice(0);
|
||||||
|
} else {
|
||||||
|
result = [];
|
||||||
|
for (i = 0, n = arg1.length; i < n; ++i) {
|
||||||
|
result[i] = arg1[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
result.subarray = subarray;
|
||||||
|
result.buffer = result;
|
||||||
|
result.byteLength = result.length;
|
||||||
|
result.set = setArrayOffset;
|
||||||
|
|
||||||
|
if (typeof arg1 === 'object' && arg1.buffer) {
|
||||||
|
result.buffer = arg1.buffer;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.Uint8Array = TypedArray;
|
||||||
|
window.Int8Array = TypedArray;
|
||||||
|
|
||||||
|
// we don't need support for set, byteLength for 32-bit array
|
||||||
|
// so we can use the TypedArray as well
|
||||||
|
window.Uint32Array = TypedArray;
|
||||||
|
window.Int32Array = TypedArray;
|
||||||
|
window.Uint16Array = TypedArray;
|
||||||
|
window.Float32Array = TypedArray;
|
||||||
|
window.Float64Array = TypedArray;
|
||||||
|
})();
|
||||||
|
|
||||||
|
// URL = URL || webkitURL
|
||||||
|
// Support: Safari<7, Android 4.2+
|
||||||
|
(function normalizeURLObject() {
|
||||||
|
if (!window.URL) {
|
||||||
|
window.URL = window.webkitURL;
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
|
// Object.defineProperty()?
|
||||||
|
// Support: Android<4.0, Safari<5.1
|
||||||
|
(function checkObjectDefinePropertyCompatibility() {
|
||||||
|
if (typeof Object.defineProperty !== 'undefined') {
|
||||||
|
var definePropertyPossible = true;
|
||||||
|
try {
|
||||||
|
// some browsers (e.g. safari) cannot use defineProperty() on DOM objects
|
||||||
|
// and thus the native version is not sufficient
|
||||||
|
Object.defineProperty(new Image(), 'id', { value: 'test' });
|
||||||
|
// ... another test for android gb browser for non-DOM objects
|
||||||
|
var Test = function Test() {};
|
||||||
|
Test.prototype = { get id() { } };
|
||||||
|
Object.defineProperty(new Test(), 'id',
|
||||||
|
{ value: '', configurable: true, enumerable: true, writable: false });
|
||||||
|
} catch (e) {
|
||||||
|
definePropertyPossible = false;
|
||||||
|
}
|
||||||
|
if (definePropertyPossible) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.defineProperty = function objectDefineProperty(obj, name, def) {
|
||||||
|
delete obj[name];
|
||||||
|
if ('get' in def) {
|
||||||
|
obj.__defineGetter__(name, def['get']);
|
||||||
|
}
|
||||||
|
if ('set' in def) {
|
||||||
|
obj.__defineSetter__(name, def['set']);
|
||||||
|
}
|
||||||
|
if ('value' in def) {
|
||||||
|
obj.__defineSetter__(name, function objectDefinePropertySetter(value) {
|
||||||
|
this.__defineGetter__(name, function objectDefinePropertyGetter() {
|
||||||
|
return value;
|
||||||
|
});
|
||||||
|
return value;
|
||||||
|
});
|
||||||
|
obj[name] = def.value;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
|
||||||
|
|
||||||
|
// No XMLHttpRequest#response?
|
||||||
|
// Support: IE<11, Android <4.0
|
||||||
|
(function checkXMLHttpRequestResponseCompatibility() {
|
||||||
|
var xhrPrototype = XMLHttpRequest.prototype;
|
||||||
|
var xhr = new XMLHttpRequest();
|
||||||
|
if (!('overrideMimeType' in xhr)) {
|
||||||
|
// IE10 might have response, but not overrideMimeType
|
||||||
|
// Support: IE10
|
||||||
|
Object.defineProperty(xhrPrototype, 'overrideMimeType', {
|
||||||
|
value: function xmlHttpRequestOverrideMimeType(mimeType) {}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if ('responseType' in xhr) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The worker will be using XHR, so we can save time and disable worker.
|
||||||
|
PDFJS.disableWorker = true;
|
||||||
|
|
||||||
|
Object.defineProperty(xhrPrototype, 'responseType', {
|
||||||
|
get: function xmlHttpRequestGetResponseType() {
|
||||||
|
return this._responseType || 'text';
|
||||||
|
},
|
||||||
|
set: function xmlHttpRequestSetResponseType(value) {
|
||||||
|
if (value === 'text' || value === 'arraybuffer') {
|
||||||
|
this._responseType = value;
|
||||||
|
if (value === 'arraybuffer' &&
|
||||||
|
typeof this.overrideMimeType === 'function') {
|
||||||
|
this.overrideMimeType('text/plain; charset=x-user-defined');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Support: IE9
|
||||||
|
if (typeof VBArray !== 'undefined') {
|
||||||
|
Object.defineProperty(xhrPrototype, 'response', {
|
||||||
|
get: function xmlHttpRequestResponseGet() {
|
||||||
|
if (this.responseType === 'arraybuffer') {
|
||||||
|
return new Uint8Array(new VBArray(this.responseBody).toArray());
|
||||||
|
} else {
|
||||||
|
return this.responseText;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.defineProperty(xhrPrototype, 'response', {
|
||||||
|
get: function xmlHttpRequestResponseGet() {
|
||||||
|
if (this.responseType !== 'arraybuffer') {
|
||||||
|
return this.responseText;
|
||||||
|
}
|
||||||
|
var text = this.responseText;
|
||||||
|
var i, n = text.length;
|
||||||
|
var result = new Uint8Array(n);
|
||||||
|
for (i = 0; i < n; ++i) {
|
||||||
|
result[i] = text.charCodeAt(i) & 0xFF;
|
||||||
|
}
|
||||||
|
return result.buffer;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
|
||||||
|
// window.btoa (base64 encode function) ?
|
||||||
|
// Support: IE<10
|
||||||
|
(function checkWindowBtoaCompatibility() {
|
||||||
|
if ('btoa' in window) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var digits =
|
||||||
|
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
||||||
|
|
||||||
|
window.btoa = function windowBtoa(chars) {
|
||||||
|
var buffer = '';
|
||||||
|
var i, n;
|
||||||
|
for (i = 0, n = chars.length; i < n; i += 3) {
|
||||||
|
var b1 = chars.charCodeAt(i) & 0xFF;
|
||||||
|
var b2 = chars.charCodeAt(i + 1) & 0xFF;
|
||||||
|
var b3 = chars.charCodeAt(i + 2) & 0xFF;
|
||||||
|
var d1 = b1 >> 2, d2 = ((b1 & 3) << 4) | (b2 >> 4);
|
||||||
|
var d3 = i + 1 < n ? ((b2 & 0xF) << 2) | (b3 >> 6) : 64;
|
||||||
|
var d4 = i + 2 < n ? (b3 & 0x3F) : 64;
|
||||||
|
buffer += (digits.charAt(d1) + digits.charAt(d2) +
|
||||||
|
digits.charAt(d3) + digits.charAt(d4));
|
||||||
|
}
|
||||||
|
return buffer;
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
|
||||||
|
// window.atob (base64 encode function)?
|
||||||
|
// Support: IE<10
|
||||||
|
(function checkWindowAtobCompatibility() {
|
||||||
|
if ('atob' in window) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://github.com/davidchambers/Base64.js
|
||||||
|
var digits =
|
||||||
|
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
||||||
|
window.atob = function (input) {
|
||||||
|
input = input.replace(/=+$/, '');
|
||||||
|
if (input.length % 4 === 1) {
|
||||||
|
throw new Error('bad atob input');
|
||||||
|
}
|
||||||
|
for (
|
||||||
|
// initialize result and counters
|
||||||
|
var bc = 0, bs, buffer, idx = 0, output = '';
|
||||||
|
// get next character
|
||||||
|
buffer = input.charAt(idx++);
|
||||||
|
// character found in table?
|
||||||
|
// initialize bit storage and add its ascii value
|
||||||
|
~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer,
|
||||||
|
// and if not first of each 4 characters,
|
||||||
|
// convert the first 8 bits to one ascii character
|
||||||
|
bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0
|
||||||
|
) {
|
||||||
|
// try to find character in table (0-63, not found => -1)
|
||||||
|
buffer = digits.indexOf(buffer);
|
||||||
|
}
|
||||||
|
return output;
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
|
||||||
|
// Function.prototype.bind?
|
||||||
|
// Support: Android<4.0, iOS<6.0
|
||||||
|
(function checkFunctionPrototypeBindCompatibility() {
|
||||||
|
if (typeof Function.prototype.bind !== 'undefined') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Function.prototype.bind = function functionPrototypeBind(obj) {
|
||||||
|
var fn = this, headArgs = Array.prototype.slice.call(arguments, 1);
|
||||||
|
var bound = function functionPrototypeBindBound() {
|
||||||
|
var args = headArgs.concat(Array.prototype.slice.call(arguments));
|
||||||
|
return fn.apply(obj, args);
|
||||||
|
};
|
||||||
|
return bound;
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
|
||||||
|
// HTMLElement dataset property
|
||||||
|
// Support: IE<11, Safari<5.1, Android<4.0
|
||||||
|
(function checkDatasetProperty() {
|
||||||
|
var div = document.createElement('div');
|
||||||
|
if ('dataset' in div) {
|
||||||
|
return; // dataset property exists
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.defineProperty(HTMLElement.prototype, 'dataset', {
|
||||||
|
get: function() {
|
||||||
|
if (this._dataset) {
|
||||||
|
return this._dataset;
|
||||||
|
}
|
||||||
|
|
||||||
|
var dataset = {};
|
||||||
|
for (var j = 0, jj = this.attributes.length; j < jj; j++) {
|
||||||
|
var attribute = this.attributes[j];
|
||||||
|
if (attribute.name.substring(0, 5) !== 'data-') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
var key = attribute.name.substring(5).replace(/\-([a-z])/g,
|
||||||
|
function(all, ch) {
|
||||||
|
return ch.toUpperCase();
|
||||||
|
});
|
||||||
|
dataset[key] = attribute.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.defineProperty(this, '_dataset', {
|
||||||
|
value: dataset,
|
||||||
|
writable: false,
|
||||||
|
enumerable: false
|
||||||
|
});
|
||||||
|
return dataset;
|
||||||
|
},
|
||||||
|
enumerable: true
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
|
||||||
|
// HTMLElement classList property
|
||||||
|
// Support: IE<10, Android<4.0, iOS<5.0
|
||||||
|
(function checkClassListProperty() {
|
||||||
|
var div = document.createElement('div');
|
||||||
|
if ('classList' in div) {
|
||||||
|
return; // classList property exists
|
||||||
|
}
|
||||||
|
|
||||||
|
function changeList(element, itemName, add, remove) {
|
||||||
|
var s = element.className || '';
|
||||||
|
var list = s.split(/\s+/g);
|
||||||
|
if (list[0] === '') {
|
||||||
|
list.shift();
|
||||||
|
}
|
||||||
|
var index = list.indexOf(itemName);
|
||||||
|
if (index < 0 && add) {
|
||||||
|
list.push(itemName);
|
||||||
|
}
|
||||||
|
if (index >= 0 && remove) {
|
||||||
|
list.splice(index, 1);
|
||||||
|
}
|
||||||
|
element.className = list.join(' ');
|
||||||
|
return (index >= 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
var classListPrototype = {
|
||||||
|
add: function(name) {
|
||||||
|
changeList(this.element, name, true, false);
|
||||||
|
},
|
||||||
|
contains: function(name) {
|
||||||
|
return changeList(this.element, name, false, false);
|
||||||
|
},
|
||||||
|
remove: function(name) {
|
||||||
|
changeList(this.element, name, false, true);
|
||||||
|
},
|
||||||
|
toggle: function(name) {
|
||||||
|
changeList(this.element, name, true, true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Object.defineProperty(HTMLElement.prototype, 'classList', {
|
||||||
|
get: function() {
|
||||||
|
if (this._classList) {
|
||||||
|
return this._classList;
|
||||||
|
}
|
||||||
|
|
||||||
|
var classList = Object.create(classListPrototype, {
|
||||||
|
element: {
|
||||||
|
value: this,
|
||||||
|
writable: false,
|
||||||
|
enumerable: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(this, '_classList', {
|
||||||
|
value: classList,
|
||||||
|
writable: false,
|
||||||
|
enumerable: false
|
||||||
|
});
|
||||||
|
return classList;
|
||||||
|
},
|
||||||
|
enumerable: true
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
|
||||||
|
// Check console compatibility
|
||||||
|
// In older IE versions the console object is not available
|
||||||
|
// unless console is open.
|
||||||
|
// Support: IE<10
|
||||||
|
(function checkConsoleCompatibility() {
|
||||||
|
if (!('console' in window)) {
|
||||||
|
window.console = {
|
||||||
|
log: function() {},
|
||||||
|
error: function() {},
|
||||||
|
warn: function() {}
|
||||||
|
};
|
||||||
|
} else if (!('bind' in console.log)) {
|
||||||
|
// native functions in IE9 might not have bind
|
||||||
|
console.log = (function(fn) {
|
||||||
|
return function(msg) { return fn(msg); };
|
||||||
|
})(console.log);
|
||||||
|
console.error = (function(fn) {
|
||||||
|
return function(msg) { return fn(msg); };
|
||||||
|
})(console.error);
|
||||||
|
console.warn = (function(fn) {
|
||||||
|
return function(msg) { return fn(msg); };
|
||||||
|
})(console.warn);
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
|
// Check onclick compatibility in Opera
|
||||||
|
// Support: Opera<15
|
||||||
|
(function checkOnClickCompatibility() {
|
||||||
|
// workaround for reported Opera bug DSK-354448:
|
||||||
|
// onclick fires on disabled buttons with opaque content
|
||||||
|
function ignoreIfTargetDisabled(event) {
|
||||||
|
if (isDisabled(event.target)) {
|
||||||
|
event.stopPropagation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function isDisabled(node) {
|
||||||
|
return node.disabled || (node.parentNode && isDisabled(node.parentNode));
|
||||||
|
}
|
||||||
|
if (navigator.userAgent.indexOf('Opera') !== -1) {
|
||||||
|
// use browser detection since we cannot feature-check this bug
|
||||||
|
document.addEventListener('click', ignoreIfTargetDisabled, true);
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
|
// Checks if possible to use URL.createObjectURL()
|
||||||
|
// Support: IE
|
||||||
|
(function checkOnBlobSupport() {
|
||||||
|
// sometimes IE loosing the data created with createObjectURL(), see #3977
|
||||||
|
if (navigator.userAgent.indexOf('Trident') >= 0) {
|
||||||
|
PDFJS.disableCreateObjectURL = true;
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
|
// Checks if navigator.language is supported
|
||||||
|
(function checkNavigatorLanguage() {
|
||||||
|
if ('language' in navigator) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PDFJS.locale = navigator.userLanguage || 'en-US';
|
||||||
|
})();
|
||||||
|
|
||||||
|
(function checkRangeRequests() {
|
||||||
|
// Safari has issues with cached range requests see:
|
||||||
|
// https://github.com/mozilla/pdf.js/issues/3260
|
||||||
|
// Last tested with version 6.0.4.
|
||||||
|
// Support: Safari 6.0+
|
||||||
|
var isSafari = Object.prototype.toString.call(
|
||||||
|
window.HTMLElement).indexOf('Constructor') > 0;
|
||||||
|
|
||||||
|
// Older versions of Android (pre 3.0) has issues with range requests, see:
|
||||||
|
// https://github.com/mozilla/pdf.js/issues/3381.
|
||||||
|
// Make sure that we only match webkit-based Android browsers,
|
||||||
|
// since Firefox/Fennec works as expected.
|
||||||
|
// Support: Android<3.0
|
||||||
|
var regex = /Android\s[0-2][^\d]/;
|
||||||
|
var isOldAndroid = regex.test(navigator.userAgent);
|
||||||
|
|
||||||
|
// Range requests are broken in Chrome 39 and 40, https://crbug.com/442318
|
||||||
|
var isChromeWithRangeBug = /Chrome\/(39|40)\./.test(navigator.userAgent);
|
||||||
|
|
||||||
|
if (isSafari || isOldAndroid || isChromeWithRangeBug) {
|
||||||
|
PDFJS.disableRange = true;
|
||||||
|
PDFJS.disableStream = true;
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
|
// Check if the browser supports manipulation of the history.
|
||||||
|
// Support: IE<10, Android<4.2
|
||||||
|
(function checkHistoryManipulation() {
|
||||||
|
// Android 2.x has so buggy pushState support that it was removed in
|
||||||
|
// Android 3.0 and restored as late as in Android 4.2.
|
||||||
|
// Support: Android 2.x
|
||||||
|
if (!history.pushState || navigator.userAgent.indexOf('Android 2.') >= 0) {
|
||||||
|
PDFJS.disableHistory = true;
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
|
// Support: IE<11, Chrome<21, Android<4.4, Safari<6
|
||||||
|
(function checkSetPresenceInImageData() {
|
||||||
|
// IE < 11 will use window.CanvasPixelArray which lacks set function.
|
||||||
|
if (window.CanvasPixelArray) {
|
||||||
|
if (typeof window.CanvasPixelArray.prototype.set !== 'function') {
|
||||||
|
window.CanvasPixelArray.prototype.set = function(arr) {
|
||||||
|
for (var i = 0, ii = this.length; i < ii; i++) {
|
||||||
|
this[i] = arr[i];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Old Chrome and Android use an inaccessible CanvasPixelArray prototype.
|
||||||
|
// Because we cannot feature detect it, we rely on user agent parsing.
|
||||||
|
var polyfill = false, versionMatch;
|
||||||
|
if (navigator.userAgent.indexOf('Chrom') >= 0) {
|
||||||
|
versionMatch = navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);
|
||||||
|
// Chrome < 21 lacks the set function.
|
||||||
|
polyfill = versionMatch && parseInt(versionMatch[2]) < 21;
|
||||||
|
} else if (navigator.userAgent.indexOf('Android') >= 0) {
|
||||||
|
// Android < 4.4 lacks the set function.
|
||||||
|
// Android >= 4.4 will contain Chrome in the user agent,
|
||||||
|
// thus pass the Chrome check above and not reach this block.
|
||||||
|
polyfill = /Android\s[0-4][^\d]/g.test(navigator.userAgent);
|
||||||
|
} else if (navigator.userAgent.indexOf('Safari') >= 0) {
|
||||||
|
versionMatch = navigator.userAgent.
|
||||||
|
match(/Version\/([0-9]+)\.([0-9]+)\.([0-9]+) Safari\//);
|
||||||
|
// Safari < 6 lacks the set function.
|
||||||
|
polyfill = versionMatch && parseInt(versionMatch[1]) < 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (polyfill) {
|
||||||
|
var contextPrototype = window.CanvasRenderingContext2D.prototype;
|
||||||
|
var createImageData = contextPrototype.createImageData;
|
||||||
|
contextPrototype.createImageData = function(w, h) {
|
||||||
|
var imageData = createImageData.call(this, w, h);
|
||||||
|
imageData.data.set = function(arr) {
|
||||||
|
for (var i = 0, ii = this.length; i < ii; i++) {
|
||||||
|
this[i] = arr[i];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return imageData;
|
||||||
|
};
|
||||||
|
// this closure will be kept referenced, so clear its vars
|
||||||
|
contextPrototype = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
|
// Support: IE<10, Android<4.0, iOS
|
||||||
|
(function checkRequestAnimationFrame() {
|
||||||
|
function fakeRequestAnimationFrame(callback) {
|
||||||
|
window.setTimeout(callback, 20);
|
||||||
|
}
|
||||||
|
|
||||||
|
var isIOS = /(iPad|iPhone|iPod)/g.test(navigator.userAgent);
|
||||||
|
if (isIOS) {
|
||||||
|
// requestAnimationFrame on iOS is broken, replacing with fake one.
|
||||||
|
window.requestAnimationFrame = fakeRequestAnimationFrame;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ('requestAnimationFrame' in window) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
window.requestAnimationFrame =
|
||||||
|
window.mozRequestAnimationFrame ||
|
||||||
|
window.webkitRequestAnimationFrame ||
|
||||||
|
fakeRequestAnimationFrame;
|
||||||
|
})();
|
||||||
|
|
||||||
|
(function checkCanvasSizeLimitation() {
|
||||||
|
var isIOS = /(iPad|iPhone|iPod)/g.test(navigator.userAgent);
|
||||||
|
var isAndroid = /Android/g.test(navigator.userAgent);
|
||||||
|
if (isIOS || isAndroid) {
|
||||||
|
// 5MP
|
||||||
|
PDFJS.maxCanvasPixels = 5242880;
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
|
// Disable fullscreen support for certain problematic configurations.
|
||||||
|
// Support: IE11+ (when embedded).
|
||||||
|
(function checkFullscreenSupport() {
|
||||||
|
var isEmbeddedIE = (navigator.userAgent.indexOf('Trident') >= 0 &&
|
||||||
|
window.parent !== window);
|
||||||
|
if (isEmbeddedIE) {
|
||||||
|
PDFJS.disableFullscreen = true;
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
|
// Provides document.currentScript support
|
||||||
|
// Support: IE, Chrome<29.
|
||||||
|
(function checkCurrentScript() {
|
||||||
|
if ('currentScript' in document) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Object.defineProperty(document, 'currentScript', {
|
||||||
|
get: function () {
|
||||||
|
var scripts = document.getElementsByTagName('script');
|
||||||
|
return scripts[scripts.length - 1];
|
||||||
|
},
|
||||||
|
enumerable: true,
|
||||||
|
configurable: true
|
||||||
|
});
|
||||||
|
})();
|
|
@ -0,0 +1,618 @@
|
||||||
|
/* Copyright 2012 Mozilla Foundation
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
/* globals PDFJS */
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var FontInspector = (function FontInspectorClosure() {
|
||||||
|
var fonts;
|
||||||
|
var active = false;
|
||||||
|
var fontAttribute = 'data-font-name';
|
||||||
|
function removeSelection() {
|
||||||
|
var divs = document.querySelectorAll('div[' + fontAttribute + ']');
|
||||||
|
for (var i = 0, ii = divs.length; i < ii; ++i) {
|
||||||
|
var div = divs[i];
|
||||||
|
div.className = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function resetSelection() {
|
||||||
|
var divs = document.querySelectorAll('div[' + fontAttribute + ']');
|
||||||
|
for (var i = 0, ii = divs.length; i < ii; ++i) {
|
||||||
|
var div = divs[i];
|
||||||
|
div.className = 'debuggerHideText';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function selectFont(fontName, show) {
|
||||||
|
var divs = document.querySelectorAll('div[' + fontAttribute + '=' +
|
||||||
|
fontName + ']');
|
||||||
|
for (var i = 0, ii = divs.length; i < ii; ++i) {
|
||||||
|
var div = divs[i];
|
||||||
|
div.className = show ? 'debuggerShowText' : 'debuggerHideText';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function textLayerClick(e) {
|
||||||
|
if (!e.target.dataset.fontName ||
|
||||||
|
e.target.tagName.toUpperCase() !== 'DIV') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var fontName = e.target.dataset.fontName;
|
||||||
|
var selects = document.getElementsByTagName('input');
|
||||||
|
for (var i = 0; i < selects.length; ++i) {
|
||||||
|
var select = selects[i];
|
||||||
|
if (select.dataset.fontName !== fontName) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
select.checked = !select.checked;
|
||||||
|
selectFont(fontName, select.checked);
|
||||||
|
select.scrollIntoView();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
// Properties/functions needed by PDFBug.
|
||||||
|
id: 'FontInspector',
|
||||||
|
name: 'Font Inspector',
|
||||||
|
panel: null,
|
||||||
|
manager: null,
|
||||||
|
init: function init() {
|
||||||
|
var panel = this.panel;
|
||||||
|
panel.setAttribute('style', 'padding: 5px;');
|
||||||
|
var tmp = document.createElement('button');
|
||||||
|
tmp.addEventListener('click', resetSelection);
|
||||||
|
tmp.textContent = 'Refresh';
|
||||||
|
panel.appendChild(tmp);
|
||||||
|
|
||||||
|
fonts = document.createElement('div');
|
||||||
|
panel.appendChild(fonts);
|
||||||
|
},
|
||||||
|
cleanup: function cleanup() {
|
||||||
|
fonts.textContent = '';
|
||||||
|
},
|
||||||
|
enabled: false,
|
||||||
|
get active() {
|
||||||
|
return active;
|
||||||
|
},
|
||||||
|
set active(value) {
|
||||||
|
active = value;
|
||||||
|
if (active) {
|
||||||
|
document.body.addEventListener('click', textLayerClick, true);
|
||||||
|
resetSelection();
|
||||||
|
} else {
|
||||||
|
document.body.removeEventListener('click', textLayerClick, true);
|
||||||
|
removeSelection();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// FontInspector specific functions.
|
||||||
|
fontAdded: function fontAdded(fontObj, url) {
|
||||||
|
function properties(obj, list) {
|
||||||
|
var moreInfo = document.createElement('table');
|
||||||
|
for (var i = 0; i < list.length; i++) {
|
||||||
|
var tr = document.createElement('tr');
|
||||||
|
var td1 = document.createElement('td');
|
||||||
|
td1.textContent = list[i];
|
||||||
|
tr.appendChild(td1);
|
||||||
|
var td2 = document.createElement('td');
|
||||||
|
td2.textContent = obj[list[i]].toString();
|
||||||
|
tr.appendChild(td2);
|
||||||
|
moreInfo.appendChild(tr);
|
||||||
|
}
|
||||||
|
return moreInfo;
|
||||||
|
}
|
||||||
|
var moreInfo = properties(fontObj, ['name', 'type']);
|
||||||
|
var fontName = fontObj.loadedName;
|
||||||
|
var font = document.createElement('div');
|
||||||
|
var name = document.createElement('span');
|
||||||
|
name.textContent = fontName;
|
||||||
|
var download = document.createElement('a');
|
||||||
|
if (url) {
|
||||||
|
url = /url\(['"]?([^\)"']+)/.exec(url);
|
||||||
|
download.href = url[1];
|
||||||
|
} else if (fontObj.data) {
|
||||||
|
url = URL.createObjectURL(new Blob([fontObj.data], {
|
||||||
|
type: fontObj.mimeType
|
||||||
|
}));
|
||||||
|
download.href = url;
|
||||||
|
}
|
||||||
|
download.textContent = 'Download';
|
||||||
|
var logIt = document.createElement('a');
|
||||||
|
logIt.href = '';
|
||||||
|
logIt.textContent = 'Log';
|
||||||
|
logIt.addEventListener('click', function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
console.log(fontObj);
|
||||||
|
});
|
||||||
|
var select = document.createElement('input');
|
||||||
|
select.setAttribute('type', 'checkbox');
|
||||||
|
select.dataset.fontName = fontName;
|
||||||
|
select.addEventListener('click', (function(select, fontName) {
|
||||||
|
return (function() {
|
||||||
|
selectFont(fontName, select.checked);
|
||||||
|
});
|
||||||
|
})(select, fontName));
|
||||||
|
font.appendChild(select);
|
||||||
|
font.appendChild(name);
|
||||||
|
font.appendChild(document.createTextNode(' '));
|
||||||
|
font.appendChild(download);
|
||||||
|
font.appendChild(document.createTextNode(' '));
|
||||||
|
font.appendChild(logIt);
|
||||||
|
font.appendChild(moreInfo);
|
||||||
|
fonts.appendChild(font);
|
||||||
|
// Somewhat of a hack, should probably add a hook for when the text layer
|
||||||
|
// is done rendering.
|
||||||
|
setTimeout(function() {
|
||||||
|
if (this.active) {
|
||||||
|
resetSelection();
|
||||||
|
}
|
||||||
|
}.bind(this), 2000);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
|
||||||
|
// Manages all the page steppers.
|
||||||
|
var StepperManager = (function StepperManagerClosure() {
|
||||||
|
var steppers = [];
|
||||||
|
var stepperDiv = null;
|
||||||
|
var stepperControls = null;
|
||||||
|
var stepperChooser = null;
|
||||||
|
var breakPoints = {};
|
||||||
|
return {
|
||||||
|
// Properties/functions needed by PDFBug.
|
||||||
|
id: 'Stepper',
|
||||||
|
name: 'Stepper',
|
||||||
|
panel: null,
|
||||||
|
manager: null,
|
||||||
|
init: function init() {
|
||||||
|
var self = this;
|
||||||
|
this.panel.setAttribute('style', 'padding: 5px;');
|
||||||
|
stepperControls = document.createElement('div');
|
||||||
|
stepperChooser = document.createElement('select');
|
||||||
|
stepperChooser.addEventListener('change', function(event) {
|
||||||
|
self.selectStepper(this.value);
|
||||||
|
});
|
||||||
|
stepperControls.appendChild(stepperChooser);
|
||||||
|
stepperDiv = document.createElement('div');
|
||||||
|
this.panel.appendChild(stepperControls);
|
||||||
|
this.panel.appendChild(stepperDiv);
|
||||||
|
if (sessionStorage.getItem('pdfjsBreakPoints')) {
|
||||||
|
breakPoints = JSON.parse(sessionStorage.getItem('pdfjsBreakPoints'));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
cleanup: function cleanup() {
|
||||||
|
stepperChooser.textContent = '';
|
||||||
|
stepperDiv.textContent = '';
|
||||||
|
steppers = [];
|
||||||
|
},
|
||||||
|
enabled: false,
|
||||||
|
active: false,
|
||||||
|
// Stepper specific functions.
|
||||||
|
create: function create(pageIndex) {
|
||||||
|
var debug = document.createElement('div');
|
||||||
|
debug.id = 'stepper' + pageIndex;
|
||||||
|
debug.setAttribute('hidden', true);
|
||||||
|
debug.className = 'stepper';
|
||||||
|
stepperDiv.appendChild(debug);
|
||||||
|
var b = document.createElement('option');
|
||||||
|
b.textContent = 'Page ' + (pageIndex + 1);
|
||||||
|
b.value = pageIndex;
|
||||||
|
stepperChooser.appendChild(b);
|
||||||
|
var initBreakPoints = breakPoints[pageIndex] || [];
|
||||||
|
var stepper = new Stepper(debug, pageIndex, initBreakPoints);
|
||||||
|
steppers.push(stepper);
|
||||||
|
if (steppers.length === 1) {
|
||||||
|
this.selectStepper(pageIndex, false);
|
||||||
|
}
|
||||||
|
return stepper;
|
||||||
|
},
|
||||||
|
selectStepper: function selectStepper(pageIndex, selectPanel) {
|
||||||
|
var i;
|
||||||
|
pageIndex = pageIndex | 0;
|
||||||
|
if (selectPanel) {
|
||||||
|
this.manager.selectPanel(this);
|
||||||
|
}
|
||||||
|
for (i = 0; i < steppers.length; ++i) {
|
||||||
|
var stepper = steppers[i];
|
||||||
|
if (stepper.pageIndex === pageIndex) {
|
||||||
|
stepper.panel.removeAttribute('hidden');
|
||||||
|
} else {
|
||||||
|
stepper.panel.setAttribute('hidden', true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var options = stepperChooser.options;
|
||||||
|
for (i = 0; i < options.length; ++i) {
|
||||||
|
var option = options[i];
|
||||||
|
option.selected = (option.value | 0) === pageIndex;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
saveBreakPoints: function saveBreakPoints(pageIndex, bps) {
|
||||||
|
breakPoints[pageIndex] = bps;
|
||||||
|
sessionStorage.setItem('pdfjsBreakPoints', JSON.stringify(breakPoints));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
|
||||||
|
// The stepper for each page's IRQueue.
|
||||||
|
var Stepper = (function StepperClosure() {
|
||||||
|
// Shorter way to create element and optionally set textContent.
|
||||||
|
function c(tag, textContent) {
|
||||||
|
var d = document.createElement(tag);
|
||||||
|
if (textContent) {
|
||||||
|
d.textContent = textContent;
|
||||||
|
}
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
|
||||||
|
var opMap = null;
|
||||||
|
|
||||||
|
function simplifyArgs(args) {
|
||||||
|
if (typeof args === 'string') {
|
||||||
|
var MAX_STRING_LENGTH = 75;
|
||||||
|
return args.length <= MAX_STRING_LENGTH ? args :
|
||||||
|
args.substr(0, MAX_STRING_LENGTH) + '...';
|
||||||
|
}
|
||||||
|
if (typeof args !== 'object' || args === null) {
|
||||||
|
return args;
|
||||||
|
}
|
||||||
|
if ('length' in args) { // array
|
||||||
|
var simpleArgs = [], i, ii;
|
||||||
|
var MAX_ITEMS = 10;
|
||||||
|
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
|
||||||
|
simpleArgs.push(simplifyArgs(args[i]));
|
||||||
|
}
|
||||||
|
if (i < args.length) {
|
||||||
|
simpleArgs.push('...');
|
||||||
|
}
|
||||||
|
return simpleArgs;
|
||||||
|
}
|
||||||
|
var simpleObj = {};
|
||||||
|
for (var key in args) {
|
||||||
|
simpleObj[key] = simplifyArgs(args[key]);
|
||||||
|
}
|
||||||
|
return simpleObj;
|
||||||
|
}
|
||||||
|
|
||||||
|
function Stepper(panel, pageIndex, initialBreakPoints) {
|
||||||
|
this.panel = panel;
|
||||||
|
this.breakPoint = 0;
|
||||||
|
this.nextBreakPoint = null;
|
||||||
|
this.pageIndex = pageIndex;
|
||||||
|
this.breakPoints = initialBreakPoints;
|
||||||
|
this.currentIdx = -1;
|
||||||
|
this.operatorListIdx = 0;
|
||||||
|
}
|
||||||
|
Stepper.prototype = {
|
||||||
|
init: function init() {
|
||||||
|
var panel = this.panel;
|
||||||
|
var content = c('div', 'c=continue, s=step');
|
||||||
|
var table = c('table');
|
||||||
|
content.appendChild(table);
|
||||||
|
table.cellSpacing = 0;
|
||||||
|
var headerRow = c('tr');
|
||||||
|
table.appendChild(headerRow);
|
||||||
|
headerRow.appendChild(c('th', 'Break'));
|
||||||
|
headerRow.appendChild(c('th', 'Idx'));
|
||||||
|
headerRow.appendChild(c('th', 'fn'));
|
||||||
|
headerRow.appendChild(c('th', 'args'));
|
||||||
|
panel.appendChild(content);
|
||||||
|
this.table = table;
|
||||||
|
if (!opMap) {
|
||||||
|
opMap = Object.create(null);
|
||||||
|
for (var key in PDFJS.OPS) {
|
||||||
|
opMap[PDFJS.OPS[key]] = key;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
updateOperatorList: function updateOperatorList(operatorList) {
|
||||||
|
var self = this;
|
||||||
|
|
||||||
|
function cboxOnClick() {
|
||||||
|
var x = +this.dataset.idx;
|
||||||
|
if (this.checked) {
|
||||||
|
self.breakPoints.push(x);
|
||||||
|
} else {
|
||||||
|
self.breakPoints.splice(self.breakPoints.indexOf(x), 1);
|
||||||
|
}
|
||||||
|
StepperManager.saveBreakPoints(self.pageIndex, self.breakPoints);
|
||||||
|
}
|
||||||
|
|
||||||
|
var MAX_OPERATORS_COUNT = 15000;
|
||||||
|
if (this.operatorListIdx > MAX_OPERATORS_COUNT) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var chunk = document.createDocumentFragment();
|
||||||
|
var operatorsToDisplay = Math.min(MAX_OPERATORS_COUNT,
|
||||||
|
operatorList.fnArray.length);
|
||||||
|
for (var i = this.operatorListIdx; i < operatorsToDisplay; i++) {
|
||||||
|
var line = c('tr');
|
||||||
|
line.className = 'line';
|
||||||
|
line.dataset.idx = i;
|
||||||
|
chunk.appendChild(line);
|
||||||
|
var checked = this.breakPoints.indexOf(i) !== -1;
|
||||||
|
var args = operatorList.argsArray[i] || [];
|
||||||
|
|
||||||
|
var breakCell = c('td');
|
||||||
|
var cbox = c('input');
|
||||||
|
cbox.type = 'checkbox';
|
||||||
|
cbox.className = 'points';
|
||||||
|
cbox.checked = checked;
|
||||||
|
cbox.dataset.idx = i;
|
||||||
|
cbox.onclick = cboxOnClick;
|
||||||
|
|
||||||
|
breakCell.appendChild(cbox);
|
||||||
|
line.appendChild(breakCell);
|
||||||
|
line.appendChild(c('td', i.toString()));
|
||||||
|
var fn = opMap[operatorList.fnArray[i]];
|
||||||
|
var decArgs = args;
|
||||||
|
if (fn === 'showText') {
|
||||||
|
var glyphs = args[0];
|
||||||
|
var newArgs = [];
|
||||||
|
var str = [];
|
||||||
|
for (var j = 0; j < glyphs.length; j++) {
|
||||||
|
var glyph = glyphs[j];
|
||||||
|
if (typeof glyph === 'object' && glyph !== null) {
|
||||||
|
str.push(glyph.fontChar);
|
||||||
|
} else {
|
||||||
|
if (str.length > 0) {
|
||||||
|
newArgs.push(str.join(''));
|
||||||
|
str = [];
|
||||||
|
}
|
||||||
|
newArgs.push(glyph); // null or number
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (str.length > 0) {
|
||||||
|
newArgs.push(str.join(''));
|
||||||
|
}
|
||||||
|
decArgs = [newArgs];
|
||||||
|
}
|
||||||
|
line.appendChild(c('td', fn));
|
||||||
|
line.appendChild(c('td', JSON.stringify(simplifyArgs(decArgs))));
|
||||||
|
}
|
||||||
|
if (operatorsToDisplay < operatorList.fnArray.length) {
|
||||||
|
line = c('tr');
|
||||||
|
var lastCell = c('td', '...');
|
||||||
|
lastCell.colspan = 4;
|
||||||
|
chunk.appendChild(lastCell);
|
||||||
|
}
|
||||||
|
this.operatorListIdx = operatorList.fnArray.length;
|
||||||
|
this.table.appendChild(chunk);
|
||||||
|
},
|
||||||
|
getNextBreakPoint: function getNextBreakPoint() {
|
||||||
|
this.breakPoints.sort(function(a, b) { return a - b; });
|
||||||
|
for (var i = 0; i < this.breakPoints.length; i++) {
|
||||||
|
if (this.breakPoints[i] > this.currentIdx) {
|
||||||
|
return this.breakPoints[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
breakIt: function breakIt(idx, callback) {
|
||||||
|
StepperManager.selectStepper(this.pageIndex, true);
|
||||||
|
var self = this;
|
||||||
|
var dom = document;
|
||||||
|
self.currentIdx = idx;
|
||||||
|
var listener = function(e) {
|
||||||
|
switch (e.keyCode) {
|
||||||
|
case 83: // step
|
||||||
|
dom.removeEventListener('keydown', listener, false);
|
||||||
|
self.nextBreakPoint = self.currentIdx + 1;
|
||||||
|
self.goTo(-1);
|
||||||
|
callback();
|
||||||
|
break;
|
||||||
|
case 67: // continue
|
||||||
|
dom.removeEventListener('keydown', listener, false);
|
||||||
|
var breakPoint = self.getNextBreakPoint();
|
||||||
|
self.nextBreakPoint = breakPoint;
|
||||||
|
self.goTo(-1);
|
||||||
|
callback();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
dom.addEventListener('keydown', listener, false);
|
||||||
|
self.goTo(idx);
|
||||||
|
},
|
||||||
|
goTo: function goTo(idx) {
|
||||||
|
var allRows = this.panel.getElementsByClassName('line');
|
||||||
|
for (var x = 0, xx = allRows.length; x < xx; ++x) {
|
||||||
|
var row = allRows[x];
|
||||||
|
if ((row.dataset.idx | 0) === idx) {
|
||||||
|
row.style.backgroundColor = 'rgb(251,250,207)';
|
||||||
|
row.scrollIntoView();
|
||||||
|
} else {
|
||||||
|
row.style.backgroundColor = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return Stepper;
|
||||||
|
})();
|
||||||
|
|
||||||
|
var Stats = (function Stats() {
|
||||||
|
var stats = [];
|
||||||
|
function clear(node) {
|
||||||
|
while (node.hasChildNodes()) {
|
||||||
|
node.removeChild(node.lastChild);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function getStatIndex(pageNumber) {
|
||||||
|
for (var i = 0, ii = stats.length; i < ii; ++i) {
|
||||||
|
if (stats[i].pageNumber === pageNumber) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
// Properties/functions needed by PDFBug.
|
||||||
|
id: 'Stats',
|
||||||
|
name: 'Stats',
|
||||||
|
panel: null,
|
||||||
|
manager: null,
|
||||||
|
init: function init() {
|
||||||
|
this.panel.setAttribute('style', 'padding: 5px;');
|
||||||
|
PDFJS.enableStats = true;
|
||||||
|
},
|
||||||
|
enabled: false,
|
||||||
|
active: false,
|
||||||
|
// Stats specific functions.
|
||||||
|
add: function(pageNumber, stat) {
|
||||||
|
if (!stat) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var statsIndex = getStatIndex(pageNumber);
|
||||||
|
if (statsIndex !== false) {
|
||||||
|
var b = stats[statsIndex];
|
||||||
|
this.panel.removeChild(b.div);
|
||||||
|
stats.splice(statsIndex, 1);
|
||||||
|
}
|
||||||
|
var wrapper = document.createElement('div');
|
||||||
|
wrapper.className = 'stats';
|
||||||
|
var title = document.createElement('div');
|
||||||
|
title.className = 'title';
|
||||||
|
title.textContent = 'Page: ' + pageNumber;
|
||||||
|
var statsDiv = document.createElement('div');
|
||||||
|
statsDiv.textContent = stat.toString();
|
||||||
|
wrapper.appendChild(title);
|
||||||
|
wrapper.appendChild(statsDiv);
|
||||||
|
stats.push({ pageNumber: pageNumber, div: wrapper });
|
||||||
|
stats.sort(function(a, b) { return a.pageNumber - b.pageNumber; });
|
||||||
|
clear(this.panel);
|
||||||
|
for (var i = 0, ii = stats.length; i < ii; ++i) {
|
||||||
|
this.panel.appendChild(stats[i].div);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
cleanup: function () {
|
||||||
|
stats = [];
|
||||||
|
clear(this.panel);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
|
||||||
|
// Manages all the debugging tools.
|
||||||
|
var PDFBug = (function PDFBugClosure() {
|
||||||
|
var panelWidth = 300;
|
||||||
|
var buttons = [];
|
||||||
|
var activePanel = null;
|
||||||
|
|
||||||
|
return {
|
||||||
|
tools: [
|
||||||
|
FontInspector,
|
||||||
|
StepperManager,
|
||||||
|
Stats
|
||||||
|
],
|
||||||
|
enable: function(ids) {
|
||||||
|
var all = false, tools = this.tools;
|
||||||
|
if (ids.length === 1 && ids[0] === 'all') {
|
||||||
|
all = true;
|
||||||
|
}
|
||||||
|
for (var i = 0; i < tools.length; ++i) {
|
||||||
|
var tool = tools[i];
|
||||||
|
if (all || ids.indexOf(tool.id) !== -1) {
|
||||||
|
tool.enabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!all) {
|
||||||
|
// Sort the tools by the order they are enabled.
|
||||||
|
tools.sort(function(a, b) {
|
||||||
|
var indexA = ids.indexOf(a.id);
|
||||||
|
indexA = indexA < 0 ? tools.length : indexA;
|
||||||
|
var indexB = ids.indexOf(b.id);
|
||||||
|
indexB = indexB < 0 ? tools.length : indexB;
|
||||||
|
return indexA - indexB;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
init: function init() {
|
||||||
|
/*
|
||||||
|
* Basic Layout:
|
||||||
|
* PDFBug
|
||||||
|
* Controls
|
||||||
|
* Panels
|
||||||
|
* Panel
|
||||||
|
* Panel
|
||||||
|
* ...
|
||||||
|
*/
|
||||||
|
var ui = document.createElement('div');
|
||||||
|
ui.id = 'PDFBug';
|
||||||
|
|
||||||
|
var controls = document.createElement('div');
|
||||||
|
controls.setAttribute('class', 'controls');
|
||||||
|
ui.appendChild(controls);
|
||||||
|
|
||||||
|
var panels = document.createElement('div');
|
||||||
|
panels.setAttribute('class', 'panels');
|
||||||
|
ui.appendChild(panels);
|
||||||
|
|
||||||
|
var container = document.getElementById('viewerContainer');
|
||||||
|
container.appendChild(ui);
|
||||||
|
container.style.right = panelWidth + 'px';
|
||||||
|
|
||||||
|
// Initialize all the debugging tools.
|
||||||
|
var tools = this.tools;
|
||||||
|
var self = this;
|
||||||
|
for (var i = 0; i < tools.length; ++i) {
|
||||||
|
var tool = tools[i];
|
||||||
|
var panel = document.createElement('div');
|
||||||
|
var panelButton = document.createElement('button');
|
||||||
|
panelButton.textContent = tool.name;
|
||||||
|
panelButton.addEventListener('click', (function(selected) {
|
||||||
|
return function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
self.selectPanel(selected);
|
||||||
|
};
|
||||||
|
})(i));
|
||||||
|
controls.appendChild(panelButton);
|
||||||
|
panels.appendChild(panel);
|
||||||
|
tool.panel = panel;
|
||||||
|
tool.manager = this;
|
||||||
|
if (tool.enabled) {
|
||||||
|
tool.init();
|
||||||
|
} else {
|
||||||
|
panel.textContent = tool.name + ' is disabled. To enable add ' +
|
||||||
|
' "' + tool.id + '" to the pdfBug parameter ' +
|
||||||
|
'and refresh (seperate multiple by commas).';
|
||||||
|
}
|
||||||
|
buttons.push(panelButton);
|
||||||
|
}
|
||||||
|
this.selectPanel(0);
|
||||||
|
},
|
||||||
|
cleanup: function cleanup() {
|
||||||
|
for (var i = 0, ii = this.tools.length; i < ii; i++) {
|
||||||
|
if (this.tools[i].enabled) {
|
||||||
|
this.tools[i].cleanup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
selectPanel: function selectPanel(index) {
|
||||||
|
if (typeof index !== 'number') {
|
||||||
|
index = this.tools.indexOf(index);
|
||||||
|
}
|
||||||
|
if (index === activePanel) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
activePanel = index;
|
||||||
|
var tools = this.tools;
|
||||||
|
for (var j = 0; j < tools.length; ++j) {
|
||||||
|
if (j === index) {
|
||||||
|
buttons[j].setAttribute('class', 'active');
|
||||||
|
tools[j].active = true;
|
||||||
|
tools[j].panel.removeAttribute('hidden');
|
||||||
|
} else {
|
||||||
|
buttons[j].setAttribute('class', '');
|
||||||
|
tools[j].active = false;
|
||||||
|
tools[j].panel.setAttribute('hidden', 'true');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})();
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="40"
|
||||||
|
height="40"
|
||||||
|
viewBox="0 0 40 40">
|
||||||
|
<path
|
||||||
|
d="M 1.5006714,23.536225 6.8925879,18.994244 14.585721,26.037937 34.019683,4.5410479 38.499329,9.2235032 14.585721,35.458952 z"
|
||||||
|
id="path4"
|
||||||
|
style="fill:#ffff00;fill-opacity:1;stroke:#000000;stroke-width:1.25402856;stroke-opacity:1" />
|
||||||
|
</svg>
|
After Width: | Height: | Size: 415 B |
|
@ -0,0 +1,16 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
height="40"
|
||||||
|
width="40"
|
||||||
|
viewBox="0 0 40 40">
|
||||||
|
<rect
|
||||||
|
style="fill:#ffff00;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||||
|
width="33.76017"
|
||||||
|
height="33.76017"
|
||||||
|
x="3.119915"
|
||||||
|
y="3.119915" />
|
||||||
|
<path
|
||||||
|
d="m 20.677967,8.54499 c -7.342801,0 -13.295293,4.954293 -13.295293,11.065751 0,2.088793 0.3647173,3.484376 1.575539,5.150563 L 6.0267418,31.45501 13.560595,29.011117 c 2.221262,1.387962 4.125932,1.665377 7.117372,1.665377 7.3428,0 13.295291,-4.954295 13.295291,-11.065753 0,-6.111458 -5.952491,-11.065751 -13.295291,-11.065751 z"
|
||||||
|
style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:0.93031836;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 883 B |
|
@ -0,0 +1,26 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="40"
|
||||||
|
height="40"
|
||||||
|
viewBox="0 0 40 40">
|
||||||
|
<g
|
||||||
|
transform="translate(0,-60)"
|
||||||
|
id="layer1">
|
||||||
|
<rect
|
||||||
|
width="36.460953"
|
||||||
|
height="34.805603"
|
||||||
|
x="1.7695236"
|
||||||
|
y="62.597198"
|
||||||
|
style="fill:#ffff00;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.30826771;stroke-opacity:1" />
|
||||||
|
<g
|
||||||
|
transform="matrix(0.88763677,0,0,0.88763677,2.2472646,8.9890584)">
|
||||||
|
<path
|
||||||
|
d="M 20,64.526342 C 11.454135,64.526342 4.5263421,71.454135 4.5263421,80 4.5263421,88.545865 11.454135,95.473658 20,95.473658 28.545865,95.473658 35.473658,88.545865 35.473658,80 35.473658,71.454135 28.545865,64.526342 20,64.526342 z m -0.408738,9.488564 c 3.527079,0 6.393832,2.84061 6.393832,6.335441 0,3.494831 -2.866753,6.335441 -6.393832,6.335441 -3.527079,0 -6.393832,-2.84061 -6.393832,-6.335441 0,-3.494831 2.866753,-6.335441 6.393832,-6.335441 z"
|
||||||
|
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.02768445;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
|
||||||
|
<path
|
||||||
|
d="m 7.2335209,71.819938 4.9702591,4.161823 c -1.679956,2.581606 -1.443939,6.069592 0.159325,8.677725 l -5.1263071,3.424463 c 0.67516,1.231452 3.0166401,3.547686 4.2331971,4.194757 l 3.907728,-4.567277 c 2.541952,1.45975 5.730694,1.392161 8.438683,-0.12614 l 3.469517,6.108336 c 1.129779,-0.44367 4.742234,-3.449633 5.416358,-5.003859 l -5.46204,-4.415541 c 1.44319,-2.424098 1.651175,-5.267515 0.557303,-7.748623 l 5.903195,-3.833951 C 33.14257,71.704996 30.616217,69.018606 29.02952,67.99296 l -4.118813,4.981678 C 22.411934,71.205099 18.900853,70.937534 16.041319,72.32916 l -3.595408,-5.322091 c -1.345962,0.579488 -4.1293881,2.921233 -5.2123901,4.812869 z m 8.1010311,3.426672 c 2.75284,-2.446266 6.769149,-2.144694 9.048998,0.420874 2.279848,2.56557 2.113919,6.596919 -0.638924,9.043185 -2.752841,2.446267 -6.775754,2.13726 -9.055604,-0.428308 -2.279851,-2.565568 -2.107313,-6.589485 0.64553,-9.035751 z"
|
||||||
|
style="fill:#000000;fill-opacity:1;stroke:none" />
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 2.1 KiB |
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="64"
|
||||||
|
height="64"
|
||||||
|
viewBox="0 0 64 64">
|
||||||
|
<path
|
||||||
|
d="M 32.003143,1.4044602 57.432701,62.632577 6.5672991,62.627924 z"
|
||||||
|
style="fill:#ffff00;fill-opacity:0.94117647;fill-rule:nonzero;stroke:#000000;stroke-width:1.00493038;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
|
||||||
|
</svg>
|
After Width: | Height: | Size: 408 B |
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="64"
|
||||||
|
height="64"
|
||||||
|
viewBox="0 0 64 64">
|
||||||
|
<path
|
||||||
|
d="M 25.470843,9.4933766 C 25.30219,12.141818 30.139101,14.445969 34.704831,13.529144 40.62635,12.541995 41.398833,7.3856498 35.97505,5.777863 31.400921,4.1549155 25.157674,6.5445892 25.470843,9.4933766 z M 4.5246282,17.652051 C 4.068249,11.832873 9.2742983,5.9270407 18.437379,3.0977088 29.751911,-0.87185184 45.495663,1.4008022 53.603953,7.1104009 c 9.275765,6.1889221 7.158128,16.2079421 -3.171076,21.5939521 -1.784316,1.635815 -6.380222,1.21421 -7.068351,3.186186 -1.04003,0.972427 -1.288046,2.050158 -1.232864,3.168203 1.015111,2.000108 -3.831548,1.633216 -3.270553,3.759574 0.589477,5.264544 -0.179276,10.53738 -0.362842,15.806257 -0.492006,2.184998 1.163456,4.574232 -0.734888,6.610642 -2.482919,2.325184 -7.30604,2.189143 -9.193497,-0.274767 -2.733688,-1.740626 -8.254447,-3.615254 -6.104247,-6.339626 3.468112,-1.708686 -2.116197,-3.449897 0.431242,-5.080274 5.058402,-1.39256 -2.393215,-2.304318 -0.146889,-4.334645 3.069198,-0.977415 2.056986,-2.518352 -0.219121,-3.540397 1.876567,-1.807151 1.484149,-4.868919 -2.565455,-5.942205 0.150866,-1.805474 2.905737,-4.136876 -1.679967,-5.20493 C 10.260902,27.882167 4.6872697,22.95045 4.5245945,17.652051 z"
|
||||||
|
id="path604"
|
||||||
|
style="fill:#ffff00;fill-opacity:1;stroke:#000000;stroke-width:1.72665179;stroke-opacity:1" />
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.4 KiB |
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="64"
|
||||||
|
height="64"
|
||||||
|
viewBox="0 0 64 64">
|
||||||
|
<path
|
||||||
|
d="M 32.003143,10.913072 57.432701,53.086929 6.567299,53.083723 z"
|
||||||
|
id="path2985"
|
||||||
|
style="fill:#ffff00;fill-opacity:0.94117647;fill-rule:nonzero;stroke:#000000;stroke-width:0.83403099;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
|
||||||
|
</svg>
|
After Width: | Height: | Size: 426 B |
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="40"
|
||||||
|
height="40"
|
||||||
|
viewBox="0 0 40 40">
|
||||||
|
</svg>
|
After Width: | Height: | Size: 158 B |
|
@ -0,0 +1,42 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="40"
|
||||||
|
height="40"
|
||||||
|
viewBox="0 0 40 40">
|
||||||
|
<rect
|
||||||
|
width="36.075428"
|
||||||
|
height="31.096582"
|
||||||
|
x="1.962286"
|
||||||
|
y="4.4517088"
|
||||||
|
id="rect4"
|
||||||
|
style="fill:#ffff00;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.23004246;stroke-opacity:1" />
|
||||||
|
<rect
|
||||||
|
width="27.96859"
|
||||||
|
height="1.5012145"
|
||||||
|
x="6.0157046"
|
||||||
|
y="10.285"
|
||||||
|
id="rect6"
|
||||||
|
style="fill:#000000;fill-opacity:1;stroke:none" />
|
||||||
|
<rect
|
||||||
|
width="27.96859"
|
||||||
|
height="0.85783684"
|
||||||
|
x="6.0157056"
|
||||||
|
y="23.21689"
|
||||||
|
id="rect8"
|
||||||
|
style="fill:#000000;fill-opacity:1;stroke:none" />
|
||||||
|
<rect
|
||||||
|
width="27.96859"
|
||||||
|
height="0.85783684"
|
||||||
|
x="5.8130345"
|
||||||
|
y="28.964394"
|
||||||
|
id="rect10"
|
||||||
|
style="fill:#000000;fill-opacity:1;stroke:none" />
|
||||||
|
<rect
|
||||||
|
width="27.96859"
|
||||||
|
height="0.85783684"
|
||||||
|
x="6.0157046"
|
||||||
|
y="17.426493"
|
||||||
|
id="rect12"
|
||||||
|
style="fill:#000000;fill-opacity:1;stroke:none" />
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.0 KiB |
|
@ -0,0 +1,16 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="40"
|
||||||
|
height="40"
|
||||||
|
viewBox="0 0 40 40">
|
||||||
|
<rect
|
||||||
|
width="33.76017"
|
||||||
|
height="33.76017"
|
||||||
|
x="3.119915"
|
||||||
|
y="3.119915"
|
||||||
|
style="fill:#ffff00;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
|
||||||
|
<path
|
||||||
|
d="m 17.692678,34.50206 0,-16.182224 c -1.930515,-0.103225 -3.455824,-0.730383 -4.57593,-1.881473 -1.12011,-1.151067 -1.680164,-2.619596 -1.680164,-4.405591 0,-1.992435 0.621995,-3.5796849 1.865988,-4.7617553 1.243989,-1.1820288 3.06352,-1.7730536 5.458598,-1.7730764 l 9.802246,0 0,2.6789711 -2.229895,0 0,26.3251486 -2.632515,0 0,-26.3251486 -3.45324,0 0,26.3251486 z"
|
||||||
|
style="font-size:29.42051125px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:1.07795751;stroke-opacity:1;font-family:Arial;-inkscape-font-specification:Arial" />
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 199 B |
After Width: | Height: | Size: 304 B |
After Width: | Height: | Size: 193 B |
After Width: | Height: | Size: 296 B |
After Width: | Height: | Size: 193 B |
After Width: | Height: | Size: 296 B |
After Width: | Height: | Size: 199 B |
After Width: | Height: | Size: 304 B |
After Width: | Height: | Size: 326 B |
After Width: | Height: | Size: 326 B |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 403 B |
After Width: | Height: | Size: 933 B |
After Width: | Height: | Size: 179 B |
After Width: | Height: | Size: 266 B |
After Width: | Height: | Size: 301 B |
After Width: | Height: | Size: 583 B |
After Width: | Height: | Size: 175 B |
After Width: | Height: | Size: 276 B |
After Width: | Height: | Size: 360 B |
After Width: | Height: | Size: 731 B |
After Width: | Height: | Size: 359 B |
After Width: | Height: | Size: 714 B |
After Width: | Height: | Size: 290 B |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 174 B |
After Width: | Height: | Size: 260 B |
After Width: | Height: | Size: 259 B |
After Width: | Height: | Size: 425 B |
After Width: | Height: | Size: 108 B |
After Width: | Height: | Size: 152 B |
After Width: | Height: | Size: 295 B |
After Width: | Height: | Size: 550 B |
After Width: | Height: | Size: 242 B |
After Width: | Height: | Size: 398 B |
After Width: | Height: | Size: 238 B |
After Width: | Height: | Size: 396 B |
After Width: | Height: | Size: 245 B |
After Width: | Height: | Size: 405 B |
After Width: | Height: | Size: 246 B |
After Width: | Height: | Size: 403 B |
After Width: | Height: | Size: 321 B |
After Width: | Height: | Size: 586 B |
After Width: | Height: | Size: 257 B |
After Width: | Height: | Size: 464 B |
After Width: | Height: | Size: 309 B |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 246 B |
After Width: | Height: | Size: 456 B |
After Width: | Height: | Size: 243 B |
After Width: | Height: | Size: 458 B |
After Width: | Height: | Size: 225 B |
After Width: | Height: | Size: 344 B |
After Width: | Height: | Size: 225 B |
After Width: | Height: | Size: 331 B |
After Width: | Height: | Size: 384 B |
After Width: | Height: | Size: 871 B |
After Width: | Height: | Size: 177 B |
After Width: | Height: | Size: 394 B |
After Width: | Height: | Size: 178 B |
After Width: | Height: | Size: 331 B |
After Width: | Height: | Size: 185 B |
After Width: | Height: | Size: 220 B |
After Width: | Height: | Size: 136 B |
After Width: | Height: | Size: 160 B |
After Width: | Height: | Size: 88 B |
After Width: | Height: | Size: 109 B |
After Width: | Height: | Size: 183 B |
After Width: | Height: | Size: 205 B |
After Width: | Height: | Size: 128 B |
After Width: | Height: | Size: 149 B |
After Width: | Height: | Size: 125 B |
After Width: | Height: | Size: 172 B |
|
@ -0,0 +1,422 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<!--
|
||||||
|
Copyright 2012 Mozilla Foundation
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
|
||||||
|
Adobe CMap resources are covered by their own copyright but the same license:
|
||||||
|
|
||||||
|
Copyright 1990-2015 Adobe Systems Incorporated.
|
||||||
|
|
||||||
|
See https://github.com/adobe-type-tools/cmap-resources
|
||||||
|
-->
|
||||||
|
<html dir="ltr" mozdisallowselectionprint moznomarginboxes>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||||
|
<meta name="google" content="notranslate">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<title>PDF.js viewer</title>
|
||||||
|
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="viewer.css"/>
|
||||||
|
|
||||||
|
<script src="compatibility.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- This snippet is used in production (included from viewer.html) -->
|
||||||
|
<script src="../build/pdf.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script src="debugger.js"></script>
|
||||||
|
<script src="viewer.js"></script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body tabindex="1" class="loadingInProgress">
|
||||||
|
<div id="outerContainer">
|
||||||
|
|
||||||
|
<div id="sidebarContainer">
|
||||||
|
<div id="toolbarSidebar">
|
||||||
|
<div class="splitToolbarButton toggled">
|
||||||
|
<button id="viewThumbnail" class="toolbarButton group toggled" title="Show Thumbnails" tabindex="2" data-l10n-id="thumbs">
|
||||||
|
<span data-l10n-id="thumbs_label">Thumbnails</span>
|
||||||
|
</button>
|
||||||
|
<button id="viewOutline" class="toolbarButton group" title="Show Document Outline" tabindex="3" data-l10n-id="outline">
|
||||||
|
<span data-l10n-id="outline_label">Document Outline</span>
|
||||||
|
</button>
|
||||||
|
<button id="viewAttachments" class="toolbarButton group" title="Show Attachments" tabindex="4" data-l10n-id="attachments">
|
||||||
|
<span data-l10n-id="attachments_label">Attachments</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="sidebarContent">
|
||||||
|
<div id="thumbnailView">
|
||||||
|
</div>
|
||||||
|
<div id="outlineView" class="hidden">
|
||||||
|
</div>
|
||||||
|
<div id="attachmentsView" class="hidden">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div> <!-- sidebarContainer -->
|
||||||
|
|
||||||
|
<div id="mainContainer">
|
||||||
|
<div class="findbar hidden doorHanger hiddenSmallView" id="findbar">
|
||||||
|
<label for="findInput" class="toolbarLabel" data-l10n-id="find_label">Find:</label>
|
||||||
|
<input id="findInput" class="toolbarField" tabindex="91">
|
||||||
|
<div class="splitToolbarButton">
|
||||||
|
<button class="toolbarButton findPrevious" title="" id="findPrevious" tabindex="92" data-l10n-id="find_previous">
|
||||||
|
<span data-l10n-id="find_previous_label">Previous</span>
|
||||||
|
</button>
|
||||||
|
<div class="splitToolbarButtonSeparator"></div>
|
||||||
|
<button class="toolbarButton findNext" title="" id="findNext" tabindex="93" data-l10n-id="find_next">
|
||||||
|
<span data-l10n-id="find_next_label">Next</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<input type="checkbox" id="findHighlightAll" class="toolbarField" tabindex="94">
|
||||||
|
<label for="findHighlightAll" class="toolbarLabel" data-l10n-id="find_highlight">Highlight all</label>
|
||||||
|
<input type="checkbox" id="findMatchCase" class="toolbarField" tabindex="95">
|
||||||
|
<label for="findMatchCase" class="toolbarLabel" data-l10n-id="find_match_case_label">Match case</label>
|
||||||
|
<span id="findResultsCount" class="toolbarLabel hidden"></span>
|
||||||
|
<span id="findMsg" class="toolbarLabel"></span>
|
||||||
|
</div> <!-- findbar -->
|
||||||
|
|
||||||
|
<div id="secondaryToolbar" class="secondaryToolbar hidden doorHangerRight">
|
||||||
|
<div id="secondaryToolbarButtonContainer">
|
||||||
|
<button id="secondaryPresentationMode" class="secondaryToolbarButton presentationMode visibleLargeView" title="Switch to Presentation Mode" tabindex="51" data-l10n-id="presentation_mode">
|
||||||
|
<span data-l10n-id="presentation_mode_label">Presentation Mode</span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button id="secondaryOpenFile" class="secondaryToolbarButton openFile visibleLargeView" title="Open File" tabindex="52" data-l10n-id="open_file">
|
||||||
|
<span data-l10n-id="open_file_label">Open</span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button id="secondaryPrint" class="secondaryToolbarButton print visibleMediumView" title="Print" tabindex="53" data-l10n-id="print">
|
||||||
|
<span data-l10n-id="print_label">Print</span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button id="secondaryDownload" class="secondaryToolbarButton download visibleMediumView" title="Download" tabindex="54" data-l10n-id="download">
|
||||||
|
<span data-l10n-id="download_label">Download</span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<a href="#" id="secondaryViewBookmark" class="secondaryToolbarButton bookmark visibleSmallView" title="Current view (copy or open in new window)" tabindex="55" data-l10n-id="bookmark">
|
||||||
|
<span data-l10n-id="bookmark_label">Current View</span>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<div class="horizontalToolbarSeparator visibleLargeView"></div>
|
||||||
|
|
||||||
|
<button id="firstPage" class="secondaryToolbarButton firstPage" title="Go to First Page" tabindex="56" data-l10n-id="first_page">
|
||||||
|
<span data-l10n-id="first_page_label">Go to First Page</span>
|
||||||
|
</button>
|
||||||
|
<button id="lastPage" class="secondaryToolbarButton lastPage" title="Go to Last Page" tabindex="57" data-l10n-id="last_page">
|
||||||
|
<span data-l10n-id="last_page_label">Go to Last Page</span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<div class="horizontalToolbarSeparator"></div>
|
||||||
|
|
||||||
|
<button id="pageRotateCw" class="secondaryToolbarButton rotateCw" title="Rotate Clockwise" tabindex="58" data-l10n-id="page_rotate_cw">
|
||||||
|
<span data-l10n-id="page_rotate_cw_label">Rotate Clockwise</span>
|
||||||
|
</button>
|
||||||
|
<button id="pageRotateCcw" class="secondaryToolbarButton rotateCcw" title="Rotate Counterclockwise" tabindex="59" data-l10n-id="page_rotate_ccw">
|
||||||
|
<span data-l10n-id="page_rotate_ccw_label">Rotate Counterclockwise</span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<div class="horizontalToolbarSeparator"></div>
|
||||||
|
|
||||||
|
<button id="toggleHandTool" class="secondaryToolbarButton handTool" title="Enable hand tool" tabindex="60" data-l10n-id="hand_tool_enable">
|
||||||
|
<span data-l10n-id="hand_tool_enable_label">Enable hand tool</span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<div class="horizontalToolbarSeparator"></div>
|
||||||
|
|
||||||
|
<button id="documentProperties" class="secondaryToolbarButton documentProperties" title="Document Properties…" tabindex="61" data-l10n-id="document_properties">
|
||||||
|
<span data-l10n-id="document_properties_label">Document Properties…</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div> <!-- secondaryToolbar -->
|
||||||
|
|
||||||
|
<div class="toolbar">
|
||||||
|
<div id="toolbarContainer">
|
||||||
|
<div id="toolbarViewer">
|
||||||
|
<div id="toolbarViewerLeft">
|
||||||
|
<button id="sidebarToggle" class="toolbarButton" title="Toggle Sidebar" tabindex="11" data-l10n-id="toggle_sidebar">
|
||||||
|
<span data-l10n-id="toggle_sidebar_label">Toggle Sidebar</span>
|
||||||
|
</button>
|
||||||
|
<div class="toolbarButtonSpacer"></div>
|
||||||
|
<button id="viewFind" class="toolbarButton group hiddenSmallView" title="Find in Document" tabindex="12" data-l10n-id="findbar">
|
||||||
|
<span data-l10n-id="findbar_label">Find</span>
|
||||||
|
</button>
|
||||||
|
<div class="splitToolbarButton">
|
||||||
|
<button class="toolbarButton pageUp" title="Previous Page" id="previous" tabindex="13" data-l10n-id="previous">
|
||||||
|
<span data-l10n-id="previous_label">Previous</span>
|
||||||
|
</button>
|
||||||
|
<div class="splitToolbarButtonSeparator"></div>
|
||||||
|
<button class="toolbarButton pageDown" title="Next Page" id="next" tabindex="14" data-l10n-id="next">
|
||||||
|
<span data-l10n-id="next_label">Next</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<label id="pageNumberLabel" class="toolbarLabel" for="pageNumber" data-l10n-id="page_label">Page: </label>
|
||||||
|
<input type="number" id="pageNumber" class="toolbarField pageNumber" value="1" size="4" min="1" tabindex="15">
|
||||||
|
<span id="numPages" class="toolbarLabel"></span>
|
||||||
|
</div>
|
||||||
|
<div id="toolbarViewerRight">
|
||||||
|
<button id="presentationMode" class="toolbarButton presentationMode hiddenLargeView" title="Switch to Presentation Mode" tabindex="31" data-l10n-id="presentation_mode">
|
||||||
|
<span data-l10n-id="presentation_mode_label">Presentation Mode</span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button id="openFile" class="toolbarButton openFile hiddenLargeView" title="Open File" tabindex="32" data-l10n-id="open_file">
|
||||||
|
<span data-l10n-id="open_file_label">Open</span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button id="print" class="toolbarButton print hiddenMediumView" title="Print" tabindex="33" data-l10n-id="print">
|
||||||
|
<span data-l10n-id="print_label">Print</span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button id="download" class="toolbarButton download hiddenMediumView" title="Download" tabindex="34" data-l10n-id="download">
|
||||||
|
<span data-l10n-id="download_label">Download</span>
|
||||||
|
</button>
|
||||||
|
<a href="#" id="viewBookmark" class="toolbarButton bookmark hiddenSmallView" title="Current view (copy or open in new window)" tabindex="35" data-l10n-id="bookmark">
|
||||||
|
<span data-l10n-id="bookmark_label">Current View</span>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<div class="verticalToolbarSeparator hiddenSmallView"></div>
|
||||||
|
|
||||||
|
<button id="secondaryToolbarToggle" class="toolbarButton" title="Tools" tabindex="36" data-l10n-id="tools">
|
||||||
|
<span data-l10n-id="tools_label">Tools</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="outerCenter">
|
||||||
|
<div class="innerCenter" id="toolbarViewerMiddle">
|
||||||
|
<div class="splitToolbarButton">
|
||||||
|
<button id="zoomOut" class="toolbarButton zoomOut" title="Zoom Out" tabindex="21" data-l10n-id="zoom_out">
|
||||||
|
<span data-l10n-id="zoom_out_label">Zoom Out</span>
|
||||||
|
</button>
|
||||||
|
<div class="splitToolbarButtonSeparator"></div>
|
||||||
|
<button id="zoomIn" class="toolbarButton zoomIn" title="Zoom In" tabindex="22" data-l10n-id="zoom_in">
|
||||||
|
<span data-l10n-id="zoom_in_label">Zoom In</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<span id="scaleSelectContainer" class="dropdownToolbarButton">
|
||||||
|
<select id="scaleSelect" title="Zoom" tabindex="23" data-l10n-id="zoom">
|
||||||
|
<option id="pageAutoOption" title="" value="auto" selected="selected" data-l10n-id="page_scale_auto">Automatic Zoom</option>
|
||||||
|
<option id="pageActualOption" title="" value="page-actual" data-l10n-id="page_scale_actual">Actual Size</option>
|
||||||
|
<option id="pageFitOption" title="" value="page-fit" data-l10n-id="page_scale_fit">Fit Page</option>
|
||||||
|
<option id="pageWidthOption" title="" value="page-width" data-l10n-id="page_scale_width">Full Width</option>
|
||||||
|
<option id="customScaleOption" title="" value="custom"></option>
|
||||||
|
<option title="" value="0.5" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 50 }'>50%</option>
|
||||||
|
<option title="" value="0.75" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 75 }'>75%</option>
|
||||||
|
<option title="" value="1" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 100 }'>100%</option>
|
||||||
|
<option title="" value="1.25" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 125 }'>125%</option>
|
||||||
|
<option title="" value="1.5" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 150 }'>150%</option>
|
||||||
|
<option title="" value="2" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 200 }'>200%</option>
|
||||||
|
<option title="" value="3" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 300 }'>300%</option>
|
||||||
|
<option title="" value="4" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 400 }'>400%</option>
|
||||||
|
</select>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="loadingBar">
|
||||||
|
<div class="progress">
|
||||||
|
<div class="glimmer">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<menu type="context" id="viewerContextMenu">
|
||||||
|
<menuitem id="contextFirstPage" label="First Page"
|
||||||
|
data-l10n-id="first_page"></menuitem>
|
||||||
|
<menuitem id="contextLastPage" label="Last Page"
|
||||||
|
data-l10n-id="last_page"></menuitem>
|
||||||
|
<menuitem id="contextPageRotateCw" label="Rotate Clockwise"
|
||||||
|
data-l10n-id="page_rotate_cw"></menuitem>
|
||||||
|
<menuitem id="contextPageRotateCcw" label="Rotate Counter-Clockwise"
|
||||||
|
data-l10n-id="page_rotate_ccw"></menuitem>
|
||||||
|
</menu>
|
||||||
|
|
||||||
|
<div id="viewerContainer" tabindex="0">
|
||||||
|
<div id="viewer" class="pdfViewer"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="errorWrapper" hidden='true'>
|
||||||
|
<div id="errorMessageLeft">
|
||||||
|
<span id="errorMessage"></span>
|
||||||
|
<button id="errorShowMore" data-l10n-id="error_more_info">
|
||||||
|
More Information
|
||||||
|
</button>
|
||||||
|
<button id="errorShowLess" data-l10n-id="error_less_info" hidden='true'>
|
||||||
|
Less Information
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div id="errorMessageRight">
|
||||||
|
<button id="errorClose" data-l10n-id="error_close">
|
||||||
|
Close
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="clearBoth"></div>
|
||||||
|
<textarea id="errorMoreInfo" hidden='true' readonly="readonly"></textarea>
|
||||||
|
</div>
|
||||||
|
</div> <!-- mainContainer -->
|
||||||
|
|
||||||
|
<div id="overlayContainer" class="hidden">
|
||||||
|
<div id="passwordOverlay" class="container hidden">
|
||||||
|
<div class="dialog">
|
||||||
|
<div class="row">
|
||||||
|
<p id="passwordText" data-l10n-id="password_label">Enter the password to open this PDF file:</p>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<!-- The type="password" attribute is set via script, to prevent warnings in Firefox for all http:// documents. -->
|
||||||
|
<input id="password" class="toolbarField" />
|
||||||
|
</div>
|
||||||
|
<div class="buttonRow">
|
||||||
|
<button id="passwordCancel" class="overlayButton"><span data-l10n-id="password_cancel">Cancel</span></button>
|
||||||
|
<button id="passwordSubmit" class="overlayButton"><span data-l10n-id="password_ok">OK</span></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="documentPropertiesOverlay" class="container hidden">
|
||||||
|
<div class="dialog">
|
||||||
|
<div class="row">
|
||||||
|
<span data-l10n-id="document_properties_file_name">File name:</span> <p id="fileNameField">-</p>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<span data-l10n-id="document_properties_file_size">File size:</span> <p id="fileSizeField">-</p>
|
||||||
|
</div>
|
||||||
|
<div class="separator"></div>
|
||||||
|
<div class="row">
|
||||||
|
<span data-l10n-id="document_properties_title">Title:</span> <p id="titleField">-</p>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<span data-l10n-id="document_properties_author">Author:</span> <p id="authorField">-</p>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<span data-l10n-id="document_properties_subject">Subject:</span> <p id="subjectField">-</p>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<span data-l10n-id="document_properties_keywords">Keywords:</span> <p id="keywordsField">-</p>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<span data-l10n-id="document_properties_creation_date">Creation Date:</span> <p id="creationDateField">-</p>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<span data-l10n-id="document_properties_modification_date">Modification Date:</span> <p id="modificationDateField">-</p>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<span data-l10n-id="document_properties_creator">Creator:</span> <p id="creatorField">-</p>
|
||||||
|
</div>
|
||||||
|
<div class="separator"></div>
|
||||||
|
<div class="row">
|
||||||
|
<span data-l10n-id="document_properties_producer">PDF Producer:</span> <p id="producerField">-</p>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<span data-l10n-id="document_properties_version">PDF Version:</span> <p id="versionField">-</p>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<span data-l10n-id="document_properties_page_count">Page Count:</span> <p id="pageCountField">-</p>
|
||||||
|
</div>
|
||||||
|
<div class="buttonRow">
|
||||||
|
<button id="documentPropertiesClose" class="overlayButton"><span data-l10n-id="document_properties_close">Close</span></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div> <!-- overlayContainer -->
|
||||||
|
|
||||||
|
</div> <!-- outerContainer -->
|
||||||
|
<div id="printContainer"></div>
|
||||||
|
<div id="mozPrintCallback-shim" hidden>
|
||||||
|
<style>
|
||||||
|
@media print {
|
||||||
|
#printContainer div {
|
||||||
|
page-break-after: always;
|
||||||
|
page-break-inside: avoid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<style scoped>
|
||||||
|
#mozPrintCallback-shim {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
z-index: 9999999;
|
||||||
|
|
||||||
|
display: block;
|
||||||
|
text-align: center;
|
||||||
|
background-color: rgba(0, 0, 0, 0.5);
|
||||||
|
}
|
||||||
|
#mozPrintCallback-shim[hidden] {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
@media print {
|
||||||
|
#mozPrintCallback-shim {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#mozPrintCallback-shim .mozPrintCallback-dialog-box {
|
||||||
|
display: inline-block;
|
||||||
|
margin: -50px auto 0;
|
||||||
|
position: relative;
|
||||||
|
top: 45%;
|
||||||
|
left: 0;
|
||||||
|
min-width: 220px;
|
||||||
|
max-width: 400px;
|
||||||
|
|
||||||
|
padding: 9px;
|
||||||
|
|
||||||
|
border: 1px solid hsla(0, 0%, 0%, .5);
|
||||||
|
border-radius: 2px;
|
||||||
|
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
|
||||||
|
|
||||||
|
background-color: #474747;
|
||||||
|
|
||||||
|
color: hsl(0, 0%, 85%);
|
||||||
|
font-size: 16px;
|
||||||
|
line-height: 20px;
|
||||||
|
}
|
||||||
|
#mozPrintCallback-shim .progress-row {
|
||||||
|
clear: both;
|
||||||
|
padding: 1em 0;
|
||||||
|
}
|
||||||
|
#mozPrintCallback-shim progress {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
#mozPrintCallback-shim .relative-progress {
|
||||||
|
clear: both;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
#mozPrintCallback-shim .progress-actions {
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div class="mozPrintCallback-dialog-box">
|
||||||
|
<!-- TODO: Localise the following strings -->
|
||||||
|
Preparing document for printing...
|
||||||
|
<div class="progress-row">
|
||||||
|
<progress value="0" max="100"></progress>
|
||||||
|
<span class="relative-progress">0%</span>
|
||||||
|
</div>
|
||||||
|
<div class="progress-actions">
|
||||||
|
<input type="button" value="Cancel" class="mozPrintCallback-cancel">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
|
@ -70,7 +70,6 @@ func Home(ctx *context.Context) {
|
||||||
ctx.Handle(404, "repo.Home", nil)
|
ctx.Handle(404, "repo.Home", nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if entry != nil && !entry.IsDir() {
|
if entry != nil && !entry.IsDir() {
|
||||||
blob := entry.Blob()
|
blob := entry.Blob()
|
||||||
|
|
||||||
|
@ -92,9 +91,12 @@ func Home(ctx *context.Context) {
|
||||||
|
|
||||||
_, isTextFile := base.IsTextFile(buf)
|
_, isTextFile := base.IsTextFile(buf)
|
||||||
_, isImageFile := base.IsImageFile(buf)
|
_, isImageFile := base.IsImageFile(buf)
|
||||||
|
_, isPDFFile := base.IsPDFFile(buf)
|
||||||
ctx.Data["IsFileText"] = isTextFile
|
ctx.Data["IsFileText"] = isTextFile
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
|
case isPDFFile:
|
||||||
|
ctx.Data["IsPDFFile"] = true
|
||||||
case isImageFile:
|
case isImageFile:
|
||||||
ctx.Data["IsImageFile"] = true
|
ctx.Data["IsImageFile"] = true
|
||||||
case isTextFile:
|
case isTextFile:
|
||||||
|
|
|
@ -31,6 +31,8 @@
|
||||||
<div class="view-raw ui center">
|
<div class="view-raw ui center">
|
||||||
{{if .IsImageFile}}
|
{{if .IsImageFile}}
|
||||||
<img src="{{EscapePound .FileLink}}">
|
<img src="{{EscapePound .FileLink}}">
|
||||||
|
{{else if .IsPDFFile}}
|
||||||
|
<iframe width="100%" height="600px" src="{{AppSubUrl}}/plugins/pdfjs-1.4.20/web/viewer.html?file={{EscapePound .FileLink}}"></iframe>
|
||||||
{{else}}
|
{{else}}
|
||||||
<a href="{{EscapePound .FileLink}}" rel="nofollow" class="btn btn-gray btn-radius">{{.i18n.Tr "repo.file_view_raw"}}</a>
|
<a href="{{EscapePound .FileLink}}" rel="nofollow" class="btn btn-gray btn-radius">{{.i18n.Tr "repo.file_view_raw"}}</a>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|