mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Move viewer specific compatibility options from src/shared/compatibility.js
and into a separate file
Unfortunately, as far as I can tell, we still need the ability to adjust certain viewer options depending on the browser environment in PDF.js version `2.0`. However, we should be able to separate this from the general compatibility code in the `src/shared/compatibility.js` file.
This commit is contained in:
parent
ea3d8450d2
commit
9e0a31f662
4 changed files with 48 additions and 44 deletions
|
@ -26,12 +26,10 @@ if ((typeof PDFJSDev === 'undefined' ||
|
|||
// users - https://github.com/mozilla/pdf.js/issues/9397
|
||||
if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('CHROME')) {
|
||||
|
||||
var globalScope = require('./global_scope');
|
||||
|
||||
const globalScope = require('./global_scope');
|
||||
const isNodeJS = require('./is_node');
|
||||
|
||||
var userAgent = (typeof navigator !== 'undefined' && navigator.userAgent) || '';
|
||||
var isAndroid = /Android/.test(userAgent);
|
||||
var isIOSChrome = userAgent.indexOf('CriOS') >= 0;
|
||||
var isIE = userAgent.indexOf('Trident') >= 0;
|
||||
var isIOS = /\b(iPad|iPhone|iPod)(?=;)/.test(userAgent);
|
||||
|
@ -80,18 +78,6 @@ PDFJS.compatibilityChecked = true;
|
|||
}
|
||||
})();
|
||||
|
||||
// Checks if navigator.language is supported
|
||||
// Support: IE<11
|
||||
(function checkNavigatorLanguage() {
|
||||
if (typeof navigator === 'undefined') {
|
||||
return;
|
||||
}
|
||||
if ('language' in navigator) {
|
||||
return;
|
||||
}
|
||||
PDFJS.locale = navigator.userLanguage || 'en-US';
|
||||
})();
|
||||
|
||||
// Support: Safari 6.0+, iOS
|
||||
(function checkRangeRequests() {
|
||||
// Safari has issues with cached range requests see:
|
||||
|
@ -103,25 +89,6 @@ PDFJS.compatibilityChecked = true;
|
|||
}
|
||||
})();
|
||||
|
||||
// Support: Android, iOS
|
||||
(function checkCanvasSizeLimitation() {
|
||||
if (isIOS || isAndroid) {
|
||||
// 5MP
|
||||
PDFJS.maxCanvasPixels = 5242880;
|
||||
}
|
||||
})();
|
||||
|
||||
// Disable fullscreen support for certain problematic configurations.
|
||||
// Support: IE11+ (when embedded).
|
||||
(function checkFullscreenSupport() {
|
||||
if (!hasDOM) {
|
||||
return;
|
||||
}
|
||||
if (isIE && window.parent !== window) {
|
||||
PDFJS.disableFullscreen = true;
|
||||
}
|
||||
})();
|
||||
|
||||
// Provides document.currentScript support
|
||||
// Support: IE, Chrome<29.
|
||||
(function checkCurrentScript() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue