[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

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



commit a2d9d9ec318b990e73e768123d61edc2d226527a
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
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>



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits