summaryrefslogtreecommitdiffstats
path: root/doc/trex_toc.asciidoc
blob: eecb883f77917e7000f01c996774078114541afb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
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="https://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[]