Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: static/js/index.js

Issue 29572820: Issue 5727 - Implement non-embedded homepage video on abp.org (Closed) Base URL: https://hg.adblockplus.org/web.adblockplus.org
Patch Set: Created Oct. 10, 2017, 6:09 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: static/js/index.js
===================================================================
--- a/static/js/index.js
+++ b/static/js/index.js
@@ -1,10 +1,12 @@
(function()
{
+ document.documentElement.className = "js";
+
var visibleTab;
var container = document.getElementById("more-container");
window.toggleMore = function()
{
if (container.className == "hidden")
container.className = visibleTab || getDefaultTab();
else
@@ -20,9 +22,32 @@
function getDefaultTab()
{
var content = document.getElementById("content");
var ua = content.className.match(/ua\-([^\s]+)/);
visibleTab = ua && ua[1] || "firefox";
return visibleTab;
}
+
+ function changeImageToVideo(event)
+ {
+ event.preventDefault();
+
+ var image = this;
+
+ var video = document.createElement("iframe");
+ video.id = "video";
+ video.setAttribute("frameborder", "0");
+ video.setAttribute("height", "285");
+ video.setAttribute("width", "520");
+ video.setAttribute("itemprop", "video");
+ video.setAttribute("allowfullscreen", "allowfullscreen");
+ video.setAttribute("src", image.getAttribute("href"));
+
+ image.parentNode.replaceChild(video, image);
+ }
+
+ document
+ .getElementById("video")
+ .addEventListener("click", changeImageToVideo);
+
})();

Powered by Google App Engine
This is Rietveld