Merge pull request #8469 from Snuffleupagus/ESLint-object-styles-web

Fix inconsistent spacing and trailing commas in objects in `web/` files, so we can enable the `comma-dangle` and `object-curly-spacing` ESLint rules later on
This commit is contained in:
Tim van der Meij 2017-06-01 23:48:10 +02:00 committed by GitHub
commit 593dec1bb7
26 changed files with 125 additions and 124 deletions

View File

@ -49,7 +49,7 @@ class AnnotationLayerBuilder {
render(viewport, intent = 'display') {
this.pdfPage.getAnnotations({ intent, }).then((annotations) => {
var parameters = {
viewport: viewport.clone({ dontFlip: true }),
viewport: viewport.clone({ dontFlip: true, }),
div: this.div,
annotations,
page: this.pdfPage,

View File

@ -22,7 +22,7 @@ import {
import {
build, createBlob, getDocument, getFilenameFromUrl, InvalidPDFException,
MissingPDFException, OPS, PDFJS, shadow, UnexpectedResponseException,
UNSUPPORTED_FEATURES, version,
UNSUPPORTED_FEATURES, version
} from 'pdfjs-lib';
import { CursorTool, PDFCursorTools } from './pdf_cursor_tools';
import { PDFRenderingQueue, RenderingStates } from './pdf_rendering_queue';
@ -329,7 +329,7 @@ var PDFViewerApplication = {
container: thumbnailContainer,
renderingQueue: pdfRenderingQueue,
linkService: pdfLinkService,
l10n: this.l10n
l10n: this.l10n,
});
pdfRenderingQueue.setThumbnailViewer(this.pdfThumbnailViewer);
@ -389,7 +389,7 @@ var PDFViewerApplication = {
viewer,
pdfViewer: this.pdfViewer,
eventBus,
contextMenuItems: appConfig.fullscreen
contextMenuItems: appConfig.fullscreen,
});
}
@ -543,7 +543,7 @@ var PDFViewerApplication = {
},
onProgress(loaded, total) {
PDFViewerApplication.progress(loaded / total);
}
},
});
} else {
throw new Error('Not implemented: initPassiveLoading');
@ -779,25 +779,25 @@ var PDFViewerApplication = {
*/
error: function pdfViewError(message, moreInfo) {
let moreInfoText = [this.l10n.get('error_version_info',
{version: version || '?', build: build || '?'},
{ version: version || '?', build: build || '?', },
'PDF.js v{{version}} (build: {{build}})')];
if (moreInfo) {
moreInfoText.push(
this.l10n.get('error_message', {message: moreInfo.message},
this.l10n.get('error_message', { message: moreInfo.message, },
'Message: {{message}}'));
if (moreInfo.stack) {
moreInfoText.push(
this.l10n.get('error_stack', {stack: moreInfo.stack},
this.l10n.get('error_stack', { stack: moreInfo.stack, },
'Stack: {{stack}}'));
} else {
if (moreInfo.filename) {
moreInfoText.push(
this.l10n.get('error_file', {file: moreInfo.filename},
this.l10n.get('error_file', { file: moreInfo.filename, },
'File: {{file}}'));
}
if (moreInfo.lineNumber) {
moreInfoText.push(
this.l10n.get('error_line', {line: moreInfo.lineNumber},
this.l10n.get('error_line', { line: moreInfo.lineNumber, },
'Line: {{line}}'));
}
}
@ -1133,7 +1133,7 @@ var PDFViewerApplication = {
this.initialDestination = null;
} else if (this.initialBookmark) {
this.pdfLinkService.setHash(this.initialBookmark);
this.pdfHistory.push({ hash: this.initialBookmark }, true);
this.pdfHistory.push({ hash: this.initialBookmark, }, true);
this.initialBookmark = null;
} else if (storedHash) {
this.pdfLinkService.setHash(storedHash);
@ -1215,7 +1215,7 @@ var PDFViewerApplication = {
if (typeof PDFJSDev !== 'undefined' &&
PDFJSDev.test('FIREFOX || MOZCENTRAL')) {
this.externalServices.reportTelemetry({
type: 'print'
type: 'print',
});
}
},
@ -1608,7 +1608,7 @@ function webViewerPageRendered(e) {
if (typeof PDFJSDev !== 'undefined' &&
PDFJSDev.test('FIREFOX || MOZCENTRAL')) {
PDFViewerApplication.externalServices.reportTelemetry({
type: 'pageInfo'
type: 'pageInfo',
});
// It is a good time to report stream and font types.
PDFViewerApplication.pdfDocument.getStats().then(function (stats) {
@ -1851,7 +1851,7 @@ function webViewerFind(e) {
phraseSearch: e.phraseSearch,
caseSensitive: e.caseSensitive,
highlightAll: e.highlightAll,
findPrevious: e.findPrevious
findPrevious: e.findPrevious,
});
}
@ -1861,7 +1861,7 @@ function webViewerFindFromUrlHash(e) {
phraseSearch: e.phraseSearch,
caseSensitive: false,
highlightAll: true,
findPrevious: false
findPrevious: false,
});
}
@ -1989,7 +1989,7 @@ function webViewerKeyDown(evt) {
phraseSearch: findState.phraseSearch,
caseSensitive: findState.caseSensitive,
highlightAll: findState.highlightAll,
findPrevious: cmd === 5 || cmd === 12
findPrevious: cmd === 5 || cmd === 12,
});
}
handled = true;
@ -2241,8 +2241,8 @@ var PDFPrintServiceFactory = {
supportsPrinting: false,
createPrintService() {
throw new Error('Not implemented: createPrintService');
}
}
},
},
};
export {

View File

@ -208,7 +208,7 @@ function requestAccessToLocalFile(fileUrl, overlayManager) {
// checkbox causes the extension to reload, and Chrome will close all
// tabs upon reload.
ChromeCom.request('openExtensionsPageForFileAccess', {
newTab: e.ctrlKey || e.metaKey || e.button === 1 || window !== top
newTab: e.ctrlKey || e.metaKey || e.button === 1 || window !== top,
});
};
@ -254,14 +254,14 @@ function setReferer(url, callback) {
if (!port) {
// The background page will accept the port, and keep adding the Referer
// request header to requests to |url| until the port is disconnected.
port = chrome.runtime.connect({name: 'chromecom-referrer'});
port = chrome.runtime.connect({ name: 'chromecom-referrer', });
}
port.onDisconnect.addListener(onDisconnect);
port.onMessage.addListener(onMessage);
// Initiate the information exchange.
port.postMessage({
referer: window.history.state && window.history.state.chromecomState,
requestUrl: url
requestUrl: url,
});
function onMessage(referer) {

View File

@ -119,7 +119,7 @@ var FontInspector = (function FontInspectorClosure() {
download.href = url[1];
} else if (fontObj.data) {
url = URL.createObjectURL(new Blob([fontObj.data], {
type: fontObj.mimeType
type: fontObj.mimeType,
}));
download.href = url;
}
@ -154,7 +154,7 @@ var FontInspector = (function FontInspectorClosure() {
resetSelection();
}
}, 2000);
}
},
};
})();
@ -243,7 +243,7 @@ var StepperManager = (function StepperManagerClosure() {
saveBreakPoints: function saveBreakPoints(pageIndex, bps) {
breakPoints[pageIndex] = bps;
sessionStorage.setItem('pdfjsBreakPoints', JSON.stringify(breakPoints));
}
},
};
})();
@ -433,7 +433,7 @@ var Stepper = (function StepperClosure() {
row.style.backgroundColor = null;
}
}
}
},
};
return Stepper;
})();
@ -497,7 +497,7 @@ var Stats = (function Stats() {
cleanup() {
stats = [];
clear(this.panel);
}
},
};
})();
@ -615,6 +615,6 @@ window.PDFBug = (function PDFBugClosure() {
tools[j].panel.setAttribute('hidden', 'true');
}
}
}
},
};
})();

View File

@ -34,7 +34,7 @@ function attachDOMEventsToEventBus(eventBus) {
eventBus.on('textlayerrendered', function (e) {
var event = document.createEvent('CustomEvent');
event.initCustomEvent('textlayerrendered', true, true, {
pageNumber: e.pageNumber
pageNumber: e.pageNumber,
});
e.source.textLayerDiv.dispatchEvent(event);
});
@ -52,7 +52,7 @@ function attachDOMEventsToEventBus(eventBus) {
eventBus.on('pagesloaded', function (e) {
var event = document.createEvent('CustomEvent');
event.initCustomEvent('pagesloaded', true, true, {
pagesCount: e.pagesCount
pagesCount: e.pagesCount,
});
e.source.container.dispatchEvent(event);
});
@ -79,14 +79,14 @@ function attachDOMEventsToEventBus(eventBus) {
phraseSearch: e.phraseSearch,
caseSensitive: e.caseSensitive,
highlightAll: e.highlightAll,
findPrevious: e.findPrevious
findPrevious: e.findPrevious,
});
window.dispatchEvent(event);
});
eventBus.on('attachmentsloaded', function (e) {
var event = document.createEvent('CustomEvent');
event.initCustomEvent('attachmentsloaded', true, true, {
attachmentsCount: e.attachmentsCount
attachmentsCount: e.attachmentsCount,
});
e.source.container.dispatchEvent(event);
});
@ -107,7 +107,7 @@ function attachDOMEventsToEventBus(eventBus) {
eventBus.on('namedaction', function (e) {
var event = document.createEvent('CustomEvent');
event.initCustomEvent('namedaction', true, true, {
action: e.action
action: e.action,
});
e.source.pdfViewer.container.dispatchEvent(event);
});
@ -115,14 +115,14 @@ function attachDOMEventsToEventBus(eventBus) {
var event = document.createEvent('CustomEvent');
event.initCustomEvent('presentationmodechanged', true, true, {
active: e.active,
switchInProgress: e.switchInProgress
switchInProgress: e.switchInProgress,
});
window.dispatchEvent(event);
});
eventBus.on('outlineloaded', function (e) {
var event = document.createEvent('CustomEvent');
event.initCustomEvent('outlineloaded', true, true, {
outlineCount: e.outlineCount
outlineCount: e.outlineCount,
});
e.source.container.dispatchEvent(event);
});

