2
0

viewer-geckoview.js 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /**
  2. * @licstart The following is the entire license notice for the
  3. * JavaScript code in this page
  4. *
  5. * Copyright 2022 Mozilla Foundation
  6. *
  7. * Licensed under the Apache License, Version 2.0 (the "License");
  8. * you may not use this file except in compliance with the License.
  9. * You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS,
  15. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. * See the License for the specific language governing permissions and
  17. * limitations under the License.
  18. *
  19. * @licend The above is the entire license notice for the
  20. * JavaScript code in this page
  21. */
  22. "use strict";
  23. Object.defineProperty(exports, "__esModule", {
  24. value: true
  25. });
  26. Object.defineProperty(exports, "PDFViewerApplication", {
  27. enumerable: true,
  28. get: function () {
  29. return _app.PDFViewerApplication;
  30. }
  31. });
  32. exports.PDFViewerApplicationConstants = void 0;
  33. Object.defineProperty(exports, "PDFViewerApplicationOptions", {
  34. enumerable: true,
  35. get: function () {
  36. return _app_options.AppOptions;
  37. }
  38. });
  39. var _ui_utils = require("./ui_utils.js");
  40. var _app_options = require("./app_options.js");
  41. var _pdf_link_service = require("./pdf_link_service.js");
  42. var _app = require("./app.js");
  43. const pdfjsVersion = '3.2.146';
  44. const pdfjsBuild = '3fd2a3548';
  45. const AppConstants = {
  46. LinkTarget: _pdf_link_service.LinkTarget,
  47. RenderingStates: _ui_utils.RenderingStates,
  48. ScrollMode: _ui_utils.ScrollMode,
  49. SpreadMode: _ui_utils.SpreadMode
  50. };
  51. exports.PDFViewerApplicationConstants = AppConstants;
  52. window.PDFViewerApplication = _app.PDFViewerApplication;
  53. window.PDFViewerApplicationConstants = AppConstants;
  54. window.PDFViewerApplicationOptions = _app_options.AppOptions;
  55. ;
  56. function getViewerConfiguration() {
  57. return {
  58. appContainer: document.body,
  59. mainContainer: document.getElementById("viewerContainer"),
  60. viewerContainer: document.getElementById("viewer"),
  61. passwordOverlay: {
  62. dialog: document.getElementById("passwordDialog"),
  63. label: document.getElementById("passwordText"),
  64. input: document.getElementById("password"),
  65. submitButton: document.getElementById("passwordSubmit"),
  66. cancelButton: document.getElementById("passwordCancel")
  67. },
  68. printContainer: document.getElementById("printContainer"),
  69. openFileInput: document.getElementById("fileInput")
  70. };
  71. }
  72. function webViewerLoad() {
  73. const config = getViewerConfiguration();
  74. _app.PDFViewerApplication.run(config);
  75. }
  76. document.blockUnblockOnload?.(true);
  77. if (document.readyState === "interactive" || document.readyState === "complete") {
  78. webViewerLoad();
  79. } else {
  80. document.addEventListener("DOMContentLoaded", webViewerLoad, true);
  81. }