Browse Source

PDF.js version 1.8.374 - See mozilla/pdf.js@b4c35857ff0b0f61412977b8de513b2ea6688019

master v1.8.374
pdfjsbot 8 years ago
parent
commit
11969843e0
  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. 16
      lib/web/app.js
  14. 99
      lib/web/hand_tool.js
  15. 148
      lib/web/pdf_cursor_tools.js
  16. 1
      lib/web/preferences.js
  17. 49
      lib/web/secondary_toolbar.js
  18. 2
      package.json

2
bower.json

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

12
build/pdf.combined.js

@ -12827,8 +12827,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() { @@ -12827,8 +12827,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
}();
var version, build;
{
exports.version = version = '1.8.371';
exports.build = build = '8d2ae20f';
exports.version = version = '1.8.374';
exports.build = build = 'b4c35857';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;
@ -28240,8 +28240,8 @@ if (!_util.globalScope.PDFJS) { @@ -28240,8 +28240,8 @@ if (!_util.globalScope.PDFJS) {
}
var PDFJS = _util.globalScope.PDFJS;
{
PDFJS.version = '1.8.371';
PDFJS.build = '8d2ae20f';
PDFJS.version = '1.8.374';
PDFJS.build = 'b4c35857';
}
PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {
@ -43834,8 +43834,8 @@ exports.TilingPattern = TilingPattern; @@ -43834,8 +43834,8 @@ exports.TilingPattern = TilingPattern;
"use strict";
var pdfjsVersion = '1.8.371';
var pdfjsBuild = '8d2ae20f';
var pdfjsVersion = '1.8.374';
var pdfjsBuild = 'b4c35857';
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

@ -3535,8 +3535,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() { @@ -3535,8 +3535,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
}();
var version, build;
{
exports.version = version = '1.8.371';
exports.build = build = '8d2ae20f';
exports.version = version = '1.8.374';
exports.build = build = 'b4c35857';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;
@ -5509,8 +5509,8 @@ if (!_util.globalScope.PDFJS) { @@ -5509,8 +5509,8 @@ if (!_util.globalScope.PDFJS) {
}
var PDFJS = _util.globalScope.PDFJS;
{
PDFJS.version = '1.8.371';
PDFJS.build = '8d2ae20f';
PDFJS.version = '1.8.374';
PDFJS.build = 'b4c35857';
}
PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {
@ -8012,8 +8012,8 @@ exports.TilingPattern = TilingPattern; @@ -8012,8 +8012,8 @@ exports.TilingPattern = TilingPattern;
"use strict";
var pdfjsVersion = '1.8.371';
var pdfjsBuild = '8d2ae20f';
var pdfjsVersion = '1.8.374';
var pdfjsBuild = 'b4c35857';
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

@ -37150,8 +37150,8 @@ exports.Type1Parser = Type1Parser; @@ -37150,8 +37150,8 @@ exports.Type1Parser = Type1Parser;
"use strict";
var pdfjsVersion = '1.8.371';
var pdfjsBuild = '8d2ae20f';
var pdfjsVersion = '1.8.374';
var pdfjsBuild = 'b4c35857';
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

@ -1418,8 +1418,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() { @@ -1418,8 +1418,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
}();
var version, build;
{
exports.version = version = '1.8.371';
exports.build = build = '8d2ae20f';
exports.version = version = '1.8.374';
exports.build = build = 'b4c35857';
}
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.371';
PDFJS.build = '8d2ae20f';
PDFJS.version = '1.8.374';
PDFJS.build = 'b4c35857';
}
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.371';
var pdfjsBuild = '8d2ae20f';
var pdfjsVersion = '1.8.374';
var pdfjsBuild = 'b4c35857';
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.371';
var pdfjsBuild = '8d2ae20f';
var pdfjsVersion = '1.8.374';
var pdfjsBuild = 'b4c35857';
var pdfjsCoreWorker = require('./core/worker.js');
{
require('./core/network.js');

16
lib/web/app.js

@ -23,6 +23,8 @@ var _ui_utils = require('./ui_utils'); @@ -23,6 +23,8 @@ var _ui_utils = require('./ui_utils');
var _pdfjs = require('./pdfjs');
var _pdf_cursor_tools = require('./pdf_cursor_tools');
var _pdf_rendering_queue = require('./pdf_rendering_queue');
var _pdf_sidebar = require('./pdf_sidebar');
@ -31,8 +33,6 @@ var _pdf_viewer = require('./pdf_viewer'); @@ -31,8 +33,6 @@ var _pdf_viewer = require('./pdf_viewer');
var _dom_events = require('./dom_events');
var _hand_tool = require('./hand_tool');
var _overlay_manager = require('./overlay_manager');
var _password_prompt = require('./password_prompt');
@ -108,6 +108,7 @@ var PDFViewerApplication = { @@ -108,6 +108,7 @@ var PDFViewerApplication = {
pdfSidebar: null,
pdfOutlineViewer: null,
pdfAttachmentViewer: null,
pdfCursorTools: null,
store: null,
downloadManager: null,
preferences: null,
@ -271,12 +272,12 @@ var PDFViewerApplication = { @@ -271,12 +272,12 @@ var PDFViewerApplication = {
findBarConfig.eventBus = eventBus;
_this2.findBar = new _pdf_find_bar.PDFFindBar(findBarConfig);
_this2.overlayManager = _overlay_manager.OverlayManager;
_this2.handTool = new _hand_tool.HandTool({
_this2.pdfDocumentProperties = new _pdf_document_properties.PDFDocumentProperties(appConfig.documentProperties);
_this2.pdfCursorTools = new _pdf_cursor_tools.PDFCursorTools({
container: container,
eventBus: eventBus,
preferences: _this2.preferences
});
_this2.pdfDocumentProperties = new _pdf_document_properties.PDFDocumentProperties(appConfig.documentProperties);
_this2.toolbar = new _toolbar.Toolbar(appConfig.toolbar, container, eventBus);
_this2.secondaryToolbar = new _secondary_toolbar.SecondaryToolbar(appConfig.secondaryToolbar, container, eventBus);
if (_this2.supportsFullscreen) {
@ -1518,10 +1519,11 @@ function webViewerKeyDown(evt) { @@ -1518,10 +1519,11 @@ function webViewerKeyDown(evt) {
ensureViewerFocused = true;
}
break;
case 83:
PDFViewerApplication.pdfCursorTools.switchTool(_pdf_cursor_tools.CursorTool.SELECT);
break;
case 72:
if (!isViewerInPresentationMode) {
PDFViewerApplication.handTool.toggle();
}
PDFViewerApplication.pdfCursorTools.switchTool(_pdf_cursor_tools.CursorTool.HAND);
break;
case 82:
PDFViewerApplication.rotatePages(90);

99
lib/web/hand_tool.js

@ -1,99 +0,0 @@ @@ -1,99 +0,0 @@
/* Copyright 2017 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.
*/
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.HandTool = 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 _grab_to_pan = require('./grab_to_pan');
var _ui_utils = require('./ui_utils');
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var HandTool = function () {
function HandTool(_ref) {
var _this = this;
var container = _ref.container,
eventBus = _ref.eventBus,
preferences = _ref.preferences;
_classCallCheck(this, HandTool);
this.container = container;
this.eventBus = eventBus;
this.wasActive = false;
this.handTool = new _grab_to_pan.GrabToPan({
element: this.container,
onActiveChanged: function onActiveChanged(isActive) {
_this.eventBus.dispatch('handtoolchanged', { isActive: isActive });
}
});
this.eventBus.on('togglehandtool', this.toggle.bind(this));
var enableOnLoad = preferences.get('enableHandToolOnLoad');
Promise.all([_ui_utils.localized, enableOnLoad]).then(function (values) {
if (values[1] === true) {
_this.handTool.activate();
}
}).catch(function (reason) {});
this.eventBus.on('presentationmodechanged', function (evt) {
if (evt.switchInProgress) {
return;
}
if (evt.active) {
_this.enterPresentationMode();
} else {
_this.exitPresentationMode();
}
});
}
_createClass(HandTool, [{
key: 'toggle',
value: function toggle() {
this.handTool.toggle();
}
}, {
key: 'enterPresentationMode',
value: function enterPresentationMode() {
if (this.isActive) {
this.wasActive = true;
this.handTool.deactivate();
}
}
}, {
key: 'exitPresentationMode',
value: function exitPresentationMode() {
if (this.wasActive) {
this.wasActive = false;
this.handTool.activate();
}
}
}, {
key: 'isActive',
get: function get() {
return !!this.handTool.active;
}
}]);
return HandTool;
}();
exports.HandTool = HandTool;

148
lib/web/pdf_cursor_tools.js

@ -0,0 +1,148 @@ @@ -0,0 +1,148 @@
/* Copyright 2017 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.
*/
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.PDFCursorTools = exports.CursorTool = undefined;
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
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 _grab_to_pan = require('./grab_to_pan');
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var CursorTool = {
SELECT: 0,
HAND: 1,
ZOOM: 2
};
var PDFCursorTools = function () {
function PDFCursorTools(_ref) {
var _this = this;
var container = _ref.container,
eventBus = _ref.eventBus,
preferences = _ref.preferences;
_classCallCheck(this, PDFCursorTools);
this.container = container;
this.eventBus = eventBus;
this.active = CursorTool.SELECT;
this.activeBeforePresentationMode = null;
this.handTool = new _grab_to_pan.GrabToPan({ element: this.container });
this._addEventListeners();
Promise.all([preferences.get('cursorToolOnLoad'), preferences.get('enableHandToolOnLoad')]).then(function (_ref2) {
var _ref3 = _slicedToArray(_ref2, 2),
cursorToolPref = _ref3[0],
handToolPref = _ref3[1];
if (handToolPref === true) {
preferences.set('enableHandToolOnLoad', false);
if (cursorToolPref === CursorTool.SELECT) {
cursorToolPref = CursorTool.HAND;
preferences.set('cursorToolOnLoad', cursorToolPref).catch(function () {});
}
}
_this.switchTool(cursorToolPref);
}).catch(function () {});
}
_createClass(PDFCursorTools, [{
key: 'switchTool',
value: function switchTool(tool) {
var _this2 = this;
if (this.activeBeforePresentationMode !== null) {
return;
}
if (tool === this.active) {
return;
}
var disableActiveTool = function disableActiveTool() {
switch (_this2.active) {
case CursorTool.SELECT:
break;
case CursorTool.HAND:
_this2.handTool.deactivate();
break;
case CursorTool.ZOOM:
}
};
switch (tool) {
case CursorTool.SELECT:
disableActiveTool();
break;
case CursorTool.HAND:
disableActiveTool();
this.handTool.activate();
break;
case CursorTool.ZOOM:
default:
console.error('switchTool: "' + tool + '" is an unsupported value.');
return;
}
this.active = tool;
this._dispatchEvent();
}
}, {
key: '_dispatchEvent',
value: function _dispatchEvent() {
this.eventBus.dispatch('cursortoolchanged', {
source: this,
tool: this.active
});
}
}, {
key: '_addEventListeners',
value: function _addEventListeners() {
var _this3 = this;
this.eventBus.on('switchcursortool', function (evt) {
_this3.switchTool(evt.tool);
});
this.eventBus.on('presentationmodechanged', function (evt) {
if (evt.switchInProgress) {
return;
}
var previouslyActive = void 0;
if (evt.active) {
previouslyActive = _this3.active;
_this3.switchTool(CursorTool.SELECT);
_this3.activeBeforePresentationMode = previouslyActive;
} else {
previouslyActive = _this3.activeBeforePresentationMode;
_this3.activeBeforePresentationMode = null;
_this3.switchTool(previouslyActive);
}
});
}
}, {
key: 'activeTool',
get: function get() {
return this.active;
}
}]);
return PDFCursorTools;
}();
exports.CursorTool = CursorTool;
exports.PDFCursorTools = PDFCursorTools;

1
lib/web/preferences.js

@ -35,6 +35,7 @@ function getDefaultPreferences() { @@ -35,6 +35,7 @@ function getDefaultPreferences() {
"defaultZoomValue": "",
"sidebarViewOnLoad": 0,
"enableHandToolOnLoad": false,
"cursorToolOnLoad": 0,
"enableWebGL": false,
"pdfBugEnabled": false,
"disableRange": false,

49
lib/web/secondary_toolbar.js

@ -21,6 +21,8 @@ exports.SecondaryToolbar = undefined; @@ -21,6 +21,8 @@ exports.SecondaryToolbar = 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_cursor_tools = require('./pdf_cursor_tools');
var _ui_utils = require('./ui_utils');
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@ -69,8 +71,14 @@ var SecondaryToolbar = function () { @@ -69,8 +71,14 @@ var SecondaryToolbar = function () {
eventName: 'rotateccw',
close: false
}, {
element: options.toggleHandToolButton,
eventName: 'togglehandtool',
element: options.cursorSelectToolButton,
eventName: 'switchcursortool',
eventDetails: { tool: _pdf_cursor_tools.CursorTool.SELECT },
close: true
}, {
element: options.cursorHandToolButton,
eventName: 'switchcursortool',
eventDetails: { tool: _pdf_cursor_tools.CursorTool.HAND },
close: true
}, {
element: options.documentPropertiesButton,
@ -90,7 +98,7 @@ var SecondaryToolbar = function () { @@ -90,7 +98,7 @@ var SecondaryToolbar = function () {
this.previousContainerHeight = null;
this.reset();
this._bindClickListeners();
this._bindHandToolListener(options.toggleHandToolButton);
this._bindCursorToolsListener(options);
this.eventBus.on('resize', this._setMaxHeight.bind(this));
}
@ -132,11 +140,16 @@ var SecondaryToolbar = function () { @@ -132,11 +140,16 @@ var SecondaryToolbar = function () {
var _buttons$button = _this.buttons[button],
element = _buttons$button.element,
eventName = _buttons$button.eventName,
close = _buttons$button.close;
close = _buttons$button.close,
eventDetails = _buttons$button.eventDetails;
element.addEventListener('click', function (evt) {
if (eventName !== null) {
_this.eventBus.dispatch(eventName, { source: _this });
var details = { source: _this };
for (var property in eventDetails) {
details[property] = eventDetails[property];
}
_this.eventBus.dispatch(eventName, details);
}
if (close) {
_this.close();
@ -149,20 +162,18 @@ var SecondaryToolbar = function () { @@ -149,20 +162,18 @@ var SecondaryToolbar = function () {
}
}
}, {
key: '_bindHandToolListener',
value: function _bindHandToolListener(toggleHandToolButton) {
var isHandToolActive = false;
this.eventBus.on('handtoolchanged', function (evt) {
if (isHandToolActive === evt.isActive) {
return;
}
isHandToolActive = evt.isActive;
if (isHandToolActive) {
toggleHandToolButton.title = _ui_utils.mozL10n.get('hand_tool_disable.title', null, 'Disable hand tool');
toggleHandToolButton.firstElementChild.textContent = _ui_utils.mozL10n.get('hand_tool_disable_label', null, 'Disable hand tool');
} else {
toggleHandToolButton.title = _ui_utils.mozL10n.get('hand_tool_enable.title', null, 'Enable hand tool');
toggleHandToolButton.firstElementChild.textContent = _ui_utils.mozL10n.get('hand_tool_enable_label', null, 'Enable hand tool');
key: '_bindCursorToolsListener',
value: function _bindCursorToolsListener(buttons) {
this.eventBus.on('cursortoolchanged', function (evt) {
buttons.cursorSelectToolButton.classList.remove('toggled');
buttons.cursorHandToolButton.classList.remove('toggled');
switch (evt.tool) {
case _pdf_cursor_tools.CursorTool.SELECT:
buttons.cursorSelectToolButton.classList.add('toggled');
break;
case _pdf_cursor_tools.CursorTool.HAND:
buttons.cursorHandToolButton.classList.add('toggled');
break;
}
});
}

2
package.json

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

Loading…
Cancel
Save