Skip to content

Instantly share code, notes, and snippets.

@kostia
Created October 4, 2016 08:59
Show Gist options
  • Save kostia/247c3e533d32082ca79c1577746a7fca to your computer and use it in GitHub Desktop.
Save kostia/247c3e533d32082ca79c1577746a7fca to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="Hangout Starter">
<Require feature="rpc" />
<Require feature="views" />
<Require feature="locked-domain" />
</ModulePrefs>
<Content type="html"><![CDATA[
<html>
<style type="text/css">
<!--
.button {
border-radius: 3px;
-moz-border-radius: 3px;
background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#ddd));
background: -moz-linear-gradient(top, #fff, #ddd);
border: 1px solid #bbb;
}
.button:active {
background: -webkit-gradient(linear, left top, left bottom, from(#aaa), to(#333));
background: -moz-linear-gradient(bottom, #ddd, #aaa); }
-->
</style>
<body>
<script src="//plus.google.com/hangouts/_/api/v1/hangout.js"></script>
<h3>Simple Hangout App</h3>
<p>
<input class="button" type="button" value="Show participants!" id="showParticipants"
style="visibility:hidden;"
onClick="showParticipants()"/>
</p>
<div id="participantsDiv"></div>
<hr>
<script>
function showParticipants() {
var participants = gapi.hangout.getParticipants();
var markup = '<p>Participants: </p><ul>';
for (var index in participants) {
var participant = participants[index];
if (!participant.person) {
markup += '<li>A participant not running this app</li>';
}
markup += '<li>' + participant.person.displayName + '</li>';
}
markup += '</ul>';
var div = document.getElementById('participantsDiv');
div.innerHTML = markup;
}
gadgets.util.registerOnLoadHandler(function() {
gapi.hangout.onApiReady.add(function(event) {
if (event.isApiReady) {
document.getElementById('showParticipants').style.visibility = 'visible';
}
});
});
</script>
</body>
]]>
</Content>
</Module>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment