Created
December 2, 2015 22:19
-
-
Save jptrsn/208fa3daeeb9a5055e50 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="Twitter Timeline" | |
description="Add a twitter timeline." | |
thumbnail="http://www.gstatic.com/sites-gadgets/common/images/sites-icon-gadget-thumb.png" | |
screenshot="http://www.gstatic.com/sites-gadgets/common/images/sites-icon-gadget-ss.png" | |
author="Open Source Teacher" | |
height="600" width="250" | |
/> | |
<UserPref name="handle" display_name="Twitter Handle (no @ symbol)" required="true"/> | |
<UserPref name="id" display_name="Twitter Widget ID (number)" required="true"/> | |
<Content type="html"> | |
<![CDATA[ | |
<a class="twitter-timeline" id="widget"></a> | |
<script type="text/javascript"> | |
gadgets.util.registerOnLoadHandler(doRender); | |
function doRender() { | |
var prefs = new gadgets.Prefs(); | |
var handle = prefs.getString("handle"); | |
var href = "https://twitter.com/" + handle; | |
document.getElementById("widget").setAttribute("href",href); | |
var id = prefs.getString("id"); | |
document.getElementById("widget").setAttribute("data-widget-id",id); | |
document.getElementById("widget").innerHTML = "Tweets by @" + handle; | |
} | |
!function(d,s,id){ | |
var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https'; | |
if(!d.getElementById(id)){ | |
js=d.createElement(s); | |
js.id=id; | |
js.src=p+"://platform.twitter.com/widgets.js"; | |
fjs.parentNode.insertBefore(js,fjs); | |
} | |
} | |
(document,"script","twitter-wjs"); | |
</script> | |
]]> | |
</Content> | |
</Module> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment