Difference between revisions of "MediaWiki:Common.js"
m |
(allow full screen YT videos) |
||
(One intermediate revision by one other user not shown) | |||
Line 3: | Line 3: | ||
/* put here by Dotsarecoolp */ | /* put here by Dotsarecoolp */ | ||
$(document).ready(function() { | $(document).ready(function() { | ||
− | $(".yt-ll-data [title]").each(function() { | + | $(".yt-ll-data[title]").each(function() { |
var url = $(this).attr("title"); | var url = $(this).attr("title"); | ||
$(this).css("background-image","url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100'><polygon points='0,0 100,50 0,100' style='fill:white;' /></svg>\"),url(https://img.youtube.com/vi/" + url + "/0.jpg)"); | $(this).css("background-image","url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100'><polygon points='0,0 100,50 0,100' style='fill:white;' /></svg>\"),url(https://img.youtube.com/vi/" + url + "/0.jpg)"); | ||
$(this).click(function() { | $(this).click(function() { | ||
− | $(this).html("<iframe width='100%' height='100%' src='https://www.youtube.com/embed/" + url + "' frameborder='0'></iframe>"); | + | $(this).html("<iframe width='100%' height='100%' src='https://www.youtube.com/embed/" + url + "' frameborder='0' allowfullscreen></iframe>"); |
}); | }); | ||
}); | }); | ||
}); | }); |
Latest revision as of 21:55, 22 December 2019
/* Any JavaScript here will be loaded for all users on every page load. */ /* put here by Dotsarecoolp */ $(document).ready(function() { $(".yt-ll-data[title]").each(function() { var url = $(this).attr("title"); $(this).css("background-image","url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100'><polygon points='0,0 100,50 0,100' style='fill:white;' /></svg>\"),url(https://img.youtube.com/vi/" + url + "/0.jpg)"); $(this).click(function() { $(this).html("<iframe width='100%' height='100%' src='https://www.youtube.com/embed/" + url + "' frameborder='0' allowfullscreen></iframe>"); }); }); });