Page Builder by SiteOrigin - Version 2.6.0

Version Description

  • 17 December 2017 =
  • Load prebuilt layout JSON files found in themes!
  • Allow post types with numeric slugs.
  • Add a filter for inline styles.
Download this release

Release Info

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

Code changes from version 2.5.16 to 2.6.0

css/admin.css CHANGED
@@ -967,6 +967,12 @@
967
  padding-left: 26px;
968
  background-position: left center;
969
  }
 
 
 
 
 
 
970
  .so-panels-dialog .so-toolbar .so-buttons {
971
  float: right;
972
  }
@@ -1439,17 +1445,9 @@
1439
  padding: 15px;
1440
  font-weight: bold;
1441
  }
1442
- .so-panels-dialog.so-panels-dialog-prebuilt-layouts .so-content .so-directory-items {
1443
- zoom: 1;
1444
- }
1445
- .so-panels-dialog.so-panels-dialog-prebuilt-layouts .so-content .so-directory-items:before {
1446
- content: '';
1447
- display: block;
1448
- }
1449
- .so-panels-dialog.so-panels-dialog-prebuilt-layouts .so-content .so-directory-items:after {
1450
- content: '';
1451
- display: table;
1452
- clear: both;
1453
  }
1454
  .so-panels-dialog.so-panels-dialog-prebuilt-layouts .so-content .so-directory-items .so-no-results {
1455
  margin: 20px 0;
@@ -1460,10 +1458,11 @@
1460
  -moz-box-sizing: border-box;
1461
  -webkit-box-sizing: border-box;
1462
  box-sizing: border-box;
1463
- float: left;
1464
  padding: 6px;
1465
  }
1466
  .so-panels-dialog.so-panels-dialog-prebuilt-layouts .so-content .so-directory-items .so-directory-item .so-directory-item-wrapper {
 
 
1467
  padding: 15px 10px;
1468
  background: #F7F7F7;
1469
  border: 1px solid #d0d0d0;
@@ -1476,6 +1475,7 @@
1476
  margin: 0 0 13px 0;
1477
  }
1478
  .so-panels-dialog.so-panels-dialog-prebuilt-layouts .so-content .so-directory-items .so-directory-item .so-screenshot {
 
1479
  background: #ffffff;
1480
  margin-bottom: 10px;
1481
  border: 1px solid #d0d0d0;
@@ -1561,33 +1561,21 @@
1561
  .so-panels-dialog.so-panels-dialog-prebuilt-layouts .so-content .so-directory-items .so-directory-item {
1562
  width: 20%;
1563
  }
1564
- .so-panels-dialog.so-panels-dialog-prebuilt-layouts .so-content .so-directory-items .so-directory-item:nth-of-type(5n+1) {
1565
- clear: both;
1566
- }
1567
  }
1568
  @media only screen and (max-width: 1679px) and (min-width: 1280px) {
1569
  .so-panels-dialog.so-panels-dialog-prebuilt-layouts .so-content .so-directory-items .so-directory-item {
1570
  width: 25%;
1571
  }
1572
- .so-panels-dialog.so-panels-dialog-prebuilt-layouts .so-content .so-directory-items .so-directory-item:nth-of-type(4n+1) {
1573
- clear: both;
1574
- }
1575
  }
1576
  @media only screen and (max-width: 1279px) and (min-width: 1140px) {
1577
  .so-panels-dialog.so-panels-dialog-prebuilt-layouts .so-content .so-directory-items .so-directory-item {
1578
  width: 33.333%;
1579
  }
1580
- .so-panels-dialog.so-panels-dialog-prebuilt-layouts .so-content .so-directory-items .so-directory-item:nth-of-type(3n+1) {
1581
- clear: both;
1582
- }
1583
  }
1584
  @media only screen and (max-width: 1139px) {
1585
  .so-panels-dialog.so-panels-dialog-prebuilt-layouts .so-content .so-directory-items .so-directory-item {
1586
  width: 50%;
1587
  }
1588
- .so-panels-dialog.so-panels-dialog-prebuilt-layouts .so-content .so-directory-items .so-directory-item:nth-of-type(2n+1) {
1589
- clear: both;
1590
- }
1591
  }
1592
  .so-panels-dialog.so-panels-dialog-prebuilt-layouts .so-content .so-directory-pages {
1593
  margin-top: 15px;
967
  padding-left: 26px;
968
  background-position: left center;
969
  }
970
+ .so-panels-dialog .so-toolbar .so-status .dashicons-warning {
971
+ color: #aa0000;
972
+ vertical-align: middle;
973
+ margin-right: 7px;
974
+ margin-top: -1px;
975
+ }
976
  .so-panels-dialog .so-toolbar .so-buttons {
977
  float: right;
978
  }
1445
  padding: 15px;
1446
  font-weight: bold;
1447
  }
1448
+ .so-panels-dialog.so-panels-dialog-prebuilt-layouts .so-content .so-directory-items-wrapper {
1449
+ display: flex;
1450
+ flex-flow: row wrap;
 
 
 
 
 
 
 
 
1451
  }
1452
  .so-panels-dialog.so-panels-dialog-prebuilt-layouts .so-content .so-directory-items .so-no-results {
1453
  margin: 20px 0;
1458
  -moz-box-sizing: border-box;
1459
  -webkit-box-sizing: border-box;
1460
  box-sizing: border-box;
 
1461
  padding: 6px;
1462
  }
1463
  .so-panels-dialog.so-panels-dialog-prebuilt-layouts .so-content .so-directory-items .so-directory-item .so-directory-item-wrapper {
1464
+ height: 100%;
1465
+ box-sizing: border-box;
1466
  padding: 15px 10px;
1467
  background: #F7F7F7;
1468
  border: 1px solid #d0d0d0;
1475
  margin: 0 0 13px 0;
1476
  }
1477
  .so-panels-dialog.so-panels-dialog-prebuilt-layouts .so-content .so-directory-items .so-directory-item .so-screenshot {
1478
+ height: calc(100% - 50px);
1479
  background: #ffffff;
1480
  margin-bottom: 10px;
1481
  border: 1px solid #d0d0d0;
1561
  .so-panels-dialog.so-panels-dialog-prebuilt-layouts .so-content .so-directory-items .so-directory-item {
1562
  width: 20%;
1563
  }
 
 
 
1564
  }
1565
  @media only screen and (max-width: 1679px) and (min-width: 1280px) {
1566
  .so-panels-dialog.so-panels-dialog-prebuilt-layouts .so-content .so-directory-items .so-directory-item {
1567
  width: 25%;
1568
  }
 
 
 
1569
  }
1570
  @media only screen and (max-width: 1279px) and (min-width: 1140px) {
1571
  .so-panels-dialog.so-panels-dialog-prebuilt-layouts .so-content .so-directory-items .so-directory-item {
1572
  width: 33.333%;
1573
  }
 
 
 
1574
  }
1575
  @media only screen and (max-width: 1139px) {
1576
  .so-panels-dialog.so-panels-dialog-prebuilt-layouts .so-content .so-directory-items .so-directory-item {
1577
  width: 50%;
1578
  }
 
 
 
1579
  }
1580
  .so-panels-dialog.so-panels-dialog-prebuilt-layouts .so-content .so-directory-pages {
1581
  margin-top: 15px;
inc/admin-layouts.php CHANGED
@@ -12,6 +12,8 @@ class SiteOrigin_Panels_Admin_Layouts {
12
  function __construct() {
13
  // Filter all the available external layout directories.
14
  add_filter( 'siteorigin_panels_external_layout_directories', array( $this, 'filter_directories' ), 8 );
 
 
15
 
16
  add_action( 'wp_ajax_so_panels_layouts_query', array( $this, 'action_get_prebuilt_layouts' ) );
17
  add_action( 'wp_ajax_so_panels_get_layout', array( $this, 'action_get_prebuilt_layout' ) );
@@ -60,12 +62,105 @@ class SiteOrigin_Panels_Admin_Layouts {
60
  return $directories;
61
  }
62
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  /**
64
- * Gets all the prebuilt layouts
65
  */
66
  function action_get_prebuilt_layouts() {
67
  if ( empty( $_REQUEST['_panelsnonce'] ) || ! wp_verify_nonce( $_REQUEST['_panelsnonce'], 'panels_action' ) ) {
68
- wp_die();
69
  }
70
 
71
  // Get any layouts that the current user could edit.
@@ -148,7 +243,7 @@ class SiteOrigin_Panels_Admin_Layouts {
148
  // Check that the user can view the given page types
149
  $post_type = get_post_type_object( str_replace( 'clone_', '', $type ) );
150
  if( empty( $post_type ) ) {
151
- return;
152
  }
153
 
154
  $return['title'] = sprintf( __( 'Clone %s', 'siteorigin-panels' ), esc_html( $post_type->labels->singular_name ) );
@@ -220,8 +315,10 @@ class SiteOrigin_Panels_Admin_Layouts {
220
  $lid = ! empty( $_REQUEST['lid'] ) ? $_REQUEST['lid'] : false;
221
 
222
  if ( empty( $lid ) || empty( $layouts[ $lid ] ) ) {
223
- // Display an error message
224
- wp_die();
 
 
225
  }
226
 
227
  $layout = $layouts[ $_REQUEST['lid'] ];
@@ -264,7 +361,10 @@ class SiteOrigin_Panels_Admin_Layouts {
264
  // For now, we'll just pretend to load this
265
  $panels_data = json_decode( $response['body'], true );
266
  } else {
267
- // Display some sort of error message
 
 
 
268
  }
269
  }
270
  $raw_panels_data = true;
@@ -279,8 +379,7 @@ class SiteOrigin_Panels_Admin_Layouts {
279
  $panels_data['widgets'] = SiteOrigin_Panels_Admin::single()->process_raw_widgets( $panels_data['widgets'], array(), true, true );
280
  }
281
 
282
- echo json_encode( $panels_data );
283
- wp_die();
284
  }
285
 
286
  /**
@@ -308,15 +407,26 @@ class SiteOrigin_Panels_Admin_Layouts {
308
  wp_die();
309
  }
310
 
 
 
 
 
 
 
 
 
 
 
 
 
311
  header( 'content-type: application/json' );
312
- header( 'Content-Disposition: attachment; filename=layout-' . date( 'dmY' ) . '.json' );
313
 
314
- $export_data = wp_unslash( $_POST['panels_export_data'] );
315
  echo $export_data;
316
 
317
  wp_die();
318
  }
319
-
320
  /**
321
  * Enable the directory.
322
  */
@@ -328,4 +438,26 @@ class SiteOrigin_Panels_Admin_Layouts {
328
  update_user_meta( $user, 'so_panels_directory_enabled', true );
329
  wp_die();
330
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
331
  }
12
  function __construct() {
13
  // Filter all the available external layout directories.
14
  add_filter( 'siteorigin_panels_external_layout_directories', array( $this, 'filter_directories' ), 8 );
15
+ // Filter all the available local layout folders.
16
+ add_filter( 'siteorigin_panels_prebuilt_layouts', array( $this, 'get_local_layouts' ), 8 );
17
 
18
  add_action( 'wp_ajax_so_panels_layouts_query', array( $this, 'action_get_prebuilt_layouts' ) );
19
  add_action( 'wp_ajax_so_panels_get_layout', array( $this, 'action_get_prebuilt_layout' ) );
62
  return $directories;
63
  }
64
 
65
+
66
+ /**
67
+ * Looks through local folders in the active theme and any others filtered in by theme and plugins, to find JSON
68
+ * prebuilt layouts.
69
+ *
70
+ */
71
+ public function get_local_layouts() {
72
+
73
+ // By default we'll look for layouts in a directory in the active theme
74
+ $layout_folders = array( get_template_directory() . '/siteorigin-page-builder-layouts' );
75
+
76
+ // And the child theme if there is one.
77
+ if ( is_child_theme() ) {
78
+ $layout_folders[] = get_stylesheet_directory() . '/siteorigin-page-builder-layouts';
79
+ }
80
+
81
+ // This allows themes and plugins to customize where we look for layouts.
82
+ $layout_folders = apply_filters( 'siteorigin_panels_local_layouts_directories', $layout_folders );
83
+
84
+ $layouts = array();
85
+ foreach ( $layout_folders as $folder ) {
86
+ $files = array();
87
+ if ( file_exists( $folder ) && is_dir( $folder ) ) {
88
+ $files = list_files( $folder, 1 );
89
+ }
90
+
91
+ foreach ( $files as $file ) {
92
+ // get file mime type
93
+ $mime_type = mime_content_type( $file );
94
+
95
+ // skip non text files.
96
+ if ( strpos( $mime_type, 'text/' ) !== 0 ) {
97
+ continue;
98
+ }
99
+
100
+ // get file contents
101
+ $file_contents = file_get_contents( $file );
102
+ // json decode
103
+ $panels_data = json_decode( $file_contents, true );
104
+
105
+ // get file name by stripping out folder path and .json extension
106
+ $file_name = str_replace( $folder . '/' , '', $file );
107
+ $file_name = str_replace( '.json', '', $file_name );
108
+
109
+ // get name: check for id or name else use filename
110
+ $panels_data['id'] = sanitize_title_with_dashes( $this->get_layout_id( $panels_data, $file_name ) );
111
+
112
+ if ( empty( $panels_data['name'] ) ) {
113
+ $panels_data['name'] = $file_name;
114
+ }
115
+
116
+ $panels_data['name'] = sanitize_text_field( $panels_data['name'] );
117
+
118
+ // get screenshot: check for screenshot prop else try use image file with same filename.
119
+ $panels_data['screenshot'] = $this->get_layout_file_screenshot( $panels_data, $folder, $file_name );
120
+
121
+ // set item on layouts array
122
+ $layouts[ $panels_data['id'] ] = $panels_data;
123
+ }
124
+ }
125
+
126
+ return $layouts;
127
+ }
128
+
129
+ private function get_layout_id( $layout_data, $fallback ) {
130
+ if ( ! empty( $layout_data['id'] ) ) {
131
+ return $layout_data['id'];
132
+ } else if ( ! empty( $layout_data['name'] ) ) {
133
+ return $layout_data['name'];
134
+ } else {
135
+ return $fallback;
136
+ }
137
+ }
138
+
139
+ private function get_layout_file_screenshot( $panels_data, $folder_path, $file_name ) {
140
+ if ( ! empty( $panels_data['screenshot'] ) ) {
141
+ return $panels_data['screenshot'];
142
+ } else {
143
+ $paths = glob( $folder_path . "/$file_name.{jpg,jpeg,gif,png}", GLOB_BRACE );
144
+ // Highlander Condition. There can be only one.
145
+ $screenshot_path = empty( $paths ) ? '' : wp_normalize_path( $paths[0] );
146
+ $wp_content_dir = wp_normalize_path( WP_CONTENT_DIR );
147
+ $screenshot_url = '';
148
+ if ( file_exists( $screenshot_path ) &&
149
+ strrpos( $screenshot_path, $wp_content_dir ) === 0 ) {
150
+
151
+ $screenshot_url = str_replace( $wp_content_dir, content_url(), $screenshot_path );
152
+ }
153
+
154
+ return $screenshot_url;
155
+ }
156
+ }
157
+
158
  /**
159
+ * Gets all the prebuilt layouts.
160
  */
161
  function action_get_prebuilt_layouts() {
162
  if ( empty( $_REQUEST['_panelsnonce'] ) || ! wp_verify_nonce( $_REQUEST['_panelsnonce'], 'panels_action' ) ) {
163
+ wp_die( __( 'Invalid request.', 'siteorigin-panels' ), 403 );
164
  }
165
 
166
  // Get any layouts that the current user could edit.
243
  // Check that the user can view the given page types
244
  $post_type = get_post_type_object( str_replace( 'clone_', '', $type ) );
245
  if( empty( $post_type ) ) {
246
+ return;
247
  }
248
 
249
  $return['title'] = sprintf( __( 'Clone %s', 'siteorigin-panels' ), esc_html( $post_type->labels->singular_name ) );
315
  $lid = ! empty( $_REQUEST['lid'] ) ? $_REQUEST['lid'] : false;
316
 
317
  if ( empty( $lid ) || empty( $layouts[ $lid ] ) ) {
318
+ wp_send_json_error( array(
319
+ 'error' => true,
320
+ 'message' => __( 'Missing layout ID or no such layout exists', 'siteorigin-panels' ),
321
+ ) );
322
  }
323
 
324
  $layout = $layouts[ $_REQUEST['lid'] ];
361
  // For now, we'll just pretend to load this
362
  $panels_data = json_decode( $response['body'], true );
363
  } else {
364
+ wp_send_json_error( array(
365
+ 'error' => true,
366
+ 'message' => __( 'There was a problem fetching the layout. Please try again later.', 'siteorigin-panels' ),
367
+ ) );
368
  }
369
  }
370
  $raw_panels_data = true;
379
  $panels_data['widgets'] = SiteOrigin_Panels_Admin::single()->process_raw_widgets( $panels_data['widgets'], array(), true, true );
380
  }
381
 
382
+ wp_send_json_success( $panels_data );
 
383
  }
384
 
385
  /**
407
  wp_die();
408
  }
409
 
410
+ $export_data = wp_unslash( $_POST['panels_export_data'] );
411
+
412
+ $decoded_export_data = json_decode( $export_data, true );
413
+
414
+ if ( ! empty( $decoded_export_data['name'] ) ) {
415
+ $decoded_export_data['id'] = sanitize_title_with_dashes( $decoded_export_data['name'] );
416
+ $filename = $decoded_export_data['id'];
417
+ } else {
418
+ $filename = 'layout-' . date( 'dmY' );
419
+ }
420
+
421
+
422
  header( 'content-type: application/json' );
423
+ header( "Content-Disposition: attachment; filename=$filename.json" );
424
 
 
425
  echo $export_data;
426
 
427
  wp_die();
428
  }
429
+
430
  /**
431
  * Enable the directory.
432
  */
438
  update_user_meta( $user, 'so_panels_directory_enabled', true );
439
  wp_die();
440
  }
441
+
442
+ /**
443
+ * Load a layout from a json file
444
+ *
445
+ * @param $id
446
+ * @param $name
447
+ * @param $json_file
448
+ * @param bool $screenshot
449
+ *
450
+ * @return array The data for the layout
451
+ */
452
+ public static function load_layout($id, $name, $json_file, $screenshot = false) {
453
+ $layout_data = json_decode(file_get_contents($json_file), true);
454
+ $layout_data = apply_filters('siteorigin_panels_load_layout_' . $id, $layout_data);
455
+
456
+ $layout_data = array_merge(array(
457
+ 'name' => $name,
458
+ 'screenshot' => $screenshot,
459
+ ), $layout_data);
460
+
461
+ return $layout_data;
462
+ }
463
  }
inc/admin.php CHANGED
@@ -1105,4 +1105,31 @@ class SiteOrigin_Panels_Admin {
1105
  return $strings;
1106
  }
1107
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1108
  }
1105
  return $strings;
1106
  }
1107
 
1108
+ /**
1109
+ * Display links for various SiteOrigin addons
1110
+ */
1111
+ public static function display_footer_premium_link(){
1112
+ $links = array(
1113
+ array(
1114
+ 'text' => __('Get a lightbox addon for SiteOrigin widgets', 'siteorigin-panels'),
1115
+ 'url' => SiteOrigin_Panels::premium_url('plugin/lightbox')
1116
+ ),
1117
+ array(
1118
+ 'text' => __('Get the row, cell and widget animations addon', 'siteorigin-panels'),
1119
+ 'url' => SiteOrigin_Panels::premium_url('plugin/lightbox')
1120
+ ),
1121
+ array(
1122
+ 'text' => __('Get premium email support for SiteOrigin Page Builder', 'siteorigin-panels'),
1123
+ 'url' => SiteOrigin_Panels::premium_url()
1124
+ ),
1125
+ );
1126
+ $link = $links[array_rand($links)];
1127
+
1128
+ ?>
1129
+ <a href="<?php echo esc_url( $link['url'] ) ?>" target="_blank" rel='noopener noreferrer'>
1130
+ <?php echo esc_html( $link['text'] ) ?>.
1131
+ </a>
1132
+ <?php
1133
+ }
1134
+
1135
  }
inc/renderer.php CHANGED
@@ -22,6 +22,7 @@ class SiteOrigin_Panels_Renderer {
22
  */
23
  public function add_inline_css( $post_id, $css ) {
24
  if ( is_null( $this->inline_css ) ) {
 
25
  $this->inline_css = array();
26
  add_action( 'wp_head', array( $this, 'print_inline_css' ), 12 );
27
  add_action( 'wp_footer', array( $this, 'print_inline_css' ) );
@@ -501,6 +502,9 @@ class SiteOrigin_Panels_Renderer {
501
  $css_id = sanitize_html_class( current_filter() );
502
  break;
503
  }
 
 
 
504
 
505
  if ( ! empty( $the_css ) ) {
506
  ?>
22
  */
23
  public function add_inline_css( $post_id, $css ) {
24
  if ( is_null( $this->inline_css ) ) {
25
+ // Initialize the inline CSS array and add actions to handle printing.
26
  $this->inline_css = array();
27
  add_action( 'wp_head', array( $this, 'print_inline_css' ), 12 );
28
  add_action( 'wp_footer', array( $this, 'print_inline_css' ) );
502
  $css_id = sanitize_html_class( current_filter() );
503
  break;
504
  }
505
+
506
+ // Allow third party developers to change the inline styles or remove them completely.
507
+ $the_css = apply_filters( 'siteorigin_panels_inline_styles', $the_css );
508
 
509
  if ( ! empty( $the_css ) ) {
510
  ?>
inc/settings.php CHANGED
@@ -596,11 +596,18 @@ class SiteOrigin_Panels_Settings {
596
  * @return array
597
  */
598
  function get_post_types() {
599
- $types = array_merge( array(
 
 
600
  'page' => 'page',
601
  'post' => 'post'
602
- ), get_post_types( array( '_builtin' => false ) ) );
603
-
 
 
 
 
 
604
  // These are post types we know we don't want to show Page Builder on
605
  unset( $types['ml-slider'] );
606
 
596
  * @return array
597
  */
598
  function get_post_types() {
599
+ $post_types = get_post_types( array( '_builtin' => false ) );
600
+
601
+ $types = array(
602
  'page' => 'page',
603
  'post' => 'post'
604
+ );
605
+
606
+ // Don't use `array_merge` here as it will break things if a post type has a numeric slug.
607
+ foreach ( $post_types as $key => $value ) {
608
+ $types[ $key ] = $value;
609
+ }
610
+
611
  // These are post types we know we don't want to show Page Builder on
612
  unset( $types['ml-slider'] );
613
 
js/siteorigin-panels-2516.min.js DELETED
@@ -1,4 +0,0 @@
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[name="cells"].so-row-field').val(this.model.get("cells").length),this.model.has("ratio")&&this.$('select[name="ratio"].so-row-field').val(this.model.get("ratio")),this.model.has("ratio_direction")&&this.$('select[name="ratio_direction"].so-row-field').val(this.model.get("ratio_direction"))),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:{},ratio:this.model.get("ratio"),ratio_direction:this.model.get("ratio_direction")},this.$('input[name="cells"].so-row-field').val(this.model.get("cells").length),this.model.has("ratio")&&this.$('select[name="ratio"].so-row-field').val(this.model.get("ratio")),this.model.has("ratio_direction")&&this.$('select[name="ratio_direction"].so-row-field').val(this.model.get("ratio_direction")),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 select[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)),this.row.ratio=e.ratio,this.row.ratio_direction=e.direction,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),this.model.set("ratio",this.row.ratio),this.model.set("ratio_direction",this.row.ratio_direction)),!_.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":31}],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")})
2
- ;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);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 _.isUndefined(e)||_.isNull(e)?"":(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,o=e("#siteorigin-panels-metabox");if(s=e("form#post"),o.length&&s.length)t=o,i=o.find(".siteorigin-panels-data-field"),l={editorType:"tinyMCE",postId:e("#post_ID").val(),editorId:"#content",builderType:o.data("builder-type"),builderSupports:o.data("builder-supports"),loadOnAttach:panelsOptions.loadOnAttach&&1==e("#auto_draft").val(),loadLiveEditor:1==o.data("live-editor"),liveEditorPreview:t.data("preview-url")};else if(e(".siteorigin-panels-builder-form").length){var n=e(".siteorigin-panels-builder-form");t=n.find(".siteorigin-panels-builder-container"),i=n.find('input[name="panels_data"]'),s=n,l={editorType:"standalone",postId:n.data("post-id"),editorId:"#post_content",builderType:n.data("type"),builderSupports:n.data("builder-supports"),loadLiveEditor:!1,liveEditorPreview:n.data("preview-url")}}if(!_.isUndefined(t)){var a=window.siteoriginPanels,r=new a.model.builder,d=new a.view.builder({model:r,config:l});d.render().attach({container:t}).setDataField(i).attachToEditor(),s.submit(function(){r.refreshPanelsData()}),t.removeClass("so-panels-loading"),e(document).trigger("panels_setup",d,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].ratio)||(s.ratio=e.grids[i].ratio),_.isUndefined(e.grids[i].ratio_direction)||(s.ratio_direction=e.grids[i].ratio_direction),_.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"),ratio:i.get("ratio"),ratio_direction:i.get("ratio_direction"),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"),ratio:r.data("ratio"),ratio_direction:r.data("ratio-direction"),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,style:c.data("style"),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("widget_id",""),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.supports("revertToEditor")||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(),l("#editor-expand-toggle").on("change.editor-expand",function(){l(this).prop("checked")||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)},
3
- 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){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),l(document).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){
4
- 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(),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=jQuery,l={addWidget:function(e,t,i){var l=wp.customHtmlWidgets,o=s("<div></div>"),n=t.find(".widget-content:first");n.before(o);var a=new l.CustomHtmlWidgetControl({el:o,syncContainer:n});return a.initializeEditor(),a.editor.codemirror.refresh(),a}};t.exports=l},{}],31:[function(e,t,i){var s=e("./custom-html-widget"),l=e("./media-widget"),o=e("./text-widget"),n={CUSTOM_HTML:"custom_html",MEDIA_AUDIO:"media_audio",MEDIA_GALLERY:"media_gallery",MEDIA_IMAGE:"media_image",MEDIA_VIDEO:"media_video",TEXT:"text",addWidget:function(e,t){var i,n=e.find("> .id_base").val();switch(n){case this.CUSTOM_HTML:i=s;break;case this.MEDIA_AUDIO:case this.MEDIA_GALLERY:case this.MEDIA_IMAGE:case this.MEDIA_VIDEO:i=l;break;case this.TEXT:i=o}i.addWidget(n,e,t)}};t.exports=n},{"./custom-html-widget":30,"./media-widget":32,"./text-widget":33}],32:[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,syncContainer:a,model:c});return h.render(),h}}};t.exports=l},{}],33:[function(e,t,i){var s=jQuery,l={addWidget:function(e,t,i){var l=wp.textWidgets,o={},n=t.find(".visual");if(n.length>0){if(!n.val())return null;var a=s("<div></div>"),r=t.find(".widget-content:first");r.before(a),o={el:a,syncContainer:r}}else o={el:t};var d=new l.TextWidgetControl(o);return d.initializeEditor(),d}};t.exports=l},{}]},{},[16]);
 
 
 
 
js/{siteorigin-panels-2516.js → siteorigin-panels-260.js} RENAMED
@@ -545,7 +545,13 @@ module.exports = panels.view.dialog.extend( {
545
  // Handle exporting the file
546
  c.find( '.so-export' ).submit( function ( e ) {
547
  var $$ = $( this );
548
- $$.find( 'input[name="panels_export_data"]' ).val( JSON.stringify( thisView.builder.model.getPanelsData() ) );
 
 
 
 
 
 
549
  } );
550
 
551
  },
@@ -728,14 +734,15 @@ module.exports = panels.view.dialog.extend( {
728
  panelsOptions.ajaxurl,
729
  args,
730
  function ( layout ) {
731
- if ( layout.error !== undefined ) {
732
- // There was an error
733
- alert( layout.error );
734
- deferredLayout.reject( layout );
735
  } else {
736
- this.setStatusMessage( '', false );
737
- deferredLayout.resolve( layout );
738
  }
 
 
739
  }.bind( this )
740
  );
741
  return deferredLayout.promise();
@@ -5685,10 +5692,13 @@ module.exports = Backbone.View.extend( {
5685
  /**
5686
  * Set a status message for the dialog
5687
  */
5688
- setStatusMessage: function ( message, loading ) {
5689
- this.$( '.so-toolbar .so-status' ).html( message );
 
5690
  if ( ! _.isUndefined( loading ) && loading ) {
5691
  this.$( '.so-toolbar .so-status' ).addClass( 'so-panels-loading' );
 
 
5692
  }
5693
  },
5694
 
545
  // Handle exporting the file
546
  c.find( '.so-export' ).submit( function ( e ) {
547
  var $$ = $( this );
548
+ var panelsData = thisView.builder.model.getPanelsData();
549
+ var postName = $('input[name="post_title"]').val();
550
+ if ( ! postName ) {
551
+ postName = $('input[name="post_ID"]').val();
552
+ }
553
+ panelsData.name = postName;
554
+ $$.find( 'input[name="panels_export_data"]' ).val( JSON.stringify( panelsData ) );
555
  } );
556
 
557
  },
734
  panelsOptions.ajaxurl,
735
  args,
736
  function ( layout ) {
737
+ var msg = '';
738
+ if ( ! layout.success ) {
739
+ msg = layout.data.message;
740
+ deferredLayout.reject( layout.data );
741
  } else {
742
+ deferredLayout.resolve( layout.data );
 
743
  }
744
+ this.setStatusMessage( msg, false, ! layout.success );
745
+ this.updateButtonState( true );
746
  }.bind( this )
747
  );
748
  return deferredLayout.promise();
5692
  /**
5693
  * Set a status message for the dialog
5694
  */
5695
+ setStatusMessage: function ( message, loading, error ) {
5696
+ var msg = error ? '<span class="dashicons dashicons-warning"></span>' + message : message;
5697
+ this.$( '.so-toolbar .so-status' ).html( msg );
5698
  if ( ! _.isUndefined( loading ) && loading ) {
5699
  this.$( '.so-toolbar .so-status' ).addClass( 'so-panels-loading' );
5700
+ } else {
5701
+ this.$( '.so-toolbar .so-status' ).removeClass( 'so-panels-loading' );
5702
  }
5703
  },
5704
 
js/siteorigin-panels-260.min.js ADDED
@@ -0,0 +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){var i=l(this),s=t.builder.model.getPanelsData(),o=l('input[name="post_title"]').val();o||(o=l('input[name="post_ID"]').val()),s.name=o,i.find('input[name="panels_export_data"]').val(JSON.stringify(s))})},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){var i="";e.success?t.resolve(e.data):(i=e.data.message,t.reject(e.data)),this.setStatusMessage(i,!1,!e.success),this.updateButtonState(!0)}.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[name="cells"].so-row-field').val(this.model.get("cells").length),this.model.has("ratio")&&this.$('select[name="ratio"].so-row-field').val(this.model.get("ratio")),this.model.has("ratio_direction")&&this.$('select[name="ratio_direction"].so-row-field').val(this.model.get("ratio_direction"))),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:{},ratio:this.model.get("ratio"),ratio_direction:this.model.get("ratio_direction")},this.$('input[name="cells"].so-row-field').val(this.model.get("cells").length),this.model.has("ratio")&&this.$('select[name="ratio"].so-row-field').val(this.model.get("ratio")),this.model.has("ratio_direction")&&this.$('select[name="ratio_direction"].so-row-field').val(this.model.get("ratio_direction")),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 select[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)),this.row.ratio=e.ratio,this.row.ratio_direction=e.direction,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),this.model.set("ratio",this.row.ratio),this.model.set("ratio_direction",this.row.ratio_direction)),!_.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":31}],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()},
2
+ 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);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 _.isUndefined(e)||_.isNull(e)?"":(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,o=e("#siteorigin-panels-metabox");if(s=e("form#post"),o.length&&s.length)t=o,i=o.find(".siteorigin-panels-data-field"),l={editorType:"tinyMCE",postId:e("#post_ID").val(),editorId:"#content",builderType:o.data("builder-type"),builderSupports:o.data("builder-supports"),loadOnAttach:panelsOptions.loadOnAttach&&1==e("#auto_draft").val(),loadLiveEditor:1==o.data("live-editor"),liveEditorPreview:t.data("preview-url")};else if(e(".siteorigin-panels-builder-form").length){var n=e(".siteorigin-panels-builder-form");t=n.find(".siteorigin-panels-builder-container"),i=n.find('input[name="panels_data"]'),s=n,l={editorType:"standalone",postId:n.data("post-id"),editorId:"#post_content",builderType:n.data("type"),builderSupports:n.data("builder-supports"),loadLiveEditor:!1,liveEditorPreview:n.data("preview-url")}}if(!_.isUndefined(t)){var a=window.siteoriginPanels,r=new a.model.builder,d=new a.view.builder({model:r,config:l});d.render().attach({container:t}).setDataField(i).attachToEditor(),s.submit(function(){r.refreshPanelsData()}),t.removeClass("so-panels-loading"),e(document).trigger("panels_setup",d,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].ratio)||(s.ratio=e.grids[i].ratio),_.isUndefined(e.grids[i].ratio_direction)||(s.ratio_direction=e.grids[i].ratio_direction),_.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"),ratio:i.get("ratio"),ratio_direction:i.get("ratio_direction"),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"),ratio:r.data("ratio"),ratio_direction:r.data("ratio-direction"),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,style:c.data("style"),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("widget_id",""),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.supports("revertToEditor")||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(),l("#editor-expand-toggle").on("change.editor-expand",function(){l(this).prop("checked")||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}),
3
+ 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){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),l(document).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,i){var s=i?'<span class="dashicons dashicons-warning"></span>'+e:e;this.$(".so-toolbar .so-status").html(s),!_.isUndefined(t)&&t?this.$(".so-toolbar .so-status").addClass("so-panels-loading"):this.$(".so-toolbar .so-status").removeClass("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){
4
+ 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(),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=jQuery,l={addWidget:function(e,t,i){var l=wp.customHtmlWidgets,o=s("<div></div>"),n=t.find(".widget-content:first");n.before(o);var a=new l.CustomHtmlWidgetControl({el:o,syncContainer:n});return a.initializeEditor(),a.editor.codemirror.refresh(),a}};t.exports=l},{}],31:[function(e,t,i){var s=e("./custom-html-widget"),l=e("./media-widget"),o=e("./text-widget"),n={CUSTOM_HTML:"custom_html",MEDIA_AUDIO:"media_audio",MEDIA_GALLERY:"media_gallery",MEDIA_IMAGE:"media_image",MEDIA_VIDEO:"media_video",TEXT:"text",addWidget:function(e,t){var i,n=e.find("> .id_base").val();switch(n){case this.CUSTOM_HTML:i=s;break;case this.MEDIA_AUDIO:case this.MEDIA_GALLERY:case this.MEDIA_IMAGE:case this.MEDIA_VIDEO:i=l;break;case this.TEXT:i=o}i.addWidget(n,e,t)}};t.exports=n},{"./custom-html-widget":30,"./media-widget":32,"./text-widget":33}],32:[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,syncContainer:a,model:c});return h.render(),h}}};t.exports=l},{}],33:[function(e,t,i){var s=jQuery,l={addWidget:function(e,t,i){var l=wp.textWidgets,o={},n=t.find(".visual");if(n.length>0){if(!n.val())return null;var a=s("<div></div>"),r=t.find(".widget-content:first");r.before(a),o={el:a,syncContainer:r}}else o={el:t};var d=new l.TextWidgetControl(o);return d.initializeEditor(),d}};t.exports=l},{}]},{},[16]);
js/{styling-2516.js → styling-260.js} RENAMED
File without changes
js/{styling-2516.min.js → styling-260.min.js} RENAMED
File without changes
lang/siteorigin-panels.pot CHANGED
@@ -17,22 +17,34 @@ msgstr ""
17
  "X-Poedit-SearchPathExcluded-0: *.js\n"
18
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
19
 
20
- #: tmp/inc/admin-layouts.php:38, tmp/inc/admin-layouts.php:104
21
  msgid "Layouts Directory"
22
  msgstr ""
23
 
24
- #: tmp/inc/admin-layouts.php:83
 
 
 
 
25
  msgid "Theme Defined Layouts"
26
  msgstr ""
27
 
28
- #: tmp/inc/admin-layouts.php:154
29
  msgid "Clone %s"
30
  msgstr ""
31
 
32
- #: tmp/inc/admin-layouts.php:192
33
  msgid " - Results For:"
34
  msgstr ""
35
 
 
 
 
 
 
 
 
 
36
  #: tmp/inc/admin-widget-dialog.php:97, tmp/widgets/widgets.php:164
37
  msgid "Widgets Bundle"
38
  msgstr ""
@@ -85,7 +97,7 @@ msgstr ""
85
  msgid "Addons"
86
  msgstr ""
87
 
88
- #: tmp/inc/admin.php:140, tmp/inc/admin.php:491, tmp/inc/admin.php:1002, tmp/inc/admin.php:1007, tmp/inc/settings.php:195, tmp/tpl/js-templates.php:203
89
  msgid "Page Builder"
90
  msgstr ""
91
 
@@ -217,7 +229,7 @@ msgstr ""
217
  msgid "Layout Builder Widget"
218
  msgstr ""
219
 
220
- #: tmp/inc/admin.php:371, tmp/tpl/js-templates.php:107, tmp/tpl/js-templates.php:426
221
  msgid "Are you sure?"
222
  msgstr ""
223
 
@@ -233,7 +245,7 @@ msgstr ""
233
  msgid "Add Widget to Cell"
234
  msgstr ""
235
 
236
- #: tmp/inc/admin.php:379, tmp/tpl/js-templates.php:230
237
  msgid "Search Widgets"
238
  msgstr ""
239
 
@@ -281,15 +293,15 @@ msgstr ""
281
  msgid "Row Actions"
282
  msgstr ""
283
 
284
- #: tmp/inc/admin.php:395, tmp/tpl/js-templates.php:105
285
  msgid "Edit Row"
286
  msgstr ""
287
 
288
- #: tmp/inc/admin.php:396, tmp/tpl/js-templates.php:106
289
  msgid "Duplicate Row"
290
  msgstr ""
291
 
292
- #: tmp/inc/admin.php:397, tmp/tpl/js-templates.php:107
293
  msgid "Delete Row"
294
  msgstr ""
295
 
@@ -313,7 +325,7 @@ msgstr ""
313
  msgid "New Row"
314
  msgstr ""
315
 
316
- #: tmp/inc/admin.php:405, tmp/inc/styles.php:183, tmp/tpl/js-templates.php:70
317
  msgid "Row"
318
  msgstr ""
319
 
@@ -409,10 +421,22 @@ msgstr ""
409
  msgid "Sign Up"
410
  msgstr ""
411
 
412
- #: tmp/inc/admin.php:1103, tmp/tpl/js-templates.php:242
413
  msgid "Close"
414
  msgstr ""
415
 
 
 
 
 
 
 
 
 
 
 
 
 
416
  #: tmp/inc/data/widgets-bundle.php:7
417
  msgid "SiteOrigin Editor"
418
  msgstr ""
@@ -945,7 +969,7 @@ msgstr ""
945
  msgid "Color of links inside this cell."
946
  msgstr ""
947
 
948
- #: tmp/inc/styles.php:316, tmp/tpl/js-templates.php:69
949
  msgid "Widget"
950
  msgstr ""
951
 
@@ -1173,7 +1197,7 @@ msgstr ""
1173
  msgid "Add Widget"
1174
  msgstr ""
1175
 
1176
- #: tmp/tpl/js-templates.php:22
1177
  msgid "Prebuilt Layouts"
1178
  msgstr ""
1179
 
@@ -1205,163 +1229,155 @@ msgstr ""
1205
  msgid "Revert to Editor"
1206
  msgstr ""
1207
 
1208
- #: tmp/tpl/js-templates.php:68
1209
  msgid "Add a %s, %s or %s to get started. Read our %s if you need help."
1210
  msgstr ""
1211
 
1212
- #: tmp/tpl/js-templates.php:71
1213
  msgid "Prebuilt Layout"
1214
  msgstr ""
1215
 
1216
- #: tmp/tpl/js-templates.php:72
1217
  msgid "documentation"
1218
  msgstr ""
1219
 
1220
- #: tmp/tpl/js-templates.php:79
1221
  msgid "Pro Tip"
1222
  msgstr ""
1223
 
1224
- #: tmp/tpl/js-templates.php:81
1225
- msgid "12 tips every Page Builder user should know."
1226
- msgstr ""
1227
-
1228
- #: tmp/tpl/js-templates.php:151
1229
  msgid "Edit"
1230
  msgstr ""
1231
 
1232
- #: tmp/tpl/js-templates.php:152, tmp/tpl/js-templates.php:274, tmp/tpl/js-templates.php:359
1233
  msgid "Duplicate"
1234
  msgstr ""
1235
 
1236
- #: tmp/tpl/js-templates.php:153, tmp/tpl/js-templates.php:273, tmp/tpl/js-templates.php:358
1237
  msgid "Delete"
1238
  msgstr ""
1239
 
1240
- #: tmp/tpl/js-templates.php:212, tmp/tpl/js-templates.php:277, tmp/tpl/js-templates.php:366, tmp/tpl/js-templates.php:558
1241
  msgid "Done"
1242
  msgstr ""
1243
 
1244
- #: tmp/tpl/js-templates.php:226
1245
  msgid "Add New Widget %s"
1246
  msgstr ""
1247
 
1248
- #: tmp/tpl/js-templates.php:327
1249
  msgid "Left to Right"
1250
  msgstr ""
1251
 
1252
- #: tmp/tpl/js-templates.php:328
1253
  msgid "Right to Left"
1254
  msgstr ""
1255
 
1256
- #: tmp/tpl/js-templates.php:339
1257
  msgid "1{Set row layout}: %1$s columns with a ratio of %2$s going from %3$s"
1258
  msgstr ""
1259
 
1260
- #: tmp/tpl/js-templates.php:345
1261
  msgid "Set"
1262
  msgstr ""
1263
 
1264
- #: tmp/tpl/js-templates.php:364, tmp/tpl/js-templates.php:420
1265
  msgid "Insert"
1266
  msgstr ""
1267
 
1268
- #: tmp/tpl/js-templates.php:384
1269
  msgid "Page Builder Layouts"
1270
  msgstr ""
1271
 
1272
- #: tmp/tpl/js-templates.php:388
1273
  msgid "Search"
1274
  msgstr ""
1275
 
1276
- #: tmp/tpl/js-templates.php:392
1277
- msgid "Theme Defined"
1278
- msgstr ""
1279
-
1280
- #: tmp/tpl/js-templates.php:401
1281
  msgid "Import/Export"
1282
  msgstr ""
1283
 
1284
- #: tmp/tpl/js-templates.php:408
1285
  msgid "Clone: %s"
1286
  msgstr ""
1287
 
1288
- #: tmp/tpl/js-templates.php:424
1289
  msgid "Insert after"
1290
  msgstr ""
1291
 
1292
- #: tmp/tpl/js-templates.php:425
1293
  msgid "Insert before"
1294
  msgstr ""
1295
 
1296
- #: tmp/tpl/js-templates.php:426
1297
  msgid "Replace current"
1298
  msgstr ""
1299
 
1300
- #: tmp/tpl/js-templates.php:437
1301
  msgid "Do you want to browse the Prebuilt Layouts directory?"
1302
  msgstr ""
1303
 
1304
- #: tmp/tpl/js-templates.php:438
1305
  msgid "Enable"
1306
  msgstr ""
1307
 
1308
- #: tmp/tpl/js-templates.php:451
1309
  msgid "Your search didn't return any results"
1310
  msgstr ""
1311
 
1312
- #: tmp/tpl/js-templates.php:479
1313
  msgid "Previous"
1314
  msgstr ""
1315
 
1316
- #: tmp/tpl/js-templates.php:480
1317
  msgid "Next"
1318
  msgstr ""
1319
 
1320
- #: tmp/tpl/js-templates.php:490
1321
  msgid "Drop import file here"
1322
  msgstr ""
1323
 
1324
- #: tmp/tpl/js-templates.php:491
1325
  msgid "Or"
1326
  msgstr ""
1327
 
1328
- #: tmp/tpl/js-templates.php:494
1329
  msgid "Select Import File"
1330
  msgstr ""
1331
 
1332
- #: tmp/tpl/js-templates.php:508
1333
  msgid "Download Layout"
1334
  msgstr ""
1335
 
1336
- #: tmp/tpl/js-templates.php:519
1337
  msgid "Page Builder Change History"
1338
  msgstr ""
1339
 
1340
- #: tmp/tpl/js-templates.php:534
1341
  msgid "Restore Version"
1342
  msgstr ""
1343
 
1344
- #: tmp/tpl/js-templates.php:552, tmp/tpl/js-templates.php:553
1345
  msgid "Collapse"
1346
  msgstr ""
1347
 
1348
- #: tmp/tpl/js-templates.php:552
1349
  msgid "Expand"
1350
  msgstr ""
1351
 
1352
- #: tmp/tpl/js-templates.php:560
1353
  msgid "Toggle desktop mode"
1354
  msgstr ""
1355
 
1356
- #: tmp/tpl/js-templates.php:563
1357
  msgid "Toggle tablet mode"
1358
  msgstr ""
1359
 
1360
- #: tmp/tpl/js-templates.php:566
1361
  msgid "Toggle mobile mode"
1362
  msgstr ""
1363
 
1364
- #: tmp/tpl/js-templates.php:605
1365
  msgid "No Results"
1366
  msgstr ""
1367
 
17
  "X-Poedit-SearchPathExcluded-0: *.js\n"
18
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
19
 
20
+ #: tmp/inc/admin-layouts.php:40, tmp/inc/admin-layouts.php:199
21
  msgid "Layouts Directory"
22
  msgstr ""
23
 
24
+ #: tmp/inc/admin-layouts.php:163
25
+ msgid "Invalid request."
26
+ msgstr ""
27
+
28
+ #: tmp/inc/admin-layouts.php:178
29
  msgid "Theme Defined Layouts"
30
  msgstr ""
31
 
32
+ #: tmp/inc/admin-layouts.php:249
33
  msgid "Clone %s"
34
  msgstr ""
35
 
36
+ #: tmp/inc/admin-layouts.php:287
37
  msgid " - Results For:"
38
  msgstr ""
39
 
40
+ #: tmp/inc/admin-layouts.php:320
41
+ msgid "Missing layout ID or no such layout exists"
42
+ msgstr ""
43
+
44
+ #: tmp/inc/admin-layouts.php:366
45
+ msgid "There was a problem fetching the layout. Please try again later."
46
+ msgstr ""
47
+
48
  #: tmp/inc/admin-widget-dialog.php:97, tmp/widgets/widgets.php:164
49
  msgid "Widgets Bundle"
50
  msgstr ""
97
  msgid "Addons"
98
  msgstr ""
99
 
100
+ #: tmp/inc/admin.php:140, tmp/inc/admin.php:491, tmp/inc/admin.php:1002, tmp/inc/admin.php:1007, tmp/inc/settings.php:195, tmp/tpl/js-templates.php:200
101
  msgid "Page Builder"
102
  msgstr ""
103
 
229
  msgid "Layout Builder Widget"
230
  msgstr ""
231
 
232
+ #: tmp/inc/admin.php:371, tmp/tpl/js-templates.php:104, tmp/tpl/js-templates.php:425
233
  msgid "Are you sure?"
234
  msgstr ""
235
 
245
  msgid "Add Widget to Cell"
246
  msgstr ""
247
 
248
+ #: tmp/inc/admin.php:379, tmp/tpl/js-templates.php:227
249
  msgid "Search Widgets"
250
  msgstr ""
251
 
293
  msgid "Row Actions"
294
  msgstr ""
295
 
296
+ #: tmp/inc/admin.php:395, tmp/tpl/js-templates.php:102
297
  msgid "Edit Row"
298
  msgstr ""
299
 
300
+ #: tmp/inc/admin.php:396, tmp/tpl/js-templates.php:103
301
  msgid "Duplicate Row"
302
  msgstr ""
303
 
304
+ #: tmp/inc/admin.php:397, tmp/tpl/js-templates.php:104
305
  msgid "Delete Row"
306
  msgstr ""
307
 
325
  msgid "New Row"
326
  msgstr ""
327
 
328
+ #: tmp/inc/admin.php:405, tmp/inc/styles.php:183, tmp/tpl/js-templates.php:69
329
  msgid "Row"
330
  msgstr ""
331
 
421
  msgid "Sign Up"
422
  msgstr ""
423
 
424
+ #: tmp/inc/admin.php:1103, tmp/tpl/js-templates.php:239
425
  msgid "Close"
426
  msgstr ""
427
 
428
+ #: tmp/inc/admin.php:1114
429
+ msgid "Get a lightbox addon for SiteOrigin widgets"
430
+ msgstr ""
431
+
432
+ #: tmp/inc/admin.php:1118
433
+ msgid "Get the row, cell and widget animations addon"
434
+ msgstr ""
435
+
436
+ #: tmp/inc/admin.php:1122
437
+ msgid "Get premium email support for SiteOrigin Page Builder"
438
+ msgstr ""
439
+
440
  #: tmp/inc/data/widgets-bundle.php:7
441
  msgid "SiteOrigin Editor"
442
  msgstr ""
969
  msgid "Color of links inside this cell."
970
  msgstr ""
971
 
972
+ #: tmp/inc/styles.php:316, tmp/tpl/js-templates.php:68
973
  msgid "Widget"
974
  msgstr ""
975
 
1197
  msgid "Add Widget"
1198
  msgstr ""
1199
 
1200
+ #: tmp/tpl/js-templates.php:22, tmp/tpl/js-templates.php:390
1201
  msgid "Prebuilt Layouts"
1202
  msgstr ""
1203
 
1229
  msgid "Revert to Editor"
1230
  msgstr ""
1231
 
1232
+ #: tmp/tpl/js-templates.php:67
1233
  msgid "Add a %s, %s or %s to get started. Read our %s if you need help."
1234
  msgstr ""
1235
 
1236
+ #: tmp/tpl/js-templates.php:70
1237
  msgid "Prebuilt Layout"
1238
  msgstr ""
1239
 
1240
+ #: tmp/tpl/js-templates.php:71
1241
  msgid "documentation"
1242
  msgstr ""
1243
 
1244
+ #: tmp/tpl/js-templates.php:78
1245
  msgid "Pro Tip"
1246
  msgstr ""
1247
 
1248
+ #: tmp/tpl/js-templates.php:148
 
 
 
 
1249
  msgid "Edit"
1250
  msgstr ""
1251
 
1252
+ #: tmp/tpl/js-templates.php:149, tmp/tpl/js-templates.php:271, tmp/tpl/js-templates.php:356
1253
  msgid "Duplicate"
1254
  msgstr ""
1255
 
1256
+ #: tmp/tpl/js-templates.php:150, tmp/tpl/js-templates.php:270, tmp/tpl/js-templates.php:355
1257
  msgid "Delete"
1258
  msgstr ""
1259
 
1260
+ #: tmp/tpl/js-templates.php:209, tmp/tpl/js-templates.php:274, tmp/tpl/js-templates.php:363, tmp/tpl/js-templates.php:557
1261
  msgid "Done"
1262
  msgstr ""
1263
 
1264
+ #: tmp/tpl/js-templates.php:223
1265
  msgid "Add New Widget %s"
1266
  msgstr ""
1267
 
1268
+ #: tmp/tpl/js-templates.php:324
1269
  msgid "Left to Right"
1270
  msgstr ""
1271
 
1272
+ #: tmp/tpl/js-templates.php:325
1273
  msgid "Right to Left"
1274
  msgstr ""
1275
 
1276
+ #: tmp/tpl/js-templates.php:336
1277
  msgid "1{Set row layout}: %1$s columns with a ratio of %2$s going from %3$s"
1278
  msgstr ""
1279
 
1280
+ #: tmp/tpl/js-templates.php:342
1281
  msgid "Set"
1282
  msgstr ""
1283
 
1284
+ #: tmp/tpl/js-templates.php:361, tmp/tpl/js-templates.php:419
1285
  msgid "Insert"
1286
  msgstr ""
1287
 
1288
+ #: tmp/tpl/js-templates.php:381
1289
  msgid "Page Builder Layouts"
1290
  msgstr ""
1291
 
1292
+ #: tmp/tpl/js-templates.php:385
1293
  msgid "Search"
1294
  msgstr ""
1295
 
1296
+ #: tmp/tpl/js-templates.php:400
 
 
 
 
1297
  msgid "Import/Export"
1298
  msgstr ""
1299
 
1300
+ #: tmp/tpl/js-templates.php:407
1301
  msgid "Clone: %s"
1302
  msgstr ""
1303
 
1304
+ #: tmp/tpl/js-templates.php:423
1305
  msgid "Insert after"
1306
  msgstr ""
1307
 
1308
+ #: tmp/tpl/js-templates.php:424
1309
  msgid "Insert before"
1310
  msgstr ""
1311
 
1312
+ #: tmp/tpl/js-templates.php:425
1313
  msgid "Replace current"
1314
  msgstr ""
1315
 
1316
+ #: tmp/tpl/js-templates.php:436
1317
  msgid "Do you want to browse the Prebuilt Layouts directory?"
1318
  msgstr ""
1319
 
1320
+ #: tmp/tpl/js-templates.php:437
1321
  msgid "Enable"
1322
  msgstr ""
1323
 
1324
+ #: tmp/tpl/js-templates.php:450
1325
  msgid "Your search didn't return any results"
1326
  msgstr ""
1327
 
1328
+ #: tmp/tpl/js-templates.php:478
1329
  msgid "Previous"
1330
  msgstr ""
1331
 
1332
+ #: tmp/tpl/js-templates.php:479
1333
  msgid "Next"
1334
  msgstr ""
1335
 
1336
+ #: tmp/tpl/js-templates.php:489
1337
  msgid "Drop import file here"
1338
  msgstr ""
1339
 
1340
+ #: tmp/tpl/js-templates.php:490
1341
  msgid "Or"
1342
  msgstr ""
1343
 
1344
+ #: tmp/tpl/js-templates.php:493
1345
  msgid "Select Import File"
1346
  msgstr ""
1347
 
1348
+ #: tmp/tpl/js-templates.php:507
1349
  msgid "Download Layout"
1350
  msgstr ""
1351
 
1352
+ #: tmp/tpl/js-templates.php:518
1353
  msgid "Page Builder Change History"
1354
  msgstr ""
1355
 
1356
+ #: tmp/tpl/js-templates.php:533
1357
  msgid "Restore Version"
1358
  msgstr ""
1359
 
1360
+ #: tmp/tpl/js-templates.php:551, tmp/tpl/js-templates.php:552
1361
  msgid "Collapse"
1362
  msgstr ""
1363
 
1364
+ #: tmp/tpl/js-templates.php:551
1365
  msgid "Expand"
1366
  msgstr ""
1367
 
1368
+ #: tmp/tpl/js-templates.php:559
1369
  msgid "Toggle desktop mode"
1370
  msgstr ""
1371
 
1372
+ #: tmp/tpl/js-templates.php:562
1373
  msgid "Toggle tablet mode"
1374
  msgstr ""
1375
 
1376
+ #: tmp/tpl/js-templates.php:565
1377
  msgid "Toggle mobile mode"
1378
  msgstr ""
1379
 
1380
+ #: tmp/tpl/js-templates.php:604
1381
  msgid "No Results"
1382
  msgstr ""
1383
 
readme.txt CHANGED
@@ -2,8 +2,8 @@
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.9
5
- Stable tag: 2.5.16
6
- Build time: 2017-11-22T14:19:27+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,11 @@ We've tried to ensure that Page Builder is compatible with most plugin widgets.
96
 
97
  == Changelog ==
98
 
 
 
 
 
 
99
  = 2.5.16 - 22 November 2017 =
100
  * Disabled the Content Cache feature until we've resolved all issues and conflicts.
101
 
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.9
5
+ Stable tag: 2.6.0
6
+ Build time: 2017-12-17T12:20:48+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.6.0 - 17 December 2017 =
100
+ * Load prebuilt layout JSON files found in themes!
101
+ * Allow post types with numeric slugs.
102
+ * Add a filter for inline styles.
103
+
104
  = 2.5.16 - 22 November 2017 =
105
  * Disabled the Content Cache feature until we've resolved all issues and conflicts.
106
 
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.16
7
  Author: SiteOrigin
8
  Author URI: https://siteorigin.com
9
  License: GPL3
@@ -11,11 +11,11 @@ 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.16' );
15
  if ( ! defined( 'SITEORIGIN_PANELS_JS_SUFFIX' ) ) {
16
  define( 'SITEORIGIN_PANELS_JS_SUFFIX', '.min' );
17
  }
18
- define( 'SITEORIGIN_PANELS_VERSION_SUFFIX', '-2516' );
19
 
20
  require_once plugin_dir_path( __FILE__ ) . 'inc/functions.php';
21
 
@@ -485,7 +485,7 @@ class SiteOrigin_Panels {
485
 
486
  static function display_learn_button() {
487
  return siteorigin_panels_setting( 'display-learn' ) &&
488
- apply_filters( 'siteorigin_panels_learn', true );
489
  }
490
 
491
  /**
@@ -505,16 +505,19 @@ class SiteOrigin_Panels {
505
  apply_filters( 'siteorigin_premium_upgrade_teaser', true ) &&
506
  ! defined( 'SITEORIGIN_PREMIUM_VERSION' );
507
  }
508
-
509
  /**
510
  * Get the premium upgrade URL
511
  *
512
  * @return string
513
  */
514
- public static function premium_url() {
515
  $ref = apply_filters( 'siteorigin_premium_affiliate_id', '' );
516
  $url = 'https://siteorigin.com/downloads/premium/?featured_plugin=siteorigin-panels';
517
- if( $ref ) {
 
 
 
518
  $url = add_query_arg( 'ref', urlencode( $ref ), $url );
519
  }
520
  return $url;
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.6.0
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.6.0' );
15
  if ( ! defined( 'SITEORIGIN_PANELS_JS_SUFFIX' ) ) {
16
  define( 'SITEORIGIN_PANELS_JS_SUFFIX', '.min' );
17
  }
18
+ define( 'SITEORIGIN_PANELS_VERSION_SUFFIX', '-260' );
19
 
20
  require_once plugin_dir_path( __FILE__ ) . 'inc/functions.php';
21
 
485
 
486
  static function display_learn_button() {
487
  return siteorigin_panels_setting( 'display-learn' ) &&
488
+ apply_filters( 'siteorigin_panels_learn', true );
489
  }
490
 
491
  /**
505
  apply_filters( 'siteorigin_premium_upgrade_teaser', true ) &&
506
  ! defined( 'SITEORIGIN_PREMIUM_VERSION' );
507
  }
508
+
509
  /**
510
  * Get the premium upgrade URL
511
  *
512
  * @return string
513
  */
514
+ public static function premium_url( $featured_addon = false ) {
515
  $ref = apply_filters( 'siteorigin_premium_affiliate_id', '' );
516
  $url = 'https://siteorigin.com/downloads/premium/?featured_plugin=siteorigin-panels';
517
+ if( ! empty( $featured_addon ) ) {
518
+ $url = add_query_arg( 'featured_addon', urlencode( $featured_addon ), $url );
519
+ }
520
+ if( ! empty( $ref ) ) {
521
  $url = add_query_arg( 'ref', urlencode( $ref ), $url );
522
  }
523
  return $url;
tpl/js-templates.php CHANGED
@@ -63,23 +63,20 @@ $layouts = apply_filters( 'siteorigin_panels_prebuilt_layouts', array() );
63
  <div class="so-panels-welcome-message">
64
  <div class="so-message-wrapper">
65
  <?php
66
-
67
- printf(
68
- __( 'Add a %s, %s or %s to get started. Read our %s if you need help.', 'siteorigin-panels' ),
69
- "<a href='#' class='so-tool-button so-widget-add'>" . __( 'Widget', 'siteorigin-panels' ) . "</a>",
70
- "<a href='#' class='so-tool-button so-row-add'>" . __( 'Row', 'siteorigin-panels' ) . "</a>",
71
- "<a href='#' class='so-tool-button so-prebuilt-add'>" . __( 'Prebuilt Layout', 'siteorigin-panels' ) . "</a>",
72
- "<a href='https://siteorigin.com/page-builder/documentation/' target='_blank' rel='noopener noreferrer'>" . __( 'documentation', 'siteorigin-panels' ) . "</a>"
73
- );
74
  ?>
75
  </div>
76
 
77
- <?php if( SiteOrigin_Panels::display_learn_button() ) : ?>
78
  <div class="so-tip-wrapper">
79
  <strong><?php _e( 'Pro Tip', 'siteorigin-panels' ) ?>: </strong>
80
- <a href="#siteorigin-learn-page-builder-tips" class="so-lesson-modal">
81
- <?php _e( '12 tips every Page Builder user should know.', 'siteorigin-panels' ) ?>
82
- </a>
83
  </div>
84
  <?php endif; ?>
85
  </div>
@@ -115,8 +112,8 @@ $layouts = apply_filters( 'siteorigin_panels_prebuilt_layouts', array() );
115
 
116
  ?>
117
  <div data-color-label="<?php echo esc_attr( $i ); ?>"
118
- class="<?php echo esc_attr( implode( ' ', $classes ) ) ?>{{% if( rowColorLabel == '<?php echo esc_attr( $i ); ?>' ) print(' so-row-color-selected'); %}}"
119
- ></div>
120
  <?php
121
  }
122
  ?>
@@ -389,7 +386,9 @@ $layouts = apply_filters( 'siteorigin_panels_prebuilt_layouts', array() );
389
 
390
  <ul class="so-sidebar-tabs">
391
  <?php if( !empty( $layouts ) ) : ?>
392
- <li><a href="#prebuilt"><?php _e('Theme Defined', 'siteorigin-panels') ?></a></li>
 
 
393
  <?php endif; ?>
394
 
395
  <?php
63
  <div class="so-panels-welcome-message">
64
  <div class="so-message-wrapper">
65
  <?php
66
+ printf(
67
+ __( 'Add a %s, %s or %s to get started. Read our %s if you need help.', 'siteorigin-panels' ),
68
+ "<a href='#' class='so-tool-button so-widget-add'>" . __( 'Widget', 'siteorigin-panels' ) . "</a>",
69
+ "<a href='#' class='so-tool-button so-row-add'>" . __( 'Row', 'siteorigin-panels' ) . "</a>",
70
+ "<a href='#' class='so-tool-button so-prebuilt-add'>" . __( 'Prebuilt Layout', 'siteorigin-panels' ) . "</a>",
71
+ "<a href='https://siteorigin.com/page-builder/documentation/' target='_blank' rel='noopener noreferrer'>" . __( 'documentation', 'siteorigin-panels' ) . "</a>"
72
+ );
 
73
  ?>
74
  </div>
75
 
76
+ <?php if( SiteOrigin_Panels::display_premium_teaser() ) : ?>
77
  <div class="so-tip-wrapper">
78
  <strong><?php _e( 'Pro Tip', 'siteorigin-panels' ) ?>: </strong>
79
+ <?php SiteOrigin_Panels_Admin::display_footer_premium_link() ?>
 
 
80
  </div>
81
  <?php endif; ?>
82
  </div>
112
 
113
  ?>
114
  <div data-color-label="<?php echo esc_attr( $i ); ?>"
115
+ class="<?php echo esc_attr( implode( ' ', $classes ) ) ?>{{% if( rowColorLabel == '<?php echo esc_attr( $i ); ?>' ) print(' so-row-color-selected'); %}}"
116
+ ></div>
117
  <?php
118
  }
119
  ?>
386
 
387
  <ul class="so-sidebar-tabs">
388
  <?php if( !empty( $layouts ) ) : ?>
389
+ <li>
390
+ <a href="#prebuilt"><?php _e('Prebuilt Layouts', 'siteorigin-panels') ?></a>
391
+ </li>
392
  <?php endif; ?>
393
 
394
  <?php