Merge pull request #2368 from XhmikosR/master

This commit is contained in:
Parker Moore 2014-05-12 01:11:15 -04:00
commit 31d7afc987
3 changed files with 29 additions and 24 deletions

View File

@ -1,27 +1,32 @@
<script type="text/javascript" charset="utf-8">
var anchorForId = function(id){
<script>
var anchorForId = function (id) {
var anchor = document.createElement("a");
anchor.className = "header-link";
anchor.href = "#" + id;
anchor.innerHTML = "<i class=\"fa fa-link\"></i>";
return anchor;
};
var anchor = document.createElement("a");
anchor.className = "header-link";
anchor.href = "#" + id;
anchor.innerHTML = '<i class="fa fa-link"></i>';
return anchor;
}
var linkifyAnchors = function(level, containingElement) {
var linkifyAnchors = function (level, containingElement) {
var headers = containingElement.getElementsByTagName("h" + level);
for (var h = 0; h < headers.length; h++) {
var header = headers[h];
var headers = containingElement.getElementsByTagName("h"+level);
for(var h=0; h<headers.length; h++){
var header = headers[h];
if (typeof header.id !== "undefined" && header.id !== "") {
header.appendChild(anchorForId(header.id));
}
}
};
if( typeof(header.id) !== "undefined" && header.id !== "" )
header.appendChild(anchorForId(header.id));
}
};
document.onreadystatechange = function(){
if(this.readyState === "complete"){
var contentBlock = document.getElementsByClassName("docs")[0] || document.getElementsByClassName("news")[0]
for(var level=1; level<=6; level++)
linkifyAnchors(level, contentBlock);
}
}
document.onreadystatechange = function () {
if (this.readyState === "complete") {
var contentBlock = document.getElementsByClassName("docs")[0] || document.getElementsByClassName("news")[0];
if (!contentBlock) {
return;
}
for (var level = 1; level <= 6; level++) {
linkifyAnchors(level, contentBlock);
}
}
};
</script>

View File

@ -10,7 +10,6 @@
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic,900">
<link rel="stylesheet" href="/css/screen.css">
<link rel="icon" type="image/x-icon" href="/favicon.ico">
{% include anchor_links.html %}
<!--[if lt IE 9]>
<script src="/js/html5shiv.min.js"></script>
<script src="/js/respond.min.js"></script>

View File

@ -6,6 +6,7 @@
{{ content }}
{% include footer.html %}
{% include anchor_links.html %}
{% include analytics.html %}
</body>