manifest
{
"background": {
"scripts": [ "js/jquery.js", "lhgdialog/lhgdialog.min.js", "js/done.js" ]
},
"browser_action": {
"default_icon": "icon.png",
"popup": "popup.html"
},
"content_scripts": [ {
"css": [ "css.css", "lhgdialog/skins/mac.css" ],
"js": [ "js/jquery.js", "js/atFoucs.js", "lhgdialog/lhgdialog.min.js", "js/done.js" ],
"matches": [ "http://tieba.baidu.com/*" ]
} ],
"description": "@风云酷小子 为百度贴吧开发的辅助工具",
"icons": {
"128": "icon.png"
},
"key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDhQZj+Jaj/72suRYUcFK8tzO7Zn/2kzsKCMGbItVmGefp5kZnV9o2ZboXF6RPHC8fzSVegt/XvzbG3X2/8+V3juKdrWbU0CV9oooOAj8J169fXKASEtlT2KLoI3FA8JFY+/7jc8df/ovRKDXXI6TrzZkMzqtaNYLqg0Pe/OGYAoQIDAQAB",
"manifest_version": 2,
"name": "酷小子贴吧工具v2.0",
"permissions": [ "tabs", "http://*/" ],
"version": "2.0"
}
done.js
$(document).ready(function() {
$("body").append("<div id='boy'><div align='center' class='boy-title'>酷小子贴吧工具</div><div id='boy_update' class='boy-list'>工具更新</div><div id='boy_other' class='boy-list'>附加功能</div><!--v2.0取消<div id='boy_sign' class='boy-list'>一键签到</div>--><div id='boy_sign_wap' class='boy-list'>wap签到(beta)</div><div class='boy-list' id='boy-num'>查询水度</div><div class='boy-list' id='boy-fen'>坟贴提醒</div><div class='boy-list' id='boy-weiba'>小尾巴儿</div><div class='boy-list' id='edit-page'>页面改造器</div></div>");
/*取随机数函数*/
$.rand=function(Min,Max)
{
var Range = Max - Min;
var Rand = Math.random();
return(Min + Math.round(Rand * Range));
};
/*自动执行的*/
(function() {
$("#boy").slideDown();
if (window.location.href.indexOf('tieba.baidu.com/p/') > 0) {
var times = $(".j_lzl_wrapper>.core_reply_tail>ul.p_tail>li:nth-child(2)").text();
var time = times.substr(0, 16) + ':00';
var a = time.split(" ");
var b = a[0].split("-");
var c = a[1].split(":");
var date = new Date();
date.setFullYear(b[0],parseInt(b[1].replace("0",""))-1,b[2]);
date.setHours(c[0],c[1],c[2]);
var now = new Date();
var dateCha = now - date;
var dateChaDays = Math.floor(dateCha / (24 * 3600 * 1000));
if (dateChaDays > 120) {
$(".new_tiezi_tip").before("<div class='fen'>酷小子工具·坟帖提醒:该帖子发表于" + dateChaDays + "天以前,挖坟需谨慎</div>")
}
/*如果在帖子页面,新增功能*/
$("#boy").append("<div class='boy-list' id='boy-qiu'>插入糗事</div>");
$("#boy").append("<div id='boy_shua' class='boy-list'>强刷回复</div>");
$("#boy").append("<div class='boy-list' id='boy-reply'>狂刷回复(神器)</div>");
}
/*小尾巴*/
if (localStorage["boyWeiba"]) {
$(".tb-editor-editarea").append("<font id='boy-xiaoweiba-txt'><br><br><br><br><b style='display:none;color:#e10602'><b><font color=\"#e10602\">" + localStorage["boyWeiba"].replace("?.png","?"+Math.random()+"&.png") + "</font></b></b></font>")
}
})();
/*自动执行的*/
$("#boy-test").on("click",
function() {
window.open('chrome-extension:///t.html');
});
$(".boy-list").on("mouseenter",
function() {
$(this).animate({
marginLeft: '10px'
},
'fast')
});
$(".boy-list").on("mouseleave",
function() {
$(this).animate({
marginLeft: '0px'
},
'fast')
});
$('#boy').on("mouseenter",
function() {
$(this).animate({
opacity: '0.6',
left:"0"
},
"fast")
});
$('#boy').on("mouseleave",
function() {
$(this).animate({
opacity: '0.2',
left:"-100"
},
"fast")
});
$("#boy_update").on("click",
function() {
window.location = 'http://www.44886.com/forum.php?mod=viewthread&tid=37&page=1#pid37';
});
$("#boy_other").on("click",
function() {
$.dialog({
id:'boy-other-content',
title:'酷小子附加娱乐中心',
width:642,
height:482,
min:false,
max:false,
fixed:true,
content:'url:http://tieba.44886.com',
zIndex:999999
});
});
/*下面功能是老版本的一键签到,v2.0被取消掉*/
/*
$("#boy_sign").on("click",
function() {
$.dialog({
id: 'alert',
content: '提示:使用本功能,您当前查看的页面将会跳转到签到界面,签到完成后请按下F5返回您当前正在查看的页面。',
title: '提醒您',
width: 340,
min: false,
max: false,
fixed: true,
button: [{
name: '立即签到',
callback: function() {
void((function() {
var e = document.createElement('script');
e.type = 'text/javascript';
e.charset = 'UTF-8';
e.src = 'http://kutools.duapp.com/baidu.js';
document.body.appendChild(e);
})())
},
focus: true
},
{
name: '算了',
},
]
})
});
*/
/*狂刷回复功能*/
var reply_txt='酷小子贴吧工具';
var reply_txt_array=null;
var tid=0;
var reply_num=0;/*第几次回复了*/
var reply_ba_name='';/*贴吧名称*/
var reply_tbs='';/*tbs*/
var reply_timer = null;
$.reply = function() {
reply_num++;
$.ajax({
url: "http://wapp.baidu.com/mo/q---wapp_1370150224473_797--1-1-0--2/m",
dataType: "text",
type:'POST',
data:"ti=回复&src=1&word="+reply_ba_name+"&tbs="+reply_tbs+"&ifpost=1&ifposta=1&post_info=0&tn=baiduWiseSubmit&fid=2084826&verify=&verify_2=&pinf=1_2_0&pic_info=&z="+tid+"&last=0&pn=0&r=0&see_lz=0&no_post_pic=0&floor=&sub1=回贴&co="+reply_txt_array[$.rand(0,(reply_txt_array.length)-1 )]+"",
success: function(msg) {
if(msg.indexOf('<span class="light">回贴成功</span>')>0){
$("#boy_reply_content").prepend("+第"+reply_num+"次--<span class='green'>刷回复成功</span>--1秒后继续<br/><br/>");
setTimeout($.reply,1000);
}else if(msg.indexOf('<span class="light">您的操作过于频繁,请稍后再试</span>')>0){
$("#boy_reply_content").prepend("+第"+reply_num+"次--<span class='red'>操作过于频繁,失败,休息1分钟再工作</span><br/><br/>");
setTimeout($.reply,60000);
}else{
$("#boy_reply_content").prepend("+第"+reply_num+"次--<span class='red'>失败</span>--2秒后再试<br/><br/>");
setTimeout($.reply,2000);
}
},
})
}
$("#boy-reply").on("click",
function() {
$.dialog({
id: 'alert',
content: '提示:本功能为v1.7版新增,能够让你看到刷帖的过程,而且在你主动停止之前,不会停止刷帖。',
title: '提醒您',
width: 340,
min: false,
max: false,
fixed: true,
button: [{
name: '立即刷',
callback: function() {
$("body").append("<div class='sgin_wap' id='boy_reply_content'></div>");
$("#boy_reply_content").append("请输入你想刷的内容:<br/>");
$("#boy_reply_content").append('<textarea id="boy_reply_txt" placeholder="每行一句,如果输入多行,则每次随机使用其中一句发表"></textarea><br/>');
$("#boy_reply_content").append('<input type="submit" id="boy_reply_but" class="subbtn_bg_active" value="立即工作"/>');
$("#boy_reply_but").click(function(){
/*获取当前帖子的ID*/
tid=window.location.href.replace("http://tieba.baidu.com/p/","");
/*获取完毕*/
$.ajax({
url:"http://wapp.baidu.com/mo/q---wapp_1370150224473_797--1-1-0--2/m?kz="+tid+"&is_bakan=0&lp=5010&pinf=1_2_0",
dataType:"text",
beforeSend: function(){
reply_txt=$("#boy_reply_txt").val();
reply_txt_array=reply_txt.split("\n");
$("#boy_reply_content").html('');
$("#boy_reply_content").html('狂刷回复,开始了!请不要刷新页面,不要关闭窗口。坐等任务消息。<br/>如果想退出,请刷新页面!');
},
success: function(msg){
var re=/name="tbs" value=".*?"/i;
var result=msg.match(re);
if(result!=null){
reply_tbs=result[0].replace('name="tbs" value="','');
reply_tbs=reply_tbs.replace('"','');
reply_ba_name= $("#wd1").val();
$.reply();
}else{
$("#sgin_wap").prepend("<span class='red'>失败,没获取到临时码</span>,请刷新页面<br/><br/>");
}
}
});
});
},
focus: true
},
{
name: '算了',
},
]
})
});
/*狂刷回复*/
/*下面代码是WAP签到*/
var ba_num = 0;
var bas = null;
var sgin_num = 0;
var sgin_timer = null;
$.sgin_wap = function() {
if (sgin_num >= ba_num) {
$("#sgin_wap").prepend("<span class='green'>恭喜你,签到全部完成!请手动刷新页面</span><br/><br/>");
return false;
}
ba = bas[sgin_num];
ba = ba.replace('<a href="m?kw=', '');
ba = ba.replace('"', '');
$.ajax({
url: "http://wapp.baidu.com/mo/q---9DA45AC5AEA644802A9EB085E2F49C2F--1-1-0--2/m?kw=" + ba + "&lp=1030",
beforeSend: function() {
$("#sgin_wap").prepend("<span id='sgin" + sgin_num + "'>+" + (sgin_num + 1) + '.' + decodeURI(ba) + '--</span><br/><br/>');
},
dataType: "text",
success: function(msg) {
if (msg.indexOf('<span >已签到</span>') > 0) {
$("#sgin" + sgin_num + "").append("<span class='green'>已经签到了</span>--3秒后继续");
sgin_num++;
setTimeout($.sgin_wap,3000);
return false
} else {
re = /<a href="\/mo\/q---.*?"/gi;
result = msg.match(re);
if (result == null) {
$("#sgin" + sgin_num + "").append("<span class='red'>本吧没开放签到功能</span>--3秒后继续");
sgin_num++;
setTimeout($.sgin_wap,3000);
} else {
url = result[0].replace('<a href="', '');
url = url.replace('"', '');
url = url.replace(/amp;/g, '');
$("#sgin" + sgin_num + "").append("<span class='zise'>还没签到</span>--马上签到--");
$.ajax({
url: "http://wapp.baidu.com" + url,
dataType: "text",
success: function(msg) {
if (msg.indexOf('<span class="light">签到成功') > 0) {
$("#sgin" + sgin_num + "").append("<span class='green'>签到成功</span>--休息5秒");
} else {
$("#sgin" + sgin_num + "").append("<span class='red'>签到失败</span>(请人工进该贴吧看看)--休息5秒");
}
sgin_num++;
setTimeout($.sgin_wap,5000);
return false
}
})
}
}
},
})
}
$("#boy_sign_wap").on("click",
function() {
$.dialog({
id: 'alert',
content: '提示:模拟WAP一键签到,每天5点经验,测试版。',
title: '提醒您',
width: 340,
min: false,
max: false,
fixed: true,
button: [{
name: '立即签到',
callback: function() {
$("body").append("<div class='sgin_wap' id='sgin_wap'></div>");
$.ajax({
url: "http://tieba.baidu.com/mo/q-0--9DA45AC5AEA644802A9EB085E2F49C2F-sz%40224_220%2C-1-1-0--/m?tn=bdFBW&tab=favorite",
dataType: "text",
beforeSend: function() {
$("#sgin_wap").prepend("嗯哼,我开始工作了。请稍后,我会把签到的情况写出来的,注意新的消息在上面哦~~<br/>签到过程,不要刷新页面!<br/>任何问题,请在贴吧 @风云酷小子")
},
success: function(msg) {
var re = /<a href="m\?kw=.*?"/gi;
var result = msg.match(re);
if (result == null) {
$("#sgin_wap").prepend("喂喂,好象你还没有喜欢的贴吧呢~~<br/><br/>");
} else {
ba_num = result.length;
bas = result;
$("#sgin_wap").prepend("好吧,你喜欢的贴吧有" + ba_num + "个,接下来将为你挨个签到,请等待<br/><br/>");
$.sgin_wap();
}
}
})
},
focus: true
},
{
name: '算了',
},
]
})
});
/*wap签到完成了*/
$("#boy-num").on("click",
function() {
var ba = $("#wd1").val();
var ren = $("a.u_username_show").html();
if (ba == undefined) {
$.dialog({
content: '请进入具体贴吧再使用本功能',
id: 'alert',
fixed: true,
time: 5,
title: '出错',
max: false,
min: false
});
return false
}
if (ren == undefined) {
$.dialog({
content: '未获取到你的用户名,请检查是否登录,或者还没点我喜欢',
id: 'alert',
fixed: true,
time: 5,
title: '出错',
max: false,
min: false
});
return false
}
$.dialog({
id: 'num',
content: '请稍后...',
min: false,
max: false,
fixed: true,
title: '您在本吧的发帖数量',
init: function() {
var ba = $("#wd1").val();
var ren = $("a.u_username_show").html();
$.ajax({
url: 'http://kutools.duapp.com/api.getBaiDuTieBaForChrome.php?ba=' + encodeURIComponent(ba) + '&ren=' + encodeURIComponent(ren),
success: function(msg) {
if (msg != '0') {
lhgdialog.list['num'].close();
$.dialog({
width: 400,
id: 'num',
fixed: true,
title: '您在本吧的发帖数量',
min: false,
max: false,
content: '截至此时,你在本吧的发帖数量为:<b>' + msg + '</b>',
})
} else {
lhgdialog.list['num'].close();
$.dialog({
id: 'num',
width: 300,
title: '您在本吧的发帖数量',
min: false,
fixed: true,
max: false,
content: '查询失败,可能未获取到你的用户名',
})
}
},
error: function(msg) {
lhgdialog.list['num'].close();
$.dialog({
id: 'num',
width: 300,
title: '您在本吧的发帖数量',
min: false,
fixed: true,
max: false,
content: msg,
})
}
})
},
close: function() {}
})
});
$("#boy-fen").on("click",
function() {
$.dialog({
content: '坟贴提醒功能,在你进入帖子的时候,如果该帖子的发表日期大于4个月,本工具会发出严重警告提醒你。免得你回复坟贴最终被吧主封号。',
id: 'alert',
fixed: true,
time: 8,
width: 350,
title: '坟贴提示',
max: false,
min: false
})
});
$.qiu = function() {
$.dialog({
id: 'qiu',
content: '请稍后...',
min: false,
max: false,
fixed: true,
title: '插入糗事',
zIndex: 898999999,
init: function() {
$.ajax({
url: 'http://44886.com/api.php?xiaohua&type=rand&from=hot&num=5',
dataType: "json",
success: function(msg) {
if (msg.length>0) {
lhgdialog.list['qiu'].close();
var txt = '';
txt = '<div><ul class="qiu-ul">';
for (var i in msg) {
txt += "<li class='qiu-li'>" + msg[i]['text'] + ""
if(msg[i]["img"]!=undefined){
txt +='<br/><img unselectable="on" pic_type="0" class="BDE_Image" src="'+msg[i]['img']+'"/><br/>';
}
txt += "</li>";
}
txt += "</ul></div>";
$.dialog({
width: '300px',
id: 'qiu',
fixed: false,
title: '插入糗事',
min: false,
max: false,
left: '100%',
content: txt,
});
$(".qiu-li").click(function() {
$("html,body").animate({
scrollTop: 1000000
},
1000);
if (localStorage["boyWeiba"]) {
$("#boy-xiaoweiba-txt").before($(this).html() + "(ps:本糗事来自【酷小子贴吧工具】)<br>")
} else {
$('.tb-editor-editarea').append($(this).html() + "(ps:本糗事来自【酷小子贴吧工具】)<br>")
}
$(this).slideUp()
})
} else {
lhgdialog.list['num'].close();
$.dialog({
id: 'qiu',
width: 300,
title: '插入糗事',
min: false,
fixed: true,
max: false,
content: '获取糗事列表失败',
})
}
},
error: function(msg) {
lhgdialog.list['num'].close();
lhgdialog.list['num'].close();
$.dialog({
id: 'qiu',
width: 300,
title: '插入糗事',
min: false,
fixed: true,
max: false,
content: '获取糗事列表失败',
})
}
})
},
close: function() {}
});
};
$("#boy-qiu").on("click",
function() {
$.qiu()
});
/*小尾巴设置*/
$("#boy-weiba").on("click",
function() {
$.dialog({
content: '设置你的贴吧小尾巴吧:<br><textarea name="textarea" id="xiaoweiba-txt" cols="45" rows="5">'+ (localStorage["boyWeiba"] ? localStorage["boyWeiba"].replace(/<br\/>/g,"\n") : "") +'</textarea>',
id: 'alert',
fixed: true,
width: 400,
title: '设置发言小尾巴',
max: false,
min: false,
button: [{
name: '保存',
callback: function() {
var temp=$("#xiaoweiba-txt").val();
localStorage["boyWeiba"] = temp.replace(/\n/g,"<br/>");
},
focus: true
},
]
})
});
/*小尾巴设置完毕*/
/*页面改造*/
$("#edit-page").on("click",
function() {
$.dialog({
content: '这是什么呢?<br/>本功能可以让你任意修改当前页面的内容,修改后,你可以把修改后的页面截图给你的好友看。以完成正常情况下不能达到的显示效果。<br/>点击下面按钮后,你的鼠标指针变成输入状态,表示可以修改页面了',
id: 'alert',
fixed: true,
width: 400,
title: '页面改造器',
max: false,
min: false,
button: [{
name: '立即使用',
callback: function() {
document.body.contentEditable='true';
document.designMode='on';
void 0;
},
focus: true
},
]
})
});
/*页面改造*/
/*下面是强刷回复*/
$("#boy_shua").on("click",
function() {
if (window.location.href.indexOf('tieba.baidu.com/p/') > 0) {
$.dialog({
id: 'alert',
content: '提示:使用本功能,能够一次性提交多条回复。由于时间间隔短,可能会让你的账号被贴吧吧主或贴吧管理员封锁,请三思而后行。',
title: '提醒您',
width: 340,
min: false,
max: false,
fixed: true,
button: [{
name: '给我刷',
callback: function() {
window.location = 'javascript: var c=rich_postor._getData(); c.content="我喜欢静。喜欢白杨仰望流云"; for(var i=1;i<=12;i++) {if(i<12){if(i<11){if(i<10){ if(i<9){if(i<8){if(i<7){if(i<6){if(i<5){if(i<4){if(i<3){if(i<2){ if(i<1){c.content="di1";}} else{c.content="目不转睛的静。喜欢秋蝉抱紧";}} else{c.content="树梢纵声嘶鸣的静。喜欢落叶";}} else{c.content="轻叩大地欲言又止的静——";}} else{c.content="轻叩大地欲言又止的静——";}} else{c.content="静。喜欢不远的往事里一种疼痛着";}} else{c.content="的静。喜欢诗歌腹稿中那份自身";}} else{c.content="无力承担的静。喜欢倾诉的念头";}} else{c.content="一直被秋风压抑着的静……";}} else{c.content="秋天正在远行.似乎久已注定——";}} else{c.content="这无比惋惜而又无法挽留,";}} else{c.content="这刚刚到来就要匆匆远去……";} PostHandler.post(rich_postor._option.url,c,function(I){rich_postor.showAddResult(I)},function(I){});}; void 0;'
},
focus: true
},
{
name: '算了',
},
]
})
} else {
$.dialog({
content: '该功能仅适用于帖子浏览页面',
id: 'alert',
fixed: true,
time: 5,
title: '出错',
max: false,
min: false
})
}
});
/*强刷回复完成*/
/*下面是清楚广告,游戏之类的*/
var replaceStr ='<ul class="myAd"><li><a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=544230987&site=qq&menu=yes">联系风云酷小子</a></li><li><a href="http://u.youku.com/风云酷小子" target="_blank">酷小子的所有视频</a></li><li><iframe src="http://follow.v.t.qq.com/index.php?c=follow&a=quick&name=ydfyhs&style=3&t=1379141387573&f=1" frameborder="0" scrolling="auto" width="208" height="20" marginwidth="0" marginheight="0" allowtransparency="true"></iframe></li></ul>';
$(".hgame_mod_theme1").hide();
$(".hgame_mod_theme2").hide();
$("#aside_ad").hide();
$(".aside_ad_bright").hide();
$(".game_rank").hide();
$(".pc2client").hide();
$(".game_item").hide();
$(".l_client").hide();
$(".tieba_notice").hide();
$(".j_surveillance").hide();
$("#bdshare").hide();
$("#balv_mod").after(replaceStr );
/*清楚完成*/
/*给酷小子加I*/
$(".tb_icon_author").each(function(index, element) {
if($(this).attr("title").indexOf('风云酷小子')>0){
$(this).children("a").after('<img src="http://tb2.bdstatic.com/tb/img/itieba_vip.gif" class="verified_icon">');
}
});
$(".d_name").each(function(index, element) {
if($(this).attr("data-field").indexOf('246939895')>0){
$(this).children("a").after('<img src="http://tb2.bdstatic.com/tb/img/itieba_vip.gif" class="d_verified_icon">');
}
});
$(".at").each(function(index, element) {
if($(this).html()=="@风云酷小子" || $(this).attr("username")=="风云酷小子"){
$(this).after('<img src="http://tb2.bdstatic.com/tb/img/itieba_vip.gif" class="d_verified_icon">');
}
});
});
css.css
@charset "utf-8";
/* CSS Document */
#boy{
position: fixed;
left: -100px;
top: 30%;
z-index: 88;
padding: 2px;
font-size: 14px;
color: #000;
background-color: #fff800;
opacity: 0.2;
cursor:pointer;
}
.green {
color: #060;
}
.zise {
color: #C0F;
}
.boy-title{
font-size: 16;
font-weight: bold;
background: -webkit-gradient(linear,0% 0%, 0% 100%, from(#fff800), to(#f60));
padding: 5px;
}
.boy_list{
padding-left: 0px;
margin-left: 0px;
}
.qiu-ul {
list-style:none;
}
.qiu-li{
margin: 10px;
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: #999;
cursor:pointer;
}
.edit_font_normal{
display:none;}
.sgin_wap {
position: fixed;
z-index: 99999999;
height: 50%;
width: 50%;
left: 25%;
top: 25%;
border: 5px solid #999;
overflow-y: scroll;
background-color: #FFF;
}
.fen {
font-size: 16px;
color: #F00;
padding: 5px;
border: 3px solid #F00;
}
.red {
color: #F00;
}
#boy_reply_txt {
height: 80%;
width: 90%;
}
.myAd {
list-style:none;
padding:0px;
margin:0px;
}
.myAd li{
margin-top: 5px;
margin-right: 5px;
margin-bottom: 5px;
margin-left: 15px;
padding: 5px;
}
jsAtfocus.js
//在光标处插入字符
(function($){
$.fn.extend({
insertAtCaret: function(myValue){
var $t=$(this)[0];
if (document.selection) {
this.focus();
sel = document.selection.createRange();
sel.text = myValue;
this.focus();
}
else
if ($t.selectionStart || $t.selectionStart == '0') {
var startPos = $t.selectionStart;
var endPos = $t.selectionEnd;
var scrollTop = $t.scrollTop;
$t.value = $t.value.substring(0, startPos) + myValue + $t.value.substring(endPos, $t.value.length);
this.focus();
$t.selectionStart = startPos + myValue.length;
$t.selectionEnd = startPos + myValue.length;
$t.scrollTop = scrollTop;
}
else {
this.value += myValue;
this.focus();
}
}
})
})(jQuery);