зеркало из https://github.com/mozilla/gecko-dev.git
Bug 789615 - Update pdf.js to version 0.5.22. r=Mossop
This commit is contained in:
Родитель
0c4755bc0c
Коммит
acbf52caca
|
@ -1,34 +1,178 @@
|
|||
|
||||
Copyright (c) 2011 Mozilla Foundation
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
Contributors: Andreas Gal <gal@mozilla.com>
|
||||
Chris G Jones <cjones@mozilla.com>
|
||||
Shaon Barman <shaon.barman@gmail.com>
|
||||
Vivien Nicolas <21@vingtetun.org>
|
||||
Justin D'Arcangelo <justindarc@gmail.com>
|
||||
Yury Delendik
|
||||
Kalervo Kujala
|
||||
Adil Allawi <@ironymark>
|
||||
Jakob Miland <saebekassebil@gmail.com>
|
||||
Artur Adib <aadib@mozilla.com>
|
||||
Brendan Dahl <bdahl@mozilla.com>
|
||||
David Quintana <gigaherz@gmail.com>
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
1. Definitions.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
"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
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
This is the pdf.js project output, https://github.com/mozilla/pdf.js
|
||||
|
||||
Current extension version is: 0.4.11
|
||||
Current extension version is: 0.5.22
|
||||
|
||||
|
|
|
@ -1,5 +1,19 @@
|
|||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
|
|
|
@ -1,3 +1,18 @@
|
|||
/* 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.
|
||||
*/
|
||||
|
||||
var EXPORTED_SYMBOLS = ["PdfJs"];
|
||||
|
||||
const Cc = Components.classes;
|
||||
|
|
|
@ -1,5 +1,19 @@
|
|||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
|
|
|
@ -1,3 +1,18 @@
|
|||
/* 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.
|
||||
*/
|
||||
|
||||
* {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
|
@ -29,29 +44,17 @@ select {
|
|||
|
||||
#viewerContainer:-webkit-full-screen {
|
||||
top: 0px;
|
||||
padding-top: 6px;
|
||||
padding-bottom: 24px;
|
||||
border-top: 5px solid transparent;
|
||||
background-color: #404040;
|
||||
background-image: url(images/texture.png);
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
:-webkit-full-screen #viewer {
|
||||
margin: 0pt;
|
||||
padding: 0pt;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
:-webkit-full-screen .page {
|
||||
margin: 0px auto;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
#viewerContainer:-moz-full-screen {
|
||||
top: 0px;
|
||||
border-top: 5px solid transparent;
|
||||
background-color: #404040;
|
||||
background-image: url(images/texture.png);
|
||||
width: 100%;
|
||||
|
@ -59,6 +62,10 @@ select {
|
|||
overflow: hidden;
|
||||
}
|
||||
|
||||
:-webkit-full-screen .page:last-child {
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
:-moz-full-screen .page:last-child {
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
@ -760,9 +767,9 @@ html[dir='rtl'] .toolbarButton.pageDown::before {
|
|||
}
|
||||
|
||||
#thumbnailView {
|
||||
position: fixed;
|
||||
position: absolute;
|
||||
width: 120px;
|
||||
top: 33px;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
padding: 10px 40px 0;
|
||||
overflow: auto;
|
||||
|
@ -771,8 +778,6 @@ html[dir='rtl'] .toolbarButton.pageDown::before {
|
|||
.thumbnail {
|
||||
margin-bottom: 15px;
|
||||
float: left;
|
||||
width: 114px;
|
||||
height: 142px;
|
||||
}
|
||||
|
||||
.thumbnail:not([data-loaded]) {
|
||||
|
@ -825,9 +830,9 @@ a:focus > .thumbnail > .thumbnailSelectionRing,
|
|||
}
|
||||
|
||||
#outlineView {
|
||||
position: fixed;
|
||||
position: absolute;
|
||||
width: 192px;
|
||||
top: 33px;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
padding: 4px 4px 0;
|
||||
overflow: auto;
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,5 +1,19 @@
|
|||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -21,6 +35,7 @@ var RenderingStates = {
|
|||
FINISHED: 3
|
||||
};
|
||||
|
||||
PDFJS.workerSrc = '../build/pdf.js';
|
||||
|
||||
var mozL10n = document.mozL10n || document.webL10n;
|
||||
|
||||
|
@ -33,6 +48,19 @@ function getFileName(url) {
|
|||
return url.substring(url.lastIndexOf('/', end) + 1, end);
|
||||
}
|
||||
|
||||
function scrollIntoView(element, spot) {
|
||||
var parent = element.offsetParent, offsetY = element.offsetTop;
|
||||
while (parent.clientHeight == parent.scrollHeight) {
|
||||
offsetY += parent.offsetTop;
|
||||
parent = parent.offsetParent;
|
||||
if (!parent)
|
||||
return; // no need to scroll
|
||||
}
|
||||
if (spot)
|
||||
offsetY += spot.top;
|
||||
parent.scrollTop = offsetY;
|
||||
}
|
||||
|
||||
var Cache = function cacheCache(size) {
|
||||
var data = [];
|
||||
this.push = function cachePush(view) {
|
||||
|
@ -98,6 +126,21 @@ var ProgressBar = (function ProgressBarClosure() {
|
|||
return ProgressBar;
|
||||
})();
|
||||
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
var FirefoxCom = (function FirefoxComClosure() {
|
||||
return {
|
||||
/**
|
||||
|
@ -242,6 +285,7 @@ var PDFView = {
|
|||
thumbnailViewScroll: null,
|
||||
isFullscreen: false,
|
||||
previousScale: null,
|
||||
pageRotation: 0,
|
||||
|
||||
// called once when the document is loaded
|
||||
initialize: function pdfViewInitialize() {
|
||||
|
@ -431,7 +475,13 @@ var PDFView = {
|
|||
|
||||
setTitleUsingUrl: function pdfViewSetTitleUsingUrl(url) {
|
||||
this.url = url;
|
||||
document.title = decodeURIComponent(getFileName(url)) || url;
|
||||
try {
|
||||
document.title = decodeURIComponent(getFileName(url)) || url;
|
||||
} catch (e) {
|
||||
// decodeURIComponent may throw URIError,
|
||||
// fall back to using the unprocessed url in that case
|
||||
document.title = url;
|
||||
}
|
||||
},
|
||||
|
||||
open: function pdfViewOpen(url, scale, password) {
|
||||
|
@ -674,6 +724,8 @@ var PDFView = {
|
|||
storedHash = 'page=' + page + '&zoom=' + zoom + ',' + left + ',' + top;
|
||||
}
|
||||
|
||||
this.pageRotation = 0;
|
||||
|
||||
var pages = this.pages = [];
|
||||
this.pageText = [];
|
||||
this.startedTextExtraction = false;
|
||||
|
@ -1147,6 +1199,34 @@ var PDFView = {
|
|||
this.isFullscreen = false;
|
||||
this.parseScale(this.previousScale);
|
||||
this.page = this.page;
|
||||
},
|
||||
|
||||
rotatePages: function pdfViewPageRotation(delta) {
|
||||
|
||||
this.pageRotation = (this.pageRotation + 360 + delta) % 360;
|
||||
|
||||
for (var i = 0, l = this.pages.length; i < l; i++) {
|
||||
var page = this.pages[i];
|
||||
page.update(page.scale, this.pageRotation);
|
||||
}
|
||||
|
||||
for (var i = 0, l = this.thumbnails.length; i < l; i++) {
|
||||
var thumb = this.thumbnails[i];
|
||||
thumb.updateRotation(this.pageRotation);
|
||||
}
|
||||
|
||||
var currentPage = this.pages[this.page - 1];
|
||||
|
||||
if (this.isFullscreen) {
|
||||
this.parseScale('page-fit', true);
|
||||
}
|
||||
|
||||
this.renderHighestPriority();
|
||||
|
||||
// Wait for fullscreen to take effect
|
||||
setTimeout(function() {
|
||||
currentPage.scrollIntoView();
|
||||
}, 0);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1155,8 +1235,9 @@ var PageView = function pageView(container, pdfPage, id, scale,
|
|||
this.id = id;
|
||||
this.pdfPage = pdfPage;
|
||||
|
||||
this.rotation = 0;
|
||||
this.scale = scale || 1.0;
|
||||
this.viewport = this.pdfPage.getViewport(this.scale);
|
||||
this.viewport = this.pdfPage.getViewport(this.scale, this.pdfPage.rotate);
|
||||
|
||||
this.renderingState = RenderingStates.INITIAL;
|
||||
this.resume = null;
|
||||
|
@ -1167,6 +1248,8 @@ var PageView = function pageView(container, pdfPage, id, scale,
|
|||
var div = this.el = document.createElement('div');
|
||||
div.id = 'pageContainer' + this.id;
|
||||
div.className = 'page';
|
||||
div.style.width = this.viewport.width + 'px';
|
||||
div.style.height = this.viewport.height + 'px';
|
||||
|
||||
container.appendChild(anchor);
|
||||
container.appendChild(div);
|
||||
|
@ -1176,12 +1259,18 @@ var PageView = function pageView(container, pdfPage, id, scale,
|
|||
this.pdfPage.destroy();
|
||||
};
|
||||
|
||||
this.update = function pageViewUpdate(scale) {
|
||||
this.update = function pageViewUpdate(scale, rotation) {
|
||||
this.renderingState = RenderingStates.INITIAL;
|
||||
this.resume = null;
|
||||
|
||||
if (typeof rotation !== 'undefined') {
|
||||
this.rotation = rotation;
|
||||
}
|
||||
|
||||
this.scale = scale || this.scale;
|
||||
var viewport = this.pdfPage.getViewport(this.scale);
|
||||
|
||||
var totalRotation = (this.rotation + this.pdfPage.rotate) % 360;
|
||||
var viewport = this.pdfPage.getViewport(this.scale, totalRotation);
|
||||
|
||||
this.viewport = viewport;
|
||||
div.style.width = viewport.width + 'px';
|
||||
|
@ -1310,7 +1399,7 @@ var PageView = function pageView(container, pdfPage, id, scale,
|
|||
|
||||
this.scrollIntoView = function pageViewScrollIntoView(dest) {
|
||||
if (!dest) {
|
||||
div.scrollIntoView(true);
|
||||
scrollIntoView(div);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1369,16 +1458,7 @@ var PageView = function pageView(container, pdfPage, id, scale,
|
|||
var width = Math.abs(boundingRect[0][0] - boundingRect[1][0]);
|
||||
var height = Math.abs(boundingRect[0][1] - boundingRect[1][1]);
|
||||
|
||||
// using temporary div to scroll it into view
|
||||
var tempDiv = document.createElement('div');
|
||||
tempDiv.style.position = 'absolute';
|
||||
tempDiv.style.left = Math.floor(x) + 'px';
|
||||
tempDiv.style.top = Math.floor(y) + 'px';
|
||||
tempDiv.style.width = Math.ceil(width) + 'px';
|
||||
tempDiv.style.height = Math.ceil(height) + 'px';
|
||||
div.appendChild(tempDiv);
|
||||
tempDiv.scrollIntoView(true);
|
||||
div.removeChild(tempDiv);
|
||||
scrollIntoView(div, {left: x, top: y, width: width, height: height});
|
||||
}, 0);
|
||||
};
|
||||
|
||||
|
@ -1521,7 +1601,9 @@ var ThumbnailView = function thumbnailView(container, pdfPage, id) {
|
|||
return false;
|
||||
};
|
||||
|
||||
var viewport = pdfPage.getViewport(1);
|
||||
var rotation = 0;
|
||||
var totalRotation = (rotation + pdfPage.rotate) % 360;
|
||||
var viewport = pdfPage.getViewport(1, totalRotation);
|
||||
var pageWidth = this.width = viewport.width;
|
||||
var pageHeight = this.height = viewport.height;
|
||||
var pageRatio = pageWidth / pageHeight;
|
||||
|
@ -1536,12 +1618,41 @@ var ThumbnailView = function thumbnailView(container, pdfPage, id) {
|
|||
div.id = 'thumbnailContainer' + id;
|
||||
div.className = 'thumbnail';
|
||||
|
||||
var ring = document.createElement('div');
|
||||
ring.className = 'thumbnailSelectionRing';
|
||||
ring.style.width = canvasWidth + 'px';
|
||||
ring.style.height = canvasHeight + 'px';
|
||||
|
||||
div.appendChild(ring);
|
||||
anchor.appendChild(div);
|
||||
container.appendChild(anchor);
|
||||
|
||||
this.hasImage = false;
|
||||
this.renderingState = RenderingStates.INITIAL;
|
||||
|
||||
this.updateRotation = function(rot) {
|
||||
|
||||
rotation = rot;
|
||||
totalRotation = (rotation + pdfPage.rotate) % 360;
|
||||
viewport = pdfPage.getViewport(1, totalRotation);
|
||||
pageWidth = this.width = viewport.width;
|
||||
pageHeight = this.height = viewport.height;
|
||||
pageRatio = pageWidth / pageHeight;
|
||||
|
||||
canvasHeight = canvasWidth / this.width * this.height;
|
||||
scaleX = this.scaleX = (canvasWidth / pageWidth);
|
||||
scaleY = this.scaleY = (canvasHeight / pageHeight);
|
||||
|
||||
div.removeAttribute('data-loaded');
|
||||
ring.textContent = '';
|
||||
ring.style.width = canvasWidth + 'px';
|
||||
ring.style.height = canvasHeight + 'px';
|
||||
|
||||
this.hasImage = false;
|
||||
this.renderingState = RenderingStates.INITIAL;
|
||||
this.resume = null;
|
||||
}
|
||||
|
||||
function getPageDrawContext() {
|
||||
var canvas = document.createElement('canvas');
|
||||
canvas.id = 'thumbnail' + id;
|
||||
|
@ -1555,10 +1666,7 @@ var ThumbnailView = function thumbnailView(container, pdfPage, id) {
|
|||
|
||||
div.setAttribute('data-loaded', true);
|
||||
|
||||
var ring = document.createElement('div');
|
||||
ring.className = 'thumbnailSelectionRing';
|
||||
ring.appendChild(canvas);
|
||||
div.appendChild(ring);
|
||||
|
||||
var ctx = canvas.getContext('2d');
|
||||
ctx.save();
|
||||
|
@ -1584,7 +1692,7 @@ var ThumbnailView = function thumbnailView(container, pdfPage, id) {
|
|||
|
||||
var self = this;
|
||||
var ctx = getPageDrawContext();
|
||||
var drawViewport = pdfPage.getViewport(scaleX);
|
||||
var drawViewport = pdfPage.getViewport(scaleX, totalRotation);
|
||||
var renderContext = {
|
||||
canvasContext: ctx,
|
||||
viewport: drawViewport,
|
||||
|
@ -1890,6 +1998,93 @@ document.addEventListener('DOMContentLoaded', function webViewerLoad(evt) {
|
|||
PDFView.renderHighestPriority();
|
||||
});
|
||||
|
||||
document.getElementById('viewThumbnail').addEventListener('click',
|
||||
function() {
|
||||
PDFView.switchSidebarView('thumbs');
|
||||
});
|
||||
|
||||
document.getElementById('viewOutline').addEventListener('click',
|
||||
function() {
|
||||
PDFView.switchSidebarView('outline');
|
||||
});
|
||||
|
||||
document.getElementById('viewSearch').addEventListener('click',
|
||||
function() {
|
||||
PDFView.switchSidebarView('search');
|
||||
});
|
||||
|
||||
document.getElementById('searchButton').addEventListener('click',
|
||||
function() {
|
||||
PDFView.search();
|
||||
});
|
||||
|
||||
document.getElementById('previous').addEventListener('click',
|
||||
function() {
|
||||
PDFView.page--;
|
||||
});
|
||||
|
||||
document.getElementById('next').addEventListener('click',
|
||||
function() {
|
||||
PDFView.page++;
|
||||
});
|
||||
|
||||
document.querySelector('.zoomIn').addEventListener('click',
|
||||
function() {
|
||||
PDFView.zoomIn();
|
||||
});
|
||||
|
||||
document.querySelector('.zoomOut').addEventListener('click',
|
||||
function() {
|
||||
PDFView.zoomOut();
|
||||
});
|
||||
|
||||
document.getElementById('fullscreen').addEventListener('click',
|
||||
function() {
|
||||
PDFView.fullscreen();
|
||||
});
|
||||
|
||||
document.getElementById('openFile').addEventListener('click',
|
||||
function() {
|
||||
document.getElementById('fileInput').click();
|
||||
});
|
||||
|
||||
document.getElementById('print').addEventListener('click',
|
||||
function() {
|
||||
window.print();
|
||||
});
|
||||
|
||||
document.getElementById('download').addEventListener('click',
|
||||
function() {
|
||||
PDFView.download();
|
||||
});
|
||||
|
||||
document.getElementById('searchTermsInput').addEventListener('keydown',
|
||||
function() {
|
||||
if (event.keyCode == 13) {
|
||||
PDFView.search();
|
||||
}
|
||||
});
|
||||
|
||||
document.getElementById('pageNumber').addEventListener('change',
|
||||
function() {
|
||||
PDFView.page = this.value;
|
||||
});
|
||||
|
||||
document.getElementById('scaleSelect').addEventListener('change',
|
||||
function() {
|
||||
PDFView.parseScale(this.value);
|
||||
});
|
||||
|
||||
document.getElementById('page_rotate_ccw').addEventListener('click',
|
||||
function() {
|
||||
PDFView.rotatePages(-90);
|
||||
});
|
||||
|
||||
document.getElementById('page_rotate_cw').addEventListener('click',
|
||||
function() {
|
||||
PDFView.rotatePages(90);
|
||||
});
|
||||
|
||||
if (FirefoxCom.requestSync('getLoadingType') == 'passive') {
|
||||
PDFView.setTitleUsingUrl(file);
|
||||
PDFView.initPassiveLoading();
|
||||
|
@ -2050,7 +2245,7 @@ window.addEventListener('pagechange', function pagechange(evt) {
|
|||
var last = numVisibleThumbs > 1 ?
|
||||
visibleThumbs.last.id : first;
|
||||
if (page <= first || page >= last)
|
||||
thumbnail.scrollIntoView();
|
||||
scrollIntoView(thumbnail);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2137,6 +2332,18 @@ window.addEventListener('keydown', function keydown(evt) {
|
|||
handled = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case 82: // 'r'
|
||||
PDFView.rotatePages(90);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (cmd == 4) { // shift-key
|
||||
switch (evt.keyCode) {
|
||||
case 82: // 'r'
|
||||
PDFView.rotatePages(-90);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,8 @@ zoom_in_label=Zoom In
|
|||
zoom.title=Zoom
|
||||
print.title=Print
|
||||
print_label=Print
|
||||
fullscreen.title=Fullscreen
|
||||
fullscreen_label=Fullscreen
|
||||
open_file.title=Open File
|
||||
open_file_label=Open
|
||||
download.title=Download
|
||||
|
@ -48,6 +50,10 @@ thumb_page_title=Page {{page}}
|
|||
# number.
|
||||
thumb_page_canvas=Thumbnail of Page {{page}}
|
||||
|
||||
# Context menu
|
||||
page_rotate_cw=Rotate Clockwise
|
||||
page_rotate_ccw=Rotate Counter-Clockwise
|
||||
|
||||
# Search panel button title and messages
|
||||
search=Find
|
||||
search_terms_not_found=(Not found)
|
||||
|
|
Загрузка…
Ссылка в новой задаче