common.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. var lotLists = [];
  2. $(function () {
  3. isFold()
  4. initLotList();
  5. $(".hot-lot-lable").click(function () {
  6. var id = $(this).attr("id");
  7. var index = $(".hot-lot-lable").index(this);
  8. $(".hot-lot-lable").removeClass("active").eq(index).addClass("active");
  9. $(".hot-lottery-content").removeClass("active").eq(index).addClass("active");
  10. refreshLotList(id);
  11. })
  12. $(".wfgz-lable").click(function () {
  13. var index = $(".wfgz-lable").index(this);
  14. $(".wfgz-lable").removeClass("active").eq(index).addClass("active");
  15. $(".wfgz-content").removeClass("active").eq(index).addClass("active");
  16. })
  17. $(".lot-title").click(function () {
  18. var index = $(".lot-title").index(this);
  19. if ($(this).hasClass("active")) {
  20. $(this).removeClass("active");
  21. $(".lot-list-wrapper").eq(index).removeClass("active");
  22. }
  23. else {
  24. $(".lot-title").removeClass("active").eq(index).addClass("active");
  25. $(".lot-list-wrapper").removeClass("active").eq(index).addClass("active");
  26. }
  27. })
  28. })
  29. function initLotList() {
  30. if (lotLists.length > 0) {
  31. for (var i = 0; i < lotLists.length; i++) {
  32. lotLists[i].dele();
  33. }
  34. }
  35. lotLists = [];
  36. $(".typecell-list").each(function (i, e) {
  37. var c = $(e).children(".lotCode:eq(0)").val();
  38. var t = $(e).children(".time:eq(0)").val();
  39. lotLists[i] = new Balljump(e, c, t);
  40. })
  41. }
  42. function refreshLotList(id) {
  43. $.ajax({
  44. type: "post",
  45. url: "/Template/_getNavLotteryTable",
  46. data: {
  47. id: id
  48. },
  49. success: function (res) {
  50. $("#GPC-box").html(res);
  51. initLotList();
  52. }
  53. });
  54. }
  55. function IsPC() {
  56. var userAgentInfo = navigator.userAgent;
  57. var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
  58. var flag = true;
  59. for (var v = 0; v < Agents.length; v++) {
  60. if (userAgentInfo.indexOf(Agents[v]) > 0) {
  61. flag = false;
  62. break;
  63. }
  64. }
  65. return flag;
  66. }
  67. function isFold() {
  68. var PC = IsPC();
  69. if (!PC) {
  70. $(".main").addClass('pon')
  71. } else {
  72. $(".main").removeClass('pon')
  73. }
  74. }