$(document).ready(function () {
let back = localStorage.getItem('back');
if(back) {
location.reload(true);
localStorage.removeItem('back');
}
var languageParameter = localStorage.getItem("language") || "CN";
var uid = localStorage.getItem("uid") || 0;
var url = window.location.search;
var theRequest = new Object();
if (url.indexOf("?") != -1) {
var str = url.substr(1);
strs = str.split("&");
for (var i = 0; i < strs.length; i++) {
theRequest[strs[i].split("=")[0]] = unescape(
decodeURIComponent(strs[i].split("=")[1])
);
}
}
var filterStarTime = 0;
var filterEndTime = 99999999;
var filterLabel = "";
var filterType = "tuijian";
var labelname = "";
var dataArray = [];
var allDataArray = [];
var videotype = "Asian";
var currentPage = theRequest.page ? Number(theRequest.page) : 1;
var homePageText = "";
var endPageText = "";
var prevPageText = "";
var nextPageText = "";
var showVideoNum = 12;
var ispage = true;
var isOpen = false;
var filterTypeArray = ["zuixin", "remen", "dianzan", "shichang"];
var isFilteringModules = false;
var starFilterIsShow = false;
var isSelectLabel = true;
var languageIsLong = false;
var bannerArr = new Array();
if (languageParameter == "CN") {
homePageText = "首頁";
endPageText = "尾頁";
prevPageText = "上一頁";
nextPageText = "下一頁";
$("#chinese").addClass(" isSelectLanguage");
$("#chinese").siblings().removeClass(" isSelectLanguage");
} else {
homePageText = "One";
endPageText = "Prev";
prevPageText = "Next";
nextPageText = "Last";
$("#english").addClass(" isSelectLanguage");
$("#english").siblings().removeClass(" isSelectLanguage");
}
// let logo = localStorage.getItem('logo');
// console.log(logo);
// if(logo) {
// $(".ageTipPage").hide();
// localStorage.removeItem('logo');
// }else{
// $(".ageTipPage").show();
// }
if(sessionStorage.getItem('isReload')) {
// 页面被刷新
}else {
// 第一次被刷新
$(".ageTipPage").show();
sessionStorage.setItem('isReload', true);
}
$('.addressImg').on('click', function() {
$(".addressBox").show();
})
$(".confirmBtn").on("click", function () {
$(".ageTipPage").hide();
$(".addressBox").show();
});
$(".logo").on("click", function () {
localStorage.setItem('logo', true);
$(location).attr("href", "index.html?logo=true");
});
if (uid) {
let uname = localStorage.getItem("username");
$(".userContent").show();
$(".userName").text(uname);
$(".myCollection").show();
$(".loginOut").show();
$(".userLogin").hide();
} else {
$(".userContent").hide();
$(".myCollection").hide();
$(".loginOut").hide();
$(".userBtn").show();
}
// 判断中英文
LanguageSwitching();
// 获取标签数据
function getlabelData(videopage) {
let languageParameter = localStorage.getItem("language") || "CN";
$("#tip").hide();
$.ajax({
type: "post",
url: "https://www.bibidd.com/bibidd/Mediasix/shouye_resou_img_video",
dataType: "json",
data: {
type: "video",
page: videopage,
LNG: languageParameter,
},
success: function (res) {
let labelDataArray = res.data;
let labelHtml = "";
labelHtml += '
${videoTime(data.time_chuo)}
${data.title}
`;
}
}
});
setTimeout(() => {
$(".video").append(videoHtml);
$(".bottomLoadContent").hide();
var loadingUrl = "/Public/bibidd/images/loading.png";
$(".lazy").lazyload({
effect: "show",
placeholder: loadingUrl,
failurelimit: 10,
skip_invisible: false,
});
$(".videoContent").on("click", function () {
let thisId = $(this).attr("id");
let thisIdLength = $(this).attr("id").length;
let thisIndex = Number(thisId.substring(12, thisIdLength));
let labelname = theRequest.labelname || '';
let type = theRequest.type || '';
let name = theRequest.name || 'Asia';
$(location).attr(
"href",
"videodetails.html?videoid=" +
allDataArray[thisIndex].id +
"&fabulous=" +
allDataArray[thisIndex].thumbs_up +
"&favorite=" +
allDataArray[thisIndex].favorite +
"&videoname=" +
allDataArray[thisIndex].title +
"&labelname=" +
labelname +
"&type=" +
type +
"&videotype=" +
videotype +
"&name=" +
name
);
});
ispage = true;
// 广告详情
$(".banner").on("click", function () {
window.location.href = allDataArray[$(this).index()].jump_link;
});
}, 500);
} else {
$(".bottomLoadContent").hide();
$(".box").show();
ispage = true;
}
}
}
});
// 创建视频dom元素
function createDomHtml(dataArray) {
let videoHtml = "";
$.each(dataArray, function (index, data) {
if (data.jump_link) {
let headBannerHtml = `
${videoTime(data.time_chuo)}
${data.title}
`;
}
}
});
$(".video").html(videoHtml);
$(".headBanner .banner .bannerImg").attr("data-original", bannerArr[0].img);
$(".video .banner .bannerImg").attr("data-original", bannerArr[1].img);
var loadingUrl = "/Public/bibidd/images/loading.png";
$(".lazy").lazyload({
effect: "show",
placeholder: loadingUrl,
failurelimit: 10,
skip_invisible: false,
});
$(".videoContent").on("click", function () {
let thisId = $(this).attr("id");
let thisIdLength = $(this).attr("id").length;
let thisIndex = Number(thisId.substring(12, thisIdLength));
let labelname = theRequest.labelname || '';
let type = theRequest.type || '';
let name = theRequest.name || 'Asia';
$(location).attr(
"href",
"videodetails.html?videoid=" +
allDataArray[thisIndex].id +
"&fabulous=" +
allDataArray[thisIndex].thumbs_up +
"&favorite=" +
allDataArray[thisIndex].favorite +
"&videoname=" +
allDataArray[thisIndex].title +
"&labelname=" +
labelname +
"&type=" +
type +
"&videotype=" +
videotype +
"&name=" +
name
);
});
// 广告详情
$(".banner").on("click", function () {
let bannerParent = $(this).parent().attr("class");
if (bannerParent == "headBanner") {
window.location.href = bannerArr[0].jump_link;
} else {
window.location.href = allDataArray[$(this).index()].jump_link;
}
});
}
function clearScroll() {
showVideoNum = 12;
ispage = false;
scrollT = 0;
offsetT = 0;
$(".bottomLoadContent").show();
$(".box").hide();
}
// 收起筛选列表
$(".filterAddLabel").on("click", function () {
if (isOpen) {
// 收起
$(".filterAddLabelImg").attr("src", "/Public/bibidd/images/shang.png");
$(".filterLabelListContent").hide();
} else {
// 展开
$(".filterAddLabelImg").attr("src", "/Public/bibidd/images/xia.png");
$(".filterLabelListContent").show();
}
isOpen = !isOpen;
});
// 关闭筛选界面
$(".cancelFilter").on("click", function () {
isFilteringModules = false;
$(".FilteringModules").hide();
starFilterIsShow = false;
$(".filterTimeContent").html("");
$(".filterSwitch").hide();
});
// 选择筛选分类
$(".screenHeaderContentLi").on("click", function () {
if ($(this).index() == 0) {
isFilteringModules = !isFilteringModules;
if (isFilteringModules) {
$(".FilteringModules").show();
$(".filterTimeContent").html(`