微博咆哮体[Chrome Extension]
传说最近咆哮体很火,昨晚下班就写了这个小玩意,在网页端发微博时,自动将微博内容转为咆哮体,
暂支持了腾讯,新浪,搜狐微博
先看下截图:
主要代码如下:
(function(){
var $ = function(id){return document.getElementById(id)},
sendBtn,txtMsg;
switch(location.hostname){
case "t.qq.com":
sendBtn = document.getElementsByClassName("sendBtn")[0];
txtMsg = $("msgTxt");
break;
case "t.sina.com.cn":
sendBtn = $("publisher_submit");
txtMsg = $("publish_editor");
break;
case "t.sohu.com":
sendBtn = document.getElementsByClassName("crJs_submit")[0];
txtMsg = document.getElementsByClassName("atfake");
txtMsg = txtMsg.length > 0 && txtMsg.nextElementSibling;
break;
}
if(!(sendBtn || txtMsg)){return;}
sendBtn.title = "咆哮吧!!!!!";
sendBtn.addEventListener("mousedown", function(){
if(txtMsg.value.trim().length > 0) {
txtMsg.value = paoxiao(txtMsg.value);
}
}, false);
var $ = function(id){return document.getElementById(id)},
sendBtn,txtMsg;
switch(location.hostname){
case "t.qq.com":
sendBtn = document.getElementsByClassName("sendBtn")[0];
txtMsg = $("msgTxt");
break;
case "t.sina.com.cn":
sendBtn = $("publisher_submit");
txtMsg = $("publish_editor");
break;
case "t.sohu.com":
sendBtn = document.getElementsByClassName("crJs_submit")[0];
txtMsg = document.getElementsByClassName("atfake");
txtMsg = txtMsg.length > 0 && txtMsg.nextElementSibling;
break;
}
if(!(sendBtn || txtMsg)){return;}
sendBtn.title = "咆哮吧!!!!!";
sendBtn.addEventListener("mousedown", function(){
if(txtMsg.value.trim().length > 0) {
txtMsg.value = paoxiao(txtMsg.value);
}
}, false);
})();
下载 后Chrome会自动提示安装,其它浏览器拖到Chrome中安装即可