Hi guys! I'm sorry to bother you, I've added twitch channels and twitch videos embed in my forum's post, but i can't make clip works.
I'm using this:
can't understand why he doesn't work, any help please?
---------------- edit: it works, but it conflits with "channel and video embed"
I'm using this:
- Code:
$(function(){
$('.postbody a[href*="twitch.tv"]').each(function() {
var clip = '/clip/';
var ytid = $(this).attr('href').replace(new RegExp('.*' + clip), '');
$(this).html('<iframe src="https://clips.twitch.tv/embed?clip=' +ytid+ '&parent=www.galaxypledges.net"' + " frameborder='0' allowfullscreen='true' scrolling='no' height='378' width='620'></iframe><br />");
});
});
can't understand why he doesn't work, any help please?
---------------- edit: it works, but it conflits with "channel and video embed"
- Code:
$('.postbody a[href*="twitch.tv"]').each(function() {
var ytid = $(this).attr('href').split("twitch.tv/")[1].split("?")[0];
$(this).html("<iframe src=https://player.twitch.tv/?channel=" +ytid+ "&parent=www.galaxypledges.net" + " frameborder='0' allowfullscreen='true' scrolling='no' height='378' width='620'></iframe><br />");
});
$('.postbody a[href*="twitch.tv"]').each(function() {
var ytid = $(this).attr('href').split("twitch.tv/")[1].split("/")[0];
$(this).html("<iframe src=https://player.twitch.tv/?channel=" +ytid+ "&parent=www.galaxypledges.net" + " frameborder='0' allowfullscreen='true' scrolling='no' height='378' width='620'></iframe><br />");
});
$('.postbody a[href*="twitch.tv"]').each(function() {
var ytid = $(this).attr('href').split("twitch.tv/videos/")[1].split("?")[0];
$(this).html("<iframe src=https://player.twitch.tv/?video=" +ytid+ "&parent=www.galaxypledges.net" + " frameborder='0' allowfullscreen='true' scrolling='no' height='378' width='620'></iframe><br />");
});