Difference between revisions of "MediaWiki:Common.js"
(Created page with "→Any JavaScript here will be loaded for all users on every page load.: →put here by Dotsarecoolp: $(document).ready(function() { $("[yt-ll-data]").each(function()...") |
m |
||
Line 3: | Line 3: | ||
/* put here by Dotsarecoolp */ | /* put here by Dotsarecoolp */ | ||
$(document).ready(function() { | $(document).ready(function() { | ||
− | $(" | + | $(".yt-ll-data [title]").each(function() { |
− | var url = $(this).attr(" | + | 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() { |
Revision as of 02:16, 11 May 2017
/* 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'></iframe>"); }); }); });