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

[tor-commits] [nyx/master] Show FAQ when javascript is disabled



commit 3a53a21190b7a8a86a0e6e94b1be4fdccb6e7654
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Sat Oct 24 17:05:52 2020 -0700

    Show FAQ when javascript is disabled
    
    Minor adjustment of a patch from Sai...
    
      https://github.com/torproject/nyx/issues/21
---
 web/index.html       | 20 +++-----------------
 web/styles.css       |  2 --
 web/styles_no_js.css | 12 ------------
 3 files changed, 3 insertions(+), 31 deletions(-)

diff --git a/web/index.html b/web/index.html
index f214a36..adfadb5 100644
--- a/web/index.html
+++ b/web/index.html
@@ -6,7 +6,6 @@
     <title>Nyx</title>
     <link rel="shortcut icon" href="images/favicon.png">
     <link rel="stylesheet" type="text/css" href="styles.css">
-    <noscript><link rel="stylesheet" type="text/css" href="styles_no_js.css"></noscript>
 
     <!-- jQueryTools 1.2.6 (https://jquerytools.github.io/download/), copied July 24, 2017 -->
     <script src="jquery.tools.min.js" type="text/javascript"></script>
@@ -860,6 +859,7 @@ logged_events BW, NOTICE, WARN, ERR
 
     <script type="text/javascript">
     $(function() {
+      $('.answer').toggle(); // hide answers on launch
       $(".tabs").tabs(".page", { history: true });
 
       // when javascript is enabled change nav anchors so they're both shorter
@@ -874,22 +874,8 @@ logged_events BW, NOTICE, WARN, ERR
       // show/hide for FAQ questions
 
       var toggleFaq = function(answer) {
-        if (answer.is('.open')) {
-          answer.animate({'height': '0'}, 100);
-          answer.removeClass('open');
-        } else {
-          var newHeight = 0;
-
-          answer.children().each(function () {
-            if (["nyx-img", "vidalia-img"].indexOf(this.className) == -1) {
-              newHeight += $(this).outerHeight(true);
-            }
-          });
-
-          answer.animate({'height': newHeight}, 100);
-          answer.addClass('open');
-          history.replaceState(undefined, undefined, "#" + answer.parent().attr('id'));
-         }
+        answer.toggle();
+        history.replaceState(undefined, undefined, "#" + answer.parent().attr('id'));
       }
 
       $('.questions > li > span').click(function() {
diff --git a/web/styles.css b/web/styles.css
index 81bca90..e412f17 100644
--- a/web/styles.css
+++ b/web/styles.css
@@ -251,8 +251,6 @@ FAQ Page
 }
 
 .answer {
-  height: 0px;
-  overflow: hidden;
   padding: 0px;
 }
 
diff --git a/web/styles_no_js.css b/web/styles_no_js.css
deleted file mode 100644
index d7b03f3..0000000
--- a/web/styles_no_js.css
+++ /dev/null
@@ -1,12 +0,0 @@
-/*============================================================
-Attributes when javascript is disabled
-============================================================*/
-
-#t2 {
-  display: none;
-}
-
-#faq_section {
-  display: none;
-}
-

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