Made the regex check cooler

This commit is contained in:
WastedMeerkat 2021-10-19 05:05:34 -05:00 committed by GitHub
parent c8c95a3cf0
commit c298856c70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -424,7 +424,7 @@ Embedding =
key: 'TwitchTV' key: 'TwitchTV'
regExp: /^\w+:\/\/(?:www\.|secure\.|clips\.)?twitch\.tv\/(\w[^#\&\?]*)/ regExp: /^\w+:\/\/(?:www\.|secure\.|clips\.)?twitch\.tv\/(\w[^#\&\?]*)/
el: (a) -> el: (a) ->
if a.dataset.href.match(/^\w+:\/\/(www\.|secure\.|clips\.)?twitch\.tv/)[1] is 'clips.' if a.dataset.href.match(/^\w+:\/\/(?:(clips\.)|\w+\.)?twitch\.tv/)[1]
url = "//clips.twitch.tv/embed?clip=#{a.dataset.uid}&parent=#{location.hostname}" url = "//clips.twitch.tv/embed?clip=#{a.dataset.uid}&parent=#{location.hostname}"
else else
m = a.dataset.uid.match /(\w+)(?:\/(?:v\/)?(\d+))?/ m = a.dataset.uid.match /(\w+)(?:\/(?:v\/)?(\d+))?/