Skip to content

Instantly share code, notes, and snippets.

@victorknust
Forked from Swader/FW Survey 2015.js
Created March 26, 2014 15:23
Show Gist options
  • Save victorknust/9785902 to your computer and use it in GitHub Desktop.
Save victorknust/9785902 to your computer and use it in GitHub Desktop.
// DO NOT FORGET TO ADD A #tf_container DIV WHERE YOU WANT THE FORM TO APPEAR
var div=document.createElement('div');
div.setAttribute("class", "typeform-widget");
div.setAttribute("data-url", "https://bitfalls.typeform.com/to/tZ8wBZ"+location.search);
div.setAttribute("data-text", "Best PHP IDE for 2014");
div.setAttribute("style", "width:100%;height:600px;");
var tid = setInterval( function () {
if ( document.readyState !== 'complete' ) return;
clearInterval( tid );
var tfcon = document.getElementById('tf_container');
tfcon.appendChild(div);
(function(){var qs,js,q,s,d=document,gi=d.getElementById,ce=d.createElement,gt=d.getElementsByTagName,id='typef_orm',b='https://s3-eu-west-1.amazonaws.com/share.typeform.com/';if(!gi.call(d,id)){js=ce.call(d,'script');js.id=id;js.src=b+'widget.js';q=gt.call(d,'script')[0];q.parentNode.insertBefore(js,q)}})()
}, 100 );
var div=document.createElement("div");div.setAttribute("class","typeform-widget");div.setAttribute("data-url","https://bitfalls.typeform.com/to/tZ8wBZ"+location.search);div.setAttribute("data-text","Best PHP IDE for 2014");div.setAttribute("style","width:100%;height:600px;");
var tid=setInterval(function(){if("complete"===document.readyState){clearInterval(tid);document.getElementById("tf_container").appendChild(div);var b,a;a=document;b=a.createElement;var c=a.getElementsByTagName;a.getElementById.call(a,"typef_orm")||(b=b.call(a,"script"),b.id="typef_orm",b.src="https://s3-eu-west-1.amazonaws.com/share.typeform.com/widget.js",a=c.call(a,"script")[0],a.parentNode.insertBefore(b,a))}},100);
var tid = setInterval( function () {
if ( document.readyState !== 'complete' ) return;
clearInterval( tid );
var tfcon = document.getElementById('tf_container');
var el;
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) ) {
el=document.createElement('a');
el.setAttribute('href', "https://bitfalls.typeform.com/to/tZ8wBZ"+location.search);
el.setAttribute('target', '_blank');
el.setAttribute('title', 'Go To Typeform');
el.innerHTML = "You're on a mobile client. Please click here to go to the survey";
} else {
el=document.createElement('div');
el.setAttribute("class", "typeform-widget");
el.setAttribute("data-url", "https://bitfalls.typeform.com/to/tZ8wBZ"+location.search);
el.setAttribute("data-text", "Best PHP IDE for 2014");
el.setAttribute("style", "width:100%;height:600px;");
}
tfcon.appendChild(el);
(function(){var qs,js,q,s,d=document,gi=d.getElementById,ce=d.createElement,gt=d.getElementsByTagName,id='typef_orm',b='https://s3-eu-west-1.amazonaws.com/share.typeform.com/';if(!gi.call(d,id)){js=ce.call(d,'script');js.id=id;js.src=b+'widget.js';q=gt.call(d,'script')[0];q.parentNode.insertBefore(js,q)}})()
}, 100 );
var tid=setInterval(function(){if("complete"===document.readyState){clearInterval(tid);var b=document.getElementById("tf_container"),a;/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)?(a=document.createElement("a"),a.setAttribute("href","https://bitfalls.typeform.com/to/tZ8wBZ"+location.search),a.setAttribute("target","_blank"),a.setAttribute("title","Go To Typeform"),a.innerHTML="You're on a mobile client. Please click here to go to the survey"):(a=document.createElement("div"),
a.setAttribute("class","typeform-widget"),a.setAttribute("data-url","https://bitfalls.typeform.com/to/tZ8wBZ"+location.search),a.setAttribute("data-text","Best PHP IDE for 2014"),a.setAttribute("style","width:100%;height:600px;"));b.appendChild(a);a=document;var b=a.createElement,c=a.getElementsByTagName;a.getElementById.call(a,"typef_orm")||(b=b.call(a,"script"),b.id="typef_orm",b.src="https://s3-eu-west-1.amazonaws.com/share.typeform.com/widget.js",a=c.call(a,"script")[0],a.parentNode.insertBefore(b,
a))}},100);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment