Skip to content

Commit

Permalink
Make twitch irc extraction better.
Browse files Browse the repository at this point in the history
  • Loading branch information
stefansundin committed Jan 14, 2017
1 parent 01a8645 commit 9b576a1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion public/js/main.js
Expand Up @@ -55,7 +55,12 @@ $(document).ready(function() {
});
form.find("[data-irc]").each(function() {
btn = $(this);
btn.attr("href", `irc://${btn.attr("data-irc")}/${basename(q)}`);
var m = /(?:https?:\/\/(?:www\.|clips\.)?twitch\.tv\/)?([^/]+)/.exec(q);
if (m == null) {
return;
}
var channel = m[1];
btn.attr("href", `irc://${btn.attr("data-irc")}/${channel}`);
});
});

Expand Down

0 comments on commit 9b576a1

Please sign in to comment.