Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- SharePoint WIKI Table of Contents. Sunnyape, August -->
- <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
- <script type="text/javascript">
- function hideTOC() {
- document.getElementById("theTOC").style.display = 'none';
- document.getElementById("show").style.display = 'block';
- document.getElementById("hide").style.display = 'none';
- }
- </script>
- <script type="text/javascript">
- function showTOC() {
- document.getElementById("theTOC").style.display = 'block';
- document.getElementById("show").style.display = 'none';
- document.getElementById("hide").style.display = 'block';
- }
- </script>
- <div id="wikiTOC">
- <table style="padding: 5px;"><tr>
- <td><div class="TOCheader">Table of Contents</div></td>
- <td>
- <div class="closehide" id='hide'>[<a href='#' title='Click to hide' onClick="hideTOC()">hide</a>]</div>
- <div class="closehide" id='show'>[<a href='#' title='Click to show' onClick="showTOC()">show</a>]</div>
- </td>
- </tr></table>
- <div id='theTOC'>
- <script type="text/javascript">
- $(document).ready(function(){
- var L2=0, L3=0, L4=0;
- $(".ms-wikicontent h1, .ms-wikicontent h2, .ms-wikicontent h3, .ms-wikicontent h4").each(function(i){
- theLevel=$(this).get(0).tagName;
- if (theLevel=="H2") {
- L2=L2+1;
- L3=0;
- L4=0;
- theLevelString=""+L2;
- }
- else if (theLevel=="H3") {
- L3=L3+1;
- L4=0;
- theLevelString=""+L2+"."+L3;
- }
- else {
- L4=L4+1;
- theLevelString=""+L2+"."+L3+"."+L4;
- }
- $(this).attr("id", "heading_" + i);
- $("#theTOC").append("<a href='#heading_" + i + "' title='" + theLevel + "'>" + theLevelString + " " + $(this).text() + "</a><br />");
- });
- });
- showTOC();
- </script>
- </div>
- </div>
- <style>
- #wikiTOC {border: 1px black dashed; background-color: whitesmoke; float: left; padding: 10px; padding-top: 0px;}
- #wikiTOC .TOCheader {font-size: 1.1em; font-weight: bold; text-align: center; padding: 5px;}
- #wikiTOC .closehide {font-size: 11px; font-weight: normal;}
- #wikiTOC a[title=H2] {font-size:12px; font-weight: normal;}
- #wikiTOC a[title=H3] {font-size:11px; font-weight: normal; margin-left: 8px;}
- #wikiTOC a[title=H4] {font-size:10px; font-weight: normal; margin-left: 16px;}
- </style>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement