Everything2
Near Matches
Ignore Exact
Full Text
Everything2

E2 node autolinker

created by wonko

(thing) by Canned Yams (6.1 y) (print)   ?   (I like it!) 1 C! Fri May 10 2002 at 22:45:39

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>


printable version
chaos

E2 node autolinker in perl E2 Link and Logger Client E2 Visual Basic hardlinking utility E2 Explorer
Everything2 Auto-Linker That '70s Show A long talk on the beach that answered nothing All this poochie moochie on Everything2 is making me sick!
On being a college radio DJ Node your homework E2 Vim Plugin Absolutely Fabulous
Baruch Goldstein soft link N.F.S. Grundtvig PHP
HTML Webster's Dictionary directory web server
Gemeinhardt World War I linker
Y'know, if you log in, you can write something here, or contact authors directly on the site. Create a New User if you don't already have an account.
  Epicenter
Login
Password

password reminder
register

Everything2 Help

Cool Staff Picks
Things you could have written:
feudalism
Tupperware
Bronze Age
Leonard Cohen
Could a baby eat another baby?
So it goes
Cut and paste writeups will die
Red Dragon
Mac OS X
To what degree does a journalism education benefit a career in print journalism?
hamburger
Raft of the Medusa
How to survive against zombies
New Writeups
trixingee
Dungeon Mastering for the first time(idea)
Netrat0
It's Called Subtext, Honey(person)
eyeofthebeholder
The Dragon(idea)
Heitah
consist, comprise, constitute, or compose(idea)
Meezzio
Gotlandssnus(thing)
argv
Astral Plane(idea)
Madara
One Winged Angel(fiction)
Tom Rook
Talk is cheap(poetry)
shaogo
Adelle Davis(person)
Aerobe
race car g sfjsgsd(poetry)
Binah
Dream Log: July 5, 2008(dream)
StrawberryFrog
Forgotten things in space(idea)
antigravpussy
velvet revolution fairy tale(idea)
Heitah
Nerve agent VX(thing)
Pavlovna
shite(idea)
E2 is a by-product of the existence of The Everything Development Company