@@ -67,6 +67,13 @@ function initToggleMenu() {
6767 }
6868}
6969
70+var toggleContentNav = document.getElementById('js-search-window-toggle');
71+if (toggleContentNav !== null) {
72+ toggleContentNav.onclick = function() {
73+ document.body.classList.toggle('has-active-search-window');
74+ }
75+}
76+
7077//
7178 // search functionality
7279//
@@ -100,7 +107,7 @@ function makeTeaser(body, terms) {
100107 var TERM_WEIGHT = 40;
101108 var NORMAL_WORD_WEIGHT = 2;
102109 var FIRST_WORD_WEIGHT = 8;
103− var TEASER_MAX_WORDS = 30;
110+ var TEASER_MAX_WORDS = 17;
104111
105112 var stemmedTerms = terms.map(function (w) {
106113 return elasticlunr.stemmer(w.toLowerCase());
@@ -202,29 +209,11 @@ function formatSearchResultItem(item, terms) {
202209 return li;
203210}
204211
205−// Go from the book view to the search view
206−function toggleSearchMode() {
207− var bookContent = document.querySelector(".book-content");
208− var searchContainer = document.querySelector(".search-container");
209− if (searchContainer.classList.contains("search-container--is-visible")) {
210− searchContainer.classList.remove("search-container--is-visible");
211− document.body.classList.remove("search-mode");
212− bookContent.style.display = "block";
213− } else {
214− searchContainer.classList.add("search-container--is-visible");
215− document.body.classList.add("search-mode");
216− $bookContent.style.display = "none";
217− document.getElementById("search").focus();
218− }
219−}
220−
221212function initSearch() {
222213 var searchInput = document.getElementById("search");
223214 if (!searchInput) {
224215 return;
225216 }
226− var searchIcon = document.getElementById("js-search-window-toggle");
227− searchIcon.addEventListener("click", toggleSearchMode);
228217
229218 var searchResults = document.querySelector(".search-results");
230219 var searchResultsHeader = document.querySelector(".search-results__header");