MCPcopy Create free account
hub / github.com/Useful-Scripts-Extension/useful-script / showVideo

Function showVideo

scripts/backup/m38u_detector.js:552–599  ·  view source on GitHub ↗
({ type, url, duration, download })

Source from the content-addressed store, hash-verified

550 }
551
552 async function showVideo({ type, url, duration, download }) {
553 let div = document.createElement("div");
554 div.className = "m3u8-item";
555 div.innerHTML = `
556 <span>${type}</span>
557 <span
558 class="copy-link"
559 title="${url}"
560 style="
561 max-width: 200px;
562 text-overflow: ellipsis;
563 white-space: nowrap;
564 overflow: hidden;
565 margin-left: 10px;
566 "
567 >${url.pathname}</span>
568 <span
569 style="
570 margin-left: 10px;
571 flex-grow: 1;
572 "
573 >${duration}</span>
574 <span
575 class="download-btn"
576 style="
577 margin-left: 10px;
578 cursor: pointer;
579 ">下载(Download)</span>
580 `;
581
582 div.querySelector(".copy-link").addEventListener("click", () => {
583 // 复制链接
584 mgmapi.copyText(url.href);
585 mgmapi.message("已复制链接 (link copied)", 2000);
586 });
587
588 div.querySelector(".download-btn").addEventListener("click", download);
589
590 rootDiv.style.display = "block";
591
592 count++;
593
594 shownUrls.push(url.href);
595
596 bar.querySelector(".number-indicator").setAttribute("data-number", count);
597
598 wrapper.appendChild(div);
599 }
600})();
601
602(function () {

Callers 2

doVideosFunction · 0.85
doM3UFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected