1 頁 (共 1 頁)

BBCode 5.0.0

發表於 : 2006-05-07 , 10:33
懸壺子
BBCode 5.0.0

http://phpbb-tw.net/phpbb/viewtopic.php?p=229820#229820

代碼: 選擇全部

############################################################## 
## MOD Title: Advanced BBCode Box MOD 
## MOD Author: Disturbed One < anthony@anthonycoy.com > (Anthony Coy) http://www.hvmdesign.com 
## MOD Author: AL Tnen <al_tnen@hotmail.com> (N/A) http://www.tnen.zzn.com 
## MOD Description: This MOD adds lots of useful BBCode features and makes the bbcode buttons 
## look just like Microsoft Office 2003. It also improves the functions of 
## phpBB's BBCode function. It adds the bbcode exactly where the cursor is, 
## inserts smilies where the cursor is, and adds more ways to customize posts. 
## The MOD is very fast loading, and is a sleek addition to your phpBB bulletin board. 
## MOD Version: 5.0.0 
## 
## Installation Level: Easy 
## Installation Time: 10 Minutes 
## 
## Files To Edit: (4) 
## language/lang_english/lang_main.php 
## includes/bbcode.php 
## templates/subSilver/bbcode.tpl 
## templates/subSilver/posting_body.tpl 
## 
## Included Files: (57) 
## bbcode_box/add_bbcode.js 
## bbcode_box/grad.htm 
## bbcode_box/images/* 
## 
## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2 
############################################################## 
## For security purposes, please check: http://www.hvmdesign.com/mods.php 
## for the latest version of this MOD. If this MOD is out of date, 
## then it may have security risks fixed in newer versions. 
############################################################## 
## Author Notes: 
## 
## This MOD has been handed over to me (Disturbed One) by 
## permission from the old MOD author (AL Tnen). 
## 
## Please do not remove the copyright notice located on the box 
## without permission from me. 
## 
## The new version makes this MOD compatible with the newest 
## version of phpBB. This is the first new update since this MOD 
## was built for phpBB v2.0.3. 
## 
## This version adds new features compared to its last version 
## like BBCode insert at the cursor, and on selected text. Also some 
## BBCode security issues were fixed. For a complete list of BBCode 
## this MOD has, please read below. 
## 
## - Font Type (Dropdown Shows Actual Preview of Font) 
## - Font Size (Dropdown Shows Actual Preview of Size) 
## - Font Color (Dropdown Features New Colors, and Preview) 
## - Justify Align 
## - Left Align 
## - Center Align 
## - Right Align 
## - Superscript 
## - Subscript 
## - Bold 
## - Italic 
## - Underline 
## - Strikethrough 
## - Text Fade (IE Only) 
## - Text Gradient (IE Only) 
## - Message Box Align Left (Traditional) 
## - Message Box Align Right (Arabic, etc) 
## - Marquee Down 
## - Marquee Up 
## - Marquee Left 
## - Marquee Right 
## - Code 
## - Quote 
## - Spoiler (User must click on link to review text within tags) 
## - Hyperlink Wizard 
## - Email Wizard 
## - Include Webpage Wizard (Adds Iframe that displays page specified by user) 
## - Image Wizard 
## - Flash Wizard 
## - Streaming Video Wizard 
## - Streaming Audio Wizard 
## - RAM Wizard (Real Media Audio) 
## - Ordered List Wizard 
## - Unordered List Wizard 
## - Line Break 
## - Remove BBCode (Removes all BBCode tags from selected text) 
## - Close Tags (Closes remaining open tags) 
## 
############################################################## 
## MOD History: 
## 
## 2005-10-08 - Version 5.0.0 
## - MOD Taken over by Disturbed One 
## - Added features such as superscript, subscript, etc. 
## - Made compatible with the latest version of phpBB 
## - Fixed some functions 
## - Made BBCode so it is inserted at curser or on selected text 
## - Added Mozilla compatibility fixes 
## 
## ????-??-?? - Version 4.5.0 & Under 
## - MOD Development by Al Tnen 
## 
############################################################## 


外掛下載:
http://www.phpbbhacks.com/download/1059

--
如果您安裝此外掛後, 又要新增其他 BBCode 的話,
建議您, 參考下列文章( 感謝 hentaibbc 大大分享) 的作法:
http://phpbb-tw.net/phpbb/viewtopic.php?p=213652#213652

Re: BBCode 5.0.0

發表於 : 2006-05-07 , 10:35
懸壺子
以下錯誤是根據個人在測試論壇安裝所得,
相關解決方法, 則是參考原作者, 官方, 竹貓網站.

編輯文章時, 頁面出現錯誤訊息:

代碼: 選擇全部

Parse error: parse error, unexpected '<' in /home/vhosts/combbs.f5k.com/phpbb/includes/bbcode.php(61) : eval()'d code on line 24 

解決之道:

#
#-----[ OPEN ]-----
#
templates/YOUR_THEME/bbcode.tpl

#
#-----[ FIND AND DELETE ]-----
#

代碼: 選擇全部

<!-- 
//====================================================================== | 
//==== Start Advanced BBCode Box MOD =================================== | 
//==== v5.0.0 ========================================================== | 
//==== 
--> 
#
#-----[ FIND AND DELETE ]-----
#

代碼: 選擇全部

<!-- 
//==== 
//==== Author: Disturbed One [http://hvmdesign.com] =================== | 
//==== End Advanced BBCode Box MOD ==================================== | 
//===================================================================== | 
--> 
#
#-----[ SAVE & CLOSE ]-----
#
Source: http://www.hvmdesign.com/viewtopic.php?p=10573#10573

###############################################################################
編輯文章時, 出現 Script Error

解決之道:
#
#-----[ OPEN ]-----
#
templates/YOUR_THEME/posting_body.tpl

#
#-----[ FIND ]-----
# ps. 此程式碼為安裝 BBCode Box 所新增

代碼: 選擇全部

<img border="0" src="mods/bbcode_box/images/justify.gif" class="postimage" name="justify" type="image" onClick="BBCjustify()" onMouseOver="helpline('justify') border-style: outset; border-width: 1" alt="justify"> 



#
#-----[ REPLACE WITH ]-----
#

代碼: 選擇全部

<img border="0" src="mods/bbcode_box/images/justify.gif" class="postimage" name="justify" type="image" onClick="BBCjustify()" onMouseOver="helpline('justify')" border-style: outset; border-width: 1" alt="justify"> 


#
#-----[ SAVE & CLOSE ]-----
#
Source: http://www.phpbb.com/phpBB/viewtopic.ph ... 57#1817957

不過, 這個修改最好是這樣:
#
#-----[ REPLACE WITH ]-----
#

代碼: 選擇全部

<img border="0" src="mods/bbcode_box/images/justify.gif" class="postimage" name="justify" type="image" onClick="BBCjustify()" onMouseOver="helpline('justify')" alt="justify"> 


Source: http://phpbb-tw.net/phpbb/viewtopic.php?p=214920#214920


補充說明:
上頭第 1 個連結, 作者還有提出一個錯誤-> 無法使用表情符號;
但是根據我的測試發現, 表情符號的使用一切正常.

如果您也碰到這個錯誤, 那麼可以修改如下:

#
#-----[ OPEN ]-----
#
mods/bbcode_box/bbcode_box.js

#
#-----[ FIND ]-----
#

代碼: 選擇全部

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(); 
   } 
} 


#
#-----[ REPLACE WITH ]-----
#

代碼: 選擇全部

function emoticon(text) { 
   text = ' ' + text + ' '; 
   PostWrite(text); 
} 
 
#
#-----[ SAVE & CLOSE ]-----
#

Re: BBCode 5.0.0

發表於 : 2006-05-07 , 10:38
懸壺子
網友 秋本 發現 '字體顏色' 的設定無法重複選取;
http://phpbb-tw.net/phpbb/viewtopic.php?p=229693#229693
事實上 '字體型態' 以及 '字體大小' 也有相同的問題.

以下的修改, 提供您參考:
#
#-----[ OPEN ]-----
#
templates/YOUR_THEME/posting_body.tpl

#
#-----[ FIND ]-----
# ps. 這是 '字體型態' 的原始語法

代碼: 選擇全部

onChange="BBCft()" 
#
#-----[ REPLACE WITH ]-----
#

代碼: 選擇全部

onChange="BBCft();this.selectedIndex=0;"



#
#-----[ FIND ]-----
# ps. 這是 '字體大小' 的原始語法

代碼: 選擇全部

onChange="BBCfs()" 
#
#-----[ FIND ]-----
# ps. 這是 '字體顏色' 的原始語法

代碼: 選擇全部

onChange="BBCfc()" 
#
#-----[ REPLACE WITH ]-----
#

代碼: 選擇全部

onChange="BBCfc();this.selectedIndex=0;"
#
#-----[ SAVE & CLOSE ]-----
#
#EoM
--
補充說明:
此外掛發表在官方 phpbb 討論區的主題, 也是已經被鎖定;
理由是, 該作者已經很久沒有參與討論了.
http://www.phpbb.com/phpBB/viewtopic.ph ... 57#1817957

若以後有相關問題, 則建議您到原作者網站尋求支援.
http://www.hvmdesign.com

ps.
目前最新版本是 5.0.0a
只是針對前面回文 bbcode.tpl 的修正而已.

代碼: 選擇全部

## MOD History: 
## 
##   2005-10-08 - Version 5.0.0a 
##      - Fixed bbcode.tpl problem

Re: BBCode 5.0.0

發表於 : 2006-05-28 , 16:03
懸壺子
http://phpbb-tw.net/phpbb/viewtopic.php?t=39686
[外掛] BBcode Box v5.0.0 中文化-2

代碼: 選擇全部

# 
#-----[ ?#125;啟]------------------------------------------ 
# 
templatessubSilverposting_body.tpl 

# 
#-----[ 尋找]------------------------------------------ 
# 
</Start> 
   <td class="row2" valign="top"><span><span></span> 
      <table id="posttable" width="100%" border="1" bordercolor="#C0C0C0" cellspacing="0" cellpadding="0" valign="top"> 
        <tr align="right" valign="middle"> 
         <td valign="center"> 
            <table width="100%" cellpadding="3" cellspacing="0" bgcolor="#FFFFFF"> 
               <tr> 
                  <td background="mods/bbcode_box/images/bg.gif" valign="middle"><img src="mods/bbcode_box/images/dots.gif"></td> 
                  <td background="mods/bbcode_box/images/bg.gif"> 
                     <table cellpadding="0" cellspacing="0" border="0" width="100%"> 
                        <tr> 
                           <td align="left" width="70%"> 
                              <select> 
                                 <option>Font type</option> 
                                 <option>Default font</option> 
                                 <option>Arial</option> 
                                 <option>Arial Black</option> 
                                 <option>Century Gothic</option> 
                                 <option>Comic Sans MS</option> 
                                 <option>Courier New</option> 
                                 <option>Georgia</option> 
                                 <option>Lucida Console</option> 
                                 <option>Microsoft Sans Serif</option> 
                                 <option>Symbol</option> 
                                 <option>Tahoma</option> 
                                 <option>Trebuchet</option> 
                                 <option>Times New Roman</option> 
\n                                 <option>Verdana</option> 
                              </select> 
                              <select> 
                                 <option>Font Size</option> 
                                 <option>{L_FONT_TINY}</option> 
                                 <option>{L_FONT_SMALL}</option> 
                                 <option>{L_FONT_NORMAL}</option> 
                                 <option>{L_FONT_LARGE}</option> 
                                 <option>{L_FONT_HUGE}</option> 
                              </select> 
                              <select> 
                                 <option>Font Color</option> 
                                 </option>{L_COLOR_DEFAULT}</option> 
                                 <option>{L_COLOR_DARK_RED}</option> 
n                                 <option>{L_COLOR_RED}</option> 
                                 <option>{L_COLOR_ORANGE}</option> 
                                 <option>{L_COLOR_BROWN}</option> 
                                 <option>{L_COLOR_YELLOW}</option> 
                                 <option>{L_COLOR_GREEN}</option> 
                                 <option>{L_COLOR_OLIVE}</option> 
                                 <option>{L_COLOR_CYAN}</option> 
                                 <option>{L_COLOR_BLUE}</option> 
                                 <option>{L_COLOR_DARK_BLUE}</option> 
                                 <option>{L_COLOR_INDIGO}</option> 
                                 <option>{L_COLOR_VIOLET}</option> 
                                 <option>{L_COLOR_WHITE}</option> 
                                 <option>{L_COLOR_BLACK}</option> 
                              </select> 
                           </td> 
                           <td align="right" width="30%"><a href="http://hvmdesign.com/" class="gensmall" title="BBCode代碼盒子模組 - 來自 Disturbed One - www.HVMDesign.com" target="blank">新版 BBCode 代碼盒子 v5.0.0 版</a><br><a href="http://hjkwe654.no-ip.org/forum/index.php" class="gensmall" title="BBCode代碼盒子模組中文化 - 來自 hjkwe654 - http://hjkwe654.no-ip.org" target="blank">新版 BBCode 代碼盒子中文化 v5.0.0 版<br>中文化作者:hjkwe654</a></td> 
                        </tr> 
                     </table> 
                  </td> 
               </tr> 
               <tr height="28"> 
                  <td background="mods/bbcode_box/images/bg.gif" valign="middle"><img src="mods/bbcode_box/images/dots.gif"></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')" border-style: outset; border-width: 1" alt="讓字體靠邊緣"><img border="0" src="mods/bbcode_box/images/right.gif" name="right" type="image" class="postimage" alt="讓字體靠右邊"><img border="0" src="mods/bbcode_box/images/center.gif" name="center" type="image" class="postimage" alt="讓字體在正中央"><img border="0" src="mods/bbcode_box/images/left.gif" name="left" type="image" class="postimage" alt="讓字體靠左邊"><img 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" alt=""><img border="0" src="mods/bbcode_box/images/sub.gif" name="subs" class="postimage" type="image" alt=""><img 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" class="postimage" alt="粗體文字"><img border="0" src="mods/bbcode_box/images/italic.gif" name="italic" type="image" class="postimage" alt="字體傾斜"><img border="0" src="mods/bbcode_box/images/under.gif" name="under" type="image" class="postimage" alt="字體底線"><img border="0" src="mods/bbcode_box/images/strike.gif" class="postimage" name="strik" type="image" alt="刪除線"><img 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" class="postimage" alt="顏色控制棒"><img border="0" src="mods/bbcode_box/images/grad.gif" name="grad" type="image" class="postimage" alt="讓一串字產生多種顏色"><img 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" class="postimage" alt="右到左"><img border="0" src="mods/bbcode_box/images/ltr.gif" name="dirltr" type="image" class="postimage" alt="左到右"><img 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" class="postimage" alt="往下移動"><img border="0" src="mods/bbcode_box/images/marqu.gif" name="marqu" type="image" class="postimage" alt="往上移動"><img border="0" src="mods/bbcode_box/images/marql.gif" name="marql" type="image" class="postimage" alt="往左移動"><img border="0" src="mods/bbcode_box/images/marqr.gif" name="marqr" type="image" 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"></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" class="postimage" alt="代碼"><img border="0" src="mods/bbcode_box/images/quote.gif" name="quote" type="image" class="postimage" alt="引言"><img border="0" src="mods/bbcode_box/images/spoil.gif" class="postimage" name="spoil" type="image" alt="隱藏文字"><img 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" class="postimage" alt="網頁連結"><img border="0" src="mods/bbcode_box/images/email.gif" name="email" type="image" class="postimage" alt="電子郵件"><img border="0" src="mods/bbcode_box/images/web.gif" name="web" type="image" class="postimage" alt="讓網頁直接出?#123;在文章裡"><img 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" class="postimage" alt="圖片"><img border="0" src="mods/bbcode_box/images/flash.gif" name="flash" type="image" class="postimage" alt="Flash檔案"><img border="0" src="mods/bbcode_box/images/video.gif" name="video" type="image" class="postimage" alt="電影"><img border="0" src="mods/bbcode_box/images/sound.gif" name="stream" type="image" class="postimage" alt="聲音檔"><img border="0" src="mods/bbcode_box/images/ram.gif" name="ram" type="image" class="postimage" alt="RM媒體檔案"><img 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" class="postimage" alt="列表"><img border="0" src="mods/bbcode_box/images/hr.gif" name="hr" type="image" class="postimage" alt="線條"><img 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" class="postimage" alt="移除所有BBcode代碼"> 
                  </td> 
               </tr> 
            </table> 
         </td> 
        </tr> 
        <tr> 
         <td colspan="9"><span> 
           <input></span> 
          </td> 
        </tr> 
        <tr> 
         <td colspan="9"> 
            <span><textarea>{MESSAGE}</textarea></span></span></span> 
         </td> 
        </tr> 
</Author> 

# 
#-----[ 外掛修正完畢]------------------------------------------ 
#

BBCode 5.0.0[外掛] BBcode Box v5.0.0 中文化-1

發表於 : 2006-05-28 , 16:05
懸壺子
[外掛] BBcode Box v5.0.0 中文化-1

http://phpbb-tw.net/phpbb/viewtopic.php?t=39684

#
#-----[ 開啟]------------------------------------------
#
modsbbcode_boxbbcode_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);

b_help = "粗體文字: [b]text[/b]";
i_help = "字體變斜: [i]text[/i]";
u_help = "字體底線: [u]text[/u]";
quote_help = "引言: [quote]text[/quote]";
code_help = "代碼: [code]code[/code]";
spoil_help = "隱藏文字: [spoil]text[/spoil]";
img_help = "圖片連結: [img]http://image path[/img]";
url_help = "網頁連結: [url]http://hvmdesign.com[/url] 或 [url=http://hvmdesign.com]High Velocity Media[/url]";
fc_help = "字體顏色: [color=red]text[/color] 你可以使用 HTML color=#FF0000";
fs_help = "字體大小: [size=10]Small Text[/size]";
ft_help = "字體型態: [font=Tahoma]text[/font]";
rtl_help = "作一個訊息盒子從左到右";
ltr_help = "作一個訊息盒子從右到左";
mail_help = "電子郵件: [email]forum@hvmdesign.com[/email]";
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="讓移動字體往右邊移動: [marq=right]text[/marq]";
marql_help="讓移動字體往左邊移動: [marq=left]text[/marq]";
marqu_help="讓移動字體往上面移動: [marq=up]text[/marq]";
marqd_help="讓移動字體往下面移動: [marq=down]text[/marq]";
stream_help="聲音檔案連結: [stream]File URL[/stream]";
ram_help="rm檔案連結: [ram]File URL[/ram]";
web_help="讓網頁直接在文章裡出?#123;: [web]Page URL[/web]";
plain_help="移除所有的BBcode代碼";
hr_help="產生線條 [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)";
list_help = "製作列表: [list|=1|a]text[/list] 提示: 你可以使用 [*] 來製作";
strike_help = "讓字體有刪除線: [s]text[/s]";
sup_help = "Superscript: [sup]text[/sup]";
sub_help = "Subscript: [sub]text[/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> 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 BBCram() {
var FoundErrors = '';
var enterURL = prompt("請輸入RM檔案連結","http://");
if (!enterURL) {
FoundErrors += " 你必須輸入檔案連結!";
}
var enterW = prompt("請輸入視窗長度", "220");
if (!enterW) {
FoundErrors += " 你必須輸入視窗長度!";
}
var enterH = prompt("請輸入視窗寬度", "140");
if (!enterH) {
FoundErrors += " 你必須輸入視窗寬度!";
}
if (FoundErrors) {
alert("Error:"+FoundErrors);
return;
}
var ToAdd = "[ram width="+enterW+" height="+enterH+"]"+enterURL+"[/ram]";
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 BBCweb() {
var FoundErrors = '';
var enterURL = prompt("請輸入要顯示的網頁連結","http://");
if (!enterURL) {
FoundErrors += "你必須要輸入網頁連結!";
}
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("請輸入電子郵件地?#125;","");
if (!entermail) {
FoundErrors += " 你必須要輸入電子郵件地?#125;!";
}
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 = "[s]" + theSelection + "[/s]";
document.post.message.focus();
return;
}
}
else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
{
mozWrap(txtarea, "[s]", "[/s]");
return;
}
if (Strikeout == 0) {
ToAdd = "[s]";
document.strik.src = "mods/bbcode_box/images/strike1.gif";
Strikeout = 1;
} else {
ToAdd = "[/s]";
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 != '') { \r
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;
}
\n }
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();
\n 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 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>= 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 = "[code]" + theSelection + "[/code]";
document.post.message.focus();
return;
}
}
else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
{
mozWrap(txtarea, "[code]", "[/code]");
return;
}
if (Code == 0) {
ToAdd = "[code]";
document.post.code.src = "mods/bbcode_box/images/code1.gif";
Code = 1;
} else {
ToAdd = "[/code]";
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 = "[list]" + theSelection + "[/list]";
document.post.message.focus();
return;
}
}
else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
{
mozWrap(txtarea, "[list]", "[/list]");
return;
}
if (List == 0) {
ToAdd = "[list]";
document.listdf.src = "mods/bbcode_box/images/list1.gif";
List = 1;
} else {
ToAdd = "[/list]";
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 = "[b]" + theSelection + "[/b]";
document.post.message.focus();
return;
}
}
else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
{
mozWrap(txtarea, "[b]", "[/b]");
return;
}
if (Bold == 0) {
ToAdd = "[b]";
document.post.bold.src = "mods/bbcode_box/images/bold1.gif";
Bold = 1;
} else {
ToAdd = "[/b]";
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 = "[i]" + theSelection + "[/i]";
document.post.message.focus();
return;
}
}
else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
{
mozWrap(txtarea, "[i]", "[/i]");
return;
}
if (Italic == 0) {
ToAdd = "[i]";
document.post.italic.src = "mods/bbcode_box/images/italic1.gif";
Italic = 1;
} else {
ToAdd = "[/i]";
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 = "[u]" + theSelection + "[/u]";
document.post.message.focus();
return;
}
}
else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
{
mozWrap(txtarea, "[u]", "[/u]");
return;
}
if (Underline == 0) {
ToAdd = "[u]";
document.post.under.src = "mods/bbcode_box/images/under1.gif";
Underline = 1;
} else {
ToAdd = "[/u]";
document.post.under.src = "mods/bbcode_box/images/under.gif";
Underline = 0;
}
PostWrite(ToAdd);
}

