版权是谁的不知道了!西西~
安装难度:相当简单
功能说明:发贴时自动将HTML代码转换为论坛通用UBB代码
修改文件:/templates/default/post_newthread.htm
1、查找:
--------------------------------------------------------------------------------
- <script language="JavaScript">
复制代码
在上面增加:
- <script language=JavaScript>
- <!--
- function SymError()
- {
- return true;
- }
- window.onerror = SymError;
- //-->
- </script>
- <script language=JavaScript1.2>
- function html_trans(str) {
- str = str.replace(/\r/g,"");
- str = str.replace(/on(load|click|dbclick|mouseover|mousedown|mouseup)="[^"]+"/ig,"");
- str = str.replace(/<script[^>]*?>([\w\W]*?)<\/script>/ig,"");
- str = str.replace(/<a[^>]+href="([^"]+)"[^>]*>(.*?)<\/a>/ig,"\n[url=$1]$2[/url]\n");
- str = str.replace(/<font[^>]+color=([^ >]+)[^>]*>(.*?)<\/font>/ig,"\n[color=$1]$2[/color]\n");
- str = str.replace(/<img[^>]+src="([^"]+)"[^>]*>/ig,"\n[img]$1[/img]\n\t\n");
- str = str.replace(/<([\/]?)b>/ig,"[$1b]");
- str = str.replace(/<([\/]?)strong>/ig,"[$1b]");
- str = str.replace(/<([\/]?)u>/ig,"[$1u]");
- 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(/<[^>]*?>/g,"");
- str = str.replace(/\[url=([^\]]+)\]\n(\[img\]\1\[\/img\])\n\[\/url\]\n\t\n+/g,"$2");
- str = str.replace(/\n+/g,"\n");
- return str;
- }
- function trans(){
- var str = "";
- rtf.focus();
- rtf.document.body.innerHTML = "";
- rtf.document.execCommand("paste");
- str = rtf.document.body.innerHTML;
- if(str.length == 0) {
- alert("剪切板内无数据!");
- return "";
- }
- return html_trans(str);
- }
- </script>
复制代码
2、查找:
- tabindex="4" onSelect="javascript: storeCaret(this)
复制代码
在前面增加:
- class=textarea id=atc_content onbeforepaste="if(document.getElementById('x_paste').checked){window.clipboardData.setData('atc_content',trans());this.focus();}" rows="1"
复制代码
3、查找:
在后面增加:
- <IFRAME id=rtf style="WIDTH: 0px; HEIGHT: 0px" marginWidth=0 marginHeight=0 src="about:blank" scrolling=no></IFRAME>
- <LABEL for=x_paste></LABEL><br>
- <input type='button' name='tietu' onClick="document.getElementById('atc_content').value += trans()" value=转换剪切板数据>
- <SCRIPT>
- rtf.document.designMode="On";
- </SCRIPT>
复制代码
已经把代码改成转图的时候自动空一行!!支持下吧!谢谢!
演示地址:http://bbs.woaibt.com
帐号密码test 请在新手区测试!谢谢合作!
[ 本帖最后由 fjch1986 于 2005-12-12 14:34 编辑 ] |