%PDF- %PDF-
Direktori : /var/www/tif-dev/wp-content/plugins/gravityforms/js/ |
Current File : //var/www/tif-dev/wp-content/plugins/gravityforms/js/page_conditional_logic.min.js |
var GFPageConditionalLogic=function(t){var p=this,f=jQuery;p.init=function(){p.options=t,p.paginationType=p.options.pagination.type,p.triggerInputIds=p.getTriggerInputIds(p.options.pages),p.formWrapper="#gform_wrapper_"+p.options.formId,"steps"===p.paginationType?p.originalCurrentPage=parseInt(f(p.formWrapper+" .gf_step_active .gf_step_number").text(),10):"percentage"===p.paginationType&&(p.originalCurrentPage=parseInt(f(p.formWrapper+" .gf_step_current_page").text(),10),p.originalProgress=parseInt(f(p.formWrapper+" .gf_progressbar_percentage span").text(),10)),p.evaluatePages(),p.bindEvents()},p.bindEvents=function(){gform.addAction("gform_input_change",function(t,e,o){var a=parseInt(o,10)+"",n=-1!==f.inArray(o,p.triggerInputIds)||-1!==f.inArray(a,p.triggerInputIds);p.options.formId==e&&n&&p.evaluatePages()})},p.evaluatePages=function(){for(var t,e,o,a,n,r=1,i=p.originalCurrentPage,s=0;s<p.options.pages.length;s++)t=p.options.pages[s],e=s+2,o=p.evaluatePage(t,p.options.formId),a=p.isPageVisible(t),o||!1===a?o&&!a&&p.showPage(t,e):p.hidePage(t,e),(a=p.isPageVisible(t))&&(r++,"steps"===p.paginationType?f("#gf_step_"+p.options.formId+"_"+e).find(".gf_step_number").html(r):"percentage"===p.paginationType&&p.originalCurrentPage==e&&(i=r,f(p.formWrapper+" .gf_step_current_page").html(i)),p.resetButton(t));if("percentage"===p.paginationType&&(i=!0===p.options.pagination.display_progressbar_on_confirmation?i-1:i),n=Math.floor(i/r*100),"percentage"===p.paginationType){var g=n+"%";f(p.formWrapper+" .gf_step_page_count").html(r),f(p.formWrapper+" .gf_progressbar_percentage span").html(g),f(p.formWrapper+" .gf_progressbar_percentage").removeClass("percentbar_"+p.originalProgress).addClass("percentbar_"+n).css("width",g)}100===n?p.updateNextButton(p.originalCurrentPage-1):p.updateNextButton(),gform.doAction("gform_frontend_pages_evaluated",p.options.pages,p.options.formId,p),gform.doAction("gform_frontend_pages_evaluated_{0}".format(p.options.formId),p.options.pages,p.options.formId,p)},p.evaluatePage=function(t,e){return!t.conditionalLogic||"show"===gf_get_field_action(e,t.conditionalLogic)},p.getTriggerInputIds=function(){for(var t=[],e=0;e<p.options.pages.length;e++){var o=p.options.pages[e];if(o.conditionalLogic)for(var a=0;a<o.conditionalLogic.rules.length;a++){var n=p.options.pages[e].conditionalLogic.rules[a];-1===f.inArray(n.fieldId,t)&&t.push(n.fieldId)}}return t},p.isPageVisible=function(t){return!("object"!=typeof t&&!(t=p.getPage(t)))&&(void 0!==t.isVisible?t.isVisible:null)},p.getPage=function(t){for(var e=0;e<p.options.pages.length;e++){var o=p.options.pages[e];if(o.fieldId==t)return o}return!1},p.showPage=function(t,e){!0!==p.isPageVisible(t)&&(t.isVisible=!0,f("#gf_step_"+p.options.formId+"_"+e).removeClass("gf_step_hidden"),gform.doAction("gform_frontend_page_visible",t,p.options.formId),gform.doAction("gform_frontend_page_visible_{0}".format(p.options.formId),t,p.options.formId))},p.hidePage=function(t,e){!1!==p.isPageVisible(t)&&(t.isVisible=!1,f("#gf_step_"+p.options.formId+"_"+e).addClass("gf_step_hidden"),gform.doAction("gform_frontend_page_hidden",t,p.options.formId),gform.doAction("gform_frontend_page_hidden_{0}".format(p.options.formId),t,p.options.formId))},p.updateNextButton=function(t){var e=parseInt(f("#gform_target_page_number_"+p.options.formId).val(),10),o=p.options.pages.length+1;if(p.currentPageIsLastPage(e,o,t)){var a=p.getValidatedLastPageIndex(t),n=p.options.pages[a],r=f("#gform_next_button_"+p.options.formId+"_"+n.fieldId),i=p.isPageVisible(n),s=f("#gform_submit_button_"+p.options.formId);i?p.resetButton(n):("image"===s.attr("type")?("image"===r.attr("type")&&r.data("alt",r.attr("alt")),r.attr("type","image").attr("src",s.attr("src")).attr("alt",s.attr("alt")).addClass("gform_image_button").removeClass("button")):r.attr("type","button").val(s.val()).addClass("button").removeClass("gform_image_button"),p.options.pages[a].isUpdated=!0)}},p.getValidatedLastPageIndex=function(t){return void 0===t||t<0||t>=p.options.pages.length?p.options.pages.length-1:t},p.currentPageIsLastPage=function(t,e,o){return t===e||void 0!==o},p.resetButton=function(t){if(t.hasOwnProperty("isUpdated")){delete t.isUpdated;var e=f("#gform_next_button_"+p.options.formId+"_"+t.fieldId);"image"===t.nextButton.type?e.attr("type","image").attr("src",t.nextButton.imageUrl).attr("alt",e.data("alt")).addClass("gform_image_button").removeClass("button"):e.attr("type","button").val(t.nextButton.text).addClass("button").removeClass("gform_image_button")}},this.init()};