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

Method notice

src/js/player.js:640–675  ·  view source on GitHub ↗
(text, time = 2000, opacity = 0.8, id)

Source from the content-addressed store, hash-verified

638 }
639
640 notice(text, time = 2000, opacity = 0.8, id) {
641 let oldNoticeEle;
642 if (id) {
643 oldNoticeEle = document.getElementById(`dplayer-notice-${id}`);
644 if (oldNoticeEle) {
645 oldNoticeEle.innerHTML = text;
646 }
647 if (this.noticeList[id]) {
648 clearTimeout(this.noticeList[id]);
649 this.noticeList[id] = null;
650 }
651 }
652 if (!oldNoticeEle) {
653 const notice = Template.NewNotice(text, opacity, id);
654 this.template.noticeList.appendChild(notice);
655 oldNoticeEle = notice;
656 }
657
658 this.events.trigger('notice_show', oldNoticeEle);
659
660 if (time > 0) {
661 this.noticeList[id] = setTimeout(
662 (function (e, dp) {
663 return () => {
664 e.addEventListener('animationend', () => {
665 dp.template.noticeList.removeChild(e);
666 });
667 e.classList.add('remove-notice');
668 dp.events.trigger('notice_hide');
669 dp.noticeList[id] = null;
670 };
671 })(oldNoticeEle, this),
672 time
673 );
674 }
675 }
676
677 resize() {
678 if (this.danmaku) {

Callers 7

constructorMethod · 0.95
seekMethod · 0.95
volumeMethod · 0.95
initMSEMethod · 0.95
initVideoMethod · 0.95
switchQualityMethod · 0.95
sendMethod · 0.80

Calls 2

NewNoticeMethod · 0.80
triggerMethod · 0.80

Tested by

no test coverage detected