diff --git a/source/javascripts/init.js b/source/javascripts/init.js new file mode 100644 index 0000000..3bf546d --- /dev/null +++ b/source/javascripts/init.js @@ -0,0 +1,24 @@ +$(function() { + var toc = $("#toc").tocify({ + selectors: "h1,h2", + extendPage: false, + theme: "none", + smoothScroll: false, + showEffectSpeed: 0, + hideEffectSpeed: 180, + ignoreSelector: ".toc-ignore", + hashGenerator: 'pretty', + highlightOffset: 60, + scrollTo: -2, + scrollHistory: true, + hashGenerator: function(text, element) { + return element[0].getAttribute('id'); + } + }).data("toc-tocify"); + + // Hack to make already open sections to start opened, + // instead of displaying an ugly animation + setTimeout(function() { + toc.setOption("showEffectSpeed", 180); + },50); +}); diff --git a/source/layouts/layout.erb b/source/layouts/layout.erb index bcceb15..23aa1f3 100644 --- a/source/layouts/layout.erb +++ b/source/layouts/layout.erb @@ -13,6 +13,7 @@ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. %> +<% language_tabs = current_page.data.language_tabs %>
@@ -26,45 +27,16 @@ under the License. <%= stylesheet_link_tag "screen", media: 'screen' %> <%= stylesheet_link_tag "print", media: 'print' %> - + <%= javascript_include_tag "all" %> - + <% if language_tabs %> + + <% end %> @@ -73,35 +45,33 @@ under the License.