var thisPageIndex = 1; var thisTotalPage = $("#totalpage").val(); var thisRow = 30; var thisType = $(".tuku-category.tuku-active").data("type"); var thisQs = $("#currentqs").data("qs"); $(function () { setTimeout(function () { initWrapperTop(true) },150); setTimeout(wrapperScroll, 1000); $('.tuku-category').click(function () { var index = $(".tuku-category").index(this); $(".tuku-category").removeClass('tuku-active').eq(index).addClass('tuku-active'); thisType = $(".tuku-category").eq(index).data('type'); thisPageIndex = 0; thisq = $("#currentqs").data("qs"); if (thisType == 1) { $('#qishu').show(); getAll(1, "A", thisq, 1); } if (thisType == 2) { $('#qishu').show(); getHot(1, "彩吧图谜", thisq, 1); } if (thisType == 3) { $('#qishu').hide(); getNewest(1); } if (thisType == 4) { $('#qishu').hide(); getHistory(); } }) $("body").delegate(".tuku-area-item", "click", function () { var index = $(".tuku-area-item").index(this); $(".tuku-area-item").removeClass('area-selected').eq(index).addClass('area-selected'); thisPageIndex = 0; var text = $(this).find("span:eq(0)").text(); text = text.replace(/^\s+|\s+$/g, ""); var qs = $("#currentqs").data("qs"); if (thisType == 1) { getAll(2, text, qs ,3); } if (thisType == 2) { getHot(2, text, qs, 3); } $(".tuku-list-wrapper")[0].scrollTop = 0; }) }) function getAll(t, a, q, add) { initWrapperTop(true); //$(".tuku-wrapper").css("top", "140px"); if (t == 1) { el = $(".tuku-wrapper"); } if (t == 2) { el = $(".tuku-list-wrapper"); } var load = layer.load(2, { shade: [0.1, '#000'] }); $.ajax({ url: "/TK/GetTKQB", type: "post", async:false, data: { t: t, p: thisPageIndex + 1, r: thisRow, a: a, q: q }, success: function (res) { if (res != "") { thisPageIndex = thisPageIndex + 1; if (add == 1) { el.eq(0).html(res); thisTotalPage = $("#totalpage").val(); setTimeout(wrapperScroll, 1000); } if (add==2) { el.eq(0).append(res); } if (add == 3) { el.eq(0).html(res); thisTotalPage = $("#totalpage").val(); setTimeout(wrapperScroll, 1000); if (thisTotalPage == 0) { el.eq(0).html("
  • 暂无图片信息!
  • "); } } } else { layer.msg("没有更多数据了!") } layer.close(load); } }) } function getHot(t, n, q, add) { initWrapperTop(true); var load = layer.load(2, { shade: [0.1, '#000'] }); //$(".tuku-wrapper").css("top", "140px"); if (t == 1) { el = $(".tuku-wrapper"); } if (t == 2) { el = $(".tuku-list-wrapper"); } $.ajax({ url: "/TK/GetTKRM", type: "post", async: false, data: { t: t, p: thisPageIndex+1, r: thisRow, n: n, q: q }, success: function (res) { if (res != "") { thisPageIndex = thisPageIndex + 1; if (add == 1) { el.eq(0).html(res); thisTotalPage = $("#totalpage").val(); setTimeout(wrapperScroll, 1000); } if (add == 2) { el.eq(0).append(res); } if (add == 3) { el.eq(0).html(res); thisTotalPage = $("#totalpage").val(); setTimeout(wrapperScroll, 1000); if (thisTotalPage == 0) { el.eq(0).html("
  • 暂无图片信息!
  • "); } } } else { layer.msg("没有更多数据了!") } layer.close(load); } }) } function getNewest(t) { initWrapperTop(); var load = layer.load(2, { shade: [0.1, '#000'] }); //$(".tuku-wrapper").css("top", "100px"); $.ajax({ url: "/TK/GetTKZX", type: "post", async: false, data: { t:t, p: thisPageIndex+1, r: thisRow, q: thisQs }, success: function (res) { if (res != "") { thisPageIndex = thisPageIndex + 1; if (t == 1) { $(".tuku-wrapper").html(res); thisTotalPage = $("#totalpage").val(); setTimeout(wrapperScroll, 1000); } else if (t == 2) { $(".tuku-list-wrapper").append(res); } } else { layer.msg("没有更多数据了!") } thisTotalPage = $("#totalpage").val(); layer.close(load); } }) } function getHistory() { initWrapperTop(); var load = layer.load(2, { shade: [0.1, '#000'] }); $.ajax({ url: "/TK/GetTKLS", type: "post", success: function (res) { $(".tuku-wrapper").html(res).css("top", "100px"); layer.close(load); } }) } function getPeriods(el, t) { if ($(el).hasClass("notActive")) { layer.msg("当前已经是最近一期!"); return; } thisPageIndex = 0; var curentQs = $("#currentqs").data("qs"); var a = $(".tuku-area-item.area-selected").find("span:eq(0)").text().replace(/^\s+|\s+$/g, ""); if (t == 1) { var qs = String(curentQs - 1); var year = Number(qs.substr(0, 4))-1; var num = qs.substr(4); if (num == '000') { $.ajax({ url: "/TK/Getqs", type: "post", async: false, data: { y: year }, success: function (data) { qs = data; $(".tuku-qishu-left").attr("data-"+year,data); } }) } } else if (t == 2) { var qs = String(curentQs); var year = Number(qs.substr(0, 4)); if ($(".tuku-qishu-left").attr("data-" + year)) { var ynum = $(".tuku-qishu-left").attr("data-" + year); if (Number(qs) < Number(ynum)) { qs = Number(qs) + 1; } else { qs = (year + 1) + "001"; } } else { qs = Number(qs) + 1; } } $("#currentqs").text("第" + qs + "期").data("qs", qs); if (thisType == 1) { getAll(2, a, qs, 3); } if (thisType == 2) { getHot(2, a, qs, 3); } if (thisQs != qs) { $(".tuku-qishu-right").removeClass("notActive"); } else { $(".tuku-qishu-right").addClass("notActive"); } $(".tuku-list-wrapper")[0].scrollTop = 0; } function wrapperScroll() { var wrapper = $(".tuku-list-wrapper")[0]; wrapper.addEventListener("scroll", function () { var ch = wrapper.clientHeight; var st = wrapper.scrollTop; var sh = wrapper.scrollHeight; if (st + ch - sh >= -10) { if (thisPageIndex < thisTotalPage) { if (thisType == 1) { var a = $(".tuku-area-item.area-selected").find("span:eq(0)").text().replace(/^\s+|\s+$/g, ""); var q = $("#currentqs").data("qs"); getAll(2, a, q, 2); } if (thisType == 2) { var a = $(".tuku-area-item.area-selected").find("span:eq(0)").text().replace(/^\s+|\s+$/g, ""); var q = $("#currentqs").data("qs"); getHot(2, a, q, 2); } if (thisType == 3) { getNewest(2); } } } }) } function toAll(el) { var q = $(el).find("span:eq(0)").text(); $(".tuku-category").removeClass('tuku-active').eq(0).addClass('tuku-active'); thisType = $(".tuku-category").eq(0).data('type'); $("#currentqs").data("qs", q).text("第" + q + "期"); thisPageIndex = 0; $('#qishu').show(); getAll(1, "A", q, 1); } function initWrapperTop(qs) { $("#ads-wrapper").show(); var h1 = $("#ads-wrapper").height(); var h = h1 + 40; if (qs) { h = h + 40; } $("#wrapper1").css({ top: h + "px" }) }