Browse Source

Merge branch 'issue-4954' of https://github.com/Snuffleupagus/pdf.js into hashes

Conflicts:
	web/viewer.js
Yury Delendik 11 years ago
parent
commit
63b7fa5634
  1. 3
      extensions/firefox/content/PdfStreamConverter.jsm
  2. 1
      web/default_preferences.js
  3. 50
      web/viewer.js

3
extensions/firefox/content/PdfStreamConverter.jsm

@ -344,9 +344,6 @@ ChromeActions.prototype = {
return 'null'; return 'null';
} }
}, },
pdfBugEnabled: function() {
return getBoolPref(PREF_PREFIX + '.pdfBugEnabled', false);
},
supportsIntegratedFind: function() { supportsIntegratedFind: function() {
// Integrated find is only supported when we're not in a frame // Integrated find is only supported when we're not in a frame
if (this.domWindow.frameElement !== null) { if (this.domWindow.frameElement !== null) {

1
web/default_preferences.js

@ -26,6 +26,7 @@ var DEFAULT_PREFERENCES = {
sidebarViewOnLoad: 0, sidebarViewOnLoad: 0,
enableHandToolOnLoad: false, enableHandToolOnLoad: false,
enableWebGL: false, enableWebGL: false,
pdfBugEnabled: false,
disableRange: false, disableRange: false,
disableAutoFetch: false, disableAutoFetch: false,
disableFontFace: false, disableFontFace: false,

50
web/viewer.js

@ -233,6 +233,9 @@ var PDFView = {
Preferences.get('sidebarViewOnLoad').then(function resolved(value) { Preferences.get('sidebarViewOnLoad').then(function resolved(value) {
self.preferenceSidebarViewOnLoad = value; self.preferenceSidebarViewOnLoad = value;
}), }),
Preferences.get('pdfBugEnabled').then(function resolved(value) {
self.preferencesPdfBugEnabled = value;
}),
Preferences.get('disableTextLayer').then(function resolved(value) { Preferences.get('disableTextLayer').then(function resolved(value) {
if (PDFJS.disableTextLayer === true) { if (PDFJS.disableTextLayer === true) {
return; return;
@ -1765,6 +1768,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);
@ -1772,63 +1784,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':
@ -1842,18 +1833,25 @@ function webViewerInitialized() {
break; break;
} }
} }
//#if !(FIREFOX || MOZCENTRAL)
if ('pdfbug' in hashParams) { if ('pdfbug' in hashParams) {
//#else
//if ('pdfBug' in hashParams && FirefoxCom.requestSync('pdfBugEnabled')) {
//#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…
Cancel
Save