Last active
March 10, 2016 10:57
-
-
Save TimoStahl/ab0717db4d93e77c0cc8 to your computer and use it in GitHub Desktop.
Sharepoint 2010 Wiki - Webpart - Table of Contents
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<WebPart xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/WebPart/v2"> | |
<Title>Automagic Table of Contents</Title> | |
<FrameType>Standard</FrameType> | |
<Description>This web part renders headlines for SharePoint 2010 wiki pages. (by Timo Litzbarski)</Description> | |
<IsIncluded>true</IsIncluded> | |
<ZoneID>Bottom</ZoneID> | |
<PartOrder>1</PartOrder> | |
<FrameState>Normal</FrameState> | |
<Height /> | |
<Width /> | |
<AllowRemove>true</AllowRemove> | |
<AllowZoneChange>true</AllowZoneChange> | |
<AllowMinimize>true</AllowMinimize> | |
<AllowConnect>false</AllowConnect> | |
<AllowEdit>false</AllowEdit> | |
<AllowHide>true</AllowHide> | |
<IsVisible>true</IsVisible> | |
<DetailLink /> | |
<HelpLink /> | |
<HelpMode>Modeless</HelpMode> | |
<Dir>Default</Dir> | |
<PartImageSmall /> | |
<MissingAssembly>Cannot import this Web Part.</MissingAssembly> | |
<PartImageLarge>/_layouts/images/itdl.gif</PartImageLarge> | |
<IsIncludedFilter /> | |
<Assembly>Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly> | |
<TypeName>Microsoft.SharePoint.WebPartPages.ContentEditorWebPart</TypeName> | |
<ContentLink xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor" /> | |
<Content xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor"> | |
<![CDATA[<script src=http://code.jquery.com/jquery-latest.js type=text/javascript></script> | |
<script type=text/javascript> | |
$(function(){ | |
function t(){ | |
$("#tl_toc").empty(); | |
$("h1, h2, h3, h4").each(function(i) { | |
var current = $(this); | |
var space = ""; | |
switch (current.prop("tagName")) { | |
case "H2": | |
space = " "; | |
break; | |
case "H3": | |
space = "  "; | |
break; | |
case "H4": | |
space = "   "; | |
break; | |
} | |
current.attr("id", "title" + i); | |
$("#tl_toc").append(space + "<a id='link" + i + "' href='#title" + i + "'>" + current.text() + "</a><br>"); | |
}); | |
} | |
ExecuteOrDelayUntilScriptLoaded(t,"sp.js")});</script> | |
<div id="tl_toc"></div>]]> | |
</Content> | |
<PartStorage xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor" /> | |
</WebPart> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment