Add table of contents on wiki pages
This commit is contained in:
parent
146e956432
commit
93af6a68bd
@ -18,6 +18,9 @@ by {$submitter}.{/blocktrans}</p>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div id="wiki-content">
|
||||
<div id="wiki-toc"><span id="contentheader">{trans 'Table of Content'}</span><div id="wiki-toc-content"></div></div>
|
||||
<script type="text/javascript" src="{media '/idf/js/wiki-toc.js'}"></script>
|
||||
<p class="desc">{$page.summary}</p>
|
||||
|
||||
{if !$oldrev}
|
||||
@ -29,6 +32,7 @@ by {$submitter}.{/blocktrans}</p>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
</div>
|
||||
{/block}
|
||||
{block context}
|
||||
{ashowuser 'submitter', $page.get_submitter(), $request}
|
||||
|
@ -746,6 +746,32 @@ ol > li {
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
#wiki-toc {
|
||||
float: right;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
#wiki-toc-content {
|
||||
border: 1px solid #999999;
|
||||
border-width: 1px 0;
|
||||
padding: 10px 0;
|
||||
padding-bottom: 25px;
|
||||
background-color: #ffffff;
|
||||
display: block;
|
||||
}
|
||||
|
||||
#wiki-toc-content a {
|
||||
display: block;
|
||||
}
|
||||
|
||||
#wiki-toc-content a.wiki-h2 {
|
||||
margin-left: 1em;
|
||||
}
|
||||
|
||||
#wiki-toc-content a.wiki-h3 {
|
||||
margin-left: 2em;
|
||||
}
|
||||
|
||||
/**
|
||||
* main menu
|
||||
*/
|
||||
|
7
www/media/idf/js/wiki-toc.js
Normal file
7
www/media/idf/js/wiki-toc.js
Normal file
@ -0,0 +1,7 @@
|
||||
$(document).ready(function() {
|
||||
$(":header", "#wiki-content").map(function (index) {
|
||||
this.id = "wikititle_" + index;
|
||||
$("<a href='#" + this.id + "'>" + this.innerText + "</a>").addClass("wiki-" + this.tagName.toLowerCase()).appendTo('#wiki-toc-content');
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user