@@ -1,7 +1,4 @@
2− // styling of input fields
1+// styling of input fields
5var inputElements = document.querySelectorAll('input.tlon-input');
2var inputElements = document.querySelectorAll('input.tlon-input');
6for (var i = 0; i < inputElements.length; i++) {
3for (var i = 0; i < inputElements.length; i++) {
7 //listen for changes in input
4 //listen for changes in input
@@ -30,10 +27,7 @@ for (var i = 0; i < inputElements.length; i++) {
34− // toggling of navigation menus
30+// toggling of navigation menus
37var toggleMainNav = document.getElementById('js-main-nav-toggle');
31var toggleMainNav = document.getElementById('js-main-nav-toggle');
38if (toggleMainNav !== null) {
32if (toggleMainNav !== null) {
39 toggleMainNav.onclick = function() {
33 toggleMainNav.onclick = function() {
@@ -48,20 +42,6 @@ if (toggleContentNav !== null) {
51−/*function initToggleMenu() {
52− var menu = document.querySelector(".menu");
53− var menuIcon = document.querySelector(".menu-icon");
54− var page = document.querySelector(".page");
55− menuIcon.addEventListener("click", function() {
56− menu.classList.toggle("menu-hidden");
57− page.classList.toggle("page-without-menu");
65function initHotKeys() {
45function initHotKeys() {
67 var bodyEl = document.body;
47 var bodyEl = document.body;
@@ -98,10 +78,8 @@ function initHotKeys() {
102− // search functionality
82+// search functionality
105function debounce(func, wait) {
83function debounce(func, wait) {
106 var timeout;
84 var timeout;
@@ -135,19 +113,10 @@ function makeTeaser(body, terms) {
135 //var TEASER_MAX_WORDS = 17;
113 //var TEASER_MAX_WORDS = 17;
136 var TEASER_MAX_CHARS = 63;
114 var TEASER_MAX_CHARS = 63;
139 var stemmedTerms = terms.map(function (w) {
116 var stemmedTerms = terms.map(function (w) {
140 return elasticlunr.stemmer(w.toLowerCase());
117 return elasticlunr.stemmer(w.toLowerCase());
143− console.log(stemmedTerms);
144− // create array with full word + partial Words (smallest fragment is 2 characters)
145− // first iteration is full word, then next is subset of the original word
146− /*var stemmedTerms = [];
147− for (var i = terms[0].length; i>=2; i--) {
148− stemmedTerms.push(terms[0].substring(0,i));
150− console.log(stemmedTerms);*/
151 var termFound = false;
120 var termFound = false;
152 var index = 0;
121 var index = 0;
153 var weighted = []; // contains elements of ["word", weight, index_in_document]
122 var weighted = []; // contains elements of ["word", weight, index_in_document]
@@ -290,7 +259,7 @@ function initSearch() {
291 var options = {
260 var options = {
292 bool: "AND",
261 bool: "AND",
293− expand: true,
262+ expand: true, // turn on partial word search
294 fields: {
263 fields: {
295 title: {boost: 2},
264 title: {boost: 2},
296 body: {boost: 1},
265 body: {boost: 1},
@@ -342,8 +311,6 @@ function initSearch() {
345− // change query in order to make partial words work
347 var results = index.search(term, options).filter(function (r) {
314 var results = index.search(term, options).filter(function (r) {
348 return r.doc.body !== "";
315 return r.doc.body !== "";