Skip to content

Instantly share code, notes, and snippets.

@ryanjbaxter
Created September 8, 2011 18:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanjbaxter/cb936123966efa6abbae to your computer and use it in GitHub Desktop.
Save ryanjbaxter/cb936123966efa6abbae to your computer and use it in GitHub Desktop.
BoulderUX
<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="YouTube Player" description="YouTube Player Using Embedded Experiences" height="400" width="700">
<Require feature="dynamic-height"></Require>
</ModulePrefs>
<Content type="html">
<![CDATA[
<script type="text/javascript">
function showPlayer(){
document.getElementById("player").innerHTML =
'<object width="480" height="385">' +
'<param name="movie" value="http://www.youtube.com/v/4eXXHmAHvDY?fs=1&amp;hl=en_US"></param>' +
'<param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param>' +
'<embed src="http://www.youtube.com/v/4eXXHmAHvDY?fs=1&amp;hl=en_US"' +
'type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480"' +
'height="385">' +
'</embed>' +
'</object>';
gadgets.window.adjustHeight();
}
function initData() {
showPlayer();
}
gadgets.util.registerOnLoadHandler(initData);
</script>
<div id="player">
</div>
]]>
</Content>
</Module>
<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="YouTube Player" description="YouTube Player Using Embedded Experiences" height="400" width="700">
<Require feature="dynamic-height"></Require>
<Require feature="embedded-experiences"></Require>
</ModulePrefs>
<Content type="html" view="embedded,default">
<![CDATA[
<script type="text/javascript">
function showPlayer(context){
document.getElementById("player").innerHTML =
'<object width="480" height="385">' +
'<param name="movie" value="http://www.youtube.com/v/' + context + '?fs=1&amp;hl=en_US"></param>' +
'<param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param>' +
'<embed src="http://www.youtube.com/v/' + context + '?fs=1&amp;hl=en_US"' +
'type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480"' +
'height="385">' +
'</embed>' +
'</object>';
gadgets.window.adjustHeight();
}
function initData() {
opensocial.data.getDataContext().registerListener('org.opensocial.ee.context', function(key){
var context = opensocial.data.getDataContext().getDataSet(key);
showPlayer(context);
});
}
gadgets.util.registerOnLoadHandler(initData);
</script>
<div id="player">
</div>
]]>
</Content>
</Module>
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="Sample Gadget" height="500" width="600">
<Locale messages="http://doc.examples.googlepages.com/ALL_ALL.xml"/>
<Locale lang="de" messages="http://doc.examples.googlepages.com/de_ALL.xml"/>
<Locale lang="zh-cn" messages="http://doc.examples.googlepages.com/zh_cn_ALL.xml"/>
<Require feature="settitle"></Require>
</ModulePrefs>
<UserPref name="fontcolor" display_name="__MSG_color__" default_value="Red" datatype="enum">
<EnumValue value="Red" display_value="__MSG_red__" />
<EnumValue value="Green" display_value="__MSG_green__" />
</UserPref>
<Content type="html" view="home">
<![CDATA[
<div id="content_div"></div>
<script type="text/javascript">
// Display message in the user's preferred language
function displayMsg(){
var div = document.getElementById('content_div');
var prefs = new gadgets.Prefs(); // Get userprefs
div.style.color = prefs.getString("fontcolor"); // Set font color to user's color choice
var html = "<br><h1>";
html += prefs.getMsg("hello_world");
html += "</h1>";
div.innerHTML = html;
gadgets.window.setTitle(prefs.getMsg("hello_world"));
}
gadgets.util.registerOnLoadHandler(displayMsg);
</script>
]]>
</Content>
</Module>
<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="YouTube Player" description="YouTube Player Using Embedded Experiences" height="400" width="700">
<Require feature="embedded-experiences"></Require>
<Require feature="dynamic-height"></Require>
</ModulePrefs>
<Content type="html" view="embedded,default">
<![CDATA[
<script type="text/javascript">
function showPlayer(context){
document.getElementById("player").innerHTML = '<object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/' + context + '?fs=1&amp;hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/' + context + '?fs=1&amp;hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object>';
gadgets.window.adjustHeight();
}
function initData() {
opensocial.data.getDataContext().registerListener('org.opensocial.ee.context', function(key){
showPlayer(opensocial.data.getDataContext().getDataSet(key));
});
}
gadgets.util.registerOnLoadHandler(initData);
</script>
<div id="player">
</div>
]]>
</Content>
</Module>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment