index.js 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. // url生成二维码
  2. var qrcode = new QRCode(document.getElementById("qrcode"), {
  3. width: 100,
  4. height: 100
  5. });
  6. $(".download").click(function () {
  7. var p_text = $(this).find("#text-1").text();
  8. var p_title = $(this).find("#text-2").text();
  9. var p_page = $(this).find("#download-page").text();
  10. qrcode.makeCode(p_page);
  11. $('.az_hover a').attr('href', p_text);
  12. $('.download_popup p').html(p_title);
  13. });
  14. $(function () {
  15. $("#J_rank_list").load('/Layout/gameRankList');
  16. $(".public_nav li").removeClass('current_page');
  17. });
  18. var keyword = encodeURI('{$keyword}');
  19. var AjaxGamePage = function (page) {
  20. $.ajax({
  21. url: '/search/_getGameList' + '?keyword=' + keyword + '&page=' + page,
  22. type: 'post',
  23. dataType: 'json',
  24. data: { page: page },
  25. success: function (data) {
  26. var html = '';
  27. $.each(data.list.data, function (i, row) {
  28. html += '<div class="game_cont">'
  29. + '<div class="search_game_img">'
  30. + ' <a href="' + row.gameUrl + '" title="' + row.nickname + '" target="_blank" ><img src="' + row.icon + '" class="smallIcon" ></a>';
  31. if (row.libaonum) {
  32. html += '<a href="' + row.gameUrl + '" target="_blank" ><img class="havegift" src="/static/images/icon/gift.png"></a>';
  33. }
  34. html += '</div>'
  35. + '<h4><a href="' + row.gameUrl + '" title="' + row.nickname + '" target="_blank" >' + row.nickname + '</a></h4>'
  36. + '<p>' + row.size + '</p>'
  37. + '<p>' + row.subject + '<span>|</span>' + row.type + '</p>';
  38. if (row.download) {
  39. html += '<div class="download">';
  40. } else {
  41. html += '<div class="no_download">';
  42. }
  43. html += '<a href="javascript:">立即下载</a>'
  44. + '<span id="text-1" style="display: none;">' + row.download + '</span>'
  45. + '<span id="text-2" style="display: none;">' + row.nickname + '</span>'
  46. + '<span id="download-page" style="display: none;">http://wl.weilongwl.com/download/' + row.id + '.html</span></div></div>';
  47. });
  48. html += '<div class="page">' + data.page
  49. + '<div class="rows">共 <b>' + data.list.total + '</b>条 / <b>' + data.list.last_page + '</b>页 记录 </div></div>';
  50. $(".relate_game").html(html);
  51. }
  52. });
  53. // 调用js
  54. jsa();
  55. }
  56. var AjaxPage = function (page) {
  57. setTimeout(function () {
  58. $(".pagination li:first-child a").html('上一页');
  59. $(".pagination li:first-child span").html('上一页');
  60. $(".pagination li:last-child a").html('下一页');
  61. $(".pagination li:last-child span").html('下一页');
  62. $(".disabled").each(function () {
  63. var a = $(this).text();
  64. if (a = "...") {
  65. //修改父元素
  66. $(this).find("span").css("cssText", "background:#fff;color:#494949 !important;border:none;cursor: context-menu;");
  67. }
  68. });
  69. }, 300);
  70. $.ajax({
  71. url: '/search/_getNewsList' + '?keyword=' + keyword + '&page=' + page,
  72. type: 'get',
  73. dataType: 'json',
  74. success: function (data) {
  75. var html = '';
  76. $.each(data.list.data, function (i, row) {
  77. html += '<div class="game_detail">'
  78. + '<div class="content_left">'
  79. + '<a href="' + row.url + '" title="' + row.title + '" target="_blank"><img src="' + row.image + '"></a>'
  80. + '</div>'
  81. + '<div class="content_right">'
  82. + '<h4><a href="' + row.url + '" title="' + row.title + '" target="_blank">' + row.title + '</a> </h4>'
  83. + '<p><span>发布时间:' + row.createtime + '</span></p>'
  84. + '<div class="text"><p> ' + row.cutcontent + '</p></div>'
  85. + '</div>'
  86. + '</div>';
  87. });
  88. html += '<div class="page">' + data.page
  89. + '<div class="rows">共 <b>' + data.list.total + '</b>条 / <b>' + data.list.last_page + '</b>页 记录 </div></div>';
  90. $(".new_news").html(html);
  91. }
  92. });
  93. }
  94. // 输入框带值
  95. var keyword = $(".keyword").text();
  96. keyword = keyword.replace("\"", "").replace("\"", "");
  97. $("#search-input").val(keyword);
  98. $(document).ready(function () {
  99. var val = $('#search-input').val();
  100. val = val.replace(/\s*/g, "");
  101. var vala = $('#search-input').val();
  102. if (vala == "") {
  103. vala = $("#search-input").attr('placeholder');
  104. $("#search_ul").hide();
  105. } else if ($("#search_ul li").length > 0) {
  106. $("#search_ul").show();
  107. }
  108. if (!val.length || val.length == 0 || vala == " ") {
  109. $("#search_ul").hide();
  110. $("#search_ul").empty();
  111. return
  112. }
  113. $.ajax({
  114. type: 'POST',
  115. url: '/game/ajaxGameList',
  116. dataType: 'json',
  117. data: { keyword: val },
  118. success: function (json) {
  119. if ($.isEmptyObject(json)) {
  120. $("#search_ul").empty();
  121. $("#search_ul").hide();
  122. } else {
  123. var html = '',
  124. turl = '/game101';
  125. $.each(json, function (i, row) {
  126. toUrl = turl.replace('101', row.id)
  127. html += '<li><a href="' + toUrl + '" target="_blank">' + row.nickname + '</a></li>';
  128. });
  129. arrow = ' <div class="border-up-empty"> <span></span></div>'
  130. $("#search_ul").html(html + arrow);
  131. }
  132. }
  133. });
  134. });
  135. // 设置默认游戏icon
  136. $(".content_left img").error(function () {
  137. $(this).attr("src", "/static/images/icon/990-625.png");
  138. })
  139. // 异步加载js
  140. var jsa = function () {
  141. setTimeout(function () {
  142. $(".pagination li:first-child a").html('上一页');
  143. $(".pagination li:first-child span").html('上一页');
  144. $(".pagination li:last-child a").html('下一页');
  145. $(".pagination li:last-child span").html('下一页');
  146. $(".disabled").each(function () {
  147. var a = $(this).text();
  148. if (a = "...") {
  149. //修改父元素
  150. $(this).find("span").css("cssText", "background:#fff;color:#494949 !important;border:none;cursor: context-menu;");
  151. }
  152. });
  153. $(".download").click(function () {
  154. var p_text = $(this).find("#text-1").text();
  155. var p_title = $(this).find("#text-2").text();
  156. var p_page = $(this).find("#download-page").text();
  157. qrcode.makeCode(p_page);
  158. $('.az_hover a').attr('href', p_text);
  159. $('.download_popup p').html(p_title);
  160. });
  161. // 下载弹窗
  162. $(".az_code img").hover(function () {
  163. $(".download_popup .big_az_code").css("cssText", "display: block !important");
  164. }, function () {
  165. $(".download_popup .big_az_code").css("cssText", "display: none !important");
  166. });
  167. $(".download_popup .close").click(function () {
  168. $(".warp_download_popup").hide();
  169. });
  170. $(".download").click(function () {
  171. $(".warp_download_popup").show();
  172. });
  173. $(".tip .close,.determine,.cancel").click(function () {
  174. $(".warp_no_download_popup").hide();
  175. $(".warp_kf_popup").hide();
  176. });
  177. $(".no_download").click(function () {
  178. $(".warp_no_download_popup").show();
  179. });
  180. // 下载弹窗
  181. $(".small-code").hover(function () {
  182. $(".az_code_right .big_az_code").show();
  183. }, function () {
  184. $(".az_code_right .big_az_code").hide();
  185. });
  186. $(".rollBox").hover(function () {
  187. $(".manu_phone_left").show();
  188. $(".manu_phone_right").show();
  189. }, function () {
  190. $(".manu_phone_left").hide();
  191. $(".manu_phone_right").hide();
  192. });
  193. $(".az_hover").hover(function () {
  194. $(".az_hover img").attr("src", "/static/images/home/az-white.png");
  195. $(".az_hover span").css("cssText", "color:#fff !important");
  196. }, function () {
  197. $(".az_hover img").attr("src", "/static/images/home/SVG-07.png");
  198. $(".az_hover span").css("cssText", "color: #8cc63d !important");
  199. });
  200. }, 300);
  201. }