function BBCurl() {
var FoundErrors = '';
var enterURL = prompt("請輸入網?#125;", "http://");
var enterTITLE = prompt("請輸入網?#125;的名稱", "Web Page Name");
if (!enterURL) {
FoundErrors += " 你必須要輸入網?#125;!";
}
if (!enterTITLE) {
FoundErrors += " 你必須要輸入網?#125;的名稱!";
}
if (FoundErrors) {
alert("Error:"+FoundErrors);
return;
}
var ToAdd = "[url="+enterURL+"]"+enterTITLE+"[/url]";
PostWrite(ToAdd);
}

function BBCimg() {
var FoundErrors = '';
var enterURL = prompt("請輸入圖片網?#125;","http://");
if (!enterURL) {
FoundErrors += " 你必須要輸入圖片網?#125;!";
}
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;

\n 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;
}

#
#-----[ 接 BBcode Box v5.0.0 中文化-2]------------------------------------------
#

modsbbcode_boxbbcode_box.js 中文化

發表於 : 2006-05-28 , 16:10
懸壺子
modsbbcode_boxbbcode_box.js 中文化  論壇更新5/28


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]text[/b]";
i_help = "字體變斜: [i]text[/i]";
u_help = "字體底線: [u]text[/u]";
quote_help = "引言: [quote]text[/quote]";
code_help = "代碼: [code]code[/code]";
spoil_help = "隱藏文字: [spoil]text[/spoil]";
img_help = "圖片連結: [img]http://image path[/img]";
url_help = "網頁連結: [url]http://hvmdesign.com[/url] 或 [url=http://hvmdesign.com]High Velocity Media[/url]";
fc_help = "字體顏色: [color=red]text[/color] 你可以使用 HTML color=#FF0000";
fs_help = "字體大小: [size=10]Small Text[/size]";
ft_help = "字體型態: [font=Tahoma]text[/font]";
rtl_help = "作一個訊息盒子從左到右";
ltr_help = "作一個訊息盒子從右到左";
mail_help = "電子郵件: [email]forum@hvmdesign.com[/email]";
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="讓移動字體往右邊移動: [marq=right]text[/marq]";
marql_help="讓移動字體往左邊移動: [marq=left]text[/marq]";
marqu_help="讓移動字體往上面移動: [marq=up]text[/marq]";
marqd_help="讓移動字體往下面移動: [marq=down]text[/marq]";
stream_help="聲音檔案連結: [stream]File URL[/stream]";
ram_help="rm檔案連結: [ram]File URL[/ram]";
web_help="讓網頁直接在文章裡出現 [web]Page URL[/web]";
plain_help="移除所有的BBcode代碼";
hr_help="產生線條 [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)";
list_help = "製作列表: [list|=1|a]text[/list] 提示: 你可以使用 [*] 來製作";
strike_help = "讓字體有刪除線: [s]text[/s]";
sup_help = "Superscript: [sup]text[/sup]";
sub_help = "Subscript: [sub]text[/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> 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 BBCram() {
var FoundErrors = '';
var enterURL = prompt("請輸入RM檔案連結","http://");
if (!enterURL) {
FoundErrors += " 你必須輸入檔案連結!";
}
var enterW = prompt("請輸入視窗長度", "220");
if (!enterW) {
FoundErrors += " 你必須輸入視窗長度!";
}
var enterH = prompt("請輸入視窗寬度", "140");
if (!enterH) {
FoundErrors += " 你必須輸入視窗寬度!";
}
if (FoundErrors) {
alert("Error:"+FoundErrors);
return;
}
var ToAdd = "[ram width="+enterW+" height="+enterH+"]"+enterURL+"[/ram]";
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 BBCweb() {
var FoundErrors = '';
var enterURL = prompt("請輸入要顯示的網頁連結","http://");
if (!enterURL) {
FoundErrors += "你必須要輸入網頁連結!";
}
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("請輸入電子郵件地址","");
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 = "[s]" + theSelection + "[/s]";
document.post.message.focus();
return;
}
}
else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
{
mozWrap(txtarea, "[s]", "[/s]");
return;
}
if (Strikeout == 0) {
ToAdd = "[s]";
document.strik.src = "mods/bbcode_box/images/strike1.gif";
Strikeout = 1;
} else {
ToAdd = "[/s]";
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 != '') {
\n 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 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>= 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 = "[code]" + theSelection + "[/code]";
document.post.message.focus();
return;
}
}
else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
{
mozWrap(txtarea, "[code]", "[/code]");
return;
}
if (Code == 0) {
ToAdd = "[code]";
document.post.code.src = "mods/bbcode_box/images/code1.gif";
Code = 1;
} else {
ToAdd = "[/code]";
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 = "[list]" + theSelection + "[/list]";
document.post.message.focus();
return;
}
}
else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
{
mozWrap(txtarea, "[list]", "[/list]");
return;
}
if (List == 0) {
ToAdd = "[list]";
document.listdf.src = "mods/bbcode_box/images/list1.gif";
List = 1;
} else {
ToAdd = "[/list]";
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 = "[b]" + theSelection + "[/b]";
document.post.message.focus();
return;
}
}
else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
{
mozWrap(txtarea, "[b]", "[/b]");
return;
}
if (Bold == 0) {
ToAdd = "[b]";
document.post.bold.src = "mods/bbcode_box/images/bold1.gif";
Bold = 1;
} else {
ToAdd = "[/b]";
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 = "[i]" + theSelection + "[/i]";
document.post.message.focus();
return;
}
}
else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
{
mozWrap(txtarea, "[i]", "[/i]");
return;
}
if (Italic == 0) {
ToAdd = "[i]";
document.post.italic.src = "mods/bbcode_box/images/italic1.gif";
Italic = 1;
} else {
ToAdd = "[/i]";
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 = "[u]" + theSelection + "[/u]";
document.post.message.focus();
return;
}
}
else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
{
mozWrap(txtarea, "[u]", "[/u]");
return;
}
if (Underline == 0) {
ToAdd = "[u]";
document.post.under.src = "mods/bbcode_box/images/under1.gif";
Underline = 1;
} else {
ToAdd = "[/u]";
document.post.under.src = "mods/bbcode_box/images/under.gif";
Underline = 0;
} \r
PostWrite(ToAdd);
}

