Flyzoo Chat

<script>

window.FlyzooApi = {};

(function () {

var eventMethod = window.addEventListener ? “addEventListener” : “attachEvent”;
var detachEvent = window.removeEventListener ? “removeEventListener” : “detachEvent”;
var eventer = window[eventMethod];
var messageEvent = eventMethod == “attachEvent” ? “onmessage” : “message”;

window.eventHandler = function (e) {
window[detachEvent](messageEvent, window.eventHandler);

var evt = e[“data”];
window.FlyzooApi.AT = evt[“value”];

CallbackAccessToken()
}

eventer(messageEvent, window.eventHandler, false);

function getParameterByName(name) {

name = name.replace(/[\[]/, “\\\[“).replace(/[\]]/, “\\\]”);
var regexS = “[\\?&]” + name + “=([^&#]*)”;
var regex = new RegExp(regexS);
var results = regex.exec(window.location.search);
if (results == null)
return “”;
else
return decodeURIComponent(results[1].replace(/\+/g, ” “));
}

window._FlyzooApplicationId = getParameterByName(“appid”);

var fz = document.createElement(‘script’); fz.type = ‘text/javascript’; fz.async = true;

var xOrigin = “”;

if (getParameterByName(“url”) != null) {
xOrigin = getParameterByName(“url”);
}

var caller = window.opener != null ? window.opener : parent.window.opener;

caller.postMessage({ “message”: “askAccessToken”, “callback”: “CallbackAccessToken” }, xOrigin);

function CallbackAccessToken() {
fz.src = ‘//widget.flyzoo.co/scripts/flyzoo.start.js’;
var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(fz, s);
$(“body”).css({ “margin”: “0”, “padding”: “0”, “width”: “100%”, “height”: “100%” });
$(“body”).wrapInner(‘<div id=”flyzooScrollFix” style=”position:absolute;width:100%;height:100%;overflow:scroll; -webkit-overflow-scrolling:touch”>’);
}
})();

</script>

Pin It on Pinterest