PageSourceSearch

https://www.pesticidenews.cn/images/common.js

js pesticidenews.cn collected 2026-10-04 01:23:57 UTC 5,801 bytes, 188 lines download raw bytes

1/**
2 * @description 显示当前时间
3 * @param {String} o  html容器
4 * @param {String} type 时间类型
5 * @return {Null} null null
6 */
7function showTime(o,type){	
8	var time=setInterval(
9	function(){
10		var d=new Date();
11		var weekday=new Array(7);
12			weekday[0]="星期日";
13			weekday[1]="星期一";
14			weekday[2]="星期二";
15			weekday[3]="星期三";
16			weekday[4]="星期四";
17			weekday[5]="星期五";
18			weekday[6]="星期六";
19			var year=testLen(d.getFullYear()) ,month=testLen(d.getMonth()+1) ,day=testLen(d.getDate()) ,hours=testLen(d.getHours()) ,
20				minutes=testLen(d.getMinutes()),seconds=testLen(d.getSeconds()),milliseconds=testLen(d.getMilliseconds());
21			if(type=='short'){
22				$(o).html(title+ year +'年'+ month +'月'+ day +'日');
23			}else if(type=='normal'){
24				$(o).html( year +'å¹´'+ month +'月'+ day +'日'+'  '+weekday[d.getDay()]);
25			}else{
26				$(o).html(title+ year +'å¹´'+ month +'月'+ day +'日'+'  '+weekday[d.getDay()]+'  '+ hours +' : '+ minutes+' : '+ seconds);
27			}
28		}
29		,1000
30	);
31	function testLen(s){
32		return (s.toString().length)<2?('0'+s):s;
33	}
34}
35 
36/**
37 * @description 获取Cookie
38 * @param {String} name  Cookie名称
39 * @return {String} Result 返回Cookie值
40 */
41function getCookie( name ) {
42	var start = document.cookie.indexOf( name + "=" );
43	var len = start + name.length + 1;
44	if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {
45		return null;
46	}
47	if ( start == -1 ) return null;
48	var end = document.cookie.indexOf( ";", len );
49	if ( end == -1 ) end = document.cookie.length;
50	return unescape( document.cookie.substring( len, end ) );
51}
52/**
53 * @description 设置Cookie
54 * @param {String} name  Cookie名称
55 * @param {String} value  Cookie值
56 * @param {Number} expires  生存周期
57 * @param {String} path  Cookie地址
58 * @param {String} domain  Cookie域
59 * @param {Boolen} secure  Cookie安全限制
60 * @return {Null} null null
61 */
62function setCookie( name, value, expires, path, domain, secure ) {
63	var today = new Date();
64	today.setTime( today.getTime() );
65	if ( expires ) {
66		expires = expires * 1000 * 60 * 60 * 24;
67	}
68	var expires_date = new Date( today.getTime() + (expires) );
69	document.cookie = name+"="+escape( value ) +
70		( ( expires ) ? ";expires="+expires_date.toGMTString() : "" ) + 
71		( ( path ) ? ";path=" + path : "" ) +
72		( ( domain ) ? ";domain=" + domain : "" ) +
73		( ( secure ) ? ";secure" : "" );
74}
75/**
76 * @description 删除Cookie
77 * @param {String} name  Cookie名称
78 * @param {String} path  Cookie地址
79 * @param {String} domain  Cookie域
80 * @return {Null} null null
81 */
82function deleteCookie( name, path, domain ) {
83	if ( getCookie( name ) ) document.cookie = name + "=" +
84			( ( path ) ? ";path=" + path : "") +
85			( ( domain ) ? ";domain=" + domain : "" ) +
86			";expires=Thu, 01-Jan-1970 00:00:01 GMT";
87}
88
89/**
90 * @description 获取指定的js参数
91 * @param {String} name 指定的js名称 
92 * @return {Array} result 参数值的数组
93 */
94function getJsSrc(name,paras){
95	var scripts=document.getElementsByTagName('script'),i,n,slen=scripts.length,plen=paras.length,returns=[];
96	for(i=0;i<slen;i++){
97		var src=scripts[i].src;
98		if(src.indexOf(name)>-1){
99			for(n=0;n<plen;n++){
100				returns.push(src.getjsparas(paras[n]))
101			}
102			return returns;
103		}
104	}
105}
106
107/**
108 * @description 获取*.js?后的参数
109 * @param {String} name 参数名称 
110 * @return {String} result 参数值
111 */
112String.prototype.getjsparas=function (name){     
113	var paraString = this.substring(this.indexOf("?")+1,this.length).split("&");     
114	var paraObj = {}     
115	for (i=0; j=paraString[i]; i++){     
116		paraObj[j.substring(0,j.indexOf("=")).toLowerCase()] = j.substring(j.indexOf("=")+1,j.length);     
117	}     
118	var returnValue = paraObj[name.toLowerCase()];     
119	if(typeof(returnValue)=="undefined"){     
120		return "";     
121	}else{     
122		return returnValue;     
123	}     
124}
125
126/**
127 * @description 加入收藏
128 * @param {Null} 
129 * @return {Null} null null
130 */
131function saveHomepage()
132{
133 if (document.all)
134    {
135		window.external.addFavorite(document.location.href,document.title)
136    }
137    else if (window.sidebar)
138    {
139       window.sidebar.addPanel(document.title, document.location.href, "");
140 }
141}
142 
143/**
144 * @description 设置为首页
145 * @param {Null} 
146 * @return {Null} null null
147 */
148function setHomepage()
149{
150 if (document.all)
151    {
152        document.body.style.behavior='url(#default#homepage)';
153  		document.body.setHomePage(document.location.host);
154 
155    }
156    else if (window.sidebar)
157    {
158		if(window.netscape)
159		{
160			 try
161			{  
162				netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");  
163			 }  
164			 catch (e)  
165			 {  
166				alert( "该操作被浏览器拒绝,如果想启用该功能,请在地址栏内输入 about:config,然后将项 signed.applets.codebase_principal_support 值该为true" );  
167			 }
168		} 
169		var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);
170		prefs.setCharPref('browser.startup.homepage',document.location.host);
171 	}
172}
173/**
174 * @description 设置图片按钮切换效果
175 * @param {String} key  元素钩子
176 * @return {Null} null null
177 */
178function bindImgButtonEvents(key){
179	$(key).each(function(){
180		var src=$(this).attr('src');
181		$(this).data('p',src.replace(src.split('/')[src.split('/').length-1],'')).data('i',src.split('/')[src.split('/').length-1]);
182		$(this).hover(function(){
183			$(this).attr('src',$(this).data('p')+'o.'+$(this).data('i'));
184		},function(){
185			$(this).attr('src',$(this).data('p')+$(this).data('i'));
186		});
187	});
188}

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.