Author |
Topic |
Nathan
Help Moderator
USA
7664 Posts |
Posted - 16 November 2003 : 02:03:01
|
I'm not exactly sure which mozilla versions support this, I know and have tested it in 1.5 (and Firebird), and expect it works in 1.4. It might work in 1.3 . . . but I didn't include that version in this mod.
This mod will allow users of Mozilla and Mozilla based browsers to insert format tags into the middle of their textarea like is already done for IE.
In file inc_code.js replace this:
//function AddText(NewCode) {
// document.PostTopic.Message.value+=NewCode
//}
function AddText(NewCode) {
if (document.PostTopic.Message.createTextRange && document.PostTopic.Message.caretPos) {
var caretPos = document.PostTopic.Message.caretPos;
caretPos.text = NewCode;
} else {
document.PostTopic.Message.value+=NewCode;
}
document.PostTopic.Message.focus();
}
With this:
//function AddText(NewCode) {
// document.PostTopic.Message.value+=NewCode
//}
/*function AddText(NewCode) {
if (document.PostTopic.Message.createTextRange && document.PostTopic.Message.caretPos) {
var caretPos = document.PostTopic.Message.caretPos;
caretPos.text = NewCode;
} else {
document.PostTopic.Message.value+=NewCode;
}
document.PostTopic.Message.focus();
}*/
function AddText(text) {
var tarea = document.PostTopic.Message;
if (typeof tarea.selectionStart != 'undefined'){ // 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 - end) == 0) ? start + text.length : 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);
}
}
And replace this
function getText() {
if (document.PostTopic.Message.createTextRange && document.PostTopic.Message.caretPos) {
return document.PostTopic.Message.caretPos.text;
} else {
return '';
}
}
with this
/*function getText() {
if (document.PostTopic.Message.createTextRange && document.PostTopic.Message.caretPos) {
return document.PostTopic.Message.caretPos.text;
} else {
return '';
}
}*/
function getText() {
var tarea = document.PostTopic.Message;
if (tarea.createTextRange && tarea.caretPos) {
return tarea.caretPos.text;
} else if (typeof tarea.selectionStart != 'undefined'){
return tarea.value.substr(tarea.selectionStart,tarea.selectionEnd-tarea.selectionStart)
}
return '';
}
And finally in inc_smilies.asp replace this
" if (document.PostTopic.Message.createTextRange && document.PostTopic.Message.caretPos) {" & vbNewLine & _
" var caretPos = document.PostTopic.Message.caretPos;" & vbNewLine & _
" caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? smilieface + ' ' : smilieface;" & vbNewLine & _
" document.PostTopic.Message.focus();" & vbNewLine & _
" } else {" & vbNewLine & _
" document.PostTopic.Message.value+=smilieface;" & vbNewLine & _
" document.PostTopic.Message.focus();" & vbNewLine & _
" }" & vbNewLine & _
with this
" AddText(smilieface);" & vbNewLine & _
|
Nathan Bales CoreBoard | Active Users Download |
Edited by - Nathan on 23 June 2004 07:22:16 |
|
MarcelG
Retired Support Moderator
Netherlands
2625 Posts |
Posted - 16 November 2003 : 07:01:19
|
sorry nathan, but whát does it do ?
quote: This mod will allow users of Mozilla and Mozilla based browsers to insert format tags into the middle of their textarea like is already done for IE.
It doesn't really make sense to me...sorry... |
portfolio - linkshrinker - oxle - twitter |
|
|
altisdesign
Junior Member
United Kingdom
357 Posts |
Posted - 16 November 2003 : 07:07:28
|
When you are on the "post a new topic" and the "reply to topic" page, you have the formatting buttons (eg. Bold, Italics etc.). I think the mod is to make these buttons work in Mozilla browser, where they previously did not work correctly like they do in Internet explorer, to make it easier for users of these browsers to format text as it should |
Altis Design offers all manner of web design services to a variety of commercial and personal clients |
|
|
MarcelG
Retired Support Moderator
Netherlands
2625 Posts |
|
HuwR
Forum Admin
United Kingdom
20584 Posts |
Posted - 16 November 2003 : 07:28:32
|
we could also do with some confirmation from mozilla users that it works |
|
|
aspwiz
Junior Member
250 Posts |
Posted - 16 November 2003 : 08:52:21
|
Brilliant Mod!!
I can confirm this does NOT work in Opera 7.21. The tags get inserted into the end of the post (the problem could be as simple as, when you click the button, you deslect your section so it puts the tags at the end)
Can Mozilla and netscape users confirm this does or does not work, along with what does actually happen? |
|
|
aspwiz
Junior Member
250 Posts |
Posted - 16 November 2003 : 08:53:23
|
I think this should be included in the next version's base code. |
|
|
HuwR
Forum Admin
United Kingdom
20584 Posts |
Posted - 16 November 2003 : 09:04:04
|
it is not supposed to work in Opera.
it will be included if some mozilla users confirm that it works |
|
|
cripto9t
Average Member
USA
881 Posts |
Posted - 16 November 2003 : 11:29:32
|
- Netscape 6.2 - Yes
- Netscape 7.0 - No
Thanks Nathan |
_-/Cripto9t\-_ |
|
|
Nathan
Help Moderator
USA
7664 Posts |
Posted - 16 November 2003 : 16:18:10
|
It works in Netscape 6.2?
It should Work in Netscape 7.1 because its based on Mozilla 1.4 |
Nathan Bales CoreBoard | Active Users Download |
|
|
homeacademy
Junior Member
USA
163 Posts |
Posted - 16 November 2003 : 17:57:52
|
Tested NS 7.1 - kinda.
All format buttons work, with the exception of HR, Bullets, and smilies. HR inserts in the middle but adds an extra close bracket. Bullets return weird stuff in the middle. Smilies insert at the end. |
|
|
Davio
Development Team Member
Jamaica
12217 Posts |
Posted - 16 November 2003 : 23:08:16
|
Checked it with Mozilla Firebird 0.7.
The HR tag comes out like this: [hr]] The List tag comes out like this: [list][*]
But at least they are inserted where the cursor is. |
Support Snitz Forums
|
|
|
Nathan
Help Moderator
USA
7664 Posts |
Posted - 16 November 2003 : 23:49:19
|
Yeah, actually, I was investigating this and found a rather large bug. This is going to get a whole lot more complex. |
Nathan Bales CoreBoard | Active Users Download |
|
|
Nathan
Help Moderator
USA
7664 Posts |
Posted - 17 November 2003 : 00:04:06
|
Ok, so not a whole lot more complex. But the previous issues should be fixed.
Smilies are still at the end. I havn't yet looked for the insert smilie function, its located somewhere else. |
Nathan Bales CoreBoard | Active Users Download |
Edited by - Nathan on 17 November 2003 00:05:04 |
|
|
Nathan
Help Moderator
USA
7664 Posts |
|
Davio
Development Team Member
Jamaica
12217 Posts |
|
Topic |
|