bookish-press 0.4.25 → 0.4.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -158,11 +158,15 @@ function scrollToLastLocation() {
158
158
  }
159
159
  }
160
160
  }
161
+ /** Account for static builds, where location isn't defined */
162
+ function getLocation() {
163
+ return typeof location === 'undefined' ? undefined : location;
164
+ }
161
165
  function getHighlightedWord() {
162
- return location.search.split('&')[0]?.split('=')[1] ?? undefined;
166
+ return getLocation()?.search.split('&')[0]?.split('=')[1] ?? undefined;
163
167
  }
164
168
  function getHighlightedNumber() {
165
- const number = location.search.split('&')[1]?.split('=')[1];
169
+ const number = getLocation()?.search.split('&')[1]?.split('=')[1];
166
170
  return number === undefined ? undefined : parseInt(number);
167
171
  }
168
172
  // Prepare to render the chapter by getting some data from the chapter and book.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bookish-press",
3
3
  "private": false,
4
- "version": "0.4.25",
4
+ "version": "0.4.26",
5
5
  "type": "module",
6
6
  "description": "A platform for reading and writing readable, accessible, beautiful online books.",
7
7
  "license": "MIT",