Merge pull request #9125 from Snuffleupagus/rm-viewer-PDFJS-options
Remove compatibility code for unsupported browsers for a couple of `PDFJS` options
This commit is contained in:
commit
f9a0515452
@ -25,10 +25,8 @@ var globalScope = require('./global_scope');
|
||||
|
||||
var userAgent = (typeof navigator !== 'undefined' && navigator.userAgent) || '';
|
||||
var isAndroid = /Android/.test(userAgent);
|
||||
var isAndroidPre3 = /Android\s[0-2][^\d]/.test(userAgent);
|
||||
var isAndroidPre5 = /Android\s[0-4][^\d]/.test(userAgent);
|
||||
var isChrome = userAgent.indexOf('Chrom') >= 0;
|
||||
var isChromeWithRangeBug = /Chrome\/(39|40)\./.test(userAgent);
|
||||
var isIOSChrome = userAgent.indexOf('CriOS') >= 0;
|
||||
var isIE = userAgent.indexOf('Trident') >= 0;
|
||||
var isIOS = /\b(iPad|iPhone|iPod)(?=;)/.test(userAgent);
|
||||
@ -470,38 +468,17 @@ PDFJS.compatibilityChecked = true;
|
||||
PDFJS.locale = navigator.userLanguage || 'en-US';
|
||||
})();
|
||||
|
||||
// Support: Safari 6.0+, Android<3.0, Chrome 39/40, iOS
|
||||
// Support: Safari 6.0+, iOS
|
||||
(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.
|
||||
|
||||
// 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.
|
||||
|
||||
// Range requests are broken in Chrome 39 and 40, https://crbug.com/442318
|
||||
if (isSafari || isAndroidPre3 || isChromeWithRangeBug || isIOS) {
|
||||
if (isSafari || isIOS) {
|
||||
PDFJS.disableRange = true;
|
||||
PDFJS.disableStream = true;
|
||||
}
|
||||
})();
|
||||
|
||||
// Check if the browser supports manipulation of the history.
|
||||
// Support: IE<10, Android<4.2
|
||||
(function checkHistoryManipulation() {
|
||||
if (!hasDOM) {
|
||||
return;
|
||||
}
|
||||
// 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 || isAndroidPre3) {
|
||||
PDFJS.disableHistory = true;
|
||||
}
|
||||
})();
|
||||
|
||||
// Support: IE<11, Chrome<21, Android<4.4, Safari<6
|
||||
(function checkSetPresenceInImageData() {
|
||||
if (!hasDOM) {
|
||||
|
@ -1525,10 +1525,6 @@ function webViewerInitialized() {
|
||||
if ('verbosity' in hashParams) {
|
||||
PDFJS.verbosity = hashParams['verbosity'] | 0;
|
||||
}
|
||||
if ('ignorecurrentpositiononzoom' in hashParams) {
|
||||
PDFJS.ignoreCurrentPositionOnZoom =
|
||||
(hashParams['ignorecurrentpositiononzoom'] === 'true');
|
||||
}
|
||||
if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('PRODUCTION')) {
|
||||
if ('disablebcmaps' in hashParams && hashParams['disablebcmaps']) {
|
||||
PDFJS.cMapUrl = '../external/cmaps/';
|
||||
|
@ -505,7 +505,7 @@ class BaseViewer {
|
||||
|
||||
if (!noScroll) {
|
||||
let page = this._currentPageNumber, dest;
|
||||
if (this._location && !PDFJS.ignoreCurrentPositionOnZoom &&
|
||||
if (this._location &&
|
||||
!(this.isInPresentationMode || this.isChangingPresentationMode)) {
|
||||
page = this._location.pageNumber;
|
||||
dest = [null, { name: 'XYZ', }, this._location.left,
|
||||
|
@ -102,12 +102,6 @@ PDFJS.disableHistory = (PDFJS.disableHistory === undefined ?
|
||||
PDFJS.disableTextLayer = (PDFJS.disableTextLayer === undefined ?
|
||||
false : PDFJS.disableTextLayer);
|
||||
|
||||
/**
|
||||
* Disables maintaining the current position in the document when zooming.
|
||||
*/
|
||||
PDFJS.ignoreCurrentPositionOnZoom = (PDFJS.ignoreCurrentPositionOnZoom ===
|
||||
undefined ? false : PDFJS.ignoreCurrentPositionOnZoom);
|
||||
|
||||
if (typeof PDFJSDev === 'undefined' ||
|
||||
!PDFJSDev.test('FIREFOX || MOZCENTRAL')) {
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user