Navigation im World Wide Web als Hypertextsystem (Diplomarbeit von Tobias Steinke)
Inhaltsverzeichnis     AlterNav an     AlterNav aus     Zurück zur Literatur


Anhang: Quellcode von AlterNav

altindex.htm

<html>
<head>
<!-- AlterNav by Tobias Steinke, 1999 -->
<!-- Frameset for alternav.htm -->
<meta name="author" content="Tobias Steinke">
<meta name="created" content="1999">
<meta name="keywords" content="AlterNav, navigation, history">
<title>AlterNav</title>
</head>
<frameset rows="80,*">
   <frame src="alternav.htm" name="AlterNavUp" marginwidth=5 marginheight=5>
   <frame src="index.htm" name="AlterNavDown">
   <noframes>
      <p>Frames only!</p>
   </noframes>
</frameset>
</html>

alternav.htm

<html>
<head>
<!-- AlterNav by Tobias Steinke, 1999 -->
<!-- Called by altindex.htm -->
<title>AlterNav</title>
<script language="JavaScript">
<!--
if(navigator.appVersion.substring(0,1)>="4")
   if(screen.availWidth>=1024)
      location.replace("alternavbig.htm");
var i,j,store=1,display=0;
var titles=new Array(5);
var urls=new Array(5);
var names=new Array(5);
for(i=0;i<5;i++)
{  titles[i]=new Array(11);
   urls[i]=new Array(11);
   names[i]="";
}
for(i=0;i<5;i++)
   for(j=0;j<11;j++)
   {  titles[i][j]=" ";
      urls[i][j]=" ";
   }
for(i=1;i<5;i++)
{  titles[i][0]="History "+i;
   urls[i][0]="History "+i;
}

function InitAlterNav()
{  var i=0,j,k,c;
   if(document.cookie)
   {  c=document.cookie.split("§%");
      if(c[i++]=="AlterNav=")
      {  for(j=1;j<5;j++)
         {  names[j]=MyReplace(c[i++],"§&",";");
            for(k=1;k<11;k++)
            {  titles[j][k]=MyReplace(c[i++],"§&",";");
               urls[j][k]=MyReplace(c[i++],"§&",";");
            }
         }
         document.history.myname.value=names[1];
         for(j=1;j<11;j++)
            document.history.historystore.options[j].text=titles[1][j];
      }
   }
   document.history.historystore.options[0].text=titles[1][0];
   TestChange();
}

function TestChange()
{  var i,j;
   var t=MyReplace(MyReplace(parent.AlterNavDown.document.title,"§%",""),"§&","");
   var u=MyReplace(MyReplace(parent.AlterNavDown.location.href,"§%",""),"§&","");
   if(t!=titles[0][0] || u!=urls[0][0])
   {  for(i=10;i>0;i--)
      {  if(i<10)
         {  if(display==0)
               document.history.list.options[i].text=titles[0][i-1];
            else
               document.history.list.options[i].text=urls[0][i-1];
         }
         titles[0][i]=titles[0][i-1];
         urls[0][i]=urls[0][i-1];
         if(titles[0][i]==t && urls[0][i]==u)
         {  for(j=i;j<10;j++)
            {  if(display==0)
                  document.history.list.options[j].text=titles[0][j+1];
               else
                  document.history.list.options[j].text=urls[0][j+1];
               titles[0][j]=titles[0][j+1];
               urls[0][j]=urls[0][j+1];
            }
         }
      }
      if(display==0)
         document.history.list.options[0].text=t;
      else
         document.history.list.options[0].text=u;
      titles[0][0]=t;
      urls[0][0]=u;
   }
   setTimeout("TestChange()",1000);
}

function Go(store0,index)
{  if(urls[store0][index]!=" " && index>0)
      parent.AlterNavDown.location.href=urls[store0][index];
   if(store0==0)
      document.history.list.selectedIndex=0;
   else
      document.history.historystore.selectedIndex=0;
}

function ClearHistory(index)
{  var i;
   for(i=1;i<11;i++)
   {  titles[index][i]=" ";
      urls[index][i]=" ";
      if(index==0 && i<10)
         document.history.list.options[i].text=" ";
      if(index>0)
         document.history.historystore.options[i].text=" ";
   }
   if(index>0)
      StoreCookie();
}

function StoreCookie()
{  var now=new Date();
   var inayear=new Date(now.getTime()+1000*60*60*24*365);
   var i,j,c="AlterNav=§%";
   for(i=1;i<5;i++)
   {  c+=names[i]+"§%";
      for(j=1;j<11;j++)
      {  c+=titles[i][j]+"§%";
         c+=urls[i][j]+"§%";
      }
   }
   document.cookie=MyReplace(c,";","§&")+"; expires="+inayear.toGMTString()+";";
}

function StoreName()
{  names[store]=MyReplace(MyReplace(document.history.myname.value,"§%",""),"§&","");
   document.history.myname.value=names[store];
   StoreCookie();
}

function Store()
{  var i;
   for(i=0;i<10;i++)
   {  titles[store][i+1]=titles[0][i];
      urls[store][i+1]=urls[0][i];
      if(display==0)
         document.history.historystore.options[i+1].text=titles[0][i];
      else
         document.history.historystore.options[i+1].text=urls[0][i];
   }
   StoreCookie();
}

function Call(index)
{  var i;
   store=index;
   document.history.myname.value=names[store];
   for(i=0;i<11;i++)
   { if(display==0)
        document.history.historystore.options[i].text=titles[store][i];
     else
        document.history.historystore.options[i].text=urls[store][i];
   }
}

function ChangeDisplay()
{  var i;
   display=!display;
   if(display==0)
   {  document.history.tubutton.value=" U ";
      if(document.all)
         document.all.tutitle.title=" Show URLs ";
      for(i=0;i<10;i++)
      {  document.history.list.options[i].text=titles[0][i];
         document.history.historystore.options[i+1].text=titles[store][i+1];
      }
   }
   else
   {  document.history.tubutton.value=" T ";
      if(document.all)
         document.all.tutitle.title=" Show titles ";
      for(i=0;i<10;i++)
      {  document.history.list.options[i].text=urls[0][i];
         document.history.historystore.options[i+1].text=urls[store][i+1];
      }
   }
}

function MyReplace(s,c1,c2)
{  var r="",a,i;
   a=s.split(c1);
   for(i=0;i<a.length;i++)
   {  r+=a[i];
      if(i<a.length-1)
         r+=c2;
   }
   return r;
}
//-->
</script>
</head>

<body bgcolor=white text=black onload="InitAlterNav()">
<form name="history">
<table bgcolor=#eeeeee border=0 cellspacing=0 cellpadding=3>
   <tr>
      <td>
         <input type=button name="tubutton" value=" U " onclick="ChangeDisplay()" style="width:25px;" id="tutitle" title=" Show URL's ">
      </td>
      <td>
         <font face="Arial, Helvetica" size=+1><b>
         <a href="altman.htm" title=" Manual " target="AlterNavDown">
         AlterNav</a> </b>
         <font size=-1>© 1999 Tobias Steinke
         </font></font>
      </td>
      <td width=3> </td>
      <td>
         <input type=button value=" 1 " onclick="Call(1)" style="width:25px;" title=" Call history 1 ">
      </td>
      <td>
         <input type=button value=" 2 " onclick="Call(2)" style="width:25px;" title=" Call history 2 ">
      </td>
      <td width=3> </td>
      <td>
         <input type=button value=" S " onclick="Store()" style="width:25px;" title=" Store history ">
      </td>
      <td>
         <input type=text name="myname" onchange="StoreName()" size=37 style="width:305px;" maxlength=60 title=" Name of this history ">
      </td>
   </tr>
   <tr>
      <td>
         <input type=button value=" C " onclick="ClearHistory(0)" style="width:25px;" title=" Clear AlterNav's history ">
      </td>
      <td>
         <select size=1 name="list" onchange="Go(0,document.history.list.options.selectedIndex)" style="width:305px;" width=305>
         <option selected>AlterNav does not function without JavaScript.
         <option> 
         <option> 
         <option> 
         <option> 
         <option> 
         <option> 
         <option> 
         <option> 
         <option> 
         </select>
      </td>
      <td width=3> </td>
      <td>
         <input type=button value=" 3 " onclick="Call(3)" style="width:25px;" title=" Call history 3 ">
      </td>
      <td>
         <input type=button value=" 4 " onclick="Call(4)" style="width:25px;" title=" Call history 4 ">
      </td>
      <td width=3> </td>
      <td>
         <input type=button value=" C " onclick="ClearHistory(store)" style="width:25px;" title=" Clear history ">
      </td>
      <td>
         <select size=1 name="historystore" onchange="Go(store,document.history.historystore.options.selectedIndex)" style="width:305;" width=305>
         <option selected>AlterNav does not function without JavaScript.
         <option> 
         <option> 
         <option> 
         <option> 
         <option> 
         <option> 
         <option> 
         <option> 
         <option> 
         <option> 
         </select>
      </td>
   </tr>
</table>
</form>
</body>
</html>


Navigation im World Wide Web als Hypertextsystem (Diplomarbeit von Tobias Steinke)
Inhaltsverzeichnis     AlterNav an     AlterNav aus     Zurück zur Literatur

© 1999 Tobias Steinke, mail@tobias-steinke.de