Paste: baidutiebasign
Author: | test |
Mode: | javascript |
Date: | Tue, 7 May 2013 11:22:45 |
Plain Text |
var BaseUrl="";
var baObjs = new Array;
var localUrl = window.location.href;
var bai;
var ajax=Ajax();
var pageStr;
var baCH = new Array;
var baEN = new Array;
if(cutchar(localUrl,"http://",".com")=="wapp.baidu"){
show_BaseDiv();
mark_cell();
}
if(cutchar(localUrl,"http://",".com")=="tieba.baidu"){$("#Sign_MainDiv").innerHTML+= "电脑签到<br/>";
show_BaseDiv();
document.getElementById("myli5").innerHTML="<a href='http://wapp.baidu.com/mo/m?tn=bdFBW&tab=favorite' target='_blank'>进入WAPP</a>";
mark_fav();
}
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;}"+
".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/p/1768731534' target='_blank'>蝉曦吧反馈专用贴</a></span><br/>"+
"服务器随时可能不可用,故关注更新帖,保证可以及时更新书签:<br/>"+
"<span class='pt15'><a href='http://tieba.baidu.com/p/2110672062?see_lz=1' target='_blank'>蝉曦吧地址更新专用帖</a></span><br/>"+
"请注意:请在自动签到的时候,放慢你的发帖和回复速度,防止应为操作过频被度受和谐ID。<br/>"+
"------2013.04.03 v1.2.0------<br/>"+
"更新1.重新改变了界面<br/>"+
"更新2.解决了“c++”等含有符号的贴吧的解决问题<br/>"+
"更新3.完善了模拟手机签到的代码<br/>"+
"<span style='color:green;'>------------------------------</span><br/>"+
"ios(越狱)和android版签到工具,请前往<a href='http://tieba.baidu.com/p/2047715431?see_lz=1' target='_blank'>手机签到工具</a>支持并提供宝贵意见,本工具相对别的签到工具的优点是:省流量;100个贴吧的签到约为300KB的流量左右<br/>";
document.getElementById("Sign_MainDiv").innerHTML="请使用本工具的人能够将代码书签的地址改成googlecode的地址:<br/>"+
"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)})());<br/>"+
"以下地址一段时间内将不会保证代码的稳定性、可用性和更新状态<br/>"+
"http://pastebin.com/raw.php?i=YGb5nCmY<br/>"+
"https://raw.github.com/chanxi/--------/master/sign.js<br/>"+
"http://chanxi.ueuo.com/script/sign.js<br/>"+
"程序开始工作...<br/>---开始收集I贴吧中的贴吧名,请等待 ......<br/>";
}
function mark_fav(){
countba();
}
function countba(){
$(".Sign_BtnTop")[0].innerHTML="开始收集。。。";
$.ajax({
type: "get",url: "http://tieba.baidu.com/i/" +PageData.user.itieba_id+"/allfeed",
data: "",dataType: "text",success: function (data) {
var dataObjs=$(data).find(".always_go_list li .j_ba_link");
for(var i=0;i<dataObjs.length;i++){
baObjs[i] =new Object;
baObjs[i].fid=dataObjs.eq(i).attr("forum-id");
baObjs[i].name=dataObjs.eq(i).attr("title")||dataObjs.eq(i)[0].innerHTML;
baObjs[i].kw=dataObjs.eq(i).attr("forum");
}
$(".Sign_BtnTop")[0].innerHTML="收集完毕!";
$(".Sign_BtnTop")[1].innerHTML="0 / "+baObjs;
$(".Sign_MainDiv")[0].innerHTML+="估测完毕:您喜欢的贴吧有"+(baObjs.length)+"个,最长将花费时间"+parseInt(baObjs.length*6/60)+"分"+(baObjs.length*6%60)+"秒";
checksigned(0);
},
error: function () {
$(".Sign_MainDiv")[0].innerHTML+="收集贴吧遇到问题,程序不能继续下去!请手动刷新后重新运行!";
}
});
}
function checksigned(bai){
if(bai>=baObjs.length){
$(".Sign_MainDiv")[0].innerHTML+="<br/>签到完毕!请自行检查有没有签到正确,如有错误,欢迎反馈<a href='http://tieba.baidu.com/p/1768731534' target='_blank'>蝉曦吧反馈专用贴</a><br/><br/><br/><br/><br/>";
$(".Sign_BtnTop")[2].innerHTML="<span style='color:red;'>签到完毕!</span>";
return 0;
}else{
$(".Sign_BtnTop")[1].innerHTML=(bai+1)+" / "+baObjs.length;
$(".Sign_MainDiv")[0].innerHTML+="<br/>+"+(bai+1)+" .<a href='http://tieba.baidu.com/f?kw="+baObjs[bai].kw+"' target='_blank'>"+baObjs[bai].name+"吧</a>";
}
$.ajax({
type: "get",url: "http://tieba.baidu.com/f?kw="+baObjs[bai].kw+"&mmmm="+Math.random(),
data: "",dataType: "text",success: function (data) {
var rewords=data;
var my_Rank=cutchar(rewords,"<span class=\"sign_index_num j_signin_index\">","</span>");
var my_Days=cutchar(rewords,"c_sign_num : ",",");
var my_AllDays=cutchar(rewords,"c_sign_num : ",",");
var tbs=cutchar(rewords,"PageData.tbs = \"","\";");
if(cutchar(rewords,"PageData.user.is_block = ",";//是否已封禁")=="1"){
$(".Sign_MainDiv")[0].innerHTML+="--您在本吧<span style='color:red;'>被封禁,不能签到!</span>---防和谐,等待1s ing...";
setTimeout("checksigned("+(bai+1)+");",1000);
return 0;
}
if(rewords.indexOf("<span class=\"sign_index_num j_signin_index\">")<0){
$(".Sign_MainDiv")[0].innerHTML+="--本吧还没开放签到系统!---防和谐,等待1s ing...";
setTimeout("checksigned("+(bai+1)+");",1000);
return 0;
}
if(my_Rank=="0"){
$(".Sign_MainDiv")[0].innerHTML+="--未签到!";
signed(bai,tbs);
}else{
$(".Sign_MainDiv")[0].innerHTML+="--已签到!--今日第<span style='color:red;'>"+my_Rank+"</span>个签到,连续<span style='color:red;'>"+my_Days+"</span>天!---防和谐,等待1s ing...";
setTimeout("checksigned("+(bai+1)+");",1000);
}
return 0;
},
error: function () {
$(".Sign_MainDiv")[0].innerHTML+="---检查出现问题,重新检查!";
setTimeout("checksigned("+bai+");",1000);
}
});
}
function signed(bai,tbs){
$.ajax({
type: "post",
url: "http://tieba.baidu.com/sign/add",
data: "kw="+encodeURIComponent(baObjs[bai].name)+"&ie=utf-8&tbs="+tbs,
dataType: "text",
success: function (data) {
var rewords=eval('(' + data + ')');
if(rewords.error==""){
$(".Sign_MainDiv")[0].innerHTML+="--签到完毕,您是第<span style='color:red;'>"+rewords.data.uinfo.user_sign_rank+"</span>个签到,连续<span style='color:red;'>"+rewords.data.uinfo.cont_sign_num+"</span>天,共<span style='color:red;'>"+rewords.data.uinfo.cout_total_sing_num+"</span>天!---防和谐,等待6s ing...";
var waittime=6000;
}
else{
$(".Sign_MainDiv")[0].innerHTML+="--<span style='color:red;'>"+eval('"'+rewords.error+'"')+"</span>---防和谐,等待1s ing...";
var waittime=1000;
}
setTimeout("checksigned("+(bai+1)+");",waittime);
},
error: function () {
$(".Sign_MainDiv")[0].innerHTML+="签到出现问题,马上重签!";
signed(bai,tbs);
}
});
}
function mark_cell(){
var i=0;ba=0;
var urlStr1;
ajax.get("http://wapp.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(){
ajax.get("http://wapp.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++;
}
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://wapp.baidu.com/mo/"+urlStr1+"/m?kw="+baEN[i]+"&m="+Math.random(), function(data){
document.getElementById("Sign_MainDiv").innerHTML+=(i+1)+". <a href='http://wapp.baidu.com/mo?kw="+baEN[i]+"' target='_blank'>"+baCH[i]+"</a>";
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(/&/gi,"&");
ajax.get("http://wapp.baidu.com/mo/"+urlStr1+"/sign?"+urlStr2, function(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(">喜欢本吧</a>")>0){
document.getElementById("Sign_MainDiv").innerHTML+="--未喜欢!";
var urlStr2=cutchar(data,"amp;itb_","\"").replace(/&/gi,"&");
ajax.get("http://wapp.baidu.com/mo/"+urlStr1+"/sign?"+urlStr2, function(data){
document.getElementById("Sign_MainDiv").innerHTML+="--本吧签到结果请自行在电脑版检查!";
});
}else if(data.indexOf("<td style=\"text-align:right;\"></td>")>0){
document.getElementById("Sign_MainDiv").innerHTML+="--本吧还没开放签到系统!";
}
i++;
if(i==ba) {
clearInterval(ret);
document.getElementById("myli5").innerHTML="<span style='color:red;'>签到完毕!</span>";
}
});
},4000);
},6000);
});
});
}
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';
aj.targetUrl = '';
aj.sendString = '';
aj.resultHandle = null;
aj.createXMLHttpRequest = function() {
var request = false;
if (window.XMLHttpRequest) {
request = new XMLHttpRequest();
if (request.overrideMimeType) {
request.overrideMimeType("text/xml");
}
} 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();
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