Skip to content

Instantly share code, notes, and snippets.

@beriberikix
Created June 19, 2012 15:45
Show Gist options
  • Save beriberikix/2954896 to your computer and use it in GitHub Desktop.
Save beriberikix/2954896 to your computer and use it in GitHub Desktop.
Guess the Pastry
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="Hangout Starter">
<Require feature="rpc" />
<Require feature="views" />
</ModulePrefs>
<Content type="html"><![CDATA[
<script src="//talkgadget.google.com/hangouts/_/api/hangout.js?v=1.1"></script>
<style>
.guess {
color: green;
}
</style>
<script>
var answer = 'nom';
function showParticipants() {
// list people in the hangout
var participants = gapi.hangout.getParticipants();
var retVal = '<p>Participants: </p><ul>';
for ( var index in participants ) {
var participant = participants[index];
retVal += '<li>' + participant.person.displayName + '</li>';
}
retVal += '</ul>';
var div = document.querySelector('#participants');
div.innerHTML = retVal;
}
function guess(){
// when they guess, disable the text button
}
function hasGuessed(id){
// check if they've guessed
}
function guessedCorrectly(){
// The prize http://t2ak.roblox.com/211849f350913e2fad980ab1d50fc4f8');
var nyan = gapi.hangout.av.effects.createImageResource('http://t2ak.roblox.com/211849f350913e2fad980ab1d50fc4f8');
nyan.showOverlay({'scale': {'magnitude': 0.5, 'reference': gapi.hangout.av.effects.ScaleReference.WIDTH}});
}
function myEventHandlers() {
gapi.hangout.onParticipantsChanged.add(showParticipants);
}
function startMyApp() {
}
function init() {
gapi.hangout.onApiReady.add(
function(eventObj) {
if (eventObj.isApiReady) {
myEventHandlers();
startMyApp();
}
});
}
gadgets.util.registerOnLoadHandler(init);
</script>
<h3>Guess that pastry</h3>
<img src="//farm3.staticflickr.com/2705/5799948301_99c92573f1_q.jpg" alt=""/>
<br />
<p>Your guess?</p>
<input type="text" id="guess"/><button id="save" onclick="javascript:guess()">Guess</button>
<div id="participants"></div>
]]>
</Content>
</Module>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment