@ -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'); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
})(); |
After Width: | Height: | Size: 415 B |
After Width: | Height: | Size: 883 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 408 B |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 426 B |
After Width: | Height: | Size: 158 B |
After Width: | Height: | Size: 1.0 KiB |
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> |
||||||
|
|