SiteOrigin Widgets Bundle - Version 1.13.3

Version Description

  • 15 November 2018 =
  • Contact: Fix checkboxes and radio alignment on android.
  • FitText: Set minimum font size to ensure readability.
  • TinyMCE field: Use correct editor when block editor is present.
  • Google maps: Use correct info window text for markers.
  • TinyMCE: Remove 'editor-buttons' style enqueue causing conflicts.
  • TinyMCE field: Prevent adding multiple copies of media buttons.
  • Image widget: if no alt text is supplied add an empty alt attribute.
  • Repeaters: Reverted some commits causing multiple issues.
  • WP 5: Fixed some styles in the block editor.
  • Only setup form fields in the dialog when a PB edit widget dialog is opened.
  • Multi-measurement field: Fix autoFill in block editor and attempt to fix in PHP <
Download this release

Release Info

Developer gpriday
Plugin Icon 128x128 SiteOrigin Widgets Bundle
Version 1.13.3
Comparing to
See all releases

Code changes from version 1.13.2 to 1.13.3

base/base.php CHANGED
@@ -246,11 +246,6 @@ function siteorigin_widgets_font_families( ){
246
return apply_filters('siteorigin_widgets_font_families', $font_families);
247
}
248
249
- function siteorigin_widgets_tinymce_admin_print_styles() {
250
- wp_enqueue_style( 'editor-buttons' );
251
- }
252
- add_action( 'admin_print_styles', 'siteorigin_widgets_tinymce_admin_print_styles' );
253
-
254
/**
255
* Get list of supported measurements
256
*
246
return apply_filters('siteorigin_widgets_font_families', $font_families);
247
}
248
249
/**
250
* Get list of supported measurements
251
*
base/css/admin.css CHANGED
@@ -591,46 +591,49 @@
591
background-size: cover;
592
background-image: url("img/bundle-icon.png");
593
}
594
- .widget-icon.so-widget-icon.so-gutenberg-icon {
595
width: 20px;
596
height: 20px;
597
display: inline-block;
598
}
599
- .gutenberg__editor .so-widget-placeholder > .components-placeholder__label {
600
background: url("img/bundle-icon.png") no-repeat left;
601
background-size: 20px;
602
padding-left: 25px;
603
}
604
- .gutenberg__editor .so-widget-placeholder > .components-placeholder__fieldset {
605
max-width: unset;
606
}
607
- .gutenberg__editor .so-widget-placeholder > .components-placeholder__fieldset .so-widget-gutenberg-container {
608
width: 100%;
609
}
610
- .gutenberg__editor .so-widget-placeholder > .components-placeholder__fieldset .so-widget-gutenberg-container .siteorigin-widget-form.siteorigin-widget-form-main {
611
min-width: unset;
612
}
613
- .gutenberg__editor .siteorigin-widget-form .siteorigin-widget-field {
614
text-align: left;
615
}
616
- .gutenberg__editor .siteorigin-widget-form .siteorigin-widget-field input {
617
padding: 3px 5px;
618
}
619
- .gutenberg__editor .siteorigin-widget-form .siteorigin-widget-field.siteorigin-widget-field-type-autocomplete .select-content-button,
620
- .gutenberg__editor .siteorigin-widget-form .siteorigin-widget-field.siteorigin-widget-field-type-link .select-content-button {
621
box-shadow: unset;
622
font-size: 13px;
623
height: 28px;
624
}
625
- .gutenberg__editor .siteorigin-widget-form .siteorigin-widget-field.siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector-current {
626
height: 37px;
627
}
628
- .gutenberg__editor .siteorigin-widget-form .siteorigin-widget-field.siteorigin-widget-field-type-tinymce .wp-switch-editor {
629
box-sizing: content-box;
630
}
631
- .gutenberg__editor .so-widget-gutenberg-preview-container .so-widgets-spinner-container {
632
text-align: center;
633
}
634
- .gutenberg__editor .so-widget-gutenberg-preview-container .so-widgets-spinner-container > span {
635
display: inline-block;
636
}
591
background-size: cover;
592
background-image: url("img/bundle-icon.png");
593
}
594
+ .widget-icon.so-widget-icon.so-block-editor-icon {
595
width: 20px;
596
height: 20px;
597
display: inline-block;
598
}
599
+ .block-editor .so-widget-placeholder {
600
+ text-align: left;
601
+ }
602
+ .block-editor .so-widget-placeholder > .components-placeholder__label {
603
background: url("img/bundle-icon.png") no-repeat left;
604
background-size: 20px;
605
padding-left: 25px;
606
}
607
+ .block-editor .so-widget-placeholder > .components-placeholder__fieldset {
608
max-width: unset;
609
}
610
+ .block-editor .so-widget-placeholder > .components-placeholder__fieldset .so-widget-block-container {
611
width: 100%;
612
}
613
+ .block-editor .so-widget-placeholder > .components-placeholder__fieldset .so-widget-block-container .siteorigin-widget-form.siteorigin-widget-form-main {
614
min-width: unset;
615
}
616
+ .block-editor .siteorigin-widget-form .siteorigin-widget-field {
617
text-align: left;
618
}
619
+ .block-editor .siteorigin-widget-form .siteorigin-widget-field input {
620
padding: 3px 5px;
621
}
622
+ .block-editor .siteorigin-widget-form .siteorigin-widget-field.siteorigin-widget-field-type-autocomplete .select-content-button,
623
+ .block-editor .siteorigin-widget-form .siteorigin-widget-field.siteorigin-widget-field-type-link .select-content-button {
624
box-shadow: unset;
625
font-size: 13px;
626
height: 28px;
627
}
628
+ .block-editor .siteorigin-widget-form .siteorigin-widget-field.siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector-current {
629
height: 37px;
630
}
631
+ .block-editor .siteorigin-widget-form .siteorigin-widget-field.siteorigin-widget-field-type-tinymce .wp-switch-editor {
632
box-sizing: content-box;
633
}
634
+ .block-editor .so-widget-preview-container .so-widgets-spinner-container {
635
text-align: center;
636
}
637
+ .block-editor .so-widget-preview-container .so-widgets-spinner-container > span {
638
display: inline-block;
639
}
base/inc/fields/builder.class.php CHANGED
@@ -11,7 +11,7 @@ class SiteOrigin_Widget_Field_Builder extends SiteOrigin_Widget_Field_Base {
11
if( defined('SITEORIGIN_PANELS_VERSION') ) {
12
// Normal rendering code
13
// In some contexts this is already encoded, e.g. accordion widget using a layout field for content,
14
- // inside a PB block in Gutenberg.
15
$valid_string = is_string( $value ); // Required for PHP <5.4
16
if ( empty( $valid_string ) ) {
17
$value = json_encode( $value );
11
if( defined('SITEORIGIN_PANELS_VERSION') ) {
12
// Normal rendering code
13
// In some contexts this is already encoded, e.g. accordion widget using a layout field for content,
14
+ // inside a PB block in the block editor.
15
$valid_string = is_string( $value ); // Required for PHP <5.4
16
if ( empty( $valid_string ) ) {
17
$value = json_encode( $value );
base/inc/fields/container-base.class.php CHANGED
@@ -1,122 +1,122 @@
1
- <?php
2
-
3
- /**
4
- *
5
- * The common base class for fields which may contain and render other fields.
6
- *
7
- * Class SiteOrigin_Widget_Field_Container_Base
8
- */
9
- abstract class SiteOrigin_Widget_Field_Container_Base extends SiteOrigin_Widget_Field_Base {
10
- /**
11
- * The child field options.
12
- *
13
- * @access protected
14
- * @var array
15
- */
16
- protected $fields;
17
- /**
18
- * The child field instances.
19
- *
20
- * @access protected
21
- * @var array
22
- */
23
- protected $sub_fields;
24
- /**
25
- * Whether or not this container's fields should initially be hidden.
26
- *
27
- * @access protected
28
- * @var bool
29
- */
30
- protected $hide;
31
- /**
32
- * The current visibility state of this container.
33
- *
34
- * @access protected
35
- * @var string
36
- */
37
- protected $state;
38
- /**
39
- * Whether or not this container's fields are rendered within a collapsible container.
40
- *
41
- * @access protected
42
- * @var bool
43
- */
44
- protected $collapsible = true;
45
-
46
- protected function render_before_field( $value, $instance ) {
47
- if( ! empty( $value[ 'so_field_container_state' ] ) ) {
48
- $this->state = $value[ 'so_field_container_state' ];
49
- }
50
- else {
51
- $this->state = $this->hide ? 'closed' : 'open';
52
- }
53
-
54
- parent::render_before_field( $value, $instance );
55
- }
56
-
57
- protected function get_label_classes( $value, $instance ) {
58
- $label_classes = parent::get_label_classes( $value, $instance );
59
- if( $this->state == 'open' ) $label_classes[] = 'siteorigin-widget-section-visible';
60
- return $label_classes;
61
- }
62
-
63
- protected function render_field_label( $value, $instance ) {
64
- if ($this->collapsible ) {
65
- parent::render_field_label( $value, $instance );
66
- }
67
- }
68
-
69
- protected function create_and_render_sub_fields( $values, $parent_container = null, $is_template = false ) {
70
- $this->sub_fields = array();
71
- if( isset( $parent_container )) {
72
- if( ! in_array( $parent_container, $this->parent_container, true ) ){
73
- $this->parent_container[] = $parent_container;
74
- }
75
- }
76
- /* @var $field_factory SiteOrigin_Widget_Field_Factory */
77
- $field_factory = SiteOrigin_Widget_Field_Factory::single();
78
- foreach( $this->fields as $sub_field_name => $sub_field_options ) {
79
- /* @var $field SiteOrigin_Widget_Field_Base */
80
- $field = $field_factory->create_field(
81
- $sub_field_name,
82
- $sub_field_options,
83
- $this->for_widget,
84
- $this->parent_container,
85
- $is_template
86
- );
87
- $sub_value = ( ! empty( $values ) && isset( $values[$sub_field_name] ) ) ? $values[$sub_field_name] : null;
88
- $field->render( $sub_value, $values );
89
- $field_js_vars = $field->get_javascript_variables();
90
- if( ! empty( $field_js_vars ) ) {
91
- $this->javascript_variables[$sub_field_name] = $field_js_vars;
92
- }
93
- $field->enqueue_scripts();
94
- $this->sub_fields[$sub_field_name] = $field;
95
- }
96
- }
97
-
98
- protected function sanitize_field_input( $value, $instance ) {
99
- /* @var $field_factory SiteOrigin_Widget_Field_Factory */
100
- $field_factory = SiteOrigin_Widget_Field_Factory::single();
101
- foreach( $this->fields as $sub_field_name => $sub_field_options ) {
102
-
103
- /* @var $sub_field SiteOrigin_Widget_Field_Base */
104
- if( ! empty( $this->sub_fields ) && ! empty( $this->sub_fields[$sub_field_name] ) ) {
105
- $sub_field = $this->sub_fields[$sub_field_name];
106
- }
107
- else {
108
- $sub_field = $field_factory->create_field(
109
- $this->base_name . '][' . $sub_field_name,
110
- $sub_field_options,
111
- $this->for_widget,
112
- $this->parent_container
113
- );
114
- }
115
- $value[$sub_field_name] = $sub_field->sanitize( isset($value[$sub_field_name]) ? $value[$sub_field_name] : null, $value );
116
- $value = $sub_field->sanitize_instance( $value );
117
- }
118
-
119
- return $value;
120
- }
121
-
122
- }
1
+ <?php
2
+
3
+ /**
4
+ *
5
+ * The common base class for fields which may contain and render other fields.
6
+ *
7
+ * Class SiteOrigin_Widget_Field_Container_Base
8
+ */
9
+ abstract class SiteOrigin_Widget_Field_Container_Base extends SiteOrigin_Widget_Field_Base {
10
+ /**
11
+ * The child field options.
12
+ *
13
+ * @access protected
14
+ * @var array
15
+ */
16
+ protected $fields;
17
+ /**
18
+ * The child field instances.
19
+ *
20
+ * @access protected
21
+ * @var array
22
+ */
23
+ protected $sub_fields;
24
+ /**
25
+ * Whether or not this container's fields should initially be hidden.
26
+ *
27
+ * @access protected
28
+ * @var bool
29
+ */
30
+ protected $hide;
31
+ /**
32
+ * The current visibility state of this container.
33
+ *
34
+ * @access protected
35
+ * @var string
36
+ */
37
+ protected $state;
38
+ /**
39
+ * Whether or not this container's fields are rendered within a collapsible container.
40
+ *
41
+ * @access protected
42
+ * @var bool
43
+ */
44
+ protected $collapsible = true;
45
+
46
+ protected function render_before_field( $value, $instance ) {
47
+ if( ! empty( $value[ 'so_field_container_state' ] ) ) {
48
+ $this->state = $value[ 'so_field_container_state' ];
49
+ }
50
+ else {
51
+ $this->state = $this->hide ? 'closed' : 'open';
52
+ }
53
+
54
+ parent::render_before_field( $value, $instance );
55
+ }
56
+
57
+ protected function get_label_classes( $value, $instance ) {
58
+ $label_classes = parent::get_label_classes( $value, $instance );
59
+ if( $this->state == 'open' ) $label_classes[] = 'siteorigin-widget-section-visible';
60
+ return $label_classes;
61
+ }
62
+
63
+ protected function render_field_label( $value, $instance ) {
64
+ if ($this->collapsible ) {
65
+ parent::render_field_label( $value, $instance );
66
+ }
67
+ }
68
+
69
+ protected function create_and_render_sub_fields( $values, $parent_container = null, $is_template = false ) {
70
+ $this->sub_fields = array();
71
+ if( isset( $parent_container )) {
72
+ if( ! in_array( $parent_container, $this->parent_container, true ) ){
73
+ $this->parent_container[] = $parent_container;
74
+ }
75
+ }
76
+ /* @var $field_factory SiteOrigin_Widget_Field_Factory */
77
+ $field_factory = SiteOrigin_Widget_Field_Factory::single();
78
+ foreach( $this->fields as $sub_field_name => $sub_field_options ) {
79
+ /* @var $field SiteOrigin_Widget_Field_Base */
80
+ $field = $field_factory->create_field(
81
+ $sub_field_name,
82
+ $sub_field_options,
83
+ $this->for_widget,
84
+ $this->parent_container,
85
+ $is_template
86
+ );
87
+ $sub_value = ( ! empty( $values ) && isset( $values[$sub_field_name] ) ) ? $values[$sub_field_name] : null;
88
+ $field->render( $sub_value, $values );
89
+ $field_js_vars = $field->get_javascript_variables();
90
+ if( ! empty( $field_js_vars ) ) {
91
+ $this->javascript_variables[$sub_field_name] = $field_js_vars;
92
+ }
93
+ $field->enqueue_scripts();
94
+ $this->sub_fields[$sub_field_name] = $field;
95
+ }
96
+ }
97
+
98
+ protected function sanitize_field_input( $value, $instance ) {
99
+ /* @var $field_factory SiteOrigin_Widget_Field_Factory */
100
+ $field_factory = SiteOrigin_Widget_Field_Factory::single();
101
+ foreach( $this->fields as $sub_field_name => $sub_field_options ) {
102
+
103
+ /* @var $sub_field SiteOrigin_Widget_Field_Base */
104
+ if( ! empty( $this->sub_fields ) && ! empty( $this->sub_fields[$sub_field_name] ) ) {
105
+ $sub_field = $this->sub_fields[$sub_field_name];
106
+ }
107
+ else {
108
+ $sub_field = $field_factory->create_field(
109
+ $this->base_name . '][' . $sub_field_name,
110
+ $sub_field_options,
111
+ $this->for_widget,
112
+ $this->parent_container
113
+ );
114
+ }
115
+ $value[$sub_field_name] = $sub_field->sanitize( isset($value[$sub_field_name]) ? $value[$sub_field_name] : null, $value );
116
+ $value = $sub_field->sanitize_instance( $value );
117
+ }
118
+
119
+ return $value;
120
+ }
121
+
122
+ }
base/inc/fields/js/multi-measurement-field.js CHANGED
@@ -1,57 +1,57 @@
1
- /* global jQuery */
2
-
3
- (function( $ ) {
4
- $( document ).on( 'sowsetupformfield', '.siteorigin-widget-field-type-multi-measurement', function ( e ) {
5
-
6
- var valField = $( this ).find( 'input[type="hidden"][class="siteorigin-widget-input"]' );
7
- var separator = valField.data( 'separator' );
8
- var autoFillEnabled = valField.data( 'autofill' );
9
- var values = valField.val() === '' ? [] : valField.val().split( separator );
10
- var $valInputs = $( this ).find( '.sow-multi-measurement-input' );
11
- var $inputContainers = $( this ).find( '.sow-multi-measurement-input-container' );
12
-
13
- var updateValue = function ( $element ) {
14
- var vals = valField.val() === '' ? [] : valField.val().split( separator );
15
- var $unitInput = $element.find( '+ .sow-multi-measurement-select-unit' );
16
- var index = $valInputs.index( $element );
17
- vals[ index ] = $element.val() + ( $element.val() === '' ? '' : $unitInput.val() );
18
- valField.val( vals.join( separator ) );
19
- };
20
-
21
- $valInputs.each( function ( index, element ) {
22
- if ( values.length > index ) {
23
- var valueResult = values[ index ].match( /(\d+\.?\d*)([a-z%]+)*/ );
24
- if ( valueResult && valueResult.length ) {
25
- var amount = valueResult[ 1 ];
26
- var unit = valueResult[ 2 ];
27
- $( element ).val( amount );
28
- $( element ).find( '+ .sow-multi-measurement-select-unit' ).val( unit );
29
- }
30
- } else {
31
- updateValue( $( element ) );
32
- }
33
- } );
34
-
35
- $inputContainers.change( function ( event ) {
36
- var $valInput = $( event.currentTarget ).find( '> .sow-multi-measurement-input' );
37
- var doAutofill = autoFillEnabled;
38
- if ( autoFillEnabled ) {
39
- $valInputs.each( function ( index, element ) {
40
- // Only want to autofill if it has been enabled and no other inputs have values.
41
- if ( element !== $valInput.eq( 0 ) ) {
42
- doAutofill = doAutofill && !( $( element ).val() );
43
- }
44
- } );
45
- }
46
- if ( doAutofill ) {
47
- $valInputs.each( function( index, element ) {
48
- $( element ).val( $valInput.val() );
49
- updateValue( $( element ) );
50
- } );
51
- } else {
52
- updateValue( $valInput );
53
- }
54
- } );
55
-
56
- } );
57
- })( jQuery );
1
+ /* global jQuery */
2
+
3
+ (function( $ ) {
4
+ $( document ).on( 'sowsetupformfield', '.siteorigin-widget-field-type-multi-measurement', function ( e ) {
5
+
6
+ var valField = $( this ).find( 'input[type="hidden"][class="siteorigin-widget-input"]' );
7
+ var separator = valField.data( 'separator' );
8
+ var autoFillEnabled = valField.data( 'autofill' );
9
+ var values = valField.val() === '' ? [] : valField.val().split( separator );
10
+ var $valInputs = $( this ).find( '.sow-multi-measurement-input' );
11
+ var $inputContainers = $( this ).find( '.sow-multi-measurement-input-container' );
12
+
13
+ var updateValue = function ( $element ) {
14
+ var vals = valField.val() === '' ? [] : valField.val().split( separator );
15
+ var $unitInput = $element.find( '+ .sow-multi-measurement-select-unit' );
16
+ var index = $valInputs.index( $element );
17
+ vals[ index ] = $element.val() + ( $element.val() === '' ? '' : $unitInput.val() );
18
+ valField.val( vals.join( separator ) );
19
+ };
20
+
21
+ $valInputs.each( function ( index, element ) {
22
+ if ( values.length > index ) {
23
+ var valueResult = values[ index ].match( /(\d+\.?\d*)([a-z%]+)*/ );
24
+ if ( valueResult && valueResult.length ) {
25
+ var amount = valueResult[ 1 ];
26
+ var unit = valueResult[ 2 ];
27
+ $( element ).val( amount );
28
+ $( element ).find( '+ .sow-multi-measurement-select-unit' ).val( unit );
29
+ }
30
+ } else {
31
+ updateValue( $( element ) );
32
+ }
33
+ } );
34
+
35
+ $inputContainers.change( function ( event ) {
36
+ var $valInput = $( event.currentTarget ).find( '> .sow-multi-measurement-input' );
37
+ var doAutofill = autoFillEnabled;
38
+ if ( autoFillEnabled ) {
39
+ $valInputs.each( function ( index, element ) {
40
+ // Only want to autofill if it has been enabled and no other inputs have values.
41
+ if ( $( element ).attr( 'id' ) !== $valInput.eq( 0 ).attr( 'id' ) ) {
42
+ doAutofill = doAutofill && !( $( element ).val() );
43
+ }
44
+ } );
45
+ }
46
+ if ( doAutofill ) {
47
+ $valInputs.each( function( index, element ) {
48
+ $( element ).val( $valInput.val() );
49
+ updateValue( $( element ) );
50
+ } );
51
+ } else {
52
+ updateValue( $valInput );
53
+ }
54
+ } );
55
+
56
+ } );
57
+ })( jQuery );
base/inc/fields/js/multi-measurement-field.min.js CHANGED
@@ -1 +1 @@
1
- !function(t){t(document).on("sowsetupformfield",".siteorigin-widget-field-type-multi-measurement",function(e){var i=t(this).find('input[type="hidden"][class="siteorigin-widget-input"]'),n=i.data("separator"),a=i.data("autofill"),l=""===i.val()?[]:i.val().split(n),u=t(this).find(".sow-multi-measurement-input"),s=t(this).find(".sow-multi-measurement-input-container"),o=function(t){var e=""===i.val()?[]:i.val().split(n),a=t.find("+ .sow-multi-measurement-select-unit");e[u.index(t)]=t.val()+(""===t.val()?"":a.val()),i.val(e.join(n))};u.each(function(e,i){if(l.length>e){var n=l[e].match(/(\d+\.?\d*)([a-z%]+)*/);if(n&&n.length){var a=n[1],u=n[2];t(i).val(a),t(i).find("+ .sow-multi-measurement-select-unit").val(u)}}else o(t(i))}),s.change(function(e){var i=t(e.currentTarget).find("> .sow-multi-measurement-input"),n=a;a&&u.each(function(e,a){a!==i.eq(0)&&(n=n&&!t(a).val())}),n?u.each(function(e,n){t(n).val(i.val()),o(t(n))}):o(i)})})}(jQuery);
1
+ !function(t){t(document).on("sowsetupformfield",".siteorigin-widget-field-type-multi-measurement",function(i){var e=t(this).find('input[type="hidden"][class="siteorigin-widget-input"]'),n=e.data("separator"),a=e.data("autofill"),l=""===e.val()?[]:e.val().split(n),u=t(this).find(".sow-multi-measurement-input"),s=t(this).find(".sow-multi-measurement-input-container"),r=function(t){var i=""===e.val()?[]:e.val().split(n),a=t.find("+ .sow-multi-measurement-select-unit");i[u.index(t)]=t.val()+(""===t.val()?"":a.val()),e.val(i.join(n))};u.each(function(i,e){if(l.length>i){var n=l[i].match(/(\d+\.?\d*)([a-z%]+)*/);if(n&&n.length){var a=n[1],u=n[2];t(e).val(a),t(e).find("+ .sow-multi-measurement-select-unit").val(u)}}else r(t(e))}),s.change(function(i){var e=t(i.currentTarget).find("> .sow-multi-measurement-input"),n=a;a&&u.each(function(i,a){t(a).attr("id")!==e.eq(0).attr("id")&&(n=n&&!t(a).val())}),n?u.each(function(i,n){t(n).val(e.val()),r(t(n))}):r(e)})})}(jQuery);
base/inc/fields/js/tinymce-field.js CHANGED
@@ -7,10 +7,12 @@
7
return;
8
}
9
10
- var inGutenberg = $( 'body' ).is( '.gutenberg-editor-page' );
11
- var wpEditor = inGutenberg ? wp.oldEditor : wp.editor;
12
- wp.editor.autop = wpEditor.autop;
13
- wp.editor.removep = wpEditor.removep;
14
15
var $container = $field.find( '.siteorigin-widget-tinymce-container' );
16
var settings = $container.data( 'editorSettings' );
@@ -46,7 +48,9 @@
46
$( document ).on( 'wp-before-tinymce-init', function ( event, init ) {
47
if ( init.selector === settings.tinymce.selector ) {
48
var mediaButtons = $container.data( 'mediaButtons' );
49
- $field.find( '.wp-editor-tabs' ).before( mediaButtons.html );
50
}
51
} );
52
$( document ).on( 'tinymce-editor-setup', function () {
7
return;
8
}
9
10
+ var wpEditor = wp.oldEditor ? wp.oldEditor : wp.editor;
11
+ if ( wpEditor && wpEditor.hasOwnProperty( 'autop' ) ) {
12
+ wp.editor.autop = wpEditor.autop;
13
+ wp.editor.removep = wpEditor.removep;
14
+ wp.editor.initialize = wpEditor.initialize
15
+ }
16
17
var $container = $field.find( '.siteorigin-widget-tinymce-container' );
18
var settings = $container.data( 'editorSettings' );
48
$( document ).on( 'wp-before-tinymce-init', function ( event, init ) {
49
if ( init.selector === settings.tinymce.selector ) {
50
var mediaButtons = $container.data( 'mediaButtons' );
51
+ if ( $field.find( '.wp-media-buttons' ).length === 0 ) {
52
+ $field.find( '.wp-editor-tabs' ).before( mediaButtons.html );
53
+ }
54
}
55
} );
56
$( document ).on( 'tinymce-editor-setup', function () {
base/inc/fields/js/tinymce-field.min.js CHANGED
@@ -1 +1 @@
1
- !function(i){var e=function(e){if(!e.data("initialized")){var t=i("body").is(".gutenberg-editor-page"),n=t?wp.oldEditor:wp.editor;wp.editor.autop=n.autop,wp.editor.removep=n.removep;var o,r=e.find(".siteorigin-widget-tinymce-container"),d=r.data("editorSettings");if(d.wpautopToggleField){var a=r.closest(".siteorigin-widget-form");o=a.find(d.wpautopToggleField),d.tinymce.wpautop=o.is(":checked")}var s=r.find("textarea"),c=s.attr("id"),l=function(i){i.on("change",function(){window.tinymce.get(c).save(),s.trigger("change")}),o&&(o.off("change"),o.on("change",function(){wp.editor.remove(c),d.tinymce.wpautop=o.is(":checked"),wp.editor.initialize(c,d)}))};if(d.tinymce&&(d.tinymce=i.extend({},d.tinymce,{selector:"#"+c,setup:l})),i(document).on("wp-before-tinymce-init",function(i,t){if(t.selector===d.tinymce.selector){var n=r.data("mediaButtons");e.find(".wp-editor-tabs").before(n.html)}}),i(document).on("tinymce-editor-setup",function(){e.find(".wp-editor-wrap").hasClass(d.selectedEditor+"-active")||setTimeout(function(){window.switchEditors.go(c)},10)}),n.remove(c),window.tinymce.EditorManager.overrideDefaults({base_url:d.baseURL,suffix:d.suffix}),s.is(":visible"))n.initialize(c,d);else var f=setInterval(function(){s.is(":visible")&&(n.initialize(c,d),clearInterval(f))},500);e.on("click",function(t){var n=i(t.target);if(n.is(".wp-switch-editor")){var o=n.hasClass("switch-tmce")?"tmce":"html";if("tmce"===o){var r=window.tinymce.get(c);if(null!==r){var a=s.val();-1!==a.search("<")&&-1===a.search(">")&&(a=a.replace(/</g,""),s.val(a)),r.setContent(window.switchEditors.wpautop(a))}}d.selectedEditor=o,e.find(".siteorigin-widget-tinymce-selected-editor").val(o)}}),e.data("initialized",!0)}};i(document).on("sowsetupformfield",".siteorigin-widget-field-type-tinymce",function(){var t=i(this),n=t.closest(".siteorigin-widget-field-repeater-item-form");n.length>0?n.is(":visible")?e(t):n.on("slideToggleOpenComplete",function(){n.is(":visible")&&(e(t),n.off("slideToggleOpenComplete"))}):e(t)}),i(document).on("sortstop",function(t,n){var o;o=n.item.is(".siteorigin-widget-field-repeater-item")?n.item.find("> .siteorigin-widget-field-repeater-item-form"):n.item.find(".siteorigin-widget-form"),o.find(".siteorigin-widget-field-type-tinymce").each(function(){i(this).data("initialized",null),e(i(this))})})}(jQuery);
1
+ !function(i){var e=function(e){if(!e.data("initialized")){var t=wp.oldEditor?wp.oldEditor:wp.editor;t&&t.hasOwnProperty("autop")&&(wp.editor.autop=t.autop,wp.editor.removep=t.removep,wp.editor.initialize=t.initialize);var n,o=e.find(".siteorigin-widget-tinymce-container"),r=o.data("editorSettings");if(r.wpautopToggleField){var a=o.closest(".siteorigin-widget-form");n=a.find(r.wpautopToggleField),r.tinymce.wpautop=n.is(":checked")}var d=o.find("textarea"),s=d.attr("id"),c=function(i){i.on("change",function(){window.tinymce.get(s).save(),d.trigger("change")}),n&&(n.off("change"),n.on("change",function(){wp.editor.remove(s),r.tinymce.wpautop=n.is(":checked"),wp.editor.initialize(s,r)}))};if(r.tinymce&&(r.tinymce=i.extend({},r.tinymce,{selector:"#"+s,setup:c})),i(document).on("wp-before-tinymce-init",function(i,t){if(t.selector===r.tinymce.selector){var n=o.data("mediaButtons");0===e.find(".wp-media-buttons").length&&e.find(".wp-editor-tabs").before(n.html)}}),i(document).on("tinymce-editor-setup",function(){e.find(".wp-editor-wrap").hasClass(r.selectedEditor+"-active")||setTimeout(function(){window.switchEditors.go(s)},10)}),t.remove(s),window.tinymce.EditorManager.overrideDefaults({base_url:r.baseURL,suffix:r.suffix}),d.is(":visible"))t.initialize(s,r);else var l=setInterval(function(){d.is(":visible")&&(t.initialize(s,r),clearInterval(l))},500);e.on("click",function(t){var n=i(t.target);if(n.is(".wp-switch-editor")){var o=n.hasClass("switch-tmce")?"tmce":"html";if("tmce"===o){var a=window.tinymce.get(s);if(null!==a){var c=d.val();-1!==c.search("<")&&-1===c.search(">")&&(c=c.replace(/</g,""),d.val(c)),a.setContent(window.switchEditors.wpautop(c))}}r.selectedEditor=o,e.find(".siteorigin-widget-tinymce-selected-editor").val(o)}}),e.data("initialized",!0)}};i(document).on("sowsetupformfield",".siteorigin-widget-field-type-tinymce",function(){var t=i(this),n=t.closest(".siteorigin-widget-field-repeater-item-form");n.length>0?n.is(":visible")?e(t):n.on("slideToggleOpenComplete",function(){n.is(":visible")&&(e(t),n.off("slideToggleOpenComplete"))}):e(t)}),i(document).on("sortstop",function(t,n){var o;o=n.item.is(".siteorigin-widget-field-repeater-item")?n.item.find("> .siteorigin-widget-field-repeater-item-form"):n.item.find(".siteorigin-widget-form"),o.find(".siteorigin-widget-field-type-tinymce").each(function(){i(this).data("initialized",null),e(i(this))})})}(jQuery);
base/inc/fields/multi-measurement.class.php CHANGED
@@ -1,118 +1,122 @@
1
- <?php
2
-
3
- /**
4
- * Class SiteOrigin_Widget_Field_Multi_Measurement
5
- */
6
- class SiteOrigin_Widget_Field_Multi_Measurement extends SiteOrigin_Widget_Field_Text_Input_Base {
7
-
8
- /**
9
- * Configuration of the measurements to be taken. Should be in the form:
10
- * `array(
11
- * 'padding_left' => array(
12
- * 'label' => __( 'Padding left', 'so-widgets-bundle' ),
13
- * 'units' => array( 'px', 'rem', 'em', '%' ),
14
- * ),
15
- * 'padding_right' => __( 'Padding right', 'so-widgets-bundle' ),
16
- * 'padding_bottom' => __( 'Padding bottom', 'so-widgets-bundle' ),
17
- * 'padding_top' => __( 'Padding top', 'so-widgets-bundle' ),
18
- * )`
19
- *
20
- * The 'units' property is optional and defaults to the list returned by `siteorigin_widgets_get_measurements_list`.
21
- *
22
- * @access protected
23
- * @var array
24
- */
25
- protected $measurements;
26
-
27
- /**
28
- * String separator for the measurements. Default is an empty space.
29
- *
30
- * @access protected
31
- * @var string
32
- */
33
- protected $separator;
34
-
35
- /**
36
- * Whether to automatically fill the rest of the inputs when the first value is entered.
37
- * Default is false.
38
- *
39
- * @access protected
40
- * @var boolean
41
- */
42
- protected $autofill;
43
-
44
- protected function get_default_options() {
45
- return array(
46
- 'separator' => ' ',
47
- 'autofill' => false,
48
- );
49
- }
50
-
51
- protected function render_field( $value, $instance ) {
52
- ?>
53
- <div class="sow-multi-measurement-container">
54
- <?php
55
- foreach ( $this->measurements as $name => $measurement_config ) {
56
-
57
- if ( is_array( $measurement_config ) ) {
58
- $label = empty( $measurement_config['label'] ) ? '' : $measurement_config['label'];
59
- } else {
60
- $label = $measurement_config;
61
- }
62
- $units = empty( $measurement_config['units'] ) ?
63
- siteorigin_widgets_get_measurements_list() :
64
- $measurement_config['units'];
65
- $input_id = $this->element_id . '-' . $name;
66
- ?>
67
- <div class="sow-multi-measurement-input-container">
68
- <label for="<?php echo esc_attr( $input_id ) ?>"><?php echo esc_html( $label ) ?></label>
69
- <input id="<?php echo esc_attr( $input_id ) ?>" type="text" class="sow-multi-measurement-input">
70
- <select class="sow-multi-measurement-select-unit">
71
- <?php foreach ( $units as $unit ):?>
72
- <option value="<?php echo esc_attr( $unit ) ?>"><?php echo esc_html( $unit ) ?></option>
73
- <?php endforeach?>
74
- </select>
75
- <div class="clear"></div>
76
- </div>
77
- <?php
78
- }
79
- ?>
80
- </div>
81
- <input type="hidden"
82
- class="siteorigin-widget-input"
83
- value="<?php echo esc_attr( $value ) ?>"
84
- name="<?php echo esc_attr( $this->element_name ) ?>"
85
- data-autofill="<?php echo empty( $this->autofill ) ? 'false' : 'true'; ?>"
86
- data-separator="<?php echo esc_attr( $this->separator ) ?>"/><?php
87
- }
88
-
89
- public function enqueue_scripts() {
90
- wp_enqueue_style( 'so-multi-measurement-field', plugin_dir_url( __FILE__ ) . 'css/multi-measurement-field.css', array(),
91
- SOW_BUNDLE_VERSION );
92
- wp_enqueue_script( 'so-multi-measurement-field',
93
- plugin_dir_url( __FILE__ ) . 'js/multi-measurement-field' . SOW_BUNDLE_JS_SUFFIX . '.js', array( 'jquery' ),
94
- SOW_BUNDLE_VERSION );
95
- }
96
-
97
- protected function sanitize_field_input( $value, $instance ) {
98
- if ( empty( $value ) ) {
99
- return $value;
100
- }
101
-
102
- $values = explode( $this->separator, $value );
103
- $any_values = false;
104
- foreach ( $values as $index => $measurement ) {
105
- $any_values = $any_values || ! empty( $measurement );
106
- preg_match('/(\d+\.?\d*)([a-z%]+)*/', $measurement, $matches);
107
-
108
- $num_matches = count( $matches );
109
-
110
- $val = $num_matches > 1 ? $matches[1] : '0';
111
- $unit = $num_matches > 2 ? $matches[2] : 'px';
112
- $measurement = $val . $unit;
113
- $values[ $index ] = $measurement;
114
- }
115
- // If all values are empty, just return an empty string.
116
- return $any_values ? implode( $this->separator, $values ) : '';
117
- }
118
- }
1
+ <?php
2
+
3
+ /**
4
+ * Class SiteOrigin_Widget_Field_Multi_Measurement
5
+ */
6
+ class SiteOrigin_Widget_Field_Multi_Measurement extends SiteOrigin_Widget_Field_Text_Input_Base {
7
+
8
+ /**
9
+ * Configuration of the measurements to be taken. Should be in the form:
10
+ * `array(
11
+ * 'padding_left' => array(
12
+ * 'label' => __( 'Padding left', 'so-widgets-bundle' ),
13
+ * 'units' => array( 'px', 'rem', 'em', '%' ),
14
+ * ),
15
+ * 'padding_right' => __( 'Padding right', 'so-widgets-bundle' ),
16
+ * 'padding_bottom' => __( 'Padding bottom', 'so-widgets-bundle' ),
17
+ * 'padding_top' => __( 'Padding top', 'so-widgets-bundle' ),
18
+ * )`
19
+ *
20
+ * The 'units' property is optional and defaults to the list returned by `siteorigin_widgets_get_measurements_list`.
21
+ *
22
+ * @access protected
23
+ * @var array
24
+ */
25
+ protected $measurements;
26
+
27
+ /**
28
+ * String separator for the measurements. Default is an empty space.
29
+ *
30
+ * @access protected
31
+ * @var string
32
+ */
33
+ protected $separator;
34
+
35
+ /**
36
+ * Whether to automatically fill the rest of the inputs when the first value is entered.
37
+ * Default is false.
38
+ *
39
+ * @access protected
40
+ * @var boolean
41
+ */
42
+ protected $autofill;
43
+
44
+ protected function get_default_options() {
45
+ return array(
46
+ 'separator' => ' ',
47
+ 'autofill' => false,
48
+ );
49
+ }
50
+
51
+ protected function render_field( $value, $instance ) {
52
+ ?>
53
+ <div class="sow-multi-measurement-container">
54
+ <?php
55
+ foreach ( $this->measurements as $name => $measurement_config ) {
56
+
57
+ if ( is_array( $measurement_config ) ) {
58
+ $label = empty( $measurement_config['label'] ) ? '' : $measurement_config['label'];
59
+ } else {
60
+ $label = $measurement_config;
61
+ }
62
+ $default_measurements = siteorigin_widgets_get_measurements_list();
63
+ $units = empty( $measurement_config['units'] ) ?
64
+ $default_measurements :
65
+ $measurement_config['units'];
66
+ if ( empty( $units ) ) {
67
+ $units = array( 'px' );
68
+ }
69
+ $input_id = $this->element_id . '-' . $name;
70
+ ?>
71
+ <div class="sow-multi-measurement-input-container">
72
+ <label for="<?php echo esc_attr( $input_id ) ?>"><?php echo esc_html( $label ) ?></label>
73
+ <input id="<?php echo esc_attr( $input_id ) ?>" type="text" class="sow-multi-measurement-input">
74
+ <select class="sow-multi-measurement-select-unit">
75
+ <?php foreach ( (array) $units as $unit ):?>
76
+ <option value="<?php echo esc_attr( $unit ) ?>"><?php echo esc_html( $unit ) ?></option>
77
+ <?php endforeach?>
78
+ </select>
79
+ <div class="clear"></div>
80
+ </div>
81
+ <?php
82
+ }
83
+ ?>
84
+ </div>
85
+ <input type="hidden"
86
+ class="siteorigin-widget-input"
87
+ value="<?php echo esc_attr( $value ) ?>"
88
+ name="<?php echo esc_attr( $this->element_name ) ?>"
89
+ data-autofill="<?php echo empty( $this->autofill ) ? 'false' : 'true'; ?>"
90
+ data-separator="<?php echo esc_attr( $this->separator ) ?>"/><?php
91
+ }
92
+
93
+ public function enqueue_scripts() {
94
+ wp_enqueue_style( 'so-multi-measurement-field', plugin_dir_url( __FILE__ ) . 'css/multi-measurement-field.css', array(),
95
+ SOW_BUNDLE_VERSION );
96
+ wp_enqueue_script( 'so-multi-measurement-field',
97
+ plugin_dir_url( __FILE__ ) . 'js/multi-measurement-field' . SOW_BUNDLE_JS_SUFFIX . '.js', array( 'jquery' ),
98
+ SOW_BUNDLE_VERSION );
99
+ }
100
+
101
+ protected function sanitize_field_input( $value, $instance ) {
102
+ if ( empty( $value ) ) {
103
+ return $value;
104
+ }
105
+
106
+ $values = explode( $this->separator, $value );
107
+ $any_values = false;
108
+ foreach ( $values as $index => $measurement ) {
109
+ $any_values = $any_values || ! empty( $measurement );
110
+ preg_match('/(\d+\.?\d*)([a-z%]+)*/', $measurement, $matches);
111
+
112
+ $num_matches = count( $matches );
113
+
114
+ $val = $num_matches > 1 ? $matches[1] : '0';
115
+ $unit = $num_matches > 2 ? $matches[2] : 'px';
116
+ $measurement = $val . $unit;
117
+ $values[ $index ] = $measurement;
118
+ }
119
+ // If all values are empty, just return an empty string.
120
+ return $any_values ? implode( $this->separator, $values ) : '';
121
+ }
122
+ }
base/inc/fields/repeater.class.php CHANGED
@@ -94,7 +94,6 @@ class SiteOrigin_Widget_Field_Repeater extends SiteOrigin_Widget_Field_Container
94
<?php endif; ?>
95
<?php
96
ob_start();
97
- $container['is_template'] = true;
98
$this->create_and_render_sub_fields( null, $container, true );
99
$rpt_fields = ob_get_clean();
100
$rpt_fields = preg_replace( '/\s+name\s*=\s*/', ' data-name=', $rpt_fields );
94
<?php endif; ?>
95
<?php
96
ob_start();
97
$this->create_and_render_sub_fields( null, $container, true );
98
$rpt_fields = ob_get_clean();
99
$rpt_fields = preg_replace( '/\s+name\s*=\s*/', ' data-name=', $rpt_fields );
base/inc/fields/section.class.php CHANGED
@@ -1,23 +1,23 @@
1
- <?php
2
-
3
- /**
4
- * Class SiteOrigin_Widget_Field_Section
5
- */
6
- class SiteOrigin_Widget_Field_Section extends SiteOrigin_Widget_Field_Container_Base {
7
-
8
- protected function render_field( $value, $instance ) {
9
- ?>
10
- <div class="siteorigin-widget-section <?php if( $this->state == 'closed' ) echo 'siteorigin-widget-section-hide'; ?>"><?php
11
- if ( !isset( $this->fields ) || empty($this->fields ) ) {
12
- echo '</div>';
13
- return;
14
- }
15
- $this->create_and_render_sub_fields( $value, array( 'name' => $this->base_name, 'type' => 'section' ) );
16
- ?>
17
- <input type="hidden"
18
- name="<?php echo esc_attr( $this->element_name . '[so_field_container_state]' ) ?>" id="<?php echo esc_attr( $this->element_id . '-so_field_container_state' ) ?>"
19
- class="siteorigin-widget-input siteorigin-widget-field-container-state" value="<?php echo esc_attr( $this->state ) ?>"/>
20
- </div><?php
21
- }
22
-
23
}
1
+ <?php
2
+
3
+ /**
4
+ * Class SiteOrigin_Widget_Field_Section
5
+ */
6
+ class SiteOrigin_Widget_Field_Section extends SiteOrigin_Widget_Field_Container_Base {
7
+
8
+ protected function render_field( $value, $instance ) {
9
+ ?>
10
+ <div class="siteorigin-widget-section <?php if( $this->state == 'closed' ) echo 'siteorigin-widget-section-hide'; ?>"><?php
11
+ if ( !isset( $this->fields ) || empty($this->fields ) ) {
12
+ echo '</div>';
13
+ return;
14
+ }
15
+ $this->create_and_render_sub_fields( $value, array( 'name' => $this->base_name, 'type' => 'section' ) );
16
+ ?>
17
+ <input type="hidden"
18
+ name="<?php echo esc_attr( $this->element_name . '[so_field_container_state]' ) ?>" id="<?php echo esc_attr( $this->element_id . '-so_field_container_state' ) ?>"
19
+ class="siteorigin-widget-input siteorigin-widget-field-container-state" value="<?php echo esc_attr( $this->state ) ?>"/>
20
+ </div><?php
21
+ }
22
+
23
}
base/js/admin.js CHANGED
@@ -530,7 +530,7 @@ var sowbForms = window.sowbForms || {};
530
531
return $(this).each(function (i, el) {
532
var $el = $(el);
533
- var $items = $el.find('> .siteorigin-widget-field-repeater-items');
534
var name = $el.data('repeater-name');
535
536
$items.bind('updateFieldPositions', function () {
@@ -550,11 +550,8 @@ var sowbForms = window.sowbForms || {};
550
});
551
});
552
553
- // Skip child repeaters as they'll go through this setup process for themselves.
554
- var $fieldsExclRepeaters = $.find( '> .siteorigin-widget-field-repeater-item > .siteorigin-widget-field-repeater-item-form > .siteorigin-widget-field' )
555
- .not( '.siteorigin-widget-field-type-repeater' );
556
// Update the field names for all the input items
557
- $fieldsExclRepeaters.find('.siteorigin-widget-input').each( function ( i, input ) {
558
var $in = $( input );
559
var pos = $in.data( 'repeater-positions' );
560
@@ -581,7 +578,7 @@ var sowbForms = window.sowbForms || {};
581
if ( !$.data( 'initialSetup' ) ) {
582
// Setup default checked values, now that we've updated input names.
583
// Without this radio inputs in repeaters will be rendered as if they all belong to the same group.
584
- $fieldsExclRepeaters.find('input[type="radio"].siteorigin-widget-input').each(function (i, input) {
585
var $in = $(input);
586
$in.prop('checked', $in.prop('defaultChecked'));
587
});
@@ -661,10 +658,16 @@ var sowbForms = window.sowbForms || {};
661
});
662
663
// Replace repeater item id placeholders with the index of the repeater item.
664
- var repeaterName = $el.data( 'repeater-name' );
665
- var re = new RegExp( repeaterName + '-_id_', 'g' );
666
- var repeaterItemId = repeaterName + '-' + $nextIndex;
667
- var repeaterHtml = repeaterObject.html().replace( re, repeaterItemId );
668
669
var readonly = typeof $el.attr('readonly') !== 'undefined';
670
var item = $('<div class="siteorigin-widget-field-repeater-item ui-draggable" />')
@@ -1234,7 +1237,7 @@ var sowbForms = window.sowbForms || {};
1234
});
1235
}
1236
1237
- if ( $body.hasClass('gutenberg-editor-page') ) {
1238
// Setup new widgets when they're added in the customizer interface
1239
$(document).on('panels_setup_preview', function () {
1240
$( sowb ).trigger( 'setup_widgets' );
@@ -1244,7 +1247,7 @@ var sowbForms = window.sowbForms || {};
1244
$( document ).on( 'open_dialog', function ( e, dialog ) {
1245
// When we open a Page Builder edit widget dialog
1246
if ( dialog.$el.find( '.so-panels-dialog' ).is( '.so-panels-dialog-edit-widget' ) ) {
1247
- var $fields = $( e.target ).find( '.siteorigin-widget-form-main' ).find( '> .siteorigin-widget-field' );
1248
$fields.trigger( 'sowsetupformfield' );
1249
}
1250
});
530
531
return $(this).each(function (i, el) {
532
var $el = $(el);
533
+ var $items = $el.find('.siteorigin-widget-field-repeater-items');
534
var name = $el.data('repeater-name');
535
536
$items.bind('updateFieldPositions', function () {
550
});
551
});
552
553
// Update the field names for all the input items
554
+ $.find('.siteorigin-widget-input').each( function ( i, input ) {
555
var $in = $( input );
556
var pos = $in.data( 'repeater-positions' );
557
578
if ( !$.data( 'initialSetup' ) ) {
579
// Setup default checked values, now that we've updated input names.
580
// Without this radio inputs in repeaters will be rendered as if they all belong to the same group.
581
+ $.find('.siteorigin-widget-input').each(function (i, input) {
582
var $in = $(input);
583
$in.prop('checked', $in.prop('defaultChecked'));
584
});
658
});
659
660
// Replace repeater item id placeholders with the index of the repeater item.
661
+ var repeaterHtml = '';
662
+ repeaterObject.find( '> .siteorigin-widget-field' )
663
+ .each( function ( index, element ) {
664
+ var html = element.outerHTML;
665
+ // Skip child repeaters, so they can setup their own id's when necessary.
666
+ if ( ! $( element ).is( '.siteorigin-widget-field-type-repeater' ) ) {
667
+ html = html.replace( /_id_/g, $nextIndex );
668
+ }
669
+ repeaterHtml += html;
670
+ } );
671
672
var readonly = typeof $el.attr('readonly') !== 'undefined';
673
var item = $('<div class="siteorigin-widget-field-repeater-item ui-draggable" />')
1237
});
1238
}
1239
1240
+ if ( $body.hasClass('block-editor-page') ) {
1241
// Setup new widgets when they're added in the customizer interface
1242
$(document).on('panels_setup_preview', function () {
1243
$( sowb ).trigger( 'setup_widgets' );
1247
$( document ).on( 'open_dialog', function ( e, dialog ) {
1248
// When we open a Page Builder edit widget dialog
1249
if ( dialog.$el.find( '.so-panels-dialog' ).is( '.so-panels-dialog-edit-widget' ) ) {
1250
+ var $fields = dialog.$el.find( '.siteorigin-widget-form-main' ).find( '> .siteorigin-widget-field' );
1251
$fields.trigger( 'sowsetupformfield' );
1252
}
1253
});
base/js/admin.min.js CHANGED
@@ -1 +1 @@
1
- var sowbForms=window.sowbForms||{};!function(e){e.fn.sowSetupForm=function(){return e(this).each(function(i,t){var r,n=e(t),a=!0,s=e("body"),o=n.find("input[name]");if(o.length&&-1!==o.attr("name").indexOf("__i__"))return this;if(n.is(".siteorigin-widget-form-main")){if(!0===n.data("sow-form-setup"))return!0;if(s.hasClass("widgets-php")&&!n.is(":visible")&&0===n.closest(".panel-dialog").length)return!0;n.on("sowstatechange",function(i,t,r){n.find("[data-state-handler]").each(function(){var i=e(this),n=e.extend({},i.data("state-handler"),a?i.data("state-handler-initial"):{});if(0===Object.keys(n).length)return!0;var s,o,d,l,g,f,p={},c=sowbForms.getContainerFieldId(i,"repeater",".siteorigin-widget-field-repeater-item");if(!1!==c){var u={};for(var m in n)u[m.replace("{$repeater}",c)]=n[m];n=u}var w=sowbForms.getContainerFieldId(i,"widget",".siteorigin-widget-widget");if(!1!==w){var v={};for(var h in n){var b=h.match(/_else\[(.*)\]|(.*)\[(.*)\]/),y="";y=b&&b.length&&void 0===b[1]?b[2]+"_"+w+"["+b[3]+"]":"_else["+b[1]+"_"+w+"]",v[y]=n[h]}n=v}for(var F in n)if(g=!1,null!==(s=F.match(/^([a-zA-Z0-9_-]+)(\[([a-zA-Z0-9_\-,]+)\])?(\[\])?#x2F;))){if(o={group:"default",name:"",multi:!1},void 0!==s[2]?(o.group=s[1],o.name=s[3]):o.name=s[0],o.multi=void 0!==s[4],"_else"===o.group)o.group=o.name,o.name="",g=o.group===t&&void 0===p[o.group];else{f=o.name.split(",").map(function(e){return e.trim()});for(var k=0;k<f.length&&!(g=o.group===t&&f[k]===r);k++);}if(g){d=n[F],o.multi||(d=[d]);for(var k=0;k<d.length;k++)l=void 0!==d[k][1]&&Boolean(d[k][1])?i.find(d[k][1]):i,l[d[k][0]].apply(l,void 0!==d[k][2]?d[k][2]:[]);p[o.group]=!0}}})}),n.sowSetupPreview(),r=n;var d=n.find(".siteorigin-widget-teaser");if(d.find(".dashicons-dismiss").click(function(){var i=e(this);e.get(i.data("dismiss-url")),d.slideUp("normal",function(){d.remove()})}),!n.data("backupDisabled")){var l=n.find("> .siteorigin-widgets-form-id").val(),g=n.find("> .siteorigin-widgets-form-timestamp"),f=parseInt(g.val()||0),p=JSON.parse(sessionStorage.getItem(l));if(p)if(p._sow_form_timestamp>f){var c=e('<div class="siteorigin-widget-form-notification"><span>'+soWidgets.backup.newerVersion+'</span><a class="button button-small so-backup-restore">'+soWidgets.backup.restore+'</a><a class="button button-small so-backup-dismiss">'+soWidgets.backup.dismiss+"</a><div><small>"+soWidgets.backup.replaceWarning+"</small></div></div>");n.prepend(c),c.find(".so-backup-restore").click(function(){sowbForms.setWidgetFormValues(r,p),c.slideUp("fast",function(){c.remove()})}),c.find(".so-backup-dismiss").click(function(){c.slideUp("fast",function(){sessionStorage.removeItem(l),c.remove()})})}else sessionStorage.removeItem(l);n.change(function(){g.val((new Date).getTime());var e=sowbForms.getWidgetFormValues(n);sessionStorage.setItem(l,JSON.stringify(e))})}}else r=n.closest(".siteorigin-widget-form-main");r.find("> .siteorigin-widgets-form-id").val();var u=n.find("> .siteorigin-widget-field");u.find("> .siteorigin-widget-section").sowSetupForm();var m=u.find("> .siteorigin-widget-widget");m.find("> .siteorigin-widget-section").sowSetupForm(),m.filter(":not(:has(> .siteorigin-widget-section))").sowSetupForm(),u.find(".siteorigin-widget-input").each(function(i,t){null===e(t).data("original-name")&&e(t).data("original-name",e(t).attr("name"))}),u.find("> .siteorigin-widget-field-repeater").sowSetupRepeater(),n.find(".siteorigin-widget-field-repeater-item").sowSetupRepeaterItems(),u.find("> .siteorigin-widget-input-color").each(function(){var i=e(this),t={change:function(i,t){setTimeout(function(){e(i.target).trigger("change")},100)}};i.data("defaultColor")&&(t.defaultColor=i.data("defaultColor")),i.wpColorPicker(t)});var w=function(){e(this).toggleClass("siteorigin-widget-section-visible"),e(this).parent().find("> .siteorigin-widget-section, > .siteorigin-widget-widget > .siteorigin-widget-section").slideToggle("fast",function(){if(e(window).resize(),e(this).find("> .siteorigin-widget-field-container-state").val(e(this).is(":visible")?"open":"closed"),e(this).is(":visible")){e(this).find("> .siteorigin-widget-field").trigger("sowsetupformfield")}})};u.filter(".siteorigin-widget-field-type-widget, .siteorigin-widget-field-type-section").find("> label").click(w),u.filter(".siteorigin-widget-field-type-posts").find(".posts-container-label-wrapper").click(w),u.filter(".siteorigin-widget-field-type-slider").each(function(){var i=e(this),t=i.find('input[type="number"]'),r=i.find(".siteorigin-widget-value-slider");r.slider({max:parseFloat(t.attr("max")),min:parseFloat(t.attr("min")),step:parseFloat(t.attr("step")),value:parseFloat(t.val()),slide:function(e,i){t.val(parseFloat(i.value)),t.trigger("change")},change:function(e,t){i.find(".siteorigin-widget-slider-value").html(t.value)}}),t.change(function(e,i){i&&i.silent||r.slider("value",parseFloat(t.val()))})}),u.filter(".siteorigin-widget-field-type-link").each(function(){var i=e(this),t=null,r=function(){null!==t&&t.abort();var r=i.find(".content-text-search"),n=r.val(),a=r.data("postTypes"),s=i.find("ul.posts").empty().addClass("loading");e.get(soWidgets.ajaxurl,{action:"so_widgets_search_posts",query:n,postTypes:a},function(i){for(var t=0;t<i.length;t++)""===i[t].label&&(i[t].label="&nbsp;"),s.append(e("<li>").addClass("post").html(i[t].label+"<span>("+i[t].type+")</span>").data(i[t]));s.removeClass("loading")})};i.find(".select-content-button, .button-close").click(function(t){t.preventDefault(),e(this).blur();var n=i.find(".existing-content-selector");n.toggle(),n.is(":visible")&&0===n.find("ul.posts li").length&&r()}),i.on("click",".posts li",function(t){t.preventDefault();var r=e(this);i.find("input.siteorigin-widget-input").val("post: "+r.data("value")),i.change(),i.find(".existing-content-selector").toggle()});var n=null;i.find(".content-text-search").keyup(function(){null!==n&&clearTimeout(n),n=setTimeout(function(){r()},500)})}),void 0!==jQuery.fn.soPanelsSetupBuilderWidget&&u.filter(".siteorigin-widget-field-type-builder").each(function(){e(this).find("> .siteorigin-page-builder-field").each(function(){var i=e(this);i.soPanelsSetupBuilderWidget({builderType:i.data("type")})})});var v=function(){var i=e(this),t=i.closest("[data-state-emitter]").data("state-emitter");if(void 0!==t){var n={default:""};void 0===t.length&&(t=[t]);for(var a=0;a<t.length;a++)n=function(t,r){if(void 0===sowEmitters[t.callback]||"_"===t.callback.substr(0,1))return r;if(i.is('[type="radio"]')&&!i.is(":checked"))return r;var n=sowbForms.getContainerFieldId(i,"repeater",".siteorigin-widget-field-repeater-item");!1!==n&&(t.args=t.args.map(function(e){return e.replace("{$repeater}",n)}));var a=sowbForms.getContainerFieldId(i,"widget",".siteorigin-widget-widget");!1===a||t.hasOwnProperty("widgetFieldId")||(t.widgetFieldId=a,t.args=t.args.map(function(e){return e+"_"+a}));var s=i.is('[type="checkbox"]')?i.is(":checked"):i.val();return e.extend(r,sowEmitters[t.callback](s,t.args))}(t[a],n);var s=r.data("states");void 0===s&&(s={default:""});for(var o in n)void 0!==s[o]&&n[o]===s[o]||(s[o]=n[o],r.trigger("sowstatechange",[o,n[o]]));r.data("states",s)}};u.filter("[data-state-emitter]").each(function(){var i=e(this).find(".siteorigin-widget-input");i.on("keyup change",v),i.each(function(){var i=e(this);i.is(":radio")?i.is(":checked")&&v.call(i[0]):v.call(i[0])})}),n.trigger("sowsetupform",u).data("sow-form-setup",!0),u.trigger("sowsetupformfield"),n.find(".siteorigin-widget-field-repeater-item").trigger("updateFieldPositions"),(s.hasClass("wp-customizer")||s.hasClass("widgets-php"))&&n.closest(".ui-sortable").on("sortstop",function(e,i){i.item.find(".siteorigin-widget-form").find("> .siteorigin-widget-field").trigger("sowsetupformfield")}),a=!1})},e.fn.sowSetupPreview=function(){var i=e(this);i.siblings(".siteorigin-widget-preview").find("> a").click(function(t){t.preventDefault();var r=sowbForms.getWidgetFormValues(i),n=e(e("#so-widgets-bundle-tpl-preview-dialog").html().trim()).appendTo("body");n.find('input[name="data"]').val(JSON.stringify(r)),n.find('input[name="class"]').val(i.data("class")),n.find("iframe").on("load",function(){e(this).css("visibility","visible")}),n.find("form").submit(),n.find(".close").click(function(){n.remove()})})},e.fn.sowSetupRepeater=function(){return e(this).each(function(i,t){var r=e(t),n=r.find("> .siteorigin-widget-field-repeater-items"),a=r.data("repeater-name");n.bind("updateFieldPositions",function(){var i=e(this),t=i.find("> .siteorigin-widget-field-repeater-item");t.each(function(i,t){e(t).find(".siteorigin-widget-input").each(function(t,r){var n=e(r).data("repeater-positions");void 0===n&&(n={}),n[a]=i,e(r).data("repeater-positions",n)})});var n=i.find("> .siteorigin-widget-field-repeater-item > .siteorigin-widget-field-repeater-item-form > .siteorigin-widget-field").not(".siteorigin-widget-field-type-repeater");n.find(".siteorigin-widget-input").each(function(i,t){var r=e(t),n=r.data("repeater-positions");if(void 0!==n){var a=r.attr("data-original-name");if(a||(r.attr("data-original-name",r.attr("name")),a=r.attr("name")),!a)return;if(n)for(var s in n)a=a.replace("#"+s+"#",n[s]);r.attr("name",a)}}),i.data("initialSetup")||(n.find('input[type="radio"].siteorigin-widget-input').each(function(i,t){var r=e(t);r.prop("checked",r.prop("defaultChecked"))}),i.data("initialSetup",!0));var s=r.data("scroll-count")?parseInt(r.data("scroll-count")):0;if(s>0&&t.length>s){var o=t.first().outerHeight();i.css("max-height",o*s).css("overflow","auto")}else i.css("max-height","").css("overflow","")}),n.sortable({handle:".siteorigin-widget-field-repeater-item-top",items:"> .siteorigin-widget-field-repeater-item",update:function(){n.find('input[type="radio"].siteorigin-widget-input').attr("name",""),n.trigger("updateFieldPositions"),r.trigger("change")},sortstop:function(i,t){if(t.item.is(".siteorigin-widget-field-repeater-item"))t.item.find("> .siteorigin-widget-field-repeater-item-form").each(function(){e(this).find("> .siteorigin-widget-field").trigger("sowsetupformfield")});else{t.item.find(".siteorigin-widget-form").find("> .siteorigin-widget-field").trigger("sowsetupformfield")}r.trigger("change")}}),n.trigger("updateFieldPositions"),r.find("> .siteorigin-widget-field-repeater-add").disableSelection().click(function(i){i.preventDefault(),r.closest(".siteorigin-widget-field-repeater").sowAddRepeaterItem().find("> .siteorigin-widget-field-repeater-items").slideDown("fast",function(){e(window).resize()})}),r.find("> .siteorigin-widget-field-repeater-top > .siteorigin-widget-field-repeater-expand").click(function(i){i.preventDefault(),r.closest(".siteorigin-widget-field-repeater").find("> .siteorigin-widget-field-repeateritems-").slideToggle("fast",function(){e(window).resize()})})})},e.fn.sowAddRepeaterItem=function(){return e(this).each(function(i,t){var r=e(t),n=r.find("> .siteorigin-widget-field-repeater-items").children().length+1,a=e("<div>"+r.find("> .siteorigin-widget-field-repeater-item-html").html()+"</div>");a.find(".siteorigin-widget-input[data-name]").each(function(){var i=e(this);0===i.closest(".siteorigin-widget-field-repeater-item-html").length&&i.attr("name",e(this).data("name"))});var s=r.data("repeater-name"),o=new RegExp(s+"-_id_","g"),d=s+"-"+n,l=a.html().replace(o,d),g=void 0!==r.attr("readonly"),f=e('<div class="siteorigin-widget-field-repeater-item ui-draggable" />').append(e('<div class="siteorigin-widget-field-repeater-item-top" />').append(e('<div class="siteorigin-widget-field-expand" />')).append(g?"":e('<div class="siteorigin-widget-field-copy" />')).append(g?"":e('<div class="siteorigin-widget-field-remove" />')).append(e("<h4 />").html(r.data("item-name")))).append(e('<div class="siteorigin-widget-field-repeater-item-form" />').html(l));r.find("> .siteorigin-widget-field-repeater-items").append(f).sortable("refresh").trigger("updateFieldPositions"),f.sowSetupRepeaterItems(),f.hide().slideDown("fast",function(){e(window).resize()}),r.trigger("change")})},e.fn.sowRemoveRepeaterItem=function(){return e(this).each(function(i,t){var r=e(this).closest(".siteorigin-widget-field-repeater-items");e(this).remove(),r.sortable("refresh").trigger("updateFieldPositions"),e(t).trigger("change")})},e.fn.sowSetupRepeaterItems=function(){return e(this).each(function(i,t){var r=e(t);if(void 0===r.data("sowrepeater-actions-setup")){var n=r.closest(".siteorigin-widget-field-repeater"),a=r.find("> .siteorigin-widget-field-repeater-item-top"),s=n.data("item-label");if(s&&s.selector){var o=function(){var e=s.hasOwnProperty("valueMethod")&&s.valueMethod?s.valueMethod:"val",i=r.find(s.selector)[e]();i&&(i.length>80&&(i=i.substr(0,79)+"..."),a.find("h4").text(i))};o();var d=s.hasOwnProperty("updateEvent")&&s.updateEvent?s.updateEvent:"change";r.bind(d,o)}a.click(function(i){"siteorigin-widget-field-remove"!==i.target.className&&"siteorigin-widget-field-copy"!==i.target.className&&(i.preventDefault(),e(this).closest(".siteorigin-widget-field-repeater-item").find(".siteorigin-widget-field-repeater-item-form").eq(0).slideToggle("fast",function(){if(e(window).resize(),e(this).is(":visible")){e(this).trigger("slideToggleOpenComplete");e(this).find("> .siteorigin-widget-field").trigger("sowsetupformfield")}else e(this).trigger("slideToggleCloseComplete")}))}),a.find(".siteorigin-widget-field-remove").click(function(i,t){i.preventDefault();var n=e(this).closest(".siteorigin-widget-field-repeater-items"),a=e(this).closest(".siteorigin-widget-field-repeater-item"),s=function(){a.remove(),n.sortable("refresh").trigger("updateFieldPositions"),e(window).resize()};t&&t.silent?s():confirm(soWidgets.sure)&&a.slideUp("fast",s),r.trigger("change")}),a.find(".siteorigin-widget-field-copy").click(function(i){i.preventDefault();var t=e(this).closest(".siteorigin-widget-form-main"),n=e(this).closest(".siteorigin-widget-field-repeater-item"),a=n.clone(),s=n.closest(".siteorigin-widget-field-repeater-items"),o=s.children().length,d={};a.find("*[name]").each(function(){var i=e(this),s=i.attr("id"),l=i.attr("name");if(i.is("textarea")&&i.parent().is(".wp-editor-container")&&"undefined"!=typeof tinymce){i.parent().empty().append(i),i.css("display","");var g=tinymce.get(s);g&&i.val(g.getContent())}else if(i.is(".wp-color-picker")){var f=i.closest(".wp-picker-container"),p=i.closest(".siteorigin-widget-field");f.remove(),p.append(i.remove())}else{var c=s?n.find("#"+s):n.find('[name="'+l+'"]');c.length&&null!=c.val()&&i.val(c.val())}if(s){var u,m,w;if(i.is('[type="radio"]')){m=s.replace(/-\d+-\d+#x2F;,"");var v=s.replace(/-\d+#x2F;,"");if(!d[m]){var h={};d[m]=t.find(".siteorigin-widget-input[id^="+m+"]").not("[id*=_id_]").filter(function(i,t){var r=e(t).attr("name");return!h[r]&&(h[r]=!0,!0)}).length+1}var b=m+"-"+d[m];w=b+s.match(/-\d+#x2F;)[0],a.find("label[for="+v+"]").attr("for",b)}else u=new RegExp("-\\d+quot;),m=s.replace(u,""),d[m]||(d[m]=t.find(".siteorigin-widget-input[id^="+m+"]").not("[id*=_id_]").length+1),w=m+"-"+d[m]++;if(i.attr("id",w),i.is(".wp-editor-area")){var y=i.closest(".siteorigin-widget-tinymce-container"),F=y.data("media-buttons");if(F&&F.html){var u=new RegExp(s,"g");F.html=F.html.replace(u,w),y.data("media-buttons",F)}}a.find("label[for="+s+"]").attr("for",w),a.find("[id*="+s+"]").each(function(){var i=e(this).attr("id"),t=i.replace(s,w);e(this).attr("id",t)}),"undefined"!=typeof tinymce&&tinymce.get(w)&&tinymce.get(w).remove()}var k=n.parents(".siteorigin-widget-field-repeater").length,_=e("body");(_.hasClass("wp-customizer")||_.hasClass("widgets-php"))&&0===r.closest(".panel-dialog").length&&(k+=1);var C=l.replace(new RegExp("((?:.*?\\[\\d+\\]){"+(k-1).toString()+"})?(.*?\\[)\\d+(\\])"),"$1$2"+o.toString()+"$3");i.attr("name",C),i.data("original-name",C)}),s.append(a).sortable("refresh").trigger("updateFieldPositions"),a.sowSetupRepeaterItems(),a.hide().slideDown("fast",function(){e(window).resize()}),r.trigger("change")}),r.find("> .siteorigin-widget-field-repeater-item-form").sowSetupForm(),r.data("sowrepeater-actions-setup",!0)}})},sowbForms.getContainerFieldId=function(e,i,t){var r=i+"FieldId";this.hasOwnProperty(r)||(this[r]=1);var n=e.closest(t);if(n.length){var a=n.data("field-id");return void 0===a&&(a=this[r]++),n.data("field-id",a),a}return!1},sowbForms.getWidgetFieldVariable=function(e,i,t){var r=window.sow_field_javascript_variables[e];i=i.replace(/\[#.*?#\]/g,"");for(var n=/[a-zA-Z0-9\-]+(?:\[c?[0-9]+\])?\[(.*)\]/.exec(i)[1],a=n.split("]["),s=a.length?r:null;a.length;)s=s[a.shift()];return s[t]},sowbForms.fetchWidgetVariable=function(i,t,r){window.sowVars=window.sowVars||{},void 0===window.sowVars[t]?e.post(soWidgets.ajaxurl,{action:"sow_get_javascript_variables",widget:t,key:i},function(e){window.sowVars[t]=e,r(window.sowVars[t][i])}):r(window.sowVars[t][i])},sowbForms.getWidgetFormValues=function(i){if(_.isUndefined(i))return null;var t={};return i.find("*[name]").each(function(){var i=e(this);try{var r=/[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec(i.attr("name"));if(_.isEmpty(r))return!0;r=r[1];var n=r.split("][");n=n.map(function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e});var a=t,s=null,o=_.isString(i.attr("type"))?i.attr("type").toLowerCase():null;if("checkbox"===o)s=!!i.is(":checked")&&(""===i.val()||i.val());else if("radio"===o){if(!i.is(":checked"))return;s=i.val()}else if("TEXTAREA"===i.prop("tagName")&&i.hasClass("wp-editor-area")){var d=null;"undefined"!=typeof tinyMCE&&(d=tinyMCE.get(i.attr("id"))),s=null===d||"function"!=typeof d.getContent||d.isHidden()?i.val():d.getContent()}else if("SELECT"===i.prop("tagName")){var l=i.find("option:selected");1===l.length?s=i.find("option:selected").val():l.length>1&&(s=_.map(i.find("option:selected"),function(i,t){return e(i).val()}))}else s=i.val();for(var g=0;g<n.length;g++)g===n.length-1?""===n[g]?a.push(s):a[n[g]]=s:(_.isUndefined(a[n[g]])&&(_.isNumber(n[g+1])||""===n[g+1]?a[n[g]]=[]:a[n[g]]={}),a=a[n[g]])}catch(e){console.error("Field ["+i.attr("name")+"] could not be processed and was skipped - "+e.message)}}),t},sowbForms.setWidgetFormValues=function(i,t,r,n){r=r||!1,n=void 0!==n&&n||void 0===n;var a=0,s=function(i,t){if(10==++a)return void--a;i.find("> .siteorigin-widget-field-type-repeater,> .siteorigin-widget-field-type-section > .siteorigin-widget-section > .siteorigin-widget-field-type-repeater").each(function(i,n){var a=e(this),o=a.find("> .siteorigin-widget-field-repeater"),d=o.data("repeaterName"),l=t.hasOwnProperty(d)?t[d]:null;if(a.parent().is(".siteorigin-widget-section")){var g=o.data("element-name");g=g.replace(/\[#.*?#\]/g,"");for(var f=/[a-zA-Z0-9\-]+(?:\[c?[0-9]+\])?\[(.*)\]/.exec(g)[1],p=f.split("]["),c=p.length?t:null;p.length;){var u=p.shift();c=c.hasOwnProperty(u)?c[u]:c}l=c}if(l&&Array.isArray(l)){var m=o.find("> .siteorigin-widget-field-repeater-items > .siteorigin-widget-field-repeater-item"),w=l.length,v=m.length;if(w>v)for(var h=0;h<w-v;h++)o.find("> .siteorigin-widget-field-repeater-add").click();else if(!r&&w<v)for(var b=w;b<v;b++){var y=e(m.eq(b));y.find("> .siteorigin-widget-field-repeater-item-top").find(".siteorigin-widget-field-remove").trigger("click",{silent:!0})}m=o.find("> .siteorigin-widget-field-repeater-items > .siteorigin-widget-field-repeater-item");for(var F=0;F<m.length;F++)m.eq(F).find("> .siteorigin-widget-field-repeater-item-form"),s(m.eq(F).find("> .siteorigin-widget-field-repeater-item-form"),l[F])}}),--a};s(i,t),i.find("*[name]").each(function(){var i=e(this),a=/[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec(i.attr("name"));if(void 0===a||null===a)return!0;a=a[1];var s=a.split("][");s=s.map(function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e});for(var o,d=t,l=0;l<s.length;l++){if(!d.hasOwnProperty(s[l])){if(r)return!0;break}l===s.length-1?o=d[s[l]]:d=d[s[l]]}if("checkbox"===i.attr("type"))i.prop("checked",o);else if("radio"===i.attr("type"))i.prop("checked",o===i.val());else if("TEXTAREA"===i.prop("tagName")&&i.hasClass("wp-editor-area")){var g=null;"undefined"!=typeof tinyMCE&&(g=tinyMCE.get(i.attr("id"))),null!==g&&"function"==typeof g.setContent&&!g.isHidden()&&i.parent().is(":visible")?g.initialized?g.setContent(o):g.on("init",function(){g.setContent(o)}):i.val(o)}else if(i.is(".panels-data")){i.val(o);var f=i.data("builder");f&&f.setDataField(i)}else i.val(o);n&&i.trigger("change")})},e(".widgets-holder-wrap").on("click",".widget:has(.siteorigin-widget-form-main) .widget-top",function(){var i=e(this).closest(".widget").find(".siteorigin-widget-form-main");setTimeout(function(){i.sowSetupForm()},200)});var i=e("body");i.hasClass("wp-customizer")&&e(document).on("widget-added",function(e,i){i.find(".siteorigin-widget-form").sowSetupForm()}),i.hasClass("gutenberg-editor-page")&&e(document).on("panels_setup_preview",function(){e(sowb).trigger("setup_widgets")}),e(document).on("open_dialog",function(i,t){if(t.$el.find(".so-panels-dialog").is(".so-panels-dialog-edit-widget")){e(i.target).find(".siteorigin-widget-form-main").find("> .siteorigin-widget-field").trigger("sowsetupformfield")}}),e(function(){e(document).trigger("sowadminloaded")})}(jQuery);var sowEmitters={_match:function(e,i){void 0===i&&(i=".*");var t=new RegExp("^([a-zA-Z0-9_-]+)(\\[([a-zA-Z0-9_-]+)\\])? *: *("+i+") *quot;),r=t.exec(e);if(null===r)return!1;var n="",a="default";return void 0!==r[3]?(a=r[1],n=r[3]):n=r[1],{match:r[4].trim(),group:a,state:n}},_checker:function(e,i,t,r){var n={};void 0===i.length&&(i=[i]);for(var a,s=0;s<i.length;s++)!1!==(a=sowEmitters._match(i[s],t))&&("_true"===a.match||r(e,i,a.match))&&(n[a.group]=a.state);return n},select:function(e,i){void 0===i.length&&(i=[i]);for(var t={},r=0;r<i.length;r++)""===i[r]&&(i[r]="default"),t[i[r]]=e;return t},conditional:function(val,args){return sowEmitters._checker(val,args,"[^;{}]*",function(val,args,match){return eval(match)})},in:function(e,i){return sowEmitters._checker(e,i,"[^;{}]*",function(e,i,t){return-1!==t.split(",").map(function(e){return e.trim()}).indexOf(e)})}};window.sowbForms=sowbForms;
1
+ var sowbForms=window.sowbForms||{};!function(e){e.fn.sowSetupForm=function(){return e(this).each(function(i,t){var r,n=e(t),a=!0,s=e("body"),o=n.find("input[name]");if(o.length&&-1!==o.attr("name").indexOf("__i__"))return this;if(n.is(".siteorigin-widget-form-main")){if(!0===n.data("sow-form-setup"))return!0;if(s.hasClass("widgets-php")&&!n.is(":visible")&&0===n.closest(".panel-dialog").length)return!0;n.on("sowstatechange",function(i,t,r){n.find("[data-state-handler]").each(function(){var i=e(this),n=e.extend({},i.data("state-handler"),a?i.data("state-handler-initial"):{});if(0===Object.keys(n).length)return!0;var s,o,d,l,g,f,c={},p=sowbForms.getContainerFieldId(i,"repeater",".siteorigin-widget-field-repeater-item");if(!1!==p){var u={};for(var m in n)u[m.replace("{$repeater}",p)]=n[m];n=u}var w=sowbForms.getContainerFieldId(i,"widget",".siteorigin-widget-widget");if(!1!==w){var v={};for(var h in n){var b=h.match(/_else\[(.*)\]|(.*)\[(.*)\]/),y="";y=b&&b.length&&void 0===b[1]?b[2]+"_"+w+"["+b[3]+"]":"_else["+b[1]+"_"+w+"]",v[y]=n[h]}n=v}for(var F in n)if(g=!1,null!==(s=F.match(/^([a-zA-Z0-9_-]+)(\[([a-zA-Z0-9_\-,]+)\])?(\[\])?#x2F;))){if(o={group:"default",name:"",multi:!1},void 0!==s[2]?(o.group=s[1],o.name=s[3]):o.name=s[0],o.multi=void 0!==s[4],"_else"===o.group)o.group=o.name,o.name="",g=o.group===t&&void 0===c[o.group];else{f=o.name.split(",").map(function(e){return e.trim()});for(var k=0;k<f.length&&!(g=o.group===t&&f[k]===r);k++);}if(g){d=n[F],o.multi||(d=[d]);for(var k=0;k<d.length;k++)l=void 0!==d[k][1]&&Boolean(d[k][1])?i.find(d[k][1]):i,l[d[k][0]].apply(l,void 0!==d[k][2]?d[k][2]:[]);c[o.group]=!0}}})}),n.sowSetupPreview(),r=n;var d=n.find(".siteorigin-widget-teaser");if(d.find(".dashicons-dismiss").click(function(){var i=e(this);e.get(i.data("dismiss-url")),d.slideUp("normal",function(){d.remove()})}),!n.data("backupDisabled")){var l=n.find("> .siteorigin-widgets-form-id").val(),g=n.find("> .siteorigin-widgets-form-timestamp"),f=parseInt(g.val()||0),c=JSON.parse(sessionStorage.getItem(l));if(c)if(c._sow_form_timestamp>f){var p=e('<div class="siteorigin-widget-form-notification"><span>'+soWidgets.backup.newerVersion+'</span><a class="button button-small so-backup-restore">'+soWidgets.backup.restore+'</a><a class="button button-small so-backup-dismiss">'+soWidgets.backup.dismiss+"</a><div><small>"+soWidgets.backup.replaceWarning+"</small></div></div>");n.prepend(p),p.find(".so-backup-restore").click(function(){sowbForms.setWidgetFormValues(r,c),p.slideUp("fast",function(){p.remove()})}),p.find(".so-backup-dismiss").click(function(){p.slideUp("fast",function(){sessionStorage.removeItem(l),p.remove()})})}else sessionStorage.removeItem(l);n.change(function(){g.val((new Date).getTime());var e=sowbForms.getWidgetFormValues(n);sessionStorage.setItem(l,JSON.stringify(e))})}}else r=n.closest(".siteorigin-widget-form-main");r.find("> .siteorigin-widgets-form-id").val();var u=n.find("> .siteorigin-widget-field");u.find("> .siteorigin-widget-section").sowSetupForm();var m=u.find("> .siteorigin-widget-widget");m.find("> .siteorigin-widget-section").sowSetupForm(),m.filter(":not(:has(> .siteorigin-widget-section))").sowSetupForm(),u.find(".siteorigin-widget-input").each(function(i,t){null===e(t).data("original-name")&&e(t).data("original-name",e(t).attr("name"))}),u.find("> .siteorigin-widget-field-repeater").sowSetupRepeater(),n.find(".siteorigin-widget-field-repeater-item").sowSetupRepeaterItems(),u.find("> .siteorigin-widget-input-color").each(function(){var i=e(this),t={change:function(i,t){setTimeout(function(){e(i.target).trigger("change")},100)}};i.data("defaultColor")&&(t.defaultColor=i.data("defaultColor")),i.wpColorPicker(t)});var w=function(){e(this).toggleClass("siteorigin-widget-section-visible"),e(this).parent().find("> .siteorigin-widget-section, > .siteorigin-widget-widget > .siteorigin-widget-section").slideToggle("fast",function(){if(e(window).resize(),e(this).find("> .siteorigin-widget-field-container-state").val(e(this).is(":visible")?"open":"closed"),e(this).is(":visible")){e(this).find("> .siteorigin-widget-field").trigger("sowsetupformfield")}})};u.filter(".siteorigin-widget-field-type-widget, .siteorigin-widget-field-type-section").find("> label").click(w),u.filter(".siteorigin-widget-field-type-posts").find(".posts-container-label-wrapper").click(w),u.filter(".siteorigin-widget-field-type-slider").each(function(){var i=e(this),t=i.find('input[type="number"]'),r=i.find(".siteorigin-widget-value-slider");r.slider({max:parseFloat(t.attr("max")),min:parseFloat(t.attr("min")),step:parseFloat(t.attr("step")),value:parseFloat(t.val()),slide:function(e,i){t.val(parseFloat(i.value)),t.trigger("change")},change:function(e,t){i.find(".siteorigin-widget-slider-value").html(t.value)}}),t.change(function(e,i){i&&i.silent||r.slider("value",parseFloat(t.val()))})}),u.filter(".siteorigin-widget-field-type-link").each(function(){var i=e(this),t=null,r=function(){null!==t&&t.abort();var r=i.find(".content-text-search"),n=r.val(),a=r.data("postTypes"),s=i.find("ul.posts").empty().addClass("loading");e.get(soWidgets.ajaxurl,{action:"so_widgets_search_posts",query:n,postTypes:a},function(i){for(var t=0;t<i.length;t++)""===i[t].label&&(i[t].label="&nbsp;"),s.append(e("<li>").addClass("post").html(i[t].label+"<span>("+i[t].type+")</span>").data(i[t]));s.removeClass("loading")})};i.find(".select-content-button, .button-close").click(function(t){t.preventDefault(),e(this).blur();var n=i.find(".existing-content-selector");n.toggle(),n.is(":visible")&&0===n.find("ul.posts li").length&&r()}),i.on("click",".posts li",function(t){t.preventDefault();var r=e(this);i.find("input.siteorigin-widget-input").val("post: "+r.data("value")),i.change(),i.find(".existing-content-selector").toggle()});var n=null;i.find(".content-text-search").keyup(function(){null!==n&&clearTimeout(n),n=setTimeout(function(){r()},500)})}),void 0!==jQuery.fn.soPanelsSetupBuilderWidget&&u.filter(".siteorigin-widget-field-type-builder").each(function(){e(this).find("> .siteorigin-page-builder-field").each(function(){var i=e(this);i.soPanelsSetupBuilderWidget({builderType:i.data("type")})})});var v=function(){var i=e(this),t=i.closest("[data-state-emitter]").data("state-emitter");if(void 0!==t){var n={default:""};void 0===t.length&&(t=[t]);for(var a=0;a<t.length;a++)n=function(t,r){if(void 0===sowEmitters[t.callback]||"_"===t.callback.substr(0,1))return r;if(i.is('[type="radio"]')&&!i.is(":checked"))return r;var n=sowbForms.getContainerFieldId(i,"repeater",".siteorigin-widget-field-repeater-item");!1!==n&&(t.args=t.args.map(function(e){return e.replace("{$repeater}",n)}));var a=sowbForms.getContainerFieldId(i,"widget",".siteorigin-widget-widget");!1===a||t.hasOwnProperty("widgetFieldId")||(t.widgetFieldId=a,t.args=t.args.map(function(e){return e+"_"+a}));var s=i.is('[type="checkbox"]')?i.is(":checked"):i.val();return e.extend(r,sowEmitters[t.callback](s,t.args))}(t[a],n);var s=r.data("states");void 0===s&&(s={default:""});for(var o in n)void 0!==s[o]&&n[o]===s[o]||(s[o]=n[o],r.trigger("sowstatechange",[o,n[o]]));r.data("states",s)}};u.filter("[data-state-emitter]").each(function(){var i=e(this).find(".siteorigin-widget-input");i.on("keyup change",v),i.each(function(){var i=e(this);i.is(":radio")?i.is(":checked")&&v.call(i[0]):v.call(i[0])})}),n.trigger("sowsetupform",u).data("sow-form-setup",!0),u.trigger("sowsetupformfield"),n.find(".siteorigin-widget-field-repeater-item").trigger("updateFieldPositions"),(s.hasClass("wp-customizer")||s.hasClass("widgets-php"))&&n.closest(".ui-sortable").on("sortstop",function(e,i){i.item.find(".siteorigin-widget-form").find("> .siteorigin-widget-field").trigger("sowsetupformfield")}),a=!1})},e.fn.sowSetupPreview=function(){var i=e(this);i.siblings(".siteorigin-widget-preview").find("> a").click(function(t){t.preventDefault();var r=sowbForms.getWidgetFormValues(i),n=e(e("#so-widgets-bundle-tpl-preview-dialog").html().trim()).appendTo("body");n.find('input[name="data"]').val(JSON.stringify(r)),n.find('input[name="class"]').val(i.data("class")),n.find("iframe").on("load",function(){e(this).css("visibility","visible")}),n.find("form").submit(),n.find(".close").click(function(){n.remove()})})},e.fn.sowSetupRepeater=function(){return e(this).each(function(i,t){var r=e(t),n=r.find(".siteorigin-widget-field-repeater-items"),a=r.data("repeater-name");n.bind("updateFieldPositions",function(){var i=e(this),t=i.find("> .siteorigin-widget-field-repeater-item");t.each(function(i,t){e(t).find(".siteorigin-widget-input").each(function(t,r){var n=e(r).data("repeater-positions");void 0===n&&(n={}),n[a]=i,e(r).data("repeater-positions",n)})}),i.find(".siteorigin-widget-input").each(function(i,t){var r=e(t),n=r.data("repeater-positions");if(void 0!==n){var a=r.attr("data-original-name");if(a||(r.attr("data-original-name",r.attr("name")),a=r.attr("name")),!a)return;if(n)for(var s in n)a=a.replace("#"+s+"#",n[s]);r.attr("name",a)}}),i.data("initialSetup")||(i.find(".siteorigin-widget-input").each(function(i,t){var r=e(t);r.prop("checked",r.prop("defaultChecked"))}),i.data("initialSetup",!0));var n=r.data("scroll-count")?parseInt(r.data("scroll-count")):0;if(n>0&&t.length>n){var s=t.first().outerHeight();i.css("max-height",s*n).css("overflow","auto")}else i.css("max-height","").css("overflow","")}),n.sortable({handle:".siteorigin-widget-field-repeater-item-top",items:"> .siteorigin-widget-field-repeater-item",update:function(){n.find('input[type="radio"].siteorigin-widget-input').attr("name",""),n.trigger("updateFieldPositions"),r.trigger("change")},sortstop:function(i,t){if(t.item.is(".siteorigin-widget-field-repeater-item"))t.item.find("> .siteorigin-widget-field-repeater-item-form").each(function(){e(this).find("> .siteorigin-widget-field").trigger("sowsetupformfield")});else{t.item.find(".siteorigin-widget-form").find("> .siteorigin-widget-field").trigger("sowsetupformfield")}r.trigger("change")}}),n.trigger("updateFieldPositions"),r.find("> .siteorigin-widget-field-repeater-add").disableSelection().click(function(i){i.preventDefault(),r.closest(".siteorigin-widget-field-repeater").sowAddRepeaterItem().find("> .siteorigin-widget-field-repeater-items").slideDown("fast",function(){e(window).resize()})}),r.find("> .siteorigin-widget-field-repeater-top > .siteorigin-widget-field-repeater-expand").click(function(i){i.preventDefault(),r.closest(".siteorigin-widget-field-repeater").find("> .siteorigin-widget-field-repeateritems-").slideToggle("fast",function(){e(window).resize()})})})},e.fn.sowAddRepeaterItem=function(){return e(this).each(function(i,t){var r=e(t),n=r.find("> .siteorigin-widget-field-repeater-items").children().length+1,a=e("<div>"+r.find("> .siteorigin-widget-field-repeater-item-html").html()+"</div>");a.find(".siteorigin-widget-input[data-name]").each(function(){var i=e(this);0===i.closest(".siteorigin-widget-field-repeater-item-html").length&&i.attr("name",e(this).data("name"))});var s="";a.find("> .siteorigin-widget-field").each(function(i,t){var r=t.outerHTML;e(t).is(".siteorigin-widget-field-type-repeater")||(r=r.replace(/_id_/g,n)),s+=r});var o=void 0!==r.attr("readonly"),d=e('<div class="siteorigin-widget-field-repeater-item ui-draggable" />').append(e('<div class="siteorigin-widget-field-repeater-item-top" />').append(e('<div class="siteorigin-widget-field-expand" />')).append(o?"":e('<div class="siteorigin-widget-field-copy" />')).append(o?"":e('<div class="siteorigin-widget-field-remove" />')).append(e("<h4 />").html(r.data("item-name")))).append(e('<div class="siteorigin-widget-field-repeater-item-form" />').html(s));r.find("> .siteorigin-widget-field-repeater-items").append(d).sortable("refresh").trigger("updateFieldPositions"),d.sowSetupRepeaterItems(),d.hide().slideDown("fast",function(){e(window).resize()}),r.trigger("change")})},e.fn.sowRemoveRepeaterItem=function(){return e(this).each(function(i,t){var r=e(this).closest(".siteorigin-widget-field-repeater-items");e(this).remove(),r.sortable("refresh").trigger("updateFieldPositions"),e(t).trigger("change")})},e.fn.sowSetupRepeaterItems=function(){return e(this).each(function(i,t){var r=e(t);if(void 0===r.data("sowrepeater-actions-setup")){var n=r.closest(".siteorigin-widget-field-repeater"),a=r.find("> .siteorigin-widget-field-repeater-item-top"),s=n.data("item-label");if(s&&s.selector){var o=function(){var e=s.hasOwnProperty("valueMethod")&&s.valueMethod?s.valueMethod:"val",i=r.find(s.selector)[e]();i&&(i.length>80&&(i=i.substr(0,79)+"..."),a.find("h4").text(i))};o();var d=s.hasOwnProperty("updateEvent")&&s.updateEvent?s.updateEvent:"change";r.bind(d,o)}a.click(function(i){"siteorigin-widget-field-remove"!==i.target.className&&"siteorigin-widget-field-copy"!==i.target.className&&(i.preventDefault(),e(this).closest(".siteorigin-widget-field-repeater-item").find(".siteorigin-widget-field-repeater-item-form").eq(0).slideToggle("fast",function(){if(e(window).resize(),e(this).is(":visible")){e(this).trigger("slideToggleOpenComplete");e(this).find("> .siteorigin-widget-field").trigger("sowsetupformfield")}else e(this).trigger("slideToggleCloseComplete")}))}),a.find(".siteorigin-widget-field-remove").click(function(i,t){i.preventDefault();var n=e(this).closest(".siteorigin-widget-field-repeater-items"),a=e(this).closest(".siteorigin-widget-field-repeater-item"),s=function(){a.remove(),n.sortable("refresh").trigger("updateFieldPositions"),e(window).resize()};t&&t.silent?s():confirm(soWidgets.sure)&&a.slideUp("fast",s),r.trigger("change")}),a.find(".siteorigin-widget-field-copy").click(function(i){i.preventDefault();var t=e(this).closest(".siteorigin-widget-form-main"),n=e(this).closest(".siteorigin-widget-field-repeater-item"),a=n.clone(),s=n.closest(".siteorigin-widget-field-repeater-items"),o=s.children().length,d={};a.find("*[name]").each(function(){var i=e(this),s=i.attr("id"),l=i.attr("name");if(i.is("textarea")&&i.parent().is(".wp-editor-container")&&"undefined"!=typeof tinymce){i.parent().empty().append(i),i.css("display","");var g=tinymce.get(s);g&&i.val(g.getContent())}else if(i.is(".wp-color-picker")){var f=i.closest(".wp-picker-container"),c=i.closest(".siteorigin-widget-field");f.remove(),c.append(i.remove())}else{var p=s?n.find("#"+s):n.find('[name="'+l+'"]');p.length&&null!=p.val()&&i.val(p.val())}if(s){var u,m,w;if(i.is('[type="radio"]')){m=s.replace(/-\d+-\d+#x2F;,"");var v=s.replace(/-\d+#x2F;,"");if(!d[m]){var h={};d[m]=t.find(".siteorigin-widget-input[id^="+m+"]").not("[id*=_id_]").filter(function(i,t){var r=e(t).attr("name");return!h[r]&&(h[r]=!0,!0)}).length+1}var b=m+"-"+d[m];w=b+s.match(/-\d+#x2F;)[0],a.find("label[for="+v+"]").attr("for",b)}else u=new RegExp("-\\d+quot;),m=s.replace(u,""),d[m]||(d[m]=t.find(".siteorigin-widget-input[id^="+m+"]").not("[id*=_id_]").length+1),w=m+"-"+d[m]++;if(i.attr("id",w),i.is(".wp-editor-area")){var y=i.closest(".siteorigin-widget-tinymce-container"),F=y.data("media-buttons");if(F&&F.html){var u=new RegExp(s,"g");F.html=F.html.replace(u,w),y.data("media-buttons",F)}}a.find("label[for="+s+"]").attr("for",w),a.find("[id*="+s+"]").each(function(){var i=e(this).attr("id"),t=i.replace(s,w);e(this).attr("id",t)}),"undefined"!=typeof tinymce&&tinymce.get(w)&&tinymce.get(w).remove()}var k=n.parents(".siteorigin-widget-field-repeater").length,_=e("body");(_.hasClass("wp-customizer")||_.hasClass("widgets-php"))&&0===r.closest(".panel-dialog").length&&(k+=1);var C=l.replace(new RegExp("((?:.*?\\[\\d+\\]){"+(k-1).toString()+"})?(.*?\\[)\\d+(\\])"),"$1$2"+o.toString()+"$3");i.attr("name",C),i.data("original-name",C)}),s.append(a).sortable("refresh").trigger("updateFieldPositions"),a.sowSetupRepeaterItems(),a.hide().slideDown("fast",function(){e(window).resize()}),r.trigger("change")}),r.find("> .siteorigin-widget-field-repeater-item-form").sowSetupForm(),r.data("sowrepeater-actions-setup",!0)}})},sowbForms.getContainerFieldId=function(e,i,t){var r=i+"FieldId";this.hasOwnProperty(r)||(this[r]=1);var n=e.closest(t);if(n.length){var a=n.data("field-id");return void 0===a&&(a=this[r]++),n.data("field-id",a),a}return!1},sowbForms.getWidgetFieldVariable=function(e,i,t){var r=window.sow_field_javascript_variables[e];i=i.replace(/\[#.*?#\]/g,"");for(var n=/[a-zA-Z0-9\-]+(?:\[c?[0-9]+\])?\[(.*)\]/.exec(i)[1],a=n.split("]["),s=a.length?r:null;a.length;)s=s[a.shift()];return s[t]},sowbForms.fetchWidgetVariable=function(i,t,r){window.sowVars=window.sowVars||{},void 0===window.sowVars[t]?e.post(soWidgets.ajaxurl,{action:"sow_get_javascript_variables",widget:t,key:i},function(e){window.sowVars[t]=e,r(window.sowVars[t][i])}):r(window.sowVars[t][i])},sowbForms.getWidgetFormValues=function(i){if(_.isUndefined(i))return null;var t={};return i.find("*[name]").each(function(){var i=e(this);try{var r=/[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec(i.attr("name"));if(_.isEmpty(r))return!0;r=r[1];var n=r.split("][");n=n.map(function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e});var a=t,s=null,o=_.isString(i.attr("type"))?i.attr("type").toLowerCase():null;if("checkbox"===o)s=!!i.is(":checked")&&(""===i.val()||i.val());else if("radio"===o){if(!i.is(":checked"))return;s=i.val()}else if("TEXTAREA"===i.prop("tagName")&&i.hasClass("wp-editor-area")){var d=null;"undefined"!=typeof tinyMCE&&(d=tinyMCE.get(i.attr("id"))),s=null===d||"function"!=typeof d.getContent||d.isHidden()?i.val():d.getContent()}else if("SELECT"===i.prop("tagName")){var l=i.find("option:selected");1===l.length?s=i.find("option:selected").val():l.length>1&&(s=_.map(i.find("option:selected"),function(i,t){return e(i).val()}))}else s=i.val();for(var g=0;g<n.length;g++)g===n.length-1?""===n[g]?a.push(s):a[n[g]]=s:(_.isUndefined(a[n[g]])&&(_.isNumber(n[g+1])||""===n[g+1]?a[n[g]]=[]:a[n[g]]={}),a=a[n[g]])}catch(e){console.error("Field ["+i.attr("name")+"] could not be processed and was skipped - "+e.message)}}),t},sowbForms.setWidgetFormValues=function(i,t,r,n){r=r||!1,n=void 0!==n&&n||void 0===n;var a=0,s=function(i,t){if(10==++a)return void--a;i.find("> .siteorigin-widget-field-type-repeater,> .siteorigin-widget-field-type-section > .siteorigin-widget-section > .siteorigin-widget-field-type-repeater").each(function(i,n){var a=e(this),o=a.find("> .siteorigin-widget-field-repeater"),d=o.data("repeaterName"),l=t.hasOwnProperty(d)?t[d]:null;if(a.parent().is(".siteorigin-widget-section")){var g=o.data("element-name");g=g.replace(/\[#.*?#\]/g,"");for(var f=/[a-zA-Z0-9\-]+(?:\[c?[0-9]+\])?\[(.*)\]/.exec(g)[1],c=f.split("]["),p=c.length?t:null;c.length;){var u=c.shift();p=p.hasOwnProperty(u)?p[u]:p}l=p}if(l&&Array.isArray(l)){var m=o.find("> .siteorigin-widget-field-repeater-items > .siteorigin-widget-field-repeater-item"),w=l.length,v=m.length;if(w>v)for(var h=0;h<w-v;h++)o.find("> .siteorigin-widget-field-repeater-add").click();else if(!r&&w<v)for(var b=w;b<v;b++){var y=e(m.eq(b));y.find("> .siteorigin-widget-field-repeater-item-top").find(".siteorigin-widget-field-remove").trigger("click",{silent:!0})}m=o.find("> .siteorigin-widget-field-repeater-items > .siteorigin-widget-field-repeater-item");for(var F=0;F<m.length;F++)m.eq(F).find("> .siteorigin-widget-field-repeater-item-form"),s(m.eq(F).find("> .siteorigin-widget-field-repeater-item-form"),l[F])}}),--a};s(i,t),i.find("*[name]").each(function(){var i=e(this),a=/[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec(i.attr("name"));if(void 0===a||null===a)return!0;a=a[1];var s=a.split("][");s=s.map(function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e});for(var o,d=t,l=0;l<s.length;l++){if(!d.hasOwnProperty(s[l])){if(r)return!0;break}l===s.length-1?o=d[s[l]]:d=d[s[l]]}if("checkbox"===i.attr("type"))i.prop("checked",o);else if("radio"===i.attr("type"))i.prop("checked",o===i.val());else if("TEXTAREA"===i.prop("tagName")&&i.hasClass("wp-editor-area")){var g=null;"undefined"!=typeof tinyMCE&&(g=tinyMCE.get(i.attr("id"))),null!==g&&"function"==typeof g.setContent&&!g.isHidden()&&i.parent().is(":visible")?g.initialized?g.setContent(o):g.on("init",function(){g.setContent(o)}):i.val(o)}else if(i.is(".panels-data")){i.val(o);var f=i.data("builder");f&&f.setDataField(i)}else i.val(o);n&&i.trigger("change")})},e(".widgets-holder-wrap").on("click",".widget:has(.siteorigin-widget-form-main) .widget-top",function(){var i=e(this).closest(".widget").find(".siteorigin-widget-form-main");setTimeout(function(){i.sowSetupForm()},200)});var i=e("body");i.hasClass("wp-customizer")&&e(document).on("widget-added",function(e,i){i.find(".siteorigin-widget-form").sowSetupForm()}),i.hasClass("block-editor-page")&&e(document).on("panels_setup_preview",function(){e(sowb).trigger("setup_widgets")}),e(document).on("open_dialog",function(e,i){if(i.$el.find(".so-panels-dialog").is(".so-panels-dialog-edit-widget")){i.$el.find(".siteorigin-widget-form-main").find("> .siteorigin-widget-field").trigger("sowsetupformfield")}}),e(function(){e(document).trigger("sowadminloaded")})}(jQuery);var sowEmitters={_match:function(e,i){void 0===i&&(i=".*");var t=new RegExp("^([a-zA-Z0-9_-]+)(\\[([a-zA-Z0-9_-]+)\\])? *: *("+i+") *quot;),r=t.exec(e);if(null===r)return!1;var n="",a="default";return void 0!==r[3]?(a=r[1],n=r[3]):n=r[1],{match:r[4].trim(),group:a,state:n}},_checker:function(e,i,t,r){var n={};void 0===i.length&&(i=[i]);for(var a,s=0;s<i.length;s++)!1!==(a=sowEmitters._match(i[s],t))&&("_true"===a.match||r(e,i,a.match))&&(n[a.group]=a.state);return n},select:function(e,i){void 0===i.length&&(i=[i]);for(var t={},r=0;r<i.length;r++)""===i[r]&&(i[r]="default"),t[i[r]]=e;return t},conditional:function(val,args){return sowEmitters._checker(val,args,"[^;{}]*",function(val,args,match){return eval(match)})},in:function(e,i){return sowEmitters._checker(e,i,"[^;{}]*",function(e,i,t){return-1!==t.split(",").map(function(e){return e.trim()}).indexOf(e)})}};window.sowbForms=sowbForms;
base/siteorigin-widget.class.php CHANGED
@@ -1068,12 +1068,12 @@ abstract class SiteOrigin_Widget extends WP_Widget {
1068
else {
1069
$name = array();
1070
foreach ( $container as $container_item ) {
1071
- $name[] = $container_item['name'] . ( ! empty( $container_item['is_template'] ) ? '-_id_' : '' );
1072
}
1073
$name[] = $field_name;
1074
- $field_id_base = $this->get_field_id( implode( '-', $name ) );
1075
if ( $is_template ) {
1076
- return $field_id_base;
1077
}
1078
if ( ! isset( $this->field_ids[ $field_id_base ] ) ) {
1079
$this->field_ids[ $field_id_base ] = 1;
1068
else {
1069
$name = array();
1070
foreach ( $container as $container_item ) {
1071
+ $name[] = $container_item['name'];
1072
}
1073
$name[] = $field_name;
1074
+ $field_id_base = $this->get_field_id(implode('-', $name));
1075
if ( $is_template ) {
1076
+ return $field_id_base . '-_id_';
1077
}
1078
if ( ! isset( $this->field_ids[ $field_id_base ] ) ) {
1079
$this->field_ids[ $field_id_base ] = 1;
compat/{gutenberg → block-editor}/widget-block.js RENAMED
@@ -20,7 +20,7 @@
20
return el(
21
'span',
22
{
23
- className: 'widget-icon so-widget-icon so-gutenberg-icon'
24
}
25
)
26
},
@@ -53,9 +53,9 @@
53
54
if ( props.loadingWidgets ) {
55
$.get( {
56
- url: sowbGutenbergAdmin.restUrl + 'sowb/v1/widgets',
57
beforeSend: function ( xhr ) {
58
- xhr.setRequestHeader( 'X-WP-Nonce', sowbGutenbergAdmin.nonce );
59
}
60
} )
61
.then( function( widgets ) {
@@ -69,7 +69,7 @@
69
70
function onWidgetClassChange( newWidgetClass ) {
71
if ( newWidgetClass !== '' ) {
72
- if ( props.widgetSettingsChanged && ! confirm( sowbGutenbergAdmin.confirmChangeWidget ) ) {
73
return false;
74
}
75
props.setAttributes( { widgetClass: newWidgetClass, widgetData: null } );
@@ -147,9 +147,9 @@
147
var loadingWidgetForm = props.attributes.widgetClass && !props.widgetFormHtml;
148
if ( loadingWidgetForm ) {
149
$.get( {
150
- url: sowbGutenbergAdmin.restUrl + 'sowb/v1/widgets/forms',
151
beforeSend: function ( xhr ) {
152
- xhr.setRequestHeader( 'X-WP-Nonce', sowbGutenbergAdmin.nonce );
153
},
154
data: {
155
widgetClass: props.attributes.widgetClass
@@ -192,7 +192,7 @@
192
el( Spinner ) :
193
el(
194
'div',
195
- { className: 'so-widget-gutenberg-container' },
196
el(
197
SelectControl,
198
{
@@ -202,7 +202,7 @@
202
}
203
),
204
el( 'div', {
205
- className: 'so-widget-gutenberg-form-container',
206
dangerouslySetInnerHTML: { __html: widgetForm },
207
ref: setupWidgetForm,
208
} )
@@ -215,9 +215,9 @@
215
var loadingWidgetPreview = !props.editing && !props.widgetPreviewHtml;
216
if ( loadingWidgetPreview ) {
217
$.get( {
218
- url: sowbGutenbergAdmin.restUrl + 'sowb/v1/widgets/previews',
219
beforeSend: function ( xhr ) {
220
- xhr.setRequestHeader( 'X-WP-Nonce', sowbGutenbergAdmin.nonce );
221
},
222
data: {
223
widgetClass: props.attributes.widgetClass,
@@ -251,7 +251,7 @@
251
'div',
252
{
253
key: 'preview',
254
- className: 'so-widget-gutenberg-preview-container'
255
},
256
( loadingWidgetPreview ?
257
el( 'div', {
20
return el(
21
'span',
22
{
23
+ className: 'widget-icon so-widget-icon so-block-editor-icon'
24
}
25
)
26
},
53
54
if ( props.loadingWidgets ) {
55
$.get( {
56
+ url: sowbBlockEditorAdmin.restUrl + 'sowb/v1/widgets',
57
beforeSend: function ( xhr ) {
58
+ xhr.setRequestHeader( 'X-WP-Nonce', sowbBlockEditorAdmin.nonce );
59
}
60
} )
61
.then( function( widgets ) {
69
70
function onWidgetClassChange( newWidgetClass ) {
71
if ( newWidgetClass !== '' ) {
72
+ if ( props.widgetSettingsChanged && ! confirm( sowbBlockEditorAdmin.confirmChangeWidget ) ) {
73
return false;
74
}
75
props.setAttributes( { widgetClass: newWidgetClass, widgetData: null } );
147
var loadingWidgetForm = props.attributes.widgetClass && !props.widgetFormHtml;
148
if ( loadingWidgetForm ) {
149
$.get( {
150
+ url: sowbBlockEditorAdmin.restUrl + 'sowb/v1/widgets/forms',
151
beforeSend: function ( xhr ) {
152
+ xhr.setRequestHeader( 'X-WP-Nonce', sowbBlockEditorAdmin.nonce );
153
},
154
data: {
155
widgetClass: props.attributes.widgetClass
192
el( Spinner ) :
193
el(
194
'div',
195
+ { className: 'so-widget-block-container' },
196
el(
197
SelectControl,
198
{
202
}
203
),
204
el( 'div', {
205
+ className: 'so-widget-block-form-container',
206
dangerouslySetInnerHTML: { __html: widgetForm },
207
ref: setupWidgetForm,
208
} )
215
var loadingWidgetPreview = !props.editing && !props.widgetPreviewHtml;
216
if ( loadingWidgetPreview ) {
217
$.get( {
218
+ url: sowbBlockEditorAdmin.restUrl + 'sowb/v1/widgets/previews',
219
beforeSend: function ( xhr ) {
220
+ xhr.setRequestHeader( 'X-WP-Nonce', sowbBlockEditorAdmin.nonce );
221
},
222
data: {
223
widgetClass: props.attributes.widgetClass,
251
'div',
252
{
253
key: 'preview',
254
+ className: 'so-widget-preview-container'
255
},
256
( loadingWidgetPreview ?
257
el( 'div', {
compat/block-editor/widget-block.min.js ADDED
@@ -0,0 +1 @@
1
+ !function(e,t,i,n,o,s){var d=n.createElement,a=t.registerBlockType,r=e.BlockControls,l=o.SelectControl,w=s.withState,g=o.Toolbar,c=o.IconButton,m=o.Placeholder,u=o.Spinner,b=i.__;a("sowb/widget-block",{title:b("SiteOrigin Widget"),description:b("Select a SiteOrigin widget from the dropdown."),icon:function(){return d("span",{className:"widget-icon so-widget-icon so-block-editor-icon"})},category:"widgets",supports:{html:!1},attributes:{widgetClass:{type:"string"},widgetData:{type:"object"}},edit:w({loadingWidgets:!0,editing:!1,formInitialized:!1,previewInitialized:!1,widgets:null,widgetFormHtml:"",widgetSettingsChanged:!1,widgetPreviewHtml:""})(function(e){function t(t){if(""!==t){if(e.widgetSettingsChanged&&!confirm(sowbBlockEditorAdmin.confirmChangeWidget))return!1;e.setAttributes({widgetClass:t,widgetData:null}),e.setState({widgetFormHtml:null,formInitialized:!1,widgetSettingsChanged:!1,widgetPreviewHtml:null,previewInitialized:!1})}}function i(){e.setState({editing:!0,formInitialized:!1})}function n(){e.setState({editing:!1,previewInitialized:!1})}function o(t){var i=$(t).find(".siteorigin-widget-form-main");if(i.length>0&&!e.formInitialized){i.siblings(".siteorigin-widget-preview").find("> a").on("click",function(e){e.stopImmediatePropagation(),n()}),i.data("backupDisabled",!0),i.sowSetupForm(),e.attributes.widgetData?sowbForms.setWidgetFormValues(i,e.attributes.widgetData):e.setAttributes({widgetData:sowbForms.getWidgetFormValues(i)}),i.on("change",function(){e.setAttributes({widgetData:sowbForms.getWidgetFormValues(i)}),e.setState({widgetSettingsChanged:!0,widgetPreviewHtml:null,previewInitialized:!1})}),e.setState({formInitialized:!0})}}function s(){e.previewInitialized||($(window.sowb).trigger("setup_widgets"),e.setState({previewInitialized:!0}))}if(e.loadingWidgets&&$.get({url:sowbBlockEditorAdmin.restUrl+"sowb/v1/widgets",beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",sowbBlockEditorAdmin.nonce)}}).then(function(t){var i={widgets:t,loadingWidgets:!1};e.attributes.widgetClass||(i.editing=!0),e.setState(i)}),e.editing){var a=[];e.widgets&&(e.widgets.sort(function(e,t){return e.name<t.name?-1:e.name>t.name?1:0}),a=e.widgets.map(function(e){return{value:e.class,label:e.name}}),a.unshift({value:"",label:b("Select widget type")}));var w=e.attributes.widgetClass&&!e.widgetFormHtml;w&&$.get({url:sowbBlockEditorAdmin.restUrl+"sowb/v1/widgets/forms",beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",sowbBlockEditorAdmin.nonce)},data:{widgetClass:e.attributes.widgetClass}}).then(function(t){e.setState({widgetFormHtml:t})});var p=e.widgetFormHtml?e.widgetFormHtml:"";return[!!p&&d(r,{key:"controls"},d(g,null,d(c,{className:"components-icon-button components-toolbar__control",label:b("Preview widget."),onClick:n,icon:"visibility"}))),d(m,{key:"placeholder",className:"so-widget-placeholder",label:b("SiteOrigin Widget"),instructions:b("Select the type of widget you want to use:")},e.loadingWidgets||w?d(u):d("div",{className:"so-widget-block-container"},d(l,{options:a,value:e.attributes.widgetClass,onChange:t}),d("div",{className:"so-widget-block-form-container",dangerouslySetInnerHTML:{__html:p},ref:o})))]}var f=!e.editing&&!e.widgetPreviewHtml;f&&$.get({url:sowbBlockEditorAdmin.restUrl+"sowb/v1/widgets/previews",beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",sowbBlockEditorAdmin.nonce)},data:{widgetClass:e.attributes.widgetClass,widgetData:e.attributes.widgetData||{}}}).then(function(t){e.setState({widgetPreviewHtml:t})});var v=e.widgetPreviewHtml?e.widgetPreviewHtml:"";return[d(r,{key:"controls"},d(g,null,d(c,{className:"components-icon-button components-toolbar__control",label:b("Edit widget."),onClick:i,icon:"edit"}))),d("div",{key:"preview",className:"so-widget-preview-container"},f?d("div",{className:"so-widgets-spinner-container"},d("span",null,d(u))):d("div",{dangerouslySetInnerHTML:{__html:v},ref:s}))]}),save:function(){return null}})}(window.wp.editor,window.wp.blocks,window.wp.i18n,window.wp.element,window.wp.components,window.wp.compose);
compat/{gutenberg/gutenberg.php → block-editor/widget-block.php} RENAMED
@@ -1,10 +1,10 @@
1
<?php
2
3
- class SiteOrigin_Widgets_Bundle_Gutenberg_Block {
4
/**
5
* Get the singleton instance
6
*
7
- * @return SiteOrigin_Widgets_Bundle_Gutenberg_Block
8
*/
9
public static function single() {
10
static $single;
@@ -32,7 +32,7 @@ class SiteOrigin_Widgets_Bundle_Gutenberg_Block {
32
);
33
wp_localize_script(
34
'sowb-widget-block',
35
- 'sowbGutenbergAdmin',
36
array(
37
'restUrl' => esc_url_raw( rest_url() ),
38
'nonce' => wp_create_nonce( 'wp_rest' ),
@@ -81,4 +81,4 @@ class SiteOrigin_Widgets_Bundle_Gutenberg_Block {
81
}
82
}
83
84
- SiteOrigin_Widgets_Bundle_Gutenberg_Block::single();
1
<?php
2
3
+ class SiteOrigin_Widgets_Bundle_Widget_Block {
4
/**
5
* Get the singleton instance
6
*
7
+ * @return SiteOrigin_Widgets_Bundle_Widget_Block
8
*/
9
public static function single() {
10
static $single;
32
);
33
wp_localize_script(
34
'sowb-widget-block',
35
+ 'sowbBlockEditorAdmin',
36
array(
37
'restUrl' => esc_url_raw( rest_url() ),
38
'nonce' => wp_create_nonce( 'wp_rest' ),
81
}
82
}
83
84
+ SiteOrigin_Widgets_Bundle_Widget_Block::single();
compat/compat.php CHANGED
@@ -23,7 +23,7 @@ class SiteOrigin_Widgets_Bundle_Compatibility {
23
}
24
25
if ( function_exists( 'register_block_type' ) ) {
26
- require_once plugin_dir_path( __FILE__ ) . 'gutenberg/gutenberg.php';
27
}
28
}
29
23
}
24
25
if ( function_exists( 'register_block_type' ) ) {
26
+ require_once plugin_dir_path( __FILE__ ) . 'block-editor/widget-block.php';
27
}
28
}
29
compat/gutenberg/widget-block.min.js DELETED
@@ -1 +0,0 @@
1
- !function(e,t,i,n,o,s){var r=n.createElement,a=t.registerBlockType,d=e.BlockControls,g=o.SelectControl,l=s.withState,w=o.Toolbar,u=o.IconButton,c=o.Placeholder,m=o.Spinner,b=i.__;a("sowb/widget-block",{title:b("SiteOrigin Widget"),description:b("Select a SiteOrigin widget from the dropdown."),icon:function(){return r("span",{className:"widget-icon so-widget-icon so-gutenberg-icon"})},category:"widgets",supports:{html:!1},attributes:{widgetClass:{type:"string"},widgetData:{type:"object"}},edit:l({loadingWidgets:!0,editing:!1,formInitialized:!1,previewInitialized:!1,widgets:null,widgetFormHtml:"",widgetSettingsChanged:!1,widgetPreviewHtml:""})(function(e){function t(t){if(""!==t){if(e.widgetSettingsChanged&&!confirm(sowbGutenbergAdmin.confirmChangeWidget))return!1;e.setAttributes({widgetClass:t,widgetData:null}),e.setState({widgetFormHtml:null,formInitialized:!1,widgetSettingsChanged:!1,widgetPreviewHtml:null,previewInitialized:!1})}}function i(){e.setState({editing:!0,formInitialized:!1})}function n(){e.setState({editing:!1,previewInitialized:!1})}function o(t){var i=$(t).find(".siteorigin-widget-form-main");if(i.length>0&&!e.formInitialized){i.siblings(".siteorigin-widget-preview").find("> a").on("click",function(e){e.stopImmediatePropagation(),n()}),i.data("backupDisabled",!0),i.sowSetupForm(),e.attributes.widgetData?sowbForms.setWidgetFormValues(i,e.attributes.widgetData):e.setAttributes({widgetData:sowbForms.getWidgetFormValues(i)}),i.on("change",function(){e.setAttributes({widgetData:sowbForms.getWidgetFormValues(i)}),e.setState({widgetSettingsChanged:!0,widgetPreviewHtml:null,previewInitialized:!1})}),e.setState({formInitialized:!0})}}function s(){e.previewInitialized||($(window.sowb).trigger("setup_widgets"),e.setState({previewInitialized:!0}))}if(e.loadingWidgets&&$.get({url:sowbGutenbergAdmin.restUrl+"sowb/v1/widgets",beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",sowbGutenbergAdmin.nonce)}}).then(function(t){var i={widgets:t,loadingWidgets:!1};e.attributes.widgetClass||(i.editing=!0),e.setState(i)}),e.editing){var a=[];e.widgets&&(e.widgets.sort(function(e,t){return e.name<t.name?-1:e.name>t.name?1:0}),a=e.widgets.map(function(e){return{value:e.class,label:e.name}}),a.unshift({value:"",label:b("Select widget type")}));var l=e.attributes.widgetClass&&!e.widgetFormHtml;l&&$.get({url:sowbGutenbergAdmin.restUrl+"sowb/v1/widgets/forms",beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",sowbGutenbergAdmin.nonce)},data:{widgetClass:e.attributes.widgetClass}}).then(function(t){e.setState({widgetFormHtml:t})});var p=e.widgetFormHtml?e.widgetFormHtml:"";return[!!p&&r(d,{key:"controls"},r(w,null,r(u,{className:"components-icon-button components-toolbar__control",label:b("Preview widget."),onClick:n,icon:"visibility"}))),r(c,{key:"placeholder",className:"so-widget-placeholder",label:b("SiteOrigin Widget"),instructions:b("Select the type of widget you want to use:")},e.loadingWidgets||l?r(m):r("div",{className:"so-widget-gutenberg-container"},r(g,{options:a,value:e.attributes.widgetClass,onChange:t}),r("div",{className:"so-widget-gutenberg-form-container",dangerouslySetInnerHTML:{__html:p},ref:o})))]}var f=!e.editing&&!e.widgetPreviewHtml;f&&$.get({url:sowbGutenbergAdmin.restUrl+"sowb/v1/widgets/previews",beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",sowbGutenbergAdmin.nonce)},data:{widgetClass:e.attributes.widgetClass,widgetData:e.attributes.widgetData||{}}}).then(function(t){e.setState({widgetPreviewHtml:t})});var v=e.widgetPreviewHtml?e.widgetPreviewHtml:"";return[r(d,{key:"controls"},r(w,null,r(u,{className:"components-icon-button components-toolbar__control",label:b("Edit widget."),onClick:i,icon:"edit"}))),r("div",{key:"preview",className:"so-widget-gutenberg-preview-container"},f?r("div",{className:"so-widgets-spinner-container"},r("span",null,r(m))):r("div",{dangerouslySetInnerHTML:{__html:v},ref:s}))]}),save:function(){return null}})}(window.wp.editor,window.wp.blocks,window.wp.i18n,window.wp.element,window.wp.components,window.wp.compose);
js/sow.google-map.js CHANGED
@@ -172,6 +172,66 @@ sowb.SiteOriginGoogleMap = function($) {
172
}
173
markerBatches[ batchIndex ][ i % BATCH_SIZE ] = markerPositions[ i ];
174
}
175
var overQuota = false;
176
var geocodeMarkerBatch = function ( markerBatchHead, markerBatchTail ) {
177
var doneCount = 0;
@@ -180,63 +240,14 @@ sowb.SiteOriginGoogleMap = function($) {
180
if ( overQuota ) {
181
break;
182
}
183
- var mrkr = markerBatchHead[ i ];
184
- this.getLocation( mrkr.place ).done( function ( location ) {
185
- var mrkerIcon = options.markerIcon;
186
- if ( mrkr.custom_marker_icon ) {
187
- mrkerIcon = mrkr.custom_marker_icon;
188
- }
189
-
190
- var marker = new google.maps.Marker( {
191
- position: location,
192
- map: map,
193
- draggable: options.markersDraggable,
194
- icon: mrkerIcon,
195
- title: ''
196
- } );
197
-
198
- if ( mrkr.hasOwnProperty( 'info' ) && mrkr.info ) {
199
- var infoWindowOptions = { content: mrkr.info };
200
-
201
- if ( mrkr.hasOwnProperty( 'info_max_width' ) && mrkr.info_max_width ) {
202
- infoWindowOptions.maxWidth = mrkr.info_max_width;
203
- }
204
-
205
- var infoDisplay = options.markerInfoDisplay;
206
- infoWindowOptions.disableAutoPan = infoDisplay === 'always';
207
- var infoWindow = new google.maps.InfoWindow( infoWindowOptions );
208
- this.infoWindows.push( infoWindow );
209
- var openEvent = infoDisplay;
210
- if ( infoDisplay === 'always' ) {
211
- openEvent = 'click';
212
- infoWindow.open( map, marker );
213
}
214
- marker.addListener( openEvent, function () {
215
- infoWindow.open( map, marker );
216
- if ( infoDisplay !== 'always' && !options.markerInfoMultiple ) {
217
- this.infoWindows.forEach( function ( iw ) {
218
- if ( iw !== infoWindow ) {
219
- iw.close();
220
- }
221
- } );
222
- }
223
- }.bind( this ) );
224
- if ( infoDisplay === 'mouseover' ) {
225
- marker.addListener( 'mouseout', function () {
226
- setTimeout( function () {
227
- infoWindow.close();
228
- }, 100 );
229
- } );
230
- }
231
- }
232
- if ( ++doneCount === markerBatchHead.length && markerBatchTail.length ) {
233
- geocodeMarkerBatch( markerBatchTail.shift(), markerBatchTail );
234
}
235
- }.bind( this ) )
236
- .fail( function ( errorStatus ) {
237
- overQuota = errorStatus === google.maps.GeocoderStatus.OVER_QUERY_LIMIT;
238
- console.log( errorStatus );
239
- } );
240
}
241
}.bind( this );
242
geocodeMarkerBatch( markerBatches.shift(), markerBatches );
172
}
173
markerBatches[ batchIndex ][ i % BATCH_SIZE ] = markerPositions[ i ];
174
}
175
+ var geocodeMarker = function ( mrkr ) {
176
+
177
+ var customIcon = mrkr.custom_marker_icon;
178
+ var markerInfo = mrkr.hasOwnProperty( 'info' ) ? mrkr.info : null;
179
+ var infoMaxWidth = mrkr.hasOwnProperty( 'info_max_width' ) ? mrkr.info_max_width : null;
180
+ return this.getLocation( mrkr.place ).done( function ( location ) {
181
+ var mrkerIcon = options.markerIcon;
182
+ if ( customIcon ) {
183
+ mrkerIcon = customIcon;
184
+ }
185
+
186
+ var marker = new google.maps.Marker( {
187
+ position: location,
188
+ map: map,
189
+ draggable: options.markersDraggable,
190
+ icon: mrkerIcon,
191
+ title: ''
192
+ } );
193
+
194
+ if ( markerInfo ) {
195
+ var infoWindowOptions = { content: markerInfo };
196
+
197
+ if ( infoMaxWidth ) {
198
+ infoWindowOptions.maxWidth = infoMaxWidth;
199
+ }
200
+
201
+ var infoDisplay = options.markerInfoDisplay;
202
+ infoWindowOptions.disableAutoPan = infoDisplay === 'always';
203
+ var infoWindow = new google.maps.InfoWindow( infoWindowOptions );
204
+ this.infoWindows.push( infoWindow );
205
+ var openEvent = infoDisplay;
206
+ if ( infoDisplay === 'always' ) {
207
+ openEvent = 'click';
208
+ infoWindow.open( map, marker );
209
+ }
210
+ marker.addListener( openEvent, function () {
211
+ infoWindow.open( map, marker );
212
+ if ( infoDisplay !== 'always' && !options.markerInfoMultiple ) {
213
+ this.infoWindows.forEach( function ( iw ) {
214
+ if ( iw !== infoWindow ) {
215
+ iw.close();
216
+ }
217
+ } );
218
+ }
219
+ }.bind( this ) );
220
+ if ( infoDisplay === 'mouseover' ) {
221
+ marker.addListener( 'mouseout', function () {
222
+ setTimeout( function () {
223
+ infoWindow.close();
224
+ }, 100 );
225
+ } );
226
+ }
227
+ }
228
+ }.bind( this ) )
229
+ .fail( function ( errorStatus ) {
230
+ overQuota = errorStatus === google.maps.GeocoderStatus.OVER_QUERY_LIMIT;
231
+ console.log( errorStatus );
232
+ } );
233
+ }.bind( this );
234
+
235
var overQuota = false;
236
var geocodeMarkerBatch = function ( markerBatchHead, markerBatchTail ) {
237
var doneCount = 0;
240
if ( overQuota ) {
241
break;
242
}
243
+ geocodeMarker( markerBatchHead[ i ] ).then(
244
+ function () {
245
+ if ( ++doneCount === markerBatchHead.length && markerBatchTail.length ) {
246
+ geocodeMarkerBatch( markerBatchTail.shift(), markerBatchTail );
247
}
248
}
249
+ );
250
+
251
}
252
}.bind( this );
253
geocodeMarkerBatch( markerBatches.shift(), markerBatches );
js/sow.google-map.min.js CHANGED
@@ -1 +1 @@
1
- function soGoogleMapInitialize(){new sowb.SiteOriginGoogleMap(jQuery).initMaps()}var sowb=window.sowb||{};sowb.SiteOriginGoogleMap=function(e){return{DEFAULT_LOCATIONS:["Addo Elephant National Park, R335, Addo","Cape Town, Western Cape, South Africa","San Francisco Bay Area, CA, United States","New York, NY, United States"],showMap:function(e,o,t){var i=Number(t.zoom);i||(i=14);var a={zoom:i,scrollwheel:t.scrollZoom,draggable:t.draggable,disableDefaultUI:t.disableUi,zoomControl:t.zoomControl,panControl:t.panControl,center:o,mapTypeControlOptions:{mapTypeIds:[google.maps.MapTypeId.ROADMAP,google.maps.MapTypeId.SATELLITE,"user_map_style"]}},n=new google.maps.Map(e,a),s={name:t.mapName},r=t.mapStyles;if(r){var l=new google.maps.StyledMapType(r,s);n.mapTypes.set("user_map_style",l),n.setMapTypeId("user_map_style")}if(t.markerAtCenter&&(this.centerMarker=new google.maps.Marker({position:o,map:n,draggable:t.markersDraggable,icon:t.markerIcon,title:""})),t.keepCentered){var d;google.maps.event.addDomListener(n,"idle",function(){d=n.getCenter()}),google.maps.event.addDomListener(window,"resize",function(){n.setCenter(d)})}this.linkAutocompleteField(t.autocomplete,t.autocompleteElement,n,t),this.showMarkers(t.markerPositions,n,t),this.showDirections(t.directions,n,t)},linkAutocompleteField:function(o,t,i,a){if(o&&t){var n=function(e){this.inputAddress!==e&&(this.inputAddress=e,this.getLocation(this.inputAddress).done(function(e){i.setZoom(15),i.setCenter(e),this.centerMarker&&(this.centerMarker.setPosition(e),this.centerMarker.setTitle(this.inputAddress))}.bind(this)))}.bind(this),s=e(t);o.addListener("place_changed",function(){var e=o.getPlace();i.setZoom(15),e.geometry&&(i.setCenter(e.geometry.location),this.centerMarker&&this.centerMarker.setPosition(e.geometry.location))}.bind(this)),google.maps.event.addDomListener(t,"keypress",function(e){"13"===(e.keyCode||e.which)&&e.preventDefault()}),s.focusin(function(){if(!this.resultsObserver){var o=document.querySelector(".pac-container");this.resultsObserver=new MutationObserver(function(){var o=e(e(".pac-item").get(0)),t=o.find(".pac-item-query").text(),i=o.find("span").not("[class]").text(),a=t+(i?", "+i:"");a&&n(a)});var t={attributes:!0,childList:!0,characterData:!0};this.resultsObserver.observe(o,t)}}.bind(this));var r=function(e){this.getGeocoder().geocode({location:e},function(o,t){if(t===google.maps.GeocoderStatus.OK&&o.length>0){var i=o[0].formatted_address;s.val(i),this.centerMarker&&(this.centerMarker.setPosition(e),this.centerMarker.setTitle(i))}}.bind(this))}.bind(this);i.addListener("click",function(e){r(e.latLng)}),this.centerMarker.addListener("dragend",function(e){r(e.latLng)})}},showMarkers:function(e,o,t){if(e&&e.length){this.infoWindows=[];for(var i=[],a=0;a<e.length;a++){var n=parseInt(a/10);i.length===n&&(i[n]=[]),i[n][a%10]=e[a]}var s=!1,r=function(e,i){for(var a=0,n=0;n<e.length&&!s;n++){var l=e[n];this.getLocation(l.place).done(function(n){var s=t.markerIcon;l.custom_marker_icon&&(s=l.custom_marker_icon);var d=new google.maps.Marker({position:n,map:o,draggable:t.markersDraggable,icon:s,title:""});if(l.hasOwnProperty("info")&&l.info){var c={content:l.info};l.hasOwnProperty("info_max_width")&&l.info_max_width&&(c.maxWidth=l.info_max_width);var p=t.markerInfoDisplay;c.disableAutoPan="always"===p;var g=new google.maps.InfoWindow(c);this.infoWindows.push(g);var u=p;"always"===p&&(u="click",g.open(o,d)),d.addListener(u,function(){g.open(o,d),"always"===p||t.markerInfoMultiple||this.infoWindows.forEach(function(e){e!==g&&e.close()})}.bind(this)),"mouseover"===p&&d.addListener("mouseout",function(){setTimeout(function(){g.close()},100)})}++a===e.length&&i.length&&r(i.shift(),i)}.bind(this)).fail(function(e){s=e===google.maps.GeocoderStatus.OVER_QUERY_LIMIT,console.log(e)})}}.bind(this);r(i.shift(),i)}},showDirections:function(e,o){if(e){e.waypoints&&e.waypoints.length&&e.waypoints.map(function(e){e.stopover=Boolean(e.stopover)});var t=new google.maps.DirectionsRenderer;t.setMap(o);(new google.maps.DirectionsService).route({origin:e.origin,destination:e.destination,travelMode:e.travelMode.toUpperCase(),avoidHighways:e.avoidHighways,avoidTolls:e.avoidTolls,waypoints:e.waypoints,optimizeWaypoints:e.optimizeWaypoints},function(o,i){i===google.maps.DirectionsStatus.OK&&(t.setOptions({preserveViewport:e.preserveViewport}),t.setDirections(o))})}},initMaps:function(){var o=e(".sow-google-map-autocomplete"),t=new e.Deferred;0===o.length?t.resolve():o.each(function(o,i){if(void 0===google.maps.places)return void t.reject('Sorry, we couldn\'t load the "places" library due to another plugin, so the autocomplete feature is not available.');var a=new google.maps.places.Autocomplete(i,{types:["address"]}),n=e(i).siblings(".sow-google-map-canvas");if(n.length>0){var s=n.data("options");s.autocomplete=a,s.autocompleteElement=i,this.getLocation(s.address).done(function(e){this.showMap(n.get(0),e,s),n.data("initialized",!0),t.resolve()}.bind(this)).fail(function(){n.append("<div><p><strong>"+soWidgetsGoogleMap.geocode.noResults+"</strong></p></div>"),t.reject()})}}.bind(this)),t.always(function(){e(".sow-google-map-canvas").each(function(o,t){var i=e(t);if(i.data("initialized"))return!0;var a=i.data("options"),n=a.address;if(!n){var s=a.markerPositions;s&&s.length&&(n=s[0].place)}this.getLocation(n).done(function(e){this.showMap(i.get(0),e,a),i.data("initialized",!0)}.bind(this)).fail(function(){i.append("<div><p><strong>"+soWidgetsGoogleMap.geocode.noResults+"</strong></p></div>")})}.bind(this))}.bind(this)).fail(function(e){console.log(e)})},getGeocoder:function(){return this._geocoder||(this._geocoder=new google.maps.Geocoder),this._geocoder},getLocation:function(o){var t,i=new e.Deferred,a={address:o};if(o&&o.indexOf(",")>-1){var n=o.split(",");n&&2===n.length&&(t=new google.maps.LatLng(n[0],n[1]),isNaN(t.lat())||isNaN(t.lng())||(a={location:{lat:t.lat(),lng:t.lng()}}))}if(a.hasOwnProperty("location"))i.resolve(a.location);else if(a.hasOwnProperty("address")){if(!a.address){var s=parseInt(Math.random()*this.DEFAULT_LOCATIONS.length);a.address=this.DEFAULT_LOCATIONS[s]}var r=0,l=function(e,o){o===google.maps.GeocoderStatus.OK?i.resolve(e[0].geometry.location):o===google.maps.GeocoderStatus.OVER_QUERY_LIMIT?++r<3?setTimeout(function(){this.getGeocoder().geocode.call(this,a,l)}.bind(this),1e3):i.reject(o):o!==google.maps.GeocoderStatus.ZERO_RESULTS&&o!==google.maps.GeocoderStatus.OVER_DAILY_LIMIT||i.reject(o)}.bind(this);this.getGeocoder().geocode(a,l)}return i}}},jQuery(function(e){sowb.setupGoogleMaps=function(){var o,t=[],i=e(".sow-google-map-canvas");if(i.length){i.each(function(i,a){var n=e(a);if(!n.is(":visible")||n.data("apiInitialized"))return n;var s=n.data("options");s&&(void 0!==s.libraries&&null!==s.libraries&&(t=t.concat(s.libraries)),!o&&s.apiKey&&(o=s.apiKey)),n.data("apiInitialized",!0)});var a=void 0!==window.google&&void 0!==window.google.maps;if(sowb.mapsApiInitialized)var n=setTimeout(function(){a&&(clearTimeout(n),soGoogleMapInitialize())},100);else{var s="https://maps.googleapis.com/maps/api/js?callback=soGoogleMapInitialize";if(t&&t.length&&(s+="&libraries="+t.join(",")),o&&(s+="&key="+o),window.console&&window.console.error){var r=window.console.error;sowb.onLoadMapsApiError=function(o){var t=o.match(/^Google Maps API (error|warning): ([^\s]*)\s([^\s]*)(?:\s(.*))?/);t&&t.length&&t[0]&&e(".sow-google-map-canvas").each(function(o,t){var i=e(t);if(i.data("fallbackImage")){var a=i.data("fallbackImage");a.hasOwnProperty("img")&&i.append(a.img)}}),r.apply(window.console,arguments)},window.console.error=sowb.onLoadMapsApiError}e("body").append('<script async type="text/javascript" src="'+s+'">'),sowb.mapsApiInitialized=!0}}},sowb.setupGoogleMaps(),e(sowb).on("setup_widgets",sowb.setupGoogleMaps)}),window.sowb=sowb;
1
+ function soGoogleMapInitialize(){new sowb.SiteOriginGoogleMap(jQuery).initMaps()}var sowb=window.sowb||{};sowb.SiteOriginGoogleMap=function(e){return{DEFAULT_LOCATIONS:["Addo Elephant National Park, R335, Addo","Cape Town, Western Cape, South Africa","San Francisco Bay Area, CA, United States","New York, NY, United States"],showMap:function(e,o,t){var i=Number(t.zoom);i||(i=14);var a={zoom:i,scrollwheel:t.scrollZoom,draggable:t.draggable,disableDefaultUI:t.disableUi,zoomControl:t.zoomControl,panControl:t.panControl,center:o,mapTypeControlOptions:{mapTypeIds:[google.maps.MapTypeId.ROADMAP,google.maps.MapTypeId.SATELLITE,"user_map_style"]}},n=new google.maps.Map(e,a),s={name:t.mapName},r=t.mapStyles;if(r){var l=new google.maps.StyledMapType(r,s);n.mapTypes.set("user_map_style",l),n.setMapTypeId("user_map_style")}if(t.markerAtCenter&&(this.centerMarker=new google.maps.Marker({position:o,map:n,draggable:t.markersDraggable,icon:t.markerIcon,title:""})),t.keepCentered){var d;google.maps.event.addDomListener(n,"idle",function(){d=n.getCenter()}),google.maps.event.addDomListener(window,"resize",function(){n.setCenter(d)})}this.linkAutocompleteField(t.autocomplete,t.autocompleteElement,n,t),this.showMarkers(t.markerPositions,n,t),this.showDirections(t.directions,n,t)},linkAutocompleteField:function(o,t,i,a){if(o&&t){var n=function(e){this.inputAddress!==e&&(this.inputAddress=e,this.getLocation(this.inputAddress).done(function(e){i.setZoom(15),i.setCenter(e),this.centerMarker&&(this.centerMarker.setPosition(e),this.centerMarker.setTitle(this.inputAddress))}.bind(this)))}.bind(this),s=e(t);o.addListener("place_changed",function(){var e=o.getPlace();i.setZoom(15),e.geometry&&(i.setCenter(e.geometry.location),this.centerMarker&&this.centerMarker.setPosition(e.geometry.location))}.bind(this)),google.maps.event.addDomListener(t,"keypress",function(e){"13"===(e.keyCode||e.which)&&e.preventDefault()}),s.focusin(function(){if(!this.resultsObserver){var o=document.querySelector(".pac-container");this.resultsObserver=new MutationObserver(function(){var o=e(e(".pac-item").get(0)),t=o.find(".pac-item-query").text(),i=o.find("span").not("[class]").text(),a=t+(i?", "+i:"");a&&n(a)});var t={attributes:!0,childList:!0,characterData:!0};this.resultsObserver.observe(o,t)}}.bind(this));var r=function(e){this.getGeocoder().geocode({location:e},function(o,t){if(t===google.maps.GeocoderStatus.OK&&o.length>0){var i=o[0].formatted_address;s.val(i),this.centerMarker&&(this.centerMarker.setPosition(e),this.centerMarker.setTitle(i))}}.bind(this))}.bind(this);i.addListener("click",function(e){r(e.latLng)}),this.centerMarker.addListener("dragend",function(e){r(e.latLng)})}},showMarkers:function(e,o,t){if(e&&e.length){this.infoWindows=[];for(var i=[],a=0;a<e.length;a++){var n=parseInt(a/10);i.length===n&&(i[n]=[]),i[n][a%10]=e[a]}var s=function(e){var i=e.custom_marker_icon,a=e.hasOwnProperty("info")?e.info:null,n=e.hasOwnProperty("info_max_width")?e.info_max_width:null;return this.getLocation(e.place).done(function(e){var s=t.markerIcon;i&&(s=i);var r=new google.maps.Marker({position:e,map:o,draggable:t.markersDraggable,icon:s,title:""});if(a){var l={content:a};n&&(l.maxWidth=n);var d=t.markerInfoDisplay;l.disableAutoPan="always"===d;var c=new google.maps.InfoWindow(l);this.infoWindows.push(c);var p=d;"always"===d&&(p="click",c.open(o,r)),r.addListener(p,function(){c.open(o,r),"always"===d||t.markerInfoMultiple||this.infoWindows.forEach(function(e){e!==c&&e.close()})}.bind(this)),"mouseover"===d&&r.addListener("mouseout",function(){setTimeout(function(){c.close()},100)})}}.bind(this)).fail(function(e){r=e===google.maps.GeocoderStatus.OVER_QUERY_LIMIT,console.log(e)})}.bind(this),r=!1,l=function(e,o){for(var t=0,i=0;i<e.length&&!r;i++)s(e[i]).then(function(){++t===e.length&&o.length&&l(o.shift(),o)})}.bind(this);l(i.shift(),i)}},showDirections:function(e,o){if(e){e.waypoints&&e.waypoints.length&&e.waypoints.map(function(e){e.stopover=Boolean(e.stopover)});var t=new google.maps.DirectionsRenderer;t.setMap(o);(new google.maps.DirectionsService).route({origin:e.origin,destination:e.destination,travelMode:e.travelMode.toUpperCase(),avoidHighways:e.avoidHighways,avoidTolls:e.avoidTolls,waypoints:e.waypoints,optimizeWaypoints:e.optimizeWaypoints},function(o,i){i===google.maps.DirectionsStatus.OK&&(t.setOptions({preserveViewport:e.preserveViewport}),t.setDirections(o))})}},initMaps:function(){var o=e(".sow-google-map-autocomplete"),t=new e.Deferred;0===o.length?t.resolve():o.each(function(o,i){if(void 0===google.maps.places)return void t.reject('Sorry, we couldn\'t load the "places" library due to another plugin, so the autocomplete feature is not available.');var a=new google.maps.places.Autocomplete(i,{types:["address"]}),n=e(i).siblings(".sow-google-map-canvas");if(n.length>0){var s=n.data("options");s.autocomplete=a,s.autocompleteElement=i,this.getLocation(s.address).done(function(e){this.showMap(n.get(0),e,s),n.data("initialized",!0),t.resolve()}.bind(this)).fail(function(){n.append("<div><p><strong>"+soWidgetsGoogleMap.geocode.noResults+"</strong></p></div>"),t.reject()})}}.bind(this)),t.always(function(){e(".sow-google-map-canvas").each(function(o,t){var i=e(t);if(i.data("initialized"))return!0;var a=i.data("options"),n=a.address;if(!n){var s=a.markerPositions;s&&s.length&&(n=s[0].place)}this.getLocation(n).done(function(e){this.showMap(i.get(0),e,a),i.data("initialized",!0)}.bind(this)).fail(function(){i.append("<div><p><strong>"+soWidgetsGoogleMap.geocode.noResults+"</strong></p></div>")})}.bind(this))}.bind(this)).fail(function(e){console.log(e)})},getGeocoder:function(){return this._geocoder||(this._geocoder=new google.maps.Geocoder),this._geocoder},getLocation:function(o){var t,i=new e.Deferred,a={address:o};if(o&&o.indexOf(",")>-1){var n=o.split(",");n&&2===n.length&&(t=new google.maps.LatLng(n[0],n[1]),isNaN(t.lat())||isNaN(t.lng())||(a={location:{lat:t.lat(),lng:t.lng()}}))}if(a.hasOwnProperty("location"))i.resolve(a.location);else if(a.hasOwnProperty("address")){if(!a.address){var s=parseInt(Math.random()*this.DEFAULT_LOCATIONS.length);a.address=this.DEFAULT_LOCATIONS[s]}var r=0,l=function(e,o){o===google.maps.GeocoderStatus.OK?i.resolve(e[0].geometry.location):o===google.maps.GeocoderStatus.OVER_QUERY_LIMIT?++r<3?setTimeout(function(){this.getGeocoder().geocode.call(this,a,l)}.bind(this),1e3):i.reject(o):o!==google.maps.GeocoderStatus.ZERO_RESULTS&&o!==google.maps.GeocoderStatus.OVER_DAILY_LIMIT||i.reject(o)}.bind(this);this.getGeocoder().geocode(a,l)}return i}}},jQuery(function(e){sowb.setupGoogleMaps=function(){var o,t=[],i=e(".sow-google-map-canvas");if(i.length){i.each(function(i,a){var n=e(a);if(!n.is(":visible")||n.data("apiInitialized"))return n;var s=n.data("options");s&&(void 0!==s.libraries&&null!==s.libraries&&(t=t.concat(s.libraries)),!o&&s.apiKey&&(o=s.apiKey)),n.data("apiInitialized",!0)});var a=void 0!==window.google&&void 0!==window.google.maps;if(sowb.mapsApiInitialized)var n=setTimeout(function(){a&&(clearTimeout(n),soGoogleMapInitialize())},100);else{var s="https://maps.googleapis.com/maps/api/js?callback=soGoogleMapInitialize";if(t&&t.length&&(s+="&libraries="+t.join(",")),o&&(s+="&key="+o),window.console&&window.console.error){var r=window.console.error;sowb.onLoadMapsApiError=function(o){var t=o.match(/^Google Maps API (error|warning): ([^\s]*)\s([^\s]*)(?:\s(.*))?/);t&&t.length&&t[0]&&e(".sow-google-map-canvas").each(function(o,t){var i=e(t);if(i.data("fallbackImage")){var a=i.data("fallbackImage");a.hasOwnProperty("img")&&i.append(a.img)}}),r.apply(window.console,arguments)},window.console.error=sowb.onLoadMapsApiError}e("body").append('<script async type="text/javascript" src="'+s+'">'),sowb.mapsApiInitialized=!0}}},sowb.setupGoogleMaps(),e(sowb).on("setup_widgets",sowb.setupGoogleMaps)}),window.sowb=sowb;
js/sow.jquery.fittext.js CHANGED
@@ -55,6 +55,7 @@ jQuery( function( $ ){
55
fitTextWrapper.find( 'h1,h2,h3,h4,h5,h6' ).each( function () {
56
var $ = $( this );
57
$.fitText( compressor, {
58
maxFontSize: $.css( 'font-size' )
59
} );
60
} );
55
fitTextWrapper.find( 'h1,h2,h3,h4,h5,h6' ).each( function () {
56
var $ = $( this );
57
$.fitText( compressor, {
58
+ minFontSize: '12px',
59
maxFontSize: $.css( 'font-size' )
60
} );
61
} );
js/sow.jquery.fittext.min.js CHANGED
@@ -1 +1 @@
1
- var sowb=window.sowb||{};!function(t){t.fn.fitText=function(i,e){var n=i||1,o=t.extend({minFontSize:Number.NEGATIVE_INFINITY,maxFontSize:Number.POSITIVE_INFINITY},e);return this.each(function(){var i=t(this),e=function(){i.css("font-size",Math.max(Math.min(i.width()/(10*n),parseFloat(o.maxFontSize)),parseFloat(o.minFontSize)))};e(),t(window).on("resize.fittext orientationchange.fittext",e)})}}(jQuery),jQuery(function(t){sowb.runFitText=function(){t(".so-widget-fittext-wrapper").each(function(){var i=t(this);if(!i.is(":visible")||i.data("fitTextDone"))return i;t(window).off("resize.fittext orientationchange.fittext");var e=i.data("fitTextCompressor")||.85;i.find("h1,h2,h3,h4,h5,h6").each(function(){var i=t(this);i.fitText(e,{maxFontSize:i.css("font-size")})}),i.data("fitTextDone",!0),i.trigger("fitTextDone")})},t(sowb).on("setup_widgets",sowb.runFitText),sowb.runFitText()}),window.sowb=sowb;
1
+ var sowb=window.sowb||{};!function(t){t.fn.fitText=function(i,e){var n=i||1,o=t.extend({minFontSize:Number.NEGATIVE_INFINITY,maxFontSize:Number.POSITIVE_INFINITY},e);return this.each(function(){var i=t(this),e=function(){i.css("font-size",Math.max(Math.min(i.width()/(10*n),parseFloat(o.maxFontSize)),parseFloat(o.minFontSize)))};e(),t(window).on("resize.fittext orientationchange.fittext",e)})}}(jQuery),jQuery(function(t){sowb.runFitText=function(){t(".so-widget-fittext-wrapper").each(function(){var i=t(this);if(!i.is(":visible")||i.data("fitTextDone"))return i;t(window).off("resize.fittext orientationchange.fittext");var e=i.data("fitTextCompressor")||.85;i.find("h1,h2,h3,h4,h5,h6").each(function(){var i=t(this);i.fitText(e,{minFontSize:"12px",maxFontSize:i.css("font-size")})}),i.data("fitTextDone",!0),i.trigger("fitTextDone")})},t(sowb).on("setup_widgets",sowb.runFitText),sowb.runFitText()}),window.sowb=sowb;
lang/so-widgets-bundle.pot CHANGED
@@ -572,28 +572,28 @@ msgstr ""
572
msgid "Current Color"
573
msgstr ""
574
575
- #: compat/builders.php:4
576
- msgid "Beaver Builder"
577
msgstr ""
578
579
- #: compat/builders.php:8
580
- msgid "Elementor"
581
msgstr ""
582
583
- #: compat/builders.php:12
584
- msgid "Visual Composer"
585
msgstr ""
586
587
- #: compat/gutenberg/gutenberg.php:39, compat/visual-composer/visual-composer.php:77
588
- msgid "Selecting a different widget will revert any changes. Continue?"
589
msgstr ""
590
591
- #: compat/gutenberg/gutenberg.php:52
592
- msgid "You need to select a widget type before you'll see anything here. :)"
593
msgstr ""
594
595
- #: compat/gutenberg/gutenberg.php:73
596
- msgid "Invalid widget class %s. Please make sure the widget has been activated in %sSiteOrigin Widgets%s."
597
msgstr ""
598
599
#: compat/visual-composer/visual-composer.php:38, compat/visual-composer/visual-composer.php:54
572
msgid "Current Color"
573
msgstr ""
574
575
+ #: compat/block-editor/widget-block.php:39, compat/visual-composer/visual-composer.php:77
576
+ msgid "Selecting a different widget will revert any changes. Continue?"
577
msgstr ""
578
579
+ #: compat/block-editor/widget-block.php:52
580
+ msgid "You need to select a widget type before you'll see anything here. :)"
581
msgstr ""
582
583
+ #: compat/block-editor/widget-block.php:73
584
+ msgid "Invalid widget class %s. Please make sure the widget has been activated in %sSiteOrigin Widgets%s."
585
msgstr ""
586
587
+ #: compat/builders.php:4
588
+ msgid "Beaver Builder"
589
msgstr ""
590
591
+ #: compat/builders.php:8
592
+ msgid "Elementor"
593
msgstr ""
594
595
+ #: compat/builders.php:12
596
+ msgid "Visual Composer"
597
msgstr ""
598
599
#: compat/visual-composer/visual-composer.php:38, compat/visual-composer/visual-composer.php:54
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
Tags: bundle, widget, button, slider, image, carousel, price table, google maps, tinymce, social links
3
Requires at least: 4.2
4
Tested up to: 4.9.1
5
- Stable tag: 1.13.2
6
- Build time: 2018-10-31T10:38:58-07:00
7
License: GPLv3 or later
8
Contributors: gpriday, braam-genis
9
Donate link: https://siteorigin.com/downloads/contribution/
@@ -65,6 +65,19 @@ The SiteOrigin Widgets Bundle is the perfect platform to build widgets for your
65
66
== Changelog ==
67
68
= 1.13.2 - 31 October 2018 =
69
* Builder field: Prevent error in PHP <= 5.4
70
* Avoid replacing repeater item id placeholders for child repeaters.
2
Tags: bundle, widget, button, slider, image, carousel, price table, google maps, tinymce, social links
3
Requires at least: 4.2
4
Tested up to: 4.9.1
5
+ Stable tag: 1.13.3
6
+ Build time: 2018-11-15T16:26:45-08:00
7
License: GPLv3 or later
8
Contributors: gpriday, braam-genis
9
Donate link: https://siteorigin.com/downloads/contribution/
65
66
== Changelog ==
67
68
+ = 1.13.3 - 15 November 2018 =
69
+ * Contact: Fix checkboxes and radio alignment on android.
70
+ * FitText: Set minimum font size to ensure readability.
71
+ * TinyMCE field: Use correct editor when block editor is present.
72
+ * Google maps: Use correct info window text for markers.
73
+ * TinyMCE: Remove 'editor-buttons' style enqueue causing conflicts.
74
+ * TinyMCE field: Prevent adding multiple copies of media buttons.
75
+ * Image widget: if no alt text is supplied add an empty alt attribute.
76
+ * Repeaters: Reverted some commits causing multiple issues.
77
+ * WP 5: Fixed some styles in the block editor.
78
+ * Only setup form fields in the dialog when a PB edit widget dialog is opened.
79
+ * Multi-measurement field: Fix autoFill in block editor and attempt to fix in PHP <= 5.3.
80
+
81
= 1.13.2 - 31 October 2018 =
82
* Builder field: Prevent error in PHP <= 5.4
83
* Avoid replacing repeater item id placeholders for child repeaters.
so-widgets-bundle.php CHANGED
@@ -2,7 +2,7 @@
2
/*
3
Plugin Name: SiteOrigin Widgets Bundle
4
Description: A collection of all widgets, neatly bundled into a single plugin. It's also a framework to code your own widgets on top of.
5
- Version: 1.13.2
6
Text Domain: so-widgets-bundle
7
Domain Path: /lang
8
Author: SiteOrigin
@@ -12,7 +12,7 @@ License: GPL3
12
License URI: https://www.gnu.org/licenses/gpl-3.0.txt
13
*/
14
15
- define('SOW_BUNDLE_VERSION', '1.13.2');
16
define('SOW_BUNDLE_BASE_FILE', __FILE__);
17
18
// Allow JS suffix to be pre-set
2
/*
3
Plugin Name: SiteOrigin Widgets Bundle
4
Description: A collection of all widgets, neatly bundled into a single plugin. It's also a framework to code your own widgets on top of.
5
+ Version: 1.13.3
6
Text Domain: so-widgets-bundle
7
Domain Path: /lang
8
Author: SiteOrigin
12
License URI: https://www.gnu.org/licenses/gpl-3.0.txt
13
*/
14
15
+ define('SOW_BUNDLE_VERSION', '1.13.3');
16
define('SOW_BUNDLE_BASE_FILE', __FILE__);
17
18
// Allow JS suffix to be pre-set
widgets/contact/styles/default.less CHANGED
@@ -110,11 +110,13 @@
110
111
label {
112
margin-bottom: 0;
113
}
114
115
input {
116
float: left;
117
- margin: 0.4em 0.5em 0 0;
118
height: auto;
119
}
120
}
110
111
label {
112
margin-bottom: 0;
113
+ display: flex;
114
+ align-items: center;
115
}
116
117
input {
118
float: left;
119
+ margin-right: 0.5em;
120
height: auto;
121
}
122
}
widgets/google-map/tpl/static-map.php CHANGED
@@ -1,22 +1,22 @@
1
- <?php
2
- /**
3
- * @var $destination_url
4
- * @var $new_window
5
- * @var $src_url
6
- * @var $fallback_image_data
7
- */
8
- ?>
9
-
10
- <?php if( !empty( $destination_url ) ): ?>
11
- <a href="<?php echo sow_esc_url( $destination_url ) ?>" <?php echo $new_window ? 'target="_blank" rel="noopener noreferrer"' : '' ?>>
12
- <?php endif; ?>
13
-
14
- <img
15
- class="sowb-google-map-static"
16
- border="0"
17
- src="<?php echo sow_esc_url( $src_url ) ?>"
18
- data-fallback-image="<?php echo esc_attr( json_encode( $fallback_image_data ) ); ?>"
19
- onerror="this.sowbLoadError = true;">
20
-
21
- <?php
22
- if( !empty( $destination_url ) ) echo '</a>';
1
+ <?php
2
+ /**
3
+ * @var $destination_url
4
+ * @var $new_window
5
+ * @var $src_url
6
+ * @var $fallback_image_data
7
+ */
8
+ ?>
9
+
10
+ <?php if( !empty( $destination_url ) ): ?>
11
+ <a href="<?php echo sow_esc_url( $destination_url ) ?>" <?php echo $new_window ? 'target="_blank" rel="noopener noreferrer"' : '' ?>>
12
+ <?php endif; ?>
13
+
14
+ <img
15
+ class="sowb-google-map-static"
16
+ border="0"
17
+ src="<?php echo sow_esc_url( $src_url ) ?>"
18
+ data-fallback-image="<?php echo esc_attr( json_encode( $fallback_image_data ) ); ?>"
19
+ onerror="this.sowbLoadError = true;">
20
+
21
+ <?php
22
+ if( !empty( $destination_url ) ) echo '</a>';
widgets/image/tpl/default.php CHANGED
@@ -1,29 +1,29 @@
1
- <?php
2
- /**
3
- * @var $title
4
- * @var $title_position
5
- * @var $url
6
- * @var $link_attributes
7
- * @var $new_window
8
- * @var $attributes
9
- * @var $classes
10
- */
11
- ?>
12
-
13
- <?php if( $title_position == 'above' ) : ?>
14
- <?php echo $args['before_title'] . wp_kses_post( $title ) . $args['after_title']; ?>
15
- <?php endif; ?>
16
-
17
- <?php
18
-
19
- ?>
20
- <div class="sow-image-container">
21
- <?php if ( ! empty( $url ) ) : ?><a href="<?php echo sow_esc_url( $url ) ?>" <?php foreach( $link_attributes as $att => $val ) if ( ! empty( $val ) ) : echo $att.'="' . esc_attr( $val ) . '" '; endif; ?>><?php endif; ?>
22
- <img <?php foreach( $attributes as $n => $v ) if ( ! empty( $v ) ) : echo $n.'="' . esc_attr( $v ) . '" '; endif; ?>
23
- class="<?php echo esc_attr( implode(' ', $classes ) ) ?>"/>
24
- <?php if ( ! empty( $url ) ) : ?></a><?php endif; ?>
25
- </div>
26
-
27
- <?php if( $title_position == 'below' ) : ?>
28
- <?php echo $args['before_title'] . wp_kses_post( $title ) . $args['after_title']; ?>
29
- <?php endif; ?>
1
+ <?php
2
+ /**
3
+ * @var $title
4
+ * @var $title_position
5
+ * @var $url
6
+ * @var $link_attributes
7
+ * @var $new_window
8
+ * @var $attributes
9
+ * @var $classes
10
+ */
11
+ ?>
12
+
13
+ <?php if( $title_position == 'above' ) : ?>
14
+ <?php echo $args['before_title'] . wp_kses_post( $title ) . $args['after_title']; ?>
15
+ <?php endif; ?>
16
+
17
+ <?php
18
+
19
+ ?>
20
+ <div class="sow-image-container">
21
+ <?php if ( ! empty( $url ) ) : ?><a href="<?php echo sow_esc_url( $url ) ?>" <?php foreach( $link_attributes as $att => $val ) if ( ! empty( $val ) ) : echo $att.'="' . esc_attr( $val ) . '" '; endif; ?>><?php endif; ?>
22
+ <img <?php foreach( $attributes as $n => $v ) if ( $n === 'alt' || ! empty( $v ) ) : echo $n.'="' . esc_attr( $v ) . '" '; endif; ?>
23
+ class="<?php echo esc_attr( implode(' ', $classes ) ) ?>"/>
24
+ <?php if ( ! empty( $url ) ) : ?></a><?php endif; ?>
25
+ </div>
26
+
27
+ <?php if( $title_position == 'below' ) : ?>
28
+ <?php echo $args['before_title'] . wp_kses_post( $title ) . $args['after_title']; ?>
29
+ <?php endif; ?>