// This is adapted from Terraform’s web site: // https://github.com/hashicorp/terraform-website/blob/b218a3a9aac14462065e2035e8281d38e784af47/content/source/assets/javascripts/application.js document.addEventListener('turbolinks:load', function() { "use strict"; // On docs/content pages, add a hierarchical quick nav menu if there are // more than two H2 headers. var headers = $('#inner').find('h2'); if (headers.length > 2 && $("div#inner-quicknav").length === 0) { // Build the quick-nav HTML: $("#inner h1").first().after( '
' ); var quickNav = $('#inner-quicknav > ul.dropdown'); headers.each(function(index, element) { var level = element.nodeName.toLowerCase(); var header_text = $(element).text(); var header_id = $(element).attr('id'); quickNav.append('