脚本之家贴图转换+转贴工具用到的js代码超级推荐_Javascript教程-查字典教程网
脚本之家贴图转换+转贴工具用到的js代码超级推荐
脚本之家贴图转换+转贴工具用到的js代码超级推荐
发布时间:2017-01-14 来源:查字典编辑
摘要:functiondelnull(){varstr=document.getElementById('text').value;str=str...

<SCRIPTlanguage=JavaScript>

<>

</SCRIPT>

<SCRIPTlanguage=JavaScript1.2>

functiondelnull()

{

varstr=document.getElementById('text').value;

str=str.replace(/([s]*rn[s]*){2,}/gm,"rn");

document.getElementById('text').value=str;

}

functionrefix()

{

varstr=document.getElementById('text').value;

str=str.replace(/([s]*rn[s]*){2,}/gm,"rnrn");

document.getElementById('text').value=str;

}

functionurl()

{

varstr=document.getElementById('text').value;

str=str.replace(/^[]*(http://|^mms://|rtsp://|pnm://|ftp://|mmst://|mmsu://)([^rn]*)$/igm,"[url]$1$2[/url]");

document.getElementById('text').value=str;

}

functionaddbr()

{

varstr=document.getElementById('text').value;

str=str.replace(/rn/gm,"rnrn");

document.getElementById('text').value=str;

}

functionhtml_trans(str){

str=str.replace(/r/g,"");

str=str.replace(/on(load|click|dbclick|mouseover|mousedown|mouseup)="[^"]+"/ig,"");

str=str.replace(/<script[^>]*?>([wW]*?)</script>/ig,"");

if(set.fontbash.checked)

{

str=str.replace(/<span[^>]*?displays*?:s*?none[^>]*?>([wW]*?)</span>/ig,"");

str=str.replace(/<span[^>]*?fonts*?-s*?sizes*?:s*(0px|0pt)[^>]*?>([wW]*?)</span>/ig,"");

str=str.replace(/<font([^>]+)(0px|0pt)+([^>]*)>([wW]*?)</font>/ig,"");

}

if(set.filtrate.checked)

{

str=str.replace(/[^<]*<([^>]*?)>[^<]*/ig,"<$1>");

tm=window.textfield.value;

if(tm.length<1){

vararr;

arr=str.match(/<img[^>]+src=["]?([^"]+)["]?[^>]*>/ig);

tm=arr[0].replace(/<img[^>]+src=["]?([^"]+)["]?[^>]*>/ig,"$1")+""";

i=tm.search(//[^/]+"/ig);

tm=tm.substr(0,i);

window.textfield.value=tm+"/";

}

if(tm.substr(tm.length-1,1)!="/")tm+="/";

varstrtm="<img[^>]+src=["]?("+tm+"[^"]+)["]?[^>]*>";

varre=newRegExp(strtm,"ig");

str=str.replace(re,"n[img]$1[/img]n");

}

else

{

if(set.stext.checked)str=str.replace(/[^<]*<([^>]*?)>[^<]*/ig,"<$1>");

if(!set.linka.checked)str=str.replace(/<a[^>]+href=["]?([^"]+)["]?[^>]*>(.*?)</a>/ig,"[url=$1]$2[/url]");

if(!set.font_color.checked&&!set.stext.checked)

str=str.replace(/<font([^>]+)color=([^>]+)([^>]*)>(.*?)</font>/ig,"[color=$2]<font$1$3>$4</font>[/color]");

if(!set.font_size.checked&&!set.stext.checked)

str=str.replace(/<font([^>]+)size=([^>]+)([^>]*)>(.*?)</font>/ig,"[size=$2]<font$1$3>$4</font>[/size]");

if(!set.font_face.checked&&!set.stext.checked)

str=str.replace(/<font[^>]+face=([^>]+)[^>]*>(.*?)</font>/ig,"[font=$1]$2[/font]");

if(!set.img.checked)str=str.replace(/<img[^>]+src=["]?([^"]+)["]?[^>]*>/ig,"n[img]$1[/img]n");

if(!set.odj.checked){

//returnstr;

str=str.replace(/<object[^>]*?6BF52A52-394A-11d3-B153-00C04F79FAA6[^>]*?>.*<param[^>]+names*=s*["](url|src)["][^>]+value=["]?([^"]+)["][^>]*>.*</object>/ig,"n

播放视频文件

在线播放n");

str=str.replace(/<object[^>]*?D27CDB6E-AE6D-11cf-96B8-444553540000[^>]*?>.*<param[^>]+names*=s*["](url|src)["][^>]+value=["]?([^"]+)["][^>]*>.*</object>/ig,"n

Flash动画

在线播放n");

str=str.replace(/<embed[^>]*type=["]?application/x-shockwave-flash["]?[^>]*src=["]?([^"|^]+)["]?[^>]*>/ig,"n

Flash动画

在线播放n");

str=str.replace(/<embed[^>]*src=["]?([^"|^]+)["]?[^>]*type=["]?application/x-shockwave-flash["]?[^>]*>/ig,"n

Flash动画

在线播放n");

str=str.replace(/<object[^>]*?CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA[^>]*?>.*<param[^>]+names*=s*["](url|src)["][^>]+value=["]?([^"]+)["][^>]*>.*</object>/ig,"n

播放real视频流文件

在线播放n");

}

if(!set.font_b.checked&&!set.stext.checked){

str=str.replace(/<([/]?)b>/ig,"[$1b]");

str=str.replace(/<([/]?)strong>/ig,"[$1b]");}

if(!set.font_u.checked&&!set.stext.checked)

str=str.replace(/<([/]?)u>/ig,"[$1u]");

if(!set.font_i.checked&&!set.stext.checked)

str=str.replace(/<([/]?)i>/ig,"[$1i]");

str=str.replace(//g,"");

str=str.replace(/&/g,"&");

str=str.replace(/"/g,""");

str=str.replace(/</g,"<");

str=str.replace(/>/g,">");

}

str=str.replace(/<br>/ig,"n");

str=str.replace(/<p[^>]*?>/ig,"nn");

str=str.replace(/<[^>]*?>/g,"");

str=str.replace(/[url=([^]]+)]n([img]1[/img])n[/url]/g,"$2");

str=str.replace(/n+/g,"n");

returnstr;

}

functioncopycode(obj){

obj.select();

objcopy=obj.createTextRange();

objcopy.execCommand("Copy");

}

functiontrans(){

varstr="";

rtf.focus();

rtf.document.body.innerHTML="";

rtf.document.execCommand("paste");

str=rtf.document.body.innerHTML;

if(str.length==0){

alert("剪贴版不存在超文本数据!");

return"";

}

returnhtml_trans(str);

}

functionpreview(){

varprewin=window.open("","","");

prewin.document.write(rtf.document.body.innerHTML);

}

functionzhen(str)

{

strfound=str.replace(//ig,"");

strfound=strfound.replace(/[/ig,"[");

strfound=strfound.replace(/]/ig,"]");

strfound=strfound.replace(/{/ig,"{");

strfound=strfound.replace(/}/ig,"}");

strfound=strfound.replace(/|/ig,"|");

strfound=strfound.replace(///ig,"/");

strfound=strfound.replace(/^/ig,"^");

strfound=strfound.replace(/./ig,".");

strfound=strfound.replace(/*/ig,"*");

strfound=strfound.replace(/?/ig,"?");

strfound=strfound.replace(/+/ig,"+");

returnstrfound;

}

functionreplace_star()

{

varstr=document.getElementById('text').value;

if(!reg.checked)

strfound=zhen(find_text.value);

else

strfound=find_text.value;

varre=newRegExp(strfound,"ig");

str=str.replace(re,replace_text.value);

document.getElementById('text').value=str;

}

</SCRIPT>

相关阅读
推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
  • 大家都在看
  • 小编推荐
  • 猜你喜欢
  • 最新Javascript教程学习
    热门Javascript教程学习
    编程开发子分类