forked from mozilla/pdf.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fd6fd6e
commit a042594
Showing
377 changed files
with
130,748 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
*~ | ||
local.mk | ||
build/ | ||
tags | ||
.DS_Store | ||
Makefile | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,374 @@ | ||
/** | ||
* @licstart The following is the entire license notice for the | ||
* JavaScript code in this page | ||
* | ||
* Copyright 2023 Mozilla Foundation | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* @licend The above is the entire license notice for the | ||
* JavaScript code in this page | ||
*/ | ||
|
||
/******/ // The require scope | ||
/******/ var __webpack_require__ = {}; | ||
/******/ | ||
/************************************************************************/ | ||
/******/ /* webpack/runtime/define property getters */ | ||
/******/ (() => { | ||
/******/ // define getter functions for harmony exports | ||
/******/ __webpack_require__.d = (exports, definition) => { | ||
/******/ for(var key in definition) { | ||
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { | ||
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); | ||
/******/ } | ||
/******/ } | ||
/******/ }; | ||
/******/ })(); | ||
/******/ | ||
/******/ /* webpack/runtime/hasOwnProperty shorthand */ | ||
/******/ (() => { | ||
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) | ||
/******/ })(); | ||
/******/ | ||
/************************************************************************/ | ||
var __webpack_exports__ = {}; | ||
/* harmony export */ __webpack_require__.d(__webpack_exports__, { | ||
/* harmony export */ AppOptions: () => (/* binding */ AppOptions), | ||
/* harmony export */ OptionKind: () => (/* binding */ OptionKind), | ||
/* harmony export */ compatibilityParams: () => (/* binding */ compatibilityParams) | ||
/* harmony export */ }); | ||
const compatibilityParams = Object.create(null); | ||
{ | ||
if (typeof navigator === "undefined") { | ||
globalThis.navigator = Object.create(null); | ||
} | ||
const userAgent = navigator.userAgent || ""; | ||
const platform = navigator.platform || ""; | ||
const maxTouchPoints = navigator.maxTouchPoints || 1; | ||
const isAndroid = /Android/.test(userAgent); | ||
const isIOS = /\b(iPad|iPhone|iPod)(?=;)/.test(userAgent) || platform === "MacIntel" && maxTouchPoints > 1; | ||
(function checkCanvasSizeLimitation() { | ||
if (isIOS || isAndroid) { | ||
compatibilityParams.maxCanvasPixels = 5242880; | ||
} | ||
})(); | ||
} | ||
const OptionKind = { | ||
BROWSER: 0x01, | ||
VIEWER: 0x02, | ||
API: 0x04, | ||
WORKER: 0x08, | ||
PREFERENCE: 0x80 | ||
}; | ||
const defaultOptions = { | ||
canvasMaxAreaInBytes: { | ||
value: -1, | ||
kind: OptionKind.BROWSER + OptionKind.API | ||
}, | ||
isInAutomation: { | ||
value: false, | ||
kind: OptionKind.BROWSER | ||
}, | ||
supportsDocumentFonts: { | ||
value: true, | ||
kind: OptionKind.BROWSER | ||
}, | ||
supportsIntegratedFind: { | ||
value: false, | ||
kind: OptionKind.BROWSER | ||
}, | ||
supportsMouseWheelZoomCtrlKey: { | ||
value: true, | ||
kind: OptionKind.BROWSER | ||
}, | ||
supportsMouseWheelZoomMetaKey: { | ||
value: true, | ||
kind: OptionKind.BROWSER | ||
}, | ||
supportsPinchToZoom: { | ||
value: true, | ||
kind: OptionKind.BROWSER | ||
}, | ||
annotationEditorMode: { | ||
value: 0, | ||
kind: OptionKind.VIEWER + OptionKind.PREFERENCE | ||
}, | ||
annotationMode: { | ||
value: 2, | ||
kind: OptionKind.VIEWER + OptionKind.PREFERENCE | ||
}, | ||
cursorToolOnLoad: { | ||
value: 0, | ||
kind: OptionKind.VIEWER + OptionKind.PREFERENCE | ||
}, | ||
defaultZoomDelay: { | ||
value: 400, | ||
kind: OptionKind.VIEWER + OptionKind.PREFERENCE | ||
}, | ||
defaultZoomValue: { | ||
value: "", | ||
kind: OptionKind.VIEWER + OptionKind.PREFERENCE | ||
}, | ||
disableHistory: { | ||
value: false, | ||
kind: OptionKind.VIEWER | ||
}, | ||
disablePageLabels: { | ||
value: false, | ||
kind: OptionKind.VIEWER + OptionKind.PREFERENCE | ||
}, | ||
enableHighlightEditor: { | ||
value: false, | ||
kind: OptionKind.VIEWER + OptionKind.PREFERENCE | ||
}, | ||
enablePermissions: { | ||
value: false, | ||
kind: OptionKind.VIEWER + OptionKind.PREFERENCE | ||
}, | ||
enablePrintAutoRotate: { | ||
value: true, | ||
kind: OptionKind.VIEWER + OptionKind.PREFERENCE | ||
}, | ||
enableScripting: { | ||
value: true, | ||
kind: OptionKind.VIEWER + OptionKind.PREFERENCE | ||
}, | ||
externalLinkRel: { | ||
value: "noopener noreferrer nofollow", | ||
kind: OptionKind.VIEWER | ||
}, | ||
externalLinkTarget: { | ||
value: 0, | ||
kind: OptionKind.VIEWER + OptionKind.PREFERENCE | ||
}, | ||
highlightEditorColors: { | ||
value: "yellow=#FFFF98,green=#53FFBC,blue=#80EBFF,pink=#FFCBE6,red=#FF4F5F", | ||
kind: OptionKind.VIEWER + OptionKind.PREFERENCE | ||
}, | ||
historyUpdateUrl: { | ||
value: false, | ||
kind: OptionKind.VIEWER + OptionKind.PREFERENCE | ||
}, | ||
ignoreDestinationZoom: { | ||
value: false, | ||
kind: OptionKind.VIEWER + OptionKind.PREFERENCE | ||
}, | ||
imageResourcesPath: { | ||
value: "./images/", | ||
kind: OptionKind.VIEWER | ||
}, | ||
maxCanvasPixels: { | ||
value: 16777216, | ||
kind: OptionKind.VIEWER | ||
}, | ||
forcePageColors: { | ||
value: false, | ||
kind: OptionKind.VIEWER + OptionKind.PREFERENCE | ||
}, | ||
pageColorsBackground: { | ||
value: "Canvas", | ||
kind: OptionKind.VIEWER + OptionKind.PREFERENCE | ||
}, | ||
pageColorsForeground: { | ||
value: "CanvasText", | ||
kind: OptionKind.VIEWER + OptionKind.PREFERENCE | ||
}, | ||
pdfBugEnabled: { | ||
value: false, | ||
kind: OptionKind.VIEWER + OptionKind.PREFERENCE | ||
}, | ||
printResolution: { | ||
value: 150, | ||
kind: OptionKind.VIEWER | ||
}, | ||
sidebarViewOnLoad: { | ||
value: -1, | ||
kind: OptionKind.VIEWER + OptionKind.PREFERENCE | ||
}, | ||
scrollModeOnLoad: { | ||
value: -1, | ||
kind: OptionKind.VIEWER + OptionKind.PREFERENCE | ||
}, | ||
spreadModeOnLoad: { | ||
value: -1, | ||
kind: OptionKind.VIEWER + OptionKind.PREFERENCE | ||
}, | ||
textLayerMode: { | ||
value: 1, | ||
kind: OptionKind.VIEWER + OptionKind.PREFERENCE | ||
}, | ||
viewOnLoad: { | ||
value: 0, | ||
kind: OptionKind.VIEWER + OptionKind.PREFERENCE | ||
}, | ||
cMapPacked: { | ||
value: true, | ||
kind: OptionKind.API | ||
}, | ||
cMapUrl: { | ||
value: "../web/cmaps/", | ||
kind: OptionKind.API | ||
}, | ||
disableAutoFetch: { | ||
value: false, | ||
kind: OptionKind.API + OptionKind.PREFERENCE | ||
}, | ||
disableFontFace: { | ||
value: false, | ||
kind: OptionKind.API + OptionKind.PREFERENCE | ||
}, | ||
disableRange: { | ||
value: false, | ||
kind: OptionKind.API + OptionKind.PREFERENCE | ||
}, | ||
disableStream: { | ||
value: false, | ||
kind: OptionKind.API + OptionKind.PREFERENCE | ||
}, | ||
docBaseUrl: { | ||
value: "", | ||
kind: OptionKind.API | ||
}, | ||
enableXfa: { | ||
value: true, | ||
kind: OptionKind.API + OptionKind.PREFERENCE | ||
}, | ||
fontExtraProperties: { | ||
value: false, | ||
kind: OptionKind.API | ||
}, | ||
isEvalSupported: { | ||
value: true, | ||
kind: OptionKind.API | ||
}, | ||
isOffscreenCanvasSupported: { | ||
value: true, | ||
kind: OptionKind.API | ||
}, | ||
maxImageSize: { | ||
value: -1, | ||
kind: OptionKind.API | ||
}, | ||
pdfBug: { | ||
value: false, | ||
kind: OptionKind.API | ||
}, | ||
standardFontDataUrl: { | ||
value: "../web/standard_fonts/", | ||
kind: OptionKind.API | ||
}, | ||
verbosity: { | ||
value: 1, | ||
kind: OptionKind.API | ||
}, | ||
workerPort: { | ||
value: null, | ||
kind: OptionKind.WORKER | ||
}, | ||
workerSrc: { | ||
value: "../build/pdf.worker.mjs", | ||
kind: OptionKind.WORKER | ||
} | ||
}; | ||
{ | ||
defaultOptions.defaultUrl = { | ||
value: "compressed.tracemonkey-pldi-09.pdf", | ||
kind: OptionKind.VIEWER | ||
}; | ||
defaultOptions.sandboxBundleSrc = { | ||
value: "../build/pdf.sandbox.mjs", | ||
kind: OptionKind.VIEWER | ||
}; | ||
defaultOptions.viewerCssTheme = { | ||
value: 0, | ||
kind: OptionKind.VIEWER + OptionKind.PREFERENCE | ||
}; | ||
} | ||
{ | ||
defaultOptions.disablePreferences = { | ||
value: false, | ||
kind: OptionKind.VIEWER | ||
}; | ||
defaultOptions.locale = { | ||
value: navigator.language || "en-US", | ||
kind: OptionKind.VIEWER | ||
}; | ||
} | ||
const userOptions = Object.create(null); | ||
class AppOptions { | ||
constructor() { | ||
throw new Error("Cannot initialize AppOptions."); | ||
} | ||
static get(name) { | ||
const userOption = userOptions[name]; | ||
if (userOption !== undefined) { | ||
return userOption; | ||
} | ||
const defaultOption = defaultOptions[name]; | ||
if (defaultOption !== undefined) { | ||
return compatibilityParams[name] ?? defaultOption.value; | ||
} | ||
return undefined; | ||
} | ||
static getAll(kind = null) { | ||
const options = Object.create(null); | ||
for (const name in defaultOptions) { | ||
const defaultOption = defaultOptions[name]; | ||
if (kind) { | ||
if (!(kind & defaultOption.kind)) { | ||
continue; | ||
} | ||
if (kind === OptionKind.PREFERENCE) { | ||
if (defaultOption.kind & OptionKind.BROWSER) { | ||
throw new Error(`Invalid kind for preference: ${name}`); | ||
} | ||
const value = defaultOption.value, | ||
valueType = typeof value; | ||
if (valueType === "boolean" || valueType === "string" || valueType === "number" && Number.isInteger(value)) { | ||
options[name] = value; | ||
continue; | ||
} | ||
throw new Error(`Invalid type for preference: ${name}`); | ||
} | ||
} | ||
const userOption = userOptions[name]; | ||
options[name] = userOption !== undefined ? userOption : compatibilityParams[name] ?? defaultOption.value; | ||
} | ||
return options; | ||
} | ||
static set(name, value) { | ||
userOptions[name] = value; | ||
} | ||
static setAll(options, init = false) { | ||
if (init) { | ||
if (this.get("disablePreferences")) { | ||
return; | ||
} | ||
if (Object.keys(userOptions).length) { | ||
console.warn("setAll: The Preferences may override manually set AppOptions; " + 'please use the "disablePreferences"-option in order to prevent that.'); | ||
} | ||
} | ||
for (const name in options) { | ||
userOptions[name] = options[name]; | ||
} | ||
} | ||
static remove(name) { | ||
delete userOptions[name]; | ||
} | ||
} | ||
|
||
var __webpack_exports__AppOptions = __webpack_exports__.AppOptions; | ||
var __webpack_exports__OptionKind = __webpack_exports__.OptionKind; | ||
var __webpack_exports__compatibilityParams = __webpack_exports__.compatibilityParams; | ||
export { __webpack_exports__AppOptions as AppOptions, __webpack_exports__OptionKind as OptionKind, __webpack_exports__compatibilityParams as compatibilityParams }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"canvasMaxAreaInBytes":-1,"isInAutomation":false,"supportsDocumentFonts":true,"supportsIntegratedFind":false,"supportsMouseWheelZoomCtrlKey":true,"supportsMouseWheelZoomMetaKey":true,"supportsPinchToZoom":true} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"annotationEditorMode":0,"annotationMode":2,"cursorToolOnLoad":0,"defaultZoomDelay":400,"defaultZoomValue":"","disablePageLabels":false,"enableHighlightEditor":false,"enablePermissions":false,"enablePrintAutoRotate":true,"enableScripting":true,"externalLinkTarget":0,"highlightEditorColors":"yellow=#FFFF98,green=#53FFBC,blue=#80EBFF,pink=#FFCBE6,red=#FF4F5F","historyUpdateUrl":false,"ignoreDestinationZoom":false,"forcePageColors":false,"pageColorsBackground":"Canvas","pageColorsForeground":"CanvasText","pdfBugEnabled":false,"sidebarViewOnLoad":-1,"scrollModeOnLoad":-1,"spreadModeOnLoad":-1,"textLayerMode":1,"viewOnLoad":0,"disableAutoFetch":false,"disableFontFace":false,"disableRange":false,"disableStream":false,"enableXfa":true,"viewerCssTheme":0} |
Oops, something went wrong.