mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 09:26:54 -06:00
Fix: Set title for multiple youtube video player with the same ID (don't rely on id to set title)
When an identical youtube video is embedded multiple times on the same page. it will only be successful setting title to 1st element in the dom matching a unique id which is based on the actual youtube video id.
This commit is contained in:
parent
cd8b896272
commit
17febe4914
@ -33,9 +33,9 @@
|
||||
})
|
||||
.html('<p id="lazyYT-title-' + id + '" class="lazyYT-title"></p><div class="lazyYT-button"></div>')
|
||||
.addClass('lazyYT-image-loaded');
|
||||
|
||||
$el_title = $el.find("p.lazyYT-title"); //get reference to the current container title element
|
||||
$.getJSON('https://gdata.youtube.com/feeds/api/videos/' + id + '?v=2&alt=json', function (data) {
|
||||
$('#lazyYT-title-' + id).text(data.entry.title.$t);
|
||||
$el_title.text(data.entry.title.$t);
|
||||
});
|
||||
|
||||
$el.on('click', function (e) {
|
||||
|
Loading…
Reference in New Issue
Block a user