Commit 220429a1 authored by Kevin Stover's avatar Kevin Stover

Merge branch 'release/v2.2.50'

parents 3ac377b9 047dd41b
......@@ -78,94 +78,6 @@ function ninja_forms_delete_form( $form_id = '' ){
}
add_action('wp_ajax_ninja_forms_add_conditional', 'ninja_forms_add_conditional');
function ninja_forms_add_conditional(){
global $wpdb, $ninja_forms_fields;
$field_id = $_REQUEST['field_id'];
$x = $_REQUEST['x'];
ninja_forms_field_conditional_output($field_id, $x);
die();
}
add_action('wp_ajax_ninja_forms_add_cr', 'ninja_forms_add_cr');
function ninja_forms_add_cr(){
global $wpdb, $ninja_forms_fields;
$field_id = $_REQUEST['field_id'];
$x = $_REQUEST['x'];
$y = $_REQUEST['y'];
$new_html = ninja_forms_return_echo('ninja_forms_field_conditional_cr_output', $field_id, $x, $y);
header("Content-type: application/json");
$array = array ('new_html' => $new_html, 'field_id' => $field_id, 'x' => $x, 'y' => $y);
echo json_encode($array);
die();
}
add_action('wp_ajax_ninja_forms_change_action', 'ninja_forms_change_action');
function ninja_forms_change_action(){
global $wpdb, $ninja_forms_fields;
$form_id = $_REQUEST['form_id'];
$action_slug = $_REQUEST['action_slug'];
$field_id = $_REQUEST['field_id'];
$x = $_REQUEST['x'];
$field_data = $_REQUEST['field_data'];
$field_data = $field_data['ninja_forms_field_'.$field_id];
$field_row = ninja_forms_get_field_by_id($field_id);
$type = $field_row['type'];
$reg_field = $ninja_forms_fields[$type];
if( isset( $reg_field['conditional']['action'][$action_slug] ) ){
$conditional = $reg_field['conditional']['action'][$action_slug];
}else if( $action_slug == 'change_value'){
$conditional = array( 'output' => 'text' );
}else{
$conditional = '';
}
header("Content-type: application/json");
if( isset( $conditional['output'] ) ){
$new_type = $conditional['output'];
}else{
$new_type = '';
}
$new_html = ninja_forms_return_echo( 'ninja_forms_field_conditional_action_output', $field_id, $x, $conditional, '', $field_data );
$array = array('new_html' => $new_html, 'new_type' => $new_type );
echo json_encode($array);
die();
}
add_action('wp_ajax_ninja_forms_change_cr_field', 'ninja_forms_change_cr_field');
function ninja_forms_change_cr_field(){
global $wpdb, $ninja_forms_fields;
$field_id = $_REQUEST['field_id'];
$field_value = $_REQUEST['field_value'];
$x = $_REQUEST['x'];
$y = $_REQUEST['y'];
$field_row = ninja_forms_get_field_by_id($field_value);
$type = $field_row['type'];
$reg_field = $ninja_forms_fields[$type];
$conditional = $reg_field['conditional'];
header("Content-type: application/json");
$new_html = '';
if(isset($conditional['value']) AND is_array($conditional['value'])){
$new_html = ninja_forms_return_echo('ninja_forms_field_conditional_cr_value_output', $field_id, $x, $y, $conditional);
$array = array('new_html' => $new_html, 'new_type' => $conditional['value']['type'] );
echo json_encode($array);
}
die();
}
add_action('wp_ajax_ninja_forms_add_list_option', 'ninja_forms_add_list_options');
function ninja_forms_add_list_options(){
global $wpdb;
......
......@@ -72,6 +72,12 @@ function ninja_forms_display_fields($form_id){
$display_style = $data['display_style'];
}else{
$display_style = '';
}
if( isset( $data['visible'] ) ){
$visible = $data['visible'];
}else{
$visible = true;
}
if ( $display_style != '' ) {
......@@ -96,7 +102,7 @@ function ninja_forms_display_fields($form_id){
$field_wrap_class = apply_filters( 'ninja_forms_field_wrap_class', $field_wrap_class, $field_id );
do_action( 'ninja_forms_display_before_opening_field_wrap', $field_id, $data );
?>
<div class="<?php echo $field_wrap_class;?>" <?php echo $display_style;?> id="ninja_forms_field_<?php echo $field_id;?>_div_wrap">
<div class="<?php echo $field_wrap_class;?>" <?php echo $display_style;?> id="ninja_forms_field_<?php echo $field_id;?>_div_wrap" data-visible="<?php echo $visible;?>">
<?php
do_action( 'ninja_forms_display_after_opening_field_wrap', $field_id, $data );
}
......
......@@ -155,35 +155,72 @@ jQuery(document).ready(function(jQuery) {
* Calculation Field JS
*/
var selects = jQuery(".ninja-forms-field-calc-listen");
var calc_fields = jQuery(".ninja-forms-field-calc-listen");
selects.each(function (i, element) {
var select = jQuery(element);
var previousValue = jQuery(this).val();
if ( this.type !== 'checkbox' ) {
jQuery(element).data("oldValue", previousValue);
calc_fields.each(function (i, element) {
if ( this.type == 'checkbox' ) {
if ( this.checked ) {
var previousValue = 'checked';
} else {
var previousValue = 'unchecked';
}
} else {
var previousValue = jQuery(this).val();
}
var form_id = ninja_forms_get_form_id( this );
var field_id = jQuery(this).attr("rel");
var calc_settings = window['ninja_forms_form_' + form_id + '_calc_settings'];
// Get our auto total field or fields.
for ( calc_id in calc_settings.calc_fields ) {
if ( calc_id != field_id ) {
jQuery(element).data(calc_id + "-oldValue", previousValue);
}
}
});
jQuery('body').on( 'focus', '.ninja-forms-field-list-options-span-calc-listen', function(e){
var field_id = jQuery(this).attr("rel");
jQuery(this).data("oldValue", jQuery("input[name='ninja_forms_field_" + field_id +"']:checked").val());
if ( jQuery("#ninja_forms_field_" + field_id + "_type").val() == 'list' && jQuery("#ninja_forms_field_" + field_id + "_list_type").val() == 'radio' ) {
var form_id = ninja_forms_get_form_id( this );
var calc_settings = window['ninja_forms_form_' + form_id + '_calc_settings'];
// Get our auto total field or fields.
for ( calc_id in calc_settings.calc_fields ) {
if ( calc_id != field_id ) {
jQuery(this).data(calc_id + "-oldValue", jQuery("input[name='ninja_forms_field_" + field_id +"']:checked").val());
}
}
}
});
jQuery('body').on( 'mousedown', '.ninja-forms-field-list-options-span-calc-listen', function(e){
var field_id = jQuery(this).attr("rel");
jQuery(this).data("oldValue", jQuery("input[name='ninja_forms_field_" + field_id +"']:checked").val());
if ( jQuery("#ninja_forms_field_" + field_id + "_type").val() == 'list' && jQuery("#ninja_forms_field_" + field_id + "_list_type").val() == 'radio' ) {
var form_id = ninja_forms_get_form_id( this );
var calc_settings = window['ninja_forms_form_' + form_id + '_calc_settings'];
// Get our auto total field or fields.
for ( calc_id in calc_settings.calc_fields ) {
if ( calc_id != field_id ) {
jQuery(this).data(calc_id + "-oldValue", jQuery("input[name='ninja_forms_field_" + field_id +"']:checked").val());
}
}
}
});
// Listen to the input elements for our auto-calculation fields and change the total.
jQuery('body').on( 'change', '.ninja-forms-field-calc-listen', function(event){
if ( this == event.target ) {
// Get our calc settings.
var form_id = ninja_forms_get_form_id( this );
var field_id = jQuery(this).attr("rel");
var calc_settings = window['ninja_forms_form_' + form_id + '_calc_settings'];
var visible = jQuery("#ninja_forms_field_" + field_id + "_div_wrap").data("visible");
// Get our auto total field or fields.
for ( calc_id in calc_settings.calc_fields ) {
......@@ -219,21 +256,70 @@ jQuery(document).ready(function(jQuery) {
var key = jQuery(this).val();
var new_value = '';
// Set our old_value to the previous one for this field.
old_value = jQuery(this).data('oldValue');
old_value = jQuery(this).data(calc_id + '-oldValue');
// Check to see if we are in a list field. If we are, we can grab the calc values.
if ( jQuery('#ninja_forms_field_' + field_id + '_type' ).val() == 'list' ) {
var key = jQuery(this).val();
// See if we have any old values. If we do, compare them to our current selection for this field and see if we need to subtract anything.
if ( jQuery('#ninja_forms_field_' + field_id + '_list_type').val() == 'checkbox' ) {
if ( !this.checked ) {
if ( this.checked ) {
jQuery(this).data(calc_id + '-oldValue', 'checked' );
} else {
jQuery(this).data(calc_id + '-oldValue', 'unchecked' );
}
if ( this.checked && visible == 1 ) {
// If this is checked AND visible, we don't want to do any old operations
old_value = 0;
} else if ( this.checked && visible != 1 ) {
// If this is checked AND hidden, we want to perform an old operation on it.
old_value = key;
new_value = 0;
} else if ( !this.checked && visible == 1 ) {
if ( old_value == 'checked' ) {
old_value = key;
} else {
old_value = 0;
}
new_value = 0;
} else if ( !this.checked && visible != 1 ) {
if ( old_value == 'checked' ) {
old_value = key;
} else {
old_value = 0;
}
new_value = 0;
}
} else if ( jQuery('#ninja_forms_field_' + field_id + '_list_type').val() == 'radio' ) {
// If this is a checkbox or a radio list, then we have to check the span parent for the oldValue.
var span = jQuery(this).parent().parent().parent().parent();
old_value = jQuery(span).data('oldValue');
old_value = jQuery(span).data(calc_id + '-oldValue');
if ( typeof old_value === 'undefined' ) {
if ( this.checked ) {
old_value = jQuery(this).val();
}
}
if ( this.checked && visible == 1 ) {
if ( old_value == key ) {
old_value = 0;
}
} else if ( this.checked && visible != 1 ) {
new_value = 0;
} else if ( !this.checked ) {
old_value = 0;
new_value = 0;
}
if ( this.checked ) {
jQuery(span).data(calc_id + '-oldValue', key );
}
} else if ( jQuery('#ninja_forms_field_' + field_id + '_list_type').val() == 'multi' ) {
// This is a multi-select list. The value is in an array, so we need to add all the values together.
if ( jQuery.isArray( key ) ) {
......@@ -257,25 +343,36 @@ jQuery(document).ready(function(jQuery) {
}
} else {
// This is a select list, so we can just grab the oldValue from this field.
var old_value = jQuery(this).data('oldValue');
var old_value = jQuery(this).data(calc_id + '-oldValue');
}
// Check to see if we're in a checkbox field. If so, the key needs to be based on checked or unchecked, not value.
} else if ( jQuery('#ninja_forms_field_' + field_id + '_type').val() == 'checkbox' ) {
if ( this.checked ) {
if ( this.checked && visible == 1 ) {
// This field is checked, so set key to 'checked.'
var key = 'checked';
// Checkboxes only have two states, so if we are changing, the previous value must have been the opposite of this one.
var old_value = 'unchecked';
old_value = 'unchecked';
} else if( this.checked && visible != 1 ) {
var key = 'unchecked';
if ( jQuery(this).data(calc_id + '-oldValue') == 'checked' || typeof jQuery(this).data(calc_id + '-oldValue') === 'undefined' ){
old_value = 'checked';
} else {
old_value = 0;
}
} else if( !this.checked && visible != 1 ) {
var key = 'unchecked';
old_value = 0;
} else {
var key = 'unchecked';
var old_value = 'checked';
if ( jQuery(this).data(calc_id + '-oldValue') == 'checked' || typeof jQuery(this).data(calc_id + '-oldValue') === 'undefined' ){
old_value = 'checked';
} else {
old_value = 0;
}
}
}
if ( this.type !== 'checkbox' ) {
jQuery(this).data('oldValue', key);
}
if ( new_value === '' ) {
if ( typeof calc_settings.calc_value[field_id] !== 'undefined' && typeof calc_settings.calc_value[field_id][key] !== 'undefined' ) {
// Get our calc value for this field from our previously defined JS object.
......@@ -362,11 +459,13 @@ jQuery(document).ready(function(jQuery) {
}
// If our old value exists and isn't empty or 0, then carry out the old_op on it.
if ( old_value && !isNaN( old_value ) && old_value != 0 && old_value != '' && !jQuery(this).hasClass('ninja-forms-field-calc-no-old-op') ) {
old_value = parseFloat( old_value );
var asdf = current_value;
tmp = new ninja_forms_var_operator(old_op);
current_value = tmp.evaluate( current_value, old_value );
//console.log( this.id + ' - ' + asdf + ' ' + old_op + ' ' + old_value + ' = ' + current_value );
}
// If our new value exists and isn't empty or 0, then carry out the new_op on it.
......@@ -374,7 +473,7 @@ jQuery(document).ready(function(jQuery) {
new_value = parseFloat( new_value );
tmp = new ninja_forms_var_operator(new_op);
var calc_value = tmp.evaluate( current_value, new_value );
//console.log( current_value + ' ' + new_op + ' ' + new_value + ' = ' + calc_value );
//console.log( this.id + ' - ' + current_value + ' ' + new_op + ' ' + new_value + ' = ' + calc_value );
} else {
// We don't have any calculations to do, so set calc_value to our current_value.
var calc_value = current_value;
......@@ -483,7 +582,20 @@ jQuery(document).ready(function(jQuery) {
}
if ( current_value !== calc_value ) {
jQuery(this).removeClass('ninja-forms-field-calc-no-old-op');
if ( jQuery('#ninja_forms_field_' + field_id + '_list_type').val() != 'checkbox' ) {
jQuery(this).data(calc_id + '-oldValue', key);
}
if ( jQuery('#ninja_forms_field_' + field_id + '_list_type').val() == 'checkbox' || jQuery('#ninja_forms_field_' + field_id + '_list_type').val() == 'radio' ) {
jQuery("#ninja_forms_field_" + field_id + "_div_wrap").find(".ninja-forms-field").each(function(){
jQuery(this).removeClass('ninja-forms-field-calc-no-old-op');
});
} else {
jQuery(this).removeClass('ninja-forms-field-calc-no-old-op');
}
calc_value = calc_value.toFixed(calc_places);
// Set the value of our calculation field.
if(jQuery("#ninja_forms_field_" + calc_id).attr("type") == 'text' ){
......@@ -515,7 +627,7 @@ function ninja_forms_before_submit(formData, jqForm, options){
}
function ninja_forms_response(responseText, statusText, xhr, jQueryform){
//console.log(responseText);
//alert(responseText);
if( ninja_forms_settings.ajax_msg_format == 'inline' ){
var result = jQuery(jQueryform).triggerHandler('submitResponse', [ responseText ]);
if ( result !== false ) {
......
function ninja_forms_before_submit(e,t,n){var r=jQuery(t).triggerHandler("beforeSubmit",[e,t,n]);if(r!==false){r=jQuery("body").triggerHandler("beforeSubmit",[e,t,n])}if(r!==false){r=jQuery(document).triggerHandler("beforeSubmit",[e,t,n])}return r}function ninja_forms_response(e,t,n,r){if(ninja_forms_settings.ajax_msg_format=="inline"){var i=jQuery(r).triggerHandler("submitResponse",[e]);if(i!==false){i=jQuery("body").triggerHandler("submitResponse",[e])}if(i!==false){i=jQuery(document).triggerHandler("submitResponse",[e])}return i}}function ninja_forms_register_response_function(e,t){if(typeof window["ninja_forms_response_function_list"][e]=="undefined"){window["ninja_forms_response_function_list"][e]={}}window["ninja_forms_response_function_list"][e][t]=t}function ninja_forms_register_before_submit_function(e,t){if(typeof window["ninja_forms_before_submit_function_list"][e]=="undefined"){window["ninja_forms_before_submit_function_list"][e]={}}window["ninja_forms_before_submit_function_list"][e][t]=t}function ninja_forms_default_before_submit(e,t,n){var r=jQuery(t).prop("id").replace("ninja_forms_form_","");jQuery("#ninja_forms_form_"+r+"_process_msg").show();jQuery("#ninja_forms_form_"+r+"_response_msg").prop("innerHTML","");jQuery("#ninja_forms_form_"+r+"_response_msg").removeClass("ninja-forms-error-msg");jQuery("#ninja_forms_form_"+r+"_response_msg").removeClass("ninja-forms-success-msg");jQuery(".ninja-forms-field-error").prop("innerHTML","");jQuery(".ninja-forms-error").removeClass("ninja-forms-error");return true}function ninja_forms_default_response(e){var t=e.form_id;jQuery("#ninja_forms_form_"+t+"_process_msg").hide();ninja_forms_update_error_msgs(e);ninja_forms_update_success_msg(e);return true}function ninja_forms_update_success_msg(e){var t="";var n=e.form_id;var r=e.success;var i=e.form_settings;var s=i.hide_complete;var o=i.clear_complete;if(r!=false){for(var u in r){t+="<p>"+r[u]+"</p>"}if(t!=""){jQuery("#ninja_forms_form_"+n+"_response_msg").removeClass("ninja-forms-error-msg");jQuery("#ninja_forms_form_"+n+"_response_msg").addClass("ninja-forms-success-msg");jQuery("#ninja_forms_form_"+n+"_response_msg").prop("innerHTML",t)}if(s==1){jQuery("#ninja_forms_form_"+n).hide()}if(o==1){jQuery("#ninja_forms_form_"+n).resetForm()}}}function ninja_forms_update_error_msgs(e){var t="";var n=e.form_id;var r=e.errors;var n=e.form_id;if(r!=false){for(var i in r){if(r[i]["location"]=="general"){t+="<p>"+r[i]["msg"]+"</p>"}else{var s=r[i]["location"];jQuery("#ninja_forms_field_"+s+"_error").show();jQuery("#ninja_forms_field_"+s+"_error").prop("innerHTML",r[i]["msg"]);jQuery("#ninja_forms_field_"+s+"_div_wrap").addClass("ninja-forms-error")}}if(t!=""){jQuery("#ninja_forms_form_"+n+"_response_msg").removeClass("ninja-forms-success-msg");jQuery("#ninja_forms_form_"+n+"_response_msg").addClass("ninja-forms-error-msg");jQuery("#ninja_forms_form_"+n+"_response_msg").prop("innerHTML",t)}}}function ninja_forms_html_decode(e){if(e){var t=jQuery("<div />").html(e).text();t=jQuery("<div />").html(t).text();return t}else{return""}}function ninja_forms_toggle_login_register(e,t){var n="ninja_forms_form_"+t+"_"+e+"_form";if(e=="login"){var r="ninja_forms_form_"+t+"_register_form"}else{var r="ninja_forms_form_"+t+"_login_form"}var i=document.getElementById(n);var s=document.getElementById(r);if(i.style.display=="block"){i.style.display="none"}else{i.style.display="block";s.style.display="none"}}function ninja_forms_get_form_id(e){var t=jQuery(e).closest("form").prop("id");t=t.replace("ninja_forms_form_","");if(t==""||t=="ninja_forms_admin"){t=jQuery("#_form_id").val()}return t}function check_pass_strength(e,t){jQuery("#pass-strength-result").removeClass("short bad good strong");if(!e){jQuery("#pass-strength-result").html(ninja_forms_password_strength.empty);return}strength=passwordStrength(e,t);switch(strength){case 2:jQuery("#pass-strength-result").addClass("bad").html(ninja_forms_password_strength["bad"]);break;case 3:jQuery("#pass-strength-result").addClass("good").html(ninja_forms_password_strength["good"]);break;case 4:jQuery("#pass-strength-result").addClass("strong").html(ninja_forms_password_strength["strong"]);break;case 5:jQuery("#pass-strength-result").addClass("short").html(ninja_forms_password_strength["mismatch"]);break;default:jQuery("#pass-strength-result").addClass("short").html(ninja_forms_password_strength["short"])}}function passwordStrength(e,t){var n=1,r=2,i=3,s=4,o=5,u=0,a,f;if(e!=t&&t.length>0)return o;if(e.length<4)return n;if(e.match(/[0-9]/))u+=10;if(e.match(/[a-z]/))u+=26;if(e.match(/[A-Z]/))u+=26;if(e.match(/[^a-zA-Z0-9]/))u+=31;a=Math.log(Math.pow(u,e.length));f=a/Math.LN2;if(f<40)return r;if(f<56)return i;return s}function ninja_forms_find_opposite_op(e){switch(e){case"add":return"subtract";case"subtract":return"add";case"multiply":return"divide";case"divide":return"multiply"}}function ninja_forms_var_operator(e){this.operation=e;this.evaluate=function(t,n){switch(this.operation){case"add":return t+n;case"subtract":return t-n;case"multiply":return t*n;case"divide":return t/n}}}jQuery(document).ready(function(jQuery){window["ninja_forms_response_function_list"]={};window["ninja_forms_before_submit_function_list"]={};jQuery(".ninja-forms-form input").bind("keypress",function(e){if(e.keyCode==13){var t=jQuery(this).attr("type");if(t!="textarea"){return false}}});jQuery("div.label-inside input, div.label-inside textarea").focus(function(){var e=jQuery("#"+this.id+"_label_hidden").val();if(this.value==e){this.value=""}});jQuery("div.label-inside input, div.label-inside textarea").blur(function(){var e=jQuery("#"+this.id+"_label_hidden").val();if(this.value==""){this.value=e}});if(jQuery.fn.mask){jQuery(".ninja-forms-mask").each(function(){var e=this.title;jQuery(this).mask(e)});jQuery(".ninja-forms-date").mask("99/99/9999")}if(jQuery.fn.datepicker){jQuery(".ninja-forms-datepicker").datepicker({dateFormat:ninja_forms_settings.date_format})}if(jQuery.fn.autoNumeric){jQuery(".ninja-forms-currency").autoNumeric({aSign:ninja_forms_settings.currency_symbol})}if(jQuery.fn.qtip){jQuery(".ninja-forms-help-text").qtip({style:{classes:"qtip-shadow qtip-dark"}})}jQuery(".ninja-forms-form").each(function(){var e=this.id.replace("ninja_forms_form_","");var t=window["ninja_forms_form_"+e+"_settings"];ajax=t.ajax;if(ajax==1){var n={beforeSubmit:ninja_forms_before_submit,success:ninja_forms_response,dataType:"json"};jQuery(this).ajaxForm(n);jQuery(this).on("submitResponse.default",function(e,t){return ninja_forms_default_response(t)});jQuery(this).on("beforeSubmit.default",function(e,t,n,r){return ninja_forms_default_before_submit(t,n,r)})}else{jQuery(this).submit(function(e){var t=jQuery(this).serialize();var n=this;var r="";return ninja_forms_before_submit(t,n,r)})}});jQuery(".pass1").val("").keyup(function(){var e=this.value;var t=this.id.replace("pass1","pass2");t=jQuery("#"+t).val();check_pass_strength(e,t)});jQuery(".pass2").val("").keyup(function(){var e=this.value;var t=this.id.replace("pass2","pass1");t=jQuery("#"+t).val();check_pass_strength(t,e)});var selects=jQuery(".ninja-forms-field-calc-listen");selects.each(function(e,t){var n=jQuery(t);var r=jQuery(this).val();if(this.type!=="checkbox"){jQuery(t).data("oldValue",r)}});jQuery("body").on("focus",".ninja-forms-field-list-options-span-calc-listen",function(e){var t=jQuery(this).attr("rel");jQuery(this).data("oldValue",jQuery("input[name='ninja_forms_field_"+t+"']:checked").val())});jQuery("body").on("mousedown",".ninja-forms-field-list-options-span-calc-listen",function(e){var t=jQuery(this).attr("rel");jQuery(this).data("oldValue",jQuery("input[name='ninja_forms_field_"+t+"']:checked").val())});jQuery("body").on("change",".ninja-forms-field-calc-listen",function(event){if(this==event.target){var form_id=ninja_forms_get_form_id(this);var field_id=jQuery(this).attr("rel");var calc_settings=window["ninja_forms_form_"+form_id+"_calc_settings"];for(calc_id in calc_settings.calc_fields){if(calc_id!=field_id){var calc_method=calc_settings.calc_fields[calc_id]["method"];var calc_places=calc_settings.calc_fields[calc_id]["places"];if(calc_method=="fields"){var change=false;for(var i=calc_settings.calc_fields[calc_id]["fields"].length-1;i>=0;i--){if(calc_settings.calc_fields[calc_id]["fields"][i]["field"]==field_id){change=true;break}}}else if(calc_method=="eq"){var change=false;if(typeof calc_settings.calc_fields[calc_id]["fields"]!=="undefined"){for(var i=calc_settings.calc_fields[calc_id]["fields"].length-1;i>=0;i--){if(calc_settings.calc_fields[calc_id]["fields"][i]==field_id){change=true;break}}}}if((calc_method=="fields"||calc_method=="eq")&&change||calc_method=="auto"){if(calc_method=="auto"||calc_method=="fields"){var key=jQuery(this).val();var new_value="";old_value=jQuery(this).data("oldValue");if(jQuery("#ninja_forms_field_"+field_id+"_type").val()=="list"){var key=jQuery(this).val();if(jQuery("#ninja_forms_field_"+field_id+"_list_type").val()=="checkbox"){if(!this.checked){old_value=key;new_value=0}}else if(jQuery("#ninja_forms_field_"+field_id+"_list_type").val()=="radio"){var span=jQuery(this).parent().parent().parent().parent();old_value=jQuery(span).data("oldValue")}else if(jQuery("#ninja_forms_field_"+field_id+"_list_type").val()=="multi"){if(jQuery.isArray(key)){var tmp=0;for(var i=key.length-1;i>=0;i--){if(typeof calc_settings.calc_value[field_id][key[i]]!=="undefined"){tmp+=parseFloat(calc_settings.calc_value[field_id][key[i]])}}new_value=tmp}if(jQuery.isArray(old_value)){var tmp=0;for(var i=old_value.length-1;i>=0;i--){if(typeof calc_settings.calc_value[field_id][old_value[i]]!=="undefined"){tmp+=parseFloat(calc_settings.calc_value[field_id][old_value[i]])}}old_value=tmp}}else{var old_value=jQuery(this).data("oldValue")}}else if(jQuery("#ninja_forms_field_"+field_id+"_type").val()=="checkbox"){if(this.checked){var key="checked";var old_value="unchecked"}else{var key="unchecked";var old_value="checked"}}if(this.type!=="checkbox"){jQuery(this).data("oldValue",key)}if(new_value===""){if(typeof calc_settings.calc_value[field_id]!=="undefined"&&typeof calc_settings.calc_value[field_id][key]!=="undefined"){var new_value=calc_settings.calc_value[field_id][key]}else{if(typeof this.type==="undefined"){var new_value=this.innerHTML}else{var new_value=this.value}if(typeof ninja_forms_settings.currency_symbol!=="undefined"){new_value=new_value.replace(ninja_forms_settings.currency_symbol,"");new_value=new_value.replace(/,/g,"")}if(isNaN(new_value)){new_value=0}}}if(typeof calc_settings.calc_value[field_id]!=="undefined"&&typeof calc_settings.calc_value[field_id][old_value]!=="undefined"){old_value=calc_settings.calc_value[field_id][old_value]}else{if(old_value==""||typeof old_value==="undefined"){old_value=0}else{if(isNaN(old_value)){if(typeof ninja_forms_settings.currency_symbol!=="undefined"){old_value=old_value.replace(ninja_forms_settings.currency_symbol,"");old_value=old_value.replace(/,/g,"")}}}}if(jQuery("#ninja_forms_field_"+calc_id).attr("type")=="text"){var current_value=jQuery("#ninja_forms_field_"+calc_id).val()}else{var current_value=jQuery("#ninja_forms_field_"+calc_id).html()}if(typeof ninja_forms_settings.currency_symbol!=="undefined"){current_value=current_value.replace(ninja_forms_settings.currency_symbol,"");current_value=current_value.replace(/,/g,"")}if(!isNaN(current_value)){current_value=parseFloat(current_value)}else{current_value=0}if(calc_method=="auto"){var old_op="subtract";var new_op="add";if(!jQuery(this).hasClass("ninja-forms-field-calc-auto")){old_value="";new_value=""}}else if(calc_method=="fields"){for(var i=calc_settings.calc_fields[calc_id]["fields"].length-1;i>=0;i--){if(calc_settings.calc_fields[calc_id]["fields"][i]["field"]==field_id){var old_op=ninja_forms_find_opposite_op(calc_settings.calc_fields[calc_id]["fields"][i]["op"]);var new_op=calc_settings.calc_fields[calc_id]["fields"][i]["op"]}}}if(old_value&&!isNaN(old_value)&&old_value!=0&&old_value!=""&&!jQuery(this).hasClass("ninja-forms-field-calc-no-old-op")){old_value=parseFloat(old_value);tmp=new ninja_forms_var_operator(old_op);current_value=tmp.evaluate(current_value,old_value)}if(new_value&&!isNaN(new_value)&&new_value!=0&&new_value!=""&&!jQuery(this).hasClass("ninja-forms-field-calc-no-new-op")){new_value=parseFloat(new_value);tmp=new ninja_forms_var_operator(new_op);var calc_value=tmp.evaluate(current_value,new_value)}else{var calc_value=current_value}}else if(calc_method=="eq"){var tmp_eq=calc_settings.calc_fields[calc_id]["eq"];for(var i=calc_settings.calc_fields[calc_id]["fields"].length-1;i>=0;i--){var f_id=calc_settings.calc_fields[calc_id]["fields"][i];var key=jQuery("#ninja_forms_field_"+f_id).val();var f_value="";if(jQuery("#ninja_forms_field_"+f_id+"_type").val()=="list"){if(jQuery("#ninja_forms_field_"+f_id+"_list_type").val()=="radio"){key=jQuery(".ninja-forms-field-"+f_id+"-options :checked").val()}else if(jQuery("#ninja_forms_field_"+f_id+"_list_type").val()=="multi"){if(jQuery.isArray(key)){var tmp=0;for(var x=key.length-1;x>=0;x--){if(typeof calc_settings.calc_value[f_id][key[x]]!=="undefined"){tmp+=parseFloat(calc_settings.calc_value[f_id][key[x]])}}f_value=tmp}}else if(jQuery("#ninja_forms_field_"+f_id+"_list_type").val()=="checkbox"){var tmp=0;jQuery(".ninja-forms-field-"+f_id+"-options :checked").each(function(){if(typeof calc_settings.calc_value[f_id][this.value]!=="undefined"){tmp+=parseFloat(calc_settings.calc_value[f_id][this.value])}});f_value=tmp}}else if(jQuery("#ninja_forms_field_"+f_id+"_type").val()=="checkbox"){if(jQuery("#ninja_forms_field_"+f_id).attr("checked")){var key="checked"}else{var key="unchecked"}}if(f_value==""){if(typeof calc_settings.calc_value[f_id]!=="undefined"&&typeof calc_settings.calc_value[f_id][key]!=="undefined"){f_value=calc_settings.calc_value[f_id][key]}else{f_value=key}}if(typeof f_value!=="undefined"){if(f_value.indexOf("%")>=0){f_value=f_value.replace("%","");if(!isNaN(f_value)){f_value=parseFloat(f_value)/100}}}if(typeof this.type==="undefined"){f_value=this.innerHTML}else{f_value=this.value}if(typeof ninja_forms_settings.currency_symbol!=="undefined"){f_value=f_value.replace(ninja_forms_settings.currency_symbol,"");f_value=f_value.replace(/,/g,"")}if(isNaN(f_value)||f_value==""||!f_value||typeof f_value==="undefined"){f_value=0}var find="field_"+f_id;var re=new RegExp(find,"g");tmp_eq=tmp_eq.replace(re,f_value)}var calc_value=eval(tmp_eq)}if(jQuery("#ninja_forms_field_"+calc_id).attr("type")=="text"){var current_value=jQuery("#ninja_forms_field_"+calc_id).val()}else{var current_value=jQuery("#ninja_forms_field_"+calc_id).html()}if(typeof ninja_forms_settings.currency_symbol!=="undefined"){current_value=current_value.replace(ninja_forms_settings.currency_symbol,"")}if(!isNaN(current_value)){current_value=parseFloat(current_value)}else{current_value=0}if(current_value!==calc_value){jQuery(this).removeClass("ninja-forms-field-calc-no-old-op");calc_value=calc_value.toFixed(calc_places);if(jQuery("#ninja_forms_field_"+calc_id).attr("type")=="text"){jQuery("#ninja_forms_field_"+calc_id).val(calc_value)}else{jQuery("#ninja_forms_field_"+calc_id).html(calc_value)}jQuery("#ninja_forms_field_"+calc_id).trigger("change")}}}}}})})
\ No newline at end of file
function ninja_forms_before_submit(e,t,n){var r=jQuery(t).triggerHandler("beforeSubmit",[e,t,n]);if(r!==false){r=jQuery("body").triggerHandler("beforeSubmit",[e,t,n])}if(r!==false){r=jQuery(document).triggerHandler("beforeSubmit",[e,t,n])}return r}function ninja_forms_response(e,t,n,r){if(ninja_forms_settings.ajax_msg_format=="inline"){var i=jQuery(r).triggerHandler("submitResponse",[e]);if(i!==false){i=jQuery("body").triggerHandler("submitResponse",[e])}if(i!==false){i=jQuery(document).triggerHandler("submitResponse",[e])}return i}}function ninja_forms_register_response_function(e,t){if(typeof window["ninja_forms_response_function_list"][e]=="undefined"){window["ninja_forms_response_function_list"][e]={}}window["ninja_forms_response_function_list"][e][t]=t}function ninja_forms_register_before_submit_function(e,t){if(typeof window["ninja_forms_before_submit_function_list"][e]=="undefined"){window["ninja_forms_before_submit_function_list"][e]={}}window["ninja_forms_before_submit_function_list"][e][t]=t}function ninja_forms_default_before_submit(e,t,n){var r=jQuery(t).prop("id").replace("ninja_forms_form_","");jQuery("#ninja_forms_form_"+r+"_process_msg").show();jQuery("#ninja_forms_form_"+r+"_response_msg").prop("innerHTML","");jQuery("#ninja_forms_form_"+r+"_response_msg").removeClass("ninja-forms-error-msg");jQuery("#ninja_forms_form_"+r+"_response_msg").removeClass("ninja-forms-success-msg");jQuery(".ninja-forms-field-error").prop("innerHTML","");jQuery(".ninja-forms-error").removeClass("ninja-forms-error");return true}function ninja_forms_default_response(e){var t=e.form_id;jQuery("#ninja_forms_form_"+t+"_process_msg").hide();ninja_forms_update_error_msgs(e);ninja_forms_update_success_msg(e);return true}function ninja_forms_update_success_msg(e){var t="";var n=e.form_id;var r=e.success;var i=e.form_settings;var s=i.hide_complete;var o=i.clear_complete;if(r!=false){for(var u in r){t+="<p>"+r[u]+"</p>"}if(t!=""){jQuery("#ninja_forms_form_"+n+"_response_msg").removeClass("ninja-forms-error-msg");jQuery("#ninja_forms_form_"+n+"_response_msg").addClass("ninja-forms-success-msg");jQuery("#ninja_forms_form_"+n+"_response_msg").prop("innerHTML",t)}if(s==1){jQuery("#ninja_forms_form_"+n).hide()}if(o==1){jQuery("#ninja_forms_form_"+n).resetForm()}}}function ninja_forms_update_error_msgs(e){var t="";var n=e.form_id;var r=e.errors;var n=e.form_id;if(r!=false){for(var i in r){if(r[i]["location"]=="general"){t+="<p>"+r[i]["msg"]+"</p>"}else{var s=r[i]["location"];jQuery("#ninja_forms_field_"+s+"_error").show();jQuery("#ninja_forms_field_"+s+"_error").prop("innerHTML",r[i]["msg"]);jQuery("#ninja_forms_field_"+s+"_div_wrap").addClass("ninja-forms-error")}}if(t!=""){jQuery("#ninja_forms_form_"+n+"_response_msg").removeClass("ninja-forms-success-msg");jQuery("#ninja_forms_form_"+n+"_response_msg").addClass("ninja-forms-error-msg");jQuery("#ninja_forms_form_"+n+"_response_msg").prop("innerHTML",t)}}}function ninja_forms_html_decode(e){if(e){var t=jQuery("<div />").html(e).text();t=jQuery("<div />").html(t).text();return t}else{return""}}function ninja_forms_toggle_login_register(e,t){var n="ninja_forms_form_"+t+"_"+e+"_form";if(e=="login"){var r="ninja_forms_form_"+t+"_register_form"}else{var r="ninja_forms_form_"+t+"_login_form"}var i=document.getElementById(n);var s=document.getElementById(r);if(i.style.display=="block"){i.style.display="none"}else{i.style.display="block";s.style.display="none"}}function ninja_forms_get_form_id(e){var t=jQuery(e).closest("form").prop("id");t=t.replace("ninja_forms_form_","");if(t==""||t=="ninja_forms_admin"){t=jQuery("#_form_id").val()}return t}function check_pass_strength(e,t){jQuery("#pass-strength-result").removeClass("short bad good strong");if(!e){jQuery("#pass-strength-result").html(ninja_forms_password_strength.empty);return}strength=passwordStrength(e,t);switch(strength){case 2:jQuery("#pass-strength-result").addClass("bad").html(ninja_forms_password_strength["bad"]);break;case 3:jQuery("#pass-strength-result").addClass("good").html(ninja_forms_password_strength["good"]);break;case 4:jQuery("#pass-strength-result").addClass("strong").html(ninja_forms_password_strength["strong"]);break;case 5:jQuery("#pass-strength-result").addClass("short").html(ninja_forms_password_strength["mismatch"]);break;default:jQuery("#pass-strength-result").addClass("short").html(ninja_forms_password_strength["short"])}}function passwordStrength(e,t){var n=1,r=2,i=3,s=4,o=5,u=0,a,f;if(e!=t&&t.length>0)return o;if(e.length<4)return n;if(e.match(/[0-9]/))u+=10;if(e.match(/[a-z]/))u+=26;if(e.match(/[A-Z]/))u+=26;if(e.match(/[^a-zA-Z0-9]/))u+=31;a=Math.log(Math.pow(u,e.length));f=a/Math.LN2;if(f<40)return r;if(f<56)return i;return s}function ninja_forms_find_opposite_op(e){switch(e){case"add":return"subtract";case"subtract":return"add";case"multiply":return"divide";case"divide":return"multiply"}}function ninja_forms_var_operator(e){this.operation=e;this.evaluate=function(t,n){switch(this.operation){case"add":return t+n;case"subtract":return t-n;case"multiply":return t*n;case"divide":return t/n}}}jQuery(document).ready(function(jQuery){window["ninja_forms_response_function_list"]={};window["ninja_forms_before_submit_function_list"]={};jQuery(".ninja-forms-form input").bind("keypress",function(e){if(e.keyCode==13){var t=jQuery(this).attr("type");if(t!="textarea"){return false}}});jQuery("div.label-inside input, div.label-inside textarea").focus(function(){var e=jQuery("#"+this.id+"_label_hidden").val();if(this.value==e){this.value=""}});jQuery("div.label-inside input, div.label-inside textarea").blur(function(){var e=jQuery("#"+this.id+"_label_hidden").val();if(this.value==""){this.value=e}});if(jQuery.fn.mask){jQuery(".ninja-forms-mask").each(function(){var e=this.title;jQuery(this).mask(e)});jQuery(".ninja-forms-date").mask("99/99/9999")}if(jQuery.fn.datepicker){jQuery(".ninja-forms-datepicker").datepicker({dateFormat:ninja_forms_settings.date_format})}if(jQuery.fn.autoNumeric){jQuery(".ninja-forms-currency").autoNumeric({aSign:ninja_forms_settings.currency_symbol})}if(jQuery.fn.qtip){jQuery(".ninja-forms-help-text").qtip({style:{classes:"qtip-shadow qtip-dark"}})}jQuery(".ninja-forms-form").each(function(){var e=this.id.replace("ninja_forms_form_","");var t=window["ninja_forms_form_"+e+"_settings"];ajax=t.ajax;if(ajax==1){var n={beforeSubmit:ninja_forms_before_submit,success:ninja_forms_response,dataType:"json"};jQuery(this).ajaxForm(n);jQuery(this).on("submitResponse.default",function(e,t){return ninja_forms_default_response(t)});jQuery(this).on("beforeSubmit.default",function(e,t,n,r){return ninja_forms_default_before_submit(t,n,r)})}else{jQuery(this).submit(function(e){var t=jQuery(this).serialize();var n=this;var r="";return ninja_forms_before_submit(t,n,r)})}});jQuery(".pass1").val("").keyup(function(){var e=this.value;var t=this.id.replace("pass1","pass2");t=jQuery("#"+t).val();check_pass_strength(e,t)});jQuery(".pass2").val("").keyup(function(){var e=this.value;var t=this.id.replace("pass2","pass1");t=jQuery("#"+t).val();check_pass_strength(t,e)});var calc_fields=jQuery(".ninja-forms-field-calc-listen");calc_fields.each(function(e,t){if(this.type=="checkbox"){if(this.checked){var n="checked"}else{var n="unchecked"}}else{var n=jQuery(this).val()}var r=ninja_forms_get_form_id(this);var i=jQuery(this).attr("rel");var s=window["ninja_forms_form_"+r+"_calc_settings"];for(calc_id in s.calc_fields){if(calc_id!=i){jQuery(t).data(calc_id+"-oldValue",n)}}});jQuery("body").on("focus",".ninja-forms-field-list-options-span-calc-listen",function(e){var t=jQuery(this).attr("rel");if(jQuery("#ninja_forms_field_"+t+"_type").val()=="list"&&jQuery("#ninja_forms_field_"+t+"_list_type").val()=="radio"){var n=ninja_forms_get_form_id(this);var r=window["ninja_forms_form_"+n+"_calc_settings"];for(calc_id in r.calc_fields){if(calc_id!=t){jQuery(this).data(calc_id+"-oldValue",jQuery("input[name='ninja_forms_field_"+t+"']:checked").val())}}}});jQuery("body").on("mousedown",".ninja-forms-field-list-options-span-calc-listen",function(e){var t=jQuery(this).attr("rel");if(jQuery("#ninja_forms_field_"+t+"_type").val()=="list"&&jQuery("#ninja_forms_field_"+t+"_list_type").val()=="radio"){var n=ninja_forms_get_form_id(this);var r=window["ninja_forms_form_"+n+"_calc_settings"];for(calc_id in r.calc_fields){if(calc_id!=t){jQuery(this).data(calc_id+"-oldValue",jQuery("input[name='ninja_forms_field_"+t+"']:checked").val())}}}});jQuery("body").on("change",".ninja-forms-field-calc-listen",function(event){if(this==event.target){var form_id=ninja_forms_get_form_id(this);var field_id=jQuery(this).attr("rel");var calc_settings=window["ninja_forms_form_"+form_id+"_calc_settings"];var visible=jQuery("#ninja_forms_field_"+field_id+"_div_wrap").data("visible");for(calc_id in calc_settings.calc_fields){if(calc_id!=field_id){var calc_method=calc_settings.calc_fields[calc_id]["method"];var calc_places=calc_settings.calc_fields[calc_id]["places"];if(calc_method=="fields"){var change=false;for(var i=calc_settings.calc_fields[calc_id]["fields"].length-1;i>=0;i--){if(calc_settings.calc_fields[calc_id]["fields"][i]["field"]==field_id){change=true;break}}}else if(calc_method=="eq"){var change=false;if(typeof calc_settings.calc_fields[calc_id]["fields"]!=="undefined"){for(var i=calc_settings.calc_fields[calc_id]["fields"].length-1;i>=0;i--){if(calc_settings.calc_fields[calc_id]["fields"][i]==field_id){change=true;break}}}}if((calc_method=="fields"||calc_method=="eq")&&change||calc_method=="auto"){if(calc_method=="auto"||calc_method=="fields"){var key=jQuery(this).val();var new_value="";old_value=jQuery(this).data(calc_id+"-oldValue");if(jQuery("#ninja_forms_field_"+field_id+"_type").val()=="list"){var key=jQuery(this).val();if(jQuery("#ninja_forms_field_"+field_id+"_list_type").val()=="checkbox"){if(this.checked){jQuery(this).data(calc_id+"-oldValue","checked")}else{jQuery(this).data(calc_id+"-oldValue","unchecked")}if(this.checked&&visible==1){old_value=0}else if(this.checked&&visible!=1){old_value=key;new_value=0}else if(!this.checked&&visible==1){if(old_value=="checked"){old_value=key}else{old_value=0}new_value=0}else if(!this.checked&&visible!=1){if(old_value=="checked"){old_value=key}else{old_value=0}new_value=0}}else if(jQuery("#ninja_forms_field_"+field_id+"_list_type").val()=="radio"){var span=jQuery(this).parent().parent().parent().parent();old_value=jQuery(span).data(calc_id+"-oldValue");if(typeof old_value==="undefined"){if(this.checked){old_value=jQuery(this).val()}}if(this.checked&&visible==1){if(old_value==key){old_value=0}}else if(this.checked&&visible!=1){new_value=0}else if(!this.checked){old_value=0;new_value=0}if(this.checked){jQuery(span).data(calc_id+"-oldValue",key)}}else if(jQuery("#ninja_forms_field_"+field_id+"_list_type").val()=="multi"){if(jQuery.isArray(key)){var tmp=0;for(var i=key.length-1;i>=0;i--){if(typeof calc_settings.calc_value[field_id][key[i]]!=="undefined"){tmp+=parseFloat(calc_settings.calc_value[field_id][key[i]])}}new_value=tmp}if(jQuery.isArray(old_value)){var tmp=0;for(var i=old_value.length-1;i>=0;i--){if(typeof calc_settings.calc_value[field_id][old_value[i]]!=="undefined"){tmp+=parseFloat(calc_settings.calc_value[field_id][old_value[i]])}}old_value=tmp}}else{var old_value=jQuery(this).data(calc_id+"-oldValue")}}else if(jQuery("#ninja_forms_field_"+field_id+"_type").val()=="checkbox"){if(this.checked&&visible==1){var key="checked";old_value="unchecked"}else if(this.checked&&visible!=1){var key="unchecked";if(jQuery(this).data(calc_id+"-oldValue")=="checked"||typeof jQuery(this).data(calc_id+"-oldValue")==="undefined"){old_value="checked"}else{old_value=0}}else if(!this.checked&&visible!=1){var key="unchecked";old_value=0}else{var key="unchecked";if(jQuery(this).data(calc_id+"-oldValue")=="checked"||typeof jQuery(this).data(calc_id+"-oldValue")==="undefined"){old_value="checked"}else{old_value=0}}}if(new_value===""){if(typeof calc_settings.calc_value[field_id]!=="undefined"&&typeof calc_settings.calc_value[field_id][key]!=="undefined"){var new_value=calc_settings.calc_value[field_id][key]}else{if(typeof this.type==="undefined"){var new_value=this.innerHTML}else{var new_value=this.value}if(typeof ninja_forms_settings.currency_symbol!=="undefined"){new_value=new_value.replace(ninja_forms_settings.currency_symbol,"");new_value=new_value.replace(/,/g,"")}if(isNaN(new_value)){new_value=0}}}if(typeof calc_settings.calc_value[field_id]!=="undefined"&&typeof calc_settings.calc_value[field_id][old_value]!=="undefined"){old_value=calc_settings.calc_value[field_id][old_value]}else{if(old_value==""||typeof old_value==="undefined"){old_value=0}else{if(isNaN(old_value)){if(typeof ninja_forms_settings.currency_symbol!=="undefined"){old_value=old_value.replace(ninja_forms_settings.currency_symbol,"");old_value=old_value.replace(/,/g,"")}}}}if(jQuery("#ninja_forms_field_"+calc_id).attr("type")=="text"){var current_value=jQuery("#ninja_forms_field_"+calc_id).val()}else{var current_value=jQuery("#ninja_forms_field_"+calc_id).html()}if(typeof ninja_forms_settings.currency_symbol!=="undefined"){current_value=current_value.replace(ninja_forms_settings.currency_symbol,"");current_value=current_value.replace(/,/g,"")}if(!isNaN(current_value)){current_value=parseFloat(current_value)}else{current_value=0}if(calc_method=="auto"){var old_op="subtract";var new_op="add";if(!jQuery(this).hasClass("ninja-forms-field-calc-auto")){old_value="";new_value=""}}else if(calc_method=="fields"){for(var i=calc_settings.calc_fields[calc_id]["fields"].length-1;i>=0;i--){if(calc_settings.calc_fields[calc_id]["fields"][i]["field"]==field_id){var old_op=ninja_forms_find_opposite_op(calc_settings.calc_fields[calc_id]["fields"][i]["op"]);var new_op=calc_settings.calc_fields[calc_id]["fields"][i]["op"]}}}if(old_value&&!isNaN(old_value)&&old_value!=0&&old_value!=""&&!jQuery(this).hasClass("ninja-forms-field-calc-no-old-op")){old_value=parseFloat(old_value);var asdf=current_value;tmp=new ninja_forms_var_operator(old_op);current_value=tmp.evaluate(current_value,old_value)}if(new_value&&!isNaN(new_value)&&new_value!=0&&new_value!=""&&!jQuery(this).hasClass("ninja-forms-field-calc-no-new-op")){new_value=parseFloat(new_value);tmp=new ninja_forms_var_operator(new_op);var calc_value=tmp.evaluate(current_value,new_value)}else{var calc_value=current_value}}else if(calc_method=="eq"){var tmp_eq=calc_settings.calc_fields[calc_id]["eq"];for(var i=calc_settings.calc_fields[calc_id]["fields"].length-1;i>=0;i--){var f_id=calc_settings.calc_fields[calc_id]["fields"][i];var key=jQuery("#ninja_forms_field_"+f_id).val();var f_value="";if(jQuery("#ninja_forms_field_"+f_id+"_type").val()=="list"){if(jQuery("#ninja_forms_field_"+f_id+"_list_type").val()=="radio"){key=jQuery(".ninja-forms-field-"+f_id+"-options :checked").val()}else if(jQuery("#ninja_forms_field_"+f_id+"_list_type").val()=="multi"){if(jQuery.isArray(key)){var tmp=0;for(var x=key.length-1;x>=0;x--){if(typeof calc_settings.calc_value[f_id][key[x]]!=="undefined"){tmp+=parseFloat(calc_settings.calc_value[f_id][key[x]])}}f_value=tmp}}else if(jQuery("#ninja_forms_field_"+f_id+"_list_type").val()=="checkbox"){var tmp=0;jQuery(".ninja-forms-field-"+f_id+"-options :checked").each(function(){if(typeof calc_settings.calc_value[f_id][this.value]!=="undefined"){tmp+=parseFloat(calc_settings.calc_value[f_id][this.value])}});f_value=tmp}}else if(jQuery("#ninja_forms_field_"+f_id+"_type").val()=="checkbox"){if(jQuery("#ninja_forms_field_"+f_id).attr("checked")){var key="checked"}else{var key="unchecked"}}if(f_value==""){if(typeof calc_settings.calc_value[f_id]!=="undefined"&&typeof calc_settings.calc_value[f_id][key]!=="undefined"){f_value=calc_settings.calc_value[f_id][key]}else{f_value=key}}if(typeof f_value!=="undefined"){if(f_value.indexOf("%")>=0){f_value=f_value.replace("%","");if(!isNaN(f_value)){f_value=parseFloat(f_value)/100}}}if(typeof this.type==="undefined"){f_value=this.innerHTML}else{f_value=this.value}if(typeof ninja_forms_settings.currency_symbol!=="undefined"){f_value=f_value.replace(ninja_forms_settings.currency_symbol,"");f_value=f_value.replace(/,/g,"")}if(isNaN(f_value)||f_value==""||!f_value||typeof f_value==="undefined"){f_value=0}var find="field_"+f_id;var re=new RegExp(find,"g");tmp_eq=tmp_eq.replace(re,f_value)}var calc_value=eval(tmp_eq)}if(jQuery("#ninja_forms_field_"+calc_id).attr("type")=="text"){var current_value=jQuery("#ninja_forms_field_"+calc_id).val()}else{var current_value=jQuery("#ninja_forms_field_"+calc_id).html()}if(typeof ninja_forms_settings.currency_symbol!=="undefined"){current_value=current_value.replace(ninja_forms_settings.currency_symbol,"")}if(!isNaN(current_value)){current_value=parseFloat(current_value)}else{current_value=0}if(current_value!==calc_value){if(jQuery("#ninja_forms_field_"+field_id+"_list_type").val()!="checkbox"){jQuery(this).data(calc_id+"-oldValue",key)}if(jQuery("#ninja_forms_field_"+field_id+"_list_type").val()=="checkbox"||jQuery("#ninja_forms_field_"+field_id+"_list_type").val()=="radio"){jQuery("#ninja_forms_field_"+field_id+"_div_wrap").find(".ninja-forms-field").each(function(){jQuery(this).removeClass("ninja-forms-field-calc-no-old-op")})}else{jQuery(this).removeClass("ninja-forms-field-calc-no-old-op")}calc_value=calc_value.toFixed(calc_places);if(jQuery("#ninja_forms_field_"+calc_id).attr("type")=="text"){jQuery("#ninja_forms_field_"+calc_id).val(calc_value)}else{jQuery("#ninja_forms_field_"+calc_id).html(calc_value)}jQuery("#ninja_forms_field_"+calc_id).trigger("change")}}}}}})})
\ No newline at end of file
......@@ -3,7 +3,7 @@
Plugin Name: Ninja Forms
Plugin URI: http://ninjaforms.com/
Description: Ninja Forms is a webform builder with unparalleled ease of use and features.
Version: 2.2.49
Version: 2.2.50
Author: The WP Ninjas
Author URI: http://ninjaforms.com
Text Domain: ninja-forms
......@@ -51,7 +51,7 @@ global $wpdb, $wp_version;
define("NINJA_FORMS_DIR", WP_PLUGIN_DIR."/".basename( dirname( __FILE__ ) ) );
define("NINJA_FORMS_URL", plugins_url()."/".basename( dirname( __FILE__ ) ) );
define("NINJA_FORMS_VERSION", "2.2.49");
define("NINJA_FORMS_VERSION", "2.2.50");
define("NINJA_FORMS_TABLE_NAME", $wpdb->prefix . "ninja_forms");
define("NINJA_FORMS_FIELDS_TABLE_NAME", $wpdb->prefix . "ninja_forms_fields");
define("NINJA_FORMS_FAV_FIELDS_TABLE_NAME", $wpdb->prefix . "ninja_forms_fav_fields");
......
......@@ -3,7 +3,7 @@ Contributors: kstover, jameslaws, daveshine
Tags: form, forms, contact form, custom form, form builder, form creator, form manager, form creation, contact forms, custom forms, forms builder, forms creator, forms manager, forms creation, form administration,
Requires at least: 3.4
Tested up to: 3.6
Stable tag: 2.2.49
Stable tag: 2.2.50
License: GPLv2 or later
Forms created with a simple drag and drop interface. Contact forms, Email collection forms, or any other form you want on your WordPress site.
......@@ -76,14 +76,17 @@ For help and video tutorials, please visit our website: [Ninja Forms Documentati
== Upgrade Notice ==
= 2.2.49 =
= 2.2.50 =
*Bugs:*
* Duplicated or imported forms that use the [ninja_forms_field] shortcode should now have their references automatically changed after duplication/import.
* Fixed a bug that caused the Total calculation field to work incorrectly with Tax and Subtotals.
* Fixed a major bug that could cause calculation fields to not work when using the currencty input mask.
* Fixed a bug that caused special characters to appear incorrectly in List fields.
* Fixed a major bug that could prevent calculation fields from working properly when more than one calculation referenced the same field.
* Fixed a bug that caused calculation fields to work incorrectly with the Conditional Logic extension.
*Changes:*
* Added the "visible" HTML5 data attribute to fields.
* Removed functions from core that were specific to the Conditional Logic extension.
== Requested Features ==
......@@ -91,6 +94,18 @@ If you have any feature requests, please feel free to visit [ninjaforms.com](htt
== Changelog ==
= 2.2.50 =
*Bugs:*
* Fixed a major bug that could prevent calculation fields from working properly when more than one calculation referenced the same field.
* Fixed a bug that caused calculation fields to work incorrectly with the Conditional Logic extension.
*Changes:*
* Added the "visible" HTML5 data attribute to fields.
* Removed functions from core that were specific to the Conditional Logic extension.
= 2.2.49 =
*Bugs:*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment