Author |
Topic |
cripto9t
Average Member
USA
881 Posts |
Posted - 17 November 2003 : 07:38:22
|
Still doesn't work in my NS 7.0, but the smiles now work in IE. The smiles insert right on this forum. Has the code been changed or has it always been this way |
_-/Cripto9t\-_ |
|
|
Nathan
Help Moderator
USA
7664 Posts |
Posted - 17 November 2003 : 11:01:03
|
The smilies should never have been broken in IE. Unless that function I eliminated had a typo in it.
It shouldn't work in Netscape 6.x or 7.0, their Gecko base is too old. |
Nathan Bales CoreBoard | Active Users Download |
Edited by - Nathan on 17 November 2003 11:02:05 |
|
|
zeth
Junior Member
United Kingdom
117 Posts |
Posted - 01 December 2003 : 08:11:18
|
This is a great fix to a horrible problem, everyone should use this now! Thankyou, rant over. |
THEOLOGY.ME.UK CROSSRING.COM |
|
|
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
Posted - 21 January 2004 : 10:08:19
|
implemented this change on this site. You'll probably have to force a refresh to get the new inc_code.js file though.
Will test it for a few days here and if there are no problems, it will be added to the base code. |
|
|
OneWayMule
Dev. Team Member & Support Moderator
Austria
4969 Posts |
|
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
Posted - 21 January 2004 : 11:06:25
|
I tested it with the current nightly build of Firebird for windows:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7a) Gecko/20040120 Firebird/0.8.0+
works fine with that version. |
|
|
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
Posted - 23 January 2004 : 07:35:32
|
ok, I've been doing some more testing of this and noticed some things.
(this is all using Mozilla Firebird)
after inserting text, tags or a smilie inside some existing text, the focus isn't being returned to the textarea
and, after the insertion, the cursor isn't being left immediately after the newly inserted text, it is being placed at the end of the textarea.
I found one site, where this behavior doesn't exist:
http://randomfoo.net/sandbox/mozilla/getselection/
Mozilla's implementation doesn't allow you to just return focus at the caretPos like IE does, you have to figure out the position it should be at by taking the ending position of the selection in the textarea, and add to that # whatever was added during the insertion.
I was able to kludge my way through it and got it to act as expected, but it's not the most elegant solution. I had to manually pass some values based on the length of the tags used and change the addText function further. Then I had to modify all of the smilie tags to also pass a value. But it broke some of the current functionality, so I reverted it all back to the code shown in this post.
I believe that Mozilla is still being actively developed, and this functionality isn't final, and may change. Taking that into account, I think it would be better to leave this as a MOD for right now. It's a pretty simple change, but I don't want to add code to the distribution file that might become obsolete in a few months.
I am open for suggestions though. |
|
|
Nathan
Help Moderator
USA
7664 Posts |
Posted - 18 June 2004 : 20:03:26
|
I streamlined the above code and fixed the return focus.
It should also now work with any browser that supports DOM2 (Safari???) |
Nathan Bales CoreBoard | Active Users Download |
|
|
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
Posted - 18 June 2004 : 21:08:10
|
I implemented Nathan's changed code above on this site. You'll probably have to force a refresh to get the new inc_code.js file though.
Please test this out and report back any problems. |
|
|
Davio
Development Team Member
Jamaica
12217 Posts |
|
Nathan
Help Moderator
USA
7664 Posts |
|
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
Posted - 19 June 2004 : 19:48:37
|
Nathan,
Do you think it would be possible to implement the IE functionality where you can select some text, then click on the one of the buttons (like the Bold button), and then have all of the selected text surrounded by the tags.
For example, in IE you can select some text like this:
selectedtext
and then when you click on the Bold button, it will automatically change the selected text to this:
[b]selectedtext[/b]
I tried doing it with Firefox .9 and it just puts the tags at the very end of all the text in the textarea. |
|
|
Nathan
Help Moderator
USA
7664 Posts |
Posted - 19 June 2004 : 22:12:20
|
Oh, you mean to keep the entire thing selected instead of putting the cursor at the end?
function AddText(text) {
var tarea = document.PostTopic.Message;
if (tarea.selectionStart){ // if it supports DOM2
start = tarea.selectionStart;
end = tarea.selectionEnd;
tarea.value = tarea.value.substr(0,tarea.selectionStart)
+ text + tarea.value.substr(tarea.selectionEnd);
tarea.focus();
tarea.selectionStart = start;
tarea.selectionEnd = start + text.length;
} else {
if (tarea.createTextRange && tarea.caretPos) {
var caretPos = tarea.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
}
else {
tarea.value += text;
}
tarea.focus(caretPos);
}
}
As far as I can this mimics the IE functionality nearly perfectly. The only major difference is that IE keeps the text selected only doesn't highlight the selected part (a bug in IE????) and Mozilla does. |
Nathan Bales CoreBoard | Active Users Download |
|
|
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
Posted - 21 June 2004 : 20:08:35
|
Thanks Nathan,
I tried the changes you posted, but with Firebird .9 it still behaved the same (placed the tags at the end of the textarea instead of around the selected text). |
|
|
Nathan
Help Moderator
USA
7664 Posts |
Posted - 21 June 2004 : 21:19:52
|
I tested that with Firefox .9 (currently my default browser). . . is it really not working for you? |
Nathan Bales CoreBoard | Active Users Download |
Edited by - Nathan on 21 June 2004 21:20:29 |
|
|
Topic |
|