Version Description
Download this release
Release Info
Developer | imtiazrayhan |
Plugin | WP Table Builder – WordPress Table Plugin |
Version | 1.2.3 |
Comparing to | |
See all releases |
Code changes from version 1.2.2 to 1.2.3
- inc/admin/base/controls-stack.php +53 -17
- inc/admin/class-admin-menu.php +26 -7
- inc/admin/class-wptb-listing.php +65 -32
- inc/admin/controls/control-button.php +6 -1
- inc/admin/controls/control-button2.php +109 -0
- inc/admin/controls/control-data-mule.php +54 -0
- inc/admin/controls/control-html-output.php +1 -1
- inc/admin/controls/control-size.php +6 -6
- inc/admin/controls/control-toggle.php +8 -3
- inc/admin/css/admin.css +478 -14
- inc/admin/element-classes/elements/button-element.php +2 -2
- inc/admin/element-classes/elements/list-element.php +30 -0
- inc/admin/js/WPTB_BuilderControls.js +73 -3
- inc/admin/js/WPTB_ResponsiveFrontend.js +1123 -0
- inc/admin/js/admin.js +897 -717
- inc/admin/js/admin.js.map +1 -1
inc/admin/base/controls-stack.php
CHANGED
@@ -20,6 +20,13 @@ if ( ! defined( 'WPINC' ) ) {
|
|
20 |
* @abstract
|
21 |
*/
|
22 |
abstract class Controls_Stack extends Base_Object {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
/**
|
25 |
* Get stack.
|
@@ -65,24 +72,53 @@ abstract class Controls_Stack extends Base_Object {
|
|
65 |
$this->_register_controls();
|
66 |
do_action( 'wp-table-builder/register_controls/' . $this->get_name(), $this );
|
67 |
}
|
68 |
-
|
69 |
/**
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
|
85 |
-
public function add_control( $id, array $args ) {
|
86 |
-
|
|
|
|
|
|
|
|
|
87 |
}
|
88 |
}
|
20 |
* @abstract
|
21 |
*/
|
22 |
abstract class Controls_Stack extends Base_Object {
|
23 |
+
|
24 |
+
protected $defaultControlArgs = [
|
25 |
+
'elementOptionsContainerOn' => 'true',
|
26 |
+
'elementOptionContainerOn' => 'true',
|
27 |
+
'elementOptionsGroupId' => 'element-options-group',
|
28 |
+
'elementOptionClass' => 'wptb-element-option'
|
29 |
+
];
|
30 |
|
31 |
/**
|
32 |
* Get stack.
|
72 |
$this->_register_controls();
|
73 |
do_action( 'wp-table-builder/register_controls/' . $this->get_name(), $this );
|
74 |
}
|
75 |
+
|
76 |
/**
|
77 |
+
* Return default control args
|
78 |
+
* @since 1.1.2
|
79 |
+
* @access public
|
80 |
+
*
|
81 |
+
* @return array
|
82 |
+
*/
|
83 |
+
public function getDefaultControlArgs() {
|
84 |
+
return $this->defaultControlArgs;
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Change default control args
|
89 |
+
*
|
90 |
+
* @param $name
|
91 |
+
* @param $value
|
92 |
+
* @since 1.1.2
|
93 |
+
* @access public
|
94 |
+
*
|
95 |
+
*/
|
96 |
+
public function setDefaultControlArg( $name, $value ) {
|
97 |
+
$this->defaultControlArgs[$name] = $value;
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Add new control to stack.
|
102 |
+
*
|
103 |
+
* Register a single control to allow the user to set/update data.
|
104 |
+
*
|
105 |
+
* This method should be used inside `_register_controls()`.
|
106 |
+
*
|
107 |
+
* @param string $id Control ID.
|
108 |
+
* @param array $args Control arguments.
|
109 |
+
*
|
110 |
+
* @param int $control_pos
|
111 |
+
* @return bool True if control added, False otherwise.
|
112 |
+
* @since 1.1.2
|
113 |
+
* @access public
|
114 |
+
*
|
115 |
+
*/
|
116 |
|
117 |
+
public function add_control( $id, array $args, $control_pos = 0 ) {
|
118 |
+
$defaultControlArgs = $this->getDefaultControlArgs();
|
119 |
+
if( $defaultControlArgs && is_array( $defaultControlArgs ) ) {
|
120 |
+
$args = array_merge( $defaultControlArgs, $args );
|
121 |
+
}
|
122 |
+
return Init::instance()->controls_manager->add_control_to_stack( $this, $id, $args, $control_pos );
|
123 |
}
|
124 |
}
|
inc/admin/class-admin-menu.php
CHANGED
@@ -28,6 +28,13 @@ class Admin_Menu {
|
|
28 |
*/
|
29 |
public function __construct() {
|
30 |
// Let's make some menus.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
add_action( 'admin_menu', array( $this, 'register_menus' ), 9 );
|
32 |
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
33 |
add_action( 'wp_ajax_create_table', array( $this, 'create_table' ) );
|
@@ -183,6 +190,14 @@ class Admin_Menu {
|
|
183 |
|
184 |
add_action( 'load-' . $builder_page, [ $this, 'load_assets' ] );
|
185 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
186 |
do_action( 'wptb_admin_menu', $this );
|
187 |
|
188 |
}
|
@@ -383,14 +398,18 @@ class Admin_Menu {
|
|
383 |
</a>
|
384 |
</span>
|
385 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
386 |
</div>
|
387 |
-
|
388 |
-
<?php
|
389 |
-
$table_list->prepare_items();
|
390 |
-
?>
|
391 |
-
<form method="post"><?php
|
392 |
-
$table_list->display(); ?>
|
393 |
-
</form><?php
|
394 |
}
|
395 |
|
396 |
/**
|
28 |
*/
|
29 |
public function __construct() {
|
30 |
// Let's make some menus.
|
31 |
+
add_filter( 'set_screen_option_'.'tables_per_page', function( $status, $option, $value ){
|
32 |
+
return (int) $value;
|
33 |
+
}, 10, 3 );
|
34 |
+
|
35 |
+
add_filter( 'set-screen-option', function( $status, $option, $value ){
|
36 |
+
return ( $option == 'tables_per_page' ) ? (int) $value : $status;
|
37 |
+
}, 10, 3 );
|
38 |
add_action( 'admin_menu', array( $this, 'register_menus' ), 9 );
|
39 |
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
40 |
add_action( 'wp_ajax_create_table', array( $this, 'create_table' ) );
|
190 |
|
191 |
add_action( 'load-' . $builder_page, [ $this, 'load_assets' ] );
|
192 |
|
193 |
+
add_action( 'load-' . $tables_overview, function () {
|
194 |
+
add_screen_option( 'per_page', array(
|
195 |
+
'label' => 'Number of items per page:',
|
196 |
+
'default' => 15,
|
197 |
+
'option' => 'tables_per_page', // название опции, будет записано в метаполе юзера
|
198 |
+
) );
|
199 |
+
} );
|
200 |
+
|
201 |
do_action( 'wptb_admin_menu', $this );
|
202 |
|
203 |
}
|
398 |
</a>
|
399 |
</span>
|
400 |
</div>
|
401 |
+
<?php
|
402 |
+
$table_list->prepare_items();
|
403 |
+
$table_list->views();
|
404 |
+
?>
|
405 |
+
<form method="get">
|
406 |
+
<input type="hidden" name="page" value="<?php echo $_REQUEST['page'] ?>" />
|
407 |
+
<?php
|
408 |
+
$table_list->search_box( 'Search Tables', 'search_tables' );
|
409 |
+
$table_list->display(); ?>
|
410 |
+
</form>
|
411 |
</div>
|
412 |
+
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
413 |
}
|
414 |
|
415 |
/**
|
inc/admin/class-wptb-listing.php
CHANGED
@@ -22,16 +22,28 @@ class WPTB_Listing extends \WP_List_Table{
|
|
22 |
parent::__construct( [
|
23 |
'singular' => __( 'WPTB Table', 'wp-table-builder' ),
|
24 |
'plural' => __( 'WPTB Tables', 'wp-table-builder' ),
|
25 |
-
'ajax' => false
|
26 |
] );
|
27 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
-
public static function get_tables( $per_page = 5, $page_number = 1 ) {
|
30 |
|
31 |
global $wpdb, $post;
|
32 |
|
33 |
$params = array( 'post_type' => 'wptb-tables', 'posts_per_page' => $per_page, 'paged' => $page_number );
|
34 |
|
|
|
|
|
35 |
$params['orderby'] = isset( $_REQUEST['orderby'] ) && ! empty( sanitize_text_field( $_REQUEST['orderby'] ) ) ? sanitize_text_field( $_REQUEST['orderby'] ) : 'date';
|
36 |
$params['order'] = isset( $_REQUEST['order'] ) && ! empty( sanitize_text_field( $_REQUEST['order'] ) ) ? sanitize_text_field( $_REQUEST['order'] ) : 'DESC';
|
37 |
|
@@ -87,14 +99,16 @@ class WPTB_Listing extends \WP_List_Table{
|
|
87 |
[ 'ID' => $id ],
|
88 |
[ '%d' ]
|
89 |
);
|
90 |
-
|
91 |
}
|
92 |
|
93 |
-
public static function record_count( $per_page ) {
|
94 |
|
95 |
global $wpdb, $post;
|
96 |
|
97 |
$params = array( 'post_type' => 'wptb-tables', 'posts_per_page' => $per_page );
|
|
|
|
|
|
|
98 |
$params['orderby'] = isset( $_REQUEST['orderby'] ) && ! empty( sanitize_text_field( $_REQUEST['orderby'] ) ) ? sanitize_text_field( $_REQUEST['orderby'] ) : 'date';
|
99 |
$params['order'] = isset( $_REQUEST['order'] ) && ! empty( sanitize_text_field( $_REQUEST['order'] ) ) ? sanitize_text_field( $_REQUEST['order'] ) : 'DESC';
|
100 |
|
@@ -149,12 +163,18 @@ class WPTB_Listing extends \WP_List_Table{
|
|
149 |
),
|
150 |
home_url()
|
151 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
|
153 |
$actions = [
|
154 |
'edit' => sprintf( '<a href="?page=wptb-builder&table=%d">Edit</a>', absint( $item->ID ) ),
|
155 |
-
'duplicate' =>
|
156 |
'preview_' => sprintf( '<a href="%s" target="_blank">Preview</a>', $wptb_preview_button_url ),
|
157 |
-
'delete' =>
|
158 |
];
|
159 |
|
160 |
return $title . $this->row_actions( $actions );
|
@@ -229,36 +249,45 @@ class WPTB_Listing extends \WP_List_Table{
|
|
229 |
|
230 |
$per_page = $this->get_items_per_page( 'tables_per_page', 10 );
|
231 |
$current_page = $this->get_pagenum();
|
232 |
-
|
|
|
|
|
|
|
|
|
|
|
233 |
|
234 |
$this->set_pagination_args( [
|
235 |
'total_items' => $total_items, //WE have to calculate the total number of items
|
236 |
'per_page' => $per_page //WE have to determine how many items to show on a page
|
237 |
] );
|
238 |
-
|
239 |
-
$this->items = $this->get_tables( $per_page, $current_page );
|
240 |
-
|
241 |
}
|
242 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
243 |
public function process_bulk_action() {
|
244 |
-
|
245 |
$nonce = isset( $_REQUEST['_wpnonce'] ) && esc_attr( $_REQUEST['_wpnonce'] ) ? esc_attr( $_REQUEST['_wpnonce'] ) : '';
|
246 |
-
|
247 |
-
|
248 |
if ( 'duplicate' === $this->current_action() ) {
|
249 |
|
250 |
if ( ! wp_verify_nonce( $nonce, 'wptb_nonce_table' ) ) {
|
251 |
die( 'Go get a life script kiddies' );
|
252 |
} else {
|
253 |
-
$
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
<script>window.history.pushState( null, null, window.location.href.split('?')[0] + '?page=wptb-overview' );</script>
|
259 |
<?php
|
260 |
}
|
261 |
-
|
262 |
}
|
263 |
|
264 |
if ( 'delete' === $this->current_action() ) {
|
@@ -268,38 +297,42 @@ class WPTB_Listing extends \WP_List_Table{
|
|
268 |
} else {
|
269 |
$this->delete_table( absint( $_GET['table_id'] ) );
|
270 |
?>
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
<script>window.history.pushState( null, null, window.location.href.split('?')[0] + '?page=wptb-overview' );</script>
|
275 |
<?php
|
276 |
}
|
277 |
|
278 |
}
|
279 |
|
280 |
// If the delete bulk action is triggered
|
281 |
-
if ( ( isset( $
|
282 |
-
( isset( $
|
283 |
-
|
284 |
if( ! wp_verify_nonce( $nonce, 'bulk-' . $this->_args['plural'] ) ){
|
285 |
die( 'Go get a life script kiddies' );
|
286 |
} else {
|
287 |
-
$delete_ids = esc_sql( $
|
288 |
|
289 |
// loop over the array of record IDs and delete them
|
290 |
foreach ( $delete_ids as $id ) {
|
291 |
$this->delete_table( absint( $id ) );
|
292 |
}
|
293 |
-
|
294 |
?>
|
295 |
<div class="notice notice-success is-dismissible">
|
296 |
<p><?php esc_html_e( 'Bulk Delete Performed Successfully.', 'wp-table-builder' ); ?></p>
|
297 |
</div>
|
298 |
-
|
299 |
-
<?php
|
300 |
}
|
301 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
302 |
}
|
303 |
}
|
304 |
|
305 |
-
$table = new WPTB_Listing();
|
22 |
parent::__construct( [
|
23 |
'singular' => __( 'WPTB Table', 'wp-table-builder' ),
|
24 |
'plural' => __( 'WPTB Tables', 'wp-table-builder' ),
|
25 |
+
'ajax' => false
|
26 |
] );
|
27 |
}
|
28 |
+
|
29 |
+
protected function get_views() {
|
30 |
+
$count = self::record_count( 10, '' );
|
31 |
+
$status_links = array(
|
32 |
+
"all" => __( '<a href="' . esc_url( admin_url( 'admin.php?page=wptb-overview' ) ) . '">' .
|
33 |
+
'All ' .
|
34 |
+
'<span class="count">(' . $count . ')</span></a>', 'wp-table-builde' )
|
35 |
+
);
|
36 |
+
return $status_links;
|
37 |
+
}
|
38 |
|
39 |
+
public static function get_tables( $per_page = 5, $page_number = 1, $search_text ) {
|
40 |
|
41 |
global $wpdb, $post;
|
42 |
|
43 |
$params = array( 'post_type' => 'wptb-tables', 'posts_per_page' => $per_page, 'paged' => $page_number );
|
44 |
|
45 |
+
if( $search_text ) $params['s'] = $search_text;
|
46 |
+
|
47 |
$params['orderby'] = isset( $_REQUEST['orderby'] ) && ! empty( sanitize_text_field( $_REQUEST['orderby'] ) ) ? sanitize_text_field( $_REQUEST['orderby'] ) : 'date';
|
48 |
$params['order'] = isset( $_REQUEST['order'] ) && ! empty( sanitize_text_field( $_REQUEST['order'] ) ) ? sanitize_text_field( $_REQUEST['order'] ) : 'DESC';
|
49 |
|
99 |
[ 'ID' => $id ],
|
100 |
[ '%d' ]
|
101 |
);
|
|
|
102 |
}
|
103 |
|
104 |
+
public static function record_count( $per_page, $search_text ) {
|
105 |
|
106 |
global $wpdb, $post;
|
107 |
|
108 |
$params = array( 'post_type' => 'wptb-tables', 'posts_per_page' => $per_page );
|
109 |
+
|
110 |
+
if( $search_text ) $params['s'] = $search_text;
|
111 |
+
|
112 |
$params['orderby'] = isset( $_REQUEST['orderby'] ) && ! empty( sanitize_text_field( $_REQUEST['orderby'] ) ) ? sanitize_text_field( $_REQUEST['orderby'] ) : 'date';
|
113 |
$params['order'] = isset( $_REQUEST['order'] ) && ! empty( sanitize_text_field( $_REQUEST['order'] ) ) ? sanitize_text_field( $_REQUEST['order'] ) : 'DESC';
|
114 |
|
163 |
),
|
164 |
home_url()
|
165 |
);
|
166 |
+
|
167 |
+
$server_request_url = remove_query_arg( '_wp_http_referer', $_SERVER['REQUEST_URI'] );
|
168 |
+
$server_request_url = remove_query_arg( '_wpnonce', $server_request_url );
|
169 |
+
$server_request_url = remove_query_arg( 'action', $server_request_url );
|
170 |
+
$server_request_url = remove_query_arg( 'table_id', $server_request_url );
|
171 |
+
$query = parse_url( $server_request_url, PHP_URL_QUERY );
|
172 |
|
173 |
$actions = [
|
174 |
'edit' => sprintf( '<a href="?page=wptb-builder&table=%d">Edit</a>', absint( $item->ID ) ),
|
175 |
+
'duplicate' => '<a href="?' . $query . sprintf( '&action=%s&table_id=%s&_wpnonce=%s', 'duplicate', absint( $item->ID ), $nonce ) . '">Duplicate</a>',
|
176 |
'preview_' => sprintf( '<a href="%s" target="_blank">Preview</a>', $wptb_preview_button_url ),
|
177 |
+
'delete' => '<a href="?' . $query . sprintf( '&action=%s&table_id=%s&_wpnonce=%s', 'delete', absint( $item->ID ), $nonce ) . '">Delete</a>'
|
178 |
];
|
179 |
|
180 |
return $title . $this->row_actions( $actions );
|
249 |
|
250 |
$per_page = $this->get_items_per_page( 'tables_per_page', 10 );
|
251 |
$current_page = $this->get_pagenum();
|
252 |
+
|
253 |
+
$search_text = '';
|
254 |
+
if( isset( $_REQUEST['s'] ) && ! empty( $_REQUEST['s'] ) ) {
|
255 |
+
$search_text = sanitize_text_field($_REQUEST['s']);
|
256 |
+
}
|
257 |
+
$total_items = self::record_count( $per_page, $search_text );
|
258 |
|
259 |
$this->set_pagination_args( [
|
260 |
'total_items' => $total_items, //WE have to calculate the total number of items
|
261 |
'per_page' => $per_page //WE have to determine how many items to show on a page
|
262 |
] );
|
263 |
+
$this->items = $this->get_tables( $per_page, $current_page, $search_text );
|
|
|
|
|
264 |
}
|
265 |
|
266 |
+
public function request_url_clear() {
|
267 |
+
$_SERVER['REQUEST_URI'] = remove_query_arg( '_wp_http_referer', $_SERVER['REQUEST_URI'] );
|
268 |
+
$_SERVER['REQUEST_URI'] = remove_query_arg( 'action', $_SERVER['REQUEST_URI'] );
|
269 |
+
$_SERVER['REQUEST_URI'] = remove_query_arg( 'action2', $_SERVER['REQUEST_URI'] );
|
270 |
+
$_SERVER['REQUEST_URI'] = remove_query_arg( 'table_id', $_SERVER['REQUEST_URI'] );
|
271 |
+
$_SERVER['REQUEST_URI'] = remove_query_arg( 'bulk-delete', $_SERVER['REQUEST_URI'] );
|
272 |
+
}
|
273 |
+
|
274 |
public function process_bulk_action() {
|
275 |
+
|
276 |
$nonce = isset( $_REQUEST['_wpnonce'] ) && esc_attr( $_REQUEST['_wpnonce'] ) ? esc_attr( $_REQUEST['_wpnonce'] ) : '';
|
277 |
+
|
278 |
+
|
279 |
if ( 'duplicate' === $this->current_action() ) {
|
280 |
|
281 |
if ( ! wp_verify_nonce( $nonce, 'wptb_nonce_table' ) ) {
|
282 |
die( 'Go get a life script kiddies' );
|
283 |
} else {
|
284 |
+
$this->duplicate_table( absint( $_GET['table_id'] ) );
|
285 |
+
?>
|
286 |
+
<div class="notice notice-success is-dismissible">
|
287 |
+
<p><?php esc_html_e( 'Table duplicate successfully.', 'wp-table-builder' ); ?></p>
|
288 |
+
</div>
|
|
|
289 |
<?php
|
290 |
}
|
|
|
291 |
}
|
292 |
|
293 |
if ( 'delete' === $this->current_action() ) {
|
297 |
} else {
|
298 |
$this->delete_table( absint( $_GET['table_id'] ) );
|
299 |
?>
|
300 |
+
<div class="notice notice-success is-dismissible">
|
301 |
+
<p><?php esc_html_e( 'Table deleted successfully.', 'wp-table-builder' ); ?></p>
|
302 |
+
</div>
|
|
|
303 |
<?php
|
304 |
}
|
305 |
|
306 |
}
|
307 |
|
308 |
// If the delete bulk action is triggered
|
309 |
+
if ( ( isset( $_REQUEST['action'] ) && sanitize_text_field( $_REQUEST['action'] ) == 'bulk-delete' ) ||
|
310 |
+
( isset( $_REQUEST['action2'] ) && sanitize_text_field( $_REQUEST['action2'] ) == 'bulk-delete' ) ) {
|
311 |
+
|
312 |
if( ! wp_verify_nonce( $nonce, 'bulk-' . $this->_args['plural'] ) ){
|
313 |
die( 'Go get a life script kiddies' );
|
314 |
} else {
|
315 |
+
$delete_ids = esc_sql( $_REQUEST['bulk-delete'] );
|
316 |
|
317 |
// loop over the array of record IDs and delete them
|
318 |
foreach ( $delete_ids as $id ) {
|
319 |
$this->delete_table( absint( $id ) );
|
320 |
}
|
321 |
+
|
322 |
?>
|
323 |
<div class="notice notice-success is-dismissible">
|
324 |
<p><?php esc_html_e( 'Bulk Delete Performed Successfully.', 'wp-table-builder' ); ?></p>
|
325 |
</div>
|
326 |
+
<?php
|
|
|
327 |
}
|
328 |
}
|
329 |
+
$this->request_url_clear();
|
330 |
+
?>
|
331 |
+
<script>
|
332 |
+
window.history.pushState( null, null, "<?php echo home_url() . $_SERVER['REQUEST_URI']; ?>" );
|
333 |
+
</script>
|
334 |
+
<?php
|
335 |
}
|
336 |
}
|
337 |
|
338 |
+
$table = new WPTB_Listing();
|
inc/admin/controls/control-button.php
CHANGED
@@ -50,11 +50,16 @@ class Control_Button extends Base_Control {
|
|
50 |
?>
|
51 |
<#
|
52 |
let label,
|
|
|
53 |
elemContainer;
|
54 |
|
55 |
if( data.label ) {
|
56 |
label = data.label;
|
57 |
}
|
|
|
|
|
|
|
|
|
58 |
|
59 |
if( data.elemContainer ) {
|
60 |
elemContainer = data.elemContainer;
|
@@ -65,7 +70,7 @@ class Control_Button extends Base_Control {
|
|
65 |
|
66 |
<div class="wptb-settings-row wptb-settings-middle-xs">
|
67 |
<div class="wptb-settings-col-xs-12" style="margin: auto; text-align: center;">
|
68 |
-
<input type="button" class="wptb-element-property wptb-button {{{targetInputAddClass}}}" data-element="{{{elemContainer}}}" value="{{{label}}}" title="{{{label}}}">
|
69 |
</div>
|
70 |
</div>
|
71 |
|
50 |
?>
|
51 |
<#
|
52 |
let label,
|
53 |
+
style,
|
54 |
elemContainer;
|
55 |
|
56 |
if( data.label ) {
|
57 |
label = data.label;
|
58 |
}
|
59 |
+
|
60 |
+
if(data.style) {
|
61 |
+
style = 'style="' + data.style + '"';
|
62 |
+
}
|
63 |
|
64 |
if( data.elemContainer ) {
|
65 |
elemContainer = data.elemContainer;
|
70 |
|
71 |
<div class="wptb-settings-row wptb-settings-middle-xs">
|
72 |
<div class="wptb-settings-col-xs-12" style="margin: auto; text-align: center;">
|
73 |
+
<input type="button" {{{style}}} class="wptb-element-property wptb-button {{{targetInputAddClass}}}" data-element="{{{elemContainer}}}" value="{{{label}}}" title="{{{label}}}">
|
74 |
</div>
|
75 |
</div>
|
76 |
|
inc/admin/controls/control-button2.php
ADDED
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace WP_Table_Builder\Inc\Admin\Controls;
|
3 |
+
|
4 |
+
// If this file is called directly, abort.
|
5 |
+
if ( ! defined( 'WPINC' ) ) {
|
6 |
+
die;
|
7 |
+
}
|
8 |
+
|
9 |
+
/**
|
10 |
+
* WP Table Builder "Button" control.
|
11 |
+
*
|
12 |
+
* A control class for creating "button" control object
|
13 |
+
*
|
14 |
+
* @since 1.1.2
|
15 |
+
*/
|
16 |
+
class Control_Button2 extends Base_Control {
|
17 |
+
/**
|
18 |
+
* Get "Button" control type.
|
19 |
+
*
|
20 |
+
* @since 1.1.2
|
21 |
+
* @access public
|
22 |
+
*
|
23 |
+
* @return string Control type.
|
24 |
+
*/
|
25 |
+
public function get_type() {
|
26 |
+
return 'button2';
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Enqueue "button" control scripts and styles.
|
31 |
+
*
|
32 |
+
* Used to register and enqueue custom scripts and styles used by the control.
|
33 |
+
*
|
34 |
+
* @since 1.1.2
|
35 |
+
* @access public
|
36 |
+
*/
|
37 |
+
public function enqueue() {
|
38 |
+
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Render "button" control output in the editor.
|
43 |
+
*
|
44 |
+
* Used to generate the control HTML in the editor wp js template
|
45 |
+
*
|
46 |
+
* @since 1.1.2
|
47 |
+
* @access public
|
48 |
+
*/
|
49 |
+
public function content_template() {
|
50 |
+
?>
|
51 |
+
<#
|
52 |
+
let label,
|
53 |
+
style,
|
54 |
+
additionsClasses,
|
55 |
+
id,
|
56 |
+
title,
|
57 |
+
elemContainer,
|
58 |
+
targetInputAddClass = '';
|
59 |
+
|
60 |
+
if( data.label ) {
|
61 |
+
label = data.label;
|
62 |
+
}
|
63 |
+
|
64 |
+
if(data.style) {
|
65 |
+
style = 'style="' + data.style + '"';
|
66 |
+
}
|
67 |
+
|
68 |
+
if(data.additionsClasses) {
|
69 |
+
additionsClasses = data.additionsClasses;
|
70 |
+
}
|
71 |
+
|
72 |
+
if(data.id) {
|
73 |
+
id = 'id="' + data.id + '"';
|
74 |
+
}
|
75 |
+
|
76 |
+
if(data.title) {
|
77 |
+
title = 'title="' + data.title + '"';
|
78 |
+
}
|
79 |
+
|
80 |
+
if( data.elemContainer ) {
|
81 |
+
elemContainer = data.elemContainer;
|
82 |
+
}
|
83 |
+
|
84 |
+
targetInputAddClass = data.elementControlTargetUnicClass;
|
85 |
+
#>
|
86 |
+
<button {{{style}}} class="wptb-element-property {{{additionsClasses}}} {{{targetInputAddClass}}}" data-element="{{{elemContainer}}}" {{{id}}}
|
87 |
+
{{{title}}}>{{{label}}}</button>
|
88 |
+
|
89 |
+
<wptb-template-script>
|
90 |
+
( function() {
|
91 |
+
let targetButtons = document.getElementsByClassName( '{{{targetInputAddClass}}}' );
|
92 |
+
if( targetButtons.length > 0 ) {
|
93 |
+
targetButton = targetButtons[0];
|
94 |
+
let dataSelectorElement = targetButton.dataset.element;
|
95 |
+
if( dataSelectorElement ) {
|
96 |
+
let selectorElement = document.querySelector( '.' + dataSelectorElement );
|
97 |
+
if( selectorElement ) {
|
98 |
+
targetButton.onclick = function( event ) {
|
99 |
+
WPTB_Helper.wptbDocumentEventGenerate( 'wptb-control:{{{targetInputAddClass}}}', selectorElement );
|
100 |
+
};
|
101 |
+
}
|
102 |
+
}
|
103 |
+
}
|
104 |
+
} )();
|
105 |
+
</wptb-template-script>
|
106 |
+
|
107 |
+
<?php
|
108 |
+
}
|
109 |
+
}
|
inc/admin/controls/control-data-mule.php
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WP_Table_Builder\Inc\Admin\Controls;
|
4 |
+
|
5 |
+
// if called directly, abort
|
6 |
+
if ( ! defined( 'WPINC' ) ) {
|
7 |
+
die;
|
8 |
+
}
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Class Control_Data_Mule
|
12 |
+
*
|
13 |
+
* Data mule to carry backend data to front end
|
14 |
+
*
|
15 |
+
* Accepted options
|
16 |
+
* dataId => id for data
|
17 |
+
* dataObj => main data object
|
18 |
+
*
|
19 |
+
* @package WP_Table_Builder\Inc\Admin\Controls
|
20 |
+
*/
|
21 |
+
class Control_Data_Mule extends Base_Control {
|
22 |
+
/**
|
23 |
+
* Get control type.
|
24 |
+
*
|
25 |
+
* Return the control type.
|
26 |
+
*
|
27 |
+
* @since 1.1.2
|
28 |
+
* @access public
|
29 |
+
*/
|
30 |
+
public function get_type() {
|
31 |
+
return 'data_mule';
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Control content template.
|
36 |
+
*
|
37 |
+
* Used to generate the control HTML in the editor using wp js template
|
38 |
+
*
|
39 |
+
* @since 1.1.2
|
40 |
+
* @access public
|
41 |
+
*/
|
42 |
+
public function content_template() {
|
43 |
+
?>
|
44 |
+
<#
|
45 |
+
const dataId = data.dataId;
|
46 |
+
const dataObj = data.dataObj;
|
47 |
+
|
48 |
+
WPTB_ControlsManager.setControlData(dataId , dataObj);
|
49 |
+
#>
|
50 |
+
<div style="display: none">
|
51 |
+
</div>
|
52 |
+
<?php
|
53 |
+
}
|
54 |
+
}
|
inc/admin/controls/control-html-output.php
CHANGED
@@ -45,7 +45,7 @@ class Control_Html_Output extends Base_Control {
|
|
45 |
<#
|
46 |
const {html} = data;
|
47 |
#>
|
48 |
-
<div class="wptb-settings-row wptb-
|
49 |
{{{html}}}
|
50 |
</div>
|
51 |
<?php
|
45 |
<#
|
46 |
const {html} = data;
|
47 |
#>
|
48 |
+
<div class="wptb-settings-row wptb-html-control-wrapper">
|
49 |
{{{html}}}
|
50 |
</div>
|
51 |
<?php
|
inc/admin/controls/control-size.php
CHANGED
@@ -84,15 +84,15 @@ class Control_Size extends Base_Control {
|
|
84 |
} else {
|
85 |
max = 100;
|
86 |
}
|
87 |
-
if(
|
88 |
-
min = data.min;
|
89 |
-
} else {
|
90 |
min = 10;
|
91 |
-
}
|
92 |
-
if( data.defaultValue ) {
|
93 |
-
defaultValue = data.defaultValue;
|
94 |
} else {
|
|
|
|
|
|
|
95 |
defaultValue = 15;
|
|
|
|
|
96 |
}
|
97 |
if( data.dimension ) {
|
98 |
dimension = data.dimension;
|
84 |
} else {
|
85 |
max = 100;
|
86 |
}
|
87 |
+
if(isNaN(data.min)) {
|
|
|
|
|
88 |
min = 10;
|
|
|
|
|
|
|
89 |
} else {
|
90 |
+
min = data.min;
|
91 |
+
}
|
92 |
+
if( isNaN(data.defaultValue )) {
|
93 |
defaultValue = 15;
|
94 |
+
} else {
|
95 |
+
defaultValue = data.defaultValue;
|
96 |
}
|
97 |
if( data.dimension ) {
|
98 |
dimension = data.dimension;
|
inc/admin/controls/control-toggle.php
CHANGED
@@ -54,7 +54,8 @@ class Control_Toggle extends Base_Control {
|
|
54 |
selectors = [],
|
55 |
elemContainer,
|
56 |
selectorsJson,
|
57 |
-
targetInputAddClass
|
|
|
58 |
|
59 |
if( data.label ) {
|
60 |
label = data.label;
|
@@ -75,6 +76,10 @@ class Control_Toggle extends Base_Control {
|
|
75 |
if( data.elemContainer ) {
|
76 |
elemContainer = data.elemContainer;
|
77 |
}
|
|
|
|
|
|
|
|
|
78 |
|
79 |
targetInputAddClass = data.elementControlTargetUnicClass;
|
80 |
#>
|
@@ -237,7 +242,7 @@ class Control_Toggle extends Base_Control {
|
|
237 |
if( '{{{selectorsJson}}}' ) {
|
238 |
let selectors = JSON.parse( '{{{selectorsJson}}}' );
|
239 |
|
240 |
-
targetInput.checked = getSetElementValue( selectors );
|
241 |
}
|
242 |
|
243 |
targetInput.onchange = function( event ) {
|
@@ -249,12 +254,12 @@ class Control_Toggle extends Base_Control {
|
|
249 |
details = {value: 'unchecked'};
|
250 |
}
|
251 |
|
252 |
-
WPTB_Helper.wptbDocumentEventGenerate( 'wptb-control:{{{targetInputAddClass}}}', selectorElement, details );
|
253 |
if( '{{{selectorsJson}}}' ) {
|
254 |
let selectors = JSON.parse( '{{{selectorsJson}}}' );
|
255 |
|
256 |
getSetElementValue( selectors, details.value );
|
257 |
}
|
|
|
258 |
|
259 |
let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
|
260 |
wptbTableStateSaveManager.tableStateSet();
|
54 |
selectors = [],
|
55 |
elemContainer,
|
56 |
selectorsJson,
|
57 |
+
targetInputAddClass,
|
58 |
+
checked = false;
|
59 |
|
60 |
if( data.label ) {
|
61 |
label = data.label;
|
76 |
if( data.elemContainer ) {
|
77 |
elemContainer = data.elemContainer;
|
78 |
}
|
79 |
+
|
80 |
+
if( data.checked ) {
|
81 |
+
checked = true
|
82 |
+
}
|
83 |
|
84 |
targetInputAddClass = data.elementControlTargetUnicClass;
|
85 |
#>
|
242 |
if( '{{{selectorsJson}}}' ) {
|
243 |
let selectors = JSON.parse( '{{{selectorsJson}}}' );
|
244 |
|
245 |
+
targetInput.checked = getSetElementValue( selectors ) || {{{checked}}};
|
246 |
}
|
247 |
|
248 |
targetInput.onchange = function( event ) {
|
254 |
details = {value: 'unchecked'};
|
255 |
}
|
256 |
|
|
|
257 |
if( '{{{selectorsJson}}}' ) {
|
258 |
let selectors = JSON.parse( '{{{selectorsJson}}}' );
|
259 |
|
260 |
getSetElementValue( selectors, details.value );
|
261 |
}
|
262 |
+
WPTB_Helper.wptbDocumentEventGenerate( 'wptb-control:{{{targetInputAddClass}}}', selectorElement, details );
|
263 |
|
264 |
let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
|
265 |
wptbTableStateSaveManager.tableStateSet();
|
inc/admin/css/admin.css
CHANGED
@@ -23,6 +23,9 @@
|
|
23 |
--wptb-plugin-theme-side-bar-font-size-base: 16px;
|
24 |
--wptb-plugin-theme-header-font-size-base: 16px;
|
25 |
--wptb-plugin-theme-side-bar-sections-font-base: 80%;
|
|
|
|
|
|
|
26 |
}
|
27 |
|
28 |
html {
|
@@ -117,6 +120,10 @@ body > img {
|
|
117 |
margin: 0 !important;
|
118 |
}
|
119 |
|
|
|
|
|
|
|
|
|
120 |
.wptb-plugin-height-full {
|
121 |
height: 100%;
|
122 |
}
|
@@ -456,7 +463,15 @@ body > img {
|
|
456 |
}
|
457 |
|
458 |
.collapsed .wptb-left-panel {
|
459 |
-
transform: translateX(-100%);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
460 |
}
|
461 |
|
462 |
.wptb-left-scroll-panel {
|
@@ -497,7 +512,13 @@ body > img {
|
|
497 |
grid-template-columns: 1fr;
|
498 |
grid-auto-flow: row;
|
499 |
transition: width .2s ease-out;
|
500 |
-
grid-template-areas: "brand" "sidebar-tabs" "sidebar-content";
|
|
|
|
|
|
|
|
|
|
|
|
|
501 |
}
|
502 |
|
503 |
.wptb-panel-drawer-toggle {
|
@@ -529,13 +550,13 @@ body > img {
|
|
529 |
background-color: var(--wptb-plugin-logo-color);
|
530 |
color: var(--wptb-plugin-white);
|
531 |
padding: 25px 0;
|
532 |
-
/*font-size: 1.7rem;*/
|
533 |
font-size: 170%;
|
534 |
display: grid;
|
535 |
grid-template-columns: 1fr;
|
536 |
grid-template-rows: 1fr;
|
537 |
grid-template-areas: "brand-position";
|
538 |
text-align: center;
|
|
|
539 |
}
|
540 |
|
541 |
.wptb-brand-name {
|
@@ -551,6 +572,7 @@ body > img {
|
|
551 |
grid-area: sidebar-tabs;
|
552 |
text-align: center;
|
553 |
justify-content: stretch;
|
|
|
554 |
}
|
555 |
|
556 |
.wptb-panel-tabs div {
|
@@ -994,13 +1016,19 @@ input[type="range"]::-ms-thumb {
|
|
994 |
|
995 |
#element-options-group {
|
996 |
grid-area: sidebar-content;
|
|
|
997 |
}
|
998 |
|
999 |
.wptb-settings-section {
|
1000 |
grid-area: sidebar-content;
|
1001 |
}
|
1002 |
|
|
|
|
|
|
|
|
|
1003 |
[data-wptb-section] {
|
|
|
1004 |
animation: wptb-basic-appear 0.2s ease-out;
|
1005 |
}
|
1006 |
|
@@ -1259,8 +1287,8 @@ ul.wptb-tabs {
|
|
1259 |
}
|
1260 |
|
1261 |
.collapsed .wptb-builder-panel {
|
1262 |
-
left:
|
1263 |
-
width: 100
|
1264 |
}
|
1265 |
|
1266 |
/**
|
@@ -1334,8 +1362,7 @@ ul.wptb-tabs {
|
|
1334 |
margin-top: 30px;
|
1335 |
margin-bottom: 30px;
|
1336 |
max-width: 700px;
|
1337 |
-
overflow
|
1338 |
-
overflow-y: hidden;
|
1339 |
}
|
1340 |
|
1341 |
#wptb-cell_mode_background {
|
@@ -1907,6 +1934,7 @@ br[data-mce-bogus="1"] {
|
|
1907 |
.wptb-droppable.wptb-cell li .wptb-list-item-content p {
|
1908 |
word-wrap: break-word;
|
1909 |
line-height: 30px;
|
|
|
1910 |
}
|
1911 |
|
1912 |
.wptb-list-container ul li > div > p::before {
|
@@ -1914,7 +1942,7 @@ br[data-mce-bogus="1"] {
|
|
1914 |
display: inline-block;
|
1915 |
line-height: 30px;
|
1916 |
padding: 0 5px 0 0;
|
1917 |
-
font-size: 15px;
|
1918 |
font-family: verdana, sans-serif;
|
1919 |
cursor: text;
|
1920 |
}
|
@@ -3382,6 +3410,18 @@ wptb_shortcode_container_element {
|
|
3382 |
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
3383 |
}
|
3384 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3385 |
.wptb-plugin-margin-no {
|
3386 |
margin: 0 !important;
|
3387 |
}
|
@@ -3516,19 +3556,443 @@ wptb_shortcode_container_element {
|
|
3516 |
cursor: pointer;
|
3517 |
}
|
3518 |
|
3519 |
-
.wptb-
|
3520 |
display: flex;
|
3521 |
flex-direction: column;
|
3522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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3533 |
}
|
3534 |
|
23 |
--wptb-plugin-theme-side-bar-font-size-base: 16px;
|
24 |
--wptb-plugin-theme-header-font-size-base: 16px;
|
25 |
--wptb-plugin-theme-side-bar-sections-font-base: 80%;
|
26 |
+
|
27 |
+
|
28 |
+
--wptb-plugin-left-panel-constant: 40px
|
29 |
}
|
30 |
|
31 |
html {
|
120 |
margin: 0 !important;
|
121 |
}
|
122 |
|
123 |
+
.wptb-plugin-width-full {
|
124 |
+
width: 100%;
|
125 |
+
}
|
126 |
+
|
127 |
.wptb-plugin-height-full {
|
128 |
height: 100%;
|
129 |
}
|
463 |
}
|
464 |
|
465 |
.collapsed .wptb-left-panel {
|
466 |
+
transform: translateX(calc(-100% + var(--wptb-plugin-left-panel-constant)));
|
467 |
+
}
|
468 |
+
|
469 |
+
.collapsed .wptb-left-panel .wptb-left-panel-sidebar-content {
|
470 |
+
opacity: 0;
|
471 |
+
}
|
472 |
+
|
473 |
+
.collapsed .wptb-left-panel .wptb-panel-tabs {
|
474 |
+
opacity: 0;
|
475 |
}
|
476 |
|
477 |
.wptb-left-scroll-panel {
|
512 |
grid-template-columns: 1fr;
|
513 |
grid-auto-flow: row;
|
514 |
transition: width .2s ease-out;
|
515 |
+
grid-template-areas: "brand" "sidebar-tabs" "sidebar-content" "sidebar-footer";
|
516 |
+
}
|
517 |
+
|
518 |
+
.wptb-left-panel-sidebar-content {
|
519 |
+
grid-area: sidebar-content;
|
520 |
+
overflow: auto;
|
521 |
+
transition: all 0.2s ease-out;
|
522 |
}
|
523 |
|
524 |
.wptb-panel-drawer-toggle {
|
550 |
background-color: var(--wptb-plugin-logo-color);
|
551 |
color: var(--wptb-plugin-white);
|
552 |
padding: 25px 0;
|
|
|
553 |
font-size: 170%;
|
554 |
display: grid;
|
555 |
grid-template-columns: 1fr;
|
556 |
grid-template-rows: 1fr;
|
557 |
grid-template-areas: "brand-position";
|
558 |
text-align: center;
|
559 |
+
height: 61px;
|
560 |
}
|
561 |
|
562 |
.wptb-brand-name {
|
572 |
grid-area: sidebar-tabs;
|
573 |
text-align: center;
|
574 |
justify-content: stretch;
|
575 |
+
transition: all 0.2s ease-out;
|
576 |
}
|
577 |
|
578 |
.wptb-panel-tabs div {
|
1016 |
|
1017 |
#element-options-group {
|
1018 |
grid-area: sidebar-content;
|
1019 |
+
padding-top: 20px;
|
1020 |
}
|
1021 |
|
1022 |
.wptb-settings-section {
|
1023 |
grid-area: sidebar-content;
|
1024 |
}
|
1025 |
|
1026 |
+
.wptb-responsive-section {
|
1027 |
+
grid-area: sidebar-content;
|
1028 |
+
}
|
1029 |
+
|
1030 |
[data-wptb-section] {
|
1031 |
+
padding-top: 20px;
|
1032 |
animation: wptb-basic-appear 0.2s ease-out;
|
1033 |
}
|
1034 |
|
1287 |
}
|
1288 |
|
1289 |
.collapsed .wptb-builder-panel {
|
1290 |
+
left: calc(0px + var(--wptb-plugin-left-panel-constant));
|
1291 |
+
width: calc(100% - var(--wptb-plugin-left-panel-constant));
|
1292 |
}
|
1293 |
|
1294 |
/**
|
1362 |
margin-top: 30px;
|
1363 |
margin-bottom: 30px;
|
1364 |
max-width: 700px;
|
1365 |
+
overflow: visible;
|
|
|
1366 |
}
|
1367 |
|
1368 |
#wptb-cell_mode_background {
|
1934 |
.wptb-droppable.wptb-cell li .wptb-list-item-content p {
|
1935 |
word-wrap: break-word;
|
1936 |
line-height: 30px;
|
1937 |
+
font-size: 15px;
|
1938 |
}
|
1939 |
|
1940 |
.wptb-list-container ul li > div > p::before {
|
1942 |
display: inline-block;
|
1943 |
line-height: 30px;
|
1944 |
padding: 0 5px 0 0;
|
1945 |
+
/* font-size: 15px; */
|
1946 |
font-family: verdana, sans-serif;
|
1947 |
cursor: text;
|
1948 |
}
|
3410 |
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
3411 |
}
|
3412 |
|
3413 |
+
.wptb-plugin-box-shadow-up-md {
|
3414 |
+
box-shadow: 0 -5px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
3415 |
+
}
|
3416 |
+
|
3417 |
+
.wptb-plugin-box-shadow-xl {
|
3418 |
+
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.3) !important;
|
3419 |
+
}
|
3420 |
+
|
3421 |
+
.wptb-plugin-inset-shadow-md {
|
3422 |
+
box-shadow: inset 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
|
3423 |
+
}
|
3424 |
+
|
3425 |
.wptb-plugin-margin-no {
|
3426 |
margin: 0 !important;
|
3427 |
}
|
3556 |
cursor: pointer;
|
3557 |
}
|
3558 |
|
3559 |
+
.wptb-html-control-wrapper {
|
3560 |
display: flex;
|
3561 |
flex-direction: column;
|
3562 |
justify-content: center;
|
3563 |
align-items: center;
|
3564 |
+
/*margin: 20px 0;*/
|
3565 |
}
|
3566 |
|
3567 |
+
.wptb-html-control-wrapper > div {
|
3568 |
+
/*margin: 10px 0;*/
|
3569 |
}
|
3570 |
|
3571 |
+
.wptb-html-control-wrapper div:last-child {
|
3572 |
+
/*margin-bottom: 40px;*/
|
3573 |
+
}
|
3574 |
+
|
3575 |
+
.wptb-builder-responsive {
|
3576 |
+
position: absolute;
|
3577 |
+
top: 0;
|
3578 |
+
left: 0;
|
3579 |
+
width: 100%;
|
3580 |
+
height: 100%;
|
3581 |
+
background-color: #fff;
|
3582 |
+
z-index: 400000;
|
3583 |
+
margin: auto;
|
3584 |
+
padding: 40px 10px;
|
3585 |
+
}
|
3586 |
+
|
3587 |
+
.wptb-responsive-menu-tools {
|
3588 |
+
margin: auto auto 60px auto;
|
3589 |
+
max-width: 700px;
|
3590 |
+
}
|
3591 |
+
|
3592 |
+
.wptb-screen-size-slider-wrapper {
|
3593 |
+
display: grid;
|
3594 |
+
grid-template-columns: 1fr;
|
3595 |
+
grid-template-areas: 'content';
|
3596 |
+
justify-content: center;
|
3597 |
+
align-items: center;
|
3598 |
+
margin-bottom: 80px;
|
3599 |
+
}
|
3600 |
+
|
3601 |
+
.wptb-screen-size-slider-empty {
|
3602 |
+
width: 100%;
|
3603 |
+
position: relative;
|
3604 |
+
height: 5px;
|
3605 |
+
border-radius: 3px;
|
3606 |
+
background-color: #fff;
|
3607 |
+
border: 1px solid var(--wptb-plugin-gray-400);
|
3608 |
+
grid-area: content;
|
3609 |
+
}
|
3610 |
+
|
3611 |
+
.wptb-screen-size-slider-fill {
|
3612 |
+
height: 100%;
|
3613 |
+
position: absolute;
|
3614 |
+
left: 0;
|
3615 |
+
border-radius: 3px;
|
3616 |
+
background-color: var(--wptb-plugin-logo-color);
|
3617 |
+
border: 1px solid transparent;
|
3618 |
+
transition: all 0.1s linear;
|
3619 |
+
}
|
3620 |
+
|
3621 |
+
.wptb-drag-active .wptb-screen-size-slider-fill {
|
3622 |
+
transition: none !important;
|
3623 |
+
}
|
3624 |
+
|
3625 |
+
.wptb-screen-size-slider-arrow {
|
3626 |
+
position: absolute;
|
3627 |
+
top: -30px;
|
3628 |
+
cursor: grab;
|
3629 |
+
transition: all 0.1s linear;
|
3630 |
+
}
|
3631 |
+
|
3632 |
+
.wptb-drag-active .wptb-screen-size-slider-arrow {
|
3633 |
+
transition: none !important;
|
3634 |
+
}
|
3635 |
+
|
3636 |
+
.wptb-screen-size-slider-arrow:active {
|
3637 |
+
cursor: grabbing;
|
3638 |
+
}
|
3639 |
+
|
3640 |
+
.wptb-size-slider-stops-wrapper {
|
3641 |
+
z-index: 900000;
|
3642 |
+
position: absolute;
|
3643 |
+
top: -10px;
|
3644 |
+
}
|
3645 |
+
|
3646 |
+
.wptb-slider-stop {
|
3647 |
+
position: absolute;
|
3648 |
+
display: flex;
|
3649 |
+
width: fit-content;
|
3650 |
+
flex-direction: column;
|
3651 |
+
justify-content: center;
|
3652 |
+
align-items: center;
|
3653 |
+
cursor: pointer;
|
3654 |
+
}
|
3655 |
+
|
3656 |
+
.wptb-slider-stop-knob {
|
3657 |
+
width: 20px;
|
3658 |
+
height: 20px;
|
3659 |
+
background-color: #fff;
|
3660 |
+
border: 2px solid var(--wptb-plugin-logo-color);
|
3661 |
+
border-radius: 50%;
|
3662 |
+
margin-bottom: 5px;
|
3663 |
+
transition: all 0.2s ease-out;
|
3664 |
+
}
|
3665 |
+
|
3666 |
+
.wptb-slider-stop-label {
|
3667 |
+
text-transform: capitalize;
|
3668 |
+
font-size: 90%;
|
3669 |
+
color: var(--wptb-plugin-gray-400);
|
3670 |
+
}
|
3671 |
+
|
3672 |
+
.wptb-slider-stop-active .wptb-slider-stop-knob {
|
3673 |
+
background-color: var(--wptb-plugin-logo-color);
|
3674 |
+
color: inherit !important;
|
3675 |
+
}
|
3676 |
+
|
3677 |
+
.wptb-slider-stop-active .wptb-slider-stop-label {
|
3678 |
+
color: inherit !important;
|
3679 |
+
}
|
3680 |
+
|
3681 |
+
.wptb-size-input-wrapper {
|
3682 |
+
display: flex;
|
3683 |
+
justify-content: center;
|
3684 |
+
align-items: center;
|
3685 |
+
font-size: 90%;
|
3686 |
+
}
|
3687 |
+
|
3688 |
+
.wptb-size-input-wrapper * {
|
3689 |
+
margin: 0 10px;
|
3690 |
+
font-size: inherit !important;
|
3691 |
+
font-variant-numeric: tabular-nums;
|
3692 |
+
}
|
3693 |
+
|
3694 |
+
.wptb-size-input {
|
3695 |
+
width: calc(9ch);
|
3696 |
+
border: 1px solid var(--wptb-plugin-gray-400) !important;
|
3697 |
+
background-color: var(--wptb-plugin-gray-100) !important;
|
3698 |
+
text-align: center;
|
3699 |
+
}
|
3700 |
+
|
3701 |
+
.wptb-responsive-builder-main {
|
3702 |
+
/*display: grid;*/
|
3703 |
+
/*grid-auto-flow: row;*/
|
3704 |
+
/*grid-template-areas: "toolbox" "main";*/
|
3705 |
+
margin-bottom: 20px;
|
3706 |
+
padding: 0 20px;
|
3707 |
+
position: relative;
|
3708 |
+
}
|
3709 |
+
|
3710 |
+
.wptb-responsive-toolbox-wrapper {
|
3711 |
+
display: grid;
|
3712 |
+
align-items: center;
|
3713 |
+
border: 1px solid var(--wptb-plugin-gray-300);
|
3714 |
+
border-radius: 3px;
|
3715 |
+
grid-area: toolbox;
|
3716 |
+
}
|
3717 |
+
|
3718 |
+
.wptb-responsive-toolbox-top-static {
|
3719 |
+
display: grid;
|
3720 |
+
grid-template-columns: repeat(2, 1fr);
|
3721 |
+
grid-auto-rows: 1fr;
|
3722 |
+
align-items: center;
|
3723 |
+
grid-gap: 10px;
|
3724 |
+
}
|
3725 |
+
|
3726 |
+
.wptb-responsive-identify-cells-wrapper {
|
3727 |
+
/*grid-column: 2;*/
|
3728 |
+
}
|
3729 |
+
|
3730 |
+
.wptb-responsive-toolbox-dynamic-wrapper {
|
3731 |
+
display: grid;
|
3732 |
+
grid-template-columns: 1fr;
|
3733 |
+
grid-gap: 10px;
|
3734 |
+
grid-auto-rows: auto;
|
3735 |
+
}
|
3736 |
+
|
3737 |
+
.wptb-responsive-toolbox-wrapper > div {
|
3738 |
+
padding: 10px;
|
3739 |
+
border-bottom: 1px solid var(--wptb-plugin-gray-300);
|
3740 |
+
}
|
3741 |
+
|
3742 |
+
.wptb-responsive-toolbox-row div:nth-child(even) {
|
3743 |
+
justify-self: end;
|
3744 |
+
}
|
3745 |
+
|
3746 |
+
.wptb-responsive-toolbox-wrapper > div:last-child {
|
3747 |
+
border-bottom: none !important;
|
3748 |
+
}
|
3749 |
+
|
3750 |
+
.wptb-responsive-toolbox-dynamic-controls-holder {
|
3751 |
+
display: grid;
|
3752 |
+
grid-template-columns: repeat(2, 1fr);
|
3753 |
+
grid-gap: 5px;
|
3754 |
+
}
|
3755 |
+
|
3756 |
+
.wptb-responsive-toolbox-dynamic-controls-holder > div:nth-child(even) {
|
3757 |
+
justify-self: end;
|
3758 |
+
}
|
3759 |
+
|
3760 |
+
.wptb-responsive-size-range-name {
|
3761 |
+
justify-self: center;
|
3762 |
+
font-weight: bold;
|
3763 |
+
}
|
3764 |
+
|
3765 |
+
.wptb-responsive-clone-wrapper {
|
3766 |
+
width: 100%;
|
3767 |
+
height: 100%;
|
3768 |
+
grid-area: main;
|
3769 |
+
padding: 20px 0;
|
3770 |
+
justify-self: center;
|
3771 |
+
border: 1px solid var(--wptb-plugin-gray-300);
|
3772 |
+
border-top: none !important;
|
3773 |
+
display: flex;
|
3774 |
+
justify-content: center;
|
3775 |
+
align-items: center;
|
3776 |
+
}
|
3777 |
+
|
3778 |
+
.wptb-responsive-clone-inner-wrapper {
|
3779 |
+
display: flex;
|
3780 |
+
justify-content: center;
|
3781 |
+
width: 100%;
|
3782 |
+
}
|
3783 |
+
|
3784 |
+
|
3785 |
+
.wptb-checkerboard-pattern {
|
3786 |
+
background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyIDIiPgogICAgPHJlY3Qgd2lkdGg9IjEiIGhlaWdodD0iMSIgeD0iMCIgeT0iMCIgZmlsbD0icmdiKDIwMywyMTMsMjI0KSIvPgogICAgPHJlY3Qgd2lkdGg9IjEiIGhlaWdodD0iMSIgeD0iMSIgeT0iMCIgZmlsbD0icmdiKDIzNywyNDIsMjQ3KSIvPgogICAgPHJlY3Qgd2lkdGg9IjEiIGhlaWdodD0iMSIgeD0iMSIgeT0iMSIgZmlsbD0icmdiKDIwMywyMTMsMjI0KSIvPgogICAgPHJlY3Qgd2lkdGg9IjEiIGhlaWdodD0iMSIgeD0iMCIgeT0iMSIgZmlsbD0icmdiKDIzNywyNDIsMjQ3KSIvPgo8L3N2Zz4=");
|
3787 |
+
background-repeat: repeat;
|
3788 |
+
background-size: 20px;
|
3789 |
+
}
|
3790 |
+
|
3791 |
+
.wptb-responsive-disabled-table-overlay {
|
3792 |
+
/*grid-area: main;*/
|
3793 |
+
position: absolute;
|
3794 |
+
left: 0;
|
3795 |
+
top: 0;
|
3796 |
+
width: 100%;
|
3797 |
+
height: 100%;
|
3798 |
+
background-image: repeating-linear-gradient(45deg, transparent, transparent 15px, rgba(1, 1, 1, 0.2) 15px, rgba(1, 1, 1, 0.2) 30px);
|
3799 |
+
z-index: 10;
|
3800 |
+
}
|
3801 |
+
|
3802 |
+
.wptb-responsive-wait-overlay {
|
3803 |
+
/*grid-area: main;*/
|
3804 |
+
position: absolute;
|
3805 |
+
top: 0;
|
3806 |
+
left: 0;
|
3807 |
+
width: 100%;
|
3808 |
+
height: 100%;
|
3809 |
+
z-index: 10;
|
3810 |
+
display: flex;
|
3811 |
+
justify-content: center;
|
3812 |
+
align-items: center;
|
3813 |
+
background-color: rgba(0, 0, 0, 0.4);
|
3814 |
+
color: #fff;
|
3815 |
+
text-transform: uppercase;
|
3816 |
+
font-weight: bold;
|
3817 |
+
}
|
3818 |
+
|
3819 |
+
.wptb-responsive-wait-overlay:after {
|
3820 |
+
content: '';
|
3821 |
+
animation: wptb-text-dots 2s infinite;
|
3822 |
+
}
|
3823 |
+
|
3824 |
+
@keyframes wptb-text-dots {
|
3825 |
+
0% {
|
3826 |
+
content: ''
|
3827 |
+
}
|
3828 |
+
33% {
|
3829 |
+
content: '.'
|
3830 |
+
}
|
3831 |
+
66% {
|
3832 |
+
content: '..'
|
3833 |
+
}
|
3834 |
+
100% {
|
3835 |
+
content: '...'
|
3836 |
+
}
|
3837 |
+
}
|
3838 |
+
|
3839 |
+
.wptb-controls-flex-row {
|
3840 |
+
display: flex;
|
3841 |
+
align-items: center;
|
3842 |
+
flex-direction: row;
|
3843 |
+
}
|
3844 |
+
|
3845 |
+
.wptb-controls-flex-row label {
|
3846 |
+
margin: 0 5px;
|
3847 |
+
}
|
3848 |
+
|
3849 |
+
/*checkbox fix for WordPress default style adding margin-top*/
|
3850 |
+
.wptb-responsive-builder-main input[type="checkbox"] {
|
3851 |
+
margin-top: 0 !important;
|
3852 |
+
}
|
3853 |
+
|
3854 |
+
.wptb-responsive-cell-identifier {
|
3855 |
+
position: absolute;
|
3856 |
+
top: 0;
|
3857 |
+
left: 0;
|
3858 |
+
width: 100%;
|
3859 |
+
height: 100%;
|
3860 |
+
display: flex;
|
3861 |
+
justify-content: center;
|
3862 |
+
align-items: center;
|
3863 |
+
font-size: 4rem;
|
3864 |
+
text-shadow: 3px 3px 1px var(--wptb-plugin-gray-300);
|
3865 |
+
opacity: 0;
|
3866 |
+
transition: opacity 0.5s ease-out;
|
3867 |
+
z-index: 9000000;
|
3868 |
+
}
|
3869 |
+
|
3870 |
+
.wptb-responsive-show-cell-identifier .wptb-responsive-cell-identifier {
|
3871 |
+
opacity: 1 !important;
|
3872 |
+
}
|
3873 |
+
|
3874 |
+
.wptb-plugin-modal-window {
|
3875 |
+
position: absolute;
|
3876 |
+
top: 0;
|
3877 |
+
left: 0;
|
3878 |
+
width: 100%;
|
3879 |
+
height: 100%;
|
3880 |
+
background-color: rgba(0, 0, 0, 0.5);
|
3881 |
+
z-index: 300000;
|
3882 |
+
display: flex;
|
3883 |
+
justify-content: center;
|
3884 |
+
align-items: center;
|
3885 |
+
}
|
3886 |
+
|
3887 |
+
.wptb-plugin-modal-inner-window {
|
3888 |
+
max-width: 400px;
|
3889 |
+
background-color: #fff;
|
3890 |
+
padding: 20px;
|
3891 |
+
border-radius: 3px;
|
3892 |
+
display: grid;
|
3893 |
+
grid-template-areas:
|
3894 |
+
"modalIcon message"
|
3895 |
+
"buttonContainer buttonContainer";
|
3896 |
+
grid-gap: 10px;
|
3897 |
+
}
|
3898 |
+
|
3899 |
+
.wptb-plugin-modal-icon {
|
3900 |
+
grid-area: modalIcon;
|
3901 |
+
width: 50px;
|
3902 |
+
height: 100%;
|
3903 |
+
display: flex;
|
3904 |
+
justify-content: center;
|
3905 |
+
align-items: center;
|
3906 |
+
transform: scale(2);
|
3907 |
+
pointer-events: none;
|
3908 |
+
}
|
3909 |
+
|
3910 |
+
.wptb-plugin-modal-message {
|
3911 |
+
grid-area: message;
|
3912 |
+
}
|
3913 |
+
|
3914 |
+
.wptb-plugin-modal-button-container {
|
3915 |
+
margin: 5px 0 0 0;
|
3916 |
+
justify-self: center;
|
3917 |
+
grid-area: buttonContainer;
|
3918 |
+
width: 100%;
|
3919 |
+
}
|
3920 |
+
|
3921 |
+
.wptb-plugin-button-material {
|
3922 |
+
width: fit-content;
|
3923 |
+
padding: 5px;
|
3924 |
+
border-radius: 3px;
|
3925 |
+
background-color: var(--wptb-plugin-logo-color);
|
3926 |
+
color: #fff;
|
3927 |
+
cursor: pointer;
|
3928 |
+
transition: all 0.05s ease-out;
|
3929 |
+
}
|
3930 |
+
|
3931 |
+
.wptb-plugin-button-material:active {
|
3932 |
+
transform: scale(0.95);
|
3933 |
+
}
|
3934 |
+
|
3935 |
+
.wptb-plugin-button-material-fit-content {
|
3936 |
+
width: fit-content !important;
|
3937 |
+
}
|
3938 |
+
|
3939 |
+
.wptb-plugin-button-material-full-size {
|
3940 |
+
width: 100%;
|
3941 |
+
}
|
3942 |
+
|
3943 |
+
.wptb-plugin-responsive-base {
|
3944 |
+
min-width: auto !important;
|
3945 |
+
width: 100% !important;
|
3946 |
+
}
|
3947 |
+
|
3948 |
+
/*visual update for popup components inside responsive menu*/
|
3949 |
+
.wptb-responsive-toolbox-wrapper .wptb-menu-popup-wrapper {
|
3950 |
+
margin-right: 0 !important;
|
3951 |
+
}
|
3952 |
+
|
3953 |
+
.wptb-responsive-breakpoint-edit-wrapper {
|
3954 |
+
display: grid;
|
3955 |
+
grid-template-columns: repeat(2, 1fr);
|
3956 |
+
grid-auto-flow: row;
|
3957 |
+
align-items: center;
|
3958 |
+
}
|
3959 |
+
|
3960 |
+
.wptb-toggle input:disabled + i {
|
3961 |
+
background: var(--wptb-plugin-gray-400);
|
3962 |
+
}
|
3963 |
+
|
3964 |
+
.wptb-control-row {
|
3965 |
+
width: 95%;
|
3966 |
+
}
|
3967 |
+
|
3968 |
+
.wptb-builder-content {
|
3969 |
+
position: relative;
|
3970 |
+
}
|
3971 |
+
|
3972 |
+
.wptb-responsive-builder-toolbox-float {
|
3973 |
+
grid-area: toolbox;
|
3974 |
+
padding: 10px 0;
|
3975 |
+
display: flex;
|
3976 |
+
justify-content: space-between;
|
3977 |
+
}
|
3978 |
+
|
3979 |
+
.wptb-panel-toggle-section {
|
3980 |
+
grid-area: sidebar-footer;
|
3981 |
+
display: flex;
|
3982 |
+
flex-direction: row;
|
3983 |
+
justify-content: flex-end;
|
3984 |
+
align-items: center;
|
3985 |
+
padding: 20px 10px;
|
3986 |
+
background-color: var(--wptb-plugin-logo-color);
|
3987 |
+
color: #fff;
|
3988 |
+
}
|
3989 |
+
|
3990 |
+
.wptb-panel-toggle-section .wptb-panel-drawer-icon {
|
3991 |
+
cursor: pointer;
|
3992 |
+
transform: scale(2);
|
3993 |
+
}
|
3994 |
+
|
3995 |
+
.collapsed .wptb-panel-toggle-section {
|
3996 |
+
opacity: 1 !important;
|
3997 |
}
|
3998 |
|
inc/admin/element-classes/elements/button-element.php
CHANGED
@@ -203,7 +203,7 @@ class Button_Element extends Element_Base {
|
|
203 |
'min' => 1,
|
204 |
'max' => 3,
|
205 |
'step' => 0.1,
|
206 |
-
|
207 |
]
|
208 |
];
|
209 |
|
@@ -255,7 +255,7 @@ class Button_Element extends Element_Base {
|
|
255 |
esc_html__( 'icon', $text_domain ) => $icon_controls,
|
256 |
];
|
257 |
|
258 |
-
Control_Section_Group_Tabbed::add_section( 'buttonElementOptions', 'button options', $button_controls, [
|
259 |
$this,
|
260 |
'add_control'
|
261 |
] );
|
203 |
'min' => 1,
|
204 |
'max' => 3,
|
205 |
'step' => 0.1,
|
206 |
+
'defaultValue' => 1
|
207 |
]
|
208 |
];
|
209 |
|
255 |
esc_html__( 'icon', $text_domain ) => $icon_controls,
|
256 |
];
|
257 |
|
258 |
+
Control_Section_Group_Tabbed::add_section( 'buttonElementOptions', __( 'button options', 'wp-table-builder' ), $button_controls, [
|
259 |
$this,
|
260 |
'add_control'
|
261 |
] );
|
inc/admin/element-classes/elements/list-element.php
CHANGED
@@ -175,6 +175,36 @@ class List_Element extends Element_Base {
|
|
175 |
]
|
176 |
]
|
177 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
|
179 |
$this->add_control(
|
180 |
'listAlignment',
|
175 |
]
|
176 |
]
|
177 |
);
|
178 |
+
|
179 |
+
$this->add_control(
|
180 |
+
'size',
|
181 |
+
[
|
182 |
+
'label' => __( 'Font Size', 'wp_table_builder' ),
|
183 |
+
'type' => Controls_Manager::SIZE,
|
184 |
+
'selectors' => [
|
185 |
+
'{{{data.container}}} ul li p' => 'fontSize',
|
186 |
+
],
|
187 |
+
'min' => 10,
|
188 |
+
'max' => 50,
|
189 |
+
'defaultValue' => 15,
|
190 |
+
'dimension' => 'px'
|
191 |
+
]
|
192 |
+
);
|
193 |
+
|
194 |
+
$this->add_control(
|
195 |
+
'spacing',
|
196 |
+
[
|
197 |
+
'label' => __( 'Item Spacing', 'wp_table_builder' ),
|
198 |
+
'type' => Controls_Manager::SIZE,
|
199 |
+
'selectors' => [
|
200 |
+
'{{{data.container}}} ul li' => 'marginBottom',
|
201 |
+
],
|
202 |
+
'min' => 0,
|
203 |
+
'max' => 30,
|
204 |
+
'defaultValue' => 0,
|
205 |
+
'dimension' => 'px'
|
206 |
+
]
|
207 |
+
);
|
208 |
|
209 |
$this->add_control(
|
210 |
'listAlignment',
|
inc/admin/js/WPTB_BuilderControls.js
CHANGED
@@ -20,7 +20,77 @@ var e=arguments[3];Object.defineProperty(exports,"__esModule",{value:!0}),export
|
|
20 |
(function(){var e=exports.default||module.exports;"function"==typeof e&&(e=e.options),Object.assign(e,{render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("div",{staticClass:"wptb-settings-item-header"},[e._v(e._s(e.label))]),e._v(" "),n("div",{staticClass:"wptb-settings-row wptb-settings-middle-xs"},[n("div",{staticClass:"wptb-settings-col-xs-8"},[n("input",{directives:[{name:"model",rawName:"v-model",value:e.elementMainValue,expression:"elementMainValue"}],staticClass:"wptb-element-property wptb-size-slider",attrs:{type:"range",min:e.min,max:e.max,step:e.step},domProps:{value:e.elementMainValue},on:{__r:function(t){e.elementMainValue=t.target.value}}})]),e._v(" "),n("div",{staticClass:"wptb-settings-col-xs-4"},[n("input",{directives:[{name:"model",rawName:"v-model",value:e.elementMainValue,expression:"elementMainValue"}],staticClass:"wptb-size-number wptb-number-input wptb-element-property",attrs:{type:"number",min:e.min,max:e.max,step:e.step},domProps:{value:e.elementMainValue},on:{input:function(t){t.target.composing||(e.elementMainValue=t.target.value)}}})])])])},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
21 |
},{"../mixins/ControlBase":"LTB1"}],"YVYX":[function(require,module,exports) {
|
22 |
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=o(require("vue")),t=o(require("../containers/RangeControl")),n=o(require("../functions/WPTB_ControlsManager"));function o(e){return e&&e.__esModule?e:{default:e}}var r={name:"ControlRange",handler:function(o){var r=n.default.getControlData(o);new e.default({data:r,components:{RangeControl:t.default}}).$mount("#".concat(o))}};exports.default=r;
|
23 |
-
},{"vue":"HYXJ","../containers/RangeControl":"W4BN","../functions/WPTB_ControlsManager":"WZJa"}],"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
-
"
|
26 |
-
},{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
(function(){var e=exports.default||module.exports;"function"==typeof e&&(e=e.options),Object.assign(e,{render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("div",{staticClass:"wptb-settings-item-header"},[e._v(e._s(e.label))]),e._v(" "),n("div",{staticClass:"wptb-settings-row wptb-settings-middle-xs"},[n("div",{staticClass:"wptb-settings-col-xs-8"},[n("input",{directives:[{name:"model",rawName:"v-model",value:e.elementMainValue,expression:"elementMainValue"}],staticClass:"wptb-element-property wptb-size-slider",attrs:{type:"range",min:e.min,max:e.max,step:e.step},domProps:{value:e.elementMainValue},on:{__r:function(t){e.elementMainValue=t.target.value}}})]),e._v(" "),n("div",{staticClass:"wptb-settings-col-xs-4"},[n("input",{directives:[{name:"model",rawName:"v-model",value:e.elementMainValue,expression:"elementMainValue"}],staticClass:"wptb-size-number wptb-number-input wptb-element-property",attrs:{type:"number",min:e.min,max:e.max,step:e.step},domProps:{value:e.elementMainValue},on:{input:function(t){t.target.composing||(e.elementMainValue=t.target.value)}}})])])])},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
21 |
},{"../mixins/ControlBase":"LTB1"}],"YVYX":[function(require,module,exports) {
|
22 |
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=o(require("vue")),t=o(require("../containers/RangeControl")),n=o(require("../functions/WPTB_ControlsManager"));function o(e){return e&&e.__esModule?e:{default:e}}var r={name:"ControlRange",handler:function(o){var r=n.default.getControlData(o);new e.default({data:r,components:{RangeControl:t.default}}).$mount("#".concat(o))}};exports.default=r;
|
23 |
+
},{"vue":"HYXJ","../containers/RangeControl":"W4BN","../functions/WPTB_ControlsManager":"WZJa"}],"qsi5":[function(require,module,exports) {
|
24 |
+
"use strict";function e(){var e={};return function(t,r){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2e3;Object.keys(e).includes(t)&&clearTimeout(e[t]),e[t]=setTimeout(r,o)}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var t=e();exports.default=t;
|
25 |
+
},{}],"cW6v":[function(require,module,exports) {
|
26 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=t(require("../functions/DeBouncer"));function t(e){return e&&e.__esModule?e:{default:e}}var i={props:{clone:{type:Boolean,default:!1,required:!1},cloneQuery:{type:String,required:!0},tableDirectives:{type:String,default:""},tableStyle:{type:Object,default:function(){}}},inheritAttrs:!1,data:function(){return{cloneInner:!1,clonedTable:null,mainTable:null,tableDirectiveDatasetId:"wptbResponsiveDirectives",tableHaveDirectives:!1}},mounted:function(){this.cloneInner=this.clone},watch:{clone:function(e){this.cloneInner=e},cloneInner:function(e){e&&(this.startClone(),this.cloneInner=!1)},tableDirectives:function(e){e&&this.addDirectivesToTable(e)},"appOptions.identifyCells":{handler:function(e){e&&(this.showCellIdentification(),this.appOptions.identifyCells=!1)}},"directives.responsiveEnabled":{handler:function(e){e&&(this.mainTable.dataset.wptbAdaptiveTable=0)}}},methods:{startClone:function(){if(this.mainTable=document.querySelector(this.cloneQuery),!this.mainTable)throw new Error("no clone target is found with a query value of ".concat(this.cloneQuery));this.appOptions.hasLegacyResponsive="1"===this.mainTable.dataset.wptbAdaptiveTable,this.clonedTable=this.mainTable.cloneNode(!0),this.clonedTable.classList.add("wptb-plugin-box-shadow-xl"),this.$refs.tableClone.appendChild(this.clonedTable);var e=this.mainTable.dataset[this.tableDirectiveDatasetId];this.tableDirectives&&this.addDirectivesToTable(this.tableDirectives),this.tableHaveDirectives=void 0!==e,this.setupCellIdentification(this.clonedTable),this.$emit("tableCloned",e)},addDirectivesToTable:function(e){this.clonedTable&&this.mainTable&&(this.clonedTable.dataset[this.tableDirectiveDatasetId]=e,this.mainTable.dataset[this.tableDirectiveDatasetId]=e,this.$emit("directivesCopied",this.tableHaveDirectives),this.tableHaveDirectives=!1)},setupCellIdentification:function(e){Array.from(e.querySelectorAll("td")).map(function(e,t){"relative"!==getComputedStyle(e).position&&(e.style.position="relative");var i=document.createRange();i.setStart(e,0);var a="background-color: hsla(211, 25%, ".concat(t%2==0?70:90,"%, 80%)"),n='<div class="wptb-responsive-cell-identifier" style="'.concat(a,'">').concat(t+1,"</div>"),l=i.createContextualFragment(n);e.appendChild(l.childNodes[0])})},showCellIdentification:function(){var t=this;this.clonedTable.classList.add("wptb-responsive-show-cell-identifier"),(0,e.default)("cellIdentification",function(){t.clonedTable.classList.remove("wptb-responsive-show-cell-identifier")},2e3)}}};exports.default=i;
|
27 |
+
(function(){var e=exports.default||module.exports;"function"==typeof e&&(e=e.options),Object.assign(e,{render:function(){var e=this.$createElement,t=this._self._c||e;return t("div",{staticClass:"wptb-responsive-clone-wrapper"},[t("div",{staticClass:"wptb-responsive-clone-inner-wrapper"},[t("div",{ref:"tableClone",style:this.tableStyle})])])},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
28 |
+
},{"../functions/DeBouncer":"qsi5"}],"h0P7":[function(require,module,exports) {
|
29 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var t={inheritAttrs:!1,props:{postFix:{type:String,default:""},value:{type:null,default:0},enableDynamicWidth:{type:Boolean,default:!1},dynamicWidthPadding:{type:Number,default:3},onlyEnter:{type:Boolean,default:!1},min:{type:Number,default:0},max:{type:Number,default:1e3},enableLimit:{type:Boolean,default:!1}},model:{prop:"value",event:"valueChanged"},watch:{value:function(t){this.innerValue=t}},data:function(){return{innerValue:0}},mounted:function(){this.innerValue=this.value},computed:{postFixIt:function(){return"".concat(this.innerValue).concat(this.postFix)},dynamicWidth:function(){return this.enableDynamicWidth?{width:"calc(".concat(this.innerValue.toString().length+this.postFix.length+this.dynamicWidthPadding,"ch) !important")}:{}}},methods:{getValue:function(t){var e=Number.parseInt(t,10);return e=isNaN(e)?0:e,this.enableLimit?this.limitValue(e):e},limitValue:function(t){return t<this.min?this.min:t>this.max?this.max:t},handleOnInput:function(t){this.onlyEnter||this.$emit("valueChanged",this.getValue(t.target.value))},handleEnterInput:function(t){this.onlyEnter&&this.$emit("valueChanged",this.getValue(t.target.value))},handleKeyPress:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"up",e=this.getValue(this.innerValue);switch(t){case"up":e+=1;break;case"down":e-=1;break;default:e+=1}e=this.getValue(e),this.$emit("valueChanged",e)}}};exports.default=t;
|
30 |
+
(function(){var e=exports.default||module.exports;"function"==typeof e&&(e=e.options),Object.assign(e,{render:function(){var e=this,n=e.$createElement;return(e._self._c||n)("input",{style:e.dynamicWidth,attrs:{type:"text",disabled:e.$attrs.disabled},domProps:{value:e.postFixIt},on:{input:e.handleOnInput,keydown:[function(n){return!n.type.indexOf("key")&&e._k(n.keyCode,"up",38,n.key,["Up","ArrowUp"])?null:(n.preventDefault(),e.handleKeyPress("up"))},function(n){return!n.type.indexOf("key")&&e._k(n.keyCode,"down",40,n.key,["Down","ArrowDown"])?null:(n.preventDefault(),e.handleKeyPress("down"))},function(n){return!n.type.indexOf("key")&&e._k(n.keyCode,"enter",13,n.key,"Enter")?null:(n.preventDefault(),e.handleEnterInput(n))}]}})},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
31 |
+
},{}],"xi3E":[function(require,module,exports) {
|
32 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var t=e(require("./NumberPostfixInput"));function e(t){return t&&t.__esModule?t:{default:t}}var a={props:{value:{type:Number,default:0},rawValue:{type:Number,default:0},active:{type:Boolean,default:!1},stopId:String,enableBreakpointCustomization:{type:Boolean,default:!1}},components:{NumberPostfixInput:t.default},data:function(){return{wrapperStyle:{left:0,top:0},innerRawValue:this.rawValue}},watch:{rawValue:function(t){this.innerRawValue=t},value:function(){this.calculateStyle()},innerRawValue:function(t){this.$emit("breakpointChange",t,this.stopId)}},mounted:function(){var t=this;this.$nextTick(function(){t.calculateStyle()})},methods:{clickEvent:function(){this.$emit("click",this.rawValue)},calculateStyle:function(){var t=this.$refs.wrapper,e=this.$refs.knob;if(t){var a=t.getBoundingClientRect().width;this.wrapperStyle.left="calc(".concat(this.value,"% - ").concat(a/2,"px)")}if(e){var n=e.getBoundingClientRect().height;this.wrapperStyle.top="-".concat(n/2,"px")}}}};exports.default=a;
|
33 |
+
(function(){var e=exports.default||module.exports;"function"==typeof e&&(e=e.options),Object.assign(e,{render:function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{ref:"wrapper",staticClass:"wptb-slider-stop",class:{"wptb-slider-stop-active":e.active},style:e.wrapperStyle,on:{"!click":function(t){return t.preventDefault(),e.clickEvent(t)}}},[i("div",{ref:"knob",staticClass:"wptb-slider-stop-knob"}),e._v(" "),i("div",{staticClass:"wptb-slider-stop-label"},[e._t("default")],2),e._v(" "),i("div",{directives:[{name:"show",rawName:"v-show",value:e.enableBreakpointCustomization,expression:"enableBreakpointCustomization"}]},[i("number-postfix-input",{staticClass:"wptb-size-input",staticStyle:{"font-size":"90%"},attrs:{"enable-dynamic-width":!0,"only-enter":!0,"post-fix":"px"},model:{value:e.innerRawValue,callback:function(t){e.innerRawValue=t},expression:"innerRawValue"}})],1)])},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
34 |
+
},{"./NumberPostfixInput":"h0P7"}],"ooD9":[function(require,module,exports) {
|
35 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var t={props:{amount:{type:Number,default:0}},computed:{calculateStyle:function(){return{width:"".concat(this.amount,"%")}}}};exports.default=t;
|
36 |
+
(function(){var e=exports.default||module.exports;"function"==typeof e&&(e=e.options),Object.assign(e,{render:function(){var e=this.$createElement;return(this._self._c||e)("div",{staticClass:"wptb-screen-size-slider-fill",style:this.calculateStyle})},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
37 |
+
},{}],"q8F8":[function(require,module,exports) {
|
38 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e={props:{positionPercentage:{type:Number,default:0}},data:function(){return{style:{left:0}}},watch:{positionPercentage:{handler:function(){this.calculateStyle()},deep:!0}},mounted:function(){this.calculateStyle()},methods:{calculateStyle:function(){var e=this.$refs.arrowWrapper.getBoundingClientRect().width;this.style.left="calc(".concat(this.positionPercentage,"% - ").concat(e/2,"px)")},handleDrag:function(e){var t=e.screenX,a=e.screenY;0===t&&0===a||this.$emit("arrowDrag",e)}}};exports.default=e;
|
39 |
+
(function(){var e=exports.default||module.exports;"function"==typeof e&&(e=e.options),Object.assign(e,{render:function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{ref:"arrowWrapper",staticClass:"wptb-screen-size-slider-arrow",style:e.style,attrs:{draggable:"true"},on:{drag:function(t){return t.preventDefault(),e.handleDrag(t)},dragover:function(e){e.preventDefault()},dragend:function(t){return t.preventDefault(),e.$emit("arrowDragEnd")},drop:function(e){e.preventDefault()},dragexit:function(e){e.preventDefault()},dragleave:function(e){e.preventDefault()}}},[r("svg",{attrs:{width:"17",height:"16",fill:"none",xmlns:"http://www.w3.org/2000/svg"}},[r("path",{attrs:{d:"M8.5 16L0 0h17L8.5 16z",fill:"var(--wptb-plugin-logo-color)"}})])])},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
40 |
+
},{}],"V4gv":[function(require,module,exports) {
|
41 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var t=n(require("./SliderStop")),e=n(require("./SliderFill")),i=n(require("./SliderArrow"));function n(t){return t&&t.__esModule?t:{default:t}}var r={props:{stops:Object,endPadding:{type:Number,default:0},modelVal:{type:Number,default:0},enableBreakpointCustomization:{type:Boolean,default:!1}},components:{SliderStop:t.default,SliderFill:e.default,SliderArrow:i.default},data:function(){return{min:0,max:100,currentVal:0,isDragging:!1,minSizeBetweenBreakpoints:100,repaintId:0}},beforeMount:function(){this.calculateMinMax()},watch:{currentVal:function(){this.$emit("slide",this.currentVal)},modelVal:function(t){this.currentVal=Math.floor(t)}},methods:{handleBreakpointChange:function(t,e){var i=this.directives.breakpoints;if(!i[e])throw new Error("no breakpoint found with the given ID: [".concat(e,"]"));var n=Object.keys(i).sort(function(t,e){return i[t].width-i[e].width}),r=n.indexOf(e),a=n[r-1],s=n[r+1];a&&i[a].width>=t&&(t=i[a].width+this.minSizeBetweenBreakpoints),s&&i[s].width<=t&&(t=i[s].width-this.minSizeBetweenBreakpoints),i[e].width=t,this.calculateMinMax(),this.repaintId+=1},calculateMinMax:function(){var t=Object.values(this.stops).sort(function(t,e){return-1*(e.width-t.width)});this.min=t[0].width-this.endPadding,this.max=t[t.length-1].width+this.endPadding,this.currentVal=t[t.length-1].width},translateIntoPercent:function(t){var e=this.max-this.min;return 100*(t-this.min)/e},slide:function(t){this.currentVal=t},handleArrowDrag:function(t){this.isDragging=!0;var e=this.$refs.sliderWrapper.getBoundingClientRect(),i=e.left,n=e.width,r=(t.clientX-i)*(this.max-this.min)/n;this.currentVal=this.limitToRange(this.min+r)},limitToRange:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=t;return t<this.min&&(i=this.min),t>this.max&&(i=this.max),e&&(i=Math.floor(i)),i},isStopActive:function(t){var e=this;return this.currentVal>=t&&Object.values(this.stops).filter(function(t){return t<=e.currentVal}).every(function(e){return e<=t})}}};exports.default=r;
|
42 |
+
(function(){var e=exports.default||module.exports;"function"==typeof e&&(e=e.options),Object.assign(e,{render:function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{key:e.repaintId,ref:"sliderWrapper",staticClass:"wptb-screen-size-slider-wrapper",class:{"wptb-drag-active":e.isDragging}},[r("div",{staticClass:"wptb-screen-size-slider-empty"},[r("slider-arrow",{attrs:{"position-percentage":e.translateIntoPercent(e.limitToRange(e.currentVal))},on:{arrowDrag:e.handleArrowDrag,arrowDragEnd:function(t){e.isDragging=!1}}}),e._v(" "),r("slider-fill",{attrs:{amount:e.translateIntoPercent(e.limitToRange(e.currentVal))}}),e._v(" "),e._l(e.stops,function(t,a){var n=t.name,i=t.width;return r("slider-stop",{key:a,attrs:{active:e.isStopActive(i),value:e.translateIntoPercent(i),"raw-value":i,"stop-id":a,enableBreakpointCustomization:e.enableBreakpointCustomization},on:{click:e.slide,breakpointChange:e.handleBreakpointChange}},[e._v(e._s(n))])})],2)])},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
43 |
+
},{"./SliderStop":"xi3E","./SliderFill":"ooD9","./SliderArrow":"q8F8"}],"phKF":[function(require,module,exports) {
|
44 |
|
45 |
+
var t,e,n=module.exports={};function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function i(e){if(t===setTimeout)return setTimeout(e,0);if((t===r||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}function u(t){if(e===clearTimeout)return clearTimeout(t);if((e===o||!e)&&clearTimeout)return e=clearTimeout,clearTimeout(t);try{return e(t)}catch(n){try{return e.call(null,t)}catch(n){return e.call(this,t)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:r}catch(n){t=r}try{e="function"==typeof clearTimeout?clearTimeout:o}catch(n){e=o}}();var c,s=[],l=!1,a=-1;function f(){l&&c&&(l=!1,c.length?s=c.concat(s):a=-1,s.length&&h())}function h(){if(!l){var t=i(f);l=!0;for(var e=s.length;e;){for(c=s,s=[];++a<e;)c&&c[a].run();a=-1,e=s.length}c=null,l=!1,u(t)}}function m(t,e){this.fun=t,this.array=e}function p(){}n.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];s.push(new m(t,e)),1!==s.length||l||i(h)},m.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.env={},n.argv=[],n.version="",n.versions={},n.on=p,n.addListener=p,n.once=p,n.off=p,n.removeListener=p,n.removeAllListeners=p,n.emit=p,n.prependListener=p,n.prependOnceListener=p,n.listeners=function(t){return[]},n.binding=function(t){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(t){throw new Error("process.chdir is not supported")},n.umask=function(){return 0};
|
46 |
+
},{}],"Q6f0":[function(require,module,exports) {
|
47 |
+
var global = arguments[3];
|
48 |
+
var process = require("process");
|
49 |
+
var e=arguments[3],t=require("process");function n(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function r(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach(function(t){o(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(e,t,n){"object"===("undefined"==typeof exports?"undefined":a(exports))&&"undefined"!=typeof module?module.exports=n():t[e]=n()}("WPTB_ResponsiveFrontend",self||e,function(){function e(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]}function t(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this.element=e,this.referenceObject=n,this.mergedRenderStatus=!0,this.mergedCells={row:[],column:[]},this.getMergedRenderStatus=function(){return t.mergedRenderStatus},this.setMergedRenderStatus=function(e){t.mergedRenderStatus=e},this.addToMergedCells=function(e,n){t.mergedCells[e].push(n)},this.isReference=function(){return null!==t.referenceObject},this.isReference()&&(this.element=e.cloneNode(!0)),this.modifications={},this.spans={row:1,col:1},this.remainingSpans={row:0,col:0},this.cacheSpanValues=function(){Object.keys(t.spans).map(function(e){if(Object.prototype.hasOwnProperty.call(t.spans,e)){var n=t.spans[e];t.spans[e]=t.element.getAttribute("".concat(e,"Span"))||n}})},this.cacheSpanValues(),this.getSpan=function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1]?t.getElement().getAttribute("".concat(e,"Span")):t.spans[e];if(n)return n;throw new Error("no span value found with the given type of [".concat(e,"]"))},this.getRemainingSpans=function(e){return t.remainingSpans[e]},this.setRemainingSpans=function(e,n){t.remainingSpans[e]=n},this.getElement=function(){return t.element},this.createCellElement=function(){return document.createElement("td")},e||(this.element=this.createCellElement()),this.setAttribute=function(e,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:",",s=t.getElement()[e];"function"!=typeof s&&"object"!==a(s)||(s=t.getElement().getAttribute(e)),t.modifications[e]&&(s=t.modifications[e].default);var i=s;r?i+="".concat(i).concat(o).concat(n):i=n,t.modifications[e]={value:i,default:s},t.getElement()[e]=i},this.setSpan=function(e,n){if(!t.isReference()){var r=t.getSpan(e)-n<0?t.getSpan(e):n;t.setAttribute("".concat(e,"Span"),r),t.setRemainingSpans(e,t.getSpan(e)-r);for(var o=0;o<r-1;o+=1)t.mergedCells[e][o].setMergedRenderStatus(!1);return!0}if(!t.getMergedRenderStatus())return!1;var a=t.referenceObject.getRemainingSpans(e);if(0===a)return!1;var s=a-n<0?a:n,i=a-s;if(t.referenceObject.setRemainingSpans(e,i),t.setAttribute("".concat(e,"Span"),s),0!==i)for(var l=t.referenceObject.mergedCells[e].length-a+1,d=l+s-1,u=l;u<d;u+=1)t.mergedCells[e][u].setMergedRenderStatus(!1);return!0},this.resetAttribute=function(e){t.modifications[e]&&(t.getElement()[e]=t.modifications[e].default,t.modifications[e]=void 0)},this.resetAllAttributes=function(){Object.keys(t.modifications).map(function(e){Object.prototype.hasOwnProperty.call(t.modifications,e)&&t.resetAttribute(e)})},{getElement:this.getElement,el:this.element,setAttribute:this.setAttribute,resetAllAttributes:this.resetAllAttributes,getSpan:this.getSpan,setSpan:this.setSpan,getRemainingSpans:this.getRemainingSpans,setRemainingSpans:this.setRemainingSpans,isReference:this.isReference,addToMergedCells:this.addToMergedCells,mergedCells:this.mergedCells,setMergedRenderStatus:this.setMergedRenderStatus,getMergedRenderStatus:this.getMergedRenderStatus}}function n(n){var r=this;return this.tableElement=n,this.parsedTable=[],this.rowCache=[],this.originals={rows:[]},this.rowColors={header:null,even:null,odd:null},this.addToParsed=function(e,t,n){r.parsedTable[e]||(r.parsedTable[e]=[]),r.parsedTable[e][t]=n},this.parseTable=function(){var e=Array.from(r.tableElement.querySelectorAll("tr"));e.map(function(e,n){r.originals.rows.push(e),Array.from(e.querySelectorAll("td")).map(function(e,o){var a=new t(e);r.addToParsed(n,o,a);var s=a.getSpan(t.spanTypes.row),i=a.getSpan(t.spanTypes.column);if(s>1)for(var l=1;l<s;l+=1){var d=new t(e,a);a.addToMergedCells("row",d),r.addToParsed(n+l,o,d)}if(i>1)for(var u=1;u<i;u+=1){var c=new t(e,a);a.addToMergedCells("column",c),r.addToParsed(n,o+u,c)}})}),r.parseRowColors(e)},this.parseRowColors=function(t){(!t||t.length<=0)&&e("no rows are found to parse their colors","error"),r.rowColors.header=""===t[0].style.backgroundColor?null:t[0].style.backgroundColor;for(var n=t.length/3>=1?0:1===t.length?2:(t.length-1)%2,o=0;o<n;o+=1){var a=document.createElement("tr");r.tableElement.querySelector("tbody").appendChild(a),t.push(a)}r.rowColors.even=getComputedStyle(t[1]).backgroundColor,r.rowColors.odd=getComputedStyle(t[2]).backgroundColor;for(var s=0;s<n;s+=1)t[t.length-(s+1)].remove()},this.addRow=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;Array.isArray(e)||(e=[e]);var o,a=r.tableElement.querySelector("tbody");if(t)o=r.originals.rows[n];else{var s=document.createRange();s.setStart(a,0),o=s.createContextualFragment('<tr class="'.concat(e.join(" "),'"></tr>')).childNodes[0]}return a.appendChild(o),r.rowCache.push(o),{el:o,id:r.rowCache.length-1}},this.clearTable=function(){r.rowCache=[],r.tableElement.querySelector("tbody").innerHTML=""},this.getRow=function(t){return r.rowCache[t]?r.rowCache[t]:(e("no row with id [".concat(t,"] found in the cache."),"warn"),null)},this.maxRows=function(){return r.parsedTable.length},this.maxColumns=function(){return r.parsedTable.reduce(function(e,t){return t.length>e&&(e=t.length),e},0)},this.getCell=function(t,n){var o=arguments.length>2&&void 0!==arguments[2]&&arguments[2];try{if(r.parsedTable[t][n])return o?r.parsedTable[t][n]:r.parsedTable[t][n].el}catch(a){return e("no cell found at the given address of [".concat(t,"-").concat(n,"]"),"warn"),null}return e("no cell found at the given address of [".concat(t,"-").concat(n,"]"),"warn"),null},this.getCellsAtRow=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=[],o=0;o<r.maxColumns();o+=1){var a=r.getCell(e,o,t);a&&n.push(a)}return n},this.appendToRow=function(e,t,n){var o=r.getRow(n),a=r.getCell(e,t,!0);return a&&o&&o.appendChild(a.getElement()),a},this.appendElementToRow=function(e,t){var n=r.getRow(t);e&&n&&n.appendChild(e)},this.appendObjectToRow=function(e,t){var n=r.getRow(t);e&&n&&n.appendChild(e.getElement())},this.parseTable(),{maxRows:this.maxRows,maxColumns:this.maxColumns,addRow:this.addRow,clearTable:this.clearTable,getCell:this.getCell,appendToRow:this.appendToRow,appendElementToRow:this.appendElementToRow,appendObjectToRow:this.appendObjectToRow,getCellsAtRow:this.getCellsAtRow,el:this.tableElement,rowColors:this.rowColors}}t.spanTypes={row:"row",column:"col"};var o={query:".wptb-preview-table",defaultClasses:["wptb-plugin-responsive-base"],bindToResize:!1};return function(){var e=this,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.options=r({},o,{},a),this.elements=Array.from(document.querySelectorAll(this.options.query)),this.elementObjects=this.elements.map(function(e){return{el:e,tableObject:new n(e)}}),this.bindRebuildToResize=function(){window.addEventListener("resize",function(t){e.rebuildTables(t.target.innerWidth)})},this.getDirective=function(e){var t=e.dataset.wptbResponsiveDirectives;return t?JSON.parse(atob(t)):null},this.addDefaultClasses=function(t){t.classList.add(e.options.defaultClasses)},this.removeDefaultClasses=function(t){t.classList.remove(e.options.defaultClasses)},this.autoBuild=function(t,n,r,o){var a=r.cellStackDirection[n],s=r.topRowAsHeader[n],i=r.cellsPerRow[n];o.clearTable(),"desktop"===n?(e.buildDefault(o),e.removeDefaultClasses(t)):(e.autoDirectionBuild(o,a,s,i),e.addDefaultClasses(t))},this.autoDirectionBuild=function(t,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,a=t.maxRows(),s=t.maxColumns(),i="row"===n;if(r)e.headerBuild(t,n,o);else if(i)!function(){for(var e=[],n=0;n<a;n+=1)t.getCellsAtRow(n,!0).forEach(function(t){return e.push(t)});for(var r=e.length,s=0,i=0;s<r;s+=o,i+=1){var l=t.addRow("wptb-row");l.el.style.backgroundColor=t.rowColors[i%2==0?"odd":"even"];for(var d=0;d<o;d+=1){var u=e[s+d];u&&(t.appendElementToRow(u.getElement(),l.id),u.resetAllAttributes(),u.setAttribute("style","width: 100% !important",!0,";"),u.setAttribute("colSpan",1),u.setAttribute("rowSpan",1))}}}();else{for(var l=[],d=0;d<s;d+=1)for(var u=0;u<a;u+=1){var c=t.getCell(u,d,!0);c&&l.push(c)}for(var p=l.length,f=0,h=0;f<p;f+=o,h+=1){var g=t.addRow("wptb-row");g.el.style.backgroundColor=t.rowColors[h%2==0?"odd":"even"];for(var b=0;b<o;b+=1){var m=l[f+b];m&&(t.appendElementToRow(m.getElement(),g.id),m.resetAllAttributes(),m.setAttribute("style","width: 100% !important",!0,";"),m.setAttribute("colSpan",1),m.setAttribute("rowSpan",1))}}}},this.headerBuild=function(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=e.getCellsAtRow(0,!0).map(function(t){return t.setAttribute("style","background-color: ".concat(e.rowColors.header),!0,";"),t}),a="column"===n,s=e.maxRows(),i=e.maxColumns();if(a)for(var l=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=e.addRow("wptb-row");t&&(n.el.style.borderTop="3px solid gray"),o.map(function(t){e.appendElementToRow(t.el.cloneNode(!0),n.id)})},d=Math.ceil((s-1)/r),u=1,c=0;c<d;c+=1){l(c>0);for(var p=0;p<r&&!(u>=s);p+=1){var f=e.addRow("wptb-row");f.el.style.backgroundColor=e.rowColors[p%2==0?"even":"odd"];for(var h=0;h<i;h+=1){var g=e.getCell(u,h,!0);if(g){g.resetAllAttributes();var b=!0,m=g.getSpan(t.spanTypes.row);if(g.getSpan(t.spanTypes.column),m>1){var w=r-p,v=Math.min(m,w);b=g.setSpan(t.spanTypes.row,v),g.setMergedRenderStatus(!0)}b&&e.appendObjectToRow(g,f.id)}}u+=1}}else for(var R=Math.ceil((s-1)/r),C=1,y=0;y<R;y+=1){for(var S=0;S<i;S+=1){var T=e.addRow("wptb-row");T.el.style.backgroundColor="none",y>0&&0===S&&(T.el.style.borderTop="3px solid gray");var A=o[S].el.cloneNode(!0);A.style.backgroundColor="".concat(e.rowColors.header," !important"),e.appendElementToRow(A,T.id);for(var O=0;O<r&&!(C+O>=s);O+=1){var E=e.getCell(C+O,S,!0);if(E){E.resetAllAttributes();var j=!0,M=E.getSpan(t.spanTypes.row);if(E.getSpan(t.spanTypes.column),M>1){var x=r-O,k=Math.min(M,x);j=E.setSpan(t.spanTypes.row,k);var P=E.el.getAttribute("rowSpan"),D=E.el.getAttribute("colSpan");E.setAttribute("rowSpan",D),E.setAttribute("colSpan",P),E.setMergedRenderStatus(!0)}if(j){var q=(C+O+y)%2==0?"even":"odd";1===r&&(q=C%2==0?"even":"odd"),E.setAttribute("style","background-color: ".concat(e.rowColors[q]),!0,";"),e.appendObjectToRow(E,T.id)}}}}C+=r}},this.buildDefault=function(e){for(var t=e.maxRows(),n=e.maxColumns(),r=0;r<t;r+=1)for(var o=e.addRow("",!0,r).id,a=0;a<n;a+=1){var s=e.getCell(r,a,!0);s&&!s.isReference()&&(s.resetAllAttributes(),e.appendElementToRow(s.getElement(),o))}},this.calculateRangeId=function(e,t){var n=Object.keys(t).sort(function(e,n){return t[e].width-t[n].width}),r=n[0];return n.map(function(n){e>=t[n].width&&(r=n)}),r},this.rebuildTable=function(t,n,r){var o=e.getDirective(t);if(o){if(!o.responsiveEnabled)return;var a=o.responsiveMode,s=e["".concat(a,"Build")];n||(n=t.getBoundingClientRect().width);var i=e.calculateRangeId(n,o.breakpoints);if(!s)throw new Error("No build mode named as [".concat(a,"] found."));var l=o.modeOptions[a];s.call(e,t,i,l,r)}},this.rebuildTables=function(t){t||(t=window.innerWidth),e.elementObjects.map(function(n){e.rebuildTable(n.el,t,n.tableObject)})},this.options.bindToResize&&this.bindRebuildToResize(),{rebuildTables:this.rebuildTables}}});
|
50 |
+
},{"process":"phKF"}],"ATQh":[function(require,module,exports) {
|
51 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var t={props:{click:{type:Function,default:function(){console.log("Material button clicked")}},size:{type:String,default:"fit-content"}},computed:{buttonClass:function(){return["wptb-plugin-button-material-".concat(this.size)]}}};exports.default=t;
|
52 |
+
(function(){var t=exports.default||module.exports;"function"==typeof t&&(t=t.options),Object.assign(t,{render:function(){var t=this,e=t.$createElement;return(t._self._c||e)("div",{staticClass:"wptb-plugin-button-material",class:t.buttonClass,on:{click:function(e){return e.preventDefault(),t.click(e)}}},[t._t("default")],2)},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
53 |
+
},{}],"vCKs":[function(require,module,exports) {
|
54 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=t(require("./MaterialButton"));function t(e){return e&&e.__esModule?e:{default:e}}var o={props:{message:{type:String,default:"This is a default message for modal window."},visible:{type:Boolean,default:!1},relativeRef:{type:HTMLElement,required:!0},callback:{type:Function,default:function(){console.log("modal button clicked")}}},components:{MaterialButton:e.default},mounted:function(){this.relativeRef.appendChild(this.$refs.mainWrapper)},beforeDestroy:function(){this.$refs.mainWrapper.remove()}};exports.default=o;
|
55 |
+
(function(){var s=exports.default||module.exports;"function"==typeof s&&(s=s.options),Object.assign(s,{render:function(){var s=this,i=s.$createElement,t=s._self._c||i;return t("div",{directives:[{name:"show",rawName:"v-show",value:s.visible,expression:"visible"}],ref:"mainWrapper",staticClass:"wptb-plugin-modal-window"},[t("div",{staticClass:"wptb-plugin-modal-inner-window"},[s._m(0),s._v(" "),t("div",{staticClass:"wptb-plugin-modal-message"},[s._v(s._s(s.message))]),s._v(" "),t("div",{staticClass:"wptb-plugin-modal-button-container"},[t("material-button",{attrs:{size:"full-size",click:s.callback}},[s._v(s._s(s.strings.okay))])],1)])])},staticRenderFns:[function(){var s=this.$createElement,i=this._self._c||s;return i("div",{staticClass:"wptb-plugin-modal-icon"},[i("span",{staticClass:"dashicons dashicons-warning"})])}],_compiled:!0,_scopeId:null,functional:void 0});})();
|
56 |
+
},{"./MaterialButton":"ATQh"}],"waBm":[function(require,module,exports) {
|
57 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=c(require("../components/TableClone")),t=c(require("../components/ScreenSizeSlider")),i=c(require("../../../WPTB_ResponsiveFrontend")),n=c(require("../functions/DeBouncer")),r=c(require("../components/ModalWindow")),o=c(require("../components/MaterialButton")),s=c(require("../components/NumberPostfixInput"));function c(e){return e&&e.__esModule?e:{default:e}}function u(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,n)}return i}function a(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?u(Object(i),!0).forEach(function(t){l(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):u(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function l(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function p(e){return(p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var d={props:{cloneQuery:{type:String,required:!0},screenSizes:Object,compareSizes:Object},components:{TableClone:e.default,ScreenSizeSlider:t.default,ModalWindow:r.default,MaterialButton:o.default,NumberPostfixInput:s.default},data:function(){return{isVisible:!0,currentSize:0,currentDirectives:null,currentSizeRangeName:"desktop",sliderPadding:20,sizeStops:{},responsiveFrontend:null,rebuilding:!1,debounceTime:1e3,sizeLimitMin:100,sizeLimitMax:0}},watch:{currentSizeRangeName:function(e){this.appOptions.currentBreakpoint=e},directives:{handler:function(){this.currentDirectives=this.encodeResponsiveDirectives()},deep:!0},"appOptions.currentSize":{handler:function(e){var t=this,i=this.currentSizeRangeName;this.currentSizeRangeName=this.calculateSizeRangeName(e),i!==this.currentSizeRangeName&&this.directives.responsiveEnabled&&(this.rebuilding=!0,(0,n.default)("currentSize",function(){t.responsiveFrontend.rebuildTables(t.appOptions.currentSize),t.rebuilding=!1},this.debounceTime))}}},beforeMount:function(){},mounted:function(){var e=this;document.addEventListener("wptbSectionChanged",function(t){e.isVisible="table_responsive_menu"===t.detail}),this.sizeLimitMax=this.$refs.builderResponsive.getBoundingClientRect().width},computed:{tableStyle:function(){if(!this.directives.responsiveEnabled)return{};var e=this.limitToRange(this.appOptions.currentSize,Math.min(this.sizeLimitMin,this.sizeLimitMax),Math.max(this.sizeLimitMin,this.sizeLimitMax));return{width:"".concat(e,"px")}},modalRelative:function(){return document.querySelector(".wptb-builder-panel")}},methods:{limitToRange:function(e,t,i){return e>i?i:e<t?t:e},tableCloned:function(e){if(this.responsiveFrontend=new i.default({query:".wptb-builder-responsive table"}),e){var t=this.decodeResponsiveDirectives(e);try{var n=JSON.parse(t);this.deepMergeObject(this.directives,n)}catch(r){console.warn("[WPTB]: invalid directive found at main table")}}},deepMergeObject:function(e,t){Object.keys(t).map(function(i){Object.prototype.hasOwnProperty.call(t,i)&&void 0!==e[i]&&("object"===p(e[i])?e[i]=a({},e[i],{},t[i]):e[i]=t[i])})},directivesCopied:function(e){this.responsiveFrontend.rebuildTables(this.appOptions.currentSize),e||(new WPTB_TableStateSaveManager).tableStateSet(),this.rebuilding=!1},sliderSizeStops:function(){var e=this,t=Object.keys(this.screenSizes).reduce(function(t,i){return Object.prototype.hasOwnProperty.call(e.screenSizes,i)&&(t[e.screenSizes[i].name]=e.screenSizes[i].width),t},{});return this.directives.stops=t,t},calculateSizeRangeName:function(e){var t=this.directives.breakpoints,i=Object.keys(t).filter(function(i){return!!Object.prototype.hasOwnProperty.call(t,i)&&t[i].width<=e}).sort(function(e,i){return t[e].width-t[i].width});return 0===i.length?"mobile":i[i.length-1]},handleSizeSlideChange:function(e){this.appOptions.currentSize=e},encodeResponsiveDirectives:function(){var e=JSON.stringify(this.directives);return btoa(e)},decodeResponsiveDirectives:function(e){return atob(e)},showCellIdentifications:function(){this.appOptions.identifyCells=!0}}};exports.default=d;
|
58 |
+
(function(){var e=exports.default||module.exports;"function"==typeof e&&(e=e.options),Object.assign(e,{render:function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("transition",{attrs:{name:"wptb-fade"}},[e.isVisible?i("div",{ref:"builderResponsive",staticClass:"wptb-builder-responsive"},[i("div",{staticClass:"wptb-responsive-menu-tools"},[i("screen-size-slider",{attrs:{"end-padding":e.sliderPadding,stops:e.directives.breakpoints,"model-val":e.appOptions.currentSize,"enable-breakpoint-customization":!1},on:{slide:e.handleSizeSlideChange}})],1),e._v(" "),i("div",{staticClass:"wptb-responsive-builder-main wptb-checkerboard-pattern wptb-plugin-inset-shadow-md"},[i("div",{staticClass:"wptb-responsive-builder-toolbox-float"},[i("number-postfix-input",{staticClass:"wptb-size-input wptb-plugin-box-shadow-xl",attrs:{"post-fix":"px","only-enter":!0},model:{value:e.appOptions.currentSize,callback:function(t){e.$set(e.appOptions,"currentSize",t)},expression:"appOptions.currentSize"}}),e._v(" "),i("material-button",{staticClass:"wptb-plugin-box-shadow-xl",attrs:{size:"fit-content",click:e.showCellIdentifications}},[e._v(e._s(e._f("cap")(e.strings.identifyCells))+" ")])],1),e._v(" "),i("table-clone",{ref:"tableClone",attrs:{clone:e.isVisible,"clone-query":e.cloneQuery,"table-directives":e.currentDirectives,"table-style":e.tableStyle},on:{tableCloned:e.tableCloned,directivesCopied:e.directivesCopied}}),e._v(" "),i("transition",{attrs:{name:"wptb-fade"}},[e.directives.responsiveEnabled?e._e():i("div",{staticClass:"wptb-responsive-disabled-table-overlay"})]),e._v(" "),i("transition",{attrs:{name:"wptb-fade"}},[i("div",{directives:[{name:"show",rawName:"v-show",value:e.rebuilding,expression:"rebuilding"}],staticClass:"wptb-responsive-wait-overlay"},[e._v(e._s(e.strings.rebuilding))])]),e._v(" "),i("modal-window",{attrs:{visible:e.appOptions.hasLegacyResponsive,message:e.strings.legacyResponsiveWarning,"relative-ref":e.modalRelative,callback:function(){e.appOptions.hasLegacyResponsive=!1}}})],1)]):e._e()])},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
59 |
+
},{"../components/TableClone":"cW6v","../components/ScreenSizeSlider":"V4gv","../../../WPTB_ResponsiveFrontend":"Q6f0","../functions/DeBouncer":"qsi5","../components/ModalWindow":"vCKs","../components/MaterialButton":"ATQh","../components/NumberPostfixInput":"h0P7"}],"TuCQ":[function(require,module,exports) {
|
60 |
+
|
61 |
+
(function(){var t=exports.default||module.exports;"function"==typeof t&&(t=t.options),Object.assign(t,{render:function(){var t=this.$createElement;return(this._self._c||t)("div",{staticClass:"wptb-controls-flex-row"},[this._t("default")],2)},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
62 |
+
},{}],"GZC0":[function(require,module,exports) {
|
63 |
+
"use strict";function e(e,t){e.filter("cap",function(e){return e.split(" ").map(function(e){return e[0].toUpperCase()+e.slice(1)}).join(" ")})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var t={install:e};exports.default=t;
|
64 |
+
},{}],"yEip":[function(require,module,exports) {
|
65 |
+
"use strict";function t(t,e){t.mixin({data:function(){return{strings:e.strings}}})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e={install:t};exports.default=e;
|
66 |
+
},{}],"CDb8":[function(require,module,exports) {
|
67 |
+
"use strict";function e(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function t(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(n){e(t,n,r[n])})}return t}Object.defineProperty(exports,"__esModule",{value:!0}),exports.Plugin=exports.SSR=exports.Fragment=exports.default=void 0;var n=function(e,t,n){Object.defineProperty(e,t,{configurable:!0,get:function(){return n},set:function(e){console.warn("tried to set frozen property ".concat(t," with ").concat(e))}})},r=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;Object.defineProperty(e,t,{configurable:!0,writable:!0,value:n})},o={abstract:!0,name:"Fragment",props:{name:{type:String,default:function(){return Math.floor(Date.now()*Math.random()).toString(16)}}},mounted:function(){var e=this.$el,t=e.parentNode,o=document.createComment("fragment#".concat(this.name,"#head")),i=document.createComment("fragment#".concat(this.name,"#tail"));t.insertBefore(o,e),t.insertBefore(i,e),e.appendChild=function(r){t.insertBefore(r,i),n(r,"parentNode",e)},e.insertBefore=function(r,o){t.insertBefore(r,o),n(r,"parentNode",e)},e.removeChild=function(e){t.removeChild(e),r(e,"parentNode")},Array.from(e.childNodes).forEach(function(t){return e.appendChild(t)}),t.removeChild(e),n(e,"parentNode",t),n(e,"nextSibling",i.nextSibling);var a=t.insertBefore;t.insertBefore=function(n,r){a.call(t,n,r!==e?r:o)};var c=t.removeChild;t.removeChild=function(n){if(n===e){for(;o.nextSibling!==i;)e.removeChild(o.nextSibling);t.removeChild(o),t.removeChild(i),r(e,"parentNode"),t.insertBefore=a,t.removeChild=c}else c.call(t,n)}},render:function(e){var n=this,r=this.$slots.default;return r&&r.length&&r.forEach(function(e){return e.data=t({},e.data,{attrs:t({fragment:n.name},(e.data||{}).attrs)})}),e("div",{attrs:{fragment:this.name}},r)}};function i(e,t){}var a=o,c=i,f={install:function(e){e.component("fragment",o)}},l={Fragment:o,Plugin:f,SSR:i};exports.Plugin=f,exports.SSR=c,exports.Fragment=a;var u=l;exports.default=u;
|
68 |
+
},{}],"vpWQ":[function(require,module,exports) {
|
69 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e={props:{label:String,value:{type:null},disabled:{type:Boolean,default:!1}},data:function(){return{innerValue:""}},model:{prop:"value",event:"valueChanged"},watch:{value:function(e){this.innerValue=e},innerValue:function(e){this.$emit("valueChanged",e)}},mounted:function(){this.innerValue=this.value}},t=e;exports.default=t;
|
70 |
+
},{}],"osOD":[function(require,module,exports) {
|
71 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=t(require("../mixins/PanelControlBase"));function t(e){return e&&e.__esModule?e:{default:e}}var r={mixins:[e.default]};exports.default=r;
|
72 |
+
(function(){var e=exports.default||module.exports;"function"==typeof e&&(e=e.options),Object.assign(e,{render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"wptb-element-option wptb-settings-items wptb-plugin-width-full"},[n("div",{staticClass:"wptb-settings-row wptb-settings-middle-xs"},[n("label",{staticClass:"wptb-toggle"},[n("span",{staticStyle:{"font-size":"16px"}},[e._v(" "+e._s(e.label)+" ")]),e._v(" "),n("input",{directives:[{name:"model",rawName:"v-model",value:e.innerValue,expression:"innerValue"}],staticClass:"wptb-element-property",attrs:{type:"checkbox",disabled:e.disabled},domProps:{checked:Array.isArray(e.innerValue)?e._i(e.innerValue,null)>-1:e.innerValue},on:{change:function(t){var n=e.innerValue,i=t.target,l=!!i.checked;if(Array.isArray(n)){var s=e._i(n,null);i.checked?s<0&&(e.innerValue=n.concat([null])):s>-1&&(e.innerValue=n.slice(0,s).concat(n.slice(s+1)))}else e.innerValue=l}}}),e._v(" "),n("i")])])])},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
73 |
+
},{"../mixins/PanelControlBase":"vpWQ"}],"fI53":[function(require,module,exports) {
|
74 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=t(require("../mixins/PanelControlBase"));function t(e){return e&&e.__esModule?e:{default:e}}var o={props:{options:{type:Object,default:function(){}}},mixins:[e.default]};exports.default=o;
|
75 |
+
(function(){var e=exports.default||module.exports;"function"==typeof e&&(e=e.options),Object.assign(e,{render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"wptb-element-option wptb-settings-items wptb-plugin-width-full"},[n("div",{staticClass:"wptb-settings-row wptb-settings-middle-xs"},[n("label",{staticClass:"wptb-control-row wptb-flex wptb-flex-row wptb-flex-align-center wptb-flex-justify-space-between"},[n("span",{staticStyle:{"font-size":"16px"}},[e._v(" "+e._s(e.label)+" ")]),e._v(" "),n("select",{directives:[{name:"model",rawName:"v-model",value:e.innerValue,expression:"innerValue"}],attrs:{disabled:e.disabled},on:{change:function(t){var n=Array.prototype.filter.call(t.target.options,function(e){return e.selected}).map(function(e){return"_value"in e?e._value:e.value});e.innerValue=t.target.multiple?n:n[0]}}},e._l(e.options,function(t,l){return n("option",{key:l,domProps:{value:l}},[e._v(e._s(e._f("cap")(t)))])}),0)])])])},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
76 |
+
},{"../mixins/PanelControlBase":"vpWQ"}],"DmVJ":[function(require,module,exports) {
|
77 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=require("vue-fragment"),r=t(require("./PanelToggleControl")),o=t(require("./PanelDropdownControl"));function t(e){return e&&e.__esModule?e:{default:e}}var n={components:{PanelToggleControl:r.default,PanelDropdownControl:o.default,Fragment:e.Fragment}};exports.default=n;
|
78 |
+
(function(){var e=exports.default||module.exports;"function"==typeof e&&(e=e.options),Object.assign(e,{render:function(){var e=this,s=e.$createElement,n=e._self._c||s;return n("fragment",[n("panel-toggle-control",{attrs:{label:e._f("cap")(e.strings.enableResponsive)},model:{value:e.directives.responsiveEnabled,callback:function(s){e.$set(e.directives,"responsiveEnabled",s)},expression:"directives.responsiveEnabled"}}),e._v(" "),n("panel-dropdown-control",{attrs:{label:e._f("cap")(e.strings.mode),options:{auto:"auto"},disabled:!e.directives.responsiveEnabled},model:{value:e.directives.responsiveMode,callback:function(s){e.$set(e.directives,"responsiveMode",s)},expression:"directives.responsiveMode"}})],1)},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
79 |
+
},{"vue-fragment":"CDb8","./PanelToggleControl":"osOD","./PanelDropdownControl":"fI53"}],"UchZ":[function(require,module,exports) {
|
80 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e={props:{header:{type:String,default:"Tab Header"},tabs:{type:Object,default:function(){return{default:"Default"}}},currentTab:{type:String,default:"default"}},methods:{isActiveTab:function(e){return this.currentTab===e},handleTabClick:function(e){this.$emit("tabClicked",e)}}};exports.default=e;
|
81 |
+
(function(){var t=exports.default||module.exports;"function"==typeof t&&(t=t.options),Object.assign(t,{render:function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"wptb-section-group-tabbed wptb-plugin-box-shadow-md wptb-plugin-width-full"},[s("div",{staticClass:"wptb-panel-toggle wptb-section-group-tabbed-header"},[s("div",{staticClass:"header"},[t._v(t._s(t.header))])]),t._v(" "),s("div",{staticClass:"wptb-section-group-tabbed-tabs-buttons"},t._l(t.tabs,function(e,i){return s("div",{key:i,staticClass:"wptb-settings-section-item static-active",class:{active:t.isActiveTab(i),disabled:!t.isActiveTab(i)},on:{"!click":function(e){return e.preventDefault(),t.handleTabClick(i)}}},[t._v(" "+t._s(e)+" ")])}),0),t._v(" "),s("div",{staticClass:"wptb-section-group-tab-content"},[t._t("default")],2)])},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
82 |
+
},{}],"bOKu":[function(require,module,exports) {
|
83 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=r(require("../mixins/PanelControlBase")),t=r(require("./NumberPostfixInput"));function r(e){return e&&e.__esModule?e:{default:e}}var u={components:{NumberPostfixInput:t.default},mixins:[e.default]};exports.default=u;
|
84 |
+
(function(){var t=exports.default||module.exports;"function"==typeof t&&(t=t.options),Object.assign(t,{render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"wptb-element-option wptb-settings-items wptb-plugin-width-full"},[i("div",{staticClass:"wptb-settings-row wptb-settings-middle-xs"},[i("label",{staticClass:"wptb-control-row wptb-flex wptb-flex-row wptb-flex-align-center wptb-flex-justify-space-between"},[i("span",{staticStyle:{"font-size":"16px"}},[t._v(" "+t._s(t.label)+" ")]),t._v(" "),i("number-postfix-input",{staticClass:"wptb-size-input",attrs:{"enable-dynamic-width":!0,min:1,max:100,"enable-limit":!0,disabled:t.disabled},model:{value:t.innerValue,callback:function(e){t.innerValue=e},expression:"innerValue"}})],1)])])},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
85 |
+
},{"../mixins/PanelControlBase":"vpWQ","./NumberPostfixInput":"h0P7"}],"rfRR":[function(require,module,exports) {
|
86 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=require("vue-fragment"),t=n(require("./PanelToggleControl")),r=n(require("./PanelDropdownControl")),o=n(require("./PanelInputControl"));function n(e){return e&&e.__esModule?e:{default:e}}var i={components:{Fragment:e.Fragment,PanelToggleControl:t.default,PanelDropdownControl:r.default,PanelInputControl:o.default},methods:{isDisabled:function(){return"desktop"===this.appOptions.currentBreakpoint||!this.directives.responsiveEnabled}},computed:{perLabelString:function(){return this.directives.modeOptions.auto.topRowAsHeader[this.appOptions.currentBreakpoint]?this.strings.itemsPerHeader:this.strings.cellsPerRow}}};exports.default=i;
|
87 |
+
(function(){var e=exports.default||module.exports;"function"==typeof e&&(e=e.options),Object.assign(e,{render:function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("fragment",[o("panel-toggle-control",{attrs:{label:e._f("cap")(e.strings.topRowHeader),disabled:e.isDisabled()},model:{value:e.directives.modeOptions.auto.topRowAsHeader[e.appOptions.currentBreakpoint],callback:function(t){e.$set(e.directives.modeOptions.auto.topRowAsHeader,e.appOptions.currentBreakpoint,t)},expression:"directives.modeOptions.auto.topRowAsHeader[appOptions.currentBreakpoint]"}}),e._v(" "),o("panel-dropdown-control",{attrs:{label:e._f("cap")(e.strings.stackDirection),options:{row:e.strings.row,column:e.strings.column},disabled:e.isDisabled()},model:{value:e.directives.modeOptions.auto.cellStackDirection[e.appOptions.currentBreakpoint],callback:function(t){e.$set(e.directives.modeOptions.auto.cellStackDirection,e.appOptions.currentBreakpoint,t)},expression:"directives.modeOptions.auto.cellStackDirection[appOptions.currentBreakpoint]"}}),e._v(" "),o("panel-input-control",{attrs:{label:e._f("cap")(e.perLabelString),disabled:e.isDisabled()},model:{value:e.directives.modeOptions.auto.cellsPerRow[e.appOptions.currentBreakpoint],callback:function(t){e.$set(e.directives.modeOptions.auto.cellsPerRow,e.appOptions.currentBreakpoint,t)},expression:"directives.modeOptions.auto.cellsPerRow[appOptions.currentBreakpoint]"}})],1)},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
88 |
+
},{"vue-fragment":"CDb8","./PanelToggleControl":"osOD","./PanelDropdownControl":"fI53","./PanelInputControl":"bOKu"}],"BxO6":[function(require,module,exports) {
|
89 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=r(require("./PanelSectionGroupTabbed")),t=r(require("./AutoModePanelControls"));function r(e){return e&&e.__esModule?e:{default:e}}var o={components:{PanelSectionGroupTabbed:e.default,AutoModePanelControls:t.default},computed:{breakpointsObject:function(){var e=this;return Object.keys(this.directives.breakpoints).sort(function(t,r){return e.directives.breakpoints[t].width-e.directives.breakpoints[r].width}).reduce(function(t,r){return Object.prototype.hasOwnProperty.call(e.directives.breakpoints,r)&&(t[r]=e.directives.breakpoints[r].name),t},{})},currentPanelControls:function(){return"".concat(this.directives.responsiveMode[0].toUpperCase()+this.directives.responsiveMode.slice(1),"ModePanelControls")}},methods:{handleTabChange:function(e){this.appOptions.currentBreakpoint=e,this.appOptions.currentSize=this.directives.breakpoints[e].width}}};exports.default=o;
|
90 |
+
(function(){var t=exports.default||module.exports;"function"==typeof t&&(t=t.options),Object.assign(t,{render:function(){var t=this.$createElement,e=this._self._c||t;return e("panel-section-group-tabbed",{attrs:{"current-tab":this.appOptions.currentBreakpoint,tabs:this.breakpointsObject,header:this.strings[this.directives.responsiveMode]},on:{tabClicked:this.handleTabChange}},[e(this.currentPanelControls,{tag:"component"})],1)},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
91 |
+
},{"./PanelSectionGroupTabbed":"UchZ","./AutoModePanelControls":"rfRR"}],"Ub7O":[function(require,module,exports) {
|
92 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=l(require("vue")),n=l(require("../containers/ResponsiveApp")),t=l(require("../components/ResponsiveControlsRow")),o=l(require("../functions/WPTB_ControlsManager")),r=l(require("../plugins/filters")),s=l(require("../plugins/strings")),a=l(require("../components/ResponsivePanelGeneralControls")),i=l(require("../components/ResponsivePanelModeControls"));function l(e){return e&&e.__esModule?e:{default:e}}function p(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,o)}return t}function u(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?p(Object(t),!0).forEach(function(n){c(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):p(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function c(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var d={name:"ResponsiveTable",handler:function(l){var p=o.default.getControlData("responsiveMenuData"),c={responsiveEnabled:!1,responsiveMode:"auto",preserveRowColor:!1,modeOptions:{auto:{topRowAsHeader:{desktop:!1,tablet:!1,mobile:!1},cellStackDirection:{desktop:"row",tablet:"row",mobile:"row"},cellsPerRow:{desktop:1,tablet:1,mobile:1}}},breakpoints:p.screenSizes};e.default.use({install:function(e,n){var t=n.components;e.mixin({components:t})}},{components:{ResponsiveControlsRow:t.default}}),e.default.use({install:function(e,n){e.mixin({data:function(){return n.data}})}},{data:{appOptions:{identifyCells:!1,hasLegacyResponsive:!1,currentBreakpoint:"desktop",currentSize:0},directives:c}}),e.default.use(r.default),e.default.use(s.default,p),new e.default({components:{ResponsiveApp:n.default},data:u({mainTableQuery:".wptb-preview-table"},p),template:'<responsive-app :clone-query="mainTableQuery" :screen-sizes="screenSizes" :compare-sizes="compareSizes"></responsive-app>'}).$mount("#".concat(l)),new e.default({components:{ResponsivePanelGeneralControls:a.default},template:"<responsive-panel-general-controls></responsive-panel-general-controls>"}).$mount("#responsiveBuilderLeftPanelGeneralControls"),new e.default({components:{ResponsivePanelModeControls:i.default},data:u({},p),template:"<responsive-panel-mode-controls></responsive-panel-mode-controls>"}).$mount("#responsiveBuilderLeftPanelModeOptions")}};exports.default=d;
|
93 |
+
},{"vue":"HYXJ","../containers/ResponsiveApp":"waBm","../components/ResponsiveControlsRow":"TuCQ","../functions/WPTB_ControlsManager":"WZJa","../plugins/filters":"GZC0","../plugins/strings":"yEip","../components/ResponsivePanelGeneralControls":"DmVJ","../components/ResponsivePanelModeControls":"BxO6"}],"Zn1h":[function(require,module,exports) {
|
94 |
+
|
95 |
+
"use strict";var e=u(require("vue")),t=u(require("./mountPoints/WPTB_IconSelectControl")),n=u(require("./mountPoints/WPTB_RangeControl")),o=u(require("./functions/WPTB_ControlsManager")),r=u(require("./mountPoints/WPTB_ResponsiveTable"));function u(e){return e&&e.__esModule?e:{default:e}}e.default.config.productionTip=!1;var a=self||void 0;a.WPTB_ControlsManager=o.default;var i=[t.default,n.default,o.default,r.default];function l(e){o.default.addControlScript(e.name,e.handler)}i.map(l);
|
96 |
+
},{"vue":"HYXJ","./mountPoints/WPTB_IconSelectControl":"Pn7d","./mountPoints/WPTB_RangeControl":"YVYX","./functions/WPTB_ControlsManager":"WZJa","./mountPoints/WPTB_ResponsiveTable":"Ub7O"}]},{},["Zn1h"], null)
|
inc/admin/js/WPTB_ResponsiveFrontend.js
ADDED
@@ -0,0 +1,1123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Responsive class assignment for frontend operations.
|
3 |
+
*
|
4 |
+
* This file can be used as an UMD.
|
5 |
+
*/
|
6 |
+
(function assignToGlobal(key, context, factory) {
|
7 |
+
if (typeof exports === 'object' && typeof module !== 'undefined') {
|
8 |
+
module.exports = factory();
|
9 |
+
} else {
|
10 |
+
// eslint-disable-next-line no-param-reassign
|
11 |
+
context[key] = factory();
|
12 |
+
}
|
13 |
+
// eslint-disable-next-line no-restricted-globals
|
14 |
+
})('WPTB_ResponsiveFrontend', self || global, () => {
|
15 |
+
/**
|
16 |
+
* Log a message to console.
|
17 |
+
*
|
18 |
+
* @param {string} message message to be logged
|
19 |
+
* @param {string} type console log type (e.g info, warn, error)
|
20 |
+
* @throws An error will be given for invalid type value
|
21 |
+
*/
|
22 |
+
function logToConsole(message, type = 'log') {
|
23 |
+
if (typeof process !== 'undefined' && process.env.NODE_ENV === 'development') {
|
24 |
+
if (console[type]) {
|
25 |
+
console[type](`[WPTB]: ${message}`);
|
26 |
+
} else {
|
27 |
+
throw new Error(`no logging type found with given type value of [${type}]`);
|
28 |
+
}
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Object implementation for cell element operations.
|
34 |
+
* If an empty cellElement parameter is given, a fresh cell element will be created.
|
35 |
+
*
|
36 |
+
* @param {HTMLElement | null} cellElement cell element
|
37 |
+
* @param {null | CellObject} [isReference=null] main cell object if the current cell is a reference to that cell in cases like merged cells
|
38 |
+
* @constructor
|
39 |
+
*/
|
40 |
+
function CellObject(cellElement, reference = null) {
|
41 |
+
// cell element
|
42 |
+
this.element = cellElement;
|
43 |
+
|
44 |
+
this.referenceObject = reference;
|
45 |
+
|
46 |
+
// variable for deciding part of merged cells to be visible or not
|
47 |
+
this.mergedRenderStatus = true;
|
48 |
+
|
49 |
+
// connected merged cell references
|
50 |
+
this.mergedCells = {
|
51 |
+
row: [],
|
52 |
+
column: [],
|
53 |
+
};
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Get merged render status.
|
57 |
+
* @return {boolean} render status
|
58 |
+
*/
|
59 |
+
this.getMergedRenderStatus = () => {
|
60 |
+
return this.mergedRenderStatus;
|
61 |
+
};
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Set merged render status.
|
65 |
+
* @param {boolean} status render status
|
66 |
+
*/
|
67 |
+
this.setMergedRenderStatus = (status) => {
|
68 |
+
this.mergedRenderStatus = status;
|
69 |
+
};
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Add merged cells.
|
73 |
+
*
|
74 |
+
* @param {string} mergeType merge type
|
75 |
+
* @param {CellObject} cellObj cell object instance
|
76 |
+
*/
|
77 |
+
this.addToMergedCells = (mergeType, cellObj) => {
|
78 |
+
this.mergedCells[mergeType].push(cellObj);
|
79 |
+
};
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Determine if current cell is a reference to a main cell.
|
83 |
+
* @return {boolean} a reference or not
|
84 |
+
*/
|
85 |
+
this.isReference = () => {
|
86 |
+
return this.referenceObject !== null;
|
87 |
+
};
|
88 |
+
|
89 |
+
if (this.isReference()) {
|
90 |
+
this.element = cellElement.cloneNode(true);
|
91 |
+
}
|
92 |
+
|
93 |
+
// modifications object
|
94 |
+
// this object will keep track of the modifications that has done to the cell to make sure we can roll them back to their original values
|
95 |
+
this.modifications = {};
|
96 |
+
|
97 |
+
// spans object for cell's original merge values
|
98 |
+
this.spans = {
|
99 |
+
row: 1,
|
100 |
+
col: 1,
|
101 |
+
};
|
102 |
+
|
103 |
+
this.remainingSpans = {
|
104 |
+
row: 0,
|
105 |
+
col: 0,
|
106 |
+
};
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Cache cell element's original span values.
|
110 |
+
* @private
|
111 |
+
*/
|
112 |
+
this.cacheSpanValues = () => {
|
113 |
+
// eslint-disable-next-line array-callback-return
|
114 |
+
Object.keys(this.spans).map((k) => {
|
115 |
+
if (Object.prototype.hasOwnProperty.call(this.spans, k)) {
|
116 |
+
const defaultVal = this.spans[k];
|
117 |
+
|
118 |
+
this.spans[k] = this.element.getAttribute(`${k}Span`) || defaultVal;
|
119 |
+
}
|
120 |
+
});
|
121 |
+
};
|
122 |
+
|
123 |
+
this.cacheSpanValues();
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Get original span value of cell object.
|
127 |
+
*
|
128 |
+
* @param {string} spanType span type, available values are row-column
|
129 |
+
* @param {boolean} fromElement, instead of original value, get the assigned span value from HTMLElement itself
|
130 |
+
* @throws An error will be given for invalid span type
|
131 |
+
*/
|
132 |
+
this.getSpan = (spanType, fromElement = false) => {
|
133 |
+
const spanVal = fromElement ? this.getElement().getAttribute(`${spanType}Span`) : this.spans[spanType];
|
134 |
+
if (spanVal) {
|
135 |
+
return spanVal;
|
136 |
+
}
|
137 |
+
throw new Error(`no span value found with the given type of [${spanType}]`);
|
138 |
+
};
|
139 |
+
|
140 |
+
this.getRemainingSpans = (spanType) => {
|
141 |
+
return this.remainingSpans[spanType];
|
142 |
+
};
|
143 |
+
|
144 |
+
this.setRemainingSpans = (spanType, value) => {
|
145 |
+
this.remainingSpans[spanType] = value;
|
146 |
+
};
|
147 |
+
|
148 |
+
/**
|
149 |
+
* Get cell element.
|
150 |
+
*
|
151 |
+
* @return {HTMLElement} cell element
|
152 |
+
*/
|
153 |
+
this.getElement = () => {
|
154 |
+
return this.element;
|
155 |
+
};
|
156 |
+
|
157 |
+
/**
|
158 |
+
* Create a cell element.
|
159 |
+
* @private
|
160 |
+
* @return {HTMLTableDataCellElement}
|
161 |
+
*/
|
162 |
+
this.createCellElement = () => {
|
163 |
+
return document.createElement('td');
|
164 |
+
};
|
165 |
+
|
166 |
+
// create a new cell element if no cellElement argument is given with constructor function
|
167 |
+
if (!cellElement) {
|
168 |
+
this.element = this.createCellElement();
|
169 |
+
}
|
170 |
+
|
171 |
+
/**
|
172 |
+
* Add attribute to cell element.
|
173 |
+
*
|
174 |
+
* This function have the ability to add/remove attributes from cell element.
|
175 |
+
* All attributes modified with this function will be cached with their before value for an easy reset on demand.
|
176 |
+
*
|
177 |
+
* @param {string} attributeKey attribute name in camelCase format, for sub-keys, use dot object notation
|
178 |
+
* @param {any} attributeValue attribute value
|
179 |
+
* @param {boolean} [append=false] append the value or replace it
|
180 |
+
* @param {string} [glue=,] glue to join attribute value if append option is enabled
|
181 |
+
*/
|
182 |
+
this.setAttribute = (attributeKey, attributeValue, append = false, glue = ',') => {
|
183 |
+
let defaultVal = this.getElement()[attributeKey];
|
184 |
+
|
185 |
+
// if attribute value is a function or an object, it means we pulled a whole declaration instead of only inline attribute values, in that case, use getAttribute to get only inline values related to that attribute
|
186 |
+
if (typeof defaultVal === 'function' || typeof defaultVal === 'object') {
|
187 |
+
defaultVal = this.getElement().getAttribute(attributeKey);
|
188 |
+
}
|
189 |
+
|
190 |
+
// if there is already a default value defined, use that instead
|
191 |
+
if (this.modifications[attributeKey]) {
|
192 |
+
defaultVal = this.modifications[attributeKey].default;
|
193 |
+
}
|
194 |
+
|
195 |
+
let currentVal = defaultVal;
|
196 |
+
|
197 |
+
// join attributes
|
198 |
+
if (append) {
|
199 |
+
currentVal += `${currentVal}${glue}${attributeValue}`;
|
200 |
+
} else {
|
201 |
+
currentVal = attributeValue;
|
202 |
+
}
|
203 |
+
|
204 |
+
this.modifications[attributeKey] = { value: currentVal, default: defaultVal };
|
205 |
+
|
206 |
+
this.getElement()[attributeKey] = currentVal;
|
207 |
+
};
|
208 |
+
|
209 |
+
/**
|
210 |
+
* Set row/colspan for cell.
|
211 |
+
*
|
212 |
+
* @param {string} spanType span type
|
213 |
+
* @param {number} value value to assign to span
|
214 |
+
* @return {boolean} if any space left to render the element
|
215 |
+
*/
|
216 |
+
this.setSpan = (spanType, value) => {
|
217 |
+
// working on main cell
|
218 |
+
if (!this.isReference()) {
|
219 |
+
const valueToApply = this.getSpan(spanType) - value < 0 ? this.getSpan(spanType) : value;
|
220 |
+
|
221 |
+
this.setAttribute(`${spanType}Span`, valueToApply);
|
222 |
+
|
223 |
+
// calculate remaining cells amount to merge in this span type
|
224 |
+
this.setRemainingSpans(spanType, this.getSpan(spanType) - valueToApply);
|
225 |
+
|
226 |
+
// set visibility of connected merge group cells to false to not render them since we added necessary span values to main cell which will leak into their position
|
227 |
+
for (let mc = 0; mc < valueToApply - 1; mc += 1) {
|
228 |
+
this.mergedCells[spanType][mc].setMergedRenderStatus(false);
|
229 |
+
}
|
230 |
+
|
231 |
+
return true;
|
232 |
+
}
|
233 |
+
// working on reference
|
234 |
+
|
235 |
+
if (!this.getMergedRenderStatus()) {
|
236 |
+
return false;
|
237 |
+
}
|
238 |
+
|
239 |
+
const remainingVal = this.referenceObject.getRemainingSpans(spanType);
|
240 |
+
|
241 |
+
// no space left to put cell
|
242 |
+
if (remainingVal === 0) {
|
243 |
+
return false;
|
244 |
+
}
|
245 |
+
|
246 |
+
const valueToApply = remainingVal - value < 0 ? remainingVal : value;
|
247 |
+
|
248 |
+
const remainingParentSpans = remainingVal - valueToApply;
|
249 |
+
this.referenceObject.setRemainingSpans(spanType, remainingParentSpans);
|
250 |
+
|
251 |
+
this.setAttribute(`${spanType}Span`, valueToApply);
|
252 |
+
|
253 |
+
// change render status of remaining connected merge cells
|
254 |
+
if (remainingParentSpans !== 0) {
|
255 |
+
const totalConnectedCells = this.referenceObject.mergedCells[spanType].length;
|
256 |
+
const startIndex = totalConnectedCells - remainingVal + 1;
|
257 |
+
const endIndex = startIndex + valueToApply - 1;
|
258 |
+
|
259 |
+
for (let mc = startIndex; mc < endIndex; mc += 1) {
|
260 |
+
this.mergedCells[spanType][mc].setMergedRenderStatus(false);
|
261 |
+
}
|
262 |
+
}
|
263 |
+
|
264 |
+
return true;
|
265 |
+
};
|
266 |
+
|
267 |
+
/**
|
268 |
+
* Reset a modified attribute to its default value
|
269 |
+
*
|
270 |
+
* @param {string} attributeKey attribute name
|
271 |
+
*/
|
272 |
+
this.resetAttribute = (attributeKey) => {
|
273 |
+
if (this.modifications[attributeKey]) {
|
274 |
+
this.getElement()[attributeKey] = this.modifications[attributeKey].default;
|
275 |
+
this.modifications[attributeKey] = undefined;
|
276 |
+
}
|
277 |
+
};
|
278 |
+
|
279 |
+
/**
|
280 |
+
* Reset all modified attributes of cell element to their default values.
|
281 |
+
*/
|
282 |
+
this.resetAllAttributes = () => {
|
283 |
+
// eslint-disable-next-line array-callback-return
|
284 |
+
Object.keys(this.modifications).map((k) => {
|
285 |
+
if (Object.prototype.hasOwnProperty.call(this.modifications, k)) {
|
286 |
+
this.resetAttribute(k);
|
287 |
+
}
|
288 |
+
});
|
289 |
+
};
|
290 |
+
|
291 |
+
return {
|
292 |
+
getElement: this.getElement,
|
293 |
+
el: this.element,
|
294 |
+
setAttribute: this.setAttribute,
|
295 |
+
resetAllAttributes: this.resetAllAttributes,
|
296 |
+
getSpan: this.getSpan,
|
297 |
+
setSpan: this.setSpan,
|
298 |
+
getRemainingSpans: this.getRemainingSpans,
|
299 |
+
setRemainingSpans: this.setRemainingSpans,
|
300 |
+
isReference: this.isReference,
|
301 |
+
addToMergedCells: this.addToMergedCells,
|
302 |
+
mergedCells: this.mergedCells,
|
303 |
+
setMergedRenderStatus: this.setMergedRenderStatus,
|
304 |
+
getMergedRenderStatus: this.getMergedRenderStatus,
|
305 |
+
};
|
306 |
+
}
|
307 |
+
|
308 |
+
CellObject.spanTypes = { row: 'row', column: 'col' };
|
309 |
+
|
310 |
+
/**
|
311 |
+
* Object implementation for table element operations.
|
312 |
+
*
|
313 |
+
* @param {HTMLElement} tableEl table element
|
314 |
+
* @return {object} instance
|
315 |
+
* @constructor
|
316 |
+
*/
|
317 |
+
function TableObject(tableEl) {
|
318 |
+
/**
|
319 |
+
* Table element.
|
320 |
+
* @private
|
321 |
+
* @type {HTMLElement}
|
322 |
+
*/
|
323 |
+
this.tableElement = tableEl;
|
324 |
+
|
325 |
+
/**
|
326 |
+
* Parsed table object.
|
327 |
+
*
|
328 |
+
* @private
|
329 |
+
* @type {array}
|
330 |
+
*/
|
331 |
+
this.parsedTable = [];
|
332 |
+
|
333 |
+
/**
|
334 |
+
* An array of created table rows elements that are id'd according to their index in array.
|
335 |
+
* @type {[HTMLElement]}
|
336 |
+
*/
|
337 |
+
this.rowCache = [];
|
338 |
+
|
339 |
+
/**
|
340 |
+
* Original table elements minus the cells.
|
341 |
+
* @type {{rows: []}}
|
342 |
+
* @private
|
343 |
+
*/
|
344 |
+
this.originals = { rows: [] };
|
345 |
+
|
346 |
+
/**
|
347 |
+
* Row colors of original table.
|
348 |
+
* @type {{even: string, header: string, odd: string}}
|
349 |
+
*/
|
350 |
+
this.rowColors = {
|
351 |
+
header: null,
|
352 |
+
even: null,
|
353 |
+
odd: null,
|
354 |
+
};
|
355 |
+
|
356 |
+
/**
|
357 |
+
* Add cell to parsed array.
|
358 |
+
*
|
359 |
+
* @private
|
360 |
+
* @param {number} r row id
|
361 |
+
* @param {number} c column id
|
362 |
+
* @param {CellObject} cellObject cell object to add to parsed array
|
363 |
+
*/
|
364 |
+
this.addToParsed = (r, c, cellObject) => {
|
365 |
+
if (!this.parsedTable[r]) {
|
366 |
+
this.parsedTable[r] = [];
|
367 |
+
}
|
368 |
+
|
369 |
+
this.parsedTable[r][c] = cellObject;
|
370 |
+
};
|
371 |
+
|
372 |
+
/**
|
373 |
+
* Assign table cells into row and column numbers.
|
374 |
+
* @private
|
375 |
+
*/
|
376 |
+
this.parseTable = () => {
|
377 |
+
const rows = Array.from(this.tableElement.querySelectorAll('tr'));
|
378 |
+
|
379 |
+
// eslint-disable-next-line array-callback-return
|
380 |
+
rows.map((r, ri) => {
|
381 |
+
// cache original rows for future use
|
382 |
+
this.originals.rows.push(r);
|
383 |
+
|
384 |
+
const cells = Array.from(r.querySelectorAll('td'));
|
385 |
+
|
386 |
+
// eslint-disable-next-line array-callback-return
|
387 |
+
cells.map((c, ci) => {
|
388 |
+
const currentCellObject = new CellObject(c);
|
389 |
+
this.addToParsed(ri, ci, currentCellObject);
|
390 |
+
|
391 |
+
const spanRow = currentCellObject.getSpan(CellObject.spanTypes.row);
|
392 |
+
const spanCol = currentCellObject.getSpan(CellObject.spanTypes.column);
|
393 |
+
|
394 |
+
if (spanRow > 1) {
|
395 |
+
for (let sr = 1; sr < spanRow; sr += 1) {
|
396 |
+
const referenceCell = new CellObject(c, currentCellObject);
|
397 |
+
currentCellObject.addToMergedCells('row', referenceCell);
|
398 |
+
this.addToParsed(ri + sr, ci, referenceCell);
|
399 |
+
}
|
400 |
+
}
|
401 |
+
if (spanCol > 1) {
|
402 |
+
for (let sc = 1; sc < spanCol; sc += 1) {
|
403 |
+
const referenceCell = new CellObject(c, currentCellObject);
|
404 |
+
currentCellObject.addToMergedCells('column', referenceCell);
|
405 |
+
this.addToParsed(ri, ci + sc, referenceCell);
|
406 |
+
}
|
407 |
+
}
|
408 |
+
});
|
409 |
+
});
|
410 |
+
this.parseRowColors(rows);
|
411 |
+
};
|
412 |
+
|
413 |
+
/**
|
414 |
+
* Parse row colors of original table for futures uses.
|
415 |
+
* @param {[HTMLElement]} rows html row elements
|
416 |
+
* @private
|
417 |
+
*/
|
418 |
+
this.parseRowColors = (rows) => {
|
419 |
+
if (!rows || rows.length <= 0) {
|
420 |
+
logToConsole('no rows are found to parse their colors', 'error');
|
421 |
+
}
|
422 |
+
|
423 |
+
// header row color
|
424 |
+
this.rowColors.header = rows[0].style.backgroundColor === '' ? null : rows[0].style.backgroundColor;
|
425 |
+
|
426 |
+
// calculate needed number of rows to get even and odd row background colors
|
427 |
+
// eslint-disable-next-line no-nested-ternary
|
428 |
+
const rowsNeeded = rows.length / 3 >= 1 ? 0 : rows.length === 1 ? 2 : (rows.length - 1) % 2;
|
429 |
+
|
430 |
+
// create additional rows and add them to table to get their row background colors since table row count may be lower to get even/odd rows
|
431 |
+
for (let rn = 0; rn < rowsNeeded; rn += 1) {
|
432 |
+
const tempRow = document.createElement('tr');
|
433 |
+
|
434 |
+
this.tableElement.querySelector('tbody').appendChild(tempRow);
|
435 |
+
rows.push(tempRow);
|
436 |
+
}
|
437 |
+
|
438 |
+
// even & odd row colors
|
439 |
+
this.rowColors.even = getComputedStyle(rows[1]).backgroundColor;
|
440 |
+
this.rowColors.odd = getComputedStyle(rows[2]).backgroundColor;
|
441 |
+
|
442 |
+
// remove created rows from DOM
|
443 |
+
for (let r = 0; r < rowsNeeded; r += 1) {
|
444 |
+
rows[rows.length - (r + 1)].remove();
|
445 |
+
}
|
446 |
+
};
|
447 |
+
|
448 |
+
/**
|
449 |
+
* Add a row to the table.
|
450 |
+
* @param {array} classList an array of class names to be added to row
|
451 |
+
* @param {boolean} fromOriginals use rows from original table instead of creating a new one
|
452 |
+
* @param {number} originalIndex original row index
|
453 |
+
*/
|
454 |
+
this.addRow = (classList, fromOriginals = false, originalIndex = 0) => {
|
455 |
+
if (!Array.isArray(classList)) {
|
456 |
+
// eslint-disable-next-line no-param-reassign
|
457 |
+
classList = [classList];
|
458 |
+
}
|
459 |
+
|
460 |
+
const tableBody = this.tableElement.querySelector('tbody');
|
461 |
+
let tempRow;
|
462 |
+
|
463 |
+
if (!fromOriginals) {
|
464 |
+
const range = document.createRange();
|
465 |
+
range.setStart(tableBody, 0);
|
466 |
+
// eslint-disable-next-line prefer-destructuring
|
467 |
+
tempRow = range.createContextualFragment(`<tr class="${classList.join(' ')}"></tr>`).childNodes[0];
|
468 |
+
} else {
|
469 |
+
tempRow = this.originals.rows[originalIndex];
|
470 |
+
}
|
471 |
+
|
472 |
+
// add row to table body
|
473 |
+
tableBody.appendChild(tempRow);
|
474 |
+
|
475 |
+
// cache row for future use
|
476 |
+
this.rowCache.push(tempRow);
|
477 |
+
|
478 |
+
return { el: tempRow, id: this.rowCache.length - 1 };
|
479 |
+
};
|
480 |
+
|
481 |
+
/**
|
482 |
+
* Clear the contents of table element.
|
483 |
+
*/
|
484 |
+
this.clearTable = () => {
|
485 |
+
// clear row cache
|
486 |
+
this.rowCache = [];
|
487 |
+
|
488 |
+
// clear children of `tbody` element
|
489 |
+
this.tableElement.querySelector('tbody').innerHTML = '';
|
490 |
+
};
|
491 |
+
|
492 |
+
/**
|
493 |
+
* Get row element from cache.
|
494 |
+
*
|
495 |
+
* @param {number} id row id
|
496 |
+
* @return {null|HTMLElement} row element if present or null if not
|
497 |
+
*/
|
498 |
+
this.getRow = (id) => {
|
499 |
+
if (this.rowCache[id]) {
|
500 |
+
return this.rowCache[id];
|
501 |
+
}
|
502 |
+
|
503 |
+
// eslint-disable-next-line no-console
|
504 |
+
logToConsole(`no row with id [${id}] found in the cache.`, 'warn');
|
505 |
+
return null;
|
506 |
+
};
|
507 |
+
|
508 |
+
/**
|
509 |
+
* Get maximum number of rows available at table.
|
510 |
+
*
|
511 |
+
* @return {number} maximum amount of rows
|
512 |
+
*/
|
513 |
+
this.maxRows = () => {
|
514 |
+
return this.parsedTable.length;
|
515 |
+
};
|
516 |
+
|
517 |
+
/**
|
518 |
+
* Get the number of maximum available column count in the table.
|
519 |
+
*
|
520 |
+
* @return {number} maximum available column count
|
521 |
+
*/
|
522 |
+
this.maxColumns = () => {
|
523 |
+
return this.parsedTable.reduce((p, c) => {
|
524 |
+
if (c.length > p) {
|
525 |
+
// eslint-disable-next-line no-param-reassign
|
526 |
+
p = c.length;
|
527 |
+
}
|
528 |
+
|
529 |
+
return p;
|
530 |
+
}, 0);
|
531 |
+
};
|
532 |
+
|
533 |
+
/**
|
534 |
+
* Get the table cell at specified row-column location.
|
535 |
+
*
|
536 |
+
* As in arrays, row and column numbering starts from number 0.
|
537 |
+
*
|
538 |
+
* @param {number} r row number
|
539 |
+
* @param {number} c column number
|
540 |
+
* @param {boolean} returnObject return object instead of HTMLElement
|
541 |
+
* @return {HTMLElement | null | CellObject} element if address is possible, null if not
|
542 |
+
*/
|
543 |
+
this.getCell = (r, c, returnObject = false) => {
|
544 |
+
try {
|
545 |
+
if (this.parsedTable[r][c]) {
|
546 |
+
if (returnObject) {
|
547 |
+
return this.parsedTable[r][c];
|
548 |
+
}
|
549 |
+
return this.parsedTable[r][c].el;
|
550 |
+
}
|
551 |
+
} catch (e) {
|
552 |
+
// eslint-disable-next-line no-console
|
553 |
+
logToConsole(`no cell found at the given address of [${r}-${c}]`, 'warn');
|
554 |
+
return null;
|
555 |
+
}
|
556 |
+
// eslint-disable-next-line no-console
|
557 |
+
logToConsole(`no cell found at the given address of [${r}-${c}]`, 'warn');
|
558 |
+
return null;
|
559 |
+
};
|
560 |
+
|
561 |
+
/**
|
562 |
+
* Get cells at a given row.
|
563 |
+
*
|
564 |
+
* @param {number} rowId row id
|
565 |
+
* @param {boolean} returnObj return an array of CellObject instead
|
566 |
+
* @return {array} cells in row
|
567 |
+
*/
|
568 |
+
this.getCellsAtRow = (rowId, returnObj = false) => {
|
569 |
+
const cells = [];
|
570 |
+
for (let c = 0; c < this.maxColumns(); c += 1) {
|
571 |
+
const tempCell = this.getCell(rowId, c, returnObj);
|
572 |
+
if (tempCell) {
|
573 |
+
cells.push(tempCell);
|
574 |
+
}
|
575 |
+
}
|
576 |
+
return cells;
|
577 |
+
};
|
578 |
+
|
579 |
+
/**
|
580 |
+
* Append the cell with given ids to a cached row
|
581 |
+
*
|
582 |
+
* @param {number} cellRowId cell row id
|
583 |
+
* @param {number} cellColumnId cell column id
|
584 |
+
* @param {number} rowId id of row in row cache
|
585 |
+
*/
|
586 |
+
this.appendToRow = (cellRowId, cellColumnId, rowId) => {
|
587 |
+
const cachedRow = this.getRow(rowId);
|
588 |
+
const cell = this.getCell(cellRowId, cellColumnId, true);
|
589 |
+
|
590 |
+
if (cell && cachedRow) {
|
591 |
+
cachedRow.appendChild(cell.getElement());
|
592 |
+
}
|
593 |
+
return cell;
|
594 |
+
};
|
595 |
+
|
596 |
+
/**
|
597 |
+
* Append html element to a cached row.
|
598 |
+
*
|
599 |
+
* @param {HTMLElement} el element
|
600 |
+
* @param {number} rowId if of row in row cache
|
601 |
+
*/
|
602 |
+
this.appendElementToRow = (el, rowId) => {
|
603 |
+
const cachedRow = this.getRow(rowId);
|
604 |
+
|
605 |
+
if (el && cachedRow) {
|
606 |
+
cachedRow.appendChild(el);
|
607 |
+
}
|
608 |
+
};
|
609 |
+
|
610 |
+
/**
|
611 |
+
* Add cell object to a cached row.
|
612 |
+
*
|
613 |
+
* @param {CellObject} cellObj cell object
|
614 |
+
* @param {number} rowId row id
|
615 |
+
*/
|
616 |
+
this.appendObjectToRow = (cellObj, rowId) => {
|
617 |
+
const cachedRow = this.getRow(rowId);
|
618 |
+
if (cellObj && cachedRow) {
|
619 |
+
cachedRow.appendChild(cellObj.getElement());
|
620 |
+
}
|
621 |
+
};
|
622 |
+
|
623 |
+
this.parseTable();
|
624 |
+
|
625 |
+
return {
|
626 |
+
maxRows: this.maxRows,
|
627 |
+
maxColumns: this.maxColumns,
|
628 |
+
addRow: this.addRow,
|
629 |
+
clearTable: this.clearTable,
|
630 |
+
getCell: this.getCell,
|
631 |
+
appendToRow: this.appendToRow,
|
632 |
+
appendElementToRow: this.appendElementToRow,
|
633 |
+
appendObjectToRow: this.appendObjectToRow,
|
634 |
+
getCellsAtRow: this.getCellsAtRow,
|
635 |
+
el: this.tableElement,
|
636 |
+
rowColors: this.rowColors,
|
637 |
+
};
|
638 |
+
}
|
639 |
+
|
640 |
+
// default options for responsive class
|
641 |
+
const responsiveClassDefaultOptions = {
|
642 |
+
query: '.wptb-preview-table',
|
643 |
+
defaultClasses: ['wptb-plugin-responsive-base'],
|
644 |
+
bindToResize: false,
|
645 |
+
};
|
646 |
+
|
647 |
+
/**
|
648 |
+
* Class for handling operations related to responsive functionalities of tables.
|
649 |
+
*
|
650 |
+
* @constructor
|
651 |
+
* @param {object} options options object
|
652 |
+
*/
|
653 |
+
function ResponsiveFront(options = {}) {
|
654 |
+
// merge default options with user sent options
|
655 |
+
this.options = { ...responsiveClassDefaultOptions, ...options };
|
656 |
+
|
657 |
+
this.elements = Array.from(document.querySelectorAll(this.options.query));
|
658 |
+
|
659 |
+
this.elementObjects = this.elements.map((e) => {
|
660 |
+
return {
|
661 |
+
el: e,
|
662 |
+
tableObject: new TableObject(e),
|
663 |
+
};
|
664 |
+
});
|
665 |
+
|
666 |
+
/**
|
667 |
+
* Bind rebuilding of tables to window resize event.
|
668 |
+
*/
|
669 |
+
this.bindRebuildToResize = () => {
|
670 |
+
window.addEventListener('resize', (e) => {
|
671 |
+
this.rebuildTables(e.target.innerWidth);
|
672 |
+
});
|
673 |
+
};
|
674 |
+
|
675 |
+
/**
|
676 |
+
* Get responsive directives of table element.
|
677 |
+
*
|
678 |
+
* @private
|
679 |
+
* @param {HTMLElement} el table element
|
680 |
+
* @return {object|null} JSON representation of the directive element, if not available, null will be returned
|
681 |
+
*/
|
682 |
+
this.getDirective = (el) => {
|
683 |
+
const directiveString = el.dataset.wptbResponsiveDirectives;
|
684 |
+
|
685 |
+
if (!directiveString) {
|
686 |
+
return null;
|
687 |
+
}
|
688 |
+
|
689 |
+
return JSON.parse(atob(directiveString));
|
690 |
+
};
|
691 |
+
|
692 |
+
/**
|
693 |
+
* Add default classes to rebuilt tables.
|
694 |
+
*
|
695 |
+
* This classes are added to lay out a base style for the responsive table.
|
696 |
+
*
|
697 |
+
* @param {HTMLElement} el table element
|
698 |
+
*/
|
699 |
+
this.addDefaultClasses = (el) => {
|
700 |
+
el.classList.add(this.options.defaultClasses);
|
701 |
+
};
|
702 |
+
|
703 |
+
/**
|
704 |
+
* Remove default classes from target table.
|
705 |
+
* @param {HTMLElement} el table element
|
706 |
+
*/
|
707 |
+
this.removeDefaultClasses = (el) => {
|
708 |
+
el.classList.remove(this.options.defaultClasses);
|
709 |
+
};
|
710 |
+
|
711 |
+
/**
|
712 |
+
* Rebuild table in auto mode.
|
713 |
+
*
|
714 |
+
* Main characteristic of auto mode is table is rebuilt by stacking rows/columns on top of each other, leaving minimal effort from user to create a responsive table at breakpoints.
|
715 |
+
*
|
716 |
+
* @param {HTMLElement} tableEl table element
|
717 |
+
* @param {string} sizeRange range id for current screen size
|
718 |
+
* @param {object} autoOption mode options
|
719 |
+
* @param {TableObject} tableObj table object
|
720 |
+
*/
|
721 |
+
this.autoBuild = (tableEl, sizeRange, autoOption, tableObj) => {
|
722 |
+
const direction = autoOption.cellStackDirection[sizeRange];
|
723 |
+
// eslint-disable-next-line prefer-destructuring
|
724 |
+
const topRowAsHeader = autoOption.topRowAsHeader[sizeRange];
|
725 |
+
|
726 |
+
const cellsPerRow = autoOption.cellsPerRow[sizeRange];
|
727 |
+
|
728 |
+
tableObj.clearTable();
|
729 |
+
|
730 |
+
if (sizeRange === 'desktop') {
|
731 |
+
this.buildDefault(tableObj);
|
732 |
+
this.removeDefaultClasses(tableEl);
|
733 |
+
} else {
|
734 |
+
this.autoDirectionBuild(tableObj, direction, topRowAsHeader, cellsPerRow);
|
735 |
+
this.addDefaultClasses(tableEl);
|
736 |
+
}
|
737 |
+
};
|
738 |
+
|
739 |
+
/**
|
740 |
+
* Rebuild table with a direction to read cells.
|
741 |
+
*
|
742 |
+
* Direction in question in here is either by row or column:
|
743 |
+
* * row: cells will be read row by row, in each row starting from the first column
|
744 |
+
* * column: cells will be read column by column, in each column starting from the first row of the table
|
745 |
+
*
|
746 |
+
* @param {TableObject} tableObj table object
|
747 |
+
* @param {string} direction direction to read cells, possible options [row, column]
|
748 |
+
* @param {boolean} topRowAsHeader use top row as header
|
749 |
+
* @param {number} cellsPerRow cells per row
|
750 |
+
*/
|
751 |
+
this.autoDirectionBuild = (tableObj, direction, topRowAsHeader = false, cellsPerRow = 1) => {
|
752 |
+
const rows = tableObj.maxRows();
|
753 |
+
const columns = tableObj.maxColumns();
|
754 |
+
const isRowStacked = direction === 'row';
|
755 |
+
|
756 |
+
// build table with top row as header
|
757 |
+
if (topRowAsHeader) {
|
758 |
+
this.headerBuild(tableObj, direction, cellsPerRow);
|
759 |
+
} else {
|
760 |
+
// cell stack direction is selected as row
|
761 |
+
// for future new functionality additions, keep different cell stack direction logic separate instead of generalizing the inner logic
|
762 |
+
// eslint-disable-next-line no-lonely-if
|
763 |
+
if (isRowStacked) {
|
764 |
+
const allCellsByRow = [];
|
765 |
+
|
766 |
+
// get cells by reading row by row
|
767 |
+
for (let r = 0; r < rows; r += 1) {
|
768 |
+
// eslint-disable-next-line no-loop-func
|
769 |
+
tableObj.getCellsAtRow(r, true).forEach((c) => allCellsByRow.push(c));
|
770 |
+
}
|
771 |
+
|
772 |
+
const cellCount = allCellsByRow.length;
|
773 |
+
|
774 |
+
for (let c = 0, r = 0; c < cellCount; c += cellsPerRow, r += 1) {
|
775 |
+
// const rowId = tableObj.addRow('wptb-row').id;
|
776 |
+
const rowObj = tableObj.addRow('wptb-row');
|
777 |
+
|
778 |
+
// preserve original row colors for even and odd rows
|
779 |
+
rowObj.el.style.backgroundColor = tableObj.rowColors[r % 2 === 0 ? 'odd' : 'even'];
|
780 |
+
|
781 |
+
// place cells by 'cells by row' option value
|
782 |
+
for (let pR = 0; pR < cellsPerRow; pR += 1) {
|
783 |
+
const tempCell = allCellsByRow[c + pR];
|
784 |
+
|
785 |
+
if (tempCell) {
|
786 |
+
tableObj.appendElementToRow(tempCell.getElement(), rowObj.id);
|
787 |
+
|
788 |
+
tempCell.resetAllAttributes();
|
789 |
+
tempCell.setAttribute('style', 'width: 100% !important', true, ';');
|
790 |
+
tempCell.setAttribute('colSpan', 1);
|
791 |
+
tempCell.setAttribute('rowSpan', 1);
|
792 |
+
}
|
793 |
+
}
|
794 |
+
}
|
795 |
+
}
|
796 |
+
// cell stack direction is selected as column
|
797 |
+
else {
|
798 |
+
const allCellsByCol = [];
|
799 |
+
const rowStartIndex = 0;
|
800 |
+
|
801 |
+
// read all cells column by column
|
802 |
+
for (let c = 0; c < columns; c += 1) {
|
803 |
+
for (let r = rowStartIndex; r < rows; r += 1) {
|
804 |
+
const tCell = tableObj.getCell(r, c, true);
|
805 |
+
if (tCell) {
|
806 |
+
allCellsByCol.push(tCell);
|
807 |
+
}
|
808 |
+
}
|
809 |
+
}
|
810 |
+
|
811 |
+
const cellCount = allCellsByCol.length;
|
812 |
+
|
813 |
+
for (let c = 0, r = 0; c < cellCount; c += cellsPerRow, r += 1) {
|
814 |
+
const rowObj = tableObj.addRow('wptb-row');
|
815 |
+
|
816 |
+
// preserve original row colors for even and odd rows
|
817 |
+
rowObj.el.style.backgroundColor = tableObj.rowColors[r % 2 === 0 ? 'odd' : 'even'];
|
818 |
+
|
819 |
+
for (let cR = 0; cR < cellsPerRow; cR += 1) {
|
820 |
+
const tempCell = allCellsByCol[c + cR];
|
821 |
+
|
822 |
+
if (tempCell) {
|
823 |
+
tableObj.appendElementToRow(tempCell.getElement(), rowObj.id);
|
824 |
+
|
825 |
+
tempCell.resetAllAttributes();
|
826 |
+
tempCell.setAttribute('style', 'width: 100% !important', true, ';');
|
827 |
+
tempCell.setAttribute('colSpan', 1);
|
828 |
+
tempCell.setAttribute('rowSpan', 1);
|
829 |
+
}
|
830 |
+
}
|
831 |
+
}
|
832 |
+
}
|
833 |
+
}
|
834 |
+
};
|
835 |
+
|
836 |
+
/**
|
837 |
+
* Build table with top row assigned as header.
|
838 |
+
*
|
839 |
+
* @param {TableObject} tableObj table object
|
840 |
+
* @param {string} direction cell stack direction, possible options are [row, column]
|
841 |
+
* @param {number} itemsPerHeader items bound to each header element
|
842 |
+
*/
|
843 |
+
this.headerBuild = (tableObj, direction, itemsPerHeader = 1) => {
|
844 |
+
// cells at header
|
845 |
+
// applying header row color to cells
|
846 |
+
const headerCells = tableObj.getCellsAtRow(0, true).map((h) => {
|
847 |
+
h.setAttribute('style', `background-color: ${tableObj.rowColors.header}`, true, ';');
|
848 |
+
return h;
|
849 |
+
});
|
850 |
+
|
851 |
+
const stackedAsColumn = direction === 'column';
|
852 |
+
|
853 |
+
// row count
|
854 |
+
const rows = tableObj.maxRows();
|
855 |
+
// column count
|
856 |
+
const columns = tableObj.maxColumns();
|
857 |
+
|
858 |
+
const rowBorderStyle = '3px solid gray';
|
859 |
+
|
860 |
+
// stack direction is column
|
861 |
+
if (stackedAsColumn) {
|
862 |
+
/**
|
863 |
+
* Add header cells as new row to table.
|
864 |
+
* @param {boolean} addBorder add top border to header row
|
865 |
+
*/
|
866 |
+
// eslint-disable-next-line no-inner-declarations
|
867 |
+
function addHeaderCells(addBorder = false) {
|
868 |
+
const rowObj = tableObj.addRow('wptb-row');
|
869 |
+
|
870 |
+
if (addBorder) {
|
871 |
+
rowObj.el.style.borderTop = rowBorderStyle;
|
872 |
+
}
|
873 |
+
|
874 |
+
// eslint-disable-next-line array-callback-return
|
875 |
+
headerCells.map((h) => {
|
876 |
+
// clone header cell to reuse it for multiple rows
|
877 |
+
tableObj.appendElementToRow(h.el.cloneNode(true), rowObj.id);
|
878 |
+
});
|
879 |
+
}
|
880 |
+
|
881 |
+
// count of header rows that will be created
|
882 |
+
const headerCount = Math.ceil((rows - 1) / itemsPerHeader);
|
883 |
+
// row index on original table
|
884 |
+
let currentOriginalRow = 1;
|
885 |
+
for (let r = 0; r < headerCount; r += 1) {
|
886 |
+
// create header row and add to table
|
887 |
+
addHeaderCells(r > 0);
|
888 |
+
for (let c = 0; c < itemsPerHeader; c += 1) {
|
889 |
+
// break iteration when current row surpasses original row amount
|
890 |
+
if (currentOriginalRow >= rows) {
|
891 |
+
break;
|
892 |
+
}
|
893 |
+
const rowObj = tableObj.addRow('wptb-row');
|
894 |
+
|
895 |
+
// apply row color relative to current header row
|
896 |
+
rowObj.el.style.backgroundColor = tableObj.rowColors[c % 2 === 0 ? 'even' : 'odd'];
|
897 |
+
for (let cc = 0; cc < columns; cc += 1) {
|
898 |
+
const currentCell = tableObj.getCell(currentOriginalRow, cc, true);
|
899 |
+
|
900 |
+
if (currentCell) {
|
901 |
+
currentCell.resetAllAttributes();
|
902 |
+
|
903 |
+
// status to decide whether render cell or not
|
904 |
+
let cellAddStatus = true;
|
905 |
+
|
906 |
+
const rowSpan = currentCell.getSpan(CellObject.spanTypes.row);
|
907 |
+
const colSpan = currentCell.getSpan(CellObject.spanTypes.column);
|
908 |
+
|
909 |
+
if (rowSpan > 1) {
|
910 |
+
// items remaining in current header
|
911 |
+
const remainingItems = itemsPerHeader - c;
|
912 |
+
|
913 |
+
// calculate whether to apply full rowspan value or remaining item value depending on the current position of the cell
|
914 |
+
const currentRowSpan = Math.min(rowSpan, remainingItems);
|
915 |
+
|
916 |
+
cellAddStatus = currentCell.setSpan(CellObject.spanTypes.row, currentRowSpan);
|
917 |
+
// reset render status of cell to visible for future use
|
918 |
+
currentCell.setMergedRenderStatus(true);
|
919 |
+
}
|
920 |
+
|
921 |
+
if (cellAddStatus) {
|
922 |
+
tableObj.appendObjectToRow(currentCell, rowObj.id);
|
923 |
+
}
|
924 |
+
}
|
925 |
+
}
|
926 |
+
currentOriginalRow += 1;
|
927 |
+
}
|
928 |
+
}
|
929 |
+
} else {
|
930 |
+
// stack direction is row
|
931 |
+
// number of headers that will be created
|
932 |
+
const headerCount = Math.ceil((rows - 1) / itemsPerHeader);
|
933 |
+
|
934 |
+
let currentOriginalRow = 1;
|
935 |
+
|
936 |
+
for (let hc = 0; hc < headerCount; hc += 1) {
|
937 |
+
for (let c = 0; c < columns; c += 1) {
|
938 |
+
const rowObj = tableObj.addRow('wptb-row');
|
939 |
+
|
940 |
+
// clear out row color to override row color with cell colors
|
941 |
+
rowObj.el.style.backgroundColor = 'none';
|
942 |
+
|
943 |
+
if (hc > 0 && c === 0) {
|
944 |
+
rowObj.el.style.borderTop = rowBorderStyle;
|
945 |
+
}
|
946 |
+
|
947 |
+
const clonedHeaderCell = headerCells[c].el.cloneNode(true);
|
948 |
+
|
949 |
+
// apply header row color to header cell
|
950 |
+
clonedHeaderCell.style.backgroundColor = `${tableObj.rowColors.header} !important`;
|
951 |
+
|
952 |
+
tableObj.appendElementToRow(clonedHeaderCell, rowObj.id);
|
953 |
+
|
954 |
+
for (let r = 0; r < itemsPerHeader; r += 1) {
|
955 |
+
if (currentOriginalRow + r >= rows) {
|
956 |
+
break;
|
957 |
+
}
|
958 |
+
|
959 |
+
// const currentCell = tableObj.appendToRow(currentOriginalRow + r, c, rowObj.id);
|
960 |
+
const currentCell = tableObj.getCell(currentOriginalRow + r, c, true);
|
961 |
+
|
962 |
+
if (currentCell) {
|
963 |
+
currentCell.resetAllAttributes();
|
964 |
+
|
965 |
+
let cellAddStatus = true;
|
966 |
+
|
967 |
+
const rowSpan = currentCell.getSpan(CellObject.spanTypes.row);
|
968 |
+
const colSpan = currentCell.getSpan(CellObject.spanTypes.column);
|
969 |
+
|
970 |
+
if (rowSpan > 1) {
|
971 |
+
const remainingItems = itemsPerHeader - r;
|
972 |
+
|
973 |
+
const currentRowSpan = Math.min(rowSpan, remainingItems);
|
974 |
+
|
975 |
+
cellAddStatus = currentCell.setSpan(CellObject.spanTypes.row, currentRowSpan);
|
976 |
+
|
977 |
+
const rS = currentCell.el.getAttribute('rowSpan');
|
978 |
+
const cS = currentCell.el.getAttribute('colSpan');
|
979 |
+
|
980 |
+
// switch span values
|
981 |
+
currentCell.setAttribute('rowSpan', cS);
|
982 |
+
currentCell.setAttribute('colSpan', rS);
|
983 |
+
|
984 |
+
currentCell.setMergedRenderStatus(true);
|
985 |
+
}
|
986 |
+
if (cellAddStatus) {
|
987 |
+
// color index for the cell, this will be used to reflect table row colors to cells. currently, grouping up the same items with the same color code
|
988 |
+
let colorIndex = (currentOriginalRow + r + hc) % 2 === 0 ? 'even' : 'odd';
|
989 |
+
|
990 |
+
// for better visuals and distinction for tables with 1 item per header, using this calculation for color index
|
991 |
+
if (itemsPerHeader === 1) {
|
992 |
+
colorIndex = currentOriginalRow % 2 === 0 ? 'even' : 'odd';
|
993 |
+
}
|
994 |
+
|
995 |
+
currentCell.setAttribute(
|
996 |
+
'style',
|
997 |
+
`background-color: ${tableObj.rowColors[colorIndex]}`,
|
998 |
+
true,
|
999 |
+
';'
|
1000 |
+
);
|
1001 |
+
tableObj.appendObjectToRow(currentCell, rowObj.id);
|
1002 |
+
}
|
1003 |
+
}
|
1004 |
+
}
|
1005 |
+
}
|
1006 |
+
currentOriginalRow += itemsPerHeader;
|
1007 |
+
}
|
1008 |
+
}
|
1009 |
+
};
|
1010 |
+
|
1011 |
+
/**
|
1012 |
+
* Build table in its default form.
|
1013 |
+
*
|
1014 |
+
* Default form of table is the layout it has in desktop breakpoint.
|
1015 |
+
*
|
1016 |
+
* @param {TableObject} tableObj table object
|
1017 |
+
*/
|
1018 |
+
this.buildDefault = (tableObj) => {
|
1019 |
+
const rows = tableObj.maxRows();
|
1020 |
+
const columns = tableObj.maxColumns();
|
1021 |
+
|
1022 |
+
for (let r = 0; r < rows; r += 1) {
|
1023 |
+
const rowId = tableObj.addRow('', true, r).id;
|
1024 |
+
for (let c = 0; c < columns; c += 1) {
|
1025 |
+
const tempCell = tableObj.getCell(r, c, true);
|
1026 |
+
|
1027 |
+
// only render cell if a valid cell is found and it is not a reference
|
1028 |
+
if (tempCell && !tempCell.isReference()) {
|
1029 |
+
// reset all modified attributes of cell to their default values
|
1030 |
+
tempCell.resetAllAttributes();
|
1031 |
+
tableObj.appendElementToRow(tempCell.getElement(), rowId);
|
1032 |
+
}
|
1033 |
+
}
|
1034 |
+
}
|
1035 |
+
};
|
1036 |
+
|
1037 |
+
/**
|
1038 |
+
* Calculate range id for given size value.
|
1039 |
+
*
|
1040 |
+
* @param {number} val value
|
1041 |
+
* @param {object} stops an object containing stop ids as keys and respective sizes as values
|
1042 |
+
* @return {string} range id
|
1043 |
+
*/
|
1044 |
+
this.calculateRangeId = (val, stops) => {
|
1045 |
+
// eslint-disable-next-line prefer-destructuring
|
1046 |
+
const sortedStops = Object.keys(stops).sort((a, b) => stops[a].width - stops[b].width);
|
1047 |
+
|
1048 |
+
let rangeId = sortedStops[0];
|
1049 |
+
|
1050 |
+
// eslint-disable-next-line array-callback-return
|
1051 |
+
sortedStops.map((s) => {
|
1052 |
+
if (val >= stops[s].width) {
|
1053 |
+
rangeId = s;
|
1054 |
+
}
|
1055 |
+
});
|
1056 |
+
|
1057 |
+
return rangeId;
|
1058 |
+
};
|
1059 |
+
|
1060 |
+
/**
|
1061 |
+
* Rebuild table according to its responsive directives.
|
1062 |
+
*
|
1063 |
+
* @private
|
1064 |
+
* @param {HTMLElement} el table element
|
1065 |
+
* @param {number} size size in pixels
|
1066 |
+
* @param {TableObject} tableObj table object instance
|
1067 |
+
* @throws An error will be given for invalid mode name
|
1068 |
+
*/
|
1069 |
+
this.rebuildTable = (el, size, tableObj) => {
|
1070 |
+
const directive = this.getDirective(el);
|
1071 |
+
|
1072 |
+
if (directive) {
|
1073 |
+
if (!directive.responsiveEnabled) {
|
1074 |
+
// this.buildDefault(tableObj);
|
1075 |
+
return;
|
1076 |
+
}
|
1077 |
+
|
1078 |
+
const mode = directive.responsiveMode;
|
1079 |
+
|
1080 |
+
// main build logic for different responsive modes should be named in the format of `{modeName}Build` to automatically call the associated function from here
|
1081 |
+
const buildCallable = this[`${mode}Build`];
|
1082 |
+
|
1083 |
+
if (!size) {
|
1084 |
+
// eslint-disable-next-line no-param-reassign
|
1085 |
+
size = el.getBoundingClientRect().width;
|
1086 |
+
}
|
1087 |
+
|
1088 |
+
const sizeRangeId = this.calculateRangeId(size, directive.breakpoints);
|
1089 |
+
|
1090 |
+
if (buildCallable) {
|
1091 |
+
const modeOptions = directive.modeOptions[mode];
|
1092 |
+
buildCallable.call(this, el, sizeRangeId, modeOptions, tableObj);
|
1093 |
+
} else {
|
1094 |
+
throw new Error(`No build mode named as [${mode}] found.`);
|
1095 |
+
}
|
1096 |
+
}
|
1097 |
+
};
|
1098 |
+
|
1099 |
+
/**
|
1100 |
+
* Rebuild tables with the given screen size.
|
1101 |
+
*
|
1102 |
+
* @param {number} size screen size
|
1103 |
+
*/
|
1104 |
+
this.rebuildTables = (size) => {
|
1105 |
+
if (!size) {
|
1106 |
+
// eslint-disable-next-line no-param-reassign
|
1107 |
+
size = window.innerWidth;
|
1108 |
+
}
|
1109 |
+
// eslint-disable-next-line array-callback-return
|
1110 |
+
this.elementObjects.map((o) => {
|
1111 |
+
this.rebuildTable(o.el, size, o.tableObject);
|
1112 |
+
});
|
1113 |
+
};
|
1114 |
+
|
1115 |
+
if (this.options.bindToResize) {
|
1116 |
+
this.bindRebuildToResize();
|
1117 |
+
}
|
1118 |
+
|
1119 |
+
return { rebuildTables: this.rebuildTables };
|
1120 |
+
}
|
1121 |
+
|
1122 |
+
return ResponsiveFront;
|
1123 |
+
});
|
inc/admin/js/admin.js
CHANGED
@@ -1,5 +1,95 @@
|
|
1 |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
var WPTB_ActionsField = function WPTB_ActionsField() {
|
4 |
var _this = this;
|
5 |
|
@@ -367,8 +457,6 @@ var WPTB_ActionsField = function WPTB_ActionsField() {
|
|
367 |
document.addEventListener('DOMContentLoaded', WPTB_Builder);
|
368 |
}
|
369 |
})();
|
370 |
-
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
371 |
-
|
372 |
var WPTB_Cell = function WPTB_Cell(callback, DOMElement) {
|
373 |
|
374 |
function highlightRow(td) {
|
@@ -446,53 +534,7 @@ var WPTB_Cell = function WPTB_Cell(callback, DOMElement) {
|
|
446 |
|
447 |
WPTB_innerElementSet(DOMElement);
|
448 |
|
449 |
-
|
450 |
-
if (inputs && (typeof inputs === 'undefined' ? 'undefined' : _typeof(inputs)) === 'object') {
|
451 |
-
var _table = WPTB_Helper.findAncestor(DOMElement, 'wptb-preview-table'),
|
452 |
-
highlighted = _table.querySelector('.wptb-highlighted');
|
453 |
-
if (highlighted) {
|
454 |
-
var infArr = highlighted.className.match(/wptb-element-((.+-)\d+)/i);
|
455 |
-
|
456 |
-
var controlUnicClassCommonPart = '';
|
457 |
-
if (infArr && Array.isArray(infArr)) {
|
458 |
-
controlUnicClassCommonPart = infArr[1];
|
459 |
-
}
|
460 |
-
|
461 |
-
if (inputs.hasOwnProperty('cellWidth')) {
|
462 |
-
_table.addColumnWidth(inputs.cellWidth);
|
463 |
-
|
464 |
-
if (controlUnicClassCommonPart) {
|
465 |
-
var cellWidthFixedControl = document.querySelector('.wptb-el-' + controlUnicClassCommonPart + '-cellWidthFixed');
|
466 |
-
|
467 |
-
if (cellWidthFixedControl && !cellWidthFixedControl.checked) cellWidthFixedControl.checked = true;
|
468 |
-
}
|
469 |
-
} else if (inputs.hasOwnProperty('cellWidthFixed')) {
|
470 |
-
if (inputs.cellWidthFixed == 'checked') {
|
471 |
-
var width = WPTB_Helper.getColumnWidth(_table, highlighted);
|
472 |
-
_table.addColumnWidth(width);
|
473 |
-
} else {
|
474 |
-
_table.addColumnWidth(false, true);
|
475 |
-
}
|
476 |
-
} else if (inputs.hasOwnProperty('cellHeight')) {
|
477 |
-
_table.addRowHeight(inputs.cellHeight);
|
478 |
-
|
479 |
-
if (controlUnicClassCommonPart) {
|
480 |
-
var _cellWidthFixedControl = document.querySelector('.wptb-el-' + controlUnicClassCommonPart + '-cellHeightFixed');
|
481 |
-
|
482 |
-
if (_cellWidthFixedControl && !_cellWidthFixedControl.checked) _cellWidthFixedControl.checked = true;
|
483 |
-
}
|
484 |
-
} else if (inputs.hasOwnProperty('cellHeightFixed')) {
|
485 |
-
if (inputs.cellHeightFixed == 'checked') {
|
486 |
-
var height = WPTB_Helper.getRowHeight(_table, highlighted);
|
487 |
-
_table.addRowHeight(height);
|
488 |
-
} else {
|
489 |
-
_table.addRowHeight(false, true);
|
490 |
-
}
|
491 |
-
}
|
492 |
-
}
|
493 |
-
}
|
494 |
-
}
|
495 |
-
WPTB_Helper.controlsInclude(DOMElement, controlsChange);
|
496 |
|
497 |
var wptbPhElement = DOMElement.getElementsByClassName('wptb-ph-element');
|
498 |
|
@@ -572,46 +614,52 @@ var WPTB_Cell = function WPTB_Cell(callback, DOMElement) {
|
|
572 |
var tdBorderTopWidth = tdStyleObj.getPropertyValue('border-top-width');
|
573 |
var tdBorderBottomWidth = tdStyleObj.getPropertyValue('border-bottom-width');
|
574 |
|
575 |
-
var width = parseInt(this.offsetWidth, 10) - parseInt(tdPaddingLeft, 10) - parseInt(tdPaddingRight, 10)
|
576 |
-
|
577 |
-
var height = parseInt(this.offsetHeight, 10) - parseInt(tdPaddingTop, 10) - parseInt(tdPaddingBottom, 10) - parseInt(tdBorderTopWidth, 10) / 2 - parseInt(tdBorderBottomWidth, 10) / 2;
|
578 |
|
|
|
579 |
var table = WPTB_Helper.findAncestor(this, 'wptb-preview-table');
|
580 |
if (table) {
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
|
|
|
|
|
|
|
|
592 |
}
|
593 |
-
}
|
594 |
|
595 |
-
|
596 |
-
|
597 |
-
|
|
|
598 |
}
|
599 |
-
}
|
600 |
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
|
|
606 |
}
|
607 |
-
}
|
608 |
|
609 |
-
|
610 |
-
|
611 |
-
|
|
|
612 |
}
|
613 |
}
|
614 |
}
|
|
|
|
|
|
|
615 |
}
|
616 |
}
|
617 |
|
@@ -997,51 +1045,54 @@ var WPTB_Helper = {
|
|
997 |
}
|
998 |
},
|
999 |
dataTitleColumnSet: function dataTitleColumnSet(table) {
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
|
|
|
|
|
|
1045 |
},
|
1046 |
findAncestor: function findAncestor(el, cls) {
|
1047 |
while ((el = el.parentElement) && !el.classList.contains(cls)) {}
|
@@ -1185,8 +1236,8 @@ var WPTB_Helper = {
|
|
1185 |
} else if (type == 'star_rating') {
|
1186 |
if (parent.dataset.type == 'star-color') {
|
1187 |
var ratingStar = affectedEl.querySelectorAll('li');
|
1188 |
-
for (var
|
1189 |
-
var span = ratingStar[
|
1190 |
for (var j = 0; j < span.length; j++) {
|
1191 |
span[j].style.fill = uiColor;
|
1192 |
}
|
@@ -1365,83 +1416,100 @@ var WPTB_Helper = {
|
|
1365 |
if (element && (typeof element === 'undefined' ? 'undefined' : _typeof(element)) === 'object' && functionHandler && typeof functionHandler === 'function') {
|
1366 |
element.addEventListener('element:controls:active', function () {
|
1367 |
if (!element.hasOwnProperty('controlConnectFunctionsName') || !Array.isArray(element.controlConnectFunctionsName) || element.controlConnectFunctionsName.indexOf(functionHandler.name) == -1) {
|
1368 |
-
|
1369 |
-
|
1370 |
-
|
1371 |
-
if (infArr && Array.isArray(infArr)) {
|
1372 |
-
elementKind = infArr[1];
|
1373 |
-
}
|
1374 |
|
1375 |
-
|
1376 |
-
|
1377 |
-
// if( elementsSettingsTemplateJs.length > 0 ) {
|
1378 |
-
// elementsSettingsTemplateJs = elementsSettingsTemplateJs[0];
|
1379 |
-
//
|
1380 |
-
// let elementsSettings = elementsSettingsTemplateJs.innerHTML;
|
1381 |
-
// let controlClassesNames = [];
|
1382 |
-
// if( elementsSettings ) {
|
1383 |
-
// elementsSettings = elementsSettings.trim();
|
1384 |
-
// elementsSettings = JSON.parse( elementsSettings );
|
1385 |
-
// if( elementsSettings && typeof elementsSettings === 'object' ) {
|
1386 |
-
// if( 'tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2] in elementsSettings ) {
|
1387 |
-
// let elementSettings = elementsSettings['tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2]];
|
1388 |
-
// if( elementSettings && typeof elementSettings === 'object' ) {
|
1389 |
-
// Object.keys( elementSettings ).forEach( function( key ) {
|
1390 |
-
// let regularText = new RegExp( 'data-wptb-el-' + elementKind + '-(\\d+)-([a-zA-Z0-9_-]+)', "i" );
|
1391 |
-
// let keyInfArr = key.match( regularText );
|
1392 |
-
// if( keyInfArr && Array.isArray( keyInfArr ) ) {
|
1393 |
-
// let controlClass = key.replace( 'data-', '' );
|
1394 |
-
// controlClassesNames.push( [controlClass, keyInfArr[2]] );
|
1395 |
-
// }
|
1396 |
-
// });
|
1397 |
-
// }
|
1398 |
-
// }
|
1399 |
-
// }
|
1400 |
-
// }
|
1401 |
-
// }
|
1402 |
-
// }
|
1403 |
-
if (elementKind) {
|
1404 |
-
var elementOptionsContainer = document.querySelector('.wptb-element-options.wptb-options-' + infArr[1] + '-' + infArr[2]);
|
1405 |
-
|
1406 |
-
// from time to time depend on table cells hierarchy, cell td items may catch mouse clicks which are intended for elements. since the active section is not cell management, this will gives and unharmfull error of not found element, simple check for null equality will be sufficient for now.
|
1407 |
-
if (!elementOptionsContainer) {
|
1408 |
-
return;
|
1409 |
}
|
1410 |
|
1411 |
-
|
1412 |
-
|
1413 |
-
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
1421 |
-
|
1422 |
-
|
1423 |
-
|
1424 |
-
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
1430 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1431 |
|
1432 |
-
|
1433 |
-
|
1434 |
-
|
1435 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1436 |
}
|
1437 |
-
}
|
1438 |
|
1439 |
-
|
1440 |
-
element.controlConnectFunctionsName = [];
|
1441 |
}
|
1442 |
-
|
1443 |
-
element.controlConnectFunctionsName.push(functionHandler.name);
|
1444 |
-
}
|
1445 |
}
|
1446 |
}, false);
|
1447 |
}
|
@@ -1522,18 +1590,18 @@ var WPTB_Helper = {
|
|
1522 |
// if( elementsSettings ) {
|
1523 |
// elementsSettings = elementsSettings.trim();
|
1524 |
// elementsSettings = JSON.parse( elementsSettings );
|
1525 |
-
// if( elementsSettings && typeof elementsSettings === 'object' &&
|
1526 |
// ( 'tmpl-wptb-el-datas-' + dependOnControlElementKind ) in elementsSettings ) {
|
1527 |
// let elementSettings = elementsSettings['tmpl-wptb-el-datas-' + dependOnControlElementKind];
|
1528 |
-
// if( elementSettings && typeof elementSettings === 'object' &&
|
1529 |
// ( 'data-wptb-el-' + dependOnControlElementKind + '-' + dependOnControlName ) in elementSettings ) {
|
1530 |
// let elementSettingValue = elementSettings['data-wptb-el-' + dependOnControlElementKind + '-' + dependOnControlName];
|
1531 |
-
//
|
1532 |
// if( elementSettingValue ) {
|
1533 |
-
// if( dependOn[1] && Array.isArray( dependOn[1] ) &&
|
1534 |
// ( dependOn[1].indexOf( elementSettingValue ) !== -1 ) ) {
|
1535 |
// controlContainerElem.style.display = 'block';
|
1536 |
-
// } else if( dependOn[2] && Array.isArray( dependOn[2] ) &&
|
1537 |
// ( dependOn[2].indexOf( elementSettingValue ) !== -1 ) ) {
|
1538 |
// controlContainerElem.style.display = 'none';
|
1539 |
// }
|
@@ -1750,7 +1818,7 @@ var WPTB_Helper = {
|
|
1750 |
}
|
1751 |
}
|
1752 |
},
|
1753 |
-
//
|
1754 |
elementOptionsSet: function elementOptionsSet(kind, element) {
|
1755 |
// get controls config for this element
|
1756 |
var wptbContrlStacksConfigId = 'wptb-' + kind + '-control-stack';
|
@@ -1759,12 +1827,9 @@ var WPTB_Helper = {
|
|
1759 |
var elementContainerClass = void 0;
|
1760 |
var elementOptionClassIndic = void 0;
|
1761 |
var elementOptionsGroup = void 0;
|
1762 |
-
var elementOptionsGroupId = void 0;
|
1763 |
-
var wptbelementOptionClass = void 0;
|
1764 |
|
1765 |
-
|
1766 |
-
var
|
1767 |
-
var wptbelementOptionsScriptsContainer = document.createElement('div');
|
1768 |
|
1769 |
var infArr = element.className.match(/wptb-element-((.+-)\d+)/i);
|
1770 |
if (!infArr) {
|
@@ -1775,9 +1840,10 @@ var WPTB_Helper = {
|
|
1775 |
if (element.classList.contains('wptb-preview-table')) {
|
1776 |
element.classList.add('wptb-element-main-table_setting-' + table_id);
|
1777 |
} else if (element.classList.contains('wptb-cell')) {
|
1778 |
-
var cellEditActiveClass = document.querySelector('.wptb-element-table_cell_setting-' +
|
1779 |
-
if (cellEditActiveClass)
|
1780 |
-
|
|
|
1781 |
}
|
1782 |
|
1783 |
infArr = element.className.match(/wptb-element-((.+-)\d+)/i);
|
@@ -1790,18 +1856,15 @@ var WPTB_Helper = {
|
|
1790 |
elementContainerClass = infArr[0];
|
1791 |
elementOptionClassIndic = infArr[1];
|
1792 |
|
1793 |
-
if (element.classList.contains('wptb-preview-table')) {
|
1794 |
-
elementOptionsGroupId = 'table-settings-group';
|
1795 |
-
wptbelementOptionClass = 'wptb-element-option';
|
1796 |
-
} else if (element.classList.contains('wptb-cell')) {
|
1797 |
-
elementOptionsGroupId = 'element-cell-options-group';
|
1798 |
-
wptbelementOptionClass = 'wptb-element-option';
|
1799 |
-
|
1800 |
this.activateSection('cell_settings');
|
|
|
|
|
|
|
1801 |
} else {
|
1802 |
var children = document.getElementById('element-options-group').childNodes;
|
1803 |
-
for (var
|
1804 |
-
if (children[
|
1805 |
}
|
1806 |
|
1807 |
// hide wptb-elements-container and wptb-settings-section
|
@@ -1811,39 +1874,23 @@ var WPTB_Helper = {
|
|
1811 |
// show element-options-group
|
1812 |
// document.getElementById( 'element-options-group' ).style.display = 'block';
|
1813 |
this.activateSection('options_group');
|
1814 |
-
|
1815 |
-
elementOptionsGroupId = 'element-options-group';
|
1816 |
-
wptbelementOptionClass = 'wptb-element-option';
|
1817 |
}
|
1818 |
|
1819 |
-
wptbelementOptionsContainer.classList.add('wptb-element-options', 'wptb-options-' + infArr[1]);
|
1820 |
-
wptbelementOptionsScriptsContainer.classList.add('wptb-element-options-scripts', 'wptb-options-' + infArr[1]);
|
1821 |
-
|
1822 |
var jsonControlsConfigJson = tmplControlsConfig(data);
|
1823 |
var jsonControlsConfig = JSON.parse(jsonControlsConfigJson);
|
1824 |
|
1825 |
-
|
1826 |
-
|
1827 |
-
|
1828 |
-
var elementOptionsGroupChildren = [].concat(_toConsumableArray(elementOptionsGroup.children));
|
1829 |
-
for (var _i6 = 0; _i6 < elementOptionsGroupChildren.length; _i6++) {
|
1830 |
-
elementOptionsGroup.removeChild(elementOptionsGroupChildren[_i6]);
|
1831 |
-
}
|
1832 |
-
|
1833 |
-
// insert created container into element-option-group tag
|
1834 |
-
document.getElementById(elementOptionsGroupId).appendChild(wptbelementOptionsContainer);
|
1835 |
-
document.getElementById(elementOptionsGroupId).appendChild(wptbelementOptionsScriptsContainer);
|
1836 |
-
|
1837 |
-
// show created container
|
1838 |
-
wptbelementOptionsContainer.style.display = 'block';
|
1839 |
|
1840 |
-
//
|
1841 |
-
var
|
1842 |
|
1843 |
// array for keep "appear depend on" parametrs
|
1844 |
var controlappearDependOnControl = [];
|
1845 |
|
1846 |
// create controls
|
|
|
1847 |
var i = 0;
|
1848 |
Object.keys(jsonControlsConfig).forEach(function (key) {
|
1849 |
var data = jsonControlsConfig[key];
|
@@ -1862,50 +1909,103 @@ var WPTB_Helper = {
|
|
1862 |
}
|
1863 |
}
|
1864 |
|
1865 |
-
|
1866 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1867 |
|
1868 |
-
if (data.
|
1869 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1870 |
}
|
1871 |
|
1872 |
-
|
1873 |
-
|
|
|
|
|
1874 |
}
|
1875 |
|
1876 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1877 |
|
1878 |
-
|
|
|
|
|
1879 |
|
1880 |
-
var helperJavascriptElem =
|
1881 |
if (helperJavascriptElem.length > 0) {
|
1882 |
helperJavascriptElem = helperJavascriptElem[0];
|
1883 |
var helperJavascriptCode = helperJavascriptElem.innerText;
|
1884 |
-
|
1885 |
var script = document.createElement('script');
|
1886 |
script.setAttribute('type', 'text/javascript');
|
1887 |
script.innerHTML = helperJavascriptCode.replace(/\r|\n|\t/g, '').trim();
|
1888 |
-
|
|
|
|
|
|
|
1889 |
}
|
1890 |
|
1891 |
i++;
|
1892 |
});
|
1893 |
|
1894 |
-
|
1895 |
-
|
1896 |
-
|
1897 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1898 |
}
|
1899 |
-
}
|
|
|
|
|
|
|
1900 |
|
1901 |
// run appearDependOnControl function
|
1902 |
-
for (var
|
1903 |
-
WPTB_Helper.appearDependOnControl(controlappearDependOnControl[
|
1904 |
}
|
1905 |
|
1906 |
WPTB_Helper.wptbDocumentEventGenerate('element:controls:active', element);
|
1907 |
},
|
1908 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1909 |
managerExternalCssStyles: function managerExternalCssStyles(elementContainer, selector, cssName, cssValue) {
|
1910 |
var infArr = elementContainer.match(/wptb-element-main(.+)-(\d+)/i);
|
1911 |
if (!infArr || !Array.isArray(infArr)) {
|
@@ -2006,6 +2106,7 @@ var WPTB_Helper = {
|
|
2006 |
var _this = this;
|
2007 |
|
2008 |
this.sections = {};
|
|
|
2009 |
if (!Array.isArray(sections)) {
|
2010 |
sections = [sections];
|
2011 |
}
|
@@ -2029,6 +2130,7 @@ var WPTB_Helper = {
|
|
2029 |
|
2030 |
var displayType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'block';
|
2031 |
|
|
|
2032 |
this.triggerSectionEvent(sectionDataId);
|
2033 |
Object.keys(this.sections).map(function (k) {
|
2034 |
if (Object.prototype.hasOwnProperty.call(_this2.sections, k)) {
|
@@ -2038,6 +2140,30 @@ var WPTB_Helper = {
|
|
2038 |
});
|
2039 |
},
|
2040 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2041 |
/**
|
2042 |
* Set up related buttons and links to trigger certain elements
|
2043 |
*/
|
@@ -2052,7 +2178,7 @@ var WPTB_Helper = {
|
|
2052 |
vm.activateSection(sectionName, displayType);
|
2053 |
});
|
2054 |
|
2055 |
-
document.addEventListener('
|
2056 |
if (e.detail === sectionName) {
|
2057 |
s.classList.remove('disabled');
|
2058 |
s.classList.add('active');
|
@@ -2081,7 +2207,7 @@ var WPTB_Helper = {
|
|
2081 |
* @param {string} sectionName section name
|
2082 |
*/
|
2083 |
triggerSectionEvent: function triggerSectionEvent(sectionName) {
|
2084 |
-
var sectionEvent = new CustomEvent('
|
2085 |
|
2086 |
document.dispatchEvent(sectionEvent);
|
2087 |
},
|
@@ -2221,6 +2347,12 @@ var WPTB_Helper = {
|
|
2221 |
if (codeClone.classList.contains('wptb-element-main-table_setting-startedid-0')) {
|
2222 |
codeClone.classList.remove('wptb-element-main-table_setting-startedid-0');
|
2223 |
codeClone.classList.add('wptb-element-main-table_setting-' + postId);
|
|
|
|
|
|
|
|
|
|
|
|
|
2224 |
paramIdsNecessaryChange = true;
|
2225 |
}
|
2226 |
}
|
@@ -2346,6 +2478,11 @@ var WPTB_Helper = {
|
|
2346 |
},
|
2347 |
//
|
2348 |
clickOnFreeSpace: function clickOnFreeSpace() {
|
|
|
|
|
|
|
|
|
|
|
2349 |
var cellModeBackground = document.querySelector('#wptb-cell_mode_background');
|
2350 |
if (cellModeBackground && cellModeBackground.classList.contains('visible')) {
|
2351 |
return;
|
@@ -2419,6 +2556,7 @@ var WPTB_Helper = {
|
|
2419 |
}
|
2420 |
|
2421 |
if (bar.length > 0) {
|
|
|
2422 |
for (var i = 0; i < bar.length; i++) {
|
2423 |
if (bar[i].classList.contains('visible')) {
|
2424 |
document.select.deactivateMultipleSelectMode();
|
@@ -2429,18 +2567,23 @@ var WPTB_Helper = {
|
|
2429 |
wptbPreviewTable.parentNode.classList.remove('wptb-preview-table-manage-cells');
|
2430 |
var wptbPreviewTableTds = wptbPreviewTable.getElementsByTagName('td');
|
2431 |
if (wptbPreviewTableTds.length > 0) {
|
2432 |
-
for (var
|
2433 |
-
wptbPreviewTableTds[
|
2434 |
}
|
2435 |
}
|
|
|
2436 |
} else if (!close) {
|
2437 |
document.select.activateMultipleSelectMode();
|
2438 |
bar[i].classList.add('visible');
|
2439 |
cellModeBackground.classList.add('visible');
|
2440 |
leftScrollPanelCurtain.classList.add('visible');
|
2441 |
wptbPreviewTable.parentNode.classList.add('wptb-preview-table-manage-cells');
|
|
|
|
|
2442 |
}
|
2443 |
}
|
|
|
|
|
2444 |
}
|
2445 |
},
|
2446 |
|
@@ -2692,95 +2835,205 @@ var WPTB_Helper = {
|
|
2692 |
};
|
2693 |
var WPTB_Initializer = function WPTB_Initializer() {
|
2694 |
|
2695 |
-
|
2696 |
-
|
2697 |
-
|
2698 |
-
|
2699 |
|
2700 |
-
|
2701 |
-
|
2702 |
|
2703 |
-
|
2704 |
-
|
2705 |
-
|
2706 |
-
|
2707 |
-
|
2708 |
|
2709 |
-
|
2710 |
-
|
2711 |
-
|
2712 |
-
|
2713 |
-
|
2714 |
|
2715 |
-
|
2716 |
-
|
2717 |
-
|
2718 |
-
|
2719 |
-
|
2720 |
|
2721 |
-
|
2722 |
-
|
2723 |
-
|
2724 |
-
|
2725 |
-
|
2726 |
|
2727 |
-
|
2728 |
-
|
2729 |
-
|
2730 |
|
2731 |
-
|
2732 |
|
2733 |
-
|
2734 |
|
2735 |
-
|
2736 |
-
|
2737 |
-
|
2738 |
|
2739 |
-
|
2740 |
-
|
2741 |
-
|
2742 |
-
WPTB_Helper.setupSidebarToggle('.wptb-panel-drawer-toggle');
|
2743 |
-
WPTB_Helper.setupPanelToggleButtons();
|
2744 |
-
};
|
2745 |
-
var WPTB_LeftPanel = function WPTB_LeftPanel() {
|
2746 |
|
2747 |
-
|
2748 |
-
|
2749 |
|
2750 |
-
|
2751 |
-
|
2752 |
-
|
2753 |
-
e.dataTransfer.setData('wptbElIndic-' + this.dataset.wptbElement, 'wptbElIndic-' + this.dataset.wptbElement);
|
2754 |
-
};
|
2755 |
-
};
|
2756 |
|
2757 |
-
|
2758 |
-
|
2759 |
-
for (var _i = 0; _i < wptbTablesEditModeCloseButton.length; _i++) {
|
2760 |
-
wptbTablesEditModeCloseButton[_i].onclick = WPTB_Helper.toggleTableEditMode;
|
2761 |
-
}
|
2762 |
-
document.getElementById('wptb-add-end-row').onclick = table.addRowToTheEnd;
|
2763 |
-
document.getElementById('wptb-add-start-row').onclick = table.addRowToTheStart;
|
2764 |
-
document.getElementById('wptb-add-row-before').onclick = table.addRowBefore;
|
2765 |
-
document.getElementById('wptb-add-row-after').onclick = table.addRowAfter;
|
2766 |
-
document.getElementById('wptb-add-end-column').onclick = table.addColumnEnd;
|
2767 |
-
document.getElementById('wptb-add-start-column').onclick = table.addColumnStart;
|
2768 |
-
document.getElementById('wptb-add-column-before').onclick = table.addColumnBefore;
|
2769 |
-
document.getElementById('wptb-add-column-after').onclick = table.addColumnAfter;
|
2770 |
-
document.getElementById('wptb-delete-column').onclick = table.deleteColumn;
|
2771 |
-
document.getElementById('wptb-delete-row').onclick = table.deleteRow;
|
2772 |
-
document.getElementById('wptb-merge-cells').onclick = table.mergeCells;
|
2773 |
-
document.getElementById('wptb-split-cell').onclick = table.splitCell;
|
2774 |
-
};
|
2775 |
|
2776 |
-
//
|
2777 |
-
|
2778 |
-
|
2779 |
-
|
2780 |
-
|
2781 |
-
|
2782 |
-
|
2783 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2784 |
|
2785 |
var wptbHeader = document.getElementsByClassName('wptb-header');
|
2786 |
if (wptbHeader.length > 0) wptbHeader = wptbHeader[0];
|
@@ -2923,6 +3176,88 @@ if (!Object.keys) {
|
|
2923 |
};
|
2924 |
}();
|
2925 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2926 |
var WPTB_Settings = function WPTB_Settings() {
|
2927 |
var elems = document.getElementsByClassName('wptb-element');
|
2928 |
|
@@ -3043,12 +3378,12 @@ var WPTB_Stringifier = function WPTB_Stringifier(codeMain) {
|
|
3043 |
if (tds.length > 0) {
|
3044 |
for (var i = 0; i < tds.length; i++) {
|
3045 |
|
3046 |
-
|
3047 |
-
tds[i].removeAttribute('data-x-index');
|
3048 |
-
}
|
3049 |
tds[i].removeAttribute('data-y-index');
|
3050 |
tds[i].removeAttribute('draggable');
|
3051 |
tds[i].classList.remove('wptb-droppable');
|
|
|
|
|
3052 |
var innerElements = tds[i].getElementsByClassName('wptb-ph-element');
|
3053 |
|
3054 |
if (innerElements.length > 0) {
|
@@ -3112,21 +3447,22 @@ var WPTB_Stringifier = function WPTB_Stringifier(codeMain) {
|
|
3112 |
}
|
3113 |
}
|
3114 |
|
3115 |
-
|
3116 |
-
|
3117 |
-
|
3118 |
-
|
3119 |
-
|
3120 |
-
|
3121 |
-
|
3122 |
-
|
3123 |
-
|
3124 |
-
|
3125 |
-
|
3126 |
-
|
3127 |
-
|
3128 |
-
|
3129 |
-
|
|
|
3130 |
}
|
3131 |
}
|
3132 |
|
@@ -3159,27 +3495,28 @@ var array = [],
|
|
3159 |
* @param Event this is the event instance of the click performed over a cell.
|
3160 |
*/
|
3161 |
var mark = function mark(event) {
|
3162 |
-
var
|
3163 |
-
|
|
|
3164 |
noCells = document.getElementsByClassName('wptb-no-cell-action'),
|
3165 |
singleCells = document.getElementsByClassName('wptb-single-action'),
|
3166 |
multipleCells = document.getElementsByClassName('wptb-multiple-select-action'),
|
3167 |
cellSettings = document.getElementById('wptb-left-scroll-panel-cell-settings'),
|
3168 |
-
position = getCoords(
|
3169 |
row = position[0],
|
3170 |
column = position[1];
|
3171 |
if (!document.select.isActivated()) {
|
3172 |
return;
|
3173 |
}
|
3174 |
-
if (
|
3175 |
-
|
3176 |
for (var i = 0; i < rs; i++) {
|
3177 |
for (var j = 0; j < cs; j++) {
|
3178 |
array[row + i][column + j] = 0;
|
3179 |
}
|
3180 |
}
|
3181 |
} else {
|
3182 |
-
|
3183 |
for (var i = 0; i < rs; i++) {
|
3184 |
for (var j = 0; j < cs; j++) {
|
3185 |
array[row + i][column + j] = 1;
|
@@ -3284,6 +3621,9 @@ var array = [],
|
|
3284 |
}
|
3285 |
cellSettings.classList.remove('visible');
|
3286 |
}
|
|
|
|
|
|
|
3287 |
};
|
3288 |
|
3289 |
/*
|
@@ -3417,23 +3757,25 @@ var array = [],
|
|
3417 |
tds[0].classList.remove('wptb-highlighted');
|
3418 |
}
|
3419 |
cellSettings.classList.remove('visible');
|
3420 |
-
for (var
|
3421 |
-
for (var
|
3422 |
-
array[
|
3423 |
}
|
3424 |
}
|
3425 |
-
for (var
|
3426 |
-
multipleCells[
|
3427 |
-
multipleCells[
|
3428 |
}
|
3429 |
-
for (var
|
3430 |
-
noCells[
|
3431 |
-
noCells[
|
3432 |
}
|
3433 |
-
for (var
|
3434 |
-
singleCells[
|
3435 |
-
singleCells[
|
3436 |
}
|
|
|
|
|
3437 |
};
|
3438 |
|
3439 |
/*
|
@@ -3563,8 +3905,8 @@ var array = [],
|
|
3563 |
var cells = table.getElementsByTagName('td');
|
3564 |
|
3565 |
if (cells.length > 0) {
|
3566 |
-
for (var
|
3567 |
-
WPTB_Cell(mark, cells[
|
3568 |
}
|
3569 |
}
|
3570 |
} else {
|
@@ -3572,6 +3914,45 @@ var array = [],
|
|
3572 |
}
|
3573 |
}
|
3574 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3575 |
/*
|
3576 |
* For assigning to each cell xIndex and y Index attributes,
|
3577 |
* these are the column number and row number of cell in table.
|
@@ -3592,11 +3973,11 @@ var array = [],
|
|
3592 |
var tableRows = table.rows;
|
3593 |
var widthIsSet = false;
|
3594 |
var arrayTdsFromPreviousRow = [];
|
3595 |
-
for (var
|
3596 |
-
var _row = tableRows[
|
3597 |
var tds = _row.children;
|
3598 |
-
for (var
|
3599 |
-
var td = tds[
|
3600 |
if (td.dataset.xIndex == dataXIndex) {
|
3601 |
if (value) {
|
3602 |
if (td.colSpan == colspan) {
|
@@ -3606,7 +3987,7 @@ var array = [],
|
|
3606 |
} else {
|
3607 |
td.style.width = null;
|
3608 |
td.dataset.wptbFixedWidth = value;
|
3609 |
-
if (
|
3610 |
tableTdsFor(dataXIndex, colspan + 1);
|
3611 |
}
|
3612 |
}
|
@@ -3640,6 +4021,8 @@ var array = [],
|
|
3640 |
}
|
3641 |
|
3642 |
table.tdDefaultWidth();
|
|
|
|
|
3643 |
}
|
3644 |
};
|
3645 |
|
@@ -3664,10 +4047,10 @@ var array = [],
|
|
3664 |
var borderRightWidth = tableFullStyleObj.getPropertyValue('border-right-width');
|
3665 |
var tableBorderCommon = parseFloat(borderLeftWidth, 10) + parseFloat(borderRightWidth, 10);
|
3666 |
|
3667 |
-
for (var
|
3668 |
-
var tds = rows[
|
3669 |
-
for (var
|
3670 |
-
var td = tds[
|
3671 |
|
3672 |
if (!arrayCellsWidthFixedHelper[parseFloat(td.dataset.xIndex)] && !arrayCellsWidthAutoHelper[parseFloat(td.dataset.xIndex)]) {
|
3673 |
if (td.style.width) {
|
@@ -3695,30 +4078,30 @@ var array = [],
|
|
3695 |
arrayCellsWidthFixedHelper[parseFloat(td.dataset.xIndex)] += tdPaddingCommon;
|
3696 |
arrayCellsWidthFixedHelper[parseFloat(td.dataset.xIndex)] += tableTdBorderCommonWidth;
|
3697 |
|
3698 |
-
if (
|
3699 |
arrayCellsWidthFixedHelper[parseFloat(td.dataset.xIndex)] += parseFloat(tableTdBorderLeftWidth, 10) / 2;
|
3700 |
-
} else if (
|
3701 |
arrayCellsWidthFixedHelper[parseFloat(td.dataset.xIndex)] += tableBorderCommon / 2 - parseFloat(tableTdBorderRightWidth, 10) / 2;
|
3702 |
}
|
3703 |
|
3704 |
-
if (
|
3705 |
arrayCellsWidthFixedHelper[parseFloat(td.dataset.xIndex)] += parseFloat(tableTdBorderRightWidth, 10) / 2;
|
3706 |
-
} else if (
|
3707 |
arrayCellsWidthFixedHelper[parseFloat(td.dataset.xIndex)] += tableBorderCommon / 2 - parseFloat(tableTdBorderRightWidth, 10) / 2;
|
3708 |
}
|
3709 |
} else if (arrayCellsWidthAutoHelper[parseFloat(td.dataset.xIndex)]) {
|
3710 |
arrayCellsWidthAutoHelper[parseFloat(td.dataset.xIndex)] += tdPaddingCommon;
|
3711 |
arrayCellsWidthAutoHelper[parseFloat(td.dataset.xIndex)] += tableTdBorderCommonWidth;
|
3712 |
|
3713 |
-
if (
|
3714 |
arrayCellsWidthAutoHelper[parseFloat(td.dataset.xIndex)] += parseFloat(tableTdBorderLeftWidth, 10) / 2;
|
3715 |
-
} else if (
|
3716 |
arrayCellsWidthAutoHelper[parseFloat(td.dataset.xIndex)] += tableBorderCommon / 2 - parseFloat(tableTdBorderLeftWidth, 10) / 2;
|
3717 |
}
|
3718 |
|
3719 |
-
if (
|
3720 |
arrayCellsWidthAutoHelper[parseFloat(td.dataset.xIndex)] += parseFloat(tableTdBorderRightWidth, 10) / 2;
|
3721 |
-
} else if (
|
3722 |
arrayCellsWidthAutoHelper[parseFloat(td.dataset.xIndex)] += tableBorderCommon / 2 - parseFloat(tableTdBorderLeftWidth, 10) / 2;
|
3723 |
}
|
3724 |
}
|
@@ -3733,16 +4116,16 @@ var array = [],
|
|
3733 |
}
|
3734 |
}
|
3735 |
|
3736 |
-
for (var
|
3737 |
-
if (arrayCellsWidthFixedHelper[
|
3738 |
-
tableTdsSumMaxWidthFixed += arrayCellsWidthFixedHelper[
|
3739 |
}
|
3740 |
}
|
3741 |
|
3742 |
var CellsWidthAutoCount = 0;
|
3743 |
-
for (var
|
3744 |
-
if (arrayCellsWidthAutoHelper[
|
3745 |
-
tableTdsSumMaxWidthAuto += arrayCellsWidthAutoHelper[
|
3746 |
CellsWidthAutoCount++;
|
3747 |
}
|
3748 |
}
|
@@ -3845,11 +4228,11 @@ var array = [],
|
|
3845 |
var tableRows = table.rows;
|
3846 |
var heightIsSet = false;
|
3847 |
var arrayTdsPrevious = [];
|
3848 |
-
for (var
|
3849 |
-
var _row2 = tableRows[
|
3850 |
var tds = _row2.children;
|
3851 |
-
for (var
|
3852 |
-
var td = tds[
|
3853 |
if (td.dataset.yIndex == dataYIndex) {
|
3854 |
if (value) {
|
3855 |
if (td.rowSpan == rowspan) {
|
@@ -3860,7 +4243,7 @@ var array = [],
|
|
3860 |
} else {
|
3861 |
td.style.height = null;
|
3862 |
td.dataset.wptbFixedHeight = value;
|
3863 |
-
if (
|
3864 |
tableTdsFor(dataYIndex, rowspan + 1);
|
3865 |
}
|
3866 |
}
|
@@ -3891,6 +4274,8 @@ var array = [],
|
|
3891 |
})();
|
3892 |
}
|
3893 |
}
|
|
|
|
|
3894 |
}
|
3895 |
};
|
3896 |
|
@@ -3900,14 +4285,14 @@ var array = [],
|
|
3900 |
table.mergingCellsVertically = false;
|
3901 |
table.dataset.reconstraction = 1;
|
3902 |
var forBreak = 0;
|
3903 |
-
for (var
|
3904 |
-
if (tds[
|
3905 |
table.dataset.reconstraction = 0;
|
3906 |
table.mergingСellsHorizontally = true;
|
3907 |
forBreak++;
|
3908 |
}
|
3909 |
|
3910 |
-
if (tds[
|
3911 |
table.dataset.reconstraction = 0;
|
3912 |
table.mergingCellsVertically = true;
|
3913 |
forBreak++;
|
@@ -4017,99 +4402,77 @@ var array = [],
|
|
4017 |
|
4018 |
table.addColumnAfter = function (c_pos) {
|
4019 |
var rows = table.rows,
|
4020 |
-
|
4021 |
-
|
4022 |
-
|
4023 |
-
cellStyle = cell.getAttribute('style'),
|
4024 |
-
pos = c_pos != undefined && typeof c_pos === 'number' ? c_pos : getCoords(cell)[1];
|
4025 |
|
4026 |
-
if (
|
4027 |
-
|
|
|
4028 |
} else {
|
4029 |
-
|
4030 |
-
|
4031 |
-
|
4032 |
-
bro = void 0,
|
4033 |
-
_carriedRowspans = [],
|
4034 |
-
currentCell = void 0;
|
4035 |
|
4036 |
-
|
4037 |
-
|
4038 |
-
|
4039 |
-
|
4040 |
-
|
4041 |
-
|
4042 |
-
|
4043 |
-
|
4044 |
-
|
4045 |
-
|
4046 |
-
|
4047 |
-
|
4048 |
-
|
4049 |
-
|
4050 |
-
|
4051 |
-
|
4052 |
-
|
4053 |
-
|
4054 |
-
|
4055 |
-
|
4056 |
-
if (
|
4057 |
-
|
4058 |
-
|
4059 |
-
|
4060 |
-
|
4061 |
-
|
4062 |
-
|
4063 |
-
}
|
4064 |
-
break;
|
4065 |
-
} else if (_carriedRowspans[xPosition] > 0) {
|
4066 |
-
// If no pending insertion, let's check if no rowspan from upper cells is pending in current position
|
4067 |
-
if (pos == xPosition) {
|
4068 |
-
pendingInsertion = true;
|
4069 |
-
}
|
4070 |
-
} else {
|
4071 |
-
currentCell = cellsBuffer[cellPointer++];
|
4072 |
-
if (currentCell.rowSpan > 1) {
|
4073 |
-
_stepsToMove = currentCell.colSpan;
|
4074 |
-
for (var k = 0; k < currentCell.colSpan; k++) {
|
4075 |
-
_carriedRowspans[xPosition + k] = currentCell.rowSpan;
|
4076 |
-
if (xPosition + k == pos) {
|
4077 |
-
pendingInsertion = true;
|
4078 |
-
}
|
4079 |
-
}
|
4080 |
-
} else if (currentCell.colSpan > 1) {
|
4081 |
-
_stepsToMove = currentCell.colSpan;
|
4082 |
-
for (var k = 0; k < currentCell.colSpan; k++) {
|
4083 |
-
if (xPosition + k == pos) {
|
4084 |
-
pendingInsertion = true;
|
4085 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
4086 |
}
|
4087 |
-
} else if (
|
4088 |
-
|
|
|
|
|
4089 |
}
|
4090 |
}
|
4091 |
}
|
4092 |
|
4093 |
-
for (var
|
4094 |
-
|
4095 |
}
|
4096 |
-
|
4097 |
-
|
4098 |
-
|
4099 |
-
|
4100 |
-
|
4101 |
-
|
4102 |
-
|
4103 |
-
table.recalculateIndexes();
|
4104 |
-
table.addColumnWidth();
|
4105 |
-
table.addRowHeight();
|
4106 |
-
WPTB_Helper.dataTitleColumnSet(table);
|
4107 |
-
undoSelect();
|
4108 |
|
4109 |
-
|
4110 |
|
4111 |
-
|
4112 |
-
|
|
|
4113 |
}
|
4114 |
};
|
4115 |
|
@@ -4228,13 +4591,13 @@ var array = [],
|
|
4228 |
cellStyle = cell.getAttribute('style'),
|
4229 |
row = getCoords(cell)[0],
|
4230 |
cellNew = void 0;
|
4231 |
-
for (var
|
4232 |
-
var rowChildren = table.rows[
|
4233 |
var rowChildrenLength = rowChildren.length;
|
4234 |
if (rowChildrenLength > 0) {
|
4235 |
-
for (var
|
4236 |
-
if (rowChildren[
|
4237 |
-
row =
|
4238 |
cellNew = true;
|
4239 |
break;
|
4240 |
}
|
@@ -4276,15 +4639,15 @@ var array = [],
|
|
4276 |
|
4277 |
var cellsColSpan = 0;
|
4278 |
if (rowAfter < table.rows.length - 1) {
|
4279 |
-
for (var
|
4280 |
-
var tableRowsIChildren = table.rows[
|
4281 |
tableRIChildrenLength = tableRowsIChildren.length;
|
4282 |
if (tableRIChildrenLength > 0) {
|
4283 |
-
for (var
|
4284 |
-
var rowIRowSpan = tableRowsIChildren[
|
4285 |
|
4286 |
-
if (rowIRowSpan - 1 +
|
4287 |
-
tableRowsIChildren[
|
4288 |
}
|
4289 |
}
|
4290 |
}
|
@@ -4295,8 +4658,8 @@ var array = [],
|
|
4295 |
rNextChildrenLength = rNextChildren.length;
|
4296 |
|
4297 |
if (rNextChildrenLength > 0) {
|
4298 |
-
for (var
|
4299 |
-
cellsColSpan += rNextChildren[
|
4300 |
}
|
4301 |
}
|
4302 |
} else {
|
@@ -4413,20 +4776,20 @@ var array = [],
|
|
4413 |
tds = [].slice.call(document.getElementsByClassName('wptb-highlighted'), 1),
|
4414 |
tdsChildrenNew = [];
|
4415 |
|
4416 |
-
for (var
|
4417 |
-
var tdsInternalElements = tds[
|
4418 |
if (tdsInternalElements.length > 0) {
|
4419 |
var tdsIntElemLength = tdsInternalElements.length;
|
4420 |
-
for (var
|
4421 |
-
tdsChildrenNew.push(tdsInternalElements[
|
4422 |
}
|
4423 |
}
|
4424 |
-
var p = tds[
|
4425 |
-
p.removeChild(tds[
|
4426 |
}
|
4427 |
if (tdsChildrenNew.length > 0) {
|
4428 |
-
for (var
|
4429 |
-
first.appendChild(tdsChildrenNew[
|
4430 |
}
|
4431 |
}
|
4432 |
|
@@ -4481,7 +4844,7 @@ var array = [],
|
|
4481 |
cell.rowSpan = 1;
|
4482 |
cell.colSpan = 1;
|
4483 |
|
4484 |
-
for (var
|
4485 |
var td = new WPTB_Cell(mark);
|
4486 |
td.getDOMElement().setAttribute('style', cellStyles);
|
4487 |
td.getDOMElement().classList.add('wptb-highlighted');
|
@@ -4493,9 +4856,9 @@ var array = [],
|
|
4493 |
}
|
4494 |
|
4495 |
if (rowspan > 1) {
|
4496 |
-
for (var
|
4497 |
var rowChildInsertBefore = undefined,
|
4498 |
-
rowNext = table.rows[row +
|
4499 |
rowChildren = rowNext.children,
|
4500 |
rowChildrenLength = rowChildren.length;
|
4501 |
|
@@ -4507,13 +4870,13 @@ var array = [],
|
|
4507 |
}
|
4508 |
}
|
4509 |
}
|
4510 |
-
for (var
|
4511 |
-
var
|
4512 |
-
|
4513 |
if (rowChildInsertBefore != undefined) {
|
4514 |
-
rowNext.insertBefore(
|
4515 |
} else {
|
4516 |
-
rowNext.appendChild(
|
4517 |
}
|
4518 |
}
|
4519 |
}
|
@@ -4613,7 +4976,7 @@ var array = [],
|
|
4613 |
|
4614 |
if (rowspan == undefined) rowspan = 1;
|
4615 |
|
4616 |
-
for (var
|
4617 |
thisRow = table.rows[row];
|
4618 |
var thisRowChildren = thisRow.children,
|
4619 |
nextRow = table.rows[row + 1],
|
@@ -4624,16 +4987,16 @@ var array = [],
|
|
4624 |
if (nextRow != undefined) {
|
4625 |
nextRowChildren = nextRow.children;
|
4626 |
nextRowChildrenLength = nextRowChildren.length;
|
4627 |
-
for (var
|
4628 |
-
if (thisRowChildren[
|
4629 |
var td = new WPTB_Cell(mark);
|
4630 |
td.getDOMElement().setAttribute('style', cellStyles);
|
4631 |
-
td.getDOMElement().colSpan = thisRowChildren[
|
4632 |
-
td.getDOMElement().rowSpan = thisRowChildren[
|
4633 |
|
4634 |
var nextRowChildrenK = undefined;
|
4635 |
for (var _k5 = 0; _k5 < nextRowChildrenLength; _k5++) {
|
4636 |
-
if (Number(nextRowChildren[_k5].dataset.xIndex) > Number(thisRowChildren[
|
4637 |
nextRowChildrenK = nextRowChildren[_k5];
|
4638 |
break;
|
4639 |
}
|
@@ -4660,11 +5023,11 @@ var array = [],
|
|
4660 |
|
4661 |
var tableRows = table.rows;
|
4662 |
if (tableRows.length > 0) {
|
4663 |
-
for (var
|
4664 |
-
var jRowChildren = tableRows[
|
4665 |
if (jRowChildren.length > 0) {
|
4666 |
for (var x = 0; x < jRowChildren.length; x++) {
|
4667 |
-
if (jRowChildren[x].rowSpan - 1 >= row -
|
4668 |
jRowChildren[x].rowSpan--;
|
4669 |
}
|
4670 |
}
|
@@ -4714,9 +5077,9 @@ var array = [],
|
|
4714 |
cellXIndex = cell.dataset.xIndex,
|
4715 |
colspan = cell.colSpan;
|
4716 |
|
4717 |
-
for (var
|
4718 |
-
for (var
|
4719 |
-
var rowChildren = table.rows[
|
4720 |
var rowChildrenLength = rowChildren.length;
|
4721 |
if (rowChildrenLength > 0) {
|
4722 |
for (var _k7 = rowChildrenLength - 1; _k7 >= 0; _k7--) {
|
@@ -4724,7 +5087,7 @@ var array = [],
|
|
4724 |
if (rowChildren[_k7].colSpan > 1) {
|
4725 |
rowChildren[_k7].colSpan--;
|
4726 |
} else {
|
4727 |
-
table.rows[
|
4728 |
}
|
4729 |
break;
|
4730 |
} else if (Number(rowChildren[_k7].dataset.xIndex) < Number(cellXIndex) && Number(rowChildren[_k7].dataset.xIndex) + Number(rowChildren[_k7].colSpan - 1) >= cellXIndex) {
|
@@ -4737,8 +5100,8 @@ var array = [],
|
|
4737 |
}
|
4738 |
}
|
4739 |
|
4740 |
-
for (var
|
4741 |
-
if (array[
|
4742 |
}
|
4743 |
|
4744 |
maxAmountOfCells--;
|
@@ -4790,6 +5153,9 @@ var array = [],
|
|
4790 |
|
4791 |
WPTB_LeftPanel();
|
4792 |
|
|
|
|
|
|
|
4793 |
WPTB_Helper.elementStartScript(table, 'table_setting');
|
4794 |
WPTB_Helper.elementOptionsSet('table_setting', table);
|
4795 |
|
@@ -5090,190 +5456,4 @@ var WPTB_TableStateSaveManager = function WPTB_TableStateSaveManager() {
|
|
5090 |
}
|
5091 |
};
|
5092 |
};
|
5093 |
-
var WPTB_innerElementSet = function WPTB_innerElementSet(element) {
|
5094 |
-
|
5095 |
-
element.ondragenter = function (e) {
|
5096 |
-
var div;
|
5097 |
-
if (e.dataTransfer.types.indexOf('wptbelement') == -1 && e.dataTransfer.types.indexOf('wptb-moving-mode') == -1) {
|
5098 |
-
return;
|
5099 |
-
}
|
5100 |
-
WPTB_DropHandle(this, e);
|
5101 |
-
|
5102 |
-
element.classList.add('wptb-ondragenter');
|
5103 |
-
};
|
5104 |
-
element.ondragover = function (e) {
|
5105 |
-
e.preventDefault();
|
5106 |
-
WPTB_DropHandle(this, e);
|
5107 |
-
};
|
5108 |
-
element.ondragleave = function () {};
|
5109 |
-
element.ondrop = function (e) {
|
5110 |
-
this.classList.remove('wptb-ondragenter');
|
5111 |
-
var element = void 0,
|
5112 |
-
classId = void 0;
|
5113 |
-
e.preventDefault();
|
5114 |
-
e.stopPropagation();
|
5115 |
-
|
5116 |
-
if (!e.dataTransfer.getData('wptbElement') && !e.dataTransfer.getData('node')) {
|
5117 |
-
return;
|
5118 |
-
}
|
5119 |
-
var wptbDropHandle = void 0,
|
5120 |
-
wptbDropBorderMarker = void 0;
|
5121 |
-
if (document.getElementsByClassName('wptb-drop-handle').length > 0) {
|
5122 |
-
wptbDropHandle = document.getElementsByClassName('wptb-drop-handle')[0];
|
5123 |
-
}
|
5124 |
-
if (document.getElementsByClassName('wptb-drop-border-marker').length > 0) {
|
5125 |
-
wptbDropBorderMarker = document.getElementsByClassName('wptb-drop-border-marker')[0];
|
5126 |
-
}
|
5127 |
-
|
5128 |
-
if (e.dataTransfer.getData('wptbElement')) {
|
5129 |
-
element = WPTB_Helper.newElementProxy(e.dataTransfer.getData('wptbElement'));
|
5130 |
-
element = element.getDOMElement();
|
5131 |
-
} else {
|
5132 |
-
classId = e.dataTransfer.getData('node');
|
5133 |
-
element = document.getElementsByClassName(classId)[0];
|
5134 |
-
//element.classList.remove( 'wptb-moving-mode' );
|
5135 |
-
}
|
5136 |
-
|
5137 |
-
if (wptbDropHandle.style.display == 'block') {
|
5138 |
-
var td = void 0;
|
5139 |
-
if (wptbDropHandle.dataset.text == 'Drop Here') {
|
5140 |
-
td = wptbDropHandle.getDOMParentElement();
|
5141 |
-
td.appendChild(element);
|
5142 |
-
} else {
|
5143 |
-
var innerElement = wptbDropHandle.getDOMParentElement();
|
5144 |
-
td = innerElement.parentNode;
|
5145 |
-
|
5146 |
-
if (wptbDropHandle.dataset.text == 'Above Element') {
|
5147 |
-
td.insertBefore(element, innerElement);
|
5148 |
-
} else if (wptbDropHandle.dataset.text == 'Below Element') {
|
5149 |
-
var innerElementNext = innerElement.nextSibling;
|
5150 |
-
td.insertBefore(element, innerElementNext);
|
5151 |
-
}
|
5152 |
-
}
|
5153 |
-
|
5154 |
-
var thisRow = td.parentNode;
|
5155 |
-
if (WPTB_Helper.rowIsTop(thisRow)) {
|
5156 |
-
var table = WPTB_Helper.findAncestor(thisRow, 'wptb-preview-table');
|
5157 |
-
|
5158 |
-
if (table.classList.contains('wptb-table-preview-head')) {
|
5159 |
-
WPTB_Helper.dataTitleColumnSet(table);
|
5160 |
-
}
|
5161 |
-
}
|
5162 |
-
|
5163 |
-
// start item javascript if item is new
|
5164 |
-
var infArr = element.className.match(/wptb-element-(.+)-(\d+)/i);
|
5165 |
-
var elemKind = infArr[1];
|
5166 |
-
if (e.dataTransfer.getData('wptbElement') && (elemKind == 'text' || elemKind == 'button' || elemKind == 'image' || elemKind == 'star_rating' || elemKind == 'list')) {
|
5167 |
-
//WPTB_Helper.elementStartScript( element );
|
5168 |
-
}
|
5169 |
-
} else {
|
5170 |
-
return;
|
5171 |
-
}
|
5172 |
-
|
5173 |
-
wptbDropHandle.style.display = 'none';
|
5174 |
-
wptbDropBorderMarker.style.display = 'none';
|
5175 |
-
|
5176 |
-
WPTB_innerElementSet(element);
|
5177 |
-
|
5178 |
-
if (!element.classList.contains('wptb-image-container') || element.classList.contains('wptb-moving-mode')) {
|
5179 |
-
element.classList.remove('wptb-moving-mode');
|
5180 |
-
var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
|
5181 |
-
wptbTableStateSaveManager.tableStateSet();
|
5182 |
-
}
|
5183 |
-
return true;
|
5184 |
-
};
|
5185 |
-
element.onmouseover = function (e) {
|
5186 |
-
element.classList.remove('wptb-ondragenter');
|
5187 |
-
};
|
5188 |
-
};
|
5189 |
-
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
5190 |
-
|
5191 |
-
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
|
5192 |
-
|
5193 |
-
var applyGenericItemSettings = function applyGenericItemSettings(element, kindIndexProt) {
|
5194 |
-
var copy = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
5195 |
-
|
5196 |
-
var node = element.getDOMElement(),
|
5197 |
-
index,
|
5198 |
-
copy;
|
5199 |
-
if (node.classList.contains('wptb-ph-element')) {
|
5200 |
-
if (kindIndexProt == undefined || copy == true) {
|
5201 |
-
//index = document.counter.nextIndex( element.kind );
|
5202 |
-
var wptbElements = document.getElementsByClassName('wptb-ph-element');
|
5203 |
-
var elementIndexesArr = [];
|
5204 |
-
for (var i = 0; i < wptbElements.length; i++) {
|
5205 |
-
var regex = new RegExp('wptb-element-' + element.kind + '-(\\d+)', "i");
|
5206 |
-
var infArr = wptbElements[i].className.match(regex);
|
5207 |
-
if (infArr) {
|
5208 |
-
elementIndexesArr.push(infArr[1]);
|
5209 |
-
}
|
5210 |
-
}
|
5211 |
-
if (elementIndexesArr.length > 0) {
|
5212 |
-
var elementIndexMax = Math.max.apply(Math, elementIndexesArr);
|
5213 |
-
index = elementIndexMax + 1;
|
5214 |
-
} else {
|
5215 |
-
index = 1;
|
5216 |
-
}
|
5217 |
-
|
5218 |
-
if (copy) {
|
5219 |
-
// change all data-elements which save parameters for different controls
|
5220 |
-
var wptbNodeattributes = [].concat(_toConsumableArray(node.attributes));
|
5221 |
-
for (var _i = 0; _i < wptbNodeattributes.length; _i++) {
|
5222 |
-
if (wptbNodeattributes[_i] && _typeof(wptbNodeattributes[_i]) === 'object' && wptbNodeattributes[_i].nodeName) {
|
5223 |
-
var regularText = new RegExp('data-wptb-el-' + element.kind + '-(\\d+)-([a-zA-Z0-9_-]+)', "i");
|
5224 |
-
var attr = wptbNodeattributes[_i].nodeName.match(regularText);
|
5225 |
-
if (attr && Array.isArray(attr)) {
|
5226 |
-
var newDataAttributeName = wptbNodeattributes[_i].nodeName.replace(element.kind + '-' + attr[1], element.kind + '-' + index);
|
5227 |
-
var newDataAttributeValue = wptbNodeattributes[_i].nodeValue;
|
5228 |
-
node.removeAttribute(wptbNodeattributes[_i].nodeName);
|
5229 |
-
node.setAttribute(newDataAttributeName, newDataAttributeValue);
|
5230 |
-
}
|
5231 |
-
}
|
5232 |
-
}
|
5233 |
-
}
|
5234 |
-
} else if (kindIndexProt && !copy) {
|
5235 |
-
var kindIndexProtArr = kindIndexProt.split('-');
|
5236 |
-
index = kindIndexProtArr[kindIndexProtArr.length - 1];
|
5237 |
-
// start element javascript if element is new
|
5238 |
-
}
|
5239 |
-
|
5240 |
-
var node_wptb_element_kind_num = node.className.match(/wptb-element-(.+)-(\d+)/i);
|
5241 |
-
if (node_wptb_element_kind_num) {
|
5242 |
-
node.classList.remove(node_wptb_element_kind_num[0]);
|
5243 |
-
}
|
5244 |
-
if (!node.classList.contains('wptb-ph-element')) {
|
5245 |
-
node.classList.add('wptb-ph-element');
|
5246 |
-
if (!node.classList.contains('wptb-element-' + element.kind + '-' + index)) {
|
5247 |
-
node.classList.add('wptb-element-' + element.kind + '-' + index);
|
5248 |
-
}
|
5249 |
-
} else {
|
5250 |
-
if (!node.classList.contains('wptb-element-' + element.kind + '-' + index)) {
|
5251 |
-
node.classList.add('wptb-element-' + element.kind + '-' + index);
|
5252 |
-
}
|
5253 |
-
}
|
5254 |
-
WPTB_Helper.elementStartScript(element.getDOMElement());
|
5255 |
-
new WPTB_ElementOptions(element, index, kindIndexProt);
|
5256 |
-
document.counter.increment(element.kind);
|
5257 |
-
}
|
5258 |
-
|
5259 |
-
node.onmouseenter = function (event) {
|
5260 |
-
if (event.target.classList.contains('wptb-moving-mode')) {
|
5261 |
-
return;
|
5262 |
-
}
|
5263 |
-
|
5264 |
-
var wptbActionsField = new WPTB_ActionsField();
|
5265 |
-
|
5266 |
-
wptbActionsField.addActionField(1, node);
|
5267 |
-
|
5268 |
-
wptbActionsField.setParameters(node);
|
5269 |
-
|
5270 |
-
node.classList.remove('wptb-ondragenter');
|
5271 |
-
};
|
5272 |
-
|
5273 |
-
node.onmouseleave = function (event) {
|
5274 |
-
var wptbActionsField = new WPTB_ActionsField();
|
5275 |
-
|
5276 |
-
wptbActionsField.leaveFromField(event, node);
|
5277 |
-
};
|
5278 |
-
};
|
5279 |
//# sourceMappingURL=admin.js.map
|
1 |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
2 |
|
3 |
+
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
|
4 |
+
|
5 |
+
var applyGenericItemSettings = function applyGenericItemSettings(element, kindIndexProt) {
|
6 |
+
var copy = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
7 |
+
|
8 |
+
var node = element.getDOMElement(),
|
9 |
+
index,
|
10 |
+
copy;
|
11 |
+
if (node.classList.contains('wptb-ph-element')) {
|
12 |
+
if (kindIndexProt == undefined || copy == true) {
|
13 |
+
//index = document.counter.nextIndex( element.kind );
|
14 |
+
var wptbElements = document.getElementsByClassName('wptb-ph-element');
|
15 |
+
var elementIndexesArr = [];
|
16 |
+
for (var i = 0; i < wptbElements.length; i++) {
|
17 |
+
var regex = new RegExp('wptb-element-' + element.kind + '-(\\d+)', "i");
|
18 |
+
var infArr = wptbElements[i].className.match(regex);
|
19 |
+
if (infArr) {
|
20 |
+
elementIndexesArr.push(infArr[1]);
|
21 |
+
}
|
22 |
+
}
|
23 |
+
if (elementIndexesArr.length > 0) {
|
24 |
+
var elementIndexMax = Math.max.apply(Math, elementIndexesArr);
|
25 |
+
index = elementIndexMax + 1;
|
26 |
+
} else {
|
27 |
+
index = 1;
|
28 |
+
}
|
29 |
+
|
30 |
+
if (copy) {
|
31 |
+
// change all data-elements which save parameters for different controls
|
32 |
+
var wptbNodeattributes = [].concat(_toConsumableArray(node.attributes));
|
33 |
+
for (var _i = 0; _i < wptbNodeattributes.length; _i++) {
|
34 |
+
if (wptbNodeattributes[_i] && _typeof(wptbNodeattributes[_i]) === 'object' && wptbNodeattributes[_i].nodeName) {
|
35 |
+
var regularText = new RegExp('data-wptb-el-' + element.kind + '-(\\d+)-([a-zA-Z0-9_-]+)', "i");
|
36 |
+
var attr = wptbNodeattributes[_i].nodeName.match(regularText);
|
37 |
+
if (attr && Array.isArray(attr)) {
|
38 |
+
var newDataAttributeName = wptbNodeattributes[_i].nodeName.replace(element.kind + '-' + attr[1], element.kind + '-' + index);
|
39 |
+
var newDataAttributeValue = wptbNodeattributes[_i].nodeValue;
|
40 |
+
node.removeAttribute(wptbNodeattributes[_i].nodeName);
|
41 |
+
node.setAttribute(newDataAttributeName, newDataAttributeValue);
|
42 |
+
}
|
43 |
+
}
|
44 |
+
}
|
45 |
+
}
|
46 |
+
} else if (kindIndexProt && !copy) {
|
47 |
+
var kindIndexProtArr = kindIndexProt.split('-');
|
48 |
+
index = kindIndexProtArr[kindIndexProtArr.length - 1];
|
49 |
+
// start element javascript if element is new
|
50 |
+
}
|
51 |
+
|
52 |
+
var node_wptb_element_kind_num = node.className.match(/wptb-element-(.+)-(\d+)/i);
|
53 |
+
if (node_wptb_element_kind_num) {
|
54 |
+
node.classList.remove(node_wptb_element_kind_num[0]);
|
55 |
+
}
|
56 |
+
if (!node.classList.contains('wptb-ph-element')) {
|
57 |
+
node.classList.add('wptb-ph-element');
|
58 |
+
if (!node.classList.contains('wptb-element-' + element.kind + '-' + index)) {
|
59 |
+
node.classList.add('wptb-element-' + element.kind + '-' + index);
|
60 |
+
}
|
61 |
+
} else {
|
62 |
+
if (!node.classList.contains('wptb-element-' + element.kind + '-' + index)) {
|
63 |
+
node.classList.add('wptb-element-' + element.kind + '-' + index);
|
64 |
+
}
|
65 |
+
}
|
66 |
+
WPTB_Helper.elementStartScript(element.getDOMElement());
|
67 |
+
new WPTB_ElementOptions(element, index, kindIndexProt);
|
68 |
+
document.counter.increment(element.kind);
|
69 |
+
}
|
70 |
+
|
71 |
+
node.onmouseenter = function (event) {
|
72 |
+
if (event.target.classList.contains('wptb-moving-mode')) {
|
73 |
+
return;
|
74 |
+
}
|
75 |
+
|
76 |
+
var wptbActionsField = new WPTB_ActionsField();
|
77 |
+
|
78 |
+
wptbActionsField.addActionField(1, node);
|
79 |
+
|
80 |
+
wptbActionsField.setParameters(node);
|
81 |
+
|
82 |
+
node.classList.remove('wptb-ondragenter');
|
83 |
+
};
|
84 |
+
|
85 |
+
node.onmouseleave = function (event) {
|
86 |
+
var wptbActionsField = new WPTB_ActionsField();
|
87 |
+
|
88 |
+
wptbActionsField.leaveFromField(event, node);
|
89 |
+
};
|
90 |
+
};
|
91 |
+
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
92 |
+
|
93 |
var WPTB_ActionsField = function WPTB_ActionsField() {
|
94 |
var _this = this;
|
95 |
|
457 |
document.addEventListener('DOMContentLoaded', WPTB_Builder);
|
458 |
}
|
459 |
})();
|
|
|
|
|
460 |
var WPTB_Cell = function WPTB_Cell(callback, DOMElement) {
|
461 |
|
462 |
function highlightRow(td) {
|
534 |
|
535 |
WPTB_innerElementSet(DOMElement);
|
536 |
|
537 |
+
WPTB_Helper.elementStartScript(DOMElement, 'table_cell_setting');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
538 |
|
539 |
var wptbPhElement = DOMElement.getElementsByClassName('wptb-ph-element');
|
540 |
|
614 |
var tdBorderTopWidth = tdStyleObj.getPropertyValue('border-top-width');
|
615 |
var tdBorderBottomWidth = tdStyleObj.getPropertyValue('border-bottom-width');
|
616 |
|
617 |
+
var width = parseInt(this.offsetWidth, 10) - parseInt(tdPaddingLeft, 10) - parseInt(tdPaddingRight, 10);
|
|
|
|
|
618 |
|
619 |
+
var height = parseInt(this.offsetHeight, 10) - parseInt(tdPaddingTop, 10) - parseInt(tdPaddingBottom, 10);
|
620 |
var table = WPTB_Helper.findAncestor(this, 'wptb-preview-table');
|
621 |
if (table) {
|
622 |
+
if (table.style.borderCollapse === 'collapse') {
|
623 |
+
width = width - parseInt(tdBorderLeftWidth, 10) / 2 - parseInt(tdBorderRightWidth, 10) / 2;
|
624 |
+
height = height - parseInt(tdBorderTopWidth, 10) / 2 - parseInt(tdBorderBottomWidth, 10) / 2;
|
625 |
+
var tableFullStyleObj = window.getComputedStyle(table, null);
|
626 |
+
var tableBorderLeft = tableFullStyleObj.getPropertyValue('border-left-width');
|
627 |
+
var tableBorderRight = tableFullStyleObj.getPropertyValue('border-right-width');
|
628 |
+
var tableBorderTop = tableFullStyleObj.getPropertyValue('border-top-width');
|
629 |
+
var tableBorderBottom = tableFullStyleObj.getPropertyValue('border-bottom-width');
|
630 |
+
|
631 |
+
var tr = this.parentNode;
|
632 |
+
if (tr && tr.nodeName.toLowerCase() === 'tr') {
|
633 |
+
if (tr.firstChild && tr.firstChild.dataset.xIndex === this.dataset.xIndex) {
|
634 |
+
if (parseInt(tableBorderLeft, 10) > parseInt(tdBorderLeftWidth, 10)) {
|
635 |
+
width += -(parseInt(tableBorderLeft, 10) - parseInt(tdBorderLeftWidth, 10)) / 2;
|
636 |
+
}
|
637 |
}
|
|
|
638 |
|
639 |
+
if (tr.lastChild && tr.lastChild.dataset.xIndex === this.dataset.xIndex) {
|
640 |
+
if (parseInt(tableBorderRight, 10) > parseInt(tdBorderRightWidth, 10)) {
|
641 |
+
width += -(parseInt(tableBorderRight, 10) - parseInt(tdBorderRightWidth, 10)) / 2;
|
642 |
+
}
|
643 |
}
|
|
|
644 |
|
645 |
+
var body = tr.parentNode;
|
646 |
+
if (body && body.nodeName.toLowerCase() === 'body') {
|
647 |
+
if (body.firstChild && body.firstChild.firstChild.dataset.yIndex === this.dataset.yIndex) {
|
648 |
+
if (parseInt(tableBorderTop, 10) > parseInt(tdBorderTopWidth, 10)) {
|
649 |
+
height += (parseInt(tableBorderTop, 10) - parseInt(tdBorderTopWidth, 10)) / 2;
|
650 |
+
}
|
651 |
}
|
|
|
652 |
|
653 |
+
if (body.lastChild && body.lastChild.firstChild.dataset.yIndex === this.dataset.yIndex) {
|
654 |
+
if (parseInt(tableBorderBottom, 10) > parseInt(tdBorderBottomWidth, 10)) {
|
655 |
+
height += (parseInt(tableBorderBottom, 10) - parseInt(tdBorderBottomWidth, 10)) / 2;
|
656 |
+
}
|
657 |
}
|
658 |
}
|
659 |
}
|
660 |
+
} else if (table.style.borderCollapse === 'separate') {
|
661 |
+
width = width - parseInt(tdBorderLeftWidth, 10) - parseInt(tdBorderRightWidth, 10);
|
662 |
+
height = height - parseInt(tdBorderTopWidth, 10) - parseInt(tdBorderBottomWidth, 10);
|
663 |
}
|
664 |
}
|
665 |
|
1045 |
}
|
1046 |
},
|
1047 |
dataTitleColumnSet: function dataTitleColumnSet(table) {
|
1048 |
+
// TODO dataTitleColumnSet
|
1049 |
+
// let rows = table.rows,
|
1050 |
+
// rowHead = rows[0];
|
1051 |
+
// let computedStyleRowHead = getComputedStyle( rowHead );
|
1052 |
+
//
|
1053 |
+
// let rowHeadChildren = rowHead.children;
|
1054 |
+
// let contentsForHeader = {};
|
1055 |
+
// for( let i = 0; i < rowHeadChildren.length; i++ ) {
|
1056 |
+
// let tdElements = rowHeadChildren[i].children;
|
1057 |
+
//
|
1058 |
+
// for( let j = 0; j < tdElements.length; j++ ) {
|
1059 |
+
// let element = tdElements[j];
|
1060 |
+
// if( element.classList.contains( 'wptb-ph-element' ) ) {
|
1061 |
+
// let infArr = element.className.match( /wptb-element-(.+)-(\d+)/i );
|
1062 |
+
// if( infArr[1] == 'text' ) {
|
1063 |
+
// let p = element.querySelector( 'p' ),
|
1064 |
+
// textContent = p.textContent,
|
1065 |
+
// textAlign = p.style.textAlign;
|
1066 |
+
// contentsForHeader[rowHeadChildren[i].dataset.xIndex] = [textContent, element.style.fontSize,
|
1067 |
+
// element.style.color, computedStyleRowHead.backgroundColor, textAlign];
|
1068 |
+
// break;
|
1069 |
+
// }
|
1070 |
+
// }
|
1071 |
+
// }
|
1072 |
+
// if( ! contentsForHeader[rowHeadChildren[i].dataset.xIndex] ) {
|
1073 |
+
// contentsForHeader[rowHeadChildren[i].dataset.xIndex] = ['', '',
|
1074 |
+
// '', computedStyleRowHead.backgroundColor, ''];
|
1075 |
+
// }
|
1076 |
+
// }
|
1077 |
+
// for ( let i = 1; i < rows.length; i++ ) {
|
1078 |
+
// let thisRow = rows[i],
|
1079 |
+
// thisRowChildren = thisRow.children;
|
1080 |
+
// for( let j = 0; j < thisRowChildren.length; j++ ) {
|
1081 |
+
// if ( contentsForHeader[thisRowChildren[j].dataset.xIndex] ) {
|
1082 |
+
// thisRowChildren[j].dataset.wptbTitleColumn = contentsForHeader[thisRowChildren[j].dataset.xIndex][0];
|
1083 |
+
// thisRowChildren[j].dataset.wptbTitleColumnFontSize = contentsForHeader[thisRowChildren[j].dataset.xIndex][1];
|
1084 |
+
// thisRowChildren[j].dataset.wptbTitleColumnColor = contentsForHeader[thisRowChildren[j].dataset.xIndex][2];
|
1085 |
+
// thisRowChildren[j].dataset.wptbTitleBackgroundColor = contentsForHeader[thisRowChildren[j].dataset.xIndex][3];
|
1086 |
+
// thisRowChildren[j].dataset.wptbTitleAlign = contentsForHeader[thisRowChildren[j].dataset.xIndex][4];
|
1087 |
+
// } else {
|
1088 |
+
// thisRowChildren[j].dataset.wptbTitleColumn = null;
|
1089 |
+
// thisRowChildren[j].dataset.wptbTitleColumnFontSize = null;
|
1090 |
+
// thisRowChildren[j].dataset.wptbTitleColumnColor = null;
|
1091 |
+
// thisRowChildren[j].dataset.wptbTitleBackgroundColor = null;
|
1092 |
+
// thisRowChildren[j].dataset.wptbTitleAlign = null;
|
1093 |
+
// }
|
1094 |
+
// }
|
1095 |
+
// }
|
1096 |
},
|
1097 |
findAncestor: function findAncestor(el, cls) {
|
1098 |
while ((el = el.parentElement) && !el.classList.contains(cls)) {}
|
1236 |
} else if (type == 'star_rating') {
|
1237 |
if (parent.dataset.type == 'star-color') {
|
1238 |
var ratingStar = affectedEl.querySelectorAll('li');
|
1239 |
+
for (var _i3 = 0; _i3 < ratingStar.length; _i3++) {
|
1240 |
+
var span = ratingStar[_i3].getElementsByTagName('span');
|
1241 |
for (var j = 0; j < span.length; j++) {
|
1242 |
span[j].style.fill = uiColor;
|
1243 |
}
|
1416 |
if (element && (typeof element === 'undefined' ? 'undefined' : _typeof(element)) === 'object' && functionHandler && typeof functionHandler === 'function') {
|
1417 |
element.addEventListener('element:controls:active', function () {
|
1418 |
if (!element.hasOwnProperty('controlConnectFunctionsName') || !Array.isArray(element.controlConnectFunctionsName) || element.controlConnectFunctionsName.indexOf(functionHandler.name) == -1) {
|
1419 |
+
(function () {
|
1420 |
+
var infArr = element.className.match(/wptb-element-(.+)-(\d+)/i),
|
1421 |
+
elementKind = void 0;
|
|
|
|
|
|
|
1422 |
|
1423 |
+
if (infArr && Array.isArray(infArr)) {
|
1424 |
+
elementKind = infArr[1];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1425 |
}
|
1426 |
|
1427 |
+
// if( ! element.hasOwnProperty( 'сontrolsConnectIndic' ) || element.сontrolsConnectIndic !== true && elementKind ) {
|
1428 |
+
// let elementsSettingsTemplateJs = document.getElementsByClassName( 'wptb-element-datas' );
|
1429 |
+
// if( elementsSettingsTemplateJs.length > 0 ) {
|
1430 |
+
// elementsSettingsTemplateJs = elementsSettingsTemplateJs[0];
|
1431 |
+
//
|
1432 |
+
// let elementsSettings = elementsSettingsTemplateJs.innerHTML;
|
1433 |
+
// let controlClassesNames = [];
|
1434 |
+
// if( elementsSettings ) {
|
1435 |
+
// elementsSettings = elementsSettings.trim();
|
1436 |
+
// elementsSettings = JSON.parse( elementsSettings );
|
1437 |
+
// if( elementsSettings && typeof elementsSettings === 'object' ) {
|
1438 |
+
// if( 'tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2] in elementsSettings ) {
|
1439 |
+
// let elementSettings = elementsSettings['tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2]];
|
1440 |
+
// if( elementSettings && typeof elementSettings === 'object' ) {
|
1441 |
+
// Object.keys( elementSettings ).forEach( function( key ) {
|
1442 |
+
// let regularText = new RegExp( 'data-wptb-el-' + elementKind + '-(\\d+)-([a-zA-Z0-9_-]+)', "i" );
|
1443 |
+
// let keyInfArr = key.match( regularText );
|
1444 |
+
// if( keyInfArr && Array.isArray( keyInfArr ) ) {
|
1445 |
+
// let controlClass = key.replace( 'data-', '' );
|
1446 |
+
// controlClassesNames.push( [controlClass, keyInfArr[2]] );
|
1447 |
+
// }
|
1448 |
+
// });
|
1449 |
+
// }
|
1450 |
+
// }
|
1451 |
+
// }
|
1452 |
+
// }
|
1453 |
+
// }
|
1454 |
+
// }
|
1455 |
+
if (elementKind) {
|
1456 |
+
var elementOptionsGroupIds = element.optionsGroupIds;
|
1457 |
+
if (elementOptionsGroupIds && Array.isArray(elementOptionsGroupIds)) {
|
1458 |
+
for (var i = 0; i < elementOptionsGroupIds.length; i++) {
|
1459 |
+
var _elementOptionsGroupId = elementOptionsGroupIds[i];
|
1460 |
+
|
1461 |
+
var elementOptionsGroup = document.getElementById(_elementOptionsGroupId);
|
1462 |
+
|
1463 |
+
var controlActiveElements = elementOptionsGroup.querySelectorAll('.wptb-element-property');
|
1464 |
+
controlActiveElements = [].concat(_toConsumableArray(controlActiveElements));
|
1465 |
+
|
1466 |
+
controlActiveElements.map(function (controlActiveElement) {
|
1467 |
+
var regularText = new RegExp('wptb-el-' + elementKind + '-(\\d+)-([a-zA-Z0-9_-]+)', "i");
|
1468 |
+
var controlInfArr = controlActiveElement.className.match(regularText);
|
1469 |
+
if (controlInfArr && Array.isArray(controlInfArr)) {
|
1470 |
+
var controlUnicClassName = controlInfArr[0];
|
1471 |
+
|
1472 |
+
element.addEventListener('wptb-control:' + controlUnicClassName, function () {
|
1473 |
+
var controls = {};
|
1474 |
+
var controlName = controlInfArr[2];
|
1475 |
+
var control = document.getElementsByClassName(controlUnicClassName);
|
1476 |
+
if (control.length > 0 && controlName) {
|
1477 |
+
var targetControlValue = WPTB_Helper.targetControlValueGet(control);
|
1478 |
+
|
1479 |
+
controls[controlName] = targetControlValue;
|
1480 |
+
}
|
1481 |
|
1482 |
+
functionHandler(controls, element);
|
1483 |
+
}, false);
|
1484 |
+
}
|
1485 |
+
});
|
1486 |
+
}
|
1487 |
+
}
|
1488 |
+
//let elementOptionsContainer = document.querySelector( '.wptb-element-options.wptb-options-' + infArr[1] + '-' + infArr[2] );
|
1489 |
+
|
1490 |
+
// from time to time depend on table cells hierarchy, cell td items may catch mouse clicks which are intended for elements. since the active section is not cell management, this will gives and unharmfull error of not found element, simple check for null equality will be sufficient for now.
|
1491 |
+
// if(!elementOptionsContainer){
|
1492 |
+
// return;
|
1493 |
+
// }
|
1494 |
+
|
1495 |
+
// let elementOptions = elementOptionsContainer.querySelectorAll( '.wptb-element-option' );
|
1496 |
+
// let controlActiveElements = elementOptions[i].querySelector( '.wptb-element-property' );
|
1497 |
+
//
|
1498 |
+
//
|
1499 |
+
// for( let i = 0; i < elementOptions.length; i++ ) {
|
1500 |
+
// let controlActiveElement = elementOptions[i].querySelector( '.wptb-element-property' );
|
1501 |
+
// if( controlActiveElement ) {
|
1502 |
+
//
|
1503 |
+
// }
|
1504 |
+
// }
|
1505 |
+
|
1506 |
+
if (!element.controlConnectFunctionsName && !Array.isArray(element.controlConnectFunctionsName)) {
|
1507 |
+
element.controlConnectFunctionsName = [];
|
1508 |
}
|
|
|
1509 |
|
1510 |
+
element.controlConnectFunctionsName.push(functionHandler.name);
|
|
|
1511 |
}
|
1512 |
+
})();
|
|
|
|
|
1513 |
}
|
1514 |
}, false);
|
1515 |
}
|
1590 |
// if( elementsSettings ) {
|
1591 |
// elementsSettings = elementsSettings.trim();
|
1592 |
// elementsSettings = JSON.parse( elementsSettings );
|
1593 |
+
// if( elementsSettings && typeof elementsSettings === 'object' &&
|
1594 |
// ( 'tmpl-wptb-el-datas-' + dependOnControlElementKind ) in elementsSettings ) {
|
1595 |
// let elementSettings = elementsSettings['tmpl-wptb-el-datas-' + dependOnControlElementKind];
|
1596 |
+
// if( elementSettings && typeof elementSettings === 'object' &&
|
1597 |
// ( 'data-wptb-el-' + dependOnControlElementKind + '-' + dependOnControlName ) in elementSettings ) {
|
1598 |
// let elementSettingValue = elementSettings['data-wptb-el-' + dependOnControlElementKind + '-' + dependOnControlName];
|
1599 |
+
//
|
1600 |
// if( elementSettingValue ) {
|
1601 |
+
// if( dependOn[1] && Array.isArray( dependOn[1] ) &&
|
1602 |
// ( dependOn[1].indexOf( elementSettingValue ) !== -1 ) ) {
|
1603 |
// controlContainerElem.style.display = 'block';
|
1604 |
+
// } else if( dependOn[2] && Array.isArray( dependOn[2] ) &&
|
1605 |
// ( dependOn[2].indexOf( elementSettingValue ) !== -1 ) ) {
|
1606 |
// controlContainerElem.style.display = 'none';
|
1607 |
// }
|
1818 |
}
|
1819 |
}
|
1820 |
},
|
1821 |
+
//
|
1822 |
elementOptionsSet: function elementOptionsSet(kind, element) {
|
1823 |
// get controls config for this element
|
1824 |
var wptbContrlStacksConfigId = 'wptb-' + kind + '-control-stack';
|
1827 |
var elementContainerClass = void 0;
|
1828 |
var elementOptionClassIndic = void 0;
|
1829 |
var elementOptionsGroup = void 0;
|
|
|
|
|
1830 |
|
1831 |
+
var controlElementParent = void 0;
|
1832 |
+
var elementOptionsScriptsContainer = void 0;
|
|
|
1833 |
|
1834 |
var infArr = element.className.match(/wptb-element-((.+-)\d+)/i);
|
1835 |
if (!infArr) {
|
1840 |
if (element.classList.contains('wptb-preview-table')) {
|
1841 |
element.classList.add('wptb-element-main-table_setting-' + table_id);
|
1842 |
} else if (element.classList.contains('wptb-cell')) {
|
1843 |
+
var cellEditActiveClass = document.querySelector('.wptb-element-table_cell_setting-' + element.dataset.xIndex + '-' + element.dataset.yIndex);
|
1844 |
+
if (!cellEditActiveClass) element.classList.add('wptb-element-table_cell_setting-' + element.dataset.xIndex + '-' + element.dataset.yIndex);
|
1845 |
+
} else if (element.classList.contains('wptb-responsive')) {
|
1846 |
+
element.classList.add('wptb-element-table_responsive_setting-' + table_id);
|
1847 |
}
|
1848 |
|
1849 |
infArr = element.className.match(/wptb-element-((.+-)\d+)/i);
|
1856 |
elementContainerClass = infArr[0];
|
1857 |
elementOptionClassIndic = infArr[1];
|
1858 |
|
1859 |
+
if (element.classList.contains('wptb-preview-table')) {} else if (element.classList.contains('wptb-cell')) {
|
|
|
|
|
|
|
|
|
|
|
|
|
1860 |
this.activateSection('cell_settings');
|
1861 |
+
} else if (element.classList.contains('wptb-responsive')) {
|
1862 |
+
elementOptionsGroupId = 'table-responsive-group';
|
1863 |
+
wptbelementOptionClass = 'wptb-element-option';
|
1864 |
} else {
|
1865 |
var children = document.getElementById('element-options-group').childNodes;
|
1866 |
+
for (var _i4 = 0; _i4 < children.length; _i4++) {
|
1867 |
+
if (children[_i4].style) children[_i4].style.display = 'none';
|
1868 |
}
|
1869 |
|
1870 |
// hide wptb-elements-container and wptb-settings-section
|
1874 |
// show element-options-group
|
1875 |
// document.getElementById( 'element-options-group' ).style.display = 'block';
|
1876 |
this.activateSection('options_group');
|
|
|
|
|
|
|
1877 |
}
|
1878 |
|
|
|
|
|
|
|
1879 |
var jsonControlsConfigJson = tmplControlsConfig(data);
|
1880 |
var jsonControlsConfig = JSON.parse(jsonControlsConfigJson);
|
1881 |
|
1882 |
+
var elementOptionsGroupIdsInvolved = [],
|
1883 |
+
elementOptionsGroupInvolved = {},
|
1884 |
+
elementOptionsContainerInvolved = {};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1885 |
|
1886 |
+
// object for save all scrips for each controls
|
1887 |
+
var controlScriptsObj = {};
|
1888 |
|
1889 |
// array for keep "appear depend on" parametrs
|
1890 |
var controlappearDependOnControl = [];
|
1891 |
|
1892 |
// create controls
|
1893 |
+
var elementOptionsScriptsContainerIndic = false;
|
1894 |
var i = 0;
|
1895 |
Object.keys(jsonControlsConfig).forEach(function (key) {
|
1896 |
var data = jsonControlsConfig[key];
|
1909 |
}
|
1910 |
}
|
1911 |
|
1912 |
+
function elementOptionsContainerInvolvedGet(elementOptionsGroupId, elementOptionsContainerInvolved) {
|
1913 |
+
if (!elementOptionsContainerInvolved[elementOptionsGroupId]) {
|
1914 |
+
var elementOptionsContainer = document.createElement('div');
|
1915 |
+
elementOptionsContainer.classList.add('wptb-element-options', 'wptb-options-' + infArr[1]);
|
1916 |
+
document.getElementById(elementOptionsGroupId).appendChild(elementOptionsContainer);
|
1917 |
+
elementOptionsContainerInvolved[elementOptionsGroupId] = elementOptionsContainer;
|
1918 |
+
}
|
1919 |
+
|
1920 |
+
return elementOptionsContainerInvolved[elementOptionsGroupId];
|
1921 |
+
}
|
1922 |
|
1923 |
+
if (elementOptionsGroupIdsInvolved.indexOf(data.elementOptionsGroupId) == -1) {
|
1924 |
+
elementOptionsGroupIdsInvolved.push(data.elementOptionsGroupId);
|
1925 |
+
// clear elements from options group
|
1926 |
+
//document.getElementById( 'element-options-group' ).innerHTML = '';
|
1927 |
+
elementOptionsGroup = document.getElementById(data.elementOptionsGroupId);
|
1928 |
+
var elementOptionsGroupChildren = [].concat(_toConsumableArray(elementOptionsGroup.children));
|
1929 |
+
for (var _i5 = 0; _i5 < elementOptionsGroupChildren.length; _i5++) {
|
1930 |
+
elementOptionsGroup.removeChild(elementOptionsGroupChildren[_i5]);
|
1931 |
+
}
|
1932 |
+
elementOptionsGroupInvolved[data.elementOptionsGroupId] = elementOptionsGroup;
|
1933 |
}
|
1934 |
|
1935 |
+
controlElementParent = elementOptionsGroupInvolved[data.elementOptionsGroupId];
|
1936 |
+
|
1937 |
+
if (data.elementOptionsContainerOn === 'true') {
|
1938 |
+
controlElementParent = elementOptionsContainerInvolvedGet(data.elementOptionsGroupId, elementOptionsContainerInvolved);
|
1939 |
}
|
1940 |
|
1941 |
+
if (data.elementOptionContainerOn === 'true') {
|
1942 |
+
var elementOptionContainer = document.createElement('div');
|
1943 |
+
elementOptionContainer.classList.add(data.elementOptionClass, 'wptb-settings-items');
|
1944 |
+
|
1945 |
+
if (data.customClassForContainer) {
|
1946 |
+
elementOptionContainer.classList.add(data.customClassForContainer);
|
1947 |
+
}
|
1948 |
+
|
1949 |
+
if (data.containerAdditionalStyles) {
|
1950 |
+
elementOptionContainer.setAttribute('style', data.containerAdditionalStyles);
|
1951 |
+
}
|
1952 |
+
|
1953 |
+
controlElementParent.appendChild(elementOptionContainer);
|
1954 |
|
1955 |
+
controlElementParent = elementOptionContainer;
|
1956 |
+
}
|
1957 |
+
controlElementParent.innerHTML = controlElementParent.innerHTML + controlTemplate;
|
1958 |
|
1959 |
+
var helperJavascriptElem = controlElementParent.getElementsByTagName('wptb-template-script');
|
1960 |
if (helperJavascriptElem.length > 0) {
|
1961 |
helperJavascriptElem = helperJavascriptElem[0];
|
1962 |
var helperJavascriptCode = helperJavascriptElem.innerText;
|
1963 |
+
controlElementParent.removeChild(helperJavascriptElem);
|
1964 |
var script = document.createElement('script');
|
1965 |
script.setAttribute('type', 'text/javascript');
|
1966 |
script.innerHTML = helperJavascriptCode.replace(/\r|\n|\t/g, '').trim();
|
1967 |
+
if (!controlScriptsObj[data.elementOptionsGroupId] || !Array.isArray(controlScriptsObj[data.elementOptionsGroupId])) {
|
1968 |
+
controlScriptsObj[data.elementOptionsGroupId] = [];
|
1969 |
+
}
|
1970 |
+
controlScriptsObj[data.elementOptionsGroupId].push(script);
|
1971 |
}
|
1972 |
|
1973 |
i++;
|
1974 |
});
|
1975 |
|
1976 |
+
element.optionsGroupIds = elementOptionsGroupIdsInvolved;
|
1977 |
+
|
1978 |
+
Object.keys(controlScriptsObj).forEach(function (elementOptionsGroupId) {
|
1979 |
+
var controlScriptsArr = controlScriptsObj[elementOptionsGroupId];
|
1980 |
+
elementOptionsScriptsContainer = document.createElement('div');
|
1981 |
+
elementOptionsScriptsContainer.classList.add('wptb-element-options-scripts', 'wptb-options-' + infArr[1]);
|
1982 |
+
elementOptionsGroupInvolved[elementOptionsGroupId].appendChild(elementOptionsScriptsContainer);
|
1983 |
+
if (controlScriptsArr.length > 0) {
|
1984 |
+
for (var _i6 = 0; _i6 < controlScriptsArr.length; _i6++) {
|
1985 |
+
elementOptionsScriptsContainer.appendChild(controlScriptsArr[_i6]);
|
1986 |
+
}
|
1987 |
}
|
1988 |
+
});
|
1989 |
+
|
1990 |
+
// run the scripts of controls
|
1991 |
+
|
1992 |
|
1993 |
// run appearDependOnControl function
|
1994 |
+
for (var _i7 = 0; _i7 < controlappearDependOnControl.length; _i7++) {
|
1995 |
+
WPTB_Helper.appearDependOnControl(controlappearDependOnControl[_i7][0], controlappearDependOnControl[_i7][1]);
|
1996 |
}
|
1997 |
|
1998 |
WPTB_Helper.wptbDocumentEventGenerate('element:controls:active', element);
|
1999 |
},
|
2000 |
+
|
2001 |
+
/**
|
2002 |
+
* function for create, update css for element
|
2003 |
+
*
|
2004 |
+
* @param elementContainer
|
2005 |
+
* @param selector
|
2006 |
+
* @param cssName
|
2007 |
+
* @param cssValue
|
2008 |
+
*/
|
2009 |
managerExternalCssStyles: function managerExternalCssStyles(elementContainer, selector, cssName, cssValue) {
|
2010 |
var infArr = elementContainer.match(/wptb-element-main(.+)-(\d+)/i);
|
2011 |
if (!infArr || !Array.isArray(infArr)) {
|
2106 |
var _this = this;
|
2107 |
|
2108 |
this.sections = {};
|
2109 |
+
this.currentSection = '';
|
2110 |
if (!Array.isArray(sections)) {
|
2111 |
sections = [sections];
|
2112 |
}
|
2130 |
|
2131 |
var displayType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'block';
|
2132 |
|
2133 |
+
this.currentSection = sectionDataId;
|
2134 |
this.triggerSectionEvent(sectionDataId);
|
2135 |
Object.keys(this.sections).map(function (k) {
|
2136 |
if (Object.prototype.hasOwnProperty.call(_this2.sections, k)) {
|
2140 |
});
|
2141 |
},
|
2142 |
|
2143 |
+
/**
|
2144 |
+
* Get id of current active section
|
2145 |
+
*
|
2146 |
+
* @returns {string} active section i
|
2147 |
+
*/
|
2148 |
+
getCurrentSection: function getCurrentSection() {
|
2149 |
+
return this.currentSection;
|
2150 |
+
},
|
2151 |
+
|
2152 |
+
/**
|
2153 |
+
* Get current section from search parameter 'wptb-builder-section' of window location
|
2154 |
+
*/
|
2155 |
+
getSectionFromUrl: function getSectionFromUrl() {
|
2156 |
+
var parsedUrl = new URL(window.location.href);
|
2157 |
+
var urlSection = parsedUrl.searchParams.get('wptb-builder-section');
|
2158 |
+
if (urlSection) {
|
2159 |
+
if (Object.keys(this.sections).some(function (key) {
|
2160 |
+
return key === urlSection;
|
2161 |
+
})) {
|
2162 |
+
this.activateSection(urlSection);
|
2163 |
+
}
|
2164 |
+
}
|
2165 |
+
},
|
2166 |
+
|
2167 |
/**
|
2168 |
* Set up related buttons and links to trigger certain elements
|
2169 |
*/
|
2178 |
vm.activateSection(sectionName, displayType);
|
2179 |
});
|
2180 |
|
2181 |
+
document.addEventListener('wptbSectionChanged', function (e) {
|
2182 |
if (e.detail === sectionName) {
|
2183 |
s.classList.remove('disabled');
|
2184 |
s.classList.add('active');
|
2207 |
* @param {string} sectionName section name
|
2208 |
*/
|
2209 |
triggerSectionEvent: function triggerSectionEvent(sectionName) {
|
2210 |
+
var sectionEvent = new CustomEvent('wptbSectionChanged', { detail: sectionName });
|
2211 |
|
2212 |
document.dispatchEvent(sectionEvent);
|
2213 |
},
|
2347 |
if (codeClone.classList.contains('wptb-element-main-table_setting-startedid-0')) {
|
2348 |
codeClone.classList.remove('wptb-element-main-table_setting-startedid-0');
|
2349 |
codeClone.classList.add('wptb-element-main-table_setting-' + postId);
|
2350 |
+
var wptbTableSetup = document.querySelector('.wptb-table-setup');
|
2351 |
+
if (wptbTableSetup) {
|
2352 |
+
wptbTableSetup.innerHTML = '';
|
2353 |
+
wptbTableSetup.appendChild(codeClone);
|
2354 |
+
WPTB_Table();
|
2355 |
+
}
|
2356 |
paramIdsNecessaryChange = true;
|
2357 |
}
|
2358 |
}
|
2478 |
},
|
2479 |
//
|
2480 |
clickOnFreeSpace: function clickOnFreeSpace() {
|
2481 |
+
// if current active section is responsive menu, ignore this functionality
|
2482 |
+
if (this.getCurrentSection() === 'table_responsive_menu') {
|
2483 |
+
return;
|
2484 |
+
}
|
2485 |
+
|
2486 |
var cellModeBackground = document.querySelector('#wptb-cell_mode_background');
|
2487 |
if (cellModeBackground && cellModeBackground.classList.contains('visible')) {
|
2488 |
return;
|
2556 |
}
|
2557 |
|
2558 |
if (bar.length > 0) {
|
2559 |
+
var toggleEditMode = '';
|
2560 |
for (var i = 0; i < bar.length; i++) {
|
2561 |
if (bar[i].classList.contains('visible')) {
|
2562 |
document.select.deactivateMultipleSelectMode();
|
2567 |
wptbPreviewTable.parentNode.classList.remove('wptb-preview-table-manage-cells');
|
2568 |
var wptbPreviewTableTds = wptbPreviewTable.getElementsByTagName('td');
|
2569 |
if (wptbPreviewTableTds.length > 0) {
|
2570 |
+
for (var _i8 = 0; _i8 < wptbPreviewTableTds.length; _i8++) {
|
2571 |
+
wptbPreviewTableTds[_i8].classList.remove('wptb-highlighted');
|
2572 |
}
|
2573 |
}
|
2574 |
+
toggleEditMode = 'closed';
|
2575 |
} else if (!close) {
|
2576 |
document.select.activateMultipleSelectMode();
|
2577 |
bar[i].classList.add('visible');
|
2578 |
cellModeBackground.classList.add('visible');
|
2579 |
leftScrollPanelCurtain.classList.add('visible');
|
2580 |
wptbPreviewTable.parentNode.classList.add('wptb-preview-table-manage-cells');
|
2581 |
+
|
2582 |
+
toggleEditMode = 'opened';
|
2583 |
}
|
2584 |
}
|
2585 |
+
|
2586 |
+
WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-edit-mode/' + toggleEditMode, wptbPreviewTable);
|
2587 |
}
|
2588 |
},
|
2589 |
|
2835 |
};
|
2836 |
var WPTB_Initializer = function WPTB_Initializer() {
|
2837 |
|
2838 |
+
var MIN_COLUMNS = 1,
|
2839 |
+
MIN_ROWS = 1,
|
2840 |
+
MAX_COLUMNS = 30,
|
2841 |
+
MAX_ROWS = 30;
|
2842 |
|
2843 |
+
var tableGenerator = document.body;
|
2844 |
+
columnsDecrementButton = tableGenerator.getElementsByClassName('wptb-input-number-decrement')[0], columnsIncrementButton = tableGenerator.getElementsByClassName('wptb-input-number-increment')[0], rowsDecrementButton = tableGenerator.getElementsByClassName('wptb-input-number-decrement')[1], rowsIncrementButton = tableGenerator.getElementsByClassName('wptb-input-number-increment')[1], columnsInput = document.getElementById('wptb-columns-number'), rowsInput = document.getElementById('wptb-rows-number');
|
2845 |
|
2846 |
+
columnsDecrementButton.onclick = function () {
|
2847 |
+
if (columnsInput.value > MIN_COLUMNS) {
|
2848 |
+
columnsInput.value--;
|
2849 |
+
}
|
2850 |
+
};
|
2851 |
|
2852 |
+
columnsIncrementButton.onclick = function () {
|
2853 |
+
if (columnsInput.value < MAX_COLUMNS) {
|
2854 |
+
columnsInput.value++;
|
2855 |
+
}
|
2856 |
+
};
|
2857 |
|
2858 |
+
rowsDecrementButton.onclick = function () {
|
2859 |
+
if (rowsInput.value > MIN_ROWS) {
|
2860 |
+
rowsInput.value--;
|
2861 |
+
}
|
2862 |
+
};
|
2863 |
|
2864 |
+
rowsIncrementButton.onclick = function () {
|
2865 |
+
if (rowsInput.value < MAX_ROWS) {
|
2866 |
+
rowsInput.value++;
|
2867 |
+
}
|
2868 |
+
};
|
2869 |
|
2870 |
+
document.getElementById('wptb-generate-table').onclick = function () {
|
2871 |
+
var columns = document.getElementById('wptb-columns-number').value,
|
2872 |
+
rows = document.getElementById('wptb-rows-number').value;
|
2873 |
|
2874 |
+
//wptbTableStateSaveManager.tableStateClear();
|
2875 |
|
2876 |
+
WPTB_Table(columns, rows);
|
2877 |
|
2878 |
+
var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
|
2879 |
+
wptbTableStateSaveManager.tableStateSet();
|
2880 |
+
};
|
2881 |
|
2882 |
+
// register and setup section buttons
|
2883 |
+
WPTB_Helper.registerSections(['elements', 'table_settings', 'cell_settings', 'options_group', 'table_responsive_menu']);
|
2884 |
+
WPTB_Helper.setupSectionButtons();
|
|
|
|
|
|
|
|
|
2885 |
|
2886 |
+
// activate elements section for startup
|
2887 |
+
WPTB_Helper.activateSection('elements');
|
2888 |
|
2889 |
+
// side bar toggle setup
|
2890 |
+
// WPTB_Helper.setupSidebarToggle('.wptb-panel-drawer-toggle');
|
2891 |
+
WPTB_Helper.setupSidebarToggle('.wptb-panel-toggle-section .wptb-panel-drawer-icon');
|
|
|
|
|
|
|
2892 |
|
2893 |
+
// setup panel sections that have the ability to be toggled on/off
|
2894 |
+
WPTB_Helper.setupPanelToggleButtons();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2895 |
|
2896 |
+
// setup responsive menu both at left and builder panel
|
2897 |
+
new WptbResponsive('table_responsive_menu', 'wptbResponsiveApp', '.wptb-builder-content');
|
2898 |
+
|
2899 |
+
// get builder section from url parameter for easy switch at page load
|
2900 |
+
WPTB_Helper.getSectionFromUrl();
|
2901 |
+
};
|
2902 |
+
var WPTB_innerElementSet = function WPTB_innerElementSet(element) {
|
2903 |
+
|
2904 |
+
element.ondragenter = function (e) {
|
2905 |
+
var div;
|
2906 |
+
if (e.dataTransfer.types.indexOf('wptbelement') == -1 && e.dataTransfer.types.indexOf('wptb-moving-mode') == -1) {
|
2907 |
+
return;
|
2908 |
+
}
|
2909 |
+
WPTB_DropHandle(this, e);
|
2910 |
+
|
2911 |
+
element.classList.add('wptb-ondragenter');
|
2912 |
+
};
|
2913 |
+
element.ondragover = function (e) {
|
2914 |
+
e.preventDefault();
|
2915 |
+
WPTB_DropHandle(this, e);
|
2916 |
+
};
|
2917 |
+
element.ondragleave = function () {};
|
2918 |
+
element.ondrop = function (e) {
|
2919 |
+
this.classList.remove('wptb-ondragenter');
|
2920 |
+
var element = void 0,
|
2921 |
+
classId = void 0;
|
2922 |
+
e.preventDefault();
|
2923 |
+
e.stopPropagation();
|
2924 |
+
|
2925 |
+
if (!e.dataTransfer.getData('wptbElement') && !e.dataTransfer.getData('node')) {
|
2926 |
+
return;
|
2927 |
+
}
|
2928 |
+
var wptbDropHandle = void 0,
|
2929 |
+
wptbDropBorderMarker = void 0;
|
2930 |
+
if (document.getElementsByClassName('wptb-drop-handle').length > 0) {
|
2931 |
+
wptbDropHandle = document.getElementsByClassName('wptb-drop-handle')[0];
|
2932 |
+
}
|
2933 |
+
if (document.getElementsByClassName('wptb-drop-border-marker').length > 0) {
|
2934 |
+
wptbDropBorderMarker = document.getElementsByClassName('wptb-drop-border-marker')[0];
|
2935 |
+
}
|
2936 |
+
|
2937 |
+
if (e.dataTransfer.getData('wptbElement')) {
|
2938 |
+
element = WPTB_Helper.newElementProxy(e.dataTransfer.getData('wptbElement'));
|
2939 |
+
element = element.getDOMElement();
|
2940 |
+
} else {
|
2941 |
+
classId = e.dataTransfer.getData('node');
|
2942 |
+
element = document.getElementsByClassName(classId)[0];
|
2943 |
+
//element.classList.remove( 'wptb-moving-mode' );
|
2944 |
+
}
|
2945 |
+
|
2946 |
+
if (wptbDropHandle.style.display == 'block') {
|
2947 |
+
var td = void 0;
|
2948 |
+
if (wptbDropHandle.dataset.text == 'Drop Here') {
|
2949 |
+
td = wptbDropHandle.getDOMParentElement();
|
2950 |
+
td.appendChild(element);
|
2951 |
+
} else {
|
2952 |
+
var innerElement = wptbDropHandle.getDOMParentElement();
|
2953 |
+
td = innerElement.parentNode;
|
2954 |
+
|
2955 |
+
if (wptbDropHandle.dataset.text == 'Above Element') {
|
2956 |
+
td.insertBefore(element, innerElement);
|
2957 |
+
} else if (wptbDropHandle.dataset.text == 'Below Element') {
|
2958 |
+
var innerElementNext = innerElement.nextSibling;
|
2959 |
+
td.insertBefore(element, innerElementNext);
|
2960 |
+
}
|
2961 |
+
}
|
2962 |
+
|
2963 |
+
var thisRow = td.parentNode;
|
2964 |
+
if (WPTB_Helper.rowIsTop(thisRow)) {
|
2965 |
+
var table = WPTB_Helper.findAncestor(thisRow, 'wptb-preview-table');
|
2966 |
+
|
2967 |
+
if (table.classList.contains('wptb-table-preview-head')) {
|
2968 |
+
WPTB_Helper.dataTitleColumnSet(table);
|
2969 |
+
}
|
2970 |
+
}
|
2971 |
+
|
2972 |
+
// start item javascript if item is new
|
2973 |
+
var infArr = element.className.match(/wptb-element-(.+)-(\d+)/i);
|
2974 |
+
var elemKind = infArr[1];
|
2975 |
+
if (e.dataTransfer.getData('wptbElement') && (elemKind == 'text' || elemKind == 'button' || elemKind == 'image' || elemKind == 'star_rating' || elemKind == 'list')) {
|
2976 |
+
//WPTB_Helper.elementStartScript( element );
|
2977 |
+
}
|
2978 |
+
} else {
|
2979 |
+
return;
|
2980 |
+
}
|
2981 |
+
|
2982 |
+
wptbDropHandle.style.display = 'none';
|
2983 |
+
wptbDropBorderMarker.style.display = 'none';
|
2984 |
+
|
2985 |
+
WPTB_innerElementSet(element);
|
2986 |
+
|
2987 |
+
if (!element.classList.contains('wptb-image-container') || element.classList.contains('wptb-moving-mode')) {
|
2988 |
+
element.classList.remove('wptb-moving-mode');
|
2989 |
+
var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
|
2990 |
+
wptbTableStateSaveManager.tableStateSet();
|
2991 |
+
}
|
2992 |
+
return true;
|
2993 |
+
};
|
2994 |
+
element.onmouseover = function (e) {
|
2995 |
+
element.classList.remove('wptb-ondragenter');
|
2996 |
+
};
|
2997 |
+
};
|
2998 |
+
var WPTB_LeftPanel = function WPTB_LeftPanel() {
|
2999 |
+
|
3000 |
+
var table = document.getElementsByClassName('wptb-preview-table')[0],
|
3001 |
+
wptbElementButtons = document.getElementsByClassName('wptb-element');
|
3002 |
+
|
3003 |
+
for (var i = 0; i < wptbElementButtons.length; i++) {
|
3004 |
+
wptbElementButtons[i].ondragstart = function (e) {
|
3005 |
+
e.dataTransfer.setData('wptbElement', this.dataset.wptbElement);
|
3006 |
+
e.dataTransfer.setData('wptbElIndic-' + this.dataset.wptbElement, 'wptbElIndic-' + this.dataset.wptbElement);
|
3007 |
+
};
|
3008 |
+
};
|
3009 |
+
|
3010 |
+
if (table) {
|
3011 |
+
var wptbTablesEditModeCloseButton = document.getElementsByClassName('wptb-table-edit-mode-close');
|
3012 |
+
for (var _i = 0; _i < wptbTablesEditModeCloseButton.length; _i++) {
|
3013 |
+
wptbTablesEditModeCloseButton[_i].onclick = WPTB_Helper.toggleTableEditMode;
|
3014 |
+
}
|
3015 |
+
document.getElementById('wptb-add-end-row').onclick = table.addRowToTheEnd;
|
3016 |
+
document.getElementById('wptb-add-start-row').onclick = table.addRowToTheStart;
|
3017 |
+
document.getElementById('wptb-add-row-before').onclick = table.addRowBefore;
|
3018 |
+
document.getElementById('wptb-add-row-after').onclick = table.addRowAfter;
|
3019 |
+
document.getElementById('wptb-add-end-column').onclick = table.addColumnEnd;
|
3020 |
+
document.getElementById('wptb-add-start-column').onclick = table.addColumnStart;
|
3021 |
+
document.getElementById('wptb-add-column-before').onclick = table.addColumnBefore;
|
3022 |
+
document.getElementById('wptb-add-column-after').onclick = table.addColumnAfter;
|
3023 |
+
document.getElementById('wptb-delete-column').onclick = table.deleteColumn;
|
3024 |
+
document.getElementById('wptb-delete-row').onclick = table.deleteRow;
|
3025 |
+
document.getElementById('wptb-merge-cells').onclick = table.mergeCells;
|
3026 |
+
document.getElementById('wptb-split-cell').onclick = table.splitCell;
|
3027 |
+
};
|
3028 |
+
|
3029 |
+
// this code hides the "element parameters" area
|
3030 |
+
// when clicked outside this element and its "tinymce" toolbar
|
3031 |
+
var wptbBuilderPanel = document.getElementsByClassName('wptb-builder-panel')[0];
|
3032 |
+
wptbBuilderPanel.onclick = function (e) {
|
3033 |
+
if (!e.target.classList.contains('wptb-ph-element') && !WPTB_Helper.findAncestor(e.target, 'wptb-ph-element') && !e.target.classList.contains('wptb-fixed-toolbar') && !WPTB_Helper.findAncestor(e.target, 'wptb-fixed-toolbar')) {
|
3034 |
+
WPTB_Helper.clickOnFreeSpace();
|
3035 |
+
}
|
3036 |
+
};
|
3037 |
|
3038 |
var wptbHeader = document.getElementsByClassName('wptb-header');
|
3039 |
if (wptbHeader.length > 0) wptbHeader = wptbHeader[0];
|
3176 |
};
|
3177 |
}();
|
3178 |
}
|
3179 |
+
/**
|
3180 |
+
* Responsive menu and options class.
|
3181 |
+
*
|
3182 |
+
* This class will be called and instanced at table builder menu to add it the responsive menu and its controls.
|
3183 |
+
*
|
3184 |
+
* @param {string} sectionName section name
|
3185 |
+
* @param {string} responsiveWrapperId id for mount point
|
3186 |
+
* @param {string} mainContainerQuery query to find parent container for responsive menu
|
3187 |
+
* @throws {Error} will throw an error if mainContainerQuery failed to find any element
|
3188 |
+
* @constructor
|
3189 |
+
*/
|
3190 |
+
// eslint-disable-next-line no-unused-vars
|
3191 |
+
function WptbResponsive(sectionName, responsiveWrapperId, mainContainerQuery) {
|
3192 |
+
var _this = this;
|
3193 |
+
|
3194 |
+
this.sectionName = sectionName;
|
3195 |
+
this.responsiveWrapperId = responsiveWrapperId;
|
3196 |
+
this.responsiveTable = null;
|
3197 |
+
this.loaded = false;
|
3198 |
+
|
3199 |
+
/**
|
3200 |
+
* Add responsive container to dom.
|
3201 |
+
*/
|
3202 |
+
this.addContainerToDom = function () {
|
3203 |
+
var responsiveContainer = document.querySelector('#' + _this.responsiveWrapperId);
|
3204 |
+
if (!responsiveContainer) {
|
3205 |
+
var mainContainer = document.querySelector(mainContainerQuery);
|
3206 |
+
|
3207 |
+
// parent container not found, throw error
|
3208 |
+
if (!mainContainer) {
|
3209 |
+
throw new Error('[WPTB_Responsive]: no parent container is found with the given query of [' + mainContainerQuery + ']');
|
3210 |
+
}
|
3211 |
+
|
3212 |
+
var range = document.createRange();
|
3213 |
+
range.setStart(mainContainer, 0);
|
3214 |
+
|
3215 |
+
var responsiveElement = range.createContextualFragment('<div class="wptb-responsive" id="' + _this.responsiveWrapperId + '">responsive element</div>');
|
3216 |
+
mainContainer.appendChild(responsiveElement);
|
3217 |
+
_this.loaded = true;
|
3218 |
+
}
|
3219 |
+
|
3220 |
+
_this.responsiveTable = document.querySelector('#' + _this.responsiveWrapperId);
|
3221 |
+
};
|
3222 |
+
|
3223 |
+
/**
|
3224 |
+
* Load and make necessary mount preparations for component.
|
3225 |
+
*/
|
3226 |
+
this.load = function () {
|
3227 |
+
if (!_this.loaded) {
|
3228 |
+
_this.addContainerToDom();
|
3229 |
+
|
3230 |
+
WPTB_Helper.elementStartScript(_this.responsiveTable, 'table_responsive_menu');
|
3231 |
+
WPTB_Helper.elementOptionsSet('table_responsive_menu', _this.responsiveTable);
|
3232 |
+
WPTB_ControlsManager.callControlScript('ResponsiveTable', _this.responsiveWrapperId);
|
3233 |
+
}
|
3234 |
+
};
|
3235 |
+
|
3236 |
+
/**
|
3237 |
+
* Startup hook for the component.
|
3238 |
+
*/
|
3239 |
+
this.startUp = function () {
|
3240 |
+
// event listener for section change events
|
3241 |
+
document.addEventListener('wptbSectionChanged', function (e) {
|
3242 |
+
var tablePreview = document.querySelector('.wptb-preview-table');
|
3243 |
+
|
3244 |
+
// check if activated section is related to responsive and there is a main table already in the view
|
3245 |
+
if (e.detail === _this.sectionName && tablePreview) {
|
3246 |
+
_this.load();
|
3247 |
+
}
|
3248 |
+
});
|
3249 |
+
|
3250 |
+
// event listener for table ready signal
|
3251 |
+
document.addEventListener('wptb:table:generated', function () {
|
3252 |
+
// check current section to be sure that responsive menu is the active one before calling load related scripts
|
3253 |
+
if (WPTB_Helper.getCurrentSection() === 'table_responsive_menu') {
|
3254 |
+
_this.load();
|
3255 |
+
}
|
3256 |
+
});
|
3257 |
+
};
|
3258 |
+
|
3259 |
+
this.startUp();
|
3260 |
+
}
|
3261 |
var WPTB_Settings = function WPTB_Settings() {
|
3262 |
var elems = document.getElementsByClassName('wptb-element');
|
3263 |
|
3378 |
if (tds.length > 0) {
|
3379 |
for (var i = 0; i < tds.length; i++) {
|
3380 |
|
3381 |
+
tds[i].removeAttribute('data-x-index');
|
|
|
|
|
3382 |
tds[i].removeAttribute('data-y-index');
|
3383 |
tds[i].removeAttribute('draggable');
|
3384 |
tds[i].classList.remove('wptb-droppable');
|
3385 |
+
var infArr = tds[i].className.match(/wptb-element-((.+-)\d+)/i);
|
3386 |
+
if (infArr) tds[i].classList.remove(infArr[0]);
|
3387 |
var innerElements = tds[i].getElementsByClassName('wptb-ph-element');
|
3388 |
|
3389 |
if (innerElements.length > 0) {
|
3447 |
}
|
3448 |
}
|
3449 |
|
3450 |
+
// TODO dataTitleColumnSet
|
3451 |
+
// if( tds[i].hasAttribute( 'data-wptb-title-column' ) ) {
|
3452 |
+
// let columnNameDivContainer = document.createElement( 'div' ),
|
3453 |
+
// columnNameDiv = document.createElement( 'div' );
|
3454 |
+
// columnNameDivContainer.classList.add( 'wptb-column-title-mobile-container' );
|
3455 |
+
// columnNameDiv.classList.add( 'wptb-column-title-mobile' );
|
3456 |
+
// columnNameDiv.dataset.wptbTitleColumn = tds[i].dataset.wptbTitleColumn;
|
3457 |
+
// columnNameDiv.setAttribute( 'style', 'font-size:' + tds[i].dataset.wptbTitleColumnFontSize + '; \n\
|
3458 |
+
// color:' + tds[i].dataset.wptbTitleColumnColor + '; background-color:' + tds[i].dataset.wptbTitleBackgroundColor + '; text-align:' + tds[i].dataset.wptbTitleAlign + ';' );
|
3459 |
+
// columnNameDiv.style.padding = tds[i].style.padding;
|
3460 |
+
// if( tds[i].children.length == 0 ) {
|
3461 |
+
// tds[i].classList.add( 'wptb-column-title-mobile-not-elements' );
|
3462 |
+
// }
|
3463 |
+
// columnNameDivContainer.appendChild( columnNameDiv );
|
3464 |
+
// tds[i].insertBefore( columnNameDivContainer, tds[i].firstChild );
|
3465 |
+
// }
|
3466 |
}
|
3467 |
}
|
3468 |
|
3495 |
* @param Event this is the event instance of the click performed over a cell.
|
3496 |
*/
|
3497 |
var mark = function mark(event) {
|
3498 |
+
var thisElem = event.currentTarget;
|
3499 |
+
var rs = thisElem.rowSpan,
|
3500 |
+
cs = thisElem.colSpan,
|
3501 |
noCells = document.getElementsByClassName('wptb-no-cell-action'),
|
3502 |
singleCells = document.getElementsByClassName('wptb-single-action'),
|
3503 |
multipleCells = document.getElementsByClassName('wptb-multiple-select-action'),
|
3504 |
cellSettings = document.getElementById('wptb-left-scroll-panel-cell-settings'),
|
3505 |
+
position = getCoords(thisElem),
|
3506 |
row = position[0],
|
3507 |
column = position[1];
|
3508 |
if (!document.select.isActivated()) {
|
3509 |
return;
|
3510 |
}
|
3511 |
+
if (thisElem.className.match(/wptb-highlighted/)) {
|
3512 |
+
thisElem.classList.remove('wptb-highlighted');
|
3513 |
for (var i = 0; i < rs; i++) {
|
3514 |
for (var j = 0; j < cs; j++) {
|
3515 |
array[row + i][column + j] = 0;
|
3516 |
}
|
3517 |
}
|
3518 |
} else {
|
3519 |
+
thisElem.classList.add('wptb-highlighted');
|
3520 |
for (var i = 0; i < rs; i++) {
|
3521 |
for (var j = 0; j < cs; j++) {
|
3522 |
array[row + i][column + j] = 1;
|
3621 |
}
|
3622 |
cellSettings.classList.remove('visible');
|
3623 |
}
|
3624 |
+
|
3625 |
+
var details = { countMarkedCells: markedCells };
|
3626 |
+
WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/cell/mark', thisElem, details);
|
3627 |
};
|
3628 |
|
3629 |
/*
|
3757 |
tds[0].classList.remove('wptb-highlighted');
|
3758 |
}
|
3759 |
cellSettings.classList.remove('visible');
|
3760 |
+
for (var _i = 0; _i < array.length; _i++) {
|
3761 |
+
for (var _j = 0; _j < array[_i].length; _j++) {
|
3762 |
+
array[_i][_j] = 0;
|
3763 |
}
|
3764 |
}
|
3765 |
+
for (var _i2 = 0; _i2 < multipleCells.length; _i2++) {
|
3766 |
+
multipleCells[_i2].classList.remove('visible');
|
3767 |
+
multipleCells[_i2].setAttribute('disabled', 'disabled');
|
3768 |
}
|
3769 |
+
for (var _i3 = 0; _i3 < noCells.length; _i3++) {
|
3770 |
+
noCells[_i3].classList.add('visible');
|
3771 |
+
noCells[_i3].removeAttribute('disabled');
|
3772 |
}
|
3773 |
+
for (var _i4 = 0; _i4 < singleCells.length; _i4++) {
|
3774 |
+
singleCells[_i4].classList.remove('visible');
|
3775 |
+
singleCells[_i4].setAttribute('disabled', 'disabled');
|
3776 |
}
|
3777 |
+
|
3778 |
+
WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/undo-select/active', table);
|
3779 |
};
|
3780 |
|
3781 |
/*
|
3905 |
var cells = table.getElementsByTagName('td');
|
3906 |
|
3907 |
if (cells.length > 0) {
|
3908 |
+
for (var _i5 = 0; _i5 < cells.length; _i5++) {
|
3909 |
+
WPTB_Cell(mark, cells[_i5]);
|
3910 |
}
|
3911 |
}
|
3912 |
} else {
|
3914 |
}
|
3915 |
}
|
3916 |
|
3917 |
+
/**
|
3918 |
+
* this method run "mark" method of WPTB_Table object
|
3919 |
+
* @param event
|
3920 |
+
*/
|
3921 |
+
table.mark = function (event) {
|
3922 |
+
mark(event);
|
3923 |
+
};
|
3924 |
+
|
3925 |
+
/**
|
3926 |
+
* this method run "undoSelect" method of WPTB_Table object
|
3927 |
+
* @param event
|
3928 |
+
*/
|
3929 |
+
table.undoSelect = function () {
|
3930 |
+
undoSelect();
|
3931 |
+
};
|
3932 |
+
|
3933 |
+
/**
|
3934 |
+
* method for set value for maxAmountOfCells
|
3935 |
+
* @param value
|
3936 |
+
*/
|
3937 |
+
table.setMaxAmountOfCells = function (value) {
|
3938 |
+
maxAmountOfCells = value;
|
3939 |
+
};
|
3940 |
+
|
3941 |
+
/**
|
3942 |
+
* this method return maxAmountOfCells value
|
3943 |
+
* @returns {*}
|
3944 |
+
*/
|
3945 |
+
table.getMaxAmountOfCells = function () {
|
3946 |
+
return maxAmountOfCells;
|
3947 |
+
};
|
3948 |
+
|
3949 |
+
/**
|
3950 |
+
* this method run "fillTableArray" method of WPTB_Table object
|
3951 |
+
* @returns {[]}
|
3952 |
+
*/
|
3953 |
+
table.fillTableArray = function () {
|
3954 |
+
return fillTableArray();
|
3955 |
+
};
|
3956 |
/*
|
3957 |
* For assigning to each cell xIndex and y Index attributes,
|
3958 |
* these are the column number and row number of cell in table.
|
3973 |
var tableRows = table.rows;
|
3974 |
var widthIsSet = false;
|
3975 |
var arrayTdsFromPreviousRow = [];
|
3976 |
+
for (var _i6 = 0; _i6 < tableRows.length; _i6++) {
|
3977 |
+
var _row = tableRows[_i6];
|
3978 |
var tds = _row.children;
|
3979 |
+
for (var _j2 = 0; _j2 < tds.length; _j2++) {
|
3980 |
+
var td = tds[_j2];
|
3981 |
if (td.dataset.xIndex == dataXIndex) {
|
3982 |
if (value) {
|
3983 |
if (td.colSpan == colspan) {
|
3987 |
} else {
|
3988 |
td.style.width = null;
|
3989 |
td.dataset.wptbFixedWidth = value;
|
3990 |
+
if (_i6 == tableRows.length - 1 && !widthIsSet) {
|
3991 |
tableTdsFor(dataXIndex, colspan + 1);
|
3992 |
}
|
3993 |
}
|
4021 |
}
|
4022 |
|
4023 |
table.tdDefaultWidth();
|
4024 |
+
|
4025 |
+
WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);
|
4026 |
}
|
4027 |
};
|
4028 |
|
4047 |
var borderRightWidth = tableFullStyleObj.getPropertyValue('border-right-width');
|
4048 |
var tableBorderCommon = parseFloat(borderLeftWidth, 10) + parseFloat(borderRightWidth, 10);
|
4049 |
|
4050 |
+
for (var _i7 = 0; _i7 < rows.length; _i7++) {
|
4051 |
+
var tds = rows[_i7].children;
|
4052 |
+
for (var _j3 = 0; _j3 < tds.length; _j3++) {
|
4053 |
+
var td = tds[_j3];
|
4054 |
|
4055 |
if (!arrayCellsWidthFixedHelper[parseFloat(td.dataset.xIndex)] && !arrayCellsWidthAutoHelper[parseFloat(td.dataset.xIndex)]) {
|
4056 |
if (td.style.width) {
|
4078 |
arrayCellsWidthFixedHelper[parseFloat(td.dataset.xIndex)] += tdPaddingCommon;
|
4079 |
arrayCellsWidthFixedHelper[parseFloat(td.dataset.xIndex)] += tableTdBorderCommonWidth;
|
4080 |
|
4081 |
+
if (_j3 == 0 && tableBorderCommon / 2 <= parseFloat(tableTdBorderLeftWidth, 10)) {
|
4082 |
arrayCellsWidthFixedHelper[parseFloat(td.dataset.xIndex)] += parseFloat(tableTdBorderLeftWidth, 10) / 2;
|
4083 |
+
} else if (_j3 == 0 && tableBorderCommon / 2 > parseFloat(tableTdBorderLeftWidth, 10)) {
|
4084 |
arrayCellsWidthFixedHelper[parseFloat(td.dataset.xIndex)] += tableBorderCommon / 2 - parseFloat(tableTdBorderRightWidth, 10) / 2;
|
4085 |
}
|
4086 |
|
4087 |
+
if (_j3 == tds.length - 1 && tableBorderCommon / 2 <= parseFloat(tableTdBorderRightWidth, 10)) {
|
4088 |
arrayCellsWidthFixedHelper[parseFloat(td.dataset.xIndex)] += parseFloat(tableTdBorderRightWidth, 10) / 2;
|
4089 |
+
} else if (_j3 == tds.length - 1 && tableBorderCommon / 2 > parseFloat(tableTdBorderRightWidth, 10)) {
|
4090 |
arrayCellsWidthFixedHelper[parseFloat(td.dataset.xIndex)] += tableBorderCommon / 2 - parseFloat(tableTdBorderRightWidth, 10) / 2;
|
4091 |
}
|
4092 |
} else if (arrayCellsWidthAutoHelper[parseFloat(td.dataset.xIndex)]) {
|
4093 |
arrayCellsWidthAutoHelper[parseFloat(td.dataset.xIndex)] += tdPaddingCommon;
|
4094 |
arrayCellsWidthAutoHelper[parseFloat(td.dataset.xIndex)] += tableTdBorderCommonWidth;
|
4095 |
|
4096 |
+
if (_j3 == 0 && tableBorderCommon / 2 <= parseFloat(tableTdBorderLeftWidth, 10)) {
|
4097 |
arrayCellsWidthAutoHelper[parseFloat(td.dataset.xIndex)] += parseFloat(tableTdBorderLeftWidth, 10) / 2;
|
4098 |
+
} else if (_j3 == 0 && tableBorderCommon / 2 > parseFloat(tableTdBorderLeftWidth, 10)) {
|
4099 |
arrayCellsWidthAutoHelper[parseFloat(td.dataset.xIndex)] += tableBorderCommon / 2 - parseFloat(tableTdBorderLeftWidth, 10) / 2;
|
4100 |
}
|
4101 |
|
4102 |
+
if (_j3 == tds.length - 1 && tableBorderCommon / 2 <= parseFloat(tableTdBorderRightWidth, 10)) {
|
4103 |
arrayCellsWidthAutoHelper[parseFloat(td.dataset.xIndex)] += parseFloat(tableTdBorderRightWidth, 10) / 2;
|
4104 |
+
} else if (_j3 == tds.length - 1 && tableBorderCommon / 2 > parseFloat(tableTdBorderRightWidth, 10)) {
|
4105 |
arrayCellsWidthAutoHelper[parseFloat(td.dataset.xIndex)] += tableBorderCommon / 2 - parseFloat(tableTdBorderLeftWidth, 10) / 2;
|
4106 |
}
|
4107 |
}
|
4116 |
}
|
4117 |
}
|
4118 |
|
4119 |
+
for (var _i8 = 0; _i8 < arrayCellsWidthFixedHelper.length; _i8++) {
|
4120 |
+
if (arrayCellsWidthFixedHelper[_i8]) {
|
4121 |
+
tableTdsSumMaxWidthFixed += arrayCellsWidthFixedHelper[_i8];
|
4122 |
}
|
4123 |
}
|
4124 |
|
4125 |
var CellsWidthAutoCount = 0;
|
4126 |
+
for (var _i9 = 0; _i9 < arrayCellsWidthAutoHelper.length; _i9++) {
|
4127 |
+
if (arrayCellsWidthAutoHelper[_i9]) {
|
4128 |
+
tableTdsSumMaxWidthAuto += arrayCellsWidthAutoHelper[_i9];
|
4129 |
CellsWidthAutoCount++;
|
4130 |
}
|
4131 |
}
|
4228 |
var tableRows = table.rows;
|
4229 |
var heightIsSet = false;
|
4230 |
var arrayTdsPrevious = [];
|
4231 |
+
for (var _i10 = 0; _i10 < tableRows.length; _i10++) {
|
4232 |
+
var _row2 = tableRows[_i10];
|
4233 |
var tds = _row2.children;
|
4234 |
+
for (var _j4 = 0; _j4 < tds.length; _j4++) {
|
4235 |
+
var td = tds[_j4];
|
4236 |
if (td.dataset.yIndex == dataYIndex) {
|
4237 |
if (value) {
|
4238 |
if (td.rowSpan == rowspan) {
|
4243 |
} else {
|
4244 |
td.style.height = null;
|
4245 |
td.dataset.wptbFixedHeight = value;
|
4246 |
+
if (_j4 == tds.length - 1 && !heightIsSet) {
|
4247 |
tableTdsFor(dataYIndex, rowspan + 1);
|
4248 |
}
|
4249 |
}
|
4274 |
})();
|
4275 |
}
|
4276 |
}
|
4277 |
+
|
4278 |
+
WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);
|
4279 |
}
|
4280 |
};
|
4281 |
|
4285 |
table.mergingCellsVertically = false;
|
4286 |
table.dataset.reconstraction = 1;
|
4287 |
var forBreak = 0;
|
4288 |
+
for (var _i11 = 0; _i11 < tds.length; _i11++) {
|
4289 |
+
if (tds[_i11].colSpan > 1) {
|
4290 |
table.dataset.reconstraction = 0;
|
4291 |
table.mergingСellsHorizontally = true;
|
4292 |
forBreak++;
|
4293 |
}
|
4294 |
|
4295 |
+
if (tds[_i11].rowSpan > 1) {
|
4296 |
table.dataset.reconstraction = 0;
|
4297 |
table.mergingCellsVertically = true;
|
4298 |
forBreak++;
|
4402 |
|
4403 |
table.addColumnAfter = function (c_pos) {
|
4404 |
var rows = table.rows,
|
4405 |
+
cell = void 0,
|
4406 |
+
cellStyle = void 0,
|
4407 |
+
pos = void 0;
|
|
|
|
|
4408 |
|
4409 |
+
if (c_pos != undefined && typeof c_pos === 'number') {
|
4410 |
+
pos = c_pos;
|
4411 |
+
cell = document.querySelector('[data-x-index="' + pos + '"]');
|
4412 |
} else {
|
4413 |
+
cell = document.querySelector('.wptb-highlighted');
|
4414 |
+
pos = getCoords(cell)[1];
|
4415 |
+
}
|
|
|
|
|
|
|
4416 |
|
4417 |
+
if (cell) {
|
4418 |
+
cellStyle = cell.getAttribute('style');
|
4419 |
+
|
4420 |
+
if (maxAmountOfCells - pos - cell.colSpan + 1 == 1) {
|
4421 |
+
table.addColumnEnd();
|
4422 |
+
} else {
|
4423 |
+
var newTd = function newTd(cellStyle) {
|
4424 |
+
var td = new WPTB_Cell(mark);
|
4425 |
+
if (cellStyle) {
|
4426 |
+
td.getDOMElement().setAttribute('style', cellStyle);
|
4427 |
+
td.getDOMElement().style.width = null;
|
4428 |
+
td.getDOMElement().style.height = null;
|
4429 |
+
}
|
4430 |
+
return td;
|
4431 |
+
};
|
4432 |
+
|
4433 |
+
for (var _i12 = 0; _i12 < rows.length; _i12++) {
|
4434 |
+
var tds = rows[_i12].children;
|
4435 |
+
for (var _j5 = 0; _j5 < tds.length; _j5++) {
|
4436 |
+
if (parseInt(tds[_j5].dataset.xIndex) <= pos) {
|
4437 |
+
if (parseInt(tds[_j5].dataset.xIndex) + tds[_j5].colSpan == pos + cell.colSpan) {
|
4438 |
+
var td = newTd(cellStyle);
|
4439 |
+
var nextSib = tds[_j5].nextSibling;
|
4440 |
+
if (nextSib) {
|
4441 |
+
rows[_i12].insertBefore(td.getDOMElement(), nextSib);
|
4442 |
+
} else {
|
4443 |
+
rows[_i12].appendChild(td.getDOMElement());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4444 |
}
|
4445 |
+
|
4446 |
+
break;
|
4447 |
+
} else if (parseInt(tds[_j5].dataset.xIndex) + tds[_j5].colSpan > pos + cell.colSpan) {
|
4448 |
+
tds[_j5].colSpan++;
|
4449 |
+
if (tds[_j5].rowSpan > 1) _i12 += tds[_j5].rowSpan - 1;
|
4450 |
+
break;
|
4451 |
}
|
4452 |
+
} else if (parseInt(tds[_j5].dataset.xIndex) > pos) {
|
4453 |
+
var _td = newTd(cellStyle);
|
4454 |
+
rows[_i12].insertBefore(_td.getDOMElement(), tds[_j5]);
|
4455 |
+
break;
|
4456 |
}
|
4457 |
}
|
4458 |
}
|
4459 |
|
4460 |
+
for (var i = 0; i < array.length; i++) {
|
4461 |
+
array[i].push(0);
|
4462 |
}
|
4463 |
+
maxAmountOfCells++;
|
4464 |
+
drawTable(array);
|
4465 |
+
table.recalculateIndexes();
|
4466 |
+
table.addColumnWidth();
|
4467 |
+
table.addRowHeight();
|
4468 |
+
WPTB_Helper.dataTitleColumnSet(table);
|
4469 |
+
undoSelect();
|
|
|
|
|
|
|
|
|
|
|
4470 |
|
4471 |
+
WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);
|
4472 |
|
4473 |
+
var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
|
4474 |
+
wptbTableStateSaveManager.tableStateSet();
|
4475 |
+
}
|
4476 |
}
|
4477 |
};
|
4478 |
|
4591 |
cellStyle = cell.getAttribute('style'),
|
4592 |
row = getCoords(cell)[0],
|
4593 |
cellNew = void 0;
|
4594 |
+
for (var _i13 = row - 1; _i13 >= 0; _i13--) {
|
4595 |
+
var rowChildren = table.rows[_i13].children;
|
4596 |
var rowChildrenLength = rowChildren.length;
|
4597 |
if (rowChildrenLength > 0) {
|
4598 |
+
for (var _j6 = 0; _j6 < rowChildrenLength; _j6++) {
|
4599 |
+
if (rowChildren[_j6].rowSpan == 1) {
|
4600 |
+
row = _i13;
|
4601 |
cellNew = true;
|
4602 |
break;
|
4603 |
}
|
4639 |
|
4640 |
var cellsColSpan = 0;
|
4641 |
if (rowAfter < table.rows.length - 1) {
|
4642 |
+
for (var _i14 = 0; _i14 <= rowAfter; _i14++) {
|
4643 |
+
var tableRowsIChildren = table.rows[_i14].children,
|
4644 |
tableRIChildrenLength = tableRowsIChildren.length;
|
4645 |
if (tableRIChildrenLength > 0) {
|
4646 |
+
for (var _j7 = 0; _j7 < tableRIChildrenLength; _j7++) {
|
4647 |
+
var rowIRowSpan = tableRowsIChildren[_j7].rowSpan;
|
4648 |
|
4649 |
+
if (rowIRowSpan - 1 + _i14 > rowAfter) {
|
4650 |
+
tableRowsIChildren[_j7].rowSpan++;
|
4651 |
}
|
4652 |
}
|
4653 |
}
|
4658 |
rNextChildrenLength = rNextChildren.length;
|
4659 |
|
4660 |
if (rNextChildrenLength > 0) {
|
4661 |
+
for (var _i15 = 0; _i15 < rNextChildrenLength; _i15++) {
|
4662 |
+
cellsColSpan += rNextChildren[_i15].colSpan;
|
4663 |
}
|
4664 |
}
|
4665 |
} else {
|
4776 |
tds = [].slice.call(document.getElementsByClassName('wptb-highlighted'), 1),
|
4777 |
tdsChildrenNew = [];
|
4778 |
|
4779 |
+
for (var _i16 = 0; _i16 < tds.length; _i16++) {
|
4780 |
+
var tdsInternalElements = tds[_i16].getElementsByClassName('wptb-ph-element');
|
4781 |
if (tdsInternalElements.length > 0) {
|
4782 |
var tdsIntElemLength = tdsInternalElements.length;
|
4783 |
+
for (var _j8 = 0; _j8 < tdsIntElemLength; _j8++) {
|
4784 |
+
tdsChildrenNew.push(tdsInternalElements[_j8]);
|
4785 |
}
|
4786 |
}
|
4787 |
+
var p = tds[_i16].parentNode;
|
4788 |
+
p.removeChild(tds[_i16]);
|
4789 |
}
|
4790 |
if (tdsChildrenNew.length > 0) {
|
4791 |
+
for (var _i17 = 0; _i17 < tdsChildrenNew.length; _i17++) {
|
4792 |
+
first.appendChild(tdsChildrenNew[_i17]);
|
4793 |
}
|
4794 |
}
|
4795 |
|
4844 |
cell.rowSpan = 1;
|
4845 |
cell.colSpan = 1;
|
4846 |
|
4847 |
+
for (var _i18 = 1; _i18 < colspan; _i18++) {
|
4848 |
var td = new WPTB_Cell(mark);
|
4849 |
td.getDOMElement().setAttribute('style', cellStyles);
|
4850 |
td.getDOMElement().classList.add('wptb-highlighted');
|
4856 |
}
|
4857 |
|
4858 |
if (rowspan > 1) {
|
4859 |
+
for (var _i19 = 1; _i19 < rowspan; _i19++) {
|
4860 |
var rowChildInsertBefore = undefined,
|
4861 |
+
rowNext = table.rows[row + _i19],
|
4862 |
rowChildren = rowNext.children,
|
4863 |
rowChildrenLength = rowChildren.length;
|
4864 |
|
4870 |
}
|
4871 |
}
|
4872 |
}
|
4873 |
+
for (var _j9 = 0; _j9 < colspan; _j9++) {
|
4874 |
+
var _td2 = new WPTB_Cell(mark);
|
4875 |
+
_td2.getDOMElement().setAttribute('style', cellStyles);
|
4876 |
if (rowChildInsertBefore != undefined) {
|
4877 |
+
rowNext.insertBefore(_td2.getDOMElement(), rowChildInsertBefore);
|
4878 |
} else {
|
4879 |
+
rowNext.appendChild(_td2.getDOMElement());
|
4880 |
}
|
4881 |
}
|
4882 |
}
|
4976 |
|
4977 |
if (rowspan == undefined) rowspan = 1;
|
4978 |
|
4979 |
+
for (var _i20 = 0; _i20 < rowspan; _i20++) {
|
4980 |
thisRow = table.rows[row];
|
4981 |
var thisRowChildren = thisRow.children,
|
4982 |
nextRow = table.rows[row + 1],
|
4987 |
if (nextRow != undefined) {
|
4988 |
nextRowChildren = nextRow.children;
|
4989 |
nextRowChildrenLength = nextRowChildren.length;
|
4990 |
+
for (var _j10 = 0; _j10 < thisRowChildren.length; _j10++) {
|
4991 |
+
if (thisRowChildren[_j10].rowSpan > 1) {
|
4992 |
var td = new WPTB_Cell(mark);
|
4993 |
td.getDOMElement().setAttribute('style', cellStyles);
|
4994 |
+
td.getDOMElement().colSpan = thisRowChildren[_j10].colSpan;
|
4995 |
+
td.getDOMElement().rowSpan = thisRowChildren[_j10].rowSpan - 1;
|
4996 |
|
4997 |
var nextRowChildrenK = undefined;
|
4998 |
for (var _k5 = 0; _k5 < nextRowChildrenLength; _k5++) {
|
4999 |
+
if (Number(nextRowChildren[_k5].dataset.xIndex) > Number(thisRowChildren[_j10].dataset.xIndex)) {
|
5000 |
nextRowChildrenK = nextRowChildren[_k5];
|
5001 |
break;
|
5002 |
}
|
5023 |
|
5024 |
var tableRows = table.rows;
|
5025 |
if (tableRows.length > 0) {
|
5026 |
+
for (var _j11 = 0; _j11 < row; _j11++) {
|
5027 |
+
var jRowChildren = tableRows[_j11].children;
|
5028 |
if (jRowChildren.length > 0) {
|
5029 |
for (var x = 0; x < jRowChildren.length; x++) {
|
5030 |
+
if (jRowChildren[x].rowSpan - 1 >= row - _j11) {
|
5031 |
jRowChildren[x].rowSpan--;
|
5032 |
}
|
5033 |
}
|
5077 |
cellXIndex = cell.dataset.xIndex,
|
5078 |
colspan = cell.colSpan;
|
5079 |
|
5080 |
+
for (var _i21 = 0; _i21 < colspan; _i21++) {
|
5081 |
+
for (var _j12 = 0; _j12 < table.rows.length; _j12++) {
|
5082 |
+
var rowChildren = table.rows[_j12].children;
|
5083 |
var rowChildrenLength = rowChildren.length;
|
5084 |
if (rowChildrenLength > 0) {
|
5085 |
for (var _k7 = rowChildrenLength - 1; _k7 >= 0; _k7--) {
|
5087 |
if (rowChildren[_k7].colSpan > 1) {
|
5088 |
rowChildren[_k7].colSpan--;
|
5089 |
} else {
|
5090 |
+
table.rows[_j12].removeChild(rowChildren[_k7]);
|
5091 |
}
|
5092 |
break;
|
5093 |
} else if (Number(rowChildren[_k7].dataset.xIndex) < Number(cellXIndex) && Number(rowChildren[_k7].dataset.xIndex) + Number(rowChildren[_k7].colSpan - 1) >= cellXIndex) {
|
5100 |
}
|
5101 |
}
|
5102 |
|
5103 |
+
for (var _j13 = 0; _j13 < table.rows.length; _j13++) {
|
5104 |
+
if (array[_j13] != undefined) array[_j13].pop();
|
5105 |
}
|
5106 |
|
5107 |
maxAmountOfCells--;
|
5153 |
|
5154 |
WPTB_LeftPanel();
|
5155 |
|
5156 |
+
// event hook to signal that table is generated and ready to be used
|
5157 |
+
WPTB_Helper.wptbDocumentEventGenerate('wptb:table:generated', document);
|
5158 |
+
|
5159 |
WPTB_Helper.elementStartScript(table, 'table_setting');
|
5160 |
WPTB_Helper.elementOptionsSet('table_setting', table);
|
5161 |
|
5456 |
}
|
5457 |
};
|
5458 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5459 |
//# sourceMappingURL=admin.js.map
|
inc/admin/js/admin.js.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"sources":["WPTB_ActionsField.js","WPTB_Builder.js","WPTB_Cell.js","WPTB_DropHandle.js","WPTB_ElementCounters.js","WPTB_ElementObject.js","WPTB_ElementOptions.js","WPTB_Helper.js","WPTB_Initializer.js","WPTB_LeftPanel.js","WPTB_MultipleSelect.js","WPTB_Parser.js","WPTB_Polyfills.js","WPTB_Settings.js","WPTB_Stringifier.js","WPTB_Table.js","WPTB_TableStateSaveManager.js","WPTB_innerElementSet.js","applyGenericItemSettings.js"],"names":["WPTB_ActionsField","wptbActions","document","getElementsByClassName","length","addActionField","actionType","thisNode","body","getElementsByTagName","actions","previousNode","activeElem","classList","remove","parentNode","removeChild","btnDelete","btnCopy","createElement","add","appendChild","type","onclick","event","act","target","el","infArr","className","match","hasOwnProperty","kind","thisRow","WPTB_Helper","rowIsTop","table","findAncestor","contains","dataTitleColumnSet","wptbActionsField","actionsRemove","wptbTableStateSaveManager","WPTB_TableStateSaveManager","tableStateSet","copy","activeElement","activeElemParent","Array","isArray","data","elemProt","tinyMceClear","WPTB_ElementObject","insertBefore","getDOMElement","nextSibling","elementCopy","cloneNode","applyGenericItemSettings","wptbDocumentEventGenerate","WPTB_innerElementSet","setParameters","btnMove","draggable","ondragstart","wptbElementIconsDirectories","tmplIconsDirectories","wp","template","jsonIconsDirectories","IconsDirectories","JSON","parse","dragImages","getElementIcon","dataTransfer","effectAllowed","setDragImage","setData","style","display","actionsHide","ondragend","elementDragEndClear","coordinatesElement","getBoundingClientRect","wptbContainer","correctTop","top","parseFloat","removeEventListener","left","right","clientWidth","addEventListener","leaveFromField","node","relatedTarget","onmouseleave","opacity","WPTB_Builder","table_id","detectMode","http","XMLHttpRequest","urlSet","ajaxurl","open","setRequestHeader","onreadystatechange","d","readyState","status","ans","responseText","getElementById","value","wptbTableSetupEl","WPTB_Parser","WPTB_Table","element","querySelector","dataset","wptbTableContainerMaxWidth","maxWidth","tdDefaultWidth","WPTB_Settings","send","counter","ElementCounters","select","MultipleSelect","initializer","WPTB_Initializer","settings","url","window","location","href","regex","RegExp","results","exec","WPTB_Cell","callback","DOMElement","highlightRow","td","parentRow","columnCount","parseInt","tds","i","classToAdd","ttd","highlightColumn","index","rowCount","tr","padding","jQuery","val","innerBorderWidth","border","ondblclick","stopPropagation","currentTarget","newElementProxy","controlsChange","inputs","highlighted","controlUnicClassCommonPart","addColumnWidth","cellWidth","cellWidthFixedControl","checked","cellWidthFixed","width","getColumnWidth","addRowHeight","cellHeight","cellHeightFixed","height","getRowHeight","controlsInclude","wptbPhElement","wptbElementTypeClass","wptbTypeElementArr","split","wptbInternalActiveElement","j","wptbInternalActiveElementObj","setCoords","y","x","yIndex","xIndex","getCoords","coords","appendElement","getCellDimensions","tdStyleObj","getComputedStyle","tdPaddingLeft","getPropertyValue","tdPaddingRight","tdBorderLeftWidth","tdBorderRightWidth","tdPaddingTop","tdPaddingBottom","tdBorderTopWidth","tdBorderBottomWidth","offsetWidth","offsetHeight","tableFullStyleObj","tableBorderLeft","tableBorderRight","tableBorderTop","tableBorderBottom","nodeName","toLowerCase","firstChild","lastChild","WPTB_DropHandle","thisElem","e","wptbDropHandle","wptbDropBorderMarker","wptbDropBorderMarkerTop","wptbDropBorderMarkerRight","wptbDropBorderMarkerBottom","wptbDropBorderMarkerLeft","ondragenter","ondragover","preventDefault","ondragleave","ondrop","getData","wptbMovingMode","text","getDOMParentElement","innerElement","innerElementNext","undefined","onscroll","localName","indics","types","notDragEnter","indexOf","elementDrag","offsetY","layerY","bottom","priv","increment","key","nextIndex","kindIndexProt","wpTemplateId","itemHtml","replace","trim","innerHTML","wptbElementMutch","elementClearFromTinyMce","inElems","querySelectorAll","inElemObj","WPTB_ElementOptions","elementOptionsSet","capture","hexToRgb","hex","result","rgbToHex","rgb","isHex","rgbm","Math","round","toString","toUpperCase","slice","test","icon_directory","hostName","protocol","hostname","img","src","wptbDropHandles","wptbDropBorderMarkers","linkHttpCheckChange","link","convertToAbs","currentLocation","origin","linkArr","linkClean","rows","rowHead","computedStyleRowHead","rowHeadChildren","children","contentsForHeader","tdElements","p","textContent","textAlign","fontSize","color","backgroundColor","thisRowChildren","wptbTitleColumn","wptbTitleColumnFontSize","wptbTitleColumnColor","wptbTitleBackgroundColor","wptbTitleAlign","cls","parentElement","row","parent","getSelectionText","txt","getSelection","selection","createRange","elementOptionsPanelClear","elementOptionsGroup","wpColorPickerCheckChangeForTableStateSaving","originalEvent","wpPickerContainer","irisStripMouseUpStateSaveManager","wpColorPickerClear","attribute","isId","input","newInput","setAttribute","decodeURIComponent","cell","xIndexes","yIndexes","wpColorPickerChange","ui","uiColor","classe","ps","number","affectedEl","ratingStar","span","fill","wptbTextMessageSize","numberImputSize","wptbNumberInputs","maxCount","maxValue","onkeydown","thisValue","String","substring","onkeyup","ucfirst","str","charAt","eventName","details","CustomEvent","detail","bubbles","dispatchEvent","elementStartScript","WPTB_ElementsScriptsLauncher","deleteEventHandlers","off","elementChildren","replaceAll","string","search","join","mceContentBodys","k","dataMceStyle","removeAttribute","mceEditFocus","contentEditable","spellCheck","mceIds","elementOptionContainerCustomClassSet","targetInput","customClassForContainer","containerElement","elementOptionContainerAdditionalStyles","containerAdditionalStyles","containerStylesArrOne","containerStylesSet","containerStyleStr","containerStyleStrArr","functionHandler","controlConnectFunctionsName","name","elementKind","elementOptionsContainer","elementOptions","controlActiveElement","regularText","controlInfArr","controlUnicClassName","controls","controlName","control","targetControlValue","targetControlValueGet","push","oneControlInclude","wptbContrlStacksConfigId","tmplControlsConfig","container","jsonControlsConfigJson","jsonControlsConfig","controlClassName","innerElementCopyIncludeHandler","appearDependOnControl","dependOn","targetControlElementClass","dependOnControlName","dependOnControlElementClass","dependOnControlElement","targetControlElement","controlContainerElem","showHideDependOnControlElement","dependOnControlElements","controlsStateManager","targetControlClass","controlChangeIndic","targetControls","selectorElement","elementsSettingsTemplatesJs","elementSettings","elementsSettings","stringify","alignmentValue","elementControlsStateCopy","elementProt","copyElem","infArrProt","infArrCopy","elemProtKind","elemCopyKind","elementsSettingsTemplateJs","elementSettingsProt","elementSettingsCopy","Object","keys","forEach","elementSettingValue","elementSettingKeyCopy","elementControlsStateDelete","nameControl","wptbElementDatas","elementContainerClass","elementOptionClassIndic","elementOptionsGroupId","wptbelementOptionClass","wptbelementOptionsContainer","wptbelementOptionsScriptsContainer","cellEditActiveClass","activateSection","childNodes","elementOptionsGroupChildren","controlScriptsArr","controlappearDependOnControl","controlKey","tmplControlTemplate","elemContainer","elementControlTargetUnicClass","controlTemplate","wptbElementOptionContainer","helperJavascriptElem","helperJavascriptCode","innerText","script","managerExternalCssStyles","elementContainer","selector","cssName","cssValue","head","cssForThisElement","cssText","cssTextArrFirst","pop","selectorExists","cssTextArrSecond","cssTextArrThird","cssNameExists","cssTextArrFourth","splice","registerSections","sections","map","sectionElement","s","sectionDataId","displayType","triggerSectionEvent","prototype","call","visibility","setupSectionButtons","sectionButtons","from","vm","sectionName","wptbSectionButton","wptbSectionDisplayType","setupPanelToggleButtons","$","each","find","click","slideToggle","toggleClass","sectionEvent","setupSidebarToggle","toggleSelector","toggleButton","toggle","externalCssStylesDelete","externalCssStylesCopy","copyElement","activeElemClass","cssForActiveElement","cssForNewElement","infArrCopyEl","cssForActiveElementInnerHTML","cssForNewElementInnerHTML","elementsStylesConvertToObject","stylesElements","stylesObj","styleElemId","getAttribute","elementsStylesSetFromObject","jsonObject","styleCss","saveTable","startSaving","previewSaving","wptbTableStateNumberSave","wptbTableStateNumberShow","bar","toggleTableEditMode","wptb_admin_object","t","messagingArea","code","datas","postId","rs","wptbId","paramIdsNecessaryChange","codeClone","columns","WPTB_Stringifier","outerHTML","datas_containers","styleObjJson","messagingAreaText","setTimeout","params","title","content","elements_datas","elements_styles","security_code","preview_saving","id","action","builderPageUrl","history","pushState","wptbPreviewTable","wptbPreviewBtn","wptbPreviewBtnHref","previewHref","wptbSaveBtn","clickOnFreeSpace","cellModeBackground","wpcdFixedToolbar","hasAttribute","elementAjax","dataAjaxData","element_name","element_ajax_data","close","leftScrollPanelCurtain","leftScrollPanelCellSettings","deactivateMultipleSelectMode","wptbPreviewTableTds","activateMultipleSelectMode","checkingDimensionValue","dimension","searchIndex","checkSetGetStyleSizeValue","styleName","computedStyleName","elemStyleValue","elementStyles","checkSetGetStyleColorValue","set","elemStyleColorValue","checkSetGetStyleValue","getValueMaxCountSameElementsInArray","arr","check","maxPropName","recalculateIndexes","trs","maxCols","maxColsFull","tdsArr","jMainIter","colSpan","rowSpan","z","tableRowsColorsReinstall","tableIndex","tableHeaderBackground","tableEvenRowBackground","tableOddRowBackground","MIN_COLUMNS","MIN_ROWS","MAX_COLUMNS","MAX_ROWS","tableGenerator","columnsDecrementButton","columnsIncrementButton","rowsDecrementButton","rowsIncrementButton","columnsInput","rowsInput","WPTB_LeftPanel","wptbElementButtons","wptbElement","wptbTablesEditModeCloseButton","addRowToTheEnd","addRowToTheStart","addRowBefore","addRowAfter","addColumnEnd","addColumnStart","addColumnBefore","addColumnAfter","deleteColumn","deleteRow","mergeCells","splitCell","wptbBuilderPanel","wptbHeader","selectedCells","multipleCellMode","isActivated","pushSelectedCell","flushSelectedCells","getFirst","minXIndex","minYIndex","first","getLast","maxXIndex","maxYIndex","last","removeAllButFirst","div","columnTitleMobile","hasDontEnumBug","propertyIsEnumerable","dontEnums","dontEnumsLength","obj","TypeError","prop","elems","wptbUndo","tableStateGet","wptbUndoredo","wptbUndoRedoContainer","wptbRedo","shortcodePopupWindow","onbeforeunload","wptbSaveDisabled","previewId","floor","random","newHref","URL","searchParams","tableTitleField","onchange","codeMain","tableColumns","minWidth","innerElements","wptbActionsLength","dataMceBogus","columnNameDivContainer","columnNameDiv","array","wptb_preview_table","wptbTableSetup","maxAmountOfCells","maxAmountOfRows","mark","cs","noCells","singleCells","multipleCells","cellSettings","position","column","cellHighlighted","markedCells","controlElemIds","elementControlSizeUnicClass","elementControlSizeFixedUnicClass","sizeName","getSizeFunctionName","size","cellSizeInputs","cellSizeFixedInput","isSquare","realTimeArray","carried","cols","matriz","items","justAssigned","amount","carriedRowspans","cellsBuffer","cellPointer","xPosition","stepsToMove","celda","drawTable","a","undoSelect","fillTableArray","colspansSums","cells","colspanSumInRow","max","apply","getActualPointsInRow","points","skipInCols","reconstraction","insertRow","borderWidth","cleaner","dataXIndex","tableTdsFor","colspan","tableRows","widthIsSet","arrayTdsFromPreviousRow","wptbFixedWidth","tableTdsSumMaxWidth","tableTdsSumMaxWidthFixed","tableTdsSumMaxWidthAuto","wptbTableSetupWidth","arrayCellsWidthFixedHelper","arrayCellsWidthAutoHelper","tdPaddingCommon","tableTdBorderCommonWidth","cssForTdsWidthAuto","borderLeftWidth","borderRightWidth","tableBorderCommon","wptbTdWidthAuto","wptbCssTdAutoWidth","tableTdBorderLeftWidth","tableTdBorderRightWidth","CellsWidthAutoCount","wptbTableTdsSumMaxWidth","wptbCellsWidthAutoCount","mergingСellsHorizontally","wptbFixedWidthSize","styleElementCreate","tableTdWidthAuto","tableTdsWidthAutoCommon","cssForTdsWidthAutoOld","wptbTableAlignment","float","dataYIndex","rowspan","heightIsSet","arrayTdsPrevious","wptbFixedHeight","mergingCellsVertically","forBreak","currentTable","currentTableTd","currentTdStyle","firstCell","c_pos","cellStyle","pos","pendingInsertion","bro","currentCell","l","r","aux","cellNew","rowChildren","rowChildrenLength","cellRowSpan","rowAfter","cellsColSpan","tableRowsIChildren","tableRIChildrenLength","rowIRowSpan","rNext","rNextChildren","rNextChildrenLength","rowStart","columnStart","rowEnd","columnEnd","itemsEstimate","dimensions","tdsChildrenNew","tdsInternalElements","tdsIntElemLength","firstWidth","firstDataFixedWidth","firstHeight","firstDataFixedHeight","cellStyles","cellXIndex","rowChildInsertBefore","rowNext","Number","findRowspannedCells","difference","actualPoints","addLackingCells","sumRows","totalColspan","nextRow","nextRowChildren","nextRowChildrenLength","tdArr","nextRowChildrenK","jRowChildren","onresize","generate","wptbTableStateSaving","wptbNewTableSetup","wptbHighlighted","wptbDirectlyhovered","cssForTdsWidthAutoValue","wptbTableTitle","wptbSetupName","datawptbUndoredo","wptbTableSetupNew","wptbLeftScrollPanelCellSetting","tableStateClear","classId","elemKind","onmouseover","wptbElements","elementIndexesArr","elementIndexMax","wptbNodeattributes","attributes","attr","newDataAttributeName","newDataAttributeValue","nodeValue","kindIndexProtArr","node_wptb_element_kind_num","onmouseenter"],"mappings":";;AAAA,IAAIA,oBAAoB,SAApBA,iBAAoB,GAAW;AAAA;;AAC/B;AACA,SAAKC,WAAL;AACA,QAAIC,SAASC,sBAAT,CAAiC,cAAjC,EAAkDC,MAAlD,IAA4D,CAAhE,EAAoE;AAChE,aAAKH,WAAL,GAAmBC,SAASC,sBAAT,CAAiC,cAAjC,EAAkD,CAAlD,CAAnB;AACH;;AAED,SAAKE,cAAL,GAAsB,UAAEC,UAAF,EAAcC,QAAd,E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,IAAIxC,iBAAJ,EAAvB;;AAEAwC,yBAAiBwD,cAAjB,CAAiCxE,KAAjC,EAAwCyE,IAAxC;AACH,KAJD;AAKH,CApFD","file":"admin.js","sourcesContent":["var WPTB_ActionsField = function() {\n //this.wptbBorderMarker;\n this.wptbActions;\n if( document.getElementsByClassName( 'wptb-actions' ).length != 0 ) {\n this.wptbActions = document.getElementsByClassName( 'wptb-actions' )[0];\n }\n \n this.addActionField = ( actionType, thisNode ) => {\n let body = document.getElementsByTagName( 'body' )[0];\n \n let actions = document.getElementsByClassName( 'wptb-actions' );\n if( actions.length != 0 ) {\n let previousNode = actions[0].activeElem;\n if( previousNode ) {\n previousNode.classList.remove( 'wptb-directlyhovered' );\n }\n \n while( actions.length != 0 ) {\n actions[0].parentNode.removeChild( actions[0] );\n }\n }\n \n if( actionType == 1 ) {\n \n let btnDelete, btnCopy;\n\n btnDelete = document.createElement( 'span' ),\n btnCopy = document.createElement( 'span' ),\n actions = document.createElement( 'div' );\n\n actions.classList.add( 'wptb-actions' );\n btnDelete.classList.add( 'dashicons', 'dashicons-trash', 'wptb-delete-action' );\n btnCopy.classList.add( 'dashicons', 'dashicons-admin-page', 'wptb-duplicate-action' );\n \n actions.appendChild( btnCopy );\n actions.appendChild( btnDelete );\n \n body.appendChild( actions );\n\n actions.activeElem = thisNode;\n\n actions.type = 1;\n\n btnDelete.onclick = function( event ) {\n let act = event.target.parentNode.activeElem,\n el = act.parentNode;\n let infArr = act.className.match( /wptb-element-(.+)-(\\d+)/i );\n// if( act && infArr && Array.isArray( infArr ) ) {\n// WPTB_Helper.elementControlsStateDelete( act );\n// WPTB_Helper.externalCssStylesDelete( infArr[0] );\n// }\n \n if( act ) {\n el.removeChild( act );\n }\n\n if( act && typeof act === 'object' && act.hasOwnProperty( 'kind' ) && act.kind == 'text' ) {\n let thisRow = el.parentNode;\n \n if( WPTB_Helper.rowIsTop( thisRow ) ) {\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\n\n if( table.classList.contains( 'wptb-table-preview-head' ) ) {\n WPTB_Helper.dataTitleColumnSet( table );\n }\n }\n }\n\n let wptbActionsField = new WPTB_ActionsField();\n wptbActionsField.actionsRemove();\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n btnCopy.onclick = ( event ) => {\n let copy,\n infArr,\n type;\n let activeElement = event.target.parentNode.activeElem;\n let activeElemParent = activeElement.parentNode;\n infArr = activeElement.className.match( /wptb-element-(.+)-(\\d+)/i );\n if( infArr && Array.isArray( infArr ) ) {\n type = infArr[1];\n let data = {};\n data.kind = type;\n data.elemProt = activeElement;\n data.tinyMceClear = true;\n copy = new WPTB_ElementObject( data );\n //WPTB_Helper.elementControlsStateCopy( activeElement, copy.getDOMElement() );\n //WPTB_Helper.externalCssStylesCopy( activeElement, copy.getDOMElement() );\n //WPTB_Helper.elementStartScript( copy.getDOMElement() );\n \n activeElemParent.insertBefore( copy.getDOMElement(), activeElement.nextSibling );\n } else {\n copy = {};\n let elementCopy = activeElement.cloneNode( true );\n elementCopy.classList.remove( 'wptb-directlyhovered' );\n \n copy.getDOMElement = function() {\n return elementCopy;\n }\n \n applyGenericItemSettings( copy );\n \n activeElemParent.insertBefore( copy.getDOMElement(), activeElement.nextSibling );\n \n WPTB_Helper.wptbDocumentEventGenerate( 'wptb-inner-element:copy', activeElement, copy.getDOMElement() );\n }\n \n WPTB_innerElementSet( copy.getDOMElement() );\n\n let wptbActionsField = new WPTB_ActionsField( 1, activeElement );\n wptbActionsField.setParameters( activeElement );\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n \n \n if( thisNode.classList.contains( 'wptb-ph-element' ) ) {\n let btnMove;\n btnMove = document.createElement( 'span' );\n btnMove.classList.add( \"dashicons\", \"dashicons-move\", 'wptb-move-action' );\n btnMove.draggable = true;\n actions.appendChild( btnMove );\n \n btnMove.ondragstart = ( event ) => {\n let wptbElementIconsDirectories = 'wptb-element-icons-directories';\n let tmplIconsDirectories = wp.template( wptbElementIconsDirectories );\n let data = {};\n let jsonIconsDirectories = tmplIconsDirectories( data );\n let IconsDirectories = JSON.parse( jsonIconsDirectories );\n\n let dragImages,\n actions = event.target.parentNode,\n activeElem = actions.activeElem,\n infArr,\n type;\n infArr = activeElem.className.match( /wptb-element-(.+)-(\\d+)/i );\n if( infArr && Array.isArray( infArr ) ) {\n type = infArr[1];\n activeElem.classList.add( 'wptb-moving-mode' );\n\n if( IconsDirectories && typeof IconsDirectories === 'object' && IconsDirectories[type] ) {\n dragImages = WPTB_Helper.getElementIcon( IconsDirectories[type] );\n }\n\n event.dataTransfer.effectAllowed = 'move';\n event.dataTransfer.setDragImage( dragImages, 0, 0 );\n event.dataTransfer.setData( 'node', 'wptb-element-' + infArr[1] + '-' + infArr[2] );\n event.dataTransfer.setData( 'wptb-moving-mode', 'wptb-element-' + infArr[1] + '-' + infArr[2] );\n event.dataTransfer.setData( 'wptbElIndic-' + infArr[1], 'wptbElIndic-' + infArr[1] );\n let act = event.target.parentNode.activeElem;\n if( act.kind == 'text' ) {\n let thisRow = act.parentNode.parentNode;\n \n if( WPTB_Helper.rowIsTop( thisRow ) ) {\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\n\n if( table.classList.contains( 'wptb-table-preview-head' ) ) {\n WPTB_Helper.dataTitleColumnSet( table );\n }\n }\n }\n } else {\n this.style.display = 'none';\n }\n\n this.actionsHide();\n };\n\n btnMove.ondragend = ( event ) => {\n WPTB_Helper.elementDragEndClear();\n }\n }\n\n actions.style.display = 'flex';\n\n this.wptbActions = actions;\n } \n }\n \n this.setParameters = ( thisNode ) => {\n \n if( ! this.wptbActions ) {\n let actions = document.getElementsByClassName( 'wptb-actions' );\n if( actions.length > 0 ) {\n this.wptbActions = actions[0];\n } else {\n this.wptbActions = false;\n }\n }\n \n if( this.wptbActions && this.wptbActions.classList.contains( 'wptb-actions' ) ) {\n this.wptbActions.style.display = 'flex';\n } else {\n return;\n }\n \n let coordinatesElement = thisNode.getBoundingClientRect();\n \n let wptbContainer = document.getElementsByClassName( 'wptb-container' )[0];\n let correctTop = () => {\n let coordinatesElement = thisNode.getBoundingClientRect();\n this.wptbActions.style.top = parseFloat( coordinatesElement.top ) - 15 + 'px';\n }\n wptbContainer.removeEventListener( 'scroll', correctTop, false );\n \n this.wptbActions.style.top = parseFloat( coordinatesElement.top ) - 15 + 'px';\n this.wptbActions.style.left = ( parseFloat( coordinatesElement.right ) - parseFloat( this.wptbActions.clientWidth ) ) + 1 + 'px';\n \n this.wptbActions.style.display = 'flex';\n thisNode.classList.add( 'wptb-directlyhovered' );\n \n wptbContainer.addEventListener( 'scroll', correctTop, false );\n }\n \n this.leaveFromField = ( event, node, actionType ) => {\n if( ! this.wptbActions ) {\n let actions = document.getElementsByClassName( 'wptb-actions' );\n if( actions.length > 0 ) {\n this.wptbActions = actions[0];\n } else {\n this.wptbActions = false;\n }\n }\n \n if( ! this.wptbActions ) {\n return;\n }\n \n if( event.relatedTarget ) {\n if ( event.relatedTarget.classList.contains( 'wptb-actions' ) ||\n event.relatedTarget.classList.contains( 'wptb-move-action' ) ||\n event.relatedTarget.classList.contains( 'wptb-duplicate-action' ) ||\n event.relatedTarget.classList.contains( 'wptb-delete-action' ) ) {\n if( ! this.wptbActions ) {\n this.wptbActions = document.getElementsByClassName( 'wptb-actions' )[0];\n }\n this.wptbActions.onmouseleave = ( event ) => {\n if( event.relatedTarget != null && ( event.relatedTarget.classList.contains( 'wptb-ph-element' ) || \n WPTB_Helper.findAncestor( event.relatedTarget, 'wptb-ph-element') ) && event.relatedTarget != this.wptbActions.activeElem &&\n WPTB_Helper.findAncestor( event.relatedTarget, 'wptb-directlyhovered' ) != this.wptbActions.activeElem ) {\n \n// this.wptbActions.style.display = 'none';\n// event.relatedTarget.parentNode.parentNode.classList.remove( 'wptb-directlyhovered' );\n//\n// let wptbActionsField = new WPTB_ActionsField();\n//\n// wptbActionsField.addActionField( 1, event.relatedTarget.parentNode.parentNode );\n//\n// wptbActionsField.setParameters( event.relatedTarget.parentNode.parentNode );\n } else {\n \n }\n \n let wptbActionsField = new WPTB_ActionsField();\n\n wptbActionsField.leaveFromField( event, event.relatedTarget.parentNode.parentNode );\n \n event.target.activeElem.classList.remove( 'wptb-directlyhovered' );\n }\n\n return;\n } \n }\n \n node.classList.remove( 'wptb-directlyhovered' );\n this.wptbActions.style.display = 'none';\n \n if( event.relatedTarget ) {\n if( event.relatedTarget.classList.contains( 'wptb-ph-element' ) || WPTB_Helper.findAncestor( event.relatedTarget, 'wptb-ph-element' ) ) {\n this.addActionField( 1, event.relatedTarget.parentNode );\n\n this.setParameters( event.relatedTarget.parentNode );\n }\n }\n }\n \n this.actionsRemove = () => {\n if( ! this.wptbActions ) {\n let actions = document.getElementsByClassName( 'wptb-actions' );\n if( actions.length > 0 ) {\n this.wptbActions = actions[0];\n }\n }\n \n if( this.wptbActions ) {\n this.wptbActions.parentNode.removeChild( this.wptbActions );\n }\n }\n \n this.actionsHide = () => {\n if( ! this.wptbActions ) {\n let actions = document.getElementsByClassName( 'wptb-actions' );\n if( actions.length > 0 ) {\n this.wptbActions = actions[0];\n }\n }\n \n if( this.wptbActions ) {\n this.wptbActions.style.opacity = 0;\n }\n }\n}","(function () {\n var WPTB_Builder = function () {\n var table_id = WPTB_Helper.detectMode();\n if ( table_id ) {\n var http = new XMLHttpRequest(),\n urlSet = ajaxurl + \"?action=get_table\" + '&id=' + table_id;\n http.open('GET', urlSet, true);\n http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');\n http.onreadystatechange = function (d) {\n if (this.readyState == 4 && this.status == 200) {\n var ans = JSON.parse( http.responseText );\n document.getElementById('wptb-setup-name').value = ans[0];\n \n if( ans[1] ) {\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'none';\n let wptbTableSetupEl = document.getElementsByClassName('wptb-table-setup')[0];\n wptbTableSetupEl.appendChild( WPTB_Parser( ans[1] ) );\n \n let body = document.getElementsByTagName('body')[0];\n \n WPTB_Table();\n let element = document.querySelector( '.wptb-preview-table' );\n if( element ) {\n let infArr = element.className.match( /wptb-element-((.+-)\\d+)/i );\n if( ! infArr ) {\n element.classList.add( 'wptb-element-main-table_setting-' + table_id );\n }\n \n if( element.dataset.wptbTableContainerMaxWidth ) {\n wptbTableSetupEl.style.maxWidth = element.dataset.wptbTableContainerMaxWidth + 'px';\n \n element.tdDefaultWidth();\n }\n }\n \n //WPTB_LeftPanel();\n WPTB_Settings();\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n } else {\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\n }\n \n return;\n }\n };\n http.send(null);\n } else {\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n document.counter = new ElementCounters();\n document.select = new MultipleSelect();\n\n var initializer = WPTB_Initializer();\n settings = WPTB_Settings();\n };\n\n let url = window.location.href,\n regex = new RegExp('[?&]page=wptb-builder'),\n results = regex.exec( url );\n if ( results ) {\n document.addEventListener('DOMContentLoaded', WPTB_Builder);\n }\n})();","var WPTB_Cell = function ( callback, DOMElement ) {\n\n function highlightRow(td) {\n var parentRow = td.parentNode,\n columnCount = parseInt(document.getElementById('wptb-columns-number').value),\n tds = document.getElementsByClassName('wptb-preview-table')[0].getElementsByTagName('td');\n for (var i = 0; i < tds.length; i++) {\n tds[i].classList.remove('wptb-highlighted-row-first', 'wptb-highlighted-row-last', 'wptb-highlighted-row-inner', 'wptb-highlighted-column-first', 'wptb-highlighted-column-last', 'wptb-highlighted-column-inner');\n }\n for (var i = 0; i < columnCount; i++) {\n\n var classToAdd = i == 0 ? 'wptb-highlighted-row-first' : i == columnCount - 1 ? 'wptb-highlighted-row-last' : 'wptb-highlighted-row-inner';\n var ttd = parentRow.getElementsByTagName('td')[i];\n if (ttd !== td) {\n ttd.classList.add(classToAdd);\n }\n }\n }\n\n function highlightColumn(td) {\n\n var index,\n parentRow = td.parentNode;\n columnCount = parseInt(document.getElementById('wptb-columns-number').value), rowCount = parseInt(document.getElementById('wptb-rows-number').value), table = document.getElementsByClassName('wptb-preview-table')[0];\n for (var i = 0; i < columnCount; i++) {\n if (parentRow.getElementsByTagName('td')[i] === td) {\n index = i;\n break;\n }\n }\n\n for (var i = 0; i < rowCount; i++) {\n var classToAdd = i == 0 ? 'wptb-highlighted-column-first' : i == rowCount - 1 ? 'wptb-highlighted-column-last' : 'wptb-highlighted-column-inner';\n var tr = table.getElementsByTagName('tr')[i];\n if (tr.getElementsByTagName('td')[index] !== td) {\n tr.getElementsByTagName('td')[index].classList.add(classToAdd);\n }\n }\n }\n \n if( ! DOMElement ) {\n DOMElement = document.createElement(\"td\");\n\n DOMElement.style.padding = jQuery('#wptb-table-padding-number').val() + 'px';\n\n var innerBorderWidth = jQuery('#wptb-table-inner-border-number').val();\n\n if (innerBorderWidth != '' && parseInt(innerBorderWidth) != 0) {\n DOMElement.style.border = innerBorderWidth + 'px solid ' + jQuery('#wptb-table-border-color').val();\n } \n\n DOMElement.classList.add('wptb-droppable', 'wptb-cell');\n }\n\n DOMElement.draggable = false;\n if ( callback ) {\n DOMElement.onclick = callback;\n }\n \n // Cell double click handler\n DOMElement.ondblclick = function( event ) {\n event.stopPropagation();\n if( ! WPTB_Helper.findAncestor( DOMElement, 'wptb-preview-table-manage-cells' ) && event.target == event.currentTarget ) {\n \n WPTB_Helper.wptbDocumentEventGenerate( 'table:cell:dblclick', event.target );\n \n let element = WPTB_Helper.newElementProxy( 'text' );\n element = element.getDOMElement();\n \n DOMElement.appendChild( element );\n \n WPTB_innerElementSet( element );\n }\n }\n \n WPTB_innerElementSet( DOMElement );\n\n function controlsChange( inputs, DOMElement ) {\n if( inputs && typeof inputs === 'object' ) {\n let table = WPTB_Helper.findAncestor( DOMElement, 'wptb-preview-table' ),\n highlighted = table.querySelector( '.wptb-highlighted' );\n if( highlighted ) {\n let infArr = highlighted.className.match(/wptb-element-((.+-)\\d+)/i);\n\n let controlUnicClassCommonPart = '';\n if(infArr && Array.isArray(infArr)) {\n controlUnicClassCommonPart = infArr[1]\n }\n\n if( inputs.hasOwnProperty( 'cellWidth' ) ) {\n table.addColumnWidth( inputs.cellWidth );\n\n if( controlUnicClassCommonPart ) {\n let cellWidthFixedControl = document.querySelector(`.wptb-el-${controlUnicClassCommonPart}-cellWidthFixed`);\n\n if(cellWidthFixedControl && !cellWidthFixedControl.checked) cellWidthFixedControl.checked = true;\n }\n } else if( inputs.hasOwnProperty( 'cellWidthFixed' ) ) {\n if( inputs.cellWidthFixed == 'checked' ) {\n let width = WPTB_Helper.getColumnWidth( table, highlighted );\n table.addColumnWidth( width );\n } else {\n table.addColumnWidth( false, true );\n }\n } else if( inputs.hasOwnProperty( 'cellHeight' ) ) {\n table.addRowHeight( inputs.cellHeight );\n\n if( controlUnicClassCommonPart ) {\n let cellWidthFixedControl = document.querySelector(`.wptb-el-${controlUnicClassCommonPart}-cellHeightFixed`);\n\n if(cellWidthFixedControl && !cellWidthFixedControl.checked) cellWidthFixedControl.checked = true;\n }\n } else if( inputs.hasOwnProperty( 'cellHeightFixed' ) ) {\n if( inputs.cellHeightFixed == 'checked' ) {\n let height = WPTB_Helper.getRowHeight( table, highlighted );\n table.addRowHeight( height );\n } else {\n table.addRowHeight( false, true );\n }\n }\n }\n }\n }\n WPTB_Helper.controlsInclude( DOMElement, controlsChange );\n \n let wptbPhElement = DOMElement.getElementsByClassName( 'wptb-ph-element' );\n \n if ( wptbPhElement.length > 0 ) {\n for( let i = 0; i < wptbPhElement.length; i++ ) {\n wptbPhElement[i].getDOMElement = function() {\n return wptbPhElement[i];\n }\n \n WPTB_innerElementSet( wptbPhElement[i] );\n \n let wptbElementTypeClass = wptbPhElement[i].className.match( /wptb-element-((.+-)\\d+)/i );\n if( wptbElementTypeClass && Array.isArray( wptbElementTypeClass ) ) {\n let wptbTypeElementArr = wptbElementTypeClass[1].split( '-' );\n wptbPhElement[i].kind = wptbTypeElementArr[0];\n applyGenericItemSettings( wptbPhElement[i], wptbElementTypeClass[1] );\n let wptbInternalActiveElement = wptbPhElement[i].getElementsByClassName( 'wptb-in-element' );\n if ( wptbInternalActiveElement.length > 0 ) {\n for ( let j = 0; j < wptbInternalActiveElement.length; j++ ) {\n let wptbInternalActiveElementObj = {};\n wptbInternalActiveElementObj.getDOMElement = function() {\n return wptbInternalActiveElement[j];\n }\n \n applyGenericItemSettings( wptbInternalActiveElementObj );\n }\n }\n }\n }\n }\n\n this.getDOMElement = function () {\n return DOMElement;\n };\n\n this.setCoords = function (y, x) {\n var el = this.getDOMElement();\n el.dataset.yIndex = y;\n el.dataset.xIndex = x;\n };\n\n this.getCoords = function () {\n var coords,\n el = this.getDOMElement();\n coords.x = el.dataset.xIndex;\n coords.y = el.dataset.yIndex;\n return coords;\n };\n\n this.appendElement = function (node) {\n getDOMElement().appendChild(node);\n };\n \n DOMElement.getCellDimensions = function() {\n \n let tdStyleObj = window.getComputedStyle( this, null );\n \n let tdPaddingLeft = tdStyleObj.getPropertyValue( 'padding-left' );\n let tdPaddingRight = tdStyleObj.getPropertyValue( 'padding-right' );\n \n let tdBorderLeftWidth = tdStyleObj.getPropertyValue( 'border-left-width' );\n let tdBorderRightWidth = tdStyleObj.getPropertyValue( 'border-right-width' );\n \n let tdPaddingTop = tdStyleObj.getPropertyValue( 'padding-top' );\n let tdPaddingBottom = tdStyleObj.getPropertyValue( 'padding-bottom' );\n \n let tdBorderTopWidth = tdStyleObj.getPropertyValue( 'border-top-width' );\n let tdBorderBottomWidth = tdStyleObj.getPropertyValue( 'border-bottom-width' );\n \n let width = parseInt( this.offsetWidth, 10 ) - \n parseInt( tdPaddingLeft, 10 ) - \n parseInt( tdPaddingRight, 10 ) -\n ( parseInt( tdBorderLeftWidth, 10 ) / 2 ) -\n ( parseInt( tdBorderRightWidth, 10 ) / 2 );\n \n let height = parseInt( this.offsetHeight, 10 ) - \n parseInt( tdPaddingTop, 10 ) - \n parseInt( tdPaddingBottom, 10 ) -\n ( parseInt( tdBorderTopWidth, 10 ) / 2 ) -\n ( parseInt( tdBorderBottomWidth, 10 ) / 2 ); \n \n \n let table = WPTB_Helper.findAncestor( this, 'wptb-preview-table' );\n if( table ) {\n let tableFullStyleObj = window.getComputedStyle( table, null );\n let tableBorderLeft = tableFullStyleObj.getPropertyValue( 'border-left-width' );\n let tableBorderRight = tableFullStyleObj.getPropertyValue( 'border-right-width' );\n let tableBorderTop = tableFullStyleObj.getPropertyValue( 'border-top-width' );\n let tableBorderBottom = tableFullStyleObj.getPropertyValue( 'border-bottom-width' );\n \n let tr = this.parentNode;\n if( tr && tr.nodeName.toLowerCase() === 'tr' ) {\n if( tr.firstChild && tr.firstChild.dataset.xIndex === this.dataset.xIndex ) {\n if( parseInt( tableBorderLeft, 10 ) > parseInt( tdBorderLeftWidth, 10 ) ) {\n width += -( parseInt( tableBorderLeft, 10 ) - parseInt( tdBorderLeftWidth, 10 ) ) / 2;\n }\n }\n\n if( tr.lastChild && tr.lastChild.dataset.xIndex === this.dataset.xIndex ) {\n if( parseInt( tableBorderRight, 10 ) > parseInt( tdBorderRightWidth, 10 ) ) {\n width += -( parseInt( tableBorderRight, 10 ) - parseInt( tdBorderRightWidth, 10 ) ) / 2;\n }\n }\n \n let body = tr.parentNode;\n if( body && body.nodeName.toLowerCase() === 'body' ) {\n if( body.firstChild && body.firstChild.firstChild.dataset.yIndex === this.dataset.yIndex ) {\n if( parseInt( tableBorderTop, 10 ) > parseInt( tdBorderTopWidth, 10 ) ) {\n height += ( parseInt( tableBorderTop, 10 ) - parseInt( tdBorderTopWidth, 10 ) ) / 2;\n }\n }\n \n if( body.lastChild && body.lastChild.firstChild.dataset.yIndex === this.dataset.yIndex ) {\n if( parseInt( tableBorderBottom, 10 ) > parseInt( tdBorderBottomWidth, 10 ) ) {\n height += ( parseInt( tableBorderBottom, 10 ) - parseInt( tdBorderBottomWidth, 10 ) ) / 2;\n }\n }\n }\n }\n }\n \n return {\n width: parseInt( width ), \n height: parseInt( height )\n };\n }\n\n return this;\n};","var WPTB_DropHandle = function (thisElem, e) {\n \n let wptbDropHandle,\n wptbDropBorderMarker,\n wptbDropBorderMarkerTop,\n wptbDropBorderMarkerRight,\n wptbDropBorderMarkerBottom,\n wptbDropBorderMarkerLeft;\n if ( document.getElementsByClassName( 'wptb-drop-handle' ).length == 0 ) {\n wptbDropHandle = document.createElement( 'div' );\n wptbDropHandle.classList.add( 'wptb-drop-handle' );\n \n wptbDropBorderMarker = document.createElement( 'div' );\n wptbDropBorderMarker.classList.add( 'wptb-drop-border-marker' );\n \n wptbDropBorderMarkerTop = document.createElement( 'div' ),\n wptbDropBorderMarkerRight = document.createElement( 'div' ),\n wptbDropBorderMarkerBottom = document.createElement( 'div' ),\n wptbDropBorderMarkerLeft = document.createElement( 'div' );\n \n wptbDropBorderMarkerTop.classList.add( 'wptb-drop-border-marker-top' );\n wptbDropBorderMarkerRight.classList.add( 'wptb-drop-border-marker-right' );\n wptbDropBorderMarkerBottom.classList.add( 'wptb-drop-border-marker-bottom' );\n wptbDropBorderMarkerLeft.classList.add( 'wptb-drop-border-marker-left' );\n \n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerTop );\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerRight );\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerBottom );\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerLeft );\n \n let body = document.getElementsByTagName( 'body' );\n if ( body.length > 0 ) {\n body[0].appendChild( wptbDropHandle );\n body[0].appendChild( wptbDropBorderMarker );\n }\n \n wptbDropHandle.ondragenter = function () {\n\n }\n\n wptbDropHandle.ondragover = function (e) {\n e.preventDefault();\n }\n\n wptbDropHandle.ondragleave = function () {\n\n }\n wptbDropHandle.ondrop = function (e) {\n e.preventDefault();\n let element;\n \n if ( e.dataTransfer.getData('wptbElement') ) {\n element = WPTB_Helper.newElementProxy( e.dataTransfer.getData('wptbElement') );\n element = element.getDOMElement();\n } else {\n element = document.getElementsByClassName( e.dataTransfer.getData('node') )[0];\n element.classList.remove( 'wptb-moving-mode' );\n element.classList.remove( 'wptb-moving-into-same-elem' );\n element.wptbMovingMode = 1;\n }\n \n let td;\n if( wptbDropHandle.dataset.text == 'Drop Here' ) {\n thisElem = wptbDropHandle.getDOMParentElement();\n if ( thisElem.nodeName.toLowerCase() == 'td' ) {\n td = wptbDropHandle.getDOMParentElement();\n td.appendChild( element );\n }\n } else {\n let innerElement = wptbDropHandle.getDOMParentElement();\n td = innerElement.parentNode;\n \n if( wptbDropHandle.dataset.text == 'Above Element' ) {\n td.insertBefore( element, innerElement );\n } else if( wptbDropHandle.dataset.text == 'Below Element' ) {\n let innerElementNext = innerElement.nextSibling;\n td.insertBefore( element, innerElementNext );\n }\n }\n \n let thisRow = td.parentNode;\n if( WPTB_Helper.rowIsTop( thisRow ) ) {\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\n\n if( table.classList.contains( 'wptb-table-preview-head' ) ) {\n WPTB_Helper.dataTitleColumnSet( table );\n }\n }\n \n wptbDropHandle.style.display = 'none';\n wptbDropBorderMarker.style.display = 'none';\n \n WPTB_innerElementSet( element );\n if( ! element.classList.contains( 'wptb-image-container' ) || element.wptbMovingMode == 1 ) {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n element.wptbMovingMode == undefined;\n }\n }\n let wptbContainer = document.querySelector( '.wptb-container' );\n wptbContainer.onscroll = function() {\n wptbDropHandle.style.display = 'none';\n wptbDropBorderMarker.style.display = 'none';\n }\n } else {\n wptbDropHandle = document.getElementsByClassName( 'wptb-drop-handle' )[0];\n wptbDropBorderMarker = document.getElementsByClassName( 'wptb-drop-border-marker' )[0];\n }\n if( thisElem && thisElem.nodeName.toLowerCase() == 'td' && \n thisElem.getElementsByClassName( 'wptb-ph-element' ).length != 0 ) {\n return;\n }\n \n let thisRow;\n if ( thisElem.localName == 'td' ) {\n thisRow = thisElem.parentNode;\n } else if ( thisElem.localName == 'div' && thisElem.classList.contains( 'wptb-ph-element' ) ) {\n thisRow = thisElem.parentNode.parentNode;\n }\n \n if( WPTB_Helper.rowIsTop( thisRow ) ) {\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\n \n if( table.classList.contains( 'wptb-table-preview-head' ) ) {\n let indics = e.dataTransfer.types;\n let notDragEnter = false;\n for ( let i = 0; i < indics.length; i++ ) {\n let infArr = indics[i].match( /wptbelindic-([a-z]+)/i );\n if ( infArr && infArr[1] != 'text' ) {\n notDragEnter = true;\n break;\n }\n }\n if( notDragEnter ) {\n return;\n }\n }\n }\n \n wptbDropHandle.style.width = thisElem.offsetWidth + 'px';\n let height = thisElem.offsetHeight,\n coordinatesElement = thisElem.getBoundingClientRect(),\n left = parseFloat( coordinatesElement.left ),\n top;\n wptbDropHandle.style.left = left + 'px';\n \n if( e.dataTransfer.types.indexOf( 'wptb-moving-mode' ) != -1 ) {\n let elementDrag = document.getElementsByClassName( 'wptb-moving-mode' )[0];\n if( thisElem == elementDrag ) {\n wptbDropHandle.classList.add('wptb-moving-into-same-elem');\n wptbDropBorderMarker.classList.add('wptb-moving-into-same-elem');\n } else {\n wptbDropHandle.classList.remove('wptb-moving-into-same-elem');\n wptbDropBorderMarker.classList.remove('wptb-moving-into-same-elem');\n }\n }\n \n wptbDropHandle.getDOMParentElement = function() {\n return thisElem;\n }\n \n wptbDropHandle.style.display = 'block';\n wptbDropBorderMarker.style.display = 'block';\n if( thisElem.nodeName.toLowerCase() != 'td' ) {\n let y = e.offsetY==undefined?e.layerY:e.offsetY;\n top = parseFloat( coordinatesElement.top ) - parseFloat( 11 );\n wptbDropHandle.dataset.text = 'Above Element';\n if ( y > height/2 ) {\n top = parseFloat( coordinatesElement.top ) + height - 1;\n wptbDropHandle.dataset.text = 'Below Element';\n }\n } else {\n wptbDropHandle.dataset.text = 'Drop Here';\n top = parseFloat( coordinatesElement.top ) + height/2 - 5;\n }\n wptbDropHandle.style.top = top + 'px';\n\n wptbDropBorderMarker.style.top = coordinatesElement.top + 'px';\n wptbDropBorderMarker.style.left = coordinatesElement.left + 'px';\n\n wptbDropBorderMarkerTop = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-top' );\n wptbDropBorderMarkerTop.style.width = ( parseFloat( thisElem.offsetWidth ) - parseFloat( 1 ) ) + 'px';\n\n wptbDropBorderMarkerRight = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-right' );\n wptbDropBorderMarkerRight.style.height = ( parseFloat( coordinatesElement.bottom ) - parseFloat( coordinatesElement.top ) - 1 ) + 'px';\n wptbDropBorderMarkerRight.style.left = wptbDropBorderMarkerTop.style.width;\n\n wptbDropBorderMarkerBottom = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-bottom' );\n wptbDropBorderMarkerBottom.style.width = wptbDropBorderMarkerTop.style.width;\n wptbDropBorderMarkerBottom.style.top = wptbDropBorderMarkerRight.style.height;\n\n wptbDropBorderMarkerLeft = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-left' );\n wptbDropBorderMarkerLeft.style.height = wptbDropBorderMarkerRight.style.height;\n}","var ElementCounters = function () {\n\n\tvar priv = [];\n\tpriv['text'] = 0;\n\tpriv['image'] = 0;\n\tpriv['list'] = 0;\n\tpriv['button'] = 0;\n\n\tthis.increment = function (key) {\n\t\tif (!(key in priv)) {\n\t\t\treturn;\n\t\t}\n\t\tpriv[key]++;\n\t}\n\n\tthis.nextIndex = function (key) {\n\t\tif (!(key in priv)) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn priv[key] + 1;\n\t}\n\n\treturn this;\n\n};","var WPTB_ElementObject = function ( data ) {\n let DOMElement, kindIndexProt, copy;\n if( ! data.elemProt ) {\n DOMElement = document.createElement('div'),\n kindIndexProt = undefined,\n copy = false;\n DOMElement.classList.add( 'wptb-' + data.kind + '-container', 'wptb-ph-element' );\n \n let wpTemplateId = 'wptb-' + data.kind + '-content';\n let template = wp.template( wpTemplateId );\n data.node = DOMElement;\n let itemHtml = template( data );\n\n itemHtml = itemHtml.replace(/\\r|\\n|\\t/g, '').trim();\n DOMElement.innerHTML = itemHtml;\n } else {\n DOMElement = data.elemProt.cloneNode( true );\n DOMElement.classList.remove( 'wptb-directlyhovered' );\n let wptbElementMutch = data.elemProt.className.match( /wptb-element-((.+-)\\d+)/i );\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\n kindIndexProt = wptbElementMutch[1];\n };\n copy = true;\n \n if( data.tinyMceClear ) {\n DOMElement = WPTB_Helper.elementClearFromTinyMce( DOMElement );\n }\n }\n \n let inElems = DOMElement.querySelectorAll( '.wptb-in-element' );\n if( inElems.length > 0 ) {\n for ( let i = 0; i < inElems.length; i++ ) {\n let inElemObj = {};\n inElemObj.getDOMElement = function() {\n return inElems[i];\n }\n \n applyGenericItemSettings( inElemObj );\n }\n }\n \n window.addEventListener( 'item:onmouseenter', function( event ) {\n //console.log( event );\n }, false);\n \n \n this.kind = data.kind;\n this.getDOMElement = function () {\n return DOMElement;\n };\n \n applyGenericItemSettings( this, kindIndexProt, copy );\n return this;\n}\n\n\n","var WPTB_ElementOptions = function ( element, index, kindIndexProt ) {\n\n var node = element.getDOMElement();\n node.addEventListener( 'click', function() {\n WPTB_Helper.elementOptionsSet( element.kind, this );\n }, {capture: true} );\n};","var WPTB_Helper = {\n hexToRgb: function( hex ) {\n var result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec( hex );\n return result ? 'rgb(' + parseInt( result[1], 16 ) + ',' + parseInt( result[2], 16 ) + ',' + parseInt( result[3], 16 ) + ')' : null;\n },\n rgbToHex: function ( rgb ) {\n if( rgb ) {\n if( WPTB_Helper.isHex( rgb ) ) return rgb;\n\n let rgbm = rgb.match(/^rgba?[\\s+]?\\([\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?((?:[0-9]*[.])?[0-9]+)[\\s+]?\\)/i);\n if ( rgbm && rgbm.length === 5) {\n return \"#\" +\n ('0' + Math.round(parseFloat(rgbm[4], 10) * 255).toString(16).toUpperCase()).slice(-2) +\n (\"0\" + parseInt(rgbm[1], 10).toString(16).toUpperCase()).slice(-2) +\n (\"0\" + parseInt(rgbm[2], 10).toString(16).toUpperCase()).slice(-2) +\n (\"0\" + parseInt(rgbm[3], 10).toString(16).toUpperCase()).slice(-2);\n } else {\n rgbm = rgb.match(/^rgba?[\\s+]?\\([\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?/i);\n if (rgbm && rgbm.length === 4) {\n return \"#\" +\n (\"0\" + parseInt(rgbm[1], 10).toString(16).toUpperCase()).slice(-2) +\n (\"0\" + parseInt(rgbm[2], 10).toString(16).toUpperCase()).slice(-2) +\n (\"0\" + parseInt(rgbm[3], 10).toString(16).toUpperCase()).slice(-2);\n } else {\n return '';\n }\n }\n } else {\n return '';\n }\n\n },\n isHex: function( hex ) {\n let regex = new RegExp('^#(?:[A-Fa-f0-9]{3}){1,2}$');\n return regex.test( hex );\n },\n getElementIcon: function ( icon_directory ) {\n let hostName = location.protocol + '//' + location.hostname;\n let img = document.createElement( 'img' );\n img.src = icon_directory;\n return img;\n },\n elementDragEndClear: function() {\n let wptbMovingMode = document.getElementsByClassName( 'wptb-moving-mode' );\n if ( wptbMovingMode.length > 0 ) {\n for( let i = 0; i < wptbMovingMode.length; i++ ) {\n wptbMovingMode[i].classList.remove( 'wptb-moving-mode' );\n }\n }\n\n let wptbDropHandles = document.getElementsByClassName( 'wptb-drop-handle' );\n if ( wptbDropHandles.length > 0 ) {\n for( let i = 0; i < wptbDropHandles.length; i++ ) {\n wptbDropHandles[i].style.display = 'none';\n }\n }\n\n let wptbDropBorderMarkers = document.getElementsByClassName( 'wptb-drop-border-marker' );\n if ( wptbDropBorderMarkers.length > 0 ) {\n for( let i = 0; i < wptbDropBorderMarkers.length; i++ ) {\n wptbDropBorderMarkers[i].style.display = 'none';\n }\n }\n },\n linkHttpCheckChange: function( link, convertToAbs = false ) {\n if ( link ) {\n // even though it is not a best practice and a huge security risk, sometimes our users use javascript tag at href attributes, this check will make sure those tags will not be modified and returned as they are\n if(link.match(/^(javascript:)(.+)$/)){\n return link;\n }\n // relative link checking\n // if link starts with '/', assume it is a relative link to the origin of the current site\n else if( link.match(/^\\/([\\S]+)$/) ){\n if (convertToAbs) {\n const currentLocation = document.location;\n let {origin} = currentLocation;\n\n\n // strip out the '/' at the end of the origin name if there is any\n if (origin.match(/^(.+)\\/$/)) {\n origin = origin.slice(-1);\n }\n\n return `${origin}${link}`;\n }else{\n return link;\n }\n }\n else if ( link.indexOf( 'http://' ) == -1 && link.indexOf( 'https://' ) == -1 ) {\n let linkArr = link.split( '/' ),\n linkClean;\n if ( Array.isArray( linkArr ) && linkArr.length > 0 ) {\n linkClean = linkArr[linkArr.length - 1];\n }\n return document.location.protocol + '//' + linkClean;\n } else { \n return link;\n }\n } else {\n return '';\n }\n },\n dataTitleColumnSet: function( table ) {\n let rows = table.rows,\n rowHead = rows[0];\n let computedStyleRowHead = getComputedStyle( rowHead );\n \n let rowHeadChildren = rowHead.children;\n let contentsForHeader = {};\n for( let i = 0; i < rowHeadChildren.length; i++ ) {\n let tdElements = rowHeadChildren[i].children;\n \n for( let j = 0; j < tdElements.length; j++ ) {\n let element = tdElements[j];\n if( element.classList.contains( 'wptb-ph-element' ) ) {\n let infArr = element.className.match( /wptb-element-(.+)-(\\d+)/i );\n if( infArr[1] == 'text' ) {\n let p = element.querySelector( 'p' ),\n textContent = p.textContent,\n textAlign = p.style.textAlign;\n contentsForHeader[rowHeadChildren[i].dataset.xIndex] = [textContent, element.style.fontSize, \n element.style.color, computedStyleRowHead.backgroundColor, textAlign];\n break;\n }\n }\n }\n if( ! contentsForHeader[rowHeadChildren[i].dataset.xIndex] ) {\n contentsForHeader[rowHeadChildren[i].dataset.xIndex] = ['', '', \n '', computedStyleRowHead.backgroundColor, ''];\n }\n }\n for ( let i = 1; i < rows.length; i++ ) {\n let thisRow = rows[i],\n thisRowChildren = thisRow.children;\n for( let j = 0; j < thisRowChildren.length; j++ ) {\n if ( contentsForHeader[thisRowChildren[j].dataset.xIndex] ) {\n thisRowChildren[j].dataset.wptbTitleColumn = contentsForHeader[thisRowChildren[j].dataset.xIndex][0];\n thisRowChildren[j].dataset.wptbTitleColumnFontSize = contentsForHeader[thisRowChildren[j].dataset.xIndex][1];\n thisRowChildren[j].dataset.wptbTitleColumnColor = contentsForHeader[thisRowChildren[j].dataset.xIndex][2];\n thisRowChildren[j].dataset.wptbTitleBackgroundColor = contentsForHeader[thisRowChildren[j].dataset.xIndex][3];\n thisRowChildren[j].dataset.wptbTitleAlign = contentsForHeader[thisRowChildren[j].dataset.xIndex][4];\n } else {\n thisRowChildren[j].dataset.wptbTitleColumn = '';\n thisRowChildren[j].dataset.wptbTitleColumnFontSize = '';\n thisRowChildren[j].dataset.wptbTitleColumnColor = '';\n thisRowChildren[j].dataset.wptbTitleBackgroundColor = '';\n thisRowChildren[j].dataset.wptbTitleAlign = '';\n }\n }\n }\n },\n findAncestor: function( el, cls ) {\n while ( ( el = el.parentElement ) && !el.classList.contains( cls ) );\n return el;\n },\n rowIsTop: function( row ) {\n var parent = row.parentNode;\n if( parent.children[0] == row ) {\n return true;\n } else {\n return false;\n }\n },\n getSelectionText: function() {\n var txt = '';\n if (txt = window.getSelection) {\n txt = window.getSelection().toString();\n } else {\n txt = document.selection.createRange().text;\n }\n return txt;\n },\n elementOptionsPanelClear: function() {\n let elementOptionsGroup = document.getElementById( 'element-options-group' );\n if( elementOptionsGroup ) {\n elementOptionsGroup.innerHTML = '';\n }\n },\n wpColorPickerCheckChangeForTableStateSaving: function( event ) {\n if( event.originalEvent.type == 'external' ) {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n } else {\n let wpPickerContainer = WPTB_Helper.findAncestor( event.target, 'wp-picker-container' );\n if( wpPickerContainer ) {\n if( event.originalEvent.type == 'square' || event.originalEvent.type == 'strip' ) {\n let body = document.getElementsByTagName( 'body' )[0];\n body.removeEventListener( 'mouseup', WPTB_Helper.irisStripMouseUpStateSaveManager, false );\n body.addEventListener( 'mouseup', WPTB_Helper.irisStripMouseUpStateSaveManager, false );\n }\n }\n }\n },\n irisStripMouseUpStateSaveManager: function() {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n \n let body = document.getElementsByTagName( 'body' )[0];\n body.removeEventListener( 'mouseup', WPTB_Helper.irisStripMouseUpStateSaveManager, false );\n },\n wpColorPickerClear: function( attribute, isId ) {\n let input;\n if( isId ) {\n input = [document.getElementById( attribute )];\n input.length = 1;\n } else {\n input = document.getElementsByClassName( attribute );\n }\n for( let i = 0; i < input.length; i++ ) {\n let wpPickerContainer = WPTB_Helper.findAncestor( input[i], 'wp-picker-container' );\n if( wpPickerContainer ) {\n let parent = wpPickerContainer.parentNode;\n parent.removeChild( wpPickerContainer );\n let newInput = document.createElement( 'input' );\n if( isId ) {\n newInput.setAttribute( 'id', attribute );\n } else {\n newInput.classList.add( 'wptb-element-property', attribute );\n }\n newInput.value = \"\";\n parent.appendChild( newInput );\n }\n }\n },\n detectMode: function() {\n var url = window.location.href,\n regex = new RegExp('[?&]table(=([^&#]*)|&|#|$)'),\n results = regex.exec(url);\n if ( ! results ) return false;\n if ( ! results[2] ) return '';\n return decodeURIComponent( results[2].replace(/\\+/g, ' ') );\n },\n getColumnWidth: function( table, cell ) {\n let xIndex = cell.dataset.xIndex;\n let xIndexes = table.querySelectorAll( '[data-x-index=\"' + xIndex + '\"]' );\n let cellWidth = cell.getCellDimensions().width;\n for( let i = 0; i < xIndexes.length; i++ ) {\n if( cellWidth > xIndexes[i].getCellDimensions().width ) {\n cellWidth = xIndexes[i].getCellDimensions().width;\n }\n }\n return cellWidth;\n },\n getRowHeight: function( table, cell ) {\n let yIndex = cell.dataset.yIndex;\n let yIndexes = table.querySelectorAll( '[data-y-index=\"' + yIndex + '\"]' );\n let cellHeight = cell.getCellDimensions().height;\n for( let i = 0; i < yIndexes.length; i++ ) {\n if( cellHeight > yIndexes[i].getCellDimensions().height ) {\n cellHeight = yIndexes[i].getCellDimensions().height;\n }\n }\n return cellHeight;\n },\n newElementProxy: function( el ) {\n if( el ) {\n let data = {kind: el};\n return new WPTB_ElementObject( data );\n }\n },\n wpColorPickerChange: function( event, ui ) {\n let uiColor;\n if( ui ) {\n uiColor = ui.color.toString();\n } else {\n uiColor = '';\n }\n \n let parent = WPTB_Helper.findAncestor( event.target, 'wp-picker-input-wrap' ).getElementsByClassName( 'wptb-color-picker' )[0], classe, type, ps, number;\n classe = parent.dataset.element.match(/wptb-options-(.+)-(\\d+)/i);\n type = classe[1];\n number = classe[2];\n let affectedEl = document.getElementsByClassName( 'wptb-element-' + type + '-' + number )[0];\n if ( type == 'button' ) {\n if ( parent.dataset.type == 'button-text-color' ) {\n affectedEl.getElementsByClassName( 'wptb-button' )[0].style.color = uiColor;\n } else {\n affectedEl.getElementsByClassName( 'wptb-button' )[0].style.backgroundColor = uiColor;\n }\n } else if( type == 'list' ) {\n let ps = affectedEl.querySelectorAll( 'p' );\n if( ps.length > 0 ) {\n for ( let i = 0; i < ps.length; i++ ) {\n ps[i].style.color = uiColor;\n }\n }\n } else if( type == 'star_rating' ) {\n if ( parent.dataset.type == 'star-color' ) {\n let ratingStar = affectedEl.querySelectorAll('li');\n for( let i = 0; i < ratingStar.length; i++ ) {\n let span = ratingStar[i].getElementsByTagName( 'span' );\n for( let j = 0; j < span.length; j++ ) {\n span[j].style.fill = uiColor;\n }\n }\n } else if( parent.dataset.type == 'numeral-rating-color' ) {\n let wptbTextMessageSize = affectedEl.querySelector('.wptb-number-rating');\n wptbTextMessageSize.style.color = uiColor;\n }\n\n } else {\n affectedEl.style.color = uiColor;\n }\n },\n numberImputSize: function ( wptbNumberInputs, maxCount, maxValue ) {\n wptbNumberInputs.onkeydown = function() {\n let thisValue = this.value;\n thisValue = String( thisValue );\n if ( thisValue[0] == 0 ) {\n this.value = \"\";\n } else {\n thisValue = thisValue.substring( 0, maxCount );\n this.value = thisValue;\n }\n }\n wptbNumberInputs.onkeyup = function( ) {\n let thisValue = this.value;\n if ( parseInt( thisValue, 10 ) > parseInt( maxValue, 10 ) ) {\n this.value = maxValue;\n }\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n },\n ucfirst: function( str ) {\n return str.charAt(0).toUpperCase() + str.slice(1);\n },\n wptbDocumentEventGenerate: function( eventName, element, details ) {\n if( eventName && element ) {\n if( ! details ) {\n details = true;\n }\n let event = new CustomEvent( eventName, { detail: details, bubbles: true } );\n element.dispatchEvent( event );\n }\n },\n // run script for the pointed element\n elementStartScript: function( element, kind ) {\n //let script = element.getElementsByTagName( 'script' );\n if(!kind) {\n let infArr = element.className.match(/wptb-element-(.+)-(\\d+)/i);\n if( infArr && Array.isArray( infArr ) ) {\n kind = infArr[1];\n }\n }\n\n if( kind ) {\n// let wpTemplateId = 'wptb-' + kind + '-script';\n// let template = wp.template( wpTemplateId );\n// let data = {elemClass: infArr[0]};\n// let elementScriptText = template( data );\n// elementScriptText = elementScriptText.replace(/\\r|\\n|\\t/g, '').trim();\n//\n// let scriptNew = document.createElement( 'script' );\n// scriptNew.setAttribute( 'type', 'text/javascript' );\n// scriptNew.innerHTML = elementScriptText;\n// element.parentNode.appendChild( scriptNew );\n\n// element.parentNode.removeChild( scriptNew );\n if( kind in WPTB_ElementsScriptsLauncher ) {\n WPTB_ElementsScriptsLauncher[kind]( element );\n }\n }\n },\n // deletes event handlers from the pointed option element and from all his daughter elements\n deleteEventHandlers: function( element ) {\n if( element ) {\n jQuery( element ).off();\n let elementChildren = element.children;\n if( elementChildren ) {\n for ( let i = 0; i < elementChildren.length; i++ ) {\n WPTB_Helper.deleteEventHandlers( elementChildren[i] );\n }\n }\n } else {\n return;\n }\n },\n // replace all occurrences in a string\n replaceAll: function( string, search, replace ){\n return string.split( search ).join( replace );\n },\n // clears code from TinyMCE attributes\n elementClearFromTinyMce: function( element ) {\n let mceContentBodys = element.querySelectorAll( '.mce-content-body' );\n if( mceContentBodys.length > 0 ) {\n for ( let k = 0; k < mceContentBodys.length; k++ ) {\n mceContentBodys[k].classList.remove( 'mce-content-body' );\n }\n }\n\n let dataMceStyle = element.querySelectorAll( '[data-mce-style]' );\n if ( dataMceStyle.length > 0 ) {\n for ( let k = 0; k < dataMceStyle.length; k++ ) {\n dataMceStyle[k].removeAttribute( 'data-mce-style' );\n }\n }\n \n let mceEditFocus = element.querySelectorAll( '.mce-edit-focus' );\n if( mceEditFocus.length > 0 ) {\n for ( let k = 0; k < mceEditFocus.length; k++ ) {\n mceEditFocus[k].classList.remove( 'mce-edit-focus' );\n }\n }\n\n let contentEditable = element.querySelectorAll( '[contenteditable]' );\n if ( contentEditable.length > 0 ) {\n for ( let k = 0; k < contentEditable.length; k++ ) {\n contentEditable[k].removeAttribute( 'contenteditable' );\n }\n }\n\n let spellCheck = element.querySelectorAll( '[spellcheck]' );\n if ( spellCheck.length > 0 ) {\n for ( let k = 0; k < spellCheck.length; k++ ) {\n spellCheck[k].removeAttribute( 'spellcheck' );\n }\n }\n\n let mceIds = element.querySelectorAll( '[id^=mce_]' );\n if ( mceIds.length > 0 ) {\n for ( let k = 0; k < mceIds.length; k++ ) {\n mceIds[k].removeAttribute( 'id' );\n }\n }\n \n return element;\n },\n elementOptionContainerCustomClassSet: function( targetInput, customClassForContainer ) {\n if( targetInput && customClassForContainer ) {\n let containerElement = WPTB_Helper.findAncestor( targetInput, 'wptb-element-option' );\n if( containerElement ) {\n containerElement.classList.add( customClassForContainer );\n }\n }\n },\n elementOptionContainerAdditionalStyles: function( targetInput, containerAdditionalStyles ) {\n if( targetInput && containerAdditionalStyles ) {\n let containerElement = WPTB_Helper.findAncestor( targetInput, 'wptb-element-option' );\n let containerStylesArrOne = containerAdditionalStyles.split( ';' );\n\n if( containerElement && containerStylesArrOne ) {\n function containerStylesSet( containerStyleStr, containerElement ) {\n if( containerStyleStr ) {\n containerStyleStrArr = containerStyleStr.split( ':' );\n\n if( containerStyleStrArr && Array.isArray( containerStyleStrArr ) ) {\n containerElement.style[containerStyleStrArr[0]] = containerStyleStrArr[1];\n }\n }\n }\n if( containerStylesArrOne && Array.isArray( containerStylesArrOne ) ) {\n for( let i = 0; i < containerStylesArrOne.length; i++ ) {\n if( containerStylesArrOne[i] ) {\n containerStylesSet( containerStylesArrOne[i], containerElement );\n }\n }\n } else {\n containerStylesSet( containerStylesArrOne, containerElement );\n }\n }\n }\n },\n // function which set handler for event of changes of control\n controlsInclude: function( element, functionHandler ) {\n if( element && typeof element === 'object' && functionHandler && typeof functionHandler === 'function' ) {\n element.addEventListener( 'element:controls:active', function() {\n if(!element.hasOwnProperty('controlConnectFunctionsName') ||\n !Array.isArray(element.controlConnectFunctionsName) ||\n element.controlConnectFunctionsName.indexOf(functionHandler.name) == -1) {\n let infArr = element.className.match( /wptb-element-(.+)-(\\d+)/i ),\n elementKind;\n\n if( infArr && Array.isArray( infArr ) ) {\n elementKind = infArr[1];\n }\n\n// if( ! element.hasOwnProperty( 'сontrolsConnectIndic' ) || element.сontrolsConnectIndic !== true && elementKind ) {\n// let elementsSettingsTemplateJs = document.getElementsByClassName( 'wptb-element-datas' );\n// if( elementsSettingsTemplateJs.length > 0 ) {\n// elementsSettingsTemplateJs = elementsSettingsTemplateJs[0];\n//\n// let elementsSettings = elementsSettingsTemplateJs.innerHTML;\n// let controlClassesNames = [];\n// if( elementsSettings ) {\n// elementsSettings = elementsSettings.trim();\n// elementsSettings = JSON.parse( elementsSettings );\n// if( elementsSettings && typeof elementsSettings === 'object' ) {\n// if( 'tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2] in elementsSettings ) {\n// let elementSettings = elementsSettings['tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2]];\n// if( elementSettings && typeof elementSettings === 'object' ) {\n// Object.keys( elementSettings ).forEach( function( key ) {\n// let regularText = new RegExp( 'data-wptb-el-' + elementKind + '-(\\\\d+)-([a-zA-Z0-9_-]+)', \"i\" );\n// let keyInfArr = key.match( regularText );\n// if( keyInfArr && Array.isArray( keyInfArr ) ) {\n// let controlClass = key.replace( 'data-', '' );\n// controlClassesNames.push( [controlClass, keyInfArr[2]] );\n// }\n// });\n// }\n// }\n// }\n// }\n// }\n// }\n if( elementKind ){\n let elementOptionsContainer = document.querySelector( '.wptb-element-options.wptb-options-' + infArr[1] + '-' + infArr[2] );\n\n // from time to time depend on table cells hierarchy, cell td items may catch mouse clicks which are intended for elements. since the active section is not cell management, this will gives and unharmfull error of not found element, simple check for null equality will be sufficient for now.\n if(!elementOptionsContainer){\n return;\n }\n\n let elementOptions = elementOptionsContainer.querySelectorAll( '.wptb-element-option' );\n\n\n for( let i = 0; i < elementOptions.length; i++ ) {\n let controlActiveElement = elementOptions[i].querySelector( '.wptb-element-property' );\n if( controlActiveElement ) {\n let regularText = new RegExp( 'wptb-el-' + elementKind + '-(\\\\d+)-([a-zA-Z0-9_-]+)', \"i\" );\n let controlInfArr = controlActiveElement.className.match( regularText );\n if( controlInfArr && Array.isArray( controlInfArr ) ) {\n let controlUnicClassName = controlInfArr[0];\n\n element.addEventListener( 'wptb-control:' + controlUnicClassName, function() {\n let controls = {};\n let controlName = controlInfArr[2];\n let control = document.getElementsByClassName( controlUnicClassName );\n if( control.length > 0 && controlName ) {\n let targetControlValue = WPTB_Helper.targetControlValueGet( control );\n\n controls[controlName] = targetControlValue;\n }\n\n functionHandler( controls, element );\n }, false );\n }\n }\n }\n \n if(!element.controlConnectFunctionsName && !Array.isArray(element.controlConnectFunctionsName)) {\n element.controlConnectFunctionsName = [];\n }\n\n element.controlConnectFunctionsName.push( functionHandler.name );\n }\n }\n }, false );\n }\n },\n oneControlInclude: function( element, functionHandler, controlName ) {\n if( element && typeof element === 'object' && typeof functionHandler === 'function' && typeof controlName === 'string' ) {\n let infArr = element.className.match( /wptb-element-((.+-)\\d+)/i ),\n elementKind;\n \n if( infArr && Array.isArray( infArr ) ) {\n elementKind = infArr[1].split( '-' )[0];\n \n let wptbContrlStacksConfigId = 'wptb-' + elementKind + '-control-stack';\n let tmplControlsConfig = wp.template( wptbContrlStacksConfigId );\n let data = {\n container: '.' + infArr[0]\n };\n let jsonControlsConfigJson = tmplControlsConfig( data );\n let jsonControlsConfig = JSON.parse( jsonControlsConfigJson );\n \n if( jsonControlsConfig && typeof jsonControlsConfig === 'object' && jsonControlsConfig.hasOwnProperty( controlName ) ) {\n let controlClassName = 'wptb-el-' + infArr[1] + '-' + controlName;\n \n element.addEventListener( 'wptb-control:' + controlClassName, function( event ) {\n let control = document.getElementsByClassName( controlClassName );\n if( control.length > 0 ) {\n let targetControlValue = WPTB_Helper.targetControlValueGet( control );\n\n functionHandler( targetControlValue, element );\n }\n }, false );\n }\n }\n } else {\n return false;\n }\n },\n //\n innerElementCopyIncludeHandler: function( element, functionHandler ) {\n if( element && typeof element === 'object' && typeof functionHandler === 'function' ) {\n element.addEventListener( 'wptb-inner-element:copy', function( event ) {\n let innerElement = event.detail;\n if( innerElement ) {\n WPTB_Helper.elementClearFromTinyMce( innerElement );\n functionHandler( innerElement, element );\n }\n }, false );\n }\n },\n //\n appearDependOnControl: function( dependOn, targetControlElementClass ) {\n if( Array.isArray( dependOn ) ) {\n let dependOnControlName = dependOn[0];\n let infArr = targetControlElementClass.match( /wptb-el-((.+-)\\d+)-(.+)/i );\n \n if( infArr && Array.isArray( infArr ) ) {\n let controlName = infArr[3];\n\n let dependOnControlElementClass = targetControlElementClass.replace( controlName, dependOnControlName );\n\n let dependOnControlElement = document.getElementsByClassName( dependOnControlElementClass );\n\n if( dependOnControlElement.length > 0 ) {\n dependOnControlElement = dependOnControlElement[0];\n let targetControlElement = document.getElementsByClassName( targetControlElementClass );\n if( targetControlElement.length > 0 ) {\n targetControlElement = targetControlElement[0];\n let controlContainerElem = WPTB_Helper.findAncestor( targetControlElement, 'wptb-element-option' );\n\n if( controlContainerElem ) {\n function showHideDependOnControlElement( dependOnControlElementClass, dependOn ) {\n \n// let elementsSettingsTemplateJs = document.getElementsByClassName( 'wptb-element-datas' );\n// if( elementsSettingsTemplateJs.length > 0 ) {\n// elementsSettingsTemplateJs = elementsSettingsTemplateJs[0];\n//\n// let elementsSettings = elementsSettingsTemplateJs.innerHTML;\n// if( elementsSettings ) {\n// elementsSettings = elementsSettings.trim();\n// elementsSettings = JSON.parse( elementsSettings );\n// if( elementsSettings && typeof elementsSettings === 'object' && \n// ( 'tmpl-wptb-el-datas-' + dependOnControlElementKind ) in elementsSettings ) {\n// let elementSettings = elementsSettings['tmpl-wptb-el-datas-' + dependOnControlElementKind];\n// if( elementSettings && typeof elementSettings === 'object' && \n// ( 'data-wptb-el-' + dependOnControlElementKind + '-' + dependOnControlName ) in elementSettings ) {\n// let elementSettingValue = elementSettings['data-wptb-el-' + dependOnControlElementKind + '-' + dependOnControlName];\n// \n// if( elementSettingValue ) {\n// if( dependOn[1] && Array.isArray( dependOn[1] ) && \n// ( dependOn[1].indexOf( elementSettingValue ) !== -1 ) ) {\n// controlContainerElem.style.display = 'block';\n// } else if( dependOn[2] && Array.isArray( dependOn[2] ) && \n// ( dependOn[2].indexOf( elementSettingValue ) !== -1 ) ) {\n// controlContainerElem.style.display = 'none';\n// }\n// }\n// }\n// }\n// }\n// }\n if( dependOnControlElementClass ) {\n let dependOnControlElements = document.getElementsByClassName( dependOnControlElementClass );\n if( dependOnControlElements.length > 0 ) {\n let targetControlValue = WPTB_Helper.targetControlValueGet( dependOnControlElements );\n \n if( dependOn[1] && Array.isArray( dependOn[1] ) && \n ( dependOn[1].indexOf( targetControlValue ) !== -1 ) ) {\n controlContainerElem.style.display = 'block';\n } else if( dependOn[2] && Array.isArray( dependOn[2] ) && \n ( dependOn[2].indexOf( targetControlValue ) !== -1 ) ) {\n controlContainerElem.style.display = 'none';\n }\n }\n }\n }\n\n showHideDependOnControlElement( dependOnControlElementClass, dependOn );\n\n dependOnControlElement.addEventListener( 'change', function( event ) {\n showHideDependOnControlElement( dependOnControlElementClass, dependOn );\n }, false );\n }\n }\n }\n }\n }\n },\n //\n controlsStateManager: function ( targetControlClass, controlChangeIndic ) {\n let targetControls = document.getElementsByClassName( targetControlClass );\n if( targetControls.length > 0 ) {\n //targetControls = targetControls[0];\n \n let infArr = targetControlClass.match( /wptb-el-((.+-)\\d+)-(.+)/i );\n \n if( infArr && Array.isArray( infArr ) ) {\n let selectorElement;\n selectorElement = document.querySelector( '.wptb-element-' + infArr[1] );\n \n if( selectorElement ) {\n let elementsSettingsTemplatesJs;\n let elementSettings = {};\n let elementsSettings;\n elementsSettingsTemplatesJs = document.getElementsByClassName( 'wptb-element-datas' );\n if( elementsSettingsTemplatesJs.length == 0 || elementsSettingsTemplatesJs[0].innerHTML == '' ) {\n let targetControlValue = WPTB_Helper.targetControlValueGet( targetControls );\n elementSettings['data-' + targetControlClass] = targetControlValue;\n\n elementsSettings = {};\n elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] = elementSettings;\n elementsSettings = JSON.stringify( elementsSettings );\n\n if( elementsSettingsTemplatesJs.length == 0 ) {\n elementsSettingsTemplatesJs = document.createElement( 'script' );\n elementsSettingsTemplatesJs.setAttribute( 'type', 'text/html' );\n elementsSettingsTemplatesJs.setAttribute( 'class', 'wptb-element-datas' );\n } else {\n elementsSettingsTemplatesJs = elementsSettingsTemplatesJs[0];\n }\n\n elementsSettingsTemplatesJs.innerHTML = elementsSettings;\n\n let body = document.getElementsByTagName('body')[0];\n body.appendChild( elementsSettingsTemplatesJs );\n } else {\n elementsSettingsTemplatesJs = elementsSettingsTemplatesJs[0];\n elementsSettings = elementsSettingsTemplatesJs.innerHTML;\n if( elementsSettings ) {\n elementsSettings = elementsSettings.trim();\n elementsSettings = JSON.parse( elementsSettings );\n\n if( elementsSettings && typeof elementsSettings === 'object' ) {\n \n \n if( controlChangeIndic ) {\n let targetControlValue = WPTB_Helper.targetControlValueGet( targetControls );\n if( ! ( ( 'tmpl-wptb-el-datas-' + infArr[1] ) in elementsSettings ) || \n typeof elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] !== 'object') {\n elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] = {};\n }\n elementsSettings['tmpl-wptb-el-datas-' + infArr[1]]['data-' + targetControlClass] = targetControlValue;\n elementsSettingsTemplatesJs.innerHTML = JSON.stringify( elementsSettings );\n } else if( ! ( ( ( 'tmpl-wptb-el-datas-' + infArr[1] ) in elementsSettings ) && \n typeof elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] === 'object' && \n ( 'data-' + targetControlClass ) in elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] ) ) {\n let targetControlValue = WPTB_Helper.targetControlValueGet( targetControls );\n if( ! ( ( 'tmpl-wptb-el-datas-' + infArr[1] ) in elementsSettings ) || \n typeof elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] !== 'object') {\n elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] = {};\n }\n elementsSettings['tmpl-wptb-el-datas-' + infArr[1]]['data-' + targetControlClass] = targetControlValue;\n elementsSettingsTemplatesJs.innerHTML = JSON.stringify( elementsSettings );\n } else if( ( ( 'tmpl-wptb-el-datas-' + infArr[1] ) in elementsSettings ) && \n typeof elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] === 'object' && \n ( 'data-' + targetControlClass ) in elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] ) {\n for( let i = 0; i < targetControls.length; i++ ) {\n if( targetControls[i].type == 'checkbox' ) {\n let targetControlValue;\n if( targetControls[i].name ) {\n targetControlValue = elementsSettings['tmpl-wptb-el-datas-' + infArr[1]]['data-' + targetControlClass][targetControls[i].name];\n } else {\n targetControlValue = elementsSettings['tmpl-wptb-el-datas-' + infArr[1]]['data-' + targetControlClass];\n }\n \n if( targetControlValue == 'checked' ) {\n targetControls[i].checked = true;\n } else if( targetControlValue == 'unchecked' ) {\n targetControls[i].checked = false;\n }\n } else {\n targetControls[i].value = elementsSettings['tmpl-wptb-el-datas-' + infArr[1]]['data-' + targetControlClass];\n }\n }\n }\n }\n }\n }\n }\n }\n }\n },\n //\n targetControlValueGet: function( targetControls ) {\n let targetControlValue;\n for( let i = 0; i < targetControls.length; i++ ) {\n if( targetControls[i].type == 'checkbox' && targetControls[i].name ) {\n if( ! targetControlValue ) targetControlValue = {};\n if( targetControls[i].checked == true ) {\n targetControlValue[targetControls[i].name] = 'checked';\n } else {\n targetControlValue[targetControls[i].name] = 'unchecked';\n }\n } else if( targetControls[i].type == 'checkbox' ) {\n if( targetControls[i].checked == true ) {\n targetControlValue = 'checked';\n } else {\n targetControlValue = 'unchecked';\n }\n } else if( targetControls[i].type ) {\n targetControlValue = targetControls[i].value;\n } else if( targetControls[i].dataset.alignmentValue && targetControls[i].classList.contains( 'selected' ) ){\n targetControlValue = targetControls[i].dataset.alignmentValue;\n }\n }\n return targetControlValue;\n },\n //\n elementControlsStateCopy: function( elementProt, copyElem ) {\n if( elementProt && copyElem ) {\n let infArrProt = elementProt.className.match( /wptb-element-((.+-)\\d+)/i );\n let infArrCopy = copyElem.className.match( /wptb-element-((.+-)\\d+)/i );\n if( infArrProt && Array.isArray( infArrProt ) &&\n infArrCopy && Array.isArray( infArrCopy )) {\n let elemProtKind = infArrProt[1];\n let elemCopyKind = infArrCopy[1];\n let elementsSettingsTemplateJs = document.getElementsByClassName( 'wptb-element-datas' );\n if( elementsSettingsTemplateJs.length > 0 ) {\n elementsSettingsTemplateJs = elementsSettingsTemplateJs[0];\n \n let elementsSettings = elementsSettingsTemplateJs.innerHTML;\n if( elementsSettings ) {\n elementsSettings = elementsSettings.trim();\n elementsSettings = JSON.parse( elementsSettings );\n \n if( elementsSettings && typeof elementsSettings === 'object' ) {\n let elementSettingsProt = elementsSettings['tmpl-wptb-el-datas-' + elemProtKind];\n if( elementSettingsProt && typeof elementSettingsProt === 'object' ) {\n let elementSettingsCopy = {};\n \n Object.keys( elementSettingsProt ).forEach( function( key ) {\n let elementSettingValue = elementSettingsProt[key];\n let elementSettingKeyCopy = key.replace( elemProtKind, elemCopyKind );\n elementSettingsCopy[elementSettingKeyCopy] = elementSettingValue;\n });\n \n if( Object.keys( elementSettingsCopy ).length > 0 ) {\n elementsSettings['tmpl-wptb-el-datas-' + elemCopyKind] = elementSettingsCopy;\n \n elementsSettings = JSON.stringify( elementsSettings );\n elementsSettingsTemplateJs.innerHTML = elementsSettings;\n }\n }\n }\n }\n }\n }\n }\n },\n //\n elementControlsStateDelete: function( element, nameControl ) {\n let infArr = element.className.match( /wptb-element-(.+)-(\\d+)/i );\n let body = document.getElementsByTagName( 'body' )[0];\n let wptbElementDatas = body.getElementsByClassName( 'wptb-element-datas' );\n if( infArr && Array.isArray( infArr ) && wptbElementDatas.length > 0 ) {\n wptbElementDatas = wptbElementDatas[0];\n let elementsSettings = wptbElementDatas.innerHTML;\n if( elementsSettings ) {\n elementsSettings = elementsSettings.trim();\n elementsSettings = JSON.parse( elementsSettings );\n if( elementsSettings && typeof elementsSettings === 'object' &&\n ( ( 'tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2] ) in elementsSettings ) ) {\n if( ! nameControl ) {\n delete elementsSettings['tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2]];\n } else {\n if( elementsSettings['tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2]] && \n typeof elementsSettings['tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2]] === 'object' &&\n ( 'data-wptb-el-' + infArr[1] + '-' + infArr[2] + '-' + nameControl ) in elementsSettings['tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2]] ) {\n delete elementsSettings['tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2]]['data-wptb-el-' + infArr[1] + '-' + infArr[2] + '-' + nameControl];\n }\n }\n\n if( Object.keys( elementsSettings ).length == 0 ) {\n body.removeChild( wptbElementDatas );\n } else {\n elementsSettings = JSON.stringify( elementsSettings );\n wptbElementDatas.innerHTML = elementsSettings;\n }\n }\n }\n }\n },\n // \n elementOptionsSet: function( kind, element ) {\n // get controls config for this element\n let wptbContrlStacksConfigId = 'wptb-' + kind + '-control-stack';\n let tmplControlsConfig = wp.template( wptbContrlStacksConfigId );\n let data;\n let elementContainerClass;\n let elementOptionClassIndic;\n let elementOptionsGroup;\n let elementOptionsGroupId;\n let wptbelementOptionClass;\n \n // create containers for inserting controls of this item and their scripts\n let wptbelementOptionsContainer = document.createElement( 'div' );\n let wptbelementOptionsScriptsContainer = document.createElement( 'div' );\n \n let infArr = element.className.match( /wptb-element-((.+-)\\d+)/i );\n if( ! infArr ) {\n let table_id = WPTB_Helper.detectMode();\n if (!table_id) {\n table_id = 'startedid-0';\n }\n if( element.classList.contains( 'wptb-preview-table' ) ) {\n element.classList.add( 'wptb-element-main-table_setting-' + table_id );\n } else if( element.classList.contains( 'wptb-cell' ) ) {\n let cellEditActiveClass = document.querySelector( '.wptb-element-table_cell_setting-' + table_id );\n if( cellEditActiveClass ) cellEditActiveClass.classList.remove( 'wptb-element-table_cell_setting-' + table_id );\n element.classList.add( 'wptb-element-table_cell_setting-' + table_id );\n }\n\n infArr = element.className.match( /wptb-element-((.+-)\\d+)/i );\n }\n\n data = {\n container: '.' + infArr[0]\n };\n\n elementContainerClass = infArr[0];\n elementOptionClassIndic = infArr[1];\n \n if( element.classList.contains( 'wptb-preview-table' ) ) {\n elementOptionsGroupId = 'table-settings-group';\n wptbelementOptionClass = 'wptb-element-option';\n } else if( element.classList.contains( 'wptb-cell' ) ) {\n elementOptionsGroupId = 'element-cell-options-group';\n wptbelementOptionClass = 'wptb-element-option';\n\n this.activateSection('cell_settings');\n } else {\n let children = document.getElementById( 'element-options-group' ).childNodes;\n for ( let i = 0; i < children.length; i++) {\n if ( children[i].style )\n children[i].style.display = 'none';\n }\n\n // hide wptb-elements-container and wptb-settings-section\n // document.getElementsByClassName( 'wptb-elements-container' )[0].style.display = 'none';\n // document.getElementsByClassName( 'wptb-settings-section' )[0].style.display = 'none';\n\n // show element-options-group\n // document.getElementById( 'element-options-group' ).style.display = 'block';\n this.activateSection('options_group');\n\n elementOptionsGroupId = 'element-options-group';\n wptbelementOptionClass = 'wptb-element-option';\n }\n \n wptbelementOptionsContainer.classList.add( 'wptb-element-options', 'wptb-options-' + infArr[1] );\n wptbelementOptionsScriptsContainer.classList.add( 'wptb-element-options-scripts', 'wptb-options-' + infArr[1] );\n\n let jsonControlsConfigJson = tmplControlsConfig( data );\n let jsonControlsConfig = JSON.parse( jsonControlsConfigJson );\n\n // clear elements from options group\n //document.getElementById( 'element-options-group' ).innerHTML = '';\n elementOptionsGroup = document.getElementById( elementOptionsGroupId );\n let elementOptionsGroupChildren = [...elementOptionsGroup.children];\n for( let i = 0; i < elementOptionsGroupChildren.length; i++ ) {\n elementOptionsGroup.removeChild( elementOptionsGroupChildren[i] );\n }\n\n \n // insert created container into element-option-group tag\n document.getElementById( elementOptionsGroupId ).appendChild( wptbelementOptionsContainer );\n document.getElementById( elementOptionsGroupId ).appendChild( wptbelementOptionsScriptsContainer );\n\n // show created container\n wptbelementOptionsContainer.style.display = 'block';\n \n // array for save all scrips for each controls\n let controlScriptsArr = [];\n\n // array for keep \"appear depend on\" parametrs\n let controlappearDependOnControl = [];\n\n // create controls\n let i = 0;\n Object.keys( jsonControlsConfig ).forEach( function( key ) {\n let data = jsonControlsConfig[key];\n data.controlKey = key;\n\n // get necessary wp js template\n let tmplControlTemplate = wp.template( 'wptb-' + data.type + '-control' );\n\n data.elemContainer = elementContainerClass;\n data.elementControlTargetUnicClass = 'wptb-el-' + elementOptionClassIndic + '-' + data.controlKey;\n let controlTemplate = tmplControlTemplate( data );\n\n if( 'appearDependOnControl' in data ) {\n if( Array.isArray( data.appearDependOnControl ) ) {\n controlappearDependOnControl.push( [data.appearDependOnControl, data.elementControlTargetUnicClass] );\n }\n }\n\n let wptbElementOptionContainer = document.createElement( 'div' );\n wptbElementOptionContainer.classList.add( wptbelementOptionClass, 'wptb-settings-items' );\n\n if( data.customClassForContainer ) {\n wptbElementOptionContainer.classList.add( data.customClassForContainer );\n }\n\n if( data.containerAdditionalStyles ) {\n wptbElementOptionContainer.setAttribute( 'style', data.containerAdditionalStyles );\n }\n\n wptbElementOptionContainer.innerHTML = controlTemplate;\n\n wptbelementOptionsContainer.appendChild( wptbElementOptionContainer );\n\n let helperJavascriptElem = wptbElementOptionContainer.getElementsByTagName( 'wptb-template-script' );\n if( helperJavascriptElem.length > 0 ) {\n helperJavascriptElem = helperJavascriptElem[0];\n let helperJavascriptCode = helperJavascriptElem.innerText;\n wptbElementOptionContainer.removeChild( helperJavascriptElem );\n let script = document.createElement( 'script' );\n script.setAttribute( 'type', 'text/javascript' );\n script.innerHTML = helperJavascriptCode.replace(/\\r|\\n|\\t/g, '').trim();\n controlScriptsArr.push( script );\n }\n\n i++;\n });\n\n // run the scripts of controls\n if( controlScriptsArr.length > 0 ) {\n for( let i = 0; i < controlScriptsArr.length; i++ ) {\n wptbelementOptionsScriptsContainer.appendChild( controlScriptsArr[i] );\n }\n }\n\n // run appearDependOnControl function\n for ( let i = 0; i < controlappearDependOnControl.length; i++ ) {\n WPTB_Helper.appearDependOnControl( controlappearDependOnControl[i][0], controlappearDependOnControl[i][1] );\n }\n\n WPTB_Helper.wptbDocumentEventGenerate( 'element:controls:active', element );\n },\n // function for create, update css for element\n managerExternalCssStyles: function( elementContainer, selector, cssName, cssValue ) {\n let infArr = elementContainer.match( /wptb-element-main(.+)-(\\d+)/i );\n if( ! infArr || ! Array.isArray( infArr ) ) {\n let table = document.getElementsByClassName( 'wptb-preview-table' );\n \n if( table.length > 0 ) {\n table = table[0];\n \n let infArr = table.className.match( /wptb-element-main(.+)-(\\d+)/i );\n if( infArr && Array.isArray( infArr ) ) {\n selector = '.' + infArr[0] + ' ' + selector;\n }\n }\n }\n \n let head = document.head;\n if( head ) {\n let cssForThisElement = head.querySelector( '#styles-' + elementContainer );\n if( cssForThisElement ) {\n let cssText = cssForThisElement.innerHTML;\n if( cssText ) {\n let cssTextArrFirst = cssText.split( '}' );\n cssTextArrFirst.pop();\n let selectorExists = false;\n for( let i = 0; i < cssTextArrFirst.length; i++ ) {\n let cssTextArrSecond = cssTextArrFirst[i].split( '{' );\n if( cssTextArrSecond[0] === selector ) {\n let cssTextArrThird = cssTextArrSecond[1].split( ';' );\n cssTextArrThird.pop();\n let cssNameExists = false;\n for( let j = 0; j < cssTextArrThird.length; j++ ) {\n let cssTextArrFourth = cssTextArrThird[j].split( ':' );\n if( cssTextArrFourth[0] === cssName ) {\n if( cssValue ) {\n cssTextArrThird[j] = cssName + ':' + cssValue;\n } else {\n cssTextArrThird.splice( j, 1 );\n }\n \n cssTextArrSecond[1] = cssTextArrThird.join( ';' ) ? cssTextArrThird.join( ';' ) + ';' : '';\n cssNameExists = true;\n break;\n }\n }\n if( ! cssNameExists ) {\n if( cssValue ) {\n cssTextArrSecond[1] += cssName + ':' + cssValue + ';';\n }\n }\n if( cssTextArrSecond[1] ) {\n cssTextArrFirst[i] = cssTextArrSecond[0] + '{' + cssTextArrSecond[1]\n } else {\n cssTextArrFirst.splice( i, 1 );\n }\n if( cssTextArrFirst.join( '}' ) ) {\n cssForThisElement.innerHTML = cssTextArrFirst.join( '}' ) + '}';\n } else {\n head.removeChild( cssForThisElement );\n }\n \n selectorExists = true;\n break;\n }\n }\n\n if( ! selectorExists ) {\n if( cssValue ) {\n cssForThisElement.innerHTML = cssText + selector + '{' + cssName + ':' + cssValue + ';}';\n } else {\n cssForThisElement.innerHTML = cssText;\n }\n }\n } else {\n if( cssValue ) {\n cssForThisElement.innerHTML = selector + '{' + cssName + ':' + cssValue + ';}';\n } else {\n head.removeChild( cssForThisElement );\n }\n }\n } else {\n if( cssValue ) {\n let cssForThisElement = document.createElement( 'style' );\n cssForThisElement.setAttribute( 'id', 'styles-' + elementContainer );\n cssForThisElement.classList.add( 'styles-wptb-elements' );\n cssForThisElement.innerHTML = selector + '{' + cssName + ':' + cssValue + ';}';\n head.appendChild( cssForThisElement );\n }\n }\n }\n },\n /**\n *\n * Register section parts for sidebar\n *\n * @param {array} sections an array of section names\n */\n registerSections(sections) {\n this.sections = {};\n if (!Array.isArray(sections)) {\n sections = [sections];\n }\n\n sections.map(s => {\n const sectionElement = document.querySelector(`[data-wptb-section=${s}]`);\n if (sectionElement) {\n this.sections[s] = sectionElement;\n }\n })\n },\n /**\n * Activate a registered section and deactivates others\n *\n * @param {string} sectionDataId section name to be activated\n * @param {string} displayType display type override for section to be used in its display style property\n */\n activateSection(sectionDataId, displayType = 'block') {\n this.triggerSectionEvent(sectionDataId);\n Object.keys(this.sections).map(k => {\n if (Object.prototype.hasOwnProperty.call(this.sections, k)) {\n const visibility = sectionDataId === k ? displayType : 'none';\n this.sections[k].style = `display: ${visibility} !important`;\n }\n })\n },\n /**\n * Set up related buttons and links to trigger certain elements\n */\n setupSectionButtons() {\n const sectionButtons = Array.from( document.querySelectorAll('[data-wptb-section-button'));\n const vm = this;\n\n sectionButtons.map(s => {\n const sectionName = s.dataset.wptbSectionButton;\n s.addEventListener('click', function() {\n const displayType = s.dataset.wptbSectionDisplayType;\n vm.activateSection(sectionName, displayType);\n })\n\n document.addEventListener('sectionChanged', (e)=> {\n if(e.detail === sectionName){\n s.classList.remove('disabled');\n s.classList.add('active');\n }else{\n s.classList.remove('active');\n s.classList.add('disabled');\n }\n })\n })\n },\n setupPanelToggleButtons(){\n const $ = jQuery;\n\n $('.wptb-panel-toggle-group').each(function(){\n const vm = $(this);\n $(this).find('.toggle-icon').click(() => {\n vm.find('.wptb-panel-toggle-target').slideToggle();\n vm.toggleClass('wptb-panel-toggle-content');\n })\n })\n },\n /**\n * Trigger a section change event\n *\n * @param {string} sectionName section name\n */\n triggerSectionEvent(sectionName){\n const sectionEvent = new CustomEvent('sectionChanged', {detail: sectionName});\n\n document.dispatchEvent(sectionEvent);\n },\n /**\n * Setup sidebar toggle element\n *\n * @param {string} toggleSelector query selector for drawer toggle element\n */\n setupSidebarToggle(toggleSelector){\n const toggleButton = document.querySelector(toggleSelector);\n if(toggleButton){\n toggleButton.addEventListener('click', (e)=>{\n e.preventDefault();\n document.body.classList.toggle('collapsed');\n })\n }\n },\n // function for deleting all external CSS for the element\n externalCssStylesDelete: function( elementContainerClass ) {\n let head = document.head;\n if( head ) {\n let cssForThisElement = head.querySelector( '#styles-' + elementContainerClass );\n \n if( cssForThisElement ) {\n head.removeChild( cssForThisElement );\n }\n }\n },\n // function for copy all external CSS for the element\n externalCssStylesCopy: function( activeElement, copyElement ) {\n if( activeElement ) {\n let infArr = activeElement.className.match( /wptb-element-(.+)-(\\d+)/i );\n if( infArr && Array.isArray( infArr ) ) {\n let activeElemClass = infArr[0];\n \n let head = document.head;\n if( head ) {\n let cssForActiveElement = head.querySelector( '#styles-' + activeElemClass );\n\n if( cssForActiveElement ) {\n let cssForNewElement = cssForActiveElement.cloneNode( true );\n \n cssForNewElement.removeAttribute( 'id', 'styles-' + activeElemClass );\n \n let infArrCopyEl = copyElement.className.match( /wptb-element-(.+)-(\\d+)/i );\n if( infArrCopyEl && Array.isArray( infArrCopyEl ) ) {\n cssForNewElement.setAttribute( 'id', 'styles-' + infArrCopyEl[0] );\n let cssForActiveElementInnerHTML = cssForActiveElement.innerHTML;\n let cssForNewElementInnerHTML = WPTB_Helper.replaceAll( cssForActiveElementInnerHTML, activeElemClass, infArrCopyEl[0] );\n cssForNewElement.innerHTML = cssForNewElementInnerHTML;\n head.appendChild( cssForNewElement );\n }\n }\n }\n }\n }\n },\n // function for convertation elements stiles in json\n elementsStylesConvertToObject: function() {\n let head = document.head;\n let stylesElements = head.querySelectorAll( '.styles-wptb-elements' );\n let stylesObj = {};\n for( let i = 0; i < stylesElements.length; i++ ) {\n let styleElemId = stylesElements[i].getAttribute( 'id' );\n if( styleElemId && stylesElements[i].innerHTML ) {\n stylesObj[styleElemId] = stylesElements[i].innerHTML;\n }\n }\n \n if( Object.keys( stylesObj ).length != 0 ) {\n return JSON.stringify( stylesObj );\n }\n return '';\n },\n // function for set scc styles tags to head\n elementsStylesSetFromObject: function( jsonObject ) {\n let head = document.head;\n if( head ) {\n let stylesElements = head.querySelectorAll( '.styles-wptb-elements' );\n if( stylesElements.length > 0 ) {\n stylesElements = [...stylesElements];\n for( let i = 0; i < stylesElements.length; i++ ) {\n head.removeChild( stylesElements[i] );\n }\n }\n if( jsonObject ) {\n let stylesObj = JSON.parse( jsonObject );\n if( Object.keys( stylesObj ).length != 0 ) {\n Object.keys( stylesObj ).forEach( function( key ) {\n let cssText = stylesObj[key];\n let styleCss = document.createElement( 'style' );\n styleCss.setAttribute( 'id', key );\n styleCss.classList.add( 'styles-wptb-elements' );\n styleCss.innerHTML = cssText;\n head.appendChild( styleCss );\n });\n }\n }\n }\n },\n // function for table saving\n saveTable: function( event, startSaving, previewSaving ) {\n if( ! previewSaving && ! startSaving ) {\n if( ( ! event.target.dataset.wptbTableStateNumberSave && window.wptbTableStateNumberShow == 0 ) || \n window.wptbTableStateNumberShow == event.target.dataset.wptbTableStateNumberSave ) {\n //return;\n }\n }\n \n if( ! previewSaving ) {\n let bar = document.querySelector( '.wptb-edit-bar' );\n if ( bar && bar.classList.contains( 'visible' ) ) {\n let table = document.getElementsByClassName( 'wptb-preview-table' )[0];\n WPTB_Helper.toggleTableEditMode();\n }\n }\n\n let http = new XMLHttpRequest(),\n url = ( wptb_admin_object ? wptb_admin_object.ajaxurl : ajaxurl ) + \"?action=save_table\",\n t = document.getElementById( 'wptb-setup-name' ).value.trim(),\n messagingArea,\n code,\n datas;\n \n code = document.getElementsByClassName( 'wptb-preview-table' );\n \n let postId;\n if (( rs = WPTB_Helper.detectMode() ) || ( rs = document.wptbId )) {\n postId = rs;\n }\n let paramIdsNecessaryChange = false;\n if( code.length > 0 ) {\n code = code[0];\n let codeClone = code.cloneNode( true );\n if( postId ) {\n if( codeClone.classList.contains( 'wptb-element-main-table_setting-startedid-0' ) ) {\n codeClone.classList.remove( 'wptb-element-main-table_setting-startedid-0' );\n codeClone.classList.add( 'wptb-element-main-table_setting-' + postId );\n paramIdsNecessaryChange = true;\n }\n }\n codeClone.columns = code.columns;\n code = WPTB_Stringifier( codeClone );\n code = code.outerHTML;\n } else { \n code = '';\n }\n \n if( ! previewSaving ) {\n datas = '';\n let datas_containers = document.getElementsByClassName( 'wptb-element-datas' );\n\n if( datas_containers.length > 0 ) {\n if( datas_containers[0].innerHTML ) {\n datas = datas_containers[0].innerHTML;\n\n if( paramIdsNecessaryChange ) {\n datas = WPTB_Helper.replaceAll( datas, 'tmpl-wptb-el-datas-main-table_setting-startedid-0', \n 'tmpl-wptb-el-datas-main-table_setting-' + postId );\n\n datas = WPTB_Helper.replaceAll( datas, 'data-wptb-el-main-table_setting-startedid-0', \n 'data-wptb-el-main-table_setting-' + postId );\n }\n }\n }\n }\n\n let styleObjJson = WPTB_Helper.elementsStylesConvertToObject();\n if( paramIdsNecessaryChange ) {\n styleObjJson = WPTB_Helper.replaceAll( styleObjJson, '.wptb-element-main-table_setting-startedid-0', \n '.wptb-element-main-table_setting-' + postId );\n }\n \n if ( t === '' && code === '' ) {\n let messagingAreaText = '';\n if( t === '' ) messagingAreaText += 'You must assign a name to the table before saving it.</br>';\n if( code === '' ) messagingAreaText += 'Table wasn\\'t created';\n messagingArea = document.getElementById( 'wptb-messaging-area' );\n messagingArea.innerHTML = '<div class=\"wptb-error wptb-message\">Error: ' + messagingAreaText + '</div>';\n messagingArea.classList.add( 'wptb-warning' );\n setTimeout(function () {\n messagingArea.removeChild( messagingArea.firstChild );\n }, 4000 );\n return;\n }\n\n let params = {\n title: t,\n content: code,\n elements_datas: datas,\n elements_styles: styleObjJson,\n security_code: wptb_admin_object.security_code\n };\n \n \n if( previewSaving ) {\n params.preview_saving = previewSaving;\n }\n \n if ( postId ) {\n params.id = postId;\n }\n params = JSON.stringify( params );\n\n http.open('POST', url, true);\n http.setRequestHeader( 'Content-type', 'application/json; charset=utf-8' );\n\n http.onreadystatechange = function ( action ) {\n if ( this.readyState == 4 && this.status == 200 ) {\n var data = JSON.parse( http.responseText );\n messagingArea = document.getElementById( 'wptb-messaging-area' );\n\n if ( data[0] == 'saved' ) {\n let builderPageUrl = document.location.href.replace( '#', '' );\n let regex = new RegExp( '&table=(.+)', \"i\" );\n builderPageUrl = builderPageUrl.replace( regex, '' );\n window.history.pushState( null, null, builderPageUrl + '&table=' + data[1] );\n \n WPTB_Helper.saveTable( event, true );\n return;\n } else if( data[0] == 'edited' && startSaving ) {\n document.wptbId = data[1];\n messagingArea.innerHTML = '<div class=\"wptb-success wptb-message\">Table \"' + t + '\" was successfully saved.</div>';\n document.getElementsByClassName( 'wptb-embed-btn' )[0].classList.remove( 'wptb-button-disable' );\n document.getElementById( 'wptb-embed-shortcode' ).value = '[wptb id=' + data[1] + ']';\n let wptbPreviewTable = document.querySelector( '.wptb-preview-table' );\n let wptbPreviewBtn = document.getElementsByClassName( 'wptb-preview-btn' );\n if( wptbPreviewBtn.length > 0 ) {\n wptbPreviewBtn = wptbPreviewBtn[0];\n wptbPreviewBtn.classList.remove( 'wptb-button-disable' );\n let wptbPreviewBtnHref = wptbPreviewBtn.dataset.previewHref;\n wptbPreviewBtnHref = wptbPreviewBtnHref.replace( 'empty', data[1] );\n wptbPreviewBtn.setAttribute( 'href', wptbPreviewBtnHref );\n }\n \n event.target.dataset.wptbTableStateNumberSave = window.wptbTableStateNumberShow;\n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\n if( wptbSaveBtn.length > 0 ) {\n wptbSaveBtn = wptbSaveBtn[0];\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\n wptbSaveBtn.classList.remove('active');\n }\n } else if( data[0] == 'edited' ) {\n messagingArea.innerHTML = '<div class=\"wptb-success wptb-message\">Table \"' + t + '\" was successfully updated.</div>';\n event.target.dataset.wptbTableStateNumberSave = window.wptbTableStateNumberShow;\n \n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\n if( wptbSaveBtn.length > 0 ) {\n wptbSaveBtn = wptbSaveBtn[0];\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\n wptbSaveBtn.classList.remove('active');\n }\n } else if( data[0] == 'preview_edited' ) {\n return;\n } else {\n messagingArea.innerHTML = '<div class=\"wptb-error wptb-message\">Safety problems</div>';\n }\n messagingArea.classList.add( 'wptb-success' );\n setTimeout( function () {\n messagingArea.removeChild( messagingArea.firstChild );\n }, 4000 );\n }\n }\n http.send( params );\n },\n //\n clickOnFreeSpace: function() {\n let cellModeBackground = document.querySelector( '#wptb-cell_mode_background' );\n if( cellModeBackground && cellModeBackground.classList.contains( 'visible' ) ) {\n return;\n }\n // document.getElementsByClassName( 'wptb-elements-container' )[0].style.display = 'table';\n // document.getElementsByClassName( 'wptb-settings-section' )[0].style.display = 'block';\n // document.getElementById( 'element-options-group' ).style.display = 'none';\n this.activateSection('elements');\n\n let wpcdFixedToolbar = document.getElementById( 'wpcd_fixed_toolbar' );\n if( wpcdFixedToolbar.hasAttribute( 'data-toolbar-active-id' ) ) {\n document.getElementById( wpcdFixedToolbar.getAttribute( 'data-toolbar-active-id' ) ).classList.remove( 'toolbar-active' );\n }\n let element = document.querySelector( '.wptb-preview-table' );\n if( element ) {\n WPTB_Helper.elementOptionsSet( 'table_setting', element );\n }\n },\n\n /*\n * function for sending of element ajax request\n */\n elementAjax: function( dataAjaxData, element ) {\n let http = new XMLHttpRequest(),\n url = ( wptb_admin_object ? wptb_admin_object.ajaxurl : ajaxurl ) + \"?action=wptb_element_ajax\";\n let element_name;\n let infArr = element.className.match( /wptb-element-(.+)-(\\d+)/i );\n if( infArr && Array.isArray( infArr ) ) {\n element_name = infArr[1];\n }\n \n let params = {\n element_ajax_data: dataAjaxData,\n element_name: element_name,\n security_code: wptb_admin_object.security_code\n };\n params = JSON.stringify( params );\n\n http.open( 'POST', url, true );\n http.setRequestHeader( 'Content-type', 'application/json; charset=utf-8' );\n\n http.onreadystatechange = function ( action ) {\n if ( this.readyState == 4 && this.status == 200 ) {\n var data = JSON.parse( http.responseText );\n let detail;\n if ( data && Array.isArray( data ) && data[0] == 'element_ajax_responce' ) {\n detail = {value: data[1]};\n } else {\n detail = '';\n }\n WPTB_Helper.wptbDocumentEventGenerate( 'wptb-element:ajax-response', element, detail );\n }\n }\n http.send( params );\n },\n\n /*\n * This just toggles visibility of cell edit bar, and toggles\n * cell selecting mode.\n */\n toggleTableEditMode: function ( close = false ) {\n let bar = document.getElementsByClassName('wptb-edit-bar'),\n cellModeBackground = document.getElementById('wptb-cell_mode_background'),\n leftScrollPanelCurtain = document.getElementById('wptb-left-scroll-panel-curtain'),\n leftScrollPanelCellSettings = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ),\n wptbPreviewTable = document.getElementsByClassName('wptb-preview-table');\n if (wptbPreviewTable.length > 0) {\n wptbPreviewTable = wptbPreviewTable[0];\n }\n\n if ( bar.length > 0 ) {\n for ( let i = 0; i < bar.length; i++ ) {\n if ( bar[i].classList.contains( 'visible' ) ) {\n document.select.deactivateMultipleSelectMode();\n bar[i].classList.remove( 'visible' );\n cellModeBackground.classList.remove( 'visible' );\n leftScrollPanelCurtain.classList.remove( 'visible' );\n leftScrollPanelCellSettings.classList.remove( 'visible' );\n wptbPreviewTable.parentNode.classList.remove( 'wptb-preview-table-manage-cells' );\n let wptbPreviewTableTds = wptbPreviewTable.getElementsByTagName( 'td' );\n if ( wptbPreviewTableTds.length > 0 ) {\n for ( let i = 0; i < wptbPreviewTableTds.length; i++ ) {\n wptbPreviewTableTds[i].classList.remove( 'wptb-highlighted' );\n }\n }\n } else if( ! close ) {\n document.select.activateMultipleSelectMode();\n bar[i].classList.add( 'visible' );\n cellModeBackground.classList.add( 'visible' );\n leftScrollPanelCurtain.classList.add( 'visible' );\n wptbPreviewTable.parentNode.classList.add( 'wptb-preview-table-manage-cells' );\n }\n }\n\n }\n },\n\n /*\n * checking of dimension of value\n */\n checkingDimensionValue: function ( value, dimension ) {\n value = String( value );\n dimension = String( dimension );\n if( value && dimension ) {\n let searchIndex = value.indexOf( dimension );\n if ( searchIndex != -1 && searchIndex == ( value.length - dimension.length ) ) {\n return true;\n } else {\n return false;\n }\n } else {\n return false;\n }\n },\n\n /*\n * if dimension is included - checking and if it necessary setting value\n * without dimension - return value\n */\n checkSetGetStyleSizeValue: function( element, styleName, computedStyleName, dimension ) {\n let elemStyleValue = element.style[styleName];\n elemStyleValue = String( elemStyleValue );\n\n if( ! elemStyleValue || dimension ? ! ( WPTB_Helper.checkingDimensionValue( elemStyleValue, dimension ) ) : false ){\n let elementStyles = window.getComputedStyle( element );\n if( computedStyleName && elementStyles.getPropertyValue( computedStyleName ) && dimension ? WPTB_Helper.checkingDimensionValue( elementStyles.getPropertyValue( computedStyleName ), dimension ) : true ) {\n if( ! dimension ) {\n return elementStyles.getPropertyValue( computedStyleName );\n } else {\n element.style[styleName] = elementStyles.getPropertyValue( computedStyleName );\n }\n } else {\n if( ! dimension ) {\n return false;\n } else {\n element.style[styleName] = null;\n }\n }\n } else if( ! dimension ) {\n return elemStyleValue;\n }\n\n return element.style[styleName];\n },\n\n /*\n * function checking that element has the style\n * if this style is present - checking the format color\n * if param set is true - setting style for element (consider hex format of color)\n * if param set is false - getting style from element\n */\n checkSetGetStyleColorValue: function ( element, styleName, computedStyleName, set = false ) {\n let elemStyleColorValue = element.style[styleName];\n\n if( ! elemStyleColorValue ) {\n let elementStyles = window.getComputedStyle( element, null );\n\n if( elementStyles && elementStyles.getPropertyValue( computedStyleName ) ) {\n\n if( set ) {\n elemStyleColorValue = WPTB_Helper.rgbToHex( elementStyles.getPropertyValue( computedStyleName ) );\n if( WPTB_Helper.isHex( elemStyleColorValue ) ) {\n element.style[styleName] = elemStyleColorValue;\n } else {\n element.style[styleName] = '';\n }\n } else {\n return elementStyles.getPropertyValue( computedStyleName );\n }\n\n } else {\n if( set ) {\n element.style[styleName] = '';\n } else {\n return '';\n }\n }\n } else if( ! set ) {\n return elemStyleColorValue;\n }\n },\n\n /*\n * function checking that element has the style\n * if this style is present - checking the format color\n * if param set is true - setting style for element (consider hex format of color)\n * if param set is false - getting style from element\n */\n checkSetGetStyleValue: function ( element, styleName, computedStyleName, set = false ) {\n let elemStyleColorValue = element.style[styleName];\n\n if( ! elemStyleColorValue ) {\n let elementStyles = window.getComputedStyle( element, null );\n\n if( elementStyles && elementStyles.getPropertyValue( computedStyleName ) ) {\n\n if( set ) {\n element.style[styleName] = elementStyles.getPropertyValue( computedStyleName );\n } else {\n return elementStyles.getPropertyValue( computedStyleName );\n }\n\n } else if( ! set ) {\n return '';\n }\n } else if( ! set ) {\n return elemStyleColorValue;\n }\n },\n\n /*\n * get the value of the same elements that have the most count\n */\n getValueMaxCountSameElementsInArray: function ( arr ) {\n if( arr && Array.isArray( arr ) ) {\n let check = {};\n for( let i = 0; i < arr.length; i++ ) {\n if( check[arr[i]] ) {\n check[arr[i]]++;\n } else {\n check[arr[i]] = 1;\n }\n }\n\n let maxPropName;\n for ( let key in check ) {\n if( ! maxPropName ) {\n maxPropName = key;\n continue;\n } else {\n if( check[maxPropName] < check[key] ) {\n maxPropName = key;\n }\n }\n }\n\n return maxPropName;\n }\n },\n\n /*\n * For assigning to each cell xIndex and y Index attributes,\n * these are the column number and row number of cell in table.\n */\n recalculateIndexes: function ( table ) {\n let trs = table.getElementsByTagName( 'tr' ),\n tds, maxCols = 0, maxColsFull = 0, tdsArr = [];\n\n for ( let i = 0; i < trs.length; i++ ) {\n tds = trs[i].getElementsByTagName( 'td' );\n\n if ( tdsArr[i] == undefined ) {\n tdsArr[i] = [];\n }\n\n let jMainIter = 0;\n for ( let j = 0; j < tds.length; j++ ) {\n if ( tdsArr[i][j] != undefined ) {\n for ( let y = 0; y < 100; y++ ) {\n if ( tdsArr[i][jMainIter] != undefined ) {\n jMainIter++;\n continue;\n }\n tdsArr[i][jMainIter] = tds[j];\n tds[j].dataset.xIndex = jMainIter;\n break;\n }\n } else {\n tdsArr[i][j] = tds[j];\n tds[j].dataset.xIndex = jMainIter;\n }\n tds[j].dataset.yIndex = i;\n\n if ( tds[j].colSpan > 1 ) {\n for ( let k = 1; k < tds[j].colSpan; k++ ) {\n jMainIter++;\n tdsArr[i][jMainIter] = 'tdDummy';\n }\n }\n\n if ( tds[j].rowSpan > 1 ) {\n for ( let x = 1; x < tds[j].rowSpan; x++ ) {\n if ( tdsArr[i + x] == undefined ) {\n tdsArr[i + x] = [];\n }\n for ( let z = 0; z < tds[j].colSpan; z++ ) {\n tdsArr[i + x][jMainIter - tds[j].colSpan + 1 + z ] = 'tdDummy';\n }\n }\n }\n jMainIter++;\n\n if ( j > maxCols ) {\n maxCols = j;\n }\n }\n\n if( i == 0 ) {\n maxColsFull = jMainIter;\n }\n }\n table.columns = maxCols;\n table.maxCols = maxColsFull;\n },\n\n /**\n * Table Rows colors reinstall\n */\n tableRowsColorsReinstall: function ( table ) {\n let infArr = table.className.match( /wptb-element-main(.+)-(\\d+)/i );\n if( infArr && Array.isArray( infArr ) ) {\n let tableIndex = '';\n if( infArr[infArr.length -1] == '0' ) {\n tableIndex = 'startedid-0';\n } else {\n tableIndex = infArr[infArr.length -1];\n }\n\n let tableHeaderBackground = document.querySelector('.wptb-el-main-table_setting-' + tableIndex + '-tableHeaderBackground' );\n if( tableHeaderBackground ) {\n let details = {value: tableHeaderBackground.value};\n WPTB_Helper.wptbDocumentEventGenerate( 'controlColor:change', tableHeaderBackground, details );\n }\n\n let tableEvenRowBackground = document.querySelector('.wptb-el-main-table_setting-' + tableIndex + '-tableEvenRowBackground' );\n if( tableEvenRowBackground ) {\n let details = {value: tableEvenRowBackground.value};\n WPTB_Helper.wptbDocumentEventGenerate( 'controlColor:change', tableEvenRowBackground, details );\n }\n\n let tableOddRowBackground = document.querySelector('.wptb-el-main-table_setting-' + tableIndex + '-tableOddRowBackground' );\n if( tableOddRowBackground ) {\n let details = {value: tableOddRowBackground.value};\n WPTB_Helper.wptbDocumentEventGenerate( 'controlColor:change', tableOddRowBackground, details );\n }\n }\n }\n}\n","var WPTB_Initializer = function () {\n\n const MIN_COLUMNS = 1,\n MIN_ROWS = 1,\n MAX_COLUMNS = 30,\n MAX_ROWS = 30;\n\n var tableGenerator = document.body;\n columnsDecrementButton = tableGenerator.getElementsByClassName('wptb-input-number-decrement')[0],\n columnsIncrementButton = tableGenerator.getElementsByClassName('wptb-input-number-increment')[0],\n rowsDecrementButton = tableGenerator.getElementsByClassName('wptb-input-number-decrement')[1],\n rowsIncrementButton = tableGenerator.getElementsByClassName('wptb-input-number-increment')[1],\n columnsInput = document.getElementById('wptb-columns-number'),\n rowsInput = document.getElementById('wptb-rows-number');\n \n columnsDecrementButton.onclick = function () {\n if (columnsInput.value > MIN_COLUMNS) {\n columnsInput.value--;\n }\n };\n\n columnsIncrementButton.onclick = function () {\n if (columnsInput.value < MAX_COLUMNS) {\n columnsInput.value++;\n }\n };\n\n rowsDecrementButton.onclick = function () {\n if (rowsInput.value > MIN_ROWS) {\n rowsInput.value--;\n }\n };\n\n rowsIncrementButton.onclick = function () {\n if (rowsInput.value < MAX_ROWS) {\n rowsInput.value++;\n }\n };\n\n document.getElementById( 'wptb-generate-table' ).onclick = function ( ) {\n var columns = document.getElementById('wptb-columns-number').value,\n rows = document.getElementById('wptb-rows-number').value;\n\n //wptbTableStateSaveManager.tableStateClear();\n \n WPTB_Table(columns, rows);\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n\n WPTB_Helper.registerSections(['elements', 'table_settings', 'cell_settings', 'options_group']);\n WPTB_Helper.setupSectionButtons();\n WPTB_Helper.activateSection('elements');\n WPTB_Helper.setupSidebarToggle('.wptb-panel-drawer-toggle');\n WPTB_Helper.setupPanelToggleButtons();\n};\n","var WPTB_LeftPanel = function () {\r\n\r\n let table = document.getElementsByClassName('wptb-preview-table')[0],\r\n wptbElementButtons = document.getElementsByClassName('wptb-element');\r\n\r\n for (var i = 0; i < wptbElementButtons.length; i++) {\r\n wptbElementButtons[i].ondragstart = function (e) {\r\n e.dataTransfer.setData('wptbElement', this.dataset.wptbElement);\r\n e.dataTransfer.setData( 'wptbElIndic-' + this.dataset.wptbElement, 'wptbElIndic-' + this.dataset.wptbElement );\r\n }\r\n };\r\n \r\n if( table ) {\r\n let wptbTablesEditModeCloseButton = document.getElementsByClassName( 'wptb-table-edit-mode-close' );\r\n for ( let i = 0; i < wptbTablesEditModeCloseButton.length; i++ ) {\r\n wptbTablesEditModeCloseButton[i].onclick = WPTB_Helper.toggleTableEditMode;\r\n }\r\n document.getElementById('wptb-add-end-row').onclick = table.addRowToTheEnd;\r\n document.getElementById('wptb-add-start-row').onclick = table.addRowToTheStart;\r\n document.getElementById('wptb-add-row-before').onclick = table.addRowBefore;\r\n document.getElementById('wptb-add-row-after').onclick = table.addRowAfter;\r\n document.getElementById('wptb-add-end-column').onclick = table.addColumnEnd;\r\n document.getElementById('wptb-add-start-column').onclick = table.addColumnStart;\r\n document.getElementById('wptb-add-column-before').onclick = table.addColumnBefore;\r\n document.getElementById('wptb-add-column-after').onclick = table.addColumnAfter;\r\n document.getElementById('wptb-delete-column').onclick = table.deleteColumn;\r\n document.getElementById('wptb-delete-row').onclick = table.deleteRow;\r\n document.getElementById('wptb-merge-cells').onclick = table.mergeCells;\r\n document.getElementById('wptb-split-cell').onclick = table.splitCell;\r\n };\r\n\r\n // this code hides the \"element parameters\" area\r\n // when clicked outside this element and its \"tinymce\" toolbar \r\n let wptbBuilderPanel = document.getElementsByClassName( 'wptb-builder-panel' )[0];\r\n wptbBuilderPanel.onclick = function( e ) {\r\n if( ! e.target.classList.contains( 'wptb-ph-element' ) && ! WPTB_Helper.findAncestor( e.target, 'wptb-ph-element' ) && \r\n ! e.target.classList.contains( 'wptb-fixed-toolbar' ) && ! WPTB_Helper.findAncestor( e.target, 'wptb-fixed-toolbar' ) ) {\r\n WPTB_Helper.clickOnFreeSpace();\r\n } \r\n };\r\n \r\n let wptbHeader = document.getElementsByClassName( 'wptb-header' );\r\n if( wptbHeader.length > 0 ) wptbHeader = wptbHeader[0];\r\n wptbHeader.onclick = function() {\r\n WPTB_Helper.clickOnFreeSpace();\r\n };\r\n};","var MultipleSelect = function () {\n\n\tvar selectedCells = [],\n\t\tmultipleCellMode = false;\n\n\tthis.activateMultipleSelectMode = function () {\n\t\tselectedCells = [];\n\t\tvar tds = document.getElementsByClassName('wptb-preview-table')[0].getElementsByTagName('td');\n\t\tfor (var i = 0; i < tds.length; i++) {\n\t\t\ttds[i].classList.remove('wptb-highlighted');\n\t\t}\n\t\tmultipleCellMode = true;\n\t}\n\n\tthis.deactivateMultipleSelectMode = function () {\n\t\tmultipleCellMode = false;\n\t}\n\n\tthis.isActivated = function () {\n\t\treturn multipleCellMode;\n\t}\n\n\tthis.pushSelectedCell = function (cell) {\n\t\tif (!multipleCellMode) {\n\t\t\treturn;\n\t\t}\n\t\tselectedCells.push(cell);\n\t\tcell.classList.add('wptb-highlighted');\n\t};\n\n\tthis.selectedCells = function () {\n\t\treturn selectedCells;\n\t}\n\n\tthis.flushSelectedCells = function () {\n\t\tselectedCells = [];\n\t}\n\n\tthis.getFirst = function () {\n\t\tvar minXIndex = 1000, minYIndex = 1000, first;\n\t\tfor (var i = selectedCells.length - 1; i >= 0; i--) {\n\t\t\tif (minXIndex >= selectedCells[i].dataset.xIndex\n\t\t\t\t&& minYIndex >= selectedCells[i].dataset.yIndex) {\n\t\t\t\tfirst = selectedCells[i];\n\t\t\t\tminXIndex = selectedCells[i].dataset.xIndex;\n\t\t\t\tminYIndex = selectedCells[i].dataset.yIndex;\n\t\t\t}\n\t\t}\n\t\treturn first;\n\t}\n\n\tthis.getLast = function () {\n\t\tvar maxXIndex = -1, maxYIndex = -1, last;\n\t\tfor (var i = selectedCells.length - 1; i >= 0; i--) {\n\t\t\tif (maxXIndex <= selectedCells[i].dataset.xIndex\n\t\t\t\t&& maxYIndex <= selectedCells[i].dataset.yIndex) {\n\t\t\t\tlast = selectedCells[i];\n\t\t\t\tmaxXIndex = selectedCells[i].dataset.xIndex;\n\t\t\t\tmaxYIndex = selectedCells[i].dataset.yIndex;\n\t\t\t}\n\t\t}\n\t\treturn last;\n\t}\n\n\tthis.removeAllButFirst = function () {\n\t\tvar td = this.getFirst();\n\t\tfor (var i = 1; i < selectedCells.length; i++) {\n\t\t\tselectedCells[i].classList.add('wptb-fused-cell-' + td.dataset.xIndex + '-' + td.dataset.yIndex);\n\t\t}\n\t}\n\n\treturn this;\n\n};","var WPTB_Parser = function ( code ) {\n let div = document.createElement( 'div' );\n div.innerHTML = code;\n \n let table = div.children[0];\n let columnTitleMobile = [...table.querySelectorAll( '.wptb-column-title-mobile-container' )];\n \n for( let i = 0; i < columnTitleMobile.length; i++ ) {\n let parent = columnTitleMobile[i].parentNode;\n parent.removeChild( columnTitleMobile[i] );\n }\n \n let tds = table.querySelectorAll( 'td' );\n for ( let i = 0; i < tds.length; i++ ) {\n tds[i].classList.add( 'wptb-droppable' );\n tds[i].classList.remove( 'wptb-column-title-mobile-not-elements' );\n }\n \n return table;\n}","// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys\nif (!Object.keys) {\n Object.keys = (function () {\n 'use strict';\n var hasOwnProperty = Object.prototype.hasOwnProperty,\n hasDontEnumBug = !({toString: null}).propertyIsEnumerable('toString'),\n dontEnums = [\n 'toString',\n 'toLocaleString',\n 'valueOf',\n 'hasOwnProperty',\n 'isPrototypeOf',\n 'propertyIsEnumerable',\n 'constructor'\n ],\n dontEnumsLength = dontEnums.length;\n\n return function (obj) {\n if (typeof obj !== 'object' && (typeof obj !== 'function' || obj === null)) {\n throw new TypeError('Object.keys called on non-object');\n }\n\n var result = [], prop, i;\n\n for (prop in obj) {\n if (hasOwnProperty.call(obj, prop)) {\n result.push(prop);\n }\n }\n\n if (hasDontEnumBug) {\n for (i = 0; i < dontEnumsLength; i++) {\n if (hasOwnProperty.call(obj, dontEnums[i])) {\n result.push(dontEnums[i]);\n }\n }\n }\n return result;\n };\n }());\n}","var WPTB_Settings = function () {\n var elems = document.getElementsByClassName('wptb-element');\n\n for ( var i = 0; i < elems.length; i++ ) {\n elems[i].ondragstart = function ( event ) {\n event.dataTransfer.effectAllowed = 'move';\n event.dataTransfer.setData( 'wptbElement', event.target.dataset.wptbElement );\n event.dataTransfer.setData( 'wptbElIndic-' + event.target.dataset.wptbElement, 'wptbElIndic-' + event.target.dataset.wptbElement );\n }\n elems[i].ondragend = function () {\n WPTB_Helper.elementDragEndClear();\n }\n };\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n let wptbUndo = document.getElementsByClassName( 'wptb-undo' );\n if( wptbUndo.length > 0 ) {\n wptbUndo = wptbUndo[0];\n \n wptbUndo.onclick = function( event ) {\n if( ! this.classList.contains( 'wptb-undoredo-disabled' ) ) {\n wptbTableStateSaveManager.tableStateGet( this.dataset.wptbUndoredo );\n let wptbUndoRedoContainer = document.getElementsByClassName( 'wptb-undo-redo-container' );\n if(wptbUndoRedoContainer.length > 0) {\n wptbUndoRedoContainer = wptbUndoRedoContainer[0];\n wptbUndoRedoContainer.onmouseleave = function( event ) {\n event.target.onmouseleave = '';\n let table = document.querySelector( '.wptb-preview-table' );\n WPTB_Table();\n }\n }\n }\n }\n }\n \n let wptbRedo = document.getElementsByClassName( 'wptb-redo' );\n if( wptbRedo.length > 0 ) {\n wptbRedo = wptbRedo[0];\n \n wptbRedo.onclick = function( event ) {\n if( ! this.classList.contains( 'wptb-undoredo-disabled' ) ) {\n wptbTableStateSaveManager.tableStateGet( this.dataset.wptbUndoredo );\n let wptbUndoRedoContainer = document.getElementsByClassName( 'wptb-undo-redo-container' );\n if(wptbUndoRedoContainer.length > 0) {\n wptbUndoRedoContainer = wptbUndoRedoContainer[0];\n wptbUndoRedoContainer.onmouseleave = function( event ) {\n event.target.onmouseleave = '';\n let table = document.querySelector( '.wptb-preview-table' );\n WPTB_Table();\n }\n }\n }\n \n }\n }\n \n let shortcodePopupWindow = document.getElementsByClassName( 'wptb-popup-window-modal' )[0];\n document.getElementsByClassName( 'wptb-embed-btn' )[0].onclick = function () {\n if( ! this.classList.contains( 'wptb-button-disable' ) ) {\n shortcodePopupWindow.classList.add( 'wptb-popup-show' );\n }\n }\n \n window.onbeforeunload = function(e) {\n let wptbSaveDisabled = document.getElementsByClassName( 'wptb-save-disabled' );\n if( wptbSaveDisabled.length == 0 ) {\n return true;\n } else {\n return null;\n }\n };\n \n \n document.getElementsByClassName( 'wptb-popup-dark-area' )[0].onclick = function () {\n shortcodePopupWindow.classList.remove( 'wptb-popup-show' );\n }\n \n document.getElementsByClassName( 'wptb-popup-window-close-icon' )[0].onclick = function () {\n shortcodePopupWindow.classList.remove( 'wptb-popup-show' );\n }\n \n document.getElementsByClassName( 'wptb-preview-btn' )[0].onclick = function ( event ) {\n if( this.classList.contains( 'wptb-button-disable' ) ) {\n return;\n } \n \n let previewId = Math.floor( Math.random() * 10000 );\n \n var newHref = new URL( event.target.href );\n newHref.searchParams.set( 'preview_id', previewId );\n event.target.href = newHref.toString();\n WPTB_Helper.saveTable( event, false, previewId );\n }\n\n document.getElementsByClassName( 'wptb-save-btn' )[0].onclick = function ( event ) {\n if( ! this.classList.contains( 'wptb-save-disabled' ) ) {\n WPTB_Helper.saveTable( event );\n }\n }\n\n let tableTitleField = document.querySelector( '#wptb-setup-name' );\n if( tableTitleField ) {\n tableTitleField.onchange = function () {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n }\n};\n","var WPTB_Stringifier = function ( codeMain ) {\n if ( codeMain ) {\n let code = codeMain.cloneNode( true );\n code.dataset.tableColumns = codeMain.columns;\n code.style.width = null;\n code.style.minWidth = null;\n code.style.maxWidth = null;\n \n let tds = code.getElementsByTagName( 'td' );\n if ( tds.length > 0 ) {\n for ( let i = 0; i < tds.length; i++ ) {\n \n if ( codeMain.querySelector( 'wptb-table-preview-head' ) ) {\n tds[i].removeAttribute( 'data-x-index' );\n }\n tds[i].removeAttribute( 'data-y-index' );\n tds[i].removeAttribute( 'draggable' );\n tds[i].classList.remove( 'wptb-droppable' );\n let innerElements = tds[i].getElementsByClassName( 'wptb-ph-element' );\n \n if ( innerElements.length > 0 ) {\n for ( let j = 0; j < innerElements.length; j++ ) {\n \n let mceContentBodys = innerElements[j].querySelectorAll( '.mce-content-body' );\n if( mceContentBodys.length > 0 ) {\n for ( let k = 0; k < mceContentBodys.length; k++ ) {\n mceContentBodys[k].classList.remove( 'mce-content-body' );\n }\n }\n \n let dataMceStyle = innerElements[j].querySelectorAll( '[data-mce-style]' );\n if ( dataMceStyle.length > 0 ) {\n for ( let k = 0; k < dataMceStyle.length; k++ ) {\n dataMceStyle[k].removeAttribute( 'data-mce-style' );\n }\n }\n \n let contentEditable = innerElements[j].querySelectorAll( '[contenteditable]' );\n if ( contentEditable.length > 0 ) {\n for ( let k = 0; k < contentEditable.length; k++ ) {\n contentEditable[k].removeAttribute( 'contenteditable' );\n }\n }\n \n let spellCheck = innerElements[j].querySelectorAll( '[spellcheck]' );\n if ( spellCheck.length > 0 ) {\n for ( let k = 0; k < spellCheck.length; k++ ) {\n spellCheck[k].removeAttribute( 'spellcheck' );\n }\n }\n \n let mceIds = innerElements[j].querySelectorAll( '[id^=mce_]' );\n if ( mceIds.length > 0 ) {\n for ( let k = 0; k < mceIds.length; k++ ) {\n mceIds[k].removeAttribute( 'id' );\n }\n }\n \n let wptbActions = innerElements[j].querySelectorAll( '.wptb-actions' );\n let wptbActionsLength = wptbActions.length;\n while ( wptbActionsLength > 0 ) {\n if( wptbActions[0] && wptbActions[0].parentNode ) {\n wptbActions[0].parentNode.removeChild( wptbActions[0] );\n wptbActionsLength--;\n } else {\n break;\n }\n \n } \n \n let dataMceBogus = innerElements[j].querySelectorAll( '[data-mce-bogus]' );\n if( dataMceBogus.length > 0 ) {\n dataMceBogus = [...dataMceBogus];\n for( let k = 0; k < dataMceBogus.length; k++ ) {\n if( dataMceBogus[k] && dataMceBogus[k].parentNode ) {\n dataMceBogus[k].parentNode.removeChild( dataMceBogus[k] );\n }\n }\n }\n }\n }\n \n if( tds[i].hasAttribute( 'data-wptb-title-column' ) ) {\n let columnNameDivContainer = document.createElement( 'div' ),\n columnNameDiv = document.createElement( 'div' );\n columnNameDivContainer.classList.add( 'wptb-column-title-mobile-container' );\n columnNameDiv.classList.add( 'wptb-column-title-mobile' );\n columnNameDiv.dataset.wptbTitleColumn = tds[i].dataset.wptbTitleColumn;\n columnNameDiv.setAttribute( 'style', 'font-size:' + tds[i].dataset.wptbTitleColumnFontSize + '; \\n\\\n color:' + tds[i].dataset.wptbTitleColumnColor + '; background-color:' + tds[i].dataset.wptbTitleBackgroundColor + '; text-align:' + tds[i].dataset.wptbTitleAlign + ';' );\n columnNameDiv.style.padding = tds[i].style.padding;\n if( tds[i].children.length == 0 ) {\n tds[i].classList.add( 'wptb-column-title-mobile-not-elements' );\n }\n columnNameDivContainer.appendChild( columnNameDiv );\n tds[i].insertBefore( columnNameDivContainer, tds[i].firstChild );\n }\n }\n }\n \n return code;\n }\n}","var array = [], WPTB_Table = function ( columns, rows, wptb_preview_table ) {\n\n /* The members of the class */\n var settings = document.getElementsByClassName('wptb-settings-items'),\n wptbTableSetup = document.getElementsByClassName(\"wptb-table-setup\")[0],\n table, row, cell,\n maxAmountOfCells,\n maxAmountOfRows;\n\n //HERE ARE THE PRIVATE FUNCTIONS\n /*\n * This function toggles buttons visibility in cell edit mode\n * (according to the amount of currently selected cells), and\n * highlights visually the clicked cell if it is not highlighted, or\n * removes highlight if clicked cell is already highlighted. \n * It too toggles the bits of our abstract representation.\n * @param Event this is the event instance of the click performed over a cell.\n */\n var mark = function ( event ) {\n var rs = this.rowSpan,\n cs = this.colSpan,\n noCells = document.getElementsByClassName('wptb-no-cell-action'),\n singleCells = document.getElementsByClassName('wptb-single-action'),\n multipleCells = document.getElementsByClassName('wptb-multiple-select-action'),\n cellSettings = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ),\n position = getCoords(this),\n row = position[0],\n column = position[1];\n if ( ! document.select.isActivated() ) {\n return;\n }\n if (this.className.match(/wptb-highlighted/)) {\n this.classList.remove('wptb-highlighted');\n for (var i = 0; i < rs; i++) {\n for (var j = 0; j < cs; j++) {\n array[row + i][column + j] = 0;\n }\n }\n } else {\n this.classList.add('wptb-highlighted');\n for (var i = 0; i < rs; i++) {\n for (var j = 0; j < cs; j++) {\n array[row + i][column + j] = 1;\n }\n }\n }\n\n let cellHighlighted = document.getElementsByClassName('wptb-highlighted'),\n markedCells = cellHighlighted.length;\n if (markedCells === 0) {\n for (var i = 0; i < multipleCells.length; i++) {\n multipleCells[i].classList.remove('visible');\n multipleCells[i].setAttribute('disabled', 'disabled');\n }\n for (var i = 0; i < noCells.length; i++) {\n noCells[i].classList.add('visible');\n noCells[i].removeAttribute('disabled');\n }\n for (var i = 0; i < singleCells.length; i++) {\n singleCells[i].classList.remove('visible');\n singleCells[i].setAttribute('disabled', 'disabled');\n }\n cellSettings.classList.remove( 'visible' );\n } else if (markedCells === 1) {\n for (var i = 0; i < multipleCells.length; i++) {\n multipleCells[i].classList.remove('visible');\n multipleCells[i].setAttribute('disabled', 'disabled');\n }\n for (var i = 0; i < noCells.length; i++) {\n noCells[i].classList.remove('visible');\n noCells[i].setAttribute('disabled', 'disabled');\n }\n for (var i = 0; i < singleCells.length; i++) {\n singleCells[i].classList.add('visible');\n singleCells[i].removeAttribute('disabled');\n }\n\n cellHighlighted = cellHighlighted[0];\n WPTB_Helper.elementOptionsSet( 'table_cell_setting', cellHighlighted );\n\n let infArr = cellHighlighted.className.match( /wptb-element-((.+-)\\d+)/i );\n\n const controlElemIds = ['cellWidth', 'cellHeight'];\n\n controlElemIds.map(s => {\n let elementControlSizeUnicClass = `wptb-el-${infArr[1]}-${s}`,\n elementControlSizeFixedUnicClass = `wptb-el-${infArr[1]}-${s}Fixed`;\n if(s === 'cellWidth' || s === 'cellHeight') {\n let sizeName = '',\n getSizeFunctionName = '';\n if(s === 'cellWidth') {\n sizeName = 'width';\n getSizeFunctionName = 'getColumnWidth';\n } else if(s === 'cellHeight') {\n sizeName = 'height';\n getSizeFunctionName = 'getRowHeight';\n }\n let size = cellHighlighted.style[sizeName],\n cellSizeInputs = document.querySelectorAll( '.' + elementControlSizeUnicClass ),\n cellSizeFixedInput = document.querySelector( '.' + elementControlSizeFixedUnicClass );\n cellSizeInputs = [...cellSizeInputs];\n\n if(!size && !cellHighlighted.dataset[`wptbFixed${sizeName.toUpperCase()}`]) {\n size = WPTB_Helper[getSizeFunctionName](table, cellHighlighted);\n cellSizeInputs.map(s => {\n s.value = size;\n });\n\n cellSizeFixedInput.checked = false;\n } else {\n cellSizeInputs.map(s => {\n if( size ) {\n s.value = parseFloat( size, 10 );\n } else if( cellHighlighted.dataset[`wptbFixed${sizeName.toUpperCase()}`] ) {\n s.value = cellHighlighted.dataset[`wptbFixed${sizeName.toUpperCase()}`];\n }\n });\n\n cellSizeFixedInput.checked = true;\n }\n }\n });\n\n cellSettings.classList.add( 'visible' );\n } else {\n for (var i = 0; i < multipleCells.length; i++) {\n if (table.isSquare(array)) {\n multipleCells[i].classList.add('visible');\n multipleCells[i].removeAttribute('disabled');\n } else {\n multipleCells[i].classList.remove('visible');\n multipleCells[i].setAttribute('disabled', 'disabled');\n }\n }\n for (var i = 0; i < noCells.length; i++) {\n noCells[i].classList.remove('visible');\n noCells[i].setAttribute('disabled', 'disabled');\n }\n for (var i = 0; i < singleCells.length; i++) {\n singleCells[i].classList.remove('visible');\n singleCells[i].setAttribute('disabled', 'disabled');\n }\n cellSettings.classList.remove( 'visible' );\n }\n };\n\n /* \n * This function fills an array with 1's according to the actual design\n * of HTML table.\n * @returns an array of arrays containing an abstract representation\n * of HTML table.\n * @deprecated\n * */\n\n var realTimeArray = function () {\n var carried = [], tds, cols, matriz = [];\n\n for (var i = 0; i < maxAmountOfCells; i++) {\n carried[i] = 0;\n }\n\n for (var i = 0; i < table.rows.length; i++) {\n cols = [];\n\n var tds = table.rows[i].getElementsByTagName('td');\n\n for (items = 0; items < tds.length; items++) {\n\n for (var k = 0; k < tds[items].colSpan; k++) {\n cols.push(1);\n }\n\n if (tds[items].rowSpan > 1) {\n for (var k = 0; k < tds[items].colSpan; k++) {\n carried[items + k] = {\n justAssigned: true,\n amount: tds[items].rowSpan\n };\n }\n }\n }\n\n for (var k = 0; k < maxAmountOfCells; k++) {\n if (typeof carried[k] == 'object' && carried[k].amount > 0) {\n carried[k].amount--;\n if (carried[k].justAssigned) {\n carried[k].justAssigned = false;\n } else {\n cols.push(1);\n }\n }\n }\n\n matriz.push(cols);\n\n }\n return matriz;\n };\n\n /*\n * This function gets the number and position of cell spaces in current row that are occuped \n * by upper rowspanned cells.\n * @param number the number of row where we wish to calculate the carried rowspans up to.\n * @return an array with the remaining rowspans in each column.\n */\n var carriedRowspans = function (row) {\n var carried = [], tds, cols;\n\n for (var i = 0; i < maxAmountOfCells; i++) {\n carried[i] = 0;\n }\n\n if (row == -1) {\n return carried;\n }\n\n for (var i = 0; i <= row; i++) {\n cellsBuffer = table.rows[i].getElementsByTagName('td');\n cellPointer = 0;\n\n for (var xPosition = 0; xPosition < maxAmountOfCells; xPosition += stepsToMove) {\n stepsToMove = 1;\n\n if (carried[xPosition]) {\n carried[xPosition]--;\n } else {\n celda = cellsBuffer[cellPointer++];\n if (celda.rowSpan > 1) {\n for (k = 0; k < celda.colSpan; k++) {\n carried[xPosition + k] = celda.rowSpan - 1;\n }\n stepsToMove = celda.colSpan;\n } else if (celda.colSpan > 1) {\n stepsToMove = celda.colSpan;\n }\n }\n }\n\n }\n return carried;\n };\n\n /*\n * A helpful function for showing\n * the abstract table in console.\n * @param Array our abstract table.\n */\n var drawTable = function (a) {\n var string = 'DRAWING TABLE:\\n';\n for (var i = 0; i < a.length; i++) {\n\n for (var j = 0; j < a[i].length; j++) {\n string += ' ' + a[i][j];\n }\n string += '\\n';\n }\n table.isSquare(a);\n };\n\n /*\n * It resets all the bits of our abstract representation\n * to 0 and removes the highlighting class of all cells.\n */\n\n var undoSelect = function () {\n var noCells = document.getElementsByClassName('wptb-no-cell-action'),\n singleCells = document.getElementsByClassName('wptb-single-action'),\n multipleCells = document.getElementsByClassName('wptb-multiple-select-action'),\n cellSettings = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ),\n tds = table.getElementsByClassName('wptb-highlighted');\n while (tds.length) {\n tds[0].classList.remove('wptb-highlighted');\n }\n cellSettings.classList.remove( 'visible' );\n for (var i = 0; i < array.length; i++) {\n for (var j = 0; j < array[i].length; j++) {\n array[i][j] = 0;\n }\n }\n for (var i = 0; i < multipleCells.length; i++) {\n multipleCells[i].classList.remove('visible');\n multipleCells[i].setAttribute('disabled', 'disabled');\n }\n for (var i = 0; i < noCells.length; i++) {\n noCells[i].classList.add('visible');\n noCells[i].removeAttribute('disabled');\n }\n for (var i = 0; i < singleCells.length; i++) {\n singleCells[i].classList.remove('visible');\n singleCells[i].setAttribute('disabled', 'disabled');\n }\n };\n\n /*\n * This fills the abstract representation of our table with \n * zeros, at the start. the max amount of cells is the greatest sum\n * of all colspans for row.\n */\n\n var fillTableArray = function () {\n var colspansSums = [], a = [];\n\n //calculate max amount of cells inside a row\n for (var i = 0; i < table.rows.length; i++) {\n var cells = table.rows[i].getElementsByTagName('td'),\n colspanSumInRow = 0;\n for (var j = 0; j < cells.length; j++) {\n colspanSumInRow += cells[j].colSpan;\n }\n colspansSums.push(colspanSumInRow);\n }\n\n maxAmountOfCells = Math.max.apply(null, colspansSums);\n //calculate max rows\n var maxAmountOfRows = table.rows.length;\n\n // fill with zeros from both values\n for (var i = 0; i < maxAmountOfRows; i++) {\n a[i] = [];\n for (var j = 0; j < maxAmountOfCells; j++) {\n a[i].push(0);\n }\n }\n drawTable(a);\n return a;\n };\n\n /*\n * This function gets the sum of all colspans in a row.\n * @param number the number of row to be used as reference.\n */\n var getActualPointsInRow = function (row) {\n var tds = table.rows[row].getElementsByTagName('td'),\n points = 0;\n for (var i = 0; i < tds.length; i++) {\n points += tds[i].colSpan;\n }\n return points;\n }\n\n /*\n * This function gets us the exact coordinates of\n * an exact cell, in a more reliable way than xIndex and yIndex,\n * these last ones were meant to be used for getting the cell trough them.\n * @param DOMElement the cell to get the coordinates.\n */\n var getCoords = function (search) {\n var skipInCols = [], cell;\n\n for (var i = 0; i < maxAmountOfCells; i++) {\n skipInCols[i] = 0;\n }\n\n for (var i = 0; i < table.rows.length; i++) {\n var cellsBuffer = table.rows[i].getElementsByTagName('td');\n cellPointer = 0;\n for (var xPosition = 0; xPosition < maxAmountOfCells; xPosition += stepsToMove) {\n stepsToMove = 1;\n\n if (skipInCols[xPosition]) {\n skipInCols[xPosition]--;\n } else {\n var td = cellsBuffer[cellPointer++];\n if (td == search) {\n return [i, xPosition];\n }\n if (td.rowSpan > 1) {\n for ( let k = 0; k < td.colSpan; k++ ) {\n skipInCols[xPosition + k] = td.rowSpan - 1;\n }\n stepsToMove = td.colSpan;\n } else if (td.colSpan > 1) {\n stepsToMove = td.colSpan;\n }\n }\n }\n }\n };\n\n jQuery('#wptb-table-border-color').val('');\n jQuery('#wptb-table-padding-number,#wptb-table-padding-slider').val('15');\n\n if ( columns || rows ) {\n //END OF PRIVATE FUNCTIONS\n for (var i = 0; i < settings.length; i++) {\n if (settings[i].id !== 'wptb-apply-inner-border') {\n settings[i].classList.add('visible');\n }\n }\n\n //Create a HTML Table element.\n table = document.createElement( 'table' );\n table.classList.add( 'wptb-preview-table', 'wptb-element-main-table_setting-startedid-0' );\n table.style.border = '0px solid';\n table.dataset.reconstraction = 1;\n //table.dataset.wptbAdaptiveTable = 1;\n //Add the data rows.\n for (var i = 0; i < rows; i++) {\n\n row = table.insertRow(-1);\n row.classList.add( 'wptb-row' );\n\n for (var j = 0; j < columns; j++) {\n cell = new WPTB_Cell(mark);\n cell.setCoords(i, j);\n cell.getDOMElement().style.borderWidth = '1px';\n row.appendChild(cell.getDOMElement());\n }\n }\n } else {\n if( ! wptb_preview_table ) wptb_preview_table = document.querySelector( '.wptb-preview-table' );\n\n if ( wptb_preview_table ) {\n table = wptb_preview_table;\n\n let cells = table.getElementsByTagName('td');\n\n if (cells.length > 0) {\n for (let i = 0; i < cells.length; i++) {\n WPTB_Cell(mark, cells[i]);\n }\n }\n } else {\n return;\n }\n }\n\n /*\n * For assigning to each cell xIndex and y Index attributes,\n * these are the column number and row number of cell in table. \n */\n\n table.recalculateIndexes = function () {\n WPTB_Helper.recalculateIndexes( this );\n }\n \n table.addColumnWidth = function( value, cleaner ) {\n let highlighted = table.getElementsByClassName( 'wptb-highlighted' );\n if( highlighted.length > 0 ) {\n for( let k = 0; k < highlighted.length; k++ ) {\n let dataXIndex = highlighted[k].dataset.xIndex;\n if( dataXIndex ) {\n function tableTdsFor( dataXIndex, colspan ) {\n let tableRows = table.rows;\n let widthIsSet = false;\n let arrayTdsFromPreviousRow = [];\n for( let i = 0; i < tableRows.length; i++ ) {\n let row = tableRows[i];\n let tds = row.children;\n for( let j = 0; j < tds.length; j++ ) {\n let td = tds[j];\n if( td.dataset.xIndex == dataXIndex ) {\n if( value ) {\n if( td.colSpan == colspan ) {\n td.style.width = value + 'px';\n td.removeAttribute( 'data-wptb-fixed-width' );\n widthIsSet = true;\n } else {\n td.style.width = null;\n td.dataset.wptbFixedWidth = value;\n if( i == tableRows.length - 1 && ! widthIsSet ) {\n tableTdsFor( dataXIndex, colspan + 1 );\n }\n }\n } else if( cleaner ) {\n td.style.width = null;\n td.removeAttribute( 'data-wptb-fixed-width' );\n } else {\n if( td.dataset.wptbFixedWidth ) {\n if( td.colSpan == colspan ) {\n td.style.width = td.dataset.wptbFixedWidth + 'px';\n td.removeAttribute( 'data-wptb-fixed-width' );\n } \n } else if( td.style.width ) {\n for( let z = 0; z < arrayTdsFromPreviousRow.length; z++ ) {\n arrayTdsFromPreviousRow[z].style.width = td.style.width;\n }\n arrayTdsFromPreviousRow = [];\n } else {\n arrayTdsFromPreviousRow.push( td );\n }\n }\n break;\n } \n }\n }\n }\n \n tableTdsFor( dataXIndex, 1 );\n }\n }\n \n table.tdDefaultWidth();\n }\n }\n \n table.tdDefaultWidth = function() {\n let rows = table.rows;\n \n let tableTdsSumMaxWidth = 0;\n let tableTdsSumMaxWidthFixed = 0;\n let tableTdsSumMaxWidthAuto = 0;\n \n let wptbTableSetup = document.getElementsByClassName( 'wptb-table-setup' )[0];\n let wptbTableSetupWidth = wptbTableSetup.offsetWidth;\n \n let arrayCellsWidthFixedHelper = [];\n let arrayCellsWidthAutoHelper = [];\n let tdPaddingCommon = 0;\n let tableTdBorderCommonWidth = 0;\n let cssForTdsWidthAuto = '';\n \n \n let tableFullStyleObj = window.getComputedStyle( table, null );\n let borderLeftWidth = tableFullStyleObj.getPropertyValue( 'border-left-width' );\n let borderRightWidth = tableFullStyleObj.getPropertyValue( 'border-right-width' );\n let tableBorderCommon = parseFloat( borderLeftWidth, 10 ) + parseFloat( borderRightWidth, 10 );\n \n for( let i = 0; i < rows.length; i++ ) {\n let tds = rows[i].children;\n for( let j = 0; j < tds.length; j++ ) {\n let td = tds[j];\n \n if( ! arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] && ! arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] ) {\n if( td.style.width ) {\n arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] = parseFloat( td.style.width );\n td.removeAttribute( 'data-wptb-css-td-auto-width' );\n } else {\n if( ! td.dataset.wptbFixedWidth ) {\n arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] = table.dataset.wptbTdWidthAuto ? parseFloat( table.dataset.wptbTdWidthAuto, 10 ) : 100;\n td.dataset.wptbCssTdAutoWidth = true;\n }\n }\n \n if( window.getComputedStyle( td, null ) ) {\n let tdStyleObj = window.getComputedStyle( td, null );\n let tdPaddingLeft = tdStyleObj.getPropertyValue( 'padding-left' );\n let tdPaddingRight = tdStyleObj.getPropertyValue( 'padding-right' );\n tdPaddingCommon = parseFloat( tdPaddingLeft, 10 ) + parseFloat( tdPaddingRight, 10 );\n\n let tableTdBorderLeftWidth = tdStyleObj.getPropertyValue( 'border-left-width' );\n let tableTdBorderRightWidth = tdStyleObj.getPropertyValue( 'border-right-width' );\n tableTdBorderCommonWidth = parseFloat( tableTdBorderLeftWidth, 10 ) + parseFloat( tableTdBorderRightWidth, 10 );\n tableTdBorderCommonWidth = tableTdBorderCommonWidth / 2;\n \n if( arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] ) {\n arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] += tdPaddingCommon;\n arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] += tableTdBorderCommonWidth;\n \n if( j == 0 && ( tableBorderCommon / 2 ) <= parseFloat( tableTdBorderLeftWidth, 10 ) ) {\n arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] += parseFloat( tableTdBorderLeftWidth, 10 ) / 2;\n } else if( j == 0 && ( tableBorderCommon / 2 ) > parseFloat( tableTdBorderLeftWidth, 10 ) ) {\n arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] += ( ( tableBorderCommon / 2 ) - ( parseFloat( tableTdBorderRightWidth, 10 ) / 2 ) );\n }\n\n if( j == tds.length - 1 && ( tableBorderCommon / 2 ) <= parseFloat( tableTdBorderRightWidth, 10 ) ) {\n arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] += parseFloat( tableTdBorderRightWidth, 10 ) / 2;\n } else if( j == tds.length - 1 && ( tableBorderCommon / 2 ) > parseFloat( tableTdBorderRightWidth, 10 ) ) {\n arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] += ( ( tableBorderCommon / 2 ) - ( parseFloat( tableTdBorderRightWidth, 10 ) / 2 ) );\n }\n } else if( arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] ) {\n arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] += tdPaddingCommon;\n arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] += tableTdBorderCommonWidth;\n \n if( j == 0 && ( tableBorderCommon / 2 ) <= parseFloat( tableTdBorderLeftWidth, 10 ) ) {\n arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] += parseFloat( tableTdBorderLeftWidth, 10 ) / 2;\n } else if( j == 0 && ( tableBorderCommon / 2 ) > parseFloat( tableTdBorderLeftWidth, 10 ) ) {\n arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] += ( ( tableBorderCommon / 2 ) - ( parseFloat( tableTdBorderLeftWidth, 10 ) / 2 ) );\n }\n\n if( j == tds.length - 1 && ( tableBorderCommon / 2 ) <= parseFloat( tableTdBorderRightWidth, 10 ) ) {\n arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] += parseFloat( tableTdBorderRightWidth, 10 ) / 2;\n } else if( j == tds.length - 1 && ( tableBorderCommon / 2 ) > parseFloat( tableTdBorderRightWidth, 10 ) ) {\n arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] += ( ( tableBorderCommon / 2 ) - ( parseFloat( tableTdBorderLeftWidth, 10 ) / 2 ) );\n }\n }\n }\n } else if( arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] ) {\n if( ! td.dataset.wptbFixedWidth ) {\n td.dataset.wptbCssTdAutoWidth = true;\n }\n } else if( arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] ) {\n td.removeAttribute( 'data-wptb-css-td-auto-width' );\n }\n }\n }\n \n for( let i = 0; i < arrayCellsWidthFixedHelper.length; i++ ) {\n if( arrayCellsWidthFixedHelper[i] ) {\n tableTdsSumMaxWidthFixed += arrayCellsWidthFixedHelper[i];\n }\n }\n \n let CellsWidthAutoCount = 0;\n for( let i = 0; i < arrayCellsWidthAutoHelper.length; i++ ) {\n if( arrayCellsWidthAutoHelper[i] ) {\n tableTdsSumMaxWidthAuto += arrayCellsWidthAutoHelper[i];\n CellsWidthAutoCount++;\n }\n }\n \n tableTdsSumMaxWidth = tableTdsSumMaxWidthFixed + tableTdsSumMaxWidthAuto;\n \n table.dataset.wptbTableTdsSumMaxWidth = tableTdsSumMaxWidth;\n if( CellsWidthAutoCount ) {\n table.dataset.wptbCellsWidthAutoCount = CellsWidthAutoCount;\n if( table.mergingСellsHorizontally ) {\n table.dataset.wptbFixedWidthSize = tableTdsSumMaxWidthFixed;\n } else {\n table.removeAttribute( 'data-wptb-fixed-width-size' );\n }\n } else {\n table.removeAttribute( 'data-wptb-fixed-width-size' );\n table.removeAttribute( 'data-wptb-cells-width-auto-count' );\n }\n \n let styleElementCreate = false;\n let tableTdWidthAuto;\n if( tableTdsSumMaxWidth < wptbTableSetupWidth ) {\n if( CellsWidthAutoCount ) {\n table.style.minWidth = '100%';\n if( table.mergingСellsHorizontally ) {\n table.style.width = 'auto';\n let tableTdsWidthAutoCommon = wptbTableSetupWidth - tableTdsSumMaxWidthFixed;\n tableTdWidthAuto = tableTdsWidthAutoCommon / CellsWidthAutoCount;\n tableTdWidthAuto = tableTdWidthAuto - tdPaddingCommon - tableTdBorderCommonWidth;\n styleElementCreate = true;\n } else {\n table.style.width = '100%';\n }\n } else {\n table.style.width = 'auto';\n table.style.minWidth = null;\n table.style.maxWidth = null;\n }\n } else {\n table.style.maxWidth = null;\n table.style.minWidth = tableTdsSumMaxWidth + 'px';\n table.style.width = 'auto';\n tableTdWidthAuto = table.dataset.wptbTdWidthAuto ? table.dataset.wptbTdWidthAuto : '100';\n styleElementCreate = true;\n }\n \n let head = document.head;\n if( head ) {\n let cssForTdsWidthAutoOld = head.querySelector( 'style[data-wptb-td-auto-width=\"true\"]' );\n if( cssForTdsWidthAutoOld ) {\n head.removeChild( cssForTdsWidthAutoOld );\n }\n }\n \n if( styleElementCreate ) {\n cssForTdsWidthAuto = document.createElement( 'style' );\n cssForTdsWidthAuto.setAttribute( 'data-wptb-td-auto-width', true );\n cssForTdsWidthAuto.innerHTML = '[data-wptb-css-td-auto-width=true]{width:' + tableTdWidthAuto + 'px}';\n if( head ) {\n head.appendChild( cssForTdsWidthAuto );\n }\n }\n \n if( table.dataset.wptbTableAlignment ) {\n let wptbTableAlignment = table.dataset.wptbTableAlignment;\n\n let wptbTableSetupWidth = wptbTableSetup.offsetWidth;\n if( wptbTableSetupWidth < table.offsetWidth ) {\n table.style.float = null;\n } else {\n if( wptbTableAlignment == 'center' ) {\n table.style.float = null;\n } else {\n table.style.float = wptbTableAlignment;\n }\n }\n\n if( wptbTableAlignment == 'center' ) {\n wptbTableSetup.style.float = null;\n } else {\n wptbTableSetup.style.float = wptbTableAlignment;\n }\n \n if( tableTdWidthAuto && table.dataset.wptbTableContainerMaxWidth && table.offsetWidth < table.dataset.wptbTableContainerMaxWidth ) {\n table.style.width = '100%';\n }\n } else {\n table.style.float = null;\n }\n }\n \n table.addRowHeight = function( value, cleaner ) {\n let highlighted = table.getElementsByClassName( 'wptb-highlighted' );\n if( highlighted.length > 0 ) {\n for( let k = 0; k < highlighted.length; k++ ) {\n let dataYIndex = highlighted[k].dataset.yIndex;\n if( dataYIndex ) {\n function tableTdsFor( dataYIndex, rowspan ) {\n let tableRows = table.rows;\n let heightIsSet = false;\n let arrayTdsPrevious = [];\n for( let i = 0; i < tableRows.length; i++ ) {\n let row = tableRows[i];\n let tds = row.children;\n for( let j = 0; j < tds.length; j++ ) {\n let td = tds[j];\n if( td.dataset.yIndex == dataYIndex ) {\n if( value ) {\n if( td.rowSpan == rowspan ) {\n td.style.height = value + 'px';\n td.removeAttribute( 'data-wptb-fixed-heidht' );\n heightIsSet = true;\n continue;\n } else {\n td.style.height = null;\n td.dataset.wptbFixedHeight = value;\n if( j == tds.length - 1 && ! heightIsSet ) {\n tableTdsFor( dataYIndex , rowspan + 1 );\n }\n }\n } else if( cleaner ) {\n td.style.height = null;\n td.removeAttribute( 'data-wptb-fixed-heidht' );\n } else {\n if( td.dataset.wptbFixedHeight ) {\n if( td.rowSpan = rowspan ) {\n td.style.height = td.dataset.wptbFixedHeight + 'px';\n td.removeAttribute( 'data-wptb-fixed-width' );\n }\n } else if( td.style.height ) {\n for( let z = 0; z < arrayTdsPrevious.length; z++ ) {\n arrayTdsPrevious[z].style.height = td.style.height;\n }\n arrayTdsPrevious = [];\n } else {\n arrayTdsPrevious.push( td );\n }\n }\n } \n }\n }\n }\n \n tableTdsFor( dataYIndex, 1 );\n }\n }\n }\n }\n \n table.reconstraction = function() {\n let tds = table.getElementsByTagName( 'td' );\n table.mergingСellsHorizontally = false;\n table.mergingCellsVertically = false;\n table.dataset.reconstraction = 1;\n let forBreak = 0;\n for( let i = 0; i < tds.length; i++ ) {\n if( tds[i].colSpan > 1 ) {\n table.dataset.reconstraction = 0;\n table.mergingСellsHorizontally = true;\n forBreak++;\n }\n \n if( tds[i].rowSpan > 1 ) {\n table.dataset.reconstraction = 0;\n table.mergingCellsVertically = true;\n forBreak++;\n }\n \n if( forBreak == 2 ) {\n break;\n }\n }\n }\n\n /*\n * As simple as it is: adds a column to the end of table.\n */\n table.addColumnEnd = function () {\n let td,\n currentTable = document.getElementsByClassName('wptb-preview-table'),\n currentTableTd,\n currentTdStyle;\n if (currentTable.length > 0) {\n currentTableTd = currentTable[0].querySelector('td');\n }\n\n if (currentTableTd) {\n currentTdStyle = currentTableTd.getAttribute('style');\n }\n \n for (var i = 0; i < table.rows.length; i++) {\n td = new WPTB_Cell(mark);\n \n if (currentTdStyle) {\n td.getDOMElement().setAttribute('style', currentTdStyle);\n td.getDOMElement().style.width = null;\n td.getDOMElement().style.height = null;\n }\n \n table.rows[i].appendChild(td.getDOMElement());\n array[i].push(0);\n }\n \n maxAmountOfCells++;\n table.recalculateIndexes();\n table.tdDefaultWidth();\n table.addRowHeight();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n /*\n * As simple as it looks: adds a column to the start of table.\n */\n\n table.addColumnStart = function () {\n let td,\n firstCell,\n currentTable = document.getElementsByClassName('wptb-preview-table'),\n currentTableTd,\n currentTdStyle;\n if ( currentTable.length > 0 ) {\n currentTableTd = currentTable[0].querySelector('td');\n }\n\n if ( currentTableTd ) {\n currentTdStyle = currentTableTd.getAttribute('style');\n }\n \n for (var i = 0; i < table.rows.length; i++) {\n td = new WPTB_Cell(mark);\n if (currentTdStyle) {\n td.getDOMElement().setAttribute('style', currentTdStyle);\n td.getDOMElement().style.width = null;\n td.getDOMElement().style.height = null;\n }\n firstCell = table.rows[i].getElementsByTagName('td')[0];\n if (firstCell) {\n table.rows[i].insertBefore(td.getDOMElement(), firstCell);\n } else {\n table.rows[i].appendChild(td.getDOMElement());\n }\n array[i].push(0);\n }\n\n maxAmountOfCells++;\n table.recalculateIndexes();\n table.tdDefaultWidth();\n table.addRowHeight();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n /*\n * Well, not so simple as previous functions.\n * It adds a column after a certain column of reference.\n * @param integer the column number to be used as reference.\n *\tIf empty, then the first highlighted cell is used as reference.\n */\n\n table.addColumnAfter = function (c_pos) {\n let rows = table.rows,\n cellPointer,\n cellsBuffer,\n cell = document.querySelector('.wptb-highlighted'),\n cellStyle = cell.getAttribute('style'),\n pos = c_pos != undefined && typeof c_pos === 'number' ? c_pos : getCoords(cell)[1];\n \n \n \n if( maxAmountOfCells - pos - cell.colSpan + 1 == 1 ) {\n table.addColumnEnd();\n } else {\n let pendingInsertion = false,\n stepsToMove,\n td, bro,\n carriedRowspans = [],\n currentCell;\n\n for (var i = 0; i < maxAmountOfCells; i++) {\n carriedRowspans.push(0);\n }\n\n for (var i = 0; i < rows.length; i++) {\n cellPointer = 0;\n cellsBuffer = rows[i].getElementsByTagName('td');\n pendingInsertion = false;\n for (var xPosition = 0;\n xPosition < maxAmountOfCells;\n xPosition += stepsToMove) {\n stepsToMove = 1;\n\n if (pendingInsertion) {\n td = new WPTB_Cell(mark);\n if (cellStyle) {\n td.getDOMElement().setAttribute('style', cellStyle);\n td.getDOMElement().style.width = null;\n td.getDOMElement().style.height = null;\n }\n if (currentCell && rows[i].contains(currentCell)) {\n bro = currentCell.nextSibling;\n if (bro) {\n rows[i].insertBefore(td.getDOMElement(), bro);\n } else {\n rows[i].appendChild(td.getDOMElement());\n }\n } else {\n rows[i].insertBefore(td.getDOMElement(), cellsBuffer[0]);\n }\n break;\n } else if (carriedRowspans[xPosition] > 0) {\n // If no pending insertion, let's check if no rowspan from upper cells is pending in current position\n if (pos == xPosition) {\n pendingInsertion = true;\n }\n } else {\n currentCell = cellsBuffer[cellPointer++];\n if (currentCell.rowSpan > 1) {\n stepsToMove = currentCell.colSpan;\n for (var k = 0; k < currentCell.colSpan; k++) {\n carriedRowspans[xPosition + k] = currentCell.rowSpan;\n if (xPosition + k == pos) {\n pendingInsertion = true;\n }\n }\n } else if (currentCell.colSpan > 1) {\n stepsToMove = currentCell.colSpan;\n for (var k = 0; k < currentCell.colSpan; k++) {\n if (xPosition + k == pos) {\n pendingInsertion = true;\n }\n }\n } else if (xPosition == pos) {\n pendingInsertion = true;\n }\n }\n }\n\n for (var l = 0; l < maxAmountOfCells; l++) {\n if (carriedRowspans[l] > 0)\n carriedRowspans[l]--;\n }\n\n }\n\n for (var i = 0; i < array.length; i++) {\n array[i].push(0);\n }\n maxAmountOfCells++;\n drawTable(array);\n table.recalculateIndexes();\n table.addColumnWidth();\n table.addRowHeight();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n };\n\n /*\n * For preventing us to take a lot of time,\n * This is just calling the function addColumnAfter, but\n * using the previous column to current one as reference.\n * @see addColumnAfter\n */\n\n table.addColumnBefore = function () {\n var cell = document.querySelector('.wptb-highlighted'),\n pos = getCoords(cell)[1];\n\n if (pos === 0) {\n table.addColumnStart();\n } else {\n table.addColumnAfter(pos - 1);\n }\n };\n\n /*\n * Luckily, thisfunction is simple, \n * it just add a row to the end of table.\n */\n\n table.addRowToTheEnd = function () {\n let r = table.insertRow(-1),\n td,\n aux,\n currentTable = document.getElementsByClassName('wptb-preview-table');\n r.classList.add( 'wptb-row' );\n if (currentTable.length > 0) {\n currentTable = currentTable[0];\n \n for (var i = 0; i < maxAmountOfCells; i++) {\n td = new WPTB_Cell(mark);\n let currentTableTd = currentTable.querySelector('[data-x-index=\"' + i + '\"]');\n if( currentTableTd ) {\n let currentTdStyle = currentTableTd.getAttribute( 'style' );\n \n td.getDOMElement().setAttribute( 'style', currentTdStyle );\n td.getDOMElement().style.height = null;\n }\n r.appendChild(td.getDOMElement());\n }\n \n aux = Array.from(array[0]);\n array.push(aux);\n drawTable(array);\n table.recalculateIndexes();\n WPTB_Helper.tableRowsColorsReinstall( table );\n table.addColumnWidth();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n };\n\n /*\n * Yet another simple function, \n * it just add a row to the start of table.\n */\n\n table.addRowToTheStart = function () {\n let r = table.insertRow(0),\n td,\n aux,\n currentTable = document.getElementsByClassName('wptb-preview-table'),\n currentTableTd,\n currentTdStyle;\n r.classList.add( 'wptb-row' );\n if (currentTable.length > 0) {\n currentTable = currentTable[0];\n \n for (var i = 0; i < maxAmountOfCells; i++) {\n td = new WPTB_Cell(mark);\n let currentTableTd = currentTable.querySelector('[data-x-index=\"' + i + '\"]');\n if( currentTableTd ) {\n let currentTdStyle = currentTableTd.getAttribute( 'style' );\n \n td.getDOMElement().setAttribute( 'style', currentTdStyle );\n td.getDOMElement().style.height = null;\n }\n r.appendChild(td.getDOMElement());\n }\n \n aux = Array.from(array[0]);\n array.push(aux);\n drawTable(array);\n table.recalculateIndexes();\n WPTB_Helper.tableRowsColorsReinstall( table );\n table.addColumnWidth();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n };\n\n /* \n * This function adds a row before the current one.\n * Since the biggest factor of problem is a not-started but ongoing rowspan,\n * the most of the troubles is not here.\n */\n\n table.addRowBefore = function () {\n let cell = document.querySelector('.wptb-highlighted'),\n cellStyle = cell.getAttribute('style'),\n row = getCoords(cell)[0],\n cellNew;\n for( let i = row - 1; i >= 0; i-- ) {\n let rowChildren = table.rows[i].children;\n let rowChildrenLength = rowChildren.length;\n if( rowChildrenLength > 0 ) {\n for( let j = 0; j < rowChildrenLength; j++ ) {\n if( rowChildren[j].rowSpan == 1 ) {\n row = i;\n cellNew = true;\n break;\n }\n }\n }\n if ( cellNew ) {\n break;\n }\n }\n\n if (row === 0) {\n table.addRowToTheStart();\n } else {\n table.addRowAfter( row, cellStyle );\n }\n };\n\n /*\n * Well... by the name convention of the previous 3 functions,\n * it's pretty obvious that this functions attaches a new\n * row after highlighted cell row. The greatest obstacle it was\n * the possibility of a TR not having the exact amount of columns\n * occuped by actual node but rowspanned upper cells. For that purpose\n * it was created the function realTimeArray.\n * @see realTimeArray\n */\n\n table.addRowAfter = function ( row, cellStyle ) {\n let cellRowSpan,\n rowAfter,\n aux;\n \n if ( ( row == undefined || typeof row !== 'number' ) && cellStyle == undefined ) {\n let cell = document.querySelector('.wptb-highlighted');\n cellStyle = cell.getAttribute('style'),\n row = getCoords(cell)[0],\n cellRowSpan = cell.rowSpan,\n rowAfter = row + cellRowSpan - 1;\n } else {\n rowAfter = row;\n }\n \n \n let cellsColSpan = 0;\n if ( rowAfter < table.rows.length -1 ) {\n for( let i = 0; i <= rowAfter ; i++ ) {\n let tableRowsIChildren = table.rows[i].children,\n tableRIChildrenLength = tableRowsIChildren.length;\n if( tableRIChildrenLength > 0 ) {\n for( let j = 0; j < tableRIChildrenLength; j++ ) {\n let rowIRowSpan = tableRowsIChildren[j].rowSpan;\n\n if ( rowIRowSpan - 1 + i > rowAfter ) {\n tableRowsIChildren[j].rowSpan++;\n }\n }\n }\n }\n \n let rNext = table.rows[rowAfter + 1],\n rNextChildren = rNext.children,\n rNextChildrenLength = rNextChildren.length;\n \n if( rNextChildrenLength > 0 ) {\n for ( let i = 0; i < rNextChildrenLength; i++ ) {\n cellsColSpan += rNextChildren[i].colSpan;\n }\n }\n } else {\n cellsColSpan = array[0].length;\n }\n \n let r = table.insertRow( rowAfter + 1 );\n r.classList.add( 'wptb-row' );\n \n for ( j = 0; j < cellsColSpan; j++ ) {\n let td = new WPTB_Cell( mark );\n td.getDOMElement().setAttribute( 'style', cellStyle );\n td.getDOMElement().style.width = null;\n td.getDOMElement().style.height = null;\n r.appendChild( td.getDOMElement() );\n }\n\n aux = Array.from(array[0]);\n array.push(aux);\n drawTable(array);\n table.recalculateIndexes();\n WPTB_Helper.tableRowsColorsReinstall( table );\n table.addColumnWidth();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after');\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n /*\n * This function checks the current selected cells\n * make a rectangular shape.\n * @param Array the abstract table.\n * @return false, if not making a rectangle, or\n *\tArray an array containing number of rows and columns, if selection makes a rectangle.\n */\n\n table.isSquare = function (a) {\n var rowStart = -1,\n columnStart = -1,\n rowEnd = -1,\n columnEnd = -1,\n height,\n width,\n itemsEstimate = 0,\n items = 0;\n\n for (var i = 0; i < a.length; i++) {\n for (var j = 0; j < a[i].length; j++) {\n if (a[i][j] == 1) {\n if ( j < columnStart || columnStart == -1 ) {\n columnStart = j;\n }\n if ( i < rowStart || rowStart == -1 ) {\n rowStart = i;\n }\n }\n }\n \n }\n\n for (var i = a.length - 1; i > -1; i--) {\n for (var j = a[i].length - 1; j > -1; j--) {\n if (a[i][j] == 1) {\n if ( j > columnEnd ) {\n columnEnd = j;\n }\n if ( i > rowEnd ) {\n rowEnd = i;\n }\n }\n }\n }\n\n for (var i = rowStart; i < rowEnd; i++) {\n for (var j = columnStart; j < columnEnd; j++) {\n if (a[i][j] == 0 || a[i][j] == undefined) {\n return false;\n }\n }\n }\n\n for (var i = 0; i < a.length; i++) {\n for (var j = 0; j < a[i].length; j++) {\n if (a[i][j] == 1) {\n items++;\n }\n }\n }\n\n height = rowEnd - rowStart + 1;\n width = columnEnd - columnStart + 1;\n itemsEstimate = height * width;\n\n if (itemsEstimate !== items) {\n return false;\n }\n return [height, width];\n };\n\n /*\n * This function merges all selected cells.\n * Well, actually sets the colspan and rowspan of first \n * upper left cell in selection and deletes the another selected cells.\n */\n\n table.mergeCells = function () {\n var dimensions = table.isSquare(array),\n rowspan = dimensions[0],\n colspan = dimensions[1],\n first = document.querySelector('.wptb-highlighted'),\n tds = [].slice.call(document.getElementsByClassName('wptb-highlighted'), 1),\n tdsChildrenNew = [];\n\n for (let i = 0; i < tds.length; i++) {\n let tdsInternalElements = tds[i].getElementsByClassName('wptb-ph-element');\n if (tdsInternalElements.length > 0) {\n let tdsIntElemLength = tdsInternalElements.length;\n for (let j = 0; j < tdsIntElemLength; j++) {\n tdsChildrenNew.push(tdsInternalElements[j]);\n }\n }\n let p = tds[i].parentNode;\n p.removeChild(tds[i]);\n }\n if (tdsChildrenNew.length > 0) {\n for (let i = 0; i < tdsChildrenNew.length; i++) {\n first.appendChild(tdsChildrenNew[i]);\n }\n }\n\n first.colSpan = colspan;\n first.rowSpan = rowspan;\n table.recalculateIndexes();\n table.reconstraction();\n let firstWidth = first.style.width;\n let firstDataFixedWidth = first.dataset.wptbFixedWidth;\n if( firstWidth ) {\n table.addColumnWidth( parseFloat( firstWidth, 10 ) );\n } else if( firstDataFixedWidth ) {\n table.addColumnWidth();\n } else {\n table.addColumnWidth( false, true );\n }\n \n let firstHeight = first.style.height;\n let firstDataFixedHeight = first.dataset.wptbFixedHeight;\n if( firstHeight ) {\n table.addRowHeight( parseFloat( firstHeight, 10 ) );\n } else if( firstDataFixedHeight ) {\n table.addRowHeight();\n } else {\n table.addRowHeight( false, true );\n }\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n /*\n * This functions makes the exact inverse as above.\n * It resets colspan and rowspan and appends \n * the same amount in cells to the table.\n * @bug\n */\n\n table.splitCell = function () {\n var cell = document.getElementsByClassName('wptb-highlighted')[0],\n rowspan = cell.rowSpan,\n colspan = cell.colSpan,\n cellStyles = cell.getAttribute('style'),\n row = getCoords(cell)[0],\n thisRow = table.rows[row],\n cellXIndex =cell.dataset.xIndex;\n \n cell.rowSpan = 1;\n cell.colSpan = 1;\n \n for (let i = 1; i < colspan; i++) {\n let td = new WPTB_Cell(mark);\n td.getDOMElement().setAttribute('style', cellStyles);\n td.getDOMElement().classList.add( 'wptb-highlighted' );\n if ( cell.nextSibling ) {\n thisRow.insertBefore( td.getDOMElement(), cell.nextSibling );\n } else {\n thisRow.appendChild( td.getDOMElement() );\n }\n \n }\n\n if (rowspan > 1) {\n for (let i = 1; i < rowspan; i++) {\n let rowChildInsertBefore = undefined,\n rowNext = table.rows[row + i],\n rowChildren = rowNext.children,\n rowChildrenLength = rowChildren.length;\n \n if ( rowChildrenLength > 0 ) {\n for ( let k = 0; k < rowChildrenLength; k++ ) {\n if ( Number( rowChildren[k].dataset.xIndex ) > Number( cellXIndex ) ) {\n rowChildInsertBefore = rowChildren[k];\n break;\n } \n }\n }\n for ( let j = 0; j < colspan; j++ ) {\n let td = new WPTB_Cell( mark );\n td.getDOMElement().setAttribute( 'style', cellStyles );\n if ( rowChildInsertBefore != undefined ) {\n rowNext.insertBefore( td.getDOMElement(), rowChildInsertBefore );\n } else {\n rowNext.appendChild( td.getDOMElement() );\n }\n }\n }\n }\n\n table.recalculateIndexes();\n table.reconstraction();\n table.addColumnWidth();\n table.addRowHeight();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n /*\n * Searches for rowspanned cells up to row number meeting it.\n * @param number the number of row where the function\n * must search up to.\n */\n\n table.findRowspannedCells = function (row) {\n var array = [],\n difference;\n actualPoints = getActualPointsInRow(row);\n if (actualPoints === maxAmountOfCells) {\n return [];\n }\n difference = maxAmountOfCells - actualPoints;\n\n for (var i = row - 1; i >= 0 && difference; i--) {\n var tds = table.rows[i].getElementsByTagName('td');\n for (var i = 0; i < tds.length; i++) {\n if (tds[i].rowSpan > 1) {\n array.push(tds[i]);\n difference -= tds[i].colSpan;\n }\n }\n }\n return array;\n\n }\n\n /*\n * This function explores the table and adds \n * a cell for each lacking one for each row\n * to meet an even amount of cells.\n */\n\n table.addLackingCells = function () {\n var sumRows = [];\n for (var i = 0; i < table.rows.length; i++) {\n sumRows.push(0);\n }\n\n for (var i = 0; i < table.rows.length; i++) {\n var tds = table.rows[i].getElementsByTagName('td');\n for (var j = 0; j < tds.length; j++) {\n if (tds[j].rowSpan > 1) {\n for (var k = 1; k < tds[j].rowSpan; k++) {\n sumRows[i + k]++;\n }\n }\n }\n }\n\n for (var i = 0; i < table.rows.length; i++) {\n var tds = table.rows[i].getElementsByTagName('td'),\n totalColspan = 0;\n for (var j = 0; j < tds.length; j++) {\n totalColspan += tds[j].colSpan;\n }\n totalColspan += sumRows[i];\n difference = maxAmountOfCells - totalColspan;\n for (var j = 0; j < difference; j++) {\n var td = new WPTB_Cell(mark);\n table.rows[i].appendChild(td.getDOMElement());\n //table.rows[i].insertBefore( td.getDOMElement(), rows[i].nextSibling );\n }\n }\n };\n\n /*\n * This function deletes the row of currently\n * selected cell. \n */\n\n table.deleteRow = function () {\n let cell = document.querySelector('.wptb-highlighted'),\n cellStyles = cell.getAttribute('style'),\n rowspan = cell.rowSpan,\n row = getCoords(cell)[0],\n thisRow,\n aux;\n \n if ( rowspan == undefined ) rowspan = 1;\n \n for ( let i = 0; i < rowspan; i++ ) {\n thisRow = table.rows[row];\n let thisRowChildren = thisRow.children,\n nextRow = table.rows[row + 1],\n nextRowChildren,\n nextRowChildrenLength,\n tdArr = [];\n\n if( nextRow != undefined ) {\n nextRowChildren = nextRow.children;\n nextRowChildrenLength = nextRowChildren.length;\n for (let j = 0; j < thisRowChildren.length; j++) {\n if ( thisRowChildren[j].rowSpan > 1 ) {\n let td = new WPTB_Cell(mark);\n td.getDOMElement().setAttribute('style', cellStyles);\n td.getDOMElement().colSpan = thisRowChildren[j].colSpan;\n td.getDOMElement().rowSpan = thisRowChildren[j].rowSpan - 1;\n\n let nextRowChildrenK = undefined;\n for ( let k = 0; k < nextRowChildrenLength; k++ ) {\n if ( Number( nextRowChildren[k].dataset.xIndex ) > Number( thisRowChildren[j].dataset.xIndex ) ) {\n nextRowChildrenK = nextRowChildren[k];\n break;\n } \n }\n\n if ( nextRowChildrenK ) {\n tdArr.push( [td, nextRowChildrenK] );\n } else {\n tdArr.push( [td] );\n }\n }\n }\n\n if ( tdArr.length > 0 ) {\n for ( let k = 0; k < tdArr.length; k++ ) {\n if ( tdArr[k][1] != undefined ) {\n nextRow.insertBefore( tdArr[k][0].getDOMElement(), tdArr[k][1] );\n } else {\n nextRow.appendChild( tdArr[k][0].getDOMElement() );\n }\n }\n }\n }\n \n let tableRows = table.rows;\n if ( tableRows.length > 0 ) {\n for ( let j = 0; j < row; j++ ) {\n let jRowChildren = tableRows[j].children;\n if ( jRowChildren.length > 0 ) {\n for ( let x = 0; x < jRowChildren.length; x++ ) {\n if ( jRowChildren[x].rowSpan - 1 >= row - j ) {\n jRowChildren[x].rowSpan--;\n }\n }\n }\n }\n }\n aux = Array.from(array[0]);\n array.pop(aux);\n drawTable(array);\n table.getElementsByTagName('tbody')[0].removeChild(table.rows[row]);\n \n if( table.rows.length == 0 ) {\n WPTB_Helper.toggleTableEditMode();\n wptbTableSetup.innerHTML = '';\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\n if( wptbSaveBtn.length > 0 ) {\n wptbSaveBtn = wptbSaveBtn[0];\n \n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\n wptbSaveBtn.classList.remove('active');\n }\n } else {\n table.recalculateIndexes();\n WPTB_Helper.tableRowsColorsReinstall( table );\n WPTB_Helper.dataTitleColumnSet( table );\n table.reconstraction();\n }\n }\n \n undoSelect();\n\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n\n /*\n * This function deletes the column of currently\n * selected cell. Again, this is way more complicated than\n * delete row case.\n */\n\n table.deleteColumn = function () {\n let cell = document.querySelector('.wptb-highlighted'),\n cellXIndex = cell.dataset.xIndex,\n colspan = cell.colSpan;\n \n for ( let i = 0; i < colspan; i++ ) {\n for ( let j = 0; j < table.rows.length; j++ ) {\n let rowChildren = table.rows[j].children;\n let rowChildrenLength = rowChildren.length;\n if( rowChildrenLength > 0 ) {\n for ( let k = rowChildrenLength - 1; k >= 0; k-- ) {\n if ( Number( rowChildren[k].dataset.xIndex ) == Number( cellXIndex ) ) {\n if ( rowChildren[k].colSpan > 1 ) {\n rowChildren[k].colSpan--;\n } else {\n table.rows[j].removeChild( rowChildren[k] );\n }\n break;\n } else if( Number( rowChildren[k].dataset.xIndex ) < Number( cellXIndex ) && \n Number( rowChildren[k].dataset.xIndex ) + \n Number( rowChildren[k].colSpan -1 ) >= cellXIndex ) {\n if ( rowChildren[k].colSpan > 1 ) {\n rowChildren[k].colSpan--;\n }\n break;\n }\n }\n }\n }\n \n for ( let j = 0; j < table.rows.length; j++ ) {\n if (array[j] != undefined)\n array[j].pop();\n }\n \n maxAmountOfCells--;\n \n if( table.querySelectorAll( 'td' ).length == 0 ) {\n WPTB_Helper.toggleTableEditMode();\n wptbTableSetup.innerHTML = '';\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\n if( wptbSaveBtn.length > 0 ) {\n wptbSaveBtn = wptbSaveBtn[0];\n \n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\n wptbSaveBtn.classList.remove('active');\n }\n } else {\n table.recalculateIndexes();\n table.tdDefaultWidth();\n WPTB_Helper.dataTitleColumnSet( table );\n table.reconstraction();\n }\n }\n \n undoSelect();\n\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'none';\n\n array = fillTableArray();\n\n undoSelect();\n drawTable(array);\n\n wptbTableSetup.appendChild(table);\n //if (columns || rows) {\n table.recalculateIndexes( true );\n //}\n table.reconstraction();\n table.tdDefaultWidth();\n \n wptbTableSetup.onresize = function() {\n table.tdDefaultWidth();\n };\n\n WPTB_LeftPanel();\n\n WPTB_Helper.elementStartScript( table, 'table_setting' );\n WPTB_Helper.elementOptionsSet( 'table_setting', table );\n \n // this code gets the ID of the active element in the toolbar \n // and stores it in the data attribute of the common container element \"wpcd_fixed_toolbar\"\n// let wptbPhElement = document.getElementsByClassName( 'wptb-ph-element' );\n// let wpcdFixedToolbar = document.getElementById( 'wpcd_fixed_toolbar' );\n// for ( let i = 0; i < wptbPhElement.length; i++ ) {\n// wptbPhElement[i].addEventListener( 'click', function( e ) {\n// let wptbToolbar = document.getElementById( 'wpcd_fixed_toolbar' ).children;\n// for ( let j = 0; j < wptbToolbar.length; j++ ) {\n// let elementStyles = window.getComputedStyle( wptbToolbar[j], 'null' );\n// if( elementStyles.getPropertyValue( 'display' ) == 'block' ) {\n// wpcdFixedToolbar.dataset.toolbarActiveId = wptbToolbar[j].getAttribute( 'id' );\n// }\n// }\n// }, false );\n// }\n \n// let wptbPanelLeft = document.getElementsByClassName( 'wptb-panel-left' );\n// if( wptbPanelLeft.length > 0 ) {\n// wptbPanelLeft[0].addEventListener( 'click', function( e ) {\n// let toolbarActiveElementId = wpcdFixedToolbar.dataset.toolbarActiveId;\n// document.getElementById( toolbarActiveElementId ).style.display = '';\n// }, false );\n// }\n \n// let body = document.getElementsByTagName( 'body' );\n// if( body.length > 0 ) {\n// body[0].addEventListener( 'click', function( e ) {\n// if ( e.target.classList.contains( 'wptb-panel-left' ) || WPTB_Helper.findAncestor( e.target, 'wptb-panel-left' ) ) {\n// let toolbarActiveElementId = wpcdFixedToolbar.dataset.toolbarActiveId;\n// document.getElementById( toolbarActiveElementId ).style.display = '';\n// }\n// }, false );\n// }\n};","var WPTB_TableStateSaveManager = function() {\n this.tableStateSet = ( generate ) => {\n \n if( generate && window.wptbTableStateSaving && Array.isArray( window.wptbTableStateSaving ) ) {\n return;\n }\n \n // get table setup\n let wptbTableSetup = document.getElementsByClassName( 'wptb-table-setup' );\n let wptbPreviewTable = '';\n if( wptbTableSetup.length > 0 ) {\n wptbTableSetup = wptbTableSetup[0];\n\n wptbPreviewTable = wptbTableSetup.querySelector( '.wptb-preview-table' );\n } else {\n wptbTableSetup = '';\n }\n\n\n \n // check if a global array doesn't exist with saved versions of the table \n // them create it\n if( ! window.wptbTableStateSaving && ! Array.isArray( window.wptbTableStateSaving ) ) {\n window.wptbTableStateSaving = [];\n } \n\n // remove the extra part of the array after changing the table \n // when it is showed in the not last modified version\n if( window.wptbTableStateSaving.length > window.wptbTableStateNumberShow ) {\n window.wptbTableStateSaving = window.wptbTableStateSaving.slice( 0, window.wptbTableStateNumberShow + 1 );\n }\n\n //add new state of table\n let wptbNewTableSetup = '';\n if( wptbTableSetup ) {\n wptbNewTableSetup = wptbTableSetup.cloneNode( true );\n let wptbHighlighted = wptbNewTableSetup.getElementsByClassName( 'wptb-highlighted' );\n for( let i = 0; i < wptbHighlighted.length; i++ ) {\n wptbHighlighted[i].classList.remove( 'wptb-highlighted' );\n }\n let wptbDirectlyhovered = wptbNewTableSetup.getElementsByClassName( 'wptb-directlyhovered' );\n for( let i = 0; i < wptbDirectlyhovered.length; i++ ) {\n wptbDirectlyhovered[i].classList.remove( 'wptb-directlyhovered' );\n }\n let mceContentBodys = wptbNewTableSetup.querySelectorAll( '.mce-content-body' );\n if( mceContentBodys.length > 0 ) {\n for ( let k = 0; k < mceContentBodys.length; k++ ) {\n mceContentBodys[k].classList.remove( 'mce-content-body' );\n }\n }\n let dataMceStyle = wptbNewTableSetup.querySelectorAll( '[data-mce-style]' );\n if ( dataMceStyle.length > 0 ) {\n for ( let k = 0; k < dataMceStyle.length; k++ ) {\n dataMceStyle[k].removeAttribute( 'data-mce-style' );\n }\n }\n let mceIds = wptbNewTableSetup.querySelectorAll( '[id^=mce_]' );\n if ( mceIds.length > 0 ) {\n for ( let k = 0; k < mceIds.length; k++ ) {\n mceIds[k].removeAttribute( 'id' );\n }\n }\n }\n\n let cssForTdsWidthAutoValue = '';\n let head = document.head;\n if( head ) {\n let cssForTdsWidthAuto = head.querySelector( 'style[data-wptb-td-auto-width=\"true\"]' );\n if( cssForTdsWidthAuto ) {\n cssForTdsWidthAutoValue = cssForTdsWidthAuto.innerHTML;\n }\n }\n\n let wptbTableTitle = '';\n let wptbSetupName = document.getElementById( 'wptb-setup-name' );\n if( wptbSetupName ) wptbTableTitle = wptbSetupName.value;\n\n window.wptbTableStateSaving.push( [wptbNewTableSetup, cssForTdsWidthAutoValue, wptbTableTitle] );\n\n // set new number of state which is showed now\n window.wptbTableStateNumberShow = window.wptbTableStateSaving.length - 1;\n\n // make undo arrow active when the table was changed\n if( window.wptbTableStateSaving.length - 1 > 0 ) {\n let wptbUndo = document.getElementsByClassName( 'wptb-undo' );\n if( wptbUndo.length > 0 ) {\n wptbUndo = wptbUndo[0];\n\n wptbUndo.classList.remove( 'wptb-undoredo-disabled' );\n }\n }\n\n // make redo arrow not active when the table was changed\n let wptbRedo = document.getElementsByClassName( 'wptb-redo' );\n if( wptbRedo.length > 0 ) {\n wptbRedo = wptbRedo[0];\n\n wptbRedo.classList.add( 'wptb-undoredo-disabled' );\n }\n\n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\n if( wptbSaveBtn.length > 0 ) {\n wptbSaveBtn = wptbSaveBtn[0];\n if( ( ! wptbSaveBtn.dataset.wptbTableStateNumberSave && window.wptbTableStateNumberShow == 0 ) || \n window.wptbTableStateNumberShow == wptbSaveBtn.dataset.wptbTableStateNumberSave || ! wptbPreviewTable ) {\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\n wptbSaveBtn.classList.remove('active');\n } else {\n wptbSaveBtn.classList.remove( 'wptb-save-disabled' );\n wptbSaveBtn.classList.add('active');\n }\n }\n }\n \n this.tableStateGet = ( datawptbUndoredo ) => {\n if( datawptbUndoredo && window.wptbTableStateSaving && window.wptbTableStateSaving.length > 0 ) {\n \n // changes the number of the state which displays now\n if( datawptbUndoredo == 'undo' ) {\n if( window.wptbTableStateNumberShow > 0 ) {\n window.wptbTableStateNumberShow--;\n } else {\n return false;\n }\n } else if( datawptbUndoredo == 'redo' ) {\n if( window.wptbTableStateNumberShow < window.wptbTableStateSaving.length ) {\n window.wptbTableStateNumberShow++;\n } else {\n return false;\n }\n }\n \n // add or delete class \"wptb-undoredo-disabled\" for undo button\n let wptbUndo = document.getElementsByClassName( 'wptb-undo' );\n if( wptbUndo.length > 0 ) {\n wptbUndo = wptbUndo[0];\n \n if( window.wptbTableStateNumberShow == 0 ) {\n if( wptbUndo ) {\n wptbUndo.classList.add( 'wptb-undoredo-disabled' );\n }\n } else if( window.wptbTableStateNumberShow > 0 ) {\n if( wptbUndo ) {\n wptbUndo.classList.remove( 'wptb-undoredo-disabled' );\n }\n }\n }\n \n // add or delete class \"wptb-undoredo-disabled\" for redo button\n let wptbRedo = document.getElementsByClassName( 'wptb-redo' );\n if( wptbRedo.length > 0 ) {\n wptbRedo = wptbRedo[0];\n \n if( window.wptbTableStateNumberShow == window.wptbTableStateSaving.length - 1 ) {\n if( wptbRedo ) {\n wptbRedo.classList.add( 'wptb-undoredo-disabled' );\n }\n } else if( window.wptbTableStateNumberShow < window.wptbTableStateSaving.length - 1 ) {\n if( wptbRedo ) {\n wptbRedo.classList.remove( 'wptb-undoredo-disabled' );\n }\n }\n }\n \n // add or delete class \"wptb-save-disabled\" for save button\n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\n if( wptbSaveBtn.length > 0 ) {\n wptbSaveBtn = wptbSaveBtn[0];\n if( ( ! wptbSaveBtn.dataset.wptbTableStateNumberSave && window.wptbTableStateNumberShow == 0 ) || \n window.wptbTableStateNumberShow == wptbSaveBtn.dataset.wptbTableStateNumberSave ) {\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\n wptbSaveBtn.classList.remove('active');\n } else {\n wptbSaveBtn.classList.add('active');\n wptbSaveBtn.classList.remove( 'wptb-save-disabled' );\n }\n }\n \n // load necessary saved table state\n let wptbTableSetup = document.getElementsByClassName( 'wptb-table-setup' );\n if( wptbTableSetup.length > 0 ) {\n wptbTableSetup = wptbTableSetup[0];\n\n //wptbTableSetup.outerHTML = '';\n if( window.wptbTableStateSaving[window.wptbTableStateNumberShow] ) {\n if( window.wptbTableStateSaving[window.wptbTableStateNumberShow][0] && \n typeof window.wptbTableStateSaving[window.wptbTableStateNumberShow][0] === 'object' ) {\n if( 'outerHTML' in window.wptbTableStateSaving[window.wptbTableStateNumberShow][0] ) {\n wptbTableSetup.outerHTML = window.wptbTableStateSaving[window.wptbTableStateNumberShow][0].outerHTML;\n }\n }\n\n let wptbTableSetupNew = document.querySelector( '.wptb-table-setup' );\n if( wptbTableSetupNew && wptbTableSetupNew.children.length == 0 ) {\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\n wptbSaveBtn.classList.remove('active');\n } else {\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'none';\n }\n\n // add or change or delete style element in the head for table cells who have auto width\n let head = document.head;\n if( head ) {\n let cssForTdsWidthAutoOld = head.querySelector( 'style[data-wptb-td-auto-width=\"true\"]' );\n if( cssForTdsWidthAutoOld ) {\n head.removeChild( cssForTdsWidthAutoOld );\n }\n\n if( window.wptbTableStateSaving[window.wptbTableStateNumberShow][1] ) {\n let cssForTdsWidthAuto = document.createElement( 'style' );\n cssForTdsWidthAuto.setAttribute( 'data-wptb-td-auto-width', true );\n cssForTdsWidthAuto.innerHTML = window.wptbTableStateSaving[window.wptbTableStateNumberShow][1];\n head.appendChild( cssForTdsWidthAuto );\n }\n }\n\n // change value of table title field\n let wptbSetupName = document.getElementById( 'wptb-setup-name' );\n if( typeof window.wptbTableStateSaving[window.wptbTableStateNumberShow][2] != 'undefined' ) {\n if( wptbSetupName ) wptbSetupName.value = window.wptbTableStateSaving[window.wptbTableStateNumberShow][2];\n }\n }\n \n let body = document.getElementsByTagName( 'body' );\n if( body.length > 0 ) {\n body = body[0];\n }\n\n WPTB_Helper.elementOptionsPanelClear();\n WPTB_LeftPanel();\n\n let wptbLeftScrollPanelCellSetting = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ); \n if( wptbLeftScrollPanelCellSetting ) {\n wptbLeftScrollPanelCellSetting.classList.remove( 'visible' );\n }\n }\n }\n }\n \n this.tableStateClear = function() {\n delete window.wptbTableStateSaving;\n delete window.wptbTableStateNumberShow;\n \n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\n if( wptbSaveBtn.length > 0 ) {\n wptbSaveBtn = wptbSaveBtn[0];\n \n wptbSaveBtn.removeAttribute( 'data-wptb-table-state-number-save' );\n }\n \n let wptbUndo = document.getElementsByClassName( 'wptb-undo' );\n if( wptbUndo.length > 0 ) {\n wptbUndo = wptbUndo[0];\n \n wptbUndo.classList.add( 'wptb-undoredo-disabled' );\n }\n \n let wptbRedo = document.getElementsByClassName( 'wptb-redo' );\n if( wptbRedo.length > 0 ) {\n wptbRedo = wptbRedo[0];\n\n wptbRedo.classList.add( 'wptb-undoredo-disabled' );\n }\n }\n}","var WPTB_innerElementSet = function ( element ) {\n \n element.ondragenter = function (e) {\n var div;\n if ( e.dataTransfer.types.indexOf( 'wptbelement' ) == -1 && e.dataTransfer.types.indexOf( 'wptb-moving-mode' ) == -1 ) {\n return;\n }\n WPTB_DropHandle(this, e);\n \n element.classList.add( 'wptb-ondragenter' );\n }\n element.ondragover = function (e) {\n e.preventDefault();\n WPTB_DropHandle(this, e);\n }\n element.ondragleave = function () {\n \n }\n element.ondrop = function(e) {\n this.classList.remove( 'wptb-ondragenter' );\n let element, classId;\n e.preventDefault();\n e.stopPropagation();\n\n if (!e.dataTransfer.getData('wptbElement') && !e.dataTransfer.getData('node')) {\n return;\n }\n let wptbDropHandle,\n wptbDropBorderMarker;\n if ( document.getElementsByClassName( 'wptb-drop-handle' ).length > 0 ) {\n wptbDropHandle = document.getElementsByClassName( 'wptb-drop-handle' )[0];\n }\n if( document.getElementsByClassName( 'wptb-drop-border-marker' ).length > 0 ) {\n wptbDropBorderMarker = document.getElementsByClassName( 'wptb-drop-border-marker' )[0];\n }\n\n if ( e.dataTransfer.getData( 'wptbElement' ) ) {\n element = WPTB_Helper.newElementProxy( e.dataTransfer.getData( 'wptbElement' ) );\n element = element.getDOMElement();\n } else {\n classId = e.dataTransfer.getData( 'node' );\n element = document.getElementsByClassName( classId )[0];\n //element.classList.remove( 'wptb-moving-mode' );\n }\n \n if( wptbDropHandle.style.display == 'block' ) {\n let td;\n if( wptbDropHandle.dataset.text == 'Drop Here' ) {\n td = wptbDropHandle.getDOMParentElement();\n td.appendChild( element );\n } else {\n let innerElement = wptbDropHandle.getDOMParentElement();\n td = innerElement.parentNode;\n\n if( wptbDropHandle.dataset.text == 'Above Element' ) {\n td.insertBefore( element, innerElement );\n } else if( wptbDropHandle.dataset.text == 'Below Element' ) {\n let innerElementNext = innerElement.nextSibling;\n td.insertBefore( element, innerElementNext );\n }\n }\n \n let thisRow = td.parentNode;\n if( WPTB_Helper.rowIsTop( thisRow ) ) { \n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\n \n if( table.classList.contains( 'wptb-table-preview-head' ) ) {\n WPTB_Helper.dataTitleColumnSet( table );\n }\n }\n \n // start item javascript if item is new\n let infArr = element.className.match(/wptb-element-(.+)-(\\d+)/i);\n let elemKind = infArr[1];\n if ( e.dataTransfer.getData( 'wptbElement' ) && ( elemKind == 'text' || elemKind == 'button' || elemKind == 'image' || elemKind == 'star_rating' || elemKind == 'list' ) ) {\n //WPTB_Helper.elementStartScript( element );\n }\n } else {\n return;\n }\n \n wptbDropHandle.style.display = 'none';\n wptbDropBorderMarker.style.display = 'none';\n\n WPTB_innerElementSet( element );\n \n if( ! element.classList.contains( 'wptb-image-container' ) || element.classList.contains( 'wptb-moving-mode' ) ) {\n element.classList.remove( 'wptb-moving-mode' );\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n } \n return true;\n }\n element.onmouseover = function(e) {\n element.classList.remove( 'wptb-ondragenter' );\n }\n}","var applyGenericItemSettings = function ( element, kindIndexProt, copy = false ) {\n var node = element.getDOMElement(),\n index,\n copy;\n if( node.classList.contains( 'wptb-ph-element' ) ) {\n if ( kindIndexProt == undefined || copy == true ) {\n //index = document.counter.nextIndex( element.kind );\n let wptbElements = document.getElementsByClassName( 'wptb-ph-element' );\n let elementIndexesArr = [];\n for( let i = 0; i < wptbElements.length; i++ ) {\n var regex = new RegExp( 'wptb-element-' + element.kind + '-(\\\\d+)', \"i\" );\n let infArr = wptbElements[i].className.match( regex );\n if( infArr ) {\n elementIndexesArr.push( infArr[1] );\n }\n }\n if( elementIndexesArr.length > 0 ) {\n let elementIndexMax = Math.max( ...elementIndexesArr );\n index = elementIndexMax + 1;\n } else { \n index = 1;\n }\n\n if( copy ) {\n // change all data-elements which save parameters for different controls\n let wptbNodeattributes = [...node.attributes];\n for( let i = 0; i < wptbNodeattributes.length; i++ ) {\n if( wptbNodeattributes[i] && typeof wptbNodeattributes[i] === 'object' && wptbNodeattributes[i].nodeName ) {\n let regularText = new RegExp( 'data-wptb-el-' + element.kind + '-(\\\\d+)-([a-zA-Z0-9_-]+)', \"i\" );\n let attr = wptbNodeattributes[i].nodeName.match( regularText );\n if( attr && Array.isArray( attr ) ) {\n let newDataAttributeName = wptbNodeattributes[i].nodeName.replace( element.kind + '-' + attr[1], element.kind + '-' + index );\n let newDataAttributeValue = wptbNodeattributes[i].nodeValue;\n node.removeAttribute( wptbNodeattributes[i].nodeName );\n node.setAttribute( newDataAttributeName, newDataAttributeValue );\n }\n }\n }\n }\n } else if ( kindIndexProt && ! copy ) {\n let kindIndexProtArr = kindIndexProt.split('-');\n index = kindIndexProtArr[kindIndexProtArr.length - 1];\n // start element javascript if element is new\n \n }\n\n let node_wptb_element_kind_num = node.className.match(/wptb-element-(.+)-(\\d+)/i);\n if ( node_wptb_element_kind_num ) {\n node.classList.remove( node_wptb_element_kind_num[0] );\n }\n if ( ! node.classList.contains( 'wptb-ph-element' ) ) {\n node.classList.add( 'wptb-ph-element' );\n if( ! node.classList.contains( 'wptb-element-' + element.kind + '-' + index ) ) {\n node.classList.add( 'wptb-element-' + element.kind + '-' + index );\n }\n } else {\n if( ! node.classList.contains( 'wptb-element-' + element.kind + '-' + index ) ) {\n node.classList.add( 'wptb-element-' + element.kind + '-' + index );\n }\n }\n WPTB_Helper.elementStartScript( element.getDOMElement() );\n new WPTB_ElementOptions( element, index, kindIndexProt );\n document.counter.increment(element.kind);\n }\n \n node.onmouseenter = function ( event ) {\n if( event.target.classList.contains( 'wptb-moving-mode' ) ) {\n return;\n }\n \n let wptbActionsField = new WPTB_ActionsField();\n \n wptbActionsField.addActionField( 1, node );\n \n wptbActionsField.setParameters( node );\n \n node.classList.remove( 'wptb-ondragenter' );\n };\n \n node.onmouseleave = function ( event ) {\n let wptbActionsField = new WPTB_ActionsField();\n \n wptbActionsField.leaveFromField( event, node );\n };\n};"]}
|
1 |
+
{"version":3,"sources":["applyGenericItemSettings.js","WPTB_ActionsField.js","WPTB_Builder.js","WPTB_Cell.js","WPTB_DropHandle.js","WPTB_ElementCounters.js","WPTB_ElementObject.js","WPTB_ElementOptions.js","WPTB_Helper.js","WPTB_Initializer.js","WPTB_innerElementSet.js","WPTB_LeftPanel.js","WPTB_MultipleSelect.js","WPTB_Parser.js","WPTB_Polyfills.js","WPTB_Responsive.js","WPTB_Settings.js","WPTB_Stringifier.js","WPTB_Table.js","WPTB_TableStateSaveManager.js"],"names":["applyGenericItemSettings","element","kindIndexProt","copy","node","getDOMElement","index","classList","contains","undefined","wptbElements","document","getElementsByClassName","elementIndexesArr","i","length","regex","RegExp","kind","infArr","className","match","push","elementIndexMax","Math","max","wptbNodeattributes","attributes","nodeName","regularText","attr","Array","isArray","newDataAttributeName","replace","newDataAttributeValue","nodeValue","removeAttribute","setAttribute","kindIndexProtArr","split","node_wptb_element_kind_num","remove","add","WPTB_Helper","elementStartScript","WPTB_ElementOptions","counter","increment","onmouseenter","event","target","wptbActionsField","WPTB_ActionsField","addActionField","setParameters","onmouseleave","leaveFromField","wptbActions","actionType","thisNode","body","getElementsByTagName","actions","previousNode","activeElem","parentNode","removeChild","btnDelete","btnCopy","createElement","appendChild","type","onclick","act","el","hasOwnProperty","thisRow","rowIsTop","table","findAncestor","dataTitleColumnSet","actionsRemove","wptbTableStateSaveManager","WPTB_TableStateSaveManager","tableStateSet","activeElement","activeElemParent","data","elemProt","tinyMceClear","WPTB_ElementObject","insertBefore","nextSibling","elementCopy","cloneNode","wptbDocumentEventGenerate","WPTB_innerElementSet","btnMove","draggable","ondragstart","wptbElementIconsDirectories","tmplIconsDirectories","wp","template","jsonIconsDirectories","IconsDirectories","JSON","parse","dragImages","getElementIcon","dataTransfer","effectAllowed","setDragImage","setData","style","display","actionsHide","ondragend","elementDragEndClear","coordinatesElement","getBoundingClientRect","wptbContainer","correctTop","top","parseFloat","removeEventListener","left","right","clientWidth","addEventListener","relatedTarget","opacity","WPTB_Builder","table_id","detectMode","http","XMLHttpRequest","urlSet","ajaxurl","open","setRequestHeader","onreadystatechange","d","readyState","status","ans","responseText","getElementById","value","wptbTableSetupEl","WPTB_Parser","WPTB_Table","querySelector","dataset","wptbTableContainerMaxWidth","maxWidth","tdDefaultWidth","WPTB_Settings","send","ElementCounters","select","MultipleSelect","initializer","WPTB_Initializer","settings","url","window","location","href","results","exec","WPTB_Cell","callback","DOMElement","highlightRow","td","parentRow","columnCount","parseInt","tds","classToAdd","ttd","highlightColumn","rowCount","tr","padding","jQuery","val","innerBorderWidth","border","ondblclick","stopPropagation","currentTarget","newElementProxy","wptbPhElement","wptbElementTypeClass","wptbTypeElementArr","wptbInternalActiveElement","j","wptbInternalActiveElementObj","setCoords","y","x","yIndex","xIndex","getCoords","coords","appendElement","getCellDimensions","tdStyleObj","getComputedStyle","tdPaddingLeft","getPropertyValue","tdPaddingRight","tdBorderLeftWidth","tdBorderRightWidth","tdPaddingTop","tdPaddingBottom","tdBorderTopWidth","tdBorderBottomWidth","width","offsetWidth","height","offsetHeight","borderCollapse","tableFullStyleObj","tableBorderLeft","tableBorderRight","tableBorderTop","tableBorderBottom","toLowerCase","firstChild","lastChild","WPTB_DropHandle","thisElem","e","wptbDropHandle","wptbDropBorderMarker","wptbDropBorderMarkerTop","wptbDropBorderMarkerRight","wptbDropBorderMarkerBottom","wptbDropBorderMarkerLeft","ondragenter","ondragover","preventDefault","ondragleave","ondrop","getData","wptbMovingMode","text","getDOMParentElement","innerElement","innerElementNext","onscroll","localName","indics","types","notDragEnter","indexOf","elementDrag","offsetY","layerY","bottom","priv","key","nextIndex","wpTemplateId","itemHtml","trim","innerHTML","wptbElementMutch","elementClearFromTinyMce","inElems","querySelectorAll","inElemObj","elementOptionsSet","capture","hexToRgb","hex","result","rgbToHex","rgb","isHex","rgbm","round","toString","toUpperCase","slice","test","icon_directory","hostName","protocol","hostname","img","src","wptbDropHandles","wptbDropBorderMarkers","linkHttpCheckChange","link","convertToAbs","currentLocation","origin","linkArr","linkClean","cls","parentElement","row","parent","children","getSelectionText","txt","getSelection","selection","createRange","elementOptionsPanelClear","elementOptionsGroup","wpColorPickerCheckChangeForTableStateSaving","originalEvent","wpPickerContainer","irisStripMouseUpStateSaveManager","wpColorPickerClear","attribute","isId","input","newInput","decodeURIComponent","getColumnWidth","cell","xIndexes","cellWidth","getRowHeight","yIndexes","cellHeight","wpColorPickerChange","ui","uiColor","color","classe","ps","number","affectedEl","backgroundColor","ratingStar","span","fill","wptbTextMessageSize","numberImputSize","wptbNumberInputs","maxCount","maxValue","onkeydown","thisValue","String","substring","onkeyup","ucfirst","str","charAt","eventName","details","CustomEvent","detail","bubbles","dispatchEvent","WPTB_ElementsScriptsLauncher","deleteEventHandlers","off","elementChildren","replaceAll","string","search","join","mceContentBodys","k","dataMceStyle","mceEditFocus","contentEditable","spellCheck","mceIds","elementOptionContainerCustomClassSet","targetInput","customClassForContainer","containerElement","elementOptionContainerAdditionalStyles","containerAdditionalStyles","containerStylesArrOne","containerStylesSet","containerStyleStr","containerStyleStrArr","controlsInclude","functionHandler","controlConnectFunctionsName","name","elementKind","elementOptionsGroupIds","optionsGroupIds","elementOptionsGroupId","controlActiveElements","map","controlInfArr","controlActiveElement","controlUnicClassName","controls","controlName","control","targetControlValue","targetControlValueGet","oneControlInclude","wptbContrlStacksConfigId","tmplControlsConfig","container","jsonControlsConfigJson","jsonControlsConfig","controlClassName","innerElementCopyIncludeHandler","appearDependOnControl","dependOn","targetControlElementClass","dependOnControlName","dependOnControlElementClass","dependOnControlElement","targetControlElement","controlContainerElem","showHideDependOnControlElement","dependOnControlElements","controlsStateManager","targetControlClass","controlChangeIndic","targetControls","selectorElement","elementsSettingsTemplatesJs","elementSettings","elementsSettings","stringify","checked","alignmentValue","elementControlsStateCopy","elementProt","copyElem","infArrProt","infArrCopy","elemProtKind","elemCopyKind","elementsSettingsTemplateJs","elementSettingsProt","elementSettingsCopy","Object","keys","forEach","elementSettingValue","elementSettingKeyCopy","elementControlsStateDelete","nameControl","wptbElementDatas","elementContainerClass","elementOptionClassIndic","controlElementParent","elementOptionsScriptsContainer","cellEditActiveClass","activateSection","wptbelementOptionClass","childNodes","elementOptionsGroupIdsInvolved","elementOptionsGroupInvolved","elementOptionsContainerInvolved","controlScriptsObj","controlappearDependOnControl","elementOptionsScriptsContainerIndic","controlKey","tmplControlTemplate","elemContainer","elementControlTargetUnicClass","controlTemplate","elementOptionsContainerInvolvedGet","elementOptionsContainer","elementOptionsGroupChildren","elementOptionsContainerOn","elementOptionContainerOn","elementOptionContainer","elementOptionClass","helperJavascriptElem","helperJavascriptCode","innerText","script","controlScriptsArr","managerExternalCssStyles","elementContainer","selector","cssName","cssValue","head","cssForThisElement","cssText","cssTextArrFirst","pop","selectorExists","cssTextArrSecond","cssTextArrThird","cssNameExists","cssTextArrFourth","splice","registerSections","sections","currentSection","sectionElement","s","sectionDataId","displayType","triggerSectionEvent","prototype","call","visibility","getCurrentSection","getSectionFromUrl","parsedUrl","URL","urlSection","searchParams","get","some","setupSectionButtons","sectionButtons","from","vm","sectionName","wptbSectionButton","wptbSectionDisplayType","setupPanelToggleButtons","$","each","find","click","slideToggle","toggleClass","sectionEvent","setupSidebarToggle","toggleSelector","toggleButton","toggle","externalCssStylesDelete","externalCssStylesCopy","copyElement","activeElemClass","cssForActiveElement","cssForNewElement","infArrCopyEl","cssForActiveElementInnerHTML","cssForNewElementInnerHTML","elementsStylesConvertToObject","stylesElements","stylesObj","styleElemId","getAttribute","elementsStylesSetFromObject","jsonObject","styleCss","saveTable","startSaving","previewSaving","wptbTableStateNumberSave","wptbTableStateNumberShow","bar","toggleTableEditMode","wptb_admin_object","t","messagingArea","code","datas","postId","rs","wptbId","paramIdsNecessaryChange","codeClone","wptbTableSetup","columns","WPTB_Stringifier","outerHTML","datas_containers","styleObjJson","messagingAreaText","setTimeout","params","title","content","elements_datas","elements_styles","security_code","preview_saving","id","action","builderPageUrl","history","pushState","wptbPreviewTable","wptbPreviewBtn","wptbPreviewBtnHref","previewHref","wptbSaveBtn","clickOnFreeSpace","cellModeBackground","wpcdFixedToolbar","hasAttribute","elementAjax","dataAjaxData","element_name","element_ajax_data","close","leftScrollPanelCurtain","leftScrollPanelCellSettings","toggleEditMode","deactivateMultipleSelectMode","wptbPreviewTableTds","activateMultipleSelectMode","checkingDimensionValue","dimension","searchIndex","checkSetGetStyleSizeValue","styleName","computedStyleName","elemStyleValue","elementStyles","checkSetGetStyleColorValue","set","elemStyleColorValue","checkSetGetStyleValue","getValueMaxCountSameElementsInArray","arr","check","maxPropName","recalculateIndexes","trs","maxCols","maxColsFull","tdsArr","jMainIter","colSpan","rowSpan","z","tableRowsColorsReinstall","tableIndex","tableHeaderBackground","tableEvenRowBackground","tableOddRowBackground","MIN_COLUMNS","MIN_ROWS","MAX_COLUMNS","MAX_ROWS","tableGenerator","columnsDecrementButton","columnsIncrementButton","rowsDecrementButton","rowsIncrementButton","columnsInput","rowsInput","rows","WptbResponsive","div","classId","elemKind","onmouseover","WPTB_LeftPanel","wptbElementButtons","wptbElement","wptbTablesEditModeCloseButton","addRowToTheEnd","addRowToTheStart","addRowBefore","addRowAfter","addColumnEnd","addColumnStart","addColumnBefore","addColumnAfter","deleteColumn","deleteRow","mergeCells","splitCell","wptbBuilderPanel","wptbHeader","selectedCells","multipleCellMode","isActivated","pushSelectedCell","flushSelectedCells","getFirst","minXIndex","minYIndex","first","getLast","maxXIndex","maxYIndex","last","removeAllButFirst","columnTitleMobile","hasDontEnumBug","propertyIsEnumerable","dontEnums","dontEnumsLength","obj","TypeError","prop","responsiveWrapperId","mainContainerQuery","responsiveTable","loaded","addContainerToDom","responsiveContainer","mainContainer","Error","range","setStart","responsiveElement","createContextualFragment","load","WPTB_ControlsManager","callControlScript","startUp","tablePreview","elems","wptbUndo","tableStateGet","wptbUndoredo","wptbUndoRedoContainer","wptbRedo","shortcodePopupWindow","onbeforeunload","wptbSaveDisabled","previewId","floor","random","newHref","tableTitleField","onchange","codeMain","tableColumns","minWidth","innerElements","wptbActionsLength","dataMceBogus","array","wptb_preview_table","maxAmountOfCells","maxAmountOfRows","mark","cs","noCells","singleCells","multipleCells","cellSettings","position","column","cellHighlighted","markedCells","controlElemIds","elementControlSizeUnicClass","elementControlSizeFixedUnicClass","sizeName","getSizeFunctionName","size","cellSizeInputs","cellSizeFixedInput","isSquare","countMarkedCells","realTimeArray","carried","cols","matriz","items","justAssigned","amount","carriedRowspans","cellsBuffer","cellPointer","xPosition","stepsToMove","celda","drawTable","a","undoSelect","fillTableArray","colspansSums","cells","colspanSumInRow","apply","getActualPointsInRow","points","skipInCols","reconstraction","insertRow","borderWidth","setMaxAmountOfCells","getMaxAmountOfCells","addColumnWidth","cleaner","highlighted","dataXIndex","tableTdsFor","colspan","tableRows","widthIsSet","arrayTdsFromPreviousRow","wptbFixedWidth","tableTdsSumMaxWidth","tableTdsSumMaxWidthFixed","tableTdsSumMaxWidthAuto","wptbTableSetupWidth","arrayCellsWidthFixedHelper","arrayCellsWidthAutoHelper","tdPaddingCommon","tableTdBorderCommonWidth","cssForTdsWidthAuto","borderLeftWidth","borderRightWidth","tableBorderCommon","wptbTdWidthAuto","wptbCssTdAutoWidth","tableTdBorderLeftWidth","tableTdBorderRightWidth","CellsWidthAutoCount","wptbTableTdsSumMaxWidth","wptbCellsWidthAutoCount","mergingСellsHorizontally","wptbFixedWidthSize","styleElementCreate","tableTdWidthAuto","tableTdsWidthAutoCommon","cssForTdsWidthAutoOld","wptbTableAlignment","float","addRowHeight","dataYIndex","rowspan","heightIsSet","arrayTdsPrevious","wptbFixedHeight","mergingCellsVertically","forBreak","currentTable","currentTableTd","currentTdStyle","firstCell","c_pos","cellStyle","pos","newTd","nextSib","r","aux","cellNew","rowChildren","rowChildrenLength","cellRowSpan","rowAfter","cellsColSpan","tableRowsIChildren","tableRIChildrenLength","rowIRowSpan","rNext","rNextChildren","rNextChildrenLength","rowStart","columnStart","rowEnd","columnEnd","itemsEstimate","dimensions","tdsChildrenNew","tdsInternalElements","tdsIntElemLength","p","firstWidth","firstDataFixedWidth","firstHeight","firstDataFixedHeight","cellStyles","cellXIndex","rowChildInsertBefore","rowNext","Number","findRowspannedCells","difference","actualPoints","addLackingCells","sumRows","totalColspan","thisRowChildren","nextRow","nextRowChildren","nextRowChildrenLength","tdArr","nextRowChildrenK","jRowChildren","onresize","generate","wptbTableStateSaving","wptbNewTableSetup","wptbHighlighted","wptbDirectlyhovered","cssForTdsWidthAutoValue","wptbTableTitle","wptbSetupName","datawptbUndoredo","wptbTableSetupNew","wptbLeftScrollPanelCellSetting","tableStateClear"],"mappings":";;;;AAAA,IAAIA,2BAA2B,SAA3BA,wBAA2B,CAAWC,OAAX,EAAoBC,aAApB,EAAkD;AAAA,QAAfC,IAAe,uEAAR,KAAQ;;AAC7E,QAAIC,OAAOH,QAAQI,aAAR,EAAX;AAAA,QACIC,KADJ;AAAA,QAEIH,IAFJ;AAGA,QAAIC,KAAKG,SAAL,CAAeC,QAAf,CAAyB,iBAAzB,CAAJ,EAAmD;AAC/C,YAAKN,iBAAiBO,SAAjB,IAA8BN,QAAQ,IAA3C,EAAkD;AAC9C;AACA,gBAAIO,eAAeC,SAASC,sBAAT,CAAiC,iBAAjC,CAAnB;AACA,gBAAIC,oBAAoB,EAAxB;AACA,iBAAK,IAAIC,IAAI,CAAb,EAAgBA,IAAIJ,aAAaK,MAAjC,EAAyCD,GAAzC,EAA+C;AAC3C,oBAAIE,QAAQ,IAAIC,MAAJ,CAAY,kBAAkBhB,QAAQiB,IAA1B,GAAiC,SAA7C,EAAwD,GAAxD,CAAZ;AACA,oBAAIC,SAAST,aAAaI,CAAb,EAAgBM,SAAhB,CAA0BC,KAA1B,CAAiCL,KAAjC,CAAb;A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ACJ,KA5HD;;AA8HA,SAAK81B,eAAL,GAAuB,YAAW;AAC9B,eAAOjuB,OAAOutB,oBAAd;AACA,eAAOvtB,OAAO0Y,wBAAd;;AAEA,YAAIqC,cAAc3kB,SAASC,sBAAT,CAAiC,eAAjC,CAAlB;AACA,YAAI0kB,YAAYvkB,MAAZ,GAAqB,CAAzB,EAA6B;AACzBukB,0BAAcA,YAAY,CAAZ,CAAd;;AAEAA,wBAAYjjB,eAAZ,CAA6B,mCAA7B;AACH;;AAED,YAAI0qB,WAAWpsB,SAASC,sBAAT,CAAiC,WAAjC,CAAf;AACA,YAAImsB,SAAShsB,MAAT,GAAkB,CAAtB,EAA0B;AACtBgsB,uBAAWA,SAAS,CAAT,CAAX;;AAEAA,qBAASxsB,SAAT,CAAmBoC,GAAnB,CAAwB,wBAAxB;AACH;;AAED,YAAIwqB,WAAWxsB,SAASC,sBAAT,CAAiC,WAAjC,CAAf;AACA,YAAIusB,SAASpsB,MAAT,GAAkB,CAAtB,EAA0B;AACtBosB,uBAAWA,SAAS,CAAT,CAAX;;AAEAA,qBAAS5sB,SAAT,CAAmBoC,GAAnB,CAAwB,wBAAxB;AACH;AACJ,KAxBD;AAyBH,CAzQD","file":"admin.js","sourcesContent":["var applyGenericItemSettings = function ( element, kindIndexProt, copy = false ) {\r\n var node = element.getDOMElement(),\r\n index,\r\n copy;\r\n if( node.classList.contains( 'wptb-ph-element' ) ) {\r\n if ( kindIndexProt == undefined || copy == true ) {\r\n //index = document.counter.nextIndex( element.kind );\r\n let wptbElements = document.getElementsByClassName( 'wptb-ph-element' );\r\n let elementIndexesArr = [];\r\n for( let i = 0; i < wptbElements.length; i++ ) {\r\n var regex = new RegExp( 'wptb-element-' + element.kind + '-(\\\\d+)', \"i\" );\r\n let infArr = wptbElements[i].className.match( regex );\r\n if( infArr ) {\r\n elementIndexesArr.push( infArr[1] );\r\n }\r\n }\r\n if( elementIndexesArr.length > 0 ) {\r\n let elementIndexMax = Math.max( ...elementIndexesArr );\r\n index = elementIndexMax + 1;\r\n } else { \r\n index = 1;\r\n }\r\n\r\n if( copy ) {\r\n // change all data-elements which save parameters for different controls\r\n let wptbNodeattributes = [...node.attributes];\r\n for( let i = 0; i < wptbNodeattributes.length; i++ ) {\r\n if( wptbNodeattributes[i] && typeof wptbNodeattributes[i] === 'object' && wptbNodeattributes[i].nodeName ) {\r\n let regularText = new RegExp( 'data-wptb-el-' + element.kind + '-(\\\\d+)-([a-zA-Z0-9_-]+)', \"i\" );\r\n let attr = wptbNodeattributes[i].nodeName.match( regularText );\r\n if( attr && Array.isArray( attr ) ) {\r\n let newDataAttributeName = wptbNodeattributes[i].nodeName.replace( element.kind + '-' + attr[1], element.kind + '-' + index );\r\n let newDataAttributeValue = wptbNodeattributes[i].nodeValue;\r\n node.removeAttribute( wptbNodeattributes[i].nodeName );\r\n node.setAttribute( newDataAttributeName, newDataAttributeValue );\r\n }\r\n }\r\n }\r\n }\r\n } else if ( kindIndexProt && ! copy ) {\r\n let kindIndexProtArr = kindIndexProt.split('-');\r\n index = kindIndexProtArr[kindIndexProtArr.length - 1];\r\n // start element javascript if element is new\r\n \r\n }\r\n\r\n let node_wptb_element_kind_num = node.className.match(/wptb-element-(.+)-(\\d+)/i);\r\n if ( node_wptb_element_kind_num ) {\r\n node.classList.remove( node_wptb_element_kind_num[0] );\r\n }\r\n if ( ! node.classList.contains( 'wptb-ph-element' ) ) {\r\n node.classList.add( 'wptb-ph-element' );\r\n if( ! node.classList.contains( 'wptb-element-' + element.kind + '-' + index ) ) {\r\n node.classList.add( 'wptb-element-' + element.kind + '-' + index );\r\n }\r\n } else {\r\n if( ! node.classList.contains( 'wptb-element-' + element.kind + '-' + index ) ) {\r\n node.classList.add( 'wptb-element-' + element.kind + '-' + index );\r\n }\r\n }\r\n WPTB_Helper.elementStartScript( element.getDOMElement() );\r\n new WPTB_ElementOptions( element, index, kindIndexProt );\r\n document.counter.increment(element.kind);\r\n }\r\n \r\n node.onmouseenter = function ( event ) {\r\n if( event.target.classList.contains( 'wptb-moving-mode' ) ) {\r\n return;\r\n }\r\n \r\n let wptbActionsField = new WPTB_ActionsField();\r\n \r\n wptbActionsField.addActionField( 1, node );\r\n \r\n wptbActionsField.setParameters( node );\r\n \r\n node.classList.remove( 'wptb-ondragenter' );\r\n };\r\n \r\n node.onmouseleave = function ( event ) {\r\n let wptbActionsField = new WPTB_ActionsField();\r\n \r\n wptbActionsField.leaveFromField( event, node );\r\n };\r\n};","var WPTB_ActionsField = function() {\r\n //this.wptbBorderMarker;\r\n this.wptbActions;\r\n if( document.getElementsByClassName( 'wptb-actions' ).length != 0 ) {\r\n this.wptbActions = document.getElementsByClassName( 'wptb-actions' )[0];\r\n }\r\n \r\n this.addActionField = ( actionType, thisNode ) => {\r\n let body = document.getElementsByTagName( 'body' )[0];\r\n \r\n let actions = document.getElementsByClassName( 'wptb-actions' );\r\n if( actions.length != 0 ) {\r\n let previousNode = actions[0].activeElem;\r\n if( previousNode ) {\r\n previousNode.classList.remove( 'wptb-directlyhovered' );\r\n }\r\n \r\n while( actions.length != 0 ) {\r\n actions[0].parentNode.removeChild( actions[0] );\r\n }\r\n }\r\n \r\n if( actionType == 1 ) {\r\n \r\n let btnDelete, btnCopy;\r\n\r\n btnDelete = document.createElement( 'span' ),\r\n btnCopy = document.createElement( 'span' ),\r\n actions = document.createElement( 'div' );\r\n\r\n actions.classList.add( 'wptb-actions' );\r\n btnDelete.classList.add( 'dashicons', 'dashicons-trash', 'wptb-delete-action' );\r\n btnCopy.classList.add( 'dashicons', 'dashicons-admin-page', 'wptb-duplicate-action' );\r\n \r\n actions.appendChild( btnCopy );\r\n actions.appendChild( btnDelete );\r\n \r\n body.appendChild( actions );\r\n\r\n actions.activeElem = thisNode;\r\n\r\n actions.type = 1;\r\n\r\n btnDelete.onclick = function( event ) {\r\n let act = event.target.parentNode.activeElem,\r\n el = act.parentNode;\r\n let infArr = act.className.match( /wptb-element-(.+)-(\\d+)/i );\r\n// if( act && infArr && Array.isArray( infArr ) ) {\r\n// WPTB_Helper.elementControlsStateDelete( act );\r\n// WPTB_Helper.externalCssStylesDelete( infArr[0] );\r\n// }\r\n \r\n if( act ) {\r\n el.removeChild( act );\r\n }\r\n\r\n if( act && typeof act === 'object' && act.hasOwnProperty( 'kind' ) && act.kind == 'text' ) {\r\n let thisRow = el.parentNode;\r\n \r\n if( WPTB_Helper.rowIsTop( thisRow ) ) {\r\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\r\n\r\n if( table.classList.contains( 'wptb-table-preview-head' ) ) {\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n }\r\n }\r\n\r\n let wptbActionsField = new WPTB_ActionsField();\r\n wptbActionsField.actionsRemove();\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n btnCopy.onclick = ( event ) => {\r\n let copy,\r\n infArr,\r\n type;\r\n let activeElement = event.target.parentNode.activeElem;\r\n let activeElemParent = activeElement.parentNode;\r\n infArr = activeElement.className.match( /wptb-element-(.+)-(\\d+)/i );\r\n if( infArr && Array.isArray( infArr ) ) {\r\n type = infArr[1];\r\n let data = {};\r\n data.kind = type;\r\n data.elemProt = activeElement;\r\n data.tinyMceClear = true;\r\n copy = new WPTB_ElementObject( data );\r\n //WPTB_Helper.elementControlsStateCopy( activeElement, copy.getDOMElement() );\r\n //WPTB_Helper.externalCssStylesCopy( activeElement, copy.getDOMElement() );\r\n //WPTB_Helper.elementStartScript( copy.getDOMElement() );\r\n \r\n activeElemParent.insertBefore( copy.getDOMElement(), activeElement.nextSibling );\r\n } else {\r\n copy = {};\r\n let elementCopy = activeElement.cloneNode( true );\r\n elementCopy.classList.remove( 'wptb-directlyhovered' );\r\n \r\n copy.getDOMElement = function() {\r\n return elementCopy;\r\n }\r\n \r\n applyGenericItemSettings( copy );\r\n \r\n activeElemParent.insertBefore( copy.getDOMElement(), activeElement.nextSibling );\r\n \r\n WPTB_Helper.wptbDocumentEventGenerate( 'wptb-inner-element:copy', activeElement, copy.getDOMElement() );\r\n }\r\n \r\n WPTB_innerElementSet( copy.getDOMElement() );\r\n\r\n let wptbActionsField = new WPTB_ActionsField( 1, activeElement );\r\n wptbActionsField.setParameters( activeElement );\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n \r\n \r\n if( thisNode.classList.contains( 'wptb-ph-element' ) ) {\r\n let btnMove;\r\n btnMove = document.createElement( 'span' );\r\n btnMove.classList.add( \"dashicons\", \"dashicons-move\", 'wptb-move-action' );\r\n btnMove.draggable = true;\r\n actions.appendChild( btnMove );\r\n \r\n btnMove.ondragstart = ( event ) => {\r\n let wptbElementIconsDirectories = 'wptb-element-icons-directories';\r\n let tmplIconsDirectories = wp.template( wptbElementIconsDirectories );\r\n let data = {};\r\n let jsonIconsDirectories = tmplIconsDirectories( data );\r\n let IconsDirectories = JSON.parse( jsonIconsDirectories );\r\n\r\n let dragImages,\r\n actions = event.target.parentNode,\r\n activeElem = actions.activeElem,\r\n infArr,\r\n type;\r\n infArr = activeElem.className.match( /wptb-element-(.+)-(\\d+)/i );\r\n if( infArr && Array.isArray( infArr ) ) {\r\n type = infArr[1];\r\n activeElem.classList.add( 'wptb-moving-mode' );\r\n\r\n if( IconsDirectories && typeof IconsDirectories === 'object' && IconsDirectories[type] ) {\r\n dragImages = WPTB_Helper.getElementIcon( IconsDirectories[type] );\r\n }\r\n\r\n event.dataTransfer.effectAllowed = 'move';\r\n event.dataTransfer.setDragImage( dragImages, 0, 0 );\r\n event.dataTransfer.setData( 'node', 'wptb-element-' + infArr[1] + '-' + infArr[2] );\r\n event.dataTransfer.setData( 'wptb-moving-mode', 'wptb-element-' + infArr[1] + '-' + infArr[2] );\r\n event.dataTransfer.setData( 'wptbElIndic-' + infArr[1], 'wptbElIndic-' + infArr[1] );\r\n let act = event.target.parentNode.activeElem;\r\n if( act.kind == 'text' ) {\r\n let thisRow = act.parentNode.parentNode;\r\n \r\n if( WPTB_Helper.rowIsTop( thisRow ) ) {\r\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\r\n\r\n if( table.classList.contains( 'wptb-table-preview-head' ) ) {\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n }\r\n }\r\n } else {\r\n this.style.display = 'none';\r\n }\r\n\r\n this.actionsHide();\r\n };\r\n\r\n btnMove.ondragend = ( event ) => {\r\n WPTB_Helper.elementDragEndClear();\r\n }\r\n }\r\n\r\n actions.style.display = 'flex';\r\n\r\n this.wptbActions = actions;\r\n } \r\n }\r\n \r\n this.setParameters = ( thisNode ) => {\r\n \r\n if( ! this.wptbActions ) {\r\n let actions = document.getElementsByClassName( 'wptb-actions' );\r\n if( actions.length > 0 ) {\r\n this.wptbActions = actions[0];\r\n } else {\r\n this.wptbActions = false;\r\n }\r\n }\r\n \r\n if( this.wptbActions && this.wptbActions.classList.contains( 'wptb-actions' ) ) {\r\n this.wptbActions.style.display = 'flex';\r\n } else {\r\n return;\r\n }\r\n \r\n let coordinatesElement = thisNode.getBoundingClientRect();\r\n \r\n let wptbContainer = document.getElementsByClassName( 'wptb-container' )[0];\r\n let correctTop = () => {\r\n let coordinatesElement = thisNode.getBoundingClientRect();\r\n this.wptbActions.style.top = parseFloat( coordinatesElement.top ) - 15 + 'px';\r\n }\r\n wptbContainer.removeEventListener( 'scroll', correctTop, false );\r\n \r\n this.wptbActions.style.top = parseFloat( coordinatesElement.top ) - 15 + 'px';\r\n this.wptbActions.style.left = ( parseFloat( coordinatesElement.right ) - parseFloat( this.wptbActions.clientWidth ) ) + 1 + 'px';\r\n \r\n this.wptbActions.style.display = 'flex';\r\n thisNode.classList.add( 'wptb-directlyhovered' );\r\n \r\n wptbContainer.addEventListener( 'scroll', correctTop, false );\r\n }\r\n \r\n this.leaveFromField = ( event, node, actionType ) => {\r\n if( ! this.wptbActions ) {\r\n let actions = document.getElementsByClassName( 'wptb-actions' );\r\n if( actions.length > 0 ) {\r\n this.wptbActions = actions[0];\r\n } else {\r\n this.wptbActions = false;\r\n }\r\n }\r\n \r\n if( ! this.wptbActions ) {\r\n return;\r\n }\r\n \r\n if( event.relatedTarget ) {\r\n if ( event.relatedTarget.classList.contains( 'wptb-actions' ) ||\r\n event.relatedTarget.classList.contains( 'wptb-move-action' ) ||\r\n event.relatedTarget.classList.contains( 'wptb-duplicate-action' ) ||\r\n event.relatedTarget.classList.contains( 'wptb-delete-action' ) ) {\r\n if( ! this.wptbActions ) {\r\n this.wptbActions = document.getElementsByClassName( 'wptb-actions' )[0];\r\n }\r\n this.wptbActions.onmouseleave = ( event ) => {\r\n if( event.relatedTarget != null && ( event.relatedTarget.classList.contains( 'wptb-ph-element' ) || \r\n WPTB_Helper.findAncestor( event.relatedTarget, 'wptb-ph-element') ) && event.relatedTarget != this.wptbActions.activeElem &&\r\n WPTB_Helper.findAncestor( event.relatedTarget, 'wptb-directlyhovered' ) != this.wptbActions.activeElem ) {\r\n \r\n// this.wptbActions.style.display = 'none';\r\n// event.relatedTarget.parentNode.parentNode.classList.remove( 'wptb-directlyhovered' );\r\n//\r\n// let wptbActionsField = new WPTB_ActionsField();\r\n//\r\n// wptbActionsField.addActionField( 1, event.relatedTarget.parentNode.parentNode );\r\n//\r\n// wptbActionsField.setParameters( event.relatedTarget.parentNode.parentNode );\r\n } else {\r\n \r\n }\r\n \r\n let wptbActionsField = new WPTB_ActionsField();\r\n\r\n wptbActionsField.leaveFromField( event, event.relatedTarget.parentNode.parentNode );\r\n \r\n event.target.activeElem.classList.remove( 'wptb-directlyhovered' );\r\n }\r\n\r\n return;\r\n } \r\n }\r\n \r\n node.classList.remove( 'wptb-directlyhovered' );\r\n this.wptbActions.style.display = 'none';\r\n \r\n if( event.relatedTarget ) {\r\n if( event.relatedTarget.classList.contains( 'wptb-ph-element' ) || WPTB_Helper.findAncestor( event.relatedTarget, 'wptb-ph-element' ) ) {\r\n this.addActionField( 1, event.relatedTarget.parentNode );\r\n\r\n this.setParameters( event.relatedTarget.parentNode );\r\n }\r\n }\r\n }\r\n \r\n this.actionsRemove = () => {\r\n if( ! this.wptbActions ) {\r\n let actions = document.getElementsByClassName( 'wptb-actions' );\r\n if( actions.length > 0 ) {\r\n this.wptbActions = actions[0];\r\n }\r\n }\r\n \r\n if( this.wptbActions ) {\r\n this.wptbActions.parentNode.removeChild( this.wptbActions );\r\n }\r\n }\r\n \r\n this.actionsHide = () => {\r\n if( ! this.wptbActions ) {\r\n let actions = document.getElementsByClassName( 'wptb-actions' );\r\n if( actions.length > 0 ) {\r\n this.wptbActions = actions[0];\r\n }\r\n }\r\n \r\n if( this.wptbActions ) {\r\n this.wptbActions.style.opacity = 0;\r\n }\r\n }\r\n}","(function () {\r\n var WPTB_Builder = function () {\r\n var table_id = WPTB_Helper.detectMode();\r\n if ( table_id ) {\r\n var http = new XMLHttpRequest(),\r\n urlSet = ajaxurl + \"?action=get_table\" + '&id=' + table_id;\r\n http.open('GET', urlSet, true);\r\n http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');\r\n http.onreadystatechange = function (d) {\r\n if (this.readyState == 4 && this.status == 200) {\r\n var ans = JSON.parse( http.responseText );\r\n document.getElementById('wptb-setup-name').value = ans[0];\r\n \r\n if( ans[1] ) {\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'none';\r\n let wptbTableSetupEl = document.getElementsByClassName('wptb-table-setup')[0];\r\n wptbTableSetupEl.appendChild( WPTB_Parser( ans[1] ) );\r\n \r\n let body = document.getElementsByTagName('body')[0];\r\n \r\n WPTB_Table();\r\n let element = document.querySelector( '.wptb-preview-table' );\r\n if( element ) {\r\n let infArr = element.className.match( /wptb-element-((.+-)\\d+)/i );\r\n if( ! infArr ) {\r\n element.classList.add( 'wptb-element-main-table_setting-' + table_id );\r\n }\r\n \r\n if( element.dataset.wptbTableContainerMaxWidth ) {\r\n wptbTableSetupEl.style.maxWidth = element.dataset.wptbTableContainerMaxWidth + 'px';\r\n \r\n element.tdDefaultWidth();\r\n }\r\n }\r\n \r\n //WPTB_LeftPanel();\r\n WPTB_Settings();\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n } else {\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\r\n }\r\n \r\n return;\r\n }\r\n };\r\n http.send(null);\r\n } else {\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n document.counter = new ElementCounters();\r\n document.select = new MultipleSelect();\r\n\r\n var initializer = WPTB_Initializer();\r\n settings = WPTB_Settings();\r\n };\r\n\r\n let url = window.location.href,\r\n regex = new RegExp('[?&]page=wptb-builder'),\r\n results = regex.exec( url );\r\n if ( results ) {\r\n document.addEventListener('DOMContentLoaded', WPTB_Builder);\r\n }\r\n})();","var WPTB_Cell = function ( callback, DOMElement ) {\r\n\r\n function highlightRow(td) {\r\n var parentRow = td.parentNode,\r\n columnCount = parseInt(document.getElementById('wptb-columns-number').value),\r\n tds = document.getElementsByClassName('wptb-preview-table')[0].getElementsByTagName('td');\r\n for (var i = 0; i < tds.length; i++) {\r\n tds[i].classList.remove('wptb-highlighted-row-first', 'wptb-highlighted-row-last', 'wptb-highlighted-row-inner', 'wptb-highlighted-column-first', 'wptb-highlighted-column-last', 'wptb-highlighted-column-inner');\r\n }\r\n for (var i = 0; i < columnCount; i++) {\r\n\r\n var classToAdd = i == 0 ? 'wptb-highlighted-row-first' : i == columnCount - 1 ? 'wptb-highlighted-row-last' : 'wptb-highlighted-row-inner';\r\n var ttd = parentRow.getElementsByTagName('td')[i];\r\n if (ttd !== td) {\r\n ttd.classList.add(classToAdd);\r\n }\r\n }\r\n }\r\n\r\n function highlightColumn(td) {\r\n\r\n var index,\r\n parentRow = td.parentNode;\r\n columnCount = parseInt(document.getElementById('wptb-columns-number').value), rowCount = parseInt(document.getElementById('wptb-rows-number').value), table = document.getElementsByClassName('wptb-preview-table')[0];\r\n for (var i = 0; i < columnCount; i++) {\r\n if (parentRow.getElementsByTagName('td')[i] === td) {\r\n index = i;\r\n break;\r\n }\r\n }\r\n\r\n for (var i = 0; i < rowCount; i++) {\r\n var classToAdd = i == 0 ? 'wptb-highlighted-column-first' : i == rowCount - 1 ? 'wptb-highlighted-column-last' : 'wptb-highlighted-column-inner';\r\n var tr = table.getElementsByTagName('tr')[i];\r\n if (tr.getElementsByTagName('td')[index] !== td) {\r\n tr.getElementsByTagName('td')[index].classList.add(classToAdd);\r\n }\r\n }\r\n }\r\n \r\n if( ! DOMElement ) {\r\n DOMElement = document.createElement(\"td\");\r\n\r\n DOMElement.style.padding = jQuery('#wptb-table-padding-number').val() + 'px';\r\n\r\n var innerBorderWidth = jQuery('#wptb-table-inner-border-number').val();\r\n\r\n if (innerBorderWidth != '' && parseInt(innerBorderWidth) != 0) {\r\n DOMElement.style.border = innerBorderWidth + 'px solid ' + jQuery('#wptb-table-border-color').val();\r\n } \r\n\r\n DOMElement.classList.add('wptb-droppable', 'wptb-cell');\r\n }\r\n\r\n DOMElement.draggable = false;\r\n if ( callback ) {\r\n DOMElement.onclick = callback;\r\n }\r\n \r\n // Cell double click handler\r\n DOMElement.ondblclick = function( event ) {\r\n event.stopPropagation();\r\n if( ! WPTB_Helper.findAncestor( DOMElement, 'wptb-preview-table-manage-cells' ) && event.target == event.currentTarget ) {\r\n \r\n WPTB_Helper.wptbDocumentEventGenerate( 'table:cell:dblclick', event.target );\r\n \r\n let element = WPTB_Helper.newElementProxy( 'text' );\r\n element = element.getDOMElement();\r\n \r\n DOMElement.appendChild( element );\r\n \r\n WPTB_innerElementSet( element );\r\n }\r\n }\r\n \r\n WPTB_innerElementSet( DOMElement );\r\n\r\n WPTB_Helper.elementStartScript( DOMElement, 'table_cell_setting' );\r\n\r\n let wptbPhElement = DOMElement.getElementsByClassName( 'wptb-ph-element' );\r\n \r\n if ( wptbPhElement.length > 0 ) {\r\n for( let i = 0; i < wptbPhElement.length; i++ ) {\r\n wptbPhElement[i].getDOMElement = function() {\r\n return wptbPhElement[i];\r\n }\r\n \r\n WPTB_innerElementSet( wptbPhElement[i] );\r\n \r\n let wptbElementTypeClass = wptbPhElement[i].className.match( /wptb-element-((.+-)\\d+)/i );\r\n if( wptbElementTypeClass && Array.isArray( wptbElementTypeClass ) ) {\r\n let wptbTypeElementArr = wptbElementTypeClass[1].split( '-' );\r\n wptbPhElement[i].kind = wptbTypeElementArr[0];\r\n applyGenericItemSettings( wptbPhElement[i], wptbElementTypeClass[1] );\r\n let wptbInternalActiveElement = wptbPhElement[i].getElementsByClassName( 'wptb-in-element' );\r\n if ( wptbInternalActiveElement.length > 0 ) {\r\n for ( let j = 0; j < wptbInternalActiveElement.length; j++ ) {\r\n let wptbInternalActiveElementObj = {};\r\n wptbInternalActiveElementObj.getDOMElement = function() {\r\n return wptbInternalActiveElement[j];\r\n }\r\n \r\n applyGenericItemSettings( wptbInternalActiveElementObj );\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n this.getDOMElement = function () {\r\n return DOMElement;\r\n };\r\n\r\n this.setCoords = function (y, x) {\r\n var el = this.getDOMElement();\r\n el.dataset.yIndex = y;\r\n el.dataset.xIndex = x;\r\n };\r\n\r\n this.getCoords = function () {\r\n var coords,\r\n el = this.getDOMElement();\r\n coords.x = el.dataset.xIndex;\r\n coords.y = el.dataset.yIndex;\r\n return coords;\r\n };\r\n\r\n this.appendElement = function (node) {\r\n getDOMElement().appendChild(node);\r\n };\r\n \r\n DOMElement.getCellDimensions = function() {\r\n\r\n let tdStyleObj = window.getComputedStyle( this, null );\r\n\r\n let tdPaddingLeft = tdStyleObj.getPropertyValue( 'padding-left' );\r\n let tdPaddingRight = tdStyleObj.getPropertyValue( 'padding-right' );\r\n\r\n let tdBorderLeftWidth = tdStyleObj.getPropertyValue( 'border-left-width' );\r\n let tdBorderRightWidth = tdStyleObj.getPropertyValue( 'border-right-width' );\r\n\r\n let tdPaddingTop = tdStyleObj.getPropertyValue( 'padding-top' );\r\n let tdPaddingBottom = tdStyleObj.getPropertyValue( 'padding-bottom' );\r\n\r\n let tdBorderTopWidth = tdStyleObj.getPropertyValue( 'border-top-width' );\r\n let tdBorderBottomWidth = tdStyleObj.getPropertyValue( 'border-bottom-width' );\r\n\r\n let width = parseInt( this.offsetWidth, 10 ) -\r\n parseInt( tdPaddingLeft, 10 ) -\r\n parseInt( tdPaddingRight, 10 );\r\n\r\n let height = parseInt( this.offsetHeight, 10 ) -\r\n parseInt( tdPaddingTop, 10 ) -\r\n parseInt( tdPaddingBottom, 10 );\r\n let table = WPTB_Helper.findAncestor( this, 'wptb-preview-table' );\r\n if(table) {\r\n if(table.style.borderCollapse === 'collapse') {\r\n width = width - ( parseInt( tdBorderLeftWidth, 10 ) / 2 ) -\r\n ( parseInt( tdBorderRightWidth, 10 ) / 2 );\r\n height = height - ( parseInt( tdBorderTopWidth, 10 ) / 2 ) -\r\n ( parseInt( tdBorderBottomWidth, 10 ) / 2 );\r\n let tableFullStyleObj = window.getComputedStyle( table, null );\r\n let tableBorderLeft = tableFullStyleObj.getPropertyValue( 'border-left-width' );\r\n let tableBorderRight = tableFullStyleObj.getPropertyValue( 'border-right-width' );\r\n let tableBorderTop = tableFullStyleObj.getPropertyValue( 'border-top-width' );\r\n let tableBorderBottom = tableFullStyleObj.getPropertyValue( 'border-bottom-width' );\r\n\r\n let tr = this.parentNode;\r\n if( tr && tr.nodeName.toLowerCase() === 'tr' ) {\r\n if( tr.firstChild && tr.firstChild.dataset.xIndex === this.dataset.xIndex ) {\r\n if( parseInt( tableBorderLeft, 10 ) > parseInt( tdBorderLeftWidth, 10 ) ) {\r\n width += -( parseInt( tableBorderLeft, 10 ) - parseInt( tdBorderLeftWidth, 10 ) ) / 2;\r\n }\r\n }\r\n\r\n if( tr.lastChild && tr.lastChild.dataset.xIndex === this.dataset.xIndex ) {\r\n if( parseInt( tableBorderRight, 10 ) > parseInt( tdBorderRightWidth, 10 ) ) {\r\n width += -( parseInt( tableBorderRight, 10 ) - parseInt( tdBorderRightWidth, 10 ) ) / 2;\r\n }\r\n }\r\n\r\n let body = tr.parentNode;\r\n if( body && body.nodeName.toLowerCase() === 'body' ) {\r\n if( body.firstChild && body.firstChild.firstChild.dataset.yIndex === this.dataset.yIndex ) {\r\n if( parseInt( tableBorderTop, 10 ) > parseInt( tdBorderTopWidth, 10 ) ) {\r\n height += ( parseInt( tableBorderTop, 10 ) - parseInt( tdBorderTopWidth, 10 ) ) / 2;\r\n }\r\n }\r\n\r\n if( body.lastChild && body.lastChild.firstChild.dataset.yIndex === this.dataset.yIndex ) {\r\n if( parseInt( tableBorderBottom, 10 ) > parseInt( tdBorderBottomWidth, 10 ) ) {\r\n height += ( parseInt( tableBorderBottom, 10 ) - parseInt( tdBorderBottomWidth, 10 ) ) / 2;\r\n }\r\n }\r\n }\r\n }\r\n } else if(table.style.borderCollapse === 'separate') {\r\n width = width - parseInt( tdBorderLeftWidth, 10 ) -\r\n parseInt( tdBorderRightWidth, 10 );\r\n height = height - parseInt( tdBorderTopWidth, 10 ) -\r\n parseInt( tdBorderBottomWidth, 10 );\r\n }\r\n }\r\n\r\n return {\r\n width: parseInt( width ),\r\n height: parseInt( height )\r\n };\r\n }\r\n\r\n return this;\r\n};","var WPTB_DropHandle = function (thisElem, e) {\r\n \r\n let wptbDropHandle,\r\n wptbDropBorderMarker,\r\n wptbDropBorderMarkerTop,\r\n wptbDropBorderMarkerRight,\r\n wptbDropBorderMarkerBottom,\r\n wptbDropBorderMarkerLeft;\r\n if ( document.getElementsByClassName( 'wptb-drop-handle' ).length == 0 ) {\r\n wptbDropHandle = document.createElement( 'div' );\r\n wptbDropHandle.classList.add( 'wptb-drop-handle' );\r\n \r\n wptbDropBorderMarker = document.createElement( 'div' );\r\n wptbDropBorderMarker.classList.add( 'wptb-drop-border-marker' );\r\n \r\n wptbDropBorderMarkerTop = document.createElement( 'div' ),\r\n wptbDropBorderMarkerRight = document.createElement( 'div' ),\r\n wptbDropBorderMarkerBottom = document.createElement( 'div' ),\r\n wptbDropBorderMarkerLeft = document.createElement( 'div' );\r\n \r\n wptbDropBorderMarkerTop.classList.add( 'wptb-drop-border-marker-top' );\r\n wptbDropBorderMarkerRight.classList.add( 'wptb-drop-border-marker-right' );\r\n wptbDropBorderMarkerBottom.classList.add( 'wptb-drop-border-marker-bottom' );\r\n wptbDropBorderMarkerLeft.classList.add( 'wptb-drop-border-marker-left' );\r\n \r\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerTop );\r\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerRight );\r\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerBottom );\r\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerLeft );\r\n \r\n let body = document.getElementsByTagName( 'body' );\r\n if ( body.length > 0 ) {\r\n body[0].appendChild( wptbDropHandle );\r\n body[0].appendChild( wptbDropBorderMarker );\r\n }\r\n \r\n wptbDropHandle.ondragenter = function () {\r\n\r\n }\r\n\r\n wptbDropHandle.ondragover = function (e) {\r\n e.preventDefault();\r\n }\r\n\r\n wptbDropHandle.ondragleave = function () {\r\n\r\n }\r\n wptbDropHandle.ondrop = function (e) {\r\n e.preventDefault();\r\n let element;\r\n \r\n if ( e.dataTransfer.getData('wptbElement') ) {\r\n element = WPTB_Helper.newElementProxy( e.dataTransfer.getData('wptbElement') );\r\n element = element.getDOMElement();\r\n } else {\r\n element = document.getElementsByClassName( e.dataTransfer.getData('node') )[0];\r\n element.classList.remove( 'wptb-moving-mode' );\r\n element.classList.remove( 'wptb-moving-into-same-elem' );\r\n element.wptbMovingMode = 1;\r\n }\r\n \r\n let td;\r\n if( wptbDropHandle.dataset.text == 'Drop Here' ) {\r\n thisElem = wptbDropHandle.getDOMParentElement();\r\n if ( thisElem.nodeName.toLowerCase() == 'td' ) {\r\n td = wptbDropHandle.getDOMParentElement();\r\n td.appendChild( element );\r\n }\r\n } else {\r\n let innerElement = wptbDropHandle.getDOMParentElement();\r\n td = innerElement.parentNode;\r\n \r\n if( wptbDropHandle.dataset.text == 'Above Element' ) {\r\n td.insertBefore( element, innerElement );\r\n } else if( wptbDropHandle.dataset.text == 'Below Element' ) {\r\n let innerElementNext = innerElement.nextSibling;\r\n td.insertBefore( element, innerElementNext );\r\n }\r\n }\r\n \r\n let thisRow = td.parentNode;\r\n if( WPTB_Helper.rowIsTop( thisRow ) ) {\r\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\r\n\r\n if( table.classList.contains( 'wptb-table-preview-head' ) ) {\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n }\r\n \r\n wptbDropHandle.style.display = 'none';\r\n wptbDropBorderMarker.style.display = 'none';\r\n \r\n WPTB_innerElementSet( element );\r\n if( ! element.classList.contains( 'wptb-image-container' ) || element.wptbMovingMode == 1 ) {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n element.wptbMovingMode == undefined;\r\n }\r\n }\r\n let wptbContainer = document.querySelector( '.wptb-container' );\r\n wptbContainer.onscroll = function() {\r\n wptbDropHandle.style.display = 'none';\r\n wptbDropBorderMarker.style.display = 'none';\r\n }\r\n } else {\r\n wptbDropHandle = document.getElementsByClassName( 'wptb-drop-handle' )[0];\r\n wptbDropBorderMarker = document.getElementsByClassName( 'wptb-drop-border-marker' )[0];\r\n }\r\n if( thisElem && thisElem.nodeName.toLowerCase() == 'td' && \r\n thisElem.getElementsByClassName( 'wptb-ph-element' ).length != 0 ) {\r\n return;\r\n }\r\n \r\n let thisRow;\r\n if ( thisElem.localName == 'td' ) {\r\n thisRow = thisElem.parentNode;\r\n } else if ( thisElem.localName == 'div' && thisElem.classList.contains( 'wptb-ph-element' ) ) {\r\n thisRow = thisElem.parentNode.parentNode;\r\n }\r\n \r\n if( WPTB_Helper.rowIsTop( thisRow ) ) {\r\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\r\n \r\n if( table.classList.contains( 'wptb-table-preview-head' ) ) {\r\n let indics = e.dataTransfer.types;\r\n let notDragEnter = false;\r\n for ( let i = 0; i < indics.length; i++ ) {\r\n let infArr = indics[i].match( /wptbelindic-([a-z]+)/i );\r\n if ( infArr && infArr[1] != 'text' ) {\r\n notDragEnter = true;\r\n break;\r\n }\r\n }\r\n if( notDragEnter ) {\r\n return;\r\n }\r\n }\r\n }\r\n \r\n wptbDropHandle.style.width = thisElem.offsetWidth + 'px';\r\n let height = thisElem.offsetHeight,\r\n coordinatesElement = thisElem.getBoundingClientRect(),\r\n left = parseFloat( coordinatesElement.left ),\r\n top;\r\n wptbDropHandle.style.left = left + 'px';\r\n \r\n if( e.dataTransfer.types.indexOf( 'wptb-moving-mode' ) != -1 ) {\r\n let elementDrag = document.getElementsByClassName( 'wptb-moving-mode' )[0];\r\n if( thisElem == elementDrag ) {\r\n wptbDropHandle.classList.add('wptb-moving-into-same-elem');\r\n wptbDropBorderMarker.classList.add('wptb-moving-into-same-elem');\r\n } else {\r\n wptbDropHandle.classList.remove('wptb-moving-into-same-elem');\r\n wptbDropBorderMarker.classList.remove('wptb-moving-into-same-elem');\r\n }\r\n }\r\n \r\n wptbDropHandle.getDOMParentElement = function() {\r\n return thisElem;\r\n }\r\n \r\n wptbDropHandle.style.display = 'block';\r\n wptbDropBorderMarker.style.display = 'block';\r\n if( thisElem.nodeName.toLowerCase() != 'td' ) {\r\n let y = e.offsetY==undefined?e.layerY:e.offsetY;\r\n top = parseFloat( coordinatesElement.top ) - parseFloat( 11 );\r\n wptbDropHandle.dataset.text = 'Above Element';\r\n if ( y > height/2 ) {\r\n top = parseFloat( coordinatesElement.top ) + height - 1;\r\n wptbDropHandle.dataset.text = 'Below Element';\r\n }\r\n } else {\r\n wptbDropHandle.dataset.text = 'Drop Here';\r\n top = parseFloat( coordinatesElement.top ) + height/2 - 5;\r\n }\r\n wptbDropHandle.style.top = top + 'px';\r\n\r\n wptbDropBorderMarker.style.top = coordinatesElement.top + 'px';\r\n wptbDropBorderMarker.style.left = coordinatesElement.left + 'px';\r\n\r\n wptbDropBorderMarkerTop = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-top' );\r\n wptbDropBorderMarkerTop.style.width = ( parseFloat( thisElem.offsetWidth ) - parseFloat( 1 ) ) + 'px';\r\n\r\n wptbDropBorderMarkerRight = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-right' );\r\n wptbDropBorderMarkerRight.style.height = ( parseFloat( coordinatesElement.bottom ) - parseFloat( coordinatesElement.top ) - 1 ) + 'px';\r\n wptbDropBorderMarkerRight.style.left = wptbDropBorderMarkerTop.style.width;\r\n\r\n wptbDropBorderMarkerBottom = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-bottom' );\r\n wptbDropBorderMarkerBottom.style.width = wptbDropBorderMarkerTop.style.width;\r\n wptbDropBorderMarkerBottom.style.top = wptbDropBorderMarkerRight.style.height;\r\n\r\n wptbDropBorderMarkerLeft = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-left' );\r\n wptbDropBorderMarkerLeft.style.height = wptbDropBorderMarkerRight.style.height;\r\n}","var ElementCounters = function () {\r\n\r\n\tvar priv = [];\r\n\tpriv['text'] = 0;\r\n\tpriv['image'] = 0;\r\n\tpriv['list'] = 0;\r\n\tpriv['button'] = 0;\r\n\r\n\tthis.increment = function (key) {\r\n\t\tif (!(key in priv)) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tpriv[key]++;\r\n\t}\r\n\r\n\tthis.nextIndex = function (key) {\r\n\t\tif (!(key in priv)) {\r\n\t\t\treturn undefined;\r\n\t\t}\r\n\t\treturn priv[key] + 1;\r\n\t}\r\n\r\n\treturn this;\r\n\r\n};","var WPTB_ElementObject = function ( data ) {\r\n let DOMElement, kindIndexProt, copy;\r\n if( ! data.elemProt ) {\r\n DOMElement = document.createElement('div'),\r\n kindIndexProt = undefined,\r\n copy = false;\r\n DOMElement.classList.add( 'wptb-' + data.kind + '-container', 'wptb-ph-element' );\r\n \r\n let wpTemplateId = 'wptb-' + data.kind + '-content';\r\n let template = wp.template( wpTemplateId );\r\n data.node = DOMElement;\r\n let itemHtml = template( data );\r\n\r\n itemHtml = itemHtml.replace(/\\r|\\n|\\t/g, '').trim();\r\n DOMElement.innerHTML = itemHtml;\r\n } else {\r\n DOMElement = data.elemProt.cloneNode( true );\r\n DOMElement.classList.remove( 'wptb-directlyhovered' );\r\n let wptbElementMutch = data.elemProt.className.match( /wptb-element-((.+-)\\d+)/i );\r\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\r\n kindIndexProt = wptbElementMutch[1];\r\n };\r\n copy = true;\r\n \r\n if( data.tinyMceClear ) {\r\n DOMElement = WPTB_Helper.elementClearFromTinyMce( DOMElement );\r\n }\r\n }\r\n \r\n let inElems = DOMElement.querySelectorAll( '.wptb-in-element' );\r\n if( inElems.length > 0 ) {\r\n for ( let i = 0; i < inElems.length; i++ ) {\r\n let inElemObj = {};\r\n inElemObj.getDOMElement = function() {\r\n return inElems[i];\r\n }\r\n \r\n applyGenericItemSettings( inElemObj );\r\n }\r\n }\r\n \r\n window.addEventListener( 'item:onmouseenter', function( event ) {\r\n //console.log( event );\r\n }, false);\r\n \r\n \r\n this.kind = data.kind;\r\n this.getDOMElement = function () {\r\n return DOMElement;\r\n };\r\n \r\n applyGenericItemSettings( this, kindIndexProt, copy );\r\n return this;\r\n}\r\n\r\n\r\n","var WPTB_ElementOptions = function ( element, index, kindIndexProt ) {\r\n\r\n var node = element.getDOMElement();\r\n node.addEventListener( 'click', function() {\r\n WPTB_Helper.elementOptionsSet( element.kind, this );\r\n }, {capture: true} );\r\n};","var WPTB_Helper = {\r\n hexToRgb: function( hex ) {\r\n var result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec( hex );\r\n return result ? 'rgb(' + parseInt( result[1], 16 ) + ',' + parseInt( result[2], 16 ) + ',' + parseInt( result[3], 16 ) + ')' : null;\r\n },\r\n rgbToHex: function ( rgb ) {\r\n if( rgb ) {\r\n if( WPTB_Helper.isHex( rgb ) ) return rgb;\r\n\r\n let rgbm = rgb.match(/^rgba?[\\s+]?\\([\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?((?:[0-9]*[.])?[0-9]+)[\\s+]?\\)/i);\r\n if ( rgbm && rgbm.length === 5) {\r\n return \"#\" +\r\n ('0' + Math.round(parseFloat(rgbm[4], 10) * 255).toString(16).toUpperCase()).slice(-2) +\r\n (\"0\" + parseInt(rgbm[1], 10).toString(16).toUpperCase()).slice(-2) +\r\n (\"0\" + parseInt(rgbm[2], 10).toString(16).toUpperCase()).slice(-2) +\r\n (\"0\" + parseInt(rgbm[3], 10).toString(16).toUpperCase()).slice(-2);\r\n } else {\r\n rgbm = rgb.match(/^rgba?[\\s+]?\\([\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?/i);\r\n if (rgbm && rgbm.length === 4) {\r\n return \"#\" +\r\n (\"0\" + parseInt(rgbm[1], 10).toString(16).toUpperCase()).slice(-2) +\r\n (\"0\" + parseInt(rgbm[2], 10).toString(16).toUpperCase()).slice(-2) +\r\n (\"0\" + parseInt(rgbm[3], 10).toString(16).toUpperCase()).slice(-2);\r\n } else {\r\n return '';\r\n }\r\n }\r\n } else {\r\n return '';\r\n }\r\n\r\n },\r\n isHex: function( hex ) {\r\n let regex = new RegExp('^#(?:[A-Fa-f0-9]{3}){1,2}$');\r\n return regex.test( hex );\r\n },\r\n getElementIcon: function ( icon_directory ) {\r\n let hostName = location.protocol + '//' + location.hostname;\r\n let img = document.createElement( 'img' );\r\n img.src = icon_directory;\r\n return img;\r\n },\r\n elementDragEndClear: function() {\r\n let wptbMovingMode = document.getElementsByClassName( 'wptb-moving-mode' );\r\n if ( wptbMovingMode.length > 0 ) {\r\n for( let i = 0; i < wptbMovingMode.length; i++ ) {\r\n wptbMovingMode[i].classList.remove( 'wptb-moving-mode' );\r\n }\r\n }\r\n\r\n let wptbDropHandles = document.getElementsByClassName( 'wptb-drop-handle' );\r\n if ( wptbDropHandles.length > 0 ) {\r\n for( let i = 0; i < wptbDropHandles.length; i++ ) {\r\n wptbDropHandles[i].style.display = 'none';\r\n }\r\n }\r\n\r\n let wptbDropBorderMarkers = document.getElementsByClassName( 'wptb-drop-border-marker' );\r\n if ( wptbDropBorderMarkers.length > 0 ) {\r\n for( let i = 0; i < wptbDropBorderMarkers.length; i++ ) {\r\n wptbDropBorderMarkers[i].style.display = 'none';\r\n }\r\n }\r\n },\r\n linkHttpCheckChange: function( link, convertToAbs = false ) {\r\n if ( link ) {\r\n // even though it is not a best practice and a huge security risk, sometimes our users use javascript tag at href attributes, this check will make sure those tags will not be modified and returned as they are\r\n if(link.match(/^(javascript:)(.+)$/)){\r\n return link;\r\n }\r\n // relative link checking\r\n // if link starts with '/', assume it is a relative link to the origin of the current site\r\n else if( link.match(/^\\/([\\S]+)$/) ){\r\n if (convertToAbs) {\r\n const currentLocation = document.location;\r\n let {origin} = currentLocation;\r\n\r\n\r\n // strip out the '/' at the end of the origin name if there is any\r\n if (origin.match(/^(.+)\\/$/)) {\r\n origin = origin.slice(-1);\r\n }\r\n\r\n return `${origin}${link}`;\r\n }else{\r\n return link;\r\n }\r\n }\r\n else if ( link.indexOf( 'http://' ) == -1 && link.indexOf( 'https://' ) == -1 ) {\r\n let linkArr = link.split( '/' ),\r\n linkClean;\r\n if ( Array.isArray( linkArr ) && linkArr.length > 0 ) {\r\n linkClean = linkArr[linkArr.length - 1];\r\n }\r\n return document.location.protocol + '//' + linkClean;\r\n } else {\r\n return link;\r\n }\r\n } else {\r\n return '';\r\n }\r\n },\r\n dataTitleColumnSet: function( table ) {\r\n // TODO dataTitleColumnSet\r\n // let rows = table.rows,\r\n // rowHead = rows[0];\r\n // let computedStyleRowHead = getComputedStyle( rowHead );\r\n //\r\n // let rowHeadChildren = rowHead.children;\r\n // let contentsForHeader = {};\r\n // for( let i = 0; i < rowHeadChildren.length; i++ ) {\r\n // let tdElements = rowHeadChildren[i].children;\r\n //\r\n // for( let j = 0; j < tdElements.length; j++ ) {\r\n // let element = tdElements[j];\r\n // if( element.classList.contains( 'wptb-ph-element' ) ) {\r\n // let infArr = element.className.match( /wptb-element-(.+)-(\\d+)/i );\r\n // if( infArr[1] == 'text' ) {\r\n // let p = element.querySelector( 'p' ),\r\n // textContent = p.textContent,\r\n // textAlign = p.style.textAlign;\r\n // contentsForHeader[rowHeadChildren[i].dataset.xIndex] = [textContent, element.style.fontSize,\r\n // element.style.color, computedStyleRowHead.backgroundColor, textAlign];\r\n // break;\r\n // }\r\n // }\r\n // }\r\n // if( ! contentsForHeader[rowHeadChildren[i].dataset.xIndex] ) {\r\n // contentsForHeader[rowHeadChildren[i].dataset.xIndex] = ['', '',\r\n // '', computedStyleRowHead.backgroundColor, ''];\r\n // }\r\n // }\r\n // for ( let i = 1; i < rows.length; i++ ) {\r\n // let thisRow = rows[i],\r\n // thisRowChildren = thisRow.children;\r\n // for( let j = 0; j < thisRowChildren.length; j++ ) {\r\n // if ( contentsForHeader[thisRowChildren[j].dataset.xIndex] ) {\r\n // thisRowChildren[j].dataset.wptbTitleColumn = contentsForHeader[thisRowChildren[j].dataset.xIndex][0];\r\n // thisRowChildren[j].dataset.wptbTitleColumnFontSize = contentsForHeader[thisRowChildren[j].dataset.xIndex][1];\r\n // thisRowChildren[j].dataset.wptbTitleColumnColor = contentsForHeader[thisRowChildren[j].dataset.xIndex][2];\r\n // thisRowChildren[j].dataset.wptbTitleBackgroundColor = contentsForHeader[thisRowChildren[j].dataset.xIndex][3];\r\n // thisRowChildren[j].dataset.wptbTitleAlign = contentsForHeader[thisRowChildren[j].dataset.xIndex][4];\r\n // } else {\r\n // thisRowChildren[j].dataset.wptbTitleColumn = null;\r\n // thisRowChildren[j].dataset.wptbTitleColumnFontSize = null;\r\n // thisRowChildren[j].dataset.wptbTitleColumnColor = null;\r\n // thisRowChildren[j].dataset.wptbTitleBackgroundColor = null;\r\n // thisRowChildren[j].dataset.wptbTitleAlign = null;\r\n // }\r\n // }\r\n // }\r\n },\r\n findAncestor: function( el, cls ) {\r\n while ( ( el = el.parentElement ) && !el.classList.contains( cls ) );\r\n return el;\r\n },\r\n rowIsTop: function( row ) {\r\n var parent = row.parentNode;\r\n if( parent.children[0] == row ) {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n },\r\n getSelectionText: function() {\r\n var txt = '';\r\n if (txt = window.getSelection) {\r\n txt = window.getSelection().toString();\r\n } else {\r\n txt = document.selection.createRange().text;\r\n }\r\n return txt;\r\n },\r\n elementOptionsPanelClear: function() {\r\n let elementOptionsGroup = document.getElementById( 'element-options-group' );\r\n if( elementOptionsGroup ) {\r\n elementOptionsGroup.innerHTML = '';\r\n }\r\n },\r\n wpColorPickerCheckChangeForTableStateSaving: function( event ) {\r\n if( event.originalEvent.type == 'external' ) {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n } else {\r\n let wpPickerContainer = WPTB_Helper.findAncestor( event.target, 'wp-picker-container' );\r\n if( wpPickerContainer ) {\r\n if( event.originalEvent.type == 'square' || event.originalEvent.type == 'strip' ) {\r\n let body = document.getElementsByTagName( 'body' )[0];\r\n body.removeEventListener( 'mouseup', WPTB_Helper.irisStripMouseUpStateSaveManager, false );\r\n body.addEventListener( 'mouseup', WPTB_Helper.irisStripMouseUpStateSaveManager, false );\r\n }\r\n }\r\n }\r\n },\r\n irisStripMouseUpStateSaveManager: function() {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n\r\n let body = document.getElementsByTagName( 'body' )[0];\r\n body.removeEventListener( 'mouseup', WPTB_Helper.irisStripMouseUpStateSaveManager, false );\r\n },\r\n wpColorPickerClear: function( attribute, isId ) {\r\n let input;\r\n if( isId ) {\r\n input = [document.getElementById( attribute )];\r\n input.length = 1;\r\n } else {\r\n input = document.getElementsByClassName( attribute );\r\n }\r\n for( let i = 0; i < input.length; i++ ) {\r\n let wpPickerContainer = WPTB_Helper.findAncestor( input[i], 'wp-picker-container' );\r\n if( wpPickerContainer ) {\r\n let parent = wpPickerContainer.parentNode;\r\n parent.removeChild( wpPickerContainer );\r\n let newInput = document.createElement( 'input' );\r\n if( isId ) {\r\n newInput.setAttribute( 'id', attribute );\r\n } else {\r\n newInput.classList.add( 'wptb-element-property', attribute );\r\n }\r\n newInput.value = \"\";\r\n parent.appendChild( newInput );\r\n }\r\n }\r\n },\r\n detectMode: function() {\r\n var url = window.location.href,\r\n regex = new RegExp('[?&]table(=([^&#]*)|&|#|$)'),\r\n results = regex.exec(url);\r\n if ( ! results ) return false;\r\n if ( ! results[2] ) return '';\r\n return decodeURIComponent( results[2].replace(/\\+/g, ' ') );\r\n },\r\n getColumnWidth: function( table, cell ) {\r\n let xIndex = cell.dataset.xIndex;\r\n let xIndexes = table.querySelectorAll( '[data-x-index=\"' + xIndex + '\"]' );\r\n let cellWidth = cell.getCellDimensions().width;\r\n for( let i = 0; i < xIndexes.length; i++ ) {\r\n if( cellWidth > xIndexes[i].getCellDimensions().width ) {\r\n cellWidth = xIndexes[i].getCellDimensions().width;\r\n }\r\n }\r\n return cellWidth;\r\n },\r\n getRowHeight: function( table, cell ) {\r\n let yIndex = cell.dataset.yIndex;\r\n let yIndexes = table.querySelectorAll( '[data-y-index=\"' + yIndex + '\"]' );\r\n let cellHeight = cell.getCellDimensions().height;\r\n for( let i = 0; i < yIndexes.length; i++ ) {\r\n if( cellHeight > yIndexes[i].getCellDimensions().height ) {\r\n cellHeight = yIndexes[i].getCellDimensions().height;\r\n }\r\n }\r\n return cellHeight;\r\n },\r\n newElementProxy: function( el ) {\r\n if( el ) {\r\n let data = {kind: el};\r\n return new WPTB_ElementObject( data );\r\n }\r\n },\r\n wpColorPickerChange: function( event, ui ) {\r\n let uiColor;\r\n if( ui ) {\r\n uiColor = ui.color.toString();\r\n } else {\r\n uiColor = '';\r\n }\r\n\r\n let parent = WPTB_Helper.findAncestor( event.target, 'wp-picker-input-wrap' ).getElementsByClassName( 'wptb-color-picker' )[0], classe, type, ps, number;\r\n classe = parent.dataset.element.match(/wptb-options-(.+)-(\\d+)/i);\r\n type = classe[1];\r\n number = classe[2];\r\n let affectedEl = document.getElementsByClassName( 'wptb-element-' + type + '-' + number )[0];\r\n if ( type == 'button' ) {\r\n if ( parent.dataset.type == 'button-text-color' ) {\r\n affectedEl.getElementsByClassName( 'wptb-button' )[0].style.color = uiColor;\r\n } else {\r\n affectedEl.getElementsByClassName( 'wptb-button' )[0].style.backgroundColor = uiColor;\r\n }\r\n } else if( type == 'list' ) {\r\n let ps = affectedEl.querySelectorAll( 'p' );\r\n if( ps.length > 0 ) {\r\n for ( let i = 0; i < ps.length; i++ ) {\r\n ps[i].style.color = uiColor;\r\n }\r\n }\r\n } else if( type == 'star_rating' ) {\r\n if ( parent.dataset.type == 'star-color' ) {\r\n let ratingStar = affectedEl.querySelectorAll('li');\r\n for( let i = 0; i < ratingStar.length; i++ ) {\r\n let span = ratingStar[i].getElementsByTagName( 'span' );\r\n for( let j = 0; j < span.length; j++ ) {\r\n span[j].style.fill = uiColor;\r\n }\r\n }\r\n } else if( parent.dataset.type == 'numeral-rating-color' ) {\r\n let wptbTextMessageSize = affectedEl.querySelector('.wptb-number-rating');\r\n wptbTextMessageSize.style.color = uiColor;\r\n }\r\n\r\n } else {\r\n affectedEl.style.color = uiColor;\r\n }\r\n },\r\n numberImputSize: function ( wptbNumberInputs, maxCount, maxValue ) {\r\n wptbNumberInputs.onkeydown = function() {\r\n let thisValue = this.value;\r\n thisValue = String( thisValue );\r\n if ( thisValue[0] == 0 ) {\r\n this.value = \"\";\r\n } else {\r\n thisValue = thisValue.substring( 0, maxCount );\r\n this.value = thisValue;\r\n }\r\n }\r\n wptbNumberInputs.onkeyup = function( ) {\r\n let thisValue = this.value;\r\n if ( parseInt( thisValue, 10 ) > parseInt( maxValue, 10 ) ) {\r\n this.value = maxValue;\r\n }\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n },\r\n ucfirst: function( str ) {\r\n return str.charAt(0).toUpperCase() + str.slice(1);\r\n },\r\n wptbDocumentEventGenerate: function( eventName, element, details ) {\r\n if( eventName && element ) {\r\n if( ! details ) {\r\n details = true;\r\n }\r\n let event = new CustomEvent( eventName, { detail: details, bubbles: true } );\r\n element.dispatchEvent( event );\r\n }\r\n },\r\n // run script for the pointed element\r\n elementStartScript: function( element, kind ) {\r\n //let script = element.getElementsByTagName( 'script' );\r\n if(!kind) {\r\n let infArr = element.className.match(/wptb-element-(.+)-(\\d+)/i);\r\n if( infArr && Array.isArray( infArr ) ) {\r\n kind = infArr[1];\r\n }\r\n }\r\n\r\n if( kind ) {\r\n// let wpTemplateId = 'wptb-' + kind + '-script';\r\n// let template = wp.template( wpTemplateId );\r\n// let data = {elemClass: infArr[0]};\r\n// let elementScriptText = template( data );\r\n// elementScriptText = elementScriptText.replace(/\\r|\\n|\\t/g, '').trim();\r\n//\r\n// let scriptNew = document.createElement( 'script' );\r\n// scriptNew.setAttribute( 'type', 'text/javascript' );\r\n// scriptNew.innerHTML = elementScriptText;\r\n// element.parentNode.appendChild( scriptNew );\r\n\r\n// element.parentNode.removeChild( scriptNew );\r\n if( kind in WPTB_ElementsScriptsLauncher ) {\r\n WPTB_ElementsScriptsLauncher[kind]( element );\r\n }\r\n }\r\n },\r\n // deletes event handlers from the pointed option element and from all his daughter elements\r\n deleteEventHandlers: function( element ) {\r\n if( element ) {\r\n jQuery( element ).off();\r\n let elementChildren = element.children;\r\n if( elementChildren ) {\r\n for ( let i = 0; i < elementChildren.length; i++ ) {\r\n WPTB_Helper.deleteEventHandlers( elementChildren[i] );\r\n }\r\n }\r\n } else {\r\n return;\r\n }\r\n },\r\n // replace all occurrences in a string\r\n replaceAll: function( string, search, replace ){\r\n return string.split( search ).join( replace );\r\n },\r\n // clears code from TinyMCE attributes\r\n elementClearFromTinyMce: function( element ) {\r\n let mceContentBodys = element.querySelectorAll( '.mce-content-body' );\r\n if( mceContentBodys.length > 0 ) {\r\n for ( let k = 0; k < mceContentBodys.length; k++ ) {\r\n mceContentBodys[k].classList.remove( 'mce-content-body' );\r\n }\r\n }\r\n\r\n let dataMceStyle = element.querySelectorAll( '[data-mce-style]' );\r\n if ( dataMceStyle.length > 0 ) {\r\n for ( let k = 0; k < dataMceStyle.length; k++ ) {\r\n dataMceStyle[k].removeAttribute( 'data-mce-style' );\r\n }\r\n }\r\n\r\n let mceEditFocus = element.querySelectorAll( '.mce-edit-focus' );\r\n if( mceEditFocus.length > 0 ) {\r\n for ( let k = 0; k < mceEditFocus.length; k++ ) {\r\n mceEditFocus[k].classList.remove( 'mce-edit-focus' );\r\n }\r\n }\r\n\r\n let contentEditable = element.querySelectorAll( '[contenteditable]' );\r\n if ( contentEditable.length > 0 ) {\r\n for ( let k = 0; k < contentEditable.length; k++ ) {\r\n contentEditable[k].removeAttribute( 'contenteditable' );\r\n }\r\n }\r\n\r\n let spellCheck = element.querySelectorAll( '[spellcheck]' );\r\n if ( spellCheck.length > 0 ) {\r\n for ( let k = 0; k < spellCheck.length; k++ ) {\r\n spellCheck[k].removeAttribute( 'spellcheck' );\r\n }\r\n }\r\n\r\n let mceIds = element.querySelectorAll( '[id^=mce_]' );\r\n if ( mceIds.length > 0 ) {\r\n for ( let k = 0; k < mceIds.length; k++ ) {\r\n mceIds[k].removeAttribute( 'id' );\r\n }\r\n }\r\n\r\n return element;\r\n },\r\n elementOptionContainerCustomClassSet: function( targetInput, customClassForContainer ) {\r\n if( targetInput && customClassForContainer ) {\r\n let containerElement = WPTB_Helper.findAncestor( targetInput, 'wptb-element-option' );\r\n if( containerElement ) {\r\n containerElement.classList.add( customClassForContainer );\r\n }\r\n }\r\n },\r\n elementOptionContainerAdditionalStyles: function( targetInput, containerAdditionalStyles ) {\r\n if( targetInput && containerAdditionalStyles ) {\r\n let containerElement = WPTB_Helper.findAncestor( targetInput, 'wptb-element-option' );\r\n let containerStylesArrOne = containerAdditionalStyles.split( ';' );\r\n\r\n if( containerElement && containerStylesArrOne ) {\r\n function containerStylesSet( containerStyleStr, containerElement ) {\r\n if( containerStyleStr ) {\r\n containerStyleStrArr = containerStyleStr.split( ':' );\r\n\r\n if( containerStyleStrArr && Array.isArray( containerStyleStrArr ) ) {\r\n containerElement.style[containerStyleStrArr[0]] = containerStyleStrArr[1];\r\n }\r\n }\r\n }\r\n if( containerStylesArrOne && Array.isArray( containerStylesArrOne ) ) {\r\n for( let i = 0; i < containerStylesArrOne.length; i++ ) {\r\n if( containerStylesArrOne[i] ) {\r\n containerStylesSet( containerStylesArrOne[i], containerElement );\r\n }\r\n }\r\n } else {\r\n containerStylesSet( containerStylesArrOne, containerElement );\r\n }\r\n }\r\n }\r\n },\r\n // function which set handler for event of changes of control\r\n controlsInclude: function( element, functionHandler ) {\r\n if( element && typeof element === 'object' && functionHandler && typeof functionHandler === 'function' ) {\r\n element.addEventListener( 'element:controls:active', function() {\r\n if(!element.hasOwnProperty('controlConnectFunctionsName') ||\r\n !Array.isArray(element.controlConnectFunctionsName) ||\r\n element.controlConnectFunctionsName.indexOf(functionHandler.name) == -1) {\r\n let infArr = element.className.match( /wptb-element-(.+)-(\\d+)/i ),\r\n elementKind;\r\n\r\n if( infArr && Array.isArray( infArr ) ) {\r\n elementKind = infArr[1];\r\n }\r\n\r\n// if( ! element.hasOwnProperty( 'сontrolsConnectIndic' ) || element.сontrolsConnectIndic !== true && elementKind ) {\r\n// let elementsSettingsTemplateJs = document.getElementsByClassName( 'wptb-element-datas' );\r\n// if( elementsSettingsTemplateJs.length > 0 ) {\r\n// elementsSettingsTemplateJs = elementsSettingsTemplateJs[0];\r\n//\r\n// let elementsSettings = elementsSettingsTemplateJs.innerHTML;\r\n// let controlClassesNames = [];\r\n// if( elementsSettings ) {\r\n// elementsSettings = elementsSettings.trim();\r\n// elementsSettings = JSON.parse( elementsSettings );\r\n// if( elementsSettings && typeof elementsSettings === 'object' ) {\r\n// if( 'tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2] in elementsSettings ) {\r\n// let elementSettings = elementsSettings['tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2]];\r\n// if( elementSettings && typeof elementSettings === 'object' ) {\r\n// Object.keys( elementSettings ).forEach( function( key ) {\r\n// let regularText = new RegExp( 'data-wptb-el-' + elementKind + '-(\\\\d+)-([a-zA-Z0-9_-]+)', \"i\" );\r\n// let keyInfArr = key.match( regularText );\r\n// if( keyInfArr && Array.isArray( keyInfArr ) ) {\r\n// let controlClass = key.replace( 'data-', '' );\r\n// controlClassesNames.push( [controlClass, keyInfArr[2]] );\r\n// }\r\n// });\r\n// }\r\n// }\r\n// }\r\n// }\r\n// }\r\n// }\r\n if( elementKind ){\r\n let elementOptionsGroupIds = element.optionsGroupIds;\r\n if(elementOptionsGroupIds && Array.isArray(elementOptionsGroupIds)) {\r\n for(let i = 0; i < elementOptionsGroupIds.length; i++) {\r\n let elementOptionsGroupId = elementOptionsGroupIds[i];\r\n\r\n let elementOptionsGroup = document.getElementById(elementOptionsGroupId);\r\n\r\n let controlActiveElements = elementOptionsGroup.querySelectorAll('.wptb-element-property');\r\n controlActiveElements = [...controlActiveElements];\r\n\r\n controlActiveElements.map(controlActiveElement => {\r\n let regularText = new RegExp( 'wptb-el-' + elementKind + '-(\\\\d+)-([a-zA-Z0-9_-]+)', \"i\" );\r\n let controlInfArr = controlActiveElement.className.match( regularText );\r\n if( controlInfArr && Array.isArray( controlInfArr ) ) {\r\n let controlUnicClassName = controlInfArr[0];\r\n\r\n element.addEventListener( 'wptb-control:' + controlUnicClassName, function() {\r\n let controls = {};\r\n let controlName = controlInfArr[2];\r\n let control = document.getElementsByClassName( controlUnicClassName );\r\n if( control.length > 0 && controlName ) {\r\n let targetControlValue = WPTB_Helper.targetControlValueGet( control );\r\n\r\n controls[controlName] = targetControlValue;\r\n }\r\n\r\n functionHandler( controls, element );\r\n }, false );\r\n }\r\n });\r\n }\r\n }\r\n //let elementOptionsContainer = document.querySelector( '.wptb-element-options.wptb-options-' + infArr[1] + '-' + infArr[2] );\r\n\r\n // from time to time depend on table cells hierarchy, cell td items may catch mouse clicks which are intended for elements. since the active section is not cell management, this will gives and unharmfull error of not found element, simple check for null equality will be sufficient for now.\r\n // if(!elementOptionsContainer){\r\n // return;\r\n // }\r\n\r\n // let elementOptions = elementOptionsContainer.querySelectorAll( '.wptb-element-option' );\r\n // let controlActiveElements = elementOptions[i].querySelector( '.wptb-element-property' );\r\n //\r\n //\r\n // for( let i = 0; i < elementOptions.length; i++ ) {\r\n // let controlActiveElement = elementOptions[i].querySelector( '.wptb-element-property' );\r\n // if( controlActiveElement ) {\r\n //\r\n // }\r\n // }\r\n\r\n if(!element.controlConnectFunctionsName && !Array.isArray(element.controlConnectFunctionsName)) {\r\n element.controlConnectFunctionsName = [];\r\n }\r\n\r\n element.controlConnectFunctionsName.push( functionHandler.name );\r\n }\r\n }\r\n }, false );\r\n }\r\n },\r\n oneControlInclude: function( element, functionHandler, controlName ) {\r\n if( element && typeof element === 'object' && typeof functionHandler === 'function' && typeof controlName === 'string' ) {\r\n let infArr = element.className.match( /wptb-element-((.+-)\\d+)/i ),\r\n elementKind;\r\n\r\n if( infArr && Array.isArray( infArr ) ) {\r\n elementKind = infArr[1].split( '-' )[0];\r\n\r\n let wptbContrlStacksConfigId = 'wptb-' + elementKind + '-control-stack';\r\n let tmplControlsConfig = wp.template( wptbContrlStacksConfigId );\r\n let data = {\r\n container: '.' + infArr[0]\r\n };\r\n let jsonControlsConfigJson = tmplControlsConfig( data );\r\n let jsonControlsConfig = JSON.parse( jsonControlsConfigJson );\r\n\r\n if( jsonControlsConfig && typeof jsonControlsConfig === 'object' && jsonControlsConfig.hasOwnProperty( controlName ) ) {\r\n let controlClassName = 'wptb-el-' + infArr[1] + '-' + controlName;\r\n\r\n element.addEventListener( 'wptb-control:' + controlClassName, function( event ) {\r\n let control = document.getElementsByClassName( controlClassName );\r\n if( control.length > 0 ) {\r\n let targetControlValue = WPTB_Helper.targetControlValueGet( control );\r\n\r\n functionHandler( targetControlValue, element );\r\n }\r\n }, false );\r\n }\r\n }\r\n } else {\r\n return false;\r\n }\r\n },\r\n //\r\n innerElementCopyIncludeHandler: function( element, functionHandler ) {\r\n if( element && typeof element === 'object' && typeof functionHandler === 'function' ) {\r\n element.addEventListener( 'wptb-inner-element:copy', function( event ) {\r\n let innerElement = event.detail;\r\n if( innerElement ) {\r\n WPTB_Helper.elementClearFromTinyMce( innerElement );\r\n functionHandler( innerElement, element );\r\n }\r\n }, false );\r\n }\r\n },\r\n //\r\n appearDependOnControl: function( dependOn, targetControlElementClass ) {\r\n if( Array.isArray( dependOn ) ) {\r\n let dependOnControlName = dependOn[0];\r\n let infArr = targetControlElementClass.match( /wptb-el-((.+-)\\d+)-(.+)/i );\r\n\r\n if( infArr && Array.isArray( infArr ) ) {\r\n let controlName = infArr[3];\r\n\r\n let dependOnControlElementClass = targetControlElementClass.replace( controlName, dependOnControlName );\r\n\r\n let dependOnControlElement = document.getElementsByClassName( dependOnControlElementClass );\r\n\r\n if( dependOnControlElement.length > 0 ) {\r\n dependOnControlElement = dependOnControlElement[0];\r\n let targetControlElement = document.getElementsByClassName( targetControlElementClass );\r\n if( targetControlElement.length > 0 ) {\r\n targetControlElement = targetControlElement[0];\r\n let controlContainerElem = WPTB_Helper.findAncestor( targetControlElement, 'wptb-element-option' );\r\n\r\n if( controlContainerElem ) {\r\n function showHideDependOnControlElement( dependOnControlElementClass, dependOn ) {\r\n\r\n// let elementsSettingsTemplateJs = document.getElementsByClassName( 'wptb-element-datas' );\r\n// if( elementsSettingsTemplateJs.length > 0 ) {\r\n// elementsSettingsTemplateJs = elementsSettingsTemplateJs[0];\r\n//\r\n// let elementsSettings = elementsSettingsTemplateJs.innerHTML;\r\n// if( elementsSettings ) {\r\n// elementsSettings = elementsSettings.trim();\r\n// elementsSettings = JSON.parse( elementsSettings );\r\n// if( elementsSettings && typeof elementsSettings === 'object' &&\r\n// ( 'tmpl-wptb-el-datas-' + dependOnControlElementKind ) in elementsSettings ) {\r\n// let elementSettings = elementsSettings['tmpl-wptb-el-datas-' + dependOnControlElementKind];\r\n// if( elementSettings && typeof elementSettings === 'object' &&\r\n// ( 'data-wptb-el-' + dependOnControlElementKind + '-' + dependOnControlName ) in elementSettings ) {\r\n// let elementSettingValue = elementSettings['data-wptb-el-' + dependOnControlElementKind + '-' + dependOnControlName];\r\n//\r\n// if( elementSettingValue ) {\r\n// if( dependOn[1] && Array.isArray( dependOn[1] ) &&\r\n// ( dependOn[1].indexOf( elementSettingValue ) !== -1 ) ) {\r\n// controlContainerElem.style.display = 'block';\r\n// } else if( dependOn[2] && Array.isArray( dependOn[2] ) &&\r\n// ( dependOn[2].indexOf( elementSettingValue ) !== -1 ) ) {\r\n// controlContainerElem.style.display = 'none';\r\n// }\r\n// }\r\n// }\r\n// }\r\n// }\r\n// }\r\n if( dependOnControlElementClass ) {\r\n let dependOnControlElements = document.getElementsByClassName( dependOnControlElementClass );\r\n if( dependOnControlElements.length > 0 ) {\r\n let targetControlValue = WPTB_Helper.targetControlValueGet( dependOnControlElements );\r\n\r\n if( dependOn[1] && Array.isArray( dependOn[1] ) &&\r\n ( dependOn[1].indexOf( targetControlValue ) !== -1 ) ) {\r\n controlContainerElem.style.display = 'block';\r\n } else if( dependOn[2] && Array.isArray( dependOn[2] ) &&\r\n ( dependOn[2].indexOf( targetControlValue ) !== -1 ) ) {\r\n controlContainerElem.style.display = 'none';\r\n }\r\n }\r\n }\r\n }\r\n\r\n showHideDependOnControlElement( dependOnControlElementClass, dependOn );\r\n\r\n dependOnControlElement.addEventListener( 'change', function( event ) {\r\n showHideDependOnControlElement( dependOnControlElementClass, dependOn );\r\n }, false );\r\n }\r\n }\r\n }\r\n }\r\n }\r\n },\r\n //\r\n controlsStateManager: function ( targetControlClass, controlChangeIndic ) {\r\n let targetControls = document.getElementsByClassName( targetControlClass );\r\n if( targetControls.length > 0 ) {\r\n //targetControls = targetControls[0];\r\n\r\n let infArr = targetControlClass.match( /wptb-el-((.+-)\\d+)-(.+)/i );\r\n\r\n if( infArr && Array.isArray( infArr ) ) {\r\n let selectorElement;\r\n selectorElement = document.querySelector( '.wptb-element-' + infArr[1] );\r\n\r\n if( selectorElement ) {\r\n let elementsSettingsTemplatesJs;\r\n let elementSettings = {};\r\n let elementsSettings;\r\n elementsSettingsTemplatesJs = document.getElementsByClassName( 'wptb-element-datas' );\r\n if( elementsSettingsTemplatesJs.length == 0 || elementsSettingsTemplatesJs[0].innerHTML == '' ) {\r\n let targetControlValue = WPTB_Helper.targetControlValueGet( targetControls );\r\n elementSettings['data-' + targetControlClass] = targetControlValue;\r\n\r\n elementsSettings = {};\r\n elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] = elementSettings;\r\n elementsSettings = JSON.stringify( elementsSettings );\r\n\r\n if( elementsSettingsTemplatesJs.length == 0 ) {\r\n elementsSettingsTemplatesJs = document.createElement( 'script' );\r\n elementsSettingsTemplatesJs.setAttribute( 'type', 'text/html' );\r\n elementsSettingsTemplatesJs.setAttribute( 'class', 'wptb-element-datas' );\r\n } else {\r\n elementsSettingsTemplatesJs = elementsSettingsTemplatesJs[0];\r\n }\r\n\r\n elementsSettingsTemplatesJs.innerHTML = elementsSettings;\r\n\r\n let body = document.getElementsByTagName('body')[0];\r\n body.appendChild( elementsSettingsTemplatesJs );\r\n } else {\r\n elementsSettingsTemplatesJs = elementsSettingsTemplatesJs[0];\r\n elementsSettings = elementsSettingsTemplatesJs.innerHTML;\r\n if( elementsSettings ) {\r\n elementsSettings = elementsSettings.trim();\r\n elementsSettings = JSON.parse( elementsSettings );\r\n\r\n if( elementsSettings && typeof elementsSettings === 'object' ) {\r\n\r\n\r\n if( controlChangeIndic ) {\r\n let targetControlValue = WPTB_Helper.targetControlValueGet( targetControls );\r\n if( ! ( ( 'tmpl-wptb-el-datas-' + infArr[1] ) in elementsSettings ) ||\r\n typeof elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] !== 'object') {\r\n elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] = {};\r\n }\r\n elementsSettings['tmpl-wptb-el-datas-' + infArr[1]]['data-' + targetControlClass] = targetControlValue;\r\n elementsSettingsTemplatesJs.innerHTML = JSON.stringify( elementsSettings );\r\n } else if( ! ( ( ( 'tmpl-wptb-el-datas-' + infArr[1] ) in elementsSettings ) &&\r\n typeof elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] === 'object' &&\r\n ( 'data-' + targetControlClass ) in elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] ) ) {\r\n let targetControlValue = WPTB_Helper.targetControlValueGet( targetControls );\r\n if( ! ( ( 'tmpl-wptb-el-datas-' + infArr[1] ) in elementsSettings ) ||\r\n typeof elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] !== 'object') {\r\n elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] = {};\r\n }\r\n elementsSettings['tmpl-wptb-el-datas-' + infArr[1]]['data-' + targetControlClass] = targetControlValue;\r\n elementsSettingsTemplatesJs.innerHTML = JSON.stringify( elementsSettings );\r\n } else if( ( ( 'tmpl-wptb-el-datas-' + infArr[1] ) in elementsSettings ) &&\r\n typeof elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] === 'object' &&\r\n ( 'data-' + targetControlClass ) in elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] ) {\r\n for( let i = 0; i < targetControls.length; i++ ) {\r\n if( targetControls[i].type == 'checkbox' ) {\r\n let targetControlValue;\r\n if( targetControls[i].name ) {\r\n targetControlValue = elementsSettings['tmpl-wptb-el-datas-' + infArr[1]]['data-' + targetControlClass][targetControls[i].name];\r\n } else {\r\n targetControlValue = elementsSettings['tmpl-wptb-el-datas-' + infArr[1]]['data-' + targetControlClass];\r\n }\r\n\r\n if( targetControlValue == 'checked' ) {\r\n targetControls[i].checked = true;\r\n } else if( targetControlValue == 'unchecked' ) {\r\n targetControls[i].checked = false;\r\n }\r\n } else {\r\n targetControls[i].value = elementsSettings['tmpl-wptb-el-datas-' + infArr[1]]['data-' + targetControlClass];\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n },\r\n //\r\n targetControlValueGet: function( targetControls ) {\r\n let targetControlValue;\r\n for( let i = 0; i < targetControls.length; i++ ) {\r\n if( targetControls[i].type == 'checkbox' && targetControls[i].name ) {\r\n if( ! targetControlValue ) targetControlValue = {};\r\n if( targetControls[i].checked == true ) {\r\n targetControlValue[targetControls[i].name] = 'checked';\r\n } else {\r\n targetControlValue[targetControls[i].name] = 'unchecked';\r\n }\r\n } else if( targetControls[i].type == 'checkbox' ) {\r\n if( targetControls[i].checked == true ) {\r\n targetControlValue = 'checked';\r\n } else {\r\n targetControlValue = 'unchecked';\r\n }\r\n } else if( targetControls[i].type ) {\r\n targetControlValue = targetControls[i].value;\r\n } else if( targetControls[i].dataset.alignmentValue && targetControls[i].classList.contains( 'selected' ) ){\r\n targetControlValue = targetControls[i].dataset.alignmentValue;\r\n }\r\n }\r\n return targetControlValue;\r\n },\r\n //\r\n elementControlsStateCopy: function( elementProt, copyElem ) {\r\n if( elementProt && copyElem ) {\r\n let infArrProt = elementProt.className.match( /wptb-element-((.+-)\\d+)/i );\r\n let infArrCopy = copyElem.className.match( /wptb-element-((.+-)\\d+)/i );\r\n if( infArrProt && Array.isArray( infArrProt ) &&\r\n infArrCopy && Array.isArray( infArrCopy )) {\r\n let elemProtKind = infArrProt[1];\r\n let elemCopyKind = infArrCopy[1];\r\n let elementsSettingsTemplateJs = document.getElementsByClassName( 'wptb-element-datas' );\r\n if( elementsSettingsTemplateJs.length > 0 ) {\r\n elementsSettingsTemplateJs = elementsSettingsTemplateJs[0];\r\n\r\n let elementsSettings = elementsSettingsTemplateJs.innerHTML;\r\n if( elementsSettings ) {\r\n elementsSettings = elementsSettings.trim();\r\n elementsSettings = JSON.parse( elementsSettings );\r\n\r\n if( elementsSettings && typeof elementsSettings === 'object' ) {\r\n let elementSettingsProt = elementsSettings['tmpl-wptb-el-datas-' + elemProtKind];\r\n if( elementSettingsProt && typeof elementSettingsProt === 'object' ) {\r\n let elementSettingsCopy = {};\r\n\r\n Object.keys( elementSettingsProt ).forEach( function( key ) {\r\n let elementSettingValue = elementSettingsProt[key];\r\n let elementSettingKeyCopy = key.replace( elemProtKind, elemCopyKind );\r\n elementSettingsCopy[elementSettingKeyCopy] = elementSettingValue;\r\n });\r\n\r\n if( Object.keys( elementSettingsCopy ).length > 0 ) {\r\n elementsSettings['tmpl-wptb-el-datas-' + elemCopyKind] = elementSettingsCopy;\r\n\r\n elementsSettings = JSON.stringify( elementsSettings );\r\n elementsSettingsTemplateJs.innerHTML = elementsSettings;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n },\r\n //\r\n elementControlsStateDelete: function( element, nameControl ) {\r\n let infArr = element.className.match( /wptb-element-(.+)-(\\d+)/i );\r\n let body = document.getElementsByTagName( 'body' )[0];\r\n let wptbElementDatas = body.getElementsByClassName( 'wptb-element-datas' );\r\n if( infArr && Array.isArray( infArr ) && wptbElementDatas.length > 0 ) {\r\n wptbElementDatas = wptbElementDatas[0];\r\n let elementsSettings = wptbElementDatas.innerHTML;\r\n if( elementsSettings ) {\r\n elementsSettings = elementsSettings.trim();\r\n elementsSettings = JSON.parse( elementsSettings );\r\n if( elementsSettings && typeof elementsSettings === 'object' &&\r\n ( ( 'tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2] ) in elementsSettings ) ) {\r\n if( ! nameControl ) {\r\n delete elementsSettings['tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2]];\r\n } else {\r\n if( elementsSettings['tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2]] &&\r\n typeof elementsSettings['tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2]] === 'object' &&\r\n ( 'data-wptb-el-' + infArr[1] + '-' + infArr[2] + '-' + nameControl ) in elementsSettings['tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2]] ) {\r\n delete elementsSettings['tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2]]['data-wptb-el-' + infArr[1] + '-' + infArr[2] + '-' + nameControl];\r\n }\r\n }\r\n\r\n if( Object.keys( elementsSettings ).length == 0 ) {\r\n body.removeChild( wptbElementDatas );\r\n } else {\r\n elementsSettings = JSON.stringify( elementsSettings );\r\n wptbElementDatas.innerHTML = elementsSettings;\r\n }\r\n }\r\n }\r\n }\r\n },\r\n //\r\n elementOptionsSet: function( kind, element ) {\r\n // get controls config for this element\r\n let wptbContrlStacksConfigId = 'wptb-' + kind + '-control-stack';\r\n let tmplControlsConfig = wp.template( wptbContrlStacksConfigId );\r\n let data;\r\n let elementContainerClass;\r\n let elementOptionClassIndic;\r\n let elementOptionsGroup;\r\n\r\n let controlElementParent;\r\n let elementOptionsScriptsContainer;\r\n\r\n let infArr = element.className.match( /wptb-element-((.+-)\\d+)/i );\r\n if( ! infArr ) {\r\n let table_id = WPTB_Helper.detectMode();\r\n if (!table_id) {\r\n table_id = 'startedid-0';\r\n }\r\n if( element.classList.contains( 'wptb-preview-table' ) ) {\r\n element.classList.add( 'wptb-element-main-table_setting-' + table_id );\r\n } else if( element.classList.contains( 'wptb-cell' ) ) {\r\n let cellEditActiveClass = document.querySelector('.wptb-element-table_cell_setting-' + element.dataset.xIndex + '-' + element.dataset.yIndex);\r\n if( ! cellEditActiveClass ) element.classList.add('wptb-element-table_cell_setting-' + element.dataset.xIndex + '-' + element.dataset.yIndex);\r\n }else if (element.classList.contains('wptb-responsive')){\r\n element.classList.add('wptb-element-table_responsive_setting-' + table_id);\r\n }\r\n\r\n infArr = element.className.match( /wptb-element-((.+-)\\d+)/i );\r\n }\r\n\r\n data = {\r\n container: '.' + infArr[0]\r\n };\r\n\r\n elementContainerClass = infArr[0];\r\n elementOptionClassIndic = infArr[1];\r\n\r\n if( element.classList.contains( 'wptb-preview-table' ) ) {\r\n\r\n } else if( element.classList.contains( 'wptb-cell' ) ) {\r\n this.activateSection('cell_settings');\r\n }else if (element.classList.contains('wptb-responsive')){\r\n elementOptionsGroupId = 'table-responsive-group';\r\n wptbelementOptionClass = 'wptb-element-option';\r\n }\r\n else {\r\n let children = document.getElementById( 'element-options-group' ).childNodes;\r\n for ( let i = 0; i < children.length; i++) {\r\n if ( children[i].style )\r\n children[i].style.display = 'none';\r\n }\r\n\r\n // hide wptb-elements-container and wptb-settings-section\r\n // document.getElementsByClassName( 'wptb-elements-container' )[0].style.display = 'none';\r\n // document.getElementsByClassName( 'wptb-settings-section' )[0].style.display = 'none';\r\n\r\n // show element-options-group\r\n // document.getElementById( 'element-options-group' ).style.display = 'block';\r\n this.activateSection('options_group');\r\n }\r\n\r\n let jsonControlsConfigJson = tmplControlsConfig( data );\r\n let jsonControlsConfig = JSON.parse( jsonControlsConfigJson );\r\n\r\n let elementOptionsGroupIdsInvolved = [],\r\n elementOptionsGroupInvolved = {},\r\n elementOptionsContainerInvolved = {};\r\n\r\n // object for save all scrips for each controls\r\n let controlScriptsObj = {};\r\n\r\n // array for keep \"appear depend on\" parametrs\r\n let controlappearDependOnControl = [];\r\n\r\n // create controls\r\n let elementOptionsScriptsContainerIndic = false;\r\n let i = 0;\r\n Object.keys( jsonControlsConfig ).forEach( function( key ) {\r\n let data = jsonControlsConfig[key];\r\n data.controlKey = key;\r\n\r\n // get necessary wp js template\r\n let tmplControlTemplate = wp.template( 'wptb-' + data.type + '-control' );\r\n\r\n data.elemContainer = elementContainerClass;\r\n data.elementControlTargetUnicClass = 'wptb-el-' + elementOptionClassIndic + '-' + data.controlKey;\r\n let controlTemplate = tmplControlTemplate( data );\r\n\r\n if( 'appearDependOnControl' in data ) {\r\n if( Array.isArray( data.appearDependOnControl ) ) {\r\n controlappearDependOnControl.push( [data.appearDependOnControl, data.elementControlTargetUnicClass] );\r\n }\r\n }\r\n\r\n function elementOptionsContainerInvolvedGet(elementOptionsGroupId, elementOptionsContainerInvolved) {\r\n if(!elementOptionsContainerInvolved[elementOptionsGroupId]){\r\n let elementOptionsContainer = document.createElement( 'div' );\r\n elementOptionsContainer.classList.add( 'wptb-element-options', 'wptb-options-' + infArr[1] );\r\n document.getElementById( elementOptionsGroupId ).appendChild(elementOptionsContainer);\r\n elementOptionsContainerInvolved[elementOptionsGroupId] = elementOptionsContainer;\r\n }\r\n\r\n return elementOptionsContainerInvolved[elementOptionsGroupId];\r\n }\r\n\r\n if(elementOptionsGroupIdsInvolved.indexOf(data.elementOptionsGroupId) == -1) {\r\n elementOptionsGroupIdsInvolved.push(data.elementOptionsGroupId);\r\n // clear elements from options group\r\n //document.getElementById( 'element-options-group' ).innerHTML = '';\r\n elementOptionsGroup = document.getElementById(data.elementOptionsGroupId);\r\n let elementOptionsGroupChildren = [...elementOptionsGroup.children];\r\n for( let i = 0; i < elementOptionsGroupChildren.length; i++ ) {\r\n elementOptionsGroup.removeChild( elementOptionsGroupChildren[i] );\r\n }\r\n elementOptionsGroupInvolved[data.elementOptionsGroupId] = elementOptionsGroup;\r\n }\r\n\r\n controlElementParent = elementOptionsGroupInvolved[data.elementOptionsGroupId];\r\n\r\n if(data.elementOptionsContainerOn === 'true') {\r\n controlElementParent = elementOptionsContainerInvolvedGet(data.elementOptionsGroupId, elementOptionsContainerInvolved);\r\n }\r\n\r\n\r\n if(data.elementOptionContainerOn === 'true') {\r\n let elementOptionContainer = document.createElement( 'div' );\r\n elementOptionContainer.classList.add( data.elementOptionClass, 'wptb-settings-items' );\r\n\r\n if( data.customClassForContainer ) {\r\n elementOptionContainer.classList.add( data.customClassForContainer );\r\n }\r\n\r\n if( data.containerAdditionalStyles ) {\r\n elementOptionContainer.setAttribute( 'style', data.containerAdditionalStyles );\r\n }\r\n\r\n controlElementParent.appendChild( elementOptionContainer );\r\n\r\n controlElementParent = elementOptionContainer;\r\n }\r\n controlElementParent.innerHTML = controlElementParent.innerHTML + controlTemplate;\r\n\r\n let helperJavascriptElem = controlElementParent.getElementsByTagName( 'wptb-template-script' );\r\n if( helperJavascriptElem.length > 0 ) {\r\n helperJavascriptElem = helperJavascriptElem[0];\r\n let helperJavascriptCode = helperJavascriptElem.innerText;\r\n controlElementParent.removeChild( helperJavascriptElem );\r\n let script = document.createElement( 'script' );\r\n script.setAttribute( 'type', 'text/javascript' );\r\n script.innerHTML = helperJavascriptCode.replace(/\\r|\\n|\\t/g, '').trim();\r\n if(!controlScriptsObj[data.elementOptionsGroupId] || !Array.isArray(controlScriptsObj[data.elementOptionsGroupId])) {\r\n controlScriptsObj[data.elementOptionsGroupId] = [];\r\n }\r\n controlScriptsObj[data.elementOptionsGroupId].push( script );\r\n }\r\n\r\n i++;\r\n });\r\n\r\n element.optionsGroupIds = elementOptionsGroupIdsInvolved;\r\n\r\n Object.keys( controlScriptsObj ).forEach( function( elementOptionsGroupId ) {\r\n let controlScriptsArr = controlScriptsObj[elementOptionsGroupId];\r\n elementOptionsScriptsContainer = document.createElement( 'div' );\r\n elementOptionsScriptsContainer.classList.add( 'wptb-element-options-scripts', 'wptb-options-' + infArr[1] );\r\n elementOptionsGroupInvolved[elementOptionsGroupId].appendChild(elementOptionsScriptsContainer);\r\n if( controlScriptsArr.length > 0 ) {\r\n for( let i = 0; i < controlScriptsArr.length; i++ ) {\r\n elementOptionsScriptsContainer.appendChild(controlScriptsArr[i]);\r\n }\r\n }\r\n });\r\n\r\n\r\n\r\n // run the scripts of controls\r\n\r\n\r\n // run appearDependOnControl function\r\n for ( let i = 0; i < controlappearDependOnControl.length; i++ ) {\r\n WPTB_Helper.appearDependOnControl( controlappearDependOnControl[i][0], controlappearDependOnControl[i][1] );\r\n }\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate( 'element:controls:active', element );\r\n },\r\n\r\n /**\r\n * function for create, update css for element\r\n *\r\n * @param elementContainer\r\n * @param selector\r\n * @param cssName\r\n * @param cssValue\r\n */\r\n managerExternalCssStyles: function( elementContainer, selector, cssName, cssValue ) {\r\n let infArr = elementContainer.match( /wptb-element-main(.+)-(\\d+)/i );\r\n if( ! infArr || ! Array.isArray( infArr ) ) {\r\n let table = document.getElementsByClassName( 'wptb-preview-table' );\r\n\r\n if( table.length > 0 ) {\r\n table = table[0];\r\n\r\n let infArr = table.className.match( /wptb-element-main(.+)-(\\d+)/i );\r\n if( infArr && Array.isArray( infArr ) ) {\r\n selector = '.' + infArr[0] + ' ' + selector;\r\n }\r\n }\r\n }\r\n\r\n let head = document.head;\r\n if( head ) {\r\n let cssForThisElement = head.querySelector( '#styles-' + elementContainer );\r\n if( cssForThisElement ) {\r\n let cssText = cssForThisElement.innerHTML;\r\n if( cssText ) {\r\n let cssTextArrFirst = cssText.split( '}' );\r\n cssTextArrFirst.pop();\r\n let selectorExists = false;\r\n for( let i = 0; i < cssTextArrFirst.length; i++ ) {\r\n let cssTextArrSecond = cssTextArrFirst[i].split( '{' );\r\n if( cssTextArrSecond[0] === selector ) {\r\n let cssTextArrThird = cssTextArrSecond[1].split( ';' );\r\n cssTextArrThird.pop();\r\n let cssNameExists = false;\r\n for( let j = 0; j < cssTextArrThird.length; j++ ) {\r\n let cssTextArrFourth = cssTextArrThird[j].split( ':' );\r\n if( cssTextArrFourth[0] === cssName ) {\r\n if( cssValue ) {\r\n cssTextArrThird[j] = cssName + ':' + cssValue;\r\n } else {\r\n cssTextArrThird.splice( j, 1 );\r\n }\r\n\r\n cssTextArrSecond[1] = cssTextArrThird.join( ';' ) ? cssTextArrThird.join( ';' ) + ';' : '';\r\n cssNameExists = true;\r\n break;\r\n }\r\n }\r\n if( ! cssNameExists ) {\r\n if( cssValue ) {\r\n cssTextArrSecond[1] += cssName + ':' + cssValue + ';';\r\n }\r\n }\r\n if( cssTextArrSecond[1] ) {\r\n cssTextArrFirst[i] = cssTextArrSecond[0] + '{' + cssTextArrSecond[1]\r\n } else {\r\n cssTextArrFirst.splice( i, 1 );\r\n }\r\n if( cssTextArrFirst.join( '}' ) ) {\r\n cssForThisElement.innerHTML = cssTextArrFirst.join( '}' ) + '}';\r\n } else {\r\n head.removeChild( cssForThisElement );\r\n }\r\n\r\n selectorExists = true;\r\n break;\r\n }\r\n }\r\n\r\n if( ! selectorExists ) {\r\n if( cssValue ) {\r\n cssForThisElement.innerHTML = cssText + selector + '{' + cssName + ':' + cssValue + ';}';\r\n } else {\r\n cssForThisElement.innerHTML = cssText;\r\n }\r\n }\r\n } else {\r\n if( cssValue ) {\r\n cssForThisElement.innerHTML = selector + '{' + cssName + ':' + cssValue + ';}';\r\n } else {\r\n head.removeChild( cssForThisElement );\r\n }\r\n }\r\n } else {\r\n if( cssValue ) {\r\n let cssForThisElement = document.createElement( 'style' );\r\n cssForThisElement.setAttribute( 'id', 'styles-' + elementContainer );\r\n cssForThisElement.classList.add( 'styles-wptb-elements' );\r\n cssForThisElement.innerHTML = selector + '{' + cssName + ':' + cssValue + ';}';\r\n head.appendChild( cssForThisElement );\r\n }\r\n }\r\n }\r\n },\r\n /**\r\n *\r\n * Register section parts for sidebar\r\n *\r\n * @param {array} sections an array of section names\r\n */\r\n registerSections(sections) {\r\n this.sections = {};\r\n this.currentSection = '';\r\n if (!Array.isArray(sections)) {\r\n sections = [sections];\r\n }\r\n\r\n sections.map(s => {\r\n const sectionElement = document.querySelector(`[data-wptb-section=${s}]`);\r\n if (sectionElement) {\r\n this.sections[s] = sectionElement;\r\n }\r\n })\r\n },\r\n /**\r\n * Activate a registered section and deactivates others\r\n *\r\n * @param {string} sectionDataId section name to be activated\r\n * @param {string} displayType display type override for section to be used in its display style property\r\n */\r\n activateSection(sectionDataId, displayType = 'block') {\r\n this.currentSection=sectionDataId;\r\n this.triggerSectionEvent(sectionDataId);\r\n Object.keys(this.sections).map(k => {\r\n if (Object.prototype.hasOwnProperty.call(this.sections, k)) {\r\n const visibility = sectionDataId === k ? displayType : 'none';\r\n this.sections[k].style = `display: ${visibility} !important`;\r\n }\r\n })\r\n },\r\n /**\r\n * Get id of current active section\r\n *\r\n * @returns {string} active section i\r\n */\r\n getCurrentSection(){\r\n return this.currentSection;\r\n },\r\n /**\r\n * Get current section from search parameter 'wptb-builder-section' of window location\r\n */\r\n getSectionFromUrl(){\r\n const parsedUrl = new URL(window.location.href);\r\n const urlSection = parsedUrl.searchParams.get('wptb-builder-section');\r\n if(urlSection){\r\n if(Object.keys(this.sections).some(key => key===urlSection)){\r\n this.activateSection(urlSection);\r\n }\r\n }\r\n },\r\n /**\r\n * Set up related buttons and links to trigger certain elements\r\n */\r\n setupSectionButtons() {\r\n const sectionButtons = Array.from( document.querySelectorAll('[data-wptb-section-button'));\r\n const vm = this;\r\n\r\n sectionButtons.map(s => {\r\n const sectionName = s.dataset.wptbSectionButton;\r\n s.addEventListener('click', function() {\r\n const displayType = s.dataset.wptbSectionDisplayType;\r\n vm.activateSection(sectionName, displayType);\r\n })\r\n\r\n document.addEventListener('wptbSectionChanged', (e)=> {\r\n if(e.detail === sectionName){\r\n s.classList.remove('disabled');\r\n s.classList.add('active');\r\n }else{\r\n s.classList.remove('active');\r\n s.classList.add('disabled');\r\n }\r\n })\r\n })\r\n },\r\n setupPanelToggleButtons(){\r\n const $ = jQuery;\r\n\r\n $('.wptb-panel-toggle-group').each(function(){\r\n const vm = $(this);\r\n $(this).find('.toggle-icon').click(() => {\r\n vm.find('.wptb-panel-toggle-target').slideToggle();\r\n vm.toggleClass('wptb-panel-toggle-content');\r\n })\r\n })\r\n },\r\n /**\r\n * Trigger a section change event\r\n *\r\n * @param {string} sectionName section name\r\n */\r\n triggerSectionEvent(sectionName){\r\n const sectionEvent = new CustomEvent('wptbSectionChanged', {detail: sectionName});\r\n\r\n document.dispatchEvent(sectionEvent);\r\n },\r\n /**\r\n * Setup sidebar toggle element\r\n *\r\n * @param {string} toggleSelector query selector for drawer toggle element\r\n */\r\n setupSidebarToggle(toggleSelector){\r\n const toggleButton = document.querySelector(toggleSelector);\r\n if(toggleButton){\r\n toggleButton.addEventListener('click', (e)=>{\r\n e.preventDefault();\r\n document.body.classList.toggle('collapsed');\r\n })\r\n }\r\n },\r\n // function for deleting all external CSS for the element\r\n externalCssStylesDelete: function( elementContainerClass ) {\r\n let head = document.head;\r\n if( head ) {\r\n let cssForThisElement = head.querySelector( '#styles-' + elementContainerClass );\r\n\r\n if( cssForThisElement ) {\r\n head.removeChild( cssForThisElement );\r\n }\r\n }\r\n },\r\n // function for copy all external CSS for the element\r\n externalCssStylesCopy: function( activeElement, copyElement ) {\r\n if( activeElement ) {\r\n let infArr = activeElement.className.match( /wptb-element-(.+)-(\\d+)/i );\r\n if( infArr && Array.isArray( infArr ) ) {\r\n let activeElemClass = infArr[0];\r\n\r\n let head = document.head;\r\n if( head ) {\r\n let cssForActiveElement = head.querySelector( '#styles-' + activeElemClass );\r\n\r\n if( cssForActiveElement ) {\r\n let cssForNewElement = cssForActiveElement.cloneNode( true );\r\n\r\n cssForNewElement.removeAttribute( 'id', 'styles-' + activeElemClass );\r\n\r\n let infArrCopyEl = copyElement.className.match( /wptb-element-(.+)-(\\d+)/i );\r\n if( infArrCopyEl && Array.isArray( infArrCopyEl ) ) {\r\n cssForNewElement.setAttribute( 'id', 'styles-' + infArrCopyEl[0] );\r\n let cssForActiveElementInnerHTML = cssForActiveElement.innerHTML;\r\n let cssForNewElementInnerHTML = WPTB_Helper.replaceAll( cssForActiveElementInnerHTML, activeElemClass, infArrCopyEl[0] );\r\n cssForNewElement.innerHTML = cssForNewElementInnerHTML;\r\n head.appendChild( cssForNewElement );\r\n }\r\n }\r\n }\r\n }\r\n }\r\n },\r\n // function for convertation elements stiles in json\r\n elementsStylesConvertToObject: function() {\r\n let head = document.head;\r\n let stylesElements = head.querySelectorAll( '.styles-wptb-elements' );\r\n let stylesObj = {};\r\n for( let i = 0; i < stylesElements.length; i++ ) {\r\n let styleElemId = stylesElements[i].getAttribute( 'id' );\r\n if( styleElemId && stylesElements[i].innerHTML ) {\r\n stylesObj[styleElemId] = stylesElements[i].innerHTML;\r\n }\r\n }\r\n\r\n if( Object.keys( stylesObj ).length != 0 ) {\r\n return JSON.stringify( stylesObj );\r\n }\r\n return '';\r\n },\r\n // function for set scc styles tags to head\r\n elementsStylesSetFromObject: function( jsonObject ) {\r\n let head = document.head;\r\n if( head ) {\r\n let stylesElements = head.querySelectorAll( '.styles-wptb-elements' );\r\n if( stylesElements.length > 0 ) {\r\n stylesElements = [...stylesElements];\r\n for( let i = 0; i < stylesElements.length; i++ ) {\r\n head.removeChild( stylesElements[i] );\r\n }\r\n }\r\n if( jsonObject ) {\r\n let stylesObj = JSON.parse( jsonObject );\r\n if( Object.keys( stylesObj ).length != 0 ) {\r\n Object.keys( stylesObj ).forEach( function( key ) {\r\n let cssText = stylesObj[key];\r\n let styleCss = document.createElement( 'style' );\r\n styleCss.setAttribute( 'id', key );\r\n styleCss.classList.add( 'styles-wptb-elements' );\r\n styleCss.innerHTML = cssText;\r\n head.appendChild( styleCss );\r\n });\r\n }\r\n }\r\n }\r\n },\r\n // function for table saving\r\n saveTable: function( event, startSaving, previewSaving ) {\r\n if( ! previewSaving && ! startSaving ) {\r\n if( ( ! event.target.dataset.wptbTableStateNumberSave && window.wptbTableStateNumberShow == 0 ) ||\r\n window.wptbTableStateNumberShow == event.target.dataset.wptbTableStateNumberSave ) {\r\n //return;\r\n }\r\n }\r\n\r\n if( ! previewSaving ) {\r\n let bar = document.querySelector( '.wptb-edit-bar' );\r\n if ( bar && bar.classList.contains( 'visible' ) ) {\r\n let table = document.getElementsByClassName( 'wptb-preview-table' )[0];\r\n WPTB_Helper.toggleTableEditMode();\r\n }\r\n }\r\n\r\n let http = new XMLHttpRequest(),\r\n url = ( wptb_admin_object ? wptb_admin_object.ajaxurl : ajaxurl ) + \"?action=save_table\",\r\n t = document.getElementById( 'wptb-setup-name' ).value.trim(),\r\n messagingArea,\r\n code,\r\n datas;\r\n\r\n code = document.getElementsByClassName( 'wptb-preview-table' );\r\n\r\n let postId;\r\n if (( rs = WPTB_Helper.detectMode() ) || ( rs = document.wptbId )) {\r\n postId = rs;\r\n }\r\n let paramIdsNecessaryChange = false;\r\n if( code.length > 0 ) {\r\n code = code[0];\r\n let codeClone = code.cloneNode( true );\r\n if( postId ) {\r\n if( codeClone.classList.contains( 'wptb-element-main-table_setting-startedid-0' ) ) {\r\n codeClone.classList.remove( 'wptb-element-main-table_setting-startedid-0' );\r\n codeClone.classList.add( 'wptb-element-main-table_setting-' + postId );\r\n let wptbTableSetup = document.querySelector('.wptb-table-setup');\r\n if(wptbTableSetup) {\r\n wptbTableSetup.innerHTML = '';\r\n wptbTableSetup.appendChild(codeClone);\r\n WPTB_Table();\r\n }\r\n paramIdsNecessaryChange = true;\r\n }\r\n }\r\n codeClone.columns = code.columns;\r\n code = WPTB_Stringifier( codeClone );\r\n code = code.outerHTML;\r\n } else {\r\n code = '';\r\n }\r\n\r\n if( ! previewSaving ) {\r\n datas = '';\r\n let datas_containers = document.getElementsByClassName( 'wptb-element-datas' );\r\n\r\n if( datas_containers.length > 0 ) {\r\n if( datas_containers[0].innerHTML ) {\r\n datas = datas_containers[0].innerHTML;\r\n\r\n if( paramIdsNecessaryChange ) {\r\n datas = WPTB_Helper.replaceAll( datas, 'tmpl-wptb-el-datas-main-table_setting-startedid-0',\r\n 'tmpl-wptb-el-datas-main-table_setting-' + postId );\r\n\r\n datas = WPTB_Helper.replaceAll( datas, 'data-wptb-el-main-table_setting-startedid-0',\r\n 'data-wptb-el-main-table_setting-' + postId );\r\n }\r\n }\r\n }\r\n }\r\n\r\n let styleObjJson = WPTB_Helper.elementsStylesConvertToObject();\r\n if( paramIdsNecessaryChange ) {\r\n styleObjJson = WPTB_Helper.replaceAll( styleObjJson, '.wptb-element-main-table_setting-startedid-0',\r\n '.wptb-element-main-table_setting-' + postId );\r\n }\r\n\r\n if ( t === '' && code === '' ) {\r\n let messagingAreaText = '';\r\n if( t === '' ) messagingAreaText += 'You must assign a name to the table before saving it.</br>';\r\n if( code === '' ) messagingAreaText += 'Table wasn\\'t created';\r\n messagingArea = document.getElementById( 'wptb-messaging-area' );\r\n messagingArea.innerHTML = '<div class=\"wptb-error wptb-message\">Error: ' + messagingAreaText + '</div>';\r\n messagingArea.classList.add( 'wptb-warning' );\r\n setTimeout(function () {\r\n messagingArea.removeChild( messagingArea.firstChild );\r\n }, 4000 );\r\n return;\r\n }\r\n\r\n let params = {\r\n title: t,\r\n content: code,\r\n elements_datas: datas,\r\n elements_styles: styleObjJson,\r\n security_code: wptb_admin_object.security_code\r\n };\r\n\r\n\r\n if( previewSaving ) {\r\n params.preview_saving = previewSaving;\r\n }\r\n\r\n if ( postId ) {\r\n params.id = postId;\r\n }\r\n params = JSON.stringify( params );\r\n\r\n http.open('POST', url, true);\r\n http.setRequestHeader( 'Content-type', 'application/json; charset=utf-8' );\r\n\r\n http.onreadystatechange = function ( action ) {\r\n if ( this.readyState == 4 && this.status == 200 ) {\r\n var data = JSON.parse( http.responseText );\r\n messagingArea = document.getElementById( 'wptb-messaging-area' );\r\n\r\n if ( data[0] == 'saved' ) {\r\n let builderPageUrl = document.location.href.replace( '#', '' );\r\n let regex = new RegExp( '&table=(.+)', \"i\" );\r\n builderPageUrl = builderPageUrl.replace( regex, '' );\r\n window.history.pushState( null, null, builderPageUrl + '&table=' + data[1] );\r\n\r\n WPTB_Helper.saveTable( event, true );\r\n return;\r\n } else if( data[0] == 'edited' && startSaving ) {\r\n document.wptbId = data[1];\r\n messagingArea.innerHTML = '<div class=\"wptb-success wptb-message\">Table \"' + t + '\" was successfully saved.</div>';\r\n document.getElementsByClassName( 'wptb-embed-btn' )[0].classList.remove( 'wptb-button-disable' );\r\n document.getElementById( 'wptb-embed-shortcode' ).value = '[wptb id=' + data[1] + ']';\r\n let wptbPreviewTable = document.querySelector( '.wptb-preview-table' );\r\n let wptbPreviewBtn = document.getElementsByClassName( 'wptb-preview-btn' );\r\n if( wptbPreviewBtn.length > 0 ) {\r\n wptbPreviewBtn = wptbPreviewBtn[0];\r\n wptbPreviewBtn.classList.remove( 'wptb-button-disable' );\r\n let wptbPreviewBtnHref = wptbPreviewBtn.dataset.previewHref;\r\n wptbPreviewBtnHref = wptbPreviewBtnHref.replace( 'empty', data[1] );\r\n wptbPreviewBtn.setAttribute( 'href', wptbPreviewBtnHref );\r\n }\r\n\r\n event.target.dataset.wptbTableStateNumberSave = window.wptbTableStateNumberShow;\r\n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\r\n if( wptbSaveBtn.length > 0 ) {\r\n wptbSaveBtn = wptbSaveBtn[0];\r\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\r\n wptbSaveBtn.classList.remove('active');\r\n }\r\n } else if( data[0] == 'edited' ) {\r\n messagingArea.innerHTML = '<div class=\"wptb-success wptb-message\">Table \"' + t + '\" was successfully updated.</div>';\r\n event.target.dataset.wptbTableStateNumberSave = window.wptbTableStateNumberShow;\r\n\r\n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\r\n if( wptbSaveBtn.length > 0 ) {\r\n wptbSaveBtn = wptbSaveBtn[0];\r\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\r\n wptbSaveBtn.classList.remove('active');\r\n }\r\n } else if( data[0] == 'preview_edited' ) {\r\n return;\r\n } else {\r\n messagingArea.innerHTML = '<div class=\"wptb-error wptb-message\">Safety problems</div>';\r\n }\r\n messagingArea.classList.add( 'wptb-success' );\r\n setTimeout( function () {\r\n messagingArea.removeChild( messagingArea.firstChild );\r\n }, 4000 );\r\n }\r\n }\r\n http.send( params );\r\n },\r\n //\r\n clickOnFreeSpace: function() {\r\n // if current active section is responsive menu, ignore this functionality\r\n if(this.getCurrentSection() === 'table_responsive_menu'){\r\n return;\r\n }\r\n\r\n let cellModeBackground = document.querySelector( '#wptb-cell_mode_background' );\r\n if( cellModeBackground && cellModeBackground.classList.contains( 'visible' ) ) {\r\n return;\r\n }\r\n // document.getElementsByClassName( 'wptb-elements-container' )[0].style.display = 'table';\r\n // document.getElementsByClassName( 'wptb-settings-section' )[0].style.display = 'block';\r\n // document.getElementById( 'element-options-group' ).style.display = 'none';\r\n this.activateSection('elements');\r\n\r\n let wpcdFixedToolbar = document.getElementById( 'wpcd_fixed_toolbar' );\r\n if( wpcdFixedToolbar.hasAttribute( 'data-toolbar-active-id' ) ) {\r\n document.getElementById( wpcdFixedToolbar.getAttribute( 'data-toolbar-active-id' ) ).classList.remove( 'toolbar-active' );\r\n }\r\n let element = document.querySelector( '.wptb-preview-table' );\r\n if( element ) {\r\n WPTB_Helper.elementOptionsSet( 'table_setting', element );\r\n }\r\n },\r\n\r\n /*\r\n * function for sending of element ajax request\r\n */\r\n elementAjax: function( dataAjaxData, element ) {\r\n let http = new XMLHttpRequest(),\r\n url = ( wptb_admin_object ? wptb_admin_object.ajaxurl : ajaxurl ) + \"?action=wptb_element_ajax\";\r\n let element_name;\r\n let infArr = element.className.match( /wptb-element-(.+)-(\\d+)/i );\r\n if( infArr && Array.isArray( infArr ) ) {\r\n element_name = infArr[1];\r\n }\r\n\r\n let params = {\r\n element_ajax_data: dataAjaxData,\r\n element_name: element_name,\r\n security_code: wptb_admin_object.security_code\r\n };\r\n params = JSON.stringify( params );\r\n\r\n http.open( 'POST', url, true );\r\n http.setRequestHeader( 'Content-type', 'application/json; charset=utf-8' );\r\n\r\n http.onreadystatechange = function ( action ) {\r\n if ( this.readyState == 4 && this.status == 200 ) {\r\n var data = JSON.parse( http.responseText );\r\n let detail;\r\n if ( data && Array.isArray( data ) && data[0] == 'element_ajax_responce' ) {\r\n detail = {value: data[1]};\r\n } else {\r\n detail = '';\r\n }\r\n WPTB_Helper.wptbDocumentEventGenerate( 'wptb-element:ajax-response', element, detail );\r\n }\r\n }\r\n http.send( params );\r\n },\r\n\r\n /*\r\n * This just toggles visibility of cell edit bar, and toggles\r\n * cell selecting mode.\r\n */\r\n toggleTableEditMode: function ( close = false ) {\r\n let bar = document.getElementsByClassName('wptb-edit-bar'),\r\n cellModeBackground = document.getElementById('wptb-cell_mode_background'),\r\n leftScrollPanelCurtain = document.getElementById('wptb-left-scroll-panel-curtain'),\r\n leftScrollPanelCellSettings = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ),\r\n wptbPreviewTable = document.getElementsByClassName('wptb-preview-table');\r\n if (wptbPreviewTable.length > 0) {\r\n wptbPreviewTable = wptbPreviewTable[0];\r\n }\r\n\r\n if ( bar.length > 0 ) {\r\n let toggleEditMode = '';\r\n for ( let i = 0; i < bar.length; i++ ) {\r\n if ( bar[i].classList.contains( 'visible' ) ) {\r\n document.select.deactivateMultipleSelectMode();\r\n bar[i].classList.remove( 'visible' );\r\n cellModeBackground.classList.remove( 'visible' );\r\n leftScrollPanelCurtain.classList.remove( 'visible' );\r\n leftScrollPanelCellSettings.classList.remove( 'visible' );\r\n wptbPreviewTable.parentNode.classList.remove( 'wptb-preview-table-manage-cells' );\r\n let wptbPreviewTableTds = wptbPreviewTable.getElementsByTagName( 'td' );\r\n if ( wptbPreviewTableTds.length > 0 ) {\r\n for ( let i = 0; i < wptbPreviewTableTds.length; i++ ) {\r\n wptbPreviewTableTds[i].classList.remove( 'wptb-highlighted' );\r\n }\r\n }\r\n toggleEditMode = 'closed';\r\n\r\n } else if( ! close ) {\r\n document.select.activateMultipleSelectMode();\r\n bar[i].classList.add( 'visible' );\r\n cellModeBackground.classList.add( 'visible' );\r\n leftScrollPanelCurtain.classList.add( 'visible' );\r\n wptbPreviewTable.parentNode.classList.add( 'wptb-preview-table-manage-cells' );\r\n\r\n toggleEditMode = 'opened';\r\n }\r\n }\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-edit-mode/' + toggleEditMode, wptbPreviewTable)\r\n }\r\n },\r\n\r\n /*\r\n * checking of dimension of value\r\n */\r\n checkingDimensionValue: function ( value, dimension ) {\r\n value = String( value );\r\n dimension = String( dimension );\r\n if( value && dimension ) {\r\n let searchIndex = value.indexOf( dimension );\r\n if ( searchIndex != -1 && searchIndex == ( value.length - dimension.length ) ) {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n } else {\r\n return false;\r\n }\r\n },\r\n\r\n /*\r\n * if dimension is included - checking and if it necessary setting value\r\n * without dimension - return value\r\n */\r\n checkSetGetStyleSizeValue: function( element, styleName, computedStyleName, dimension ) {\r\n let elemStyleValue = element.style[styleName];\r\n elemStyleValue = String( elemStyleValue );\r\n\r\n if( ! elemStyleValue || dimension ? ! ( WPTB_Helper.checkingDimensionValue( elemStyleValue, dimension ) ) : false ){\r\n let elementStyles = window.getComputedStyle( element );\r\n if( computedStyleName && elementStyles.getPropertyValue( computedStyleName ) && dimension ? WPTB_Helper.checkingDimensionValue( elementStyles.getPropertyValue( computedStyleName ), dimension ) : true ) {\r\n if( ! dimension ) {\r\n return elementStyles.getPropertyValue( computedStyleName );\r\n } else {\r\n element.style[styleName] = elementStyles.getPropertyValue( computedStyleName );\r\n }\r\n } else {\r\n if( ! dimension ) {\r\n return false;\r\n } else {\r\n element.style[styleName] = null;\r\n }\r\n }\r\n } else if( ! dimension ) {\r\n return elemStyleValue;\r\n }\r\n\r\n return element.style[styleName];\r\n },\r\n\r\n /*\r\n * function checking that element has the style\r\n * if this style is present - checking the format color\r\n * if param set is true - setting style for element (consider hex format of color)\r\n * if param set is false - getting style from element\r\n */\r\n checkSetGetStyleColorValue: function ( element, styleName, computedStyleName, set = false ) {\r\n let elemStyleColorValue = element.style[styleName];\r\n\r\n if( ! elemStyleColorValue ) {\r\n let elementStyles = window.getComputedStyle( element, null );\r\n\r\n if( elementStyles && elementStyles.getPropertyValue( computedStyleName ) ) {\r\n\r\n if( set ) {\r\n elemStyleColorValue = WPTB_Helper.rgbToHex( elementStyles.getPropertyValue( computedStyleName ) );\r\n if( WPTB_Helper.isHex( elemStyleColorValue ) ) {\r\n element.style[styleName] = elemStyleColorValue;\r\n } else {\r\n element.style[styleName] = '';\r\n }\r\n } else {\r\n return elementStyles.getPropertyValue( computedStyleName );\r\n }\r\n\r\n } else {\r\n if( set ) {\r\n element.style[styleName] = '';\r\n } else {\r\n return '';\r\n }\r\n }\r\n } else if( ! set ) {\r\n return elemStyleColorValue;\r\n }\r\n },\r\n\r\n /*\r\n * function checking that element has the style\r\n * if this style is present - checking the format color\r\n * if param set is true - setting style for element (consider hex format of color)\r\n * if param set is false - getting style from element\r\n */\r\n checkSetGetStyleValue: function ( element, styleName, computedStyleName, set = false ) {\r\n let elemStyleColorValue = element.style[styleName];\r\n\r\n if( ! elemStyleColorValue ) {\r\n let elementStyles = window.getComputedStyle( element, null );\r\n\r\n if( elementStyles && elementStyles.getPropertyValue( computedStyleName ) ) {\r\n\r\n if( set ) {\r\n element.style[styleName] = elementStyles.getPropertyValue( computedStyleName );\r\n } else {\r\n return elementStyles.getPropertyValue( computedStyleName );\r\n }\r\n\r\n } else if( ! set ) {\r\n return '';\r\n }\r\n } else if( ! set ) {\r\n return elemStyleColorValue;\r\n }\r\n },\r\n\r\n /*\r\n * get the value of the same elements that have the most count\r\n */\r\n getValueMaxCountSameElementsInArray: function ( arr ) {\r\n if( arr && Array.isArray( arr ) ) {\r\n let check = {};\r\n for( let i = 0; i < arr.length; i++ ) {\r\n if( check[arr[i]] ) {\r\n check[arr[i]]++;\r\n } else {\r\n check[arr[i]] = 1;\r\n }\r\n }\r\n\r\n let maxPropName;\r\n for ( let key in check ) {\r\n if( ! maxPropName ) {\r\n maxPropName = key;\r\n continue;\r\n } else {\r\n if( check[maxPropName] < check[key] ) {\r\n maxPropName = key;\r\n }\r\n }\r\n }\r\n\r\n return maxPropName;\r\n }\r\n },\r\n\r\n /*\r\n * For assigning to each cell xIndex and y Index attributes,\r\n * these are the column number and row number of cell in table.\r\n */\r\n recalculateIndexes: function ( table ) {\r\n let trs = table.getElementsByTagName( 'tr' ),\r\n tds, maxCols = 0, maxColsFull = 0, tdsArr = [];\r\n\r\n for ( let i = 0; i < trs.length; i++ ) {\r\n tds = trs[i].getElementsByTagName( 'td' );\r\n\r\n if ( tdsArr[i] == undefined ) {\r\n tdsArr[i] = [];\r\n }\r\n\r\n let jMainIter = 0;\r\n for ( let j = 0; j < tds.length; j++ ) {\r\n if ( tdsArr[i][j] != undefined ) {\r\n for ( let y = 0; y < 100; y++ ) {\r\n if ( tdsArr[i][jMainIter] != undefined ) {\r\n jMainIter++;\r\n continue;\r\n }\r\n tdsArr[i][jMainIter] = tds[j];\r\n tds[j].dataset.xIndex = jMainIter;\r\n break;\r\n }\r\n } else {\r\n tdsArr[i][j] = tds[j];\r\n tds[j].dataset.xIndex = jMainIter;\r\n }\r\n tds[j].dataset.yIndex = i;\r\n\r\n if ( tds[j].colSpan > 1 ) {\r\n for ( let k = 1; k < tds[j].colSpan; k++ ) {\r\n jMainIter++;\r\n tdsArr[i][jMainIter] = 'tdDummy';\r\n }\r\n }\r\n\r\n if ( tds[j].rowSpan > 1 ) {\r\n for ( let x = 1; x < tds[j].rowSpan; x++ ) {\r\n if ( tdsArr[i + x] == undefined ) {\r\n tdsArr[i + x] = [];\r\n }\r\n for ( let z = 0; z < tds[j].colSpan; z++ ) {\r\n tdsArr[i + x][jMainIter - tds[j].colSpan + 1 + z ] = 'tdDummy';\r\n }\r\n }\r\n }\r\n jMainIter++;\r\n\r\n if ( j > maxCols ) {\r\n maxCols = j;\r\n }\r\n }\r\n\r\n if( i == 0 ) {\r\n maxColsFull = jMainIter;\r\n }\r\n }\r\n table.columns = maxCols;\r\n table.maxCols = maxColsFull;\r\n },\r\n\r\n /**\r\n * Table Rows colors reinstall\r\n */\r\n tableRowsColorsReinstall: function ( table ) {\r\n let infArr = table.className.match( /wptb-element-main(.+)-(\\d+)/i );\r\n if( infArr && Array.isArray( infArr ) ) {\r\n let tableIndex = '';\r\n if( infArr[infArr.length -1] == '0' ) {\r\n tableIndex = 'startedid-0';\r\n } else {\r\n tableIndex = infArr[infArr.length -1];\r\n }\r\n\r\n let tableHeaderBackground = document.querySelector('.wptb-el-main-table_setting-' + tableIndex + '-tableHeaderBackground' );\r\n if( tableHeaderBackground ) {\r\n let details = {value: tableHeaderBackground.value};\r\n WPTB_Helper.wptbDocumentEventGenerate( 'controlColor:change', tableHeaderBackground, details );\r\n }\r\n\r\n let tableEvenRowBackground = document.querySelector('.wptb-el-main-table_setting-' + tableIndex + '-tableEvenRowBackground' );\r\n if( tableEvenRowBackground ) {\r\n let details = {value: tableEvenRowBackground.value};\r\n WPTB_Helper.wptbDocumentEventGenerate( 'controlColor:change', tableEvenRowBackground, details );\r\n }\r\n\r\n let tableOddRowBackground = document.querySelector('.wptb-el-main-table_setting-' + tableIndex + '-tableOddRowBackground' );\r\n if( tableOddRowBackground ) {\r\n let details = {value: tableOddRowBackground.value};\r\n WPTB_Helper.wptbDocumentEventGenerate( 'controlColor:change', tableOddRowBackground, details );\r\n }\r\n }\r\n }\r\n}\r\n","var WPTB_Initializer = function () {\r\n\r\n const MIN_COLUMNS = 1,\r\n MIN_ROWS = 1,\r\n MAX_COLUMNS = 30,\r\n MAX_ROWS = 30;\r\n\r\n var tableGenerator = document.body;\r\n columnsDecrementButton = tableGenerator.getElementsByClassName('wptb-input-number-decrement')[0],\r\n columnsIncrementButton = tableGenerator.getElementsByClassName('wptb-input-number-increment')[0],\r\n rowsDecrementButton = tableGenerator.getElementsByClassName('wptb-input-number-decrement')[1],\r\n rowsIncrementButton = tableGenerator.getElementsByClassName('wptb-input-number-increment')[1],\r\n columnsInput = document.getElementById('wptb-columns-number'),\r\n rowsInput = document.getElementById('wptb-rows-number');\r\n \r\n columnsDecrementButton.onclick = function () {\r\n if (columnsInput.value > MIN_COLUMNS) {\r\n columnsInput.value--;\r\n }\r\n };\r\n\r\n columnsIncrementButton.onclick = function () {\r\n if (columnsInput.value < MAX_COLUMNS) {\r\n columnsInput.value++;\r\n }\r\n };\r\n\r\n rowsDecrementButton.onclick = function () {\r\n if (rowsInput.value > MIN_ROWS) {\r\n rowsInput.value--;\r\n }\r\n };\r\n\r\n rowsIncrementButton.onclick = function () {\r\n if (rowsInput.value < MAX_ROWS) {\r\n rowsInput.value++;\r\n }\r\n };\r\n\r\n document.getElementById( 'wptb-generate-table' ).onclick = function ( ) {\r\n var columns = document.getElementById('wptb-columns-number').value,\r\n rows = document.getElementById('wptb-rows-number').value;\r\n\r\n //wptbTableStateSaveManager.tableStateClear();\r\n \r\n WPTB_Table(columns, rows);\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n\r\n // register and setup section buttons\r\n WPTB_Helper.registerSections(['elements', 'table_settings', 'cell_settings', 'options_group' , 'table_responsive_menu']);\r\n WPTB_Helper.setupSectionButtons();\r\n\r\n // activate elements section for startup\r\n WPTB_Helper.activateSection('elements');\r\n\r\n // side bar toggle setup\r\n // WPTB_Helper.setupSidebarToggle('.wptb-panel-drawer-toggle');\r\n WPTB_Helper.setupSidebarToggle('.wptb-panel-toggle-section .wptb-panel-drawer-icon');\r\n\r\n // setup panel sections that have the ability to be toggled on/off\r\n WPTB_Helper.setupPanelToggleButtons();\r\n\r\n // setup responsive menu both at left and builder panel\r\n new WptbResponsive('table_responsive_menu', 'wptbResponsiveApp', '.wptb-builder-content');\r\n\r\n // get builder section from url parameter for easy switch at page load\r\n WPTB_Helper.getSectionFromUrl();\r\n};\r\n","var WPTB_innerElementSet = function ( element ) {\r\n \r\n element.ondragenter = function (e) {\r\n var div;\r\n if ( e.dataTransfer.types.indexOf( 'wptbelement' ) == -1 && e.dataTransfer.types.indexOf( 'wptb-moving-mode' ) == -1 ) {\r\n return;\r\n }\r\n WPTB_DropHandle(this, e);\r\n \r\n element.classList.add( 'wptb-ondragenter' );\r\n }\r\n element.ondragover = function (e) {\r\n e.preventDefault();\r\n WPTB_DropHandle(this, e);\r\n }\r\n element.ondragleave = function () {\r\n \r\n }\r\n element.ondrop = function(e) {\r\n this.classList.remove( 'wptb-ondragenter' );\r\n let element, classId;\r\n e.preventDefault();\r\n e.stopPropagation();\r\n\r\n if (!e.dataTransfer.getData('wptbElement') && !e.dataTransfer.getData('node')) {\r\n return;\r\n }\r\n let wptbDropHandle,\r\n wptbDropBorderMarker;\r\n if ( document.getElementsByClassName( 'wptb-drop-handle' ).length > 0 ) {\r\n wptbDropHandle = document.getElementsByClassName( 'wptb-drop-handle' )[0];\r\n }\r\n if( document.getElementsByClassName( 'wptb-drop-border-marker' ).length > 0 ) {\r\n wptbDropBorderMarker = document.getElementsByClassName( 'wptb-drop-border-marker' )[0];\r\n }\r\n\r\n if ( e.dataTransfer.getData( 'wptbElement' ) ) {\r\n element = WPTB_Helper.newElementProxy( e.dataTransfer.getData( 'wptbElement' ) );\r\n element = element.getDOMElement();\r\n } else {\r\n classId = e.dataTransfer.getData( 'node' );\r\n element = document.getElementsByClassName( classId )[0];\r\n //element.classList.remove( 'wptb-moving-mode' );\r\n }\r\n \r\n if( wptbDropHandle.style.display == 'block' ) {\r\n let td;\r\n if( wptbDropHandle.dataset.text == 'Drop Here' ) {\r\n td = wptbDropHandle.getDOMParentElement();\r\n td.appendChild( element );\r\n } else {\r\n let innerElement = wptbDropHandle.getDOMParentElement();\r\n td = innerElement.parentNode;\r\n\r\n if( wptbDropHandle.dataset.text == 'Above Element' ) {\r\n td.insertBefore( element, innerElement );\r\n } else if( wptbDropHandle.dataset.text == 'Below Element' ) {\r\n let innerElementNext = innerElement.nextSibling;\r\n td.insertBefore( element, innerElementNext );\r\n }\r\n }\r\n \r\n let thisRow = td.parentNode;\r\n if( WPTB_Helper.rowIsTop( thisRow ) ) { \r\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\r\n \r\n if( table.classList.contains( 'wptb-table-preview-head' ) ) {\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n }\r\n \r\n // start item javascript if item is new\r\n let infArr = element.className.match(/wptb-element-(.+)-(\\d+)/i);\r\n let elemKind = infArr[1];\r\n if ( e.dataTransfer.getData( 'wptbElement' ) && ( elemKind == 'text' || elemKind == 'button' || elemKind == 'image' || elemKind == 'star_rating' || elemKind == 'list' ) ) {\r\n //WPTB_Helper.elementStartScript( element );\r\n }\r\n } else {\r\n return;\r\n }\r\n \r\n wptbDropHandle.style.display = 'none';\r\n wptbDropBorderMarker.style.display = 'none';\r\n\r\n WPTB_innerElementSet( element );\r\n \r\n if( ! element.classList.contains( 'wptb-image-container' ) || element.classList.contains( 'wptb-moving-mode' ) ) {\r\n element.classList.remove( 'wptb-moving-mode' );\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n } \r\n return true;\r\n }\r\n element.onmouseover = function(e) {\r\n element.classList.remove( 'wptb-ondragenter' );\r\n }\r\n}","var WPTB_LeftPanel = function () {\r\n\r\n let table = document.getElementsByClassName('wptb-preview-table')[0],\r\n wptbElementButtons = document.getElementsByClassName('wptb-element');\r\n\r\n for (var i = 0; i < wptbElementButtons.length; i++) {\r\n wptbElementButtons[i].ondragstart = function (e) {\r\n e.dataTransfer.setData('wptbElement', this.dataset.wptbElement);\r\n e.dataTransfer.setData( 'wptbElIndic-' + this.dataset.wptbElement, 'wptbElIndic-' + this.dataset.wptbElement );\r\n }\r\n };\r\n \r\n if( table ) {\r\n let wptbTablesEditModeCloseButton = document.getElementsByClassName( 'wptb-table-edit-mode-close' );\r\n for ( let i = 0; i < wptbTablesEditModeCloseButton.length; i++ ) {\r\n wptbTablesEditModeCloseButton[i].onclick = WPTB_Helper.toggleTableEditMode;\r\n }\r\n document.getElementById('wptb-add-end-row').onclick = table.addRowToTheEnd;\r\n document.getElementById('wptb-add-start-row').onclick = table.addRowToTheStart;\r\n document.getElementById('wptb-add-row-before').onclick = table.addRowBefore;\r\n document.getElementById('wptb-add-row-after').onclick = table.addRowAfter;\r\n document.getElementById('wptb-add-end-column').onclick = table.addColumnEnd;\r\n document.getElementById('wptb-add-start-column').onclick = table.addColumnStart;\r\n document.getElementById('wptb-add-column-before').onclick = table.addColumnBefore;\r\n document.getElementById('wptb-add-column-after').onclick = table.addColumnAfter;\r\n document.getElementById('wptb-delete-column').onclick = table.deleteColumn;\r\n document.getElementById('wptb-delete-row').onclick = table.deleteRow;\r\n document.getElementById('wptb-merge-cells').onclick = table.mergeCells;\r\n document.getElementById('wptb-split-cell').onclick = table.splitCell;\r\n };\r\n\r\n // this code hides the \"element parameters\" area\r\n // when clicked outside this element and its \"tinymce\" toolbar \r\n let wptbBuilderPanel = document.getElementsByClassName( 'wptb-builder-panel' )[0];\r\n wptbBuilderPanel.onclick = function( e ) {\r\n if( ! e.target.classList.contains( 'wptb-ph-element' ) && ! WPTB_Helper.findAncestor( e.target, 'wptb-ph-element' ) && \r\n ! e.target.classList.contains( 'wptb-fixed-toolbar' ) && ! WPTB_Helper.findAncestor( e.target, 'wptb-fixed-toolbar' ) ) {\r\n WPTB_Helper.clickOnFreeSpace();\r\n } \r\n };\r\n \r\n let wptbHeader = document.getElementsByClassName( 'wptb-header' );\r\n if( wptbHeader.length > 0 ) wptbHeader = wptbHeader[0];\r\n wptbHeader.onclick = function() {\r\n WPTB_Helper.clickOnFreeSpace();\r\n };\r\n};","var MultipleSelect = function () {\r\n\r\n\tvar selectedCells = [],\r\n\t\tmultipleCellMode = false;\r\n\r\n\tthis.activateMultipleSelectMode = function () {\r\n\t\tselectedCells = [];\r\n\t\tvar tds = document.getElementsByClassName('wptb-preview-table')[0].getElementsByTagName('td');\r\n\t\tfor (var i = 0; i < tds.length; i++) {\r\n\t\t\ttds[i].classList.remove('wptb-highlighted');\r\n\t\t}\r\n\t\tmultipleCellMode = true;\r\n\t}\r\n\r\n\tthis.deactivateMultipleSelectMode = function () {\r\n\t\tmultipleCellMode = false;\r\n\t}\r\n\r\n\tthis.isActivated = function () {\r\n\t\treturn multipleCellMode;\r\n\t}\r\n\r\n\tthis.pushSelectedCell = function (cell) {\r\n\t\tif (!multipleCellMode) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tselectedCells.push(cell);\r\n\t\tcell.classList.add('wptb-highlighted');\r\n\t};\r\n\r\n\tthis.selectedCells = function () {\r\n\t\treturn selectedCells;\r\n\t}\r\n\r\n\tthis.flushSelectedCells = function () {\r\n\t\tselectedCells = [];\r\n\t}\r\n\r\n\tthis.getFirst = function () {\r\n\t\tvar minXIndex = 1000, minYIndex = 1000, first;\r\n\t\tfor (var i = selectedCells.length - 1; i >= 0; i--) {\r\n\t\t\tif (minXIndex >= selectedCells[i].dataset.xIndex\r\n\t\t\t\t&& minYIndex >= selectedCells[i].dataset.yIndex) {\r\n\t\t\t\tfirst = selectedCells[i];\r\n\t\t\t\tminXIndex = selectedCells[i].dataset.xIndex;\r\n\t\t\t\tminYIndex = selectedCells[i].dataset.yIndex;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn first;\r\n\t}\r\n\r\n\tthis.getLast = function () {\r\n\t\tvar maxXIndex = -1, maxYIndex = -1, last;\r\n\t\tfor (var i = selectedCells.length - 1; i >= 0; i--) {\r\n\t\t\tif (maxXIndex <= selectedCells[i].dataset.xIndex\r\n\t\t\t\t&& maxYIndex <= selectedCells[i].dataset.yIndex) {\r\n\t\t\t\tlast = selectedCells[i];\r\n\t\t\t\tmaxXIndex = selectedCells[i].dataset.xIndex;\r\n\t\t\t\tmaxYIndex = selectedCells[i].dataset.yIndex;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn last;\r\n\t}\r\n\r\n\tthis.removeAllButFirst = function () {\r\n\t\tvar td = this.getFirst();\r\n\t\tfor (var i = 1; i < selectedCells.length; i++) {\r\n\t\t\tselectedCells[i].classList.add('wptb-fused-cell-' + td.dataset.xIndex + '-' + td.dataset.yIndex);\r\n\t\t}\r\n\t}\r\n\r\n\treturn this;\r\n\r\n};","var WPTB_Parser = function ( code ) {\r\n let div = document.createElement( 'div' );\r\n div.innerHTML = code;\r\n \r\n let table = div.children[0];\r\n let columnTitleMobile = [...table.querySelectorAll( '.wptb-column-title-mobile-container' )];\r\n \r\n for( let i = 0; i < columnTitleMobile.length; i++ ) {\r\n let parent = columnTitleMobile[i].parentNode;\r\n parent.removeChild( columnTitleMobile[i] );\r\n }\r\n \r\n let tds = table.querySelectorAll( 'td' );\r\n for ( let i = 0; i < tds.length; i++ ) {\r\n tds[i].classList.add( 'wptb-droppable' );\r\n tds[i].classList.remove( 'wptb-column-title-mobile-not-elements' );\r\n }\r\n \r\n return table;\r\n}","// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys\r\nif (!Object.keys) {\r\n Object.keys = (function () {\r\n 'use strict';\r\n var hasOwnProperty = Object.prototype.hasOwnProperty,\r\n hasDontEnumBug = !({toString: null}).propertyIsEnumerable('toString'),\r\n dontEnums = [\r\n 'toString',\r\n 'toLocaleString',\r\n 'valueOf',\r\n 'hasOwnProperty',\r\n 'isPrototypeOf',\r\n 'propertyIsEnumerable',\r\n 'constructor'\r\n ],\r\n dontEnumsLength = dontEnums.length;\r\n\r\n return function (obj) {\r\n if (typeof obj !== 'object' && (typeof obj !== 'function' || obj === null)) {\r\n throw new TypeError('Object.keys called on non-object');\r\n }\r\n\r\n var result = [], prop, i;\r\n\r\n for (prop in obj) {\r\n if (hasOwnProperty.call(obj, prop)) {\r\n result.push(prop);\r\n }\r\n }\r\n\r\n if (hasDontEnumBug) {\r\n for (i = 0; i < dontEnumsLength; i++) {\r\n if (hasOwnProperty.call(obj, dontEnums[i])) {\r\n result.push(dontEnums[i]);\r\n }\r\n }\r\n }\r\n return result;\r\n };\r\n }());\r\n}","/**\r\n * Responsive menu and options class.\r\n *\r\n * This class will be called and instanced at table builder menu to add it the responsive menu and its controls.\r\n *\r\n * @param {string} sectionName section name\r\n * @param {string} responsiveWrapperId id for mount point\r\n * @param {string} mainContainerQuery query to find parent container for responsive menu\r\n * @throws {Error} will throw an error if mainContainerQuery failed to find any element\r\n * @constructor\r\n */\r\n// eslint-disable-next-line no-unused-vars\r\nfunction WptbResponsive(sectionName, responsiveWrapperId, mainContainerQuery) {\r\n\tthis.sectionName = sectionName;\r\n\tthis.responsiveWrapperId = responsiveWrapperId;\r\n\tthis.responsiveTable = null;\r\n\tthis.loaded = false;\r\n\r\n\t/**\r\n\t * Add responsive container to dom.\r\n\t */\r\n\tthis.addContainerToDom = () => {\r\n\t\tconst responsiveContainer = document.querySelector(`#${this.responsiveWrapperId}`);\r\n\t\tif (!responsiveContainer) {\r\n\t\t\tconst mainContainer = document.querySelector(mainContainerQuery);\r\n\r\n\t\t\t// parent container not found, throw error\r\n\t\t\tif (!mainContainer) {\r\n\t\t\t\tthrow new Error(\r\n\t\t\t\t\t`[WPTB_Responsive]: no parent container is found with the given query of [${mainContainerQuery}]`\r\n\t\t\t\t);\r\n\t\t\t}\r\n\r\n\t\t\tconst range = document.createRange();\r\n\t\t\trange.setStart(mainContainer, 0);\r\n\r\n\t\t\tconst responsiveElement = range.createContextualFragment(\r\n\t\t\t\t`<div class=\"wptb-responsive\" id=\"${this.responsiveWrapperId}\">responsive element</div>`\r\n\t\t\t);\r\n\t\t\tmainContainer.appendChild(responsiveElement);\r\n\t\t\tthis.loaded = true;\r\n\t\t}\r\n\r\n\t\tthis.responsiveTable = document.querySelector(`#${this.responsiveWrapperId}`);\r\n\t};\r\n\r\n\t/**\r\n\t * Load and make necessary mount preparations for component.\r\n\t */\r\n\tthis.load = () => {\r\n\t\tif (!this.loaded) {\r\n\t\t\tthis.addContainerToDom();\r\n\r\n\t\t\tWPTB_Helper.elementStartScript(this.responsiveTable, 'table_responsive_menu');\r\n\t\t\tWPTB_Helper.elementOptionsSet('table_responsive_menu', this.responsiveTable);\r\n\t\t\tWPTB_ControlsManager.callControlScript('ResponsiveTable', this.responsiveWrapperId);\r\n\t\t}\r\n\t};\r\n\r\n\t/**\r\n\t * Startup hook for the component.\r\n\t */\r\n\tthis.startUp = () => {\r\n\t\t// event listener for section change events\r\n\t\tdocument.addEventListener('wptbSectionChanged', (e) => {\r\n\t\t\tconst tablePreview = document.querySelector('.wptb-preview-table');\r\n\r\n\t\t\t// check if activated section is related to responsive and there is a main table already in the view\r\n\t\t\tif (e.detail === this.sectionName && tablePreview) {\r\n\t\t\t\tthis.load();\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\t// event listener for table ready signal\r\n\t\tdocument.addEventListener('wptb:table:generated', () => {\r\n\t\t\t// check current section to be sure that responsive menu is the active one before calling load related scripts\r\n\t\t\tif (WPTB_Helper.getCurrentSection() === 'table_responsive_menu') {\r\n\t\t\t\tthis.load();\r\n\t\t\t}\r\n\t\t});\r\n\t};\r\n\r\n\tthis.startUp();\r\n}\r\n","var WPTB_Settings = function () {\r\n var elems = document.getElementsByClassName('wptb-element');\r\n\r\n for ( var i = 0; i < elems.length; i++ ) {\r\n elems[i].ondragstart = function ( event ) {\r\n event.dataTransfer.effectAllowed = 'move';\r\n event.dataTransfer.setData( 'wptbElement', event.target.dataset.wptbElement );\r\n event.dataTransfer.setData( 'wptbElIndic-' + event.target.dataset.wptbElement, 'wptbElIndic-' + event.target.dataset.wptbElement );\r\n }\r\n elems[i].ondragend = function () {\r\n WPTB_Helper.elementDragEndClear();\r\n }\r\n };\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n let wptbUndo = document.getElementsByClassName( 'wptb-undo' );\r\n if( wptbUndo.length > 0 ) {\r\n wptbUndo = wptbUndo[0];\r\n \r\n wptbUndo.onclick = function( event ) {\r\n if( ! this.classList.contains( 'wptb-undoredo-disabled' ) ) {\r\n wptbTableStateSaveManager.tableStateGet( this.dataset.wptbUndoredo );\r\n let wptbUndoRedoContainer = document.getElementsByClassName( 'wptb-undo-redo-container' );\r\n if(wptbUndoRedoContainer.length > 0) {\r\n wptbUndoRedoContainer = wptbUndoRedoContainer[0];\r\n wptbUndoRedoContainer.onmouseleave = function( event ) {\r\n event.target.onmouseleave = '';\r\n let table = document.querySelector( '.wptb-preview-table' );\r\n WPTB_Table();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n \r\n let wptbRedo = document.getElementsByClassName( 'wptb-redo' );\r\n if( wptbRedo.length > 0 ) {\r\n wptbRedo = wptbRedo[0];\r\n \r\n wptbRedo.onclick = function( event ) {\r\n if( ! this.classList.contains( 'wptb-undoredo-disabled' ) ) {\r\n wptbTableStateSaveManager.tableStateGet( this.dataset.wptbUndoredo );\r\n let wptbUndoRedoContainer = document.getElementsByClassName( 'wptb-undo-redo-container' );\r\n if(wptbUndoRedoContainer.length > 0) {\r\n wptbUndoRedoContainer = wptbUndoRedoContainer[0];\r\n wptbUndoRedoContainer.onmouseleave = function( event ) {\r\n event.target.onmouseleave = '';\r\n let table = document.querySelector( '.wptb-preview-table' );\r\n WPTB_Table();\r\n }\r\n }\r\n }\r\n \r\n }\r\n }\r\n \r\n let shortcodePopupWindow = document.getElementsByClassName( 'wptb-popup-window-modal' )[0];\r\n document.getElementsByClassName( 'wptb-embed-btn' )[0].onclick = function () {\r\n if( ! this.classList.contains( 'wptb-button-disable' ) ) {\r\n shortcodePopupWindow.classList.add( 'wptb-popup-show' );\r\n }\r\n }\r\n \r\n window.onbeforeunload = function(e) {\r\n let wptbSaveDisabled = document.getElementsByClassName( 'wptb-save-disabled' );\r\n if( wptbSaveDisabled.length == 0 ) {\r\n return true;\r\n } else {\r\n return null;\r\n }\r\n };\r\n \r\n \r\n document.getElementsByClassName( 'wptb-popup-dark-area' )[0].onclick = function () {\r\n shortcodePopupWindow.classList.remove( 'wptb-popup-show' );\r\n }\r\n \r\n document.getElementsByClassName( 'wptb-popup-window-close-icon' )[0].onclick = function () {\r\n shortcodePopupWindow.classList.remove( 'wptb-popup-show' );\r\n }\r\n \r\n document.getElementsByClassName( 'wptb-preview-btn' )[0].onclick = function ( event ) {\r\n if( this.classList.contains( 'wptb-button-disable' ) ) {\r\n return;\r\n } \r\n \r\n let previewId = Math.floor( Math.random() * 10000 );\r\n \r\n var newHref = new URL( event.target.href );\r\n newHref.searchParams.set( 'preview_id', previewId );\r\n event.target.href = newHref.toString();\r\n WPTB_Helper.saveTable( event, false, previewId );\r\n }\r\n\r\n document.getElementsByClassName( 'wptb-save-btn' )[0].onclick = function ( event ) {\r\n if( ! this.classList.contains( 'wptb-save-disabled' ) ) {\r\n WPTB_Helper.saveTable( event );\r\n }\r\n }\r\n\r\n let tableTitleField = document.querySelector( '#wptb-setup-name' );\r\n if( tableTitleField ) {\r\n tableTitleField.onchange = function () {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n }\r\n};\r\n","var WPTB_Stringifier = function ( codeMain ) {\r\n if ( codeMain ) {\r\n let code = codeMain.cloneNode( true );\r\n code.dataset.tableColumns = codeMain.columns;\r\n code.style.width = null;\r\n code.style.minWidth = null;\r\n code.style.maxWidth = null;\r\n \r\n let tds = code.getElementsByTagName( 'td' );\r\n if ( tds.length > 0 ) {\r\n for ( let i = 0; i < tds.length; i++ ) {\r\n\r\n tds[i].removeAttribute( 'data-x-index' );\r\n tds[i].removeAttribute( 'data-y-index' );\r\n tds[i].removeAttribute( 'draggable' );\r\n tds[i].classList.remove( 'wptb-droppable' );\r\n let infArr = tds[i].className.match( /wptb-element-((.+-)\\d+)/i );\r\n if(infArr) tds[i].classList.remove(infArr[0]);\r\n let innerElements = tds[i].getElementsByClassName( 'wptb-ph-element' );\r\n \r\n if ( innerElements.length > 0 ) {\r\n for ( let j = 0; j < innerElements.length; j++ ) {\r\n \r\n let mceContentBodys = innerElements[j].querySelectorAll( '.mce-content-body' );\r\n if( mceContentBodys.length > 0 ) {\r\n for ( let k = 0; k < mceContentBodys.length; k++ ) {\r\n mceContentBodys[k].classList.remove( 'mce-content-body' );\r\n }\r\n }\r\n \r\n let dataMceStyle = innerElements[j].querySelectorAll( '[data-mce-style]' );\r\n if ( dataMceStyle.length > 0 ) {\r\n for ( let k = 0; k < dataMceStyle.length; k++ ) {\r\n dataMceStyle[k].removeAttribute( 'data-mce-style' );\r\n }\r\n }\r\n \r\n let contentEditable = innerElements[j].querySelectorAll( '[contenteditable]' );\r\n if ( contentEditable.length > 0 ) {\r\n for ( let k = 0; k < contentEditable.length; k++ ) {\r\n contentEditable[k].removeAttribute( 'contenteditable' );\r\n }\r\n }\r\n \r\n let spellCheck = innerElements[j].querySelectorAll( '[spellcheck]' );\r\n if ( spellCheck.length > 0 ) {\r\n for ( let k = 0; k < spellCheck.length; k++ ) {\r\n spellCheck[k].removeAttribute( 'spellcheck' );\r\n }\r\n }\r\n \r\n let mceIds = innerElements[j].querySelectorAll( '[id^=mce_]' );\r\n if ( mceIds.length > 0 ) {\r\n for ( let k = 0; k < mceIds.length; k++ ) {\r\n mceIds[k].removeAttribute( 'id' );\r\n }\r\n }\r\n \r\n let wptbActions = innerElements[j].querySelectorAll( '.wptb-actions' );\r\n let wptbActionsLength = wptbActions.length;\r\n while ( wptbActionsLength > 0 ) {\r\n if( wptbActions[0] && wptbActions[0].parentNode ) {\r\n wptbActions[0].parentNode.removeChild( wptbActions[0] );\r\n wptbActionsLength--;\r\n } else {\r\n break;\r\n }\r\n \r\n } \r\n \r\n let dataMceBogus = innerElements[j].querySelectorAll( '[data-mce-bogus]' );\r\n if( dataMceBogus.length > 0 ) {\r\n dataMceBogus = [...dataMceBogus];\r\n for( let k = 0; k < dataMceBogus.length; k++ ) {\r\n if( dataMceBogus[k] && dataMceBogus[k].parentNode ) {\r\n dataMceBogus[k].parentNode.removeChild( dataMceBogus[k] );\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n // TODO dataTitleColumnSet\r\n // if( tds[i].hasAttribute( 'data-wptb-title-column' ) ) {\r\n // let columnNameDivContainer = document.createElement( 'div' ),\r\n // columnNameDiv = document.createElement( 'div' );\r\n // columnNameDivContainer.classList.add( 'wptb-column-title-mobile-container' );\r\n // columnNameDiv.classList.add( 'wptb-column-title-mobile' );\r\n // columnNameDiv.dataset.wptbTitleColumn = tds[i].dataset.wptbTitleColumn;\r\n // columnNameDiv.setAttribute( 'style', 'font-size:' + tds[i].dataset.wptbTitleColumnFontSize + '; \\n\\\r\n // color:' + tds[i].dataset.wptbTitleColumnColor + '; background-color:' + tds[i].dataset.wptbTitleBackgroundColor + '; text-align:' + tds[i].dataset.wptbTitleAlign + ';' );\r\n // columnNameDiv.style.padding = tds[i].style.padding;\r\n // if( tds[i].children.length == 0 ) {\r\n // tds[i].classList.add( 'wptb-column-title-mobile-not-elements' );\r\n // }\r\n // columnNameDivContainer.appendChild( columnNameDiv );\r\n // tds[i].insertBefore( columnNameDivContainer, tds[i].firstChild );\r\n // }\r\n }\r\n }\r\n \r\n return code;\r\n }\r\n}","var array = [], WPTB_Table = function ( columns, rows, wptb_preview_table ) {\r\n\r\n /* The members of the class */\r\n var settings = document.getElementsByClassName('wptb-settings-items'),\r\n wptbTableSetup = document.getElementsByClassName(\"wptb-table-setup\")[0],\r\n table, row, cell,\r\n maxAmountOfCells,\r\n maxAmountOfRows;\r\n\r\n //HERE ARE THE PRIVATE FUNCTIONS\r\n /*\r\n * This function toggles buttons visibility in cell edit mode\r\n * (according to the amount of currently selected cells), and\r\n * highlights visually the clicked cell if it is not highlighted, or\r\n * removes highlight if clicked cell is already highlighted. \r\n * It too toggles the bits of our abstract representation.\r\n * @param Event this is the event instance of the click performed over a cell.\r\n */\r\n var mark = function ( event ) {\r\n let thisElem = event.currentTarget;\r\n let rs = thisElem.rowSpan,\r\n cs = thisElem.colSpan,\r\n noCells = document.getElementsByClassName('wptb-no-cell-action'),\r\n singleCells = document.getElementsByClassName('wptb-single-action'),\r\n multipleCells = document.getElementsByClassName('wptb-multiple-select-action'),\r\n cellSettings = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ),\r\n position = getCoords(thisElem),\r\n row = position[0],\r\n column = position[1];\r\n if ( ! document.select.isActivated() ) {\r\n return;\r\n }\r\n if (thisElem.className.match(/wptb-highlighted/)) {\r\n thisElem.classList.remove('wptb-highlighted');\r\n for (var i = 0; i < rs; i++) {\r\n for (var j = 0; j < cs; j++) {\r\n array[row + i][column + j] = 0;\r\n }\r\n }\r\n } else {\r\n thisElem.classList.add('wptb-highlighted');\r\n for (var i = 0; i < rs; i++) {\r\n for (var j = 0; j < cs; j++) {\r\n array[row + i][column + j] = 1;\r\n }\r\n }\r\n }\r\n\r\n let cellHighlighted = document.getElementsByClassName('wptb-highlighted'),\r\n markedCells = cellHighlighted.length;\r\n if (markedCells === 0) {\r\n for (var i = 0; i < multipleCells.length; i++) {\r\n multipleCells[i].classList.remove('visible');\r\n multipleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n for (var i = 0; i < noCells.length; i++) {\r\n noCells[i].classList.add('visible');\r\n noCells[i].removeAttribute('disabled');\r\n }\r\n for (var i = 0; i < singleCells.length; i++) {\r\n singleCells[i].classList.remove('visible');\r\n singleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n cellSettings.classList.remove( 'visible' );\r\n } else if (markedCells === 1) {\r\n for (var i = 0; i < multipleCells.length; i++) {\r\n multipleCells[i].classList.remove('visible');\r\n multipleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n for (var i = 0; i < noCells.length; i++) {\r\n noCells[i].classList.remove('visible');\r\n noCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n for (var i = 0; i < singleCells.length; i++) {\r\n singleCells[i].classList.add('visible');\r\n singleCells[i].removeAttribute('disabled');\r\n }\r\n\r\n cellHighlighted = cellHighlighted[0];\r\n WPTB_Helper.elementOptionsSet( 'table_cell_setting', cellHighlighted );\r\n\r\n let infArr = cellHighlighted.className.match( /wptb-element-((.+-)\\d+)/i );\r\n\r\n const controlElemIds = ['cellWidth', 'cellHeight'];\r\n\r\n controlElemIds.map(s => {\r\n let elementControlSizeUnicClass = `wptb-el-${infArr[1]}-${s}`,\r\n elementControlSizeFixedUnicClass = `wptb-el-${infArr[1]}-${s}Fixed`;\r\n if(s === 'cellWidth' || s === 'cellHeight') {\r\n let sizeName = '',\r\n getSizeFunctionName = '';\r\n if(s === 'cellWidth') {\r\n sizeName = 'width';\r\n getSizeFunctionName = 'getColumnWidth';\r\n } else if(s === 'cellHeight') {\r\n sizeName = 'height';\r\n getSizeFunctionName = 'getRowHeight';\r\n }\r\n let size = cellHighlighted.style[sizeName],\r\n cellSizeInputs = document.querySelectorAll( '.' + elementControlSizeUnicClass ),\r\n cellSizeFixedInput = document.querySelector( '.' + elementControlSizeFixedUnicClass );\r\n cellSizeInputs = [...cellSizeInputs];\r\n\r\n if(!size && !cellHighlighted.dataset[`wptbFixed${sizeName.toUpperCase()}`]) {\r\n size = WPTB_Helper[getSizeFunctionName](table, cellHighlighted);\r\n cellSizeInputs.map(s => {\r\n s.value = size;\r\n });\r\n\r\n cellSizeFixedInput.checked = false;\r\n } else {\r\n cellSizeInputs.map(s => {\r\n if( size ) {\r\n s.value = parseFloat( size, 10 );\r\n } else if( cellHighlighted.dataset[`wptbFixed${sizeName.toUpperCase()}`] ) {\r\n s.value = cellHighlighted.dataset[`wptbFixed${sizeName.toUpperCase()}`];\r\n }\r\n });\r\n\r\n cellSizeFixedInput.checked = true;\r\n }\r\n }\r\n });\r\n\r\n cellSettings.classList.add( 'visible' );\r\n } else {\r\n for (var i = 0; i < multipleCells.length; i++) {\r\n if (table.isSquare(array)) {\r\n multipleCells[i].classList.add('visible');\r\n multipleCells[i].removeAttribute('disabled');\r\n } else {\r\n multipleCells[i].classList.remove('visible');\r\n multipleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n }\r\n for (var i = 0; i < noCells.length; i++) {\r\n noCells[i].classList.remove('visible');\r\n noCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n for (var i = 0; i < singleCells.length; i++) {\r\n singleCells[i].classList.remove('visible');\r\n singleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n cellSettings.classList.remove( 'visible' );\r\n }\r\n\r\n let details = {countMarkedCells:markedCells};\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/cell/mark', thisElem, details);\r\n };\r\n\r\n /* \r\n * This function fills an array with 1's according to the actual design\r\n * of HTML table.\r\n * @returns an array of arrays containing an abstract representation\r\n * of HTML table.\r\n * @deprecated\r\n * */\r\n\r\n var realTimeArray = function () {\r\n var carried = [], tds, cols, matriz = [];\r\n\r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n carried[i] = 0;\r\n }\r\n\r\n for (var i = 0; i < table.rows.length; i++) {\r\n cols = [];\r\n\r\n var tds = table.rows[i].getElementsByTagName('td');\r\n\r\n for (items = 0; items < tds.length; items++) {\r\n\r\n for (var k = 0; k < tds[items].colSpan; k++) {\r\n cols.push(1);\r\n }\r\n\r\n if (tds[items].rowSpan > 1) {\r\n for (var k = 0; k < tds[items].colSpan; k++) {\r\n carried[items + k] = {\r\n justAssigned: true,\r\n amount: tds[items].rowSpan\r\n };\r\n }\r\n }\r\n }\r\n\r\n for (var k = 0; k < maxAmountOfCells; k++) {\r\n if (typeof carried[k] == 'object' && carried[k].amount > 0) {\r\n carried[k].amount--;\r\n if (carried[k].justAssigned) {\r\n carried[k].justAssigned = false;\r\n } else {\r\n cols.push(1);\r\n }\r\n }\r\n }\r\n\r\n matriz.push(cols);\r\n\r\n }\r\n return matriz;\r\n };\r\n\r\n /*\r\n * This function gets the number and position of cell spaces in current row that are occuped \r\n * by upper rowspanned cells.\r\n * @param number the number of row where we wish to calculate the carried rowspans up to.\r\n * @return an array with the remaining rowspans in each column.\r\n */\r\n var carriedRowspans = function (row) {\r\n var carried = [], tds, cols;\r\n\r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n carried[i] = 0;\r\n }\r\n\r\n if (row == -1) {\r\n return carried;\r\n }\r\n\r\n for (var i = 0; i <= row; i++) {\r\n cellsBuffer = table.rows[i].getElementsByTagName('td');\r\n cellPointer = 0;\r\n\r\n for (var xPosition = 0; xPosition < maxAmountOfCells; xPosition += stepsToMove) {\r\n stepsToMove = 1;\r\n\r\n if (carried[xPosition]) {\r\n carried[xPosition]--;\r\n } else {\r\n celda = cellsBuffer[cellPointer++];\r\n if (celda.rowSpan > 1) {\r\n for (k = 0; k < celda.colSpan; k++) {\r\n carried[xPosition + k] = celda.rowSpan - 1;\r\n }\r\n stepsToMove = celda.colSpan;\r\n } else if (celda.colSpan > 1) {\r\n stepsToMove = celda.colSpan;\r\n }\r\n }\r\n }\r\n\r\n }\r\n return carried;\r\n };\r\n\r\n /*\r\n * A helpful function for showing\r\n * the abstract table in console.\r\n * @param Array our abstract table.\r\n */\r\n var drawTable = function (a) {\r\n var string = 'DRAWING TABLE:\\n';\r\n for (var i = 0; i < a.length; i++) {\r\n\r\n for (var j = 0; j < a[i].length; j++) {\r\n string += ' ' + a[i][j];\r\n }\r\n string += '\\n';\r\n }\r\n table.isSquare(a);\r\n };\r\n\r\n /*\r\n * It resets all the bits of our abstract representation\r\n * to 0 and removes the highlighting class of all cells.\r\n */\r\n\r\n var undoSelect = function () {\r\n let noCells = document.getElementsByClassName('wptb-no-cell-action'),\r\n singleCells = document.getElementsByClassName('wptb-single-action'),\r\n multipleCells = document.getElementsByClassName('wptb-multiple-select-action'),\r\n cellSettings = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ),\r\n tds = table.getElementsByClassName('wptb-highlighted');\r\n while (tds.length) {\r\n tds[0].classList.remove('wptb-highlighted');\r\n }\r\n cellSettings.classList.remove( 'visible' );\r\n for (let i = 0; i < array.length; i++) {\r\n for (let j = 0; j < array[i].length; j++) {\r\n array[i][j] = 0;\r\n }\r\n }\r\n for (let i = 0; i < multipleCells.length; i++) {\r\n multipleCells[i].classList.remove('visible');\r\n multipleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n for (let i = 0; i < noCells.length; i++) {\r\n noCells[i].classList.add('visible');\r\n noCells[i].removeAttribute('disabled');\r\n }\r\n for (let i = 0; i < singleCells.length; i++) {\r\n singleCells[i].classList.remove('visible');\r\n singleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/undo-select/active', table);\r\n };\r\n\r\n /*\r\n * This fills the abstract representation of our table with \r\n * zeros, at the start. the max amount of cells is the greatest sum\r\n * of all colspans for row.\r\n */\r\n\r\n var fillTableArray = function () {\r\n var colspansSums = [], a = [];\r\n\r\n //calculate max amount of cells inside a row\r\n for (var i = 0; i < table.rows.length; i++) {\r\n var cells = table.rows[i].getElementsByTagName('td'),\r\n colspanSumInRow = 0;\r\n for (var j = 0; j < cells.length; j++) {\r\n colspanSumInRow += cells[j].colSpan;\r\n }\r\n colspansSums.push(colspanSumInRow);\r\n }\r\n\r\n maxAmountOfCells = Math.max.apply(null, colspansSums);\r\n //calculate max rows\r\n var maxAmountOfRows = table.rows.length;\r\n\r\n // fill with zeros from both values\r\n for (var i = 0; i < maxAmountOfRows; i++) {\r\n a[i] = [];\r\n for (var j = 0; j < maxAmountOfCells; j++) {\r\n a[i].push(0);\r\n }\r\n }\r\n drawTable(a);\r\n return a;\r\n };\r\n\r\n /*\r\n * This function gets the sum of all colspans in a row.\r\n * @param number the number of row to be used as reference.\r\n */\r\n var getActualPointsInRow = function (row) {\r\n var tds = table.rows[row].getElementsByTagName('td'),\r\n points = 0;\r\n for (var i = 0; i < tds.length; i++) {\r\n points += tds[i].colSpan;\r\n }\r\n return points;\r\n }\r\n\r\n /*\r\n * This function gets us the exact coordinates of\r\n * an exact cell, in a more reliable way than xIndex and yIndex,\r\n * these last ones were meant to be used for getting the cell trough them.\r\n * @param DOMElement the cell to get the coordinates.\r\n */\r\n var getCoords = function (search) {\r\n var skipInCols = [], cell;\r\n\r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n skipInCols[i] = 0;\r\n }\r\n\r\n for (var i = 0; i < table.rows.length; i++) {\r\n var cellsBuffer = table.rows[i].getElementsByTagName('td');\r\n cellPointer = 0;\r\n for (var xPosition = 0; xPosition < maxAmountOfCells; xPosition += stepsToMove) {\r\n stepsToMove = 1;\r\n\r\n if (skipInCols[xPosition]) {\r\n skipInCols[xPosition]--;\r\n } else {\r\n var td = cellsBuffer[cellPointer++];\r\n if (td == search) {\r\n return [i, xPosition];\r\n }\r\n if (td.rowSpan > 1) {\r\n for ( let k = 0; k < td.colSpan; k++ ) {\r\n skipInCols[xPosition + k] = td.rowSpan - 1;\r\n }\r\n stepsToMove = td.colSpan;\r\n } else if (td.colSpan > 1) {\r\n stepsToMove = td.colSpan;\r\n }\r\n }\r\n }\r\n }\r\n };\r\n\r\n jQuery('#wptb-table-border-color').val('');\r\n jQuery('#wptb-table-padding-number,#wptb-table-padding-slider').val('15');\r\n\r\n if ( columns || rows ) {\r\n //END OF PRIVATE FUNCTIONS\r\n for (var i = 0; i < settings.length; i++) {\r\n if (settings[i].id !== 'wptb-apply-inner-border') {\r\n settings[i].classList.add('visible');\r\n }\r\n }\r\n\r\n //Create a HTML Table element.\r\n table = document.createElement( 'table' );\r\n table.classList.add( 'wptb-preview-table', 'wptb-element-main-table_setting-startedid-0' );\r\n table.style.border = '0px solid';\r\n table.dataset.reconstraction = 1;\r\n //table.dataset.wptbAdaptiveTable = 1;\r\n //Add the data rows.\r\n for (var i = 0; i < rows; i++) {\r\n\r\n row = table.insertRow(-1);\r\n row.classList.add( 'wptb-row' );\r\n\r\n for (var j = 0; j < columns; j++) {\r\n cell = new WPTB_Cell(mark);\r\n cell.setCoords(i, j);\r\n cell.getDOMElement().style.borderWidth = '1px';\r\n row.appendChild(cell.getDOMElement());\r\n }\r\n }\r\n } else {\r\n if( ! wptb_preview_table ) wptb_preview_table = document.querySelector( '.wptb-preview-table' );\r\n\r\n if ( wptb_preview_table ) {\r\n table = wptb_preview_table;\r\n\r\n let cells = table.getElementsByTagName('td');\r\n\r\n if (cells.length > 0) {\r\n for (let i = 0; i < cells.length; i++) {\r\n WPTB_Cell(mark, cells[i]);\r\n }\r\n }\r\n } else {\r\n return;\r\n }\r\n }\r\n\r\n /**\r\n * this method run \"mark\" method of WPTB_Table object\r\n * @param event\r\n */\r\n table.mark = (event) => {\r\n mark(event);\r\n }\r\n\r\n /**\r\n * this method run \"undoSelect\" method of WPTB_Table object\r\n * @param event\r\n */\r\n table.undoSelect = () => {\r\n undoSelect();\r\n }\r\n\r\n /**\r\n * method for set value for maxAmountOfCells\r\n * @param value\r\n */\r\n table.setMaxAmountOfCells = (value) => {\r\n maxAmountOfCells = value;\r\n }\r\n\r\n /**\r\n * this method return maxAmountOfCells value\r\n * @returns {*}\r\n */\r\n table.getMaxAmountOfCells = () => {\r\n return maxAmountOfCells;\r\n }\r\n\r\n /**\r\n * this method run \"fillTableArray\" method of WPTB_Table object\r\n * @returns {[]}\r\n */\r\n table.fillTableArray = () => {\r\n return fillTableArray();\r\n }\r\n /*\r\n * For assigning to each cell xIndex and y Index attributes,\r\n * these are the column number and row number of cell in table. \r\n */\r\n\r\n table.recalculateIndexes = function () {\r\n WPTB_Helper.recalculateIndexes( this );\r\n }\r\n \r\n table.addColumnWidth = function( value, cleaner ) {\r\n let highlighted = table.getElementsByClassName( 'wptb-highlighted' );\r\n if( highlighted.length > 0 ) {\r\n for( let k = 0; k < highlighted.length; k++ ) {\r\n let dataXIndex = highlighted[k].dataset.xIndex;\r\n if( dataXIndex ) {\r\n function tableTdsFor( dataXIndex, colspan ) {\r\n let tableRows = table.rows;\r\n let widthIsSet = false;\r\n let arrayTdsFromPreviousRow = [];\r\n for( let i = 0; i < tableRows.length; i++ ) {\r\n let row = tableRows[i];\r\n let tds = row.children;\r\n for( let j = 0; j < tds.length; j++ ) {\r\n let td = tds[j];\r\n if( td.dataset.xIndex == dataXIndex ) {\r\n if( value ) {\r\n if( td.colSpan == colspan ) {\r\n td.style.width = value + 'px';\r\n td.removeAttribute( 'data-wptb-fixed-width' );\r\n widthIsSet = true;\r\n } else {\r\n td.style.width = null;\r\n td.dataset.wptbFixedWidth = value;\r\n if( i == tableRows.length - 1 && ! widthIsSet ) {\r\n tableTdsFor( dataXIndex, colspan + 1 );\r\n }\r\n }\r\n } else if( cleaner ) {\r\n td.style.width = null;\r\n td.removeAttribute( 'data-wptb-fixed-width' );\r\n } else {\r\n if( td.dataset.wptbFixedWidth ) {\r\n if( td.colSpan == colspan ) {\r\n td.style.width = td.dataset.wptbFixedWidth + 'px';\r\n td.removeAttribute( 'data-wptb-fixed-width' );\r\n } \r\n } else if( td.style.width ) {\r\n for( let z = 0; z < arrayTdsFromPreviousRow.length; z++ ) {\r\n arrayTdsFromPreviousRow[z].style.width = td.style.width;\r\n }\r\n arrayTdsFromPreviousRow = [];\r\n } else {\r\n arrayTdsFromPreviousRow.push( td );\r\n }\r\n }\r\n break;\r\n } \r\n }\r\n }\r\n }\r\n \r\n tableTdsFor( dataXIndex, 1 );\r\n }\r\n }\r\n \r\n table.tdDefaultWidth();\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\r\n }\r\n }\r\n \r\n table.tdDefaultWidth = function() {\r\n let rows = table.rows;\r\n \r\n let tableTdsSumMaxWidth = 0;\r\n let tableTdsSumMaxWidthFixed = 0;\r\n let tableTdsSumMaxWidthAuto = 0;\r\n \r\n let wptbTableSetup = document.getElementsByClassName( 'wptb-table-setup' )[0];\r\n let wptbTableSetupWidth = wptbTableSetup.offsetWidth;\r\n \r\n let arrayCellsWidthFixedHelper = [];\r\n let arrayCellsWidthAutoHelper = [];\r\n let tdPaddingCommon = 0;\r\n let tableTdBorderCommonWidth = 0;\r\n let cssForTdsWidthAuto = '';\r\n \r\n \r\n let tableFullStyleObj = window.getComputedStyle( table, null );\r\n let borderLeftWidth = tableFullStyleObj.getPropertyValue( 'border-left-width' );\r\n let borderRightWidth = tableFullStyleObj.getPropertyValue( 'border-right-width' );\r\n let tableBorderCommon = parseFloat( borderLeftWidth, 10 ) + parseFloat( borderRightWidth, 10 );\r\n \r\n for( let i = 0; i < rows.length; i++ ) {\r\n let tds = rows[i].children;\r\n for( let j = 0; j < tds.length; j++ ) {\r\n let td = tds[j];\r\n \r\n if( ! arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] && ! arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] ) {\r\n if( td.style.width ) {\r\n arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] = parseFloat( td.style.width );\r\n td.removeAttribute( 'data-wptb-css-td-auto-width' );\r\n } else {\r\n if( ! td.dataset.wptbFixedWidth ) {\r\n arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] = table.dataset.wptbTdWidthAuto ? parseFloat( table.dataset.wptbTdWidthAuto, 10 ) : 100;\r\n td.dataset.wptbCssTdAutoWidth = true;\r\n }\r\n }\r\n \r\n if( window.getComputedStyle( td, null ) ) {\r\n let tdStyleObj = window.getComputedStyle( td, null );\r\n let tdPaddingLeft = tdStyleObj.getPropertyValue( 'padding-left' );\r\n let tdPaddingRight = tdStyleObj.getPropertyValue( 'padding-right' );\r\n tdPaddingCommon = parseFloat( tdPaddingLeft, 10 ) + parseFloat( tdPaddingRight, 10 );\r\n\r\n let tableTdBorderLeftWidth = tdStyleObj.getPropertyValue( 'border-left-width' );\r\n let tableTdBorderRightWidth = tdStyleObj.getPropertyValue( 'border-right-width' );\r\n tableTdBorderCommonWidth = parseFloat( tableTdBorderLeftWidth, 10 ) + parseFloat( tableTdBorderRightWidth, 10 );\r\n tableTdBorderCommonWidth = tableTdBorderCommonWidth / 2;\r\n \r\n if( arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] ) {\r\n arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] += tdPaddingCommon;\r\n arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] += tableTdBorderCommonWidth;\r\n \r\n if( j == 0 && ( tableBorderCommon / 2 ) <= parseFloat( tableTdBorderLeftWidth, 10 ) ) {\r\n arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] += parseFloat( tableTdBorderLeftWidth, 10 ) / 2;\r\n } else if( j == 0 && ( tableBorderCommon / 2 ) > parseFloat( tableTdBorderLeftWidth, 10 ) ) {\r\n arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] += ( ( tableBorderCommon / 2 ) - ( parseFloat( tableTdBorderRightWidth, 10 ) / 2 ) );\r\n }\r\n\r\n if( j == tds.length - 1 && ( tableBorderCommon / 2 ) <= parseFloat( tableTdBorderRightWidth, 10 ) ) {\r\n arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] += parseFloat( tableTdBorderRightWidth, 10 ) / 2;\r\n } else if( j == tds.length - 1 && ( tableBorderCommon / 2 ) > parseFloat( tableTdBorderRightWidth, 10 ) ) {\r\n arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] += ( ( tableBorderCommon / 2 ) - ( parseFloat( tableTdBorderRightWidth, 10 ) / 2 ) );\r\n }\r\n } else if( arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] ) {\r\n arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] += tdPaddingCommon;\r\n arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] += tableTdBorderCommonWidth;\r\n \r\n if( j == 0 && ( tableBorderCommon / 2 ) <= parseFloat( tableTdBorderLeftWidth, 10 ) ) {\r\n arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] += parseFloat( tableTdBorderLeftWidth, 10 ) / 2;\r\n } else if( j == 0 && ( tableBorderCommon / 2 ) > parseFloat( tableTdBorderLeftWidth, 10 ) ) {\r\n arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] += ( ( tableBorderCommon / 2 ) - ( parseFloat( tableTdBorderLeftWidth, 10 ) / 2 ) );\r\n }\r\n\r\n if( j == tds.length - 1 && ( tableBorderCommon / 2 ) <= parseFloat( tableTdBorderRightWidth, 10 ) ) {\r\n arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] += parseFloat( tableTdBorderRightWidth, 10 ) / 2;\r\n } else if( j == tds.length - 1 && ( tableBorderCommon / 2 ) > parseFloat( tableTdBorderRightWidth, 10 ) ) {\r\n arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] += ( ( tableBorderCommon / 2 ) - ( parseFloat( tableTdBorderLeftWidth, 10 ) / 2 ) );\r\n }\r\n }\r\n }\r\n } else if( arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] ) {\r\n if( ! td.dataset.wptbFixedWidth ) {\r\n td.dataset.wptbCssTdAutoWidth = true;\r\n }\r\n } else if( arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] ) {\r\n td.removeAttribute( 'data-wptb-css-td-auto-width' );\r\n }\r\n }\r\n }\r\n \r\n for( let i = 0; i < arrayCellsWidthFixedHelper.length; i++ ) {\r\n if( arrayCellsWidthFixedHelper[i] ) {\r\n tableTdsSumMaxWidthFixed += arrayCellsWidthFixedHelper[i];\r\n }\r\n }\r\n \r\n let CellsWidthAutoCount = 0;\r\n for( let i = 0; i < arrayCellsWidthAutoHelper.length; i++ ) {\r\n if( arrayCellsWidthAutoHelper[i] ) {\r\n tableTdsSumMaxWidthAuto += arrayCellsWidthAutoHelper[i];\r\n CellsWidthAutoCount++;\r\n }\r\n }\r\n \r\n tableTdsSumMaxWidth = tableTdsSumMaxWidthFixed + tableTdsSumMaxWidthAuto;\r\n \r\n table.dataset.wptbTableTdsSumMaxWidth = tableTdsSumMaxWidth;\r\n if( CellsWidthAutoCount ) {\r\n table.dataset.wptbCellsWidthAutoCount = CellsWidthAutoCount;\r\n if( table.mergingСellsHorizontally ) {\r\n table.dataset.wptbFixedWidthSize = tableTdsSumMaxWidthFixed;\r\n } else {\r\n table.removeAttribute( 'data-wptb-fixed-width-size' );\r\n }\r\n } else {\r\n table.removeAttribute( 'data-wptb-fixed-width-size' );\r\n table.removeAttribute( 'data-wptb-cells-width-auto-count' );\r\n }\r\n \r\n let styleElementCreate = false;\r\n let tableTdWidthAuto;\r\n if( tableTdsSumMaxWidth < wptbTableSetupWidth ) {\r\n if( CellsWidthAutoCount ) {\r\n table.style.minWidth = '100%';\r\n if( table.mergingСellsHorizontally ) {\r\n table.style.width = 'auto';\r\n let tableTdsWidthAutoCommon = wptbTableSetupWidth - tableTdsSumMaxWidthFixed;\r\n tableTdWidthAuto = tableTdsWidthAutoCommon / CellsWidthAutoCount;\r\n tableTdWidthAuto = tableTdWidthAuto - tdPaddingCommon - tableTdBorderCommonWidth;\r\n styleElementCreate = true;\r\n } else {\r\n table.style.width = '100%';\r\n }\r\n } else {\r\n table.style.width = 'auto';\r\n table.style.minWidth = null;\r\n table.style.maxWidth = null;\r\n }\r\n } else {\r\n table.style.maxWidth = null;\r\n table.style.minWidth = tableTdsSumMaxWidth + 'px';\r\n table.style.width = 'auto';\r\n tableTdWidthAuto = table.dataset.wptbTdWidthAuto ? table.dataset.wptbTdWidthAuto : '100';\r\n styleElementCreate = true;\r\n }\r\n \r\n let head = document.head;\r\n if( head ) {\r\n let cssForTdsWidthAutoOld = head.querySelector( 'style[data-wptb-td-auto-width=\"true\"]' );\r\n if( cssForTdsWidthAutoOld ) {\r\n head.removeChild( cssForTdsWidthAutoOld );\r\n }\r\n }\r\n \r\n if( styleElementCreate ) {\r\n cssForTdsWidthAuto = document.createElement( 'style' );\r\n cssForTdsWidthAuto.setAttribute( 'data-wptb-td-auto-width', true );\r\n cssForTdsWidthAuto.innerHTML = '[data-wptb-css-td-auto-width=true]{width:' + tableTdWidthAuto + 'px}';\r\n if( head ) {\r\n head.appendChild( cssForTdsWidthAuto );\r\n }\r\n }\r\n \r\n if( table.dataset.wptbTableAlignment ) {\r\n let wptbTableAlignment = table.dataset.wptbTableAlignment;\r\n\r\n let wptbTableSetupWidth = wptbTableSetup.offsetWidth;\r\n if( wptbTableSetupWidth < table.offsetWidth ) {\r\n table.style.float = null;\r\n } else {\r\n if( wptbTableAlignment == 'center' ) {\r\n table.style.float = null;\r\n } else {\r\n table.style.float = wptbTableAlignment;\r\n }\r\n }\r\n\r\n if( wptbTableAlignment == 'center' ) {\r\n wptbTableSetup.style.float = null;\r\n } else {\r\n wptbTableSetup.style.float = wptbTableAlignment;\r\n }\r\n \r\n if( tableTdWidthAuto && table.dataset.wptbTableContainerMaxWidth && table.offsetWidth < table.dataset.wptbTableContainerMaxWidth ) {\r\n table.style.width = '100%';\r\n }\r\n } else {\r\n table.style.float = null;\r\n }\r\n }\r\n \r\n table.addRowHeight = function( value, cleaner ) {\r\n let highlighted = table.getElementsByClassName( 'wptb-highlighted' );\r\n if( highlighted.length > 0 ) {\r\n for( let k = 0; k < highlighted.length; k++ ) {\r\n let dataYIndex = highlighted[k].dataset.yIndex;\r\n if( dataYIndex ) {\r\n function tableTdsFor( dataYIndex, rowspan ) {\r\n let tableRows = table.rows;\r\n let heightIsSet = false;\r\n let arrayTdsPrevious = [];\r\n for( let i = 0; i < tableRows.length; i++ ) {\r\n let row = tableRows[i];\r\n let tds = row.children;\r\n for( let j = 0; j < tds.length; j++ ) {\r\n let td = tds[j];\r\n if( td.dataset.yIndex == dataYIndex ) {\r\n if( value ) {\r\n if( td.rowSpan == rowspan ) {\r\n td.style.height = value + 'px';\r\n td.removeAttribute( 'data-wptb-fixed-heidht' );\r\n heightIsSet = true;\r\n continue;\r\n } else {\r\n td.style.height = null;\r\n td.dataset.wptbFixedHeight = value;\r\n if( j == tds.length - 1 && ! heightIsSet ) {\r\n tableTdsFor( dataYIndex , rowspan + 1 );\r\n }\r\n }\r\n } else if( cleaner ) {\r\n td.style.height = null;\r\n td.removeAttribute( 'data-wptb-fixed-heidht' );\r\n } else {\r\n if( td.dataset.wptbFixedHeight ) {\r\n if( td.rowSpan = rowspan ) {\r\n td.style.height = td.dataset.wptbFixedHeight + 'px';\r\n td.removeAttribute( 'data-wptb-fixed-width' );\r\n }\r\n } else if( td.style.height ) {\r\n for( let z = 0; z < arrayTdsPrevious.length; z++ ) {\r\n arrayTdsPrevious[z].style.height = td.style.height;\r\n }\r\n arrayTdsPrevious = [];\r\n } else {\r\n arrayTdsPrevious.push( td );\r\n }\r\n }\r\n } \r\n }\r\n }\r\n }\r\n \r\n tableTdsFor( dataYIndex, 1 );\r\n }\r\n }\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\r\n }\r\n }\r\n \r\n table.reconstraction = function() {\r\n let tds = table.getElementsByTagName( 'td' );\r\n table.mergingСellsHorizontally = false;\r\n table.mergingCellsVertically = false;\r\n table.dataset.reconstraction = 1;\r\n let forBreak = 0;\r\n for( let i = 0; i < tds.length; i++ ) {\r\n if( tds[i].colSpan > 1 ) {\r\n table.dataset.reconstraction = 0;\r\n table.mergingСellsHorizontally = true;\r\n forBreak++;\r\n }\r\n \r\n if( tds[i].rowSpan > 1 ) {\r\n table.dataset.reconstraction = 0;\r\n table.mergingCellsVertically = true;\r\n forBreak++;\r\n }\r\n \r\n if( forBreak == 2 ) {\r\n break;\r\n }\r\n }\r\n }\r\n\r\n /*\r\n * As simple as it is: adds a column to the end of table.\r\n */\r\n table.addColumnEnd = function () {\r\n let td,\r\n currentTable = document.getElementsByClassName('wptb-preview-table'),\r\n currentTableTd,\r\n currentTdStyle;\r\n if (currentTable.length > 0) {\r\n currentTableTd = currentTable[0].querySelector('td');\r\n }\r\n\r\n if (currentTableTd) {\r\n currentTdStyle = currentTableTd.getAttribute('style');\r\n }\r\n \r\n for (var i = 0; i < table.rows.length; i++) {\r\n td = new WPTB_Cell(mark);\r\n \r\n if (currentTdStyle) {\r\n td.getDOMElement().setAttribute('style', currentTdStyle);\r\n td.getDOMElement().style.width = null;\r\n td.getDOMElement().style.height = null;\r\n }\r\n \r\n table.rows[i].appendChild(td.getDOMElement());\r\n array[i].push(0);\r\n }\r\n \r\n maxAmountOfCells++;\r\n table.recalculateIndexes();\r\n table.tdDefaultWidth();\r\n table.addRowHeight();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n /*\r\n * As simple as it looks: adds a column to the start of table.\r\n */\r\n\r\n table.addColumnStart = function () {\r\n let td,\r\n firstCell,\r\n currentTable = document.getElementsByClassName('wptb-preview-table'),\r\n currentTableTd,\r\n currentTdStyle;\r\n if ( currentTable.length > 0 ) {\r\n currentTableTd = currentTable[0].querySelector('td');\r\n }\r\n\r\n if ( currentTableTd ) {\r\n currentTdStyle = currentTableTd.getAttribute('style');\r\n }\r\n \r\n for (var i = 0; i < table.rows.length; i++) {\r\n td = new WPTB_Cell(mark);\r\n if (currentTdStyle) {\r\n td.getDOMElement().setAttribute('style', currentTdStyle);\r\n td.getDOMElement().style.width = null;\r\n td.getDOMElement().style.height = null;\r\n }\r\n firstCell = table.rows[i].getElementsByTagName('td')[0];\r\n if (firstCell) {\r\n table.rows[i].insertBefore(td.getDOMElement(), firstCell);\r\n } else {\r\n table.rows[i].appendChild(td.getDOMElement());\r\n }\r\n array[i].push(0);\r\n }\r\n\r\n maxAmountOfCells++;\r\n table.recalculateIndexes();\r\n table.tdDefaultWidth();\r\n table.addRowHeight();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n /*\r\n * Well, not so simple as previous functions.\r\n * It adds a column after a certain column of reference.\r\n * @param integer the column number to be used as reference.\r\n *\tIf empty, then the first highlighted cell is used as reference.\r\n */\r\n\r\n table.addColumnAfter = function (c_pos) {\r\n let rows = table.rows,\r\n cell,\r\n cellStyle,\r\n pos;\r\n\r\n if(c_pos != undefined && typeof c_pos === 'number') {\r\n pos = c_pos;\r\n cell = document.querySelector('[data-x-index=\"' + pos + '\"]');\r\n } else {\r\n cell = document.querySelector('.wptb-highlighted');\r\n pos = getCoords(cell)[1];\r\n }\r\n\r\n if(cell) {\r\n cellStyle = cell.getAttribute('style');\r\n\r\n if( maxAmountOfCells - pos - cell.colSpan + 1 == 1 ) {\r\n table.addColumnEnd();\r\n } else {\r\n for(let i = 0; i < rows.length; i++) {\r\n let tds = rows[i].children;\r\n for(let j = 0; j < tds.length; j++) {\r\n if(parseInt(tds[j].dataset.xIndex) <= pos) {\r\n if(parseInt(tds[j].dataset.xIndex) + tds[j].colSpan == pos + cell.colSpan) {\r\n let td = newTd(cellStyle);\r\n let nextSib = tds[j].nextSibling;\r\n if (nextSib) {\r\n rows[i].insertBefore(td.getDOMElement(), nextSib);\r\n } else {\r\n rows[i].appendChild(td.getDOMElement());\r\n }\r\n\r\n break;\r\n } else if(parseInt(tds[j].dataset.xIndex) + tds[j].colSpan > pos + cell.colSpan) {\r\n tds[j].colSpan++;\r\n if(tds[j].rowSpan > 1) i += tds[j].rowSpan - 1;\r\n break;\r\n }\r\n } else if(parseInt(tds[j].dataset.xIndex) > pos) {\r\n let td = newTd(cellStyle);\r\n rows[i].insertBefore(td.getDOMElement(), tds[j]);\r\n break;\r\n }\r\n }\r\n }\r\n\r\n function newTd(cellStyle) {\r\n let td = new WPTB_Cell(mark);\r\n if (cellStyle) {\r\n td.getDOMElement().setAttribute('style', cellStyle);\r\n td.getDOMElement().style.width = null;\r\n td.getDOMElement().style.height = null;\r\n }\r\n return td;\r\n }\r\n\r\n for (var i = 0; i < array.length; i++) {\r\n array[i].push(0);\r\n }\r\n maxAmountOfCells++;\r\n drawTable(array);\r\n table.recalculateIndexes();\r\n table.addColumnWidth();\r\n table.addRowHeight();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n }\r\n };\r\n\r\n /*\r\n * For preventing us to take a lot of time,\r\n * This is just calling the function addColumnAfter, but\r\n * using the previous column to current one as reference.\r\n * @see addColumnAfter\r\n */\r\n\r\n table.addColumnBefore = function () {\r\n var cell = document.querySelector('.wptb-highlighted'),\r\n pos = getCoords(cell)[1];\r\n\r\n if (pos === 0) {\r\n table.addColumnStart();\r\n } else {\r\n table.addColumnAfter(pos - 1);\r\n }\r\n };\r\n\r\n /*\r\n * Luckily, thisfunction is simple, \r\n * it just add a row to the end of table.\r\n */\r\n\r\n table.addRowToTheEnd = function () {\r\n let r = table.insertRow(-1),\r\n td,\r\n aux,\r\n currentTable = document.getElementsByClassName('wptb-preview-table');\r\n r.classList.add( 'wptb-row' );\r\n if (currentTable.length > 0) {\r\n currentTable = currentTable[0];\r\n \r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n td = new WPTB_Cell(mark);\r\n let currentTableTd = currentTable.querySelector('[data-x-index=\"' + i + '\"]');\r\n if( currentTableTd ) {\r\n let currentTdStyle = currentTableTd.getAttribute( 'style' );\r\n \r\n td.getDOMElement().setAttribute( 'style', currentTdStyle );\r\n td.getDOMElement().style.height = null;\r\n }\r\n r.appendChild(td.getDOMElement());\r\n }\r\n \r\n aux = Array.from(array[0]);\r\n array.push(aux);\r\n drawTable(array);\r\n table.recalculateIndexes();\r\n WPTB_Helper.tableRowsColorsReinstall( table );\r\n table.addColumnWidth();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n };\r\n\r\n /*\r\n * Yet another simple function, \r\n * it just add a row to the start of table.\r\n */\r\n\r\n table.addRowToTheStart = function () {\r\n let r = table.insertRow(0),\r\n td,\r\n aux,\r\n currentTable = document.getElementsByClassName('wptb-preview-table'),\r\n currentTableTd,\r\n currentTdStyle;\r\n r.classList.add( 'wptb-row' );\r\n if (currentTable.length > 0) {\r\n currentTable = currentTable[0];\r\n \r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n td = new WPTB_Cell(mark);\r\n let currentTableTd = currentTable.querySelector('[data-x-index=\"' + i + '\"]');\r\n if( currentTableTd ) {\r\n let currentTdStyle = currentTableTd.getAttribute( 'style' );\r\n \r\n td.getDOMElement().setAttribute( 'style', currentTdStyle );\r\n td.getDOMElement().style.height = null;\r\n }\r\n r.appendChild(td.getDOMElement());\r\n }\r\n \r\n aux = Array.from(array[0]);\r\n array.push(aux);\r\n drawTable(array);\r\n table.recalculateIndexes();\r\n WPTB_Helper.tableRowsColorsReinstall( table );\r\n table.addColumnWidth();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n };\r\n\r\n /* \r\n * This function adds a row before the current one.\r\n * Since the biggest factor of problem is a not-started but ongoing rowspan,\r\n * the most of the troubles is not here.\r\n */\r\n\r\n table.addRowBefore = function () {\r\n let cell = document.querySelector('.wptb-highlighted'),\r\n cellStyle = cell.getAttribute('style'),\r\n row = getCoords(cell)[0],\r\n cellNew;\r\n for( let i = row - 1; i >= 0; i-- ) {\r\n let rowChildren = table.rows[i].children;\r\n let rowChildrenLength = rowChildren.length;\r\n if( rowChildrenLength > 0 ) {\r\n for( let j = 0; j < rowChildrenLength; j++ ) {\r\n if( rowChildren[j].rowSpan == 1 ) {\r\n row = i;\r\n cellNew = true;\r\n break;\r\n }\r\n }\r\n }\r\n if ( cellNew ) {\r\n break;\r\n }\r\n }\r\n\r\n if (row === 0) {\r\n table.addRowToTheStart();\r\n } else {\r\n table.addRowAfter( row, cellStyle );\r\n }\r\n };\r\n\r\n /*\r\n * Well... by the name convention of the previous 3 functions,\r\n * it's pretty obvious that this functions attaches a new\r\n * row after highlighted cell row. The greatest obstacle it was\r\n * the possibility of a TR not having the exact amount of columns\r\n * occuped by actual node but rowspanned upper cells. For that purpose\r\n * it was created the function realTimeArray.\r\n * @see realTimeArray\r\n */\r\n\r\n table.addRowAfter = function ( row, cellStyle ) {\r\n let cellRowSpan,\r\n rowAfter,\r\n aux;\r\n \r\n if ( ( row == undefined || typeof row !== 'number' ) && cellStyle == undefined ) {\r\n let cell = document.querySelector('.wptb-highlighted');\r\n cellStyle = cell.getAttribute('style'),\r\n row = getCoords(cell)[0],\r\n cellRowSpan = cell.rowSpan,\r\n rowAfter = row + cellRowSpan - 1;\r\n } else {\r\n rowAfter = row;\r\n }\r\n \r\n \r\n let cellsColSpan = 0;\r\n if ( rowAfter < table.rows.length -1 ) {\r\n for( let i = 0; i <= rowAfter ; i++ ) {\r\n let tableRowsIChildren = table.rows[i].children,\r\n tableRIChildrenLength = tableRowsIChildren.length;\r\n if( tableRIChildrenLength > 0 ) {\r\n for( let j = 0; j < tableRIChildrenLength; j++ ) {\r\n let rowIRowSpan = tableRowsIChildren[j].rowSpan;\r\n\r\n if ( rowIRowSpan - 1 + i > rowAfter ) {\r\n tableRowsIChildren[j].rowSpan++;\r\n }\r\n }\r\n }\r\n }\r\n \r\n let rNext = table.rows[rowAfter + 1],\r\n rNextChildren = rNext.children,\r\n rNextChildrenLength = rNextChildren.length;\r\n \r\n if( rNextChildrenLength > 0 ) {\r\n for ( let i = 0; i < rNextChildrenLength; i++ ) {\r\n cellsColSpan += rNextChildren[i].colSpan;\r\n }\r\n }\r\n } else {\r\n cellsColSpan = array[0].length;\r\n }\r\n \r\n let r = table.insertRow( rowAfter + 1 );\r\n r.classList.add( 'wptb-row' );\r\n \r\n for ( j = 0; j < cellsColSpan; j++ ) {\r\n let td = new WPTB_Cell( mark );\r\n td.getDOMElement().setAttribute( 'style', cellStyle );\r\n td.getDOMElement().style.width = null;\r\n td.getDOMElement().style.height = null;\r\n r.appendChild( td.getDOMElement() );\r\n }\r\n\r\n aux = Array.from(array[0]);\r\n array.push(aux);\r\n drawTable(array);\r\n table.recalculateIndexes();\r\n WPTB_Helper.tableRowsColorsReinstall( table );\r\n table.addColumnWidth();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after');\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n /*\r\n * This function checks the current selected cells\r\n * make a rectangular shape.\r\n * @param Array the abstract table.\r\n * @return false, if not making a rectangle, or\r\n *\tArray an array containing number of rows and columns, if selection makes a rectangle.\r\n */\r\n\r\n table.isSquare = function (a) {\r\n var rowStart = -1,\r\n columnStart = -1,\r\n rowEnd = -1,\r\n columnEnd = -1,\r\n height,\r\n width,\r\n itemsEstimate = 0,\r\n items = 0;\r\n\r\n for (var i = 0; i < a.length; i++) {\r\n for (var j = 0; j < a[i].length; j++) {\r\n if (a[i][j] == 1) {\r\n if ( j < columnStart || columnStart == -1 ) {\r\n columnStart = j;\r\n }\r\n if ( i < rowStart || rowStart == -1 ) {\r\n rowStart = i;\r\n }\r\n }\r\n }\r\n \r\n }\r\n\r\n for (var i = a.length - 1; i > -1; i--) {\r\n for (var j = a[i].length - 1; j > -1; j--) {\r\n if (a[i][j] == 1) {\r\n if ( j > columnEnd ) {\r\n columnEnd = j;\r\n }\r\n if ( i > rowEnd ) {\r\n rowEnd = i;\r\n }\r\n }\r\n }\r\n }\r\n\r\n for (var i = rowStart; i < rowEnd; i++) {\r\n for (var j = columnStart; j < columnEnd; j++) {\r\n if (a[i][j] == 0 || a[i][j] == undefined) {\r\n return false;\r\n }\r\n }\r\n }\r\n\r\n for (var i = 0; i < a.length; i++) {\r\n for (var j = 0; j < a[i].length; j++) {\r\n if (a[i][j] == 1) {\r\n items++;\r\n }\r\n }\r\n }\r\n\r\n height = rowEnd - rowStart + 1;\r\n width = columnEnd - columnStart + 1;\r\n itemsEstimate = height * width;\r\n\r\n if (itemsEstimate !== items) {\r\n return false;\r\n }\r\n return [height, width];\r\n };\r\n\r\n /*\r\n * This function merges all selected cells.\r\n * Well, actually sets the colspan and rowspan of first \r\n * upper left cell in selection and deletes the another selected cells.\r\n */\r\n\r\n table.mergeCells = function () {\r\n var dimensions = table.isSquare(array),\r\n rowspan = dimensions[0],\r\n colspan = dimensions[1],\r\n first = document.querySelector('.wptb-highlighted'),\r\n tds = [].slice.call(document.getElementsByClassName('wptb-highlighted'), 1),\r\n tdsChildrenNew = [];\r\n\r\n for (let i = 0; i < tds.length; i++) {\r\n let tdsInternalElements = tds[i].getElementsByClassName('wptb-ph-element');\r\n if (tdsInternalElements.length > 0) {\r\n let tdsIntElemLength = tdsInternalElements.length;\r\n for (let j = 0; j < tdsIntElemLength; j++) {\r\n tdsChildrenNew.push(tdsInternalElements[j]);\r\n }\r\n }\r\n let p = tds[i].parentNode;\r\n p.removeChild(tds[i]);\r\n }\r\n if (tdsChildrenNew.length > 0) {\r\n for (let i = 0; i < tdsChildrenNew.length; i++) {\r\n first.appendChild(tdsChildrenNew[i]);\r\n }\r\n }\r\n\r\n first.colSpan = colspan;\r\n first.rowSpan = rowspan;\r\n table.recalculateIndexes();\r\n table.reconstraction();\r\n let firstWidth = first.style.width;\r\n let firstDataFixedWidth = first.dataset.wptbFixedWidth;\r\n if( firstWidth ) {\r\n table.addColumnWidth( parseFloat( firstWidth, 10 ) );\r\n } else if( firstDataFixedWidth ) {\r\n table.addColumnWidth();\r\n } else {\r\n table.addColumnWidth( false, true );\r\n }\r\n \r\n let firstHeight = first.style.height;\r\n let firstDataFixedHeight = first.dataset.wptbFixedHeight;\r\n if( firstHeight ) {\r\n table.addRowHeight( parseFloat( firstHeight, 10 ) );\r\n } else if( firstDataFixedHeight ) {\r\n table.addRowHeight();\r\n } else {\r\n table.addRowHeight( false, true );\r\n }\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n /*\r\n * This functions makes the exact inverse as above.\r\n * It resets colspan and rowspan and appends \r\n * the same amount in cells to the table.\r\n * @bug\r\n */\r\n\r\n table.splitCell = function () {\r\n var cell = document.getElementsByClassName('wptb-highlighted')[0],\r\n rowspan = cell.rowSpan,\r\n colspan = cell.colSpan,\r\n cellStyles = cell.getAttribute('style'),\r\n row = getCoords(cell)[0],\r\n thisRow = table.rows[row],\r\n cellXIndex =cell.dataset.xIndex;\r\n \r\n cell.rowSpan = 1;\r\n cell.colSpan = 1;\r\n \r\n for (let i = 1; i < colspan; i++) {\r\n let td = new WPTB_Cell(mark);\r\n td.getDOMElement().setAttribute('style', cellStyles);\r\n td.getDOMElement().classList.add( 'wptb-highlighted' );\r\n if ( cell.nextSibling ) {\r\n thisRow.insertBefore( td.getDOMElement(), cell.nextSibling );\r\n } else {\r\n thisRow.appendChild( td.getDOMElement() );\r\n }\r\n \r\n }\r\n\r\n if (rowspan > 1) {\r\n for (let i = 1; i < rowspan; i++) {\r\n let rowChildInsertBefore = undefined,\r\n rowNext = table.rows[row + i],\r\n rowChildren = rowNext.children,\r\n rowChildrenLength = rowChildren.length;\r\n \r\n if ( rowChildrenLength > 0 ) {\r\n for ( let k = 0; k < rowChildrenLength; k++ ) {\r\n if ( Number( rowChildren[k].dataset.xIndex ) > Number( cellXIndex ) ) {\r\n rowChildInsertBefore = rowChildren[k];\r\n break;\r\n } \r\n }\r\n }\r\n for ( let j = 0; j < colspan; j++ ) {\r\n let td = new WPTB_Cell( mark );\r\n td.getDOMElement().setAttribute( 'style', cellStyles );\r\n if ( rowChildInsertBefore != undefined ) {\r\n rowNext.insertBefore( td.getDOMElement(), rowChildInsertBefore );\r\n } else {\r\n rowNext.appendChild( td.getDOMElement() );\r\n }\r\n }\r\n }\r\n }\r\n\r\n table.recalculateIndexes();\r\n table.reconstraction();\r\n table.addColumnWidth();\r\n table.addRowHeight();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n /*\r\n * Searches for rowspanned cells up to row number meeting it.\r\n * @param number the number of row where the function\r\n * must search up to.\r\n */\r\n\r\n table.findRowspannedCells = function (row) {\r\n var array = [],\r\n difference;\r\n actualPoints = getActualPointsInRow(row);\r\n if (actualPoints === maxAmountOfCells) {\r\n return [];\r\n }\r\n difference = maxAmountOfCells - actualPoints;\r\n\r\n for (var i = row - 1; i >= 0 && difference; i--) {\r\n var tds = table.rows[i].getElementsByTagName('td');\r\n for (var i = 0; i < tds.length; i++) {\r\n if (tds[i].rowSpan > 1) {\r\n array.push(tds[i]);\r\n difference -= tds[i].colSpan;\r\n }\r\n }\r\n }\r\n return array;\r\n\r\n }\r\n\r\n /*\r\n * This function explores the table and adds \r\n * a cell for each lacking one for each row\r\n * to meet an even amount of cells.\r\n */\r\n\r\n table.addLackingCells = function () {\r\n var sumRows = [];\r\n for (var i = 0; i < table.rows.length; i++) {\r\n sumRows.push(0);\r\n }\r\n\r\n for (var i = 0; i < table.rows.length; i++) {\r\n var tds = table.rows[i].getElementsByTagName('td');\r\n for (var j = 0; j < tds.length; j++) {\r\n if (tds[j].rowSpan > 1) {\r\n for (var k = 1; k < tds[j].rowSpan; k++) {\r\n sumRows[i + k]++;\r\n }\r\n }\r\n }\r\n }\r\n\r\n for (var i = 0; i < table.rows.length; i++) {\r\n var tds = table.rows[i].getElementsByTagName('td'),\r\n totalColspan = 0;\r\n for (var j = 0; j < tds.length; j++) {\r\n totalColspan += tds[j].colSpan;\r\n }\r\n totalColspan += sumRows[i];\r\n difference = maxAmountOfCells - totalColspan;\r\n for (var j = 0; j < difference; j++) {\r\n var td = new WPTB_Cell(mark);\r\n table.rows[i].appendChild(td.getDOMElement());\r\n //table.rows[i].insertBefore( td.getDOMElement(), rows[i].nextSibling );\r\n }\r\n }\r\n };\r\n\r\n /*\r\n * This function deletes the row of currently\r\n * selected cell. \r\n */\r\n\r\n table.deleteRow = function () {\r\n let cell = document.querySelector('.wptb-highlighted'),\r\n cellStyles = cell.getAttribute('style'),\r\n rowspan = cell.rowSpan,\r\n row = getCoords(cell)[0],\r\n thisRow,\r\n aux;\r\n \r\n if ( rowspan == undefined ) rowspan = 1;\r\n \r\n for ( let i = 0; i < rowspan; i++ ) {\r\n thisRow = table.rows[row];\r\n let thisRowChildren = thisRow.children,\r\n nextRow = table.rows[row + 1],\r\n nextRowChildren,\r\n nextRowChildrenLength,\r\n tdArr = [];\r\n\r\n if( nextRow != undefined ) {\r\n nextRowChildren = nextRow.children;\r\n nextRowChildrenLength = nextRowChildren.length;\r\n for (let j = 0; j < thisRowChildren.length; j++) {\r\n if ( thisRowChildren[j].rowSpan > 1 ) {\r\n let td = new WPTB_Cell(mark);\r\n td.getDOMElement().setAttribute('style', cellStyles);\r\n td.getDOMElement().colSpan = thisRowChildren[j].colSpan;\r\n td.getDOMElement().rowSpan = thisRowChildren[j].rowSpan - 1;\r\n\r\n let nextRowChildrenK = undefined;\r\n for ( let k = 0; k < nextRowChildrenLength; k++ ) {\r\n if ( Number( nextRowChildren[k].dataset.xIndex ) > Number( thisRowChildren[j].dataset.xIndex ) ) {\r\n nextRowChildrenK = nextRowChildren[k];\r\n break;\r\n } \r\n }\r\n\r\n if ( nextRowChildrenK ) {\r\n tdArr.push( [td, nextRowChildrenK] );\r\n } else {\r\n tdArr.push( [td] );\r\n }\r\n }\r\n }\r\n\r\n if ( tdArr.length > 0 ) {\r\n for ( let k = 0; k < tdArr.length; k++ ) {\r\n if ( tdArr[k][1] != undefined ) {\r\n nextRow.insertBefore( tdArr[k][0].getDOMElement(), tdArr[k][1] );\r\n } else {\r\n nextRow.appendChild( tdArr[k][0].getDOMElement() );\r\n }\r\n }\r\n }\r\n }\r\n \r\n let tableRows = table.rows;\r\n if ( tableRows.length > 0 ) {\r\n for ( let j = 0; j < row; j++ ) {\r\n let jRowChildren = tableRows[j].children;\r\n if ( jRowChildren.length > 0 ) {\r\n for ( let x = 0; x < jRowChildren.length; x++ ) {\r\n if ( jRowChildren[x].rowSpan - 1 >= row - j ) {\r\n jRowChildren[x].rowSpan--;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n aux = Array.from(array[0]);\r\n array.pop(aux);\r\n drawTable(array);\r\n table.getElementsByTagName('tbody')[0].removeChild(table.rows[row]);\r\n \r\n if( table.rows.length == 0 ) {\r\n WPTB_Helper.toggleTableEditMode();\r\n wptbTableSetup.innerHTML = '';\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\r\n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\r\n if( wptbSaveBtn.length > 0 ) {\r\n wptbSaveBtn = wptbSaveBtn[0];\r\n \r\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\r\n wptbSaveBtn.classList.remove('active');\r\n }\r\n } else {\r\n table.recalculateIndexes();\r\n WPTB_Helper.tableRowsColorsReinstall( table );\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n table.reconstraction();\r\n }\r\n }\r\n \r\n undoSelect();\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n\r\n /*\r\n * This function deletes the column of currently\r\n * selected cell. Again, this is way more complicated than\r\n * delete row case.\r\n */\r\n\r\n table.deleteColumn = function () {\r\n let cell = document.querySelector('.wptb-highlighted'),\r\n cellXIndex = cell.dataset.xIndex,\r\n colspan = cell.colSpan;\r\n \r\n for ( let i = 0; i < colspan; i++ ) {\r\n for ( let j = 0; j < table.rows.length; j++ ) {\r\n let rowChildren = table.rows[j].children;\r\n let rowChildrenLength = rowChildren.length;\r\n if( rowChildrenLength > 0 ) {\r\n for ( let k = rowChildrenLength - 1; k >= 0; k-- ) {\r\n if ( Number( rowChildren[k].dataset.xIndex ) == Number( cellXIndex ) ) {\r\n if ( rowChildren[k].colSpan > 1 ) {\r\n rowChildren[k].colSpan--;\r\n } else {\r\n table.rows[j].removeChild( rowChildren[k] );\r\n }\r\n break;\r\n } else if( Number( rowChildren[k].dataset.xIndex ) < Number( cellXIndex ) && \r\n Number( rowChildren[k].dataset.xIndex ) + \r\n Number( rowChildren[k].colSpan -1 ) >= cellXIndex ) {\r\n if ( rowChildren[k].colSpan > 1 ) {\r\n rowChildren[k].colSpan--;\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n \r\n for ( let j = 0; j < table.rows.length; j++ ) {\r\n if (array[j] != undefined)\r\n array[j].pop();\r\n }\r\n \r\n maxAmountOfCells--;\r\n \r\n if( table.querySelectorAll( 'td' ).length == 0 ) {\r\n WPTB_Helper.toggleTableEditMode();\r\n wptbTableSetup.innerHTML = '';\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\r\n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\r\n if( wptbSaveBtn.length > 0 ) {\r\n wptbSaveBtn = wptbSaveBtn[0];\r\n \r\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\r\n wptbSaveBtn.classList.remove('active');\r\n }\r\n } else {\r\n table.recalculateIndexes();\r\n table.tdDefaultWidth();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n table.reconstraction();\r\n }\r\n }\r\n \r\n undoSelect();\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'none';\r\n\r\n array = fillTableArray();\r\n\r\n undoSelect();\r\n drawTable(array);\r\n\r\n wptbTableSetup.appendChild(table);\r\n //if (columns || rows) {\r\n table.recalculateIndexes( true );\r\n //}\r\n table.reconstraction();\r\n table.tdDefaultWidth();\r\n \r\n wptbTableSetup.onresize = function() {\r\n table.tdDefaultWidth();\r\n };\r\n\r\n WPTB_LeftPanel();\r\n\r\n // event hook to signal that table is generated and ready to be used\r\n WPTB_Helper.wptbDocumentEventGenerate('wptb:table:generated', document);\r\n\r\n WPTB_Helper.elementStartScript( table, 'table_setting' );\r\n WPTB_Helper.elementOptionsSet( 'table_setting', table );\r\n \r\n // this code gets the ID of the active element in the toolbar \r\n // and stores it in the data attribute of the common container element \"wpcd_fixed_toolbar\"\r\n// let wptbPhElement = document.getElementsByClassName( 'wptb-ph-element' );\r\n// let wpcdFixedToolbar = document.getElementById( 'wpcd_fixed_toolbar' );\r\n// for ( let i = 0; i < wptbPhElement.length; i++ ) {\r\n// wptbPhElement[i].addEventListener( 'click', function( e ) {\r\n// let wptbToolbar = document.getElementById( 'wpcd_fixed_toolbar' ).children;\r\n// for ( let j = 0; j < wptbToolbar.length; j++ ) {\r\n// let elementStyles = window.getComputedStyle( wptbToolbar[j], 'null' );\r\n// if( elementStyles.getPropertyValue( 'display' ) == 'block' ) {\r\n// wpcdFixedToolbar.dataset.toolbarActiveId = wptbToolbar[j].getAttribute( 'id' );\r\n// }\r\n// }\r\n// }, false );\r\n// }\r\n \r\n// let wptbPanelLeft = document.getElementsByClassName( 'wptb-panel-left' );\r\n// if( wptbPanelLeft.length > 0 ) {\r\n// wptbPanelLeft[0].addEventListener( 'click', function( e ) {\r\n// let toolbarActiveElementId = wpcdFixedToolbar.dataset.toolbarActiveId;\r\n// document.getElementById( toolbarActiveElementId ).style.display = '';\r\n// }, false );\r\n// }\r\n \r\n// let body = document.getElementsByTagName( 'body' );\r\n// if( body.length > 0 ) {\r\n// body[0].addEventListener( 'click', function( e ) {\r\n// if ( e.target.classList.contains( 'wptb-panel-left' ) || WPTB_Helper.findAncestor( e.target, 'wptb-panel-left' ) ) {\r\n// let toolbarActiveElementId = wpcdFixedToolbar.dataset.toolbarActiveId;\r\n// document.getElementById( toolbarActiveElementId ).style.display = '';\r\n// }\r\n// }, false );\r\n// }\r\n};","var WPTB_TableStateSaveManager = function() {\r\n this.tableStateSet = ( generate ) => {\r\n \r\n if( generate && window.wptbTableStateSaving && Array.isArray( window.wptbTableStateSaving ) ) {\r\n return;\r\n }\r\n \r\n // get table setup\r\n let wptbTableSetup = document.getElementsByClassName( 'wptb-table-setup' );\r\n let wptbPreviewTable = '';\r\n if( wptbTableSetup.length > 0 ) {\r\n wptbTableSetup = wptbTableSetup[0];\r\n\r\n wptbPreviewTable = wptbTableSetup.querySelector( '.wptb-preview-table' );\r\n } else {\r\n wptbTableSetup = '';\r\n }\r\n\r\n\r\n \r\n // check if a global array doesn't exist with saved versions of the table \r\n // them create it\r\n if( ! window.wptbTableStateSaving && ! Array.isArray( window.wptbTableStateSaving ) ) {\r\n window.wptbTableStateSaving = [];\r\n } \r\n\r\n // remove the extra part of the array after changing the table \r\n // when it is showed in the not last modified version\r\n if( window.wptbTableStateSaving.length > window.wptbTableStateNumberShow ) {\r\n window.wptbTableStateSaving = window.wptbTableStateSaving.slice( 0, window.wptbTableStateNumberShow + 1 );\r\n }\r\n\r\n //add new state of table\r\n let wptbNewTableSetup = '';\r\n if( wptbTableSetup ) {\r\n wptbNewTableSetup = wptbTableSetup.cloneNode( true );\r\n let wptbHighlighted = wptbNewTableSetup.getElementsByClassName( 'wptb-highlighted' );\r\n for( let i = 0; i < wptbHighlighted.length; i++ ) {\r\n wptbHighlighted[i].classList.remove( 'wptb-highlighted' );\r\n }\r\n let wptbDirectlyhovered = wptbNewTableSetup.getElementsByClassName( 'wptb-directlyhovered' );\r\n for( let i = 0; i < wptbDirectlyhovered.length; i++ ) {\r\n wptbDirectlyhovered[i].classList.remove( 'wptb-directlyhovered' );\r\n }\r\n let mceContentBodys = wptbNewTableSetup.querySelectorAll( '.mce-content-body' );\r\n if( mceContentBodys.length > 0 ) {\r\n for ( let k = 0; k < mceContentBodys.length; k++ ) {\r\n mceContentBodys[k].classList.remove( 'mce-content-body' );\r\n }\r\n }\r\n let dataMceStyle = wptbNewTableSetup.querySelectorAll( '[data-mce-style]' );\r\n if ( dataMceStyle.length > 0 ) {\r\n for ( let k = 0; k < dataMceStyle.length; k++ ) {\r\n dataMceStyle[k].removeAttribute( 'data-mce-style' );\r\n }\r\n }\r\n let mceIds = wptbNewTableSetup.querySelectorAll( '[id^=mce_]' );\r\n if ( mceIds.length > 0 ) {\r\n for ( let k = 0; k < mceIds.length; k++ ) {\r\n mceIds[k].removeAttribute( 'id' );\r\n }\r\n }\r\n }\r\n\r\n let cssForTdsWidthAutoValue = '';\r\n let head = document.head;\r\n if( head ) {\r\n let cssForTdsWidthAuto = head.querySelector( 'style[data-wptb-td-auto-width=\"true\"]' );\r\n if( cssForTdsWidthAuto ) {\r\n cssForTdsWidthAutoValue = cssForTdsWidthAuto.innerHTML;\r\n }\r\n }\r\n\r\n let wptbTableTitle = '';\r\n let wptbSetupName = document.getElementById( 'wptb-setup-name' );\r\n if( wptbSetupName ) wptbTableTitle = wptbSetupName.value;\r\n\r\n window.wptbTableStateSaving.push( [wptbNewTableSetup, cssForTdsWidthAutoValue, wptbTableTitle] );\r\n\r\n // set new number of state which is showed now\r\n window.wptbTableStateNumberShow = window.wptbTableStateSaving.length - 1;\r\n\r\n // make undo arrow active when the table was changed\r\n if( window.wptbTableStateSaving.length - 1 > 0 ) {\r\n let wptbUndo = document.getElementsByClassName( 'wptb-undo' );\r\n if( wptbUndo.length > 0 ) {\r\n wptbUndo = wptbUndo[0];\r\n\r\n wptbUndo.classList.remove( 'wptb-undoredo-disabled' );\r\n }\r\n }\r\n\r\n // make redo arrow not active when the table was changed\r\n let wptbRedo = document.getElementsByClassName( 'wptb-redo' );\r\n if( wptbRedo.length > 0 ) {\r\n wptbRedo = wptbRedo[0];\r\n\r\n wptbRedo.classList.add( 'wptb-undoredo-disabled' );\r\n }\r\n\r\n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\r\n if( wptbSaveBtn.length > 0 ) {\r\n wptbSaveBtn = wptbSaveBtn[0];\r\n if( ( ! wptbSaveBtn.dataset.wptbTableStateNumberSave && window.wptbTableStateNumberShow == 0 ) || \r\n window.wptbTableStateNumberShow == wptbSaveBtn.dataset.wptbTableStateNumberSave || ! wptbPreviewTable ) {\r\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\r\n wptbSaveBtn.classList.remove('active');\r\n } else {\r\n wptbSaveBtn.classList.remove( 'wptb-save-disabled' );\r\n wptbSaveBtn.classList.add('active');\r\n }\r\n }\r\n }\r\n \r\n this.tableStateGet = ( datawptbUndoredo ) => {\r\n if( datawptbUndoredo && window.wptbTableStateSaving && window.wptbTableStateSaving.length > 0 ) {\r\n \r\n // changes the number of the state which displays now\r\n if( datawptbUndoredo == 'undo' ) {\r\n if( window.wptbTableStateNumberShow > 0 ) {\r\n window.wptbTableStateNumberShow--;\r\n } else {\r\n return false;\r\n }\r\n } else if( datawptbUndoredo == 'redo' ) {\r\n if( window.wptbTableStateNumberShow < window.wptbTableStateSaving.length ) {\r\n window.wptbTableStateNumberShow++;\r\n } else {\r\n return false;\r\n }\r\n }\r\n \r\n // add or delete class \"wptb-undoredo-disabled\" for undo button\r\n let wptbUndo = document.getElementsByClassName( 'wptb-undo' );\r\n if( wptbUndo.length > 0 ) {\r\n wptbUndo = wptbUndo[0];\r\n \r\n if( window.wptbTableStateNumberShow == 0 ) {\r\n if( wptbUndo ) {\r\n wptbUndo.classList.add( 'wptb-undoredo-disabled' );\r\n }\r\n } else if( window.wptbTableStateNumberShow > 0 ) {\r\n if( wptbUndo ) {\r\n wptbUndo.classList.remove( 'wptb-undoredo-disabled' );\r\n }\r\n }\r\n }\r\n \r\n // add or delete class \"wptb-undoredo-disabled\" for redo button\r\n let wptbRedo = document.getElementsByClassName( 'wptb-redo' );\r\n if( wptbRedo.length > 0 ) {\r\n wptbRedo = wptbRedo[0];\r\n \r\n if( window.wptbTableStateNumberShow == window.wptbTableStateSaving.length - 1 ) {\r\n if( wptbRedo ) {\r\n wptbRedo.classList.add( 'wptb-undoredo-disabled' );\r\n }\r\n } else if( window.wptbTableStateNumberShow < window.wptbTableStateSaving.length - 1 ) {\r\n if( wptbRedo ) {\r\n wptbRedo.classList.remove( 'wptb-undoredo-disabled' );\r\n }\r\n }\r\n }\r\n \r\n // add or delete class \"wptb-save-disabled\" for save button\r\n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\r\n if( wptbSaveBtn.length > 0 ) {\r\n wptbSaveBtn = wptbSaveBtn[0];\r\n if( ( ! wptbSaveBtn.dataset.wptbTableStateNumberSave && window.wptbTableStateNumberShow == 0 ) || \r\n window.wptbTableStateNumberShow == wptbSaveBtn.dataset.wptbTableStateNumberSave ) {\r\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\r\n wptbSaveBtn.classList.remove('active');\r\n } else {\r\n wptbSaveBtn.classList.add('active');\r\n wptbSaveBtn.classList.remove( 'wptb-save-disabled' );\r\n }\r\n }\r\n \r\n // load necessary saved table state\r\n let wptbTableSetup = document.getElementsByClassName( 'wptb-table-setup' );\r\n if( wptbTableSetup.length > 0 ) {\r\n wptbTableSetup = wptbTableSetup[0];\r\n\r\n //wptbTableSetup.outerHTML = '';\r\n if( window.wptbTableStateSaving[window.wptbTableStateNumberShow] ) {\r\n if( window.wptbTableStateSaving[window.wptbTableStateNumberShow][0] && \r\n typeof window.wptbTableStateSaving[window.wptbTableStateNumberShow][0] === 'object' ) {\r\n if( 'outerHTML' in window.wptbTableStateSaving[window.wptbTableStateNumberShow][0] ) {\r\n wptbTableSetup.outerHTML = window.wptbTableStateSaving[window.wptbTableStateNumberShow][0].outerHTML;\r\n }\r\n }\r\n\r\n let wptbTableSetupNew = document.querySelector( '.wptb-table-setup' );\r\n if( wptbTableSetupNew && wptbTableSetupNew.children.length == 0 ) {\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\r\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\r\n wptbSaveBtn.classList.remove('active');\r\n } else {\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'none';\r\n }\r\n\r\n // add or change or delete style element in the head for table cells who have auto width\r\n let head = document.head;\r\n if( head ) {\r\n let cssForTdsWidthAutoOld = head.querySelector( 'style[data-wptb-td-auto-width=\"true\"]' );\r\n if( cssForTdsWidthAutoOld ) {\r\n head.removeChild( cssForTdsWidthAutoOld );\r\n }\r\n\r\n if( window.wptbTableStateSaving[window.wptbTableStateNumberShow][1] ) {\r\n let cssForTdsWidthAuto = document.createElement( 'style' );\r\n cssForTdsWidthAuto.setAttribute( 'data-wptb-td-auto-width', true );\r\n cssForTdsWidthAuto.innerHTML = window.wptbTableStateSaving[window.wptbTableStateNumberShow][1];\r\n head.appendChild( cssForTdsWidthAuto );\r\n }\r\n }\r\n\r\n // change value of table title field\r\n let wptbSetupName = document.getElementById( 'wptb-setup-name' );\r\n if( typeof window.wptbTableStateSaving[window.wptbTableStateNumberShow][2] != 'undefined' ) {\r\n if( wptbSetupName ) wptbSetupName.value = window.wptbTableStateSaving[window.wptbTableStateNumberShow][2];\r\n }\r\n }\r\n \r\n
|