Branch: Tag:

1998-06-06

1998-06-06 16:35:31 by Peter Bortas <zino@lysator.liu.se>

Removed use of self.location since some IE's break on it.

Rev: server/modules/tags/killframe.pike:1.19

15:    * Removes document-internal links. (gazink.html#foo)    */    - constant cvs_version = "$Id: killframe.pike,v 1.18 1998/04/15 12:00:45 peter Exp $"; + constant cvs_version = "$Id: killframe.pike,v 1.19 1998/06/06 16:35:31 peter Exp $";   constant thread_safe=1;      #include <module.h>
48:      string tag_killframe( string tag, mapping m, object id )   { -  string javascript; -  +     if(m->help) return register_module()[2];    -  array indexfiles; -  if( id->conf->dir_module ) -  indexfiles = id->conf->dir_module->query("indexfiles"); +  if( !id->supports->javascript ) return "";    -  +  string javascript; +     while( id->misc->orig )    id = id->misc->orig;    -  if( query("killindex") ) -  { +  // Some versions of IE will choke on :80. (Reload and repeat..)    string tmp; -  -  /* Links to index.html are ugly. */ -  +     string my_url = id->conf->query("MyWorldLocation");    if( sscanf(my_url, "%s:80/", tmp ) )    my_url = tmp +"/"+ id->not_query[1..];    else    my_url += id->not_query[1..];    -  if(id->query) -  my_url += "?"+ id->query; -  else +  // Links to index.html are ugly. All pages deserve a uniqe URL, and for +  // index-pages that URL in /. +  if( query("killindex") )    { -  +  //Get indexfiles from the directory-module if there is one. +  array indexfiles = ({}); +  if( id->conf->dir_module ) +  indexfiles = id->conf->dir_module->query("indexfiles"); +     int l=strlen(my_url)-1;       foreach( indexfiles, string index )
82:    my_url = my_url[..l-strlen(index)];    }    +  // Put back the variables if there were any. +  if(id->query) +  my_url += "?"+ id->query; +  +  // top.location = self.location is more beutiful, but it breaks some +  // version of IE    javascript = ( " if(top.location != \""+ my_url +"\")\n"    " top.location = \""+ my_url +"\";\n" ); -  } -  else -  javascript = ( " if (self != top) top.location = self.location;\n" ); +     -  if (id->supports->javascript) +     return("<script language=javascript><!--\n"    + javascript    + "//--></script>\n"); -  -  return ""; +    }      mapping query_tag_callers()   {    return ([ "killframe" : tag_killframe ]);   }