Skip to content

Instantly share code, notes, and snippets.

Created November 24, 2012 13:30
Show Gist options
  • Save anonymous/4139719 to your computer and use it in GitHub Desktop.
Save anonymous/4139719 to your computer and use it in GitHub Desktop.
贴吧最新蓝色字
var str =prompt('输入要回复的蓝字');
function UniCode(str){
str = str.replace(/<\/?a[^>]*>/gi, "");
var temps = new Array();
var i = 0;
while (/<[^>]*>|&nbsp;|@\S*/.test(str)) {
temps[i] = /<[^>]*>|&nbsp;|@\S*/.exec(str);
str = str.replace(temps[i], "㊣");
i++;
}
var out = "";
for (var i = 0; i < str.length; i++) {
out += "&#" + str.charCodeAt(i) + ";";
}
for (var i = 0; i < temps.length; i++) {
var temp = temps[i] + "";
out = out.replace(/&#12963;/, temp);
}
return out;
}
var xx = UniCode(str);
var yy = UniCode(xx);
var tieba=rich_postor._getData();
var a='<a href="http://';
var b='/" target="_blank" style="color:red">';
var d="< /a>";
tieba.content=a+yy+b+yy+d;
PostHandler.post(rich_postor._option.url,tieba,function(I){unsafeWindow.rich_postor.showAddResult(I)},function(I){});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment