lib/rdoc/generator/template/rails/resources/js/main.js in sdoc-2.1.0 vs lib/rdoc/generator/template/rails/resources/js/main.js in sdoc-2.2.0

- old
+ new

@@ -25,9 +25,26 @@ $('.description pre').each(function() { hljs.highlightBlock(this); }); }); +document.addEventListener("turbolinks:load", function() { + // Only initialize panel if not yet initialized + if(!$('#panel .tree ul li').length) { + $('#links').hide(); + var panel = new Searchdoc.Panel($('#panel'), search_data, tree, $('meta[name="data-rel-prefix"]').attr("content")); + var s = window.location.search.match(/\?q=([^&]+)/); + if (s) { + s = decodeURIComponent(s[1]).replace(/\+/g, ' '); + if (s.length > 0) { + $('#search').val(s); + panel.search(s, true); + } + } + panel.toggle(JSON.parse($('meta[name="data-tree-keys"]').attr("content"))); + } +}); + // Keep scroll position for panel (function() { var scrollTop = 0; addEventListener("turbolinks:before-render", function() {