tellform/public/dist/form-application.min.js

2 lines
43 KiB
JavaScript
Raw Normal View History

2017-10-19 00:37:27 +00:00
"use strict";var ApplicationConfiguration=function(){var a="TellForm-Form",b=["duScroll","ui.select","ngSanitize","vButton","ngResource","TellForm-Form.form_templates","ui.router","ui.bootstrap","pascalprecht.translate"],c=function(b,c){angular.module(b,c||[]),angular.module(a).requires.push(b)};return{applicationModuleName:a,applicationModuleVendorDependencies:b,registerModule:c}}();angular.module(ApplicationConfiguration.applicationModuleName,ApplicationConfiguration.applicationModuleVendorDependencies),angular.module(ApplicationConfiguration.applicationModuleName).config(["$locationProvider",function(a){a.hashPrefix("!")}]),angular.module(ApplicationConfiguration.applicationModuleName).constant("APP_PERMISSIONS",{viewAdminSettings:"viewAdminSettings",editAdminSettings:"editAdminSettings",editForm:"editForm",viewPrivateForm:"viewPrivateForm"}),angular.module(ApplicationConfiguration.applicationModuleName).constant("USER_ROLES",{admin:"admin",normal:"user",superuser:"superuser"}),angular.module(ApplicationConfiguration.applicationModuleName).constant("FORM_URL","/forms/:formId"),angular.element(document).ready(function(){"#_=_"===window.location.hash&&(window.location.hash="#!"),angular.bootstrap(document,[ApplicationConfiguration.applicationModuleName])}),angular.module("TellForm-Form.form_templates",[]).run(["$templateCache",function(a){a.put("form_modules/forms/base/views/form-not-found.client.view.html",'<script>$(".loader").fadeOut("slow");</script><section class="public-form auth sigin-view valign-wrapper"><div class="row valign"><h3 class="col-md-12 text-center">404 - Form Does not Exist</h3><div class="col-md-4 col-md-offset-4"><div class="col-md-12 text-center" style="padding-bottom: 50px">The form you are trying to access does not exist. Sorry about that!</div></div></div></section>'),a.put("form_modules/forms/base/views/form-unauthorized.client.view.html",'<script>$(".loader").fadeOut("slow");</script><section class="public-form auth sigin-view valign-wrapper"><div class="row valign"><h3 class="col-md-12 text-center">Not Authorized to Access Form</h3><div class="col-md-4 col-md-offset-4"><div class="col-md-12 text-center" style="padding-bottom: 50px">The form you are trying to access is currently private and not accesible publically.<br>If you are the owner of the form, you can set it to "Public" in the "Configuration" panel in the form admin.</div></div></div></section>'),a.put("form_modules/forms/base/views/submit-form.client.view.html","<section class=public-form><submit-form-directive myform=myform></submit-form-directive></section><script ng-if=myform.analytics.gaCode>window.ga=function(){ga.q.push(arguments)};ga.q=[];ga.l=+new Date;\n\tga('create', '{{myform.analytics.gaCode}}', 'auto'); ga('send', 'pageview');</script><script ng-if=myform.analytics.gaCode src=https://www.google-analytics.com/analytics.js async defer></script>"),a.put("form_modules/forms/base/views/directiveViews/entryPage/startPage.html",'<div class="field row text-center"><div class="col-xs-12 text-center"><h1>{{pageData.introTitle}}</h1></div><div class="col-xs-10 col-xs-offset-1 text-left"><p style=color:#ddd>{{pageData.introParagraph}}</p></div></div><div class="row form-actions" style="padding-bottom:3em; padding-left: 1em; padding-right: 1em"><p ng-repeat="button in pageData.buttons" class=text-center style=display:inline><button class="btn btn-info" type=button ng-style="{\'background-color\':button.bgColor, \'color\':button.color}"><a href={{button.url}} style="font-size: 1.6em; text-decoration: none; color: inherit">{{button.text}}</a></button></p></div><div class="row form-actions"><p class="col-xs-3 col-xs-offset-3 text-center"><button class="btn btn-info" type=button><a ng-click=exitpageData() style="color:white; font-size: 1.6em; text-decoration: none">{{ \'CONTINUE_FORM\' | translate }}</a></button></p></div>'),a.put("form_modules/forms/base/views/directiveViews/field/date.html",'<div class="field row" ng-click="setActiveField(field._id, index, true)"><div class="col-xs-12 field-title" ng-style="{\'color\': design.colors
2017-10-07 08:34:01 +00:00
if("field"===e.left.name?(c=a.fieldValue,d=b.valueB):(c=b.valueB,d=a.fieldValue),"number"===a.fieldType||"scale"===a.fieldType||"rating"===a.fieldType)switch(e.operator){case"==":return parseInt(c)===parseInt(d);case"!==":return parseInt(c)!==parseInt(d);case">":return parseInt(c)>parseInt(d);case">=":return parseInt(c)>parseInt(d);case"<":return parseInt(c)<parseInt(d);case"<=":return parseInt(c)<=parseInt(d);default:return!1}else switch(e.operator){case"==":return c===d;case"!==":return c!==d;case"contains":return c.indexOf(d)>-1;case"!contains":return!(c.indexOf(d)>-1);case"begins":return c.startsWith(d);case"!begins":return!c.startsWith(d);case"ends":return c.endsWith(d);case"!ends":return c.endsWith(d);default:return!1}}},n=function(){if(null===h.selected)throw console.error("current active field is null"),new Error("current active field is null");return h.selected._id===j?h.myform.form_fields.length-1:h.selected.index};h.isActiveField=function(a){return h.selected._id===a._id},h.setActiveField=d.setActiveField=function(a,b,d){if(null!==h.selected&&(a||null!==b)){if(a){if(null===b){b=h.myform.visible_form_fields.length;for(var e=0;e<h.myform.visible_form_fields.length;e++){var g=h.myform.visible_form_fields[e];if(g._id==a){b=e;break}}}}else a=h.myform.visible_form_fields[b]._id;if(h.selected._id!==a){h.selected._id=a,h.selected.index=b;var j=c("formValidity")(h.myform);h.translateAdvancementData={done:j,total:k,answers_not_completed:k-j},d&&(i=!0,setTimeout(function(){f.scrollToElement(angular.element(".activeField"),-10,200).then(function(){i=!1,setTimeout(function(){document.querySelectorAll(".activeField .focusOn").length?document.querySelectorAll(".activeField .focusOn")[0].focus():document.querySelectorAll(".activeField input").length?document.querySelectorAll(".activeField input")[0].focus():document.querySelectorAll(".activeField .selectize-input")[0].focus()})})}))}}},h.$watch("selected.index",function(a,c){a!==c&&c<h.myform.form_fields.length&&(h.myform.submitted||(console.log("SendVisitorData.send()"),e.send(h.myform,c,b.getTimeElapsed())))}),g.onscroll=function(){if(!i){var a,b=$(window).scrollTop(),c=document.getElementsByClassName("activeField")[0].getBoundingClientRect(),d=c.top,e=c.bottom,f=$(".activeField").height(),g=$(".form-actions").height(),k=$(document).height()-$(window).height(),l=($("form_fields").height(),"form > .field-directive:nth-of-type("+String(h.myform.visible_form_fields.length-1)+")"),m=$(l).height(),n=k-g-1.2*m,o=.9;h.selected.index===h.myform.visible_form_fields.length?b<n&&(a=h.selected.index-1,h.setActiveField(null,a,!1)):h.selected.index===h.myform.visible_form_fields.length-1&&b>n?(a=h.selected.index+1,h.setActiveField(j,a,!1)):e<f*o&&h.selected.index<h.myform.visible_form_fields.length-1?(a=h.selected.index+1,h.setActiveField(null,a,!1)):0!==h.selected.index&&d>f*o&&(a=h.selected.index-1,h.setActiveField(null,a,!1))}h.$apply()},d.nextField=h.nextField=function(){if(h.selected&&h.selected.index>-1)if(h.selected._id!==j){var a=h.myform.visible_form_fields[h.selected.index];a.logicJump&&a.logicJump.jumpTo&&m(a)?h.setActiveField(a.logicJump.jumpTo,null,!0):h.selected.index<h.myform.visible_form_fields.length-1?h.setActiveField(null,h.selected.index+1,!0):h.setActiveField(j,null,!0)}else d.setActiveField(null,0,!0);else d.setActiveField(null,0,!0)},d.prevField=h.prevField=function(){console.log("prevField"),console.log(h.selected);var a=h.selected.index-1;h.selected.index>0&&h.setActiveField(null,a,!0)},d.goToInvalid=h.goToInvalid=function(){var a=$(".row.field-directive .ng-invalid.focusOn, .row.field-directive .ng-untouched.focusOn:not(.ng-valid)").first().parents(".row.field-directive").first().attr("data-id");h.setActiveField(a,null,!0)},h.exitStartPage=function(){h.myform.startPage.showStart=!1,h.myform.visible_form_fields.length>0&&(h.selected._id=h.myform.visible_form_fields[0]._id)};var o=function(){var a=new MobileDetect(window.navigator.userAgent),b="other";return a.tablet()?b="tablet":a.mobile()?b="mobile":a.is("bot")||(b="desktop"),{type:b,name:window.navigator.platf