Last active
February 18, 2019 22:14
-
-
Save oaustegard/e118c864e7e66b84af7db0d72c94b3d3 to your computer and use it in GitHub Desktop.
Simple JS code for adding links to all headers on a Confluence page
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
AJS.$("[id]").filter(":header").each(function(){ | |
try { | |
$(this).prepend("<a href='#" + $(this).attr("id") + "'>#</a>"); | |
catch(e) { console.log(e) } | |
}); |
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
javascript:AJS.$("[id]").filter(":header").each(function(){$(this).prepend("<a href='#"+$(this).attr("id")+"'>#</a>")}) |
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
<script type="text/javascript"> | |
//prepend each header with a link to the header that can be used for ease of deep linking | |
AJS.$(document).ready(function(){ | |
AJS.$("[id]").filter(":header").each(function(){ | |
try { | |
$(this).prepend("<a href='#" + $(this).attr("id") + "'>#</a>"); | |
} catch(e) { console.log(e) } | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment