From 2f6d8378d90076e5d64750d5996fc217b21ed681 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Thu, 27 Sep 2018 00:14:25 +0800 Subject: [PATCH] format --- src/js/contextmenu.js | 2 +- src/js/controller.js | 6 +++--- src/js/fullscreen.js | 2 +- src/js/player.js | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/js/contextmenu.js b/src/js/contextmenu.js index 08a2f943f..f8cf2ad81 100644 --- a/src/js/contextmenu.js +++ b/src/js/contextmenu.js @@ -17,7 +17,7 @@ class ContextMenu { this.hide(); return; } - + const event = e || window.event; event.preventDefault(); diff --git a/src/js/controller.js b/src/js/controller.js index 86dd7caea..42968e0e1 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -57,13 +57,13 @@ class Controller { }); } } - + initHighlights () { this.player.on('durationchange', () => { if (this.player.video.duration !== 1 && this.player.video.duration !== Infinity) { if (this.player.options.highlight) { const highlights = document.querySelectorAll('.dplayer-highlight'); - [].slice.call(highlights, 0).map((item) => { + [].slice.call(highlights, 0).forEach((item) => { this.player.template.playedBarWrap.removeChild(item); }); for (let i = 0; i < this.player.options.highlight.length; i++) { @@ -72,7 +72,7 @@ class Controller { } const p = document.createElement('div'); p.classList.add('dplayer-highlight'); - p.style.left = ( (this.player.options.highlight[i].time / this.player.video.duration) * 100) + '%'; + p.style.left = this.player.options.highlight[i].time / this.player.video.duration * 100 + '%'; p.innerHTML = '' + this.player.options.highlight[i].text + ''; this.player.template.playedBarWrap.insertBefore(p, this.player.template.playedBarTime); } diff --git a/src/js/fullscreen.js b/src/js/fullscreen.js index 0eafe70d1..cd5fad5ee 100644 --- a/src/js/fullscreen.js +++ b/src/js/fullscreen.js @@ -34,7 +34,7 @@ class FullScreen { utils.setScrollPosition(this.lastScrollPosition); this.player.events.trigger('fullscreen_cancel'); } - } + }; if (/Firefox/.test(navigator.userAgent)) { document.addEventListener('mozfullscreenchange', docfullscreenchange); document.addEventListener('fullscreenchange', docfullscreenchange); diff --git a/src/js/player.js b/src/js/player.js index e2728d89b..a0d8b5482 100644 --- a/src/js/player.js +++ b/src/js/player.js @@ -438,7 +438,7 @@ class DPlayer { this.on('error', () => { if (!this.video.error) { // Not a video load error, may be poster load failed, see #307 - return + return; } this.tran && this.notice && this.type !== 'webtorrent' & this.notice(this.tran('Video load failed'), -1); });