Sha256: 3727db991e2a263ab794635dc370105a431ef1d4c2c8db4153c8b23df1b05609

Contents?: true

Size: 1.02 KB

Versions: 6

Compression:

Stored size: 1.02 KB

Contents

<script>
  var anchorForId = function (id) {
    var anchor = document.createElement("a");
    anchor.className = "header-link";
    anchor.href      = "#" + id;
    anchor.innerHTML = "<span class=\"sr-only\">Permalink</span><i class=\"fa fa-link\"></i>";
    anchor.title = "Permalink";
    return anchor;
  };

  var linkifyAnchors = function (level, containingElement) {
    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));
      }
    }
  };

  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>

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
jekyll-docs-3.1.6 site/_includes/anchor_links.html
jekyll-docs-3.1.5 site/_includes/anchor_links.html
jekyll-docs-3.1.4 site/_includes/anchor_links.html
jekyll-docs-3.1.3 site/_includes/anchor_links.html
jekyll-docs-3.1.2 site/_includes/anchor_links.html
jekyll-docs-3.0.3 site/_includes/anchor_links.html