Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 MicroMod: Insert Tags for Mozilla (Take 4)
 New Topic  Topic Locked
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 4

Nathan
Help Moderator

USA
7664 Posts

Posted - 16 November 2003 :  02:03:01  Show Profile  Visit Nathan's Homepage
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  Show Profile  Visit MarcelG's Homepage
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
Go to Top of Page

altisdesign
Junior Member

United Kingdom
357 Posts

Posted - 16 November 2003 :  07:07:28  Show Profile
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
Go to Top of Page

MarcelG
Retired Support Moderator

Netherlands
2625 Posts

Posted - 16 November 2003 :  07:16:40  Show Profile  Visit MarcelG's Homepage
ah! now I see! Thanks altisdesign!

portfolio - linkshrinker - oxle - twitter
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20579 Posts

Posted - 16 November 2003 :  07:28:32  Show Profile  Visit HuwR's Homepage
we could also do with some confirmation from mozilla users that it works
Go to Top of Page

aspwiz
Junior Member

250 Posts

Posted - 16 November 2003 :  08:52:21  Show Profile  Visit aspwiz's Homepage
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?
Go to Top of Page

aspwiz
Junior Member

250 Posts

Posted - 16 November 2003 :  08:53:23  Show Profile  Visit aspwiz's Homepage
I think this should be included in the next version's base code.
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20579 Posts

Posted - 16 November 2003 :  09:04:04  Show Profile  Visit HuwR's Homepage
it is not supposed to work in Opera.

it will be included if some mozilla users confirm that it works
Go to Top of Page

cripto9t
Average Member

USA
881 Posts

Posted - 16 November 2003 :  11:29:32  Show Profile
  • Netscape 6.2 - Yes
  • Netscape 7.0 - No

Thanks Nathan

    _-/Cripto9t\-_
Go to Top of Page

Nathan
Help Moderator

USA
7664 Posts

Posted - 16 November 2003 :  16:18:10  Show Profile  Visit Nathan's Homepage
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
Go to Top of Page

homeacademy
Junior Member

USA
163 Posts

Posted - 16 November 2003 :  17:57:52  Show Profile
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.
Go to Top of Page

Davio
Development Team Member

Jamaica
12217 Posts

Posted - 16 November 2003 :  23:08:16  Show Profile
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
Go to Top of Page

Nathan
Help Moderator

USA
7664 Posts

Posted - 16 November 2003 :  23:49:19  Show Profile  Visit Nathan's Homepage
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
Go to Top of Page

Nathan
Help Moderator

USA
7664 Posts

Posted - 17 November 2003 :  00:04:06  Show Profile  Visit Nathan's Homepage
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
Go to Top of Page

Nathan
Help Moderator

USA
7664 Posts

Posted - 17 November 2003 :  00:15:05  Show Profile  Visit Nathan's Homepage
Ok, got smilies, everything should be accounted for now.

Nathan Bales
CoreBoard | Active Users Download
Go to Top of Page

Davio
Development Team Member

Jamaica
12217 Posts

Posted - 17 November 2003 :  00:22:02  Show Profile
It works properly now.

Support Snitz Forums
Go to Top of Page
Page: of 4 Previous Topic Topic Next Topic  
Next Page
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.26 seconds. Powered By: Snitz Forums 2000 Version 3.4.07