collection.js 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. $(document).ready(function () {
  2. $('.logo').on('click', function() {
  3. localStorage.setItem('logo', true);
  4. $(location).attr("href", "index.html?logo=true");
  5. })
  6. let url = window.location.search;
  7. var theRequest = new Object();
  8. if (url.indexOf("?") != -1) {
  9. var str = url.substr(1);
  10. strs = str.split("&");
  11. for (var i = 0; i < strs.length; i++) {
  12. theRequest[strs[i].split("=")[0]] = unescape(
  13. decodeURIComponent(strs[i].split("=")[1])
  14. );
  15. }
  16. }
  17. console.log(theRequest)
  18. $('.back').on('click', function () {
  19. window.location.href = "index.html?labelname=" +
  20. theRequest.labelname +
  21. "&type=" +
  22. theRequest.type +
  23. "&videotype=" +
  24. theRequest.videotype +
  25. "&name=" +
  26. theRequest.name;
  27. })
  28. var uid = localStorage.getItem("uid");
  29. LanguageSwitching();
  30. // 获取收藏数据
  31. function getData() {
  32. $.ajax({
  33. type: "post",
  34. url: "https://www.bibidd.com/bibidd/Mediasix/shoucang_list_test",
  35. dataType: "json",
  36. data: {
  37. uid: uid,
  38. },
  39. success: function (res) {
  40. let dataArray = res.data;
  41. if(dataArray.length==0) {
  42. $('.bottomLoadContent').hide();
  43. $("#tip").show();
  44. var languageParameter = localStorage.getItem('language') || 'CN';
  45. if(languageParameter == 'CN') {
  46. $(".tiptext").text('暫無收藏數據');
  47. }else{
  48. $(".tiptext").text('The data you need is not found.');
  49. }
  50. }else{
  51. $("#tip").hide();
  52. }
  53. let videoHtml = "";
  54. $.each(dataArray, function (index, data) {
  55. if(data.top_img != 'https://www.bibidd.com/bibidd_testtest/A.jpg') {
  56. videoHtml += '<div id="videoContent' + index + '" class="videoContent">';
  57. videoHtml +=
  58. '<div class="lazy videoPhoto" data-original="' + data.top_img + '">';
  59. videoHtml +=
  60. ' <div class="videoTime">' + videoTime(data.time_chuo) + "</div>";
  61. videoHtml +=
  62. ' <div class="close">';
  63. videoHtml +=
  64. ' <img class="closeImg" src="/Public/bibidd/images/close.png"/>';
  65. videoHtml += " </div>";
  66. videoHtml += " </div>";
  67. videoHtml += ' <div class="videoTitle">' + data.title + "</div>";
  68. videoHtml += "</div>";
  69. }
  70. });
  71. $(".video").html(videoHtml);
  72. },
  73. complete: function (res) {
  74. let dataArray = res.responseJSON.data;
  75. var loadingUrl = "/Public/bibidd/images/loading.png";
  76. $(".lazy").lazyload({
  77. effect: 'show',
  78. placeholder: loadingUrl,
  79. failurelimit: 10,
  80. skip_invisible: false,
  81. });
  82. // 取消收藏
  83. $(".close").on("click", function (event) {
  84. event.stopPropagation();
  85. // 取消收藏
  86. let closetype =
  87. dataArray[$(this).parent().parent().index()].type;
  88. const id = dataArray[$(this).parent().parent().index()].id;
  89. if (closetype === 'novel') {
  90. // 取消收藏小说
  91. $.ajax({
  92. type: 'post',
  93. url: 'https://www.bibidd.com/bibidd/Nnovel/close_novel_shoucang',
  94. dataType: "json",
  95. data: {
  96. n_id: id,
  97. uid: uid
  98. },
  99. success: function (res) {
  100. },
  101. complete: function (res) {
  102. getData();
  103. }
  104. })
  105. } else {
  106. // 取消收藏视频或图片
  107. closetype =
  108. dataArray[$(this).parent().parent().index()].type === "imgs" ? "img" : "video";
  109. $.ajax({
  110. type: "post",
  111. url: "https://www.bibidd.com/bibidd/Mediasix/quxiao_shoucang",
  112. dataType: "json",
  113. data: {
  114. type: closetype,
  115. cid: id,
  116. uid: uid,
  117. },
  118. success: function (res) {
  119. },
  120. complete: function (res) {
  121. getData();
  122. },
  123. });
  124. }
  125. });
  126. // 查看收藏详情
  127. $(".videoContent").on("click", function () {
  128. $(location).attr("href", "videodetails.html?videoid=" +
  129. dataArray[$(this).index()].id +
  130. "&fabulous=" +
  131. dataArray[$(this).index()].thumbs_up +
  132. "&videoname=" +
  133. dataArray[$(this).index()].title +
  134. "&favorite=" +
  135. dataArray[$(this).index()].favorite +
  136. "labelname=" +
  137. theRequest.labelname +
  138. "&type=" +
  139. theRequest.type +
  140. "&videotype=" +
  141. theRequest.videotype +
  142. "&name=" +
  143. theRequest.name)
  144. });
  145. },
  146. });
  147. }
  148. getData();
  149. // 判断屏幕滚动高度是否超过1屏
  150. $(window).scroll(function () {
  151. var scrollT = $(document).scrollTop();
  152. var offsetT = $(".videopage").offset().top;
  153. if (scrollT >= offsetT) {
  154. $(".backToTop").show();
  155. } else {
  156. $(".backToTop").hide();
  157. }
  158. });
  159. // 返回顶部
  160. $(".backToTop").on("click", function () {
  161. $("html, body").animate(
  162. {
  163. scrollTop: 0,
  164. },
  165. 500
  166. );
  167. });
  168. function videoTime(time) {
  169. let timeStr = "";
  170. let h =
  171. Math.floor(time / 60 / 60) < 10
  172. ? "0" + Math.floor(time / 60 / 60)
  173. : Math.floor(time / 60 / 60);
  174. let m =
  175. Math.floor(Math.floor(time / 60) % 60) < 10
  176. ? "0" + Math.floor(Math.floor(time / 60) % 60)
  177. : Math.floor(Math.floor(time / 60) % 60);
  178. let s =
  179. Math.floor(time % 60) < 10
  180. ? "0" + Math.floor(time % 60)
  181. : Math.floor(time % 60);
  182. timeStr = h + ":" + m + ":" + s;
  183. return timeStr;
  184. }
  185. var languageIsLong = false;
  186. $('.language').on('click', function() {
  187. if(languageIsLong) {
  188. $('.language img').attr('src', '/Public/bibidd/images/shang.png');
  189. $(".languageWrap").css('height','50px');
  190. }else{
  191. $('.language img').attr('src', '/Public/bibidd/images/xia.png');
  192. $(".languageWrap").css('height','150px');
  193. window.scrollTo(0, 99999999999);
  194. }
  195. languageIsLong = !languageIsLong;
  196. })
  197. $('.languageText').on('click', function() {
  198. languageIsLong = !languageIsLong;
  199. $('.language img').attr('src', '/Public/bibidd/images/shang.png');
  200. $(".languageWrap").css('height','50px');
  201. if($(this).attr('id') == 'CN') {
  202. // 切换中文
  203. localStorage.setItem('language', 'CN');
  204. }else{
  205. // 切换英文
  206. localStorage.setItem('language', 'EN');
  207. }
  208. LanguageSwitching();
  209. })
  210. function LanguageSwitching() {
  211. var languageParameter = localStorage.getItem('language') || 'CN';
  212. if ( languageParameter == 'CN') {
  213. // 切换中文语言
  214. $(".tiptext").text('暫無收藏數據');
  215. $("h2").text('我的收藏');
  216. $('.language').find('p').eq(0).text('語言');
  217. $('.footerTitle').text('世界上最大的色情網站');
  218. $('.footerText').text("9169團隊每天都在更新和添加更多的色情視頻。 我們提供流媒體色情視頻、XXX相册和網絡上排名第一的免費性愛社區。 我們一直在努力新增更多的功能,讓你對色情的熱愛一直保持下去。");
  219. }else if (!languageParameter || languageParameter == 'EN'){
  220. // 切换英文语言
  221. $(".tiptext").text('The data you need is not found.');
  222. $("h2").text('My Collection');
  223. $('.language').find('p').eq(0).text('Language');
  224. $('.footerTitle').text("The world's largest pornographic website");
  225. $('.footerText').text("The 9169 team is always updating and adding more porn videos every day.We offer streaming porn videos, XXX photo albums, and the number 1 free sex community on the net. We’re always working towards adding more features that will keep your love for porno alive and well.");
  226. }
  227. }
  228. });