Created
July 27, 2018 14:55
-
-
Save NinoSkopac/9019b0457f817f7b1dca135ddcdd1ee1 to your computer and use it in GitHub Desktop.
Read2Me Widget integration script
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
<script>(function(d, t, id) { | |
var s, r, div, c, js, h, sT, sI; | |
if (d.getElementById(id)) return; | |
div = d.createElement(t); div.id = id; | |
d.body.insertBefore(div, d.body.firstChild); | |
s = 'https://d22fip447qchhd.cloudfront.net/api/widget/1.1.0-beta5r3/widget.min.html'; | |
r = new XMLHttpRequest(); r.responseType = 'document'; r.open('GET', s, true); | |
r.onload = function(e) { | |
c = e.target.response.querySelector('style'); | |
js = e.target.response.querySelector('script'); | |
h = e.target.response.querySelector('div'); | |
div.outerHTML = ""; | |
div = d.createElement(t); div.id = id; | |
sT = d.createElement('script'); | |
sI = d.createTextNode(js.text); | |
sT.appendChild(sI); div.appendChild(sT); div.appendChild(c); div.appendChild(h); | |
d.body.insertBefore(div, d.body.firstChild); | |
}; | |
r.send(); | |
}(document, 'div', 'read2me-root'));</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment