|
|
@ -3131,7 +3131,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons |
|
|
|
|
|
|
|
|
|
|
|
var HASH_CHANGE_TIMEOUT = 1000; |
|
|
|
var HASH_CHANGE_TIMEOUT = 1000; |
|
|
|
var POSITION_UPDATED_THRESHOLD = 50; |
|
|
|
var POSITION_UPDATED_THRESHOLD = 50; |
|
|
|
var UPDATE_VIEWAREA_TIMEOUT = 2000; |
|
|
|
var UPDATE_VIEWAREA_TIMEOUT = 1000; |
|
|
|
function getCurrentHash() { |
|
|
|
function getCurrentHash() { |
|
|
|
return document.location.hash; |
|
|
|
return document.location.hash; |
|
|
|
} |
|
|
|
} |
|
|
@ -3225,6 +3225,8 @@ var PDFHistory = function () { |
|
|
|
}, { |
|
|
|
}, { |
|
|
|
key: 'push', |
|
|
|
key: 'push', |
|
|
|
value: function push(_ref2) { |
|
|
|
value: function push(_ref2) { |
|
|
|
|
|
|
|
var _this2 = this; |
|
|
|
|
|
|
|
|
|
|
|
var namedDest = _ref2.namedDest, |
|
|
|
var namedDest = _ref2.namedDest, |
|
|
|
explicitDest = _ref2.explicitDest, |
|
|
|
explicitDest = _ref2.explicitDest, |
|
|
|
pageNumber = _ref2.pageNumber; |
|
|
|
pageNumber = _ref2.pageNumber; |
|
|
@ -3255,6 +3257,12 @@ var PDFHistory = function () { |
|
|
|
hash: hash, |
|
|
|
hash: hash, |
|
|
|
page: pageNumber |
|
|
|
page: pageNumber |
|
|
|
}, forceReplace); |
|
|
|
}, forceReplace); |
|
|
|
|
|
|
|
if (!this._popStateInProgress) { |
|
|
|
|
|
|
|
this._popStateInProgress = true; |
|
|
|
|
|
|
|
Promise.resolve().then(function () { |
|
|
|
|
|
|
|
_this2._popStateInProgress = false; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, { |
|
|
|
}, { |
|
|
|
key: 'pushCurrentPosition', |
|
|
|
key: 'pushCurrentPosition', |
|
|
@ -3362,6 +3370,10 @@ var PDFHistory = function () { |
|
|
|
value: function _updateInternalState(destination, uid) { |
|
|
|
value: function _updateInternalState(destination, uid) { |
|
|
|
var removeTemporary = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; |
|
|
|
var removeTemporary = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this._updateViewareaTimeout) { |
|
|
|
|
|
|
|
clearTimeout(this._updateViewareaTimeout); |
|
|
|
|
|
|
|
this._updateViewareaTimeout = null; |
|
|
|
|
|
|
|
} |
|
|
|
if (removeTemporary && destination && destination.temporary) { |
|
|
|
if (removeTemporary && destination && destination.temporary) { |
|
|
|
delete destination.temporary; |
|
|
|
delete destination.temporary; |
|
|
|
} |
|
|
|
} |
|
|
@ -3373,7 +3385,7 @@ var PDFHistory = function () { |
|
|
|
}, { |
|
|
|
}, { |
|
|
|
key: '_updateViewarea', |
|
|
|
key: '_updateViewarea', |
|
|
|
value: function _updateViewarea(_ref3) { |
|
|
|
value: function _updateViewarea(_ref3) { |
|
|
|
var _this2 = this; |
|
|
|
var _this3 = this; |
|
|
|
|
|
|
|
|
|
|
|
var location = _ref3.location; |
|
|
|
var location = _ref3.location; |
|
|
|
|
|
|
|
|
|
|
@ -3394,17 +3406,17 @@ var PDFHistory = function () { |
|
|
|
} |
|
|
|
} |
|
|
|
if (UPDATE_VIEWAREA_TIMEOUT > 0) { |
|
|
|
if (UPDATE_VIEWAREA_TIMEOUT > 0) { |
|
|
|
this._updateViewareaTimeout = setTimeout(function () { |
|
|
|
this._updateViewareaTimeout = setTimeout(function () { |
|
|
|
if (!_this2._popStateInProgress) { |
|
|
|
if (!_this3._popStateInProgress) { |
|
|
|
_this2._tryPushCurrentPosition(true); |
|
|
|
_this3._tryPushCurrentPosition(true); |
|
|
|
} |
|
|
|
} |
|
|
|
_this2._updateViewareaTimeout = null; |
|
|
|
_this3._updateViewareaTimeout = null; |
|
|
|
}, UPDATE_VIEWAREA_TIMEOUT); |
|
|
|
}, UPDATE_VIEWAREA_TIMEOUT); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, { |
|
|
|
}, { |
|
|
|
key: '_popState', |
|
|
|
key: '_popState', |
|
|
|
value: function _popState(_ref4) { |
|
|
|
value: function _popState(_ref4) { |
|
|
|
var _this3 = this; |
|
|
|
var _this4 = this; |
|
|
|
|
|
|
|
|
|
|
|
var state = _ref4.state; |
|
|
|
var state = _ref4.state; |
|
|
|
|
|
|
|
|
|
|
@ -3435,25 +3447,9 @@ var PDFHistory = function () { |
|
|
|
name: 'hashchange', |
|
|
|
name: 'hashchange', |
|
|
|
delay: HASH_CHANGE_TIMEOUT |
|
|
|
delay: HASH_CHANGE_TIMEOUT |
|
|
|
}).then(function () { |
|
|
|
}).then(function () { |
|
|
|
_this3._blockHashChange--; |
|
|
|
_this4._blockHashChange--; |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
if (state.uid < this._currentUid && this._position && this._destination) { |
|
|
|
|
|
|
|
var shouldGoBack = false; |
|
|
|
|
|
|
|
if (this._destination.temporary) { |
|
|
|
|
|
|
|
this._pushOrReplaceState(this._position); |
|
|
|
|
|
|
|
shouldGoBack = true; |
|
|
|
|
|
|
|
} else if (this._destination.page && this._destination.page !== this._position.first && this._destination.page !== this._position.page) { |
|
|
|
|
|
|
|
this._pushOrReplaceState(this._destination); |
|
|
|
|
|
|
|
this._pushOrReplaceState(this._position); |
|
|
|
|
|
|
|
shouldGoBack = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (shouldGoBack) { |
|
|
|
|
|
|
|
this._currentUid = state.uid; |
|
|
|
|
|
|
|
window.history.back(); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
var destination = state.destination; |
|
|
|
var destination = state.destination; |
|
|
|
this._updateInternalState(destination, state.uid, true); |
|
|
|
this._updateInternalState(destination, state.uid, true); |
|
|
|
if (destination.dest) { |
|
|
|
if (destination.dest) { |
|
|
@ -3464,13 +3460,13 @@ var PDFHistory = function () { |
|
|
|
this.linkService.page = destination.page; |
|
|
|
this.linkService.page = destination.page; |
|
|
|
} |
|
|
|
} |
|
|
|
Promise.resolve().then(function () { |
|
|
|
Promise.resolve().then(function () { |
|
|
|
_this3._popStateInProgress = false; |
|
|
|
_this4._popStateInProgress = false; |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}, { |
|
|
|
}, { |
|
|
|
key: '_bindEvents', |
|
|
|
key: '_bindEvents', |
|
|
|
value: function _bindEvents() { |
|
|
|
value: function _bindEvents() { |
|
|
|
var _this4 = this; |
|
|
|
var _this5 = this; |
|
|
|
|
|
|
|
|
|
|
|
var _boundEvents = this._boundEvents, |
|
|
|
var _boundEvents = this._boundEvents, |
|
|
|
eventBus = this.eventBus; |
|
|
|
eventBus = this.eventBus; |
|
|
@ -3478,8 +3474,8 @@ var PDFHistory = function () { |
|
|
|
_boundEvents.updateViewarea = this._updateViewarea.bind(this); |
|
|
|
_boundEvents.updateViewarea = this._updateViewarea.bind(this); |
|
|
|
_boundEvents.popState = this._popState.bind(this); |
|
|
|
_boundEvents.popState = this._popState.bind(this); |
|
|
|
_boundEvents.pageHide = function (evt) { |
|
|
|
_boundEvents.pageHide = function (evt) { |
|
|
|
if (!_this4._destination) { |
|
|
|
if (!_this5._destination) { |
|
|
|
_this4._tryPushCurrentPosition(); |
|
|
|
_this5._tryPushCurrentPosition(); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
eventBus.on('updateviewarea', _boundEvents.updateViewarea); |
|
|
|
eventBus.on('updateviewarea', _boundEvents.updateViewarea); |
|
|
|