Last active
March 8, 2016 22:55
-
-
Save dangerouse/2163217 to your computer and use it in GitHub Desktop.
Cloudsponge Widget Reference - Asynchronous Loading
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
<!DOCTYPE html> | |
<html> | |
<body onload="loadHandler()"> | |
<script type='text/javascript'> | |
// Replace the stylesheet with a valid value. | |
// basic csPageOptions, this variable can be defined anytime before the | |
// CloudSponge widget has initialized | |
window.csPageOptions = { | |
textarea_id:'contact_list', | |
}; | |
// Adds the CloudSponge javascript script tag to the page | |
function includeCloudSponge() { | |
var first_script = document.getElementsByTagName('script')[0]; | |
var s = document.createElement('script'); | |
s.setAttribute('type', 'text/javascript'); | |
s.setAttribute('src', "//api.cloudsponge.com/widget/YOUR_WIDGET_SCRIPT.js"); | |
first_script.parentNode.insertBefore(s, first_script); | |
} | |
// Called when the body of the document has loaded | |
function loadHandler() { | |
// Perform initialization here that must start immediately | |
// .. | |
// Load resources that don't need to be there right away | |
// .. | |
// Include CloudSponge after the time-critical initialization is complete | |
includeCloudSponge(); | |
} | |
</script> | |
<a class="cs_import">Add from Address Book</a> | |
<textarea id="contact_list" style="width:450px;height:82px"></textarea> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment