[tor-commits] [tpo/master] Fix thank you page

hiro at torproject.org hiro at torproject.org
Mon Feb 11 13:30:59 UTC 2019


commit 591fe397b312e37c90bff785189a42aba23ba8bf
Author: hiro <hiro at torproject.org>
Date:   Mon Feb 11 14:30:54 2019 +0100

    Fix thank you page
---
 content/thank-you/contents.lr   |  2 +-
 templates/footer.html           | 15 +--------------
 templates/hero-download.html    |  2 +-
 templates/macros/downloads.html |  6 +++---
 templates/script-download.html  | 14 ++++++++++++++
 templates/thank-you.html        |  2 +-
 6 files changed, 21 insertions(+), 20 deletions(-)

diff --git a/content/thank-you/contents.lr b/content/thank-you/contents.lr
index 8fca5b5..031b254 100644
--- a/content/thank-you/contents.lr
+++ b/content/thank-you/contents.lr
@@ -1,4 +1,4 @@
-_template: thank-you.html
+_template: layout.html
 ---
 section: the tor project
 ---
diff --git a/templates/footer.html b/templates/footer.html
index 12a0f43..3d1dc87 100644
--- a/templates/footer.html
+++ b/templates/footer.html
@@ -92,18 +92,5 @@
         }, 500)
       }
     </script>
-    <script type="text/javascript">
-    var os = navigator.platform;
-    if (os.indexOf("Linux") >=0) {
-      $("#linux").attr('selected', true);;
-    }else if(os.indexOf("Windows") >=0) {
-      $("#windows").attr('selected', true);;
-    }else if(os.indexOf("Mac") >=0) {
-      $("#osx").attr('selected', true);;
-    }else if(os.indexOf("Android") >=0) {
-      $("#Android").attr('selected', true);;
-    }else{
-      $("#platform").attr('selected', true);;
-    }
-    </script>
+    {% include 'script-download.html' %}
   </div>
diff --git a/templates/hero-download.html b/templates/hero-download.html
index 17fb171..a708e76 100644
--- a/templates/hero-download.html
+++ b/templates/hero-download.html
@@ -22,7 +22,7 @@
         {% else %}
           {% set download_link = '#android' %}
         {% endif %}
-        <a href="{{ download_link }}">
+        <a class="downloadLink" href="{{ download_link }}">
           <i class="fab fa-{{ id }} text-light"></i>
         </a>
       </div>
diff --git a/templates/macros/downloads.html b/templates/macros/downloads.html
index f19a080..4694b40 100644
--- a/templates/macros/downloads.html
+++ b/templates/macros/downloads.html
@@ -8,7 +8,7 @@
   {% set sig_link_64 = download_link_64 + '.asc' %}
   {% set sig_link_32 = download_link_32 + '.asc' %}
 
-  <a href="{{ download_link_32 }}">32-bit</a> (<a href="{{ sig_link_32 }}">sig</a>) / <a href="{{ download_link_32 }}">64-bit</a> (<a href="{{ sig_link_64 }}">sig<a/>)
+  <a class="downloadLink" href="{{ download_link_32 }}">32-bit</a> (<a href="{{ sig_link_32 }}">sig</a>) / <a href="{{ download_link_32 }}">64-bit</a> (<a href="{{ sig_link_64 }}">sig<a/>)
 {% endmacro %}
 
 {% macro render_mac(version, alt) %}
@@ -19,7 +19,7 @@
   {% set download_link = download_prefix + 'TorBrowser-' + version + '-osx64' + '_' + alt + '.dmg' %}
   {% set sig_link = download_link + '.asc' %}
 
-  <a href="{{ download_link }}">64-bit</a> (<a href="{{ sig_link }}">sig</a>)
+  <a class="downloadLink" href="{{ download_link }}">64-bit</a> (<a href="{{ sig_link }}">sig</a>)
 {% endmacro %}
 
 {% macro render_linux(version, alt) %}
@@ -32,5 +32,5 @@
   {% set sig_link_64 = download_link_64 + '.asc' %}
   {% set sig_link_32 = download_link_32 + '.asc' %}
 
-  <a href="{{ download_link_32 }}">32-bit</a> (<a href="{{ sig_link_32 }}">sig</a>) / <a href="{{ download_link_32 }}">64-bit</a> (<a href="{{ sig_link_64 }}">sig<a/>)
+  <a class="downloadLink" href="{{ download_link_32 }}">32-bit</a> (<a href="{{ sig_link_32 }}">sig</a>) / <a href="{{ download_link_32 }}">64-bit</a> (<a href="{{ sig_link_64 }}">sig<a/>)
 {% endmacro %}
diff --git a/templates/script-download.html b/templates/script-download.html
new file mode 100644
index 0000000..1c1828f
--- /dev/null
+++ b/templates/script-download.html
@@ -0,0 +1,14 @@
+<script>
+$(".downloadLink").click(
+    function(e) {
+        e.preventDefault();
+
+        //open download link in new page
+        window.open( $(this).attr("href") );
+
+        //redirect current page to success page
+        window.location="/thank-you";
+        window.focus();
+    }
+);
+</script>
diff --git a/templates/thank-you.html b/templates/thank-you.html
index f87f80f..ff84afe 100644
--- a/templates/thank-you.html
+++ b/templates/thank-you.html
@@ -9,7 +9,7 @@
 <div class="container">
   <div class="row">
     <div class="col-md-4">
-      <h4>{ _('Sign up for Tor News and get updates and opportunities from across the organization and community.') }}</h4>
+      <h4>{{ _('Sign up for Tor News and get updates and opportunities from across the organization and community.') }}</h4>
     </div>
     <div class="col-md-4">
       <h4>{{ _('Run a relay to make the network faster and more decentralized.') }}</h4>



More information about the tor-commits mailing list