mirror of
https://github.com/koel/koel
synced 2024-12-21 10:03:10 +00:00
21 lines
383 B
JavaScript
21 lines
383 B
JavaScript
/**
|
|
* URL-related helpers
|
|
* @type {Object}
|
|
*/
|
|
export const url = {
|
|
/**
|
|
* Parse the song ID from a hash.
|
|
*
|
|
* @param {string} hash
|
|
*
|
|
* @return {string|boolean}
|
|
*/
|
|
parseSongId(hash = null) {
|
|
if (!hash) {
|
|
hash = window.location.hash;
|
|
}
|
|
|
|
const matches = hash.match(/#!\/song\/([a-f0-9]{32}$)/);
|
|
return matches ? matches[1] : false;
|
|
},
|
|
};
|