source: main/trunk/model-interfaces-dev/heritage-nz/iframe/heritage-nz-dl_files/angular-recaptcha.js@ 32796

Last change on this file since 32796 was 32796, checked in by davidb, 5 years ago

Initial set of files to provide look and feel of Heritage NZ site, plus SVN clickable map in an iframe

  • Property svn:executable set to *
File size: 2.0 KB
Line 
1/**
2 * angular-recaptcha build:2015-08-26
3 * https://github.com/vividcortex/angular-recaptcha
4 * Copyright (c) 2015 VividCortex
5**/
6
7!function(a){"use strict";a.module("vcRecaptcha",[])}(angular),function(a){"use strict";var b=a.module("vcRecaptcha");b.service("vcRecaptchaService",["$window","$q",function(b,c){function d(){return f?c.when(f):h}function e(){if(!f)throw new Error("reCaptcha has not been loaded yet.")}var f,g=c.defer(),h=g.promise;return b.vcRecaptchaApiLoaded=function(){f=b.grecaptcha,g.resolve(f)},a.isDefined(b.grecaptcha)&&b.vcRecaptchaApiLoaded(),{create:function(a,b,c,e){return e.callback=c,e.sitekey=b,d().then(function(b){return b.render(a,e)})},reload:function(a){e(),f.reset(a)},getResponse:function(a){return e(),f.getResponse(a)}}}])}(angular),function(a){"use strict";function b(){throw new Error('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')}var c=a.module("vcRecaptcha");c.directive("vcRecaptcha",["$document","$timeout","vcRecaptchaService",function(a,c,d){return{restrict:"A",require:"?^^form",scope:{response:"=?ngModel",key:"=",theme:"=?",size:"=?",tabindex:"=?",onCreate:"&",onSuccess:"&",onExpire:"&"},link:function(e,f,g,h){function i(){h&&h.$setValidity("recaptcha",null),k&&(c.cancel(k),k=null),j()}function j(){angular.element(a[0].querySelectorAll(".pls-container")).parent().remove()}g.hasOwnProperty("key")||b(),e.widgetId=null;var k,l=e.$watch("key",function(a){if(a){40!==a.length&&b();var j=function(a){c(function(){h&&h.$setValidity("recaptcha",!0),e.response=a,e.onSuccess({response:a,widgetId:e.widgetId})}),k=c(function(){h&&h.$setValidity("recaptcha",!1),e.response="",e.onExpire({widgetId:e.widgetId})},12e4)};d.create(f[0],a,j,{theme:e.theme||g.theme||null,tabindex:e.tabindex||g.tabindex||null,size:e.size||g.size||null}).then(function(a){h&&h.$setValidity("recaptcha",!1),e.widgetId=a,e.onCreate({widgetId:a}),e.$on("$destroy",i)}),l()}})}}}])}(angular);
Note: See TracBrowser for help on using the repository browser.