PageSourceSearch

https://www.lianzhou.gov.cn/global/myFocus.js

js lianzhou.gov.cn collected 2026-10-02 12:54:33 UTC 5,634 bytes, 73 lines download raw bytes

1var myFocus={
2	$:function(id){return document.getElementById(id);},
3	$$:function(tag,obj){return (typeof obj=='object'?obj:this.$(obj)).getElementsByTagName(tag);},
4	$li:function(obj,n){return this.$$('li',this.$$('ul',obj)[n])},
5	linear:function(t,b,c,d){return c*t/d + b;},
6	easeIn:function(t,b,c,d){return c*(t/=d)*t*t*t + b;},
7	easeOut:function(t,b,c,d){return -c*((t=t/d-1)*t*t*t - 1) + b;},
8	easeInOut:function(t,b,c,d){return ((t/=d/2) < 1)?(c/2*t*t*t*t + b):(-c/2*((t-=2)*t*t*t - 2) + b);},
9	style:function(obj,style){return (+[1,])?window.getComputedStyle(obj,null)[style]:obj.currentStyle[style];},//getStyle简化版
10	opa:function(obj,v){//取得或设置对象透明度,默认100
11		if(v!=undefined) {v=v>100?100:(v<0?0:v); obj.style.filter = "alpha(opacity=" + v + ")"; obj.style.opacity = (v / 100);}
12		else return (!+[1,])?((obj.filters.alpha)?obj.filters.alpha.opacity:100):((obj.style.opacity)?obj.style.opacity*100:100);
13	},
14	animate:function(obj,prop,val,spd,type,fn){
15		var opa=prop=='opacity'?true:false;
16		if(opa&&obj.style.display=='none'){obj.style.display='';this.opa(obj,0);}
17		var t=0,b=opa?this.opa(obj):parseInt(this.style(obj,prop)),c=val-b,d=spd||50,st=type||'easeOut',m=c>0?'ceil':'floor';
18		if(obj[prop+'Timer']) clearInterval(obj[prop+'Timer']);
19		obj[prop+'Timer']=setInterval(function(){
20			if(opa&&t<d){myFocus.opa(obj,Math[m](myFocus[st](++t,b,c,d)));}
21			else if(!opa&&t<d){obj.style[prop]=Math[m](myFocus[st](++t,b,c,d))+'px';}
22			else {if(opa&&val==0){obj.style.display='none'}clearInterval(obj[prop+'Timer']);fn&&fn.call(obj);}
23		},10);return this;
24	},
25	fadeIn:function(obj,speed,fn){this.animate(obj,'opacity',100,speed==undefined?20:speed,'linear',fn);return this;},
26	fadeOut:function(obj,speed,fn){this.animate(obj,'opacity',0,speed==undefined?20:speed,'linear',fn);return this;},
27	slide:function(obj,params,speed,easing,fn){for(var p in params) this.animate(obj,p,params[p],speed,easing,fn);return this;},
28	stop:function(obj){//停止所有运动函数
29		var animate=['left','right','top','bottom','width','height','opacity'];
30		for(var i=0;i<animate.length;i++) if(obj[animate[i]+'Timer']) clearInterval(obj[animate[i]+'Timer']);
31		return this;
32	},
33	initCSS:function(p){
34		var css=[],oStyle = document.createElement('style');oStyle.type='text/css';
35		if(p.width){css.push('.'+p.style+' *{margin:0;padding:0;border:0;list-style:none;}.'+p.style+'{position:relative;width:'+p.width+'px;height:'+p.height+'px;overflow:hidden;font:12px/1.5 Verdana,Geneva,sans-serif;background:#fff;}.'+p.style+' .loading{position:absolute;z-index:9999;width:100%;height:100%;color:#666;text-align:center;padding-top:'+0.3*p.height+'px;background:#fff url(/global/loading.gif) center '+0.4*p.height+'px no-repeat;}.'+p.style+' .pic,.'+p.style+' .pic *{width:'+p.width+'px;height:'+p.height+'px;}.'+p.style+' .txt li,.'+p.style+' .txt li span,.'+p.style+' .txt-bg{width:'+p.width+'px;height:'+p.txtHeight+'px;line-height:'+p.txtHeight+'px;overflow:hidden;}')}
36		if(oStyle.styleSheet){oStyle.styleSheet.cssText=css.join('');} else {oStyle.innerHTML=css.join('');}
37		var oHead = this.$$('head',document)[0];oHead.insertBefore(oStyle,oHead.firstChild);
38	},
39	setting:function(par){
40		if(window.attachEvent){
41			(function(){
42				try{
43						myFocus.$(par.id).className=par.style;
44						myFocus.initCSS(par);
45					}
46				catch(e){
47						setTimeout(arguments.callee,0);
48					}
49			})();
50			window.attachEvent('onload',function(){
51				myFocus[par.style](par)});
52		} else{
53			document.addEventListener("DOMContentLoaded",function(){myFocus.$(par.id).className=par.style;myFocus.initCSS(par);},false);
54			window.addEventListener('load',function(){myFocus[par.style](par)},false);
55		}
56	},
57	addList:function(obj,cla){//生成HMTL,cla为生成列表的class,其中封装有:cla='txt'(生成alt文字),cla='num'(生成按钮数字),cla='thumb'(生成小图)
58		var s=[],n=this.$li(obj,0).length,num=cla.length;
59		for(var j=0;j<num;j++){
60			s.push('<ul class='+cla[j]+'>');
61			for(var i=0;i<n;i++){s.push('<li>'+(cla[j]=='num'?('<a>'+(i+1)+'</a>'):(cla[j]=='txt'?this.$li(obj,0)[i].innerHTML.replace(/\>(.|\n|\r)*?(\<\/a\>)/i,'>'+(this.$$('img',obj)[i]?this.$$('img',obj)[i].alt:'')+'</a>'):(cla[j]=='thumb'?'<img src='+(this.$$('img',obj)[i].getAttribute("thumb")||this.$$('img',obj)[i].src)+' />':'')))+'<span></span></li>')};
62			s.push('</ul>');
63		}; obj.innerHTML+=s.join('');
64	},
65	switchMF:function(fn1,fn2,auto){
66		return "box.removeChild(this.$$('div',box)[0]);var run=function(idx){("+fn1+")();if (index == n - 1) index = -1;var next = idx != undefined ? idx: index + 1;("+fn2+")();index=next;};run(index);if("+auto+"!==false) var auto=setInterval(function(){run()},t);box.onmouseover=function(){if(auto) clearInterval(auto);};box.onmouseout=function(){if(auto) auto=setInterval(function(){run()},t);}"
67	},
68	bind:function(arrStr,type,delay){
69		return "for (var j=0;j<n;j++){"+arrStr+"[j].index=j;if("+type+"=='click'){"+arrStr+"[j].onmouseover=function(){if(this.className!='current') this.className='hover'};"+arrStr+"[j].onmouseout=function(){if(this.className=='hover') this.className=''};"+arrStr+"[j].onclick=function(){if(this.index!=index) run(this.index)};}else if("+type+"=='mouseover'){"+arrStr+"[j].onmouseover=function(){var self=this;if("+delay+"==0){if(!self.className) run(self.index)}else "+arrStr+".d=setTimeout(function(){if(!self.className) run(self.index)},"+(delay==undefined?100:delay)+")};"+arrStr+"[j].onmouseout=function(){clearTimeout("+arrStr+".d)};}else{alert('myFocus 不支持这样的事件 \"'+"+type+"+'\"');break;}}"
70	},
71	extend:function(fnObj){for(var p in fnObj) this[p]=fnObj[p];}
72}
73

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.