diff options
author | Yaroslav Brustinov <ybrustin@cisco.com> | 2016-11-07 10:36:10 +0200 |
---|---|---|
committer | Yaroslav Brustinov <ybrustin@cisco.com> | 2016-11-07 10:36:10 +0200 |
commit | 93dc74335a8082e0f54b1da7f6fc6e43ff3c10ee (patch) | |
tree | 3befab98de04fdbb63807c6db1844028ae50d8b6 /doc/trex_toc.asciidoc | |
parent | bdd1dea5e21a00b6af1b0ded09e7d528485d5196 (diff) | |
parent | 5925379b5fb30e548f1ba4e804af9865de8903ae (diff) |
Add 'doc/' from commit '5925379b5fb30e548f1ba4e804af9865de8903ae'
git-subtree-dir: doc
git-subtree-mainline: bdd1dea5e21a00b6af1b0ded09e7d528485d5196
git-subtree-split: 5925379b5fb30e548f1ba4e804af9865de8903ae
Diffstat (limited to 'doc/trex_toc.asciidoc')
-rw-r--r-- | doc/trex_toc.asciidoc | 331 |
1 files changed, 331 insertions, 0 deletions
diff --git a/doc/trex_toc.asciidoc b/doc/trex_toc.asciidoc new file mode 100644 index 00000000..a41d707f --- /dev/null +++ b/doc/trex_toc.asciidoc @@ -0,0 +1,331 @@ + +ifdef::backend-xhtml11[] +++++ +<div id="toc-section"> + <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="toc"> + <div id="nav-tree"> + + </div> + </div> +</div> + + + + <!-- load the theme CSS file --> + <link href="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/themes/default/style.min.css" rel="stylesheet"/> + + <link href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" rel="stylesheet" /> + + <!-- include the jQuery library --> + <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.1/jquery.min.js"> + </script> + + <!-- include the jQuery UI library --> + <script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"> + </script> + + <!-- include the minified jstree source --> + <script src="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/jstree.min.js"> + </script> + + <style type="text/css"> + + #toc { + margin-bottom: 2.5em; + } + + #toctitle { + color: #527bbd; + font-size: 1.1em; + font-weight: bold; + margin-top: 1.0em; + margin-bottom: 0.1em; + } + + @media screen { + body { + max-width: 50em; /* approximately 80 characters wide */ + margin-left: 20em; + } + + #toc { + position: fixed; + top: 51px; + left: 0; + bottom: 0; + width: 18em; + padding-bottom: 1.5em; + margin: 0; + overflow-x: auto !important; + overflow-y: auto !important; + border-right: solid 2px #cfcfcf; + background-color: #FAFAFA; + white-space: nowrap; + } + + #toctitle { + font-size: 17px !important; + color: #4d4d4d !important; + margin-top: 0px; + height: 36px; + line-height: 36px; + 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 { + margin-top: 0.5em; + } + + #toc .toclevel2 { + margin-top: 0.25em; + display: list-item; + color: #aaaaaa; + } + + } + + + /* Custom for Nave Tree */ + #nav-tree{ + margin-left: 10px !important; + } + + #nav-tree ul > li { + color: #000 !important; + } + + .jstree-wholerow.jstree-wholerow-clicked { + background-image: url('images/icons/selected_tab_bg.png'); + background-repeat: repeat-x; + color: #fff !important; + 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; + } + + .jstree-default .jstree-themeicon{ + display: none !important; + } + + + .jstree-anchor { + font-size: 12px !important; + color: #91A501 !important; + } + + + .jstree-clicked{ + color: green !important; + } + + + #toggle { + position: fixed; + top: 14px; + left: 10px; + z-index: 210; + width: 24px; + } + + #toggle img { + opacity:0.3; + } + + #toggle img:hover { + opacity:0.9; + } + + .trex_logo{ + top: 6px; + position: relative; + } + + + </style> + + + +<script> + + $(document).ready(function(){ + var isOpen = true; + + // Initialize NavTree + initializeNavTree(); + // Drag TOC left and right + initResizable(); + // Toggle TOC whe clicking on the menu icon + toggleTOC(); + // Handle Mobile - close TOC + checkMobile(); + + function initializeNavTree() { + + // TOC tree options + var toc_tree = $('#nav-tree'); + + var toc_tree_options = { + 'core' : { + "animation" :false, + "themes" : { "stripes" : false }, + 'data' : { + "url" : "./input_replace_me.json", + "dataType" : "json" // needed only if you do not supply JSON headers + } + } + , + "plugins" : [ "wholerow" ] + }; + + $('#nav-tree').jstree(toc_tree_options) ; + + toc_tree.on("changed.jstree", function (e, data) { + window.location.href = data.instance.get_selected(true)[0].original.link; + }); + } + + function initResizable() { + var toc = $("#toc"); + var body = $("body"); + + // On resize + $("#toc").resizable({ + resize: function(e, ui) { + resized(); + }, + handles: 'e' + }); + + // On zoom changed + $(window).resize(function() { + if(isOpen){ + resized(); + } + }); + + + // Do it for the first time + var tocWidth = $(toc).outerWidth(); + var windowHeight = $(window).height(); + $(".ui-resizable-e").css({"right":$(window).width()-parseInt(tocWidth)+"px"}); + $("#toctitle").css({"width":parseInt(tocWidth)-45+"px"}); + $("#toc-section").css({"height":windowHeight + "px"}); + $("#content-section").css({"height":windowHeight + "px"}); + + } + + function resized(){ + var body = $("body"); + var tocWidth = $(toc).outerWidth(); + var windowHeight = $(window).height(); + + body.css({"marginLeft":parseInt(tocWidth)+20+"px"}); + $(".ui-resizable-e").css({"right":$(window).width()-parseInt(tocWidth)+"px"}); + $("#toctitle").css({"width":parseInt(tocWidth)-45+"px"}); + $("#toc-section").css({"height":windowHeight + "px"}); + $("#content-section").css({"height":windowHeight + "px"}); + + } + + + function toggleTOC(){ + $( "#toggle" ).click(function() { + if ( isOpen ) { + // Close it + closTOC(); + } else { + // Open it + openTOC(); + } + // Toggle status + isOpen = !isOpen; + }); + } + + + // Close TOC by default if it is mobile + function checkMobile(){ + if(isMobileDevice()){ + closTOC(); + $(".ui-resizable-e").hide(); + } + } + + // 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); + if(!isMobileDevice()){ + $(".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); + if(!isMobileDevice()){ + $(".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> +++++ +endif::backend-xhtml11[] + |