Last active
January 30, 2016 23:15
-
-
Save bhagman/d06faff090bebe7f55d7 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
<Module> | |
<ModulePrefs | |
width="300" | |
height="106" | |
border="0" | |
description="Add Google Plus Badge to your Google Site." | |
author="Brett Hagman" | |
author_email="[email protected]"> | |
<Require feature="dynamic-height"/> | |
</ModulePrefs>/> | |
<UserPref name="gplusID" display_name="Google+ ID" datatype="string" required="true"/> | |
<Content type="html"> | |
<![CDATA[ | |
<div id="GPlusBadge"></div> | |
<script type="text/javascript"> | |
function modifyHead() | |
{ | |
var prefs = new gadgets.Prefs(); | |
var gplusID = prefs.getString('gplusID'); | |
document.getElementById('GPlusBadge').innerHTML = '<div class="g-person" data-href="https://plus.google.com/' + gplusID + '" data-layout="landscape" data-width="300"></div>'; | |
link = document.createElement('link'); | |
link.href = 'https://plus.google.com/' + gplusID; | |
link.rel = 'publisher'; | |
document.getElementsByTagName('head')[0].appendChild(link); | |
script = document.createElement('script'); | |
script.type = 'text/javascript'; | |
script.innerHTML = '(function(){var po = document.createElement("script");po.type = "text/javascript"; po.async = true;po.src = "https://apis.google.com/js/platform.js";var s = document.getElementsByTagName("script")[0];s.parentNode.insertBefore(po, s);})();'; | |
document.getElementsByTagName('head')[0].appendChild(script); | |
} | |
gadgets.util.registerOnLoadHandler(modifyHead); | |
</script> | |
]]> | |
</Content> | |
</Module> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment