Page Builder by SiteOrigin - Version 2.5.4

Version Description

  • 1 June 2017 =
  • Compatibility with WordPress 4.8 widgets.
  • Refactored core widgets.
  • Compatibility with Widgets Bundle 1.9 posts selector.
  • Ensure custom CSS added in element styles is properly formed.
Download this release

Release Info

Developer gpriday
Plugin Icon 128x128 Page Builder by SiteOrigin
Version 2.5.4
Comparing to
See all releases

Code changes from version 2.5.3 to 2.5.4

inc/admin.php CHANGED
@@ -49,12 +49,14 @@ class SiteOrigin_Panels_Admin {
49
  add_action( 'load-appearance_page_so_panels_home_page', array( $this, 'add_help_tab' ), 12 );
50
 
51
  add_action( 'customize_controls_print_footer_scripts', array( $this, 'js_templates' ) );
 
 
52
 
53
  // Register all the admin actions
54
  add_action( 'wp_ajax_so_panels_builder_content', array( $this, 'action_builder_content' ) );
55
  add_action( 'wp_ajax_so_panels_widget_form', array( $this, 'action_widget_form' ) );
56
  add_action( 'wp_ajax_so_panels_live_editor_preview', array( $this, 'action_live_editor_preview' ) );
57
-
58
  // Initialize the additional admin classes.
59
  SiteOrigin_Panels_Admin_Widget_Dialog::single();
60
  SiteOrigin_Panels_Admin_Widgets_Bundle::single();
@@ -86,7 +88,7 @@ class SiteOrigin_Panels_Admin {
86
  }
87
  }
88
  }
89
-
90
  if( self::is_admin() ) {
91
  // Setup everything for Page Builder learning as long as we're viewing a Page Builder page
92
  SiteOrigin_Learn_Dialog::single();
@@ -400,21 +402,36 @@ class SiteOrigin_Panels_Admin {
400
  'loadOnAttach' => siteorigin_panels_setting( 'load-on-attach' ),
401
  'siteoriginWidgetRegex' => str_replace( '*+', '*', get_shortcode_regex( array( 'siteorigin_widget' ) ) ),
402
  ) );
403
-
 
404
  if ( $screen->base != 'widgets' ) {
405
  // Render all the widget forms. A lot of widgets use this as a chance to enqueue their scripts
406
  $original_post = isset( $GLOBALS['post'] ) ? $GLOBALS['post'] : null; // Make sure widgets don't change the global post.
407
- foreach ( $GLOBALS['wp_widget_factory']->widgets as $class => $widget_obj ) {
 
408
  ob_start();
409
  $return = $widget_obj->form( array() );
 
 
 
 
 
410
  do_action_ref_array( 'in_widget_form', array( &$widget_obj, &$return, array() ) );
411
  ob_clean();
 
 
 
 
 
412
  }
413
  $GLOBALS['post'] = $original_post;
414
  }
415
 
416
  // This gives panels a chance to enqueue scripts too, without having to check the screen ID.
417
  if ( $screen->base != 'widgets' && $screen->base != 'customize' ) {
 
 
 
418
  do_action( 'siteorigin_panel_enqueue_admin_scripts' );
419
  do_action( 'sidebar_admin_setup' );
420
  }
@@ -671,7 +688,7 @@ class SiteOrigin_Panels_Admin {
671
 
672
  return $a['title'] > $b['title'] ? 1 : - 1;
673
  }
674
-
675
  /**
676
  * Process raw widgets that have come from the Page Builder front end.
677
  *
@@ -710,7 +727,7 @@ class SiteOrigin_Panels_Admin {
710
  $info = array();
711
  }
712
  unset( $widget['info'] );
713
-
714
  $info[ 'class' ] = apply_filters( 'siteorigin_panels_widget_class', $info[ 'class' ] );
715
 
716
  if ( ! empty( $info['raw'] ) || $force ) {
@@ -754,6 +771,23 @@ class SiteOrigin_Panels_Admin {
754
  include plugin_dir_path( __FILE__ ) . '../tpl/js-templates.php';
755
  }
756
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
757
  /**
758
  * Render a widget form with all the Page Builder specific fields
759
  *
@@ -831,8 +865,17 @@ class SiteOrigin_Panels_Admin {
831
  $the_widget->number = $widget_number;
832
 
833
  ob_start();
 
 
 
834
  $return = $the_widget->form( $instance );
835
  do_action_ref_array( 'in_widget_form', array( &$the_widget, &$return, $instance ) );
 
 
 
 
 
 
836
  $form = ob_get_clean();
837
 
838
  // Convert the widget field naming into ones that Page Builder uses
@@ -846,6 +889,21 @@ class SiteOrigin_Panels_Admin {
846
  return $form;
847
  }
848
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
849
  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
850
  // ADMIN AJAX ACTIONS
851
  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -921,7 +979,7 @@ class SiteOrigin_Panels_Admin {
921
 
922
  exit();
923
  }
924
-
925
  /**
926
  * Add a column that indicates if a column is powered by Page Builder
927
  *
@@ -986,7 +1044,7 @@ class SiteOrigin_Panels_Admin {
986
  }
987
 
988
  public function get_layout_directories(){
989
-
990
  }
991
 
992
  /**
@@ -1006,7 +1064,7 @@ class SiteOrigin_Panels_Admin {
1006
  __( "Watch the video to find out more, then sign up below to get started.", 'siteorigin-panels' ),
1007
  'form_description' => __( "We'll email you a confirmation. You can unsubscribe at any time.", 'siteorigin-panels' ),
1008
  );
1009
-
1010
  $lessons['page-builder-animations'] = array(
1011
  'title' => __( 'Free Page Builder Addons', 'siteorigin-panels' ),
1012
  'video' => '212380210',
@@ -1019,7 +1077,7 @@ class SiteOrigin_Panels_Admin {
1019
 
1020
  return $lessons;
1021
  }
1022
-
1023
  /**
1024
  * Filter the translation strings for SiteOrigin learning dialogs
1025
  *
@@ -1032,7 +1090,7 @@ class SiteOrigin_Panels_Admin {
1032
  'watch_video' => __( 'Watch Intro Video', 'siteorigin-panels' ),
1033
  'loaded_from_vimeo' => __( 'Loaded from Vimeo Servers', 'siteorigin-panels' ),
1034
  'valid_email' => __( 'Please enter a valid email address.', 'siteorigin-panels' ),
1035
-
1036
  'your_name' => __( 'Your Name', 'siteorigin-panels' ),
1037
  'your_email' => __( 'Your Email', 'siteorigin-panels' ),
1038
  'sign_up' => __( 'Sign Up', 'siteorigin-panels' ),
49
  add_action( 'load-appearance_page_so_panels_home_page', array( $this, 'add_help_tab' ), 12 );
50
 
51
  add_action( 'customize_controls_print_footer_scripts', array( $this, 'js_templates' ) );
52
+ add_action( 'admin_footer-post.php', array( $this, 'js_widget_templates' ) );
53
+ add_action( 'admin_footer-post-new.php', array( $this, 'js_widget_templates' ) );
54
 
55
  // Register all the admin actions
56
  add_action( 'wp_ajax_so_panels_builder_content', array( $this, 'action_builder_content' ) );
57
  add_action( 'wp_ajax_so_panels_widget_form', array( $this, 'action_widget_form' ) );
58
  add_action( 'wp_ajax_so_panels_live_editor_preview', array( $this, 'action_live_editor_preview' ) );
59
+
60
  // Initialize the additional admin classes.
61
  SiteOrigin_Panels_Admin_Widget_Dialog::single();
62
  SiteOrigin_Panels_Admin_Widgets_Bundle::single();
88
  }
89
  }
90
  }
91
+
92
  if( self::is_admin() ) {
93
  // Setup everything for Page Builder learning as long as we're viewing a Page Builder page
94
  SiteOrigin_Learn_Dialog::single();
402
  'loadOnAttach' => siteorigin_panels_setting( 'load-on-attach' ),
403
  'siteoriginWidgetRegex' => str_replace( '*+', '*', get_shortcode_regex( array( 'siteorigin_widget' ) ) ),
404
  ) );
405
+
406
+ $js_widgets = array();
407
  if ( $screen->base != 'widgets' ) {
408
  // Render all the widget forms. A lot of widgets use this as a chance to enqueue their scripts
409
  $original_post = isset( $GLOBALS['post'] ) ? $GLOBALS['post'] : null; // Make sure widgets don't change the global post.
410
+ global $wp_widget_factory;
411
+ foreach ( $wp_widget_factory->widgets as $class => $widget_obj ) {
412
  ob_start();
413
  $return = $widget_obj->form( array() );
414
+ // These are the new widgets in WP 4.8 which are largely JS based. They only enqueue their own
415
+ // scripts on the 'widgets' screen.
416
+ if ( method_exists( $widget_obj, 'enqueue_admin_scripts' ) ) {
417
+ $widget_obj->enqueue_admin_scripts();
418
+ }
419
  do_action_ref_array( 'in_widget_form', array( &$widget_obj, &$return, array() ) );
420
  ob_clean();
421
+
422
+ // Need to render templates for new WP 4.8 widgets when not on the 'widgets' screen or in the customizer.
423
+ if ( $this->is_js_widget( $widget_obj ) ) {
424
+ $js_widgets[] = $widget_obj;
425
+ }
426
  }
427
  $GLOBALS['post'] = $original_post;
428
  }
429
 
430
  // This gives panels a chance to enqueue scripts too, without having to check the screen ID.
431
  if ( $screen->base != 'widgets' && $screen->base != 'customize' ) {
432
+ foreach ( $js_widgets as $js_widget ) {
433
+ $js_widget->render_control_template_scripts();
434
+ }
435
  do_action( 'siteorigin_panel_enqueue_admin_scripts' );
436
  do_action( 'sidebar_admin_setup' );
437
  }
688
 
689
  return $a['title'] > $b['title'] ? 1 : - 1;
690
  }
691
+
692
  /**
693
  * Process raw widgets that have come from the Page Builder front end.
694
  *
727
  $info = array();
728
  }
729
  unset( $widget['info'] );
730
+
731
  $info[ 'class' ] = apply_filters( 'siteorigin_panels_widget_class', $info[ 'class' ] );
732
 
733
  if ( ! empty( $info['raw'] ) || $force ) {
771
  include plugin_dir_path( __FILE__ ) . '../tpl/js-templates.php';
772
  }
773
 
774
+
775
+ /**
776
+ * Need to render templates for new WP 4.8 widgets when not on the 'widgets' screen or in the customizer.
777
+ */
778
+ function js_widget_templates() {
779
+ $screen = get_current_screen();
780
+
781
+ if ( $screen->base != 'widgets' ) {
782
+ global $wp_widget_factory;
783
+ foreach ( $wp_widget_factory->widgets as $class => $widget_obj ) {
784
+ if ( method_exists( $widget_obj, 'render_control_template_scripts' ) ) {
785
+ $widget_obj->render_control_template_scripts();
786
+ }
787
+ }
788
+ }
789
+ }
790
+
791
  /**
792
  * Render a widget form with all the Page Builder specific fields
793
  *
865
  $the_widget->number = $widget_number;
866
 
867
  ob_start();
868
+ if ( $this->is_js_widget( $the_widget ) ) {
869
+ ?><div class="widget-content"><?php
870
+ }
871
  $return = $the_widget->form( $instance );
872
  do_action_ref_array( 'in_widget_form', array( &$the_widget, &$return, $instance ) );
873
+ if ( $this->is_js_widget( $the_widget ) ) {
874
+ ?>
875
+ </div>
876
+ <input type="hidden" name="id_base" class="id_base" value="<?php echo esc_attr( $the_widget->id_base ); ?>" />
877
+ <?php
878
+ }
879
  $form = ob_get_clean();
880
 
881
  // Convert the widget field naming into ones that Page Builder uses
889
  return $form;
890
  }
891
 
892
+ function is_js_widget( $widget ) {
893
+ $js_widgets = array(
894
+ 'WP_Widget_Media_Audio',
895
+ 'WP_Widget_Media_Image',
896
+ 'WP_Widget_Media_Video',
897
+ 'WP_Widget_Text',
898
+ );
899
+
900
+ $is_js_widget = in_array( get_class( $widget ), $js_widgets ) &&
901
+ // Need to check this for `WP_Widget_Text` which was not a JS widget before 4.8
902
+ method_exists( $widget, 'render_control_template_scripts' );
903
+
904
+ return $is_js_widget;
905
+ }
906
+
907
  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
908
  // ADMIN AJAX ACTIONS
909
  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
979
 
980
  exit();
981
  }
982
+
983
  /**
984
  * Add a column that indicates if a column is powered by Page Builder
985
  *
1044
  }
1045
 
1046
  public function get_layout_directories(){
1047
+
1048
  }
1049
 
1050
  /**
1064
  __( "Watch the video to find out more, then sign up below to get started.", 'siteorigin-panels' ),
1065
  'form_description' => __( "We'll email you a confirmation. You can unsubscribe at any time.", 'siteorigin-panels' ),
1066
  );
1067
+
1068
  $lessons['page-builder-animations'] = array(
1069
  'title' => __( 'Free Page Builder Addons', 'siteorigin-panels' ),
1070
  'video' => '212380210',
1077
 
1078
  return $lessons;
1079
  }
1080
+
1081
  /**
1082
  * Filter the translation strings for SiteOrigin learning dialogs
1083
  *
1090
  'watch_video' => __( 'Watch Intro Video', 'siteorigin-panels' ),
1091
  'loaded_from_vimeo' => __( 'Loaded from Vimeo Servers', 'siteorigin-panels' ),
1092
  'valid_email' => __( 'Please enter a valid email address.', 'siteorigin-panels' ),
1093
+
1094
  'your_name' => __( 'Your Name', 'siteorigin-panels' ),
1095
  'your_email' => __( 'Your Email', 'siteorigin-panels' ),
1096
  'sign_up' => __( 'Sign Up', 'siteorigin-panels' ),
inc/styles.php CHANGED
@@ -450,7 +450,7 @@ class SiteOrigin_Panels_Styles {
450
  }
451
  }
452
  if ( ! empty( $css_key ) && ! empty( $style[ $css_key ] ) ) {
453
- preg_match_all( '/^(.+?):(.+?);?$/m', $style[ $css_key ], $matches );
454
 
455
  if ( ! empty( $matches[0] ) ) {
456
  for ( $i = 0; $i < count( $matches[0] ); $i ++ ) {
@@ -476,7 +476,7 @@ class SiteOrigin_Panels_Styles {
476
  }
477
 
478
  if ( ! empty( $style[ 'mobile_css' ] ) ) {
479
- preg_match_all( '/^(.+?):(.+?);?$/m', $style[ 'mobile_css' ], $matches );
480
 
481
  if ( ! empty( $matches[0] ) ) {
482
  for ( $i = 0; $i < count( $matches[0] ); $i ++ ) {
450
  }
451
  }
452
  if ( ! empty( $css_key ) && ! empty( $style[ $css_key ] ) ) {
453
+ preg_match_all( '/^([A-Za-z0-9\-]+?):(.+?);?$/m', $style[ $css_key ], $matches );
454
 
455
  if ( ! empty( $matches[0] ) ) {
456
  for ( $i = 0; $i < count( $matches[0] ); $i ++ ) {
476
  }
477
 
478
  if ( ! empty( $style[ 'mobile_css' ] ) ) {
479
+ preg_match_all( '/^([A-Za-z0-9\-]+?):(.+?);?$/m', $style[ 'mobile_css' ], $matches );
480
 
481
  if ( ! empty( $matches[0] ) ) {
482
  for ( $i = 0; $i < count( $matches[0] ); $i ++ ) {
inc/widgets/layout.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * This widget give you the full Page Builder interface inside a widget. Fully nestable.
5
+ *
6
+ * Class SiteOrigin_Panels_Widgets_Builder
7
+ */
8
+ class SiteOrigin_Panels_Widgets_Layout extends WP_Widget {
9
+ function __construct() {
10
+ parent::__construct(
11
+ 'siteorigin-panels-builder',
12
+ // TRANSLATORS: This is the name of a widget
13
+ __( 'Layout Builder', 'siteorigin-panels' ),
14
+ array(
15
+ 'description' => __( 'A complete SiteOrigin Page Builder layout as a widget.', 'siteorigin-panels' ),
16
+ 'panels_title' => false,
17
+ ),
18
+ array(
19
+ )
20
+ );
21
+ }
22
+
23
+ function widget($args, $instance) {
24
+ if( empty($instance['panels_data']) ) return;
25
+
26
+ if( is_string( $instance['panels_data'] ) ) {
27
+ $instance['panels_data'] = json_decode( $instance['panels_data'], true );
28
+ }
29
+ if(empty($instance['panels_data']['widgets'])) return;
30
+
31
+ if( ! empty( $instance['panels_data']['widgets'] ) ) {
32
+ foreach( $instance['panels_data']['widgets'] as & $widget ) {
33
+ $widget['panels_info']['class'] = str_replace( '&#92;', '\\', $widget['panels_info']['class'] );
34
+ }
35
+ }
36
+
37
+ if( empty( $instance['builder_id'] ) ) $instance['builder_id'] = uniqid();
38
+
39
+ echo $args['before_widget'];
40
+ echo SiteOrigin_Panels::renderer()->render( 'w'.$instance['builder_id'], true, $instance['panels_data'], $layout_data );
41
+ if( ! empty( $GLOBALS[ 'SITEORIGIN_PANELS_POST_CONTENT_RENDER' ] ) && siteorigin_panels_setting( 'copy-styles' ) ) {
42
+ $widget_css = '@import url(' . SiteOrigin_Panels::front_css_url() . '); ';
43
+ $widget_css .= SiteOrigin_Panels::renderer()->generate_css( 'w'.$instance['builder_id'], $instance['panels_data'], $layout_data );
44
+ $widget_css = preg_replace( '/\s+/', ' ', $widget_css );
45
+ echo "\n\n" .
46
+ '<style type="text/css" class="panels-style" data-panels-style-for-post="' . esc_attr( 'w'.$instance['builder_id'] ) . '">' .
47
+ $widget_css .
48
+ '</style>';
49
+ }
50
+ echo $args['after_widget'];
51
+ }
52
+
53
+ function update($new, $old) {
54
+ $new['builder_id'] = uniqid();
55
+
56
+ if( is_string($new['panels_data']) && ! empty( $new['panels_data'] ) ) {
57
+ // This is still in a string format, so we'll convert it to an array for sanitization
58
+ $new['panels_data'] = json_decode( $new['panels_data'], true );
59
+ }
60
+
61
+ if ( ! empty( $new['panels_data'] ) && ! empty( $new['panels_data']['widgets'] ) ) {
62
+ $new['panels_data']['widgets'] = SiteOrigin_Panels_Admin::single()->process_raw_widgets(
63
+ $new['panels_data']['widgets'],
64
+ ! empty( $old['panels_data']['widgets'] ) ? $old['panels_data']['widgets'] : false
65
+ );
66
+ foreach( $new['panels_data']['widgets'] as & $widget ) {
67
+ $widget['panels_info']['class'] = str_replace( '\\', '&#92;', $widget['panels_info']['class'] );
68
+ }
69
+ }
70
+
71
+ return $new;
72
+ }
73
+
74
+ function form( $instance ){
75
+ $instance = wp_parse_args($instance, array(
76
+ 'panels_data' => '',
77
+ 'builder_id' => uniqid(),
78
+ ) );
79
+ $form_id = uniqid();
80
+
81
+ if( ! empty( $instance['panels_data']['widgets'] ) ) {
82
+ foreach( $instance['panels_data']['widgets'] as & $widget ) {
83
+ $widget['panels_info']['class'] = str_replace( '&#92;', '\\', $widget['panels_info']['class'] );
84
+ }
85
+ }
86
+
87
+ if( ! is_string( $instance['panels_data'] ) ) {
88
+ $instance['panels_data'] = json_encode( $instance['panels_data'] );
89
+ }
90
+
91
+ ?>
92
+ <div class="siteorigin-page-builder-widget" id="siteorigin-page-builder-widget-<?php echo esc_attr( $form_id ) ?>" data-builder-id="<?php echo esc_attr( $form_id ) ?>" data-type="layout_widget">
93
+ <p>
94
+ <button class="button-secondary siteorigin-panels-display-builder" ><?php _e('Open Builder', 'siteorigin-panels') ?></button>
95
+ </p>
96
+
97
+ <input type="hidden" data-panels-filter="json_parse" value="" class="panels-data" name="<?php echo $this->get_field_name('panels_data') ?>" id="<?php echo $this->get_field_id('panels_data') ?>" />
98
+
99
+ <script type="text/javascript">
100
+ ( function( panelsData ){
101
+ // Create the panels_data input
102
+ document.getElementById('<?php echo $this->get_field_id('panels_data') ?>').value = JSON.stringify( panelsData );
103
+ } )( <?php echo $instance['panels_data']; ?> );
104
+ </script>
105
+
106
+ <input type="hidden" value="<?php echo esc_attr( $instance['builder_id'] ) ?>" name="<?php echo $this->get_field_name('builder_id') ?>" />
107
+ </div>
108
+ <script type="text/javascript">
109
+ if(
110
+ typeof jQuery.fn.soPanelsSetupBuilderWidget != 'undefined' &&
111
+ ( ! jQuery('body').hasClass('wp-customizer') || jQuery( "#siteorigin-page-builder-widget-<?php echo esc_attr( $form_id ) ?>").closest( '.panel-dialog' ).length )
112
+ ) {
113
+ jQuery( "#siteorigin-page-builder-widget-<?php echo esc_attr( $form_id ) ?>").soPanelsSetupBuilderWidget();
114
+ }
115
+ </script>
116
+ <?php
117
+ }
118
+
119
+ }
inc/widgets/post-content.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Widget for displaying content from a post
5
+ *
6
+ * Class SiteOrigin_Panels_Widgets_PostContent
7
+ */
8
+ class SiteOrigin_Panels_Widgets_PostContent extends WP_Widget {
9
+ function __construct() {
10
+ parent::__construct(
11
+ 'siteorigin-panels-post-content',
12
+ __( 'Post Content', 'siteorigin-panels' ),
13
+ array(
14
+ 'description' => __( 'Displays content from the current post.', 'siteorigin-panels' ),
15
+ )
16
+ );
17
+ }
18
+
19
+ function widget( $args, $instance ) {
20
+ if( is_admin() ) return;
21
+
22
+ echo $args['before_widget'];
23
+ $content = apply_filters('siteorigin_panels_widget_post_content', $this->default_content($instance['type']));
24
+ echo $content;
25
+ echo $args['after_widget'];
26
+ }
27
+
28
+ /**
29
+ * The default content for post types
30
+ * @param $type
31
+ * @return string
32
+ */
33
+ function default_content($type){
34
+ global $post;
35
+ if(empty($post)) return;
36
+
37
+ switch($type) {
38
+ case 'title' :
39
+ return '<h1 class="entry-title">' . $post->post_title . '</h1>';
40
+ case 'content' :
41
+ return '<div class="entry-content">' . wpautop($post->post_content) . '</div>';
42
+ case 'featured' :
43
+ if(!has_post_thumbnail()) return '';
44
+ return '<div class="featured-image">' . get_the_post_thumbnail($post->ID) . '</div>';
45
+ default :
46
+ return '';
47
+ }
48
+ }
49
+
50
+ function update($new, $old){
51
+ return $new;
52
+ }
53
+
54
+ function form( $instance ) {
55
+ $instance = wp_parse_args($instance, array(
56
+ 'type' => 'content',
57
+ ));
58
+
59
+ $types = apply_filters('siteorigin_panels_widget_post_content_types', array(
60
+ '' => __('None', 'siteorigin-panels'),
61
+ 'title' => __('Title', 'siteorigin-panels'),
62
+ 'featured' => __('Featured Image', 'siteorigin-panels'),
63
+ ));
64
+
65
+ ?>
66
+ <p>
67
+ <label for="<?php echo $this->get_field_id( 'type' ) ?>"><?php _e( 'Display Content', 'siteorigin-panels' ) ?></label>
68
+ <select id="<?php echo $this->get_field_id( 'type' ) ?>" name="<?php echo $this->get_field_name( 'type' ) ?>">
69
+ <?php foreach ($types as $type_id => $title) : ?>
70
+ <option value="<?php echo esc_attr($type_id) ?>" <?php selected($type_id, $instance['type']) ?>><?php echo esc_html($title) ?></option>
71
+ <?php endforeach ?>
72
+ </select>
73
+ </p>
74
+ <?php
75
+ }
76
+ }
inc/widgets/post-loop-helper.php ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * A helper widget for the main SiteOrigin_Panels_Widgets_PostLoop class
5
+ *
6
+ * Class SiteOrigin_Panels_Widgets_PostLoop_Helper
7
+ */
8
+ class SiteOrigin_Panels_Widgets_PostLoop_Helper extends SiteOrigin_Widget {
9
+
10
+ /**
11
+ * SiteOrigin_Panels_Widgets_PostLoop_Helper constructor.
12
+ *
13
+ * @param array $templates
14
+ */
15
+ function __construct( $templates ) {
16
+
17
+ $template_options = array();
18
+ if( ! empty( $templates ) ) {
19
+ foreach( $templates as $template ) {
20
+ $headers = get_file_data( locate_template( $template ), array(
21
+ 'loop_name' => 'Loop Name',
22
+ ) );
23
+ $template_options[ $template ] = esc_html( ! empty( $headers['loop_name'] ) ? $headers['loop_name'] : $template );
24
+ }
25
+ }
26
+
27
+ parent::__construct(
28
+ 'siteorigin-panels-postloop-helper',
29
+ __( 'Post Loop', 'siteorigin-panels' ),
30
+ array(
31
+ 'description' => __( 'Displays a post loop.', 'siteorigin-panels' ),
32
+ ),
33
+ array(),
34
+ array(
35
+ 'title' => array(
36
+ 'type' => 'text',
37
+ 'label' => __( 'Title', 'siteorigin-panels' ),
38
+ ),
39
+ 'template' => array(
40
+ 'type' => 'select',
41
+ 'label' => __( 'Template', 'siteorigin-panels' ),
42
+ 'options' => $template_options,
43
+ 'default' => 'loop.php',
44
+ ),
45
+ 'more' => array(
46
+ 'type' => 'checkbox',
47
+ 'label' => __( 'More link', 'so-widgets-bundle' ),
48
+ 'description' => __( 'If the template supports it, cut posts and display the more link.', 'siteorigin-panels' ),
49
+ 'default' => false,
50
+ ),
51
+ 'posts' => array(
52
+ 'type' => 'posts',
53
+ 'label' => __( 'Posts query', 'so-widgets-bundle' ),
54
+ 'hide' => true
55
+ ),
56
+ )
57
+ );
58
+ }
59
+
60
+ /**
61
+ * Convert this instance into one that's compatible with the posts field
62
+ *
63
+ * @param $instance
64
+ *
65
+ * @return mixed
66
+ */
67
+ function modify_instance( $instance ) {
68
+ if( ! empty( $instance['post_type'] ) ) {
69
+ $value = '';
70
+
71
+ if( ! empty( $instance['post_type'] ) ) $value .= 'post_type=' . $instance['post_type'];
72
+ if( ! empty( $instance['posts_per_page'] ) ) $value .= '&posts_per_page=' . $instance['posts_per_page'];
73
+ if( ! empty( $instance['order'] ) ) $value .= '&order=' . $instance['order'];
74
+ if( ! empty( $instance['orderby'] ) ) $value .= '&orderby=' . $instance['orderby'];
75
+ if( ! empty( $instance['sticky'] ) ) $value .= '&sticky=' . $instance['sticky'];
76
+ if( ! empty( $instance['additional'] ) ) $value .= '&additional=' . $instance['additional'];
77
+ $instance[ 'posts' ] = $value;
78
+
79
+ unset( $instance[ 'post_type' ] );
80
+ unset( $instance[ 'posts_per_page' ] );
81
+ unset( $instance[ 'order' ] );
82
+ unset( $instance[ 'orderby' ] );
83
+ unset( $instance[ 'sticky' ] );
84
+ unset( $instance[ 'additional' ] );
85
+ }
86
+
87
+ return $instance;
88
+ }
89
+
90
+ /**
91
+ * @param array $args
92
+ * @param array $instance
93
+ *
94
+ * @return bool
95
+ */
96
+ function widget( $args, $instance ) {
97
+ return false;
98
+ }
99
+ }
widgets/basic.php → inc/widgets/post-loop.php RENAMED
@@ -1,204 +1,14 @@
1
  <?php
2
 
3
- /**
4
- * This widget give you the full Page Builder interface inside a widget. Fully nestable.
5
- *
6
- * Class SiteOrigin_Panels_Widgets_Builder
7
- */
8
- class SiteOrigin_Panels_Widgets_Layout extends WP_Widget {
9
- function __construct() {
10
- parent::__construct(
11
- 'siteorigin-panels-builder',
12
- // TRANSLATORS: This is the name of a widget
13
- __( 'Layout Builder', 'siteorigin-panels' ),
14
- array(
15
- 'description' => __( 'A complete SiteOrigin Page Builder layout as a widget.', 'siteorigin-panels' ),
16
- 'panels_title' => false,
17
- ),
18
- array(
19
- )
20
- );
21
- }
22
-
23
- function widget($args, $instance) {
24
- if( empty($instance['panels_data']) ) return;
25
-
26
- if( is_string( $instance['panels_data'] ) ) {
27
- $instance['panels_data'] = json_decode( $instance['panels_data'], true );
28
- }
29
- if(empty($instance['panels_data']['widgets'])) return;
30
-
31
- if( ! empty( $instance['panels_data']['widgets'] ) ) {
32
- foreach( $instance['panels_data']['widgets'] as & $widget ) {
33
- $widget['panels_info']['class'] = str_replace( '&#92;', '\\', $widget['panels_info']['class'] );
34
- }
35
- }
36
-
37
- if( empty( $instance['builder_id'] ) ) $instance['builder_id'] = uniqid();
38
-
39
- echo $args['before_widget'];
40
- echo SiteOrigin_Panels::renderer()->render( 'w'.$instance['builder_id'], true, $instance['panels_data'], $layout_data );
41
- if( ! empty( $GLOBALS[ 'SITEORIGIN_PANELS_POST_CONTENT_RENDER' ] ) && siteorigin_panels_setting( 'copy-styles' ) ) {
42
- $widget_css = '@import url(' . SiteOrigin_Panels::front_css_url() . '); ';
43
- $widget_css .= SiteOrigin_Panels::renderer()->generate_css( 'w'.$instance['builder_id'], $instance['panels_data'], $layout_data );
44
- $widget_css = preg_replace( '/\s+/', ' ', $widget_css );
45
- echo "\n\n" .
46
- '<style type="text/css" class="panels-style" data-panels-style-for-post="' . esc_attr( 'w'.$instance['builder_id'] ) . '">' .
47
- $widget_css .
48
- '</style>';
49
- }
50
- echo $args['after_widget'];
51
- }
52
-
53
- function update($new, $old) {
54
- $new['builder_id'] = uniqid();
55
-
56
- if( is_string($new['panels_data']) && ! empty( $new['panels_data'] ) ) {
57
- // This is still in a string format, so we'll convert it to an array for sanitization
58
- $new['panels_data'] = json_decode( $new['panels_data'], true );
59
- }
60
-
61
- if ( ! empty( $new['panels_data'] ) && ! empty( $new['panels_data']['widgets'] ) ) {
62
- $new['panels_data']['widgets'] = SiteOrigin_Panels_Admin::single()->process_raw_widgets(
63
- $new['panels_data']['widgets'],
64
- ! empty( $old['panels_data']['widgets'] ) ? $old['panels_data']['widgets'] : false
65
- );
66
- foreach( $new['panels_data']['widgets'] as & $widget ) {
67
- $widget['panels_info']['class'] = str_replace( '\\', '&#92;', $widget['panels_info']['class'] );
68
- }
69
- }
70
-
71
- return $new;
72
- }
73
-
74
- function form( $instance ){
75
- $instance = wp_parse_args($instance, array(
76
- 'panels_data' => '',
77
- 'builder_id' => uniqid(),
78
- ) );
79
- $form_id = uniqid();
80
-
81
- if( ! empty( $instance['panels_data']['widgets'] ) ) {
82
- foreach( $instance['panels_data']['widgets'] as & $widget ) {
83
- $widget['panels_info']['class'] = str_replace( '&#92;', '\\', $widget['panels_info']['class'] );
84
- }
85
- }
86
-
87
- if( ! is_string( $instance['panels_data'] ) ) {
88
- $instance['panels_data'] = json_encode( $instance['panels_data'] );
89
- }
90
-
91
- ?>
92
- <div class="siteorigin-page-builder-widget" id="siteorigin-page-builder-widget-<?php echo esc_attr( $form_id ) ?>" data-builder-id="<?php echo esc_attr( $form_id ) ?>" data-type="layout_widget">
93
- <p>
94
- <button class="button-secondary siteorigin-panels-display-builder" ><?php _e('Open Builder', 'siteorigin-panels') ?></button>
95
- </p>
96
-
97
- <input type="hidden" data-panels-filter="json_parse" value="" class="panels-data" name="<?php echo $this->get_field_name('panels_data') ?>" id="<?php echo $this->get_field_id('panels_data') ?>" />
98
-
99
- <script type="text/javascript">
100
- ( function( panelsData ){
101
- // Create the panels_data input
102
- document.getElementById('<?php echo $this->get_field_id('panels_data') ?>').value = JSON.stringify( panelsData );
103
- } )( <?php echo $instance['panels_data']; ?> );
104
- </script>
105
-
106
- <input type="hidden" value="<?php echo esc_attr( $instance['builder_id'] ) ?>" name="<?php echo $this->get_field_name('builder_id') ?>" />
107
- </div>
108
- <script type="text/javascript">
109
- if(
110
- typeof jQuery.fn.soPanelsSetupBuilderWidget != 'undefined' &&
111
- ( ! jQuery('body').hasClass('wp-customizer') || jQuery( "#siteorigin-page-builder-widget-<?php echo esc_attr( $form_id ) ?>").closest( '.panel-dialog' ).length )
112
- ) {
113
- jQuery( "#siteorigin-page-builder-widget-<?php echo esc_attr( $form_id ) ?>").soPanelsSetupBuilderWidget();
114
- }
115
- </script>
116
- <?php
117
- }
118
-
119
- }
120
-
121
- /**
122
- * Widget for displaying content from a post
123
- *
124
- * Class SiteOrigin_Panels_Widgets_PostContent
125
- */
126
- class SiteOrigin_Panels_Widgets_PostContent extends WP_Widget {
127
- function __construct() {
128
- parent::__construct(
129
- 'siteorigin-panels-post-content',
130
- __( 'Post Content', 'siteorigin-panels' ),
131
- array(
132
- 'description' => __( 'Displays content from the current post.', 'siteorigin-panels' ),
133
- )
134
- );
135
- }
136
-
137
- function widget( $args, $instance ) {
138
- if( is_admin() ) return;
139
-
140
- echo $args['before_widget'];
141
- $content = apply_filters('siteorigin_panels_widget_post_content', $this->default_content($instance['type']));
142
- echo $content;
143
- echo $args['after_widget'];
144
- }
145
-
146
- /**
147
- * The default content for post types
148
- * @param $type
149
- * @return string
150
- */
151
- function default_content($type){
152
- global $post;
153
- if(empty($post)) return;
154
-
155
- switch($type) {
156
- case 'title' :
157
- return '<h1 class="entry-title">' . $post->post_title . '</h1>';
158
- case 'content' :
159
- return '<div class="entry-content">' . wpautop($post->post_content) . '</div>';
160
- case 'featured' :
161
- if(!has_post_thumbnail()) return '';
162
- return '<div class="featured-image">' . get_the_post_thumbnail($post->ID) . '</div>';
163
- default :
164
- return '';
165
- }
166
- }
167
-
168
- function update($new, $old){
169
- return $new;
170
- }
171
-
172
- function form( $instance ) {
173
- $instance = wp_parse_args($instance, array(
174
- 'type' => 'content',
175
- ));
176
-
177
- $types = apply_filters('siteorigin_panels_widget_post_content_types', array(
178
- '' => __('None', 'siteorigin-panels'),
179
- 'title' => __('Title', 'siteorigin-panels'),
180
- 'featured' => __('Featured Image', 'siteorigin-panels'),
181
- ));
182
-
183
- ?>
184
- <p>
185
- <label for="<?php echo $this->get_field_id( 'type' ) ?>"><?php _e( 'Display Content', 'siteorigin-panels' ) ?></label>
186
- <select id="<?php echo $this->get_field_id( 'type' ) ?>" name="<?php echo $this->get_field_name( 'type' ) ?>">
187
- <?php foreach ($types as $type_id => $title) : ?>
188
- <option value="<?php echo esc_attr($type_id) ?>" <?php selected($type_id, $instance['type']) ?>><?php echo esc_html($title) ?></option>
189
- <?php endforeach ?>
190
- </select>
191
- </p>
192
- <?php
193
- }
194
- }
195
-
196
  /**
197
  * Display a loop of posts.
198
  *
199
  * Class SiteOrigin_Panels_Widgets_PostLoop
200
  */
201
  class SiteOrigin_Panels_Widgets_PostLoop extends WP_Widget{
 
 
 
202
  function __construct() {
203
  parent::__construct(
204
  'siteorigin-panels-postloop',
@@ -208,7 +18,29 @@ class SiteOrigin_Panels_Widgets_PostLoop extends WP_Widget{
208
  )
209
  );
210
  }
211
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
212
  /**
213
  * @param array $args
214
  * @param array $instance
@@ -216,7 +48,7 @@ class SiteOrigin_Panels_Widgets_PostLoop extends WP_Widget{
216
  function widget( $args, $instance ) {
217
  if( empty( $instance['template'] ) ) return;
218
  if( is_admin() ) return;
219
-
220
  static $depth = 0;
221
  $depth++;
222
  if( $depth > 1 ) {
@@ -225,7 +57,7 @@ class SiteOrigin_Panels_Widgets_PostLoop extends WP_Widget{
225
  echo $args['before_widget'].$args['after_widget'];
226
  return;
227
  }
228
-
229
  $query_args = $instance;
230
  //If Widgets Bundle post selector is available and a posts query has been saved using it.
231
  if ( function_exists( 'siteorigin_widget_post_selector_process_query' ) && ! empty( $instance['posts'] ) ) {
@@ -234,19 +66,22 @@ class SiteOrigin_Panels_Widgets_PostLoop extends WP_Widget{
234
  }
235
  else {
236
  if ( ! empty( $instance['posts'] ) ) {
 
237
  $query_args = wp_parse_args( $instance['posts'], $query_args );
238
  }
239
-
240
- switch($query_args['sticky']){
241
- case 'ignore' :
242
- $query_args['ignore_sticky_posts'] = 1;
243
- break;
244
- case 'only' :
245
- $query_args['post__in'] = get_option( 'sticky_posts' );
246
- break;
247
- case 'exclude' :
248
- $query_args['post__not_in'] = get_option( 'sticky_posts' );
249
- break;
 
 
250
  }
251
  unset($query_args['template']);
252
  unset($query_args['title']);
@@ -257,11 +92,11 @@ class SiteOrigin_Panels_Widgets_PostLoop extends WP_Widget{
257
  }
258
  $query_args = wp_parse_args($query_args['additional'], $query_args);
259
  unset($query_args['additional']);
260
-
261
  global $wp_rewrite;
262
-
263
  if( $wp_rewrite->using_permalinks() ) {
264
-
265
  if( get_query_var('paged') ) {
266
  // When the widget appears on a sub page.
267
  $query_args['paged'] = get_query_var('paged');
@@ -278,11 +113,11 @@ class SiteOrigin_Panels_Widgets_PostLoop extends WP_Widget{
278
  // Get current page number when we're not using permalinks
279
  $query_args['paged'] = isset($_GET['paged']) ? intval($_GET['paged']) : 1;
280
  }
281
-
282
  // Exclude the current post to prevent possible infinite loop
283
-
284
  global $siteorigin_panels_current_post;
285
-
286
  if( !empty($siteorigin_panels_current_post) ){
287
  if( !empty( $query_args['post__not_in'] ) ){
288
  if( !is_array( $query_args['post__not_in'] ) ){
@@ -295,22 +130,22 @@ class SiteOrigin_Panels_Widgets_PostLoop extends WP_Widget{
295
  $query_args['post__not_in'] = array( $siteorigin_panels_current_post );
296
  }
297
  }
298
-
299
  if( !empty($query_args['post__in']) && !is_array($query_args['post__in']) ) {
300
  $query_args['post__in'] = explode(',', $query_args['post__in']);
301
  $query_args['post__in'] = array_map('intval', $query_args['post__in']);
302
  }
303
-
304
  // Create the query
305
  query_posts( apply_filters( 'siteorigin_panels_postloop_query_args', $query_args ) );
306
  echo $args['before_widget'];
307
-
308
  // Filter the title
309
  $instance['title'] = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
310
  if ( !empty( $instance['title'] ) ) {
311
  echo $args['before_title'] . $instance['title'] . $args['after_title'];
312
  }
313
-
314
  global $more; $old_more = $more; $more = empty($instance['more']);
315
  self::$rendering_loop = true;
316
  if(strpos('/'.$instance['template'], '/content') !== false) {
@@ -323,64 +158,14 @@ class SiteOrigin_Panels_Widgets_PostLoop extends WP_Widget{
323
  locate_template($instance['template'], true, false);
324
  }
325
  self::$rendering_loop = false;
326
-
327
  echo $args['after_widget'];
328
-
329
  // Reset everything
330
  wp_reset_query();
331
  $depth--;
332
  }
333
-
334
- static $rendering_loop;
335
-
336
- static function is_rendering_loop() {
337
- return self::$rendering_loop;
338
- }
339
-
340
- /**
341
- * Update the widget
342
- *
343
- * @param array $new
344
- * @param array $old
345
- * @return array
346
- */
347
- function update($new, $old){
348
- $new['more'] = !empty( $new['more'] );
349
- return $new;
350
- }
351
-
352
- /**
353
- * Get all the existing files
354
- *
355
- * @return array
356
- */
357
- function get_loop_templates(){
358
- $templates = array();
359
-
360
- $template_files = array(
361
- 'loop*.php',
362
- '*/loop*.php',
363
- 'content*.php',
364
- '*/content*.php',
365
- );
366
-
367
- $template_dirs = array(get_template_directory(), get_stylesheet_directory());
368
- $template_dirs = array_unique($template_dirs);
369
- foreach($template_dirs as $dir ){
370
- foreach($template_files as $template_file) {
371
- foreach((array) glob($dir.'/'.$template_file) as $file) {
372
- if( file_exists( $file ) ) $templates[] = str_replace($dir.'/', '', $file);
373
- }
374
- }
375
- }
376
-
377
- $templates = array_unique($templates);
378
- $templates = apply_filters('siteorigin_panels_postloop_templates', $templates);
379
- sort($templates);
380
-
381
- return $templates;
382
- }
383
-
384
  /**
385
  * Display the form for the post loop.
386
  *
@@ -388,76 +173,71 @@ class SiteOrigin_Panels_Widgets_PostLoop extends WP_Widget{
388
  * @return string|void
389
  */
390
  function form( $instance ) {
391
- $instance = wp_parse_args($instance, array(
392
- 'title' => '',
393
- 'template' => 'loop.php',
394
-
395
- // Query args
396
- 'post_type' => 'post',
397
- 'posts_per_page' => '',
398
-
399
- 'order' => 'DESC',
400
- 'orderby' => 'date',
401
-
402
- 'sticky' => '',
403
-
404
- 'additional' => '',
405
- 'more' => false,
406
- ));
407
-
408
  $templates = $this->get_loop_templates();
409
  if( empty($templates) ) {
410
  ?><p><?php _e("Your theme doesn't have any post loops.", 'siteorigin-panels') ?></p><?php
411
  return;
412
  }
413
-
414
- ?>
415
- <p>
416
- <label for="<?php echo $this->get_field_id( 'title' ) ?>"><?php _e( 'Title', 'siteorigin-panels' ) ?></label>
417
- <input type="text" class="widefat" name="<?php echo $this->get_field_name( 'title' ) ?>" id="<?php echo $this->get_field_id( 'title' ) ?>" value="<?php echo esc_attr( $instance['title'] ) ?>">
418
- </p>
419
- <p>
420
- <label for="<?php echo $this->get_field_id('template') ?>"><?php _e('Template', 'siteorigin-panels') ?></label>
421
- <select id="<?php echo $this->get_field_id( 'template' ) ?>" name="<?php echo $this->get_field_name( 'template' ) ?>">
422
- <?php foreach($templates as $template) : ?>
423
- <option value="<?php echo esc_attr($template) ?>" <?php selected($instance['template'], $template) ?>>
424
- <?php
425
- $headers = get_file_data( locate_template($template), array(
426
- 'loop_name' => 'Loop Name',
427
- ) );
428
- echo esc_html(!empty($headers['loop_name']) ? $headers['loop_name'] : $template);
429
- ?>
430
- </option>
431
- <?php endforeach; ?>
432
- </select>
433
- </p>
434
-
435
- <p>
436
- <label for="<?php echo $this->get_field_id('more') ?>"><?php _e('More Link', 'siteorigin-panels') ?></label>
437
- <input type="checkbox" class="widefat" id="<?php echo $this->get_field_id( 'more' ) ?>" name="<?php echo $this->get_field_name( 'more' ) ?>" <?php checked( $instance['more'] ) ?> /><br/>
438
- <small><?php _e('If the template supports it, cut posts and display the more link.', 'siteorigin-panels') ?></small>
439
- </p>
440
- <?php
441
-
442
  // If the Widgets Bundle is installed and the post selector is available, use that.
443
  // Otherwise revert back to our own form fields.
444
- if ( function_exists( 'siteorigin_widget_post_selector_enqueue_admin_scripts' ) ) {
445
- siteorigin_widget_post_selector_enqueue_admin_scripts();
446
- $value = '';
447
- if ( ! empty( $instance['posts'] ) && ! is_array( $instance['posts'] ) ) {
448
- $value = $instance['posts'];
449
- }
450
- else if ( ! empty( $instance['post_type'] ) ) {
451
- $value .= 'post_type=' . $instance['post_type'];
452
- $value .= '&posts_per_page=' . $instance['posts_per_page'];
453
- $value .= '&order=' . $instance['order'];
454
- $value .= '&orderby=' . $instance['orderby'];
455
- $value .= '&sticky=' . $instance['sticky'];
456
- $value .= '&additional=' . $instance['additional'];
457
- }
458
- siteorigin_widget_post_selector_admin_form_field( $value, $this->get_field_name( 'posts' ) );
459
  }
460
  else {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
461
  if ( ! empty( $instance['posts'] ) ) {
462
  $instance = wp_parse_args( $instance['posts'] , $instance );
463
  unset( $instance['posts'] );
@@ -476,12 +256,12 @@ class SiteOrigin_Panels_Widgets_PostLoop extends WP_Widget{
476
  <?php endforeach; ?>
477
  </select>
478
  </p>
479
-
480
  <p>
481
  <label for="<?php echo $this->get_field_id('posts_per_page') ?>"><?php _e('Posts Per Page', 'siteorigin-panels') ?></label>
482
  <input type="text" class="small-text" id="<?php echo $this->get_field_id( 'posts_per_page' ) ?>" name="<?php echo $this->get_field_name( 'posts_per_page' ) ?>" value="<?php echo esc_attr($instance['posts_per_page']) ?>" />
483
  </p>
484
-
485
  <p>
486
  <label <?php echo $this->get_field_id('orderby') ?>><?php _e('Order By', 'siteorigin-panels') ?></label>
487
  <select id="<?php echo $this->get_field_id( 'orderby' ) ?>" name="<?php echo $this->get_field_name( 'orderby' ) ?>" value="<?php echo esc_attr($instance['orderby']) ?>">
@@ -499,7 +279,7 @@ class SiteOrigin_Panels_Widgets_PostLoop extends WP_Widget{
499
  <option value="post__in" <?php selected($instance['orderby'], 'post__in') ?>><?php esc_html_e('Post In Order', 'siteorigin-panels') ?></option>
500
  </select>
501
  </p>
502
-
503
  <p>
504
  <label for="<?php echo $this->get_field_id('order') ?>"><?php _e('Order', 'siteorigin-panels') ?></label>
505
  <select id="<?php echo $this->get_field_id( 'order' ) ?>" name="<?php echo $this->get_field_name( 'order' ) ?>" value="<?php echo esc_attr($instance['order']) ?>">
@@ -507,7 +287,7 @@ class SiteOrigin_Panels_Widgets_PostLoop extends WP_Widget{
507
  <option value="ASC" <?php selected($instance['order'], 'ASC') ?>><?php esc_html_e('Ascending', 'siteorigin-panels') ?></option>
508
  </select>
509
  </p>
510
-
511
  <p>
512
  <label for="<?php echo $this->get_field_id('sticky') ?>"><?php _e('Sticky Posts', 'siteorigin-panels') ?></label>
513
  <select id="<?php echo $this->get_field_id( 'sticky' ) ?>" name="<?php echo $this->get_field_name( 'sticky' ) ?>" value="<?php echo esc_attr($instance['sticky']) ?>">
@@ -517,7 +297,7 @@ class SiteOrigin_Panels_Widgets_PostLoop extends WP_Widget{
517
  <option value="only" <?php selected($instance['sticky'], 'only') ?>><?php esc_html_e('Only Sticky', 'siteorigin-panels') ?></option>
518
  </select>
519
  </p>
520
-
521
  <p>
522
  <label for="<?php echo $this->get_field_id('additional') ?>"><?php _e('Additional ', 'siteorigin-panels') ?></label>
523
  <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'additional' ) ?>" name="<?php echo $this->get_field_name( 'additional' ) ?>" value="<?php echo esc_attr($instance['additional']) ?>" />
@@ -534,14 +314,40 @@ class SiteOrigin_Panels_Widgets_PostLoop extends WP_Widget{
534
  <?php
535
  }
536
  }
537
- }
538
-
539
- /**
540
- * Register the widgets.
541
- */
542
- function siteorigin_panels_basic_widgets_init(){
543
- register_widget('SiteOrigin_Panels_Widgets_PostContent');
544
- register_widget('SiteOrigin_Panels_Widgets_PostLoop');
545
- register_widget('SiteOrigin_Panels_Widgets_Layout');
546
- }
547
- add_action('widgets_init', 'siteorigin_panels_basic_widgets_init');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  /**
4
  * Display a loop of posts.
5
  *
6
  * Class SiteOrigin_Panels_Widgets_PostLoop
7
  */
8
  class SiteOrigin_Panels_Widgets_PostLoop extends WP_Widget{
9
+
10
+ static $rendering_loop;
11
+
12
  function __construct() {
13
  parent::__construct(
14
  'siteorigin-panels-postloop',
18
  )
19
  );
20
  }
21
+
22
+ static function is_rendering_loop() {
23
+ return self::$rendering_loop;
24
+ }
25
+
26
+ /**
27
+ * Update the widget
28
+ *
29
+ * @param array $new
30
+ * @param array $old
31
+ * @return array
32
+ */
33
+ function update( $new, $old ){
34
+ if( class_exists( 'SiteOrigin_Widget' ) && class_exists( 'SiteOrigin_Widget_Field_Posts' ) ) {
35
+ $helper = new SiteOrigin_Panels_Widgets_PostLoop_Helper( $this->get_loop_templates() );
36
+ return $helper->update( $new, $old );
37
+ }
38
+ else {
39
+ $new['more'] = !empty( $new['more'] );
40
+ return $new;
41
+ }
42
+ }
43
+
44
  /**
45
  * @param array $args
46
  * @param array $instance
48
  function widget( $args, $instance ) {
49
  if( empty( $instance['template'] ) ) return;
50
  if( is_admin() ) return;
51
+
52
  static $depth = 0;
53
  $depth++;
54
  if( $depth > 1 ) {
57
  echo $args['before_widget'].$args['after_widget'];
58
  return;
59
  }
60
+
61
  $query_args = $instance;
62
  //If Widgets Bundle post selector is available and a posts query has been saved using it.
63
  if ( function_exists( 'siteorigin_widget_post_selector_process_query' ) && ! empty( $instance['posts'] ) ) {
66
  }
67
  else {
68
  if ( ! empty( $instance['posts'] ) ) {
69
+ // This is using the new WB 1.9 posts field
70
  $query_args = wp_parse_args( $instance['posts'], $query_args );
71
  }
72
+
73
+ if( ! empty( $query_args['sticky'] ) ) {
74
+ switch( $query_args['sticky'] ){
75
+ case 'ignore' :
76
+ $query_args['ignore_sticky_posts'] = 1;
77
+ break;
78
+ case 'only' :
79
+ $query_args['post__in'] = get_option( 'sticky_posts' );
80
+ break;
81
+ case 'exclude' :
82
+ $query_args['post__not_in'] = get_option( 'sticky_posts' );
83
+ break;
84
+ }
85
  }
86
  unset($query_args['template']);
87
  unset($query_args['title']);
92
  }
93
  $query_args = wp_parse_args($query_args['additional'], $query_args);
94
  unset($query_args['additional']);
95
+
96
  global $wp_rewrite;
97
+
98
  if( $wp_rewrite->using_permalinks() ) {
99
+
100
  if( get_query_var('paged') ) {
101
  // When the widget appears on a sub page.
102
  $query_args['paged'] = get_query_var('paged');
113
  // Get current page number when we're not using permalinks
114
  $query_args['paged'] = isset($_GET['paged']) ? intval($_GET['paged']) : 1;
115
  }
116
+
117
  // Exclude the current post to prevent possible infinite loop
118
+
119
  global $siteorigin_panels_current_post;
120
+
121
  if( !empty($siteorigin_panels_current_post) ){
122
  if( !empty( $query_args['post__not_in'] ) ){
123
  if( !is_array( $query_args['post__not_in'] ) ){
130
  $query_args['post__not_in'] = array( $siteorigin_panels_current_post );
131
  }
132
  }
133
+
134
  if( !empty($query_args['post__in']) && !is_array($query_args['post__in']) ) {
135
  $query_args['post__in'] = explode(',', $query_args['post__in']);
136
  $query_args['post__in'] = array_map('intval', $query_args['post__in']);
137
  }
138
+
139
  // Create the query
140
  query_posts( apply_filters( 'siteorigin_panels_postloop_query_args', $query_args ) );
141
  echo $args['before_widget'];
142
+
143
  // Filter the title
144
  $instance['title'] = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
145
  if ( !empty( $instance['title'] ) ) {
146
  echo $args['before_title'] . $instance['title'] . $args['after_title'];
147
  }
148
+
149
  global $more; $old_more = $more; $more = empty($instance['more']);
150
  self::$rendering_loop = true;
151
  if(strpos('/'.$instance['template'], '/content') !== false) {
158
  locate_template($instance['template'], true, false);
159
  }
160
  self::$rendering_loop = false;
161
+
162
  echo $args['after_widget'];
163
+
164
  // Reset everything
165
  wp_reset_query();
166
  $depth--;
167
  }
168
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
169
  /**
170
  * Display the form for the post loop.
171
  *
173
  * @return string|void
174
  */
175
  function form( $instance ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
176
  $templates = $this->get_loop_templates();
177
  if( empty($templates) ) {
178
  ?><p><?php _e("Your theme doesn't have any post loops.", 'siteorigin-panels') ?></p><?php
179
  return;
180
  }
181
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
182
  // If the Widgets Bundle is installed and the post selector is available, use that.
183
  // Otherwise revert back to our own form fields.
184
+ if( class_exists( 'SiteOrigin_Widget' ) && class_exists( 'SiteOrigin_Widget_Field_Posts' ) ) {
185
+ $helper = new SiteOrigin_Panels_Widgets_PostLoop_Helper( $templates );
186
+
187
+ ob_start();
188
+ $helper->form( $instance );
189
+ $form_html = ob_get_clean();
190
+
191
+ $form_html = preg_replace_callback( '/name="widget-siteorigin-panels-postloop-helper[^\"]+\[(.*?)\]"/', array( $this, 'fix_helper_form_callback' ), $form_html );
192
+
193
+ echo $form_html;
 
 
 
 
 
194
  }
195
  else {
196
+ $instance = wp_parse_args( $instance, array(
197
+ 'title' => '',
198
+ 'template' => 'loop.php',
199
+
200
+ // Query args
201
+ 'post_type' => 'post',
202
+ 'posts_per_page' => '',
203
+
204
+ 'order' => 'DESC',
205
+ 'orderby' => 'date',
206
+
207
+ 'sticky' => '',
208
+
209
+ 'additional' => '',
210
+ 'more' => false,
211
+ ) );
212
+
213
+ ?>
214
+ <p>
215
+ <label for="<?php echo $this->get_field_id( 'title' ) ?>"><?php _e( 'Title', 'siteorigin-panels' ) ?></label>
216
+ <input type="text" class="widefat" name="<?php echo $this->get_field_name( 'title' ) ?>" id="<?php echo $this->get_field_id( 'title' ) ?>" value="<?php echo esc_attr( $instance['title'] ) ?>">
217
+ </p>
218
+ <p>
219
+ <label for="<?php echo $this->get_field_id('template') ?>"><?php _e('Template', 'siteorigin-panels') ?></label>
220
+ <select id="<?php echo $this->get_field_id( 'template' ) ?>" name="<?php echo $this->get_field_name( 'template' ) ?>">
221
+ <?php foreach($templates as $template) : ?>
222
+ <option value="<?php echo esc_attr($template) ?>" <?php selected($instance['template'], $template) ?>>
223
+ <?php
224
+ $headers = get_file_data( locate_template($template), array(
225
+ 'loop_name' => 'Loop Name',
226
+ ) );
227
+ echo esc_html(!empty($headers['loop_name']) ? $headers['loop_name'] : $template);
228
+ ?>
229
+ </option>
230
+ <?php endforeach; ?>
231
+ </select>
232
+ </p>
233
+
234
+ <p>
235
+ <label for="<?php echo $this->get_field_id('more') ?>"><?php _e('More Link', 'siteorigin-panels') ?></label>
236
+ <input type="checkbox" class="widefat" id="<?php echo $this->get_field_id( 'more' ) ?>" name="<?php echo $this->get_field_name( 'more' ) ?>" <?php checked( $instance['more'] ) ?> /><br/>
237
+ <small><?php _e('If the template supports it, cut posts and display the more link.', 'siteorigin-panels') ?></small>
238
+ </p>
239
+ <?php
240
+
241
  if ( ! empty( $instance['posts'] ) ) {
242
  $instance = wp_parse_args( $instance['posts'] , $instance );
243
  unset( $instance['posts'] );
256
  <?php endforeach; ?>
257
  </select>
258
  </p>
259
+
260
  <p>
261
  <label for="<?php echo $this->get_field_id('posts_per_page') ?>"><?php _e('Posts Per Page', 'siteorigin-panels') ?></label>
262
  <input type="text" class="small-text" id="<?php echo $this->get_field_id( 'posts_per_page' ) ?>" name="<?php echo $this->get_field_name( 'posts_per_page' ) ?>" value="<?php echo esc_attr($instance['posts_per_page']) ?>" />
263
  </p>
264
+
265
  <p>
266
  <label <?php echo $this->get_field_id('orderby') ?>><?php _e('Order By', 'siteorigin-panels') ?></label>
267
  <select id="<?php echo $this->get_field_id( 'orderby' ) ?>" name="<?php echo $this->get_field_name( 'orderby' ) ?>" value="<?php echo esc_attr($instance['orderby']) ?>">
279
  <option value="post__in" <?php selected($instance['orderby'], 'post__in') ?>><?php esc_html_e('Post In Order', 'siteorigin-panels') ?></option>
280
  </select>
281
  </p>
282
+
283
  <p>
284
  <label for="<?php echo $this->get_field_id('order') ?>"><?php _e('Order', 'siteorigin-panels') ?></label>
285
  <select id="<?php echo $this->get_field_id( 'order' ) ?>" name="<?php echo $this->get_field_name( 'order' ) ?>" value="<?php echo esc_attr($instance['order']) ?>">
287
  <option value="ASC" <?php selected($instance['order'], 'ASC') ?>><?php esc_html_e('Ascending', 'siteorigin-panels') ?></option>
288
  </select>
289
  </p>
290
+
291
  <p>
292
  <label for="<?php echo $this->get_field_id('sticky') ?>"><?php _e('Sticky Posts', 'siteorigin-panels') ?></label>
293
  <select id="<?php echo $this->get_field_id( 'sticky' ) ?>" name="<?php echo $this->get_field_name( 'sticky' ) ?>" value="<?php echo esc_attr($instance['sticky']) ?>">
297
  <option value="only" <?php selected($instance['sticky'], 'only') ?>><?php esc_html_e('Only Sticky', 'siteorigin-panels') ?></option>
298
  </select>
299
  </p>
300
+
301
  <p>
302
  <label for="<?php echo $this->get_field_id('additional') ?>"><?php _e('Additional ', 'siteorigin-panels') ?></label>
303
  <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'additional' ) ?>" name="<?php echo $this->get_field_name( 'additional' ) ?>" value="<?php echo esc_attr($instance['additional']) ?>" />
314
  <?php
315
  }
316
  }
317
+
318
+ /**
319
+ * Get all the existing files
320
+ *
321
+ * @return array
322
+ */
323
+ function get_loop_templates(){
324
+ $templates = array();
325
+
326
+ $template_files = array(
327
+ 'loop*.php',
328
+ '*/loop*.php',
329
+ 'content*.php',
330
+ '*/content*.php',
331
+ );
332
+
333
+ $template_dirs = array( get_template_directory(), get_stylesheet_directory() );
334
+ $template_dirs = array_unique( $template_dirs );
335
+ foreach( $template_dirs as $dir ){
336
+ foreach( $template_files as $template_file ) {
337
+ foreach( (array) glob($dir.'/'.$template_file) as $file ) {
338
+ if( file_exists( $file ) ) $templates[] = str_replace($dir.'/', '', $file);
339
+ }
340
+ }
341
+ }
342
+
343
+ $templates = array_unique( $templates );
344
+ $templates = apply_filters('siteorigin_panels_postloop_templates', $templates);
345
+ sort( $templates );
346
+
347
+ return $templates;
348
+ }
349
+
350
+ function fix_helper_form_callback( $match ){
351
+ return 'name="' . $this->get_field_name( $match[1] ) . '"';
352
+ }
353
+ }
js/siteorigin-panels-25.js CHANGED
@@ -1552,6 +1552,7 @@ module.exports = panels.view.dialog.extend({
1552
 
1553
  },{}],9:[function(require,module,exports){
1554
  var panels = window.panels, $ = jQuery;
 
1555
 
1556
  module.exports = panels.view.dialog.extend( {
1557
 
@@ -1709,7 +1710,6 @@ module.exports = panels.view.dialog.extend( {
1709
  return;
1710
  }
1711
 
1712
- var thisView = this;
1713
  this.$( '.so-content' ).addClass( 'so-panels-loading' );
1714
 
1715
  var data = {
@@ -1724,22 +1724,31 @@ module.exports = panels.view.dialog.extend( {
1724
  data,
1725
  function ( result ) {
1726
  // Add in the CID of the widget model
1727
- var html = result.replace( /{\$id}/g, thisView.model.cid );
1728
 
1729
  // Load this content into the form
1730
- thisView.$( '.so-content' )
 
1731
  .removeClass( 'so-panels-loading' )
1732
  .html( html );
1733
 
1734
  // Trigger all the necessary events
1735
- thisView.trigger( 'form_loaded', thisView );
1736
 
1737
  // For legacy compatibility, trigger a panelsopen event
1738
- thisView.$( '.panel-dialog' ).trigger( 'panelsopen' );
1739
 
1740
  // If the main dialog is closed from this point on, save the widget content
1741
- thisView.on( 'close_dialog', thisView.updateModel, thisView );
1742
- },
 
 
 
 
 
 
 
 
1743
  'html'
1744
  );
1745
  },
@@ -1831,7 +1840,7 @@ module.exports = panels.view.dialog.extend( {
1831
 
1832
  } );
1833
 
1834
- },{}],10:[function(require,module,exports){
1835
  var panels = window.panels, $ = jQuery;
1836
 
1837
  module.exports = panels.view.dialog.extend( {
@@ -7034,4 +7043,93 @@ module.exports = Backbone.View.extend( {
7034
 
7035
  } );
7036
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7037
  },{}]},{},[16]);
1552
 
1553
  },{}],9:[function(require,module,exports){
1554
  var panels = window.panels, $ = jQuery;
1555
+ var jsWidget = require( '../view/widgets/js-widget' );
1556
 
1557
  module.exports = panels.view.dialog.extend( {
1558
 
1710
  return;
1711
  }
1712
 
 
1713
  this.$( '.so-content' ).addClass( 'so-panels-loading' );
1714
 
1715
  var data = {
1724
  data,
1725
  function ( result ) {
1726
  // Add in the CID of the widget model
1727
+ var html = result.replace( /{\$id}/g, this.model.cid );
1728
 
1729
  // Load this content into the form
1730
+ var $soContent = this.$( '.so-content' );
1731
+ $soContent
1732
  .removeClass( 'so-panels-loading' )
1733
  .html( html );
1734
 
1735
  // Trigger all the necessary events
1736
+ this.trigger( 'form_loaded', this );
1737
 
1738
  // For legacy compatibility, trigger a panelsopen event
1739
+ this.$( '.panel-dialog' ).trigger( 'panelsopen' );
1740
 
1741
  // If the main dialog is closed from this point on, save the widget content
1742
+ this.on( 'close_dialog', this.updateModel, this );
1743
+
1744
+ var widgetContent = $soContent.find( '> .widget-content' );
1745
+ // If there's a widget content wrapper, this is one of the new widgets in WP 4.8 which need some special
1746
+ // handling in JS.
1747
+ if ( widgetContent.length > 0 ) {
1748
+ jsWidget.addWidget( $soContent, this.model.widget_id );
1749
+ }
1750
+
1751
+ }.bind( this ),
1752
  'html'
1753
  );
1754
  },
1840
 
1841
  } );
1842
 
1843
+ },{"../view/widgets/js-widget":30}],10:[function(require,module,exports){
1844
  var panels = window.panels, $ = jQuery;
1845
 
1846
  module.exports = panels.view.dialog.extend( {
7043
 
7044
  } );
7045
 
7046
+ },{}],30:[function(require,module,exports){
7047
+ var mediaWidget = require( './media-widget' );
7048
+ var textWidget = require( './text-widget' );
7049
+
7050
+ var jsWidget = {
7051
+ MEDIA_AUDIO: 'media_audio',
7052
+ MEDIA_IMAGE: 'media_image',
7053
+ MEDIA_VIDEO: 'media_video',
7054
+ TEXT: 'text',
7055
+
7056
+ addWidget: function( widgetContainer, widgetId ) {
7057
+ var idBase = widgetContainer.find( '> .id_base' ).val();
7058
+ var widget;
7059
+
7060
+ switch ( idBase ) {
7061
+ case this.MEDIA_AUDIO:
7062
+ case this.MEDIA_IMAGE:
7063
+ case this.MEDIA_VIDEO:
7064
+ widget = mediaWidget;
7065
+ break;
7066
+ case this.TEXT:
7067
+ widget = textWidget;
7068
+ break
7069
+ }
7070
+
7071
+ widget.addWidget( idBase, widgetContainer, widgetId );
7072
+ },
7073
+ };
7074
+
7075
+ module.exports = jsWidget;
7076
+
7077
+ },{"./media-widget":31,"./text-widget":32}],31:[function(require,module,exports){
7078
+ var $ = jQuery;
7079
+
7080
+ var mediaWidget = {
7081
+ addWidget: function( idBase, widgetContainer, widgetId ) {
7082
+ var component = wp.mediaWidgets;
7083
+
7084
+ var ControlConstructor = component.controlConstructors[ idBase ];
7085
+ if ( ! ControlConstructor ) {
7086
+ return;
7087
+ }
7088
+
7089
+ var ModelConstructor = component.modelConstructors[ idBase ] || component.MediaWidgetModel;
7090
+ var widgetContent = widgetContainer.find( '> .widget-content' );
7091
+ var controlContainer = $( '<div class="media-widget-control"></div>' );
7092
+ widgetContent.before( controlContainer );
7093
+
7094
+ var modelAttributes = {};
7095
+ widgetContent.find( '.media-widget-instance-property' ).each( function() {
7096
+ var input = $( this );
7097
+ modelAttributes[ input.data( 'property' ) ] = input.val();
7098
+ });
7099
+ modelAttributes.widget_id = widgetId;
7100
+
7101
+ var widgetModel = new ModelConstructor( modelAttributes );
7102
+
7103
+ var widgetControl = new ControlConstructor({
7104
+ el: controlContainer,
7105
+ model: widgetModel
7106
+ });
7107
+
7108
+ widgetControl.render();
7109
+
7110
+ return widgetControl;
7111
+ }
7112
+ };
7113
+
7114
+ module.exports = mediaWidget;
7115
+
7116
+ },{}],32:[function(require,module,exports){
7117
+ var $ = jQuery;
7118
+
7119
+ var textWidget = {
7120
+ addWidget: function( idBase, widgetContainer, widgetId ) {
7121
+ var component = wp.textWidgets;
7122
+
7123
+ var widgetControl = new component.TextWidgetControl({
7124
+ el: widgetContainer
7125
+ });
7126
+
7127
+ widgetControl.initializeEditor();
7128
+
7129
+ return widgetControl;
7130
+ }
7131
+ };
7132
+
7133
+ module.exports = textWidget;
7134
+
7135
  },{}]},{},[16]);
js/siteorigin-panels-25.min.js CHANGED
@@ -1,4 +1,4 @@
1
- !function e(t,i,s){function l(n,a){if(!i[n]){if(!t[n]){var r="function"==typeof require&&require;if(!a&&r)return r(n,!0);if(o)return o(n,!0);var d=new Error("Cannot find module '"+n+"'");throw d.code="MODULE_NOT_FOUND",d}var c=i[n]={exports:{}};t[n][0].call(c.exports,function(e){var i=t[n][1][e];return l(i||e)},c,c.exports,e,t,i,s)}return i[n].exports}for(var o="function"==typeof require&&require,n=0;n<s.length;n++)l(s[n]);return l}({1:[function(e,t,i){var s=window.panels;t.exports=Backbone.Collection.extend({model:s.model.cell,initialize:function(){},totalWeight:function(){var e=0;return this.each(function(t){e+=t.get("weight")}),e}})},{}],2:[function(e,t,i){var s=window.panels;t.exports=Backbone.Collection.extend({model:s.model.historyEntry,builder:null,maxSize:12,initialize:function(){this.on("add",this.onAddEntry,this)},addEntry:function(e,t){_.isEmpty(t)&&(t=this.builder.getPanelsData());var i=new s.model.historyEntry({text:e,data:JSON.stringify(t),time:parseInt((new Date).getTime()/1e3),collection:this});this.add(i)},onAddEntry:function(e){if(this.models.length>1){var t=this.at(this.models.length-2);(e.get("text")===t.get("text")&&e.get("time")-t.get("time")<15||e.get("data")===t.get("data"))&&(this.remove(e),t.set("count",t.get("count")+1))}for(;this.models.length>this.maxSize;)this.shift()}})},{}],3:[function(e,t,i){var s=window.panels;t.exports=Backbone.Collection.extend({model:s.model.row,empty:function(){for(var e;;){if(!(e=this.collection.first()))break;e.destroy()}}})},{}],4:[function(e,t,i){var s=window.panels;t.exports=Backbone.Collection.extend({model:s.model.widget,initialize:function(){}})},{}],5:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=s.view.dialog.extend({dialogClass:"so-panels-dialog-add-builder",render:function(){this.renderDialog(this.parseDialogContent(l("#siteorigin-panels-dialog-builder").html(),{})),this.$(".so-content .siteorigin-panels-builder").append(this.builder.$el)},initializeDialog:function(){var e=this;this.once("open_dialog_complete",function(){e.builder.initSortable()}),this.on("open_dialog_complete",function(){e.builder.trigger("builder_resize")})}})},{}],6:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=s.view.dialog.extend({historyEntryTemplate:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-dialog-history-entry").html())),entries:{},currentEntry:null,revertEntry:null,selectedEntry:null,previewScrollTop:null,dialogClass:"so-panels-dialog-history",dialogIcon:"history",events:{"click .so-close":"closeDialog","click .so-restore":"restoreSelectedEntry"},initializeDialog:function(){this.entries=new s.collection.historyEntries,this.on("open_dialog",this.setCurrentEntry,this),this.on("open_dialog",this.renderHistoryEntries,this)},render:function(){var e=this;this.renderDialog(this.parseDialogContent(l("#siteorigin-panels-dialog-history").html(),{})),this.$("iframe.siteorigin-panels-history-iframe").load(function(){var t=l(this);t.show(),t.contents().scrollTop(e.previewScrollTop)})},setRevertEntry:function(e){this.revertEntry=new s.model.historyEntry({data:JSON.stringify(e.getPanelsData()),time:parseInt((new Date).getTime()/1e3)})},setCurrentEntry:function(){this.currentEntry=new s.model.historyEntry({data:JSON.stringify(this.builder.model.getPanelsData()),time:parseInt((new Date).getTime()/1e3)}),this.selectedEntry=this.currentEntry,this.previewEntry(this.currentEntry),this.$(".so-buttons .so-restore").addClass("disabled")},renderHistoryEntries:function(){var e=this,t=this.$(".history-entries").empty();this.currentEntry.get("data")===this.revertEntry.get("data")&&_.isEmpty(this.entries.models)||l(this.historyEntryTemplate({title:panelsOptions.loc.history.revert,count:1})).data("historyEntry",this.revertEntry).prependTo(t),this.entries.each(function(i){var s=e.historyEntryTemplate({title:panelsOptions.loc.history[i.get("text")],count:i.get("count")});l(s).data("historyEntry",i).prependTo(t)}),l(this.historyEntryTemplate({title:panelsOptions.loc.history.current,count:1})).data("historyEntry",this.currentEntry).addClass("so-selected").prependTo(t),t.find(".history-entry").click(function(){var i=jQuery(this);t.find(".history-entry").not(i).removeClass("so-selected"),i.addClass("so-selected");var s=i.data("historyEntry");e.selectedEntry=s,e.selectedEntry.cid!==e.currentEntry.cid?e.$(".so-buttons .so-restore").removeClass("disabled"):e.$(".so-buttons .so-restore").addClass("disabled"),e.previewEntry(s)}),this.updateEntryTimes()},previewEntry:function(e){var t=this.$("iframe.siteorigin-panels-history-iframe");t.hide(),this.previewScrollTop=t.contents().scrollTop(),this.$('form.history-form input[name="live_editor_panels_data"]').val(e.get("data")),this.$('form.history-form input[name="live_editor_post_ID"]').val(this.builder.config.postId),this.$("form.history-form").submit()},restoreSelectedEntry:function(){return!this.$(".so-buttons .so-restore").hasClass("disabled")&&(this.currentEntry.get("data")===this.selectedEntry.get("data")?(this.closeDialog(),!1):("restore"!==this.selectedEntry.get("text")&&this.builder.addHistoryEntry("restore",this.builder.model.getPanelsData()),this.builder.model.loadPanelsData(JSON.parse(this.selectedEntry.get("data"))),this.closeDialog(),!1))},updateEntryTimes:function(){var e=this;this.$(".history-entries .history-entry").each(function(){var t=jQuery(this),i=t.find(".timesince"),s=t.data("historyEntry");i.html(e.timeSince(s.get("time")))})},timeSince:function(e){var t,i=parseInt((new Date).getTime()/1e3)-e,s=[];return i>3600&&(t=Math.floor(i/3600),1===t?s.push(panelsOptions.loc.time.hour.replace("%d",t)):s.push(panelsOptions.loc.time.hours.replace("%d",t)),i-=3600*t),i>60&&(t=Math.floor(i/60),1===t?s.push(panelsOptions.loc.time.minute.replace("%d",t)):s.push(panelsOptions.loc.time.minutes.replace("%d",t)),i-=60*t),i>0&&(1===i?s.push(panelsOptions.loc.time.second.replace("%d",i)):s.push(panelsOptions.loc.time.seconds.replace("%d",i))),_.isEmpty(s)?panelsOptions.loc.time.now:panelsOptions.loc.time.ago.replace("%s",s.slice(0,2).join(", "))}})},{}],7:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=s.view.dialog.extend({directoryTemplate:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-directory-items").html())),builder:null,dialogClass:"so-panels-dialog-prebuilt-layouts",dialogIcon:"layouts",layoutCache:{},currentTab:!1,directoryPage:1,events:{"click .so-close":"closeDialog","click .so-sidebar-tabs li a":"tabClickHandler","click .so-content .layout":"layoutClickHandler","keyup .so-sidebar-search":"searchHandler","click .so-screenshot, .so-title":"directoryItemClickHandler"},initializeDialog:function(){var e=this;this.on("open_dialog",function(){e.$(".so-sidebar-tabs li a").first().click(),e.$(".so-status").removeClass("so-panels-loading")}),this.on("button_click",this.toolbarButtonClick,this)},render:function(){this.renderDialog(this.parseDialogContent(l("#siteorigin-panels-dialog-prebuilt").html(),{})),this.initToolbar()},tabClickHandler:function(e){e.preventDefault(),this.selectedLayoutItem=null,this.uploadedLayout=null,this.updateButtonState(!1),this.$(".so-sidebar-tabs li").removeClass("tab-active");var t=l(e.target),i=t.attr("href").split("#")[1];t.parent().addClass("tab-active");var s=this;this.$(".so-content").empty(),s.currentTab=i,"import"==i?this.displayImportExport():this.displayLayoutDirectory("",1,i),s.$(".so-sidebar-search").val("")},displayImportExport:function(){var e=this.$(".so-content").empty().removeClass("so-panels-loading");e.html(l("#siteorigin-panels-dialog-prebuilt-importexport").html());var t=this,i=t.$(".import-upload-ui").hide();new plupload.Uploader({runtimes:"html5,silverlight,flash,html4",browse_button:i.find(".file-browse-button").get(0),container:i.get(0),drop_element:i.find(".drag-upload-area").get(0),file_data_name:"panels_import_data",multiple_queues:!1,max_file_size:panelsOptions.plupload.max_file_size,url:panelsOptions.plupload.url,flash_swf_url:panelsOptions.plupload.flash_swf_url,silverlight_xap_url:panelsOptions.plupload.silverlight_xap_url,filters:[{title:panelsOptions.plupload.filter_title,extensions:"json"}],multipart_params:{action:"so_panels_import_layout"},init:{PostInit:function(e){e.features.dragdrop&&i.addClass("has-drag-drop"),i.show().find(".progress-precent").css("width","0%")},FilesAdded:function(e){i.find(".file-browse-button").blur(),i.find(".drag-upload-area").removeClass("file-dragover"),i.find(".progress-bar").fadeIn("fast"),t.$(".js-so-selected-file").text(panelsOptions.loc.prebuilt_loading),e.start()},UploadProgress:function(e,t){i.find(".progress-precent").css("width",t.percent+"%")},FileUploaded:function(e,s,l){var o=JSON.parse(l.response);_.isUndefined(o.widgets)?alert(panelsOptions.plupload.error_message):(t.uploadedLayout=o,i.find(".progress-bar").hide(),t.$(".js-so-selected-file").text(panelsOptions.loc.ready_to_insert.replace("%s",s.name)),t.updateButtonState(!0))},Error:function(){alert(panelsOptions.plupload.error_message)}}}).init(),i.find(".drag-upload-area").on("dragover",function(){l(this).addClass("file-dragover")}).on("dragleave",function(){l(this).removeClass("file-dragover")}),e.find(".so-export").submit(function(e){l(this).find('input[name="panels_export_data"]').val(JSON.stringify(t.builder.model.getPanelsData()))})},displayLayoutDirectory:function(e,t,i){var s=this,o=this.$(".so-content").empty().addClass("so-panels-loading");if(void 0===e&&(e=""),void 0===t&&(t=1),void 0===i&&(i="directory-siteorigin"),i.match("^directory-")&&!panelsOptions.directory_enabled)return o.removeClass("so-panels-loading").html(l("#siteorigin-panels-directory-enable").html()),void o.find(".so-panels-enable-directory").click(function(n){n.preventDefault(),l.get(panelsOptions.ajaxurl,{action:"so_panels_directory_enable"},function(){}),panelsOptions.directory_enabled=!0,o.addClass("so-panels-loading"),s.displayLayoutDirectory(e,t,i)});l.get(panelsOptions.ajaxurl,{action:"so_panels_layouts_query",search:e,page:t,type:i},function(n){if(s.currentTab===i){o.removeClass("so-panels-loading").html(s.directoryTemplate(n));var a=o.find(".so-previous"),r=o.find(".so-next");t<=1?a.addClass("button-disabled"):a.click(function(i){i.preventDefault(),s.displayLayoutDirectory(e,t-1,s.currentTab)}),t===n.max_num_pages||0===n.max_num_pages?r.addClass("button-disabled"):r.click(function(i){i.preventDefault(),s.displayLayoutDirectory(e,t+1,s.currentTab)}),o.find(".so-screenshot").each(function(){var e=l(this),t=e.find(".so-screenshot-wrapper");if(t.css("height",t.width()/4*3+"px").addClass("so-loading"),""!==e.data("src"))var i=l("<img/>").attr("src",e.data("src")).load(function(){t.removeClass("so-loading").css("height","auto"),i.appendTo(t).hide().fadeIn("fast")});else l("<img/>").attr("src",panelsOptions.prebuiltDefaultScreenshot).appendTo(t).hide().fadeIn("fast")}),o.find(".so-directory-browse").html(n.title)}},"json")},directoryItemClickHandler:function(e){var t=this.$(e.target).closest(".so-directory-item");this.$(".so-directory-items").find(".selected").removeClass("selected"),t.addClass("selected"),this.selectedLayoutItem={lid:t.data("layout-id"),type:t.data("layout-type")},this.updateButtonState(!0)},toolbarButtonClick:function(e){if(!this.canAddLayout())return!1;var t=e.data("value");if(_.isUndefined(t))return!1;if(this.updateButtonState(!1),e.hasClass("so-needs-confirm")&&!e.hasClass("so-confirmed")){if(this.updateButtonState(!0),e.hasClass("so-confirming"))return;e.addClass("so-confirming");var i=e.html();return e.html('<span class="dashicons dashicons-yes"></span>'+e.data("confirm")),setTimeout(function(){e.removeClass("so-confirmed").html(i)},2500),setTimeout(function(){e.removeClass("so-confirming"),e.addClass("so-confirmed")},200),!1}this.addingLayout=!0,"import"===this.currentTab?this.addLayoutToBuilder(this.uploadedLayout,t):this.loadSelectedLayout().then(function(e){this.addLayoutToBuilder(e,t)}.bind(this))},canAddLayout:function(){return(this.selectedLayoutItem||this.uploadedLayout)&&!this.addingLayout},loadSelectedLayout:function(){this.setStatusMessage(panelsOptions.loc.prebuilt_loading,!0);var e=_.extend(this.selectedLayoutItem,{action:"so_panels_get_layout"}),t=new l.Deferred;return l.get(panelsOptions.ajaxurl,e,function(e){void 0!==e.error?(alert(e.error),t.reject(e)):(this.setStatusMessage("",!1),t.resolve(e))}.bind(this)),t.promise()},searchHandler:function(e){13===e.keyCode&&this.displayLayoutDirectory(l(e.currentTarget).val(),1,this.currentTab)},updateButtonState:function(e){e=e&&(this.selectedLayoutItem||this.uploadedLayout);var t=this.$(".so-import-layout");t.prop("disabled",!e),e?t.removeClass("disabled"):t.addClass("disabled")},addLayoutToBuilder:function(e,t){this.builder.addHistoryEntry("prebuilt_loaded"),this.builder.model.loadPanelsData(e,t),this.addingLayout=!1,this.closeDialog()}})},{}],8:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=s.view.dialog.extend({cellPreviewTemplate:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-dialog-row-cell-preview").html())),editableLabel:!0,events:{"click .so-close":"closeDialog","click .so-toolbar .so-save":"saveHandler","click .so-toolbar .so-insert":"insertHandler","click .so-toolbar .so-delete":"deleteHandler","click .so-toolbar .so-duplicate":"duplicateHandler","change .row-set-form > *":"setCellsFromForm","click .row-set-form button.set-row":"setCellsFromForm"},dialogIcon:"add-row",dialogClass:"so-panels-dialog-row-edit",styleType:"row",dialogType:"edit",row:{cells:null,style:{}},cellStylesCache:[],initializeDialog:function(){this.on("open_dialog",function(){_.isUndefined(this.model)||_.isEmpty(this.model.get("cells"))?this.setRowModel(null):this.setRowModel(this.model),this.regenerateRowPreview()},this),this.row={cells:new s.collection.cells([{weight:.5},{weight:.5}]),style:{}},this.dialogFormsLoaded=0;var e=this;this.on("form_loaded styles_loaded",function(){2===++this.dialogFormsLoaded&&e.updateModel({refreshArgs:{silent:!0}})}),this.on("close_dialog",this.closeHandler),this.on("edit_label",function(e){if(e!==panelsOptions.loc.row.add&&e!==panelsOptions.loc.row.edit||(e=""),this.model.set("label",e),_.isEmpty(e)){var t="create"===this.dialogType?panelsOptions.loc.row.add:panelsOptions.loc.row.edit;this.$(".so-title").text(t)}}.bind(this))},setRowDialogType:function(e){this.dialogType=e},render:function(){var e="create"===this.dialogType?panelsOptions.loc.row.add:panelsOptions.loc.row.edit;this.renderDialog(this.parseDialogContent(l("#siteorigin-panels-dialog-row").html(),{title:e,dialogType:this.dialogType}));var t=this.$(".so-title");this.model.has("label")&&!_.isEmpty(this.model.get("label"))&&t.text(this.model.get("label")),this.$(".so-edit-title").val(t.text()),this.styles=new s.view.styles,this.styles.model=this.model,this.styles.render("row",this.builder.config.postId,{builderType:this.builder.config.builderType,dialog:this}),this.builder.supports("addRow")||this.$(".so-buttons .so-duplicate").remove(),this.builder.supports("deleteRow")||this.$(".so-buttons .so-delete").remove();var i=this.$(".so-sidebar.so-right-sidebar");return this.styles.attach(i),this.styles.on("styles_loaded",function(e){e?i.removeClass("so-panels-loading"):(i.closest(".so-panels-dialog").removeClass("so-panels-dialog-has-right-sidebar"),i.remove())},this),i.addClass("so-panels-loading"),_.isUndefined(this.model)||this.$("input.so-row-field").val(this.model.get("cells").length),this.$("input.so-row-field").keyup(function(){l(this).trigger("change")}),this},setRowModel:function(e){return this.model=e,_.isEmpty(this.model)?this:(this.row={cells:this.model.get("cells").clone(),style:{}},this.$("input.so-row-field").val(this.model.get("cells").length),this.clearCellStylesCache(),this)},regenerateRowPreview:function(){var e=this,t=this.$(".row-preview"),i=this.getSelectedCellIndex();t.empty();var s;this.row.cells.each(function(o,n){var a=l(this.cellPreviewTemplate({weight:o.get("weight")}));t.append(a),n==i&&a.find(".preview-cell-in").addClass("cell-selected");var r,d=a.prev();d.length&&(r=l('<div class="resize-handle"></div>'),r.appendTo(a).dblclick(function(){var t=e.row.cells.at(n-1),i=o.get("weight")+t.get("weight");o.set("weight",i/2),t.set("weight",i/2),e.scaleRowWidths()}),r.draggable({axis:"x",containment:t,start:function(e,t){var i=a.clone().appendTo(t.helper).css({position:"absolute",top:"0",width:a.outerWidth(),left:6,height:a.outerHeight()});i.find(".resize-handle").remove();var s=d.clone().appendTo(t.helper).css({position:"absolute",top:"0",width:d.outerWidth(),right:6,height:d.outerHeight()});s.find(".resize-handle").remove(),l(this).data({newCellClone:i,prevCellClone:s}),a.find("> .preview-cell-in").css("visibility","hidden"),d.find("> .preview-cell-in").css("visibility","hidden")},drag:function(i,s){var o=e.row.cells.at(n).get("weight"),a=e.row.cells.at(n-1).get("weight"),r=o-(s.position.left+6)/t.width(),d=a+(s.position.left+6)/t.width();s.helper.offset().left,t.offset().left;l(this).data("newCellClone").css("width",t.width()*r).find(".preview-cell-weight").html(Math.round(1e3*r)/10),l(this).data("prevCellClone").css("width",t.width()*d).find(".preview-cell-weight").html(Math.round(1e3*d)/10)},stop:function(i,s){l(this).data("newCellClone").remove(),l(this).data("prevCellClone").remove(),a.find(".preview-cell-in").css("visibility","visible"),d.find(".preview-cell-in").css("visibility","visible");var o=s.position.left+6,r=o/t.width(),c=e.row.cells.at(n),h=e.row.cells.at(n-1);c.get("weight")-r>.02&&h.get("weight")+r>.02&&(c.set("weight",c.get("weight")-r),h.set("weight",h.get("weight")+r)),e.scaleRowWidths(),s.helper.css("left",-6)}})),a.click(function(e){if(l(e.target).is(".preview-cell")||l(e.target).is(".preview-cell-in")){var t=l(e.target);t.closest(".row-preview").find(".preview-cell .preview-cell-in").removeClass("cell-selected"),t.addClass("cell-selected"),this.openSelectedCellStyles()}}.bind(this)),a.find(".preview-cell-weight").click(function(i){e.$(".resize-handle").css("pointer-event","none").draggable("disable"),t.find(".preview-cell-weight").each(function(){var i=jQuery(this).hide();l('<input type="text" class="preview-cell-weight-input no-user-interacted" />').val(parseFloat(i.html())).insertAfter(i).focus(function(){clearTimeout(s)}).keyup(function(e){9!==e.keyCode&&l(this).removeClass("no-user-interacted"),13===e.keyCode&&(e.preventDefault(),l(this).blur())}).keydown(function(e){if(9===e.keyCode){e.preventDefault();var i=t.find(".preview-cell-weight-input"),s=i.index(l(this));s===i.length-1?i.eq(0).focus().select():i.eq(s+1).focus().select()}}).blur(function(){t.find(".preview-cell-weight-input").each(function(t,i){isNaN(parseFloat(l(i).val()))&&l(i).val(Math.floor(1e3*e.row.cells.at(t).get("weight"))/10)}),s=setTimeout(function(){if(0===t.find(".preview-cell-weight-input").length)return!1;var i=[],s=[],o=0,n=0;if(t.find(".preview-cell-weight-input").each(function(t,a){var r=parseFloat(l(a).val());r=isNaN(r)?1/e.row.cells.length:Math.round(10*r)/1e3;var d=!l(a).hasClass("no-user-interacted");i.push(r),s.push(d),d?o+=r:n+=r}),o>0&&n>0&&1-o>0)for(var a=0;a<i.length;a++)s[a]||(i[a]=i[a]/n*(1-o));var r=_.reduce(i,function(e,t){return e+t});i=i.map(function(e){return e/r}),Math.min.apply(Math,i)>.01&&e.row.cells.each(function(e,t){e.set("weight",i[t])}),t.find(".preview-cell").each(function(t,i){var s=e.row.cells.at(t).get("weight");l(i).animate({width:Math.round(1e3*s)/10+"%"},250),l(i).find(".preview-cell-weight-input").val(Math.round(1e3*s)/10)}),t.find(".preview-cell").css("overflow","visible"),setTimeout(function(){e.regenerateRowPreview()},260)},100)}).click(function(){l(this).select()})}),l(this).siblings(".preview-cell-weight-input").select()})},this),this.openSelectedCellStyles(),this.trigger("form_loaded",this)},getSelectedCellIndex:function(){var e=-1;return this.$(".preview-cell .preview-cell-in").each(function(t,i){l(i).is(".cell-selected")&&(e=t)}),e},openSelectedCellStyles:function(){if(!_.isUndefined(this.cellStyles)){if(this.cellStyles.stylesLoaded){var e={};try{e=this.getFormValues(".so-sidebar .so-visual-styles.so-cell-styles").style}catch(e){console.log("Error retrieving cell styles - "+e.message)}this.cellStyles.model.set("style",e)}this.cellStyles.detach()}if(this.cellStyles=this.getSelectedCellStyles(),this.cellStyles){var t=this.$(".so-sidebar.so-right-sidebar");this.cellStyles.attach(t),this.cellStyles.stylesLoaded||(this.cellStyles.on("styles_loaded",function(){t.removeClass("so-panels-loading")},this),t.addClass("so-panels-loading"))}},getSelectedCellStyles:function(){var e=this.getSelectedCellIndex();if(e>-1){var t=this.cellStylesCache[e];t||(t=new s.view.styles,t.model=this.row.cells.at(e),t.render("cell",this.builder.config.postId,{builderType:this.builder.config.builderType,dialog:this,index:e}),this.cellStylesCache[e]=t)}return t},clearCellStylesCache:function(){this.cellStylesCache.forEach(function(e){e.remove()}),this.cellStylesCache=[]},scaleRowWidths:function(){var e=this;this.$(".row-preview .preview-cell").each(function(t,i){var s=e.row.cells.at(t);l(i).css("width",100*s.get("weight")+"%").find(".preview-cell-weight").html(Math.round(1e3*s.get("weight"))/10)})},setCellsFromForm:function(){try{var e={cells:parseInt(this.$('.row-set-form input[name="cells"]').val()),ratio:parseFloat(this.$('.row-set-form select[name="ratio"]').val()),direction:this.$('.row-set-form select[name="ratio_direction"]').val()};_.isNaN(e.cells)&&(e.cells=1),isNaN(e.ratio)&&(e.ratio=1),e.cells<1?(e.cells=1,this.$('.row-set-form input[name="cells"]').val(e.cells)):e.cells>12&&(e.cells=12,this.$('.row-set-form input[name="cells"]').val(e.cells)),this.$('.row-set-form input[name="ratio"]').val(e.ratio);for(var t=[],i=this.row.cells.length!==e.cells,o=1,n=0;n<e.cells;n++)t.push(o),o*=e.ratio;var a=_.reduce(t,function(e,t){return e+t});if(t=_.map(t,function(e){return e/a}),t=_.filter(t,function(e){return e>.01}),"left"===e.direction&&(t=t.reverse()),this.row.cells=new s.collection.cells(this.row.cells.first(t.length)),_.each(t,function(e,t){var i=this.row.cells.at(t);i?i.set("weight",e):(i=new s.model.cell({weight:e,row:this.model}),this.row.cells.add(i))}.bind(this)),i)this.regenerateRowPreview();else{var r=this;this.$(".preview-cell").each(function(e,t){var i=r.row.cells.at(e).get("weight");l(t).animate({width:Math.round(1e3*i)/10+"%"},250),l(t).find(".preview-cell-weight").html(Math.round(1e3*i)/10)}),this.$(".preview-cell").css("overflow","visible"),setTimeout(function(){r.regenerateRowPreview()},260)}}catch(e){console.log("Error setting cells - "+e.message)}this.$(".row-set-form .so-button-row-set").removeClass("button-primary")},tabClickHandler:function(e){"#row-layout"===e.attr("href")?this.$(".so-panels-dialog").addClass("so-panels-dialog-has-right-sidebar"):this.$(".so-panels-dialog").removeClass("so-panels-dialog-has-right-sidebar")},updateModel:function(e){if(e=_.extend({refresh:!0,refreshArgs:null},e),_.isEmpty(this.model)||this.model.setCells(this.row.cells),!_.isUndefined(this.styles)&&this.styles.stylesLoaded){var t={};try{t=this.getFormValues(".so-sidebar .so-visual-styles.so-row-styles").style}catch(e){console.log("Error retrieving row styles - "+e.message)}this.model.set("style",t)}if(!_.isUndefined(this.cellStyles)&&this.cellStyles.stylesLoaded){var t={};try{t=this.getFormValues(".so-sidebar .so-visual-styles.so-cell-styles").style}catch(e){console.log("Error retrieving cell styles - "+e.message)}this.cellStyles.model.set("style",t)}e.refresh&&this.builder.model.refreshPanelsData(e.refreshArgs)},insertHandler:function(){this.builder.addHistoryEntry("row_added"),this.updateModel();var e=this.builder.getActiveCell({createCell:!1}),t={};return null!==e&&(t.at=this.builder.model.get("rows").indexOf(e.row)+1),this.model.collection=this.builder.model.get("rows"),this.builder.model.get("rows").add(this.model,t),this.closeDialog(),this.builder.model.refreshPanelsData(),!1},saveHandler:function(){return this.builder.addHistoryEntry("row_edited"),this.updateModel(),this.closeDialog(),this.builder.model.refreshPanelsData(),!1},deleteHandler:function(){return this.model.trigger("visual_destroy"),this.closeDialog({silent:!0}),!1},duplicateHandler:function(){this.builder.addHistoryEntry("row_duplicated");var e=this.model.clone(this.builder.model);return this.builder.model.get("rows").add(e,{at:this.builder.model.get("rows").indexOf(this.model)+1}),this.closeDialog({silent:!0}),!1},closeHandler:function(){this.clearCellStylesCache(),_.isUndefined(this.cellStyles)||(this.cellStyles=void 0)}})},{}],9:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=s.view.dialog.extend({builder:null,sidebarWidgetTemplate:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-dialog-widget-sidebar-widget").html())),dialogClass:"so-panels-dialog-edit-widget",dialogIcon:"add-widget",widgetView:!1,savingWidget:!1,editableLabel:!0,events:{"click .so-close":"saveHandler","click .so-nav.so-previous":"navToPrevious","click .so-nav.so-next":"navToNext","click .so-toolbar .so-delete":"deleteHandler","click .so-toolbar .so-duplicate":"duplicateHandler"},initializeDialog:function(){var e=this;this.model.on("change:values",this.handleChangeValues,this),this.model.on("destroy",this.remove,this),this.dialogFormsLoaded=0,this.on("form_loaded styles_loaded",function(){2===++this.dialogFormsLoaded&&e.updateModel({refreshArgs:{silent:!0}})}),this.on("edit_label",function(e){e===panelsOptions.widgets[this.model.get("class")].title&&(e=""),this.model.set("label",e),_.isEmpty(e)&&this.$(".so-title").text(this.model.getWidgetField("title"))}.bind(this))},render:function(){this.renderDialog(this.parseDialogContent(l("#siteorigin-panels-dialog-widget").html(),{})),this.loadForm();var e=this.model.getWidgetField("title");this.$(".so-title .widget-name").html(e),this.$(".so-edit-title").val(e),this.builder.supports("addWidget")||this.$(".so-buttons .so-duplicate").remove(),this.builder.supports("deleteWidget")||this.$(".so-buttons .so-delete").remove(),this.styles=new s.view.styles,this.styles.model=this.model,this.styles.render("widget",this.builder.config.postId,{builderType:this.builder.config.builderType,dialog:this});var t=this.$(".so-sidebar.so-right-sidebar");this.styles.attach(t),this.styles.on("styles_loaded",function(e){e?t.removeClass("so-panels-loading"):(t.closest(".so-panels-dialog").removeClass("so-panels-dialog-has-right-sidebar"),t.remove())},this),t.addClass("so-panels-loading")},getPrevDialog:function(){var e=this.builder.$(".so-cells .cell .so-widget");if(e.length<=1)return!1;var t=e.index(this.widgetView.$el);if(0===t)return!1;do{if(widgetView=e.eq(--t).data("view"),!_.isUndefined(widgetView)&&!widgetView.model.get("read_only"))return widgetView.getEditDialog()}while(!_.isUndefined(widgetView)&&t>0);return!1},getNextDialog:function(){var e=this.builder.$(".so-cells .cell .so-widget");if(e.length<=1)return!1;var t,i=e.index(this.widgetView.$el);if(i===e.length-1)return!1;do{if(t=e.eq(++i).data("view"),!_.isUndefined(t)&&!t.model.get("read_only"))return t.getEditDialog()}while(!_.isUndefined(t));return!1},loadForm:function(){if(this.$("> *").length){var e=this;this.$(".so-content").addClass("so-panels-loading");var t={action:"so_panels_widget_form",widget:this.model.get("class"),instance:JSON.stringify(this.model.get("values")),raw:this.model.get("raw")};l.post(panelsOptions.ajaxurl,t,function(t){var i=t.replace(/{\$id}/g,e.model.cid);e.$(".so-content").removeClass("so-panels-loading").html(i),e.trigger("form_loaded",e),e.$(".panel-dialog").trigger("panelsopen"),e.on("close_dialog",e.updateModel,e)},"html")}},updateModel:function(e){if(e=_.extend({refresh:!0,refreshArgs:null},e),this.savingWidget=!0,!this.model.get("missing")){var t=this.getFormValues();_.isUndefined(t.widgets)?t={}:(t=t.widgets,t=t[Object.keys(t)[0]]),this.model.setValues(t),this.model.set("raw",!0)}if(this.styles.stylesLoaded){var i={};try{i=this.getFormValues(".so-sidebar .so-visual-styles").style}catch(e){}this.model.set("style",i)}this.savingWidget=!1,e.refresh&&this.builder.model.refreshPanelsData(e.refreshArgs)},handleChangeValues:function(){this.savingWidget||this.loadForm()},saveHandler:function(){this.builder.addHistoryEntry("widget_edited"),this.closeDialog()},deleteHandler:function(){return this.model.trigger("visual_destroy"),this.closeDialog({silent:!0}),this.builder.model.refreshPanelsData(),!1},duplicateHandler:function(){return this.model.trigger("user_duplicate"),this.closeDialog({silent:!0}),this.builder.model.refreshPanelsData(),!1}})},{}],10:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=s.view.dialog.extend({builder:null,widgetTemplate:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-dialog-widgets-widget").html())),filter:{},dialogClass:"so-panels-dialog-add-widget",dialogIcon:"add-widget",events:{"click .so-close":"closeDialog","click .widget-type":"widgetClickHandler","keyup .so-sidebar-search":"searchHandler"},initializeDialog:function(){this.on("open_dialog",function(){this.filter.search="",this.filterWidgets(this.filter)},this),this.on("open_dialog_complete",function(){this.$(".so-sidebar-search").val("").focus(),this.balanceWidgetHeights()}),this.on("tab_click",this.tabClickHandler,this)},render:function(){this.renderDialog(this.parseDialogContent(l("#siteorigin-panels-dialog-widgets").html(),{})),_.each(panelsOptions.widgets,function(e){var t=l(this.widgetTemplate({title:e.title,description:e.description}));_.isUndefined(e.icon)&&(e.icon="dashicons dashicons-admin-generic"),l('<span class="widget-icon" />').addClass(e.icon).prependTo(t.find(".widget-type-wrapper")),t.data("class",e.class).appendTo(this.$(".widget-type-list"))},this);var e=this.$(".so-sidebar-tabs");_.each(panelsOptions.widget_dialog_tabs,function(t){l(this.dialogTabTemplate({title:t.title})).data({message:t.message,filter:t.filter}).appendTo(e)},this),this.initTabs();var t=this;l(window).resize(function(){t.balanceWidgetHeights()})},tabClickHandler:function(e){this.filter=e.parent().data("filter"),this.filter.search=this.$(".so-sidebar-search").val();var t=e.parent().data("message");return _.isEmpty(t)&&(t=""),this.$(".so-toolbar .so-status").html(t),this.filterWidgets(this.filter),!1},searchHandler:function(e){if(13===e.which){var t=this.$(".widget-type-list .widget-type:visible");1===t.length&&t.click()}else this.filter.search=l(e.target).val().trim(),this.filterWidgets(this.filter)},filterWidgets:function(e){_.isUndefined(e)&&(e={}),_.isUndefined(e.groups)&&(e.groups=""),this.$(".widget-type-list .widget-type").each(function(){var t,i=l(this),s=i.data("class"),o=_.isUndefined(panelsOptions.widgets[s])?null:panelsOptions.widgets[s];t=!!_.isEmpty(e.groups)||null!==o&&!_.isEmpty(_.intersection(e.groups,panelsOptions.widgets[s].groups)),t&&(_.isUndefined(e.search)||""===e.search||-1===o.title.toLowerCase().indexOf(e.search.toLowerCase())&&(t=!1)),t?i.show():i.hide()}),this.balanceWidgetHeights()},widgetClickHandler:function(e){this.builder.addHistoryEntry("widget_added");var t=l(e.currentTarget),i=new s.model.widget({class:t.data("class")});i.cell=this.builder.getActiveCell(),i.cell.get("widgets").add(i),this.closeDialog(),this.builder.model.refreshPanelsData()},balanceWidgetHeights:function(e){var t=[[]],i=null,s=Math.round(this.$(".widget-type").parent().width()/this.$(".widget-type").width());this.$(".widget-type").css("clear","none").filter(":visible").each(function(e,t){e%s==0&&0!==e&&l(t).css("clear","both")}),this.$(".widget-type-wrapper").css("height","auto").filter(":visible").each(function(e,s){var o=l(s);null!==i&&i.position().top!==o.position().top&&(t[t.length]=[]),i=o,t[t.length-1].push(o)}),_.each(t,function(e,t){var i=_.max(e.map(function(e){return e.height()}));_.each(e,function(e){e.height(i)})})}})},{}],11:[function(e,t,i){t.exports={canCopyPaste:function(){return"undefined"!=typeof Storage&&panelsOptions.user},setModel:function(e){if(!this.canCopyPaste())return!1;var t=panels.helpers.serialize.serialize(e)
2
- ;return e instanceof panels.model.row?t.thingType="row-model":e instanceof panels.model.widget&&(t.thingType="widget-model"),localStorage["panels_clipboard_"+panelsOptions.user]=JSON.stringify(t),!0},isModel:function(e){if(!this.canCopyPaste())return!1;var t=localStorage["panels_clipboard_"+panelsOptions.user];return void 0!==t&&(t=JSON.parse(t),t.thingType&&t.thingType===e)},getModel:function(e){if(!this.canCopyPaste())return null;var t=localStorage["panels_clipboard_"+panelsOptions.user];return void 0!==t&&(t=JSON.parse(t),t.thingType&&t.thingType===e)?panels.helpers.serialize.unserialize(t,t.thingType,null):null}}},{}],12:[function(e,t,i){t.exports={lock:function(){if("hidden"!==jQuery("body").css("overflow")){var e=[self.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,self.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop];jQuery("body").data({"scroll-position":e}).css("overflow","hidden"),_.isUndefined(e)||window.scrollTo(e[0],e[1])}},unlock:function(){if("hidden"===jQuery("body").css("overflow")&&!jQuery(".so-panels-dialog-wrapper").is(":visible")&&!jQuery(".so-panels-live-editor").is(":visible")){jQuery("body").css("overflow","visible");var e=jQuery("body").data("scroll-position");_.isUndefined(e)||window.scrollTo(e[0],e[1])}}}},{}],13:[function(e,t,i){t.exports={serialize:function(e){var t;if(e instanceof Backbone.Model){var i={};for(var s in e.attributes)if(e.attributes.hasOwnProperty(s)){if("builder"===s||"collection"===s)continue;t=e.attributes[s],t instanceof Backbone.Model||t instanceof Backbone.Collection?i[s]=this.serialize(t):i[s]=t}return i}if(e instanceof Backbone.Collection){for(var l=[],o=0;o<e.models.length;o++)t=e.models[o],t instanceof Backbone.Model||t instanceof Backbone.Collection?l.push(this.serialize(t)):l.push(t);return l}},unserialize:function(e,t,i){var s;switch(t){case"row-model":s=new panels.model.row,s.builder=i,s.set("style",e.style),s.setCells(this.unserialize(e.cells,"cell-collection",s));break;case"cell-model":s=new panels.model.cell,s.row=i,s.set("weight",e.weight),s.set("style",e.style),s.set("widgets",this.unserialize(e.widgets,"widget-collection",s));break;case"widget-model":s=new panels.model.widget,s.cell=i;for(var l in e)e.hasOwnProperty(l)&&s.set(l,e[l]);s.set("widget_id",panels.helpers.utils.generateUUID());break;case"cell-collection":s=new panels.collection.cells;for(var o=0;o<e.length;o++)s.push(this.unserialize(e[o],"cell-model",i));break;case"widget-collection":s=new panels.collection.widgets;for(var o=0;o<e.length;o++)s.push(this.unserialize(e[o],"widget-model",i));break;default:console.log("Unknown Thing - "+t)}return s}}},{}],14:[function(e,t,i){t.exports={generateUUID:function(){var e=(new Date).getTime();return window.performance&&"function"==typeof window.performance.now&&(e+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var i=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"==t?i:3&i|8).toString(16)})},processTemplate:function(e){return e=e.replace(/{{%/g,"<%"),e=e.replace(/%}}/g,"%>"),e=e.trim()},selectElementContents:function(e){var t=document.createRange();t.selectNodeContents(e);var i=window.getSelection();i.removeAllRanges(),i.addRange(t)}}},{}],15:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=function(e){return this.each(function(){var t=jQuery(this),i=t.closest("form").find(".widget-id").val(),o=l.extend(!0,{},e);if(_.isUndefined(i)||!(i.indexOf("__i__")>-1)){var n=new s.model.builder,a=new s.view.builder({model:n,config:o}),r=t.closest(".so-panels-dialog-wrapper").data("view");_.isUndefined(r)||(r.on("close_dialog",function(){n.refreshPanelsData()}),r.on("open_dialog_complete",function(){a.trigger("builder_resize")}),r.model.on("destroy",function(){n.emptyRows().destroy()}),a.setDialogParents(panelsOptions.loc.layout_widget,r));var d=Boolean(t.closest(".widget-content").length);a.render().attach({container:t,dialog:d||"dialog"===t.data("mode"),type:t.data("type")}).setDataField(t.find("input.panels-data")),d||"dialog"===t.data("mode")?(a.setDialogParents(panelsOptions.loc.layout_widget,a.dialog),t.find(".siteorigin-panels-display-builder").click(function(e){e.preventDefault(),a.dialog.openDialog()})):t.find(".siteorigin-panels-display-builder").parent().remove(),l(document).trigger("panels_setup",a)}})}},{}],16:[function(e,t,i){var s={};window.panels=s,window.siteoriginPanels=s,s.helpers={},s.helpers.clipboard=e("./helpers/clipboard"),s.helpers.utils=e("./helpers/utils"),s.helpers.serialize=e("./helpers/serialize"),s.helpers.pageScroll=e("./helpers/page-scroll"),s.model={},s.model.widget=e("./model/widget"),s.model.cell=e("./model/cell"),s.model.row=e("./model/row"),s.model.builder=e("./model/builder"),s.model.historyEntry=e("./model/history-entry"),s.collection={},s.collection.widgets=e("./collection/widgets"),s.collection.cells=e("./collection/cells"),s.collection.rows=e("./collection/rows"),s.collection.historyEntries=e("./collection/history-entries"),s.view={},s.view.widget=e("./view/widget"),s.view.cell=e("./view/cell"),s.view.row=e("./view/row"),s.view.builder=e("./view/builder"),s.view.dialog=e("./view/dialog"),s.view.styles=e("./view/styles"),s.view.liveEditor=e("./view/live-editor"),s.dialog={},s.dialog.builder=e("./dialog/builder"),s.dialog.widgets=e("./dialog/widgets"),s.dialog.widget=e("./dialog/widget"),s.dialog.prebuilt=e("./dialog/prebuilt"),s.dialog.row=e("./dialog/row"),s.dialog.history=e("./dialog/history"),s.utils={},s.utils.menu=e("./utils/menu"),jQuery.fn.soPanelsSetupBuilderWidget=e("./jquery/setup-builder-widget"),jQuery(function(e){var t,i,s,l;if(e("#siteorigin-panels-metabox").length&&e("form#post").length)t=e("#siteorigin-panels-metabox"),i=e("#siteorigin-panels-metabox .siteorigin-panels-data-field"),s=e("form#post"),l={editorType:"tinyMCE",postId:e("#post_ID").val(),editorId:"#content",builderType:e("#siteorigin-panels-metabox").data("builder-type"),builderSupports:e("#siteorigin-panels-metabox").data("builder-supports"),loadOnAttach:panelsOptions.loadOnAttach&&1==e("#auto_draft").val(),loadLiveEditor:1==e("#siteorigin-panels-metabox").data("live-editor"),liveEditorPreview:t.data("preview-url")};else if(e(".siteorigin-panels-builder-form").length){var o=e(".siteorigin-panels-builder-form");t=o.find(".siteorigin-panels-builder-container"),i=o.find('input[name="panels_data"]'),s=o,l={editorType:"standalone",postId:o.data("post-id"),editorId:"#post_content",builderType:o.data("type"),builderSupports:o.data("builder-supports"),loadLiveEditor:!1,liveEditorPreview:o.data("preview-url")}}if(!_.isUndefined(t)){var n=window.siteoriginPanels,a=new n.model.builder,r=new n.view.builder({model:a,config:l});r.render().attach({container:t}).setDataField(i).attachToEditor(),s.submit(function(){a.refreshPanelsData()}),t.removeClass("so-panels-loading"),e(document).trigger("panels_setup",r,window.panels)}e(document).on("widget-added",function(t,i){e(i).find(".siteorigin-page-builder-widget").soPanelsSetupBuilderWidget()}),e("body").hasClass("wp-customizer")||e(function(){e(".siteorigin-page-builder-widget").soPanelsSetupBuilderWidget()})})},{"./collection/cells":1,"./collection/history-entries":2,"./collection/rows":3,"./collection/widgets":4,"./dialog/builder":5,"./dialog/history":6,"./dialog/prebuilt":7,"./dialog/row":8,"./dialog/widget":9,"./dialog/widgets":10,"./helpers/clipboard":11,"./helpers/page-scroll":12,"./helpers/serialize":13,"./helpers/utils":14,"./jquery/setup-builder-widget":15,"./model/builder":17,"./model/cell":18,"./model/history-entry":19,"./model/row":20,"./model/widget":21,"./utils/menu":22,"./view/builder":23,"./view/cell":24,"./view/dialog":25,"./view/live-editor":26,"./view/row":27,"./view/styles":28,"./view/widget":29}],17:[function(e,t,i){t.exports=Backbone.Model.extend({layoutPosition:{BEFORE:"before",AFTER:"after",REPLACE:"replace"},rows:{},defaults:{data:{widgets:[],grids:[],grid_cells:[]}},initialize:function(){this.set("rows",new panels.collection.rows)},addRow:function(e,t,i){i=_.extend({noAnimate:!1},i);var s=new panels.collection.cells(t);e=_.extend({collection:this.get("rows"),cells:s},e);var l=new panels.model.row(e);return l.builder=this,this.get("rows").add(l,i),l},loadPanelsData:function(e,t){try{t===this.layoutPosition.BEFORE?e=this.concatPanelsData(e,this.getPanelsData()):t===this.layoutPosition.AFTER&&(e=this.concatPanelsData(this.getPanelsData(),e)),this.emptyRows(),this.set("data",JSON.parse(JSON.stringify(e)),{silent:!0});var i=[];if(_.isUndefined(e.grid_cells))return void this.trigger("load_panels_data");for(var s,l=0;l<e.grid_cells.length;l++)s=parseInt(e.grid_cells[l].grid),_.isUndefined(i[s])&&(i[s]=[]),i[s].push(e.grid_cells[l]);var o=this;if(_.each(i,function(t,i){var s={};_.isUndefined(e.grids[i].style)||(s.style=e.grids[i].style),_.isUndefined(e.grids[i].color_label)||(s.color_label=e.grids[i].color_label),_.isUndefined(e.grids[i].label)||(s.label=e.grids[i].label),o.addRow(s,t,{noAnimate:!0})}),_.isUndefined(e.widgets))return;_.each(e.widgets,function(e){var t=null;_.isUndefined(e.panels_info)?(t=e.info,delete e.info):(t=e.panels_info,delete e.panels_info);var i=o.get("rows").at(parseInt(t.grid)),s=i.get("cells").at(parseInt(t.cell)),l=new panels.model.widget({class:t.class,values:e});_.isUndefined(t.style)||l.set("style",t.style),_.isUndefined(t.read_only)||l.set("read_only",t.read_only),_.isUndefined(t.widget_id)?l.set("widget_id",panels.helpers.utils.generateUUID()):l.set("widget_id",t.widget_id),_.isUndefined(t.label)||l.set("label",t.label),l.cell=s,s.get("widgets").add(l,{noAnimate:!0})}),this.trigger("load_panels_data")}catch(e){console.log("Error loading data: "+e.message)}},concatPanelsData:function(e,t){if(_.isUndefined(t)||_.isUndefined(t.grids)||_.isEmpty(t.grids)||_.isUndefined(t.grid_cells)||_.isEmpty(t.grid_cells))return e;if(_.isUndefined(e)||_.isUndefined(e.grids)||_.isEmpty(e.grids))return t;var i=e.grids.length,s=_.isUndefined(e.widgets)?0:e.widgets.length,l={grids:[],grid_cells:[],widgets:[]};l.grids=e.grids.concat(t.grids),_.isUndefined(e.grid_cells)||(l.grid_cells=e.grid_cells.slice()),_.isUndefined(e.widgets)||(l.widgets=e.widgets.slice());var o;for(o=0;o<t.grid_cells.length;o++){var n=t.grid_cells[o];n.grid=parseInt(n.grid)+i,l.grid_cells.push(n)}if(!_.isUndefined(t.widgets))for(o=0;o<t.widgets.length;o++){var a=t.widgets[o];a.panels_info.grid=parseInt(a.panels_info.grid)+i,a.panels_info.id=parseInt(a.panels_info.id)+s,l.widgets.push(a)}return l},getPanelsData:function(){var e={widgets:[],grids:[],grid_cells:[]},t=0;return this.get("rows").each(function(i,s){i.get("cells").each(function(i,l){i.get("widgets").each(function(i,o){var n={class:i.get("class"),raw:i.get("raw"),grid:s,cell:l,id:t++,widget_id:i.get("widget_id"),style:i.get("style"),label:i.get("label")};_.isEmpty(n.widget_id)&&(n.widget_id=panels.helpers.utils.generateUUID());var a=_.extend(_.clone(i.get("values")),{panels_info:n});e.widgets.push(a)}),e.grid_cells.push({grid:s,index:l,weight:i.get("weight"),style:i.get("style")})}),e.grids.push({cells:i.get("cells").length,style:i.get("style"),color_label:i.get("color_label"),label:i.get("label")})}),e},refreshPanelsData:function(e){e=_.extend({silent:!1},e);var t=this.get("data"),i=this.getPanelsData();this.set("data",i,{silent:!0}),e.silent||JSON.stringify(i)===JSON.stringify(t)||(this.trigger("change"),this.trigger("change:data"),this.trigger("refresh_panels_data",i,e))},emptyRows:function(){return _.invoke(this.get("rows").toArray(),"destroy"),this.get("rows").reset(),this},isValidLayoutPosition:function(e){return e===this.layoutPosition.BEFORE||e===this.layoutPosition.AFTER||e===this.layoutPosition.REPLACE},getPanelsDataFromHtml:function(e,t){var i=this,s=jQuery('<div id="wrapper">'+e+"</div>");if(s.find(".panel-layout .panel-grid").length){var l={grids:[],grid_cells:[],widgets:[]},o=new RegExp(panelsOptions.siteoriginWidgetRegex,"i"),n=function(){function e(e){return e&&"string"==typeof e&&(e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,""),e=e.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim,""),t.innerHTML=e,e=t.textContent,t.textContent=""),e}var t=document.createElement("div");return e}(),a=function(e){var t=e.find("div");if(!t.length)return e.html();var i;for(i=0;i<t.length-1&&jQuery.trim(t.eq(i).text())==jQuery.trim(t.eq(i+1).text());i++);var s=t.eq(i).find(".widget-title:header"),l="";return s.length&&(l=s.html(),s.remove()),{title:l,text:t.eq(i).html()}},r=s.find(".panel-layout").eq(0),d=function(e,t){return jQuery(t).closest(".panel-layout").is(r)};return s.find("> .panel-layout > .panel-grid").filter(d).each(function(e,s){var r=jQuery(s),c=r.find(".panel-grid-cell").filter(d);l.grids.push({cells:c.length,style:r.data("style"),color_label:r.data("color-label"),label:r.data("label")}),c.each(function(s,r){var c=jQuery(r),h=c.find(".so-panel").filter(d);l.grid_cells.push({grid:e,weight:_.isUndefined(c.data("weight"))?1:parseFloat(c.data("weight")),style:c.data("style")}),h.each(function(r,d){var c=jQuery(d),h=c.find(".panel-widget-style").length?c.find(".panel-widget-style").html():c.html(),u={grid:e,cell:s,raw:!1,label:c.data("label")};h=h.trim();var p=o.exec(h);if(!_.isNull(p)&&""===h.replace(o,"").trim()){try{var g=/class="(.*?)"/.exec(p[3]),f=jQuery(p[5]),w=JSON.parse(n(f.val())),m=w.instance;u.class=g[1].replace(/\\\\+/g,"\\"),u.raw=!1,m.panels_info=u,l.widgets.push(m)}catch(e){u.class=t,l.widgets.push(_.extend(a(c),{filter:"1",type:"visual",panels_info:u}))}return!0}if(-1!==h.indexOf("panel-layout")){if(jQuery("<div>"+h+"</div>").find(".panel-layout .panel-grid").length)return u.class="SiteOrigin_Panels_Widgets_Layout",l.widgets.push({panels_data:i.getPanelsDataFromHtml(h,t),panels_info:u}),!0}return u.class=t,l.widgets.push(_.extend(a(c),{filter:"1",type:"visual",panels_info:u})),!0})})}),s.find(".panel-layout").remove(),s.find("style[data-panels-style-for-post]").remove(),s.html().replace(/^\s+|\s+$/gm,"").length&&(l.grids.push({cells:1,style:{}}),l.grid_cells.push({grid:l.grids.length-1,weight:1}),l.widgets.push({filter:"1",text:s.html().replace(/^\s+|\s+$/gm,""),title:"",type:"visual",panels_info:{class:t,raw:!1,grid:l.grids.length-1,cell:0}})),l}return{grid_cells:[{grid:0,weight:1}],grids:[{cells:1}],widgets:[{filter:"1",text:e,title:"",type:"visual",panels_info:{class:t,raw:!1,grid:0,cell:0}}]}}})},{}],18:[function(e,t,i){t.exports=Backbone.Model.extend({widgets:{},row:null,defaults:{weight:0,style:{}},indexes:null,initialize:function(){this.set("widgets",new panels.collection.widgets),this.on("destroy",this.onDestroy,this)},onDestroy:function(){_.invoke(this.get("widgets").toArray(),"destroy"),this.get("widgets").reset()},clone:function(e,t){_.isUndefined(e)&&(e=this.row),t=_.extend({cloneWidgets:!0},t);var i=new this.constructor(this.attributes);return i.set("collection",e.get("cells"),{silent:!0}),i.row=e,t.cloneWidgets&&this.get("widgets").each(function(e){i.get("widgets").add(e.clone(i,t),{silent:!0})}),i}})},{}],19:[function(e,t,i){t.exports=Backbone.Model.extend({defaults:{text:"",data:"",time:null,count:1}})},{}],20:[function(e,t,i){t.exports=Backbone.Model.extend({builder:null,defaults:{style:{}},indexes:null,initialize:function(){_.isEmpty(this.get("cells"))?this.set("cells",new panels.collection.cells):this.get("cells").each(function(e){e.row=this}.bind(this)),this.on("destroy",this.onDestroy,this)},setCells:function(e){var t=this.get("cells")||new panels.collection.cells,i=[];t.each(function(s,l){var o=e.at(l);if(o)s.set("weight",o.get("weight"));else{for(var n=t.at(e.length-1),a=s.get("widgets").models.slice(),r=0;r<a.length;r++)a[r].moveToCell(n,{silent:!1});i.push(s)}}),_.each(i,function(e){t.remove(e)}),e.length>t.length&&_.each(e.slice(t.length,e.length),function(e){e.set({collection:t}),e.row=this,t.add(e)}.bind(this)),this.reweightCells()},reweightCells:function(){var e=0,t=this.get("cells");t.each(function(t){e+=t.get("weight")}),t.each(function(t){t.set("weight",t.get("weight")/e)}),this.trigger("reweight_cells")},onDestroy:function(){_.invoke(this.get("cells").toArray(),"destroy"),this.get("cells").reset()},clone:function(e){_.isUndefined(e)&&(e=this.builder);var t=new this.constructor(this.attributes);t.set("collection",e.get("rows"),{silent:!0}),t.builder=e;var i=new panels.collection.cells;return this.get("cells").each(function(e){i.add(e.clone(t),{silent:!0})}),t.set("cells",i),t}})},{}],21:[function(e,t,i){t.exports=Backbone.Model.extend({cell:null,defaults:{class:null,missing:!1,values:{},raw:!1,style:{},read_only:!1,widget_id:""},indexes:null,initialize:function(){var e=this.get("class");!_.isUndefined(panelsOptions.widgets[e])&&panelsOptions.widgets[e].installed||this.set("missing",!0)},getWidgetField:function(e){return _.isUndefined(panelsOptions.widgets[this.get("class")])?"title"===e||"description"===e?panelsOptions.loc.missing_widget[e]:"":this.has("label")&&!_.isEmpty(this.get("label"))?this.get("label"):panelsOptions.widgets[this.get("class")][e]},moveToCell:function(e,t,i){return t=_.extend({silent:!0},t),this.cell=e,this.collection.remove(this,t),e.get("widgets").add(this,_.extend({at:i},t)),this.trigger("move_to_cell",e,i),this},triggerEdit:function(){this.trigger("user_edit",this)},triggerDuplicate:function(){this.trigger("user_duplicate",this)},setValues:function(e){var t=!1;JSON.stringify(e)!==JSON.stringify(this.get("values"))&&(t=!0),this.set("values",e,{silent:!0}),t&&(this.trigger("change",this),this.trigger("change:values"))},clone:function(e,t){_.isUndefined(e)&&(e=this.cell);var i=new this.constructor(this.attributes),s=JSON.parse(JSON.stringify(this.get("values"))),l=function(e){return _.each(e,function(t,i){_.isString(i)&&"_"===i[0]?delete e[i]:_.isObject(e[i])&&l(e[i])}),e};return s=l(s),"SiteOrigin_Panels_Widgets_Layout"===this.get("class")&&(s.builder_id=Math.random().toString(36).substr(2)),i.set("values",s,{silent:!0}),i.set("collection",e.get("widgets"),{silent:!0}),i.cell=e,i.isDuplicate=!0,i},getTitle:function(){var e=panelsOptions.widgets[this.get("class")];if(_.isUndefined(e))return this.get("class").replace(/_/g," ");if(!_.isUndefined(e.panels_title)&&!1===e.panels_title)return panelsOptions.widgets[this.get("class")].description;var t=this.get("values"),i=["title","text"];for(var s in t)t.hasOwnProperty(s)&&i.push(s);i=_.uniq(i);for(var l in i)if(!_.isUndefined(t[i[l]])&&_.isString(t[i[l]])&&""!==t[i[l]]&&"on"!==t[i[l]]&&"_"!==i[l][0]&&!jQuery.isNumeric(t[i[l]])){var o=t[i[l]];o=o.replace(/<\/?[^>]+(>|$)/g,"");var n=o.split(" ");return n=n.slice(0,20),n.join(" ")}return this.getWidgetField("description")}})},{}],22:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=Backbone.View.extend({wrapperTemplate:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-context-menu").html())),sectionTemplate:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-context-menu-section").html())),contexts:[],active:!1,events:{"keyup .so-search-wrapper input":"searchKeyUp"},initialize:function(){this.listenContextMenu(),this.render(),this.attach()},listenContextMenu:function(){var e=this;l(window).on("contextmenu",function(t){return e.active&&!e.isOverEl(e.$el,t)?(e.closeMenu(),e.active=!1,t.preventDefault(),!1):!!e.active||(e.active=!1,e.trigger("activate_context",t,e),void(e.active&&(t.preventDefault(),e.openMenu({left:t.pageX,top:t.pageY}))))})},render:function(){this.setElement(this.wrapperTemplate())},attach:function(){this.$el.appendTo("body")},openMenu:function(e){this.trigger("open_menu"),l(window).on("keyup",{menu:this},this.keyboardListen),l(window).on("click",{menu:this},this.clickOutsideListen),this.$el.css("max-height",l(window).height()-20),e.left+this.$el.outerWidth()+10>=l(window).width()&&(e.left=l(window).width()-this.$el.outerWidth()-10),e.left<=0&&(e.left=10),e.top+this.$el.outerHeight()-l(window).scrollTop()+10>=l(window).height()&&(e.top=l(window).height()+l(window).scrollTop()-this.$el.outerHeight()-10),e.left<=0&&(e.left=10),this.$el.css({left:e.left+1,top:e.top+1}).show(),this.$(".so-search-wrapper input").focus()},closeMenu:function(){this.trigger("close_menu"),l(window).off("keyup",this.keyboardListen),l(window).off("click",this.clickOutsideListen),this.active=!1,this.$el.empty().hide()},keyboardListen:function(e){var t=e.data.menu;switch(e.which){case 27:t.closeMenu()}},clickOutsideListen:function(e){var t=e.data.menu;3!==e.which&&t.$el.is(":visible")&&!t.isOverEl(t.$el,e)&&t.closeMenu()},addSection:function(e,t,i,s){var o=this;t=_.extend({display:5,defaultDisplay:!1,search:!0,sectionTitle:"",searchPlaceholder:"",titleKey:"title"},t);var n=l(this.sectionTemplate({settings:t,items:i})).attr("id","panels-menu-section-"+e);this.$el.append(n),n.find(".so-item:not(.so-confirm)").click(function(){var e=l(this);s(e.data("key")),o.closeMenu()}),n.find(".so-item.so-confirm").click(function(){var e=l(this);if(e.hasClass("so-confirming"))return s(e.data("key")),void o.closeMenu();e.data("original-text",e.html()).addClass("so-confirming").html('<span class="dashicons dashicons-yes"></span> '+panelsOptions.loc.dropdown_confirm),setTimeout(function(){e.removeClass("so-confirming"),e.html(e.data("original-text"))},2500)}),n.data("settings",t).find(".so-search-wrapper input").trigger("keyup"),this.active=!0},hasSection:function(e){return this.$el.find("#panels-menu-section-"+e).length>0},searchKeyUp:function(e){var t=l(e.currentTarget),i=t.closest(".so-section"),s=i.data("settings");if(38===e.which||40===e.which){var o=i.find("ul li:visible"),n=o.filter(".so-active").eq(0);if(n.length){o.removeClass("so-active");var a=o.index(n);38===e.which?n=a-1<0?o.last():o.eq(a-1):40===e.which&&(n=a+1>=o.length?o.first():o.eq(a+1))}else 38===e.which?n=o.last():40===e.which&&(n=o.first());return n.addClass("so-active"),!1}if(13===e.which)return 1===i.find("ul li:visible").length?(i.find("ul li:visible").trigger("click"),!1):(i.find("ul li.so-active:visible").trigger("click"),!1);if(""===t.val())if(s.defaultDisplay){i.find(".so-item").hide();for(var r=0;r<s.defaultDisplay.length;r++)i.find('.so-item[data-key="'+s.defaultDisplay[r]+'"]').show()}else i.find(".so-item").show();else i.find(".so-item").hide().each(function(){var e=l(this);-1!==e.html().toLowerCase().indexOf(t.val().toLowerCase())&&e.show()});i.find(".so-item:visible:gt("+(s.display-1)+")").hide(),0===i.find(".so-item:visible").length&&""!==t.val()?i.find(".so-no-results").show():i.find(".so-no-results").hide()},isOverEl:function(e,t){var i=[[e.offset().left,e.offset().top],[e.offset().left+e.outerWidth(),e.offset().top+e.outerHeight()]];return t.pageX>=i[0][0]&&t.pageX<=i[1][0]&&t.pageY>=i[0][1]&&t.pageY<=i[1][1]}})},{}],23:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=Backbone.View.extend({config:{},template:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-builder").html())),dialogs:{},rowsSortable:null,dataField:!1,currentData:"",attachedToEditor:!1,attachedVisible:!1,liveEditor:void 0,menu:!1,activeCell:null,events:{"click .so-tool-button.so-widget-add":"displayAddWidgetDialog","click .so-tool-button.so-row-add":"displayAddRowDialog","click .so-tool-button.so-prebuilt-add":"displayAddPrebuiltDialog","click .so-tool-button.so-history":"displayHistoryDialog","click .so-tool-button.so-live-editor":"displayLiveEditor"},rows:null,initialize:function(e){var t=this;return this.config=_.extend({loadLiveEditor:!1,builderSupports:{}},e.config),this.config.builderSupports=_.extend({addRow:!0,editRow:!0,deleteRow:!0,moveRow:!0,addWidget:!0,editWidget:!0,deleteWidget:!0,moveWidget:!0,prebuilt:!0,history:!0,liveEditor:!0,revertToEditor:!0},this.config.builderSupports),e.config.loadLiveEditor&&this.on("builder_live_editor_added",function(){this.displayLiveEditor()}),this.dialogs={widgets:new s.dialog.widgets,row:new s.dialog.row,prebuilt:new s.dialog.prebuilt},_.each(this.dialogs,function(e,i,s){s[i].setBuilder(t)}),this.dialogs.row.setRowDialogType("create"),this.model.get("rows").on("add",this.onAddRow,this),l(window).resize(function(e){e.target===window&&t.trigger("builder_resize")}),this.model.on("change:data load_panels_data",this.storeModelData,this),this.on("content_change",this.handleContentChange,this),this.on("display_builder",this.handleDisplayBuilder,this),this.on("hide_builder",this.handleHideBuilder,this),this.on("builder_rendered builder_resize",this.handleBuilderSizing,this),this.model.on("change:data load_panels_data",this.toggleWelcomeDisplay,this),this.on("display_builder",this.wrapEditorExpandAdjust,this),this.menu=new s.utils.menu({}),this.menu.on("activate_context",this.activateContextMenu,this),this.config.loadOnAttach&&this.on("builder_attached_to_editor",function(){this.displayAttachedBuilder({confirm:!1})},this),this},render:function(){return this.setElement(this.template()),this.$el.attr("id","siteorigin-panels-builder-"+this.cid).addClass("so-builder-container"),this.trigger("builder_rendered"),this},attach:function(e){e=_.extend({container:!1,dialog:!1},e),e.dialog?(this.dialog=new s.dialog.builder,this.dialog.builder=this):(this.$el.appendTo(e.container),this.metabox=e.container.closest(".postbox"),this.initSortable(),this.trigger("attached_to_container",e.container)),this.trigger("builder_attached"),this.supports("liveEditor")&&this.addLiveEditor(),this.supports("history")&&this.addHistoryBrowser();var t=this.$(".so-builder-toolbar");return this.supports("addWidget")||t.find(".so-widget-add").hide(),this.supports("addRow")||t.find(".so-row-add").hide(),this.supports("prebuilt")||t.find(".so-prebuilt-add").hide(),this},attachToEditor:function(){if("tinyMCE"!==this.config.editorType)return this;this.attachedToEditor=!0;var e=this.metabox,t=this;l("#wp-content-wrap .wp-editor-tabs").find(".wp-switch-editor").click(function(e){e.preventDefault(),l("#wp-content-editor-container").show(),l("#wp-content-wrap").removeClass("panels-active"),l("#content-resize-handle").show(),t.trigger("hide_builder")}).end().append(l('<a id="content-panels" class="hide-if-no-js wp-switch-editor switch-panels">'+e.find(".hndle span").html()+"</a>").click(function(e){t.displayAttachedBuilder({confirm:!0})&&e.preventDefault()})),this.supports("revertToEditor")&&e.find(".so-switch-to-standard").click(function(i){i.preventDefault(),confirm(panelsOptions.loc.confirm_stop_builder)&&(t.addHistoryEntry("back_to_editor"),t.model.loadPanelsData(!1),l("#wp-content-wrap").show(),e.hide(),l(window).resize(),t.attachedVisible=!1,t.trigger("hide_builder"))}).show(),e.insertAfter("#wp-content-wrap").hide().addClass("attached-to-editor");var i=this.model.get("data");_.isEmpty(i.widgets)&&_.isEmpty(i.grids)||this.displayAttachedBuilder({confirm:!1});var s=function(){var e=t.$(".so-builder-toolbar");if(t.$el.hasClass("so-display-narrow"))return e.css({top:0,left:0,width:"100%",position:"absolute"}),void t.$el.css("padding-top",e.outerHeight());var i=l(window).scrollTop()-t.$el.offset().top;"fixed"===l("#wpadminbar").css("position")&&(i+=l("#wpadminbar").outerHeight());var s={top:0,bottom:t.$el.outerHeight()-e.outerHeight()+20};i>s.top&&i<s.bottom?"fixed"!==e.css("position")&&e.css({top:l("#wpadminbar").outerHeight(),left:t.$el.offset().left,width:t.$el.outerWidth(),position:"fixed"}):e.css({top:Math.min(Math.max(i,0),t.$el.outerHeight()-e.outerHeight()+20),left:0,width:"100%",position:"absolute"}),t.$el.css("padding-top",e.outerHeight())};return this.on("builder_resize",s,this),l(document).scroll(s),s(),this.trigger("builder_attached_to_editor"),this},displayAttachedBuilder:function(e){if(e=_.extend({confirm:!0},e),e.confirm){var t="undefined"!=typeof tinyMCE&&tinyMCE.get("content");if(""!==(t&&_.isFunction(t.getContent)?t.getContent():l("textarea#content").val())&&!confirm(panelsOptions.loc.confirm_use_builder))return!1}return l("#wp-content-wrap").hide(),this.metabox.show().find("> .inside").show(),l(window).resize(),l(document).scroll(),this.attachedVisible=!0,this.trigger("display_builder"),!0},initSortable:function(){if(!this.supports("moveRow"))return this;var e=this;return this.rowsSortable=this.$(".so-rows-container").sortable({appendTo:"#wpwrap",items:".so-row-container",handle:".so-row-move",axis:"y",tolerance:"pointer",scroll:!1,stop:function(t,i){e.addHistoryEntry("row_moved");var s=l(i.item),o=s.data("view");e.model.get("rows").remove(o.model,{silent:!0}),e.model.get("rows").add(o.model,{silent:!0,at:s.index()}),o.trigger("move",s.index()),e.model.refreshPanelsData()}}),this},refreshSortable:function(){_.isNull(this.rowsSortable)||this.rowsSortable.sortable("refresh")},setDataField:function(e,t){if(t=_.extend({load:!0},t),this.dataField=e,this.dataField.data("builder",this),t.load&&""!==e.val()){var i=this.dataField.val();try{i=JSON.parse(i)}catch(e){i={}}this.model.loadPanelsData(i),this.currentData=i,this.toggleWelcomeDisplay()}return this},storeModelData:function(){var e=JSON.stringify(this.model.get("data"));l(this.dataField).val()!==e&&(l(this.dataField).val(e),l(this.dataField).trigger("change"),this.trigger("content_change"))},onAddRow:function(e,t,i){i=_.extend({noAnimate:!1},i);var l=new s.view.row({model:e});l.builder=this,l.render(),_.isUndefined(i.at)||t.length<=1?l.$el.appendTo(this.$(".so-rows-container")):l.$el.insertAfter(this.$(".so-rows-container .so-row-container").eq(i.at-1)),!1===i.noAnimate&&l.visualCreate(),this.refreshSortable(),l.resize()},displayAddWidgetDialog:function(){this.dialogs.widgets.openDialog()},displayAddRowDialog:function(){var e=new s.model.row,t=new s.collection.cells([{weight:.5},{weight:.5}]);t.each(function(t){t.row=e}),e.set("cells",t),e.builder=this.model,this.dialogs.row.setRowModel(e),this.dialogs.row.openDialog()},displayAddPrebuiltDialog:function(){this.dialogs.prebuilt.openDialog()},displayHistoryDialog:function(){this.dialogs.history.openDialog()},pasteRowHandler:function(){var e=s.helpers.clipboard.getModel("row-model");!_.isEmpty(e)&&e instanceof s.model.row&&(this.addHistoryEntry("row_pasted"),e.builder=this.model,this.model.get("rows").add(e,{at:this.model.get("rows").indexOf(this.model)+1}),this.model.refreshPanelsData())},getActiveCell:function(e){if(e=_.extend({createCell:!0},e),!this.model.get("rows").length){if(!e.createCell)return null;this.model.addRow({},[{weight:1}],{noAnimate:!0})}var t=this.activeCell;return _.isEmpty(t)||-1===this.model.get("rows").indexOf(t.model.row)?this.model.get("rows").last().get("cells").first():t.model},addLiveEditor:function(){return _.isEmpty(this.config.liveEditorPreview)?this:(this.liveEditor=new s.view.liveEditor({builder:this,previewUrl:this.config.liveEditorPreview}),this.liveEditor.hasPreviewUrl()&&this.$(".so-builder-toolbar .so-live-editor").show(),this.trigger("builder_live_editor_added"),this)},displayLiveEditor:function(){_.isUndefined(this.liveEditor)||this.liveEditor.open()},addHistoryBrowser:function(){if(_.isEmpty(this.config.liveEditorPreview))return this;this.dialogs.history=new s.dialog.history,this.dialogs.history.builder=this,this.dialogs.history.entries.builder=this.model,this.dialogs.history.setRevertEntry(this.model),this.$(".so-builder-toolbar .so-history").show()},addHistoryEntry:function(e,t){_.isUndefined(t)&&(t=null),_.isUndefined(this.dialogs.history)||this.dialogs.history.entries.addEntry(e,t)},supports:function(e){return"rowAction"===e?this.supports("addRow")||this.supports("editRow")||this.supports("deleteRow"):"widgetAction"===e?this.supports("addWidget")||this.supports("editWidget")||this.supports("deleteWidget"):!_.isUndefined(this.config.builderSupports[e])&&this.config.builderSupports[e]},handleContentChange:function(){if(panelsOptions.copy_content&&this.attachedToEditor&&this.$el.is(":visible")){var e=this.model.getPanelsData();_.isEmpty(e.widgets)||l.post(panelsOptions.ajaxurl,{action:"so_panels_builder_content",panels_data:JSON.stringify(e),post_id:this.config.postId},function(e){""!==e&&this.updateEditorContent(e)}.bind(this))}},updateEditorContent:function(e){
3
- if("tinyMCE"!==this.config.editorType||"undefined"==typeof tinyMCE||_.isNull(tinyMCE.get("content"))){l(this.config.editorId).val(e).trigger("change").trigger("keyup")}else{var t=tinyMCE.get("content");t.setContent(e),t.fire("change"),t.fire("keyup")}this.triggerYoastSeoChange()},triggerYoastSeoChange:function(){if(l("#yoast_wpseo_focuskw_text_input").length){var e,t=document.getElementById("yoast_wpseo_focuskw_text_input");document.createEvent?(e=document.createEvent("HTMLEvents"),e.initEvent("keyup",!0,!0)):(e=document.createEventObject(),e.eventType="keyup"),e.eventName="keyup",document.createEvent?t.dispatchEvent(e):t.fireEvent("on"+e.eventType,e)}},handleDisplayBuilder:function(){var e="undefined"!=typeof tinyMCE&&tinyMCE.get("content"),t=e&&_.isFunction(e.getContent)?e.getContent():l("textarea#content").val();if((_.isEmpty(this.model.get("data"))||_.isEmpty(this.model.get("data").widgets)&&_.isEmpty(this.model.get("data").grids))&&""!==t){var i=panelsOptions.text_widget;if(_.isEmpty(i))return;this.model.loadPanelsData(this.model.getPanelsDataFromHtml(t,i)),this.model.trigger("change"),this.model.trigger("change:data")}l("#post-status-info").addClass("for-siteorigin-panels")},handleHideBuilder:function(){l("#post-status-info").show().removeClass("for-siteorigin-panels")},wrapEditorExpandAdjust:function(){try{for(var e,t=(l.hasData(window)&&l._data(window)).events.scroll,i=0;i<t.length;i++)if("editor-expand"===t[i].namespace){e=t[i],l(window).unbind("scroll",e.handler),l(window).bind("scroll",function(t){this.attachedVisible||e.handler(t)}.bind(this));break}}catch(e){return}},handleBuilderSizing:function(){var e=this.$el.width();return e?(e<480?this.$el.addClass("so-display-narrow"):this.$el.removeClass("so-display-narrow"),this):this},setDialogParents:function(e,t){_.each(this.dialogs,function(i,s,l){l[s].setParent(e,t)}),this.on("add_dialog",function(i){i.setParent(e,t)},this)},toggleWelcomeDisplay:function(){this.model.get("rows").isEmpty()?this.$(".so-panels-welcome-message").show():this.$(".so-panels-welcome-message").hide()},activateContextMenu:function(e,t){var i=this,s=l(".siteorigin-panels-builder:visible").sort(function(e,t){return l(e).zIndex()>l(t).zIndex()?1:-1}).last(),o=l(".so-panels-dialog-wrapper:visible").sort(function(e,t){return l(e).zIndex()>l(t).zIndex()?1:-1}).last(),n=i.$el.closest(".so-panels-dialog-wrapper");if(i.$el.is(s)&&(0===o.length||o.is(n))){var a=l([]).add(i.$(".so-panels-welcome-message:visible")).add(i.$(".so-rows-container > .so-row-container")).add(i.$(".so-cells > .cell")).add(i.$(".cell-wrapper > .so-widget")).filter(function(i){return t.isOverEl(l(this),e)}),r=a.last().data("view");void 0!==r&&void 0!==r.buildContextualMenu?r.buildContextualMenu(e,t):a.last().hasClass("so-panels-welcome-message")&&this.buildContextualMenu(e,t)}},buildContextualMenu:function(e,t){var i={};this.supports("addRow")&&(i.add_row={title:panelsOptions.loc.contextual.add_row}),s.helpers.clipboard.canCopyPaste()&&s.helpers.clipboard.isModel("row-model")&&this.supports("addRow")&&(i.paste_row={title:panelsOptions.loc.contextual.row_paste}),_.isEmpty(i)||t.addSection("builder-actions",{sectionTitle:panelsOptions.loc.contextual.row_actions,search:!1},i,function(e){switch(e){case"add_row":this.displayAddRowDialog();break;case"paste_row":this.pasteRowHandler()}}.bind(this))}})},{}],24:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=Backbone.View.extend({template:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-builder-cell").html())),events:{"click .cell-wrapper":"handleCellClick"},row:null,widgetSortable:null,initialize:function(){this.model.get("widgets").on("add",this.onAddWidget,this)},render:function(){var e={weight:this.model.get("weight"),totalWeight:this.row.model.get("cells").totalWeight()};this.setElement(this.template(e)),this.$el.data("view",this);var t=this;return this.model.get("widgets").each(function(e){var i=new s.view.widget({model:e});i.cell=t,i.render(),i.$el.appendTo(t.$(".widgets-container"))}),this.initSortable(),this.initResizable(),this},initSortable:function(){if(!this.row.builder.supports("moveWidget"))return this;var e=this,t=e.row.builder.$el.attr("id");return this.widgetSortable=this.$(".widgets-container").sortable({placeholder:"so-widget-sortable-highlight",connectWith:"#"+t+" .so-cells .cell .widgets-container",tolerance:"pointer",scroll:!1,over:function(t,i){e.row.builder.trigger("widget_sortable_move")},stop:function(t,i){e.row.builder.addHistoryEntry("widget_moved");var s=l(i.item),o=s.data("view"),n=s.closest(".cell").data("view");o.model.moveToCell(n.model,{},s.index()),o.cell=n,o.cell.row.builder.model.refreshPanelsData()},helper:function(e,t){var i=t.clone().css({width:t.outerWidth(),"z-index":1e4,position:"fixed"}).addClass("widget-being-dragged").appendTo("body");return t.outerWidth()>720&&i.animate({"margin-left":e.pageX-t.offset().left-240,width:480},"fast"),i}}),this},refreshSortable:function(){_.isNull(this.widgetSortable)||this.widgetSortable.sortable("refresh")},initResizable:function(){if(!this.row.builder.supports("editRow"))return this;var e,t=this.$(".resize-handle").css("position","absolute"),i=this.row.$el,s=this;return t.draggable({axis:"x",containment:i,start:function(t,i){if(e=s.$el.prev().data("view"),!_.isUndefined(e)){var o=s.$el.clone().appendTo(i.helper).css({position:"absolute",top:"0",width:s.$el.outerWidth(),left:5,height:s.$el.outerHeight()});o.find(".resize-handle").remove();var n=e.$el.clone().appendTo(i.helper).css({position:"absolute",top:"0",width:e.$el.outerWidth(),right:5,height:e.$el.outerHeight()});n.find(".resize-handle").remove(),l(this).data({newCellClone:o,prevCellClone:n})}},drag:function(i,o){var n=s.row.$el.width()+10,a=s.model.get("weight")-(o.position.left+t.outerWidth()/2)/n,r=e.model.get("weight")+(o.position.left+t.outerWidth()/2)/n;l(this).data("newCellClone").css("width",n*a).find(".preview-cell-weight").html(Math.round(1e3*a)/10),l(this).data("prevCellClone").css("width",n*r).find(".preview-cell-weight").html(Math.round(1e3*r)/10)},stop:function(i,o){l(this).data("newCellClone").remove(),l(this).data("prevCellClone").remove();var n=s.row.$el.width()+10,a=s.model.get("weight")-(o.position.left+t.outerWidth()/2)/n,r=e.model.get("weight")+(o.position.left+t.outerWidth()/2)/n;a>.02&&r>.02&&(s.row.builder.addHistoryEntry("cell_resized"),s.model.set("weight",a),e.model.set("weight",r),s.row.resize()),o.helper.css("left",-t.outerWidth()/2),s.row.builder.model.refreshPanelsData()}}),this},onAddWidget:function(e,t,i){i=_.extend({noAnimate:!1},i);var l=new s.view.widget({model:e});l.cell=this,_.isUndefined(e.isDuplicate)&&(e.isDuplicate=!1),l.render({loadForm:e.isDuplicate}),_.isUndefined(i.at)||t.length<=1?l.$el.appendTo(this.$(".widgets-container")):l.$el.insertAfter(this.$(".widgets-container .so-widget").eq(i.at-1)),!1===i.noAnimate&&l.visualCreate(),this.refreshSortable(),this.row.resize()},handleCellClick:function(e){this.row.builder.$el.find(".so-cells .cell").removeClass("cell-selected"),this.row.builder.activeCell!==this||this.model.get("widgets").length?(this.$el.addClass("cell-selected"),this.row.builder.activeCell=this):this.row.builder.activeCell=null},pasteHandler:function(){var e=s.helpers.clipboard.getModel("widget-model");!_.isEmpty(e)&&e instanceof s.model.widget&&(this.row.builder.addHistoryEntry("widget_pasted"),e.cell=this.model,this.model.get("widgets").add(e),this.row.builder.model.refreshPanelsData())},buildContextualMenu:function(e,t){var i=this;t.hasSection("add-widget-below")||t.addSection("add-widget-cell",{sectionTitle:panelsOptions.loc.contextual.add_widget_cell,searchPlaceholder:panelsOptions.loc.contextual.search_widgets,defaultDisplay:panelsOptions.contextual.default_widgets},panelsOptions.widgets,function(e){i.row.builder.addHistoryEntry("widget_added");var t=new s.model.widget({class:e});t.cell=i.model,t.cell.get("widgets").add(t),i.row.builder.model.refreshPanelsData()});var l={};this.row.builder.supports("addWidget")&&s.helpers.clipboard.isModel("widget-model")&&(l.paste={title:panelsOptions.loc.contextual.cell_paste_widget}),_.isEmpty(l)||t.addSection("cell-actions",{sectionTitle:panelsOptions.loc.contextual.cell_actions,search:!1},l,function(e){switch(e){case"paste":this.pasteHandler()}this.row.builder.model.refreshPanelsData()}.bind(this)),this.row.buildContextualMenu(e,t)}})},{}],25:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=Backbone.View.extend({dialogTemplate:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-dialog").html())),dialogTabTemplate:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-dialog-tab").html())),tabbed:!1,rendered:!1,builder:!1,className:"so-panels-dialog-wrapper",dialogClass:"",dialogIcon:"",parentDialog:!1,dialogOpen:!1,editableLabel:!1,events:{"click .so-close":"closeDialog","click .so-nav.so-previous":"navToPrevious","click .so-nav.so-next":"navToNext"},initialize:function(){this.once("open_dialog",this.render),this.once("open_dialog",this.attach),this.once("open_dialog",this.setDialogClass),this.trigger("initialize_dialog",this),_.isUndefined(this.initializeDialog)||this.initializeDialog()},getNextDialog:function(){return null},getPrevDialog:function(){return null},setDialogClass:function(){""!==this.dialogClass&&this.$(".so-panels-dialog").addClass(this.dialogClass)},setBuilder:function(e){return this.builder=e,e.trigger("add_dialog",this,this.builder),this},attach:function(){return this.$el.appendTo("body"),this},parseDialogContent:function(e,t){t=_.extend({cid:this.cid},t);var i=l(_.template(s.helpers.utils.processTemplate(e))(t)),o={title:i.find(".title").html(),buttons:i.find(".buttons").html(),content:i.find(".content").html()};return i.has(".left-sidebar")&&(o.left_sidebar=i.find(".left-sidebar").html()),i.has(".right-sidebar")&&(o.right_sidebar=i.find(".right-sidebar").html()),o},renderDialog:function(e){if(e=_.extend({editableLabel:this.editableLabel,dialogIcon:this.dialogIcon},e),this.$el.html(this.dialogTemplate(e)).hide(),this.$el.data("view",this),this.$el.addClass("so-panels-dialog-wrapper"),!1!==this.parentDialog){var t=this,i=l('<h3 class="so-parent-link"></h3>').html(this.parentDialog.text+'<div class="so-separator"></div>');i.click(function(e){e.preventDefault(),t.closeDialog(),t.parentDialog.openDialog()}),this.$(".so-title-bar").prepend(i)}return this.$(".so-title-bar .so-title-editable").length&&this.initEditableLabel(),this},initTabs:function(){var e=this.$(".so-sidebar-tabs li a");if(0===e.length)return this;var t=this;return e.click(function(e){e.preventDefault();var i=l(this);t.$(".so-sidebar-tabs li").removeClass("tab-active"),t.$(".so-content .so-content-tabs > *").hide(),i.parent().addClass("tab-active");var s=i.attr("href");if(!_.isUndefined(s)&&"#"===s.charAt(0)){var o=s.split("#")[1];t.$(".so-content .so-content-tabs .tab-"+o).show()}t.trigger("tab_click",i)}),this.$(".so-sidebar-tabs li a").first().click(),this},initToolbar:function(){this.$(".so-toolbar .so-buttons .so-toolbar-button").click(function(e){e.preventDefault(),this.trigger("button_click",l(e.currentTarget))}.bind(this)),this.$(".so-toolbar .so-buttons .so-dropdown-button").click(function(e){e.preventDefault();var t=l(e.currentTarget),i=t.siblings(".so-dropdown-links-wrapper");i.is(".hidden")?i.removeClass("hidden"):i.addClass("hidden")}.bind(this)),l("html").click(function(e){this.$(".so-dropdown-links-wrapper").not(".hidden").each(function(t,i){var s=l(i),o=l(e.target);0!==o.length&&(o.is(".so-needs-confirm")&&!o.is(".so-confirmed")||o.is(".so-dropdown-button"))||s.addClass("hidden")})}.bind(this))},initEditableLabel:function(){var e=this.$(".so-title-bar .so-title-editable");e.keypress(function(t){var i="keypress"===t.type&&13===t.keyCode;if(i){var s=l(":tabbable"),o=s.index(e);s.eq(o+1).focus(),window.getSelection().removeAllRanges()}return!i}).blur(function(){var t=e.text().replace(/^\s+|\s+$/gm,"");t!==e.data("original-value").replace(/^\s+|\s+$/gm,"")&&(e.text(t),this.trigger("edit_label",t))}.bind(this)),e.focus(function(){e.data("original-value",e.text()),s.helpers.utils.selectElementContents(this)})},setupDialog:function(){this.openDialog(),this.closeDialog()},refreshDialogNav:function(){this.$(".so-title-bar .so-nav").show().removeClass("so-disabled");var e=this.getNextDialog(),t=this.$(".so-title-bar .so-next"),i=this.getPrevDialog(),s=this.$(".so-title-bar .so-previous");null===e?t.hide():!1===e&&t.addClass("so-disabled"),null===i?s.hide():!1===i&&s.addClass("so-disabled")},openDialog:function(e){e=_.extend({silent:!1},e),e.silent||this.trigger("open_dialog"),this.dialogOpen=!0,this.refreshDialogNav(),s.helpers.pageScroll.lock(),l(window).on("keyup",this.keyboardListen),this.$el.show(),e.silent||(this.trigger("open_dialog_complete"),this.builder.trigger("open_dialog",this))},closeDialog:function(e){e=_.extend({silent:!1},e),e.silent||this.trigger("close_dialog"),this.dialogOpen=!1,this.$el.hide(),s.helpers.pageScroll.unlock(),l(window).off("keyup",this.keyboardListen),e.silent||(this.trigger("close_dialog_complete"),this.builder.trigger("close_dialog",this))},keyboardListen:function(e){27===e.which&&l(".so-panels-dialog-wrapper .so-close").trigger("click")},navToPrevious:function(){this.closeDialog();var e=this.getPrevDialog();null!==e&&!1!==e&&e.openDialog()},navToNext:function(){this.closeDialog();var e=this.getNextDialog();null!==e&&!1!==e&&e.openDialog()},getFormValues:function(e){_.isUndefined(e)&&(e=".so-content");var t,i=this.$(e),s={};return i.find("[name]").each(function(){var e=l(this);try{var i=/([A-Za-z_]+)\[(.*)\]/.exec(e.attr("name"));if(_.isEmpty(i))return!0;_.isUndefined(i[2])?t=e.attr("name"):(t=i[2].split("]["),t.unshift(i[1])),t=t.map(function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e});var o=s,n=null,a=!!_.isString(e.attr("type"))&&e.attr("type").toLowerCase();if("checkbox"===a)n=e.is(":checked")?""===e.val()||e.val():null;else if("radio"===a){if(!e.is(":checked"))return;n=e.val()}else if("TEXTAREA"===e.prop("tagName")&&e.hasClass("wp-editor-area")){var r=null;"undefined"!=typeof tinyMCE&&(r=tinyMCE.get(e.attr("id"))),n=null!==r&&_.isFunction(r.getContent)&&!r.isHidden()?r.getContent():e.val()}else if("SELECT"===e.prop("tagName")){var d=e.find("option:selected");1===d.length?n=e.find("option:selected").val():d.length>1&&(n=_.map(e.find("option:selected"),function(e,t){return l(e).val()}))}else n=e.val();if(!_.isUndefined(e.data("panels-filter")))switch(e.data("panels-filter")){case"json_parse":try{n=JSON.parse(n)}catch(e){n=""}}if(null!==n)for(var c=0;c<t.length;c++)c===t.length-1?""===t[c]?o.push(n):o[t[c]]=n:(_.isUndefined(o[t[c]])&&(""===t[c+1]?o[t[c]]=[]:o[t[c]]={}),o=o[t[c]])}catch(t){console.log("Field ["+e.attr("name")+"] could not be processed and was skipped - "+t.message)}}),s},setStatusMessage:function(e,t){this.$(".so-toolbar .so-status").html(e),!_.isUndefined(t)&&t&&this.$(".so-toolbar .so-status").addClass("so-panels-loading")},setParent:function(e,t){this.parentDialog={text:e,dialog:t}}})},{}],26:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=Backbone.View.extend({template:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-live-editor").html())),previewScrollTop:0,loadTimes:[],previewFrameId:1,previewUrl:null,previewIframe:null,events:{"click .live-editor-close":"close","click .live-editor-collapse":"collapse","click .live-editor-mode":"mobileToggle"},initialize:function(e){e=_.extend({builder:!1,previewUrl:!1},e),_.isEmpty(e.previewUrl)&&(e.previewUrl=panelsOptions.ajaxurl+"&action=so_panels_live_editor_preview"),this.builder=e.builder,this.previewUrl=e.previewUrl,this.builder.model.on("refresh_panels_data",this.handleRefreshData,this),this.builder.model.on("load_panels_data",this.handleLoadData,this)},render:function(){this.setElement(this.template()),this.$el.hide();var e=this,t=!1;return l(document).mousedown(function(){t=!0}).mouseup(function(){t=!1}),this.$el.on("mouseenter",".so-widget-wrapper",function(){var i=l(this),s=i.data("live-editor-preview-widget");t||void 0===s||!s.length||e.$(".so-preview-overlay").is(":visible")||(e.highlightElement(s),e.scrollToElement(s))}),e.$el.on("mouseleave",".so-widget-wrapper",function(){e.resetHighlights()}),e.builder.on("open_dialog",function(){e.resetHighlights()}),this},attach:function(){this.$el.appendTo("body")},open:function(){if(""===this.$el.html()&&this.render(),0===this.$el.closest("body").length&&this.attach(),s.helpers.pageScroll.lock(),this.$el.is(":visible"))return this;if(this.$el.show(),this.refreshPreview(this.builder.model.getPanelsData()),this.originalContainer=this.builder.$el.parent(),this.builder.$el.appendTo(this.$(".so-live-editor-builder")),this.builder.$(".so-tool-button.so-live-editor").hide(),this.builder.trigger("builder_resize"),"auto-draft"===l("#original_post_status").val()&&!this.autoSaved){var e=this;wp.autosave&&(""===l('#title[name="post_title"]').val()&&l('#title[name="post_title"]').val(panelsOptions.loc.draft).trigger("keydown"),l(document).one("heartbeat-tick.autosave",function(){e.autoSaved=!0,e.refreshPreview(e.builder.model.getPanelsData())}),wp.autosave.server.triggerSave())}},close:function(){if(!this.$el.is(":visible"))return this;this.$el.hide(),s.helpers.pageScroll.unlock(),this.builder.$el.appendTo(this.originalContainer),this.builder.$(".so-tool-button.so-live-editor").show(),this.builder.trigger("builder_resize")},collapse:function(){this.$el.toggleClass("so-collapsed");var e=this.$(".live-editor-collapse span");e.html(e.data(this.$el.hasClass("so-collapsed")?"expand":"collapse"))},highlightElement:function(e){_.isUndefined(this.resetHighlightTimeout)||clearTimeout(this.resetHighlightTimeout),this.previewIframe.contents().find("body").find(".panel-grid .panel-grid-cell .so-panel").filter(function(){return 0===l(this).parents(".so-panel").length}).not(e).addClass("so-panels-faded"),e.removeClass("so-panels-faded").addClass("so-panels-highlighted")},resetHighlights:function(){var e=this.previewIframe.contents().find("body");this.resetHighlightTimeout=setTimeout(function(){e.find(".panel-grid .panel-grid-cell .so-panel").removeClass("so-panels-faded so-panels-highlighted")},100)},scrollToElement:function(e){this.$(".so-preview iframe")[0].contentWindow.liveEditorScrollTo(e)},handleRefreshData:function(e,t){if(!this.$el.is(":visible"))return this;this.refreshPreview(e)},handleLoadData:function(){if(!this.$el.is(":visible"))return this;this.refreshPreview(this.builder.model.getPanelsData())},refreshPreview:function(e){var t=this.loadTimes.length?_.reduce(this.loadTimes,function(e,t){return e+t},0)/this.loadTimes.length:1e3;_.isNull(this.previewIframe)||this.$(".so-preview-overlay").is(":visible")||(this.previewScrollTop=this.previewIframe.contents().scrollTop()),this.$(".so-preview-overlay").show(),this.$(".so-preview-overlay .so-loading-bar").clearQueue().css("width","0%").animate({width:"100%"},parseInt(t)+100),this.postToIframe({live_editor_panels_data:JSON.stringify(e),live_editor_post_ID:this.builder.config.postId},this.previewUrl,this.$(".so-preview")),this.previewIframe.data("load-start",(new Date).getTime())},postToIframe:function(e,t,i){_.isNull(this.previewIframe)||this.previewIframe.remove();var s="siteorigin-panels-live-preview-"+this.previewFrameId;this.previewIframe=l('<iframe src="javascript:false;" />').attr({id:s,name:s}).appendTo(i),this.setupPreviewFrame(this.previewIframe);var o=l('<form id="soPostToPreviewFrame" method="post" />').attr({id:s,target:this.previewIframe.attr("id"),action:t}).appendTo("body");return l.each(e,function(e,t){l('<input type="hidden" />').attr({name:e,value:t}).appendTo(o)}),o.submit().remove(),this.previewFrameId++,this.previewIframe},setupPreviewFrame:function(e){var t=this;e.data("iframeready",!1).on("iframeready",function(){var e=l(this),i=e.contents();if(!e.data("iframeready")){e.data("iframeready",!0),void 0!==e.data("load-start")&&(t.loadTimes.unshift((new Date).getTime()-e.data("load-start")),_.isEmpty(t.loadTimes)||(t.loadTimes=t.loadTimes.slice(0,4))),setTimeout(function(){i.scrollTop(t.previewScrollTop),t.$(".so-preview-overlay").hide()},100);var s=i.find("#pl-"+t.builder.config.postId);s.find(".panel-grid .panel-grid-cell .so-panel").filter(function(){return l(this).closest(".panel-layout").is(s)}).each(function(e,i){var s=l(i),o=t.$(".so-live-editor-builder .so-widget-wrapper").eq(s.data("index"));o.data("live-editor-preview-widget",s),s.css({cursor:"pointer"}).mouseenter(function(){o.parent().addClass("so-hovered"),t.highlightElement(s)}).mouseleave(function(){o.parent().removeClass("so-hovered"),t.resetHighlights()}).click(function(e){e.preventDefault(),o.find(".title h4").click()})}),i.find("a").css({"pointer-events":"none"}).click(function(e){e.preventDefault()})}}).on("load",function(){var e=l(this);e.data("iframeready")||e.trigger("iframeready")})},hasPreviewUrl:function(){return""!==this.$("form.live-editor-form").attr("action")},mobileToggle:function(e){var t=l(e.currentTarget);this.$(".live-editor-mode").not(t).removeClass("so-active"),t.addClass("so-active"),this.$el.removeClass("live-editor-desktop-mode live-editor-tablet-mode live-editor-mobile-mode").addClass("live-editor-"+t.data("mode")+"-mode")}})},{}],27:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=Backbone.View.extend({template:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-builder-row").html())),events:{"click .so-row-settings":"editSettingsHandler","click .so-row-duplicate":"duplicateHandler","click .so-row-delete":"confirmedDeleteHandler","click .so-row-color":"rowColorChangeHandler"},builder:null,dialog:null,initialize:function(){var e=this.model.get("cells");e.on("add",this.handleCellAdd,this),e.on("remove",this.handleCellRemove,this),this.model.on("reweight_cells",this.resize,this),this.model.on("destroy",this.onModelDestroy,this),this.model.on("visual_destroy",this.visualDestroyModel,this);var t=this;e.each(function(e){t.listenTo(e.get("widgets"),"add",t.resize)}),e.on("add",function(e){t.listenTo(e.get("widgets"),"add",t.resize)},this),this.model.on("change:label",this.onLabelChange,this)},render:function(){var e=this.model.has("color_label")?this.model.get("color_label"):1,t=this.model.has("label")?this.model.get("label"):"";this.setElement(this.template({rowColorLabel:e,rowLabel:t})),this.$el.data("view",this);var i=this;return this.model.get("cells").each(function(e){var t=new s.view.cell({model:e});t.row=i,t.render(),t.$el.appendTo(i.$(".so-cells"))}),this.builder.supports("rowAction")?(this.builder.supports("editWidget")||(this.$(".so-row-toolbar .so-row-settings").parent().remove(),this.$el.addClass("so-row-no-edit")),this.builder.supports("addWidget")||(this.$(".so-row-toolbar .so-row-duplicate").parent().remove(),this.$el.addClass("so-row-no-duplicate")),this.builder.supports("deleteWidget")||(this.$(".so-row-toolbar .so-row-delete").parent().remove(),this.$el.addClass("so-row-no-delete"))):(this.$(".so-row-toolbar .so-dropdown-wrapper").remove(),this.$el.addClass("so-row-no-actions")),this.builder.supports("moveRow")||(this.$(".so-row-toolbar .so-row-move").remove(),this.$el.addClass("so-row-no-move")),l.trim(this.$(".so-row-toolbar").html()).length||this.$(".so-row-toolbar").remove(),this.builder.on("widget_sortable_move",this.resize,this),this.builder.on("builder_resize",this.resize,this),this.resize(),this},visualCreate:function(){this.$el.hide().fadeIn("fast")},resize:function(e){if(this.$el.is(":visible")){this.$(".so-cells .cell-wrapper").css("min-height",0),this.$(".so-cells .resize-handle").css("height",0);var t=0;this.$(".so-cells .cell").each(function(){t=Math.max(t,l(this).height()),l(this).css("width",100*l(this).data("view").model.get("weight")+"%")}),this.$(".so-cells .cell-wrapper").css("min-height",Math.max(t,63)),this.$(".so-cells .resize-handle").css("height",this.$(".so-cells .cell-wrapper").outerHeight())}},onModelDestroy:function(){this.remove()},visualDestroyModel:function(){this.builder.addHistoryEntry("row_deleted");var e=this;this.$el.fadeOut("normal",function(){e.model.destroy(),e.builder.model.refreshPanelsData()})},onLabelChange:function(e,t){0==this.$(".so-row-label").length?this.$(".so-row-toolbar").prepend('<h3 class="so-row-label">'+t+"</h3>"):this.$(".so-row-label").text(t)},duplicateHandler:function(){this.builder.addHistoryEntry("row_duplicated");var e=this.model.clone(this.builder.model);this.builder.model.get("rows").add(e,{at:this.builder.model.get("rows").indexOf(this.model)+1}),this.builder.model.refreshPanelsData()},copyHandler:function(){s.helpers.clipboard.setModel(this.model)},pasteHandler:function(){var e=s.helpers.clipboard.getModel("row-model");!_.isEmpty(e)&&e instanceof s.model.row&&(this.builder.addHistoryEntry("row_pasted"),e.builder=this.builder.model,this.builder.model.get("rows").add(e,{at:this.builder.model.get("rows").indexOf(this.model)+1}),this.builder.model.refreshPanelsData())},confirmedDeleteHandler:function(e){var t=l(e.target);if(t.hasClass("dashicons")&&(t=l.parent()),t.hasClass("so-confirmed"))this.visualDestroyModel();else{var i=t.html();t.addClass("so-confirmed").html('<span class="dashicons dashicons-yes"></span>'+panelsOptions.loc.dropdown_confirm),setTimeout(function(){t.removeClass("so-confirmed").html(i)},2500)}},editSettingsHandler:function(){return null===this.dialog&&(this.dialog=new s.dialog.row,this.dialog.setBuilder(this.builder).setRowModel(this.model)),this.dialog.openDialog(),this},deleteHandler:function(){return this.model.destroy(),this},rowColorChangeHandler:function(e){this.$(".so-row-color").removeClass("so-row-color-selected");var t=l(e.target),i=t.data("color-label"),s=this.model.has("color_label")?this.model.get("color_label"):1;t.addClass("so-row-color-selected"),this.$el.removeClass("so-row-color-"+s),this.$el.addClass("so-row-color-"+i),this.model.set("color_label",i)},handleCellAdd:function(e){var t=new s.view.cell({model:e});t.row=this,t.render(),t.$el.appendTo(this.$(".so-cells"))},handleCellRemove:function(e){this.$(".so-cells > .cell").each(function(){var t=l(this).data("view");_.isUndefined(t)||t.model.cid===e.cid&&t.remove()})},buildContextualMenu:function(e,t){for(var i=[],l=1;l<5;l++)i.push({title:l+" "+panelsOptions.loc.contextual.column});this.builder.supports("addRow")&&t.addSection("add-row",{sectionTitle:panelsOptions.loc.contextual.add_row,search:!1},i,function(e){this.builder.addHistoryEntry("row_added");for(var t=Number(e)+1,i=[],l=0;l<t;l++)i.push({weight:100/t});var o=new s.model.row({collection:this.collection}),n=new s.collection.cells(i);n.each(function(e){e.row=o}),o.setCells(n),o.builder=this.builder.model,this.builder.model.get("rows").add(o,{at:this.builder.model.get("rows").indexOf(this.model)+1}),this.builder.model.refreshPanelsData()}.bind(this));var o={};this.builder.supports("editRow")&&(o.edit={title:panelsOptions.loc.contextual.row_edit}),s.helpers.clipboard.canCopyPaste()&&(o.copy={title:panelsOptions.loc.contextual.row_copy},this.builder.supports("addRow")&&s.helpers.clipboard.isModel("row-model")&&(o.paste={title:panelsOptions.loc.contextual.row_paste})),this.builder.supports("addRow")&&(o.duplicate={title:panelsOptions.loc.contextual.row_duplicate}),this.builder.supports("deleteRow")&&(o.delete={title:panelsOptions.loc.contextual.row_delete,confirm:!0}),_.isEmpty(o)||t.addSection("row-actions",{sectionTitle:panelsOptions.loc.contextual.row_actions,search:!1},o,function(e){switch(e){case"edit":this.editSettingsHandler();break;case"copy":this.copyHandler();break;case"paste":this.pasteHandler();break;case"duplicate":this.duplicateHandler();break;case"delete":this.visualDestroyModel()}}.bind(this))}})},{}],28:[function(e,t,i){var s=(window.panels,jQuery);t.exports=Backbone.View.extend({stylesLoaded:!1,initialize:function(){},render:function(e,t,i){if(!_.isUndefined(e)){i=_.extend({builderType:"",dialog:null},i),this.$el.addClass("so-visual-styles so-"+e+"-styles");var l={builderType:i.builderType};return"cell"===e&&(l.index=i.index),s.post(panelsOptions.ajaxurl,{action:"so_panels_style_form",type:e,style:this.model.get("style"),args:JSON.stringify(l),postId:t},function(e){this.$el.html(e),this.setupFields(),this.stylesLoaded=!0,this.trigger("styles_loaded",!_.isEmpty(e)),_.isNull(i.dialog)||i.dialog.trigger("styles_loaded",!_.isEmpty(e))}.bind(this)),this}},attach:function(e){e.append(this.$el)},detach:function(){this.$el.detach()},setupFields:function(){this.$(".style-section-wrapper").each(function(){var e=s(this);e.find(".style-section-head").click(function(t){t.preventDefault(),e.find(".style-section-fields").slideToggle("fast")})}),_.isUndefined(s.fn.wpColorPicker)||(_.isObject(panelsOptions.wpColorPickerOptions.palettes)&&!s.isArray(panelsOptions.wpColorPickerOptions.palettes)&&(panelsOptions.wpColorPickerOptions.palettes=s.map(panelsOptions.wpColorPickerOptions.palettes,function(e){return e})),this.$(".so-wp-color-field").wpColorPicker(panelsOptions.wpColorPickerOptions)),this.$(".style-field-image").each(function(){var e=null,t=s(this);t.find(".so-image-selector").click(function(i){i.preventDefault(),null===e&&(e=wp.media({title:"choose",library:{type:"image"},button:{text:"Done",close:!0}}),e.on("select",function(){var i=e.state().get("selection").first().attributes,s=i.url;if(!_.isUndefined(i.sizes))try{s=i.sizes.thumbnail.url}catch(e){s=i.sizes.full.url}t.find(".current-image").css("background-image","url("+s+")"),t.find("input").val(i.id)})),e.open()}),t.find(".remove-image").click(function(e){e.preventDefault(),t.find(".current-image").css("background-image","none"),t.find("input").val("")})}),this.$(".style-field-measurement").each(function(){var e=s(this),t=e.find('input[type="text"]'),i=e.find("select"),l=e.find('input[type="hidden"]');t.focus(function(){s(this).select()});!function(e){if(""!==e){var o=/(?:([0-9\.,\-]+)(.*))+/,n=l.val().split(" "),a=[];for(var r in n){var d=o.exec(n[r]);_.isNull(d)||_.isUndefined(d[1])||_.isUndefined(d[2])||(a.push(d[1]),i.val(d[2]))}1===t.length?t.val(a.join(" ")):(1===a.length?a=[a[0],a[0],a[0],a[0]]:2===a.length?a=[a[0],a[1],a[0],a[1]]:3===a.length&&(a=[a[0],a[1],a[2],a[1]]),t.each(function(e,t){s(t).val(a[e])}))}}(l.val());var o=function(e){if(1===t.length){var o=t.val().split(" ").filter(function(e){return""!==e}).map(function(e){return e+i.val()}).join(" ");l.val(o)}else{var n=s(e.target),a=[],r=[],d=[];t.each(function(e,t){var i=""!==s(t).val()?parseFloat(s(t).val()):null;a.push(i),null===i?r.push(e):d.push(e)}),3===r.length&&d[0]===t.index(n)&&(t.val(n.val()),a=[n.val(),n.val(),n.val(),n.val()]),JSON.stringify(a)===JSON.stringify([null,null,null,null])?l.val(""):l.val(a.map(function(e){return(null===e?0:e)+i.val()}).join(" "))}};t.change(o),i.change(o)})}})},{}],29:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=Backbone.View.extend({template:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-builder-widget").html())),cell:null,dialog:null,events:{"click .widget-edit":"editHandler","click .title h4":"titleClickHandler","click .actions .widget-duplicate":"duplicateHandler","click .actions .widget-delete":"deleteHandler"},initialize:function(){this.model.on("user_edit",this.editHandler,this),this.model.on("user_duplicate",this.duplicateHandler,this),this.model.on("destroy",this.onModelDestroy,this),this.model.on("visual_destroy",this.visualDestroyModel,this),this.model.on("change:values",this.onModelChange,this),this.model.on("change:label",this.onLabelChange,this)},render:function(e){if(e=_.extend({loadForm:!1},e),this.setElement(this.template({title:this.model.getWidgetField("title"),description:this.model.getTitle()})),this.$el.data("view",this),this.cell.row.builder.supports("editWidget")&&!this.model.get("read_only")||(this.$(".actions .widget-edit").remove(),this.$el.addClass("so-widget-no-edit")),this.cell.row.builder.supports("addWidget")||(this.$(".actions .widget-duplicate").remove(),
4
- this.$el.addClass("so-widget-no-duplicate")),this.cell.row.builder.supports("deleteWidget")||(this.$(".actions .widget-delete").remove(),this.$el.addClass("so-widget-no-delete")),this.cell.row.builder.supports("moveWidget")||this.$el.addClass("so-widget-no-move"),l.trim(this.$(".actions").html()).length||this.$(".actions").remove(),this.model.get("read_only")&&this.$el.addClass("so-widget-read-only"),0===_.size(this.model.get("values"))||e.loadForm){var t=this.getEditDialog();t.once("form_loaded",t.saveWidget,t),t.setupDialog()}return this},visualCreate:function(){this.$el.hide().fadeIn("fast")},getEditDialog:function(){return null===this.dialog&&(this.dialog=new s.dialog.widget({model:this.model}),this.dialog.setBuilder(this.cell.row.builder),this.dialog.widgetView=this),this.dialog},editHandler:function(){this.getEditDialog().openDialog()},titleClickHandler:function(e){return!this.cell.row.builder.supports("editWidget")||this.model.get("read_only")?this:(this.editHandler(),this)},duplicateHandler:function(){this.cell.row.builder.addHistoryEntry("widget_duplicated");var e=this.model.clone(this.model.cell);return this.cell.model.get("widgets").add(e,{at:this.model.collection.indexOf(this.model)+1}),this.cell.row.builder.model.refreshPanelsData(),this},copyHandler:function(){s.helpers.clipboard.setModel(this.model)},deleteHandler:function(){return this.model.trigger("visual_destroy"),this},onModelChange:function(){this.$(".description").html(this.model.getTitle())},onLabelChange:function(e){this.$(".title > h4").text(e.getWidgetField("title"))},onModelDestroy:function(){this.remove()},visualDestroyModel:function(){this.cell.row.builder.addHistoryEntry("widget_deleted");var e=this;return this.$el.fadeOut("fast",function(){e.cell.row.resize(),e.model.destroy(),e.cell.row.builder.model.refreshPanelsData(),e.remove()}),this},buildContextualMenu:function(e,t){this.cell.row.builder.supports("addWidget")&&t.addSection("add-widget-below",{sectionTitle:panelsOptions.loc.contextual.add_widget_below,searchPlaceholder:panelsOptions.loc.contextual.search_widgets,defaultDisplay:panelsOptions.contextual.default_widgets},panelsOptions.widgets,function(e){this.cell.row.builder.addHistoryEntry("widget_added");var t=new s.model.widget({class:e});t.cell=this.cell.model,this.cell.model.get("widgets").add(t,{at:this.model.collection.indexOf(this.model)+1}),this.cell.row.builder.model.refreshPanelsData()}.bind(this));var i={};this.cell.row.builder.supports("editWidget")&&!this.model.get("read_only")&&(i.edit={title:panelsOptions.loc.contextual.widget_edit}),s.helpers.clipboard.canCopyPaste()&&(i.copy={title:panelsOptions.loc.contextual.widget_copy}),this.cell.row.builder.supports("addWidget")&&(i.duplicate={title:panelsOptions.loc.contextual.widget_duplicate}),this.cell.row.builder.supports("deleteWidget")&&(i.delete={title:panelsOptions.loc.contextual.widget_delete,confirm:!0}),_.isEmpty(i)||t.addSection("widget-actions",{sectionTitle:panelsOptions.loc.contextual.widget_actions,search:!1},i,function(e){switch(e){case"edit":this.editHandler();break;case"copy":this.copyHandler();break;case"duplicate":this.duplicateHandler();break;case"delete":this.visualDestroyModel()}}.bind(this)),this.cell.buildContextualMenu(e,t)}})},{}]},{},[16]);
1
+ !function e(t,i,s){function l(n,a){if(!i[n]){if(!t[n]){var r="function"==typeof require&&require;if(!a&&r)return r(n,!0);if(o)return o(n,!0);var d=new Error("Cannot find module '"+n+"'");throw d.code="MODULE_NOT_FOUND",d}var c=i[n]={exports:{}};t[n][0].call(c.exports,function(e){var i=t[n][1][e];return l(i||e)},c,c.exports,e,t,i,s)}return i[n].exports}for(var o="function"==typeof require&&require,n=0;n<s.length;n++)l(s[n]);return l}({1:[function(e,t,i){var s=window.panels;t.exports=Backbone.Collection.extend({model:s.model.cell,initialize:function(){},totalWeight:function(){var e=0;return this.each(function(t){e+=t.get("weight")}),e}})},{}],2:[function(e,t,i){var s=window.panels;t.exports=Backbone.Collection.extend({model:s.model.historyEntry,builder:null,maxSize:12,initialize:function(){this.on("add",this.onAddEntry,this)},addEntry:function(e,t){_.isEmpty(t)&&(t=this.builder.getPanelsData());var i=new s.model.historyEntry({text:e,data:JSON.stringify(t),time:parseInt((new Date).getTime()/1e3),collection:this});this.add(i)},onAddEntry:function(e){if(this.models.length>1){var t=this.at(this.models.length-2);(e.get("text")===t.get("text")&&e.get("time")-t.get("time")<15||e.get("data")===t.get("data"))&&(this.remove(e),t.set("count",t.get("count")+1))}for(;this.models.length>this.maxSize;)this.shift()}})},{}],3:[function(e,t,i){var s=window.panels;t.exports=Backbone.Collection.extend({model:s.model.row,empty:function(){for(var e;;){if(!(e=this.collection.first()))break;e.destroy()}}})},{}],4:[function(e,t,i){var s=window.panels;t.exports=Backbone.Collection.extend({model:s.model.widget,initialize:function(){}})},{}],5:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=s.view.dialog.extend({dialogClass:"so-panels-dialog-add-builder",render:function(){this.renderDialog(this.parseDialogContent(l("#siteorigin-panels-dialog-builder").html(),{})),this.$(".so-content .siteorigin-panels-builder").append(this.builder.$el)},initializeDialog:function(){var e=this;this.once("open_dialog_complete",function(){e.builder.initSortable()}),this.on("open_dialog_complete",function(){e.builder.trigger("builder_resize")})}})},{}],6:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=s.view.dialog.extend({historyEntryTemplate:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-dialog-history-entry").html())),entries:{},currentEntry:null,revertEntry:null,selectedEntry:null,previewScrollTop:null,dialogClass:"so-panels-dialog-history",dialogIcon:"history",events:{"click .so-close":"closeDialog","click .so-restore":"restoreSelectedEntry"},initializeDialog:function(){this.entries=new s.collection.historyEntries,this.on("open_dialog",this.setCurrentEntry,this),this.on("open_dialog",this.renderHistoryEntries,this)},render:function(){var e=this;this.renderDialog(this.parseDialogContent(l("#siteorigin-panels-dialog-history").html(),{})),this.$("iframe.siteorigin-panels-history-iframe").load(function(){var t=l(this);t.show(),t.contents().scrollTop(e.previewScrollTop)})},setRevertEntry:function(e){this.revertEntry=new s.model.historyEntry({data:JSON.stringify(e.getPanelsData()),time:parseInt((new Date).getTime()/1e3)})},setCurrentEntry:function(){this.currentEntry=new s.model.historyEntry({data:JSON.stringify(this.builder.model.getPanelsData()),time:parseInt((new Date).getTime()/1e3)}),this.selectedEntry=this.currentEntry,this.previewEntry(this.currentEntry),this.$(".so-buttons .so-restore").addClass("disabled")},renderHistoryEntries:function(){var e=this,t=this.$(".history-entries").empty();this.currentEntry.get("data")===this.revertEntry.get("data")&&_.isEmpty(this.entries.models)||l(this.historyEntryTemplate({title:panelsOptions.loc.history.revert,count:1})).data("historyEntry",this.revertEntry).prependTo(t),this.entries.each(function(i){var s=e.historyEntryTemplate({title:panelsOptions.loc.history[i.get("text")],count:i.get("count")});l(s).data("historyEntry",i).prependTo(t)}),l(this.historyEntryTemplate({title:panelsOptions.loc.history.current,count:1})).data("historyEntry",this.currentEntry).addClass("so-selected").prependTo(t),t.find(".history-entry").click(function(){var i=jQuery(this);t.find(".history-entry").not(i).removeClass("so-selected"),i.addClass("so-selected");var s=i.data("historyEntry");e.selectedEntry=s,e.selectedEntry.cid!==e.currentEntry.cid?e.$(".so-buttons .so-restore").removeClass("disabled"):e.$(".so-buttons .so-restore").addClass("disabled"),e.previewEntry(s)}),this.updateEntryTimes()},previewEntry:function(e){var t=this.$("iframe.siteorigin-panels-history-iframe");t.hide(),this.previewScrollTop=t.contents().scrollTop(),this.$('form.history-form input[name="live_editor_panels_data"]').val(e.get("data")),this.$('form.history-form input[name="live_editor_post_ID"]').val(this.builder.config.postId),this.$("form.history-form").submit()},restoreSelectedEntry:function(){return!this.$(".so-buttons .so-restore").hasClass("disabled")&&(this.currentEntry.get("data")===this.selectedEntry.get("data")?(this.closeDialog(),!1):("restore"!==this.selectedEntry.get("text")&&this.builder.addHistoryEntry("restore",this.builder.model.getPanelsData()),this.builder.model.loadPanelsData(JSON.parse(this.selectedEntry.get("data"))),this.closeDialog(),!1))},updateEntryTimes:function(){var e=this;this.$(".history-entries .history-entry").each(function(){var t=jQuery(this),i=t.find(".timesince"),s=t.data("historyEntry");i.html(e.timeSince(s.get("time")))})},timeSince:function(e){var t,i=parseInt((new Date).getTime()/1e3)-e,s=[];return i>3600&&(t=Math.floor(i/3600),1===t?s.push(panelsOptions.loc.time.hour.replace("%d",t)):s.push(panelsOptions.loc.time.hours.replace("%d",t)),i-=3600*t),i>60&&(t=Math.floor(i/60),1===t?s.push(panelsOptions.loc.time.minute.replace("%d",t)):s.push(panelsOptions.loc.time.minutes.replace("%d",t)),i-=60*t),i>0&&(1===i?s.push(panelsOptions.loc.time.second.replace("%d",i)):s.push(panelsOptions.loc.time.seconds.replace("%d",i))),_.isEmpty(s)?panelsOptions.loc.time.now:panelsOptions.loc.time.ago.replace("%s",s.slice(0,2).join(", "))}})},{}],7:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=s.view.dialog.extend({directoryTemplate:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-directory-items").html())),builder:null,dialogClass:"so-panels-dialog-prebuilt-layouts",dialogIcon:"layouts",layoutCache:{},currentTab:!1,directoryPage:1,events:{"click .so-close":"closeDialog","click .so-sidebar-tabs li a":"tabClickHandler","click .so-content .layout":"layoutClickHandler","keyup .so-sidebar-search":"searchHandler","click .so-screenshot, .so-title":"directoryItemClickHandler"},initializeDialog:function(){var e=this;this.on("open_dialog",function(){e.$(".so-sidebar-tabs li a").first().click(),e.$(".so-status").removeClass("so-panels-loading")}),this.on("button_click",this.toolbarButtonClick,this)},render:function(){this.renderDialog(this.parseDialogContent(l("#siteorigin-panels-dialog-prebuilt").html(),{})),this.initToolbar()},tabClickHandler:function(e){e.preventDefault(),this.selectedLayoutItem=null,this.uploadedLayout=null,this.updateButtonState(!1),this.$(".so-sidebar-tabs li").removeClass("tab-active");var t=l(e.target),i=t.attr("href").split("#")[1];t.parent().addClass("tab-active");var s=this;this.$(".so-content").empty(),s.currentTab=i,"import"==i?this.displayImportExport():this.displayLayoutDirectory("",1,i),s.$(".so-sidebar-search").val("")},displayImportExport:function(){var e=this.$(".so-content").empty().removeClass("so-panels-loading");e.html(l("#siteorigin-panels-dialog-prebuilt-importexport").html());var t=this,i=t.$(".import-upload-ui").hide();new plupload.Uploader({runtimes:"html5,silverlight,flash,html4",browse_button:i.find(".file-browse-button").get(0),container:i.get(0),drop_element:i.find(".drag-upload-area").get(0),file_data_name:"panels_import_data",multiple_queues:!1,max_file_size:panelsOptions.plupload.max_file_size,url:panelsOptions.plupload.url,flash_swf_url:panelsOptions.plupload.flash_swf_url,silverlight_xap_url:panelsOptions.plupload.silverlight_xap_url,filters:[{title:panelsOptions.plupload.filter_title,extensions:"json"}],multipart_params:{action:"so_panels_import_layout"},init:{PostInit:function(e){e.features.dragdrop&&i.addClass("has-drag-drop"),i.show().find(".progress-precent").css("width","0%")},FilesAdded:function(e){i.find(".file-browse-button").blur(),i.find(".drag-upload-area").removeClass("file-dragover"),i.find(".progress-bar").fadeIn("fast"),t.$(".js-so-selected-file").text(panelsOptions.loc.prebuilt_loading),e.start()},UploadProgress:function(e,t){i.find(".progress-precent").css("width",t.percent+"%")},FileUploaded:function(e,s,l){var o=JSON.parse(l.response);_.isUndefined(o.widgets)?alert(panelsOptions.plupload.error_message):(t.uploadedLayout=o,i.find(".progress-bar").hide(),t.$(".js-so-selected-file").text(panelsOptions.loc.ready_to_insert.replace("%s",s.name)),t.updateButtonState(!0))},Error:function(){alert(panelsOptions.plupload.error_message)}}}).init(),i.find(".drag-upload-area").on("dragover",function(){l(this).addClass("file-dragover")}).on("dragleave",function(){l(this).removeClass("file-dragover")}),e.find(".so-export").submit(function(e){l(this).find('input[name="panels_export_data"]').val(JSON.stringify(t.builder.model.getPanelsData()))})},displayLayoutDirectory:function(e,t,i){var s=this,o=this.$(".so-content").empty().addClass("so-panels-loading");if(void 0===e&&(e=""),void 0===t&&(t=1),void 0===i&&(i="directory-siteorigin"),i.match("^directory-")&&!panelsOptions.directory_enabled)return o.removeClass("so-panels-loading").html(l("#siteorigin-panels-directory-enable").html()),void o.find(".so-panels-enable-directory").click(function(n){n.preventDefault(),l.get(panelsOptions.ajaxurl,{action:"so_panels_directory_enable"},function(){}),panelsOptions.directory_enabled=!0,o.addClass("so-panels-loading"),s.displayLayoutDirectory(e,t,i)});l.get(panelsOptions.ajaxurl,{action:"so_panels_layouts_query",search:e,page:t,type:i},function(n){if(s.currentTab===i){o.removeClass("so-panels-loading").html(s.directoryTemplate(n));var a=o.find(".so-previous"),r=o.find(".so-next");t<=1?a.addClass("button-disabled"):a.click(function(i){i.preventDefault(),s.displayLayoutDirectory(e,t-1,s.currentTab)}),t===n.max_num_pages||0===n.max_num_pages?r.addClass("button-disabled"):r.click(function(i){i.preventDefault(),s.displayLayoutDirectory(e,t+1,s.currentTab)}),o.find(".so-screenshot").each(function(){var e=l(this),t=e.find(".so-screenshot-wrapper");if(t.css("height",t.width()/4*3+"px").addClass("so-loading"),""!==e.data("src"))var i=l("<img/>").attr("src",e.data("src")).load(function(){t.removeClass("so-loading").css("height","auto"),i.appendTo(t).hide().fadeIn("fast")});else l("<img/>").attr("src",panelsOptions.prebuiltDefaultScreenshot).appendTo(t).hide().fadeIn("fast")}),o.find(".so-directory-browse").html(n.title)}},"json")},directoryItemClickHandler:function(e){var t=this.$(e.target).closest(".so-directory-item");this.$(".so-directory-items").find(".selected").removeClass("selected"),t.addClass("selected"),this.selectedLayoutItem={lid:t.data("layout-id"),type:t.data("layout-type")},this.updateButtonState(!0)},toolbarButtonClick:function(e){if(!this.canAddLayout())return!1;var t=e.data("value");if(_.isUndefined(t))return!1;if(this.updateButtonState(!1),e.hasClass("so-needs-confirm")&&!e.hasClass("so-confirmed")){if(this.updateButtonState(!0),e.hasClass("so-confirming"))return;e.addClass("so-confirming");var i=e.html();return e.html('<span class="dashicons dashicons-yes"></span>'+e.data("confirm")),setTimeout(function(){e.removeClass("so-confirmed").html(i)},2500),setTimeout(function(){e.removeClass("so-confirming"),e.addClass("so-confirmed")},200),!1}this.addingLayout=!0,"import"===this.currentTab?this.addLayoutToBuilder(this.uploadedLayout,t):this.loadSelectedLayout().then(function(e){this.addLayoutToBuilder(e,t)}.bind(this))},canAddLayout:function(){return(this.selectedLayoutItem||this.uploadedLayout)&&!this.addingLayout},loadSelectedLayout:function(){this.setStatusMessage(panelsOptions.loc.prebuilt_loading,!0);var e=_.extend(this.selectedLayoutItem,{action:"so_panels_get_layout"}),t=new l.Deferred;return l.get(panelsOptions.ajaxurl,e,function(e){void 0!==e.error?(alert(e.error),t.reject(e)):(this.setStatusMessage("",!1),t.resolve(e))}.bind(this)),t.promise()},searchHandler:function(e){13===e.keyCode&&this.displayLayoutDirectory(l(e.currentTarget).val(),1,this.currentTab)},updateButtonState:function(e){e=e&&(this.selectedLayoutItem||this.uploadedLayout);var t=this.$(".so-import-layout");t.prop("disabled",!e),e?t.removeClass("disabled"):t.addClass("disabled")},addLayoutToBuilder:function(e,t){this.builder.addHistoryEntry("prebuilt_loaded"),this.builder.model.loadPanelsData(e,t),this.addingLayout=!1,this.closeDialog()}})},{}],8:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=s.view.dialog.extend({cellPreviewTemplate:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-dialog-row-cell-preview").html())),editableLabel:!0,events:{"click .so-close":"closeDialog","click .so-toolbar .so-save":"saveHandler","click .so-toolbar .so-insert":"insertHandler","click .so-toolbar .so-delete":"deleteHandler","click .so-toolbar .so-duplicate":"duplicateHandler","change .row-set-form > *":"setCellsFromForm","click .row-set-form button.set-row":"setCellsFromForm"},dialogIcon:"add-row",dialogClass:"so-panels-dialog-row-edit",styleType:"row",dialogType:"edit",row:{cells:null,style:{}},cellStylesCache:[],initializeDialog:function(){this.on("open_dialog",function(){_.isUndefined(this.model)||_.isEmpty(this.model.get("cells"))?this.setRowModel(null):this.setRowModel(this.model),this.regenerateRowPreview()},this),this.row={cells:new s.collection.cells([{weight:.5},{weight:.5}]),style:{}},this.dialogFormsLoaded=0;var e=this;this.on("form_loaded styles_loaded",function(){2===++this.dialogFormsLoaded&&e.updateModel({refreshArgs:{silent:!0}})}),this.on("close_dialog",this.closeHandler),this.on("edit_label",function(e){if(e!==panelsOptions.loc.row.add&&e!==panelsOptions.loc.row.edit||(e=""),this.model.set("label",e),_.isEmpty(e)){var t="create"===this.dialogType?panelsOptions.loc.row.add:panelsOptions.loc.row.edit;this.$(".so-title").text(t)}}.bind(this))},setRowDialogType:function(e){this.dialogType=e},render:function(){var e="create"===this.dialogType?panelsOptions.loc.row.add:panelsOptions.loc.row.edit;this.renderDialog(this.parseDialogContent(l("#siteorigin-panels-dialog-row").html(),{title:e,dialogType:this.dialogType}));var t=this.$(".so-title");this.model.has("label")&&!_.isEmpty(this.model.get("label"))&&t.text(this.model.get("label")),this.$(".so-edit-title").val(t.text()),this.styles=new s.view.styles,this.styles.model=this.model,this.styles.render("row",this.builder.config.postId,{builderType:this.builder.config.builderType,dialog:this}),this.builder.supports("addRow")||this.$(".so-buttons .so-duplicate").remove(),this.builder.supports("deleteRow")||this.$(".so-buttons .so-delete").remove();var i=this.$(".so-sidebar.so-right-sidebar");return this.styles.attach(i),this.styles.on("styles_loaded",function(e){e?i.removeClass("so-panels-loading"):(i.closest(".so-panels-dialog").removeClass("so-panels-dialog-has-right-sidebar"),i.remove())},this),i.addClass("so-panels-loading"),_.isUndefined(this.model)||this.$("input.so-row-field").val(this.model.get("cells").length),this.$("input.so-row-field").keyup(function(){l(this).trigger("change")}),this},setRowModel:function(e){return this.model=e,_.isEmpty(this.model)?this:(this.row={cells:this.model.get("cells").clone(),style:{}},this.$("input.so-row-field").val(this.model.get("cells").length),this.clearCellStylesCache(),this)},regenerateRowPreview:function(){var e=this,t=this.$(".row-preview"),i=this.getSelectedCellIndex();t.empty();var s;this.row.cells.each(function(o,n){var a=l(this.cellPreviewTemplate({weight:o.get("weight")}));t.append(a),n==i&&a.find(".preview-cell-in").addClass("cell-selected");var r,d=a.prev();d.length&&(r=l('<div class="resize-handle"></div>'),r.appendTo(a).dblclick(function(){var t=e.row.cells.at(n-1),i=o.get("weight")+t.get("weight");o.set("weight",i/2),t.set("weight",i/2),e.scaleRowWidths()}),r.draggable({axis:"x",containment:t,start:function(e,t){var i=a.clone().appendTo(t.helper).css({position:"absolute",top:"0",width:a.outerWidth(),left:6,height:a.outerHeight()});i.find(".resize-handle").remove();var s=d.clone().appendTo(t.helper).css({position:"absolute",top:"0",width:d.outerWidth(),right:6,height:d.outerHeight()});s.find(".resize-handle").remove(),l(this).data({newCellClone:i,prevCellClone:s}),a.find("> .preview-cell-in").css("visibility","hidden"),d.find("> .preview-cell-in").css("visibility","hidden")},drag:function(i,s){var o=e.row.cells.at(n).get("weight"),a=e.row.cells.at(n-1).get("weight"),r=o-(s.position.left+6)/t.width(),d=a+(s.position.left+6)/t.width();s.helper.offset().left,t.offset().left;l(this).data("newCellClone").css("width",t.width()*r).find(".preview-cell-weight").html(Math.round(1e3*r)/10),l(this).data("prevCellClone").css("width",t.width()*d).find(".preview-cell-weight").html(Math.round(1e3*d)/10)},stop:function(i,s){l(this).data("newCellClone").remove(),l(this).data("prevCellClone").remove(),a.find(".preview-cell-in").css("visibility","visible"),d.find(".preview-cell-in").css("visibility","visible");var o=s.position.left+6,r=o/t.width(),c=e.row.cells.at(n),h=e.row.cells.at(n-1);c.get("weight")-r>.02&&h.get("weight")+r>.02&&(c.set("weight",c.get("weight")-r),h.set("weight",h.get("weight")+r)),e.scaleRowWidths(),s.helper.css("left",-6)}})),a.click(function(e){if(l(e.target).is(".preview-cell")||l(e.target).is(".preview-cell-in")){var t=l(e.target);t.closest(".row-preview").find(".preview-cell .preview-cell-in").removeClass("cell-selected"),t.addClass("cell-selected"),this.openSelectedCellStyles()}}.bind(this)),a.find(".preview-cell-weight").click(function(i){e.$(".resize-handle").css("pointer-event","none").draggable("disable"),t.find(".preview-cell-weight").each(function(){var i=jQuery(this).hide();l('<input type="text" class="preview-cell-weight-input no-user-interacted" />').val(parseFloat(i.html())).insertAfter(i).focus(function(){clearTimeout(s)}).keyup(function(e){9!==e.keyCode&&l(this).removeClass("no-user-interacted"),13===e.keyCode&&(e.preventDefault(),l(this).blur())}).keydown(function(e){if(9===e.keyCode){e.preventDefault();var i=t.find(".preview-cell-weight-input"),s=i.index(l(this));s===i.length-1?i.eq(0).focus().select():i.eq(s+1).focus().select()}}).blur(function(){t.find(".preview-cell-weight-input").each(function(t,i){isNaN(parseFloat(l(i).val()))&&l(i).val(Math.floor(1e3*e.row.cells.at(t).get("weight"))/10)}),s=setTimeout(function(){if(0===t.find(".preview-cell-weight-input").length)return!1;var i=[],s=[],o=0,n=0;if(t.find(".preview-cell-weight-input").each(function(t,a){var r=parseFloat(l(a).val());r=isNaN(r)?1/e.row.cells.length:Math.round(10*r)/1e3;var d=!l(a).hasClass("no-user-interacted");i.push(r),s.push(d),d?o+=r:n+=r}),o>0&&n>0&&1-o>0)for(var a=0;a<i.length;a++)s[a]||(i[a]=i[a]/n*(1-o));var r=_.reduce(i,function(e,t){return e+t});i=i.map(function(e){return e/r}),Math.min.apply(Math,i)>.01&&e.row.cells.each(function(e,t){e.set("weight",i[t])}),t.find(".preview-cell").each(function(t,i){var s=e.row.cells.at(t).get("weight");l(i).animate({width:Math.round(1e3*s)/10+"%"},250),l(i).find(".preview-cell-weight-input").val(Math.round(1e3*s)/10)}),t.find(".preview-cell").css("overflow","visible"),setTimeout(function(){e.regenerateRowPreview()},260)},100)}).click(function(){l(this).select()})}),l(this).siblings(".preview-cell-weight-input").select()})},this),this.openSelectedCellStyles(),this.trigger("form_loaded",this)},getSelectedCellIndex:function(){var e=-1;return this.$(".preview-cell .preview-cell-in").each(function(t,i){l(i).is(".cell-selected")&&(e=t)}),e},openSelectedCellStyles:function(){if(!_.isUndefined(this.cellStyles)){if(this.cellStyles.stylesLoaded){var e={};try{e=this.getFormValues(".so-sidebar .so-visual-styles.so-cell-styles").style}catch(e){console.log("Error retrieving cell styles - "+e.message)}this.cellStyles.model.set("style",e)}this.cellStyles.detach()}if(this.cellStyles=this.getSelectedCellStyles(),this.cellStyles){var t=this.$(".so-sidebar.so-right-sidebar");this.cellStyles.attach(t),this.cellStyles.stylesLoaded||(this.cellStyles.on("styles_loaded",function(){t.removeClass("so-panels-loading")},this),t.addClass("so-panels-loading"))}},getSelectedCellStyles:function(){var e=this.getSelectedCellIndex();if(e>-1){var t=this.cellStylesCache[e];t||(t=new s.view.styles,t.model=this.row.cells.at(e),t.render("cell",this.builder.config.postId,{builderType:this.builder.config.builderType,dialog:this,index:e}),this.cellStylesCache[e]=t)}return t},clearCellStylesCache:function(){this.cellStylesCache.forEach(function(e){e.remove()}),this.cellStylesCache=[]},scaleRowWidths:function(){var e=this;this.$(".row-preview .preview-cell").each(function(t,i){var s=e.row.cells.at(t);l(i).css("width",100*s.get("weight")+"%").find(".preview-cell-weight").html(Math.round(1e3*s.get("weight"))/10)})},setCellsFromForm:function(){try{var e={cells:parseInt(this.$('.row-set-form input[name="cells"]').val()),ratio:parseFloat(this.$('.row-set-form select[name="ratio"]').val()),direction:this.$('.row-set-form select[name="ratio_direction"]').val()};_.isNaN(e.cells)&&(e.cells=1),isNaN(e.ratio)&&(e.ratio=1),e.cells<1?(e.cells=1,this.$('.row-set-form input[name="cells"]').val(e.cells)):e.cells>12&&(e.cells=12,this.$('.row-set-form input[name="cells"]').val(e.cells)),this.$('.row-set-form input[name="ratio"]').val(e.ratio);for(var t=[],i=this.row.cells.length!==e.cells,o=1,n=0;n<e.cells;n++)t.push(o),o*=e.ratio;var a=_.reduce(t,function(e,t){return e+t});if(t=_.map(t,function(e){return e/a}),t=_.filter(t,function(e){return e>.01}),"left"===e.direction&&(t=t.reverse()),this.row.cells=new s.collection.cells(this.row.cells.first(t.length)),_.each(t,function(e,t){var i=this.row.cells.at(t);i?i.set("weight",e):(i=new s.model.cell({weight:e,row:this.model}),this.row.cells.add(i))}.bind(this)),i)this.regenerateRowPreview();else{var r=this;this.$(".preview-cell").each(function(e,t){var i=r.row.cells.at(e).get("weight");l(t).animate({width:Math.round(1e3*i)/10+"%"},250),l(t).find(".preview-cell-weight").html(Math.round(1e3*i)/10)}),this.$(".preview-cell").css("overflow","visible"),setTimeout(function(){r.regenerateRowPreview()},260)}}catch(e){console.log("Error setting cells - "+e.message)}this.$(".row-set-form .so-button-row-set").removeClass("button-primary")},tabClickHandler:function(e){"#row-layout"===e.attr("href")?this.$(".so-panels-dialog").addClass("so-panels-dialog-has-right-sidebar"):this.$(".so-panels-dialog").removeClass("so-panels-dialog-has-right-sidebar")},updateModel:function(e){if(e=_.extend({refresh:!0,refreshArgs:null},e),_.isEmpty(this.model)||this.model.setCells(this.row.cells),!_.isUndefined(this.styles)&&this.styles.stylesLoaded){var t={};try{t=this.getFormValues(".so-sidebar .so-visual-styles.so-row-styles").style}catch(e){console.log("Error retrieving row styles - "+e.message)}this.model.set("style",t)}if(!_.isUndefined(this.cellStyles)&&this.cellStyles.stylesLoaded){var t={};try{t=this.getFormValues(".so-sidebar .so-visual-styles.so-cell-styles").style}catch(e){console.log("Error retrieving cell styles - "+e.message)}this.cellStyles.model.set("style",t)}e.refresh&&this.builder.model.refreshPanelsData(e.refreshArgs)},insertHandler:function(){this.builder.addHistoryEntry("row_added"),this.updateModel();var e=this.builder.getActiveCell({createCell:!1}),t={};return null!==e&&(t.at=this.builder.model.get("rows").indexOf(e.row)+1),this.model.collection=this.builder.model.get("rows"),this.builder.model.get("rows").add(this.model,t),this.closeDialog(),this.builder.model.refreshPanelsData(),!1},saveHandler:function(){return this.builder.addHistoryEntry("row_edited"),this.updateModel(),this.closeDialog(),this.builder.model.refreshPanelsData(),!1},deleteHandler:function(){return this.model.trigger("visual_destroy"),this.closeDialog({silent:!0}),!1},duplicateHandler:function(){this.builder.addHistoryEntry("row_duplicated");var e=this.model.clone(this.builder.model);return this.builder.model.get("rows").add(e,{at:this.builder.model.get("rows").indexOf(this.model)+1}),this.closeDialog({silent:!0}),!1},closeHandler:function(){this.clearCellStylesCache(),_.isUndefined(this.cellStyles)||(this.cellStyles=void 0)}})},{}],9:[function(e,t,i){var s=window.panels,l=jQuery,o=e("../view/widgets/js-widget");t.exports=s.view.dialog.extend({builder:null,sidebarWidgetTemplate:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-dialog-widget-sidebar-widget").html())),dialogClass:"so-panels-dialog-edit-widget",dialogIcon:"add-widget",widgetView:!1,savingWidget:!1,editableLabel:!0,events:{"click .so-close":"saveHandler","click .so-nav.so-previous":"navToPrevious","click .so-nav.so-next":"navToNext","click .so-toolbar .so-delete":"deleteHandler","click .so-toolbar .so-duplicate":"duplicateHandler"},initializeDialog:function(){var e=this;this.model.on("change:values",this.handleChangeValues,this),this.model.on("destroy",this.remove,this),this.dialogFormsLoaded=0,this.on("form_loaded styles_loaded",function(){2===++this.dialogFormsLoaded&&e.updateModel({refreshArgs:{silent:!0}})}),this.on("edit_label",function(e){e===panelsOptions.widgets[this.model.get("class")].title&&(e=""),this.model.set("label",e),_.isEmpty(e)&&this.$(".so-title").text(this.model.getWidgetField("title"))}.bind(this))},render:function(){this.renderDialog(this.parseDialogContent(l("#siteorigin-panels-dialog-widget").html(),{})),this.loadForm();var e=this.model.getWidgetField("title");this.$(".so-title .widget-name").html(e),this.$(".so-edit-title").val(e),this.builder.supports("addWidget")||this.$(".so-buttons .so-duplicate").remove(),this.builder.supports("deleteWidget")||this.$(".so-buttons .so-delete").remove(),this.styles=new s.view.styles,this.styles.model=this.model,this.styles.render("widget",this.builder.config.postId,{builderType:this.builder.config.builderType,dialog:this});var t=this.$(".so-sidebar.so-right-sidebar");this.styles.attach(t),this.styles.on("styles_loaded",function(e){e?t.removeClass("so-panels-loading"):(t.closest(".so-panels-dialog").removeClass("so-panels-dialog-has-right-sidebar"),t.remove())},this),t.addClass("so-panels-loading")},getPrevDialog:function(){var e=this.builder.$(".so-cells .cell .so-widget");if(e.length<=1)return!1;var t=e.index(this.widgetView.$el);if(0===t)return!1;do{if(widgetView=e.eq(--t).data("view"),!_.isUndefined(widgetView)&&!widgetView.model.get("read_only"))return widgetView.getEditDialog()}while(!_.isUndefined(widgetView)&&t>0);return!1},getNextDialog:function(){var e=this.builder.$(".so-cells .cell .so-widget");if(e.length<=1)return!1;var t,i=e.index(this.widgetView.$el);if(i===e.length-1)return!1;do{if(t=e.eq(++i).data("view"),!_.isUndefined(t)&&!t.model.get("read_only"))return t.getEditDialog()}while(!_.isUndefined(t));return!1},loadForm:function(){if(this.$("> *").length){this.$(".so-content").addClass("so-panels-loading");var e={action:"so_panels_widget_form",widget:this.model.get("class"),instance:JSON.stringify(this.model.get("values")),raw:this.model.get("raw")};l.post(panelsOptions.ajaxurl,e,function(e){var t=e.replace(/{\$id}/g,this.model.cid),i=this.$(".so-content");i.removeClass("so-panels-loading").html(t),this.trigger("form_loaded",this),this.$(".panel-dialog").trigger("panelsopen"),this.on("close_dialog",this.updateModel,this),i.find("> .widget-content").length>0&&o.addWidget(i,this.model.widget_id)}.bind(this),"html")}},updateModel:function(e){if(e=_.extend({refresh:!0,refreshArgs:null},e),this.savingWidget=!0,!this.model.get("missing")){var t=this.getFormValues();_.isUndefined(t.widgets)?t={}:(t=t.widgets,t=t[Object.keys(t)[0]]),this.model.setValues(t),this.model.set("raw",!0)}if(this.styles.stylesLoaded){var i={};try{i=this.getFormValues(".so-sidebar .so-visual-styles").style}catch(e){}this.model.set("style",i)}this.savingWidget=!1,e.refresh&&this.builder.model.refreshPanelsData(e.refreshArgs)},handleChangeValues:function(){this.savingWidget||this.loadForm()},saveHandler:function(){this.builder.addHistoryEntry("widget_edited"),this.closeDialog()},deleteHandler:function(){return this.model.trigger("visual_destroy"),this.closeDialog({silent:!0}),this.builder.model.refreshPanelsData(),!1},duplicateHandler:function(){return this.model.trigger("user_duplicate"),this.closeDialog({silent:!0}),this.builder.model.refreshPanelsData(),!1}})},{"../view/widgets/js-widget":30}],10:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=s.view.dialog.extend({builder:null,widgetTemplate:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-dialog-widgets-widget").html())),filter:{},dialogClass:"so-panels-dialog-add-widget",dialogIcon:"add-widget",events:{"click .so-close":"closeDialog","click .widget-type":"widgetClickHandler","keyup .so-sidebar-search":"searchHandler"},initializeDialog:function(){this.on("open_dialog",function(){this.filter.search="",this.filterWidgets(this.filter)},this),this.on("open_dialog_complete",function(){this.$(".so-sidebar-search").val("").focus(),this.balanceWidgetHeights()}),this.on("tab_click",this.tabClickHandler,this)},render:function(){this.renderDialog(this.parseDialogContent(l("#siteorigin-panels-dialog-widgets").html(),{})),_.each(panelsOptions.widgets,function(e){var t=l(this.widgetTemplate({title:e.title,description:e.description}));_.isUndefined(e.icon)&&(e.icon="dashicons dashicons-admin-generic"),l('<span class="widget-icon" />').addClass(e.icon).prependTo(t.find(".widget-type-wrapper")),t.data("class",e.class).appendTo(this.$(".widget-type-list"))},this);var e=this.$(".so-sidebar-tabs");_.each(panelsOptions.widget_dialog_tabs,function(t){l(this.dialogTabTemplate({title:t.title})).data({message:t.message,filter:t.filter}).appendTo(e)},this),this.initTabs();var t=this;l(window).resize(function(){t.balanceWidgetHeights()})},tabClickHandler:function(e){this.filter=e.parent().data("filter"),this.filter.search=this.$(".so-sidebar-search").val();var t=e.parent().data("message");return _.isEmpty(t)&&(t=""),this.$(".so-toolbar .so-status").html(t),this.filterWidgets(this.filter),!1},searchHandler:function(e){if(13===e.which){var t=this.$(".widget-type-list .widget-type:visible");1===t.length&&t.click()}else this.filter.search=l(e.target).val().trim(),this.filterWidgets(this.filter)},filterWidgets:function(e){_.isUndefined(e)&&(e={}),_.isUndefined(e.groups)&&(e.groups=""),this.$(".widget-type-list .widget-type").each(function(){var t,i=l(this),s=i.data("class"),o=_.isUndefined(panelsOptions.widgets[s])?null:panelsOptions.widgets[s];t=!!_.isEmpty(e.groups)||null!==o&&!_.isEmpty(_.intersection(e.groups,panelsOptions.widgets[s].groups)),t&&(_.isUndefined(e.search)||""===e.search||-1===o.title.toLowerCase().indexOf(e.search.toLowerCase())&&(t=!1)),t?i.show():i.hide()}),this.balanceWidgetHeights()},widgetClickHandler:function(e){this.builder.addHistoryEntry("widget_added");var t=l(e.currentTarget),i=new s.model.widget({class:t.data("class")});i.cell=this.builder.getActiveCell(),i.cell.get("widgets").add(i),this.closeDialog(),this.builder.model.refreshPanelsData()},balanceWidgetHeights:function(e){var t=[[]],i=null,s=Math.round(this.$(".widget-type").parent().width()/this.$(".widget-type").width());this.$(".widget-type").css("clear","none").filter(":visible").each(function(e,t){e%s==0&&0!==e&&l(t).css("clear","both")}),this.$(".widget-type-wrapper").css("height","auto").filter(":visible").each(function(e,s){var o=l(s);null!==i&&i.position().top!==o.position().top&&(t[t.length]=[]),i=o,t[t.length-1].push(o)}),_.each(t,function(e,t){var i=_.max(e.map(function(e){return e.height()}));_.each(e,function(e){e.height(i)})})}})},{}],11:[function(e,t,i){t.exports={
2
+ canCopyPaste:function(){return"undefined"!=typeof Storage&&panelsOptions.user},setModel:function(e){if(!this.canCopyPaste())return!1;var t=panels.helpers.serialize.serialize(e);return e instanceof panels.model.row?t.thingType="row-model":e instanceof panels.model.widget&&(t.thingType="widget-model"),localStorage["panels_clipboard_"+panelsOptions.user]=JSON.stringify(t),!0},isModel:function(e){if(!this.canCopyPaste())return!1;var t=localStorage["panels_clipboard_"+panelsOptions.user];return void 0!==t&&(t=JSON.parse(t),t.thingType&&t.thingType===e)},getModel:function(e){if(!this.canCopyPaste())return null;var t=localStorage["panels_clipboard_"+panelsOptions.user];return void 0!==t&&(t=JSON.parse(t),t.thingType&&t.thingType===e)?panels.helpers.serialize.unserialize(t,t.thingType,null):null}}},{}],12:[function(e,t,i){t.exports={lock:function(){if("hidden"!==jQuery("body").css("overflow")){var e=[self.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,self.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop];jQuery("body").data({"scroll-position":e}).css("overflow","hidden"),_.isUndefined(e)||window.scrollTo(e[0],e[1])}},unlock:function(){if("hidden"===jQuery("body").css("overflow")&&!jQuery(".so-panels-dialog-wrapper").is(":visible")&&!jQuery(".so-panels-live-editor").is(":visible")){jQuery("body").css("overflow","visible");var e=jQuery("body").data("scroll-position");_.isUndefined(e)||window.scrollTo(e[0],e[1])}}}},{}],13:[function(e,t,i){t.exports={serialize:function(e){var t;if(e instanceof Backbone.Model){var i={};for(var s in e.attributes)if(e.attributes.hasOwnProperty(s)){if("builder"===s||"collection"===s)continue;t=e.attributes[s],t instanceof Backbone.Model||t instanceof Backbone.Collection?i[s]=this.serialize(t):i[s]=t}return i}if(e instanceof Backbone.Collection){for(var l=[],o=0;o<e.models.length;o++)t=e.models[o],t instanceof Backbone.Model||t instanceof Backbone.Collection?l.push(this.serialize(t)):l.push(t);return l}},unserialize:function(e,t,i){var s;switch(t){case"row-model":s=new panels.model.row,s.builder=i,s.set("style",e.style),s.setCells(this.unserialize(e.cells,"cell-collection",s));break;case"cell-model":s=new panels.model.cell,s.row=i,s.set("weight",e.weight),s.set("style",e.style),s.set("widgets",this.unserialize(e.widgets,"widget-collection",s));break;case"widget-model":s=new panels.model.widget,s.cell=i;for(var l in e)e.hasOwnProperty(l)&&s.set(l,e[l]);s.set("widget_id",panels.helpers.utils.generateUUID());break;case"cell-collection":s=new panels.collection.cells;for(var o=0;o<e.length;o++)s.push(this.unserialize(e[o],"cell-model",i));break;case"widget-collection":s=new panels.collection.widgets;for(var o=0;o<e.length;o++)s.push(this.unserialize(e[o],"widget-model",i));break;default:console.log("Unknown Thing - "+t)}return s}}},{}],14:[function(e,t,i){t.exports={generateUUID:function(){var e=(new Date).getTime();return window.performance&&"function"==typeof window.performance.now&&(e+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var i=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"==t?i:3&i|8).toString(16)})},processTemplate:function(e){return e=e.replace(/{{%/g,"<%"),e=e.replace(/%}}/g,"%>"),e=e.trim()},selectElementContents:function(e){var t=document.createRange();t.selectNodeContents(e);var i=window.getSelection();i.removeAllRanges(),i.addRange(t)}}},{}],15:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=function(e){return this.each(function(){var t=jQuery(this),i=t.closest("form").find(".widget-id").val(),o=l.extend(!0,{},e);if(_.isUndefined(i)||!(i.indexOf("__i__")>-1)){var n=new s.model.builder,a=new s.view.builder({model:n,config:o}),r=t.closest(".so-panels-dialog-wrapper").data("view");_.isUndefined(r)||(r.on("close_dialog",function(){n.refreshPanelsData()}),r.on("open_dialog_complete",function(){a.trigger("builder_resize")}),r.model.on("destroy",function(){n.emptyRows().destroy()}),a.setDialogParents(panelsOptions.loc.layout_widget,r));var d=Boolean(t.closest(".widget-content").length);a.render().attach({container:t,dialog:d||"dialog"===t.data("mode"),type:t.data("type")}).setDataField(t.find("input.panels-data")),d||"dialog"===t.data("mode")?(a.setDialogParents(panelsOptions.loc.layout_widget,a.dialog),t.find(".siteorigin-panels-display-builder").click(function(e){e.preventDefault(),a.dialog.openDialog()})):t.find(".siteorigin-panels-display-builder").parent().remove(),l(document).trigger("panels_setup",a)}})}},{}],16:[function(e,t,i){var s={};window.panels=s,window.siteoriginPanels=s,s.helpers={},s.helpers.clipboard=e("./helpers/clipboard"),s.helpers.utils=e("./helpers/utils"),s.helpers.serialize=e("./helpers/serialize"),s.helpers.pageScroll=e("./helpers/page-scroll"),s.model={},s.model.widget=e("./model/widget"),s.model.cell=e("./model/cell"),s.model.row=e("./model/row"),s.model.builder=e("./model/builder"),s.model.historyEntry=e("./model/history-entry"),s.collection={},s.collection.widgets=e("./collection/widgets"),s.collection.cells=e("./collection/cells"),s.collection.rows=e("./collection/rows"),s.collection.historyEntries=e("./collection/history-entries"),s.view={},s.view.widget=e("./view/widget"),s.view.cell=e("./view/cell"),s.view.row=e("./view/row"),s.view.builder=e("./view/builder"),s.view.dialog=e("./view/dialog"),s.view.styles=e("./view/styles"),s.view.liveEditor=e("./view/live-editor"),s.dialog={},s.dialog.builder=e("./dialog/builder"),s.dialog.widgets=e("./dialog/widgets"),s.dialog.widget=e("./dialog/widget"),s.dialog.prebuilt=e("./dialog/prebuilt"),s.dialog.row=e("./dialog/row"),s.dialog.history=e("./dialog/history"),s.utils={},s.utils.menu=e("./utils/menu"),jQuery.fn.soPanelsSetupBuilderWidget=e("./jquery/setup-builder-widget"),jQuery(function(e){var t,i,s,l;if(e("#siteorigin-panels-metabox").length&&e("form#post").length)t=e("#siteorigin-panels-metabox"),i=e("#siteorigin-panels-metabox .siteorigin-panels-data-field"),s=e("form#post"),l={editorType:"tinyMCE",postId:e("#post_ID").val(),editorId:"#content",builderType:e("#siteorigin-panels-metabox").data("builder-type"),builderSupports:e("#siteorigin-panels-metabox").data("builder-supports"),loadOnAttach:panelsOptions.loadOnAttach&&1==e("#auto_draft").val(),loadLiveEditor:1==e("#siteorigin-panels-metabox").data("live-editor"),liveEditorPreview:t.data("preview-url")};else if(e(".siteorigin-panels-builder-form").length){var o=e(".siteorigin-panels-builder-form");t=o.find(".siteorigin-panels-builder-container"),i=o.find('input[name="panels_data"]'),s=o,l={editorType:"standalone",postId:o.data("post-id"),editorId:"#post_content",builderType:o.data("type"),builderSupports:o.data("builder-supports"),loadLiveEditor:!1,liveEditorPreview:o.data("preview-url")}}if(!_.isUndefined(t)){var n=window.siteoriginPanels,a=new n.model.builder,r=new n.view.builder({model:a,config:l});r.render().attach({container:t}).setDataField(i).attachToEditor(),s.submit(function(){a.refreshPanelsData()}),t.removeClass("so-panels-loading"),e(document).trigger("panels_setup",r,window.panels)}e(document).on("widget-added",function(t,i){e(i).find(".siteorigin-page-builder-widget").soPanelsSetupBuilderWidget()}),e("body").hasClass("wp-customizer")||e(function(){e(".siteorigin-page-builder-widget").soPanelsSetupBuilderWidget()})})},{"./collection/cells":1,"./collection/history-entries":2,"./collection/rows":3,"./collection/widgets":4,"./dialog/builder":5,"./dialog/history":6,"./dialog/prebuilt":7,"./dialog/row":8,"./dialog/widget":9,"./dialog/widgets":10,"./helpers/clipboard":11,"./helpers/page-scroll":12,"./helpers/serialize":13,"./helpers/utils":14,"./jquery/setup-builder-widget":15,"./model/builder":17,"./model/cell":18,"./model/history-entry":19,"./model/row":20,"./model/widget":21,"./utils/menu":22,"./view/builder":23,"./view/cell":24,"./view/dialog":25,"./view/live-editor":26,"./view/row":27,"./view/styles":28,"./view/widget":29}],17:[function(e,t,i){t.exports=Backbone.Model.extend({layoutPosition:{BEFORE:"before",AFTER:"after",REPLACE:"replace"},rows:{},defaults:{data:{widgets:[],grids:[],grid_cells:[]}},initialize:function(){this.set("rows",new panels.collection.rows)},addRow:function(e,t,i){i=_.extend({noAnimate:!1},i);var s=new panels.collection.cells(t);e=_.extend({collection:this.get("rows"),cells:s},e);var l=new panels.model.row(e);return l.builder=this,this.get("rows").add(l,i),l},loadPanelsData:function(e,t){try{t===this.layoutPosition.BEFORE?e=this.concatPanelsData(e,this.getPanelsData()):t===this.layoutPosition.AFTER&&(e=this.concatPanelsData(this.getPanelsData(),e)),this.emptyRows(),this.set("data",JSON.parse(JSON.stringify(e)),{silent:!0});var i=[];if(_.isUndefined(e.grid_cells))return void this.trigger("load_panels_data");for(var s,l=0;l<e.grid_cells.length;l++)s=parseInt(e.grid_cells[l].grid),_.isUndefined(i[s])&&(i[s]=[]),i[s].push(e.grid_cells[l]);var o=this;if(_.each(i,function(t,i){var s={};_.isUndefined(e.grids[i].style)||(s.style=e.grids[i].style),_.isUndefined(e.grids[i].color_label)||(s.color_label=e.grids[i].color_label),_.isUndefined(e.grids[i].label)||(s.label=e.grids[i].label),o.addRow(s,t,{noAnimate:!0})}),_.isUndefined(e.widgets))return;_.each(e.widgets,function(e){var t=null;_.isUndefined(e.panels_info)?(t=e.info,delete e.info):(t=e.panels_info,delete e.panels_info);var i=o.get("rows").at(parseInt(t.grid)),s=i.get("cells").at(parseInt(t.cell)),l=new panels.model.widget({class:t.class,values:e});_.isUndefined(t.style)||l.set("style",t.style),_.isUndefined(t.read_only)||l.set("read_only",t.read_only),_.isUndefined(t.widget_id)?l.set("widget_id",panels.helpers.utils.generateUUID()):l.set("widget_id",t.widget_id),_.isUndefined(t.label)||l.set("label",t.label),l.cell=s,s.get("widgets").add(l,{noAnimate:!0})}),this.trigger("load_panels_data")}catch(e){console.log("Error loading data: "+e.message)}},concatPanelsData:function(e,t){if(_.isUndefined(t)||_.isUndefined(t.grids)||_.isEmpty(t.grids)||_.isUndefined(t.grid_cells)||_.isEmpty(t.grid_cells))return e;if(_.isUndefined(e)||_.isUndefined(e.grids)||_.isEmpty(e.grids))return t;var i=e.grids.length,s=_.isUndefined(e.widgets)?0:e.widgets.length,l={grids:[],grid_cells:[],widgets:[]};l.grids=e.grids.concat(t.grids),_.isUndefined(e.grid_cells)||(l.grid_cells=e.grid_cells.slice()),_.isUndefined(e.widgets)||(l.widgets=e.widgets.slice());var o;for(o=0;o<t.grid_cells.length;o++){var n=t.grid_cells[o];n.grid=parseInt(n.grid)+i,l.grid_cells.push(n)}if(!_.isUndefined(t.widgets))for(o=0;o<t.widgets.length;o++){var a=t.widgets[o];a.panels_info.grid=parseInt(a.panels_info.grid)+i,a.panels_info.id=parseInt(a.panels_info.id)+s,l.widgets.push(a)}return l},getPanelsData:function(){var e={widgets:[],grids:[],grid_cells:[]},t=0;return this.get("rows").each(function(i,s){i.get("cells").each(function(i,l){i.get("widgets").each(function(i,o){var n={class:i.get("class"),raw:i.get("raw"),grid:s,cell:l,id:t++,widget_id:i.get("widget_id"),style:i.get("style"),label:i.get("label")};_.isEmpty(n.widget_id)&&(n.widget_id=panels.helpers.utils.generateUUID());var a=_.extend(_.clone(i.get("values")),{panels_info:n});e.widgets.push(a)}),e.grid_cells.push({grid:s,index:l,weight:i.get("weight"),style:i.get("style")})}),e.grids.push({cells:i.get("cells").length,style:i.get("style"),color_label:i.get("color_label"),label:i.get("label")})}),e},refreshPanelsData:function(e){e=_.extend({silent:!1},e);var t=this.get("data"),i=this.getPanelsData();this.set("data",i,{silent:!0}),e.silent||JSON.stringify(i)===JSON.stringify(t)||(this.trigger("change"),this.trigger("change:data"),this.trigger("refresh_panels_data",i,e))},emptyRows:function(){return _.invoke(this.get("rows").toArray(),"destroy"),this.get("rows").reset(),this},isValidLayoutPosition:function(e){return e===this.layoutPosition.BEFORE||e===this.layoutPosition.AFTER||e===this.layoutPosition.REPLACE},getPanelsDataFromHtml:function(e,t){var i=this,s=jQuery('<div id="wrapper">'+e+"</div>");if(s.find(".panel-layout .panel-grid").length){var l={grids:[],grid_cells:[],widgets:[]},o=new RegExp(panelsOptions.siteoriginWidgetRegex,"i"),n=function(){function e(e){return e&&"string"==typeof e&&(e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,""),e=e.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim,""),t.innerHTML=e,e=t.textContent,t.textContent=""),e}var t=document.createElement("div");return e}(),a=function(e){var t=e.find("div");if(!t.length)return e.html();var i;for(i=0;i<t.length-1&&jQuery.trim(t.eq(i).text())==jQuery.trim(t.eq(i+1).text());i++);var s=t.eq(i).find(".widget-title:header"),l="";return s.length&&(l=s.html(),s.remove()),{title:l,text:t.eq(i).html()}},r=s.find(".panel-layout").eq(0),d=function(e,t){return jQuery(t).closest(".panel-layout").is(r)};return s.find("> .panel-layout > .panel-grid").filter(d).each(function(e,s){var r=jQuery(s),c=r.find(".panel-grid-cell").filter(d);l.grids.push({cells:c.length,style:r.data("style"),color_label:r.data("color-label"),label:r.data("label")}),c.each(function(s,r){var c=jQuery(r),h=c.find(".so-panel").filter(d);l.grid_cells.push({grid:e,weight:_.isUndefined(c.data("weight"))?1:parseFloat(c.data("weight")),style:c.data("style")}),h.each(function(r,d){var c=jQuery(d),h=c.find(".panel-widget-style").length?c.find(".panel-widget-style").html():c.html(),u={grid:e,cell:s,raw:!1,label:c.data("label")};h=h.trim();var p=o.exec(h);if(!_.isNull(p)&&""===h.replace(o,"").trim()){try{var g=/class="(.*?)"/.exec(p[3]),f=jQuery(p[5]),w=JSON.parse(n(f.val())),m=w.instance;u.class=g[1].replace(/\\\\+/g,"\\"),u.raw=!1,m.panels_info=u,l.widgets.push(m)}catch(e){u.class=t,l.widgets.push(_.extend(a(c),{filter:"1",type:"visual",panels_info:u}))}return!0}if(-1!==h.indexOf("panel-layout")){if(jQuery("<div>"+h+"</div>").find(".panel-layout .panel-grid").length)return u.class="SiteOrigin_Panels_Widgets_Layout",l.widgets.push({panels_data:i.getPanelsDataFromHtml(h,t),panels_info:u}),!0}return u.class=t,l.widgets.push(_.extend(a(c),{filter:"1",type:"visual",panels_info:u})),!0})})}),s.find(".panel-layout").remove(),s.find("style[data-panels-style-for-post]").remove(),s.html().replace(/^\s+|\s+$/gm,"").length&&(l.grids.push({cells:1,style:{}}),l.grid_cells.push({grid:l.grids.length-1,weight:1}),l.widgets.push({filter:"1",text:s.html().replace(/^\s+|\s+$/gm,""),title:"",type:"visual",panels_info:{class:t,raw:!1,grid:l.grids.length-1,cell:0}})),l}return{grid_cells:[{grid:0,weight:1}],grids:[{cells:1}],widgets:[{filter:"1",text:e,title:"",type:"visual",panels_info:{class:t,raw:!1,grid:0,cell:0}}]}}})},{}],18:[function(e,t,i){t.exports=Backbone.Model.extend({widgets:{},row:null,defaults:{weight:0,style:{}},indexes:null,initialize:function(){this.set("widgets",new panels.collection.widgets),this.on("destroy",this.onDestroy,this)},onDestroy:function(){_.invoke(this.get("widgets").toArray(),"destroy"),this.get("widgets").reset()},clone:function(e,t){_.isUndefined(e)&&(e=this.row),t=_.extend({cloneWidgets:!0},t);var i=new this.constructor(this.attributes);return i.set("collection",e.get("cells"),{silent:!0}),i.row=e,t.cloneWidgets&&this.get("widgets").each(function(e){i.get("widgets").add(e.clone(i,t),{silent:!0})}),i}})},{}],19:[function(e,t,i){t.exports=Backbone.Model.extend({defaults:{text:"",data:"",time:null,count:1}})},{}],20:[function(e,t,i){t.exports=Backbone.Model.extend({builder:null,defaults:{style:{}},indexes:null,initialize:function(){_.isEmpty(this.get("cells"))?this.set("cells",new panels.collection.cells):this.get("cells").each(function(e){e.row=this}.bind(this)),this.on("destroy",this.onDestroy,this)},setCells:function(e){var t=this.get("cells")||new panels.collection.cells,i=[];t.each(function(s,l){var o=e.at(l);if(o)s.set("weight",o.get("weight"));else{for(var n=t.at(e.length-1),a=s.get("widgets").models.slice(),r=0;r<a.length;r++)a[r].moveToCell(n,{silent:!1});i.push(s)}}),_.each(i,function(e){t.remove(e)}),e.length>t.length&&_.each(e.slice(t.length,e.length),function(e){e.set({collection:t}),e.row=this,t.add(e)}.bind(this)),this.reweightCells()},reweightCells:function(){var e=0,t=this.get("cells");t.each(function(t){e+=t.get("weight")}),t.each(function(t){t.set("weight",t.get("weight")/e)}),this.trigger("reweight_cells")},onDestroy:function(){_.invoke(this.get("cells").toArray(),"destroy"),this.get("cells").reset()},clone:function(e){_.isUndefined(e)&&(e=this.builder);var t=new this.constructor(this.attributes);t.set("collection",e.get("rows"),{silent:!0}),t.builder=e;var i=new panels.collection.cells;return this.get("cells").each(function(e){i.add(e.clone(t),{silent:!0})}),t.set("cells",i),t}})},{}],21:[function(e,t,i){t.exports=Backbone.Model.extend({cell:null,defaults:{class:null,missing:!1,values:{},raw:!1,style:{},read_only:!1,widget_id:""},indexes:null,initialize:function(){var e=this.get("class");!_.isUndefined(panelsOptions.widgets[e])&&panelsOptions.widgets[e].installed||this.set("missing",!0)},getWidgetField:function(e){return _.isUndefined(panelsOptions.widgets[this.get("class")])?"title"===e||"description"===e?panelsOptions.loc.missing_widget[e]:"":this.has("label")&&!_.isEmpty(this.get("label"))?this.get("label"):panelsOptions.widgets[this.get("class")][e]},moveToCell:function(e,t,i){return t=_.extend({silent:!0},t),this.cell=e,this.collection.remove(this,t),e.get("widgets").add(this,_.extend({at:i},t)),this.trigger("move_to_cell",e,i),this},triggerEdit:function(){this.trigger("user_edit",this)},triggerDuplicate:function(){this.trigger("user_duplicate",this)},setValues:function(e){var t=!1;JSON.stringify(e)!==JSON.stringify(this.get("values"))&&(t=!0),this.set("values",e,{silent:!0}),t&&(this.trigger("change",this),this.trigger("change:values"))},clone:function(e,t){_.isUndefined(e)&&(e=this.cell);var i=new this.constructor(this.attributes),s=JSON.parse(JSON.stringify(this.get("values"))),l=function(e){return _.each(e,function(t,i){_.isString(i)&&"_"===i[0]?delete e[i]:_.isObject(e[i])&&l(e[i])}),e};return s=l(s),"SiteOrigin_Panels_Widgets_Layout"===this.get("class")&&(s.builder_id=Math.random().toString(36).substr(2)),i.set("values",s,{silent:!0}),i.set("collection",e.get("widgets"),{silent:!0}),i.cell=e,i.isDuplicate=!0,i},getTitle:function(){var e=panelsOptions.widgets[this.get("class")];if(_.isUndefined(e))return this.get("class").replace(/_/g," ");if(!_.isUndefined(e.panels_title)&&!1===e.panels_title)return panelsOptions.widgets[this.get("class")].description;var t=this.get("values"),i=["title","text"];for(var s in t)t.hasOwnProperty(s)&&i.push(s);i=_.uniq(i);for(var l in i)if(!_.isUndefined(t[i[l]])&&_.isString(t[i[l]])&&""!==t[i[l]]&&"on"!==t[i[l]]&&"_"!==i[l][0]&&!jQuery.isNumeric(t[i[l]])){var o=t[i[l]];o=o.replace(/<\/?[^>]+(>|$)/g,"");var n=o.split(" ");return n=n.slice(0,20),n.join(" ")}return this.getWidgetField("description")}})},{}],22:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=Backbone.View.extend({wrapperTemplate:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-context-menu").html())),sectionTemplate:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-context-menu-section").html())),contexts:[],active:!1,events:{"keyup .so-search-wrapper input":"searchKeyUp"},initialize:function(){this.listenContextMenu(),this.render(),this.attach()},listenContextMenu:function(){var e=this;l(window).on("contextmenu",function(t){return e.active&&!e.isOverEl(e.$el,t)?(e.closeMenu(),e.active=!1,t.preventDefault(),!1):!!e.active||(e.active=!1,e.trigger("activate_context",t,e),void(e.active&&(t.preventDefault(),e.openMenu({left:t.pageX,top:t.pageY}))))})},render:function(){this.setElement(this.wrapperTemplate())},attach:function(){this.$el.appendTo("body")},openMenu:function(e){this.trigger("open_menu"),l(window).on("keyup",{menu:this},this.keyboardListen),l(window).on("click",{menu:this},this.clickOutsideListen),this.$el.css("max-height",l(window).height()-20),e.left+this.$el.outerWidth()+10>=l(window).width()&&(e.left=l(window).width()-this.$el.outerWidth()-10),e.left<=0&&(e.left=10),e.top+this.$el.outerHeight()-l(window).scrollTop()+10>=l(window).height()&&(e.top=l(window).height()+l(window).scrollTop()-this.$el.outerHeight()-10),e.left<=0&&(e.left=10),this.$el.css({left:e.left+1,top:e.top+1}).show(),this.$(".so-search-wrapper input").focus()},closeMenu:function(){this.trigger("close_menu"),l(window).off("keyup",this.keyboardListen),l(window).off("click",this.clickOutsideListen),this.active=!1,this.$el.empty().hide()},keyboardListen:function(e){var t=e.data.menu;switch(e.which){case 27:t.closeMenu()}},clickOutsideListen:function(e){var t=e.data.menu;3!==e.which&&t.$el.is(":visible")&&!t.isOverEl(t.$el,e)&&t.closeMenu()},addSection:function(e,t,i,s){var o=this;t=_.extend({display:5,defaultDisplay:!1,search:!0,sectionTitle:"",searchPlaceholder:"",titleKey:"title"},t);var n=l(this.sectionTemplate({settings:t,items:i})).attr("id","panels-menu-section-"+e);this.$el.append(n),n.find(".so-item:not(.so-confirm)").click(function(){var e=l(this);s(e.data("key")),o.closeMenu()}),n.find(".so-item.so-confirm").click(function(){var e=l(this);if(e.hasClass("so-confirming"))return s(e.data("key")),void o.closeMenu();e.data("original-text",e.html()).addClass("so-confirming").html('<span class="dashicons dashicons-yes"></span> '+panelsOptions.loc.dropdown_confirm),setTimeout(function(){e.removeClass("so-confirming"),e.html(e.data("original-text"))},2500)}),n.data("settings",t).find(".so-search-wrapper input").trigger("keyup"),this.active=!0},hasSection:function(e){return this.$el.find("#panels-menu-section-"+e).length>0},searchKeyUp:function(e){var t=l(e.currentTarget),i=t.closest(".so-section"),s=i.data("settings");if(38===e.which||40===e.which){var o=i.find("ul li:visible"),n=o.filter(".so-active").eq(0);if(n.length){o.removeClass("so-active");var a=o.index(n);38===e.which?n=a-1<0?o.last():o.eq(a-1):40===e.which&&(n=a+1>=o.length?o.first():o.eq(a+1))}else 38===e.which?n=o.last():40===e.which&&(n=o.first());return n.addClass("so-active"),!1}if(13===e.which)return 1===i.find("ul li:visible").length?(i.find("ul li:visible").trigger("click"),!1):(i.find("ul li.so-active:visible").trigger("click"),!1);if(""===t.val())if(s.defaultDisplay){i.find(".so-item").hide();for(var r=0;r<s.defaultDisplay.length;r++)i.find('.so-item[data-key="'+s.defaultDisplay[r]+'"]').show()}else i.find(".so-item").show();else i.find(".so-item").hide().each(function(){var e=l(this);-1!==e.html().toLowerCase().indexOf(t.val().toLowerCase())&&e.show()});i.find(".so-item:visible:gt("+(s.display-1)+")").hide(),0===i.find(".so-item:visible").length&&""!==t.val()?i.find(".so-no-results").show():i.find(".so-no-results").hide()},isOverEl:function(e,t){var i=[[e.offset().left,e.offset().top],[e.offset().left+e.outerWidth(),e.offset().top+e.outerHeight()]];return t.pageX>=i[0][0]&&t.pageX<=i[1][0]&&t.pageY>=i[0][1]&&t.pageY<=i[1][1]}})},{}],23:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=Backbone.View.extend({config:{},template:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-builder").html())),dialogs:{},rowsSortable:null,dataField:!1,currentData:"",attachedToEditor:!1,attachedVisible:!1,liveEditor:void 0,menu:!1,activeCell:null,events:{"click .so-tool-button.so-widget-add":"displayAddWidgetDialog","click .so-tool-button.so-row-add":"displayAddRowDialog","click .so-tool-button.so-prebuilt-add":"displayAddPrebuiltDialog","click .so-tool-button.so-history":"displayHistoryDialog","click .so-tool-button.so-live-editor":"displayLiveEditor"},rows:null,initialize:function(e){var t=this;return this.config=_.extend({loadLiveEditor:!1,builderSupports:{}},e.config),this.config.builderSupports=_.extend({addRow:!0,editRow:!0,deleteRow:!0,moveRow:!0,addWidget:!0,editWidget:!0,deleteWidget:!0,moveWidget:!0,prebuilt:!0,history:!0,liveEditor:!0,revertToEditor:!0},this.config.builderSupports),e.config.loadLiveEditor&&this.on("builder_live_editor_added",function(){this.displayLiveEditor()}),this.dialogs={widgets:new s.dialog.widgets,row:new s.dialog.row,prebuilt:new s.dialog.prebuilt},_.each(this.dialogs,function(e,i,s){s[i].setBuilder(t)}),this.dialogs.row.setRowDialogType("create"),this.model.get("rows").on("add",this.onAddRow,this),l(window).resize(function(e){e.target===window&&t.trigger("builder_resize")}),this.model.on("change:data load_panels_data",this.storeModelData,this),this.on("content_change",this.handleContentChange,this),this.on("display_builder",this.handleDisplayBuilder,this),this.on("hide_builder",this.handleHideBuilder,this),this.on("builder_rendered builder_resize",this.handleBuilderSizing,this),this.model.on("change:data load_panels_data",this.toggleWelcomeDisplay,this),this.on("display_builder",this.wrapEditorExpandAdjust,this),this.menu=new s.utils.menu({}),this.menu.on("activate_context",this.activateContextMenu,this),this.config.loadOnAttach&&this.on("builder_attached_to_editor",function(){this.displayAttachedBuilder({confirm:!1})},this),this},render:function(){return this.setElement(this.template()),this.$el.attr("id","siteorigin-panels-builder-"+this.cid).addClass("so-builder-container"),this.trigger("builder_rendered"),this},attach:function(e){e=_.extend({container:!1,dialog:!1},e),e.dialog?(this.dialog=new s.dialog.builder,this.dialog.builder=this):(this.$el.appendTo(e.container),this.metabox=e.container.closest(".postbox"),this.initSortable(),this.trigger("attached_to_container",e.container)),this.trigger("builder_attached"),this.supports("liveEditor")&&this.addLiveEditor(),this.supports("history")&&this.addHistoryBrowser();var t=this.$(".so-builder-toolbar");return this.supports("addWidget")||t.find(".so-widget-add").hide(),this.supports("addRow")||t.find(".so-row-add").hide(),this.supports("prebuilt")||t.find(".so-prebuilt-add").hide(),this},attachToEditor:function(){if("tinyMCE"!==this.config.editorType)return this;this.attachedToEditor=!0;var e=this.metabox,t=this;l("#wp-content-wrap .wp-editor-tabs").find(".wp-switch-editor").click(function(e){e.preventDefault(),l("#wp-content-editor-container").show(),l("#wp-content-wrap").removeClass("panels-active"),l("#content-resize-handle").show(),t.trigger("hide_builder")}).end().append(l('<a id="content-panels" class="hide-if-no-js wp-switch-editor switch-panels">'+e.find(".hndle span").html()+"</a>").click(function(e){t.displayAttachedBuilder({confirm:!0})&&e.preventDefault()})),this.supports("revertToEditor")&&e.find(".so-switch-to-standard").click(function(i){i.preventDefault(),confirm(panelsOptions.loc.confirm_stop_builder)&&(t.addHistoryEntry("back_to_editor"),t.model.loadPanelsData(!1),l("#wp-content-wrap").show(),e.hide(),l(window).resize(),t.attachedVisible=!1,t.trigger("hide_builder"))}).show(),e.insertAfter("#wp-content-wrap").hide().addClass("attached-to-editor");var i=this.model.get("data");_.isEmpty(i.widgets)&&_.isEmpty(i.grids)||this.displayAttachedBuilder({confirm:!1});var s=function(){var e=t.$(".so-builder-toolbar");if(t.$el.hasClass("so-display-narrow"))return e.css({top:0,left:0,width:"100%",position:"absolute"}),void t.$el.css("padding-top",e.outerHeight());var i=l(window).scrollTop()-t.$el.offset().top;"fixed"===l("#wpadminbar").css("position")&&(i+=l("#wpadminbar").outerHeight());var s={top:0,bottom:t.$el.outerHeight()-e.outerHeight()+20};i>s.top&&i<s.bottom?"fixed"!==e.css("position")&&e.css({top:l("#wpadminbar").outerHeight(),left:t.$el.offset().left,width:t.$el.outerWidth(),position:"fixed"}):e.css({top:Math.min(Math.max(i,0),t.$el.outerHeight()-e.outerHeight()+20),left:0,width:"100%",position:"absolute"}),t.$el.css("padding-top",e.outerHeight())};return this.on("builder_resize",s,this),l(document).scroll(s),s(),this.trigger("builder_attached_to_editor"),this},displayAttachedBuilder:function(e){if(e=_.extend({confirm:!0},e),e.confirm){var t="undefined"!=typeof tinyMCE&&tinyMCE.get("content");if(""!==(t&&_.isFunction(t.getContent)?t.getContent():l("textarea#content").val())&&!confirm(panelsOptions.loc.confirm_use_builder))return!1}return l("#wp-content-wrap").hide(),this.metabox.show().find("> .inside").show(),l(window).resize(),l(document).scroll(),this.attachedVisible=!0,this.trigger("display_builder"),!0},initSortable:function(){if(!this.supports("moveRow"))return this;var e=this;return this.rowsSortable=this.$(".so-rows-container").sortable({appendTo:"#wpwrap",items:".so-row-container",handle:".so-row-move",axis:"y",tolerance:"pointer",scroll:!1,stop:function(t,i){e.addHistoryEntry("row_moved");var s=l(i.item),o=s.data("view");e.model.get("rows").remove(o.model,{silent:!0}),e.model.get("rows").add(o.model,{silent:!0,at:s.index()}),o.trigger("move",s.index()),e.model.refreshPanelsData()}}),this},refreshSortable:function(){_.isNull(this.rowsSortable)||this.rowsSortable.sortable("refresh")},setDataField:function(e,t){if(t=_.extend({load:!0},t),this.dataField=e,this.dataField.data("builder",this),t.load&&""!==e.val()){var i=this.dataField.val();try{i=JSON.parse(i)}catch(e){i={}}this.model.loadPanelsData(i),this.currentData=i,this.toggleWelcomeDisplay()}return this},storeModelData:function(){var e=JSON.stringify(this.model.get("data"));l(this.dataField).val()!==e&&(l(this.dataField).val(e),l(this.dataField).trigger("change"),this.trigger("content_change"))},onAddRow:function(e,t,i){i=_.extend({noAnimate:!1},i);var l=new s.view.row({model:e});l.builder=this,l.render(),_.isUndefined(i.at)||t.length<=1?l.$el.appendTo(this.$(".so-rows-container")):l.$el.insertAfter(this.$(".so-rows-container .so-row-container").eq(i.at-1)),!1===i.noAnimate&&l.visualCreate(),this.refreshSortable(),l.resize()},displayAddWidgetDialog:function(){this.dialogs.widgets.openDialog()},displayAddRowDialog:function(){var e=new s.model.row,t=new s.collection.cells([{weight:.5},{weight:.5}]);t.each(function(t){t.row=e}),e.set("cells",t),e.builder=this.model,this.dialogs.row.setRowModel(e),this.dialogs.row.openDialog()},displayAddPrebuiltDialog:function(){this.dialogs.prebuilt.openDialog()},displayHistoryDialog:function(){this.dialogs.history.openDialog()},pasteRowHandler:function(){var e=s.helpers.clipboard.getModel("row-model");!_.isEmpty(e)&&e instanceof s.model.row&&(this.addHistoryEntry("row_pasted"),e.builder=this.model,this.model.get("rows").add(e,{at:this.model.get("rows").indexOf(this.model)+1}),this.model.refreshPanelsData())},getActiveCell:function(e){if(e=_.extend({createCell:!0},e),!this.model.get("rows").length){if(!e.createCell)return null;this.model.addRow({},[{weight:1}],{noAnimate:!0})}var t=this.activeCell;return _.isEmpty(t)||-1===this.model.get("rows").indexOf(t.model.row)?this.model.get("rows").last().get("cells").first():t.model},addLiveEditor:function(){return _.isEmpty(this.config.liveEditorPreview)?this:(this.liveEditor=new s.view.liveEditor({builder:this,previewUrl:this.config.liveEditorPreview}),this.liveEditor.hasPreviewUrl()&&this.$(".so-builder-toolbar .so-live-editor").show(),this.trigger("builder_live_editor_added"),this)},displayLiveEditor:function(){_.isUndefined(this.liveEditor)||this.liveEditor.open()},addHistoryBrowser:function(){if(_.isEmpty(this.config.liveEditorPreview))return this;this.dialogs.history=new s.dialog.history,this.dialogs.history.builder=this,this.dialogs.history.entries.builder=this.model,this.dialogs.history.setRevertEntry(this.model),this.$(".so-builder-toolbar .so-history").show()},addHistoryEntry:function(e,t){_.isUndefined(t)&&(t=null),_.isUndefined(this.dialogs.history)||this.dialogs.history.entries.addEntry(e,t)},supports:function(e){return"rowAction"===e?this.supports("addRow")||this.supports("editRow")||this.supports("deleteRow"):"widgetAction"===e?this.supports("addWidget")||this.supports("editWidget")||this.supports("deleteWidget"):!_.isUndefined(this.config.builderSupports[e])&&this.config.builderSupports[e]},handleContentChange:function(){if(panelsOptions.copy_content&&this.attachedToEditor&&this.$el.is(":visible")){var e=this.model.getPanelsData();_.isEmpty(e.widgets)||l.post(panelsOptions.ajaxurl,{action:"so_panels_builder_content",
3
+ panels_data:JSON.stringify(e),post_id:this.config.postId},function(e){""!==e&&this.updateEditorContent(e)}.bind(this))}},updateEditorContent:function(e){if("tinyMCE"!==this.config.editorType||"undefined"==typeof tinyMCE||_.isNull(tinyMCE.get("content"))){l(this.config.editorId).val(e).trigger("change").trigger("keyup")}else{var t=tinyMCE.get("content");t.setContent(e),t.fire("change"),t.fire("keyup")}this.triggerYoastSeoChange()},triggerYoastSeoChange:function(){if(l("#yoast_wpseo_focuskw_text_input").length){var e,t=document.getElementById("yoast_wpseo_focuskw_text_input");document.createEvent?(e=document.createEvent("HTMLEvents"),e.initEvent("keyup",!0,!0)):(e=document.createEventObject(),e.eventType="keyup"),e.eventName="keyup",document.createEvent?t.dispatchEvent(e):t.fireEvent("on"+e.eventType,e)}},handleDisplayBuilder:function(){var e="undefined"!=typeof tinyMCE&&tinyMCE.get("content"),t=e&&_.isFunction(e.getContent)?e.getContent():l("textarea#content").val();if((_.isEmpty(this.model.get("data"))||_.isEmpty(this.model.get("data").widgets)&&_.isEmpty(this.model.get("data").grids))&&""!==t){var i=panelsOptions.text_widget;if(_.isEmpty(i))return;this.model.loadPanelsData(this.model.getPanelsDataFromHtml(t,i)),this.model.trigger("change"),this.model.trigger("change:data")}l("#post-status-info").addClass("for-siteorigin-panels")},handleHideBuilder:function(){l("#post-status-info").show().removeClass("for-siteorigin-panels")},wrapEditorExpandAdjust:function(){try{for(var e,t=(l.hasData(window)&&l._data(window)).events.scroll,i=0;i<t.length;i++)if("editor-expand"===t[i].namespace){e=t[i],l(window).unbind("scroll",e.handler),l(window).bind("scroll",function(t){this.attachedVisible||e.handler(t)}.bind(this));break}}catch(e){return}},handleBuilderSizing:function(){var e=this.$el.width();return e?(e<480?this.$el.addClass("so-display-narrow"):this.$el.removeClass("so-display-narrow"),this):this},setDialogParents:function(e,t){_.each(this.dialogs,function(i,s,l){l[s].setParent(e,t)}),this.on("add_dialog",function(i){i.setParent(e,t)},this)},toggleWelcomeDisplay:function(){this.model.get("rows").isEmpty()?this.$(".so-panels-welcome-message").show():this.$(".so-panels-welcome-message").hide()},activateContextMenu:function(e,t){var i=this,s=l(".siteorigin-panels-builder:visible").sort(function(e,t){return l(e).zIndex()>l(t).zIndex()?1:-1}).last(),o=l(".so-panels-dialog-wrapper:visible").sort(function(e,t){return l(e).zIndex()>l(t).zIndex()?1:-1}).last(),n=i.$el.closest(".so-panels-dialog-wrapper");if(i.$el.is(s)&&(0===o.length||o.is(n))){var a=l([]).add(i.$(".so-panels-welcome-message:visible")).add(i.$(".so-rows-container > .so-row-container")).add(i.$(".so-cells > .cell")).add(i.$(".cell-wrapper > .so-widget")).filter(function(i){return t.isOverEl(l(this),e)}),r=a.last().data("view");void 0!==r&&void 0!==r.buildContextualMenu?r.buildContextualMenu(e,t):a.last().hasClass("so-panels-welcome-message")&&this.buildContextualMenu(e,t)}},buildContextualMenu:function(e,t){var i={};this.supports("addRow")&&(i.add_row={title:panelsOptions.loc.contextual.add_row}),s.helpers.clipboard.canCopyPaste()&&s.helpers.clipboard.isModel("row-model")&&this.supports("addRow")&&(i.paste_row={title:panelsOptions.loc.contextual.row_paste}),_.isEmpty(i)||t.addSection("builder-actions",{sectionTitle:panelsOptions.loc.contextual.row_actions,search:!1},i,function(e){switch(e){case"add_row":this.displayAddRowDialog();break;case"paste_row":this.pasteRowHandler()}}.bind(this))}})},{}],24:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=Backbone.View.extend({template:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-builder-cell").html())),events:{"click .cell-wrapper":"handleCellClick"},row:null,widgetSortable:null,initialize:function(){this.model.get("widgets").on("add",this.onAddWidget,this)},render:function(){var e={weight:this.model.get("weight"),totalWeight:this.row.model.get("cells").totalWeight()};this.setElement(this.template(e)),this.$el.data("view",this);var t=this;return this.model.get("widgets").each(function(e){var i=new s.view.widget({model:e});i.cell=t,i.render(),i.$el.appendTo(t.$(".widgets-container"))}),this.initSortable(),this.initResizable(),this},initSortable:function(){if(!this.row.builder.supports("moveWidget"))return this;var e=this,t=e.row.builder.$el.attr("id");return this.widgetSortable=this.$(".widgets-container").sortable({placeholder:"so-widget-sortable-highlight",connectWith:"#"+t+" .so-cells .cell .widgets-container",tolerance:"pointer",scroll:!1,over:function(t,i){e.row.builder.trigger("widget_sortable_move")},stop:function(t,i){e.row.builder.addHistoryEntry("widget_moved");var s=l(i.item),o=s.data("view"),n=s.closest(".cell").data("view");o.model.moveToCell(n.model,{},s.index()),o.cell=n,o.cell.row.builder.model.refreshPanelsData()},helper:function(e,t){var i=t.clone().css({width:t.outerWidth(),"z-index":1e4,position:"fixed"}).addClass("widget-being-dragged").appendTo("body");return t.outerWidth()>720&&i.animate({"margin-left":e.pageX-t.offset().left-240,width:480},"fast"),i}}),this},refreshSortable:function(){_.isNull(this.widgetSortable)||this.widgetSortable.sortable("refresh")},initResizable:function(){if(!this.row.builder.supports("editRow"))return this;var e,t=this.$(".resize-handle").css("position","absolute"),i=this.row.$el,s=this;return t.draggable({axis:"x",containment:i,start:function(t,i){if(e=s.$el.prev().data("view"),!_.isUndefined(e)){var o=s.$el.clone().appendTo(i.helper).css({position:"absolute",top:"0",width:s.$el.outerWidth(),left:5,height:s.$el.outerHeight()});o.find(".resize-handle").remove();var n=e.$el.clone().appendTo(i.helper).css({position:"absolute",top:"0",width:e.$el.outerWidth(),right:5,height:e.$el.outerHeight()});n.find(".resize-handle").remove(),l(this).data({newCellClone:o,prevCellClone:n})}},drag:function(i,o){var n=s.row.$el.width()+10,a=s.model.get("weight")-(o.position.left+t.outerWidth()/2)/n,r=e.model.get("weight")+(o.position.left+t.outerWidth()/2)/n;l(this).data("newCellClone").css("width",n*a).find(".preview-cell-weight").html(Math.round(1e3*a)/10),l(this).data("prevCellClone").css("width",n*r).find(".preview-cell-weight").html(Math.round(1e3*r)/10)},stop:function(i,o){l(this).data("newCellClone").remove(),l(this).data("prevCellClone").remove();var n=s.row.$el.width()+10,a=s.model.get("weight")-(o.position.left+t.outerWidth()/2)/n,r=e.model.get("weight")+(o.position.left+t.outerWidth()/2)/n;a>.02&&r>.02&&(s.row.builder.addHistoryEntry("cell_resized"),s.model.set("weight",a),e.model.set("weight",r),s.row.resize()),o.helper.css("left",-t.outerWidth()/2),s.row.builder.model.refreshPanelsData()}}),this},onAddWidget:function(e,t,i){i=_.extend({noAnimate:!1},i);var l=new s.view.widget({model:e});l.cell=this,_.isUndefined(e.isDuplicate)&&(e.isDuplicate=!1),l.render({loadForm:e.isDuplicate}),_.isUndefined(i.at)||t.length<=1?l.$el.appendTo(this.$(".widgets-container")):l.$el.insertAfter(this.$(".widgets-container .so-widget").eq(i.at-1)),!1===i.noAnimate&&l.visualCreate(),this.refreshSortable(),this.row.resize()},handleCellClick:function(e){this.row.builder.$el.find(".so-cells .cell").removeClass("cell-selected"),this.row.builder.activeCell!==this||this.model.get("widgets").length?(this.$el.addClass("cell-selected"),this.row.builder.activeCell=this):this.row.builder.activeCell=null},pasteHandler:function(){var e=s.helpers.clipboard.getModel("widget-model");!_.isEmpty(e)&&e instanceof s.model.widget&&(this.row.builder.addHistoryEntry("widget_pasted"),e.cell=this.model,this.model.get("widgets").add(e),this.row.builder.model.refreshPanelsData())},buildContextualMenu:function(e,t){var i=this;t.hasSection("add-widget-below")||t.addSection("add-widget-cell",{sectionTitle:panelsOptions.loc.contextual.add_widget_cell,searchPlaceholder:panelsOptions.loc.contextual.search_widgets,defaultDisplay:panelsOptions.contextual.default_widgets},panelsOptions.widgets,function(e){i.row.builder.addHistoryEntry("widget_added");var t=new s.model.widget({class:e});t.cell=i.model,t.cell.get("widgets").add(t),i.row.builder.model.refreshPanelsData()});var l={};this.row.builder.supports("addWidget")&&s.helpers.clipboard.isModel("widget-model")&&(l.paste={title:panelsOptions.loc.contextual.cell_paste_widget}),_.isEmpty(l)||t.addSection("cell-actions",{sectionTitle:panelsOptions.loc.contextual.cell_actions,search:!1},l,function(e){switch(e){case"paste":this.pasteHandler()}this.row.builder.model.refreshPanelsData()}.bind(this)),this.row.buildContextualMenu(e,t)}})},{}],25:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=Backbone.View.extend({dialogTemplate:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-dialog").html())),dialogTabTemplate:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-dialog-tab").html())),tabbed:!1,rendered:!1,builder:!1,className:"so-panels-dialog-wrapper",dialogClass:"",dialogIcon:"",parentDialog:!1,dialogOpen:!1,editableLabel:!1,events:{"click .so-close":"closeDialog","click .so-nav.so-previous":"navToPrevious","click .so-nav.so-next":"navToNext"},initialize:function(){this.once("open_dialog",this.render),this.once("open_dialog",this.attach),this.once("open_dialog",this.setDialogClass),this.trigger("initialize_dialog",this),_.isUndefined(this.initializeDialog)||this.initializeDialog()},getNextDialog:function(){return null},getPrevDialog:function(){return null},setDialogClass:function(){""!==this.dialogClass&&this.$(".so-panels-dialog").addClass(this.dialogClass)},setBuilder:function(e){return this.builder=e,e.trigger("add_dialog",this,this.builder),this},attach:function(){return this.$el.appendTo("body"),this},parseDialogContent:function(e,t){t=_.extend({cid:this.cid},t);var i=l(_.template(s.helpers.utils.processTemplate(e))(t)),o={title:i.find(".title").html(),buttons:i.find(".buttons").html(),content:i.find(".content").html()};return i.has(".left-sidebar")&&(o.left_sidebar=i.find(".left-sidebar").html()),i.has(".right-sidebar")&&(o.right_sidebar=i.find(".right-sidebar").html()),o},renderDialog:function(e){if(e=_.extend({editableLabel:this.editableLabel,dialogIcon:this.dialogIcon},e),this.$el.html(this.dialogTemplate(e)).hide(),this.$el.data("view",this),this.$el.addClass("so-panels-dialog-wrapper"),!1!==this.parentDialog){var t=this,i=l('<h3 class="so-parent-link"></h3>').html(this.parentDialog.text+'<div class="so-separator"></div>');i.click(function(e){e.preventDefault(),t.closeDialog(),t.parentDialog.openDialog()}),this.$(".so-title-bar").prepend(i)}return this.$(".so-title-bar .so-title-editable").length&&this.initEditableLabel(),this},initTabs:function(){var e=this.$(".so-sidebar-tabs li a");if(0===e.length)return this;var t=this;return e.click(function(e){e.preventDefault();var i=l(this);t.$(".so-sidebar-tabs li").removeClass("tab-active"),t.$(".so-content .so-content-tabs > *").hide(),i.parent().addClass("tab-active");var s=i.attr("href");if(!_.isUndefined(s)&&"#"===s.charAt(0)){var o=s.split("#")[1];t.$(".so-content .so-content-tabs .tab-"+o).show()}t.trigger("tab_click",i)}),this.$(".so-sidebar-tabs li a").first().click(),this},initToolbar:function(){this.$(".so-toolbar .so-buttons .so-toolbar-button").click(function(e){e.preventDefault(),this.trigger("button_click",l(e.currentTarget))}.bind(this)),this.$(".so-toolbar .so-buttons .so-dropdown-button").click(function(e){e.preventDefault();var t=l(e.currentTarget),i=t.siblings(".so-dropdown-links-wrapper");i.is(".hidden")?i.removeClass("hidden"):i.addClass("hidden")}.bind(this)),l("html").click(function(e){this.$(".so-dropdown-links-wrapper").not(".hidden").each(function(t,i){var s=l(i),o=l(e.target);0!==o.length&&(o.is(".so-needs-confirm")&&!o.is(".so-confirmed")||o.is(".so-dropdown-button"))||s.addClass("hidden")})}.bind(this))},initEditableLabel:function(){var e=this.$(".so-title-bar .so-title-editable");e.keypress(function(t){var i="keypress"===t.type&&13===t.keyCode;if(i){var s=l(":tabbable"),o=s.index(e);s.eq(o+1).focus(),window.getSelection().removeAllRanges()}return!i}).blur(function(){var t=e.text().replace(/^\s+|\s+$/gm,"");t!==e.data("original-value").replace(/^\s+|\s+$/gm,"")&&(e.text(t),this.trigger("edit_label",t))}.bind(this)),e.focus(function(){e.data("original-value",e.text()),s.helpers.utils.selectElementContents(this)})},setupDialog:function(){this.openDialog(),this.closeDialog()},refreshDialogNav:function(){this.$(".so-title-bar .so-nav").show().removeClass("so-disabled");var e=this.getNextDialog(),t=this.$(".so-title-bar .so-next"),i=this.getPrevDialog(),s=this.$(".so-title-bar .so-previous");null===e?t.hide():!1===e&&t.addClass("so-disabled"),null===i?s.hide():!1===i&&s.addClass("so-disabled")},openDialog:function(e){e=_.extend({silent:!1},e),e.silent||this.trigger("open_dialog"),this.dialogOpen=!0,this.refreshDialogNav(),s.helpers.pageScroll.lock(),l(window).on("keyup",this.keyboardListen),this.$el.show(),e.silent||(this.trigger("open_dialog_complete"),this.builder.trigger("open_dialog",this))},closeDialog:function(e){e=_.extend({silent:!1},e),e.silent||this.trigger("close_dialog"),this.dialogOpen=!1,this.$el.hide(),s.helpers.pageScroll.unlock(),l(window).off("keyup",this.keyboardListen),e.silent||(this.trigger("close_dialog_complete"),this.builder.trigger("close_dialog",this))},keyboardListen:function(e){27===e.which&&l(".so-panels-dialog-wrapper .so-close").trigger("click")},navToPrevious:function(){this.closeDialog();var e=this.getPrevDialog();null!==e&&!1!==e&&e.openDialog()},navToNext:function(){this.closeDialog();var e=this.getNextDialog();null!==e&&!1!==e&&e.openDialog()},getFormValues:function(e){_.isUndefined(e)&&(e=".so-content");var t,i=this.$(e),s={};return i.find("[name]").each(function(){var e=l(this);try{var i=/([A-Za-z_]+)\[(.*)\]/.exec(e.attr("name"));if(_.isEmpty(i))return!0;_.isUndefined(i[2])?t=e.attr("name"):(t=i[2].split("]["),t.unshift(i[1])),t=t.map(function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e});var o=s,n=null,a=!!_.isString(e.attr("type"))&&e.attr("type").toLowerCase();if("checkbox"===a)n=e.is(":checked")?""===e.val()||e.val():null;else if("radio"===a){if(!e.is(":checked"))return;n=e.val()}else if("TEXTAREA"===e.prop("tagName")&&e.hasClass("wp-editor-area")){var r=null;"undefined"!=typeof tinyMCE&&(r=tinyMCE.get(e.attr("id"))),n=null!==r&&_.isFunction(r.getContent)&&!r.isHidden()?r.getContent():e.val()}else if("SELECT"===e.prop("tagName")){var d=e.find("option:selected");1===d.length?n=e.find("option:selected").val():d.length>1&&(n=_.map(e.find("option:selected"),function(e,t){return l(e).val()}))}else n=e.val();if(!_.isUndefined(e.data("panels-filter")))switch(e.data("panels-filter")){case"json_parse":try{n=JSON.parse(n)}catch(e){n=""}}if(null!==n)for(var c=0;c<t.length;c++)c===t.length-1?""===t[c]?o.push(n):o[t[c]]=n:(_.isUndefined(o[t[c]])&&(""===t[c+1]?o[t[c]]=[]:o[t[c]]={}),o=o[t[c]])}catch(t){console.log("Field ["+e.attr("name")+"] could not be processed and was skipped - "+t.message)}}),s},setStatusMessage:function(e,t){this.$(".so-toolbar .so-status").html(e),!_.isUndefined(t)&&t&&this.$(".so-toolbar .so-status").addClass("so-panels-loading")},setParent:function(e,t){this.parentDialog={text:e,dialog:t}}})},{}],26:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=Backbone.View.extend({template:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-live-editor").html())),previewScrollTop:0,loadTimes:[],previewFrameId:1,previewUrl:null,previewIframe:null,events:{"click .live-editor-close":"close","click .live-editor-collapse":"collapse","click .live-editor-mode":"mobileToggle"},initialize:function(e){e=_.extend({builder:!1,previewUrl:!1},e),_.isEmpty(e.previewUrl)&&(e.previewUrl=panelsOptions.ajaxurl+"&action=so_panels_live_editor_preview"),this.builder=e.builder,this.previewUrl=e.previewUrl,this.builder.model.on("refresh_panels_data",this.handleRefreshData,this),this.builder.model.on("load_panels_data",this.handleLoadData,this)},render:function(){this.setElement(this.template()),this.$el.hide();var e=this,t=!1;return l(document).mousedown(function(){t=!0}).mouseup(function(){t=!1}),this.$el.on("mouseenter",".so-widget-wrapper",function(){var i=l(this),s=i.data("live-editor-preview-widget");t||void 0===s||!s.length||e.$(".so-preview-overlay").is(":visible")||(e.highlightElement(s),e.scrollToElement(s))}),e.$el.on("mouseleave",".so-widget-wrapper",function(){e.resetHighlights()}),e.builder.on("open_dialog",function(){e.resetHighlights()}),this},attach:function(){this.$el.appendTo("body")},open:function(){if(""===this.$el.html()&&this.render(),0===this.$el.closest("body").length&&this.attach(),s.helpers.pageScroll.lock(),this.$el.is(":visible"))return this;if(this.$el.show(),this.refreshPreview(this.builder.model.getPanelsData()),this.originalContainer=this.builder.$el.parent(),this.builder.$el.appendTo(this.$(".so-live-editor-builder")),this.builder.$(".so-tool-button.so-live-editor").hide(),this.builder.trigger("builder_resize"),"auto-draft"===l("#original_post_status").val()&&!this.autoSaved){var e=this;wp.autosave&&(""===l('#title[name="post_title"]').val()&&l('#title[name="post_title"]').val(panelsOptions.loc.draft).trigger("keydown"),l(document).one("heartbeat-tick.autosave",function(){e.autoSaved=!0,e.refreshPreview(e.builder.model.getPanelsData())}),wp.autosave.server.triggerSave())}},close:function(){if(!this.$el.is(":visible"))return this;this.$el.hide(),s.helpers.pageScroll.unlock(),this.builder.$el.appendTo(this.originalContainer),this.builder.$(".so-tool-button.so-live-editor").show(),this.builder.trigger("builder_resize")},collapse:function(){this.$el.toggleClass("so-collapsed");var e=this.$(".live-editor-collapse span");e.html(e.data(this.$el.hasClass("so-collapsed")?"expand":"collapse"))},highlightElement:function(e){_.isUndefined(this.resetHighlightTimeout)||clearTimeout(this.resetHighlightTimeout),this.previewIframe.contents().find("body").find(".panel-grid .panel-grid-cell .so-panel").filter(function(){return 0===l(this).parents(".so-panel").length}).not(e).addClass("so-panels-faded"),e.removeClass("so-panels-faded").addClass("so-panels-highlighted")},resetHighlights:function(){var e=this.previewIframe.contents().find("body");this.resetHighlightTimeout=setTimeout(function(){e.find(".panel-grid .panel-grid-cell .so-panel").removeClass("so-panels-faded so-panels-highlighted")},100)},scrollToElement:function(e){this.$(".so-preview iframe")[0].contentWindow.liveEditorScrollTo(e)},handleRefreshData:function(e,t){if(!this.$el.is(":visible"))return this;this.refreshPreview(e)},handleLoadData:function(){if(!this.$el.is(":visible"))return this;this.refreshPreview(this.builder.model.getPanelsData())},refreshPreview:function(e){var t=this.loadTimes.length?_.reduce(this.loadTimes,function(e,t){return e+t},0)/this.loadTimes.length:1e3;_.isNull(this.previewIframe)||this.$(".so-preview-overlay").is(":visible")||(this.previewScrollTop=this.previewIframe.contents().scrollTop()),this.$(".so-preview-overlay").show(),this.$(".so-preview-overlay .so-loading-bar").clearQueue().css("width","0%").animate({width:"100%"},parseInt(t)+100),this.postToIframe({live_editor_panels_data:JSON.stringify(e),live_editor_post_ID:this.builder.config.postId},this.previewUrl,this.$(".so-preview")),this.previewIframe.data("load-start",(new Date).getTime())},postToIframe:function(e,t,i){_.isNull(this.previewIframe)||this.previewIframe.remove();var s="siteorigin-panels-live-preview-"+this.previewFrameId;this.previewIframe=l('<iframe src="javascript:false;" />').attr({id:s,name:s}).appendTo(i),this.setupPreviewFrame(this.previewIframe);var o=l('<form id="soPostToPreviewFrame" method="post" />').attr({id:s,target:this.previewIframe.attr("id"),action:t}).appendTo("body");return l.each(e,function(e,t){l('<input type="hidden" />').attr({name:e,value:t}).appendTo(o)}),o.submit().remove(),this.previewFrameId++,this.previewIframe},setupPreviewFrame:function(e){var t=this;e.data("iframeready",!1).on("iframeready",function(){var e=l(this),i=e.contents();if(!e.data("iframeready")){e.data("iframeready",!0),void 0!==e.data("load-start")&&(t.loadTimes.unshift((new Date).getTime()-e.data("load-start")),_.isEmpty(t.loadTimes)||(t.loadTimes=t.loadTimes.slice(0,4))),setTimeout(function(){i.scrollTop(t.previewScrollTop),t.$(".so-preview-overlay").hide()},100);var s=i.find("#pl-"+t.builder.config.postId);s.find(".panel-grid .panel-grid-cell .so-panel").filter(function(){return l(this).closest(".panel-layout").is(s)}).each(function(e,i){var s=l(i),o=t.$(".so-live-editor-builder .so-widget-wrapper").eq(s.data("index"));o.data("live-editor-preview-widget",s),s.css({cursor:"pointer"}).mouseenter(function(){o.parent().addClass("so-hovered"),t.highlightElement(s)}).mouseleave(function(){o.parent().removeClass("so-hovered"),t.resetHighlights()}).click(function(e){e.preventDefault(),o.find(".title h4").click()})}),i.find("a").css({"pointer-events":"none"}).click(function(e){e.preventDefault()})}}).on("load",function(){var e=l(this);e.data("iframeready")||e.trigger("iframeready")})},hasPreviewUrl:function(){return""!==this.$("form.live-editor-form").attr("action")},mobileToggle:function(e){var t=l(e.currentTarget);this.$(".live-editor-mode").not(t).removeClass("so-active"),t.addClass("so-active"),this.$el.removeClass("live-editor-desktop-mode live-editor-tablet-mode live-editor-mobile-mode").addClass("live-editor-"+t.data("mode")+"-mode")}})},{}],27:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=Backbone.View.extend({template:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-builder-row").html())),events:{"click .so-row-settings":"editSettingsHandler","click .so-row-duplicate":"duplicateHandler","click .so-row-delete":"confirmedDeleteHandler","click .so-row-color":"rowColorChangeHandler"},builder:null,dialog:null,initialize:function(){var e=this.model.get("cells");e.on("add",this.handleCellAdd,this),e.on("remove",this.handleCellRemove,this),this.model.on("reweight_cells",this.resize,this),this.model.on("destroy",this.onModelDestroy,this),this.model.on("visual_destroy",this.visualDestroyModel,this);var t=this;e.each(function(e){t.listenTo(e.get("widgets"),"add",t.resize)}),e.on("add",function(e){t.listenTo(e.get("widgets"),"add",t.resize)},this),this.model.on("change:label",this.onLabelChange,this)},render:function(){var e=this.model.has("color_label")?this.model.get("color_label"):1,t=this.model.has("label")?this.model.get("label"):"";this.setElement(this.template({rowColorLabel:e,rowLabel:t})),this.$el.data("view",this);var i=this;return this.model.get("cells").each(function(e){var t=new s.view.cell({model:e});t.row=i,t.render(),t.$el.appendTo(i.$(".so-cells"))}),this.builder.supports("rowAction")?(this.builder.supports("editWidget")||(this.$(".so-row-toolbar .so-row-settings").parent().remove(),this.$el.addClass("so-row-no-edit")),this.builder.supports("addWidget")||(this.$(".so-row-toolbar .so-row-duplicate").parent().remove(),this.$el.addClass("so-row-no-duplicate")),this.builder.supports("deleteWidget")||(this.$(".so-row-toolbar .so-row-delete").parent().remove(),this.$el.addClass("so-row-no-delete"))):(this.$(".so-row-toolbar .so-dropdown-wrapper").remove(),this.$el.addClass("so-row-no-actions")),this.builder.supports("moveRow")||(this.$(".so-row-toolbar .so-row-move").remove(),this.$el.addClass("so-row-no-move")),l.trim(this.$(".so-row-toolbar").html()).length||this.$(".so-row-toolbar").remove(),this.builder.on("widget_sortable_move",this.resize,this),this.builder.on("builder_resize",this.resize,this),this.resize(),this},visualCreate:function(){this.$el.hide().fadeIn("fast")},resize:function(e){if(this.$el.is(":visible")){this.$(".so-cells .cell-wrapper").css("min-height",0),this.$(".so-cells .resize-handle").css("height",0);var t=0;this.$(".so-cells .cell").each(function(){t=Math.max(t,l(this).height()),l(this).css("width",100*l(this).data("view").model.get("weight")+"%")}),this.$(".so-cells .cell-wrapper").css("min-height",Math.max(t,63)),this.$(".so-cells .resize-handle").css("height",this.$(".so-cells .cell-wrapper").outerHeight())}},onModelDestroy:function(){this.remove()},visualDestroyModel:function(){this.builder.addHistoryEntry("row_deleted");var e=this;this.$el.fadeOut("normal",function(){e.model.destroy(),e.builder.model.refreshPanelsData()})},onLabelChange:function(e,t){0==this.$(".so-row-label").length?this.$(".so-row-toolbar").prepend('<h3 class="so-row-label">'+t+"</h3>"):this.$(".so-row-label").text(t)},duplicateHandler:function(){this.builder.addHistoryEntry("row_duplicated");var e=this.model.clone(this.builder.model);this.builder.model.get("rows").add(e,{at:this.builder.model.get("rows").indexOf(this.model)+1}),this.builder.model.refreshPanelsData()},copyHandler:function(){s.helpers.clipboard.setModel(this.model)},pasteHandler:function(){var e=s.helpers.clipboard.getModel("row-model");!_.isEmpty(e)&&e instanceof s.model.row&&(this.builder.addHistoryEntry("row_pasted"),e.builder=this.builder.model,this.builder.model.get("rows").add(e,{at:this.builder.model.get("rows").indexOf(this.model)+1}),this.builder.model.refreshPanelsData())},confirmedDeleteHandler:function(e){var t=l(e.target);if(t.hasClass("dashicons")&&(t=l.parent()),t.hasClass("so-confirmed"))this.visualDestroyModel();else{var i=t.html();t.addClass("so-confirmed").html('<span class="dashicons dashicons-yes"></span>'+panelsOptions.loc.dropdown_confirm),setTimeout(function(){t.removeClass("so-confirmed").html(i)},2500)}},editSettingsHandler:function(){return null===this.dialog&&(this.dialog=new s.dialog.row,this.dialog.setBuilder(this.builder).setRowModel(this.model)),this.dialog.openDialog(),this},deleteHandler:function(){return this.model.destroy(),this},rowColorChangeHandler:function(e){this.$(".so-row-color").removeClass("so-row-color-selected");var t=l(e.target),i=t.data("color-label"),s=this.model.has("color_label")?this.model.get("color_label"):1;t.addClass("so-row-color-selected"),this.$el.removeClass("so-row-color-"+s),this.$el.addClass("so-row-color-"+i),this.model.set("color_label",i)},handleCellAdd:function(e){var t=new s.view.cell({model:e});t.row=this,t.render(),t.$el.appendTo(this.$(".so-cells"))},handleCellRemove:function(e){this.$(".so-cells > .cell").each(function(){var t=l(this).data("view");_.isUndefined(t)||t.model.cid===e.cid&&t.remove()})},buildContextualMenu:function(e,t){for(var i=[],l=1;l<5;l++)i.push({title:l+" "+panelsOptions.loc.contextual.column});this.builder.supports("addRow")&&t.addSection("add-row",{sectionTitle:panelsOptions.loc.contextual.add_row,search:!1},i,function(e){this.builder.addHistoryEntry("row_added");for(var t=Number(e)+1,i=[],l=0;l<t;l++)i.push({weight:100/t});var o=new s.model.row({collection:this.collection}),n=new s.collection.cells(i);n.each(function(e){e.row=o}),o.setCells(n),o.builder=this.builder.model,this.builder.model.get("rows").add(o,{at:this.builder.model.get("rows").indexOf(this.model)+1}),this.builder.model.refreshPanelsData()}.bind(this));var o={};this.builder.supports("editRow")&&(o.edit={title:panelsOptions.loc.contextual.row_edit}),s.helpers.clipboard.canCopyPaste()&&(o.copy={title:panelsOptions.loc.contextual.row_copy},this.builder.supports("addRow")&&s.helpers.clipboard.isModel("row-model")&&(o.paste={title:panelsOptions.loc.contextual.row_paste})),this.builder.supports("addRow")&&(o.duplicate={title:panelsOptions.loc.contextual.row_duplicate}),this.builder.supports("deleteRow")&&(o.delete={title:panelsOptions.loc.contextual.row_delete,confirm:!0}),_.isEmpty(o)||t.addSection("row-actions",{sectionTitle:panelsOptions.loc.contextual.row_actions,search:!1},o,function(e){switch(e){case"edit":this.editSettingsHandler();break;case"copy":this.copyHandler();break;case"paste":this.pasteHandler();break;case"duplicate":this.duplicateHandler();break;case"delete":this.visualDestroyModel()}}.bind(this))}})},{}],28:[function(e,t,i){var s=(window.panels,jQuery);t.exports=Backbone.View.extend({stylesLoaded:!1,initialize:function(){},render:function(e,t,i){if(!_.isUndefined(e)){i=_.extend({builderType:"",dialog:null},i),this.$el.addClass("so-visual-styles so-"+e+"-styles");var l={builderType:i.builderType};return"cell"===e&&(l.index=i.index),s.post(panelsOptions.ajaxurl,{action:"so_panels_style_form",type:e,style:this.model.get("style"),args:JSON.stringify(l),postId:t},function(e){this.$el.html(e),this.setupFields(),this.stylesLoaded=!0,this.trigger("styles_loaded",!_.isEmpty(e)),_.isNull(i.dialog)||i.dialog.trigger("styles_loaded",!_.isEmpty(e))}.bind(this)),this}},attach:function(e){e.append(this.$el)},detach:function(){this.$el.detach()},setupFields:function(){this.$(".style-section-wrapper").each(function(){var e=s(this);e.find(".style-section-head").click(function(t){t.preventDefault(),e.find(".style-section-fields").slideToggle("fast")})}),_.isUndefined(s.fn.wpColorPicker)||(_.isObject(panelsOptions.wpColorPickerOptions.palettes)&&!s.isArray(panelsOptions.wpColorPickerOptions.palettes)&&(panelsOptions.wpColorPickerOptions.palettes=s.map(panelsOptions.wpColorPickerOptions.palettes,function(e){return e})),this.$(".so-wp-color-field").wpColorPicker(panelsOptions.wpColorPickerOptions)),this.$(".style-field-image").each(function(){var e=null,t=s(this);t.find(".so-image-selector").click(function(i){i.preventDefault(),null===e&&(e=wp.media({title:"choose",library:{type:"image"},button:{text:"Done",close:!0}}),e.on("select",function(){var i=e.state().get("selection").first().attributes,s=i.url;if(!_.isUndefined(i.sizes))try{s=i.sizes.thumbnail.url}catch(e){s=i.sizes.full.url}t.find(".current-image").css("background-image","url("+s+")"),t.find("input").val(i.id)})),e.open()}),t.find(".remove-image").click(function(e){e.preventDefault(),t.find(".current-image").css("background-image","none"),t.find("input").val("")})}),this.$(".style-field-measurement").each(function(){var e=s(this),t=e.find('input[type="text"]'),i=e.find("select"),l=e.find('input[type="hidden"]');t.focus(function(){s(this).select()});!function(e){if(""!==e){var o=/(?:([0-9\.,\-]+)(.*))+/,n=l.val().split(" "),a=[];for(var r in n){var d=o.exec(n[r]);_.isNull(d)||_.isUndefined(d[1])||_.isUndefined(d[2])||(a.push(d[1]),i.val(d[2]))}1===t.length?t.val(a.join(" ")):(1===a.length?a=[a[0],a[0],a[0],a[0]]:2===a.length?a=[a[0],a[1],a[0],a[1]]:3===a.length&&(a=[a[0],a[1],a[2],a[1]]),t.each(function(e,t){s(t).val(a[e])}))}}(l.val());var o=function(e){if(1===t.length){var o=t.val().split(" ").filter(function(e){return""!==e}).map(function(e){return e+i.val()}).join(" ");l.val(o)}else{var n=s(e.target),a=[],r=[],d=[];t.each(function(e,t){var i=""!==s(t).val()?parseFloat(s(t).val()):null;a.push(i),null===i?r.push(e):d.push(e)}),3===r.length&&d[0]===t.index(n)&&(t.val(n.val()),a=[n.val(),n.val(),n.val(),n.val()]),JSON.stringify(a)===JSON.stringify([null,null,null,null])?l.val(""):l.val(a.map(function(e){return(null===e?0:e)+i.val()}).join(" "))}};t.change(o),i.change(o)})}})},{}],29:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=Backbone.View.extend({template:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-builder-widget").html())),cell:null,dialog:null,events:{"click .widget-edit":"editHandler","click .title h4":"titleClickHandler","click .actions .widget-duplicate":"duplicateHandler","click .actions .widget-delete":"deleteHandler"},initialize:function(){this.model.on("user_edit",this.editHandler,this),this.model.on("user_duplicate",this.duplicateHandler,this),this.model.on("destroy",this.onModelDestroy,this),this.model.on("visual_destroy",this.visualDestroyModel,this),this.model.on("change:values",this.onModelChange,this),this.model.on("change:label",this.onLabelChange,this)},render:function(e){if(e=_.extend({loadForm:!1},e),this.setElement(this.template({title:this.model.getWidgetField("title"),description:this.model.getTitle()})),this.$el.data("view",this),this.cell.row.builder.supports("editWidget")&&!this.model.get("read_only")||(this.$(".actions .widget-edit").remove(),
4
+ this.$el.addClass("so-widget-no-edit")),this.cell.row.builder.supports("addWidget")||(this.$(".actions .widget-duplicate").remove(),this.$el.addClass("so-widget-no-duplicate")),this.cell.row.builder.supports("deleteWidget")||(this.$(".actions .widget-delete").remove(),this.$el.addClass("so-widget-no-delete")),this.cell.row.builder.supports("moveWidget")||this.$el.addClass("so-widget-no-move"),l.trim(this.$(".actions").html()).length||this.$(".actions").remove(),this.model.get("read_only")&&this.$el.addClass("so-widget-read-only"),0===_.size(this.model.get("values"))||e.loadForm){var t=this.getEditDialog();t.once("form_loaded",t.saveWidget,t),t.setupDialog()}return this},visualCreate:function(){this.$el.hide().fadeIn("fast")},getEditDialog:function(){return null===this.dialog&&(this.dialog=new s.dialog.widget({model:this.model}),this.dialog.setBuilder(this.cell.row.builder),this.dialog.widgetView=this),this.dialog},editHandler:function(){this.getEditDialog().openDialog()},titleClickHandler:function(e){return!this.cell.row.builder.supports("editWidget")||this.model.get("read_only")?this:(this.editHandler(),this)},duplicateHandler:function(){this.cell.row.builder.addHistoryEntry("widget_duplicated");var e=this.model.clone(this.model.cell);return this.cell.model.get("widgets").add(e,{at:this.model.collection.indexOf(this.model)+1}),this.cell.row.builder.model.refreshPanelsData(),this},copyHandler:function(){s.helpers.clipboard.setModel(this.model)},deleteHandler:function(){return this.model.trigger("visual_destroy"),this},onModelChange:function(){this.$(".description").html(this.model.getTitle())},onLabelChange:function(e){this.$(".title > h4").text(e.getWidgetField("title"))},onModelDestroy:function(){this.remove()},visualDestroyModel:function(){this.cell.row.builder.addHistoryEntry("widget_deleted");var e=this;return this.$el.fadeOut("fast",function(){e.cell.row.resize(),e.model.destroy(),e.cell.row.builder.model.refreshPanelsData(),e.remove()}),this},buildContextualMenu:function(e,t){this.cell.row.builder.supports("addWidget")&&t.addSection("add-widget-below",{sectionTitle:panelsOptions.loc.contextual.add_widget_below,searchPlaceholder:panelsOptions.loc.contextual.search_widgets,defaultDisplay:panelsOptions.contextual.default_widgets},panelsOptions.widgets,function(e){this.cell.row.builder.addHistoryEntry("widget_added");var t=new s.model.widget({class:e});t.cell=this.cell.model,this.cell.model.get("widgets").add(t,{at:this.model.collection.indexOf(this.model)+1}),this.cell.row.builder.model.refreshPanelsData()}.bind(this));var i={};this.cell.row.builder.supports("editWidget")&&!this.model.get("read_only")&&(i.edit={title:panelsOptions.loc.contextual.widget_edit}),s.helpers.clipboard.canCopyPaste()&&(i.copy={title:panelsOptions.loc.contextual.widget_copy}),this.cell.row.builder.supports("addWidget")&&(i.duplicate={title:panelsOptions.loc.contextual.widget_duplicate}),this.cell.row.builder.supports("deleteWidget")&&(i.delete={title:panelsOptions.loc.contextual.widget_delete,confirm:!0}),_.isEmpty(i)||t.addSection("widget-actions",{sectionTitle:panelsOptions.loc.contextual.widget_actions,search:!1},i,function(e){switch(e){case"edit":this.editHandler();break;case"copy":this.copyHandler();break;case"duplicate":this.duplicateHandler();break;case"delete":this.visualDestroyModel()}}.bind(this)),this.cell.buildContextualMenu(e,t)}})},{}],30:[function(e,t,i){var s=e("./media-widget"),l=e("./text-widget"),o={MEDIA_AUDIO:"media_audio",MEDIA_IMAGE:"media_image",MEDIA_VIDEO:"media_video",TEXT:"text",addWidget:function(e,t){var i,o=e.find("> .id_base").val();switch(o){case this.MEDIA_AUDIO:case this.MEDIA_IMAGE:case this.MEDIA_VIDEO:i=s;break;case this.TEXT:i=l}i.addWidget(o,e,t)}};t.exports=o},{"./media-widget":31,"./text-widget":32}],31:[function(e,t,i){var s=jQuery,l={addWidget:function(e,t,i){var l=wp.mediaWidgets,o=l.controlConstructors[e];if(o){var n=l.modelConstructors[e]||l.MediaWidgetModel,a=t.find("> .widget-content"),r=s('<div class="media-widget-control"></div>');a.before(r);var d={};a.find(".media-widget-instance-property").each(function(){var e=s(this);d[e.data("property")]=e.val()}),d.widget_id=i;var c=new n(d),h=new o({el:r,model:c});return h.render(),h}}};t.exports=l},{}],32:[function(e,t,i){var s=(jQuery,{addWidget:function(e,t,i){var s=wp.textWidgets,l=new s.TextWidgetControl({el:t});return l.initializeEditor(),l}});t.exports=s},{}]},{},[16]);
lang/siteorigin-panels.pot CHANGED
@@ -73,339 +73,339 @@ msgstr ""
73
  msgid "Installing %s"
74
  msgstr ""
75
 
76
- #: tmp/inc/admin.php:119
77
  msgid "Support Forum"
78
  msgstr ""
79
 
80
- #: tmp/inc/admin.php:120
81
  msgid "Newsletter"
82
  msgstr ""
83
 
84
- #: tmp/inc/admin.php:132, tmp/inc/admin.php:453, tmp/inc/admin.php:938, tmp/inc/admin.php:943, tmp/inc/settings.php:186, tmp/tpl/js-templates.php:201
85
  msgid "Page Builder"
86
  msgstr ""
87
 
88
- #: tmp/inc/admin.php:259
89
  msgid "All Widgets"
90
  msgstr ""
91
 
92
- #: tmp/inc/admin.php:284
93
  msgid "Missing Widget"
94
  msgstr ""
95
 
96
- #: tmp/inc/admin.php:285
97
  msgid "Page Builder doesn't know about this widget."
98
  msgstr ""
99
 
100
- #: tmp/inc/admin.php:289
101
  msgid "%d seconds"
102
  msgstr ""
103
 
104
- #: tmp/inc/admin.php:291
105
  msgid "%d minutes"
106
  msgstr ""
107
 
108
- #: tmp/inc/admin.php:293
109
  msgid "%d hours"
110
  msgstr ""
111
 
112
- #: tmp/inc/admin.php:296
113
  msgid "%d second"
114
  msgstr ""
115
 
116
- #: tmp/inc/admin.php:298
117
  msgid "%d minute"
118
  msgstr ""
119
 
120
- #: tmp/inc/admin.php:300
121
  msgid "%d hour"
122
  msgstr ""
123
 
124
- #: tmp/inc/admin.php:303
125
  msgid "%s before"
126
  msgstr ""
127
 
128
- #: tmp/inc/admin.php:304
129
  msgid "Now"
130
  msgstr ""
131
 
132
- #: tmp/inc/admin.php:308
133
  msgid "Current"
134
  msgstr ""
135
 
136
- #: tmp/inc/admin.php:309
137
  msgid "Original"
138
  msgstr ""
139
 
140
- #: tmp/inc/admin.php:310
141
  msgid "Version restored"
142
  msgstr ""
143
 
144
- #: tmp/inc/admin.php:311
145
  msgid "Converted to editor"
146
  msgstr ""
147
 
148
- #: tmp/inc/admin.php:315
149
  msgid "Widget deleted"
150
  msgstr ""
151
 
152
- #: tmp/inc/admin.php:317
153
  msgid "Widget added"
154
  msgstr ""
155
 
156
- #: tmp/inc/admin.php:319
157
  msgid "Widget edited"
158
  msgstr ""
159
 
160
- #: tmp/inc/admin.php:321
161
  msgid "Widget duplicated"
162
  msgstr ""
163
 
164
- #: tmp/inc/admin.php:323
165
  msgid "Widget moved"
166
  msgstr ""
167
 
168
- #: tmp/inc/admin.php:327
169
  msgid "Row deleted"
170
  msgstr ""
171
 
172
- #: tmp/inc/admin.php:329
173
  msgid "Row added"
174
  msgstr ""
175
 
176
- #: tmp/inc/admin.php:331
177
  msgid "Row edited"
178
  msgstr ""
179
 
180
- #: tmp/inc/admin.php:333
181
  msgid "Row moved"
182
  msgstr ""
183
 
184
- #: tmp/inc/admin.php:335
185
  msgid "Row duplicated"
186
  msgstr ""
187
 
188
- #: tmp/inc/admin.php:337
189
  msgid "Row pasted"
190
  msgstr ""
191
 
192
- #: tmp/inc/admin.php:340
193
  msgid "Cell resized"
194
  msgstr ""
195
 
196
- #: tmp/inc/admin.php:343
197
  msgid "Prebuilt layout loaded"
198
  msgstr ""
199
 
200
- #: tmp/inc/admin.php:347
201
  msgid "Loading prebuilt layout"
202
  msgstr ""
203
 
204
- #: tmp/inc/admin.php:348
205
  msgid "Would you like to copy this editor's existing content to Page Builder?"
206
  msgstr ""
207
 
208
- #: tmp/inc/admin.php:349
209
  msgid "Would you like to clear your Page Builder content and revert to using the standard visual editor?"
210
  msgstr ""
211
 
212
- #: tmp/inc/admin.php:351
213
  msgid "Layout Builder Widget"
214
  msgstr ""
215
 
216
- #: tmp/inc/admin.php:353, tmp/tpl/js-templates.php:105, tmp/tpl/js-templates.php:424
217
  msgid "Are you sure?"
218
  msgstr ""
219
 
220
- #: tmp/inc/admin.php:355
221
  msgid "%s is ready to insert."
222
  msgstr ""
223
 
224
- #: tmp/inc/admin.php:359
225
  msgid "Add Widget Below"
226
  msgstr ""
227
 
228
- #: tmp/inc/admin.php:360
229
  msgid "Add Widget to Cell"
230
  msgstr ""
231
 
232
- #: tmp/inc/admin.php:361, tmp/tpl/js-templates.php:228
233
  msgid "Search Widgets"
234
  msgstr ""
235
 
236
- #: tmp/inc/admin.php:363, tmp/tpl/js-templates.php:17, tmp/tpl/js-templates.php:19
237
  msgid "Add Row"
238
  msgstr ""
239
 
240
- #: tmp/inc/admin.php:364
241
  msgid "Column"
242
  msgstr ""
243
 
244
- #: tmp/inc/admin.php:366
245
  msgid "Cell Actions"
246
  msgstr ""
247
 
248
- #: tmp/inc/admin.php:367
249
  msgid "Paste Widget"
250
  msgstr ""
251
 
252
- #: tmp/inc/admin.php:369
253
  msgid "Widget Actions"
254
  msgstr ""
255
 
256
- #: tmp/inc/admin.php:370
257
  msgid "Edit Widget"
258
  msgstr ""
259
 
260
- #: tmp/inc/admin.php:371
261
  msgid "Duplicate Widget"
262
  msgstr ""
263
 
264
- #: tmp/inc/admin.php:372
265
  msgid "Delete Widget"
266
  msgstr ""
267
 
268
- #: tmp/inc/admin.php:373
269
  msgid "Copy Widget"
270
  msgstr ""
271
 
272
- #: tmp/inc/admin.php:374
273
  msgid "Paste Widget Below"
274
  msgstr ""
275
 
276
- #: tmp/inc/admin.php:376
277
  msgid "Row Actions"
278
  msgstr ""
279
 
280
- #: tmp/inc/admin.php:377, tmp/tpl/js-templates.php:103
281
  msgid "Edit Row"
282
  msgstr ""
283
 
284
- #: tmp/inc/admin.php:378, tmp/tpl/js-templates.php:104
285
  msgid "Duplicate Row"
286
  msgstr ""
287
 
288
- #: tmp/inc/admin.php:379, tmp/tpl/js-templates.php:105
289
  msgid "Delete Row"
290
  msgstr ""
291
 
292
- #: tmp/inc/admin.php:380
293
  msgid "Copy Row"
294
  msgstr ""
295
 
296
- #: tmp/inc/admin.php:381
297
  msgid "Paste Row"
298
  msgstr ""
299
 
300
- #: tmp/inc/admin.php:383
301
  msgid "Draft"
302
  msgstr ""
303
 
304
- #: tmp/inc/admin.php:384
305
  msgid "Untitled"
306
  msgstr ""
307
 
308
- #: tmp/inc/admin.php:386
309
  msgid "New Row"
310
  msgstr ""
311
 
312
- #: tmp/inc/admin.php:387, tmp/inc/styles.php:173, tmp/tpl/js-templates.php:68
313
  msgid "Row"
314
  msgstr ""
315
 
316
- #: tmp/inc/admin.php:395
317
  msgid "Page Builder layouts"
318
  msgstr ""
319
 
320
- #: tmp/inc/admin.php:396
321
  msgid "Error uploading or importing file."
322
  msgstr ""
323
 
324
- #: tmp/inc/admin.php:534, tmp/inc/home.php:26
325
  msgid "Home Page"
326
  msgstr ""
327
 
328
- #: tmp/inc/admin.php:628
329
  msgid "Untitled Widget"
330
  msgstr ""
331
 
332
- #: tmp/inc/admin.php:793
333
  msgid "You need to install 1{%1$s} to use the widget 2{%2$s}."
334
  msgstr ""
335
 
336
- #: tmp/inc/admin.php:799
337
  msgid "Save and reload this page to start using the widget after you've installed it."
338
  msgstr ""
339
 
340
- #: tmp/inc/admin.php:815
341
  msgid "The widget 1{%1$s} is not available. Please try locate and install the missing plugin. Post on the 2{support forums} if you need help."
342
  msgstr ""
343
 
344
- #: tmp/inc/admin.php:955
345
  msgid "%s Widgets"
346
  msgstr ""
347
 
348
- #: tmp/inc/admin.php:1001
349
  msgid "12 Page Builder Tips"
350
  msgstr ""
351
 
352
- #: tmp/inc/admin.php:1004
353
  msgid "Sign up to our newsletter and we'll send you this free Page Builder video course."
354
  msgstr ""
355
 
356
- #: tmp/inc/admin.php:1005
357
  msgid "12 tips that'll help you get the most out of Page Builder."
358
  msgstr ""
359
 
360
- #: tmp/inc/admin.php:1006
361
  msgid "Watch the video to find out more, then sign up below to get started."
362
  msgstr ""
363
 
364
- #: tmp/inc/admin.php:1007, tmp/inc/admin.php:1017
365
  msgid "We'll email you a confirmation. You can unsubscribe at any time."
366
  msgstr ""
367
 
368
- #: tmp/inc/admin.php:1011
369
  msgid "Free Page Builder Addons"
370
  msgstr ""
371
 
372
- #: tmp/inc/admin.php:1014
373
  msgid "The free animations addon allows you to add beautiful animations to Page Builder elements."
374
  msgstr ""
375
 
376
- #: tmp/inc/admin.php:1015
377
  msgid "Sign up to our newsletter and we'll send you the addon as a free gift."
378
  msgstr ""
379
 
380
- #: tmp/inc/admin.php:1016
381
  msgid "Plus, we'll send you even more powerful addons, for as long as you're subscribed."
382
  msgstr ""
383
 
384
- #: tmp/inc/admin.php:1032
385
  msgid "Watch Intro Video"
386
  msgstr ""
387
 
388
- #: tmp/inc/admin.php:1033
389
  msgid "Loaded from Vimeo Servers"
390
  msgstr ""
391
 
392
- #: tmp/inc/admin.php:1034
393
  msgid "Please enter a valid email address."
394
  msgstr ""
395
 
396
- #: tmp/inc/admin.php:1036
397
  msgid "Your Name"
398
  msgstr ""
399
 
400
- #: tmp/inc/admin.php:1037
401
  msgid "Your Email"
402
  msgstr ""
403
 
404
- #: tmp/inc/admin.php:1038
405
  msgid "Sign Up"
406
  msgstr ""
407
 
408
- #: tmp/inc/admin.php:1039, tmp/tpl/js-templates.php:240
409
  msgid "Close"
410
  msgstr ""
411
 
@@ -889,7 +889,7 @@ msgstr ""
889
  msgid "Collapse Order"
890
  msgstr ""
891
 
892
- #: tmp/inc/styles.php:229, tmp/widgets/basic.php:514, tmp/widgets/widgets.php:635, tmp/widgets/widgets.php:757
893
  msgid "Default"
894
  msgstr ""
895
 
@@ -953,6 +953,158 @@ msgstr ""
953
  msgid "Color of links inside this widget."
954
  msgstr ""
955
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
956
  #: tmp/settings/tpl/help.php:6
957
  msgid "Please read the 1{settings guide} of the Page Builder documentation for help."
958
  msgstr ""
@@ -969,15 +1121,15 @@ msgstr ""
969
  msgid "Save Settings"
970
  msgstr ""
971
 
972
- #: tmp/siteorigin-panels.php:297
973
  msgid "Read More"
974
  msgstr ""
975
 
976
- #: tmp/siteorigin-panels.php:380
977
  msgid "Edit Home Page"
978
  msgstr ""
979
 
980
- #: tmp/siteorigin-panels.php:400, tmp/tpl/js-templates.php:34, tmp/tpl/js-templates.php:36
981
  msgid "Live Editor"
982
  msgstr ""
983
 
@@ -1217,154 +1369,6 @@ msgstr ""
1217
  msgid "No Results"
1218
  msgstr ""
1219
 
1220
- #: tmp/widgets/basic.php:13
1221
- msgid "Layout Builder"
1222
- msgstr ""
1223
-
1224
- #: tmp/widgets/basic.php:15
1225
- msgid "A complete SiteOrigin Page Builder layout as a widget."
1226
- msgstr ""
1227
-
1228
- #: tmp/widgets/basic.php:94
1229
- msgid "Open Builder"
1230
- msgstr ""
1231
-
1232
- #: tmp/widgets/basic.php:130
1233
- msgid "Post Content"
1234
- msgstr ""
1235
-
1236
- #: tmp/widgets/basic.php:132
1237
- msgid "Displays content from the current post."
1238
- msgstr ""
1239
-
1240
- #: tmp/widgets/basic.php:178, tmp/widgets/basic.php:488, tmp/widgets/widgets.php:608, tmp/widgets/widgets.php:783
1241
- msgid "None"
1242
- msgstr ""
1243
-
1244
- #: tmp/widgets/basic.php:179, tmp/widgets/basic.php:416, tmp/widgets/widgets/call-to-action/call-to-action.php:15, tmp/widgets/widgets/list/list.php:15, tmp/widgets/widgets/price-box/price-box.php:15
1245
- msgid "Title"
1246
- msgstr ""
1247
-
1248
- #: tmp/widgets/basic.php:180
1249
- msgid "Featured Image"
1250
- msgstr ""
1251
-
1252
- #: tmp/widgets/basic.php:185
1253
- msgid "Display Content"
1254
- msgstr ""
1255
-
1256
- #: tmp/widgets/basic.php:205
1257
- msgid "Post Loop"
1258
- msgstr ""
1259
-
1260
- #: tmp/widgets/basic.php:207
1261
- msgid "Displays a post loop."
1262
- msgstr ""
1263
-
1264
- #: tmp/widgets/basic.php:410
1265
- msgid "Your theme doesn't have any post loops."
1266
- msgstr ""
1267
-
1268
- #: tmp/widgets/basic.php:420
1269
- msgid "Template"
1270
- msgstr ""
1271
-
1272
- #: tmp/widgets/basic.php:436
1273
- msgid "More Link"
1274
- msgstr ""
1275
-
1276
- #: tmp/widgets/basic.php:438
1277
- msgid "If the template supports it, cut posts and display the more link."
1278
- msgstr ""
1279
-
1280
- #: tmp/widgets/basic.php:472, tmp/widgets/widgets.php:594
1281
- msgid "Post Type"
1282
- msgstr ""
1283
-
1284
- #: tmp/widgets/basic.php:481, tmp/widgets/widgets.php:601
1285
- msgid "Posts Per Page"
1286
- msgstr ""
1287
-
1288
- #: tmp/widgets/basic.php:486, tmp/widgets/widgets.php:606
1289
- msgid "Order By"
1290
- msgstr ""
1291
-
1292
- #: tmp/widgets/basic.php:489, tmp/widgets/widgets.php:609
1293
- msgid "Post ID"
1294
- msgstr ""
1295
-
1296
- #: tmp/widgets/basic.php:490, tmp/widgets/widgets.php:610
1297
- msgid "Author"
1298
- msgstr ""
1299
-
1300
- #: tmp/widgets/basic.php:491, tmp/widgets/basic.php:492, tmp/widgets/widgets.php:611, tmp/widgets/widgets.php:612, tmp/widgets/widgets/testimonial/testimonial.php:15
1301
- msgid "Name"
1302
- msgstr ""
1303
-
1304
- #: tmp/widgets/basic.php:493, tmp/widgets/widgets.php:613
1305
- msgid "Date"
1306
- msgstr ""
1307
-
1308
- #: tmp/widgets/basic.php:494, tmp/widgets/widgets.php:614
1309
- msgid "Modified"
1310
- msgstr ""
1311
-
1312
- #: tmp/widgets/basic.php:495, tmp/widgets/widgets.php:615
1313
- msgid "Parent"
1314
- msgstr ""
1315
-
1316
- #: tmp/widgets/basic.php:496, tmp/widgets/widgets.php:616
1317
- msgid "Random"
1318
- msgstr ""
1319
-
1320
- #: tmp/widgets/basic.php:497, tmp/widgets/widgets.php:617
1321
- msgid "Comment Count"
1322
- msgstr ""
1323
-
1324
- #: tmp/widgets/basic.php:498, tmp/widgets/widgets.php:618
1325
- msgid "Menu Order"
1326
- msgstr ""
1327
-
1328
- #: tmp/widgets/basic.php:499
1329
- msgid "Post In Order"
1330
- msgstr ""
1331
-
1332
- #: tmp/widgets/basic.php:504, tmp/widgets/widgets.php:624
1333
- msgid "Order"
1334
- msgstr ""
1335
-
1336
- #: tmp/widgets/basic.php:506, tmp/widgets/widgets.php:627
1337
- msgid "Descending"
1338
- msgstr ""
1339
-
1340
- #: tmp/widgets/basic.php:507, tmp/widgets/widgets.php:626
1341
- msgid "Ascending"
1342
- msgstr ""
1343
-
1344
- #: tmp/widgets/basic.php:512, tmp/widgets/widgets.php:633
1345
- msgid "Sticky Posts"
1346
- msgstr ""
1347
-
1348
- #: tmp/widgets/basic.php:515, tmp/widgets/widgets.php:636
1349
- msgid "Ignore Sticky"
1350
- msgstr ""
1351
-
1352
- #: tmp/widgets/basic.php:516, tmp/widgets/widgets.php:637
1353
- msgid "Exclude Sticky"
1354
- msgstr ""
1355
-
1356
- #: tmp/widgets/basic.php:517, tmp/widgets/widgets.php:638
1357
- msgid "Only Sticky"
1358
- msgstr ""
1359
-
1360
- #: tmp/widgets/basic.php:522
1361
- msgid "Additional "
1362
- msgstr ""
1363
-
1364
- #: tmp/widgets/basic.php:529, tmp/widgets/widgets.php:648
1365
- msgid "Additional query arguments. See 1{query_posts}."
1366
- msgstr ""
1367
-
1368
  #: tmp/widgets/widgets.php:161
1369
  msgid "This is a legacy widget. "
1370
  msgstr ""
73
  msgid "Installing %s"
74
  msgstr ""
75
 
76
+ #: tmp/inc/admin.php:121
77
  msgid "Support Forum"
78
  msgstr ""
79
 
80
+ #: tmp/inc/admin.php:122
81
  msgid "Newsletter"
82
  msgstr ""
83
 
84
+ #: tmp/inc/admin.php:134, tmp/inc/admin.php:470, tmp/inc/admin.php:996, tmp/inc/admin.php:1001, tmp/inc/settings.php:186, tmp/tpl/js-templates.php:201
85
  msgid "Page Builder"
86
  msgstr ""
87
 
88
+ #: tmp/inc/admin.php:261
89
  msgid "All Widgets"
90
  msgstr ""
91
 
92
+ #: tmp/inc/admin.php:286
93
  msgid "Missing Widget"
94
  msgstr ""
95
 
96
+ #: tmp/inc/admin.php:287
97
  msgid "Page Builder doesn't know about this widget."
98
  msgstr ""
99
 
100
+ #: tmp/inc/admin.php:291
101
  msgid "%d seconds"
102
  msgstr ""
103
 
104
+ #: tmp/inc/admin.php:293
105
  msgid "%d minutes"
106
  msgstr ""
107
 
108
+ #: tmp/inc/admin.php:295
109
  msgid "%d hours"
110
  msgstr ""
111
 
112
+ #: tmp/inc/admin.php:298
113
  msgid "%d second"
114
  msgstr ""
115
 
116
+ #: tmp/inc/admin.php:300
117
  msgid "%d minute"
118
  msgstr ""
119
 
120
+ #: tmp/inc/admin.php:302
121
  msgid "%d hour"
122
  msgstr ""
123
 
124
+ #: tmp/inc/admin.php:305
125
  msgid "%s before"
126
  msgstr ""
127
 
128
+ #: tmp/inc/admin.php:306
129
  msgid "Now"
130
  msgstr ""
131
 
132
+ #: tmp/inc/admin.php:310
133
  msgid "Current"
134
  msgstr ""
135
 
136
+ #: tmp/inc/admin.php:311
137
  msgid "Original"
138
  msgstr ""
139
 
140
+ #: tmp/inc/admin.php:312
141
  msgid "Version restored"
142
  msgstr ""
143
 
144
+ #: tmp/inc/admin.php:313
145
  msgid "Converted to editor"
146
  msgstr ""
147
 
148
+ #: tmp/inc/admin.php:317
149
  msgid "Widget deleted"
150
  msgstr ""
151
 
152
+ #: tmp/inc/admin.php:319
153
  msgid "Widget added"
154
  msgstr ""
155
 
156
+ #: tmp/inc/admin.php:321
157
  msgid "Widget edited"
158
  msgstr ""
159
 
160
+ #: tmp/inc/admin.php:323
161
  msgid "Widget duplicated"
162
  msgstr ""
163
 
164
+ #: tmp/inc/admin.php:325
165
  msgid "Widget moved"
166
  msgstr ""
167
 
168
+ #: tmp/inc/admin.php:329
169
  msgid "Row deleted"
170
  msgstr ""
171
 
172
+ #: tmp/inc/admin.php:331
173
  msgid "Row added"
174
  msgstr ""
175
 
176
+ #: tmp/inc/admin.php:333
177
  msgid "Row edited"
178
  msgstr ""
179
 
180
+ #: tmp/inc/admin.php:335
181
  msgid "Row moved"
182
  msgstr ""
183
 
184
+ #: tmp/inc/admin.php:337
185
  msgid "Row duplicated"
186
  msgstr ""
187
 
188
+ #: tmp/inc/admin.php:339
189
  msgid "Row pasted"
190
  msgstr ""
191
 
192
+ #: tmp/inc/admin.php:342
193
  msgid "Cell resized"
194
  msgstr ""
195
 
196
+ #: tmp/inc/admin.php:345
197
  msgid "Prebuilt layout loaded"
198
  msgstr ""
199
 
200
+ #: tmp/inc/admin.php:349
201
  msgid "Loading prebuilt layout"
202
  msgstr ""
203
 
204
+ #: tmp/inc/admin.php:350
205
  msgid "Would you like to copy this editor's existing content to Page Builder?"
206
  msgstr ""
207
 
208
+ #: tmp/inc/admin.php:351
209
  msgid "Would you like to clear your Page Builder content and revert to using the standard visual editor?"
210
  msgstr ""
211
 
212
+ #: tmp/inc/admin.php:353
213
  msgid "Layout Builder Widget"
214
  msgstr ""
215
 
216
+ #: tmp/inc/admin.php:355, tmp/tpl/js-templates.php:105, tmp/tpl/js-templates.php:424
217
  msgid "Are you sure?"
218
  msgstr ""
219
 
220
+ #: tmp/inc/admin.php:357
221
  msgid "%s is ready to insert."
222
  msgstr ""
223
 
224
+ #: tmp/inc/admin.php:361
225
  msgid "Add Widget Below"
226
  msgstr ""
227
 
228
+ #: tmp/inc/admin.php:362
229
  msgid "Add Widget to Cell"
230
  msgstr ""
231
 
232
+ #: tmp/inc/admin.php:363, tmp/tpl/js-templates.php:228
233
  msgid "Search Widgets"
234
  msgstr ""
235
 
236
+ #: tmp/inc/admin.php:365, tmp/tpl/js-templates.php:17, tmp/tpl/js-templates.php:19
237
  msgid "Add Row"
238
  msgstr ""
239
 
240
+ #: tmp/inc/admin.php:366
241
  msgid "Column"
242
  msgstr ""
243
 
244
+ #: tmp/inc/admin.php:368
245
  msgid "Cell Actions"
246
  msgstr ""
247
 
248
+ #: tmp/inc/admin.php:369
249
  msgid "Paste Widget"
250
  msgstr ""
251
 
252
+ #: tmp/inc/admin.php:371
253
  msgid "Widget Actions"
254
  msgstr ""
255
 
256
+ #: tmp/inc/admin.php:372
257
  msgid "Edit Widget"
258
  msgstr ""
259
 
260
+ #: tmp/inc/admin.php:373
261
  msgid "Duplicate Widget"
262
  msgstr ""
263
 
264
+ #: tmp/inc/admin.php:374
265
  msgid "Delete Widget"
266
  msgstr ""
267
 
268
+ #: tmp/inc/admin.php:375
269
  msgid "Copy Widget"
270
  msgstr ""
271
 
272
+ #: tmp/inc/admin.php:376
273
  msgid "Paste Widget Below"
274
  msgstr ""
275
 
276
+ #: tmp/inc/admin.php:378
277
  msgid "Row Actions"
278
  msgstr ""
279
 
280
+ #: tmp/inc/admin.php:379, tmp/tpl/js-templates.php:103
281
  msgid "Edit Row"
282
  msgstr ""
283
 
284
+ #: tmp/inc/admin.php:380, tmp/tpl/js-templates.php:104
285
  msgid "Duplicate Row"
286
  msgstr ""
287
 
288
+ #: tmp/inc/admin.php:381, tmp/tpl/js-templates.php:105
289
  msgid "Delete Row"
290
  msgstr ""
291
 
292
+ #: tmp/inc/admin.php:382
293
  msgid "Copy Row"
294
  msgstr ""
295
 
296
+ #: tmp/inc/admin.php:383
297
  msgid "Paste Row"
298
  msgstr ""
299
 
300
+ #: tmp/inc/admin.php:385
301
  msgid "Draft"
302
  msgstr ""
303
 
304
+ #: tmp/inc/admin.php:386
305
  msgid "Untitled"
306
  msgstr ""
307
 
308
+ #: tmp/inc/admin.php:388
309
  msgid "New Row"
310
  msgstr ""
311
 
312
+ #: tmp/inc/admin.php:389, tmp/inc/styles.php:173, tmp/tpl/js-templates.php:68
313
  msgid "Row"
314
  msgstr ""
315
 
316
+ #: tmp/inc/admin.php:397
317
  msgid "Page Builder layouts"
318
  msgstr ""
319
 
320
+ #: tmp/inc/admin.php:398
321
  msgid "Error uploading or importing file."
322
  msgstr ""
323
 
324
+ #: tmp/inc/admin.php:551, tmp/inc/home.php:26
325
  msgid "Home Page"
326
  msgstr ""
327
 
328
+ #: tmp/inc/admin.php:645
329
  msgid "Untitled Widget"
330
  msgstr ""
331
 
332
+ #: tmp/inc/admin.php:827
333
  msgid "You need to install 1{%1$s} to use the widget 2{%2$s}."
334
  msgstr ""
335
 
336
+ #: tmp/inc/admin.php:833
337
  msgid "Save and reload this page to start using the widget after you've installed it."
338
  msgstr ""
339
 
340
+ #: tmp/inc/admin.php:849
341
  msgid "The widget 1{%1$s} is not available. Please try locate and install the missing plugin. Post on the 2{support forums} if you need help."
342
  msgstr ""
343
 
344
+ #: tmp/inc/admin.php:1013
345
  msgid "%s Widgets"
346
  msgstr ""
347
 
348
+ #: tmp/inc/admin.php:1059
349
  msgid "12 Page Builder Tips"
350
  msgstr ""
351
 
352
+ #: tmp/inc/admin.php:1062
353
  msgid "Sign up to our newsletter and we'll send you this free Page Builder video course."
354
  msgstr ""
355
 
356
+ #: tmp/inc/admin.php:1063
357
  msgid "12 tips that'll help you get the most out of Page Builder."
358
  msgstr ""
359
 
360
+ #: tmp/inc/admin.php:1064
361
  msgid "Watch the video to find out more, then sign up below to get started."
362
  msgstr ""
363
 
364
+ #: tmp/inc/admin.php:1065, tmp/inc/admin.php:1075
365
  msgid "We'll email you a confirmation. You can unsubscribe at any time."
366
  msgstr ""
367
 
368
+ #: tmp/inc/admin.php:1069
369
  msgid "Free Page Builder Addons"
370
  msgstr ""
371
 
372
+ #: tmp/inc/admin.php:1072
373
  msgid "The free animations addon allows you to add beautiful animations to Page Builder elements."
374
  msgstr ""
375
 
376
+ #: tmp/inc/admin.php:1073
377
  msgid "Sign up to our newsletter and we'll send you the addon as a free gift."
378
  msgstr ""
379
 
380
+ #: tmp/inc/admin.php:1074
381
  msgid "Plus, we'll send you even more powerful addons, for as long as you're subscribed."
382
  msgstr ""
383
 
384
+ #: tmp/inc/admin.php:1090
385
  msgid "Watch Intro Video"
386
  msgstr ""
387
 
388
+ #: tmp/inc/admin.php:1091
389
  msgid "Loaded from Vimeo Servers"
390
  msgstr ""
391
 
392
+ #: tmp/inc/admin.php:1092
393
  msgid "Please enter a valid email address."
394
  msgstr ""
395
 
396
+ #: tmp/inc/admin.php:1094, tmp/learn/tpl/dialog.php:22
397
  msgid "Your Name"
398
  msgstr ""
399
 
400
+ #: tmp/inc/admin.php:1095, tmp/learn/tpl/dialog.php:27
401
  msgid "Your Email"
402
  msgstr ""
403
 
404
+ #: tmp/inc/admin.php:1096, tmp/learn/tpl/dialog.php:31
405
  msgid "Sign Up"
406
  msgstr ""
407
 
408
+ #: tmp/inc/admin.php:1097, tmp/learn/tpl/dialog.php:37, tmp/tpl/js-templates.php:240
409
  msgid "Close"
410
  msgstr ""
411
 
889
  msgid "Collapse Order"
890
  msgstr ""
891
 
892
+ #: tmp/inc/styles.php:229, tmp/inc/widgets/post-loop.php:294, tmp/widgets/widgets.php:635, tmp/widgets/widgets.php:757
893
  msgid "Default"
894
  msgstr ""
895
 
953
  msgid "Color of links inside this widget."
954
  msgstr ""
955
 
956
+ #: tmp/inc/widgets/layout.php:13
957
+ msgid "Layout Builder"
958
+ msgstr ""
959
+
960
+ #: tmp/inc/widgets/layout.php:15
961
+ msgid "A complete SiteOrigin Page Builder layout as a widget."
962
+ msgstr ""
963
+
964
+ #: tmp/inc/widgets/layout.php:94
965
+ msgid "Open Builder"
966
+ msgstr ""
967
+
968
+ #: tmp/inc/widgets/post-content.php:12
969
+ msgid "Post Content"
970
+ msgstr ""
971
+
972
+ #: tmp/inc/widgets/post-content.php:14
973
+ msgid "Displays content from the current post."
974
+ msgstr ""
975
+
976
+ #: tmp/inc/widgets/post-content.php:60, tmp/inc/widgets/post-loop.php:268, tmp/widgets/widgets.php:608, tmp/widgets/widgets.php:783
977
+ msgid "None"
978
+ msgstr ""
979
+
980
+ #: tmp/inc/widgets/post-content.php:61, tmp/inc/widgets/post-loop-helper.php:37, tmp/inc/widgets/post-loop.php:215, tmp/widgets/widgets/call-to-action/call-to-action.php:15, tmp/widgets/widgets/list/list.php:15, tmp/widgets/widgets/price-box/price-box.php:15
981
+ msgid "Title"
982
+ msgstr ""
983
+
984
+ #: tmp/inc/widgets/post-content.php:62
985
+ msgid "Featured Image"
986
+ msgstr ""
987
+
988
+ #: tmp/inc/widgets/post-content.php:67
989
+ msgid "Display Content"
990
+ msgstr ""
991
+
992
+ #: tmp/inc/widgets/post-loop-helper.php:29, tmp/inc/widgets/post-loop.php:15
993
+ msgid "Post Loop"
994
+ msgstr ""
995
+
996
+ #: tmp/inc/widgets/post-loop-helper.php:31, tmp/inc/widgets/post-loop.php:17
997
+ msgid "Displays a post loop."
998
+ msgstr ""
999
+
1000
+ #: tmp/inc/widgets/post-loop-helper.php:41, tmp/inc/widgets/post-loop.php:219
1001
+ msgid "Template"
1002
+ msgstr ""
1003
+
1004
+ #: tmp/inc/widgets/post-loop-helper.php:48, tmp/inc/widgets/post-loop.php:237
1005
+ msgid "If the template supports it, cut posts and display the more link."
1006
+ msgstr ""
1007
+
1008
+ #: tmp/inc/widgets/post-loop.php:178
1009
+ msgid "Your theme doesn't have any post loops."
1010
+ msgstr ""
1011
+
1012
+ #: tmp/inc/widgets/post-loop.php:235
1013
+ msgid "More Link"
1014
+ msgstr ""
1015
+
1016
+ #: tmp/inc/widgets/post-loop.php:252, tmp/widgets/widgets.php:594
1017
+ msgid "Post Type"
1018
+ msgstr ""
1019
+
1020
+ #: tmp/inc/widgets/post-loop.php:261, tmp/widgets/widgets.php:601
1021
+ msgid "Posts Per Page"
1022
+ msgstr ""
1023
+
1024
+ #: tmp/inc/widgets/post-loop.php:266, tmp/widgets/widgets.php:606
1025
+ msgid "Order By"
1026
+ msgstr ""
1027
+
1028
+ #: tmp/inc/widgets/post-loop.php:269, tmp/widgets/widgets.php:609
1029
+ msgid "Post ID"
1030
+ msgstr ""
1031
+
1032
+ #: tmp/inc/widgets/post-loop.php:270, tmp/widgets/widgets.php:610
1033
+ msgid "Author"
1034
+ msgstr ""
1035
+
1036
+ #: tmp/inc/widgets/post-loop.php:271, tmp/inc/widgets/post-loop.php:272, tmp/widgets/widgets.php:611, tmp/widgets/widgets.php:612, tmp/widgets/widgets/testimonial/testimonial.php:15
1037
+ msgid "Name"
1038
+ msgstr ""
1039
+
1040
+ #: tmp/inc/widgets/post-loop.php:273, tmp/widgets/widgets.php:613
1041
+ msgid "Date"
1042
+ msgstr ""
1043
+
1044
+ #: tmp/inc/widgets/post-loop.php:274, tmp/widgets/widgets.php:614
1045
+ msgid "Modified"
1046
+ msgstr ""
1047
+
1048
+ #: tmp/inc/widgets/post-loop.php:275, tmp/widgets/widgets.php:615
1049
+ msgid "Parent"
1050
+ msgstr ""
1051
+
1052
+ #: tmp/inc/widgets/post-loop.php:276, tmp/widgets/widgets.php:616
1053
+ msgid "Random"
1054
+ msgstr ""
1055
+
1056
+ #: tmp/inc/widgets/post-loop.php:277, tmp/widgets/widgets.php:617
1057
+ msgid "Comment Count"
1058
+ msgstr ""
1059
+
1060
+ #: tmp/inc/widgets/post-loop.php:278, tmp/widgets/widgets.php:618
1061
+ msgid "Menu Order"
1062
+ msgstr ""
1063
+
1064
+ #: tmp/inc/widgets/post-loop.php:279
1065
+ msgid "Post In Order"
1066
+ msgstr ""
1067
+
1068
+ #: tmp/inc/widgets/post-loop.php:284, tmp/widgets/widgets.php:624
1069
+ msgid "Order"
1070
+ msgstr ""
1071
+
1072
+ #: tmp/inc/widgets/post-loop.php:286, tmp/widgets/widgets.php:627
1073
+ msgid "Descending"
1074
+ msgstr ""
1075
+
1076
+ #: tmp/inc/widgets/post-loop.php:287, tmp/widgets/widgets.php:626
1077
+ msgid "Ascending"
1078
+ msgstr ""
1079
+
1080
+ #: tmp/inc/widgets/post-loop.php:292, tmp/widgets/widgets.php:633
1081
+ msgid "Sticky Posts"
1082
+ msgstr ""
1083
+
1084
+ #: tmp/inc/widgets/post-loop.php:295, tmp/widgets/widgets.php:636
1085
+ msgid "Ignore Sticky"
1086
+ msgstr ""
1087
+
1088
+ #: tmp/inc/widgets/post-loop.php:296, tmp/widgets/widgets.php:637
1089
+ msgid "Exclude Sticky"
1090
+ msgstr ""
1091
+
1092
+ #: tmp/inc/widgets/post-loop.php:297, tmp/widgets/widgets.php:638
1093
+ msgid "Only Sticky"
1094
+ msgstr ""
1095
+
1096
+ #: tmp/inc/widgets/post-loop.php:302
1097
+ msgid "Additional "
1098
+ msgstr ""
1099
+
1100
+ #: tmp/inc/widgets/post-loop.php:309, tmp/widgets/widgets.php:648
1101
+ msgid "Additional query arguments. See 1{query_posts}."
1102
+ msgstr ""
1103
+
1104
+ #: tmp/learn/tpl/dialog.php:19
1105
+ msgid "Please enter a valid email"
1106
+ msgstr ""
1107
+
1108
  #: tmp/settings/tpl/help.php:6
1109
  msgid "Please read the 1{settings guide} of the Page Builder documentation for help."
1110
  msgstr ""
1121
  msgid "Save Settings"
1122
  msgstr ""
1123
 
1124
+ #: tmp/siteorigin-panels.php:305
1125
  msgid "Read More"
1126
  msgstr ""
1127
 
1128
+ #: tmp/siteorigin-panels.php:388
1129
  msgid "Edit Home Page"
1130
  msgstr ""
1131
 
1132
+ #: tmp/siteorigin-panels.php:408, tmp/tpl/js-templates.php:34, tmp/tpl/js-templates.php:36
1133
  msgid "Live Editor"
1134
  msgstr ""
1135
 
1369
  msgid "No Results"
1370
  msgstr ""
1371
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1372
  #: tmp/widgets/widgets.php:161
1373
  msgid "This is a legacy widget. "
1374
  msgstr ""
learn/css/learn.css CHANGED
@@ -13,19 +13,12 @@
13
  position: fixed;
14
  top: 50%;
15
  left: 50%;
16
- padding: 20px 30px;
17
  max-width: 700px;
18
  margin-left: -350px;
19
  min-height: 400px;
20
  margin-top: -200px;
21
  background-color: #fff; }
22
- #siteorigin-learn #siteorigin-learn-dialog .video-title {
23
- font-weight: 300;
24
- text-align: center;
25
- line-height: 1.2em;
26
- font-size: 22px;
27
- color: #555;
28
- margin: 0 0 20px 0; }
29
  #siteorigin-learn #siteorigin-learn-dialog .poster-wrapper {
30
  cursor: pointer;
31
  display: block;
@@ -39,29 +32,10 @@
39
  bottom: 0;
40
  left: 0;
41
  width: 640px;
42
- height: 58px; }
43
- #siteorigin-learn #siteorigin-learn-dialog .poster-wrapper .video-play-info {
44
- position: absolute;
45
- top: 0;
46
- bottom: 0;
47
- left: 0;
48
- right: 0;
49
- background: rgba(0, 0, 0, 0.75);
50
- display: flex;
51
- justify-content: center;
52
- align-items: center;
53
- opacity: 0;
54
- transition: 0.25s; }
55
- #siteorigin-learn #siteorigin-learn-dialog .poster-wrapper .video-play-info .video-play-info-text {
56
- text-align: center;
57
- font-size: 1.8em;
58
- color: rgba(255, 255, 255, 0.95); }
59
- #siteorigin-learn #siteorigin-learn-dialog .poster-wrapper .video-play-info .video-play-info-text small {
60
- display: block;
61
- margin-top: 0.8em;
62
- font-size: 0.65em;
63
- font-weight: 200; }
64
- #siteorigin-learn #siteorigin-learn-dialog .poster-wrapper:hover .video-play-info {
65
  opacity: 1; }
66
  #siteorigin-learn #siteorigin-learn-dialog .video-iframe, #siteorigin-learn #siteorigin-learn-dialog .video-iframe iframe {
67
  width: 640px;
@@ -114,12 +88,10 @@
114
  font-size: 0.95em;
115
  line-height: 1em; }
116
  #siteorigin-learn #siteorigin-learn-dialog .learn-close {
117
- display: inline-block;
 
 
118
  cursor: pointer;
119
  font-weight: bold;
120
  font-size: 0.9em;
121
- padding: 4px;
122
- color: #666;
123
- position: absolute;
124
- top: 4px;
125
- right: 8px; }
13
  position: fixed;
14
  top: 50%;
15
  left: 50%;
16
+ padding: 30px;
17
  max-width: 700px;
18
  margin-left: -350px;
19
  min-height: 400px;
20
  margin-top: -200px;
21
  background-color: #fff; }
 
 
 
 
 
 
 
22
  #siteorigin-learn #siteorigin-learn-dialog .poster-wrapper {
23
  cursor: pointer;
24
  display: block;
32
  bottom: 0;
33
  left: 0;
34
  width: 640px;
35
+ height: 38px;
36
+ transition: opacity 0.35s;
37
+ opacity: 0.90; }
38
+ #siteorigin-learn #siteorigin-learn-dialog .poster-wrapper:hover .play-button {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  opacity: 1; }
40
  #siteorigin-learn #siteorigin-learn-dialog .video-iframe, #siteorigin-learn #siteorigin-learn-dialog .video-iframe iframe {
41
  width: 640px;
88
  font-size: 0.95em;
89
  line-height: 1em; }
90
  #siteorigin-learn #siteorigin-learn-dialog .learn-close {
91
+ margin: 20px auto 0 auto;
92
+ text-align: center;
93
+ display: block;
94
  cursor: pointer;
95
  font-weight: bold;
96
  font-size: 0.9em;
97
+ color: #666; }
 
 
 
 
learn/css/learn.scss CHANGED
@@ -17,7 +17,7 @@
17
  top: 50%;
18
  left: 50%;
19
 
20
- padding: 20px 30px;
21
  max-width: 640px + 60px;
22
  margin-left: -( 640px + 60px ) / 2;
23
 
@@ -26,15 +26,6 @@
26
 
27
  background-color: #fff;
28
 
29
- .video-title {
30
- font-weight: 300;
31
- text-align: center;
32
- line-height: 1.2em;
33
- font-size: 22px;
34
- color: #555;
35
- margin: 0 0 20px 0;
36
- }
37
-
38
  .poster-wrapper {
39
  cursor: pointer;
40
  display: block;
@@ -51,42 +42,15 @@
51
  bottom: 0;
52
  left: 0;
53
  width: 640px;
54
- height: 58px;
55
- }
56
-
57
- .video-play-info {
58
- position: absolute;
59
- top: 0;
60
- bottom: 0;
61
- left: 0;
62
- right: 0;
63
- background: rgba( 0,0,0,0.75 );
64
 
65
- display: flex;
66
- justify-content: center;
67
- align-items: center;
68
- opacity: 0;
69
- transition: 0.25s;
70
 
71
- .video-play-info-text {
72
- text-align: center;
73
- font-size: 1.8em;
74
- color: rgba( 255,255,255,0.95 );
75
-
76
- small {
77
- display: block;
78
- margin-top: 0.8em;
79
- font-size: 0.65em;
80
- font-weight: 200;
81
- }
82
-
83
- }
84
  }
85
 
86
- &:hover {
87
- .video-play-info {
88
- opacity: 1;
89
- }
90
  }
91
  }
92
 
@@ -124,12 +88,12 @@
124
  text-align: center;
125
  font-size: 0.85em;
126
  font-weight: 500;
127
-
128
  @media (max-height: 900px) {
129
  display: none;
130
  }
131
  }
132
-
133
  input {
134
  padding: 6px 8px;
135
  font-weight: 500;
@@ -164,15 +128,13 @@
164
  }
165
 
166
  .learn-close {
167
- display: inline-block;
 
 
168
  cursor: pointer;
169
  font-weight: bold;
170
  font-size: 0.9em;
171
- padding: 4px;
172
  color: #666;
173
- position: absolute;
174
- top: 4px;
175
- right: 8px;
176
  }
177
  }
178
 
17
  top: 50%;
18
  left: 50%;
19
 
20
+ padding: 30px;
21
  max-width: 640px + 60px;
22
  margin-left: -( 640px + 60px ) / 2;
23
 
26
 
27
  background-color: #fff;
28
 
 
 
 
 
 
 
 
 
 
29
  .poster-wrapper {
30
  cursor: pointer;
31
  display: block;
42
  bottom: 0;
43
  left: 0;
44
  width: 640px;
45
+ height: 38px;
 
 
 
 
 
 
 
 
 
46
 
47
+ transition: opacity 0.35s;
 
 
 
 
48
 
49
+ opacity: 0.90;
 
 
 
 
 
 
 
 
 
 
 
 
50
  }
51
 
52
+ &:hover .play-button {
53
+ opacity: 1;
 
 
54
  }
55
  }
56
 
88
  text-align: center;
89
  font-size: 0.85em;
90
  font-weight: 500;
91
+
92
  @media (max-height: 900px) {
93
  display: none;
94
  }
95
  }
96
+
97
  input {
98
  padding: 6px 8px;
99
  font-weight: 500;
128
  }
129
 
130
  .learn-close {
131
+ margin: 20px auto 0 auto;
132
+ text-align: center;
133
+ display: block;
134
  cursor: pointer;
135
  font-weight: bold;
136
  font-size: 0.9em;
 
137
  color: #666;
 
 
 
138
  }
139
  }
140
 
learn/img/play.svg CHANGED
@@ -1,27 +1,9 @@
1
-
2
- <svg width="640px" height="58px" viewBox="-190 -3 640 58" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
- <!-- Generator: Sketch 42 (36781) - http://www.bohemiancoding.com/sketch -->
4
  <desc>Created with Sketch.</desc>
5
- <defs>
6
- <rect id="path-1" x="10.880651" y="11" width="419.399638" height="10"></rect>
7
- <mask id="mask-2" maskContentUnits="userSpaceOnUse" maskUnits="objectBoundingBox" x="-1" y="-1" width="421.399638" height="12">
8
- <rect x="9.88065099" y="10" width="421.399638" height="12" fill="white"></rect>
9
- <use xlink:href="#path-1" fill="black"></use>
10
- </mask>
11
- </defs>
12
- <g id="Artboard" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" transform="translate(-190.000000, -3.000000)">
13
- <g id="player" transform="translate(83.000000, 17.000000)">
14
- <rect id="Rectangle-1" fill-opacity="0.75" fill="#172322" x="0" y="0" width="547" height="32" rx="3"></rect>
15
- <use id="play-bar" stroke="#898F8F" mask="url(#mask-2)" stroke-width="2" stroke-linejoin="round" xlink:href="#path-1"></use>
16
- </g>
17
- <g id="play" transform="translate(10.000000, 9.000000)">
18
- <rect id="Rectangle-1-copy" fill-opacity="0.75" fill="#172322" x="0" y="0" width="65" height="40" rx="4"></rect>
19
- <polygon id="Triangle-1" fill="#FFFFFF" points="23 30 23 10 42 20"></polygon>
20
- </g>
21
- <g id="Group" transform="translate(532.000000, 27.000000)">
22
- <path d="M44.618,0 L48.392,0 L47.474,4.301 L51.537,4.301 L52.489,0 L56.263,0 L53.645,12.172 L49.871,12.172 L50.925,7.225 L46.845,7.225 L45.808,12.172 L42,12.172 L44.618,0 Z M56.161,12.172 L58.711,0 L63.709,0 C63.913,0 65.63,0 66.718,0.68 C68.129,1.564 68.809,3.179 68.809,5.1 C68.809,7.752 67.5,10.387 65.545,11.458 C64.712,11.917 63.335,12.172 62.57,12.172 L56.161,12.172 Z M61.924,2.686 L60.513,9.486 L62.06,9.486 C62.808,9.486 63.216,9.231 63.471,9.044 C64.253,8.466 65.12,6.681 65.12,4.709 C65.12,2.686 63.709,2.686 63.114,2.686 L61.924,2.686 Z" id="HD" fill="#00ADEF"></path>
23
- <path d="M84.0537308,8.5301333 C83.9859522,8.46235468 83.9857058,8.34528252 84.0537308,8.27725743 L85.2804006,7.05058766 C85.3479328,6.98305551 85.4647585,6.98305551 85.5327835,7.0510806 L87.6245549,9.14285201 L88.9015041,7.86590283 C88.9692827,7.79812421 89.0368149,7.82277098 89.0488918,7.91766105 L89.0384711,11.9001417 C89.0414295,11.9229806 89.0397432,11.9442143 89.0341554,11.963127 C89.0164672,12.022996 88.9596841,12.0596055 88.8873864,12.0502405 L84.9210507,12.0459951 C84.8256677,12.0344111 84.8010209,11.966386 84.8685531,11.8988539 L86.1455023,10.6219047 L84.0537308,8.5301333 Z M85.5301333,4.99796538 C85.4623547,5.065744 85.3452825,5.06599047 85.2772574,4.99796538 L84.0505877,3.77129562 C83.9830555,3.70376347 83.9830555,3.58693777 84.0510806,3.51891269 L86.142852,1.42714128 L84.8659028,0.150192101 C84.7981242,0.0824134821 84.822771,0.014881331 84.917661,0.00280441347 L88.9001417,0.0132251352 C88.9229806,0.0102667359 88.9442143,0.0119530754 88.963127,0.017540798 C89.022996,0.0352290575 89.0596055,0.0920121467 89.0502405,0.164309838 L89.0459951,4.13064553 C89.0344111,4.22602853 88.966386,4.2506753 88.8988539,4.18314315 L87.6219047,2.90619397 L85.5301333,4.99796538 Z M80.5215629,7.05373084 C80.5893416,6.98595223 80.7064137,6.98570576 80.7744388,7.05373084 L82.0011086,8.28040061 C82.0686407,8.34793276 82.0686407,8.46475845 82.0006156,8.53278354 L79.9088442,10.6245549 L81.1857934,11.9015041 C81.253572,11.9692827 81.2289252,12.0368149 81.1340352,12.0488918 L77.1515545,12.0384711 C77.1287157,12.0414295 77.1074819,12.0397432 77.0885693,12.0341554 C77.0287002,12.0164672 76.9920907,11.9596841 77.0014557,11.8873864 L77.0057011,7.9210507 C77.0172851,7.8256677 77.0853102,7.80102093 77.1528423,7.86855308 L78.4297915,9.14550225 L80.5215629,7.05373084 Z M81.9979654,3.52156293 C82.065744,3.58934155 82.0659905,3.70641371 81.9979654,3.7744388 L80.7712956,5.00110856 C80.7037635,5.06864071 80.5869378,5.06864071 80.5189127,5.00061563 L78.4271413,2.90884422 L77.1501921,4.1857934 C77.0824135,4.25357202 77.0148813,4.22892524 77.0028044,4.13403518 L77.0132251,0.151554519 C77.0102667,0.128715676 77.0119531,0.107481896 77.0175408,0.088569256 C77.0352291,0.0287001858 77.0920121,-0.00790929921 77.1643098,0.00145568673 L81.1306455,0.00570112622 C81.2260285,0.0172851083 81.2506753,0.0853101948 81.1831432,0.152842346 L79.906194,1.42979152 L81.9979654,3.52156293 Z" id="fullscreen" fill="#FFFFFF"></path>
24
- <path d="M0,0 L3,0 L3,12 L0,12 L0,0 Z M5,0 L8,0 L8,12 L5,12 L5,0 Z M10,0 L13,0 L13,12 L10,12 L10,0 Z M15,0 L18,0 L18,12 L15,12 L15,0 Z M20,0 L23,0 L23,12 L20,12 L20,0 Z M25,0 L28,0 L28,12 L25,12 L25,0 Z M30,0 L33,0 L33,12 L30,12 L30,0 Z" id="volume" fill="#00ADEF"></path>
25
- </g>
26
  </g>
27
- </svg>
1
+ <svg width="640px" height="38px" viewBox="0 682 640 38" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
 
 
2
  <desc>Created with Sketch.</desc>
3
+ <defs></defs>
4
+ <g id="Player" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" transform="translate(0.000000, 682.000000)">
5
+ <rect id="progress" fill-opacity="0.658599411" fill="#6E6E6E" x="0" y="0" width="640" height="37.9424018"></rect>
6
+ <rect id="button-wrapper" fill="#3B3B3B" x="0" y="0" width="50" height="38"></rect>
7
+ <path d="M19.7849533,11.1423787 C19.3514356,10.8439879 19,11.0303603 19,11.5542487 L19,26.4636798 C19,26.9895403 19.3523673,27.1732993 19.7849533,26.87555 L30.2707614,19.658156 C30.7916651,19.2996173 30.7917378,18.7183613 30.2707614,18.3597726 L19.7849533,11.1423787 Z" id="button" fill="#FFFFFF"></path>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  </g>
9
+ </svg>
learn/js/learn.js CHANGED
@@ -1,9 +1,9 @@
1
  jQuery( function( $ ){
2
 
3
- var getVideoEmbed = function( videoId ) {
4
- return '<iframe src="https://player.vimeo.com/video/' +
5
  encodeURI( videoId ) +
6
- '?autoplay=1&title=0&byline=0&portrait=0" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>';
7
  };
8
 
9
  $('body').on( 'click', 'a[href^="#siteorigin-learn-"]', function( e ) {
@@ -20,15 +20,15 @@ jQuery( function( $ ){
20
  dialog
21
  .find( '.video-iframe' ).hide().end()
22
  .find( '.poster-wrapper' ).data( 'video', lesson.video ).end()
23
- .find( '.video-title' ).html( lesson.title ).end()
24
- .find( '.main-poster' ).hide().attr( 'src', lesson.poster ).show( ).end()
25
  .find( '.learn-description' ).html( lesson.description ).end()
26
  .find( '.form-description' ).html( lesson.form_description ).end()
27
- .find( 'input[name="lesson_id"]' ).val( lessonId ).end()
28
- .css({
29
- 'margin-top': - dialog.outerHeight() / 2,
30
- 'margin-left': - dialog.outerWidth() / 2,
31
- });
 
32
  }
33
  } );
34
 
@@ -70,17 +70,9 @@ jQuery( function( $ ){
70
  $( '#siteorigin-learn .learn-close' ).click();
71
  } );
72
 
73
- $( '#siteorigin-learn' ).find( '.main-poster, .play-button, .video-play-info, .video-play-info-text' ).click( function(){
74
  $( '#siteorigin-learn' )
75
  .find( '.poster-wrapper' ).hide().end()
76
- .find( '.video-iframe' ).show().html( getVideoEmbed( $( '#siteorigin-learn .poster-wrapper' ).data( 'video' ) ) );
77
  } );
78
-
79
- $(document).keyup(function(e) {
80
- // when escape is pressed
81
- if ( e.keyCode === 27 && $( '#siteorigin-learn-overlay' ).is( ':visible' ) ) {
82
- e.preventDefault();
83
- $( '#siteorigin-learn .learn-close' ).click();
84
- }
85
- });
86
  } );
1
  jQuery( function( $ ){
2
 
3
+ var getWistiaEmbed = function( videoId ) {
4
+ return '<iframe src="//fast.wistia.net/embed/iframe/' +
5
  encodeURI( videoId ) +
6
+ '?autoplay=1" allowtransparency="true" frameborder="0" scrolling="no" class="wistia_embed" name="wistia_embed" allowfullscreen mozallowfullscreen webkitallowfullscreen oallowfullscreen msallowfullscreen width="640" height="360"></iframe>';
7
  };
8
 
9
  $('body').on( 'click', 'a[href^="#siteorigin-learn-"]', function( e ) {
20
  dialog
21
  .find( '.video-iframe' ).hide().end()
22
  .find( '.poster-wrapper' ).data( 'video', lesson.video ).end()
23
+ .find( '.main-poster' ).hide().attr( 'src', lesson.poster ).fadeIn( ).end()
 
24
  .find( '.learn-description' ).html( lesson.description ).end()
25
  .find( '.form-description' ).html( lesson.form_description ).end()
26
+ .find( 'input[name="lesson_id"]' ).val( lessonId ).end();
27
+
28
+ dialog.css({
29
+ 'margin-top': - dialog.outerHeight() / 2,
30
+ 'margin-left': - dialog.outerWidth() / 2,
31
+ });
32
  }
33
  } );
34
 
70
  $( '#siteorigin-learn .learn-close' ).click();
71
  } );
72
 
73
+ $( '#siteorigin-learn' ).find( '.main-poster, .play-button' ).click( function(){
74
  $( '#siteorigin-learn' )
75
  .find( '.poster-wrapper' ).hide().end()
76
+ .find( '.video-iframe' ).show().html( getWistiaEmbed( $( '#siteorigin-learn .poster-wrapper' ).data( 'video' ) ) );
77
  } );
 
 
 
 
 
 
 
 
78
  } );
learn/js/learn.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(e){var i=function(e){return'<iframe src="https://player.vimeo.com/video/'+encodeURI(e)+'?autoplay=1&title=0&byline=0&portrait=0" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>'};e("body").on("click",'a[href^="#siteorigin-learn-"]',function(i){var r=e(this),n=r.attr("href").replace("#siteorigin-learn-","");if(n&&soLearn.lessons.hasOwnProperty(n)){i.preventDefault();var o=soLearn.lessons[n];e("#siteorigin-learn").show();var t=e("#siteorigin-learn-dialog");t.find(".video-iframe").hide().end().find(".poster-wrapper").data("video",o.video).end().find(".video-title").html(o.title).end().find(".main-poster").hide().attr("src",o.poster).show().end().find(".learn-description").html(o.description).end().find(".form-description").html(o.form_description).end().find('input[name="lesson_id"]').val(n).end().css({"margin-top":-t.outerHeight()/2,"margin-left":-t.outerWidth()/2})}}),e("body").on("mouseover",'a[href^="#siteorigin-learn-"]',function(i){if(!e("#siteorigin-learn").is(":visible")){var r=e(this),n=r.attr("href").replace("#siteorigin-learn-","");n&&soLearn.lessons.hasOwnProperty(n)&&e("#siteorigin-learn-dialog .main-poster").attr("src",soLearn.lessons[n].poster)}}),e("#siteorigin-learn-overlay").add("#siteorigin-learn .learn-close").click(function(){e("#siteorigin-learn").hide().find(".video-iframe").empty().hide().end().find(".poster-wrapper").show()}),e("#siteorigin-learn form").submit(function(i){var r=e(this),n=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,o=r.find('input[name="email"]');if(""===o.val()||!n.test(o.val()))return i.preventDefault(),void alert(r.data("email-error"));e("#siteorigin-learn .learn-close").click()}),e("#siteorigin-learn").find(".main-poster, .play-button, .video-play-info, .video-play-info-text").click(function(){e("#siteorigin-learn").find(".poster-wrapper").hide().end().find(".video-iframe").show().html(i(e("#siteorigin-learn .poster-wrapper").data("video")))}),e(document).keyup(function(i){27===i.keyCode&&e("#siteorigin-learn-overlay").is(":visible")&&(i.preventDefault(),e("#siteorigin-learn .learn-close").click())})});
1
+ jQuery(function(e){var i=function(e){return'<iframe src="//fast.wistia.net/embed/iframe/'+encodeURI(e)+'?autoplay=1" allowtransparency="true" frameborder="0" scrolling="no" class="wistia_embed" name="wistia_embed" allowfullscreen mozallowfullscreen webkitallowfullscreen oallowfullscreen msallowfullscreen width="640" height="360"></iframe>'};e("body").on("click",'a[href^="#siteorigin-learn-"]',function(i){var r=e(this),n=r.attr("href").replace("#siteorigin-learn-","");if(n&&soLearn.lessons.hasOwnProperty(n)){i.preventDefault();var a=soLearn.lessons[n];e("#siteorigin-learn").show();var o=e("#siteorigin-learn-dialog");o.find(".video-iframe").hide().end().find(".poster-wrapper").data("video",a.video).end().find(".main-poster").hide().attr("src",a.poster).fadeIn().end().find(".learn-description").html(a.description).end().find(".form-description").html(a.form_description).end().find('input[name="lesson_id"]').val(n).end(),o.css({"margin-top":-o.outerHeight()/2,"margin-left":-o.outerWidth()/2})}}),e("body").on("mouseover",'a[href^="#siteorigin-learn-"]',function(i){if(!e("#siteorigin-learn").is(":visible")){var r=e(this),n=r.attr("href").replace("#siteorigin-learn-","");n&&soLearn.lessons.hasOwnProperty(n)&&e("#siteorigin-learn-dialog .main-poster").attr("src",soLearn.lessons[n].poster)}}),e("#siteorigin-learn-overlay").add("#siteorigin-learn .learn-close").click(function(){e("#siteorigin-learn").hide().find(".video-iframe").empty().hide().end().find(".poster-wrapper").show()}),e("#siteorigin-learn form").submit(function(i){var r=e(this),n=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,a=r.find('input[name="email"]');if(""===a.val()||!n.test(a.val()))return i.preventDefault(),void alert(r.data("email-error"));e("#siteorigin-learn .learn-close").click()}),e("#siteorigin-learn").find(".main-poster, .play-button").click(function(){e("#siteorigin-learn").find(".poster-wrapper").hide().end().find(".video-iframe").show().html(i(e("#siteorigin-learn .poster-wrapper").data("video")))})});
learn/learn.php CHANGED
@@ -1,70 +1,53 @@
1
  <?php
2
 
3
- if( ! class_exists( 'SiteOrigin_Learn_Dialog' ) ) {
4
-
5
- class SiteOrigin_Learn_Dialog {
6
-
7
- private $lessons;
8
- const SUBMIT_URL = 'https://siteorigin.com/wp-admin/admin-ajax.php?action=lesson_signup_submit';
9
-
10
- function __construct() {
11
- $this->lessons = array();
12
- add_action( 'admin_footer', array( $this, 'admin_footer' ) );
13
- add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 100 );
14
- }
15
-
16
- public static function single() {
17
- static $single;
18
-
19
- return empty( $single ) ? $single = new self() : $single;
20
- }
21
-
22
- /**
23
- * Add a course that we might display
24
- *
25
- * @param $id
26
- * @param $data
27
- */
28
- public function add_lessons( $id, $data ) {
29
- $this->lessons[ $id ] = $data;
30
- }
31
-
32
- /**
33
- * Get all the available courses
34
- *
35
- * @return mixed|void
36
- */
37
- public function get_lessons() {
38
- return apply_filters( 'siteorigin_learn_lessons', $this->lessons );
39
- }
40
-
41
- /**
42
- * Add the dialog to the footer when this is setup
43
- */
44
- public function admin_footer() {
45
- wp_localize_script( 'siteorigin-learn', 'soLearn', array(
46
- 'lessons' => $this->get_lessons(),
47
- ) );
48
-
49
- // These strings should be filtered and translated by the calling plugin.
50
- $dialog_strings = apply_filters( 'siteorigin_learn_strings', array(
51
- 'watch_video' => 'Watch Intro Video',
52
- 'loaded_from_vimeo' => 'Loaded from Vimeo Servers',
53
- 'valid_email' => 'Please enter a valid email address.',
54
-
55
- 'your_name' => 'Your Name',
56
- 'your_email' => 'Your Email',
57
- 'sign_up' => 'Sign Up',
58
- 'close' => 'Close',
59
- ) );
60
-
61
- include plugin_dir_path( __FILE__ ) . 'tpl/dialog.php';
62
- }
63
-
64
- public function enqueue_scripts() {
65
- wp_enqueue_script( 'siteorigin-learn', plugin_dir_url( __FILE__ ) . 'js/learn' . ( WP_DEBUG ? '' : '.min' ) . '.js', array( 'jquery' ), false, true );
66
- wp_enqueue_style( 'siteorigin-learn', plugin_dir_url( __FILE__ ) . 'css/learn.css', array() );
67
- }
68
  }
69
-
70
  }
1
  <?php
2
 
3
+ class SiteOrigin_Learn_Dialog {
4
+
5
+ private $lessons;
6
+ const SUBMIT_URL = 'https://siteorigin.com/wp-admin/admin-ajax.php?action=lesson_signup_submit';
7
+
8
+ function __construct(){
9
+ $this->lessons = array();
10
+ add_action( 'admin_footer', array( $this, 'admin_footer' ) );
11
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 15 );
12
+ }
13
+
14
+ public static function single() {
15
+ static $single;
16
+ return empty( $single ) ? $single = new self() : $single;
17
+ }
18
+
19
+ /**
20
+ * Add a course that we might display
21
+ *
22
+ * @param $id
23
+ * @param $data
24
+ */
25
+ public function add_lessons( $id, $data ) {
26
+ $this->lessons[$id] = $data;
27
+ }
28
+
29
+ /**
30
+ * Get all the available courses
31
+ *
32
+ * @return mixed|void
33
+ */
34
+ public function get_lessons(){
35
+ return apply_filters( 'siteorigin_learn_lessons', $this->lessons );
36
+ }
37
+
38
+ /**
39
+ * Add the dialog to the footer when this is setup
40
+ */
41
+ public function admin_footer(){
42
+ include plugin_dir_path( __FILE__ ) . 'tpl/dialog.php';
43
+ }
44
+
45
+ public function enqueue_scripts(){
46
+ wp_enqueue_script( 'siteorigin-learn', plugin_dir_url( __FILE__ ) . 'js/learn' . ( WP_DEBUG ? '' : '.min' ) . '.js', array( 'jquery' ), false, true );
47
+ wp_enqueue_style( 'siteorigin-learn', plugin_dir_url( __FILE__ ) . 'css/learn.css', array( ) );
48
+
49
+ wp_localize_script( 'siteorigin-learn', 'soLearn', array(
50
+ 'lessons' => $this->get_lessons(),
51
+ ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  }
 
53
  }
learn/tpl/dialog.php CHANGED
@@ -1,6 +1,5 @@
1
  <?php
2
  $user = wp_get_current_user();
3
- /* @var $dialog_strings */
4
  ?>
5
 
6
  <div id="siteorigin-learn" style="display: none;">
@@ -8,44 +7,34 @@ $user = wp_get_current_user();
8
  <div id="siteorigin-learn-overlay"></div>
9
  <div id="siteorigin-learn-dialog">
10
 
11
- <h4 class="video-title"></h4>
12
-
13
  <div class="poster-wrapper">
14
  <img src="" width="640px" height="360px" class="main-poster" />
15
-
16
- <div class="video-play-info">
17
- <div class="video-play-info-text">
18
- <?php esc_html( $dialog_strings[ 'watch_video' ] ) ?>
19
- <small><?php esc_html( $dialog_strings[ 'loaded_from_vimeo' ] ) ?></small>
20
- </div>
21
- </div>
22
-
23
- <img src="<?php echo plugin_dir_url( __FILE__ ) . '../img/play.svg' ?>" width="640px" height="58px" class="play-button" />
24
  </div>
25
  <div class="video-iframe">
26
  </div>
27
 
28
  <p class="learn-description"></p>
29
 
30
- <form class="signup-form" method="post" action="<?php echo esc_url( SiteOrigin_Learn_Dialog::SUBMIT_URL ) ?>" target="_blank" data-email-error="<?php esc_attr( $dialog_strings['valid_email'] ) ?>" >
31
  <?php if( ! empty( $user->data->display_name ) && $user->data->display_name !== $user->data->user_login ) : ?>
32
  <div class="form-field">
33
- <label for="siteorigin-learn-name-input"><?php esc_html( $dialog_strings[ 'your_name' ] ) ?></label>
34
  <input type="text" name="name" value="<?php echo ! empty( $user->data->display_name ) ? esc_attr( $user->data->display_name ) : '' ?>" id="siteorigin-learn-name-input" />
35
  </div>
36
  <?php endif ?>
37
  <div class="form-field">
38
- <label for="siteorigin-learn-email-input"><?php esc_html( $dialog_strings[ 'your_email' ] ) ?></label>
39
  <input type="text" name="email" value="<?php echo ! empty( $user->data->user_email ) ? esc_attr( $user->data->user_email ) : '' ?>" id="siteorigin-learn-email-input" />
40
  </div>
41
  <div class="form-submit">
42
- <input type="submit" class="button-primary" value="<?php echo esc_attr( $dialog_strings[ 'sign_up' ] ) ?>" />
43
  </div>
44
  <input type="hidden" name="lesson_id" value="" />
45
  </form>
46
  <div class="form-description"></div>
47
 
48
- <div class="learn-close"><?php esc_html( $dialog_strings[ 'close' ] ) ?></div>
49
 
50
  </div>
51
 
1
  <?php
2
  $user = wp_get_current_user();
 
3
  ?>
4
 
5
  <div id="siteorigin-learn" style="display: none;">
7
  <div id="siteorigin-learn-overlay"></div>
8
  <div id="siteorigin-learn-dialog">
9
 
 
 
10
  <div class="poster-wrapper">
11
  <img src="" width="640px" height="360px" class="main-poster" />
12
+ <img src="<?php echo plugin_dir_url( __FILE__ ) . '../img/play.svg' ?>" width="48px" height="48px" class="play-button" />
 
 
 
 
 
 
 
 
13
  </div>
14
  <div class="video-iframe">
15
  </div>
16
 
17
  <p class="learn-description"></p>
18
 
19
+ <form class="signup-form" method="post" action="<?php echo esc_url( SiteOrigin_Learn_Dialog::SUBMIT_URL ) ?>" target="_blank" data-email-error="<?php esc_attr_e( 'Please enter a valid email', 'siteorigin-panels' ) ?>" >
20
  <?php if( ! empty( $user->data->display_name ) && $user->data->display_name !== $user->data->user_login ) : ?>
21
  <div class="form-field">
22
+ <label for="siteorigin-learn-name-input"><?php esc_attr_e( 'Your Name', 'siteorigin-panels' ) ?></label>
23
  <input type="text" name="name" value="<?php echo ! empty( $user->data->display_name ) ? esc_attr( $user->data->display_name ) : '' ?>" id="siteorigin-learn-name-input" />
24
  </div>
25
  <?php endif ?>
26
  <div class="form-field">
27
+ <label for="siteorigin-learn-email-input"><?php esc_attr_e( 'Your Email', 'siteorigin-panels' ) ?></label>
28
  <input type="text" name="email" value="<?php echo ! empty( $user->data->user_email ) ? esc_attr( $user->data->user_email ) : '' ?>" id="siteorigin-learn-email-input" />
29
  </div>
30
  <div class="form-submit">
31
+ <input type="submit" class="button-primary" value="<?php esc_attr_e( 'Sign Up', 'siteorigin-panels' ) ?>" />
32
  </div>
33
  <input type="hidden" name="lesson_id" value="" />
34
  </form>
35
  <div class="form-description"></div>
36
 
37
+ <div class="learn-close"><?php _e( 'Close', 'siteorigin-panels' ) ?></div>
38
 
39
  </div>
40
 
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === Page Builder by SiteOrigin ===
2
  Tags: page builder, responsive, widget, widgets, builder, page, admin, gallery, content, cms, pages, post, css, layout, grid
3
  Requires at least: 4.4
4
- Tested up to: 4.7.3
5
  Stable tag: 2.5.3
6
- Build time: 2017-05-11T14:23:19+02:00
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl.html
9
  Donate link: https://siteorigin.com/downloads/contribution/
@@ -96,6 +96,12 @@ We've tried to ensure that Page Builder is compatible with most plugin widgets.
96
 
97
  == Changelog ==
98
 
 
 
 
 
 
 
99
  = 2.5.3 - 9 May 2017 =
100
  * Added legacy function wrapper for siteorigin_panels_generate_css
101
  * Added more cache render checks
1
  === Page Builder by SiteOrigin ===
2
  Tags: page builder, responsive, widget, widgets, builder, page, admin, gallery, content, cms, pages, post, css, layout, grid
3
  Requires at least: 4.4
4
+ Tested up to: 4.8
5
  Stable tag: 2.5.3
6
+ Build time: 2017-06-01T11:53:46+02:00
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl.html
9
  Donate link: https://siteorigin.com/downloads/contribution/
96
 
97
  == Changelog ==
98
 
99
+ = 2.5.4 - 1 June 2017 =
100
+ * Compatibility with WordPress 4.8 widgets.
101
+ * Refactored core widgets.
102
+ * Compatibility with Widgets Bundle 1.9 posts selector.
103
+ * Ensure custom CSS added in element styles is properly formed.
104
+
105
  = 2.5.3 - 9 May 2017 =
106
  * Added legacy function wrapper for siteorigin_panels_generate_css
107
  * Added more cache render checks
siteorigin-panels.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Page Builder by SiteOrigin
4
  Plugin URI: https://siteorigin.com/page-builder/
5
  Description: A drag and drop, responsive page builder that simplifies building your website.
6
- Version: 2.5.3
7
  Author: SiteOrigin
8
  Author URI: https://siteorigin.com
9
  License: GPL3
@@ -11,14 +11,13 @@ License URI: http://www.gnu.org/licenses/gpl.html
11
  Donate link: http://siteorigin.com/page-builder/#donate
12
  */
13
 
14
- define( 'SITEORIGIN_PANELS_VERSION', '2.5.3' );
15
  if ( ! defined( 'SITEORIGIN_PANELS_JS_SUFFIX' ) ) {
16
  define( 'SITEORIGIN_PANELS_JS_SUFFIX', '.min' );
17
  }
18
  define( 'SITEORIGIN_PANELS_VERSION_SUFFIX', '-25' );
19
 
20
  require_once plugin_dir_path( __FILE__ ) . 'inc/functions.php';
21
- require_once plugin_dir_path( __FILE__ ) . 'widgets/basic.php';
22
 
23
  class SiteOrigin_Panels {
24
 
@@ -31,6 +30,8 @@ class SiteOrigin_Panels {
31
  add_action( 'plugins_loaded', array( $this, 'version_check' ) );
32
  add_action( 'plugins_loaded', array( $this, 'init' ) );
33
  add_action( 'admin_bar_menu', array( $this, 'admin_bar_menu' ), 100 );
 
 
34
 
35
  add_filter( 'body_class', array( $this, 'body_class' ) );
36
  add_filter( 'siteorigin_panels_data', array( $this, 'process_panels_data' ), 5 );
@@ -135,13 +136,20 @@ class SiteOrigin_Panels {
135
  * @param $class
136
  */
137
  public static function autoloader( $class ) {
138
- if ( strpos( $class, 'SiteOrigin_Panels_' ) === 0 ) {
139
- $filename = strtolower( str_replace( array( 'SiteOrigin_Panels_', '_' ), array( '', '-' ), $class ) );
 
 
 
 
 
 
 
140
  $filename = plugin_dir_path( __FILE__ ) . 'inc/' . strtolower( $filename ) . '.php';
141
-
142
- if ( file_exists( $filename ) ) {
143
- include $filename;
144
- }
145
  }
146
  }
147
 
@@ -409,6 +417,12 @@ class SiteOrigin_Panels {
409
 
410
  return $admin_bar;
411
  }
 
 
 
 
 
 
412
 
413
  function live_edit_link_style() {
414
  if ( is_singular() && current_user_can( 'edit_post', get_the_ID() ) && get_post_meta( get_the_ID(), 'panels_data', true ) ) {
3
  Plugin Name: Page Builder by SiteOrigin
4
  Plugin URI: https://siteorigin.com/page-builder/
5
  Description: A drag and drop, responsive page builder that simplifies building your website.
6
+ Version: 2.5.4
7
  Author: SiteOrigin
8
  Author URI: https://siteorigin.com
9
  License: GPL3
11
  Donate link: http://siteorigin.com/page-builder/#donate
12
  */
13
 
14
+ define( 'SITEORIGIN_PANELS_VERSION', '2.5.4' );
15
  if ( ! defined( 'SITEORIGIN_PANELS_JS_SUFFIX' ) ) {
16
  define( 'SITEORIGIN_PANELS_JS_SUFFIX', '.min' );
17
  }
18
  define( 'SITEORIGIN_PANELS_VERSION_SUFFIX', '-25' );
19
 
20
  require_once plugin_dir_path( __FILE__ ) . 'inc/functions.php';
 
21
 
22
  class SiteOrigin_Panels {
23
 
30
  add_action( 'plugins_loaded', array( $this, 'version_check' ) );
31
  add_action( 'plugins_loaded', array( $this, 'init' ) );
32
  add_action( 'admin_bar_menu', array( $this, 'admin_bar_menu' ), 100 );
33
+
34
+ add_action('widgets_init', array( $this, 'widgets_init' ) );
35
 
36
  add_filter( 'body_class', array( $this, 'body_class' ) );
37
  add_filter( 'siteorigin_panels_data', array( $this, 'process_panels_data' ), 5 );
136
  * @param $class
137
  */
138
  public static function autoloader( $class ) {
139
+ $filename = false;
140
+ if ( strpos( $class, 'SiteOrigin_Panels_Widgets_' ) === 0 ) {
141
+ $filename = str_replace( 'SiteOrigin_Panels_Widgets_', '', $class );
142
+ $filename = str_replace( '_', '-', $filename );
143
+ $filename = strtolower( preg_replace( '/([a-z])([A-Z])/', '$1-$2', $filename ) );
144
+ $filename = plugin_dir_path( __FILE__ ) . 'inc/widgets/' . $filename . '.php';
145
+ }
146
+ else if ( strpos( $class, 'SiteOrigin_Panels_' ) === 0 ) {
147
+ $filename = str_replace( array( 'SiteOrigin_Panels_', '_' ), array( '', '-' ), $class );
148
  $filename = plugin_dir_path( __FILE__ ) . 'inc/' . strtolower( $filename ) . '.php';
149
+ }
150
+
151
+ if ( ! empty( $filename ) && file_exists( $filename ) ) {
152
+ include $filename;
153
  }
154
  }
155
 
417
 
418
  return $admin_bar;
419
  }
420
+
421
+ function widgets_init(){
422
+ register_widget( 'SiteOrigin_Panels_Widgets_PostContent' );
423
+ register_widget( 'SiteOrigin_Panels_Widgets_PostLoop' );
424
+ register_widget( 'SiteOrigin_Panels_Widgets_Layout' );
425
+ }
426
 
427
  function live_edit_link_style() {
428
  if ( is_singular() && current_user_can( 'edit_post', get_the_ID() ) && get_post_meta( get_the_ID(), 'panels_data', true ) ) {