Board Thread:Support Requests - Getting Technical/@comment-5961377-20140807025056/@comment-5961377-20150221232122

Well, the objective was getting linked images to embed in the chat, how would I go about fixing this?

And maybe also this other script, that embeds YouTube videos linked in chat... // Embed YouTube videos $(this.el).children('.message').children('a[href*="www.youtube.com/watch?"], a[href*="m.youtube.com/watch?"], a[href*="youtu.be/"]').each(function {                    var $this = $(this).text,                        result,                        res,                        ult,                        result2,                        result3,                        result4,                        result5,                        link,                        link2;

if (/www\.youtube\.com\/watch\?/.test($this) || /m\.youtube\.com\/watch\?/.test($this)) { if ($this.indexOf('http://') === 0) { result = $this.slice(7); } else if ($this.indexOf('https://') === 0) { result = $this.slice(8); }

res = result.indexOf('watch?'); ult = result.indexOf('v='); result2 = result.slice(0, res + 6) + result.slice(ult); result3 = result2.indexOf('&'); result4 = result2.substring(0, result3 !== -1 ? result3 : result2.length);

if (/www\.youtube\.com\/watch\?/.test($this)) { result5 = result4.replace('www.youtube.com/watch?v=', 'www.youtube.com/embed/'); } else { result5 = result4.replace('m.youtube.com/watch?v=', 'www.youtube.com/embed/'); }

link = result5.slice(0, 33); link2 = link.slice(22); } else { if ($this.indexOf('http://youtu.be/') === 0) { result = $this.slice(16); } else if ($this.indexOf('https://youtu.be/') === 0) { result = $this.slice(17); }

link = 'www.youtube.com/embed/' + result; link2 = result.slice(0, 11); }

$(this).after(' ');

var $el = $(this).parent('.message').children('table').children('tbody').children('tr').children('td').children('#comments'); $.getJSON('http://gdata.youtube.com/feeds/api/videos/' + link2 + '/comments', {                       v: 2,                        alt: 'json',                        'max-results': 50                    }, function (data) {                        $(data.feed.entry).each(function  { $(this.author).each(function {                                ytname = this.name.$t;                            }); var ytid = this.yt$channelId.$t, ytimage = ytid.slice(2), ytpblshd = this.published.$t, ytdt = ytpblshd.replace(/T/g, ' ').slice(0, 19), ytmnth = ytdt.slice(5, 7), ytyr = ytdt.slice(0, 4), ytdy = ytdt.slice(8, 10), yttm = ytdt.slice(11); $($el).append('  ' + ytname + ' ' + ytmnthnm[ytmnth - 1] + ' ' + ytdy + ', ' + ytyr + ' • ' + yttm + ' (UTC) ' + this.content.$t + ' '); });                   });                });

Simply appending these two scripts doesn't seem to work... I don't know where to place them.