$(function () {
if (getCookie("flag") == "1") {
initOther();
search(1, true, false);
}
});
/**
* 初始化其他操作
*/
function initOther() {
$(".slideDown-btn").click(function () {
var display = $('.slideDown-box');
if (display.css('display') == 'block') {
display.slideUp("slow");
$(this).html('展开 ');
} else {
display.slideDown("slow");
$(this).html('收起 ');
}
});
$("#searchbutton").click(function () {
search(1, false, false);
});
$("#shaixuan").click(function () {
$("#wd").val("");
search(1, false, false);
});
$("#wd").keydown(function (e) {
if (e.keyCode == 13) {
search(1, false, false);
}
});
$(".dropdown-box").find("li").click(function () {
$("#bigType").text($(this).text());
$("#bigType").attr("prepath", $(this).attr("prepath"));
$(".dropdown-box").attr("style", "display: none;");
if ($(this).text() == '足舐') {
$(".lovefoot").attr("style", "display: block;");
} else {
$(".lovefoot").attr("style", "display: none;");
}
getQueryHeaderInfo($("#bigType").text(), false, true);
search(1, false, true);
});
$(".dropdown-hover").mouseover(function () {
$(".dropdown-box").attr("style", "display: block;");
});
$(".dropdown-hover").mouseout(function () {
$(".dropdown-box").attr("style", "display: none;");
});
$(".clearAll").click(function () {
$("#playvideo").find("video").attr("src", "");
$("#bigpreview").find("img").attr("src", "");
$("#playvideo").css("display", "none");
$("#bigpreview").css("display", "none");
});
}
/**
* 多条件搜索
* @param pageNo
*/
function search(pageNo, startFlag, searchSelectFlag) {
var genres = "";
var cast = "";
var keyword = "";
if (searchSelectFlag) {
$("#wd").val("");
}
if (!startFlag) {
genres = $(".leixingul").find(".btn-warm").text().replace("全部", "");
cast = $(".yanyuanul").find(".btn-warm").text().replace("全部", "");
keyword = $("#wd").val();
}
var orderField = $(".paixuul").find(".btn-warm").attr("orderField");
var order = $(".paixuul").find(".btn-warm").attr("order");
var bigType = $("#bigType").text();
var prepath = $("#bigType").attr("prepath");
if (searchSelectFlag) {
genres = "";
cast = "";
if (bigType == '足舐') {
genres = "待审查";
orderField = "vi.update_date";
} else if (bigType == '码池') {
orderField = "vi.modify_time";
} else {
orderField = "vi.issue_date";
}
order = "desc";
}
$.ajax({
url: "videoInfo/getVideoInfoPage", //请求的url地址
dataType: "json", //返回格式为json
data: JSON.stringify({
"pageNo": pageNo,
"pageSize": 10,
"genres": genres,
"cast": cast,
"orderField": orderField,
"order": order,
"keyword": keyword,
"bigType": bigType
}), //参数值
type: "post", //请求方式
contentType: "application/json;charset=utf-8",
async: true, //请求是否异步,默认为异步,这也是ajax重要特性
success: function (data) {
//请求成功时处理
if (data != null && $.trim(data) != "" && data.success) {
if (startFlag) {
getQueryHeaderInfo($("#bigType").text(), startFlag, false);
}
data = data.data;
var videoInfoList = data.list;
var str = "";
for (var i = 0; i < videoInfoList.length; i++) {
var videoInfo = videoInfoList[i];
var date = videoInfo.issueDate + "|" + videoInfo.modifyTime;
if (orderField == 'vi.modify_time') {
date = videoInfo.modifyTime + "|" + videoInfo.issueDate;
} else if (orderField == 'vi.update_date') {
date = videoInfo.updateDate + "|" + videoInfo.issueDate;
}
var scoreStr = '';
var orginUrl= '';
if (bigType == '骑兵') {
scoreStr += videoInfo.resolutionRatio + '|';
scoreStr += (videoInfo.original === null ? '?' : (videoInfo.original == 1 ? '原档' : '非原档')) + '|';
scoreStr += (videoInfo.subtitle === null ? '?' : (videoInfo.subtitle == 1 ? '字幕' : '无字幕')) + '|';
scoreStr += (videoInfo.recoding === null ? '?' : (videoInfo.recoding == 1 ? '压缩' : '未压缩')) + '|';
scoreStr += videoInfo.score;
} else if (bigType == '码池') {
scoreStr += (videoInfo.videoInfoFlag === 'false' ? '' : '骑兵|');
scoreStr += (videoInfo.videoLoveFootFlag === 'false' ? '' : '足舐|');
scoreStr += (videoInfo.type === 1 ? '待审查' : (videoInfo.type === 2 ? '审查中' : (videoInfo.type === 3 ? '审查已通过' : '审查未通过'))) + '|';
scoreStr += videoInfo.score;
} else if (bigType == '足舐') {
scoreStr += (videoInfo.orginAvnoashiUrl === null ? '' : 'avnoashi|');
scoreStr += (videoInfo.orginJpfootUrl === null ? '' : 'jpfoot|');
scoreStr += (videoInfo.orginFeetpassionUrl === null ? '' : 'feetpassion|');
scoreStr += (videoInfo.videoInfoFlag === 'false' ? '' : '骑兵|');
if (videoInfo.videoInfoPoolFlag === 'false') {
scoreStr += '';
} else {
scoreStr += '码池(' + (videoInfo.videoInfoPoolType === 1 ? '待审查' : (videoInfo.videoInfoPoolType === 2 ? '审查中' : (videoInfo.videoInfoPoolType === 3 ? '审查已通过' : '审查未通过'))) + ')|';
}
scoreStr += (videoInfo.type === 1 ? '爬取失败' : (videoInfo.type === 2 ? '待审查' : (videoInfo.type === 3 ? '审查已通过' : '审查未通过'))) + '|';
scoreStr += videoInfo.score;
orginUrl += videoInfo.orginAvnoashiUrl === null ? '' : videoInfo.orginAvnoashiUrl;
orginUrl += (videoInfo.orginAvnoashiUrl != null && videoInfo.orginJpfootUrl != null) ? ',' : '';
orginUrl += videoInfo.orginJpfootUrl === null ? '' : videoInfo.orginJpfootUrl;
if (orginUrl === '') {
orginUrl += videoInfo.orginFeetpassionUrl;
}
} else {
scoreStr = videoInfo.score;
}
var str2 = "";
if (bigType == '骑兵') {
str2 = " " +
" " + videoInfo.xpCount + " " +
" " +
" " +
" " +
" " +
" " +
" " + scoreStr + " " +
" ";
} else {
str2 = " " + scoreStr + " ";
}
str += "
" +
" " +
" ";
}
$(".myui-vodlist").html(str);
if (str == "") {
$(".vodlistnone").attr("style", "padding: 50px;display: block;");
$(".myui-page").html("");
} else {
$(".vodlistnone").attr("style", "padding: 50px;display: none;");
$(".myui-page").pagination({
pageSize: "10",
pageNo: pageNo,
total: data.total,
callback: function (pageNo) {
//$("#wd").val("");
search(pageNo, false, false);
}
});
}
initContentEvent();
} else {
alert(data.message);
}
},
beforeSend: function () {
//请求前的处理
if (startFlag) {
$("#cover").css("display", "block");
} else {
$(".loading").css("display", "block");
}
},
complete: function () {
//请求完成的处理
if (startFlag) {
$("#cover").css("display", "none");
} else {
$(".loading").css("display", "none");
}
},
error: function (data) {
//请求出错处理
alert('error:' + data);
}
});
}
/**
* 查询头信息
* @param bigType
* @param startFlag
*/
function getQueryHeaderInfo(bigType, startFlag, searchSelectFlag) {
var infantryType = "";
if (bigType == '步兵' && !searchSelectFlag) {
infantryType = $(".leixingul").find(".btn-warm").text().replace("全部", "");
}
$.ajax({
url: "queryHeader/getQueryHeaderInfo", //请求的url地址
dataType: "json", //返回格式为json
data: {"bigType": bigType, "infantryType": infantryType}, //参数值
type: "post", //请求方式
async: !startFlag, //请求是否异步,默认为异步,这也是ajax重要特性
success: function (data) {
if (bigType == '步兵') {
$(".leixingli").css("display", "none");
} else {
$(".leixingli").css("display", "block");
}
if (searchSelectFlag) {
$("ul.leixingul").find("a:eq(1)").addClass("btn-warm");
$("ul.yanyuanul").find("a:eq(1)").addClass("btn-warm");
$("ul.paixuul").find("a.btn-warm").removeClass("btn-warm");
if (bigType == '足舐') {
$("ul.paixuul").find("a:eq(3)").addClass("btn-warm");
} else if (bigType == '码池') {
$("ul.paixuul").find("a:eq(2)").addClass("btn-warm");
} else {
$("ul.paixuul").find("a:eq(1)").addClass("btn-warm");
}
}
//请求成功时处理
if (data != null && $.trim(data.data) != "" && data.success) {
data = data.data;
if ($.isEmptyObject(data)) {
if ($(".displayli").length > 0) {
$(".displayli").remove();
}
$(".vodlistnone").attr("style", "padding: 50px;display: block;");
$(".myui-vodlist").html("");
$(".myui-page").html("");
return;
}
if ($(".displayli").length > 0) {
$(".displayli").remove();
}
if (data.videoCastList.length > 0) {
var videoCastList = data.videoCastList;
var str = "";
for (var i = 0; i < videoCastList.length; i++) {
var videoCast = videoCastList[i];
str += "" + videoCast.name + " ";
}
$(".yanyuanul").append(str);
}
if (data.videoGenresList.length > 0) {
var videoGenresList = data.videoGenresList;
var str = "";
for (var i = 0; i < videoGenresList.length; i++) {
var videoGenres = videoGenresList[i];
if (bigType == '步兵' && i == 0) {
str += "" + videoGenres.name + " ";
} else {
str += "" + videoGenres.name + " ";
}
}
$(".leixingul").append(str);
}
if (searchSelectFlag && bigType != '步兵') {
$("ul.leixingul").find("a.btn-warm").removeClass("btn-warm");
if (bigType == '足舐') {
$("ul.leixingul").find("a:eq(3)").addClass("btn-warm");
} else if (bigType == '码池') {
$("ul.leixingul").find("a:eq(1)").addClass("btn-warm");
} else {
$("ul.leixingul").find("a:eq(1)").addClass("btn-warm");
}
}
$(".searchbtn").unbind("click");
$(".searchbtn").click(function () {
$(this).closest('ul').find(".searchbtn").removeClass("btn-warm");
$(this).addClass("btn-warm");
if ($(this).attr('order') != undefined) {
var order = $(this).attr('order');
if ("desc" == order) {
$(this).attr("order", "asc");
} else if ("asc" == order) {
$(this).attr("order", "desc");
}
}
$("#wd").val("");
search(1, false, false);
});
} else {
alert(data.message);
}
},
beforeSend: function () {
//请求前的处理
if (!startFlag) {
$(".loading-shaixuan").css("display", "block");
}
},
complete: function () {
//请求完成的处理
if (!startFlag) {
$(".loading-shaixuan").css("display", "none");
}
},
error: function (data) {
//请求出错处理
alert('error:' + data);
}
});
}
/**
* 初始化主内容事件
*/
function initContentEvent() {
var prepath = $("#bigType").attr("prepath");
// $(".playvideo").dblclick(function () {
// if (prepath == "machi") {
// return;
// }
//
// if ($("#playvideo").css("display") === 'none') {
// $("#playvideo").css("display", "block");
// $("#playvideo").find("video").attr("src", prepath + "/" + $(this).attr("videoUrl"));
// $("#playvideo").find("video").prop('muted', true);
// } else if ($("#playvideo").css("display") === 'block') {
// $("#playvideo").css("display", "none");
// $("#playvideo").find("video").attr("src", "");
// }
// });
$(".videodetail").click(function () {
var bigTypeText = $("#bigType").text();
if (bigTypeText == '足舐') {
var orginUrl = $(this).attr("orginUrl");
let orginUrlArr = orginUrl.split(",");
window.open(orginUrlArr[0]);
} else {
var type = $("#bigType").attr("prepath");
var code = $(this).attr("identificationCode");
window.open("voddetail.html?type=" + type + "&code=" + code, "_blank");
}
});
$(".bigpreview").dblclick(function () {
if ($("#bigpreview").css("display") === 'none') {
$("#bigpreview").css("display", "block");
$("#bigpreview").find("img").attr("src", "apics/" + $(this).attr("imgUrl"));
} else if ($("#bigpreview").css("display") === 'block') {
$("#bigpreview").css("display", "none");
$("#bigpreview").find("img").attr("src", "");
}
});
$(".identificationCode").dblclick(function () {
let s = $(this).parent().find("input[type='hidden']");
if ($(s).attr("javdbUrl") != null && $(s).attr("javdbUrl") !== "null") {
window.open($(s).attr("javdbUrl"), "_blank");
} else {
window.open("https://www.javbus.com/" + $(this).text(), "_blank");
}
});
$(".identificationDate").dblclick(function () {
let title = $(this).attr("title");
let orginUrlArr = title.split(",");
if (orginUrlArr.length > 1) {
window.open(orginUrlArr[1]);
}
});
initOther4Popup();
}
function initOther4Popup(){
let clickTimer = null;
// 打开弹窗
$("span.xp").unbind("click");
$("span.xp").on("click", function (e) {
clearTimeout(clickTimer);
clickTimer = setTimeout(() => {
let parent = $(this).parent();
var commentfirst = parent.find("input[type='hidden']").eq(0).attr("commentfirst");
var commenttwo = parent.find("input[type='hidden']").eq(1).attr("commenttwo");
var commentxp = parent.find("input[type='hidden']").eq(2).attr("commentxp");
var commentscore = parent.find("input[type='hidden']").eq(3).attr("commentscore");
var bigtype = parent.find("input[type='hidden']").eq(4).attr("bigtype");
var identificationCode = $(this).attr("identificationCode");
var javdbUrl = $(this).attr("title");
quietPop(bigtype, identificationCode, commentfirst, commenttwo, commentxp, commentscore, javdbUrl);
$(".popup-video").fadeIn();
centerPopup(); // 调用居中函数
}, 300); // 300ms 是判断单击和双击的时间间隔
});
$("span.xp").off("dblclick");
$("span.xp").dblclick(function (e) {
clearTimeout(clickTimer);
let javdbUrl = $(this).attr("title");
if (javdbUrl != null) {
window.open(javdbUrl, "_blank");
}
});
// 关闭弹窗
$(".close-btn").unbind("click");
$(".close-btn").on("click", function () {
$(".popup-video").fadeOut();
});
// 阻止表单默认提交行为
$(".popup-video form").on("submit", function (e) {
e.preventDefault();
var nameEn = $("#popup-form-hidden-nameEn").val();
if (nameEn === '骑兵') {
insertOrUpdateQibingSubmit();
}
});
// 实现拖动功能
let isDragging = false;
let offsetX, offsetY;
$("#draggable-popup h2").on("mousedown", function (e) {
// 判断如果点击在 input 或 select 上,不触发拖动
if ($(e.target).closest("input, select, label").length) {
return; // 如果按在 input 或 select 上,不启动拖动
}
isDragging = true;
offsetX = e.clientX - $(this).offset().left;
offsetY = e.clientY - $(this).offset().top;
$(this).css("cursor", "grabbing"); // 改变鼠标指针样式
});
$(document).on("mousemove", function (e) {
if (isDragging) {
const left = e.clientX - offsetX;
const top = e.clientY - offsetY;
$("#draggable-popup").css({
left: `${left}px`,
top: `${top}px`,
});
}
});
$(document).on("mouseup", function () {
isDragging = false;
$("#draggable-popup").css("cursor", "move"); // 恢复鼠标指针样式
});
// 重置按钮的功能
$("#reset-button").on("click", function () {
$("#result-container").fadeOut(); // 隐藏请求结果区域
$(".loading-icon").fadeOut(); // 重置时隐藏加载图标
});
}
// 显示加载图标
function showLoading() {
$("#result-content").text(""); // 清空内容
$("#result-container").hide(); // 使用 hide() 快速隐藏
$("#loading-icon").fadeIn(); // 显示加载图标
}
// 计算并设置弹窗居中位置
function centerPopup() {
const popup = $("#draggable-popup");
const windowWidth = $(window).width();
const windowHeight = $(window).height();
const popupWidth = popup.outerWidth();
const popupHeight = popup.outerHeight();
// 计算弹窗的位置
const left = (windowWidth - popupWidth) / 2;
const top = (windowHeight - popupHeight) / 4;
// 设置弹窗的位置
popup.css({
left: `${left}px`,
top: `${top}px`,
});
}
function quietPop(bigtype, identificationCode, commentfirst, commenttwo, commentxp, commentscore, javdburl) {
if (bigtype === '骑兵') {
let formContent = "";
formContent += 'code:
';
formContent += 'commentfirst:
';
formContent += 'commenttwo:
';
formContent += 'commentxp:
';
formContent += 'commentscore:
';
formContent += 'javdburl:
';
$("#form-container-2").html(formContent);
$("#popup-form-hidden-nameEn").val(bigtype);
$("#draggable-popup > h2").text("InsertOrUpdate4Qibing");
}
}
function insertOrUpdateQibingSubmit(){
var formData = new FormData($("#popup-form")[0]);
formData.append("userName", getCookie('username'));
$.ajax({
url: "videoInfo/insertOrUpdateQibing", //请求的url地址
dataType: "json", //返回格式为json
data: formData, //参数值
type: "post", //请求方式
processData: false,// 告诉jQuery不要去处理发送的数据
contentType: false,// 告诉jQuery不要去设置Content-Type请求头
async: true, //请求是否异步,默认为异步,这也是ajax重要特性
success: function (data) {
//$(".popup > .watchlist-loading").css("display", "none");
//请求成功时处理
if (data != null && $.trim(data) != "" && data.success) {
$("#searchbutton").click();
} else {
//$("#insertOrUpdateAlert").html(data.message);
}
// 在请求成功后填充数据到结果区域
$("#result-content").text(JSON.stringify(data, null, 2));
$("#loading-icon").fadeOut();
$("#result-container").fadeIn(); // 显示结果区域
},
beforeSend: function () {
//$(".popup > .watchlist-loading").css("display", "block");
showLoading(); // 显示加载状态
},
complete: function () {
},
error: function (data) {
//请求出错处理
console.log("insertOrUpdateQibing-submit error," + data);
}
});
}