var loadSocialLogin = function() { var button_selectors = document.querySelectorAll("[class='sp-social-login_buttons']"); for(var i = 0; i < button_selectors.length; i++) { button_selectors[i].innerHTML='
'; } } var load = false; function waitForElementToDisplay(selector, time) { if(document.querySelector(selector)!=null) { if (!load) { //console.log("Social Login Loaded"); document.querySelector(selector).insertAdjacentHTML('beforeend','
'); load = true; } return; } else { setTimeout(function() { waitForElementToDisplay(selector, time); }, time); } } if (document.readyState === "complete") { loadSocialLogin(); } else { if (window.addEventListener) { window.addEventListener("load", loadSocialLogin, false); } else { if (window.attachEvent) { window.attachEvent('on' + "load", loadSocialLogin); } } } function eventer (e) { e.preventDefault ? e.preventDefault() : e.returnValue = false; if (e.origin+'/'=="https://bc.hexgator.com/") { var data = JSON.parse(e.data); var event = data.event; var channel = data.data.channel; var key = data.data.key; if (event=='doSocialLogin') { top.window.location.assign(key); } } } if (window.addEventListener) { window.addEventListener("message", eventer, false); } else { window.attachEvent("onmessage", eventer); }