Browse Source

PDF.js version 1.1.474

master v1.1.474
Pdf Bot 10 years ago
parent
commit
4e9dc94ec9
  1. 2
      bower.json
  2. 4
      build/pdf.combined.js
  3. 4
      build/pdf.js
  4. 4
      build/pdf.worker.js
  5. 2
      package.json
  6. 88
      web/pdf_viewer.js

2
bower.json

@ -1,6 +1,6 @@
{ {
"name": "pdfjs-dist", "name": "pdfjs-dist",
"version": "1.1.472", "version": "1.1.474",
"main": [ "main": [
"build/pdf.js", "build/pdf.js",
"build/pdf.worker.js" "build/pdf.worker.js"

4
build/pdf.combined.js

@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') {
(typeof window !== 'undefined' ? window : this).PDFJS = {}; (typeof window !== 'undefined' ? window : this).PDFJS = {};
} }
PDFJS.version = '1.1.472'; PDFJS.version = '1.1.474';
PDFJS.build = '20b5814'; PDFJS.build = '7a8b0fb';
(function pdfjsWrapper() { (function pdfjsWrapper() {
// Use strict in our context only - users might not want it // Use strict in our context only - users might not want it

4
build/pdf.js

@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') {
(typeof window !== 'undefined' ? window : this).PDFJS = {}; (typeof window !== 'undefined' ? window : this).PDFJS = {};
} }
PDFJS.version = '1.1.472'; PDFJS.version = '1.1.474';
PDFJS.build = '20b5814'; PDFJS.build = '7a8b0fb';
(function pdfjsWrapper() { (function pdfjsWrapper() {
// Use strict in our context only - users might not want it // Use strict in our context only - users might not want it

4
build/pdf.worker.js vendored

@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') {
(typeof window !== 'undefined' ? window : this).PDFJS = {}; (typeof window !== 'undefined' ? window : this).PDFJS = {};
} }
PDFJS.version = '1.1.472'; PDFJS.version = '1.1.474';
PDFJS.build = '20b5814'; PDFJS.build = '7a8b0fb';
(function pdfjsWrapper() { (function pdfjsWrapper() {
// Use strict in our context only - users might not want it // Use strict in our context only - users might not want it

2
package.json

@ -1,6 +1,6 @@
{ {
"name": "pdfjs-dist", "name": "pdfjs-dist",
"version": "1.1.472", "version": "1.1.474",
"description": "Generic build of Mozilla's PDF.js library.", "description": "Generic build of Mozilla's PDF.js library.",
"keywords": [ "keywords": [
"Mozilla", "Mozilla",

88
web/pdf_viewer.js

@ -2805,38 +2805,74 @@ var PDFHistory = (function () {
var self = this; var self = this;
window.addEventListener('popstate', function pdfHistoryPopstate(evt) { window.addEventListener('popstate', function pdfHistoryPopstate(evt) {
evt.preventDefault();
evt.stopPropagation();
if (!self.historyUnlocked) { if (!self.historyUnlocked) {
return; return;
} }
if (evt.state) { if (evt.state) {
// Move back/forward in the history. // Move back/forward in the history.
self._goTo(evt.state); self._goTo(evt.state);
} else { return;
// Handle the user modifying the hash of a loaded document. }
self.previousHash = window.location.hash.substring(1);
// If the state is not set, then the user tried to navigate to a
// different hash by manually editing the URL and pressing Enter, or by
// clicking on an in-page link (e.g. the "current view" link).
// Save the current view state to the browser history.
// If the history is empty when the hash changes, // Note: In Firefox, history.null could also be null after an in-page
// update the previous entry in the browser history. // navigation to the same URL, and without dispatching the popstate
if (self.uid === 0) { // event: https://bugzilla.mozilla.org/show_bug.cgi?id=1183881
var previousParams = (self.previousHash && self.currentBookmark &&
if (self.uid === 0) {
// Replace the previous state if it was not explicitly set.
var previousParams = (self.previousHash && self.currentBookmark &&
self.previousHash !== self.currentBookmark) ? self.previousHash !== self.currentBookmark) ?
{hash: self.currentBookmark, page: self.currentPage} : {hash: self.currentBookmark, page: self.currentPage} :
{page: 1}; {page: 1};
self.historyUnlocked = false; replacePreviousHistoryState(previousParams, function() {
self.allowHashChange = false; updateHistoryWithCurrentHash();
window.history.back(); });
self._pushToHistory(previousParams, false, true); } else {
window.history.forward(); updateHistoryWithCurrentHash();
self.historyUnlocked = true;
}
self._pushToHistory({hash: self.previousHash}, false, true);
self._updatePreviousBookmark();
} }
}, false); }, false);
function updateHistoryWithCurrentHash() {
self.previousHash = window.location.hash.slice(1);
self._pushToHistory({hash: self.previousHash}, false, true);
self._updatePreviousBookmark();
}
function replacePreviousHistoryState(params, callback) {
// To modify the previous history entry, the following happens:
// 1. history.back()
// 2. _pushToHistory, which calls history.replaceState( ... )
// 3. history.forward()
// Because a navigation via the history API does not immediately update
// the history state, the popstate event is used for synchronization.
self.historyUnlocked = false;
// Suppress the hashchange event to avoid side effects caused by
// navigating back and forward.
self.allowHashChange = false;
window.addEventListener('popstate', rewriteHistoryAfterBack);
history.back();
function rewriteHistoryAfterBack() {
window.removeEventListener('popstate', rewriteHistoryAfterBack);
window.addEventListener('popstate', rewriteHistoryAfterForward);
self._pushToHistory(params, false, true);
history.forward();
}
function rewriteHistoryAfterForward() {
window.removeEventListener('popstate', rewriteHistoryAfterForward);
self.allowHashChange = true;
self.historyUnlocked = true;
callback();
}
}
function pdfHistoryBeforeUnload() { function pdfHistoryBeforeUnload() {
var previousParams = self._getPreviousParams(null, true); var previousParams = self._getPreviousParams(null, true);
if (previousParams) { if (previousParams) {
@ -2888,19 +2924,7 @@ var PDFHistory = (function () {
if (!this.initialized) { if (!this.initialized) {
return true; return true;
} }
// If the current hash changes when moving back/forward in the history, return this.allowHashChange;
// this will trigger a 'popstate' event *as well* as a 'hashchange' event.
// Since the hash generally won't correspond to the exact the position
// stored in the history's state object, triggering the 'hashchange' event
// can thus corrupt the browser history.
//
// When the hash changes during a 'popstate' event, we *only* prevent the
// first 'hashchange' event and immediately reset allowHashChange.
// If it is not reset, the user would not be able to change the hash.
var temp = this.allowHashChange;
this.allowHashChange = true;
return temp;
}, },
_updatePreviousBookmark: function pdfHistory_updatePreviousBookmark() { _updatePreviousBookmark: function pdfHistory_updatePreviousBookmark() {

Loading…
Cancel
Save