$(document).ready(function () {
$(".logo").on("click", function () {
window.location.href = "https://www.bibidd.com";
});
$(".quanpinghei").hide();
var uid = localStorage.getItem("uid");
if (uid) {
$("#register").text("My Collection");
$("#login").text("Log out");
$("#login").css("backgroundColor", "#D6565A");
} else {
$("#register").text("Sign up");
$("#login").text("Login");
$("#login").css("backgroundColor", "#CE5C2A");
}
// 获取标签数据
var labelcurrentid = 1;
var labelDataArray = [];
var lpage = 1;
var labelname = "";
function getlabelData(videopage) {
$(".box").show();
$.ajax({
type: "post",
url: "https://www.bibidd.com/bibidd/Mediaonefive/shouye_resou_img_video",
dataType: "json",
data: {
type: "img",
page: videopage,
},
success: function (res) {
labelDataArray = res.data;
},
complete: function (res) {
// 分页
let code = res.responseJSON.code;
let dataNum = res.responseJSON.all_num;
$(function () {
$("#pagination3").pagination({
currentPage: labelcurrentid,
totalPage: Math.ceil(dataNum / 30),
isShow: true,
count: 7,
homePageText: "One",
endPageText: "Last",
prevPageText: "Prev",
nextPageText: "Next",
callback: function (current) {
labelcurrentid = current;
getlabelData(labelcurrentid);
},
});
Math.ceil(dataNum / 30) < 2?$('.firstPage').show():$('.firstPage').hide();
});
let labelHtml = "";
labelHtml += '
';
videoHtml +=
'
';
videoHtml += '
' + data.title + "
";
videoHtml += '
';
videoHtml += " ";
videoHtml += '
';
videoHtml +=
'

';
videoHtml +=
'
' +
data.views +
"
";
videoHtml += "
";
videoHtml += " ";
videoHtml += '
';
videoHtml +=
'

';
videoHtml +=
'
' + data.thumbs_up + "
";
videoHtml += "
";
videoHtml += "
";
videoHtml += "
";
});
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 looks = $(this).find("#looks").eq(0).text();
$(this).find("#looks").eq(0).text(Number(looks)+1);
$(location).attr("href","bphotodetails.html?imgid=" +
allDataArray[$(this).index()].id +
"&fabulous=" +
allDataArray[$(this).index()].thumbs_up +
"&favorite=" +
allDataArray[$(this).index()].favorite
);
});
ispage = true;
}, 1000);
} else {
$(".bottomLoadContent").hide();
$(".box").show();
ispage = true;
}
}
}
});
// 创建视频dom元素
function createDomHtml(dataArray) {
let videoHtml = "";
$.each(dataArray, function (index, data) {
videoHtml += '';
videoHtml +=
'
';
videoHtml += '
' + data.title + "
";
videoHtml += '
';
videoHtml += " ";
videoHtml += '
';
videoHtml +=
'

';
videoHtml += '
' + data.views + "
";
videoHtml += "
";
videoHtml += " ";
videoHtml += '
';
videoHtml +=
'

';
videoHtml += '
' + data.thumbs_up + "
";
videoHtml += "
";
videoHtml += "
";
videoHtml += "
";
});
$(".video").html(videoHtml);
var loadingUrl = "/Public/bibidd/images/loading.png";
$(".lazy").lazyload({
effect: "show",
placeholder: loadingUrl,
failurelimit: 10,
skip_invisible: false,
});
// 查看视频详情
$(".videoContent").on("click", function () {
let looks = $(this).find("#looks").eq(0).text();
$(this).find("#looks").eq(0).text(Number(looks)+1);
$(location).attr("href","bphotodetails.html?imgid=" +
dataArray[$(this).index()].id +
"&fabulous=" +
dataArray[$(this).index()].thumbs_up +
"&favorite=" +
dataArray[$(this).index()].favorite
);
});
}
function clearScroll() {
showVideoNum = 12;
ispage = false;
scrollT = 0;
offsetT = 0;
$(".bottomLoadContent").show();
$(".box").hide();
}
$('.clearTextImg').on('click', function() {
$('.searchInput').val('');
})
});