Version Description
Download this release
Release Info
Developer | pross |
Plugin | WordPress Page Builder – Beaver Builder |
Version | 2.0.6.4 |
Comparing to | |
See all releases |
Code changes from version 2.0.6.3 to 2.0.6.4
- changelog.txt +17 -0
- classes/class-fl-builder-admin-settings.php +1 -3
- classes/class-fl-builder-debug.php +12 -1
- classes/class-fl-builder-loader.php +1 -1
- classes/class-fl-builder-model.php +1 -1
- classes/class-fl-builder.php +2 -2
- fl-builder.php +1 -1
- includes/admin-settings-tools.php +1 -1
- includes/compatibility.php +7 -0
- includes/row-css.php +1 -1
- includes/ui-field-dimension.php +4 -0
- includes/updater-config.php +1 -1
- js/fl-builder-preview.js +29 -0
- js/fl-builder.min.js +4 -4
- languages/bg_BG.mo +0 -0
- languages/cs_CZ.mo +0 -0
- languages/de_DE.mo +0 -0
- languages/en_GB.mo +0 -0
- languages/fa_IR.mo +0 -0
- languages/fi.mo +0 -0
- languages/he_IL.mo +0 -0
- languages/hu_HU.mo +0 -0
- languages/it_IT.mo +0 -0
- languages/nb_NO.mo +0 -0
- languages/nl_NL.mo +0 -0
- languages/pl_PL.mo +0 -0
- languages/pt_BR.mo +0 -0
- languages/pt_PT.mo +0 -0
- languages/sl_SI.mo +0 -0
- languages/sv_SE.mo +0 -0
changelog.txt
CHANGED
@@ -1,3 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<h4>2.0.6.3 - 03/19/2018</h4>
|
2 |
<p><strong>Hotfix</strong></p>
|
3 |
<ul>
|
1 |
+
<h4>2.0.6.4 - 03/27/2018</h4>
|
2 |
+
<p><strong>Enhancements</strong></p>
|
3 |
+
<ul>
|
4 |
+
<li>Added optional Terms and Conditions to Contact and Subcribe Modules to comply with GDPR.</li>
|
5 |
+
</ul>
|
6 |
+
<p><strong>Bug Fixes</strong></p>
|
7 |
+
<ul>
|
8 |
+
<li>When debug mode is enabled turn display_errors on to show any PHP errors.</li>
|
9 |
+
<li>Fixed PHP fatal error with Tasty Recipes plugin.</li>
|
10 |
+
<li>Fixed an issue with row background image connections.</li>
|
11 |
+
<li>Fixed PHP 7.2 issue when uploading icon sets.</li>
|
12 |
+
<li>Fixed a width issue on WooCommerce single post layouts.</li>
|
13 |
+
<li>Fixed hide-menu class not working in menu module.</li>
|
14 |
+
<li>Fixed assets not loading when using layout shortcode.</li>
|
15 |
+
<li>Fixed PHP warning when layout shortcode is included with a WP action.</li>
|
16 |
+
</ul>
|
17 |
+
|
18 |
<h4>2.0.6.3 - 03/19/2018</h4>
|
19 |
<p><strong>Hotfix</strong></p>
|
20 |
<ul>
|
classes/class-fl-builder-admin-settings.php
CHANGED
@@ -448,9 +448,7 @@ final class FLBuilderAdminSettings {
|
|
448 |
$path = get_attached_file( $id );
|
449 |
$new_path = $dir['path'] . 'icon-' . time() . '/';
|
450 |
|
451 |
-
|
452 |
-
fl_builder_filesystem()->get_filesystem();
|
453 |
-
}
|
454 |
|
455 |
$unzipped = unzip_file( $path, $new_path );
|
456 |
|
448 |
$path = get_attached_file( $id );
|
449 |
$new_path = $dir['path'] . 'icon-' . time() . '/';
|
450 |
|
451 |
+
fl_builder_filesystem()->get_filesystem();
|
|
|
|
|
452 |
|
453 |
$unzipped = unzip_file( $path, $new_path );
|
454 |
|
classes/class-fl-builder-debug.php
CHANGED
@@ -9,7 +9,18 @@ final class FL_Debug {
|
|
9 |
self::prepare_tests();
|
10 |
self::display_tests();
|
11 |
}
|
|
|
|
|
|
|
|
|
12 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
private static function display_tests() {
|
14 |
|
15 |
header( 'Content-Type:text/plain' );
|
@@ -370,4 +381,4 @@ final class FL_Debug {
|
|
370 |
self::register( 'server', $args );
|
371 |
}
|
372 |
}
|
373 |
-
add_action( '
|
9 |
self::prepare_tests();
|
10 |
self::display_tests();
|
11 |
}
|
12 |
+
|
13 |
+
if ( get_option( 'fl_debug_mode', false ) ) {
|
14 |
+
self::enable_logging();
|
15 |
+
}
|
16 |
}
|
17 |
+
|
18 |
+
public static function enable_logging() {
|
19 |
+
@ini_set( 'display_errors', 1 ); // @codingStandardsIgnoreLine
|
20 |
+
@ini_set( 'display_startup_errors', 1 ); // @codingStandardsIgnoreLine
|
21 |
+
@error_reporting( E_ALL ); // @codingStandardsIgnoreLine
|
22 |
+
}
|
23 |
+
|
24 |
private static function display_tests() {
|
25 |
|
26 |
header( 'Content-Type:text/plain' );
|
381 |
self::register( 'server', $args );
|
382 |
}
|
383 |
}
|
384 |
+
add_action( 'plugins_loaded', array( 'FL_Debug', 'init' ) );
|
classes/class-fl-builder-loader.php
CHANGED
@@ -46,7 +46,7 @@ if ( ! class_exists( 'FLBuilderLoader' ) ) {
|
|
46 |
* @return void
|
47 |
*/
|
48 |
static private function define_constants() {
|
49 |
-
define( 'FL_BUILDER_VERSION', '2.0.6.
|
50 |
define( 'FL_BUILDER_FILE', trailingslashit( dirname( dirname( __FILE__ ) ) ) . 'fl-builder.php' );
|
51 |
define( 'FL_BUILDER_DIR', plugin_dir_path( FL_BUILDER_FILE ) );
|
52 |
define( 'FL_BUILDER_URL', plugins_url( '/', FL_BUILDER_FILE ) );
|
46 |
* @return void
|
47 |
*/
|
48 |
static private function define_constants() {
|
49 |
+
define( 'FL_BUILDER_VERSION', '2.0.6.4' );
|
50 |
define( 'FL_BUILDER_FILE', trailingslashit( dirname( dirname( __FILE__ ) ) ) . 'fl-builder.php' );
|
51 |
define( 'FL_BUILDER_DIR', plugin_dir_path( FL_BUILDER_FILE ) );
|
52 |
define( 'FL_BUILDER_URL', plugins_url( '/', FL_BUILDER_FILE ) );
|
classes/class-fl-builder-model.php
CHANGED
@@ -2767,7 +2767,7 @@ final class FLBuilderModel {
|
|
2767 |
continue;
|
2768 |
}
|
2769 |
|
2770 |
-
$module = (object) $module;
|
2771 |
$module->kind = 'module';
|
2772 |
$module->isWidget = false; // @codingStandardsIgnoreLine
|
2773 |
$module->isAlias = false; // @codingStandardsIgnoreLine
|
2767 |
continue;
|
2768 |
}
|
2769 |
|
2770 |
+
$module = clone (object) $module;
|
2771 |
$module->kind = 'module';
|
2772 |
$module->isWidget = false; // @codingStandardsIgnoreLine
|
2773 |
$module->isAlias = false; // @codingStandardsIgnoreLine
|
classes/class-fl-builder.php
CHANGED
@@ -1350,8 +1350,8 @@ final class FLBuilder {
|
|
1350 |
// Enqueue styles and scripts for this post.
|
1351 |
self::enqueue_layout_styles_scripts_by_id( $query_post->ID );
|
1352 |
|
1353 |
-
// Print the styles
|
1354 |
-
if ( !
|
1355 |
wp_print_styles();
|
1356 |
}
|
1357 |
|
1350 |
// Enqueue styles and scripts for this post.
|
1351 |
self::enqueue_layout_styles_scripts_by_id( $query_post->ID );
|
1352 |
|
1353 |
+
// Print the styles if we are outside of the head tag.
|
1354 |
+
if ( ! doing_action( 'wp_enqueue_scripts' ) ) {
|
1355 |
wp_print_styles();
|
1356 |
}
|
1357 |
|
fl-builder.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Beaver Builder Plugin (Lite Version)
|
4 |
* Plugin URI: https://www.wpbeaverbuilder.com/?utm_medium=bb&utm_source=plugins-admin-page&utm_campaign=plugins-admin-uri
|
5 |
* Description: A drag and drop frontend WordPress page builder plugin that works with almost any theme!
|
6 |
-
* Version: 2.0.6.
|
7 |
* Author: The Beaver Builder Team
|
8 |
* Author URI: https://www.wpbeaverbuilder.com/?utm_medium=bb&utm_source=plugins-admin-page&utm_campaign=plugins-admin-author
|
9 |
* Copyright: (c) 2014 Beaver Builder
|
3 |
* Plugin Name: Beaver Builder Plugin (Lite Version)
|
4 |
* Plugin URI: https://www.wpbeaverbuilder.com/?utm_medium=bb&utm_source=plugins-admin-page&utm_campaign=plugins-admin-uri
|
5 |
* Description: A drag and drop frontend WordPress page builder plugin that works with almost any theme!
|
6 |
+
* Version: 2.0.6.4
|
7 |
* Author: The Beaver Builder Team
|
8 |
* Author URI: https://www.wpbeaverbuilder.com/?utm_medium=bb&utm_source=plugins-admin-page&utm_campaign=plugins-admin-author
|
9 |
* Copyright: (c) 2014 Beaver Builder
|
includes/admin-settings-tools.php
CHANGED
@@ -23,7 +23,7 @@
|
|
23 |
<?php $header = ( $debug ) ? __( 'Debug Mode Enabled', 'fl-builder' ) : __( 'Debug Mode Disabled', 'fl-builder' ); ?>
|
24 |
<h3 class="fl-settings-form-header"><?php echo $header ?></h3>
|
25 |
|
26 |
-
<form id="
|
27 |
<div class="fl-settings-form-content">
|
28 |
<?php if ( ! $debug ) : ?>
|
29 |
<p><?php _e( 'Enable debug mode to generate a unique support url.', 'fl-builder' ); ?></p>
|
23 |
<?php $header = ( $debug ) ? __( 'Debug Mode Enabled', 'fl-builder' ) : __( 'Debug Mode Disabled', 'fl-builder' ); ?>
|
24 |
<h3 class="fl-settings-form-header"><?php echo $header ?></h3>
|
25 |
|
26 |
+
<form id="debug-form" action="<?php FLBuilderAdminSettings::render_form_action( 'tools' ); ?>" method="post">
|
27 |
<div class="fl-settings-form-content">
|
28 |
<?php if ( ! $debug ) : ?>
|
29 |
<p><?php _e( 'Enable debug mode to generate a unique support url.', 'fl-builder' ); ?></p>
|
includes/compatibility.php
CHANGED
@@ -323,3 +323,10 @@ function fl_fix_nextgen_gallery() {
|
|
323 |
define( 'NGG_DISABLE_RESOURCE_MANAGER', true );
|
324 |
}
|
325 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
323 |
define( 'NGG_DISABLE_RESOURCE_MANAGER', true );
|
324 |
}
|
325 |
}
|
326 |
+
add_action( 'template_redirect', 'fl_fix_tasty_recipes' );
|
327 |
+
function fl_fix_tasty_recipes() {
|
328 |
+
if ( FLBuilderModel::is_builder_active() ) {
|
329 |
+
remove_action( 'wp_enqueue_editor', array( 'Tasty_Recipes\Assets', 'action_wp_enqueue_editor' ) );
|
330 |
+
remove_action( 'media_buttons', array( 'Tasty_Recipes\Editor', 'action_media_buttons' ) );
|
331 |
+
}
|
332 |
+
}
|
includes/row-css.php
CHANGED
@@ -66,7 +66,7 @@
|
|
66 |
}
|
67 |
<?php endif; ?>
|
68 |
|
69 |
-
<?php if ( 'photo' == $row->settings->bg_type && ! empty( $row->settings->
|
70 |
.fl-node-<?php echo $row->node; ?> > .fl-row-content-wrap {
|
71 |
background-image: url(<?php echo $row->settings->bg_image_src; ?>);
|
72 |
background-repeat: <?php echo $row->settings->bg_repeat; ?>;
|
66 |
}
|
67 |
<?php endif; ?>
|
68 |
|
69 |
+
<?php if ( 'photo' == $row->settings->bg_type && ! empty( $row->settings->bg_image_src ) ) : // Background Photo ?>
|
70 |
.fl-node-<?php echo $row->node; ?> > .fl-row-content-wrap {
|
71 |
background-image: url(<?php echo $row->settings->bg_image_src; ?>);
|
72 |
background-repeat: <?php echo $row->settings->bg_repeat; ?>;
|
includes/ui-field-dimension.php
CHANGED
@@ -26,6 +26,7 @@ var responsive = data.name.replace( data.rootName, '' );
|
|
26 |
name="{{data.rootName}}_top{{responsive}}"
|
27 |
value="{{data.settings[ data.rootName + '_top' + responsive ]}}"
|
28 |
placeholder="{{placeholder.top}}"
|
|
|
29 |
/>
|
30 |
<label><?php _e( 'Top', 'fl-builder' ); ?></label>
|
31 |
</div>
|
@@ -35,6 +36,7 @@ var responsive = data.name.replace( data.rootName, '' );
|
|
35 |
name="{{data.rootName}}_right{{responsive}}"
|
36 |
value="{{data.settings[ data.rootName + '_right' + responsive ]}}"
|
37 |
placeholder="{{placeholder.right}}"
|
|
|
38 |
/>
|
39 |
<label><?php _e( 'Right', 'fl-builder' ); ?></label>
|
40 |
</div>
|
@@ -44,6 +46,7 @@ var responsive = data.name.replace( data.rootName, '' );
|
|
44 |
name="{{data.rootName}}_bottom{{responsive}}"
|
45 |
value="{{data.settings[ data.rootName + '_bottom' + responsive ]}}"
|
46 |
placeholder="{{placeholder.bottom}}"
|
|
|
47 |
/>
|
48 |
<label><?php _e( 'Bottom', 'fl-builder' ); ?></label>
|
49 |
</div>
|
@@ -53,6 +56,7 @@ var responsive = data.name.replace( data.rootName, '' );
|
|
53 |
name="{{data.rootName}}_left{{responsive}}"
|
54 |
value="{{data.settings[ data.rootName + '_left' + responsive ]}}"
|
55 |
placeholder="{{placeholder.left}}"
|
|
|
56 |
/>
|
57 |
<label><?php _e( 'Left', 'fl-builder' ); ?></label>
|
58 |
</div>
|
26 |
name="{{data.rootName}}_top{{responsive}}"
|
27 |
value="{{data.settings[ data.rootName + '_top' + responsive ]}}"
|
28 |
placeholder="{{placeholder.top}}"
|
29 |
+
data-unit="top"
|
30 |
/>
|
31 |
<label><?php _e( 'Top', 'fl-builder' ); ?></label>
|
32 |
</div>
|
36 |
name="{{data.rootName}}_right{{responsive}}"
|
37 |
value="{{data.settings[ data.rootName + '_right' + responsive ]}}"
|
38 |
placeholder="{{placeholder.right}}"
|
39 |
+
data-unit="right"
|
40 |
/>
|
41 |
<label><?php _e( 'Right', 'fl-builder' ); ?></label>
|
42 |
</div>
|
46 |
name="{{data.rootName}}_bottom{{responsive}}"
|
47 |
value="{{data.settings[ data.rootName + '_bottom' + responsive ]}}"
|
48 |
placeholder="{{placeholder.bottom}}"
|
49 |
+
data-unit="bottom"
|
50 |
/>
|
51 |
<label><?php _e( 'Bottom', 'fl-builder' ); ?></label>
|
52 |
</div>
|
56 |
name="{{data.rootName}}_left{{responsive}}"
|
57 |
value="{{data.settings[ data.rootName + '_left' + responsive ]}}"
|
58 |
placeholder="{{placeholder.left}}"
|
59 |
+
data-unit="left"
|
60 |
/>
|
61 |
<label><?php _e( 'Left', 'fl-builder' ); ?></label>
|
62 |
</div>
|
includes/updater-config.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
if ( class_exists( 'FLUpdater' ) ) {
|
4 |
FLUpdater::add_product(array(
|
5 |
'name' => 'Beaver Builder Plugin (Lite Version)',
|
6 |
-
'version' => '2.0.6.
|
7 |
'slug' => 'bb-plugin',
|
8 |
'type' => 'plugin',
|
9 |
));
|
3 |
if ( class_exists( 'FLUpdater' ) ) {
|
4 |
FLUpdater::add_product(array(
|
5 |
'name' => 'Beaver Builder Plugin (Lite Version)',
|
6 |
+
'version' => '2.0.6.4',
|
7 |
'slug' => 'bb-plugin',
|
8 |
'type' => 'plugin',
|
9 |
));
|
js/fl-builder-preview.js
CHANGED
@@ -1838,6 +1838,7 @@
|
|
1838 |
break;
|
1839 |
|
1840 |
case 'unit':
|
|
|
1841 |
field.find('input[type=number]').on('keyup', callback);
|
1842 |
break;
|
1843 |
|
@@ -2149,6 +2150,10 @@
|
|
2149 |
field.find( 'input[type=number]' ).on( 'keyup', $.proxy( this._previewCSS, this, preview ) );
|
2150 |
break;
|
2151 |
|
|
|
|
|
|
|
|
|
2152 |
case 'select':
|
2153 |
field.find( 'select' ).on( 'change', $.proxy( this._previewCSS, this, preview ) );
|
2154 |
break;
|
@@ -2191,6 +2196,30 @@
|
|
2191 |
}
|
2192 |
},
|
2193 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2194 |
/**
|
2195 |
* Updates the CSS rule for a color preview.
|
2196 |
*
|
1838 |
break;
|
1839 |
|
1840 |
case 'unit':
|
1841 |
+
case 'dimension':
|
1842 |
field.find('input[type=number]').on('keyup', callback);
|
1843 |
break;
|
1844 |
|
2150 |
field.find( 'input[type=number]' ).on( 'keyup', $.proxy( this._previewCSS, this, preview ) );
|
2151 |
break;
|
2152 |
|
2153 |
+
case 'dimension':
|
2154 |
+
field.find( 'input[type=number]' ).on( 'keyup', $.proxy( this._previewDimensionCSS, this, preview ) );
|
2155 |
+
break;
|
2156 |
+
|
2157 |
case 'select':
|
2158 |
field.find( 'select' ).on( 'change', $.proxy( this._previewCSS, this, preview ) );
|
2159 |
break;
|
2196 |
}
|
2197 |
},
|
2198 |
|
2199 |
+
/**
|
2200 |
+
* Updates the CSS rule for a dimension field preview.
|
2201 |
+
*
|
2202 |
+
* @since 2.0.7
|
2203 |
+
* @access private
|
2204 |
+
* @method _previewDimensionCSS
|
2205 |
+
* @param {Object} preview A preview object.
|
2206 |
+
* @param {Object} e An event object.
|
2207 |
+
*/
|
2208 |
+
_previewDimensionCSS: function( preview, e )
|
2209 |
+
{
|
2210 |
+
var dimensionPreview = $.extend( {}, preview ),
|
2211 |
+
property = dimensionPreview.property,
|
2212 |
+
unit = $( e.target ).data( 'unit' );
|
2213 |
+
|
2214 |
+
if ( 'border-width' === property ) {
|
2215 |
+
dimensionPreview.property = 'border-' + unit + '-width';
|
2216 |
+
} else {
|
2217 |
+
dimensionPreview.property = property + '-' + unit;
|
2218 |
+
}
|
2219 |
+
|
2220 |
+
this._previewCSS( dimensionPreview, e );
|
2221 |
+
},
|
2222 |
+
|
2223 |
/**
|
2224 |
* Updates the CSS rule for a color preview.
|
2225 |
*
|
js/fl-builder.min.js
CHANGED
@@ -3,7 +3,7 @@ action:"render_icon_selector"},FLIconSelector._getContentComplete)):FLIconSelect
|
|
3 |
FLBuilder._initSortables()))},_updateNode:function(t,i){e(".fl-node-"+t).length&&(FLBuilder._showNodeLoading(t),FLBuilder.ajax({action:"render_node",node_id:t},function(e){FLBuilder._renderLayout(JSON.parse(e),i)}.bind(this)))},_updateLayout:function(){FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"render_layout"},FLBuilder._renderLayout)},_renderLayout:function(e,t){FLBuilder._layout=new FLBuilderAJAXLayout(e,t)},_renderLayoutComplete:function(){FLBuilder._layout&&(FLBuilder._layout._complete(),FLBuilder._layout=null)},_resizeLayout:function(){e(window).trigger("resize"),"undefined"!=typeof YUI&&YUI().use("node-event-simulate",function(e){e.one(window).simulate("resize")})},layoutHasContent:function(){return e(FLBuilder._contentClass).children(".fl-row").length>0},_initMediaElements:function(){var t={};"undefined"!=typeof e.fn.mediaelementplayer&&("undefined"!=typeof _wpmejsSettings&&(t.pluginPath=_wpmejsSettings.pluginPath),e(".wp-audio-shortcode, .wp-video-shortcode").not(".mejs-container").mediaelementplayer(t))},_initDropTargets:function(){var t="row"==FLBuilderConfig.userTemplateType?"":":not(.fl-node-global)",i=e(FLBuilder._contentClass+" .fl-row"),l=null,s=e(FLBuilder._contentClass+" .fl-row"+t).find(".fl-col-group"),o=null,n=null,r=0;for(e(".fl-col-drop-target").remove(),e(".fl-col-group-drop-target").remove(),e(".fl-row-drop-target").remove(),e(FLBuilder._contentClass).append('<div class="fl-drop-target fl-row-drop-target"></div>'),i.prepend('<div class="fl-drop-target fl-row-drop-target"></div>'),i.append('<div class="fl-drop-target fl-drop-target-last fl-row-drop-target fl-row-drop-target-last"></div>');r<i.length;r++)l=i.eq(r),0===l.find(".fl-col-group").length&&l.find(".fl-row-content").prepend('<div class="fl-drop-target fl-col-group-drop-target"></div>');for(r=0;r<s.length;r++)o=s.eq(r),n=o.find("> .fl-col"),o.hasClass("fl-col-group-nested")||(o.append('<div class="fl-drop-target fl-col-group-drop-target"></div>'),o.append('<div class="fl-drop-target fl-drop-target-last fl-col-group-drop-target fl-col-group-drop-target-last"></div>')),n.append('<div class="fl-drop-target fl-col-drop-target"></div>'),n.append('<div class="fl-drop-target fl-drop-target-last fl-col-drop-target fl-col-drop-target-last"></div>')},_blockDragHelper:function(e,t){var i=t.clone();return t.clone().insertAfter(t),i.addClass("fl-builder-block-drag-helper"),i},_blockDragInit:function(t){var i=e(t.currentTarget),l=null,s=e(window).scrollTop(),o=0;FLBuilder._dragEnabled=!0,FLBuilder._dragInitialScrollTop=s,i.closest("[data-node]").length>0?(l=i.closest("[data-node]"),l.addClass("fl-node-drag-init")):i.hasClass("fl-builder-block")&&e(".fl-row").each(function(){null===l&&e(this).offset().top-s>0&&(l=e(this))}),null!==l&&(o=l.offset().top-s),FLBuilder._highlightRowsAndColsForDrag(i),FLBuilder._adjustColHeightsForDrag(),FLBuilder._disableGlobalRows(),FLBuilder._destroyOverlayEvents(),FLBuilder._removeAllOverlays(),FLBuilder._initSortables(),e("body").addClass("fl-builder-dragging"),e(".fl-builder-empty-message").hide(),e(".fl-sortable-disabled").removeClass("fl-sortable-disabled"),o>0&&scrollTo(0,l.offset().top-o),FLBuilder.triggerHook("didInitDrag")},_blockDragStart:function(t,i){FLBuilder._dragging=!0,e(".fl-node-drag-init").removeClass("fl-node-drag-init"),FLBuilder.triggerHook("didStartDrag")},_blockDragSort:function(t,i){var l=i.placeholder.parent(),s=FLBuilderStrings.insert;FLBuilder._blockPreventSort(i.item,l)||(l.hasClass("fl-col-content")?s=i.item.hasClass("fl-builder-block-row")?i.item.find(".fl-builder-block-title").text():i.item.hasClass("fl-col-sortable-proxy-item")?FLBuilderStrings.column:i.item.hasClass("fl-builder-block-module")?i.item.find(".fl-builder-block-title").text():i.item.hasClass("fl-builder-block-saved-module")||i.item.hasClass("fl-builder-block-module-template")?i.item.find(".fl-builder-block-title").text():i.item.attr("data-name"):l.hasClass("fl-col-drop-target")?s="":l.hasClass("fl-col-group-drop-target")?s="":l.hasClass("fl-row-drop-target")&&(s=i.item.hasClass("fl-builder-block-row")?i.item.find(".fl-builder-block-title").text():i.item.hasClass("fl-builder-block-saved-row")?i.item.find(".fl-builder-block-title").text():i.item.hasClass("fl-row-sortable-proxy-item")?FLBuilderStrings.row:FLBuilderStrings.newRow),i.placeholder.html(s),i.item.hasClass("fl-node-global")||i.item.hasClass("fl-builder-block-global")||e(".fl-node-dragging").hasClass("fl-node-global")?i.placeholder.addClass("fl-builder-drop-zone-global"):i.placeholder.removeClass("fl-builder-drop-zone-global"))},_blockDragChange:function(e,t){t.placeholder.css("opacity","0"),t.placeholder.animate({opacity:"1"},100)},_blockPreventSort:function(t,i){var l=!1,s=t.hasClass("fl-builder-block-row"),o=t.hasClass("fl-col-sortable-proxy-item"),n=i.hasClass("fl-col-content"),r=i.hasClass("fl-col-drop-target"),a=i.parents(".fl-col-group:not(.fl-col-group-nested)"),d=i.parents(".fl-col-group-nested");return(s||o)&&n&&d.length>0&&(l=!0),n&&!i.find(".fl-module, .fl-col").length&&(s&&"1-col"==t.data("cols")?l=!0:o&&(l=!0)),s&&n&&e.inArray(t.data("cols"),["5-cols","6-cols"])>-1&&(l=!0),o&&e(".fl-node-dragging").find(".fl-col-group-nested").length>0&&(n||r&&d.length>0)&&(l=!0),r&&a.length>0&&0===d.length&&a.find("> .fl-col:visible").length>11&&(l=!0),r&&d.length>0&&d.find(".fl-col:visible").length>3&&(l=!0),l&&i.addClass("fl-sortable-disabled"),l},_blockDragStop:function(t,i){var l=e(window).scrollTop(),s=i.item.parent(),o=null;s.hasClass("fl-drop-target")&&s.closest("[data-node]").length?(s=s.closest("[data-node]"),o=s.offset().top-l):o=s.offset().top-l,s.hasClass("fl-builder-blocks-section-content")&&FLBuilder._showPanel(),FLBuilder._dragEnabled=!1,FLBuilder._dragging=!1,FLBuilder._bindOverlayEvents(),FLBuilder._highlightEmptyCols(),FLBuilder._enableGlobalRows(),FLBuilder._setupEmptyLayout(),e("body").removeClass("fl-builder-dragging"),scrollTo(0,s.offset().top-o),FLBuilder.triggerHook("didStopDrag")},_blockDragCancel:function(){FLBuilder._dragEnabled&&!FLBuilder._dragging&&(FLBuilder._dragEnabled=!1,FLBuilder._dragging=!1,FLBuilder._bindOverlayEvents(),FLBuilder._highlightEmptyCols(),FLBuilder._enableGlobalRows(),FLBuilder._setupEmptyLayout(),e("body").removeClass("fl-builder-dragging"),e(".fl-node-drag-init").removeClass("fl-node-drag-init"),e(".fl-node-dragging").removeClass("fl-node-dragging"),scrollTo(0,FLBuilder._dragInitialScrollTop))},_reorderNode:function(e,t){FLBuilder.ajax({action:"reorder_node",node_id:e,position:t})},_moveNode:function(e,t,i){FLBuilder.ajax({action:"move_node",new_parent:e,node_id:t,position:i})},_removeAllOverlays:function(){FLBuilder._removeRowOverlays(),FLBuilder._removeColOverlays(),FLBuilder._removeColHighlightGuides(),FLBuilder._removeModuleOverlays(),FLBuilder._hideTipTips(),FLBuilder._closeAllSubmenus()},_appendOverlay:function(e,t){var i=0,l=null,s=e.hasClass("fl-row"),o=s?e.find("> .fl-row-content-wrap"):e.find("> .fl-node-content"),n={top:parseInt(o.css("margin-top"),10),bottom:parseInt(o.css("margin-bottom"),10)};return e.append(t),e.addClass("fl-block-overlay-active"),FLBuilder._initTipTips(),l=e.find("> .fl-block-overlay"),n.top<0&&(i=parseInt(l.css("top"),10),i=isNaN(i)?0:i,l.css("top",n.top+i+"px")),n.bottom<0&&(i=parseInt(l.css("bottom"),10),i=isNaN(i)?0:i,l.css("bottom",n.bottom+i+"px")),l},_buildOverlayOverflowMenu:function(e){var t=e.find(".fl-block-overlay-actions"),i=t.data("original"),l=0,s=null,o=0,n=null,r=0,a=[],d=[],u=[],c=wp.template("fl-overlay-overflow-menu");for(void 0!=i&&(t.after(i),t.remove(),t=i),t.data("original",t.clone()),l=Math.floor(t[0].getBoundingClientRect().width)-8,s=t.find(" > i, > span.fl-builder-has-submenu");r<s.length;r++)n=s.eq(r),o+=Math.floor(n[0].getBoundingClientRect().width),o>l?(d.push(n),n.remove()):a.push(n);if(d.length>0){for(d.unshift(a.pop().remove()),r=0;r<d.length;r++)d[r].is(".fl-builder-has-submenu")?u.push({type:"submenu",label:d[r].find(".fa").data("title"),submenu:d[r].find(".fl-builder-submenu")[0].outerHTML}):u.push({type:"action",label:d[r].data("title"),className:d[r].removeClass(function(e,t){return t.replace(/fl-block-([^\s]+)/,"")}).attr("class")});t.append(c(u)),FLBuilder._initTipTips()}},_removeRowOverlays:function(){e(".fl-row").removeClass("fl-block-overlay-active"),e(".fl-row-overlay").remove(),e(".fl-module").removeClass("fl-module-adjust-height"),e("body").removeClass("fl-builder-row-resizing"),FLBuilder._closeAllSubmenus()},_disableGlobalRows:function(){"row"!=FLBuilderConfig.userTemplateType&&e(".fl-row.fl-node-global").addClass("fl-node-disabled")},_enableGlobalRows:function(){"row"!=FLBuilderConfig.userTemplateType&&e(".fl-node-disabled").removeClass("fl-node-disabled")},_rowMouseenter:function(){var t=e(this),i=t.offset().top,l=null,s=null,o=wp.template("fl-row-overlay");t.closest(".fl-builder-node-loading").length||t.hasClass("fl-block-overlay-active")||(s=FLBuilder._appendOverlay(t,o({global:t.hasClass("fl-node-global"),node:t.attr("data-node")})),t.find(".fl-node-content:visible").each(function(){var t=e(this).offset().top;l=null===l||l>t?t:l}),null!==l&&l<i&&s.css("top",l-i-30+"px"),s.offset().top<43&&s.addClass("fl-row-overlay-header-bottom"),t.find(".fl-module").each(function(){var t=e(this);t.outerHeight(!0)<20&&t.addClass("fl-module-adjust-height")}),FLBuilder._buildOverlayOverflowMenu(s))},_rowMouseleave:function(t){var i=e(t.toElement)||e(t.relatedTarget),l=i.hasClass("fl-row-overlay"),s=i.closest(".fl-row-overlay").length>0,o=i.is("#tiptip_holder"),n=i.closest("#tiptip_holder").length>0;l||s||o||n||FLBuilder._removeRowOverlays()},_rowDragHelper:function(){return e('<div class="fl-builder-block-drag-helper">'+FLBuilderStrings.row+"</div>")},_rowDragInit:function(t){var i=e(t.target),l=e(".fl-row-sortable-proxy-item"),s=i.closest(".fl-row");s.addClass("fl-node-dragging"),FLBuilder._blockDragInit(t),t.target=l[0],l.trigger(t)},_rowDragStart:function(t,i){var l=e(FLBuilder._contentClass+" .fl-row"),s=e(".fl-node-dragging");1===l.length&&e(FLBuilder._contentClass).addClass("fl-builder-empty"),s.hide(),FLBuilder._blockDragStart(t,i)},_rowDragStop:function(t,i){var l=i.item,s=l.parent(),o=null,n=null,r=0;if(FLBuilder._blockDragStop(t,i),s.hasClass("fl-builder-rows"))return void l.remove();if(s.hasClass("fl-row-sortable-proxy"))return void e(".fl-node-dragging").removeClass("fl-node-dragging").show();if(l.hasClass("fl-builder-block")){if(s.hasClass("fl-sortable-disabled"))return l.remove(),void FLBuilder._showPanel();s.hasClass("fl-col-content")?FLBuilder._addColGroup(l.closest(".fl-col").attr("data-node"),l.attr("data-cols"),s.find("> .fl-module, .fl-col-group, .fl-builder-block").index(l)):s.hasClass("fl-col-drop-target")?FLBuilder._addCols(s.closest(".fl-col"),s.hasClass("fl-col-drop-target-last")?"after":"before",l.attr("data-cols"),s.closest(".fl-col-group-nested").length>0):s.hasClass("fl-col-group-drop-target")?(n=l.closest(".fl-col-group"),r=l.closest(".fl-row").find(".fl-row-content > .fl-col-group").index(n),FLBuilder._addColGroup(l.closest(".fl-row").attr("data-node"),l.attr("data-cols"),s.hasClass("fl-drop-target-last")?r+1:r)):(o=l.closest(".fl-row"),r=o.length?e(FLBuilder._contentClass+" .fl-row").index(o):0,FLBuilder._addRow(l.attr("data-cols"),s.hasClass("fl-drop-target-last")?r+1:r)),l.remove(),FLBuilder._showPanel(),e(".fl-builder-modules").siblings(".fl-builder-blocks-section-title").eq(0).trigger("click")}else o=e(".fl-node-dragging").removeClass("fl-node-dragging").show(),s.parent().hasClass("fl-builder-content")||(s.hasClass("fl-drop-target-last")?s.parent().after(o):s.parent().before(o),FLBuilder._reorderNode(o.attr("data-node"),o.index())),e(".fl-row-sortable-proxy").append(i.item)},_addRow:function(t,i){FLBuilder._showNodeLoadingPlaceholder(e(FLBuilder._contentClass),i),FLBuilder._newRowPosition=i,FLBuilder.ajax({action:"render_new_row",cols:t,position:i},FLBuilder._addRowComplete)},_addRowComplete:function(t){var i="object"==typeof t?t:JSON.parse(t),l=e(FLBuilder._contentClass),s=e(i.html).data("node"),o=FLBuilder._addModuleAfterNodeRender;i.nodeParent=l,i.nodePosition=FLBuilder._newRowPosition,FLBuilder._renderLayout(i,function(){null!==o&&(e(".fl-node-"+s+" .fl-col-content").append(o),FLBuilder._reorderModule(o),FLBuilder._addModuleAfterNodeRender=null),FLBuilder._removeNodeLoadingPlaceholder(e(".fl-node-"+s)),FLBuilder.triggerHook("didAddRow",s)})},_deleteRowClicked:function(t){var i=e(this).closest(".fl-row"),l=null;i.find(".fl-module").length?(l=confirm(FLBuilderStrings.deleteRowMessage),l&&FLBuilder._deleteRow(i)):FLBuilder._deleteRow(i),FLBuilder._removeAllOverlays(),t.stopPropagation()},_deleteRow:function(e){var t=e.attr("data-node");FLBuilder.ajax({action:"delete_node",node_id:t}),e.empty(),e.remove(),FLBuilder._setupEmptyLayout(),FLBuilder._removeRowOverlays(),FLBuilder.triggerHook("didDeleteRow",t)},_rowCopyClicked:function(t){var i=e(this).closest(".fl-row"),l=i.attr("data-node"),s=e(FLBuilder._contentClass+" .fl-row").index(i)+1,o=i.clone(),n=e(".fl-builder-settings[data-node]"),r=n.attr("data-node"),a=r===l?i:i.find('[data-node="'+r+'"]'),d=null;n.length&&a.length&&(d=FLBuilder._getSettings(n),FLBuilderSettingsConfig.nodes[r]=d),o.addClass("fl-node-"+l+"-clone fl-builder-node-clone"),o.find(".fl-block-overlay").remove(),i.after(o),e("html, body").animate({scrollTop:o.offset().top-75},500),FLBuilder._showNodeLoading(l+"-clone"),FLBuilder._newRowPosition=s,FLBuilder.ajax({action:"copy_row",node_id:l,settings:d,settings_id:r},function(e){var t=JSON.parse(e);t.duplicatedRow=l,FLBuilder._rowCopyComplete(t)}),t.stopPropagation()},_rowCopyComplete:function(t){t.nodeParent=e(FLBuilder._contentClass),t.nodePosition=FLBuilder._newRowPosition,FLBuilder._renderLayout(t,function(){FLBuilder.triggerHook("didDuplicateRow",{newNodeId:t.nodeId,oldNodeId:t.duplicatedRow}),t.nodeParent.find(".fl-builder-node-loading").eq(0).remove()})},_rowSettingsClicked:function(t){var i=e(this),l=i.closest(".fl-row").attr("data-node"),s=i.closest(".fl-block-overlay-global").length>0,o=null;s&&"row"!=FLBuilderConfig.userTemplateType?FLBuilderConfig.userCanEditGlobalTemplates&&(o=window.open(e('.fl-row[data-node="'+l+'"]').attr("data-template-url")),o.FLBuilderGlobalNodeId=l):i.hasClass("fl-block-settings")&&FLBuilderSettingsForms.render({id:"row",nodeId:l,className:"fl-builder-row-settings",attrs:'data-node="'+l+'"',buttons:s||FLBuilderConfig.lite||FLBuilderConfig.simpleUi?[]:["save-as"],badges:s?[FLBuilderStrings.global]:[],settings:FLBuilderSettingsConfig.nodes[l],preview:{type:"row"}},function(){e("#fl-field-width select").on("change",FLBuilder._rowWidthChanged),e("#fl-field-content_width select").on("change",FLBuilder._rowWidthChanged)}),t.stopPropagation()},_rowWidthChanged:function(){var t=e("#fl-field-width select").val(),i=e("#fl-field-content_width select").val(),l=e("#fl-field-max_content_width");"fixed"==t||"full"==t&&"fixed"==i?l.show():l.hide()},_resetRowWidthClicked:function(t){var i=e(this),l=i.closest(".fl-row"),s=l.attr("data-node"),o=l.find(".fl-row-content"),n=FLBuilderConfig.global.row_width+"px",r=e(".fl-builder-row-settings");l.hasClass("fl-row-fixed-width")&&l.css("max-width",n),o.css("max-width",n),r.length&&r.find("[name=max_content_width]").val(""),FLBuilder.ajax({action:"resize_row_content",node:s,width:""}),FLBuilder._closeAllSubmenus(),FLBuilder.triggerHook("didResetRowWidth",s),t.stopPropagation()},_highlightEmptyCols:function(){var t="row"==FLBuilderConfig.userTemplateType?"":":not(.fl-node-global)",i=(e(FLBuilder._contentClass+" .fl-row"+t),e(FLBuilder._contentClass+" .fl-col"+t));e(".fl-row-highlight").removeClass("fl-row-highlight"),i.removeClass("fl-col-highlight").find(".fl-col-content").css("height",""),i.each(function(){var t=e(this);0===t.find(".fl-module, .fl-col").length&&t.addClass("fl-col-highlight")})},_removeEmptyColHighlights:function(){e(".fl-row-highlight").removeClass("fl-row-highlight"),e(".fl-col-highlight").removeClass("fl-col-highlight")},_highlightRowsAndColsForDrag:function(t){var i="row"==FLBuilderConfig.userTemplateType?"":":not(.fl-node-global)";e(FLBuilder._contentClass+" .fl-row").addClass("fl-row-highlight"),t.closest(".fl-row-overlay").length||e(FLBuilder._contentClass+" .fl-col"+i).addClass("fl-col-highlight")},_adjustColHeightsForDrag:function(){var t="row"==FLBuilderConfig.userTemplateType?"":".fl-row:not(.fl-node-global) ",i=e(FLBuilder._contentClass),l=i.find(t+".fl-col-group:not(.fl-col-group-nested) > .fl-col > .fl-col-content"),s=i.find(t+".fl-col-group-nested .fl-col-content"),o=0;for(e(".fl-node-drag-init").hide();o<s.length;o++)FLBuilder._adjustColHeightForDrag(s.eq(o));for(o=0;o<l.length;o++)FLBuilder._adjustColHeightForDrag(l.eq(o));e(".fl-node-drag-init").show()},_adjustColHeightForDrag:function(e){e.find(".fl-module:visible, .fl-col:visible").length&&e.height(e.height()+45)},_showColHighlightGuide:function(){var t=e(this),i=t.find("a"),l=t.closest(".fl-col"),s=l.parents(".fl-col"),o=e('<div class="fl-col-highlight-guide"></div>'),n=null,r=t.closest(".fl-block-overlay").offset().top;(i.hasClass("fl-block-col-move-parent")||i.hasClass("fl-block-col-edit-parent"))&&(l=s),l.hasClass("fl-col-highlight")||(l.find("> .fl-col-content").append(o),l.addClass("fl-col-has-highlight-guide"),n=o.offset().top,n>r&&o.css("top",r-n+4+"px"))},_removeColHighlightGuides:function(){e(".fl-col-has-highlight-guide").removeClass("fl-col-has-highlight-guide"),e(".fl-col-highlight-guide").remove()},_colMouseenter:function(){var t=e(this),i=t.closest(".fl-col-group"),l=i.hasClass("fl-col-group-has-child-loading"),s=t.hasClass("fl-node-global"),o=t.parents(".fl-node-global").length>0,n=t.closest(".fl-col-group").find("> .fl-col").length,r=i.find("> .fl-col").index(t),a=0===r,d=n===r+1,u=t.find(".fl-col").length>0,c=t.parents(".fl-col"),h=c.closest(".fl-col-group"),f=c.length>0,g=f?h.find("> .fl-col").length:0,p=h.find("> .fl-col").index(c),b=!!f&&0===p,m=!!f&&g===p+1,v=t.find("> .fl-col-content").width(),_=t.closest(".fl-row"),L=!!_.find(".fl-row-fixed-width").addBack(".fl-row-fixed-width").length,w=FLBuilderConfig.rowResize.userCanResizeRows,C=wp.template("fl-col-overlay"),F=null;FLBuilderConfig.simpleUi||s&&o&&"row"!=FLBuilderConfig.userTemplateType||t.find(".fl-module, .fl-builder-node-loading-placeholder").length>0||t.find(".fl-col").length>0||t.closest(".fl-builder-node-loading").length||(t.hasClass("fl-block-overlay-active")||(FLBuilder._removeColOverlays(),FLBuilder._removeModuleOverlays(),F=FLBuilder._appendOverlay(t,C({global:s,groupLoading:l,numCols:n,first:a,last:d,hasChildCols:u,hasParentCol:f,parentFirst:b,parentLast:m,numParentCols:g,contentWidth:v,rowIsFixedWidth:L,userCanResizeRows:w})),FLBuilder._buildOverlayOverflowMenu(F),FLBuilder._initColDragResizing()),e("body").addClass("fl-block-overlay-muted"))},_colMouseleave:function(t){var i=e(this),l=e(t.toElement)||e(t.relatedTarget),s=i.find(".fl-module").length>0,o=l.is("#tiptip_holder"),n=l.closest("#tiptip_holder").length>0;o||n||s||(FLBuilder._removeColOverlays(),FLBuilder._removeColHighlightGuides(),FLBuilder._closeAllSubmenus())},_removeColOverlays:function(){var t=e(".fl-col");t.removeClass("fl-block-overlay-active"),t.find(".fl-col-overlay").remove(),e("body").removeClass("fl-block-overlay-muted"),FLBuilder._closeAllSubmenus()},_colDragHelper:function(){return e('<div class="fl-builder-block-drag-helper">'+FLBuilderStrings.column+"</div>")},_colDragInit:function(t){var i=e(t.target),l=e(".fl-col-sortable-proxy-item"),s=i.closest(".fl-col");i.hasClass("fl-block-col-move-parent")&&(s=s.parents(".fl-col")),s.addClass("fl-node-dragging"),FLBuilder._blockDragInit(t),FLBuilder._removeColHighlightGuides(),t.target=l[0],l.trigger(t)},_colDragStart:function(t,i){var l=e(".fl-node-dragging");l.hide(),FLBuilder._resetColumnWidths(l.parent()),FLBuilder._blockDragStart(t,i)},_colDragStop:function(t,i){FLBuilder._blockDragStop(t,i);var l=e(".fl-node-dragging").removeClass("fl-node-dragging").show(),s=l.attr("data-node"),o=i.item.parent(),n=l.parent(),r=n.attr("data-node");newGroup=o.closest(".fl-col-group"),newGroupId=newGroup.attr("data-node"),newRow=o.closest(".fl-row"),position=0,o.hasClass("fl-sortable-disabled")?FLBuilder._resetColumnWidths(n):o.hasClass("fl-col-sortable-proxy")?FLBuilder._resetColumnWidths(n):o.hasClass("fl-col-content")?(l.remove(),0===n.find(".fl-col").length&&n.remove(),position=o.find("> .fl-module, .fl-col-group, .fl-col-sortable-proxy-item").index(i.item),FLBuilder._addColGroup(o.closest(".fl-col").attr("data-node"),s,position)):o.hasClass("fl-col-drop-target")?(o.hasClass("fl-col-drop-target-last")?o.parent().after(l):o.parent().before(l),FLBuilder._resetColumnWidths(newGroup),r==newGroupId?FLBuilder.ajax({action:"reorder_col",node_id:s,position:l.index()}):FLBuilder.ajax({action:"move_col",node_id:s,new_parent:newGroupId,position:l.index(),resize:[r,newGroupId]}),FLBuilder._resizeLayout()):o.hasClass("fl-col-group-drop-target")?(l.remove(),0===n.find(".fl-col").length&&n.remove(),position=newRow.find(".fl-row-content > .fl-col-group").index(newGroup),position=o.hasClass("fl-drop-target-last")?position+1:position,FLBuilder._addColGroup(newRow.attr("data-node"),s,position)):o.hasClass("fl-row-drop-target")&&(l.remove(),position=o.closest(".fl-builder-content").find(".fl-row").index(newRow),position=o.hasClass("fl-drop-target-last")?position+1:position,FLBuilder._addRow(s,position)),0===n.find(".fl-col").length&&n.remove(),e(".fl-col-sortable-proxy").append(i.item),FLBuilder._highlightEmptyCols(),FLBuilder._initDropTargets(),FLBuilder._initSortables(),FLBuilder._closeAllSubmenus()},_colSettingsClicked:function(t){var i=e(this),l=i.closest(".fl-col"),s=l.find("> .fl-col-content"),o=i.closest(".fl-block-overlay-global").length>0,n=null;FLBuilder._colResizing||(i.hasClass("fl-block-col-edit-parent")&&(l=l.parents(".fl-col")),n=l.attr("data-node"),FLBuilderSettingsForms.render({id:"col",nodeId:n,className:"fl-builder-col-settings",attrs:'data-node="'+n+'"',badges:o?[FLBuilderStrings.global]:[],settings:FLBuilderSettingsConfig.nodes[n],preview:{type:"col"}},function(){0===l.siblings(".fl-col").length?e("#fl-builder-settings-section-general").hide():s.width()<=40&&e("#fl-field-size").hide()}),t.stopPropagation())},_copyColClicked:function(t){var i=e(this).closest(".fl-col"),l=i.attr("data-node"),s=i.clone(),o=i.parent(),n=e(".fl-builder-settings[data-node]"),r=n.attr("data-node"),a=r===l?i:i.find('[data-node="'+r+'"]'),d=null;n.length&&a.length&&(d=FLBuilder._getSettings(n),FLBuilderSettingsConfig.nodes[r]=d),s.addClass("fl-node-"+l+"-clone fl-builder-node-clone"),s.find(".fl-block-overlay").remove(),i.after(s),FLBuilder._showNodeLoading(l+"-clone"),FLBuilder._newColParent=o,FLBuilder._newColPosition=i.index()+1,FLBuilder._resetColumnWidths(o),FLBuilder.ajax({action:"copy_col",node_id:l,settings:d,settings_id:r},function(e){var t=JSON.parse(e);t.duplicatedColumn=l,FLBuilder._copyColComplete(t)}),t.stopPropagation()},_copyColComplete:function(e){e.nodeParent=FLBuilder._newColParent,e.nodePosition=FLBuilder._newColPosition,FLBuilder._renderLayout(e,function(){FLBuilder.triggerHook("didDuplicateColumn",{newNodeId:e.nodeId,oldNodeId:e.duplicatedColumn}),e.nodeParent.find(".fl-builder-node-loading").eq(0).remove()})},_deleteColClicked:function(t){var i=e(this),l=i.closest(".fl-col"),s=l.closest(".fl-col-group"),o=l.parents(".fl-col"),n=o.length>0,r=o.find("> .fl-col-content > .fl-module, > .fl-col-content > .fl-col-group"),a=l.siblings(".fl-col"),d=!0;l.find(".fl-module").length>0&&(d=confirm(FLBuilderStrings.deleteColumnMessage)),n&&1===r.length&&(0===a.length?l=o:1!==a.length||a.find(".fl-module").length||(l=s)),d&&(FLBuilder._deleteCol(l),FLBuilder._removeAllOverlays(),FLBuilder._highlightEmptyCols()),t.stopPropagation()},_deleteCol:function(e){var t=e.attr("data-node"),i=e.closest(".fl-row"),l=e.closest(".fl-col-group"),s=0;e.remove(),rowCols=i.find(".fl-row-content > .fl-col-group > .fl-col"),groupCols=l.find(" > .fl-col"),0===rowCols.length&&"row"!=FLBuilderConfig.userTemplateType?FLBuilder._deleteRow(i):(0===groupCols.length?l.remove():(s=6===groupCols.length?16.65:7===groupCols.length?14.28:Math.round(100/groupCols.length*100)/100,groupCols.css("width",s+"%"),FLBuilder.triggerHook("didResetColumnWidths",{cols:groupCols})),FLBuilder.ajax({action:"delete_col",node_id:t,new_width:s}),FLBuilder._initDropTargets(),FLBuilder._initSortables(),FLBuilder.triggerHook("didDeleteColumn",t))},_addCols:function(e,t,i,l){var s=e.closest(".fl-col-group"),o=s.find(".fl-col").index(e);i="undefined"==typeof i?"1-col":i,l="undefined"!=typeof l&&l,"after"==t&&o++,FLBuilder._showNodeLoadingPlaceholder(s,o),FLBuilder._removeAllOverlays(),FLBuilder.ajax({action:"render_new_columns",node_id:e.attr("data-node"),insert:t,type:i,nested:l?1:0},FLBuilder._addColsComplete)},_addColsComplete:function(t){var i=JSON.parse(t),l=null,s=FLBuilder._addModuleAfterNodeRender;FLBuilder._renderLayout(i,function(){null!==s&&(e('.fl-module[data-node="'+s.module.data("node")+'"]').remove(),l=e('.fl-col[data-node="'+s.colId+'"]'),"after"==s.position?l.next().find(".fl-col-content").append(s.module):l.prev().find(".fl-col-content").append(s.module),FLBuilder._reorderModule(s.module),FLBuilder._addModuleAfterNodeRender=null),FLBuilder.triggerHook("didAddColumn",i.nodeId),FLBuilder.triggerHook("didResetColumnWidths",{cols:e(".fl-node-"+i.nodeId).find("> .fl-col")})})},_addColGroup:function(t,i,l){var s=e(".fl-node-"+t);FLBuilder._newColGroupPosition=l,s.hasClass("fl-col")?FLBuilder._newColGroupParent=s.find(" > .fl-col-content"):FLBuilder._newColGroupParent=s.find(".fl-row-content"),FLBuilder._showNodeLoadingPlaceholder(FLBuilder._newColGroupParent,l),FLBuilder.ajax({action:"render_new_column_group",cols:i,node_id:t,position:l},FLBuilder._addColGroupComplete)},_addColGroupComplete:function(t){var i=JSON.parse(t),l=e(i.html),s=l.data("node"),o=l.find(".fl-col").data("node"),n=FLBuilder._addModuleAfterNodeRender;i.nodeParent=FLBuilder._newColGroupParent,i.nodePosition=FLBuilder._newColGroupPosition,FLBuilder._renderLayout(i,function(){i.nodeParent.hasClass("fl-col-content")&&i.nodeParent.parents(".fl-col").addClass("fl-col-has-cols"),null!==n&&(e(".fl-node-"+o+" .fl-col-content").append(n),FLBuilder._reorderModule(n),FLBuilder._addModuleAfterNodeRender=null),FLBuilder._removeNodeLoadingPlaceholder(e(".fl-node-"+s)),FLBuilder.triggerHook("didAddColumnGroup",s)})},_initColDragResizing:function(){e(".fl-block-col-resize").not(".fl-block-row-resize").draggable({axis:"x",start:FLBuilder._colDragResizeStart,drag:FLBuilder._colDragResize,stop:FLBuilder._colDragResizeStop})},_colDragResizeStart:function(t,i){var l=e(i.helper),s="",o=l.hasClass("fl-block-col-resize-parent"),n=o?l.closest(".fl-col").parents(".fl-col"):null,r=o?n.parents(".fl-col-group"):l.closest(".fl-col-group"),a=r.find("> .fl-col"),d=o?n:l.closest(".fl-col"),u=d.attr("data-node"),c=e("[data-node="+u+"] #fl-field-size input"),h=null,f=null,g=null,p=100,b=0,m=null,v=null;for(l.hasClass("fl-block-col-resize-e")?(s="e",h=d.nextAll(".fl-col").first()):(s="w",h=d.prevAll(".fl-col").first()),f=h.attr("data-node"),g=e("[data-node="+f+"] #fl-field-size input");b<a.length;b++)a.eq(b).data("node")!=d.data("node")&&a.eq(b).data("node")!=h.data("node")&&(p-=parseFloat(a.eq(b)[0].style.width));c.length?(m=c,v="col"):g.length&&(m=g,v="sibling"),FLBuilder._colResizeData={handle:l,feedbackLeft:l.find(".fl-block-col-resize-feedback-left"),feedbackRight:l.find(".fl-block-col-resize-feedback-right"),direction:s,groupWidth:r.outerWidth(),col:d,colWidth:parseFloat(d[0].style.width)/100,sibling:h,offset:i.position.left,availWidth:p,setting:m,settingType:v},FLBuilder._colResizing=!0,e("body").addClass("fl-builder-col-resizing"),FLBuilder._closePanel(),FLBuilder._destroyOverlayEvents(),FLBuilder.triggerHook("col-resize-start")},_colDragResize:function(e,t){var i=FLBuilder._colResizeData,l=FLBuilderConfig.isRtl?"w":"e",s=i.handle.closest(".fl-block-overlay"),o=(i.offset-t.position.left)/i.groupWidth,n=l==i.direction?100*(i.colWidth-o):100*(i.colWidth+o),r=Math.round(100*n)/100,a=i.availWidth-n,d=Math.round(100*a)/100,u=8,c=Math.round(100*(i.availWidth-u))/100;r<u?(r=u,d=c):d<u&&(r=c,d=u),l==i.direction?(i.feedbackLeft.html(r.toFixed(1)+"%").show(),i.feedbackRight.html(d.toFixed(1)+"%").show()):(i.feedbackLeft.html(d.toFixed(1)+"%").show(),i.feedbackRight.html(r.toFixed(1)+"%").show()),i.col.css("width",r+"%"),i.sibling.css("width",d+"%"),i.setting&&("col"===i.settingType?i.setting.val(parseFloat(i.col[0].style.width)):"sibling"===i.settingType&&i.setting.val(parseFloat(i.sibling[0].style.width))),FLBuilder._buildOverlayOverflowMenu(s),FLBuilder.triggerHook("col-resize-drag")},_colDragResizeStop:function(t,i){var l=FLBuilder._colResizeData,s=FLBuilder._colResizeData.handle.closest(".fl-block-overlay"),o=l.col.data("node"),n=parseFloat(l.col[0].style.width),r=l.sibling.data("node"),a=parseFloat(l.sibling[0].style.width);FLBuilder._colResizeData.feedbackLeft.hide(),FLBuilder._colResizeData.feedbackRight.hide(),FLBuilder.ajax({action:"resize_cols",col_id:o,col_width:n,sibling_id:r,sibling_width:a}),FLBuilder._buildOverlayOverflowMenu(s),FLBuilder._colResizeData=null,e("body").removeClass("fl-builder-col-resizing"),FLBuilder._bindOverlayEvents(),setTimeout(function(){FLBuilder._colResizing=!1},50),FLBuilder.triggerHook("col-resize-stop"),FLBuilder.triggerHook("didResizeColumn",{colId:o,colWidth:n,siblingId:r,siblingWidth:a})},_resetColumnWidthsClicked:function(t){var i=e(this),l=!!i.closest(".fl-row-overlay").length,s=null,o=null,n=[],r=null,a=0,d=e(".fl-builder-col-settings"),u=null;o=l?i.closest(".fl-row").find(".fl-row-content > .fl-col-group"):i.parents(".fl-col-group").last(),o.each(function(){for(s=e(this),r=s.find(".fl-col-group"),n.push(s.data("node")),FLBuilder._resetColumnWidths(s),a=0;a<r.length;a++)FLBuilder._resetColumnWidths(r.eq(a)),n.push(r.eq(a).data("node"))}),d.length&&(u=e(".fl-node-"+d.attr("data-node")),d.find("#fl-field-size input").val(parseFloat(u[0].style.width))),FLBuilder.ajax({action:"reset_col_widths",group_id:n}),FLBuilder.triggerHook("col-reset-widths"),FLBuilder._closeAllSubmenus(),t.stopPropagation()},_resetColumnWidths:function(e){var t=e.find(" > .fl-col:visible"),i=0;i=6===t.length?16.65:7===t.length?14.28:Math.round(100/t.length*100)/100,t.css("width",i+"%"),FLBuilder.triggerHook("didResetColumnWidths",{cols:t})},_moduleMouseenter:function(){var t=e(this),i=t.attr("data-name"),l=t.hasClass("fl-node-global"),s=t.parents(".fl-node-global").length>0,o=t.parents(".fl-col-group").last(),n=o.hasClass("fl-col-group-has-child-loading"),r=t.closest(".fl-col-group").find("> .fl-col").length,a=t.closest(".fl-col"),d=0===a.index(),u=r===a.index()+1,c=a.parents(".fl-col"),h=c.length>0,f=h?c.closest(".fl-col-group").find("> .fl-col").length:0,g=!!h&&0===c.index(),p=!!h&&f===c.index()+1,b=a.find("> .fl-col-content").width(),m=t.closest(".fl-row"),v=!!m.find(".fl-row-fixed-width").addBack(".fl-row-fixed-width").length,_=FLBuilderConfig.rowResize.userCanResizeRows,L=wp.template("fl-module-overlay"),w=null;FLBuilder._removeColOverlays(),FLBuilder._removeModuleOverlays(),l&&s&&"row"!=FLBuilderConfig.userTemplateType||t.closest(".fl-builder-node-loading").length||(t.hasClass("fl-block-overlay-active")||(w=FLBuilder._appendOverlay(t,L({global:l,moduleName:i,groupLoading:n,numCols:r,colFirst:d,colLast:u,hasParentCol:h,numParentCols:f,parentFirst:g,parentLast:p,contentWidth:b,rowIsFixedWidth:v,userCanResizeRows:_})),FLBuilder._buildOverlayOverflowMenu(w),FLBuilder._initColDragResizing()),e("body").addClass("fl-block-overlay-muted"))},_moduleMouseleave:function(t){var i=(e(this),e(t.toElement)||e(t.relatedTarget)),l=i.is("#tiptip_holder"),s=i.closest("#tiptip_holder").length>0;l||s||(FLBuilder._removeModuleOverlays(),FLBuilder._removeColHighlightGuides())},_removeModuleOverlays:function(){var t=e(".fl-module");t.removeClass("fl-block-overlay-active"),t.find(".fl-module-overlay").remove(),
|
4 |
e("body").removeClass("fl-block-overlay-muted"),FLBuilder._closeAllSubmenus()},_moduleDragHelper:function(t,i){return e('<div class="fl-builder-block-drag-helper">'+i.attr("data-name")+"</div>")},_moduleDragStart:function(t,i){e(i.item).data("original-position",i.item.index()),FLBuilder._blockDragStart(t,i)},_moduleDragStop:function(t,i){FLBuilder._blockDragStop(t,i);var l=i.item,s=l.parent(),o=null,n=0,r=0;if(s.hasClass("fl-builder-modules")||s.hasClass("fl-builder-widgets"))return void l.remove();if(l.hasClass("fl-builder-block")){if(s.hasClass("fl-sortable-disabled"))return l.remove(),void FLBuilder._showPanel();s.hasClass("fl-row-drop-target")?(s=l.closest(".fl-builder-content"),r=0,o=l.closest(".fl-row"),n=s.find(".fl-row").index(o)):s.hasClass("fl-col-group-drop-target")?(s=l.closest(".fl-row-content"),r=s.closest(".fl-row").attr("data-node"),o=l.closest(".fl-col-group"),n=s.find(" > .fl-col-group").index(o)):s.hasClass("fl-col-drop-target")?(s=l.closest(".fl-col-group"),r=s.attr("data-node"),o=l.closest(".fl-col"),n=s.find(" > .fl-col").index(o)):(n=s.find("> .fl-module, .fl-col-group, .fl-builder-block").index(l),r=l.closest(".fl-col").attr("data-node")),l.closest(".fl-drop-target-last").length&&(n+=1),FLBuilder._addModule(s,r,l.attr("data-type"),n,l.attr("data-widget"),l.attr("data-alias")),l.remove()}else{if(s.hasClass("fl-sortable-disabled"))return e(t.target).append(i.item),e(t.target).children().eq(i.item.data("original-position")).before(i.item),void FLBuilder._highlightEmptyCols();s.hasClass("fl-row-drop-target")?(o=l.closest(".fl-row"),n=l.closest(".fl-builder-content").children(".fl-row").index(o),n=l.closest(".fl-drop-target-last").length?n+1:n,FLBuilder._addModuleAfterNodeRender=l,FLBuilder._addRow("1-col",n),l.remove()):s.hasClass("fl-col-group-drop-target")?(o=l.closest(".fl-col-group"),n=l.closest(".fl-row-content ").find(" > .fl-col-group").index(o),n=l.closest(".fl-drop-target-last").length?n+1:n,FLBuilder._addModuleAfterNodeRender=l,FLBuilder._addColGroup(l.closest(".fl-row").attr("data-node"),"1-col",n),l.remove()):s.hasClass("fl-col-drop-target")?(o=l.closest(".fl-col"),n=l.closest(".fl-col-drop-target-last").length?"after":"before",FLBuilder._addModuleAfterNodeRender={module:l,colId:o.data("node"),position:n},FLBuilder._addCols(o,n,"1-col",l.closest(".fl-col-group-nested").length>0),l.remove()):FLBuilder._reorderModule(l)}FLBuilder._resizeLayout()},_reorderModule:function(e){var t=e.closest(".fl-col").attr("data-node"),i=e.attr("data-parent"),l=e.attr("data-node"),s=e.index();t==i?FLBuilder._reorderNode(l,s):(e.attr("data-parent",t),FLBuilder._moveNode(t,l,s))},_deleteModuleClicked:function(t){var i=e(this).closest(".fl-module"),l=confirm(FLBuilderStrings.deleteModuleMessage);l&&(FLBuilder._deleteModule(i),FLBuilder._removeAllOverlays()),t.stopPropagation()},_deleteModule:function(e){var t=e.closest(".fl-row"),i=e.attr("data-node");FLBuilder.ajax({action:"delete_node",node_id:i}),e.empty(),e.remove(),t.removeClass("fl-block-overlay-muted"),FLBuilder._highlightEmptyCols(),FLBuilder._removeAllOverlays(),FLBuilder.triggerHook("didDeleteModule",i)},_moduleCopyClicked:function(t){var i=e(this).closest(".fl-module"),l=i.attr("data-node"),s=i.index()+1,o=i.clone(),n=e(".fl-builder-module-settings[data-node="+l+"]"),r=null;n.length&&(r=FLBuilder._getSettings(n),FLBuilderSettingsConfig.nodes[l]=r),o.addClass("fl-node-"+l+"-clone fl-builder-node-clone"),o.find(".fl-block-overlay").remove(),i.after(o),e("html, body").animate({scrollTop:o.offset().top-75},500),FLBuilder._showNodeLoading(l+"-clone"),FLBuilder._newModuleParent=i.parent(),FLBuilder._newModulePosition=s,FLBuilder.ajax({action:"copy_module",node_id:l,settings:r},function(e){var t=JSON.parse(e);t.duplicatedModule=l,FLBuilder._moduleCopyComplete(t)}),t.stopPropagation()},_moduleCopyComplete:function(e){e.nodeParent=FLBuilder._newModuleParent,e.nodePosition=FLBuilder._newModulePosition,FLBuilder._renderLayout(e,function(){FLBuilder.triggerHook("didDuplicateModule",{newNodeId:e.nodeId,oldNodeId:e.duplicatedModule}),e.nodeParent.find(".fl-builder-node-loading").eq(0).remove()})},_moduleSettingsClicked:function(t){var i=e(this),l=i.closest(".fl-module").attr("data-type"),s=i.closest(".fl-module").attr("data-node"),o=i.closest(".fl-col").attr("data-node"),n=i.closest(".fl-block-overlay-global").length>0;t.stopPropagation(),FLBuilder._colResizing||n&&!FLBuilderConfig.userCanEditGlobalTemplates||FLBuilder._showModuleSettings({type:l,nodeId:s,parentId:o,global:n})},_showModuleSettings:function(t,i){var l=FLBuilderSettingsConfig.modules[t.type],s=t.settings?t.settings:FLBuilderSettingsConfig.nodes[t.nodeId],o=e("head");-1===e.inArray(t.type,FLBuilder._loadedModuleAssets)&&(""!==l.assets.css&&o.append(l.assets.css),""!==l.assets.js&&o.append(l.assets.js),FLBuilder._loadedModuleAssets.push(t.type)),FLBuilderSettingsForms.render({type:"module",id:t.type,nodeId:t.nodeId,className:"fl-builder-module-settings fl-builder-"+t.type+"-settings",attrs:'data-node="'+t.nodeId+'" data-parent="'+t.parentId+'" data-type="'+t.type+'"',buttons:t.global||FLBuilderConfig.lite||FLBuilderConfig.simpleUi?[]:["save-as"],badges:t.global?[FLBuilderStrings.global]:[],settings:s,legacy:t.legacy,helper:FLBuilder._moduleHelpers[t.type],rules:FLBuilder._moduleHelpers[t.type]?FLBuilder._moduleHelpers[t.type].rules:null,preview:{type:"module",layout:t.layout,callback:function(){FLBuilder.triggerHook("didAddModule",t.nodeId)}}},i)},_saveModuleClicked:function(){var t=e(this).closest(".fl-builder-settings"),i=t.attr("data-type"),l=(t.attr("data-node"),FLBuilder._moduleHelpers[i]),s=!0;"undefined"!=typeof l&&(t.find("label.error").remove(),t.validate().hideErrors(),s=t.validate().form(),s&&(s=l.submit())),s?FLBuilder._saveSettings():FLBuilder._toggleSettingsTabErrors()},_addModule:function(e,t,i,l,s,o){FLBuilder._showNodeLoadingPlaceholder(e,l),e.hasClass("fl-col-group")?(FLBuilder._newModuleParent=null,FLBuilder._newModulePosition=0):(FLBuilder._newModuleParent=e,FLBuilder._newModulePosition=l),FLBuilder.ajax({action:"render_new_module",parent_id:t,type:i,position:l,node_preview:1,widget:"undefined"==typeof s?"":s,alias:"undefined"==typeof o?"":o},FLBuilder._addModuleComplete)},_addModuleComplete:function(t){var i=JSON.parse(t);i.layout&&(i.layout.nodeParent=FLBuilder._newModuleParent,i.layout.nodePosition=FLBuilder._newModulePosition),i.settings||(i.settings=FLBuilderSettingsConfig.defaults.modules[i.type]),e("form.fl-builder-settings").length?i.layout&&FLBuilder._renderLayout(i.layout):FLBuilder._showModuleSettings(i,function(){e(".fl-builder-module-settings").data("new-module","1")})},registerModuleHelper:function(t,i){var l={rules:{},init:function(){},submit:function(){return!0},preview:function(){}};FLBuilder._moduleHelpers[t]=e.extend({},l,i)},_registerModuleHelper:function(e,t){FLBuilder.registerModuleHelper(e,t)},_showNodeTemplateSettings:function(t){var i=e(".fl-builder-settings-lightbox .fl-builder-settings"),l=i.attr("data-node"),s=FLBuilderStrings.saveModule;return i.hasClass("fl-builder-row-settings")&&(s=FLBuilderStrings.saveRow),!!FLBuilder._triggerSettingsSave(!1,!1,!1)&&void FLBuilderSettingsForms.render({id:"node_template",nodeId:l,title:s,attrs:'data-node="'+l+'"',className:"fl-builder-node-template-settings",rules:{name:{required:!0}}},function(){FLBuilderConfig.userCanEditGlobalTemplates||e("#fl-field-global").hide()})},_saveNodeTemplate:function(){var t=e(".fl-builder-node-template-settings"),i=t.attr("data-node"),l=t.validate().form();l&&(FLBuilder._showNodeLoading(i),FLBuilder.ajax({action:"save_node_template",node_id:i,settings:FLBuilder._getSettings(t)},function(e){FLBuilder._saveNodeTemplateComplete(e),FLBuilder._hideNodeLoading(i)}),FLBuilder._lightbox.close())},_saveNodeTemplateComplete:function(t){var i=JSON.parse(t),l=e(".fl-builder-saved-"+i.type+"s"),s=l.find(".fl-builder-block"),o=null,n="",r=i.name.toLowerCase(),a=0,d=wp.template("fl-node-template-block"),u={name:i.name,isGlobal:i.global,content:i.type,id:i.id,postID:i.postID,kind:"template",type:"user",link:i.link,category:{uncategorized:FLBuilderStrings.uncategorized}};if(FLBuilderConfig.contentItems.template.push(u),FLBuilder.triggerHook("contentItemsChanged"),i.layout&&(FLBuilder._renderLayout(i.layout),FLBuilder.triggerHook("didSaveGlobalNodeTemplate",i.config)),0===s.length)l.append(d(i));else for(;a<s.length;a++){if(o=s.eq(a),n=o.text().toLowerCase().trim(),0===a&&r<n){l.prepend(d(i));break}if(r<n){o.before(d(i));break}if(s.length-1===a){l.append(d(i));break}}l.find(".fl-builder-block-no-node-templates").remove()},_nodeTemplateDragStop:function(t,i){FLBuilder._blockDragStop(t,i);var l=i.item,s=l.parent(),o=null,n=0,r=null,a="",d=null;if(s.hasClass("fl-builder-blocks-section-content"))return void l.remove();if(l.hasClass("fl-builder-block-saved-row")||l.hasClass("fl-builder-block-row-template"))r=l.closest(".fl-row"),n=r.length?e(FLBuilder._contentClass+" .fl-row").index(r):0,n=s.hasClass("fl-drop-target-last")?n+1:n,o=null,a="render_new_row",d=FLBuilder._addRowComplete,FLBuilder._newRowPosition=n,FLBuilder._showNodeLoadingPlaceholder(e(FLBuilder._contentClass),n);else if(l.hasClass("fl-builder-block-saved-module")||l.hasClass("fl-builder-block-module-template")){if(a="render_new_module",d=FLBuilder._addModuleComplete,s.hasClass("fl-sortable-disabled"))return l.remove(),void FLBuilder._showPanel();s.hasClass("fl-row-drop-target")?(s=l.closest(".fl-builder-content"),o=0,n=s.find(".fl-row").index(l.closest(".fl-row"))):s.hasClass("fl-col-group-drop-target")?(s=l.closest(".fl-row-content"),o=s.closest(".fl-row").attr("data-node"),n=s.find(" > .fl-col-group").index(l.closest(".fl-col-group"))):s.hasClass("fl-col-drop-target")?(s=l.closest(".fl-col-group"),n=s.children(".fl-col").index(l.closest(".fl-col")),o=s.attr("data-node")):(n=s.children(".fl-module, .fl-builder-block").index(l),o=l.closest(".fl-col").attr("data-node")),l.closest(".fl-drop-target-last").length&&(n+=1),s.hasClass("fl-col-group")?(FLBuilder._newModuleParent=null,FLBuilder._newModulePosition=0):(FLBuilder._newModuleParent=s,FLBuilder._newModulePosition=n),FLBuilder._showNodeLoadingPlaceholder(s,n)}FLBuilder.ajax({action:a,template_id:l.attr("data-id"),template_type:l.attr("data-type"),parent_id:o,position:n},function(e){if(a.indexOf("row")>-1){var t=JSON.parse(e);FLBuilder.triggerHook("didApplyRowTemplateComplete",t.config),d(t.layout)}else d(e)}),l.remove()},_editNodeTemplateClicked:function(t){t.preventDefault(),t.stopPropagation(),window.open(e(this).attr("href"))},_deleteNodeTemplateClicked:function(t){var i=e(t.target),l=i.closest(".fl-builder-blocks-section"),s=l.find(".fl-builder-blocks-section-content"),o=s.find(".fl-builder-block"),n=i.closest(".fl-builder-block"),r=n.hasClass("fl-builder-block-global"),a=r?FLBuilder._updateLayout:void 0,d=r?FLBuilderStrings.deleteGlobalTemplate:FLBuilderStrings.deleteTemplate,u=null;confirm(d)&&(n.remove(),1===o.length&&(n.hasClass("fl-builder-block-saved-row")?s.append('<span class="fl-builder-block-no-node-templates">'+FLBuilderStrings.noSavedRows+"</span>"):s.append('<span class="fl-builder-block-no-node-templates">'+FLBuilderStrings.noSavedModules+"</span>")),n.hasClass("fl-builder-block-global")&&FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"delete_node_template",template_id:n.attr("data-id")},a),u=_.findIndex(FLBuilderConfig.contentItems.template,{id:n.attr("data-id"),type:"user"}),FLBuilderConfig.contentItems.template.splice(u,1),FLBuilder.triggerHook("contentItemsChanged"))},_initSettingsForms:function(){FLBuilder._initCodeFields(),FLBuilder._initColorPickers(),FLBuilder._initSelectFields(),FLBuilder._initEditorFields(),FLBuilder._initMultipleFields(),FLBuilder._initAutoSuggestFields(),FLBuilder._initLinkFields(),FLBuilder._initFontFields(),FLBuilder._initOrderingFields(),FLBuilder._initTimezoneFields(),FLBuilder._focusFirstSettingsControl(),FLBuilder._lightbox._resizeEditors(),e(".fl-builder-settings-fields").css("visibility","visible"),FLBuilder.triggerHook("settings-form-init")},_destroySettingsForms:function(){FLBuilder._destroyEditorFields()},_setSettingsFormContent:function(t){e(".fl-legacy-settings").remove(),e("body").append(t)},_settingsTabClicked:function(t){var i=e(this),l=i.closest(".fl-builder-settings"),s=i.attr("href").split("#").pop();FLBuilder._resetSettingsTabsState(),l.find(".fl-builder-settings-tab").removeClass("fl-active"),l.find("#"+s).addClass("fl-active"),l.find(".fl-builder-settings-tabs .fl-active").removeClass("fl-active"),l.find("a[href*="+s+"]").addClass("fl-active"),FLBuilder._focusFirstSettingsControl(),t.preventDefault()},_resetSettingsTabsState:function(){var t=e(".fl-lightbox:visible");FLBuilder._hideTabsOverflowMenu(),t.find(".fl-builder-settings-tabs .fl-active").removeClass("fl-active"),t.find(".fl-builder-settings-tabs-overflow-menu .fl-active").removeClass("fl-active"),t.find(".fl-contains-active").removeClass("fl-contains-active")},_calculateSettingsTabsOverflow:function(){var t=e(".fl-lightbox:visible"),i=t.outerWidth(),l=t.hasClass("fl-lightbox-width-slim"),s=t.find(".fl-builder-settings-tabs"),o=t.find(".fl-builder-settings-tabs-overflow-menu"),n=t.find(".fl-builder-settings-tabs-more"),r=s.find("a"),a=!1,d=i-60,u=0,c=l?16:30;o.html(""),FLBuilder._hideTabsOverflowMenu(),r.removeClass("fl-overflowed"),r.each(function(){if(!e(this).is(":visible"))return!0;if(!a){var t=e(this).textWidth()+c+12;u+=t,u>=d&&(a=!0)}if(a){var i=e(this).html(),l=e(this).attr("href"),s="";e(this).hasClass("fl-active")&&(s="fl-active"),e(this).hasClass("error")&&(s+=" error"),""!==s&&(s='class="'+s+'"');var n=e('<a href="'+l+'" '+s+">"+i+"</a>");o.append(n),e(this).addClass("fl-overflowed")}else e(this).removeClass("fl-overflowed")}),a?t.addClass("fl-lightbox-has-tab-overflow"):t.removeClass("fl-lightbox-has-tab-overflow"),o.find(".fl-active").length>0?n.addClass("fl-contains-active"):n.removeClass("fl-contains-active"),o.find(".error").length>0?n.addClass("fl-contains-errors"):n.removeClass("fl-contains-errors")},_settingsTabsToOverflowMenuItemClicked:function(t){var i=e(t.currentTarget),l=i.attr("href"),s=i.closest(".fl-lightbox-header-wrap").find(".fl-builder-settings-tabs"),o=s.find('a[href="'+l+'"]'),n=s.find(".fl-builder-settings-tabs-more");FLBuilder._resetSettingsTabsState(),o.trigger("click"),i.addClass("fl-active"),n.addClass("fl-contains-active"),FLBuilder._hideTabsOverflowMenu(),t.preventDefault()},_hasOverflowTabs:function(){var t=e(".fl-lightbox:visible"),i=t.find(".fl-builder-settings-tabs-overflow-menu a");return i.length>0},_showTabsOverflowMenu:function(){if(FLBuilder._hasOverflowTabs()){var t=e(".fl-lightbox:visible");t.find(".fl-builder-settings-tabs-overflow-menu").css("display","flex"),t.find(".fl-builder-settings-tabs-overflow-click-mask").show(),this.isShowingSettingsTabsOverflowMenu=!0}},_hideTabsOverflowMenu:function(){var t=e(".fl-lightbox:visible");t.find(".fl-builder-settings-tabs-overflow-menu").css("display","none"),t.find(".fl-builder-settings-tabs-overflow-click-mask").hide(),this.isShowingSettingsTabsOverflowMenu=!1},_toggleTabsOverflowMenu:function(e){FLBuilder.isShowingSettingsTabsOverflowMenu?FLBuilder._hideTabsOverflowMenu():FLBuilder._showTabsOverflowMenu(),e.stopPropagation()},_settingsCancelClicked:function(t){var i=e(".fl-builder-lightbox[data-parent]"),l=e(".fl-builder-module-settings"),s=null,o=null,n=null,r=null;return i.length>0?void FLBuilder._closeNestedSettings():(l.length>0&&"undefined"!=typeof l.data("new-module")?(s=e(FLBuilder.preview.state.html),o=e(".fl-node-"+l.data("node")),n=o.closest(".fl-col"),r=s.find(".fl-node-"+n.data("node")),r.length>0?FLBuilder._deleteModule(o):FLBuilder._deleteCol(n)):FLBuilder.preview&&FLBuilder.preview.revert(),FLBuilder.preview=null,void FLLightbox.closeParent(this))},_focusFirstSettingsControl:function(){var t=e(".fl-builder-settings:visible"),i=t.find(".fl-builder-settings-tab.fl-active"),l=i.find(".fl-field").first(),s=l.find('input:not([type="hidden"]), textarea, select, button, a, .fl-editor-field').first();if("undefined"!=typeof tinyMCE&&s.hasClass("fl-editor-field")){var o=s.find("textarea.wp-editor-area").attr("id");tinyMCE.get(o).focus()}else setTimeout(function(){s.focus().css("animation-name","fl-grab-attention")},300);l.css("animation-name","fl-grab-attention"),l.on("animationend",function(){l.css("animation-name","")})},_initSettingsValidation:function(t,i){var l=e(".fl-builder-settings").last();l.validate({ignore:".fl-ignore-validation",rules:t,messages:i,errorPlacement:FLBuilder._settingsErrorPlacement})},_settingsErrorPlacement:function(e,t){e.appendTo(t.parent())},_toggleSettingsTabErrors:function(){for(var t=e(".fl-builder-settings:visible"),i=t.find(".fl-builder-settings-tab"),l=null,s=null,o=0;o<i.length;o++)l=i.eq(o),s=l.find("label.error"),tabLink=t.find(".fl-builder-settings-tabs a[href*="+l.attr("id")+"]"),tabLink.find(".fl-error-icon").remove(),tabLink.removeClass("error"),s.length>0&&(tabLink.append('<span class="fl-error-icon"></span>'),tabLink.addClass("error"));FLBuilder._calculateSettingsTabsOverflow()},_getSettings:function(t){FLBuilder._updateEditorFields();var i=t.serializeArray(),l=0,s=0,o="",n="",r="",a=[],d=[],u={};for(l=0;l<i.length;l++)if(o=i[l].value.replace(/\r/gm,""),!(i[l].name.indexOf("flrich")>-1))if(i[l].name.indexOf("[")>-1){for(n=i[l].name.replace(/\[(.*)\]/,""),r=i[l].name.replace(n,""),a=[],d=r.match(/\[[^\]]*\]/g),s=0;s<d.length;s++)"[]"!=d[s]&&a.push(d[s].replace(/\[|\]/g,""));r.match(/\[\]\[[^\]]*\]\[[^\]]+\]/)?("undefined"==typeof u[n]&&(u[n]={}),"undefined"==typeof u[n][a[0]]&&(u[n][a[0]]={}),"undefined"==typeof u[n][a[0]][a[1]]&&(u[n][a[0]][a[1]]={}),u[n][a[0]][a[1]]=o):r.match(/\[\]\[[^\]]*\]\[\]/)?("undefined"==typeof u[n]&&(u[n]={}),"undefined"==typeof u[n][a[0]]&&(u[n][a[0]]=[]),u[n][a[0]].push(o)):r.match(/\[\]\[[^\]]*\]/)?("undefined"==typeof u[n]&&(u[n]={}),u[n][a[0]]=o):r.match(/\[\]/)&&("undefined"==typeof u[n]&&(u[n]=[]),u[n].push(o))}else u[i[l].name]=o;for(r in u)if("undefined"!=typeof u["as_values_"+r]){u[r]=e.grep(u["as_values_"+r].split(","),function(e){return""!==e}).join(",");try{delete u["as_values_"+r]}catch(c){}}return e.each(t.find("[name]"),function(t,i){var l=e(i).attr("name").replace(/\[(.*)\]/,"");l in u||(u[l]="")}),u=e.extend({},FLBuilder._getOriginalSettings(t),u)},_getSettingsJSONForHTML:function(e){return JSON.stringify(e).replace(/\'/g,"'").replace("<wbr />","<wbr>")},_getOriginalSettings:function(t,i){var l=t.find(".fl-builder-settings-json"),s=t.data("node"),o=FLBuilderSettingsConfig.nodes,n=null,r={};if(s&&o[s]?n=o[s]:l.length&&(n=JSON.parse(l.val().replace(/'/g,"'"))),n)for(key in n)(e("#fl-field-"+key).length||i)&&(r[key]=n[key]);return r},_saveSettings:function(t){var i=e(".fl-builder-settings-lightbox .fl-builder-settings"),l=i.data("new-module"),s=i.attr("data-node"),o=FLBuilder._getSettings(i),n=FLBuilder.preview;return!_.isUndefined(t)&&_.isBoolean(t)||(t=!0),n&&!n._settingsHaveChanged()&&_.isUndefined(l)?void FLBuilder._lightbox.close():(FLBuilder._showNodeLoading(s),FLBuilderSettingsConfig.nodes[s]=o,FLBuilder.ajax({action:"save_settings",node_id:s,settings:o},FLBuilder._saveSettingsComplete.bind(this,t,n)),FLBuilder.triggerHook("didSaveNodeSettings",{nodeId:s,settings:o}),void FLBuilder._lightbox.close())},_saveSettingsComplete:function(e,t,i){var l=JSON.parse(i),s=function(){t&&l.layout.partial&&l.layout.nodeId===t.nodeId&&(t.clear(),t=null)};!0===e?FLBuilder._renderLayout(l.layout,s):s(),FLBuilder.triggerHook("didSaveNodeSettingsComplete",{nodeId:l.node_id,settings:l.settings})},_triggerSettingsSave:function(t,i,l){var s=FLBuilder._lightbox._node.find("form.fl-builder-settings"),o=FLBuilder._lightbox._node.data("instance-id"),n=FLLightbox._instances[o],r=e(".fl-lightbox-wrap[data-parent]:visible"),a=!1,d=!0;return t=!_.isUndefined(t)&&t,i=!_.isUndefined(i)&&i,l=!!_.isUndefined(l)||l,s.length&&(r.length&&(r.find(".fl-builder-settings-save").trigger("click"),(r.find("label.error").length||e(".fl-builder-alert-lightbox:visible").length)&&(d=!1)),d&&!s.validate().form()&&(d=!1),a=FLBuilderSettingsForms.settingsHaveChanged(),d&&a&&(t&&n.disableClose(),s.find(".fl-builder-settings-save").trigger("click"),t&&n.enableClose(),(s.find("label.error").length||e(".fl-builder-alert-lightbox:visible").length)&&(d=!1)),l&&(FLBuilder._destroySettingsForms(),!a&&FLBuilder.preview&&(FLBuilder.preview.clear(),FLBuilder.preview=null)),a||t||n.close()),d||(FLBuilder.triggerHook("didFailSettingsSave"),FLBuilder._toggleSettingsTabErrors(),i&&!e(".fl-builder-alert-lightbox:visible").length&&FLBuilder.alert(FLBuilderStrings.settingsHaveErrors)),d},_refreshSettingsPreviewReference:function(){FLBuilder.preview&&FLBuilder.preview._initElementsAndClasses()},_openNestedSettings:function(t){t.className&&-1===t.className.indexOf("fl-builder-settings-lightbox")&&(t.className+=" fl-builder-settings-lightbox"),t=e.extend({className:"fl-builder-lightbox fl-builder-settings-lightbox",destroyOnClose:!0,resizable:!0},t);var i=e(".fl-lightbox-wrap:visible"),l=i.find(".fl-lightbox"),s=new FLLightbox(t),o=s._node,n=o.find(".fl-lightbox");return i.hide(),o.attr("data-parent",i.attr("data-instance-id")),n.attr("style",l.attr("style")),s.on("resized",FLBuilder._calculateSettingsTabsOverflow),s.open('<div class="fl-builder-lightbox-loading"></div>'),s},_closeNestedSettings:function(){var t=e(".fl-builder-lightbox[data-parent]:visible"),i=t.find(".fl-lightbox"),l=t.attr("data-instance-id"),s=FLLightbox._instances[l],o=t.attr("data-parent"),n=e('[data-instance-id="'+o+'"]'),r=n.find(".fl-lightbox"),a=n.find("form"),d=FLLightbox._instances[o];s.on("close",function(){r.attr("style",i.attr("style")),n.show(),d._resize(),n.find("label.error").remove(),a.validate().hideErrors(),FLBuilder._toggleSettingsTabErrors()}),s.close()},_showHelpTooltip:function(){e(this).siblings(".fl-help-tooltip-text").fadeIn()},_hideHelpTooltip:function(){e(this).siblings(".fl-help-tooltip-text").fadeOut()},_initAutoSuggestFields:function(){var t=e(".fl-builder-settings:visible .fl-suggest-field"),i=null,l=null,s=null,o=[];t.each(function(){i=e(this),""!==i.attr("data-value")&&(FLBuilderSettingsForms.showFieldLoader(i),o.push({name:i.attr("name"),value:i.attr("data-value"),action:i.attr("data-action"),data:i.attr("data-action-data")}))}),o.length?FLBuilder.ajax({action:"get_autosuggest_values",fields:o},function(i){l=JSON.parse(i);for(s in l)e('.fl-suggest-field[name="'+s+'"]').attr("data-value",l[s]);t.each(FLBuilder._initAutoSuggestField)}):t.each(FLBuilder._initAutoSuggestField)},_initAutoSuggestField:function(){var t=e(this);t.autoSuggest(FLBuilder._ajaxUrl({fl_action:"fl_builder_autosuggest",fl_as_action:t.data("action"),fl_as_action_data:t.data("action-data"),_wpnonce:FLBuilderConfig.ajaxNonce}),e.extend({},{asHtmlID:t.attr("name"),selectedItemProp:"name",searchObjProps:"name",minChars:3,keyDelay:1e3,fadeOut:!1,usePlaceholder:!0,emptyText:FLBuilderStrings.noResultsFound,showResultListWhenNoMatch:!0,preFill:t.data("value"),queryParam:"fl_as_query",afterSelectionAdd:FLBuilder._updateAutoSuggestField,afterSelectionRemove:FLBuilder._updateAutoSuggestField,selectionLimit:t.data("limit")},t.data("args"))),FLBuilderSettingsForms.hideFieldLoader(t)},_updateAutoSuggestField:function(t,i,l){e(this).siblings(".as-values").val(l.join(",")).trigger("change")},_initCodeFields:function(){e(".fl-builder-settings:visible").find(".fl-code-field").each(FLBuilder._initCodeField)},_initCodeField:function(){var t=e(this),i=t.find("textarea"),l=(i.attr("id"),i.data("editor")),s=i.data("wrap"),o=e("<div>",{position:"absolute",height:20*parseInt(i.attr("rows"),10)}),n=null;o.insertBefore(i),i.css("display","none"),ace.require("ace/ext/language_tools"),n=ace.edit(o[0]),n.$blockScrolling=1/0,n.getSession().setValue(i.val()),n.getSession().setMode("ace/mode/"+l),s&&n.getSession().setUseWrapMode(!0),n.setOptions({enableBasicAutocompletion:!0,enableLiveAutocompletion:!0,enableSnippets:!1,showLineNumbers:!1,showFoldWidgets:!1}),n.getSession().on("change",function(e){i.val(n.getSession().getValue()).trigger("change")}),i.closest(".fl-field").data("editor",n)},_initMultipleFields:function(){for(var t=e(".fl-builder-settings:visible .fl-builder-field-multiples"),i=null,l=null,s=0,o=FLBuilderConfig.isRtl?{left:10}:{right:10};s<t.length;s++)i=t.eq(s),l=i.find(".fl-builder-field-multiple"),1===l.length?l.eq(0).find(".fl-builder-field-actions").addClass("fl-builder-field-actions-single"):l.find(".fl-builder-field-actions").removeClass("fl-builder-field-actions-single");e(".fl-builder-field-multiples").sortable({items:".fl-builder-field-multiple",cursor:"move",cursorAt:o,distance:5,opacity:.5,placeholder:"fl-builder-field-dd-zone",stop:FLBuilder._fieldDragStop,tolerance:"pointer",axis:"y"})},_addFieldClicked:function(){var t=e(this),i=t.attr("data-field"),l=t.closest("tr").siblings("tr[data-field="+i+"]").last(),s=l.clone(),o=s.find(".fl-form-field"),n=null,r=parseInt(l.find("label span.fl-builder-field-index").html(),10)+1;s.find("th label span.fl-builder-field-index").html(r),s.find(".fl-form-field-preview-text").html(""),s.find("input, textarea, select").val(""),l.after(s),FLBuilder._initMultipleFields(),o.length&&(n=o.find(".fl-form-field-edit").data("type"),o.find("input").val(JSON.stringify(FLBuilderSettingsConfig.defaults.forms[n])))},_copyFieldClicked:function(){var t=e(this),i=t.closest("tr"),l=i.clone(),s=parseInt(i.find("label span.fl-builder-field-index").html(),10)+1;l.find("th label span.fl-builder-field-index").html(s),i.after(l),FLBuilder._renumberFields(i.parent()),FLBuilder._initMultipleFields(),FLBuilder.preview.delayPreview()},_deleteFieldClicked:function(){var t=e(this).closest("tr"),i=t.parent(),l=confirm(FLBuilderStrings.deleteFieldMessage);l&&(t.remove(),FLBuilder._renumberFields(i),FLBuilder._initMultipleFields(),FLBuilder.preview.delayPreview())},_renumberFields:function(e){for(var t=e.find(".fl-builder-field-multiple"),i=0;i<t.length;i++)t.eq(i).find("th label span.fl-builder-field-index").html(i+1)},_fieldDragHelper:function(){return e('<div class="fl-builder-field-dd-helper"></div>')},_fieldDragStop:function(e,t){FLBuilder._renumberFields(t.item.parent()),FLBuilder.preview.delayPreview()},_initSelectFields:function(){e(".fl-builder-settings:visible").find(".fl-builder-settings-fields select").trigger("change")},_settingsSelectChanged:function(){var t=e(this),i=t.attr("data-toggle"),l=t.attr("data-hide"),s=t.attr("data-trigger"),o=t.val(),n=0;if("undefined"!=typeof i){i=JSON.parse(i);for(n in i)FLBuilder._settingsSelectToggle(i[n].fields,"hide","#fl-field-"),FLBuilder._settingsSelectToggle(i[n].sections,"hide","#fl-builder-settings-section-"),FLBuilder._settingsSelectToggle(i[n].tabs,"hide","a[href*=fl-builder-settings-tab-","]");"undefined"!=typeof i[o]&&(FLBuilder._settingsSelectToggle(i[o].fields,"show","#fl-field-"),FLBuilder._settingsSelectToggle(i[o].sections,"show","#fl-builder-settings-section-"),FLBuilder._settingsSelectToggle(i[o].tabs,"show","a[href*=fl-builder-settings-tab-","]"))}if("undefined"!=typeof l&&(l=JSON.parse(l),"undefined"!=typeof l[o]&&(FLBuilder._settingsSelectToggle(l[o].fields,"hide","#fl-field-"),FLBuilder._settingsSelectToggle(l[o].sections,"hide","#fl-builder-settings-section-"),FLBuilder._settingsSelectToggle(l[o].tabs,"hide","a[href*=fl-builder-settings-tab-","]"))),"undefined"!=typeof s&&(s=JSON.parse(s),"undefined"!=typeof s[o]&&"undefined"!=typeof s[o].fields))for(n=0;n<s[o].fields.length;n++)e("#fl-field-"+s[o].fields[n]).find("select").trigger("change");FLBuilder._calculateSettingsTabsOverflow()},_settingsSelectToggle:function(t,i,l,s){var o=0;if(s="undefined"==typeof s?"":s,"undefined"!=typeof t)for(;o<t.length;o++)e(".fl-builder-settings:visible").find(l+t[o]+s)[i](),e(l+t[o]+s).parent().find('.fl-field[data-type="code"]').each(function(){e(this).data("editor").resize()})},_initColorPickers:function(){var t=FLBuilderConfig.colorPresets?FLBuilderConfig.colorPresets:[];FLBuilder.colorPicker=new FLBuilderColorPicker({mode:"hsv",elements:".fl-color-picker .fl-color-picker-value",presets:t,labels:{colorPresets:FLBuilderStrings.colorPresets,colorPicker:FLBuilderStrings.colorPicker,placeholder:FLBuilderStrings.placeholder,removePresetConfirm:FLBuilderStrings.removePresetConfirm,noneColorSelected:FLBuilderStrings.noneColorSelected,alreadySaved:FLBuilderStrings.alreadySaved,noPresets:FLBuilderStrings.noPresets,presetAdded:FLBuilderStrings.presetAdded}}),e(FLBuilder.colorPicker).on("presetRemoved presetAdded",function(e,t){FLBuilder.ajax({action:"save_color_presets",presets:t.presets})})},_initSinglePhotoSelector:function(){null===FLBuilder._singlePhotoSelector&&(FLBuilder._singlePhotoSelector=wp.media({title:FLBuilderStrings.selectPhoto,button:{text:FLBuilderStrings.selectPhoto},library:{type:"image"},multiple:!1}),FLBuilder._singlePhotoSelector.on("open",FLBuilder._wpmedia_reset_errors),_wpPluploadSettings.defaults.multipart_params.fl_upload_type="photo")},_selectSinglePhoto:function(){FLBuilder._initSinglePhotoSelector(),FLBuilder._singlePhotoSelector.once("open",e.proxy(FLBuilder._singlePhotoOpened,this)),FLBuilder._singlePhotoSelector.once("select",e.proxy(FLBuilder._singlePhotoSelected,this)),FLBuilder._singlePhotoSelector.open()},_singlePhotoOpened:function(){var t=FLBuilder._singlePhotoSelector.state().get("selection"),i=e(this).closest(".fl-photo-field"),l=i.find("input[type=hidden]"),s=l.val(),o=null;e(this).hasClass("fl-photo-replace")?(t.reset(),i.addClass("fl-photo-empty"),l.val("")):""!==s?(o=wp.media.attachment(s),o.fetch(),t.add(o?[o]:[])):t.reset()},_singlePhotoSelected:function(){var t=FLBuilder._singlePhotoSelector.state().get("selection").first().toJSON(),i=e(this).closest(".fl-photo-field"),l=i.find("input[type=hidden]"),s=i.find(".fl-photo-preview img"),o=i.find("select");l.val(t.id),s.attr("src",FLBuilder._getPhotoSrc(t)),i.removeClass("fl-photo-empty").removeClass("fl-photo-no-attachment"),i.find("label.error").remove(),o.show(),o.html(FLBuilder._getPhotoSizeOptions(t)),o.trigger("change"),FLBuilderSettingsConfig.attachments[t.id]=t},_singlePhotoRemoved:function(){FLBuilder._initSinglePhotoSelector();var t=FLBuilder._singlePhotoSelector.state(),i="undefined"!=typeof t?t.get("selection"):null,l=e(this).closest(".fl-photo-field"),s=l.find("input[type=hidden]"),o=l.find("select");i&&i.reset(),l.addClass("fl-photo-empty"),s.val(""),o.html('<option value="" selected></option>'),o.trigger("change")},_getPhotoSrc:function(e){return"undefined"==typeof e.sizes?e.url:"undefined"!=typeof e.sizes.thumbnail?e.sizes.thumbnail.url:e.sizes.full.url},_getPhotoSizeOptions:function(e,t){var i="",l=null,s=null,o="",n={full:FLBuilderStrings.fullSize,large:FLBuilderStrings.large,medium:FLBuilderStrings.medium,thumbnail:FLBuilderStrings.thumbnail};if("undefined"==typeof e.sizes||0===e.sizes.length)i+='<option value="'+e.url+'">'+FLBuilderStrings.fullSize+"</option>";else{t&&(t=t.replace(/https?/,""));for(l in e.sizes)o="undefined"!=typeof n[l]?n[l]+" - ":"undefined"!=typeof FLBuilderConfig.customImageSizeTitles[l]?FLBuilderConfig.customImageSizeTitles[l]+" - ":"",s="",t?t===e.sizes[l].url.replace(/https?/,"")&&(s=' selected="selected"'):s="full"==l?' selected="selected"':"",i+='<option value="'+e.sizes[l].url+'"'+s+">"+o+e.sizes[l].width+" x "+e.sizes[l].height+"</option>"}return i},_selectMultiplePhotos:function(){var t=e(this).closest(".fl-multiple-photos-field"),i=t.find("input[type=hidden]"),l=i.val(),s=""===l?"":JSON.parse(l),o=wp.media.gallery.defaults.id,n='[gallery ids="-1"]',r=null,a=null,d=null,u=null,c=[];if("object"==typeof s){for(u in s)c.push(s[u]);n='[gallery ids="'+c.join()+'"]'}r=wp.shortcode.next("gallery",n).shortcode,_.isUndefined(r.get("id"))&&!_.isUndefined(o)&&r.set("id",o),a=wp.media.gallery.attachments(r),d=new wp.media.model.Selection(a.models,{props:a.props.toJSON(),multiple:!0}),d.gallery=a.gallery,d.more().done(function(){d.length||FLBuilder._multiplePhotoSelector.setState("gallery-library"),
|
5 |
d.props.set({query:!1}),d.unmirror(),d.props.unset("orderby")}),FLBuilder._multiplePhotoSelector&&FLBuilder._multiplePhotoSelector.dispose(),FLBuilder._multiplePhotoSelector=wp.media({frame:"post",state:e(this).hasClass("fl-multiple-photos-edit")?"gallery-edit":"gallery-library",title:wp.media.view.l10n.editGalleryTitle,editing:!0,multiple:!0,selection:d}).open(),e(FLBuilder._multiplePhotoSelector.views.view.el).addClass("fl-multiple-photos-lightbox"),FLBuilder._multiplePhotoSelector.once("update",e.proxy(FLBuilder._multiplePhotosSelected,this))},_multiplePhotosSelected:function(t){for(var i=e(this).closest(".fl-multiple-photos-field"),l=i.find("input[type=hidden]"),s=i.find(".fl-multiple-photos-count"),o=[],n=0;n<t.models.length;n++)o.push(t.models[n].id);1==o.length?s.html("1 "+FLBuilderStrings.photoSelected):s.html(o.length+" "+FLBuilderStrings.photosSelected),i.removeClass("fl-multiple-photos-empty"),i.find("label.error").remove(),l.val(JSON.stringify(o)).trigger("change")},_selectSingleVideo:function(){null===FLBuilder._singleVideoSelector&&(FLBuilder._singleVideoSelector=wp.media({title:FLBuilderStrings.selectVideo,button:{text:FLBuilderStrings.selectVideo},library:{type:"video"},multiple:!1}),FLBuilder._singleVideoSelector.on("open",FLBuilder._wpmedia_reset_errors),_wpPluploadSettings.defaults.multipart_params.fl_upload_type="video"),FLBuilder._singleVideoSelector.once("select",e.proxy(FLBuilder._singleVideoSelected,this)),FLBuilder._singleVideoSelector.open()},_singleVideoSelected:function(){var t=FLBuilder._singleVideoSelector.state().get("selection").first().toJSON(),i=e(this).closest(".fl-video-field"),l=i.find(".fl-video-preview-img"),s=i.find(".fl-video-preview-filename"),o=i.find("input[type=hidden]");l.html('<span class="dashicons dashicons-media-video"></span>'),s.html(t.filename),i.removeClass("fl-video-empty"),i.find("label.error").remove(),o.val(t.id).trigger("change"),FLBuilderSettingsConfig.attachments[t.id]=t},_selectMultipleAudios:function(){var t=e(this).closest(".fl-multiple-audios-field"),i=t.find("input[type=hidden]"),l=i.val(),s=""==l?'[playlist ids="-1"]':'[playlist ids="'+JSON.parse(l).join()+'"]',o=wp.shortcode.next("playlist",s).shortcode,n=wp.media.playlist.defaults.id,r=null,a=null;_.isUndefined(o.get("id"))&&!_.isUndefined(n)&&o.set("id",n),r=wp.media.playlist.attachments(o),a=new wp.media.model.Selection(r.models,{props:r.props.toJSON(),multiple:!0}),a.playlist=r.playlist,a.more().done(function(){a.props.set({query:!1}),a.unmirror(),a.props.unset("orderby")}),FLBuilder._multipleAudiosSelector&&FLBuilder._multipleAudiosSelector.dispose(),FLBuilder._multipleAudiosSelector=wp.media({frame:"post",state:e(this).hasClass("fl-multiple-audios-edit")?"playlist-edit":"playlist-library",title:wp.media.view.l10n.editPlaylistTitle,editing:!0,multiple:!0,selection:a}).open(),FLBuilder._multipleAudiosSelector.content.get("view").sidebar.unset("playlist"),FLBuilder._multipleAudiosSelector.on("content:render:browse",function(e){e&&e.sidebar.on("ready",function(){e.sidebar.unset("playlist")})}),FLBuilder._multipleAudiosSelector.once("update",e.proxy(FLBuilder._multipleAudiosSelected,this))},_multipleAudiosSelected:function(t){for(var i=e(this).closest(".fl-multiple-audios-field"),l=i.find(".fl-multiple-audios-count"),s=i.find("input[type=hidden]"),o=[],n=0;n<t.models.length;n++)o.push(t.models[n].id);1==o.length?l.html("1 "+FLBuilderStrings.audioSelected):l.html(o.length+" "+FLBuilderStrings.audiosSelected),s.val(JSON.stringify(o)).trigger("change"),i.removeClass("fl-multiple-audios-empty"),i.find("label.error").remove()},_selectIcon:function(){var e=this;FLIconSelector.open(function(t){FLBuilder._iconSelected.apply(e,[t])})},_iconSelected:function(t){var i=e(this).closest(".fl-icon-field"),l=i.find("input[type=hidden]"),s=i.find("i"),o=s.attr("data-icon");l.val(t).trigger("change"),s.removeClass(o),s.addClass(t),s.attr("data-icon",t),i.removeClass("fl-icon-empty"),i.find("label.error").remove()},_removeIcon:function(){var t=e(this).closest(".fl-icon-field"),i=t.find("input[type=hidden]"),l=t.find("i");i.val("").trigger("change"),l.removeClass(),l.attr("data-icon",""),t.addClass("fl-icon-empty")},_formFieldClicked:function(){var t=e(this),i=t.closest(".fl-builder-settings"),l=t.attr("data-type"),s=t.siblings("input").val(),o=FLBuilder._moduleHelpers[l],n=(FLBuilderSettingsConfig.forms[l],FLBuilder._openNestedSettings({className:"fl-builder-lightbox fl-form-field-settings"}));""===s&&(s=JSON.stringify(FLBuilderSettingsConfig.forms[l])),FLBuilderSettingsForms.render({id:l,nodeId:i.attr("data-node"),nodeSettings:FLBuilder._getSettings(i),settings:JSON.parse(s.replace(/'/g,"'")),lightbox:n,helper:o,rules:o?o.rules:null},function(){t.attr("id","fl-"+n._node.attr("data-instance-id")),n._node.find("form.fl-builder-settings").attr("data-type",l)})},_saveFormFieldClicked:function(){var t=e(this).closest(".fl-builder-settings"),i=e(this).closest(".fl-lightbox-wrap").attr("data-instance-id"),l=t.attr("data-type"),s=FLBuilder._getSettings(t),o={},n=FLBuilder._moduleHelpers[l],r=e(".fl-builder-settings #fl-"+i),a=r.parent().attr("data-preview-text"),d=t.find("#fl-field-"+a),u=s[a],c=e('select[name="'+a+'"]'),h=document.createElement("div"),f=!0;return c.length>0&&(u=c.find('option[value="'+s[a]+'"]').text()),"undefined"!=typeof n&&(t.find("label.error").remove(),t.validate().hideErrors(),f=t.validate().form(),f&&(f=n.submit())),f?("undefined"!=typeof a&&"undefined"!=typeof u&&("icon"===d.data("type")?u='<i class="'+u+'"></i>':u.length>35&&(h.innerHTML=u,u=(h.textContent||h.innerText||"").replace(/^(.{35}[^\s]*).*/,"$1")+"..."),r.siblings(".fl-form-field-preview-text").html(u)),o=r.siblings("input").val().replace(/'/g,"'"),""!=o&&(s=e.extend(JSON.parse(o),s)),r.siblings("input").val(JSON.stringify(s)).trigger("change"),FLBuilder._closeNestedSettings(),!0):(FLBuilder._toggleSettingsTabErrors(),!1)},_layoutFieldClicked:function(){var t=e(this);t.siblings().removeClass("fl-layout-field-option-selected"),t.addClass("fl-layout-field-option-selected"),t.siblings("input").val(t.attr("data-value"))},_initLinkFields:function(){e(".fl-builder-settings:visible .fl-link-field").each(FLBuilder._initLinkField)},_initLinkField:function(){var t=e(this),i=t.find(".fl-link-field-search-input");i.autoSuggest(FLBuilder._ajaxUrl({fl_action:"fl_builder_autosuggest",fl_as_action:"fl_as_links",_wpnonce:FLBuilderConfig.ajaxNonce}),{asHtmlID:i.attr("name"),selectedItemProp:"name",searchObjProps:"name",minChars:3,keyDelay:1e3,fadeOut:!1,usePlaceholder:!0,emptyText:FLBuilderStrings.noResultsFound,showResultListWhenNoMatch:!0,queryParam:"fl_as_query",selectionLimit:1,afterSelectionAdd:FLBuilder._updateLinkField})},_updateLinkField:function(e,t,i){var l=e.closest(".fl-link-field"),s=l.find(".fl-link-field-search"),o=l.find(".fl-link-field-search-input"),n=l.find(".fl-link-field-input");n.val(t.value).trigger("keyup"),o.autoSuggest("remove",t.value),s.hide()},_linkFieldSelectClicked:function(){var t=e(this).closest(".fl-link-field").find(".fl-link-field-search");t.show(),t.find("input").focus()},_linkFieldSelectCancelClicked:function(){var t=e(this);t.parent().hide(),t.closest(".fl-link-field").find("input.fl-link-field-input").focus()},_initFontFields:function(){e(".fl-builder-settings:visible .fl-font-field").each(FLBuilder._initFontField)},_initFontField:function(){var t=e(this),i=t.attr("data-value"),l=t.find(".fl-font-field-font"),s=t.find(".fl-font-field-weight");l.on("change",function(){FLBuilder._getFontWeights(l)}),i.indexOf("family")>-1&&(i=JSON.parse(i),l.val(i.family),l.trigger("change"),s.find("option[value="+i.weight+"]").length&&s.val(i.weight))},_getFontWeights:function(t){var i=t.next(".fl-font-field-weight"),l=t.val(),s={"default":"Default",regular:"Regular",100:"Thin 100",200:"Extra-Light 200",300:"Light 300",400:"Normal 400",500:"Medium 500",600:"Semi-Bold 600",700:"Bold 700",800:"Extra-Bold 800",900:"Ultra-Bold 900"},o={};i.html(""),o="undefined"!=typeof FLBuilderFontFamilies.system[l]?FLBuilderFontFamilies.system[l].weights:"undefined"!=typeof FLBuilderFontFamilies.google[l]?FLBuilderFontFamilies.google[l]:FLBuilderFontFamilies["default"][l],e.each(o,function(e,t){i.append('<option value="'+t+'">'+s[t]+"</option>")})},_initTinyMCE:function(){tinymce.ui.FloatPanel.zIndex=100100,e(".fl-builder-hidden-editor").each(FLBuilder._initEditorField)},_initEditorFields:function(){e(".fl-builder-settings:visible .fl-editor-field").each(FLBuilder._initEditorField)},_initEditorField:function(){var t=e(this),i=t.find("textarea"),l=t.attr("data-name"),s="flrich"+(new Date).getTime()+"_"+l,o=FLBuilderConfig.wp_editor,n=tinyMCEPreInit,r=Number(t.attr("data-buttons")),a=t.attr("data-rows"),d=null,u=null;o=o.replace(/flbuildereditor/g,s),n=JSON.parse(JSON.stringify(n).replace(/flbuildereditor/g,s)),i.after(o).remove(),e("textarea#"+s).val(i.val()),void 0!==typeof tinymce&&void 0!==n.mceInit[s]&&(d=n.mceInit[s],u=tinymce.$("#wp-"+s+"-wrap"),u.find("textarea").attr("rows",a),r||u.find(".wp-media-buttons").remove(),!u.hasClass("tmce-active")&&n.qtInit.hasOwnProperty(s)||d.wp_skip_init||tinymce.init(d)),void 0!==typeof quicktags&&quicktags(n.qtInit[s]),window.wpActiveEditor=s},_reinitEditorFields:function(){e(".fl-lightbox-resizable:visible").length&&setTimeout(function(){var t,i;if("undefined"!=typeof tinymce){for(t=tinymce.editors.length-1;t>-1;t--)i=tinymce.editors[t].id,tinyMCE.execCommand("mceRemoveEditor",!0,i),tinyMCE.execCommand("mceAddEditor",!0,i);FLBuilder.preview&&FLBuilder.preview._initDefaultFieldPreviews(e('.fl-field[data-type="editor"]'))}},1)},_destroyEditorFields:function(){var t;if("undefined"!=typeof tinymce){for(t=tinymce.editors.length-1;t>-1;t--)tinyMCE.execCommand("mceRemoveEditor",!0,tinymce.editors[t].id);e(".wplink-autocomplete").remove(),e(".ui-helper-hidden-accessible").remove()}},_updateEditorFields:function(){var t=e(".fl-builder-settings:visible textarea.wp-editor-area");t.each(FLBuilder._updateEditorField)},_updateEditorField:function(){var t=e(this),i=t.closest(".fl-editor-field"),l=(t.closest(".fl-builder-settings"),t.closest(".wp-editor-wrap")),s=t.attr("id"),o=i.attr("data-name"),n="undefined"!=typeof tinyMCE&&tinyMCE.get(s),r=t.siblings('textarea[name="'+o+'"]'),a=i.data("wpautop");0===r.length&&(r=e('<textarea name="'+o+'"></textarea>').hide(),t.after(r)),a?n&&l.hasClass("tmce-active")?r.val(n.getContent()):"undefined"!=typeof switchEditors?r.val(switchEditors.wpautop(t.val())):r.val(t.val()):(n&&l.hasClass("tmce-active")&&n.save(),r.val(t.val()))},_loopDataSourceChange:function(){var t=e(this).val();e(".fl-loop-data-source").hide(),e('.fl-loop-data-source[data-source="'+t+'"]').show()},_customQueryPostTypeChange:function(){var t=e(this).val();e(".fl-custom-query-filter").hide(),e(".fl-custom-query-"+t+"-filter").show()},_initOrderingFields:function(){e(".fl-builder-settings:visible .fl-ordering-field-options").each(FLBuilder._initOrderingField)},_initOrderingField:function(){e(this).sortable({items:".fl-ordering-field-option",containment:"parent",tolerance:"pointer",stop:FLBuilder._updateOrderingField})},_updateOrderingField:function(t){var i=e(t.target),l=i.siblings("input[type=hidden]"),s=[];i.find(".fl-ordering-field-option").each(function(){s.push(e(this).attr("data-key"))}),l.val(JSON.stringify(s)).trigger("change")},_onNumberFieldFocus:function(t){var i=e(t.currentTarget);i.addClass("mousetrap"),Mousetrap.bind("up",function(){i.attr("step",1)}),Mousetrap.bind("down",function(){i.attr("step",1)}),Mousetrap.bind("shift+up",function(){i.attr("step",10)}),Mousetrap.bind("shift+down",function(){i.attr("step",10)})},_onNumberFieldBlur:function(t){var i=e(t.currentTarget);i.attr("step",1).removeClass("mousetrap")},_initTimezoneFields:function(){e(".fl-builder-settings:visible .fl-field[data-type=timezone]").each(FLBuilder._initTimezoneField)},_initTimezoneField:function(){var t=e(this).find("select"),i=t.attr("data-value");t.find('option[value="'+i+'"]').attr("selected","selected")},ajax:function(t,i){var l;FLBuilder.triggerHook("didBeginAJAX",t);for(l in t)"undefined"==typeof t[l]&&(t[l]=null);return t._wpnonce=FLBuilderConfig.ajaxNonce,t.post_id=FLBuilderConfig.postId,t.fl_builder=1,t.fl_action=t.action,"undefined"!=typeof t.settings&&(t.settings=FLBuilder._ajaxModSecFix(e.extend(!0,{},t.settings))),"undefined"!=typeof t.node_settings&&(t.node_settings=FLBuilder._ajaxModSecFix(e.extend(!0,{},t.node_settings))),t={fl_builder_data:t},e.post(FLBuilder._ajaxUrl(),t,function(e){FLBuilder._ajaxComplete(),"undefined"!=typeof i&&i.call(this,e),FLBuilder.triggerHook("didCompleteAJAX",t)})},_ajaxComplete:function(){FLBuilder.hideAjaxLoader()},_ajaxUrl:function(e){var t=window.location.href.split("#").shift(),i=null;if("undefined"!=typeof e)for(i in e)t+=t.indexOf("?")>-1?"&":"?",t+=i+"="+e[i];return t},showAjaxLoader:function(){0===e(".fl-builder-lightbox-loading").length&&e(".fl-builder-loading").show()},hideAjaxLoader:function(){e(".fl-builder-loading").hide()},_showNodeLoading:function(t){var i=e(".fl-node-"+t);i.addClass("fl-builder-node-loading")},_hideNodeLoading:function(t){var i=e(".fl-node-"+t);i.removeClass("fl-builder-node-loading")},_showNodeLoadingPlaceholder:function(t,i){var l=e('<div class="fl-builder-node-loading-placeholder"></div>');t.hasClass("fl-builder-content")?siblings=t.find(".fl-row"):t.hasClass("fl-row-content")?siblings=t.find(" > .fl-col-group"):t.hasClass("fl-col-group")?(t.addClass("fl-col-group-has-child-loading"),siblings=t.find(" > .fl-col")):siblings=t.find(" > .fl-col-group, > .fl-module"),0===siblings.length||siblings.length==i?t.append(l):siblings.eq(i).before(l)},_removeNodeLoadingPlaceholder:function(e){var t=e.prev(".fl-builder-node-loading-placeholder"),i=e.next(".fl-builder-node-loading-placeholder");t.length?t.remove():i.remove()},_ajaxModSecFix:function(e){var t;if(FLBuilderConfig.modSecFix&&"undefined"!=typeof btoa)if("string"==typeof e)e=FLBuilder._btoa(e);else for(t in e)"string"==typeof e[t]?e[t]=FLBuilder._btoa(e[t]):"object"==typeof e[t]&&(e[t]=FLBuilder._ajaxModSecFix(e[t]));return e},_btoa:function(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,function(e,t){return String.fromCharCode("0x"+t)}))},_wpmedia_reset_errors:function(){e(".upload-error").remove(),e(".media-uploader-status").removeClass("errors").hide()},_initLightboxes:function(){FLBuilder._lightbox=new FLLightbox({className:"fl-builder-lightbox fl-builder-settings-lightbox",resizable:!0}),FLBuilder._lightbox.on("resized",FLBuilder._calculateSettingsTabsOverflow),FLBuilder._lightbox.on("close",FLBuilder._lightboxClosed),FLBuilder._lightbox.on("beforeCloseLightbox",FLBuilder._destroyEditorFields),FLBuilder._actionsLightbox=new FLLightbox({className:"fl-builder-actions-lightbox"})},_showLightbox:function(){FLBuilder._lightbox.open('<div class="fl-builder-lightbox-loading"></div>'),FLBuilder._removeAllOverlays(),FLBuilder._initLightboxScrollbars()},_setLightboxContent:function(e){FLBuilder._lightbox.setContent(e)},_initLightboxScrollbars:function(){FLBuilder._initScrollbars(),FLBuilder._lightboxScrollbarTimeout=setTimeout(FLBuilder._initLightboxScrollbars,500)},_lightboxClosed:function(){FLBuilder.triggerHook("settings-lightbox-closed"),FLBuilder._lightbox.empty(),clearTimeout(FLBuilder._lightboxScrollbarTimeout)},_showActionsLightbox:function(e){var t=wp.template("fl-actions-lightbox");FLBuilder.triggerHook("actions-lightbox-settings",e),FLBuilder._actionsLightbox.open(t(e))},alert:function(e){var t=new FLLightbox({className:"fl-builder-alert-lightbox",destroyOnClose:!0}),i=wp.template("fl-alert-lightbox");t.open(i({message:e}))},_alertClose:function(){FLLightbox.closeParent(this)},confirm:function(t){var i={message:"",ok:function(){},cancel:function(){},strings:{ok:FLBuilderStrings.ok,cancel:FLBuilderStrings.cancel}},l=e.extend({},i,"undefined"==typeof t?{}:t);lightbox=new FLLightbox({className:"fl-builder-confirm-lightbox fl-builder-alert-lightbox",destroyOnClose:!0}),template=wp.template("fl-confirm-lightbox"),lightbox.open(template(l)),lightbox._node.find(".fl-builder-confirm-ok").on("click",l.ok),lightbox._node.find(".fl-builder-confirm-cancel").on("click",l.cancel)},triggerHook:function(t,i){e("body").trigger("fl-builder."+t,i)},addHook:function(t,i){e("body").on("fl-builder."+t,i)},removeHook:function(t,i){e("body").off("fl-builder."+t,i)},log:function(e){"undefined"!=typeof window.console&&"undefined"!=typeof window.console.log&&console.log(e)},logError:function(e){var t=null;"undefined"!=typeof e&&("undefined"!=typeof e.stack?t=e.stack:"undefined"!=typeof e.message&&(t=e.message),t&&(FLBuilder.log("************************************************************************"),FLBuilder.log(FLBuilderStrings.errorMessage),FLBuilder.log(t),FLBuilder.log("************************************************************************")))},logGlobalError:function(e,t,i,l,s){FLBuilder.log("************************************************************************"),FLBuilder.log(FLBuilderStrings.errorMessage),FLBuilder.log(FLBuilderStrings.globalErrorMessage.replace("{message}",e).replace("{line}",i).replace("{file}",t)),"undefined"!=typeof s&&"undefined"!=typeof s.stack&&(FLBuilder.log(s.stack),FLBuilder.log("************************************************************************"))}},e(function(){FLBuilder._init()})}(jQuery),function(e){FLBuilderAJAXLayout=function(t,i){this._data=e.extend({},this._defaults,"string"==typeof t?JSON.parse(t):t),this._callback=i,this._post=FLBuilderConfig.postId,this._head=e("head").eq(0),this._body=e("body").eq(0),this._data.css&&(this._loader=e('<img src="'+this._data.css+'" />'),this._oldCss=e('link[href*="/cache/'+this._post+'"]'),this._newCss=e('<link rel="stylesheet" id="fl-builder-layout-'+this._post+'-css" href="'+this._data.css+'" />')),this._data.partial?(this._data.js&&(this._oldJs=e("#fl-builder-partial-refresh-js"),this._newJs=e('<script type="text/javascript" id="fl-builder-partial-refresh-js">'+this._data.js+"</script>")),this._data.nodeId&&(this._data.oldNodeId?(this._oldScriptsStyles=e('.fl-builder-node-scripts-styles[data-node="'+this._data.oldNodeId+'"]'),this._content=e(".fl-node-"+this._data.oldNodeId)):(this._oldScriptsStyles=e('.fl-builder-node-scripts-styles[data-node="'+this._data.nodeId+'"]'),this._content=e(".fl-node-"+this._data.nodeId).eq(0)))):(this._oldJs=e('script[src*="/cache/'+this._post+'"]'),this._newJs=e('<script src="'+this._data.js+'"></script>'),this._oldScriptsStyles=e(".fl-builder-layout-scripts-styles"),this._content=e(FLBuilder._contentClass)),this._init()},FLBuilderAJAXLayout.prototype={_defaults:{partial:!1,nodeId:null,nodeType:null,nodeParent:null,nodePosition:null,oldNodeId:null,html:null,scriptsStyles:null,css:null,js:null},_data:null,_callback:function(){},_post:null,_head:null,_body:null,_loader:null,_oldCss:null,_newCss:null,_oldJs:null,_newJs:null,_oldScriptsStyles:null,_content:null,_init:function(){this._body.height(this._body.height()),this._loader?(this._loader.on("error",e.proxy(this._loadNewCSSComplete,this)),this._body.append(this._loader)):this._finish()},_loadNewCSSComplete:function(){this._loader.remove(),this._oldCss.length>0?this._oldCss.after(this._newCss):this._head.append(this._newCss),setTimeout(e.proxy(this._finish,this),250)},_finish:function(){this._removeOldContentAndAssets(),this._cleanNewHTML(),this._cleanNewAssets(),this._addNewHTML(),this._addNewScriptsStyles(),this._addNewJS(),e(FLBuilder._contentClass).trigger("fl-builder.layout-rendered"),FLBuilder.hideAjaxLoader(),"undefined"!=typeof this._callback&&this._callback(),FLBuilder.triggerHook("didRenderLayoutComplete")},_removeOldContentAndAssets:function(){this._content&&this._content.empty(),this._oldCss&&this._oldCss.remove(),this._oldJs&&this._oldJs.remove(),this._oldScriptsStyles&&this._oldScriptsStyles.remove()},_cleanNewHTML:function(){if(this._data.scriptsStyles){var t=e("<div>"+this._data.html+"</div>"),i="fl-row",l=this._data.scriptsStyles,s="";this._data.partial&&(i="column-group"==this._data.nodeType?"fl-col-group":"column"==this._data.nodeType?"fl-col":"fl-"+this._data.nodeType),t.find("> *, script").each(function(){e(this).hasClass(i)||(s=e(this).remove(),l+=s[0].outerHTML)}),""!==l&&(l=this._data.partial?'<div class="fl-builder-node-scripts-styles" data-node="'+this._data.nodeId+'">'+l+"<div>":'<div class="fl-builder-node-scripts-styles">'+l+"<div>"),this._data.html=t.html(),this._data.scriptsStyles=l}},_addNewHTML:function(){var t;this._data.partial?this._data.nodeParent?(t=this._data.nodeParent.hasClass("fl-builder-content")?this._data.nodeParent.find(".fl-row"):this._data.nodeParent.hasClass("fl-row-content")?this._data.nodeParent.find(" > .fl-col-group"):this._data.nodeParent.hasClass("fl-col-group")?this._data.nodeParent.find(" > .fl-col"):this._data.nodeParent.find(" > .fl-col-group, > .fl-module"),t=t.filter(":not(.fl-builder-node-clone)"),0===t.length||t.length==this._data.nodePosition?this._data.nodeParent.append(this._data.html):t.eq(this._data.nodePosition).before(this._data.html),this._data.nodeId&&FLBuilder._removeNodeLoadingPlaceholder(e(".fl-node-"+this._data.nodeId))):(this._content.after(this._data.html),this._content.remove()):this._content.append(this._data.html),FLBuilder.preview&&this._data.nodeId&&this._data.nodeId!=FLBuilder.preview.nodeId&&e(FLBuilder.preview.classes.node).length&&e(FLBuilder.preview.classes.node).html(FLBuilder.preview.elements.node.html())},_cleanNewAssets:function(){var t=this;this._data.html=this._removeDuplicateAssets(this._data.html),this._data.scriptsStyles&&""!==this._data.scriptsStyles&&(this._data.scriptsStyles=this._removeDuplicateAssets(this._data.scriptsStyles)),this._data.partial?e(".fl-builder-node-scripts-styles").each(function(){t._data.html.indexOf("fl-node-"+e(this).data("node"))>-1&&e(this).remove()}):(e("#fl-builder-partial-refresh-js").remove(),e(".fl-builder-node-scripts-styles").remove())},_removeDuplicateAssets:function(t){var i=e("<div>"+t+"</div>"),l="",s=null,o="",n=null,r=window.location,a=r.protocol+"//"+r.hostname+(r.port?":"+r.port:"");return i.find("script").each(function(){l=e(this).attr("src"),"undefined"!=typeof l&&(l=l.replace(a,""),s=e('script[src*="'+l+'"]'),s.length>0&&e(this).remove())}),i.find("link").each(function(){o=e(this).attr("href"),"undefined"!=typeof o&&(o=o.replace(a,""),n=e('link[href*="'+o+'"]'),n.length>0&&e(this).remove())}),i.html()},_addNewScriptsStyles:function(){this._data.scriptsStyles&&""!==this._data.scriptsStyles&&this._body.append(this._data.scriptsStyles)},_addNewJS:function(){setTimeout(e.proxy(function(){this._newJs&&this._head.append(this._newJs)},this),50)},_complete:function(){FLBuilder._setupEmptyLayout(),FLBuilder._highlightEmptyCols(),FLBuilder._initDropTargets(),FLBuilder._initSortables(),FLBuilder._resizeLayout(),FLBuilder._initMediaElements(),FLBuilderLayout.init(),FLBuilderResponsiveEditing.refreshPreview(),this._body.height("auto")}}}(jQuery),function(e){FLBuilderPreview=function(e){this.type=e.type,this._saveState(),e.layout?FLBuilder._renderLayout(e.layout,function(){this._init(),e.callback&&e.callback()}.bind(this)):this._init()},FLBuilderPreview._fontsList={},FLBuilderPreview.prototype={type:"",nodeId:null,classes:{},elements:{},state:null,_savedSettings:null,_styleSheet:null,_styleSheetMedium:null,_styleSheetResponsive:null,_timeout:null,_loaderTimeout:null,_lastClassName:null,_xhr:null,_init:function(){switch(this.nodeId=e(".fl-builder-settings").data("node"),this._saveSettings(),this._initElementsAndClasses(),this._createSheets(),this._initResponsivePreviews(),this._initDefaultFieldPreviews(),this.type){case"row":this._initRow();break;case"col":this._initColumn();break;case"module":this._initModule()}},_saveSettings:function(){var t=e(".fl-builder-settings-lightbox .fl-builder-settings");this._savedSettings=FLBuilder._getSettings(t)},_settingsHaveChanged:function(){var t=e(".fl-builder-settings-lightbox .fl-builder-settings"),i=FLBuilder._getSettings(t);return JSON.stringify(this._savedSettings)!=JSON.stringify(i)},_initElementsAndClasses:function(){var t;t="row"==this.type?".fl-row-content-wrap":".fl-"+this.type+"-content",e.extend(this.classes,{settings:".fl-builder-"+this.type+"-settings",settingsHeader:".fl-builder-"+this.type+"-settings .fl-lightbox-header",node:FLBuilder._contentClass+" .fl-node-"+this.nodeId,content:FLBuilder._contentClass+" .fl-node-"+this.nodeId+" > "+t}),e.extend(this.elements,{settings:e(this.classes.settings),settingsHeader:e(this.classes.settingsHeader),node:e(this.classes.node),content:e(this.classes.content)})},_createSheets:function(){this._destroySheets(),this._styleSheet||(this._styleSheet=new FLStyleSheet({id:"fl-builder-preview",className:"fl-builder-preview-style"})),this._styleSheetMedium||(this._styleSheetMedium=new FLStyleSheet({id:"fl-builder-preview-medium",className:"fl-builder-preview-style"})),this._styleSheetResponsive||(this._styleSheetResponsive=new FLStyleSheet({id:"fl-builder-preview-responsive",className:"fl-builder-preview-style"}))},_destroySheets:function(){this._styleSheet&&(this._styleSheet.destroy(),this._styleSheet=null),this._styleSheetMedium&&(this._styleSheetMedium.destroy(),this._styleSheetMedium=null),this._styleSheetResponsive&&(this._styleSheetResponsive.destroy(),this._styleSheetResponsive=null)},updateCSSRule:function(e,t,i){this._styleSheet.updateRule(e,t,i)},delay:function(e,t){this._cancelDelay(),this._timeout=setTimeout(t,e)},_cancelDelay:function(){null!==this._timeout&&clearTimeout(this._timeout)},hexToRgb:function(e){var t=parseInt(e,16),i=t>>16&255,l=t>>8&255,s=255&t;return[i,l,s]},parseFloat:function(e){return isNaN(parseFloat(e))?0:parseFloat(e)},_initResponsivePreviews:function(){FLBuilder.addHook("responsive-editing-switched",e.proxy(this._responsiveEditingSwitched,this))},_destroyResponsivePreviews:function(){FLBuilder.removeHook("responsive-editing-switched")},_responsiveEditingSwitched:function(e,t){"default"==t?(this._styleSheetMedium.disable(),this._styleSheetResponsive.disable()):"medium"==t?(this._styleSheetMedium.enable(),this._styleSheetResponsive.disable()):"responsive"==t&&(this._styleSheetMedium.disable(),this._styleSheetResponsive.enable())},updateResponsiveCSSRule:function(e,t,i){var l=FLBuilderResponsiveEditing._mode,s="default"==l?"":l.charAt(0).toUpperCase()+l.slice(1);this["_styleSheet"+s].updateRule(e,t,i)},_saveState:function(){var t=FLBuilderConfig.postId,i=e('link[href*="/cache/'+t+'"]').attr("href"),l=e('script[src*="/cache/'+t+'"]').attr("src"),s=e(FLBuilder._contentClass).html();this.state={css:i,js:l,html:s}},preview:function(){var t=e(".fl-builder-settings-lightbox .fl-builder-settings"),i=t.attr("data-node"),l=FLBuilder._getSettings(t);FLBuilder._showNodeLoading(i),this._cancelPreview(),this._xhr=FLBuilder.ajax({action:"render_layout",node_id:i,node_preview:l},e.proxy(this._renderPreview,this))},delayPreview:function(t){var i="undefined"==typeof t?[]:e(t.target).closest("tr").find("th"),l=e(".fl-builder-widget-settings .fl-builder-settings-title"),s=e(".fl-builder-settings .fl-lightbox-header"),o=FLBuilderLayoutConfig.paths.pluginUrl+"img/ajax-loader-small.svg",n=e('<img class="fl-builder-preview-loader" src="'+o+'" />');this.delay(1e3,e.proxy(this.preview,this)),this._loaderTimeout=setTimeout(function(){e(".fl-builder-preview-loader").remove(),i.length>0?i.append(n):l.length>0?l.append(n):s.length>0&&s.append(n)},1500)},_cancelPreview:function(){this._xhr&&(this._xhr.abort(),this._xhr=null)},_renderPreview:function(t){this._xhr=null,FLBuilder._renderLayout(t,e.proxy(this._renderPreviewComplete,this))},_renderPreviewComplete:function(){this._createSheets(),this._initElementsAndClasses(),null!==this._loaderTimeout&&clearTimeout(this._loaderTimeout),e(".fl-builder-preview-loader").remove(),e(FLBuilder._contentClass).trigger("fl-builder.preview-rendered")},revert:function(){return this._settingsHaveChanged()?void FLBuilder._updateNode(this.nodeId,function(){this.clear()}.bind(this)):void this.clear()},cancel:function(){this._cancelDelay(),this._cancelPreview()},clear:function(){this.cancel(),this._destroySheets(),this._destroyResponsivePreviews()},_initNodeTextColor:function(){e.extend(this.elements,{textColor:e(this.classes.settings+" input[name=text_color]"),linkColor:e(this.classes.settings+" input[name=link_color]"),hoverColor:e(this.classes.settings+" input[name=hover_color]"),headingColor:e(this.classes.settings+" input[name=heading_color]")}),this.elements.textColor.on("change",e.proxy(this._textColorChange,this)),this.elements.linkColor.on("change",e.proxy(this._textColorChange,this)),this.elements.hoverColor.on("change",e.proxy(this._textColorChange,this)),this.elements.headingColor.on("change",e.proxy(this._textColorChange,this))},_textColorChange:function(t){var i=this.elements.textColor.val(),l=this.elements.linkColor.val(),s=this.elements.hoverColor.val(),o=this.elements.headingColor.val();l=""===l?i:l,s=""===s?i:s,o=""===o?i:o,this.delay(100,e.proxy(function(){""===i?this.updateCSSRule(this.classes.node,"color","inherit"):this.updateCSSRule(this.classes.node,"color","#"+i),""===l?this.updateCSSRule(this.classes.node+" a","color","inherit"):this.updateCSSRule(this.classes.node+" a","color","#"+l),""===s?this.updateCSSRule(this.classes.node+" a:hover","color","inherit"):this.updateCSSRule(this.classes.node+" a:hover","color","#"+s),""===o?(this.updateCSSRule(this.classes.node+" h1","color","inherit"),this.updateCSSRule(this.classes.node+" h2","color","inherit"),this.updateCSSRule(this.classes.node+" h3","color","inherit"),this.updateCSSRule(this.classes.node+" h4","color","inherit"),this.updateCSSRule(this.classes.node+" h5","color","inherit"),this.updateCSSRule(this.classes.node+" h6","color","inherit"),this.updateCSSRule(this.classes.node+" h1 a","color","inherit"),this.updateCSSRule(this.classes.node+" h2 a","color","inherit"),this.updateCSSRule(this.classes.node+" h3 a","color","inherit"),this.updateCSSRule(this.classes.node+" h4 a","color","inherit"),this.updateCSSRule(this.classes.node+" h5 a","color","inherit"),this.updateCSSRule(this.classes.node+" h6 a","color","inherit")):(this.updateCSSRule(this.classes.node+" h1","color","#"+o),this.updateCSSRule(this.classes.node+" h2","color","#"+o),this.updateCSSRule(this.classes.node+" h3","color","#"+o),this.updateCSSRule(this.classes.node+" h4","color","#"+o),this.updateCSSRule(this.classes.node+" h5","color","#"+o),this.updateCSSRule(this.classes.node+" h6","color","#"+o),this.updateCSSRule(this.classes.node+" h1 a","color","#"+o),this.updateCSSRule(this.classes.node+" h2 a","color","#"+o),this.updateCSSRule(this.classes.node+" h3 a","color","#"+o),this.updateCSSRule(this.classes.node+" h4 a","color","#"+o),this.updateCSSRule(this.classes.node+" h5 a","color","#"+o),this.updateCSSRule(this.classes.node+" h6 a","color","#"+o))},this))},_initNodeBg:function(){e.extend(this.elements,{bgType:e(this.classes.settings+" select[name=bg_type]"),bgColor:e(this.classes.settings+" input[name=bg_color]"),bgColorPicker:e(this.classes.settings+" .fl-picker-bg_color"),bgOpacity:e(this.classes.settings+" input[name=bg_opacity]"),bgImageSrc:e(this.classes.settings+" select[name=bg_image_src]"),bgRepeat:e(this.classes.settings+" select[name=bg_repeat]"),bgPosition:e(this.classes.settings+" select[name=bg_position]"),bgAttachment:e(this.classes.settings+" select[name=bg_attachment]"),bgSize:e(this.classes.settings+" select[name=bg_size]"),bgVideoSource:e(this.classes.settings+" select[name=bg_video_source]"),bgVideo:e(this.classes.settings+" input[name=bg_video]"),bgVideoServiceUrl:e(this.classes.settings+" input[name=bg_video_service_url]"),bgVideoFallbackSrc:e(this.classes.settings+" select[name=bg_video_fallback_src]"),bgSlideshowSource:e(this.classes.settings+" select[name=ss_source]"),bgSlideshowPhotos:e(this.classes.settings+" input[name=ss_photos]"),bgSlideshowFeedUrl:e(this.classes.settings+" input[name=ss_feed_url]"),
|
6 |
-
bgSlideshowSpeed:e(this.classes.settings+" input[name=ss_speed]"),bgSlideshowTrans:e(this.classes.settings+" select[name=ss_transition]"),bgSlideshowTransSpeed:e(this.classes.settings+" input[name=ss_transitionDuration]"),bgParallaxImageSrc:e(this.classes.settings+" select[name=bg_parallax_image_src]"),bgOverlayColor:e(this.classes.settings+" input[name=bg_overlay_color]"),bgOverlayOpacity:e(this.classes.settings+" input[name=bg_overlay_opacity]")}),this.elements.bgType.on("change",e.proxy(this._bgTypeChange,this)),this.elements.bgColor.on("change",e.proxy(this._bgColorChange,this)),this.elements.bgOpacity.on("keyup",e.proxy(this._bgOpacityChange,this)),this.elements.bgImageSrc.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgRepeat.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgPosition.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgAttachment.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgSize.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgVideoServiceUrl.on("change",e.proxy(this._bgVideoChange,this)),this.elements.bgSlideshowSource.on("change",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowPhotos.on("change",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowFeedUrl.on("keyup",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowSpeed.on("keyup",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowTrans.on("change",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowTransSpeed.on("keyup",e.proxy(this._bgSlideshowChange,this)),this.elements.bgParallaxImageSrc.on("change",e.proxy(this._bgParallaxChange,this)),this.elements.bgOverlayColor.on("change",e.proxy(this._bgOverlayChange,this)),this.elements.bgOverlayOpacity.on("keyup",e.proxy(this._bgOverlayChange,this))},_bgTypeChange:function(e){var t=this.elements.bgType.val();this.elements.node.removeClass("fl-row-bg-video"),this.elements.node.removeClass("fl-row-bg-slideshow"),this.elements.node.removeClass("fl-row-bg-parallax"),this.elements.node.find(".fl-bg-video").remove(),this.elements.node.find(".fl-bg-slideshow").remove(),this.elements.content.css("background-image",""),this.updateCSSRule(this.classes.content,{"background-color":"transparent","background-image":"none"}),"none"==t?this._bgOverlayClear():"color"==t?(this.elements.bgColor.trigger("change"),this._bgOverlayClear()):"photo"==t?(this.elements.bgColor.trigger("change"),this.elements.bgImageSrc.trigger("change")):"video"==t?(this.elements.bgColor.trigger("change"),this._bgVideoChange()):"slideshow"==t?(this.elements.bgColor.trigger("change"),this._bgSlideshowChange()):"parallax"==t&&(this.elements.bgColor.trigger("change"),this.elements.bgParallaxImageSrc.trigger("change"))},_bgColorChange:function(t){var i,l,s;""===this.elements.bgColor.val()||isNaN(this.elements.bgOpacity.val())?this.updateCSSRule(this.classes.content,"background-color","transparent"):(i=this.hexToRgb(this.elements.bgColor.val()),l=this.parseFloat(this.elements.bgOpacity.val())/100,s="rgba("+i.join()+", "+l+")",this.delay(100,e.proxy(function(){this.updateCSSRule(this.classes.content,"background-color",s)},this)))},_bgOpacityChange:function(e){this.elements.bgColor.trigger("change")},_bgPhotoChange:function(e){this.elements.bgImageSrc.val()?this.updateCSSRule(this.classes.content,{"background-image":"url("+this.elements.bgImageSrc.val()+")","background-repeat":this.elements.bgRepeat.val(),"background-position":this.elements.bgPosition.val(),"background-attachment":this.elements.bgAttachment.val(),"background-size":this.elements.bgSize.val()}):this.updateCSSRule(this.classes.content,{"background-image":"none"})},_bgVideoChange:function(t){var i=this.elements,l=i.bgVideoSource.val(),s=i.bgVideo.val(),o=i.bgVideoServiceUrl.val(),n="https://www.youtube.com/iframe_api",r="https://player.vimeo.com/api/player.js",a=e("<script>");"video_service"==l&&""!=o?(/^(?:(?:(?:https?:)?\/\/)?(?:www.)?(?:youtu(?:be.com|.be))\/(?:watch\?v\=|v\/|embed\/)?([\w\-]+))/i.test(o)&&e('script[src*="youtube.com"').length<1?a.attr("src",n):/^(http\:\/\/|https\:\/\/)?(www\.)?(vimeo\.com\/)([0-9]+)$/.test(o)&&e('script[src*="vimeo.com"').length<1&&a.attr("src",r),a.attr("type","text/javascript").appendTo("head"),this.delay(500,e.proxy(this.preview,this))):""!=s&&this.preview()},_bgSlideshowChange:function(t){var i=this.elements,l=i.bgSlideshowSource.val(),s=i.bgSlideshowPhotos.val(),o=i.bgSlideshowFeedUrl.val(),n=i.bgSlideshowSpeed.val(),r=i.bgSlideshowTransSpeed.val();"wordpress"==l&&""===s||"smugmug"==l&&""===o||isNaN(parseInt(n))||isNaN(parseInt(r))||this.delay(500,e.proxy(this.preview,this))},_bgParallaxChange:function(e){this.elements.bgParallaxImageSrc.val()&&this.updateCSSRule(this.classes.content,{"background-image":"url("+this.elements.bgParallaxImageSrc.val()+")","background-repeat":"no-repeat","background-position":"center center","background-attachment":"fixed","background-size":"cover"})},_bgOverlayChange:function(t){var i,l,s;""===this.elements.bgOverlayColor.val()||isNaN(this.elements.bgOverlayOpacity.val())?(this.elements.node.removeClass("fl-row-bg-overlay"),this.elements.node.removeClass("fl-col-bg-overlay"),this.updateCSSRule(this.classes.content+":after","background-color","transparent")):(i=this.hexToRgb(this.elements.bgOverlayColor.val()),l=this.parseFloat(this.elements.bgOverlayOpacity.val())/100,s="rgba("+i.join()+", "+l+")",this.delay(100,e.proxy(function(){this.elements.node.hasClass("fl-col")?this.elements.node.addClass("fl-col-bg-overlay"):this.elements.node.addClass("fl-row-bg-overlay"),this.updateCSSRule(this.classes.content+":after","background-color",s)},this)))},_bgOverlayClear:function(e){this.elements.bgOverlayColor.prev(".fl-color-picker-clear").trigger("click")},_initNodeBorder:function(){e.extend(this.elements,{borderType:e(this.classes.settings+" select[name=border_type]"),borderColor:e(this.classes.settings+" input[name=border_color]"),borderColorPicker:e(this.classes.settings+" .fl-picker-border_color"),borderOpacity:e(this.classes.settings+" input[name=border_opacity]")}),this.elements.borderType.on("change",e.proxy(this._borderTypeChange,this)),this.elements.borderColor.on("change",e.proxy(this._borderColorChange,this)),this.elements.borderOpacity.on("keyup",e.proxy(this._borderOpacityChange,this))},_borderTypeChange:function(e){var t=this.elements.borderType.val();this.updateCSSRule(this.classes.content,{"border-style":""===t?"none":t}),this.elements.borderColor.trigger("change"),this.elements.borderTop.trigger("keyup")},_borderColorChange:function(t){var i,l,s;""===this.elements.borderColor.val()||isNaN(this.elements.borderOpacity.val())?this.updateCSSRule(this.classes.content,"border-color","transparent"):(i=this.hexToRgb(this.elements.borderColor.val()),l=parseInt(this.elements.borderOpacity.val())/100,s="rgba("+i.join()+", "+l+")",this.delay(100,e.proxy(function(){this.updateCSSRule(this.classes.content,"border-color",s)},this)))},_borderOpacityChange:function(e){this.elements.borderColor.trigger("change")},_initNodeClassName:function(){e.extend(this.elements,{className:e(this.classes.settings+" input[name=class]")}),this.elements.className.on("keyup",e.proxy(this._classNameChange,this)),this._lastClassName=this.elements.className.val()},_classNameChange:function(e){var t=this.elements.className.val();null!==this._lastClassName&&this.elements.node.removeClass(this._lastClassName),this.elements.node.addClass(t),this._lastClassName=t},_initResponsiveDimensions:function(t){var i={},l=["Top","Bottom","Left","Right"],s=["","Medium","Responsive"],o=this.classes.settings,n="",r="",a=null,d=null;for(a=0;a<l.length;a++)for(d=0;d<s.length;d++)n=t+l[a]+s[d],r=t+"_"+l[a].toLowerCase(),""!=s[d]&&(r+="_"+s[d].toLowerCase()),i[n]=e(o+" input[name="+r+"]"),i[n].on("keyup",e.proxy(this._responsiveDimensionChange,this,t));e.extend(this.elements,i)},_getDimensions:function(e){for(var t=FLBuilderResponsiveEditing._mode,i=["Top","Bottom","Left","Right"],l="default"==t?"":t.charAt(0).toUpperCase()+t.slice(1),s={},o=0;o<i.length;o++)s[i[o].toLowerCase()]=this.elements[e+i[o]+l].val();return this._normalizeDimensionValues(s,e)},_responsiveDimensionChange:function(t){var i=this._getDimensions(t),l={},s="border"==t;e.each(i,function(e,i){l[t+"-"+e+(s?"-width":"")]=i}),this.updateResponsiveCSSRule(this.classes.content,l),this._positionAbsoluteBgs()},_normalizeDimensionValues:function(t,i){var l=this,s=FLBuilderResponsiveEditing._mode,o="default"==s?"":s.charAt(0).toUpperCase()+s.slice(1),i=i.split("-");return"undefined"==typeof i[1]?i[1]="":i[1]=i[1].charAt(0).toUpperCase()+i[1].slice(1),e.map(t,function(e,s){if(e=e.toLowerCase().replace(/[^a-z0-9%.\-]/g,""),""===e){var n=i[0]+s.charAt(0).toUpperCase()+s.slice(1)+i[1]+o,r=l.elements[n].attr("placeholder");r&&(e=r)}null===e||""===e||isNaN(e)||(e=parseFloat(e)+"px"),t[s]=e}),t},_positionAbsoluteBgs:function(){var t=this.elements.node.find(".fl-bg-slideshow"),i=this.elements.node.find(".fl-bg-video"),l=null,s=null,o={top:0,bottom:0,left:0,right:0};(t.length>0||i.length>0)&&(l=this._getDimensions("margin"),s=this._getDimensions("border"),e.map(o,function(e,t){l[t]&&s[t]?o[t]="calc("+l[t]+"+"+s[t]+")":l[t]?o[t]=l[t]:s[t]&&(o[t]=s[t])}),t.length>0&&(this.updateCSSRule(this.classes.node+" .fl-bg-slideshow",o),FLBuilder._resizeLayout()),i.length>0&&this.updateCSSRule(this.classes.node+" .fl-bg-video",o))},_initRow:function(){e.extend(this.elements,{width:e(this.classes.settings+" select[name=width]"),contentWidth:e(this.classes.settings+" select[name=content_width]"),maxContentWidth:e(this.classes.settings+" input[name=max_content_width]"),height:e(this.classes.settings+" select[name=full_height]"),align:e(this.classes.settings+" select[name=content_alignment]")}),this.elements.width.on("change",e.proxy(this._rowWidthChange,this)),this.elements.contentWidth.on("change",e.proxy(this._rowContentWidthChange,this)),this.elements.maxContentWidth.on("keyup",e.proxy(this._rowMaxContentWidthChange,this)),this.elements.height.on("change",e.proxy(this._rowHeightChange,this)),this.elements.align.on("change",e.proxy(this._rowHeightChange,this)),this._initNodeTextColor(),this._initNodeBg(),this._initNodeClassName(),this._initNodeBorder(),this._initResponsiveDimensions("border"),this._initResponsiveDimensions("margin"),this._initResponsiveDimensions("padding")},_rowWidthChange:function(e){var t=this.elements.node,i=this.elements.maxContentWidth.val();"full"==this.elements.width.val()?(t.css("max-width","none"),t.removeClass("fl-row-fixed-width"),t.addClass("fl-row-full-width")):(t.removeClass("fl-row-full-width"),t.addClass("fl-row-fixed-width"),""!==i?t.css("max-width",i+"px"):t.css("max-width",FLBuilderConfig.global.row_width+"px"))},_rowHeightChange:function(e){var t=this.elements.node;t.removeClass("fl-row-align-top"),t.removeClass("fl-row-align-center"),t.removeClass("fl-row-align-bottom"),"full"==this.elements.height.val()?(t.addClass("fl-row-full-height"),t.addClass("fl-row-align-"+this.elements.align.val())):t.removeClass("fl-row-full-height")},_rowContentWidthChange:function(e){var t=this.elements.content.find(".fl-row-content"),i=this.elements.maxContentWidth.val();"full"==this.elements.contentWidth.val()?(t.css("max-width","none"),t.removeClass("fl-row-fixed-width"),t.addClass("fl-row-full-width")):(t.removeClass("fl-row-full-width"),t.addClass("fl-row-fixed-width"),""!==i?t.css("max-width",i+"px"):t.css("max-width",FLBuilderConfig.global.row_width+"px"))},_rowMaxContentWidthChange:function(e){var t=this.elements.node,i=this.elements.content.find(".fl-row-content"),l=this.elements.maxContentWidth.val();""==l?l=FLBuilderConfig.global.row_width+"px":l+="px","fixed"==this.elements.width.val()&&t.css("max-width",l),"fixed"==this.elements.contentWidth.val()&&i.css("max-width",l)},_initColumn:function(){e.extend(this.elements,{size:e(this.classes.settings+" input[name=size]"),columnHeight:e(this.classes.settings+" select[name=equal_height]"),columnAlign:e(this.classes.settings+" select[name=content_alignment]"),responsiveOrder:e(this.classes.settings+" select[name=responsive_order]")}),this.elements.size.on("keyup",e.proxy(this._colSizeChange,this)),this.elements.columnHeight.on("change",e.proxy(this._colHeightChange,this)),this.elements.columnAlign.on("change",e.proxy(this._colHeightChange,this)),this.elements.responsiveOrder.on("change",e.proxy(this._colResponsiveOrder,this)),this._initNodeTextColor(),this._initNodeBg(),this._initNodeClassName(),this._initNodeBorder(),this._initResponsiveDimensions("border"),this._initResponsiveDimensions("margin"),this._initResponsiveDimensions("padding")},_colSizeChange:function(){var t=8,i=100-t,l=parseFloat(this.elements.size.val()),s=this.elements.node.prev(".fl-col"),o=this.elements.node.next(".fl-col"),n=0===o.length?s:o,r=this.elements.node.siblings(".fl-col"),a=0;0===r.length||isNaN(l)||(r.each(function(){e(this).data("node")!=n.data("node")&&(i-=parseFloat(e(this)[0].style.width),a+=parseFloat(e(this)[0].style.width))}),l<t&&(l=t),l>i&&(l=i),n.css("width",100-a-l+"%"),this.elements.node.css("width",l+"%"))},_colHeightChange:function(){var e=this.elements.node.parent(".fl-col-group");e.removeClass("fl-col-group-align-top"),e.removeClass("fl-col-group-align-center"),e.removeClass("fl-col-group-align-bottom"),"yes"==this.elements.columnHeight.val()?(e.addClass("fl-col-group-equal-height"),e.addClass("fl-col-group-align-"+this.elements.columnAlign.val())):e.removeClass("fl-col-group-equal-height")},_colResponsiveOrder:function(){var e=this.elements.node.parent(".fl-col-group");"reversed"==this.elements.responsiveOrder.val()?e.addClass("fl-col-group-responsive-reversed"):e.removeClass("fl-col-group-responsive-reversed")},_initModule:function(){this._initNodeClassName(),this._initResponsiveDimensions("margin")},_initDefaultFieldPreviews:function(e){for(var e=_.isUndefined(e)?this.elements.settings.find(".fl-field"):e,t=null,i=null,l=0;l<e.length;l++)t=e.eq(l),i=t.data("preview"),"refresh"==i.type&&this._initFieldRefreshPreview(t),"text"==i.type&&this._initFieldTextPreview(t),"css"==i.type&&this._initFieldCSSPreview(t),"widget"==i.type&&this._initFieldWidgetPreview(t),"font"==i.type&&this._initFieldFontPreview(t)},_initFieldRefreshPreview:function(t){var i=t.data("type"),l=t.data("preview"),s=e.proxy(this.delayPreview,this);switch(i){case"text":t.find("input[type=text]").on("keyup",s);break;case"textarea":t.find("textarea").on("keyup",s);break;case"select":t.find("select").on("change",s);break;case"color":t.find(".fl-color-picker-value").on("change",s);break;case"photo":t.find("select").on("change",s);break;case"multiple-photos":t.find("input").on("change",s);break;case"photo-sizes":t.find("select").on("change",s);break;case"video":t.find("input").on("change",s);break;case"multiple-audios":t.find("input").on("change",s);break;case"icon":t.find("input").on("change",s);break;case"form":t.delegate("input","change",s);break;case"editor":this._addTextEditorCallback(t,l);break;case"code":t.find("textarea").on("change",s);break;case"post-type":t.find("select").on("change",s);break;case"suggest":t.find(".as-values").on("change",s),t.find("select").on("change",s);break;case"unit":t.find("input[type=number]").on("keyup",s);break;case"ordering":t.find("input[type=hidden]").on("change",s)}},_initFieldTextPreview:function(t){var i=t.data("type"),l=t.data("preview"),s=e.proxy(this._previewText,this,l);switch(i){case"text":t.find("input[type=text]").on("keyup",s);break;case"unit":t.find("input[type=number]").on("keyup",s);break;case"textarea":t.find("textarea").on("keyup",s);break;case"code":t.find("textarea").on("change",s);break;case"editor":this._addTextEditorCallback(t,l)}},_previewText:function(t,i){var l=this.elements.node.find(t.selector),s=e("<div>"+e(i.target).val()+"</div>");l.length>0&&(s.find("script").remove(),l.html(s.html()))},_previewTextEditor:function(t,i,l){var s=this.elements.node.find(t.selector),o="undefined"!=typeof tinyMCE?tinyMCE.get(i):null,n=e("#"+i),r="";s.length>0&&(r=e(o&&"none"==n.css("display")?"<div>"+o.getContent()+"</div>":"undefined"==typeof switchEditors||"undefined"==typeof switchEditors.wpautop?"<div>"+n.val()+"</div>":"<div>"+switchEditors.wpautop(n.val())+"</div>"),r.find("script").remove(),s.html(r.html()))},_addTextEditorCallback:function(t,i){var l=t.find("textarea.wp-editor-area").attr("id"),s=null;if("refresh"==i.type)s=e.proxy(this.delayPreview,this);else{if("text"!=i.type)return;s=e.proxy(this._previewTextEditor,this,i,l)}e("#"+l).on("keyup",s),"undefined"!=typeof tinyMCE&&(editor=tinyMCE.get(l),editor.on("change",s),editor.on("keyup",s))},_initFieldFontPreview:function(t){var i=t.data("type"),l=t.data("preview");l.id=t.attr("id");var s=e.proxy(this._previewFont,this,l);"font"==i&&t.find(".fl-font-field").on("change","select",s)},_previewFont:function(t,i){var l=e(i.delegateTarget),s=l.find(".fl-font-field-font"),o=e(s).find(":selected"),n=o.parent().attr("label"),r=l.find(".fl-font-field-weight"),a=t.id+"-"+this.nodeId,d=this._getPreviewSelector(this.classes.node,t.selector);"Google"==n&&this._buildFontStylesheet(a,s.val(),r.val()),"Default"==s.val()?(this.updateCSSRule(d,"font-family",""),this.updateCSSRule(d,"font-weight","")):(this.updateCSSRule(d,"font-family",s.val()),this.updateCSSRule(d,"font-weight",r.val()))},_buildFontStylesheet:function(t,i,l){var s=FLBuilderConfig.googleFontsUrl,o="",n={},r={};n[i]=[l],FLBuilderPreview._fontsList[t]=n,Object.keys(FLBuilderPreview._fontsList).forEach(function(e){var t=FLBuilderPreview._fontsList[e];Object.keys(t).forEach(function(e){var i=t[e];r[e]=r[e]||[],i=i.filter(function(t){return r[e].indexOf(t)<0}),r[e]=r[e].concat(i)})}),e.each(r,function(e,t){o+=e+":"+t.join()+"|"}),o=s+o.slice(0,-1).replace(" ","+"),e("#fl-builder-google-fonts-preview").length<1?e("<link>").attr("id","fl-builder-google-fonts-preview").attr("type","text/css").attr("rel","stylesheet").attr("href",o).appendTo("head"):e("#fl-builder-google-fonts-preview").attr("href",o)},_initFieldCSSPreview:function(e){var t=e.data("preview"),i=null;if("undefined"!=typeof t.rules)for(i in t.rules)this._initFieldCSSPreviewCallback(e,t.rules[i]);else this._initFieldCSSPreviewCallback(e,t)},_initFieldCSSPreviewCallback:function(t,i){switch(t.data("type")){case"text":t.find("input[type=text]").on("keyup",e.proxy(this._previewCSS,this,i));break;case"unit":t.find("input[type=number]").on("keyup",e.proxy(this._previewCSS,this,i));break;case"select":t.find("select").on("change",e.proxy(this._previewCSS,this,i));break;case"color":t.find(".fl-color-picker-value").on("change",e.proxy(this._previewColor,this,i))}},_previewCSS:function(t,i){var l=this._getPreviewSelector(this.classes.node,t.selector),s=t.property,o="undefined"==typeof t.unit?"":t.unit,n=e(i.target),r=n.val();"%"==o?r=parseInt(r)/100:""!==r&&(r+=o),n.closest(".fl-field-responsive-setting").length?this.updateResponsiveCSSRule(l,s,r):this.updateCSSRule(l,s,r)},_previewColor:function(t,i){var l=this._getPreviewSelector(this.classes.node,t.selector),s=e(i.target),o=s.val(),n=""===o?"inherit":"#"+o;/^rgb/.test(o.replace(/\s+/g,""))&&(n=o),s.closest(".fl-field-responsive-setting").length?this.updateResponsiveCSSRule(l,t.property,n):this.updateCSSRule(l,t.property,n)},_initFieldWidgetPreview:function(t){var i=e.proxy(this.delayPreview,this);t.find("input").on("keyup",i),t.find("input[type=checkbox]").on("click",i),t.find("textarea").on("keyup",i),t.find("select").on("change",i)},_getPreviewSelector:function(e,t){for(var i="",l=t.split(","),s=0;s<l.length;s++)l[s].indexOf("{node}")>-1?i=l[s].replace("{node}",e):i+=e+" "+l[s],s!=l.length-1&&(i+=", ");return i}}}(jQuery),function(e){var t={ignored:[],reparsed:[],width:null,callback:null,sheets:{},styles:[],queue:[],emPxValue:null,regex:{media:/@media[^{]*{([\s\S]+?})\s*}/gi,empty:/@media[^{]*{([^{}]*?)}/gi,keyframes:/@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,comments:/\/\*[^*]*\*+([^\/][^*]*\*+)*\//gi,urls:/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,findStyles:/@media *([^\{]+)\{([\S\s]+?)\}$/,only:/(only\s+)?([a-zA-Z]+)\s?/,minw:/\(\s*min\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,maxw:/\(\s*max\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,minmaxwh:/\(\s*m(in|ax)\-(height|width)\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/gi,other:/\([^\)]*\)/g},ignore:function(e){Array.prototype.push.apply(this.ignored,e)},reparse:function(e){Array.prototype.push.apply(this.reparsed,e)},update:function(e,t){this.width=void 0===e?null:e,this.callback=void 0===t?null:t,i.update(),this.queueSheets()?this.runQueue():this.applyStyles()},queueSheets:function(){for(var t=e("link, style"),i=null,l=null,s=null,o=null,n=null,r=null,a=null,d=!1,u=0,c=0;u<t.length;u++)if(element=t[u],i=element.href,l=element.id,s=element.tagName.toLowerCase(),o=element.rel,n=element.media,r=i?i:l?l:"style-"+u,a=!0,d=!1,"style"===s||i&&o&&"stylesheet"===o.toLowerCase()){for(c=0;c<this.ignored.length;c++)if(r.indexOf(this.ignored[c])>-1){d=!0;break}if(d)continue;for(c=0;c<this.reparsed.length;c++)if(r.indexOf(this.reparsed[c])>-1){this.sheets[r]=null;break}void 0!==this.sheets[r]&&this.sheets[r]||this.queue.push({element:t.eq(u),key:r,tagName:s,href:i,id:l,media:n})}return this.queue.length},runQueue:function(){var t;this.queue.length?(t=this.queue.shift(),"style"===t.tagName?(this.parse(t.element.html(),t),this.runQueue()):e.get(t.href,e.proxy(function(e){this.parse(e,t),this.runQueue()},this))):this.applyStyles()},parse:function(e,t){var i=this.regex,l=this.cleanStyles(e),s=l.match(i.media),o=s&&s.length||0,n=!o&&t.media,r=null,a=null,d=null,u="",c=0,h=0;for(s?u=l.replace(i.media,""):n&&"all"!=t.media?o=1:u=l,this.sheets[t.key]={element:t.element,key:t.key,tagName:t.tagName,href:t.href,id:t.id,all:u,queries:[]},c=0;c<o;c++)for(n?(r=t.media,l=this.convertURLs(l,t.href)):(r=s[c].match(i.findStyles)&&RegExp.$1,l=RegExp.$2&&this.convertURLs(RegExp.$2,t.href)),a=r.split(","),h=0;h<a.length;h++)r=a[h],d=r.split("(")[0].match(i.only)&&RegExp.$2,"print"!=d&&(r.replace(i.minmaxwh,"").match(i.other)||this.sheets[t.key].queries.push({minw:r.match(i.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:r.match(i.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),styles:l}))},applyStyles:function(){var t=e("head"),i=null,l=null,s=null,o=null,n=null,r=null,a=null,d=null,u=!1;this.clearStyles();for(o in this.sheets)if(i="",l=e("<style></style>"),s=this.sheets[o],s.queries.length&&this.width){for(i+=s.all,r=0;r<s.queries.length;r++)n=s.queries[r],a=n.minw,d=n.maxw,u=!1,a&&(a=parseFloat(a)*(a.indexOf("em")>-1?this.getEmPxValue():1),this.width>=a&&(i+=n.styles,u=!0)),d&&!u&&(d=parseFloat(d)*(d.indexOf("em")>-1?this.getEmPxValue():1),this.width<=d&&(i+=n.styles));this.styles.push(l),t.append(l),l.html(i),s.element.remove()}},clearStyles:function(){var t=e("head"),i=null,l=this.styles.slice(0);this.styles=[];for(i in this.sheets)this.sheets[i].element.parent().length||t.append(this.sheets[i].element);setTimeout(function(){for(var e=0;e<l.length;e++)l[e].empty(),l[e].remove()},50)},cleanStyles:function(e){var t=this.regex;return e.replace(t.comments,"").replace(t.keyframes,"").replace(t.empty,"")},convertURLs:function(e,t){return t?(t=t.substring(0,t.lastIndexOf("/")),t.length&&(t+="/"),e.replace(this.regex.urls,"$1"+t+"$2$3")):e},getEmPxValue:function(){if(this.emPxValue)return this.emPxValue;var e=null,t=window.document,i=t.documentElement,l=t.body,s=t.createElement("div"),o=i.style.fontSize,n=l&&l.style.fontSize,r=!1;return s.style.cssText="position:absolute;font-size:1em;width:1em",l||(l=r=t.createElement("body"),l.style.background="none"),i.style.fontSize="100%",l.style.fontSize="100%",l.appendChild(s),r&&i.insertBefore(l,i.firstChild),e=parseFloat(s.offsetWidth),r?i.removeChild(l):l.removeChild(s),i.style.fontSize=o,n?l.style.fontSize=n:l.style.fontSize="",this.emPxValue=e,e}},i={_functions:null,update:function(){var e;if(!this._functions){this._functions={};for(e in l)this._functions[e]=jQuery.fn[e]}if(t.width)for(e in l)jQuery.fn[e]=l[e];else for(e in this._functions)jQuery.fn[e]=this._functions[e]}},l={width:function(l){return void 0!=l?i._functions.width.call(this,l):e.isWindow(this[0])?t.width:i._functions.width.call(this)}};FLBuilderSimulateMediaQuery={ignore:function(e){t.ignore(e)},reparse:function(e){t.reparse(e)},update:function(e,i){t.update(e,i)}}}(jQuery),function(e){FLBuilderResponsiveEditing={_mode:"default",refreshPreview:function(){var t;e(".fl-responsive-preview").length&&"default"!=this._mode&&("responsive"==this._mode?(t=FLBuilderConfig.global.responsive_breakpoint>=320?320:FLBuilderConfig.global.responsive_breakpoint,FLBuilderSimulateMediaQuery.update(t)):"medium"==this._mode&&(t=FLBuilderConfig.global.medium_breakpoint>=769?769:FLBuilderConfig.global.medium_breakpoint,FLBuilderSimulateMediaQuery.update(t)),FLBuilder._resizeLayout())},_init:function(){this._bind(),this._initMediaQueries()},_bind:function(){FLBuilder.addHook("responsive-editing-switched",this._previewSpacingFields),FLBuilder.addHook("settings-form-init",this._initSettingsForms),FLBuilder.addHook("settings-lightbox-closed",this._clearPreview),e("body").delegate(".fl-field-responsive-toggle","click",this._settingToggleClicked)},_initMediaQueries:function(){FLBuilderSimulateMediaQuery.ignore([FLBuilderConfig.pluginUrl,"fl-theme-builder","/wp-includes/","/wp-admin/","admin-bar-inline-css","ace-tm","ace_editor.css"]),FLBuilderSimulateMediaQuery.reparse([FLBuilderConfig.postId+"-layout-draft.css?",FLBuilderConfig.postId+"-layout-draft-partial.css?",FLBuilderConfig.postId+"-layout-preview.css?",FLBuilderConfig.postId+"-layout-preview-partial.css?","fl-builder-global-css","fl-builder-layout-css"])},_switchTo:function(t,i){var l=e("html"),s=e("body"),o=e(FLBuilder._contentClass),n=e(".fl-responsive-preview"),r=e(".fl-responsive-preview-mask"),a=e(".fl-content-placeholder"),d=null;if(FLBuilderResponsiveEditing._mode=t,"default"==t){if(0===a.length)return;l.removeClass("fl-responsive-preview-enabled"),a.after(o),a.remove(),n.remove(),r.remove()}else 0===n.length?(l.addClass("fl-responsive-preview-enabled"),o.after('<div class="fl-content-placeholder"></div>'),s.prepend(wp.template("fl-responsive-preview")()),e(".fl-responsive-preview").addClass("fl-preview-"+t),e(".fl-responsive-preview-content").append(o)):(n.removeClass("fl-preview-responsive fl-preview-medium"),n.addClass("fl-preview-"+t));"responsive"==t?(d=FLBuilderConfig.global.responsive_breakpoint>=360?360:FLBuilderConfig.global.responsive_breakpoint,o.width(d),FLBuilderSimulateMediaQuery.update(d,i)):"medium"==t?(d=FLBuilderConfig.global.medium_breakpoint>=769?769:FLBuilderConfig.global.medium_breakpoint,o.width(d),FLBuilderSimulateMediaQuery.update(d,i)):(o.width(""),FLBuilderSimulateMediaQuery.update(null,i)),this._setContentBackgroundColor(),FLBuilder._resizeLayout(),FLBuilder.triggerHook("responsive-editing-switched",t)},_setContentBackgroundColor:function(){var t=e(FLBuilder._contentClass),i=e(".fl-responsive-preview"),l=e(".fl-content-placeholder"),s=l.parents(),o="#fff",n=0;if(0===i.length)t.css("background-color","");else{for(;n<s.length&&(o=s.eq(n).css("background-color"),"rgba(0, 0, 0, 0)"==o);n++);t.css("background-color",o)}},_switchToAndScroll:function(t){var i=e(".fl-builder-settings").data("node"),l=void 0===i?void 0:e(".fl-node-"+i);FLBuilderResponsiveEditing._switchTo(t,function(){void 0!==l&&l&&setTimeout(function(){var t=e(window),i=e(".fl-responsive-preview-content");!i.length||t.height()<i.height()?e("html, body").animate({scrollTop:l.offset().top-100},250):scrollTo(0,0)},250)})},_clearPreview:function(){FLBuilderResponsiveEditing._switchToAndScroll("default")},_settingToggleClicked:function(){var t=e(this),i=t.data("mode");i="default"==i?"medium":"medium"==i?"responsive":"default",FLBuilderResponsiveEditing._switchAllSettingsTo(i),t.siblings(".fl-field-responsive-setting:visible").find("input").focus()},_switchAllSettingsTo:function(t){var i="dashicons-desktop dashicons-tablet dashicons-smartphone";e(".fl-field-responsive-toggle").removeClass(i),e(".fl-field-responsive-setting").hide(),i="default"==t?"dashicons-desktop":"medium"==t?"dashicons-tablet":"dashicons-smartphone",e(".fl-field-responsive-toggle").addClass(i).data("mode",t),e(".fl-field-responsive-setting-"+t).css("display","inline-block"),FLBuilderResponsiveEditing._switchToAndScroll(t)},_initSettingsForms:function(){var e=FLBuilderResponsiveEditing;Number(FLBuilderConfig.global.responsive_enabled)&&(e._initFields("dimension","input","keyup",e._spacingFieldKeyup,["margin","padding"]),e._initFields("dimension","input","keyup",e._textFieldKeyup),e._initFields("unit","input","keyup",e._textFieldKeyup)),e._switchAllSettingsTo(e._mode)},_initFields:function(t,i,l,s,o){for(var n=e(".fl-builder-settings"),r=n.find(".fl-field").has(".fl-field-responsive-setting"),a=null,d=null,u=0;u<r.length;u++)a=r.eq(u),d=a.attr("id").replace("fl-field-",""),"object"==typeof o&&e.inArray(d,o)<0||t==a.attr("data-type")&&void 0===a.attr("data-responsive-init")&&(a.find(".fl-field-responsive-setting-default "+i).on(l,s),a.find(".fl-field-responsive-setting-medium "+i).on(l,s),a.find(".fl-field-responsive-setting-responsive "+i).on(l,s),a.find(".fl-field-responsive-setting-default "+i).trigger(l),a.attr("data-responsive-init",1))},_getFields:function(t,i){var l=e(t).closest(".fl-field");return{"default":l.find(".fl-field-responsive-setting-default "+i),medium:l.find(".fl-field-responsive-setting-medium "+i),responsive:l.find(".fl-field-responsive-setting-responsive "+i)}},_textFieldKeyup:function(){var e=FLBuilderResponsiveEditing._getFields(this,"input");e["default"].each(function(t){var i=e["default"].eq(t).attr("placeholder"),l=e["default"].eq(t).val(),s=e.medium.eq(t).val();""==l?e.medium.eq(t).attr("placeholder",void 0===i?"":i):e.medium.eq(t).attr("placeholder",l),""==s?e.responsive.eq(t).attr("placeholder",e.medium.eq(t).attr("placeholder")):e.responsive.eq(t).attr("placeholder",s)})},_spacingFieldKeyup:function(){var t=e(".fl-builder-settings"),i="row",l=e(this).closest(".fl-field").attr("id").replace("fl-field-",""),s=FLBuilderResponsiveEditing._getFields(this,"input"),o=FLBuilderConfig.global,n=null,r=null,a=null,d=null;t.hasClass("fl-builder-row-settings")?i="row":t.hasClass("fl-builder-col-settings")?i="col":t.hasClass("fl-builder-module-settings")&&(i="module"),e.extend(o,{col_margins:0,col_margins_medium:"",col_margins_responsive:"",col_padding:0,col_padding_medium:"",col_padding_responsive:""}),n=i+"_"+l+("margin"===l?"s":""),r=o[n],a=o[n+"_medium"],d=o[n+"_responsive"],s["default"].each(function(e){var t=s["default"].eq(e).attr("name").split("_").pop(),n=s["default"].eq(e).val(),u=s.medium.eq(e).val(),c=(s.responsive.eq(e).val(),null),h=null;""===a&&(""!==n?s.medium.eq(e).attr("placeholder",n):""!==r&&s.medium.eq(e).attr("placeholder",r)),""===d&&("module"===i&&Number(o.auto_spacing)?(c=""===a?Number(r):a,h=""===u?Number(n):u,""!==h&&(h>c||h<0)?s.responsive.eq(e).attr("placeholder",c):""!==h?s.responsive.eq(e).attr("placeholder",h):s.responsive.eq(e).attr("placeholder",c)):(!Number(o.auto_spacing)||"padding"===l&&"top|bottom".indexOf(t)>-1)&&(""!==u?s.responsive.eq(e).attr("placeholder",u):""!==a?s.responsive.eq(e).attr("placeholder",a):""!==n?s.responsive.eq(e).attr("placeholder",n):""!==r&&s.responsive.eq(e).attr("placeholder",r)))})},_previewSpacingFields:function(){var t=FLBuilderResponsiveEditing._mode,i=e(".fl-builder-settings");0!==i.length&&void 0!==i.attr("data-node")&&i.find(".fl-field").has(".fl-field-responsive-setting").each(function(){var e=FLBuilderResponsiveEditing._getFields(this,"input"),i=e.responsive.closest(".fl-field").data("preview");"refresh"!=i.type&&e[t].trigger("keyup")})}},e(function(){FLBuilderResponsiveEditing._init()})}(jQuery),function(e){FLBuilderResponsivePreview={enter:function(){this.render()},exit:function(){this.destroy()},switchTo:function(t){var i=FLBuilderConfig.global,l=e("#fl-builder-preview-frame"),s="100%";
|
7 |
-
"responsive"==t?(s=i.responsive_breakpoint>=360?360:i.responsive_breakpoint,l.width(s)):"medium"==t&&(s=i.medium_breakpoint>=769?769:i.medium_breakpoint,l.width(s)),l.width(s)},render:function(){var t=e("body"),i=FLBuilderConfig.previewUrl,l=e("#fl-builder-preview-mask, #fl-builder-preview-frame"),s=e('<div id="fl-builder-preview-mask"></div>'),o=e('<iframe id="fl-builder-preview-frame" src="'+i+'" frameborder="0"></iframe>');l.remove(),t.append(s),t.append(o)},destroy:function(){e("#fl-builder-preview-mask, #fl-builder-preview-frame").remove()}}}(jQuery),function(e){var t={init:function(){var t=e("body");t.delegate(".fl-builder-service-select","change",this._serviceChange),t.delegate(".fl-builder-service-connect-button","click",this._connectClicked),t.delegate(".fl-builder-service-account-select","change",this._accountChange),t.delegate(".fl-builder-service-account-delete","click",this._accountDeleteClicked),t.delegate(".fl-builder-campaign-monitor-client-select","change",this._campaignMonitorClientChange),t.delegate(".fl-builder-mailchimp-list-select","change",this._mailChimpListChange),t.delegate(".fl-builder-activecampaign-list_type-select","change",this._activeCampaignChange)},_startSettingsLoading:function(t){var i=e(".fl-builder-settings"),l=t.closest(".fl-builder-service-settings"),s=e(".fl-builder-service-error");i.append('<div class="fl-builder-loading"></div>'),l.addClass("fl-builder-service-settings-loading"),s.remove()},_finishSettingsLoading:function(){var t=e(".fl-builder-settings"),i=e(".fl-builder-service-settings-loading");t.find(".fl-builder-loading").remove(),i.removeClass("fl-builder-service-settings-loading")},_serviceChange:function(){var i=e(".fl-builder-settings").data("node"),l=e(this),s=l.closest("tr"),o=l.val();s.siblings("tr.fl-builder-service-account-row").remove(),s.siblings("tr.fl-builder-service-connect-row").remove(),s.siblings("tr.fl-builder-service-field-row").remove(),e(".fl-builder-service-error").remove(),""!==o&&(t._startSettingsLoading(l),FLBuilder.ajax({action:"render_service_settings",node_id:i,service:o},t._serviceChangeComplete))},_serviceChangeComplete:function(i){var l=JSON.parse(i),s=e(".fl-builder-service-settings-loading"),o=s.find(".fl-builder-service-select-row");o.after(l.html),t._addAccountDelete(s),t._finishSettingsLoading()},_connectClicked:function(){for(var i=e(".fl-builder-settings").data("node"),l=e(this).closest(".fl-builder-service-settings"),s=l.find(".fl-builder-service-select"),o=l.find(".fl-builder-service-connect-row"),n=l.find(".fl-builder-service-connect-input"),r=null,a=null,d=0,u={action:"connect_service",node_id:i,service:s.val(),fields:{}};d<n.length;d++)r=n.eq(d),a=r.attr("name"),u.fields[a]=r.val();o.hide(),t._startSettingsLoading(s),FLBuilder.ajax(u,t._connectComplete)},_connectComplete:function(i){var l=JSON.parse(i),s=e(".fl-builder-service-settings-loading"),o=s.find(".fl-builder-service-select-row"),n=s.find(".fl-builder-service-select"),r=s.find(".fl-builder-service-account-row"),a=s.find(".fl-builder-service-account-select"),d=s.find(".fl-builder-service-connect-row");l.error?(d.show(),0===a.length?n.after('<div class="fl-builder-service-error">'+l.error+"</div>"):a.after('<div class="fl-builder-service-error">'+l.error+"</div>")):(d.remove(),r.remove(),o.after(l.html)),t._addAccountDelete(s),t._finishSettingsLoading()},_accountChange:function(){var i=e(".fl-builder-settings").data("node"),l=e(this).closest(".fl-builder-service-settings"),s=l.find(".fl-builder-service-select"),o=l.find(".fl-builder-service-account-select"),n=l.find(".fl-builder-service-connect-row"),r=l.find("tr.fl-builder-service-field-row"),a=e(".fl-builder-service-error"),d=o.val(),u=null;n.remove(),r.remove(),a.remove(),"add_new_account"==d?u={action:"render_service_settings",node_id:i,service:s.val(),add_new:!0}:""!==d&&(u={action:"render_service_fields",node_id:i,service:s.val(),account:d}),u&&(t._startSettingsLoading(s),FLBuilder.ajax(u,t._accountChangeComplete)),t._addAccountDelete(l)},_accountChangeComplete:function(i){var l=JSON.parse(i),s=e(".fl-builder-service-settings-loading"),o=s.find(".fl-builder-service-account-row");o.after(l.html),t._finishSettingsLoading()},_addAccountDelete:function(e){var t=e.find(".fl-builder-service-account-select");t.length>0&&(e.find(".fl-builder-service-account-delete").remove(),""!==t.val()&&"add_new_account"!=t.val()&&t.after('<a href="javascript:void(0);" class="fl-builder-service-account-delete">'+FLBuilderStrings.deleteAccount+"</a>"))},_accountDeleteClicked:function(){var i=e(this).closest(".fl-builder-service-settings"),l=i.find(".fl-builder-service-select"),s=i.find(".fl-builder-service-account-select");confirm(FLBuilderStrings.deleteAccountWarning)&&(FLBuilder.ajax({action:"delete_service_account",service:l.val(),account:s.val()},t._accountDeleteComplete),t._startSettingsLoading(s))},_accountDeleteComplete:function(){var i=e(".fl-builder-service-settings-loading"),l=i.find(".fl-builder-service-select");t._finishSettingsLoading(),l.trigger("change")},_campaignMonitorClientChange:function(){var i=e(".fl-builder-settings").data("node"),l=e(this).closest(".fl-builder-service-settings"),s=l.find(".fl-builder-service-select"),o=l.find(".fl-builder-service-account-select"),n=e(this),r=l.find(".fl-builder-service-list-select"),a=n.val();0!==r.length&&r.closest("tr").remove(),""!==a&&(t._startSettingsLoading(s),FLBuilder.ajax({action:"render_service_fields",node_id:i,service:s.val(),account:o.val(),client:a},t._campaignMonitorClientChangeComplete))},_campaignMonitorClientChangeComplete:function(i){var l=JSON.parse(i),s=e(".fl-builder-service-settings-loading"),o=s.find(".fl-builder-campaign-monitor-client-select");o.closest("tr").after(l.html),t._finishSettingsLoading()},_mailChimpListChange:function(){var i=e(".fl-builder-settings").data("node"),l=e(this).closest(".fl-builder-service-settings"),s=l.find(".fl-builder-service-select"),o=l.find(".fl-builder-service-account-select"),n=l.find(".fl-builder-service-list-select");e(".fl-builder-mailchimp-group-select").closest("tr").remove(),""!==n.val()&&(t._startSettingsLoading(s),FLBuilder.ajax({action:"render_service_fields",node_id:i,service:s.val(),account:o.val(),list_id:n.val()},t._mailChimpListChangeComplete))},_mailChimpListChangeComplete:function(i){var l=JSON.parse(i),s=e(".fl-builder-service-settings-loading"),o=s.find(".fl-builder-service-list-select");o.closest("tr").after(l.html),t._finishSettingsLoading()},_activeCampaignChange:function(){var i=e(".fl-builder-settings").data("node"),l=e(this).closest(".fl-builder-service-settings"),s=l.find(".fl-builder-service-select"),o=l.find(".fl-builder-service-account-select"),n=l.find(".fl-builder-service-list-select");list_type=l.find('select[name="list_type"]'),0!==n.length&&n.closest("tr").remove(),""!==list_type.val()&&(t._startSettingsLoading(s),FLBuilder.ajax({action:"render_service_fields",node_id:i,service:s.val(),account:o.val(),list_type:list_type.val()},t._activeCampaignTypeChangeComplete))},_activeCampaignTypeChangeComplete:function(i){var l=JSON.parse(i),s=e(".fl-builder-service-settings-loading"),o=s.find(".fl-builder-service-field-row");o.after(l.html),t._finishSettingsLoading()}};e(function(){t.init()})}(jQuery),function(e){FLBuilderTour={_tour:null,start:function(){FLBuilderTour._tour?FLBuilderTour._tour.restart():(FLBuilderTour._tour=new Tour(FLBuilderTour._config()),FLBuilderTour._tour.init()),FLBuilder._triggerSettingsSave(!1,!0)&&FLBuilderTour._tour.start()},_config:function(){var t={storage:!1,onStart:FLBuilderTour._onStart,onPrev:FLBuilderTour._onPrev,onNext:FLBuilderTour._onNext,onEnd:FLBuilderTour._onEnd,template:'<div class="popover" role="tooltip"> <i class="fa fa-times" data-role="end"></i> <div class="arrow"></div> <h3 class="popover-title"></h3> <div class="popover-content"></div> <div class="popover-navigation clearfix"> <button class="fl-builder-button fl-builder-button-primary fl-builder-tour-next" data-role="next">'+FLBuilderStrings.tourNext+"</button> </div> </div>",steps:[{animation:!1,element:".fl-builder--content-library-panel",placement:"left",title:FLBuilderStrings.tourTemplatesTitle,content:FLBuilderStrings.tourTemplates,onShow:function(){FLBuilder.ContentPanel.show("templates")}},{animation:!1,element:".fl-builder--content-library-panel",placement:"left",title:FLBuilderStrings.tourAddRowsTitle,content:FLBuilderStrings.tourAddRows,onShow:function(){FLBuilder.ContentPanel.show("rows")}},{animation:!1,element:".fl-builder--content-library-panel",placement:"left",title:FLBuilderStrings.tourAddContentTitle,content:FLBuilderStrings.tourAddContent,onShow:function(){FLBuilder.ContentPanel.show("modules")}},{animation:!1,element:".fl-row:first-of-type",placement:"top",title:FLBuilderStrings.tourEditContentTitle,content:FLBuilderStrings.tourEditContent,onShow:function(){FLBuilderTour._dimSection(".fl-builder-bar"),FLBuilder._closePanel(),e(".fl-row").eq(0).trigger("mouseenter"),e(".fl-module").eq(0).trigger("mouseenter")}},{animation:!1,element:".fl-row:first-of-type .fl-module-overlay .fl-block-overlay-actions",placement:"top",title:FLBuilderStrings.tourEditContentTitle,content:FLBuilderStrings.tourEditContent2,onShow:function(){FLBuilderTour._dimSection(".fl-builder-bar"),FLBuilder._closePanel(),e(".fl-row").eq(0).trigger("mouseenter"),e(".fl-module").eq(0).trigger("mouseenter")}},{animation:!1,element:".fl-builder-content-panel-button",placement:"bottom",title:FLBuilderStrings.tourAddContentButtonTitle,content:FLBuilderStrings.tourAddContentButton,onShow:function(){FLBuilderTour._dimSection("body"),e(".fl-row").eq(0).trigger("mouseleave"),e(".fl-module").eq(0).trigger("mouseleave")}},{animation:!1,element:".fl-builder-templates-button",placement:"bottom",title:FLBuilderStrings.tourTemplatesButtonTitle,content:FLBuilderStrings.tourTemplatesButton,onShow:function(){FLBuilderTour._dimSection("body")}},{animation:!1,element:".fl-builder-tools-button",placement:"bottom",title:FLBuilderStrings.tourToolsButtonTitle,content:FLBuilderStrings.tourToolsButton,onShow:function(){FLBuilderTour._dimSection("body")}},{animation:!1,element:".fl-builder-done-button",placement:"bottom",title:FLBuilderStrings.tourDoneButtonTitle,content:FLBuilderStrings.tourDoneButton,onShow:function(){FLBuilderTour._dimSection("body")}},{animation:!1,orphan:!0,backdrop:!0,title:FLBuilderStrings.tourFinishedTitle,content:FLBuilderStrings.tourFinished,template:'<div class="popover" role="tooltip"> <div class="arrow"></div> <i class="fa fa-times" data-role="end"></i> <h3 class="popover-title"></h3> <div class="popover-content"></div> <div class="popover-navigation clearfix"> <button class="fl-builder-button fl-builder-button-primary fl-builder-tour-next" data-role="end">'+FLBuilderStrings.tourEnd+"</button> </div> </div>"}]};return FLBuilderConfig.lite?t.steps.shift():"disabled"==FLBuilderConfig.enabledTemplates?t.steps.shift():"fl-builder-template"==FLBuilderConfig.postType&&t.steps.shift(),t},_onStart:function(){var t=e("body");t.scrollTop(0),t.append('<div class="fl-builder-tour-mask"></div>'),0===e(".fl-row").length&&"module"!=FLBuilderConfig.userTemplateType&&(e(".fl-builder-content").append('<div class="fl-builder-tour-demo-content fl-row fl-row-fixed-width fl-row-bg-none"> <div class="fl-row-content-wrap"> <div class="fl-row-content fl-row-fixed-width fl-node-content"> <div class="fl-col-group"> <div class="fl-col" style="width:100%"> <div class="fl-col-content fl-node-content"> <div class="fl-module fl-module-rich-text" data-type="rich-text" data-name="Text Editor"> <div class="fl-module-content fl-node-content"> <div class="fl-rich-text"> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus pellentesque ut lorem non cursus. Sed mauris nunc, porttitor iaculis lorem a, sollicitudin lacinia sapien. Proin euismod orci lacus, et sollicitudin leo posuere ac. In hac habitasse platea dictumst. Maecenas elit magna, consequat in turpis suscipit, ultrices rhoncus arcu. Phasellus finibus sapien nec elit tempus venenatis. Maecenas tincidunt sapien non libero maximus, in aliquam felis tincidunt. Mauris mollis ultricies facilisis. Duis condimentum dignissim tortor sit amet facilisis. Aenean gravida lacus eu risus molestie egestas. Donec ut dolor dictum, fringilla metus malesuada, viverra nunc. Maecenas ut purus ac justo aliquet lacinia. Cras vestibulum elementum tincidunt. Maecenas mattis tortor neque, consectetur dignissim neque tempor nec.</p></div> </div> </div> </div> </div> </div> </div> </div> </div>'),FLBuilder._setupEmptyLayout(),FLBuilder._highlightEmptyCols())},_onPrev:function(){e(".fl-builder-tour-dimmed").remove()},_onNext:function(){e(".fl-builder-tour-dimmed").remove()},_onEnd:function(){e("body").off("fl-builder.template-selector-loaded"),e(".fl-builder-tour-mask").remove(),e(".fl-builder-tour-dimmed").remove(),e(".fl-builder-tour-demo-content").remove(),FLBuilder._setupEmptyLayout(),FLBuilder._highlightEmptyCols(),FLBuilder._showPanel(),FLBuilder._initTemplateSelector()},_dimSection:function(t){e(t).find(".fl-builder-tour-dimmed").remove(),e(t).append('<div class="fl-builder-tour-dimmed"></div>')}}}(jQuery),function(e,t){String.prototype.startsWith||(String.prototype.startsWith=function(e,t){return t=t||0,this.substr(t,e.length)===e}),e.fn.textWidth=function(t,i){return e.fn.textWidth.fakeEl||(e.fn.textWidth.fakeEl=e("<span>").hide().appendTo(document.body)),e.fn.textWidth.fakeEl.text(t||this.val()||this.text()).css("font",i||this.css("font")),e.fn.textWidth.fakeEl.width()},FLExtendableObject={create:function(t){var i=Object.create(this);return i=e.extend(i,t),e(this).trigger("onCreate"),i}},e.fn.switchClass=function(t,i){return this.each(function(){return e(this).removeClass(function(e,i){var l=[],s=i.split(" ");for(var e in s)s[e].startsWith(t)&&l.push(s[e]);return l.join(" ")}),e(this).addClass(t+i)})};var i={init:function(){t.addHook("cancelTask",this.onCancelTask.bind(this)),t.addHook("showSavedMessage",this.onSaveShortcut.bind(this)),t.addHook("goToNextTab",this.onNextPrevTabShortcut.bind(this,"next")),t.addHook("goToPrevTab",this.onNextPrevTabShortcut.bind(this,"prev")),t.addHook("endEditingSession",this.onEndEditingSession.bind(this)),t.addHook("restartEditingSession",this.onRestartEditingSession.bind(this)),this.setDefaultKeyboardShortcuts()},addShortcut:function(t,i,l){var s=e.proxy(this,"onTriggerKey",t);l?Mousetrap.bindGlobal(i,s):Mousetrap.bind(i,s)},reset:function(){Mousetrap.reset()},setDefaultKeyboardShortcuts:function(){this.reset();for(var e in FLBuilderConfig.keyboardShortcuts){var t=FLBuilderConfig.keyboardShortcuts[e].keyCode,i=FLBuilderConfig.keyboardShortcuts[e].isGlobal;this.addShortcut(e,t,i)}},onTriggerKey:function(e,i){t.triggerHook(e),i.preventDefault?i.preventDefault():i.returnValue=!1},onCancelTask:function(){return o.isPreviewing?void o.endPreview():s.isShowing?void s.hide():t.ContentPanel.isShowing?void t.ContentPanel.hide():void 0},pause:function(){Mousetrap.pause()},unpause:function(){Mousetrap.unpause()},onEndEditingSession:function(){this.reset(),this.addShortcut("restartEditingSession","mod+e")},onRestartEditingSession:function(){this.reset(),this.setDefaultKeyboardShortcuts()},onSaveShortcut:function(){if(t.SaveManager.layoutNeedsPublish()){var e=FLBuilderStrings.savedStatus.hasAlreadySaved;t.SaveManager.showStatusMessage(e),setTimeout(function(){t.SaveManager.resetStatusMessage()},2e3)}else{var e=FLBuilderStrings.savedStatus.nothingToSave;t.SaveManager.showStatusMessage(e),setTimeout(function(){t.SaveManager.resetStatusMessage()},2e3)}},onNextPrevTabShortcut:function(i,l){var s,o,n=e(".fl-lightbox:visible"),r=n.find(".fl-builder-settings-tabs a");n.length>0&&(s=r.filter("a.fl-active"),o="next"==i?s.is(r.last())?r.first():s.next("a"):s.is(r.first())?r.last():s.prev("a"),o.trigger("click")),t._calculateSettingsTabsOverflow(),l.preventDefault()}},l={isShowing:!1,init:function(){this.render(),t.addHook("showKeyboardShortcuts",this.show.bind(this))},render:function(){var t=wp.template("fl-keyboard-shortcuts"),i=FLBuilderConfig.keyboardShortcuts;this.$el=e(t(i)),e("body").append(this.$el),this.$el.find(".dismiss-shortcut-ui").on("click",this.hide.bind(this)),this.$el.on("click",this.hide.bind(this))},show:function(){this.isShowing||(this.$el.addClass("is-showing"),this.isShowing=!0)},hide:function(){this.isShowing&&(this.$el.removeClass("is-showing"),this.isShowing=!1)},toggle:function(){this.isShowing?this.hide():this.show()}},s=FLExtendableObject.create({isShowing:!1,init:function(){this.$el=e(".fl-builder-publish-actions"),this.$defaultBarButtons=e(".fl-builder-bar-actions"),this.$clickAwayMask=e(".fl-builder-publish-actions-click-away-mask"),this.$doneBtn=this.$defaultBarButtons.find(".fl-builder-done-button"),this.$doneBtn.on("click",this.onDoneTriggered.bind(this)),this.$actions=this.$el.find(".fl-builder-button"),this.$actions.on("click",this.onActionClicked.bind(this)),t.addHook("triggerDone",this.onDoneTriggered.bind(this));var i=this.hide.bind(this);t.addHook("cancelPublishActions",i),t.addHook("endEditingSession",i),this.$clickAwayMask.on("click",i)},onDoneTriggered:function(){t.SaveManager.layoutNeedsPublish()?this.show():FLBuilderConfig.shouldRefreshOnPublish?t._exit():t._exitWithoutRefresh()},show:function(){this.isShowing||t._triggerSettingsSave(!1,!0)&&(this.$el.removeClass("is-hidden"),this.$defaultBarButtons.css("opacity","0"),this.$clickAwayMask.show(),this.isShowing=!0,t.triggerHook("didShowPublishActions"))},hide:function(){this.isShowing&&(this.$el.addClass("is-hidden"),this.$defaultBarButtons.css("opacity","1"),this.$clickAwayMask.hide(),this.isShowing=!1)},onActionClicked:function(i){var l=e(i.currentTarget).data("action");switch(l){case"dismiss":this.hide();break;case"discard":this.hide(),o.muteToolbar(),t._discardButtonClicked();break;case"publish":this.hide(),o.muteToolbar(),t._publishButtonClicked(),t._destroyOverlayEvents();break;case"draft":this.hide(),o.muteToolbar(),t._draftButtonClicked();break;default:this.hide(),o.muteToolbar(),t._draftButtonClicked()}t.triggerHook(l+"ButtonClicked")}}),o={isPreviewing:!1,init:function(){this.$el=e("body"),this.$mainToolbar=e(".fl-builder-bar"),this.$mainToolbarContent=this.$mainToolbar.find(".fl-builder-bar-content"),this.$wpAdminBar=e("#wpadminbar"),this.$endPreviewBtn=e(".fl-builder--preview-actions .end-preview-btn"),t.addHook("endEditingSession",this.endEditingSession.bind(this)),t.addHook("previewLayout",this.togglePreview.bind(this)),this.$endPreviewBtn.on("click",this.endPreview.bind(this)),this.$deviceIcons=e(".fl-builder--preview-actions i"),this.$deviceIcons.on("click",this.onDeviceIconClick.bind(this));var i=this.$wpAdminBar.find("#wp-admin-bar-fl-builder-frontend-edit-link > a, #wp-admin-bar-fl-theme-builder-frontend-edit-link > a");i.on("click",this.onClickPageBuilderToolbarLink.bind(this)),e("#wpadminbar a").attr("tabindex","-1");var l=this.restartEditingSession.bind(this);t.addHook("restartEditingSession",l),t.addHook("didHideAllLightboxes",this.unmuteToolbar.bind(this)),t.addHook("didCancelDiscard",this.unmuteToolbar.bind(this)),t.addHook("didEnterRevisionPreview",this.hide.bind(this)),t.addHook("didExitRevisionPreview",this.show.bind(this)),t.addHook("didPublishLayout",this.onPublish.bind(this))},endEditingSession:function(){t._destroyOverlayEvents(),t._removeAllOverlays(),t._removeEmptyColHighlights(),t._removeColHighlightGuides(),t._unbindEvents(),e("html").removeClass("fl-builder-edit").addClass("fl-builder-show-admin-bar"),e("body").removeClass("fl-builder-edit"),e("#wpadminbar a").attr("tabindex",null),e(t._contentClass).removeClass("fl-builder-content-editing"),this.hideMainToolbar(),t.ContentPanel.hide(),FLBuilderLayout.init()},restartEditingSession:function(i){t._initTemplateSelector(),t._bindOverlayEvents(),t._highlightEmptyCols(),e("html").addClass("fl-builder-edit").removeClass("fl-builder-show-admin-bar"),e("body").addClass("fl-builder-edit"),e("#wpadminbar a").attr("tabindex","-1"),e(t._contentClass).addClass("fl-builder-content-editing"),this.showMainToolbar(),i.preventDefault()},onClickPageBuilderToolbarLink:function(e){t.triggerHook("restartEditingSession"),e.preventDefault()},onPublish:function(){var e=this.$wpAdminBar.find("#wp-admin-bar-fl-builder-frontend-edit-link > a span");e.css("color","#6bc373")},hide:function(){e("html").hasClass("fl-builder-edit")&&(t._unbindEvents(),t._destroyOverlayEvents(),t._removeAllOverlays(),e("html").removeClass("fl-builder-edit"),e("body").removeClass("admin-bar"),this.hideMainToolbar(),t.ContentPanel.hide(),FLBuilderLayout.init(),t.triggerHook("didHideEditingUI"))},show:function(){e("html").hasClass("fl-builder-edit")||(t._bindOverlayEvents(),this.showMainToolbar(),FLBuilderResponsiveEditing._switchTo("default"),e("html").addClass("fl-builder-edit"),e("body").addClass("admin-bar"),t.triggerHook("didShowEditingUI"))},beginPreview:function(){t._triggerSettingsSave(!1,!0)&&(this.isPreviewing=!0,this.hide(),e("html").addClass("fl-builder-preview"),e("html, body").removeClass("fl-builder-edit"),t._removeEmptyColHighlights(),t._removeColHighlightGuides(),t.triggerHook("didBeginPreview"),FLBuilderResponsivePreview.enter())},endPreview:function(){this.isPreviewing=!1,this.show(),t._highlightEmptyCols(),FLBuilderResponsivePreview.exit(),e("html").removeClass("fl-builder-preview"),e("html, body").addClass("fl-builder-edit")},togglePreview:function(){this.isPreviewing?this.endPreview():this.beginPreview()},hideMainToolbar:function(){this.$mainToolbar.addClass("is-hidden"),e("html").removeClass("fl-builder-is-showing-toolbar")},showMainToolbar:function(){this.unmuteToolbar(),this.$mainToolbar.removeClass("is-hidden"),e("html").addClass("fl-builder-is-showing-toolbar")},onDeviceIconClick:function(t){var i=e(t.target).data("mode");FLBuilderResponsivePreview.switchTo(i)},muteToolbar:function(){this.$mainToolbarContent.addClass("is-muted"),t._hideTipTips()},unmuteToolbar:function(){this.$mainToolbarContent.removeClass("is-muted")}},n={isEditing:!0,init:function(){history.pushState&&(t.addHook("endEditingSession",this.onLeaveBuilder.bind(this)),t.addHook("restartEditingSession",this.onEnterBuilder.bind(this)))},onEnterBuilder:function(){history.replaceState({},document.title,FLBuilderConfig.editUrl),this.isEditing=!0},onLeaveBuilder:function(){history.replaceState({},document.title,FLBuilderConfig.url),this.isEditing=!1}},r={$row:null,$rowContent:null,row:null,drag:{},init:function(){if(this.userCanResize()){var i=e(t._contentClass);i.delegate(".fl-block-row-resize","mouseenter",this.onDragHandleHover.bind(this)),i.delegate(".fl-block-row-resize","mousedown",this.onDragHandleDown.bind(this))}},userCanResize:function(){return FLBuilderConfig.rowResize.userCanResizeRows},onDragHandleHover:function(t){if(!this.drag.isDragging){var i=e(t.target);this.$row=i.closest(".fl-row"),this.$rowContent=this.$row.find(".fl-row-content"),this.row={node:this.$row.data("node"),isFixedWidth:this.$row.hasClass("fl-row-fixed-width"),settings:e(".fl-builder-row-settings[data-node="+this.$row.data("node")+"]")},this.drag={edge:null,isDragging:!1,originalPosition:null,originalWidth:null,calculatedWidth:null,operation:null},this.row.isFixedWidth?this.drag.originalWidth=this.$row.width():this.drag.originalWidth=this.$rowContent.width(),this.dragInit()}},onDragHandleDown:function(){e("body").addClass("fl-builder-row-resizing")},dragInit:function(e){this.$row.find(".fl-block-row-resize").draggable({axis:"x",start:this.dragStart.bind(this),drag:this.dragging.bind(this),stop:this.dragStop.bind(this)})},dragStart:function(i,l){var s=e("body"),o=e(l.helper);this.drag.isDragging=!0,this.row.isFixedWidth?this.drag.originalWidth=this.$row.width():this.drag.originalWidth=this.$rowContent.width(),o.hasClass("fl-block-col-resize-e")&&(this.drag.edge="e",this.$feedback=o.find(".fl-block-col-resize-feedback-left")),o.hasClass("fl-block-col-resize-w")&&(this.drag.edge="w",this.$feedback=o.find(".fl-block-col-resize-feedback-right")),s.addClass("fl-builder-row-resizing"),t._colResizing=!0,t._destroyOverlayEvents(),t._closePanel()},dragging:function(e,t){var i=t.position.left,l=t.originalPosition.left,s=this.drag.originalWidth,o=0,n=this.drag.edge,r=FLBuilderConfig.rowResize.minAllowedWidth,a=FLBuilderConfig.rowResize.maxAllowedWidth;l!==i&&(FLBuilderConfig.isRtl&&(n="w"==n?"e":"w"),l>i?"w"===n?this.drag.operation="+":this.drag.operation="-":"e"===n?this.drag.operation="+":this.drag.operation="-",o=Math.abs(l-i),"+"===this.drag.operation?this.drag.calculatedWidth=s+2*o:this.drag.calculatedWidth=s-2*o,!1!==r&&this.drag.calculatedWidth<r&&(this.drag.calculatedWidth=r),!1!==a&&this.drag.calculatedWidth>a&&(this.drag.calculatedWidth=a),this.row.isFixedWidth&&this.$row.css("max-width",this.drag.calculatedWidth+"px"),this.$rowContent.css("max-width",this.drag.calculatedWidth+"px"),_.isUndefined(this.$feedback)||this.$feedback.html(this.drag.calculatedWidth+"px").show(),this.row.settings.length&&this.row.settings.find("[name=max_content_width]").val(this.drag.calculatedWidth))},dragStop:function(i,l){this.drag.isDragging=!1,_.isUndefined(this.$feedback)||this.$feedback.hide();var s={action:"resize_row_content",node:this.row.node,width:this.drag.calculatedWidth},o=e("body");t.ajax(s),t._bindOverlayEvents(),o.removeClass("fl-builder-row-resizing"),e(".fl-block-overlay").each(function(){t._buildOverlayOverflowMenu(e(this))}),e("body").removeClass("fl-builder-row-resizing"),setTimeout(function(){t._colResizing=!1},50),t.triggerHook("didResizeRow",{rowId:this.row.node,rowWidth:this.drag.calculatedWidth})}},a={templateName:"fl-toolbar",init:function(){this.template=wp.template(this.templateName),this.render(),this.initTipTips();var e=this.$el.find(".fl-builder-content-panel-button");e.on("click",t._togglePanel),this.$el.find(".fl-builder-buy-button").on("click",t._upgradeClicked),this.$el.find(".fl-builder-upgrade-button").on("click",t._upgradeClicked)},render:function(t){var i=e(this.template(t));this.$el=i,this.el=i.get(0),o.$mainToolbar=this.$el,e("body").prepend(i),e("html").addClass("fl-builder-is-showing-toolbar")},initTipTips:function(){e(".fl-builder--saving-indicator").tipTip({defaultPosition:"bottom",edgeOffset:14}),e(".fl-builder-publish-actions .fl-builder-button-group .fl-builder-button").tipTip({defaultPosition:"bottom",edgeOffset:6})}};e(function(){t.ContentPanel.init(),FLBuilderConfig.simpleUi||t.MainMenu.init(),FLBuilderConfig.showToolbar?(a.init(),t.ContentPanel.alignPanelArrow()):e("html").addClass("fl-builder-no-toolbar"),i.init(),l.init(),o.init(),n.init(),r.init(),s.init(),t.triggerHook("didInitUI")})}(jQuery,FLBuilder),function(e,t){var i=FLExtendableObject.create({templateName:"fl-main-menu-panel-view",name:"Untitled View",isShowing:!1,isRootView:!1,items:{},init:function(){this.template=wp.template(this.templateName)},render:function(){return this.template(this)},bindEvents:function(){this.$items=this.$el.find(".fl-builder--menu-item")},show:function(){this.$el.addClass("is-showing")},hide:function(){this.$el.removeClass("is-showing")},transitionIn:function(e){requestAnimationFrame(this.show.bind(this))},transitionOut:function(e){this.hide()}}),l=FLExtendableObject.create({templateName:"fl-main-menu-panel",template:null,menu:null,views:{},viewNavigationStack:[],isShowing:!1,shouldShowTabs:!1,init:function(){this.template=wp.template(this.templateName),e("body").prepend(this.template(this)),this.$el=e(".fl-builder--main-menu-panel"),this.$el.find(".fl-builder--main-menu-panel-views").html("");for(var i in FLBuilderConfig.mainMenu){this.renderPanel(i);var l="render"+i.charAt(0).toUpperCase()+i.slice(1)+"Panel";t.addHook(l,e.proxy(function(){this.renderPanel(i)},this))}e("body").on("click",".fl-builder--main-menu-panel .pop-view",this.goToPreviousView.bind(this)),this.$tabs=this.$el.find(".fl-builder--tabs > span"),this.$tabs.on("click",this.onItemClick.bind(this)),this.$barTitle=e(".fl-builder-bar-title"),e("body").on("click",".fl-builder-bar-title",this.toggle.bind(this));var n=this.hide.bind(this);t.addHook("didShowPublishActions",n),t.addHook("didBeginSearch",n),t.addHook("didBeginPreview",n),t.addHook("didShowContentPanel",n),t.addHook("endEditingSession",n),t.addHook("didFocusSearchBox",n),t.addHook("didEnterRevisionPreview",n),t.addHook("didFailSettingsSave",n),t.addHook("showKeyboardShortcuts",n),this.$mask=e(".fl-builder--main-menu-panel-mask"),this.$mask.on("click",n),s.init(),o.init()},renderPanel:function(t){var l,s,o;e('fl-builder--main-menu-panel-view[data-name="'+t+'"]').remove(),l=FLBuilderConfig.mainMenu[t],l.handle=t,s=i.create(l),s.init(),o=e(s.render()),s.$el=o,e(".fl-builder--main-menu-panel-views").append(o),s.bindEvents(),s.$el.find(".fl-builder--menu-item").on("click",this.onItemClick.bind(this)),s.isRootView&&(this.rootView=s,this.currentView=s),this.views[t]=s},show:function(){this.isShowing||(this.$el.addClass("is-showing"),this.$barTitle.addClass("is-showing-menu"),this.currentView.transitionIn(),this.isShowing=!0,this.$mask.show(),t.triggerHook("didOpenMainMenu"))},hide:function(){this.isShowing&&(this.$el.removeClass("is-showing"),this.$barTitle.removeClass("is-showing-menu"),this.isShowing=!1,this.resetViews(),this.$mask.hide())},toggle:function(){this.isShowing?this.hide():this.show()},onItemClick:function(i){var l=e(i.currentTarget),s=l.data("type");switch(s){case"view":var o=l.data("view");this.goToView(o);break;case"event":var n=l.data("event");t.triggerHook(n,l);break;case"link":}},goToView:function(e){var t=this.currentView,i=this.views[e];t.transitionOut(),i.transitionIn(),this.currentView=i,this.viewNavigationStack.push(t)},goToPreviousView:function(){var t=this.currentView,i=this.viewNavigationStack.pop();t.transitionOut(!0),i.transitionIn(!0),this.currentView=i,e(".fl-builder-bar-title-caret").focus()},resetViews:function(){this.currentView!=this.rootView&&(this.currentView.hide(),this.rootView.show(),this.currentView=this.rootView,this.viewNavigationStack=[])}});t.MainMenu=l;var s={init:function(){t.addHook("saveTemplate",this.saveTemplate.bind(this)),t.addHook("saveCoreTemplate",this.saveCoreTemplate.bind(this)),t.addHook("duplicateLayout",this.duplicateLayout.bind(this)),t.addHook("showLayoutSettings",this.showLayoutSettings.bind(this)),t.addHook("showGlobalSettings",this.showGlobalSettings.bind(this)),t.addHook("toggleUISkin",this.toggleUISkin.bind(this)),t.addHook("clearLayoutCache",this.clearLayoutCache.bind(this))},saveTemplate:function(){t._saveUserTemplateClicked(),l.hide()},saveCoreTemplate:function(){FLBuilderCoreTemplatesAdmin._saveClicked(),l.hide()},duplicateLayout:function(){t._duplicateLayoutClicked(),l.hide()},showGlobalSettings:function(){t._globalSettingsClicked(),l.hide()},showLayoutSettings:function(){t._layoutSettingsClicked(),l.hide()},clearLayoutCache:function(){t.ajax({action:"clear_cache"},function(){location.href=FLBuilderConfig.editUrl}),t.showAjaxLoader(),l.hide()},toggleUISkin:function(i){e('a[data-event="toggleUISkin"]');if(e("body").hasClass("fl-builder-ui-skin--light"))var l="light",s="dark";if(e("body").hasClass("fl-builder-ui-skin--dark"))var l="dark",s="light";e("body").removeClass("fl-builder-ui-skin--"+l).addClass("fl-builder-ui-skin--"+s),t.ajax({action:"save_ui_skin",skin_name:s})}},o={init:function(){t.addHook("beginTour",this.onStartTourClicked.bind(this))},onStartTourClicked:function(){FLBuilderTour.start(),l.hide()}}}(jQuery,FLBuilder),function(e,t){var i=FLExtendableObject.create({handle:"",name:"",panel:null,shouldShowTabItem:!0,isShowing:!1,views:{},activeView:null,defaultView:null,categorySelector:null,init:function(i){this.categorySelector=a.create({handle:"selector-"+this.handle,tab:this,items:[]}),this.categorySelector.init(),e(this.categorySelector).on("categorySelected",this.onViewSelected.bind(this));i.views;if(this.initViews(i.views),0===Object.keys(this.views).length){var l={handle:"noViews",name:"No Views",templateName:"fl-content-panel-no-view"};this.addView(l);
|
8 |
-
}if(!this.activeView){var s=Object.keys(this.views)[0],l=this.views[s];this.activeView=l}this.defaultView=this.activeView,e(this.panel).on("afterRender",this.renderView.bind(this,this.activeView)),e(this.panel).on("onShow onShowTab",this.initScroller.bind(this)),t.addHook("contentItemsChanged",this.onLibraryDataChanged.bind(this))},initViews:function(e){for(var t in e){var i=e[t];this.categorySelector.addItem(i),"separator"!==i.type&&this.addView(i)}},addView:function(e){var t=l;switch(this.handle){case"modules":t=s;break;case"rows":t=o;break;case"templates":t=n;break;case"saved":t=r;break;default:t=l}_.isNull(this.viewController)||_.isUndefined(this.viewController)||(t=window[this.viewController]);var i=t.create(e),a=i.handle;i.init(),this.views[a]=i,i.isShowing&&(this.activeView=i)},renderView:function(e){if(this.$el=this.panel.$el.find('.fl-builder--panel-view[data-tab="'+this.handle+'"]'),_.isObject(e))var i=e;else var i=this.views[e];if(_.isObject(i)&&_.isFunction(i.render)){var l=i.render();this.$el.find(".fl-nanoscroller-content").html(l),this.activeView=i,t._initSortables(),this===this.panel.activeTab&&this.renderGroupSelector(),this.initScroller(),this.$el.find(".fl-nanoscroller-content").scrollTop(0)}},initScroller:function(){this.$el.nanoScroller({alwaysVisible:!0,preventPageScrolling:!0,paneClass:"fl-nanoscroller-pane",sliderClass:"fl-nanoscroller-slider",contentClass:"fl-nanoscroller-content"})},show:function(){e(this.activeView).trigger("onBeforeShow"),this.renderGroupSelector(),this.isShowing=!0,this.$el.addClass("is-showing"),this.$el.find(".fl-nanoscroller-content").scrollTop(0)},hide:function(){this.isShowing=!1,this.$el.removeClass("is-showing"),this.activeView!==this.defaultView&&this.renderView(this.defaultView),_.isObject(this.categorySelector)&&this.categorySelector.close()},renderGroupSelector:function(){var e=this.panel.$groupSelect,t=this.panel.$el.find(".fl-builder-panel-search");if(this.isSearchEnabled?t.show():t.hide(),Object.keys(this.views).length>1&&!_.isUndefined(this.categorySelector)){var i=this.categorySelector.render();this.panel.$el.find(".fl-builder-content-group-select");e.html(i),e.show(),this.panel.$el.removeClass("single-view")}else e.hide(),t.hide(),this.panel.$el.addClass("single-view")},onViewSelected:function(e,t){this.renderView(t),this.categorySelector.close()},onLibraryDataChanged:function(){this.renderView(this.activeView)}}),l=FLExtendableObject.create({templateName:"",name:"",handle:"",query:null,init:function(){this.template=wp.template(this.templateName),e(this).on("afterRender",this.bindEvents.bind(this)),e(this).trigger("afterInit")},filterTemplateData:function(e){return _.isNull(this.query)||_.isUndefined(this.query)||(e.queryResults=t.Search.byQuery(this.query)),e},render:function(){e(this).trigger("beforeRender");var t=this;t=this.filterTemplateData(t);var i=e(this.template(t));return this.$el=i,e(this).trigger("afterRender"),i},bindEvents:function(){},transitionIn:function(){},transitionOut:function(){}}),s=l.create({templateName:"fl-content-panel-modules-view",bindEvents:function(){this.$sections=this.$el,this.$items=this.$el.find(".fl-builder-block, .fl-builder-blocks-section-title")}}),o=l.create({templateName:"fl-content-panel-row-templates-view",bindEvents:function(){this.$items=this.$el.find(".fl-builder-block, .fl-builder-blocks-section-title")}}),n=l.create({templateName:"fl-content-panel-templates-view",bindEvents:function(){this.$items=this.$el.find(".fl-builder--template-collection-item"),this.$items.on("click",this.onTemplateClick.bind(this)),this.$userTemplateSections=e(".fl-user-templates"),this.$userTemplates=this.$el.find(".fl-user-template, .fl-builder--save-new-user-template"),this.$saveNewTemplateInput=this.$el.find('.fl-save-control input[name="template-name"]'),this.$saveNewTemplateCat=this.$el.find('.fl-save-control input[name="template-category"]'),this.$saveNewTemplateBtn=this.$el.find(".fl-save-control button"),this.$saveNewMask=this.$el.find(".fl-save-control-mask"),this.$saveNewTemplateInput.on("focus",this.onSaveInputFocus.bind(this)),this.$saveNewTemplateInput.on("keyup",this.onSaveInputKeyup.bind(this)),this.$saveNewTemplateBtn.on("click",this.onSaveButtonClick.bind(this)),this.$saveNewMask.on("click",this.resetSaveInput.bind(this))},onSaveInputFocus:function(){this.resetSaveInput(),this.$saveNewMask.show()},resetSaveInput:function(){this.$saveNewTemplateInput.val(""),this.$saveNewTemplateBtn.hide(),this.$saveNewMask.hide()},onSaveInputKeyup:function(t){var i=e(t.currentTarget),l=i.val(),s=i.siblings("button");""!==l?s.show():s.hide()},onSaveButtonClick:function(i){var l=e(i.currentTarget),s=l.siblings('input[name="template-name"]').val(),o=l.siblings('input[name="template-category"]').val(),n={name:s,category:o};""!==s&&t.ajax({action:"save_user_template",settings:n},t._saveUserTemplateSettingsComplete)},onTemplateClick:function(i){var l=e(i.currentTarget),s=l.data("id"),o=l.data("type");t._requestTemplateInsert(s,o)}}),r=l.create({templateName:"fl-content-panel-saved-view",filterTemplateData:function(e){return e.queryResults=t.Search.byQuery({kind:"template",type:"user",content:["module","row"]}),e}}),a=FLExtendableObject.create({templateName:"fl-content-panel-category-selector",template:null,tab:null,isOpen:!1,items:{},init:function(){this.template=wp.template(this.templateName),e(this).on("afterRender",this.bindEvents.bind(this)),e(this.tab.panel).on("didShowSearchControls",this.close.bind(this))},render:function(){this.close();var t=e(this.template(this));return this.$el=t,e(this).trigger("afterRender"),t},bindEvents:function(){this.$selectorTitle=this.$el.find(".fl-builder--selector-display"),this.$selectorTitle.on("click",this.toggleOpenClose.bind(this)),this.$categories=this.$el.find(".fl-builder--selector-menu .fl-builder--menu-item"),this.$categories.on("click",this.onCategoryClick.bind(this))},addItem:function(e){var t;t=_.isUndefined(e.handle)?_.uniqueId("sep_"):e.handle,this.items[t]=e},open:function(){this.isOpen||(this.$el.addClass("is-showing"),this.isOpen=!0)},close:function(){this.isOpen&&(this.$el.removeClass("is-showing"),this.isOpen=!1,this.$selectorTitle.find("button").focus())},toggleOpenClose:function(){this.isOpen?this.close():this.open()},onCategoryClick:function(t){var i=e(t.target).data("view");e(this).trigger("categorySelected",i)}});t.ContentPanel=FLExtendableObject.create({templateName:"fl-content-panel-base",template:null,tabs:{},activeTab:null,isShowing:!1,init:function(){if(FLBuilderConfig.panelData){var e=FLBuilderConfig.panelData.tabs;for(var l in e){var s=e[l];if(n=i.create(s),n.panel=this,n.views={},n.init(s),this.tabs[l]=n,n.isShowing&&(this.activeTab=n),!this.activeTab){var o=Object.keys(this.tabs)[0],n=this.tabs[o];n.isShowing=!0,this.activeTab=n}}this.template=wp.template(this.templateName),this.render(),this.renderSearchResults=wp.template("fl-search-results-panel"),this.renderNoResults=wp.template("fl-search-no-results"),t.triggerHook("contentPanelDidInit")}},render:function(){e("body").prepend(this.template(this)),this.$el=e(".fl-builder--content-library-panel"),this.bindEvents(),this.$groupSelect=this.$el.find(".fl-builder-content-group-select"),e(this).trigger("afterRender")},bindEvents:function(){this.$tabs=this.$el.find(".fl-builder--tabs [data-tab]"),this.$tabs.on("mouseup",this.onTabItemMouseUp.bind(this)),this.$tabs.on("click",this.onTabItemClick.bind(this)),this.$search=this.$el.find(".fl-builder-panel-search"),this.$searchBtn=this.$search.find(".fl-builder-toggle-panel-search"),this.$searchInput=this.$search.find('input[name="search-term"]'),this.$searchBtn.on("click",this.onSearchButtonClicked.bind(this)),this.$search.find(".fl-builder-dismiss-panel-search").on("click",this.onDismissButtonClicked.bind(this)),this.$searchInput.on("keyup",this.onSearchTermChanged.bind(this)),this.$searchPanel=this.$el.find(".fl-builder--search-results-panel"),t.addHook("showContentPanel",this.show.bind(this)),t.addHook("showModules",this.show.bind(this,"modules")),t.addHook("showRows",this.show.bind(this,"rows")),t.addHook("showTemplates",this.show.bind(this,"templates")),t.addHook("showSaved",this.show.bind(this,"saved")),t.addHook("showSearch",this.goToSearch.bind(this));var e=this.hide.bind(this);t.addHook("hideContentPanel",e),t.addHook("didShowLightbox",e),t.addHook("didShowPublishActions",e),t.addHook("didBeginSearch",e),t.addHook("didInitDrag",e),t.addHook("didOpenMainMenu",e),t.addHook("didApplyTemplate",e);var i=this.toggleShowHide.bind(this);t.addHook("toggleContentPanel",i),t.addHook("didStopDrag",this.hideSearchControls.bind(this))},alignPanelArrow:function(){var t,i,l=this.$el,s=null,o=this.$el.find(".fl-builder--panel-arrow"),n=e(".fl-builder-content-panel-button"),r=this.$el.css("animation-duration");if(0!=n.length){this.$el.css("animation-duration","0s"),this.show(),s=l[0].getBoundingClientRect(),t=o[0].getBoundingClientRect(),this.hide(),this.$el.css("animation-duration",r),buttonOffset=n[0].getBoundingClientRect();var a=buttonOffset.x+buttonOffset.width/2;i=a<s.x?20:a-s.x-t.width/2,o.css({right:"auto",left:i+"px"})}},show:function(i){"module"===FLBuilderConfig.userTemplateType||FLBuilderConfig.simpleUi||(t.triggerHook("willShowContentPanel"),"undefined"!=typeof i&&this.showTab(i),this.isShowing||t._triggerSettingsSave(!1,!0)&&(e("body").addClass("fl-builder-content-panel-is-showing"),this.isShowing=!0,e(this).trigger("onShow"),t.triggerHook("didShowContentPanel")))},hide:function(){this.isShowing&&(this.$el.hasClass("fl-builder-ui-pinned")||(e("body").removeClass("fl-builder-content-panel-is-showing"),this.isShowing=!1,e(this).trigger("onHide"),t.triggerHook("didHideContentPanel")))},toggleShowHide:function(){this.isShowing?this.hide():this.show()},showTab:function(t){var i=this.tabs[t];_.isObject(i)&&(_.isObject(this.activeTab)&&(this.activeTab.hide(),this.$tabs.filter(".is-showing").removeClass("is-showing")),this.hideSearchControls(),i.show(),this.$tabs.filter('[data-tab="'+i.handle+'"]').addClass("is-showing"),this.activeTab=i,e(this).trigger("onShowTab"))},goToSearch:function(){this.show("modules"),this.$el.find(".fl-builder-toggle-panel-search").trigger("click")},onTabItemMouseUp:function(t){e(t.currentTarget).blur()},onTabItemClick:function(t){var i=e(t.target),l=i.data("tab");this.showTab(l)},onSearchButtonClicked:function(){this.showSearchControls()},onDismissButtonClicked:function(){this.hideSearchControls(),this.$searchBtn.focus()},showSearchControls:function(){this.$search.addClass("is-showing-input"),this.$search.find('input[name="search-term"]').focus(),e(".fl-builder--selector-display-label").attr("tabindex",-1),this.$searchBtn.attr("tabindex",-1),e(this).trigger("didShowSearchControls")},hideSearchControls:function(){this.$search.removeClass("is-showing-input"),this.clearSearchInput(),this.hideSearchResults(),e(".fl-builder--selector-display-label").attr("tabindex",null),this.$searchBtn.attr("tabindex",null)},onSearchTermChanged:function(e){var i=this.$searchInput.val();if(""!==i){var l=t.Search.byTerm(i);""!=l.term?this.showSearchResults(l):this.hideSearchResults()}else this.hideSearchResults()},clearSearchInput:function(){this.$searchInput.val(""),this.hideSearchResults()},showSearchResults:function(i){if(i.total>0){var l=e(this.renderSearchResults(i));this.$searchPanel.html(l),t._initSortables()}else{var l=e(this.renderNoResults(i));this.$searchPanel.html(l)}e("body").addClass("fl-builder-search-results-panel-is-showing")},hideSearchResults:function(){e("body").removeClass("fl-builder-search-results-panel-is-showing")}})}(jQuery,FLBuilder),function(e){FLBuilderSettingsForms={config:null,settings:null,legacyXhr:null,init:function(){this.bind()},bind:function(){FLBuilder.addHook("didDeleteRow",this.closeOnDeleteNode),FLBuilder.addHook("didDeleteColumn",this.closeOnDeleteNode),FLBuilder.addHook("didDeleteModule",this.closeOnDeleteNode)},render:function(t,i){var l=FLBuilderSettingsConfig.forms,s=FLBuilderSettingsConfig.modules,o={type:"general",id:null,nodeId:null,className:"",attrs:"",title:"",badges:[],tabs:[],buttons:[],settings:{},legacy:null,rules:null,preview:null,helper:null};if(t.nodeId&&!t.settings)return void this.loadNodeSettings(t,i);if(t=e.extend(o,t),i=void 0===i?function(){}:i,t.id){if("general"===t.type&&void 0!==l[t.id])t=e.extend(!0,t,l[t.id]);else{if("module"!==t.type||void 0===s[t.id])return;t=e.extend(!0,t,s[t.id])}this.config=t,this.renderLightbox(t)&&(t.legacy||!this.renderLegacySettings(t,i)?this.renderComplete(t,i):this.showLightboxLoader())}},loadNodeSettings:function(e,t){FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"get_node_settings",node_id:e.nodeId},function(i){e.settings=JSON.parse(i),FLBuilderSettingsConfig.nodes[e.nodeId]=e.settings,FLBuilderSettingsForms.render(e,t),FLBuilder.hideAjaxLoader()})},renderLightbox:function(t){var i=wp.template("fl-builder-settings"),l=FLBuilder._lightbox._node.find("form.fl-builder-settings");e(".fl-lightbox-wrap[data-parent]");if(t.nodeId&&t.nodeId===l.data("node")&&!t.lightbox)return FLBuilder._focusFirstSettingsControl(),!1;if(t.lightbox)t.lightbox.setContent(i(t));else{if(!FLBuilder._triggerSettingsSave(!0,!0))return!1;FLBuilder.preview&&FLBuilder.preview.cancel(),FLBuilder._closePanel(),FLBuilder._showLightbox(),FLBuilder._setLightboxContent(i(t))}return!0},renderComplete:function(t,i){var l=e(".fl-builder-settings:visible");setTimeout(function(){t.legacy&&this.renderLegacySettingsComplete(t.legacy),i(),FLBuilder._initSettingsForms(),t.rules&&FLBuilder._initSettingsValidation(t.rules),t.preview&&(FLBuilder.preview=new FLBuilderPreview(t.preview)),t.helper&&t.helper.init(),l.closest(".fl-lightbox-wrap[data-parent]").length||(this.settings=FLBuilder._getSettings(l))}.bind(this),1)},renderFields:function(t,i){var l=wp.template("fl-builder-settings-row"),s="",o=null,n=null,r=null,a=!1,d=null,u=["dimension","unit"],i=i?i:this.config.settings,c=FLBuilderConfig.global;for(n in t)o=t[n],a=!!o.multiple,supportsResponsive=e.inArray(o.type,u)>-1,r=_.isUndefined(i[n])?"":i[n],_.isUndefined(i[n])&&o["default"]&&(r=o["default"]),d=o.responsive&&c.responsive_enabled&&!a&&supportsResponsive?o.responsive:null,s+=l({field:o,name:n,rootName:n,value:r,preview:JSON.stringify(o.preview?o.preview:{type:"refresh"}),responsive:d,rowClass:o.row_class?" "+o.row_class:"",isMultiple:a,supportsMultiple:"editor"!==o.type&&"photo"!==o.type&&"service"!==o.type,settings:i,globalSettings:c,template:e("#tmpl-fl-builder-field-"+o.type)});return s},renderField:function(e){var t=wp.template("fl-builder-field");return t(e)},renderSectionTemplate:function(e,t){var i=wp.template(e.template.id);return i({section:e,settings:t})},renderTabTemplate:function(e,t){var i=wp.template(e.template.id);return i({tab:e,settings:t})},renderLegacySettings:function(t,i){var l=e(".fl-builder-settings:visible"),s=null,o=!1,n={tabs:[],sections:[],fields:[],settings:null,node_id:null};return l.find(".fl-legacy-field").each(function(){s=e(this),n.fields.push(s.attr("data-field")),FLBuilderSettingsForms.showFieldLoader(s),o=!0}),l.find(".fl-legacy-settings-section").each(function(){s=e(this),n.sections.push({tab:s.attr("data-tab"),section:s.attr("data-section")}),o=!0}),l.find(".fl-legacy-settings-tab").each(function(){s=e(this),n.tabs.push(s.attr("data-tab")),o=!0}),l.attr("data-node")?n.node_id=l.attr("data-node"):n.settings=FLBuilder._getOriginalSettings(l,!0),this.legacyXhr&&(this.legacyXhr.abort(),this.legacyXhr=null),this.legacyXhr=FLBuilder.ajax(e.extend(this.getLegacyVars(),{action:"render_legacy_settings",data:n,form:l.attr("data-form-id"),group:l.attr("data-form-group"),lightbox:l.closest(".fl-builder-lightbox").attr("data-instance-id")}),function(e){FLBuilderSettingsForms.renderLegacySettingsComplete(e),o&&FLBuilderSettingsForms.renderComplete(t,i),FLBuilderSettingsForms.hideLightboxLoader()}),o},renderLegacySettingsComplete:function(t){var i="object"==typeof t?t:JSON.parse(t),l=null,s=null,o="",n=null,r=null,a=null;if(i.lightbox?(l=e(".fl-builder-lightbox[data-instance-id="+i.lightbox+"]"),s=l.length?l.find(".fl-builder-settings"):null):(s=e(".fl-builder-settings:visible"),l=s.closest(".fl-builder-lightbox")),s&&s.length){for(o in i.fields)n=e("#fl-field-"+o).attr("id",""),n.after(i.fields[o]).remove();for(o in i.extras)n=e("#fl-field-"+o).find(".fl-field-control-wrapper"),n.prepend(i.extras[o].before),n.append(i.extras[o].after);for(a in i.sections)for(o in i.sections[a])r=e("#fl-builder-settings-section-"+o),r.html(i.sections[a][o]);for(o in i.tabs)a=e("#fl-builder-settings-tab-"+o),a.html(i.tabs[o]);l.data("parent")||(this.settings=FLBuilder._getSettings(s),FLBuilder.preview&&(FLBuilder.preview._savedSettings=this.settings)),_.isUndefined(window.FLThemeBuilderFieldConnections)||FLThemeBuilderFieldConnections._initSettingsForms(),this.legacyXhr=null}},getLegacyVars:function(){var t=e(".fl-builder-settings:visible"),i=t.closest(".fl-builder-lightbox"),l=i.attr("data-parent"),s=null,o=null,n={};return l&&(l=e(".fl-builder-lightbox[data-instance-id="+l+"]"),t=l.find("form.fl-builder-settings"),s=FLBuilder._getSettings(t),o=t.attr("data-node"),o&&(n.node_id=o,n.node_settings=s)),n},settingsHaveChanged:function(){var e=FLBuilder._lightbox._node.find("form.fl-builder-settings"),t=FLBuilder._getSettings(e),i=!!this.settings&&JSON.stringify(this.settings)!=JSON.stringify(t);return i},closeOnDeleteNode:function(t,i){var l=e(".fl-builder-settings[data-node]"),s=FLBuilder._contentClass+" .fl-node-"+l.data("node");l.length&&!e(s).length&&FLLightbox.closeAll()},showLightboxLoader:function(){e(".fl-builder-settings:visible").append('<div class="fl-builder-loading"></div>')},hideLightboxLoader:function(t){e(".fl-builder-settings:visible .fl-builder-loading").remove()},showFieldLoader:function(e){var t=e.closest(".fl-field-control").find(".fl-field-control-wrapper");t.hide().after('<div class="fl-field-loader">'+FLBuilderStrings.fieldLoading+"</div>")},hideFieldLoader:function(e){var t=e.closest(".fl-field"),i=e.closest(".fl-field-control").find(".fl-field-control-wrapper");i.show(),t.find(".fl-field-loader").remove()}},FLBuilderSettingsConfig="undefined"==typeof FLBuilderSettingsConfig?{}:FLBuilderSettingsConfig,e.extend(FLBuilderSettingsConfig,{init:function(){FLBuilder.addHook("didSaveNodeSettings",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didSaveNodeSettingsComplete",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didSaveGlobalSettingsComplete",this.updateOnSaveGlobalSettings.bind(this)),FLBuilder.addHook("didSaveLayoutSettingsComplete",this.updateOnSaveLayoutSettings.bind(this)),FLBuilder.addHook("didAddRow",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didAddColumnGroup",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didAddColumn",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didAddModule",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didDeleteRow",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didDeleteColumn",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didDeleteModule",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didDuplicateRow",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didDuplicateColumn",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didDuplicateModule",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didResizeRow",this.updateOnRowResize.bind(this)),FLBuilder.addHook("didResizeColumn",this.updateOnColumnResize.bind(this)),FLBuilder.addHook("didResetRowWidth",this.updateOnResetRowWidth.bind(this)),FLBuilder.addHook("didResetColumnWidths",this.updateOnResetColumnWidths.bind(this)),FLBuilder.addHook("didApplyTemplateComplete",this.updateOnApplyTemplate.bind(this)),FLBuilder.addHook("didApplyRowTemplateComplete",this.updateOnApplyTemplate.bind(this)),FLBuilder.addHook("didSaveGlobalNodeTemplate",this.updateOnApplyTemplate.bind(this)),FLBuilder.addHook("didRestoreRevisionComplete",this.updateOnApplyTemplate.bind(this))},updateOnSaveGlobalSettings:function(e,t){this.settings.global=t},updateOnSaveLayoutSettings:function(e,t){this.settings.layout=t},updateOnNodeEvent:function(){var e=arguments[0];e.namespace.indexOf("didAdd")>-1?this.addNode(arguments[1]):e.namespace.indexOf("didSaveNodeSettings")>-1?this.updateNode(arguments[1].nodeId,arguments[1].settings):e.namespace.indexOf("didDelete")>-1?this.deleteNodes():e.namespace.indexOf("didDuplicate")>-1&&this.duplicateNode(arguments[1].oldNodeId,arguments[1].newNodeId)},updateOnRowResize:function(e,t){this.nodes[t.rowId].max_content_width=t.rowWidth},updateOnResetRowWidth:function(e,t){this.nodes[t].max_content_width=""},updateOnColumnResize:function(e,t){this.nodes[t.colId].size=t.colWidth,this.nodes[t.siblingId].size=t.siblingWidth},updateOnResetColumnWidths:function(t,i){var l=this;i.cols.each(function(){var t=e(this),i=t.attr("data-node");l.nodes[i]&&(l.nodes[i].size=parseFloat(t[0].style.width))})},updateOnApplyTemplate:function(e,t){this.nodes=t.nodes,this.attachments=t.attachments},addNode:function(t,i){var l=e(".fl-node-"+t),s=l.hasClass("fl-row"),o=l.hasClass("fl-col"),n=l.hasClass("fl-col-group"),r=l.hasClass("fl-module"),a=this;this.nodes[t]||(i||(s?i=e.extend({},this.defaults.row):o?i=e.extend({},this.defaults.column):r&&(i=e.extend({},this.defaults.modules[l.attr("data-type")])),s||n?l.find(".fl-col").each(function(){var t=e(this),i=e.extend({},a.defaults.column);i.size=parseFloat(t[0].style.width),a.addNode(t.attr("data-node"),i)}):r&&(a.addNode(l.closest(".fl-row").attr("data-node")),a.addNode(l.closest(".fl-col").attr("data-node")),a.updateOnResetColumnWidths(null,{cols:l.closest(".fl-col-group").find("> .fl-col")}))),i&&(this.nodes[t]=i))},updateNode:function(t,i){var l=e(".fl-node-"+t),s=this;l.hasClass("fl-col")&&l.closest(".fl-col-group").find("> .fl-col").each(function(){var t=e(this),l=t.attr("data-node");s.nodes[l].size=parseFloat(t[0].style.width),s.nodes[l].equal_height=i.equal_height,s.nodes[l].content_alignment=i.content_alignment,s.nodes[l].responsive_order=i.responsive_order}),this.nodes[t]=i},duplicateNode:function(t,i){var l=e(".fl-node-"+i),s=l.find("[data-node]"),o=e(".fl-node-"+t),n=o.find("[data-node]"),r=this;this.nodes[i]=this.nodes[t],s.each(function(l){t=n.eq(l).attr("data-node"),i=e(this).attr("data-node"),r.nodes[t]&&(r.nodes[i]=r.nodes[t])})},deleteNodes:function(){var t="",i=e(FLBuilder._contentClass).html();for(t in this.nodes)i.indexOf(t)===-1&&(this.nodes[t]=null,delete this.nodes[t])}}),e(function(){FLBuilderSettingsConfig.init(),FLBuilderSettingsForms.init()})}(jQuery),function(e){var t={init:function(){"module"===FLBuilderConfig.userTemplateType||FLBuilderConfig.simpleUi||(this.initPanel(),this.pinOrUnpin(),this.bind())},bind:function(){var t=e(window),i=e("body");t.on("resize",_.throttle(this.windowResize.bind(this),250)),i.delegate(".fl-builder-ui-pinned-collapse","click",this.collapse),i.delegate(".fl-builder--content-library-panel .fl-builder--tabs","click",this.closeLightboxOnPanelClick),FLBuilder.addHook("didShowLightbox",this.pinLightboxOnOpen.bind(this)),FLBuilder.addHook("didHideAllLightboxes",this.pinnedLightboxClosed.bind(this)),FLBuilder.addHook("endEditingSession",this.hide.bind(this)),FLBuilder.addHook("didHideEditingUI",this.hide.bind(this)),FLBuilder.addHook("publishButtonClicked",this.hide.bind(this)),FLBuilder.addHook("restartEditingSession",this.show.bind(this)),FLBuilder.addHook("didShowEditingUI",this.show.bind(this)),FLBuilder.addHook("didShowLightbox",this.uncollapse.bind(this)),FLBuilder.addHook("willShowContentPanel",this.uncollapse.bind(this)),FLBuilder.addHook("willShowContentPanel",this.closeLightboxOnPanelClick.bind(this))},isPinned:function(){return e(".fl-builder--content-library-panel").hasClass("fl-builder-ui-pinned")},pin:function(e,t){this.pinPanel(e),this.pinLightboxes(),t&&this.savePosition(),FLBuilder._resizeLayout()},unpin:function(e){this.unpinLightboxes(),this.unpinPanel(),e&&this.savePosition(),FLBuilder._resizeLayout()},pinOrUnpin:function(){var t=e(".fl-builder--content-library-panel"),i=this.isPinned();t.hasClass("fl-builder-ui-pinned-hidden")||(window.innerWidth<=500?(i&&this.unpin(!1),this.disableDragAndResize()):(i||this.restorePosition(),this.enableDragAndResize()))},show:function(){var t=e(".fl-builder--content-library-panel");t.hasClass("fl-builder-ui-pinned-hidden")&&(t.removeClass("fl-builder-ui-pinned-hidden"),t.show(),this.restorePosition())},hide:function(){var t=e("body"),i=e(".fl-builder--content-library-panel");this.isPinned()&&(this.uncollapse(),i.addClass("fl-builder-ui-pinned-hidden"),i.hide(),t.css("margin",""),FLBuilder._resizeLayout())},collapse:function(){var t=e(this).find("i:visible"),i=e("body"),l=t.data("toggle"),s=t.data("position"),o=e(".fl-builder--content-library-panel"),n=o.outerWidth();"hide"===l?(o.css(s,"-"+n+"px"),i.css("margin-"+s,""),i.addClass("fl-builder-ui-pinned-is-collapsed")):(o.css(s,"0px"),i.css("margin-"+s,n+"px"),i.removeClass("fl-builder-ui-pinned-is-collapsed"))},uncollapse:function(){this.isCollapsed()&&e(".fl-builder-ui-pinned-collapse:visible").trigger("click")},isCollapsed:function(){return e("body").hasClass("fl-builder-ui-pinned-is-collapsed")},initPanel:function(){var t=e(".fl-builder--content-library-panel");t.draggable({cursor:"move",handle:".fl-builder--tabs",cancel:".fl-builder--tabs button",scroll:!1,drag:this.drag.bind(this),stop:this.dragStop.bind(this),start:this.dragStart.bind(this)}).resizable({handles:"e, w",minHeight:400,minWidth:380,maxWidth:500,start:this.resizeStart.bind(this),stop:this.resizeStop.bind(this)}),t.addClass("fl-builder-ui-pinned-container"),t.find(".ui-resizable-e, .ui-resizable-w").hide()},pinPanel:function(t){var i=e(".fl-builder--content-library-panel"),l=i.width(),s=e("body"),o=e(".fl-responsive-preview, .fl-responsive-preview-mask"),n=e(FLBuilder._contentClass).parentsUntil("body").last();s.addClass("fl-builder-ui-is-pinned fl-builder-ui-is-pinned-"+t),s.addClass("fl-builder-content-panel-is-showing"),s.css("margin-"+t,l+"px"),o.css("margin-"+t,l+"px"),n.addClass("fl-builder-ui-pinned-content-transform"),i.addClass("fl-builder-ui-pinned fl-builder-ui-pinned-"+t),i.find(".ui-resizable-"+("left"===t?"e":"w")).show(),i.on("resize",_.throttle(this.resize.bind(this),250)),i.attr("style",""),FLBuilder.ContentPanel.isShowing=!0},unpinPanel:function(){var t=e(".fl-builder--content-library-panel"),i=t.find(".fl-builder--panel-content .is-showing").data("tab"),l=e("body"),s=e(".fl-responsive-preview, .fl-responsive-preview-mask"),o=e(FLBuilder._contentClass).parentsUntil("body").last();l.css("margin-left",""),l.css("margin-right",""),l.removeClass("fl-builder-ui-is-pinned"),l.removeClass("fl-builder-ui-is-pinned-left"),l.removeClass("fl-builder-ui-is-pinned-right"),s.css("margin-left",""),s.css("margin-right",""),o.removeClass("fl-lightbox-content-transform"),t.removeClass("fl-builder-ui-pinned"),t.removeClass("fl-builder-ui-pinned-left"),t.removeClass("fl-builder-ui-pinned-right"),t.find(".ui-resizable-handle").hide(),t.off("resize"),t.attr("style",""),t.find(".fl-builder--tabs [data-tab="+i+"]").addClass("is-showing")},pinLightboxes:function(){var t=this;e(".fl-lightbox-resizable").each(function(){t.pinLightbox(e(this))}),FLBuilder._reinitEditorFields()},pinLightbox:function(t){var i=e(".fl-builder--content-library-panel"),l=t.closest(".fl-lightbox-wrap");l.closest(".fl-builder-ui-pinned").length||(i.append(l),t.attr("style",""),t.draggable("disable"),t.resizable("disable")),t.is(":visible")&&i.find(".fl-builder--tabs .is-showing").removeClass("is-showing")},pinLightboxOnOpen:function(e,t){var i=t._node.find(".fl-lightbox-resizable");i.length&&(i.hasClass("fl-builder-ui-pinning-initialized")||(i.draggable("option","start",this.dragStart.bind(this)),i.draggable("option","drag",this.drag.bind(this)),i.draggable("option","stop",this.dragStop.bind(this)),i.addClass("fl-builder-ui-pinning-initialized")),this.isPinned()&&this.pinLightbox(i),FLBuilder.addHook("responsive-editing-switched",this.resize))},pinnedLightboxClosed:function(){var t=e(".fl-builder--content-library-panel");tab=null,this.isPinned()&&(tab=t.find(".fl-builder--panel-content .is-showing").data("tab"),t.find(".fl-builder--tabs [data-tab="+tab+"]").addClass("is-showing")),e(".fl-lightbox").removeClass("fl-lightbox-prevent-animation")},unpinLightboxes:function(){var t=e("body"),i=e(".fl-builder--content-library-panel");i.find(".fl-lightbox-wrap").each(function(){var l=e(this),s=l.find(".fl-lightbox"),o=0,n=0,r=0;s.draggable("enable"),s.resizable("enable"),s.find(".ui-resizable-handle").show(),t.append(l),s.is(":visible")?(o=parseInt(i.css("top"))-parseInt(l.css("top"))-parseInt(l.css("padding-top")),n=parseInt(i.css("left"))-parseInt(l.css("padding-left")),r=parseInt(i.css("right"))-parseInt(l.css("padding-right")),s.css("top",(o<0?0:o)+"px"),s.css(FLBuilderConfig.isRtl?"right":"left",(FLBuilderConfig.isRtl?r:n)+"px"),s.addClass("fl-lightbox-prevent-animation"),t.removeClass("fl-builder-content-panel-is-showing"),FLBuilder.ContentPanel.isShowing=!1):s.css({top:"25px",left:"25px"})}),FLBuilder._reinitEditorFields()},closeLightboxOnPanelClick:function(){FLBuilder._triggerSettingsSave(!1,!0)},windowResize:function(){this.pinOrUnpin()},resizeStart:function(){e("body").addClass("fl-builder-resizable-is-resizing"),FLBuilder._destroyOverlayEvents(),FLBuilder._removeAllOverlays()},resize:function(){var t=e("body"),i=e(".fl-responsive-preview, .fl-responsive-preview-mask"),l=e(".fl-builder--content-library-panel"),s=l.outerWidth();l.hasClass("fl-builder-ui-pinned-left")?(t.css("margin-left",s+"px"),i.css("margin-left",s+"px")):l.hasClass("fl-builder-ui-pinned-right")&&(t.css("margin-right",s+"px"),i.css("margin-right",s+"px"))},resizeStop:function(){e("body").removeClass("fl-builder-resizable-is-resizing"),FLBuilder._bindOverlayEvents(),FLBuilder._resizeLayout(),this.savePosition()},dragStart:function(t,i){var l=e("body"),s=(e(t.target),e(".fl-builder-bar-actions"));e(".fl-lightbox-resizable:visible").length||s.addClass("fl-builder-content-panel-pin-zone"),l.addClass("fl-builder-draggable-is-dragging"),l.append('<div class="fl-builder-ui-pin-zone fl-builder-ui-pin-zone-left"></div>'),l.append('<div class="fl-builder-ui-pin-zone fl-builder-ui-pin-zone-right"></div>'),FLBuilder._destroyOverlayEvents()},drag:function(t,i){var l=e("body"),s=e(".fl-responsive-preview"),o=e(window),n=s.length?s.width():o.width(),r=o.scrollTop(),a=e(".fl-builder--content-library-panel"),d=a.offset().top,u=e(".fl-builder-bar-actions"),c=e(t.target);c.hasClass("fl-builder--content-library-panel")&&(t.clientX<n-75&&d-r<46?u.addClass("fl-builder-content-panel-pin-zone-hover"):u.removeClass("fl-builder-content-panel-pin-zone-hover")),c.hasClass("fl-builder-ui-pinned")?this.unpinPanel():t.clientX<75?l.addClass("fl-builder-ui-show-pin-zone fl-builder-ui-show-pin-zone-left"):t.clientX>n-75?l.addClass("fl-builder-ui-show-pin-zone fl-builder-ui-show-pin-zone-right"):(l.removeClass("fl-builder-ui-show-pin-zone"),l.removeClass("fl-builder-ui-show-pin-zone-left"),l.removeClass("fl-builder-ui-show-pin-zone-right"))},dragStop:function(t,i){var l=(e(window),e("body")),s=e(".fl-builder-bar-actions"),o=e(".fl-builder-ui-pin-zone"),n=e(".fl-builder--content-library-panel"),r=e(".fl-lightbox-resizable:visible");e(t.target);l.removeClass("fl-builder-draggable-is-dragging"),s.removeClass("fl-builder-content-panel-pin-zone"),s.removeClass("fl-builder-content-panel-pin-zone-hover"),o.remove(),r.length&&parseInt(r.css("top"))<0&&r.css("top","0"),l.hasClass("fl-builder-ui-show-pin-zone")?(l.hasClass("fl-builder-ui-show-pin-zone-left")?this.pin("left",!0):this.pin("right",!0),l.removeClass("fl-builder-ui-show-pin-zone"),l.removeClass("fl-builder-ui-show-pin-zone-left"),l.removeClass("fl-builder-ui-show-pin-zone-right")):n.find(".fl-lightbox").length?this.unpin(!0):(n.attr("style",""),this.savePosition()),FLBuilder._bindOverlayEvents()},disableDragAndResize:function(){var t=e(".fl-builder--content-library-panel"),i=e(".fl-lightbox-resizable");
|
9 |
-
t.draggable("disable"),t.resizable("disable"),i.draggable("disable"),i.resizable("disable")},enableDragAndResize:function(){var t=e(".fl-builder--content-library-panel"),i=e(".fl-lightbox-resizable:not(.fl-lightbox-width-full)");t.draggable("enable"),t.resizable("enable"),this.isPinned()||(i.draggable("enable"),i.resizable("enable"))},savePosition:function(){var t=e(".fl-builder--content-library-panel"),i=e(".fl-lightbox-resizable:visible"),l={pinned:{width:t.width(),position:null}};t.hasClass("fl-builder-ui-pinned-left")?l.pinned.position="left":t.hasClass("fl-builder-ui-pinned-right")?l.pinned.position="right":i.length&&(l.lightbox={width:i.width(),height:i.height(),top:parseInt(i.css("top"))<0?"0px":i.css("top"),left:i.css("left")}),FLBuilderConfig.userSettings.pinned=l.pinned,l.lightbox&&(FLBuilderConfig.userSettings.lightbox=l.lightbox),FLBuilder.ajax({action:"save_pinned_ui_position",data:l})},restorePosition:function(){var t=e(".fl-builder--content-library-panel"),i=FLBuilderConfig.userSettings.pinned;i&&i.position&&(t.width(i.width),this.pin(i.position,!1),t.width(i.width))}};e(function(){t.init()})}(jQuery),function(e){var t={init:function(){this.setupMainMenuData(),e(".fl-builder--revision-actions select").on("change",this.selectChanged),e(".fl-cancel-revision-preview").on("click",this.exitPreview.bind(this)),e(".fl-apply-revision-preview").on("click",this.applyClicked.bind(this)),FLBuilder.addHook("revisionItemClicked",this.itemClicked.bind(this)),FLBuilder.addHook("didPublishLayout",this.refreshItems.bind(this))},setupMainMenuData:function(){var t=FLBuilderConfig.revisions.posts,i=FLBuilderConfig.revisions.authors,l=wp.template("fl-revision-list-item"),s=e(".fl-builder--revision-actions select"),o="",n="",r=0;if(FLBuilderConfig.mainMenu.revisions.items=[],s.html(""),0===t.length)FLBuilderConfig.mainMenu.revisions.items.push({eventName:"noRevisionsMessage",type:"event",label:wp.template("fl-no-revisions-message")()});else for(;r<t.length;r++)o=FLBuilderStrings.revisionDate.replace("%s",t[r].date.diff),o+=" ("+t[r].date.published+")",n=FLBuilderStrings.revisionAuthor.replace("%s",i[t[r].author].name),FLBuilderConfig.mainMenu.revisions.items.push({eventName:"revisionItemClicked",type:"event",label:l({id:t[r].id,date:o,author:n,avatar:i[t[r].author].avatar})}),s.append('<option value="'+t[r].id+'">'+o+"</option>");FLBuilder.triggerHook("renderRevisionsPanel")},refreshItems:function(){FLBuilder.ajax({action:"refresh_revision_items"},this.refreshItemsComplete.bind(this))},refreshItemsComplete:function(e){FLBuilderConfig.revisions=JSON.parse(e),this.setupMainMenuData()},itemClicked:function(t,i){var l=e(i).find(".fl-revision-list-item").attr("data-revision-id");FLBuilder._triggerSettingsSave(!1,!0)&&(e(".fl-builder--revision-actions select").val(l),this.preview(l))},selectChanged:function(i){t.preview(e(this).val())},applyClicked:function(i){var l=e(".fl-builder--revision-actions select").val();t.restore(l)},preview:function(t){e(".fl-builder--revision-actions").css("display","flex"),FLBuilder.triggerHook("didEnterRevisionPreview"),FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"render_revision_preview",revision_id:t},this.previewRenderComplete.bind(this))},previewRenderComplete:function(e){FLBuilder._renderLayout(e,function(){FLBuilder._destroyOverlayEvents(),FLBuilder._removeAllOverlays()})},exitPreview:function(){e(".fl-builder--revision-actions").hide(),FLBuilder.triggerHook("didExitRevisionPreview"),FLBuilder._bindOverlayEvents(),FLBuilder._updateLayout()},restore:function(i){e(".fl-builder--revision-actions").hide(),FLBuilder.triggerHook("didExitRevisionPreview"),FLBuilder.showAjaxLoader(),FLBuilder._bindOverlayEvents(),FLBuilder.ajax({action:"restore_revision",revision_id:i},t.restoreComplete)},restoreComplete:function(e){var t=JSON.parse(e);FLBuilder._renderLayout(t.layout),FLBuilder.triggerHook("didRestoreRevisionComplete",t.config)}};e(function(){t.init()})}(jQuery),function(e){var t={query:function(e){var t={},i=null,l={library:{}},s=null;if(e=this.normalizeQuery(e),_.isNull(e.kind))t=FLBuilderConfig.contentItems;else for(var o in e.kind)i=e.kind[o],t[i]=FLBuilderConfig.contentItems[i];return s=this.findMatches(e,t),l.library=this.formatResults(s,e),l},normalizeQuery:function(e){var t={kind:null,type:null,category:null,group:null,enabled:!0,global:null,searchTerm:null,categorized:!1};return e=_.extend(t,e),_.isString(e.kind)&&(e.kind=[e.kind]),e},findMatches:function(e,t){var i={},l=null,s=null,o=null,n=null,r=null,a=null;for(l in t){s=t[l],i[l]={items:[]};for(a in s)if(o=s[a],_.isUndefined(e.category)||_.isNull(e.category)||this.matchesCategory(o.category,e.category)){switch(l){case"template":if(!(_.isUndefined(e.content)||_.isNull(e.content)||(n=_.contains(e.content,o.content),r=e.content===o.content,n||r)))continue;if(!_.isUndefined(e.type)&&!_.isNull(e.type)&&e.type!==o.type)continue;if(!_.isNull(e.group)){var d=e.group,u=o.group;if(_.isString(d)&&(d=[d]),_.isString(u)&&(u=[u]),_.isEmpty(d)||_.isEmpty(u))continue;var c=!1;for(a in d){var h=d[a];_.contains(u,h)&&(c=!0)}if(!c)continue}break;case"module":if(!_.isNull(e.group)){if(e.group===!1&&o.group.length>0)continue;if(e.group!==!1&&!_.contains(o.group,e.group))continue}}(_.isUndefined(e.searchTerm)||_.isNull(e.searchTerm)||this.matchesSearchTerm(o,e.searchTerm))&&i[l].items.push(o)}}return i},matchesCategory:function(e,t){var i,l,s,o,n,r;if(e===t)return!0;_.isString(t)&&(t=[t]);for(l in t){if(i=t[l],_.isString(e)&&e===i)return!0;if(_.isArray(e))for(s in e)if(o=e[s],o===i)return!0;if(_.isObject(e))for(n in e)if(r=e[n],r===i||n===i)return!0}return!1},matchesSearchTerm:function(e,t){var i,l,s=t.toLowerCase();return!(_.isUndefined(e.slug)||!e.slug.toLowerCase().includes(s))||(!(_.isUndefined(e.name)||!e.name.toLowerCase().includes(s))||(!(!_.isString(e.category)||!e.category.toLowerCase().includes(s))||(!(_.isUndefined(e.description)||!e.description.toLowerCase().includes(s))||(!(_.isUndefined(e.id_base)||!e.id_base.includes(t))||(!(!e.isWidget||(i="widget",!i.includes(s)))||!(_.isUndefined(e.editor_export)||(l="module",!l.includes(s))))))))},formatResults:function(e,t){if(t.categorized)for(type in e){var i=e[type].items;e[type].categorized=this.groupBy(i,"category")}return e},groupBy:function(e,t){var i,l,s={};return _.forEach(e,function(e,o,n){i=e[t],_.isNull(i)||_.isUndefined(i)||_.isString(i)&&""===e[i]||(_.isString(i)&&(s[i]=s[i]||[],s[i].push(e)),_.isArray(i)&&(l=i,_.forEach(l,function(t,i,l){s[t]=s[t]||[],s[t].push(e)})),_.isObject(i)&&(l=i,_.forEach(l,function(t,i,l){s[t]=s[t]||[],s[t].push(e)})))}),s},search:function(e){var t={searchTerm:e},i=this.query(t),l={total:0,term:e,sections:{}};if(!_.isUndefined(i.library.module.items)){var s={};for(var o in i.library.module.items){var n=i.library.module.items[o],r=n.group[0],a=n.category;n.name;_.isUndefined(s[r])&&(s[r]={}),_.isUndefined(s[r][a])&&(s[r][a]=[]),s[r][a].push(n)}l.grouped=s}for(var o in i.library){var d=i.library[o];!_.isUndefined(d.items)&&d.items.length>0&&(l.sections[o]={name:FLBuilderStrings.typeLabels[o],handle:o,type:"",items:d.items},l.total+=d.items.length)}return l}};FLBuilder.Search={byQuery:function(e){return t.query(e)},byTerm:function(e){var i=t.search(e);return i}}}(jQuery),function(e,t){var i={layoutNeedsPublish:!1,defaultIndicatorMessage:"",defaultTooltipMessage:"",messages:null,init:function(){this.messages=FLBuilderStrings.savedStatus,this.$savingIndicator=e(".fl-builder--saving-indicator"),t.addHook("didBeginAJAX",this.onLayoutSaving.bind(this)),t.addHook("didCompleteAJAX",this.onLayoutSaved.bind(this)),t.addHook("didPublishLayout",this.onLayoutPublished.bind(this)),t.addHook("publishAndRemain",this.onPublishAndRemain.bind(this)),t.addHook("didShowLightbox",this.setLayoutNeedsPublish.bind(this)),!FLBuilderConfig.layoutHasDraftedChanges&&FLBuilderConfig.builderEnabledd||(this.setLayoutNeedsPublish(),this.resetStatusMessage())},setLayoutNeedsPublish:function(){this.layoutNeedsPublish||(this.layoutNeedsPublish=!0,e("body").addClass("fl-builder--layout-has-drafted-changes"))},onLayoutSaving:function(e,t){this.isPublishingLayout(t.action)?this.showStatusMessage(this.messages.publishing,this.messages.publishingTooltip):this.isUpdatingLayout(t.action)&&(this.setLayoutNeedsPublish(),this.showStatusMessage(this.messages.saving,this.messages.savingTooltip))},isPublishingLayout:function(e){return"save_layout"==e},isUpdatingLayout:function(e){return!this.isPublishingLayout()&&(e.startsWith("render")?!!e.startsWith("render_new"):!e.startsWith("duplicate")&&(!e.startsWith("refresh")&&("save_ui_skin"!=e&&("save_lightbox_position"!=e&&"save_pinned_ui_position"!=e))))},onLayoutSaved:function(e,t){if(this.isUpdatingLayout(t.fl_builder_data.action)){this.showStatusMessage(this.messages.saved,this.messages.savedTooltip);var i=this;setTimeout(function(){i.resetStatusMessage()},2e3)}},onLayoutPublished:function(){this.layoutNeedsPublish=!1,e("body").removeClass("fl-builder--layout-has-drafted-changes"),this.resetStatusMessage()},showStatusMessage:function(t,i){this.$savingIndicator.html(t),_.isUndefined(i)||(this.$savingIndicator.attr("title",i),e(".fl-builder--saving-indicator").tipTip({defaultPosition:"bottom",edgeOffset:14}))},resetStatusMessage:function(){this.layoutNeedsPublish?(this.defaultIndicatorMessage=this.messages.edited+'<i class="fa fa-question-circle"></i>',this.defaultTooltipMessage=this.messages.editedTooltip):(this.defaultIndicatorMessage="",this.defaultTooltipMessage=""),this.showStatusMessage(this.defaultIndicatorMessage,this.defaultTooltipMessage)},onPublishAndRemain:function(){if(this.layoutNeedsPublish)t._publishLayout(!1);else{this.showStatusMessage(this.messages.noChanges);var e=this;setTimeout(function(){e.resetStatusMessage()},2e3)}}};t.SaveManager={layoutNeedsPublish:function(){return i.layoutNeedsPublish},showStatusMessage:function(e,t){i.showStatusMessage(e,t)},resetStatusMessage:function(){i.resetStatusMessage()}},e(function(){i.init()})}(jQuery,FLBuilder);
|
3 |
FLBuilder._initSortables()))},_updateNode:function(t,i){e(".fl-node-"+t).length&&(FLBuilder._showNodeLoading(t),FLBuilder.ajax({action:"render_node",node_id:t},function(e){FLBuilder._renderLayout(JSON.parse(e),i)}.bind(this)))},_updateLayout:function(){FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"render_layout"},FLBuilder._renderLayout)},_renderLayout:function(e,t){FLBuilder._layout=new FLBuilderAJAXLayout(e,t)},_renderLayoutComplete:function(){FLBuilder._layout&&(FLBuilder._layout._complete(),FLBuilder._layout=null)},_resizeLayout:function(){e(window).trigger("resize"),"undefined"!=typeof YUI&&YUI().use("node-event-simulate",function(e){e.one(window).simulate("resize")})},layoutHasContent:function(){return e(FLBuilder._contentClass).children(".fl-row").length>0},_initMediaElements:function(){var t={};"undefined"!=typeof e.fn.mediaelementplayer&&("undefined"!=typeof _wpmejsSettings&&(t.pluginPath=_wpmejsSettings.pluginPath),e(".wp-audio-shortcode, .wp-video-shortcode").not(".mejs-container").mediaelementplayer(t))},_initDropTargets:function(){var t="row"==FLBuilderConfig.userTemplateType?"":":not(.fl-node-global)",i=e(FLBuilder._contentClass+" .fl-row"),l=null,s=e(FLBuilder._contentClass+" .fl-row"+t).find(".fl-col-group"),o=null,n=null,r=0;for(e(".fl-col-drop-target").remove(),e(".fl-col-group-drop-target").remove(),e(".fl-row-drop-target").remove(),e(FLBuilder._contentClass).append('<div class="fl-drop-target fl-row-drop-target"></div>'),i.prepend('<div class="fl-drop-target fl-row-drop-target"></div>'),i.append('<div class="fl-drop-target fl-drop-target-last fl-row-drop-target fl-row-drop-target-last"></div>');r<i.length;r++)l=i.eq(r),0===l.find(".fl-col-group").length&&l.find(".fl-row-content").prepend('<div class="fl-drop-target fl-col-group-drop-target"></div>');for(r=0;r<s.length;r++)o=s.eq(r),n=o.find("> .fl-col"),o.hasClass("fl-col-group-nested")||(o.append('<div class="fl-drop-target fl-col-group-drop-target"></div>'),o.append('<div class="fl-drop-target fl-drop-target-last fl-col-group-drop-target fl-col-group-drop-target-last"></div>')),n.append('<div class="fl-drop-target fl-col-drop-target"></div>'),n.append('<div class="fl-drop-target fl-drop-target-last fl-col-drop-target fl-col-drop-target-last"></div>')},_blockDragHelper:function(e,t){var i=t.clone();return t.clone().insertAfter(t),i.addClass("fl-builder-block-drag-helper"),i},_blockDragInit:function(t){var i=e(t.currentTarget),l=null,s=e(window).scrollTop(),o=0;FLBuilder._dragEnabled=!0,FLBuilder._dragInitialScrollTop=s,i.closest("[data-node]").length>0?(l=i.closest("[data-node]"),l.addClass("fl-node-drag-init")):i.hasClass("fl-builder-block")&&e(".fl-row").each(function(){null===l&&e(this).offset().top-s>0&&(l=e(this))}),null!==l&&(o=l.offset().top-s),FLBuilder._highlightRowsAndColsForDrag(i),FLBuilder._adjustColHeightsForDrag(),FLBuilder._disableGlobalRows(),FLBuilder._destroyOverlayEvents(),FLBuilder._removeAllOverlays(),FLBuilder._initSortables(),e("body").addClass("fl-builder-dragging"),e(".fl-builder-empty-message").hide(),e(".fl-sortable-disabled").removeClass("fl-sortable-disabled"),o>0&&scrollTo(0,l.offset().top-o),FLBuilder.triggerHook("didInitDrag")},_blockDragStart:function(t,i){FLBuilder._dragging=!0,e(".fl-node-drag-init").removeClass("fl-node-drag-init"),FLBuilder.triggerHook("didStartDrag")},_blockDragSort:function(t,i){var l=i.placeholder.parent(),s=FLBuilderStrings.insert;FLBuilder._blockPreventSort(i.item,l)||(l.hasClass("fl-col-content")?s=i.item.hasClass("fl-builder-block-row")?i.item.find(".fl-builder-block-title").text():i.item.hasClass("fl-col-sortable-proxy-item")?FLBuilderStrings.column:i.item.hasClass("fl-builder-block-module")?i.item.find(".fl-builder-block-title").text():i.item.hasClass("fl-builder-block-saved-module")||i.item.hasClass("fl-builder-block-module-template")?i.item.find(".fl-builder-block-title").text():i.item.attr("data-name"):l.hasClass("fl-col-drop-target")?s="":l.hasClass("fl-col-group-drop-target")?s="":l.hasClass("fl-row-drop-target")&&(s=i.item.hasClass("fl-builder-block-row")?i.item.find(".fl-builder-block-title").text():i.item.hasClass("fl-builder-block-saved-row")?i.item.find(".fl-builder-block-title").text():i.item.hasClass("fl-row-sortable-proxy-item")?FLBuilderStrings.row:FLBuilderStrings.newRow),i.placeholder.html(s),i.item.hasClass("fl-node-global")||i.item.hasClass("fl-builder-block-global")||e(".fl-node-dragging").hasClass("fl-node-global")?i.placeholder.addClass("fl-builder-drop-zone-global"):i.placeholder.removeClass("fl-builder-drop-zone-global"))},_blockDragChange:function(e,t){t.placeholder.css("opacity","0"),t.placeholder.animate({opacity:"1"},100)},_blockPreventSort:function(t,i){var l=!1,s=t.hasClass("fl-builder-block-row"),o=t.hasClass("fl-col-sortable-proxy-item"),n=i.hasClass("fl-col-content"),r=i.hasClass("fl-col-drop-target"),a=i.parents(".fl-col-group:not(.fl-col-group-nested)"),d=i.parents(".fl-col-group-nested");return(s||o)&&n&&d.length>0&&(l=!0),n&&!i.find(".fl-module, .fl-col").length&&(s&&"1-col"==t.data("cols")?l=!0:o&&(l=!0)),s&&n&&e.inArray(t.data("cols"),["5-cols","6-cols"])>-1&&(l=!0),o&&e(".fl-node-dragging").find(".fl-col-group-nested").length>0&&(n||r&&d.length>0)&&(l=!0),r&&a.length>0&&0===d.length&&a.find("> .fl-col:visible").length>11&&(l=!0),r&&d.length>0&&d.find(".fl-col:visible").length>3&&(l=!0),l&&i.addClass("fl-sortable-disabled"),l},_blockDragStop:function(t,i){var l=e(window).scrollTop(),s=i.item.parent(),o=null;s.hasClass("fl-drop-target")&&s.closest("[data-node]").length?(s=s.closest("[data-node]"),o=s.offset().top-l):o=s.offset().top-l,s.hasClass("fl-builder-blocks-section-content")&&FLBuilder._showPanel(),FLBuilder._dragEnabled=!1,FLBuilder._dragging=!1,FLBuilder._bindOverlayEvents(),FLBuilder._highlightEmptyCols(),FLBuilder._enableGlobalRows(),FLBuilder._setupEmptyLayout(),e("body").removeClass("fl-builder-dragging"),scrollTo(0,s.offset().top-o),FLBuilder.triggerHook("didStopDrag")},_blockDragCancel:function(){FLBuilder._dragEnabled&&!FLBuilder._dragging&&(FLBuilder._dragEnabled=!1,FLBuilder._dragging=!1,FLBuilder._bindOverlayEvents(),FLBuilder._highlightEmptyCols(),FLBuilder._enableGlobalRows(),FLBuilder._setupEmptyLayout(),e("body").removeClass("fl-builder-dragging"),e(".fl-node-drag-init").removeClass("fl-node-drag-init"),e(".fl-node-dragging").removeClass("fl-node-dragging"),scrollTo(0,FLBuilder._dragInitialScrollTop))},_reorderNode:function(e,t){FLBuilder.ajax({action:"reorder_node",node_id:e,position:t})},_moveNode:function(e,t,i){FLBuilder.ajax({action:"move_node",new_parent:e,node_id:t,position:i})},_removeAllOverlays:function(){FLBuilder._removeRowOverlays(),FLBuilder._removeColOverlays(),FLBuilder._removeColHighlightGuides(),FLBuilder._removeModuleOverlays(),FLBuilder._hideTipTips(),FLBuilder._closeAllSubmenus()},_appendOverlay:function(e,t){var i=0,l=null,s=e.hasClass("fl-row"),o=s?e.find("> .fl-row-content-wrap"):e.find("> .fl-node-content"),n={top:parseInt(o.css("margin-top"),10),bottom:parseInt(o.css("margin-bottom"),10)};return e.append(t),e.addClass("fl-block-overlay-active"),FLBuilder._initTipTips(),l=e.find("> .fl-block-overlay"),n.top<0&&(i=parseInt(l.css("top"),10),i=isNaN(i)?0:i,l.css("top",n.top+i+"px")),n.bottom<0&&(i=parseInt(l.css("bottom"),10),i=isNaN(i)?0:i,l.css("bottom",n.bottom+i+"px")),l},_buildOverlayOverflowMenu:function(e){var t=e.find(".fl-block-overlay-actions"),i=t.data("original"),l=0,s=null,o=0,n=null,r=0,a=[],d=[],u=[],c=wp.template("fl-overlay-overflow-menu");for(void 0!=i&&(t.after(i),t.remove(),t=i),t.data("original",t.clone()),l=Math.floor(t[0].getBoundingClientRect().width)-8,s=t.find(" > i, > span.fl-builder-has-submenu");r<s.length;r++)n=s.eq(r),o+=Math.floor(n[0].getBoundingClientRect().width),o>l?(d.push(n),n.remove()):a.push(n);if(d.length>0){for(d.unshift(a.pop().remove()),r=0;r<d.length;r++)d[r].is(".fl-builder-has-submenu")?u.push({type:"submenu",label:d[r].find(".fa").data("title"),submenu:d[r].find(".fl-builder-submenu")[0].outerHTML}):u.push({type:"action",label:d[r].data("title"),className:d[r].removeClass(function(e,t){return t.replace(/fl-block-([^\s]+)/,"")}).attr("class")});t.append(c(u)),FLBuilder._initTipTips()}},_removeRowOverlays:function(){e(".fl-row").removeClass("fl-block-overlay-active"),e(".fl-row-overlay").remove(),e(".fl-module").removeClass("fl-module-adjust-height"),e("body").removeClass("fl-builder-row-resizing"),FLBuilder._closeAllSubmenus()},_disableGlobalRows:function(){"row"!=FLBuilderConfig.userTemplateType&&e(".fl-row.fl-node-global").addClass("fl-node-disabled")},_enableGlobalRows:function(){"row"!=FLBuilderConfig.userTemplateType&&e(".fl-node-disabled").removeClass("fl-node-disabled")},_rowMouseenter:function(){var t=e(this),i=t.offset().top,l=null,s=null,o=wp.template("fl-row-overlay");t.closest(".fl-builder-node-loading").length||t.hasClass("fl-block-overlay-active")||(s=FLBuilder._appendOverlay(t,o({global:t.hasClass("fl-node-global"),node:t.attr("data-node")})),t.find(".fl-node-content:visible").each(function(){var t=e(this).offset().top;l=null===l||l>t?t:l}),null!==l&&l<i&&s.css("top",l-i-30+"px"),s.offset().top<43&&s.addClass("fl-row-overlay-header-bottom"),t.find(".fl-module").each(function(){var t=e(this);t.outerHeight(!0)<20&&t.addClass("fl-module-adjust-height")}),FLBuilder._buildOverlayOverflowMenu(s))},_rowMouseleave:function(t){var i=e(t.toElement)||e(t.relatedTarget),l=i.hasClass("fl-row-overlay"),s=i.closest(".fl-row-overlay").length>0,o=i.is("#tiptip_holder"),n=i.closest("#tiptip_holder").length>0;l||s||o||n||FLBuilder._removeRowOverlays()},_rowDragHelper:function(){return e('<div class="fl-builder-block-drag-helper">'+FLBuilderStrings.row+"</div>")},_rowDragInit:function(t){var i=e(t.target),l=e(".fl-row-sortable-proxy-item"),s=i.closest(".fl-row");s.addClass("fl-node-dragging"),FLBuilder._blockDragInit(t),t.target=l[0],l.trigger(t)},_rowDragStart:function(t,i){var l=e(FLBuilder._contentClass+" .fl-row"),s=e(".fl-node-dragging");1===l.length&&e(FLBuilder._contentClass).addClass("fl-builder-empty"),s.hide(),FLBuilder._blockDragStart(t,i)},_rowDragStop:function(t,i){var l=i.item,s=l.parent(),o=null,n=null,r=0;if(FLBuilder._blockDragStop(t,i),s.hasClass("fl-builder-rows"))return void l.remove();if(s.hasClass("fl-row-sortable-proxy"))return void e(".fl-node-dragging").removeClass("fl-node-dragging").show();if(l.hasClass("fl-builder-block")){if(s.hasClass("fl-sortable-disabled"))return l.remove(),void FLBuilder._showPanel();s.hasClass("fl-col-content")?FLBuilder._addColGroup(l.closest(".fl-col").attr("data-node"),l.attr("data-cols"),s.find("> .fl-module, .fl-col-group, .fl-builder-block").index(l)):s.hasClass("fl-col-drop-target")?FLBuilder._addCols(s.closest(".fl-col"),s.hasClass("fl-col-drop-target-last")?"after":"before",l.attr("data-cols"),s.closest(".fl-col-group-nested").length>0):s.hasClass("fl-col-group-drop-target")?(n=l.closest(".fl-col-group"),r=l.closest(".fl-row").find(".fl-row-content > .fl-col-group").index(n),FLBuilder._addColGroup(l.closest(".fl-row").attr("data-node"),l.attr("data-cols"),s.hasClass("fl-drop-target-last")?r+1:r)):(o=l.closest(".fl-row"),r=o.length?e(FLBuilder._contentClass+" .fl-row").index(o):0,FLBuilder._addRow(l.attr("data-cols"),s.hasClass("fl-drop-target-last")?r+1:r)),l.remove(),FLBuilder._showPanel(),e(".fl-builder-modules").siblings(".fl-builder-blocks-section-title").eq(0).trigger("click")}else o=e(".fl-node-dragging").removeClass("fl-node-dragging").show(),s.parent().hasClass("fl-builder-content")||(s.hasClass("fl-drop-target-last")?s.parent().after(o):s.parent().before(o),FLBuilder._reorderNode(o.attr("data-node"),o.index())),e(".fl-row-sortable-proxy").append(i.item)},_addRow:function(t,i){FLBuilder._showNodeLoadingPlaceholder(e(FLBuilder._contentClass),i),FLBuilder._newRowPosition=i,FLBuilder.ajax({action:"render_new_row",cols:t,position:i},FLBuilder._addRowComplete)},_addRowComplete:function(t){var i="object"==typeof t?t:JSON.parse(t),l=e(FLBuilder._contentClass),s=e(i.html).data("node"),o=FLBuilder._addModuleAfterNodeRender;i.nodeParent=l,i.nodePosition=FLBuilder._newRowPosition,FLBuilder._renderLayout(i,function(){null!==o&&(e(".fl-node-"+s+" .fl-col-content").append(o),FLBuilder._reorderModule(o),FLBuilder._addModuleAfterNodeRender=null),FLBuilder._removeNodeLoadingPlaceholder(e(".fl-node-"+s)),FLBuilder.triggerHook("didAddRow",s)})},_deleteRowClicked:function(t){var i=e(this).closest(".fl-row"),l=null;i.find(".fl-module").length?(l=confirm(FLBuilderStrings.deleteRowMessage),l&&FLBuilder._deleteRow(i)):FLBuilder._deleteRow(i),FLBuilder._removeAllOverlays(),t.stopPropagation()},_deleteRow:function(e){var t=e.attr("data-node");FLBuilder.ajax({action:"delete_node",node_id:t}),e.empty(),e.remove(),FLBuilder._setupEmptyLayout(),FLBuilder._removeRowOverlays(),FLBuilder.triggerHook("didDeleteRow",t)},_rowCopyClicked:function(t){var i=e(this).closest(".fl-row"),l=i.attr("data-node"),s=e(FLBuilder._contentClass+" .fl-row").index(i)+1,o=i.clone(),n=e(".fl-builder-settings[data-node]"),r=n.attr("data-node"),a=r===l?i:i.find('[data-node="'+r+'"]'),d=null;n.length&&a.length&&(d=FLBuilder._getSettings(n),FLBuilderSettingsConfig.nodes[r]=d),o.addClass("fl-node-"+l+"-clone fl-builder-node-clone"),o.find(".fl-block-overlay").remove(),i.after(o),e("html, body").animate({scrollTop:o.offset().top-75},500),FLBuilder._showNodeLoading(l+"-clone"),FLBuilder._newRowPosition=s,FLBuilder.ajax({action:"copy_row",node_id:l,settings:d,settings_id:r},function(e){var t=JSON.parse(e);t.duplicatedRow=l,FLBuilder._rowCopyComplete(t)}),t.stopPropagation()},_rowCopyComplete:function(t){t.nodeParent=e(FLBuilder._contentClass),t.nodePosition=FLBuilder._newRowPosition,FLBuilder._renderLayout(t,function(){FLBuilder.triggerHook("didDuplicateRow",{newNodeId:t.nodeId,oldNodeId:t.duplicatedRow}),t.nodeParent.find(".fl-builder-node-loading").eq(0).remove()})},_rowSettingsClicked:function(t){var i=e(this),l=i.closest(".fl-row").attr("data-node"),s=i.closest(".fl-block-overlay-global").length>0,o=null;s&&"row"!=FLBuilderConfig.userTemplateType?FLBuilderConfig.userCanEditGlobalTemplates&&(o=window.open(e('.fl-row[data-node="'+l+'"]').attr("data-template-url")),o.FLBuilderGlobalNodeId=l):i.hasClass("fl-block-settings")&&FLBuilderSettingsForms.render({id:"row",nodeId:l,className:"fl-builder-row-settings",attrs:'data-node="'+l+'"',buttons:s||FLBuilderConfig.lite||FLBuilderConfig.simpleUi?[]:["save-as"],badges:s?[FLBuilderStrings.global]:[],settings:FLBuilderSettingsConfig.nodes[l],preview:{type:"row"}},function(){e("#fl-field-width select").on("change",FLBuilder._rowWidthChanged),e("#fl-field-content_width select").on("change",FLBuilder._rowWidthChanged)}),t.stopPropagation()},_rowWidthChanged:function(){var t=e("#fl-field-width select").val(),i=e("#fl-field-content_width select").val(),l=e("#fl-field-max_content_width");"fixed"==t||"full"==t&&"fixed"==i?l.show():l.hide()},_resetRowWidthClicked:function(t){var i=e(this),l=i.closest(".fl-row"),s=l.attr("data-node"),o=l.find(".fl-row-content"),n=FLBuilderConfig.global.row_width+"px",r=e(".fl-builder-row-settings");l.hasClass("fl-row-fixed-width")&&l.css("max-width",n),o.css("max-width",n),r.length&&r.find("[name=max_content_width]").val(""),FLBuilder.ajax({action:"resize_row_content",node:s,width:""}),FLBuilder._closeAllSubmenus(),FLBuilder.triggerHook("didResetRowWidth",s),t.stopPropagation()},_highlightEmptyCols:function(){var t="row"==FLBuilderConfig.userTemplateType?"":":not(.fl-node-global)",i=(e(FLBuilder._contentClass+" .fl-row"+t),e(FLBuilder._contentClass+" .fl-col"+t));e(".fl-row-highlight").removeClass("fl-row-highlight"),i.removeClass("fl-col-highlight").find(".fl-col-content").css("height",""),i.each(function(){var t=e(this);0===t.find(".fl-module, .fl-col").length&&t.addClass("fl-col-highlight")})},_removeEmptyColHighlights:function(){e(".fl-row-highlight").removeClass("fl-row-highlight"),e(".fl-col-highlight").removeClass("fl-col-highlight")},_highlightRowsAndColsForDrag:function(t){var i="row"==FLBuilderConfig.userTemplateType?"":":not(.fl-node-global)";e(FLBuilder._contentClass+" .fl-row").addClass("fl-row-highlight"),t.closest(".fl-row-overlay").length||e(FLBuilder._contentClass+" .fl-col"+i).addClass("fl-col-highlight")},_adjustColHeightsForDrag:function(){var t="row"==FLBuilderConfig.userTemplateType?"":".fl-row:not(.fl-node-global) ",i=e(FLBuilder._contentClass),l=i.find(t+".fl-col-group:not(.fl-col-group-nested) > .fl-col > .fl-col-content"),s=i.find(t+".fl-col-group-nested .fl-col-content"),o=0;for(e(".fl-node-drag-init").hide();o<s.length;o++)FLBuilder._adjustColHeightForDrag(s.eq(o));for(o=0;o<l.length;o++)FLBuilder._adjustColHeightForDrag(l.eq(o));e(".fl-node-drag-init").show()},_adjustColHeightForDrag:function(e){e.find(".fl-module:visible, .fl-col:visible").length&&e.height(e.height()+45)},_showColHighlightGuide:function(){var t=e(this),i=t.find("a"),l=t.closest(".fl-col"),s=l.parents(".fl-col"),o=e('<div class="fl-col-highlight-guide"></div>'),n=null,r=t.closest(".fl-block-overlay").offset().top;(i.hasClass("fl-block-col-move-parent")||i.hasClass("fl-block-col-edit-parent"))&&(l=s),l.hasClass("fl-col-highlight")||(l.find("> .fl-col-content").append(o),l.addClass("fl-col-has-highlight-guide"),n=o.offset().top,n>r&&o.css("top",r-n+4+"px"))},_removeColHighlightGuides:function(){e(".fl-col-has-highlight-guide").removeClass("fl-col-has-highlight-guide"),e(".fl-col-highlight-guide").remove()},_colMouseenter:function(){var t=e(this),i=t.closest(".fl-col-group"),l=i.hasClass("fl-col-group-has-child-loading"),s=t.hasClass("fl-node-global"),o=t.parents(".fl-node-global").length>0,n=t.closest(".fl-col-group").find("> .fl-col").length,r=i.find("> .fl-col").index(t),a=0===r,d=n===r+1,u=t.find(".fl-col").length>0,c=t.parents(".fl-col"),h=c.closest(".fl-col-group"),f=c.length>0,g=f?h.find("> .fl-col").length:0,p=h.find("> .fl-col").index(c),b=!!f&&0===p,m=!!f&&g===p+1,v=t.find("> .fl-col-content").width(),_=t.closest(".fl-row"),L=!!_.find(".fl-row-fixed-width").addBack(".fl-row-fixed-width").length,w=FLBuilderConfig.rowResize.userCanResizeRows,C=wp.template("fl-col-overlay"),F=null;FLBuilderConfig.simpleUi||s&&o&&"row"!=FLBuilderConfig.userTemplateType||t.find(".fl-module, .fl-builder-node-loading-placeholder").length>0||t.find(".fl-col").length>0||t.closest(".fl-builder-node-loading").length||(t.hasClass("fl-block-overlay-active")||(FLBuilder._removeColOverlays(),FLBuilder._removeModuleOverlays(),F=FLBuilder._appendOverlay(t,C({global:s,groupLoading:l,numCols:n,first:a,last:d,hasChildCols:u,hasParentCol:f,parentFirst:b,parentLast:m,numParentCols:g,contentWidth:v,rowIsFixedWidth:L,userCanResizeRows:w})),FLBuilder._buildOverlayOverflowMenu(F),FLBuilder._initColDragResizing()),e("body").addClass("fl-block-overlay-muted"))},_colMouseleave:function(t){var i=e(this),l=e(t.toElement)||e(t.relatedTarget),s=i.find(".fl-module").length>0,o=l.is("#tiptip_holder"),n=l.closest("#tiptip_holder").length>0;o||n||s||(FLBuilder._removeColOverlays(),FLBuilder._removeColHighlightGuides(),FLBuilder._closeAllSubmenus())},_removeColOverlays:function(){var t=e(".fl-col");t.removeClass("fl-block-overlay-active"),t.find(".fl-col-overlay").remove(),e("body").removeClass("fl-block-overlay-muted"),FLBuilder._closeAllSubmenus()},_colDragHelper:function(){return e('<div class="fl-builder-block-drag-helper">'+FLBuilderStrings.column+"</div>")},_colDragInit:function(t){var i=e(t.target),l=e(".fl-col-sortable-proxy-item"),s=i.closest(".fl-col");i.hasClass("fl-block-col-move-parent")&&(s=s.parents(".fl-col")),s.addClass("fl-node-dragging"),FLBuilder._blockDragInit(t),FLBuilder._removeColHighlightGuides(),t.target=l[0],l.trigger(t)},_colDragStart:function(t,i){var l=e(".fl-node-dragging");l.hide(),FLBuilder._resetColumnWidths(l.parent()),FLBuilder._blockDragStart(t,i)},_colDragStop:function(t,i){FLBuilder._blockDragStop(t,i);var l=e(".fl-node-dragging").removeClass("fl-node-dragging").show(),s=l.attr("data-node"),o=i.item.parent(),n=l.parent(),r=n.attr("data-node");newGroup=o.closest(".fl-col-group"),newGroupId=newGroup.attr("data-node"),newRow=o.closest(".fl-row"),position=0,o.hasClass("fl-sortable-disabled")?FLBuilder._resetColumnWidths(n):o.hasClass("fl-col-sortable-proxy")?FLBuilder._resetColumnWidths(n):o.hasClass("fl-col-content")?(l.remove(),0===n.find(".fl-col").length&&n.remove(),position=o.find("> .fl-module, .fl-col-group, .fl-col-sortable-proxy-item").index(i.item),FLBuilder._addColGroup(o.closest(".fl-col").attr("data-node"),s,position)):o.hasClass("fl-col-drop-target")?(o.hasClass("fl-col-drop-target-last")?o.parent().after(l):o.parent().before(l),FLBuilder._resetColumnWidths(newGroup),r==newGroupId?FLBuilder.ajax({action:"reorder_col",node_id:s,position:l.index()}):FLBuilder.ajax({action:"move_col",node_id:s,new_parent:newGroupId,position:l.index(),resize:[r,newGroupId]}),FLBuilder._resizeLayout()):o.hasClass("fl-col-group-drop-target")?(l.remove(),0===n.find(".fl-col").length&&n.remove(),position=newRow.find(".fl-row-content > .fl-col-group").index(newGroup),position=o.hasClass("fl-drop-target-last")?position+1:position,FLBuilder._addColGroup(newRow.attr("data-node"),s,position)):o.hasClass("fl-row-drop-target")&&(l.remove(),position=o.closest(".fl-builder-content").find(".fl-row").index(newRow),position=o.hasClass("fl-drop-target-last")?position+1:position,FLBuilder._addRow(s,position)),0===n.find(".fl-col").length&&n.remove(),e(".fl-col-sortable-proxy").append(i.item),FLBuilder._highlightEmptyCols(),FLBuilder._initDropTargets(),FLBuilder._initSortables(),FLBuilder._closeAllSubmenus()},_colSettingsClicked:function(t){var i=e(this),l=i.closest(".fl-col"),s=l.find("> .fl-col-content"),o=i.closest(".fl-block-overlay-global").length>0,n=null;FLBuilder._colResizing||(i.hasClass("fl-block-col-edit-parent")&&(l=l.parents(".fl-col")),n=l.attr("data-node"),FLBuilderSettingsForms.render({id:"col",nodeId:n,className:"fl-builder-col-settings",attrs:'data-node="'+n+'"',badges:o?[FLBuilderStrings.global]:[],settings:FLBuilderSettingsConfig.nodes[n],preview:{type:"col"}},function(){0===l.siblings(".fl-col").length?e("#fl-builder-settings-section-general").hide():s.width()<=40&&e("#fl-field-size").hide()}),t.stopPropagation())},_copyColClicked:function(t){var i=e(this).closest(".fl-col"),l=i.attr("data-node"),s=i.clone(),o=i.parent(),n=e(".fl-builder-settings[data-node]"),r=n.attr("data-node"),a=r===l?i:i.find('[data-node="'+r+'"]'),d=null;n.length&&a.length&&(d=FLBuilder._getSettings(n),FLBuilderSettingsConfig.nodes[r]=d),s.addClass("fl-node-"+l+"-clone fl-builder-node-clone"),s.find(".fl-block-overlay").remove(),i.after(s),FLBuilder._showNodeLoading(l+"-clone"),FLBuilder._newColParent=o,FLBuilder._newColPosition=i.index()+1,FLBuilder._resetColumnWidths(o),FLBuilder.ajax({action:"copy_col",node_id:l,settings:d,settings_id:r},function(e){var t=JSON.parse(e);t.duplicatedColumn=l,FLBuilder._copyColComplete(t)}),t.stopPropagation()},_copyColComplete:function(e){e.nodeParent=FLBuilder._newColParent,e.nodePosition=FLBuilder._newColPosition,FLBuilder._renderLayout(e,function(){FLBuilder.triggerHook("didDuplicateColumn",{newNodeId:e.nodeId,oldNodeId:e.duplicatedColumn}),e.nodeParent.find(".fl-builder-node-loading").eq(0).remove()})},_deleteColClicked:function(t){var i=e(this),l=i.closest(".fl-col"),s=l.closest(".fl-col-group"),o=l.parents(".fl-col"),n=o.length>0,r=o.find("> .fl-col-content > .fl-module, > .fl-col-content > .fl-col-group"),a=l.siblings(".fl-col"),d=!0;l.find(".fl-module").length>0&&(d=confirm(FLBuilderStrings.deleteColumnMessage)),n&&1===r.length&&(0===a.length?l=o:1!==a.length||a.find(".fl-module").length||(l=s)),d&&(FLBuilder._deleteCol(l),FLBuilder._removeAllOverlays(),FLBuilder._highlightEmptyCols()),t.stopPropagation()},_deleteCol:function(e){var t=e.attr("data-node"),i=e.closest(".fl-row"),l=e.closest(".fl-col-group"),s=0;e.remove(),rowCols=i.find(".fl-row-content > .fl-col-group > .fl-col"),groupCols=l.find(" > .fl-col"),0===rowCols.length&&"row"!=FLBuilderConfig.userTemplateType?FLBuilder._deleteRow(i):(0===groupCols.length?l.remove():(s=6===groupCols.length?16.65:7===groupCols.length?14.28:Math.round(100/groupCols.length*100)/100,groupCols.css("width",s+"%"),FLBuilder.triggerHook("didResetColumnWidths",{cols:groupCols})),FLBuilder.ajax({action:"delete_col",node_id:t,new_width:s}),FLBuilder._initDropTargets(),FLBuilder._initSortables(),FLBuilder.triggerHook("didDeleteColumn",t))},_addCols:function(e,t,i,l){var s=e.closest(".fl-col-group"),o=s.find(".fl-col").index(e);i="undefined"==typeof i?"1-col":i,l="undefined"!=typeof l&&l,"after"==t&&o++,FLBuilder._showNodeLoadingPlaceholder(s,o),FLBuilder._removeAllOverlays(),FLBuilder.ajax({action:"render_new_columns",node_id:e.attr("data-node"),insert:t,type:i,nested:l?1:0},FLBuilder._addColsComplete)},_addColsComplete:function(t){var i=JSON.parse(t),l=null,s=FLBuilder._addModuleAfterNodeRender;FLBuilder._renderLayout(i,function(){null!==s&&(e('.fl-module[data-node="'+s.module.data("node")+'"]').remove(),l=e('.fl-col[data-node="'+s.colId+'"]'),"after"==s.position?l.next().find(".fl-col-content").append(s.module):l.prev().find(".fl-col-content").append(s.module),FLBuilder._reorderModule(s.module),FLBuilder._addModuleAfterNodeRender=null),FLBuilder.triggerHook("didAddColumn",i.nodeId),FLBuilder.triggerHook("didResetColumnWidths",{cols:e(".fl-node-"+i.nodeId).find("> .fl-col")})})},_addColGroup:function(t,i,l){var s=e(".fl-node-"+t);FLBuilder._newColGroupPosition=l,s.hasClass("fl-col")?FLBuilder._newColGroupParent=s.find(" > .fl-col-content"):FLBuilder._newColGroupParent=s.find(".fl-row-content"),FLBuilder._showNodeLoadingPlaceholder(FLBuilder._newColGroupParent,l),FLBuilder.ajax({action:"render_new_column_group",cols:i,node_id:t,position:l},FLBuilder._addColGroupComplete)},_addColGroupComplete:function(t){var i=JSON.parse(t),l=e(i.html),s=l.data("node"),o=l.find(".fl-col").data("node"),n=FLBuilder._addModuleAfterNodeRender;i.nodeParent=FLBuilder._newColGroupParent,i.nodePosition=FLBuilder._newColGroupPosition,FLBuilder._renderLayout(i,function(){i.nodeParent.hasClass("fl-col-content")&&i.nodeParent.parents(".fl-col").addClass("fl-col-has-cols"),null!==n&&(e(".fl-node-"+o+" .fl-col-content").append(n),FLBuilder._reorderModule(n),FLBuilder._addModuleAfterNodeRender=null),FLBuilder._removeNodeLoadingPlaceholder(e(".fl-node-"+s)),FLBuilder.triggerHook("didAddColumnGroup",s)})},_initColDragResizing:function(){e(".fl-block-col-resize").not(".fl-block-row-resize").draggable({axis:"x",start:FLBuilder._colDragResizeStart,drag:FLBuilder._colDragResize,stop:FLBuilder._colDragResizeStop})},_colDragResizeStart:function(t,i){var l=e(i.helper),s="",o=l.hasClass("fl-block-col-resize-parent"),n=o?l.closest(".fl-col").parents(".fl-col"):null,r=o?n.parents(".fl-col-group"):l.closest(".fl-col-group"),a=r.find("> .fl-col"),d=o?n:l.closest(".fl-col"),u=d.attr("data-node"),c=e("[data-node="+u+"] #fl-field-size input"),h=null,f=null,g=null,p=100,b=0,m=null,v=null;for(l.hasClass("fl-block-col-resize-e")?(s="e",h=d.nextAll(".fl-col").first()):(s="w",h=d.prevAll(".fl-col").first()),f=h.attr("data-node"),g=e("[data-node="+f+"] #fl-field-size input");b<a.length;b++)a.eq(b).data("node")!=d.data("node")&&a.eq(b).data("node")!=h.data("node")&&(p-=parseFloat(a.eq(b)[0].style.width));c.length?(m=c,v="col"):g.length&&(m=g,v="sibling"),FLBuilder._colResizeData={handle:l,feedbackLeft:l.find(".fl-block-col-resize-feedback-left"),feedbackRight:l.find(".fl-block-col-resize-feedback-right"),direction:s,groupWidth:r.outerWidth(),col:d,colWidth:parseFloat(d[0].style.width)/100,sibling:h,offset:i.position.left,availWidth:p,setting:m,settingType:v},FLBuilder._colResizing=!0,e("body").addClass("fl-builder-col-resizing"),FLBuilder._closePanel(),FLBuilder._destroyOverlayEvents(),FLBuilder.triggerHook("col-resize-start")},_colDragResize:function(e,t){var i=FLBuilder._colResizeData,l=FLBuilderConfig.isRtl?"w":"e",s=i.handle.closest(".fl-block-overlay"),o=(i.offset-t.position.left)/i.groupWidth,n=l==i.direction?100*(i.colWidth-o):100*(i.colWidth+o),r=Math.round(100*n)/100,a=i.availWidth-n,d=Math.round(100*a)/100,u=8,c=Math.round(100*(i.availWidth-u))/100;r<u?(r=u,d=c):d<u&&(r=c,d=u),l==i.direction?(i.feedbackLeft.html(r.toFixed(1)+"%").show(),i.feedbackRight.html(d.toFixed(1)+"%").show()):(i.feedbackLeft.html(d.toFixed(1)+"%").show(),i.feedbackRight.html(r.toFixed(1)+"%").show()),i.col.css("width",r+"%"),i.sibling.css("width",d+"%"),i.setting&&("col"===i.settingType?i.setting.val(parseFloat(i.col[0].style.width)):"sibling"===i.settingType&&i.setting.val(parseFloat(i.sibling[0].style.width))),FLBuilder._buildOverlayOverflowMenu(s),FLBuilder.triggerHook("col-resize-drag")},_colDragResizeStop:function(t,i){var l=FLBuilder._colResizeData,s=FLBuilder._colResizeData.handle.closest(".fl-block-overlay"),o=l.col.data("node"),n=parseFloat(l.col[0].style.width),r=l.sibling.data("node"),a=parseFloat(l.sibling[0].style.width);FLBuilder._colResizeData.feedbackLeft.hide(),FLBuilder._colResizeData.feedbackRight.hide(),FLBuilder.ajax({action:"resize_cols",col_id:o,col_width:n,sibling_id:r,sibling_width:a}),FLBuilder._buildOverlayOverflowMenu(s),FLBuilder._colResizeData=null,e("body").removeClass("fl-builder-col-resizing"),FLBuilder._bindOverlayEvents(),setTimeout(function(){FLBuilder._colResizing=!1},50),FLBuilder.triggerHook("col-resize-stop"),FLBuilder.triggerHook("didResizeColumn",{colId:o,colWidth:n,siblingId:r,siblingWidth:a})},_resetColumnWidthsClicked:function(t){var i=e(this),l=!!i.closest(".fl-row-overlay").length,s=null,o=null,n=[],r=null,a=0,d=e(".fl-builder-col-settings"),u=null;o=l?i.closest(".fl-row").find(".fl-row-content > .fl-col-group"):i.parents(".fl-col-group").last(),o.each(function(){for(s=e(this),r=s.find(".fl-col-group"),n.push(s.data("node")),FLBuilder._resetColumnWidths(s),a=0;a<r.length;a++)FLBuilder._resetColumnWidths(r.eq(a)),n.push(r.eq(a).data("node"))}),d.length&&(u=e(".fl-node-"+d.attr("data-node")),d.find("#fl-field-size input").val(parseFloat(u[0].style.width))),FLBuilder.ajax({action:"reset_col_widths",group_id:n}),FLBuilder.triggerHook("col-reset-widths"),FLBuilder._closeAllSubmenus(),t.stopPropagation()},_resetColumnWidths:function(e){var t=e.find(" > .fl-col:visible"),i=0;i=6===t.length?16.65:7===t.length?14.28:Math.round(100/t.length*100)/100,t.css("width",i+"%"),FLBuilder.triggerHook("didResetColumnWidths",{cols:t})},_moduleMouseenter:function(){var t=e(this),i=t.attr("data-name"),l=t.hasClass("fl-node-global"),s=t.parents(".fl-node-global").length>0,o=t.parents(".fl-col-group").last(),n=o.hasClass("fl-col-group-has-child-loading"),r=t.closest(".fl-col-group").find("> .fl-col").length,a=t.closest(".fl-col"),d=0===a.index(),u=r===a.index()+1,c=a.parents(".fl-col"),h=c.length>0,f=h?c.closest(".fl-col-group").find("> .fl-col").length:0,g=!!h&&0===c.index(),p=!!h&&f===c.index()+1,b=a.find("> .fl-col-content").width(),m=t.closest(".fl-row"),v=!!m.find(".fl-row-fixed-width").addBack(".fl-row-fixed-width").length,_=FLBuilderConfig.rowResize.userCanResizeRows,L=wp.template("fl-module-overlay"),w=null;FLBuilder._removeColOverlays(),FLBuilder._removeModuleOverlays(),l&&s&&"row"!=FLBuilderConfig.userTemplateType||t.closest(".fl-builder-node-loading").length||(t.hasClass("fl-block-overlay-active")||(w=FLBuilder._appendOverlay(t,L({global:l,moduleName:i,groupLoading:n,numCols:r,colFirst:d,colLast:u,hasParentCol:h,numParentCols:f,parentFirst:g,parentLast:p,contentWidth:b,rowIsFixedWidth:v,userCanResizeRows:_})),FLBuilder._buildOverlayOverflowMenu(w),FLBuilder._initColDragResizing()),e("body").addClass("fl-block-overlay-muted"))},_moduleMouseleave:function(t){var i=(e(this),e(t.toElement)||e(t.relatedTarget)),l=i.is("#tiptip_holder"),s=i.closest("#tiptip_holder").length>0;l||s||(FLBuilder._removeModuleOverlays(),FLBuilder._removeColHighlightGuides())},_removeModuleOverlays:function(){var t=e(".fl-module");t.removeClass("fl-block-overlay-active"),t.find(".fl-module-overlay").remove(),
|
4 |
e("body").removeClass("fl-block-overlay-muted"),FLBuilder._closeAllSubmenus()},_moduleDragHelper:function(t,i){return e('<div class="fl-builder-block-drag-helper">'+i.attr("data-name")+"</div>")},_moduleDragStart:function(t,i){e(i.item).data("original-position",i.item.index()),FLBuilder._blockDragStart(t,i)},_moduleDragStop:function(t,i){FLBuilder._blockDragStop(t,i);var l=i.item,s=l.parent(),o=null,n=0,r=0;if(s.hasClass("fl-builder-modules")||s.hasClass("fl-builder-widgets"))return void l.remove();if(l.hasClass("fl-builder-block")){if(s.hasClass("fl-sortable-disabled"))return l.remove(),void FLBuilder._showPanel();s.hasClass("fl-row-drop-target")?(s=l.closest(".fl-builder-content"),r=0,o=l.closest(".fl-row"),n=s.find(".fl-row").index(o)):s.hasClass("fl-col-group-drop-target")?(s=l.closest(".fl-row-content"),r=s.closest(".fl-row").attr("data-node"),o=l.closest(".fl-col-group"),n=s.find(" > .fl-col-group").index(o)):s.hasClass("fl-col-drop-target")?(s=l.closest(".fl-col-group"),r=s.attr("data-node"),o=l.closest(".fl-col"),n=s.find(" > .fl-col").index(o)):(n=s.find("> .fl-module, .fl-col-group, .fl-builder-block").index(l),r=l.closest(".fl-col").attr("data-node")),l.closest(".fl-drop-target-last").length&&(n+=1),FLBuilder._addModule(s,r,l.attr("data-type"),n,l.attr("data-widget"),l.attr("data-alias")),l.remove()}else{if(s.hasClass("fl-sortable-disabled"))return e(t.target).append(i.item),e(t.target).children().eq(i.item.data("original-position")).before(i.item),void FLBuilder._highlightEmptyCols();s.hasClass("fl-row-drop-target")?(o=l.closest(".fl-row"),n=l.closest(".fl-builder-content").children(".fl-row").index(o),n=l.closest(".fl-drop-target-last").length?n+1:n,FLBuilder._addModuleAfterNodeRender=l,FLBuilder._addRow("1-col",n),l.remove()):s.hasClass("fl-col-group-drop-target")?(o=l.closest(".fl-col-group"),n=l.closest(".fl-row-content ").find(" > .fl-col-group").index(o),n=l.closest(".fl-drop-target-last").length?n+1:n,FLBuilder._addModuleAfterNodeRender=l,FLBuilder._addColGroup(l.closest(".fl-row").attr("data-node"),"1-col",n),l.remove()):s.hasClass("fl-col-drop-target")?(o=l.closest(".fl-col"),n=l.closest(".fl-col-drop-target-last").length?"after":"before",FLBuilder._addModuleAfterNodeRender={module:l,colId:o.data("node"),position:n},FLBuilder._addCols(o,n,"1-col",l.closest(".fl-col-group-nested").length>0),l.remove()):FLBuilder._reorderModule(l)}FLBuilder._resizeLayout()},_reorderModule:function(e){var t=e.closest(".fl-col").attr("data-node"),i=e.attr("data-parent"),l=e.attr("data-node"),s=e.index();t==i?FLBuilder._reorderNode(l,s):(e.attr("data-parent",t),FLBuilder._moveNode(t,l,s))},_deleteModuleClicked:function(t){var i=e(this).closest(".fl-module"),l=confirm(FLBuilderStrings.deleteModuleMessage);l&&(FLBuilder._deleteModule(i),FLBuilder._removeAllOverlays()),t.stopPropagation()},_deleteModule:function(e){var t=e.closest(".fl-row"),i=e.attr("data-node");FLBuilder.ajax({action:"delete_node",node_id:i}),e.empty(),e.remove(),t.removeClass("fl-block-overlay-muted"),FLBuilder._highlightEmptyCols(),FLBuilder._removeAllOverlays(),FLBuilder.triggerHook("didDeleteModule",i)},_moduleCopyClicked:function(t){var i=e(this).closest(".fl-module"),l=i.attr("data-node"),s=i.index()+1,o=i.clone(),n=e(".fl-builder-module-settings[data-node="+l+"]"),r=null;n.length&&(r=FLBuilder._getSettings(n),FLBuilderSettingsConfig.nodes[l]=r),o.addClass("fl-node-"+l+"-clone fl-builder-node-clone"),o.find(".fl-block-overlay").remove(),i.after(o),e("html, body").animate({scrollTop:o.offset().top-75},500),FLBuilder._showNodeLoading(l+"-clone"),FLBuilder._newModuleParent=i.parent(),FLBuilder._newModulePosition=s,FLBuilder.ajax({action:"copy_module",node_id:l,settings:r},function(e){var t=JSON.parse(e);t.duplicatedModule=l,FLBuilder._moduleCopyComplete(t)}),t.stopPropagation()},_moduleCopyComplete:function(e){e.nodeParent=FLBuilder._newModuleParent,e.nodePosition=FLBuilder._newModulePosition,FLBuilder._renderLayout(e,function(){FLBuilder.triggerHook("didDuplicateModule",{newNodeId:e.nodeId,oldNodeId:e.duplicatedModule}),e.nodeParent.find(".fl-builder-node-loading").eq(0).remove()})},_moduleSettingsClicked:function(t){var i=e(this),l=i.closest(".fl-module").attr("data-type"),s=i.closest(".fl-module").attr("data-node"),o=i.closest(".fl-col").attr("data-node"),n=i.closest(".fl-block-overlay-global").length>0;t.stopPropagation(),FLBuilder._colResizing||n&&!FLBuilderConfig.userCanEditGlobalTemplates||FLBuilder._showModuleSettings({type:l,nodeId:s,parentId:o,global:n})},_showModuleSettings:function(t,i){var l=FLBuilderSettingsConfig.modules[t.type],s=t.settings?t.settings:FLBuilderSettingsConfig.nodes[t.nodeId],o=e("head");-1===e.inArray(t.type,FLBuilder._loadedModuleAssets)&&(""!==l.assets.css&&o.append(l.assets.css),""!==l.assets.js&&o.append(l.assets.js),FLBuilder._loadedModuleAssets.push(t.type)),FLBuilderSettingsForms.render({type:"module",id:t.type,nodeId:t.nodeId,className:"fl-builder-module-settings fl-builder-"+t.type+"-settings",attrs:'data-node="'+t.nodeId+'" data-parent="'+t.parentId+'" data-type="'+t.type+'"',buttons:t.global||FLBuilderConfig.lite||FLBuilderConfig.simpleUi?[]:["save-as"],badges:t.global?[FLBuilderStrings.global]:[],settings:s,legacy:t.legacy,helper:FLBuilder._moduleHelpers[t.type],rules:FLBuilder._moduleHelpers[t.type]?FLBuilder._moduleHelpers[t.type].rules:null,preview:{type:"module",layout:t.layout,callback:function(){FLBuilder.triggerHook("didAddModule",t.nodeId)}}},i)},_saveModuleClicked:function(){var t=e(this).closest(".fl-builder-settings"),i=t.attr("data-type"),l=(t.attr("data-node"),FLBuilder._moduleHelpers[i]),s=!0;"undefined"!=typeof l&&(t.find("label.error").remove(),t.validate().hideErrors(),s=t.validate().form(),s&&(s=l.submit())),s?FLBuilder._saveSettings():FLBuilder._toggleSettingsTabErrors()},_addModule:function(e,t,i,l,s,o){FLBuilder._showNodeLoadingPlaceholder(e,l),e.hasClass("fl-col-group")?(FLBuilder._newModuleParent=null,FLBuilder._newModulePosition=0):(FLBuilder._newModuleParent=e,FLBuilder._newModulePosition=l),FLBuilder.ajax({action:"render_new_module",parent_id:t,type:i,position:l,node_preview:1,widget:"undefined"==typeof s?"":s,alias:"undefined"==typeof o?"":o},FLBuilder._addModuleComplete)},_addModuleComplete:function(t){var i=JSON.parse(t);i.layout&&(i.layout.nodeParent=FLBuilder._newModuleParent,i.layout.nodePosition=FLBuilder._newModulePosition),i.settings||(i.settings=FLBuilderSettingsConfig.defaults.modules[i.type]),e("form.fl-builder-settings").length?i.layout&&FLBuilder._renderLayout(i.layout):FLBuilder._showModuleSettings(i,function(){e(".fl-builder-module-settings").data("new-module","1")})},registerModuleHelper:function(t,i){var l={rules:{},init:function(){},submit:function(){return!0},preview:function(){}};FLBuilder._moduleHelpers[t]=e.extend({},l,i)},_registerModuleHelper:function(e,t){FLBuilder.registerModuleHelper(e,t)},_showNodeTemplateSettings:function(t){var i=e(".fl-builder-settings-lightbox .fl-builder-settings"),l=i.attr("data-node"),s=FLBuilderStrings.saveModule;return i.hasClass("fl-builder-row-settings")&&(s=FLBuilderStrings.saveRow),!!FLBuilder._triggerSettingsSave(!1,!1,!1)&&void FLBuilderSettingsForms.render({id:"node_template",nodeId:l,title:s,attrs:'data-node="'+l+'"',className:"fl-builder-node-template-settings",rules:{name:{required:!0}}},function(){FLBuilderConfig.userCanEditGlobalTemplates||e("#fl-field-global").hide()})},_saveNodeTemplate:function(){var t=e(".fl-builder-node-template-settings"),i=t.attr("data-node"),l=t.validate().form();l&&(FLBuilder._showNodeLoading(i),FLBuilder.ajax({action:"save_node_template",node_id:i,settings:FLBuilder._getSettings(t)},function(e){FLBuilder._saveNodeTemplateComplete(e),FLBuilder._hideNodeLoading(i)}),FLBuilder._lightbox.close())},_saveNodeTemplateComplete:function(t){var i=JSON.parse(t),l=e(".fl-builder-saved-"+i.type+"s"),s=l.find(".fl-builder-block"),o=null,n="",r=i.name.toLowerCase(),a=0,d=wp.template("fl-node-template-block"),u={name:i.name,isGlobal:i.global,content:i.type,id:i.id,postID:i.postID,kind:"template",type:"user",link:i.link,category:{uncategorized:FLBuilderStrings.uncategorized}};if(FLBuilderConfig.contentItems.template.push(u),FLBuilder.triggerHook("contentItemsChanged"),i.layout&&(FLBuilder._renderLayout(i.layout),FLBuilder.triggerHook("didSaveGlobalNodeTemplate",i.config)),0===s.length)l.append(d(i));else for(;a<s.length;a++){if(o=s.eq(a),n=o.text().toLowerCase().trim(),0===a&&r<n){l.prepend(d(i));break}if(r<n){o.before(d(i));break}if(s.length-1===a){l.append(d(i));break}}l.find(".fl-builder-block-no-node-templates").remove()},_nodeTemplateDragStop:function(t,i){FLBuilder._blockDragStop(t,i);var l=i.item,s=l.parent(),o=null,n=0,r=null,a="",d=null;if(s.hasClass("fl-builder-blocks-section-content"))return void l.remove();if(l.hasClass("fl-builder-block-saved-row")||l.hasClass("fl-builder-block-row-template"))r=l.closest(".fl-row"),n=r.length?e(FLBuilder._contentClass+" .fl-row").index(r):0,n=s.hasClass("fl-drop-target-last")?n+1:n,o=null,a="render_new_row",d=FLBuilder._addRowComplete,FLBuilder._newRowPosition=n,FLBuilder._showNodeLoadingPlaceholder(e(FLBuilder._contentClass),n);else if(l.hasClass("fl-builder-block-saved-module")||l.hasClass("fl-builder-block-module-template")){if(a="render_new_module",d=FLBuilder._addModuleComplete,s.hasClass("fl-sortable-disabled"))return l.remove(),void FLBuilder._showPanel();s.hasClass("fl-row-drop-target")?(s=l.closest(".fl-builder-content"),o=0,n=s.find(".fl-row").index(l.closest(".fl-row"))):s.hasClass("fl-col-group-drop-target")?(s=l.closest(".fl-row-content"),o=s.closest(".fl-row").attr("data-node"),n=s.find(" > .fl-col-group").index(l.closest(".fl-col-group"))):s.hasClass("fl-col-drop-target")?(s=l.closest(".fl-col-group"),n=s.children(".fl-col").index(l.closest(".fl-col")),o=s.attr("data-node")):(n=s.children(".fl-module, .fl-builder-block").index(l),o=l.closest(".fl-col").attr("data-node")),l.closest(".fl-drop-target-last").length&&(n+=1),s.hasClass("fl-col-group")?(FLBuilder._newModuleParent=null,FLBuilder._newModulePosition=0):(FLBuilder._newModuleParent=s,FLBuilder._newModulePosition=n),FLBuilder._showNodeLoadingPlaceholder(s,n)}FLBuilder.ajax({action:a,template_id:l.attr("data-id"),template_type:l.attr("data-type"),parent_id:o,position:n},function(e){if(a.indexOf("row")>-1){var t=JSON.parse(e);FLBuilder.triggerHook("didApplyRowTemplateComplete",t.config),d(t.layout)}else d(e)}),l.remove()},_editNodeTemplateClicked:function(t){t.preventDefault(),t.stopPropagation(),window.open(e(this).attr("href"))},_deleteNodeTemplateClicked:function(t){var i=e(t.target),l=i.closest(".fl-builder-blocks-section"),s=l.find(".fl-builder-blocks-section-content"),o=s.find(".fl-builder-block"),n=i.closest(".fl-builder-block"),r=n.hasClass("fl-builder-block-global"),a=r?FLBuilder._updateLayout:void 0,d=r?FLBuilderStrings.deleteGlobalTemplate:FLBuilderStrings.deleteTemplate,u=null;confirm(d)&&(n.remove(),1===o.length&&(n.hasClass("fl-builder-block-saved-row")?s.append('<span class="fl-builder-block-no-node-templates">'+FLBuilderStrings.noSavedRows+"</span>"):s.append('<span class="fl-builder-block-no-node-templates">'+FLBuilderStrings.noSavedModules+"</span>")),n.hasClass("fl-builder-block-global")&&FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"delete_node_template",template_id:n.attr("data-id")},a),u=_.findIndex(FLBuilderConfig.contentItems.template,{id:n.attr("data-id"),type:"user"}),FLBuilderConfig.contentItems.template.splice(u,1),FLBuilder.triggerHook("contentItemsChanged"))},_initSettingsForms:function(){FLBuilder._initCodeFields(),FLBuilder._initColorPickers(),FLBuilder._initSelectFields(),FLBuilder._initEditorFields(),FLBuilder._initMultipleFields(),FLBuilder._initAutoSuggestFields(),FLBuilder._initLinkFields(),FLBuilder._initFontFields(),FLBuilder._initOrderingFields(),FLBuilder._initTimezoneFields(),FLBuilder._focusFirstSettingsControl(),FLBuilder._lightbox._resizeEditors(),e(".fl-builder-settings-fields").css("visibility","visible"),FLBuilder.triggerHook("settings-form-init")},_destroySettingsForms:function(){FLBuilder._destroyEditorFields()},_setSettingsFormContent:function(t){e(".fl-legacy-settings").remove(),e("body").append(t)},_settingsTabClicked:function(t){var i=e(this),l=i.closest(".fl-builder-settings"),s=i.attr("href").split("#").pop();FLBuilder._resetSettingsTabsState(),l.find(".fl-builder-settings-tab").removeClass("fl-active"),l.find("#"+s).addClass("fl-active"),l.find(".fl-builder-settings-tabs .fl-active").removeClass("fl-active"),l.find("a[href*="+s+"]").addClass("fl-active"),FLBuilder._focusFirstSettingsControl(),t.preventDefault()},_resetSettingsTabsState:function(){var t=e(".fl-lightbox:visible");FLBuilder._hideTabsOverflowMenu(),t.find(".fl-builder-settings-tabs .fl-active").removeClass("fl-active"),t.find(".fl-builder-settings-tabs-overflow-menu .fl-active").removeClass("fl-active"),t.find(".fl-contains-active").removeClass("fl-contains-active")},_calculateSettingsTabsOverflow:function(){var t=e(".fl-lightbox:visible"),i=t.outerWidth(),l=t.hasClass("fl-lightbox-width-slim"),s=t.find(".fl-builder-settings-tabs"),o=t.find(".fl-builder-settings-tabs-overflow-menu"),n=t.find(".fl-builder-settings-tabs-more"),r=s.find("a"),a=!1,d=i-60,u=0,c=l?16:30;o.html(""),FLBuilder._hideTabsOverflowMenu(),r.removeClass("fl-overflowed"),r.each(function(){if(!e(this).is(":visible"))return!0;if(!a){var t=e(this).textWidth()+c+12;u+=t,u>=d&&(a=!0)}if(a){var i=e(this).html(),l=e(this).attr("href"),s="";e(this).hasClass("fl-active")&&(s="fl-active"),e(this).hasClass("error")&&(s+=" error"),""!==s&&(s='class="'+s+'"');var n=e('<a href="'+l+'" '+s+">"+i+"</a>");o.append(n),e(this).addClass("fl-overflowed")}else e(this).removeClass("fl-overflowed")}),a?t.addClass("fl-lightbox-has-tab-overflow"):t.removeClass("fl-lightbox-has-tab-overflow"),o.find(".fl-active").length>0?n.addClass("fl-contains-active"):n.removeClass("fl-contains-active"),o.find(".error").length>0?n.addClass("fl-contains-errors"):n.removeClass("fl-contains-errors")},_settingsTabsToOverflowMenuItemClicked:function(t){var i=e(t.currentTarget),l=i.attr("href"),s=i.closest(".fl-lightbox-header-wrap").find(".fl-builder-settings-tabs"),o=s.find('a[href="'+l+'"]'),n=s.find(".fl-builder-settings-tabs-more");FLBuilder._resetSettingsTabsState(),o.trigger("click"),i.addClass("fl-active"),n.addClass("fl-contains-active"),FLBuilder._hideTabsOverflowMenu(),t.preventDefault()},_hasOverflowTabs:function(){var t=e(".fl-lightbox:visible"),i=t.find(".fl-builder-settings-tabs-overflow-menu a");return i.length>0},_showTabsOverflowMenu:function(){if(FLBuilder._hasOverflowTabs()){var t=e(".fl-lightbox:visible");t.find(".fl-builder-settings-tabs-overflow-menu").css("display","flex"),t.find(".fl-builder-settings-tabs-overflow-click-mask").show(),this.isShowingSettingsTabsOverflowMenu=!0}},_hideTabsOverflowMenu:function(){var t=e(".fl-lightbox:visible");t.find(".fl-builder-settings-tabs-overflow-menu").css("display","none"),t.find(".fl-builder-settings-tabs-overflow-click-mask").hide(),this.isShowingSettingsTabsOverflowMenu=!1},_toggleTabsOverflowMenu:function(e){FLBuilder.isShowingSettingsTabsOverflowMenu?FLBuilder._hideTabsOverflowMenu():FLBuilder._showTabsOverflowMenu(),e.stopPropagation()},_settingsCancelClicked:function(t){var i=e(".fl-builder-lightbox[data-parent]"),l=e(".fl-builder-module-settings"),s=null,o=null,n=null,r=null;return i.length>0?void FLBuilder._closeNestedSettings():(l.length>0&&"undefined"!=typeof l.data("new-module")?(s=e(FLBuilder.preview.state.html),o=e(".fl-node-"+l.data("node")),n=o.closest(".fl-col"),r=s.find(".fl-node-"+n.data("node")),r.length>0?FLBuilder._deleteModule(o):FLBuilder._deleteCol(n)):FLBuilder.preview&&FLBuilder.preview.revert(),FLBuilder.preview=null,void FLLightbox.closeParent(this))},_focusFirstSettingsControl:function(){var t=e(".fl-builder-settings:visible"),i=t.find(".fl-builder-settings-tab.fl-active"),l=i.find(".fl-field").first(),s=l.find('input:not([type="hidden"]), textarea, select, button, a, .fl-editor-field').first();if("undefined"!=typeof tinyMCE&&s.hasClass("fl-editor-field")){var o=s.find("textarea.wp-editor-area").attr("id");tinyMCE.get(o).focus()}else setTimeout(function(){s.focus().css("animation-name","fl-grab-attention")},300);l.css("animation-name","fl-grab-attention"),l.on("animationend",function(){l.css("animation-name","")})},_initSettingsValidation:function(t,i){var l=e(".fl-builder-settings").last();l.validate({ignore:".fl-ignore-validation",rules:t,messages:i,errorPlacement:FLBuilder._settingsErrorPlacement})},_settingsErrorPlacement:function(e,t){e.appendTo(t.parent())},_toggleSettingsTabErrors:function(){for(var t=e(".fl-builder-settings:visible"),i=t.find(".fl-builder-settings-tab"),l=null,s=null,o=0;o<i.length;o++)l=i.eq(o),s=l.find("label.error"),tabLink=t.find(".fl-builder-settings-tabs a[href*="+l.attr("id")+"]"),tabLink.find(".fl-error-icon").remove(),tabLink.removeClass("error"),s.length>0&&(tabLink.append('<span class="fl-error-icon"></span>'),tabLink.addClass("error"));FLBuilder._calculateSettingsTabsOverflow()},_getSettings:function(t){FLBuilder._updateEditorFields();var i=t.serializeArray(),l=0,s=0,o="",n="",r="",a=[],d=[],u={};for(l=0;l<i.length;l++)if(o=i[l].value.replace(/\r/gm,""),!(i[l].name.indexOf("flrich")>-1))if(i[l].name.indexOf("[")>-1){for(n=i[l].name.replace(/\[(.*)\]/,""),r=i[l].name.replace(n,""),a=[],d=r.match(/\[[^\]]*\]/g),s=0;s<d.length;s++)"[]"!=d[s]&&a.push(d[s].replace(/\[|\]/g,""));r.match(/\[\]\[[^\]]*\]\[[^\]]+\]/)?("undefined"==typeof u[n]&&(u[n]={}),"undefined"==typeof u[n][a[0]]&&(u[n][a[0]]={}),"undefined"==typeof u[n][a[0]][a[1]]&&(u[n][a[0]][a[1]]={}),u[n][a[0]][a[1]]=o):r.match(/\[\]\[[^\]]*\]\[\]/)?("undefined"==typeof u[n]&&(u[n]={}),"undefined"==typeof u[n][a[0]]&&(u[n][a[0]]=[]),u[n][a[0]].push(o)):r.match(/\[\]\[[^\]]*\]/)?("undefined"==typeof u[n]&&(u[n]={}),u[n][a[0]]=o):r.match(/\[\]/)&&("undefined"==typeof u[n]&&(u[n]=[]),u[n].push(o))}else u[i[l].name]=o;for(r in u)if("undefined"!=typeof u["as_values_"+r]){u[r]=e.grep(u["as_values_"+r].split(","),function(e){return""!==e}).join(",");try{delete u["as_values_"+r]}catch(c){}}return e.each(t.find("[name]"),function(t,i){var l=e(i).attr("name").replace(/\[(.*)\]/,"");l in u||(u[l]="")}),u=e.extend({},FLBuilder._getOriginalSettings(t),u)},_getSettingsJSONForHTML:function(e){return JSON.stringify(e).replace(/\'/g,"'").replace("<wbr />","<wbr>")},_getOriginalSettings:function(t,i){var l=t.find(".fl-builder-settings-json"),s=t.data("node"),o=FLBuilderSettingsConfig.nodes,n=null,r={};if(s&&o[s]?n=o[s]:l.length&&(n=JSON.parse(l.val().replace(/'/g,"'"))),n)for(key in n)(e("#fl-field-"+key).length||i)&&(r[key]=n[key]);return r},_saveSettings:function(t){var i=e(".fl-builder-settings-lightbox .fl-builder-settings"),l=i.data("new-module"),s=i.attr("data-node"),o=FLBuilder._getSettings(i),n=FLBuilder.preview;return!_.isUndefined(t)&&_.isBoolean(t)||(t=!0),n&&!n._settingsHaveChanged()&&_.isUndefined(l)?void FLBuilder._lightbox.close():(FLBuilder._showNodeLoading(s),FLBuilderSettingsConfig.nodes[s]=o,FLBuilder.ajax({action:"save_settings",node_id:s,settings:o},FLBuilder._saveSettingsComplete.bind(this,t,n)),FLBuilder.triggerHook("didSaveNodeSettings",{nodeId:s,settings:o}),void FLBuilder._lightbox.close())},_saveSettingsComplete:function(e,t,i){var l=JSON.parse(i),s=function(){t&&l.layout.partial&&l.layout.nodeId===t.nodeId&&(t.clear(),t=null)};!0===e?FLBuilder._renderLayout(l.layout,s):s(),FLBuilder.triggerHook("didSaveNodeSettingsComplete",{nodeId:l.node_id,settings:l.settings})},_triggerSettingsSave:function(t,i,l){var s=FLBuilder._lightbox._node.find("form.fl-builder-settings"),o=FLBuilder._lightbox._node.data("instance-id"),n=FLLightbox._instances[o],r=e(".fl-lightbox-wrap[data-parent]:visible"),a=!1,d=!0;return t=!_.isUndefined(t)&&t,i=!_.isUndefined(i)&&i,l=!!_.isUndefined(l)||l,s.length&&(r.length&&(r.find(".fl-builder-settings-save").trigger("click"),(r.find("label.error").length||e(".fl-builder-alert-lightbox:visible").length)&&(d=!1)),d&&!s.validate().form()&&(d=!1),a=FLBuilderSettingsForms.settingsHaveChanged(),d&&a&&(t&&n.disableClose(),s.find(".fl-builder-settings-save").trigger("click"),t&&n.enableClose(),(s.find("label.error").length||e(".fl-builder-alert-lightbox:visible").length)&&(d=!1)),l&&(FLBuilder._destroySettingsForms(),!a&&FLBuilder.preview&&(FLBuilder.preview.clear(),FLBuilder.preview=null)),a||t||n.close()),d||(FLBuilder.triggerHook("didFailSettingsSave"),FLBuilder._toggleSettingsTabErrors(),i&&!e(".fl-builder-alert-lightbox:visible").length&&FLBuilder.alert(FLBuilderStrings.settingsHaveErrors)),d},_refreshSettingsPreviewReference:function(){FLBuilder.preview&&FLBuilder.preview._initElementsAndClasses()},_openNestedSettings:function(t){t.className&&-1===t.className.indexOf("fl-builder-settings-lightbox")&&(t.className+=" fl-builder-settings-lightbox"),t=e.extend({className:"fl-builder-lightbox fl-builder-settings-lightbox",destroyOnClose:!0,resizable:!0},t);var i=e(".fl-lightbox-wrap:visible"),l=i.find(".fl-lightbox"),s=new FLLightbox(t),o=s._node,n=o.find(".fl-lightbox");return i.hide(),o.attr("data-parent",i.attr("data-instance-id")),n.attr("style",l.attr("style")),s.on("resized",FLBuilder._calculateSettingsTabsOverflow),s.open('<div class="fl-builder-lightbox-loading"></div>'),s},_closeNestedSettings:function(){var t=e(".fl-builder-lightbox[data-parent]:visible"),i=t.find(".fl-lightbox"),l=t.attr("data-instance-id"),s=FLLightbox._instances[l],o=t.attr("data-parent"),n=e('[data-instance-id="'+o+'"]'),r=n.find(".fl-lightbox"),a=n.find("form"),d=FLLightbox._instances[o];s.on("close",function(){r.attr("style",i.attr("style")),n.show(),d._resize(),n.find("label.error").remove(),a.validate().hideErrors(),FLBuilder._toggleSettingsTabErrors()}),s.close()},_showHelpTooltip:function(){e(this).siblings(".fl-help-tooltip-text").fadeIn()},_hideHelpTooltip:function(){e(this).siblings(".fl-help-tooltip-text").fadeOut()},_initAutoSuggestFields:function(){var t=e(".fl-builder-settings:visible .fl-suggest-field"),i=null,l=null,s=null,o=[];t.each(function(){i=e(this),""!==i.attr("data-value")&&(FLBuilderSettingsForms.showFieldLoader(i),o.push({name:i.attr("name"),value:i.attr("data-value"),action:i.attr("data-action"),data:i.attr("data-action-data")}))}),o.length?FLBuilder.ajax({action:"get_autosuggest_values",fields:o},function(i){l=JSON.parse(i);for(s in l)e('.fl-suggest-field[name="'+s+'"]').attr("data-value",l[s]);t.each(FLBuilder._initAutoSuggestField)}):t.each(FLBuilder._initAutoSuggestField)},_initAutoSuggestField:function(){var t=e(this);t.autoSuggest(FLBuilder._ajaxUrl({fl_action:"fl_builder_autosuggest",fl_as_action:t.data("action"),fl_as_action_data:t.data("action-data"),_wpnonce:FLBuilderConfig.ajaxNonce}),e.extend({},{asHtmlID:t.attr("name"),selectedItemProp:"name",searchObjProps:"name",minChars:3,keyDelay:1e3,fadeOut:!1,usePlaceholder:!0,emptyText:FLBuilderStrings.noResultsFound,showResultListWhenNoMatch:!0,preFill:t.data("value"),queryParam:"fl_as_query",afterSelectionAdd:FLBuilder._updateAutoSuggestField,afterSelectionRemove:FLBuilder._updateAutoSuggestField,selectionLimit:t.data("limit")},t.data("args"))),FLBuilderSettingsForms.hideFieldLoader(t)},_updateAutoSuggestField:function(t,i,l){e(this).siblings(".as-values").val(l.join(",")).trigger("change")},_initCodeFields:function(){e(".fl-builder-settings:visible").find(".fl-code-field").each(FLBuilder._initCodeField)},_initCodeField:function(){var t=e(this),i=t.find("textarea"),l=(i.attr("id"),i.data("editor")),s=i.data("wrap"),o=e("<div>",{position:"absolute",height:20*parseInt(i.attr("rows"),10)}),n=null;o.insertBefore(i),i.css("display","none"),ace.require("ace/ext/language_tools"),n=ace.edit(o[0]),n.$blockScrolling=1/0,n.getSession().setValue(i.val()),n.getSession().setMode("ace/mode/"+l),s&&n.getSession().setUseWrapMode(!0),n.setOptions({enableBasicAutocompletion:!0,enableLiveAutocompletion:!0,enableSnippets:!1,showLineNumbers:!1,showFoldWidgets:!1}),n.getSession().on("change",function(e){i.val(n.getSession().getValue()).trigger("change")}),i.closest(".fl-field").data("editor",n)},_initMultipleFields:function(){for(var t=e(".fl-builder-settings:visible .fl-builder-field-multiples"),i=null,l=null,s=0,o=FLBuilderConfig.isRtl?{left:10}:{right:10};s<t.length;s++)i=t.eq(s),l=i.find(".fl-builder-field-multiple"),1===l.length?l.eq(0).find(".fl-builder-field-actions").addClass("fl-builder-field-actions-single"):l.find(".fl-builder-field-actions").removeClass("fl-builder-field-actions-single");e(".fl-builder-field-multiples").sortable({items:".fl-builder-field-multiple",cursor:"move",cursorAt:o,distance:5,opacity:.5,placeholder:"fl-builder-field-dd-zone",stop:FLBuilder._fieldDragStop,tolerance:"pointer",axis:"y"})},_addFieldClicked:function(){var t=e(this),i=t.attr("data-field"),l=t.closest("tr").siblings("tr[data-field="+i+"]").last(),s=l.clone(),o=s.find(".fl-form-field"),n=null,r=parseInt(l.find("label span.fl-builder-field-index").html(),10)+1;s.find("th label span.fl-builder-field-index").html(r),s.find(".fl-form-field-preview-text").html(""),s.find("input, textarea, select").val(""),l.after(s),FLBuilder._initMultipleFields(),o.length&&(n=o.find(".fl-form-field-edit").data("type"),o.find("input").val(JSON.stringify(FLBuilderSettingsConfig.defaults.forms[n])))},_copyFieldClicked:function(){var t=e(this),i=t.closest("tr"),l=i.clone(),s=parseInt(i.find("label span.fl-builder-field-index").html(),10)+1;l.find("th label span.fl-builder-field-index").html(s),i.after(l),FLBuilder._renumberFields(i.parent()),FLBuilder._initMultipleFields(),FLBuilder.preview.delayPreview()},_deleteFieldClicked:function(){var t=e(this).closest("tr"),i=t.parent(),l=confirm(FLBuilderStrings.deleteFieldMessage);l&&(t.remove(),FLBuilder._renumberFields(i),FLBuilder._initMultipleFields(),FLBuilder.preview.delayPreview())},_renumberFields:function(e){for(var t=e.find(".fl-builder-field-multiple"),i=0;i<t.length;i++)t.eq(i).find("th label span.fl-builder-field-index").html(i+1)},_fieldDragHelper:function(){return e('<div class="fl-builder-field-dd-helper"></div>')},_fieldDragStop:function(e,t){FLBuilder._renumberFields(t.item.parent()),FLBuilder.preview.delayPreview()},_initSelectFields:function(){e(".fl-builder-settings:visible").find(".fl-builder-settings-fields select").trigger("change")},_settingsSelectChanged:function(){var t=e(this),i=t.attr("data-toggle"),l=t.attr("data-hide"),s=t.attr("data-trigger"),o=t.val(),n=0;if("undefined"!=typeof i){i=JSON.parse(i);for(n in i)FLBuilder._settingsSelectToggle(i[n].fields,"hide","#fl-field-"),FLBuilder._settingsSelectToggle(i[n].sections,"hide","#fl-builder-settings-section-"),FLBuilder._settingsSelectToggle(i[n].tabs,"hide","a[href*=fl-builder-settings-tab-","]");"undefined"!=typeof i[o]&&(FLBuilder._settingsSelectToggle(i[o].fields,"show","#fl-field-"),FLBuilder._settingsSelectToggle(i[o].sections,"show","#fl-builder-settings-section-"),FLBuilder._settingsSelectToggle(i[o].tabs,"show","a[href*=fl-builder-settings-tab-","]"))}if("undefined"!=typeof l&&(l=JSON.parse(l),"undefined"!=typeof l[o]&&(FLBuilder._settingsSelectToggle(l[o].fields,"hide","#fl-field-"),FLBuilder._settingsSelectToggle(l[o].sections,"hide","#fl-builder-settings-section-"),FLBuilder._settingsSelectToggle(l[o].tabs,"hide","a[href*=fl-builder-settings-tab-","]"))),"undefined"!=typeof s&&(s=JSON.parse(s),"undefined"!=typeof s[o]&&"undefined"!=typeof s[o].fields))for(n=0;n<s[o].fields.length;n++)e("#fl-field-"+s[o].fields[n]).find("select").trigger("change");FLBuilder._calculateSettingsTabsOverflow()},_settingsSelectToggle:function(t,i,l,s){var o=0;if(s="undefined"==typeof s?"":s,"undefined"!=typeof t)for(;o<t.length;o++)e(".fl-builder-settings:visible").find(l+t[o]+s)[i](),e(l+t[o]+s).parent().find('.fl-field[data-type="code"]').each(function(){e(this).data("editor").resize()})},_initColorPickers:function(){var t=FLBuilderConfig.colorPresets?FLBuilderConfig.colorPresets:[];FLBuilder.colorPicker=new FLBuilderColorPicker({mode:"hsv",elements:".fl-color-picker .fl-color-picker-value",presets:t,labels:{colorPresets:FLBuilderStrings.colorPresets,colorPicker:FLBuilderStrings.colorPicker,placeholder:FLBuilderStrings.placeholder,removePresetConfirm:FLBuilderStrings.removePresetConfirm,noneColorSelected:FLBuilderStrings.noneColorSelected,alreadySaved:FLBuilderStrings.alreadySaved,noPresets:FLBuilderStrings.noPresets,presetAdded:FLBuilderStrings.presetAdded}}),e(FLBuilder.colorPicker).on("presetRemoved presetAdded",function(e,t){FLBuilder.ajax({action:"save_color_presets",presets:t.presets})})},_initSinglePhotoSelector:function(){null===FLBuilder._singlePhotoSelector&&(FLBuilder._singlePhotoSelector=wp.media({title:FLBuilderStrings.selectPhoto,button:{text:FLBuilderStrings.selectPhoto},library:{type:"image"},multiple:!1}),FLBuilder._singlePhotoSelector.on("open",FLBuilder._wpmedia_reset_errors),_wpPluploadSettings.defaults.multipart_params.fl_upload_type="photo")},_selectSinglePhoto:function(){FLBuilder._initSinglePhotoSelector(),FLBuilder._singlePhotoSelector.once("open",e.proxy(FLBuilder._singlePhotoOpened,this)),FLBuilder._singlePhotoSelector.once("select",e.proxy(FLBuilder._singlePhotoSelected,this)),FLBuilder._singlePhotoSelector.open()},_singlePhotoOpened:function(){var t=FLBuilder._singlePhotoSelector.state().get("selection"),i=e(this).closest(".fl-photo-field"),l=i.find("input[type=hidden]"),s=l.val(),o=null;e(this).hasClass("fl-photo-replace")?(t.reset(),i.addClass("fl-photo-empty"),l.val("")):""!==s?(o=wp.media.attachment(s),o.fetch(),t.add(o?[o]:[])):t.reset()},_singlePhotoSelected:function(){var t=FLBuilder._singlePhotoSelector.state().get("selection").first().toJSON(),i=e(this).closest(".fl-photo-field"),l=i.find("input[type=hidden]"),s=i.find(".fl-photo-preview img"),o=i.find("select");l.val(t.id),s.attr("src",FLBuilder._getPhotoSrc(t)),i.removeClass("fl-photo-empty").removeClass("fl-photo-no-attachment"),i.find("label.error").remove(),o.show(),o.html(FLBuilder._getPhotoSizeOptions(t)),o.trigger("change"),FLBuilderSettingsConfig.attachments[t.id]=t},_singlePhotoRemoved:function(){FLBuilder._initSinglePhotoSelector();var t=FLBuilder._singlePhotoSelector.state(),i="undefined"!=typeof t?t.get("selection"):null,l=e(this).closest(".fl-photo-field"),s=l.find("input[type=hidden]"),o=l.find("select");i&&i.reset(),l.addClass("fl-photo-empty"),s.val(""),o.html('<option value="" selected></option>'),o.trigger("change")},_getPhotoSrc:function(e){return"undefined"==typeof e.sizes?e.url:"undefined"!=typeof e.sizes.thumbnail?e.sizes.thumbnail.url:e.sizes.full.url},_getPhotoSizeOptions:function(e,t){var i="",l=null,s=null,o="",n={full:FLBuilderStrings.fullSize,large:FLBuilderStrings.large,medium:FLBuilderStrings.medium,thumbnail:FLBuilderStrings.thumbnail};if("undefined"==typeof e.sizes||0===e.sizes.length)i+='<option value="'+e.url+'">'+FLBuilderStrings.fullSize+"</option>";else{t&&(t=t.replace(/https?/,""));for(l in e.sizes)o="undefined"!=typeof n[l]?n[l]+" - ":"undefined"!=typeof FLBuilderConfig.customImageSizeTitles[l]?FLBuilderConfig.customImageSizeTitles[l]+" - ":"",s="",t?t===e.sizes[l].url.replace(/https?/,"")&&(s=' selected="selected"'):s="full"==l?' selected="selected"':"",i+='<option value="'+e.sizes[l].url+'"'+s+">"+o+e.sizes[l].width+" x "+e.sizes[l].height+"</option>"}return i},_selectMultiplePhotos:function(){var t=e(this).closest(".fl-multiple-photos-field"),i=t.find("input[type=hidden]"),l=i.val(),s=""===l?"":JSON.parse(l),o=wp.media.gallery.defaults.id,n='[gallery ids="-1"]',r=null,a=null,d=null,u=null,c=[];if("object"==typeof s){for(u in s)c.push(s[u]);n='[gallery ids="'+c.join()+'"]'}r=wp.shortcode.next("gallery",n).shortcode,_.isUndefined(r.get("id"))&&!_.isUndefined(o)&&r.set("id",o),a=wp.media.gallery.attachments(r),d=new wp.media.model.Selection(a.models,{props:a.props.toJSON(),multiple:!0}),d.gallery=a.gallery,d.more().done(function(){d.length||FLBuilder._multiplePhotoSelector.setState("gallery-library"),
|
5 |
d.props.set({query:!1}),d.unmirror(),d.props.unset("orderby")}),FLBuilder._multiplePhotoSelector&&FLBuilder._multiplePhotoSelector.dispose(),FLBuilder._multiplePhotoSelector=wp.media({frame:"post",state:e(this).hasClass("fl-multiple-photos-edit")?"gallery-edit":"gallery-library",title:wp.media.view.l10n.editGalleryTitle,editing:!0,multiple:!0,selection:d}).open(),e(FLBuilder._multiplePhotoSelector.views.view.el).addClass("fl-multiple-photos-lightbox"),FLBuilder._multiplePhotoSelector.once("update",e.proxy(FLBuilder._multiplePhotosSelected,this))},_multiplePhotosSelected:function(t){for(var i=e(this).closest(".fl-multiple-photos-field"),l=i.find("input[type=hidden]"),s=i.find(".fl-multiple-photos-count"),o=[],n=0;n<t.models.length;n++)o.push(t.models[n].id);1==o.length?s.html("1 "+FLBuilderStrings.photoSelected):s.html(o.length+" "+FLBuilderStrings.photosSelected),i.removeClass("fl-multiple-photos-empty"),i.find("label.error").remove(),l.val(JSON.stringify(o)).trigger("change")},_selectSingleVideo:function(){null===FLBuilder._singleVideoSelector&&(FLBuilder._singleVideoSelector=wp.media({title:FLBuilderStrings.selectVideo,button:{text:FLBuilderStrings.selectVideo},library:{type:"video"},multiple:!1}),FLBuilder._singleVideoSelector.on("open",FLBuilder._wpmedia_reset_errors),_wpPluploadSettings.defaults.multipart_params.fl_upload_type="video"),FLBuilder._singleVideoSelector.once("select",e.proxy(FLBuilder._singleVideoSelected,this)),FLBuilder._singleVideoSelector.open()},_singleVideoSelected:function(){var t=FLBuilder._singleVideoSelector.state().get("selection").first().toJSON(),i=e(this).closest(".fl-video-field"),l=i.find(".fl-video-preview-img"),s=i.find(".fl-video-preview-filename"),o=i.find("input[type=hidden]");l.html('<span class="dashicons dashicons-media-video"></span>'),s.html(t.filename),i.removeClass("fl-video-empty"),i.find("label.error").remove(),o.val(t.id).trigger("change"),FLBuilderSettingsConfig.attachments[t.id]=t},_selectMultipleAudios:function(){var t=e(this).closest(".fl-multiple-audios-field"),i=t.find("input[type=hidden]"),l=i.val(),s=""==l?'[playlist ids="-1"]':'[playlist ids="'+JSON.parse(l).join()+'"]',o=wp.shortcode.next("playlist",s).shortcode,n=wp.media.playlist.defaults.id,r=null,a=null;_.isUndefined(o.get("id"))&&!_.isUndefined(n)&&o.set("id",n),r=wp.media.playlist.attachments(o),a=new wp.media.model.Selection(r.models,{props:r.props.toJSON(),multiple:!0}),a.playlist=r.playlist,a.more().done(function(){a.props.set({query:!1}),a.unmirror(),a.props.unset("orderby")}),FLBuilder._multipleAudiosSelector&&FLBuilder._multipleAudiosSelector.dispose(),FLBuilder._multipleAudiosSelector=wp.media({frame:"post",state:e(this).hasClass("fl-multiple-audios-edit")?"playlist-edit":"playlist-library",title:wp.media.view.l10n.editPlaylistTitle,editing:!0,multiple:!0,selection:a}).open(),FLBuilder._multipleAudiosSelector.content.get("view").sidebar.unset("playlist"),FLBuilder._multipleAudiosSelector.on("content:render:browse",function(e){e&&e.sidebar.on("ready",function(){e.sidebar.unset("playlist")})}),FLBuilder._multipleAudiosSelector.once("update",e.proxy(FLBuilder._multipleAudiosSelected,this))},_multipleAudiosSelected:function(t){for(var i=e(this).closest(".fl-multiple-audios-field"),l=i.find(".fl-multiple-audios-count"),s=i.find("input[type=hidden]"),o=[],n=0;n<t.models.length;n++)o.push(t.models[n].id);1==o.length?l.html("1 "+FLBuilderStrings.audioSelected):l.html(o.length+" "+FLBuilderStrings.audiosSelected),s.val(JSON.stringify(o)).trigger("change"),i.removeClass("fl-multiple-audios-empty"),i.find("label.error").remove()},_selectIcon:function(){var e=this;FLIconSelector.open(function(t){FLBuilder._iconSelected.apply(e,[t])})},_iconSelected:function(t){var i=e(this).closest(".fl-icon-field"),l=i.find("input[type=hidden]"),s=i.find("i"),o=s.attr("data-icon");l.val(t).trigger("change"),s.removeClass(o),s.addClass(t),s.attr("data-icon",t),i.removeClass("fl-icon-empty"),i.find("label.error").remove()},_removeIcon:function(){var t=e(this).closest(".fl-icon-field"),i=t.find("input[type=hidden]"),l=t.find("i");i.val("").trigger("change"),l.removeClass(),l.attr("data-icon",""),t.addClass("fl-icon-empty")},_formFieldClicked:function(){var t=e(this),i=t.closest(".fl-builder-settings"),l=t.attr("data-type"),s=t.siblings("input").val(),o=FLBuilder._moduleHelpers[l],n=(FLBuilderSettingsConfig.forms[l],FLBuilder._openNestedSettings({className:"fl-builder-lightbox fl-form-field-settings"}));""===s&&(s=JSON.stringify(FLBuilderSettingsConfig.forms[l])),FLBuilderSettingsForms.render({id:l,nodeId:i.attr("data-node"),nodeSettings:FLBuilder._getSettings(i),settings:JSON.parse(s.replace(/'/g,"'")),lightbox:n,helper:o,rules:o?o.rules:null},function(){t.attr("id","fl-"+n._node.attr("data-instance-id")),n._node.find("form.fl-builder-settings").attr("data-type",l)})},_saveFormFieldClicked:function(){var t=e(this).closest(".fl-builder-settings"),i=e(this).closest(".fl-lightbox-wrap").attr("data-instance-id"),l=t.attr("data-type"),s=FLBuilder._getSettings(t),o={},n=FLBuilder._moduleHelpers[l],r=e(".fl-builder-settings #fl-"+i),a=r.parent().attr("data-preview-text"),d=t.find("#fl-field-"+a),u=s[a],c=e('select[name="'+a+'"]'),h=document.createElement("div"),f=!0;return c.length>0&&(u=c.find('option[value="'+s[a]+'"]').text()),"undefined"!=typeof n&&(t.find("label.error").remove(),t.validate().hideErrors(),f=t.validate().form(),f&&(f=n.submit())),f?("undefined"!=typeof a&&"undefined"!=typeof u&&("icon"===d.data("type")?u='<i class="'+u+'"></i>':u.length>35&&(h.innerHTML=u,u=(h.textContent||h.innerText||"").replace(/^(.{35}[^\s]*).*/,"$1")+"..."),r.siblings(".fl-form-field-preview-text").html(u)),o=r.siblings("input").val().replace(/'/g,"'"),""!=o&&(s=e.extend(JSON.parse(o),s)),r.siblings("input").val(JSON.stringify(s)).trigger("change"),FLBuilder._closeNestedSettings(),!0):(FLBuilder._toggleSettingsTabErrors(),!1)},_layoutFieldClicked:function(){var t=e(this);t.siblings().removeClass("fl-layout-field-option-selected"),t.addClass("fl-layout-field-option-selected"),t.siblings("input").val(t.attr("data-value"))},_initLinkFields:function(){e(".fl-builder-settings:visible .fl-link-field").each(FLBuilder._initLinkField)},_initLinkField:function(){var t=e(this),i=t.find(".fl-link-field-search-input");i.autoSuggest(FLBuilder._ajaxUrl({fl_action:"fl_builder_autosuggest",fl_as_action:"fl_as_links",_wpnonce:FLBuilderConfig.ajaxNonce}),{asHtmlID:i.attr("name"),selectedItemProp:"name",searchObjProps:"name",minChars:3,keyDelay:1e3,fadeOut:!1,usePlaceholder:!0,emptyText:FLBuilderStrings.noResultsFound,showResultListWhenNoMatch:!0,queryParam:"fl_as_query",selectionLimit:1,afterSelectionAdd:FLBuilder._updateLinkField})},_updateLinkField:function(e,t,i){var l=e.closest(".fl-link-field"),s=l.find(".fl-link-field-search"),o=l.find(".fl-link-field-search-input"),n=l.find(".fl-link-field-input");n.val(t.value).trigger("keyup"),o.autoSuggest("remove",t.value),s.hide()},_linkFieldSelectClicked:function(){var t=e(this).closest(".fl-link-field").find(".fl-link-field-search");t.show(),t.find("input").focus()},_linkFieldSelectCancelClicked:function(){var t=e(this);t.parent().hide(),t.closest(".fl-link-field").find("input.fl-link-field-input").focus()},_initFontFields:function(){e(".fl-builder-settings:visible .fl-font-field").each(FLBuilder._initFontField)},_initFontField:function(){var t=e(this),i=t.attr("data-value"),l=t.find(".fl-font-field-font"),s=t.find(".fl-font-field-weight");l.on("change",function(){FLBuilder._getFontWeights(l)}),i.indexOf("family")>-1&&(i=JSON.parse(i),l.val(i.family),l.trigger("change"),s.find("option[value="+i.weight+"]").length&&s.val(i.weight))},_getFontWeights:function(t){var i=t.next(".fl-font-field-weight"),l=t.val(),s={"default":"Default",regular:"Regular",100:"Thin 100",200:"Extra-Light 200",300:"Light 300",400:"Normal 400",500:"Medium 500",600:"Semi-Bold 600",700:"Bold 700",800:"Extra-Bold 800",900:"Ultra-Bold 900"},o={};i.html(""),o="undefined"!=typeof FLBuilderFontFamilies.system[l]?FLBuilderFontFamilies.system[l].weights:"undefined"!=typeof FLBuilderFontFamilies.google[l]?FLBuilderFontFamilies.google[l]:FLBuilderFontFamilies["default"][l],e.each(o,function(e,t){i.append('<option value="'+t+'">'+s[t]+"</option>")})},_initTinyMCE:function(){tinymce.ui.FloatPanel.zIndex=100100,e(".fl-builder-hidden-editor").each(FLBuilder._initEditorField)},_initEditorFields:function(){e(".fl-builder-settings:visible .fl-editor-field").each(FLBuilder._initEditorField)},_initEditorField:function(){var t=e(this),i=t.find("textarea"),l=t.attr("data-name"),s="flrich"+(new Date).getTime()+"_"+l,o=FLBuilderConfig.wp_editor,n=tinyMCEPreInit,r=Number(t.attr("data-buttons")),a=t.attr("data-rows"),d=null,u=null;o=o.replace(/flbuildereditor/g,s),n=JSON.parse(JSON.stringify(n).replace(/flbuildereditor/g,s)),i.after(o).remove(),e("textarea#"+s).val(i.val()),void 0!==typeof tinymce&&void 0!==n.mceInit[s]&&(d=n.mceInit[s],u=tinymce.$("#wp-"+s+"-wrap"),u.find("textarea").attr("rows",a),r||u.find(".wp-media-buttons").remove(),!u.hasClass("tmce-active")&&n.qtInit.hasOwnProperty(s)||d.wp_skip_init||tinymce.init(d)),void 0!==typeof quicktags&&quicktags(n.qtInit[s]),window.wpActiveEditor=s},_reinitEditorFields:function(){e(".fl-lightbox-resizable:visible").length&&setTimeout(function(){var t,i;if("undefined"!=typeof tinymce){for(t=tinymce.editors.length-1;t>-1;t--)i=tinymce.editors[t].id,tinyMCE.execCommand("mceRemoveEditor",!0,i),tinyMCE.execCommand("mceAddEditor",!0,i);FLBuilder.preview&&FLBuilder.preview._initDefaultFieldPreviews(e('.fl-field[data-type="editor"]'))}},1)},_destroyEditorFields:function(){var t;if("undefined"!=typeof tinymce){for(t=tinymce.editors.length-1;t>-1;t--)tinyMCE.execCommand("mceRemoveEditor",!0,tinymce.editors[t].id);e(".wplink-autocomplete").remove(),e(".ui-helper-hidden-accessible").remove()}},_updateEditorFields:function(){var t=e(".fl-builder-settings:visible textarea.wp-editor-area");t.each(FLBuilder._updateEditorField)},_updateEditorField:function(){var t=e(this),i=t.closest(".fl-editor-field"),l=(t.closest(".fl-builder-settings"),t.closest(".wp-editor-wrap")),s=t.attr("id"),o=i.attr("data-name"),n="undefined"!=typeof tinyMCE&&tinyMCE.get(s),r=t.siblings('textarea[name="'+o+'"]'),a=i.data("wpautop");0===r.length&&(r=e('<textarea name="'+o+'"></textarea>').hide(),t.after(r)),a?n&&l.hasClass("tmce-active")?r.val(n.getContent()):"undefined"!=typeof switchEditors?r.val(switchEditors.wpautop(t.val())):r.val(t.val()):(n&&l.hasClass("tmce-active")&&n.save(),r.val(t.val()))},_loopDataSourceChange:function(){var t=e(this).val();e(".fl-loop-data-source").hide(),e('.fl-loop-data-source[data-source="'+t+'"]').show()},_customQueryPostTypeChange:function(){var t=e(this).val();e(".fl-custom-query-filter").hide(),e(".fl-custom-query-"+t+"-filter").show()},_initOrderingFields:function(){e(".fl-builder-settings:visible .fl-ordering-field-options").each(FLBuilder._initOrderingField)},_initOrderingField:function(){e(this).sortable({items:".fl-ordering-field-option",containment:"parent",tolerance:"pointer",stop:FLBuilder._updateOrderingField})},_updateOrderingField:function(t){var i=e(t.target),l=i.siblings("input[type=hidden]"),s=[];i.find(".fl-ordering-field-option").each(function(){s.push(e(this).attr("data-key"))}),l.val(JSON.stringify(s)).trigger("change")},_onNumberFieldFocus:function(t){var i=e(t.currentTarget);i.addClass("mousetrap"),Mousetrap.bind("up",function(){i.attr("step",1)}),Mousetrap.bind("down",function(){i.attr("step",1)}),Mousetrap.bind("shift+up",function(){i.attr("step",10)}),Mousetrap.bind("shift+down",function(){i.attr("step",10)})},_onNumberFieldBlur:function(t){var i=e(t.currentTarget);i.attr("step",1).removeClass("mousetrap")},_initTimezoneFields:function(){e(".fl-builder-settings:visible .fl-field[data-type=timezone]").each(FLBuilder._initTimezoneField)},_initTimezoneField:function(){var t=e(this).find("select"),i=t.attr("data-value");t.find('option[value="'+i+'"]').attr("selected","selected")},ajax:function(t,i){var l;FLBuilder.triggerHook("didBeginAJAX",t);for(l in t)"undefined"==typeof t[l]&&(t[l]=null);return t._wpnonce=FLBuilderConfig.ajaxNonce,t.post_id=FLBuilderConfig.postId,t.fl_builder=1,t.fl_action=t.action,"undefined"!=typeof t.settings&&(t.settings=FLBuilder._ajaxModSecFix(e.extend(!0,{},t.settings))),"undefined"!=typeof t.node_settings&&(t.node_settings=FLBuilder._ajaxModSecFix(e.extend(!0,{},t.node_settings))),t={fl_builder_data:t},e.post(FLBuilder._ajaxUrl(),t,function(e){FLBuilder._ajaxComplete(),"undefined"!=typeof i&&i.call(this,e),FLBuilder.triggerHook("didCompleteAJAX",t)})},_ajaxComplete:function(){FLBuilder.hideAjaxLoader()},_ajaxUrl:function(e){var t=window.location.href.split("#").shift(),i=null;if("undefined"!=typeof e)for(i in e)t+=t.indexOf("?")>-1?"&":"?",t+=i+"="+e[i];return t},showAjaxLoader:function(){0===e(".fl-builder-lightbox-loading").length&&e(".fl-builder-loading").show()},hideAjaxLoader:function(){e(".fl-builder-loading").hide()},_showNodeLoading:function(t){var i=e(".fl-node-"+t);i.addClass("fl-builder-node-loading")},_hideNodeLoading:function(t){var i=e(".fl-node-"+t);i.removeClass("fl-builder-node-loading")},_showNodeLoadingPlaceholder:function(t,i){var l=e('<div class="fl-builder-node-loading-placeholder"></div>');t.hasClass("fl-builder-content")?siblings=t.find(".fl-row"):t.hasClass("fl-row-content")?siblings=t.find(" > .fl-col-group"):t.hasClass("fl-col-group")?(t.addClass("fl-col-group-has-child-loading"),siblings=t.find(" > .fl-col")):siblings=t.find(" > .fl-col-group, > .fl-module"),0===siblings.length||siblings.length==i?t.append(l):siblings.eq(i).before(l)},_removeNodeLoadingPlaceholder:function(e){var t=e.prev(".fl-builder-node-loading-placeholder"),i=e.next(".fl-builder-node-loading-placeholder");t.length?t.remove():i.remove()},_ajaxModSecFix:function(e){var t;if(FLBuilderConfig.modSecFix&&"undefined"!=typeof btoa)if("string"==typeof e)e=FLBuilder._btoa(e);else for(t in e)"string"==typeof e[t]?e[t]=FLBuilder._btoa(e[t]):"object"==typeof e[t]&&(e[t]=FLBuilder._ajaxModSecFix(e[t]));return e},_btoa:function(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,function(e,t){return String.fromCharCode("0x"+t)}))},_wpmedia_reset_errors:function(){e(".upload-error").remove(),e(".media-uploader-status").removeClass("errors").hide()},_initLightboxes:function(){FLBuilder._lightbox=new FLLightbox({className:"fl-builder-lightbox fl-builder-settings-lightbox",resizable:!0}),FLBuilder._lightbox.on("resized",FLBuilder._calculateSettingsTabsOverflow),FLBuilder._lightbox.on("close",FLBuilder._lightboxClosed),FLBuilder._lightbox.on("beforeCloseLightbox",FLBuilder._destroyEditorFields),FLBuilder._actionsLightbox=new FLLightbox({className:"fl-builder-actions-lightbox"})},_showLightbox:function(){FLBuilder._lightbox.open('<div class="fl-builder-lightbox-loading"></div>'),FLBuilder._removeAllOverlays(),FLBuilder._initLightboxScrollbars()},_setLightboxContent:function(e){FLBuilder._lightbox.setContent(e)},_initLightboxScrollbars:function(){FLBuilder._initScrollbars(),FLBuilder._lightboxScrollbarTimeout=setTimeout(FLBuilder._initLightboxScrollbars,500)},_lightboxClosed:function(){FLBuilder.triggerHook("settings-lightbox-closed"),FLBuilder._lightbox.empty(),clearTimeout(FLBuilder._lightboxScrollbarTimeout)},_showActionsLightbox:function(e){var t=wp.template("fl-actions-lightbox");FLBuilder.triggerHook("actions-lightbox-settings",e),FLBuilder._actionsLightbox.open(t(e))},alert:function(e){var t=new FLLightbox({className:"fl-builder-alert-lightbox",destroyOnClose:!0}),i=wp.template("fl-alert-lightbox");t.open(i({message:e}))},_alertClose:function(){FLLightbox.closeParent(this)},confirm:function(t){var i={message:"",ok:function(){},cancel:function(){},strings:{ok:FLBuilderStrings.ok,cancel:FLBuilderStrings.cancel}},l=e.extend({},i,"undefined"==typeof t?{}:t);lightbox=new FLLightbox({className:"fl-builder-confirm-lightbox fl-builder-alert-lightbox",destroyOnClose:!0}),template=wp.template("fl-confirm-lightbox"),lightbox.open(template(l)),lightbox._node.find(".fl-builder-confirm-ok").on("click",l.ok),lightbox._node.find(".fl-builder-confirm-cancel").on("click",l.cancel)},triggerHook:function(t,i){e("body").trigger("fl-builder."+t,i)},addHook:function(t,i){e("body").on("fl-builder."+t,i)},removeHook:function(t,i){e("body").off("fl-builder."+t,i)},log:function(e){"undefined"!=typeof window.console&&"undefined"!=typeof window.console.log&&console.log(e)},logError:function(e){var t=null;"undefined"!=typeof e&&("undefined"!=typeof e.stack?t=e.stack:"undefined"!=typeof e.message&&(t=e.message),t&&(FLBuilder.log("************************************************************************"),FLBuilder.log(FLBuilderStrings.errorMessage),FLBuilder.log(t),FLBuilder.log("************************************************************************")))},logGlobalError:function(e,t,i,l,s){FLBuilder.log("************************************************************************"),FLBuilder.log(FLBuilderStrings.errorMessage),FLBuilder.log(FLBuilderStrings.globalErrorMessage.replace("{message}",e).replace("{line}",i).replace("{file}",t)),"undefined"!=typeof s&&"undefined"!=typeof s.stack&&(FLBuilder.log(s.stack),FLBuilder.log("************************************************************************"))}},e(function(){FLBuilder._init()})}(jQuery),function(e){FLBuilderAJAXLayout=function(t,i){this._data=e.extend({},this._defaults,"string"==typeof t?JSON.parse(t):t),this._callback=i,this._post=FLBuilderConfig.postId,this._head=e("head").eq(0),this._body=e("body").eq(0),this._data.css&&(this._loader=e('<img src="'+this._data.css+'" />'),this._oldCss=e('link[href*="/cache/'+this._post+'"]'),this._newCss=e('<link rel="stylesheet" id="fl-builder-layout-'+this._post+'-css" href="'+this._data.css+'" />')),this._data.partial?(this._data.js&&(this._oldJs=e("#fl-builder-partial-refresh-js"),this._newJs=e('<script type="text/javascript" id="fl-builder-partial-refresh-js">'+this._data.js+"</script>")),this._data.nodeId&&(this._data.oldNodeId?(this._oldScriptsStyles=e('.fl-builder-node-scripts-styles[data-node="'+this._data.oldNodeId+'"]'),this._content=e(".fl-node-"+this._data.oldNodeId)):(this._oldScriptsStyles=e('.fl-builder-node-scripts-styles[data-node="'+this._data.nodeId+'"]'),this._content=e(".fl-node-"+this._data.nodeId).eq(0)))):(this._oldJs=e('script[src*="/cache/'+this._post+'"]'),this._newJs=e('<script src="'+this._data.js+'"></script>'),this._oldScriptsStyles=e(".fl-builder-layout-scripts-styles"),this._content=e(FLBuilder._contentClass)),this._init()},FLBuilderAJAXLayout.prototype={_defaults:{partial:!1,nodeId:null,nodeType:null,nodeParent:null,nodePosition:null,oldNodeId:null,html:null,scriptsStyles:null,css:null,js:null},_data:null,_callback:function(){},_post:null,_head:null,_body:null,_loader:null,_oldCss:null,_newCss:null,_oldJs:null,_newJs:null,_oldScriptsStyles:null,_content:null,_init:function(){this._body.height(this._body.height()),this._loader?(this._loader.on("error",e.proxy(this._loadNewCSSComplete,this)),this._body.append(this._loader)):this._finish()},_loadNewCSSComplete:function(){this._loader.remove(),this._oldCss.length>0?this._oldCss.after(this._newCss):this._head.append(this._newCss),setTimeout(e.proxy(this._finish,this),250)},_finish:function(){this._removeOldContentAndAssets(),this._cleanNewHTML(),this._cleanNewAssets(),this._addNewHTML(),this._addNewScriptsStyles(),this._addNewJS(),e(FLBuilder._contentClass).trigger("fl-builder.layout-rendered"),FLBuilder.hideAjaxLoader(),"undefined"!=typeof this._callback&&this._callback(),FLBuilder.triggerHook("didRenderLayoutComplete")},_removeOldContentAndAssets:function(){this._content&&this._content.empty(),this._oldCss&&this._oldCss.remove(),this._oldJs&&this._oldJs.remove(),this._oldScriptsStyles&&this._oldScriptsStyles.remove()},_cleanNewHTML:function(){if(this._data.scriptsStyles){var t=e("<div>"+this._data.html+"</div>"),i="fl-row",l=this._data.scriptsStyles,s="";this._data.partial&&(i="column-group"==this._data.nodeType?"fl-col-group":"column"==this._data.nodeType?"fl-col":"fl-"+this._data.nodeType),t.find("> *, script").each(function(){e(this).hasClass(i)||(s=e(this).remove(),l+=s[0].outerHTML)}),""!==l&&(l=this._data.partial?'<div class="fl-builder-node-scripts-styles" data-node="'+this._data.nodeId+'">'+l+"<div>":'<div class="fl-builder-node-scripts-styles">'+l+"<div>"),this._data.html=t.html(),this._data.scriptsStyles=l}},_addNewHTML:function(){var t;this._data.partial?this._data.nodeParent?(t=this._data.nodeParent.hasClass("fl-builder-content")?this._data.nodeParent.find(".fl-row"):this._data.nodeParent.hasClass("fl-row-content")?this._data.nodeParent.find(" > .fl-col-group"):this._data.nodeParent.hasClass("fl-col-group")?this._data.nodeParent.find(" > .fl-col"):this._data.nodeParent.find(" > .fl-col-group, > .fl-module"),t=t.filter(":not(.fl-builder-node-clone)"),0===t.length||t.length==this._data.nodePosition?this._data.nodeParent.append(this._data.html):t.eq(this._data.nodePosition).before(this._data.html),this._data.nodeId&&FLBuilder._removeNodeLoadingPlaceholder(e(".fl-node-"+this._data.nodeId))):(this._content.after(this._data.html),this._content.remove()):this._content.append(this._data.html),FLBuilder.preview&&this._data.nodeId&&this._data.nodeId!=FLBuilder.preview.nodeId&&e(FLBuilder.preview.classes.node).length&&e(FLBuilder.preview.classes.node).html(FLBuilder.preview.elements.node.html())},_cleanNewAssets:function(){var t=this;this._data.html=this._removeDuplicateAssets(this._data.html),this._data.scriptsStyles&&""!==this._data.scriptsStyles&&(this._data.scriptsStyles=this._removeDuplicateAssets(this._data.scriptsStyles)),this._data.partial?e(".fl-builder-node-scripts-styles").each(function(){t._data.html.indexOf("fl-node-"+e(this).data("node"))>-1&&e(this).remove()}):(e("#fl-builder-partial-refresh-js").remove(),e(".fl-builder-node-scripts-styles").remove())},_removeDuplicateAssets:function(t){var i=e("<div>"+t+"</div>"),l="",s=null,o="",n=null,r=window.location,a=r.protocol+"//"+r.hostname+(r.port?":"+r.port:"");return i.find("script").each(function(){l=e(this).attr("src"),"undefined"!=typeof l&&(l=l.replace(a,""),s=e('script[src*="'+l+'"]'),s.length>0&&e(this).remove())}),i.find("link").each(function(){o=e(this).attr("href"),"undefined"!=typeof o&&(o=o.replace(a,""),n=e('link[href*="'+o+'"]'),n.length>0&&e(this).remove())}),i.html()},_addNewScriptsStyles:function(){this._data.scriptsStyles&&""!==this._data.scriptsStyles&&this._body.append(this._data.scriptsStyles)},_addNewJS:function(){setTimeout(e.proxy(function(){this._newJs&&this._head.append(this._newJs)},this),50)},_complete:function(){FLBuilder._setupEmptyLayout(),FLBuilder._highlightEmptyCols(),FLBuilder._initDropTargets(),FLBuilder._initSortables(),FLBuilder._resizeLayout(),FLBuilder._initMediaElements(),FLBuilderLayout.init(),FLBuilderResponsiveEditing.refreshPreview(),this._body.height("auto")}}}(jQuery),function(e){FLBuilderPreview=function(e){this.type=e.type,this._saveState(),e.layout?FLBuilder._renderLayout(e.layout,function(){this._init(),e.callback&&e.callback()}.bind(this)):this._init()},FLBuilderPreview._fontsList={},FLBuilderPreview.prototype={type:"",nodeId:null,classes:{},elements:{},state:null,_savedSettings:null,_styleSheet:null,_styleSheetMedium:null,_styleSheetResponsive:null,_timeout:null,_loaderTimeout:null,_lastClassName:null,_xhr:null,_init:function(){switch(this.nodeId=e(".fl-builder-settings").data("node"),this._saveSettings(),this._initElementsAndClasses(),this._createSheets(),this._initResponsivePreviews(),this._initDefaultFieldPreviews(),this.type){case"row":this._initRow();break;case"col":this._initColumn();break;case"module":this._initModule()}},_saveSettings:function(){var t=e(".fl-builder-settings-lightbox .fl-builder-settings");this._savedSettings=FLBuilder._getSettings(t)},_settingsHaveChanged:function(){var t=e(".fl-builder-settings-lightbox .fl-builder-settings"),i=FLBuilder._getSettings(t);return JSON.stringify(this._savedSettings)!=JSON.stringify(i)},_initElementsAndClasses:function(){var t;t="row"==this.type?".fl-row-content-wrap":".fl-"+this.type+"-content",e.extend(this.classes,{settings:".fl-builder-"+this.type+"-settings",settingsHeader:".fl-builder-"+this.type+"-settings .fl-lightbox-header",node:FLBuilder._contentClass+" .fl-node-"+this.nodeId,content:FLBuilder._contentClass+" .fl-node-"+this.nodeId+" > "+t}),e.extend(this.elements,{settings:e(this.classes.settings),settingsHeader:e(this.classes.settingsHeader),node:e(this.classes.node),content:e(this.classes.content)})},_createSheets:function(){this._destroySheets(),this._styleSheet||(this._styleSheet=new FLStyleSheet({id:"fl-builder-preview",className:"fl-builder-preview-style"})),this._styleSheetMedium||(this._styleSheetMedium=new FLStyleSheet({id:"fl-builder-preview-medium",className:"fl-builder-preview-style"})),this._styleSheetResponsive||(this._styleSheetResponsive=new FLStyleSheet({id:"fl-builder-preview-responsive",className:"fl-builder-preview-style"}))},_destroySheets:function(){this._styleSheet&&(this._styleSheet.destroy(),this._styleSheet=null),this._styleSheetMedium&&(this._styleSheetMedium.destroy(),this._styleSheetMedium=null),this._styleSheetResponsive&&(this._styleSheetResponsive.destroy(),this._styleSheetResponsive=null)},updateCSSRule:function(e,t,i){this._styleSheet.updateRule(e,t,i)},delay:function(e,t){this._cancelDelay(),this._timeout=setTimeout(t,e)},_cancelDelay:function(){null!==this._timeout&&clearTimeout(this._timeout)},hexToRgb:function(e){var t=parseInt(e,16),i=t>>16&255,l=t>>8&255,s=255&t;return[i,l,s]},parseFloat:function(e){return isNaN(parseFloat(e))?0:parseFloat(e)},_initResponsivePreviews:function(){FLBuilder.addHook("responsive-editing-switched",e.proxy(this._responsiveEditingSwitched,this))},_destroyResponsivePreviews:function(){FLBuilder.removeHook("responsive-editing-switched")},_responsiveEditingSwitched:function(e,t){"default"==t?(this._styleSheetMedium.disable(),this._styleSheetResponsive.disable()):"medium"==t?(this._styleSheetMedium.enable(),this._styleSheetResponsive.disable()):"responsive"==t&&(this._styleSheetMedium.disable(),this._styleSheetResponsive.enable())},updateResponsiveCSSRule:function(e,t,i){var l=FLBuilderResponsiveEditing._mode,s="default"==l?"":l.charAt(0).toUpperCase()+l.slice(1);this["_styleSheet"+s].updateRule(e,t,i)},_saveState:function(){var t=FLBuilderConfig.postId,i=e('link[href*="/cache/'+t+'"]').attr("href"),l=e('script[src*="/cache/'+t+'"]').attr("src"),s=e(FLBuilder._contentClass).html();this.state={css:i,js:l,html:s}},preview:function(){var t=e(".fl-builder-settings-lightbox .fl-builder-settings"),i=t.attr("data-node"),l=FLBuilder._getSettings(t);FLBuilder._showNodeLoading(i),this._cancelPreview(),this._xhr=FLBuilder.ajax({action:"render_layout",node_id:i,node_preview:l},e.proxy(this._renderPreview,this))},delayPreview:function(t){var i="undefined"==typeof t?[]:e(t.target).closest("tr").find("th"),l=e(".fl-builder-widget-settings .fl-builder-settings-title"),s=e(".fl-builder-settings .fl-lightbox-header"),o=FLBuilderLayoutConfig.paths.pluginUrl+"img/ajax-loader-small.svg",n=e('<img class="fl-builder-preview-loader" src="'+o+'" />');this.delay(1e3,e.proxy(this.preview,this)),this._loaderTimeout=setTimeout(function(){e(".fl-builder-preview-loader").remove(),i.length>0?i.append(n):l.length>0?l.append(n):s.length>0&&s.append(n)},1500)},_cancelPreview:function(){this._xhr&&(this._xhr.abort(),this._xhr=null)},_renderPreview:function(t){this._xhr=null,FLBuilder._renderLayout(t,e.proxy(this._renderPreviewComplete,this))},_renderPreviewComplete:function(){this._createSheets(),this._initElementsAndClasses(),null!==this._loaderTimeout&&clearTimeout(this._loaderTimeout),e(".fl-builder-preview-loader").remove(),e(FLBuilder._contentClass).trigger("fl-builder.preview-rendered")},revert:function(){return this._settingsHaveChanged()?void FLBuilder._updateNode(this.nodeId,function(){this.clear()}.bind(this)):void this.clear()},cancel:function(){this._cancelDelay(),this._cancelPreview()},clear:function(){this.cancel(),this._destroySheets(),this._destroyResponsivePreviews()},_initNodeTextColor:function(){e.extend(this.elements,{textColor:e(this.classes.settings+" input[name=text_color]"),linkColor:e(this.classes.settings+" input[name=link_color]"),hoverColor:e(this.classes.settings+" input[name=hover_color]"),headingColor:e(this.classes.settings+" input[name=heading_color]")}),this.elements.textColor.on("change",e.proxy(this._textColorChange,this)),this.elements.linkColor.on("change",e.proxy(this._textColorChange,this)),this.elements.hoverColor.on("change",e.proxy(this._textColorChange,this)),this.elements.headingColor.on("change",e.proxy(this._textColorChange,this))},_textColorChange:function(t){var i=this.elements.textColor.val(),l=this.elements.linkColor.val(),s=this.elements.hoverColor.val(),o=this.elements.headingColor.val();l=""===l?i:l,s=""===s?i:s,o=""===o?i:o,this.delay(100,e.proxy(function(){""===i?this.updateCSSRule(this.classes.node,"color","inherit"):this.updateCSSRule(this.classes.node,"color","#"+i),""===l?this.updateCSSRule(this.classes.node+" a","color","inherit"):this.updateCSSRule(this.classes.node+" a","color","#"+l),""===s?this.updateCSSRule(this.classes.node+" a:hover","color","inherit"):this.updateCSSRule(this.classes.node+" a:hover","color","#"+s),""===o?(this.updateCSSRule(this.classes.node+" h1","color","inherit"),this.updateCSSRule(this.classes.node+" h2","color","inherit"),this.updateCSSRule(this.classes.node+" h3","color","inherit"),this.updateCSSRule(this.classes.node+" h4","color","inherit"),this.updateCSSRule(this.classes.node+" h5","color","inherit"),this.updateCSSRule(this.classes.node+" h6","color","inherit"),this.updateCSSRule(this.classes.node+" h1 a","color","inherit"),this.updateCSSRule(this.classes.node+" h2 a","color","inherit"),this.updateCSSRule(this.classes.node+" h3 a","color","inherit"),this.updateCSSRule(this.classes.node+" h4 a","color","inherit"),this.updateCSSRule(this.classes.node+" h5 a","color","inherit"),this.updateCSSRule(this.classes.node+" h6 a","color","inherit")):(this.updateCSSRule(this.classes.node+" h1","color","#"+o),this.updateCSSRule(this.classes.node+" h2","color","#"+o),this.updateCSSRule(this.classes.node+" h3","color","#"+o),this.updateCSSRule(this.classes.node+" h4","color","#"+o),this.updateCSSRule(this.classes.node+" h5","color","#"+o),this.updateCSSRule(this.classes.node+" h6","color","#"+o),this.updateCSSRule(this.classes.node+" h1 a","color","#"+o),this.updateCSSRule(this.classes.node+" h2 a","color","#"+o),this.updateCSSRule(this.classes.node+" h3 a","color","#"+o),this.updateCSSRule(this.classes.node+" h4 a","color","#"+o),this.updateCSSRule(this.classes.node+" h5 a","color","#"+o),this.updateCSSRule(this.classes.node+" h6 a","color","#"+o))},this))},_initNodeBg:function(){e.extend(this.elements,{bgType:e(this.classes.settings+" select[name=bg_type]"),bgColor:e(this.classes.settings+" input[name=bg_color]"),bgColorPicker:e(this.classes.settings+" .fl-picker-bg_color"),bgOpacity:e(this.classes.settings+" input[name=bg_opacity]"),bgImageSrc:e(this.classes.settings+" select[name=bg_image_src]"),bgRepeat:e(this.classes.settings+" select[name=bg_repeat]"),bgPosition:e(this.classes.settings+" select[name=bg_position]"),bgAttachment:e(this.classes.settings+" select[name=bg_attachment]"),bgSize:e(this.classes.settings+" select[name=bg_size]"),bgVideoSource:e(this.classes.settings+" select[name=bg_video_source]"),bgVideo:e(this.classes.settings+" input[name=bg_video]"),bgVideoServiceUrl:e(this.classes.settings+" input[name=bg_video_service_url]"),bgVideoFallbackSrc:e(this.classes.settings+" select[name=bg_video_fallback_src]"),bgSlideshowSource:e(this.classes.settings+" select[name=ss_source]"),bgSlideshowPhotos:e(this.classes.settings+" input[name=ss_photos]"),bgSlideshowFeedUrl:e(this.classes.settings+" input[name=ss_feed_url]"),
|
6 |
+
bgSlideshowSpeed:e(this.classes.settings+" input[name=ss_speed]"),bgSlideshowTrans:e(this.classes.settings+" select[name=ss_transition]"),bgSlideshowTransSpeed:e(this.classes.settings+" input[name=ss_transitionDuration]"),bgParallaxImageSrc:e(this.classes.settings+" select[name=bg_parallax_image_src]"),bgOverlayColor:e(this.classes.settings+" input[name=bg_overlay_color]"),bgOverlayOpacity:e(this.classes.settings+" input[name=bg_overlay_opacity]")}),this.elements.bgType.on("change",e.proxy(this._bgTypeChange,this)),this.elements.bgColor.on("change",e.proxy(this._bgColorChange,this)),this.elements.bgOpacity.on("keyup",e.proxy(this._bgOpacityChange,this)),this.elements.bgImageSrc.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgRepeat.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgPosition.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgAttachment.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgSize.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgVideoServiceUrl.on("change",e.proxy(this._bgVideoChange,this)),this.elements.bgSlideshowSource.on("change",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowPhotos.on("change",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowFeedUrl.on("keyup",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowSpeed.on("keyup",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowTrans.on("change",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowTransSpeed.on("keyup",e.proxy(this._bgSlideshowChange,this)),this.elements.bgParallaxImageSrc.on("change",e.proxy(this._bgParallaxChange,this)),this.elements.bgOverlayColor.on("change",e.proxy(this._bgOverlayChange,this)),this.elements.bgOverlayOpacity.on("keyup",e.proxy(this._bgOverlayChange,this))},_bgTypeChange:function(e){var t=this.elements.bgType.val();this.elements.node.removeClass("fl-row-bg-video"),this.elements.node.removeClass("fl-row-bg-slideshow"),this.elements.node.removeClass("fl-row-bg-parallax"),this.elements.node.find(".fl-bg-video").remove(),this.elements.node.find(".fl-bg-slideshow").remove(),this.elements.content.css("background-image",""),this.updateCSSRule(this.classes.content,{"background-color":"transparent","background-image":"none"}),"none"==t?this._bgOverlayClear():"color"==t?(this.elements.bgColor.trigger("change"),this._bgOverlayClear()):"photo"==t?(this.elements.bgColor.trigger("change"),this.elements.bgImageSrc.trigger("change")):"video"==t?(this.elements.bgColor.trigger("change"),this._bgVideoChange()):"slideshow"==t?(this.elements.bgColor.trigger("change"),this._bgSlideshowChange()):"parallax"==t&&(this.elements.bgColor.trigger("change"),this.elements.bgParallaxImageSrc.trigger("change"))},_bgColorChange:function(t){var i,l,s;""===this.elements.bgColor.val()||isNaN(this.elements.bgOpacity.val())?this.updateCSSRule(this.classes.content,"background-color","transparent"):(i=this.hexToRgb(this.elements.bgColor.val()),l=this.parseFloat(this.elements.bgOpacity.val())/100,s="rgba("+i.join()+", "+l+")",this.delay(100,e.proxy(function(){this.updateCSSRule(this.classes.content,"background-color",s)},this)))},_bgOpacityChange:function(e){this.elements.bgColor.trigger("change")},_bgPhotoChange:function(e){this.elements.bgImageSrc.val()?this.updateCSSRule(this.classes.content,{"background-image":"url("+this.elements.bgImageSrc.val()+")","background-repeat":this.elements.bgRepeat.val(),"background-position":this.elements.bgPosition.val(),"background-attachment":this.elements.bgAttachment.val(),"background-size":this.elements.bgSize.val()}):this.updateCSSRule(this.classes.content,{"background-image":"none"})},_bgVideoChange:function(t){var i=this.elements,l=i.bgVideoSource.val(),s=i.bgVideo.val(),o=i.bgVideoServiceUrl.val(),n="https://www.youtube.com/iframe_api",r="https://player.vimeo.com/api/player.js",a=e("<script>");"video_service"==l&&""!=o?(/^(?:(?:(?:https?:)?\/\/)?(?:www.)?(?:youtu(?:be.com|.be))\/(?:watch\?v\=|v\/|embed\/)?([\w\-]+))/i.test(o)&&e('script[src*="youtube.com"').length<1?a.attr("src",n):/^(http\:\/\/|https\:\/\/)?(www\.)?(vimeo\.com\/)([0-9]+)$/.test(o)&&e('script[src*="vimeo.com"').length<1&&a.attr("src",r),a.attr("type","text/javascript").appendTo("head"),this.delay(500,e.proxy(this.preview,this))):""!=s&&this.preview()},_bgSlideshowChange:function(t){var i=this.elements,l=i.bgSlideshowSource.val(),s=i.bgSlideshowPhotos.val(),o=i.bgSlideshowFeedUrl.val(),n=i.bgSlideshowSpeed.val(),r=i.bgSlideshowTransSpeed.val();"wordpress"==l&&""===s||"smugmug"==l&&""===o||isNaN(parseInt(n))||isNaN(parseInt(r))||this.delay(500,e.proxy(this.preview,this))},_bgParallaxChange:function(e){this.elements.bgParallaxImageSrc.val()&&this.updateCSSRule(this.classes.content,{"background-image":"url("+this.elements.bgParallaxImageSrc.val()+")","background-repeat":"no-repeat","background-position":"center center","background-attachment":"fixed","background-size":"cover"})},_bgOverlayChange:function(t){var i,l,s;""===this.elements.bgOverlayColor.val()||isNaN(this.elements.bgOverlayOpacity.val())?(this.elements.node.removeClass("fl-row-bg-overlay"),this.elements.node.removeClass("fl-col-bg-overlay"),this.updateCSSRule(this.classes.content+":after","background-color","transparent")):(i=this.hexToRgb(this.elements.bgOverlayColor.val()),l=this.parseFloat(this.elements.bgOverlayOpacity.val())/100,s="rgba("+i.join()+", "+l+")",this.delay(100,e.proxy(function(){this.elements.node.hasClass("fl-col")?this.elements.node.addClass("fl-col-bg-overlay"):this.elements.node.addClass("fl-row-bg-overlay"),this.updateCSSRule(this.classes.content+":after","background-color",s)},this)))},_bgOverlayClear:function(e){this.elements.bgOverlayColor.prev(".fl-color-picker-clear").trigger("click")},_initNodeBorder:function(){e.extend(this.elements,{borderType:e(this.classes.settings+" select[name=border_type]"),borderColor:e(this.classes.settings+" input[name=border_color]"),borderColorPicker:e(this.classes.settings+" .fl-picker-border_color"),borderOpacity:e(this.classes.settings+" input[name=border_opacity]")}),this.elements.borderType.on("change",e.proxy(this._borderTypeChange,this)),this.elements.borderColor.on("change",e.proxy(this._borderColorChange,this)),this.elements.borderOpacity.on("keyup",e.proxy(this._borderOpacityChange,this))},_borderTypeChange:function(e){var t=this.elements.borderType.val();this.updateCSSRule(this.classes.content,{"border-style":""===t?"none":t}),this.elements.borderColor.trigger("change"),this.elements.borderTop.trigger("keyup")},_borderColorChange:function(t){var i,l,s;""===this.elements.borderColor.val()||isNaN(this.elements.borderOpacity.val())?this.updateCSSRule(this.classes.content,"border-color","transparent"):(i=this.hexToRgb(this.elements.borderColor.val()),l=parseInt(this.elements.borderOpacity.val())/100,s="rgba("+i.join()+", "+l+")",this.delay(100,e.proxy(function(){this.updateCSSRule(this.classes.content,"border-color",s)},this)))},_borderOpacityChange:function(e){this.elements.borderColor.trigger("change")},_initNodeClassName:function(){e.extend(this.elements,{className:e(this.classes.settings+" input[name=class]")}),this.elements.className.on("keyup",e.proxy(this._classNameChange,this)),this._lastClassName=this.elements.className.val()},_classNameChange:function(e){var t=this.elements.className.val();null!==this._lastClassName&&this.elements.node.removeClass(this._lastClassName),this.elements.node.addClass(t),this._lastClassName=t},_initResponsiveDimensions:function(t){var i={},l=["Top","Bottom","Left","Right"],s=["","Medium","Responsive"],o=this.classes.settings,n="",r="",a=null,d=null;for(a=0;a<l.length;a++)for(d=0;d<s.length;d++)n=t+l[a]+s[d],r=t+"_"+l[a].toLowerCase(),""!=s[d]&&(r+="_"+s[d].toLowerCase()),i[n]=e(o+" input[name="+r+"]"),i[n].on("keyup",e.proxy(this._responsiveDimensionChange,this,t));e.extend(this.elements,i)},_getDimensions:function(e){for(var t=FLBuilderResponsiveEditing._mode,i=["Top","Bottom","Left","Right"],l="default"==t?"":t.charAt(0).toUpperCase()+t.slice(1),s={},o=0;o<i.length;o++)s[i[o].toLowerCase()]=this.elements[e+i[o]+l].val();return this._normalizeDimensionValues(s,e)},_responsiveDimensionChange:function(t){var i=this._getDimensions(t),l={},s="border"==t;e.each(i,function(e,i){l[t+"-"+e+(s?"-width":"")]=i}),this.updateResponsiveCSSRule(this.classes.content,l),this._positionAbsoluteBgs()},_normalizeDimensionValues:function(t,i){var l=this,s=FLBuilderResponsiveEditing._mode,o="default"==s?"":s.charAt(0).toUpperCase()+s.slice(1),i=i.split("-");return"undefined"==typeof i[1]?i[1]="":i[1]=i[1].charAt(0).toUpperCase()+i[1].slice(1),e.map(t,function(e,s){if(e=e.toLowerCase().replace(/[^a-z0-9%.\-]/g,""),""===e){var n=i[0]+s.charAt(0).toUpperCase()+s.slice(1)+i[1]+o,r=l.elements[n].attr("placeholder");r&&(e=r)}null===e||""===e||isNaN(e)||(e=parseFloat(e)+"px"),t[s]=e}),t},_positionAbsoluteBgs:function(){var t=this.elements.node.find(".fl-bg-slideshow"),i=this.elements.node.find(".fl-bg-video"),l=null,s=null,o={top:0,bottom:0,left:0,right:0};(t.length>0||i.length>0)&&(l=this._getDimensions("margin"),s=this._getDimensions("border"),e.map(o,function(e,t){l[t]&&s[t]?o[t]="calc("+l[t]+"+"+s[t]+")":l[t]?o[t]=l[t]:s[t]&&(o[t]=s[t])}),t.length>0&&(this.updateCSSRule(this.classes.node+" .fl-bg-slideshow",o),FLBuilder._resizeLayout()),i.length>0&&this.updateCSSRule(this.classes.node+" .fl-bg-video",o))},_initRow:function(){e.extend(this.elements,{width:e(this.classes.settings+" select[name=width]"),contentWidth:e(this.classes.settings+" select[name=content_width]"),maxContentWidth:e(this.classes.settings+" input[name=max_content_width]"),height:e(this.classes.settings+" select[name=full_height]"),align:e(this.classes.settings+" select[name=content_alignment]")}),this.elements.width.on("change",e.proxy(this._rowWidthChange,this)),this.elements.contentWidth.on("change",e.proxy(this._rowContentWidthChange,this)),this.elements.maxContentWidth.on("keyup",e.proxy(this._rowMaxContentWidthChange,this)),this.elements.height.on("change",e.proxy(this._rowHeightChange,this)),this.elements.align.on("change",e.proxy(this._rowHeightChange,this)),this._initNodeTextColor(),this._initNodeBg(),this._initNodeClassName(),this._initNodeBorder(),this._initResponsiveDimensions("border"),this._initResponsiveDimensions("margin"),this._initResponsiveDimensions("padding")},_rowWidthChange:function(e){var t=this.elements.node,i=this.elements.maxContentWidth.val();"full"==this.elements.width.val()?(t.css("max-width","none"),t.removeClass("fl-row-fixed-width"),t.addClass("fl-row-full-width")):(t.removeClass("fl-row-full-width"),t.addClass("fl-row-fixed-width"),""!==i?t.css("max-width",i+"px"):t.css("max-width",FLBuilderConfig.global.row_width+"px"))},_rowHeightChange:function(e){var t=this.elements.node;t.removeClass("fl-row-align-top"),t.removeClass("fl-row-align-center"),t.removeClass("fl-row-align-bottom"),"full"==this.elements.height.val()?(t.addClass("fl-row-full-height"),t.addClass("fl-row-align-"+this.elements.align.val())):t.removeClass("fl-row-full-height")},_rowContentWidthChange:function(e){var t=this.elements.content.find(".fl-row-content"),i=this.elements.maxContentWidth.val();"full"==this.elements.contentWidth.val()?(t.css("max-width","none"),t.removeClass("fl-row-fixed-width"),t.addClass("fl-row-full-width")):(t.removeClass("fl-row-full-width"),t.addClass("fl-row-fixed-width"),""!==i?t.css("max-width",i+"px"):t.css("max-width",FLBuilderConfig.global.row_width+"px"))},_rowMaxContentWidthChange:function(e){var t=this.elements.node,i=this.elements.content.find(".fl-row-content"),l=this.elements.maxContentWidth.val();""==l?l=FLBuilderConfig.global.row_width+"px":l+="px","fixed"==this.elements.width.val()&&t.css("max-width",l),"fixed"==this.elements.contentWidth.val()&&i.css("max-width",l)},_initColumn:function(){e.extend(this.elements,{size:e(this.classes.settings+" input[name=size]"),columnHeight:e(this.classes.settings+" select[name=equal_height]"),columnAlign:e(this.classes.settings+" select[name=content_alignment]"),responsiveOrder:e(this.classes.settings+" select[name=responsive_order]")}),this.elements.size.on("keyup",e.proxy(this._colSizeChange,this)),this.elements.columnHeight.on("change",e.proxy(this._colHeightChange,this)),this.elements.columnAlign.on("change",e.proxy(this._colHeightChange,this)),this.elements.responsiveOrder.on("change",e.proxy(this._colResponsiveOrder,this)),this._initNodeTextColor(),this._initNodeBg(),this._initNodeClassName(),this._initNodeBorder(),this._initResponsiveDimensions("border"),this._initResponsiveDimensions("margin"),this._initResponsiveDimensions("padding")},_colSizeChange:function(){var t=8,i=100-t,l=parseFloat(this.elements.size.val()),s=this.elements.node.prev(".fl-col"),o=this.elements.node.next(".fl-col"),n=0===o.length?s:o,r=this.elements.node.siblings(".fl-col"),a=0;0===r.length||isNaN(l)||(r.each(function(){e(this).data("node")!=n.data("node")&&(i-=parseFloat(e(this)[0].style.width),a+=parseFloat(e(this)[0].style.width))}),l<t&&(l=t),l>i&&(l=i),n.css("width",100-a-l+"%"),this.elements.node.css("width",l+"%"))},_colHeightChange:function(){var e=this.elements.node.parent(".fl-col-group");e.removeClass("fl-col-group-align-top"),e.removeClass("fl-col-group-align-center"),e.removeClass("fl-col-group-align-bottom"),"yes"==this.elements.columnHeight.val()?(e.addClass("fl-col-group-equal-height"),e.addClass("fl-col-group-align-"+this.elements.columnAlign.val())):e.removeClass("fl-col-group-equal-height")},_colResponsiveOrder:function(){var e=this.elements.node.parent(".fl-col-group");"reversed"==this.elements.responsiveOrder.val()?e.addClass("fl-col-group-responsive-reversed"):e.removeClass("fl-col-group-responsive-reversed")},_initModule:function(){this._initNodeClassName(),this._initResponsiveDimensions("margin")},_initDefaultFieldPreviews:function(e){for(var e=_.isUndefined(e)?this.elements.settings.find(".fl-field"):e,t=null,i=null,l=0;l<e.length;l++)t=e.eq(l),i=t.data("preview"),"refresh"==i.type&&this._initFieldRefreshPreview(t),"text"==i.type&&this._initFieldTextPreview(t),"css"==i.type&&this._initFieldCSSPreview(t),"widget"==i.type&&this._initFieldWidgetPreview(t),"font"==i.type&&this._initFieldFontPreview(t)},_initFieldRefreshPreview:function(t){var i=t.data("type"),l=t.data("preview"),s=e.proxy(this.delayPreview,this);switch(i){case"text":t.find("input[type=text]").on("keyup",s);break;case"textarea":t.find("textarea").on("keyup",s);break;case"select":t.find("select").on("change",s);break;case"color":t.find(".fl-color-picker-value").on("change",s);break;case"photo":t.find("select").on("change",s);break;case"multiple-photos":t.find("input").on("change",s);break;case"photo-sizes":t.find("select").on("change",s);break;case"video":t.find("input").on("change",s);break;case"multiple-audios":t.find("input").on("change",s);break;case"icon":t.find("input").on("change",s);break;case"form":t.delegate("input","change",s);break;case"editor":this._addTextEditorCallback(t,l);break;case"code":t.find("textarea").on("change",s);break;case"post-type":t.find("select").on("change",s);break;case"suggest":t.find(".as-values").on("change",s),t.find("select").on("change",s);break;case"unit":case"dimension":t.find("input[type=number]").on("keyup",s);break;case"ordering":t.find("input[type=hidden]").on("change",s)}},_initFieldTextPreview:function(t){var i=t.data("type"),l=t.data("preview"),s=e.proxy(this._previewText,this,l);switch(i){case"text":t.find("input[type=text]").on("keyup",s);break;case"unit":t.find("input[type=number]").on("keyup",s);break;case"textarea":t.find("textarea").on("keyup",s);break;case"code":t.find("textarea").on("change",s);break;case"editor":this._addTextEditorCallback(t,l)}},_previewText:function(t,i){var l=this.elements.node.find(t.selector),s=e("<div>"+e(i.target).val()+"</div>");l.length>0&&(s.find("script").remove(),l.html(s.html()))},_previewTextEditor:function(t,i,l){var s=this.elements.node.find(t.selector),o="undefined"!=typeof tinyMCE?tinyMCE.get(i):null,n=e("#"+i),r="";s.length>0&&(r=e(o&&"none"==n.css("display")?"<div>"+o.getContent()+"</div>":"undefined"==typeof switchEditors||"undefined"==typeof switchEditors.wpautop?"<div>"+n.val()+"</div>":"<div>"+switchEditors.wpautop(n.val())+"</div>"),r.find("script").remove(),s.html(r.html()))},_addTextEditorCallback:function(t,i){var l=t.find("textarea.wp-editor-area").attr("id"),s=null;if("refresh"==i.type)s=e.proxy(this.delayPreview,this);else{if("text"!=i.type)return;s=e.proxy(this._previewTextEditor,this,i,l)}e("#"+l).on("keyup",s),"undefined"!=typeof tinyMCE&&(editor=tinyMCE.get(l),editor.on("change",s),editor.on("keyup",s))},_initFieldFontPreview:function(t){var i=t.data("type"),l=t.data("preview");l.id=t.attr("id");var s=e.proxy(this._previewFont,this,l);"font"==i&&t.find(".fl-font-field").on("change","select",s)},_previewFont:function(t,i){var l=e(i.delegateTarget),s=l.find(".fl-font-field-font"),o=e(s).find(":selected"),n=o.parent().attr("label"),r=l.find(".fl-font-field-weight"),a=t.id+"-"+this.nodeId,d=this._getPreviewSelector(this.classes.node,t.selector);"Google"==n&&this._buildFontStylesheet(a,s.val(),r.val()),"Default"==s.val()?(this.updateCSSRule(d,"font-family",""),this.updateCSSRule(d,"font-weight","")):(this.updateCSSRule(d,"font-family",s.val()),this.updateCSSRule(d,"font-weight",r.val()))},_buildFontStylesheet:function(t,i,l){var s=FLBuilderConfig.googleFontsUrl,o="",n={},r={};n[i]=[l],FLBuilderPreview._fontsList[t]=n,Object.keys(FLBuilderPreview._fontsList).forEach(function(e){var t=FLBuilderPreview._fontsList[e];Object.keys(t).forEach(function(e){var i=t[e];r[e]=r[e]||[],i=i.filter(function(t){return r[e].indexOf(t)<0}),r[e]=r[e].concat(i)})}),e.each(r,function(e,t){o+=e+":"+t.join()+"|"}),o=s+o.slice(0,-1).replace(" ","+"),e("#fl-builder-google-fonts-preview").length<1?e("<link>").attr("id","fl-builder-google-fonts-preview").attr("type","text/css").attr("rel","stylesheet").attr("href",o).appendTo("head"):e("#fl-builder-google-fonts-preview").attr("href",o)},_initFieldCSSPreview:function(e){var t=e.data("preview"),i=null;if("undefined"!=typeof t.rules)for(i in t.rules)this._initFieldCSSPreviewCallback(e,t.rules[i]);else this._initFieldCSSPreviewCallback(e,t)},_initFieldCSSPreviewCallback:function(t,i){switch(t.data("type")){case"text":t.find("input[type=text]").on("keyup",e.proxy(this._previewCSS,this,i));break;case"unit":t.find("input[type=number]").on("keyup",e.proxy(this._previewCSS,this,i));break;case"dimension":t.find("input[type=number]").on("keyup",e.proxy(this._previewDimensionCSS,this,i));break;case"select":t.find("select").on("change",e.proxy(this._previewCSS,this,i));break;case"color":t.find(".fl-color-picker-value").on("change",e.proxy(this._previewColor,this,i))}},_previewCSS:function(t,i){var l=this._getPreviewSelector(this.classes.node,t.selector),s=t.property,o="undefined"==typeof t.unit?"":t.unit,n=e(i.target),r=n.val();"%"==o?r=parseInt(r)/100:""!==r&&(r+=o),n.closest(".fl-field-responsive-setting").length?this.updateResponsiveCSSRule(l,s,r):this.updateCSSRule(l,s,r)},_previewDimensionCSS:function(t,i){var l=e.extend({},t),s=l.property,o=e(i.target).data("unit");"border-width"===s?l.property="border-"+o+"-width":l.property=s+"-"+o,this._previewCSS(l,i)},_previewColor:function(t,i){var l=this._getPreviewSelector(this.classes.node,t.selector),s=e(i.target),o=s.val(),n=""===o?"inherit":"#"+o;/^rgb/.test(o.replace(/\s+/g,""))&&(n=o),s.closest(".fl-field-responsive-setting").length?this.updateResponsiveCSSRule(l,t.property,n):this.updateCSSRule(l,t.property,n)},_initFieldWidgetPreview:function(t){var i=e.proxy(this.delayPreview,this);t.find("input").on("keyup",i),t.find("input[type=checkbox]").on("click",i),t.find("textarea").on("keyup",i),t.find("select").on("change",i)},_getPreviewSelector:function(e,t){for(var i="",l=t.split(","),s=0;s<l.length;s++)l[s].indexOf("{node}")>-1?i=l[s].replace("{node}",e):i+=e+" "+l[s],s!=l.length-1&&(i+=", ");return i}}}(jQuery),function(e){var t={ignored:[],reparsed:[],width:null,callback:null,sheets:{},styles:[],queue:[],emPxValue:null,regex:{media:/@media[^{]*{([\s\S]+?})\s*}/gi,empty:/@media[^{]*{([^{}]*?)}/gi,keyframes:/@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,comments:/\/\*[^*]*\*+([^\/][^*]*\*+)*\//gi,urls:/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,findStyles:/@media *([^\{]+)\{([\S\s]+?)\}$/,only:/(only\s+)?([a-zA-Z]+)\s?/,minw:/\(\s*min\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,maxw:/\(\s*max\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,minmaxwh:/\(\s*m(in|ax)\-(height|width)\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/gi,other:/\([^\)]*\)/g},ignore:function(e){Array.prototype.push.apply(this.ignored,e)},reparse:function(e){Array.prototype.push.apply(this.reparsed,e)},update:function(e,t){this.width=void 0===e?null:e,this.callback=void 0===t?null:t,i.update(),this.queueSheets()?this.runQueue():this.applyStyles()},queueSheets:function(){for(var t=e("link, style"),i=null,l=null,s=null,o=null,n=null,r=null,a=null,d=!1,u=0,c=0;u<t.length;u++)if(element=t[u],i=element.href,l=element.id,s=element.tagName.toLowerCase(),o=element.rel,n=element.media,r=i?i:l?l:"style-"+u,a=!0,d=!1,"style"===s||i&&o&&"stylesheet"===o.toLowerCase()){for(c=0;c<this.ignored.length;c++)if(r.indexOf(this.ignored[c])>-1){d=!0;break}if(d)continue;for(c=0;c<this.reparsed.length;c++)if(r.indexOf(this.reparsed[c])>-1){this.sheets[r]=null;break}void 0!==this.sheets[r]&&this.sheets[r]||this.queue.push({element:t.eq(u),key:r,tagName:s,href:i,id:l,media:n})}return this.queue.length},runQueue:function(){var t;this.queue.length?(t=this.queue.shift(),"style"===t.tagName?(this.parse(t.element.html(),t),this.runQueue()):e.get(t.href,e.proxy(function(e){this.parse(e,t),this.runQueue()},this))):this.applyStyles()},parse:function(e,t){var i=this.regex,l=this.cleanStyles(e),s=l.match(i.media),o=s&&s.length||0,n=!o&&t.media,r=null,a=null,d=null,u="",c=0,h=0;for(s?u=l.replace(i.media,""):n&&"all"!=t.media?o=1:u=l,this.sheets[t.key]={element:t.element,key:t.key,tagName:t.tagName,href:t.href,id:t.id,all:u,queries:[]},c=0;c<o;c++)for(n?(r=t.media,l=this.convertURLs(l,t.href)):(r=s[c].match(i.findStyles)&&RegExp.$1,l=RegExp.$2&&this.convertURLs(RegExp.$2,t.href)),a=r.split(","),h=0;h<a.length;h++)r=a[h],d=r.split("(")[0].match(i.only)&&RegExp.$2,"print"!=d&&(r.replace(i.minmaxwh,"").match(i.other)||this.sheets[t.key].queries.push({minw:r.match(i.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:r.match(i.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),styles:l}))},applyStyles:function(){var t=e("head"),i=null,l=null,s=null,o=null,n=null,r=null,a=null,d=null,u=!1;this.clearStyles();for(o in this.sheets)if(i="",l=e("<style></style>"),s=this.sheets[o],s.queries.length&&this.width){for(i+=s.all,r=0;r<s.queries.length;r++)n=s.queries[r],a=n.minw,d=n.maxw,u=!1,a&&(a=parseFloat(a)*(a.indexOf("em")>-1?this.getEmPxValue():1),this.width>=a&&(i+=n.styles,u=!0)),d&&!u&&(d=parseFloat(d)*(d.indexOf("em")>-1?this.getEmPxValue():1),this.width<=d&&(i+=n.styles));this.styles.push(l),t.append(l),l.html(i),s.element.remove()}},clearStyles:function(){var t=e("head"),i=null,l=this.styles.slice(0);this.styles=[];for(i in this.sheets)this.sheets[i].element.parent().length||t.append(this.sheets[i].element);setTimeout(function(){for(var e=0;e<l.length;e++)l[e].empty(),l[e].remove()},50)},cleanStyles:function(e){var t=this.regex;return e.replace(t.comments,"").replace(t.keyframes,"").replace(t.empty,"")},convertURLs:function(e,t){return t?(t=t.substring(0,t.lastIndexOf("/")),t.length&&(t+="/"),e.replace(this.regex.urls,"$1"+t+"$2$3")):e},getEmPxValue:function(){if(this.emPxValue)return this.emPxValue;var e=null,t=window.document,i=t.documentElement,l=t.body,s=t.createElement("div"),o=i.style.fontSize,n=l&&l.style.fontSize,r=!1;return s.style.cssText="position:absolute;font-size:1em;width:1em",l||(l=r=t.createElement("body"),l.style.background="none"),i.style.fontSize="100%",l.style.fontSize="100%",l.appendChild(s),r&&i.insertBefore(l,i.firstChild),e=parseFloat(s.offsetWidth),r?i.removeChild(l):l.removeChild(s),i.style.fontSize=o,n?l.style.fontSize=n:l.style.fontSize="",this.emPxValue=e,e}},i={_functions:null,update:function(){var e;if(!this._functions){this._functions={};for(e in l)this._functions[e]=jQuery.fn[e]}if(t.width)for(e in l)jQuery.fn[e]=l[e];else for(e in this._functions)jQuery.fn[e]=this._functions[e]}},l={width:function(l){return void 0!=l?i._functions.width.call(this,l):e.isWindow(this[0])?t.width:i._functions.width.call(this)}};FLBuilderSimulateMediaQuery={ignore:function(e){t.ignore(e)},reparse:function(e){t.reparse(e)},update:function(e,i){t.update(e,i)}}}(jQuery),function(e){FLBuilderResponsiveEditing={_mode:"default",refreshPreview:function(){var t;e(".fl-responsive-preview").length&&"default"!=this._mode&&("responsive"==this._mode?(t=FLBuilderConfig.global.responsive_breakpoint>=320?320:FLBuilderConfig.global.responsive_breakpoint,FLBuilderSimulateMediaQuery.update(t)):"medium"==this._mode&&(t=FLBuilderConfig.global.medium_breakpoint>=769?769:FLBuilderConfig.global.medium_breakpoint,FLBuilderSimulateMediaQuery.update(t)),FLBuilder._resizeLayout())},_init:function(){this._bind(),this._initMediaQueries()},_bind:function(){FLBuilder.addHook("responsive-editing-switched",this._previewSpacingFields),FLBuilder.addHook("settings-form-init",this._initSettingsForms),FLBuilder.addHook("settings-lightbox-closed",this._clearPreview),e("body").delegate(".fl-field-responsive-toggle","click",this._settingToggleClicked)},_initMediaQueries:function(){FLBuilderSimulateMediaQuery.ignore([FLBuilderConfig.pluginUrl,"fl-theme-builder","/wp-includes/","/wp-admin/","admin-bar-inline-css","ace-tm","ace_editor.css"]),FLBuilderSimulateMediaQuery.reparse([FLBuilderConfig.postId+"-layout-draft.css?",FLBuilderConfig.postId+"-layout-draft-partial.css?",FLBuilderConfig.postId+"-layout-preview.css?",FLBuilderConfig.postId+"-layout-preview-partial.css?","fl-builder-global-css","fl-builder-layout-css"])},_switchTo:function(t,i){var l=e("html"),s=e("body"),o=e(FLBuilder._contentClass),n=e(".fl-responsive-preview"),r=e(".fl-responsive-preview-mask"),a=e(".fl-content-placeholder"),d=null;if(FLBuilderResponsiveEditing._mode=t,"default"==t){if(0===a.length)return;l.removeClass("fl-responsive-preview-enabled"),a.after(o),a.remove(),n.remove(),r.remove()}else 0===n.length?(l.addClass("fl-responsive-preview-enabled"),o.after('<div class="fl-content-placeholder"></div>'),s.prepend(wp.template("fl-responsive-preview")()),e(".fl-responsive-preview").addClass("fl-preview-"+t),e(".fl-responsive-preview-content").append(o)):(n.removeClass("fl-preview-responsive fl-preview-medium"),n.addClass("fl-preview-"+t));"responsive"==t?(d=FLBuilderConfig.global.responsive_breakpoint>=360?360:FLBuilderConfig.global.responsive_breakpoint,o.width(d),FLBuilderSimulateMediaQuery.update(d,i)):"medium"==t?(d=FLBuilderConfig.global.medium_breakpoint>=769?769:FLBuilderConfig.global.medium_breakpoint,o.width(d),FLBuilderSimulateMediaQuery.update(d,i)):(o.width(""),FLBuilderSimulateMediaQuery.update(null,i)),this._setContentBackgroundColor(),FLBuilder._resizeLayout(),FLBuilder.triggerHook("responsive-editing-switched",t)},_setContentBackgroundColor:function(){var t=e(FLBuilder._contentClass),i=e(".fl-responsive-preview"),l=e(".fl-content-placeholder"),s=l.parents(),o="#fff",n=0;if(0===i.length)t.css("background-color","");else{for(;n<s.length&&(o=s.eq(n).css("background-color"),"rgba(0, 0, 0, 0)"==o);n++);t.css("background-color",o)}},_switchToAndScroll:function(t){var i=e(".fl-builder-settings").data("node"),l=void 0===i?void 0:e(".fl-node-"+i);FLBuilderResponsiveEditing._switchTo(t,function(){void 0!==l&&l&&setTimeout(function(){var t=e(window),i=e(".fl-responsive-preview-content");!i.length||t.height()<i.height()?e("html, body").animate({scrollTop:l.offset().top-100},250):scrollTo(0,0)},250)})},_clearPreview:function(){FLBuilderResponsiveEditing._switchToAndScroll("default")},_settingToggleClicked:function(){var t=e(this),i=t.data("mode");i="default"==i?"medium":"medium"==i?"responsive":"default",FLBuilderResponsiveEditing._switchAllSettingsTo(i),t.siblings(".fl-field-responsive-setting:visible").find("input").focus()},_switchAllSettingsTo:function(t){var i="dashicons-desktop dashicons-tablet dashicons-smartphone";e(".fl-field-responsive-toggle").removeClass(i),e(".fl-field-responsive-setting").hide(),i="default"==t?"dashicons-desktop":"medium"==t?"dashicons-tablet":"dashicons-smartphone",e(".fl-field-responsive-toggle").addClass(i).data("mode",t),e(".fl-field-responsive-setting-"+t).css("display","inline-block"),FLBuilderResponsiveEditing._switchToAndScroll(t)},_initSettingsForms:function(){var e=FLBuilderResponsiveEditing;Number(FLBuilderConfig.global.responsive_enabled)&&(e._initFields("dimension","input","keyup",e._spacingFieldKeyup,["margin","padding"]),e._initFields("dimension","input","keyup",e._textFieldKeyup),e._initFields("unit","input","keyup",e._textFieldKeyup)),e._switchAllSettingsTo(e._mode)},_initFields:function(t,i,l,s,o){for(var n=e(".fl-builder-settings"),r=n.find(".fl-field").has(".fl-field-responsive-setting"),a=null,d=null,u=0;u<r.length;u++)a=r.eq(u),d=a.attr("id").replace("fl-field-",""),"object"==typeof o&&e.inArray(d,o)<0||t==a.attr("data-type")&&void 0===a.attr("data-responsive-init")&&(a.find(".fl-field-responsive-setting-default "+i).on(l,s),a.find(".fl-field-responsive-setting-medium "+i).on(l,s),a.find(".fl-field-responsive-setting-responsive "+i).on(l,s),a.find(".fl-field-responsive-setting-default "+i).trigger(l),a.attr("data-responsive-init",1))},_getFields:function(t,i){var l=e(t).closest(".fl-field");return{"default":l.find(".fl-field-responsive-setting-default "+i),medium:l.find(".fl-field-responsive-setting-medium "+i),responsive:l.find(".fl-field-responsive-setting-responsive "+i)}},_textFieldKeyup:function(){var e=FLBuilderResponsiveEditing._getFields(this,"input");e["default"].each(function(t){var i=e["default"].eq(t).attr("placeholder"),l=e["default"].eq(t).val(),s=e.medium.eq(t).val();""==l?e.medium.eq(t).attr("placeholder",void 0===i?"":i):e.medium.eq(t).attr("placeholder",l),""==s?e.responsive.eq(t).attr("placeholder",e.medium.eq(t).attr("placeholder")):e.responsive.eq(t).attr("placeholder",s)})},_spacingFieldKeyup:function(){var t=e(".fl-builder-settings"),i="row",l=e(this).closest(".fl-field").attr("id").replace("fl-field-",""),s=FLBuilderResponsiveEditing._getFields(this,"input"),o=FLBuilderConfig.global,n=null,r=null,a=null,d=null;t.hasClass("fl-builder-row-settings")?i="row":t.hasClass("fl-builder-col-settings")?i="col":t.hasClass("fl-builder-module-settings")&&(i="module"),e.extend(o,{col_margins:0,col_margins_medium:"",col_margins_responsive:"",col_padding:0,col_padding_medium:"",col_padding_responsive:""}),n=i+"_"+l+("margin"===l?"s":""),r=o[n],a=o[n+"_medium"],d=o[n+"_responsive"],s["default"].each(function(e){var t=s["default"].eq(e).attr("name").split("_").pop(),n=s["default"].eq(e).val(),u=s.medium.eq(e).val(),c=(s.responsive.eq(e).val(),null),h=null;""===a&&(""!==n?s.medium.eq(e).attr("placeholder",n):""!==r&&s.medium.eq(e).attr("placeholder",r)),""===d&&("module"===i&&Number(o.auto_spacing)?(c=""===a?Number(r):a,h=""===u?Number(n):u,""!==h&&(h>c||h<0)?s.responsive.eq(e).attr("placeholder",c):""!==h?s.responsive.eq(e).attr("placeholder",h):s.responsive.eq(e).attr("placeholder",c)):(!Number(o.auto_spacing)||"padding"===l&&"top|bottom".indexOf(t)>-1)&&(""!==u?s.responsive.eq(e).attr("placeholder",u):""!==a?s.responsive.eq(e).attr("placeholder",a):""!==n?s.responsive.eq(e).attr("placeholder",n):""!==r&&s.responsive.eq(e).attr("placeholder",r)))})},_previewSpacingFields:function(){var t=FLBuilderResponsiveEditing._mode,i=e(".fl-builder-settings");0!==i.length&&void 0!==i.attr("data-node")&&i.find(".fl-field").has(".fl-field-responsive-setting").each(function(){var e=FLBuilderResponsiveEditing._getFields(this,"input"),i=e.responsive.closest(".fl-field").data("preview");
|
7 |
+
"refresh"!=i.type&&e[t].trigger("keyup")})}},e(function(){FLBuilderResponsiveEditing._init()})}(jQuery),function(e){FLBuilderResponsivePreview={enter:function(){this.render()},exit:function(){this.destroy()},switchTo:function(t){var i=FLBuilderConfig.global,l=e("#fl-builder-preview-frame"),s="100%";"responsive"==t?(s=i.responsive_breakpoint>=360?360:i.responsive_breakpoint,l.width(s)):"medium"==t&&(s=i.medium_breakpoint>=769?769:i.medium_breakpoint,l.width(s)),l.width(s)},render:function(){var t=e("body"),i=FLBuilderConfig.previewUrl,l=e("#fl-builder-preview-mask, #fl-builder-preview-frame"),s=e('<div id="fl-builder-preview-mask"></div>'),o=e('<iframe id="fl-builder-preview-frame" src="'+i+'" frameborder="0"></iframe>');l.remove(),t.append(s),t.append(o)},destroy:function(){e("#fl-builder-preview-mask, #fl-builder-preview-frame").remove()}}}(jQuery),function(e){var t={init:function(){var t=e("body");t.delegate(".fl-builder-service-select","change",this._serviceChange),t.delegate(".fl-builder-service-connect-button","click",this._connectClicked),t.delegate(".fl-builder-service-account-select","change",this._accountChange),t.delegate(".fl-builder-service-account-delete","click",this._accountDeleteClicked),t.delegate(".fl-builder-campaign-monitor-client-select","change",this._campaignMonitorClientChange),t.delegate(".fl-builder-mailchimp-list-select","change",this._mailChimpListChange),t.delegate(".fl-builder-activecampaign-list_type-select","change",this._activeCampaignChange)},_startSettingsLoading:function(t){var i=e(".fl-builder-settings"),l=t.closest(".fl-builder-service-settings"),s=e(".fl-builder-service-error");i.append('<div class="fl-builder-loading"></div>'),l.addClass("fl-builder-service-settings-loading"),s.remove()},_finishSettingsLoading:function(){var t=e(".fl-builder-settings"),i=e(".fl-builder-service-settings-loading");t.find(".fl-builder-loading").remove(),i.removeClass("fl-builder-service-settings-loading")},_serviceChange:function(){var i=e(".fl-builder-settings").data("node"),l=e(this),s=l.closest("tr"),o=l.val();s.siblings("tr.fl-builder-service-account-row").remove(),s.siblings("tr.fl-builder-service-connect-row").remove(),s.siblings("tr.fl-builder-service-field-row").remove(),e(".fl-builder-service-error").remove(),""!==o&&(t._startSettingsLoading(l),FLBuilder.ajax({action:"render_service_settings",node_id:i,service:o},t._serviceChangeComplete))},_serviceChangeComplete:function(i){var l=JSON.parse(i),s=e(".fl-builder-service-settings-loading"),o=s.find(".fl-builder-service-select-row");o.after(l.html),t._addAccountDelete(s),t._finishSettingsLoading()},_connectClicked:function(){for(var i=e(".fl-builder-settings").data("node"),l=e(this).closest(".fl-builder-service-settings"),s=l.find(".fl-builder-service-select"),o=l.find(".fl-builder-service-connect-row"),n=l.find(".fl-builder-service-connect-input"),r=null,a=null,d=0,u={action:"connect_service",node_id:i,service:s.val(),fields:{}};d<n.length;d++)r=n.eq(d),a=r.attr("name"),u.fields[a]=r.val();o.hide(),t._startSettingsLoading(s),FLBuilder.ajax(u,t._connectComplete)},_connectComplete:function(i){var l=JSON.parse(i),s=e(".fl-builder-service-settings-loading"),o=s.find(".fl-builder-service-select-row"),n=s.find(".fl-builder-service-select"),r=s.find(".fl-builder-service-account-row"),a=s.find(".fl-builder-service-account-select"),d=s.find(".fl-builder-service-connect-row");l.error?(d.show(),0===a.length?n.after('<div class="fl-builder-service-error">'+l.error+"</div>"):a.after('<div class="fl-builder-service-error">'+l.error+"</div>")):(d.remove(),r.remove(),o.after(l.html)),t._addAccountDelete(s),t._finishSettingsLoading()},_accountChange:function(){var i=e(".fl-builder-settings").data("node"),l=e(this).closest(".fl-builder-service-settings"),s=l.find(".fl-builder-service-select"),o=l.find(".fl-builder-service-account-select"),n=l.find(".fl-builder-service-connect-row"),r=l.find("tr.fl-builder-service-field-row"),a=e(".fl-builder-service-error"),d=o.val(),u=null;n.remove(),r.remove(),a.remove(),"add_new_account"==d?u={action:"render_service_settings",node_id:i,service:s.val(),add_new:!0}:""!==d&&(u={action:"render_service_fields",node_id:i,service:s.val(),account:d}),u&&(t._startSettingsLoading(s),FLBuilder.ajax(u,t._accountChangeComplete)),t._addAccountDelete(l)},_accountChangeComplete:function(i){var l=JSON.parse(i),s=e(".fl-builder-service-settings-loading"),o=s.find(".fl-builder-service-account-row");o.after(l.html),t._finishSettingsLoading()},_addAccountDelete:function(e){var t=e.find(".fl-builder-service-account-select");t.length>0&&(e.find(".fl-builder-service-account-delete").remove(),""!==t.val()&&"add_new_account"!=t.val()&&t.after('<a href="javascript:void(0);" class="fl-builder-service-account-delete">'+FLBuilderStrings.deleteAccount+"</a>"))},_accountDeleteClicked:function(){var i=e(this).closest(".fl-builder-service-settings"),l=i.find(".fl-builder-service-select"),s=i.find(".fl-builder-service-account-select");confirm(FLBuilderStrings.deleteAccountWarning)&&(FLBuilder.ajax({action:"delete_service_account",service:l.val(),account:s.val()},t._accountDeleteComplete),t._startSettingsLoading(s))},_accountDeleteComplete:function(){var i=e(".fl-builder-service-settings-loading"),l=i.find(".fl-builder-service-select");t._finishSettingsLoading(),l.trigger("change")},_campaignMonitorClientChange:function(){var i=e(".fl-builder-settings").data("node"),l=e(this).closest(".fl-builder-service-settings"),s=l.find(".fl-builder-service-select"),o=l.find(".fl-builder-service-account-select"),n=e(this),r=l.find(".fl-builder-service-list-select"),a=n.val();0!==r.length&&r.closest("tr").remove(),""!==a&&(t._startSettingsLoading(s),FLBuilder.ajax({action:"render_service_fields",node_id:i,service:s.val(),account:o.val(),client:a},t._campaignMonitorClientChangeComplete))},_campaignMonitorClientChangeComplete:function(i){var l=JSON.parse(i),s=e(".fl-builder-service-settings-loading"),o=s.find(".fl-builder-campaign-monitor-client-select");o.closest("tr").after(l.html),t._finishSettingsLoading()},_mailChimpListChange:function(){var i=e(".fl-builder-settings").data("node"),l=e(this).closest(".fl-builder-service-settings"),s=l.find(".fl-builder-service-select"),o=l.find(".fl-builder-service-account-select"),n=l.find(".fl-builder-service-list-select");e(".fl-builder-mailchimp-group-select").closest("tr").remove(),""!==n.val()&&(t._startSettingsLoading(s),FLBuilder.ajax({action:"render_service_fields",node_id:i,service:s.val(),account:o.val(),list_id:n.val()},t._mailChimpListChangeComplete))},_mailChimpListChangeComplete:function(i){var l=JSON.parse(i),s=e(".fl-builder-service-settings-loading"),o=s.find(".fl-builder-service-list-select");o.closest("tr").after(l.html),t._finishSettingsLoading()},_activeCampaignChange:function(){var i=e(".fl-builder-settings").data("node"),l=e(this).closest(".fl-builder-service-settings"),s=l.find(".fl-builder-service-select"),o=l.find(".fl-builder-service-account-select"),n=l.find(".fl-builder-service-list-select");list_type=l.find('select[name="list_type"]'),0!==n.length&&n.closest("tr").remove(),""!==list_type.val()&&(t._startSettingsLoading(s),FLBuilder.ajax({action:"render_service_fields",node_id:i,service:s.val(),account:o.val(),list_type:list_type.val()},t._activeCampaignTypeChangeComplete))},_activeCampaignTypeChangeComplete:function(i){var l=JSON.parse(i),s=e(".fl-builder-service-settings-loading"),o=s.find(".fl-builder-service-field-row");o.after(l.html),t._finishSettingsLoading()}};e(function(){t.init()})}(jQuery),function(e){FLBuilderTour={_tour:null,start:function(){FLBuilderTour._tour?FLBuilderTour._tour.restart():(FLBuilderTour._tour=new Tour(FLBuilderTour._config()),FLBuilderTour._tour.init()),FLBuilder._triggerSettingsSave(!1,!0)&&FLBuilderTour._tour.start()},_config:function(){var t={storage:!1,onStart:FLBuilderTour._onStart,onPrev:FLBuilderTour._onPrev,onNext:FLBuilderTour._onNext,onEnd:FLBuilderTour._onEnd,template:'<div class="popover" role="tooltip"> <i class="fa fa-times" data-role="end"></i> <div class="arrow"></div> <h3 class="popover-title"></h3> <div class="popover-content"></div> <div class="popover-navigation clearfix"> <button class="fl-builder-button fl-builder-button-primary fl-builder-tour-next" data-role="next">'+FLBuilderStrings.tourNext+"</button> </div> </div>",steps:[{animation:!1,element:".fl-builder--content-library-panel",placement:"left",title:FLBuilderStrings.tourTemplatesTitle,content:FLBuilderStrings.tourTemplates,onShow:function(){FLBuilder.ContentPanel.show("templates")}},{animation:!1,element:".fl-builder--content-library-panel",placement:"left",title:FLBuilderStrings.tourAddRowsTitle,content:FLBuilderStrings.tourAddRows,onShow:function(){FLBuilder.ContentPanel.show("rows")}},{animation:!1,element:".fl-builder--content-library-panel",placement:"left",title:FLBuilderStrings.tourAddContentTitle,content:FLBuilderStrings.tourAddContent,onShow:function(){FLBuilder.ContentPanel.show("modules")}},{animation:!1,element:".fl-row:first-of-type",placement:"top",title:FLBuilderStrings.tourEditContentTitle,content:FLBuilderStrings.tourEditContent,onShow:function(){FLBuilderTour._dimSection(".fl-builder-bar"),FLBuilder._closePanel(),e(".fl-row").eq(0).trigger("mouseenter"),e(".fl-module").eq(0).trigger("mouseenter")}},{animation:!1,element:".fl-row:first-of-type .fl-module-overlay .fl-block-overlay-actions",placement:"top",title:FLBuilderStrings.tourEditContentTitle,content:FLBuilderStrings.tourEditContent2,onShow:function(){FLBuilderTour._dimSection(".fl-builder-bar"),FLBuilder._closePanel(),e(".fl-row").eq(0).trigger("mouseenter"),e(".fl-module").eq(0).trigger("mouseenter")}},{animation:!1,element:".fl-builder-content-panel-button",placement:"bottom",title:FLBuilderStrings.tourAddContentButtonTitle,content:FLBuilderStrings.tourAddContentButton,onShow:function(){FLBuilderTour._dimSection("body"),e(".fl-row").eq(0).trigger("mouseleave"),e(".fl-module").eq(0).trigger("mouseleave")}},{animation:!1,element:".fl-builder-templates-button",placement:"bottom",title:FLBuilderStrings.tourTemplatesButtonTitle,content:FLBuilderStrings.tourTemplatesButton,onShow:function(){FLBuilderTour._dimSection("body")}},{animation:!1,element:".fl-builder-tools-button",placement:"bottom",title:FLBuilderStrings.tourToolsButtonTitle,content:FLBuilderStrings.tourToolsButton,onShow:function(){FLBuilderTour._dimSection("body")}},{animation:!1,element:".fl-builder-done-button",placement:"bottom",title:FLBuilderStrings.tourDoneButtonTitle,content:FLBuilderStrings.tourDoneButton,onShow:function(){FLBuilderTour._dimSection("body")}},{animation:!1,orphan:!0,backdrop:!0,title:FLBuilderStrings.tourFinishedTitle,content:FLBuilderStrings.tourFinished,template:'<div class="popover" role="tooltip"> <div class="arrow"></div> <i class="fa fa-times" data-role="end"></i> <h3 class="popover-title"></h3> <div class="popover-content"></div> <div class="popover-navigation clearfix"> <button class="fl-builder-button fl-builder-button-primary fl-builder-tour-next" data-role="end">'+FLBuilderStrings.tourEnd+"</button> </div> </div>"}]};return FLBuilderConfig.lite?t.steps.shift():"disabled"==FLBuilderConfig.enabledTemplates?t.steps.shift():"fl-builder-template"==FLBuilderConfig.postType&&t.steps.shift(),t},_onStart:function(){var t=e("body");t.scrollTop(0),t.append('<div class="fl-builder-tour-mask"></div>'),0===e(".fl-row").length&&"module"!=FLBuilderConfig.userTemplateType&&(e(".fl-builder-content").append('<div class="fl-builder-tour-demo-content fl-row fl-row-fixed-width fl-row-bg-none"> <div class="fl-row-content-wrap"> <div class="fl-row-content fl-row-fixed-width fl-node-content"> <div class="fl-col-group"> <div class="fl-col" style="width:100%"> <div class="fl-col-content fl-node-content"> <div class="fl-module fl-module-rich-text" data-type="rich-text" data-name="Text Editor"> <div class="fl-module-content fl-node-content"> <div class="fl-rich-text"> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus pellentesque ut lorem non cursus. Sed mauris nunc, porttitor iaculis lorem a, sollicitudin lacinia sapien. Proin euismod orci lacus, et sollicitudin leo posuere ac. In hac habitasse platea dictumst. Maecenas elit magna, consequat in turpis suscipit, ultrices rhoncus arcu. Phasellus finibus sapien nec elit tempus venenatis. Maecenas tincidunt sapien non libero maximus, in aliquam felis tincidunt. Mauris mollis ultricies facilisis. Duis condimentum dignissim tortor sit amet facilisis. Aenean gravida lacus eu risus molestie egestas. Donec ut dolor dictum, fringilla metus malesuada, viverra nunc. Maecenas ut purus ac justo aliquet lacinia. Cras vestibulum elementum tincidunt. Maecenas mattis tortor neque, consectetur dignissim neque tempor nec.</p></div> </div> </div> </div> </div> </div> </div> </div> </div>'),FLBuilder._setupEmptyLayout(),FLBuilder._highlightEmptyCols())},_onPrev:function(){e(".fl-builder-tour-dimmed").remove()},_onNext:function(){e(".fl-builder-tour-dimmed").remove()},_onEnd:function(){e("body").off("fl-builder.template-selector-loaded"),e(".fl-builder-tour-mask").remove(),e(".fl-builder-tour-dimmed").remove(),e(".fl-builder-tour-demo-content").remove(),FLBuilder._setupEmptyLayout(),FLBuilder._highlightEmptyCols(),FLBuilder._showPanel(),FLBuilder._initTemplateSelector()},_dimSection:function(t){e(t).find(".fl-builder-tour-dimmed").remove(),e(t).append('<div class="fl-builder-tour-dimmed"></div>')}}}(jQuery),function(e,t){String.prototype.startsWith||(String.prototype.startsWith=function(e,t){return t=t||0,this.substr(t,e.length)===e}),e.fn.textWidth=function(t,i){return e.fn.textWidth.fakeEl||(e.fn.textWidth.fakeEl=e("<span>").hide().appendTo(document.body)),e.fn.textWidth.fakeEl.text(t||this.val()||this.text()).css("font",i||this.css("font")),e.fn.textWidth.fakeEl.width()},FLExtendableObject={create:function(t){var i=Object.create(this);return i=e.extend(i,t),e(this).trigger("onCreate"),i}},e.fn.switchClass=function(t,i){return this.each(function(){return e(this).removeClass(function(e,i){var l=[],s=i.split(" ");for(var e in s)s[e].startsWith(t)&&l.push(s[e]);return l.join(" ")}),e(this).addClass(t+i)})};var i={init:function(){t.addHook("cancelTask",this.onCancelTask.bind(this)),t.addHook("showSavedMessage",this.onSaveShortcut.bind(this)),t.addHook("goToNextTab",this.onNextPrevTabShortcut.bind(this,"next")),t.addHook("goToPrevTab",this.onNextPrevTabShortcut.bind(this,"prev")),t.addHook("endEditingSession",this.onEndEditingSession.bind(this)),t.addHook("restartEditingSession",this.onRestartEditingSession.bind(this)),this.setDefaultKeyboardShortcuts()},addShortcut:function(t,i,l){var s=e.proxy(this,"onTriggerKey",t);l?Mousetrap.bindGlobal(i,s):Mousetrap.bind(i,s)},reset:function(){Mousetrap.reset()},setDefaultKeyboardShortcuts:function(){this.reset();for(var e in FLBuilderConfig.keyboardShortcuts){var t=FLBuilderConfig.keyboardShortcuts[e].keyCode,i=FLBuilderConfig.keyboardShortcuts[e].isGlobal;this.addShortcut(e,t,i)}},onTriggerKey:function(e,i){t.triggerHook(e),i.preventDefault?i.preventDefault():i.returnValue=!1},onCancelTask:function(){return o.isPreviewing?void o.endPreview():s.isShowing?void s.hide():t.ContentPanel.isShowing?void t.ContentPanel.hide():void 0},pause:function(){Mousetrap.pause()},unpause:function(){Mousetrap.unpause()},onEndEditingSession:function(){this.reset(),this.addShortcut("restartEditingSession","mod+e")},onRestartEditingSession:function(){this.reset(),this.setDefaultKeyboardShortcuts()},onSaveShortcut:function(){if(t.SaveManager.layoutNeedsPublish()){var e=FLBuilderStrings.savedStatus.hasAlreadySaved;t.SaveManager.showStatusMessage(e),setTimeout(function(){t.SaveManager.resetStatusMessage()},2e3)}else{var e=FLBuilderStrings.savedStatus.nothingToSave;t.SaveManager.showStatusMessage(e),setTimeout(function(){t.SaveManager.resetStatusMessage()},2e3)}},onNextPrevTabShortcut:function(i,l){var s,o,n=e(".fl-lightbox:visible"),r=n.find(".fl-builder-settings-tabs a");n.length>0&&(s=r.filter("a.fl-active"),o="next"==i?s.is(r.last())?r.first():s.next("a"):s.is(r.first())?r.last():s.prev("a"),o.trigger("click")),t._calculateSettingsTabsOverflow(),l.preventDefault()}},l={isShowing:!1,init:function(){this.render(),t.addHook("showKeyboardShortcuts",this.show.bind(this))},render:function(){var t=wp.template("fl-keyboard-shortcuts"),i=FLBuilderConfig.keyboardShortcuts;this.$el=e(t(i)),e("body").append(this.$el),this.$el.find(".dismiss-shortcut-ui").on("click",this.hide.bind(this)),this.$el.on("click",this.hide.bind(this))},show:function(){this.isShowing||(this.$el.addClass("is-showing"),this.isShowing=!0)},hide:function(){this.isShowing&&(this.$el.removeClass("is-showing"),this.isShowing=!1)},toggle:function(){this.isShowing?this.hide():this.show()}},s=FLExtendableObject.create({isShowing:!1,init:function(){this.$el=e(".fl-builder-publish-actions"),this.$defaultBarButtons=e(".fl-builder-bar-actions"),this.$clickAwayMask=e(".fl-builder-publish-actions-click-away-mask"),this.$doneBtn=this.$defaultBarButtons.find(".fl-builder-done-button"),this.$doneBtn.on("click",this.onDoneTriggered.bind(this)),this.$actions=this.$el.find(".fl-builder-button"),this.$actions.on("click",this.onActionClicked.bind(this)),t.addHook("triggerDone",this.onDoneTriggered.bind(this));var i=this.hide.bind(this);t.addHook("cancelPublishActions",i),t.addHook("endEditingSession",i),this.$clickAwayMask.on("click",i)},onDoneTriggered:function(){t.SaveManager.layoutNeedsPublish()?this.show():FLBuilderConfig.shouldRefreshOnPublish?t._exit():t._exitWithoutRefresh()},show:function(){this.isShowing||t._triggerSettingsSave(!1,!0)&&(this.$el.removeClass("is-hidden"),this.$defaultBarButtons.css("opacity","0"),this.$clickAwayMask.show(),this.isShowing=!0,t.triggerHook("didShowPublishActions"))},hide:function(){this.isShowing&&(this.$el.addClass("is-hidden"),this.$defaultBarButtons.css("opacity","1"),this.$clickAwayMask.hide(),this.isShowing=!1)},onActionClicked:function(i){var l=e(i.currentTarget).data("action");switch(l){case"dismiss":this.hide();break;case"discard":this.hide(),o.muteToolbar(),t._discardButtonClicked();break;case"publish":this.hide(),o.muteToolbar(),t._publishButtonClicked(),t._destroyOverlayEvents();break;case"draft":this.hide(),o.muteToolbar(),t._draftButtonClicked();break;default:this.hide(),o.muteToolbar(),t._draftButtonClicked()}t.triggerHook(l+"ButtonClicked")}}),o={isPreviewing:!1,init:function(){this.$el=e("body"),this.$mainToolbar=e(".fl-builder-bar"),this.$mainToolbarContent=this.$mainToolbar.find(".fl-builder-bar-content"),this.$wpAdminBar=e("#wpadminbar"),this.$endPreviewBtn=e(".fl-builder--preview-actions .end-preview-btn"),t.addHook("endEditingSession",this.endEditingSession.bind(this)),t.addHook("previewLayout",this.togglePreview.bind(this)),this.$endPreviewBtn.on("click",this.endPreview.bind(this)),this.$deviceIcons=e(".fl-builder--preview-actions i"),this.$deviceIcons.on("click",this.onDeviceIconClick.bind(this));var i=this.$wpAdminBar.find("#wp-admin-bar-fl-builder-frontend-edit-link > a, #wp-admin-bar-fl-theme-builder-frontend-edit-link > a");i.on("click",this.onClickPageBuilderToolbarLink.bind(this)),e("#wpadminbar a").attr("tabindex","-1");var l=this.restartEditingSession.bind(this);t.addHook("restartEditingSession",l),t.addHook("didHideAllLightboxes",this.unmuteToolbar.bind(this)),t.addHook("didCancelDiscard",this.unmuteToolbar.bind(this)),t.addHook("didEnterRevisionPreview",this.hide.bind(this)),t.addHook("didExitRevisionPreview",this.show.bind(this)),t.addHook("didPublishLayout",this.onPublish.bind(this))},endEditingSession:function(){t._destroyOverlayEvents(),t._removeAllOverlays(),t._removeEmptyColHighlights(),t._removeColHighlightGuides(),t._unbindEvents(),e("html").removeClass("fl-builder-edit").addClass("fl-builder-show-admin-bar"),e("body").removeClass("fl-builder-edit"),e("#wpadminbar a").attr("tabindex",null),e(t._contentClass).removeClass("fl-builder-content-editing"),this.hideMainToolbar(),t.ContentPanel.hide(),FLBuilderLayout.init()},restartEditingSession:function(i){t._initTemplateSelector(),t._bindOverlayEvents(),t._highlightEmptyCols(),e("html").addClass("fl-builder-edit").removeClass("fl-builder-show-admin-bar"),e("body").addClass("fl-builder-edit"),e("#wpadminbar a").attr("tabindex","-1"),e(t._contentClass).addClass("fl-builder-content-editing"),this.showMainToolbar(),i.preventDefault()},onClickPageBuilderToolbarLink:function(e){t.triggerHook("restartEditingSession"),e.preventDefault()},onPublish:function(){var e=this.$wpAdminBar.find("#wp-admin-bar-fl-builder-frontend-edit-link > a span");e.css("color","#6bc373")},hide:function(){e("html").hasClass("fl-builder-edit")&&(t._unbindEvents(),t._destroyOverlayEvents(),t._removeAllOverlays(),e("html").removeClass("fl-builder-edit"),e("body").removeClass("admin-bar"),this.hideMainToolbar(),t.ContentPanel.hide(),FLBuilderLayout.init(),t.triggerHook("didHideEditingUI"))},show:function(){e("html").hasClass("fl-builder-edit")||(t._bindOverlayEvents(),this.showMainToolbar(),FLBuilderResponsiveEditing._switchTo("default"),e("html").addClass("fl-builder-edit"),e("body").addClass("admin-bar"),t.triggerHook("didShowEditingUI"))},beginPreview:function(){t._triggerSettingsSave(!1,!0)&&(this.isPreviewing=!0,this.hide(),e("html").addClass("fl-builder-preview"),e("html, body").removeClass("fl-builder-edit"),t._removeEmptyColHighlights(),t._removeColHighlightGuides(),t.triggerHook("didBeginPreview"),FLBuilderResponsivePreview.enter())},endPreview:function(){this.isPreviewing=!1,this.show(),t._highlightEmptyCols(),FLBuilderResponsivePreview.exit(),e("html").removeClass("fl-builder-preview"),e("html, body").addClass("fl-builder-edit")},togglePreview:function(){this.isPreviewing?this.endPreview():this.beginPreview()},hideMainToolbar:function(){this.$mainToolbar.addClass("is-hidden"),e("html").removeClass("fl-builder-is-showing-toolbar")},showMainToolbar:function(){this.unmuteToolbar(),this.$mainToolbar.removeClass("is-hidden"),e("html").addClass("fl-builder-is-showing-toolbar")},onDeviceIconClick:function(t){var i=e(t.target).data("mode");FLBuilderResponsivePreview.switchTo(i)},muteToolbar:function(){this.$mainToolbarContent.addClass("is-muted"),t._hideTipTips()},unmuteToolbar:function(){this.$mainToolbarContent.removeClass("is-muted")}},n={isEditing:!0,init:function(){history.pushState&&(t.addHook("endEditingSession",this.onLeaveBuilder.bind(this)),t.addHook("restartEditingSession",this.onEnterBuilder.bind(this)))},onEnterBuilder:function(){history.replaceState({},document.title,FLBuilderConfig.editUrl),this.isEditing=!0},onLeaveBuilder:function(){history.replaceState({},document.title,FLBuilderConfig.url),this.isEditing=!1}},r={$row:null,$rowContent:null,row:null,drag:{},init:function(){if(this.userCanResize()){var i=e(t._contentClass);i.delegate(".fl-block-row-resize","mouseenter",this.onDragHandleHover.bind(this)),i.delegate(".fl-block-row-resize","mousedown",this.onDragHandleDown.bind(this))}},userCanResize:function(){return FLBuilderConfig.rowResize.userCanResizeRows},onDragHandleHover:function(t){if(!this.drag.isDragging){var i=e(t.target);this.$row=i.closest(".fl-row"),this.$rowContent=this.$row.find(".fl-row-content"),this.row={node:this.$row.data("node"),isFixedWidth:this.$row.hasClass("fl-row-fixed-width"),settings:e(".fl-builder-row-settings[data-node="+this.$row.data("node")+"]")},this.drag={edge:null,isDragging:!1,originalPosition:null,originalWidth:null,calculatedWidth:null,operation:null},this.row.isFixedWidth?this.drag.originalWidth=this.$row.width():this.drag.originalWidth=this.$rowContent.width(),this.dragInit()}},onDragHandleDown:function(){e("body").addClass("fl-builder-row-resizing")},dragInit:function(e){this.$row.find(".fl-block-row-resize").draggable({axis:"x",start:this.dragStart.bind(this),drag:this.dragging.bind(this),stop:this.dragStop.bind(this)})},dragStart:function(i,l){var s=e("body"),o=e(l.helper);this.drag.isDragging=!0,this.row.isFixedWidth?this.drag.originalWidth=this.$row.width():this.drag.originalWidth=this.$rowContent.width(),o.hasClass("fl-block-col-resize-e")&&(this.drag.edge="e",this.$feedback=o.find(".fl-block-col-resize-feedback-left")),o.hasClass("fl-block-col-resize-w")&&(this.drag.edge="w",this.$feedback=o.find(".fl-block-col-resize-feedback-right")),s.addClass("fl-builder-row-resizing"),t._colResizing=!0,t._destroyOverlayEvents(),t._closePanel()},dragging:function(e,t){var i=t.position.left,l=t.originalPosition.left,s=this.drag.originalWidth,o=0,n=this.drag.edge,r=FLBuilderConfig.rowResize.minAllowedWidth,a=FLBuilderConfig.rowResize.maxAllowedWidth;l!==i&&(FLBuilderConfig.isRtl&&(n="w"==n?"e":"w"),l>i?"w"===n?this.drag.operation="+":this.drag.operation="-":"e"===n?this.drag.operation="+":this.drag.operation="-",o=Math.abs(l-i),"+"===this.drag.operation?this.drag.calculatedWidth=s+2*o:this.drag.calculatedWidth=s-2*o,!1!==r&&this.drag.calculatedWidth<r&&(this.drag.calculatedWidth=r),!1!==a&&this.drag.calculatedWidth>a&&(this.drag.calculatedWidth=a),this.row.isFixedWidth&&this.$row.css("max-width",this.drag.calculatedWidth+"px"),this.$rowContent.css("max-width",this.drag.calculatedWidth+"px"),_.isUndefined(this.$feedback)||this.$feedback.html(this.drag.calculatedWidth+"px").show(),this.row.settings.length&&this.row.settings.find("[name=max_content_width]").val(this.drag.calculatedWidth))},dragStop:function(i,l){this.drag.isDragging=!1,_.isUndefined(this.$feedback)||this.$feedback.hide();var s={action:"resize_row_content",node:this.row.node,width:this.drag.calculatedWidth},o=e("body");t.ajax(s),t._bindOverlayEvents(),o.removeClass("fl-builder-row-resizing"),e(".fl-block-overlay").each(function(){t._buildOverlayOverflowMenu(e(this))}),e("body").removeClass("fl-builder-row-resizing"),setTimeout(function(){t._colResizing=!1},50),t.triggerHook("didResizeRow",{rowId:this.row.node,rowWidth:this.drag.calculatedWidth})}},a={templateName:"fl-toolbar",init:function(){this.template=wp.template(this.templateName),this.render(),this.initTipTips();var e=this.$el.find(".fl-builder-content-panel-button");e.on("click",t._togglePanel),this.$el.find(".fl-builder-buy-button").on("click",t._upgradeClicked),this.$el.find(".fl-builder-upgrade-button").on("click",t._upgradeClicked)},render:function(t){var i=e(this.template(t));this.$el=i,this.el=i.get(0),o.$mainToolbar=this.$el,e("body").prepend(i),e("html").addClass("fl-builder-is-showing-toolbar")},initTipTips:function(){e(".fl-builder--saving-indicator").tipTip({defaultPosition:"bottom",edgeOffset:14}),e(".fl-builder-publish-actions .fl-builder-button-group .fl-builder-button").tipTip({defaultPosition:"bottom",edgeOffset:6})}};e(function(){t.ContentPanel.init(),FLBuilderConfig.simpleUi||t.MainMenu.init(),FLBuilderConfig.showToolbar?(a.init(),t.ContentPanel.alignPanelArrow()):e("html").addClass("fl-builder-no-toolbar"),i.init(),l.init(),o.init(),n.init(),r.init(),s.init(),t.triggerHook("didInitUI")})}(jQuery,FLBuilder),function(e,t){var i=FLExtendableObject.create({templateName:"fl-main-menu-panel-view",name:"Untitled View",isShowing:!1,isRootView:!1,items:{},init:function(){this.template=wp.template(this.templateName)},render:function(){return this.template(this)},bindEvents:function(){this.$items=this.$el.find(".fl-builder--menu-item")},show:function(){this.$el.addClass("is-showing")},hide:function(){this.$el.removeClass("is-showing")},transitionIn:function(e){requestAnimationFrame(this.show.bind(this))},transitionOut:function(e){this.hide()}}),l=FLExtendableObject.create({templateName:"fl-main-menu-panel",template:null,menu:null,views:{},viewNavigationStack:[],isShowing:!1,shouldShowTabs:!1,init:function(){this.template=wp.template(this.templateName),e("body").prepend(this.template(this)),this.$el=e(".fl-builder--main-menu-panel"),this.$el.find(".fl-builder--main-menu-panel-views").html("");for(var i in FLBuilderConfig.mainMenu){this.renderPanel(i);var l="render"+i.charAt(0).toUpperCase()+i.slice(1)+"Panel";t.addHook(l,e.proxy(function(){this.renderPanel(i)},this))}e("body").on("click",".fl-builder--main-menu-panel .pop-view",this.goToPreviousView.bind(this)),this.$tabs=this.$el.find(".fl-builder--tabs > span"),this.$tabs.on("click",this.onItemClick.bind(this)),this.$barTitle=e(".fl-builder-bar-title"),e("body").on("click",".fl-builder-bar-title",this.toggle.bind(this));var n=this.hide.bind(this);t.addHook("didShowPublishActions",n),t.addHook("didBeginSearch",n),t.addHook("didBeginPreview",n),t.addHook("didShowContentPanel",n),t.addHook("endEditingSession",n),t.addHook("didFocusSearchBox",n),t.addHook("didEnterRevisionPreview",n),t.addHook("didFailSettingsSave",n),t.addHook("showKeyboardShortcuts",n),this.$mask=e(".fl-builder--main-menu-panel-mask"),this.$mask.on("click",n),s.init(),o.init()},renderPanel:function(t){var l,s,o;e('fl-builder--main-menu-panel-view[data-name="'+t+'"]').remove(),l=FLBuilderConfig.mainMenu[t],l.handle=t,s=i.create(l),s.init(),o=e(s.render()),s.$el=o,e(".fl-builder--main-menu-panel-views").append(o),s.bindEvents(),s.$el.find(".fl-builder--menu-item").on("click",this.onItemClick.bind(this)),s.isRootView&&(this.rootView=s,this.currentView=s),this.views[t]=s},show:function(){this.isShowing||(this.$el.addClass("is-showing"),this.$barTitle.addClass("is-showing-menu"),this.currentView.transitionIn(),this.isShowing=!0,this.$mask.show(),t.triggerHook("didOpenMainMenu"))},hide:function(){this.isShowing&&(this.$el.removeClass("is-showing"),this.$barTitle.removeClass("is-showing-menu"),this.isShowing=!1,this.resetViews(),this.$mask.hide())},toggle:function(){this.isShowing?this.hide():this.show()},onItemClick:function(i){var l=e(i.currentTarget),s=l.data("type");switch(s){case"view":var o=l.data("view");this.goToView(o);break;case"event":var n=l.data("event");t.triggerHook(n,l);break;case"link":}},goToView:function(e){var t=this.currentView,i=this.views[e];t.transitionOut(),i.transitionIn(),this.currentView=i,this.viewNavigationStack.push(t)},goToPreviousView:function(){var t=this.currentView,i=this.viewNavigationStack.pop();t.transitionOut(!0),i.transitionIn(!0),this.currentView=i,e(".fl-builder-bar-title-caret").focus()},resetViews:function(){this.currentView!=this.rootView&&(this.currentView.hide(),this.rootView.show(),this.currentView=this.rootView,this.viewNavigationStack=[])}});t.MainMenu=l;var s={init:function(){t.addHook("saveTemplate",this.saveTemplate.bind(this)),t.addHook("saveCoreTemplate",this.saveCoreTemplate.bind(this)),t.addHook("duplicateLayout",this.duplicateLayout.bind(this)),t.addHook("showLayoutSettings",this.showLayoutSettings.bind(this)),t.addHook("showGlobalSettings",this.showGlobalSettings.bind(this)),t.addHook("toggleUISkin",this.toggleUISkin.bind(this)),t.addHook("clearLayoutCache",this.clearLayoutCache.bind(this))},saveTemplate:function(){t._saveUserTemplateClicked(),l.hide()},saveCoreTemplate:function(){FLBuilderCoreTemplatesAdmin._saveClicked(),l.hide()},duplicateLayout:function(){t._duplicateLayoutClicked(),l.hide()},showGlobalSettings:function(){t._globalSettingsClicked(),l.hide()},showLayoutSettings:function(){t._layoutSettingsClicked(),l.hide()},clearLayoutCache:function(){t.ajax({action:"clear_cache"},function(){location.href=FLBuilderConfig.editUrl}),t.showAjaxLoader(),l.hide()},toggleUISkin:function(i){e('a[data-event="toggleUISkin"]');if(e("body").hasClass("fl-builder-ui-skin--light"))var l="light",s="dark";if(e("body").hasClass("fl-builder-ui-skin--dark"))var l="dark",s="light";e("body").removeClass("fl-builder-ui-skin--"+l).addClass("fl-builder-ui-skin--"+s),t.ajax({action:"save_ui_skin",skin_name:s})}},o={init:function(){t.addHook("beginTour",this.onStartTourClicked.bind(this))},onStartTourClicked:function(){FLBuilderTour.start(),l.hide()}}}(jQuery,FLBuilder),function(e,t){var i=FLExtendableObject.create({handle:"",name:"",panel:null,shouldShowTabItem:!0,isShowing:!1,views:{},activeView:null,defaultView:null,categorySelector:null,init:function(i){this.categorySelector=a.create({handle:"selector-"+this.handle,
|
8 |
+
tab:this,items:[]}),this.categorySelector.init(),e(this.categorySelector).on("categorySelected",this.onViewSelected.bind(this));i.views;if(this.initViews(i.views),0===Object.keys(this.views).length){var l={handle:"noViews",name:"No Views",templateName:"fl-content-panel-no-view"};this.addView(l)}if(!this.activeView){var s=Object.keys(this.views)[0],l=this.views[s];this.activeView=l}this.defaultView=this.activeView,e(this.panel).on("afterRender",this.renderView.bind(this,this.activeView)),e(this.panel).on("onShow onShowTab",this.initScroller.bind(this)),t.addHook("contentItemsChanged",this.onLibraryDataChanged.bind(this))},initViews:function(e){for(var t in e){var i=e[t];this.categorySelector.addItem(i),"separator"!==i.type&&this.addView(i)}},addView:function(e){var t=l;switch(this.handle){case"modules":t=s;break;case"rows":t=o;break;case"templates":t=n;break;case"saved":t=r;break;default:t=l}_.isNull(this.viewController)||_.isUndefined(this.viewController)||(t=window[this.viewController]);var i=t.create(e),a=i.handle;i.init(),this.views[a]=i,i.isShowing&&(this.activeView=i)},renderView:function(e){if(this.$el=this.panel.$el.find('.fl-builder--panel-view[data-tab="'+this.handle+'"]'),_.isObject(e))var i=e;else var i=this.views[e];if(_.isObject(i)&&_.isFunction(i.render)){var l=i.render();this.$el.find(".fl-nanoscroller-content").html(l),this.activeView=i,t._initSortables(),this===this.panel.activeTab&&this.renderGroupSelector(),this.initScroller(),this.$el.find(".fl-nanoscroller-content").scrollTop(0)}},initScroller:function(){this.$el.nanoScroller({alwaysVisible:!0,preventPageScrolling:!0,paneClass:"fl-nanoscroller-pane",sliderClass:"fl-nanoscroller-slider",contentClass:"fl-nanoscroller-content"})},show:function(){e(this.activeView).trigger("onBeforeShow"),this.renderGroupSelector(),this.isShowing=!0,this.$el.addClass("is-showing"),this.$el.find(".fl-nanoscroller-content").scrollTop(0)},hide:function(){this.isShowing=!1,this.$el.removeClass("is-showing"),this.activeView!==this.defaultView&&this.renderView(this.defaultView),_.isObject(this.categorySelector)&&this.categorySelector.close()},renderGroupSelector:function(){var e=this.panel.$groupSelect,t=this.panel.$el.find(".fl-builder-panel-search");if(this.isSearchEnabled?t.show():t.hide(),Object.keys(this.views).length>1&&!_.isUndefined(this.categorySelector)){var i=this.categorySelector.render();this.panel.$el.find(".fl-builder-content-group-select");e.html(i),e.show(),this.panel.$el.removeClass("single-view")}else e.hide(),t.hide(),this.panel.$el.addClass("single-view")},onViewSelected:function(e,t){this.renderView(t),this.categorySelector.close()},onLibraryDataChanged:function(){this.renderView(this.activeView)}}),l=FLExtendableObject.create({templateName:"",name:"",handle:"",query:null,init:function(){this.template=wp.template(this.templateName),e(this).on("afterRender",this.bindEvents.bind(this)),e(this).trigger("afterInit")},filterTemplateData:function(e){return _.isNull(this.query)||_.isUndefined(this.query)||(e.queryResults=t.Search.byQuery(this.query)),e},render:function(){e(this).trigger("beforeRender");var t=this;t=this.filterTemplateData(t);var i=e(this.template(t));return this.$el=i,e(this).trigger("afterRender"),i},bindEvents:function(){},transitionIn:function(){},transitionOut:function(){}}),s=l.create({templateName:"fl-content-panel-modules-view",bindEvents:function(){this.$sections=this.$el,this.$items=this.$el.find(".fl-builder-block, .fl-builder-blocks-section-title")}}),o=l.create({templateName:"fl-content-panel-row-templates-view",bindEvents:function(){this.$items=this.$el.find(".fl-builder-block, .fl-builder-blocks-section-title")}}),n=l.create({templateName:"fl-content-panel-templates-view",bindEvents:function(){this.$items=this.$el.find(".fl-builder--template-collection-item"),this.$items.on("click",this.onTemplateClick.bind(this)),this.$userTemplateSections=e(".fl-user-templates"),this.$userTemplates=this.$el.find(".fl-user-template, .fl-builder--save-new-user-template"),this.$saveNewTemplateInput=this.$el.find('.fl-save-control input[name="template-name"]'),this.$saveNewTemplateCat=this.$el.find('.fl-save-control input[name="template-category"]'),this.$saveNewTemplateBtn=this.$el.find(".fl-save-control button"),this.$saveNewMask=this.$el.find(".fl-save-control-mask"),this.$saveNewTemplateInput.on("focus",this.onSaveInputFocus.bind(this)),this.$saveNewTemplateInput.on("keyup",this.onSaveInputKeyup.bind(this)),this.$saveNewTemplateBtn.on("click",this.onSaveButtonClick.bind(this)),this.$saveNewMask.on("click",this.resetSaveInput.bind(this))},onSaveInputFocus:function(){this.resetSaveInput(),this.$saveNewMask.show()},resetSaveInput:function(){this.$saveNewTemplateInput.val(""),this.$saveNewTemplateBtn.hide(),this.$saveNewMask.hide()},onSaveInputKeyup:function(t){var i=e(t.currentTarget),l=i.val(),s=i.siblings("button");""!==l?s.show():s.hide()},onSaveButtonClick:function(i){var l=e(i.currentTarget),s=l.siblings('input[name="template-name"]').val(),o=l.siblings('input[name="template-category"]').val(),n={name:s,category:o};""!==s&&t.ajax({action:"save_user_template",settings:n},t._saveUserTemplateSettingsComplete)},onTemplateClick:function(i){var l=e(i.currentTarget),s=l.data("id"),o=l.data("type");t._requestTemplateInsert(s,o)}}),r=l.create({templateName:"fl-content-panel-saved-view",filterTemplateData:function(e){return e.queryResults=t.Search.byQuery({kind:"template",type:"user",content:["module","row"]}),e}}),a=FLExtendableObject.create({templateName:"fl-content-panel-category-selector",template:null,tab:null,isOpen:!1,items:{},init:function(){this.template=wp.template(this.templateName),e(this).on("afterRender",this.bindEvents.bind(this)),e(this.tab.panel).on("didShowSearchControls",this.close.bind(this))},render:function(){this.close();var t=e(this.template(this));return this.$el=t,e(this).trigger("afterRender"),t},bindEvents:function(){this.$selectorTitle=this.$el.find(".fl-builder--selector-display"),this.$selectorTitle.on("click",this.toggleOpenClose.bind(this)),this.$categories=this.$el.find(".fl-builder--selector-menu .fl-builder--menu-item"),this.$categories.on("click",this.onCategoryClick.bind(this))},addItem:function(e){var t;t=_.isUndefined(e.handle)?_.uniqueId("sep_"):e.handle,this.items[t]=e},open:function(){this.isOpen||(this.$el.addClass("is-showing"),this.isOpen=!0)},close:function(){this.isOpen&&(this.$el.removeClass("is-showing"),this.isOpen=!1,this.$selectorTitle.find("button").focus())},toggleOpenClose:function(){this.isOpen?this.close():this.open()},onCategoryClick:function(t){var i=e(t.target).data("view");e(this).trigger("categorySelected",i)}});t.ContentPanel=FLExtendableObject.create({templateName:"fl-content-panel-base",template:null,tabs:{},activeTab:null,isShowing:!1,init:function(){if(FLBuilderConfig.panelData){var e=FLBuilderConfig.panelData.tabs;for(var l in e){var s=e[l];if(n=i.create(s),n.panel=this,n.views={},n.init(s),this.tabs[l]=n,n.isShowing&&(this.activeTab=n),!this.activeTab){var o=Object.keys(this.tabs)[0],n=this.tabs[o];n.isShowing=!0,this.activeTab=n}}this.template=wp.template(this.templateName),this.render(),this.renderSearchResults=wp.template("fl-search-results-panel"),this.renderNoResults=wp.template("fl-search-no-results"),t.triggerHook("contentPanelDidInit")}},render:function(){e("body").prepend(this.template(this)),this.$el=e(".fl-builder--content-library-panel"),this.bindEvents(),this.$groupSelect=this.$el.find(".fl-builder-content-group-select"),e(this).trigger("afterRender")},bindEvents:function(){this.$tabs=this.$el.find(".fl-builder--tabs [data-tab]"),this.$tabs.on("mouseup",this.onTabItemMouseUp.bind(this)),this.$tabs.on("click",this.onTabItemClick.bind(this)),this.$search=this.$el.find(".fl-builder-panel-search"),this.$searchBtn=this.$search.find(".fl-builder-toggle-panel-search"),this.$searchInput=this.$search.find('input[name="search-term"]'),this.$searchBtn.on("click",this.onSearchButtonClicked.bind(this)),this.$search.find(".fl-builder-dismiss-panel-search").on("click",this.onDismissButtonClicked.bind(this)),this.$searchInput.on("keyup",this.onSearchTermChanged.bind(this)),this.$searchPanel=this.$el.find(".fl-builder--search-results-panel"),t.addHook("showContentPanel",this.show.bind(this)),t.addHook("showModules",this.show.bind(this,"modules")),t.addHook("showRows",this.show.bind(this,"rows")),t.addHook("showTemplates",this.show.bind(this,"templates")),t.addHook("showSaved",this.show.bind(this,"saved")),t.addHook("showSearch",this.goToSearch.bind(this));var e=this.hide.bind(this);t.addHook("hideContentPanel",e),t.addHook("didShowLightbox",e),t.addHook("didShowPublishActions",e),t.addHook("didBeginSearch",e),t.addHook("didInitDrag",e),t.addHook("didOpenMainMenu",e),t.addHook("didApplyTemplate",e);var i=this.toggleShowHide.bind(this);t.addHook("toggleContentPanel",i),t.addHook("didStopDrag",this.hideSearchControls.bind(this))},alignPanelArrow:function(){var t,i,l=this.$el,s=null,o=this.$el.find(".fl-builder--panel-arrow"),n=e(".fl-builder-content-panel-button"),r=this.$el.css("animation-duration");if(0!=n.length){this.$el.css("animation-duration","0s"),this.show(),s=l[0].getBoundingClientRect(),t=o[0].getBoundingClientRect(),this.hide(),this.$el.css("animation-duration",r),buttonOffset=n[0].getBoundingClientRect();var a=buttonOffset.x+buttonOffset.width/2;i=a<s.x?20:a-s.x-t.width/2,o.css({right:"auto",left:i+"px"})}},show:function(i){"module"===FLBuilderConfig.userTemplateType||FLBuilderConfig.simpleUi||(t.triggerHook("willShowContentPanel"),"undefined"!=typeof i&&this.showTab(i),this.isShowing||t._triggerSettingsSave(!1,!0)&&(e("body").addClass("fl-builder-content-panel-is-showing"),this.isShowing=!0,e(this).trigger("onShow"),t.triggerHook("didShowContentPanel")))},hide:function(){this.isShowing&&(this.$el.hasClass("fl-builder-ui-pinned")||(e("body").removeClass("fl-builder-content-panel-is-showing"),this.isShowing=!1,e(this).trigger("onHide"),t.triggerHook("didHideContentPanel")))},toggleShowHide:function(){this.isShowing?this.hide():this.show()},showTab:function(t){var i=this.tabs[t];_.isObject(i)&&(_.isObject(this.activeTab)&&(this.activeTab.hide(),this.$tabs.filter(".is-showing").removeClass("is-showing")),this.hideSearchControls(),i.show(),this.$tabs.filter('[data-tab="'+i.handle+'"]').addClass("is-showing"),this.activeTab=i,e(this).trigger("onShowTab"))},goToSearch:function(){this.show("modules"),this.$el.find(".fl-builder-toggle-panel-search").trigger("click")},onTabItemMouseUp:function(t){e(t.currentTarget).blur()},onTabItemClick:function(t){var i=e(t.target),l=i.data("tab");this.showTab(l)},onSearchButtonClicked:function(){this.showSearchControls()},onDismissButtonClicked:function(){this.hideSearchControls(),this.$searchBtn.focus()},showSearchControls:function(){this.$search.addClass("is-showing-input"),this.$search.find('input[name="search-term"]').focus(),e(".fl-builder--selector-display-label").attr("tabindex",-1),this.$searchBtn.attr("tabindex",-1),e(this).trigger("didShowSearchControls")},hideSearchControls:function(){this.$search.removeClass("is-showing-input"),this.clearSearchInput(),this.hideSearchResults(),e(".fl-builder--selector-display-label").attr("tabindex",null),this.$searchBtn.attr("tabindex",null)},onSearchTermChanged:function(e){var i=this.$searchInput.val();if(""!==i){var l=t.Search.byTerm(i);""!=l.term?this.showSearchResults(l):this.hideSearchResults()}else this.hideSearchResults()},clearSearchInput:function(){this.$searchInput.val(""),this.hideSearchResults()},showSearchResults:function(i){if(i.total>0){var l=e(this.renderSearchResults(i));this.$searchPanel.html(l),t._initSortables()}else{var l=e(this.renderNoResults(i));this.$searchPanel.html(l)}e("body").addClass("fl-builder-search-results-panel-is-showing")},hideSearchResults:function(){e("body").removeClass("fl-builder-search-results-panel-is-showing")}})}(jQuery,FLBuilder),function(e){FLBuilderSettingsForms={config:null,settings:null,legacyXhr:null,init:function(){this.bind()},bind:function(){FLBuilder.addHook("didDeleteRow",this.closeOnDeleteNode),FLBuilder.addHook("didDeleteColumn",this.closeOnDeleteNode),FLBuilder.addHook("didDeleteModule",this.closeOnDeleteNode)},render:function(t,i){var l=FLBuilderSettingsConfig.forms,s=FLBuilderSettingsConfig.modules,o={type:"general",id:null,nodeId:null,className:"",attrs:"",title:"",badges:[],tabs:[],buttons:[],settings:{},legacy:null,rules:null,preview:null,helper:null};if(t.nodeId&&!t.settings)return void this.loadNodeSettings(t,i);if(t=e.extend(o,t),i=void 0===i?function(){}:i,t.id){if("general"===t.type&&void 0!==l[t.id])t=e.extend(!0,t,l[t.id]);else{if("module"!==t.type||void 0===s[t.id])return;t=e.extend(!0,t,s[t.id])}this.config=t,this.renderLightbox(t)&&(t.legacy||!this.renderLegacySettings(t,i)?this.renderComplete(t,i):this.showLightboxLoader())}},loadNodeSettings:function(e,t){FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"get_node_settings",node_id:e.nodeId},function(i){e.settings=JSON.parse(i),FLBuilderSettingsConfig.nodes[e.nodeId]=e.settings,FLBuilderSettingsForms.render(e,t),FLBuilder.hideAjaxLoader()})},renderLightbox:function(t){var i=wp.template("fl-builder-settings"),l=FLBuilder._lightbox._node.find("form.fl-builder-settings");e(".fl-lightbox-wrap[data-parent]");if(t.nodeId&&t.nodeId===l.data("node")&&!t.lightbox)return FLBuilder._focusFirstSettingsControl(),!1;if(t.lightbox)t.lightbox.setContent(i(t));else{if(!FLBuilder._triggerSettingsSave(!0,!0))return!1;FLBuilder.preview&&FLBuilder.preview.cancel(),FLBuilder._closePanel(),FLBuilder._showLightbox(),FLBuilder._setLightboxContent(i(t))}return!0},renderComplete:function(t,i){var l=e(".fl-builder-settings:visible");setTimeout(function(){t.legacy&&this.renderLegacySettingsComplete(t.legacy),i(),FLBuilder._initSettingsForms(),t.rules&&FLBuilder._initSettingsValidation(t.rules),t.preview&&(FLBuilder.preview=new FLBuilderPreview(t.preview)),t.helper&&t.helper.init(),l.closest(".fl-lightbox-wrap[data-parent]").length||(this.settings=FLBuilder._getSettings(l))}.bind(this),1)},renderFields:function(t,i){var l=wp.template("fl-builder-settings-row"),s="",o=null,n=null,r=null,a=!1,d=null,u=["dimension","unit"],i=i?i:this.config.settings,c=FLBuilderConfig.global;for(n in t)o=t[n],a=!!o.multiple,supportsResponsive=e.inArray(o.type,u)>-1,r=_.isUndefined(i[n])?"":i[n],_.isUndefined(i[n])&&o["default"]&&(r=o["default"]),d=o.responsive&&c.responsive_enabled&&!a&&supportsResponsive?o.responsive:null,s+=l({field:o,name:n,rootName:n,value:r,preview:JSON.stringify(o.preview?o.preview:{type:"refresh"}),responsive:d,rowClass:o.row_class?" "+o.row_class:"",isMultiple:a,supportsMultiple:"editor"!==o.type&&"photo"!==o.type&&"service"!==o.type,settings:i,globalSettings:c,template:e("#tmpl-fl-builder-field-"+o.type)});return s},renderField:function(e){var t=wp.template("fl-builder-field");return t(e)},renderSectionTemplate:function(e,t){var i=wp.template(e.template.id);return i({section:e,settings:t})},renderTabTemplate:function(e,t){var i=wp.template(e.template.id);return i({tab:e,settings:t})},renderLegacySettings:function(t,i){var l=e(".fl-builder-settings:visible"),s=null,o=!1,n={tabs:[],sections:[],fields:[],settings:null,node_id:null};return l.find(".fl-legacy-field").each(function(){s=e(this),n.fields.push(s.attr("data-field")),FLBuilderSettingsForms.showFieldLoader(s),o=!0}),l.find(".fl-legacy-settings-section").each(function(){s=e(this),n.sections.push({tab:s.attr("data-tab"),section:s.attr("data-section")}),o=!0}),l.find(".fl-legacy-settings-tab").each(function(){s=e(this),n.tabs.push(s.attr("data-tab")),o=!0}),l.attr("data-node")?n.node_id=l.attr("data-node"):n.settings=FLBuilder._getOriginalSettings(l,!0),this.legacyXhr&&(this.legacyXhr.abort(),this.legacyXhr=null),this.legacyXhr=FLBuilder.ajax(e.extend(this.getLegacyVars(),{action:"render_legacy_settings",data:n,form:l.attr("data-form-id"),group:l.attr("data-form-group"),lightbox:l.closest(".fl-builder-lightbox").attr("data-instance-id")}),function(e){FLBuilderSettingsForms.renderLegacySettingsComplete(e),o&&FLBuilderSettingsForms.renderComplete(t,i),FLBuilderSettingsForms.hideLightboxLoader()}),o},renderLegacySettingsComplete:function(t){var i="object"==typeof t?t:JSON.parse(t),l=null,s=null,o="",n=null,r=null,a=null;if(i.lightbox?(l=e(".fl-builder-lightbox[data-instance-id="+i.lightbox+"]"),s=l.length?l.find(".fl-builder-settings"):null):(s=e(".fl-builder-settings:visible"),l=s.closest(".fl-builder-lightbox")),s&&s.length){for(o in i.fields)n=e("#fl-field-"+o).attr("id",""),n.after(i.fields[o]).remove();for(o in i.extras)n=e("#fl-field-"+o).find(".fl-field-control-wrapper"),n.prepend(i.extras[o].before),n.append(i.extras[o].after);for(a in i.sections)for(o in i.sections[a])r=e("#fl-builder-settings-section-"+o),r.html(i.sections[a][o]);for(o in i.tabs)a=e("#fl-builder-settings-tab-"+o),a.html(i.tabs[o]);l.data("parent")||(this.settings=FLBuilder._getSettings(s),FLBuilder.preview&&(FLBuilder.preview._savedSettings=this.settings)),_.isUndefined(window.FLThemeBuilderFieldConnections)||FLThemeBuilderFieldConnections._initSettingsForms(),this.legacyXhr=null}},getLegacyVars:function(){var t=e(".fl-builder-settings:visible"),i=t.closest(".fl-builder-lightbox"),l=i.attr("data-parent"),s=null,o=null,n={};return l&&(l=e(".fl-builder-lightbox[data-instance-id="+l+"]"),t=l.find("form.fl-builder-settings"),s=FLBuilder._getSettings(t),o=t.attr("data-node"),o&&(n.node_id=o,n.node_settings=s)),n},settingsHaveChanged:function(){var e=FLBuilder._lightbox._node.find("form.fl-builder-settings"),t=FLBuilder._getSettings(e),i=!!this.settings&&JSON.stringify(this.settings)!=JSON.stringify(t);return i},closeOnDeleteNode:function(t,i){var l=e(".fl-builder-settings[data-node]"),s=FLBuilder._contentClass+" .fl-node-"+l.data("node");l.length&&!e(s).length&&FLLightbox.closeAll()},showLightboxLoader:function(){e(".fl-builder-settings:visible").append('<div class="fl-builder-loading"></div>')},hideLightboxLoader:function(t){e(".fl-builder-settings:visible .fl-builder-loading").remove()},showFieldLoader:function(e){var t=e.closest(".fl-field-control").find(".fl-field-control-wrapper");t.hide().after('<div class="fl-field-loader">'+FLBuilderStrings.fieldLoading+"</div>")},hideFieldLoader:function(e){var t=e.closest(".fl-field"),i=e.closest(".fl-field-control").find(".fl-field-control-wrapper");i.show(),t.find(".fl-field-loader").remove()}},FLBuilderSettingsConfig="undefined"==typeof FLBuilderSettingsConfig?{}:FLBuilderSettingsConfig,e.extend(FLBuilderSettingsConfig,{init:function(){FLBuilder.addHook("didSaveNodeSettings",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didSaveNodeSettingsComplete",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didSaveGlobalSettingsComplete",this.updateOnSaveGlobalSettings.bind(this)),FLBuilder.addHook("didSaveLayoutSettingsComplete",this.updateOnSaveLayoutSettings.bind(this)),FLBuilder.addHook("didAddRow",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didAddColumnGroup",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didAddColumn",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didAddModule",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didDeleteRow",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didDeleteColumn",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didDeleteModule",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didDuplicateRow",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didDuplicateColumn",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didDuplicateModule",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didResizeRow",this.updateOnRowResize.bind(this)),FLBuilder.addHook("didResizeColumn",this.updateOnColumnResize.bind(this)),FLBuilder.addHook("didResetRowWidth",this.updateOnResetRowWidth.bind(this)),FLBuilder.addHook("didResetColumnWidths",this.updateOnResetColumnWidths.bind(this)),FLBuilder.addHook("didApplyTemplateComplete",this.updateOnApplyTemplate.bind(this)),FLBuilder.addHook("didApplyRowTemplateComplete",this.updateOnApplyTemplate.bind(this)),FLBuilder.addHook("didSaveGlobalNodeTemplate",this.updateOnApplyTemplate.bind(this)),FLBuilder.addHook("didRestoreRevisionComplete",this.updateOnApplyTemplate.bind(this))},updateOnSaveGlobalSettings:function(e,t){this.settings.global=t},updateOnSaveLayoutSettings:function(e,t){this.settings.layout=t},updateOnNodeEvent:function(){var e=arguments[0];e.namespace.indexOf("didAdd")>-1?this.addNode(arguments[1]):e.namespace.indexOf("didSaveNodeSettings")>-1?this.updateNode(arguments[1].nodeId,arguments[1].settings):e.namespace.indexOf("didDelete")>-1?this.deleteNodes():e.namespace.indexOf("didDuplicate")>-1&&this.duplicateNode(arguments[1].oldNodeId,arguments[1].newNodeId)},updateOnRowResize:function(e,t){this.nodes[t.rowId].max_content_width=t.rowWidth},updateOnResetRowWidth:function(e,t){this.nodes[t].max_content_width=""},updateOnColumnResize:function(e,t){this.nodes[t.colId].size=t.colWidth,this.nodes[t.siblingId].size=t.siblingWidth},updateOnResetColumnWidths:function(t,i){var l=this;i.cols.each(function(){var t=e(this),i=t.attr("data-node");l.nodes[i]&&(l.nodes[i].size=parseFloat(t[0].style.width))})},updateOnApplyTemplate:function(e,t){this.nodes=t.nodes,this.attachments=t.attachments},addNode:function(t,i){var l=e(".fl-node-"+t),s=l.hasClass("fl-row"),o=l.hasClass("fl-col"),n=l.hasClass("fl-col-group"),r=l.hasClass("fl-module"),a=this;this.nodes[t]||(i||(s?i=e.extend({},this.defaults.row):o?i=e.extend({},this.defaults.column):r&&(i=e.extend({},this.defaults.modules[l.attr("data-type")])),s||n?l.find(".fl-col").each(function(){var t=e(this),i=e.extend({},a.defaults.column);i.size=parseFloat(t[0].style.width),a.addNode(t.attr("data-node"),i)}):r&&(a.addNode(l.closest(".fl-row").attr("data-node")),a.addNode(l.closest(".fl-col").attr("data-node")),a.updateOnResetColumnWidths(null,{cols:l.closest(".fl-col-group").find("> .fl-col")}))),i&&(this.nodes[t]=i))},updateNode:function(t,i){var l=e(".fl-node-"+t),s=this;l.hasClass("fl-col")&&l.closest(".fl-col-group").find("> .fl-col").each(function(){var t=e(this),l=t.attr("data-node");s.nodes[l].size=parseFloat(t[0].style.width),s.nodes[l].equal_height=i.equal_height,s.nodes[l].content_alignment=i.content_alignment,s.nodes[l].responsive_order=i.responsive_order}),this.nodes[t]=i},duplicateNode:function(t,i){var l=e(".fl-node-"+i),s=l.find("[data-node]"),o=e(".fl-node-"+t),n=o.find("[data-node]"),r=this;this.nodes[i]=this.nodes[t],s.each(function(l){t=n.eq(l).attr("data-node"),i=e(this).attr("data-node"),r.nodes[t]&&(r.nodes[i]=r.nodes[t])})},deleteNodes:function(){var t="",i=e(FLBuilder._contentClass).html();for(t in this.nodes)i.indexOf(t)===-1&&(this.nodes[t]=null,delete this.nodes[t])}}),e(function(){FLBuilderSettingsConfig.init(),FLBuilderSettingsForms.init()})}(jQuery),function(e){var t={init:function(){"module"===FLBuilderConfig.userTemplateType||FLBuilderConfig.simpleUi||(this.initPanel(),this.pinOrUnpin(),this.bind())},bind:function(){var t=e(window),i=e("body");t.on("resize",_.throttle(this.windowResize.bind(this),250)),i.delegate(".fl-builder-ui-pinned-collapse","click",this.collapse),i.delegate(".fl-builder--content-library-panel .fl-builder--tabs","click",this.closeLightboxOnPanelClick),FLBuilder.addHook("didShowLightbox",this.pinLightboxOnOpen.bind(this)),FLBuilder.addHook("didHideAllLightboxes",this.pinnedLightboxClosed.bind(this)),FLBuilder.addHook("endEditingSession",this.hide.bind(this)),FLBuilder.addHook("didHideEditingUI",this.hide.bind(this)),FLBuilder.addHook("publishButtonClicked",this.hide.bind(this)),FLBuilder.addHook("restartEditingSession",this.show.bind(this)),FLBuilder.addHook("didShowEditingUI",this.show.bind(this)),FLBuilder.addHook("didShowLightbox",this.uncollapse.bind(this)),FLBuilder.addHook("willShowContentPanel",this.uncollapse.bind(this)),FLBuilder.addHook("willShowContentPanel",this.closeLightboxOnPanelClick.bind(this))},isPinned:function(){return e(".fl-builder--content-library-panel").hasClass("fl-builder-ui-pinned")},pin:function(e,t){this.pinPanel(e),this.pinLightboxes(),t&&this.savePosition(),FLBuilder._resizeLayout()},unpin:function(e){this.unpinLightboxes(),this.unpinPanel(),e&&this.savePosition(),FLBuilder._resizeLayout()},pinOrUnpin:function(){var t=e(".fl-builder--content-library-panel"),i=this.isPinned();t.hasClass("fl-builder-ui-pinned-hidden")||(window.innerWidth<=500?(i&&this.unpin(!1),this.disableDragAndResize()):(i||this.restorePosition(),this.enableDragAndResize()))},show:function(){var t=e(".fl-builder--content-library-panel");t.hasClass("fl-builder-ui-pinned-hidden")&&(t.removeClass("fl-builder-ui-pinned-hidden"),t.show(),this.restorePosition())},hide:function(){var t=e("body"),i=e(".fl-builder--content-library-panel");this.isPinned()&&(this.uncollapse(),i.addClass("fl-builder-ui-pinned-hidden"),i.hide(),t.css("margin",""),FLBuilder._resizeLayout())},collapse:function(){var t=e(this).find("i:visible"),i=e("body"),l=t.data("toggle"),s=t.data("position"),o=e(".fl-builder--content-library-panel"),n=o.outerWidth();"hide"===l?(o.css(s,"-"+n+"px"),i.css("margin-"+s,""),i.addClass("fl-builder-ui-pinned-is-collapsed")):(o.css(s,"0px"),i.css("margin-"+s,n+"px"),i.removeClass("fl-builder-ui-pinned-is-collapsed"))},uncollapse:function(){this.isCollapsed()&&e(".fl-builder-ui-pinned-collapse:visible").trigger("click")},isCollapsed:function(){return e("body").hasClass("fl-builder-ui-pinned-is-collapsed")},initPanel:function(){var t=e(".fl-builder--content-library-panel");t.draggable({cursor:"move",handle:".fl-builder--tabs",cancel:".fl-builder--tabs button",scroll:!1,drag:this.drag.bind(this),stop:this.dragStop.bind(this),start:this.dragStart.bind(this)}).resizable({handles:"e, w",minHeight:400,minWidth:380,maxWidth:500,start:this.resizeStart.bind(this),stop:this.resizeStop.bind(this)}),t.addClass("fl-builder-ui-pinned-container"),t.find(".ui-resizable-e, .ui-resizable-w").hide()},pinPanel:function(t){var i=e(".fl-builder--content-library-panel"),l=i.width(),s=e("body"),o=e(".fl-responsive-preview, .fl-responsive-preview-mask"),n=e(FLBuilder._contentClass).parentsUntil("body").last();s.addClass("fl-builder-ui-is-pinned fl-builder-ui-is-pinned-"+t),s.addClass("fl-builder-content-panel-is-showing"),s.css("margin-"+t,l+"px"),o.css("margin-"+t,l+"px"),n.addClass("fl-builder-ui-pinned-content-transform"),i.addClass("fl-builder-ui-pinned fl-builder-ui-pinned-"+t),i.find(".ui-resizable-"+("left"===t?"e":"w")).show(),i.on("resize",_.throttle(this.resize.bind(this),250)),i.attr("style",""),FLBuilder.ContentPanel.isShowing=!0},unpinPanel:function(){var t=e(".fl-builder--content-library-panel"),i=t.find(".fl-builder--panel-content .is-showing").data("tab"),l=e("body"),s=e(".fl-responsive-preview, .fl-responsive-preview-mask"),o=e(FLBuilder._contentClass).parentsUntil("body").last();l.css("margin-left",""),l.css("margin-right",""),l.removeClass("fl-builder-ui-is-pinned"),l.removeClass("fl-builder-ui-is-pinned-left"),l.removeClass("fl-builder-ui-is-pinned-right"),s.css("margin-left",""),s.css("margin-right",""),o.removeClass("fl-lightbox-content-transform"),t.removeClass("fl-builder-ui-pinned"),t.removeClass("fl-builder-ui-pinned-left"),t.removeClass("fl-builder-ui-pinned-right"),t.find(".ui-resizable-handle").hide(),t.off("resize"),t.attr("style",""),t.find(".fl-builder--tabs [data-tab="+i+"]").addClass("is-showing")},pinLightboxes:function(){var t=this;e(".fl-lightbox-resizable").each(function(){t.pinLightbox(e(this))}),FLBuilder._reinitEditorFields()},pinLightbox:function(t){var i=e(".fl-builder--content-library-panel"),l=t.closest(".fl-lightbox-wrap");l.closest(".fl-builder-ui-pinned").length||(i.append(l),t.attr("style",""),t.draggable("disable"),t.resizable("disable")),t.is(":visible")&&i.find(".fl-builder--tabs .is-showing").removeClass("is-showing")},pinLightboxOnOpen:function(e,t){var i=t._node.find(".fl-lightbox-resizable");i.length&&(i.hasClass("fl-builder-ui-pinning-initialized")||(i.draggable("option","start",this.dragStart.bind(this)),i.draggable("option","drag",this.drag.bind(this)),i.draggable("option","stop",this.dragStop.bind(this)),i.addClass("fl-builder-ui-pinning-initialized")),this.isPinned()&&this.pinLightbox(i),FLBuilder.addHook("responsive-editing-switched",this.resize))},pinnedLightboxClosed:function(){var t=e(".fl-builder--content-library-panel");tab=null,this.isPinned()&&(tab=t.find(".fl-builder--panel-content .is-showing").data("tab"),t.find(".fl-builder--tabs [data-tab="+tab+"]").addClass("is-showing")),e(".fl-lightbox").removeClass("fl-lightbox-prevent-animation")},unpinLightboxes:function(){var t=e("body"),i=e(".fl-builder--content-library-panel");i.find(".fl-lightbox-wrap").each(function(){var l=e(this),s=l.find(".fl-lightbox"),o=0,n=0,r=0;s.draggable("enable"),s.resizable("enable"),s.find(".ui-resizable-handle").show(),t.append(l),s.is(":visible")?(o=parseInt(i.css("top"))-parseInt(l.css("top"))-parseInt(l.css("padding-top")),n=parseInt(i.css("left"))-parseInt(l.css("padding-left")),r=parseInt(i.css("right"))-parseInt(l.css("padding-right")),s.css("top",(o<0?0:o)+"px"),s.css(FLBuilderConfig.isRtl?"right":"left",(FLBuilderConfig.isRtl?r:n)+"px"),s.addClass("fl-lightbox-prevent-animation"),t.removeClass("fl-builder-content-panel-is-showing"),FLBuilder.ContentPanel.isShowing=!1):s.css({top:"25px",left:"25px"})}),FLBuilder._reinitEditorFields()},closeLightboxOnPanelClick:function(){FLBuilder._triggerSettingsSave(!1,!0)},windowResize:function(){this.pinOrUnpin()},resizeStart:function(){e("body").addClass("fl-builder-resizable-is-resizing"),FLBuilder._destroyOverlayEvents(),FLBuilder._removeAllOverlays()},resize:function(){var t=e("body"),i=e(".fl-responsive-preview, .fl-responsive-preview-mask"),l=e(".fl-builder--content-library-panel"),s=l.outerWidth();l.hasClass("fl-builder-ui-pinned-left")?(t.css("margin-left",s+"px"),i.css("margin-left",s+"px")):l.hasClass("fl-builder-ui-pinned-right")&&(t.css("margin-right",s+"px"),i.css("margin-right",s+"px"))},resizeStop:function(){e("body").removeClass("fl-builder-resizable-is-resizing"),FLBuilder._bindOverlayEvents(),FLBuilder._resizeLayout(),this.savePosition()},dragStart:function(t,i){var l=e("body"),s=(e(t.target),e(".fl-builder-bar-actions"));e(".fl-lightbox-resizable:visible").length||s.addClass("fl-builder-content-panel-pin-zone"),l.addClass("fl-builder-draggable-is-dragging"),l.append('<div class="fl-builder-ui-pin-zone fl-builder-ui-pin-zone-left"></div>'),l.append('<div class="fl-builder-ui-pin-zone fl-builder-ui-pin-zone-right"></div>'),FLBuilder._destroyOverlayEvents()},drag:function(t,i){var l=e("body"),s=e(".fl-responsive-preview"),o=e(window),n=s.length?s.width():o.width(),r=o.scrollTop(),a=e(".fl-builder--content-library-panel"),d=a.offset().top,u=e(".fl-builder-bar-actions"),c=e(t.target);c.hasClass("fl-builder--content-library-panel")&&(t.clientX<n-75&&d-r<46?u.addClass("fl-builder-content-panel-pin-zone-hover"):u.removeClass("fl-builder-content-panel-pin-zone-hover")),c.hasClass("fl-builder-ui-pinned")?this.unpinPanel():t.clientX<75?l.addClass("fl-builder-ui-show-pin-zone fl-builder-ui-show-pin-zone-left"):t.clientX>n-75?l.addClass("fl-builder-ui-show-pin-zone fl-builder-ui-show-pin-zone-right"):(l.removeClass("fl-builder-ui-show-pin-zone"),l.removeClass("fl-builder-ui-show-pin-zone-left"),l.removeClass("fl-builder-ui-show-pin-zone-right"))},dragStop:function(t,i){var l=(e(window),e("body")),s=e(".fl-builder-bar-actions"),o=e(".fl-builder-ui-pin-zone"),n=e(".fl-builder--content-library-panel"),r=e(".fl-lightbox-resizable:visible");e(t.target);l.removeClass("fl-builder-draggable-is-dragging"),s.removeClass("fl-builder-content-panel-pin-zone"),s.removeClass("fl-builder-content-panel-pin-zone-hover"),o.remove(),r.length&&parseInt(r.css("top"))<0&&r.css("top","0"),l.hasClass("fl-builder-ui-show-pin-zone")?(l.hasClass("fl-builder-ui-show-pin-zone-left")?this.pin("left",!0):this.pin("right",!0),l.removeClass("fl-builder-ui-show-pin-zone"),
|
9 |
+
l.removeClass("fl-builder-ui-show-pin-zone-left"),l.removeClass("fl-builder-ui-show-pin-zone-right")):n.find(".fl-lightbox").length?this.unpin(!0):(n.attr("style",""),this.savePosition()),FLBuilder._bindOverlayEvents()},disableDragAndResize:function(){var t=e(".fl-builder--content-library-panel"),i=e(".fl-lightbox-resizable");t.draggable("disable"),t.resizable("disable"),i.draggable("disable"),i.resizable("disable")},enableDragAndResize:function(){var t=e(".fl-builder--content-library-panel"),i=e(".fl-lightbox-resizable:not(.fl-lightbox-width-full)");t.draggable("enable"),t.resizable("enable"),this.isPinned()||(i.draggable("enable"),i.resizable("enable"))},savePosition:function(){var t=e(".fl-builder--content-library-panel"),i=e(".fl-lightbox-resizable:visible"),l={pinned:{width:t.width(),position:null}};t.hasClass("fl-builder-ui-pinned-left")?l.pinned.position="left":t.hasClass("fl-builder-ui-pinned-right")?l.pinned.position="right":i.length&&(l.lightbox={width:i.width(),height:i.height(),top:parseInt(i.css("top"))<0?"0px":i.css("top"),left:i.css("left")}),FLBuilderConfig.userSettings.pinned=l.pinned,l.lightbox&&(FLBuilderConfig.userSettings.lightbox=l.lightbox),FLBuilder.ajax({action:"save_pinned_ui_position",data:l})},restorePosition:function(){var t=e(".fl-builder--content-library-panel"),i=FLBuilderConfig.userSettings.pinned;i&&i.position&&(t.width(i.width),this.pin(i.position,!1),t.width(i.width))}};e(function(){t.init()})}(jQuery),function(e){var t={init:function(){this.setupMainMenuData(),e(".fl-builder--revision-actions select").on("change",this.selectChanged),e(".fl-cancel-revision-preview").on("click",this.exitPreview.bind(this)),e(".fl-apply-revision-preview").on("click",this.applyClicked.bind(this)),FLBuilder.addHook("revisionItemClicked",this.itemClicked.bind(this)),FLBuilder.addHook("didPublishLayout",this.refreshItems.bind(this))},setupMainMenuData:function(){var t=FLBuilderConfig.revisions.posts,i=FLBuilderConfig.revisions.authors,l=wp.template("fl-revision-list-item"),s=e(".fl-builder--revision-actions select"),o="",n="",r=0;if(FLBuilderConfig.mainMenu.revisions.items=[],s.html(""),0===t.length)FLBuilderConfig.mainMenu.revisions.items.push({eventName:"noRevisionsMessage",type:"event",label:wp.template("fl-no-revisions-message")()});else for(;r<t.length;r++)o=FLBuilderStrings.revisionDate.replace("%s",t[r].date.diff),o+=" ("+t[r].date.published+")",n=FLBuilderStrings.revisionAuthor.replace("%s",i[t[r].author].name),FLBuilderConfig.mainMenu.revisions.items.push({eventName:"revisionItemClicked",type:"event",label:l({id:t[r].id,date:o,author:n,avatar:i[t[r].author].avatar})}),s.append('<option value="'+t[r].id+'">'+o+"</option>");FLBuilder.triggerHook("renderRevisionsPanel")},refreshItems:function(){FLBuilder.ajax({action:"refresh_revision_items"},this.refreshItemsComplete.bind(this))},refreshItemsComplete:function(e){FLBuilderConfig.revisions=JSON.parse(e),this.setupMainMenuData()},itemClicked:function(t,i){var l=e(i).find(".fl-revision-list-item").attr("data-revision-id");FLBuilder._triggerSettingsSave(!1,!0)&&(e(".fl-builder--revision-actions select").val(l),this.preview(l))},selectChanged:function(i){t.preview(e(this).val())},applyClicked:function(i){var l=e(".fl-builder--revision-actions select").val();t.restore(l)},preview:function(t){e(".fl-builder--revision-actions").css("display","flex"),FLBuilder.triggerHook("didEnterRevisionPreview"),FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"render_revision_preview",revision_id:t},this.previewRenderComplete.bind(this))},previewRenderComplete:function(e){FLBuilder._renderLayout(e,function(){FLBuilder._destroyOverlayEvents(),FLBuilder._removeAllOverlays()})},exitPreview:function(){e(".fl-builder--revision-actions").hide(),FLBuilder.triggerHook("didExitRevisionPreview"),FLBuilder._bindOverlayEvents(),FLBuilder._updateLayout()},restore:function(i){e(".fl-builder--revision-actions").hide(),FLBuilder.triggerHook("didExitRevisionPreview"),FLBuilder.showAjaxLoader(),FLBuilder._bindOverlayEvents(),FLBuilder.ajax({action:"restore_revision",revision_id:i},t.restoreComplete)},restoreComplete:function(e){var t=JSON.parse(e);FLBuilder._renderLayout(t.layout),FLBuilder.triggerHook("didRestoreRevisionComplete",t.config)}};e(function(){t.init()})}(jQuery),function(e){var t={query:function(e){var t={},i=null,l={library:{}},s=null;if(e=this.normalizeQuery(e),_.isNull(e.kind))t=FLBuilderConfig.contentItems;else for(var o in e.kind)i=e.kind[o],t[i]=FLBuilderConfig.contentItems[i];return s=this.findMatches(e,t),l.library=this.formatResults(s,e),l},normalizeQuery:function(e){var t={kind:null,type:null,category:null,group:null,enabled:!0,global:null,searchTerm:null,categorized:!1};return e=_.extend(t,e),_.isString(e.kind)&&(e.kind=[e.kind]),e},findMatches:function(e,t){var i={},l=null,s=null,o=null,n=null,r=null,a=null;for(l in t){s=t[l],i[l]={items:[]};for(a in s)if(o=s[a],_.isUndefined(e.category)||_.isNull(e.category)||this.matchesCategory(o.category,e.category)){switch(l){case"template":if(!(_.isUndefined(e.content)||_.isNull(e.content)||(n=_.contains(e.content,o.content),r=e.content===o.content,n||r)))continue;if(!_.isUndefined(e.type)&&!_.isNull(e.type)&&e.type!==o.type)continue;if(!_.isNull(e.group)){var d=e.group,u=o.group;if(_.isString(d)&&(d=[d]),_.isString(u)&&(u=[u]),_.isEmpty(d)||_.isEmpty(u))continue;var c=!1;for(a in d){var h=d[a];_.contains(u,h)&&(c=!0)}if(!c)continue}break;case"module":if(!_.isNull(e.group)){if(e.group===!1&&o.group.length>0)continue;if(e.group!==!1&&!_.contains(o.group,e.group))continue}}(_.isUndefined(e.searchTerm)||_.isNull(e.searchTerm)||this.matchesSearchTerm(o,e.searchTerm))&&i[l].items.push(o)}}return i},matchesCategory:function(e,t){var i,l,s,o,n,r;if(e===t)return!0;_.isString(t)&&(t=[t]);for(l in t){if(i=t[l],_.isString(e)&&e===i)return!0;if(_.isArray(e))for(s in e)if(o=e[s],o===i)return!0;if(_.isObject(e))for(n in e)if(r=e[n],r===i||n===i)return!0}return!1},matchesSearchTerm:function(e,t){var i,l,s=t.toLowerCase();return!(_.isUndefined(e.slug)||!e.slug.toLowerCase().includes(s))||(!(_.isUndefined(e.name)||!e.name.toLowerCase().includes(s))||(!(!_.isString(e.category)||!e.category.toLowerCase().includes(s))||(!(_.isUndefined(e.description)||!e.description.toLowerCase().includes(s))||(!(_.isUndefined(e.id_base)||!e.id_base.includes(t))||(!(!e.isWidget||(i="widget",!i.includes(s)))||!(_.isUndefined(e.editor_export)||(l="module",!l.includes(s))))))))},formatResults:function(e,t){if(t.categorized)for(type in e){var i=e[type].items;e[type].categorized=this.groupBy(i,"category")}return e},groupBy:function(e,t){var i,l,s={};return _.forEach(e,function(e,o,n){i=e[t],_.isNull(i)||_.isUndefined(i)||_.isString(i)&&""===e[i]||(_.isString(i)&&(s[i]=s[i]||[],s[i].push(e)),_.isArray(i)&&(l=i,_.forEach(l,function(t,i,l){s[t]=s[t]||[],s[t].push(e)})),_.isObject(i)&&(l=i,_.forEach(l,function(t,i,l){s[t]=s[t]||[],s[t].push(e)})))}),s},search:function(e){var t={searchTerm:e},i=this.query(t),l={total:0,term:e,sections:{}};if(!_.isUndefined(i.library.module.items)){var s={};for(var o in i.library.module.items){var n=i.library.module.items[o],r=n.group[0],a=n.category;n.name;_.isUndefined(s[r])&&(s[r]={}),_.isUndefined(s[r][a])&&(s[r][a]=[]),s[r][a].push(n)}l.grouped=s}for(var o in i.library){var d=i.library[o];!_.isUndefined(d.items)&&d.items.length>0&&(l.sections[o]={name:FLBuilderStrings.typeLabels[o],handle:o,type:"",items:d.items},l.total+=d.items.length)}return l}};FLBuilder.Search={byQuery:function(e){return t.query(e)},byTerm:function(e){var i=t.search(e);return i}}}(jQuery),function(e,t){var i={layoutNeedsPublish:!1,defaultIndicatorMessage:"",defaultTooltipMessage:"",messages:null,init:function(){this.messages=FLBuilderStrings.savedStatus,this.$savingIndicator=e(".fl-builder--saving-indicator"),t.addHook("didBeginAJAX",this.onLayoutSaving.bind(this)),t.addHook("didCompleteAJAX",this.onLayoutSaved.bind(this)),t.addHook("didPublishLayout",this.onLayoutPublished.bind(this)),t.addHook("publishAndRemain",this.onPublishAndRemain.bind(this)),t.addHook("didShowLightbox",this.setLayoutNeedsPublish.bind(this)),!FLBuilderConfig.layoutHasDraftedChanges&&FLBuilderConfig.builderEnabledd||(this.setLayoutNeedsPublish(),this.resetStatusMessage())},setLayoutNeedsPublish:function(){this.layoutNeedsPublish||(this.layoutNeedsPublish=!0,e("body").addClass("fl-builder--layout-has-drafted-changes"))},onLayoutSaving:function(e,t){this.isPublishingLayout(t.action)?this.showStatusMessage(this.messages.publishing,this.messages.publishingTooltip):this.isUpdatingLayout(t.action)&&(this.setLayoutNeedsPublish(),this.showStatusMessage(this.messages.saving,this.messages.savingTooltip))},isPublishingLayout:function(e){return"save_layout"==e},isUpdatingLayout:function(e){return!this.isPublishingLayout()&&(e.startsWith("render")?!!e.startsWith("render_new"):!e.startsWith("duplicate")&&(!e.startsWith("refresh")&&("save_ui_skin"!=e&&("save_lightbox_position"!=e&&"save_pinned_ui_position"!=e))))},onLayoutSaved:function(e,t){if(this.isUpdatingLayout(t.fl_builder_data.action)){this.showStatusMessage(this.messages.saved,this.messages.savedTooltip);var i=this;setTimeout(function(){i.resetStatusMessage()},2e3)}},onLayoutPublished:function(){this.layoutNeedsPublish=!1,e("body").removeClass("fl-builder--layout-has-drafted-changes"),this.resetStatusMessage()},showStatusMessage:function(t,i){this.$savingIndicator.html(t),_.isUndefined(i)||(this.$savingIndicator.attr("title",i),e(".fl-builder--saving-indicator").tipTip({defaultPosition:"bottom",edgeOffset:14}))},resetStatusMessage:function(){this.layoutNeedsPublish?(this.defaultIndicatorMessage=this.messages.edited+'<i class="fa fa-question-circle"></i>',this.defaultTooltipMessage=this.messages.editedTooltip):(this.defaultIndicatorMessage="",this.defaultTooltipMessage=""),this.showStatusMessage(this.defaultIndicatorMessage,this.defaultTooltipMessage)},onPublishAndRemain:function(){if(this.layoutNeedsPublish)t._publishLayout(!1);else{this.showStatusMessage(this.messages.noChanges);var e=this;setTimeout(function(){e.resetStatusMessage()},2e3)}}};t.SaveManager={layoutNeedsPublish:function(){return i.layoutNeedsPublish},showStatusMessage:function(e,t){i.showStatusMessage(e,t)},resetStatusMessage:function(){i.resetStatusMessage()}},e(function(){i.init()})}(jQuery,FLBuilder);
|
languages/bg_BG.mo
CHANGED
Binary file
|
languages/cs_CZ.mo
CHANGED
Binary file
|
languages/de_DE.mo
CHANGED
Binary file
|
languages/en_GB.mo
CHANGED
Binary file
|
languages/fa_IR.mo
CHANGED
Binary file
|
languages/fi.mo
CHANGED
Binary file
|
languages/he_IL.mo
CHANGED
Binary file
|
languages/hu_HU.mo
CHANGED
Binary file
|
languages/it_IT.mo
CHANGED
Binary file
|
languages/nb_NO.mo
CHANGED
Binary file
|
languages/nl_NL.mo
CHANGED
Binary file
|
languages/pl_PL.mo
CHANGED
Binary file
|
languages/pt_BR.mo
CHANGED
Binary file
|
languages/pt_PT.mo
CHANGED
Binary file
|
languages/sl_SI.mo
CHANGED
Binary file
|
languages/sv_SE.mo
CHANGED
Binary file
|