debug
This commit is contained in:
149
code/public/template/shikong/huiyuan/js/page/main.js
Normal file
149
code/public/template/shikong/huiyuan/js/page/main.js
Normal file
@@ -0,0 +1,149 @@
|
||||
// 首页弹窗隐藏
|
||||
function setupHideOnClick(elementId) {
|
||||
|
||||
// 获取元素
|
||||
var element = document.querySelector(elementId);
|
||||
|
||||
// 如果元素不存在,退出函数
|
||||
if (!element) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 获取当前日期字符串 a2bb38a3fa
|
||||
var today = new Date().toISOString().slice(0, 10);
|
||||
|
||||
// 检查本地存储中的日期是否与今天匹配
|
||||
if (localStorage.getItem('hideDate_' + elementId) === today) {
|
||||
// 如果匹配,则隐藏元素
|
||||
element.style.display = 'none';
|
||||
} else {
|
||||
// 如果不匹配,则显示元素并添加点击事件监听器
|
||||
element.style.display = 'block';
|
||||
|
||||
element.addEventListener('click', function() {
|
||||
// 隐藏元素
|
||||
element.style.display = 'none';
|
||||
|
||||
// 更新本地存储,保存当前日期
|
||||
localStorage.setItem('hideDate_' + elementId, today);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 懒加载
|
||||
function initLazyLoad() {
|
||||
let lazyImages = [].slice.call(document.querySelectorAll("img.lazy"));
|
||||
|
||||
if ("IntersectionObserver" in window) {
|
||||
let lazyImageObserver = new IntersectionObserver(function(entries, observer) {
|
||||
entries.forEach(function(entry) {
|
||||
if (entry.isIntersecting) {
|
||||
let lazyImage = entry.target;
|
||||
lazyImage.src = lazyImage.getAttribute("data-src");
|
||||
lazyImage.classList.remove("lazy");
|
||||
lazyImageObserver.unobserve(lazyImage);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
lazyImages.forEach(function(lazyImage) {
|
||||
lazyImageObserver.observe(lazyImage);
|
||||
});
|
||||
} else {
|
||||
// Fallback for older browsers
|
||||
let lazyLoad = function() {
|
||||
let active = false;
|
||||
|
||||
if (active === false) {
|
||||
active = true;
|
||||
|
||||
setTimeout(function() {
|
||||
lazyImages.forEach(function(lazyImage) {
|
||||
if ((lazyImage.getBoundingClientRect().top <= window.innerHeight && lazyImage.getBoundingClientRect().bottom >= 0) && getComputedStyle(lazyImage).display !== "none") {
|
||||
lazyImage.src = lazyImage.getAttribute("data - src");
|
||||
lazyImage.classList.remove("lazy");
|
||||
|
||||
lazyImages = lazyImages.filter(function(image) {
|
||||
return image !== lazyImage;
|
||||
});
|
||||
|
||||
if (lazyImages.length === 0) {
|
||||
document.removeEventListener("scroll", lazyLoad);
|
||||
window.removeEventListener("resize", lazyLoad);
|
||||
window.removeEventListener("orientationchange", lazyLoad);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
active = false;
|
||||
}, 200);
|
||||
}
|
||||
};
|
||||
|
||||
document.addEventListener("scroll", lazyLoad);
|
||||
window.addEventListener("resize", lazyLoad);
|
||||
window.addEventListener("orientationchange", lazyLoad);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function showOverlay(message, duration = 2000) {
|
||||
const overlay = document.createElement('div');
|
||||
overlay.id = "overlay";
|
||||
overlay.className = "overlay";
|
||||
overlay.style.display = "flex"; // 显示遮罩层
|
||||
|
||||
const overlayContent = document.createElement('div');
|
||||
overlayContent.className = "overlay-content";
|
||||
overlayContent.textContent = message;
|
||||
|
||||
overlay.appendChild(overlayContent);
|
||||
document.body.appendChild(overlay);
|
||||
|
||||
// 设置定时器隐藏遮罩层并移除它
|
||||
setTimeout(function() {
|
||||
document.body.removeChild(overlay);
|
||||
}, duration); // 默认2秒后隐藏
|
||||
}
|
||||
|
||||
|
||||
// 复制粘贴
|
||||
function copyTextToClipboard(text) {
|
||||
const copyText = document.createElement('input');
|
||||
copyText.type = 'text';
|
||||
copyText.value = text;
|
||||
copyText.style.position = 'absolute';
|
||||
copyText.style.left = '-9999px';
|
||||
document.body.appendChild(copyText);
|
||||
|
||||
// 复制功能
|
||||
copyText.select();
|
||||
copyText.setSelectionRange(0, 99999); // For mobile devices
|
||||
document.execCommand("copy");
|
||||
document.body.removeChild(copyText); // 移除输入框
|
||||
}
|
||||
|
||||
function handleCopyButtonClick() {
|
||||
const textToCopy = location.href;
|
||||
copyTextToClipboard(textToCopy);
|
||||
showOverlay("您已成功复制链接,快分享给好友吧~");
|
||||
}
|
||||
|
||||
|
||||
// 确保在 DOM 加载完成后执行脚本
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// 设置首页弹窗
|
||||
setupHideOnClick('._31bb2383c4');
|
||||
initLazyLoad(); // 调用方法初始化懒加载
|
||||
|
||||
// 分享
|
||||
if(document.querySelector("#ShareButton")){
|
||||
|
||||
}
|
||||
// const GuideButton = document.querySelector("#ShareButton");
|
||||
// GuideButton.addEventListener("click", handleCopyButtonClick);
|
||||
|
||||
|
||||
});
|
||||
@@ -0,0 +1,92 @@
|
||||
|
||||
$(document).ready(function() {
|
||||
//专题 btn_gray
|
||||
$(".btn_gray").on('click', function () {
|
||||
$(".sc-gray-jump-popup").show()
|
||||
});
|
||||
// $(".btn_gray").on('click', function () {
|
||||
// $(".sc-jc-pd-img").show()
|
||||
// });
|
||||
|
||||
|
||||
//精彩片段
|
||||
const imagesArray = [
|
||||
"/static/images/default/loading/750x422.jpg",
|
||||
"https://i.imgtg.com/2023/01/16/QRBHS.jpg",
|
||||
"/static/images/default/loading/750x422.jpg",
|
||||
"/static/images/default/loading/750x422.jpg",
|
||||
"/static/images/default/loading/750x422.jpg",
|
||||
];
|
||||
|
||||
const imageContainer = document.getElementById("imageContainer");
|
||||
let strHtml = ''; // Define html before using it
|
||||
imagesArray.forEach(img => {
|
||||
strHtml += `
|
||||
<div class="_64cc81278a" onclick="openPopup('${img}')">
|
||||
<img sizes="100vh" class="point fill undefined" height="30" width="0" alt="" src="${img}">
|
||||
<div style="position: relative; float: inline-start;">
|
||||
<img sizes="100vh" class="point fill undefined" height="20" width="20" alt="" src="/static/images/zoom.png" style="position: absolute; top: 0px; right: 0px;">
|
||||
<img sizes="100vh" class="point fill lazy" height="0" width="0" alt="" src="${img}" style="object-fit: contain; width: 100%; height: 100%;">
|
||||
</div>
|
||||
</div>`
|
||||
});
|
||||
imageContainer.innerHTML = strHtml;
|
||||
|
||||
|
||||
window.openPopup = function(imgSrc) {
|
||||
$(".sc-jc-pd-img img").attr("src", imgSrc);
|
||||
$(".sc-jc-pd-img").show()
|
||||
|
||||
}
|
||||
|
||||
const dataArray = [
|
||||
{
|
||||
title: '[樱空桃桃] 樱空桃桃-免费观看片段 1',
|
||||
badge: '免费试看',
|
||||
image: '/static/images/default/loading/750x422.jpg',
|
||||
duration: '0:02:58',
|
||||
date: '10 天前',
|
||||
description: '此内容为免费观看资源,若需要观看完整版内容请开通捆版包'
|
||||
},
|
||||
{
|
||||
title: '[樱空桃桃] 樱空桃桃-免费观看片段 1',
|
||||
badge: '免费试看',
|
||||
image: '/static/images/default/loading/750x422.jpg',
|
||||
duration: '0:02:58',
|
||||
date: '10 天前',
|
||||
description: '此内容为免费观看资源,若需要观看完整版内容请开通捆版包'
|
||||
},
|
||||
// Add more objects as needed
|
||||
];
|
||||
const container = document.getElementById('dynamicContentContainer');
|
||||
container.innerHTML = ''; // Clear existing content
|
||||
|
||||
dataArray.forEach((item, index) => {
|
||||
const content = `
|
||||
<div class="_045eeff507 b13cd7bde3">
|
||||
<div class="_8e389b3ada to" style="height: auto; max-height: 43px; line-height: 1.3rem; padding-bottom: 8px; font-size: 16px;">
|
||||
${index + 1}. <span class="pink_badge" style="margin-right: 3px;">${item.badge}</span>${item.title}
|
||||
</div>
|
||||
<div class="b29b1e3a20 _1ba75a9421 b8795542a0">
|
||||
<div class="_5adb102473 _508f1080bd relative">
|
||||
<img class="point fill i_cvr" height="0" width="0" alt="" src="${item.image}">
|
||||
<img class="point fill lazy" height="0" width="0" alt="" src="${item.image}" style="object-fit: contain; width: 100%; height: 100%;">
|
||||
<div class="_45774389f4">
|
||||
<div>${item.duration}</div>
|
||||
</div>
|
||||
<div class="_293abc39de _0a85a12109">
|
||||
<div>${item.date}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="_65325a7a69 acf5ea3bd3">
|
||||
<div style="white-space: pre-wrap;">${item.description}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="_7d13122783 a661c212c5"></div>
|
||||
<div></div>
|
||||
</div>
|
||||
`;
|
||||
container.innerHTML += content; // Append the new content
|
||||
});
|
||||
|
||||
});
|
||||
127
code/public/template/shikong/huiyuan/js/page/videoinfo.js
Normal file
127
code/public/template/shikong/huiyuan/js/page/videoinfo.js
Normal file
@@ -0,0 +1,127 @@
|
||||
|
||||
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("播放未知线路");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
})
|
||||
Reference in New Issue
Block a user