Reviewers: Paul Lindner, Description: * Adds a simple example of flash being used in a Caja gadget * Corrects a minor bug in the flash taming
Please review this at http://codereview.appspot.com/181187 Affected files: M features/src/main/javascript/features/flash/taming.js A javascript/samplecontainer/examples/FlashCajaExample.xml Index: javascript/samplecontainer/examples/FlashCajaExample.xml =================================================================== --- javascript/samplecontainer/examples/FlashCajaExample.xml (revision 0) +++ javascript/samplecontainer/examples/FlashCajaExample.xml (revision 0) @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Module> + <ModulePrefs title="Flash Caja Demo" + height="200" + description="Demonstrates the use of caja to protect flash gadgets"> + <Require feature="caja"></Require> + <Require feature="flash"></Require> + <Require feature="dynamic-height"></Require> + </ModulePrefs> + <Content type="html"> + <![CDATA[ + + Caja does not allow <code>object</code> or <code>embed</code> tags + in HTML. However, Shindig provides a tamed JavaScript API for + embedding flash on a page. To embed a flash file, use + <code>Require feature="flash"</code> in your + ModulePrefs and <code>gadges.flash.embedFlash</code> in the body of + your gadget to embed flash. +<p> +For example, here is a YouTube video. +<p> + <div id="ytapiplayer"> + You need Flash player 10 and JavaScript enabled to view this video. + </div> + <script type="text/javascript"> + var success = gadgets.flash.embedFlash( + "http://www.youtube.com/v/0AqMb-edXlc", // Flash video + "ytapiplayer", // id of div to place flash object + "10" // minimum version + ); + </script> +<script>gadgets.window.adjustHeight();</script> + ]]> + </Content> +</Module> Index: features/src/main/javascript/features/flash/taming.js =================================================================== --- features/src/main/javascript/features/flash/taming.js (revision 831107) +++ features/src/main/javascript/features/flash/taming.js (working copy) @@ -23,7 +23,7 @@ */ var tamings___ = tamings___ || []; tamings___.push(function(imports) { - ___.tamesTo(gadgets.flash.embedFlash, function () { + ___.tamesTo(gadgets.flash.embedFlash, (function () { var cleanse = (function () { // Gets a fresh Array and Object constructor that // doesn't have the caja properties on it. This is @@ -121,7 +121,7 @@ })(channel) }); }); - }); + })()); var d = document.createElement('div'); d.appendChild(document.createTextNode("bridge"));

