my-video.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  1. $(function () {
  2. initOther();
  3. search(1, true, false);
  4. });
  5. /**
  6. * 初始化其他操作
  7. */
  8. function initOther() {
  9. $(".slideDown-btn").click(function () {
  10. var display = $('.slideDown-box');
  11. if (display.css('display') == 'block') {
  12. display.slideUp("slow");
  13. $(this).html('展开 <i class="fa fa-angle-down"></i>');
  14. } else {
  15. display.slideDown("slow");
  16. $(this).html('收起 <i class="fa fa-angle-up"></i>');
  17. }
  18. });
  19. $("#searchbutton").click(function () {
  20. search(1, false, false);
  21. });
  22. $("#shaixuan").click(function () {
  23. $("#wd").val("");
  24. search(1, false, false);
  25. });
  26. $("#wd").keydown(function (e) {
  27. if (e.keyCode == 13) {
  28. search(1, false, false);
  29. }
  30. });
  31. $(".dropdown-box").find("li").click(function () {
  32. $("#bigType").text($(this).text());
  33. $("#bigType").attr("prepath", $(this).attr("prepath"));
  34. $(".dropdown-box").attr("style", "display: none;");
  35. if ($(this).text() == '足舐') {
  36. $(".lovefoot").attr("style", "display: block;");
  37. } else {
  38. $(".lovefoot").attr("style", "display: none;");
  39. }
  40. getQueryHeaderInfo($("#bigType").text(), false, true);
  41. search(1, false, true);
  42. });
  43. $(".dropdown-hover").mouseover(function () {
  44. $(".dropdown-box").attr("style", "display: block;");
  45. });
  46. $(".dropdown-hover").mouseout(function () {
  47. $(".dropdown-box").attr("style", "display: none;");
  48. });
  49. $(".clearAll").click(function () {
  50. $("#playvideo").find("video").attr("src", "");
  51. $("#bigpreview").find("img").attr("src", "");
  52. $("#playvideo").css("display", "none");
  53. $("#bigpreview").css("display", "none");
  54. });
  55. }
  56. /**
  57. * 多条件搜索
  58. * @param pageNo
  59. */
  60. function search(pageNo, startFlag, searchSelectFlag) {
  61. var genres = "";
  62. var cast = "";
  63. var keyword = "";
  64. if (searchSelectFlag) {
  65. $("#wd").val("");
  66. }
  67. if (!startFlag) {
  68. genres = $(".leixingul").find(".btn-warm").text().replace("全部", "");
  69. cast = $(".yanyuanul").find(".btn-warm").text().replace("全部", "");
  70. keyword = $("#wd").val();
  71. }
  72. var orderField = $(".paixuul").find(".btn-warm").attr("orderField");
  73. var order = $(".paixuul").find(".btn-warm").attr("order");
  74. var bigType = $("#bigType").text();
  75. var prepath = $("#bigType").attr("prepath");
  76. if (searchSelectFlag) {
  77. genres = "";
  78. cast = "";
  79. if (bigType == '足舐') {
  80. orderField = "vi.update_date";
  81. } else {
  82. orderField = "vi.issue_date";
  83. }
  84. order = "desc";
  85. }
  86. $.ajax({
  87. url: "videoInfo/getVideoInfoPage", //请求的url地址
  88. dataType: "json", //返回格式为json
  89. data: JSON.stringify({
  90. "pageNo": pageNo,
  91. "pageSize": 10,
  92. "genres": genres,
  93. "cast": cast,
  94. "orderField": orderField,
  95. "order": order,
  96. "keyword": keyword,
  97. "bigType": bigType
  98. }), //参数值
  99. type: "post", //请求方式
  100. contentType: "application/json;charset=utf-8",
  101. async: true, //请求是否异步,默认为异步,这也是ajax重要特性
  102. success: function (data) {
  103. //请求成功时处理
  104. if (data != null && $.trim(data) != "" && data.success) {
  105. if (startFlag) {
  106. getQueryHeaderInfo($("#bigType").text(), startFlag, false);
  107. }
  108. data = data.data;
  109. var videoInfoList = data.list;
  110. var str = "";
  111. for (var i = 0; i < videoInfoList.length; i++) {
  112. var videoInfo = videoInfoList[i];
  113. var date = videoInfo.issueDate;
  114. if (orderField == 'vi.modify_time') {
  115. date = videoInfo.modifyTime;
  116. } else if (orderField == 'vi.update_date') {
  117. date = videoInfo.updateDate;
  118. }
  119. var scoreStr = '';
  120. var orginUrl= '';
  121. if (bigType == '骑兵') {
  122. scoreStr += videoInfo.resolutionRatio + '|';
  123. scoreStr += (videoInfo.original === null ? '?' : (videoInfo.original == 1 ? '原档' : '非原档')) + '|';
  124. scoreStr += (videoInfo.subtitle === null ? '?' : (videoInfo.subtitle == 1 ? '字幕' : '无字幕')) + '|';
  125. scoreStr += (videoInfo.recoding === null ? '?' : (videoInfo.recoding == 1 ? '压缩' : '未压缩')) + '|';
  126. scoreStr += videoInfo.score;
  127. } else if (bigType == '码池') {
  128. scoreStr += (videoInfo.videoInfoFlag === 'false' ? '' : '骑兵|');
  129. scoreStr += (videoInfo.videoLoveFootFlag === 'false' ? '' : '足舐|');
  130. scoreStr += (videoInfo.type === 1 ? '待审查' : (videoInfo.type === 2 ? '审查中' : (videoInfo.type === 3 ? '审查已通过' : '审查未通过'))) + '|';
  131. scoreStr += videoInfo.score;
  132. } else if (bigType == '足舐') {
  133. scoreStr += (videoInfo.videoInfoFlag === 'false' ? '' : '骑兵|');
  134. scoreStr += (videoInfo.videoInfoPoolFlag === 'false' ? '' : '码池|');
  135. scoreStr += (videoInfo.type === 1 ? '爬取失败' : (videoInfo.type === 2 ? '待审查' : (videoInfo.type === 3 ? '审查已通过' : '审查未通过'))) + '|';
  136. scoreStr += videoInfo.score;
  137. orginUrl += videoInfo.orginAvnoashiUrl === null ? '' : videoInfo.orginAvnoashiUrl;
  138. orginUrl += (videoInfo.orginAvnoashiUrl != null && videoInfo.orginJpfootUrl != null) ? ',' : '';
  139. orginUrl += videoInfo.orginJpfootUrl === null ? '' : videoInfo.orginJpfootUrl;
  140. } else {
  141. scoreStr = videoInfo.score;
  142. }
  143. str += "<li class=\"col-lg-8 col-md-6 col-sm-4 col-xs-3\">" +
  144. " <div class=\"myui-vodlist__box\">" +
  145. " <a class=\"myui-vodlist__thumb lazyload\" title=\"\" style=\"background-image: url(&quot;apics/" + videoInfo.imgUrl + "&quot;);\">" +
  146. " <span class=\"bigpreview playvideo play hidden-xs\" imgUrl='" + videoInfo.imgUrl + "'></span>" +
  147. " <span class=\"pic-tag pic-tag-top\">" +
  148. " <span class=\"tag identificationCode\" title=\"https://www.javbus.com/" + videoInfo.identificationCode + "\" style=\"background-color: #FB7299;\">" + videoInfo.identificationCode + "</span>" +
  149. " <span class=\"tag identificationDate\" title=\"" + orginUrl + "\" style=\"background-color: #00C0FF;\">" + date + "</span>" +
  150. " </span>" +
  151. " <span class=\"pic-text text-right\" title='" + (videoInfo.comment === '' ? '暂无评论' : videoInfo.comment) + "'>" + scoreStr + "</span>" +
  152. " </a>" +
  153. " <div class=\"myui-vodlist__detail\">" +
  154. " <h4 class=\"videodetail title text-overflow\" identificationCode='" + videoInfo.identificationCode + "' orginUrl='" + videoInfo.orginUrl + "'><a title=\" " + videoInfo.name + " \">" + videoInfo.name + "</a></h4>" +
  155. " <p class=\"text text-overflow text-muted hidden-xs\" title='" + videoInfo.mainWho + "'>直属:" + videoInfo.mainWho + "</p>" +
  156. " </div>" +
  157. " </div>" +
  158. "</li>";
  159. }
  160. $(".myui-vodlist").html(str);
  161. if (str == "") {
  162. $(".vodlistnone").attr("style", "padding: 50px;display: block;");
  163. $(".myui-page").html("");
  164. } else {
  165. $(".vodlistnone").attr("style", "padding: 50px;display: none;");
  166. $(".myui-page").pagination({
  167. pageSize: "10",
  168. pageNo: pageNo,
  169. total: data.total,
  170. callback: function (pageNo) {
  171. //$("#wd").val("");
  172. search(pageNo, false, false);
  173. }
  174. });
  175. }
  176. initContentEvent();
  177. } else {
  178. alert(data.message);
  179. }
  180. },
  181. beforeSend: function () {
  182. //请求前的处理
  183. if (startFlag) {
  184. $("#cover").css("display", "block");
  185. } else {
  186. $(".loading").css("display", "block");
  187. }
  188. },
  189. complete: function () {
  190. //请求完成的处理
  191. if (startFlag) {
  192. $("#cover").css("display", "none");
  193. } else {
  194. $(".loading").css("display", "none");
  195. }
  196. },
  197. error: function (data) {
  198. //请求出错处理
  199. alert('error:' + data);
  200. }
  201. });
  202. }
  203. /**
  204. * 查询头信息
  205. * @param bigType
  206. * @param startFlag
  207. */
  208. function getQueryHeaderInfo(bigType, startFlag, searchSelectFlag) {
  209. var infantryType = "";
  210. if (bigType == '步兵' && !searchSelectFlag) {
  211. infantryType = $(".leixingul").find(".btn-warm").text().replace("全部", "");
  212. }
  213. $.ajax({
  214. url: "queryHeader/getQueryHeaderInfo", //请求的url地址
  215. dataType: "json", //返回格式为json
  216. data: {"bigType": bigType, "infantryType": infantryType}, //参数值
  217. type: "post", //请求方式
  218. async: !startFlag, //请求是否异步,默认为异步,这也是ajax重要特性
  219. success: function (data) {
  220. if (bigType == '步兵') {
  221. $(".leixingli").css("display", "none");
  222. } else {
  223. $(".leixingli").css("display", "block");
  224. }
  225. if (searchSelectFlag) {
  226. $("ul.leixingul").find("a:eq(1)").addClass("btn-warm");
  227. $("ul.yanyuanul").find("a:eq(1)").addClass("btn-warm");
  228. $("ul.paixuul").find("a.btn-warm").removeClass("btn-warm");
  229. if (bigType == '足舐') {
  230. $("ul.paixuul").find("a:eq(3)").addClass("btn-warm");
  231. } else {
  232. $("ul.paixuul").find("a:eq(1)").addClass("btn-warm");
  233. }
  234. }
  235. //请求成功时处理
  236. if (data != null && $.trim(data.data) != "" && data.success) {
  237. data = data.data;
  238. if ($.isEmptyObject(data)) {
  239. if ($(".displayli").length > 0) {
  240. $(".displayli").remove();
  241. }
  242. $(".vodlistnone").attr("style", "padding: 50px;display: block;");
  243. $(".myui-vodlist").html("");
  244. $(".myui-page").html("");
  245. return;
  246. }
  247. if ($(".displayli").length > 0) {
  248. $(".displayli").remove();
  249. }
  250. if (data.videoCastList.length > 0) {
  251. var videoCastList = data.videoCastList;
  252. var str = "";
  253. for (var i = 0; i < videoCastList.length; i++) {
  254. var videoCast = videoCastList[i];
  255. str += "<li class='displayli'><a class=\"btn searchbtn\" title='" + videoCast.count + "'>" + videoCast.name + "</a></li>";
  256. }
  257. $(".yanyuanul").append(str);
  258. }
  259. if (data.videoGenresList.length > 0) {
  260. var videoGenresList = data.videoGenresList;
  261. var str = "";
  262. for (var i = 0; i < videoGenresList.length; i++) {
  263. var videoGenres = videoGenresList[i];
  264. if (bigType == '步兵' && i == 0) {
  265. str += "<li class='displayli'><a class=\"btn btn-warm searchbtn\" title='" + videoGenres.count + "'>" + videoGenres.name + "</a></li>";
  266. } else {
  267. str += "<li class='displayli'><a class=\"btn searchbtn\" title='" + videoGenres.count + "'>" + videoGenres.name + "</a></li>";
  268. }
  269. }
  270. $(".leixingul").append(str);
  271. }
  272. $(".searchbtn").unbind("click");
  273. $(".searchbtn").click(function () {
  274. $(this).closest('ul').find(".searchbtn").removeClass("btn-warm");
  275. $(this).addClass("btn-warm");
  276. if ($(this).attr('order') != undefined) {
  277. var order = $(this).attr('order');
  278. if ("desc" == order) {
  279. $(this).attr("order", "asc");
  280. } else if ("asc" == order) {
  281. $(this).attr("order", "desc");
  282. }
  283. }
  284. $("#wd").val("");
  285. search(1, false, false);
  286. });
  287. } else {
  288. alert(data.message);
  289. }
  290. },
  291. beforeSend: function () {
  292. //请求前的处理
  293. if (!startFlag) {
  294. $(".loading-shaixuan").css("display", "block");
  295. }
  296. },
  297. complete: function () {
  298. //请求完成的处理
  299. if (!startFlag) {
  300. $(".loading-shaixuan").css("display", "none");
  301. }
  302. },
  303. error: function (data) {
  304. //请求出错处理
  305. alert('error:' + data);
  306. }
  307. });
  308. }
  309. /**
  310. * 初始化主内容事件
  311. */
  312. function initContentEvent() {
  313. var prepath = $("#bigType").attr("prepath");
  314. // $(".playvideo").dblclick(function () {
  315. // if (prepath == "machi") {
  316. // return;
  317. // }
  318. //
  319. // if ($("#playvideo").css("display") === 'none') {
  320. // $("#playvideo").css("display", "block");
  321. // $("#playvideo").find("video").attr("src", prepath + "/" + $(this).attr("videoUrl"));
  322. // $("#playvideo").find("video").prop('muted', true);
  323. // } else if ($("#playvideo").css("display") === 'block') {
  324. // $("#playvideo").css("display", "none");
  325. // $("#playvideo").find("video").attr("src", "");
  326. // }
  327. // });
  328. $(".videodetail").click(function () {
  329. var bigTypeText = $("#bigType").text();
  330. if (bigTypeText == '足舐') {
  331. var orginUrl = $(this).attr("orginUrl");
  332. let orginUrlArr = orginUrl.split(",");
  333. window.open(orginUrlArr[0]);
  334. } else {
  335. var type = $("#bigType").attr("prepath");
  336. var code = $(this).attr("identificationCode");
  337. window.open("voddetail.html?type=" + type + "&code=" + code, "_blank");
  338. }
  339. });
  340. $(".bigpreview").dblclick(function () {
  341. if ($("#bigpreview").css("display") === 'none') {
  342. $("#bigpreview").css("display", "block");
  343. $("#bigpreview").find("img").attr("src", "apics/" + $(this).attr("imgUrl"));
  344. } else if ($("#bigpreview").css("display") === 'block') {
  345. $("#bigpreview").css("display", "none");
  346. $("#bigpreview").find("img").attr("src", "");
  347. }
  348. });
  349. $(".identificationCode").dblclick(function () {
  350. window.open("https://www.javbus.com/" + $(this).text(), "_blank");
  351. });
  352. $(".identificationDate").dblclick(function () {
  353. let title = $(this).attr("title");
  354. let orginUrlArr = title.split(",");
  355. if (orginUrlArr.length > 1) {
  356. window.open(orginUrlArr[1]);
  357. }
  358. });
  359. }