js/jqte/uncompressed/jquery-te-1.4.0.js
function selected2link()
			{
				if(!toolbar.data("sourceOpened"))
				{
					var selectedTag = getSelectedNode(); // the selected node
					var thisHrefLink = "http://"; // default the input value of the link-form-field

					// display the link-form-field
					linkAreaSwitch(true);

					if(selectedTag)
					{
						
						var thisTagName  = selectedTag.prop('tagName').toLowerCase();
						
						// if tag name of the selected node is "a" and the selected node have "href" attribute
						if(thisTagName == "a" && selectedTag.is('[href]'))
						{
							thisHrefLink = selectedTag.attr('href');
							
							selectedTag.attr(setdatalink,"");
						}
						// if it don't have "a" tag name
						else 
							replaceSelection("a",setdatalink,"");
						
					}
					else 
						linkinput.val(thisHrefLink).focus();
					
					// the method of displaying-hiding to link-types
					linktypeselect.click(function(e)
					{
						if($(e.target).hasClass(vars.css+"_linktypetext") || $(e.target).hasClass(vars.css+"_linktypearrow"))
							linktypeSwitch(true);
					});
					
					// the method of selecting to link-types
					linktypes.find("a").click(function()
					{
						var thisLinkType = $(this).attr(vars.css+"-linktype");
						
						linktypes.data("linktype",thisLinkType)
						
						linktypeview.find("."+vars.css+"_linktypetext").html(linktypes.find('a:eq('+linktypes.data("linktype")+')').text());
						
						linkInputSet(thisHrefLink);
						
						linktypeSwitch();
					});
					
					linkInputSet(thisHrefLink);
					
					// the method of link-input
					linkinput
						// auto focus
						.focus()
						// update to value
						.val(thisHrefLink)
						// the event of key to enter in link-input
						.bind("keypress keyup",function(e)
						{
							if(e.keyCode==13)
							{
								linkRecord(jQTE.find("["+setdatalink+"]"));
								return false;
							}
						});
					
					// the event of click link-button
					linkbutton.click(function()
					{
						linkRecord(jQTE.find("["+setdatalink+"]"));
					});
				}
				else
					// hide the link-form-field
					linkAreaSwitch(false);
			}
function selected2link()
			{
				if(!toolbar.data("sourceOpened"))
				{
					var selectedTag = getSelectedNode(); // the selected node
					var thisHrefLink = "http://"; // default the input value of the link-form-field

					// display the link-form-field
					linkAreaSwitch(true);

					if(selectedTag)
					{
						
						var thisTagName  = selectedTag.prop('tagName').toLowerCase();
						
						// if tag name of the selected node is "a" and the selected node have "href" attribute
						if(thisTagName == "a" && selectedTag.is('[href]'))
						{
							thisHrefLink = selectedTag.attr('href');
							
							selectedTag.attr(setdatalink,"");
						}
						// if it don't have "a" tag name
						else 
							replaceSelection("a",setdatalink,"");
						
					}
					else 
						linkinput.val(thisHrefLink).focus();
					
					// the method of displaying-hiding to link-types
					linktypeselect.click(function(e)
					{
						if($(e.target).hasClass(vars.css+"_linktypetext") || $(e.target).hasClass(vars.css+"_linktypearrow"))
							linktypeSwitch(true);
					});
					
					// the method of selecting to link-types
					linktypes.find("a").click(function()
					{
						var thisLinkType = $(this).attr(vars.css+"-linktype");
						
						linktypes.data("linktype",thisLinkType)
						
						linktypeview.find("."+vars.css+"_linktypetext").html(linktypes.find('a:eq('+linktypes.data("linktype")+')').text());
						
						linkInputSet(thisHrefLink);
						
						linktypeSwitch();
					});
					
					linkInputSet(thisHrefLink);
					
					// the method of link-input
					linkinput
						// auto focus
						.focus()
						// update to value
						.val(thisHrefLink)
						// the event of key to enter in link-input
						.bind("keypress keyup",function(e)
						{
							if(e.keyCode==13)
							{
								linkRecord(jQTE.find("["+setdatalink+"]"));
								return false;
							}
						});
					
					// the event of click link-button
					linkbutton.click(function()
					{
						linkRecord(jQTE.find("["+setdatalink+"]"));
					});
				}
				else
					// hide the link-form-field
					linkAreaSwitch(false);
			}
function selected2link ( ) { if ( ! toolbar . data ( "sourceOpened" ) ) { var selectedTag = getSelectedNode ( ) ; // the selected node
 var thisHrefLink = "http://" ; // default the input value of the link-form-field
 // display the link-form-field
 linkAreaSwitch ( true ) ; if ( selectedTag ) { var thisTagName = selectedTag . prop ( 'tagName' ) . toLowerCase ( ) ; // if tag name of the selected node is "a" and the selected node have "href" attribute
 if ( thisTagName == "a" && selectedTag . is ( '[href]' ) ) { thisHrefLink = selectedTag . attr ( 'href' ) ; selectedTag . attr ( setdatalink , "" ) ; } // if it don't have "a" tag name
 else replaceSelection ( "a" , setdatalink , "" ) ; } else linkinput . val ( thisHrefLink ) . focus ( ) ; // the method of displaying-hiding to link-types
 linktypeselect . click ( function ( e ) { if ( $ ( e . target ) . hasClass ( vars . css + "_linktypetext" ) || $ ( e . target ) . hasClass ( vars . css + "_linktypearrow" ) ) linktypeSwitch ( true ) ; } ) ; // the method of selecting to link-types
 linktypes . find ( "a" ) . click ( function ( ) { var thisLinkType = $ ( this ) . attr ( vars . css + "-linktype" ) ; linktypes . data ( "linktype" , thisLinkType ) linktypeview . find ( "." + vars . css + "_linktypetext" ) . html ( linktypes . find ( 'a:eq(' + linktypes . data ( "linktype" ) + ')' ) . text ( ) ) ; linkInputSet ( thisHrefLink ) ; linktypeSwitch ( ) ; } ) ; linkInputSet ( thisHrefLink ) ; // the method of link-input
 linkinput // auto focus
 . focus ( ) // update to value
 . val ( thisHrefLink ) // the event of key to enter in link-input
 . bind ( "keypress keyup" , function ( e ) { if ( e . keyCode == 13 ) { linkRecord ( jQTE . find ( "[" + setdatalink + "]" ) ) ; return false ; } } ) ; // the event of click link-button
 linkbutton . click ( function ( ) { linkRecord ( jQTE . find ( "[" + setdatalink + "]" ) ) ; } ) ; } else // hide the link-form-field
 linkAreaSwitch ( false ) ; }
the function of converting text to link
the function of converting text to link