-- 此文原作者 rugbyho --
此外掛中文化適用於版本BBCode Box 5.1.0c
(希望版大可以幫忙整合至
http://phpbb-tw.net/phpbb/viewtopic.php?t=48560,因為不能回復所以在此另外發佈中文化)
原外掛連結:
http://phpbb-tw.net/phpbb/viewtopic.php?t=48560
舊版BBcode Box v5.0.0 中文化為hjkwe654發布(已不適用於新版BBCode Box 5.1.0c,但網友也可依照hjkwe654的翻譯做修改)
舊版外掛參考連結:
mods\bbcode_box\bbcode_box.js
http://phpbb-tw.net/phpbb/viewtopic.php?t=39684
templates\subSilver\posting_body.tpl
http://phpbb-tw.net/phpbb/viewtopic.php?t=39686
新版外掛:(此外掛中文化於hjkwe654所翻譯的外掛有所出入;本外掛翻譯本人是依據
Office Word 2003和FCKeditor所做的翻譯,應該算滿官方的寫法,比叫容易理解)
mods\bbcode_box\bbcode_box.js (此篇可直接複製全文再覆蓋掉bbcode_box.js內全部)
代碼: 選擇全部
var theSelection = false;
var clientPC = navigator.userAgent.toLowerCase(); // Get client info
var clientVer = parseInt(navigator.appVersion); // Get browser version
var is_ie = ((clientPC.indexOf("msie") != -1) && (clientPC.indexOf("opera") == -1));
var is_nav = ((clientPC.indexOf('mozilla')!=-1) && (clientPC.indexOf('spoofer')==-1)
&& (clientPC.indexOf('compatible') == -1) && (clientPC.indexOf('opera')==-1)
&& (clientPC.indexOf('webtv')==-1) && (clientPC.indexOf('hotjava')==-1));
var is_moz = 0;
var is_win = ((clientPC.indexOf("win")!=-1) || (clientPC.indexOf("16bit") != -1));
var is_mac = (clientPC.indexOf("mac")!=-1);
var baseHeight = 0;
b_help = "粗體: [b]text[/b]";
i_help = "斜體: [i]text[/i]";
u_help = "底線: [u]text[/u]";
quote_help = "引言: [quote]text[/quote]";
code_help = "程式代碼: [code]code
";
spoil_help = "隱藏文字: [spoil]text[/spoil]";
img_help = "插入圖片: [img]
http://image path[/img]";
url_help = "插入超連結:
http://www.tactic.be or
Freddies site";
fc_help = "字型顏色:
text You can use HTML color=#FF0000";
fs_help = "字型大小:
Small Text";
ft_help = "字體: [font=Tahoma]text[/font]";
rtl_help = "從右到左閱讀";
ltr_help = "從右到左閱讀";
mail_help = "電子郵件:
forum@hvmdesign.com";
grad_help=="插入彩虹文字 (只能用於 Internet Explorer)";
right_help="置右靠齊: [align=right]text[/align]";
left_help="置左靠齊: [align=left]text[/align]";
center_help="置中靠齊: [align=center]text[/align]";
justify_help="左右對齊: [align=justify]text[/align]";
marqr_help="跑馬燈文字由左至右Marque text to Right: [marq=right]text[/marq]";
marql_help="跑馬燈文字由右至左Marque text to Left: [marq=left]text[/marq]";
marqu_help="跑馬燈文字由下至上Marque text to up: [marq=up]text[/marq]";
marqd_help="跑馬燈文字由上至下Marque text to down: [marq=down]text[/marq]";
stream_help="插入音效: [stream]File URL[/stream]";
plain_help="移除所有的BBcode代碼";
hr_help="Insert Line Break [hr]";
video_help="插入影片: [video width=# height=#]file URL[/video]";
flash_help="插入flash影片: [flash width=# height=#]flash URL[/flash]";
fade_help = "漸層文字: [fade]text[/fade] (Internet Explorer Only)";
list_help = "製作列表: [list|=1|a]text[/list] Tip: you can use [*] to insert bullet";
strike_help = "Strike text:
text";
sup_help = "下標: [sup]text[/sup]";
sub_help = "上標: [sub]text[/sub]";
symbol_help = "Insert Symbol Into Post";
youtube_help = "插入youtube影片";
googlevid_help = "插入google影片";
var Quote = 0;
var Bold = 0;
var Italic = 0;
var Underline = 0;
var Code = 0;
var flash = 0;
var fc = 0;
var fs = 0;
var ft = 0;
var center = 0;
var right = 0;
var left = 0;
var justify = 0;
var fade = 0;
var marqd = 0;
var marqu = 0;
var marql = 0;
var marqr = 0;
var mail = 0;
var video = 0;
var stream = 0;
var hr = 0;
var grad = 0;
var plain = 0;
var List = 0;
var Strikeout = 0;
var Spoiler = 0;
var superscript = 0;
var subscript = 0;
var symbol = 0;
var youtube = 0;
var GVideo = 0;
// Fix a bug involving the TextRange object in IE. From
//
http://www.frostjedi.com/terra/scripts/ ... etBug.html
// (script by TerraFrost modified by reddog)
function initInsertions() {
document.post.message.focus();
if (is_ie && typeof(baseHeight) != 'number') baseHeight = document.selection.createRange().duplicate().boundingHeight;
}
function BBCplain() {
theSelection = document.selection.createRange().text;
if (theSelection != '') {
temp = theSelection;
temp = temp.replace(/\[FLASH=([^\]]*)\]WIDTH=[0-9]{0,4} HEIGHT=[0-9]{0,4}\[\/FLASH\]/gi,"$1");
temp = temp.replace(/\[VIDEO=([^\]]*)\]WIDTH=[0-9]{0,4} HEIGHT=[0-9]{0,4}\[\/VIDEO\]/gi,"$1");
document.selection.createRange().text = temp.replace(/\[[^\]]*\]/gi,"");
}
}
function BBCgrad() {
var oSelect,oSelectRange;
document.post.message.focus();
oSelect = document.selection;
oSelectRange = oSelect.createRange();
if (oSelectRange.text.length < 1) { alert("請輸入文字內容");
return;
}
if (oSelectRange.text.length > 120) {
alert("最多為120個字元");
return;
}
showModalDialog("mods/bbcode_box/grad.htm",oSelectRange,"help:no; center:yes; status:no; dialogHeight:50px; dialogWidth:50px");
}
function BBChr() {
ToAdd = "[hr]";
PostWrite(ToAdd);
}
function BBCstream() {
var FoundErrors = '';
var enterURL = prompt("輸入音效連接","http://");
if (!enterURL) {
FoundErrors += "你必須輸入音效連接";
}
if (FoundErrors) {
alert("Error:"+FoundErrors);
return;
}
var ToAdd = "[stream]"+enterURL+"[/stream]";
PostWrite(ToAdd);
}
function BBCvideo() {
var FoundErrors = '';
var enterURL = prompt("請輸入影片檔連結", "http://");
if (!enterURL) {
FoundErrors += "你必須輸入影片檔連結.";
}
var enterW = prompt("請輸入影片寬度", "400");
if (!enterW) {
FoundErrors += "你必須輸入影片寬度";
}
var enterH = prompt("請輸入影片高度", "350");
if (!enterH) {
FoundErrors += "你必須輸入影片高度";
}
if (FoundErrors) {
alert("Error:"+FoundErrors);
return;
}
var ToAdd = "[video width="+enterW+" height="+enterH+"]"+enterURL+"[/video]";
PostWrite(ToAdd);
}
function BBCmail() {
var FoundErrors = '';
var entermail = prompt("請輸入電子郵件地址","");
if (!entermail) {
FoundErrors += "你必須輸入電子郵件地址";
}
if (FoundErrors) {
alert("Error:"+FoundErrors);
return;
}
var ToAdd = "[email]"+entermail+"[/email]";
PostWrite(ToAdd);
}
function BBCstrike() {
var txtarea = document.post.message;
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (theSelection != '') {
document.selection.createRange().text = "
" + theSelection + "";
document.post.message.focus();
return;
}
}
else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
{
mozWrap(txtarea, "
", "");
return;
}
if (Strikeout == 0) {
ToAdd = "
";
document.strik.src = "mods/bbcode_box/images/strike1.gif";
Strikeout = 1;
} else {
ToAdd = "";
document.strik.src = "mods/bbcode_box/images/strike.gif";
Strikeout = 0;
}
PostWrite(ToAdd);
}
function BBCspoil() {
var txtarea = document.post.message;
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (theSelection != '') {
document.selection.createRange().text = "[spoil]" + theSelection + "[/spoil]";
document.post.message.focus();
return;
}
}
else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
{
mozWrap(txtarea, "[spoil]", "[/spoil]");
return;
}
if (Spoiler == 0) {
ToAdd = "[spoil]";
document.spoil.src = "mods/bbcode_box/images/spoil1.gif";
Spoiler = 1;
} else {
ToAdd = "[/spoil]";
document.spoil.src = "mods/bbcode_box/images/spoil.gif";
Spoiler = 0;
}
PostWrite(ToAdd);
}
function BBCmarqu() {
var txtarea = document.post.message;
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (theSelection != '') {
document.selection.createRange().text = "[marq=up]" + theSelection + "[/marq]";
document.post.message.focus();
return;
}
}
else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
{
mozWrap(txtarea, "[marq=up]", "[/marq]");
return;
}
if (marqu == 0) {
ToAdd = "[marq=up]";
document.post.marqu.src = "mods/bbcode_box/images/marqu1.gif";
marqu = 1;
} else {
ToAdd = "[/marq]";
document.post.marqu.src = "mods/bbcode_box/images/marqu.gif";
marqu = 0;
}
PostWrite(ToAdd);
}
function BBCmarql() {
var txtarea = document.post.message;
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (theSelection != '') {
document.selection.createRange().text = "[marq=left]" + theSelection + "[/marq]";
document.post.message.focus();
return;
}
}
else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
{
mozWrap(txtarea, "[marq=left]", "[/marq]");
return;
}
if (marql == 0) {
ToAdd = "[marq=left]";
document.post.marql.src = "mods/bbcode_box/images/marql1.gif";
marql = 1;
} else {
ToAdd = "[/marq]";
document.post.marql.src = "mods/bbcode_box/images/marql.gif";
marql = 0;
}
PostWrite(ToAdd);
}
function BBCmarqr() {
var txtarea = document.post.message;
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (theSelection != '') {
document.selection.createRange().text = "[marq=right]" + theSelection + "[/marq]";
document.post.message.focus();
return;
}
}
else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
{
mozWrap(txtarea, "[marq=right]", "[/marq]");
return;
}
if (marqr == 0) {
ToAdd = "[marq=right]";
document.post.marqr.src = "mods/bbcode_box/images/marqr1.gif";
marqr = 1;
} else {
ToAdd = "[/marq]";
document.post.marqr.src = "mods/bbcode_box/images/marqr.gif";
marqr = 0;
}
PostWrite(ToAdd);
}
function BBCdir(dirc) {
document.post.message.dir=(dirc);
}
function BBCfade() {
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (theSelection != '') {
document.selection.createRange().text = "[fade]" + theSelection + "[/fade]";
document.post.message.focus();
return;
}
}
if (fade == 0) {
ToAdd = "[fade]";
document.post.fade.src = "mods/bbcode_box/images/fade1.gif";
fade = 1;
} else {
ToAdd = "[/fade]";
document.post.fade.src = "mods/bbcode_box/images/fade.gif";
fade = 0;
}
PostWrite(ToAdd);
}
function BBCjustify() {
var txtarea = document.post.message;
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (theSelection != '') {
document.selection.createRange().text = "[align=justify]" + theSelection + "[/align]";
document.post.message.focus();
return;
}
}
else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
{
mozWrap(txtarea, "[align=justify]", "[/align]");
return;
}
if (justify == 0) {
ToAdd = "[align=justify]";
document.post.justify.src = "mods/bbcode_box/images/justify1.gif";
justify = 1;
} else {
ToAdd = "[/align]";
document.post.justify.src = "mods/bbcode_box/images/justify.gif";
justify = 0;
}
PostWrite(ToAdd);
}
function BBCleft() {
var txtarea = document.post.message;
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (theSelection != '') {
document.selection.createRange().text = "[align=left]" + theSelection + "[/align]";
document.post.message.focus();
return;
}
}
else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
{
mozWrap(txtarea, "[align=left]", "[/align]");
return;
}
if (left == 0) {
ToAdd = "[align=left]";
document.post.left.src = "mods/bbcode_box/images/left1.gif";
left = 1;
} else {
ToAdd = "[/align]";
document.post.left.src = "mods/bbcode_box/images/left.gif";
left = 0;
}
PostWrite(ToAdd);
}
function BBCright() {
var txtarea = document.post.message;
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (theSelection != '') {
document.selection.createRange().text = "[align=right]" + theSelection + "[/align]";
document.post.message.focus();
return;
}
}
else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
{
mozWrap(txtarea, "[align=right]", "[/align]");
return;
}
if (right == 0) {
ToAdd = "[align=right]";
document.post.right.src = "mods/bbcode_box/images/right1.gif";
right = 1;
} else {
ToAdd = "[/align]";
document.post.right.src = "mods/bbcode_box/images/right.gif";
right = 0;
}
PostWrite(ToAdd);
}
function BBCcenter() {
var txtarea = document.post.message;
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (theSelection != '') {
document.selection.createRange().text = "[align=center]" + theSelection + "[/align]";
document.post.message.focus();
return;
}
}
else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
{
mozWrap(txtarea, "[align=center]", "[/align]");
return;
}
if (center == 0) {
ToAdd = "[align=center]";
document.post.center.src = "mods/bbcode_box/images/center1.gif";
center = 1;
} else {
ToAdd = "[/align]";
document.post.center.src = "mods/bbcode_box/images/center.gif";
center = 0;
}
PostWrite(ToAdd);
}
function BBCft() {
var txtarea = document.post.message;
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (theSelection != '') {
document.selection.createRange().text = "[font="+document.post.ft.value+"]" + theSelection + "[/font]";
document.post.message.focus();
return;
}
}
else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
{
mozWrap(txtarea, "[font="+document.post.ft.value+"]", "[/font]");
return;
}
ToAdd = "[font="+document.post.ft.value+"]"+" "+"[/font]";
PostWrite(ToAdd);
}
function BBCfs() {
var txtarea = document.post.message;
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (theSelection != '') {
document.selection.createRange().text = "[size="+document.post.fs.value+"]" + theSelection + "[/size]";
document.post.message.focus();
return;
}
}
else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
{
mozWrap(txtarea, "[size="+document.post.fs.value+"]", "[/size]");
return;
}
ToAdd = "[size="+document.post.fs.value+"]"+" "+"[/size]";
PostWrite(ToAdd);
}
function BBCfc() {
var txtarea = document.post.message;
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (theSelection != '') {
document.selection.createRange().text = "[color="+document.post.fc.value+"]" + theSelection + "[/color]";
document.post.message.focus();
return;
}
}
else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
{
mozWrap(txtarea, "[color="+document.post.fc.value+"]", "[/color]");
return;
}
ToAdd = "[color="+document.post.fc.value+"]"+" "+"[/color]";
PostWrite(ToAdd);
}
function BBCmarqd() {
var txtarea = document.post.message;
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (theSelection != '') {
document.selection.createRange().text = "[marq=down]" + theSelection + "[/marq]";
document.post.message.focus();
return;
}
}
else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
{
mozWrap(txtarea, "[marq=down]", "[/marq]");
return;
}
if (marqd == 0) {
ToAdd = "[marq=down]";
document.post.marqd.src = "mods/bbcode_box/images/marqd1.gif";
marqd = 1;
} else {
ToAdd = "[/marq]";
document.post.marqd.src = "mods/bbcode_box/images/marqd.gif";
marqd = 0;
}
PostWrite(ToAdd);
}
function BBCflash() {
var FoundErrors = '';
var enterURL = prompt("請輸入flash影片連結", "http://");
if (!enterURL) {
FoundErrors += "你必須輸入flash影片連結";
}
var enterW = prompt("請輸入flash影片寬度", "250");
if (!enterW) {
FoundErrors += "你必須輸入flash影片寬度";
}
var enterH = prompt("請輸入flash影片高度", "250");
if (!enterH) {
FoundErrors += "你必須輸入flash影片高度";
}
if (FoundErrors) {
alert("Error:"+FoundErrors);
return;
}
var ToAdd = "[flash width="+enterW+" height="+enterH+"]"+enterURL+"[/flash]";
PostWrite(ToAdd);
}
function BBCGVideo() {
var FoundErrors = '';
var enterURL = prompt("請輸入影片連結", "http://");
if (!enterURL) {
FoundErrors += "你必須輸入影片連結";
}
if (FoundErrors) {
alert("Error:"+FoundErrors);
return;
}
var ToAdd = "[GVideo]"+enterURL+"[/GVideo]";
PostWrite(ToAdd);
}
function BBCyoutube() {
var FoundErrors = '';
var enterURL = prompt("請輸入影片連結", "http://");
if (!enterURL) {
FoundErrors += "你必須輸入影片連結";
}
if (FoundErrors) {
alert("Error:"+FoundErrors);
return;
}
var ToAdd = "[youtube]"+enterURL+"[/youtube]";
PostWrite(ToAdd);
}
function helpline(help) {
document.post.helpbox.value = eval(help + "_help");
document.post.helpbox.readOnly = "true";
}
function checkForm() {
formErrors = false;
if (document.post.message.value.length < 2) {
formErrors = "訊息欄不可為空";
}
if (formErrors) {
alert(formErrors);
return false;
} else {
//formObj.preview.disabled = true;
//formObj.submit.disabled = true;
return true;
}
}
function emoticon(text) {
var txtarea = document.post.message;
text = ' ' + text + ' ';
if (txtarea.createTextRange && txtarea.caretPos) {
if (baseHeight != txtarea.caretPos.boundingHeight) {
txtarea.focus();
storeCaret(txtarea);
}
var caretPos = txtarea.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
txtarea.focus();
} else
if (txtarea.selectionEnd && (txtarea.selectionStart | txtarea.selectionStart == 0))
{
mozWrap(txtarea, text, "");
return;
} else {
txtarea.value += text;
txtarea.focus();
}
}
function bbfontstyle(bbopen, bbclose) {
var txtarea = document.post.message;
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (!theSelection) {
txtarea.value += bbopen + bbclose;
txtarea.focus();
return;
}
document.selection.createRange().text = bbopen + theSelection + bbclose;
txtarea.focus();
return;
}
else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
{
mozWrap(txtarea, bbopen, bbclose);
return;
}
else
{
txtarea.value += bbopen + bbclose;
txtarea.focus();
}
storeCaret(txtarea);
}
function storeCaret(textEl) {
if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}
function PostWrite(text) {
if (document.post.message.createTextRange && document.post.message.caretPos) {
var caretPos = document.post.message.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
}
else document.post.message.value += text;
document.post.message.focus(caretPos)
}
function BBCsup() {
var txtarea = document.post.message;
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (theSelection != '') {
document.selection.createRange().text = "[sup]" + theSelection + "[/sup]";
document.post.message.focus();
return;
}
}
else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
{
mozWrap(txtarea, "[sup]", "[/sup]");
return;
}
if (superscript == 0) {
ToAdd = "[sup]";
document.supscript.src = "mods/bbcode_box/images/sup1.gif";
superscript = 1;
} else {
ToAdd = "[/sup]";
document.supscript.src = "mods/bbcode_box/images/sup.gif";
superscript = 0;
}
PostWrite(ToAdd);
}
function BBCsub() {
var txtarea = document.post.message;
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (theSelection != '') {
document.selection.createRange().text = "[sub]" + theSelection + "[/sub]";
document.post.message.focus();
return;
}
}
else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
{
mozWrap(txtarea, "[sub]", "[/sub]");
return;
}
if (subscript == 0) {
ToAdd = "[sub]";
document.subs.src = "mods/bbcode_box/images/sub1.gif";
subscript = 1;
} else {
ToAdd = "[/sub]";
document.subs.src = "mods/bbcode_box/images/sub.gif";
subscript = 0;
}
PostWrite(ToAdd);
}
function BBCcode() {
var txtarea = document.post.message;
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (theSelection != '') {
document.selection.createRange().text = "
代碼: 選擇全部
" + theSelection + "
";
document.post.message.focus();
return;
}
}
else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
{
mozWrap(txtarea, "
");
return;
}
if (Code == 0) {
ToAdd = "
代碼: 選擇全部
";
document.post.code.src = "mods/bbcode_box/images/code1.gif";
Code = 1;
} else {
ToAdd = "
";
document.post.code.src = "mods/bbcode_box/images/code.gif";
Code = 0;
}
PostWrite(ToAdd);
}
function BBCquote() {
var txtarea = document.post.message;
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (theSelection != '') {
document.selection.createRange().text = "[quote]" + theSelection + "[/quote]";
document.post.message.focus();
return;
}
}
else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
{
mozWrap(txtarea, "[quote]", "[/quote]");
return;
}
if (Quote == 0) {
ToAdd = "[quote]";
document.post.quote.src = "mods/bbcode_box/images/quote1.gif";
Quote = 1;
} else {
ToAdd = "[/quote]";
document.post.quote.src = "mods/bbcode_box/images/quote.gif";
Quote = 0;
}
PostWrite(ToAdd);
}
function BBClist() {
var txtarea = document.post.message;
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (theSelection != '') {
document.selection.createRange().text = "
";
document.post.message.focus();
return;
}
}
else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
{
mozWrap(txtarea, "
");
return;
}
if (List == 0) {
ToAdd = "
- ";
document.listdf.src = "mods/bbcode_box/images/list1.gif";
List = 1;
} else {
ToAdd = "
";
document.listdf.src = "mods/bbcode_box/images/list.gif";
List = 0;
}
PostWrite(ToAdd);
}
function BBCbold() {
var txtarea = document.post.message;
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (theSelection != '') {
document.selection.createRange().text = "
" + theSelection + "";
document.post.message.focus();
return;
}
}
else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
{
mozWrap(txtarea, "
", "");
return;
}
if (Bold == 0) {
ToAdd = "
";
document.post.bold.src = "mods/bbcode_box/images/bold1.gif";
Bold = 1;
} else {
ToAdd = "";
document.post.bold.src = "mods/bbcode_box/images/bold.gif";
Bold = 0;
}
PostWrite(ToAdd);
}
function BBCitalic() {
var txtarea = document.post.message;
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (theSelection != '') {
document.selection.createRange().text = "
" + theSelection + "";
document.post.message.focus();
return;
}
}
else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
{
mozWrap(txtarea, "
", "");
return;
}
if (Italic == 0) {
ToAdd = "
";
document.post.italic.src = "mods/bbcode_box/images/italic1.gif";
Italic = 1;
} else {
ToAdd = "";
document.post.italic.src = "mods/bbcode_box/images/italic.gif";
Italic = 0;
}
PostWrite(ToAdd);
}
function BBCunder() {
var txtarea = document.post.message;
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (theSelection != '') {
document.selection.createRange().text = "
" + theSelection + "";
document.post.message.focus();
return;
}
}
else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
{
mozWrap(txtarea, "
", "");
return;
}
if (Underline == 0) {
ToAdd = "
";
document.post.under.src = "mods/bbcode_box/images/under1.gif";
Underline = 1;
} else {
ToAdd = "";
document.post.under.src = "mods/bbcode_box/images/under.gif";
Underline = 0;
}
PostWrite(ToAdd);
}
function BBCurl() {
var FoundErrors = '';
var enterURL = prompt("請輸入超連結網址", "http://");
var enterTITLE = prompt("輸入超連結名稱", "網頁名稱");
if (!enterURL) {
FoundErrors += "你必須輸入超連結網址";
}
if (!enterTITLE) {
FoundErrors += "你必須輸入超連結名稱";
}
if (FoundErrors) {
alert("Error:"+FoundErrors);
return;
}
var ToAdd = "
"+enterTITLE+"";
PostWrite(ToAdd);
}
function BBCimg() {
var FoundErrors = '';
var enterURL = prompt("請輸入圖片連結","http://");
if (!enterURL) {
FoundErrors += "你必須輸入圖片連結";
}
if (FoundErrors) {
alert("Error :"+FoundErrors);
return;
}
var ToAdd = "[img]"+enterURL+"[/img]";
document.post.message.value+=ToAdd;
document.post.message.focus();
}
function storeCaret(textEl) {
if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}
function mozWrap(txtarea, open, close)
{
var selLength = txtarea.textLength;
var selStart = txtarea.selectionStart;
var selEnd = txtarea.selectionEnd;
if (selEnd == 1 || selEnd == 2)
selEnd = selLength;
var s1 = (txtarea.value).substring(0,selStart);
var s2 = (txtarea.value).substring(selStart, selEnd)
var s3 = (txtarea.value).substring(selEnd, selLength);
txtarea.value = s1 + open + s2 + close + s3;
return;
}[/code]
posting_body.tpl 修改如下:
templates\subSilver\posting_body.tpl
#
#-----[ FIND ]------------------------------------------------------
#
代碼: 選擇全部
<td background="mods/bbcode_box/images/bg.gif" valign="middle"><img src="mods/bbcode_box/images/dots.gif" style="padding-left: 4px;"></td>
<td background="mods/bbcode_box/images/bg.gif" valign="middle">
<img border="0" src="mods/bbcode_box/images/justify.gif" class="postimage" name="justify" type="image" onClick="BBCjustify()" onMouseOver="helpline('justify')" style="border-style: outset; border-width: 1" alt="justify"><img border="0" src="mods/bbcode_box/images/right.gif" name="right" type="image" onClick="BBCright()" onMouseOver="helpline('right')" class="postimage" alt="right"><img border="0" src="mods/bbcode_box/images/center.gif" name="center" type="image" onClick="BBCcenter()" onMouseOver="helpline('center')" class="postimage" alt="center"><img border="0" src="mods/bbcode_box/images/left.gif" name="left" type="image" onClick="BBCleft()" onMouseOver="helpline('left')" class="postimage" alt="left"><img style="padding-left: 5px; padding-right: 5px;" src="mods/bbcode_box/images/blackdot.gif" width="1" height="100%" border="0" alt=""><img border="0" src="mods/bbcode_box/images/sup.gif" class="postimage" name="supscript" type="image" onClick="BBCsup()" onMouseOver="helpline('sup')" alt="" /><img border="0" src="mods/bbcode_box/images/sub.gif" name="subs" class="postimage" type="image" onClick="BBCsub()" onMouseOver="helpline('sub')" alt="" /><img style="padding-left: 5px; padding-right: 5px;" src="mods/bbcode_box/images/blackdot.gif" width="1" height="100%" border="0" alt=""><img border="0" src="mods/bbcode_box/images/bold.gif" name="bold" type="image" onClick="BBCbold()" onMouseOver="helpline('b')" class="postimage" alt="bold"><img border="0" src="mods/bbcode_box/images/italic.gif" name="italic" type="image" onClick="BBCitalic()" onMouseOver="helpline('i')" class="postimage" alt="italic"><img border="0" src="mods/bbcode_box/images/under.gif" name="under" type="image" onClick="BBCunder()" onMouseOver="helpline('u')" class="postimage" alt="under line"><img border="0" src="mods/bbcode_box/images/strike.gif" class="postimage" name="strik" type="image" onClick="BBCstrike()" onMouseOver="helpline('strike')" alt="" /><img style="padding-left: 5px; padding-right: 5px;" src="mods/bbcode_box/images/blackdot.gif" width="1" height="100%" border="0" alt=""><img border="0" src="mods/bbcode_box/images/fade.gif" name="fade" type="image" onClick="BBCfade()" onMouseOver="helpline('fade')" class="postimage" alt="fade"><img border="0" src="mods/bbcode_box/images/grad.gif" name="grad" type="image" onClick="BBCgrad()" onMouseOver="helpline('grad')" class="postimage" alt="gradient"><img style="padding-left: 5px; padding-right: 5px;" src="mods/bbcode_box/images/blackdot.gif" width="1" height="100%" border="0" alt=""><img border="0" src="mods/bbcode_box/images/rtl.gif" name="dirrtl" type="image" onClick="BBCdir('rtl')" onMouseOver="helpline('rtl')" class="postimage" alt="Right to Left"><img border="0" src="mods/bbcode_box/images/ltr.gif" name="dirltr" type="image" onClick="BBCdir('ltr')" onMouseOver="helpline('ltr')" class="postimage" alt="Left to Right"><img style="padding-left: 5px; padding-right: 5px;" src="mods/bbcode_box/images/blackdot.gif" width="1" height="100%" border="0" alt=""><img border="0" src="mods/bbcode_box/images/marqd.gif" name="marqd" type="image" onClick="BBCmarqd()" onMouseOver="helpline('marqd')" class="postimage" alt="Marque to down"><img border="0" src="mods/bbcode_box/images/marqu.gif" name="marqu" type="image" onClick="BBCmarqu()" onMouseOver="helpline('marqu')" class="postimage" alt="Marque to up"><img border="0" src="mods/bbcode_box/images/marql.gif" name="marql" type="image" onClick="BBCmarql()" onMouseOver="helpline('marql')" class="postimage" alt="Marque to left"><img border="0" src="mods/bbcode_box/images/marqr.gif" name="marqr" type="image" onClick="BBCmarqr()" onMouseOver="helpline('marqr')" class="postimage" alt="Marque to right">
</td>
</tr>
<tr height="28">
<td background="mods/bbcode_box/images/bg.gif" valign="middle"><img src="mods/bbcode_box/images/dots.gif" style="padding-left: 4px;"></td>
<td background="mods/bbcode_box/images/bg.gif" valign="middle">
<img border="0" src="mods/bbcode_box/images/code.gif" name="code" type="image" onClick="BBCcode()" onMouseOver="helpline('code')" class="postimage" alt="Code"><img border="0" src="mods/bbcode_box/images/quote.gif" name="quote" type="image" onClick="BBCquote()" onMouseOver="helpline('quote')" class="postimage" alt="Quote"><img border="0" src="mods/bbcode_box/images/spoil.gif" class="postimage" name="spoil" type="image" onClick="BBCspoil()" onMouseOver="helpline('spoil')" alt="" /><img style="padding-left: 5px; padding-right: 5px;" src="mods/bbcode_box/images/blackdot.gif" width="1" height="100%" border="0" alt=""><img border="0" src="mods/bbcode_box/images/url.gif" name="url" type="image" onClick="BBCurl()" onMouseOver="helpline('url')" class="postimage" alt="URL"><img border="0" src="mods/bbcode_box/images/email.gif" name="email" type="image" onClick="BBCmail()" onMouseOver="helpline('mail')" class="postimage" alt="Email"><img style="padding-left: 5px; padding-right: 5px;" src="mods/bbcode_box/images/blackdot.gif" width="1" height="20" border="0" alt=""><img border="0" src="mods/bbcode_box/images/img.gif" name="img" type="image" onClick="BBCimg()" onMouseOver="helpline('img')" class="postimage" alt="Image"><img border="0" src="mods/bbcode_box/images/flash.gif" name="flash" type="image" onClick="BBCflash()" onMouseOver="helpline('flash')" class="postimage" alt="Flash"><img border="0" src="mods/bbcode_box/images/video.gif" name="video" type="image" onClick="BBCvideo()" onMouseOver="helpline('video')" class="postimage" alt="Video"><img border="0" src="mods/bbcode_box/images/sound.gif" name="stream" type="image" onClick="BBCstream()" onMouseOver="helpline('stream')" class="postimage" alt="Stream"><img border="0" src="mods/bbcode_box/images/googlevid.gif" name="GVideo" type="image" onClick="BBCGVideo()" onMouseOver="helpline('googlevid')" class="postimage" alt="GoogleVid"><img border="0" src="mods/bbcode_box/images/youtube.gif" name="youtube" type="image" onClick="BBCyoutube()" onMouseOver="helpline('youtube')" class="postimage" alt="Youtube"><img style="padding-left: 5px; padding-right: 5px;" src="mods/bbcode_box/images/blackdot.gif" width="1" height="100%" border="0" alt=""><img border="0" src="mods/bbcode_box/images/list.gif" name="listdf" type="image" onClick="BBClist()" onMouseOver="helpline('list')" class="postimage" alt="List" /><img border="0" src="mods/bbcode_box/images/hr.gif" name="hr" type="image" onClick="BBChr()" onMouseOver="helpline('hr')" class="postimage" alt="H-Line"><img style="padding-left: 5px; padding-right: 5px;" src="mods/bbcode_box/images/blackdot.gif" width="1" height="100%" border="0" alt=""><img border="0" src="mods/bbcode_box/images/plain.gif" name="plain" type="image" onClick="BBCplain()" onMouseOver="helpline('plain')" class="postimage" alt="Remove BBcode">
</td>
#
#-----[ REPLACE WITH ]-------------------------------------------
#
代碼: 選擇全部
<td background="mods/bbcode_box/images/bg.gif" valign="middle"><img src="mods/bbcode_box/images/dots.gif" style="padding-left: 4px;"></td>
<td background="mods/bbcode_box/images/bg.gif" valign="middle">
<img border="0" src="mods/bbcode_box/images/justify.gif" class="postimage" name="justify" type="image" onClick="BBCjustify()" onMouseOver="helpline('justify')" style="border-style: outset; border-width: 1" alt="左右對齊"><img border="0" src="mods/bbcode_box/images/right.gif" name="right" type="image" onClick="BBCright()" onMouseOver="helpline('right')" class="postimage" alt="置右靠齊"><img border="0" src="mods/bbcode_box/images/center.gif" name="center" type="image" onClick="BBCcenter()" onMouseOver="helpline('center')" class="postimage" alt="置中對齊"><img border="0" src="mods/bbcode_box/images/left.gif" name="left" type="image" onClick="BBCleft()" onMouseOver="helpline('left')" class="postimage" alt="置左靠齊"><img style="padding-left: 5px; padding-right: 5px;" src="mods/bbcode_box/images/blackdot.gif" width="1" height="100%" border="0" alt=""><img border="0" src="mods/bbcode_box/images/sup.gif" class="postimage" name="supscript" type="image" onClick="BBCsup()" onMouseOver="helpline('sup')" alt="上標" /><img border="0" src="mods/bbcode_box/images/sub.gif" name="subs" class="postimage" type="image" onClick="BBCsub()" onMouseOver="helpline('sub')" alt="下標" /><img style="padding-left: 5px; padding-right: 5px;" src="mods/bbcode_box/images/blackdot.gif" width="1" height="100%" border="0" alt=""><img border="0" src="mods/bbcode_box/images/bold.gif" name="bold" type="image" onClick="BBCbold()" onMouseOver="helpline('b')" class="postimage" alt="粗體"><img border="0" src="mods/bbcode_box/images/italic.gif" name="italic" type="image" onClick="BBCitalic()" onMouseOver="helpline('i')" class="postimage" alt="斜體"><img border="0" src="mods/bbcode_box/images/under.gif" name="under" type="image" onClick="BBCunder()" onMouseOver="helpline('u')" class="postimage" alt="底線"><img border="0" src="mods/bbcode_box/images/strike.gif" class="postimage" name="strik" type="image" onClick="BBCstrike()" onMouseOver="helpline('strike')" alt="刪除線" /><img style="padding-left: 5px; padding-right: 5px;" src="mods/bbcode_box/images/blackdot.gif" width="1" height="100%" border="0" alt=""><img border="0" src="mods/bbcode_box/images/fade.gif" name="fade" type="image" onClick="BBCfade()" onMouseOver="helpline('fade')" class="postimage" alt="漸層文字"><img border="0" src="mods/bbcode_box/images/grad.gif" name="grad" type="image" onClick="BBCgrad()" onMouseOver="helpline('grad')" class="postimage" alt="彩虹文字"><img style="padding-left: 5px; padding-right: 5px;" src="mods/bbcode_box/images/blackdot.gif" width="1" height="100%" border="0" alt=""><img border="0" src="mods/bbcode_box/images/rtl.gif" name="dirrtl" type="image" onClick="BBCdir('rtl')" onMouseOver="helpline('rtl')" class="postimage" alt="從右至左閱讀"><img border="0" src="mods/bbcode_box/images/ltr.gif" name="dirltr" type="image" onClick="BBCdir('ltr')" onMouseOver="helpline('ltr')" class="postimage" alt="從左至右閱讀"><img style="padding-left: 5px; padding-right: 5px;" src="mods/bbcode_box/images/blackdot.gif" width="1" height="100%" border="0" alt=""><img border="0" src="mods/bbcode_box/images/marqd.gif" name="marqd" type="image" onClick="BBCmarqd()" onMouseOver="helpline('marqd')" class="postimage" alt="跑馬燈上至下"><img border="0" src="mods/bbcode_box/images/marqu.gif" name="marqu" type="image" onClick="BBCmarqu()" onMouseOver="helpline('marqu')" class="postimage" alt="跑馬燈下至上"><img border="0" src="mods/bbcode_box/images/marql.gif" name="marql" type="image" onClick="BBCmarql()" onMouseOver="helpline('marql')" class="postimage" alt="跑馬燈右至左"><img border="0" src="mods/bbcode_box/images/marqr.gif" name="marqr" type="image" onClick="BBCmarqr()" onMouseOver="helpline('marqr')" class="postimage" alt="跑馬燈左至右">
</td>
</tr>
<tr height="28">
<td background="mods/bbcode_box/images/bg.gif" valign="middle"><img src="mods/bbcode_box/images/dots.gif" style="padding-left: 4px;"></td>
<td background="mods/bbcode_box/images/bg.gif" valign="middle">
<img border="0" src="mods/bbcode_box/images/code.gif" name="code" type="image" onClick="BBCcode()" onMouseOver="helpline('code')" class="postimage" alt="程式碼"><img border="0" src="mods/bbcode_box/images/quote.gif" name="quote" type="image" onClick="BBCquote()" onMouseOver="helpline('quote')" class="postimage" alt="引言"><img border="0" src="mods/bbcode_box/images/spoil.gif" class="postimage" name="spoil" type="image" onClick="BBCspoil()" onMouseOver="helpline('spoil')" alt="隱藏文字" /><img style="padding-left: 5px; padding-right: 5px;" src="mods/bbcode_box/images/blackdot.gif" width="1" height="100%" border="0" alt=""><img border="0" src="mods/bbcode_box/images/url.gif" name="url" type="image" onClick="BBCurl()" onMouseOver="helpline('url')" class="postimage" alt="插入超連結"><img border="0" src="mods/bbcode_box/images/email.gif" name="email" type="image" onClick="BBCmail()" onMouseOver="helpline('mail')" class="postimage" alt="插入電子郵件"><img style="padding-left: 5px; padding-right: 5px;" src="mods/bbcode_box/images/blackdot.gif" width="1" height="20" border="0" alt=""><img border="0" src="mods/bbcode_box/images/img.gif" name="img" type="image" onClick="BBCimg()" onMouseOver="helpline('img')" class="postimage" alt="插入圖片"><img border="0" src="mods/bbcode_box/images/flash.gif" name="flash" type="image" onClick="BBCflash()" onMouseOver="helpline('flash')" class="postimage" alt="插入Flash影片"><img border="0" src="mods/bbcode_box/images/video.gif" name="video" type="image" onClick="BBCvideo()" onMouseOver="helpline('video')" class="postimage" alt="插入影片"><img border="0" src="mods/bbcode_box/images/sound.gif" name="stream" type="image" onClick="BBCstream()" onMouseOver="helpline('stream')" class="postimage" alt="插入音效"><img border="0" src="mods/bbcode_box/images/googlevid.gif" name="GVideo" type="image" onClick="BBCGVideo()" onMouseOver="helpline('googlevid')" class="postimage" alt="插入Google影片"><img border="0" src="mods/bbcode_box/images/youtube.gif" name="youtube" type="image" onClick="BBCyoutube()" onMouseOver="helpline('youtube')" class="postimage" alt="插入Youtube影片"><img style="padding-left: 5px; padding-right: 5px;" src="mods/bbcode_box/images/blackdot.gif" width="1" height="100%" border="0" alt=""><img border="0" src="mods/bbcode_box/images/list.gif" name="listdf" type="image" onClick="BBClist()" onMouseOver="helpline('list')" class="postimage" alt="項目符號" /><img border="0" src="mods/bbcode_box/images/hr.gif" name="hr" type="image" onClick="BBChr()" onMouseOver="helpline('hr')" class="postimage" alt="分隔線"><img style="padding-left: 5px; padding-right: 5px;" src="mods/bbcode_box/images/blackdot.gif" width="1" height="100%" border="0" alt=""><img border="0" src="mods/bbcode_box/images/plain.gif" name="plain" type="image" onClick="BBCplain()" onMouseOver="helpline('plain')" class="postimage" alt="移除BBcode">
</td>
如有認何譯文問題可參考FCKeditor Demo的翻譯:
http://www.fckeditor.net/demo
--
Source:
http://phpbb-tw.net/phpbb/viewtopic.php?p=255906#255906