View File

@ -69,7 +69,7 @@ DownloadManager.prototype = {
downloadData: function DownloadManager_downloadData(data, filename,
contentType) {
if (navigator.msSaveBlob) { // IE10 and above
return navigator.msSaveBlob(new Blob([data], { type: contentType }),
return navigator.msSaveBlob(new Blob([data], { type: contentType, }),
filename);
}
@ -95,7 +95,7 @@ DownloadManager.prototype = {
var blobUrl = URL.createObjectURL(blob);
download(blobUrl, filename);
}
},
};
export {

View File

@ -49,7 +49,7 @@ function composePage(pdfDocument, pageNumber, size, printContainer) {
canvasContext: ctx,
transform: [PRINT_UNITS, 0, 0, PRINT_UNITS, 0, 0],
viewport: pdfPage.getViewport(1, size.rotation),
intent: 'print'
intent: 'print',
};
return pdfPage.render(renderContext).promise;
}).then(function() {
@ -88,7 +88,7 @@ FirefoxPrintService.prototype = {
destroy() {
this.printContainer.textContent = '';
}
},
};
PDFPrintServiceFactory.instance = {
@ -101,7 +101,7 @@ PDFPrintServiceFactory.instance = {
createPrintService(pdfDocument, pagesOverview, printContainer) {
return new FirefoxPrintService(pdfDocument, pagesOverview, printContainer);
}
},
};
export {

View File

@ -75,10 +75,10 @@ var FirefoxCom = (function FirefoxComClosure() {
action,
data,
sync: false,
responseExpected: !!callback
responseExpected: !!callback,
});
return request.dispatchEvent(sender);
}
},
};
})();
@ -101,7 +101,7 @@ var DownloadManager = (function DownloadManagerClosure() {
blobUrl,
originalUrl: blobUrl,
filename,
isAttachment: true
isAttachment: true,
});
},
@ -119,7 +119,7 @@ var DownloadManager = (function DownloadManagerClosure() {
originalUrl: url,
filename,
}, onResponse);
}
},
};
return DownloadManager;
@ -179,7 +179,7 @@ class MozL10n {
phraseSearch: true,
caseSensitive: !!evt.detail.caseSensitive,
highlightAll: !!evt.detail.highlightAll,
findPrevious: !!evt.detail.findPrevious
findPrevious: !!evt.detail.findPrevious,
});
};
@ -305,7 +305,7 @@ document.mozL10n.setExternalLocalizerServices({
getStrings(key) {
return FirefoxCom.requestSync('getStrings', key);
}
},
});
export {

View File

@ -175,7 +175,7 @@ GrabToPan.prototype = {
this.document.removeEventListener('mouseup', this._endPan, true);
// Note: ChildNode.remove doesn't throw if the parentNode is undefined.
this.overlay.remove();
}
},
};
// Get the correct (vendor-prefixed) name of the matches method.

View File

@ -201,12 +201,12 @@ class PDFDocumentProperties {
} else if (kb < 1024) {
return this.l10n.get('document_properties_kb', {
size_kb: (+kb.toPrecision(3)).toLocaleString(),
size_b: fileSize.toLocaleString()
size_b: fileSize.toLocaleString(),
}, '{{size_kb}} KB ({{size_b}} bytes)');
}
return this.l10n.get('document_properties_mb', {
size_mb: (+(kb / 1024).toPrecision(3)).toLocaleString(),
size_b: fileSize.toLocaleString()
size_b: fileSize.toLocaleString(),
}, '{{size_mb}} MB ({{size_b}} bytes)');
}
@ -256,7 +256,7 @@ class PDFDocumentProperties {
var dateString = date.toLocaleDateString();
var timeString = date.toLocaleTimeString();
return this.l10n.get('document_properties_date_string',
{ date: dateString, time: timeString },
{ date: dateString, time: timeString, },
'{{date}}, {{time}}');
}
}

View File

@ -20,7 +20,7 @@ var FindStates = {
FIND_FOUND: 0,
FIND_NOTFOUND: 1,
FIND_WRAPPED: 2,
FIND_PENDING: 3
FIND_PENDING: 3,
};
var FIND_SCROLL_OFFSET_TOP = -50;
@ -70,11 +70,11 @@ var PDFFindController = (function PDFFindControllerClosure() {
this.matchCount = 0;
this.selected = { // Currently selected match.
pageIdx: -1,
matchIdx: -1
matchIdx: -1,
};
this.offset = { // Where the find algorithm currently is in the document.
pageIdx: null,
matchIdx: null
matchIdx: null,
};
this.pagesToSearch = null;
this.resumePageIdx = null;
@ -180,7 +180,7 @@ var PDFFindController = (function PDFFindControllerClosure() {
matchesWithLength.push({
match: matchIdx,
matchLength: subqueryLen,
skipped: false
skipped: false,
});
}
}
@ -406,7 +406,7 @@ var PDFFindController = (function PDFFindControllerClosure() {
this.selected.pageIdx === pageIndex) {
var spot = {
top: FIND_SCROLL_OFFSET_TOP,
left: FIND_SCROLL_OFFSET_LEFT
left: FIND_SCROLL_OFFSET_LEFT,
};
scrollIntoView(elements[beginIdx], spot,
/* skipOverflowHiddenElements = */ true);
@ -476,7 +476,7 @@ var PDFFindController = (function PDFFindControllerClosure() {
if (this.onUpdateState) {
this.onUpdateState(state, previous, this.matchCount);
}
}
},
};
return PDFFindController;
})();

View File

@ -68,7 +68,7 @@ PDFHistory.prototype = {
// is opened in the web viewer.
this.reInitialized = true;
}
this._pushOrReplaceState({fingerprint: this.fingerprint}, true);
this._pushOrReplaceState({ fingerprint: this.fingerprint, }, true);
}
var self = this;
@ -95,8 +95,8 @@ PDFHistory.prototype = {
// Replace the previous state if it was not explicitly set.
var previousParams = (self.previousHash && self.currentBookmark &&
self.previousHash !== self.currentBookmark) ?
{hash: self.currentBookmark, page: self.currentPage} :
{page: 1};
{ hash: self.currentBookmark, page: self.currentPage, } :
{ page: 1, };
replacePreviousHistoryState(previousParams, function() {
updateHistoryWithCurrentHash();
});
@ -108,7 +108,7 @@ PDFHistory.prototype = {
function updateHistoryWithCurrentHash() {
self.previousHash = window.location.hash.slice(1);
self._pushToHistory({hash: self.previousHash}, false, true);
self._pushToHistory({ hash: self.previousHash, }, false, true);
self._updatePreviousBookmark();
}
@ -329,7 +329,7 @@ PDFHistory.prototype = {
} else {
return null;
}
var params = {hash: this.currentBookmark, page: this.currentPage};
var params = { hash: this.currentBookmark, page: this.currentPage, };
if (this.isViewerInPresentationMode) {
params.hash = null;
}
@ -337,7 +337,7 @@ PDFHistory.prototype = {
},
_stateObj: function pdfHistory_stateObj(params) {
return {fingerprint: this.fingerprint, uid: this.uid, target: params};
return { fingerprint: this.fingerprint, uid: this.uid, target: params, };
},
_pushToHistory: function pdfHistory_pushToHistory(params,
@ -418,7 +418,7 @@ PDFHistory.prototype = {
window.history.forward();
}
}
}
},
};
export {

View File

@ -189,7 +189,7 @@ var PDFLinkService = (function PDFLinkServiceClosure() {
this.eventBus.dispatch('findfromurlhash', {
source: this,
query: params['search'].replace(/"/g, ''),
phraseSearch: (params['phrase'] === 'true')
phraseSearch: (params['phrase'] === 'true'),
});
}
// borrowing syntax from "Parameters for Opening PDF Files"
@ -212,23 +212,23 @@ var PDFLinkService = (function PDFLinkServiceClosure() {
if (zoomArg.indexOf('Fit') === -1) {
// If the zoomArg is a number, it has to get divided by 100. If it's
// a string, it should stay as it is.
dest = [null, { name: 'XYZ' },
dest = [null, { name: 'XYZ', },
zoomArgs.length > 1 ? (zoomArgs[1] | 0) : null,
zoomArgs.length > 2 ? (zoomArgs[2] | 0) : null,
(zoomArgNumber ? zoomArgNumber / 100 : zoomArg)];
} else {
if (zoomArg === 'Fit' || zoomArg === 'FitB') {
dest = [null, { name: zoomArg }];
dest = [null, { name: zoomArg, }];
} else if ((zoomArg === 'FitH' || zoomArg === 'FitBH') ||
(zoomArg === 'FitV' || zoomArg === 'FitBV')) {
dest = [null, { name: zoomArg },
dest = [null, { name: zoomArg, },
zoomArgs.length > 1 ? (zoomArgs[1] | 0) : null];
} else if (zoomArg === 'FitR') {
if (zoomArgs.length !== 5) {
console.error('PDFLinkService_setHash: ' +
'Not enough parameters for \'FitR\'.');
} else {
dest = [null, { name: zoomArg },
dest = [null, { name: zoomArg, },
(zoomArgs[1] | 0), (zoomArgs[2] | 0),
(zoomArgs[3] | 0), (zoomArgs[4] | 0)];
}
@ -250,7 +250,7 @@ var PDFLinkService = (function PDFLinkServiceClosure() {
if ('pagemode' in params) {
this.eventBus.dispatch('pagemode', {
source: this,
mode: params.pagemode
mode: params.pagemode,
});
}
} else { // Named (or explicit) destination.
@ -465,7 +465,7 @@ var SimpleLinkService = (function SimpleLinkServiceClosure() {
* @param {number} pageNum - page number.
* @param {Object} pageRef - reference to the page.
*/
cachePageRef(pageNum, pageRef) {}
cachePageRef(pageNum, pageRef) {},
};
return SimpleLinkService;
})();

View File

@ -171,7 +171,7 @@ class PDFOutlineViewer {
}
var fragment = document.createDocumentFragment();
var queue = [{ parent: fragment, items: this.outline }];
var queue = [{ parent: fragment, items: this.outline, }];
var hasAnyNesting = false;
while (queue.length > 0) {
var levelData = queue.shift();
@ -196,7 +196,7 @@ class PDFOutlineViewer {
var itemsDiv = document.createElement('div');
itemsDiv.className = 'outlineItems';
div.appendChild(itemsDiv);
queue.push({ parent: itemsDiv, items: item.items });
queue.push({ parent: itemsDiv, items: item.items, });
}
levelData.parent.appendChild(div);

View File

@ -46,7 +46,7 @@ function renderPage(activeServiceOnEntry, pdfDocument, pageNumber, size) {
canvasContext: ctx,
transform: [PRINT_UNITS, 0, 0, PRINT_UNITS, 0, 0],
viewport: pdfPage.getViewport(1, size.rotation),
intent: 'print'
intent: 'print',
};
return pdfPage.render(renderContext).promise;
}).then(function () {
@ -337,7 +337,7 @@ PDFPrintServiceFactory.instance = {
activeService = new PDFPrintService(pdfDocument, pagesOverview,
printContainer, l10n);
return activeService;
}
},
};
export {

View File

@ -22,7 +22,7 @@ const SidebarView = {
NONE: 0,
THUMBS: 1,
OUTLINE: 2,
ATTACHMENTS: 3
ATTACHMENTS: 3,
};
/**

View File

@ -123,7 +123,7 @@ var PDFThumbnailView = (function PDFThumbnailViewClosure() {
var anchor = document.createElement('a');
anchor.href = linkService.getAnchorUrl('#page=' + id);
this.l10n.get('thumb_page_title', {page: id}, 'Page {{page}}').
this.l10n.get('thumb_page_title', { page: id, }, 'Page {{page}}').
then((msg) => {
anchor.title = msg;
});
@ -205,7 +205,7 @@ var PDFThumbnailView = (function PDFThumbnailViewClosure() {
var totalRotation = (this.rotation + this.pdfPageRotate) % 360;
this.viewport = this.viewport.clone({
scale: 1,
rotation: totalRotation
rotation: totalRotation,
});
this.reset();
},
@ -233,7 +233,7 @@ var PDFThumbnailView = (function PDFThumbnailViewClosure() {
PDFJSDev.test('MOZCENTRAL || FIREFOX || GENERIC')) {
canvas.mozOpaque = true;
}
var ctx = canvas.getContext('2d', {alpha: false});
var ctx = canvas.getContext('2d', { alpha: false, });
var outputScale = getOutputScale(ctx);
canvas.width = (this.canvasWidth * outputScale.sx) | 0;
@ -263,7 +263,7 @@ var PDFThumbnailView = (function PDFThumbnailViewClosure() {
if (this.disableCanvasToImageConversion) {
this.canvas.id = id;
this.canvas.className = className;
this.l10n.get('thumb_page_canvas', { page: this.pageId },
this.l10n.get('thumb_page_canvas', { page: this.pageId, },
'Thumbnail of Page {{page}}').then((msg) => {
this.canvas.setAttribute('aria-label', msg);
});
@ -275,7 +275,7 @@ var PDFThumbnailView = (function PDFThumbnailViewClosure() {
var image = document.createElement('img');
image.id = id;
image.className = className;
this.l10n.get('thumb_page_canvas', { page: this.pageId },
this.l10n.get('thumb_page_canvas', { page: this.pageId, },
'Thumbnail of Page {{page}}').
then((msg) => {
image.setAttribute('aria-label', msg);
@ -348,7 +348,7 @@ var PDFThumbnailView = (function PDFThumbnailViewClosure() {
let renderContext = {
canvasContext: ctx,
viewport: drawViewport
viewport: drawViewport,
};
let renderTask = this.renderTask = this.pdfPage.render(renderContext);
renderTask.onContinue = renderContinueCallback;
@ -420,8 +420,8 @@ var PDFThumbnailView = (function PDFThumbnailViewClosure() {
setPageLabel: function PDFThumbnailView_setPageLabel(label) {
this.pageLabel = (typeof label === 'string' ? label : null);
this.l10n.get('thumb_page_title', { page: this.pageId }, 'Page {{page}}').
then((msg) => {
this.l10n.get('thumb_page_title', { page: this.pageId, },
'Page {{page}}').then((msg) => {
this.anchor.title = msg;
});
@ -429,7 +429,7 @@ var PDFThumbnailView = (function PDFThumbnailViewClosure() {
return;
}
this.l10n.get('thumb_page_canvas', { page: this.pageId },
this.l10n.get('thumb_page_canvas', { page: this.pageId, },
'Thumbnail of Page {{page}}').then((ariaLabel) => {
if (this.image) {
this.image.setAttribute('aria-label', ariaLabel);

View File

@ -88,7 +88,7 @@ var PDFThumbnailViewer = (function PDFThumbnailViewerClosure() {
// Account for only one thumbnail being visible.
var last = (numVisibleThumbs > 1 ? visibleThumbs.last.id : first);
if (page <= first || page >= last) {
scrollIntoView(thumbnail, { top: THUMBNAIL_SCROLL_MARGIN });
scrollIntoView(thumbnail, { top: THUMBNAIL_SCROLL_MARGIN, });
}
}
},
@ -220,7 +220,7 @@ var PDFThumbnailViewer = (function PDFThumbnailViewerClosure() {
return true;
}
return false;
}
},
};
return PDFThumbnailViewer;

View File

@ -400,7 +400,7 @@ var PDFViewer = (function pdfViewer() {
}
});
this.eventBus.dispatch('pagesinit', { source: this });
this.eventBus.dispatch('pagesinit', { source: this, });
if (this.defaultRenderingQueue) {
this.update();
@ -467,7 +467,7 @@ var PDFViewer = (function pdfViewer() {
var arg = {
source: this,
scale: newScale,
presetValue: preset ? newValue : undefined
presetValue: preset ? newValue : undefined,
};
this.eventBus.dispatch('scalechanging', arg);
this.eventBus.dispatch('scalechange', arg);
@ -494,7 +494,7 @@ var PDFViewer = (function pdfViewer() {
if (this._location && !PDFJS.ignoreCurrentPositionOnZoom &&
!(this.isInPresentationMode || this.isChangingPresentationMode)) {
page = this._location.pageNumber;
dest = [null, { name: 'XYZ' }, this._location.left,
dest = [null, { name: 'XYZ', }, this._location.left,
this._location.top, null];
}
this.scrollPageIntoView({
@ -776,7 +776,7 @@ var PDFViewer = (function pdfViewer() {
this.eventBus.dispatch('updateviewarea', {
source: this,
location: this._location
location: this._location,
});
},
@ -809,8 +809,8 @@ var PDFViewer = (function pdfViewer() {
// configurations when presentation mode is active.
var visible = [];
var currentPage = this._pages[this._currentPageNumber - 1];
visible.push({ id: currentPage.id, view: currentPage });
return { first: currentPage, last: currentPage, views: visible };
visible.push({ id: currentPage.id, view: currentPage, });
return { first: currentPage, last: currentPage, views: visible, };
},
cleanup() {

View File

@ -57,7 +57,7 @@ class BasePreferences {
value: Object.freeze(defaults),
writable: false,
enumerable: true,
configurable: false
configurable: false,
});
this.prefs = cloneObj(defaults);

View File

@ -60,23 +60,24 @@ class SecondaryToolbar {
this.toolbarButtonContainer = options.toolbarButtonContainer;
this.buttons = [
{ element: options.presentationModeButton, eventName: 'presentationmode',
close: true },
{ element: options.openFileButton, eventName: 'openfile', close: true },
{ element: options.printButton, eventName: 'print', close: true },
{ element: options.downloadButton, eventName: 'download', close: true },
{ element: options.viewBookmarkButton, eventName: null, close: true },
{ element: options.firstPageButton, eventName: 'firstpage', close: true },
{ element: options.lastPageButton, eventName: 'lastpage', close: true },
close: true, },
{ element: options.openFileButton, eventName: 'openfile', close: true, },
{ element: options.printButton, eventName: 'print', close: true, },
{ element: options.downloadButton, eventName: 'download', close: true, },
{ element: options.viewBookmarkButton, eventName: null, close: true, },
{ element: options.firstPageButton, eventName: 'firstpage',
close: true, },
{ element: options.lastPageButton, eventName: 'lastpage', close: true, },
{ element: options.pageRotateCwButton, eventName: 'rotatecw',
close: false },
close: false, },
{ element: options.pageRotateCcwButton, eventName: 'rotateccw',
close: false },
close: false, },
{ element: options.cursorSelectToolButton, eventName: 'switchcursortool',
eventDetails: { tool: CursorTool.SELECT, }, close: true },
eventDetails: { tool: CursorTool.SELECT, }, close: true, },
{ element: options.cursorHandToolButton, eventName: 'switchcursortool',
eventDetails: { tool: CursorTool.HAND, }, close: true },
eventDetails: { tool: CursorTool.HAND, }, close: true, },
{ element: options.documentPropertiesButton,
eventName: 'documentproperties', close: true }
eventName: 'documentproperties', close: true, },
];
this.items = {
firstPage: options.firstPageButton,

View File

@ -147,8 +147,8 @@ var TextLayerBuilder = (function TextLayerBuilderClosure() {
var match = {
begin: {
divIdx: i,
offset: matchIdx - iIndex
}
offset: matchIdx - iIndex,
},
};
// Calculate the end position.
@ -167,7 +167,7 @@ var TextLayerBuilder = (function TextLayerBuilderClosure() {
match.end = {
divIdx: i,
offset: matchIdx - iIndex
offset: matchIdx - iIndex,
};
ret.push(match);
}
@ -193,7 +193,7 @@ var TextLayerBuilder = (function TextLayerBuilderClosure() {
false : this.findController.state.highlightAll);
var infinity = {
divIdx: -1,
offset: undefined
offset: undefined,
};
function beginText(begin, className) {
@ -405,7 +405,7 @@ DefaultTextLayerFactory.prototype = {
viewport,
enhanceTextSelection,
});
}
},
};
export {

View File

@ -128,7 +128,7 @@ var Toolbar = (function ToolbarClosure() {
items.pageNumber.addEventListener('change', function() {
eventBus.dispatch('pagenumberchanged', {
source: self,
value: this.value
value: this.value,
});
});
@ -138,7 +138,7 @@ var Toolbar = (function ToolbarClosure() {
}
eventBus.dispatch('scalechanged', {
source: self,
value: this.value
value: this.value,
});
});
@ -193,7 +193,7 @@ var Toolbar = (function ToolbarClosure() {
}
if (!predefinedValueFound) {
var customScale = Math.round(scale * 10000) / 100;
this.l10n.get('page_scale_percent', {scale: customScale},
this.l10n.get('page_scale_percent', { scale: customScale, },
'{{scale}}%').
then((msg) => {
items.customScaleOption.textContent = msg;

View File

@ -51,7 +51,7 @@ var NullL10n = {
translate(element) {
return Promise.resolve();
}
},
};
/**
@ -125,7 +125,7 @@ function getOutputScale(ctx) {
return {
sx: pixelRatio,
sy: pixelRatio,
scaled: pixelRatio !== 1
scaled: pixelRatio !== 1,
};
}
@ -200,7 +200,7 @@ function watchScroll(viewAreaElement, callback) {
var state = {
down: true,
lastY: viewAreaElement.scrollTop,
_eventHandler: debounceScroll
_eventHandler: debounceScroll,
};
var rAF = null;
@ -350,7 +350,7 @@ function getVisibleElements(scrollEl, views, sortByVisibility) {
x: currentWidth,
y: currentHeight,
view,
percent: percentHeight
percent: percentHeight,
});
}
@ -508,7 +508,7 @@ var EventBus = (function EventBusClosure() {
eventListeners.slice(0).forEach(function (listener) {
listener.apply(null, args);
});
}
},
};
return EventBus;
})();
@ -589,7 +589,7 @@ var ProgressBar = (function ProgressBarClosure() {
this.visible = true;
document.body.classList.add('loadingInProgress');
this.bar.classList.remove('hidden');
}
},
};
return ProgressBar;

View File

@ -46,7 +46,7 @@ class ViewHistory {
}
}
if (typeof index !== 'number') {
index = database.files.push({fingerprint: this.fingerprint}) - 1;
index = database.files.push({ fingerprint: this.fingerprint, }) - 1;
}
this.file = database.files[index];
this.database = database;

View File

@ -127,7 +127,7 @@ function getViewerConfiguration() {
findResultsCount: document.getElementById('findResultsCount'),
findStatusIcon: document.getElementById('findStatusIcon'),
findPreviousButton: document.getElementById('findPrevious'),
findNextButton: document.getElementById('findNext')
findNextButton: document.getElementById('findNext'),
},
passwordOverlay: {
overlayName: 'passwordOverlay',
@ -135,7 +135,7 @@ function getViewerConfiguration() {
label: document.getElementById('passwordText'),
input: document.getElementById('password'),
submitButton: document.getElementById('passwordSubmit'),
cancelButton: document.getElementById('passwordCancel')
cancelButton: document.getElementById('passwordCancel'),
},
documentProperties: {
overlayName: 'documentPropertiesOverlay',
@ -153,8 +153,8 @@ function getViewerConfiguration() {
'creator': document.getElementById('creatorField'),
'producer': document.getElementById('producerField'),
'version': document.getElementById('versionField'),
'pageCount': document.getElementById('pageCountField')
}
'pageCount': document.getElementById('pageCountField'),
},
},
errorWrapper: {
container: document.getElementById('errorWrapper'),
@ -167,7 +167,7 @@ function getViewerConfiguration() {
printContainer: document.getElementById('printContainer'),
openFileInputName: 'fileInput',
debuggerScriptPath: './debugger.js',
defaultUrl: DEFAULT_URL
defaultUrl: DEFAULT_URL,
};
}