This commit is contained in:
make
2025-09-05 21:34:35 +08:00
parent 331600dceb
commit 76f166ba1d
2 changed files with 53 additions and 47 deletions

View File

@@ -408,20 +408,7 @@ href='https://{$DomainModel->d_domain}{site:vpurl v_id="$arrVideo.v_id" v_py="$a
var arrPlayUrl = {$arrVideo.v_play_url|json_encode|raw} ; var arrPlayUrl = {$arrVideo.v_play_url|json_encode|raw} ;
var strPlayUrl = "" var strPlayUrl = ""
function reorderObj(obj) {
if (!obj || typeof obj !== 'object') return obj;
let newObj = {};
if (obj.hasOwnProperty('douban')) {
newObj['douban'] = obj['douban'];
}
for (let key in obj) {
if (key !== 'douban' && obj.hasOwnProperty(key)) {
newObj[key] = obj[key];
}
}
return newObj;
}
arrPlayUrl = reorderObj(arrPlayUrl);
</script> </script>
{/block} {/block}

View File

@@ -37,7 +37,7 @@ function formatVideoUrl(strPinYin, intVId) {
.replace('{intVId}', intVId); .replace('{intVId}', intVId);
} }
function formatVideoPlayUrl(strPinYin, intVId, strPlayType='defualt',intPlayIndex=1) { function formatVideoPlayUrl(strPinYin, intVId, strPlayType = 'defualt', intPlayIndex = 1) {
return strVideoPlayUrlTemp return strVideoPlayUrlTemp
.replace('{strPinYin}', encodeURIComponent(strPinYin)) .replace('{strPinYin}', encodeURIComponent(strPinYin))
.replace('{intVId}', intVId) .replace('{intVId}', intVId)
@@ -46,7 +46,7 @@ function formatVideoPlayUrl(strPinYin, intVId, strPlayType='defualt',intPlayInde
} }
function formatSearchUrl(strKey,intPage=1) { function formatSearchUrl(strKey, intPage = 1) {
return strSearchUrlTemp return strSearchUrlTemp
.replace('{strSearchKeywords}', strKey) .replace('{strSearchKeywords}', strKey)
.replace('{intPage}', intPage); .replace('{intPage}', intPage);
@@ -172,10 +172,10 @@ function handleRedirect() {
if (!isInPcPathArray) { if (!isInPcPathArray) {
const newPath = strCurrentPath === '/' ? `/` : `${strCurrentPath}`; const newPath = strCurrentPath === '/' ? `/` : `${strCurrentPath}`;
window.location.href = buildUrl(newPath); window.location.href = buildUrl(newPath);
}else{ } else {
// 如果包含,则先判断是不是当前模板的 url如果不是 则替换成当前模板的 url // 如果包含,则先判断是不是当前模板的 url如果不是 则替换成当前模板的 url
if (firstSegment != strPcPath.replace('/', '')) { if (firstSegment != strPcPath.replace('/', '')) {
strCurrentPath = strCurrentPath.replace(firstSegment,strPcPath.replace('/', '')) ; strCurrentPath = strCurrentPath.replace(firstSegment, strPcPath.replace('/', ''));
window.location.href = buildUrl(strCurrentPath); window.location.href = buildUrl(strCurrentPath);
} }
} }
@@ -193,18 +193,18 @@ function layerPopup(strContent, intTime) {
} }
// 添加收藏 // 添加收藏
function incShouCangFun(intId){ function incShouCangFun(intId) {
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.open('GET', "/sc?intId="+intId, true); xhr.open('GET', "/sc?intId=" + intId, true);
xhr.setRequestHeader('accept', 'application/x.hubserver.admin+json'); xhr.setRequestHeader('accept', 'application/x.hubserver.admin+json');
xhr.send(); xhr.send();
xhr.onreadystatechange = function () { xhr.onreadystatechange = function () {
if (xhr.readyState == 4 && xhr.status == 200) { if (xhr.readyState == 4 && xhr.status == 200) {
layerPopup('收藏成功',3) layerPopup('收藏成功', 3)
} }
if (xhr.readyState == 4 && xhr.status == 0) { if (xhr.readyState == 4 && xhr.status == 0) {
layerPopup('操作太频繁,稍后再试',3) layerPopup('操作太频繁,稍后再试', 3)
} }
} }
} }
@@ -429,7 +429,7 @@ function escapeHtml(str) {
async function reportStats(data) { async function reportStats(data) {
try { try {
const response = await fetch(strPushApi+'/publishv', { const response = await fetch(strPushApi + '/publishv', {
method: 'POST', method: 'POST',
// mode: 'no-cors', // 添加这行 // mode: 'no-cors', // 添加这行
headers: { headers: {
@@ -485,10 +485,10 @@ function initDPlayer(strPlayUrl) {
videoPlayer.on('fullscreen_cancel', function () { videoPlayer.on('fullscreen_cancel', function () {
DomDPlayer.classList.remove("dp-fullscreen"); DomDPlayer.classList.remove("dp-fullscreen");
// 恢复 max-height 为 480px // 恢复 max-height 为 480px
if(isMobile()){ if (isMobile()) {
document.querySelector("video").style.maxHeight = "218px"; document.querySelector("video").style.maxHeight = "218px";
document.querySelector(".video-play-page .dplayer-video-wrap").style.maxHeight = "218px"; document.querySelector(".video-play-page .dplayer-video-wrap").style.maxHeight = "218px";
}else{ } else {
document.querySelector("video").style.maxHeight = strMaxPlayHeight ?? '480px'; document.querySelector("video").style.maxHeight = strMaxPlayHeight ?? '480px';
document.querySelector(".video-play-page .dplayer-video-wrap").style.maxHeight = strMaxPlayHeight ?? '480px'; document.querySelector(".video-play-page .dplayer-video-wrap").style.maxHeight = strMaxPlayHeight ?? '480px';
} }
@@ -533,7 +533,7 @@ function initDPlayer(strPlayUrl) {
if (videoPlayer.video.currentTime >= 6046 && videoPlayer.video.currentTime < 6067) { //19秒 if (videoPlayer.video.currentTime >= 6046 && videoPlayer.video.currentTime < 6067) { //19秒
videoPlayer.seek(6068); // 跳过到 494 秒 videoPlayer.seek(6068); // 跳过到 494 秒
} }
}else if (strPlayType == 'fengchao') { } else if (strPlayType == 'fengchao') {
// if (videoPlayer.video.currentTime >= 476 && videoPlayer.video.currentTime < 494) { //18秒 // if (videoPlayer.video.currentTime >= 476 && videoPlayer.video.currentTime < 494) { //18秒
// videoPlayer.seek(495); // 跳过到 494 秒 // videoPlayer.seek(495); // 跳过到 494 秒
// } // }
@@ -549,7 +549,7 @@ function initDPlayer(strPlayUrl) {
// if (videoPlayer.video.currentTime >= 6046 && videoPlayer.video.currentTime < 6067) { //19秒 // if (videoPlayer.video.currentTime >= 6046 && videoPlayer.video.currentTime < 6067) { //19秒
// videoPlayer.seek(6068); // 跳过到 494 秒 // videoPlayer.seek(6068); // 跳过到 494 秒
// } // }
}else if (strPlayType == 'wuxian') { } else if (strPlayType == 'wuxian') {
// if (videoPlayer.video.currentTime >= 476 && videoPlayer.video.currentTime < 494) { //18秒 // if (videoPlayer.video.currentTime >= 476 && videoPlayer.video.currentTime < 494) { //18秒
// videoPlayer.seek(495); // 跳过到 494 秒 // videoPlayer.seek(495); // 跳过到 494 秒
// } // }
@@ -591,7 +591,7 @@ function findFirstUrl(obj) {
} }
// 切换播放线路 // 切换播放线路
function checkLine(val){ function checkLine(val) {
// 构造 ID去掉 # 前缀) // 构造 ID去掉 # 前缀)
let strLineHeadId = `line_head_${val}`; let strLineHeadId = `line_head_${val}`;
let strLineListId = `playlist_${val}`; let strLineListId = `playlist_${val}`;
@@ -622,10 +622,29 @@ function checkLine(val){
}); });
} }
function reorderObj(obj) {
if (!obj || typeof obj !== 'object') return obj;
let newObj = {};
if (obj.hasOwnProperty('douban')) {
newObj['douban'] = obj['douban'];
}
for (let key in obj) {
if (key !== 'douban' && obj.hasOwnProperty(key)) {
newObj[key] = obj[key];
}
}
return newObj;
}
document.addEventListener("DOMContentLoaded", function () { document.addEventListener("DOMContentLoaded", function () {
if (typeof strVideoId !== "undefined") { if (typeof strVideoId !== "undefined") {
if (arrPlayUrl) {
arrPlayUrl = reorderObj(arrPlayUrl);
}
// 使用示例 // 使用示例
const statsData = { const statsData = {
v_id: strVideoId, v_id: strVideoId,
@@ -634,7 +653,7 @@ document.addEventListener("DOMContentLoaded", function () {
// 调用方法1 // 调用方法1
reportStats(statsData); reportStats(statsData);
if (typeof strPlayType !== "undefined"){ if (typeof strPlayType !== "undefined") {
if (strPlayType == 'default') { if (strPlayType == 'default') {
strPlayUrl = findFirstUrl(arrPlayUrl) strPlayUrl = findFirstUrl(arrPlayUrl)
checkLine('douban'); checkLine('douban');