Paste: baidu tieba sign wap

Author: test by cat
Mode: javascript
Date: Sun, 7 Jul 2013 17:30:40
Plain Text |
var localUrl = window.location.href;

if(cutchar(localUrl,"http://",".com")=="wapp.baidu")
	var headUrl="wapp";
if(cutchar(localUrl,"http://",".com")=="tieba.baidu")
	var headUrl="tieba";

var bai;
var ajax=Ajax();
var pageStr;
var baCH = new Array;//存贴吧名字
var baEN = new Array;//存贴吧地址
show_BaseDiv();
mark_cell();

function show_BaseDiv(){
	//以下基本样式
	document.body.innerHTML+=
	"<style>"+
		"html,body,div,p,ul,ol,li,dl,dt,dd,h1,h2,h3,h4,h5,h6,object,iframe,form,blockquote,fieldset,input,textarea,code,address,caption,cite,code,em,i,ins{margin:0;padding:0;}"+
		".Sign_Body{text-align:left;font-family:微软雅黑;}"+/*所有的自定义层都建在这里面*/
		".Sign_Body a, .Sign_Body a:link, .Sign_Body a:visited{color: #d79a1e; text-decoration: none; } .Sign_Body a:hover{color: blue; text-decoration: none;}"+/*所有的自定义的链接*/
		
		".Sign_BarTop{ display: block; position:absolute; position: fixed; width:100%; height:35px; top:0px; left:0px; padding-left:50px; padding-top:4px;  border-bottom: 1px solid red; background-color:black; color:white; z-index:111110; font-size:20px;}"+/* 顶部操作栏*/
		".Sign_BarTop span{ padding:0px;margin:0px;float:left;cursor: pointer;}.Sign_BtnTop{width:164px;height:30px;padding:8px 0px;}"+/*顶部栏中的按钮*/
		".Sign_BackDiv{	display: block; position:absolute; position:fixed; top:0; padding:0px;  margin:0px; width:100%; height:100%; background-color:black; z-index:110000; -moz-opacity: 0.8; opacity:.90; filter: alpha(opacity=80);}"+/*透明背景*/
		".Sign_MainDiv{ display: block; position: absolute; top: 42px; left: 30px; width: 800px; padding-top: 16px; padding-left: 16px; margin-bottom: 16px; border: 2px solid orange; background-color: white; z-index:111000;  word-wrap:break-word; -moz-opacity: 0.8; opacity:.80; filter: alpha(opacity=80);}"+/*主要显示部分*/
		".Sign_NoticeDiv{ display: block; position: absolute; position: fixed; top: 42px; right: 50px; width: 400px; height: 100%; padding-top: 16px; padding-left: 10px; z-index:111100; color:white; word-wrap:break-word; -moz-opacity: 0.9; opacity:.90; filter: alpha(opacity=90);background-color:#444444;}"+/*辅助显示部分*/
		".Sign_MainDiv li,.Sign_NoticeDiv li{ margin-left:-35px;}"+/*列举条例*/ 
		"#myli5{text-align:right;}"+
		/*以下是class*/
		".pr{color:red;} .pg{color:green;} .pb{color:blue;} .py{color:yellow;}"+/*彩色字*/
		".pt10{font-size:10pt;} .pt15{font-size:15pt;} .pt20{font-size:20pt;} .pt25{font-size:25px;} .pt50{font-size:50pt;} .pt60{font-size:60pt;} .pt70{font-size:70pt;} .pt80{font-size:80pt;} .pt90{font-size:90pt;} .pt100{font-size:100pt;} .pt120{font-size:120pt;} .pt150{font-size:150pt;} .pt200{font-size:200pt;} .pt500{font-size:500pt;}"+/*大小字*/
	"</style>";


	//以下构建了基本的页面显示框架
	document.body.innerHTML+="<div class='Sign_Body' id='Sign_Body'></div>";//我的根元素
	document.getElementById("Sign_Body").innerHTML="<div class='Sign_BarTop' id='Sign_BarTop'></div>"+//顶部工具栏
		"<div class='Sign_BackDiv' id='Sign_BackDiv'></div>"+//大背景
		"<div class='Sign_MainDiv' id='Sign_MainDiv'></div>"+//主体显示
		"<div class='Sign_NoticeDiv' id='Sign_NoticeDiv'>11</div>";//公告显示
		
	document.getElementById("Sign_BarTop").innerHTML="<div>"+//顶部栏
		"<span><div class='Sign_BtnTop' id='myli1'></div></span>"+//显示总贴吧数量
		"<span><div class='Sign_BtnTop' id='myli2'></div></span>"+//显示正在进行到第几个
		"<span><div class='Sign_BtnTop' id='myli3'></div></span>"+//占位
		"<span><div class='Sign_BtnTop' id='myli5'></div></span>"+//完成标志
		"<span><div class='Sign_BtnTop' id='close_btn' align='right'><a href='javascript:void 0;' onclick='div_allHid();'>关闭</a></div></span>"+//显示关闭按钮
	"</div>";
	document.getElementById("Sign_Body").innerHTML+="<img class='markPic1' style='position:absolute; position:fixed;top:0px;right:-10px;z-index:111111;' src='http://imgsrc.baidu.com/forum/pic/item/d2a29e315c6034a8bc82c368cb1349540823767a.jpg' />"+//箭头
	"<a href=\"javascript:void((function(){var e=document.createElement('script');e.type='text/javascript';e.charset='UTF-8';e.src='http://chanxi.googlecode.com/files/sign.js'+'?m='+Math.random();document.body.appendChild(e)})());\" class='markPic2' style='position:absolute;position:fixed;top:180px;right:-170px;z-index:111112;width:230px;height:70;cursor:move;background:url(http://imgsrc.baidu.com/forum/pic/item/dc8d124e251f95ca2f8ce95fc9177f3e66095261.jpg) no-repeat;'><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>一键签到</a>";//按钮标签
	
	document.getElementById("myli1").innerHTML="还未收集。。。";
	document.getElementById("myli2").innerHTML="0 / 未知";
	document.getElementById("myli3").innerHTML="";
	document.getElementById("Sign_NoticeDiv").innerHTML="请自行检查有没有签到正确,百度贴吧手机版地址如下:<br/>"+
		"<span class='pt15'><a href='http://tieba.baidu.com/mo/'  target='_blank'>百度贴吧--地址1</a></span><br/>"+
		"<span class='pt15'><a href='http://wapp.baidu.com/'  target='_blank'>百度贴吧--地址2</a></span><br/>"+
		"请注意:请在自动签到的时候,放慢你的发帖和回复速度,防止应为操作过频被度受和谐ID。<br/>"+
		"------2013.04.03 v1.2.2------<br/>"+
		"更新1.修复手机签到改UA后出现&quot;更佳小说吧阅读体验&quot;导致签到失败<br/>"+
		"提示1.手机签到可在普通版或极简版(旧版)运行<br/>"+
		"提示2.更改UA为百度手机浏览器后,手机签到可在电脑版运行<br/>"+
		"<span style='color:green;'>------------------------------</span><br/>"+
		"IE-UA插件:<img width='52' height='34' src='http://imgsrc.baidu.com/forum/w%3D580/sign=8abf0ee7500fd9f9a0175561152cd42b/caef76094b36acaf4f9ab7677dd98d1001e99c36.jpg'/>--图片另存为后改后缀为zip<br/>"+
		"<span style='color:red;'>------------------------------</span><br/>"+
		"注意1.IE8用户如须签到6经验,须安装以上的IE UA插件<br/>"+
		"注意2.IE用户如需进入<span style='color:red;'>极简版(旧版)贴吧:</span><a href='http://tieba.baidu.com/mo/q-----0-1-0--2/m?tn=bdIndex&amp;lp=1060'  target='_blank'>地址1</a> <a href='http://wapp.baidu.com/mo/q-----0-1-0--2/m?tn=bdIndex&amp;lp=1060'  target='_blank'>地址2</a>,须把以下注册表代码复制到记事本另存为wap.reg运行:<br/>"+
		"Windows Registry Editor Version 5.00<br/>"+
		"[HKEY_CURRENT_USER\\Software\\Classes\\MIME\\Database\\Content Type\\text/vnd.wap.wml]<br/>"+
		"&quot;CLSID&quot;=&quot;{25336920-03F9-11cf-8FD0-00AA00686F13}&quot;";

	document.getElementById("Sign_MainDiv").innerHTML="此代码是蝉曦签到的分支版本:手机签到<br/>"+
		"主体代码跟随 http://chanxi.googlecode.com/files/sign.js 更新<br/>"+
		"手机签到采用蝉曦旧版签到代码稍微修改而成<br/>"+
		"程序开始工作...<br/>---开始收集I贴吧中的贴吧名,请等待 ......<br/>";
}


