diff --git a/acf.php b/acf.php
index bb52c6f..c7b788d 100644
--- a/acf.php
+++ b/acf.php
@@ -3,7 +3,7 @@
Plugin Name: Advanced Custom Fields PRO
Plugin URI: https://www.advancedcustomfields.com
Description: Customize WordPress with powerful, professional and intuitive fields.
-Version: 5.8.3
+Version: 5.8.4
Author: Elliot Condon
Author URI: https://www.advancedcustomfields.com
Text Domain: acf
@@ -16,77 +16,62 @@ if( ! class_exists('ACF') ) :
class ACF {
- /** @var string The plugin version number */
- var $version = '5.8.3';
+ /** @var string The plugin version number. */
+ var $version = '5.8.4';
- /** @var array The plugin settings array */
+ /** @var array The plugin settings array. */
var $settings = array();
- /** @var array The plugin data array */
+ /** @var array The plugin data array. */
var $data = array();
- /** @var array Storage for class instances */
+ /** @var array Storage for class instances. */
var $instances = array();
-
- /*
- * __construct
- *
- * A dummy constructor to ensure ACF is only initialized once
- *
- * @type function
- * @date 23/06/12
- * @since 5.0.0
- *
- * @param N/A
- * @return N/A
- */
-
+ /**
+ * __construct
+ *
+ * A dummy constructor to ensure ACF is only setup once.
+ *
+ * @date 23/06/12
+ * @since 5.0.0
+ *
+ * @param void
+ * @return void
+ */
function __construct() {
-
- /* Do nothing here */
-
+ // Do nothing.
}
-
- /*
- * initialize
- *
- * The real constructor to initialize ACF
- *
- * @type function
- * @date 28/09/13
- * @since 5.0.0
- *
- * @param $post_id (int)
- * @return $post_id (int)
- */
-
+ /**
+ * initialize
+ *
+ * Sets up the ACF plugin.
+ *
+ * @date 28/09/13
+ * @since 5.0.0
+ *
+ * @param void
+ * @return void
+ */
function initialize() {
- // vars
- $version = $this->version;
- $basename = plugin_basename( __FILE__ );
- $path = plugin_dir_path( __FILE__ );
- $url = plugin_dir_url( __FILE__ );
- $slug = dirname($basename);
+ // Define constants.
+ $this->define( 'ACF', true );
+ $this->define( 'ACF_PATH', plugin_dir_path( __FILE__ ) );
+ $this->define( 'ACF_BASENAME', plugin_basename( __FILE__ ) );
+ $this->define( 'ACF_VERSION', $this->version );
+ $this->define( 'ACF_MAJOR_VERSION', 5 );
-
- // settings
+ // Define settings.
$this->settings = array(
-
- // basic
- 'name' => __('Advanced Custom Fields', 'acf'),
- 'version' => $version,
-
- // urls
- 'file' => __FILE__,
- 'basename' => $basename,
- 'path' => $path,
- 'url' => $url,
- 'slug' => $slug,
-
- // options
+ 'name' => __('Advanced Custom Fields', 'acf'),
+ 'slug' => dirname( ACF_BASENAME ),
+ 'version' => ACF_VERSION,
+ 'basename' => ACF_BASENAME,
+ 'path' => ACF_PATH,
+ 'file' => __FILE__,
+ 'url' => plugin_dir_url( __FILE__ ),
'show_admin' => true,
'show_updates' => true,
'stripslashes' => false,
@@ -112,12 +97,6 @@ class ACF {
'remove_wp_meta_box' => true
);
-
- // constants
- $this->define( 'ACF', true );
- $this->define( 'ACF_VERSION', $version );
- $this->define( 'ACF_PATH', $path );
-
// Include utility functions.
include_once( ACF_PATH . 'includes/acf-utility-functions.php');
@@ -128,6 +107,8 @@ class ACF {
// Include classes.
acf_include('includes/class-acf-data.php');
+ acf_include('includes/fields/class-acf-field.php');
+ acf_include('includes/locations/class-acf-location.php');
// Include functions.
acf_include('includes/acf-helper-functions.php');
@@ -141,17 +122,9 @@ class ACF {
acf_include('includes/acf-value-functions.php');
acf_include('includes/acf-input-functions.php');
- // fields
+ // Include core.
acf_include('includes/fields.php');
- acf_include('includes/fields/class-acf-field.php');
-
-
- // locations
acf_include('includes/locations.php');
- acf_include('includes/locations/class-acf-location.php');
-
-
- // core
acf_include('includes/assets.php');
acf_include('includes/compatibility.php');
acf_include('includes/deprecated.php');
@@ -166,13 +139,13 @@ class ACF {
acf_include('includes/upgrades.php');
acf_include('includes/validation.php');
- // ajax
+ // Include ajax.
acf_include('includes/ajax/class-acf-ajax.php');
acf_include('includes/ajax/class-acf-ajax-check-screen.php');
acf_include('includes/ajax/class-acf-ajax-user-setting.php');
acf_include('includes/ajax/class-acf-ajax-upgrade.php');
- // forms
+ // Include forms.
acf_include('includes/forms/form-attachment.php');
acf_include('includes/forms/form-comment.php');
acf_include('includes/forms/form-customizer.php');
@@ -184,8 +157,7 @@ class ACF {
acf_include('includes/forms/form-user.php');
acf_include('includes/forms/form-widget.php');
-
- // admin
+ // Include admin.
if( is_admin() ) {
acf_include('includes/admin/admin.php');
acf_include('includes/admin/admin-field-group.php');
@@ -196,8 +168,7 @@ class ACF {
acf_include('includes/admin/settings-info.php');
}
-
- // pro
+ // Include PRO.
acf_include('pro/acf-pro.php');
// Include tests.
@@ -205,63 +176,53 @@ class ACF {
acf_include('tests/tests.php');
}
- // actions
- add_action('init', array($this, 'init'), 5);
- add_action('init', array($this, 'register_post_types'), 5);
- add_action('init', array($this, 'register_post_status'), 5);
+ // Add actions.
+ add_action( 'init', array($this, 'init'), 5 );
+ add_action( 'init', array($this, 'register_post_types'), 5 );
+ add_action( 'init', array($this, 'register_post_status'), 5 );
-
- // filters
- add_filter('posts_where', array($this, 'posts_where'), 10, 2 );
- //add_filter('posts_request', array($this, 'posts_request'), 10, 1 );
+ // Add filters.
+ add_filter( 'posts_where', array($this, 'posts_where'), 10, 2 );
}
-
- /*
- * init
- *
- * This function will run after all plugins and theme functions have been included
- *
- * @type action (init)
- * @date 28/09/13
- * @since 5.0.0
- *
- * @param N/A
- * @return N/A
- */
-
+ /**
+ * init
+ *
+ * Completes the setup process on "init" of earlier.
+ *
+ * @date 28/09/13
+ * @since 5.0.0
+ *
+ * @param void
+ * @return void
+ */
function init() {
- // bail early if too early
- // ensures all plugins have a chance to add fields, etc
- if( !did_action('plugins_loaded') ) return;
+ // Bail early if called directly from functions.php or plugin file.
+ if( !did_action('plugins_loaded') ) {
+ return;
+ }
+ // This function may be called directly from template functions. Bail early if already did this.
+ if( acf_did('init') ) {
+ return;
+ }
- // bail early if already init
- if( acf_has_done('init') ) return;
+ // Update url setting. Allows other plugins to modify the URL (force SSL).
+ acf_update_setting( 'url', plugin_dir_url( __FILE__ ) );
-
- // vars
- $major = intval( acf_get_setting('version') );
-
-
- // update url
- // - allow another plugin to modify dir (maybe force SSL)
- acf_update_setting('url', plugin_dir_url( __FILE__ ));
-
-
- // textdomain
+ // Load textdomain file.
acf_load_textdomain();
- // include 3rd party support
+ // Include 3rd party compatiblity.
acf_include('includes/third-party.php');
- // include wpml support
+ // Include wpml support.
if( defined('ICL_SITEPRESS_VERSION') ) {
acf_include('includes/wpml.php');
}
- // fields
+ // Include fields.
acf_include('includes/fields/class-acf-field-text.php');
acf_include('includes/fields/class-acf-field-textarea.php');
acf_include('includes/fields/class-acf-field-number.php');
@@ -269,39 +230,42 @@ class ACF {
acf_include('includes/fields/class-acf-field-email.php');
acf_include('includes/fields/class-acf-field-url.php');
acf_include('includes/fields/class-acf-field-password.php');
-
acf_include('includes/fields/class-acf-field-image.php');
acf_include('includes/fields/class-acf-field-file.php');
acf_include('includes/fields/class-acf-field-wysiwyg.php');
acf_include('includes/fields/class-acf-field-oembed.php');
-
acf_include('includes/fields/class-acf-field-select.php');
acf_include('includes/fields/class-acf-field-checkbox.php');
acf_include('includes/fields/class-acf-field-radio.php');
acf_include('includes/fields/class-acf-field-button-group.php');
acf_include('includes/fields/class-acf-field-true_false.php');
-
acf_include('includes/fields/class-acf-field-link.php');
acf_include('includes/fields/class-acf-field-post_object.php');
acf_include('includes/fields/class-acf-field-page_link.php');
acf_include('includes/fields/class-acf-field-relationship.php');
acf_include('includes/fields/class-acf-field-taxonomy.php');
acf_include('includes/fields/class-acf-field-user.php');
-
acf_include('includes/fields/class-acf-field-google-map.php');
acf_include('includes/fields/class-acf-field-date_picker.php');
acf_include('includes/fields/class-acf-field-date_time_picker.php');
acf_include('includes/fields/class-acf-field-time_picker.php');
acf_include('includes/fields/class-acf-field-color_picker.php');
-
acf_include('includes/fields/class-acf-field-message.php');
acf_include('includes/fields/class-acf-field-accordion.php');
acf_include('includes/fields/class-acf-field-tab.php');
acf_include('includes/fields/class-acf-field-group.php');
- do_action('acf/include_field_types', $major);
+ /**
+ * Fires after field types have been included.
+ *
+ * @date 28/09/13
+ * @since 5.0.0
+ *
+ * @param int $major_version The major version of ACF.
+ */
+ do_action( 'acf/include_field_types', ACF_MAJOR_VERSION );
- // locations
+ // Include locations.
acf_include('includes/locations/class-acf-location-post-type.php');
acf_include('includes/locations/class-acf-location-post-template.php');
acf_include('includes/locations/class-acf-location-post-status.php');
@@ -323,38 +287,55 @@ class ACF {
acf_include('includes/locations/class-acf-location-widget.php');
acf_include('includes/locations/class-acf-location-nav-menu.php');
acf_include('includes/locations/class-acf-location-nav-menu-item.php');
- do_action('acf/include_location_rules', $major);
+ /**
+ * Fires after location types have been included.
+ *
+ * @date 28/09/13
+ * @since 5.0.0
+ *
+ * @param int $major_version The major version of ACF.
+ */
+ do_action( 'acf/include_location_rules', ACF_MAJOR_VERSION );
- // local fields
- do_action('acf/include_fields', $major);
+ /**
+ * Fires during initialization. Used to add local fields.
+ *
+ * @date 28/09/13
+ * @since 5.0.0
+ *
+ * @param int $major_version The major version of ACF.
+ */
+ do_action( 'acf/include_fields', ACF_MAJOR_VERSION );
-
- // action for 3rd party
- do_action('acf/init');
+ /**
+ * Fires after ACF is completely "initialized".
+ *
+ * @date 28/09/13
+ * @since 5.0.0
+ *
+ * @param int $major_version The major version of ACF.
+ */
+ do_action( 'acf/init', ACF_MAJOR_VERSION );
}
-
- /*
- * register_post_types
- *
- * This function will register post types and statuses
- *
- * @type function
- * @date 22/10/2015
- * @since 5.3.2
- *
- * @param n/a
- * @return n/a
- */
-
+ /**
+ * register_post_types
+ *
+ * Registers the ACF post types.
+ *
+ * @date 22/10/2015
+ * @since 5.3.2
+ *
+ * @param void
+ * @return void
+ */
function register_post_types() {
- // vars
+ // Vars.
$cap = acf_get_setting('capability');
-
- // register post type 'acf-field-group'
+ // Register the Field Group post type.
register_post_type('acf-field-group', array(
'labels' => array(
'name' => __( 'Field Groups', 'acf' ),
@@ -369,7 +350,9 @@ class ACF {
'not_found_in_trash' => __( 'No Field Groups found in Trash', 'acf' ),
),
'public' => false,
+ 'hierarchical' => true,
'show_ui' => true,
+ 'show_in_menu' => false,
'_builtin' => false,
'capability_type' => 'post',
'capabilities' => array(
@@ -378,15 +361,13 @@ class ACF {
'edit_posts' => $cap,
'delete_posts' => $cap,
),
- 'hierarchical' => true,
+ 'supports' => array('title'),
'rewrite' => false,
'query_var' => false,
- 'supports' => array('title'),
- 'show_in_menu' => false,
));
- // register post type 'acf-field'
+ // Register the Field post type.
register_post_type('acf-field', array(
'labels' => array(
'name' => __( 'Fields', 'acf' ),
@@ -401,7 +382,9 @@ class ACF {
'not_found_in_trash' => __( 'No Fields found in Trash', 'acf' ),
),
'public' => false,
+ 'hierarchical' => true,
'show_ui' => false,
+ 'show_in_menu' => false,
'_builtin' => false,
'capability_type' => 'post',
'capabilities' => array(
@@ -410,32 +393,26 @@ class ACF {
'edit_posts' => $cap,
'delete_posts' => $cap,
),
- 'hierarchical' => true,
+ 'supports' => array('title'),
'rewrite' => false,
'query_var' => false,
- 'supports' => array('title'),
- 'show_in_menu' => false,
));
-
}
-
- /*
- * register_post_status
- *
- * This function will register custom post statuses
- *
- * @type function
- * @date 22/10/2015
- * @since 5.3.2
- *
- * @param $post_id (int)
- * @return $post_id (int)
- */
-
+ /**
+ * register_post_status
+ *
+ * Registers the ACF post statuses.
+ *
+ * @date 22/10/2015
+ * @since 5.3.2
+ *
+ * @param void
+ * @return void
+ */
function register_post_status() {
- // acf-disabled
+ // Register the Disabled post status.
register_post_status('acf-disabled', array(
'label' => __( 'Inactive', 'acf' ),
'public' => true,
@@ -444,237 +421,198 @@ class ACF {
'show_in_admin_status_list' => true,
'label_count' => _n_noop( 'Inactive (%s)', 'Inactive (%s)', 'acf' ),
));
-
}
-
- /*
- * posts_where
- *
- * This function will add in some new parameters to the WP_Query args allowing fields to be found via key / name
- *
- * @type filter
- * @date 5/12/2013
- * @since 5.0.0
- *
- * @param $where (string)
- * @param $wp_query (object)
- * @return $where (string)
- */
-
+ /**
+ * posts_where
+ *
+ * Filters the $where clause allowing for custom WP_Query args.
+ *
+ * @date 31/8/19
+ * @since 5.8.1
+ *
+ * @param string $where The WHERE clause.
+ * @return WP_Query $wp_query The query object.
+ */
function posts_where( $where, $wp_query ) {
-
- // global
global $wpdb;
-
- // acf_field_key
+ // Add custom "acf_field_key" arg.
if( $field_key = $wp_query->get('acf_field_key') ) {
$where .= $wpdb->prepare(" AND {$wpdb->posts}.post_name = %s", $field_key );
}
- // acf_field_name
+ // Add custom "acf_field_name" arg.
if( $field_name = $wp_query->get('acf_field_name') ) {
$where .= $wpdb->prepare(" AND {$wpdb->posts}.post_excerpt = %s", $field_name );
}
- // acf_group_key
+ // Add custom "acf_group_key" arg.
if( $group_key = $wp_query->get('acf_group_key') ) {
$where .= $wpdb->prepare(" AND {$wpdb->posts}.post_name = %s", $group_key );
}
-
- // return
+ // Return.
return $where;
-
- }
-
-
- /*
- * define
- *
- * This function will safely define a constant
- *
- * @type function
- * @date 3/5/17
- * @since 5.5.13
- *
- * @param $name (string)
- * @param $value (mixed)
- * @return n/a
- */
-
- function define( $name, $value = true ) {
-
- if( !defined($name) ) {
- define( $name, $value );
- }
-
}
/**
- * has_setting
- *
- * Returns true if has setting.
- *
- * @date 2/2/18
- * @since 5.6.5
- *
- * @param string $name
- * @return boolean
- */
+ * define
+ *
+ * Defines a constant if doesnt already exist.
+ *
+ * @date 3/5/17
+ * @since 5.5.13
+ *
+ * @param string $name The constant name.
+ * @param mixed $value The constant value.
+ * @return void
+ */
+ function define( $name, $value = true ) {
+ if( !defined($name) ) {
+ define( $name, $value );
+ }
+ }
+ /**
+ * has_setting
+ *
+ * Returns true if a setting exists for this name.
+ *
+ * @date 2/2/18
+ * @since 5.6.5
+ *
+ * @param string $name The setting name.
+ * @return boolean
+ */
function has_setting( $name ) {
return isset($this->settings[ $name ]);
}
/**
- * get_setting
- *
- * Returns a setting.
- *
- * @date 28/09/13
- * @since 5.0.0
- *
- * @param string $name
- * @return mixed
- */
-
+ * get_setting
+ *
+ * Returns a setting or null if doesn't exist.
+ *
+ * @date 28/09/13
+ * @since 5.0.0
+ *
+ * @param string $name The setting name.
+ * @return mixed
+ */
function get_setting( $name ) {
return isset($this->settings[ $name ]) ? $this->settings[ $name ] : null;
}
/**
- * update_setting
- *
- * Updates a setting.
- *
- * @date 28/09/13
- * @since 5.0.0
- *
- * @param string $name
- * @param mixed $value
- * @return n/a
- */
-
+ * update_setting
+ *
+ * Updates a setting for the given name and value.
+ *
+ * @date 28/09/13
+ * @since 5.0.0
+ *
+ * @param string $name The setting name.
+ * @param mixed $value The setting value.
+ * @return true
+ */
function update_setting( $name, $value ) {
$this->settings[ $name ] = $value;
return true;
}
/**
- * get_data
- *
- * Returns data.
- *
- * @date 28/09/13
- * @since 5.0.0
- *
- * @param string $name
- * @return mixed
- */
-
+ * get_data
+ *
+ * Returns data or null if doesn't exist.
+ *
+ * @date 28/09/13
+ * @since 5.0.0
+ *
+ * @param string $name The data name.
+ * @return mixed
+ */
function get_data( $name ) {
return isset($this->data[ $name ]) ? $this->data[ $name ] : null;
}
-
/**
- * set_data
- *
- * Sets data.
- *
- * @date 28/09/13
- * @since 5.0.0
- *
- * @param string $name
- * @param mixed $value
- * @return n/a
- */
-
+ * set_data
+ *
+ * Sets data for the given name and value.
+ *
+ * @date 28/09/13
+ * @since 5.0.0
+ *
+ * @param string $name The data name.
+ * @param mixed $value The data value.
+ * @return void
+ */
function set_data( $name, $value ) {
$this->data[ $name ] = $value;
}
-
/**
- * get_instance
- *
- * Returns an instance.
- *
- * @date 13/2/18
- * @since 5.6.9
- *
- * @param string $class The instance class name.
- * @return object
- */
-
+ * get_instance
+ *
+ * Returns an instance or null if doesn't exist.
+ *
+ * @date 13/2/18
+ * @since 5.6.9
+ *
+ * @param string $class The instance class name.
+ * @return object
+ */
function get_instance( $class ) {
$name = strtolower($class);
return isset($this->instances[ $name ]) ? $this->instances[ $name ] : null;
}
/**
- * new_instance
- *
- * Creates and stores an instance.
- *
- * @date 13/2/18
- * @since 5.6.9
- *
- * @param string $class The instance class name.
- * @return object
- */
-
+ * new_instance
+ *
+ * Creates and stores an instance of the given class.
+ *
+ * @date 13/2/18
+ * @since 5.6.9
+ *
+ * @param string $class The instance class name.
+ * @return object
+ */
function new_instance( $class ) {
$instance = new $class();
$name = strtolower($class);
$this->instances[ $name ] = $instance;
return $instance;
}
-
}
-
/*
-* acf
-*
-* The main function responsible for returning the one true acf Instance to functions everywhere.
-* Use this function like you would a global variable, except without needing to declare the global.
-*
-* Example:
-*
-* @type function
-* @date 4/09/13
-* @since 4.3.0
-*
-* @param N/A
-* @return (object)
-*/
-
+ * acf
+ *
+ * The main function responsible for returning the one true acf Instance to functions everywhere.
+ * Use this function like you would a global variable, except without needing to declare the global.
+ *
+ * Example:
+ *
+ * @date 4/09/13
+ * @since 4.3.0
+ *
+ * @param void
+ * @return ACF
+ */
function acf() {
-
- // globals
global $acf;
-
- // initialize
+ // Instantiate only once.
if( !isset($acf) ) {
$acf = new ACF();
$acf->initialize();
}
-
-
- // return
return $acf;
-
}
-
-// initialize
+// Instantiate.
acf();
-
endif; // class_exists check
-
-?>
diff --git a/assets/js/acf-input.js b/assets/js/acf-input.js
index be153ee..8b5bbc5 100644
--- a/assets/js/acf-input.js
+++ b/assets/js/acf-input.js
@@ -2103,6 +2103,168 @@
});
};
+ /**
+ * acf.debounce
+ *
+ * Returns a debounced version of the passed function which will postpone its execution until after `wait` milliseconds have elapsed since the last time it was invoked.
+ *
+ * @date 28/8/19
+ * @since 5.8.1
+ *
+ * @param function callback The callback function.
+ * @return int wait The number of milliseconds to wait.
+ */
+ acf.debounce = function( callback, wait ){
+ var timeout;
+ return function(){
+ var context = this;
+ var args = arguments;
+ var later = function(){
+ callback.apply( context, args );
+ };
+ clearTimeout( timeout );
+ timeout = setTimeout( later, wait );
+ };
+ };
+
+ /**
+ * acf.throttle
+ *
+ * Returns a throttled version of the passed function which will allow only one execution per `limit` time period.
+ *
+ * @date 28/8/19
+ * @since 5.8.1
+ *
+ * @param function callback The callback function.
+ * @return int wait The number of milliseconds to wait.
+ */
+ acf.throttle = function( callback, limit ){
+ var busy = false;
+ return function(){
+ if( busy ) return;
+ busy = true;
+ setTimeout(function(){
+ busy = false;
+ }, limit);
+ callback.apply( this, arguments );
+ };
+ };
+
+ /**
+ * acf.isInView
+ *
+ * Returns true if the given element is in view.
+ *
+ * @date 29/8/19
+ * @since 5.8.1
+ *
+ * @param elem el The dom element to inspect.
+ * @return bool
+ */
+ acf.isInView = function( el ){
+ var rect = el.getBoundingClientRect();
+ return (
+ rect.top !== rect.bottom &&
+ rect.top >= 0 &&
+ rect.left >= 0 &&
+ rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
+ rect.right <= (window.innerWidth || document.documentElement.clientWidth)
+ );
+ };
+
+ /**
+ * acf.onceInView
+ *
+ * Watches for a dom element to become visible in the browser and then excecutes the passed callback.
+ *
+ * @date 28/8/19
+ * @since 5.8.1
+ *
+ * @param dom el The dom element to inspect.
+ * @param function callback The callback function.
+ */
+ acf.onceInView = (function() {
+
+ // Define list.
+ var items = [];
+ var id = 0;
+
+ // Define check function.
+ var check = function() {
+ items.forEach(function( item ){
+ if( acf.isInView(item.el) ) {
+ item.callback.apply( this );
+ pop( item.id );
+ }
+ });
+ };
+
+ // And create a debounced version.
+ var debounced = acf.debounce( check, 300 );
+
+ // Define add function.
+ var push = function( el, callback ) {
+
+ // Add event listener.
+ if( !items.length ) {
+ $(window).on( 'scroll resize', debounced ).on( 'acfrefresh orientationchange', check );
+ }
+
+ // Append to list.
+ items.push({ id: id++, el: el, callback: callback });
+ }
+
+ // Define remove function.
+ var pop = function( id ) {
+
+ // Remove from list.
+ items = items.filter(function(item) {
+ return (item.id !== id);
+ });
+
+ // Clean up listener.
+ if( !items.length ) {
+ $(window).off( 'scroll resize', debounced ).off( 'acfrefresh orientationchange', check );
+ }
+ }
+
+ // Define returned function.
+ return function( el, callback ){
+
+ // Allow jQuery object.
+ if( el instanceof jQuery )
+ el = el[0];
+
+ // Execute callback if already in view or add to watch list.
+ if( acf.isInView(el) ) {
+ callback.apply( this );
+ } else {
+ push( el, callback );
+ }
+ }
+ })();
+
+ /**
+ * acf.once
+ *
+ * Creates a function that is restricted to invoking `func` once.
+ *
+ * @date 2/9/19
+ * @since 5.8.1
+ *
+ * @param function func The function to restrict.
+ * @return function
+ */
+ acf.once = function( func ){
+ var i = 0;
+ return function(){
+ if( i++ > 0 ) {
+ return (func = undefined);
+ }
+ return func.apply(this, arguments);
+ }
+ }
+
/*
* exists
*
@@ -6828,7 +6990,7 @@
getNodeValue: function(){
var $node = this.get('node');
return {
- title: $node.html(),
+ title: acf.decode( $node.html() ),
url: $node.attr('href'),
target: $node.attr('target')
};
@@ -6836,7 +6998,7 @@
setNodeValue: function( val ){
var $node = this.get('node');
- $node.html( val.title );
+ $node.text( val.title );
$node.attr('href', val.url);
$node.attr('target', val.target);
$node.trigger('change');
@@ -7205,8 +7367,7 @@
'change [data-filter]': 'onChangeFilter',
'keyup [data-filter]': 'onChangeFilter',
'click .choices-list .acf-rel-item': 'onClickAdd',
- 'click [data-name="remove_item"]': 'onClickRemove',
- 'mouseover': 'onHover'
+ 'click [data-name="remove_item"]': 'onClickRemove',
},
$control: function(){
@@ -7252,60 +7413,59 @@
].join('');
},
- addSortable: function( self ){
-
- // sortable
- this.$list('values').sortable({
- items: 'li',
- forceHelperSize: true,
- forcePlaceholderSize: true,
- scroll: true,
- update: function(){
- self.$input().trigger('change');
- }
- });
- },
-
initialize: function(){
- // scroll
- var onScroll = this.proxy(function(e){
+ // Delay initialization until "interacted with" or "in view".
+ var delayed = this.proxy(acf.once(function(){
- // bail early if no more results
- if( this.get('loading') || !this.get('more') ) {
- return;
- }
+ // Add sortable.
+ this.$list('values').sortable({
+ items: 'li',
+ forceHelperSize: true,
+ forcePlaceholderSize: true,
+ scroll: true,
+ update: this.proxy(function(){
+ this.$input().trigger('change');
+ })
+ });
- // Scrolled to bottom
- var $list = this.$list('choices');
- var scrollTop = Math.ceil( $list.scrollTop() );
- var scrollHeight = Math.ceil( $list[0].scrollHeight );
- var innerHeight = Math.ceil( $list.innerHeight() );
- var paged = this.get('paged') || 1;
- if( (scrollTop + innerHeight) >= scrollHeight ) {
-
- // update paged
- this.set('paged', (paged+1));
-
- // fetch
- this.fetch();
- }
+ // Avoid browser remembering old scroll position and add event.
+ this.$list('choices').scrollTop(0).on('scroll', this.proxy(this.onScrollChoices));
- });
+ // Fetch choices.
+ this.fetch();
+
+ }));
- this.$list('choices').scrollTop(0).on('scroll', onScroll);
+ // Bind "interacted with".
+ this.$el.one( 'mouseover', delayed );
+ this.$el.one( 'focus', 'input', delayed );
- // fetch
- this.fetch();
+ // Bind "in view".
+ acf.onceInView( this.$el, delayed );
},
- onHover: function( e ){
+ onScrollChoices: function(e){
+
+ // bail early if no more results
+ if( this.get('loading') || !this.get('more') ) {
+ return;
+ }
- // only once
- $().off(e);
-
- // add sortable
- this.addSortable( this );
+ // Scrolled to bottom
+ var $list = this.$list('choices');
+ var scrollTop = Math.ceil( $list.scrollTop() );
+ var scrollHeight = Math.ceil( $list[0].scrollHeight );
+ var innerHeight = Math.ceil( $list.innerHeight() );
+ var paged = this.get('paged') || 1;
+ if( (scrollTop + innerHeight) >= scrollHeight ) {
+
+ // update paged
+ this.set('paged', (paged+1));
+
+ // fetch
+ this.fetch();
+ }
},
onKeypressFilter: function( e, $el ){
@@ -13260,6 +13420,10 @@
*/
addInputEvents: function( $el ){
+ // Bug exists in Safari where custom "invalid" handeling prevents draft from saving.
+ if( acf.get('browser') === 'safari' )
+ return;
+
// vars
var $inputs = $('.acf-field [name]', $el);
@@ -13492,6 +13656,7 @@
clearTimeout( this.timeout );
this.timeout = setTimeout(function(){
acf.doAction('refresh');
+ $(window).trigger('acfrefresh');
}, 0);
}
});
diff --git a/assets/js/acf-input.min.js b/assets/js/acf-input.min.js
index 81b2fe2..32e4b04 100644
--- a/assets/js/acf-input.min.js
+++ b/assets/js/acf-input.min.js
@@ -1,4 +1,4 @@
-!function(t,e){var i={};window.acf=i,i.data={},i.get=function(t){return this.data[t]||null},i.has=function(t){return null!==this.get(t)},i.set=function(t,e){return this.data[t]=e,this};var n=0;i.uniqueId=function(t){var e=++n+"";return t?t+e:e},i.uniqueArray=function(t){function e(t,e,i){return i.indexOf(t)===e}return t.filter(e)};var a="";i.uniqid=function(t,e){var i;void 0===t&&(t="");var n=function(t,e){return e<(t=parseInt(t,10).toString(16)).length?t.slice(t.length-e):e>t.length?Array(e-t.length+1).join("0")+t:t};return a||(a=Math.floor(123456789*Math.random())),a++,i=t,i+=n(parseInt((new Date).getTime()/1e3,10),8),i+=n(a,5),e&&(i+=(10*Math.random()).toFixed(8).toString()),i},i.strReplace=function(t,e,i){return i.split(t).join(e)},i.strCamelCase=function(t){return t=(t=t.replace(/[_-]/g," ")).replace(/(?:^\w|\b\w|\s+)/g,function(t,e){return 0==+t?"":0==e?t.toLowerCase():t.toUpperCase()})},i.strPascalCase=function(t){var e=i.strCamelCase(t);return e.charAt(0).toUpperCase()+e.slice(1)},i.strSlugify=function(t){return i.strReplace("_","-",t.toLowerCase())},i.strSanitize=function(t){var e={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","Æ":"AE","Ç":"C","È":"E","É":"E","Ê":"E","Ë":"E","Ì":"I","Í":"I","Î":"I","Ï":"I","Ð":"D","Ñ":"N","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","Ù":"U","Ú":"U","Û":"U","Ü":"U","Ý":"Y","ß":"s","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","æ":"ae","ç":"c","è":"e","é":"e","ê":"e","ë":"e","ì":"i","í":"i","î":"i","ï":"i","ñ":"n","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","ù":"u","ú":"u","û":"u","ü":"u","ý":"y","ÿ":"y","Ā":"A","ā":"a","Ă":"A","ă":"a","Ą":"A","ą":"a","Ć":"C","ć":"c","Ĉ":"C","ĉ":"c","Ċ":"C","ċ":"c","Č":"C","č":"c","Ď":"D","ď":"d","Đ":"D","đ":"d","Ē":"E","ē":"e","Ĕ":"E","ĕ":"e","Ė":"E","ė":"e","Ę":"E","ę":"e","Ě":"E","ě":"e","Ĝ":"G","ĝ":"g","Ğ":"G","ğ":"g","Ġ":"G","ġ":"g","Ģ":"G","ģ":"g","Ĥ":"H","ĥ":"h","Ħ":"H","ħ":"h","Ĩ":"I","ĩ":"i","Ī":"I","ī":"i","Ĭ":"I","ĭ":"i","Į":"I","į":"i","İ":"I","ı":"i","IJ":"IJ","ij":"ij","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","Ĺ":"L","ĺ":"l","Ļ":"L","ļ":"l","Ľ":"L","ľ":"l","Ŀ":"L","ŀ":"l","Ł":"l","ł":"l","Ń":"N","ń":"n","Ņ":"N","ņ":"n","Ň":"N","ň":"n","ʼn":"n","Ō":"O","ō":"o","Ŏ":"O","ŏ":"o","Ő":"O","ő":"o","Œ":"OE","œ":"oe","Ŕ":"R","ŕ":"r","Ŗ":"R","ŗ":"r","Ř":"R","ř":"r","Ś":"S","ś":"s","Ŝ":"S","ŝ":"s","Ş":"S","ş":"s","Š":"S","š":"s","Ţ":"T","ţ":"t","Ť":"T","ť":"t","Ŧ":"T","ŧ":"t","Ũ":"U","ũ":"u","Ū":"U","ū":"u","Ŭ":"U","ŭ":"u","Ů":"U","ů":"u","Ű":"U","ű":"u","Ų":"U","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","ź":"z","Ż":"Z","ż":"z","Ž":"Z","ž":"z","ſ":"s","ƒ":"f","Ơ":"O","ơ":"o","Ư":"U","ư":"u","Ǎ":"A","ǎ":"a","Ǐ":"I","ǐ":"i","Ǒ":"O","ǒ":"o","Ǔ":"U","ǔ":"u","Ǖ":"U","ǖ":"u","Ǘ":"U","ǘ":"u","Ǚ":"U","ǚ":"u","Ǜ":"U","ǜ":"u","Ǻ":"A","ǻ":"a","Ǽ":"AE","ǽ":"ae","Ǿ":"O","ǿ":"o"," ":"_","'":"","?":"","/":"","\\":"",".":"",",":"","`":"",">":"","<":"",'"':"","[":"","]":"","|":"","{":"","}":"","(":"",")":""},i=/\W/g,n=function(t){return void 0!==e[t]?e[t]:t};return t=(t=t.replace(i,n)).toLowerCase()},i.strMatch=function(t,e){for(var i=0,n=Math.min(t.length,e.length),a=0;a
"+this.get("text")+"
"),this.get("dismiss")&&(this.$el.append(''),this.$el.addClass("-dismiss"));var t=this.get("timeout");t&&this.away(t)},update:function(e){t.extend(this.data,e),this.initialize(),this.removeEvents(),this.addEvents()},show:function(){var t=this.get("target");t&&t.prepend(this.$el)},hide:function(){this.$el.remove()},away:function(t){this.setTimeout(function(){acf.remove(this.$el)},t)},type:function(t){var e=this.get("type");e&&this.$el.removeClass("-"+e),this.$el.addClass("-"+t),"error"==t&&this.$el.addClass("acf-error-message")},html:function(t){this.$el.html(t)},text:function(t){this.$("p").html(t)},onClickClose:function(t,e){t.preventDefault(),this.get("close").apply(this,arguments),this.remove()}});acf.newNotice=function(t){return"object"!=typeof t&&(t={text:t}),new i(t)};var n=new acf.Model({wait:"prepare",priority:1,initialize:function(){var e=t(".acf-admin-notice");e.length&&t("h1:first").after(e)}})}(jQuery),function(t,e){var i=new acf.Model({wait:"prepare",priority:1,initialize:function(){(acf.get("postboxes")||[]).map(acf.newPostbox)}});acf.getPostbox=function(e){return"string"==typeof e&&(e=t("#"+e)),acf.getInstance(e)},acf.getPostboxes=function(){return acf.getInstances(t(".acf-postbox"))},acf.newPostbox=function(t){return new acf.models.Postbox(t)},acf.models.Postbox=acf.Model.extend({data:{id:"",key:"",style:"default",label:"top",edit:""},setup:function(e){e.editLink&&(e.edit=e.editLink),t.extend(this.data,e),this.$el=this.$postbox()},$postbox:function(){return t("#"+this.get("id"))},$hide:function(){return t("#"+this.get("id")+"-hide")},$hideLabel:function(){return this.$hide().parent()},$hndle:function(){return this.$("> .hndle")},$inside:function(){return this.$("> .inside")},isVisible:function(){return this.$el.hasClass("acf-hidden")},initialize:function(){if(this.$el.addClass("acf-postbox"),this.$el.removeClass("hide-if-js"),"block"!==acf.get("editor")){var t=this.get("style");"default"!==t&&this.$el.addClass(t)}this.$inside().addClass("acf-fields").addClass("-"+this.get("label"));var e=this.get("edit");e&&this.$hndle().append(''),this.show()},show:function(){this.$hideLabel().show(),this.$hide().prop("checked",!0),this.$el.show().removeClass("acf-hidden")},enable:function(){acf.enable(this.$el,"postbox")},showEnable:function(){this.show(),this.enable()},hide:function(){this.$hideLabel().hide(),this.$el.hide().addClass("acf-hidden")},disable:function(){acf.disable(this.$el,"postbox")},hideDisable:function(){this.hide(),this.disable()},html:function(t){this.$inside().html(t),acf.doAction("append",this.$el)}})}(jQuery),function(t,e){acf.newTooltip=function(t){return"object"!=typeof t&&(t={text:t}),void 0!==t.confirmRemove?(t.textConfirm=acf.__("Remove"),t.textCancel=acf.__("Cancel"),new n(t)):void 0!==t.confirm?new n(t):new i(t)};var i=acf.Model.extend({data:{text:"",timeout:0,target:null},tmpl:function(){return''},setup:function(e){t.extend(this.data,e),this.$el=t(this.tmpl())},initialize:function(){this.render(),this.show(),this.position();var e=this.get("timeout");e&&setTimeout(t.proxy(this.fade,this),e)},update:function(e){t.extend(this.data,e),this.initialize()},render:function(){this.html(this.get("text"))},show:function(){t("body").append(this.$el)},hide:function(){this.$el.remove()},fade:function(){this.$el.addClass("acf-fade-up"),this.setTimeout(function(){this.remove()},250)},html:function(t){this.$el.html(t)},position:function(){var e=this.$el,i=this.get("target");if(i){e.removeClass("right left bottom top").css({top:0,left:0});var n=10,a=i.outerWidth(),r=i.outerHeight(),o=i.offset().top,s=i.offset().left,c=e.outerWidth(),l=e.outerHeight(),u=e.offset().top,d=o-l-u,f=s+a/2-c/2;f<10?(e.addClass("right"),f=s+a,d=o+r/2-l/2-u):f+c+10>t(window).width()?(e.addClass("left"),f=s-c,d=o+r/2-l/2-u):d-t(window).scrollTop()<10?(e.addClass("bottom"),d=o+r-u):e.addClass("top"),e.css({top:d,left:f})}}}),n=i.extend({data:{text:"",textConfirm:"",textCancel:"",target:null,targetConfirm:!0,confirm:function(){},cancel:function(){},context:!1},events:{'click [data-event="cancel"]':"onCancel",'click [data-event="confirm"]':"onConfirm"},addEvents:function(){acf.Model.prototype.addEvents.apply(this);var e=t(document),i=this.get("target");this.setTimeout(function(){this.on(e,"click","onCancel")}),this.get("targetConfirm")&&this.on(i,"click","onConfirm")},removeEvents:function(){acf.Model.prototype.removeEvents.apply(this);var e=t(document),i=this.get("target");this.off(e,"click"),this.off(i,"click")},render:function(){var t,e,i,n=[this.get("text")||acf.__("Are you sure?"),''+(this.get("textConfirm")||acf.__("Yes"))+"",''+(this.get("textCancel")||acf.__("No"))+""].join(" ");this.html(n),this.$el.addClass("-confirm")},onCancel:function(t,e){t.preventDefault(),t.stopImmediatePropagation();var i=this.get("cancel"),n=this.get("context")||this;i.apply(n,arguments),this.remove()},onConfirm:function(t,e){t.preventDefault(),t.stopImmediatePropagation();var i=this.get("confirm"),n=this.get("context")||this;i.apply(n,arguments),this.remove()}});acf.models.Tooltip=i,acf.models.TooltipConfirm=n;var a=new acf.Model({tooltip:!1,events:{"mouseenter .acf-js-tooltip":"showTitle","mouseup .acf-js-tooltip":"hideTitle","mouseleave .acf-js-tooltip":"hideTitle"},showTitle:function(t,e){var i=e.attr("title");i&&(e.attr("title",""),this.tooltip?this.tooltip.update({text:i,target:e}):this.tooltip=acf.newTooltip({text:i,target:e}))},hideTitle:function(t,e){this.tooltip.hide(),e.attr("title",this.tooltip.get("text"))}})}(jQuery),function(t,e){var i=[];acf.Field=acf.Model.extend({type:"",eventScope:".acf-field",wait:"ready",setup:function(t){this.$el=t,this.inherit(t),this.inherit(this.$control())},val:function(t){return void 0!==t?this.setValue(t):this.prop("disabled")?null:this.getValue()},getValue:function(){return this.$input().val()},setValue:function(t){return acf.val(this.$input(),t)},__:function(t){return acf._e(this.type,t)},$control:function(){return!1},$input:function(){return this.$("[name]:first")},$inputWrap:function(){return this.$(".acf-input:first")},$labelWrap:function(){return this.$(".acf-label:first")},getInputName:function(){return this.$input().attr("name")||""},parent:function(){var t=this.parents();return!!t.length&&t[0]},parents:function(){var t=this.$el.parents(".acf-field"),e;return acf.getFields(t)},show:function(t,e){var i=acf.show(this.$el,t);return i&&(this.prop("hidden",!1),acf.doAction("show_field",this,e)),i},hide:function(t,e){var i=acf.hide(this.$el,t);return i&&(this.prop("hidden",!0),acf.doAction("hide_field",this,e)),i},enable:function(t,e){var i=acf.enable(this.$el,t);return i&&(this.prop("disabled",!1),acf.doAction("enable_field",this,e)),i},disable:function(t,e){var i=acf.disable(this.$el,t);return i&&(this.prop("disabled",!0),acf.doAction("disable_field",this,e)),i},showEnable:function(t,e){return this.enable.apply(this,arguments),this.show.apply(this,arguments)},hideDisable:function(t,e){return this.disable.apply(this,arguments),this.hide.apply(this,arguments)},showNotice:function(t){"object"!=typeof t&&(t={text:t}),this.notice&&this.notice.remove(),t.target=this.$inputWrap(),this.notice=acf.newNotice(t)},removeNotice:function(t){this.notice&&(this.notice.away(t||0),this.notice=!1)},showError:function(e){this.$el.addClass("acf-error"),void 0!==e&&this.showNotice({text:e,type:"error",dismiss:!1}),acf.doAction("invalid_field",this),this.$el.one("focus change","input, select, textarea",t.proxy(this.removeError,this))},removeError:function(){this.$el.removeClass("acf-error"),this.removeNotice(250),acf.doAction("valid_field",this)},trigger:function(t,e,i){return"invalidField"==t&&(i=!0),acf.Model.prototype.trigger.apply(this,[t,e,i])}}),acf.newField=function(t){var e=t.data("type"),i=n(e),a,r=new(acf.models[i]||acf.Field)(t);return acf.doAction("new_field",r),r};var n=function(t){return acf.strPascalCase(t||"")+"Field"};acf.registerFieldType=function(t){var e,a=t.prototype.type,r=n(a);acf.models[r]=t,i.push(a)},acf.getFieldType=function(t){var e=n(t);return acf.models[e]||!1},acf.getFieldTypes=function(t){t=acf.parseArgs(t,{category:""});var e=[];return i.map(function(i){var n=acf.getFieldType(i),a=n.prototype;t.category&&a.category!==t.category||e.push(n)}),e}}(jQuery),function(t,e){acf.findFields=function(e){var i=".acf-field",n=!1;return(e=acf.parseArgs(e,{key:"",name:"",type:"",is:"",parent:!1,sibling:!1,limit:!1,visible:!1,suppressFilters:!1})).suppressFilters||(e=acf.applyFilters("find_fields_args",e)),e.key&&(i+='[data-key="'+e.key+'"]'),e.type&&(i+='[data-type="'+e.type+'"]'),e.name&&(i+='[data-name="'+e.name+'"]'),e.is&&(i+=e.is),e.visible&&(i+=":visible"),n=e.parent?e.parent.find(i):e.sibling?e.sibling.siblings(i):t(i),e.suppressFilters||(n=n.not(".acf-clone .acf-field"),n=acf.applyFilters("find_fields",n)),e.limit&&(n=n.slice(0,e.limit)),n},acf.findField=function(t,e){return acf.findFields({key:t,limit:1,parent:e,suppressFilters:!0})},acf.getField=function(t){t instanceof jQuery||(t=acf.findField(t));var e=t.data("acf");return e||(e=acf.newField(t)),e},acf.getFields=function(e){e instanceof jQuery||(e=acf.findFields(e));var i=[];return e.each(function(){var e=acf.getField(t(this));i.push(e)}),i},acf.findClosestField=function(t){return t.closest(".acf-field")},acf.getClosestField=function(t){var e=acf.findClosestField(t);return this.getField(e)};var i=function(t){var e=t,i=t+"_fields",a=t+"_field",r=function(t){var e=acf.arrayArgs(arguments),n=e.slice(1),a=acf.getFields({parent:t});if(a.length){var r=[i,a].concat(n);acf.doAction.apply(null,r)}},o=function(t){var e=acf.arrayArgs(arguments),i=e.slice(1);t.map(function(t,e){var n=[a,t].concat(i);acf.doAction.apply(null,n)})};acf.addAction(e,r),acf.addAction(i,o),n(t)},n=function(t){var e=t+"_field",i=t+"Field",n=function(n){var a=acf.arrayArgs(arguments),r=a.slice(1),s=["type","name","key"];s.map(function(t){var i="/"+t+"="+n.get(t);a=[e+i,n].concat(r),acf.doAction.apply(null,a)}),o.indexOf(t)>-1&&n.trigger(i,r)};acf.addAction(e,n)},a,r=["valid","invalid","enable","disable","new"],o=["remove","unmount","remount","sortstart","sortstop","show","hide","unload","valid","invalid","enable","disable"];["prepare","ready","load","append","remove","unmount","remount","sortstart","sortstop","show","hide","unload"].map(i),r.map(n);var s=new acf.Model({id:"fieldsEventManager",events:{'click .acf-field a[href="#"]':"onClick","change .acf-field":"onChange"},onClick:function(t){t.preventDefault()},onChange:function(){t("#_acf_changed").val(1)}})}(jQuery),function(t,e){var i=0,n=acf.Field.extend({type:"accordion",wait:"",$control:function(){return this.$(".acf-fields:first")},initialize:function(){if(!this.$el.is("td")){if(this.get("endpoint"))return this.remove();var e=this.$el,n=this.$labelWrap(),r=this.$inputWrap(),o=this.$control(),s=r.children(".description");if(s.length&&n.append(s),this.$el.is("tr")){var c=this.$el.closest("table"),l=t(''),u=t(''),d=t('"+this.get("text")+"
"),this.get("dismiss")&&(this.$el.append(''),this.$el.addClass("-dismiss"));var t=this.get("timeout");t&&this.away(t)},update:function(e){t.extend(this.data,e),this.initialize(),this.removeEvents(),this.addEvents()},show:function(){var t=this.get("target");t&&t.prepend(this.$el)},hide:function(){this.$el.remove()},away:function(t){this.setTimeout(function(){acf.remove(this.$el)},t)},type:function(t){var e=this.get("type");e&&this.$el.removeClass("-"+e),this.$el.addClass("-"+t),"error"==t&&this.$el.addClass("acf-error-message")},html:function(t){this.$el.html(t)},text:function(t){this.$("p").html(t)},onClickClose:function(t,e){t.preventDefault(),this.get("close").apply(this,arguments),this.remove()}});acf.newNotice=function(t){return"object"!=typeof t&&(t={text:t}),new i(t)};var n=new acf.Model({wait:"prepare",priority:1,initialize:function(){var e=t(".acf-admin-notice");e.length&&t("h1:first").after(e)}})}(jQuery),function(t,e){var i=new acf.Model({wait:"prepare",priority:1,initialize:function(){(acf.get("postboxes")||[]).map(acf.newPostbox)}});acf.getPostbox=function(e){return"string"==typeof e&&(e=t("#"+e)),acf.getInstance(e)},acf.getPostboxes=function(){return acf.getInstances(t(".acf-postbox"))},acf.newPostbox=function(t){return new acf.models.Postbox(t)},acf.models.Postbox=acf.Model.extend({data:{id:"",key:"",style:"default",label:"top",edit:""},setup:function(e){e.editLink&&(e.edit=e.editLink),t.extend(this.data,e),this.$el=this.$postbox()},$postbox:function(){return t("#"+this.get("id"))},$hide:function(){return t("#"+this.get("id")+"-hide")},$hideLabel:function(){return this.$hide().parent()},$hndle:function(){return this.$("> .hndle")},$inside:function(){return this.$("> .inside")},isVisible:function(){return this.$el.hasClass("acf-hidden")},initialize:function(){if(this.$el.addClass("acf-postbox"),this.$el.removeClass("hide-if-js"),"block"!==acf.get("editor")){var t=this.get("style");"default"!==t&&this.$el.addClass(t)}this.$inside().addClass("acf-fields").addClass("-"+this.get("label"));var e=this.get("edit");e&&this.$hndle().append(''),this.show()},show:function(){this.$hideLabel().show(),this.$hide().prop("checked",!0),this.$el.show().removeClass("acf-hidden")},enable:function(){acf.enable(this.$el,"postbox")},showEnable:function(){this.show(),this.enable()},hide:function(){this.$hideLabel().hide(),this.$el.hide().addClass("acf-hidden")},disable:function(){acf.disable(this.$el,"postbox")},hideDisable:function(){this.hide(),this.disable()},html:function(t){this.$inside().html(t),acf.doAction("append",this.$el)}})}(jQuery),function(t,e){acf.newTooltip=function(t){return"object"!=typeof t&&(t={text:t}),void 0!==t.confirmRemove?(t.textConfirm=acf.__("Remove"),t.textCancel=acf.__("Cancel"),new n(t)):void 0!==t.confirm?new n(t):new i(t)};var i=acf.Model.extend({data:{text:"",timeout:0,target:null},tmpl:function(){return''},setup:function(e){t.extend(this.data,e),this.$el=t(this.tmpl())},initialize:function(){this.render(),this.show(),this.position();var e=this.get("timeout");e&&setTimeout(t.proxy(this.fade,this),e)},update:function(e){t.extend(this.data,e),this.initialize()},render:function(){this.html(this.get("text"))},show:function(){t("body").append(this.$el)},hide:function(){this.$el.remove()},fade:function(){this.$el.addClass("acf-fade-up"),this.setTimeout(function(){this.remove()},250)},html:function(t){this.$el.html(t)},position:function(){var e=this.$el,i=this.get("target");if(i){e.removeClass("right left bottom top").css({top:0,left:0});var n=10,a=i.outerWidth(),r=i.outerHeight(),o=i.offset().top,s=i.offset().left,c=e.outerWidth(),l=e.outerHeight(),u=e.offset().top,d=o-l-u,f=s+a/2-c/2;f<10?(e.addClass("right"),f=s+a,d=o+r/2-l/2-u):f+c+10>t(window).width()?(e.addClass("left"),f=s-c,d=o+r/2-l/2-u):d-t(window).scrollTop()<10?(e.addClass("bottom"),d=o+r-u):e.addClass("top"),e.css({top:d,left:f})}}}),n=i.extend({data:{text:"",textConfirm:"",textCancel:"",target:null,targetConfirm:!0,confirm:function(){},cancel:function(){},context:!1},events:{'click [data-event="cancel"]':"onCancel",'click [data-event="confirm"]':"onConfirm"},addEvents:function(){acf.Model.prototype.addEvents.apply(this);var e=t(document),i=this.get("target");this.setTimeout(function(){this.on(e,"click","onCancel")}),this.get("targetConfirm")&&this.on(i,"click","onConfirm")},removeEvents:function(){acf.Model.prototype.removeEvents.apply(this);var e=t(document),i=this.get("target");this.off(e,"click"),this.off(i,"click")},render:function(){var t,e,i,n=[this.get("text")||acf.__("Are you sure?"),''+(this.get("textConfirm")||acf.__("Yes"))+"",''+(this.get("textCancel")||acf.__("No"))+""].join(" ");this.html(n),this.$el.addClass("-confirm")},onCancel:function(t,e){t.preventDefault(),t.stopImmediatePropagation();var i=this.get("cancel"),n=this.get("context")||this;i.apply(n,arguments),this.remove()},onConfirm:function(t,e){t.preventDefault(),t.stopImmediatePropagation();var i=this.get("confirm"),n=this.get("context")||this;i.apply(n,arguments),this.remove()}});acf.models.Tooltip=i,acf.models.TooltipConfirm=n;var a=new acf.Model({tooltip:!1,events:{"mouseenter .acf-js-tooltip":"showTitle","mouseup .acf-js-tooltip":"hideTitle","mouseleave .acf-js-tooltip":"hideTitle"},showTitle:function(t,e){var i=e.attr("title");i&&(e.attr("title",""),this.tooltip?this.tooltip.update({text:i,target:e}):this.tooltip=acf.newTooltip({text:i,target:e}))},hideTitle:function(t,e){this.tooltip.hide(),e.attr("title",this.tooltip.get("text"))}})}(jQuery),function(t,e){var i=[];acf.Field=acf.Model.extend({type:"",eventScope:".acf-field",wait:"ready",setup:function(t){this.$el=t,this.inherit(t),this.inherit(this.$control())},val:function(t){return void 0!==t?this.setValue(t):this.prop("disabled")?null:this.getValue()},getValue:function(){return this.$input().val()},setValue:function(t){return acf.val(this.$input(),t)},__:function(t){return acf._e(this.type,t)},$control:function(){return!1},$input:function(){return this.$("[name]:first")},$inputWrap:function(){return this.$(".acf-input:first")},$labelWrap:function(){return this.$(".acf-label:first")},getInputName:function(){return this.$input().attr("name")||""},parent:function(){var t=this.parents();return!!t.length&&t[0]},parents:function(){var t=this.$el.parents(".acf-field"),e;return acf.getFields(t)},show:function(t,e){var i=acf.show(this.$el,t);return i&&(this.prop("hidden",!1),acf.doAction("show_field",this,e)),i},hide:function(t,e){var i=acf.hide(this.$el,t);return i&&(this.prop("hidden",!0),acf.doAction("hide_field",this,e)),i},enable:function(t,e){var i=acf.enable(this.$el,t);return i&&(this.prop("disabled",!1),acf.doAction("enable_field",this,e)),i},disable:function(t,e){var i=acf.disable(this.$el,t);return i&&(this.prop("disabled",!0),acf.doAction("disable_field",this,e)),i},showEnable:function(t,e){return this.enable.apply(this,arguments),this.show.apply(this,arguments)},hideDisable:function(t,e){return this.disable.apply(this,arguments),this.hide.apply(this,arguments)},showNotice:function(t){"object"!=typeof t&&(t={text:t}),this.notice&&this.notice.remove(),t.target=this.$inputWrap(),this.notice=acf.newNotice(t)},removeNotice:function(t){this.notice&&(this.notice.away(t||0),this.notice=!1)},showError:function(e){this.$el.addClass("acf-error"),void 0!==e&&this.showNotice({text:e,type:"error",dismiss:!1}),acf.doAction("invalid_field",this),this.$el.one("focus change","input, select, textarea",t.proxy(this.removeError,this))},removeError:function(){this.$el.removeClass("acf-error"),this.removeNotice(250),acf.doAction("valid_field",this)},trigger:function(t,e,i){return"invalidField"==t&&(i=!0),acf.Model.prototype.trigger.apply(this,[t,e,i])}}),acf.newField=function(t){var e=t.data("type"),i=n(e),a,r=new(acf.models[i]||acf.Field)(t);return acf.doAction("new_field",r),r};var n=function(t){return acf.strPascalCase(t||"")+"Field"};acf.registerFieldType=function(t){var e,a=t.prototype.type,r=n(a);acf.models[r]=t,i.push(a)},acf.getFieldType=function(t){var e=n(t);return acf.models[e]||!1},acf.getFieldTypes=function(t){t=acf.parseArgs(t,{category:""});var e=[];return i.map(function(i){var n=acf.getFieldType(i),a=n.prototype;t.category&&a.category!==t.category||e.push(n)}),e}}(jQuery),function(t,e){acf.findFields=function(e){var i=".acf-field",n=!1;return(e=acf.parseArgs(e,{key:"",name:"",type:"",is:"",parent:!1,sibling:!1,limit:!1,visible:!1,suppressFilters:!1})).suppressFilters||(e=acf.applyFilters("find_fields_args",e)),e.key&&(i+='[data-key="'+e.key+'"]'),e.type&&(i+='[data-type="'+e.type+'"]'),e.name&&(i+='[data-name="'+e.name+'"]'),e.is&&(i+=e.is),e.visible&&(i+=":visible"),n=e.parent?e.parent.find(i):e.sibling?e.sibling.siblings(i):t(i),e.suppressFilters||(n=n.not(".acf-clone .acf-field"),n=acf.applyFilters("find_fields",n)),e.limit&&(n=n.slice(0,e.limit)),n},acf.findField=function(t,e){return acf.findFields({key:t,limit:1,parent:e,suppressFilters:!0})},acf.getField=function(t){t instanceof jQuery||(t=acf.findField(t));var e=t.data("acf");return e||(e=acf.newField(t)),e},acf.getFields=function(e){e instanceof jQuery||(e=acf.findFields(e));var i=[];return e.each(function(){var e=acf.getField(t(this));i.push(e)}),i},acf.findClosestField=function(t){return t.closest(".acf-field")},acf.getClosestField=function(t){var e=acf.findClosestField(t);return this.getField(e)};var i=function(t){var e=t,i=t+"_fields",a=t+"_field",r=function(t){var e=acf.arrayArgs(arguments),n=e.slice(1),a=acf.getFields({parent:t});if(a.length){var r=[i,a].concat(n);acf.doAction.apply(null,r)}},o=function(t){var e=acf.arrayArgs(arguments),i=e.slice(1);t.map(function(t,e){var n=[a,t].concat(i);acf.doAction.apply(null,n)})};acf.addAction(e,r),acf.addAction(i,o),n(t)},n=function(t){var e=t+"_field",i=t+"Field",n=function(n){var a=acf.arrayArgs(arguments),r=a.slice(1),s=["type","name","key"];s.map(function(t){var i="/"+t+"="+n.get(t);a=[e+i,n].concat(r),acf.doAction.apply(null,a)}),o.indexOf(t)>-1&&n.trigger(i,r)};acf.addAction(e,n)},a,r=["valid","invalid","enable","disable","new"],o=["remove","unmount","remount","sortstart","sortstop","show","hide","unload","valid","invalid","enable","disable"];["prepare","ready","load","append","remove","unmount","remount","sortstart","sortstop","show","hide","unload"].map(i),r.map(n);var s=new acf.Model({id:"fieldsEventManager",events:{'click .acf-field a[href="#"]':"onClick","change .acf-field":"onChange"},onClick:function(t){t.preventDefault()},onChange:function(){t("#_acf_changed").val(1)}})}(jQuery),function(t,e){var i=0,n=acf.Field.extend({type:"accordion",wait:"",$control:function(){return this.$(".acf-fields:first")},initialize:function(){if(!this.$el.is("td")){if(this.get("endpoint"))return this.remove() +;var e=this.$el,n=this.$labelWrap(),r=this.$inputWrap(),o=this.$control(),s=r.children(".description");if(s.length&&n.append(s),this.$el.is("tr")){var c=this.$el.closest("table"),l=t(''),u=t(''),d=t('

