首先申明,本插件部分内容依据 子杨 兄FOR4.0而来,在此表示感谢!!
1.后台找到 post_bbinsert.htm模版
查找
下面加上
- <script>
- 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,"[url=$1]$2[/url]");
- str = str.replace(/<font[^>]+color=([^ >]+)[^>]*>(.*?)<\/font>/ig,"[color=$1]$2[/color]");
- str = str.replace(/<img[^>]+src="([^"]+)"[^>]*>/ig,"[img]$1[/img]");
- 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\]/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.实现发表新帖内容框的转贴按钮
后台找到post_newthread模版
查找
- <td align="left" class="altbg2"><span class="smalltxt">
- <textarea rows="18" name="message" style="width: 80%; word-break: break-all" tabindex="4" onSelect="javascript: storeCaret(this);" onClick="javascript: storeCaret(this);" onKeyUp="javascript: storeCaret(this);" onKeyDown="javascript: ctlent();">$message</textarea>
复制代码
下面添加
- <iframe scrolling="no" id="rtf" src="about:blank" MARGINHEIGHT="0" MARGINWIDTH="0" style="width:0px; height:0px;"></iframe>
- <LABEL for=x_paste></LABEL><br>
- <input type='button' name='tietu' onclick="document.getElementById('message').value += trans()" value=这里写上你想写的内容>
- <SCRIPT>
- rtf.document.designMode="On";
- </SCRIPT>
复制代码
3.实现发表回帖内容框的转贴按钮
后台找到post_newreply模版
查找
- <td class="altbg2"><span class="smalltxt">
- <textarea rows="18" name="message" style="width: 80%; word-break: break-all" tabindex="4" onSelect="javascript: storeCaret(this);" onClick="javascript: storeCaret(this);" onKeyUp="javascript: storeCaret(this);" onKeyDown="javascript: ctlent();">$message</textarea>
复制代码
下面加上
- <iframe scrolling="no" id="rtf" src="about:blank" MARGINHEIGHT="0" MARGINWIDTH="0" style="width:0px; height:0px;"></iframe>
- <LABEL for=x_paste></LABEL><br>
- <input type='button' name='tietu' onclick="document.getElementById('message').value += trans()" value=转换剪切板数据>
- <SCRIPT>
- rtf.document.designMode="On";
- </SCRIPT>
复制代码
4.实现快速发新帖内容框转帖按钮
后台找到forumdisplay.htm模版
查找
- <td width="82%" class="altbg2" valign="middle"><span class="smalltxt">
- <textarea rows="7" name="message" style="width: 80%; word-break: break-all" onKeyDown="ctlent(event);" tabindex="2"></textarea>
复制代码
下面加上
- <script>
- 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,"[url=$1]$2[/url]");
- str = str.replace(/<font[^>]+color=([^ >]+)[^>]*>(.*?)<\/font>/ig,"[color=$1]$2[/color]");
- str = str.replace(/<img[^>]+src="([^"]+)"[^>]*>/ig,"[img]$1[/img]");
- 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\]/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>
- <iframe scrolling="no" id="rtf" src="about:blank" MARGINHEIGHT="0" MARGINWIDTH="0" style="width:0px; height:0px;"></iframe>
- <LABEL for=x_paste></LABEL><br>
- <input type='button' name='tietu' onclick="document.getElementById('message').value += trans()" value=这里写你想写的内容>
- <SCRIPT>
- rtf.document.designMode="On";
- </SCRIPT>
复制代码
5.实现快速回复内容框转贴按钮
后台查找viewthread.htm模版
找到
- <td width="82%" class="altbg2"><span class="smalltxt">
- <textarea rows="7" name="message" style="width: 80%; word-break: break-all" onKeyDown="ctlent(event);" tabindex="2"></textarea>
复制代码
下面加上
- <script>
- 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,"[url=$1]$2[/url]");
- str = str.replace(/<font[^>]+color=([^ >]+)[^>]*>(.*?)<\/font>/ig,"[color=$1]$2[/color]");
- str = str.replace(/<img[^>]+src="([^"]+)"[^>]*>/ig,"[img]$1[/img]");
- 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\]/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>
- <iframe scrolling="no" id="rtf" src="about:blank" MARGINHEIGHT="0" MARGINWIDTH="0" style="width:0px; height:0px;"></iframe>
- <LABEL for=x_paste></LABEL><br>
- <input type='button' name='tietu' onclick="document.getElementById('message').value += trans()" value=这里写你想写的东西>
- <SCRIPT>
- rtf.document.designMode="On";
- </SCRIPT>
复制代码
这个插件还是很实用的 特别是对于那些娱乐性的站点需要转贴很多的话 用这个按钮来转图,速度很快
具体演示可以看 www.apple123.net下图
[ 本帖最后由 scropion~ 于 2006-3-12 23:48 编辑 ] |