plugin updates

This commit is contained in:
Tony Volpe
2024-11-20 22:40:39 -05:00
parent 0238f0c4ca
commit 3362947c6e
434 changed files with 13405 additions and 9202 deletions

View File

@@ -354,7 +354,8 @@ function isValidFlyoutClick( e ) {
'jsConditonalToggle' in e.target.dataset ||
'jsAddRule' in e.target.dataset ||
'jsDeleteRule' in e.target.dataset ||
e.target.classList.contains( 'gform-field__toggle-input' )
e.target.classList.contains( 'gform-field__toggle-input' ) ||
e.target.closest( '.gform-dialog__mask' ) !== null
);
return gform.applyFilters( 'gform_conditional_logic_is_valid_flyout_click', isValidFlyoutClick, e );
}
@@ -388,7 +389,7 @@ function GFConditionalLogic( fieldId, objectType ) {
this.objectType = objectType;
this.els = this.gatherElements();
this.state = this.getStateForField( fieldId );
this.visible = false;
this.visible = document.querySelector( '.editor-sidebar .conditional_logic_flyout_container.anim-in-active' ) ? true : false;
// Prebind event listener callbacks to maintain references
this._handleToggleClick = this.handleToggleClick.bind( this );
@@ -536,7 +537,7 @@ GFConditionalLogic.prototype.renderFieldOptions = function( rule ) {
continue;
}
if ( field.inputs && jQuery.inArray( GetInputType( field ), [ 'checkbox', 'email', 'consent' ] ) == -1 ) {
if ( field.inputs && jQuery.inArray( GetInputType( field ), [ 'checkbox', 'email', 'consent' ] ) == -1 && GetInputType( field ) !== 'radio' ) {
for ( var j = 0; j < field.inputs.length; j++ ) {
var input = field.inputs[ j ];
@@ -1373,4 +1374,3 @@ GFConditionalLogic.prototype.init = function() {
this.renderSidebar();
};

View File

@@ -29,9 +29,6 @@ function gf_apply_rules(formId, fields, isInit){
native: false,
data: { formId: formId, fields: fields, isInit: isInit },
} );
if(window["gformCalculateTotalPrice"]){
window["gformCalculateTotalPrice"](formId);
}
}
});
}
@@ -255,7 +252,7 @@ function gf_format_number( value, fieldNumberFormat ) {
decimalSeparator = '.';
if( fieldNumberFormat == 'currency' ) {
decimalSeparator = gformGetDecimalSeparator( 'currency' );
decimalSeparator = gform.Currency.getDecimalSeparator( 'currency' );
} else if( fieldNumberFormat == 'decimal_comma' ) {
decimalSeparator = ',';
} else if( fieldNumberFormat == 'decimal_dot' ) {
@@ -263,7 +260,7 @@ function gf_format_number( value, fieldNumberFormat ) {
}
// transform to a decimal dot number
value = gformCleanNumber( value, '', '', decimalSeparator );
value = gform.Currency.cleanNumber( value, '', '', decimalSeparator );
/**
* Looking at format specified by wp locale creates issues. When performing conditional logic, all numbers will be formatted to decimal dot and then compared that way. AC
@@ -292,7 +289,7 @@ function gf_try_convert_float(text){
var format = 'decimal_dot';
if( gformIsNumeric( text, format ) ) {
var decimal_separator = format == "decimal_comma" ? "," : ".";
return gformCleanNumber( text, "", "", decimal_separator );
return gform.Currency.cleanNumber( text, "", "", decimal_separator );
}
return text;
@@ -315,14 +312,14 @@ function gf_matches_operation(val1, val2, operation){
val1 = gf_try_convert_float(val1);
val2 = gf_try_convert_float(val2);
return gformIsNumber(val1) && gformIsNumber(val2) ? val1 > val2 : false;
return gform.utils.isNumber(val1) && gform.utils.isNumber(val2) ? val1 > val2 : false;
break;
case "<" :
val1 = gf_try_convert_float(val1);
val2 = gf_try_convert_float(val2);
return gformIsNumber(val1) && gformIsNumber(val2) ? val1 < val2 : false;
return gform.utils.isNumber(val1) && gform.utils.isNumber(val2) ? val1 < val2 : false;
break;
case "contains" :

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
gform.addFilter("gform_datepicker_options_pre_init",function(e,t,i,r){var o,s,d,a=window.gf_legacy_multi;return a&&a[t]&&"1"===a[t]?(o=window.jQuery,s=0<o("#preview_form_container").length,d="rtl"===window.getComputedStyle(r[0],null).getPropertyValue("direction"),Object.assign(e,{showOtherMonths:!1,beforeShow:function(e,t){return t.dpDiv[0].classList.remove("gform-theme-datepicker"),t.dpDiv[0].classList.remove("gravity-theme"),t.dpDiv[0].classList.remove("gform-theme"),t.dpDiv[0].classList.remove("gform-legacy-datepicker"),t.dpDiv[0].classList.remove("gform-theme--framework"),t.dpDiv[0].classList.remove("gform-theme--foundation"),t.dpDiv[0].classList.remove("gform-theme--orbital"),t.dpDiv[0].classList.add("gform-legacy-datepicker"),d&&s&&(e=o(e).closest(".gfield"),e=o(document).outerWidth()-(e.offset().left+e.outerWidth()),t.dpDiv[0].style.right=e+"px"),s&&t.dpDiv[0].classList.add("gform-preview-datepicker"),!this.suppressDatePicker}})):e},-10);
gform.addFilter("gform_datepicker_options_pre_init",function(e,t,i,r){var o,s,d,a=window.gf_legacy_multi;return a&&a[t]&&"1"===a[t]?(s=0<(o=window.jQuery)("#preview_form_container").length,d="rtl"===window.getComputedStyle(r[0],null).getPropertyValue("direction"),Object.assign(e,{showOtherMonths:!1,beforeShow:function(e,t){return t.dpDiv[0].classList.remove("gform-theme-datepicker"),t.dpDiv[0].classList.remove("gravity-theme"),t.dpDiv[0].classList.remove("gform-theme"),t.dpDiv[0].classList.remove("gform-legacy-datepicker"),t.dpDiv[0].classList.remove("gform-theme--framework"),t.dpDiv[0].classList.remove("gform-theme--foundation"),t.dpDiv[0].classList.remove("gform-theme--orbital"),t.dpDiv[0].classList.add("gform-legacy-datepicker"),d&&s&&(e=o(e).closest(".gfield"),e=o(document).outerWidth()-(e.offset().left+e.outerWidth()),t.dpDiv[0].style.right=e+"px"),s&&t.dpDiv[0].classList.add("gform-preview-datepicker"),!this.suppressDatePicker}})):e},-10);

View File

@@ -1 +1 @@
!function(c,p,t){function y(){var e=t.datepicker;return{dayNamesMin:[e.days.sunday,e.days.monday,e.days.tuesday,e.days.wednesday,e.days.thursday,e.days.friday,e.days.saturday],monthNamesShort:[e.months.january,e.months.february,e.months.march,e.months.april,e.months.may,e.months.june,e.months.july,e.months.august,e.months.september,e.months.october,e.months.november,e.months.december],firstDay:e.firstDay,iconText:e.iconText}}function a(e){var t,a,s,r,o,i,d,m=y(),n=e.attr("id")?e.attr("id"):"",h=(t=e,h=y(),a=0<t.closest(".gform_wrapper").length,s=0<c("#preview_form_container").length,r="rtl"===window.getComputedStyle(t[0],null).getPropertyValue("direction"),o=a?t.closest(".gform_wrapper").data("form-theme"):"gravity-theme",i=a?t.closest(".gform_wrapper").attr("id").replace("gform_wrapper_",""):"",d=a?t.closest(".gform_wrapper").attr("data-form-index"):"",{yearRange:"-100:+20",showOn:"focus",dateFormat:"mm/dd/yy",dayNamesMin:h.dayNamesMin,monthNamesShort:h.monthNamesShort,firstDay:h.firstDay,changeMonth:!0,changeYear:!0,isRTL:r,showOtherMonths:a,suppressDatePicker:!1,onClose:function(){var e=this;t.focus(),this.suppressDatePicker=!0,setTimeout(function(){e.suppressDatePicker=!1},200)},beforeShow:function(e,t){return t.dpDiv[0].classList.remove("gform-theme-datepicker"),t.dpDiv[0].classList.remove("gravity-theme"),t.dpDiv[0].classList.remove("gform-theme"),t.dpDiv[0].classList.remove("gform-legacy-datepicker"),t.dpDiv[0].classList.remove("gform-theme--framework"),t.dpDiv[0].classList.remove("gform-theme--foundation"),t.dpDiv[0].classList.remove("gform-theme--orbital"),a&&(t.dpDiv[0].classList.add("gform-theme-datepicker"),c(t.dpDiv[0]).attr("data-parent-form",i+"_"+d)),void 0===o||"gravity-theme"===o?c(t.dpDiv[0]).addClass("gravity-theme"):"legacy"===o?c(t.dpDiv[0]).addClass("gform-legacy-datepicker"):(c(t.dpDiv[0]).addClass("gform-theme--"+o),"orbital"===o&&(c(t.dpDiv[0]).addClass("gform-theme--framework"),c(t.dpDiv[0]).addClass("gform-theme--foundation"))),r&&s&&(e=c(e).closest(".gfield"),e=c(document).outerWidth()-(e.offset().left+e.outerWidth()),t.dpDiv[0].style.right=e+"px"),!this.suppressDatePicker}});e.hasClass("dmy")?h.dateFormat="dd/mm/yy":e.hasClass("dmy_dash")?h.dateFormat="dd-mm-yy":e.hasClass("dmy_dot")?h.dateFormat="dd.mm.yy":e.hasClass("ymd_slash")?h.dateFormat="yy/mm/dd":e.hasClass("ymd_dash")?h.dateFormat="yy-mm-dd":e.hasClass("ymd_dot")&&(h.dateFormat="yy.mm.dd"),e.hasClass("gdatepicker_with_icon")?(h.showOn="both",h.buttonImage=e.parent().siblings("[id^='gforms_calendar_icon_input']").val(),h.buttonImageOnly=!0,h.buttonText=m.iconText):h.showOn="focus",n=n.split("_"),h=p.applyFilters("gform_datepicker_options_pre_init",h,n[1],n[2],e),e.datepicker(h),e.is(":input")&&e.click(function(){e.datepicker("show")})}function e(){c(".gform-datepicker:not(.initialized)").each(function(){var e=c(this);a(e),e.addClass("initialized")})}c(document).ready(e),window.gformInitDatepicker=e,window.gformInitSingleDatepicker=a}(jQuery,gform,gform_i18n);
((c,p,t)=>{function y(){var e=t.datepicker;return{dayNamesMin:[e.days.sunday,e.days.monday,e.days.tuesday,e.days.wednesday,e.days.thursday,e.days.friday,e.days.saturday],monthNamesShort:[e.months.january,e.months.february,e.months.march,e.months.april,e.months.may,e.months.june,e.months.july,e.months.august,e.months.september,e.months.october,e.months.november,e.months.december],firstDay:e.firstDay,iconText:e.iconText}}function a(e){var t,a,s,r,o,i,d,m=y(),n=e.attr("id")?e.attr("id"):"",h=(t=e,h=y(),a=0<t.closest(".gform_wrapper").length,s=0<c("#preview_form_container").length,r="rtl"===window.getComputedStyle(t[0],null).getPropertyValue("direction"),o=a?t.closest(".gform_wrapper").data("form-theme"):"gravity-theme",i=a?t.closest(".gform_wrapper").attr("id").replace("gform_wrapper_",""):"",d=a?t.closest(".gform_wrapper").attr("data-form-index"):"",{yearRange:"-100:+20",showOn:"focus",dateFormat:"mm/dd/yy",dayNamesMin:h.dayNamesMin,monthNamesShort:h.monthNamesShort,firstDay:h.firstDay,changeMonth:!0,changeYear:!0,isRTL:r,showOtherMonths:a,suppressDatePicker:!1,onClose:function(){var e=this;t.focus(),this.suppressDatePicker=!0,setTimeout(function(){e.suppressDatePicker=!1},200)},beforeShow:function(e,t){return t.dpDiv[0].classList.remove("gform-theme-datepicker"),t.dpDiv[0].classList.remove("gravity-theme"),t.dpDiv[0].classList.remove("gform-theme"),t.dpDiv[0].classList.remove("gform-legacy-datepicker"),t.dpDiv[0].classList.remove("gform-theme--framework"),t.dpDiv[0].classList.remove("gform-theme--foundation"),t.dpDiv[0].classList.remove("gform-theme--orbital"),a&&(t.dpDiv[0].classList.add("gform-theme-datepicker"),c(t.dpDiv[0]).attr("data-parent-form",i+"_"+d)),void 0===o||"gravity-theme"===o?c(t.dpDiv[0]).addClass("gravity-theme"):"legacy"===o?c(t.dpDiv[0]).addClass("gform-legacy-datepicker"):(c(t.dpDiv[0]).addClass("gform-theme--"+o),"orbital"===o&&(c(t.dpDiv[0]).addClass("gform-theme--framework"),c(t.dpDiv[0]).addClass("gform-theme--foundation"))),r&&s&&(e=c(e).closest(".gfield"),e=c(document).outerWidth()-(e.offset().left+e.outerWidth()),t.dpDiv[0].style.right=e+"px"),!this.suppressDatePicker}});e.hasClass("dmy")?h.dateFormat="dd/mm/yy":e.hasClass("dmy_dash")?h.dateFormat="dd-mm-yy":e.hasClass("dmy_dot")?h.dateFormat="dd.mm.yy":e.hasClass("ymd_slash")?h.dateFormat="yy/mm/dd":e.hasClass("ymd_dash")?h.dateFormat="yy-mm-dd":e.hasClass("ymd_dot")&&(h.dateFormat="yy.mm.dd"),e.hasClass("gdatepicker_with_icon")?(h.showOn="both",h.buttonImage=e.parent().siblings("[id^='gforms_calendar_icon_input']").val(),h.buttonImageOnly=!0,h.buttonText=m.iconText):h.showOn="focus",n=n.split("_"),h=p.applyFilters("gform_datepicker_options_pre_init",h,n[1],n[2],e),e.datepicker(h),e.is(":input")&&e.click(function(){e.datepicker("show")})}function e(){c(".gform-datepicker:not(.initialized)").each(function(){var e=c(this);a(e),e.addClass("initialized")})}c(document).ready(e),window.gformInitDatepicker=e,window.gformInitSingleDatepicker=a})(jQuery,gform,gform_i18n);

View File

@@ -1 +1 @@
!function(){function r(i,t,n){for(var a=(n=n.split("#"))[1]?"#"+n[1]:"",o=(n=n[0].split("?"))[0],e=void 0!==(n=n[1])?n.split("&"):[],r=!1,s=0;s<e.length;s++)e[s].startsWith(i+"=")&&(0<t.length?e[s]=i+"="+t:e.splice(s,1),r=!0);return!r&&0<t.length&&(e[e.length]=i+"="+t),o+"?"+e.join("&")+a}var s=window.gf_duplicate_submissions||{},i=function(){var i,t,n,a,o=r(s.safari_redirect_param,"",window.location.href),e=r(s.safari_redirect_param,"1",window.location.href);return console.log(o,e),i=window.navigator.userAgent,t=!!i.match(/iP(ad|od|hone)/i),n=!!i.match(/Safari/i),a=!i.match(/Chrome|CriOS|OPiOS|mercury|FxiOS|Firefox/i),(t?!!i.match(/WebKit/i)&&n&&a:void 0!==window.safari||n&&a)?e:o};!window.gf_duplicate_submissions_initialized&&"1"===s.is_gf_submission&&window.history.replaceState&&(window.gf_duplicate_submissions_initialized=!0,window.history.replaceState(null,null,i()))}();
(()=>{var n=window.gf_duplicate_submissions||{},a=function(){var i=window.navigator.userAgent,t=!!i.match(/iP(ad|od|hone)/i),n=!!i.match(/Safari/i),a=!i.match(/Chrome|CriOS|OPiOS|mercury|FxiOS|Firefox/i);return t?!!i.match(/WebKit/i)&&n&&a:void 0!==window.safari||n&&a},r=function(i,t,n){for(var n=n.split("#"),a=n[1]?"#"+n[1]:"",n=n[0].split("?"),r=n[0],n=n[1],o=void 0!==n?n.split("&"):[],e=!1,s=0;s<o.length;s++)o[s].startsWith(i+"=")&&(0<t.length?o[s]=i+"="+t:o.splice(s,1),e=!0);return!e&&0<t.length&&(o[o.length]=i+"="+t),r+"?"+o.join("&")+a},i=function(){var i=r(n.safari_redirect_param,"",window.location.href),t=r(n.safari_redirect_param,"1",window.location.href);return console.log(i,t),a()?t:i};!window.gf_duplicate_submissions_initialized&&"1"===n.is_gf_submission&&window.history.replaceState&&(window.gf_duplicate_submissions_initialized=!0,window.history.replaceState(null,null,i()))})();

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -5,20 +5,45 @@
if ( ! gform ) {
document.addEventListener( 'gform_main_scripts_loaded', function() { gform.scriptsLoaded = true; } );
document.addEventListener( 'gform/theme/scripts_loaded', function() { gform.themeScriptsLoaded = true; } );
window.addEventListener( 'DOMContentLoaded', function() { gform.domLoaded = true; } );
var gform = {
domLoaded: false,
scriptsLoaded: false,
initializeOnLoaded: function( fn ) {
if ( gform.domLoaded && gform.scriptsLoaded ) {
themeScriptsLoaded: false,
isFormEditor: () => typeof InitializeEditor === 'function',
/**
* @deprecated 2.9 the use of initializeOnLoaded in the form editor context is deprecated.
* @remove-in 3.1 this function will not check for gform.isFormEditor().
*/
callIfLoaded: function ( fn ) {
if ( gform.domLoaded && gform.scriptsLoaded && ( gform.themeScriptsLoaded || gform.isFormEditor() ) ) {
if ( gform.isFormEditor() ) {
console.warn( 'The use of gform.initializeOnLoaded() is deprecated in the form editor context and will be removed in Gravity Forms 3.1.' );
}
fn();
} else if( ! gform.domLoaded && gform.scriptsLoaded ) {
window.addEventListener( 'DOMContentLoaded', fn );
} else {
document.addEventListener( 'gform_main_scripts_loaded', fn );
return true;
}
return false;
},
/**
* Call a function when all scripts are loaded
*
* @param function fn the callback function to call when all scripts are loaded
*
* @returns void
*/
initializeOnLoaded: function( fn ) {
if ( ! gform.callIfLoaded( fn ) ) {
document.addEventListener( 'gform_main_scripts_loaded', () => { gform.scriptsLoaded = true; gform.callIfLoaded( fn ); } );
document.addEventListener( 'gform/theme/scripts_loaded', () => { gform.themeScriptsLoaded = true; gform.callIfLoaded( fn ); } );
window.addEventListener( 'DOMContentLoaded', () => { gform.domLoaded = true; gform.callIfLoaded( fn ); } );
}
},
hooks: { action: {}, filter: {} },
addAction: function( action, callable, priority, tag ) {
gform.addHook( 'action', action, callable, priority, tag );

View File

@@ -1 +1 @@
var gform;gform||(document.addEventListener("gform_main_scripts_loaded",function(){gform.scriptsLoaded=!0}),window.addEventListener("DOMContentLoaded",function(){gform.domLoaded=!0}),gform={domLoaded:!1,scriptsLoaded:!1,initializeOnLoaded:function(o){gform.domLoaded&&gform.scriptsLoaded?o():!gform.domLoaded&&gform.scriptsLoaded?window.addEventListener("DOMContentLoaded",o):document.addEventListener("gform_main_scripts_loaded",o)},hooks:{action:{},filter:{}},addAction:function(o,n,r,t){gform.addHook("action",o,n,r,t)},addFilter:function(o,n,r,t){gform.addHook("filter",o,n,r,t)},doAction:function(o){gform.doHook("action",o,arguments)},applyFilters:function(o){return gform.doHook("filter",o,arguments)},removeAction:function(o,n){gform.removeHook("action",o,n)},removeFilter:function(o,n,r){gform.removeHook("filter",o,n,r)},addHook:function(o,n,r,t,i){null==gform.hooks[o][n]&&(gform.hooks[o][n]=[]);var e=gform.hooks[o][n];null==i&&(i=n+"_"+e.length),gform.hooks[o][n].push({tag:i,callable:r,priority:t=null==t?10:t})},doHook:function(n,o,r){var t;if(r=Array.prototype.slice.call(r,1),null!=gform.hooks[n][o]&&((o=gform.hooks[n][o]).sort(function(o,n){return o.priority-n.priority}),o.forEach(function(o){"function"!=typeof(t=o.callable)&&(t=window[t]),"action"==n?t.apply(null,r):r[0]=t.apply(null,r)})),"filter"==n)return r[0]},removeHook:function(o,n,t,i){var r;null!=gform.hooks[o][n]&&(r=(r=gform.hooks[o][n]).filter(function(o,n,r){return!!(null!=i&&i!=o.tag||null!=t&&t!=o.priority)}),gform.hooks[o][n]=r)}});
var gform;gform||(document.addEventListener("gform_main_scripts_loaded",function(){gform.scriptsLoaded=!0}),document.addEventListener("gform/theme/scripts_loaded",function(){gform.themeScriptsLoaded=!0}),window.addEventListener("DOMContentLoaded",function(){gform.domLoaded=!0}),gform={domLoaded:!1,scriptsLoaded:!1,themeScriptsLoaded:!1,isFormEditor:()=>"function"==typeof InitializeEditor,callIfLoaded:function(o){return!(!gform.domLoaded||!gform.scriptsLoaded||!gform.themeScriptsLoaded&&!gform.isFormEditor()||(gform.isFormEditor()&&console.warn("The use of gform.initializeOnLoaded() is deprecated in the form editor context and will be removed in Gravity Forms 3.1."),o(),0))},initializeOnLoaded:function(o){gform.callIfLoaded(o)||(document.addEventListener("gform_main_scripts_loaded",()=>{gform.scriptsLoaded=!0,gform.callIfLoaded(o)}),document.addEventListener("gform/theme/scripts_loaded",()=>{gform.themeScriptsLoaded=!0,gform.callIfLoaded(o)}),window.addEventListener("DOMContentLoaded",()=>{gform.domLoaded=!0,gform.callIfLoaded(o)}))},hooks:{action:{},filter:{}},addAction:function(o,r,e,t){gform.addHook("action",o,r,e,t)},addFilter:function(o,r,e,t){gform.addHook("filter",o,r,e,t)},doAction:function(o){gform.doHook("action",o,arguments)},applyFilters:function(o){return gform.doHook("filter",o,arguments)},removeAction:function(o,r){gform.removeHook("action",o,r)},removeFilter:function(o,r,e){gform.removeHook("filter",o,r,e)},addHook:function(o,r,e,t,n){null==gform.hooks[o][r]&&(gform.hooks[o][r]=[]);var d=gform.hooks[o][r];null==n&&(n=r+"_"+d.length),gform.hooks[o][r].push({tag:n,callable:e,priority:t=null==t?10:t})},doHook:function(r,o,e){var t;if(e=Array.prototype.slice.call(e,1),null!=gform.hooks[r][o]&&((o=gform.hooks[r][o]).sort(function(o,r){return o.priority-r.priority}),o.forEach(function(o){"function"!=typeof(t=o.callable)&&(t=window[t]),"action"==r?t.apply(null,e):e[0]=t.apply(null,e)})),"filter"==r)return e[0]},removeHook:function(o,r,t,n){var e;null!=gform.hooks[o][r]&&(e=(e=gform.hooks[o][r]).filter(function(o,r,e){return!!(null!=n&&n!=o.tag||null!=t&&t!=o.priority)}),gform.hooks[o][r]=e)}});

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
!function($){"use strict";var escape=/["\\\x00-\x1f\x7f-\x9f]/g,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},hasOwn=Object.prototype.hasOwnProperty;$.toJSON="object"==typeof JSON&&JSON.stringify?JSON.stringify:function(t){if(null===t)return"null";var e,r,n,o,i,f,u=$.type(t);if("undefined"!==u){if("number"===u||"boolean"===u)return String(t);if("string"===u)return $.quoteString(t);if("function"==typeof t.toJSON)return $.toJSON(t.toJSON());if("date"===u)return i=t.getUTCMonth()+1,f=t.getUTCDate(),'"'+t.getUTCFullYear()+"-"+(i=i<10?"0"+i:i)+"-"+(f=f<10?"0"+f:f)+"T"+(i=(i=t.getUTCHours())<10?"0"+i:i)+":"+(f=(f=t.getUTCMinutes())<10?"0"+f:f)+":"+(i=(i=t.getUTCSeconds())<10?"0"+i:i)+"."+(f=(f=(f=t.getUTCMilliseconds())<100?"0"+f:f)<10?"0"+f:f)+'Z"';if(e=[],$.isArray(t)){for(r=0;r<t.length;r++)e.push($.toJSON(t[r])||"null");return"["+e.join(",")+"]"}if("object"==typeof t){for(r in t)if(hasOwn.call(t,r)){if("number"===(u=typeof r))n='"'+r+'"';else{if("string"!==u)continue;n=$.quoteString(r)}"function"!==(u=typeof t[r])&&"undefined"!==u&&(o=$.toJSON(t[r]),e.push(n+":"+o))}return"{"+e.join(",")+"}"}}},$.evalJSON="object"==typeof JSON&&JSON.parse?JSON.parse:function(str){return eval("("+str+")")},$.secureEvalJSON="object"==typeof JSON&&JSON.parse?JSON.parse:function(str){var filtered=str.replace(/\\["\\\/bfnrtu]/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"");if(/^[\],:{}\s]*$/.test(filtered))return eval("("+str+")");throw new SyntaxError("Error parsing JSON, source is not valid.")},$.quoteString=function(t){return t.match(escape)?'"'+t.replace(escape,function(t){var e=meta[t];return"string"==typeof e?e:(e=t.charCodeAt(),"\\u00"+Math.floor(e/16).toString(16)+(e%16).toString(16))})+'"':'"'+t+'"'}}(jQuery);
!function($){var escape=/["\\\x00-\x1f\x7f-\x9f]/g,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},hasOwn=Object.prototype.hasOwnProperty;$.toJSON="object"==typeof JSON&&JSON.stringify?JSON.stringify:function(t){if(null===t)return"null";var e,r,n,o,i,f,u=$.type(t);if("undefined"!==u){if("number"===u||"boolean"===u)return String(t);if("string"===u)return $.quoteString(t);if("function"==typeof t.toJSON)return $.toJSON(t.toJSON());if("date"===u)return i=t.getUTCMonth()+1,f=t.getUTCDate(),'"'+t.getUTCFullYear()+"-"+(i=i<10?"0"+i:i)+"-"+(f=f<10?"0"+f:f)+"T"+(i=(i=t.getUTCHours())<10?"0"+i:i)+":"+(f=(f=t.getUTCMinutes())<10?"0"+f:f)+":"+(i=(i=t.getUTCSeconds())<10?"0"+i:i)+"."+(f=(f=(f=t.getUTCMilliseconds())<100?"0"+f:f)<10?"0"+f:f)+'Z"';if(e=[],$.isArray(t)){for(r=0;r<t.length;r++)e.push($.toJSON(t[r])||"null");return"["+e.join(",")+"]"}if("object"==typeof t){for(r in t)if(hasOwn.call(t,r)){if("number"===(u=typeof r))n='"'+r+'"';else{if("string"!==u)continue;n=$.quoteString(r)}"function"!==(u=typeof t[r])&&"undefined"!==u&&(o=$.toJSON(t[r]),e.push(n+":"+o))}return"{"+e.join(",")+"}"}}},$.evalJSON="object"==typeof JSON&&JSON.parse?JSON.parse:function(str){return eval("("+str+")")},$.secureEvalJSON="object"==typeof JSON&&JSON.parse?JSON.parse:function(str){var filtered=str.replace(/\\["\\\/bfnrtu]/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"");if(/^[\],:{}\s]*$/.test(filtered))return eval("("+str+")");throw new SyntaxError("Error parsing JSON, source is not valid.")},$.quoteString=function(t){return t.match(escape)?'"'+t.replace(escape,function(t){var e=meta[t];return"string"==typeof e?e:(e=t.charCodeAt(),"\\u00"+Math.floor(e/16).toString(16)+(e%16).toString(16))})+'"':'"'+t+'"'}}(jQuery);

View File

@@ -1 +1 @@
!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?e(require("jquery")):e(jQuery)}(function(A){var a,e=navigator.userAgent,R=/iphone/i.test(e),S=/chrome/i.test(e),T=/android/i.test(e);A.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},A.fn.extend({caret:function(e,t){var n;if(0!==this.length&&!this.is(":hidden")&&this.get(0)===document.activeElement)return"number"==typeof e?(t="number"==typeof t?t:e,this.each(function(){this.setSelectionRange?this.setSelectionRange(e,t):this.createTextRange&&((n=this.createTextRange()).collapse(!0),n.moveEnd("character",t),n.moveStart("character",e),n.select())})):(this[0].setSelectionRange?(e=this[0].selectionStart,t=this[0].selectionEnd):document.selection&&document.selection.createRange&&(n=document.selection.createRange(),e=0-n.duplicate().moveStart("character",-1e5),t=e+n.text.length),{begin:e,end:t})},unmask:function(){return this.trigger("unmask")},mask:function(t,l){var n,b,u,k,y,x,j,e;return!t&&0<this.length?(e=A(this[0]).data(A.mask.dataName))?e():void 0:(l=A.extend({autoclear:A.mask.autoclear,placeholder:A.mask.placeholder,completed:null},l),n=A.mask.definitions,b=[],u=x=t.length,k=null,t=String(t),A.each(t.split(""),function(e,t){"?"==t?(x--,u=e):n[t]?(b.push(new RegExp(n[t])),null===k&&(k=b.length-1),e<u&&(y=b.length-1)):b.push(null)}),this.trigger("unmask").each(function(){var f=A(this),s=A.map(t.split(""),function(e,t){if("?"!=e)return n[e]?g(t):e}),o=s.join(""),i=f.val();function h(){if(l.completed){for(var e=k;e<=y;e++)if(b[e]&&s[e]===g(e))return;l.completed.call(f)}}function g(e){return e<l.placeholder.length?l.placeholder.charAt(e):l.placeholder.charAt(0)}function m(e){for(;++e<x&&!b[e];);return e}function d(e,t){var n,a;if(!(e<0)){for(n=e,a=m(t);n<x;n++)if(b[n]){if(!(a<x&&b[n].test(s[a])))break;s[n]=s[a],s[a]=g(a),a=m(a)}v(),f.caret(Math.max(k,e))}}function r(e){c(),f.val()!=i&&f.change()}function p(e,t){for(var n=e;n<t&&n<x;n++)b[n]&&(s[n]=g(n))}function v(){f.val(s.join(""))}function c(e){for(var t,n=f.val(),a=-1,i=0,r=0;i<x;i++)if(b[i]){for(s[i]=g(i);r++<n.length;)if(t=n.charAt(r-1),b[i].test(t)){s[i]=t,a=i;break}if(r>n.length){p(i+1,x);break}}else s[i]===n.charAt(r)&&r++,i<u&&(a=i);return e?v():a+1<u?l.autoclear||s.join("")===o?(f.val()&&f.val(""),p(0,x)):v():(v(),f.val(f.val().substring(0,a+1))),u?i:k}f.data(A.mask.dataName,function(){return A.map(s,function(e,t){return b[t]&&e!=g(t)?e:null}).join("")}),f.one("unmask",function(){f.off(".mask").removeData(A.mask.dataName)}).on("focus.mask",function(){var e;f.prop("readonly")||(clearTimeout(a),i=f.val(),e=c(),a=setTimeout(function(){f.get(0)===document.activeElement&&(v(),e==t.replace("?","").length?f.caret(0,e):f.caret(e))},10))}).on("blur.mask",r).on("keydown.mask",function(e){var t,n,a;f.prop("readonly")||(t=e.which||e.keyCode,j=f.val(),8===t||46===t||R&&127===t?(n=(a=f.caret()).begin,(a=a.end)-n==0&&(n=46!==t?function(e){for(;0<=--e&&!b[e];);return e}(n):a=m(n-1),a=46===t?m(a):a),p(n,a),d(n,a-1),e.preventDefault()):13===t?r.call(this,e):27===t&&(f.val(i),f.caret(0,c()),e.preventDefault()))}).on("keypress.mask",function(e){if(!f.prop("readonly")){var t,n,a,i=e.which||e.keyCode,r=f.caret();if(!(e.ctrlKey||e.altKey||e.metaKey||i<32)&&i&&13!==i){if(r.end-r.begin!=0&&(p(r.begin,r.end),d(r.begin,r.end-1)),(t=m(r.begin-1))<x&&(n=String.fromCharCode(i),b[t].test(n))){for(var o,c,l=t,u=g(t);l<x;l++)if(b[l]){if(o=m(l),c=s[l],s[l]=u,!(o<x&&b[o].test(c)))break;u=c}s[t]=n,v(),a=m(t),T?setTimeout(function(){A.proxy(A.fn.caret,f,a)()},0):f.caret(a),r.begin<=y&&h()}e.preventDefault()}}}).on("input.mask paste.mask",function(){f.prop("readonly")||setTimeout(function(){var e=c(!0);f.caret(e),h()},0)}),S&&T&&f.off("input.mask").on("input.mask",function(e){function t(){A.proxy(A.fn.caret,f,a.begin,a.begin)()}var n=f.val(),a=f.caret();if(j&&j.length&&j.length>n.length){for(c(!0);0<a.begin&&!b[a.begin-1];)a.begin--;if(0===a.begin)for(;a.begin<k&&!b[a.begin];)a.begin++}else{var i=c(!0),n=n.charAt(a.begin);a.begin<x&&(b[a.begin]?b[a.begin].test(n)&&a.begin++:a.begin=i)}setTimeout(t,0),h()}),c()}))}})});
(e=>{"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?e(require("jquery")):e(jQuery)})(function(A){var a,e=navigator.userAgent,R=/iphone/i.test(e),S=/chrome/i.test(e),T=/android/i.test(e);A.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},A.fn.extend({caret:function(e,t){var n;if(0!==this.length&&!this.is(":hidden")&&this.get(0)===document.activeElement)return"number"==typeof e?(t="number"==typeof t?t:e,this.each(function(){this.setSelectionRange?this.setSelectionRange(e,t):this.createTextRange&&((n=this.createTextRange()).collapse(!0),n.moveEnd("character",t),n.moveStart("character",e),n.select())})):(this[0].setSelectionRange?(e=this[0].selectionStart,t=this[0].selectionEnd):document.selection&&document.selection.createRange&&(n=document.selection.createRange(),e=0-n.duplicate().moveStart("character",-1e5),t=e+n.text.length),{begin:e,end:t})},unmask:function(){return this.trigger("unmask")},mask:function(t,l){var n,b,u,k,y,x,j,e;return!t&&0<this.length?(e=A(this[0]).data(A.mask.dataName))?e():void 0:(l=A.extend({autoclear:A.mask.autoclear,placeholder:A.mask.placeholder,completed:null},l),n=A.mask.definitions,b=[],u=x=t.length,k=null,t=String(t),A.each(t.split(""),function(e,t){"?"==t?(x--,u=e):n[t]?(b.push(new RegExp(n[t])),null===k&&(k=b.length-1),e<u&&(y=b.length-1)):b.push(null)}),this.trigger("unmask").each(function(){var s=A(this),f=A.map(t.split(""),function(e,t){if("?"!=e)return n[e]?g(t):e}),o=f.join(""),i=s.val();function h(){if(l.completed){for(var e=k;e<=y;e++)if(b[e]&&f[e]===g(e))return;l.completed.call(s)}}function g(e){return e<l.placeholder.length?l.placeholder.charAt(e):l.placeholder.charAt(0)}function m(e){for(;++e<x&&!b[e];);return e}function d(e,t){var n,a;if(!(e<0)){for(n=e,a=m(t);n<x;n++)if(b[n]){if(!(a<x&&b[n].test(f[a])))break;f[n]=f[a],f[a]=g(a),a=m(a)}v(),s.caret(Math.max(k,e))}}function r(e){c(),s.val()!=i&&s.change()}function p(e,t){for(var n=e;n<t&&n<x;n++)b[n]&&(f[n]=g(n))}function v(){s.val(f.join(""))}function c(e){for(var t,n=s.val(),a=-1,i=0,r=0;i<x;i++)if(b[i]){for(f[i]=g(i);r++<n.length;)if(t=n.charAt(r-1),b[i].test(t)){f[i]=t,a=i;break}if(r>n.length){p(i+1,x);break}}else f[i]===n.charAt(r)&&r++,i<u&&(a=i);return e?v():a+1<u?l.autoclear||f.join("")===o?(s.val()&&s.val(""),p(0,x)):v():(v(),s.val(s.val().substring(0,a+1))),u?i:k}s.data(A.mask.dataName,function(){return A.map(f,function(e,t){return b[t]&&e!=g(t)?e:null}).join("")}),s.one("unmask",function(){s.off(".mask").removeData(A.mask.dataName)}).on("focus.mask",function(){var e;s.prop("readonly")||(clearTimeout(a),i=s.val(),e=c(),a=setTimeout(function(){s.get(0)===document.activeElement&&(v(),e==t.replace("?","").length?s.caret(0,e):s.caret(e))},10))}).on("blur.mask",r).on("keydown.mask",function(e){var t,n,a;s.prop("readonly")||(t=e.which||e.keyCode,j=s.val(),8===t||46===t||R&&127===t?(n=(a=s.caret()).begin,(a=a.end)-n==0&&(n=46!==t?(e=>{for(;0<=--e&&!b[e];);return e})(n):a=m(n-1),a=46===t?m(a):a),p(n,a),d(n,a-1),e.preventDefault()):13===t?r.call(this,e):27===t&&(s.val(i),s.caret(0,c()),e.preventDefault()))}).on("keypress.mask",function(e){if(!s.prop("readonly")){var t,n,a,i=e.which||e.keyCode,r=s.caret();if(!(e.ctrlKey||e.altKey||e.metaKey||i<32)&&i&&13!==i){if(r.end-r.begin!=0&&(p(r.begin,r.end),d(r.begin,r.end-1)),(t=m(r.begin-1))<x&&(n=String.fromCharCode(i),b[t].test(n))){for(var o,c,l=t,u=g(t);l<x;l++)if(b[l]){if(o=m(l),c=f[l],f[l]=u,!(o<x&&b[o].test(c)))break;u=c}f[t]=n,v(),a=m(t),T?setTimeout(function(){A.proxy(A.fn.caret,s,a)()},0):s.caret(a),r.begin<=y&&h()}e.preventDefault()}}}).on("input.mask paste.mask",function(){s.prop("readonly")||setTimeout(function(){var e=c(!0);s.caret(e),h()},0)}),S&&T&&s.off("input.mask").on("input.mask",function(e){function t(){A.proxy(A.fn.caret,s,a.begin,a.begin)()}var n=s.val(),a=s.caret();if(j&&j.length&&j.length>n.length){for(c(!0);0<a.begin&&!b[a.begin-1];)a.begin--;if(0===a.begin)for(;a.begin<k&&!b[a.begin];)a.begin++}else{var i=c(!0),n=n.charAt(a.begin);a.begin<x&&(b[a.begin]?b[a.begin].test(n)&&a.begin++:a.begin=i)}setTimeout(t,0),h()}),c()}))}})});

View File

@@ -1 +1 @@
!function(t){t.fn.textareaCount=function(i,r){var o,l=t(this),c=0,u=i.maxCharacterSize,s=0,f=0,h={};function d(r){for(var a=0,e=0;e<r.length;e++)"\n"===r.charAt(e)&&a++;return a}function p(){return-1!==navigator.appVersion.toLowerCase().indexOf("win")}function g(r){return(r+" ").replace(/^[^A-Za-z0-9]+/gi,"").replace(/[^A-Za-z0-9]+/gi," ").split(" ")}function m(r){return r.length-1}function a(){var r,a,e,t=l.val(),n=("function"==typeof i.charCounter?i.charCounter:h[i.charCounter])(t);return 0<i.maxCharacterSize?(r=d(t=i.truncate&&n>=i.maxCharacterSize?t.substring(0,i.maxCharacterSize):t),a=i.maxCharacterSize,p()&&(a=i.maxCharacterSize-r),i.truncate&&a<n&&(e=this.scrollTop,l.val(t.substring(0,a)),this.scrollTop=e),o.removeClass(i.warningStyle+" "+i.errorStyle),a-n<=i.warningNumber&&o.addClass(i.warningStyle),a-n<0&&o.addClass(i.errorStyle),c=n,p()&&(c=n+r),f=m(g(l.val())),s=u-c):(r=d(t),c=n,p()&&(c=n+r),f=m(g(l.val()))),e=(e=(e=i.displayFormat).replace("#input",c)).replace("#words",f),e=0<u?(e=e.replace("#max",u)).replace("#left",s):e}function e(){o.html(a()),void 0!==r&&r.call(this,{input:c,max:u,left:s,words:f})}h.standard=function(r){return r.length},h.twitter=function(r){var a=Array(23).join("*"),e=new RegExp("(https?://)?([a-z0-9+!*(),;?&=$_.-]+(:[a-z0-9+!*(),;?&=$_.-]+)?@)?([a-z0-9-.]*)\\.(travel|museum|[a-z]{2,4})(:[0-9]{2,5})?(/([a-z0-9+$_-]\\.?)+)*/?(\\?[a-z+&$_.-][a-z0-9;:@&%=+/$_.-]*)?(#[a-z_.-][a-z0-9+$_.-]*)?","gi");return r.replace(e,a).length},i=t.extend({maxCharacterSize:-1,truncate:!0,charCounter:"standard",originalStyle:"originalTextareaInfo",warningStyle:"warningTextareaInfo",errorStyle:"errorTextareaInfo",warningNumber:20,displayFormat:"#input characters | #words words"},i),t("<div class='charleft'>&nbsp;</div>").insertAfter(l),(o=l.next(".charleft")).addClass(i.originalStyle),e(),l.bind("keyup",function(){e()}).bind("mouseover paste",function(){setTimeout(function(){e()},10)})}}(jQuery);
(t=>{t.fn.textareaCount=function(i,r){var o,l=t(this),c=0,u=i.maxCharacterSize,s=0,f=0,h={};function d(r){for(var a=0,e=0;e<r.length;e++)"\n"===r.charAt(e)&&a++;return a}function p(){return-1!==navigator.appVersion.toLowerCase().indexOf("win")}function g(r){return(r+" ").replace(/^[^A-Za-z0-9]+/gi,"").replace(/[^A-Za-z0-9]+/gi," ").split(" ")}function m(r){return r.length-1}function a(){var r,a,e,t=l.val(),n=("function"==typeof i.charCounter?i.charCounter:h[i.charCounter])(t);return 0<i.maxCharacterSize?(r=d(t=i.truncate&&n>=i.maxCharacterSize?t.substring(0,i.maxCharacterSize):t),a=i.maxCharacterSize,p()&&(a=i.maxCharacterSize-r),i.truncate&&a<n&&(e=this.scrollTop,l.val(t.substring(0,a)),this.scrollTop=e),o.removeClass(i.warningStyle+" "+i.errorStyle),a-n<=i.warningNumber&&o.addClass(i.warningStyle),a-n<0&&o.addClass(i.errorStyle),c=n,p()&&(c=n+r),f=m(g(l.val())),s=u-c):(r=d(t),c=n,p()&&(c=n+r),f=m(g(l.val()))),e=(e=(e=i.displayFormat).replace("#input",c)).replace("#words",f),e=0<u?(e=e.replace("#max",u)).replace("#left",s):e}function e(){o.html(a()),void 0!==r&&r.call(this,{input:c,max:u,left:s,words:f})}h.standard=function(r){return r.length},h.twitter=function(r){var a=Array(23).join("*"),e=new RegExp("(https?://)?([a-z0-9+!*(),;?&=$_.-]+(:[a-z0-9+!*(),;?&=$_.-]+)?@)?([a-z0-9-.]*)\\.(travel|museum|[a-z]{2,4})(:[0-9]{2,5})?(/([a-z0-9+$_-]\\.?)+)*/?(\\?[a-z+&$_.-][a-z0-9;:@&%=+/$_.-]*)?(#[a-z_.-][a-z0-9+$_.-]*)?","gi");return r.replace(e,a).length},i=t.extend({maxCharacterSize:-1,truncate:!0,charCounter:"standard",originalStyle:"originalTextareaInfo",warningStyle:"warningTextareaInfo",errorStyle:"errorTextareaInfo",warningNumber:20,displayFormat:"#input characters | #words words"},i),t("<div class='charleft'>&nbsp;</div>").insertAfter(l),(o=l.next(".charleft")).addClass(i.originalStyle),e(),l.bind("keyup",function(){e()}).bind("mouseover paste",function(){setTimeout(function(){e()},10)})}})(jQuery);

View File

@@ -8,7 +8,6 @@ function initLayoutEditor( $ ) {
* @returns {jQuery}
*/
$.fn.setGroupId = function ( groupId ) {
this.attr( 'data-groupId', groupId );
this.each( function () {
@@ -184,7 +183,7 @@ function initLayoutEditor( $ ) {
$field.setGroupId( getGroupId() );
// If the submit button is inline, move it back to its own row
if( jQuery('#field_submit').data( 'field-position' ) == 'inline' ) {
if( jQuery('#field_submit').attr( 'data-field-position' ) == 'inline' ) {
moveButtonToBottom();
}
@@ -266,6 +265,10 @@ function initLayoutEditor( $ ) {
initElement( $( '#field_' + fieldId ) );
} );
gform.addAction( 'gform_after_change_input_type', function( fieldId ) {
initElement( $( '#field_' + fieldId ) );
} );
gform.addAction( 'gform_form_saving_action_element_after_reload', function( form, event, newElement, elementReloadId, existingElement ) {
if ( $( newElement ).hasClass( 'gfield' ) ) {
initElement( $( '[data-js-reload="' + elementReloadId + '"]' ) );
@@ -631,7 +634,7 @@ function initLayoutEditor( $ ) {
* @since 2.6
*/
function setSubmitButtonGroup() {
if ( $( '#field_submit' ).data( 'field-position') === 'inline' ) {
if ( $( '#field_submit' ).attr( 'data-field-position') === 'inline' ) {
// Find the last group id.
var lastGroup = jQuery( '#field_submit' ).prev().attr( 'data-groupid' );
// Move the submit button to the group.
@@ -671,6 +674,8 @@ function initLayoutEditor( $ ) {
return false;
}
ui.helper.addClass( 'gform-theme__disable' );
// Match the helper to the current elements size.
ui.helper
.width( $( this ).width() )
@@ -679,7 +684,6 @@ function initLayoutEditor( $ ) {
$container.addClass( 'dragging' );
$elem = $( this ).clone();
$elem.addClass( 'placeholder' );
$( this ).addClass( 'fieldPlaceholder' );
},
drag: function( event, ui ) {
@@ -689,19 +693,19 @@ function initLayoutEditor( $ ) {
}
/**
* New field buttons are dragged relative to #wpbody so their position needs to be adjusted to work the
* New field buttons are dragged relative to #wpbody so their position needs to be adjusted to work
* the same way as dragging an existing field (which is relative to #gform_fields).
*/
var helperTop = ui.position.top - 0 + ( ui.helper.outerHeight() / 2 ),
helperLeft = ui.position.left - 0 + ( ui.helper.outerWidth() / 2 );
handleDrag( event, ui, helperTop, helperLeft );
},
stop: function( event, ui ) {
$( this ).removeClass( 'fieldPlaceholder' );
$editorContainer.removeClass( 'droppable' );
$container.removeClass( 'dragging' );
ui.helper.removeClass( 'gform-theme__disable' );
var isAddingField = false;
@@ -740,16 +744,31 @@ function initLayoutEditor( $ ) {
$elements().removeClass( 'hovering' );
if ( ! isInEditorArea( helperLeft, helperTop ) ) {
var isCompactView = $( '.gform-compact-view' ).length > 0;
if ( ! isInEditorArea( helperLeft, helperTop, isCompactView ) ) {
$indicator( false ).remove();
return;
}
// drop indicator is a different distance from field in compact view.
if ( isCompactView ) {
var topDistanceAllFields = -9;
var topDistance = 9;
var bottomDistance = 5;
var bottomDistanceAllFields = 5;
} else {
var topDistanceAllFields = -10;
var topDistance = 10;
var bottomDistance = 0;
var bottomDistanceAllFields = 0;
}
// Check if field is dragged *above* all other fields.
if ( helperTop < 0 ) {
$indicator()
.css( {
top: -30,
top: topDistanceAllFields,
left: 0,
height: '4px',
width: $container.outerWidth()
@@ -765,7 +784,7 @@ function initLayoutEditor( $ ) {
if ( $elements().last().data( 'field-class' ) !== 'gform_editor_submit_container' && $elements().last().prev().data( 'field-class' ) !== 'gform_editor_submit_container' ) {
$indicator()
.css( {
top: $container.outerHeight() - 14,
top: $container.outerHeight() - bottomDistanceAllFields,
left: 0,
height: '4px',
width: $container.outerWidth()
@@ -848,15 +867,6 @@ function initLayoutEditor( $ ) {
target: $target
} );
// drop indicator is a different distance from field in compact view.
if ( $target.parents( '.gform-compact-view' ).length > 0 ) {
var topDistance = 10;
var bottomDistance = 6;
} else {
var topDistance = 30;
var bottomDistance = 26;
}
// Where on the child field has the helper been dragged?
switch ( where ) {
case 'left':
@@ -984,11 +994,11 @@ function initLayoutEditor( $ ) {
*
* @param {number} x The left position of the coordinate.
* @param {number} y The top position of the coordinate.
* @param {boolean} isCompactView Whether or not the form editor is in compact view.
*
* @returns {boolean}
*/
function isInEditorArea( x, y ) {
function isInEditorArea( x, y, isCompactView = false ) {
if ( ! gform.tools.isRtl() ) {
var editorOffsetLeft = $editorContainer.offset().left;
} else {
@@ -999,7 +1009,7 @@ function initLayoutEditor( $ ) {
offsetLeft = containerOffset.left - editorOffsetLeft,
buttonWidth = $button.outerWidth() || null,
editorArea = {
top: -offsetTop + buttonWidth,
top: isCompactView ? -offsetTop : -offsetTop + buttonWidth,
right: -offsetLeft + $editorContainer.outerWidth() - $sidebar.outerWidth() - buttonWidth,
bottom: -offsetTop + $editorContainer.outerHeight(),
left: -offsetLeft,

File diff suppressed because one or more lines are too long

View File

@@ -10,19 +10,10 @@ var GFPageConditionalLogic = function (args) {
// Assign options to instance.
self.options = args;
self.paginationType = self.options.pagination.type;
self.triggerInputIds = self.getTriggerInputIds(self.options.pages);
self.formWrapper = '#gform_wrapper_' + self.options.formId;
if (self.paginationType === 'steps') {
self.originalCurrentPage = parseInt($(self.formWrapper + ' .gf_step_active .gf_step_number').text(), 10);
} else if (self.paginationType === 'percentage') {
self.originalCurrentPage = parseInt($(self.formWrapper + ' .gf_step_current_page').text(), 10);
self.originalProgress = parseInt($(self.formWrapper + ' .gf_progressbar_percentage span').text(), 10);
}
self.startAtZero = $(self.formWrapper + ' .gf_progressbar_wrapper').data('startAtZero');
self.evaluatePages();
@@ -47,70 +38,19 @@ var GFPageConditionalLogic = function (args) {
self.evaluatePages = function () {
var page, stepNumber, isMatch, isVisible, progress, visibleStepNumber = 1, currentPage = self.originalCurrentPage;
let page, isMatch, isVisible;
for (var i = 0; i < self.options.pages.length; i++) {
for ( let i = 0; i < self.options.pages.length; i++ ) {
page = self.options.pages[i];
stepNumber = i + 2; // plus 2 because the first page field is actually Step 2.
isMatch = self.evaluatePage(page, self.options.formId);
isVisible = self.isPageVisible(page);
isMatch = self.evaluatePage( page, self.options.formId );
isVisible = self.isPageVisible( page );
if (!isMatch && isVisible !== false) {
self.hidePage(page, stepNumber);
} else if (isMatch && !isVisible) {
self.showPage(page, stepNumber);
if ( ! isMatch && isVisible !== false ) {
self.hidePage( page );
} else if ( isMatch && !isVisible ) {
self.showPage( page );
}
// check if the page is visible and
// available as a step after evaluation.
isVisible = self.isPageVisible(page);
if (isVisible) {
visibleStepNumber++;
if (self.paginationType === 'steps') {
$('#gf_step_' + self.options.formId + '_' + stepNumber).find('.gf_step_number').html(visibleStepNumber);
} else if (self.paginationType === 'percentage' && self.originalCurrentPage == stepNumber) {
currentPage = visibleStepNumber;
$(self.formWrapper + ' .gf_step_current_page').html(currentPage);
}
}
}
if (self.paginationType === 'percentage') {
currentPage = self.options.pagination.display_progressbar_on_confirmation === true || self.startAtZero ? ( currentPage - 1 ) : currentPage;
} else {
currentPage = parseInt($(self.formWrapper + ' .gf_step_active .gf_step_number').text(), 10);
if(self.startAtZero) {
currentPage -= 1;
}
}
progress = Math.floor( currentPage / visibleStepNumber * 100 );
if (self.paginationType === 'percentage') {
var progressPercent = progress + '%';
$(self.formWrapper + ' .gf_step_page_count').html(visibleStepNumber);
$(self.formWrapper + ' .gf_progressbar_percentage span').html(progressPercent);
$(self.formWrapper + ' .gf_progressbar_percentage').removeClass('percentbar_' + self.originalProgress).addClass('percentbar_' + progress).css('width', progressPercent);
}
// Update the form button based on progress
if ( progress === 100 ) {
// Treat the current page as the last one.
self.updateButtonToSubmitText( self.originalCurrentPage - 1, isMatch );
} else {
// Update the button on the current page.
$( '[id^=gform_next_button_' + self.options.formId + '_]' ).each( function ( e, element ) {
if ( $( element ).is(':visible') ) {
self.updateButtonToNextText( self.options.pages[ e ] );
}
});
// Update the button on the last page.
self.updateButtonToSubmitText( undefined, isMatch );
}
/**
@@ -123,6 +63,14 @@ var GFPageConditionalLogic = function (args) {
*/
gform.doAction('gform_frontend_pages_evaluated', self.options.pages, self.options.formId, self);
gform.doAction('gform_frontend_pages_evaluated_{0}'.gformFormat(self.options.formId), self.options.pages, self.options.formId, self);
gform.utils.trigger( {
event: 'gform/frontend_pages/evaluated',
data: {
formId: self.options.formId,
pages: self.options.pages
},
native: false
} );
};
@@ -179,7 +127,7 @@ var GFPageConditionalLogic = function (args) {
return false;
};
self.showPage = function (page, stepNumber) {
self.showPage = function ( page ) {
var isVisible = self.isPageVisible(page);
@@ -188,8 +136,7 @@ var GFPageConditionalLogic = function (args) {
}
page.isVisible = true;
$('#gf_step_' + self.options.formId + '_' + stepNumber).removeClass('gf_step_hidden');
$('#gform_' + self.options.formId + ' div[data-js="page-field-id-' + page.fieldId + '"]').attr('data-conditional-logic', 'visible');
/**
* Fires after the conditional logic on the form has been evaluated and the page has been found to be visible.
*
@@ -203,16 +150,16 @@ var GFPageConditionalLogic = function (args) {
};
self.hidePage = function (page, stepNumber) {
self.hidePage = function ( page ) {
var isVisible = self.isPageVisible(page);
var isVisible = self.isPageVisible( page );
if (isVisible === false) {
return;
}
page.isVisible = false;
$('#gf_step_' + self.options.formId + '_' + stepNumber).addClass('gf_step_hidden');
$('#gform_' + self.options.formId + ' div[data-js="page-field-id-' + page.fieldId + '"]').attr('data-conditional-logic', 'hidden');
/**
* Fires after the conditional logic on the form has been evaluated and the page has become hidden.
@@ -227,131 +174,5 @@ var GFPageConditionalLogic = function (args) {
};
/**
* The lastPageIndex might get miscalculated at some point during the flow. If it's outside the bounds of
* the page numbers, this resets it to the last natural page.
*
* @since 2.5.3
*
* @param {number|undefined} lastPageIndex The calculated last page of the form.
* @return {number} The calculated last page number.
*/
self.getValidatedLastPageIndex = function( lastPageIndex ) {
if ( lastPageIndex === undefined || lastPageIndex < 0 || lastPageIndex >= self.options.pages.length ) {
return self.options.pages.length - 1;
}
return lastPageIndex;
};
/**
* Checks whether the page the user is on is also considered to be the last page.
*
* Without conditional logic, forms have cardinal page numbers: 1, 2, 3, 4, 5, 6.
* With conditional logic, a "last page" of a form might not be the last page. e.g., 4 is the "submit" page.
*
* @since 2.5.3
*
* @param {number|string} targetPageNumber Next page to be shown.
* @param {number|string} lastPageNumber Actual last page of the form without conditional logic.
* @param {number|undefined} lastPageIndex In the scenario above, lastPageIndex is 4.
* @return {boolean} True or false whether the current page is the last calculated page.
*/
self.currentPageIsLastPage = function( targetPageNumber, lastPageNumber, lastPageIndex ) {
return targetPageNumber === lastPageNumber || lastPageIndex !== undefined;
};
/**
* Updates the text of the next button to be submit text on a paginated form.
*
* This method changes the text of the next button to the text of
* the submit button on the form if the user is on the page
* determined to be the last page of the form.
*
* @since Unknown
*
* @param {number|undefined} lastPageIndex The calculated last page of the form.
* @param {boolean} isMatch Whether the current conditional logic condition has been met.
* @return {void}
*/
self.updateButtonToSubmitText = function ( lastPageIndex, isMatch) {
var targetPageNumber = parseInt($('#gform_target_page_number_' + self.options.formId).val(), 10),
lastPageNumber = self.options.pages.length + 1;
// No need to update the button, we're not on the last page.
if ( ! self.currentPageIsLastPage( targetPageNumber, lastPageNumber, lastPageIndex ) ) {
return;
}
var calculatedLastPageIndex = self.getValidatedLastPageIndex( lastPageIndex );
var lastPageField = self.options.pages[ calculatedLastPageIndex ],
lastNextButton = $('#gform_next_button_' + self.options.formId + '_' + lastPageField.fieldId),
isLastPageVisible = self.isPageVisible(lastPageField),
formButton = $('#gform_submit_button_' + self.options.formId);
if (! isLastPageVisible ) {
if (formButton.attr('type') === 'image') {
// Cache last next button image alt.
if (lastNextButton.attr('type') === 'image') {
lastNextButton.data('alt', lastNextButton.attr('alt'));
}
lastNextButton.attr('type', 'image').attr('src', formButton.attr('src')).attr('alt', formButton.attr('alt')).addClass('gform_image_button').removeClass('button');
} else {
lastNextButton.attr('type', 'button').val(formButton.val()).addClass('button').removeClass('gform_image_button');
}
// Set a mark on the page, so later on we can reset the button when evaluating pages.
self.options.pages[ calculatedLastPageIndex ].isUpdated = true;
} else {
self.updateButtonToNextText( lastPageField );
}
// if actual submit button has conditional logic rules, apply them to the next button
if ( formButton.attr( 'data-conditional-logic' ) === 'hidden' ) {
var nextButton = $('#gform_next_button_' + self.options.formId + '_' + lastPageField.fieldId);
if( isMatch ) {
gf_show_button( nextButton );
} else {
gf_hide_button( nextButton );
}
}
};
/**
* Updates the text of the submit button to be next text on a paginated form.
*
* This method changes the text of the submit button to the text of
* the next button on the form if the user is on the page
* determined to not be the last page of the form.
*
* @since Unknown
*
* @param {number|undefined} page The current page of the form.
* @return {void}
*/
self.updateButtonToNextText = function ( page ) {
// No need to reset if the button hasn't been updated.
if ( ! page.hasOwnProperty( 'isUpdated' ) ) {
return;
}
delete page.isUpdated;
var nextButton = $('#gform_next_button_' + self.options.formId + '_' + page.fieldId);
if (page.nextButton.type === 'image') {
nextButton.attr('type', 'image').attr('src', page.nextButton.imageUrl).attr('alt', nextButton.data('alt')).addClass('gform_image_button').removeClass('button');
} else {
nextButton.attr('type', 'button').val(page.nextButton.text).addClass('button').removeClass('gform_image_button');
}
// formButton = $('#gform_submit_button_' + self.options.formId);
// if ( formButton.attr( 'data-conditional-logic' ) === 'visible' ) {
// var nextButton = $('#gform_next_button_' + self.options.formId + '_' + lastPageField.fieldId);
// gf_show_button( nextButton );
// }
}
this.init();
};

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
!function(t){t(document).ready(function(){gform.adminUtils.handleUnsavedChanges("#gform-settings")});var n=t('div[id="gform_setting_reset"]'),i=t('input[name="_gform_setting_public_key"]'),o=t('input[name="_gform_setting_private_key"]'),r=t('input[name="_gform_setting_reset"]');window.loadRecaptcha=function(){var e=t("#recaptcha"),a=t("#gform-settings-save"),c=t('input[name="_gform_setting_type"]:checked').val();if(window.___grecaptcha_cfg.clients={},window.___grecaptcha_cfg.count=0,e.html(""),r.val(1),t("#recpatcha .gform-settings-field__feedback").remove(),i.val()&&o.val()){switch(a.prop("disabled",!0),grecaptcha.render("recaptcha",{sitekey:i.val(),size:"invisible"===c?c:"",badge:"inline","error-callback":function(){},callback:function(){a.prop("disabled",!1)}}),c){case"checkbox":t('#gforms_checkbox_recaptcha_message, label[for="reset"]').show();break;case"invisible":t('#gforms_checkbox_recaptcha_message, label[for="reset"]').hide()}n.show(),"invisible"===c&&grecaptcha.execute()}else a.prop("disabled",!1),n.hide()},i.on("change",loadRecaptcha),o.on("change",loadRecaptcha),t('input[name="_gform_setting_type"]').on("change",function(){loadRecaptcha()})}(jQuery);
(t=>{t(document).ready(function(){gform.adminUtils.handleUnsavedChanges("#gform-settings")});var n=t('div[id="gform_setting_reset"]'),i=t('input[name="_gform_setting_public_key"]'),r=t('input[name="_gform_setting_private_key"]'),o=t('input[name="_gform_setting_reset"]');window.loadRecaptcha=function(){var e=t("#recaptcha"),a=t("#gform-settings-save"),c=t('input[name="_gform_setting_type"]:checked').val();if(window.___grecaptcha_cfg.clients={},window.___grecaptcha_cfg.count=0,e.html(""),o.val(1),t("#recpatcha .gform-settings-field__feedback").remove(),i.val()&&r.val()){switch(a.prop("disabled",!0),grecaptcha.render("recaptcha",{sitekey:i.val(),size:"invisible"===c?c:"",badge:"inline","error-callback":function(){},callback:function(){a.prop("disabled",!1)}}),c){case"checkbox":t('#gforms_checkbox_recaptcha_message, label[for="reset"]').show();break;case"invisible":t('#gforms_checkbox_recaptcha_message, label[for="reset"]').hide()}n.show(),"invisible"===c&&grecaptcha.execute()}else a.prop("disabled",!1),n.hide()},i.on("change",loadRecaptcha),r.on("change",loadRecaptcha),t('input[name="_gform_setting_type"]').on("change",function(){loadRecaptcha()})})(jQuery);

File diff suppressed because one or more lines are too long