include/head.wmi
2a9aaa80
 #! /usr/bin/wml
 <: use strict; :>
 <: use warnings; :>
 #use "perl-globals.wmi"
 #use "links.wmi"
 #use "versions.wmi"
 #use "navigation.wmi"
 
56a20c47
 <define-tag viewport whitespace=delete>
 <meta name="viewport" content="width\=device-width, initial-scale=1">
 </define-tag>
 
 
a3d70401
 <!DOCTYPE html>
  <html>
  <head>
2a9aaa80
 
a3d70401
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
56a20c47
    <viewport>
a3d70401
    <meta name="author" content="The Tor Project, Inc.">
bfd7aef3
    <meta name="description" content="The Tor Project's free software protects your privacy online. Site blocked? Email [mailto:gettor@torproject.org] for help downloading Tor Browser.">
    <meta name="keywords" content="tor, tor project, tor browser, avoid censorship, traffic analysis, anonymous communications, privacy, avoid surveillance, online security, anonymous online, private browsing, anonymity online, online privacy, protect privacy, private mac browser, private windows browser, private android browser, linux browser, anonymity network, tor network, onion router, onion browser">
e742616d
    <meta property="og:image" content="https://www.torproject.org/images/tor-logo.jpg">
3e230b9e
 {#meta#}
e742616d
 
a3d70401
    <title>$(TITLE)</title>
e742616d
 
a3d70401
    <link rel="icon" href="$(IMGROOT)/favicon.ico">
    <ifneq "$(REDIRECT)" "" "<meta http-equiv="refresh" content="0;url=$(DOCROOT)/$(REDIRECT)">">
    <ifneq "$(REDIRECT_GLOBAL)" "" "<meta http-equiv="refresh" content="0;url=$(REDIRECT_GLOBAL)">">
e742616d
 
50d71b7d
    # begin WML to generate css/js paths
a3d70401
    <ifneq "$(STYLESHEET)" "" "<link href="$(DOCROOT)/$(STYLESHEET)" rel="stylesheet">">
9ecbc332
    <ifeq "$(STYLESHEET)" "" "<link href="$(DOCROOT)/css/master.min.css" rel="stylesheet">">
e742616d
 
9ecbc332
    #<link href="css/master.min.css" rel="stylesheet">
a3d70401
    <!--[if lte IE 8]>
9ecbc332
    <link href="$(DOCROOT)/css/ie8-and-down.min.css" rel="stylesheet">
a3d70401
    <![endif]-->
    <!--[if lte IE 7]>
9ecbc332
    <link href="$(DOCROOT)/css/ie7-and-down.min.css" rel="stylesheet">
a3d70401
    <![endif]-->
    <!--[if IE 6]>
9ecbc332
    <link href="$(DOCROOT)/css/ie6.min.css" rel="stylesheet">
a3d70401
    <![endif]-->
56a20c47
    #  <script language="javascript" type="text/javascript" src="$(DOCROOT)/global.js"></script>
50d71b7d
    # end WML to generate css/js paths
2a9aaa80
 </head>
 <body>
 <div id="wrap">
   <div id="header">
91897007
     <h1 id="logo"><a href="<page index>">Tor</a></h1>
2a9aaa80
       # navigation menu generation
       <div id="nav">
         <ul>
         <:{
             # create a hash and maintain order of keys
             my %navigation;
             my @keys;
             while (@navigation) {
               my $key = shift @navigation;
               my $val = shift @navigation;
               push @keys, $key;
               $navigation{$key} = $val;
             }
 
             my $page = $WML_SRC_BASENAME;
             my $lang = "$(LANG)";
 
             for my $key (@keys) {
50d71b7d
               my ($dir, $base) = $key =~ m,^(?:(.*)/)?(.*?)$,;
2a9aaa80
 
50d71b7d
               # in directory of active link, set class active. This rule should be improved with proper structuring of the links.
2a9aaa80
               my $class;
50d71b7d
               if ((index($page, 'contact') ne -1) and (index($base, 'overview') ne -1)) {
                 $class = '';
               } elsif ((defined $dir) and ($WML_SRC_DIRNAME =~/$dir/) and (index($key, 'contact') eq -1) or ($WML_SRC_BASENAME eq $base)) {
                 $class = 'class="active '.$base.' '.$page.'"';
2a9aaa80
               } else {
                 $class = '';
               }
 
 	            $dir = '.' unless defined $dir;
50d71b7d
 
2a9aaa80
               # translated version
3bc6e418
               if (-e "$(DOCROOT)/$dir/$lang/$base.wml") {
2a9aaa80
                   printf '<li><a '.$class.' href="%s">%s</a></li>'."\n",
                          stripDotSlashs("$(DOCROOT)/$dir/$base.html.$(LANG)"),$navigation{$key};
50d71b7d
               }
2a9aaa80
               # english version
               elsif (-e "$(DOCROOT)/$dir/en/$base.wml") {
               	printf '<li><a '.$class.' href="%s">%s</a></li>'."\n",
                   stripDotSlashs("$(DOCROOT)/$dir/$base.html"), $navigation{$key};
               }
               # full url
               elsif ($key =~/^http/) {
                 printf '<li><a href="%s">%s</a></li>'."\n", $key, $navigation{$key};
               } else {
236d67ee
                 warn "$WML_SRC_FILENAME has a [page $key] (parses to
3bc6e418
 docdir: $(DOCROOT)/; dir: $dir; base: $base -> $(DOCROOT)/$dir/$lang/$base.wml), but that doesn't exist.";
2a9aaa80
               }
             }
         }:>
         </ul>
       </div>
       <!-- END NAV -->
      # end navigation generation
       <div id="calltoaction">
         <ul>
           <:{
             my %calltoaction;
             my @keys;
             while (@calltoaction) {
               my $key = shift @calltoaction;
               my $val = shift @calltoaction;
               push @keys, $key;
               $calltoaction{$key} = $val;
50d71b7d
             }
2a9aaa80
 
             my $page = $WML_SRC_BASENAME;
             my $lang = "$(LANG)";
             for my $key (@keys) {
50d71b7d
               my ($dir, $base) = $key =~ m,^(?:(.*)/)?(.*?)$,;
2a9aaa80
 
50d71b7d
               # in directory, set active
2a9aaa80
               my $class;
               if ((defined $dir) and ($WML_SRC_DIRNAME =~/$dir/) or ($WML_SRC_BASENAME eq $base)) {
               #if ($WML_SRC_BASENAME eq $base) {
                 $class = 'class="active"';
               } else {
                 $class = '';
               }
 
 	          $dir = '.' unless defined $dir;
               # try to use a translated version
3bc6e418
               if (-e "$(DOCROOT)/$dir/$lang/$base.wml") {
2a9aaa80
                   printf '<li class="donate"><a '.$class.' href="%s">%s</a></li>'."\n",
                          stripDotSlashs("$(DOCROOT)/$dir/$base.html.$(LANG)"),$calltoaction{$key};
50d71b7d
               }
2a9aaa80
               # default to english version
               elsif (-e "$(DOCROOT)/$dir/en/$base.wml") {
               	printf '<li class="donate"><a '.$class.' href="%s">%s</a></li>'."\n",
                   stripDotSlashs("$(DOCROOT)/$dir/$base.html"), $calltoaction{$key};
               } else {
3bc6e418
                 warn "$WML_SRC_FILENAME has a [page $key] (parses to docdir: $(DOCROOT)/; dir: $dir; base: $base -> $(DOCROOT)/$dir/$lang/$base.wml), but that doesn't exist.";
2a9aaa80
               }
50d71b7d
             }
2a9aaa80
           }:>
         </ul>
       </div>
       <!-- END CALLTOACTION -->
   </div>
   <!-- END HEADER -->
 
 #<ifneq "$(REDIRECT)" "" "Redirecting to <a href="$(DOCROOT)/$(REDIRECT)">$(DOCROOT)/$(REDIRECT)</a>.">
 #<ifneq "$(REDIRECT_GLOBAL)" "" "Redirecting to <a href="$(REDIRECT_GLOBAL)">$(REDIRECT_GLOBAL)</a>.">