function mark_cell(){//手机签到
	if(navigator.userAgent=="Mozilla/5.0 (Linux; U; Android 4.1.2; zh-cn; MB526 Build/JZO54K) AppleWebKit/530.17 (KHTML, like Gecko) FlyFlow/2.4 Version/4.0 Mobile Safari/530.17 baidubrowser/042_1.8.4.2_diordna_458_084/alorotoM_61_2.1.4_625BM/1200a/39668C8F77034455D4DED02169F3F7C7%7C1327"){
		ajax.get("http://"+headUrl+".baidu.com/mo/q----sz%40240_320%2C,sz@320_240-1-3-0--2/m?tn=bdIndex&lp=7202", function(data){
			var waite = setTimeout(function(){
				countba_cell();
			},5000);
		});
	}else{
		ajax.get("http://"+headUrl+".baidu.com/mo/q----sz%40320_240%2C,sz@176_208-1-1-0--2/m?tn=bdIndex&lp=1062", function(data){
			var waite = setTimeout(function(){
				countba_cell();
			},5000);
		});
	}
}

function countba_cell(){//收集贴吧
	var i=0;ba=0;
	var urlStr1;
	ajax.get("http://"+headUrl+".baidu.com/mo/m?tn=bdFBW&tab=favorite", function(data){
		pageStr=data.split("/m?kw");
		urlStr1=cutchar(data,"/mo/","/m?");
		for(var j=1;j<pageStr.length;j++){
			baEN[ba]=cutchar(pageStr[j],"=","\"");
			baCH[ba]=cutchar(pageStr[j],"\">","</a>");
			ba++;
		}
		//alert(urlStr1);
		document.getElementById("myli1").innerHTML="收集完毕!";
		document.getElementById("myli2").innerHTML="0 / "+ba;
		var ret = setInterval(function(){
			document.getElementById("myli2").innerHTML=(i+1)+" / "+ba		
			document.getElementById("Sign_MainDiv").innerHTML+="<br/>";
			ajax.get("http://"+headUrl+".baidu.com/mo/"+urlStr1+"/m?kw="+baEN[i]+"&m="+Math.random(), function(data){
				document.getElementById("Sign_MainDiv").innerHTML+=(i+1)+". <a href='http://"+headUrl+".baidu.com/mo?kw="+baEN[i]+"' target='_blank'>"+baCH[i]+"</a>";
				check_cell(data,urlStr1,baEN,i);
				i++;
				if(i==ba) {
					clearInterval(ret);
					document.getElementById("myli5").innerHTML="<span style='color:red;'>签到完毕!</span>";
				}
			});
		},4000);
	});
}

function check_cell(data,urlStr1,baEN,i){//判断贴吧
	if(data.indexOf("<span >已签到</span>")>0) {
		document.getElementById("Sign_MainDiv").innerHTML+="--已签到!";
	}else if(data.indexOf(">签到</a>")>0){
		document.getElementById("Sign_MainDiv").innerHTML+="--未签到!";
		var  urlStr2=cutchar(data,"/sign?","\"").replace(/&amp;/gi,"&");
		ajax.get("http://"+headUrl+".baidu.com/mo/"+urlStr1+"/sign?"+urlStr2, function(data){
			sign_cell(data);
		});
	}else if(data.indexOf(">喜欢本吧</a>")>0){
		document.getElementById("Sign_MainDiv").innerHTML+="--未喜欢!";
		var  urlStr2=cutchar(data,"amp;itb_","\"").replace(/&amp;/gi,"&");
		ajax.get("http://"+headUrl+".baidu.com/mo/"+urlStr1+"/sign?"+urlStr2, function(data){
			sign_cell(data);
		});
	}else if(data.indexOf("<td style=\"text-align:right;\"></td>")>0){
		document.getElementById("Sign_MainDiv").innerHTML+="--本吧还没开放签到系统!";
	}else if(data.indexOf("请下载贴吧客户端,享受更佳小说吧阅读体验")>0){
		ajax.get("http://"+headUrl+".baidu.com/mo/m?kw="+baEN[i]+"&lp=novel_guide_skip&novel_client_guide=1", function(data){
			check_cell(data,urlStr1,baEN,i);
		});
	}else if(data.indexOf("尚未建立")>0){
		document.getElementById("Sign_MainDiv").innerHTML+="--本吧尚未建立!";
	}
}

function sign_cell(data){//开始签到
	if(data.indexOf("<span class=\"light\">签到成功,经验值上升<span class=\"light\">6</span>")>=0)
		document.getElementById("Sign_MainDiv").innerHTML+="--签到,经验+6!";
	else if(data.indexOf("<span class=\"light\">签到成功,经验值上升<span class=\"light\">5</span>")>=0)
		document.getElementById("Sign_MainDiv").innerHTML+="--签到,经验+5!";
	else if(data.indexOf("<span class=\"light\">签到成功,经验值上升<span class=\"light\">4</span>")>=0)
		document.getElementById("Sign_MainDiv").innerHTML+="--签到,经验+4!";
	else if(data.indexOf("<span class=\"light\">签到成功,经验值上升<span class=\"light\">3</span>")>=0)
		document.getElementById("Sign_MainDiv").innerHTML+="--签到,经验+3!";
	else if(data.indexOf("<span class=\"light\">汗,操作未成功,麻烦再试一下下")>=0)
		document.getElementById("Sign_MainDiv").innerHTML+="--签到失败!操作未成功,请稍后再试!";
	else if(data.indexOf("<span class=\"light\">你在本吧被封禁不能进行当前操作")>=0)
 		document.getElementById("Sign_MainDiv").innerHTML+="--被封禁,不能签到!";
	else if(data.indexOf("<span class=\"light\">零点时分,赶在一天伊始签到的人好多,亲要不等几分钟再来签吧~")>=0)
		document.getElementById("Sign_MainDiv").innerHTML+="--签到失败!零点时分,签到人数过多,请稍后再试!";
	else if(data.indexOf("<span class=\"light\">亲,你之前已经签过了")>=0)
		document.getElementById("Sign_MainDiv").innerHTML+="--已签到!";
 }

function deleteTag(id){
    var my = document.getElementById(id);
    if (my != null)       my.parentNode.removeChild(my);
 }

function div_allHid(){
	deleteTag("Sign_Body");
}
function cutchar(allstr,prechar,endchar){
	var preposition=allstr.indexOf(prechar)+prechar.length;
	var strlength=allstr.indexOf(endchar,preposition);
	return allstr.substring(preposition,strlength);
}

function Ajax(recvType) {
    var aj = new Object();
    aj.recvType = recvType ? recvType.toUpperCase() : 'HTML';//HTML XML
    aj.targetUrl = '';//请求地址
    aj.sendString = '';//发送的字符串
    aj.resultHandle = null;
    aj.createXMLHttpRequest = function() {//创建ajax引擎对象
        var request = false;
       //window对象中有XMLHttpRequest存在就是非IE,包括(IE7,IE8)
        if (window.XMLHttpRequest) {
            request = new XMLHttpRequest();
            if (request.overrideMimeType) {
                request.overrideMimeType("text/xml");
            }
        //window对象中有ActiveXObject属性存在就是IE
        } else if (window.ActiveXObject) {
            var versions = ['Microsoft.XMLHTTP', 'MSXML.XMLHTTP', 'Msxml2.XMLHTTP.7.0', 'Msxml2.XMLHTTP.6.0', 'Msxml2.XMLHTTP.5.0', 'Msxml2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP'];
            for (var i = 0; i < versions.length; i++) {
                try {
                    request = new ActiveXObject(versions[i]);
                    if (request) {
                        return request;
                    }
                } catch(e) {
                    request = false;
                }
            }
        }
        return request;
    }
    aj.XMLHttpRequest = aj.createXMLHttpRequest();//获取ajax引擎对象
    aj.processHandle = function() {//判断状态
        if (aj.XMLHttpRequest.readyState == 4) {
            if (aj.XMLHttpRequest.status == 200) {
                if (aj.recvType == "HTML") aj.resultHandle(aj.XMLHttpRequest.responseText);
                else if (aj.recvType == "XML") aj.resultHandle(aj.XMLHttpRequest.responseXML);
            }
        }
    }
    aj.get = function(targetUrl, resultHandle) {
        aj.targetUrl = targetUrl;
        if (resultHandle != null) {
            aj.XMLHttpRequest.onreadystatechange = aj.processHandle;
            aj.resultHandle = resultHandle;//接收回调方法
        }
        if (window.XMLHttpRequest) {
            aj.XMLHttpRequest.open("get", aj.targetUrl);
            aj.XMLHttpRequest.send(null);
        } else {
            aj.XMLHttpRequest.open("get", aj.targetUrl, true);
            aj.XMLHttpRequest.send();
        }
    }
    aj.post = function(targetUrl, sendString, resultHandle) {
        aj.targetUrl = targetUrl;
        if (typeof(sendString) == "object") {
            var str = "";
            for (var pro in sendString) {
                str += pro + "=" + sendString[pro] + "&";
            }
            aj.sendString = str.substr(0, str.length - 1);
        } else {
            aj.sendString = sendString;
        }
        if (resultHandle != null) {
            aj.XMLHttpRequest.onreadystatechange = aj.processHandle;
            aj.resultHandle = resultHandle;
        }
        aj.XMLHttpRequest.open("post", targetUrl);
        aj.XMLHttpRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        aj.XMLHttpRequest.send(aj.sendString);
    }
    return aj;
}

New Annotation

Summary:
Author:
Mode:
Body: