Created
November 24, 2012 13:30
-
-
Save anonymous/4139719 to your computer and use it in GitHub Desktop.
贴吧最新蓝色字
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var str =prompt('输入要回复的蓝字'); | |
function UniCode(str){ | |
str = str.replace(/<\/?a[^>]*>/gi, ""); | |
var temps = new Array(); | |
var i = 0; | |
while (/<[^>]*>| |@\S*/.test(str)) { | |
temps[i] = /<[^>]*>| |@\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(/㊣/, 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