MCPcopy
hub / github.com/DIYgod/DPlayer / initSubtitleButton

Method initSubtitleButton

src/js/controller.js:366–381  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

364 }
365
366 initSubtitleButton() {
367 this.player.events.on('subtitle_show', () => {
368 this.player.template.subtitleButton.dataset.balloon = this.player.tran('hide-subs');
369 this.player.template.subtitleButtonInner.style.opacity = '';
370 this.player.user.set('subtitle', 1);
371 });
372 this.player.events.on('subtitle_hide', () => {
373 this.player.template.subtitleButton.dataset.balloon = this.player.tran('show-subs');
374 this.player.template.subtitleButtonInner.style.opacity = '0.4';
375 this.player.user.set('subtitle', 0);
376 });
377
378 this.player.template.subtitleButton.addEventListener('click', () => {
379 this.player.subtitle.toggle();
380 });
381 }
382
383 setAutoHide() {
384 this.show();

Callers 1

constructorMethod · 0.95

Calls 3

onMethod · 0.45
setMethod · 0.45
toggleMethod · 0.45

Tested by

no test coverage detected