Skip to content

Instantly share code, notes, and snippets.

@dangerouse
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dangerouse/11198293 to your computer and use it in GitHub Desktop.
Save dangerouse/11198293 to your computer and use it in GitHub Desktop.
CloudSponge Widget Reference - Custom Close Button
<!DOCTYPE html>
<html>
<body>
<p>
<a class="cs_import">Add from address book</a>
<!-- This textarea will be populated with the contacts returned by CloudSponge -->
<textarea id="contact_list" style="width:450px;height:82px"></textarea>
</p>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script type="text/javascript">
var logoutLinks = {
gmail:"https://accounts.google.com/Logout",
aol:"https://my.screenname.aol.com/_cqr/logout/mcLogout.psp",
yahoo:"https://login.yahoo.com/config/login?.src=fpctx&logout=1&.direct=1",
windowslive:"http://login.live.com/logout.srf?&lc=4105&id=256455&ru=http://ca.msn.com/?ocid=mailsignout"
};
function logout(source) {
// create the iframe
frame = $('<iframe />', {src:logoutLinks[source],width:'0px',height:'0px'});
frame.load(function(){
// cleanup the iframe after it completes the logout function
// also has the nice side effect of preventing the contents from
// redirecting the parent page to a new location... live.com..
frame.remove();
})
frame.appendTo('body');
}
// Asynchronously include the widget library.
// TODO: Replace the YOUR_WIDGET_SCRIPT with valid value
(function(u){
var d=document,s='script',a=d.createElement(s),m=d.getElementsByTagName(s)[0];
a.async=1;a.src=u;m.parentNode.insertBefore(a,m);
})('//api.cloudsponge.com/widget/YOUR_WIDGET_SCRIPT.js');
window.csPageOptions = {
textarea_id:"contact_list",
afterImport: function(source, success) {
// force lowercase
source = source.toLowerCase();
logout(source);
}
};
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment