[tor-commits] [nyx/master] Show tab containing requested anchor

atagar at torproject.org atagar at torproject.org
Sat Aug 5 01:18:26 UTC 2017


commit a2d9d9ec318b990e73e768123d61edc2d226527a
Author: Damian Johnson <atagar at torproject.org>
Date:   Thu Jul 27 12:02:21 2017 -0700

    Show tab containing requested anchor
    
    When the page is loaded with an anchor tag we should show that tab's content so
    it... well, works.
---
 web/index.html | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/web/index.html b/web/index.html
index 981603e..4f4dc4a 100644
--- a/web/index.html
+++ b/web/index.html
@@ -169,10 +169,22 @@
       </div>
     </div>
 
-    <!-- activate tabs with JavaScript -->
     <script>
     $(function() {
-        $(".tabs").tabs(".panes > .content", { history: true });
+      $(".tabs").tabs(".panes > .content", { history: true });
+
+      // when provided an anchor select the tab it resides within
+
+      var anchor = window.location.hash;
+      var tabs = $(".tabs").data("tabs");
+
+      if ($("#home").find(anchor).length) {
+        tabs.click("home");
+      } else if ($("#faq").find(anchor).length) {
+        tabs.click("faq");
+      } else if ($("#download").find(anchor).length) {
+        tabs.click("download");
+      }
     });
     </script>
   </body>





More information about the tor-commits mailing list