Skip to content

Commit

Permalink
parse magnet link display name
Browse files Browse the repository at this point in the history
  • Loading branch information
4chenz committed Oct 29, 2022
1 parent f5712a8 commit 2b0a96e
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/Linkification/Linkify.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,16 @@ Linkify =
rel: 'noreferrer noopener'
target: '_blank'
href: text

# Insert the range into the anchor, the anchor into the range's DOM location, and destroy the range.
if /magnet:/.test text
range.extractContents()
dn = new URL(text)
if dn.searchParams.get('dn')
text: "🧲"+dn.searchParams.get('dn')
else
text: "🧲"+text

# Insert the range into the anchor, the anchor into the range's DOM location, and destroy$
$.add a, range.extractContents()
range.insertNode a

a
 
a

0 comments on commit 2b0a96e

Please sign in to comment.