Trikolon / liquidradio

Frontend for music station Liquid Radio
https://liquidradio.pro
MIT License
7 stars 2 forks source link

Support for url parameter 'station' #39

Closed Trikolon closed 7 years ago

Trikolon commented 7 years ago

Implement support for parameter station in the url. This enables direct sharing / bookmarking of stations via url.

Behavior: When the application loads it checks for parameter station in the url, where station holds the station id. E.g.: https://liquidradio.pro/?station=liquid_radio. If the parameter matches a station it selects that station initially. When the user selections a new station the parameter in the url is updated accordingly.

This function could be used to extract the parameter:

function getURLParameter(name) {
    return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search) || [null, ''])[1].replace(/\+/g, '%20')) || null;
}