Author |
Topic |
|
Halus
Starting Member
20 Posts |
Posted - 04 March 2001 : 04:38:25
|
Due to Davio's suggestion, I start a new thread here to continue discussion on Forum Code Editor ------------------------ The modified one has some advantages: 1. add code at exactly where the flag located, but not the very end of text
2. add code to the selected paragraph, both in the beginning and and the end of some selected paragraph
3. new function as [iframe][/iframe]
4. the size and color option is modified so that repeated selection of the same color is possible ------------------------ the modified code there
I think the center of the change in post.asp begin since line 429 of the zipped file. and the most important function is ============== function getActiveText(selectedtext) { text = (document.all) ? document.selection.createRange().text : document.getSelection(); if (selectedtext.createTextRange) { selectedtext.caretPos = document.selection.createRange().duplicate(); } return true; } function AddText(NewCode) { if (document.PostTopic.message.createTextRange && document.PostTopic.message.caretPos) { var caretPos = document.PostTopic.message.caretPos; caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? NewCode + ' ' : NewCode; } else { document.PostTopic.message.value+=NewCode } setfocus(); }
==============
this modification is based on one far earlier version, and the code is moderately changed for localization, but I think maybe someone can put it into current version if he likes it demo: http://musiz.adsldns.org/
|
|
StockholmStudent
Junior Member
Sweden
329 Posts |
Posted - 04 March 2001 : 05:05:35
|
Does it work in both Netscape and Internet Explorer?
AND WHY AINT THE E-MAIL NOTIFICATION WORKIN!??????
|
|
|
Halus
Starting Member
20 Posts |
Posted - 04 March 2001 : 05:23:05
|
Sorry, the code is not written by me and I post these codes because some members asked for it I myself use IE only and I don't know what it looks like on NE the email function? I'm not sure, maybe I cut it someday just because I did not need it Sorry
|
|
|
Davio
Development Team Member
Jamaica
12217 Posts |
|
StockholmStudent
Junior Member
Sweden
329 Posts |
Posted - 04 March 2001 : 13:34:19
|
quote:
Darn! It doesn't work in Netscape. Didn't realize it. Oh well. I have it working here: http://www.dsilvera.com/beta/31_sr4/link.asp?TOPIC_ID=13
if you are using IE.
well, I thought so... I dont even think it workes at all in Netscape when using this function. The more The Snitz Forum is developed, the more is a netscape and an explorer version needed, maybe in setup for the users, they can choose if using netscape or explorer. Cause I also know that Netscape has some difficulties with CSS...... which is a great coding. I like the colors u use... may I take them for mine too? :)
cheers /CHEETAH
|
|
|
Davio
Development Team Member
Jamaica
12217 Posts |
Posted - 04 March 2001 : 13:44:56
|
quote: I like the colors u use... may I take them for mine too?
Sure. I just used the Templates Mod for it.
|
|
|
rick7165
Senior Member
USA
1094 Posts |
Posted - 04 March 2001 : 14:25:44
|
Can someone explain or show how to add this to SR4? I'm kind of confussed what to do here...
Confussed is not hard for me to become! LOL
Rick
Test Site www.eastpasco.com Running on HuwR's SR4 release. Colors and Graphic scheme done by Richard Kinser. |
|
|
Davio
Development Team Member
Jamaica
12217 Posts |
Posted - 04 March 2001 : 14:41:20
|
LoL, sorry rick. I guess Halus's post wasn't all that clear on how to add the code.
I inserted the following code in inc_code.asp after the thelp(swtch) function:function getActiveText(selectedtext) { text = (document.all) ? document.selection.createRange().text : document.getSelection(); if (selectedtext.createTextRange) { selectedtext.caretPos = document.selection.createRange().duplicate(); } return true; }
function AddText(NewCode) { if (document.PostTopic.Message.createTextRange && document.PostTopic.Message.caretPos) { var caretPos = document.PostTopic.Message.caretPos; caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? NewCode + ' ' : NewCode; } else { document.PostTopic.Message.value+=NewCode } setfocus(); }
function setfocus() { document.PostTopic.Message.focus(); } The AddText() function in this code is replacing the one currently in the file.
And in post.asp look for the following code:<td bgColor="<% =strPopUpTableColor %>"><textarea cols="<%=intCols %>" name="Message" rows="<%=intRows %>" wrap="VIRTUAL"><% =Trim(CleanCode(TxtMsg))%></textarea><br> And replace it with this:<td bgColor="<% =strPopUpTableColor %>"><textarea cols="<%=intCols %>" name="Message" rows="<%=intRows %>" wrap="VIRTUAL" onfocus="getActiveText(this)" onclick="getActiveText(this)" onchange="getActiveText(this)"><% =Trim(CleanCode(TxtMsg))%></textarea><br> I didn't add everything that Halus posted, just the code I wanted.
|
|
|
evehawk
New Member
Australia
65 Posts |
|
Aznknight
Senior Member
USA
1373 Posts |
Posted - 08 March 2001 : 03:40:37
|
Halus, Davio, and Evehawk
I tried adding this code to my site and it overwrites the part of the message I've selected when i try to add the formating. Wierd. I did exactly as Davio posted too.
I'm using ie 5.0 browser and I have checked out the demo's available for this and it works fine.
I think it's something wrong on my part but don't know what .
- Alan www.iamviet.com |
|
|
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
Posted - 08 March 2001 : 04:45:56
|
for the code that Halus posted, I had to edit inc_code.asp more.
here is one example (just do this for all instances of like code)
change this:
} else if (basic) { AddTxt="[b][/b]"; AddText(AddTxt);
to this:
} else if (basic) { AddTxt="[b]"+text+"[/b]"; AddText(AddTxt);
make sure near the top of inc_code.asp you place this line:
set text = ""
this is in the file that Halus posted also |
|
|
rick7165
Senior Member
USA
1094 Posts |
Posted - 08 March 2001 : 05:41:33
|
After doing this mod.. what are the draw backs? Netcrap will not work?
Or can they still post just can't use this feature? Just trying to find out before I apply this mod.
Thanks, Rick
Test Site www.eastpasco.com Running on HuwR's SR4 release. Colors and Graphic scheme done by Richard Kinser. |
|
|
Aznknight
Senior Member
USA
1373 Posts |
Posted - 08 March 2001 : 13:31:16
|
thanks richard, that was it.
rick, looking at the code, i think if they are using a netscape browser, it just add the formating code at the end like it's doing now.
Oh one thing, I've noticed...after selecting the text to add the formating and then adding the formating...the mouse cursor becomes the one with the hour glass and stays like that. Is this a bug?
- Alan www.iamviet.com |
|
|
blackinwhite
Average Member
Turkey
657 Posts |
Posted - 11 April 2001 : 12:36:52
|
sorry, I came to that post from another post abut the code addition, it was for it- nothing at all now I could make it work
Edited by - blackinwhite on 11 April 2001 15:52:15 |
|
|
Davio
Development Team Member
Jamaica
12217 Posts |
Posted - 11 April 2001 : 15:38:42
|
What link?
|
|
|
|
Topic |
|