Created
November 13, 2009 12:53
-
-
Save fd/233802 to your computer and use it in GitHub Desktop.
This file contains 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
<?xml version="1.0" encoding="UTF-8" ?> | |
<Module> | |
<ModulePrefs title="Gisty" height="120"> | |
<Require feature="wave" /> | |
</ModulePrefs> | |
<Content type="html"> | |
<![CDATA[ | |
<div id="form_div"><input type="text" value="" id="gist_id" /> <input type=button value="Click Me!" id="butCount" onClick="buttonClicked()" /></div> | |
<div id="content_div"><script src="GIST_URI"></script></div> | |
<script type="text/javascript"> | |
// <!-- | |
var content_div = document.getElementById('content_div'); | |
var form_div = document.getElementById('form_div'); | |
var content = content_div.innerHTML; | |
content_div.innerHTML = ''; | |
var form = form_div.innerHTML; | |
form_div.innerHTML = ''; | |
function buttonClicked() { | |
var field = document.getElementById('gist_id'); | |
wave.getState().submitDelta({'gist_id': field.value }); | |
} | |
function stateUpdated() { | |
if (wave.getState().get('gist_id')) { | |
content_div.innerHTML = content.replace("GIST_URI", "http://gist.github.com/"+"233802"+".js"); | |
} else { | |
content_div.innerHTML = form; | |
} | |
} | |
function init() { | |
if (wave && wave.isInWaveContainer()) { | |
wave.setStateCallback(stateUpdated); | |
} | |
} | |
gadgets.util.registerOnLoadHandler(init); | |
// --> | |
</script> | |
]]> | |
</Content> | |
</Module> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment