Last active
May 23, 2017 19:10
-
-
Save crittermike/eed2d87e836a39240af76e405432dc21 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<div id="widget-container"></div> | |
<script type="text/javascript"> | |
// First grab the `view` param from the query string, if it exists | |
var reg = new RegExp( '[?&]' + 'view' + '=([^&#]*)', 'i' ); | |
var paramSearch = reg.exec(window.location.search); | |
var param = paramSearch ? paramSearch[1] : ''; | |
// Then build the JS file | |
var js = document.createElement("script"); | |
js.type = "text/javascript"; | |
js.src = "//getchant.com/widget/polling.min.js"; | |
// Then set the data-poll attribute based on the value from the query string | |
js.setAttribute('data-poll', param); | |
// Finally insert the JS file into the page. | |
document.getElementById("widget-container").appendChild(js); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment