[tor-commits] [tpo/staging] Update to script in line

emmapeel at torproject.org emmapeel at torproject.org
Sat Apr 6 18:25:13 UTC 2019


commit d256ef6d44dc6bbef07c239ce36b35241594574c
Author: hiro <hiro at torproject.org>
Date:   Fri Apr 5 01:23:04 2019 +0200

    Update to script in line
---
 .../static/js/download.js                          | 10 +++++---
 templates/footer.html                              | 29 +++-------------------
 2 files changed, 9 insertions(+), 30 deletions(-)

diff --git a/templates/script-download.html b/assets/static/js/download.js
similarity index 55%
rename from templates/script-download.html
rename to assets/static/js/download.js
index cb341ec..8ce7625 100644
--- a/templates/script-download.html
+++ b/assets/static/js/download.js
@@ -1,14 +1,16 @@
-<script>
 $(".downloadLink").click(
     function(e) {
         e.preventDefault();
 
+        locale = window.location.href.split('/')[3];
         //open download link in new page
         window.open( $(this).attr("href") );
-
+        url = "/thank-you/"
         //redirect current page to success page
-        window.location="{{ '/thank-you'|url(alt=this.alt) }}";
+        if (locale != "download") {
+          url = "/" + locale + url
+        }
+        window.location=url;
         window.focus();
     }
 );
-</script>
diff --git a/templates/footer.html b/templates/footer.html
index 5821295..6155b08 100644
--- a/templates/footer.html
+++ b/templates/footer.html
@@ -75,30 +75,7 @@
     <script src="{{ '/static/js/popper.min.js'|asseturl }}" ></script>
     <script src="{{ '/static/js/bootstrap.bundle.min.js'|asseturl }}" ></script>
     <script src="{{ '/static/js/scrollspy.min.js'|asseturl }}" ></script>
-    <script type="text/javascript">
-
-      $('.side-nav').click(function(){
-        if ($('.side-nav.active').length > 0) {
-          $('.side-nav.active').removeClass('active')
-        }
-        $(this).addClass('active');
-      });
-
-      if($('.show').length !== 1 ) {
-        $('.show').collapse();
-      }
-
-      // Coming from search result page click
-      if(window.location.hash !== "") {
-        // Somehow collapse is not working sync and calling show directly after
-        // yields no effect and there is no callback when it is ready
-        setTimeout(() => {
-          // Folds out the answer manually
-          $(window.location.hash).collapse('show')
-          // Avoids the answer being hidden by the floating header
-          window.scrollTo(0, $(window.location.hash).position().top)
-        }, 500)
-      }
-    </script>
-    {% include 'script-download.html' %}
+    <script src="{{ '/static/js/modernizr.js'|asseturl }}" ></script>
+    <script src="{{ '/static/js/fallback.js'|asseturl }}" ></script>
+    <script src="{{ '/static/js/download.js'|asseturl }}" ></script>
   </div>





More information about the tor-commits mailing list