diff --git a/src/js/info-panel.js b/src/js/info-panel.js index 6e1ca1e38..f2fae6119 100644 --- a/src/js/info-panel.js +++ b/src/js/info-panel.js @@ -35,20 +35,28 @@ class InfoPanel { } update() { - this.template.infoVersion.innerHTML = `v${DPLAYER_VERSION} ${GIT_HASH}`; - this.template.infoType.innerHTML = this.player.type; - this.template.infoUrl.innerHTML = this.player.options.video.url; - this.template.infoResolution.innerHTML = `${this.player.video.videoWidth} x ${this.player.video.videoHeight}`; - this.template.infoDuration.innerHTML = this.player.video.duration; + this.template.infoVersion.textContent = `v${DPLAYER_VERSION} ${GIT_HASH}`; + this.template.infoType.textContent = this.player.type; + this.template.infoUrl.textContent = this.player.options.video.url; + this.template.infoResolution.textContent = `${this.player.video.videoWidth} x ${this.player.video.videoHeight}`; + this.template.infoDuration.textContent = this.player.video.duration; if (this.player.options.danmaku) { - this.template.infoDanmakuId.innerHTML = this.player.options.danmaku.id; - this.template.infoDanmakuApi.innerHTML = this.player.options.danmaku.api; - this.template.infoDanmakuAmount.innerHTML = this.player.danmaku.dan.length; + this.template.infoDanmakuId.textContent = this.player.options.danmaku.id; + this.template.infoDanmakuApi.textContent = this.player.options.danmaku.api; + this.template.infoDanmakuAmount.textContent = this.player.danmaku.dan.length; } } fps(value) { - this.template.infoFPS.innerHTML = `${value.toFixed(1)}`; + this.template.infoFPS.textContent = `${value.toFixed(1)}`; + } + + toggle() { + if (this.container.classList.contains('dplayer-info-panel-hide')) { + this.show(); + } else { + this.hide(); + } } } diff --git a/src/js/template.js b/src/js/template.js index 247b32e58..dff4cc476 100644 --- a/src/js/template.js +++ b/src/js/template.js @@ -110,7 +110,7 @@ class Template { const notice = document.createElement('div'); notice.classList.add('dplayer-notice'); notice.style.opacity = opacity; - notice.innerText = text; + notice.textContent = text; if (id) { notice.id = `dplayer-notice-${id}`; } diff --git a/src/template/player.art b/src/template/player.art index c468a3840..30e581aaa 100644 --- a/src/template/player.art +++ b/src/template/player.art @@ -15,7 +15,7 @@ {{ if options.danmaku }} {{ tran('danmaku-loading') }} {{ /if }} - {{@ icons.loading }} + {{@ icons.loading }}
@@ -270,7 +270,7 @@
{{ each options.contextmenu }}
- {{ if $value.key }} {{ tran($value.key) }}{{ /if }}{{ if $value.text }} {{$value.text}}{{ /if }} + {{ if $value.key }} {{ tran($value.key) }}{{ /if }}{{ if $value.text }} {{$value.text}}{{ /if }}
{{ /each }}