Author |
Topic  |
|
evehawk
New Member

Australia
65 Posts |
Posted - 16 January 2001 : 02:36:07
|
Note: This mod only work in IE4 and later, it does not work with Netscape sorry. Update: added a simple browser check, if user's browser is not IE4 then the format button will behave like the old way (it insert code at the end of the text entry area)
Snitz version SR4
This allow you insert the formating codes or smilie at the right cursor position. You also can highlight and format a block of text.
Files change:
Post.asp inc_post_buttons.asp pop_icon_legend.asp
Instruction:
Modify to Post.asp:
Search for this line:
<textarea cols="<%=intCols %>" name="Message" rows="<%=intRows %>" wrap="VIRTUAL">
Replace with this:
<textarea cols="<%=intCols %>" name="Message" rows="<%=intRows %>" wrap="VIRTUAL" ONSELECT="storePos(this);" ONCLICK="storePos(this);" ONKEYUP="storePos(this);" ONDBLCLICK="storePos(this);" >
Modify to pop_icon_legend.asp:
Find these code at the start of the page:
<script language="Javascript"> <!-- hide
function insertsmilie(smilieface){
window.opener.document.PostTopic.Message.value+=smilieface; } // --> </script>
Replace with this:
<SCRIPT LANGUAGE="JavaScript"> <!-- Hide if (navigator.appVersion.substring(0,1) == '4' && navigator.appName == "Microsoft Internet Explorer") bok = true else bok = false // End --> </script>
<script language="Javascript"> <!-- hide
function insertsmilie(smilieface){ if (bok){ opener.document.PostTopic.Message.focus(); opener.document.PostTopic.Message.onclick(); var caretPos = opener.document.PostTopic.Message.caretPos; opener.document.PostTopic.Message.caretPos.text = smilieface; window.document.focus(); } else { window.opener.document.PostTopic.Message.value+=smilieface; } }
// --> </script>
Download and overwrite your inc_post_buttons.asp with this file: inc_post_buttons.asp If you have smilie mode install, you will need to modify your current inc_post_buttons.asp file. It is a simple and straight forward job if you take time to study my inc_post_buttons.asp file.
Thats it :)
If you have netscape and test this please let me know how bad it turn out :P
Note about graphic icons: all my button icons locate in the directory /images/ please create and copy yours.
extra icon: icon_editor_bullet.gif  right click and save the picture to your folder.
Edited by - evehawk on 17 January 2001 01:16:02 |
|
RichardKinser
Snitz Forums Admin
    
USA
16655 Posts |
Posted - 16 January 2001 : 04:27:08
|
eve, great job!
I made one small change so that text you enter in the javascript boxes will also get inserted at the cursor position instead of at the end:
This is in your inc_post_buttons.asp on line #63
replace this:
AddTxt=startmycode+txt+endmycode; AddText(AddTxt);
with this:
var caretPos = mytext.caretPos; caretPos.text=startmycode + txt + endmycode; |
 |
|
evehawk
New Member

Australia
65 Posts |
Posted - 16 January 2001 : 04:34:58
|
Thanks Richard,
inc_post_buttons.asp updated.
|
 |
|
StockholmStudent
Junior Member
 
Sweden
329 Posts |
Posted - 16 January 2001 : 08:42:06
|
I can't find this line: <textarea cols="<%=intCols %>" name="Message" rows="<%=intRows %>" wrap="VIRTUAL">
I only find this one: <textarea cols="70" name="Message" rows="10" wrap="VIRTUAL"> |
 |
|
StockholmStudent
Junior Member
 
Sweden
329 Posts |
Posted - 16 January 2001 : 08:42:52
|
quote:
I can't find this line: <textarea cols="<%=intCols %>" name="Message" rows="<%=intRows %>" wrap="VIRTUAL">
I only find this one: <textarea cols="70" name="Message" rows="10" wrap="VIRTUAL">
ah! now I remember.. I think I've changed it ! :) |
 |
|
StockholmStudent
Junior Member
 
Sweden
329 Posts |
Posted - 16 January 2001 : 08:59:27
|
OK. I did all the changes. But it doesnt work. Nothin happens when I click the buttons! Whats wrong? |
 |
|
RichardKinser
Snitz Forums Admin
    
USA
16655 Posts |
Posted - 16 January 2001 : 09:18:30
|
What version of the forum are you using? |
 |
|
StockholmStudent
Junior Member
 
Sweden
329 Posts |
Posted - 16 January 2001 : 09:37:30
|
quote:
What version of the forum are you using?
Im using version [Snitz Forums 2000 Version 3.1 final] due to the admin system...  |
 |
|
evehawk
New Member

Australia
65 Posts |
Posted - 16 January 2001 : 09:42:54
|
StockholmStudent,
Do a quick check: 1. look in your Post.asp for this line:
<form action="post_info.asp" method="post" name="PostTopic">
2. Paste the line:
<textarea cols="<%=intCols %>" name="Message" rows="<%=intRows %>" wrap="VIRTUAL"
exactly as it is
3. Your browser must be IE 4.xx or about, no netscape
The red bits are important as the function need the form and field name to work.
Edited by - evehawk on 16 January 2001 09:44:36 |
 |
|
StockholmStudent
Junior Member
 
Sweden
329 Posts |
Posted - 16 January 2001 : 09:45:32
|
quote:
StockholmStudent,
Do a quick check: 1. look in your Post.asp for this line:
<form action="post_info.asp" method="post" name="PostTopic">
2. From above Paste the line:
<textarea cols="<%=intCols %>" name="Message" rows="<%=intRows %>" wrap="VIRTUAL"
exactly as it is
3. Your browser must be IE 4.xx or about, no netscape
The red bits are important as the function need the form and field name to work.
I have IE. But do you mean that this thing wont work for netscape users!? than I wont do this! thanks anyway! sorry for any trouble. 
oh, by the way! Please make your own forum a bit more attractive! Add all the mods and such, so that this forum becomes a living demo of the very full one with all the mods! okay!?
cheers /CHEETAH |
 |
|
evehawk
New Member

Australia
65 Posts |
Posted - 16 January 2001 : 09:52:04
|
heh which one of mine you talking about StockholmStudent ? I do have mods installed on some of them but most are hidden away untill you register :) Also i am bad with color and stuff.. if you want to see an attractive forum .. Look at Richard kinser's one.. its very nice :) Netscape does not support the javascript function i use, sorry
Edited by - evehawk on 16 January 2001 09:53:21 |
 |
|
StockholmStudent
Junior Member
 
Sweden
329 Posts |
Posted - 16 January 2001 : 09:53:56
|
quote:
heh which one of mine you talking about StockholmStudent ? I do have mods installed on some of them but most are hidden away untill you register :) Also i am bad with color and stuff.. if you want to see an attractive forum .. Look at Rihard's one.. its very nice :) Netscape does not support the javascript function i use, sorry
I mean the one that Im writing in right now!!!!!!!!! Snitz OWN forum! hehe! No accusation to you buddy! :)
cheers /CHEETAH -- Sweden
|
 |
|
evehawk
New Member

Australia
65 Posts |
Posted - 16 January 2001 : 09:56:13
|

I updated the code above so this thing work with all browsers.(see 1st post)
if you use browser that not IE4 plus please let me know how this fix goes. Thanks 
Edited by - evehawk on 17 January 2001 01:11:44 |
 |
|
RichardKinser
Snitz Forums Admin
    
USA
16655 Posts |
Posted - 17 January 2001 : 02:19:13
|
eve,
I made one other small change. Instead of having the faq.asp popup when someone chooses help, I made the following change so that it will still popup the alert boxes:
in inc_post_buttons.asp :
(in this example I am using the one for bold)
change this:
<a href="Javascript:if (bok) insertMyCode(document.PostTopic.Message, document.PostTopic.mytext,'',''); else bold();">
to this:
<a href="Javascript:if (helpstat) bold(); else if (bok) insertMyCode(document.PostTopic.Message, document.PostTopic.mytext,'',''); else bold();">
Edited by - Richard Kinser on 17 January 2001 02:19:45 |
 |
|
evehawk
New Member

Australia
65 Posts |
Posted - 17 January 2001 : 04:00:36
|
Thanks Richard, yes it a better idea as it stay close to snitz origin :)
inc_post_buttons.asp updated

|
 |
|
|
Topic  |
|