Browse Source

Merge pull request #5691 from Snuffleupagus/viewer-shadow

Use the |shadow| function from src/shared/util.js in viewer.js
Tim van der Meij 10 years ago
parent
commit
ccf05c7a41
  1. 1
      src/shared/util.js
  2. 51
      web/viewer.js

1
src/shared/util.js

@ -325,6 +325,7 @@ function shadow(obj, prop, value) {
writable: false }); writable: false });
return value; return value;
} }
PDFJS.shadow = shadow;
var PasswordResponses = PDFJS.PasswordResponses = { var PasswordResponses = PDFJS.PasswordResponses = {
NEED_PASSWORD: 1, NEED_PASSWORD: 1,

51
web/viewer.js

@ -299,12 +299,8 @@ var PDFViewerApplication = {
get supportsPrinting() { get supportsPrinting() {
var canvas = document.createElement('canvas'); var canvas = document.createElement('canvas');
var value = 'mozPrintCallback' in canvas; var value = 'mozPrintCallback' in canvas;
// shadow
Object.defineProperty(this, 'supportsPrinting', { value: value, return PDFJS.shadow(this, 'supportsPrinting', value);
enumerable: true,
configurable: true,
writable: false });
return value;
}, },
get supportsFullscreen() { get supportsFullscreen() {
@ -319,59 +315,40 @@ var PDFViewerApplication = {
support = false; support = false;
} }
Object.defineProperty(this, 'supportsFullscreen', { value: support, return PDFJS.shadow(this, 'supportsFullscreen', support);
enumerable: true,
configurable: true,
writable: false });
return support;
}, },
get supportsIntegratedFind() { get supportsIntegratedFind() {
var support = false; var support = false;
//#if !(FIREFOX || MOZCENTRAL) //#if (FIREFOX || MOZCENTRAL)
//#else
// support = FirefoxCom.requestSync('supportsIntegratedFind'); // support = FirefoxCom.requestSync('supportsIntegratedFind');
//#endif //#endif
Object.defineProperty(this, 'supportsIntegratedFind', { value: support,
enumerable: true, return PDFJS.shadow(this, 'supportsIntegratedFind', support);
configurable: true,
writable: false });
return support;
}, },
get supportsDocumentFonts() { get supportsDocumentFonts() {
var support = true; var support = true;
//#if !(FIREFOX || MOZCENTRAL) //#if (FIREFOX || MOZCENTRAL)
//#else
// support = FirefoxCom.requestSync('supportsDocumentFonts'); // support = FirefoxCom.requestSync('supportsDocumentFonts');
//#endif //#endif
Object.defineProperty(this, 'supportsDocumentFonts', { value: support,
enumerable: true, return PDFJS.shadow(this, 'supportsDocumentFonts', support);
configurable: true,
writable: false });
return support;
}, },
get supportsDocumentColors() { get supportsDocumentColors() {
var support = true; var support = true;
//#if !(FIREFOX || MOZCENTRAL) //#if (FIREFOX || MOZCENTRAL)
//#else
// support = FirefoxCom.requestSync('supportsDocumentColors'); // support = FirefoxCom.requestSync('supportsDocumentColors');
//#endif //#endif
Object.defineProperty(this, 'supportsDocumentColors', { value: support,
enumerable: true, return PDFJS.shadow(this, 'supportsDocumentColors', support);
configurable: true,
writable: false });
return support;
}, },
get loadingBar() { get loadingBar() {
var bar = new ProgressBar('#loadingBar', {}); var bar = new ProgressBar('#loadingBar', {});
Object.defineProperty(this, 'loadingBar', { value: bar,
enumerable: true, return PDFJS.shadow(this, 'loadingBar', bar);
configurable: true,
writable: false });
return bar;
}, },
//#if (FIREFOX || MOZCENTRAL) //#if (FIREFOX || MOZCENTRAL)

Loading…
Cancel
Save