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,60 +1732,81 @@ function webViewerInitialized() {
//document.getElementById('secondaryOpenFile').setAttribute('hidden', 'true');
//#endif
// Special debugging flags in the hash section of the URL.
var hash = document.location.hash.substring(1);
var hashParams = PDFView.parseQueryString(hash);
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'];
//#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);
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)
if ('locale' in hashParams) {
locale = hashParams['locale'];
}
//#endif
if ('textLayer' in hashParams) {
switch (hashParams['textLayer']) {
case 'off':
PDFJS.disableTextLayer = true;
break;
case 'visible':
case 'shadow':
case 'hover':
var viewer = document.getElementById('viewer');
viewer.classList.add('textLayer-' + hashParams['textLayer']);
break;
}
}
if ('pdfBug' in hashParams) {
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)
@ -1796,32 +1817,6 @@ function webViewerInitialized() {
//}
//#endif
if ('textLayer' in hashParams) {
switch (hashParams['textLayer']) {
case 'off':
PDFJS.disableTextLayer = true;
break;
case 'visible':
case 'shadow':
case 'hover':
var viewer = document.getElementById('viewer');
viewer.classList.add('textLayer-' + hashParams['textLayer']);
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 (!PDFView.supportsPrinting) {
document.getElementById('print').classList.add('hidden');
document.getElementById('secondaryPrint').classList.add('hidden');