diff --git a/src/fullscreen.js b/src/fullscreen.js index 3af79a6..dcfa02a 100644 --- a/src/fullscreen.js +++ b/src/fullscreen.js @@ -93,8 +93,12 @@ class FullScreen { } else { this.request(type); + const anotherType = type === 'browser' ? 'web' : 'browser'; + if (this.isFullScreen(anotherType)) { + this.cancel(anotherType); + } } } } -module.exports = FullScreen; \ No newline at end of file +module.exports = FullScreen; diff --git a/src/html.js b/src/html.js deleted file mode 100644 index e4f3677..0000000 --- a/src/html.js +++ /dev/null @@ -1,274 +0,0 @@ -const html = { - main: (options, index, tran, icons) => ` -
-
- ${html.video(true, options.video.pic, options.screenshot, options.preload, options.video.url, options.subtitle)} - ${options.logo ? ` - - ` : ``} -
-
-
-
-
- - ${options.danmaku ? `${tran('Danmaku is loading')}` : ``} - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
-
- -
-
-
${tran('Set danmaku color')}
- - - - - - -
-
-
${tran('Set danmaku type')}
- - - -
-
- - -
-
- -
- -
-
-
- -
-
-
-
- 0:00 / 0:00 - ${options.live ? `${tran('Live')}` : ''} -
-
- ${options.video.quality ? ` -
- -
- ${html.qualityList(options.video.quality)} -
-
- ` : ``} - ${options.screenshot ? ` - - ${icons.get('camera')} - - ` : ``} -
- -
- ${options.subtitle ? ` -
- -
- ` : ``} -
- -
-
-
- - -
-
-
- -
-
-
-
- -
-
-
-
- ${html.contextmenuList(options.contextmenu, tran)} -
`, - - danmakumargin: (margin) => { - let result = ''; - if (margin) { - for (const key in margin) { - result += `${key}:${margin[key]};`; - } - } - return result; - }, - - contextmenuList: (contextmenu, tran) => { - let result = '
'; - for (let i = 0; i < contextmenu.length; i++) { - result += `
${tran(contextmenu[i].text)}
`; - } - result += '
'; - - return result; - }, - - qualityList: (quality) => { - let result = '
'; - for (let i = 0; i < quality.length; i++) { - result += `
${quality[i].name}
`; - } - result += '
'; - - return result; - }, - - video: (current, pic, screenshot, preload, url, subtitle) => { - const enableSubtitle = subtitle && subtitle.type === 'webvtt'; - return ` - `; - }, - - setting: (tran, icons) => ({ - 'original': ` -
- ${tran('Speed')} -
- ${icons.get('right')} -
-
-
- ${tran('Loop')} -
- - -
-
-
- ${tran('Show danmaku')} -
- - -
-
-
- ${tran('Unlimited danmaku')} -
- - -
-
-
- ${tran('Opacity for danmaku')} -
-
-
- -
-
-
-
`, - 'speed': ` -
- 0.5 -
-
- 0.75 -
-
- ${tran('Normal')} -
-
- 1.25 -
-
- 1.5 -
-
- 2 -
` - }) -}; - -module.exports = html; diff --git a/src/template.js b/src/template.js index e942d0c..be91857 100644 --- a/src/template.js +++ b/src/template.js @@ -53,7 +53,6 @@ class Template { this.commentSendButton = this.container.querySelector('.dplayer-send-icon'); this.commentSendFill = this.container.querySelector('.dplayer-send-icon .dplayer-fill'); this.commentColorSettingBox = this.container.querySelector('.dplayer-comment-setting-color'); - this.svgFill = this.container.querySelector('.dplayer-fill'); this.browserFullButton = this.container.querySelector('.dplayer-full-icon'); this.webFullButton = this.container.querySelector('.dplayer-full-in-icon'); this.menu = this.container.querySelector('.dplayer-menu'); @@ -63,7 +62,6 @@ class Template { this.subtitleButtonInner = this.container.querySelector('.dplayer-subtitle-icon .dplayer-icon-content'); this.subtitle = this.container.querySelector('.dplayer-subtitle'); this.qualityButton = this.container.querySelector('.dplayer-quality-icon'); - this.videoWrap = this.parent = this.container.querySelector('.dplayer-video-wrap'); this.barPreview = this.container.querySelector('.dplayer-bar-preview'); this.barWrap = this.container.querySelector('.dplayer-bar-wrap'); this.notice = this.container.querySelector('.dplayer-notice');