脚本之家贴图转换+转贴工具用到的js代码超级推荐_javascript技巧
- WBOYOriginal
- 2016-05-16 19:15:49929Durchsuche
<script> <BR>function delnull() <BR>{ <BR> var str=document.getElementById('text').value; <BR> str=str.replace(/([\s]*\r\n[\s]*){2,}/gm,"\r\n"); <BR> document.getElementById('text').value=str; <BR>} <BR>function refix() <BR>{ <BR> var str=document.getElementById('text').value; <BR> str=str.replace(/([\s]*\r\n[\s]*){2,}/gm,"\r\n\r\n"); <BR> document.getElementById('text').value=str; <BR>} <BR>function url() <BR>{ <BR> var str=document.getElementById('text').value; <BR> str=str.replace(/^[ ]*(http:\/\/|^mms:\/\/|rtsp:\/\/|pnm:\/\/|ftp:\/\/|mmst:\/\/|mmsu:\/\/)([^\r\n]*)$/igm,"[url]$1$2[/url]"); <BR> document.getElementById('text').value=str; <BR>} <br><br>function addbr() <BR>{ <BR> var str=document.getElementById('text').value; <BR> str=str.replace(/\r\n/gm,"\r\n\r\n"); <BR> document.getElementById('text').value=str; <BR>} <br><br>function html_trans(str) { <BR> str = str.replace(/\r/g,""); <BR> str = str.replace(/on(load|click|dbclick|mouseover|mousedown|mouseup)="[^"]+"/ig,""); <BR> str = str.replace(/<script[^>]*?>([\w\W]*?)<\/script>/ig,""); <BR>if(set.fontbash.checked) <BR>{ <BR> str = str.replace(/<span[^>]*?display\s*?:\s*?none[^>]*?>([\w\W]*?)<\/span>/ig,""); <BR> str = str.replace(/<span[^>]*?font\s*?-\s*?size\s*?:\s*(0px|0pt)[^>]*?>([\w\W]*?)<\/span>/ig,""); <BR> str = str.replace(/<font([^>]+)(0px|0pt)+([^>]*)>([\w\W]*?)<\/font>/ig,""); <BR>} <br><br>if(set.filtrate.checked) <BR>{ <BR> str = str.replace(/[^<]*<([^>]*?)>[^<]*/ig,"<$1>"); <BR> tm=window.textfield.value; <BR> if(tm.length<1){ <BR> var arr; <BR> arr=str.match(/<img [^ alt="脚本之家贴图转换+转贴工具用到的js代码超级推荐_javascript技巧" >]+src=[" ]?([^"]+)[" ]?[^>]*>/ig); <BR> tm=arr[0].replace(/<img [^ alt="脚本之家贴图转换+转贴工具用到的js代码超级推荐_javascript技巧" >]+src=[" ]?([^"]+)[" ]?[^>]*>/ig,"$1")+"\""; <BR> i=tm.search(/\/[^\/]+"/ig); <BR> tm=tm.substr(0,i); <BR> window.textfield.value=tm+"/"; <BR> } <BR> if(tm.substr(tm.length-1,1)!="/") tm+="/"; <BR> var strtm="<img [^ alt="脚本之家贴图转换+转贴工具用到的js代码超级推荐_javascript技巧" >]+src=[\"]?("+tm+"[^\"]+)[\"]?[^>]*>"; <BR> var re = new RegExp(strtm,"ig"); <BR> str = str.replace(re,"\n[img]$1[/img]\n"); <BR>} <BR>else <BR>{ <BR> if(set.stext.checked) str = str.replace(/[^<]*<([^>]*?)>[^<]*/ig,"<$1>"); <br><br> if(!set.linka.checked) str = str.replace(/<a[^>]+href=[" ]?([^"]+)[" ]?[^>]*>(.*?)<\/a>/ig,"[url=$1]$2[/url]"); <BR> if(!set.font_color.checked&&!set.stext.checked) <BR> str = str.replace(/<font([^>]+)color=([^ >]+)([^>]*)>(.*?)<\/font>/ig,"[color=$2]<font$1$3>$4[/color]"); <BR> if(!set.font_size.checked&&!set.stext.checked) <BR> str = str.replace(/<font([^>]+)size=([^ >]+)([^>]*)>(.*?)<\/font>/ig,"[size=$2]<font$1$3>$4[/size]"); <BR> if(!set.font_face.checked&&!set.stext.checked) <BR> str = str.replace(/<font[^>]+face=([^ >]+)[^>]*>(.*?)<\/font>/ig,"[font=$1]$2[/font]"); <BR> if(!set.img.checked) str = str.replace(/<img [^ alt="脚本之家贴图转换+转贴工具用到的js代码超级推荐_javascript技巧" >]+src=[" ]?([^"]+)[" ]?[^>]*>/ig,"\n[img]$1[/img]\n"); <br><br> if(!set.odj.checked){ <BR> //return str; <BR> str = str.replace(/<object[^>]*?6BF52A52\-394A\-11d3\-B153\-00C04F79FAA6[^>]*?>.*<param[^>]+name\s*=\s*["](url|src)["][^>]+value=[" ]?([^"]+)[" ][^>]*>.*<\/object>/ig,"\n<div class="UBBPanel"><div class="UBBTitle"><img src="/skin/blue/images/mediaplayer.gif" alt="" style="max-width:90%" border="0"/>播放视频文件<div class="UBBContent"><a id="meiti13918_href" href="javascript:MediaShow('wmv','meiti13918','$2','500','300')"><img name="meiti13918_img" src="/skin/blue/images/mm_snd.gif" style="max-width:90%" border="0" alt=""/><span id="meiti13918_text">在线播放<div id="meiti13918">\n"); <BR> str = str.replace(/<object[^>]*?D27CDB6E\-AE6D\-11cf\-96B8\-444553540000[^>]*?>.*<param[^>]+name\s*=\s*["](url|src)["][^>]+value=[" ]?([^"]+)[" ][^>]*>.*<\/object>/ig,"\n<div class="UBBPanel"><div class="UBBTitle"><img src="/skin/blue/images/flash.gif" alt="" style="max-width:90%" border="0"/>Flash动画<div class="UBBContent"><a id="meiti5632_href" href="javascript:MediaShow('swf','meiti5632','$2','500','300')"><img name="meiti5632_img" src="/skin/blue/images/mm_snd.gif" style="max-width:90%" border="0" alt=""/><span id="meiti5632_text">在线播放<div id="meiti5632">\n"); <BR> str = str.replace(/<embed[^>]*type=["]?application\/x\-shockwave\-flash["]?[^>]*src=[" ]?([^"|^ ]+)[" ]?[^>]*>/ig,"\n<div class="UBBPanel"><div class="UBBTitle"><img src="/skin/blue/images/flash.gif" alt="" style="max-width:90%" border="0"/>Flash动画<div class="UBBContent"><a id="meiti83606_href" href="javascript:MediaShow('swf','meiti83606','$1','500','300')"><img name="meiti83606_img" src="/skin/blue/images/mm_snd.gif" style="max-width:90%" border="0" alt=""/><span id="meiti83606_text">在线播放<div id="meiti83606">\n"); <BR> str = str.replace(/<embed[^>]*src=["]?([^"|^ ]+)["]?[^>]*type=["]?application\/x\-shockwave\-flash["]?[^>]*>/ig,"\n<div class="UBBPanel"><div class="UBBTitle"><img src="/skin/blue/images/flash.gif" alt="" style="max-width:90%" border="0"/>Flash动画<div class="UBBContent"><a id="meiti83606_href" href="javascript:MediaShow('swf','meiti83606','$1','500','300')"><img name="meiti83606_img" src="/skin/blue/images/mm_snd.gif" style="max-width:90%" border="0" alt=""/><span id="meiti83606_text">在线播放<div id="meiti83606">\n"); <BR> str = str.replace(/<object[^>]*?CFCDAA03\-8BE4\-11cf\-B84B\-0020AFBBCCFA[^>]*?>.*<param[^>]+name\s*=\s*["](url|src)["][^>]+value=[" ]?([^"]+)[" ][^>]*>.*<\/object>/ig,"\n<div class="UBBPanel"><div class="UBBTitle"><img src="/skin/blue/images/realplayer.gif" alt="" style="max-width:90%" border="0"/>播放real视频流文件<div class="UBBContent"><a id="meiti4564_href" href="javascript:MediaShow('rm','meiti4564','$2','500','300')"><img name="meiti4564_img" src="/skin/blue/images/mm_snd.gif" style="max-width:90%" border="0" alt=""/><span id="meiti4564_text">在线播放<div id="meiti4564">\n"); <BR> } <BR> if(!set.font_b.checked&&!set.stext.checked){ <BR> str = str.replace(/<([\/]?)b>/ig,"[$1b]"); <BR> str = str.replace(/<([\/]?)strong>/ig,"[$1b]");} <BR> if(!set.font_u.checked&&!set.stext.checked) <BR> str = str.replace(/<([\/]?)u>/ig,"[$1u]"); <BR> if(!set.font_i.checked&&!set.stext.checked) <BR> str = str.replace(/<([\/]?)i>/ig,"[$1i]"); <br><br> str = str.replace(/ /g," "); <BR> str = str.replace(/&/g,"&"); <BR> str = str.replace(/"/g,"\""); <BR> str = str.replace(/,"<"); <BR> str = str.replace(/>/g,">"); <BR>} <BR> str = str.replace(/<br>/ig,"\n"); <BR> str = str.replace(/<p[^>]*?>/ig,"\n\n"); <BR> str = str.replace(/<[^>]*?>/g,""); <BR> str = str.replace(/\[url=([^\]]+)\]\n(\[img\]\1\[\/img\])\n\[\/url\]/g,"$2"); <BR> str = str.replace(/\n+/g,"\n"); <br><br> return str; <BR>} <BR>function copycode(obj){ <BR>obj.select(); <BR>objcopy=obj.createTextRange(); <BR>objcopy.execCommand("Copy"); <BR>} <BR>function trans(){ <BR> var str = ""; <BR> rtf.focus(); <BR> rtf.document.body.innerHTML = ""; <BR> rtf.document.execCommand("paste"); <BR> str = rtf.document.body.innerHTML; <BR> if(str.length == 0) { <BR> alert("剪贴版不存在超文本数据!"); <BR> return ""; <BR> } <BR> return html_trans(str); <BR>} <BR>function preview(){ <BR>var prewin=window.open("","",""); <BR>prewin.document.write(rtf.document.body.innerHTML); <BR>} <BR>function zhen(str) <BR>{ <BR> strfound=str.replace(/\\/ig,"\\\\"); <BR> strfound=strfound.replace(/\[/ig,"\\["); <BR> strfound=strfound.replace(/\]/ig,"\\]"); <BR> strfound=strfound.replace(/\{/ig,"\\{"); <BR> strfound=strfound.replace(/\}/ig,"\\}"); <BR> strfound=strfound.replace(/\|/ig,"\\|"); <BR> strfound=strfound.replace(/\//ig,"\\/"); <BR> strfound=strfound.replace(/\^/ig,"\\^"); <BR> strfound=strfound.replace(/\./ig,"\\."); <BR> strfound=strfound.replace(/\*/ig,"\\*"); <BR> strfound=strfound.replace(/\?/ig,"\\?"); <BR> strfound=strfound.replace(/\+/ig,"\\+"); <BR> return strfound; <BR>} <BR>function replace_star() <BR>{ <BR> var str=document.getElementById('text').value; <BR> if(!reg.checked) <BR> strfound=zhen(find_text.value); <BR> else <BR> strfound=find_text.value; <BR> var re = new RegExp(strfound,"ig"); <BR> str=str.replace(re,replace_text.value); <BR> document.getElementById('text').value=str; <BR>} <BR></script>
Stellungnahme:Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn