nemesiscodex/openfonacide

View on GitHub
static/js/angular-recaptcha.min.js

Summary

Maintainability
A
0 mins
Test Coverage
/**
 * angular-recaptcha build:2014-10-30
 * https://github.com/vividcortex/angular-recaptcha
 * Copyright (c) 2014 VividCortex
**/

!function(a){"use strict";a.module("vcRecaptcha",[])}(angular),function(a,b){"use strict";var c=a.module("vcRecaptcha");c.service("vcRecaptchaService",["$timeout","$log",function(a){var c;return{create:function(a,d,e,f){c=e,f.callback=e,b.create(d,a,f)},reload:function(d){b.reload(d&&"t"),a(c,1e3)},data:function(){return{response:b.get_response(),challenge:b.get_challenge()}},destroy:function(){b.destroy()},switch_type:function(a){("image"===a||"audio"===a)&&b.switch_type(a)},showhelp:function(){b.showhelp()},focus_response_field:function(){b.focus_response_field()}}}])}(angular,Recaptcha),function(a,b){"use strict";var c=a.module("vcRecaptcha");c.directive("vcRecaptcha",["$log","$timeout","vcRecaptchaService",function(a,c,d){return{restrict:"A",require:"?ngModel",scope:{key:"="},link:function(a,e,f,g){{var h,i,j=!1,k=function(){g&&g.$setViewValue({response:h.val(),challenge:i.val()})},l=function(){var a=e.find("input");i=angular.element(a[0]),h=angular.element(a[1]),k()},m=function(){l(),h.bind("keyup",function(){a.$apply(k)}),g&&(g.$render=function(){h.val(g.$viewValue.response),i.val(g.$viewValue.challenge)}),e.bind("click",function(){c(function(){a.$apply(l)},1e3)})};b.reload}if(!f.hasOwnProperty("key"))throw'You need to set the "key" attribute to your public reCaptcha key. If you don\'t have a key, please get one from https://www.google.com/recaptcha/admin/create';a.$watch("key",function(b){if(b&&!j){if(40!==b.length)throw'The "key" should be set to your public reCaptcha key. If you don\'t have a key, please get one from https://www.google.com/recaptcha/admin/create';d.create(e[0],a.key,m,{tabindex:f.tabindex,theme:f.theme,lang:f.lang||null}),j=!0}})}}}])}(angular,Recaptcha);