This commit is contained in:
zbatte committed 2026-07-02 15:54:39 -06:00
commit 9883323161
17470 files changed
+4470592

No files matched your search

@@ -0,0 +1,3 @@
/* Chosen v1.8.7 | (c) 2011-2018 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
(function(){var t,e,s,i,n=function(t,e){return function(){return t.apply(e,arguments)}},r=function(t,e){function s(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return s.prototype=e.prototype,t.prototype=new s,t.__super__=e.prototype,t},o={}.hasOwnProperty;(i=function(){function t(){this.options_index=0,this.parsed=[]}return t.prototype.add_node=function(t){return"OPTGROUP"===t.nodeName.toUpperCase()?this.add_group(t):this.add_option(t)},t.prototype.add_group=function(t){var e,s,i,n,r,o;for(e=this.parsed.length,this.parsed.push({array_index:e,group:!0,label:t.label,title:t.title?t.title:void 0,children:0,disabled:t.disabled,classes:t.className}),o=[],s=0,i=(r=t.childNodes).length;s<i;s++)n=r[s],o.push(this.add_option(n,e,t.disabled));return o},t.prototype.add_option=function(t,e,s){if("OPTION"===t.nodeName.toUpperCase())return""!==t.text?(null!=e&&(this.parsed[e].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:t.value,text:t.text,html:t.innerHTML,title:t.title?t.title:void 0,selected:t.selected,disabled:!0===s?s:t.disabled,group_array_index:e,group_label:null!=e?this.parsed[e].label:null,classes:t.className,style:t.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1},t}()).select_to_array=function(t){var e,s,n,r,o;for(r=new i,s=0,n=(o=t.childNodes).length;s<n;s++)e=o[s],r.add_node(e);return r.parsed},e=function(){function t(e,s){this.form_field=e,this.options=null!=s?s:{},this.label_click_handler=n(this.label_click_handler,this),t.browser_is_supported()&&(this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers(),this.on_ready())}return t.prototype.set_default_values=function(){return this.click_test_action=function(t){return function(e){return t.test_active_click(e)}}(this),this.activate_action=function(t){return function(e){return t.activate_field(e)}}(this),this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.is_rtl=this.options.rtl||/\bchosen-rtl\b/.test(this.form_field.className),this.allow_single_deselect=null!=this.options.allow_single_deselect&&null!=this.form_field.options[0]&&""===this.form_field.options[0].text&&this.options.allow_single_deselect,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=null==this.options.enable_split_word_search||this.options.enable_split_word_search,this.group_search=null==this.options.group_search||this.options.group_search,this.search_contains=this.options.search_contains||!1,this.single_backstroke_delete=null==this.options.single_backstroke_delete||this.options.single_backstroke_delete,this.max_selected_options=this.options.max_selected_options||Infinity,this.inherit_select_classes=this.options.inherit_select_classes||!1,this.display_selected_options=null==this.options.display_selected_options||this.options.display_selected_options,this.display_disabled_options=null==this.options.display_disabled_options||this.options.display_disabled_options,this.include_group_label_in_selected=this.options.include_group_label_in_selected||!1,this.max_shown_results=this.options.max_shown_results||Number.POSITIVE_INFINITY,this.case_sensitive_search=this.options.case_sensitive_search||!1,this.hide_results_on_select=null==this.options.hide_results_on_select||this.options.hide_results_on_select},t.prototype.set_default_text=function(){return this.form_field.getAttribute("data-placeholder")?this.default_text=this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.default_text=this.options.placeholder_text_multiple||this.options.placeholder_text||t.default_multiple_text:this.default_text=this.options.placeholder_text_single||this.options.placeholder_text||t.default_single_text,this.default_text=this.escape_html(this.default_text),this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||t.default_no_result_text},t.prototype.choice_label=function(t){return this.include_group_label_in_selected&&null!=t.group_label?"<b class='group-name'>"+this.escape_html(t.group_label)+"</b>"+t.html:t.html},t.prototype.mouse_enter=function(){return this.mouse_on_container=!0},t.prototype.mouse_leave=function(){return this.mouse_on_container=!1},t.prototype.input_focus=function(t){if(this.is_multiple){if(!this.active_field)return setTimeout(function(t){return function(){return t.container_mousedown()}}(this),50)}else if(!this.active_field)return this.activate_field()},t.prototype.input_blur=function(t){if(!this.mouse_on_container)return this.active_field=!1,setTimeout(function(t){return function(){return t.blur_test()}}(this),100)},t.prototype.label_click_handler=function(t){return this.is_multiple?this.container_mousedown(t):this.activate_field()},t.proLine truncated
@@ -0,0 +1 @@
var GF_CONDITIONAL_INSTANCE=!1,GF_CONDITIONAL_INSTANCES_COLLECTION=[],FOCUSABLE_ELEMENTS=["a[href]","area[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","iframe","object","embed","[contenteditable]",'[tabindex]:not([tabindex^="-"])'],TAB_KEY=9,ESCAPE_KEY=27,FOCUSED_BEFORE_DIALOG=null,FOCUSED_BEFORE_RENDER=null;function setFocusToFirstItem(e,t){t&&t.target&&!gform.tools.getClosest(t.target,"#"+e.id)||(t=getFocusableChildren(e)).length&&t[0].focus()}function getFocusableChildren(e){return $$(FOCUSABLE_ELEMENTS.join(","),e).filter(function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)})}function trapTabKey(e,t){var e=getFocusableChildren(e),i=e.indexOf(document.activeElement);t.shiftKey&&0===i?(e[e.length-1].focus(),t.preventDefault()):t.shiftKey||i!==e.length-1||(e[0].focus(),t.preventDefault())}function $$(e,t){return gform.tools.convertElements((t||document).querySelectorAll(e))}function renderView(e,t,i,o){FOCUSED_BEFORE_RENDER=document.activeElement;var n,s=e;for(n in i)var l=i[n],a=new RegExp("{{ "+n+" }}","g"),s=s.replace(a,l);return o?(t.innerHTML=s,FOCUSED_BEFORE_RENDER.id&&window.setTimeout(function(){null!=document.getElementById(FOCUSED_BEFORE_RENDER.id)&&document.getElementById(FOCUSED_BEFORE_RENDER.id).focus()},10),!0):s}function getFieldById(t){var e=this.form.fields.filter(function(e){return e.id==t});return!!e.length&&e[0]}function getCorrectDefaultFieldId(e){var t;return e?(!useFieldId(e)&&(t=e.inputs.filter(function(e){return!e.isHidden})).length?t[0]:e).id:null}function useFieldId(e){return!e.inputs||["checkbox","email","consent","radio"].includes(GetInputType(e))}function getOptionsFromSelect(e,t){var i=[],o=gf_vars.emptyChoice,o={label:o=e.placeholder?e.placeholder:o,value:"",selected:""===t?'selected="selected"':""};i.push(o);for(var n=0;n<e.choices.length;n++){var s=e.choices[n],s={label:s.text,value:s.value,selected:s.value==t?'selected="selected"':""};i.push(s)}return i}function getCategoryOptions(e,t){for(var i=gf_vars.conditionalLogic.categories,o=[],n=0;n<i.length;n++){var s=i[n],s={label:s.label,value:s.term_id,selected:s.term_id==t?'selected="selected"':""};o.push(s)}return o}function getAddressOptions(e,t,i){var o=[],n=gf_vars.conditionalLogic.addressOptions;if(e.inputs){if(!n[e.addressType])return[];var s=n[e.addressType];if(!Array.isArray(s)){var l,a=!0;for(l in s)if(isNaN(l)){a=!1;break}a&&(s=Object.values(s))}if(Array.isArray(s))for(u=0;u<s.length;u++){d={label:g=s[u],value:g,selected:g==i?'selected="selected"':""};o.push(d)}else for(var r in s){var d,c=s[r];if(Array.isArray(c))for(var u=0;u<c.length;u++){var g=c[u];o.push(d={label:g,value:g,selected:g==i?'selected="selected"':""})}else o.push(d={label:c,value:r,selected:r==i?'selected="selected"':""})}}return o}function generateGFConditionalLogic(t,i){0<GF_CONDITIONAL_INSTANCES_COLLECTION.filter(function(e){return!0!==e.deactivated&&e.fieldId===t&&e.objectType===i}).length||(GF_CONDITIONAL_INSTANCE&&GF_CONDITIONAL_INSTANCE.fieldId!==t&&(GF_CONDITIONAL_INSTANCES_COLLECTION.forEach(function(e,t){e.hideFlyout(),e.removeEventListeners(),e.deactivated=!0}),GF_CONDITIONAL_INSTANCES_COLLECTION=GF_CONDITIONAL_INSTANCES_COLLECTION.filter(function(e){return!0!==e.deactivated})),GF_CONDITIONAL_INSTANCE=new GFConditionalLogic(t,i),GF_CONDITIONAL_INSTANCES_COLLECTION.push(GF_CONDITIONAL_INSTANCE))}function isValidFlyoutClick(e){var t="jsConditonalToggle"in e.target.dataset||"jsAddRule"in e.target.dataset||"jsDeleteRule"in e.target.dataset||e.target.classList.contains("gform-field__toggle-input")||null!==e.target.closest(".gform-dialog__mask");return gform.applyFilters("gform_conditional_logic_is_valid_flyout_click",t,e)}function ruleNeedsTextValue(e){return-1!==["contains","starts_with","ends_with","<",">"].indexOf(e.operator)}function GFConditionalLogic(e,t){this.fieldId=e,this.form=form,this.pointerDownInside=!1,this.objectType=t,this.els=this.gatherElements(),this.state=this.getStateForField(e),this.visible=!!document.querySelector(".editor-sidebar .conditional_logic_flyout_container.anim-in-active"),this._handleToggleClick=this.handleToggleClick.bind(this),this._handleFlyoutChange=this.handleFlyoutChange.bind(this),this._handleBodyClick=this.handleBodyClick.bind(this),this._handleAccordionClick=this.handleAccordionClick.bind(this),this._handleSidebarClick=this.handleSidebarClick.bind(this),this._maintainFocus=this._maintainFocus.bind(this),this._bindKeypress=this._bindKeypress.bind(this),this.init()}GFConditionalLogic.prototype.renderSidebar=function(){var e={title:this.getAccordionTitle(),toggleText:gf_vars.configure+" "+gf_vars.conditional_logic_text,active_class:this.isEnabled()?"gform-status--active":"",active_text:this.isEnabled()?"Active":"Inactive",desc_class:GetFirstRuleField()<=0?"active":"",toggle_class:GetFirstRuleField()<=0?"":"active",desc:gf_vars.conditionalLogic.conditionalLogicHelperText};renderView(gf_vars.conditionalLogic.views.siLine truncated
@@ -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" aria-hidden="true"></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>
@@ -0,0 +1,738 @@
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 ) {
// Gather the fields that are dependents of the processed fields (inside pages/sections).
var dependentFields = [];
var dependents = window["gf_form_conditional_logic"][formId]["dependents"][fields[i]];
if ( dependents ) {
dependents.forEach( function ( dependentFieldId ) {
if ( dependentFields.indexOf( dependentFieldId ) === -1 ) {
dependentFields.push( dependentFieldId );
}
});
}
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, dependentFields: dependentFields, 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(), $input ),
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++ ) {
var isPriceField = $input.closest( '.gfield_price' ).length > 0,
hasLabel = ! values[i] || ( isPriceField && values[i].indexOf( '|' ) >= 0 ),
fieldValue = gf_get_value( values[i], $input );
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 = gform.Currency.getDecimalSeparator( 'currency' );
} else if( fieldNumberFormat == 'decimal_comma' ) {
decimalSeparator = ',';
} else if( fieldNumberFormat == 'decimal_dot' ) {
decimalSeparator = '.';
}
// transform to a decimal dot number
value = gform.Currency.cleanNumber( value, '', '', decimalSeparator );
/**
* Looking at format specified by wp locale creates issues. When performing conditional logic, all numbers will be formatted to decimal dot and then compared that way. AC
*/
// 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 gform.Currency.cleanNumber( 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 gform.utils.isNumber(val1) && gform.utils.isNumber(val2) ? val1 > val2 : false;
break;
case "<" :
val1 = gf_try_convert_float(val1);
val2 = gf_try_convert_float(val2);
return gform.utils.isNumber(val1) && gform.utils.isNumber(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, $input ) {
if ( ! val ) {
return '';
}
// Selection pricing fields are formatted as value|price. Split on the | to get the field label or value that is in the first position.
// For all other pricing fields, splitting on the | won't have any effect.
if ( $input && $input.closest( '.gfield_price' ).length ) {
val = gformParseChoiceValue( val )['name'];
}
return val;
}
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 $target = jQuery( targetId );
if( $target.hasClass('gfield_shipping') || $target.hasClass('gfield_total') ||
$target.hasClass('gfield--type-shipping') || $target.hasClass('gfield--type-total') ) {
return;
}
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' ) && element.attr( 'type' ) != 'email' ) {
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;
}
@@ -0,0 +1 @@
var __gf_timeout_handle;function gf_apply_rules(i,a,n){jQuery(document).trigger("gform_pre_conditional_logic",[i,a,n]),gform.utils.trigger({event:"gform/conditionalLogic/applyRules/start",native:!1,data:{formId:i,fields:a,isInit:n}});for(var r=0;r<a.length;r++)gf_apply_field_rule(i,a[r],n,function(){var e,t;r>=a.length-1&&(e=[],(t=window.gf_form_conditional_logic[i].dependents[a[r]])&&t.forEach(function(t){-1===e.indexOf(t)&&e.push(t)}),jQuery(document).trigger("gform_post_conditional_logic",[i,a,n]),gform.utils.trigger({event:"gform/conditionalLogic/applyRules/end",native:!1,data:{formId:i,fields:a,dependentFields:e,isInit:n}}),window.gformCalculateTotalPrice)&&window.gformCalculateTotalPrice(i)})}function gf_check_field_rule(t,e,i,a){var n,e=gf_get_field_logic(t,e);return e?"hide"!=(n=gf_get_field_action(t,e.section))?gf_get_field_action(t,e.field):n:"show"}function gf_get_field_logic(t,e){var i=rgars(window,"gf_form_conditional_logic/"+t);if(i){t=rgars(i,"logic/"+e);if(t)return t;var a=rgar(i,"dependents");if(a)for(var n in a)if(-1!==a[n].indexOf(e))return rgars(i,"logic/"+n)}return!1}function gf_apply_field_rule(t,e,i,a){gf_do_field_action(t,gf_check_field_rule(t,e,i,a),e,i,a);a=window.gf_form_conditional_logic[t].logic[e];a.nextButton&&gf_do_next_button_action(t,gf_get_field_action(t,a.nextButton),e,i)}function gf_get_field_action(t,e){if(!e)return"show";for(var i=0,a=0;a<e.rules.length;a++)gf_is_match(t,gform.applyFilters("gform_rule_pre_evaluation",jQuery.extend({},e.rules[a]),t,e))&&i++;return"all"==e.logicType&&i==e.rules.length||"any"==e.logicType&&0<i?e.actionType:"show"==e.actionType?"hide":"show"}function gf_is_match(t,e){var i=jQuery,a=e.fieldId,n=gformExtractFieldId(a),a=gformExtractInputIndex(a),a=i(!1!==a?"#input_{0}_{1}_{2}, #choice_{0}_{1}_{2}".gformFormat(t,n,a):'input[id="input_{0}_{1}"], input[id^="input_{0}_{1}_"], input[id^="choice_{0}_{1}_"], select#input_{0}_{1}, textarea#input_{0}_{1}'.gformFormat(t,n)),i=-1!==i.inArray(a.attr("type"),["checkbox","radio"])?gf_is_match_checkable(a,e,t,n):gf_is_match_default(a.eq(0),e,t,n);return gform.applyFilters("gform_is_value_match",i,t,e)}function gf_is_match_checkable(t,n,r,o){var l;return""===n.value?"is"===n.operator?gf_is_checkable_empty(t):!gf_is_checkable_empty(t):(l=!1,t.each(function(){var t=jQuery(this),e=gf_get_value(t.val(),t),i=-1!==jQuery.inArray(n.operator,["<",">"]),a=-1!==jQuery.inArray(n.operator,["contains","starts_with","ends_with"]);if(e==n.value||i||a)return t.is(":checked")?"gf_other_choice"==e&&(e=jQuery("#input_{0}_{1}_other".gformFormat(r,o)).val()):e="",gf_matches_operation(e,n.value,n.operator)?!(l=!0):void 0}),l)}function gf_is_checkable_empty(t){var e=!0;return t.each(function(){jQuery(this).is(":checked")&&(e=!1)}),e}function gf_is_match_default(t,e,i,a){for(var n=t.val(),r=n instanceof Array?n:[n],o=0,l=Math.max(r.length,1),_=0;_<l;_++){var d=0<t.closest(".gfield_price").length,d=!r[_]||d&&0<=r[_].indexOf("|"),s=gf_get_value(r[_],t),c=gf_get_field_number_format(e.fieldId,i,"value"),d=(c&&!d&&(s=gf_format_number(s,c)),e.value);gf_matches_operation(s,d,e.operator)&&o++}return"isnot"==e.operator?o==l:0<o}function gf_format_number(t,e){return decimalSeparator=".","currency"==e?decimalSeparator=gform.Currency.getDecimalSeparator("currency"):"decimal_comma"==e?decimalSeparator=",":"decimal_dot"==e&&(decimalSeparator="."),t=gform.Currency.cleanNumber(t,"","",decimalSeparator),number=(t=t||0).toString()}function gf_try_convert_float(t){var e="decimal_dot";return gformIsNumeric(t,e)?gform.Currency.cleanNumber(t,"","","."):t}function gf_matches_operation(t,e,i){switch(t=t?t.toLowerCase():"",e=e?e.toLowerCase():"",i){case"is":return t==e;case"isnot":return t!=e;case">":return t=gf_try_convert_float(t),e=gf_try_convert_float(e),!(!gform.utils.isNumber(t)||!gform.utils.isNumber(e))&&e<t;case"<":return t=gf_try_convert_float(t),e=gf_try_convert_float(e),!(!gform.utils.isNumber(t)||!gform.utils.isNumber(e))&&t<e;case"contains":return 0<=t.indexOf(e);case"starts_with":return 0==t.indexOf(e);case"ends_with":var a=t.length-e.length;return a<0?!1:e==t.substring(a)}return!1}function gf_get_value(t,e){return t?e&&e.closest(".gfield_price").length?gformParseChoiceValue(t).name:t:""}function gf_do_field_action(t,e,i,a,n){for(var r=window.gf_form_conditional_logic[t],o=r.dependents[i],l=0;l<o.length;l++){var _=0==i?"#gform_submit_button_"+t:"#field_"+t+"_"+o[l],d=r.defaults[o[l]],s=(do_callback=l+1==o.length?n:null,gform.applyFilters("gform_abort_conditional_logic_do_action",!1,e,_,r.animation,d,a,t,do_callback));s?do_callback&&do_callback():gf_do_action(e,_,r.animation,d,a,do_callback,t),gform.doAction("gform_post_conditional_logic_field_action",t,e,_,d,a)}}function gf_do_next_button_action(t,e,i,a){var n=window.gf_form_conditional_logic[t],i="#gform_next_button_"+t+"_"+i;gform.applyFilters("gform_abort_conditional_logic_do_action",!1,e,i,n.animation,null,a,t,null)||gf_do_action(e,i,n.animation,null,a,null,t)}function gf_do_action(t,eLine truncated
@@ -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 );
@@ -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]?(s=0<(o=window.jQuery)("#preview_form_container").length,d="rtl"===window.getComputedStyle(r[0],null).getPropertyValue("direction"),Object.assign(e,{showOtherMonths:!1,beforeShow:function(e,t){return t.dpDiv[0].classList.remove("gform-theme-datepicker"),t.dpDiv[0].classList.remove("gravity-theme"),t.dpDiv[0].classList.remove("gform-theme"),t.dpDiv[0].classList.remove("gform-legacy-datepicker"),t.dpDiv[0].classList.remove("gform-theme--framework"),t.dpDiv[0].classList.remove("gform-theme--foundation"),t.dpDiv[0].classList.remove("gform-theme--orbital"),t.dpDiv[0].classList.add("gform-legacy-datepicker"),d&&s&&(e=o(e).closest(".gfield"),e=o(document).outerWidth()-(e.offset().left+e.outerWidth()),t.dpDiv[0].style.right=e+"px"),s&&t.dpDiv[0].classList.add("gform-preview-datepicker"),!this.suppressDatePicker}})):e},-10);
@@ -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
View File
@@ -0,0 +1 @@
((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);
@@ -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();
})();
@@ -0,0 +1 @@
(()=>{var n=window.gf_duplicate_submissions||{},a=function(){var i=window.navigator.userAgent,t=!!i.match(/iP(ad|od|hone)/i),n=!!i.match(/Safari/i),a=!i.match(/Chrome|CriOS|OPiOS|mercury|FxiOS|Firefox/i);return t?!!i.match(/WebKit/i)&&n&&a:void 0!==window.safari||n&&a},r=function(i,t,n){for(var n=n.split("#"),a=n[1]?"#"+n[1]:"",n=n[0].split("?"),r=n[0],n=n[1],o=void 0!==n?n.split("&"):[],e=!1,s=0;s<o.length;s++)o[s].startsWith(i+"=")&&(0<t.length?o[s]=i+"="+t:o.splice(s,1),e=!0);return!e&&0<t.length&&(o[o.length]=i+"="+t),r+"?"+o.join("&")+a},i=function(){var i=r(n.safari_redirect_param,"",window.location.href),t=r(n.safari_redirect_param,"1",window.location.href);return console.log(i,t),a()?t:i};!window.gf_duplicate_submissions_initialized&&"1"===n.is_gf_submission&&window.history.replaceState&&(window.gf_duplicate_submissions_initialized=!0,window.history.replaceState(null,null,i()))})();
File diff suppressed because it is too large. Load diff
+1
View File
@@ -0,0 +1 @@
function initMergeTagSupport(){"undefined"!=typeof form&&0<=jQuery(".merge-tag-support").length&&jQuery(".merge-tag-support").each(function(){new gfMergeTagsObj(form,jQuery(this))})}function FormatCurrency(e){var t;gf_vars.gf_currency_config&&(t=new gform.Currency(gf_vars.gf_currency_config).toMoney(jQuery(e).val()),jQuery(e).val(t))}function ToggleConditionalLogic(e,t){jQuery("#"+t+"_conditional_logic").is(":checked")?(CreateConditionalLogic(t,GetConditionalObject(t)),SetConditionalProperty(t,"actionType",jQuery("#"+t+"_action_type").val()),SetConditionalProperty(t,"logicType",jQuery("#"+t+"_logic_type").val()),SetRule(t,0),jQuery("#"+t+"_conditional_logic_container").show()):jQuery("#"+t+"_conditional_logic_container").hide()}function GetConditionalObject(e){var t=!1;switch(e){case"page":case"field":t=GetSelectedField();break;case"next_button":var i=GetSelectedField();(t=i.nextButton).id=i.id;break;case"confirmation":t=confirmation;break;case"notification":t=current_notification;break;case"button":t=form.button;break;default:t="undefined"!=typeof form&&form.button}return t=gform.applyFilters("gform_conditional_object",t,e)}function CreateConditionalLogic(t,e){e.conditionalLogic&&0!=e.conditionalLogic.length||(e.conditionalLogic=new ConditionalLogic);var i,o="hide"==e.conditionalLogic.actionType?"selected='selected'":"",n="show"==e.conditionalLogic.actionType?"selected='selected'":"",r="all"==e.conditionalLogic.logicType?"selected='selected'":"",a="any"==e.conditionalLogic.logicType?"selected='selected'":"",s="section"==e.type?gf_vars.thisSectionIf:"field"==t?gf_vars.thisFieldIf:"page"==t?gf_vars.thisPage:"confirmation"==t?gf_vars.thisConfirmation:"notification"==t?gf_vars.thisNotification:gf_vars.thisFormButton,l="next_button"==t?(i=gf_vars.enable,gf_vars.disable):(i=gf_vars.show,gf_vars.hide),c={};c.actionType="<select id='"+t+"_action_type' onchange='SetConditionalProperty(\""+t+"\", \"actionType\", jQuery(this).val());'><option value='show' "+n+">"+i+"</option><option value='hide' "+o+">"+l+"</option></select>",c.objectDescription=s,c.logicType="<select id='"+t+"_logic_type' onchange='SetConditionalProperty(\""+t+"\", \"logicType\", jQuery(this).val());'><option value='all' "+r+">"+gf_vars.all+"</option><option value='any' "+a+">"+gf_vars.any+"</option></select>",c.ofTheFollowingMatch=gf_vars.ofTheFollowingMatch;for(var u,d=makeArray(c).join(" "),d=gform.applyFilters("gform_conditional_logic_description",d,c,t,e),g=0;g<e.conditionalLogic.rules.length;g++)u=e.conditionalLogic.rules[g],d=(d=(d=(d=(d+="<div width='100%' class='gf_conditional_logic_rules_container'>")+GetRuleFields(t,g,e.conditionalLogic.rules[g].fieldId))+GetRuleOperators(t,g,e.conditionalLogic.rules[g].fieldId,u.operator))+GetRuleValues(t,g,e.conditionalLogic.rules[g].fieldId,u.value))+"<button type='button' class='add_field_choice gform-st-icon gform-st-icon--circle-plus' title='add another rule' onclick=\"InsertRule('"+t+"', "+(g+1)+');" onkeypress="InsertRule(\''+t+"', "+(g+1)+');"></button>',1<e.conditionalLogic.rules.length&&(d+="<button type='button' class='delete_field_choice gform-st-icon gform-st-icon--circle-minus' title='remove this rule' onclick=\"DeleteRule('"+t+"', "+g+');" onkeypress="DeleteRule(\''+t+"', "+g+');"></button></li>'),d+="</div>";jQuery("#"+t+"_conditional_logic_container").html(d),Placeholders.enable(),jQuery("#"+t+"_conditional_logic",document).parents("form").on("submit",function(e){jQuery("#"+t+"_conditional_logic_object").val(JSON.stringify(GetConditionalObject(t).conditionalLogic))})}function GetRuleOperators(e,t,i,o){var n={is:"is",isnot:"isNot",">":"greaterThan","<":"lessThan",contains:"contains",starts_with:"startsWith",ends_with:"endsWith"},r="<select id='"+e+"_rule_operator_"+t+"' class='gfield_rule_select' onchange='SetRuleProperty(\""+e+'", '+t+', "operator", jQuery(this).val());var valueSelector="#'+e+"_rule_value_"+t+'"; jQuery(valueSelector).replaceWith(GetRuleValues("'+e+'", '+t+',"'+i+'", ""));jQuery(valueSelector).change();\'>',t=IsEntryMeta(i)?GetOperatorsForMeta(n,i):n;return t=gform.applyFilters("gform_conditional_logic_operators",t,e,i),jQuery.each(t,function(e,t){var i=gf_vars[t];r+="<option value='"+e+"' "+(o==e?"selected='selected'":"")+">"+(i=void 0===i?t:i)+"</option>"}),r+="</select>"}function GetOperatorsForMeta(e,i){var o={};return entry_meta[i]&&entry_meta[i].filter&&entry_meta[i].filter.operators?jQuery.each(e,function(e,t){0<=jQuery.inArray(e,entry_meta[i].filter.operators)&&(o[e]=t)}):o=e,o}function GetRuleFields(e,t,i){for(var e="<select id='"+e+"_rule_field_"+t+"' class='gfield_rule_select' onchange='jQuery(\"#"+e+"_rule_operator_"+t+'").replaceWith(GetRuleOperators("'+e+'", '+t+', jQuery(this).val()));jQuery("#'+e+"_rule_value_"+t+'").replaceWith(GetRuleValues("'+e+'", '+t+', jQuery(this).val())); SetRule("'+e+'", '+t+"); '>",o=[],n=0;n<form.fields.length;n++){var r=form.fields[n];if(IsConditionalLogicField(r))if(r.inputs&&-1==jQuery.inArray(GetInputType(r),["checkbox","eLine truncated
File diff suppressed because it is too large. Load diff
+1
View File
@@ -0,0 +1 @@
function InitializeEditor(){if(jQuery(".search-button > input").on("keyup change click paste",function(e){FieldSearch(this),addClearButton(this)}),jQuery(".search-button > input").on("keyup paste",function(e){jQuery(".sidebar").tabs({active:0})}),jQuery(".clear-button").on("click",function(e){clearInput(this)}),jQuery(".gf-topmenu-dynamic").on("click",function(e){var t=jQuery(this).position(),t=(jQuery(".gf-popover").css("left",t.left+jQuery(this).width()/2+6+"px"),jQuery(".gf-popover").css("display"));jQuery(".gf-popover").css("display","block"===t?"none":"block")}),jQuery(".gf-popover__button").on("click",function(){var e=jQuery(this).data("url");""!==e&&(window.location.href=e)}),jQuery(document).on("click",function(e){var t=jQuery(".gf-topmenu-dynamic");t.is(e.target)||0!==t.has(e.target).length||jQuery(".gf-popover").hide()}),jQuery(".add-buttons button").each(function(){var e=jQuery(this),t=e.attr("data-type"),i=e.attr("onclick");void 0===t&&i&&-1<i.indexOf("StartAddField")&&/StartAddField\([ ]?'(.*?)[ ]?'/.test(i)&&(t=i.match(/'(.*?)'/)[1],e.data("type",t)),void 0===t||void 0!==i&&""!=i||jQuery(this).click(function(){StartAddField(t)})}),jQuery("#field_choices, #field_columns").sortable({axis:"y",handle:".field-choice-handle",update:function(e,t){MoveFieldChoice(t.item.data("index"),t.item.index())}}),jQuery(".field_input_choices").sortable({axis:"y",handle:".field-choice-handle",update:function(e,t){var i=t.item.data("index"),l=t.item.index(),d=t.item.data("input_id");MoveInputChoice(t.item.parent(),d,i,l)}}),void 0!==gf_global.view&&"settings"==gf_global.view||InitializeForm(form),jQuery(document).trigger("gform_load_form_settings",[form]),SetupUnsavedChangesWarning(),window.console){var e=jQuery(document)[0],e=jQuery.hasData(e)&&jQuery._data(e);if(e){var t,i=new Array("gform_load_form_settings");for(t in e.events)-1!==jQuery.inArray(t,i)&&console.log('Gravity Forms API warning: The jQuery event "'+t+'" is deprecated on this page since version 1.7')}}jQuery(document).on("focus","#field_choices input.field-choice-text, #field_choices input.field-choice-value",function(){jQuery(this).data("previousValue",jQuery(this).val())}),InitializeFieldSettings(),jQuery(".sidebar").tabs({activate:function(e,t){t.newPanel.css("display","flex")}}),jQuery("#field_settings").tabs(),jQuery(".field_settings").accordion(gform.options.jqEditorAccordions),jQuery("#add_fields_menu .panel-block-tabs__wrapper").accordion(gform.options.jqAddFieldAccordions),jQuery(".panel-block-tabs").find(".panel-block-tabs__toggle").each(function(e,t){jQuery(t).append('<i aria-hidden="true"></i>')}),ResetFieldAccordions(),jQuery(".panel-block > .field_settings").on("keydown",function(e){var t,i;27===e.keyCode?jQuery(".gfield.field_selected .gfield-edit").focus():9===e.keyCode&&(t=(i=gform.tools.getFocusable(this))[0],i=i[i.length-1],e.shiftKey?document.activeElement===t&&(i.focus(),e.preventDefault()):document.activeElement===i&&(t.focus(),e.preventDefault()))}),jQuery("#field_submit #gform_ppcp_smart_payment_buttons").remove()}function InitializeFieldSettings(){gform.addFilter("gform_editor_field_settings","hideDefaultMarginOnTopLabelAlignment"),jQuery("#field_max_file_size").on("input propertychange",function(){var e=jQuery(this),e=parseInt(e.val());SetFieldProperty("maxFileSize",e||"")}).on("change",function(){var e=GetSelectedField(),e=e.maxFileSize||"";this.value=""===e?"":e+"MB"}),jQuery(document).on("input propertychange",".field_default_value",function(){SetFieldDefaultValue(this.value)}),jQuery(document).on("input propertychange",".field_placeholder, .field_placeholder_textarea",function(){SetFieldPlaceholder(this.value),""===GetSelectedField().label&&(setFieldError("label_setting","below"),""!==this.value)&&resetFieldError("label_setting")}),jQuery(".field_input_choices").on("input propertychange","input",function(){var e=jQuery(this).closest("li"),t=e.data("index");SetInputChoice(e.data("input_id"),t,e.find(".field-choice-value").val(),e.find(".field-choice-text").val())}).on("click keypress","input:radio, input:checkbox",function(){var e=jQuery(this).closest("li"),t=e.data("index");SetInputChoice(e.data("input_id"),t,e.find(".field-choice-value").val(),e.find(".field-choice-text").val())}).on("click keypress",".field-input-insert-choice",function(){var e=jQuery(this).closest("li"),t=e.closest("ul"),i=e.data("index");InsertInputChoice(t,e.data("input_id"),i+1)}).on("click keypress",".field-input-delete-choice",function(){var e=jQuery(this).closest("li"),t=e.closest("ul"),i=e.data("index");DeleteInputChoice(t,e.data("input_id"),i)}),jQuery(".field_input_choice_values_enabled").on("click keypress",function(){var e=jQuery(this).parent().siblings(".gfield_settings_input_choices_container");ToggleInputChoiceValue(e,this.checked),SetInputChoices(e.find("ul"))}),jQuery(".input_placeholders_setting").on("input propertychange",".input_placeholder",function(){var e=jQuery(this).closest(".input_placeholder_row").data("input_id");SetInputPLine truncated
@@ -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
View 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=""}
@@ -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 = '&nbsp;&nbsp;&nbsp;&nbsp;';
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));
@@ -0,0 +1 @@
(a=>{var n,f,s,g,c,d,u,m;function h(){var e="<div class='gform-field-filter'>";return e+((()=>{var e,t,r=[];for(r.push("<select class='gform-filter-field' name='f[]' >"),e=0;e<s.length;e++)t=function e(t,r){r=r||0;var i,o,l,n,f,s,a,g,c,d="",u=[],m="&nbsp;&nbsp;&nbsp;&nbsp;";o=t.key;if(t.group){for(f=t.filters.length,n=[],g=t.isNestable?r+1:r,i=0;i<f;i++)(s=t.filters[i]).group?(a=e(s,g),n.push(a)):(c=m.repeat(g),l=c+s.text,a=s.key,d=b(a)?'disabled="disabled"':"",n.push('<option {0} value="{1}">{2}</option>'.gformFormat(d,a,l)));c=m.repeat(r),r=c+t.text,t.isNestable?u.push('<optgroup label="{0}"></optgroup>{1}'.gformFormat(r,n.join(""))):u.push('<optgroup label="{0}">{1}</optgroup>'.gformFormat(r,n.join("")))}else d=t.preventMultiple&&b(o)?"disabled='disabled'":"",l=t.text,u.push('<option {0} value="{1}">{2}</option>'.gformFormat(d,o,l));return u.join("")}(s[e]),r.push(t);return r.push("</select>"),r.push("<input type='hidden' class='gform-filter-type' name='t[]' value='' >"),r.join("")})()+r()+i()+(e="",e=u?(e+="<button class='gform-add add_field_choice gform-st-icon gform-st-icon--circle-plus' title='{0}'"+"></button>".gformFormat(gf_vars.addFieldFilter))+"<button class='gform-remove delete_field_choice gform-st-icon gform-st-icon--circle-minus' title='"+gf_vars.removeFieldFilter+"'></button>":e))+"</div>"}function p(e){var t=a(e),r=o(t.siblings(".gform-filter-field").val());r&&t.siblings(".gform-filter-value").replaceWith(i(r,e.value)),l(),window.gformInitDatepicker&&gformInitDatepicker()}function v(e){var t=o(e.value);t&&((e=a(e)).siblings(".gform-filter-value").replaceWith(i(t)),e.siblings(".gform-filter-type").val(t.type),e.siblings(".gform-filter-operator").replaceWith(r(t)),e.siblings(".gform-filter-operator").change()),l()}function b(e){e=e.toString();var r=[];return a(".gform-filter-field :selected").each(function(e,t){r[e]=a(t).val()}),-1<a.inArray(e,r)}function r(e){var t,r,i="<select name='o[]' class='gform-filter-operator'>";if(e)for(t=0;t<e.operators.length;t++)r=e.operators[t],i+='<option value="{0}">{1}</option>'.gformFormat(r,gf_vars[f[r]]);return i+="</select>"}function i(e,t){var r,i,o,l,n,f="",s="gform-filter-value";if(e&&void 0!==e.cssClass&&(s+=" "+e.cssClass),e&&e.values&&"contains"!=t){for(void 0!==e.placeholder&&(f+='<option value="">{0}</option>'.gformFormat(e.placeholder)),r=0;r<e.values.length;r++)i=e.values[r].value,o=e.values[r].text,e.values[r].operators&&-1===a.inArray(t,e.values[r].operators)||(f+='<option value="{0}">{1}</option>'.gformFormat(i,o));l="<select name='v[]' class='{0}'>{1}</select>".gformFormat(s,f)}else n=e&&void 0!==e.placeholder?"placeholder='{0}'".gformFormat(e.placeholder):"",l="<input type='text' value='' name='v[]' class='{0}' {1}/>".gformFormat(s,n);return l}function o(e,t){var r;if(e){t=t||s;for(var i=0;i<t.length;i++){if(e==t[i].key)return t[i];if(t[i].group&&(r=o(e,t[i].filters)))return r}}}function F(){var e;d&&(e=a("#gform-field-filters"),a(".gform-field-filter").length<=1?a(n).hasClass("ui-resizable")&&n.resizable("destroy"):e.get(0).scrollHeight>n.height()||n.height()>=m?(n.css({"min-height":m+"px","border-bottom":"5px double #DDD"}).resizable({handles:"s",minHeight:m}),e.css("min-height",m)):n.css({"min-height":"","border-bottom":""}))}function y(){var e="",e=(e+="<div id='gform-no-filters' >"+gf_vars.addFieldFilter)+("<button class='gform-add add_field_choice gform-st-icon gform-st-icon--circle-plus' title='{0}'"+"></div>".gformFormat(gf_vars.addFieldFilter));a("#gform-field-filters").html(e),d&&(n.css({"min-height":"","border-bottom":""}),n.height(80),a("#gform-field-filters").css("min-height",""))}function l(){a("select.gform-filter-field option").removeAttr("disabled"),a("select.gform-filter-field").each(function(e){var t=o(this.value);void 0!==t&&t.preventMultiple&&b(this.value)&&a("select.gform-filter-field option[value='"+this.value+"']:not(:selected)").attr("disabled","disabled")})}function _(e){e='<select name="mode"><option value="all" {0}>{1}</option><option value="any" {2}>{3}</option></select>'.gformFormat(t("all",e),gf_vars.all,t("any",e),gf_vars.any);return gf_vars.filterAndAny.gformFormat(e)}function t(e,t){return e==t?'selected="selected"':""}function j(e){e=a(e),e=e.is("button")?e.parent():e;e.after(h()),e.next("div").find(".gform-filter-field").change().find(".gform-filter-operator").change(),1==a(".gform-field-filter").length&&e.after(_()),F()}function k(e){a(e).parent().remove(),0==a(".gform-field-filter").length&&y(),l(),F()}a.fn.gfFilterUI=function(e,t,r,i){e=e,t=t,r=r,i=i,(n=a(this)).css("position","relative").html('<div id="gform-field-filters"></div>'),d=void 0!==(m=i)&&0<m,f={is:"is",isnot:"isNot",">":"greaterThan","<":"lessThan",contains:"contains",starts_with:"startsWith",ends_with:"endsWith"},gf_vars.baseUrl,s=e,g=t&&t.filters?t.filters:[],c=t&&t.mode?t.mode:"all",u=!(void 0!==r&&!r);var o,l=g;if(n.on("change",".gform-filter-field",function(){v(this)}),n.on("click","#gform-no-filters",function(){if(a(".gform-field-fLine truncated
@@ -0,0 +1,117 @@
//----------------------------------------------------------
//------ JAVASCRIPT HOOK FUNCTIONS FOR GRAVITY FORMS -------
//----------------------------------------------------------
if ( ! gform ) {
document.addEventListener( 'gform_main_scripts_loaded', function() { gform.scriptsLoaded = true; } );
document.addEventListener( 'gform/theme/scripts_loaded', function() { gform.themeScriptsLoaded = true; } );
window.addEventListener( 'DOMContentLoaded', function() { gform.domLoaded = true; } );
var gform = {
domLoaded: false,
scriptsLoaded: false,
themeScriptsLoaded: false,
isFormEditor: () => typeof InitializeEditor === 'function',
/**
* @deprecated 2.9 the use of initializeOnLoaded in the form editor context is deprecated.
* @remove-in 4.0 this function will not check for gform.isFormEditor().
*/
callIfLoaded: function ( fn ) {
if ( gform.domLoaded && gform.scriptsLoaded && ( gform.themeScriptsLoaded || gform.isFormEditor() ) ) {
if ( gform.isFormEditor() ) {
console.warn( 'The use of gform.initializeOnLoaded() is deprecated in the form editor context and will be removed in Gravity Forms 3.1.' );
}
fn();
return true;
}
return false;
},
/**
* Call a function when all scripts are loaded
*
* @param function fn the callback function to call when all scripts are loaded
*
* @returns void
*/
initializeOnLoaded: function( fn ) {
if ( ! gform.callIfLoaded( fn ) ) {
document.addEventListener( 'gform_main_scripts_loaded', () => { gform.scriptsLoaded = true; gform.callIfLoaded( fn ); } );
document.addEventListener( 'gform/theme/scripts_loaded', () => { gform.themeScriptsLoaded = true; gform.callIfLoaded( fn ); } );
window.addEventListener( 'DOMContentLoaded', () => { gform.domLoaded = true; gform.callIfLoaded( fn ); } );
}
},
hooks: { action: {}, filter: {} },
addAction: function( action, callable, priority, tag ) {
gform.addHook( 'action', action, callable, priority, tag );
},
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;
}
}
};
}
@@ -0,0 +1 @@
var gform;gform||(document.addEventListener("gform_main_scripts_loaded",function(){gform.scriptsLoaded=!0}),document.addEventListener("gform/theme/scripts_loaded",function(){gform.themeScriptsLoaded=!0}),window.addEventListener("DOMContentLoaded",function(){gform.domLoaded=!0}),gform={domLoaded:!1,scriptsLoaded:!1,themeScriptsLoaded:!1,isFormEditor:()=>"function"==typeof InitializeEditor,callIfLoaded:function(o){return!(!gform.domLoaded||!gform.scriptsLoaded||!gform.themeScriptsLoaded&&!gform.isFormEditor()||(gform.isFormEditor()&&console.warn("The use of gform.initializeOnLoaded() is deprecated in the form editor context and will be removed in Gravity Forms 3.1."),o(),0))},initializeOnLoaded:function(o){gform.callIfLoaded(o)||(document.addEventListener("gform_main_scripts_loaded",()=>{gform.scriptsLoaded=!0,gform.callIfLoaded(o)}),document.addEventListener("gform/theme/scripts_loaded",()=>{gform.themeScriptsLoaded=!0,gform.callIfLoaded(o)}),window.addEventListener("DOMContentLoaded",()=>{gform.domLoaded=!0,gform.callIfLoaded(o)}))},hooks:{action:{},filter:{}},addAction:function(o,r,e,t){gform.addHook("action",o,r,e,t)},addFilter:function(o,r,e,t){gform.addHook("filter",o,r,e,t)},doAction:function(o){gform.doHook("action",o,arguments)},applyFilters:function(o){return gform.doHook("filter",o,arguments)},removeAction:function(o,r){gform.removeHook("action",o,r)},removeFilter:function(o,r,e){gform.removeHook("filter",o,r,e)},addHook:function(o,r,e,t,n){null==gform.hooks[o][r]&&(gform.hooks[o][r]=[]);var d=gform.hooks[o][r];null==n&&(n=r+"_"+d.length),gform.hooks[o][r].push({tag:n,callable:e,priority:t=null==t?10:t})},doHook:function(r,o,e){var t;if(e=Array.prototype.slice.call(e,1),null!=gform.hooks[r][o]&&((o=gform.hooks[r][o]).sort(function(o,r){return o.priority-r.priority}),o.forEach(function(o){"function"!=typeof(t=o.callable)&&(t=window[t]),"action"==r?t.apply(null,e):e[0]=t.apply(null,e)})),"filter"==r)return e[0]},removeHook:function(o,r,t,n){var e;null!=gform.hooks[o][r]&&(e=(e=gform.hooks[o][r]).filter(function(o,r,e){return!!(null!=n&&n!=o.tag||null!=t&&t!=o.priority)}),gform.hooks[o][r]=e)}});
File diff suppressed because it is too large. Load diff
@@ -0,0 +1 @@
var gform=window.gform||{};function gformBindFormatPricingFields(){jQuery(".ginput_amount, .ginput_donation_amount").off("change.gform").on("change.gform",function(){gformFormatPricingField(this)}),jQuery(".ginput_amount, .ginput_donation_amount").each(function(){gformFormatPricingField(this)})}function Currency(e){return console.warn("Currency has been deprecated since Gravity Forms 2.9. Use gform.Currency instead."),new gform.Currency(e)}function gformCleanNumber(e,t,r,i){return console.warn("gformCleanNumber() has been deprecated since Gravity Forms 2.9. Use gform.Currency.cleanNumber() instead."),gform.Currency.cleanNumber(e,t,r,i)}function gformGetDecimalSeparator(e){return console.warn("gformGetDecimalSeparator() has been deprecated since Gravity Forms 2.9. Use gform.Currency.getDecimalSeparator() instead."),gform.Currency.getDecimalSeparator(e)}function gformIsNumber(e){return console.warn("gformIsNumber() has been deprecated since Gravity Forms 2.9. Use gform.utils.isNumber() instead."),gform.utils.isNumber(e)}function gformIsNumeric(e,t){switch(t){case"decimal_dot":return new RegExp("^(-?[0-9]{1,3}(?:,?[0-9]{3})*(?:.[0-9]+)?)$").test(e);case"decimal_comma":return new RegExp("^(-?[0-9]{1,3}(?:.?[0-9]{3})*(?:,[0-9]+)?)$").test(e)}return!1}function gformDeleteUploadedFile(e,t,r){var i,n=jQuery("#field_"+e+"_"+t),o=jQuery(r).parent().index(),r=jQuery(r).closest(".ginput_preview")[0],a=r.id,r=(r.remove(),n.find(".validation_message,#extensions_message_"+e+"_"+t).removeClass("gform_hidden"),n.find(".ginput_post_image_file").show(),n.find('input[type="text"]').val(""),jQuery("#gform_uploaded_files_"+e).val());r&&(r=jQuery.secureEvalJSON(r))&&(i="input_"+t,0<(n=n.find("#gform_multifile_upload_"+e+"_"+t)).length?(r[i].splice(o,1),t=n.data("settings"),0===(o=r[i].length)?(jQuery("#"+t.gf_vars.message_id).html(""),gfMultiFileUploader.toggleDisabled(t,!1)):(jQuery("#error_"+a).remove(),o<t.gf_vars.max_files&&gfMultiFileUploader.toggleDisabled(t,!1))):r[i]=null,jQuery("#gform_uploaded_files_"+e).val(jQuery.toJSON(r)))}void 0===jQuery.fn.prop&&(jQuery.fn.prop=jQuery.fn.attr),jQuery(document).on("gform_post_render",gformBindFormatPricingFields),gform.instances=gform.instances||{},gform.console={error:function(e){window.console&&console.error(e)},info:function(e){window.console&&console.info(e)},log:function(e){window.console&&console.log(e)}},gform.adminUtils={handleUnsavedChanges:function(e){var t=null;jQuery(e).find("input, select, textarea").on("change keyup",function(){void 0===jQuery(this).attr("onChange")&&void 0===jQuery(this).attr("onClick")&&(t=!0),"enable-api"===(jQuery(this).next().data("jsButton")||jQuery(this).data("jsButton"))&&(t=null)}),"gravityformswebapi"===this.getUrlParameter("subview")&&window.gf_webapi_vars&&window.gf_webapi_vars.api_enabled!==window.gf_webapi_vars.enable_api_checkbox_checked&&(t=!0),jQuery(e).on("submit",function(){t=null}),window.onbeforeunload=function(){return t}},getUrlParameter:function(e){for(var t=window.location.search.substring(1).split("&"),r=0;r<t.length;r++){var i=t[r].split("=");if(i[0]==e)return i[1]}}},window.HandleUnsavedChanges=gform.adminUtils.handleUnsavedChanges,gform.tools={debounce:function(i,n,o){var a,l,s;return function(){var e=this,t=arguments,r=o&&!a;t===l&&""+s==""+i&&clearTimeout(a);a=setTimeout(function(){a=null,o||i.apply(e,t)},n),s=i,l=t,r&&i.apply(e,t)}},defaultFor:function(e,t){return void 0!==e?e:t},getFocusable:function(e){return e=this.defaultFor(e,document),this.convertElements(e.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')).filter(function(e){return this.visible(e)}.bind(this))},htmlToElement:function(e){var t=document.createElement("template");return e=e.trim(),t.innerHTML=e,t.content.firstChild},elementToHTML:function(e){return e.outerHTML},convertElements:function(e){for(var t=[],r=e.length;r--;t.unshift(e[r]));return t},delegate:function(e,r,i,n){e=document.querySelectorAll(e);[].forEach.call(e,function(e,t){e.addEventListener(r,function(e){var t;((t=e.target).matches||t.msMatchesSelector).call(t,i)&&n(e)})})},getClosest:function(e,t){var r,i;for(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"].some(function(e){return"function"==typeof document.body[e]&&(r=e,!0)});e;){if((i=e.parentElement)&&i[r](t))return i;e=i}return null},getNodes:function(e,t,r,i){return e?(r=(r=this.defaultFor(r,document)).querySelectorAll(i?e:'[data-js="'+e+'"]'),t?this.convertElements(r):r):(gform.console.error("Please pass a selector to gform.tools.getNodes"),[])},mergeObjects:function(){for(var e={},t=0;t<arguments.length;t+=1)for(var r=arguments[t],i=Object.keys(r),n=0;n<i.length;n+=1)e[i[n]]=r[i[n]];return e},setAttr:function(e,t,r,i,n){if(!e||!t||!r)return gform.console.error("Please pass a selector, attribute and value to gform.tools.setAttr"),[];i=this.defaultFor(i,document),n=this.defaultFor(n,0),setTimeout(function(){gform.tools.getNodes(e,!0,i,!0).forEacLine truncated
@@ -0,0 +1,2 @@
<?php
//Nothing to see here
@@ -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);
@@ -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);
@@ -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
View File
@@ -0,0 +1 @@
!function($){var escape=/["\\\x00-\x1f\x7f-\x9f]/g,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},hasOwn=Object.prototype.hasOwnProperty;$.toJSON="object"==typeof JSON&&JSON.stringify?JSON.stringify:function(t){if(null===t)return"null";var e,r,n,o,i,f,u=$.type(t);if("undefined"!==u){if("number"===u||"boolean"===u)return String(t);if("string"===u)return $.quoteString(t);if("function"==typeof t.toJSON)return $.toJSON(t.toJSON());if("date"===u)return i=t.getUTCMonth()+1,f=t.getUTCDate(),'"'+t.getUTCFullYear()+"-"+(i=i<10?"0"+i:i)+"-"+(f=f<10?"0"+f:f)+"T"+(i=(i=t.getUTCHours())<10?"0"+i:i)+":"+(f=(f=t.getUTCMinutes())<10?"0"+f:f)+":"+(i=(i=t.getUTCSeconds())<10?"0"+i:i)+"."+(f=(f=(f=t.getUTCMilliseconds())<100?"0"+f:f)<10?"0"+f:f)+'Z"';if(e=[],$.isArray(t)){for(r=0;r<t.length;r++)e.push($.toJSON(t[r])||"null");return"["+e.join(",")+"]"}if("object"==typeof t){for(r in t)if(hasOwn.call(t,r)){if("number"===(u=typeof r))n='"'+r+'"';else{if("string"!==u)continue;n=$.quoteString(r)}"function"!==(u=typeof t[r])&&"undefined"!==u&&(o=$.toJSON(t[r]),e.push(n+":"+o))}return"{"+e.join(",")+"}"}}},$.evalJSON="object"==typeof JSON&&JSON.parse?JSON.parse:function(str){return eval("("+str+")")},$.secureEvalJSON="object"==typeof JSON&&JSON.parse?JSON.parse:function(str){var filtered=str.replace(/\\["\\\/bfnrtu]/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"");if(/^[\],:{}\s]*$/.test(filtered))return eval("("+str+")");throw new SyntaxError("Error parsing JSON, source is not valid.")},$.quoteString=function(t){return t.match(escape)?'"'+t.replace(escape,function(t){var e=meta[t];return"string"==typeof e?e:(e=t.charCodeAt(),"\\u00"+Math.floor(e/16).toString(16)+(e%16).toString(16))})+'"':'"'+t+'"'}}(jQuery);
@@ -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()})}})});
@@ -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
});
}
});
}));
@@ -0,0 +1 @@
(e=>{"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?e(require("jquery")):e(jQuery)})(function(A){var a,e=navigator.userAgent,R=/iphone/i.test(e),S=/chrome/i.test(e),T=/android/i.test(e);A.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},A.fn.extend({caret:function(e,t){var n;if(0!==this.length&&!this.is(":hidden")&&this.get(0)===document.activeElement)return"number"==typeof e?(t="number"==typeof t?t:e,this.each(function(){this.setSelectionRange?this.setSelectionRange(e,t):this.createTextRange&&((n=this.createTextRange()).collapse(!0),n.moveEnd("character",t),n.moveStart("character",e),n.select())})):(this[0].setSelectionRange?(e=this[0].selectionStart,t=this[0].selectionEnd):document.selection&&document.selection.createRange&&(n=document.selection.createRange(),e=0-n.duplicate().moveStart("character",-1e5),t=e+n.text.length),{begin:e,end:t})},unmask:function(){return this.trigger("unmask")},mask:function(t,l){var n,b,u,k,y,x,j,e;return!t&&0<this.length?(e=A(this[0]).data(A.mask.dataName))?e():void 0:(l=A.extend({autoclear:A.mask.autoclear,placeholder:A.mask.placeholder,completed:null},l),n=A.mask.definitions,b=[],u=x=t.length,k=null,t=String(t),A.each(t.split(""),function(e,t){"?"==t?(x--,u=e):n[t]?(b.push(new RegExp(n[t])),null===k&&(k=b.length-1),e<u&&(y=b.length-1)):b.push(null)}),this.trigger("unmask").each(function(){var s=A(this),f=A.map(t.split(""),function(e,t){if("?"!=e)return n[e]?g(t):e}),o=f.join(""),i=s.val();function h(){if(l.completed){for(var e=k;e<=y;e++)if(b[e]&&f[e]===g(e))return;l.completed.call(s)}}function g(e){return e<l.placeholder.length?l.placeholder.charAt(e):l.placeholder.charAt(0)}function m(e){for(;++e<x&&!b[e];);return e}function d(e,t){var n,a;if(!(e<0)){for(n=e,a=m(t);n<x;n++)if(b[n]){if(!(a<x&&b[n].test(f[a])))break;f[n]=f[a],f[a]=g(a),a=m(a)}v(),s.caret(Math.max(k,e))}}function r(e){c(),s.val()!=i&&s.change()}function p(e,t){for(var n=e;n<t&&n<x;n++)b[n]&&(f[n]=g(n))}function v(){s.val(f.join(""))}function c(e){for(var t,n=s.val(),a=-1,i=0,r=0;i<x;i++)if(b[i]){for(f[i]=g(i);r++<n.length;)if(t=n.charAt(r-1),b[i].test(t)){f[i]=t,a=i;break}if(r>n.length){p(i+1,x);break}}else f[i]===n.charAt(r)&&r++,i<u&&(a=i);return e?v():a+1<u?l.autoclear||f.join("")===o?(s.val()&&s.val(""),p(0,x)):v():(v(),s.val(s.val().substring(0,a+1))),u?i:k}s.data(A.mask.dataName,function(){return A.map(f,function(e,t){return b[t]&&e!=g(t)?e:null}).join("")}),s.one("unmask",function(){s.off(".mask").removeData(A.mask.dataName)}).on("focus.mask",function(){var e;s.prop("readonly")||(clearTimeout(a),i=s.val(),e=c(),a=setTimeout(function(){s.get(0)===document.activeElement&&(v(),e==t.replace("?","").length?s.caret(0,e):s.caret(e))},10))}).on("blur.mask",r).on("keydown.mask",function(e){var t,n,a;s.prop("readonly")||(t=e.which||e.keyCode,j=s.val(),8===t||46===t||R&&127===t?(n=(a=s.caret()).begin,(a=a.end)-n==0&&(n=46!==t?(e=>{for(;0<=--e&&!b[e];);return e})(n):a=m(n-1),a=46===t?m(a):a),p(n,a),d(n,a-1),e.preventDefault()):13===t?r.call(this,e):27===t&&(s.val(i),s.caret(0,c()),e.preventDefault()))}).on("keypress.mask",function(e){if(!s.prop("readonly")){var t,n,a,i=e.which||e.keyCode,r=s.caret();if(!(e.ctrlKey||e.altKey||e.metaKey||i<32)&&i&&13!==i){if(r.end-r.begin!=0&&(p(r.begin,r.end),d(r.begin,r.end-1)),(t=m(r.begin-1))<x&&(n=String.fromCharCode(i),b[t].test(n))){for(var o,c,l=t,u=g(t);l<x;l++)if(b[l]){if(o=m(l),c=f[l],f[l]=u,!(o<x&&b[o].test(c)))break;u=c}f[t]=n,v(),a=m(t),T?setTimeout(function(){A.proxy(A.fn.caret,s,a)()},0):s.caret(a),r.begin<=y&&h()}e.preventDefault()}}}).on("input.mask paste.mask",function(){s.prop("readonly")||setTimeout(function(){var e=c(!0);s.caret(e),h()},0)}),S&&T&&s.off("input.mask").on("input.mask",function(e){function t(){A.proxy(A.fn.caret,s,a.begin,a.begin)()}var n=s.val(),a=s.caret();if(j&&j.length&&j.length>n.length){for(c(!0);0<a.begin&&!b[a.begin-1];)a.begin--;if(0===a.begin)for(;a.begin<k&&!b[a.begin];)a.begin++}else{var i=c(!0),n=n.charAt(a.begin);a.begin<x&&(b[a.begin]?b[a.begin].test(n)&&a.begin++:a.begin=i)}setTimeout(t,0),h()}),c()}))}})});
@@ -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'>&nbsp;</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);
@@ -0,0 +1 @@
(t=>{t.fn.textareaCount=function(i,r){var o,l=t(this),c=0,u=i.maxCharacterSize,s=0,f=0,h={};function d(r){for(var a=0,e=0;e<r.length;e++)"\n"===r.charAt(e)&&a++;return a}function p(){return-1!==navigator.appVersion.toLowerCase().indexOf("win")}function g(r){return(r+" ").replace(/^[^A-Za-z0-9]+/gi,"").replace(/[^A-Za-z0-9]+/gi," ").split(" ")}function m(r){return r.length-1}function a(){var r,a,e,t=l.val(),n=("function"==typeof i.charCounter?i.charCounter:h[i.charCounter])(t);return 0<i.maxCharacterSize?(r=d(t=i.truncate&&n>=i.maxCharacterSize?t.substring(0,i.maxCharacterSize):t),a=i.maxCharacterSize,p()&&(a=i.maxCharacterSize-r),i.truncate&&a<n&&(e=this.scrollTop,l.val(t.substring(0,a)),this.scrollTop=e),o.removeClass(i.warningStyle+" "+i.errorStyle),a-n<=i.warningNumber&&o.addClass(i.warningStyle),a-n<0&&o.addClass(i.errorStyle),c=n,p()&&(c=n+r),f=m(g(l.val())),s=u-c):(r=d(t),c=n,p()&&(c=n+r),f=m(g(l.val()))),e=(e=(e=i.displayFormat).replace("#input",c)).replace("#words",f),e=0<u?(e=e.replace("#max",u)).replace("#left",s):e}function e(){o.html(a()),void 0!==r&&r.call(this,{input:c,max:u,left:s,words:f})}h.standard=function(r){return r.length},h.twitter=function(r){var a=Array(23).join("*"),e=new RegExp("(https?://)?([a-z0-9+!*(),;?&=$_.-]+(:[a-z0-9+!*(),;?&=$_.-]+)?@)?([a-z0-9-.]*)\\.(travel|museum|[a-z]{2,4})(:[0-9]{2,5})?(/([a-z0-9+$_-]\\.?)+)*/?(\\?[a-z+&$_.-][a-z0-9;:@&%=+/$_.-]*)?(#[a-z_.-][a-z0-9+$_.-]*)?","gi");return r.replace(e,a).length},i=t.extend({maxCharacterSize:-1,truncate:!0,charCounter:"standard",originalStyle:"originalTextareaInfo",warningStyle:"warningTextareaInfo",errorStyle:"errorTextareaInfo",warningNumber:20,displayFormat:"#input characters | #words words"},i),t("<div class='charleft'>&nbsp;</div>").insertAfter(l),(o=l.next(".charleft")).addClass(i.originalStyle),e(),l.bind("keyup",function(){e()}).bind("mouseover paste",function(){setTimeout(function(){e()},10)})}})(jQuery);
File diff suppressed because it is too large. Load diff
@@ -0,0 +1 @@
function initLayoutEditor(c){c.fn.setGroupId=function(e){return this.attr("data-groupId",e),this.each(function(){var t=W(c(this));t&&(t.layoutGroupId=e)}),this},c.fn.setGridColumnSpan=function(e){var i;return null===e?this.css("grid-column","auto / auto"):(this.css("grid-column","span {0}".gformFormat(e)),this.each(function(){var t;c(this).hasClass("spacer")?(t=c(this).prev(".gfield"),(i=W(t)).layoutSpacerGridColumnSpan=e):(i=W(c(this)))&&(i.layoutGridColumnSpan=e)})),this},c.fn.getGridColumnSpan=function(){var t;if(void 0!==this.css("gridColumnStart"))return t=parseInt(this.css("gridColumnStart").split(" ")[1]),isNaN(t)&&void 0!==b?b:t},c.fn.resizeGroup=function(t){j(t)},String.prototype.gformFormat||(String.prototype.gformFormat=function(){var i=arguments;return this.replace(/{(\d+)}/g,function(t,e){return void 0!==i[e]?i[e]:t})});var o,n,t,p=c("#form_editor_fields_container"),m=c(".gform_editor"),_=c("#gform_fields"),e=c("#no-fields"),r=c("#no-fields-drop"),v=c(".editor-sidebar"),E=c(".gfield-field-action"),a=M(),C=null,i=".add-buttons button",b=getComputedStyle(_[0])["grid-template-columns"].split(" ").length,y=b/4,u=null,d=!1,l=(g(a),"1"!==window.gf_legacy.is_legacy&&a.length&&(t=(()=>{var t=[],e=[],i=a[0].offsetTop;return a.each(function(){i!==this.offsetTop&&e.length&&(t.push(e),e=[]),e.push({el:this,groupId:this.dataset.groupid}),i=this.offsetTop}),t})(),n=[],t.forEach(function(t){var e,i,o=[],r=!1;t.forEach(function(t){-1!==n.indexOf(t.groupId)&&(r=!0),o.push(t.groupId)}),o.every(function(t,e,i){return t===i[0]})&&!r||(e=t,i=G(),e.forEach(function(t){c(t.el).setGroupId(i)})),n.push(t[0].groupId)})),"inline"===c("#field_submit").attr("data-field-position")&&(t=jQuery("#field_submit").prev().attr("data-groupid"),jQuery("#field_submit").setGroupId(t)),c(i).on("mousedown touchstart",function(){gform.tools.trigger("gform/flyout/close-all"),c(this).attr("title","")}).draggable({helper:"clone",revert:function(){return!1},cancel:!1,appendTo:_,containment:"document",start:function(t,e){if(H(),p.addClass("droppable"),1==gf_vars.currentlyAddingField)return!1;e.helper.addClass("gform-theme__disable"),e.helper.width(c(this).width()).height(c(this).height()),_.addClass("dragging"),(C=c(this).clone()).addClass("placeholder"),c(this).addClass("fieldPlaceholder")},drag:function(t,e){var i,o;form.fields.length&&(i=+e.position.top+e.helper.outerHeight()/2,o=+e.position.left+e.helper.outerWidth()/2,h(0,e,i,o))},stop:function(t,e){c(this).removeClass("fieldPlaceholder"),p.removeClass("droppable"),_.removeClass("dragging"),e.helper.removeClass("gform-theme__disable");var i=!1;!form.fields.length&&d?(d=!1,i=F(e.helper.data("type"))):form.fields.length&&k(!1).data("target")&&(i=F(e.helper.data("type"))),i||(k(!1).remove(),C.remove(),C=null),c(this).attr("title",c(this).attr("data-description"))}}).on("click keypress",function(){C=null}),e.droppable({accept:i,activate:function(t,e){r.show(),c(this).addClass("ready")},over:function(){c(this).addClass("hovering"),r.addClass("hovering")},out:function(){c(this).removeClass("hovering"),r.removeClass("hovering")},drop:function(){d=!0,c(this).removeClass("hovering"),r.removeClass("hovering")},deactivate:function(){c(this).removeClass("ready")}}),null);function s(t,e){var i='<li data-js-field-loading-placeholder><div class="dropzone__loader"><div class="dropzone__loader-item dropzone__loader-label"></div><div class="dropzone__loader-item dropzone__loader-content"></div></div></li>';void 0!==e?0===e?c("#gform_fields").prepend(i):c("#gform_fields").children().eq(e-1).after(i):jQuery("#field_submit")?jQuery(i).insertBefore(jQuery("#field_submit")):c("#gform_fields").append(i),c("[data-js-field-loading-placeholder]").setGridColumnSpan(b),c("#form_editor_fields_container").addClass("dropzone-loader-visible"),x(c("[data-js-field-loading-placeholder]"),k(!1).data("target"),k(!1).data("where"))}function f(){c("#form_editor_fields_container").removeClass("dropzone-loader-visible"),c("[data-js-field-loading-placeholder]").remove()}function g(i){i.hasClass("ui-draggable")&&i.draggable("destroy").resizable("destroy"),i.draggable({helper:"clone",zIndex:999,handle:".gfield-drag",create:function(t,e){var i,o;Q(c(this))||((o=!!(o=c(this).attr("id").replace("field_",""))&&GetFieldById(o))&&o.layoutGroupId&&!m.hasClass("gform_legacy_markup")?i=o.layoutGroupId:G(c(this),!1)||(i=G()),c(this).setGroupId(i))},start:function(t,e){_.addClass("dragging"),p.addClass("droppable"),(C=c(this)).addClass("placeholder")},drag:function(t,e){e.helper.width(C.width()).height(C.height()).setGridColumnSpan(null),helperLeft=gform.tools.isRtl()?e.position.left+e.helper.outerWidth():e.position.left,h(0,e,e.position.top,helperLeft)},stop:function(t,e){_.removeClass("dragging"),p.removeClass("droppable"),C.removeClass("placeholder"),M().removeClass("hovering"),k().data("target")&&x(C,k().data("target"),k().data("where")),k().remove(),e.helper.remove()}}).resizable({handles:"e, w",start:function(t,e){"1"===gf_legacy.is_leLine truncated
@@ -0,0 +1,178 @@
var GFPageConditionalLogic = function (args) {
var self = this,
$ = jQuery;
/**
* Initialize Feed Ordering
*/
self.init = function () {
// Assign options to instance.
self.options = args;
self.triggerInputIds = self.getTriggerInputIds(self.options.pages);
self.formWrapper = '#gform_wrapper_' + self.options.formId;
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 () {
let page, isMatch, isVisible;
for ( let i = 0; i < self.options.pages.length; i++ ) {
page = self.options.pages[i];
isMatch = self.evaluatePage( page, self.options.formId );
isVisible = self.isPageVisible( page );
if ( ! isMatch && isVisible !== false ) {
self.hidePage( page );
} else if ( isMatch && !isVisible ) {
self.showPage( page );
}
}
/**
* 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);
gform.utils.trigger( {
event: 'gform/frontend_pages/evaluated',
data: {
formId: self.options.formId,
pages: self.options.pages
},
native: false
} );
};
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 ) {
var isVisible = self.isPageVisible(page);
if (isVisible === true) {
return;
}
page.isVisible = true;
$('#gform_' + self.options.formId + ' div[data-js="page-field-id-' + page.fieldId + '"]').attr('data-conditional-logic', 'visible');
/**
* Fires after the conditional logic on the form has been evaluated and the page has been found to be visible.
*
* @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 ) {
var isVisible = self.isPageVisible( page );
if (isVisible === false) {
return;
}
page.isVisible = false;
$('#gform_' + self.options.formId + ' div[data-js="page-field-id-' + page.fieldId + '"]').attr('data-conditional-logic', 'hidden');
/**
* Fires after the conditional logic on the form has been evaluated and the page has become hidden.
*
* @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);
};
this.init();
};
@@ -0,0 +1 @@
var GFPageConditionalLogic=function(o){var r=this,a=jQuery;r.init=function(){r.options=o,r.triggerInputIds=r.getTriggerInputIds(r.options.pages),r.formWrapper="#gform_wrapper_"+r.options.formId,r.startAtZero=a(r.formWrapper+" .gf_progressbar_wrapper").data("startAtZero"),r.evaluatePages(),r.bindEvents()},r.bindEvents=function(){gform.addAction("gform_input_change",function(o,i,t){var e=parseInt(t,10)+"",t=-1!==a.inArray(t,r.triggerInputIds)||-1!==a.inArray(e,r.triggerInputIds);r.options.formId==i&&t&&r.evaluatePages()})},r.evaluatePages=function(){var i,t,e;for(let o=0;o<r.options.pages.length;o++)i=r.options.pages[o],t=r.evaluatePage(i,r.options.formId),e=r.isPageVisible(i),t||!1===e?t&&!e&&r.showPage(i):r.hidePage(i);gform.doAction("gform_frontend_pages_evaluated",r.options.pages,r.options.formId,r),gform.doAction("gform_frontend_pages_evaluated_{0}".gformFormat(r.options.formId),r.options.pages,r.options.formId,r),gform.utils.trigger({event:"gform/frontend_pages/evaluated",data:{formId:r.options.formId,pages:r.options.pages},native:!1})},r.evaluatePage=function(o,i){return!o.conditionalLogic||"show"===gf_get_field_action(i,o.conditionalLogic)},r.getTriggerInputIds=function(){for(var o=[],i=0;i<r.options.pages.length;i++){var t=r.options.pages[i];if(t.conditionalLogic)for(var e=0;e<t.conditionalLogic.rules.length;e++){var n=r.options.pages[i].conditionalLogic.rules[e];-1===a.inArray(n.fieldId,o)&&o.push(n.fieldId)}}return o},r.isPageVisible=function(o){return!("object"!=typeof o&&!(o=r.getPage(o)))&&(void 0!==o.isVisible?o.isVisible:null)},r.getPage=function(o){for(var i=0;i<r.options.pages.length;i++){var t=r.options.pages[i];if(t.fieldId==o)return t}return!1},r.showPage=function(o){!0!==r.isPageVisible(o)&&(o.isVisible=!0,a("#gform_"+r.options.formId+' div[data-js="page-field-id-'+o.fieldId+'"]').attr("data-conditional-logic","visible"),gform.doAction("gform_frontend_page_visible",o,r.options.formId),gform.doAction("gform_frontend_page_visible_{0}".gformFormat(r.options.formId),o,r.options.formId))},r.hidePage=function(o){!1!==r.isPageVisible(o)&&(o.isVisible=!1,a("#gform_"+r.options.formId+' div[data-js="page-field-id-'+o.fieldId+'"]').attr("data-conditional-logic","hidden"),gform.doAction("gform_frontend_page_hidden",o,r.options.formId),gform.doAction("gform_frontend_page_hidden_{0}".gformFormat(r.options.formId),o,r.options.formId))},this.init()};
@@ -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);
@@ -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 );
@@ -0,0 +1 @@
(t=>{t(document).ready(function(){gform.adminUtils.handleUnsavedChanges("#gform-settings")});var n=t('div[id="gform_setting_reset"]'),i=t('input[name="_gform_setting_public_key"]'),r=t('input[name="_gform_setting_private_key"]'),o=t('input[name="_gform_setting_reset"]');window.loadRecaptcha=function(){var e=t("#recaptcha"),a=t("#gform-settings-save"),c=t('input[name="_gform_setting_type"]:checked').val();if(window.___grecaptcha_cfg.clients={},window.___grecaptcha_cfg.count=0,e.html(""),o.val(1),t("#recpatcha .gform-settings-field__feedback").remove(),i.val()&&r.val()){switch(a.prop("disabled",!0),grecaptcha.render("recaptcha",{sitekey:i.val(),size:"invisible"===c?c:"",badge:"inline","error-callback":function(){},callback:function(){a.prop("disabled",!1)}}),c){case"checkbox":t('#gforms_checkbox_recaptcha_message, label[for="reset"]').show();break;case"invisible":t('#gforms_checkbox_recaptcha_message, label[for="reset"]').hide()}n.show(),"invisible"===c&&grecaptcha.execute()}else a.prop("disabled",!1),n.hide()},i.on("change",loadRecaptcha),r.on("change",loadRecaptcha),t('input[name="_gform_setting_type"]').on("change",function(){loadRecaptcha()})})(jQuery);
@@ -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
View 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 )")})});
@@ -0,0 +1,761 @@
//Props: https://github.com/fusioneng/Shortcake/
var GformShortcodeUI;
( function (gfShortCodeUI, $) {
var i18n = window.gform_admin_config.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.shortcode_ui.edit_form, "#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.shortcode_ui.insert_form, "#TB_inline?inlineId=select_gravity_form&width=753&height=686", "" );
});
});
}(window.gfShortcodeUI = window.gfShortcodeUI || {}, jQuery));
@@ -0,0 +1 @@
var GformShortcodeUI;(u=>{var n=window.gform_admin_config.i18n,r=window.GformShortcodeUI={models:{},collections:{},views:{},utils:{},strings:{}};r.models.ShortcodeAttribute=Backbone.Model.extend({defaults:{attr:"",label:"",type:"",section:"",description:"",default:"",value:""}}),r.models.ShortcodeAttributes=Backbone.Collection.extend({model:r.models.ShortcodeAttribute,clone:function(){return new this.constructor(_.map(this.models,function(e){return e.clone()}))}}),r.models.Shortcode=Backbone.Model.extend({defaults:{label:"",shortcode_tag:"",action_tag:"",attrs:r.models.ShortcodeAttributes},set:function(e,t){return void 0===e.attrs||e.attrs instanceof r.models.ShortcodeAttributes||(_.each(e.attrs,function(e){null!=e.default&&(e.value=e.default)}),e.attrs=new r.models.ShortcodeAttributes(e.attrs)),Backbone.Model.prototype.set.call(this,e,t)},toJSON:function(e){return void 0!==(e=Backbone.Model.prototype.toJSON.call(this,e)).attrs&&e.attrs instanceof r.models.ShortcodeAttributes&&(e.attrs=e.attrs.toJSON()),e},clone:function(){var e=Backbone.Model.prototype.clone.call(this);return e.set("attrs",e.get("attrs").clone()),e},formatShortcode:function(){var e,r,i=[];return this.get("attrs").each(function(e){var t=e.get("value"),o=e.get("type"),n=e.get("default");(!t||t.length<1)&&"checkbox"!=o||"checkbox"==o&&"true"!=n&&!t||("content"===e.get("attr")?r=e.get("value"):i.push(e.get("attr")+'="'+t+'"'))}),e="[{{ shortcode }} {{ attributes }}]",r&&0<r.length&&(e+="{{ content }}[/{{ shortcode }}]"),e=(e=(e=e.replace(/{{ shortcode }}/g,this.get("shortcode_tag"))).replace(/{{ attributes }}/g,i.join(" "))).replace(/{{ content }}/g,r)},validate:function(e){var t=[];return e.attrs.findWhere({attr:"id"}).get("value")||t.push({id:r.strings.pleaseSelectAForm}),t.length?t:null}}),r.collections.Shortcodes=Backbone.Collection.extend({model:r.models.Shortcode}),r.views.editShortcodeForm=wp.Backbone.View.extend({el:"#gform-shortcode-ui-container",template:wp.template("gf-shortcode-default-edit-form"),hasAdvancedValue:!1,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(e){return t.beforeRender(),e(),t.afterRender(),t}),this.model.get("attrs").each(function(e){switch(e.get("section")){case"required":t.views.add(".gf-edit-shortcode-form-required-attrs",new r.views.editAttributeField({model:e,parent:t}));break;case"standard":t.views.add(".gf-edit-shortcode-form-standard-attrs",new r.views.editAttributeField({model:e,parent:t}));break;default:t.views.add(".gf-edit-shortcode-form-advanced-attrs",new r.views.editAttributeField({model:e,parent:t})),t.hasAdvancedVal||(t.hasAdvancedVal=""!==e.get("value"))}}),this.listenTo(this.model,"change",this.render)},beforeRender:function(){},afterRender:function(){gform_initialize_tooltips(),u("#gform-insert-shortcode").toggle("insert"==this.options.viewMode),u("#gform-update-shortcode").toggle("insert"!=this.options.viewMode),u("#gf-edit-shortcode-form-advanced-attrs").toggle(this.hasAdvancedVal)},insertShortcode:function(e){this.model.isValid({validate:!0})?(send_to_editor(this.model.formatShortcode()),tb_remove(),this.dispose()):_.each(this.model.validationError,function(e){_.each(e,function(e,t){alert(e)})})},cancelShortcode:function(e){tb_remove(),this.dispose()},dispose:function(){this.remove(),u("#gform-shortcode-ui-wrap").append('<div id="gform-shortcode-ui-container"></div>')}}),r.views.editAttributeField=Backbone.View.extend({tagName:"div",initialize:function(e){this.parent=e.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(){return this.template=wp.media.template("gf-shortcode-ui-field-"+this.model.get("type")),this.$el.html(this.template(this.model.toJSON()))},updateValue:function(e){e=u(e.target);this.model.set("value",e.val())},updateCheckbox:function(e){e=u(e.target).prop("checked");this.model.set("value",e)},updateAction:function(e){var e=u(e.target).val(),t=(this.model.set("value",e),this.parent.model),e=r.shortcodes.findWhere({shortcode_tag:"gravityform",action_tag:e}),n=t.get("attrs"),t=(e.get("attrs").each(function(e){var t=e.get("attr"),o=n.findWhere({attr:t});void 0!==o&&t==o.get("attr")&&(t=o.get("value"),e.set("value",String(t)))}),u(this.parent.el).empty(),this.parent.options.viewMode);this.parent.dispose(),this.parent.model.set(e),(GformShortcodeUI=new r.views.editShortcodeForm({model:e,viewMode:t})).render()}}),r.utils.shortcodeViewConstructor={initialize:functionLine truncated
@@ -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
View File
@@ -0,0 +1 @@
process.env.SKIP_BUILD?process.exit(0):process.exit(1);
@@ -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;
}
@@ -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()});
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff