(searchTerm)
| 156 | }; |
| 157 | |
| 158 | const getWikiSearchString = (searchTerm) => { |
| 159 | const maxChars = getMaxChars(); |
| 160 | const rawSearchString = `https://en.wikipedia.org/w/api.php?action=query&generator=search&gsrsearch=${searchTerm}&gsrlimit=20&prop=pageimages|extracts&exchars=${maxChars}&exintro&explaintext&exlimit=max&format=json&origin=*`; |
| 161 | const searchString = encodeURI(rawSearchString); |
| 162 | return searchString; |
| 163 | }; |
| 164 | |
| 165 | const getMaxChars = () => { |
| 166 | const width = window.innerWidth || document.body.clientWidth; |
no test coverage detected