File manager - Edit - /home/asiatechinc/public_html/asiatech-websites/ecogroves.in/js/stepsForm.js
Back
!function(t){"use strict";var e={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",msTransition:"MSTransitionEnd",transition:"transitionend"}[Modernizr.prefixed("transition")],s=Modernizr.csstransitions;function i(t,e){for(var s in e)e.hasOwnProperty(s)&&(t[s]=e[s]);return t}function n(t,e){this.el=t,this.options=i({},this.options),i(this.options,e),this._init()}n.prototype.options={onSubmit:function(){return!1}},n.prototype._init=function(){this.current=0,this.questions=[].slice.call(this.el.querySelectorAll("ol.questions > li")),this.questionsCount=this.questions.length,classie.addClass(this.questions[0],"current"),this.ctrlNext=this.el.querySelector("button.res-next"),this.progress=this.el.querySelector("div.progress"),this.questionStatus=this.el.querySelector("span.number"),this.currentNum=this.questionStatus.querySelector("span.number-current"),this.currentNum.innerHTML=Number(this.current+1),this.totalQuestionNum=this.questionStatus.querySelector("span.number-total"),this.totalQuestionNum.innerHTML=this.questionsCount,this.error=this.el.querySelector("span.error-message"),this._initEvents()},n.prototype._initEvents=function(){var t=this,e=this.questions[this.current].querySelector("input"),s=function(){e.removeEventListener("focus",s),classie.addClass(t.ctrlNext,"show")};e.addEventListener("focus",s),this.ctrlNext.addEventListener("click",function(e){e.preventDefault(),t._nextQuestion()}),document.addEventListener("keydown",function(e){13===(e.keyCode||e.which)&&(e.preventDefault(),t._nextQuestion())}),this.el.addEventListener("keydown",function(t){9===(t.keyCode||t.which)&&t.preventDefault()})},n.prototype._nextQuestion=function(){if(!this._validade())return!1;this.current===this.questionsCount-1&&(this.isFilled=!0),this._clearError();var t=this.questions[this.current];if(++this.current,this._progress(),!this.isFilled){this._updateQuestionNumber(),classie.addClass(this.el,"show-next");var i=this.questions[this.current];classie.removeClass(t,"current"),classie.addClass(i,"current")}var n=this,r=function(t){s&&this.removeEventListener(e,r),n.isFilled?n._submit():(classie.removeClass(n.el,"show-next"),n.currentNum.innerHTML=n.nextQuestionNum.innerHTML,n.questionStatus.removeChild(n.nextQuestionNum),i.querySelector("input").focus())};s?this.progress.addEventListener(e,r):r()},n.prototype._progress=function(){this.progress.style.width=this.current*(100/this.questionsCount)+"%"},n.prototype._updateQuestionNumber=function(){this.nextQuestionNum=document.createElement("span"),this.nextQuestionNum.className="number-next",this.nextQuestionNum.innerHTML=Number(this.current+1),this.questionStatus.appendChild(this.nextQuestionNum)},n.prototype._submit=function(){this.options.onSubmit(this.el)},n.prototype._validade=function(){var t=this.questions[this.current].querySelector("input").value,e=document.forms.theForm.q2.value,s=e.indexOf("@"),i=e.lastIndexOf(".");return""===t?(this._showError("EMPTYSTR"),!1):""==e||(!(s<1||i<s+2||i+2>=e.length)||(this._showError("INVALIDEMAIL"),!1))},n.prototype._showError=function(t){var e="";switch(t){case"EMPTYSTR":e="Please fill the field before continuing";break;case"INVALIDEMAIL":e="Please fill a valid email address"}this.error.innerHTML=e,classie.addClass(this.error,"show")},n.prototype._clearError=function(){classie.removeClass(this.error,"show")},t.stepsForm=n}(window);
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings