]>
Commit | Line | Data |
---|---|---|
f3aaa9a9 C |
1 | // Thanks: https://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript |
2 | ||
3 | function getParameterByName (name: string, url: string) { | |
4 | if (!url) url = window.location.href | |
5 | name = name.replace(/[\[\]]/g, '\\$&') | |
6 | ||
7 | const regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)') | |
8 | const results = regex.exec(url) | |
9 | ||
10 | if (!results) return null | |
11 | if (!results[2]) return '' | |
12 | ||
13 | return decodeURIComponent(results[2].replace(/\+/g, ' ')) | |
14 | } | |
15 | ||
cd83ea1b C |
16 | function viewportHeight () { |
17 | return Math.max(document.documentElement.clientHeight, window.innerHeight || 0) | |
18 | } | |
19 | ||
f3aaa9a9 | 20 | export { |
cd83ea1b | 21 | viewportHeight, |
f3aaa9a9 C |
22 | getParameterByName |
23 | } |