From 814aa7581d74c364e1067d5981d3befbe7c43ebe Mon Sep 17 00:00:00 2001 From: Tony Jin Date: Mon, 17 Jul 2017 17:36:13 -0700 Subject: [PATCH] Chore: Full pass of prettier formatting (#223) Prettier version bump changed some rules --- src/lib/Fullscreen.js | 6 ++-- src/lib/Preview.js | 8 ++--- src/lib/annotations/Annotation.js | 3 +- src/lib/annotations/AnnotationService.js | 9 +++-- src/lib/annotations/AnnotationThread.js | 3 +- src/lib/annotations/Annotator.js | 3 +- src/lib/annotations/doc/DocAnnotator.js | 3 +- src/lib/annotations/doc/DocHighlightThread.js | 3 +- src/lib/annotations/doc/DocPointDialog.js | 3 +- src/lib/annotations/doc/DocPointThread.js | 8 +++-- src/lib/annotations/image/ImageAnnotator.js | 3 +- src/lib/annotations/image/ImagePointDialog.js | 15 +++++--- src/lib/annotations/image/ImagePointThread.js | 3 +- src/lib/viewers/BaseViewer.js | 3 +- src/lib/viewers/box3d/Box3DControls.js | 3 +- src/lib/viewers/box3d/Box3DRenderer.js | 10 +++--- src/lib/viewers/box3d/Box3DViewer.js | 3 +- .../viewers/box3d/model3d/Model3DControls.js | 3 +- .../viewers/box3d/model3d/Model3DRenderer.js | 2 +- .../viewers/box3d/model3d/Model3DViewer.js | 3 +- .../box3d/model3d/Model3DVrControls.js | 3 +- .../viewers/box3d/video360/Video360Viewer.js | 24 ++++++++----- src/lib/viewers/doc/DocBaseViewer.js | 10 +++--- src/lib/viewers/doc/DocFindBar.js | 3 +- src/lib/viewers/doc/DocumentViewer.js | 3 +- src/lib/viewers/doc/PresentationViewer.js | 3 +- src/lib/viewers/error/PreviewErrorViewer.js | 3 +- src/lib/viewers/image/ImageBaseViewer.js | 3 +- src/lib/viewers/image/ImageViewer.js | 36 +++++++++---------- src/lib/viewers/image/MultiImageViewer.js | 3 +- src/lib/viewers/media/DashViewer.js | 6 ++-- src/lib/viewers/media/MP3Viewer.js | 3 +- src/lib/viewers/media/MP4Viewer.js | 3 +- src/lib/viewers/media/MediaBaseViewer.js | 3 +- src/lib/viewers/media/MediaControls.js | 3 +- src/lib/viewers/media/Scrubber.js | 3 +- src/lib/viewers/media/Settings.js | 3 +- src/lib/viewers/media/VideoBaseViewer.js | 3 +- src/lib/viewers/office/OfficeViewer.js | 3 +- src/lib/viewers/text/BoxCSV.js | 3 +- src/lib/viewers/text/CSVViewer.js | 3 +- src/lib/viewers/text/MarkdownViewer.js | 3 +- 42 files changed, 141 insertions(+), 86 deletions(-) diff --git a/src/lib/Fullscreen.js b/src/lib/Fullscreen.js index 2c12408d9..b98b89ff6 100644 --- a/src/lib/Fullscreen.js +++ b/src/lib/Fullscreen.js @@ -41,10 +41,12 @@ class Fullscreen extends EventEmitter { isFullscreen(element) { let fullscreen; if (this.isSupported()) { - fullscreen = !!(document.fullscreenElement || + fullscreen = !!( + document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || - document.msFullscreenElement); + document.msFullscreenElement + ); } else { fullscreen = element instanceof HTMLElement && element.classList.contains(CLASS_FULLSCREEN); } diff --git a/src/lib/Preview.js b/src/lib/Preview.js index 9d6bb0b38..cd0d5afc7 100644 --- a/src/lib/Preview.js +++ b/src/lib/Preview.js @@ -46,7 +46,8 @@ const LOG_RETRY_COUNT = 3; // number of times to retry logging preview event // and not when preview is instantiated, which is too late. const PREVIEW_LOCATION = findScriptLocation(PREVIEW_SCRIPT_NAME, document.currentScript); -@autobind class Preview extends EventEmitter { +@autobind +class Preview extends EventEmitter { /** @property {boolean} - Whether preview is open */ open = false; @@ -1023,9 +1024,8 @@ const PREVIEW_LOCATION = findScriptLocation(PREVIEW_SCRIPT_NAME, document.curren * @return {Object} Headers */ getRequestHeaders(token) { - const videoHint = Browser.canPlayDash() && !this.disabledViewers.Dash - ? X_REP_HINT_VIDEO_DASH - : X_REP_HINT_VIDEO_MP4; + const videoHint = + Browser.canPlayDash() && !this.disabledViewers.Dash ? X_REP_HINT_VIDEO_DASH : X_REP_HINT_VIDEO_MP4; const headers = { 'X-Rep-Hints': `${X_REP_HINT_BASE}${X_REP_HINT_DOC_THUMBNAIL}${X_REP_HINT_IMAGE}${videoHint}` }; diff --git a/src/lib/annotations/Annotation.js b/src/lib/annotations/Annotation.js index f3f80d8cc..1c64a22ee 100644 --- a/src/lib/annotations/Annotation.js +++ b/src/lib/annotations/Annotation.js @@ -1,6 +1,7 @@ import autobind from 'autobind-decorator'; -@autobind class Annotation { +@autobind +class Annotation { //-------------------------------------------------------------------------- // Typedef //-------------------------------------------------------------------------- diff --git a/src/lib/annotations/AnnotationService.js b/src/lib/annotations/AnnotationService.js index 91f557fb0..75f83b08b 100644 --- a/src/lib/annotations/AnnotationService.js +++ b/src/lib/annotations/AnnotationService.js @@ -9,7 +9,8 @@ const ANONYMOUS_USER = { name: __('annotation_anonymous_user_name') }; -@autobind class AnnotationService extends EventEmitter { +@autobind +class AnnotationService extends EventEmitter { //-------------------------------------------------------------------------- // Static //-------------------------------------------------------------------------- @@ -23,7 +24,8 @@ const ANONYMOUS_USER = { static generateID() { /* eslint-disable */ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => { - var r = (Math.random() * 16) | 0, v = c == 'x' ? r : (r & 0x3) | 0x8; + var r = (Math.random() * 16) | 0, + v = c == 'x' ? r : (r & 0x3) | 0x8; return v.toString(16); }); /* eslint-enable */ @@ -248,7 +250,8 @@ const ANONYMOUS_USER = { * @return {Promise} Promise that resolves with fetched annotations */ getReadUrl(fileVersionId, marker = null, limit = null) { - let apiUrl = `${this.api}/2.0/files/${this.fileId}/annotations?version=${fileVersionId}&fields=item,thread,details,message,created_by,created_at,modified_at,permissions`; + let apiUrl = `${this.api}/2.0/files/${this + .fileId}/annotations?version=${fileVersionId}&fields=item,thread,details,message,created_by,created_at,modified_at,permissions`; if (marker) { apiUrl += `&marker=${marker}`; } diff --git a/src/lib/annotations/AnnotationThread.js b/src/lib/annotations/AnnotationThread.js index 15d6a1eaa..4ce7e61a4 100644 --- a/src/lib/annotations/AnnotationThread.js +++ b/src/lib/annotations/AnnotationThread.js @@ -6,7 +6,8 @@ import * as annotatorUtil from './annotatorUtil'; import { ICON_PLACED_ANNOTATION } from '../icons/icons'; import { STATES, TYPES, CLASS_ANNOTATION_POINT_BUTTON, DATA_TYPE_ANNOTATION_INDICATOR } from './annotationConstants'; -@autobind class AnnotationThread extends EventEmitter { +@autobind +class AnnotationThread extends EventEmitter { //-------------------------------------------------------------------------- // Typedef //-------------------------------------------------------------------------- diff --git a/src/lib/annotations/Annotator.js b/src/lib/annotations/Annotator.js index f6200e674..817363235 100644 --- a/src/lib/annotations/Annotator.js +++ b/src/lib/annotations/Annotator.js @@ -17,7 +17,8 @@ import { const CLASS_ANNOTATION_POINT_MODE = 'bp-point-annotation-mode'; -@autobind class Annotator extends EventEmitter { +@autobind +class Annotator extends EventEmitter { //-------------------------------------------------------------------------- // Typedef //-------------------------------------------------------------------------- diff --git a/src/lib/annotations/doc/DocAnnotator.js b/src/lib/annotations/doc/DocAnnotator.js index 8919d8eda..b03b8a507 100644 --- a/src/lib/annotations/doc/DocAnnotator.js +++ b/src/lib/annotations/doc/DocAnnotator.js @@ -55,7 +55,8 @@ function isThreadInHoverState(thread) { return thread.state === STATES.hover; } -@autobind class DocAnnotator extends Annotator { +@autobind +class DocAnnotator extends Annotator { /** * For tracking the most recent event fired by mouse move event. * diff --git a/src/lib/annotations/doc/DocHighlightThread.js b/src/lib/annotations/doc/DocHighlightThread.js index 1f3804fa4..020e97bc2 100644 --- a/src/lib/annotations/doc/DocHighlightThread.js +++ b/src/lib/annotations/doc/DocHighlightThread.js @@ -15,7 +15,8 @@ const PAGE_PADDING_BOTTOM = 15; const PAGE_PADDING_TOP = 15; const HOVER_TIMEOUT_MS = 75; -@autobind class DocHighlightThread extends AnnotationThread { +@autobind +class DocHighlightThread extends AnnotationThread { /** * Cached page element for the document. * diff --git a/src/lib/annotations/doc/DocPointDialog.js b/src/lib/annotations/doc/DocPointDialog.js index 22c4e806b..2edc19e3d 100644 --- a/src/lib/annotations/doc/DocPointDialog.js +++ b/src/lib/annotations/doc/DocPointDialog.js @@ -6,7 +6,8 @@ import * as docAnnotatorUtil from './docAnnotatorUtil'; const PAGE_PADDING_TOP = 15; const POINT_ANNOTATION_ICON_DOT_HEIGHT = 8; -@autobind class DocPointDialog extends AnnotationDialog { +@autobind +class DocPointDialog extends AnnotationDialog { //-------------------------------------------------------------------------- // Abstract Implementations //-------------------------------------------------------------------------- diff --git a/src/lib/annotations/doc/DocPointThread.js b/src/lib/annotations/doc/DocPointThread.js index b759fa903..d64d72a81 100644 --- a/src/lib/annotations/doc/DocPointThread.js +++ b/src/lib/annotations/doc/DocPointThread.js @@ -10,7 +10,8 @@ const POINT_ANNOTATION_ICON_HEIGHT = 31; const POINT_ANNOTATION_ICON_DOT_HEIGHT = 8; const POINT_ANNOTATION_ICON_WIDTH = 24; -@autobind class DocPointThread extends AnnotationThread { +@autobind +class DocPointThread extends AnnotationThread { //-------------------------------------------------------------------------- // Public //-------------------------------------------------------------------------- @@ -51,7 +52,10 @@ const POINT_ANNOTATION_ICON_WIDTH = 24; // Position and append to page this.element.style.left = `${browserX - POINT_ANNOTATION_ICON_WIDTH / 2}px`; // Add 15px for vertical padding on page - this.element.style.top = `${browserY - POINT_ANNOTATION_ICON_HEIGHT + POINT_ANNOTATION_ICON_DOT_HEIGHT / 2 + PAGE_PADDING_TOP}px`; + this.element.style.top = `${browserY - + POINT_ANNOTATION_ICON_HEIGHT + + POINT_ANNOTATION_ICON_DOT_HEIGHT / 2 + + PAGE_PADDING_TOP}px`; pageEl.appendChild(this.element); annotatorUtil.showElement(this.element); diff --git a/src/lib/annotations/image/ImageAnnotator.js b/src/lib/annotations/image/ImageAnnotator.js index f85fdfe1b..f30260523 100644 --- a/src/lib/annotations/image/ImageAnnotator.js +++ b/src/lib/annotations/image/ImageAnnotator.js @@ -9,7 +9,8 @@ const IMAGE_NODE_NAME = 'img'; // Selector for image container OR multi-image container const ANNOTATED_ELEMENT_SELECTOR = '.bp-image, .bp-images-wrapper'; -@autobind class ImageAnnotator extends Annotator { +@autobind +class ImageAnnotator extends Annotator { //-------------------------------------------------------------------------- // Abstract Implementations //-------------------------------------------------------------------------- diff --git a/src/lib/annotations/image/ImagePointDialog.js b/src/lib/annotations/image/ImagePointDialog.js index 8df482668..282fdb8c0 100644 --- a/src/lib/annotations/image/ImagePointDialog.js +++ b/src/lib/annotations/image/ImagePointDialog.js @@ -8,7 +8,8 @@ const PAGE_PADDING_TOP = 15; const POINT_ANNOTATION_ICON_HEIGHT = 31; const POINT_ANNOTATION_ICON_DOT_HEIGHT = 8; -@autobind class ImagePointDialog extends AnnotationDialog { +@autobind +class ImagePointDialog extends AnnotationDialog { //-------------------------------------------------------------------------- // Abstract Implementations //-------------------------------------------------------------------------- @@ -45,14 +46,18 @@ const POINT_ANNOTATION_ICON_DOT_HEIGHT = 8; // Only reposition if one side is past page boundary - if both are, // just center the dialog and cause scrolling since there is nothing // else we can do - const pageWidth = imageEl.clientWidth > this.annotatedElement.clientWidth - ? imageEl.clientWidth - : this.annotatedElement.clientWidth; + const pageWidth = + imageEl.clientWidth > this.annotatedElement.clientWidth + ? imageEl.clientWidth + : this.annotatedElement.clientWidth; dialogLeftX = annotatorUtil.repositionCaret(this.element, dialogLeftX, dialogWidth, browserX, pageWidth); // Position the dialog this.element.style.left = `${dialogLeftX}px`; - this.element.style.top = `${dialogTopY + PAGE_PADDING_TOP - POINT_ANNOTATION_ICON_HEIGHT + POINT_ANNOTATION_ICON_DOT_HEIGHT}px`; + this.element.style.top = `${dialogTopY + + PAGE_PADDING_TOP - + POINT_ANNOTATION_ICON_HEIGHT + + POINT_ANNOTATION_ICON_DOT_HEIGHT}px`; } } diff --git a/src/lib/annotations/image/ImagePointThread.js b/src/lib/annotations/image/ImagePointThread.js index c2f70bc03..5f455f4ed 100644 --- a/src/lib/annotations/image/ImagePointThread.js +++ b/src/lib/annotations/image/ImagePointThread.js @@ -9,7 +9,8 @@ const POINT_ANNOTATION_ICON_HEIGHT = 31; const POINT_ANNOTATION_ICON_DOT_HEIGHT = 8; const POINT_ANNOTATION_ICON_WIDTH = 24; -@autobind class ImagePointThread extends AnnotationThread { +@autobind +class ImagePointThread extends AnnotationThread { //-------------------------------------------------------------------------- // Abstract Implementations //-------------------------------------------------------------------------- diff --git a/src/lib/viewers/BaseViewer.js b/src/lib/viewers/BaseViewer.js index b452a5f83..292403bdb 100644 --- a/src/lib/viewers/BaseViewer.js +++ b/src/lib/viewers/BaseViewer.js @@ -33,7 +33,8 @@ const ANNOTATIONS_CSS = ['annotations.css']; const LOAD_TIMEOUT_MS = 180000; // 3m const RESIZE_WAIT_TIME_IN_MILLIS = 300; -@autobind class BaseViewer extends EventEmitter { +@autobind +class BaseViewer extends EventEmitter { /** @property {Controls} - UI used to interact with the document in the viewer */ controls; diff --git a/src/lib/viewers/box3d/Box3DControls.js b/src/lib/viewers/box3d/Box3DControls.js index 1f3f0aa43..341d2b883 100644 --- a/src/lib/viewers/box3d/Box3DControls.js +++ b/src/lib/viewers/box3d/Box3DControls.js @@ -8,7 +8,8 @@ import './Box3DControls.scss'; import { CLASS_HIDDEN } from '../../constants'; import { UIRegistry } from './Box3DUIUtils'; -@autobind class Box3DControls extends EventEmitter { +@autobind +class Box3DControls extends EventEmitter { /** @property {HTMLElement} - Reference to the parent container to nest UI in */ el; diff --git a/src/lib/viewers/box3d/Box3DRenderer.js b/src/lib/viewers/box3d/Box3DRenderer.js index 4202185fe..2963c43d7 100644 --- a/src/lib/viewers/box3d/Box3DRenderer.js +++ b/src/lib/viewers/box3d/Box3DRenderer.js @@ -509,7 +509,8 @@ class Box3DRenderer extends EventEmitter { if (!this.vrCommonLoadPromise) { if (commonEntities) { this.vrCommonLoadPromise = this.box3d.addRemoteEntities( - `${this.staticBaseURI}third-party/model3d/${MODEL3D_STATIC_ASSETS_VERSION}/WebVR/${commonEntities}/entities.json`, + `${this + .staticBaseURI}third-party/model3d/${MODEL3D_STATIC_ASSETS_VERSION}/WebVR/${commonEntities}/entities.json`, { isExternal: true } ); } else { @@ -518,10 +519,9 @@ class Box3DRenderer extends EventEmitter { } if (!this.vrGamepadLoadPromises[controllerName]) { this.vrCommonLoadPromise.then(() => { - this.vrGamepadLoadPromises[ - controllerName - ] = this.box3d.addRemoteEntities( - `${this.staticBaseURI}third-party/model3d/${MODEL3D_STATIC_ASSETS_VERSION}/WebVR/${controllerName}/entities.json`, + this.vrGamepadLoadPromises[controllerName] = this.box3d.addRemoteEntities( + `${this + .staticBaseURI}third-party/model3d/${MODEL3D_STATIC_ASSETS_VERSION}/WebVR/${controllerName}/entities.json`, { isExternal: true } ); this.vrGamepadLoadPromises[controllerName].then(onGamepadModelLoad); diff --git a/src/lib/viewers/box3d/Box3DViewer.js b/src/lib/viewers/box3d/Box3DViewer.js index 46289fc73..37d9f043e 100644 --- a/src/lib/viewers/box3d/Box3DViewer.js +++ b/src/lib/viewers/box3d/Box3DViewer.js @@ -32,7 +32,8 @@ const CLASS_VR_ENABLED = 'vr-enabled'; * This is the entry point for Box3D Preview Base * @class */ -@autobind class Box3DViewer extends BaseViewer { +@autobind +class Box3DViewer extends BaseViewer { /** @property {Box3DRenderer} - Box3DRenderer instance. Renders the 3D scene */ renderer; diff --git a/src/lib/viewers/box3d/model3d/Model3DControls.js b/src/lib/viewers/box3d/model3d/Model3DControls.js index 374450b78..666909c88 100644 --- a/src/lib/viewers/box3d/model3d/Model3DControls.js +++ b/src/lib/viewers/box3d/model3d/Model3DControls.js @@ -27,7 +27,8 @@ import { ICON_3D_RESET, ICON_ANIMATION, ICON_GEAR, ICON_PAUSE, ICON_PLAY } from * Render Mode selection, VR and fullscreen buttons. * @class */ -@autobind class Model3DControls extends Box3DControls { +@autobind +class Model3DControls extends Box3DControls { /** @property {Model3DAnimationClipsPullup} - UI Component for listing and interacting with animation clips */ animationClipsPullup; diff --git a/src/lib/viewers/box3d/model3d/Model3DRenderer.js b/src/lib/viewers/box3d/model3d/Model3DRenderer.js index 2fe3a7044..bc297449b 100644 --- a/src/lib/viewers/box3d/model3d/Model3DRenderer.js +++ b/src/lib/viewers/box3d/model3d/Model3DRenderer.js @@ -38,7 +38,7 @@ const PREVIEW_CAMERA_QUATERNION = { x: -0.101, y: -0.325, z: -0.035, - w: 0.940 + w: 0.94 }; const OPTIMIZE_FRAMETIME_THRESHOLD_REGULAR = 30; // 20 FPS diff --git a/src/lib/viewers/box3d/model3d/Model3DViewer.js b/src/lib/viewers/box3d/model3d/Model3DViewer.js index 7df823fa4..aa5f89db3 100644 --- a/src/lib/viewers/box3d/model3d/Model3DViewer.js +++ b/src/lib/viewers/box3d/model3d/Model3DViewer.js @@ -30,7 +30,8 @@ const LOAD_TIMEOUT = 180000; // 3 minutes * This is the entry point for the model3d preview. * @class */ -@autobind class Model3DViewer extends Box3DViewer { +@autobind +class Model3DViewer extends Box3DViewer { /** @property {Object[]} - List of Box3D instances added to the scene */ instances = []; diff --git a/src/lib/viewers/box3d/model3d/Model3DVrControls.js b/src/lib/viewers/box3d/model3d/Model3DVrControls.js index bdf61f1e5..7f49e3c9a 100644 --- a/src/lib/viewers/box3d/model3d/Model3DVrControls.js +++ b/src/lib/viewers/box3d/model3d/Model3DVrControls.js @@ -125,7 +125,8 @@ class Model3DVrControls { * * @return {void} */ - @autobind onScaleUpdate() { + @autobind + onScaleUpdate() { this.vrGamepads[0].getPosition(this.vrWorkVector1); this.vrGamepads[1].getPosition(this.vrWorkVector2); const currentScaleDistance = this.vrWorkVector1.sub(this.vrWorkVector2).length(); diff --git a/src/lib/viewers/box3d/video360/Video360Viewer.js b/src/lib/viewers/box3d/video360/Video360Viewer.js index 60b180b03..95d569540 100644 --- a/src/lib/viewers/box3d/video360/Video360Viewer.js +++ b/src/lib/viewers/box3d/video360/Video360Viewer.js @@ -102,7 +102,8 @@ class Video360Viewer extends DashViewer { * * @inheritdoc */ - @autobind loadeddataHandler() { + @autobind + loadeddataHandler() { const { token, apiHost } = this.options; this.renderer = new Video360Renderer(this.mediaContainerEl, new BoxSDK({ token, apiBase: apiHost })); this.renderer.on(EVENT_SHOW_VR_BUTTON, this.handleShowVrButton); @@ -141,7 +142,8 @@ class Video360Viewer extends DashViewer { /** * @inheritdoc */ - @autobind resize() { + @autobind + resize() { super.resize(); if (this.renderer) { this.renderer.resize(); @@ -155,7 +157,8 @@ class Video360Viewer extends DashViewer { * @private * @return {void} */ - @autobind create360Environment() { + @autobind + create360Environment() { this.skybox = this.renderer.getScene().getComponentByScriptId('skybox_renderer'); this.videoAsset = this.renderer.getBox3D().createVideo( @@ -185,7 +188,8 @@ class Video360Viewer extends DashViewer { /** * @inheritdoc */ - @autobind toggleFullscreen() { + @autobind + toggleFullscreen() { fullscreen.toggle(this.wrapperEl); } @@ -194,7 +198,8 @@ class Video360Viewer extends DashViewer { * * @return {void} */ - @autobind handleToggleVr() { + @autobind + handleToggleVr() { this.renderer.toggleVr(); if (!this.renderer.vrEnabled) { @@ -214,7 +219,8 @@ class Video360Viewer extends DashViewer { * * @return {void} */ - @autobind handleShowVrButton() { + @autobind + handleShowVrButton() { this.controls.showVrButton(); } @@ -223,7 +229,8 @@ class Video360Viewer extends DashViewer { * * @return {void} */ - @autobind onCanvasMouseDown() { + @autobind + onCanvasMouseDown() { this.renderer.getBox3D().once('mouseUp', this.onCanvasMouseUp); } @@ -232,7 +239,8 @@ class Video360Viewer extends DashViewer { * * @return {void} */ - @autobind onCanvasMouseUp() { + @autobind + onCanvasMouseUp() { const input = this.renderer.getInputController(); // Make sure the mouse hasn't moved (within mouse/touch buffer drag allowance) if (!input.getPreviousMouseDragState() && !input.getPreviousTouchDragState()) { diff --git a/src/lib/viewers/doc/DocBaseViewer.js b/src/lib/viewers/doc/DocBaseViewer.js index 360257264..a6a7380ce 100644 --- a/src/lib/viewers/doc/DocBaseViewer.js +++ b/src/lib/viewers/doc/DocBaseViewer.js @@ -39,7 +39,8 @@ const MINIMUM_RANGE_REQUEST_FILE_SIZE_NON_US = 5242880; // 5MB const DISABLE_RANGE_REQUEST_EXENSIONS = ['xls', 'xlsm', 'xlsx']; const MOBILE_MAX_CANVAS_SIZE = 2949120; // ~3MP 1920x1536 -@autobind class DocBaseViewer extends BaseViewer { +@autobind +class DocBaseViewer extends BaseViewer { //-------------------------------------------------------------------------- // Public //-------------------------------------------------------------------------- @@ -512,9 +513,10 @@ const MOBILE_MAX_CANVAS_SIZE = 2949120; // ~3MP 1920x1536 // smaller chunk size if not. This is using a rough assumption that // en-US users have higher bandwidth to Box. if (!rangeChunkSize) { - rangeChunkSize = this.options.location.locale === 'en-US' - ? RANGE_REQUEST_CHUNK_SIZE_US - : RANGE_REQUEST_CHUNK_SIZE_NON_US; + rangeChunkSize = + this.options.location.locale === 'en-US' + ? RANGE_REQUEST_CHUNK_SIZE_US + : RANGE_REQUEST_CHUNK_SIZE_NON_US; } const docInitParams = { diff --git a/src/lib/viewers/doc/DocFindBar.js b/src/lib/viewers/doc/DocFindBar.js index 00cdf6eb8..4f05eb23e 100644 --- a/src/lib/viewers/doc/DocFindBar.js +++ b/src/lib/viewers/doc/DocFindBar.js @@ -13,7 +13,8 @@ const FIND_MATCH_FOUND = 0; const FIND_MATCH_NOT_FOUND = 1; const FIND_MATCH_PENDING = 3; -@autobind class DocFindBar extends EventEmitter { +@autobind +class DocFindBar extends EventEmitter { /** * [constructor] * diff --git a/src/lib/viewers/doc/DocumentViewer.js b/src/lib/viewers/doc/DocumentViewer.js index ab2782b94..c2cce2bcb 100644 --- a/src/lib/viewers/doc/DocumentViewer.js +++ b/src/lib/viewers/doc/DocumentViewer.js @@ -29,7 +29,8 @@ const LOADING_ICON_MAP = { xlsx: ICON_FILE_SPREADSHEET }; -@autobind class DocumentViewer extends DocBaseViewer { +@autobind +class DocumentViewer extends DocBaseViewer { //-------------------------------------------------------------------------- // Public //-------------------------------------------------------------------------- diff --git a/src/lib/viewers/doc/PresentationViewer.js b/src/lib/viewers/doc/PresentationViewer.js index eb282aff5..bd69df749 100644 --- a/src/lib/viewers/doc/PresentationViewer.js +++ b/src/lib/viewers/doc/PresentationViewer.js @@ -19,7 +19,8 @@ const WHEEL_THROTTLE = 200; const PADDING_OFFSET = 30; const SCROLL_EVENT_OFFSET = 5; -@autobind class PresentationViewer extends DocBaseViewer { +@autobind +class PresentationViewer extends DocBaseViewer { //-------------------------------------------------------------------------- // Public //-------------------------------------------------------------------------- diff --git a/src/lib/viewers/error/PreviewErrorViewer.js b/src/lib/viewers/error/PreviewErrorViewer.js index df9f7300c..8c344fc44 100644 --- a/src/lib/viewers/error/PreviewErrorViewer.js +++ b/src/lib/viewers/error/PreviewErrorViewer.js @@ -6,7 +6,8 @@ import { PERMISSION_DOWNLOAD } from '../../constants'; import { ICON_FILE_DEFAULT, ICON_FILE_MEDIA, ICON_FILE_ZIP } from '../../icons/icons'; import './PreviewError.scss'; -@autobind class PreviewErrorViewer extends BaseViewer { +@autobind +class PreviewErrorViewer extends BaseViewer { /** * [constructor] * diff --git a/src/lib/viewers/image/ImageBaseViewer.js b/src/lib/viewers/image/ImageBaseViewer.js index 2569f59e6..af6fcb226 100644 --- a/src/lib/viewers/image/ImageBaseViewer.js +++ b/src/lib/viewers/image/ImageBaseViewer.js @@ -10,7 +10,8 @@ const CSS_CLASS_PANNING = 'panning'; const CSS_CLASS_ZOOMABLE = 'zoomable'; const CSS_CLASS_PANNABLE = 'pannable'; -@autobind class ImageBaseViewer extends BaseViewer { +@autobind +class ImageBaseViewer extends BaseViewer { /** * [destructor] * diff --git a/src/lib/viewers/image/ImageViewer.js b/src/lib/viewers/image/ImageViewer.js index 630755409..1d3f510fc 100644 --- a/src/lib/viewers/image/ImageViewer.js +++ b/src/lib/viewers/image/ImageViewer.js @@ -1,12 +1,7 @@ import autobind from 'autobind-decorator'; import Browser from '../../Browser'; import ImageBaseViewer from './ImageBaseViewer'; -import { - ICON_FILE_IMAGE, - ICON_FULLSCREEN_IN, - ICON_FULLSCREEN_OUT, - ICON_ROTATE_LEFT -} from '../../icons/icons'; +import { ICON_FILE_IMAGE, ICON_FULLSCREEN_IN, ICON_FULLSCREEN_OUT, ICON_ROTATE_LEFT } from '../../icons/icons'; import { CLASS_INVISIBLE } from '../../constants'; import { openContentInsideIframe } from '../../util'; import './Image.scss'; @@ -15,7 +10,8 @@ const CSS_CLASS_IMAGE = 'bp-image'; const IMAGE_PADDING = 15; const IMAGE_ZOOM_SCALE = 1.2; -@autobind class ImageViewer extends ImageBaseViewer { +@autobind +class ImageViewer extends ImageBaseViewer { /** * @inheritdoc */ @@ -312,19 +308,21 @@ const IMAGE_ZOOM_SCALE = 1.2; }; if (this.isRotated()) { - largerWidth = wrapperDimensions.width > this.imageEl.clientHeight - ? wrapperDimensions.width - : this.imageEl.clientHeight; - largerHeight = wrapperDimensions.height > this.imageEl.clientWidth - ? wrapperDimensions.height - : this.imageEl.clientWidth; + largerWidth = + wrapperDimensions.width > this.imageEl.clientHeight + ? wrapperDimensions.width + : this.imageEl.clientHeight; + largerHeight = + wrapperDimensions.height > this.imageEl.clientWidth + ? wrapperDimensions.height + : this.imageEl.clientWidth; } else { - largerWidth = wrapperDimensions.width > this.imageEl.clientWidth - ? wrapperDimensions.width - : this.imageEl.clientWidth; - largerHeight = wrapperDimensions.height > this.imageEl.clientHeight - ? wrapperDimensions.height - : this.imageEl.clientHeight; + largerWidth = + wrapperDimensions.width > this.imageEl.clientWidth ? wrapperDimensions.width : this.imageEl.clientWidth; + largerHeight = + wrapperDimensions.height > this.imageEl.clientHeight + ? wrapperDimensions.height + : this.imageEl.clientHeight; } leftPadding = (largerWidth - this.imageEl.clientWidth) / 2; diff --git a/src/lib/viewers/image/MultiImageViewer.js b/src/lib/viewers/image/MultiImageViewer.js index 97247fefb..33a916d26 100644 --- a/src/lib/viewers/image/MultiImageViewer.js +++ b/src/lib/viewers/image/MultiImageViewer.js @@ -10,7 +10,8 @@ const CSS_CLASS_IMAGE = 'bp-images'; const CSS_CLASS_IMAGE_WRAPPER = 'bp-images-wrapper'; const ZOOM_UPDATE_PAN_DELAY = 50; -@autobind class MultiImageViewer extends ImageBaseViewer { +@autobind +class MultiImageViewer extends ImageBaseViewer { /** * @inheritdoc */ diff --git a/src/lib/viewers/media/DashViewer.js b/src/lib/viewers/media/DashViewer.js index e122a81f1..f8e982550 100644 --- a/src/lib/viewers/media/DashViewer.js +++ b/src/lib/viewers/media/DashViewer.js @@ -13,7 +13,8 @@ const SEGMENT_SIZE = 5; const MAX_BUFFER = SEGMENT_SIZE * 12; // 60 sec const MANIFEST = 'manifest.mpd'; -@autobind class DashViewer extends VideoBaseViewer { +@autobind +class DashViewer extends VideoBaseViewer { /** * @inheritdoc */ @@ -304,7 +305,8 @@ const MANIFEST = 'manifest.mpd'; */ shakaErrorHandler(shakaError) { const error = new Error( - `Shaka error. Code = ${shakaError.detail.code}, Category = ${shakaError.detail.category}, Severity = ${shakaError.detail.severity}` + `Shaka error. Code = ${shakaError.detail.code}, Category = ${shakaError.detail + .category}, Severity = ${shakaError.detail.severity}` ); error.displayMessage = __('error_refresh'); diff --git a/src/lib/viewers/media/MP3Viewer.js b/src/lib/viewers/media/MP3Viewer.js index 50ecd4706..dcc20794f 100644 --- a/src/lib/viewers/media/MP3Viewer.js +++ b/src/lib/viewers/media/MP3Viewer.js @@ -5,7 +5,8 @@ import './MP3.scss'; const CSS_CLASS_MP3 = 'bp-media-mp3'; -@autobind class MP3Viewer extends MediaBaseViewer { +@autobind +class MP3Viewer extends MediaBaseViewer { /** * @inheritdoc */ diff --git a/src/lib/viewers/media/MP4Viewer.js b/src/lib/viewers/media/MP4Viewer.js index d5a49f184..dccfda251 100644 --- a/src/lib/viewers/media/MP4Viewer.js +++ b/src/lib/viewers/media/MP4Viewer.js @@ -4,7 +4,8 @@ import './MP4.scss'; const CSS_CLASS_MP4 = 'bp-media-mp4'; -@autobind class MP4Viewer extends VideoBaseViewer { +@autobind +class MP4Viewer extends VideoBaseViewer { /** * @inheritdoc */ diff --git a/src/lib/viewers/media/MediaBaseViewer.js b/src/lib/viewers/media/MediaBaseViewer.js index e71b2900d..b700e3bee 100644 --- a/src/lib/viewers/media/MediaBaseViewer.js +++ b/src/lib/viewers/media/MediaBaseViewer.js @@ -13,7 +13,8 @@ const MEDIA_VOLUME_CACHE_KEY = 'media-volume'; const MEDIA_VOLUME_INCREMENT = 0.05; const EMIT_WAIT_TIME_IN_MILLIS = 100; -@autobind class MediaBaseViewer extends BaseViewer { +@autobind +class MediaBaseViewer extends BaseViewer { /** * @inheritdoc */ diff --git a/src/lib/viewers/media/MediaControls.js b/src/lib/viewers/media/MediaControls.js index 9968a50a4..4eb52f3cc 100644 --- a/src/lib/viewers/media/MediaControls.js +++ b/src/lib/viewers/media/MediaControls.js @@ -21,7 +21,8 @@ const CRAWLER = const FILMSTRIP_FRAMES_PER_ROW = 100; const FILMSTRIP_FRAME_HEIGHT = 90; -@autobind class MediaControls extends EventEmitter { +@autobind +class MediaControls extends EventEmitter { /** * [constructor] * diff --git a/src/lib/viewers/media/Scrubber.js b/src/lib/viewers/media/Scrubber.js index a4870aa7f..631cce25d 100644 --- a/src/lib/viewers/media/Scrubber.js +++ b/src/lib/viewers/media/Scrubber.js @@ -8,7 +8,8 @@ const MAX_VALUE = 1; const CLASS_SCRUBBER_HOVER = 'bp-media-scrubber-hover'; const CLASS_SCRUBBER_TOUCH = 'bp-media-scrubber-touch'; -@autobind class Scrubber extends EventEmitter { +@autobind +class Scrubber extends EventEmitter { /** * Service to handle the position and movement of a slider element * diff --git a/src/lib/viewers/media/Settings.js b/src/lib/viewers/media/Settings.js index a61a2b56b..d1dc99922 100644 --- a/src/lib/viewers/media/Settings.js +++ b/src/lib/viewers/media/Settings.js @@ -94,7 +94,8 @@ const SUBTITLES_SUBITEM_TEMPLATE = `
`; -@autobind class Settings extends EventEmitter { +@autobind +class Settings extends EventEmitter { /** @property {HTMLElement} - Settings container element */ containerEl; diff --git a/src/lib/viewers/media/VideoBaseViewer.js b/src/lib/viewers/media/VideoBaseViewer.js index 3cef324c1..22ccb000b 100644 --- a/src/lib/viewers/media/VideoBaseViewer.js +++ b/src/lib/viewers/media/VideoBaseViewer.js @@ -7,7 +7,8 @@ import { ICON_PLAY_LARGE } from '../../icons/icons'; const MOUSE_MOVE_TIMEOUT_IN_MILLIS = 1000; const CLASS_PLAY_BUTTON = 'bp-media-play-button'; -@autobind class VideoBaseViewer extends MediaBaseViewer { +@autobind +class VideoBaseViewer extends MediaBaseViewer { /** * @inheritdoc */ diff --git a/src/lib/viewers/office/OfficeViewer.js b/src/lib/viewers/office/OfficeViewer.js index 247197b72..d294dd978 100644 --- a/src/lib/viewers/office/OfficeViewer.js +++ b/src/lib/viewers/office/OfficeViewer.js @@ -15,7 +15,8 @@ const EXCEL_ONLINE_EMBED_URL = 'https://excel.officeapps.live.com/x/_layouts/xle const OFFICE_ONLINE_IFRAME_NAME = 'office-online-iframe'; const MESSAGE_HOST_READY = 'Host_PostmessageReady'; -@autobind class OfficeViewer extends BaseViewer { +@autobind +class OfficeViewer extends BaseViewer { //-------------------------------------------------------------------------- // Public //-------------------------------------------------------------------------- diff --git a/src/lib/viewers/text/BoxCSV.js b/src/lib/viewers/text/BoxCSV.js index 2472adefd..b692a37c4 100644 --- a/src/lib/viewers/text/BoxCSV.js +++ b/src/lib/viewers/text/BoxCSV.js @@ -8,7 +8,8 @@ const WIDTH_SCROLLER = 5; const WIDTH_COLUMN = 160; const WIDTH_BORDER = 2; -@autobind class BoxCSV { +@autobind +class BoxCSV { /** * [constructor] * diff --git a/src/lib/viewers/text/CSVViewer.js b/src/lib/viewers/text/CSVViewer.js index 59a155276..bc8707a70 100644 --- a/src/lib/viewers/text/CSVViewer.js +++ b/src/lib/viewers/text/CSVViewer.js @@ -6,7 +6,8 @@ import './CSV.scss'; const JS = [`third-party/text/${TEXT_STATIC_ASSETS_VERSION}/papaparse.min.js`, 'csv.js']; -@autobind class CSVViewer extends TextBaseViewer { +@autobind +class CSVViewer extends TextBaseViewer { /** * @inheritdoc */ diff --git a/src/lib/viewers/text/MarkdownViewer.js b/src/lib/viewers/text/MarkdownViewer.js index f827c94a4..be0cd09d2 100644 --- a/src/lib/viewers/text/MarkdownViewer.js +++ b/src/lib/viewers/text/MarkdownViewer.js @@ -7,7 +7,8 @@ import './Markdown.scss'; const STATIC_URI = `third-party/text/${TEXT_STATIC_ASSETS_VERSION}/`; -@autobind class MarkdownViewer extends PlainTextViewer { +@autobind +class MarkdownViewer extends PlainTextViewer { /** * @inheritdoc */