plugin install
This commit is contained in:
3
wp/wp-content/plugins/gravityforms/js/chosen.jquery.min.js
vendored
Normal file
3
wp/wp-content/plugins/gravityforms/js/chosen.jquery.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@@ -0,0 +1,4 @@
|
||||
<div class='gform-alert gform-alert--accessibility'>
|
||||
<span class='gform-alert__icon gform-icon gform-icon--accessibility' aria-hidden='true'></span>
|
||||
<div class='gform-alert__message-wrap'><p class='gform-alert__message'>{{ a11yWarningText }}</p></div>
|
||||
</div>
|
||||
@@ -0,0 +1,21 @@
|
||||
<div class="conditional_logic_accordion {{ toggle_class }}">
|
||||
<div class="conditional_logic_accordion__label">
|
||||
{{ title }}
|
||||
</div>
|
||||
<div class="conditional_logic_accordion__status_indicator">
|
||||
<span class="gform-status-indicator gform-status-indicator--size-sm gform-status-indicator--theme-cosmos gform-status--no-hover {{ active_class }}">
|
||||
<span class="gform-status-indicator-status gform-typography--weight-medium gform-typography--size-text-xs">
|
||||
{{ active_text }}
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="conditional_logic_accordion__toggle {{ toggle_class }}">
|
||||
<button class="conditional_logic_accordion__toggle_button">
|
||||
<span class="screen-reader-text">{{ toggleText }}</span>
|
||||
<i class="conditional_logic_accordion__toggle_button_icon"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="conditional_logic_accordion__desc {{ desc_class }}">
|
||||
{{ desc }}
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,33 @@
|
||||
<aside class="conditional_logic_flyout">
|
||||
<button class="conditional_logic_flyout__close" data-js-close-flyout>
|
||||
<span class="screen-reader-text">Close Conditional Logic Settings Modal</span>
|
||||
<i class="conditional_logic_flyout__close_icon" data-js-close-flyout ></i>
|
||||
</button>
|
||||
<header class="conditional_logic_flyout__head">
|
||||
<div class="conditional_logic_flyout__title">
|
||||
{{ configure }} {{ conditionalLogic }}
|
||||
</div>
|
||||
<div class="conditional_logic_flyout__desc">
|
||||
{{ desc }}
|
||||
</div>
|
||||
</header>
|
||||
<article class="conditional_logic_flyout__body panel-block-tabs__body--settings" data-js="gform-simplebar">
|
||||
<div class="conditional_logic_flyout__toggle">
|
||||
<span class="conditional_logic_flyout__toggle_label">
|
||||
{{ enable }} {{ conditionalLogic }}
|
||||
</span>
|
||||
<div class="conditional_logic_flyout__toggle_input gform-field__toggle">
|
||||
<span class="gform-settings-input__container">
|
||||
<input type="checkbox" class="gform-field__toggle-input" data-js-conditonal-toggle id="field_conditional_logic_{{ objectType }}_{{ fieldId }}" {{ checked }}>
|
||||
<label class="gform-field__toggle-container" for="field_conditional_logic_{{ objectType }}_{{ fieldId }}">
|
||||
<span class="gform-field__toggle-switch-text screen-reader-text">{{ enabledText }}</span>
|
||||
<span class="gform-field__toggle-switch"></span>
|
||||
</label>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="conditional_logic_flyout__main">
|
||||
{{ main }}
|
||||
</div>
|
||||
</article>
|
||||
</aside>
|
||||
@@ -0,0 +1 @@
|
||||
<input type="text" placeholder="Enter a value" data-js-rule-input="value" class="gfield_rule_select gfield_rule_input active" id="field_rule_value_{{ ruleIdx }}" name="field_rule_value_{{ ruleIdx }}" value="{{ value }}">
|
||||
@@ -0,0 +1,12 @@
|
||||
<div class="conditional_logic_flyout__action">
|
||||
<select id="field_action_type" data-js-state-update="actionType">
|
||||
<option value="show" {{ showSelected }}>{{ objectShowText }}</option>
|
||||
<option value="hide" {{ hideSelected }}>{{ objectHideText }}</option>
|
||||
</select>
|
||||
{{ objectTypeText }}
|
||||
<select id="field_logic_type" data-js-state-update="logicType">
|
||||
<option value="all" {{ allSelected }}>{{ allText }}</option>
|
||||
<option value="any" {{ anySelected }}>{{ anyText }}</option>
|
||||
</select>
|
||||
{{ matchText }}
|
||||
</div>
|
||||
@@ -0,0 +1,8 @@
|
||||
<fieldset class="conditional-flyout__main-fields {{ enabledClass }}">
|
||||
{{ a11yWarning }}
|
||||
{{ logicDescription }}
|
||||
|
||||
<div class="conditional_logic_flyout__logic">
|
||||
</div>
|
||||
|
||||
</fieldset>
|
||||
@@ -0,0 +1 @@
|
||||
<option value="{{ value }}" {{ selected }}>{{ label }}</option>
|
||||
@@ -0,0 +1,14 @@
|
||||
<div class="conditional_logic_flyout__rule" data-js-rule-idx="{{ rule_idx }}">
|
||||
<select id="field_rule_field_{{ rule_idx }}" data-js-rule-input="fieldId" class="gfield_rule_select">
|
||||
{{ fieldOptions }}
|
||||
</select>
|
||||
<select id="field_rule_operator_{{ rule_idx }}" data-js-rule-input="operator" class="gfield_rule_select" >
|
||||
{{ operatorOptions }}
|
||||
</select>
|
||||
|
||||
{{ valueMarkup }}
|
||||
<div class="conditional_logic_flyout__rule-controls">
|
||||
<button type="button" class="add_field_choice gform-st-icon gform-st-icon--circle-plus" data-js-add-rule title="{{ addRuleText }}"></button>
|
||||
<button type="button" class="delete_field_choice gform-st-icon gform-st-icon--circle-minus {{ deleteClass }}" data-js-delete-rule title="{{ removeRuleText }}"></button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,3 @@
|
||||
<select data-js-rule-input="value" class="gfield_rule_select gfield_rule_value_dropdown_cl active" id="field_rule_value_{{ ruleIdx }}" name="field_rule_value_{{ ruleIdx }}">
|
||||
{{ fieldValueOptions }}
|
||||
</select>
|
||||
714
wp/wp-content/plugins/gravityforms/js/conditional_logic.js
Normal file
714
wp/wp-content/plugins/gravityforms/js/conditional_logic.js
Normal file
@@ -0,0 +1,714 @@
|
||||
|
||||
var __gf_timeout_handle;
|
||||
|
||||
gform.addAction( 'gform_input_change', function( elem, formId, fieldId ) {
|
||||
if( ! window.gf_form_conditional_logic ) {
|
||||
return;
|
||||
}
|
||||
var dependentFieldIds = rgars( gf_form_conditional_logic, [ formId, 'fields', gformExtractFieldId( fieldId ) ].join( '/' ) );
|
||||
if( dependentFieldIds ) {
|
||||
gf_apply_rules( formId, dependentFieldIds );
|
||||
}
|
||||
}, 10 );
|
||||
|
||||
function gf_apply_rules(formId, fields, isInit){
|
||||
|
||||
jQuery(document).trigger( 'gform_pre_conditional_logic', [ formId, fields, isInit ] );
|
||||
gform.utils.trigger( {
|
||||
event: 'gform/conditionalLogic/applyRules/start',
|
||||
native: false,
|
||||
data: { formId: formId, fields: fields, isInit: isInit },
|
||||
} );
|
||||
for(var i=0; i < fields.length; i++){
|
||||
gf_apply_field_rule(formId, fields[i], isInit, function(){
|
||||
var is_last_field = ( i >= fields.length - 1 );
|
||||
if( is_last_field ) {
|
||||
jQuery(document).trigger('gform_post_conditional_logic', [formId, fields, isInit]);
|
||||
gform.utils.trigger( {
|
||||
event: 'gform/conditionalLogic/applyRules/end',
|
||||
native: false,
|
||||
data: { formId: formId, fields: fields, isInit: isInit },
|
||||
} );
|
||||
if(window["gformCalculateTotalPrice"]){
|
||||
window["gformCalculateTotalPrice"](formId);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function gf_check_field_rule(formId, fieldId, isInit, callback){
|
||||
|
||||
//if conditional logic is not specified for that field, it is supposed to be displayed
|
||||
var conditionalLogic = gf_get_field_logic( formId, fieldId );
|
||||
if ( ! conditionalLogic ) {
|
||||
return 'show';
|
||||
}
|
||||
|
||||
var action = gf_get_field_action(formId, conditionalLogic["section"]);
|
||||
|
||||
//If section is hidden, always hide field. If section is displayed, see if field is supposed to be displayed or hidden
|
||||
if(action != "hide")
|
||||
action = gf_get_field_action(formId, conditionalLogic["field"]);
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the conditional logic properties for the specified field.
|
||||
*
|
||||
* @since 2.4.16
|
||||
*
|
||||
* @param {(string|number)} formId The ID of the current form.
|
||||
* @param {(string|number)} fieldId The ID of the current field.
|
||||
*
|
||||
* @return {(boolean|object)} False or the field conditional logic properties.
|
||||
*/
|
||||
function gf_get_field_logic(formId, fieldId) {
|
||||
var formConditionalLogic = rgars( window, 'gf_form_conditional_logic/' + formId );
|
||||
if ( ! formConditionalLogic ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var conditionalLogic = rgars( formConditionalLogic, 'logic/' + fieldId );
|
||||
if ( conditionalLogic ) {
|
||||
return conditionalLogic;
|
||||
}
|
||||
|
||||
var dependents = rgar( formConditionalLogic, 'dependents' );
|
||||
if ( ! dependents ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Attempting to get section field conditional logic instead.
|
||||
for ( var key in dependents ) {
|
||||
if ( dependents[key].indexOf( fieldId ) !== -1 ) {
|
||||
return rgars( formConditionalLogic, 'logic/' + key );
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function gf_apply_field_rule(formId, fieldId, isInit, callback){
|
||||
|
||||
var action = gf_check_field_rule(formId, fieldId, isInit, callback);
|
||||
|
||||
gf_do_field_action(formId, action, fieldId, isInit, callback);
|
||||
|
||||
var conditionalLogic = window["gf_form_conditional_logic"][formId]["logic"][fieldId];
|
||||
//perform conditional logic for the next button
|
||||
if(conditionalLogic["nextButton"]){
|
||||
action = gf_get_field_action(formId, conditionalLogic["nextButton"]);
|
||||
gf_do_next_button_action(formId, action, fieldId, isInit);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function gf_get_field_action(formId, conditionalLogic){
|
||||
if(!conditionalLogic)
|
||||
return "show";
|
||||
|
||||
var matches = 0;
|
||||
for(var i = 0; i < conditionalLogic["rules"].length; i++){
|
||||
/**
|
||||
* Filter the conditional logic rule before it is evaluated on the frontend.
|
||||
*
|
||||
* @param {object} rule The conditional logic rule about to be evaluated.
|
||||
* @param {(string|number)} formId The current form ID.
|
||||
* @param {object} conditionalLogic All details required to evaluate an objects conditional logic.
|
||||
*
|
||||
* @since 2.4.22
|
||||
*/
|
||||
var rule = gform.applyFilters( 'gform_rule_pre_evaluation', jQuery.extend( {}, conditionalLogic["rules"][i] ), formId, conditionalLogic );
|
||||
if(gf_is_match(formId, rule))
|
||||
matches++;
|
||||
}
|
||||
|
||||
var action;
|
||||
if( (conditionalLogic["logicType"] == "all" && matches == conditionalLogic["rules"].length) || (conditionalLogic["logicType"] == "any" && matches > 0) )
|
||||
action = conditionalLogic["actionType"];
|
||||
else
|
||||
action = conditionalLogic["actionType"] == "show" ? "hide" : "show";
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
function gf_is_match( formId, rule ) {
|
||||
|
||||
var $ = jQuery,
|
||||
inputId = rule['fieldId'],
|
||||
fieldId = gformExtractFieldId( inputId ),
|
||||
inputIndex = gformExtractInputIndex( inputId ),
|
||||
isInputSpecific = inputIndex !== false,
|
||||
$inputs;
|
||||
|
||||
if( isInputSpecific ) {
|
||||
$inputs = $( '#input_{0}_{1}_{2}, #choice_{0}_{1}_{2}'.gformFormat( formId, fieldId, inputIndex ) );
|
||||
} else {
|
||||
$inputs = $( 'input[id="input_{0}_{1}"], input[id^="input_{0}_{1}_"], input[id^="choice_{0}_{1}_"], select#input_{0}_{1}, textarea#input_{0}_{1}'.gformFormat( formId, fieldId ) );
|
||||
}
|
||||
|
||||
var isCheckable = $.inArray( $inputs.attr( 'type' ), [ 'checkbox', 'radio' ] ) !== -1;
|
||||
var isMatch = isCheckable ? gf_is_match_checkable( $inputs, rule, formId, fieldId ) : gf_is_match_default( $inputs.eq( 0 ), rule, formId, fieldId );
|
||||
|
||||
return gform.applyFilters( 'gform_is_value_match', isMatch, formId, rule );
|
||||
}
|
||||
|
||||
function gf_is_match_checkable( $inputs, rule, formId, fieldId ) {
|
||||
|
||||
// Rule is checking if the checkable is/isn't blank. Return a specific check for that use-case.
|
||||
if ( rule.value === '' ) {
|
||||
return rule.operator === 'is' ? gf_is_checkable_empty( $inputs ) : ! gf_is_checkable_empty( $inputs );
|
||||
}
|
||||
|
||||
var isMatch = false;
|
||||
|
||||
$inputs.each( function() {
|
||||
|
||||
var $input = jQuery( this ),
|
||||
fieldValue = gf_get_value( $input.val() ),
|
||||
isRangeOperator = jQuery.inArray( rule.operator, [ '<', '>' ] ) !== -1,
|
||||
isStringOperator = jQuery.inArray( rule.operator, [ 'contains', 'starts_with', 'ends_with' ] ) !== -1;
|
||||
|
||||
// if we are looking for a specific value and this is not it, skip
|
||||
if( fieldValue != rule.value && ! isRangeOperator && ! isStringOperator ) {
|
||||
return; // continue
|
||||
}
|
||||
|
||||
// force an empty value for unchecked items
|
||||
if( ! $input.is( ':checked' ) ) {
|
||||
fieldValue = '';
|
||||
}
|
||||
// if the 'other' choice is selected, get the value from the 'other' text input
|
||||
else if ( fieldValue == 'gf_other_choice' ) {
|
||||
fieldValue = jQuery( '#input_{0}_{1}_other'.gformFormat( formId, fieldId ) ).val();
|
||||
}
|
||||
|
||||
if( gf_matches_operation( fieldValue, rule.value, rule.operator ) ) {
|
||||
isMatch = true;
|
||||
return false; // break
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
return isMatch;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a collection of checkable inputs has any checked,
|
||||
* or if they are all unchecked.
|
||||
*
|
||||
* @param {jQuery} $inputs A collection of inputs to check.
|
||||
*
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function gf_is_checkable_empty( $inputs ) {
|
||||
var isEmpty = true;
|
||||
|
||||
$inputs.each( function() {
|
||||
if ( jQuery( this ).is( ':checked' ) ) {
|
||||
isEmpty = false;
|
||||
}
|
||||
} );
|
||||
|
||||
return isEmpty;
|
||||
}
|
||||
|
||||
function gf_is_match_default( $input, rule, formId, fieldId ) {
|
||||
|
||||
var val = $input.val(),
|
||||
values = ( val instanceof Array ) ? val : [ val ], // transform regular value into array to support multi-select (which returns an array of selected items)
|
||||
matchCount = 0,
|
||||
valuesLength = Math.max( values.length, 1 ); // jQuery 3.0: Make sure our length is at least 1 so that the following loop fires.
|
||||
|
||||
for( var i = 0; i < valuesLength; i++ ) {
|
||||
|
||||
// fields with pipes in the value will use the label for conditional logic comparison
|
||||
var hasLabel = values[i] ? values[i].indexOf( '|' ) >= 0 : true,
|
||||
fieldValue = gf_get_value( values[i] );
|
||||
|
||||
var fieldNumberFormat = gf_get_field_number_format( rule.fieldId, formId, 'value' );
|
||||
if( fieldNumberFormat && ! hasLabel ) {
|
||||
fieldValue = gf_format_number( fieldValue, fieldNumberFormat );
|
||||
}
|
||||
|
||||
var ruleValue = rule.value;
|
||||
//if ( fieldNumberFormat ) {
|
||||
// ruleValue = gf_format_number( ruleValue, fieldNumberFormat );
|
||||
//}
|
||||
|
||||
if( gf_matches_operation( fieldValue, ruleValue, rule.operator ) ) {
|
||||
matchCount++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// if operator is 'isnot', none of the values can match
|
||||
var isMatch = rule.operator == 'isnot' ? matchCount == valuesLength : matchCount > 0;
|
||||
|
||||
return isMatch;
|
||||
}
|
||||
|
||||
function gf_format_number( value, fieldNumberFormat ) {
|
||||
|
||||
decimalSeparator = '.';
|
||||
|
||||
if( fieldNumberFormat == 'currency' ) {
|
||||
decimalSeparator = gformGetDecimalSeparator( 'currency' );
|
||||
} else if( fieldNumberFormat == 'decimal_comma' ) {
|
||||
decimalSeparator = ',';
|
||||
} else if( fieldNumberFormat == 'decimal_dot' ) {
|
||||
decimalSeparator = '.';
|
||||
}
|
||||
|
||||
// transform to a decimal dot number
|
||||
value = gformCleanNumber( 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
|
||||
*/
|
||||
// now transform to number specified by locale
|
||||
// if( window['gf_number_format'] && window['gf_number_format'] == 'decimal_comma' ) {
|
||||
// value = gformFormatNumber( value, -1, ',', '.' );
|
||||
// }
|
||||
|
||||
if( ! value ) {
|
||||
value = 0;
|
||||
}
|
||||
|
||||
number = value.toString();
|
||||
|
||||
return number;
|
||||
}
|
||||
|
||||
function gf_try_convert_float(text){
|
||||
|
||||
/*
|
||||
* The only format that should matter is the field format. Attempting to do this by WP locale creates a lot of issues with consistency.
|
||||
* var format = window["gf_number_format"] == "decimal_comma" ? "decimal_comma" : "decimal_dot";
|
||||
*/
|
||||
|
||||
var format = 'decimal_dot';
|
||||
if( gformIsNumeric( text, format ) ) {
|
||||
var decimal_separator = format == "decimal_comma" ? "," : ".";
|
||||
return gformCleanNumber( text, "", "", decimal_separator );
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
function gf_matches_operation(val1, val2, operation){
|
||||
val1 = val1 ? val1.toLowerCase() : "";
|
||||
val2 = val2 ? val2.toLowerCase() : "";
|
||||
|
||||
switch(operation){
|
||||
case "is" :
|
||||
return val1 == val2;
|
||||
break;
|
||||
|
||||
case "isnot" :
|
||||
return val1 != val2;
|
||||
break;
|
||||
|
||||
case ">" :
|
||||
val1 = gf_try_convert_float(val1);
|
||||
val2 = gf_try_convert_float(val2);
|
||||
|
||||
return gformIsNumber(val1) && gformIsNumber(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;
|
||||
break;
|
||||
|
||||
case "contains" :
|
||||
return val1.indexOf(val2) >=0;
|
||||
break;
|
||||
|
||||
case "starts_with" :
|
||||
return val1.indexOf(val2) ==0;
|
||||
break;
|
||||
|
||||
case "ends_with" :
|
||||
var start = val1.length - val2.length;
|
||||
if(start < 0)
|
||||
return false;
|
||||
|
||||
var tail = val1.substring(start);
|
||||
return val2 == tail;
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function gf_get_value(val){
|
||||
if(!val)
|
||||
return "";
|
||||
|
||||
val = val.split("|");
|
||||
return val[0];
|
||||
}
|
||||
|
||||
function gf_do_field_action(formId, action, fieldId, isInit, callback){
|
||||
var conditional_logic = window["gf_form_conditional_logic"][formId];
|
||||
var dependent_fields = conditional_logic["dependents"][fieldId];
|
||||
|
||||
for(var i=0; i < dependent_fields.length; i++){
|
||||
var targetId = fieldId == 0 ? "#gform_submit_button_" + formId : "#field_" + formId + "_" + dependent_fields[i];
|
||||
var defaultValues = conditional_logic["defaults"][dependent_fields[i]];
|
||||
|
||||
//calling callback function on the last dependent field, to make sure it is only called once
|
||||
do_callback = (i+1) == dependent_fields.length ? callback : null;
|
||||
|
||||
/**
|
||||
* Allow add-ons to abort gf_do_action() function.
|
||||
*
|
||||
* @since 2.6.2
|
||||
*
|
||||
* @param bool $doAbort The value being filtered. True to abort conditional logic action, false to continue. Defaults to false.
|
||||
* @param string $action The conditional logic action that will be performed. Possible values: show or hide
|
||||
* @param string $targetId HTML element id that will be the targed of the conditional logic action.
|
||||
* @param bool $doAnimation True to perform animation while showing/hiding field. False to hide/show field without animation.
|
||||
* @param array $defaultValue Array containg default field values.
|
||||
* @param bool $isInit True if form is being initialized (i.e. before user has interacted with any input). False otherwise.
|
||||
* @param array $formId The current form ID.
|
||||
* @param func $do_callback Callback function to be executed after conditional logic is executed.
|
||||
*/
|
||||
let abort = gform.applyFilters( 'gform_abort_conditional_logic_do_action', false, action, targetId, conditional_logic[ "animation" ], defaultValues, isInit, formId, do_callback );
|
||||
if ( ! abort ) {
|
||||
gf_do_action( action, targetId, conditional_logic[ "animation" ], defaultValues, isInit, do_callback, formId );
|
||||
} else if ( do_callback ) {
|
||||
do_callback();
|
||||
}
|
||||
|
||||
gform.doAction('gform_post_conditional_logic_field_action', formId, action, targetId, defaultValues, isInit);
|
||||
}
|
||||
}
|
||||
|
||||
function gf_do_next_button_action(formId, action, fieldId, isInit){
|
||||
var conditional_logic = window["gf_form_conditional_logic"][formId];
|
||||
var targetId = "#gform_next_button_" + formId + "_" + fieldId;
|
||||
|
||||
/**
|
||||
* Allow add-ons to abort gf_do_action() function.
|
||||
*
|
||||
* @since 2.6.2
|
||||
*
|
||||
* @param bool $doAbort The value being filtered. True to abort conditional logic action, false to continue. Defaults to false.
|
||||
* @param string $action The conditional logic action that will be performed. Possible values: show or hide
|
||||
* @param string $targetId HTML element id that will be the targed of the conditional logic action.
|
||||
* @param bool $doAnimation True to perform animation while showing/hiding field. False to hide/show field without animation.
|
||||
* @param array $defaultValue Array containg default field values.
|
||||
* @param bool $isInit True if form is being initialized (i.e. before user has interacted with any input). False otherwise.
|
||||
* @param array $formId The current form ID.
|
||||
* @param func $do_callback Callback function to be executed after conditional logic is executed.
|
||||
*/
|
||||
let abort = gform.applyFilters( 'gform_abort_conditional_logic_do_action', false, action, targetId, conditional_logic[ "animation" ], null, isInit, formId, null );
|
||||
if ( ! abort ) {
|
||||
gf_do_action( action, targetId, conditional_logic[ "animation" ], null, isInit, null, formId );
|
||||
}
|
||||
}
|
||||
|
||||
function gf_do_action(action, targetId, useAnimation, defaultValues, isInit, callback, formId){
|
||||
var $target = jQuery( targetId );
|
||||
|
||||
/**
|
||||
* Do not re-enable inputs that are disabled by default. Check if field's inputs have been assessed. If not, add
|
||||
* designator class so these inputs are exempted below.
|
||||
*/
|
||||
if( ! $target.data( 'gf-disabled-assessed' ) ) {
|
||||
$target.find( ':input:disabled' ).addClass( 'gf-default-disabled' );
|
||||
$target.data( 'gf-disabled-assessed', true );
|
||||
}
|
||||
|
||||
// honeypot should not be impacted by conditional logic.
|
||||
if( $target.hasClass( 'gfield--type-honeypot') ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(action == "show"){
|
||||
// reset tabindex for selects
|
||||
$target.find( 'select' ).each( function() {
|
||||
var $select = jQuery( this );
|
||||
$select.attr( 'tabindex', $select.data( 'tabindex' ) );
|
||||
} );
|
||||
|
||||
if(useAnimation && !isInit){
|
||||
if($target.length > 0){
|
||||
$target.find(':input:hidden:not(.gf-default-disabled)').prop( 'disabled', false );
|
||||
if ( $target.is( 'input[type="submit"]' ) || $target.hasClass( 'gform_next_button' ) ) {
|
||||
gf_show_button( $target );
|
||||
}
|
||||
$target.slideDown(callback);
|
||||
$target.attr( 'data-conditional-logic', 'visible' );
|
||||
} else if(callback){
|
||||
callback();
|
||||
}
|
||||
}
|
||||
else{
|
||||
var display = $target.data('gf_display');
|
||||
|
||||
// set display if previous (saved) display isn't set for any reason
|
||||
if ( display == '' || display == 'none' ){
|
||||
display = '1' === gf_legacy.is_legacy ? 'list-item' : 'block';
|
||||
}
|
||||
$target.find(':input:hidden:not(.gf-default-disabled)').prop( 'disabled', false ).attr( 'data-conditional-logic', 'visible' );
|
||||
|
||||
// Handle conditional submit and next buttons.
|
||||
if ( $target.is( 'input[type="submit"]' ) || $target.hasClass( 'gform_next_button' ) ) {
|
||||
gf_show_button( $target );
|
||||
} else {
|
||||
$target.css( 'display', display );
|
||||
if( display == 'none' ) {
|
||||
$target.attr( 'data-conditional-logic', 'hidden' );
|
||||
} else {
|
||||
$target.attr( 'data-conditional-logic', 'visible' );
|
||||
}
|
||||
}
|
||||
|
||||
if(callback){
|
||||
callback();
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
|
||||
//if field is not already hidden, reset its values to the default
|
||||
var child = $target.children().first();
|
||||
if (child.length > 0){
|
||||
var reset = gform.applyFilters('gform_reset_pre_conditional_logic_field_action', true, formId, targetId, defaultValues, isInit);
|
||||
|
||||
if(reset && !gformIsHidden(child)){
|
||||
gf_reset_to_default(targetId, defaultValues);
|
||||
}
|
||||
}
|
||||
|
||||
// remove tabindex and stash as a data attr for selects
|
||||
$target.find( 'select' ).each( function() {
|
||||
var $select = jQuery( this );
|
||||
$select.data( 'tabindex', $select.attr( 'tabindex' ) ).removeAttr( 'tabindex' );
|
||||
} );
|
||||
|
||||
//Saving existing display so that it can be reset when showing the field
|
||||
if( ! $target.data('gf_display') ){
|
||||
$target.data('gf_display', $target.css('display'));
|
||||
}
|
||||
|
||||
if(useAnimation && !isInit){
|
||||
if( $target.is( 'input[type="submit"]' ) || $target.hasClass( 'gform_next_button' ) ) {
|
||||
gf_hide_button( $target );
|
||||
} else if ( $target.length > 0 && $target.is( ":visible" ) ) {
|
||||
$target.slideUp( callback );
|
||||
$target.attr( 'data-conditional-logic', 'hidden' );
|
||||
} else if ( callback ) {
|
||||
callback();
|
||||
}
|
||||
} else{
|
||||
|
||||
// Handle conditional submit and next buttons.
|
||||
if ( $target.is( 'input[type="submit"]' ) || $target.hasClass( 'gform_next_button' ) ) {
|
||||
gf_hide_button( $target );
|
||||
} else {
|
||||
$target.css( 'display', 'none' );
|
||||
$target.attr( 'data-conditional-logic', 'hidden' );
|
||||
}
|
||||
$target.find(':input:hidden:not(.gf-default-disabled)').attr( 'disabled', 'disabled' );
|
||||
if(callback){
|
||||
callback();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function gf_show_button( $target ) {
|
||||
$target.prop( 'disabled', false ).css( 'display', '' );
|
||||
$target.attr( 'data-conditional-logic', 'visible' );
|
||||
if ( '1' == gf_legacy.is_legacy ) {
|
||||
// for legacy markup, remove screen reader class.
|
||||
$target.removeClass( 'screen-reader-text' );
|
||||
}
|
||||
|
||||
// Sometimes the next button is pretending to be a submit button, so it needs conditional logic too.
|
||||
var fauxSubmitButton = jQuery( 'input.gform_next_button[type="button"][value="Submit"]' );
|
||||
if ( fauxSubmitButton ) {
|
||||
fauxSubmitButton.prop( 'disabled', false ).css( 'display', '' );
|
||||
fauxSubmitButton.attr( 'data-conditional-logic', 'visible' );
|
||||
}
|
||||
}
|
||||
|
||||
function gf_hide_button( $target ) {
|
||||
$target.attr( 'disabled', 'disabled' ).hide();
|
||||
$target.attr( 'data-conditional-logic', 'hidden' );
|
||||
if ( '1' === gf_legacy.is_legacy ) {
|
||||
// for legacy markup, let screen readers read the button.
|
||||
$target.addClass( 'screen-reader-text' );
|
||||
}
|
||||
|
||||
// Sometimes the next button is pretending to be a submit button, so it needs conditional logic too.
|
||||
var fauxSubmitButton = jQuery( 'input.gform_next_button[type="button"][value="Submit"]' );
|
||||
if ( fauxSubmitButton ) {
|
||||
fauxSubmitButton.attr( 'disabled', 'disabled' ).hide();
|
||||
fauxSubmitButton.attr( 'data-conditional-logic', 'hidden' );
|
||||
}
|
||||
}
|
||||
|
||||
function gf_reset_to_default(targetId, defaultValue){
|
||||
|
||||
var dateFields = jQuery( targetId ).find( '.gfield_date_month input, .gfield_date_day input, .gfield_date_year input, .gfield_date_dropdown_month select, .gfield_date_dropdown_day select, .gfield_date_dropdown_year select' );
|
||||
if( dateFields.length > 0 ) {
|
||||
|
||||
dateFields.each( function(){
|
||||
|
||||
var element = jQuery( this );
|
||||
|
||||
// defaultValue is associative array (i.e. [ m: 1, d: 13, y: 1987 ] )
|
||||
if( defaultValue ) {
|
||||
|
||||
var key = 'd';
|
||||
if (element.parents().hasClass('gfield_date_month') || element.parents().hasClass('gfield_date_dropdown_month') ){
|
||||
key = 'm';
|
||||
}
|
||||
else if(element.parents().hasClass('gfield_date_year') || element.parents().hasClass('gfield_date_dropdown_year') ){
|
||||
key = 'y';
|
||||
}
|
||||
|
||||
val = defaultValue[ key ];
|
||||
|
||||
}
|
||||
else{
|
||||
val = "";
|
||||
}
|
||||
|
||||
if(element.prop("tagName") == "SELECT" && val != '' )
|
||||
val = parseInt(val, 10);
|
||||
|
||||
|
||||
if(element.val() != val)
|
||||
element.val(val).trigger("change");
|
||||
else
|
||||
element.val(val);
|
||||
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//cascading down conditional logic to children to support nested conditions
|
||||
//text fields and drop downs, filter out list field text fields name with "_shim"
|
||||
var target = jQuery(targetId).find( 'select, input[type="text"]:not([id*="_shim"]), input[type="number"], input[type="hidden"], input[type="email"], input[type="tel"], input[type="url"], textarea' );
|
||||
var target_index = 0;
|
||||
|
||||
// When a List field is hidden via conditional logic during a page submission, the markup will be reduced to a
|
||||
// single row. Add enough rows/inputs to satisfy the default value.
|
||||
if( defaultValue && target.parents( '.ginput_list' ).length > 0 && target.length < defaultValue.length ) {
|
||||
while( target.length < defaultValue.length ) {
|
||||
gformAddListItem( target.eq( 0 ), 0 );
|
||||
target = jQuery(targetId).find( 'select, input[type="text"]:not([id*="_shim"]), input[type="number"], textarea' );
|
||||
}
|
||||
}
|
||||
|
||||
target.each(function(){
|
||||
|
||||
var val = "";
|
||||
|
||||
var element = jQuery(this);
|
||||
|
||||
// Only reset Single Product and Shipping hidden inputs.
|
||||
if( element.is( '[type="hidden"]' ) && ! gf_is_hidden_pricing_input( element ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
//get name of previous input field to see if it is the radio button which goes with the "Other" text box
|
||||
//otherwise field is populated with input field name
|
||||
var radio_button_name = element.prevAll("input").first().attr("value");
|
||||
if(radio_button_name == "gf_other_choice"){
|
||||
val = element.attr("value");
|
||||
}
|
||||
else if( Array.isArray( defaultValue ) && ! element.is( 'select[multiple]' ) ) {
|
||||
val = defaultValue[target_index];
|
||||
}
|
||||
else if(jQuery.isPlainObject(defaultValue)){
|
||||
val = defaultValue[element.attr("name")];
|
||||
if( ! val && element.attr( 'id' ) ) {
|
||||
// 'input_123_3_1' => '3.1'
|
||||
var inputId = element.attr( 'id' ).split( '_' ).slice( 2 ).join( '.' );
|
||||
val = defaultValue[ inputId ];
|
||||
}
|
||||
if( ! val && element.attr( 'name' ) ) {
|
||||
var inputId = element.attr( 'name' ).split( '_' )[1];
|
||||
val = defaultValue[ inputId ];
|
||||
}
|
||||
}
|
||||
else if(defaultValue){
|
||||
val = defaultValue;
|
||||
}
|
||||
|
||||
if( element.is('select:not([multiple])') && ! val ) {
|
||||
val = element.find( 'option' ).not( ':disabled' ).eq(0).val();
|
||||
}
|
||||
|
||||
if(element.val() != val) {
|
||||
element.val(val).trigger('change');
|
||||
if (element.is('select') && element.next().hasClass('chosen-container')) {
|
||||
element.trigger('chosen:updated');
|
||||
}
|
||||
// Check for Single Product & Shipping input and force visual price update.
|
||||
if( gf_is_hidden_pricing_input( element ) ) {
|
||||
var ids = gf_get_ids_by_html_id( element.parents( '.gfield' ).attr( 'id' ) );
|
||||
jQuery( '#input_' + ids[0] + '_' + ids[1] ).text( gformFormatMoney( element.val() ) );
|
||||
element.val( gformFormatMoney( element.val() ) );
|
||||
}
|
||||
}
|
||||
else{
|
||||
element.val(val);
|
||||
}
|
||||
|
||||
target_index++;
|
||||
});
|
||||
|
||||
//checkboxes and radio buttons
|
||||
var elements = jQuery(targetId).find('input[type="radio"], input[type="checkbox"]:not(".copy_values_activated")');
|
||||
|
||||
elements.each(function(){
|
||||
|
||||
//is input currently checked?
|
||||
var isChecked = jQuery(this).is(':checked') ? true : false;
|
||||
|
||||
//does input need to be marked as checked or unchecked?
|
||||
var doCheck = defaultValue ? jQuery.inArray(jQuery(this).attr('id'), defaultValue) > -1 : false;
|
||||
|
||||
//if value changed, trigger click event
|
||||
if(isChecked != doCheck){
|
||||
//setting input as checked or unchecked appropriately
|
||||
|
||||
if(jQuery(this).attr("type") == "checkbox"){
|
||||
jQuery(this).trigger('click');
|
||||
}
|
||||
else{
|
||||
jQuery(this).prop('checked', doCheck).change();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function gf_is_hidden_pricing_input( element ) {
|
||||
|
||||
// Check for Single Product fields.
|
||||
if( element.attr( 'id' ) && element.attr( 'id' ).indexOf( 'ginput_base_price' ) === 0 ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if( element.attr( 'type' ) !== 'hidden' ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check for Shipping fields.
|
||||
return element.parents( '.gfield_shipping' ).length;
|
||||
}
|
||||
1
wp/wp-content/plugins/gravityforms/js/conditional_logic.min.js
vendored
Normal file
1
wp/wp-content/plugins/gravityforms/js/conditional_logic.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
43
wp/wp-content/plugins/gravityforms/js/datepicker-legacy.js
Normal file
43
wp/wp-content/plugins/gravityforms/js/datepicker-legacy.js
Normal file
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* Apply legacy options to DatePickers within Legacy Forms.
|
||||
*/
|
||||
gform.addFilter( 'gform_datepicker_options_pre_init', function( optionsObj, formId, inputId, $element ) {
|
||||
var gf_legacy = window.gf_legacy_multi;
|
||||
|
||||
if ( ! gf_legacy ) {
|
||||
return optionsObj;
|
||||
}
|
||||
if ( !gf_legacy[ formId ] || gf_legacy[ formId ] !== '1' ) {
|
||||
return optionsObj;
|
||||
}
|
||||
|
||||
var $ = window.jQuery;
|
||||
var isPreview = $( '#preview_form_container' ).length > 0;
|
||||
var isRTL = window.getComputedStyle( $element[ 0 ], null ).getPropertyValue( 'direction' ) === 'rtl';
|
||||
var overrides = {
|
||||
showOtherMonths: false,
|
||||
beforeShow: function( input, inst ) {
|
||||
inst.dpDiv[0].classList.remove( 'gform-theme-datepicker' );
|
||||
inst.dpDiv[0].classList.remove( 'gravity-theme' );
|
||||
inst.dpDiv[0].classList.remove( 'gform-theme' );
|
||||
inst.dpDiv[0].classList.remove( 'gform-legacy-datepicker' );
|
||||
inst.dpDiv[0].classList.remove( 'gform-theme--framework' );
|
||||
inst.dpDiv[0].classList.remove( 'gform-theme--foundation' );
|
||||
inst.dpDiv[0].classList.remove( 'gform-theme--orbital' );
|
||||
inst.dpDiv[0].classList.add( 'gform-legacy-datepicker' );
|
||||
|
||||
if ( isRTL && isPreview ) {
|
||||
var $inputContainer = $( input ).closest( '.gfield' );
|
||||
var rightOffset = $( document ).outerWidth() - ( $inputContainer.offset().left + $inputContainer.outerWidth() );
|
||||
inst.dpDiv[ 0 ].style.right = rightOffset + 'px';
|
||||
}
|
||||
|
||||
if ( isPreview ) {
|
||||
inst.dpDiv[0].classList.add( 'gform-preview-datepicker' );
|
||||
}
|
||||
return ! this.suppressDatePicker;
|
||||
}
|
||||
};
|
||||
|
||||
return Object.assign( optionsObj, overrides );
|
||||
}, -10 );
|
||||
1
wp/wp-content/plugins/gravityforms/js/datepicker-legacy.min.js
vendored
Normal file
1
wp/wp-content/plugins/gravityforms/js/datepicker-legacy.min.js
vendored
Normal file
@@ -0,0 +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);
|
||||
209
wp/wp-content/plugins/gravityforms/js/datepicker.js
Normal file
209
wp/wp-content/plugins/gravityforms/js/datepicker.js
Normal file
@@ -0,0 +1,209 @@
|
||||
(function ($, gform, gform_i18n) {
|
||||
|
||||
/**
|
||||
* @function getDatepickerI18n
|
||||
* @description Return month and day of week strings for use in the datepicker instances.
|
||||
* @since 2.5
|
||||
*
|
||||
* @returns {{
|
||||
* dayNamesMin: *[],
|
||||
* monthNamesShort: *[]
|
||||
* }}
|
||||
*/
|
||||
|
||||
function getDatepickerI18n() {
|
||||
var i18n = gform_i18n.datepicker;
|
||||
return {
|
||||
dayNamesMin: [
|
||||
i18n.days.sunday,
|
||||
i18n.days.monday,
|
||||
i18n.days.tuesday,
|
||||
i18n.days.wednesday,
|
||||
i18n.days.thursday,
|
||||
i18n.days.friday,
|
||||
i18n.days.saturday,
|
||||
],
|
||||
monthNamesShort: [
|
||||
i18n.months.january,
|
||||
i18n.months.february,
|
||||
i18n.months.march,
|
||||
i18n.months.april,
|
||||
i18n.months.may,
|
||||
i18n.months.june,
|
||||
i18n.months.july,
|
||||
i18n.months.august,
|
||||
i18n.months.september,
|
||||
i18n.months.october,
|
||||
i18n.months.november,
|
||||
i18n.months.december,
|
||||
],
|
||||
firstDay: i18n.firstDay,
|
||||
iconText: i18n.iconText,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @function getDatepickerBaseOptions
|
||||
* @description Return base options object that configures the datepicker.
|
||||
* @param $element The datepicker trigger.
|
||||
* @since 2.5
|
||||
*
|
||||
* @returns {{
|
||||
* suppressDatePicker: boolean,
|
||||
* changeMonth: boolean,
|
||||
* changeYear: boolean,
|
||||
* onClose: onClose,
|
||||
* yearRange: string,
|
||||
* dateFormat: string,
|
||||
* showOn: string,
|
||||
* dayNamesMin: *[],
|
||||
* monthNamesShort: *[],
|
||||
* beforeShow: (function(*, *): boolean),
|
||||
* showOtherMonths: boolean
|
||||
* }}
|
||||
*/
|
||||
|
||||
function getDatepickerBaseOptions( $element ) {
|
||||
var i18n = getDatepickerI18n();
|
||||
var isThemeDatepicker = $element.closest( '.gform_wrapper' ).length > 0;
|
||||
var isPreview = $( '#preview_form_container' ).length > 0;
|
||||
var isRTL = window.getComputedStyle($element[0], null).getPropertyValue('direction') === 'rtl';
|
||||
var formTheme = isThemeDatepicker ? $element.closest( '.gform_wrapper' ).data( 'form-theme' ) : 'gravity-theme';
|
||||
var formId = isThemeDatepicker ? $element.closest( '.gform_wrapper' ).attr( 'id' ).replace( 'gform_wrapper_', '' ) : '';
|
||||
var formPageInstance = isThemeDatepicker ? $element.closest( '.gform_wrapper' ).attr( 'data-form-index' ) : '';
|
||||
|
||||
return {
|
||||
yearRange: '-100:+20',
|
||||
showOn: 'focus',
|
||||
dateFormat: 'mm/dd/yy',
|
||||
dayNamesMin: i18n.dayNamesMin,
|
||||
monthNamesShort: i18n.monthNamesShort,
|
||||
firstDay: i18n.firstDay,
|
||||
changeMonth: true,
|
||||
changeYear: true,
|
||||
isRTL: isRTL,
|
||||
showOtherMonths: isThemeDatepicker,
|
||||
suppressDatePicker: false,
|
||||
onClose: function() {
|
||||
var self = this;
|
||||
$element.focus();
|
||||
this.suppressDatePicker = true;
|
||||
setTimeout( function() {
|
||||
self.suppressDatePicker = false;
|
||||
}, 200 );
|
||||
},
|
||||
beforeShow: function( input, inst ) {
|
||||
|
||||
// Remove any classes that were added before as it could have been added to a different datepicker.
|
||||
inst.dpDiv[0].classList.remove( 'gform-theme-datepicker' );
|
||||
inst.dpDiv[0].classList.remove( 'gravity-theme' );
|
||||
inst.dpDiv[0].classList.remove( 'gform-theme' );
|
||||
inst.dpDiv[0].classList.remove( 'gform-legacy-datepicker' );
|
||||
inst.dpDiv[0].classList.remove( 'gform-theme--framework' );
|
||||
inst.dpDiv[0].classList.remove( 'gform-theme--foundation' );
|
||||
inst.dpDiv[0].classList.remove( 'gform-theme--orbital' );
|
||||
|
||||
// Add classes based on the form theme
|
||||
if ( isThemeDatepicker ) {
|
||||
inst.dpDiv[ 0 ].classList.add( 'gform-theme-datepicker' );
|
||||
$( inst.dpDiv[ 0 ] ).attr( 'data-parent-form', formId + '_' + formPageInstance );
|
||||
}
|
||||
|
||||
if ( formTheme === undefined || formTheme === 'gravity-theme' ) {
|
||||
$( inst.dpDiv[0] ).addClass( 'gravity-theme' );
|
||||
} else if ( formTheme === 'legacy' ) {
|
||||
$( inst.dpDiv[0] ).addClass( 'gform-legacy-datepicker' );
|
||||
} else {
|
||||
$( inst.dpDiv[0] ).addClass( 'gform-theme--' + formTheme );
|
||||
if ( formTheme === 'orbital' ) {
|
||||
$( inst.dpDiv[0] ).addClass( 'gform-theme--framework' );
|
||||
$( inst.dpDiv[0] ).addClass( 'gform-theme--foundation' );
|
||||
}
|
||||
}
|
||||
|
||||
// If the form is in preview mode and the site is RTL, adjust the datepicker position.
|
||||
if ( isRTL && isPreview ) {
|
||||
var $inputContainer = $( input ).closest( '.gfield' );
|
||||
var rightOffset = $( document ).outerWidth() - ( $inputContainer.offset().left + $inputContainer.outerWidth() );
|
||||
inst.dpDiv[ 0 ].style.right = rightOffset + 'px';
|
||||
}
|
||||
|
||||
return ! this.suppressDatePicker;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @function initSingleDatepicker
|
||||
* @description Initialize a datepicker assigning various additional options based on the trigger element.
|
||||
* @param $element The datepicker trigger.
|
||||
* @since 2.4
|
||||
*/
|
||||
|
||||
function initSingleDatepicker( $element ) {
|
||||
var i18n = getDatepickerI18n();
|
||||
var inputId = $element.attr( 'id' ) ? $element.attr( 'id' ) : '';
|
||||
var optionsObj = getDatepickerBaseOptions( $element );
|
||||
|
||||
if ( $element.hasClass( 'dmy' ) ) {
|
||||
optionsObj.dateFormat = 'dd/mm/yy';
|
||||
} else if ( $element.hasClass( 'dmy_dash' ) ) {
|
||||
optionsObj.dateFormat = 'dd-mm-yy';
|
||||
} else if ( $element.hasClass( 'dmy_dot' ) ) {
|
||||
optionsObj.dateFormat = 'dd.mm.yy';
|
||||
} else if ( $element.hasClass( 'ymd_slash' ) ) {
|
||||
optionsObj.dateFormat = 'yy/mm/dd';
|
||||
} else if ( $element.hasClass( 'ymd_dash' ) ) {
|
||||
optionsObj.dateFormat = 'yy-mm-dd';
|
||||
} else if ( $element.hasClass( 'ymd_dot' ) ) {
|
||||
optionsObj.dateFormat = 'yy.mm.dd';
|
||||
}
|
||||
|
||||
if ( $element.hasClass( 'gdatepicker_with_icon' ) ) {
|
||||
optionsObj.showOn = 'both';
|
||||
optionsObj.buttonImage = $element.parent().siblings( "[id^='gforms_calendar_icon_input']" ).val();
|
||||
optionsObj.buttonImageOnly = true;
|
||||
optionsObj.buttonText = i18n.iconText;
|
||||
} else {
|
||||
optionsObj.showOn = 'focus';
|
||||
}
|
||||
|
||||
inputId = inputId.split( '_' );
|
||||
|
||||
// allow the user to override the datepicker options object
|
||||
optionsObj = gform.applyFilters( 'gform_datepicker_options_pre_init', optionsObj, inputId[ 1 ], inputId[ 2 ], $element );
|
||||
|
||||
$element.datepicker( optionsObj );
|
||||
|
||||
// We give the input focus after selecting a date which differs from default Datepicker behavior; this prevents
|
||||
// users from clicking on the input again to open the datepicker. Let's add a manual click event to handle this.
|
||||
if ( $element.is( ':input' ) ) {
|
||||
$element.click( function() {
|
||||
$element.datepicker( 'show' );
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @function initDatepickers
|
||||
* @description Iterate over uninitialized datepickers and init. Exposed on window as gformInitDatepicker.
|
||||
* Note: this function powers both admin and theme datepickers.
|
||||
* @since 2.4
|
||||
*/
|
||||
|
||||
function initDatepickers() {
|
||||
$( '.gform-datepicker:not(.initialized)' ).each( function() {
|
||||
var $element = $( this );
|
||||
initSingleDatepicker( $element );
|
||||
$element.addClass( 'initialized' );
|
||||
} );
|
||||
}
|
||||
|
||||
$( document ).ready( initDatepickers );
|
||||
|
||||
// Make all and single init functions public for add-ons.
|
||||
// Naming is done in the 2.4 backwards compatible way.
|
||||
window.gformInitDatepicker = initDatepickers;
|
||||
window.gformInitSingleDatepicker = initSingleDatepicker;
|
||||
|
||||
})(jQuery, gform, gform_i18n);
|
||||
1
wp/wp-content/plugins/gravityforms/js/datepicker.min.js
vendored
Normal file
1
wp/wp-content/plugins/gravityforms/js/datepicker.min.js
vendored
Normal file
@@ -0,0 +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);
|
||||
115
wp/wp-content/plugins/gravityforms/js/duplicate-submissions.js
Normal file
115
wp/wp-content/plugins/gravityforms/js/duplicate-submissions.js
Normal file
@@ -0,0 +1,115 @@
|
||||
/**
|
||||
* Provides functionality to allow browsers to re-submit forms without creating duplicate submissions.
|
||||
*/
|
||||
(function() {
|
||||
|
||||
var config = window.gf_duplicate_submissions || {};
|
||||
|
||||
/**
|
||||
* Check if the current browser is Safari.
|
||||
*
|
||||
* @returns {boolean}
|
||||
*/
|
||||
var isSafari = function() {
|
||||
var ua = window.navigator.userAgent;
|
||||
var iOS = !!ua.match( /iP(ad|od|hone)/i );
|
||||
var hasSafariInUa = !!ua.match( /Safari/i );
|
||||
var noOtherBrowsersInUa = !ua.match( /Chrome|CriOS|OPiOS|mercury|FxiOS|Firefox/i )
|
||||
var result = false;
|
||||
|
||||
if ( iOS ) { //detecting Safari in IOS mobile browsers
|
||||
var webkit = !!ua.match( /WebKit/i );
|
||||
result = webkit && hasSafariInUa && noOtherBrowsersInUa;
|
||||
} else if ( window.safari !== undefined ) { //detecting Safari in Desktop Browsers
|
||||
result = true;
|
||||
} else { // detecting Safari in other platforms
|
||||
result = hasSafariInUa && noOtherBrowsersInUa;
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* Update a Query Var based on the provided key/value.
|
||||
*
|
||||
* @param {string} key The key to update.
|
||||
* @param {string} value The value to which the key should be updated.
|
||||
* @param {string} url The URL to update.
|
||||
*
|
||||
* @returns {string}
|
||||
*/
|
||||
var updateQueryVar = function( key, value, url ) {
|
||||
var separator = '?';
|
||||
|
||||
var hashSplit = url.split( '#' ),
|
||||
hash = hashSplit[ 1 ] ? '#' + hashSplit[ 1 ] : '',
|
||||
querySplit = hashSplit[ 0 ].split( '?' ),
|
||||
host = querySplit[ 0 ],
|
||||
query = querySplit[ 1 ],
|
||||
params = query !== undefined ? query.split( '&' ) : [],
|
||||
updated = false;
|
||||
|
||||
for ( var index = 0; index < params.length; index++ ) {
|
||||
var item = params[ index ];
|
||||
|
||||
// No need to process this parameter since it doesn't match the one we're updating.
|
||||
if ( ! item.startsWith( key + '=' ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Update the param if the value is non-empty, otherwise remove it.
|
||||
if ( value.length > 0 ) {
|
||||
params[ index ] = key + '=' + value;
|
||||
} else {
|
||||
params.splice( index, 1 );
|
||||
}
|
||||
|
||||
updated = true;
|
||||
}
|
||||
|
||||
// Param didn't already exist; if the value is non-empty, add it to the param array.
|
||||
if ( ! updated && value.length > 0 ) {
|
||||
params[ params.length ] = key + '=' + value;
|
||||
}
|
||||
|
||||
var queryString = params.join( '&' );
|
||||
|
||||
return host + separator + queryString + hash;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the properly-formatted URL for redirects.
|
||||
*
|
||||
* @returns {string}
|
||||
*/
|
||||
var getFormattedURL = function() {
|
||||
var baseUrl = updateQueryVar( config.safari_redirect_param, '', window.location.href );
|
||||
var safariUrl = updateQueryVar( config.safari_redirect_param, '1', window.location.href );
|
||||
|
||||
console.log( baseUrl, safariUrl );
|
||||
|
||||
return isSafari() ? safariUrl : baseUrl;
|
||||
};
|
||||
|
||||
/**
|
||||
* Replace the current history state to avoid duplicate submissions.
|
||||
*/
|
||||
var handleReplaceState = function() {
|
||||
window.history.replaceState( null, null, getFormattedURL() );
|
||||
};
|
||||
|
||||
/**
|
||||
* Initialize.
|
||||
*/
|
||||
var init = function() {
|
||||
if ( window.gf_duplicate_submissions_initialized || config.is_gf_submission !== '1' || !window.history.replaceState ) {
|
||||
return;
|
||||
}
|
||||
|
||||
window.gf_duplicate_submissions_initialized = true;
|
||||
|
||||
handleReplaceState();
|
||||
};
|
||||
|
||||
init();
|
||||
})();
|
||||
1
wp/wp-content/plugins/gravityforms/js/duplicate-submissions.min.js
vendored
Normal file
1
wp/wp-content/plugins/gravityforms/js/duplicate-submissions.min.js
vendored
Normal file
@@ -0,0 +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()))}();
|
||||
2299
wp/wp-content/plugins/gravityforms/js/form_admin.js
Normal file
2299
wp/wp-content/plugins/gravityforms/js/form_admin.js
Normal file
File diff suppressed because it is too large
Load Diff
1
wp/wp-content/plugins/gravityforms/js/form_admin.min.js
vendored
Normal file
1
wp/wp-content/plugins/gravityforms/js/form_admin.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
4815
wp/wp-content/plugins/gravityforms/js/form_editor.js
Normal file
4815
wp/wp-content/plugins/gravityforms/js/form_editor.js
Normal file
File diff suppressed because one or more lines are too long
1
wp/wp-content/plugins/gravityforms/js/form_editor.min.js
vendored
Normal file
1
wp/wp-content/plugins/gravityforms/js/form_editor.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
78
wp/wp-content/plugins/gravityforms/js/forms.js
Normal file
78
wp/wp-content/plugins/gravityforms/js/forms.js
Normal file
@@ -0,0 +1,78 @@
|
||||
function Form(){
|
||||
this.id = 0;
|
||||
this.title = gf_vars.formTitle;
|
||||
this.description = gf_vars.formDescription;
|
||||
this.labelPlacement = "top_label";
|
||||
this.subLabelPlacement = "below";
|
||||
this.maxEntriesMessage = "";
|
||||
this.confirmation = new Confirmation();
|
||||
this.button = new Button();
|
||||
this.fields = new Array();
|
||||
}
|
||||
|
||||
function Confirmation(){
|
||||
this.type = "message";
|
||||
this.message = gf_vars.formConfirmationMessage;
|
||||
this.url = "";
|
||||
this.pageId = "";
|
||||
this.queryString="";
|
||||
}
|
||||
|
||||
function Button(){
|
||||
this.type = "text";
|
||||
this.text = gf_vars.buttonText;
|
||||
this.imageUrl = "";
|
||||
}
|
||||
|
||||
function Field(id, type){
|
||||
this.id = id;
|
||||
this.formId = window.form.id;
|
||||
this.label = "";
|
||||
this.adminLabel = "";
|
||||
this.type = type;
|
||||
this.isRequired = false;
|
||||
this.size = "large";
|
||||
this.errorMessage = "";
|
||||
this.visibility = "visible";
|
||||
//NOTE: other properties will be added dynamically using associative array syntax
|
||||
}
|
||||
|
||||
function Choice(text, value, price){
|
||||
this.text=text;
|
||||
this.value = value ? value : text;
|
||||
this.isSelected = false;
|
||||
this.price = price ? price : "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a form Input object.
|
||||
*
|
||||
* @since unknown
|
||||
* @since 2.5
|
||||
*
|
||||
* @param {string|int} id The input ID.
|
||||
* @param {string} label The input label.
|
||||
* @param {string} [autocompleteAttribute] The autocomplete attribute value.
|
||||
*/
|
||||
function Input( id, label, autocompleteAttribute ) {
|
||||
this.id = id;
|
||||
this.label = label;
|
||||
this.name = "";
|
||||
|
||||
if ( typeof autocompleteAttribute !== "undefined" ) {
|
||||
this.autocompleteAttribute = autocompleteAttribute;
|
||||
}
|
||||
}
|
||||
|
||||
function ConditionalLogic(){
|
||||
this.actionType = "show"; //show or hide
|
||||
this.logicType = "all"; //any or all
|
||||
this.rules = [new ConditionalRule()];
|
||||
}
|
||||
|
||||
function ConditionalRule(){
|
||||
this.fieldId = 0;
|
||||
this.operator = "is"; //is or isnot
|
||||
this.value = "";
|
||||
}
|
||||
|
||||
1
wp/wp-content/plugins/gravityforms/js/forms.min.js
vendored
Normal file
1
wp/wp-content/plugins/gravityforms/js/forms.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
function Form(){this.id=0,this.title=gf_vars.formTitle,this.description=gf_vars.formDescription,this.labelPlacement="top_label",this.subLabelPlacement="below",this.maxEntriesMessage="",this.confirmation=new Confirmation,this.button=new Button,this.fields=new Array}function Confirmation(){this.type="message",this.message=gf_vars.formConfirmationMessage,this.url="",this.pageId="",this.queryString=""}function Button(){this.type="text",this.text=gf_vars.buttonText,this.imageUrl=""}function Field(i,t){this.id=i,this.formId=window.form.id,this.label="",this.adminLabel="",this.type=t,this.isRequired=!1,this.size="large",this.errorMessage="",this.visibility="visible"}function Choice(i,t,s){this.text=i,this.value=t||i,this.isSelected=!1,this.price=s||""}function Input(i,t,s){this.id=i,this.label=t,this.name="",void 0!==s&&(this.autocompleteAttribute=s)}function ConditionalLogic(){this.actionType="show",this.logicType="all",this.rules=[new ConditionalRule]}function ConditionalRule(){this.fieldId=0,this.operator="is",this.value=""}
|
||||
377
wp/wp-content/plugins/gravityforms/js/gf_field_filter.js
Normal file
377
wp/wp-content/plugins/gravityforms/js/gf_field_filter.js
Normal file
@@ -0,0 +1,377 @@
|
||||
(function (gfFieldFilterUI, $) {
|
||||
|
||||
$.fn.gfFilterUI = function(filterSettings, initVars, allowMultiple, minResizeHeight) {
|
||||
init(this, filterSettings, initVars, allowMultiple, minResizeHeight );
|
||||
return this;
|
||||
};
|
||||
|
||||
// private
|
||||
var $container, operatorStrings, settings, filters, mode, imagesURL, isResizable, allowMultiple, height;
|
||||
|
||||
function init (c, s, initVars, m, h){
|
||||
$container = $(c);
|
||||
$container
|
||||
.css('position' , 'relative')
|
||||
.html('<div id="gform-field-filters"></div>');
|
||||
height = h;
|
||||
isResizable = typeof height != 'undefined' && height > 0;
|
||||
operatorStrings = {"is":"is","isnot":"isNot", ">":"greaterThan", "<":"lessThan", "contains":"contains", "starts_with":"startsWith", "ends_with":"endsWith"};
|
||||
imagesURL = gf_vars.baseUrl + "/images";
|
||||
settings = s;
|
||||
filters = initVars && initVars.filters ? initVars.filters : [];
|
||||
mode = initVars && initVars.mode ? initVars.mode : "all";
|
||||
allowMultiple = typeof m == 'undefined' || m ? true : false ;
|
||||
|
||||
setUpFilters(filters);
|
||||
|
||||
}
|
||||
|
||||
function setUpFilters(filters) {
|
||||
var i;
|
||||
|
||||
$container.on('change', '.gform-filter-field', function(){
|
||||
changeField(this);
|
||||
});
|
||||
|
||||
$container.on( 'click', '#gform-no-filters', function() {
|
||||
if ( $( '.gform-field-filter' ).length == 0 ) {
|
||||
addNewFieldFilter( this );
|
||||
}
|
||||
$( this ).remove();
|
||||
});
|
||||
|
||||
$container.on( 'click', '.gform-add', function( e ) {
|
||||
addNewFieldFilter( this );
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
$container.on('click', '.gform-remove', function(){
|
||||
removeFieldFilter(this);
|
||||
});
|
||||
|
||||
$container.on('change', '.gform-filter-operator', function(){
|
||||
changeOperator(this, this.value);
|
||||
});
|
||||
|
||||
if (typeof filters == 'undefined' || filters.length == 0){
|
||||
displayNoFiltersMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
if(mode != "off"){
|
||||
$("#gform-field-filters").append(getFilterMode(mode));
|
||||
}
|
||||
|
||||
for (i = 0; i < filters.length; i++) {
|
||||
$("#gform-field-filters").append(getNewFilterRow());
|
||||
}
|
||||
|
||||
|
||||
$(".gform-filter-field").each(function (i) {
|
||||
var fieldId = filters[i].field;
|
||||
jQuery(this).val(fieldId);
|
||||
changeField(this);
|
||||
});
|
||||
$(".gform-filter-operator").each(function (i) {
|
||||
var operator = filters[i].operator;
|
||||
jQuery(this).val(operator);
|
||||
changeOperator(this, this.value);
|
||||
});
|
||||
|
||||
$(".gform-filter-value").each(function (i) {
|
||||
var value = filters[i].value;
|
||||
jQuery(this).val(value);
|
||||
jQuery(this).change();
|
||||
});
|
||||
|
||||
maybeMakeResizable()
|
||||
}
|
||||
|
||||
function getNewFilterRow() {
|
||||
var str;
|
||||
str = "<div class='gform-field-filter'>";
|
||||
str += getFilterFields() + getFilterOperators() + getFilterValues() + getAddRemoveButtons();
|
||||
str += "</div>";
|
||||
return str;
|
||||
}
|
||||
|
||||
function getFilterFields() {
|
||||
var i, select = [], optionsHTML;
|
||||
select.push("<select class='gform-filter-field' name='f[]' >");
|
||||
for (i = 0; i < settings.length; i++) {
|
||||
optionsHTML = getOptions( settings[i] );
|
||||
select.push( optionsHTML );
|
||||
|
||||
}
|
||||
select.push("</select>");
|
||||
select.push("<input type='hidden' class='gform-filter-type' name='t[]' value='' >");
|
||||
return select.join('');
|
||||
}
|
||||
|
||||
function getOptions(setting, depth) {
|
||||
if ( ! depth ) {
|
||||
depth = 0;
|
||||
}
|
||||
var j, key, val, label, groupLabel, options, disabled = "", numRows,
|
||||
select = [], subFilter, subFilterGroup, newDepth, indent, indentString = ' ';
|
||||
key = setting.key;
|
||||
|
||||
if (setting.group) {
|
||||
numRows = setting.filters.length;
|
||||
options = [];
|
||||
newDepth = setting.isNestable ? depth + 1 : depth;
|
||||
for (j = 0; j < numRows; j++) {
|
||||
subFilter = setting.filters[j];
|
||||
if (subFilter.group) {
|
||||
subFilterGroup = getOptions(subFilter, newDepth);
|
||||
options.push(subFilterGroup);
|
||||
continue;
|
||||
}
|
||||
indent = indentString.repeat(newDepth);
|
||||
label = indent + subFilter.text;
|
||||
val = subFilter.key;
|
||||
disabled = isFieldSelected(val) ? 'disabled="disabled"' : "";
|
||||
options.push('<option {0} value="{1}">{2}</option>'.gformFormat(disabled, val, label));
|
||||
}
|
||||
indent = indentString.repeat(depth);
|
||||
groupLabel = indent + setting.text;
|
||||
if ( setting.isNestable ) {
|
||||
// Optgroups can't be nested so close the optgroup immediately and fake the nested options with indentation.
|
||||
select.push('<optgroup label="{0}"></optgroup>{1}'.gformFormat(groupLabel, options.join('')));
|
||||
} else {
|
||||
select.push('<optgroup label="{0}">{1}</optgroup>'.gformFormat(groupLabel, options.join('')));
|
||||
}
|
||||
} else {
|
||||
disabled = setting.preventMultiple && isFieldSelected(key) ? "disabled='disabled'" : "";
|
||||
label = setting.text;
|
||||
select.push('<option {0} value="{1}">{2}</option>'.gformFormat(disabled, key, label));
|
||||
}
|
||||
return select.join('');
|
||||
}
|
||||
|
||||
function changeOperator (operatorSelect) {
|
||||
var $select = $(operatorSelect);
|
||||
var $fieldSelect = $select.siblings('.gform-filter-field');
|
||||
var filter = getFilter($fieldSelect.val());
|
||||
if (filter) {
|
||||
$select.siblings(".gform-filter-value").replaceWith(getFilterValues(filter, operatorSelect.value));
|
||||
}
|
||||
setDisabledFields();
|
||||
if(window['gformInitDatepicker']) {gformInitDatepicker();}
|
||||
}
|
||||
|
||||
function changeField (fieldSelect) {
|
||||
var filter = getFilter(fieldSelect.value);
|
||||
if (filter) {
|
||||
var $select = $(fieldSelect);
|
||||
$select.siblings(".gform-filter-value").replaceWith(getFilterValues(filter));
|
||||
$select.siblings(".gform-filter-type").val(filter.type);
|
||||
$select.siblings(".gform-filter-operator").replaceWith(getFilterOperators(filter));
|
||||
$select.siblings(".gform-filter-operator").change();
|
||||
}
|
||||
setDisabledFields();
|
||||
}
|
||||
|
||||
function isFieldSelected (fieldId) {
|
||||
fieldId = fieldId.toString();
|
||||
var selectedFields = [];
|
||||
$('.gform-filter-field :selected').each(function (i, selected) {
|
||||
selectedFields[i] = $(selected).val();
|
||||
});
|
||||
return $.inArray(fieldId, selectedFields) > -1 ? true : false;
|
||||
}
|
||||
|
||||
function getFilterOperators (filter) {
|
||||
var i, operator,
|
||||
str = "<select name='o[]' class='gform-filter-operator'>";
|
||||
if (filter) {
|
||||
for (i = 0; i < filter.operators.length; i++) {
|
||||
operator = filter.operators[i];
|
||||
str += '<option value="{0}">{1}</option>'.gformFormat(operator, gf_vars[operatorStrings[operator]] );
|
||||
}
|
||||
}
|
||||
str += "</select>";
|
||||
return str;
|
||||
}
|
||||
|
||||
function getFilterValues (filter, selectedOperator) {
|
||||
var i, val, text, str, options = "", placeholder, cssClass, supporterOperators;
|
||||
cssClass = 'gform-filter-value';
|
||||
|
||||
if ( filter && typeof filter.cssClass != 'undefined' ) {
|
||||
cssClass += ' ' + filter.cssClass;
|
||||
}
|
||||
|
||||
if ( filter && filter.values && selectedOperator != 'contains' ) {
|
||||
|
||||
if ( typeof filter.placeholder != 'undefined' ){
|
||||
options += '<option value="">{0}</option>'.gformFormat(filter.placeholder);
|
||||
}
|
||||
|
||||
for (i = 0; i < filter.values.length; i++) {
|
||||
val = filter.values[i].value;
|
||||
text = filter.values[i].text;
|
||||
if ( filter.values[i].operators && $.inArray( selectedOperator, filter.values[i].operators ) === -1 ) {
|
||||
continue;
|
||||
}
|
||||
options += '<option value="{0}">{1}</option>'.gformFormat(val, text);
|
||||
}
|
||||
str = "<select name='v[]' class='{0}'>{1}</select>".gformFormat(cssClass, options);
|
||||
} else {
|
||||
placeholder = ( filter && typeof filter.placeholder != 'undefined' ) ? "placeholder='{0}'".gformFormat(filter.placeholder) : '';
|
||||
|
||||
str = "<input type='text' value='' name='v[]' class='{0}' {1}/>".gformFormat(cssClass, placeholder);
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
function getFilter (key, group) {
|
||||
var f;
|
||||
|
||||
if (!key) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!group) {
|
||||
group = settings;
|
||||
}
|
||||
|
||||
for (var i = 0; i < group.length; i++) {
|
||||
if (key == group[i].key) {
|
||||
return group[i];
|
||||
} else if (group[i].group) {
|
||||
f = getFilter(key, group[i].filters);
|
||||
if ( f ) {
|
||||
return f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getAddRemoveButtons () {
|
||||
var str = "";
|
||||
if(!allowMultiple)
|
||||
return str;
|
||||
|
||||
str += "<button " +
|
||||
"class='gform-add add_field_choice gform-st-icon gform-st-icon--circle-plus' " +
|
||||
"title='{0}'" +
|
||||
"></button>".gformFormat(gf_vars.addFieldFilter);
|
||||
str += "<button " +
|
||||
"class='gform-remove delete_field_choice gform-st-icon gform-st-icon--circle-minus' " +
|
||||
"title='" + gf_vars.removeFieldFilter + "'" +
|
||||
"></button>";
|
||||
return str;
|
||||
}
|
||||
|
||||
function maybeMakeResizable () {
|
||||
if(!isResizable)
|
||||
return;
|
||||
|
||||
var $filterBox = $("#gform-field-filters");
|
||||
|
||||
var $filters = $(".gform-field-filter");
|
||||
|
||||
if ($filters.length <= 1) {
|
||||
if ($($container).hasClass('ui-resizable'))
|
||||
$container.resizable('destroy');
|
||||
return;
|
||||
}
|
||||
var makeResizable = ($filterBox.get(0).scrollHeight > $container.height()) || $container.height() >= height;
|
||||
|
||||
if (makeResizable) {
|
||||
$container
|
||||
.css({'min-height': height + 'px' , 'border-bottom': '5px double #DDD'})
|
||||
.resizable({
|
||||
handles : 's',
|
||||
minHeight: height
|
||||
});
|
||||
$filterBox.css("min-height", height);
|
||||
} else {
|
||||
$container.css({'min-height': '', 'border-bottom': ''});
|
||||
}
|
||||
}
|
||||
|
||||
function displayNoFiltersMessage () {
|
||||
var str = "";
|
||||
str += "<div id='gform-no-filters' >" + gf_vars.addFieldFilter;
|
||||
str += "<button " +
|
||||
"class='gform-add add_field_choice gform-st-icon gform-st-icon--circle-plus' " +
|
||||
"title='{0}'" +
|
||||
"></div>".gformFormat(gf_vars.addFieldFilter);
|
||||
$("#gform-field-filters").html(str);
|
||||
if(isResizable){
|
||||
$container.css({'min-height': '', 'border-bottom': ''});
|
||||
$container.height(80);
|
||||
$("#gform-field-filters").css("min-height", '');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function setDisabledFields () {
|
||||
$("select.gform-filter-field option").removeAttr("disabled");
|
||||
$("select.gform-filter-field").each(function (i) {
|
||||
var filter = getFilter(this.value);
|
||||
if (typeof(filter) != 'undefined' && filter.preventMultiple && isFieldSelected(this.value)) {
|
||||
$("select.gform-filter-field option[value='" + this.value + "']:not(:selected)").attr('disabled', 'disabled');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function getFilterMode(mode){
|
||||
var html;
|
||||
html = '<select name="mode"><option value="all" {0}>{1}</option><option value="any" {2}>{3}</option></select>'.gformFormat(selected("all", mode), gf_vars.all, selected("any", mode), gf_vars.any);
|
||||
html = gf_vars.filterAndAny.gformFormat(html);
|
||||
return html
|
||||
}
|
||||
|
||||
function selected(selected, current){
|
||||
return selected == current ? 'selected="selected"' : "";
|
||||
}
|
||||
|
||||
function addFilterMode ($filterRow) {
|
||||
|
||||
$filterRow.after(getFilterMode());
|
||||
}
|
||||
|
||||
function addNewFieldFilter ( el ) {
|
||||
var $el, $filterRow;
|
||||
$el = $( el );
|
||||
if ( $el.is( "button" ) ) {
|
||||
$filterRow = $el.parent();
|
||||
} else {
|
||||
$filterRow = $el;
|
||||
}
|
||||
|
||||
$filterRow.after( getNewFilterRow() );
|
||||
$filterRow.next( "div" )
|
||||
.find( ".gform-filter-field" ).change()
|
||||
.find( ".gform-filter-operator" ).change();
|
||||
if ($( ".gform-field-filter" ).length == 1 ) {
|
||||
addFilterMode( $filterRow );
|
||||
}
|
||||
|
||||
maybeMakeResizable();
|
||||
}
|
||||
|
||||
function removeFieldFilter (img) {
|
||||
$(img).parent().remove();
|
||||
if ($(".gform-field-filter").length == 0)
|
||||
displayNoFiltersMessage();
|
||||
setDisabledFields();
|
||||
maybeMakeResizable();
|
||||
}
|
||||
|
||||
if ( ! String.prototype.gformFormat ) {
|
||||
String.prototype.gformFormat = function() {
|
||||
var args = arguments;
|
||||
return this.replace( /{(\d+)}/g, function( match, number ) {
|
||||
return typeof args[ number ] != 'undefined' ? args[ number ] : match;
|
||||
} );
|
||||
};
|
||||
}
|
||||
|
||||
}(window.gfFilterUI = window.gfFilterUI || {}, jQuery));
|
||||
1
wp/wp-content/plugins/gravityforms/js/gf_field_filter.min.js
vendored
Normal file
1
wp/wp-content/plugins/gravityforms/js/gf_field_filter.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
92
wp/wp-content/plugins/gravityforms/js/gforms_hooks.js
Normal file
92
wp/wp-content/plugins/gravityforms/js/gforms_hooks.js
Normal file
@@ -0,0 +1,92 @@
|
||||
|
||||
//----------------------------------------------------------
|
||||
//------ JAVASCRIPT HOOK FUNCTIONS FOR GRAVITY FORMS -------
|
||||
//----------------------------------------------------------
|
||||
|
||||
if ( ! gform ) {
|
||||
document.addEventListener( 'gform_main_scripts_loaded', function() { gform.scriptsLoaded = true; } );
|
||||
window.addEventListener( 'DOMContentLoaded', function() { gform.domLoaded = true; } );
|
||||
|
||||
var gform = {
|
||||
domLoaded: false,
|
||||
scriptsLoaded: false,
|
||||
initializeOnLoaded: function( fn ) {
|
||||
if ( gform.domLoaded && gform.scriptsLoaded ) {
|
||||
fn();
|
||||
} else if( ! gform.domLoaded && gform.scriptsLoaded ) {
|
||||
window.addEventListener( 'DOMContentLoaded', fn );
|
||||
} else {
|
||||
document.addEventListener( 'gform_main_scripts_loaded', fn );
|
||||
}
|
||||
},
|
||||
hooks: { action: {}, filter: {} },
|
||||
addAction: function( action, callable, priority, tag ) {
|
||||
gform.addHook( 'action', action, callable, priority, tag );
|
||||
},
|
||||
addFilter: function( action, callable, priority, tag ) {
|
||||
gform.addHook( 'filter', action, callable, priority, tag );
|
||||
},
|
||||
doAction: function( action ) {
|
||||
gform.doHook( 'action', action, arguments );
|
||||
},
|
||||
applyFilters: function( action ) {
|
||||
return gform.doHook( 'filter', action, arguments );
|
||||
},
|
||||
removeAction: function( action, tag ) {
|
||||
gform.removeHook( 'action', action, tag );
|
||||
},
|
||||
removeFilter: function( action, priority, tag ) {
|
||||
gform.removeHook( 'filter', action, priority, tag );
|
||||
},
|
||||
addHook: function( hookType, action, callable, priority, tag ) {
|
||||
if ( undefined == gform.hooks[hookType][action] ) {
|
||||
gform.hooks[hookType][action] = [];
|
||||
}
|
||||
var hooks = gform.hooks[hookType][action];
|
||||
if ( undefined == tag ) {
|
||||
tag = action + '_' + hooks.length;
|
||||
}
|
||||
if( priority == undefined ){
|
||||
priority = 10;
|
||||
}
|
||||
|
||||
gform.hooks[hookType][action].push( { tag:tag, callable:callable, priority:priority } );
|
||||
},
|
||||
doHook: function( hookType, action, args ) {
|
||||
|
||||
// splice args from object into array and remove first index which is the hook name
|
||||
args = Array.prototype.slice.call(args, 1);
|
||||
|
||||
if ( undefined != gform.hooks[hookType][action] ) {
|
||||
var hooks = gform.hooks[hookType][action], hook;
|
||||
//sort by priority
|
||||
hooks.sort(function(a,b){return a["priority"]-b["priority"]});
|
||||
|
||||
hooks.forEach( function( hookItem ) {
|
||||
hook = hookItem.callable;
|
||||
|
||||
if(typeof hook != 'function')
|
||||
hook = window[hook];
|
||||
if ( 'action' == hookType ) {
|
||||
hook.apply(null, args);
|
||||
} else {
|
||||
args[0] = hook.apply(null, args);
|
||||
}
|
||||
} );
|
||||
}
|
||||
if ( 'filter'==hookType ) {
|
||||
return args[0];
|
||||
}
|
||||
},
|
||||
removeHook: function( hookType, action, priority, tag ) {
|
||||
if ( undefined != gform.hooks[hookType][action] ) {
|
||||
var hooks = gform.hooks[hookType][action];
|
||||
hooks = hooks.filter( function(hook, index, arr) {
|
||||
var removeHook = (undefined==tag||tag==hook.tag) && (undefined==priority||priority==hook.priority);
|
||||
return !removeHook;
|
||||
} );
|
||||
gform.hooks[hookType][action] = hooks;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
1
wp/wp-content/plugins/gravityforms/js/gforms_hooks.min.js
vendored
Normal file
1
wp/wp-content/plugins/gravityforms/js/gforms_hooks.min.js
vendored
Normal file
@@ -0,0 +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)}});
|
||||
3522
wp/wp-content/plugins/gravityforms/js/gravityforms.js
Normal file
3522
wp/wp-content/plugins/gravityforms/js/gravityforms.js
Normal file
File diff suppressed because it is too large
Load Diff
1
wp/wp-content/plugins/gravityforms/js/gravityforms.min.js
vendored
Normal file
1
wp/wp-content/plugins/gravityforms/js/gravityforms.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
2
wp/wp-content/plugins/gravityforms/js/index.php
Normal file
2
wp/wp-content/plugins/gravityforms/js/index.php
Normal file
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
//Nothing to see here
|
||||
160
wp/wp-content/plugins/gravityforms/js/jquery.json-1.3.js
Normal file
160
wp/wp-content/plugins/gravityforms/js/jquery.json-1.3.js
Normal file
@@ -0,0 +1,160 @@
|
||||
/*
|
||||
* jQuery JSON Plugin
|
||||
* version: 1.0 (2008-04-17)
|
||||
*
|
||||
* This document is licensed as free software under the terms of the
|
||||
* MIT License: http://www.opensource.org/licenses/mit-license.php
|
||||
*
|
||||
* Brantley Harris technically wrote this plugin, but it is based somewhat
|
||||
* on the JSON.org website's http://www.json.org/json2.js, which proclaims:
|
||||
* "NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.", a sentiment that
|
||||
* I uphold. I really just cleaned it up.
|
||||
*
|
||||
* It is also based heavily on MochiKit's serializeJSON, which is
|
||||
* copywrited 2005 by Bob Ippolito.
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
function toIntegersAtLease(n)
|
||||
// Format integers to have at least two digits.
|
||||
{
|
||||
return n < 10 ? '0' + n : n;
|
||||
}
|
||||
|
||||
Date.prototype.toJSON = function(date)
|
||||
// Yes, it polutes the Date namespace, but we'll allow it here, as
|
||||
// it's damned usefull.
|
||||
{
|
||||
return this.getUTCFullYear() + '-' +
|
||||
toIntegersAtLease(this.getUTCMonth()) + '-' +
|
||||
toIntegersAtLease(this.getUTCDate());
|
||||
};
|
||||
|
||||
var escapeable = /["\\\x00-\x1f\x7f-\x9f]/g;
|
||||
var meta = { // table of character substitutions
|
||||
'\b': '\\b',
|
||||
'\t': '\\t',
|
||||
'\n': '\\n',
|
||||
'\f': '\\f',
|
||||
'\r': '\\r',
|
||||
'"' : '\\"',
|
||||
'\\': '\\\\'
|
||||
};
|
||||
|
||||
$.quoteString = function(string)
|
||||
// Places quotes around a string, inteligently.
|
||||
// If the string contains no control characters, no quote characters, and no
|
||||
// backslash characters, then we can safely slap some quotes around it.
|
||||
// Otherwise we must also replace the offending characters with safe escape
|
||||
// sequences.
|
||||
{
|
||||
//if (escapeable.test(string))
|
||||
//{
|
||||
return '"' + string.replace(escapeable, function (a)
|
||||
{
|
||||
var c = meta[a];
|
||||
if (typeof c === 'string') {
|
||||
return c;
|
||||
}
|
||||
c = a.charCodeAt();
|
||||
return '\\u00' + Math.floor(c / 16).toString(16) + (c % 16).toString(16);
|
||||
}) + '"';
|
||||
//}
|
||||
//else{
|
||||
// string = string.replace('\n','\\n');
|
||||
//}
|
||||
return '"' + string + '"';
|
||||
};
|
||||
|
||||
$.toJSON = function(o, compact)
|
||||
{
|
||||
var type = typeof(o);
|
||||
|
||||
if (type == "undefined")
|
||||
return "undefined";
|
||||
else if (type == "number" || type == "boolean")
|
||||
return o + "";
|
||||
else if (o === null)
|
||||
return "null";
|
||||
|
||||
// Is it a string?
|
||||
if (type == "string")
|
||||
{
|
||||
var str = $.quoteString(o);
|
||||
return str;
|
||||
}
|
||||
|
||||
// Does it have a .toJSON function?
|
||||
if (type == "object" && typeof o.toJSON == "function")
|
||||
return o.toJSON(compact);
|
||||
|
||||
// Is it an array?
|
||||
if (type != "function" && typeof(o.length) == "number")
|
||||
{
|
||||
var ret = [];
|
||||
for (var i = 0; i < o.length; i++) {
|
||||
ret.push( $.toJSON(o[i], compact) );
|
||||
}
|
||||
if (compact)
|
||||
return "[" + ret.join(",") + "]";
|
||||
else
|
||||
return "[" + ret.join(", ") + "]";
|
||||
}
|
||||
|
||||
// If it's a function, we have to warn somebody!
|
||||
if (type == "function") {
|
||||
throw new TypeError("Unable to convert object of type 'function' to json.");
|
||||
}
|
||||
|
||||
// It's probably an object, then.
|
||||
var ret = [];
|
||||
for (var k in o) {
|
||||
var name;
|
||||
type = typeof(k);
|
||||
|
||||
if (type == "number")
|
||||
name = '"' + k + '"';
|
||||
else if (type == "string")
|
||||
name = $.quoteString(k);
|
||||
else
|
||||
continue; //skip non-string or number keys
|
||||
|
||||
var val = $.toJSON(o[k], compact);
|
||||
if (typeof(val) != "string") {
|
||||
// skip non-serializable values
|
||||
continue;
|
||||
}
|
||||
|
||||
if (compact)
|
||||
ret.push(name + ":" + val);
|
||||
else
|
||||
ret.push(name + ": " + val);
|
||||
}
|
||||
return "{" + ret.join(", ") + "}";
|
||||
};
|
||||
|
||||
$.compactJSON = function(o)
|
||||
{
|
||||
return $.toJSON(o, true);
|
||||
};
|
||||
|
||||
$.evalJSON = function(src)
|
||||
// Evals JSON that we know to be safe.
|
||||
{
|
||||
return eval("(" + src + ")");
|
||||
};
|
||||
|
||||
$.secureEvalJSON = function(src)
|
||||
// Evals JSON in a way that is *more* secure.
|
||||
{
|
||||
var filtered = src;
|
||||
filtered = filtered.replace(/\\["\\\/bfnrtu]/g, '@');
|
||||
filtered = filtered.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']');
|
||||
filtered = filtered.replace(/(?:^|:|,)(?:\s*\[)+/g, '');
|
||||
|
||||
if (/^[\],:{}\s]*$/.test(filtered))
|
||||
return eval("(" + src + ")");
|
||||
else
|
||||
throw new SyntaxError("Error parsing JSON, source is not valid.");
|
||||
};
|
||||
})(jQuery);
|
||||
1
wp/wp-content/plugins/gravityforms/js/jquery.json-1.3.min.js
vendored
Normal file
1
wp/wp-content/plugins/gravityforms/js/jquery.json-1.3.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
!function($){function toIntegersAtLease(e){return e<10?"0"+e:e}Date.prototype.toJSON=function(e){return this.getUTCFullYear()+"-"+toIntegersAtLease(this.getUTCMonth())+"-"+toIntegersAtLease(this.getUTCDate())};var escapeable=/["\\\x00-\x1f\x7f-\x9f]/g,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};$.quoteString=function(e){return'"'+e.replace(escapeable,function(e){var t=meta[e];return"string"==typeof t?t:(t=e.charCodeAt(),"\\u00"+Math.floor(t/16).toString(16)+(t%16).toString(16))})+'"'},$.toJSON=function(e,t){var r=typeof e;if("undefined"==r)return"undefined";if("number"==r||"boolean"==r)return e+"";if(null===e)return"null";if("string"==r)return $.quoteString(e);if("object"==r&&"function"==typeof e.toJSON)return e.toJSON(t);if("function"!=r&&"number"==typeof e.length){for(var n=[],o=0;o<e.length;o++)n.push($.toJSON(e[o],t));return t?"["+n.join(",")+"]":"["+n.join(", ")+"]"}if("function"==r)throw new TypeError("Unable to convert object of type 'function' to json.");var i,f,n=[];for(i in e){if("number"==(r=typeof i))f='"'+i+'"';else{if("string"!=r)continue;f=$.quoteString(i)}var u=$.toJSON(e[i],t);"string"==typeof u&&(t?n.push(f+":"+u):n.push(f+": "+u))}return"{"+n.join(", ")+"}"},$.compactJSON=function(e){return $.toJSON(e,!0)},$.evalJSON=function(src){return eval("("+src+")")},$.secureEvalJSON=function(src){var filtered=src,filtered=filtered.replace(/\\["\\\/bfnrtu]/g,"@");if(filtered=filtered.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]"),filtered=filtered.replace(/(?:^|:|,)(?:\s*\[)+/g,""),/^[\],:{}\s]*$/.test(filtered))return eval("("+src+")");throw new SyntaxError("Error parsing JSON, source is not valid.")}}(jQuery);
|
||||
200
wp/wp-content/plugins/gravityforms/js/jquery.json.js
Normal file
200
wp/wp-content/plugins/gravityforms/js/jquery.json.js
Normal file
@@ -0,0 +1,200 @@
|
||||
/**
|
||||
* jQuery JSON plugin v2.5.1
|
||||
* https://github.com/Krinkle/jquery-json
|
||||
*
|
||||
* @author Brantley Harris, 2009-2011
|
||||
* @author Timo Tijhof, 2011-2014
|
||||
* @source This plugin is heavily influenced by MochiKit's serializeJSON, which is
|
||||
* copyrighted 2005 by Bob Ippolito.
|
||||
* @source Brantley Harris wrote this plugin. It is based somewhat on the JSON.org
|
||||
* website's http://www.json.org/json2.js, which proclaims:
|
||||
* "NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.", a sentiment that
|
||||
* I uphold.
|
||||
* @license MIT License <http://opensource.org/licenses/MIT>
|
||||
*/
|
||||
(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;
|
||||
|
||||
/**
|
||||
* jQuery.toJSON
|
||||
* Converts the given argument into a JSON representation.
|
||||
*
|
||||
* @param o {Mixed} The json-serializable *thing* to be converted
|
||||
*
|
||||
* If an object has a toJSON prototype, that will be used to get the representation.
|
||||
* Non-integer/string keys are skipped in the object, as are keys that point to a
|
||||
* function.
|
||||
*
|
||||
*/
|
||||
$.toJSON = typeof JSON === 'object' && JSON.stringify ? JSON.stringify : function (o) {
|
||||
if (o === null) {
|
||||
return 'null';
|
||||
}
|
||||
|
||||
var pairs, k, name, val,
|
||||
type = $.type(o);
|
||||
|
||||
if (type === 'undefined') {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Also covers instantiated Number and Boolean objects,
|
||||
// which are typeof 'object' but thanks to $.type, we
|
||||
// catch them here. I don't know whether it is right
|
||||
// or wrong that instantiated primitives are not
|
||||
// exported to JSON as an {"object":..}.
|
||||
// We choose this path because that's what the browsers did.
|
||||
if (type === 'number' || type === 'boolean') {
|
||||
return String(o);
|
||||
}
|
||||
if (type === 'string') {
|
||||
return $.quoteString(o);
|
||||
}
|
||||
if (typeof o.toJSON === 'function') {
|
||||
return $.toJSON(o.toJSON());
|
||||
}
|
||||
if (type === 'date') {
|
||||
var month = o.getUTCMonth() + 1,
|
||||
day = o.getUTCDate(),
|
||||
year = o.getUTCFullYear(),
|
||||
hours = o.getUTCHours(),
|
||||
minutes = o.getUTCMinutes(),
|
||||
seconds = o.getUTCSeconds(),
|
||||
milli = o.getUTCMilliseconds();
|
||||
|
||||
if (month < 10) {
|
||||
month = '0' + month;
|
||||
}
|
||||
if (day < 10) {
|
||||
day = '0' + day;
|
||||
}
|
||||
if (hours < 10) {
|
||||
hours = '0' + hours;
|
||||
}
|
||||
if (minutes < 10) {
|
||||
minutes = '0' + minutes;
|
||||
}
|
||||
if (seconds < 10) {
|
||||
seconds = '0' + seconds;
|
||||
}
|
||||
if (milli < 100) {
|
||||
milli = '0' + milli;
|
||||
}
|
||||
if (milli < 10) {
|
||||
milli = '0' + milli;
|
||||
}
|
||||
return '"' + year + '-' + month + '-' + day + 'T' +
|
||||
hours + ':' + minutes + ':' + seconds +
|
||||
'.' + milli + 'Z"';
|
||||
}
|
||||
|
||||
pairs = [];
|
||||
|
||||
if ($.isArray(o)) {
|
||||
for (k = 0; k < o.length; k++) {
|
||||
pairs.push($.toJSON(o[k]) || 'null');
|
||||
}
|
||||
return '[' + pairs.join(',') + ']';
|
||||
}
|
||||
|
||||
// Any other object (plain object, RegExp, ..)
|
||||
// Need to do typeof instead of $.type, because we also
|
||||
// want to catch non-plain objects.
|
||||
if (typeof o === 'object') {
|
||||
for (k in o) {
|
||||
// Only include own properties,
|
||||
// Filter out inherited prototypes
|
||||
if (hasOwn.call(o, k)) {
|
||||
// Keys must be numerical or string. Skip others
|
||||
type = typeof k;
|
||||
if (type === 'number') {
|
||||
name = '"' + k + '"';
|
||||
} else if (type === 'string') {
|
||||
name = $.quoteString(k);
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
type = typeof o[k];
|
||||
|
||||
// Invalid values like these return undefined
|
||||
// from toJSON, however those object members
|
||||
// shouldn't be included in the JSON string at all.
|
||||
if (type !== 'function' && type !== 'undefined') {
|
||||
val = $.toJSON(o[k]);
|
||||
pairs.push(name + ':' + val);
|
||||
}
|
||||
}
|
||||
}
|
||||
return '{' + pairs.join(',') + '}';
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* jQuery.evalJSON
|
||||
* Evaluates a given json string.
|
||||
*
|
||||
* @param str {String}
|
||||
*/
|
||||
$.evalJSON = typeof JSON === 'object' && JSON.parse ? JSON.parse : function (str) {
|
||||
/*jshint evil: true */
|
||||
return eval('(' + str + ')');
|
||||
};
|
||||
|
||||
/**
|
||||
* jQuery.secureEvalJSON
|
||||
* Evals JSON in a way that is *more* secure.
|
||||
*
|
||||
* @param str {String}
|
||||
*/
|
||||
$.secureEvalJSON = typeof JSON === 'object' && 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)) {
|
||||
/*jshint evil: true */
|
||||
return eval('(' + str + ')');
|
||||
}
|
||||
throw new SyntaxError('Error parsing JSON, source is not valid.');
|
||||
};
|
||||
|
||||
/**
|
||||
* jQuery.quoteString
|
||||
* Returns a string-repr of a string, escaping quotes intelligently.
|
||||
* Mostly a support function for toJSON.
|
||||
* Examples:
|
||||
* >>> jQuery.quoteString('apple')
|
||||
* "apple"
|
||||
*
|
||||
* >>> jQuery.quoteString('"Where are we going?", she asked.')
|
||||
* "\"Where are we going?\", she asked."
|
||||
*/
|
||||
$.quoteString = function (str) {
|
||||
if (str.match(escape)) {
|
||||
return '"' + str.replace(escape, function (a) {
|
||||
var c = meta[a];
|
||||
if (typeof c === 'string') {
|
||||
return c;
|
||||
}
|
||||
c = a.charCodeAt();
|
||||
return '\\u00' + Math.floor(c / 16).toString(16) + (c % 16).toString(16);
|
||||
}) + '"';
|
||||
}
|
||||
return '"' + str + '"';
|
||||
};
|
||||
|
||||
}(jQuery));
|
||||
1
wp/wp-content/plugins/gravityforms/js/jquery.json.min.js
vendored
Normal file
1
wp/wp-content/plugins/gravityforms/js/jquery.json.min.js
vendored
Normal file
@@ -0,0 +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);
|
||||
9
wp/wp-content/plugins/gravityforms/js/jquery.maskedinput-1.3.1.min.js
vendored
Normal file
9
wp/wp-content/plugins/gravityforms/js/jquery.maskedinput-1.3.1.min.js
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
/*
|
||||
*** NOTE: File Kept for backwards compatibility. Link to jquery.maskedinput.min.js instead ***
|
||||
|
||||
Masked Input plugin for jQuery
|
||||
Copyright (c) 2007-2013 Josh Bush (digitalbush.com)
|
||||
Licensed under the MIT license (http://digitalbush.com/projects/masked-input-plugin/#license)
|
||||
Version: 1.4.1
|
||||
*/
|
||||
!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e("object"==typeof exports?require("jquery"):jQuery)}(function(e){var t,n=navigator.userAgent,a=/iphone/i.test(n),i=/chrome/i.test(n),r=/android/i.test(n);e.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},e.fn.extend({caret:function(e,t){var n;if(0!==this.length&&!this.is(":hidden"))return"number"==typeof e?(t="number"==typeof t?t:e,this.each(function(){this.setSelectionRange?this.setSelectionRange(e,t):this.createTextRange&&(n=this.createTextRange(),n.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(n,o){var c,l,u,f,s,h,g,m;if(!n&&this.length>0){c=e(this[0]);var d=c.data(e.mask.dataName);return d?d():void 0}return o=e.extend({autoclear:e.mask.autoclear,placeholder:e.mask.placeholder,completed:null},o),l=e.mask.definitions,u=[],f=g=n.length,s=null,e.each(n.split(""),function(e,t){"?"==t?(g--,f=e):l[t]?(u.push(new RegExp(l[t])),null===s&&(s=u.length-1),f>e&&(h=u.length-1)):u.push(null)}),this.trigger("unmask").each(function(){function c(){if(o.completed){for(var e=s;h>=e;e++)if(u[e]&&C[e]===d(e))return;o.completed.call(w)}}function d(e){return o.placeholder.charAt(e<o.placeholder.length?e:0)}function p(e){for(;++e<g&&!u[e];);return e}function v(e){for(;--e>=0&&!u[e];);return e}function b(e,t){var n,a;if(!(0>e)){for(n=e,a=p(t);g>n;n++)if(u[n]){if(!(g>a&&u[n].test(C[a])))break;C[n]=C[a],C[a]=d(a),a=p(a)}A(),w.caret(Math.max(s,e))}}function k(e){var t,n,a,i;for(t=e,n=d(e);g>t;t++)if(u[t]){if(a=p(t),i=C[t],C[t]=n,!(g>a&&u[a].test(i)))break;n=i}}function y(){var e=w.val(),t=w.caret();if(m&&m.length&&m.length>e.length){for(T(!0);t.begin>0&&!u[t.begin-1];)t.begin--;if(0===t.begin)for(;t.begin<s&&!u[t.begin];)t.begin++;w.caret(t.begin,t.begin)}else{for(T(!0);t.begin<g&&!u[t.begin];)t.begin++;w.caret(t.begin,t.begin)}c()}function x(){T(),w.val()!=E&&w.change()}function j(e){if(!w.prop("readonly")){var t,n,i,r=e.which||e.keyCode;m=w.val(),8===r||46===r||a&&127===r?(t=w.caret(),n=t.begin,i=t.end,i-n===0&&(n=46!==r?v(n):i=p(n-1),i=46===r?p(i):i),S(n,i),b(n,i-1),e.preventDefault()):13===r?x.call(this,e):27===r&&(w.val(E),w.caret(0,T()),e.preventDefault())}}function R(t){if(!w.prop("readonly")){var n,a,i,o=t.which||t.keyCode,l=w.caret();if(!(t.ctrlKey||t.altKey||t.metaKey||32>o)&&o&&13!==o){if(l.end-l.begin!==0&&(S(l.begin,l.end),b(l.begin,l.end-1)),n=p(l.begin-1),g>n&&(a=String.fromCharCode(o),u[n].test(a))){if(k(n),C[n]=a,A(),i=p(n),r){var f=function(){e.proxy(e.fn.caret,w,i)()};setTimeout(f,0)}else w.caret(i);l.begin<=h&&c()}t.preventDefault()}}}function S(e,t){var n;for(n=e;t>n&&g>n;n++)u[n]&&(C[n]=d(n))}function A(){w.val(C.join(""))}function T(e){var t,n,a,i=w.val(),r=-1;for(t=0,a=0;g>t;t++)if(u[t]){for(C[t]=d(t);a++<i.length;)if(n=i.charAt(a-1),u[t].test(n)){C[t]=n,r=t;break}if(a>i.length){S(t+1,g);break}}else C[t]===i.charAt(a)&&a++,f>t&&(r=t);return e?A():f>r+1?o.autoclear||C.join("")===D?(w.val()&&w.val(""),S(0,g)):A():(A(),w.val(w.val().substring(0,r+1))),f?t:s}var w=e(this),C=e.map(n.split(""),function(e,t){return"?"!=e?l[e]?d(t):e:void 0}),D=C.join(""),E=w.val();w.data(e.mask.dataName,function(){return e.map(C,function(e,t){return u[t]&&e!=d(t)?e:null}).join("")}),w.one("unmask",function(){w.off(".mask").removeData(e.mask.dataName)}).on("focus.mask",function(){if(!w.prop("readonly")){clearTimeout(t);var e;E=w.val(),e=T(),t=setTimeout(function(){w.get(0)===document.activeElement&&(A(),e==n.replace("?","").length?w.caret(0,e):w.caret(e))},10)}}).on("blur.mask",x).on("keydown.mask",j).on("keypress.mask",R).on("input.mask paste.mask",function(){w.prop("readonly")||setTimeout(function(){var e=T(!0);w.caret(e),c()},0)}),i&&r&&w.off("input.mask").on("input.mask",y),T()})}})});
|
||||
459
wp/wp-content/plugins/gravityforms/js/jquery.maskedinput.js
Normal file
459
wp/wp-content/plugins/gravityforms/js/jquery.maskedinput.js
Normal file
@@ -0,0 +1,459 @@
|
||||
/*
|
||||
Masked Input plugin for jQuery
|
||||
Copyright (c) 2007-2013 Josh Bush (digitalbush.com)
|
||||
Licensed under the MIT license (http://digitalbush.com/projects/masked-input-plugin/#license)
|
||||
Version: 1.4.1
|
||||
Source: https://github.com/RubtsovAV/jquery.maskedinput/blob/master/src/jquery.maskedinput.js
|
||||
Updated 26 June 2017
|
||||
- Fixed bug with caret position on Android
|
||||
*/
|
||||
(function (factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['jquery'], factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
// Node/CommonJS
|
||||
factory(require('jquery'));
|
||||
} else {
|
||||
// Browser globals
|
||||
factory(jQuery);
|
||||
}
|
||||
}(function ($) {
|
||||
|
||||
var ua = navigator.userAgent,
|
||||
iPhone = /iphone/i.test(ua),
|
||||
chrome = /chrome/i.test(ua),
|
||||
android = /android/i.test(ua),
|
||||
caretTimeoutId;
|
||||
|
||||
$.mask = {
|
||||
//Predefined character definitions
|
||||
definitions: {
|
||||
'9': "[0-9]",
|
||||
'a': "[A-Za-z]",
|
||||
'*': "[A-Za-z0-9]"
|
||||
},
|
||||
autoclear: true,
|
||||
dataName: "rawMaskFn",
|
||||
placeholder: '_'
|
||||
};
|
||||
|
||||
$.fn.extend({
|
||||
//Helper Function for Caret positioning
|
||||
caret: function(begin, end) {
|
||||
var range;
|
||||
|
||||
if (this.length === 0 || this.is(":hidden") || this.get(0) !== document.activeElement) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof begin == 'number') {
|
||||
end = (typeof end === 'number') ? end : begin;
|
||||
return this.each(function() {
|
||||
if (this.setSelectionRange) {
|
||||
this.setSelectionRange(begin, end);
|
||||
} else if (this.createTextRange) {
|
||||
range = this.createTextRange();
|
||||
range.collapse(true);
|
||||
range.moveEnd('character', end);
|
||||
range.moveStart('character', begin);
|
||||
range.select();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (this[0].setSelectionRange) {
|
||||
begin = this[0].selectionStart;
|
||||
end = this[0].selectionEnd;
|
||||
} else if (document.selection && document.selection.createRange) {
|
||||
range = document.selection.createRange();
|
||||
begin = 0 - range.duplicate().moveStart('character', -100000);
|
||||
end = begin + range.text.length;
|
||||
}
|
||||
return { begin: begin, end: end };
|
||||
}
|
||||
},
|
||||
unmask: function() {
|
||||
return this.trigger("unmask");
|
||||
},
|
||||
mask: function(mask, settings) {
|
||||
var input,
|
||||
defs,
|
||||
tests,
|
||||
partialPosition,
|
||||
firstNonMaskPos,
|
||||
lastRequiredNonMaskPos,
|
||||
len,
|
||||
oldVal;
|
||||
|
||||
if (!mask && this.length > 0) {
|
||||
input = $(this[0]);
|
||||
var fn = input.data($.mask.dataName)
|
||||
return fn?fn():undefined;
|
||||
}
|
||||
|
||||
settings = $.extend({
|
||||
autoclear: $.mask.autoclear,
|
||||
placeholder: $.mask.placeholder, // Load default placeholder
|
||||
completed: null
|
||||
}, settings);
|
||||
|
||||
|
||||
defs = $.mask.definitions;
|
||||
tests = [];
|
||||
partialPosition = len = mask.length;
|
||||
firstNonMaskPos = null;
|
||||
|
||||
mask = String(mask);
|
||||
|
||||
$.each(mask.split(""), function(i, c) {
|
||||
if (c == '?') {
|
||||
len--;
|
||||
partialPosition = i;
|
||||
} else if (defs[c]) {
|
||||
tests.push(new RegExp(defs[c]));
|
||||
if (firstNonMaskPos === null) {
|
||||
firstNonMaskPos = tests.length - 1;
|
||||
}
|
||||
if(i < partialPosition){
|
||||
lastRequiredNonMaskPos = tests.length - 1;
|
||||
}
|
||||
} else {
|
||||
tests.push(null);
|
||||
}
|
||||
});
|
||||
|
||||
return this.trigger("unmask").each(function() {
|
||||
var input = $(this),
|
||||
buffer = $.map(
|
||||
mask.split(""),
|
||||
function(c, i) {
|
||||
if (c != '?') {
|
||||
return defs[c] ? getPlaceholder(i) : c;
|
||||
}
|
||||
}),
|
||||
defaultBuffer = buffer.join(''),
|
||||
focusText = input.val();
|
||||
|
||||
function tryFireCompleted(){
|
||||
if (!settings.completed) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (var i = firstNonMaskPos; i <= lastRequiredNonMaskPos; i++) {
|
||||
if (tests[i] && buffer[i] === getPlaceholder(i)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
settings.completed.call(input);
|
||||
}
|
||||
|
||||
function getPlaceholder(i){
|
||||
if(i < settings.placeholder.length)
|
||||
return settings.placeholder.charAt(i);
|
||||
return settings.placeholder.charAt(0);
|
||||
}
|
||||
|
||||
function seekNext(pos) {
|
||||
while (++pos < len && !tests[pos]);
|
||||
return pos;
|
||||
}
|
||||
|
||||
function seekPrev(pos) {
|
||||
while (--pos >= 0 && !tests[pos]);
|
||||
return pos;
|
||||
}
|
||||
|
||||
function shiftL(begin,end) {
|
||||
var i,
|
||||
j;
|
||||
|
||||
if (begin<0) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = begin, j = seekNext(end); i < len; i++) {
|
||||
if (tests[i]) {
|
||||
if (j < len && tests[i].test(buffer[j])) {
|
||||
buffer[i] = buffer[j];
|
||||
buffer[j] = getPlaceholder(j);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
j = seekNext(j);
|
||||
}
|
||||
}
|
||||
writeBuffer();
|
||||
input.caret(Math.max(firstNonMaskPos, begin));
|
||||
}
|
||||
|
||||
function shiftR(pos) {
|
||||
var i,
|
||||
c,
|
||||
j,
|
||||
t;
|
||||
|
||||
for (i = pos, c = getPlaceholder(pos); i < len; i++) {
|
||||
if (tests[i]) {
|
||||
j = seekNext(i);
|
||||
t = buffer[i];
|
||||
buffer[i] = c;
|
||||
if (j < len && tests[j].test(t)) {
|
||||
c = t;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function androidInputEvent(e) {
|
||||
var curVal = input.val();
|
||||
var pos = input.caret();
|
||||
|
||||
var proxy = function () {
|
||||
$.proxy($.fn.caret, input, pos.begin, pos.begin)();
|
||||
};
|
||||
|
||||
if (oldVal && oldVal.length && oldVal.length > curVal.length ) {
|
||||
// a deletion or backspace happened
|
||||
checkVal(true);
|
||||
while (pos.begin > 0 && !tests[pos.begin-1])
|
||||
pos.begin--;
|
||||
if (pos.begin === 0)
|
||||
{
|
||||
while (pos.begin < firstNonMaskPos && !tests[pos.begin])
|
||||
pos.begin++;
|
||||
}
|
||||
setTimeout(proxy, 0);
|
||||
} else {
|
||||
var pos2 = checkVal(true);
|
||||
var lastEnteredValue = curVal.charAt(pos.begin);
|
||||
if (pos.begin < len){
|
||||
if (!tests[pos.begin]) {
|
||||
pos.begin = pos2;
|
||||
} else {
|
||||
if(tests[pos.begin].test(lastEnteredValue)){
|
||||
pos.begin++;
|
||||
}
|
||||
}
|
||||
}
|
||||
setTimeout(proxy, 0);
|
||||
}
|
||||
tryFireCompleted();
|
||||
}
|
||||
|
||||
|
||||
function blurEvent(e) {
|
||||
checkVal();
|
||||
|
||||
if (input.val() != focusText)
|
||||
input.change();
|
||||
}
|
||||
|
||||
function keydownEvent(e) {
|
||||
if (input.prop("readonly")){
|
||||
return;
|
||||
}
|
||||
|
||||
var k = e.which || e.keyCode,
|
||||
pos,
|
||||
begin,
|
||||
end;
|
||||
oldVal = input.val();
|
||||
//backspace, delete, and escape get special treatment
|
||||
if (k === 8 || k === 46 || (iPhone && k === 127)) {
|
||||
pos = input.caret();
|
||||
begin = pos.begin;
|
||||
end = pos.end;
|
||||
|
||||
if (end - begin === 0) {
|
||||
begin=k!==46?seekPrev(begin):(end=seekNext(begin-1));
|
||||
end=k===46?seekNext(end):end;
|
||||
}
|
||||
clearBuffer(begin, end);
|
||||
shiftL(begin, end - 1);
|
||||
|
||||
e.preventDefault();
|
||||
} else if( k === 13 ) { // enter
|
||||
blurEvent.call(this, e);
|
||||
} else if (k === 27) { // escape
|
||||
input.val(focusText);
|
||||
input.caret(0, checkVal());
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
function keypressEvent(e) {
|
||||
if (input.prop("readonly")){
|
||||
return;
|
||||
}
|
||||
|
||||
var k = e.which || e.keyCode,
|
||||
pos = input.caret(),
|
||||
p,
|
||||
c,
|
||||
next;
|
||||
|
||||
if (e.ctrlKey || e.altKey || e.metaKey || k < 32) {//Ignore
|
||||
return;
|
||||
} else if ( k && k !== 13 ) {
|
||||
if (pos.end - pos.begin !== 0){
|
||||
clearBuffer(pos.begin, pos.end);
|
||||
shiftL(pos.begin, pos.end-1);
|
||||
}
|
||||
|
||||
p = seekNext(pos.begin - 1);
|
||||
if (p < len) {
|
||||
c = String.fromCharCode(k);
|
||||
if (tests[p].test(c)) {
|
||||
shiftR(p);
|
||||
|
||||
buffer[p] = c;
|
||||
writeBuffer();
|
||||
next = seekNext(p);
|
||||
|
||||
if(android){
|
||||
//Path for CSP Violation on FireFox OS 1.1
|
||||
var proxy = function() {
|
||||
$.proxy($.fn.caret,input,next)();
|
||||
};
|
||||
|
||||
setTimeout(proxy,0);
|
||||
}else{
|
||||
input.caret(next);
|
||||
}
|
||||
if(pos.begin <= lastRequiredNonMaskPos){
|
||||
tryFireCompleted();
|
||||
}
|
||||
}
|
||||
}
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
function clearBuffer(start, end) {
|
||||
var i;
|
||||
for (i = start; i < end && i < len; i++) {
|
||||
if (tests[i]) {
|
||||
buffer[i] = getPlaceholder(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function writeBuffer() { input.val(buffer.join('')); }
|
||||
|
||||
function checkVal(allow) {
|
||||
//try to place characters where they belong
|
||||
var test = input.val(),
|
||||
lastMatch = -1,
|
||||
i,
|
||||
c,
|
||||
pos;
|
||||
|
||||
for (i = 0, pos = 0; i < len; i++) {
|
||||
if (tests[i]) {
|
||||
buffer[i] = getPlaceholder(i);
|
||||
while (pos++ < test.length) {
|
||||
c = test.charAt(pos - 1);
|
||||
if (tests[i].test(c)) {
|
||||
buffer[i] = c;
|
||||
lastMatch = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (pos > test.length) {
|
||||
clearBuffer(i + 1, len);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (buffer[i] === test.charAt(pos)) {
|
||||
pos++;
|
||||
}
|
||||
if( i < partialPosition){
|
||||
lastMatch = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (allow) {
|
||||
writeBuffer();
|
||||
} else if (lastMatch + 1 < partialPosition) {
|
||||
if (settings.autoclear || buffer.join('') === defaultBuffer) {
|
||||
// Invalid value. Remove it and replace it with the
|
||||
// mask, which is the default behavior.
|
||||
if(input.val()) input.val("");
|
||||
clearBuffer(0, len);
|
||||
} else {
|
||||
// Invalid value, but we opt to show the value to the
|
||||
// user and allow them to correct their mistake.
|
||||
writeBuffer();
|
||||
}
|
||||
} else {
|
||||
writeBuffer();
|
||||
input.val(input.val().substring(0, lastMatch + 1));
|
||||
}
|
||||
return (partialPosition ? i : firstNonMaskPos);
|
||||
}
|
||||
|
||||
input.data($.mask.dataName,function(){
|
||||
return $.map(buffer, function(c, i) {
|
||||
return tests[i]&&c!=getPlaceholder(i) ? c : null;
|
||||
}).join('');
|
||||
});
|
||||
|
||||
|
||||
input
|
||||
.one("unmask", function() {
|
||||
input
|
||||
.off(".mask")
|
||||
.removeData($.mask.dataName);
|
||||
})
|
||||
.on("focus.mask", function() {
|
||||
if (input.prop("readonly")){
|
||||
return;
|
||||
}
|
||||
|
||||
clearTimeout(caretTimeoutId);
|
||||
var pos;
|
||||
|
||||
focusText = input.val();
|
||||
|
||||
pos = checkVal();
|
||||
|
||||
caretTimeoutId = setTimeout(function(){
|
||||
if(input.get(0) !== document.activeElement){
|
||||
return;
|
||||
}
|
||||
writeBuffer();
|
||||
if (pos == mask.replace("?","").length) {
|
||||
input.caret(0, pos);
|
||||
} else {
|
||||
input.caret(pos);
|
||||
}
|
||||
}, 10);
|
||||
})
|
||||
.on("blur.mask", blurEvent)
|
||||
.on("keydown.mask", keydownEvent)
|
||||
.on("keypress.mask", keypressEvent)
|
||||
.on("input.mask paste.mask", function() {
|
||||
if (input.prop("readonly")){
|
||||
return;
|
||||
}
|
||||
|
||||
setTimeout(function() {
|
||||
var pos=checkVal(true);
|
||||
input.caret(pos);
|
||||
tryFireCompleted();
|
||||
}, 0);
|
||||
});
|
||||
if (chrome && android)
|
||||
{
|
||||
input
|
||||
.off('input.mask')
|
||||
.on('input.mask', androidInputEvent);
|
||||
}
|
||||
checkVal(); //Perform initial check for existing values
|
||||
});
|
||||
}
|
||||
});
|
||||
}));
|
||||
1
wp/wp-content/plugins/gravityforms/js/jquery.maskedinput.min.js
vendored
Normal file
1
wp/wp-content/plugins/gravityforms/js/jquery.maskedinput.min.js
vendored
Normal file
@@ -0,0 +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()}))}})});
|
||||
@@ -0,0 +1,195 @@
|
||||
/*
|
||||
* jQuery Textarea Counter Plugin
|
||||
* Copyright (c) 2010 Roy Jin
|
||||
* Copyright (c) 2013 LeadSift
|
||||
* Version: 3.0 (11-APR-2013)
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Requires: jQuery v1.4.2 or later
|
||||
*/
|
||||
(function($) {
|
||||
$.fn.textareaCount = function(options, fn) {
|
||||
var defaults = {
|
||||
maxCharacterSize: -1
|
||||
, truncate: true
|
||||
, charCounter: 'standard'
|
||||
, originalStyle: 'originalTextareaInfo'
|
||||
, warningStyle: 'warningTextareaInfo'
|
||||
, errorStyle: 'errorTextareaInfo'
|
||||
, warningNumber: 20
|
||||
, displayFormat: '#input characters | #words words'
|
||||
}
|
||||
, container = $(this)
|
||||
, charLeftInfo
|
||||
, numInput = 0
|
||||
, maxCharacters = options.maxCharacterSize
|
||||
, numLeft = 0
|
||||
, numWords = 0
|
||||
, charCounters = {}
|
||||
;
|
||||
|
||||
charCounters.standard = function(content){
|
||||
return content.length;
|
||||
};
|
||||
|
||||
charCounters.twitter = function(content){
|
||||
// function that counts urls as 22 chars
|
||||
// regex to match various urls ... from http://stackoverflow.com/a/6427654
|
||||
var url_length = 22
|
||||
, replacement = Array(url_length+1).join("*")
|
||||
, regex_str = "(https?:\/\/)?" + // SCHEME
|
||||
"([a-z0-9+!*(),;?&=$_.-]+(:[a-z0-9+!*(),;?&=$_.-]+)?@)?" + // User and Pass
|
||||
"([a-z0-9-.]*)\\.(travel|museum|[a-z]{2,4})" + // Host or IP
|
||||
"(:[0-9]{2,5})?" + // Port
|
||||
"(\/([a-z0-9+$_-]\\.?)+)*\/?" + // Path
|
||||
"(\\?[a-z+&$_.-][a-z0-9;:@&%=+\/$_.-]*)?" + // GET Query
|
||||
"(#[a-z_.-][a-z0-9+$_.-]*)?" // Anchor
|
||||
, regex = new RegExp(regex_str, 'gi')
|
||||
;
|
||||
return content.replace(regex, replacement).length;
|
||||
};
|
||||
|
||||
function getNewlineCount(content){
|
||||
var newlineCount = 0
|
||||
, i;
|
||||
for(i=0; i<content.length; i++){
|
||||
if(content.charAt(i) === '\n'){
|
||||
newlineCount++;
|
||||
}
|
||||
}
|
||||
return newlineCount;
|
||||
}
|
||||
|
||||
function formatDisplayInfo(){
|
||||
var format = options.displayFormat;
|
||||
format = format.replace('#input', numInput);
|
||||
format = format.replace('#words', numWords);
|
||||
//When maxCharacters <= 0, #max, #left cannot be substituted.
|
||||
if(maxCharacters > 0){
|
||||
format = format.replace('#max', maxCharacters);
|
||||
format = format.replace('#left', numLeft);
|
||||
}
|
||||
return format;
|
||||
}
|
||||
|
||||
function getInfo(){
|
||||
var info = {
|
||||
input: numInput,
|
||||
max: maxCharacters,
|
||||
left: numLeft,
|
||||
words: numWords
|
||||
};
|
||||
return info;
|
||||
}
|
||||
|
||||
function getNextCharLeftInformation(container){
|
||||
return container.next('.charleft');
|
||||
}
|
||||
|
||||
function isWin(){
|
||||
var strOS = navigator.appVersion;
|
||||
if (strOS.toLowerCase().indexOf('win') !== -1){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function getCleanedWordString(content){
|
||||
var fullStr = content + " "
|
||||
, initial_whitespace_rExp = /^[^A-Za-z0-9]+/gi
|
||||
, left_trimmedStr = fullStr.replace(initial_whitespace_rExp, "")
|
||||
, non_alphanumerics_rExp = /[^A-Za-z0-9]+/gi
|
||||
, cleanedStr = left_trimmedStr.replace(non_alphanumerics_rExp, " ")
|
||||
, splitString = cleanedStr.split(" ")
|
||||
;
|
||||
return splitString;
|
||||
}
|
||||
|
||||
function countWord(cleanedWordString){
|
||||
var word_count = cleanedWordString.length-1;
|
||||
return word_count;
|
||||
}
|
||||
|
||||
function countByCharacters(){
|
||||
var content = container.val()
|
||||
, lengthFunc = typeof(options.charCounter) === 'function'? options.charCounter : charCounters[options.charCounter]
|
||||
, contentLength = lengthFunc(content)
|
||||
, newlineCount
|
||||
, systemmaxCharacterSize
|
||||
, originalScrollTopPosition
|
||||
;
|
||||
|
||||
// Start Cut
|
||||
if(options.maxCharacterSize > 0){
|
||||
// If copied content is already more than maxCharacterSize,
|
||||
// chop it to maxCharacterSize only if truncate is true
|
||||
if(options.truncate && contentLength >= options.maxCharacterSize) {
|
||||
content = content.substring(0, options.maxCharacterSize);
|
||||
}
|
||||
|
||||
newlineCount = getNewlineCount(content);
|
||||
|
||||
systemmaxCharacterSize = options.maxCharacterSize;
|
||||
if (isWin()){
|
||||
// newlineCount new line character. For windows, it occupies 2 characters
|
||||
systemmaxCharacterSize = options.maxCharacterSize - newlineCount;
|
||||
}
|
||||
if(options.truncate && contentLength > systemmaxCharacterSize){
|
||||
//avoid scroll bar moving
|
||||
originalScrollTopPosition = this.scrollTop;
|
||||
container.val(content.substring(0, systemmaxCharacterSize));
|
||||
this.scrollTop = originalScrollTopPosition;
|
||||
}
|
||||
charLeftInfo.removeClass(options.warningStyle + ' ' + options.errorStyle);
|
||||
if(systemmaxCharacterSize - contentLength <= options.warningNumber){
|
||||
charLeftInfo.addClass(options.warningStyle);
|
||||
}
|
||||
if(systemmaxCharacterSize - contentLength < 0){
|
||||
charLeftInfo.addClass(options.errorStyle);
|
||||
}
|
||||
|
||||
numInput = contentLength;
|
||||
if(isWin()){
|
||||
numInput = contentLength + newlineCount;
|
||||
}
|
||||
|
||||
numWords = countWord(getCleanedWordString(container.val()));
|
||||
|
||||
numLeft = maxCharacters - numInput;
|
||||
} else {
|
||||
//normal count, no cut
|
||||
newlineCount = getNewlineCount(content);
|
||||
numInput = contentLength;
|
||||
if(isWin()){
|
||||
numInput = contentLength + newlineCount;
|
||||
}
|
||||
numWords = countWord(getCleanedWordString(container.val()));
|
||||
}
|
||||
|
||||
return formatDisplayInfo();
|
||||
}
|
||||
|
||||
function limitTextAreaByCharacterCount(){
|
||||
charLeftInfo.html(countByCharacters());
|
||||
//function call back
|
||||
if(typeof fn !== 'undefined'){
|
||||
fn.call(this, getInfo());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
options = $.extend(defaults, options);
|
||||
$("<div class='charleft'> </div>").insertAfter(container);
|
||||
charLeftInfo = getNextCharLeftInformation(container);
|
||||
charLeftInfo.addClass(options.originalStyle);
|
||||
|
||||
limitTextAreaByCharacterCount();
|
||||
|
||||
container.bind('keyup', function(){
|
||||
limitTextAreaByCharacterCount();}
|
||||
).bind('mouseover paste', function(){
|
||||
setTimeout(function(){
|
||||
limitTextAreaByCharacterCount();
|
||||
}, 10);
|
||||
});
|
||||
};
|
||||
})(jQuery);
|
||||
1
wp/wp-content/plugins/gravityforms/js/jquery.textareaCounter.plugin.min.js
vendored
Normal file
1
wp/wp-content/plugins/gravityforms/js/jquery.textareaCounter.plugin.min.js
vendored
Normal file
@@ -0,0 +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'> </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);
|
||||
1427
wp/wp-content/plugins/gravityforms/js/layout_editor.js
Normal file
1427
wp/wp-content/plugins/gravityforms/js/layout_editor.js
Normal file
File diff suppressed because it is too large
Load Diff
1
wp/wp-content/plugins/gravityforms/js/layout_editor.min.js
vendored
Normal file
1
wp/wp-content/plugins/gravityforms/js/layout_editor.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
357
wp/wp-content/plugins/gravityforms/js/page_conditional_logic.js
Normal file
357
wp/wp-content/plugins/gravityforms/js/page_conditional_logic.js
Normal file
@@ -0,0 +1,357 @@
|
||||
var GFPageConditionalLogic = function (args) {
|
||||
var self = this,
|
||||
$ = jQuery;
|
||||
|
||||
/**
|
||||
* Initialize Feed Ordering
|
||||
*/
|
||||
self.init = function () {
|
||||
|
||||
// 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();
|
||||
|
||||
self.bindEvents();
|
||||
|
||||
};
|
||||
|
||||
self.bindEvents = function () {
|
||||
|
||||
gform.addAction('gform_input_change', function (elem, formId, inputId) {
|
||||
|
||||
var fieldId = parseInt(inputId, 10) + '';
|
||||
var isTriggeredInput = $.inArray(inputId, self.triggerInputIds) !== -1 || $.inArray(fieldId, self.triggerInputIds) !== -1;
|
||||
|
||||
if (self.options.formId == formId && isTriggeredInput) {
|
||||
self.evaluatePages();
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
self.evaluatePages = function () {
|
||||
|
||||
var page, stepNumber, isMatch, isVisible, progress, visibleStepNumber = 1, currentPage = self.originalCurrentPage;
|
||||
|
||||
for (var 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);
|
||||
|
||||
if (!isMatch && isVisible !== false) {
|
||||
self.hidePage(page, stepNumber);
|
||||
} else if (isMatch && !isVisible) {
|
||||
self.showPage(page, stepNumber);
|
||||
}
|
||||
|
||||
// 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 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires after the conditional logic on the form has been evaluated.
|
||||
*
|
||||
* @since 2.5
|
||||
*
|
||||
* @param array $pages A collection of page field objects.
|
||||
* @param int $formId The form id.
|
||||
*/
|
||||
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);
|
||||
|
||||
};
|
||||
|
||||
self.evaluatePage = function (page, formId) {
|
||||
|
||||
// Pages with no configured conditional logic always a match.
|
||||
if (!page.conditionalLogic) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return gf_get_field_action(formId, page.conditionalLogic) === 'show';
|
||||
};
|
||||
|
||||
self.getTriggerInputIds = function () {
|
||||
var inputIds = [];
|
||||
for (var i = 0; i < self.options.pages.length; i++) {
|
||||
|
||||
var page = self.options.pages[i];
|
||||
|
||||
if (!page.conditionalLogic) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (var j = 0; j < page.conditionalLogic.rules.length; j++) {
|
||||
var rule = self.options.pages[i].conditionalLogic.rules[j];
|
||||
if ($.inArray(rule.fieldId, inputIds) === -1) {
|
||||
inputIds.push(rule.fieldId);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return inputIds;
|
||||
};
|
||||
|
||||
self.isPageVisible = function (page) {
|
||||
|
||||
if (typeof page != 'object') {
|
||||
page = self.getPage(page);
|
||||
if (!page) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return typeof page.isVisible != 'undefined' ? page.isVisible : null;
|
||||
};
|
||||
|
||||
self.getPage = function (fieldId) {
|
||||
for (var i = 0; i < self.options.pages.length; i++) {
|
||||
var page = self.options.pages[i];
|
||||
if (page.fieldId == fieldId) {
|
||||
return page;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
self.showPage = function (page, stepNumber) {
|
||||
|
||||
var isVisible = self.isPageVisible(page);
|
||||
|
||||
if (isVisible === true) {
|
||||
return;
|
||||
}
|
||||
|
||||
page.isVisible = true;
|
||||
$('#gf_step_' + self.options.formId + '_' + stepNumber).removeClass('gf_step_hidden');
|
||||
|
||||
/**
|
||||
* Fires after the conditional logic on the form has been evaluated and the page has been found to be visible.
|
||||
*
|
||||
* @since 2.5
|
||||
*
|
||||
* @param array $pages A collection of page field objects.
|
||||
* @param int $formId The form id.
|
||||
*/
|
||||
gform.doAction('gform_frontend_page_visible', page, self.options.formId);
|
||||
gform.doAction('gform_frontend_page_visible_{0}'.gformFormat(self.options.formId), page, self.options.formId);
|
||||
|
||||
};
|
||||
|
||||
self.hidePage = function (page, stepNumber) {
|
||||
|
||||
var isVisible = self.isPageVisible(page);
|
||||
|
||||
if (isVisible === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
page.isVisible = false;
|
||||
$('#gf_step_' + self.options.formId + '_' + stepNumber).addClass('gf_step_hidden');
|
||||
|
||||
/**
|
||||
* Fires after the conditional logic on the form has been evaluated and the page has become hidden.
|
||||
*
|
||||
* @since 2.5
|
||||
*
|
||||
* @param array $pages A collection of page field objects.
|
||||
* @param int $formId The form id.
|
||||
*/
|
||||
gform.doAction('gform_frontend_page_hidden', page, self.options.formId);
|
||||
gform.doAction('gform_frontend_page_hidden_{0}'.gformFormat(self.options.formId), page, self.options.formId);
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* 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();
|
||||
};
|
||||
1
wp/wp-content/plugins/gravityforms/js/page_conditional_logic.min.js
vendored
Normal file
1
wp/wp-content/plugins/gravityforms/js/page_conditional_logic.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
2
wp/wp-content/plugins/gravityforms/js/placeholders.jquery.min.js
vendored
Normal file
2
wp/wp-content/plugins/gravityforms/js/placeholders.jquery.min.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/* Placeholders.js v3.0.2 */
|
||||
(function(t){"use strict";function e(t,e,r){return t.addEventListener?t.addEventListener(e,r,!1):t.attachEvent?t.attachEvent("on"+e,r):void 0}function r(t,e){var r,n;for(r=0,n=t.length;n>r;r++)if(t[r]===e)return!0;return!1}function n(t,e){var r;t.createTextRange?(r=t.createTextRange(),r.move("character",e),r.select()):t.selectionStart&&(t.focus(),t.setSelectionRange(e,e))}function a(t,e){try{return t.type=e,!0}catch(r){return!1}}t.Placeholders={Utils:{addEventListener:e,inArray:r,moveCaret:n,changeType:a}}})(this),function(t){"use strict";function e(){}function r(){try{return document.activeElement}catch(t){}}function n(t,e){var r,n,a=!!e&&t.value!==e,u=t.value===t.getAttribute(V);return(a||u)&&"true"===t.getAttribute(P)?(t.removeAttribute(P),t.value=t.value.replace(t.getAttribute(V),""),t.className=t.className.replace(R,""),n=t.getAttribute(z),parseInt(n,10)>=0&&(t.setAttribute("maxLength",n),t.removeAttribute(z)),r=t.getAttribute(D),r&&(t.type=r),!0):!1}function a(t){var e,r,n=t.getAttribute(V);return""===t.value&&n?(t.setAttribute(P,"true"),t.value=n,t.className+=" "+I,r=t.getAttribute(z),r||(t.setAttribute(z,t.maxLength),t.removeAttribute("maxLength")),e=t.getAttribute(D),e?t.type="text":"password"===t.type&&K.changeType(t,"text")&&t.setAttribute(D,"password"),!0):!1}function u(t,e){var r,n,a,u,i,l,o;if(t&&t.getAttribute(V))e(t);else for(a=t?t.getElementsByTagName("input"):f,u=t?t.getElementsByTagName("textarea"):h,r=a?a.length:0,n=u?u.length:0,o=0,l=r+n;l>o;o++)i=r>o?a[o]:u[o-r],e(i)}function i(t){u(t,n)}function l(t){u(t,a)}function o(t){return function(){b&&t.value===t.getAttribute(V)&&"true"===t.getAttribute(P)?K.moveCaret(t,0):n(t)}}function c(t){return function(){a(t)}}function s(t){return function(e){return A=t.value,"true"===t.getAttribute(P)&&A===t.getAttribute(V)&&K.inArray(C,e.keyCode)?(e.preventDefault&&e.preventDefault(),!1):void 0}}function d(t){return function(){n(t,A),""===t.value&&(t.blur(),K.moveCaret(t,0))}}function v(t){return function(){t===r()&&t.value===t.getAttribute(V)&&"true"===t.getAttribute(P)&&K.moveCaret(t,0)}}function g(t){return function(){i(t)}}function p(t){t.form&&(T=t.form,"string"==typeof T&&(T=document.getElementById(T)),T.getAttribute(U)||(K.addEventListener(T,"submit",g(T)),T.setAttribute(U,"true"))),K.addEventListener(t,"focus",o(t)),K.addEventListener(t,"blur",c(t)),b&&(K.addEventListener(t,"keydown",s(t)),K.addEventListener(t,"keyup",d(t)),K.addEventListener(t,"click",v(t))),t.setAttribute(j,"true"),t.setAttribute(V,x),(b||t!==r())&&a(t)}var f,h,b,m,A,y,E,x,L,T,S,N,w,B=["text","search","url","tel","email","password","number","textarea"],C=[27,33,34,35,36,37,38,39,40,8,46],k="#ccc",I="placeholdersjs",R=RegExp("(?:^|\\s)"+I+"(?!\\S)"),V="data-placeholder-value",P="data-placeholder-active",D="data-placeholder-type",U="data-placeholder-submit",j="data-placeholder-bound",q="data-placeholder-focus",Q="data-placeholder-live",z="data-placeholder-maxlength",F=document.createElement("input"),G=document.getElementsByTagName("head")[0],H=document.documentElement,J=t.Placeholders,K=J.Utils;if(J.nativeSupport=void 0!==F.placeholder,!J.nativeSupport){for(f=document.getElementsByTagName("input"),h=document.getElementsByTagName("textarea"),b="false"===H.getAttribute(q),m="false"!==H.getAttribute(Q),y=document.createElement("style"),y.type="text/css",E=document.createTextNode("."+I+" { color:"+k+"; }"),y.styleSheet?y.styleSheet.cssText=E.nodeValue:y.appendChild(E),G.insertBefore(y,G.firstChild),w=0,N=f.length+h.length;N>w;w++)S=f.length>w?f[w]:h[w-f.length],x=S.attributes.placeholder,x&&(x=x.nodeValue,x&&K.inArray(B,S.type)&&p(S));L=setInterval(function(){for(w=0,N=f.length+h.length;N>w;w++)S=f.length>w?f[w]:h[w-f.length],x=S.attributes.placeholder,x?(x=x.nodeValue,x&&K.inArray(B,S.type)&&(S.getAttribute(j)||p(S),(x!==S.getAttribute(V)||"password"===S.type&&!S.getAttribute(D))&&("password"===S.type&&!S.getAttribute(D)&&K.changeType(S,"text")&&S.setAttribute(D,"password"),S.value===S.getAttribute(V)&&(S.value=x),S.setAttribute(V,x)))):S.getAttribute(P)&&(n(S),S.removeAttribute(V));m||clearInterval(L)},100)}K.addEventListener(t,"beforeunload",function(){J.disable()}),J.disable=J.nativeSupport?e:i,J.enable=J.nativeSupport?e:l}(this),function(t){"use strict";var e=t.fn.val,r=t.fn.prop;Placeholders.nativeSupport||(t.fn.val=function(t){var r=e.apply(this,arguments),n=this.eq(0).data("placeholder-value");return void 0===t&&this.eq(0).data("placeholder-active")&&r===n?"":r},t.fn.prop=function(t,e){return void 0===e&&this.eq(0).data("placeholder-active")&&"value"===t?"":r.apply(this,arguments)})}(jQuery);
|
||||
78
wp/wp-content/plugins/gravityforms/js/plugin_settings.js
Normal file
78
wp/wp-content/plugins/gravityforms/js/plugin_settings.js
Normal file
@@ -0,0 +1,78 @@
|
||||
( function ( $ ) {
|
||||
|
||||
$(document).ready(function() {
|
||||
gform.adminUtils.handleUnsavedChanges( '#gform-settings' );
|
||||
});
|
||||
|
||||
var $container = $( 'div[id="gform_setting_reset"]' ),
|
||||
$publicKey = $( 'input[name="_gform_setting_public_key"]' ),
|
||||
$privateKey = $( 'input[name="_gform_setting_private_key"]' ),
|
||||
$reset = $( 'input[name="_gform_setting_reset"]' );
|
||||
|
||||
window.loadRecaptcha = function () {
|
||||
|
||||
var $recaptcha = $( '#recaptcha' ),
|
||||
$save = $( '#gform-settings-save' ),
|
||||
type = $( 'input[name="_gform_setting_type"]:checked' ).val();
|
||||
|
||||
// Flush existing state.
|
||||
window.___grecaptcha_cfg.clients = {};
|
||||
window.___grecaptcha_cfg.count = 0;
|
||||
$recaptcha.html( '' );
|
||||
$reset.val( 1 );
|
||||
|
||||
// Reset key status.
|
||||
$( '#recpatcha .gform-settings-field__feedback' ).remove();
|
||||
|
||||
// If no public or private key is provided, exit.
|
||||
if ( ! $publicKey.val() || ! $privateKey.val() ) {
|
||||
$save.prop( 'disabled', false );
|
||||
$container.hide();
|
||||
return;
|
||||
} else {
|
||||
$save.prop( 'disabled', true );
|
||||
}
|
||||
|
||||
// Render reCAPTCHA.
|
||||
grecaptcha.render(
|
||||
'recaptcha',
|
||||
{
|
||||
'sitekey': $publicKey.val(),
|
||||
'size': type === 'invisible' ? type : '',
|
||||
'badge': 'inline',
|
||||
'error-callback': function () {
|
||||
},
|
||||
'callback': function () {
|
||||
$save.prop( 'disabled', false );
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
switch ( type ) {
|
||||
|
||||
case 'checkbox':
|
||||
$( '#gforms_checkbox_recaptcha_message, label[for="reset"]' ).show();
|
||||
break;
|
||||
|
||||
case 'invisible':
|
||||
$( '#gforms_checkbox_recaptcha_message, label[for="reset"]' ).hide();
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
$container.show();
|
||||
|
||||
if ( type === 'invisible' ) {
|
||||
grecaptcha.execute();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
$publicKey.on( 'change', loadRecaptcha );
|
||||
$privateKey.on( 'change', loadRecaptcha );
|
||||
|
||||
$( 'input[name="_gform_setting_type"]' ).on( 'change', function () {
|
||||
loadRecaptcha();
|
||||
} );
|
||||
|
||||
} )( jQuery );
|
||||
1
wp/wp-content/plugins/gravityforms/js/plugin_settings.min.js
vendored
Normal file
1
wp/wp-content/plugins/gravityforms/js/plugin_settings.min.js
vendored
Normal file
@@ -0,0 +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);
|
||||
69
wp/wp-content/plugins/gravityforms/js/preview.js
Normal file
69
wp/wp-content/plugins/gravityforms/js/preview.js
Normal file
@@ -0,0 +1,69 @@
|
||||
jQuery( document ).ready(function() {
|
||||
|
||||
// toggle the helper classes that show the form structure
|
||||
jQuery( '.toggle_helpers input[type=checkbox]' ).prop( 'checked',false );
|
||||
|
||||
jQuery('#showgrid').on( 'click', function(){
|
||||
if(jQuery(this).is(":checked")) {
|
||||
jQuery('#preview_form_container').addClass("showgrid");
|
||||
} else {
|
||||
jQuery('#preview_form_container').removeClass("showgrid");
|
||||
}
|
||||
});
|
||||
|
||||
jQuery('#showme').on( 'click', function(){
|
||||
if(jQuery(this).is(":checked")) {
|
||||
jQuery('.gform_wrapper form').addClass("gf_showme");
|
||||
jQuery('#helper_legend_container').css("display", "inline-block");
|
||||
} else {
|
||||
jQuery('.gform_wrapper form').removeClass("gf_showme");
|
||||
jQuery('#helper_legend_container').css("display", "none");
|
||||
}
|
||||
});
|
||||
|
||||
// dismiss the alerts and set a cookie
|
||||
|
||||
if (GetCookie("dismissed-notifications")) {
|
||||
jQuery(GetCookie("dismissed-notifications")).hide();
|
||||
}
|
||||
jQuery(".hidenotice").on( 'click', function () {
|
||||
var alertId = jQuery(this).closest(".preview_notice").attr("id");
|
||||
var dismissedNotifications = GetCookie("dismissed-notifications") + ",#" + alertId;
|
||||
jQuery(this).closest(".preview_notice").slideToggle('slow');
|
||||
SetCookie("dismissed-notifications",dismissedNotifications.replace('null,',''))
|
||||
});
|
||||
|
||||
// Create the cookie
|
||||
function SetCookie(sName, sValue)
|
||||
{
|
||||
document.cookie = sName + "=" + escape(sValue);
|
||||
// Expires the cookie after a month
|
||||
var date = new Date();
|
||||
date.setMonth(date.getMonth()+1);
|
||||
document.cookie += ("; expires=" + date.toUTCString());
|
||||
}
|
||||
|
||||
// Retrieve the value of the cookie.
|
||||
function GetCookie(sName)
|
||||
{
|
||||
var aCookie = document.cookie.split("; ");
|
||||
for (var i=0; i < aCookie.length; i++)
|
||||
{
|
||||
var aCrumb = aCookie[i].split("=");
|
||||
if (sName == aCrumb[0])
|
||||
return unescape(aCrumb[1]);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// display the current viewport size
|
||||
|
||||
jQuery('#browser_size_info').text('Viewport ( Width : '
|
||||
+ jQuery(window).width() + 'px , Height :' + jQuery(window).height() + 'px )');
|
||||
|
||||
jQuery(window).on( 'resize', function () {
|
||||
jQuery('#browser_size_info').text('Viewport ( Width : ' + jQuery(window).width()
|
||||
+ 'px , Height :' + jQuery(window).height() + 'px )');
|
||||
});
|
||||
|
||||
});
|
||||
1
wp/wp-content/plugins/gravityforms/js/preview.min.js
vendored
Normal file
1
wp/wp-content/plugins/gravityforms/js/preview.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
jQuery(document).ready(function(){function o(e){for(var i=document.cookie.split("; "),o=0;o<i.length;o++){var r=i[o].split("=");if(e==r[0])return unescape(r[1])}return null}jQuery(".toggle_helpers input[type=checkbox]").prop("checked",!1),jQuery("#showgrid").on("click",function(){jQuery(this).is(":checked")?jQuery("#preview_form_container").addClass("showgrid"):jQuery("#preview_form_container").removeClass("showgrid")}),jQuery("#showme").on("click",function(){jQuery(this).is(":checked")?(jQuery(".gform_wrapper form").addClass("gf_showme"),jQuery("#helper_legend_container").css("display","inline-block")):(jQuery(".gform_wrapper form").removeClass("gf_showme"),jQuery("#helper_legend_container").css("display","none"))}),o("dismissed-notifications")&&jQuery(o("dismissed-notifications")).hide(),jQuery(".hidenotice").on("click",function(){var e=jQuery(this).closest(".preview_notice").attr("id"),e=o("dismissed-notifications")+",#"+e,i=(jQuery(this).closest(".preview_notice").slideToggle("slow"),"dismissed-notifications"),e=e.replace("null,","");document.cookie=i+"="+escape(e),(i=new Date).setMonth(i.getMonth()+1),document.cookie+="; expires="+i.toUTCString()}),jQuery("#browser_size_info").text("Viewport ( Width : "+jQuery(window).width()+"px , Height :"+jQuery(window).height()+"px )"),jQuery(window).on("resize",function(){jQuery("#browser_size_info").text("Viewport ( Width : "+jQuery(window).width()+"px , Height :"+jQuery(window).height()+"px )")})});
|
||||
762
wp/wp-content/plugins/gravityforms/js/shortcode-ui.js
Normal file
762
wp/wp-content/plugins/gravityforms/js/shortcode-ui.js
Normal file
@@ -0,0 +1,762 @@
|
||||
//Props: https://github.com/fusioneng/Shortcake/
|
||||
var GformShortcodeUI;
|
||||
|
||||
( function (gfShortCodeUI, $) {
|
||||
var i18n = window.gform_admin_i18n;
|
||||
var sui = window.GformShortcodeUI = {
|
||||
models: {},
|
||||
collections: {},
|
||||
views: {},
|
||||
utils: {},
|
||||
strings: {}
|
||||
};
|
||||
|
||||
/**
|
||||
* Shortcode Attribute Model.
|
||||
*/
|
||||
sui.models.ShortcodeAttribute = Backbone.Model.extend({
|
||||
defaults: {
|
||||
attr: '',
|
||||
label: '',
|
||||
type: '',
|
||||
section: '',
|
||||
description: '',
|
||||
default: '',
|
||||
value: ''
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Shortcode Attributes collection.
|
||||
*/
|
||||
sui.models.ShortcodeAttributes = Backbone.Collection.extend({
|
||||
model: sui.models.ShortcodeAttribute,
|
||||
// Deep Clone.
|
||||
clone: function () {
|
||||
return new this.constructor(_.map(this.models, function (m) {
|
||||
return m.clone();
|
||||
}));
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* Shortcode Model
|
||||
*/
|
||||
sui.models.Shortcode = Backbone.Model.extend({
|
||||
|
||||
defaults: {
|
||||
label: '',
|
||||
shortcode_tag: '',
|
||||
action_tag: '',
|
||||
attrs: sui.models.ShortcodeAttributes,
|
||||
},
|
||||
|
||||
/**
|
||||
* Custom set method.
|
||||
* Handles setting the attribute collection.
|
||||
*/
|
||||
set: function (attributes, options) {
|
||||
|
||||
if (attributes.attrs !== undefined && !( attributes.attrs instanceof sui.models.ShortcodeAttributes )) {
|
||||
|
||||
_.each(attributes.attrs, function (attr) {
|
||||
if (attr.default != undefined) {
|
||||
attr.value = attr.default
|
||||
}
|
||||
});
|
||||
|
||||
attributes.attrs = new sui.models.ShortcodeAttributes(attributes.attrs);
|
||||
}
|
||||
|
||||
return Backbone.Model.prototype.set.call(this, attributes, options);
|
||||
},
|
||||
|
||||
/**
|
||||
* Custom toJSON.
|
||||
* Handles converting the attribute collection to JSON.
|
||||
*/
|
||||
toJSON: function (options) {
|
||||
options = Backbone.Model.prototype.toJSON.call(this, options);
|
||||
if (options.attrs !== undefined && ( options.attrs instanceof sui.models.ShortcodeAttributes )) {
|
||||
options.attrs = options.attrs.toJSON();
|
||||
}
|
||||
return options;
|
||||
},
|
||||
|
||||
/**
|
||||
* Custom clone
|
||||
* Make sure we don't clone a reference to attributes.
|
||||
*/
|
||||
clone: function () {
|
||||
var clone = Backbone.Model.prototype.clone.call(this);
|
||||
clone.set('attrs', clone.get('attrs').clone());
|
||||
return clone;
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the shortcode as... a shortcode!
|
||||
*
|
||||
* @return string eg [shortcode attr1=value]
|
||||
*/
|
||||
formatShortcode: function () {
|
||||
|
||||
var template, shortcodeAttributes, attrs = [], content, action = '', actions = [];
|
||||
|
||||
this.get('attrs').each(function (attr) {
|
||||
|
||||
var val = attr.get('value');
|
||||
var type = attr.get('type');
|
||||
var def = attr.get('default');
|
||||
|
||||
// Skip empty attributes.
|
||||
// Skip unchecked checkboxes that have don't have default='true'.
|
||||
if (( ( !val || val.length < 1 ) && type != 'checkbox') || ( type == 'checkbox' && def != 'true' && !val )) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle content attribute as a special case.
|
||||
if (attr.get('attr') === 'content') {
|
||||
content = attr.get('value');
|
||||
} else {
|
||||
attrs.push(attr.get('attr') + '="' + val + '"');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
template = "[{{ shortcode }} {{ attributes }}]"
|
||||
|
||||
if (content && content.length > 0) {
|
||||
template += "{{ content }}[/{{ shortcode }}]"
|
||||
}
|
||||
|
||||
template = template.replace(/{{ shortcode }}/g, this.get('shortcode_tag'));
|
||||
template = template.replace(/{{ attributes }}/g, attrs.join(' '));
|
||||
template = template.replace(/{{ content }}/g, content);
|
||||
|
||||
return template;
|
||||
|
||||
},
|
||||
|
||||
validate: function (shortcode) {
|
||||
var errors = [];
|
||||
var id = shortcode.attrs.findWhere({attr: 'id'});
|
||||
if (!id.get('value')) {
|
||||
errors.push({'id': sui.strings.pleaseSelectAForm});
|
||||
}
|
||||
|
||||
return errors.length ? errors : null;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Shortcode Collection
|
||||
sui.collections.Shortcodes = Backbone.Collection.extend({
|
||||
model: sui.models.Shortcode
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Single edit shortcode content view.
|
||||
*/
|
||||
sui.views.editShortcodeForm = wp.Backbone.View.extend({
|
||||
|
||||
el: '#gform-shortcode-ui-container',
|
||||
|
||||
template: wp.template('gf-shortcode-default-edit-form'),
|
||||
|
||||
hasAdvancedValue: false,
|
||||
|
||||
events: {
|
||||
'click #gform-update-shortcode': 'insertShortcode',
|
||||
'click #gform-insert-shortcode': 'insertShortcode',
|
||||
'click #gform-cancel-shortcode': 'cancelShortcode'
|
||||
},
|
||||
|
||||
initialize: function () {
|
||||
|
||||
_.bindAll(this, 'beforeRender', 'render', 'afterRender');
|
||||
|
||||
var t = this;
|
||||
this.render = _.wrap(this.render, function (render) {
|
||||
t.beforeRender();
|
||||
render();
|
||||
t.afterRender();
|
||||
return t;
|
||||
});
|
||||
|
||||
|
||||
this.model.get('attrs').each(function (attr) {
|
||||
switch (attr.get('section')) {
|
||||
case 'required':
|
||||
t.views.add(
|
||||
'.gf-edit-shortcode-form-required-attrs',
|
||||
new sui.views.editAttributeField({model: attr, parent: t})
|
||||
);
|
||||
break;
|
||||
case 'standard':
|
||||
t.views.add(
|
||||
'.gf-edit-shortcode-form-standard-attrs',
|
||||
new sui.views.editAttributeField({model: attr, parent: t})
|
||||
);
|
||||
break;
|
||||
default:
|
||||
t.views.add(
|
||||
'.gf-edit-shortcode-form-advanced-attrs',
|
||||
new sui.views.editAttributeField({model: attr, parent: t})
|
||||
);
|
||||
if (!t.hasAdvancedVal) {
|
||||
t.hasAdvancedVal = attr.get('value') !== '';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.listenTo(this.model, 'change', this.render);
|
||||
},
|
||||
|
||||
beforeRender: function () {
|
||||
//
|
||||
},
|
||||
|
||||
afterRender: function () {
|
||||
gform_initialize_tooltips();
|
||||
|
||||
$('#gform-insert-shortcode').toggle(this.options.viewMode == 'insert');
|
||||
$('#gform-update-shortcode').toggle(this.options.viewMode != 'insert');
|
||||
$('#gf-edit-shortcode-form-advanced-attrs').toggle(this.hasAdvancedVal);
|
||||
},
|
||||
|
||||
insertShortcode: function (e) {
|
||||
|
||||
var isValid = this.model.isValid({validate: true});
|
||||
|
||||
if (isValid) {
|
||||
send_to_editor(this.model.formatShortcode());
|
||||
tb_remove();
|
||||
|
||||
this.dispose();
|
||||
|
||||
} else {
|
||||
_.each(this.model.validationError, function (error) {
|
||||
_.each(error, function (message, attr) {
|
||||
alert(message);
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
cancelShortcode: function (e) {
|
||||
tb_remove();
|
||||
this.dispose();
|
||||
},
|
||||
dispose: function () {
|
||||
this.remove();
|
||||
$('#gform-shortcode-ui-wrap').append('<div id="gform-shortcode-ui-container"></div>');
|
||||
}
|
||||
});
|
||||
|
||||
sui.views.editAttributeField = Backbone.View.extend({
|
||||
|
||||
tagName: "div",
|
||||
|
||||
initialize: function (options) {
|
||||
this.parent = options.parent;
|
||||
},
|
||||
|
||||
events: {
|
||||
'keyup input[type="text"]': 'updateValue',
|
||||
'keyup textarea': 'updateValue',
|
||||
'change select': 'updateValue',
|
||||
'change #gf-shortcode-attr-action': 'updateAction',
|
||||
'change input[type=checkbox]': 'updateCheckbox',
|
||||
'change input[type=radio]': 'updateValue',
|
||||
'change input[type=email]': 'updateValue',
|
||||
'change input[type=number]': 'updateValue',
|
||||
'change input[type=date]': 'updateValue',
|
||||
'change input[type=url]': 'updateValue',
|
||||
|
||||
},
|
||||
|
||||
|
||||
render: function () {
|
||||
this.template = wp.media.template('gf-shortcode-ui-field-' + this.model.get('type'));
|
||||
return this.$el.html(this.template(this.model.toJSON()));
|
||||
},
|
||||
|
||||
/**
|
||||
* Input Changed Update Callback.
|
||||
*
|
||||
* If the input field that has changed is for content or a valid attribute,
|
||||
* then it should update the model.
|
||||
*/
|
||||
updateValue: function (e) {
|
||||
var $el = $(e.target);
|
||||
this.model.set('value', $el.val());
|
||||
},
|
||||
|
||||
updateCheckbox: function (e) {
|
||||
var $el = $(e.target);
|
||||
var val = $el.prop('checked');
|
||||
|
||||
this.model.set('value', val);
|
||||
},
|
||||
|
||||
updateAction: function (e) {
|
||||
var $el = $(e.target),
|
||||
val = $el.val();
|
||||
|
||||
this.model.set('value', val);
|
||||
var m = this.parent.model;
|
||||
var newShortcodeModel = sui.shortcodes.findWhere({shortcode_tag: 'gravityform', action_tag: val});
|
||||
|
||||
// copy over values to new shortcode model
|
||||
var currentAttrs = m.get('attrs');
|
||||
newShortcodeModel.get('attrs').each(function (attr) {
|
||||
var newAt = attr.get('attr');
|
||||
var currentAtModel = currentAttrs.findWhere({attr: newAt});
|
||||
if (typeof currentAtModel != 'undefined') {
|
||||
var currentAt = currentAtModel.get('attr');
|
||||
if (newAt == currentAt) {
|
||||
var currentVal = currentAtModel.get('value');
|
||||
attr.set('value', String(currentVal));
|
||||
}
|
||||
}
|
||||
});
|
||||
$(this.parent.el).empty();
|
||||
var viewMode = this.parent.options.viewMode;
|
||||
this.parent.dispose();
|
||||
this.parent.model.set(newShortcodeModel);
|
||||
GformShortcodeUI = new sui.views.editShortcodeForm({model: newShortcodeModel, viewMode: viewMode});
|
||||
GformShortcodeUI.render();
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
sui.utils.shortcodeViewConstructor = {
|
||||
|
||||
initialize: function( options ) {
|
||||
this.shortcodeModel = this.getShortcodeModel( this.shortcode );
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the shortcode model given the view shortcode options.
|
||||
* Must be a registered shortcode (see sui.shortcodes)
|
||||
*/
|
||||
getShortcodeModel: function( options ) {
|
||||
|
||||
var actionTag = typeof options.attrs.named.action != 'undefined' ? options.attrs.named.action : '';
|
||||
var shortcodeModel = sui.shortcodes.findWhere({action_tag: actionTag});
|
||||
|
||||
if ( ! shortcodeModel ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var shortcode = shortcodeModel.clone();
|
||||
|
||||
shortcode.get('attrs').each(function (attr) {
|
||||
|
||||
if (attr.get('attr') in options.attrs.named) {
|
||||
attr.set('value', options.attrs.named[attr.get('attr')]);
|
||||
}
|
||||
|
||||
if (attr.get('attr') === 'content' && ( 'content' in options )) {
|
||||
attr.set('value', options.content);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return shortcode;
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Return the preview HTML.
|
||||
* If empty, fetches data.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
getContent : function() {
|
||||
if ( ! this.content ) {
|
||||
this.fetch();
|
||||
}
|
||||
return this.content;
|
||||
},
|
||||
|
||||
/**
|
||||
* Fetch preview.
|
||||
* Async. Sets this.content and calls this.render.
|
||||
*
|
||||
* @return undefined
|
||||
*/
|
||||
fetch : function() {
|
||||
|
||||
var self = this;
|
||||
|
||||
if ( ! this.fetching ) {
|
||||
|
||||
this.fetching = true;
|
||||
|
||||
var attr = this.shortcodeModel.get('attrs').findWhere({attr: 'id'});
|
||||
var formId = attr.get('value');
|
||||
var data;
|
||||
data = {
|
||||
action: 'gf_do_shortcode',
|
||||
post_id: $('#post_ID').val(),
|
||||
form_id: formId,
|
||||
shortcode: this.shortcodeModel.formatShortcode(),
|
||||
nonce: gfShortcodeUIData.previewNonce
|
||||
};
|
||||
|
||||
$.post(ajaxurl, data).done(function(response) {
|
||||
self.content = response;
|
||||
}).fail(function () {
|
||||
self.content = '<span class="gf_shortcode_ui_error">' + gfShortcodeUIData.strings.errorLoadingPreview + '</span>';
|
||||
}).always(function () {
|
||||
delete self.fetching;
|
||||
self.render();
|
||||
});
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
setLoader: function() {
|
||||
this.setContent(
|
||||
'<div class="loading-placeholder">' +
|
||||
'<div class="dashicons dashicons-feedback"></div>' +
|
||||
'<div class="wpview-loading"><ins></ins></div>' +
|
||||
'</div>'
|
||||
);
|
||||
},
|
||||
|
||||
// Backwards compatability for WP pre-4.2
|
||||
View: {
|
||||
overlay: true,
|
||||
|
||||
shortcodeHTML: false,
|
||||
|
||||
setContent: function (html, option) {
|
||||
this.getNodes(function (editor, node, content) {
|
||||
var el = ( option === 'wrap' || option === 'replace' ) ? node : content,
|
||||
insert = html;
|
||||
|
||||
if (_.isString(insert)) {
|
||||
insert = editor.dom.createFragment(insert);
|
||||
}
|
||||
|
||||
if (option === 'replace') {
|
||||
editor.dom.replace(insert, el);
|
||||
} else if (option === 'remove') {
|
||||
node.parentNode.insertBefore(insert, node.nextSibling);
|
||||
$(node).remove();
|
||||
} else {
|
||||
el.innerHTML = '';
|
||||
el.appendChild(insert);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
initialize: function (options) {
|
||||
var actionTag = typeof options.shortcode.attrs.named.action != 'undefined' ? options.shortcode.attrs.named.action : '';
|
||||
var shortcodeModel = sui.shortcodes.findWhere({action_tag: actionTag});
|
||||
|
||||
if (!shortcodeModel) {
|
||||
this.shortcodeHTML = decodeURIComponent(options.encodedText);
|
||||
this.shortcode = false;
|
||||
return;
|
||||
}
|
||||
|
||||
var shortcode = shortcodeModel.clone();
|
||||
|
||||
shortcode.get('attrs').each(function (attr) {
|
||||
|
||||
if (attr.get('attr') in options.shortcode.attrs.named) {
|
||||
attr.set(
|
||||
'value',
|
||||
options.shortcode.attrs.named[attr.get('attr')]
|
||||
);
|
||||
}
|
||||
|
||||
if (attr.get('attr') === 'content' && ( 'content' in options.shortcode )) {
|
||||
attr.set('value', options.shortcode.content);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
this.shortcode = shortcode;
|
||||
},
|
||||
|
||||
loadingPlaceholder: function () {
|
||||
return '' +
|
||||
'<div class="loading-placeholder">' +
|
||||
'<div class="dashicons dashicons-feedback"></div>' +
|
||||
'<div class="wpview-loading"><ins></ins></div>' +
|
||||
'</div>';
|
||||
},
|
||||
|
||||
/**
|
||||
* @see wp.mce.View.getEditors
|
||||
*/
|
||||
getEditors: function (callback) {
|
||||
var editors = [];
|
||||
|
||||
_.each(tinymce.editors, function (editor) {
|
||||
if (editor.plugins.wpview) {
|
||||
if (callback) {
|
||||
callback(editor);
|
||||
}
|
||||
|
||||
editors.push(editor);
|
||||
}
|
||||
}, this);
|
||||
|
||||
return editors;
|
||||
},
|
||||
|
||||
/**
|
||||
* @see wp.mce.View.getNodes
|
||||
*/
|
||||
getNodes: function (callback) {
|
||||
var nodes = [],
|
||||
self = this;
|
||||
|
||||
this.getEditors(function (editor) {
|
||||
$(editor.getBody())
|
||||
.find('[data-wpview-text="' + self.encodedText + '"]')
|
||||
.each(function (i, node) {
|
||||
if (callback) {
|
||||
callback(editor, node, $(node).find('.wpview-content').get(0));
|
||||
}
|
||||
|
||||
nodes.push(node);
|
||||
});
|
||||
});
|
||||
|
||||
return nodes;
|
||||
},
|
||||
|
||||
/**
|
||||
* Set the HTML. Modeled after wp.mce.View.setIframes
|
||||
*
|
||||
*/
|
||||
setIframes: function (body) {
|
||||
var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
|
||||
|
||||
if (body.indexOf('<script') === -1) {
|
||||
this.shortcodeHTML = body;
|
||||
this.render();
|
||||
return;
|
||||
}
|
||||
|
||||
this.getNodes(function (editor, node, content) {
|
||||
var dom = editor.dom,
|
||||
styles = '',
|
||||
bodyClasses = editor.getBody().className || '',
|
||||
iframe, iframeDoc, i, resize;
|
||||
|
||||
content.innerHTML = '';
|
||||
var head = '';
|
||||
|
||||
if (!wp.mce.views.sandboxStyles) {
|
||||
tinymce.each(dom.$('link[rel="stylesheet"]', editor.getDoc().head), function (link) {
|
||||
if (link.href && link.href.indexOf('skins/lightgray/content.min.css') === -1 &&
|
||||
link.href.indexOf('skins/wordpress/wp-content.css') === -1) {
|
||||
|
||||
styles += dom.getOuterHTML(link) + '\n';
|
||||
}
|
||||
});
|
||||
|
||||
wp.mce.views.sandboxStyles = styles;
|
||||
} else {
|
||||
styles = wp.mce.views.sandboxStyles;
|
||||
}
|
||||
|
||||
// Seems Firefox needs a bit of time to insert/set the view nodes, or the iframe will fail
|
||||
// especially when switching Text => Visual.
|
||||
setTimeout(function () {
|
||||
iframe = dom.add(content, 'iframe', {
|
||||
src: tinymce.Env.ie ? 'javascript:""' : '',
|
||||
frameBorder: '0',
|
||||
id: 'gf-shortcode-preview-' + new Date().getTime(),
|
||||
allowTransparency: 'true',
|
||||
scrolling: 'no',
|
||||
'class': 'wpview-sandbox',
|
||||
style: {
|
||||
width: '100%',
|
||||
display: 'block'
|
||||
}
|
||||
});
|
||||
|
||||
iframeDoc = iframe.contentWindow.document;
|
||||
|
||||
iframeDoc.open();
|
||||
iframeDoc.write(
|
||||
'<!DOCTYPE html>' +
|
||||
'<html>' +
|
||||
'<head>' +
|
||||
'<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />' +
|
||||
head +
|
||||
styles +
|
||||
'<style>' +
|
||||
'html {' +
|
||||
'background: transparent;' +
|
||||
'padding: 0;' +
|
||||
'margin: 0;' +
|
||||
'}' +
|
||||
'body#wpview-iframe-sandbox {' +
|
||||
'background: transparent;' +
|
||||
'padding: 1px 0 !important;' +
|
||||
'margin: -1px 0 0 !important;' +
|
||||
'}' +
|
||||
'body#wpview-iframe-sandbox:before,' +
|
||||
'body#wpview-iframe-sandbox:after {' +
|
||||
'display: none;' +
|
||||
'content: "";' +
|
||||
'}' +
|
||||
'</style>' +
|
||||
'</head>' +
|
||||
'<body id="wpview-iframe-sandbox" class="' + bodyClasses + '">' +
|
||||
body +
|
||||
'</body>' +
|
||||
'</html>'
|
||||
);
|
||||
iframeDoc.close();
|
||||
|
||||
resize = function () {
|
||||
// Make sure the iframe still exists.
|
||||
iframe.contentWindow && $(iframe).height($(iframeDoc.body).height());
|
||||
};
|
||||
|
||||
if (MutationObserver) {
|
||||
new MutationObserver(_.debounce(function () {
|
||||
resize();
|
||||
}, 100))
|
||||
.observe(iframeDoc.body, {
|
||||
attributes: true,
|
||||
childList: true,
|
||||
subtree: true
|
||||
});
|
||||
} else {
|
||||
for (i = 1; i < 6; i++) {
|
||||
setTimeout(resize, i * 700);
|
||||
}
|
||||
}
|
||||
|
||||
resize();
|
||||
|
||||
editor.on('wp-body-class-change', function () {
|
||||
iframeDoc.body.className = editor.getBody().className;
|
||||
});
|
||||
|
||||
|
||||
}, 50);
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Render the shortcode
|
||||
*
|
||||
* To ensure consistent rendering - this makes an ajax request to the admin and displays.
|
||||
* @return string html
|
||||
*/
|
||||
getHtml: function () {
|
||||
|
||||
if (!this.shortcode) {
|
||||
this.setContent(this.shortcodeHTML, 'remove');
|
||||
return;
|
||||
}
|
||||
|
||||
var data;
|
||||
|
||||
if (false === this.shortcodeHTML) {
|
||||
var attr = this.shortcode.get('attrs').findWhere({attr: 'id'});
|
||||
var formId = attr.get('value');
|
||||
data = {
|
||||
action: 'gf_do_shortcode',
|
||||
post_id: $('#post_ID').val(),
|
||||
form_id: formId,
|
||||
shortcode: this.shortcode.formatShortcode(),
|
||||
nonce: gfShortcodeUIData.previewNonce
|
||||
};
|
||||
|
||||
$.post(ajaxurl, data, $.proxy(this.setIframes, this));
|
||||
|
||||
}
|
||||
return this.shortcodeHTML;
|
||||
},
|
||||
},
|
||||
|
||||
edit : function( shortcodeString ) {
|
||||
|
||||
var currentShortcode;
|
||||
|
||||
// Backwards compatability for WP pre-4.2
|
||||
if ( 'object' === typeof( shortcodeString ) ) {
|
||||
shortcodeString = decodeURIComponent( jQuery(shortcodeString).attr('data-wpview-text') );
|
||||
}
|
||||
|
||||
currentShortcode = wp.shortcode.next('gravityform', shortcodeString);
|
||||
|
||||
if ( currentShortcode ) {
|
||||
|
||||
var action = currentShortcode.shortcode.attrs.named.action ? currentShortcode.shortcode.attrs.named.action : '';
|
||||
|
||||
var defaultShortcode = sui.shortcodes.findWhere({
|
||||
shortcode_tag: currentShortcode.shortcode.tag,
|
||||
action_tag: action
|
||||
});
|
||||
|
||||
if (!defaultShortcode) {
|
||||
return;
|
||||
}
|
||||
|
||||
var currentShortcodeModel = defaultShortcode.clone();
|
||||
|
||||
// convert attribute strings to object.
|
||||
_.each(currentShortcode.shortcode.attrs.named, function (val, key) {
|
||||
attr = currentShortcodeModel.get('attrs').findWhere({attr: key});
|
||||
if (attr) {
|
||||
attr.set('value', val);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var idAttr = currentShortcodeModel.get('attrs').findWhere({attr: 'id'});
|
||||
var formId = idAttr.get('value');
|
||||
$('#add_form_id').val(formId);
|
||||
|
||||
GformShortcodeUI = new sui.views.editShortcodeForm({model: currentShortcodeModel, viewMode: 'update'});
|
||||
GformShortcodeUI.render();
|
||||
|
||||
$('#gform-insert-shortcode').hide();
|
||||
$('#gform-update-shortcode').show();
|
||||
tb_show( i18n.shortcodeUi.editForm, "#TB_inline?inlineId=select_gravity_form&width=753&height=686", "");
|
||||
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
sui.strings = gfShortcodeUIData.strings;
|
||||
|
||||
sui.shortcodes = new sui.collections.Shortcodes( gfShortcodeUIData.shortcodes );
|
||||
|
||||
if( ! gfShortcodeUIData.previewDisabled && typeof wp.mce != 'undefined'){
|
||||
wp.mce.views.register( 'gravityform', $.extend(true, {}, sui.utils.shortcodeViewConstructor) );
|
||||
}
|
||||
|
||||
$(document).on('click', '.gform_media_link', function () {
|
||||
sui.shortcodes = new sui.collections.Shortcodes(gfShortcodeUIData.shortcodes);
|
||||
var shortcode = sui.shortcodes.findWhere({shortcode_tag: 'gravityform', action_tag: ''});
|
||||
GformShortcodeUI = new sui.views.editShortcodeForm({model: shortcode, viewMode: 'insert'});
|
||||
GformShortcodeUI.render();
|
||||
tb_show( i18n.shortcodeUi.insertForm, "#TB_inline?inlineId=select_gravity_form&width=753&height=686", "" );
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}(window.gfShortcodeUI = window.gfShortcodeUI || {}, jQuery));
|
||||
|
||||
1
wp/wp-content/plugins/gravityforms/js/shortcode-ui.min.js
vendored
Normal file
1
wp/wp-content/plugins/gravityforms/js/shortcode-ui.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
7
wp/wp-content/plugins/gravityforms/js/skip.js
Normal file
7
wp/wp-content/plugins/gravityforms/js/skip.js
Normal file
@@ -0,0 +1,7 @@
|
||||
// used to exit a node process for release tasks
|
||||
|
||||
if (process.env.SKIP_BUILD) {
|
||||
process.exit(0);
|
||||
} else {
|
||||
process.exit(1);
|
||||
}
|
||||
1
wp/wp-content/plugins/gravityforms/js/skip.min.js
vendored
Normal file
1
wp/wp-content/plugins/gravityforms/js/skip.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
process.env.SKIP_BUILD?process.exit(0):process.exit(1);
|
||||
91
wp/wp-content/plugins/gravityforms/js/tooltip_init.js
Normal file
91
wp/wp-content/plugins/gravityforms/js/tooltip_init.js
Normal file
@@ -0,0 +1,91 @@
|
||||
jQuery( function() {
|
||||
gform_initialize_tooltips();
|
||||
} );
|
||||
|
||||
function gform_initialize_tooltips() {
|
||||
var $tooltips = jQuery( '.gf_tooltip' );
|
||||
if ( ! $tooltips.length ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$tooltips.tooltip( {
|
||||
show: {
|
||||
effect: 'fadeIn',
|
||||
duration: 200,
|
||||
delay: 100,
|
||||
},
|
||||
position: {
|
||||
my: 'center bottom',
|
||||
at: 'center-3 top-11',
|
||||
},
|
||||
tooltipClass: 'arrow-bottom',
|
||||
items: '[aria-label]',
|
||||
content: function () {
|
||||
var content = jQuery( this ).attr( 'aria-label' );
|
||||
return gform_strip_scripts( content );
|
||||
},
|
||||
open: function ( event, ui ) {
|
||||
if ( typeof ( event.originalEvent ) === 'undefined' ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// set the tooltip offset on reveal based on tip width and offset of trigger to handle dynamic changes in overflow
|
||||
setTimeout( function() {
|
||||
var leftOffset = ( this.getBoundingClientRect().left - ( ( ui.tooltip[0].offsetWidth / 2 ) - 5 ) ).toFixed(3);
|
||||
ui.tooltip.css( 'left', leftOffset + 'px' );
|
||||
}.bind( this ), 100 );
|
||||
|
||||
|
||||
var $id = ui.tooltip.attr( 'id' );
|
||||
jQuery( 'div.ui-tooltip' ).not( '#' + $id ).remove();
|
||||
},
|
||||
close: function ( event, ui ) {
|
||||
ui.tooltip.hover( function () {
|
||||
jQuery( this ).stop( true ).fadeTo( 400, 1 );
|
||||
},
|
||||
function () {
|
||||
jQuery( this ).fadeOut( '500', function () {
|
||||
jQuery( this ).remove();
|
||||
} );
|
||||
} );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitizes a given piece of HTML markup by removing script tags from it.
|
||||
*
|
||||
* @param {string} content The HTML content to sanitize.
|
||||
*
|
||||
* @return {string}
|
||||
*/
|
||||
function gform_strip_scripts( content ) {
|
||||
var tempWrapper = document.createElement( 'div' );
|
||||
|
||||
tempWrapper.innerHTML = content;
|
||||
|
||||
var scripts = tempWrapper.getElementsByTagName( 'script' );
|
||||
|
||||
for ( var i = 0; i < scripts.length; i++ ) {
|
||||
scripts[ i ].parentNode.removeChild( scripts[ i ] );
|
||||
}
|
||||
|
||||
return tempWrapper.innerHTML;
|
||||
}
|
||||
|
||||
function gform_system_shows_scrollbars() {
|
||||
var parent = document.createElement("div");
|
||||
parent.setAttribute("style", "width:30px;height:30px;");
|
||||
parent.classList.add('scrollbar-test');
|
||||
|
||||
var child = document.createElement("div");
|
||||
child.setAttribute("style", "width:100%;height:40px");
|
||||
parent.appendChild(child);
|
||||
document.body.appendChild(parent);
|
||||
|
||||
var scrollbarWidth = 30 - parent.firstChild.clientWidth;
|
||||
|
||||
document.body.removeChild(parent);
|
||||
|
||||
return scrollbarWidth ? true : false;
|
||||
}
|
||||
1
wp/wp-content/plugins/gravityforms/js/tooltip_init.min.js
vendored
Normal file
1
wp/wp-content/plugins/gravityforms/js/tooltip_init.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
function gform_initialize_tooltips(){var t=jQuery(".gf_tooltip");t.length&&t.tooltip({show:{effect:"fadeIn",duration:200,delay:100},position:{my:"center bottom",at:"center-3 top-11"},tooltipClass:"arrow-bottom",items:"[aria-label]",content:function(){return gform_strip_scripts(jQuery(this).attr("aria-label"))},open:function(t,e){if(void 0===t.originalEvent)return!1;setTimeout(function(){var t=(this.getBoundingClientRect().left-(e.tooltip[0].offsetWidth/2-5)).toFixed(3);e.tooltip.css("left",t+"px")}.bind(this),100);t=e.tooltip.attr("id");jQuery("div.ui-tooltip").not("#"+t).remove()},close:function(t,e){e.tooltip.hover(function(){jQuery(this).stop(!0).fadeTo(400,1)},function(){jQuery(this).fadeOut("500",function(){jQuery(this).remove()})})}})}function gform_strip_scripts(t){for(var e=document.createElement("div"),i=(e.innerHTML=t,e.getElementsByTagName("script")),o=0;o<i.length;o++)i[o].parentNode.removeChild(i[o]);return e.innerHTML}function gform_system_shows_scrollbars(){var t=document.createElement("div"),e=(t.setAttribute("style","width:30px;height:30px;"),t.classList.add("scrollbar-test"),document.createElement("div")),e=(e.setAttribute("style","width:100%;height:40px"),t.appendChild(e),document.body.appendChild(t),30-t.firstChild.clientWidth);return document.body.removeChild(t),!!e}jQuery(function(){gform_initialize_tooltips()});
|
||||
6585
wp/wp-content/plugins/gravityforms/js/vendor/selectWoo.full.js
vendored
Normal file
6585
wp/wp-content/plugins/gravityforms/js/vendor/selectWoo.full.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
5547
wp/wp-content/plugins/gravityforms/js/vendor/simplebar.js
vendored
Normal file
5547
wp/wp-content/plugins/gravityforms/js/vendor/simplebar.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user