Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Unified Diff: components/dom_distiller/core/javascript/dom_distiller_viewer.js

Issue 880983007: Iframe placeholders, security and resizing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/dom_distiller/core/css/distilledpage.css ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/dom_distiller/core/javascript/dom_distiller_viewer.js
diff --git a/components/dom_distiller/core/javascript/dom_distiller_viewer.js b/components/dom_distiller/core/javascript/dom_distiller_viewer.js
index 24d41fdf25bf5f943caf443584f92b6bc6936c3f..b330fbbf70c80dba55ade055274bcaa47b585924 100644
--- a/components/dom_distiller/core/javascript/dom_distiller_viewer.js
+++ b/components/dom_distiller/core/javascript/dom_distiller_viewer.js
@@ -6,6 +6,32 @@ function addToPage(html) {
var div = document.createElement('div');
div.innerHTML = html;
document.getElementById('content').appendChild(div);
+ fillYouTubePlaceholders();
+}
+
+function fillYouTubePlaceholders() {
+ var placeholders = document.getElementsByClassName('embed-placeholder');
+ for (var i = 0; i < placeholders.length; i++) {
+ if (!placeholders[i].hasAttribute('data-type') ||
+ placeholders[i].getAttribute('data-type') != 'youtube' ||
+ !placeholders[i].hasAttribute('data-id')) {
+ continue;
+ }
+ var embed = document.createElement('iframe');
+ var url = 'http://www.youtube.com/embed/' +
+ placeholders[i].getAttribute('data-id');
+ embed.setAttribute('class', 'youtubeIframe');
+ embed.setAttribute('src', url);
+ embed.setAttribute('type', 'text/html');
+ embed.setAttribute('frameborder', '0');
+
+ var parent = placeholders[i].parentElement;
+ var container = document.createElement('div');
+ container.setAttribute('class', 'youtubeContainer');
+ container.appendChild(embed);
+
+ parent.replaceChild(container, placeholders[i]);
+ }
}
function showLoadingIndicator(isLastPage) {
« no previous file with comments | « components/dom_distiller/core/css/distilledpage.css ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698