mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-04 18:29:27 +02:00
Fix client search
This commit is contained in:
parent
d235f6b0d1
commit
f3aaa9a95c
33 changed files with 245 additions and 249 deletions
18
client/src/app/shared/misc/utils.ts
Normal file
18
client/src/app/shared/misc/utils.ts
Normal file
|
@ -0,0 +1,18 @@
|
|||
// Thanks: https://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript
|
||||
|
||||
function getParameterByName (name: string, url: string) {
|
||||
if (!url) url = window.location.href
|
||||
name = name.replace(/[\[\]]/g, '\\$&')
|
||||
|
||||
const regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)')
|
||||
const results = regex.exec(url)
|
||||
|
||||
if (!results) return null
|
||||
if (!results[2]) return ''
|
||||
|
||||
return decodeURIComponent(results[2].replace(/\+/g, ' '))
|
||||
}
|
||||
|
||||
export {
|
||||
getParameterByName
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue