PageSourceSearch

https://www.mituw.com/template/index/default/pc/js/update.js

js mituw.com collected 2026-10-06 13:09:57 UTC 4,367 bytes, 128 lines download raw bytes

1layui.use(['element','laytpl','util','layer','laypage'], function(){
2    //注意:不能写成 use(['jquery',...],function($))——页面已加载全局jQuery时layui会跳过jquery模块,回调参数会错位
3    var $ = layui.jquery;
4    var element = layui.element;
5    var laytpl = layui.laytpl;
6    var util = layui.util;
7    var layer = layui.layer;
8    var laypage = layui.laypage;
9    var page = 1;
10    var collect_id=getQueryVariable("collect_id") ;
11    var category_id=getQueryVariable("category_id") ;
12    var search_val = getQueryVariable("search_val") ;
13    loadList(page);
14    /*加载列表*/
15    function loadList(page){
16        $(".updatelist").html('<div class="loadding"> <span></span> <span></span> <span></span> <span></span> <span></span> </div>');
17        request({
18            url:config.api.upd_page,
19            data:{
20                page:page,
21                category_id:category_id,
22                collect_id:collect_id,
23                search_val:search_val
24            },
25            success:function (res) {
26                console.log(res);
27                rec(res);
28                html_demo(res);
29            },
30            error:function(){
31                $(".updatelist").html('');
32            }
33        })
34    }
35    $("#search_btn").click(function () {
36        search_val = $("input[name=search]").val();
37        page=1;
38        loadList(page);
39    })
40    function  rec(res) {
41        laypage.render({
42            elem: 'page',
43            limit:15,
44            count: res.count
45            ,jump: function(obj, first){
46                console.log(obj.curr);
47                 if(!first) {
48                    page = obj.curr;
49                    loadList(obj.curr);
50                 }
51            }
52        });
53    }
54    //编写模板
55    function  html_demo(res) {
56        laytpl($("#list").html()).render(res, function(html){
57            $(".updatelist").html(html);
58            // =========== 重要:如果你想用自己写的getTimeText,下面这行注释掉! ===========
59            /*
60            $(".updatelist li").each(function(index, item) {
61                var timeDom = $(item).find(".new-time");
62                timeDom.html(util.timeAgo(timeDom.html(), true));
63            });
64            */
65            $('html,body').animate({scrollTop: 0},0);
66        });
67    }
68    /*获取当前时间段*/
69    function getTime(){
70        var now = new Date();
71        var year = now.getFullYear();       //å¹´
72        var month = now.getMonth() + 1;     //月
73        var day = now.getDate();            //日
74        var hh = now.getHours();            //时
75        var mm = now.getMinutes();          //分
76        var ss = now.getSeconds();           //秒
77        if(month < 10)  month = "0" + month;
78        if(day < 10) day = "0" + day;
79        if(hh < 10) hh = "0" + hh;
80        if (mm < 10) mm = "0" + mm;
81        if (ss < 10) ss = "0" + ss;
82        return year+"-"+month+"-"+day;
83    }
84    /*打开页面*/
85    /*$(".updatelist").on("click","li a[href]",function(e){
86        var that = $(this).parents("li").find(".url");
87        var index = layer.open({
88            type: 2,
89            title:that.html(),
90            content: that.attr("href"),
91            area: ['100%', window.innerHeight+"px"],
92            maxmin: true
93        });
94        layer.full(index);
95        e.preventDefault();
96    });*/
97    /*导航栏目切换*/
98    $(".content .left li a").click(function(){
99        category_id = $(this).parent('li').attr('data-id');
100        page=1;
101        if(category_id==undefined){
102            category_id=null;
103        }
104        $(".content .left li .hover").removeClass("hover");
105        $(this).addClass("hover");
106        loadList(page);
107    });
108    $(".content .fenlei li a").click(function(){
109        collect_id = $(this).parent('li').attr('data-id');
110        page=1;
111        if(collect_id==undefined){
112            collect_id=null;
113        }
114        $(".content .fenlei li .hover").removeClass("hover");
115        $(this).addClass("hover");
116        loadList(page);
117    });
118    function getQueryVariable(variable)
119    {
120        var query = window.location.search.substring(1);
121        var vars = query.split("&");
122        for (var i=0;i<vars.length;i++) {
123            var pair = vars[i].split("=");
124            if(pair[0] == variable){return pair[1];}
125        }
126        return null;
127    }
128});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.