Disable the developer hash parameters by default in PRODUCTION builds of PDF.js
This commit is contained in:
parent
1ba31a6cb7
commit
3ead6e6a94
@ -1732,6 +1732,15 @@ function webViewerInitialized() {
|
|||||||
//document.getElementById('secondaryOpenFile').setAttribute('hidden', 'true');
|
//document.getElementById('secondaryOpenFile').setAttribute('hidden', 'true');
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
|
//#if !(FIREFOX || MOZCENTRAL)
|
||||||
|
var locale = PDFJS.locale || navigator.language;
|
||||||
|
//#endif
|
||||||
|
|
||||||
|
//#if !PRODUCTION
|
||||||
|
if (true) {
|
||||||
|
//#else
|
||||||
|
//if (PDFView.preferencesPdfBugEnabled) {
|
||||||
|
//#endif
|
||||||
// Special debugging flags in the hash section of the URL.
|
// Special debugging flags in the hash section of the URL.
|
||||||
var hash = document.location.hash.substring(1);
|
var hash = document.location.hash.substring(1);
|
||||||
var hashParams = PDFView.parseQueryString(hash);
|
var hashParams = PDFView.parseQueryString(hash);
|
||||||
@ -1739,63 +1748,42 @@ function webViewerInitialized() {
|
|||||||
if ('disableWorker' in hashParams) {
|
if ('disableWorker' in hashParams) {
|
||||||
PDFJS.disableWorker = (hashParams['disableWorker'] === 'true');
|
PDFJS.disableWorker = (hashParams['disableWorker'] === 'true');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('disableRange' in hashParams) {
|
if ('disableRange' in hashParams) {
|
||||||
PDFJS.disableRange = (hashParams['disableRange'] === 'true');
|
PDFJS.disableRange = (hashParams['disableRange'] === 'true');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('disableAutoFetch' in hashParams) {
|
if ('disableAutoFetch' in hashParams) {
|
||||||
PDFJS.disableAutoFetch = (hashParams['disableAutoFetch'] === 'true');
|
PDFJS.disableAutoFetch = (hashParams['disableAutoFetch'] === 'true');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('disableFontFace' in hashParams) {
|
if ('disableFontFace' in hashParams) {
|
||||||
PDFJS.disableFontFace = (hashParams['disableFontFace'] === 'true');
|
PDFJS.disableFontFace = (hashParams['disableFontFace'] === 'true');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('disableHistory' in hashParams) {
|
if ('disableHistory' in hashParams) {
|
||||||
PDFJS.disableHistory = (hashParams['disableHistory'] === 'true');
|
PDFJS.disableHistory = (hashParams['disableHistory'] === 'true');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('webgl' in hashParams) {
|
if ('webgl' in hashParams) {
|
||||||
PDFJS.disableWebGL = (hashParams['webgl'] !== 'true');
|
PDFJS.disableWebGL = (hashParams['webgl'] !== 'true');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('useOnlyCssZoom' in hashParams) {
|
if ('useOnlyCssZoom' in hashParams) {
|
||||||
PDFJS.useOnlyCssZoom = (hashParams['useOnlyCssZoom'] === 'true');
|
PDFJS.useOnlyCssZoom = (hashParams['useOnlyCssZoom'] === 'true');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('verbosity' in hashParams) {
|
if ('verbosity' in hashParams) {
|
||||||
PDFJS.verbosity = hashParams['verbosity'] | 0;
|
PDFJS.verbosity = hashParams['verbosity'] | 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('ignoreCurrentPositionOnZoom' in hashParams) {
|
if ('ignoreCurrentPositionOnZoom' in hashParams) {
|
||||||
IGNORE_CURRENT_POSITION_ON_ZOOM =
|
IGNORE_CURRENT_POSITION_ON_ZOOM =
|
||||||
(hashParams['ignoreCurrentPositionOnZoom'] === 'true');
|
(hashParams['ignoreCurrentPositionOnZoom'] === 'true');
|
||||||
}
|
}
|
||||||
|
|
||||||
//#if !PRODUCTION
|
//#if !PRODUCTION
|
||||||
if ('disableBcmaps' in hashParams && hashParams['disableBcmaps']) {
|
if ('disableBcmaps' in hashParams && hashParams['disableBcmaps']) {
|
||||||
PDFJS.cMapUrl = '../external/cmaps/';
|
PDFJS.cMapUrl = '../external/cmaps/';
|
||||||
PDFJS.cMapPacked = false;
|
PDFJS.cMapPacked = false;
|
||||||
}
|
}
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
|
|
||||||
//#if !(FIREFOX || MOZCENTRAL)
|
//#if !(FIREFOX || MOZCENTRAL)
|
||||||
var locale = PDFJS.locale || navigator.language;
|
|
||||||
if ('locale' in hashParams) {
|
if ('locale' in hashParams) {
|
||||||
locale = hashParams['locale'];
|
locale = hashParams['locale'];
|
||||||
}
|
}
|
||||||
mozL10n.setLanguage(locale);
|
|
||||||
//#endif
|
//#endif
|
||||||
//#if (FIREFOX || MOZCENTRAL)
|
|
||||||
//if (!PDFView.supportsDocumentFonts) {
|
|
||||||
// PDFJS.disableFontFace = true;
|
|
||||||
// console.warn(mozL10n.get('web_fonts_disabled', null,
|
|
||||||
// 'Web fonts are disabled: unable to use embedded PDF fonts.'));
|
|
||||||
//}
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
if ('textLayer' in hashParams) {
|
if ('textLayer' in hashParams) {
|
||||||
switch (hashParams['textLayer']) {
|
switch (hashParams['textLayer']) {
|
||||||
case 'off':
|
case 'off':
|
||||||
@ -1809,18 +1797,25 @@ function webViewerInitialized() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//#if !(FIREFOX || MOZCENTRAL)
|
|
||||||
if ('pdfBug' in hashParams) {
|
if ('pdfBug' in hashParams) {
|
||||||
//#else
|
|
||||||
//if ('pdfBug' in hashParams && PDFView.preferencesPdfBugEnabled) {
|
|
||||||
//#endif
|
|
||||||
PDFJS.pdfBug = true;
|
PDFJS.pdfBug = true;
|
||||||
var pdfBug = hashParams['pdfBug'];
|
var pdfBug = hashParams['pdfBug'];
|
||||||
var enabled = pdfBug.split(',');
|
var enabled = pdfBug.split(',');
|
||||||
PDFBug.enable(enabled);
|
PDFBug.enable(enabled);
|
||||||
PDFBug.init();
|
PDFBug.init();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//#if !(FIREFOX || MOZCENTRAL)
|
||||||
|
mozL10n.setLanguage(locale);
|
||||||
|
//#endif
|
||||||
|
//#if (FIREFOX || MOZCENTRAL)
|
||||||
|
//if (!PDFView.supportsDocumentFonts) {
|
||||||
|
// PDFJS.disableFontFace = true;
|
||||||
|
// console.warn(mozL10n.get('web_fonts_disabled', null,
|
||||||
|
// 'Web fonts are disabled: unable to use embedded PDF fonts.'));
|
||||||
|
//}
|
||||||
|
//#endif
|
||||||
|
|
||||||
if (!PDFView.supportsPrinting) {
|
if (!PDFView.supportsPrinting) {
|
||||||
document.getElementById('print').classList.add('hidden');
|
document.getElementById('print').classList.add('hidden');
|
||||||
|
Loading…
Reference in New Issue
Block a user