##############################################################
## 外掛名稱: Enable Hoteditor In Quick Reply (快速回覆編輯介面改採所見即所得模式)
## 外掛作者: wang5555 < wang55.wang55@msa.hinet.net > (心靈捕手) http://220.134.232.37/
## 外掛描述: 這個外掛, 讓您論壇裡的快速回覆編輯介面, 改採所見即所得模式
##
## 外掛版本: 1.0.0
##
## 安裝難度: Easy
## 安裝時間: < 3 Minutes
## 需要編輯的檔案: 1
##               styles/prosilver/template/posting_qr_body.html
##
## 附加檔案: 0
##
## 版權聲明: http://opensource.org/licenses/gpl-license.php GNU General Public License v2 
############################################################## 
## 由於安全上的考量, 請檢查: http://phpbb-tw.net/phpbb/index.php 
## 是否有此外掛的最新版本. 
################################################################ 
## 作者留言:
##
##   1. 此外掛於 phpBB 3.0.2 測試無誤.
##
##   2. 修改前提: 您的論壇已經安裝好下面兩個外掛, 且運作正常
##       Evil Quick Reply (快速回覆)
##       http://phpbb-tw.net/phpbb/viewtopic.php?f=132&t=50264
##       WYSIWYG - Rich Text Editor for posting HTML message 4.2
##       http://phpbb-tw.net/phpbb/viewtopic.php?f=134&t=50261
## 
################################################################
## 外掛歷史:
##
##   2008-08-01 - Version 1.0.0
##  	- 首次發表
##
############################################################## 
## 新增外掛前, 請先備份相關檔案.
############################################################## 

#
#-----[ OPEN ]-----
#
styles/prosilver/template/posting_qr_body.html

#
#-----[ FIND ]-----
#
	<form action="{S_QR_POST_ACTION}" method="post" id="postform">

#
#-----[ REPLACE WITH ]-----
#
	<form action="{S_QR_POST_ACTION}" method="post" id="postform" onsubmit="return get_hoteditor_data();">

#
#-----[ FIND ]-----
#
			<!-- INCLUDE posting_buttons.html -->

			<div id="smiley-box">
				<!-- IF S_SMILIES_ALLOWED and .smiley -->
					<strong>{L_SMILIES}</strong><br />
					<!-- BEGIN smiley -->
						<a href="#" onclick="insert_text('{smiley.A_SMILEY_CODE}', true); return false;"><img src="{smiley.SMILEY_IMG}" width="{smiley.SMILEY_WIDTH}" height="{smiley.SMILEY_HEIGHT}" alt="{smiley.SMILEY_CODE}" title="{smiley.SMILEY_DESC}" /></a>
					<!-- END smiley -->
				<!-- ENDIF -->
				<!-- IF S_SHOW_SMILEY_LINK and S_SMILIES_ALLOWED-->
					<br /><a href="{U_MORE_SMILIES}" onclick="popup(this.href, 300, 350, '_phpbbsmilies'); return false;">{L_MORE_SMILIES}</a>
				<!-- ENDIF -->
			</div>

			<div id="message-box">
				<textarea name="message" id="message" rows="10" cols="76" class="inputbox" tabindex="2">{MESSAGE}</textarea>
			</div>

#
#-----[ REPLACE WITH ]-----
#
<!-- //HotEditor MOD START -->
<textarea style="visibility:hidden;position:absolute;top:-20;left:-20;width:1px;height:1px" <!-- IF S_UCP_ACTION and not S_PRIVMSGS and not S_EDIT_DRAFT -->name="signature" id="signature" style="height: 9em;"<!-- ELSE -->name="message" id="message"<!-- ENDIF --> rows="15" cols="76" tabindex="3" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);" class="inputbox">{MESSAGE}</textarea>		
<style type='text/css'>@import url(richedit/styles/office2007/style.css);</style>			
<script language="JavaScript" type="text/javascript" src="richedit/editor.js"></script>				
<script language="JavaScript" type="text/javascript">
	if(document.getElementById("message")){
		var mydoc=document.getElementById("message");
	}
	else if(document.getElementById("signature")){
		var mydoc=document.getElementById("signature");
		
	}
	var getdata = mydoc.value;
	getdata = convertSize(getdata,"1");
	
	Instantiate("max","editor", getdata , "100%", "300px");
	//For Vietnamese User. Edit file editor.js to enable vietnamese keyboard
	if(enable_vietnamese_keyboard==1){
		document.write("<script language=\"JavaScript\" type=\"text/javascript\" src=\"richedit/avim.js\"><\/script>");
		var hoteditor_avim_method = hot_readCookie("hoteditor_avim_method");var him_auto_checked="";var him_telex_checked="";var him_vni_checked="";var him_viqr_checked="";var him_viqr2_checked="";var him_off_checked="";if(hoteditor_avim_method=="0"){him_auto_checked="checked";}else if(hoteditor_avim_method=="1"){him_telex_checked="checked";}else if(hoteditor_avim_method=="2"){him_vni_checked="checked";}else if(hoteditor_avim_method=="3"){him_viqr_checked="checked";}else if(hoteditor_avim_method=="4"){him_viqr2_checked="checked";}else if(hoteditor_avim_method=="-1"){him_off_checked="checked";}
		document.write("<div style='width:100%;text-align:center;font-family:Verdana;font-size:11px;'><input "+him_auto_checked+" id=him_auto onclick=setMethod(0); type=radio name=viet_method> Auto :: <input "+him_telex_checked+" id=him_telex onclick=setMethod(1); type=radio name=viet_method> Telex :: <input "+him_vni_checked+" id=him_vni onclick=setMethod(2); type=radio name=viet_method> VNI :: <input "+him_viqr_checked+" id=him_viqr onclick=setMethod(3); type=radio name=viet_method> VIQR :: <input "+him_viqr2_checked+" id=him_viqr2 onclick=setMethod(4); type=radio name=viet_method> VIQR* :: <input "+him_off_checked+" id=him_off onclick=setMethod(-1); type=radio name=viet_method> Off<br><img src="+styles_folder_path+"/vietnamese_symbol.gif></div>");
	}
	function get_hoteditor_data(){
		if (HTML_ON == "no"){
			alert ("Please uncheck the HTML checkbox");
			return false;
		}
		setCodeOutput();
		var bbcode_output=document.getElementById("hoteditor_bbcode_ouput_editor").value;//Output to BBCode
		//Make BBCode ouput compatible with phpbb
		var currentDomain=document.URL;
		currentDomain=currentDomain.replace("http://","");
		var infoDomain=currentDomain.split("/");
		var correctDomain="http://";
		for(var d=0;d < infoDomain.length; d++){
			if(d<infoDomain.length-1) correctDomain+=infoDomain[d]+"/";
		}
		bbcode_output=bbcode_output.replace(/\[IMG\]\.\//gi,"[IMG]"+correctDomain);
		bbcode_output=bbcode_output.replace(/\[(\/)quote\]/gi,"[$1quote]");
		bbcode_output = convertSize(bbcode_output,"0");
		mydoc.value = bbcode_output;
	}

	function convertSize(text,what){
		if(what=="1"){//phpBB size to Hoteditor size
			text=text.replace(/\[size=85\]/gi,"[SIZE=1]");
			text=text.replace(/\[size=100\]/gi,"[SIZE=2]");
			text=text.replace(/\[size=120\]/gi,"[SIZE=3]");
			text=text.replace(/\[size=130\]/gi,"[SIZE=4]");
			text=text.replace(/\[size=150\]/gi,"[SIZE=5]");
			text=text.replace(/\[size=170\]/gi,"[SIZE=6]");
			text=text.replace(/\[size=200\]/gi,"[SIZE=7]");
		}
		else{//Hoteditor size to phpBB size 
			text=text.replace(/\[size=1\]/gi,"[SIZE=85]");
			text=text.replace(/\[size=2\]/gi,"[SIZE=100]");
			text=text.replace(/\[size=3\]/gi,"[SIZE=120]");
			text=text.replace(/\[size=4\]/gi,"[SIZE=130]");
			text=text.replace(/\[size=5\]/gi,"[SIZE=150]");
			text=text.replace(/\[size=6\]/gi,"[SIZE=170]");
			text=text.replace(/\[size=7\]/gi,"[SIZE=200]");					
		}				
		return text;
	}						
</script>	
	<!-- IF S_SMILIES_ALLOWED and .smiley -->
		<br /><strong>{L_SMILIES}</strong><br />
		<!--//HotEditor MOD -->
		<!-- BEGIN smiley -->
			<span style="curror:pointer;" onmousedown="if(editor_type=='1'){WriteHTML('<img src={smiley.SMILEY_IMG}>','editor');}else{WriteTEXT('[IMG]{smiley.SMILEY_IMG}[/IMG]','editor');}"><img src="{smiley.SMILEY_IMG}" width="{smiley.SMILEY_WIDTH}" height="{smiley.SMILEY_HEIGHT}" alt="{smiley.SMILEY_CODE}" title="{smiley.SMILEY_DESC}" /></span>
		<!-- END smiley -->
	<!-- ENDIF -->
	<!-- IF S_SHOW_SMILEY_LINK and S_SMILIES_ALLOWED -->
		<br /><a href="posting.php?mode=smilies" onclick="popup(this.href, 300, 350, '_phpbbsmilies'); return false;">{L_MORE_SMILIES}</a>
	<!-- ENDIF -->
<!-- //HotEditor MOD END -->

#
#-----[ SAVE & CLOSE ]-----
#

ps.
清除論壇快取檔案.