Skip to content

Commit 97c493f

Browse files
committed
fix(sources): fix haloruns previous record video and user links
1 parent debd0fd commit 97c493f

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

background/sources/collections/haloruns.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ const RECORDS_PAGE = 'https://haloruns.com/records?recent';
55
const resolveLink = ($link) => {
66
return new URL($link.getAttribute('href'), RECORDS_PAGE).href;
77
};
8+
const embedLink = ($link) => {
9+
const $a = document.createElement('a');
10+
$a.href = resolveLink($link);
11+
$a.target = '_blank';
12+
$a.textContent = $link.textContent;
13+
return $a.outerHTML;
14+
};
815

916
export default async () => {
1017
const body = await util.ajax(RECORDS_PAGE);
@@ -56,8 +63,8 @@ export default async () => {
5663
title: game + ' ' + difficulty + ' - ' + $level.textContent +
5764
' (' + $newRecord.textContent.replace(/ /g, '') + ')',
5865
timestamp: date.getTime(),
59-
desc: 'Previous Record: ' + $previousRecord.outerHTML +
60-
' by ' + $previousUser.outerHTML + '<br />' +
66+
desc: 'Previous Record: ' + embedLink($previousRecord) +
67+
' by ' + embedLink($previousUser) + '<br />' +
6168
'Time Saved: ' + timeSaved,
6269
game: { name: game },
6370
});

0 commit comments

Comments
 (0)