[tmp] hu60@所有人插件

时间:2024-01-11 08:56:20
<div style="padding:3px;text-align:right;">
<a style="background:green;color:white;padding:2px;" href="#" onclick="return atAll('at');">@本页</a>
   
<a style="background:green;color:white;padding:2px;" href="#" onclick="return atAll('clear');">清空</a>
</div>
<script>
function atAll(act)
{
var con=document.getElementById("content");
//con.value="haha";
var bdcon=document.getElementsByTagName("body")[0].innerHTML;
var result=null; if(act=='clear')
{
con.value='';
return false;
} var patt1=new RegExp("<a href=\".*?user\\.index\\.html\">\\s*(.+?)\\s*</a>","gm");
result=patt1.exec(bdcon);
var myName=(result==null)?'':result[1]; var patt2=new RegExp("<a href=\"#\" onclick=\"atAdd\\('(.*?)'\\).+?</a>","gm");
do{
result=patt2.exec(bdcon);
if(result==null) break;
if(result[1]==myName) continue;
var tmp='@'+result[1]+',';
con.value+=(con.value.indexOf(tmp)==-1)?tmp:'';
}while(true);
return false;
}
</script>