4771d7febbf328adc64382fb7b5e00edcaef1f53
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

1) #! /usr/bin/wml
2) <: use strict; :>
3) <: use warnings; :>
4) #use "perl-globals.wmi"
5) #use "links.wmi"
6) #use "versions.wmi"
7) #use "navigation.wmi"
8) 
hiromipaw Escaping equals sign in vie...

hiromipaw authored 6 years ago

9) <define-tag viewport whitespace=delete>
10) <meta name="viewport" content="width\=device-width, initial-scale=1">
11) </define-tag>
12) 
13) 
Nima Fatemi some meta clean up. making...

Nima Fatemi authored 9 years ago

14) <!DOCTYPE html>
15)  <html>
16)  <head>
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

17) 
Nima Fatemi some meta clean up. making...

Nima Fatemi authored 9 years ago

18)    <meta charset="utf-8">
19)    <meta http-equiv="X-UA-Compatible" content="IE=edge">
hiromipaw Escaping equals sign in vie...

hiromipaw authored 6 years ago

20)    <viewport>
Nima Fatemi some meta clean up. making...

Nima Fatemi authored 9 years ago

21)    <meta name="author" content="The Tor Project, Inc.">
hiromipaw Change keywords and descrip...

hiromipaw authored 6 years ago

22)    <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.">
23)    <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">
Sebastian Hahn Add open graph meta tag

Sebastian Hahn authored 9 years ago

24)    <meta property="og:image" content="https://www.torproject.org/images/tor-logo.jpg">
Peter Palfrader Move Debian sources.list ge...

Peter Palfrader authored 7 years ago

25) {#meta#}
Sebastian Hahn Add open graph meta tag

Sebastian Hahn authored 9 years ago

26) 
Nima Fatemi some meta clean up. making...

Nima Fatemi authored 9 years ago

27)    <title>$(TITLE)</title>
Sebastian Hahn Add open graph meta tag

Sebastian Hahn authored 9 years ago

28) 
Nima Fatemi some meta clean up. making...

Nima Fatemi authored 9 years ago

29)    <link rel="icon" href="$(IMGROOT)/favicon.ico">
30)    <ifneq "$(REDIRECT)" "" "<meta http-equiv="refresh" content="0;url=$(DOCROOT)/$(REDIRECT)">">
31)    <ifneq "$(REDIRECT_GLOBAL)" "" "<meta http-equiv="refresh" content="0;url=$(REDIRECT_GLOBAL)">">
Sebastian Hahn Add open graph meta tag

Sebastian Hahn authored 9 years ago

32) 
hiromipaw Fix navigation active tab i...

hiromipaw authored 7 years ago

33)    # begin WML to generate css/js paths
Nima Fatemi some meta clean up. making...

Nima Fatemi authored 9 years ago

34)    <ifneq "$(STYLESHEET)" "" "<link href="$(DOCROOT)/$(STYLESHEET)" rel="stylesheet">">
hiromipaw Minify JS and CSS

hiromipaw authored 6 years ago

35)    <ifeq "$(STYLESHEET)" "" "<link href="$(DOCROOT)/css/master.min.css" rel="stylesheet">">
Arthur Edelstein Bug 23484: 2017 Homepage do...

Arthur Edelstein authored 6 years ago

36)    <ifeq "$(DONATION_BANNER)" "true" "<link href="$(DOCROOT)/css/donation-banner.css" rel="stylesheet">">
Sebastian Hahn Add open graph meta tag

Sebastian Hahn authored 9 years ago

37) 
hiromipaw Minify JS and CSS

hiromipaw authored 6 years ago

38)    #<link href="css/master.min.css" rel="stylesheet">
Nima Fatemi some meta clean up. making...

Nima Fatemi authored 9 years ago

39)    <!--[if lte IE 8]>
hiromipaw Minify JS and CSS

hiromipaw authored 6 years ago

40)    <link href="$(DOCROOT)/css/ie8-and-down.min.css" rel="stylesheet">
Nima Fatemi some meta clean up. making...

Nima Fatemi authored 9 years ago

41)    <![endif]-->
42)    <!--[if lte IE 7]>
hiromipaw Minify JS and CSS

hiromipaw authored 6 years ago

43)    <link href="$(DOCROOT)/css/ie7-and-down.min.css" rel="stylesheet">
Nima Fatemi some meta clean up. making...

Nima Fatemi authored 9 years ago

44)    <![endif]-->
45)    <!--[if IE 6]>
hiromipaw Minify JS and CSS

hiromipaw authored 6 years ago

46)    <link href="$(DOCROOT)/css/ie6.min.css" rel="stylesheet">
Nima Fatemi some meta clean up. making...

Nima Fatemi authored 9 years ago

47)    <![endif]-->
hiromipaw Escaping equals sign in vie...

hiromipaw authored 6 years ago

48)    #  <script language="javascript" type="text/javascript" src="$(DOCROOT)/global.js"></script>
hiromipaw Fix navigation active tab i...

hiromipaw authored 7 years ago

49)    # end WML to generate css/js paths
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

50) </head>
51) <body>
Arthur Edelstein Bug 23484: 2017 Homepage do...

Arthur Edelstein authored 6 years ago

52) <!-- Insert donation banner if flag is true -->
53) <ifeq "$(DONATION_BANNER)" "true" "
54)     <div id="banner-wrapper">
55)         <div id="banner-contents-container">
56)             <div id="banner-tagline"><span><noscript>Protecting the Privacy of Millions Every Day</noscript></span></div>
57)             <div id="banner-slogan"><span>Tor: Powering Digital Resistance</span></div>
58)             <div id="banner-mozilla"><span>Give today and Mozilla will match your gift!</span></div>
59)             <a id="banner-donate-button-link"
60)                href="https://www.torproject.org/donate/donate-pdr-hp">
61)                 <div id="banner-donate-button">
62)                     <span>Donate Now!&#160;&#9654;</span>
63)                 </div>
64)             </a>
65)         </div>
66)     </div>
67)     <div id="banner-spacer"></div>
68)     <script src="js/donation_banner.js"></script>
69) 
70) ">
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

71) <div id="wrap">
72)   <div id="header">
Andrew Lewman it's called index, not home

Andrew Lewman authored 13 years ago

73)     <h1 id="logo"><a href="<page index>">Tor</a></h1>
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

74)       # navigation menu generation
75)       <div id="nav">
76)         <ul>
77)         <:{
78)             # create a hash and maintain order of keys
79)             my %navigation;
80)             my @keys;
81)             while (@navigation) {
82)               my $key = shift @navigation;
83)               my $val = shift @navigation;
84)               push @keys, $key;
85)               $navigation{$key} = $val;
86)             }
87) 
88)             my $page = $WML_SRC_BASENAME;
89)             my $lang = "$(LANG)";
90) 
91)             for my $key (@keys) {
hiromipaw Fix navigation active tab i...

hiromipaw authored 7 years ago

92)               my ($dir, $base) = $key =~ m,^(?:(.*)/)?(.*?)$,;
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

93) 
hiromipaw Fix navigation active tab i...

hiromipaw authored 7 years ago

94)               # in directory of active link, set class active. This rule should be improved with proper structuring of the links.
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

95)               my $class;
hiromipaw Fix navigation active tab i...

hiromipaw authored 7 years ago

96)               if ((index($page, 'contact') ne -1) and (index($base, 'overview') ne -1)) {
97)                 $class = '';
98)               } elsif ((defined $dir) and ($WML_SRC_DIRNAME =~/$dir/) and (index($key, 'contact') eq -1) or ($WML_SRC_BASENAME eq $base)) {
99)                 $class = 'class="active '.$base.' '.$page.'"';
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

100)               } else {
101)                 $class = '';
102)               }
103) 
104) 	            $dir = '.' unless defined $dir;
hiromipaw Fix navigation active tab i...

hiromipaw authored 7 years ago

105) 
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

106)               # translated version
Andrew Lewman revert the pathing for lang

Andrew Lewman authored 13 years ago

107)               if (-e "$(DOCROOT)/$dir/$lang/$base.wml") {
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

108)                   printf '<li><a '.$class.' href="%s">%s</a></li>'."\n",
109)                          stripDotSlashs("$(DOCROOT)/$dir/$base.html.$(LANG)"),$navigation{$key};
hiromipaw Fix navigation active tab i...

hiromipaw authored 7 years ago

110)               }
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

111)               # english version
112)               elsif (-e "$(DOCROOT)/$dir/en/$base.wml") {
113)               	printf '<li><a '.$class.' href="%s">%s</a></li>'."\n",
114)                   stripDotSlashs("$(DOCROOT)/$dir/$base.html"), $navigation{$key};
115)               }
116)               # full url
117)               elsif ($key =~/^http/) {
118)                 printf '<li><a href="%s">%s</a></li>'."\n", $key, $navigation{$key};
119)               } else {
Andrew Lewman switch to Goldstein's idea...

Andrew Lewman authored 13 years ago

120)                 warn "$WML_SRC_FILENAME has a [page $key] (parses to
Andrew Lewman revert the pathing for lang

Andrew Lewman authored 13 years ago

121) docdir: $(DOCROOT)/; dir: $dir; base: $base -> $(DOCROOT)/$dir/$lang/$base.wml), but that doesn't exist.";
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

122)               }
123)             }
124)         }:>
125)         </ul>
126)       </div>
127)       <!-- END NAV -->
128)      # end navigation generation
129)       <div id="calltoaction">
130)         <ul>
131)           <:{
132)             my %calltoaction;
133)             my @keys;
134)             while (@calltoaction) {
135)               my $key = shift @calltoaction;
136)               my $val = shift @calltoaction;
137)               push @keys, $key;
138)               $calltoaction{$key} = $val;
hiromipaw Fix navigation active tab i...

hiromipaw authored 7 years ago

139)             }
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

140) 
141)             my $page = $WML_SRC_BASENAME;
142)             my $lang = "$(LANG)";
143)             for my $key (@keys) {
hiromipaw Fix navigation active tab i...

hiromipaw authored 7 years ago

144)               my ($dir, $base) = $key =~ m,^(?:(.*)/)?(.*?)$,;
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

145) 
hiromipaw Fix navigation active tab i...

hiromipaw authored 7 years ago

146)               # in directory, set active
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

147)               my $class;
148)               if ((defined $dir) and ($WML_SRC_DIRNAME =~/$dir/) or ($WML_SRC_BASENAME eq $base)) {
149)               #if ($WML_SRC_BASENAME eq $base) {
150)                 $class = 'class="active"';
151)               } else {
152)                 $class = '';
153)               }
154) 
155) 	          $dir = '.' unless defined $dir;
156)               # try to use a translated version
Andrew Lewman revert the pathing for lang

Andrew Lewman authored 13 years ago

157)               if (-e "$(DOCROOT)/$dir/$lang/$base.wml") {
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

158)                   printf '<li class="donate"><a '.$class.' href="%s">%s</a></li>'."\n",
159)                          stripDotSlashs("$(DOCROOT)/$dir/$base.html.$(LANG)"),$calltoaction{$key};
hiromipaw Fix navigation active tab i...

hiromipaw authored 7 years ago

160)               }
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

161)               # default to english version
162)               elsif (-e "$(DOCROOT)/$dir/en/$base.wml") {
163)               	printf '<li class="donate"><a '.$class.' href="%s">%s</a></li>'."\n",
164)                   stripDotSlashs("$(DOCROOT)/$dir/$base.html"), $calltoaction{$key};
165)               } else {
Andrew Lewman revert the pathing for lang

Andrew Lewman authored 13 years ago

166)                 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.";
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

167)               }
hiromipaw Fix navigation active tab i...

hiromipaw authored 7 years ago

168)             }