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)
 Better Format functions in the Editor, code
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

polpot
Starting Member

11 Posts

Posted - 29 November 2002 :  11:20:12  Show Profile
I have hacked the asp files so that the Format: bar in the post new topic/reply editor works better.

Making a list of several lines just by highlighting them is now possible.

I supply the code under here:
The only thing you will need is to create 4 new icons: icon_editor_listalpha (alphabetical list)
icon_editor_listnum (numbered list)
icon_editor_heading4
icon_editor_heading5

The icons have been put into http://sectorzerox.sytes.net/icons.zip. Thanks ZeroAvengerX!

Ok, the code:


File: inc_code.js
Delete the function list().
Add the following code somewhere in the file:
Note! This forum cannot avoid decoding everything like [ list ]...[ /list] even though it is put between [ code][ /code],
so I advise to copy the text to wordpad and run replace on all "[ " to "[".



function list() {
	var text = getText();
	if (helpstat) {
		alert("List Tag Builds a bulleted list.\n\nUSE: [ list] [ *]item1[ /*] [ *]item2[ /*] [ *]item3[ /*] [ /list]");
	} else if (basic) {
		//Discover line breaks and embrace the list items.
		AddTxt="[ list]";
		while (1) {
			j = text.indexOf("\n");
			if ((j==-1) || (text=="")) {
				AddTxt+="[ *]"+text+"[ /*]";
				break;
			}
			else {
				AddTxt+="[ *]"+text.substr(0, j-1)+"[ /*]\n";
			}
			text = text.substr(j+1,text.length+1);
		}
		AddTxt+="[ /list]";
		AddText(AddTxt);
	} else {
		if (text) {
			txt=prompt("Text to be listed",text);
		} else {
			txt=prompt("Text to be listed","Text");
		}
		if (txt!=null) {
			AddTxt="[ list][ *] "+txt+"[ /*][ /list]";
			AddText(AddTxt);
		}
	}
}

function listalpha() {
	var text = getText();
	if (helpstat) {
		alert("List Tag Builds a alphabetical list.\n\nUSE: [ list=a] [ *]item1[ /*] [ *]item2[ /*] [ *]item3[ /*] [ /list=a]");
	} else if (basic) {
		//Discover line breaks and embrace the list items.
		AddTxt="[ list=a]";
		while (1) {
			j = text.indexOf("\n");
			if ((j==-1) || (text=="")) {
				AddTxt+="[ *]"+text+"[ /*]";
				break;
			}
			else {
				AddTxt+="[ *]"+text.substr(0, j-1)+"[ /*]\n";
			}
			text = text.substr(j+1,text.length+1);
		}
		AddTxt+="[ /list=a]";
		AddText(AddTxt);
	} else {
		if (text) {
			txt=prompt("Text to be listed",text);
		} else {
			txt=prompt("Text to be listed","Text");
		}
		if (txt!=null) {
			AddTxt="[ list=a][ *] "+txt+"[ /*][ /list=a]";
			AddText(AddTxt);
		}
	}
}

function listnum() {
	var text = getText();
	if (helpstat) {
		alert("List Tag Builds a numbered list.\n\nUSE: [ list=1] [ *]item1[ /*] [ *]item2[ /*] [ *]item3[ /*] [ /list=1]");
	} else if (basic) {
		//Discover line breaks and embrace the list items.
		AddTxt="[ list=1]";
		while (1) {
			j = text.indexOf("\n");
			if ((j==-1) || (text=="")) {
				AddTxt+="[ *]"+text+"[ /*]";
				break;
			}
			else {
				AddTxt+="[ *]"+text.substr(0, j-1)+"[ /*]\n";
			}
			text = text.substr(j+1,text.length+1);
		}
		AddTxt+="[ /list=1]";
		AddText(AddTxt);
	} else {
		if (text) {
			txt=prompt("Text to be listed",text);
		} else {
			txt=prompt("Text to be listed","Text");
		}
		if (txt!=null) {
			AddTxt="[ list=1][ *] "+txt+"[ /*][ /list=1]";
			AddText(AddTxt);
		}
	}
}

function heading4() {
	var text = getText();
  	if (helpstat) {
		alert("Heading4 Tag converts the enclosed text to a heading size 4.\n\nUSE: [ h4]This text is Heading4[ /h4]");
	} else if (basic) {
		AddTxt="[ h4]" + text + "[ /h4]";
		AddText(AddTxt);
	} else {
		if (text) {
			txt=prompt("Text to be a Heading4.",text);
		} else {
			txt=prompt("Text to be Heading4.","Text");
		}
		if (txt!=null) {
			AddTxt="[ h4]"+txt+"[ /h4]";
			AddText(AddTxt);
		}
	}
}

function heading5() {
	var text = getText();
  	if (helpstat) {
		alert("Heading5 Tag converts the enclosed text to a heading size 5.\n\nUSE: [ h5]This text is Heading5[ /h5]");
	} else if (basic) {
		AddTxt="[ h5]" + text + "[ /h5]";
		AddText(AddTxt);
	} else {
		if (text) {
			txt=prompt("Text to be a Heading4.",text);
		} else {
			txt=prompt("Text to be Heading4.","Text");
		}
		if (txt!=null) {
			AddTxt="[ h5]"+txt+"[ /h5]";
			AddText(AddTxt);
		}
	}
}



File: inc_iconfiles.asp
Add the following:


Const strIconEditorListalpha = "icon_editor_listalpha.gif|23|22"
Const strIconEditorListnum = "icon_editor_listnum.gif|23|22"
Const strIconEditorHeading4 = "icon_editor_heading4.gif|23|22"
Const strIconEditorHeading5 = "icon_editor_heading5.gif|23|22"



File:inc_post_buttons.asp
Search for strIconEditorList and make the section look like this:
It is probably safest to replace the entire Respons.Write statement to get it right. ALL RED CHARACTERS MUST BE THERE!!!


Response.Write	"                <a href=""Javascript:showcode();"" tabindex=""-1"">" & getCurrentIcon(strIconEditorCode,"Insert Code","align=""top""") & "</a>" & _
		"<a href=""Javascript:quote();"" tabindex=""-1"">" & getCurrentIcon(strIconEditorQuote,"Insert Quote","align=""top""") & "</a>" & _
		"<a href=""Javascript:list();"" tabindex=""-1"">" & getCurrentIcon(strIconEditorList,"Insert List","align=""top""") & "</a>" & _
		"<a href=""Javascript:listnum();"" tabindex=""-1"">" & getCurrentIcon(strIconEditorListnum,"Insert Numbered List","align=""top""") & "</a>" & _
		"<a href=""Javascript:listalpha();"" tabindex=""-1"">" & getCurrentIcon(strIconEditorListalpha,"Insert Alphabetic List","align=""top""") & "</a>" & vbNewLine & _
		"<a href=""Javascript:heading4();"" tabindex=""-1"">" & getCurrentIcon(strIconEditorHeading4,"Insert Heading4","align=""top""") & "</a>" & _
		"<a href=""Javascript:heading5();"" tabindex=""-1"">" & getCurrentIcon(strIconEditorHeading5,"Insert Heading5","align=""top""") & "</a>" & vbNewLine

Edited by - polpot on 03 December 2002 08:13:43

polpot
Starting Member

11 Posts

Posted - 02 December 2002 :  08:31:24  Show Profile
If someone has an idea of a webserver where I can put the icons, you are free to suggest it here.
Go to Top of Page

ZeroAvengerX
Starting Member

USA
48 Posts

Posted - 02 December 2002 :  14:40:38  Show Profile  Visit ZeroAvengerX's Homepage  Send ZeroAvengerX an AOL message  Send ZeroAvengerX a Yahoo! Message
i'll volunteer mine if you want just e-mail me we could put it up
Go to Top of Page

jeffery
Junior Member

USA
176 Posts

Posted - 02 December 2002 :  19:34:36  Show Profile
Got a demo of this?

www.thomasforum.com
Go to Top of Page

polpot
Starting Member

11 Posts

Posted - 03 December 2002 :  08:17:51  Show Profile
No, I haven't. You can implement it if you want to be the first one to volunteer. But several other forums have already implemented it.

Edited by - polpot on 03 December 2002 08:19:56
Go to Top of Page

user_99
Starting Member

Austria
10 Posts

Posted - 10 December 2002 :  09:41:52  Show Profile
a fine litte 'mod'

works great, thx
Go to Top of Page
  Previous Topic Topic Next Topic  
 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.17 seconds. Powered By: Snitz Forums 2000 Version 3.4.07