PageSourceSearch

https://yncn.gov.cn/js/rssinfo.js

js yncn.gov.cn collected 2026-10-02 21:20:39 UTC 9,366 bytes, 276 lines download raw bytes

1   
2function rssGetInfo()
3{
4    var _this = this;
5    var formname = "";
6    var choiceotherinfo = "";
7    var waitinfo = "";
8    
9    var _xmlhttp = createXMLHttpRequest();
10
11    var _titlestyle = "";
12    var titleshow = "";
13    var imageshow = "";
14    var newsshow = "";
15    var linkmode = "";
16    
17    var _number = "";
18
19    var _newstitlestyle = "";
20    var _contentstyle = "";
21    var _timestyle = "";
22    var _leaderfont = "";
23    var _leader = "";
24    var _endimage = "";
25    var _titlelen = "";
26    var _endimagenumber = "";
27    var _categoryshow = "";
28    var timeshow = "";
29    
30    var _timeformat = "";
31    var _newsclassname = "";
32    var _dateyear = "";
33    var _datemonth = "";
34    var _dateday = "";
35    var _datehour = "";
36    var _datecent = "";
37    var _datesecond = "";
38    var _isshowvideo = "";
39    var _showvideoalign = "";
40    var _videostyle = "";
41    var _video = "";
42    var _isshowimg = "";
43    var _showimgalign = "";
44    var _imagestyle = "";
45    var _img = "";
46    _this._initrss = function(_formname,_choiceotherinfo,_waitinfo,titlestyle,_titleshow,_imageshow,_newsshow,_linkmode,number_n,newstitlestyle,contentstyle,timestyle,leaderfont,leader,endimage,titlelen,endimagenumber,categoryshow,timeformat,newsclassname,dateyear,datemonth,dateday,datehour,datecent,datesecond,isshowvideo,showvideoalign,videostyle,video,isshowimg,showimgalign,imagestyle,img)
47    {
48        formname = _formname;
49        choiceotherinfo = _choiceotherinfo;
50        waitinfo = _waitinfo;
51    
52        _titlestyle = titlestyle;
53        titleshow = _titleshow;
54        imageshow = _imageshow;
55        newsshow = _newsshow;
56        linkmode = _linkmode;
57        
58        _number = number_n;
59    
60        _newstitlestyle = newstitlestyle;
61        _contentstyle = contentstyle;
62        _timestyle = timestyle;
63        _leaderfont = leaderfont;
64        _leader = leader;
65        _endimage = endimage;
66        _titlelen = titlelen;
67        _endimagenumber = endimagenumber;
68        _categoryshow = categoryshow;
69        _timeformat = timeformat;
70        _newsclassname = newsclassname;
71        _dateyear = dateyear;
72        _datemonth = datemonth;
73        _dateday = dateday;
74        _datehour = datehour;
75        _datecent = datecent;
76        _datesecond = datesecond;
77        _isshowvideo = isshowvideo;
78        _showvideoalign = showvideoalign;
79        _videostyle = videostyle;
80        _video = video;
81        _isshowimg = isshowimg;
82        _showimgalign = showimgalign;
83        _imagestyle = imagestyle;
84        _img = img;
85        
86    }
87    _this._onget = function()  
88    {
89    		sleep(200);
90        if(_xmlhttp.readyState == 4)
91        {
92            if(_xmlhttp.status == 200)
93            {
94                try
95                {
96                    _this._feedlist();
97                }
98                catch(e)
99                {
100                    document.getElementById(formname+'title').innerHTML=choiceotherinfo;
101                }
102            }
103            else
104            {
105                document.getElementById(formname+'title').innerHTML=choiceotherinfo;
106            }
107        }
108    }
109        
110    _this._getRss = function(url)
111    {
112        document.getElementById(formname+'title').innerHTML=waitinfo;
113        //document.getElementById(formname+'image').innerHTML="";
114        var tb = document.getElementById(formname+'message');
115        for(var i = tb.rows.length - 1; i >=0 ; i--)
116        {
117            tb.rows[i].removeNode(true);
118        }
119        startRequest(url, _this._onget,_xmlhttp);
120    }
121    
122    _this._feedlist = function()
123    {
124        var  _xmldoc  =  _xmlhttp.responseXML;
125		var testobj  = getXmlChild(_xmldoc, "channel");
126        if(testobj==null)
127        {
128            _xmldoc = loadXML(_xmlhttp.responseText);    
129        }
130        //channel
131        var _xmlchannel = getXmlChild(_xmldoc, "channel");
132        var _xmlctitle = getXmlData(_xmlchannel, "title");
133        var _xmlcdescription = getXmlData(_xmlchannel, "description", "");
134
135        var _xmlclink = getXmlData(_xmlchannel, "link");
136        if(titleshow == "true")
137            document.getElementById(formname+'title').innerHTML  =  "<a href=\"" + escapeForValue(_xmlclink) + "\" "+formname+"title=\"" + escapeForValue(_xmlc
137description) + ">" + _xmlctitle + "</a>";
138        else
139            document.getElementById(formname+'title').innerHTML = "";
140    
141        //img 文章频道的图标
142        var _xmlimage = getXmlChild(_xmlchannel, "image");
143        
144        if(imageshow == "true")
145        {
146            if(_xmlimage != null)
147            {
148                var _imgtitle = getXmlData(_xmlimage, "title");
149                var _imglink = getXmlData(_xmlimage, "link");
150                var _imgurl = getXmlData(_xmlimage, "url");
151                document.getElementById(formname+'image').innerHTML  =  "<a href=\"" + escapeForValue(_imglink) + "\" "+linkmode+"><img border=0 src=\"" + escapeForValue(_imgurl) + "\" "+formname+"title=\"" + escapeForValue(_imgtitle) + "\"></a>";
152            }
153        }
154        else
155            document.getElementById(formname+'image').innerHTML = "";
156    
157        var _items = _xmldoc.getElementsByTagName("item");
158        var _newsshow = "";
159        
160        if(newsshow == "true")
161            _newsshow = null;
162                     
163        if(_number>_items.length ||_number=="") 
164        {
165            _number=_items.length;
166        }
167                      
168        for(i=0;i<_number;i++)
169        {//显示文章内容
170            var _itemtitle = getXmlData(_items[i], "title");
171            var _itemlink = getXmlData(_items[i], "link");
172            var _itemdescription = getXmlData(_items[i], "description", "");
173            var _itemcategory = getXmlData(_items[i], "category", null);
174            var itempubDate = getXmlData(_items[i], "pubDate", "");
175            var ishaveimg = getXmlData(_items[i], "ishaveimg", "");
176            var ishavevideo = getXmlData(_items[i], "ishavevideo", "");
177            //控制文章标题的长度
178			 // 提取时间处理
179            var itempubDatetemp = itempubDate.split(" ");
180            switch(itempubDatetemp[2]){
181                case 'Jan':
182                itempubDatetemp[2] = '01';
183                break;
184                case 'Feb':
185                itempubDatetemp[2] = '02';
186                break;
187                case 'Mar':
188                itempubDatetemp[2] = '03';
189                break;
190                case 'Apr':
191                itempubDatetemp[2] = '04';
192                break;
193                case 'May':
194                itempubDatetemp[2] = '05';
195                break;
196                case 'Jun':
197                itempubDatetemp[2] = '06';
198                break;
199                case 'Jul':
200                itempubDatetemp[2] = '07';
201                break;
202                case 'Aug':
203                itempubDatetemp[2] = '08';
204                break;
205                case 'Sept':
206                itempubDatetemp[2] = '09';
207                break;
208                case 'Oct':
209                itempubDatetemp[2] = '10';
210                break;
211                case 'Nov':
212                itempubDatetemp[2] = '11';
213                break;
214                case 'Dec':
215                itempubDatetemp[2] = '12';
216                break;
217                default:
218                itempubDatetemp[2] = '00';
219            }
220            itempubDate =itempubDatetemp[3] + '-' +  itempubDatetemp[2] + '-' + itempubDatetemp[1];
221			
222            var _itemtitletemp=_itemtitle;
223            _itemtitle = _this._fixtitlelen(_itemtitle, _titlelen * 2);
224            var _itempubYear = "";
225            var _itempubMonth = "";
226            var _itempubDate = itempubDate;
227            var _itempubHours = "";
228            var _itempubMinutes = "";
229            var _itempubSeconds = "";
230            var _itempubDates = "";
231            var _timeshow = "";
232            if(i >= _endimagenumber)
233            {
234                _endimage = null;
235            }
236            if(_categoryshow == "true")
237            {
238                _itemcategory=null;
239            }
240    
241            var tr = document.getElementById(formname+'message').insertRow(-1);
242            var td = tr.insertCell(-1);
243            td.innerHTML = "<li class=\"text-more\"><span>"+ _itempubDate +"</span><a href=\"" + escapeForValue(_itemlink) +"\" target='_blank'>"+ _itemtitle +"</a> </li>";
244        }  
245    }
246    
247    _this._fixtitlelen = function(str, len)
248    {
249        if(str.length * 2 <= len || str.length == 0 || len <= 0)
250            return str;
251        if(len <= 3)
252            return "...";
253        
254        var count = 0, sublen = -1, i;
255        for(i = 0; i < str.length && count < len; i++)
256        {
257            var size = str.charCodeAt(i) > 255 ? 2 : 1;
258            count += size;
259    
260            if (count > len - 3 && sublen == -1)
261            {
262                sublen = i;
263            }
264        }
265    
266        if(i < str.length || count > len)
267        {
268            str = str.substr(0, sublen) + "...";
269        }
270        return str;
271    }
272    
273    function sleep(d){
274	   for(var t = Date.now();Date.now() - t <= d;);
275	 }
276}

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.