Disable the developer hash parameters by default in PRODUCTION builds of PDF.js

This commit is contained in:
Jonas Jenwald 2014-06-16 22:18:12 +02:00
parent 1ba31a6cb7
commit 3ead6e6a94

View File

@ -1732,6 +1732,15 @@ function webViewerInitialized() {
//document.getElementById('secondaryOpenFile').setAttribute('hidden', 'true');
//#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.
var hash = document.location.hash.substring(1);
var hashParams = PDFView.parseQueryString(hash);
@ -1739,63 +1748,42 @@ function webViewerInitialized() {
if ('disableWorker' in hashParams) {
PDFJS.disableWorker = (hashParams['disableWorker'] === 'true');
}
if ('disableRange' in hashParams) {
PDFJS.disableRange = (hashParams['disableRange'] === 'true');
}
if ('disableAutoFetch' in hashParams) {
PDFJS.disableAutoFetch = (hashParams['disableAutoFetch'] === 'true');
}
if ('disableFontFace' in hashParams) {
PDFJS.disableFontFace = (hashParams['disableFontFace'] === 'true');
}
if ('disableHistory' in hashParams) {
PDFJS.disableHistory = (hashParams['disableHistory'] === 'true');
}
if ('webgl' in hashParams) {
PDFJS.disableWebGL = (hashParams['webgl'] !== 'true');
}
if ('useOnlyCssZoom' in hashParams) {
PDFJS.useOnlyCssZoom = (hashParams['useOnlyCssZoom'] === 'true');
}
if ('verbosity' in hashParams) {
PDFJS.verbosity = hashParams['verbosity'] | 0;
}
if ('ignoreCurrentPositionOnZoom' in hashParams) {
IGNORE_CURRENT_POSITION_ON_ZOOM =
(hashParams['ignoreCurrentPositionOnZoom'] === 'true');
}
//#if !PRODUCTION
if ('disableBcmaps' in hashParams && hashParams['disableBcmaps']) {
PDFJS.cMapUrl = '../external/cmaps/';
PDFJS.cMapPacked = false;
}
//#endif
//#if !(FIREFOX || MOZCENTRAL)
var locale = PDFJS.locale || navigator.language;
if ('locale' in hashParams) {
locale = hashParams['locale'];
}
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 ('textLayer' in hashParams) {
switch (hashParams['textLayer']) {
case 'off':
@ -1809,18 +1797,25 @@ function webViewerInitialized() {
break;
}
}
//#if !(FIREFOX || MOZCENTRAL)
if ('pdfBug' in hashParams) {
//#else
//if ('pdfBug' in hashParams && PDFView.preferencesPdfBugEnabled) {
//#endif
PDFJS.pdfBug = true;
var pdfBug = hashParams['pdfBug'];
var enabled = pdfBug.split(',');
PDFBug.enable(enabled);
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) {
document.getElementById('print').classList.add('hidden');