messenger.v1200990482.js

来自「最强的爬虫工程」· JavaScript 代码 · 共 1,017 行 · 第 1/3 页

JS
1,017
字号
var norefresh25;
function getbodyCH(){
	if(window.innerHeight){
	   return window.innerHeight;
	}else if(document.documentElement&&document.documentElement.clientHeight){ 
	    return document.documentElement.clientHeight; 
	}else if(document.body){
	    return document.body.clientHeight;
	}
}
function getbodyCW(){
	if(window.innerWidth){
	    return window.innerWidth;
	}else if(document.documentElement&&document.documentElement.clientWidth){ 
	    return document.documentElement.clientWidth;
	}else if(document.body){
	    returndocument.body.clientWidth;
	}	
}
window.$m_z_index=10000
window.wid=0
if(document.all)
	var IS_IE=1
else
	var IS_IE=0
String.prototype.inc=function(s){return this.indexOf(s)>-1?true:false}
String.prototype.leftB=function(len){
	var s=this.replace(/\*/g," ").replace(/[^\x00-\xff]/g,"**")
	return this.slice(0,s.slice(0,len).replace(/\*\*/g," ").replace(/\*/g,"").length)
}
function oDel(obj){if(obj!=null){obj.parentNode.removeChild(obj)}}
function addEvent(obj,eventName,eventFunc){if(obj.attachEvent){obj.attachEvent(eventName,eventFunc);}else if(obj.addEventListener){eventName = eventName.toString().replace(/on(.*)/i,'$1');obj.addEventListener(eventName,eventFunc,true);}}
function delEvent(obj,eventName,eventFunc){if(obj.detachEvent){obj.detachEvent(eventName,eventFunc);}else if(obj.removeEventListener){eventName = eventName.toString().replace(/on(.*)/i,'$1');obj.removeEventListener(eventName,eventFunc,true);}}
if(!document.all){
	Event.prototype.__defineGetter__("srcElement",function(){var node=this.target;while(node.nodeType!=1){node=node.parentNode}return node})
	Event.prototype.__defineGetter__("x",function(){return this.clientX})
	Event.prototype.__defineGetter__("y",function(){return this.clientY})
	function CollectGarbage(){}
}
function objxy(e){
	var a=new Array()
	var t=e.offsetTop;
	var l=e.offsetLeft;
	var w=e.offsetWidth;
	var h=e.offsetHeight;
	while(e=e.offsetParent){
		t+=e.offsetTop;
		l+=e.offsetLeft;
	}
	a[0]=t;a[1]=l;a[2]=w;a[3]=h
  return a;
}
function urlcache(){
	var t=new Date();
	return t.getTime()
}
function textcount(obj, num, ismes){
	if(!num)
		num = 200;
	var l;
	if(ismes)
		l = getByteLen(obj.value);
	else
		l=obj.value.length
	if(num-l>=0){
		if(typeof(obj.nextSibling.innerHTML) == "undefined")
			obj.nextSibling.nextSibling.innerHTML="剩余 "+(num-l)+" 字"
		else
			obj.nextSibling.innerHTML="剩余 "+(num-l)+" 字"
	}
	else
		if(typeof(obj.nextSibling.innerHTML) == "undefined")
			obj.nextSibling.nextSibling.innerHTML="<font style='color:#F00'>超出 "+(l-num)+" 字</font>"
		else
			obj.nextSibling.innerHTML="<font style='color:#F00'>超出 "+(l-num)+" 字</font>"	
}

/*************************************************************
title窗口标题,w窗口宽度,url表单提交的地址,fmecho提交后回调函数
*************************************************************/
function _$w(title,w,url,fmecho){
	this.qqh=false		//判断是否有悄悄话
	if(url!=null&&url.slice(0,1)=="@"){
		url=url.slice(1)
		this.qqh=true
	}
	wid++
	var obox,obox2,otop,otitle,oclose,odel
	//大容器
	obox=document.createElement("div");
	obox.style.cssText="width:"+w+"px; border:1px solid #6488B8;background:#fff;padding:1px; position:absolute;z-index:"+$m_z_index
	obox2=document.createElement("div");
	obox2.style.cssText="width:"+(w-10)+"px;background:url(http://image2.sina.com.cn/pay/quanzi/qsina/messenger/send_r2_c8.png) repeat-x;padding-right:10px"
	obox.appendChild(obox2)
	//top
	otop=document.createElement("div");
	otop.style.cssText="width:98%; height:22px;margin:0;padding:0 0 0 4px;cursor:move"
	otop.onselectstart=function(){return false}
	obox2.appendChild(otop)
	//拖拽操作
	var dragxy=new Array()			//拖拽边距
	var del_drag=null
	otop.onmousedown=function(e){
		e=e||event
		dragxy[0]=(e.x-obox.style.left.replace("px",""))
		dragxy[1]=(e.y-obox.style.top.replace("px",""))
		addEvent(document.body,"onmousemove",drag)
	}
	obox.onmouseup=function(){
		delEvent(document.body,"onmousemove",drag)
	}
	var drag=function(e){
		if(dragxy.length!=0){
			e=e||event
			var a=dragxy
			var mx=e.x-a[0]
			var my=e.y-a[1]
			obox.style.left=mx+"px"
			wiframe.style.left=(mx-2)+"px"
			obox.style.top=my+"px"
			wiframe.style.top=(my-2)+"px"
			shadow1.style.left=(mx+1)+"px"
			shadow1.style.top=(my+1)+"px"
			shadow2.style.left=(mx+2)+"px"
			shadow2.style.top=(my+2)+"px"
			shadow3.style.left=(mx+3)+"px"
			shadow3.style.top=(my+3)+"px"
		}
	}
	otitle=document.createElement("div");
	otitle.style.cssText="float:left; width:200px; margin:3px 0 0 0; padding:0; font-size:13px; color:#5A5152;overflow-x:hidden;white-space:nowrap"
	otitle.innerHTML=title==null?"信息提示":title
	otop.appendChild(otitle)
	odel=document.createElement("input");
	odel.type="button"
	odel.value=""
	if(url!=null&&!$("but_hidden"+wid)){
		odel.setAttribute("id","but_hidden"+wid)
	}
	odel.style.cssText="float:right;margin:8px 0 0 0;cursor:pointer;background:url(http://image2.sina.com.cn/pay/quanzi/qsina/messenger/message_r2_c4.png);width:8px;height:8px;border:0px"
	otop.appendChild(odel)
	odel.onclick=function(){
		//关闭按钮
		try{
			oDel(shadow1)
			oDel(shadow2)
			oDel(shadow3)
			oDel(obox)
			oDel(hoar)
			oDel(wiframe)
			
			obox=obox2=otop=otitle=oclose=odel=null
			shadow1=shadow2=shadow3=hoar=wiframe=null
			CollectGarbage();
		}catch(e){}
	}
	//top end
	//消息内容
	var strbox,spanbt
	this.alert=function(str,echo,nonos){
		strbox=document.createElement("div")
		strbox.style.cssText="font-size:12px; color:#333333;height:60px;text-align:center; margin:20px 10px;line-height:18px;"
		strbox.innerHTML="<font id='msg_content_f' style='font-size:12px'>"+str+"</font>"
		obox2.appendChild(strbox)
		if(!nonos){
			if(str.length>115)
				obox2.style.height="150px"
		}
		else{
			if(nonos == 1)
				obox2.style.height="220px";
			else
				obox2.style.height = "280px";
		}
	}
	//消息插入按钮
	this.add_bt=function(btname,echo){
		var button
		if(spanbt==null){
			spanbt=document.createElement("span")
			spanbt.style.cssText="padding:15px 0 0 0; display:block; text-align:center"
			strbox.appendChild(spanbt)
		}
		var button=document.createElement("input")
		button.type="button"
		button.style.cssText="background:url(http://image2.sina.com.cn/pay/quanzi/qsina/messenger/botton.png) no-repeat; border:none; width:44px; height:21px;margin:0px 5px;text-align:center"
		button.value=btname
		if(echo!=null&&!$("but_hidden"+wid)){
			odel.id="but_hidden"+wid
		}
		if(echo==null)
			button.onclick=odel.onclick
		else if(typeof(echo)=="function"){
			button.onclick=echo
		}else{
			button.onclick=function(){
				eval(echo)
			}
		}
		spanbt.appendChild(button)
	}
	
	//创建表单
	var fm
	
	var check_full_space= function(val){
		if(val.search(/^[\n  ]*$/) == -1)
			return false;
		return true;
	}

	this.setfm=function(pa){
		var ismes = false;
		var parm;
		if(pa && pa.slice(0,1)=="^"){
			ismes = true;
			parm = pa.substr(1);	
		}
		else
			parm = pa;
		fm=document.createElement("form")
		fm.style.cssText="padding:10px 0 0 15px;margin:0px;text-align:left"
		fm.onsubmit=function(){
			var wd=""
			if(fm.checkwd!=null){
				if(fm.checkwd.value==""){
					$msg("验证码不能为空!")
					return false
				}
				wd="checkwd="+fm.checkwd.value+"&"
			}
			if(check_full_space(fm.content.value) || fm.content.value.replace(/\s/g,"")==""||fm.content.value=="请在这里输入纸条内容"||fm.content.value=="请在这里输入您的附加留言"){
				$msg("内容不能为空!")
				return false
			}
			var textc = 200;
			if(parm)
				textc = 250;
			
			if(ismes){
				if(getByteLen(fm.content.value) > textc){
					$msg("最多可以输入"+textc+"个字!")
					return false
				}
			}
			else{
				if(fm.content.value.length>textc){
					$msg("最多可以输入"+textc+"个字!")
					return false
				}
			}
			if(fm.checkbox){
				if(fm.checkbox.checked){
					if(parm)
						parm += "&private=1";
				}
				else
					if(parm)
						parm += "&private=0";
			}
			var parmeter;
			if(parm)
				parmeter="post:"+parm+"&"+wd+"msg="+encodeURIComponent(fm.content.value.replace(/\>/g,"&gt;").replace(/</g,"&lt;").replace(/&/g,"%26").replace(/\+/g,"%20"))
			else
				parmeter=wd+"msg="+encodeURIComponent(fm.content.value.replace(/\>/g,"&gt;").replace(/</g,"&lt;").replace(/&/g,"%26").replace(/\+/g,"%20"))
			SetAjax(url,parmeter,fmecho)

			return false
		}
		obox2.appendChild(fm)
	}
	//插入验证码
	this.validate=function(){
		var sp=document.createElement("span")
		sp.innerHTML='验证码:<input type="text" name="checkwd" class="send_input" style="vertical-align:middle;width:95px"/> \
		<img id="checkwd_img" src="/control/checkpng.php?t='+urlcache()+'" style="vertical-align:middle"/> <a href="javascript:refreshCheckCode()" style="color:#0066cc;text-decoration:underline">刷新</a>'
		fm.appendChild(sp)
	}

	//插入文本框
	this.addtext=function(parm){
		var textdiv=document.createElement("div")
		textdiv.style.cssText="padding:5px 0"
		var str=""
		if(this.qqh)
			str='<div id="stealthily">请输入留言内容:'//         <input type="checkbox" name="checkbox" value="checkbox">悄悄话 </div>'
		var ismes = false;
		if(parm && parm.slice(0,1)=="^")
			ismes = true;
		if(ismes)
			textdiv.innerHTML=str+'<textarea name="content" id="w_content" onfocus="wtextfocus(this)" style="width:240px;color:#999; height:101px; border:1px solid #A7ACB2; padding:5px; font-size:12px;" onkeyup="textcount(this, 250, true)" onmousedown="textcount(this,250, true)"></textarea><div style="text-align:right;color:#808080;padding-right:20px">剩余 250 字</div>'
		else{
			if(parm)
				textdiv.innerHTML=str+'<textarea name="content" id="w_content" onfocus="wtextfocus(this)" style="width:240px;color:#999; height:101px; border:1px solid #A7ACB2; padding:5px; font-size:12px;" onkeyup="textcount(this, 250)" onmousedown="textcount(this,250)"></textarea><div style="text-align:right;color:#808080;padding-right:20px">剩余 250 字</div>'
			else
				textdiv.innerHTML=str+'<textarea name="content" id="w_content" onfocus="wtextfocus(this);textcount(this)" style="width:240px;color:#999; height:101px; border:1px solid #A7ACB2; padding:5px; font-size:12px;" onkeyup="textcount(this)" onmousedown="textcount(this)"></textarea><div style="text-align:right;color:#808080;padding-right:20px">剩余 200 字</div>'
		}
		fm.appendChild(textdiv)
	}
	var btdiv,btsubmit,btcancel		//表单提交按钮
	this.fmbutton=function(){
		btdiv=document.createElement("div")
		btdiv.style.cssText="text-align:center;padding:15px 0 5px 0"
		btsubmit=document.createElement("input")
		btsubmit.type="submit"
		btsubmit.style.cssText="background:url(http://image2.sina.com.cn/pay/quanzi/qsina/messenger/send_r2_c9.png);border:0px;width:44px;height:21px;margin:0px 5px"
		btsubmit.value=""
		btdiv.appendChild(btsubmit)
		btcancel=document.createElement("input")
		btcancel.type="button"
		btcancel.style.cssText="background:url(http://image2.sina.com.cn/pay/quanzi/qsina/messenger/send_r2_c10.png);border:0px;width:44px;height:21px;margin:0px 5px"
		btcancel.value=""
		btdiv.appendChild(btcancel)
		btcancel.onclick=odel.onclick
		fm.appendChild(btdiv)
	}
	
	//层的位置
	var shadow1,shadow2,shadow3,wiframe
	this.xy=function(){
		var x,y,w,h
		w=obox.offsetWidth
		h=obox.offsetHeight
		x=(document.body.clientWidth-w)/2
		obox.style.left=x+"px"
		var cobj = document.body;
		while(cobj.scrollTop == 0 && cobj.parentNode) {
			if(cobj.tagName.toLowerCase() == 'html') break;
			cobj = cobj.parentNode;
		}
		var ch=(document.body.parentNode.clientHeight>document.body.clientHeight)?document.body.parentNode.clientHeight:document.body.clientHeight
		y=(cobj.scrollTop+(window.screen.availHeight-h)/2)
		obox.style.top=y+"px"
		shadow1=document.createElement("div")
		shadow1.style.cssText="position:absolute;left:"+(x+1)+"px;top:"+(y+1)+"px;width:"+w+"px;height:"+h+"px;background:#000;filter:alpha(opacity=7);-moz-opacity:0.07;z-index:"+($m_z_index-1)
		document.body.appendChild(shadow1)
		shadow2=document.createElement("div")
		shadow2.style.cssText="position:absolute;left:"+(x+2)+"px;top:"+(y+2)+"px;width:"+w+"px;height:"+h+"px;background:#000;filter:alpha(opacity=7);-moz-opacity:0.07;z-index:"+($m_z_index-2)
		document.body.appendChild(shadow2)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?