Skip to content

Commit

Permalink
fix: it's not chorus anymore :(
Browse files Browse the repository at this point in the history
  • Loading branch information
guivictorr committed Feb 2, 2024
1 parent ec93f61 commit e154752
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
17 changes: 7 additions & 10 deletions src/chorus-button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,16 @@ function buildChorusIcon() {
}

function buildChorusUrl(songName: string | null, artistName: string | null) {
const queryParams = [];

if (songName) {
queryParams.push(`name="${songName}"`);
}

if (artistName) {
queryParams.push(`artist="${artistName}"`);
if (!songName || !artistName) {
return;
}

const queryString = queryParams.join(' ');
const query = new URLSearchParams({
name: songName,
artist: artistName,
});

return `https://chorus.fightthe.pw/search?query=${queryString}`;
return `https://www.enchor.us?${query.toString()}`;
}

function handleChorusButton(event: MouseEvent) {
Expand Down
4 changes: 2 additions & 2 deletions src/song-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export function getSongInfoFrom(offsetParent: Element) {
'a[data-testid="context-item-link"], a[data-testid="internal-track-link"], a[href^="/track"]',
);
const artistNameElement = Array.from(
offsetParent.querySelectorAll('a[href^="/artist"]'),
).pop();
document.querySelectorAll('a[href^="/artist"]'),
).shift();

const songName = sanitizeSongName(songNameElement?.textContent);
const artistName = artistNameElement?.textContent ?? null;
Expand Down

0 comments on commit e154752

Please sign in to comment.