127 lines
4.5 KiB
JavaScript
127 lines
4.5 KiB
JavaScript
|
||
import {downloadImageFromUrl,copyFun,init} from '../public/commonFun.js';
|
||
$(document).ready(function() {
|
||
init();
|
||
//视频片段-视频下载-立即分享点击切换
|
||
const menuItems = document.querySelectorAll('._0b92e5c73f');
|
||
const tabContents = document.querySelectorAll('.sc-tab-info');
|
||
|
||
// Function to reset all highlights and hide all contents
|
||
function resetHighlights() {
|
||
menuItems.forEach(item => item.classList.remove('_732b697cd0'));
|
||
tabContents.forEach(content => content.classList.add('ee58ce4adf'));
|
||
}
|
||
|
||
// Highlight the first item and show the first tab content by default
|
||
if(menuItems.length > 0) {
|
||
menuItems[0].classList.add('_732b697cd0');
|
||
if(tabContents.length > 0) {
|
||
tabContents[0].classList.remove('ee58ce4adf');
|
||
}
|
||
}
|
||
|
||
// Add click event to each menu item
|
||
menuItems.forEach((item, index) => {
|
||
item.addEventListener('click', () => {
|
||
resetHighlights();
|
||
item.classList.add('_732b697cd0');
|
||
if(tabContents[index]) {
|
||
tabContents[index].classList.remove('ee58ce4adf');
|
||
}
|
||
});
|
||
});
|
||
|
||
//迅雷下载
|
||
$(".sc-thunder").text(`thunder://QUFodHRwczovL3d3dy5tbXh6eGwxLmNvbS9jb21tb24vbWFvbWkvbWFvbWkvLzg5NjEwZmQ4MTIwNzM2NjgyZDc0YTkyZTk4X18yMTE5NDkvODk2MTBmZDgxMjA3MzY2ODJkNzRhOTJlOThfXzIxMTk0OS5tcDRaWg==`)
|
||
$(".sc-down-thunder-btn").on('click', function(event) {
|
||
const thunderText = $(".sc-thunder").text();
|
||
window.open(thunderText, '_blank');
|
||
});
|
||
//fdm下载
|
||
$(".sc-fdm").text(`https://www.mmxzxl1.com/common/maomi/maomi//89610fd8120736682d74a92e98__211949/89610fd8120736682d74a92e98__211949.mp4`)
|
||
$(".sc-down-fdm-btn").on('click', function(event) {
|
||
const fdmText = $(".sc-fdm").text();
|
||
window.open(fdmText, '_blank');
|
||
});
|
||
|
||
//保存二维码
|
||
$(".sc-download-btn").on('click', function () {
|
||
const imageUrl = 'https://mj.pki.net.cn/build1//images/help/fdm/Mac.jpg'; // 替换为你要下载的图片URL
|
||
downloadImageFromUrl(imageUrl)
|
||
});
|
||
//桃子app
|
||
$(".sc-tz-app").on('click', function () {
|
||
const textUrl = 'https://oy1gp3100i6r.xyz/?code=nn'; // 替换为你要下载的图片URL
|
||
window.open(textUrl, '_blank');
|
||
});
|
||
|
||
// 绑定复制点击事件
|
||
$(".data-cp-val").text('b3e8k.com668')
|
||
$(".j-copy-select").trigger("click");
|
||
|
||
|
||
|
||
// 定义播放线路数据
|
||
const playLines = [
|
||
{ name: "默认线路2", url: "https://example.com/default.mp4",index:0 },
|
||
{ name: "线路13", url: "https://example.com/line1.mp4",index:1 },
|
||
{ name: "线路24", url: "https://example.com/line2.mp4" ,index:2}
|
||
];
|
||
|
||
// 获取线路容器
|
||
const playlineContainer = document.getElementById("playline-container");
|
||
|
||
// 动态创建线路按钮并添加到容器中
|
||
playLines.forEach((line, index) => {
|
||
const lineBtn = document.createElement("div");
|
||
lineBtn.className = "faee9a7c48 point PlayLineBtn";
|
||
lineBtn.setAttribute("data-playline", line.url);
|
||
lineBtn.setAttribute("data-index", index); // 添加索引属性
|
||
lineBtn.textContent = line.name;
|
||
playlineContainer.appendChild(lineBtn);
|
||
});
|
||
|
||
// 获取视频元素
|
||
const videoPlayer = document.getElementById("video-player");
|
||
|
||
// 设置默认播放线路(第二条线路,index为1)
|
||
const defaultPlayLine = playLines[0]; // 第二条线路
|
||
videoPlayer.src = defaultPlayLine.url;
|
||
videoPlayer.playsinline = true;
|
||
videoPlayer.setAttribute("playsinline", defaultPlayLine.index);
|
||
videoPlayer.load();
|
||
|
||
// 绑定点击事件处理程序
|
||
playlineContainer.addEventListener("click", function(e) {
|
||
if (e.target.classList.contains("PlayLineBtn")) {
|
||
const playLineUrl = e.target.getAttribute("data-playline");
|
||
const index = e.target.getAttribute("data-index"); // 获取索引
|
||
|
||
// 更改视频的 src 属性
|
||
videoPlayer.src = playLineUrl;
|
||
videoPlayer.load();
|
||
|
||
// 设置 playsinline 属性(根据需要进行处理)
|
||
videoPlayer.playsinline = true;
|
||
videoPlayer.setAttribute("playsinline", index);
|
||
|
||
// 根据索引进行不同操作
|
||
switch (index) {
|
||
case '0':
|
||
console.log("播放默认线路2");
|
||
break;
|
||
case '1':
|
||
console.log("播放线路13");
|
||
break;
|
||
case '2':
|
||
console.log("播放线路24");
|
||
break;
|
||
default:
|
||
console.log("播放未知线路");
|
||
}
|
||
}
|
||
});
|
||
|
||
|
||
|
||
}) |