$(document).ready(function () { $('.logo').on('click', function() { window.location.href = "https://www.bibidd.com"; }) $('.quanpinghei').hide(); $(".back").on("click", function () { history.back(-1); }); var uid = localStorage.getItem("uid"); // 获取收藏数据 function getData() { $.ajax({ type: "post", url: "https://www.bibidd.com/bibidd/Media/shoucang_list_test", dataType: "json", data: { uid: uid, }, success: function (res) { }, complete: function (res) { let dataArray = res.responseJSON.data; if(dataArray.length==0) { $('.bottomLoadContent').hide(); $("#tip").show(); $(".tiptext").text('The data you need is not found.'); }else{ $("#tip").hide(); } let videoHtml = ""; $.each(dataArray, function (index, data) { videoHtml += '
'; videoHtml += '
'; videoHtml += '
' + data.title + "
"; videoHtml += '
'; videoHtml += '
'; videoHtml += " "; videoHtml += '
'; videoHtml += ' '; videoHtml += '
' + data.views + "
"; videoHtml += "
"; videoHtml += " "; videoHtml += '
'; videoHtml += ' '; videoHtml += '
' + data.thumbs_up + "
"; videoHtml += "
"; videoHtml += "
"; videoHtml += '
'; videoHtml += ' '; videoHtml += "
"; videoHtml += "
"; videoHtml += "
"; }); $(".video").html(videoHtml); var loadingUrl = "/Public/bibidd/images/loading.png"; $(".lazy").lazyload({ effect: 'show', placeholder: loadingUrl, failurelimit: 10, skip_invisible: false, }); // 取消收藏 $(".close").on("click", function (event) { event.stopPropagation(); // 取消收藏 let closetype = dataArray[$(this).parent().parent().index()].type; const id = dataArray[$(this).parent().parent().index()].id; if (closetype === 'novel') { // 取消收藏小说 $.ajax({ type: 'post', url: 'https://www.bibidd.com/bibidd/Nnovel/close_novel_shoucang', dataType: "json", data: { n_id: id, uid: uid }, success: function (res) { }, complete: function (res) { getData(); } }) } else { // 取消收藏视频或图片 closetype = dataArray[$(this).parent().parent().index()].type === "imgs" ? "img" : "video"; $.ajax({ type: "post", url: "https://www.bibidd.com/bibidd/Media/quxiao_shoucang", dataType: "json", data: { type: closetype, cid: id, uid: uid, }, success: function (res) { }, complete: function (res) { getData(); }, }); } }); // 查看收藏详情 $(".videoContent").on("click", function () { let looks = $(this).find("#looks").eq(0).text(); $(this).find("#looks").eq(0).text(Number(looks)+1); const type = dataArray[$(this).index()].type; let page = ''; switch (type) { case "imgs": page = 'collectionphotodetails'; break; case "video": page = 'videodetails'; break; case "novel": page = 'bnoveldetalis'; break; } $(location).attr("href", page + ".html?videoid=" + dataArray[$(this).index()].id + "&fabulous=" + dataArray[$(this).index()].thumbs_up + "&favorite=" + dataArray[$(this).index()].favorite)+ '?status='+1; }); }, }); } getData(); // 判断屏幕滚动高度是否超过1屏 $(window).scroll(function () { var scrollT = $(document).scrollTop(); var offsetT = $(".videopage").offset().top; if (scrollT >= offsetT) { $(".backToTop").show(); } else { $(".backToTop").hide(); } }); // 返回顶部 $(".backToTop").on("click", function () { $("html, body").animate( { scrollTop: 0, }, 500 ); }); });