參考連結:http://phpbb-tw.net/phpbb/viewtopic.php ... ght=bbcode
使用版本:phpBB 2.0.18
網站位置:http://www.forever-lee.com/phpbb
狀況描述:

我想將劃圈的部份改成中文....
我已經將bbcode_box.js和add_bbcode.js這兩個檔案改的像下面這樣還是沒有效果,請問哪邊出問題了ㄋ
另外有個問題..
當我裝了這個外掛後,發表文章的那一頁左下角會出現已完成但網頁發生錯誤,可是還是可以發表文章,請問我要怎麼去修正那個錯誤呢\r
代碼: 選擇全部
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);
b_help = "粗體: [b]文字[/b]";
i_help = "斜體: [i]文字[/i]";
u_help = "底線: [u]文字[/u]";
quote_help = "引用: [quote]文字[/quote]";
code_help = "顯示?#123;式碼: [code]?#123;式碼spoil_help = "隱藏: [spoil]文字[/spoil]";
img_help = "插入圖片:
url_help = "插入超連結: 連結網?#125; or 網站名稱";
fc_help = "字型顏色: 文字 ?#93;可以使用16進位碼:#FF0000";
fs_help = "字型大小: 文字";
ft_help = "字型: [font=Tahoma]文字[/font]";
rtl_help = "由右至左輸入";
ltr_help = "由左至右輸入";
mail_help = "插入Email: [email]E-mail網?#125;[/email]";
grad_help="插入漸層色文字 (只支援IE)";
right_help="靠右對齊: [align=right]文字[/align]";
left_help="靠左對齊: [align=left]文字[/align]";
center_help="置中對齊: [align=center]文字[/align]";
justify_help="左右對齊: [align=justify]文字[/align]";
marqr_help="文字?#93;馬燈向右: [marq=right]文字[/marq]";
marql_help="文字?#93;馬燈向左: [marq=left]text[/marq]";
marqu_help="文字?#93;馬燈向上: [marq=up]text[/marq]";
marqd_help="文字?#93;馬燈向下: [marq=down]text[/marq]";
stream_help="插入串流影音檔: [stream]檔案網?#125;[/stream]";
ram_help="插入Real影片檔: [ram]檔案網?#125;[/ram]";
web_help="插入其他網頁: [web]網頁網?#125;[/web]";
plain_help="移除被選擇文字的bbcode標籤";
hr_help="插入水平線";
video_help="插入影片檔: [video width=寬度 height=高度]檔案網?#125;[/video]";
flash_help="插入Flash檔: [flash width=寬度 height=高度]Flash網?#125;[/flash]";
fade_help = "淡出文字效果: [fade]文字[/fade] (只支援IE)";
list_help = "Ordered list: [list|=1|a]text[/list] Tip: you can use [*] to insert bullet";
strike_help = "刪除線: 文字";
sup_help = "上標文字: [sup]文字[/sup]";
sub_help = "下標文字: [sub]文字[/sub]";
symbol_help = "Insert Symbol Into Post";
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 web = 0;
var video = 0;
var stream = 0;
var ram = 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;
// 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("Please select the text first");
return;
}
if (oSelectRange.text.length > 120) {
alert("This only works for less than 120 letters");
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 BBCram() {
var FoundErrors = '';
var enterURL = prompt("Please write real media file URL","http://");
if (!enterURL) {
FoundErrors += " You didn't write the file URL.";
}
var enterW = prompt("Enter the real media file width", "220");
if (!enterW) {
FoundErrors += " You didn't enter the real media file width.";
}
var enterH = prompt("Enter the real media file height", "140");
if (!enterH) {
FoundErrors += " You didn't enter the real media file height.";
}
if (FoundErrors) {
alert("Error:"+FoundErrors);
return;
}
var ToAdd = "[ram width="+enterW+" height="+enterH+"]"+enterURL+"[/ram]";
PostWrite(ToAdd);
}
function BBCstream() {
var FoundErrors = '';
var enterURL = prompt("Please write stream file URL","http://");
if (!enterURL) {
FoundErrors += " You didn't write the file URL.";
}
if (FoundErrors) {
alert("Error:"+FoundErrors);
return;
}
var ToAdd = "[stream]"+enterURL+"[/stream]";
PostWrite(ToAdd);
}
function BBCvideo() {
var FoundErrors = '';
var enterURL = prompt("Please Enter the video file URL", "http://");
if (!enterURL) {
FoundErrors += " You didn't write the file URL.";
}
var enterW = prompt("Enter the video file width", "400");
if (!enterW) {
FoundErrors += " You didn't enter the video file width.";
}
var enterH = prompt("Enter the video file height", "350");
if (!enterH) {
FoundErrors += " You didn't enter the video file height.";
}
\n if (FoundErrors) {
alert("Error:"+FoundErrors);
return;
}
var ToAdd = "[video width="+enterW+" height="+enterH+"]"+enterURL+"[/video]";
PostWrite(ToAdd);
}
function BBCweb() {
var FoundErrors = '';
var enterURL = prompt("Please enter page URL","http://");
if (!enterURL) {
FoundErrors += "You didn't write the page URL";
}
if (FoundErrors) {
alert("Error :"+FoundErrors);
return;
}
var ToAdd = "[web]"+enterURL+"[/web]";
document.post.message.value+=ToAdd;
document.post.message.focus();
}
function BBCmail() {
var FoundErrors = '';
var entermail = prompt("Enter the Email Address","");
if (!entermail) {
FoundErrors += " You didn't write the Email Address.";
}
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);
}\r
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("Enter the flash file URL", "http://");
if (!enterURL) {
FoundErrors += " You didn't write the flash file URL.";
}
var enterW = prompt("Enter the flash width", "250");
if (!enterW) {
FoundErrors += " You didn't write the flash width.";
}
var enterH = prompt("Enter the flash height", "250");
if (!enterH) {
FoundErrors += " You didn't write the flash height.";
}
if (FoundErrors) {
alert("Error:"+FoundErrors);
return;
}
var ToAdd = "[flash width="+enterW+" height="+enterH+"]"+enterURL+"[/flash]";
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 = "You must enter a message when posting";
}
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 = "
- " + theSelection + "
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("Enter the URL", "http://");
var enterTITLE = prompt("Enter the page name", "Web Page Name");
if (!enterURL) {
FoundErrors += " You didn't write the URL.";
}
if (!enterTITLE) {
FoundErrors += " You didn't write the page name.";
}
if (FoundErrors) {
alert("Error:"+FoundErrors);
return;
}
var ToAdd = ""+enterTITLE+"";
PostWrite(ToAdd);
}
function BBCimg() {
var FoundErrors = '';
var enterURL = prompt("Enter the image URL","http://");
if (!enterURL) {
FoundErrors += "You didn't write the image URL";
}
if (FoundErrors) {
alert("Error :"+FoundErrors);
return;
}
var ToAdd = "
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]

