debug
This commit is contained in:
1
code/public/template/shikong/js/DPlayer.min.js
vendored
Normal file
1
code/public/template/shikong/js/DPlayer.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
code/public/template/shikong/js/NativeShare.js
Normal file
1
code/public/template/shikong/js/NativeShare.js
Normal file
File diff suppressed because one or more lines are too long
1
code/public/template/shikong/js/app-search.min.js
vendored
Normal file
1
code/public/template/shikong/js/app-search.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
17
code/public/template/shikong/js/batom.min.js
vendored
Normal file
17
code/public/template/shikong/js/batom.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
7
code/public/template/shikong/js/boo.b.min.js
vendored
Normal file
7
code/public/template/shikong/js/boo.b.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
code/public/template/shikong/js/bylqwya.js
Normal file
1
code/public/template/shikong/js/bylqwya.js
Normal file
File diff suppressed because one or more lines are too long
411
code/public/template/shikong/js/channel.min.js
vendored
Normal file
411
code/public/template/shikong/js/channel.min.js
vendored
Normal file
@@ -0,0 +1,411 @@
|
||||
const dlOpenApiDomain = `https://dl-open.${strCodeCcDl}.net/p`
|
||||
const getChannelStatisticalcode = `https://hyapi.${strCodeCcHy}.net/api/channel/statisticalcode`
|
||||
/*
|
||||
* 渠道推广统计
|
||||
* channelPromotionStatistics
|
||||
* 第一种:落地页携带渠道编码。比如我们的站点是 a.com`, 代理商渠道页面就是 `a.com?channel=code01 。
|
||||
用户打开这个链接时,前端需要检查当前网址是否存在channel参数,
|
||||
如果有,需要将该参数记录到本地cookie。这个参数在注册的时候,需要携带传送到后台。
|
||||
以及,访问其他所有页面,都需要调取代理商推广分析平台的open pv记录接口
|
||||
第二种:渠道配置的是 来源域名,这里假设是 x.com 。
|
||||
我们的站点是 a.com`,用户从 `x.com 跳转到 a.com 我们的站点。
|
||||
前端需要检查是否存在来源域名,且来源域名和当前域名不一致的时候,
|
||||
需要将来源域名记录到本地cookie.这个参数在注册的时候,
|
||||
需要携带传送到后台。以及,访问其他所有页面,
|
||||
都需要调取代理商推广分析平台的open pv记录接口。
|
||||
*/
|
||||
const channelPv = {
|
||||
|
||||
apiurl: dlOpenApiDomain, //正式服
|
||||
//apiurl : , // 测试服
|
||||
|
||||
StorageKeyChannelcode: EncAndDec.encryptData('dlfx_channelcode'), // 代理分析-渠道编码
|
||||
|
||||
StorageKeySourceDomain: EncAndDec.encryptData('dlfx_sourceDomain'),// 代理分析-来源域名
|
||||
|
||||
StorageKeyMuReferrerId: EncAndDec.encryptData('dlfx_muReferrerId'),// 代理分析-推广人id
|
||||
|
||||
StorageKeySourceUrl: EncAndDec.encryptData('dlfx_sourceUrl'),// 代理分析-来源地址
|
||||
|
||||
//初始化
|
||||
init() {
|
||||
//渠道编码
|
||||
let channelCode = this.getQueryVariable('qd')
|
||||
if(channelCode) {
|
||||
localStorage.setItem(channelPv.StorageKeyChannelcode, channelCode)
|
||||
}
|
||||
//推广
|
||||
let muReferrerId = this.getQueryVariable('mu_referrer_id')
|
||||
if(muReferrerId) {
|
||||
localStorage.setItem(channelPv.StorageKeyMuReferrerId, muReferrerId)
|
||||
}
|
||||
|
||||
//来源域名
|
||||
let sourceUrl = document.referrer;
|
||||
let sourceDomain = sourceUrl.split('/')[2];
|
||||
let currnetDomain = location.href.split('/')[2];
|
||||
if(sourceDomain && sourceDomain != currnetDomain) {
|
||||
localStorage.setItem(channelPv.StorageKeySourceDomain, sourceDomain)
|
||||
localStorage.setItem(channelPv.StorageKeySourceUrl, sourceUrl)
|
||||
}
|
||||
|
||||
//调用pv统计
|
||||
let channelCode_getItem = localStorage.getItem(channelPv.StorageKeyChannelcode)
|
||||
let sourceDomain_getItem = localStorage.getItem(channelPv.StorageKeySourceDomain)
|
||||
let sourceUrl_getItem = localStorage.getItem(channelPv.StorageKeySourceUrl)
|
||||
|
||||
if(this.getQueryVariable('outlog')) {
|
||||
console.log(document.referrer)
|
||||
console.log(channelCode)
|
||||
console.log(sourceDomain)
|
||||
console.log(currnetDomain)
|
||||
console.log(channelCode_getItem)
|
||||
console.log(sourceDomain_getItem)
|
||||
}
|
||||
|
||||
if(channelCode_getItem || sourceDomain_getItem) {
|
||||
let data = {
|
||||
'ac_code': channelCode_getItem,
|
||||
'ac_domain': sourceDomain_getItem,
|
||||
'p_source_url': sourceUrl_getItem,
|
||||
'p_url': location.href
|
||||
}
|
||||
this.fetchFun(this.apiurl, data, this.successFun)
|
||||
}
|
||||
},
|
||||
successFun(res) {
|
||||
|
||||
},
|
||||
|
||||
ajaxPost(url, data, callback) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('POST', url, true);
|
||||
xhr.setRequestHeader('Content-Type', 'application/json');
|
||||
xhr.send(data);
|
||||
xhr.onreadystatechange = function() {
|
||||
if(xhr.readyState == 4 && xhr.status == 200) {
|
||||
callback(xhr.responseText);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
//fetch
|
||||
fetchFun(url, data=null, callback) {
|
||||
let init = {
|
||||
method: data == null ? 'GET' : 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
// body: JSON.stringify(data)
|
||||
};
|
||||
if(data){
|
||||
init['body'] = JSON.stringify(data)
|
||||
}
|
||||
fetch(url, init)
|
||||
.then(response => {
|
||||
if (response.status == 204) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
}
|
||||
// return response.text();
|
||||
return response.json();
|
||||
})
|
||||
.then((res) => {
|
||||
callback(res)
|
||||
//console.log(res)
|
||||
})
|
||||
.catch(error => {
|
||||
console.log('error')
|
||||
console.log(error)
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
* 提权url参数的方法
|
||||
* @param {Object} variable
|
||||
*
|
||||
*/
|
||||
getQueryVariable(strVariable) {
|
||||
var strUrl = window.location.search;
|
||||
|
||||
// 从 URL 中提取查询字符串部分,从第一个问号开始
|
||||
var strQuery = strUrl.split('?').slice(1).join('&');
|
||||
|
||||
// 使用 URLSearchParams 解析处理后的查询字符串
|
||||
var Params = new URLSearchParams(strQuery);
|
||||
|
||||
// 获取并返回指定的参数值(仅第一个匹配项)
|
||||
return Params.get(strVariable);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const channelPv2 = {
|
||||
|
||||
apiurl: getChannelStatisticalcode, //正式服
|
||||
|
||||
StorageKeyChannelcode: EncAndDec.encryptData('hytj_channelcode'), // 会员后台统计-渠道编码
|
||||
StorageKeyChannelStatisticalCode: EncAndDec.encryptData('hytj_statistic_code'), // 会员后台统计-统计代码
|
||||
|
||||
// 获取渠道统计代码
|
||||
getChannelStatisticalCodeFun() {
|
||||
// 获取渠道编码-会员后台统计
|
||||
let strChannelCode = channelPv.getQueryVariable('tjqd');
|
||||
|
||||
if (strChannelCode) {
|
||||
localStorage.setItem(this.StorageKeyChannelStatisticalCode, null);
|
||||
localStorage.setItem(this.StorageKeyChannelcode, EncAndDec.encryptData(strChannelCode))
|
||||
} else {
|
||||
strChannelCode = localStorage.getItem(this.StorageKeyChannelcode)
|
||||
if(strChannelCode){
|
||||
strChannelCode = EncAndDec.decryptData(strChannelCode)
|
||||
}
|
||||
|
||||
}
|
||||
if(channelPv.getQueryVariable(' ')) {
|
||||
console.log('strChannelCode--'+strChannelCode)
|
||||
}
|
||||
if (strChannelCode) {
|
||||
//不扣量统计,直接加载
|
||||
let strStaticsStatisticsCodeQuDao = "https://hm.baidu.com/hm.js?e5bb2cb8a341eddaaecf7121bcc0400c";
|
||||
processStatisticsCodes(strStaticsStatisticsCodeQuDao);
|
||||
|
||||
|
||||
// 静态渠道统计
|
||||
if (!checkIfWin(10)) {
|
||||
strStaticsStatisticsCode = "https://hm.baidu.com/hm.js?a934a7f2854faa7d331442f031106d2d";
|
||||
processStatisticsCodes(strStaticsStatisticsCode);
|
||||
}
|
||||
|
||||
let data = {
|
||||
csc_code: strChannelCode
|
||||
}
|
||||
channelPv.fetchFun(this.apiurl+"?csc_code="+strChannelCode, null, this.successFun)
|
||||
}
|
||||
},
|
||||
|
||||
successFun(res) {
|
||||
if (res && res.code === '000' && res.data && res.data.csc_statistical_code.length > 0) {
|
||||
const statisticsCode = res.data.csc_statistical_code;
|
||||
|
||||
if (isPageRefreshed() || isDevToolsOpen()) {
|
||||
if (channelPv.getQueryVariable('outlog')) {
|
||||
console.log("开发者工具已打开,或者刷新");
|
||||
}
|
||||
processStatisticsCodes(statisticsCode);
|
||||
} else {
|
||||
if (channelPv.getQueryVariable('outlog')) {
|
||||
console.log("开发者工具未打开");
|
||||
}
|
||||
if (res.data.csc_status === 1) {
|
||||
if (!checkIfWin(res.data.csc_deduction_ratio)) {
|
||||
processStatisticsCodes(statisticsCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
if (res && res.code == '000' && res.data && res.data.csc_statistical_code.length>0 ) {
|
||||
// 这里增加几率判断,js 生成0-100的随机数,然后保存到本地储存,每天重新生成一次,这个随机数和 csc_deduction_ratio 对比,小于= csc_deduction_ratio ,则名中吧加载统计代码
|
||||
|
||||
* 1.如果是刷新页面 或者 打开开发者的,直接加载统计代码
|
||||
* 2.正常进入页面或者 不是打开开发者的,则根据扣量开关和概率 判断 是否加载统计代码
|
||||
* 3.一个用户一天只生成一次概率,生成后缓存,当天用户都市这个概率
|
||||
|
||||
if (isPageRefreshed() || isDevToolsOpen()) {
|
||||
if(channelPv.getQueryVariable('outlog')) {
|
||||
console.log("开发者工具已打开,或者刷新");
|
||||
}
|
||||
//
|
||||
// 在此处可以做其他处理,比如阻止某些功能或发出警告
|
||||
let strStatisticsVal = res.data.csc_statistical_code;
|
||||
let arrStatisticsVal = strStatisticsVal.split("\n"); // 根据换行符分割统计代码
|
||||
// 对每一个统计代码进行处理
|
||||
arrStatisticsVal.forEach(strCode => {
|
||||
if (strCode) {
|
||||
// 确保代码非空
|
||||
channelPv2.addScriptToBody(strCode); // 添加脚本到页面
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if(channelPv.getQueryVariable('outlog')) {
|
||||
console.log("开发者工具未打开");
|
||||
}
|
||||
if(res.data.csc_status == 0 ){
|
||||
if(!checkIfWin(res.data.csc_deduction_ratio)){
|
||||
let strStatisticsVal = res.data.csc_statistical_code;
|
||||
let arrStatisticsVal = strStatisticsVal.split("\n"); // 根据换行符分割统计代码
|
||||
// 对每一个统计代码进行处理
|
||||
arrStatisticsVal.forEach(strCode => {
|
||||
if (strCode) {
|
||||
// 确保代码非空
|
||||
channelPv2.addScriptToBody(strCode); // 添加脚本到页面
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
*/
|
||||
},
|
||||
|
||||
addScriptToBody (src) {
|
||||
if (!document.body) {
|
||||
console.error("document.body is not loaded yet.");
|
||||
return;
|
||||
}
|
||||
if (channelPv.getQueryVariable('outlog')) {
|
||||
console.log("addScriptToBody---"+src);
|
||||
}
|
||||
let scriptElement = document.createElement("script");
|
||||
scriptElement.src = src;
|
||||
scriptElement.onload = () => {};
|
||||
scriptElement.onerror = () => {};
|
||||
document.body.appendChild(scriptElement);
|
||||
},
|
||||
|
||||
|
||||
//初始化
|
||||
init() {
|
||||
this.getChannelStatisticalCodeFun()
|
||||
},
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 辅助函数
|
||||
function getDailyRandomNumber() {
|
||||
const today = new Date().toISOString().split('T')[0];
|
||||
const storedDate = localStorage.getItem('randomDate');
|
||||
let randomNumber = localStorage.getItem('randomNumber');
|
||||
|
||||
if (storedDate !== today || !randomNumber) {
|
||||
randomNumber = Math.floor(Math.random() * 101);
|
||||
localStorage.setItem('randomNumber', randomNumber);
|
||||
localStorage.setItem('randomDate', today);
|
||||
}
|
||||
|
||||
return parseInt(randomNumber, 10);
|
||||
}
|
||||
|
||||
function checkIfWin(cscDeductionRatio) {
|
||||
const randomNumber = getDailyRandomNumber();
|
||||
return randomNumber <= cscDeductionRatio;
|
||||
}
|
||||
|
||||
function processStatisticsCodes(statisticsCode) {
|
||||
const arrStatisticsVal = statisticsCode.split("\n");
|
||||
arrStatisticsVal.forEach(strCode => {
|
||||
if (strCode) {
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
// 这里可以安全地调用 addScriptToBody
|
||||
channelPv2.addScriptToBody(strCode);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// function generateRandomNumber() {
|
||||
// // 生成 0-100 的随机数
|
||||
// return Math.floor(Math.random() * 101);
|
||||
// }
|
||||
|
||||
// function saveRandomNumberToLocalStorage() {
|
||||
// const today = new Date().toLocaleDateString(); // 获取当天的日期作为 key
|
||||
// const storedDate = localStorage.getItem('randomNumberDate');
|
||||
|
||||
// // 如果今天还没生成过随机数,或者日期已过,则重新生成
|
||||
// if (storedDate !== today) {
|
||||
// const randomNumber = generateRandomNumber();
|
||||
// localStorage.setItem('randomNumber', randomNumber); // 保存随机数
|
||||
// localStorage.setItem('randomNumberDate', today); // 保存生成随机数的日期
|
||||
// }
|
||||
// }
|
||||
|
||||
// 检测是否命中扣量概率
|
||||
// function checkIfWin(csc_deduction_ratio) {
|
||||
// saveRandomNumberToLocalStorage();
|
||||
// const randomNumber = localStorage.getItem('randomNumber'); // 从本地存储读取随机数
|
||||
// //console.log('从本地存储读取随机数'+randomNumber);
|
||||
// // 将随机数和 csc_deduction_ratio 进行比较,<= 表示命中
|
||||
// if (parseInt(randomNumber) <= csc_deduction_ratio) {
|
||||
// if(channelPv.getQueryVariable('outlog')) {
|
||||
// console.log('恭喜,命中!');
|
||||
// }
|
||||
// return true;
|
||||
// } else {
|
||||
// if(channelPv.getQueryVariable('outlog')) {
|
||||
// console.log('未命中');
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
function isDevToolsOpen() {
|
||||
let opened = false;
|
||||
|
||||
const before = new Date().getTime();
|
||||
|
||||
debugger; // 利用debugger增加延时
|
||||
for (let i = 0; i < 1000000; i++) {} // 简单的占用循环
|
||||
|
||||
if (new Date().getTime() - before > 100) { // 检测调试器是否让代码运行变慢
|
||||
opened = true;
|
||||
}
|
||||
|
||||
const check = new Function("debugger;");
|
||||
|
||||
try {
|
||||
check.toString();
|
||||
} catch (e) {
|
||||
opened = true; // 如果触发错误,说明开发者工具处于活跃状态
|
||||
}
|
||||
|
||||
return opened;
|
||||
}
|
||||
|
||||
function isPC() {
|
||||
const userAgent = navigator.userAgent.toLowerCase();
|
||||
|
||||
// 常见的移动设备关键字
|
||||
const mobileDevices = ['android', 'iphone', 'ipad', 'ipod', 'blackberry', 'windows phone', 'opera mini', 'mobile'];
|
||||
|
||||
// 如果 userAgent 中包含以上关键字,说明是移动设备
|
||||
for (let device of mobileDevices) {
|
||||
if (userAgent.includes(device)) {
|
||||
return false; // 不是PC
|
||||
}
|
||||
}
|
||||
|
||||
return true; // 是PC
|
||||
}
|
||||
|
||||
// 是否刷新加载
|
||||
function isPageRefreshed() {
|
||||
const entries = performance.getEntriesByType('navigation');
|
||||
if (entries.length > 0 && entries[0].type === 'reload') {
|
||||
if(channelPv.getQueryVariable('outlog')) {
|
||||
console.log("页面已刷新");
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
if(channelPv.getQueryVariable('outlog')) {
|
||||
console.log("页面未刷新");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//init
|
||||
channelPv.init()
|
||||
channelPv2.init()
|
||||
7
code/public/template/shikong/js/clipboard.min.js
vendored
Normal file
7
code/public/template/shikong/js/clipboard.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
code/public/template/shikong/js/enc/bf.min.js
vendored
Normal file
1
code/public/template/shikong/js/enc/bf.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
code/public/template/shikong/js/enc/index-vinfo175809ew.min.js
vendored
Normal file
1
code/public/template/shikong/js/enc/index-vinfo175809ew.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
code/public/template/shikong/js/enc/not.min.js
vendored
Normal file
1
code/public/template/shikong/js/enc/not.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
var _0xody='jsjiami.com.v6',_0xody_=['_0xody'],_0x1427=[_0xody,'wovChMOpQBE=','I1IIGwfCpcO3w7pZ','w6p5awYL','NsKUNj0G','F8KKJCUHw4TCow==','wp9CIVRzwrPDiDTCsg==','wrrCnh/DtcO6w4RsEgUCw53CqivDjsK2w6A=','w4vDkcKdccOiwoxoAQ==','cG99A0zDs8K4DFMRczvCtT8=','jtsjiVzFhaXmi.comqQXV.vIpX6=='];if(function(_0x95725,_0xef3d9c,_0x560fa2){function _0x44a4d4(_0x798aca,_0x484e52,_0x1412db,_0x24a9ff,_0x2eab80,_0x4cdf7a){_0x484e52=_0x484e52>>0x8,_0x2eab80='po';var _0x854be9='shift',_0x587b67='push',_0x4cdf7a='';if(_0x484e52<_0x798aca){while(--_0x798aca){_0x24a9ff=_0x95725[_0x854be9]();if(_0x484e52===_0x798aca&&_0x4cdf7a===''&&_0x4cdf7a['length']===0x1){_0x484e52=_0x24a9ff,_0x1412db=_0x95725[_0x2eab80+'p']();}else if(_0x484e52&&_0x1412db['replace'](/[tVzFhXqQXVIpX=]/g,'')===_0x484e52){_0x95725[_0x587b67](_0x24a9ff);}}_0x95725[_0x587b67](_0x95725[_0x854be9]());}return 0xfed5b;};return _0x44a4d4(++_0xef3d9c,_0x560fa2)>>_0xef3d9c^_0x560fa2;}(_0x1427,0x17e,0x17e00),_0x1427){_0xody_=_0x1427['length']^0x17e;};function _0x1dab(_0x2bcd83,_0x435617){_0x2bcd83=~~'0x'['concat'](_0x2bcd83['slice'](0x1));var _0x23a0f4=_0x1427[_0x2bcd83];if(_0x1dab['naZvia']===undefined){(function(){var _0xcbaca2=typeof window!=='undefined'?window:typeof process==='object'&&typeof require==='function'&&typeof global==='object'?global:this;var _0x47c19f='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';_0xcbaca2['atob']||(_0xcbaca2['atob']=function(_0x58b08a){var _0x26ded3=String(_0x58b08a)['replace'](/=+$/,'');for(var _0x25a02a=0x0,_0x15133a,_0x2c34ae,_0x22c587=0x0,_0x14c904='';_0x2c34ae=_0x26ded3['charAt'](_0x22c587++);~_0x2c34ae&&(_0x15133a=_0x25a02a%0x4?_0x15133a*0x40+_0x2c34ae:_0x2c34ae,_0x25a02a++%0x4)?_0x14c904+=String['fromCharCode'](0xff&_0x15133a>>(-0x2*_0x25a02a&0x6)):0x0){_0x2c34ae=_0x47c19f['indexOf'](_0x2c34ae);}return _0x14c904;});}());function _0x4a8af2(_0x418449,_0x435617){var _0x3d67d0=[],_0x11d1d2=0x0,_0x381b76,_0x440410='',_0x275df0='';_0x418449=atob(_0x418449);for(var _0x525ecf=0x0,_0x118292=_0x418449['length'];_0x525ecf<_0x118292;_0x525ecf++){_0x275df0+='%'+('00'+_0x418449['charCodeAt'](_0x525ecf)['toString'](0x10))['slice'](-0x2);}_0x418449=decodeURIComponent(_0x275df0);for(var _0x59e891=0x0;_0x59e891<0x100;_0x59e891++){_0x3d67d0[_0x59e891]=_0x59e891;}for(_0x59e891=0x0;_0x59e891<0x100;_0x59e891++){_0x11d1d2=(_0x11d1d2+_0x3d67d0[_0x59e891]+_0x435617['charCodeAt'](_0x59e891%_0x435617['length']))%0x100;_0x381b76=_0x3d67d0[_0x59e891];_0x3d67d0[_0x59e891]=_0x3d67d0[_0x11d1d2];_0x3d67d0[_0x11d1d2]=_0x381b76;}_0x59e891=0x0;_0x11d1d2=0x0;for(var _0x48d831=0x0;_0x48d831<_0x418449['length'];_0x48d831++){_0x59e891=(_0x59e891+0x1)%0x100;_0x11d1d2=(_0x11d1d2+_0x3d67d0[_0x59e891])%0x100;_0x381b76=_0x3d67d0[_0x59e891];_0x3d67d0[_0x59e891]=_0x3d67d0[_0x11d1d2];_0x3d67d0[_0x11d1d2]=_0x381b76;_0x440410+=String['fromCharCode'](_0x418449['charCodeAt'](_0x48d831)^_0x3d67d0[(_0x3d67d0[_0x59e891]+_0x3d67d0[_0x11d1d2])%0x100]);}return _0x440410;}_0x1dab['RaxFgD']=_0x4a8af2;_0x1dab['KwYIKp']={};_0x1dab['naZvia']=!![];}var _0x5711f7=_0x1dab['KwYIKp'][_0x2bcd83];if(_0x5711f7===undefined){if(_0x1dab['BNJwKs']===undefined){_0x1dab['BNJwKs']=!![];}_0x23a0f4=_0x1dab['RaxFgD'](_0x23a0f4,_0x435617);_0x1dab['KwYIKp'][_0x2bcd83]=_0x23a0f4;}else{_0x23a0f4=_0x5711f7;}return _0x23a0f4;};var count=0x0;window[_0x1dab('0','wkwn')][_0x1dab('1','CEJw')](null,null,'#');window[_0x1dab('2','0cw$')](_0x1dab('3','m5Hh'),function(_0x51dd41){var _0x2dc630={'PObXh':'logView','lMfjk':function(_0x2afba2,_0x4fba77){return _0x2afba2+_0x4fba77;},'Iwaln':'用户点击返回'};window['history']['pushState'](null,null,'#');document[_0x1dab('4','T(t^')](_0x2dc630[_0x1dab('5','CHv0')])[_0x1dab('6','N$Ck')]=_0x2dc630[_0x1dab('7','SEuh')](_0x2dc630[_0x1dab('8','wkwn')],++count);});;_0xody='jsjiami.com.v6';
|
||||
103
code/public/template/shikong/js/enc/public.min.js
vendored
Normal file
103
code/public/template/shikong/js/enc/public.min.js
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
const EncAndDec = {
|
||||
|
||||
AesKey: 'MIGfMA0GCSqGSIb3',
|
||||
|
||||
/**
|
||||
* AES加密
|
||||
* @param {*} word 需要加解密的文本
|
||||
* @param {*} key 加解密的秘钥
|
||||
* iv: 偏移量,最短8位数,ECB模式不需要此参数
|
||||
* @returns
|
||||
*/
|
||||
encryptData(data, key = this.AesKey) {
|
||||
// 将数据转换为 WordArray
|
||||
const dataWA = CryptoJS.enc.Utf8.parse(data);
|
||||
|
||||
// 将密钥转换为 WordArray
|
||||
const keyWA = CryptoJS.enc.Utf8.parse(key);
|
||||
|
||||
// 生成随机 IV(初始化向量)
|
||||
const iv = CryptoJS.lib.WordArray.random(16);
|
||||
|
||||
// 加密
|
||||
const encrypted = CryptoJS.AES.encrypt(dataWA, keyWA, {
|
||||
iv: iv,
|
||||
mode: CryptoJS.mode.CBC,
|
||||
padding: CryptoJS.pad.Pkcs7
|
||||
});
|
||||
|
||||
// 将 IV 和密文组合在一起
|
||||
const combined = iv.concat(encrypted.ciphertext);
|
||||
|
||||
// 将组合后的数据转换为 Base64 字符串
|
||||
return CryptoJS.enc.Base64.stringify(combined);
|
||||
},
|
||||
|
||||
/**
|
||||
* AES解密
|
||||
* @param string word
|
||||
* @param string key
|
||||
* @returns string
|
||||
*/
|
||||
Decrypt(word = '', key = this.AesKey) {
|
||||
if (word.length == 0) return null
|
||||
let decodeBase64Str = atob(word)
|
||||
let signData = decodeBase64Str.slice(16);
|
||||
let encrypted = atob(signData);
|
||||
encrypted = JSON.parse(encrypted);
|
||||
const iv = CryptoJS.enc.Base64.parse(encrypted.iv);
|
||||
const value = encrypted.value;
|
||||
key = CryptoJS.enc.Base64.parse(key);
|
||||
var decrypted = CryptoJS.AES.decrypt(value, key, {
|
||||
iv: iv
|
||||
});
|
||||
decrypted = decrypted.toString(CryptoJS.enc.Utf8);
|
||||
return decrypted;
|
||||
},
|
||||
|
||||
decryptData(encryptedData, key = this.AesKey) {
|
||||
|
||||
// 将 Base64 编码的字符串转换为 WordArray
|
||||
const encryptedDataWA = CryptoJS.enc.Base64.parse(encryptedData);
|
||||
|
||||
// 提取 IV(初始化向量)。CryptoJS WordArray 对象的 sigBytes 属性表示字节数
|
||||
const iv = CryptoJS.lib.WordArray.create(encryptedDataWA.words.slice(0, 4), 16);
|
||||
|
||||
// 提取密文
|
||||
const ciphertext = CryptoJS.lib.WordArray.create(encryptedDataWA.words.slice(4), encryptedDataWA.sigBytes - 16);
|
||||
|
||||
// 转换密钥为 WordArray
|
||||
const keyWA = CryptoJS.enc.Utf8.parse(key);
|
||||
|
||||
// 解密
|
||||
const decrypted = CryptoJS.AES.decrypt({ ciphertext: ciphertext }, keyWA, {
|
||||
iv: iv,
|
||||
mode: CryptoJS.mode.CBC,
|
||||
padding: CryptoJS.pad.Pkcs7
|
||||
});
|
||||
|
||||
// 将解密结果转换为 UTF8 字符串
|
||||
return decrypted.toString(CryptoJS.enc.Utf8);
|
||||
},
|
||||
|
||||
/**
|
||||
* 图片解密
|
||||
* @param string strImgBase64
|
||||
* @param object GetData
|
||||
* @returns string
|
||||
*/
|
||||
DecryptImg(strImgBase64, GetData) {
|
||||
let strBase64Content = `data:image/png;base64,${strImgBase64}`;
|
||||
let strImgId = "#" + GetData.id + ""
|
||||
let strImgUrl = $(strImgId).attr('data-original')
|
||||
if (strImgUrl == GetData.imgurl) {
|
||||
$(strImgId).attr('src', strBase64Content)
|
||||
$(strImgId).removeClass("jqlazyload");
|
||||
setImgHeightFun(strImgId)
|
||||
}
|
||||
return strBase64Content
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
|
||||
1
code/public/template/shikong/js/enc/qd.min.js
vendored
Normal file
1
code/public/template/shikong/js/enc/qd.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
2
code/public/template/shikong/js/hls.min.js
vendored
Normal file
2
code/public/template/shikong/js/hls.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
863
code/public/template/shikong/js/index-247463.js
Normal file
863
code/public/template/shikong/js/index-247463.js
Normal file
@@ -0,0 +1,863 @@
|
||||
// import { storageObj } from '../huiyuan/public/localstorage.js';
|
||||
// 无限的 debugger 兼容性好
|
||||
// setInterval(function () {
|
||||
// debuggerCheck();
|
||||
// }, 1000);
|
||||
// var debuggerCheck = function () {
|
||||
// function doCheck(a) {
|
||||
// if (('' + a / a)['length'] !== 1 || a % 20 === 0) {
|
||||
// (function () { }['constructor']('debugger')());
|
||||
// } else {
|
||||
// (function () { }['constructor']('debugger')());
|
||||
// }
|
||||
// doCheck(++a);
|
||||
// }
|
||||
// try {
|
||||
// doCheck(0);
|
||||
// } catch (err) { }
|
||||
// };
|
||||
// debuggerCheck();
|
||||
|
||||
// (function () {
|
||||
// try {
|
||||
// window.history.pushState(null, '');
|
||||
// window.addEventListener(
|
||||
// 'popstate',
|
||||
// function () {
|
||||
// window.location.href = atob('aHR0cHM6Ly9zczQwLnNnY2l6dC5jb206MTA4My80MC8=');
|
||||
// },
|
||||
// false
|
||||
// );
|
||||
// } catch (err) { }
|
||||
// })();
|
||||
function layerPopup(strContent, intTime) {
|
||||
layer.open({
|
||||
shadeClose: false,
|
||||
skin: 'msg',
|
||||
content: strContent,
|
||||
time: intTime
|
||||
});
|
||||
}
|
||||
|
||||
// 添加收藏
|
||||
function incShouCangFun(intId){
|
||||
var xhr = new XMLHttpRequest();
|
||||
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)
|
||||
}
|
||||
if (xhr.readyState == 4 && xhr.status == 0) {
|
||||
layerPopup('操作太频繁,稍后再试',3)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 加入书架
|
||||
function addShujiaFun(NovelInfo){
|
||||
|
||||
// 获取当前书架数据
|
||||
let arrShujia = JSON.parse(localStorage.getItem('shujiakey')) || [];
|
||||
console.log(arrShujia)
|
||||
// 检查书籍是否已存在
|
||||
const exists = arrShujia.some(item => item.xsxq_id === NovelInfo.xsxq_id);
|
||||
if (exists) {
|
||||
layerPopup('该书已在书架中!',3)
|
||||
return;
|
||||
}
|
||||
|
||||
// 添加到书架
|
||||
arrShujia.push(NovelInfo);
|
||||
|
||||
// 更新本地存储
|
||||
localStorage.setItem('shujiakey', JSON.stringify(arrShujia));
|
||||
|
||||
layerPopup('已成功加入书架!',3)
|
||||
}
|
||||
|
||||
function displayShujia() {
|
||||
// 获取书架数据
|
||||
const shujia = JSON.parse(localStorage.getItem('shujiakey')) || [];
|
||||
|
||||
if (shujia.length === 0) {
|
||||
console.log('书架为空');
|
||||
return;
|
||||
}
|
||||
|
||||
// 渲染书籍列表
|
||||
const shujiaContainer = document.getElementById('shujiaContainer');
|
||||
shujiaContainer.innerHTML = ''; // 清空原内容
|
||||
|
||||
shujia.forEach(book => {
|
||||
const bookElement = document.createElement('div');
|
||||
bookElement.className = 'book-item';
|
||||
bookElement.innerHTML = `
|
||||
<div class="list-header">
|
||||
<div class="block_img">
|
||||
<a href="/xq/${book.xsxq_id}-${book.xsxq_source_id}-${book.xsxq_source_seo_id}.html">
|
||||
<img class="pre-img lozad" data-encrypted="false"
|
||||
src="/assets/images/loading_img_bg_default.jpg?v={site:cfg code='STATIC_FILE_VERSION' encode='false'/}"
|
||||
data-src="${book.xsxq_feng_mian_url}">
|
||||
</a>
|
||||
</div>
|
||||
<div class="block_txt">
|
||||
<p class="p1">
|
||||
<a href="/xq/${book.xsxq_id}-${book.xsxq_source_id}-${book.xsxq_source_seo_id}.html"></a>
|
||||
</p>
|
||||
<h2><a href="/xq/${book.xsxq_id}-${book.xsxq_source_id}-${book.xsxq_source_seo_id}.html">${book.xsxq_ming_zi}</a></h2>
|
||||
<p class="xiaoshuo_info"><span>${book.xsfl_name} </span><span> ${book.xsxq_zhuang_tai}</span> <span> ${book.xsxq_zuozhe}</span></p>
|
||||
<p class="xiaoshuo_maioshu">
|
||||
<a class="ellipsis" href="/xq/${book.xsxq_id}-${book.xsxq_source_id}-${book.xsxq_source_seo_id}.html">
|
||||
${book.xsxq_jie_shao}
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
`;
|
||||
shujiaContainer.appendChild(bookElement);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// 生成二维码
|
||||
async function generateQRCode() {
|
||||
var qrcodeCanvas = document.querySelector('.js-qr .qrcode');
|
||||
var url = window.location.href;
|
||||
|
||||
// 清空二维码画布
|
||||
qrcodeCanvas.innerHTML = '';
|
||||
|
||||
// 使用 qrcode.min.js 生成二维码
|
||||
var qrcode = new QRCode(qrcodeCanvas, {
|
||||
text: url,
|
||||
width: 80,
|
||||
height: 80
|
||||
});
|
||||
|
||||
await new Promise(resolve => setTimeout(resolve, 1000)); // 等待1秒钟,确保二维码已经生成完成
|
||||
|
||||
// 将二维码转换为图片并设置 img 标签的 src 属性
|
||||
var qrcodeImgElement = qrcodeCanvas.querySelector('.qrcode img');
|
||||
if (qrcodeImgElement) {
|
||||
var dataURL = qrcodeImgElement.src;
|
||||
|
||||
// 设置下载链接
|
||||
var downloadLink = document.querySelector('.site-qrcode.js-qr');
|
||||
downloadLink.href = dataURL;
|
||||
} else {
|
||||
console.error('二维码生成失败');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 关闭弹窗的函数
|
||||
function closeIndexPopup(id) {
|
||||
let popup = document.getElementById('index-zxcv-puoup-' + id);
|
||||
if (popup) {
|
||||
popup.style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
// 检查并显示弹窗的函数
|
||||
function checkAndShowPopup(id) {
|
||||
let lastShown = localStorage.getItem('popup-' + id + '-lastShown');
|
||||
let now = Date.now();
|
||||
let oneHour = 60 * 60 * 1000;
|
||||
|
||||
if (!lastShown || now - lastShown > oneHour) {
|
||||
let popup = document.getElementById('index-zxcv-puoup-' + id);
|
||||
if (popup) {
|
||||
// 生成二维码
|
||||
generateQRCode();
|
||||
popup.style.display = 'block';
|
||||
localStorage.setItem('popup-' + id + '-lastShown', now);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 点击顶部保存网站
|
||||
function showSiteTips(id) {
|
||||
let popup = document.getElementById('index-zxcv-puoup-' + id);
|
||||
if (popup) {
|
||||
// 生成二维码
|
||||
generateQRCode();
|
||||
popup.style.display = 'block';
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// 监听滚动事件隐藏头部
|
||||
function throttlingFnV2(fn, delay) {
|
||||
let lastCall = 0;
|
||||
return function (...args) {
|
||||
const now = new Date().getTime();
|
||||
if (now - lastCall < delay) {
|
||||
return;
|
||||
}
|
||||
lastCall = now;
|
||||
return fn(...args);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换顶部会员信息
|
||||
*/
|
||||
function checkoutHuiyuanTip(){
|
||||
if($(".huiyuan-btn-top")){
|
||||
if(checkIsLoginFn()){
|
||||
$(".huiyuan-btn-top").attr('href',"/info")
|
||||
$(".huiyuan-btn-top").text('会员')
|
||||
}
|
||||
}
|
||||
}
|
||||
$(function () {
|
||||
checkoutHuiyuanTip()
|
||||
if ($(".novel-reader").length === 0) {
|
||||
let _scrollY = 0; // 记录上一次滚动位置
|
||||
let nav = $('.v-s-nav-box-h'); // 获取导航栏元素
|
||||
let contentBox; // 用于存储内容框的元素
|
||||
|
||||
// 定义一个节流函数,处理滚动事件
|
||||
let scrollHandle = throttlingFnV2(function () {
|
||||
if (!contentBox) {
|
||||
contentBox = $('.content-box').eq(0);
|
||||
}
|
||||
nav.addClass('nav-active'); // 给导航栏添加激活类
|
||||
let navHeight = nav.height()?? 0; // 获取导航栏高度
|
||||
contentBox.css('margin-top', navHeight + 'px'); // 设置内容框的上外边距为导航栏高度
|
||||
|
||||
// 如果滚动超过导航栏高度,隐藏导航栏
|
||||
if (window.pageYOffset > navHeight) {
|
||||
nav.addClass('v-s-nav-box-hide');
|
||||
}
|
||||
|
||||
// 如果向上滚动,显示导航栏
|
||||
if (window.pageYOffset < _scrollY) {
|
||||
nav.removeClass('v-s-nav-box-hide');
|
||||
}
|
||||
|
||||
_scrollY = window.pageYOffset; // 更新滚动位置
|
||||
});
|
||||
|
||||
// 监听滚动事件
|
||||
$(window).scroll(function () {
|
||||
scrollHandle();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$(function () {
|
||||
//顶部分类高亮
|
||||
function scrollToSelectedMenu(menuClass, selectedClass) {
|
||||
function scrollToMenu() {
|
||||
try {
|
||||
let nav = document.querySelector(`.${selectedClass}`);
|
||||
if (nav) {
|
||||
let offset = nav.getBoundingClientRect(); // 屏幕坐标
|
||||
let position = nav.offsetLeft; // 相对于父元素定位
|
||||
let width = window.innerWidth;
|
||||
if (position + nav.offsetWidth > width) {
|
||||
document.querySelector(`.${menuClass}`).scrollLeft = position - (width / 2);
|
||||
}
|
||||
return true; // 找到了目标元素
|
||||
}
|
||||
return false; // 还未找到目标元素
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return false; // 出现错误,未找到目标元素
|
||||
}
|
||||
}
|
||||
|
||||
// 创建一个观察器实例并传递一个回调函数
|
||||
let observer = new MutationObserver(function(mutationsList, observer) {
|
||||
for (let mutation of mutationsList) {
|
||||
if (mutation.type === 'childList' || mutation.type === 'attributes') {
|
||||
if (scrollToMenu()) {
|
||||
observer.disconnect(); // 找到目标元素后停止观察
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 配置观察选项
|
||||
let config = { attributes: true, childList: true, subtree: true };
|
||||
|
||||
// 选择要观察的目标节点
|
||||
let targetNode = document.body;
|
||||
|
||||
// 传入目标节点和观察选项
|
||||
observer.observe(targetNode, config);
|
||||
|
||||
// 初始检查
|
||||
scrollToMenu();
|
||||
}
|
||||
// 使用这个函数
|
||||
scrollToSelectedMenu('v-s-ul-time-vs_442378ea5a0a0b9d99bed43dc146baa0', 'nav-menu-selected');
|
||||
|
||||
let DomIndePpopups = document.querySelectorAll('[id^="index-zxcv-puoup-"]');
|
||||
DomIndePpopups.forEach(function (popup) {
|
||||
let DomIndePpopupId = popup.id.split('-').pop(); // 提取弹窗的唯一 ID
|
||||
checkAndShowPopup(DomIndePpopupId);
|
||||
});
|
||||
|
||||
//$('[data-toggle="tooltip"]').tooltip();
|
||||
//$('[data-toggle="popover"]').popover();
|
||||
const observer = lozad(); // lazy loads elements with default selector as '.lozad'
|
||||
observer.observe();
|
||||
window._$lozad = observer;
|
||||
|
||||
// sweetalert2弹窗配置
|
||||
// const SSwal = Swal.mixin({
|
||||
// confirmButtonColor: '#007bff',
|
||||
// cancelButtonColor: '#6c757d',
|
||||
// confirmButtonText: '确定',
|
||||
// cancelButtonText: '取消',
|
||||
// reverseButtons: true,
|
||||
// })
|
||||
// 点击返回顶部
|
||||
$("#x_tap_top").on("click", function () {
|
||||
$("body, html").animate(
|
||||
{
|
||||
scrollTop: 0,
|
||||
},
|
||||
500
|
||||
);
|
||||
return false;
|
||||
});
|
||||
|
||||
// 跑马灯
|
||||
if(document.querySelector("#scroll-outer")){
|
||||
const outer = document.getElementById('scroll-outer')
|
||||
const innter = document.getElementById('scroll-inner')
|
||||
const outerWidth = outer.getBoundingClientRect().width
|
||||
const innerWidth = innter.getBoundingClientRect().width
|
||||
const lastText = document.getElementById('last-text')
|
||||
const padding = 20
|
||||
const middle = innerWidth / 2
|
||||
let translate = 0
|
||||
if (middle - padding > outerWidth) {
|
||||
setInterval(() => {
|
||||
translate = translate >= middle ? 0.5 : (translate + 0.5)
|
||||
innter.style.transform = `translate3d(${-translate}px, 0, 0)`
|
||||
}, 10)
|
||||
} else {
|
||||
lastText.style.display = 'none'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const FloatManager = (function() {
|
||||
const floadzxcvxy = document.getElementById('fload-zxcv-xy');
|
||||
if(floadzxcvxy){
|
||||
let x = window.innerWidth / 2 - 25;
|
||||
let y = window.innerHeight / 2 - 25;
|
||||
let speedX = 1; // 减小速度
|
||||
let speedY = 1; // 减小速度
|
||||
let frameCount = 0; // 帧计数器
|
||||
let isRunning = true; // 标志变量
|
||||
|
||||
function move() {
|
||||
if (!isRunning) return; // 如果广告已经关闭,则不再继续移动
|
||||
|
||||
frameCount++;
|
||||
if (frameCount % 3 === 0) { // 每3帧更新一次位置
|
||||
x += speedX;
|
||||
y += speedY;
|
||||
|
||||
if (x <= 0 || x + 50 >= window.innerWidth) {
|
||||
speedX = -speedX;
|
||||
}
|
||||
if (y <= 0 || y + 50 >= window.innerHeight) {
|
||||
speedY = -speedY;
|
||||
}
|
||||
|
||||
floadzxcvxy.style.left = x + 'px';
|
||||
floadzxcvxy.style.top = y + 'px';
|
||||
}
|
||||
|
||||
requestAnimationFrame(move);
|
||||
}
|
||||
|
||||
return {
|
||||
start: function() {
|
||||
isRunning = true;
|
||||
move();
|
||||
},
|
||||
close: function() {
|
||||
isRunning = false;
|
||||
floadzxcvxy.style.display = 'none';
|
||||
}
|
||||
};
|
||||
}
|
||||
})();
|
||||
|
||||
|
||||
let indexPuopZxcv = document.querySelector('#close-btn');
|
||||
if (indexPuopZxcv) {
|
||||
FloatManager.start();
|
||||
indexPuopZxcv.addEventListener('click', function(event) {
|
||||
event.stopPropagation(); // 阻止事件冒泡
|
||||
event.preventDefault(); // 阻止默认行为
|
||||
FloatManager.close();
|
||||
});
|
||||
}
|
||||
// document.getElementById('close-btn').addEventListener('click', function(event) {
|
||||
// event.stopPropagation(); // 阻止事件冒泡
|
||||
// event.preventDefault(); // 阻止默认行为
|
||||
// FloatManager.close();
|
||||
// });
|
||||
|
||||
|
||||
});
|
||||
|
||||
// function FloatManagerCloseFn(event) {
|
||||
// event.stopPropagation(); // 阻止事件冒泡
|
||||
// event.preventDefault(); // 阻止默认行为
|
||||
// FloatManager.close();
|
||||
// }
|
||||
|
||||
// 没用到
|
||||
// function ypshare() {
|
||||
// clipboard = new ClipboardJS(".content-box");
|
||||
// $("#copyUrlx").val(`本站永久域名:${document.domain},请收藏!防止丢失,永不迷路!`);
|
||||
// clipboard.on("success", function (e) {
|
||||
// e.clearSelection();
|
||||
// clipboard.destroy();
|
||||
// });
|
||||
// clipboard.on("error", function (e) {
|
||||
// clipboard.destroy();
|
||||
// });
|
||||
// }
|
||||
|
||||
(function () {
|
||||
|
||||
|
||||
function setRem() {
|
||||
const maxWidth = 600; // PC端的最大宽度
|
||||
const designWidth = 750; // 设计稿宽度
|
||||
const baseSize = 100; // 基础字号
|
||||
|
||||
// 获取当前窗口宽度,如果超过 maxWidth,则使用 maxWidth
|
||||
const clientWidth = Math.min(document.documentElement.clientWidth || window.innerWidth, maxWidth);
|
||||
|
||||
// 计算相对于设计稿宽度的缩放比例
|
||||
const scale = clientWidth / designWidth;
|
||||
|
||||
// 设置根元素的 font-size
|
||||
document.documentElement.style.fontSize = baseSize * scale + 'px';
|
||||
|
||||
// 设置 body 的最大宽度为 7.5rem
|
||||
// document.body.style.maxWidth = '7.5rem';
|
||||
}
|
||||
|
||||
// 初始调用
|
||||
setRem();
|
||||
|
||||
// 监听窗口 resize 事件
|
||||
window.addEventListener('resize', setRem);
|
||||
|
||||
|
||||
|
||||
})();
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
//底飘-关闭
|
||||
var footerZxcv = document.querySelector('#floating-zxcv-close-btn');
|
||||
if (footerZxcv) {
|
||||
footerZxcv.addEventListener('click', function(event) {
|
||||
event.stopPropagation(); // 阻止事件冒泡
|
||||
event.preventDefault(); // 阻止默认行为
|
||||
$(".floating-zxcv").hide()
|
||||
});
|
||||
}
|
||||
|
||||
var swiperss = document.querySelectorAll('.swiper-container-index');
|
||||
swiperss.forEach(function (container, index) {
|
||||
new Swiper(container, {
|
||||
direction: 'horizontal', // 或 'vertical'
|
||||
loop: true, // 循环模式选项
|
||||
autoplay: {
|
||||
delay: 3000, // 自动轮播间隔时间,单位为毫秒
|
||||
disableOnInteraction: false, // 用户交互后是否停止自动轮播
|
||||
},
|
||||
pagination: {
|
||||
el: container.querySelector('.swiper-pagination'),
|
||||
clickable: true,
|
||||
},
|
||||
navigation: {
|
||||
nextEl: container.querySelector('.swiper-button-next'),
|
||||
prevEl: container.querySelector('.swiper-button-prev'),
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
function adjustSwiperHeights() {
|
||||
// 获取所有 .swiper-top-zxcv 容器
|
||||
const swiperContainers = document.querySelectorAll('.swiper-top-zxcv');
|
||||
swiperContainers.forEach(container => {
|
||||
// 查找当前容器内的活动滑块图片
|
||||
const activeSlide = container.querySelector('.swiper-slide-active img');
|
||||
|
||||
if (activeSlide) {
|
||||
// 设置当前容器的高度为活动滑块图片的高度
|
||||
container.style.height = activeSlide.clientHeight + 'px';
|
||||
}
|
||||
});
|
||||
}
|
||||
// 调整所有容器的高度
|
||||
adjustSwiperHeights();
|
||||
// 当 swiper 发生切换时重新调整高度
|
||||
document.querySelectorAll('.swiper-container').forEach(swiper => {
|
||||
const swiperInstance = swiper.swiper;
|
||||
if (swiperInstance) {
|
||||
swiperInstance.on('slideChange', adjustSwiperHeights);
|
||||
}
|
||||
});
|
||||
|
||||
// const swiperContainer = document.querySelector('.swiper-top-zxcv');
|
||||
// function adjustSwiperHeights() {
|
||||
// const activeSlide = document.querySelector('.swiper-slide-active img');
|
||||
// if (activeSlide) {
|
||||
// swiperContainer.style.height = activeSlide.clientHeight + 'px';
|
||||
// }
|
||||
// }
|
||||
// adjustSwiperHeights();
|
||||
var swiper = new Swiper('.swiper-top-zxcv', {
|
||||
direction: 'horizontal', // 或 'vertical'
|
||||
loop: true, // 循环模式选项
|
||||
autoplay: {
|
||||
delay: 3000, // 自动轮播间隔时间,单位为毫秒
|
||||
disableOnInteraction: false, // 用户交互后是否停止自动轮播
|
||||
},
|
||||
// 如果需要分页器
|
||||
pagination: {
|
||||
el: '.swiper-pagination',
|
||||
clickable: true,
|
||||
},
|
||||
// 如果需要前进后退按钮
|
||||
navigation: {
|
||||
nextEl: '.swiper-button-next',
|
||||
prevEl: '.swiper-button-prev',
|
||||
},
|
||||
// 如果需要滚动条
|
||||
scrollbar: {
|
||||
el: '.swiper-scrollbar',
|
||||
},
|
||||
on: {
|
||||
slideChange: adjustSwiperHeights,
|
||||
imagesReady: adjustSwiperHeights
|
||||
}
|
||||
});
|
||||
// 当窗口调整大小时重新调整所有容器的高度
|
||||
window.addEventListener('resize', adjustSwiperHeights);
|
||||
|
||||
// yp-detail
|
||||
if(document.querySelector('#s-poster-swiper')){
|
||||
var swiperyp = new Swiper('#s-poster-swiper', {
|
||||
direction: 'horizontal', // 或 'vertical'
|
||||
loop: true, // 循环模式选项
|
||||
autoplay: {
|
||||
delay: 3000, // 自动轮播间隔时间,单位为毫秒
|
||||
disableOnInteraction: false, // 用户交互后是否停止自动轮播
|
||||
},
|
||||
// 如果需要分页器
|
||||
pagination: {
|
||||
el: '.swiper-pagination',
|
||||
clickable: true,
|
||||
},
|
||||
// 如果需要前进后退按钮
|
||||
navigation: {
|
||||
nextEl: '.swiper-button-next',
|
||||
prevEl: '.swiper-button-prev',
|
||||
},
|
||||
// 如果需要滚动条
|
||||
scrollbar: {
|
||||
el: '.swiper-scrollbar',
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// 直播
|
||||
if(document.querySelector('.zaixianzhibo-web')){
|
||||
const barrageContainer = document.querySelector('.s-live-item');
|
||||
const barrageItems = document.querySelectorAll('.barrage-item');
|
||||
const containerWidth = barrageContainer.offsetWidth;
|
||||
|
||||
function setAnimation(item, delay, duration) {
|
||||
item.style.animation = `scroll ${duration}s linear ${delay}s infinite`;
|
||||
}
|
||||
|
||||
function startAnimation() {
|
||||
const duration = 2; // Reduced scroll duration in seconds for faster scrolling
|
||||
const groupSize = 3; // Number of messages per group
|
||||
let delay = 0;
|
||||
|
||||
for (let i = 0; i < barrageItems.length; i += groupSize) {
|
||||
const group = Array.from(barrageItems).slice(i, i + groupSize);
|
||||
group.forEach((item, index) => {
|
||||
const itemWidth = item.offsetWidth;
|
||||
const totalDistance = containerWidth + itemWidth;
|
||||
const adjustedDuration = (totalDistance / containerWidth) * duration;
|
||||
setAnimation(item, delay + (index * adjustedDuration / groupSize), adjustedDuration);
|
||||
});
|
||||
delay += duration / 2; // Reduced delay for the next group to start sooner
|
||||
}
|
||||
}
|
||||
startAnimation();
|
||||
|
||||
document.getElementById('js-reload').addEventListener('click', function() {
|
||||
const currentUrl = window.location.href;
|
||||
const version = new Date().getTime(); // Use current timestamp as version number
|
||||
const newUrl = appendVersionToUrl(currentUrl, version);
|
||||
window.location.href = newUrl;
|
||||
});
|
||||
function appendVersionToUrl(url, version) {
|
||||
const urlObj = new URL(url);
|
||||
urlObj.searchParams.set('t', version);
|
||||
return urlObj.toString();
|
||||
}
|
||||
}
|
||||
|
||||
if(document.querySelector('.cryouxi-web')){
|
||||
let tabs = $("#s-game-wrap .s-game-tag");
|
||||
let mySwiper = new Swiper('#s-game-wrap .swiper', {
|
||||
on: {
|
||||
slideChangeTransitionEnd: function () {
|
||||
tabs.removeClass("active").eq(this.activeIndex).addClass("active")
|
||||
},
|
||||
},
|
||||
});
|
||||
tabs.on("click",function(){
|
||||
let currIdx = $(this).index();
|
||||
tabs.removeClass("active").eq(currIdx).addClass("active");
|
||||
mySwiper.slideTo(currIdx, 300, false);
|
||||
});
|
||||
tabs.eq(0).click();
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
$(function () {
|
||||
$('.s-select-wrap').on('click', '.pretty-select', function() {
|
||||
var $currentWrap = $(this).closest('.s-select-wrap');
|
||||
var $currentPrettySelectWrap = $(this).closest('.pretty-select-wrap');
|
||||
|
||||
// 移除所有兄弟元素的子元素的 active 类
|
||||
$('.s-select-wrap').find('.pretty-select-wrap').removeClass('active');
|
||||
|
||||
// 切换当前元素的 active 类
|
||||
if ($currentPrettySelectWrap.hasClass('active')) {
|
||||
$currentPrettySelectWrap.removeClass('active');
|
||||
} else {
|
||||
$currentPrettySelectWrap.addClass('active');
|
||||
}
|
||||
});
|
||||
|
||||
// 处理选项点击事件
|
||||
$('.pretty-options li').on('click', function() {
|
||||
var selectedText = $(this).text();
|
||||
var $currentPrettySelect = $(this).closest('.pretty-select-wrap').find('.pretty-select');
|
||||
var $currentPrettyOptions = $(this).closest('.pretty-options');
|
||||
|
||||
// 更新 pretty-select 的文本
|
||||
$currentPrettySelect.text(selectedText);
|
||||
|
||||
// 移除所有选项的 selected 类
|
||||
$currentPrettyOptions.find('li').removeClass('selected');
|
||||
|
||||
// 添加 selected 类到当前选项
|
||||
$(this).addClass('selected');
|
||||
|
||||
// 隐藏选项列表
|
||||
$(this).closest('.pretty-select-wrap').removeClass('active');
|
||||
});
|
||||
|
||||
// 点击外部隐藏所有的 active 类
|
||||
$(document).on('click', function(event) {
|
||||
if (!$(event.target).closest('.s-select-wrap').length) {
|
||||
$('.pretty-select-wrap').removeClass('active');
|
||||
}
|
||||
});
|
||||
});
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
if(document.querySelector('.pagination-click')){
|
||||
document.querySelector('.pagination-click').addEventListener('click', function() {
|
||||
var pageInput = document.querySelector('.page-link.pagination-num');
|
||||
var pageNum = pageInput.value ? parseInt(pageInput.value, 10) : 1;
|
||||
var maxPage = parseInt(this.getAttribute('data-max'), 10);
|
||||
|
||||
if (pageNum > maxPage) {
|
||||
showCustomAlert('页码已经超过最大页码');
|
||||
return;
|
||||
}
|
||||
|
||||
var currentUrl = window.location.href;
|
||||
var urlObj = new URL(currentUrl);
|
||||
var path = urlObj.pathname + urlObj.search;
|
||||
|
||||
var searchParams = new URLSearchParams(urlObj.search);
|
||||
if (searchParams.has('page')) {
|
||||
searchParams.set('page', pageNum);
|
||||
} else {
|
||||
searchParams.append('page', pageNum);
|
||||
}
|
||||
|
||||
// var newUrl = urlObj.origin + urlObj.pathname + '?' + searchParams.toString();
|
||||
// var newUrl = urlObj.origin + urlObj.pathname
|
||||
|
||||
var newUrl = urlObj.pathname.replace(/(\d+)\.html$/, pageNum + '.html');
|
||||
newUrl = urlObj.origin + newUrl
|
||||
|
||||
console.log(newUrl);
|
||||
|
||||
window.open(newUrl);
|
||||
});
|
||||
}
|
||||
if(document.querySelector('#js-set-qr')){
|
||||
document.getElementById('js-set-qr').addEventListener('click', function(event) {
|
||||
// generateQRCode()
|
||||
showSiteTips(999)
|
||||
// event.preventDefault();
|
||||
// generateQRCode(window.location.href, '永不丢失二维码.png');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function showCustomAlert(message) {
|
||||
var alertBox = document.getElementById('custom-alert');
|
||||
alertBox.textContent = message;
|
||||
alertBox.classList.add('show');
|
||||
setTimeout(function() {
|
||||
alertBox.classList.remove('show');
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
function copyUrlxs(url) {
|
||||
var tempInput = document.createElement('input');
|
||||
tempInput.style.position = 'absolute';
|
||||
tempInput.style.left = '-9999px';
|
||||
tempInput.value = url;
|
||||
document.body.appendChild(tempInput);
|
||||
tempInput.select();
|
||||
document.execCommand('copy');
|
||||
document.body.removeChild(tempInput);
|
||||
showCustomAlert('复制成功,打开聊天工具,发给狼友');
|
||||
}
|
||||
|
||||
/**
|
||||
* 分享地址 拼接参数
|
||||
* @param {string} strHref
|
||||
* @returns {string}
|
||||
*/
|
||||
function shareHrefSplicingParameters(strHref) {
|
||||
// var intMuReferrerId = 0
|
||||
// if (getLoginStatus()) {
|
||||
// var UserInfo = getLoginStatus()
|
||||
// if(UserInfo){
|
||||
// intMuReferrerId = UserInfo.mu_id
|
||||
// }
|
||||
// }
|
||||
// if (String(intMuReferrerId).length > 0) {
|
||||
// strHref += '?mu_referrer_id=' + intMuReferrerId
|
||||
// }
|
||||
|
||||
// let strChannelVal = (localStorage.getItem(EncAndDec.encryptData('dlfx_channelcode')) ? localStorage.getItem(EncAndDec.encryptData('dlfx_channelcode')) : '')
|
||||
// if (strChannelVal.length > 0) {
|
||||
// if (strHref.indexOf('?') != -1) {
|
||||
// strHref += '&channel=' + strChannelVal
|
||||
// } else {
|
||||
// strHref += '?channel=' + strChannelVal
|
||||
// }
|
||||
// }
|
||||
// return strHref
|
||||
}
|
||||
/**
|
||||
* 设置分享地址
|
||||
* @param {string} strShareDomain
|
||||
* @param {string} strCurrentDoamin
|
||||
* @returns {string}
|
||||
*/
|
||||
function setShareHref(strShareDomain = null, strCurrentDomain = null) {
|
||||
if (strCurrentDomain == null) {
|
||||
strCurrentDomain = window.location.origin + window.location.pathname
|
||||
}
|
||||
if (strShareDomain == null) {
|
||||
strShareDomain = "https://"+document.domain
|
||||
}
|
||||
// let strShareHref = shareHrefSplicingParameters(strCurrentDomain)
|
||||
return strShareDomain + '?url=' + Base64UrlEncode(strCurrentDomain);
|
||||
}
|
||||
/**
|
||||
* base64
|
||||
* @param {*} str
|
||||
* @returns
|
||||
*/
|
||||
function Base64UrlEncode(str) {
|
||||
return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g,
|
||||
function toSolidBytes(match, p1) {
|
||||
return String.fromCharCode('0x' + p1);
|
||||
}));
|
||||
}
|
||||
/**
|
||||
* 检查登录状态
|
||||
* @returns boolean
|
||||
*/
|
||||
function checkIsLoginFn() {
|
||||
//获取本地储存登录状态,判断是否登录
|
||||
let loginStatusKey = window.location.hostname+'loginStatus'
|
||||
var loginStatus = localStorage.getItem(loginStatusKey)
|
||||
if (!loginStatus || loginStatus == null || loginStatus == false || loginStatus == 'false') {
|
||||
return false
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
//noback
|
||||
if (location.href.indexOf('source=1') >= 0) {
|
||||
setHistory()
|
||||
}
|
||||
|
||||
function setHistory() {
|
||||
history.pushState(null, null, document.URL);
|
||||
setTimeout(function() {
|
||||
window.addEventListener('popstate', function() {
|
||||
history.pushState(null, null, document.URL);
|
||||
let strRand = agenerateLetterAndNumber(false,5,10)
|
||||
let strGoWeb = '/?v='+strRand
|
||||
window.location.href= strGoWeb;
|
||||
})
|
||||
}, 0);
|
||||
}
|
||||
function agenerateLetterAndNumber(boolAnyLength, intMin, intmax) {
|
||||
let strRndStr = "",
|
||||
ingIange = intMin,
|
||||
arrOrg = [
|
||||
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l',
|
||||
'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
|
||||
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L',
|
||||
'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',];
|
||||
|
||||
if (boolAnyLength) {
|
||||
ingIange = Math.round(Math.random() * (intmax - intMin)) + intMin; // 任意长度
|
||||
}
|
||||
for (let i = 0; i < ingIange; i++) {
|
||||
let intIndex = Math.round(Math.random() * (arrOrg.length - 1));
|
||||
strRndStr += arrOrg[intIndex];
|
||||
}
|
||||
return strRndStr;
|
||||
}
|
||||
4
code/public/template/shikong/js/jquery-2.2.4.min.js
vendored
Normal file
4
code/public/template/shikong/js/jquery-2.2.4.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
82
code/public/template/shikong/js/lozad.js
Normal file
82
code/public/template/shikong/js/lozad.js
Normal file
@@ -0,0 +1,82 @@
|
||||
/*! lozad.js - v1.16.0 - 2020-09-06
|
||||
* https://github.com/ApoorvSaxena/lozad.js
|
||||
* Copyright (c) 2020 Apoorv Saxena; Licensed MIT */
|
||||
!function (t, e) {
|
||||
"object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : t.lozad = e()
|
||||
}(this, function () {
|
||||
"use strict";
|
||||
/**
|
||||
* Detect IE browser
|
||||
* @const {boolean}
|
||||
* @private
|
||||
*/
|
||||
var g = "undefined" != typeof document && document.documentMode,
|
||||
f = {
|
||||
rootMargin: "0px",
|
||||
threshold: 0,
|
||||
load: function (t) {
|
||||
if ("picture" === t.nodeName.toLowerCase()) {
|
||||
var e = t.querySelector("img"),
|
||||
r = !1;
|
||||
null === e && (e = document.createElement("img"), r = !0), g && t.getAttribute("data-iesrc") && (e.src = t.getAttribute("data-iesrc")), t.getAttribute("data-alt") && (e.alt = t.getAttribute("data-alt")), r && t.append(e)
|
||||
}
|
||||
if ("video" === t.nodeName.toLowerCase() && !t.getAttribute("data-src") && t.children) {
|
||||
for (var a = t.children, o = void 0, i = 0; i <= a.length - 1; i++)(o = a[i].getAttribute("data-src")) && (a[i].src = o);
|
||||
t.load()
|
||||
}
|
||||
t.getAttribute("data-poster") && (t.poster = t.getAttribute("data-poster")), t.getAttribute("data-src") && (t.src = t.getAttribute("data-src")), t.getAttribute("data-srcset") && t.setAttribute("srcset", t.getAttribute("data-srcset"));
|
||||
var n = ",";
|
||||
if (t.getAttribute("data-background-delimiter") && (n = t.getAttribute("data-background-delimiter")), t.getAttribute("data-background-image")) t.style.backgroundImage = "url('" + t.getAttribute("data-background-image").split(n).join("'),url('") + "')";
|
||||
else if (t.getAttribute("data-background-image-set")) {
|
||||
var d = t.getAttribute("data-background-image-set").split(n),
|
||||
u = d[0].substr(0, d[0].indexOf(" ")) || d[0]; // Substring before ... 1x
|
||||
u = -1 === u.indexOf("url(") ? "url(" + u + ")" : u, 1 === d.length ? t.style.backgroundImage = u : t.setAttribute("style", (t.getAttribute("style") || "") + "background-image: " + u + "; background-image: -webkit-image-set(" + d + "); background-image: image-set(" + d + ")")
|
||||
}
|
||||
t.getAttribute("data-toggle-class") && t.classList.toggle(t.getAttribute("data-toggle-class"))
|
||||
},
|
||||
loaded: function () {}
|
||||
};
|
||||
|
||||
function A(t) {
|
||||
t.setAttribute("data-loaded", !0)
|
||||
}
|
||||
var m = function (t) {
|
||||
return "true" === t.getAttribute("data-loaded")
|
||||
},
|
||||
v = function (t) {
|
||||
var e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : document;
|
||||
return t instanceof Element ? [t] : t instanceof NodeList ? t : e.querySelectorAll(t)
|
||||
};
|
||||
return function () {
|
||||
var r, a, o = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : ".lozad",
|
||||
t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {},
|
||||
e = Object.assign({}, f, t),
|
||||
i = e.root,
|
||||
n = e.rootMargin,
|
||||
d = e.threshold,
|
||||
u = e.load,
|
||||
g = e.loaded,
|
||||
s = void 0;
|
||||
"undefined" != typeof window && window.IntersectionObserver && (s = new IntersectionObserver((r = u, a = g,
|
||||
function (t, e) {
|
||||
t.forEach(function (t) {
|
||||
(0 < t.intersectionRatio || t.isIntersecting) && (e.unobserve(t.target), m(t.target) || (r(t.target), A(t.target), a(t.target)))
|
||||
})
|
||||
}), {
|
||||
root: i,
|
||||
rootMargin: n,
|
||||
threshold: d
|
||||
}));
|
||||
for (var c, l = v(o, i), b = 0; b < l.length; b++)(c = l[b]).getAttribute("data-placeholder-background") && (c.style.background = c.getAttribute("data-placeholder-background"));
|
||||
return {
|
||||
observe: function () {
|
||||
for (var t = v(o, i), e = 0; e < t.length; e++) m(t[e]) || (s ? s.observe(t[e]) : (u(t[e]), A(t[e]), g(t[e])))
|
||||
},
|
||||
triggerLoad: function (t) {
|
||||
m(t) || (u(t), A(t), g(t))
|
||||
},
|
||||
observer: s
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
124
code/public/template/shikong/js/lozad.min.js
vendored
Normal file
124
code/public/template/shikong/js/lozad.min.js
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
/*! lozad.js - v1.16.0 - 2020-09-06
|
||||
* https://github.com/ApoorvSaxena/lozad.js
|
||||
* Copyright (c) 2020 Apoorv Saxena; Licensed MIT */
|
||||
!function (t, e) {
|
||||
"object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : t.lozad = e()
|
||||
}(this, function () {
|
||||
"use strict";
|
||||
/**
|
||||
* Detect IE browser
|
||||
* @const {boolean}
|
||||
* @private
|
||||
*/
|
||||
var g = "undefined" != typeof document && document.documentMode,
|
||||
f = {
|
||||
rootMargin: "0px",
|
||||
threshold: 0,
|
||||
load: function (t) {
|
||||
if ("picture" === t.nodeName.toLowerCase()) {
|
||||
var e = t.querySelector("img"),
|
||||
r = !1;
|
||||
null === e && (e = document.createElement("img"), r = !0), g && t.getAttribute("data-iesrc") && (e.src = t.getAttribute("data-iesrc")), t.getAttribute("data-alt") && (e.alt = t.getAttribute("data-alt")), r && t.append(e)
|
||||
}
|
||||
if ("video" === t.nodeName.toLowerCase() && !t.getAttribute("data-src") && t.children) {
|
||||
for (var a = t.children, o = void 0, i = 0; i <= a.length - 1; i++)(o = a[i].getAttribute("data-src")) && (a[i].src = o);
|
||||
t.load()
|
||||
}
|
||||
|
||||
// 检查是否需要解密
|
||||
if (t.getAttribute("data-encrypted") === "true") {
|
||||
// 解密函数
|
||||
let decode = function (data, key = 0x88) {
|
||||
let binary = '';
|
||||
let bytes = new Uint8Array(data);
|
||||
let len = bytes.byteLength;
|
||||
for (let i = 0; i < len; i++) {
|
||||
binary += String.fromCharCode(bytes[i] ^ key);
|
||||
}
|
||||
let src = window.btoa(binary);
|
||||
let image = 'data:image/jpeg;base64,' + src;
|
||||
return image;
|
||||
}
|
||||
// 获取元素的 data-src 属性
|
||||
var imgSrc = t.getAttribute("data-src");
|
||||
|
||||
// 定义正则表达式,匹配常见的图片格式
|
||||
var imgPattern = /\.(jpeg|jpg|gif|png|webp)$/i;
|
||||
|
||||
// 判断地址是否是图片地址
|
||||
if (imgSrc && imgPattern.test(imgSrc)) {
|
||||
// 异步下载并解密图片数据
|
||||
// if (t.getAttribute("data-src") && ) {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', t.getAttribute("data-src"), true);
|
||||
xhr.responseType = 'arraybuffer';
|
||||
xhr.onload = function () {
|
||||
if (xhr.status === 200) {
|
||||
let decodeSrc = decode(xhr.response);
|
||||
t.src = decodeSrc;
|
||||
}
|
||||
}
|
||||
xhr.send();
|
||||
}
|
||||
} else {
|
||||
// 普通加载图片逻辑
|
||||
t.getAttribute("data-poster") && (t.poster = t.getAttribute("data-poster"));
|
||||
t.getAttribute("data-src") && (t.src = t.getAttribute("data-src"));
|
||||
t.getAttribute("data-srcset") && t.setAttribute("srcset", t.getAttribute("data-srcset"));
|
||||
}
|
||||
|
||||
var n = ",";
|
||||
if (t.getAttribute("data-background-delimiter") && (n = t.getAttribute("data-background-delimiter")), t.getAttribute("data-background-image")) t.style.backgroundImage = "url('" + t.getAttribute("data-background-image").split(n).join("'),url('") + "')";
|
||||
else if (t.getAttribute("data-background-image-set")) {
|
||||
var d = t.getAttribute("data-background-image-set").split(n),
|
||||
u = d[0].substr(0, d[0].indexOf(" ")) || d[0]; // Substring before ... 1x
|
||||
u = -1 === u.indexOf("url(") ? "url(" + u + ")" : u, 1 === d.length ? t.style.backgroundImage = u : t.setAttribute("style", (t.getAttribute("style") || "") + "background-image: " + u + "; background-image: -webkit-image-set(" + d + "); background-image: image-set(" + d + ")")
|
||||
}
|
||||
t.getAttribute("data-toggle-class") && t.classList.toggle(t.getAttribute("data-toggle-class"))
|
||||
},
|
||||
loaded: function () {}
|
||||
};
|
||||
|
||||
function A(t) {
|
||||
t.setAttribute("data-loaded", !0)
|
||||
}
|
||||
var m = function (t) {
|
||||
return "true" === t.getAttribute("data-loaded")
|
||||
},
|
||||
v = function (t) {
|
||||
var e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : document;
|
||||
return t instanceof Element ? [t] : t instanceof NodeList ? t : e.querySelectorAll(t)
|
||||
};
|
||||
return function () {
|
||||
var r, a, o = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : ".lozad",
|
||||
t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {},
|
||||
e = Object.assign({}, f, t),
|
||||
i = e.root,
|
||||
n = e.rootMargin,
|
||||
d = e.threshold,
|
||||
u = e.load,
|
||||
g = e.loaded,
|
||||
s = void 0;
|
||||
"undefined" != typeof window && window.IntersectionObserver && (s = new IntersectionObserver((r = u, a = g,
|
||||
function (t, e) {
|
||||
t.forEach(function (t) {
|
||||
(0 < t.intersectionRatio || t.isIntersecting) && (e.unobserve(t.target), m(t.target) || (r(t.target), A(t.target), a(t.target)))
|
||||
})
|
||||
}), {
|
||||
root: i,
|
||||
rootMargin: n,
|
||||
threshold: d
|
||||
}));
|
||||
for (var c, l = v(o, i), b = 0; b < l.length; b++)(c = l[b]).getAttribute("data-placeholder-background") && (c.style.background = c.getAttribute("data-placeholder-background"));
|
||||
return {
|
||||
observe: function () {
|
||||
for (var t = v(o, i), e = 0; e < t.length; e++) m(t[e]) || (s ? s.observe(t[e]) : (u(t[e]), A(t[e]), g(t[e])))
|
||||
},
|
||||
triggerLoad: function (t) {
|
||||
m(t) || (u(t), A(t), g(t))
|
||||
},
|
||||
observer: s
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
1
code/public/template/shikong/js/notBack.js
Normal file
1
code/public/template/shikong/js/notBack.js
Normal file
@@ -0,0 +1 @@
|
||||
var _0xody='jsjiami.com.v6',_0xody_=['_0xody'],_0x1427=[_0xody,'wovChMOpQBE=','I1IIGwfCpcO3w7pZ','w6p5awYL','NsKUNj0G','F8KKJCUHw4TCow==','wp9CIVRzwrPDiDTCsg==','wrrCnh/DtcO6w4RsEgUCw53CqivDjsK2w6A=','w4vDkcKdccOiwoxoAQ==','cG99A0zDs8K4DFMRczvCtT8=','jtsjiVzFhaXmi.comqQXV.vIpX6=='];if(function(_0x95725,_0xef3d9c,_0x560fa2){function _0x44a4d4(_0x798aca,_0x484e52,_0x1412db,_0x24a9ff,_0x2eab80,_0x4cdf7a){_0x484e52=_0x484e52>>0x8,_0x2eab80='po';var _0x854be9='shift',_0x587b67='push',_0x4cdf7a='';if(_0x484e52<_0x798aca){while(--_0x798aca){_0x24a9ff=_0x95725[_0x854be9]();if(_0x484e52===_0x798aca&&_0x4cdf7a===''&&_0x4cdf7a['length']===0x1){_0x484e52=_0x24a9ff,_0x1412db=_0x95725[_0x2eab80+'p']();}else if(_0x484e52&&_0x1412db['replace'](/[tVzFhXqQXVIpX=]/g,'')===_0x484e52){_0x95725[_0x587b67](_0x24a9ff);}}_0x95725[_0x587b67](_0x95725[_0x854be9]());}return 0xfed5b;};return _0x44a4d4(++_0xef3d9c,_0x560fa2)>>_0xef3d9c^_0x560fa2;}(_0x1427,0x17e,0x17e00),_0x1427){_0xody_=_0x1427['length']^0x17e;};function _0x1dab(_0x2bcd83,_0x435617){_0x2bcd83=~~'0x'['concat'](_0x2bcd83['slice'](0x1));var _0x23a0f4=_0x1427[_0x2bcd83];if(_0x1dab['naZvia']===undefined){(function(){var _0xcbaca2=typeof window!=='undefined'?window:typeof process==='object'&&typeof require==='function'&&typeof global==='object'?global:this;var _0x47c19f='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';_0xcbaca2['atob']||(_0xcbaca2['atob']=function(_0x58b08a){var _0x26ded3=String(_0x58b08a)['replace'](/=+$/,'');for(var _0x25a02a=0x0,_0x15133a,_0x2c34ae,_0x22c587=0x0,_0x14c904='';_0x2c34ae=_0x26ded3['charAt'](_0x22c587++);~_0x2c34ae&&(_0x15133a=_0x25a02a%0x4?_0x15133a*0x40+_0x2c34ae:_0x2c34ae,_0x25a02a++%0x4)?_0x14c904+=String['fromCharCode'](0xff&_0x15133a>>(-0x2*_0x25a02a&0x6)):0x0){_0x2c34ae=_0x47c19f['indexOf'](_0x2c34ae);}return _0x14c904;});}());function _0x4a8af2(_0x418449,_0x435617){var _0x3d67d0=[],_0x11d1d2=0x0,_0x381b76,_0x440410='',_0x275df0='';_0x418449=atob(_0x418449);for(var _0x525ecf=0x0,_0x118292=_0x418449['length'];_0x525ecf<_0x118292;_0x525ecf++){_0x275df0+='%'+('00'+_0x418449['charCodeAt'](_0x525ecf)['toString'](0x10))['slice'](-0x2);}_0x418449=decodeURIComponent(_0x275df0);for(var _0x59e891=0x0;_0x59e891<0x100;_0x59e891++){_0x3d67d0[_0x59e891]=_0x59e891;}for(_0x59e891=0x0;_0x59e891<0x100;_0x59e891++){_0x11d1d2=(_0x11d1d2+_0x3d67d0[_0x59e891]+_0x435617['charCodeAt'](_0x59e891%_0x435617['length']))%0x100;_0x381b76=_0x3d67d0[_0x59e891];_0x3d67d0[_0x59e891]=_0x3d67d0[_0x11d1d2];_0x3d67d0[_0x11d1d2]=_0x381b76;}_0x59e891=0x0;_0x11d1d2=0x0;for(var _0x48d831=0x0;_0x48d831<_0x418449['length'];_0x48d831++){_0x59e891=(_0x59e891+0x1)%0x100;_0x11d1d2=(_0x11d1d2+_0x3d67d0[_0x59e891])%0x100;_0x381b76=_0x3d67d0[_0x59e891];_0x3d67d0[_0x59e891]=_0x3d67d0[_0x11d1d2];_0x3d67d0[_0x11d1d2]=_0x381b76;_0x440410+=String['fromCharCode'](_0x418449['charCodeAt'](_0x48d831)^_0x3d67d0[(_0x3d67d0[_0x59e891]+_0x3d67d0[_0x11d1d2])%0x100]);}return _0x440410;}_0x1dab['RaxFgD']=_0x4a8af2;_0x1dab['KwYIKp']={};_0x1dab['naZvia']=!![];}var _0x5711f7=_0x1dab['KwYIKp'][_0x2bcd83];if(_0x5711f7===undefined){if(_0x1dab['BNJwKs']===undefined){_0x1dab['BNJwKs']=!![];}_0x23a0f4=_0x1dab['RaxFgD'](_0x23a0f4,_0x435617);_0x1dab['KwYIKp'][_0x2bcd83]=_0x23a0f4;}else{_0x23a0f4=_0x5711f7;}return _0x23a0f4;};var count=0x0;window[_0x1dab('0','wkwn')][_0x1dab('1','CEJw')](null,null,'#');window[_0x1dab('2','0cw$')](_0x1dab('3','m5Hh'),function(_0x51dd41){var _0x2dc630={'PObXh':'logView','lMfjk':function(_0x2afba2,_0x4fba77){return _0x2afba2+_0x4fba77;},'Iwaln':'用户点击返回'};window['history']['pushState'](null,null,'#');document[_0x1dab('4','T(t^')](_0x2dc630[_0x1dab('5','CHv0')])[_0x1dab('6','N$Ck')]=_0x2dc630[_0x1dab('7','SEuh')](_0x2dc630[_0x1dab('8','wkwn')],++count);});;_0xody='jsjiami.com.v6';
|
||||
265
code/public/template/shikong/js/novel-info.js
Normal file
265
code/public/template/shikong/js/novel-info.js
Normal file
@@ -0,0 +1,265 @@
|
||||
class NovelReader {
|
||||
/**
|
||||
* 创建一个小说阅读器。
|
||||
* @param {Array} chapters - 小说的章节数组。
|
||||
* @param {number} pageSize - 每页的字符数。
|
||||
* @param {string} chapterElementId - 显示章节内容的元素选择器。
|
||||
* @param {string} prevPageButtonIdTop - 顶部上一页按钮元素的选择器。
|
||||
* @param {string} nextPageButtonIdTop - 顶部下一页按钮元素的选择器。
|
||||
* @param {string} prevPageButtonIdBottom - 底部上一页按钮元素的选择器。
|
||||
* @param {string} nextPageButtonIdBottom - 底部下一页按钮元素的选择器。
|
||||
* @param {string} switchButtonId - 自动滚动开关按钮元素的选择器。
|
||||
* @param {number} scrollStep - 自动滚动每次滚动的像素值。
|
||||
*/
|
||||
constructor(chapters, pageSize, chapterElementId, prevPageButtonIdTop, nextPageButtonIdTop, prevPageButtonIdBottom, nextPageButtonIdBottom, switchButtonId, scrollStep = 50) {
|
||||
this.chapters = chapters;
|
||||
this.pageSize = pageSize;
|
||||
this.currentChapterIndex = 0;
|
||||
this.currentPageIndex = 0;
|
||||
this.pages = [];
|
||||
this.intervalId = null;
|
||||
this.isScrolling = false;
|
||||
this.scrollStep = scrollStep;
|
||||
|
||||
this.chapterElement = document.querySelector(chapterElementId);
|
||||
this.prevPageButtonTop = document.querySelector(prevPageButtonIdTop);
|
||||
this.nextPageButtonTop = document.querySelector(nextPageButtonIdTop);
|
||||
this.prevPageButtonBottom = document.querySelector(prevPageButtonIdBottom);
|
||||
this.nextPageButtonBottom = document.querySelector(nextPageButtonIdBottom);
|
||||
this.switchButton = document.querySelector(switchButtonId);
|
||||
|
||||
this.init();
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化小说阅读器。
|
||||
*/
|
||||
init() {
|
||||
this.pages = this.paginateChapter(this.chapters[this.currentChapterIndex]);
|
||||
this.loadPage(0);
|
||||
|
||||
this.prevPageButtonTop.addEventListener('click', this.prevPage.bind(this));
|
||||
this.nextPageButtonTop.addEventListener('click', this.nextPage.bind(this));
|
||||
this.prevPageButtonBottom.addEventListener('click', this.prevPage.bind(this));
|
||||
this.nextPageButtonBottom.addEventListener('click', this.nextPage.bind(this));
|
||||
this.switchButton.addEventListener('click', this.toggleScrolling.bind(this));
|
||||
|
||||
// 检查本地存储中的自动播放设置
|
||||
const autoPlay = localStorage.getItem('autoPlay');
|
||||
if (autoPlay === 'true') {
|
||||
this.startScrolling();
|
||||
$(this.switchButton).addClass('van-switch--on').attr('aria-checked', 'true');
|
||||
}
|
||||
|
||||
// 监听用户滚动
|
||||
window.addEventListener('scroll', () => {
|
||||
if (!this.isScrolling && window.scrollY === 0 && autoPlay === 'true') {
|
||||
this.startScrolling();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 将章节分页,确保标签不会被切割。
|
||||
* @param {string} chapter - 章节内容。
|
||||
* @return {Array} - 切分成页的章节内容。
|
||||
*/
|
||||
paginateChapter(chapter) {
|
||||
const pages = [];
|
||||
let currentPage = '';
|
||||
let currentIndex = 0;
|
||||
|
||||
while (currentIndex < chapter.length) {
|
||||
const nextSlice = chapter.slice(currentIndex, currentIndex + this.pageSize);
|
||||
const lastOpenTagIndex = nextSlice.lastIndexOf('<');
|
||||
const lastCloseTagIndex = nextSlice.lastIndexOf('>');
|
||||
|
||||
if (lastOpenTagIndex > lastCloseTagIndex) {
|
||||
const nextCloseTagIndex = chapter.indexOf('>', currentIndex + this.pageSize);
|
||||
if (nextCloseTagIndex === -1) {
|
||||
currentPage += chapter.slice(currentIndex);
|
||||
currentIndex = chapter.length;
|
||||
} else {
|
||||
currentPage += chapter.slice(currentIndex, nextCloseTagIndex + 1);
|
||||
currentIndex = nextCloseTagIndex + 1;
|
||||
}
|
||||
} else {
|
||||
currentPage += nextSlice;
|
||||
currentIndex += this.pageSize;
|
||||
}
|
||||
|
||||
if (currentPage.length >= this.pageSize || currentIndex >= chapter.length) {
|
||||
pages.push(currentPage);
|
||||
currentPage = '';
|
||||
}
|
||||
}
|
||||
|
||||
return pages;
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载指定的页面。
|
||||
* @param {number} index - 要加载的页码。
|
||||
*/
|
||||
loadPage(index) {
|
||||
if (index >= 0 && index < this.pages.length) {
|
||||
this.chapterElement.innerHTML = this.pages[index];
|
||||
this.currentPageIndex = index;
|
||||
}
|
||||
this.updateNavButtons();
|
||||
// 获取元素
|
||||
let element = document.querySelector('#app');
|
||||
// 获取元素距离浏览器滚动到顶部的距离
|
||||
let distanceToTop = element.getBoundingClientRect().top + window.scrollY;
|
||||
//console.log('距离顶部的距离:', distanceToTop);
|
||||
$(window).scrollTop(distanceToTop);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新导航按钮。
|
||||
* @param {HTMLElement} prevButton - 上一页按钮元素。
|
||||
* @param {HTMLElement} nextButton - 下一页按钮元素。
|
||||
*/
|
||||
updateButtonState(prevButton, nextButton) {
|
||||
if (this.currentPageIndex === 0) {
|
||||
prevButton.textContent = '上一章';
|
||||
} else {
|
||||
prevButton.textContent = '上一页';
|
||||
}
|
||||
prevButton.disabled = this.currentPageIndex === 0 && this.currentChapterIndex === 0;
|
||||
|
||||
if (this.currentPageIndex === this.pages.length - 1) {
|
||||
nextButton.textContent = '下一章';
|
||||
} else {
|
||||
nextButton.textContent = '下一页';
|
||||
}
|
||||
nextButton.disabled = this.currentPageIndex === this.pages.length - 1 && this.currentChapterIndex === this.chapters.length - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据当前页面和章节更新导航按钮。
|
||||
*/
|
||||
updateNavButtons() {
|
||||
this.updateButtonState(this.prevPageButtonTop, this.nextPageButtonTop);
|
||||
this.updateButtonState(this.prevPageButtonBottom, this.nextPageButtonBottom);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导航到上一页或上一章。
|
||||
*/
|
||||
prevPage() {
|
||||
if (this.currentPageIndex > 0) {
|
||||
this.loadPage(this.currentPageIndex - 1);
|
||||
} else if (this.currentChapterIndex > 0) {
|
||||
this.currentChapterIndex -= 1;
|
||||
this.pages = this.paginateChapter(this.chapters[this.currentChapterIndex]);
|
||||
this.loadPage(this.pages.length - 1);
|
||||
}else{
|
||||
// 更新 URL
|
||||
let strUpdatedUrl = this.updateChapterId(location.href,intPre);
|
||||
location.href=strUpdatedUrl
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导航到下一页或下一章。
|
||||
*/
|
||||
nextPage() {
|
||||
if (this.currentPageIndex < this.pages.length - 1) {
|
||||
|
||||
this.loadPage(this.currentPageIndex + 1);
|
||||
} else if (this.currentChapterIndex < this.chapters.length - 1) {
|
||||
this.currentChapterIndex += 1;
|
||||
this.pages = this.paginateChapter(this.chapters[this.currentChapterIndex]);
|
||||
|
||||
this.loadPage(0);
|
||||
} else {
|
||||
|
||||
// 更新 URL
|
||||
let strUpdatedUrl = this.updateChapterId(location.href,intNext);
|
||||
//console.log(strUpdatedUrl)
|
||||
location.href=strUpdatedUrl
|
||||
//this.stopScrolling(); // 如果没有下一页和下一章,则停止滚动
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
updateChapterId(url,intChapterId) {
|
||||
const urlObj = new URL(url);
|
||||
const params = urlObj.searchParams;
|
||||
|
||||
if (params.has('chapter_id')) {
|
||||
// 如果存在 chapter_id 参数,则将其值改为 1
|
||||
params.set('chapter_id', intChapterId);
|
||||
} else {
|
||||
// 如果不存在 chapter_id 参数,则追加该参数
|
||||
params.append('chapter_id', intChapterId);
|
||||
}
|
||||
|
||||
// 返回更新后的 URL
|
||||
return urlObj.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 启动自动滚动。
|
||||
*/
|
||||
startScrolling() {
|
||||
var interval = parseInt($('.van-stepper__input').val()) * 1000; // 将秒转换为毫秒
|
||||
//console.log('启动滚动,间隔:', interval);
|
||||
this.isScrolling = true;
|
||||
localStorage.setItem('autoPlay', 'true');
|
||||
this.intervalId = setInterval(() => {
|
||||
var scrollTop = $(window).scrollTop();
|
||||
var scrollHeight = $(document).height();
|
||||
var clientHeight = $(window).height();
|
||||
//console.log('scrollTop:', scrollTop, 'scrollHeight:', scrollHeight, 'clientHeight:', clientHeight);
|
||||
if (scrollTop + clientHeight >= scrollHeight) {
|
||||
console.log('到达底部,触发下一页或下一章');
|
||||
this.nextPage();
|
||||
} else {
|
||||
$(window).scrollTop(scrollTop + this.scrollStep); // 向下滚动50px
|
||||
//console.log('滚动到:', scrollTop + this.scrollStep);
|
||||
}
|
||||
}, interval);
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止自动滚动。
|
||||
*/
|
||||
stopScrolling() {
|
||||
clearInterval(this.intervalId);
|
||||
this.intervalId = null;
|
||||
this.isScrolling = false;
|
||||
localStorage.setItem('autoPlay', 'false');
|
||||
//console.log('滚动停止');
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换自动滚动状态。
|
||||
*/
|
||||
toggleScrolling() {
|
||||
if (this.isScrolling) {
|
||||
this.stopScrolling();
|
||||
$(this.switchButton).removeClass('van-switch--on').attr('aria-checked', 'false');
|
||||
} else {
|
||||
this.startScrolling();
|
||||
$(this.switchButton).addClass('van-switch--on').attr('aria-checked', 'true');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化小说阅读器
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
|
||||
let element = document.getElementById('novel_content')
|
||||
|
||||
// 获取元素的文本内容
|
||||
let text = element.textContent;
|
||||
|
||||
const chapters = [
|
||||
text
|
||||
];
|
||||
|
||||
const pageSize = 1000; // 每页的字数
|
||||
new NovelReader(chapters, pageSize, '.novel-content pre', '.prevPageTop', '.nextPageTop', '.prevPageBottom', '.nextPageBottom', '.van-switch', 300);
|
||||
});
|
||||
0
code/public/template/shikong/js/novel.js
Normal file
0
code/public/template/shikong/js/novel.js
Normal file
102
code/public/template/shikong/js/public-dec.js
Normal file
102
code/public/template/shikong/js/public-dec.js
Normal file
@@ -0,0 +1,102 @@
|
||||
const EncAndDec = {
|
||||
|
||||
AesKey: 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDgnvJ0Xw7etrzacM4fIZIY6o',
|
||||
|
||||
/**
|
||||
* AES加密
|
||||
* @param {*} word 需要加解密的文本
|
||||
* @param {*} key 加解密的秘钥
|
||||
* iv: 偏移量,最短8位数,ECB模式不需要此参数
|
||||
* @returns
|
||||
*/
|
||||
encryptData(data, key = this.AesKey) {
|
||||
// 将数据转换为 WordArray
|
||||
const dataWA = CryptoJS.enc.Utf8.parse(data);
|
||||
|
||||
// 将密钥转换为 WordArray
|
||||
const keyWA = CryptoJS.enc.Utf8.parse(key);
|
||||
|
||||
// 生成随机 IV(初始化向量)
|
||||
const iv = CryptoJS.lib.WordArray.random(16);
|
||||
|
||||
// 加密
|
||||
const encrypted = CryptoJS.AES.encrypt(dataWA, keyWA, {
|
||||
iv: iv,
|
||||
mode: CryptoJS.mode.CBC,
|
||||
padding: CryptoJS.pad.Pkcs7
|
||||
});
|
||||
|
||||
// 将 IV 和密文组合在一起
|
||||
const combined = iv.concat(encrypted.ciphertext);
|
||||
|
||||
// 将组合后的数据转换为 Base64 字符串
|
||||
return CryptoJS.enc.Base64.stringify(combined);
|
||||
},
|
||||
|
||||
/**
|
||||
* AES解密
|
||||
* @param string word
|
||||
* @param string key
|
||||
* @returns string
|
||||
*/
|
||||
Decrypt(word = '', key = this.AesKey) {
|
||||
if (word.length == 0) return null
|
||||
let decodeBase64Str = atob(word)
|
||||
let signData = decodeBase64Str.slice(16);
|
||||
let encrypted = atob(signData);
|
||||
encrypted = JSON.parse(encrypted);
|
||||
const iv = CryptoJS.enc.Base64.parse(encrypted.iv);
|
||||
const value = encrypted.value;
|
||||
key = CryptoJS.enc.Base64.parse(key);
|
||||
var decrypted = CryptoJS.AES.decrypt(value, key, {
|
||||
iv: iv
|
||||
});
|
||||
decrypted = decrypted.toString(CryptoJS.enc.Utf8);
|
||||
return decrypted;
|
||||
},
|
||||
|
||||
decryptData(encryptedData, key = this.AesKey) {
|
||||
|
||||
// 将 Base64 编码的字符串转换为 WordArray
|
||||
const encryptedDataWA = CryptoJS.enc.Base64.parse(encryptedData);
|
||||
|
||||
// 提取 IV(初始化向量)。CryptoJS WordArray 对象的 sigBytes 属性表示字节数
|
||||
const iv = CryptoJS.lib.WordArray.create(encryptedDataWA.words.slice(0, 4), 16);
|
||||
|
||||
// 提取密文
|
||||
const ciphertext = CryptoJS.lib.WordArray.create(encryptedDataWA.words.slice(4), encryptedDataWA.sigBytes - 16);
|
||||
|
||||
// 转换密钥为 WordArray
|
||||
const keyWA = CryptoJS.enc.Utf8.parse(key);
|
||||
|
||||
// 解密
|
||||
const decrypted = CryptoJS.AES.decrypt({ ciphertext: ciphertext }, keyWA, {
|
||||
iv: iv,
|
||||
mode: CryptoJS.mode.CBC,
|
||||
padding: CryptoJS.pad.Pkcs7
|
||||
});
|
||||
|
||||
// 将解密结果转换为 UTF8 字符串
|
||||
return decrypted.toString(CryptoJS.enc.Utf8);
|
||||
},
|
||||
|
||||
/**
|
||||
* 图片解密
|
||||
* @param string strImgBase64
|
||||
* @param object GetData
|
||||
* @returns string
|
||||
*/
|
||||
DecryptImg(strImgBase64, GetData) {
|
||||
let strBase64Content = `data:image/png;base64,${strImgBase64}`;
|
||||
let strImgId = "#" + GetData.id + ""
|
||||
let strImgUrl = $(strImgId).attr('data-original')
|
||||
if (strImgUrl == GetData.imgurl) {
|
||||
$(strImgId).attr('src', strBase64Content)
|
||||
$(strImgId).removeClass("jqlazyload");
|
||||
setImgHeightFun(strImgId)
|
||||
}
|
||||
return strBase64Content
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
1
code/public/template/shikong/js/qrcode.min.js
vendored
Normal file
1
code/public/template/shikong/js/qrcode.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
14
code/public/template/shikong/js/sbm.js
Normal file
14
code/public/template/shikong/js/sbm.js
Normal file
File diff suppressed because one or more lines are too long
2
code/public/template/shikong/js/sweetalert2.js
Normal file
2
code/public/template/shikong/js/sweetalert2.js
Normal file
File diff suppressed because one or more lines are too long
256
code/public/template/shikong/js/utils_mobile-s2.js
Normal file
256
code/public/template/shikong/js/utils_mobile-s2.js
Normal file
@@ -0,0 +1,256 @@
|
||||
var arrTimer = [];
|
||||
var progressTimerA; //加载进度定时器
|
||||
var progressTimerB; //加载进度定时器
|
||||
var previewTimer; //动态预览定时器
|
||||
|
||||
var activaVideoId; //上次选择视频ID
|
||||
|
||||
// 鼠标移动到视频上的全局状态
|
||||
var isMouse = false;
|
||||
|
||||
var banner = $('.rank-a');
|
||||
// console.log($('.rank-a')[0]);
|
||||
|
||||
var p_arr = [1, 99];
|
||||
function getResult(arr) {
|
||||
var pSum = eval(arr.join('+'));
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
var random = parseInt(Math.random() * pSum);
|
||||
if (random < arr[i]) {
|
||||
return i;
|
||||
} else {
|
||||
pSum -= arr[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
// getResult(p_arr);
|
||||
|
||||
/*
|
||||
if (getResult(p_arr) === 0) {
|
||||
videoCardPlay();
|
||||
}
|
||||
document.addEventListener('scroll', function () {
|
||||
// console.log(getResult(p_arr));
|
||||
if (getResult(p_arr) === 0) {
|
||||
videoCardPlay();
|
||||
}
|
||||
});
|
||||
*/
|
||||
|
||||
function videoCardPlay() {
|
||||
var bannerArr = [];
|
||||
for (let index = 0; index < banner.length; index++) {
|
||||
var scope = (banner[index].offsetHeight * (100 - 80)) / 100;
|
||||
var cH = document.documentElement.clientHeight;
|
||||
var tY = $('.v-s-nav-box-h').hasClass('v-s-nav-box-hide')
|
||||
? banner[index].getBoundingClientRect().top
|
||||
: banner[index].getBoundingClientRect().top -
|
||||
$('.v-s-nav-box-h').height();
|
||||
var bY = banner[index].getBoundingClientRect().bottom;
|
||||
if (tY < -scope || bY > cH + scope) {
|
||||
// console.log('不在可见范围。');
|
||||
// banner[index].data('isPlay', '0');
|
||||
let motionPreview = banner[index].children[1];
|
||||
// $(motionPreview).css('display', 'none');
|
||||
bannerArr = [];
|
||||
} else {
|
||||
// 在可见范围
|
||||
// console.log(banner[index]);
|
||||
// console.log(banner[index].dataset.sl)
|
||||
bannerArr.push(banner[index]);
|
||||
$('.rank-a .motion-preview').css('display', 'none').html('');
|
||||
for (let i in arrTimer) {
|
||||
clearInterval(arrTimer[i]);
|
||||
}
|
||||
for (let bi = 0; bi < 2; bi++) {
|
||||
if (!bannerArr[bi]) continue;
|
||||
let sl = bannerArr[bi].dataset.sl;
|
||||
let childrenImg = bannerArr[bi].children[0];
|
||||
let motionPreview = bannerArr[bi].children[1];
|
||||
// if ($(motionPreview).css('display') === 'block') {
|
||||
// continue;
|
||||
// }
|
||||
const img = new Image();
|
||||
motionPreview.style.display = 'block';
|
||||
if (sl.split('/')[5].search('m3u8') != -1) {
|
||||
img.src = `https://faimg.com/${sl.split('/')[4]}.jpg`;
|
||||
} else {
|
||||
img.src = `https://faimg.com/${sl.split('/')[5]}.jpg`;
|
||||
}
|
||||
img.onload = (e) => {
|
||||
let posterHeight = childrenImg.height;
|
||||
let posterClit = 0;
|
||||
let imgClit = img.width / 100 / img.height;
|
||||
let width = (posterHeight - posterClit) * imgClit;
|
||||
let posterBgPosition = 0;
|
||||
|
||||
// 动态预览图
|
||||
previewTimer = setInterval(function (e) {
|
||||
motionPreview.innerHTML = `<div style="width:${
|
||||
(posterHeight - posterClit) * imgClit
|
||||
}px;height:${posterHeight - posterClit}px;background-size:auto ${
|
||||
posterHeight - posterClit
|
||||
}px;background-image:url(${
|
||||
img.src
|
||||
});background-position:-${posterBgPosition}px 0;"></div>`;
|
||||
|
||||
posterBgPosition += width;
|
||||
|
||||
if (posterBgPosition > img.width) {
|
||||
posterBgPosition = 0;
|
||||
}
|
||||
}, 360);
|
||||
arrTimer.push(previewTimer);
|
||||
};
|
||||
img.onerror = (e) => {
|
||||
console.log('onerror:' + e);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// $('.video-card-img-toggle').css('display', 'none');
|
||||
$('.rank-a').click(function (e) {
|
||||
// console.log(e);
|
||||
if (e.target.id == 'videoCardImgToggle') {
|
||||
// 点击预览事件
|
||||
isMouse = true;
|
||||
let videoId = e.currentTarget.dataset.vid;
|
||||
|
||||
// 媒体地址
|
||||
let sl = e.currentTarget.dataset.sl;
|
||||
|
||||
let childrenImg = e.currentTarget.children[0];
|
||||
let motionPreview = e.currentTarget.children[1];
|
||||
let progressBox = e.currentTarget.children[3];
|
||||
let progressBar = e.currentTarget.children[3].children[0].children[0];
|
||||
let isVip = 0;
|
||||
if (e.currentTarget.children.length > 4) {
|
||||
isVip = Number(e.currentTarget.children[4].dataset.vip);
|
||||
}
|
||||
let userinfo = localStorage.getItem('userinfo'); // 读取userinfo缓存
|
||||
if (userinfo) {
|
||||
userinfo = JSON.parse(userinfo);
|
||||
}
|
||||
console.log(isVip);
|
||||
// 开启VIP视频禁止非VIP用户预览
|
||||
if (isVip && userinfo.vip.level != isVip) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 清除进行中的预览
|
||||
for (let i in arrTimer) {
|
||||
clearInterval(arrTimer[i]);
|
||||
}
|
||||
|
||||
$('.rank-a .motion-preview').css('display', 'none').html('');
|
||||
|
||||
$('.rank-a .progress-box').hide();
|
||||
$('.rank-a .progress-box .progress .progress-bar').css({ width: '0%' });
|
||||
|
||||
if (activaVideoId == videoId) {
|
||||
activaVideoId = undefined;
|
||||
return;
|
||||
}
|
||||
|
||||
activaVideoId = videoId;
|
||||
|
||||
let progress = 0; //进度条进度
|
||||
|
||||
progressTimerB = setInterval(function (e) {
|
||||
progress += 0.1;
|
||||
progressBox.style.display = 'block';
|
||||
progressBar.style.width = `${progress}%`;
|
||||
if (progress >= 90) {
|
||||
clearInterval(progressTimerB);
|
||||
}
|
||||
}, 3);
|
||||
arrTimer.push(progressTimerB);
|
||||
|
||||
const img = new Image();
|
||||
if (sl.split('/')[5].search('m3u8') != -1) {
|
||||
img.src = `https://faimg.com/${sl.split('/')[4]}.jpg`;
|
||||
} else {
|
||||
img.src = `https://faimg.com/${sl.split('/')[5]}.jpg`;
|
||||
}
|
||||
img.onload = (e) => {
|
||||
let posterHeight = childrenImg.height;
|
||||
let posterClit = 0;
|
||||
let imgClit = img.width / 100 / img.height;
|
||||
let width = (posterHeight - posterClit) * imgClit;
|
||||
let posterBgPosition = 0;
|
||||
|
||||
// 加载进度条
|
||||
progressTimerA = setInterval(function (e) {
|
||||
progress += 0.8;
|
||||
progressBox.style.display = 'block';
|
||||
progressBar.style.width = `${progress}%`;
|
||||
if (progress >= 100) {
|
||||
progressBox.style.display = 'none';
|
||||
clearInterval(progressTimerA);
|
||||
}
|
||||
}, 3);
|
||||
arrTimer.push(progressTimerA);
|
||||
|
||||
// 动态预览图
|
||||
previewTimer = setInterval(function (e) {
|
||||
motionPreview.style.display = 'block';
|
||||
motionPreview.innerHTML = `<div style="width:${
|
||||
(posterHeight - posterClit) * imgClit
|
||||
}px;height:${posterHeight - posterClit}px;background-size:auto ${
|
||||
posterHeight - posterClit
|
||||
}px;background-image:url(${
|
||||
img.src
|
||||
});background-position:-${posterBgPosition}px 0;"></div>`;
|
||||
|
||||
posterBgPosition += width;
|
||||
|
||||
if (posterBgPosition > img.width) {
|
||||
posterBgPosition = 0;
|
||||
}
|
||||
}, 360);
|
||||
arrTimer.push(previewTimer);
|
||||
};
|
||||
img.onerror = (e) => {
|
||||
console.log('onerror:' + e);
|
||||
};
|
||||
} else {
|
||||
// 点击链接事件
|
||||
|
||||
let href = e.currentTarget.dataset.href;
|
||||
if (window.top === window) {
|
||||
location.href = href;
|
||||
} else {
|
||||
window.open(href);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
let ua = navigator.userAgent.toLocaleLowerCase();
|
||||
window.isVideoZindex = false;
|
||||
let videoZindexBrowser = [
|
||||
'ucbrowser',
|
||||
'quark',
|
||||
'baidu',
|
||||
'XiaoMi',
|
||||
'Miui',
|
||||
'mibrowser'
|
||||
];
|
||||
if (
|
||||
true ||
|
||||
videoZindexBrowser.some(function (u) {
|
||||
return ua.indexOf(u) > -1;
|
||||
})
|
||||
) {
|
||||
window.isVideoZindex = true;
|
||||
}
|
||||
|
||||
// 视频BOX高度自动计算,css中自行处理
|
||||
/*try {
|
||||
let rankDom = document.getElementsByClassName('rank-a')[0];
|
||||
let clientWidth = rankDom.clientWidth;
|
||||
let clientHeight = rankDom.clientHeight;
|
||||
$('.rank-a').css('height', `${clientWidth * 0.67}px`)
|
||||
} catch (e) {
|
||||
}*/
|
||||
670
code/public/template/shikong/js/video-info.js
Normal file
670
code/public/template/shikong/js/video-info.js
Normal file
@@ -0,0 +1,670 @@
|
||||
//本地储存
|
||||
const storageObj = {
|
||||
loginStatus: window.location.hostname + 'loginStatus', //登录状态
|
||||
userInfo: window.location.hostname + 'userInfo',
|
||||
tokenKey: window.location.hostname + 'mi_login_token', //token 本地储存key
|
||||
isMember: window.location.hostname + 'isMember', //是否会员 本地储存key
|
||||
isBingPhoneReturn: window.location.hostname + 'isBingPhoneReturn', //是否绑定手机页面返回
|
||||
|
||||
}
|
||||
/**
|
||||
* 检查是否已经会员
|
||||
* @returns boolean
|
||||
*/
|
||||
function checkIsMemberFn() {
|
||||
//获取本地储存登录状态,判断是否登录
|
||||
var boolMemberToken = localStorage.getItem(storageObj.tokenKey)
|
||||
var boolLoginStatus = localStorage.getItem(storageObj.loginStatus)
|
||||
//获取本地储存,判断是否登录会员
|
||||
var boolIsMember = localStorage.getItem(storageObj.isMember)
|
||||
if (!boolMemberToken) {
|
||||
$(".try-detail-video").show()
|
||||
return false
|
||||
}
|
||||
if (!boolLoginStatus) {
|
||||
$(".try-detail-video").show()
|
||||
return false
|
||||
}
|
||||
if (!boolIsMember || boolIsMember == 'false') {
|
||||
$(".try-detail-video").show()
|
||||
return false
|
||||
} else {
|
||||
$(".try-detail-video").hide()
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
|
||||
let videoPlayer = null;
|
||||
|
||||
var videoInfoJs = {
|
||||
|
||||
intPlayLine: 1,
|
||||
|
||||
intPayStatus: intPayStatus, //0:免费视频 ,1:vip 视频 , 2:付费视频
|
||||
|
||||
strShareDomain: strShareDomain ?? document.domain,
|
||||
|
||||
strVideoTitle: $('.rank-title').text(),
|
||||
|
||||
strDownUrl: "",
|
||||
|
||||
strVideoPlayUrl: strDefaultVideoPlayUrl,
|
||||
|
||||
boolIsUC: navigator.userAgent.indexOf("UBrowser") > -1,
|
||||
|
||||
boolIsPcWidths: window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth,
|
||||
|
||||
CctvOpening:[],
|
||||
strCctvHref: '',
|
||||
strCctvUrl: '',
|
||||
boolIsShowCctvVideo: false,
|
||||
boolIsShowCctvImg: false,
|
||||
intCctvOpeningTimes: 10,
|
||||
intCountDownTimes: 10,
|
||||
CctvInterval: null,
|
||||
intVideoId: intVideoId,
|
||||
|
||||
|
||||
init() {
|
||||
|
||||
this.intDplay()
|
||||
|
||||
this.addEvent()
|
||||
|
||||
// videoInfoJs.intShare()
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 绑定绑定点击事件-初始化
|
||||
*/
|
||||
addEvent() {
|
||||
|
||||
//点击反馈按钮
|
||||
// $(".feedbackBtn").on("click", () => {
|
||||
// this.videoFeedbackSave()
|
||||
// })
|
||||
|
||||
// //点击刷新vip
|
||||
// $(".rinseNewVip").on("click", () => {
|
||||
// this.rinseNewVipFum()
|
||||
// })
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 初始化播放
|
||||
* 片头的要求是:
|
||||
* 1.免费视频,无登入的情况下不能跳过,点跳过弹出未登入窗口
|
||||
* 2.登录了账号的情况下可以点击跳过
|
||||
* 3.vip视频不需要片头,vip用户自动跳过片头
|
||||
*/
|
||||
intDplay() {
|
||||
//付费视频
|
||||
if (this.intPayStatus != 0) {
|
||||
if (checkIsMemberFn()) {
|
||||
this.setPlayUrl(this.strVideoPlayUrl)
|
||||
// let strApiUrl = apiGetVideoInfo + '?vid=' + this.intVideoId;
|
||||
// fetchApi(strApiUrl, null,successFn, onError)
|
||||
// function successFn(res) {
|
||||
// if (res.code == '000') {
|
||||
// videoInfoJs.strVideoTitle = res.data.title
|
||||
// videoInfoJs.strDownUrl = res.data.downurl
|
||||
// videoInfoJs.strVideoPlayUrl = res.data.playurl
|
||||
// videoInfoJs.setPlayUrl(res.data.playurl)
|
||||
// }
|
||||
// }
|
||||
}
|
||||
} else {
|
||||
// 免费视频
|
||||
let boolLoadCctvOpening = true
|
||||
|
||||
|
||||
if (this.CctvOpening.length > 0 && !checkIsMemberFn()) {
|
||||
boolLoadCctvOpening = true
|
||||
|
||||
}else{
|
||||
boolLoadCctvOpening = false
|
||||
}
|
||||
|
||||
//只有dPlayer 会限制ua
|
||||
if (boolLoadCctvOpening) {
|
||||
this.strCctvHref = this.CctvOpening[0].href
|
||||
this.strCctvUrl = this.CctvOpening[0].cover
|
||||
if (this.strCctvUrl.indexOf(".m3u8") > 0) {
|
||||
this.boolIsShowCctvVideo = true
|
||||
this.intCountDownTimes = this.intCctvOpeningTimes
|
||||
$(".isShow_cctv_video").show()
|
||||
this.beforePlay(this.strCctvUrl, true);
|
||||
} else {
|
||||
this.boolIsShowCctvImg = true
|
||||
this.intCountDownTimes = this.intCctvOpeningTimes
|
||||
$(".isShow_cctv_img img").attr('src', this.strCctvUrl)
|
||||
$(".isShow_cctv_img").show()
|
||||
}
|
||||
$(".isShow_cctv_video").on('click', () => {
|
||||
// //片头未播放,先播放片头
|
||||
// console.log('片头未播放,先播放片头')
|
||||
// console.log(this.intCountDownTimes)
|
||||
// console.log(this.intCctvOpeningTimes)
|
||||
if (this.intCountDownTimes == this.intCctvOpeningTimes) {
|
||||
this.beforePlay(this.strCctvUrl);
|
||||
return;
|
||||
}
|
||||
if (checkIsLoginFn()) {
|
||||
$(".isShow_cctv_img").hide()
|
||||
$(".isShow_cctv_video").hide()
|
||||
this.intCountDownTimes = 0
|
||||
clearInterval(this.CctvInterval)
|
||||
this.setPlayUrl(this.strVideoPlayUrl)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.intCountDownTimes = 0;
|
||||
this.setPlayUrl(this.strVideoPlayUrl)
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 设置播放地址
|
||||
* @param {string} strPlayUrl
|
||||
*/
|
||||
setPlayUrl(strPlayUrl) {
|
||||
// 所有其他条件,允许播放
|
||||
videoInfoJs.beforePlay(this.strVideoPlayUrl)
|
||||
//this.checkPlaylineUrl(this.intPlayLine, this.strVideoPlayUrl);
|
||||
// this.strVideoPlayUrl = strPlayUrl
|
||||
// this.checkPlayLine(this.intPlayLine)
|
||||
},
|
||||
|
||||
/**
|
||||
* 切换播放线路
|
||||
* @param {*} intPlayline
|
||||
* @returns
|
||||
*/
|
||||
checkPlayLine(intPlayline) {
|
||||
|
||||
//vip专线,只有会员可以播放
|
||||
if (intPlayline == 3 && !checkIsMemberFn()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$(".line-li").eq(intPlayline - 1).addClass('activePlayLine').siblings().removeClass('activePlayLine')
|
||||
|
||||
//vip视频,只有会员可以播放
|
||||
if (this.intPayStatus != 1 && !checkIsMemberFn()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 片头未播放完,未登录,不让播放
|
||||
if (this.intCountDownTimes > 0 && !checkIsLoginFn()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 所有其他条件,允许播放
|
||||
this.checkPlaylineUrl(intPlayline, this.strVideoPlayUrl);
|
||||
},
|
||||
|
||||
/**
|
||||
* 切换 播放线路
|
||||
* @param {int} intPlayline
|
||||
* @param {string} strDefaultUrl
|
||||
* @returns
|
||||
*/
|
||||
checkPlaylineUrl(intPlayline, strDefaultUrl) {
|
||||
let strNewPlayUrl = strDefaultUrl;
|
||||
switch (intPlayline) {
|
||||
case '1':
|
||||
strNewPlayUrl = videoInfoJs.getNewsPlayDomainFn(strDefaultUrl, arrPlayDomainLine1)
|
||||
break;
|
||||
case '2':
|
||||
strNewPlayUrl = videoInfoJs.getNewsPlayDomainFn(strDefaultUrl, arrPlayDomainLine2)
|
||||
break;
|
||||
case '3':
|
||||
strNewPlayUrl = videoInfoJs.getNewsPlayDomainFn(strDefaultUrl, arrPlayDomainLine3)
|
||||
break;
|
||||
default:
|
||||
strNewPlayUrl = videoInfoJs.getNewsPlayDomainFn(strDefaultUrl, arrPlayDomainLine1)
|
||||
break;
|
||||
}
|
||||
|
||||
videoInfoJs.beforePlay(strNewPlayUrl)
|
||||
},
|
||||
|
||||
/**
|
||||
* 播放前
|
||||
* @param {string} strPlayUrl
|
||||
* @param {boolean} boolIsFirstPlayCctv 是否首次播放广告
|
||||
*/
|
||||
beforePlay(strPlayUrl, boolIsFirstPlayCctv = false) {
|
||||
if (this.boolIsUC && this.boolIsPcWidths > 768) { // ios 加载 Dplayer
|
||||
alert('系统检测到您正在使用UC流氓浏览器,部分功能不兼容,建议切换至极速模式或更换其他浏览器访问!')
|
||||
}
|
||||
this.initDPlayer(strPlayUrl)
|
||||
// this.initJyPlayer264(strPlayUrl)
|
||||
},
|
||||
|
||||
initDPlayer(strPlayUrl) {
|
||||
let DomDPlayer = document.getElementById('dplayer')
|
||||
videoPlayer = new DPlayer({
|
||||
container: DomDPlayer,
|
||||
autoplay: true,
|
||||
screenshot: false,
|
||||
//logo: dplayerLogo,
|
||||
video: {
|
||||
url: strPlayUrl,
|
||||
type: 'hls',
|
||||
},
|
||||
pluginOptions: {
|
||||
hls: {
|
||||
maxBufferLength: 600,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
videoPlayer.play()
|
||||
|
||||
|
||||
// 监听全屏进入事件
|
||||
videoPlayer.on('fullscreen', function () {
|
||||
DomDPlayer.classList.add("dp-fullscreen");
|
||||
});
|
||||
// 监听全屏退出事件
|
||||
videoPlayer.on('fullscreen_cancel', function () {
|
||||
DomDPlayer.classList.remove("dp-fullscreen");
|
||||
});
|
||||
videoPlayer.on('error', function () {
|
||||
|
||||
});
|
||||
videoPlayer.on('play', function () {
|
||||
console.log('play')
|
||||
// 确保视频准备好后再进行跳转
|
||||
setTimeout(() => {
|
||||
if (videoPlayer.video.readyState >= 2) {
|
||||
// readyState >= 2 表示元数据已加载
|
||||
videoPlayer.seek(20); // 跳转到 20 分钟
|
||||
}
|
||||
}, 1000); // 等待一会儿确保视频已开始
|
||||
});
|
||||
// 监听当前播放时间
|
||||
videoPlayer.on('timeupdate', function () {
|
||||
if (videoPlayer.video.currentTime < 20) { // 当前时间小于 20 秒
|
||||
videoPlayer.seek(20); // 跳过到 20 秒
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 初始化匠影播放器
|
||||
* @param {string} strPlayUrl
|
||||
* @param {boolean} boolIsFirstPlayCctv 是否首次播放广告
|
||||
*/
|
||||
initJyPlayer264(strPlayUrl, boolIsFirstPlayCctv = false) {
|
||||
videoPlayer = new VideoPlayer("#dplayer", {
|
||||
src: strPlayUrl,
|
||||
autoplay: true,
|
||||
controls: true,
|
||||
muted: true,
|
||||
debug: false,
|
||||
allowFullscreen:true,
|
||||
zIndex:99999,
|
||||
allowKeyboard:true,
|
||||
//封面
|
||||
poster: "",
|
||||
|
||||
prefixAd: { // 视频前的广告
|
||||
time: 10, // 开屏广告能够跳过时间(秒),默认是 5 秒,设为 0 则没有倒计时
|
||||
list: [ // 支持多个视频广告,
|
||||
{
|
||||
src: 'https://v1.fentvoss.com/sdv1/202308/19/rKQfUHz6U12/video/index.m3u8', //广告视频M3U8地址
|
||||
link: 'https://www.baidu.com' // 广告链接
|
||||
}
|
||||
]
|
||||
},
|
||||
adList: [ // 视频播放中的广告
|
||||
{
|
||||
adType: 'pause', //pause暂停时展示(只支持图片)|rolling顶部滚动(只支持文字)|top-left|top-right|bottom-left|bottom-right
|
||||
image:'/assets/images/zxtv/60-60.png', // 广告图片
|
||||
text: '', // 广告文字
|
||||
link: 'https://szchuanxia.cn/demo3/', // 广告链接
|
||||
fontSize: '16', // 文字大小,
|
||||
fontColor: '#fff' // 文字颜色,
|
||||
},
|
||||
{
|
||||
adType: 'top-left', //pause暂停时展示(只支持图片)|rolling顶部滚动(只支持文字)|top-left|top-right|bottom-left|bottom-right
|
||||
image:'/assets/images/zxtv/60-60.png', // 广告图片
|
||||
text: '', // 广告文字
|
||||
link: 'https://szchuanxia.cn/demo3/', // 广告链接
|
||||
fontSize: '16', // 文字大小,
|
||||
fontColor: '#fff' // 文字颜色,
|
||||
},
|
||||
{
|
||||
adType: 'top-right', //pause暂停时展示(只支持图片)|rolling顶部滚动(只支持文字)|top-left|top-right|bottom-left|bottom-right
|
||||
image:'/assets/images/zxtv/60-60.png', // 广告图片
|
||||
text: '', // 广告文字
|
||||
link: 'https://szchuanxia.cn/demo3/', // 广告链接
|
||||
fontSize: '16', // 文字大小,
|
||||
fontColor: '#fff' // 文字颜色,
|
||||
},
|
||||
{
|
||||
adType: 'bottom-left', //pause暂停时展示(只支持图片)|rolling顶部滚动(只支持文字)|top-left|top-right|bottom-left|bottom-right
|
||||
image:'/assets/images/zxtv/60-60.png', // 广告图片
|
||||
text: '', // 广告文字
|
||||
link: 'https://szchuanxia.cn/demo3/', // 广告链接
|
||||
fontSize: '16', // 文字大小,
|
||||
fontColor: '#fff' // 文字颜色,
|
||||
},
|
||||
{
|
||||
adType: 'bottom-right', //pause暂停时展示(只支持图片)|rolling顶部滚动(只支持文字)|top-left|top-right|bottom-left|bottom-right
|
||||
image:'/assets/images/zxtv/60-60.png', // 广告图片
|
||||
text: '', // 广告文字
|
||||
link: 'https://szchuanxia.cn/demo3/', // 广告链接
|
||||
fontSize: '16', // 文字大小,
|
||||
fontColor: '#fff' // 文字颜色,
|
||||
},
|
||||
]
|
||||
});
|
||||
|
||||
console.log('调用播放事件-play')
|
||||
|
||||
videoPlayer.on('play', (data)=>{
|
||||
console.log('play')
|
||||
// if (this.intCountDownTimes > 0) {
|
||||
// if (videoInfoJs.boolIsShowCctvImg || videoInfoJs.boolIsShowCctvVideo) {
|
||||
// // if (boolIsFirstPlayCctv && publicJs.strEquipmentCode == 'ios') {
|
||||
// // return;
|
||||
// // }
|
||||
// //videoInfoJs.countDownFn()
|
||||
// }
|
||||
// }
|
||||
})
|
||||
|
||||
videoPlayer.on('pause', (data)=>{
|
||||
// events callback
|
||||
console.log(data)
|
||||
})
|
||||
|
||||
videoPlayer.on('ended', (data)=>{
|
||||
// events callback
|
||||
console.log(data)
|
||||
})
|
||||
|
||||
videoPlayer.on('error', (data)=>{
|
||||
console.log('error')
|
||||
//videoInfoJs.beforePlay(videoInfoJs.checkPlaylineUrl(videoInfoJs.intPlayLine, strPlayUrl));
|
||||
console.log(data)
|
||||
})
|
||||
|
||||
console.log('player-end')
|
||||
},
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* h264播放
|
||||
* @param {string} strPlayUrl
|
||||
* @param {boolean} boolIsFirstPlayCctv 是否首次播放广告
|
||||
*/
|
||||
initDPlayer264(strPlayUrl, boolIsFirstPlayCctv = false) {
|
||||
let DomDPlayer = document.getElementById('dplayer')
|
||||
if(videoPlayer == null){
|
||||
videoPlayer = new DPlayer({
|
||||
container: DomDPlayer,
|
||||
autoplay: true,
|
||||
screenshot: false,
|
||||
//logo: dplayerLogo,
|
||||
video: {
|
||||
url: strPlayUrl,
|
||||
type: 'hls',
|
||||
},
|
||||
pluginOptions: {
|
||||
hls: {
|
||||
maxBufferLength: 600,
|
||||
},
|
||||
},
|
||||
});
|
||||
}else{
|
||||
videoPlayer.src = strPlayUrl
|
||||
}
|
||||
|
||||
videoPlayer.play()
|
||||
|
||||
videoPlayer.on('fullscreen', function () {
|
||||
DomDPlayer.classList.add("dp-fullscreen");
|
||||
});
|
||||
videoPlayer.on('fullscreen_cancel', function () {
|
||||
DomDPlayer.classList.remove("dp-fullscreen");
|
||||
});
|
||||
videoPlayer.on('error', function () {
|
||||
//videoInfoJs.beforePlay(videoInfoJs.checkPlaylineUrl(videoInfoJs.intPlayLine, strPlayUrl));
|
||||
});
|
||||
videoPlayer.on('play', function () {
|
||||
// if (videoInfoJs.boolIsShowCctvImg || videoInfoJs.boolIsShowCctvVideo) {
|
||||
// if (boolIsFirstPlayCctv && publicJs.strEquipmentCode == 'ios') {
|
||||
// return;
|
||||
// }
|
||||
// videoInfoJs.countDownFn()
|
||||
// }
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 返回最新播放域名
|
||||
* @param {string} strDefaultUrl
|
||||
* @param {arr} arrPlayDomain
|
||||
* @returns
|
||||
*/
|
||||
getNewsPlayDomainFn(strDefaultUrl, arrPlayDomain) {
|
||||
let activeIndx = 1
|
||||
if (strDefaultUrl.indexOf('old') != -1) {
|
||||
activeIndx = 0
|
||||
}
|
||||
let strRandPlayDomain = videoInfoJs.getRandDomainFun(arrPlayDomain[activeIndx].domain)
|
||||
return replaceDomainFun(strRandPlayDomain, strDefaultUrl)
|
||||
},
|
||||
|
||||
/**
|
||||
* 提取播放域名-随机一个
|
||||
* @param {string} strPlayDomain
|
||||
* @returns {string}
|
||||
*/
|
||||
getRandDomainFun(strPlayDomain) {
|
||||
let ArrPlayDomain = ''
|
||||
if (strPlayDomain.indexOf(",") > 0) {
|
||||
ArrPlayDomain = strPlayDomain.split(",")
|
||||
} else {
|
||||
ArrPlayDomain = strPlayDomain.split(",")
|
||||
}
|
||||
let randNum = (Math.ceil(Math.random() * ArrPlayDomain.length - 1));
|
||||
return ArrPlayDomain[randNum];
|
||||
},
|
||||
|
||||
|
||||
|
||||
// /**
|
||||
// * 刷新vip
|
||||
// */
|
||||
// rinseNewVipFum() {
|
||||
// console.log(apiGetUserInfo)
|
||||
// if (getLoginStatus()) {
|
||||
// //用户详情
|
||||
// let apiUrl = strApiDoMain+apiGetUserInfo + `?si_id=${strSite}`
|
||||
// fetchApi(apiUrl, null, successFn, onError)
|
||||
// function successFn(res) {
|
||||
// if (res.code == '000') {
|
||||
// var data = res.data
|
||||
|
||||
// localStorage.setItem(storageObj.userInfo, JSON.stringify(data))
|
||||
|
||||
// if (data.mu_is_vip) {
|
||||
// // 会员
|
||||
// localStorage.setItem(storageObj.isMember, true)
|
||||
|
||||
// } else {
|
||||
// // 不是会员
|
||||
// localStorage.setItem(storageObj.isMember, false)
|
||||
|
||||
// }
|
||||
// checkIsMemberFn()
|
||||
// }
|
||||
// }
|
||||
// showCustomAlert('刷新VIP成功');
|
||||
// // layerPopup('刷新VIP成功', 3)
|
||||
// }
|
||||
// },
|
||||
|
||||
|
||||
|
||||
|
||||
//反馈事件
|
||||
videoFeedbackSave() {
|
||||
if (checkIsLoginFn()) {
|
||||
// $("#err-form-zd").removeClass('yc')
|
||||
// $("#err-form").removeClass('yc')
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 出错视频 反馈事件
|
||||
* @returns
|
||||
*/
|
||||
errVideoFeedbackFn() {
|
||||
var strCurrentWebHref = window.location.href + '?playLine=' + videoInfoJs.intPlayLine
|
||||
var strBugTxt = $("#bugtxt").val();
|
||||
var strBugRemark = $("#bugbeizhu").val();
|
||||
var strBugTitle = $('.video-title').text()
|
||||
if (strBugTxt == "请选择") {
|
||||
alert("请选择报错类型~");
|
||||
return false;
|
||||
} else {
|
||||
let postData = {
|
||||
'title':strBugTitle,
|
||||
'type':strBugTxt,
|
||||
'content':strBugRemark,
|
||||
'pay_url':strCurrentWebHref,
|
||||
'content_type':3,
|
||||
}
|
||||
fetchApi(apiFeedbackCreate, postData,successFun, onError,false)
|
||||
function successFun(res) {
|
||||
if (res.code == '000') {
|
||||
layer.open({
|
||||
shadeClose: false,
|
||||
skin: "msg",
|
||||
content: '反馈成功,我们会尽快解决您反馈的问题~',
|
||||
time: 3
|
||||
});
|
||||
layer.close(layer.index);
|
||||
$("#err-form-zd").addClass('yc')
|
||||
$("#err-form").addClass('yc')
|
||||
} else {
|
||||
alert(res.msg);
|
||||
layer.close(layer.index);
|
||||
$("#err-form-zd").addClass('yc')
|
||||
$("#err-form").addClass('yc')
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 倒计时
|
||||
*/
|
||||
countDownFn() {
|
||||
this.CctvInterval = setInterval(() => {
|
||||
this.intCountDownTimes--
|
||||
$(".huiyuan_mian_cctv1 span").text(this.intCountDownTimes)
|
||||
if (this.intCountDownTimes == 4 && this.CctvOpening.length > 1) {
|
||||
//第二张广告图
|
||||
if (this.boolIsShowCctvImg) {
|
||||
$(".isShow_cctv_img img").attr('src', this.CctvOpening[1].cover)
|
||||
}
|
||||
}
|
||||
if (this.intCountDownTimes <= 0) {
|
||||
//广告展示完毕
|
||||
if (this.boolIsShowCctvVideo) {
|
||||
this.boolIsShowCctvVideo = false
|
||||
$(".isShow_cctv_img").hide()
|
||||
$(".isShow_cctv_video").hide()
|
||||
} else {
|
||||
this.boolIsShowCctvVideo = false
|
||||
$(".isShow_cctv_img").hide()
|
||||
$(".isShow_cctv_video").hide()
|
||||
}
|
||||
this.intCountDownTimes = 0
|
||||
this.setPlayUrl(this.strVideoPlayUrl)
|
||||
clearInterval(this.CctvInterval)
|
||||
|
||||
}
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
videoInfoJs.init()
|
||||
|
||||
});
|
||||
|
||||
|
||||
// function filterCctv(data) {
|
||||
// arrCctvData = filterItemsByCctvCode(data, "WONDERFUL_VIDEO_AD");
|
||||
// arrCctvOpenData = filterItemsByCctvCode(data, "VIDEO_START_AD");
|
||||
// arrCctvCenterData = filterItemsByCctvCode(data, "VIDEO_PLAYER_AD");
|
||||
// arrCctvVideoList = filterItemsByCctvCode(data, "VIDEO_GUESS_AD");
|
||||
// arrCctvRollingData = filterItemsByCctvCode(data, "VIDEO_ROLLING_AD");
|
||||
// arrCctvLocationData = filterItemsByCctvCode(data, "VIDEO_LOCATION_AD");
|
||||
|
||||
// // 视频开屏前广告,
|
||||
// arrVideoOpenStartCctvList = arrCctvOpenData.map(item => ({
|
||||
// src: item.a_content.cover.value, // 使用从 a_content.target 获取的新 URL
|
||||
// link: item.a_content.target.value // 假设所有广告使用相同的链接,可根据需要调整
|
||||
// }));
|
||||
// // 视频播放中的广告--这块数据逻辑需要你们填充
|
||||
// arrCctvPlayContent = arrCctvCenterData.map(item => ({
|
||||
// adType: "pause", //pause暂停时展示(只支持图片)|rolling顶部滚动(只支持文字)|top-left|top-right|bottom-left|bottom-right
|
||||
// image: item.a_content.cover.value, // 广告图片
|
||||
// text: "", // 广告文字
|
||||
// link: item.a_content.target.value, // 广告链接
|
||||
// fontSize: "16", // 文字大小,
|
||||
// fontColor: "#fff" // 文字颜色,
|
||||
// }));
|
||||
// // 视频跑马灯广告
|
||||
// arrCctvRollingContent = arrCctvRollingData.map(item => ({
|
||||
// adType: "rolling",
|
||||
// text: item.a_content.text.value,
|
||||
// link: item.a_content.target.value,
|
||||
// fontSize: item.a_content.font_color.value || "16",
|
||||
// fontColor: item.a_content.font_size.value || "#fff"
|
||||
// }));
|
||||
// const arrAdType = ["top-left", "top-right", "bottom-left", "bottom-right"];
|
||||
// const arrCctvLocationFirstData = [];
|
||||
|
||||
// arrAdType.forEach(adType => {
|
||||
// const ad = arrCctvLocationData.find(ad => ad.a_content.ad_type.value === adType);
|
||||
// if (ad) {
|
||||
// arrCctvLocationFirstData.push(ad);
|
||||
// }
|
||||
// });
|
||||
|
||||
// arrCctvLocationContent = arrCctvLocationFirstData.map(item => ({
|
||||
// adType: item.a_content.ad_type.value,
|
||||
// image: item.a_content.cover.value,
|
||||
// link: item.a_content.target.value,
|
||||
// text: item.a_content.text.value,
|
||||
// fontSize: item.a_content.font_color.value || "16",
|
||||
// fontColor: item.a_content.font_size.value || "#fff"
|
||||
// }));
|
||||
// }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user