Created
April 10, 2016 15:28
-
-
Save kaflan/3decf292ea7af4ae265f93dc443a22ea to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<div id="wufoo-q1m2c1ph038hxkv"> </div> | |
<script type="text/javascript"> | |
var q1m2c1ph038hxkv; | |
(function(d, t) { | |
var s = d.createElement(t), | |
options = { | |
'userName': 'nashaleptachallenge', | |
'formHash': 'q1m2c1ph038hxkv', | |
'autoResize': true, | |
'height': '820', | |
'async': true, | |
'host': 'wufoo.com', | |
'header': 'show', | |
'ssl': false | |
}; | |
s.src = ('https:' == d.location.protocol ? 'https://' : 'http://') + 'www.wufoo.com/scripts/embed/form.js'; | |
s.onload = s.onreadystatechange = function() { | |
var rs = this.readyState; | |
if (rs) | |
if (rs != 'complete') | |
if (rs != 'loaded') | |
return; | |
try { | |
q1m2c1ph038hxkv = new WufooForm(); | |
q1m2c1ph038hxkv.initialize(options); | |
q1m2c1ph038hxkv.display(); | |
} catch (e) {} | |
}; | |
var scr = d.getElementsByTagName(t)[0], | |
par = scr.parentNode; | |
par.insertBefore(s, scr); | |
})(document, 'script'); | |
</script> |
This file contains hidden or 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
/** | |
* Created by kaflan on 10.04.2016. | |
*/ | |
angular.module('Wufoo', []) | |
.factory('WufooService', [ | |
'$document', '$q', '$rootScope', | |
function ($document, $q, $rootScope) { | |
var d = $q.defer(); | |
function onScriptLoad() { | |
// Load client in the browser | |
$rootScope.$apply(function () { | |
d.resolve(window.Wufoo); | |
}); | |
} | |
var wufooNum = 'q1m2c1ph038hxkv'; | |
var divId = $document[0].createElement('div'); | |
div.id = 'wufoo-' + wufooNum; | |
var scriptTag = $document[0].createElement('script'); | |
scriptTag.type = 'text/javascript'; | |
scriptTag.async = true; | |
scriptTag.src = ('https:' == d.location.protocol ? 'https://' : 'http://') + 'www.wufoo.com/scripts/embed/form.js'; | |
scriptTag.onreadystatechange = function () { | |
var q1m2c1ph038hxkv; | |
var rs = this.readyState; | |
var options = { | |
'userName': 'nashaleptachallenge', | |
'formHash': 'q1m2c1ph038hxkv', | |
'autoResize': true, | |
'height': '820', | |
'async': true, | |
'host': 'wufoo.com', | |
'header': 'show', | |
'ssl': false | |
}; | |
if(rs) if (rs != 'complete') if (rs != 'loaded')return; | |
if ( rs == 'complete') onScriptLoad(); | |
try { | |
q1m2c1ph038hxkv = new WufooForm(); | |
q1m2c1ph038hxkv.initialize(options); | |
q1m2c1ph038hxkv.display(); | |
} catch(e){ | |
alert('Erorr :',e); | |
} | |
}; | |
scriptTag.onload = onScriptLoad; | |
$document[0].getElementsByTagName('body')[0].appendChild(scriptTag); | |
return { | |
Wofoo: function () { | |
return d.promise; | |
} | |
}; | |
} | |
]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment