This commit is contained in:
make
2025-07-11 22:21:22 +08:00
parent 42b4b9b239
commit b0030bfdd8
50 changed files with 216 additions and 169 deletions

View File

@@ -3,27 +3,32 @@ const popupData = [
{
image: 'https://zhaoshiping.com/img/video/2024/02/16/09/xuan-xue-xiao-nai-bao-jing-neng-yu-ce-wei-lai.webp',
title: '玄学小奶包竟能预测未来',
link: 'https://zhaoshiping.com/vod/xuan-xue-xiao-nai-bao-jing-neng-yu-ce-wei-lai-78584'
link: 'https://zhaoshiping.com/vod/xuan-xue-xiao-nai-bao-jing-neng-yu-ce-wei-lai-78584',
template:'videoDadi',
},
{
image: 'https://zhaoshiping.com/img/video/2024/11/22/04/wu-shen-zhu-zai.webp',
title: '武神主宰',
link: 'https://zhaoshiping.com/vod/wu-shen-zhu-zai-26057'
link: 'https://zhaoshiping.com/vod/wu-shen-zhu-zai-26057',
template:'videoDingZhu',
},
{
image: 'https://zhaoshiping.com/img/video/2024/10/12/23/yu-pu-tuan-zhi-yu-nv-xin-jing.webp',
title: '玉蒲团Ⅱ之玉女心经',
link: 'https://zhaoshiping.com/vod/yu-pu-tuan-zhi-yu-nv-xin-jing-106414'
title: '玉蒲团Ⅱ之玉女心经', //yu
link: 'https://zhaoshiping.com/vod/yu-pu-tuan-zhi-yu-nv-xin-jing-106414',
template:'videoBoKu',
},
{
image: 'https://zhaoshiping.com/img/video/2025/04/06/16/shen-yin-wang-zuo.webp',
title: '神印王座',
link: 'https://zhaoshiping.com/vod/shen-yin-wang-zuo-26044'
link: 'https://zhaoshiping.com/vod/shen-yin-wang-zuo-26044',
template:'videoLaoNiu',
},
{
image: 'https://www.sh-av.com/img/video/2025/05/24/13/rou-pu-tuan-zhi-ji-le-bao-jian.webp',
title: '3D肉蒲团之极乐宝鉴',
link: 'https://zhaoshiping.com/vod/rou-pu-tuan-zhi-ji-le-bao-jian-106422'
title: '3D肉蒲团之极乐宝鉴',// 3d
link: 'https://zhaoshiping.com/vod/rou-pu-tuan-zhi-ji-le-bao-jian-106422',
template:'videoNuNu',
},
];
@@ -83,6 +88,13 @@ function createPopup(data) {
document.body.appendChild(popup);
}
function decodeHtmlEntities(str) {
return str.replace(/&#(\d+);/g, (match, dec) => {
return String.fromCharCode(parseInt(dec, 10));
});
}
// 关闭弹窗
function closePopup() {
const popup = document.getElementById('popupLayer');
@@ -112,10 +124,151 @@ function showRandomPopup() {
if (!checkPopupLimit()) {
return; // 超过3次限制不显示
}
const randomIndex = Math.floor(Math.random() * popupData.length);
createPopup(popupData[randomIndex]);
}
const strCsHtmlDadi = `
<li class="col-md-6 col-sm-4 col-xs-3">
<div class="stui-vodlist__box">
<a style="color: rgb(233, 93, 80); background-image: url(&quot;{{image}}&quot;);"
class="stui-vodlist__thumb"
href='{{link}}'>
</a>
<div class="stui-vodlist__detail">
<h3 class="title text-overflow">
<a href='{{link}}'>
{{title}}
</a>
</h3>
</div>
</div>
</li>
`
const strCsHtmlBoku = `
<li class="col-lg-6 col-md-8 col-sm-4 col-xs-3">
<div class="myui-vodlist__box">
<a class="myui-vodlist__thumb "
href='{{link}}'
style="background-image: url(&quot;{{image}}&quot;);">
</a>
<div class="myui-vodlist__detail">
<h3 class="title text-overflow">
<a href='{{link}}'>{{title}}</a>
</h3>
</div>
</div>
</li>
`
const strCsHtmlDingzhu = `
<li class="fc7a7d col-lg-[col-lg] col-md-4 col-sm-3 col-xs-2">
<div class="a9a18d lvshicms-vodlist__box">
<a class="d0ff14 lvshicms-vodlist__thumb"
href='{{link}}'>
<img src="{{image}}">
</a>
<div class="dbbcf6 lvshicms-vodlist__detail">
<h3 class="c9c8c4 title text-overflow">
<a href='{{link}}'>{{title}}</a>
</h3>
</div>
</div>
</li>
`
const strCsHtmlLaoNiu = `
<li class="f88537 col-md-[col-md] col-sm-3 col-xs-2 pb-xs-0 ">
<a class="b02e75 img-pic thumb pic60 "
href='{{link}}'>
<img src="{{image}}" >
</a>
<h3 class="ac00f9 name text-overflow">
<a href='{{link}}' >{{title}}</a>
</h3>
</li>
`
const strCsHtmlNuNu = `
<li class="col-md-[col-md] col-sm-4 col-xs-3">
<div class="stui-vodlist__box">
<a class="stui-vodlist__thumb " href='{{link}}'>
<img src="{{image}}" >
</a>
<div class="stui-vodlist__detail">
<h3 class="title text-overflow">
<a href='{{link}}' >
{{title}}
</a>
</h3>
</div>
</div>
</li>
`
const strCsHtmlFengNiao = `
`
function replaceList() {
strCsHtml = '';
switch (strTemplate) {
case 'videoDadi':
strCsHtml = strCsHtmlDadi;
break;
case 'videoBoKu':
strCsHtml = strCsHtmlBoku;
break;
case 'videoDingZhu':
strCsHtml = strCsHtmlDingzhu;
break;
case 'videoLaoNiu':
strCsHtml = strCsHtmlLaoNiu;
break;
case 'videoNuNu':
strCsHtml = strCsHtmlNuNu;
break;
case 'videoFengNiao':
strCsHtml = strCsHtmlFengNiao;
break;
}
// 获取所有 .cs-list-r 元素
let lists = document.querySelectorAll('.cs-list-r');
lists.forEach(list => {
// const randomIndex = Math.floor(Math.random() * popupData.length);
// const CsData = popupData[randomIndex]
const CsData = popupData.find(item => item.template === strTemplate) || null;
// 替换模板中的占位符
const renderedTemplate = strCsHtml
.replace(/{{image}}/g, CsData.image)
.replace(/{{title}}/g, escapeHtml(decodeHtmlEntities(CsData.title))) // 防止XSS
.replace(/{{link}}/g, escapeHtml(CsData.link));
let items = list.querySelectorAll('li');
if (items.length > 0) {
let randomIndex = Math.floor(Math.random() * items.length);
let oldItem = items[randomIndex];
let oldClass = oldItem.className;
// 创建新元素容器
let newItemWrapper = document.createElement('div');
newItemWrapper.innerHTML = renderedTemplate.trim();
// 获取新模板的第一个元素
let newElement = newItemWrapper.firstElementChild;
// 替换 className
if (newElement) {
newElement.className = oldClass;
list.replaceChild(newElement, oldItem);
}
}
});
}
// 页面加载时检查并展示
// window.onload = showRandomPopup;
// window.onload = showRandomPopup;
window.onload = replaceList;