include/dlhead.wmi
15c15169
 #! /usr/bin/wml
 <: use strict; :>
 <: use warnings; :>
 #use "perl-globals.wmi"
 #use "links.wmi"
 #use "versions.wmi"
 #use "navigation.wmi"
04ed5a04
 #use "functions.wmi"
15c15169
 
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
 <html>
 <head>
   <title>$(TITLE)</title>
   <link rel="shortcut icon" type="image/x-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)">">
 
86c5276a
   # begin WML to generate css/js paths
15c15169
   <ifneq "$(STYLESHEET)" "" "<link rel="stylesheet" type="text/css" href="$(DOCROOT)/$(STYLESHEET)">">
9ecbc332
   <ifeq "$(STYLESHEET)" "" "<link rel="stylesheet" type="text/css" href="$(DOCROOT)/css/master.min.css">">
15c15169
 
9ecbc332
   #<link href="css/master.min.css" rel="stylesheet" type="text/css">
15c15169
   <!--[if lte IE 8]>
9ecbc332
   <link rel="stylesheet" type="text/css" href="$(DOCROOT)/css/ie8-and-down.min.css">
15c15169
   <![endif]-->
   <!--[if lte IE 7]>
9ecbc332
   <link rel="stylesheet" type="text/css" href="$(DOCROOT)/css/ie7-and-down.min.css">
15c15169
   <![endif]-->
   <!--[if IE 6]>
9ecbc332
   <link rel="stylesheet" type="text/css" href="$(DOCROOT)/css/ie6.min.css">
15c15169
   <![endif]-->
 
86c5276a
   # end WML to generate css/js paths
15c15169
 
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
   <meta name="author" content="The Tor Project, Inc.">
   <meta name="keywords" content="anonymity online, tor, tor project, censorship circumvention, traffic analysis, anonymous communications research">
   <script type="text/javascript" src="../js/jquery.min.js">
 # /* jQuery */
   </script>
   <script type="text/javascript" src="../js/jquery.client.min.js">
 /* "jQuery Browser And OS Detection Plugin" by Stoimen
    Source: http://www.stoimen.com/blog/2009/07/16/jquery-browser-and-os-detection-plugin/
    License: Public Domain (http://www.stoimen.com/blog/2009/07/16/jquery-browser-and-os-detection-plugin/#comment-12498) */
   </script>
9ecbc332
   <script type="text/javascript" src="../js/jquery-migrate-1.0.0.min.js"></script>
87c425b7
   <script type="text/javascript" src="../js/jquery.ba-bbq.min.js">
 /*  Source: https://raw.github.com/cowboy/jquery-bbq/v1.2.1/jquery.ba-bbq.js */
   </script>
89d70c9a
   <script type="text/javascript" src="../js/dlpage01.js">
15c15169
 # /* Displays detected section */
   </script>
   <script async type="text/javascript" src="../js/jquery.accordion.min.js">
 /* Modified version of "Stupid Simple jQuery Accordian Menu" originally developed by Ryan Stemkoski
    Source: http://www.stemkoski.com/stupid-simple-jquery-accordion-menu/
    License: Public Domain (http://www.stemkoski.com/stupid-simple-jquery-accordion-menu/#comment-32882) */
   </script>
 </head>
42b034e7
 <body class="onload">
6c43614f
     <span class="hidden" id="version-data">
89c6c05a
         { "torbrowserbundle" : "<version-torbrowserbundle>",
6c43614f
           "torbrowserbundleosx64" : "<version-torbrowserbundleosx64>",
           "torbrowserbundlelinux32" : "<version-torbrowserbundlelinux32>",
           "torbrowserbundlelinux64" : "<version-torbrowserbundlelinux64>"  }
     </span>
15c15169
 <div id="wrap">
   <div id="header">
     <h1 id="logo"><a href="<page index>">Tor</a></h1>
       # 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) {
86c5276a
               my ($dir, $base) = $key =~ m,^(?:(.*)/)?(.*?)$,;
15c15169
 
86c5276a
               # in directory of active link, set class active
15c15169
               my $class;
               if ((defined $dir) and ($WML_SRC_DIRNAME =~/$dir/) or ($WML_SRC_BASENAME eq $base)) {
                 $class = 'class="active"';
               } else {
                 $class = '';
               }
 
 	            $dir = '.' unless defined $dir;
86c5276a
 
15c15169
               # translated version
               if (-e "$(DOCROOT)/$dir/$lang/$base.wml") {
                   printf '<li><a '.$class.' href="%s">%s</a></li>'."\n",
                          stripDotSlashs("$(DOCROOT)/$dir/$base.html.$(LANG)"),$navigation{$key};
86c5276a
               }
15c15169
               # 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 {
                 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.";
               }
             }
         }:>
76864aa1
      # LANGUAGE SWITCH 
b90c065d
       <li>
76864aa1
          <div class="dropdown">
4d9fe21e
            <div class="dropbtn">
04ed5a04
 	      <:{ if (has_translations()) {  
                     my @lngs = list_translations();
    		    print $lngs[0];
 		  }
               }:>
4d9fe21e
 	   </div>
40622742
            <div class="dropdown-content">
 	     <:{
                #import "perl-globals.wmi";
                 use Cwd;
                use Cwd 'abs_path';
                use File::Spec;
                my $urlbase = File::Spec->abs2rel(getcwd(),abs_path("$(DOCROOT)"));
                my $LANGUAGES;
                my $page = $WML_SRC_FILENAME;
                opendir(DIR, getcwd()) or die $!;
                # take a look and see what language support we have
                while (my $file = readdir(DIR)) {
                  if (-d $file) {
                    if (-e "$file/$page") {
                      my $url = $WML_SRC_BASENAME.'.html.'.$file;
                      print '<a href="'.$url.'" >'.$LANGUAGES{$file}.'</a>'."\n" unless not defined $LANGUAGES{$file};
                    }
                  }
                }
                closedir(DIR);
              }:>
              
            </div>
76864aa1
          </div> 
b90c065d
        </li>
        #
       </ul>
     
15c15169
       </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;
86c5276a
             }
15c15169
 
             my $page = $WML_SRC_BASENAME;
             my $lang = "$(LANG)";
             for my $key (@keys) {
86c5276a
               my ($dir, $base) = $key =~ m,^(?:(.*)/)?(.*?)$,;
15c15169
 
86c5276a
               # in directory, set active
15c15169
               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
               if (-e "$(DOCROOT)/$dir/$lang/$base.wml") {
                   printf '<li class="donate"><a '.$class.' href="%s">%s</a></li>'."\n",
                          stripDotSlashs("$(DOCROOT)/$dir/$base.html.$(LANG)"),$calltoaction{$key};
86c5276a
               }
15c15169
               # 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 {
                 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.";
               }
86c5276a
             }
15c15169
           }:>
         </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>.">