//JS操作cookies方法! //写cookies function setCookie(name, value) { var Days = 1; var exp = new Date(); exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000); document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString(); } function getCookie(name) { var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)"); if (arr = document.cookie.match(reg)) return unescape(arr[2]); else return null; } var lotLists = []; $(function () { isFold() //设置高频彩 刷新页面时当前的状态 var hotId = getCookie('hotId'); if (!hotId) { initLotList(); } else { $(".hot-lot-lable").removeClass("active") $(".hot-lot-btn-box").find('[name="'+hotId+'"]').addClass("active"); var hotIndex = $(".hot-lot-btn-box").find('[name="' + hotId + '"]').index(); $(".hot-lottery-content").removeClass("active").eq(hotIndex).addClass("active"); refreshLotList(hotId); } $(".hot-lot-lable").click(function () { var id = $(this).attr("name"); var index = $(".hot-lot-lable").index(this); $(".hot-lot-lable").removeClass("active").eq(index).addClass("active"); $(".hot-lottery-content").removeClass("active").eq(index).addClass("active"); refreshLotList(id); //存储id setCookie('hotId',id); }) $(".wfgz-lable").click(function () { var index = $(".wfgz-lable").index(this); $(".wfgz-lable").removeClass("active").eq(index).addClass("active"); $(".wfgz-content").removeClass("active").eq(index).addClass("active"); }) $(".lot-title").click(function () { var index = $(".lot-title").index(this); if ($(this).hasClass("active")) { $(this).removeClass("active"); $(".lot-list-wrapper").eq(index).removeClass("active"); } else { $(".lot-title").removeClass("active").eq(index).addClass("active"); $(".lot-list-wrapper").removeClass("active").eq(index).addClass("active"); } }) }) function initLotList() { if (lotLists.length > 0) { for (var i = 0; i < lotLists.length; i++) { lotLists[i].dele(); } } lotLists = []; $(".typecell-list").each(function (i, e) { var c = $(e).children(".lotCode:eq(0)").val(); var t = $(e).children(".time:eq(0)").val(); lotLists[i] = new Balljump(e, c, t); }) } function refreshLotList(name) { $.ajax({ type: "post", url: "/Template/Home_Tab", data: { czTypeEnum: name }, success: function (res) { var next = $("#GPC-box").next("section"); $("#GPC-box").remove(); next.before(res) initLotList(); } }); } function IsPC() { var userAgentInfo = navigator.userAgent; var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"]; var flag = true; for (var v = 0; v < Agents.length; v++) { if (userAgentInfo.indexOf(Agents[v]) > 0) { flag = false; break; } } return flag; } function isFold() { var PC = IsPC(); if (!PC) { $(".main").addClass('pon') } else { $(".main").removeClass('pon') } }