debug
This commit is contained in:
@@ -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 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>
|
||||
{/block}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ function formatVideoUrl(strPinYin, intVId) {
|
||||
.replace('{intVId}', intVId);
|
||||
}
|
||||
|
||||
function formatVideoPlayUrl(strPinYin, intVId, strPlayType='defualt',intPlayIndex=1) {
|
||||
function formatVideoPlayUrl(strPinYin, intVId, strPlayType = 'defualt', intPlayIndex = 1) {
|
||||
return strVideoPlayUrlTemp
|
||||
.replace('{strPinYin}', encodeURIComponent(strPinYin))
|
||||
.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
|
||||
.replace('{strSearchKeywords}', strKey)
|
||||
.replace('{intPage}', intPage);
|
||||
@@ -172,10 +172,10 @@ function handleRedirect() {
|
||||
if (!isInPcPathArray) {
|
||||
const newPath = strCurrentPath === '/' ? `/` : `${strCurrentPath}`;
|
||||
window.location.href = buildUrl(newPath);
|
||||
}else{
|
||||
} else {
|
||||
// 如果包含,则先判断是不是当前模板的 url,如果不是 则替换成当前模板的 url
|
||||
if (firstSegment != strPcPath.replace('/', '')) {
|
||||
strCurrentPath = strCurrentPath.replace(firstSegment,strPcPath.replace('/', '')) ;
|
||||
strCurrentPath = strCurrentPath.replace(firstSegment, strPcPath.replace('/', ''));
|
||||
window.location.href = buildUrl(strCurrentPath);
|
||||
}
|
||||
}
|
||||
@@ -193,18 +193,18 @@ function layerPopup(strContent, intTime) {
|
||||
}
|
||||
|
||||
// 添加收藏
|
||||
function incShouCangFun(intId){
|
||||
function incShouCangFun(intId) {
|
||||
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.send();
|
||||
xhr.onreadystatechange = function () {
|
||||
|
||||
if (xhr.readyState == 4 && xhr.status == 200) {
|
||||
layerPopup('收藏成功',3)
|
||||
layerPopup('收藏成功', 3)
|
||||
}
|
||||
if (xhr.readyState == 4 && xhr.status == 0) {
|
||||
layerPopup('操作太频繁,稍后再试',3)
|
||||
layerPopup('操作太频繁,稍后再试', 3)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -429,7 +429,7 @@ function escapeHtml(str) {
|
||||
async function reportStats(data) {
|
||||
|
||||
try {
|
||||
const response = await fetch(strPushApi+'/publishv', {
|
||||
const response = await fetch(strPushApi + '/publishv', {
|
||||
method: 'POST',
|
||||
// mode: 'no-cors', // 添加这行
|
||||
headers: {
|
||||
@@ -485,10 +485,10 @@ function initDPlayer(strPlayUrl) {
|
||||
videoPlayer.on('fullscreen_cancel', function () {
|
||||
DomDPlayer.classList.remove("dp-fullscreen");
|
||||
// 恢复 max-height 为 480px
|
||||
if(isMobile()){
|
||||
if (isMobile()) {
|
||||
document.querySelector("video").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-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秒
|
||||
videoPlayer.seek(6068); // 跳过到 494 秒
|
||||
}
|
||||
}else if (strPlayType == 'fengchao') {
|
||||
} else if (strPlayType == 'fengchao') {
|
||||
// if (videoPlayer.video.currentTime >= 476 && videoPlayer.video.currentTime < 494) { //18秒
|
||||
// videoPlayer.seek(495); // 跳过到 494 秒
|
||||
// }
|
||||
@@ -549,7 +549,7 @@ function initDPlayer(strPlayUrl) {
|
||||
// if (videoPlayer.video.currentTime >= 6046 && videoPlayer.video.currentTime < 6067) { //19秒
|
||||
// videoPlayer.seek(6068); // 跳过到 494 秒
|
||||
// }
|
||||
}else if (strPlayType == 'wuxian') {
|
||||
} else if (strPlayType == 'wuxian') {
|
||||
// if (videoPlayer.video.currentTime >= 476 && videoPlayer.video.currentTime < 494) { //18秒
|
||||
// videoPlayer.seek(495); // 跳过到 494 秒
|
||||
// }
|
||||
@@ -591,7 +591,7 @@ function findFirstUrl(obj) {
|
||||
}
|
||||
|
||||
// 切换播放线路
|
||||
function checkLine(val){
|
||||
function checkLine(val) {
|
||||
// 构造 ID(去掉 # 前缀)
|
||||
let strLineHeadId = `line_head_${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 () {
|
||||
|
||||
|
||||
if (typeof strVideoId !== "undefined") {
|
||||
|
||||
if (arrPlayUrl) {
|
||||
arrPlayUrl = reorderObj(arrPlayUrl);
|
||||
}
|
||||
|
||||
// 使用示例
|
||||
const statsData = {
|
||||
v_id: strVideoId,
|
||||
@@ -634,7 +653,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
// 调用方法1
|
||||
reportStats(statsData);
|
||||
|
||||
if (typeof strPlayType !== "undefined"){
|
||||
if (typeof strPlayType !== "undefined") {
|
||||
if (strPlayType == 'default') {
|
||||
strPlayUrl = findFirstUrl(arrPlayUrl)
|
||||
checkLine('douban');
|
||||
|
||||
Reference in New Issue
Block a user