function BBCurl() {
var FoundErrors = '';
var enterURL = prompt("請輸入網址", "http://");
var enterTITLE = prompt("請輸入網址的名稱", "Web Page Name");
if (!enterURL) {
FoundErrors += " 你必須要輸入網址!";
}
if (!enterTITLE) {
FoundErrors += " 你必須要輸入網址的名稱!";
}
if (FoundErrors) {
alert("Error:"+FoundErrors);
return;
}
var ToAdd = "[url="+enterURL+"]"+enterTITLE+"[/url]";
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;
}

subSilver的posting_body.tpl為例

發表於 : 2006-05-28 , 16:15
懸壺子
subSilver的posting_body.tpl為例(全部)5/28更新

代碼: 選擇全部

<script></script>

<BEGIN>
<table border="0" cellspacing="0" cellpadding="0" align="center" width="100%">
  <tr> 
	<td valign="top" align="center" width="100%"> 
	  <table height="40" cellspacing="2" cellpadding="2" border="0">
		<tr valign="middle"> 
		  <td>{INBOX_IMG}</td>
		  <td><span>{INBOX_LINK}  </span></td>
		  <td>{SENTBOX_IMG}</td>
		  <td><span>{SENTBOX_LINK}  </span></td>
		  <td>{OUTBOX_IMG}</td>
		  <td><span>{OUTBOX_LINK}  </span></td>
		  <td>{SAVEBOX_IMG}</td>
		  <td><span>{SAVEBOX_LINK}  </span></td>
		</tr>
	  </table>
	</td>
  </tr>
</table>

<br clear="all">
<END>

<form>

{POST_PREVIEW_BOX}
{ERROR_BOX}

<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
	<tr> 
		<td align="left"><span><a href="{U_INDEX}" class="nav">{L_INDEX}</a>
		<BEGIN> 
		-> <a href="{U_VIEW_FORUM}" class="nav">{FORUM_NAME}</a></span></td>
		<END>
	</tr>
</table>

<table border="0" cellpadding="3" cellspacing="1" width="100%" class="forumline">
	<tr> 
		<th class="thHead" colspan="2" height="25"><b>{L_POST_A}</b></th>
	</tr>
	<BEGIN>
	<tr> 
		<td class="row1"><span><b>{L_USERNAME}</b></span></td>
		<td class="row2"><span><input></span></td>
	</tr>
	<END>
	<BEGIN>
	<tr> 
		<td class="row1"><span><b>{L_USERNAME}</b></span></td>
		<td class="row2"><span><input> <input></span></td>
	</tr>
	<END>
	<tr> 
	  <td class="row1" width="22%"><span><b>{L_SUBJECT}</b></span></td>
	  <td class="row2" width="78%"> <span> 
		<input>
		</span> </td>
	</tr>
	<tr> 
	  <td class="row1" valign="top"> 
		<table width="100%" border="0" cellspacing="0" cellpadding="1">
		  <tr> 
			<td><span><b>{L_MESSAGE_BODY}</b></span> </td>
		  </tr>\r
		  <tr> 
			<td valign="middle" align="center"> <br>
			  <table width="100" border="0" cellspacing="0" cellpadding="5">
				<tr align="center"> 
				  <td colspan="{S_SMILIES_COLSPAN}" class="gensmall"><b>{L_EMOTICONS}</b></td>
				</tr>
				<BEGIN>
				<tr align="center" valign="middle"> 
				  <BEGIN>
				  <td><a href="javascript:emoticon('{smilies_row.smilies_col.SMILEY_CODE}')"><img src="{smilies_row.smilies_col.SMILEY_IMG}" border="0" alt="{smilies_row.smilies_col.SMILEY_DESC}" title="{smilies_row.smilies_col.SMILEY_DESC}"></a></td>
				  <END>
				</tr>
				<END>
				<BEGIN>
				<tr align="center"> 
				  <td colspan="{S_SMILIES_COLSPAN}"><span><a href="{U_MORE_SMILIES}" target="_phpbbsmilies" class="nav">{L_MORE_SMILIES}</a></span></td>
				</tr>
				<END>
			  </table>
			</td>
		  </tr>
		</table>
	  </td>
	  	<td class="row2" valign="top"><span><span></span> 
		<table id="posttable" width="100%" border="1" bordercolor="#C0C0C0" cellspacing="0" cellpadding="0" valign="top">
		  <tr align="right" valign="middle"> 
			<td valign="center">
				<table width="100%" cellpadding="3" cellspacing="0" bgcolor="#FFFFFF">
					<tr>
						<td background="mods/bbcode_box/images/bg.gif" valign="middle"><img src="mods/bbcode_box/images/dots.gif"></td>
						<td background="mods/bbcode_box/images/bg.gif">
							<table cellpadding="0" cellspacing="0" border="0" width="100%">
								<tr>
									<td align="left" width="70%">
										<select>
											<option>Font type</option>
											<option>Arial</option> 
											<option>Arial Black</option> 
											<option>Century Gothic</option>
											<option>Comic Sans MS</option> 
											<option>Courier New</option>
											<option>Georgia</option> 
											<option>Lucida Console</option>
											<option>Microsoft Sans Serif</option> 
											<option>Symbol</option> 
											<option>Tahoma</option>
											<option>Trebuchet</option> 
											<option>Times New Roman</option> 
											<option>Verdana</option> 
										</select>
										<select>
											<option>Font Size</option>
											<option>{L_FONT_TINY}</option>
											<option>{L_FONT_SMALL}</option>
											<option>{L_FONT_NORMAL}</option>
											<option>{L_FONT_LARGE}</option>
											<option>{L_FONT_HUGE}</option>
										</select>
										<select>
											<option>Font Color</option>
											</option><img border="0" src="mods/bbcode_box/images/right.gif" name="right" type="image" class="postimage" alt="讓字體靠右邊"><img border="0" src="mods/bbcode_box/images/center.gif" name="center" type="image" class="postimage" alt="讓字體在正中央"><img border="0" src="mods/bbcode_box/images/left.gif" name="left" type="image" class="postimage" alt="讓字體靠左邊"><img 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" alt="次方"><img border="0" src="mods/bbcode_box/images/sub.gif" name="subs" class="postimage" type="image" alt="數"><img 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" class="postimage" alt="粗體文字"><img border="0" src="mods/bbcode_box/images/italic.gif" name="italic" type="image" class="postimage" alt="字體傾斜"><img border="0" src="mods/bbcode_box/images/under.gif" name="under" type="image" class="postimage" alt="字體底線"><img border="0" src="mods/bbcode_box/images/strike.gif" class="postimage" name="strik" type="image" alt="刪除線"><img 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" class="postimage" alt="顏色控制棒"><img border="0" src="mods/bbcode_box/images/grad.gif" name="grad" type="image" class="postimage" alt="讓一串字產生多種顏色"><img 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" class="postimage" alt="右到左"><img border="0" src="mods/bbcode_box/images/ltr.gif" name="dirltr" type="image" class="postimage" alt="左到右"><img 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" class="postimage" alt="往下移動"><img border="0" src="mods/bbcode_box/images/marqu.gif" name="marqu" type="image" class="postimage" alt="往上移動"><img border="0" src="mods/bbcode_box/images/marql.gif" name="marql" type="image" class="postimage" alt="往左移動"><img border="0" src="mods/bbcode_box/images/marqr.gif" name="marqr" type="image" 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"></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" class="postimage" alt="代碼"><img border="0" src="mods/bbcode_box/images/quote.gif" name="quote" type="image" class="postimage" alt="引言"><img border="0" src="mods/bbcode_box/images/spoil.gif" class="postimage" name="spoil" type="image" alt="隱藏文字"><img 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" class="postimage" alt="網頁連結"><img border="0" src="mods/bbcode_box/images/email.gif" name="email" type="image" class="postimage" alt="電子郵件"><img border="0" src="mods/bbcode_box/images/web.gif" name="web" type="image" class="postimage" alt="讓網頁直接出現在文章裡"><img 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" class="postimage" alt="圖片"><img border="0" src="mods/bbcode_box/images/flash.gif" name="flash" type="image" class="postimage" alt="Flash檔案"><img border="0" src="mods/bbcode_box/images/video.gif" name="video" type="image" class="postimage" alt="電影"><img border="0" src="mods/bbcode_box/images/sound.gif" name="stream" type="image" class="postimage" alt="聲音檔"><img border="0" src="mods/bbcode_box/images/ram.gif" name="ram" type="image" class="postimage" alt="RM媒體檔案"><img 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" class="postimage" alt="列表"><img border="0" src="mods/bbcode_box/images/hr.gif" name="hr" type="image" class="postimage" alt="線條"><img 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" class="postimage" alt="移除所有BBcode代碼"> 

						</td> 
					</tr>
				</table>
			</td>
		  </tr>
		  <tr> 
			<td colspan="9"><span> <font><a href="http://imageshack.us" target="_blank">ImageShack</a> (免費貼圖)</font> | <font><a href=" http://home.pchome.com.tw/ " target="_blank">PChome網頁</a> (免費上傳)</font><br>
			  <input></span>
			 </td>
		  </tr>
		  <tr> 
			<td colspan="9">
				<span><textarea>{MESSAGE}</textarea>		  </span></td>
		  </tr> 
		</table>
		</span></td>
	</tr>
	<tr> 
	  <td class="row1" valign="top"><span><b>{L_OPTIONS}</b></span><br><span>{HTML_STATUS}<br>{BBCODE_STATUS}<br>{SMILIES_STATUS}</span></td>
	  <td class="row2"><span> </span> 
		<table cellspacing="0" cellpadding="1" border="0">
		  <BEGIN>
		  <tr> 
			<td> 
			  <input>
			</td>
			<td><span>{L_DISABLE_HTML}</span></td>
		  </tr>
		  <END>
		  <BEGIN>
		  <tr> 
			<td> 
			  <input>
			</td>
			<td><span>{L_DISABLE_BBCODE}</span></td>
		  </tr>
		  <END>
		  <BEGIN>
		  <tr> 
			<td> 
			  <input>
			</td>
			<td><span>{L_DISABLE_SMILIES}</span></td>
		  </tr>
		  <END>
		  <BEGIN>
		  <tr> 
			<td> 
			  <input>r
			</td>
			<td><span>{L_ATTACH_SIGNATURE}</span></td>
		  </tr>
		  <END>
		  <BEGIN>
		  <tr> 
			<td> 
			  <input>
			</td>
			<td><span>{L_NOTIFY_ON_REPLY}</span></td>
		  </tr>
		  <END>
		  <BEGIN>
		  <tr> 
			<td> 
			  <input>
			</td>
			<td><span>{L_DELETE_POST}</span></td>
		  </tr>
		  <END>
		  <BEGIN>
		  <tr> 
			<td></td>
			<td><span>{S_TYPE_TOGGLE}</span></td>
		  </tr>
		  <END>
		</table>
	  </td>
	</tr>
	{POLLBOX} 
	<tr> 
	  <td class="catBottom" colspan="2" align="center" height="28"> {S_HIDDEN_FORM_FIELDS}<input> <input></td>
	</tr>
  </table>

  <table width="100%" cellspacing="2" border="0" align="center" cellpadding="2">
	<tr> 
	  <td align="right" valign="top"><span>{S_TIMEZONE}</span></td>
	</tr>
  </table>
