This is an autolinker written in Javascript. I've only tested it in Microsoft Internet Explorer 5. It hasn't been tested it in any other browser because IE5 is the only broswer that came with my computer.

Instructions:
Copy and save the source code as an html file. Open the html file. Paste your writeup into the the "Writeup:" text area.

To specify which words to hard link, type the words in the "Words to Link:" text area. Each word has to be on a separate line and there should be no trailing white space after the word.

After specifying the words, choose whether or not the words should match the case exactly (sensitive) or not (insensitive). Then, click Auto Link.

The writeup should now be hardlinked.

I've been working on removing the white space restriction, but I haven't been able to make it work without introducing bugs into the program.

Source Code:


<html><head><title>E2 Javascript Autolinker</title></head><body>
<script language="javascript">
   function auto_link()
   {
     searchstrings=document.list.words.value.split( "\n" );
     searchstrings2=document.writeup.text.value.split( " " );

     for(i=0; i<searchstrings.length; i++)
     {
       for(j=0; j<searchstrings[i].length; j++)
       {
         if(searchstrings[i].charCodeAt(j)=="13")
           searchstrings[i]=searchstrings[i].substring(0, searchstrings[i].length-1);
       }
     }
     for(i=0; i<searchstrings.length; i++)
     {
       if(searchstrings[i].length!=0)
       {
         for(j=0; j<searchstrings2.length; j++)
         {
           searchstrings3=searchstrings2[j].split("\n");

           for(k=0; k<searchstrings3.length; k++)
           {
             for(l=0; l<searchstrings3[k].length; l++)
             {
               if(searchstrings3[k].charCodeAt(l)=="13")
                 searchstrings3[k]=searchstrings3[k].substring(0, searchstrings3[k].length-1);
             }

             if(document.list.wordcase[0].checked)
             {
               lowerss=searchstrings[i].toLowerCase();
               lowerss3=searchstrings3[k].toLowerCase();

               if(lowerss==lowerss3)
                 searchstrings3[k]="["+searchstrings3[k]+"]";
             }
             else
             {
               if(searchstrings3[k]==searchstrings[i])
                 searchstrings3[k]="["+searchstrings[i]+"]";
             }
           }
           searchstrings2[j]=searchstrings3.join("\n");       
         }
       }
     }
     linkedtext=searchstrings2.join( " ");
     document.writeup.text.value=linkedtext;
     document.writeup.text.select();
   }

   function sort()
   {
     var searchstrings2 = new Array();
     searchstrings=document.list.words.value.split( "\n" );
     searchstrings=searchstrings.sort();
     ss2index=0;
     for(i=0; i<searchstrings.length; i++)
     {
       if(searchstrings[i].length!=0)
       {
         searchstrings2[ss2index]=searchstrings[i];
         ss2index++;
       }
     }

     document.list.words.value=searchstrings2.join("\n");
   }
</script>
<table align="center" border=0 bordercolor=green>
  <tr>
    <td colspan="2">This was made for very long writeups.<br>
                    All the words need to be typed in the left text area.<br>
                    Each word needs to be on a separate line and should not have any trailing white space.
.<br>
                    This will not link words that are concatenated with other characters besides
                    the given word.
                    <p>For example, specifying "zebra" will not link "zebra" in sentences such
                    as these:
                    <ul><li>He fed the baby zebras and the hungry zebra.</li><br>
                    --It won't link to it because there is an s in the first zebra and a period
                    in the second.
                    <li>He said, "Zebra is a type of animal."</li><br>
                    --It won't link to it because there is a double quotation mark concatenated
                    with zebra.
                    </ul></p>
    </td>
  </tr>
<tr>
   <td align="center"><h2>Words to link:</h2></td>
   <td align="center"><h2>Writeup:</h2></td>
</tr>
  <tr>
    <td align="center">
      <table border=0 bordercolor=red cellspacing="5">
        <tr><td><form name="list"><textarea name="words" rows="10" cols="23"></textarea>
            </td></tr>
        <tr><td>Case Match:<br>Insensitive:
            <input type="radio" name="wordcase" value="1" checked="checked">&nbsp;&nbsp;
            &nbsp;Sensitive:<input type="radio" name="wordcase" value="2"></td></tr>
        <tr><td align="center"><input type="button" value="Sort List" onclick="sort()">
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="reset" value="Clear Data"></form>
            </td></tr>
      </table>
    </td>
    <td align="center" valign="top">
      <table border=0 bordercolor=blue cellspacing="5">
        <tr><td><form name="writeup"><textarea name="text" rows="10" cols="49"></textarea>
            </td></tr>
        <tr><td align="center"><input type="button" value="Auto Link" onclick="auto_link()">
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="reset" value="Clear Text">
            </form></td></tr>
      </table>
    </td>
  </tr>
</table>
</body></html>

Log in or registerto write something here or to contact authors.