Last active
November 26, 2018 22:48
-
-
Save absyah/5104c6ba072437ad7778f4374d1be2b0 to your computer and use it in GitHub Desktop.
iframe widget
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
<script> | |
(function(d, h, m){ | |
var js, fjs = d.getElementsByTagName(h)[0]; | |
if (d.getElementById(m)){return;} | |
js = d.createElement(h); js.id = m; | |
js.onload = function(){ | |
window.mytimezoneis({ | |
position: "left", // left || right | |
emailhash: "e5507bee9e0bb54a1c5ea5df164c74a1", // your md5 encoded email address | |
})}; | |
js.src = "https://widgets.mytimezoneis.com/js/widget.js"; | |
fjs.parentNode.insertBefore(js, fjs) | |
}(document, "script", "dhm")) | |
</script> |
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
mytimezoneis = function(params) { | |
var server = 'https://widgets.mytimezoneis.com'; | |
if (params.environment) { | |
if (params.environment == 'local') { | |
server = 'http://mytimezoneis.devsite.at'; | |
} else if (params.environment == 'development') { | |
server = 'https://dev.mytimezone.com'; | |
} | |
} | |
var position='left'; | |
if (params.position) { | |
if (params.position == 'right') { | |
position = 'right'; | |
} | |
} | |
var iframe = document.createElement('iframe'); | |
iframe.style.display = "block"; | |
iframe.style.position = "fixed"; | |
iframe.style.border = "0"; | |
iframe.style.width = "200px"; | |
iframe.style.height = "80px"; | |
iframe.style.zIndex= "101"; | |
iframe.style.bottom = "10px"; | |
if (position == 'left') { | |
iframe.style.left = "10px"; | |
} else if (position == 'right') { | |
iframe.style.right = "10px"; | |
} | |
iframe.src = server+'/widget?emailhash='+params.emailhash | |
document.body.appendChild(iframe); | |
console.log(params); | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment