function displayText(match) {
  hide(matchesList);
  infoElement.textContent = '';
  queryInfoElement.textContent = '';
  const query = queryInput.value;
  // add history entry for the query when the user has tapped/clicked a match
  history.pushState({isSearchResults: true, query: query}, null,
    `${window.location.origin}#${query}`);
  // match.l is a citation for a play or poem, e.g. Ham.3.3.2, Son.4.11, Ven.140
  // scene title matches only have act and scene number, e.g. Ham.3.3
  history.pushState({isSearchResults: false}, null,
    `${window.location.origin}#${match.l}`);
  document.title = `Search Shakespeare: ${match.l}`;
  const location = match.l.split('.');
  const text = location[0];
  fetch(`${HTML_DIR}${text}.html`).then(response => {
    return response.text();
  }).then(html => {
    textDiv.innerHTML = html;
    textDiv.onmouseover = addWordSearch;
    show(textDiv);
    highlightMatch(match, location);
  });
}
// Display the appropriate text and location when a user taps/clicks on a match
Display the appropriate text and location when a user taps/clicks on a match
Display the appropriate text and location when a user taps / clicks on a match
function displayText(match) {
  hide(matchesList);
  infoElement.textContent = '';
  queryInfoElement.textContent = '';
  const query = queryInput.value;
  history.pushState({isSearchResults: true, query: query}, null,
    `${window.location.origin}#${query}`);
  history.pushState({isSearchResults: false}, null,
    `${window.location.origin}#${match.l}`);
  document.title = `Search Shakespeare: ${match.l}`;
  const location = match.l.split('.');
  const text = location[0];
  fetch(`${HTML_DIR}${text}.html`).then(response => {
    return response.text();
  }).then(html => {
    textDiv.innerHTML = html;
    textDiv.onmouseover = addWordSearch;
    show(textDiv);
    highlightMatch(match, location);
  });
}
function displayText ( match ) { hide ( matchesList ) ; infoElement . textContent = '' ; queryInfoElement . textContent = '' ; const query = queryInput . value ; history . pushState ( { isSearchResults : true , query : query } , null , ` ${ window . location . origin } ${ query } ` ) ; history . pushState ( { isSearchResults : false } , null , ` ${ window . location . origin } ${ match . l } ` ) ; document . title = ` ${ match . l } ` ; const location = match . l . split ( '.' ) ; const text = location [ 0 ] ; fetch ( ` ${ HTML_DIR } ${ text } ` ) . then ( response => { return response . text ( ) ; } ) . then ( html => { textDiv . innerHTML = html ; textDiv . onmouseover = addWordSearch ; show ( textDiv ) ; highlightMatch ( match , location ) ; } ) ; }
Display the appropriate text and location when a user taps/clicks on a match
Display the appropriate text and location when a user taps / clicks on a match
// add history entry for the query when the user has tapped/clicked a match // match.l is a citation for a play or poem, e.g. Ham.3.3.2, Son.4.11, Ven.140 // scene title matches only have act and scene number, e.g. Ham.3.3