Last active
December 16, 2015 15:59
-
-
Save zesda/5459871 to your computer and use it in GitHub Desktop.
Dynamic Javascript snippet used to create the Zenbox (Live chat/Feedback tab) wherever it's desired. It's not perfect, but it works :)
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
var _body = document.getElementsByTagName('body') [0]; | |
var zenbox = document.createElement('script'); | |
zenbox.src = '//assets.zendesk.com/external/zenbox/v2.5/zenbox.js'; | |
var style = document.createElement('style'); | |
css = '@import url(//assets.zendesk.com/external/zenbox/v2.5/zenbox.css);'; | |
style.type = 'text/css'; | |
style.media = 'screen, projection'; | |
if (style.styleSheet){ | |
style.styleSheet.cssText = css; | |
} else { | |
style.appendChild(document.createTextNode(css)); | |
} | |
_body.appendChild(zenbox); | |
_body.appendChild(style); | |
setTimeout(function(){ | |
if (typeof(Zenbox) !== "undefined") { | |
Zenbox.init({ | |
dropboxID: "XXXXXXX", | |
url: "https://yourdomain.zendesk.com", | |
tabID: "Support", | |
tabColor: "#000", | |
tabPosition: "Right" | |
}); | |
} | |
}, 200); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment