You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
151 lines
6.5 KiB
151 lines
6.5 KiB
/** |
|
* @licstart The following is the entire license notice for the |
|
* Javascript code in this page |
|
* |
|
* Copyright 2019 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 |
|
*/ |
|
"use strict"; |
|
|
|
Object.defineProperty(exports, "__esModule", { |
|
value: true |
|
}); |
|
exports.GenericCom = void 0; |
|
|
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator")); |
|
|
|
var _app = require("./app"); |
|
|
|
var _preferences = require("./preferences"); |
|
|
|
var _download_manager = require("./download_manager"); |
|
|
|
var _genericl10n = require("./genericl10n"); |
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } |
|
|
|
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } |
|
|
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } |
|
|
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } |
|
|
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
|
|
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } |
|
|
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } |
|
|
|
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } |
|
|
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } |
|
|
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } |
|
|
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } |
|
|
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } |
|
|
|
; |
|
var GenericCom = {}; |
|
exports.GenericCom = GenericCom; |
|
|
|
var GenericPreferences = |
|
/*#__PURE__*/ |
|
function (_BasePreferences) { |
|
_inherits(GenericPreferences, _BasePreferences); |
|
|
|
function GenericPreferences() { |
|
_classCallCheck(this, GenericPreferences); |
|
|
|
return _possibleConstructorReturn(this, _getPrototypeOf(GenericPreferences).apply(this, arguments)); |
|
} |
|
|
|
_createClass(GenericPreferences, [{ |
|
key: "_writeToStorage", |
|
value: function () { |
|
var _writeToStorage2 = _asyncToGenerator( |
|
/*#__PURE__*/ |
|
_regenerator["default"].mark(function _callee(prefObj) { |
|
return _regenerator["default"].wrap(function _callee$(_context) { |
|
while (1) { |
|
switch (_context.prev = _context.next) { |
|
case 0: |
|
localStorage.setItem('pdfjs.preferences', JSON.stringify(prefObj)); |
|
|
|
case 1: |
|
case "end": |
|
return _context.stop(); |
|
} |
|
} |
|
}, _callee); |
|
})); |
|
|
|
function _writeToStorage(_x) { |
|
return _writeToStorage2.apply(this, arguments); |
|
} |
|
|
|
return _writeToStorage; |
|
}() |
|
}, { |
|
key: "_readFromStorage", |
|
value: function () { |
|
var _readFromStorage2 = _asyncToGenerator( |
|
/*#__PURE__*/ |
|
_regenerator["default"].mark(function _callee2(prefObj) { |
|
return _regenerator["default"].wrap(function _callee2$(_context2) { |
|
while (1) { |
|
switch (_context2.prev = _context2.next) { |
|
case 0: |
|
return _context2.abrupt("return", JSON.parse(localStorage.getItem('pdfjs.preferences'))); |
|
|
|
case 1: |
|
case "end": |
|
return _context2.stop(); |
|
} |
|
} |
|
}, _callee2); |
|
})); |
|
|
|
function _readFromStorage(_x2) { |
|
return _readFromStorage2.apply(this, arguments); |
|
} |
|
|
|
return _readFromStorage; |
|
}() |
|
}]); |
|
|
|
return GenericPreferences; |
|
}(_preferences.BasePreferences); |
|
|
|
var GenericExternalServices = Object.create(_app.DefaultExternalServices); |
|
|
|
GenericExternalServices.createDownloadManager = function (options) { |
|
return new _download_manager.DownloadManager(options); |
|
}; |
|
|
|
GenericExternalServices.createPreferences = function () { |
|
return new GenericPreferences(); |
|
}; |
|
|
|
GenericExternalServices.createL10n = function (_ref) { |
|
var _ref$locale = _ref.locale, |
|
locale = _ref$locale === void 0 ? 'en-US' : _ref$locale; |
|
return new _genericl10n.GenericL10n(locale); |
|
}; |
|
|
|
_app.PDFViewerApplication.externalServices = GenericExternalServices; |