Browse Source

PDF.js version 1.8.499 - See mozilla/pdf.js@d6a6f390ae9a39554b73a942860f67badbef1b4b

master v1.8.499
pdfjsbot 8 years ago
parent
commit
f9f216f735
  1. 2
      bower.json
  2. 12
      build/pdf.combined.js
  3. 2
      build/pdf.combined.js.map
  4. 12
      build/pdf.js
  5. 2
      build/pdf.js.map
  6. 4
      build/pdf.min.js
  7. 4
      build/pdf.worker.js
  8. 2
      build/pdf.worker.js.map
  9. 4
      lib/display/api.js
  10. 4
      lib/display/global.js
  11. 4
      lib/pdf.js
  12. 4
      lib/pdf.worker.js
  13. 2
      lib/web/app.js
  14. 153
      lib/web/ui_utils.js
  15. 2
      package.json
  16. 153
      web/pdf_viewer.js
  17. 2
      web/pdf_viewer.js.map

2
bower.json

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
{
"name": "pdfjs-dist",
"version": "1.8.497",
"version": "1.8.499",
"main": [
"build/pdf.js",
"build/pdf.worker.js"

12
build/pdf.combined.js

@ -13125,8 +13125,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() { @@ -13125,8 +13125,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
}();
var version, build;
{
exports.version = version = '1.8.497';
exports.build = build = 'f2fcf2a5';
exports.version = version = '1.8.499';
exports.build = build = 'd6a6f390';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;
@ -28630,8 +28630,8 @@ if (!_util.globalScope.PDFJS) { @@ -28630,8 +28630,8 @@ if (!_util.globalScope.PDFJS) {
}
var PDFJS = _util.globalScope.PDFJS;
{
PDFJS.version = '1.8.497';
PDFJS.build = 'f2fcf2a5';
PDFJS.version = '1.8.499';
PDFJS.build = 'd6a6f390';
}
PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {
@ -47250,8 +47250,8 @@ exports.TilingPattern = TilingPattern; @@ -47250,8 +47250,8 @@ exports.TilingPattern = TilingPattern;
"use strict";
var pdfjsVersion = '1.8.497';
var pdfjsBuild = 'f2fcf2a5';
var pdfjsVersion = '1.8.499';
var pdfjsBuild = 'd6a6f390';
var pdfjsSharedUtil = __w_pdfjs_require__(0);
var pdfjsDisplayGlobal = __w_pdfjs_require__(26);
var pdfjsDisplayAPI = __w_pdfjs_require__(10);

2
build/pdf.combined.js.map

File diff suppressed because one or more lines are too long

12
build/pdf.js

@ -3854,8 +3854,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() { @@ -3854,8 +3854,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
}();
var version, build;
{
exports.version = version = '1.8.497';
exports.build = build = 'f2fcf2a5';
exports.version = version = '1.8.499';
exports.build = build = 'd6a6f390';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;
@ -5912,8 +5912,8 @@ if (!_util.globalScope.PDFJS) { @@ -5912,8 +5912,8 @@ if (!_util.globalScope.PDFJS) {
}
var PDFJS = _util.globalScope.PDFJS;
{
PDFJS.version = '1.8.497';
PDFJS.build = 'f2fcf2a5';
PDFJS.version = '1.8.499';
PDFJS.build = 'd6a6f390';
}
PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {
@ -11452,8 +11452,8 @@ exports.TilingPattern = TilingPattern; @@ -11452,8 +11452,8 @@ exports.TilingPattern = TilingPattern;
"use strict";
var pdfjsVersion = '1.8.497';
var pdfjsBuild = 'f2fcf2a5';
var pdfjsVersion = '1.8.499';
var pdfjsBuild = 'd6a6f390';
var pdfjsSharedUtil = __w_pdfjs_require__(0);
var pdfjsDisplayGlobal = __w_pdfjs_require__(9);
var pdfjsDisplayAPI = __w_pdfjs_require__(3);

2
build/pdf.js.map

File diff suppressed because one or more lines are too long

4
build/pdf.min.js vendored

File diff suppressed because one or more lines are too long

4
build/pdf.worker.js vendored

@ -40403,8 +40403,8 @@ exports.Type1Parser = Type1Parser; @@ -40403,8 +40403,8 @@ exports.Type1Parser = Type1Parser;
"use strict";
var pdfjsVersion = '1.8.497';
var pdfjsBuild = 'f2fcf2a5';
var pdfjsVersion = '1.8.499';
var pdfjsBuild = 'd6a6f390';
var pdfjsCoreWorker = __w_pdfjs_require__(8);
{
__w_pdfjs_require__(19);

2
build/pdf.worker.js.map vendored

File diff suppressed because one or more lines are too long

4
lib/display/api.js

@ -1480,8 +1480,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() { @@ -1480,8 +1480,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
}();
var version, build;
{
exports.version = version = '1.8.497';
exports.build = build = 'f2fcf2a5';
exports.version = version = '1.8.499';
exports.build = build = 'd6a6f390';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;

4
lib/display/global.js

@ -39,8 +39,8 @@ if (!_util.globalScope.PDFJS) { @@ -39,8 +39,8 @@ if (!_util.globalScope.PDFJS) {
}
var PDFJS = _util.globalScope.PDFJS;
{
PDFJS.version = '1.8.497';
PDFJS.build = 'f2fcf2a5';
PDFJS.version = '1.8.499';
PDFJS.build = 'd6a6f390';
}
PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {

4
lib/pdf.js

@ -14,8 +14,8 @@ @@ -14,8 +14,8 @@
*/
'use strict';
var pdfjsVersion = '1.8.497';
var pdfjsBuild = 'f2fcf2a5';
var pdfjsVersion = '1.8.499';
var pdfjsBuild = 'd6a6f390';
var pdfjsSharedUtil = require('./shared/util.js');
var pdfjsDisplayGlobal = require('./display/global.js');
var pdfjsDisplayAPI = require('./display/api.js');

4
lib/pdf.worker.js vendored

@ -14,8 +14,8 @@ @@ -14,8 +14,8 @@
*/
'use strict';
var pdfjsVersion = '1.8.497';
var pdfjsBuild = 'f2fcf2a5';
var pdfjsVersion = '1.8.499';
var pdfjsBuild = 'd6a6f390';
var pdfjsCoreWorker = require('./core/worker.js');
{
require('./core/network.js');

2
lib/web/app.js

@ -396,7 +396,7 @@ var PDFViewerApplication = { @@ -396,7 +396,7 @@ var PDFViewerApplication = {
return this.externalServices.supportsDocumentColors;
},
get loadingBar() {
var bar = new _ui_utils.ProgressBar('#loadingBar', {});
var bar = new _ui_utils.ProgressBar('#loadingBar');
return (0, _pdf.shadow)(this, 'loadingBar', bar);
},
get supportedMouseWheelZoomModifierKeys() {

153
lib/web/ui_utils.js

@ -19,8 +19,12 @@ Object.defineProperty(exports, "__esModule", { @@ -19,8 +19,12 @@ Object.defineProperty(exports, "__esModule", {
});
exports.localized = exports.animationStarted = exports.normalizeWheelEventDelta = exports.binarySearchFirstItem = exports.watchScroll = exports.scrollIntoView = exports.getOutputScale = exports.approximateFraction = exports.roundToDivide = exports.getVisibleElements = exports.parseQueryString = exports.noContextMenuHandler = exports.getPDFFileNameFromURL = exports.ProgressBar = exports.EventBus = exports.NullL10n = exports.mozL10n = exports.RendererType = exports.cloneObj = exports.VERTICAL_PADDING = exports.SCROLLBAR_PADDING = exports.MAX_AUTO_SCALE = exports.UNKNOWN_SCALE = exports.MAX_SCALE = exports.MIN_SCALE = exports.DEFAULT_SCALE = exports.DEFAULT_SCALE_VALUE = exports.CSS_UNITS = undefined;
var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _pdf = require('../pdf');
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var CSS_UNITS = 96.0 / 72.0;
var DEFAULT_SCALE_VALUE = 'auto';
var DEFAULT_SCALE = 1.0;
@ -69,16 +73,17 @@ function getOutputScale(ctx) { @@ -69,16 +73,17 @@ function getOutputScale(ctx) {
scaled: pixelRatio !== 1
};
}
function scrollIntoView(element, spot, skipOverflowHiddenElements) {
function scrollIntoView(element, spot) {
var skipOverflowHiddenElements = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
var parent = element.offsetParent;
if (!parent) {
console.error('offsetParent is not set -- cannot scroll');
return;
}
var checkOverflow = skipOverflowHiddenElements || false;
var offsetY = element.offsetTop + element.clientTop;
var offsetX = element.offsetLeft + element.clientLeft;
while (parent.clientHeight === parent.scrollHeight || checkOverflow && getComputedStyle(parent).overflow === 'hidden') {
while (parent.clientHeight === parent.scrollHeight || skipOverflowHiddenElements && getComputedStyle(parent).overflow === 'hidden') {
if (parent.dataset._scaleY) {
offsetY /= parent.dataset._scaleY;
offsetX /= parent.dataset._scaleX;
@ -128,7 +133,7 @@ function watchScroll(viewAreaElement, callback) { @@ -128,7 +133,7 @@ function watchScroll(viewAreaElement, callback) {
}
function parseQueryString(query) {
var parts = query.split('&');
var params = {};
var params = Object.create(null);
for (var i = 0, ii = parts.length; i < ii; ++i) {
var param = parts[i].split('=');
var key = param[0].toLowerCase();
@ -187,7 +192,7 @@ function approximateFraction(x) { @@ -187,7 +192,7 @@ function approximateFraction(x) {
b = q;
}
}
var result;
var result = void 0;
if (x_ - a / b < c / d - x_) {
result = x_ === x ? [a, b] : [b, a];
} else {
@ -199,7 +204,9 @@ function roundToDivide(x, div) { @@ -199,7 +204,9 @@ function roundToDivide(x, div) {
var r = x % div;
return r === 0 ? x : Math.round(x - r + div);
}
function getVisibleElements(scrollEl, views, sortByVisibility) {
function getVisibleElements(scrollEl, views) {
var sortByVisibility = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
var top = scrollEl.scrollTop,
bottom = top + scrollEl.clientHeight;
var left = scrollEl.scrollLeft,
@ -210,10 +217,14 @@ function getVisibleElements(scrollEl, views, sortByVisibility) { @@ -210,10 +217,14 @@ function getVisibleElements(scrollEl, views, sortByVisibility) {
return elementBottom > top;
}
var visible = [],
view,
element;
var currentHeight, viewHeight, hiddenHeight, percentHeight;
var currentWidth, viewWidth;
view = void 0,
element = void 0;
var currentHeight = void 0,
viewHeight = void 0,
hiddenHeight = void 0,
percentHeight = void 0;
var currentWidth = void 0,
viewWidth = void 0;
var firstVisibleElementInd = views.length === 0 ? 0 : binarySearchFirstItem(views, isElementBottomBelowViewTop);
for (var i = firstVisibleElementInd, ii = views.length; i < ii; i++) {
view = views[i];
@ -255,8 +266,8 @@ function getVisibleElements(scrollEl, views, sortByVisibility) { @@ -255,8 +266,8 @@ function getVisibleElements(scrollEl, views, sortByVisibility) {
views: visible
};
}
function noContextMenuHandler(e) {
e.preventDefault();
function noContextMenuHandler(evt) {
evt.preventDefault();
}
function isDataSchema(url) {
var i = 0,
@ -282,7 +293,7 @@ function getPDFFileNameFromURL(url) { @@ -282,7 +293,7 @@ function getPDFFileNameFromURL(url) {
if (suggestedFilename.indexOf('%') !== -1) {
try {
suggestedFilename = reFilename.exec(decodeURIComponent(suggestedFilename))[0];
} catch (e) {}
} catch (ex) {}
}
}
return suggestedFilename || defaultFilename;
@ -305,7 +316,7 @@ function normalizeWheelEventDelta(evt) { @@ -305,7 +316,7 @@ function normalizeWheelEventDelta(evt) {
return delta;
}
function cloneObj(obj) {
var result = {};
var result = Object.create(null);
for (var i in obj) {
if (Object.prototype.hasOwnProperty.call(obj, i)) {
result[i] = obj[i];
@ -316,30 +327,39 @@ function cloneObj(obj) { @@ -316,30 +327,39 @@ function cloneObj(obj) {
var animationStarted = new Promise(function (resolve) {
window.requestAnimationFrame(resolve);
});
var mozL10n;
var mozL10n = void 0;
var localized = Promise.resolve();
var EventBus = function EventBusClosure() {
var EventBus = function () {
function EventBus() {
_classCallCheck(this, EventBus);
this._listeners = Object.create(null);
}
EventBus.prototype = {
on: function EventBus_on(eventName, listener) {
_createClass(EventBus, [{
key: 'on',
value: function on(eventName, listener) {
var eventListeners = this._listeners[eventName];
if (!eventListeners) {
eventListeners = [];
this._listeners[eventName] = eventListeners;
}
eventListeners.push(listener);
},
off: function EventBus_on(eventName, listener) {
}
}, {
key: 'off',
value: function off(eventName, listener) {
var eventListeners = this._listeners[eventName];
var i;
var i = void 0;
if (!eventListeners || (i = eventListeners.indexOf(listener)) < 0) {
return;
}
eventListeners.splice(i, 1);
},
dispatch: function EventBus_dispath(eventName) {
}
}, {
key: 'dispatch',
value: function dispatch(eventName) {
var eventListeners = this._listeners[eventName];
if (!eventListeners || eventListeners.length === 0) {
return;
@ -349,25 +369,37 @@ var EventBus = function EventBusClosure() { @@ -349,25 +369,37 @@ var EventBus = function EventBusClosure() {
listener.apply(null, args);
});
}
};
}]);
return EventBus;
}();
var ProgressBar = function ProgressBarClosure() {
function clamp(v, min, max) {
return Math.min(Math.max(v, min), max);
}
function ProgressBar(id, opts) {
function clamp(v, min, max) {
return Math.min(Math.max(v, min), max);
}
var ProgressBar = function () {
function ProgressBar(id) {
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
height = _ref.height,
width = _ref.width,
units = _ref.units;
_classCallCheck(this, ProgressBar);
this.visible = true;
this.div = document.querySelector(id + ' .progress');
this.bar = this.div.parentNode;
this.height = opts.height || 100;
this.width = opts.width || 100;
this.units = opts.units || '%';
this.height = height || 100;
this.width = width || 100;
this.units = units || '%';
this.div.style.height = this.height + this.units;
this.percent = 0;
}
ProgressBar.prototype = {
updateBar: function ProgressBar_updateBar() {
_createClass(ProgressBar, [{
key: '_updateBar',
value: function _updateBar() {
if (this._indeterminate) {
this.div.classList.add('indeterminate');
this.div.style.width = this.width + this.units;
@ -376,33 +408,32 @@ var ProgressBar = function ProgressBarClosure() { @@ -376,33 +408,32 @@ var ProgressBar = function ProgressBarClosure() {
this.div.classList.remove('indeterminate');
var progressSize = this.width * this._percent / 100;
this.div.style.width = progressSize + this.units;
},
get percent() {
return this._percent;
},
set percent(val) {
this._indeterminate = isNaN(val);
this._percent = clamp(val, 0, 100);
this.updateBar();
},
setWidth: function ProgressBar_setWidth(viewer) {
if (viewer) {
var container = viewer.parentNode;
var scrollbarWidth = container.offsetWidth - viewer.offsetWidth;
if (scrollbarWidth > 0) {
this.bar.setAttribute('style', 'width: calc(100% - ' + scrollbarWidth + 'px);');
}
}
}, {
key: 'setWidth',
value: function setWidth(viewer) {
if (!viewer) {
return;
}
},
hide: function ProgressBar_hide() {
var container = viewer.parentNode;
var scrollbarWidth = container.offsetWidth - viewer.offsetWidth;
if (scrollbarWidth > 0) {
this.bar.setAttribute('style', 'width: calc(100% - ' + scrollbarWidth + 'px);');
}
}
}, {
key: 'hide',
value: function hide() {
if (!this.visible) {
return;
}
this.visible = false;
this.bar.classList.add('hidden');
document.body.classList.remove('loadingInProgress');
},
show: function ProgressBar_show() {
}
}, {
key: 'show',
value: function show() {
if (this.visible) {
return;
}
@ -410,9 +441,21 @@ var ProgressBar = function ProgressBarClosure() { @@ -410,9 +441,21 @@ var ProgressBar = function ProgressBarClosure() {
document.body.classList.add('loadingInProgress');
this.bar.classList.remove('hidden');
}
};
}, {
key: 'percent',
get: function get() {
return this._percent;
},
set: function set(val) {
this._indeterminate = isNaN(val);
this._percent = clamp(val, 0, 100);
this._updateBar();
}
}]);
return ProgressBar;
}();
exports.CSS_UNITS = CSS_UNITS;
exports.DEFAULT_SCALE_VALUE = DEFAULT_SCALE_VALUE;
exports.DEFAULT_SCALE = DEFAULT_SCALE;

2
package.json

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
{
"name": "pdfjs-dist",
"version": "1.8.497",
"version": "1.8.499",
"main": "build/pdf.js",
"description": "Generic build of Mozilla's PDF.js library.",
"keywords": [

153
web/pdf_viewer.js

@ -122,8 +122,12 @@ Object.defineProperty(exports, "__esModule", { @@ -122,8 +122,12 @@ Object.defineProperty(exports, "__esModule", {
});
exports.localized = exports.animationStarted = exports.normalizeWheelEventDelta = exports.binarySearchFirstItem = exports.watchScroll = exports.scrollIntoView = exports.getOutputScale = exports.approximateFraction = exports.roundToDivide = exports.getVisibleElements = exports.parseQueryString = exports.noContextMenuHandler = exports.getPDFFileNameFromURL = exports.ProgressBar = exports.EventBus = exports.NullL10n = exports.mozL10n = exports.RendererType = exports.cloneObj = exports.VERTICAL_PADDING = exports.SCROLLBAR_PADDING = exports.MAX_AUTO_SCALE = exports.UNKNOWN_SCALE = exports.MAX_SCALE = exports.MIN_SCALE = exports.DEFAULT_SCALE = exports.DEFAULT_SCALE_VALUE = exports.CSS_UNITS = undefined;
var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _pdfjsLib = __w_pdfjs_require__(0);
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var CSS_UNITS = 96.0 / 72.0;
var DEFAULT_SCALE_VALUE = 'auto';
var DEFAULT_SCALE = 1.0;
@ -172,16 +176,17 @@ function getOutputScale(ctx) { @@ -172,16 +176,17 @@ function getOutputScale(ctx) {
scaled: pixelRatio !== 1
};
}
function scrollIntoView(element, spot, skipOverflowHiddenElements) {
function scrollIntoView(element, spot) {
var skipOverflowHiddenElements = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
var parent = element.offsetParent;
if (!parent) {
console.error('offsetParent is not set -- cannot scroll');
return;
}
var checkOverflow = skipOverflowHiddenElements || false;
var offsetY = element.offsetTop + element.clientTop;
var offsetX = element.offsetLeft + element.clientLeft;
while (parent.clientHeight === parent.scrollHeight || checkOverflow && getComputedStyle(parent).overflow === 'hidden') {
while (parent.clientHeight === parent.scrollHeight || skipOverflowHiddenElements && getComputedStyle(parent).overflow === 'hidden') {
if (parent.dataset._scaleY) {
offsetY /= parent.dataset._scaleY;
offsetX /= parent.dataset._scaleX;
@ -231,7 +236,7 @@ function watchScroll(viewAreaElement, callback) { @@ -231,7 +236,7 @@ function watchScroll(viewAreaElement, callback) {
}
function parseQueryString(query) {
var parts = query.split('&');
var params = {};
var params = Object.create(null);
for (var i = 0, ii = parts.length; i < ii; ++i) {
var param = parts[i].split('=');
var key = param[0].toLowerCase();
@ -290,7 +295,7 @@ function approximateFraction(x) { @@ -290,7 +295,7 @@ function approximateFraction(x) {
b = q;
}
}
var result;
var result = void 0;
if (x_ - a / b < c / d - x_) {
result = x_ === x ? [a, b] : [b, a];
} else {
@ -302,7 +307,9 @@ function roundToDivide(x, div) { @@ -302,7 +307,9 @@ function roundToDivide(x, div) {
var r = x % div;
return r === 0 ? x : Math.round(x - r + div);
}
function getVisibleElements(scrollEl, views, sortByVisibility) {
function getVisibleElements(scrollEl, views) {
var sortByVisibility = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
var top = scrollEl.scrollTop,
bottom = top + scrollEl.clientHeight;
var left = scrollEl.scrollLeft,
@ -313,10 +320,14 @@ function getVisibleElements(scrollEl, views, sortByVisibility) { @@ -313,10 +320,14 @@ function getVisibleElements(scrollEl, views, sortByVisibility) {
return elementBottom > top;
}
var visible = [],
view,
element;
var currentHeight, viewHeight, hiddenHeight, percentHeight;
var currentWidth, viewWidth;
view = void 0,
element = void 0;
var currentHeight = void 0,
viewHeight = void 0,
hiddenHeight = void 0,
percentHeight = void 0;
var currentWidth = void 0,
viewWidth = void 0;
var firstVisibleElementInd = views.length === 0 ? 0 : binarySearchFirstItem(views, isElementBottomBelowViewTop);
for (var i = firstVisibleElementInd, ii = views.length; i < ii; i++) {
view = views[i];
@ -358,8 +369,8 @@ function getVisibleElements(scrollEl, views, sortByVisibility) { @@ -358,8 +369,8 @@ function getVisibleElements(scrollEl, views, sortByVisibility) {
views: visible
};
}
function noContextMenuHandler(e) {
e.preventDefault();
function noContextMenuHandler(evt) {
evt.preventDefault();
}
function isDataSchema(url) {
var i = 0,
@ -385,7 +396,7 @@ function getPDFFileNameFromURL(url) { @@ -385,7 +396,7 @@ function getPDFFileNameFromURL(url) {
if (suggestedFilename.indexOf('%') !== -1) {
try {
suggestedFilename = reFilename.exec(decodeURIComponent(suggestedFilename))[0];
} catch (e) {}
} catch (ex) {}
}
}
return suggestedFilename || defaultFilename;
@ -408,7 +419,7 @@ function normalizeWheelEventDelta(evt) { @@ -408,7 +419,7 @@ function normalizeWheelEventDelta(evt) {
return delta;
}
function cloneObj(obj) {
var result = {};
var result = Object.create(null);
for (var i in obj) {
if (Object.prototype.hasOwnProperty.call(obj, i)) {
result[i] = obj[i];
@ -419,30 +430,39 @@ function cloneObj(obj) { @@ -419,30 +430,39 @@ function cloneObj(obj) {
var animationStarted = new Promise(function (resolve) {
window.requestAnimationFrame(resolve);
});
var mozL10n;
var mozL10n = void 0;
var localized = Promise.resolve();
var EventBus = function EventBusClosure() {
var EventBus = function () {
function EventBus() {
_classCallCheck(this, EventBus);
this._listeners = Object.create(null);
}
EventBus.prototype = {
on: function EventBus_on(eventName, listener) {
_createClass(EventBus, [{
key: 'on',
value: function on(eventName, listener) {
var eventListeners = this._listeners[eventName];
if (!eventListeners) {
eventListeners = [];
this._listeners[eventName] = eventListeners;
}
eventListeners.push(listener);
},
off: function EventBus_on(eventName, listener) {
}
}, {
key: 'off',
value: function off(eventName, listener) {
var eventListeners = this._listeners[eventName];
var i;
var i = void 0;
if (!eventListeners || (i = eventListeners.indexOf(listener)) < 0) {
return;
}
eventListeners.splice(i, 1);
},
dispatch: function EventBus_dispath(eventName) {
}
}, {
key: 'dispatch',
value: function dispatch(eventName) {
var eventListeners = this._listeners[eventName];
if (!eventListeners || eventListeners.length === 0) {
return;
@ -452,25 +472,37 @@ var EventBus = function EventBusClosure() { @@ -452,25 +472,37 @@ var EventBus = function EventBusClosure() {
listener.apply(null, args);
});
}
};
}]);
return EventBus;
}();
var ProgressBar = function ProgressBarClosure() {
function clamp(v, min, max) {
return Math.min(Math.max(v, min), max);
}
function ProgressBar(id, opts) {
function clamp(v, min, max) {
return Math.min(Math.max(v, min), max);
}
var ProgressBar = function () {
function ProgressBar(id) {
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
height = _ref.height,
width = _ref.width,
units = _ref.units;
_classCallCheck(this, ProgressBar);
this.visible = true;
this.div = document.querySelector(id + ' .progress');
this.bar = this.div.parentNode;
this.height = opts.height || 100;
this.width = opts.width || 100;
this.units = opts.units || '%';
this.height = height || 100;
this.width = width || 100;
this.units = units || '%';
this.div.style.height = this.height + this.units;
this.percent = 0;
}
ProgressBar.prototype = {
updateBar: function ProgressBar_updateBar() {
_createClass(ProgressBar, [{
key: '_updateBar',
value: function _updateBar() {
if (this._indeterminate) {
this.div.classList.add('indeterminate');
this.div.style.width = this.width + this.units;
@ -479,33 +511,32 @@ var ProgressBar = function ProgressBarClosure() { @@ -479,33 +511,32 @@ var ProgressBar = function ProgressBarClosure() {
this.div.classList.remove('indeterminate');
var progressSize = this.width * this._percent / 100;
this.div.style.width = progressSize + this.units;
},
get percent() {
return this._percent;
},
set percent(val) {
this._indeterminate = isNaN(val);
this._percent = clamp(val, 0, 100);
this.updateBar();
},
setWidth: function ProgressBar_setWidth(viewer) {
if (viewer) {
var container = viewer.parentNode;
var scrollbarWidth = container.offsetWidth - viewer.offsetWidth;
if (scrollbarWidth > 0) {
this.bar.setAttribute('style', 'width: calc(100% - ' + scrollbarWidth + 'px);');
}
}
}, {
key: 'setWidth',
value: function setWidth(viewer) {
if (!viewer) {
return;
}
},
hide: function ProgressBar_hide() {
var container = viewer.parentNode;
var scrollbarWidth = container.offsetWidth - viewer.offsetWidth;
if (scrollbarWidth > 0) {
this.bar.setAttribute('style', 'width: calc(100% - ' + scrollbarWidth + 'px);');
}
}
}, {
key: 'hide',
value: function hide() {
if (!this.visible) {
return;
}
this.visible = false;
this.bar.classList.add('hidden');
document.body.classList.remove('loadingInProgress');
},
show: function ProgressBar_show() {
}
}, {
key: 'show',
value: function show() {
if (this.visible) {
return;
}
@ -513,9 +544,21 @@ var ProgressBar = function ProgressBarClosure() { @@ -513,9 +544,21 @@ var ProgressBar = function ProgressBarClosure() {
document.body.classList.add('loadingInProgress');
this.bar.classList.remove('hidden');
}
};
}, {
key: 'percent',
get: function get() {
return this._percent;
},
set: function set(val) {
this._indeterminate = isNaN(val);
this._percent = clamp(val, 0, 100);
this._updateBar();
}
}]);
return ProgressBar;
}();
exports.CSS_UNITS = CSS_UNITS;
exports.DEFAULT_SCALE_VALUE = DEFAULT_SCALE_VALUE;
exports.DEFAULT_SCALE = DEFAULT_SCALE;

2
web/pdf_viewer.js.map

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save