toc minor fixes
authorHanoh Haim <[email protected]>
Sun, 1 May 2016 15:32:44 +0000 (18:32 +0300)
committerHanoh Haim <[email protected]>
Sun, 1 May 2016 15:32:44 +0000 (18:32 +0300)
images/Thumbs.db
images/splitbar.png [new file with mode: 0644]
images/trex_logo_toc.png [new file with mode: 0644]
trex_stateless.asciidoc
trex_toc.asciidoc
ws_main.py

index 893347a..cc9c8e8 100755 (executable)
Binary files a/images/Thumbs.db and b/images/Thumbs.db differ
diff --git a/images/splitbar.png b/images/splitbar.png
new file mode 100644 (file)
index 0000000..9c9c198
Binary files /dev/null and b/images/splitbar.png differ
diff --git a/images/trex_logo_toc.png b/images/trex_logo_toc.png
new file mode 100644 (file)
index 0000000..eb9fa1e
Binary files /dev/null and b/images/trex_logo_toc.png differ
index 4aad01e..ed9f664 100755 (executable)
@@ -3222,9 +3222,10 @@ $command   [-a] [-port 1 2 3]  [-port 0xff]  [-port clients/servers]
   port mask : 
     [-a]           : all ports 
     [-port 1 2 3]  : port 1,2 3
-    [-port 0xff]   : port by mask 0x1 for port 0 0x3 for port 0 and 1 
+    [-port 0xff]   : port by mask 0x1 for port 0 0x3 for port 0 and 1   <1> 
     [-port clients/servers] : -port clients will choose all the client side ports
 ----
+<7> 
 
 ==== Duration 
 
index 664370b..e620f9a 100644 (file)
@@ -1,17 +1,22 @@
 
 ifdef::backend-xhtml11[]
 ++++
-    <div id="toggle"><img src="images\icons\toggle.png" title="click to toggle table of contents"></div>
 
-    <div id="toc">
         <div id="toctitle">
+            <img class="trex_logo" src="images\trex_logo_toc.png"/>
             Table of Contents
         </div>
+
+        <div id="toggle">
+          <img src="images\icons\toggle.png" title="click to toggle table of contents"/>
+        </div>
         
-        <div id="nav-tree">
+
+        <div id="toc">
+          <div id="nav-tree">
           
+          </div>
         </div>
-    </div>
 
 
     <!-- load the theme CSS file -->
@@ -53,14 +58,14 @@ ifdef::backend-xhtml11[]
         
           #toc {
             position: fixed;
-            top: 0;
+            top: 51px;
             left: 0;
             bottom: 0;
             width: 18em;
             padding-bottom: 1.5em;
             margin: 0;
-            overflow-x: auto;
-            overflow-y: hidden;
+            overflow-x: auto !important;
+            overflow-y: auto !important;
             border-right: solid 2px #cfcfcf;
             background-color: #FAFAFA;
             white-space: nowrap;
@@ -75,6 +80,13 @@ ifdef::backend-xhtml11[]
             background-color: #e4e2e2;
             padding: 8px 0px 7px 45px;
             white-space: nowrap;
+            left: 0px;
+            display: block;
+            position: fixed;
+            z-index: 100;
+            width: 245px;
+            top: 0px;
+            overflow: hidden;
           }
           
           #toc .toclevel1 {
@@ -106,29 +118,39 @@ ifdef::backend-xhtml11[]
         text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0);
       }
 
+            /* For side bar */
+      .ui-resizable-e{
+        height: 100%;
+        width: 4px !important;
+        position: fixed !important;
+        top: 0px !important;
+        cursor: e-resize !important;
+        background: url('images\splitbar.png') repeat scroll right center transparent !important;
+        background-image: url('images\splitbar.png');
+      }
+
+      .jstree-default .jstree-themeicon{
+        display: none !important;
+      }
+
+
       .jstree-anchor {
         font-size: 12px !important;
         color: #91A501 !important;
       }
 
-      /* For side bar */
-      .ui-resizable-e{
-        width: 10px !important;
-      }
 
       .jstree-clicked{
         color: green !important;
       }
       
-      .jstree-default .jstree-themeicon{
-        display: none !important;
-      }
 
       #toggle {
         position: fixed;
         top: 14px;
         left: 10px;
-        z-index: 10;
+        z-index: 210;
+        width: 24px;
       }
 
       #toggle img {
@@ -139,6 +161,11 @@ ifdef::backend-xhtml11[]
         opacity:0.9;
       }
 
+      .trex_logo{
+        top: 6px;
+        position: relative;
+      }
+
     </style>
 
 
@@ -153,9 +180,15 @@ ifdef::backend-xhtml11[]
         initResizable();
         // Toggle TOC whe clicking on the menu icon
         toggleTOC();
+        // Handle Mobile - close TOC
+        checkMobile();
 
         function initializeNavTree() {
-          $('#nav-tree').jstree({
+
+          // TOC tree options
+          var toc_tree = $('#nav-tree');        
+
+          var toc_tree_options = {
             'core' : {
               "animation" :false,
               "themes" : { "stripes" : false },
@@ -166,7 +199,9 @@ ifdef::backend-xhtml11[]
             }
             ,
             "plugins" : [ "wholerow" ]
-          });
+          };
+
+          $('#nav-tree').jstree(toc_tree_options)
 
           $('#nav-tree').on("changed.jstree", function (e, data) {
             window.location.href = data.instance.get_selected(true)[0].original.link;
@@ -174,46 +209,92 @@ ifdef::backend-xhtml11[]
         }
         
         function initResizable() {
-            var toc = $("#toc");
-            var bodyLeftMargin = $("body");
-            $("#toc").resizable({
-                resize: function(e, ui) {
-                    var tocWidth = $("#toc").outerWidth();
-                    bodyLeftMargin.css({"marginLeft":parseInt(tocWidth)+20+"px"}); 
-                },
-                handles: 'e'
-            });
-        }
+          var toc = $("#toc");
+          var body = $("body");
+
+          // On resize
+          $("#toc").resizable({
+              resize: function(e, ui) {
+                  var tocWidth = $(toc).outerWidth();
+                  body.css({"marginLeft":parseInt(tocWidth)+20+"px"}); 
+                  $(".ui-resizable-e").css({"right":$(window).width()-parseInt(tocWidth)+"px"}); 
+                  $("#toctitle").css({"width":parseInt(tocWidth)-45+"px"}); 
+              },
+              handles: 'e'
+          });
+       
+          // Do it for the first time
+          var tocWidth = $(toc).outerWidth();
+          $(".ui-resizable-e").css({"right":$(window).width()-parseInt(tocWidth)+"px"}); 
+          $("#toctitle").css({"width":parseInt(tocWidth)-45+"px"}); 
 
+        }
 
         function toggleTOC(){
           var isOpen = true;
           $( "#toggle" ).click(function() {
             if ( isOpen ) {
               // Close it
-              $("#toc").hide("slide", 500);
-              // Show the show/hide button
-              $("#toggle").css("right", "-40px");
-              // $("body").css("margin-left", "20px");
-              $("body").animate({
-                "margin-left": "50px"
-              }, 500);
+               closTOC();
             } else {
               // Open it
-              $("#toc").show("slide", 500);
-              // Show the show/hide button
-              $("#toggle").css("right", "15px");
-              // $("body").css("margin-left", $(toc).outerWidth()+20+"px");
-              $("body").animate({
-                "margin-left": $(toc).outerWidth()+20+"px"
-              }, 500);
+              openTOC();
             }
+            // Toggle status
             isOpen = !isOpen;
           });
         }
 
-      }
-      )
+
+        // Close TOC by default if it is mobile
+        function checkMobile(){
+          if(isMobileDevice()){
+            closTOC();
+          }
+        }
+
+        // Check it it it is running on mobile device
+        function isMobileDevice() {
+            if(
+                navigator.userAgent.match(/Android/i) ||
+                navigator.userAgent.match(/BlackBerry/i) ||
+                navigator.userAgent.match(/iPhone|iPad|iPod/i) ||
+                navigator.userAgent.match(/Opera Mini/i) ||
+                navigator.userAgent.match(/IEMobile/i) || 
+                navigator.userAgent.match(/iPhone|iPad|iPod/i)
+              )
+            {
+              return true;
+            }
+            else
+            {
+              return false;
+            }
+        }
+
+        // Close TOC
+        function closTOC(){
+            $("#toc").hide("slide", 500);
+            $("#toctitle").hide("slide", 500);
+            $(".ui-resizable-e").hide("slide", 500);
+            // Show the show/hide button
+            $("#toggle").css("right", "-40px");
+            // Fil width
+            $("body").animate({"margin-left": "50px"}, 500);
+        }
+
+        // Open TOC
+        function openTOC(){
+            $("#toc").show("slide", 500);
+            $("#toctitle").show("slide", 500);
+            $(".ui-resizable-e").show("slide", 500);
+            // Show the show/hide button
+            $("#toggle").css("right", "15px");
+            // Minimize page width
+            $("body").animate({"margin-left": $(toc).outerWidth()+20+"px"}, 500);
+        }
+
+      });
 
 </script>
 ++++
index 276f21e..11cca9f 100644 (file)
@@ -254,8 +254,7 @@ def configure(conf):
 def convert_to_pdf(task):
     input_file = task.outputs[0].abspath()
     out_dir = task.outputs[0].parent.get_bld().abspath()
-    os.system('a2x --no-xmllint -v -f pdf  -d  article %s -D %s ' %(task.inputs[0].abspath(),out_dir ) )
-    return (0)
+    return  os.system('a2x --no-xmllint -v -f pdf  -d  article %s -D %s ' %(task.inputs[0].abspath(),out_dir ) )
 
 
 
@@ -280,20 +279,22 @@ def convert_to_html_toc_book(task):
     json_out_file = os.path.splitext(task.outputs[0].abspath())[0]+'.json' 
     tmp = os.path.splitext(task.outputs[0].abspath())[0]+'.tmp' 
     json_out_file_short = os.path.splitext(task.outputs[0].name)[0]+'.json' 
-    
-    cmd='{0} -a stylesheet={1} -a  icons=true -a docinfo -d book   -a max-width=55em  -o {2} {3}'.format(
+
+    cmd='{0} -a stylesheet={1} -a  icons=true -a docinfo -d book -a max-width=55em  -o {2} {3}'.format(
             task.env['ASCIIDOC'],
             task.inputs[1].abspath(),
             tmp,
             task.inputs[0].abspath());
 
-    os.system( cmd )
+    res= os.system( cmd )
+    if res !=0 :
+        return (1)
 
     create_toc_json(tmp,json_out_file)
 
     toc_fixup_file(tmp,task.outputs[0].abspath(),json_out_file_short);
 
-    os.system('rm {0}'.format(tmp));
+    return os.system('rm {0}'.format(tmp));
 
 
 
@@ -301,8 +302,7 @@ def convert_to_html_toc_book(task):
 def convert_to_pdf_book(task):
     input_file = task.outputs[0].abspath()
     out_dir = task.outputs[0].parent.get_bld().abspath()
-    os.system('a2x --no-xmllint -v -f pdf  -d book %s -D %s ' %(task.inputs[0].abspath(),out_dir ) )
-    return (0)
+    return os.system('a2x --no-xmllint -v -f pdf  -d book %s -D %s ' %(task.inputs[0].abspath(),out_dir ) )
 
 
 def ensure_dir(f):
@@ -494,7 +494,6 @@ def build(bld):
         source='trex_rpc_server_spec.asciidoc waf.css', target='trex_rpc_server_spec.html',scan=ascii_doc_scan);
 
 
-
     bld(rule='${ASCIIDOC}   -a stylesheet=${SRC[1].abspath()} -a  icons=true -a toc2 -a max-width=55em  -o ${TGT} ${SRC[0].abspath()}',
         source='vm_doc.asciidoc waf.css', target='vm_doc.html', scan=ascii_doc_scan)
 
@@ -594,6 +593,9 @@ def publish_test(bld):
 
 
 
+def publish_both(bld):
+    publish(bld)
+    publish_ext(bld)