aboutsummaryrefslogtreecommitdiffstats
path: root/doc/toc.html
blob: 4da01d55da86d1fc4cc524448f35710a0567542b (plain) (blame)
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
<div class="" id="accordion">
    <div class="">
        <div class="">
            <h3 class="panel-title">
                    About
            </h3>
        </div>
        <div id="about" class="doco-section">
            <div class="flex-column">
                <a class="nav-link" href="/help/about/about">About</a>
                <a class="nav-link" href="/help/about/project">Project</a>
                <a class="nav-link" href="/help/about/about_hub">About this hub</a>
            </div>
        </div>
    </div>
    <div class="">
        <div class="">
            <h3 class="panel-title">
                    Members
            </h3>
        </div>
        <div id="members" class="doco-section">
            <div class="flex-column">
               <a class="nav-link" href="/help/member/member_guide">Guide</a>
               <a class="nav-link" href="/help/member/bbcode">BBcode Reference</a>
               <a class="nav-link" href="/help/bugs">Reporting Bugs</a>	
               <a class="nav-link" href="/help/member/member_faq">FAQ</a>
            </div>
        </div>
    </div>
    <div class="panel">
        <div class="">
            <h3 class="panel-title">
                    Administrators
            </h3>
        </div>
        <div id="administrators" class="doco-section">
            <div class="flex-column">
                <a class="nav-link" href="/help/admin/administrator_guide">Guide</a>
                <a class="nav-link" href="/help/admin/hub_snapshots">Hub Snapshots</a>
                <a class="nav-link" href="/help/database">Database Tables</a>
            </div>
        </div>
    </div>
    <div class="panel">
        <div class="">
            <h3 class="panel-title">
                    Developers
            </h3>
        </div>
        <div id="developers" class="doco-section">
            <div class="flex-column">
                <a class="nav-link" href="/help/developer/developer_guide">Guide</a>
                <a class="nav-link" href="/help/developer/covenant">Code of Conduct</a>
                <a class="nav-link" href="/help/developer/zot_protocol">Zot Protocol</a>
                <a class="nav-link" href="/help/developer/api_zot">Zot API</a>
                <a class="nav-link" href="/help/hooklist">Hooks</a>
            </div>
        </div>
    </div>
    <div class="panel">
        <div class="">
            <h3 class="panel-title">
                    Tutorials
            </h3>
        </div>
        <div id="tutorials" class="doco-section">
            <div class="flex-column">
                <a class="nav-link" href="/help/tutorials/personal_channel">Personal Channel</a>
            </div>
        </div>
    </div>
</div>
<script>
	toc = {};
    // Generate the table of contents in the side nav menu (see view/tpl/help.tpl)
    $(document).ready(function () {
        $(".doco-section").find('a').each(function(){
            var url = document.createElement('a');
            url.href = window.location;
            var pageName = url.href.split('/').pop().split('#').shift().split('?').shift();
            var linkName = $(this).attr('href').split('/').pop();
            if(pageName === linkName) {
                var tocUl = $(this).closest('a').append('<ul>').find('ul');
                tocUl.removeClass();  // Classes are automatically added to <ul> elements by something else
                tocUl.toc({content: "#doco-content", headings: "h3"});
                tocUl.addClass('toc-content');
				tocUl.addClass('list-unstyled');
		tocUl.attr('id', 'doco-side-toc');

            }
        });
		
		$(document.body).trigger("sticky_kit:recalc");

		toc.contentTop = [];
		toc.edgeMargin    = 20;   // margin above the top or margin from the end of the page
		toc.topRange      = 200;  // measure from the top of the viewport to X pixels down
		// Set up content an array of locations
		$('#doco-side-toc').find('a').each(function(){
			toc.contentTop.push( $( '#'+$(this).attr('href').split('#').pop() ).offset().top );
		});


		// adjust side menu
		$(window).scroll(function(){
			var winTop = $(window).scrollTop(),
				bodyHt = $(document).height(),
				vpHt = $(window).height() + toc.edgeMargin;  // viewport height + margin
			$.each( toc.contentTop, function(i,loc){
			 if ( ( loc > winTop - toc.edgeMargin && ( loc < winTop + toc.topRange || ( winTop + vpHt ) >= bodyHt ) ) ){
			  $('#doco-side-toc li')
			   .removeClass('selected-doco-nav')
			   .eq(i).addClass('selected-doco-nav');
				if (typeof($('#doco-side-toc li').eq(i).find('a').attr('href').split('#')[1]) !== 'undefined') {
					window.history.pushState({}, '', location.href.split('#')[0] + '#' + $('#doco-side-toc li').eq(i).find('a').attr('href').split('#')[1]);
				}
			 }
			});
		});
		
		// When the page loads, it does not scroll to the section specified in the URL because it
		// has not been constructed yet by the script. This will reload the URL
		if (typeof(location.href.split('#')[1]) !== 'undefined') {
			var p = document.createElement('a');
			p.href = location.href;
			var portstr = '';
			if(p.port !== '') {
				portstr = ':'+ p.port;
			}
			var newref = p.protocol + '//'+  p.hostname + portstr + p.pathname + p.hash.split('?').shift();
			location.replace(newref)
		}
	});
</script>