\n</form>

<table width="100%" cellspacing="2" border="0" align="center">
  <tr> 
	<td valign="top" align="right">{JUMPBOX}</td>
  </tr>
</table>

{TOPIC_REVIEW_BOX}

[問題]有關BBcodeBox貼圖按鈕[IMG]的錯誤狀況

發表於 : 2006-06-10 , 12:28
懸壺子
[問題]有關BBcodeBox貼圖按鈕[IMG]的錯誤狀況

http://phpbb-tw.net/phpbb/viewtopic.php?t=44530

我很久以前安裝過BBcode Box
現在才發現
IMG貼圖按鈕按下去,並且打上圖片網址,按下確定後
他會把貼圖,也就是[IMG ]XXXXX[/IMG ]貼到文章最後面
正常來說不是應該貼到游標的位置嗎?
我有問過一兩位高手,他們沒有時間幫我解決
不過他們說應該是includes/bbcode.php或者includes/functions_post.php有關
只是我完全不懂PHP的語言
希望有人能夠幫我解決
以下是我的論壇http://dopi.33host.com
測試帳號:test
密碼:1234
請在論壇發言窗裡面試著按貼圖按鈕[IMG]
你會發現貼出來的圖會跑到最後面而不是游標
這個問題困擾我很久了
如果需要我提供哪方面的php檔請告訴我,我會立刻補上來讓各位大大參考

Re: [問題]有關BBcodeBox貼圖按鈕[IMG]的錯誤狀況

發表於 : 2006-06-10 , 12:29
懸壺子
心靈捕手

代碼: 選擇全部

以下的修改, 提供您參考: 
# 
#-----[ OPEN ]------------------------------------------ 
# 
mods/bbcode_box/bbcode_box.js 

# 
#-----[ FIND ]------------------------------------------ 
# 
代碼: 

   var ToAdd = "[img]"+enterURL+"[/img]"; 
   document.post.message.value+=ToAdd; 
   document.post.message.focus(); 
 

# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 
代碼: 

   var ToAdd = "[img]"+enterURL+"[/img]"; 
   PostWrite(ToAdd); 
 
ps.
1. 這的確比較傾向是 '非官方外掛' 的問題;
移動回該討論版面.
2. 這不見得算是 '錯誤'.
原外掛作者, 也許是考量到 '版面的編排', 才做此設計;
同樣的情況, 還有 [web] 這個標籤.