?? html2ubb.htm
字號:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>剪貼板超文本內容轉換為UBB代碼工具</title>
<script Language="JavaScript1.2" defer>
if (window.Event)
document.captureEvents(Event.MOUSEUP);
function nocontextmenu() {
event.cancelBubble = true
event.returnvalue = false;
return false;
}
function norightclick(e) {
if (window.Event) {
if (e.which == 2 || e.which == 3)
return false;
} else if (event.button == 2 || event.button == 3) {
event.cancelBubble = true
event.returnvalue = false;
return false;
}
}
document.oncontextmenu = nocontextmenu; // for IE5+
document.onmousedown = norightclick; // for all others
rtf.document.designMode="On";
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(/<style[^>]*?>([\w\W]*?)<\/stylet>/ig,"");
str = str.replace(/<embed[^>]*?>([\w\W]*?)<\/embed>/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(/<param NAME="Movie" value="([^>"]+\.swf)"[^>]*>/ig,"[flash]$1[/flash]");
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=([^\]]+)\](\[img\]\1\[\/img\])\[\/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);
}
function ExpSel(pic)
{
if (opener.document.yimxu.content.currPos) //如果對象obj存在屬性currPos
opener.document.yimxu.content.currPos.text=pic;
else
opener.document.yimxu.content.value+=pic;
}
</script>
</head>
<body style="font-size:12px" bgcolor=ThreedFace>
<textarea style="width:100%; height:290px" id="text" onbeforepaste="if(document.getElementById('x_paste').checked){window.clipboardData.setData('text',trans());this.focus();}"></textarea><br />
<iframe scrolling="no" id="rtf" src="about:blank" MARGINHEIGHT="0" MARGINWIDTH="0" style="width:0px; height:0px;"></iframe><br><img name="" src="" width="1" height="5" alt=""><br>
<input type="button" value="剪貼板超文本內容轉換為UBB代碼" onclick="document.getElementById('text').value += trans()"> <input type="button" value="確定" onclick="ExpSel(document.getElementById('text').value);window.close();opener.document.yimxu.content.focus();">
<input type="checkbox" id="x_paste"><label for="x_paste">粘貼時自動轉換剪貼板超文本內容為UBB代碼</label>
<br>
<br>
使用說明<br>
<br>
1.在別的網頁中選擇HTML內容,比如有鏈接,或者顏色的拷貝。將源代碼復制 <br>
2.點擊"粘貼時自動轉換剪貼板超文本內容為UBB代碼"按鈕,自動轉換 <br>
3.出來的就是論壇專用的 ubb 代碼了。某些情況下可能需要手動作些調整.<br>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -