Created
January 14, 2010 17:36
-
-
Save jraines/277338 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Explanatory screencast: http://www.youtube.com/jraines002#p/u/0/Vj5LjE4kuLM | |
<?xml version="1.0" encoding="UTF-8" ?> | |
<Module> | |
<ModulePrefs title="My Gadget" height="30"> | |
<Require feature="wave" /> | |
<Require feature="locked-domain" /> | |
<Require feature="dynamic-height" /> | |
</ModulePrefs> | |
<Content type="html"> | |
<![CDATA[ | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> | |
<script type="text/javascript"> | |
function stateUpdated() { | |
if (wave.getState().get('approver')) { | |
$('#message').hide(); | |
$('#approval').append(wave.getState().get('approver', 'None')); | |
$('#approval').show(); | |
} | |
else { | |
$('#message').append("Click to Approve"); | |
} | |
} | |
function approve() { | |
var approver = wave.getViewer().getDisplayName(); | |
var state = wave.getState().submitDelta({'approver' : approver}); | |
} | |
function init() { | |
if (wave && wave.isInWaveContainer()) { | |
$(function() { | |
$('#approval').hide(); | |
$('#message').click(approve); | |
wave.setStateCallback(stateUpdated); | |
}); | |
} | |
} | |
gadgets.util.registerOnLoadHandler(init); | |
</script> | |
<div id="main" style="background:#DEDEDE; height:20px; width:90px"> | |
<div id="message" style="curson:pointer;background:red"> </div> | |
<div id="approval" style="background:green"> Approved By: </div> | |
</div> | |
]]> | |
</Content> | |
</Module> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment