PageSourceSearch

https://www.dali.gov.cn/dlzrmzf/pc2025/js/sz_calendar.js

js dali.gov.cn collected 2026-10-03 17:42:29 UTC 13,546 bytes, 337 lines download raw bytes

1// JavaScript Document
2(function () {
3    window.ajaxUtil = {
4        getSync: function (url, success, error) {
5            var req = null;
6            if (window.XMLHttpRequest) {
7                req = new XMLHttpRequest();
8            } else if (window.ActiveXObject) {
9                req = new ActiveXObject("Microsoft.XMLHTTP");
10            }
11            if (!req) {
12                if (error) {
13                    error('不能使用ajax');
14                }
15                return;
16            }
17            req.onreadystatechange = function () {
18                if (req.readyState == 4 && req.status == 200) {
19                    if (success) {
20                        success(req.responseText);
21                    }
22                }
23            };
24
25            req.open("GET", url, true);
26            req.send();
27        }
28    }
29})()
30
31
32
33$(function () {
34    $(".rule-single-select").ruleSingleSelect();
35    var mydate = new Date();
36    var thisyear = mydate.getFullYear();
37    var thismonth = mydate.getMonth() + 1;
38    var thisday = mydate.getDate();
39    //日期初始填充
40    function initdata() {
41        var days = getdaysinonemonth(thisyear, thismonth); //这个月的天数
42        var preDays = getdaysinonemonth(thisyear, thismonth - 1); //上个月的天数
43        var weekday = getfirstday(thisyear, thismonth); //第一天星期几
44        if (weekday == 0) {
45            weekday = 7;
46        }
47        $('.month_name').text(thismonth + '月份');
48        $('.year_name').text(thisyear);
49        //这个月的天数,第一天星期几,上个月的天数,当天,当年,当月
50        setcalender(days, weekday, preDays, thisday, thisyear, thismonth);
51    }
52    initdata();
53    //点击上个月
54    $('.month .prev').click(function (e) {
55        if (thisyear == 2023 && thismonth == 1) {
56            return false;
57        } else {
58            thismonth--;
59            if (thismonth == 0) {
60                thismonth = 12;
61                thisyear--;
62            }
63            initdata();
64        }
65    });
66    //点击下个月
67    $('.month .next').click(function (e) {
68        thismonth++;
69        if (thismonth == 13) {
70            thismonth = 1;
71            thisyear++;
72        }
73        initdata();
74    });
75    //点击去年
76    $('.year .prev').click(function (e) {
77        if (thisyear == 2023) {
78            return false;
79        } else {
80            thisyear--;
81            initdata();
82        }
83    });
84    //点击明年
85    $('.year .next').click(function (e) {
86        thisyear++;
87        initdata();
88    });
89
90    function jjr(jqdate, arg) {
91        $.ajax('http://api.goseek.cn/Tools/holiday?date=' + jqdate, {
92            dataType: 'json',//服务器返回json格式数据
93            type: 'get',//HTTP请求类型
94            success: function (reul) {
95                if (reul.data == 1) {
96                    $(arg).addClass('jq');
97                    $(arg).append('<br/><sapn class="xiu">休</sapn>');
98                }
99            },
100            error: function (xhr, type, errorThrown) {
101
102            }
103        });
104    }
105    function rqgs(arg) {
106        arg = Number(arg);
107        if (arg < 10) {
108            return "0" + arg;
109        } else {
110            return "" + arg;
111        }
112    }
113    //填充日期表格
114    function setcalender(days, weekday, preDays, thisday, thisyear, thismonth) {//这个月的天数,第一天星期几,上个月的天数,当天,当年,当月
115        var a = 1;
116        var b = 1;
117        var c = preDays - weekday + 1;
118        var trNum = days + weekday - 1;
119
120        if (trNum < 27) {
121            $('.calendar table tbody tr:eq(4),.calendar table tbody tr:eq(5)').hide();
122        } else if (trNum > 35) {
123            $('.calendar table tbody tr').show();
124        } else {
125            $('.calendar table tbody tr:eq(5)').hide();
126
127        }
128        //转换年月日为字符串
129        thisyear = thisyear.toString();
130        if (thismonth < 10) {
131            thismonth = "0" + thismonth.toString();
132        }
133        for (var j = 0; j < 6; j++) {
134            for (var i = 0; i < 7; i++) {
135                if (j == 0 && i < weekday - 1) {
136                    //第一行上个月的
137                    c++;
138                    $(".data_table tbody tr").eq(0).find("td").eq(i).html(' ');
139
140                    //jjr(thisyear+rqgs(thismonth-1)+rqgs(c),$(".data_table tbody tr").eq(0).find("td").eq(i));
141
142                    $(".data_table tbody tr").eq(0).find("td").eq(i).addClass("unselected_month preM");
143                } else {
144                    //这个月的内容
145                    if (a > days) {
146                        //下个月加灰处理
147                        $(".data_table tbody tr").eq(j).find("td").eq(i).html(' ');
148
149                        //jjr(thisyear+rqgs(parseInt(thismonth)+1)+rqgs(b),$(".data_table tbody tr").eq(j).find("td").eq(i));
150
151                        $(".data_table tbody tr").eq(j).find("td").eq(i).addClass("unselected_month nextM");
152                        b++;
153
154                    } else {
155                        //如果是10号以前的加0
156                        if (a < 10) {
157                            a = "0" + a.toString();
158                        }
159                        //添加表格日期内容
160                        var thisValue = thisyear + thismonth + a;
161                        $(".data_table tbody tr").eq(j).find("td").eq(i).html("<div class='riqi'>" + a + "<div class='piaofu'><ul></ul><span></span></div>").attr('value', thisValue);
162                        //jjr(thisyear+rqgs(thismonth)+rqgs(a),$(".data_table tbody tr").eq(j).find("td").eq(i).find('.riqi'));
163
164                        $(".data_table tbody tr").eq(j).find("td").eq(i).addClass('usual_day').removeClass("unselected_month preM nextM");
165
166                        if (a == thisday && thismonth == mydate.getMonth() + 1 && thisyear == mydate.getFullYear()) {//今天
167                            $(".data_table tbody tr").eq(j).find("td").eq(i).find(".riqi").addClass("bghover");
168                        }
169
170                        a++;
171                    }
172                }
173            }
174        }
175
176        //var ajaxUrl = "http://www.sc.gov.cn/sousou/LeaderCalendar/LeaderCalendarByKp.ashx?year=" + thisyear + "&month=" + thismonth;
177        // var ajaxUrl = "../data/_year" + thisyear + "_month" + thismonth+'.shtml';
178        var channelIds = '1962759177267957760';
179        var ajaxUrl = '/u/search/list/calendarManuscript?websiteId='+ websiteId +'&channelId='+ channelIds +'&pageSize=500&year=' + thisyear + '&month=' + thismonth;
180        //e3853c4820194f6896eee6efd2d52ad5
181        ajaxUtil.getSync(ajaxUrl, function (jsonText) {
182            var json = JSON.parse(jsonText);
183            var json1 = json.data;
184            if (json1) {
185                for (var j = 0; j < 6; j++) {
186                    for (var i = 0; i < 7; i++) {
187                        var thisValue = $(".data_table tbody tr").eq(j).find("td").eq(i).attr('value');
188                        for (k = 0; k < json1.length; k++) {
189                            // var SUB_TITLE = json1[k].ldhdri.split('-').join('');
190                            var SUB_TITLE = json1[k].publishedTime;
191                            var URL = json1[k].url;
192                            var TITLE = json1[k].title;
193                            var titleB = TITLE.replace(/<br\>/g, "");
194                            var titleC = titleB.replace(/\?/g, "");
195                            //var titleC=titleB.replace(titleB.indexOf('?',index),"");
196                            if (thisValue == SUB_TITLE) {
197                                $(".data_table tbody tr").eq(j).find("td").eq(i).find('.riqi .piaofu ul').append("<li><a href='" + URL + "' target='_blank'>" + titleC + "</a></li>");
198                            }
199                        }
200                    }
201                }
202            }
203
204            $(".data_table tbody tr:odd td").css('background', '#dddddd');
205            $(".data_table tbody tr td .riqi").has('.piaofu ul li').addClass('has-content');
206        })
207
208    }
209    //算某个月的总天数
210    function getdaysinonemonth(year, month) {
211        month = parseInt(month, 10);
212        var d = new Date(year, month, 0);
213        return d.getDate();
214    }
215    //算某个月的第一天是星期几
216    function getfirstday(year, month) {
217        month = month - 1;
218        var d = new Date(year, month, 1);
219        return d.getDay();
220    }
221    //鼠标滑过日期
222    $(".data_table tr td").mouseover(function (e) {
223        $('.data_table tr td .riqi').removeClass('current bgHover');
224        $(this).find('.riqi').addClass('bgHover');
225        $(this).find('.riqi').has('.piaofu ul li').addClass('current');
226    });
227    //鼠标离开日期
228    $(".data_table").mouseleave(function (e) {
229        $('.data_table tr td .riqi').removeClass('current bgHover');
230    });
231    $("#activeYear").change(function () {
232        var ckVal = $(this).val();
233        if (ckVal > 0) {
234            $(".active-box .active-list ul").css("display", "none");
235            $(".active-box .active-list").css("display", "block");
236            $("#list-" + ckVal).css("display", "block");
237        } else {
238            $(".active-box .active-list ul").css("display", "none");
239            $(".active-box .active-list").css("display", "none");
240        }
241    })
242    //鼠标滑过活动集年份
243    $(".active-box .rule-single-select").mouseover(function (e) {
244        var ckVal = $("#activeYear").val();
245        if (ckVal > 0) {
246            $(".active-box .active-list ul").css("display", "none");
247            $(".active-box .active-list").css("display", "block");
248            $("#list-" + ckVal).css("display", "block");
249        } else {
250            $(".active-box .active-list ul").css("display", "none");
251            $(".active-box .active-list").css("display", "none");
252        }
253    });
254    //鼠标离开活动集年份
255    $(".active-box .active-list,.active-box").mouseleave(function (e) {
256        $(".active-box .active-list ul").css("display", "none");
257        $(".active-box .active-list").css("display", "none");
258    });
259})
260$.fn.ruleSingleSelect = function () {
261    var singleSelect = function (parentObj) {
262        parentObj.addClass("single-select"); //添加样式
263        parentObj.children().hide(); //隐藏内容
264        var divObj = $('<div class="boxwrap"></div>').prependTo(parentObj); //前插入一个DIV
265        //创建元素
266        var titObj = $('<a class="select-tit"><hr /><span></span><i></i></a>').appendTo(divObj);
267        var itemObj = $('<div class="select-items"><ul></ul></div>').appendTo(divObj);
268        var arrowObj = $('<i class="arrow"></i>').appendTo(divObj);
269        var selectObj = parentObj.find("select").eq(0); //取得select对象
270        //遍历option选项
271        selectObj.find("option").each(function (i) {
272            var indexNum = selectObj.find("option").index(this); //当前索引
273            var liObj = $('<li>' + $(this).text() + '</li>').appendTo(itemObj.find("ul")); //创建LI
274            if ($(this).prop("selected") == true) {
275                liObj.addClass("selected");
276                titObj.find("span").text($(this).text());
277            }
278            //检查控件是否启用
279            if ($(this).prop("disabled") == true) {
280                liObj.css("cursor", "default");
281                return;
282            }
283            //绑定事件
284            liObj.click(function () {
285                $(this).siblings().removeClass("selected");
286                $(this).addClass("selected"); //添加选中样式
287                selectObj.find("option").prop("selected", false);
288                selectObj.find("option").eq(indexNum).prop("selected", true); //赋值给对应的option
289                titObj.find("span").text($(this).text()); //赋值选中值
290                arrowObj.hide();
291                itemObj.hide(); //隐藏下拉框
292                selectObj.trigger("change"); //触发select的onchange事件
293                //alert(selectObj.find("option:selected").text());
294            });
295        });
296        //设置样式
297        //titObj.css({ "width": titObj.innerWidth(), "overflow": "hidden" });
298        //itemObj.children("ul").css({ "max-height": $(document).height() - titObj.offset().top - 62 });
299
300        //检查控件是否启用
301        if (selectObj.prop("disabled") == true) {
302            titObj.css("cursor", "default");
303            return;
304        }
305        //绑定单击事件
306        titObj.click(function (e) {
307            e.stopPropagation();
308            if (itemObj.is(":hidden")) {
309                //隐藏其它的下位框菜单
310                $(".single-select .select-items").hide();
311                $(".single-select .arrow").hide();
312                //位于其它无素的上面
313                arrowObj.css("z-index", "1");
314                itemObj.css("z-index", "1");
315                //显示下拉框
316                arrowObj.show();
317                itemObj.show();
318            } else {
319                //位于其它无素的上面
320                arrowObj.css("z-index", "");
321                itemObj.css("z-index", "");
322                //隐藏下拉框
323                arrowObj.hide();
324                itemObj.hide();
325            }
326        });
327        //绑定页面点击事件
328        $(document).click(function (e) {
329            selectObj.trigger("blur"); //触发select的onblure事件
330            arrowObj.hide();
331            itemObj.hide(); //隐藏下拉框
332        });
333    };
334    return $(this).each(function () {
335        singleSelect($(this));
336    });
337}

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.