Version Description
- FIX: PHP function not declared issue.
- NEW: Preview button in the builder.
Download this release
Release Info
Developer | imtiazrayhan |
Plugin | WP Table Builder – WordPress Table Plugin |
Version | 1.0.3 |
Comparing to | |
See all releases |
Code changes from version 1.0.2 to 1.0.3
- inc/admin/class-wptb-listing.php +16 -10
- inc/admin/css/admin.css +7 -7
- inc/admin/js/admin.js +348 -340
- inc/admin/js/admin.js.map +1 -1
- inc/admin/js/core/WPTB_Settings.js +11 -2
- inc/admin/views/builder/wptb-builder-header.php +23 -2
- inc/common/class-helpers.php +1 -1
- inc/core/class-preview.php +2 -1
- readme.txt +6 -1
- wp-table-builder.php +2 -2
inc/admin/class-wptb-listing.php
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
namespace WP_Table_Builder\Inc\Admin;
|
4 |
-
use WP_Table_Builder\Inc\Common\Helpers as Helpers;
|
5 |
|
6 |
|
7 |
if ( ! class_exists( 'WP_List_Table' ) ) {
|
@@ -33,8 +32,8 @@ class WPTB_Listing extends \WP_List_Table{
|
|
33 |
|
34 |
$params = array( 'post_type' => 'wptb-tables', 'posts_per_page' => $per_page, 'paged' => $page_number );
|
35 |
|
36 |
-
$params['orderby'] = ! empty( sanitize_text_field( $_REQUEST['orderby'] ) ) ? sanitize_text_field( $_REQUEST['orderby'] ) : 'date';
|
37 |
-
$params['order'] = ! empty( sanitize_text_field( $_REQUEST['order'] ) ) ? sanitize_text_field( $_REQUEST['order'] ) : 'DESC';
|
38 |
|
39 |
$loop = new \WP_Query( $params );
|
40 |
$result=[];
|
@@ -89,13 +88,13 @@ class WPTB_Listing extends \WP_List_Table{
|
|
89 |
|
90 |
}
|
91 |
|
92 |
-
public static function record_count() {
|
93 |
|
94 |
global $wpdb, $post;
|
95 |
|
96 |
$params = array( 'post_type' => 'wptb-tables', 'posts_per_page' => $per_page );
|
97 |
-
$params['orderby'] = ! empty( sanitize_text_field( $_REQUEST['orderby'] ) ) ? sanitize_text_field( $_REQUEST['orderby'] ) : 'date';
|
98 |
-
$params['order'] = ! empty( sanitize_text_field( $_REQUEST['order'] ) ) ? sanitize_text_field( $_REQUEST['order'] ) : 'DESC';
|
99 |
|
100 |
$loop = new \WP_Query( $params );
|
101 |
return $loop->found_posts;
|
@@ -139,11 +138,18 @@ class WPTB_Listing extends \WP_List_Table{
|
|
139 |
esc_html__( 'Edit This Table', 'wp-table-builder' ),
|
140 |
$title
|
141 |
);
|
142 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
$actions = [
|
144 |
'delete' => sprintf( '<a href="?page=%s&action=%s&table_id=%s&_wpnonce=%s">Delete</a>', esc_attr( $_REQUEST['page'] ), 'delete', absint( $item->ID ), $nonce ),
|
145 |
'duplicate' => sprintf( '<a href="?page=%s&action=%s&table_id=%s&_wpnonce=%s">Duplicate</a>', esc_attr( $_REQUEST['page'] ), 'duplicate', absint( $item->ID ), $nonce ),
|
146 |
-
'preview_' => sprintf( '<a href="%s
|
147 |
'edit' => sprintf( '<a href="?page=wptb-builder&table=%d">Edit</a>', absint( $item->ID ) )
|
148 |
];
|
149 |
|
@@ -219,7 +225,7 @@ class WPTB_Listing extends \WP_List_Table{
|
|
219 |
|
220 |
$per_page = $this->get_items_per_page( 'tables_per_page', 10 );
|
221 |
$current_page = $this->get_pagenum();
|
222 |
-
$total_items = self::record_count();
|
223 |
|
224 |
$this->set_pagination_args( [
|
225 |
'total_items' => $total_items, //WE have to calculate the total number of items
|
@@ -232,7 +238,7 @@ class WPTB_Listing extends \WP_List_Table{
|
|
232 |
|
233 |
public function process_bulk_action() {
|
234 |
|
235 |
-
$nonce = esc_attr( $_REQUEST['_wpnonce'] );
|
236 |
|
237 |
|
238 |
if ( 'duplicate' === $this->current_action() ) {
|
1 |
<?php
|
2 |
|
3 |
namespace WP_Table_Builder\Inc\Admin;
|
|
|
4 |
|
5 |
|
6 |
if ( ! class_exists( 'WP_List_Table' ) ) {
|
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 |
|
38 |
$loop = new \WP_Query( $params );
|
39 |
$result=[];
|
88 |
|
89 |
}
|
90 |
|
91 |
+
public static function record_count( $per_page ) {
|
92 |
|
93 |
global $wpdb, $post;
|
94 |
|
95 |
$params = array( 'post_type' => 'wptb-tables', 'posts_per_page' => $per_page );
|
96 |
+
$params['orderby'] = isset( $_REQUEST['orderby'] ) && ! empty( sanitize_text_field( $_REQUEST['orderby'] ) ) ? sanitize_text_field( $_REQUEST['orderby'] ) : 'date';
|
97 |
+
$params['order'] = isset( $_REQUEST['order'] ) && ! empty( sanitize_text_field( $_REQUEST['order'] ) ) ? sanitize_text_field( $_REQUEST['order'] ) : 'DESC';
|
98 |
|
99 |
$loop = new \WP_Query( $params );
|
100 |
return $loop->found_posts;
|
138 |
esc_html__( 'Edit This Table', 'wp-table-builder' ),
|
139 |
$title
|
140 |
);
|
141 |
+
|
142 |
+
$wptb_preview_button_url = add_query_arg(
|
143 |
+
array(
|
144 |
+
'wptb_table_preview' => absint( $item->ID ),
|
145 |
+
),
|
146 |
+
home_url()
|
147 |
+
);
|
148 |
+
|
149 |
$actions = [
|
150 |
'delete' => sprintf( '<a href="?page=%s&action=%s&table_id=%s&_wpnonce=%s">Delete</a>', esc_attr( $_REQUEST['page'] ), 'delete', absint( $item->ID ), $nonce ),
|
151 |
'duplicate' => sprintf( '<a href="?page=%s&action=%s&table_id=%s&_wpnonce=%s">Duplicate</a>', esc_attr( $_REQUEST['page'] ), 'duplicate', absint( $item->ID ), $nonce ),
|
152 |
+
'preview_' => sprintf( '<a href="%s" target="_blank">Preview</a>', $wptb_preview_button_url ),
|
153 |
'edit' => sprintf( '<a href="?page=wptb-builder&table=%d">Edit</a>', absint( $item->ID ) )
|
154 |
];
|
155 |
|
225 |
|
226 |
$per_page = $this->get_items_per_page( 'tables_per_page', 10 );
|
227 |
$current_page = $this->get_pagenum();
|
228 |
+
$total_items = self::record_count( $per_page );
|
229 |
|
230 |
$this->set_pagination_args( [
|
231 |
'total_items' => $total_items, //WE have to calculate the total number of items
|
238 |
|
239 |
public function process_bulk_action() {
|
240 |
|
241 |
+
$nonce = isset( $_REQUEST['_wpnonce'] ) && esc_attr( $_REQUEST['_wpnonce'] ) ? esc_attr( $_REQUEST['_wpnonce'] ) : '';
|
242 |
|
243 |
|
244 |
if ( 'duplicate' === $this->current_action() ) {
|
inc/admin/css/admin.css
CHANGED
@@ -96,12 +96,12 @@ body>img {
|
|
96 |
font-size: 15px;
|
97 |
}
|
98 |
|
99 |
-
.wptb-embed {
|
100 |
display: inline-block;
|
101 |
margin-right: 15px;
|
102 |
}
|
103 |
|
104 |
-
.wptb-
|
105 |
background-color: #fff;
|
106 |
border: 1px solid #ccc;
|
107 |
font-size: 16px;
|
@@ -113,22 +113,22 @@ body>img {
|
|
113 |
color: #6b6b6b;
|
114 |
}
|
115 |
|
116 |
-
.wptb-
|
117 |
-
.wptb-
|
118 |
outline: none !important;
|
119 |
box-shadow: none !important;
|
120 |
}
|
121 |
|
122 |
-
.wptb-
|
123 |
border: 0 !important;
|
124 |
}
|
125 |
|
126 |
-
.wptb-
|
127 |
opacity: 0.5;
|
128 |
cursor: not-allowed;
|
129 |
}
|
130 |
|
131 |
-
.wptb-
|
132 |
text-decoration: none;
|
133 |
}
|
134 |
|
96 |
font-size: 15px;
|
97 |
}
|
98 |
|
99 |
+
.wptb-embed, .wptb-preview {
|
100 |
display: inline-block;
|
101 |
margin-right: 15px;
|
102 |
}
|
103 |
|
104 |
+
.wptb-button-grey {
|
105 |
background-color: #fff;
|
106 |
border: 1px solid #ccc;
|
107 |
font-size: 16px;
|
113 |
color: #6b6b6b;
|
114 |
}
|
115 |
|
116 |
+
.wptb-button-grey:active,
|
117 |
+
.wptb-button-grey:focus {
|
118 |
outline: none !important;
|
119 |
box-shadow: none !important;
|
120 |
}
|
121 |
|
122 |
+
.wptb-button-grey::-moz-focus-inner {
|
123 |
border: 0 !important;
|
124 |
}
|
125 |
|
126 |
+
.wptb-button-grey.wptb-button-disable {
|
127 |
opacity: 0.5;
|
128 |
cursor: not-allowed;
|
129 |
}
|
130 |
|
131 |
+
.wptb-button-grey.wptb-button-disable:hover {
|
132 |
text-decoration: none;
|
133 |
}
|
134 |
|
inc/admin/js/admin.js
CHANGED
@@ -1,3 +1,215 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
(function () {
|
2 |
var WPTB_Builder = function WPTB_Builder() {
|
3 |
var table_id = WPTB_Helper.detectMode();
|
@@ -1373,44 +1585,136 @@ var WPTB_Initializer = function WPTB_Initializer() {
|
|
1373 |
// WPTB_LeftPanel();
|
1374 |
// }
|
1375 |
};
|
1376 |
-
var
|
1377 |
-
|
1378 |
-
var table = document.getElementsByClassName('wptb-preview-table')[0],
|
1379 |
-
wptbElementButtons = document.getElementsByClassName('wptb-element');
|
1380 |
|
1381 |
-
function
|
1382 |
-
if (
|
1383 |
-
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
}
|
1391 |
-
}
|
1392 |
}
|
1393 |
}
|
1394 |
|
1395 |
-
|
1396 |
-
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
|
1402 |
-
|
1403 |
-
|
1404 |
-
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
1412 |
-
|
1413 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1414 |
});
|
1415 |
|
1416 |
wptbTdBgColorSavedSet('wptb-odd-row-bg', 2);
|
@@ -2131,7 +2435,7 @@ var WPTB_Settings = function WPTB_Settings() {
|
|
2131 |
|
2132 |
var shortcodePopupWindow = document.getElementsByClassName('wptb-popup-window-modal')[0];
|
2133 |
document.getElementsByClassName('wptb-embed-btn')[0].onclick = function () {
|
2134 |
-
if (!this.classList.contains('wptb-
|
2135 |
shortcodePopupWindow.classList.add('wptb-popup-show');
|
2136 |
}
|
2137 |
};
|
@@ -2197,8 +2501,16 @@ var WPTB_Settings = function WPTB_Settings() {
|
|
2197 |
if (data[0] == 'saved') {
|
2198 |
document.wptbId = data[1];
|
2199 |
messagingArea.innerHTML = '<div class="wptb-success wptb-message">Table "' + t + '" was successfully saved.</div>';
|
2200 |
-
document.getElementsByClassName('wptb-embed-btn')[0].classList.remove('wptb-
|
2201 |
document.getElementById('wptb-embed-shortcode').value = '[wptb id=' + data[1] + ']';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2202 |
} else if (data[0] == 'edited') {
|
2203 |
messagingArea.innerHTML = '<div class="wptb-success wptb-message">Table "' + t + '" was successfully updated.</div>';
|
2204 |
} else {
|
@@ -4160,308 +4472,4 @@ var WPTB_Text = function WPTB_Text(text, DOMElementProt) {
|
|
4160 |
|
4161 |
return this;
|
4162 |
};
|
4163 |
-
var WPTB_innerElementSet = function WPTB_innerElementSet(element) {
|
4164 |
-
|
4165 |
-
function newElementProxy(el) {
|
4166 |
-
if (el == 'list') {
|
4167 |
-
return new WPTB_List();
|
4168 |
-
} else if (el == 'image') {
|
4169 |
-
return new WPTB_Image();
|
4170 |
-
} else if (el == 'text') {
|
4171 |
-
return new WPTB_Text();
|
4172 |
-
} else if (el == 'button') {
|
4173 |
-
return new WPTB_Button();
|
4174 |
-
}
|
4175 |
-
}
|
4176 |
-
|
4177 |
-
element.ondragenter = function (e) {
|
4178 |
-
var div;
|
4179 |
-
if (e.dataTransfer.types.indexOf('wptbelement') == -1 && e.dataTransfer.types.indexOf('wptb-moving-mode') == -1) {
|
4180 |
-
return;
|
4181 |
-
}
|
4182 |
-
WPTB_DropHandle(this, e);
|
4183 |
-
|
4184 |
-
element.classList.add('wptb-ondragenter');
|
4185 |
-
};
|
4186 |
-
element.ondragover = function (e) {
|
4187 |
-
e.preventDefault();
|
4188 |
-
WPTB_DropHandle(this, e);
|
4189 |
-
};
|
4190 |
-
element.ondragleave = function () {};
|
4191 |
-
element.ondrop = function (e) {
|
4192 |
-
this.classList.remove('wptb-ondragenter');
|
4193 |
-
var element = void 0,
|
4194 |
-
classId = void 0;
|
4195 |
-
e.preventDefault();
|
4196 |
-
e.stopPropagation();
|
4197 |
-
|
4198 |
-
if (!e.dataTransfer.getData('wptbElement') && !e.dataTransfer.getData('node')) {
|
4199 |
-
return;
|
4200 |
-
}
|
4201 |
-
var wptbDropHandle = void 0,
|
4202 |
-
wptbDropBorderMarker = void 0;
|
4203 |
-
if (document.getElementsByClassName('wptb-drop-handle').length > 0) {
|
4204 |
-
wptbDropHandle = document.getElementsByClassName('wptb-drop-handle')[0];
|
4205 |
-
}
|
4206 |
-
if (document.getElementsByClassName('wptb-drop-border-marker').length > 0) {
|
4207 |
-
wptbDropBorderMarker = document.getElementsByClassName('wptb-drop-border-marker')[0];
|
4208 |
-
}
|
4209 |
-
|
4210 |
-
if (e.dataTransfer.getData('wptbElement')) {
|
4211 |
-
element = newElementProxy(e.dataTransfer.getData('wptbElement'));
|
4212 |
-
element = element.getDOMElement();
|
4213 |
-
} else {
|
4214 |
-
classId = e.dataTransfer.getData('node');
|
4215 |
-
element = document.getElementsByClassName(classId)[0];
|
4216 |
-
element.classList.remove('wptb-moving-mode');
|
4217 |
-
}
|
4218 |
-
|
4219 |
-
if (wptbDropHandle.style.display == 'block') {
|
4220 |
-
var td = void 0;
|
4221 |
-
if (wptbDropHandle.dataset.text == 'Drop Here') {
|
4222 |
-
td = wptbDropHandle.getDOMParentElement();
|
4223 |
-
td.appendChild(element);
|
4224 |
-
} else {
|
4225 |
-
var innerElement = wptbDropHandle.getDOMParentElement();
|
4226 |
-
td = innerElement.parentNode;
|
4227 |
-
|
4228 |
-
if (wptbDropHandle.dataset.text == 'Abowe Element') {
|
4229 |
-
td.insertBefore(element, innerElement);
|
4230 |
-
} else if (wptbDropHandle.dataset.text == 'Below Element') {
|
4231 |
-
var innerElementNext = innerElement.nextSibling;
|
4232 |
-
td.insertBefore(element, innerElementNext);
|
4233 |
-
}
|
4234 |
-
}
|
4235 |
-
var thisRow = td.parentNode;
|
4236 |
-
if (thisRow.classList.contains('wptb-table-head')) {
|
4237 |
-
var table = WPTB_Helper.findAncestor(thisRow, 'wptb-preview-table');
|
4238 |
-
WPTB_Helper.dataTitleColumnSet(table);
|
4239 |
-
}
|
4240 |
-
} else {
|
4241 |
-
return;
|
4242 |
-
}
|
4243 |
-
|
4244 |
-
wptbDropHandle.style.display = 'none';
|
4245 |
-
wptbDropBorderMarker.style.display = 'none';
|
4246 |
-
|
4247 |
-
WPTB_innerElementSet(element);
|
4248 |
-
|
4249 |
-
return true;
|
4250 |
-
};
|
4251 |
-
element.onmouseover = function (e) {
|
4252 |
-
element.classList.remove('wptb-ondragenter');
|
4253 |
-
};
|
4254 |
-
};
|
4255 |
-
var applyGenericItemSettings = function applyGenericItemSettings(element, kindIndexProt) {
|
4256 |
-
var copy = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
4257 |
-
|
4258 |
-
var node = element.getDOMElement(),
|
4259 |
-
index,
|
4260 |
-
listItems,
|
4261 |
-
copy;
|
4262 |
-
|
4263 |
-
if (kindIndexProt == undefined || copy == true) {
|
4264 |
-
index = document.counter.nextIndex(element.kind);
|
4265 |
-
var wptbElements = document.getElementsByClassName('wptb-ph-element');
|
4266 |
-
var elementIndexesArr = [];
|
4267 |
-
for (var i = 0; i < wptbElements.length; i++) {
|
4268 |
-
var regex = new RegExp('wptb-element-' + element.kind + '-(\\d+)', "i");
|
4269 |
-
var infArr = wptbElements[i].className.match(regex);
|
4270 |
-
if (infArr) {
|
4271 |
-
elementIndexesArr.push(infArr[1]);
|
4272 |
-
}
|
4273 |
-
}
|
4274 |
-
if (elementIndexesArr.length > 0) {
|
4275 |
-
var elementIndexMax = Math.max.apply(Math, elementIndexesArr);
|
4276 |
-
index = elementIndexMax + 1;
|
4277 |
-
} else {
|
4278 |
-
index = 1;
|
4279 |
-
}
|
4280 |
-
} else if (kindIndexProt && !copy) {
|
4281 |
-
index = kindIndexProt.split('-')[1];
|
4282 |
-
}
|
4283 |
-
|
4284 |
-
node.onmouseenter = function (event) {
|
4285 |
-
this.classList.add('wptb-directlyhovered');
|
4286 |
-
var btnDelete = document.createElement('span'),
|
4287 |
-
btnCopy = document.createElement('span'),
|
4288 |
-
btnMove = document.createElement('span'),
|
4289 |
-
actions = document.createElement('span'),
|
4290 |
-
i = void 0;
|
4291 |
-
|
4292 |
-
actions.classList.add('wptb-actions');
|
4293 |
-
btnDelete.classList.add('dashicons', 'dashicons-trash', 'wptb-delete-action');
|
4294 |
-
btnCopy.classList.add('dashicons', 'dashicons-admin-page', 'wptb-duplicate-action');
|
4295 |
-
btnMove.classList.add("dashicons", "dashicons-move", 'wptb-move-action');
|
4296 |
-
btnMove.draggable = true;
|
4297 |
-
btnDelete.onclick = function (event) {
|
4298 |
-
var act = this.parentNode.parentNode,
|
4299 |
-
el = act.parentNode;
|
4300 |
-
el.removeChild(act);
|
4301 |
-
|
4302 |
-
if (act.kind == 'text') {
|
4303 |
-
var thisRow = el.parentNode;
|
4304 |
-
if (thisRow.classList.contains('wptb-table-head')) {
|
4305 |
-
var table = WPTB_Helper.findAncestor(thisRow, 'wptb-preview-table');
|
4306 |
-
WPTB_Helper.dataTitleColumnSet(table);
|
4307 |
-
}
|
4308 |
-
}
|
4309 |
-
};
|
4310 |
-
btnCopy.onclick = function (event) {
|
4311 |
-
var copy = void 0;
|
4312 |
-
if (element.kind == 'list') {
|
4313 |
-
var td = event.target.parentNode.parentNode.parentNode,
|
4314 |
-
temp = [],
|
4315 |
-
srcList = event.target.parentNode.parentNode.querySelectorAll('ul li .wptb-list-item-content');
|
4316 |
-
|
4317 |
-
for (var i = 0; i < srcList.length; i++) {
|
4318 |
-
temp.push(srcList[i].innerHTML);
|
4319 |
-
}
|
4320 |
-
|
4321 |
-
copy = new WPTB_List(temp, node);
|
4322 |
-
|
4323 |
-
node.parentNode.insertBefore(copy.getDOMElement(), node.nextSibling);
|
4324 |
-
} else if (element.kind == 'text') {
|
4325 |
-
var td = event.target.parentNode.parentNode.parentNode;
|
4326 |
-
copy = new WPTB_Text(event.target.parentNode.parentNode.childNodes[0].innerHTML, node);
|
4327 |
-
|
4328 |
-
node.parentNode.insertBefore(copy.getDOMElement(), node.nextSibling);
|
4329 |
-
} else if (element.kind == 'image') {
|
4330 |
-
var td = event.target.parentNode.parentNode.parentNode;
|
4331 |
-
copy = new WPTB_Image(event.target.parentNode.parentNode.children[0].children[0].src, node);
|
4332 |
-
|
4333 |
-
node.parentNode.insertBefore(copy.getDOMElement(), node.nextSibling);
|
4334 |
-
} else {
|
4335 |
-
var td = event.target.parentNode.parentNode.parentNode,
|
4336 |
-
text = event.target.parentNode.parentNode.childNodes[0].querySelector('p').innerHTML;
|
4337 |
-
copy = new WPTB_Button(text, node);
|
4338 |
-
|
4339 |
-
node.parentNode.insertBefore(copy.getDOMElement(), node.nextSibling);
|
4340 |
-
}
|
4341 |
-
|
4342 |
-
WPTB_innerElementSet(copy.getDOMElement());
|
4343 |
-
};
|
4344 |
-
var parent = this,
|
4345 |
-
infArr = void 0,
|
4346 |
-
type = void 0;
|
4347 |
-
infArr = parent.className.match(/wptb-element-(.+)-(\d+)/i);
|
4348 |
-
type = infArr[1];
|
4349 |
-
var dragImagesArr = WPTB_Helper.dragImagesArr();
|
4350 |
-
btnMove.ondragstart = function (event) {
|
4351 |
-
this.parentNode.style.opacity = 0;
|
4352 |
-
parent.classList.remove('wptb-directlyhovered');
|
4353 |
-
parent.classList.add('wptb-moving-mode');
|
4354 |
-
|
4355 |
-
event.dataTransfer.setDragImage(dragImagesArr[type], 0, 0);
|
4356 |
-
event.dataTransfer.setData('node', 'wptb-element-' + infArr[1] + '-' + infArr[2]);
|
4357 |
-
event.dataTransfer.setData('wptb-moving-mode', 'wptb-element-' + infArr[1] + '-' + infArr[2]);
|
4358 |
-
event.dataTransfer.setData('wptbElIndic-' + infArr[1], 'wptbElIndic-' + infArr[1]);
|
4359 |
-
var act = event.target.parentNode.parentNode;
|
4360 |
-
if (act.kind == 'text') {
|
4361 |
-
var thisRow = el.parentNode;
|
4362 |
-
if (thisRow.classList.contains('wptb-table-head')) {
|
4363 |
-
var table = WPTB_Helper.findAncestor(thisRow, 'wptb-preview-table');
|
4364 |
-
WPTB_Helper.dataTitleColumnSet(table);
|
4365 |
-
}
|
4366 |
-
}
|
4367 |
-
};
|
4368 |
-
|
4369 |
-
if (element.kind === 'button') {
|
4370 |
-
var a = node.querySelector('a'),
|
4371 |
-
target = a.querySelector('div');
|
4372 |
-
a.onclick = function (e) {
|
4373 |
-
e.preventDefault();
|
4374 |
-
};
|
4375 |
-
WPTB_Helper.buttonsTinyMceInit(target);
|
4376 |
-
} else if (element.kind === 'text') {
|
4377 |
-
tinyMCE.init({
|
4378 |
-
target: node.childNodes[0],
|
4379 |
-
inline: true,
|
4380 |
-
plugins: "link, paste",
|
4381 |
-
dialog_type: "modal",
|
4382 |
-
theme: 'modern',
|
4383 |
-
menubar: false,
|
4384 |
-
fixed_toolbar_container: '#wpcd_fixed_toolbar',
|
4385 |
-
paste_as_text: true,
|
4386 |
-
toolbar: 'bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify',
|
4387 |
-
setup: function setup(ed) {
|
4388 |
-
ed.on('change', function (e) {
|
4389 |
-
var row = WPTB_Helper.findAncestor(node, 'wptb-row');
|
4390 |
-
if (row.classList.contains('wptb-table-head')) {
|
4391 |
-
var table = WPTB_Helper.findAncestor(row, 'wptb-preview-table');
|
4392 |
-
WPTB_Helper.dataTitleColumnSet(table);
|
4393 |
-
}
|
4394 |
-
});
|
4395 |
-
},
|
4396 |
-
init_instance_callback: function init_instance_callback(editor) {
|
4397 |
-
window.currentEditor = editor;
|
4398 |
-
//editor.fire('focus');
|
4399 |
-
editor.on('focus', function (e) {
|
4400 |
-
var totalWidth = document.getElementsByClassName('wptb-builder-panel')[0].offsetWidth;
|
4401 |
-
if (window.currentEditor && document.getElementById('wptb_builder').scrollTop >= 55 && window.currentEditor.bodyElement.style.display != 'none') {
|
4402 |
-
document.getElementById('wpcd_fixed_toolbar').style.position = 'fixed';
|
4403 |
-
document.getElementById('wpcd_fixed_toolbar').style.right = totalWidth / 2 - document.getElementById('wpcd_fixed_toolbar').offsetWidth / 2 + 'px';
|
4404 |
-
document.getElementById('wpcd_fixed_toolbar').style.top = '100px';
|
4405 |
-
} else {
|
4406 |
-
document.getElementById('wpcd_fixed_toolbar').style.position = 'static';
|
4407 |
-
delete document.getElementById('wpcd_fixed_toolbar').style.right;
|
4408 |
-
delete document.getElementById('wpcd_fixed_toolbar').style.top;
|
4409 |
-
}
|
4410 |
-
});
|
4411 |
-
}
|
4412 |
-
});
|
4413 |
-
} else {
|
4414 |
-
listItems = node.getElementsByClassName('wptb-list-item-content');
|
4415 |
-
for (var _i = 0; _i < listItems.length; _i++) {
|
4416 |
-
WPTB_Helper.listItemsTinyMceInit(listItems[_i]);
|
4417 |
-
}
|
4418 |
-
}
|
4419 |
-
|
4420 |
-
actions.appendChild(btnMove);
|
4421 |
-
actions.appendChild(btnCopy);
|
4422 |
-
actions.appendChild(btnDelete);
|
4423 |
-
this.appendChild(actions);
|
4424 |
-
};
|
4425 |
-
|
4426 |
-
node.onmouseleave = function (event) {
|
4427 |
-
this.classList.remove('wptb-directlyhovered');
|
4428 |
-
var iter = 0;
|
4429 |
-
while (event.target.querySelector('.wptb-actions') && iter < 5) {
|
4430 |
-
event.target.querySelector('.wptb-actions').remove();
|
4431 |
-
iter++;
|
4432 |
-
}
|
4433 |
-
};
|
4434 |
-
|
4435 |
-
// Change data-title-column if the title was changed
|
4436 |
-
if (element.kind == 'text') {
|
4437 |
-
var observer = new MutationObserver(function (mutations) {
|
4438 |
-
var row = WPTB_Helper.findAncestor(node, 'wptb-row');
|
4439 |
-
if (row.classList.contains('wptb-table-head')) {
|
4440 |
-
var table = WPTB_Helper.findAncestor(row, 'wptb-preview-table');
|
4441 |
-
WPTB_Helper.dataTitleColumnSet(table);
|
4442 |
-
}
|
4443 |
-
});
|
4444 |
-
var config = { attributes: true, attributeFilter: ['style'] };
|
4445 |
-
observer.observe(element.getDOMElement(), config);
|
4446 |
-
}
|
4447 |
-
|
4448 |
-
var node_wptb_element_kind_num = node.className.match(/wptb-element-(.+)-(\d+)/i);
|
4449 |
-
if (node_wptb_element_kind_num) {
|
4450 |
-
node.classList.remove(node_wptb_element_kind_num[0]);
|
4451 |
-
}
|
4452 |
-
if (!node.classList.contains('wptb-ph-element')) {
|
4453 |
-
node.classList.add('wptb-ph-element');
|
4454 |
-
if (!node.classList.contains('wptb-element-' + element.kind + '-' + index)) {
|
4455 |
-
node.classList.add('wptb-element-' + element.kind + '-' + index);
|
4456 |
-
}
|
4457 |
-
} else {
|
4458 |
-
if (!node.classList.contains('wptb-element-' + element.kind + '-' + index)) {
|
4459 |
-
node.classList.add('wptb-element-' + element.kind + '-' + index);
|
4460 |
-
}
|
4461 |
-
}
|
4462 |
-
new WPTB_ElementOptions(element, index, kindIndexProt);
|
4463 |
-
|
4464 |
-
document.counter.increment(element.kind);
|
4465 |
-
};
|
4466 |
-
|
4467 |
//# sourceMappingURL=admin.js.map
|
1 |
+
var applyGenericItemSettings = function applyGenericItemSettings(element, kindIndexProt) {
|
2 |
+
var copy = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
3 |
+
|
4 |
+
var node = element.getDOMElement(),
|
5 |
+
index,
|
6 |
+
listItems,
|
7 |
+
copy;
|
8 |
+
|
9 |
+
if (kindIndexProt == undefined || copy == true) {
|
10 |
+
index = document.counter.nextIndex(element.kind);
|
11 |
+
var wptbElements = document.getElementsByClassName('wptb-ph-element');
|
12 |
+
var elementIndexesArr = [];
|
13 |
+
for (var i = 0; i < wptbElements.length; i++) {
|
14 |
+
var regex = new RegExp('wptb-element-' + element.kind + '-(\\d+)', "i");
|
15 |
+
var infArr = wptbElements[i].className.match(regex);
|
16 |
+
if (infArr) {
|
17 |
+
elementIndexesArr.push(infArr[1]);
|
18 |
+
}
|
19 |
+
}
|
20 |
+
if (elementIndexesArr.length > 0) {
|
21 |
+
var elementIndexMax = Math.max.apply(Math, elementIndexesArr);
|
22 |
+
index = elementIndexMax + 1;
|
23 |
+
} else {
|
24 |
+
index = 1;
|
25 |
+
}
|
26 |
+
} else if (kindIndexProt && !copy) {
|
27 |
+
index = kindIndexProt.split('-')[1];
|
28 |
+
}
|
29 |
+
|
30 |
+
node.onmouseenter = function (event) {
|
31 |
+
this.classList.add('wptb-directlyhovered');
|
32 |
+
var btnDelete = document.createElement('span'),
|
33 |
+
btnCopy = document.createElement('span'),
|
34 |
+
btnMove = document.createElement('span'),
|
35 |
+
actions = document.createElement('span'),
|
36 |
+
i = void 0;
|
37 |
+
|
38 |
+
actions.classList.add('wptb-actions');
|
39 |
+
btnDelete.classList.add('dashicons', 'dashicons-trash', 'wptb-delete-action');
|
40 |
+
btnCopy.classList.add('dashicons', 'dashicons-admin-page', 'wptb-duplicate-action');
|
41 |
+
btnMove.classList.add("dashicons", "dashicons-move", 'wptb-move-action');
|
42 |
+
btnMove.draggable = true;
|
43 |
+
btnDelete.onclick = function (event) {
|
44 |
+
var act = this.parentNode.parentNode,
|
45 |
+
el = act.parentNode;
|
46 |
+
el.removeChild(act);
|
47 |
+
|
48 |
+
if (act.kind == 'text') {
|
49 |
+
var thisRow = el.parentNode;
|
50 |
+
if (thisRow.classList.contains('wptb-table-head')) {
|
51 |
+
var table = WPTB_Helper.findAncestor(thisRow, 'wptb-preview-table');
|
52 |
+
WPTB_Helper.dataTitleColumnSet(table);
|
53 |
+
}
|
54 |
+
}
|
55 |
+
};
|
56 |
+
btnCopy.onclick = function (event) {
|
57 |
+
var copy = void 0;
|
58 |
+
if (element.kind == 'list') {
|
59 |
+
var td = event.target.parentNode.parentNode.parentNode,
|
60 |
+
temp = [],
|
61 |
+
srcList = event.target.parentNode.parentNode.querySelectorAll('ul li .wptb-list-item-content');
|
62 |
+
|
63 |
+
for (var i = 0; i < srcList.length; i++) {
|
64 |
+
temp.push(srcList[i].innerHTML);
|
65 |
+
}
|
66 |
+
|
67 |
+
copy = new WPTB_List(temp, node);
|
68 |
+
|
69 |
+
node.parentNode.insertBefore(copy.getDOMElement(), node.nextSibling);
|
70 |
+
} else if (element.kind == 'text') {
|
71 |
+
var td = event.target.parentNode.parentNode.parentNode;
|
72 |
+
copy = new WPTB_Text(event.target.parentNode.parentNode.childNodes[0].innerHTML, node);
|
73 |
+
|
74 |
+
node.parentNode.insertBefore(copy.getDOMElement(), node.nextSibling);
|
75 |
+
} else if (element.kind == 'image') {
|
76 |
+
var td = event.target.parentNode.parentNode.parentNode;
|
77 |
+
copy = new WPTB_Image(event.target.parentNode.parentNode.children[0].children[0].src, node);
|
78 |
+
|
79 |
+
node.parentNode.insertBefore(copy.getDOMElement(), node.nextSibling);
|
80 |
+
} else {
|
81 |
+
var td = event.target.parentNode.parentNode.parentNode,
|
82 |
+
text = event.target.parentNode.parentNode.childNodes[0].querySelector('p').innerHTML;
|
83 |
+
copy = new WPTB_Button(text, node);
|
84 |
+
|
85 |
+
node.parentNode.insertBefore(copy.getDOMElement(), node.nextSibling);
|
86 |
+
}
|
87 |
+
|
88 |
+
WPTB_innerElementSet(copy.getDOMElement());
|
89 |
+
};
|
90 |
+
var parent = this,
|
91 |
+
infArr = void 0,
|
92 |
+
type = void 0;
|
93 |
+
infArr = parent.className.match(/wptb-element-(.+)-(\d+)/i);
|
94 |
+
type = infArr[1];
|
95 |
+
var dragImagesArr = WPTB_Helper.dragImagesArr();
|
96 |
+
btnMove.ondragstart = function (event) {
|
97 |
+
this.parentNode.style.opacity = 0;
|
98 |
+
parent.classList.remove('wptb-directlyhovered');
|
99 |
+
parent.classList.add('wptb-moving-mode');
|
100 |
+
|
101 |
+
event.dataTransfer.setDragImage(dragImagesArr[type], 0, 0);
|
102 |
+
event.dataTransfer.setData('node', 'wptb-element-' + infArr[1] + '-' + infArr[2]);
|
103 |
+
event.dataTransfer.setData('wptb-moving-mode', 'wptb-element-' + infArr[1] + '-' + infArr[2]);
|
104 |
+
event.dataTransfer.setData('wptbElIndic-' + infArr[1], 'wptbElIndic-' + infArr[1]);
|
105 |
+
var act = event.target.parentNode.parentNode;
|
106 |
+
if (act.kind == 'text') {
|
107 |
+
var thisRow = el.parentNode;
|
108 |
+
if (thisRow.classList.contains('wptb-table-head')) {
|
109 |
+
var table = WPTB_Helper.findAncestor(thisRow, 'wptb-preview-table');
|
110 |
+
WPTB_Helper.dataTitleColumnSet(table);
|
111 |
+
}
|
112 |
+
}
|
113 |
+
};
|
114 |
+
|
115 |
+
if (element.kind === 'button') {
|
116 |
+
var a = node.querySelector('a'),
|
117 |
+
target = a.querySelector('div');
|
118 |
+
a.onclick = function (e) {
|
119 |
+
e.preventDefault();
|
120 |
+
};
|
121 |
+
WPTB_Helper.buttonsTinyMceInit(target);
|
122 |
+
} else if (element.kind === 'text') {
|
123 |
+
tinyMCE.init({
|
124 |
+
target: node.childNodes[0],
|
125 |
+
inline: true,
|
126 |
+
plugins: "link, paste",
|
127 |
+
dialog_type: "modal",
|
128 |
+
theme: 'modern',
|
129 |
+
menubar: false,
|
130 |
+
fixed_toolbar_container: '#wpcd_fixed_toolbar',
|
131 |
+
paste_as_text: true,
|
132 |
+
toolbar: 'bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify',
|
133 |
+
setup: function setup(ed) {
|
134 |
+
ed.on('change', function (e) {
|
135 |
+
var row = WPTB_Helper.findAncestor(node, 'wptb-row');
|
136 |
+
if (row.classList.contains('wptb-table-head')) {
|
137 |
+
var table = WPTB_Helper.findAncestor(row, 'wptb-preview-table');
|
138 |
+
WPTB_Helper.dataTitleColumnSet(table);
|
139 |
+
}
|
140 |
+
});
|
141 |
+
},
|
142 |
+
init_instance_callback: function init_instance_callback(editor) {
|
143 |
+
window.currentEditor = editor;
|
144 |
+
//editor.fire('focus');
|
145 |
+
editor.on('focus', function (e) {
|
146 |
+
var totalWidth = document.getElementsByClassName('wptb-builder-panel')[0].offsetWidth;
|
147 |
+
if (window.currentEditor && document.getElementById('wptb_builder').scrollTop >= 55 && window.currentEditor.bodyElement.style.display != 'none') {
|
148 |
+
document.getElementById('wpcd_fixed_toolbar').style.position = 'fixed';
|
149 |
+
document.getElementById('wpcd_fixed_toolbar').style.right = totalWidth / 2 - document.getElementById('wpcd_fixed_toolbar').offsetWidth / 2 + 'px';
|
150 |
+
document.getElementById('wpcd_fixed_toolbar').style.top = '100px';
|
151 |
+
} else {
|
152 |
+
document.getElementById('wpcd_fixed_toolbar').style.position = 'static';
|
153 |
+
delete document.getElementById('wpcd_fixed_toolbar').style.right;
|
154 |
+
delete document.getElementById('wpcd_fixed_toolbar').style.top;
|
155 |
+
}
|
156 |
+
});
|
157 |
+
}
|
158 |
+
});
|
159 |
+
} else {
|
160 |
+
listItems = node.getElementsByClassName('wptb-list-item-content');
|
161 |
+
for (var _i = 0; _i < listItems.length; _i++) {
|
162 |
+
WPTB_Helper.listItemsTinyMceInit(listItems[_i]);
|
163 |
+
}
|
164 |
+
}
|
165 |
+
|
166 |
+
actions.appendChild(btnMove);
|
167 |
+
actions.appendChild(btnCopy);
|
168 |
+
actions.appendChild(btnDelete);
|
169 |
+
this.appendChild(actions);
|
170 |
+
};
|
171 |
+
|
172 |
+
node.onmouseleave = function (event) {
|
173 |
+
this.classList.remove('wptb-directlyhovered');
|
174 |
+
var iter = 0;
|
175 |
+
while (event.target.querySelector('.wptb-actions') && iter < 5) {
|
176 |
+
event.target.querySelector('.wptb-actions').remove();
|
177 |
+
iter++;
|
178 |
+
}
|
179 |
+
};
|
180 |
+
|
181 |
+
// Change data-title-column if the title was changed
|
182 |
+
if (element.kind == 'text') {
|
183 |
+
var observer = new MutationObserver(function (mutations) {
|
184 |
+
var row = WPTB_Helper.findAncestor(node, 'wptb-row');
|
185 |
+
if (row.classList.contains('wptb-table-head')) {
|
186 |
+
var table = WPTB_Helper.findAncestor(row, 'wptb-preview-table');
|
187 |
+
WPTB_Helper.dataTitleColumnSet(table);
|
188 |
+
}
|
189 |
+
});
|
190 |
+
var config = { attributes: true, attributeFilter: ['style'] };
|
191 |
+
observer.observe(element.getDOMElement(), config);
|
192 |
+
}
|
193 |
+
|
194 |
+
var node_wptb_element_kind_num = node.className.match(/wptb-element-(.+)-(\d+)/i);
|
195 |
+
if (node_wptb_element_kind_num) {
|
196 |
+
node.classList.remove(node_wptb_element_kind_num[0]);
|
197 |
+
}
|
198 |
+
if (!node.classList.contains('wptb-ph-element')) {
|
199 |
+
node.classList.add('wptb-ph-element');
|
200 |
+
if (!node.classList.contains('wptb-element-' + element.kind + '-' + index)) {
|
201 |
+
node.classList.add('wptb-element-' + element.kind + '-' + index);
|
202 |
+
}
|
203 |
+
} else {
|
204 |
+
if (!node.classList.contains('wptb-element-' + element.kind + '-' + index)) {
|
205 |
+
node.classList.add('wptb-element-' + element.kind + '-' + index);
|
206 |
+
}
|
207 |
+
}
|
208 |
+
new WPTB_ElementOptions(element, index, kindIndexProt);
|
209 |
+
|
210 |
+
document.counter.increment(element.kind);
|
211 |
+
};
|
212 |
+
|
213 |
(function () {
|
214 |
var WPTB_Builder = function WPTB_Builder() {
|
215 |
var table_id = WPTB_Helper.detectMode();
|
1585 |
// WPTB_LeftPanel();
|
1586 |
// }
|
1587 |
};
|
1588 |
+
var WPTB_innerElementSet = function WPTB_innerElementSet(element) {
|
|
|
|
|
|
|
1589 |
|
1590 |
+
function newElementProxy(el) {
|
1591 |
+
if (el == 'list') {
|
1592 |
+
return new WPTB_List();
|
1593 |
+
} else if (el == 'image') {
|
1594 |
+
return new WPTB_Image();
|
1595 |
+
} else if (el == 'text') {
|
1596 |
+
return new WPTB_Text();
|
1597 |
+
} else if (el == 'button') {
|
1598 |
+
return new WPTB_Button();
|
|
|
|
|
1599 |
}
|
1600 |
}
|
1601 |
|
1602 |
+
element.ondragenter = function (e) {
|
1603 |
+
var div;
|
1604 |
+
if (e.dataTransfer.types.indexOf('wptbelement') == -1 && e.dataTransfer.types.indexOf('wptb-moving-mode') == -1) {
|
1605 |
+
return;
|
1606 |
+
}
|
1607 |
+
WPTB_DropHandle(this, e);
|
1608 |
+
|
1609 |
+
element.classList.add('wptb-ondragenter');
|
1610 |
+
};
|
1611 |
+
element.ondragover = function (e) {
|
1612 |
+
e.preventDefault();
|
1613 |
+
WPTB_DropHandle(this, e);
|
1614 |
+
};
|
1615 |
+
element.ondragleave = function () {};
|
1616 |
+
element.ondrop = function (e) {
|
1617 |
+
this.classList.remove('wptb-ondragenter');
|
1618 |
+
var element = void 0,
|
1619 |
+
classId = void 0;
|
1620 |
+
e.preventDefault();
|
1621 |
+
e.stopPropagation();
|
1622 |
+
|
1623 |
+
if (!e.dataTransfer.getData('wptbElement') && !e.dataTransfer.getData('node')) {
|
1624 |
+
return;
|
1625 |
+
}
|
1626 |
+
var wptbDropHandle = void 0,
|
1627 |
+
wptbDropBorderMarker = void 0;
|
1628 |
+
if (document.getElementsByClassName('wptb-drop-handle').length > 0) {
|
1629 |
+
wptbDropHandle = document.getElementsByClassName('wptb-drop-handle')[0];
|
1630 |
+
}
|
1631 |
+
if (document.getElementsByClassName('wptb-drop-border-marker').length > 0) {
|
1632 |
+
wptbDropBorderMarker = document.getElementsByClassName('wptb-drop-border-marker')[0];
|
1633 |
+
}
|
1634 |
+
|
1635 |
+
if (e.dataTransfer.getData('wptbElement')) {
|
1636 |
+
element = newElementProxy(e.dataTransfer.getData('wptbElement'));
|
1637 |
+
element = element.getDOMElement();
|
1638 |
+
} else {
|
1639 |
+
classId = e.dataTransfer.getData('node');
|
1640 |
+
element = document.getElementsByClassName(classId)[0];
|
1641 |
+
element.classList.remove('wptb-moving-mode');
|
1642 |
+
}
|
1643 |
+
|
1644 |
+
if (wptbDropHandle.style.display == 'block') {
|
1645 |
+
var td = void 0;
|
1646 |
+
if (wptbDropHandle.dataset.text == 'Drop Here') {
|
1647 |
+
td = wptbDropHandle.getDOMParentElement();
|
1648 |
+
td.appendChild(element);
|
1649 |
+
} else {
|
1650 |
+
var innerElement = wptbDropHandle.getDOMParentElement();
|
1651 |
+
td = innerElement.parentNode;
|
1652 |
+
|
1653 |
+
if (wptbDropHandle.dataset.text == 'Abowe Element') {
|
1654 |
+
td.insertBefore(element, innerElement);
|
1655 |
+
} else if (wptbDropHandle.dataset.text == 'Below Element') {
|
1656 |
+
var innerElementNext = innerElement.nextSibling;
|
1657 |
+
td.insertBefore(element, innerElementNext);
|
1658 |
+
}
|
1659 |
+
}
|
1660 |
+
var thisRow = td.parentNode;
|
1661 |
+
if (thisRow.classList.contains('wptb-table-head')) {
|
1662 |
+
var table = WPTB_Helper.findAncestor(thisRow, 'wptb-preview-table');
|
1663 |
+
WPTB_Helper.dataTitleColumnSet(table);
|
1664 |
+
}
|
1665 |
+
} else {
|
1666 |
+
return;
|
1667 |
+
}
|
1668 |
+
|
1669 |
+
wptbDropHandle.style.display = 'none';
|
1670 |
+
wptbDropBorderMarker.style.display = 'none';
|
1671 |
+
|
1672 |
+
WPTB_innerElementSet(element);
|
1673 |
+
|
1674 |
+
return true;
|
1675 |
+
};
|
1676 |
+
element.onmouseover = function (e) {
|
1677 |
+
element.classList.remove('wptb-ondragenter');
|
1678 |
+
};
|
1679 |
+
};
|
1680 |
+
var WPTB_LeftPanel = function WPTB_LeftPanel() {
|
1681 |
+
|
1682 |
+
var table = document.getElementsByClassName('wptb-preview-table')[0],
|
1683 |
+
wptbElementButtons = document.getElementsByClassName('wptb-element');
|
1684 |
+
|
1685 |
+
function wptbTdBgColorSavedSet(inputId, trNumber) {
|
1686 |
+
if (trNumber > 3) return;
|
1687 |
+
if (table) {
|
1688 |
+
var tableRows = table.getElementsByTagName('tr');
|
1689 |
+
if (tableRows.length > trNumber) {
|
1690 |
+
var trBackgroundColor = tableRows[trNumber].style.backgroundColor;
|
1691 |
+
var wptbEvenRowBg = document.getElementById(inputId);
|
1692 |
+
if (wptbEvenRowBg && trBackgroundColor) {
|
1693 |
+
wptbEvenRowBg.value = WPTB_Helper.rgbToHex(trBackgroundColor);
|
1694 |
+
}
|
1695 |
+
}
|
1696 |
+
}
|
1697 |
+
}
|
1698 |
+
|
1699 |
+
wptbTdBgColorSavedSet('wptb-even-row-bg', 1);
|
1700 |
+
jQuery('#wptb-even-row-bg').wpColorPicker({
|
1701 |
+
change: function change(event, ui) {
|
1702 |
+
var tableRows = table.getElementsByTagName('tr');
|
1703 |
+
for (var _i = 1; _i < tableRows.length; _i += 2) {
|
1704 |
+
tableRows[_i].style.backgroundColor = ui.color.toString();
|
1705 |
+
}
|
1706 |
+
},
|
1707 |
+
clear: function clear() {
|
1708 |
+
var tableRows = table.getElementsByTagName('tr');
|
1709 |
+
for (var _i2 = 1; _i2 < tableRows.length; _i2 += 2) {
|
1710 |
+
tableRows[_i2].style.backgroundColor = '';
|
1711 |
+
var tds = tableRows[_i2].getElementsByTagName('td');
|
1712 |
+
for (var j = 0; j < tds.length; j++) {
|
1713 |
+
tds[j].style.backgroundColor = '';
|
1714 |
+
}
|
1715 |
+
}
|
1716 |
+
}
|
1717 |
+
|
1718 |
});
|
1719 |
|
1720 |
wptbTdBgColorSavedSet('wptb-odd-row-bg', 2);
|
2435 |
|
2436 |
var shortcodePopupWindow = document.getElementsByClassName('wptb-popup-window-modal')[0];
|
2437 |
document.getElementsByClassName('wptb-embed-btn')[0].onclick = function () {
|
2438 |
+
if (!this.classList.contains('wptb-button-disable')) {
|
2439 |
shortcodePopupWindow.classList.add('wptb-popup-show');
|
2440 |
}
|
2441 |
};
|
2501 |
if (data[0] == 'saved') {
|
2502 |
document.wptbId = data[1];
|
2503 |
messagingArea.innerHTML = '<div class="wptb-success wptb-message">Table "' + t + '" was successfully saved.</div>';
|
2504 |
+
document.getElementsByClassName('wptb-embed-btn')[0].classList.remove('wptb-button-disable');
|
2505 |
document.getElementById('wptb-embed-shortcode').value = '[wptb id=' + data[1] + ']';
|
2506 |
+
var wptbPreviewBtn = document.getElementsByClassName('wptb-preview-btn');
|
2507 |
+
if (wptbPreviewBtn.length > 0) {
|
2508 |
+
wptbPreviewBtn = wptbPreviewBtn[0];
|
2509 |
+
wptbPreviewBtn.classList.remove('wptb-button-disable');
|
2510 |
+
var wptbPreviewBtnHref = wptbPreviewBtn.dataset.previewHref;
|
2511 |
+
wptbPreviewBtnHref = wptbPreviewBtnHref.replace('empty', data[1]);
|
2512 |
+
wptbPreviewBtn.setAttribute('href', wptbPreviewBtnHref);
|
2513 |
+
}
|
2514 |
} else if (data[0] == 'edited') {
|
2515 |
messagingArea.innerHTML = '<div class="wptb-success wptb-message">Table "' + t + '" was successfully updated.</div>';
|
2516 |
} else {
|
4472 |
|
4473 |
return this;
|
4474 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4475 |
//# sourceMappingURL=admin.js.map
|
inc/admin/js/admin.js.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"sources":["WPTB_Builder.js","WPTB_Button.js","WPTB_Cell.js","WPTB_DropHandle.js","WPTB_ElementCounters.js","WPTB_ElementOptions.js","WPTB_Helper.js","WPTB_Image.js","WPTB_Initializer.js","WPTB_LeftPanel.js","WPTB_List.js","WPTB_ListItem.js","WPTB_MultipleSelect.js","WPTB_Parser.js","WPTB_Parser2.js","WPTB_Settings.js","WPTB_Space.js","WPTB_Stringifier.js","WPTB_Stringifier2.js","WPTB_Table.js","WPTB_Text.js","WPTB_innerElementSet.js","applyGenericItemSettings.js","wptb-builder.js"],"names":["WPTB_Builder","table_id","WPTB_Helper","detectMode","http","XMLHttpRequest","urlSet","ajaxurl","open","setRequestHeader","onreadystatechange","d","readyState","status","ans","JSON","parse","responseText","document","getElementById","value","getElementsByClassName","style","display","wptbTableSetupEl","appendChild","WPTB_Parser","WPTB_Table","WPTB_LeftPanel","WPTB_Settings","send","counter","ElementCounters","select","MultipleSelect","initializer","WPTB_Initializer","settings","addEventListener","WPTB_Button","text","DOMElementProt","DOMElement","createElement","elButton","el_B","el_BDiv","kindIndexProt","undefined","copy","classList","add","innerHTML","wptbElementMutch","className","match","Array","isArray","attributesContainer","attributes","length","i","setAttribute","name","wptbButtonWrapper","querySelector","wptbButtonWrapAttributes","wptbButton","wptbButtonAttributes","kind","getDOMElement","applyGenericItemSettings","WPTB_Cell","callback","highlightRow","td","parentRow","parentNode","columnCount","parseInt","tds","getElementsByTagName","remove","classToAdd","ttd","highlightColumn","index","rowCount","table","tr","padding","jQuery","val","innerBorderWidth","border","draggable","onclick","WPTB_innerElementSet","wptbPhElement","wptbSpaceBetween","j","WPTB_Space","wptbElementTypeClass","wptbTypeElementArr","split","wptbListItems","WPTB_ListItem","setCoords","y","x","el","dataset","yIndex","xIndex","getCoords","coords","appendElement","node","getCellDimensions","tdStyleObj","window","getComputedStyle","tdPaddingLeft","getPropertyValue","tdPaddingRight","tdBorderLeftWidth","tdBorderRightWidth","tdPaddingTop","tdPaddingBottom","tdBorderTopWidth","tdBorderBottomWidth","width","parseFloat","offsetWidth","height","offsetHeight","WPTB_DropHandle","thisElem","e","newElementProxy","includes","WPTB_List","WPTB_Image","WPTB_Text","wptbDropHandle","wptbDropBorderMarker","wptbDropBorderMarkerTop","wptbDropBorderMarkerRight","wptbDropBorderMarkerBottom","wptbDropBorderMarkerLeft","body","ondragenter","ondragover","preventDefault","ondragleave","ondrop","element","dataTransfer","getData","getDOMParentElement","nodeName","toLowerCase","innerElement","insertBefore","innerElementNext","nextSibling","thisRow","contains","findAncestor","dataTitleColumnSet","wptbContainer","onscroll","localName","indics","types","notDragEnter","infArr","coordinatesElement","getBoundingClientRect","left","Number","top","indexOf","elementDrag","offsetY","layerY","bottom","priv","increment","key","nextIndex","WPTB_ElementOptions","elemIdClass","prop","cloneNode","properties","affectedEl","wptbButtonA","wptbSize","b","buttonAlignment","justifyContent","buttonAlignmentSelect","selectOption","selectOptionVal","selected","buttonHref","getAttribute","buttonLinkTarget","buttonId","buttonHrefInput","buttonLinkTargetInput","buttonLinkTargetInputId","buttonLinkTargetInputLabel","buttotIdInput","checked","buttonTextColor","color","buttonColor","backgroundColor","buttonTextColorInput","buttonBackgroundColorInput","rgbToHex","elementsA","a","aTextAlign","textAlign","imageAlignmentSelect","imageLinkHref","inputImageLink","imageLinkTarget","imageLinkTargetInput","imageLinkTargetInputId","imageLinkTargetInputLabel","img","imgWidth","imageWidthInputRange","imageWidthInputNumber","imgAlternativeText","imageAlternativeTextInput","elementFontSize","fontSize","elementTextColor","textFontSizeInputRange","textFontSizeInputNumber","textColorInput","elementList","elementListColor","listColorInput","elementListItem","querySelectorAll","listItemP","listItemPClasses","elementListClassSelect","listIconSelectLabel","nodeType","listIconSelectLabelId","elementListStyleTypeSelect","elementListItemContent","listItemPTextAlignArr","p","push","listItemPTextAlignLeftCount","listItemPTextAlignCenterCount","listItemPTextAlignRightCount","elementListAlignmentSelect","maxListItemTAlLeftC","Math","max","optionsClass","children","childNodes","buttons","size","n_Class","type","num","optionControls","wpColorPicker","change","event","ui","parent","target","classe","ps","number","toString","slider","oninput","onchange","src","alt","href","linkHttpCheckChange","rel","removeAttribute","jc","id","listItems","parentNodeSettingItem","listItem","hexToRgb","hex","result","exec","rgb","slice","getDragImageCustom","hostName","location","protocol","hostname","dragImagesArr","image","button","list","listItemsRecalculateIndex","ulElem","par","listStyleTypeIndex","listItemsTinyMceInit","tinyMCE","init","inline","plugins","dialog_type","theme","menubar","fixed_toolbar_container","paste_as_text","toolbar","setup","ed","on","article","keyCode","duplicate","firstChild","innerText","pText","replace","trim","selectedText","getSelectionText","init_instance_callback","editor","currentEditor","totalWidth","scrollTop","bodyElement","position","right","buttonsTinyMceInit","link","linkArr","linkClean","rows","rowHead","computedStyleRowHead","rowHeadChildren","contentsForHeader","tdElements","textContent","thisRowChildren","wptbTitleColumn","wptbTitleColumnFontSize","wptbTitleColumnColor","wptbTitleBackgroundColor","wptbTitleAlign","cls","parentElement","txt","getSelection","selection","createRange","settingsPanelClear","wpColorPickerClear","inputId","input","wpPickerContainer","removeChild","newInput","url","regex","RegExp","results","decodeURIComponent","getColumnWidth","cell","xIndexes","cellWidth","getRowHeight","yIndexes","cellHeight","elImage","anchor","file_frame","wp","media","frames","title","multiple","attachment","state","get","first","toJSON","MIN_COLUMNS","MIN_ROWS","MAX_COLUMNS","MAX_ROWS","tableGenerator","columnsDecrementButton","columnsIncrementButton","rowsDecrementButton","rowsIncrementButton","columnsInput","rowsInput","columns","wptbElementButtons","wptbTdBgColorSavedSet","trNumber","tableRows","trBackgroundColor","wptbEvenRowBg","clear","tableHeader","tableTopRowAsHeadSavedSet","wptbTopRowAsHeader","tableBorderColorWidthSavedSet","tableBorderColor","borderColor","tableBorderColorInput","tableBorderWidth","borderWidth","wptbTableBorderWidthSlider","wptbTableBorderWidthNumber","tableTd","applyInnerBorder","innerBorderCheckInput","wptbApplyInnerBorder","wptbTableInnerBorderSlider","wptbTableInnerBorderNumber","tableCells","tableInnerborderNumber","addInnerBorderSize","borderStyle","addCellPadding","addInnerBorder","styles","wptbPreviewTable","marginBottom","addBorderSize","cellPaddingSavedSet","wptbTableCellSlider","wptbTableCellNumber","numberImputSize","wptbNumberInputs","maxCount","maxValue","onkeydown","thisValue","String","substring","onkeyup","wptbTableBorderNumber","wptbTextfontSizeNumber","wptbImageWidthNumber","wptbTableColumnWidthNumber","wptbTableRowHeightNumber","tdDefaultWidth","wptbInnerBorderCheck","tableBorderColorSetArea","addColumnWidth","highlighted","addRowHeight","createMobileHeadForTable","thisEvent","ondragstart","setData","wptbElement","toggleTableEditMode","addRowToTheEnd","addRowToTheStart","addRowBefore","addRowAfter","addColumnEnd","addColumnStart","addColumnBefore","addColumnAfter","deleteColumn","deleteRow","mergeCells","splitCell","wptbBuilderPanel","wpcdFixedToolbar","hasAttribute","innerElements","el_L","item","wptbListItemReturn","divcontent","styleDot","listItemKeyListener","onmouseenter","btnDelete","btnCopy","actions","previous","action","content","html","setTimeout","append","onmouseleave","iter","selectedCells","multipleCellMode","activateMultipleSelectMode","deactivateMultipleSelectMode","isActivated","pushSelectedCell","flushSelectedCells","getFirst","minXIndex","minYIndex","getLast","maxXIndex","maxYIndex","last","removeAllButFirst","code","div","columnTitleMobile","WPTB_Parser2","elementHtml","createTextNode","tagName","elems","effectAllowed","ondragend","shortcodePopupWindow","bar","wptb_admin_object","t","messagingArea","WPTB_Stringifier","outerHTML","messagingAreaText","params","security_code","rs","wptbId","stringify","data","elSpaceBetween","spaceBetween","stopPropagation","t_space","spaceParent","alert","codeMain","tableColumns","minWidth","maxWidth","mceContentBodys","k","dataMceStyle","contentEditable","spellCheck","mceIds","wptbActions","wptbActionsLength","columnNameDivContainer","columnNameDiv","WPTB_Stringifier2","start","nodeValue","int_elem_arr","attributes_list","internal_elements","inter_elem","array","wptbTableSetup","row","maxAmountOfCells","maxAmountOfRows","mark","rowSpan","cs","colSpan","markedCells","noCells","singleCells","multipleCells","cellSettings","column","cellHighlighted","wptbTableColumnWidthSlider","tableColumnWidthAutoFixedCheckbox","wptbFixedWidth","wptbTableRowHeightSlider","tableRowHeightAutoFixedCheckbox","wptbFixedHeight","isSquare","realTimeArray","carried","cols","matriz","items","justAssigned","amount","carriedRowspans","cellsBuffer","cellPointer","xPosition","stepsToMove","celda","drawTable","string","undoSelect","fillTableArray","colspansSums","cells","colspanSumInRow","apply","getActualPointsInRow","points","search","skipInCols","reconstraction","insertRow","wptb_preview_table","cellModeBackground","leftScrollPanelCurtain","leftScrollPanelCellSettings","wptbPreviewTableTds","recalculateIndexes","trs","maxCols","maxColsFull","tdsArr","jMainIter","z","cleaner","dataXIndex","tableTdsFor","colspan","widthIsSet","arrayTdsFromPreviousRow","tableTdsSumMaxWidth","tableTdsSumMaxWidthFixed","tableTdsSumMaxWidthAuto","wptbTableSetupWidth","arrayCellsWidthFixedHelper","arrayCellsWidthAutoHelper","tdPaddingCommon","tableTdBorderCommonWidth","cssForTdsWidthAuto","wptbCssTdAutoWidth","tableTdBorderLeftWidth","tableTdBorderRightWidth","CellsWidthAutoCount","tableFullStyleObj","borderLeftWidth","borderRightWidth","tableBorderCommon","wptbTableTdsSumMaxWidth","wptbCellsWidthAutoCount","mergingСellsHorizontally","wptbFixedWidthSize","styleElementCreate","tableTdWidthAuto","tableTdsWidthAutoCommon","head","cssForTdsWidthAutoOld","dataYIndex","rowspan","heightIsSet","arrayTdsPrevious","tableColumnHeightAutoFixedCheckbox","mergingCellsVertically","forBreak","currentTable","currentTableTd","currentTdStyle","firstCell","c_pos","cellStyle","pos","pendingInsertion","bro","currentCell","l","r","aux","from","cellNew","rowChildren","rowChildrenLength","cellRowSpan","rowAfter","cellsColSpan","tableRowsIChildren","tableRIChildrenLength","rowIRowSpan","rNext","rNextChildren","rNextChildrenLength","rowStart","columnStart","rowEnd","columnEnd","itemsEstimate","dimensions","call","tdsChildrenNew","tdsInternalElements","tdsIntElemLength","firstWidth","firstDataFixedWidth","firstHeight","firstDataFixedHeight","cellStyles","cellXIndex","rowChildInsertBefore","rowNext","findRowspannedCells","difference","actualPoints","addLackingCells","sumRows","totalColspan","nextRow","nextRowChildren","nextRowChildrenLength","tdArr","nextRowChildrenK","jRowChildren","pop","onresize","elText2","elP","classId","onmouseover","wptbElements","elementIndexesArr","elementIndexMax","btnMove","act","temp","srcList","opacity","setDragImage","observer","MutationObserver","mutations","config","attributeFilter","observe","node_wptb_element_kind_num"],"mappings":"AAAA,CAAC,YAAY;AACT,QAAIA,eAAe,SAAfA,YAAe,GAAY;AAC3B,YAAIC,WAAWC,YAAYC,UAAZ,EAAf;AACA,YAAKF,QAAL,EAAgB;AACZ,gBAAIG,OAAO,IAAIC,cAAJ,EAAX;AAAA,gBACIC,SAASC,UAAU,mBAAV,GAAgC,MAAhC,GAAyCN,QADtD;AAEAG,iBAAKI,IAAL,CAAU,KAAV,EAAiBF,MAAjB,EAAyB,IAAzB;AACAF,iBAAKK,gBAAL,CAAsB,cAAtB,EAAsC,mCAAtC;AACAL,iBAAKM,kBAAL,GAA0B,UAAUC,CAAV,EAAa;AACnC,oBAAI,KAAKC,UAAL,IAAmB,CAAnB,IAAwB,KAAKC,MAAL,IAAe,GAA3C,EAAgD;AAC5C,wBAAIC,MAAMC,KAAKC,KAAL,CAAWZ,KAAKa,YAAhB,CAAV;AACAC,6BAASC,cAAT,CAAwB,iBAAxB,EAA2CC,KAA3C,GAAmDN,IAAI,CAAJ,CAAnD;;AAEA,wBAAIA,IAAI,CAAJ,CAAJ,EAAa;AACTI,iCAASG,sBAAT,CAAgC,sBAAhC,EAAwD,CAAxD,EAA2DC,KAA3D,CAAiEC,OAAjE,GAA2E,MAA3E;AACA,4BAAIC,mBAAmBN,SAASG,sBAAT,CAAgC,kBAAhC,EAAoD,CAApD,CAAvB;AACAG,yCAAiBC,WAAjB,CAA8BC,YAAaZ,IAAI,CAAJ,CAAb,CAA9B;AACAa;AACAC;AACAC;AACH,qBAPD,MAOO;AACHX,iCAASG,sBAAT,CAAgC,sBAAhC,EAAwD,CAAxD,EAA2DC,KAA3D,CAAiEC,OAAjE,GAA2E,OAA3E;AACH;;AAED;AACH;AACJ,aAlBD;AAmBAnB,iBAAK0B,IAAL,CAAU,IAAV;AACH,SAzBD,MAyBO;AACHZ,qBAASG,sBAAT,CAAgC,sBAAhC,EAAwD,CAA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AL,EAAkC;AAC9BpoB,aAAKnE,SAAL,CAAegC,MAAf,CAAuBuqB,2BAA2B,CAA3B,CAAvB;AACH;AACD,QAAK,CAAEpoB,KAAKnE,SAAL,CAAeqH,QAAf,CAAyB,iBAAzB,CAAP,EAAsD;AAClDlD,aAAKnE,SAAL,CAAeC,GAAf,CAAoB,iBAApB;AACA,YAAI,CAAEkE,KAAKnE,SAAL,CAAeqH,QAAf,CAAyB,kBAAkBX,QAAQvF,IAA1B,GAAiC,GAAjC,GAAuCiB,KAAhE,CAAN,EAAgF;AAC5E+B,iBAAKnE,SAAL,CAAeC,GAAf,CAAoB,kBAAkByG,QAAQvF,IAA1B,GAAiC,GAAjC,GAAuCiB,KAA3D;AACH;AACJ,KALD,MAKO;AACH,YAAI,CAAE+B,KAAKnE,SAAL,CAAeqH,QAAf,CAAyB,kBAAkBX,QAAQvF,IAA1B,GAAiC,GAAjC,GAAuCiB,KAAhE,CAAN,EAAgF;AAC5E+B,iBAAKnE,SAAL,CAAeC,GAAf,CAAoB,kBAAkByG,QAAQvF,IAA1B,GAAiC,GAAjC,GAAuCiB,KAA3D;AACH;AACJ;AACD,QAAIyG,mBAAJ,CAAyBnC,OAAzB,EAAkCtE,KAAlC,EAAyCvC,aAAzC;;AAEA7B,aAASa,OAAT,CAAiB6J,SAAjB,CAA2BhC,QAAQvF,IAAnC;AACH,CAnND;ACAA","file":"admin.js","sourcesContent":["(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 WPTB_Table();\n WPTB_LeftPanel();\n WPTB_Settings();\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 document.counter = new ElementCounters();\n document.select = new MultipleSelect();\n\n var initializer = WPTB_Initializer();\n settings = WPTB_Settings();\n };\n\n document.addEventListener('DOMContentLoaded', WPTB_Builder);\n})();","var WPTB_Button = function( text, DOMElementProt ) {\n \n var DOMElement = document.createElement('div'),\n elButton = document.createElement('div'),\n el_B = document.createElement('a'),\n el_BDiv = document.createElement( 'div' ),\n kindIndexProt = undefined,\n copy = false;\n\n DOMElement.classList.add('wptb-button-container', 'wptb-size-M', 'wptb-');\n elButton.classList.add('wptb-button-wrapper');\n el_BDiv.classList.add('wptb-button');\n el_BDiv.innerHTML = text != undefined ? text : 'Button Text';\n \n // Creation of a new button when copying to avoid errors when assigning new event handlers.\n if ( DOMElementProt ) {\n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\n kindIndexProt = wptbElementMutch[1];\n copy = true;\n }; \n var attributesContainer = [...DOMElementProt.attributes];\n if ( attributesContainer.length > 0 ) {\n for( let i = 0; i < attributesContainer.length; i++ ) {\n DOMElement.setAttribute(attributesContainer[i].name, attributesContainer[i].value);\n } \n }\n \n var wptbButtonWrapper = DOMElementProt.querySelector( '.wptb-button-wrapper' );\n if ( wptbButtonWrapper ) {\n var wptbButtonWrapAttributes = [...wptbButtonWrapper.attributes];\n if ( wptbButtonWrapAttributes.length > 0 ) {\n for( let i = 0; i < wptbButtonWrapAttributes.length; i++ ) {\n if ( wptbButtonWrapAttributes[i].name == 'style') {\n elButton.setAttribute( wptbButtonWrapAttributes[i].name, wptbButtonWrapAttributes[i].value );\n }\n } \n }\n }\n \n var wptbButton = DOMElementProt.querySelector( 'a' );\n if ( wptbButton ) {\n var wptbButtonAttributes = [...wptbButton.attributes];\n if ( wptbButtonAttributes.length > 0 ) {\n for( let i = 0; i < wptbButtonAttributes.length; i++ ) {\n if ( wptbButtonAttributes[i].name == 'style' || \n wptbButtonAttributes[i].name == 'href' || \n wptbButtonAttributes[i].name == 'target' ) {\n el_B.setAttribute( wptbButtonAttributes[i].name, wptbButtonAttributes[i].value );\n }\n } \n }\n }\n }\n \n elButton.appendChild(el_B);\n el_B.appendChild( el_BDiv );\n DOMElement.appendChild(elButton);\n \n \n \n this.kind = 'button';\n\n this.getDOMElement = function () {\n return DOMElement;\n };\n\n applyGenericItemSettings( this, kindIndexProt, copy );\n\n return this;\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 WPTB_innerElementSet( DOMElement );\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\n let wptbSpaceBetween = DOMElement.getElementsByClassName( 'wptb-space-between' );\n\n if ( wptbSpaceBetween.length > 0 ) {\n for( let j = 0; j < wptbSpaceBetween.length; j++ ) {\n WPTB_Space( wptbSpaceBetween[j] );\n }\n }\n \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 if ( wptbPhElement[i].kind == 'list' ) {\n let wptbListItems = wptbPhElement[i].getElementsByTagName( 'li' );\n if( wptbListItems.length > 0 ) {\n for ( let i = 0; i < wptbListItems.length; i++ ) {\n WPTB_ListItem( undefined, wptbListItems[i] );\n }\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 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 = parseFloat( this.offsetWidth, 10 ) - \n parseFloat( tdPaddingLeft, 10 ) - \n parseFloat( tdPaddingRight, 10 ) -\n parseFloat( tdBorderLeftWidth, 10 ) -\n parseFloat( tdBorderRightWidth, 10 );\n \n let height = parseFloat( this.offsetHeight, 10 ) - \n parseFloat( tdPaddingTop, 10 ) - \n parseFloat( tdPaddingBottom, 10 ) -\n parseFloat( tdBorderTopWidth, 10 ) -\n parseFloat( tdBorderBottomWidth, 10 );\n \n return {\n width: width, \n height: height\n };\n }\n\n return this;\n};","var WPTB_DropHandle = function (thisElem, e) {\n \n function newElementProxy(el) {\n if (el.includes('list')) {\n return new WPTB_List();\n } else if (el.includes('image')) {\n return new WPTB_Image();\n } else if (el.includes('text')) {\n return new WPTB_Text();\n } else if (el.includes('button')) {\n return new WPTB_Button();\n }\n }\n \n let wptbDropHandle,\n wptbDropBorderMarker;\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 let 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 = 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 }\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 == 'Abowe 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( thisRow.classList.contains( 'wptb-table-head' ) ) {\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\n WPTB_Helper.dataTitleColumnSet( table );\n }\n \n wptbDropHandle.style.display = 'none';\n wptbDropBorderMarker.style.display = 'none';\n \n WPTB_innerElementSet(element);\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 if( thisRow.classList.contains( 'wptb-table-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 wptbDropHandle.style.width = thisElem.offsetWidth + 'px';\n let height = thisElem.offsetHeight,\n coordinatesElement = thisElem.getBoundingClientRect(),\n left = Number( 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 = Number( coordinatesElement.top ) - Number( 11 );\n wptbDropHandle.dataset.text = 'Abowe Element';\n if ( y > height/2 ) {\n top = Number( coordinatesElement.top ) + height - 1;\n wptbDropHandle.dataset.text = 'Below Element';\n }\n } else {\n wptbDropHandle.dataset.text = 'Drop Here';\n top = Number( 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 = ( Number( thisElem.offsetWidth ) - Number( 1 ) ) + 'px';\n\n wptbDropBorderMarkerRight = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-right' );\n wptbDropBorderMarkerRight.style.height = ( Number( coordinatesElement.bottom ) - Number( 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_ElementOptions = function ( element, index, kindIndexProt ) {\n\n var node = element.getDOMElement(), elemIdClass;\n\n prop = document.querySelector(\".wptb-\" + element.kind + \"-options-prototype\").cloneNode(true);\n prop.classList.remove(\"wptb-\" + element.kind + \"-options-prototype\"); // remove prototype from the class\n elemIdClass = 'wptb-options-' + element.kind + \"-\" + index;\n\n var properties = prop.getElementsByClassName('wptb-element-property');\n\n for (var i = 0; i < properties.length; i++) {\n properties[i].dataset.element = elemIdClass;\n }\n\n prop.classList.add(elemIdClass);\n document.getElementById(\"element-options-group\").appendChild(prop);\n \n if ( kindIndexProt ) {\n if ( element.kind == 'button' ) {\n let affectedEl = document.getElementsByClassName( 'wptb-element-' + kindIndexProt )[0],\n wptbButtonWrapper,\n wptbButtonA,\n wptbButton,\n wptbSize;\n \n if ( affectedEl ) {\n wptbSize = affectedEl.className.match(/wptb-size-([a-z]+)/i);\n }\n \n if( wptbSize && Array.isArray( wptbSize ) ) {\n var b = prop.getElementsByClassName('wptb-btn-size-btn');\n \n for ( var i = 0; i < b.length; i++ ) {\n b[i].classList.remove( 'selected' );\n \n if ( b[i].innerHTML == wptbSize[1] ) {\n b[i].classList.add( 'selected' );\n }\n }\n }\n \n if( affectedEl ) {\n wptbButtonWrapper = affectedEl.getElementsByClassName( 'wptb-button-wrapper' );\n \n wptbButtonA = affectedEl.getElementsByTagName( 'a' );\n \n wptbButton = affectedEl.getElementsByClassName( 'wptb-button' );\n }\n \n if ( wptbButtonWrapper ) {\n let buttonAlignment = wptbButtonWrapper[0].style.justifyContent,\n buttonAlignmentSelect = prop.querySelector( 'select[data-type=\"button-alignment\"]' ),\n selectOption = buttonAlignmentSelect.getElementsByTagName( 'option' ),\n selectOptionVal;\n \n if ( buttonAlignment == 'flex-start' ) {\n selectOptionVal = 'left';\n } else if ( buttonAlignment == 'center' || ! buttonAlignment ) {\n selectOptionVal = 'center';\n } else if ( buttonAlignment == 'flex-end' ) {\n selectOptionVal = 'right';\n }\n \n for ( let i = 0; i < selectOption.length; i++ ) {\n if ( selectOption[i].value == selectOptionVal ) {\n selectOption[i].selected = true;\n }\n }\n }\n \n if ( wptbButtonA.length > 0 ) {\n let buttonHref = wptbButtonA[0].getAttribute( 'href' ), \n buttonLinkTarget = wptbButtonA[0].getAttribute( 'target' ),\n buttonId = wptbButtonA[0].getAttribute( 'id' ),\n \n \n buttonHrefInput = prop.querySelector( 'input[data-type=\"button-link\"]' ),\n buttonLinkTargetInput = prop.querySelector( 'input[data-type=\"button-link-target\"]' ),\n buttonLinkTargetInputId = buttonLinkTargetInput.getAttribute( 'id' ),\n buttonLinkTargetInputLabel = buttonLinkTargetInput.parentNode.getElementsByTagName( 'label' )[0],\n \n buttotIdInput = prop.querySelector( 'input[data-type=\"button-id\"]' );\n\n buttonLinkTargetInputId = buttonLinkTargetInputId + '-' + kindIndexProt.split( '-' )[1];\n buttonLinkTargetInput.setAttribute( 'id', buttonLinkTargetInputId );\n buttonLinkTargetInputLabel.setAttribute( 'for', buttonLinkTargetInputId );\n\n buttonHrefInput.value = buttonHref;\n\n if( buttonLinkTarget && buttonLinkTarget == '_blank') {\n buttonLinkTargetInput.checked = true;\n }\n \n buttotIdInput.value = buttonId;\n }\n \n if( wptbButton ) {\n let buttonTextColor = wptbButton[0].style.color,\n buttonColor = wptbButton[0].style.backgroundColor,\n buttonTextColorInput = prop.querySelector( 'input[data-type=\"button-text-color\"]' ),\n buttonBackgroundColorInput = prop.querySelector( 'input[data-type=\"button-color\"]' );\n \n \n buttonTextColorInput.value = WPTB_Helper.rgbToHex( buttonTextColor );\n \n buttonBackgroundColorInput.value = WPTB_Helper.rgbToHex( buttonColor );\n \n }\n } else if ( element.kind == 'image' ) {\n let affectedEl = document.getElementsByClassName( 'wptb-element-' + kindIndexProt );\n if ( affectedEl.length > 0 ) {\n let elementsA = affectedEl[0].getElementsByTagName( 'a' );\n if ( elementsA.length > 0 ) {\n let a = elementsA[0];\n\n if ( a ) {\n a.onclick = function( e ) {\n e.preventDefault();\n }\n // set select according to the alignment of the image\n let aTextAlign = a.style.textAlign,\n imageAlignmentSelect = prop.querySelector( 'select[data-type=\"image-alignment\"]' ),\n selectOption = imageAlignmentSelect.getElementsByTagName( 'option' );\n\n for ( let i = 0; i < selectOption.length; i++ ) {\n if ( selectOption[i].value == aTextAlign ) {\n selectOption[i].selected = true;\n }\n }\n\n // set text link for input field of setting panel\n let imageLinkHref = a.getAttribute( 'href' ),\n inputImageLink = prop.querySelector( 'input[data-type=\"image-link\"]' );\n if ( imageLinkHref ) {\n inputImageLink.value = imageLinkHref;\n }\n\n // set checkbox for target of link \n let imageLinkTarget = a.getAttribute( 'target' ),\n imageLinkTargetInput = prop.querySelector( 'input[data-type=\"image-link-target\"]' ),\n imageLinkTargetInputId = imageLinkTargetInput.getAttribute( 'id' ),\n imageLinkTargetInputLabel = imageLinkTargetInput.parentNode.getElementsByTagName( 'label' )[0];\n\n imageLinkTargetInputId = imageLinkTargetInputId + '-' + kindIndexProt.split( '-' )[1];\n\n imageLinkTargetInput.setAttribute( 'id', imageLinkTargetInputId );\n imageLinkTargetInputLabel.setAttribute( 'for', imageLinkTargetInputId );\n\n if ( imageLinkTarget && imageLinkTarget == '_blank' ) {\n imageLinkTargetInput.checked = true;\n }\n\n let img = a.getElementsByTagName( 'img' );\n if ( img.length > 0 ) {\n // set value for input fields of image size\n let imgWidth = img[0].style.width;\n if ( imgWidth ) {\n let imageWidthInputRange = prop.querySelector( 'input[type=\"range\"][data-type=\"image-size\"]' ),\n imageWidthInputNumber = prop.querySelector( 'input[type=\"number\"][data-type=\"image-size\"]' );\n\n imageWidthInputRange.value = parseInt( imgWidth );\n imageWidthInputNumber.value = parseInt( imgWidth );\n }\n\n // set value for input field of alternative text image\n let imgAlternativeText = img[0].getAttribute('alt'),\n imageAlternativeTextInput = prop.querySelector( 'input[type=\"text\"][data-type=\"alternative-text\"]' );\n\n imageAlternativeTextInput.value = imgAlternativeText;\n }\n }\n }\n }\n } else if ( element.kind == 'text' ) {\n let affectedEl = document.getElementsByClassName( 'wptb-element-' + kindIndexProt );\n if ( affectedEl.length > 0 ) {\n let elementFontSize = affectedEl[0].style.fontSize,\n elementTextColor = affectedEl[0].style.color;\n let textFontSizeInputRange = prop.querySelector( 'input[type=\"range\"][data-type=\"font-size\"]' ),\n textFontSizeInputNumber = prop.querySelector( 'input[type=\"number\"][data-type=\"font-size\"]' ),\n textColorInput = prop.querySelector( 'input[type=\"text\"][data-type=\"color\"]' );\n\n textFontSizeInputRange.value = parseInt( elementFontSize );\n textFontSizeInputNumber.value = parseInt( elementFontSize );\n textColorInput.value = WPTB_Helper.rgbToHex( elementTextColor );\n }\n } else if ( element.kind == 'list' ) {\n let elementList = document.getElementsByClassName( 'wptb-element-' + kindIndexProt );\n if ( elementList.length > 0 ) {\n let elementListColor = elementList[0].querySelector( 'p' ).style.color;\n let listColorInput = prop.querySelector( 'input[type=\"text\"][data-type=\"list-text-color\"]' );\n listColorInput.value = WPTB_Helper.rgbToHex( elementListColor );\n \n let elementListItem = elementList[0].querySelectorAll( 'li' );\n if ( elementListItem.length > 0 ) {\n let listItemP = elementListItem[0].querySelector( 'p' );\n let listItemPClasses = listItemP.classList;\n //listItemPClasses = [...listItemPClasses];\n if ( listItemPClasses.length > 0 ) {\n let elementListClassSelect = prop.querySelector( 'select[data-type=\"list-class\"]' );\n if ( elementListClassSelect ) {\n elementListClassSelect.value = 'unordered';\n \n let listIconSelectLabel = elementListClassSelect.parentNode.nextSibling;\n for ( let i = 0; i < 10; i++ ) {\n if ( listIconSelectLabel.nodeType == '1' ) {\n break;\n } else {\n listIconSelectLabel = listIconSelectLabel.nextSibling;\n }\n }\n if ( listIconSelectLabel ) {\n let listIconSelectLabelId = listIconSelectLabel.getAttribute( 'id' );\n listIconSelectLabel.setAttribute( 'id', listIconSelectLabelId + '-' + kindIndexProt );\n listIconSelectLabel.style.display = 'flex';\n }\n \n let elementListStyleTypeSelect = prop.querySelector( 'select[data-type=\"list-style-type\"]' );\n if ( elementListStyleTypeSelect ) {\n elementListStyleTypeSelect.parentNode.style.display = 'flex';\n \n if( listItemPClasses.contains( 'wptb-list-style-type-disc' ) ) {\n elementListStyleTypeSelect.value = 'disc';\n } else if( listItemPClasses.contains( 'wptb-list-style-type-circle' ) ) {\n elementListStyleTypeSelect.value = 'circle';\n } else if( listItemPClasses.contains( 'wptb-list-style-type-square' ) ) {\n elementListStyleTypeSelect.value = 'square';\n } else if ( listItemPClasses.contains( 'wptb-list-style-type-none' ) ) {\n elementListStyleTypeSelect.value = 'none';\n }\n }\n }\n }\n }\n \n let elementListItemContent = elementList[0].getElementsByClassName( 'wptb-list-item-content' );\n if ( elementListItemContent.length > 0 ) {\n let listItemPTextAlignArr = [];\n for ( let i = 0; i < elementListItemContent.length; i++ ) {\n let p = elementListItemContent[i].querySelector( 'p' );\n if ( p ) {\n if ( p.style.textAlign ) {\n listItemPTextAlignArr.push( p.style.textAlign );\n } else {\n listItemPTextAlignArr.push( 'left' );\n }\n }\n \n }\n \n let listItemPTextAlignLeftCount = 0,\n listItemPTextAlignCenterCount = 0,\n listItemPTextAlignRightCount = 0;\n \n if ( listItemPTextAlignArr.length > 0 ) {\n for ( let i = 0; i < listItemPTextAlignArr.length; i++ ) {\n if ( listItemPTextAlignArr[i] ) {\n if ( listItemPTextAlignArr[i] == 'left' ) {\n listItemPTextAlignLeftCount++;\n } else if ( listItemPTextAlignArr[i] == 'center' ) {\n listItemPTextAlignCenterCount++;\n } else if ( listItemPTextAlignArr[i] == 'right' ) {\n listItemPTextAlignRightCount++;\n }\n }\n }\n }\n \n let elementListAlignmentSelect = prop.querySelector( 'select[data-type=\"list-alignment\"]' ),\n maxListItemTAlLeftC = Math.max( listItemPTextAlignLeftCount, listItemPTextAlignCenterCount, listItemPTextAlignRightCount );\n \n if ( listItemPTextAlignLeftCount == maxListItemTAlLeftC ) {\n elementListAlignmentSelect.value = 'left';\n } else if ( listItemPTextAlignCenterCount == maxListItemTAlLeftC ) {\n elementListAlignmentSelect.value = 'center';\n } else if ( listItemPTextAlignRightCount == maxListItemTAlLeftC ) {\n elementListAlignmentSelect.value = 'right';\n }\n }\n } \n }\n }\n\n node.onclick = function () {\n var infArr = this.className.match(/wptb-element-((.+-)\\d+)/i),\n optionsClass = '.wptb-' + infArr[2] + 'options' +\n '.wptb-options-' + infArr[1];\n\n document.getElementsByClassName('wptb-elements-container')[0].style.display = 'none';\n document.getElementsByClassName('wptb-settings-section')[0].style.display = 'none';\n document.getElementById(\"element-options-group\").style.display = 'block';\n\n var children = document.getElementById(\"element-options-group\").childNodes;\n for (var i = 0; i < children.length; i++) {\n if (children[i].style)\n children[i].style.display = 'none';\n }\n\n document.querySelector(optionsClass).style.display = 'block';\n\n //var listStyleType, textAlign;\n\n// switch (element.kind) {\n\n// case 'text':\n// jQuery(prop).find('[data-type=color]').wpColorPicker({ defaultColor: node.style.color });\n// prop.querySelector('[type=number][data-type=font-size]').value\n// = prop.querySelector('[type=range][data-type=font-size]').value\n// = node.style.fontSize.substring(0, node.style.fontSize.length - 2);\n// break;\n// case 'list':\n// textAlign = node.querySelector('li p').style.textAlign;\n// listStyleType = node.querySelector('li').style.listStyleType;\n// if ( prop.querySelector( 'select[data-type=list-class]' ) ) {\n// console.log(textAlign);\n// console.log(listStyleType);\n// console.log(listStyleType);\n// console.log(prop);\n// prop.querySelector('select[data-type=list-class]').selectedIndex = ( listStyleType == 'decimal' ? 0 : 1 );\n// }\n// if ( prop.querySelector('select[data-type=list-style-type]') ) {\n// prop.querySelector('select[data-type=list-style-type]').selectedIndex = (listStyleType == 'circle' ? 0 : (listStyleType == 'square' ? 1 : 2));\n// }\n// if ( prop.querySelector('select[data-type=list-alignment]') ) {\n// prop.querySelector('select[data-type=list-alignment]').selectedIndex = (textAlign == 'left' ? 0 : (textAlign == 'center' ? 1 : 2));\n// }\n// break;\n// case 'image':\n// break;\n// case 'button':\n// jQuery(prop).find('[data-type=button-color]').wpColorPicker({ defaultColor: node.style.backgroundColor });\n// break;\n//\n// }\n };\n\n if (element.kind == 'button') {\n //We must add this special kind of property, since it is triggered with click event\n var buttons = prop.getElementsByClassName('wptb-btn-size-btn');\n\n for (var i = 0; i < buttons.length; i++) {\n buttons[i].onclick = function () {\n var size = this.innerHTML,\n n_Class = this.dataset.element,\n infArr = n_Class.match(/wptb-options-(.+)-(\\d+)/i),\n type = infArr[1],\n num = infArr[2],\n affectedEl = document.getElementsByClassName('wptb-element-' + type + '-' + num)[0];\n affectedEl.classList.remove('wptb-size-S');\n affectedEl.classList.remove('wptb-size-M');\n affectedEl.classList.remove('wptb-size-L');\n affectedEl.classList.remove('wptb-size-XL');\n affectedEl.classList.add('wptb-size-' + size);\n var b = this.parentNode.getElementsByClassName('wptb-btn-size-btn');\n for (var i = 0; i < b.length; i++) {\n b[i].classList.remove('selected');\n }\n this.classList.add('selected');\n }\n }\n }\n\n var optionControls = prop.getElementsByClassName('wptb-element-property');\n\n for (var i = 0; i < optionControls.length; i++) {\n if (optionControls[i].classList.contains('wptb-color-picker')) {\n jQuery(optionControls[i]).wpColorPicker({\n change: function (event, ui) {\n var parent = event.target, classe, type, ps, number;\n classe = parent.dataset.element.match(/wptb-options-(.+)-(\\d+)/i);\n type = classe[1];\n number = classe[2];\n 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 = ui.color.toString();\n } else {\n affectedEl.getElementsByClassName('wptb-button')[0].style.backgroundColor = ui.color.toString();\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 = ui.color.toString();\n }\n }\n } else {\n affectedEl.style.color = ui.color.toString();\n }\n }\n });\n }\n\n if (optionControls[i].dataset.type === 'font-size') {\n var slider = optionControls[i].parentNode.parentNode.getElementsByClassName('wptb-text-font-size-slider')[0];\n slider.oninput = function () {\n this.parentNode.parentNode.getElementsByClassName('wptb-text-font-size-number')[0].value = this.value;\n this.parentNode.parentNode.getElementsByClassName('wptb-text-font-size-number')[0].onchange();\n }\n }\n\n if (optionControls[i].dataset.type === 'image-size') {\n var slider = optionControls[i].parentNode.parentNode.getElementsByClassName('wptb-image-size-slider')[0];\n slider.oninput = function () {\n this.parentNode.parentNode.getElementsByClassName('wptb-image-width-number')[0].value = this.value;\n this.parentNode.parentNode.getElementsByClassName('wptb-image-width-number')[0].onchange();\n }\n }\n\n optionControls[i].onchange = function (event) {\n\n var n_Class = this.dataset.element,\n infArr = n_Class.match(/wptb-options-(.+)-(\\d+)/i),\n type = infArr[1],\n num = infArr[2],\n affectedEl = document.getElementsByClassName('wptb-element-' + type + '-' + num)[0],\n val = this.value;\n\n switch (this.dataset.type) {\n case 'src':\n var img = affectedEl.getElementsByTagName(\"img\")[0];\n img.src = this.value;\n break;\n case 'alternative-text':\n var img = affectedEl.getElementsByTagName('img')[0];\n img.alt = this.value;\n break;\n case 'image-link':\n affectedEl.getElementsByTagName('a')[0].href = WPTB_Helper.linkHttpCheckChange( this.value );\n break;\n case 'image-link-target':\n if (this.checked == true) {\n affectedEl.getElementsByTagName('a')[0].target = '_blank';\n } else {\n affectedEl.getElementsByTagName('a')[0].target = '_self';\n }\n break;\n case 'image-link-nofollow':\n if (this.checked == true) {\n affectedEl.getElementsByTagName('a')[0].rel = 'nofollow';\n } else {\n affectedEl.getElementsByTagName('a')[0].removeAttribute('rel');\n }\n break;\n case 'image-size':\n affectedEl.getElementsByTagName('a')[0].style.width = this.value + '%';\n affectedEl.getElementsByTagName('a')[0].style.height = 'auto';\n this.parentNode.parentNode.getElementsByClassName('wptb-image-size-slider')[0].value = this.value;\n break;\n case 'image-alignment':\n affectedEl.getElementsByClassName( 'wptb-image-wrapper' )[0].style.textAlign = this.value;\n break;\n case 'font-size':\n affectedEl.style.fontSize = val + 'px';\n break;\n case 'button-alignment':\n var jc = '';\n if (this.value == 'left') {\n jc = 'start';\n } else if (this.value == 'right') {\n jc = 'flex-end';\n } else {\n jc = 'center';\n }\n affectedEl.getElementsByClassName('wptb-button-wrapper')[0].style.justifyContent = jc;\n break;\n case 'button-link':\n if ( this.value ) {\n affectedEl.getElementsByTagName( 'a' )[0].href = WPTB_Helper.linkHttpCheckChange( this.value );\n } else {\n affectedEl.getElementsByTagName( 'a' )[0].removeAttribute( 'href' );\n }\n break;\n case 'button-link-target':\n if (this.checked == true) {\n affectedEl.getElementsByTagName('a')[0].target = '_blank';\n } else {\n affectedEl.getElementsByTagName('a')[0].target = '_self';\n }\n break;\n case 'button-link-nofollow':\n if (this.checked == true) {\n affectedEl.getElementsByTagName('a')[0].rel = 'nofollow';\n } else {\n affectedEl.getElementsByTagName('a')[0].removeAttribute( 'rel' );\n }\n break;\n case 'button-id':\n if( this.value ) {\n affectedEl.getElementsByTagName( 'a' )[0].id = this.value;\n } else {\n affectedEl.getElementsByTagName( 'a' )[0].removeAttribute( 'id' );\n }\n case 'button-color':\n break;\n case 'list-alignment':\n let listItems = affectedEl.querySelectorAll('li');\n for (var i = 0; i < listItems.length; i++) {\n let p = listItems[i].querySelector( 'p' );\n if ( p ) {\n p.style.textAlign = this.value;\n }\n }\n break;\n case 'list-class':\n let parentNode = event.target\n .parentNode\n .parentNode\n .querySelector('[data-type=list-style-type]')\n .parentNode,\n parentNodeSettingItem = parentNode.parentNode;\n if (val == 'unordered') {\n parentNode.style.display = 'flex';\n \n parentNodeSettingItem.querySelector( '.wptb-list-icon-select-label' ).style.display = 'flex';\n let listItem = affectedEl.querySelectorAll('li');\n for (var i = 0; i < listItem.length; i++) {\n let p = listItem[i].querySelector( 'p' );\n p.removeAttribute ( 'class' );\n p.classList.add( 'wptb-list-style-type-disc' );\n }\n parentNodeSettingItem.querySelector('[data-type=list-style-type]').value = 'disc';\n } else {\n parentNode.style.display = 'none';\n parentNodeSettingItem.querySelector( '.wptb-list-icon-select-label' ).style.display = 'none';\n var listItem = affectedEl.querySelectorAll('li');\n for (var i = 0; i < listItem.length; i++) {\n let p = listItem[i].querySelector( 'p' );\n p.removeAttribute ( 'class' );\n }\n }\n break;\n case 'list-style-type':\n var listItem = affectedEl.querySelectorAll('li');\n for (var i = 0; i < listItem.length; i++) {\n let p = listItem[i].querySelector( 'p' );\n p.removeAttribute ( 'class' );\n p.classList.add( 'wptb-list-style-type-' + val.toLowerCase() );\n }\n break;\n }\n }\n }\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 var rgb = rgb.match( /^rgba?[\\s+]?\\([\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?/i );\n\n return ( rgb && rgb.length === 4 ) ? \"#\" +\n ( \"0\" + parseInt( rgb[1],10 ).toString( 16 )).slice( -2 ) +\n ( \"0\" + parseInt( rgb[2],10 ).toString( 16 )).slice( -2 ) +\n ( \"0\" + parseInt( rgb[3],10 ).toString( 16 )).slice( -2 ) : '';\n },\n getDragImageCustom: function ( type ) {\n let hostName = location.protocol + '//' + location.hostname;\n let img = document.createElement( 'img' );\n img.src = hostName + '/wp-content/plugins/wp-table-builder/inc/admin/views/builder/icons/' + type + '.png';\n return img;\n },\n dragImagesArr: function() {\n return {\n text: WPTB_Helper.getDragImageCustom( 'text' ),\n image: WPTB_Helper.getDragImageCustom( 'image' ),\n button: WPTB_Helper.getDragImageCustom( 'button' ),\n list: WPTB_Helper.getDragImageCustom( 'list' )\n };\n },\n listItemsRecalculateIndex: function( ulElem ) {\n let par = ulElem.querySelectorAll( 'p' );\n if ( par.length > 0 ) {\n for ( let i = 0; i < par.length; i++ ) {\n par[i].dataset.listStyleTypeIndex = Number( i ) + 1 + '.';\n }\n }\n },\n listItemsTinyMceInit: function( listItem ) {\n tinyMCE.init({\n target: listItem,\n inline: true,\n plugins: \"link, paste\",\n dialog_type: \"modal\",\n theme: 'modern',\n menubar: false,\n fixed_toolbar_container: '#wpcd_fixed_toolbar',\n paste_as_text: true,\n toolbar: 'bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify',\n setup: function(ed) {\n ed.on('keydown', function(e) {\n let article = e.target.parentNode;\n if ( e.keyCode == 13 ) {\n e.preventDefault();\n let text = e.target.innerHTML;\n let duplicate = new WPTB_ListItem( text, article, true );\n \n article.parentNode.insertBefore( duplicate.getDOMElement(), article );\n WPTB_Helper.listItemsTinyMceInit( duplicate.getDOMElement().firstChild );\n e.target.querySelector( 'p' ).innerText = 'New List Item';\n //tinyMCE.execCommand('mceInsertContent', false, 'New List Item');\n WPTB_Helper.listItemsRecalculateIndex( article.parentNode );\n \n } else if ( e.keyCode == '8' || e.keyCode == '46' ) {\n let p = e.target.querySelector( 'p' );\n let pText = p.innerHTML.replace(/<[^>]+>/g, '');\n pText = pText.replace( /\\s+/g, ' ' ).trim();\n pText = pText.replace( / /g, '').trim();\n \n if( pText == '' ) {\n e.preventDefault();\n e.target.querySelector( 'p' ).innerText = '\\n';\n } else {\n let selectedText = WPTB_Helper.getSelectionText();\n selectedText = selectedText.replace( /\\s+/g, ' ' ).trim();\n selectedText = selectedText.replace( / /g, '' ).trim();\n if( selectedText == pText ) {\n e.preventDefault();\n e.target.querySelector( 'p' ).innerText = '\\n';\n }\n }\n }\n });\n \n ed.on( 'keyup', function( e ) {\n \n });\n },\n init_instance_callback: function (editor) {\n window.currentEditor = editor;\n editor.on('focus', function (e) {\n var totalWidth = document.getElementsByClassName('wptb-builder-panel')[0].offsetWidth;\n if (window.currentEditor &&\n document.getElementById('wptb_builder').scrollTop >= 55 &&\n window.currentEditor.bodyElement.style.display != 'none') {\n document.getElementById('wpcd_fixed_toolbar').style.position = 'fixed';\n document.getElementById('wpcd_fixed_toolbar').style.right = (totalWidth / 2 - document.getElementById('wpcd_fixed_toolbar').offsetWidth / 2) + 'px';\n document.getElementById('wpcd_fixed_toolbar').style.top = '100px';\n } else {\n document.getElementById('wpcd_fixed_toolbar').style.position = 'static';\n delete document.getElementById('wpcd_fixed_toolbar').style.right;\n delete document.getElementById('wpcd_fixed_toolbar').style.top;\n }\n });\n }\n });\n },\n buttonsTinyMceInit: function( target ) {\n tinyMCE.init({\n target: target,\n inline: true,\n plugins: \"link\",\n dialog_type: \"modal\",\n theme: 'modern',\n menubar: false,\n fixed_toolbar_container: '#wpcd_fixed_toolbar',\n toolbar: 'bold italic strikethrough',\n setup : function(ed) {\n ed.on('keydown', function(e) {\n if (e.keyCode == 13) {\n e.preventDefault();\n }\n });\n },\n init_instance_callback: function (editor) {\n window.currentEditor = editor;\n editor.on('focus', function (e) {\n var totalWidth = document.getElementsByClassName('wptb-builder-panel')[0].offsetWidth;\n if (window.currentEditor &&\n document.getElementById('wptb_builder').scrollTop >= 55 &&\n window.currentEditor.bodyElement.style.display != 'none') {\n document.getElementById('wpcd_fixed_toolbar').style.position = 'fixed';\n document.getElementById('wpcd_fixed_toolbar').style.right = (totalWidth / 2 - document.getElementById('wpcd_fixed_toolbar').offsetWidth / 2) + 'px';\n document.getElementById('wpcd_fixed_toolbar').style.top = '100px';\n } else {\n document.getElementById('wpcd_fixed_toolbar').style.position = 'static';\n delete document.getElementById('wpcd_fixed_toolbar').style.right;\n delete document.getElementById('wpcd_fixed_toolbar').style.top;\n }\n });\n }\n });\n },\n linkHttpCheckChange: function( link ) {\n if ( link ) {\n 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 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 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 settingsPanelClear: function() {\n document.getElementById( 'wptb-top-row-as-header' ).checked = false;\n document.getElementById( 'wptb-table-border-slider' ).value = 0;\n document.getElementById( 'wptb-table-border-number' ).value = 0;\n document.getElementById( 'wptb-inner-border-check' ).checked = false;\n document.getElementById( 'wptb-apply-inner-border' ).classList.remove( 'visible' );\n document.getElementById( 'wptb-table-inner-border-slider' ).value = 1;\n document.getElementById( 'wptb-table-inner-border-number' ).value = 1;\n \n WPTB_Helper.wpColorPickerClear( 'wptb-table-border-color' );\n \n WPTB_Helper.wpColorPickerClear( 'wptb-table-header-bg' );\n \n WPTB_Helper.wpColorPickerClear( 'wptb-even-row-bg' );\n \n WPTB_Helper.wpColorPickerClear( 'wptb-odd-row-bg' );\n \n document.getElementById( 'wptb-table-cell-slider' ).value = 15;\n document.getElementById( 'wptb-table-cell-number' ).value = 15;\n },\n wpColorPickerClear: function( inputId ) {\n let input = document.getElementById( inputId );\n let wpPickerContainer = WPTB_Helper.findAncestor( input, 'wp-picker-container' );\n let parent = wpPickerContainer.parentNode;\n parent.removeChild( wpPickerContainer );\n let newInput = document.createElement( 'input' );\n newInput.setAttribute( 'id', inputId );\n newInput.value = \"\";\n parent.appendChild( newInput );\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}\n","var WPTB_Image = function ( src, DOMElementProt ) {\n let DOMElement,\n elImage,\n kindIndexProt = undefined,\n copy = false;\n if ( DOMElementProt == undefined ) {\n DOMElement = document.createElement( 'div' );\n elImage = document.createElement( 'div' );\n\t let anchor = document.createElement( 'a' ),\n\t img = document.createElement( 'img' );\n anchor.style.display = 'inline-block';\n anchor.appendChild( img );\n DOMElement.classList.add( 'wptb-image-container' );\n elImage.classList.add( 'wptb-image-wrapper' );\n elImage.appendChild( anchor );\n DOMElement.appendChild( elImage );\n \n anchor.onclick = function( e ) {\n e.preventDefault();\n }\n \n file_frame = wp.media.frames.file_frame = wp.media({\n\t\ttitle: 'Select a image to upload',\n\t\tbutton: {\n\t\t\ttext: 'Use this image'\n\t\t},\n\t\tmultiple: false\n });\n // When an image is selected, run a callback.\n file_frame.on('select', function () {\n attachment = file_frame.state().get('selection').first().toJSON();\n img.src = attachment.url;\n });\n // Finally, open the modal\n if (src == undefined) {\n file_frame.open();\n } else {\n img.src = src;\n }\n } else {\n DOMElement = DOMElementProt.cloneNode( true );\n \n DOMElement.getElementsByTagName( 'a' )[0].onclick = function(e) {\n e.preventDefault();\n };\n \n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\n kindIndexProt = wptbElementMutch[1];\n copy = true;\n };\n }\n \n this.kind = 'image';\n this.getDOMElement = function () {\n return DOMElement;\n };\n\tapplyGenericItemSettings( this, kindIndexProt, copy );\n\n\treturn this;\n};","var WPTB_Initializer = function () {\n\n const MIN_COLUMNS = 1,\n MIN_ROWS = 1,\n MAX_COLUMNS = 10,\n MAX_ROWS = 10;\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 WPTB_Table(columns, rows);\n }\n \n// if( document.getElementsByClassName( 'wptb-preview-table' ).length == 0 ) {\n// WPTB_LeftPanel();\n// }\n\n};\n","var WPTB_LeftPanel = function () {\n\n var table = document.getElementsByClassName('wptb-preview-table')[0],\n wptbElementButtons = document.getElementsByClassName('wptb-element');\n \n function wptbTdBgColorSavedSet( inputId, trNumber ) {\n if ( trNumber > 3 ) return;\n if( table ) {\n let tableRows = table.getElementsByTagName('tr');\n if ( tableRows.length > trNumber ) {\n let trBackgroundColor = tableRows[trNumber].style.backgroundColor;\n var wptbEvenRowBg = document.getElementById(inputId);\n if ( wptbEvenRowBg && trBackgroundColor ) {\n wptbEvenRowBg.value = WPTB_Helper.rgbToHex( trBackgroundColor );\n }\n }\n }\n \n }\n \n wptbTdBgColorSavedSet( 'wptb-even-row-bg', 1 );\n jQuery('#wptb-even-row-bg').wpColorPicker({\n change: function ( event, ui ) {\n var tableRows = table.getElementsByTagName('tr');\n for ( let i = 1; i < tableRows.length; i += 2 ) {\n tableRows[i].style.backgroundColor = ui.color.toString();\n }\n },\n clear: function(){\n var tableRows = table.getElementsByTagName('tr');\n for ( let i = 1; i < tableRows.length; i += 2 ) {\n tableRows[i].style.backgroundColor = '';\n let tds = tableRows[i].getElementsByTagName('td');\n for ( let j = 0; j < tds.length; j++ ) {\n tds[j].style.backgroundColor = '';\n }\n }\n },\n\n });\n \n wptbTdBgColorSavedSet( 'wptb-odd-row-bg', 2 );\n jQuery('#wptb-odd-row-bg').wpColorPicker({\n change: function ( event, ui ) {\n var tableRows = table.getElementsByTagName('tr');\n for ( let i = 2; i < tableRows.length; i += 2 ) {\n tableRows[i].style.backgroundColor = ui.color.toString();\n }\n },\n clear: function(){\n var tableRows = table.getElementsByTagName('tr');\n for ( let i = 2; i < tableRows.length; i += 2 ) {\n tableRows[i].style.backgroundColor = '';\n let tds = tableRows[i].getElementsByTagName( 'td' );\n for ( var j = 0; j < tds.length; j++ ) {\n tds[j].style.backgroundColor = '';\n }\n }\n },\n });\n \n wptbTdBgColorSavedSet( 'wptb-table-header-bg', 0 );\n jQuery('#wptb-table-header-bg').wpColorPicker({\n change: function (event, ui) {\n var tableHeader = table.getElementsByTagName('tr')[0];\n tableHeader.style.backgroundColor = ui.color.toString();\n },\n clear: function(){\n var tableHeader = table.getElementsByTagName('tr')[0];\n tableHeader.style.backgroundColor = '';\n let tds = tableHeader.getElementsByTagName('td');\n for (var j = 0; j < tds.length; j++) {\n tds[j].style.backgroundColor = '';\n }\n },\n });\n \n function tableTopRowAsHeadSavedSet( table ) {\n let wptbTopRowAsHeader = document.getElementById( 'wptb-top-row-as-header' );\n \n if( table && table.classList.contains( 'wptb-table-preview-head' ) ) {\n wptbTopRowAsHeader.checked = true;\n } else {\n wptbTopRowAsHeader.checked = false;\n }\n }\n tableTopRowAsHeadSavedSet( table );\n \n function tableBorderColorWidthSavedSet() {\n let table = document.getElementsByClassName('wptb-preview-table');\n if ( table.length > 0 ) {\n let tableBorderColor = table[0].style.borderColor;\n if ( tableBorderColor ) {\n let tableBorderColorInput = document.getElementById( 'wptb-table-border-color' );\n if ( tableBorderColorInput ) {\n tableBorderColorInput.value = WPTB_Helper.rgbToHex( tableBorderColor );\n }\n }\n \n let tableBorderWidth = table[0].style.borderWidth;\n if ( tableBorderWidth ) {\n let wptbTableBorderWidthSlider = document.getElementById('wptb-table-border-slider'),\n wptbTableBorderWidthNumber = document.getElementById('wptb-table-border-number');\n \n if ( wptbTableBorderWidthSlider ) {\n wptbTableBorderWidthSlider.value = parseInt( tableBorderWidth );\n }\n if ( wptbTableBorderWidthNumber ) {\n wptbTableBorderWidthNumber.value = parseInt( tableBorderWidth );\n }\n }\n \n \n let tableTd = table[0].querySelector( 'td' );\n let applyInnerBorder = tableTd.style.borderWidth;\n if ( applyInnerBorder ) {\n let innerBorderCheckInput = document.getElementById( 'wptb-inner-border-check' );\n let wptbApplyInnerBorder = document.getElementById( 'wptb-apply-inner-border' );\n if ( applyInnerBorder && parseInt( applyInnerBorder ) > 0 ) {\n if ( innerBorderCheckInput ) {\n innerBorderCheckInput.checked = true;\n \n if ( wptbApplyInnerBorder ) {\n wptbApplyInnerBorder.classList.add( 'visible' );\n let wptbTableInnerBorderSlider = document.getElementById( 'wptb-table-inner-border-slider' );\n let wptbTableInnerBorderNumber = document.getElementById( 'wptb-table-inner-border-number' );\n wptbTableInnerBorderSlider.value = parseInt( applyInnerBorder );\n wptbTableInnerBorderNumber.value = parseInt( applyInnerBorder );\n }\n }\n } else {\n innerBorderCheckInput.checked = false;\n }\n }\n \n if ( ( tableBorderWidth && parseInt( tableBorderWidth ) > 0 ) || ( applyInnerBorder && parseInt( applyInnerBorder ) > 0 ) ) {\n document.getElementById( 'wptb-table-border-color-set-area' ).style.display = '';\n }\n }\n }\n \n tableBorderColorWidthSavedSet();\n\n jQuery('#wptb-table-border-color').wpColorPicker({\n change: function (event, ui) {\n var tableCells = table.getElementsByTagName('td');\n table.style.border = document.querySelector('#wptb-table-border-number').value + 'px solid ' + ui.color.toString();\n\n for (var i = 0; i < tableCells.length; i++) {\n let tableInnerborderNumber = document.querySelector('#wptb-table-inner-border-number').value;\n if ( document.getElementById('wptb-inner-border-check').checked ) {\n tableCells[i].style.border = ( tableInnerborderNumber != 0 ? tableInnerborderNumber : 1 ) + 'px solid ' + ui.color.toString();\n }\n }\n },\n clear: function() {\n var tableCells = table.getElementsByTagName('td');\n table.style.borderColor = '';\n\n for (var i = 0; i < tableCells.length; i++) {\n tableCells[i].style.borderColor = '';\n }\n }\n });\n\n function addInnerBorderSize(value) {\n var tableCells = table.getElementsByTagName('td');\n for (var i = 0; i < tableCells.length; i++) {\n tableCells[i].style.borderWidth = document.querySelector('#wptb-table-inner-border-number').value + 'px';\n tableCells[i].style.borderStyle = 'solid';\n }\n }\n\n function addCellPadding(value) {\n var tableCells = table.getElementsByTagName('td');\n for (var i = 0; i < tableCells.length; i++) {\n tableCells[i].style.padding = value + 'px';\n }\n }\n\n function addInnerBorder( checked ) {\n var styles, color = document.querySelector('#wptb-table-border-color').value != undefined ?\n document.querySelector('#wptb-table-border-color').value : 'rgb(0,0,0)';\n if ( document.querySelector( '#wptb-table-inner-border-slider' ).value == 0 || document.querySelector( '#wptb-table-inner-border-number' ).value == 0 ) {\n document.querySelector( '#wptb-table-inner-border-slider' ).value = 1;\n document.querySelector( '#wptb-table-inner-border-number' ).value = 1;\n }\n let width = document.querySelector( '#wptb-table-inner-border-slider' ).value + 'px';\n let wptbPreviewTable = document.getElementsByClassName('wptb-preview-table');\n if( wptbPreviewTable.length > 0 ) {\n if (checked == 'checked') {\n document.getElementById('wptb-apply-inner-border').style.marginBottom = '0px';\n var tableCells = wptbPreviewTable[0].getElementsByTagName( 'td' );\n for (var i = 0; i < tableCells.length; i++) {\n tableCells[i].style.border = width + ' solid ' + color;\n }\n document.getElementById( 'wptb-apply-inner-border' ).classList.add( 'visible' );\n } else {\n document.getElementById( 'wptb-apply-inner-border' ).classList.remove( 'visible' );\n var tableCells = wptbPreviewTable[0].getElementsByTagName( 'td' );\n for (var i = 0; i < tableCells.length; i++) {\n tableCells[i].style.border = '0px solid ' + color;\n tableCells[i].style.border = null;\n }\n }\n }\n \n }\n\n function addBorderSize( value ) {\n table.style.borderWidth = value + 'px';\n table.style.borderStyle = 'solid';\n }\n \n function cellPaddingSavedSet() {\n let table = document.getElementsByClassName('wptb-preview-table');\n \n if ( table.length > 0 ) {\n let td = table[0].querySelector( 'td' );\n \n if ( td ) {\n let padding = td.style.padding;\n \n if ( padding ) {\n let wptbTableCellSlider = document.getElementById('wptb-table-cell-slider'),\n wptbTableCellNumber = document.getElementById('wptb-table-cell-number');\n \n if ( wptbTableCellSlider ) {\n wptbTableCellSlider.value = parseInt( padding );\n }\n if ( wptbTableCellNumber ) {\n wptbTableCellNumber.value = parseInt( padding );\n }\n }\n }\n }\n }\n \n cellPaddingSavedSet();\n \n function numberImputSize( 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 thisValue = String( thisValue );\n if ( thisValue > maxValue ) {\n this.value = maxValue;\n }\n }\n }\n \n let wptbTableBorderNumber = document.getElementById( 'wptb-table-border-number' );\n numberImputSize( wptbTableBorderNumber, 1, 50 );\n \n let wptbTableInnerBorderNumber = document.getElementById( 'wptb-table-inner-border-number' );\n numberImputSize( wptbTableInnerBorderNumber, 1, 50 );\n \n let wptbTableCellNumber = document.getElementById( 'wptb-table-cell-number' );\n numberImputSize( wptbTableCellNumber, 1, 50 );\n \n let wptbTextfontSizeNumber = document.getElementById( 'wptb-text-font-size-number' );\n numberImputSize( wptbTextfontSizeNumber, 1, 50 );\n \n let wptbImageWidthNumber = document.getElementById( 'wptb-image-width-number' );\n numberImputSize( wptbImageWidthNumber, 2, 100 );\n \n let wptbTableColumnWidthNumber = document.getElementById( 'wptb-table-column-width-number' );\n numberImputSize( wptbTableColumnWidthNumber, 2, 500 );\n \n let wptbTableRowHeightNumber = document.getElementById( 'wptb-table-row-height-number' );\n numberImputSize( wptbTableRowHeightNumber, 2, 200 );\n \n \n \n document.getElementById('wptb-table-cell-slider').oninput = function () {\n document.getElementById('wptb-table-cell-number').value = this.value;\n addCellPadding(this.value);\n table.tdDefaultWidth();\n };\n\n document.getElementById('wptb-table-cell-number').onchange = function () {\n document.getElementById('wptb-table-cell-slider').value = this.value;\n addCellPadding(this.value);\n table.tdDefaultWidth();\n };\n\n document.getElementById('wptb-table-border-slider').oninput = function () {\n document.getElementById('wptb-table-border-number').value = this.value;\n addBorderSize(this.value);\n table.tdDefaultWidth();\n \n let wptbInnerBorderCheck = document.getElementById('wptb-inner-border-check').checked,\n tableBorderColorSetArea = document.getElementById( 'wptb-table-border-color-set-area' );\n if ( this.value == 0 && wptbInnerBorderCheck == false ) {\n tableBorderColorSetArea.style.display = 'none';\n } else {\n tableBorderColorSetArea.style.display = '';\n }\n };\n\n document.getElementById('wptb-table-border-number').onchange = function () {\n document.getElementById('wptb-table-border-slider').value = this.value;\n addBorderSize(this.value);\n table.tdDefaultWidth();\n };\n\n document.getElementById('wptb-table-inner-border-slider').oninput = function () {\n document.getElementById('wptb-table-inner-border-number').value = this.value;\n addInnerBorderSize(this.value);\n table.tdDefaultWidth();\n };\n\n document.getElementById('wptb-table-inner-border-number').onchange = function () {\n document.getElementById('wptb-table-inner-border-slider').value = this.value;\n addInnerBorderSize(this.value);\n table.tdDefaultWidth();\n };\n\n document.getElementById('wptb-inner-border-check').onchange = function () {\n if( table ) {\n let val = this.checked ? 'checked' : 'unchecked';\n addInnerBorder( val );\n let borderWidth = document.getElementById('wptb-table-border-slider').value,\n tableBorderColorSetArea = document.getElementById( 'wptb-table-border-color-set-area' );\n if( val == 'unchecked' && borderWidth == 0 ) {\n tableBorderColorSetArea.style.display = 'none';\n } else {\n tableBorderColorSetArea.style.display = '';\n }\n }\n \n };\n \n document.getElementById( 'wptb-table-column-width-slider' ).oninput = function () {\n document.getElementById( 'wptb-table-column-width-number' ).value = this.value;\n table.addColumnWidth( this.value );\n };\n \n document.getElementById( 'wptb-table-column-width-number' ).onchange = function () {\n document.getElementById( 'wptb-table-column-width-slider' ).value = this.value;\n table.addColumnWidth( this.value );\n };\n \n document.getElementById( 'wptb-table-column-width-auto-fixed' ).onchange = function () {\n if( this.checked ) {\n let highlighted = table.querySelector( '.wptb-highlighted' );\n let width = WPTB_Helper.getColumnWidth( table, highlighted );\n table.addColumnWidth( width );\n } else {\n table.addColumnWidth( false, true );\n let highlighted = table.querySelector( '.wptb-highlighted' );\n let width = WPTB_Helper.getColumnWidth( table, highlighted );\n document.getElementById( 'wptb-table-column-width-number' ).value = width;\n document.getElementById( 'wptb-table-column-width-slider' ).value = width;\n }\n };\n\n document.getElementById( 'wptb-table-row-height-slider' ).oninput = function () {\n document.getElementById( 'wptb-table-row-height-number' ).value = this.value;\n table.addRowHeight( this.value );\n };\n\n document.getElementById( 'wptb-table-row-height-number' ).onchange = function () {\n document.getElementById( 'wptb-table-row-height-slider' ).value = this.value;\n table.addRowHeight( this.value );\n };\n \n document.getElementById( 'wptb-table-row-height-auto-fixed' ).onchange = function () {\n if( this.checked ) {\n let highlighted = table.querySelector( '.wptb-highlighted' );\n let height = WPTB_Helper.getRowHeight( table, highlighted );\n table.addRowHeight( height );\n } else {\n table.addRowHeight( false, true );\n let highlighted = table.querySelector( '.wptb-highlighted' );\n let height = WPTB_Helper.getRowHeight( table, highlighted );\n document.getElementById( 'wptb-table-row-height-number' ).value = height;\n document.getElementById( 'wptb-table-row-height-slider' ).value = height;\n }\n };\n \n function createMobileHeadForTable( table, thisEvent ) {\n \n if( thisEvent.checked ) {\n WPTB_Helper.dataTitleColumnSet( table );\n \n table.classList.add( 'wptb-table-preview-head' );\n table.rows[0].classList.add( 'wptb-table-head' );\n } else {\n let rows = table.rows;\n table.classList.remove( 'wptb-table-preview-head' );\n rows[0].classList.remove( 'wptb-table-head' );\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 thisRowChildren[j].removeAttribute( 'data-wptb-title-column' );\n thisRowChildren[j].removeAttribute( 'data-wptb-title-column-font-size' );\n thisRowChildren[j].removeAttribute( 'data-wptb-title-column-color' );\n thisRowChildren[j].removeAttribute( 'data-wptb-title-background-color' );\n thisRowChildren[j].removeAttribute( 'data-wptb-title-align' );\n }\n }\n }\n }\n \n document.getElementById( 'wptb-top-row-as-header' ).onchange = function () {\n createMobileHeadForTable( table, this );\n }\n\n for (var i = 0; i < wptbElementButtons.length; i++) {\n wptbElementButtons[i].ondragstart = function (e) {\n e.dataTransfer.setData('wptbElement', this.dataset.wptbElement);\n e.dataTransfer.setData( 'wptbElIndic-' + this.dataset.wptbElement, 'wptbElIndic-' + this.dataset.wptbElement );\n }\n }\n \n if( table ) {\n document.getElementById('wptb-activate-cell-management-mode').onclick = table.toggleTableEditMode;\n document.getElementById( 'wptb-table-edit-mode-close' ).onclick = table.toggleTableEditMode;\n document.getElementById( 'wptb-left-scroll-panel-curtain-close' ).onclick = table.toggleTableEditMode;\n document.getElementById('wptb-add-end-row').onclick = table.addRowToTheEnd;\n document.getElementById('wptb-add-start-row').onclick = table.addRowToTheStart;\n document.getElementById('wptb-add-row-before').onclick = table.addRowBefore;\n document.getElementById('wptb-add-row-after').onclick = table.addRowAfter;\n document.getElementById('wptb-add-end-column').onclick = table.addColumnEnd;\n document.getElementById('wptb-add-start-column').onclick = table.addColumnStart;\n document.getElementById('wptb-add-column-before').onclick = table.addColumnBefore;\n document.getElementById('wptb-add-column-after').onclick = table.addColumnAfter;\n document.getElementById('wptb-delete-column').onclick = table.deleteColumn;\n document.getElementById('wptb-delete-row').onclick = table.deleteRow;\n document.getElementById('wptb-merge-cells').onclick = table.mergeCells;\n document.getElementById('wptb-split-cell').onclick = table.splitCell;\n }\n \n document.querySelector( '.wptb-left-panel-extend' ).onclick = function() {\n let wptbContainer = document.querySelector( '.wptb-container' );\n if( wptbContainer ) {\n if ( wptbContainer.classList.contains( 'collapsed' ) ) {\n wptbContainer.classList.remove( 'collapsed' );\n } else {\n wptbContainer.classList.add( 'collapsed' );\n }\n }\n };\n \n // this code hides the \"element parameters\" area \n // when clicked outside this element and its \"tinymce\" toolbar \n let wptbBuilderPanel = document.getElementsByClassName( 'wptb-builder-panel' )[0];\n wptbBuilderPanel.addEventListener( 'click', function( e ) {\n if( ! e.target.classList.contains( 'wptb-ph-element' ) && ! WPTB_Helper.findAncestor( e.target, 'wptb-ph-element' ) && \n ! e.target.classList.contains( 'wptb-fixed-toolbar' ) && ! WPTB_Helper.findAncestor( e.target, 'wptb-fixed-toolbar' ) ) {\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 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 } \n }, false);\n \n};","var WPTB_List = function ( innerElements, DOMElementProt ) {\n\n var el_L = document.createElement('ul'), item,\n DOMElement = document.createElement('div'),\n kindIndexProt = undefined,\n copy = false;\n DOMElement.classList.add( 'wptb-list-item-container' );\n\n this.kind = 'list';\n\n if (innerElements === '') {\n //Case for edit mode list\n } else if ( !innerElements ) {\n for (var i = 0; i < 3; i++) {\n item = new WPTB_ListItem( '<p>List Item ' + (i + 1) + '</p>');\n el_L.appendChild(item.getDOMElement());\n }\n } else {\n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\n kindIndexProt = wptbElementMutch[1];\n copy = true;\n };\n \n for ( var i = 0; i < innerElements.length; i++ ) {\n let listItem = DOMElementProt.querySelector( 'li' );\n item = new WPTB_ListItem( innerElements[i], listItem, true );\n el_L.appendChild(item.getDOMElement());\n }\n }\n DOMElement.appendChild(el_L);\n //window.addElementOptions('list', elList);\n\n this.getDOMElement = function () {\n return DOMElement;\n }\n applyGenericItemSettings( this, kindIndexProt, copy );\n WPTB_Helper.listItemsRecalculateIndex( el_L );\n\n return this;\n};","var WPTB_ListItem = function ( text, DOMElementProt, copy ) {\n let wptbListItemReturn;\n if ( DOMElementProt == undefined || ( DOMElementProt && copy )) {\n if (text == undefined) text = 'New List Item';\n var DOMElement = document.createElement('li'),\n //divdot = document.createElement('div'),\n divcontent = document.createElement('div');\n //libullet = document.createElement('li');\n //divdot.classList.add('wptb-list-item-style-dot');\n divcontent.classList.add('wptb-list-item-content');\n //libullet.classList.add('wptb-bullet');\n if ( DOMElementProt ) {\n let styleDot = DOMElementProt.getAttribute( 'style' );\n if ( styleDot ) {\n DOMElement.setAttribute( 'style', styleDot );\n }\n }\n //DOMElement.appendChild(divdot);\n DOMElement.appendChild(divcontent);\n //divdot.appendChild(libullet);\n divcontent.innerHTML = text;\n divcontent.onkeyup = window.listItemKeyListener;\n \n wptbListItemReturn = true;\n } else {\n var DOMElement = DOMElementProt;\n var divcontent = DOMElement.getElementsByClassName( 'wptb-list-item-content' )[0];\n \n divcontent.onkeyup = window.listItemKeyListener;\n \n wptbListItemReturn = false;\n }\n \n DOMElement.onmouseenter = function (event) {\n\n var btnDelete = document.createElement('span'),\n btnCopy = document.createElement('span'),\n actions = document.createElement('span'),\n previous,\n i;\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 this.classList.add('wptb-directlyhovered');\n\n btnDelete.onclick = function () {\n var action = this.parentNode, \n item = this.parentNode.parentNode,\n parent = item.parentNode;\n item.removeChild( action );\n parent.removeChild( item );\n WPTB_Helper.listItemsRecalculateIndex( parent );\n };\n\n btnCopy.onclick = function (event) {\n var listItem = event.target.parentNode.parentNode,\n content = listItem.querySelector('.wptb-list-item-content'),\n html = content.innerHTML;\n var duplicate = new WPTB_ListItem( html, listItem, true );\n listItem.parentNode.insertBefore( duplicate.getDOMElement(), DOMElement );\n WPTB_Helper.listItemsTinyMceInit( duplicate.getDOMElement().firstChild );\n setTimeout( function(){\n divcontent.innerHTML = html;\n WPTB_Helper.listItemsRecalculateIndex( listItem.parentNode );\n }, 5 );\n };\n\n actions.append(btnCopy, btnDelete);\n this.appendChild(actions);\n };\n\n DOMElement.onmouseleave = function (event) {\n this.removeAttribute( 'class' );\n let iter = 0;\n while( event.target.querySelector( '.wptb-actions' ) && iter < 5 ) {\n event.target.querySelector( '.wptb-actions' ).remove();\n iter++;\n }\n };\n\n this.getDOMElement = function () {\n return DOMElement;\n };\n \n if ( wptbListItemReturn ) {\n return this;\n }\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}","var WPTB_Parser2 = function (code) {\n if( Array.isArray( code ) ) {\n let elementHtml;\n \n if ( code.length == 1) {\n return elementHtml.appendChild( document.createTextNode( code[0] ) );\n }\n if( 0 in code ) {\n let tagName = code[0];\n elementHtml = document.createElement( tagName );\n \n if ( 1 in code ) {\n if( Array.isArray( code[1] ) ) {\n let attributes = code[1];\n \n for( let i = 0; i < attributes.length; i++ ) {\n if( Array.isArray( attributes[i] ) ) {\n elementHtml.setAttribute(attributes[i][0], attributes[i][1]);\n }\n }\n }\n }\n \n if ( 2 in code ) {\n if ( Array.isArray( code[2] ) ) {\n for ( let i = 0; i < code[2].length; i++ ) {\n if ( typeof code[2][i] === 'string' && tagName.toLowerCase() == 'p' ) {\n elementHtml.appendChild( document.createTextNode( code[2][i] ) );\n continue;\n }\n if ( ! WPTB_Parser( code[2][i] ) ) continue;\n elementHtml.appendChild( WPTB_Parser( code[2][i] ) );\n }\n } else if( typeof code[2] === 'string' ) {\n elementHtml.appendChild( document.createTextNode( code[2] ) );\n }\n \n }\n }\n \n return elementHtml;\n } else {\n return false;\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 let wptbDropHandle = document.querySelector( '.wptb-drop-handle' ),\n wptbDropBorderMarker = document.querySelector( '.wptb-drop-border-marker' );\n if ( wptbDropHandle || wptbDropBorderMarker ) {\n wptbDropHandle.style.display = 'none';\n wptbDropBorderMarker.style.display = 'none';\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-embed-disable' ) ) {\n shortcodePopupWindow.classList.add( 'wptb-popup-show' );\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-save-btn' )[0].onclick = function () {\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 table.toggleTableEditMode();\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 = document.getElementsByClassName( 'wptb-preview-table' );\n if( code.length > 0 ) {\n code = WPTB_Stringifier( code[0] );\n code = code.outerHTML;\n } else { \n code = '';\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 security_code: wptb_admin_object.security_code\n };\n if (( rs = WPTB_Helper.detectMode() ) || ( rs = document.wptbId )) {\n params.id = rs;\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 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-embed-disable' );\n document.getElementById( 'wptb-embed-shortcode' ).value = '[wptb id=' + data[1] + ']';\n } else if( data[0] == 'edited' ) {\n messagingArea.innerHTML = '<div class=\"wptb-success wptb-message\">Table \"' + t + '\" was successfully updated.</div>';\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","var WPTB_Space = function ( elSpaceBetween ) {\n\n function newElementProxy(el) {\n if (el.includes('list')) {\n return new WPTB_List();\n } else if (el.includes('image')) {\n return new WPTB_Image();\n } else if (el.includes('text')) {\n return new WPTB_Text();\n } else if (el.includes('button')) {\n return new WPTB_Button();\n }\n }\n let spaceBetween;\n if ( ! elSpaceBetween ) {\n spaceBetween = document.createElement('div'), spaceBetween.classList.add('wptb-space-between');\n } else {\n spaceBetween = elSpaceBetween;\n }\n\n spaceBetween.ondragenter = function () {\n this.classList.add('visible');\n };\n spaceBetween.ondragover = function (event) {\n event.preventDefault();\n };\n\n spaceBetween.ondragleave = function () {\n this.classList.remove('visible');\n };\n\n spaceBetween.ondrop = function (event) {\n event.stopPropagation();\n\n var p = event.target.nextSibling,\n td = event.target,\n element, t_space, spaceParent;\n\n while ( !td.classList.contains('wptb-droppable') ) {\n td = td.parentNode;\n }\n\n if (event.dataTransfer.getData('wptbElement')) {\n element = newElementProxy(event.dataTransfer.getData('wptbElement'));\n this.classList.remove('visible');\n\n if (p == null) {\n td.appendChild(element.getDOMElement());\n td.appendChild(new WPTB_Space());\n } else {\n td.insertBefore(element.getDOMElement(), p);\n td.insertBefore(new WPTB_Space(), p);\n }\n\n } else {\n alert(event.dataTransfer.getData('node'));\n element = document.getElementsByClassName(event.dataTransfer.getData('node'))[0];\n t_space = element.nextSibling;\n spaceParent = element.parentNode;\n if (t_space != undefined) {\n spaceParent.removeChild(t_space);\n }\n\n if (p == null) {\n td.appendChild(element);\n td.appendChild(new WPTB_Space());\n } else {\n td.insertBefore(element, p);\n td.insertBefore(new WPTB_Space(), p);\n }\n\n }\n this.classList.remove('visible');\n };\n \n if ( ! elSpaceBetween ) {\n return spaceBetween;\n }\n};","var WPTB_Stringifier = function ( codeMain ) {\n if ( codeMain ) {\n let code = codeMain.cloneNode( true );\n code.classList.add( 'wptb-table-preview-static-indic' );\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 innerElements[j].classList.remove( 'wptb-directlyhovered' );\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 wptbActions[0].parentNode.removeChild( wptbActions[0] );\n wptbActionsLength--;\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 WPTB_Stringifier2 = function ( node, start = false ) {\n\n\tif ( node == undefined ) {\n\t\treturn '';\n\t} else if ( node.tagName == undefined && node.nodeType == 3 ) {\n return node.nodeValue;\n }\n \n let code = [],\n children,\n int_elem_arr = false,\n attributes = [...node.attributes],\n attributes_list = [],\n internal_elements = [];\n if ( ( node.parentNode.classList.contains( 'wptb-list-item-content' ) || \n node.parentNode.classList.contains( 'mce-content-body' ) ) && \n node.tagName.toLowerCase() == 'p' ) {\n children = node.childNodes;\n int_elem_arr = true;\n } else if( node.children.length > 0 ) {\n children = node.children;\n } else {\n children = node.childNodes;\n }\n if ( attributes.length > 0 ) {\n for ( let i = 0; i < attributes.length; i++ ) {\n attributes_list[i] = [attributes[i].name, attributes[i].value];\n }\n } else {\n attributes_list = '';\n }\n \n if ( children.length > 0 ) {\n for ( let i = 0; i < children.length; i++) {\n let inter_elem = WPTB_Stringifier(children[i]);\n \n if ( Array.isArray( inter_elem ) || int_elem_arr ) {\n internal_elements[i] = inter_elem;\n } else if ( typeof inter_elem === 'string' && inter_elem ) {\n internal_elements = inter_elem;\n }\n }\n } else {\n internal_elements = '';\n }\n \n \n code.push(node.tagName.toLowerCase(), attributes_list , internal_elements);\n \n return code;\n}","var array = [], WPTB_Table = function (columns, rows) {\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 markedCells,\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 markedCells = document.getElementsByClassName('wptb-highlighted').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 let cellHighlighted = document.querySelector( '.wptb-highlighted' );\n if( cellHighlighted ) {\n let wptbTableColumnWidthSlider = document.getElementById( 'wptb-table-column-width-slider' );\n let wptbTableColumnWidthNumber = document.getElementById( 'wptb-table-column-width-number' );\n let tableColumnWidthAutoFixedCheckbox = document.getElementById( 'wptb-table-column-width-auto-fixed' );\n let width = cellHighlighted.style.width;\n if( width ) {\n wptbTableColumnWidthSlider.value = parseFloat( width, 10 );\n wptbTableColumnWidthNumber.value = parseFloat( width, 10 );\n tableColumnWidthAutoFixedCheckbox.checked = true;\n } else if( cellHighlighted.dataset.wptbFixedWidth ) {\n wptbTableColumnWidthSlider.value = cellHighlighted.dataset.wptbFixedWidth;\n wptbTableColumnWidthNumber.value = cellHighlighted.dataset.wptbFixedWidth;\n tableColumnWidthAutoFixedCheckbox.checked = true;\n } else {\n let cellWidth = WPTB_Helper.getColumnWidth( table, cellHighlighted );\n wptbTableColumnWidthSlider.value = cellWidth;\n wptbTableColumnWidthNumber.value = cellWidth;\n tableColumnWidthAutoFixedCheckbox.checked = false;\n }\n \n \n let wptbTableRowHeightSlider = document.getElementById( 'wptb-table-row-height-slider' );\n let wptbTableRowHeightNumber = document.getElementById( 'wptb-table-row-height-number' );\n let tableRowHeightAutoFixedCheckbox = document.getElementById( 'wptb-table-row-height-auto-fixed' );\n let height = cellHighlighted.style.height;\n if( height ) {\n wptbTableRowHeightSlider.value = parseFloat( height, 10 );\n wptbTableRowHeightNumber.value = parseFloat( height, 10 );\n tableRowHeightAutoFixedCheckbox.checked = true;\n } else if( cellHighlighted.dataset.wptbFixedHeight ) {\n wptbTableRowHeightSlider.value = cellHighlighted.dataset.wptbFixedHeight;\n wptbTableRowHeightNumber.value = cellHighlighted.dataset.wptbFixedHeight;\n tableRowHeightAutoFixedCheckbox.checked = true;\n } else {\n let cellHeight = WPTB_Helper.getRowHeight( table, cellHighlighted );\n wptbTableRowHeightSlider.value = cellHeight;\n wptbTableRowHeightNumber.value = cellHeight;\n tableRowHeightAutoFixedCheckbox.checked = false;\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 tds = table.getElementsByClassName('wptb-highlighted');\n while (tds.length) {\n tds[0].classList.remove('wptb-highlighted');\n }\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-header-bg').val('');\n jQuery('#wptb-even-row-bg').val('');\n jQuery('#wptb-odd-row-bg').val('');\n jQuery('#wptb-table-border-color').val('');\n jQuery('#wptb-table-inner-border-number,#wptb-table-inner-border-slider').val('0');\n jQuery('#wptb-table-border-number,#wptb-table-border-slider').val('0');\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' );\n table.dataset.reconstraction = 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 row.appendChild(cell.getDOMElement());\n }\n }\n } else {\n let wptb_preview_table = document.getElementsByClassName( 'wptb-preview-table' );\n\n if (wptb_preview_table.length > 0) {\n table = wptb_preview_table[0];\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 }\n }\n\n /*\n * This just toggles visibility of cell edit bar, and toggles \n * cell selecting mode.\n */\n\n table.toggleTableEditMode = function () {\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.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 {\n document.select.activateMultipleSelectMode();\n bar[i].classList.add( 'visible' );\n cellModeBackground.classList.add( 'visible' );\n leftScrollPanelCurtain.classList.add( 'visible' );\n wptbPreviewTable.classList.add( 'wptb-preview-table-manage-cells' );\n }\n }\n\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 ( start ) {\n let trs = this.getElementsByTagName('tr'), tds, maxCols = 0, maxColsFull = 0,\n tdsArr = [];\n let wptbTopRowAsHeader = document.getElementById( 'wptb-top-row-as-header' );\n \n for (var i = 0; i < trs.length; i++) {\n if ( i == 0 ) {\n if ( start == undefined ) {\n trs[i].style.backgroundColor = jQuery('#wptb-table-header-bg').val();\n }\n if( wptbTopRowAsHeader.checked ) {\n if( start == undefined ) {\n this.classList.add( 'wptb-table-preview-head' ); \n trs[i].classList.add( 'wptb-table-head' )\n } ;\n } else {\n if( start == undefined ) {\n this.classList.remove( 'wptb-table-preview-head' );\n trs[i].classList.remove( 'wptb-table-head' );\n }\n }\n } else {\n if (i % 2 == 0) {\n if ( start == undefined ) {\n trs[i].style.backgroundColor = jQuery('#wptb-odd-row-bg').val();\n }\n trs[i].classList.remove( 'wptb-table-head' );\n } else {\n if ( start == undefined ) {\n trs[i].style.backgroundColor = jQuery('#wptb-even-row-bg').val();\n }\n trs[i].classList.remove( 'wptb-table-head' );\n }\n }\n\n tdsArr[i];\n tds = trs[i].getElementsByTagName('td');\n\n if (tdsArr[i] == undefined) {\n tdsArr[i] = [];\n }\n\n let jMainIter = 0;\n for (var 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 if( i == 0 ) {\n maxColsFull = jMainIter;\n }\n }\n if (j > maxCols) {\n maxCols = j;\n }\n }\n this.columns = maxCols;\n this.maxCols = maxColsFull;\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 let tableColumnWidthAutoFixedCheckbox = document.getElementById( 'wptb-table-column-width-auto-fixed' );\n if( ! tableColumnWidthAutoFixedCheckbox.checked ) {\n tableColumnWidthAutoFixedCheckbox.checked = true;\n }\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 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[parseInt( td.dataset.xIndex )] && ! arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] ) {\n if( td.style.width ) {\n arrayCellsWidthFixedHelper[parseInt( 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[parseInt( td.dataset.xIndex )] = 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 if( arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] ) {\n arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] += tdPaddingCommon;\n arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] += tableTdBorderCommonWidth;\n } else {\n arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] += tdPaddingCommon;\n arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] += tableTdBorderCommonWidth;\n }\n }\n } else if( arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] ) {\n if( ! td.dataset.wptbFixedWidth ) {\n td.dataset.wptbCssTdAutoWidth = true;\n }\n } else if( arrayCellsWidthFixedHelper[parseInt( 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 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 tableTdsSumMaxWidth = tableTdsSumMaxWidthFixed + tableTdsSumMaxWidthAuto + tableBorderCommon;\n \n table.dataset.wptbTableTdsSumMaxWidth = tableTdsSumMaxWidth;\n if( CellsWidthAutoCount ) {\n table.dataset.wptbCellsWidthAutoCount = CellsWidthAutoCount;\n if( table.mergingСellsHorizontally ) {\n table.dataset.wptbFixedWidthSize = tableTdsSumMaxWidthFixed - tableBorderCommon;\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 = null;\n let tableTdsWidthAutoCommon = wptbTableSetupWidth - tableTdsSumMaxWidthFixed - tableBorderCommon;\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 = null;\n table.style.minWidth = null;\n table.style.maxWidth = tableTdsSumMaxWidth + 'px';\n }\n } else {\n table.style.maxWidth = null;\n table.style.minWidth = tableTdsSumMaxWidth + 'px';\n table.style.width = null;\n tableTdWidthAuto = '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 \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 let tableColumnHeightAutoFixedCheckbox = document.getElementById( 'wptb-table-row-height-auto-fixed' );\n if( ! tableColumnHeightAutoFixedCheckbox.checked ) {\n tableColumnHeightAutoFixedCheckbox.checked = true;\n }\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 }\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\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 }\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\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 }\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 };\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 currentTableTd,\n currentTdStyle;\n r.classList.add( 'wptb-row' );\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 < maxAmountOfCells; i++) {\n td = new WPTB_Cell(mark);\n if (currentTdStyle) {\n td.getDOMElement().setAttribute('style', currentTdStyle);\n }\n r.appendChild(td.getDOMElement());\n }\n aux = Array.from(array[0]);\n array.push(aux);\n drawTable(array);\n table.recalculateIndexes();\n table.addColumnWidth();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\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 currentTableTd = currentTable[0].querySelector('td');\n }\n\n if (currentTableTd) {\n currentTdStyle = currentTableTd.getAttribute('style');\n }\n\n for (var i = 0; i < maxAmountOfCells; i++) {\n td = new WPTB_Cell(mark);\n if (currentTdStyle) {\n td.getDOMElement().setAttribute('style', currentTdStyle);\n }\n r.appendChild(td.getDOMElement());\n }\n aux = Array.from(array[0]);\n array.push(aux);\n drawTable(array);\n table.recalculateIndexes();\n table.addColumnWidth();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\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 table.addColumnWidth();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\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\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\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 table.toggleTableEditMode();\n wptbTableSetup.innerHTML = '';\n WPTB_Helper.settingsPanelClear();\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\n }\n \n table.recalculateIndexes();\n WPTB_Helper.dataTitleColumnSet( table );\n }\n undoSelect();\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 table.toggleTableEditMode();\n wptbTableSetup.innerHTML = '';\n WPTB_Helper.settingsPanelClear();\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\n }\n \n table.recalculateIndexes();\n table.tdDefaultWidth();\n WPTB_Helper.dataTitleColumnSet( table );\n }\n undoSelect();\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 // 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_Text = function ( text , DOMElementProt ) {\n let DOMElement = document.createElement('div'),\n elText2 = document.createElement('div'),\n elP = document.createElement('p'),\n kindIndexProt = undefined,\n copy = false;\n \n DOMElement.classList.add( 'wptb-text-container' );\n\n elP.innerHTML = text != undefined ? text : 'Text';\n elText2.appendChild(elP);\n DOMElement.appendChild(elText2);\n if ( DOMElementProt ) {\n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\n kindIndexProt = wptbElementMutch[1];\n copy = true;\n };\n\n let attributes = [...DOMElementProt.attributes];\n for( let i = 0; i < attributes.length; i++ ) {\n DOMElement.setAttribute(attributes[i].name, attributes[i].value);\n }\n } \n\n this.kind = 'text';\n this.getDOMElement = function () {\n return DOMElement;\n };\n applyGenericItemSettings( this, kindIndexProt, copy );\n\n return this;\n};","var WPTB_innerElementSet = function ( element ) {\n \n function newElementProxy(el) {\n if (el == 'list') {\n return new WPTB_List();\n } else if (el == 'image') {\n return new WPTB_Image();\n } else if (el == 'text') {\n return new WPTB_Text();\n } else if (el == 'button') {\n return new WPTB_Button();\n }\n }\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 = 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 == 'Abowe 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 let thisRow = td.parentNode\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\n WPTB_Helper.dataTitleColumnSet( table );\n }\n \n } else {\n return;\n }\n \n wptbDropHandle.style.display = 'none';\n wptbDropBorderMarker.style.display = 'none';\n\n WPTB_innerElementSet( element );\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 listItems,\n copy;\n \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 } else if ( kindIndexProt && ! copy ) {\n index = kindIndexProt.split('-')[1];\n }\n \n node.onmouseenter = function (event) {\n this.classList.add('wptb-directlyhovered');\n let btnDelete = document.createElement( 'span' ),\n btnCopy = document.createElement( 'span' ),\n btnMove = document.createElement( 'span' ),\n actions = document.createElement( 'span' ), i;\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 btnMove.classList.add(\"dashicons\", \"dashicons-move\", 'wptb-move-action');\n btnMove.draggable = true;\n btnDelete.onclick = function (event) {\n let act = this.parentNode.parentNode,\n el = act.parentNode;\n el.removeChild(act);\n \n if( act.kind == 'text' ) {\n let thisRow = el.parentNode\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\n WPTB_Helper.dataTitleColumnSet( table );\n }\n }\n \n };\n btnCopy.onclick = function (event) {\n let copy;\n if (element.kind == 'list') {\n var td = event.target.parentNode.parentNode.parentNode,\n temp = [],\n srcList = event.target.parentNode.parentNode.querySelectorAll('ul li .wptb-list-item-content');\n\n for (var i = 0; i < srcList.length; i++) {\n temp.push(srcList[i].innerHTML);\n }\n\n copy = new WPTB_List( temp, node );\n\n node.parentNode.insertBefore( copy.getDOMElement(), node.nextSibling );\n } else if (element.kind == 'text') {\n var td = event.target.parentNode.parentNode.parentNode;\n copy = new WPTB_Text(event.target.parentNode.parentNode.childNodes[0].innerHTML, node);\n\n node.parentNode.insertBefore( copy.getDOMElement(), node.nextSibling );\n } else if ( element.kind == 'image' ) {\n var td = event.target.parentNode.parentNode.parentNode;\n copy = new WPTB_Image( event.target.parentNode.parentNode.children[0].children[0].src, node );\n\n node.parentNode.insertBefore( copy.getDOMElement(), node.nextSibling );\n } else {\n var td = event.target.parentNode.parentNode.parentNode,\n text = event.target.parentNode.parentNode.childNodes[0].querySelector( 'p' ).innerHTML;\n copy = new WPTB_Button( text, node );\n\n node.parentNode.insertBefore( copy.getDOMElement(), node.nextSibling );\n }\n \n WPTB_innerElementSet( copy.getDOMElement() );\n };\n let parent = this,\n infArr,\n type;\n infArr = parent.className.match(/wptb-element-(.+)-(\\d+)/i);\n type = infArr[1];\n let dragImagesArr = WPTB_Helper.dragImagesArr();\n btnMove.ondragstart = function (event) {\n this.parentNode.style.opacity = 0;\n parent.classList.remove( 'wptb-directlyhovered' );\n parent.classList.add( 'wptb-moving-mode' );\n \n event.dataTransfer.setDragImage( dragImagesArr[type], 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.parentNode;\n if( act.kind == 'text' ) {\n let thisRow = el.parentNode\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\n WPTB_Helper.dataTitleColumnSet( table );\n }\n }\n };\n\n if (element.kind === 'button') {\n let a = node.querySelector( 'a' ),\n target = a.querySelector( 'div' );\n a.onclick = function( e ) {\n e.preventDefault();\n }\n WPTB_Helper.buttonsTinyMceInit( target );\n } else if (element.kind === 'text') {\n tinyMCE.init({\n target: node.childNodes[0],\n inline: true,\n plugins: \"link, paste\",\n dialog_type: \"modal\",\n theme: 'modern',\n menubar: false,\n fixed_toolbar_container: '#wpcd_fixed_toolbar',\n paste_as_text: true,\n toolbar: 'bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify',\n setup : function( ed ) {\n ed.on( 'change', function(e) {\n let row = WPTB_Helper.findAncestor( node, 'wptb-row' );\n if( row.classList.contains( 'wptb-table-head' ) ) {\n let table = WPTB_Helper.findAncestor( row, 'wptb-preview-table' );\n WPTB_Helper.dataTitleColumnSet( table );\n }\n });\n },\n init_instance_callback: function (editor) {\n window.currentEditor = editor;\n //editor.fire('focus');\n editor.on('focus', function (e) {\n var totalWidth = document.getElementsByClassName('wptb-builder-panel')[0].offsetWidth;\n if (window.currentEditor &&\n document.getElementById('wptb_builder').scrollTop >= 55 &&\n window.currentEditor.bodyElement.style.display != 'none') {\n document.getElementById('wpcd_fixed_toolbar').style.position = 'fixed';\n document.getElementById('wpcd_fixed_toolbar').style.right = (totalWidth / 2 - document.getElementById('wpcd_fixed_toolbar').offsetWidth / 2) + 'px';\n document.getElementById('wpcd_fixed_toolbar').style.top = '100px';\n } else {\n document.getElementById('wpcd_fixed_toolbar').style.position = 'static';\n delete document.getElementById('wpcd_fixed_toolbar').style.right;\n delete document.getElementById('wpcd_fixed_toolbar').style.top;\n }\n });\n }\n });\n \n } else {\n listItems = node.getElementsByClassName( 'wptb-list-item-content' );\n for ( let i = 0; i < listItems.length; i++ ) {\n WPTB_Helper.listItemsTinyMceInit( listItems[i] );\n }\n }\n\n actions.appendChild(btnMove);\n actions.appendChild(btnCopy);\n actions.appendChild(btnDelete);\n this.appendChild( actions );\n };\n\n node.onmouseleave = function ( event ) {\n this.classList.remove( 'wptb-directlyhovered' );\n let iter = 0;\n while( event.target.querySelector( '.wptb-actions' ) && iter < 5 ) {\n event.target.querySelector( '.wptb-actions' ).remove();\n iter++;\n }\n };\n \n // Change data-title-column if the title was changed\n if( element.kind == 'text' ) {\n var observer = new MutationObserver( function( mutations ) {\n let row = WPTB_Helper.findAncestor( node, 'wptb-row' );\n if( row.classList.contains( 'wptb-table-head' ) ) {\n let table = WPTB_Helper.findAncestor( row, 'wptb-preview-table' );\n WPTB_Helper.dataTitleColumnSet( table );\n }\n });\n var config = { attributes: true, attributeFilter: ['style'] };\n observer.observe( element.getDOMElement(), config );\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 new WPTB_ElementOptions( element, index, kindIndexProt );\n\n document.counter.increment(element.kind);\n};",""]}
|
1 |
+
{"version":3,"sources":["applyGenericItemSettings.js","wptb-builder.js","WPTB_Builder.js","WPTB_Button.js","WPTB_Cell.js","WPTB_DropHandle.js","WPTB_ElementCounters.js","WPTB_ElementOptions.js","WPTB_Helper.js","WPTB_Image.js","WPTB_Initializer.js","WPTB_innerElementSet.js","WPTB_LeftPanel.js","WPTB_List.js","WPTB_ListItem.js","WPTB_MultipleSelect.js","WPTB_Parser.js","WPTB_Parser2.js","WPTB_Settings.js","WPTB_Space.js","WPTB_Stringifier.js","WPTB_Stringifier2.js","WPTB_Table.js","WPTB_Text.js"],"names":["applyGenericItemSettings","element","kindIndexProt","copy","node","getDOMElement","index","listItems","undefined","document","counter","nextIndex","kind","wptbElements","getElementsByClassName","elementIndexesArr","i","length","regex","RegExp","infArr","className","match","push","elementIndexMax","Math","max","split","onmouseenter","event","classList","add","btnDelete","createElement","btnCopy","btnMove","actions","draggable","onclick","act","parentNode","el","removeChild","thisRow","contains","table","WPTB_Helper","findAncestor","dataTitleColumnSet","td","target","temp","srcList","querySelectorAll","innerHTML","WPTB_List","insertBefore","nextSibling","WPTB_Text","childNodes","WPTB_Image","children","src","text","querySelector","WPTB_Button","WPTB_innerElementSet","parent","type","dragImagesArr","ondragstart","style","opacity","remove","dataTransfer","setDragImage","setData","a","e","preventDefault","buttonsTinyMceInit","tinyMCE","init","inline","plugins","dialog_type","theme","menubar","fixed_toolbar_container","paste_as_text","toolbar","setup","ed","on","row","init_instance_callback","editor","window","currentEditor","totalWidth","offsetWidth","getElementById","scrollTop","bodyElement","display","position","right","top","listItemsTinyMceInit","appendChild","onmouseleave","iter","observer","MutationObserver","mutations","config","attributes","attributeFilter","observe","node_wptb_element_kind_num","WPTB_ElementOptions","increment","WPTB_Builder","table_id","detectMode","http","XMLHttpRequest","urlSet","ajaxurl","open","setRequestHeader","onreadystatechange","d","readyState","status","ans","JSON","parse","responseText","value","wptbTableSetupEl","WPTB_Parser","WPTB_Table","WPTB_LeftPanel","WPTB_Settings","send","ElementCounters","select","MultipleSelect","initializer","WPTB_Initializer","settings","addEventListener","DOMElementProt","DOMElement","elButton","el_B","el_BDiv","wptbElementMutch","Array","isArray","attributesContainer","setAttribute","name","wptbButtonWrapper","wptbButtonWrapAttributes","wptbButton","wptbButtonAttributes","WPTB_Cell","callback","highlightRow","parentRow","columnCount","parseInt","tds","getElementsByTagName","classToAdd","ttd","highlightColumn","rowCount","tr","padding","jQuery","val","innerBorderWidth","border","wptbPhElement","wptbSpaceBetween","j","WPTB_Space","wptbElementTypeClass","wptbTypeElementArr","wptbListItems","WPTB_ListItem","setCoords","y","x","dataset","yIndex","xIndex","getCoords","coords","appendElement","getCellDimensions","tdStyleObj","getComputedStyle","tdPaddingLeft","getPropertyValue","tdPaddingRight","tdBorderLeftWidth","tdBorderRightWidth","tdPaddingTop","tdPaddingBottom","tdBorderTopWidth","tdBorderBottomWidth","width","parseFloat","height","offsetHeight","WPTB_DropHandle","thisElem","newElementProxy","includes","wptbDropHandle","wptbDropBorderMarker","wptbDropBorderMarkerTop","wptbDropBorderMarkerRight","wptbDropBorderMarkerBottom","wptbDropBorderMarkerLeft","body","ondragenter","ondragover","ondragleave","ondrop","getData","getDOMParentElement","nodeName","toLowerCase","innerElement","innerElementNext","wptbContainer","onscroll","localName","indics","types","notDragEnter","coordinatesElement","getBoundingClientRect","left","Number","indexOf","elementDrag","offsetY","layerY","bottom","priv","key","elemIdClass","prop","cloneNode","properties","affectedEl","wptbButtonA","wptbSize","b","buttonAlignment","justifyContent","buttonAlignmentSelect","selectOption","selectOptionVal","selected","buttonHref","getAttribute","buttonLinkTarget","buttonId","buttonHrefInput","buttonLinkTargetInput","buttonLinkTargetInputId","buttonLinkTargetInputLabel","buttotIdInput","checked","buttonTextColor","color","buttonColor","backgroundColor","buttonTextColorInput","buttonBackgroundColorInput","rgbToHex","elementsA","aTextAlign","textAlign","imageAlignmentSelect","imageLinkHref","inputImageLink","imageLinkTarget","imageLinkTargetInput","imageLinkTargetInputId","imageLinkTargetInputLabel","img","imgWidth","imageWidthInputRange","imageWidthInputNumber","imgAlternativeText","imageAlternativeTextInput","elementFontSize","fontSize","elementTextColor","textFontSizeInputRange","textFontSizeInputNumber","textColorInput","elementList","elementListColor","listColorInput","elementListItem","listItemP","listItemPClasses","elementListClassSelect","listIconSelectLabel","nodeType","listIconSelectLabelId","elementListStyleTypeSelect","elementListItemContent","listItemPTextAlignArr","p","listItemPTextAlignLeftCount","listItemPTextAlignCenterCount","listItemPTextAlignRightCount","elementListAlignmentSelect","maxListItemTAlLeftC","optionsClass","buttons","size","n_Class","num","optionControls","wpColorPicker","change","ui","classe","ps","number","toString","slider","oninput","onchange","alt","href","linkHttpCheckChange","rel","removeAttribute","jc","id","parentNodeSettingItem","listItem","hexToRgb","hex","result","exec","rgb","slice","getDragImageCustom","hostName","location","protocol","hostname","image","button","list","listItemsRecalculateIndex","ulElem","par","listStyleTypeIndex","article","keyCode","duplicate","firstChild","innerText","pText","replace","trim","selectedText","getSelectionText","link","linkArr","linkClean","rows","rowHead","computedStyleRowHead","rowHeadChildren","contentsForHeader","tdElements","textContent","thisRowChildren","wptbTitleColumn","wptbTitleColumnFontSize","wptbTitleColumnColor","wptbTitleBackgroundColor","wptbTitleAlign","cls","parentElement","txt","getSelection","selection","createRange","settingsPanelClear","wpColorPickerClear","inputId","input","wpPickerContainer","newInput","url","results","decodeURIComponent","getColumnWidth","cell","xIndexes","cellWidth","getRowHeight","yIndexes","cellHeight","elImage","anchor","file_frame","wp","media","frames","title","multiple","attachment","state","get","first","toJSON","MIN_COLUMNS","MIN_ROWS","MAX_COLUMNS","MAX_ROWS","tableGenerator","columnsDecrementButton","columnsIncrementButton","rowsDecrementButton","rowsIncrementButton","columnsInput","rowsInput","columns","div","classId","stopPropagation","onmouseover","wptbElementButtons","wptbTdBgColorSavedSet","trNumber","tableRows","trBackgroundColor","wptbEvenRowBg","clear","tableHeader","tableTopRowAsHeadSavedSet","wptbTopRowAsHeader","tableBorderColorWidthSavedSet","tableBorderColor","borderColor","tableBorderColorInput","tableBorderWidth","borderWidth","wptbTableBorderWidthSlider","wptbTableBorderWidthNumber","tableTd","applyInnerBorder","innerBorderCheckInput","wptbApplyInnerBorder","wptbTableInnerBorderSlider","wptbTableInnerBorderNumber","tableCells","tableInnerborderNumber","addInnerBorderSize","borderStyle","addCellPadding","addInnerBorder","styles","wptbPreviewTable","marginBottom","addBorderSize","cellPaddingSavedSet","wptbTableCellSlider","wptbTableCellNumber","numberImputSize","wptbNumberInputs","maxCount","maxValue","onkeydown","thisValue","String","substring","onkeyup","wptbTableBorderNumber","wptbTextfontSizeNumber","wptbImageWidthNumber","wptbTableColumnWidthNumber","wptbTableRowHeightNumber","tdDefaultWidth","wptbInnerBorderCheck","tableBorderColorSetArea","addColumnWidth","highlighted","addRowHeight","createMobileHeadForTable","thisEvent","wptbElement","toggleTableEditMode","addRowToTheEnd","addRowToTheStart","addRowBefore","addRowAfter","addColumnEnd","addColumnStart","addColumnBefore","addColumnAfter","deleteColumn","deleteRow","mergeCells","splitCell","wptbBuilderPanel","wpcdFixedToolbar","hasAttribute","innerElements","el_L","item","wptbListItemReturn","divcontent","styleDot","listItemKeyListener","previous","action","content","html","setTimeout","append","selectedCells","multipleCellMode","activateMultipleSelectMode","deactivateMultipleSelectMode","isActivated","pushSelectedCell","flushSelectedCells","getFirst","minXIndex","minYIndex","getLast","maxXIndex","maxYIndex","last","removeAllButFirst","code","columnTitleMobile","WPTB_Parser2","elementHtml","createTextNode","tagName","elems","effectAllowed","ondragend","shortcodePopupWindow","bar","wptb_admin_object","t","messagingArea","WPTB_Stringifier","outerHTML","messagingAreaText","params","security_code","rs","wptbId","stringify","data","wptbPreviewBtn","wptbPreviewBtnHref","previewHref","elSpaceBetween","spaceBetween","t_space","spaceParent","alert","codeMain","tableColumns","minWidth","maxWidth","mceContentBodys","k","dataMceStyle","contentEditable","spellCheck","mceIds","wptbActions","wptbActionsLength","columnNameDivContainer","columnNameDiv","WPTB_Stringifier2","start","nodeValue","int_elem_arr","attributes_list","internal_elements","inter_elem","array","wptbTableSetup","maxAmountOfCells","maxAmountOfRows","mark","rowSpan","cs","colSpan","markedCells","noCells","singleCells","multipleCells","cellSettings","column","cellHighlighted","wptbTableColumnWidthSlider","tableColumnWidthAutoFixedCheckbox","wptbFixedWidth","wptbTableRowHeightSlider","tableRowHeightAutoFixedCheckbox","wptbFixedHeight","isSquare","realTimeArray","carried","cols","matriz","items","justAssigned","amount","carriedRowspans","cellsBuffer","cellPointer","xPosition","stepsToMove","celda","drawTable","string","undoSelect","fillTableArray","colspansSums","cells","colspanSumInRow","apply","getActualPointsInRow","points","search","skipInCols","reconstraction","insertRow","wptb_preview_table","cellModeBackground","leftScrollPanelCurtain","leftScrollPanelCellSettings","wptbPreviewTableTds","recalculateIndexes","trs","maxCols","maxColsFull","tdsArr","jMainIter","z","cleaner","dataXIndex","tableTdsFor","colspan","widthIsSet","arrayTdsFromPreviousRow","tableTdsSumMaxWidth","tableTdsSumMaxWidthFixed","tableTdsSumMaxWidthAuto","wptbTableSetupWidth","arrayCellsWidthFixedHelper","arrayCellsWidthAutoHelper","tdPaddingCommon","tableTdBorderCommonWidth","cssForTdsWidthAuto","wptbCssTdAutoWidth","tableTdBorderLeftWidth","tableTdBorderRightWidth","CellsWidthAutoCount","tableFullStyleObj","borderLeftWidth","borderRightWidth","tableBorderCommon","wptbTableTdsSumMaxWidth","wptbCellsWidthAutoCount","mergingСellsHorizontally","wptbFixedWidthSize","styleElementCreate","tableTdWidthAuto","tableTdsWidthAutoCommon","head","cssForTdsWidthAutoOld","dataYIndex","rowspan","heightIsSet","arrayTdsPrevious","tableColumnHeightAutoFixedCheckbox","mergingCellsVertically","forBreak","currentTable","currentTableTd","currentTdStyle","firstCell","c_pos","cellStyle","pos","pendingInsertion","bro","currentCell","l","r","aux","from","cellNew","rowChildren","rowChildrenLength","cellRowSpan","rowAfter","cellsColSpan","tableRowsIChildren","tableRIChildrenLength","rowIRowSpan","rNext","rNextChildren","rNextChildrenLength","rowStart","columnStart","rowEnd","columnEnd","itemsEstimate","dimensions","call","tdsChildrenNew","tdsInternalElements","tdsIntElemLength","firstWidth","firstDataFixedWidth","firstHeight","firstDataFixedHeight","cellStyles","cellXIndex","rowChildInsertBefore","rowNext","findRowspannedCells","difference","actualPoints","addLackingCells","sumRows","totalColspan","nextRow","nextRowChildren","nextRowChildrenLength","tdArr","nextRowChildrenK","jRowChildren","pop","onresize","elText2","elP"],"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,QAEIC,SAFJ;AAAA,QAGIJ,IAHJ;;AAKA,QAAKD,iBAAiBM,SA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AAI,CAAb,EAAgBA,IAAIoG,WAAWnG,MAA/B,EAAuCD,GAAvC,EAA6C;AACzC0I,uBAAWQ,YAAX,CAAwB9C,WAAWpG,CAAX,EAAcmJ,IAAtC,EAA4C/C,WAAWpG,CAAX,EAAc2H,KAA1D;AACH;AACJ;;AAED,SAAK/H,IAAL,GAAY,MAAZ;AACA,SAAKP,aAAL,GAAqB,YAAY;AAC7B,eAAOqJ,UAAP;AACH,KAFD;AAGA1J,6BAA0B,IAA1B,EAAgCE,aAAhC,EAA+CC,IAA/C;;AAEA,WAAO,IAAP;AACH,CAhCD","file":"admin.js","sourcesContent":["var applyGenericItemSettings = function ( element, kindIndexProt, copy = false ) {\r\n var node = element.getDOMElement(),\r\n index,\r\n listItems,\r\n copy;\r\n \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 } else if ( kindIndexProt && ! copy ) {\r\n index = kindIndexProt.split('-')[1];\r\n }\r\n \r\n node.onmouseenter = function (event) {\r\n this.classList.add('wptb-directlyhovered');\r\n let btnDelete = document.createElement( 'span' ),\r\n btnCopy = document.createElement( 'span' ),\r\n btnMove = document.createElement( 'span' ),\r\n actions = document.createElement( 'span' ), i;\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 btnMove.classList.add(\"dashicons\", \"dashicons-move\", 'wptb-move-action');\r\n btnMove.draggable = true;\r\n btnDelete.onclick = function (event) {\r\n let act = this.parentNode.parentNode,\r\n el = act.parentNode;\r\n el.removeChild(act);\r\n \r\n if( act.kind == 'text' ) {\r\n let thisRow = el.parentNode\r\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\r\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n }\r\n \r\n };\r\n btnCopy.onclick = function (event) {\r\n let copy;\r\n if (element.kind == 'list') {\r\n var td = event.target.parentNode.parentNode.parentNode,\r\n temp = [],\r\n srcList = event.target.parentNode.parentNode.querySelectorAll('ul li .wptb-list-item-content');\r\n\r\n for (var i = 0; i < srcList.length; i++) {\r\n temp.push(srcList[i].innerHTML);\r\n }\r\n\r\n copy = new WPTB_List( temp, node );\r\n\r\n node.parentNode.insertBefore( copy.getDOMElement(), node.nextSibling );\r\n } else if (element.kind == 'text') {\r\n var td = event.target.parentNode.parentNode.parentNode;\r\n copy = new WPTB_Text(event.target.parentNode.parentNode.childNodes[0].innerHTML, node);\r\n\r\n node.parentNode.insertBefore( copy.getDOMElement(), node.nextSibling );\r\n } else if ( element.kind == 'image' ) {\r\n var td = event.target.parentNode.parentNode.parentNode;\r\n copy = new WPTB_Image( event.target.parentNode.parentNode.children[0].children[0].src, node );\r\n\r\n node.parentNode.insertBefore( copy.getDOMElement(), node.nextSibling );\r\n } else {\r\n var td = event.target.parentNode.parentNode.parentNode,\r\n text = event.target.parentNode.parentNode.childNodes[0].querySelector( 'p' ).innerHTML;\r\n copy = new WPTB_Button( text, node );\r\n\r\n node.parentNode.insertBefore( copy.getDOMElement(), node.nextSibling );\r\n }\r\n \r\n WPTB_innerElementSet( copy.getDOMElement() );\r\n };\r\n let parent = this,\r\n infArr,\r\n type;\r\n infArr = parent.className.match(/wptb-element-(.+)-(\\d+)/i);\r\n type = infArr[1];\r\n let dragImagesArr = WPTB_Helper.dragImagesArr();\r\n btnMove.ondragstart = function (event) {\r\n this.parentNode.style.opacity = 0;\r\n parent.classList.remove( 'wptb-directlyhovered' );\r\n parent.classList.add( 'wptb-moving-mode' );\r\n \r\n event.dataTransfer.setDragImage( dragImagesArr[type], 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.parentNode;\r\n if( act.kind == 'text' ) {\r\n let thisRow = el.parentNode\r\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\r\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n }\r\n };\r\n\r\n if (element.kind === 'button') {\r\n let a = node.querySelector( 'a' ),\r\n target = a.querySelector( 'div' );\r\n a.onclick = function( e ) {\r\n e.preventDefault();\r\n }\r\n WPTB_Helper.buttonsTinyMceInit( target );\r\n } else if (element.kind === 'text') {\r\n tinyMCE.init({\r\n target: node.childNodes[0],\r\n inline: true,\r\n plugins: \"link, paste\",\r\n dialog_type: \"modal\",\r\n theme: 'modern',\r\n menubar: false,\r\n fixed_toolbar_container: '#wpcd_fixed_toolbar',\r\n paste_as_text: true,\r\n toolbar: 'bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify',\r\n setup : function( ed ) {\r\n ed.on( 'change', function(e) {\r\n let row = WPTB_Helper.findAncestor( node, 'wptb-row' );\r\n if( row.classList.contains( 'wptb-table-head' ) ) {\r\n let table = WPTB_Helper.findAncestor( row, 'wptb-preview-table' );\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n });\r\n },\r\n init_instance_callback: function (editor) {\r\n window.currentEditor = editor;\r\n //editor.fire('focus');\r\n editor.on('focus', function (e) {\r\n var totalWidth = document.getElementsByClassName('wptb-builder-panel')[0].offsetWidth;\r\n if (window.currentEditor &&\r\n document.getElementById('wptb_builder').scrollTop >= 55 &&\r\n window.currentEditor.bodyElement.style.display != 'none') {\r\n document.getElementById('wpcd_fixed_toolbar').style.position = 'fixed';\r\n document.getElementById('wpcd_fixed_toolbar').style.right = (totalWidth / 2 - document.getElementById('wpcd_fixed_toolbar').offsetWidth / 2) + 'px';\r\n document.getElementById('wpcd_fixed_toolbar').style.top = '100px';\r\n } else {\r\n document.getElementById('wpcd_fixed_toolbar').style.position = 'static';\r\n delete document.getElementById('wpcd_fixed_toolbar').style.right;\r\n delete document.getElementById('wpcd_fixed_toolbar').style.top;\r\n }\r\n });\r\n }\r\n });\r\n \r\n } else {\r\n listItems = node.getElementsByClassName( 'wptb-list-item-content' );\r\n for ( let i = 0; i < listItems.length; i++ ) {\r\n WPTB_Helper.listItemsTinyMceInit( listItems[i] );\r\n }\r\n }\r\n\r\n actions.appendChild(btnMove);\r\n actions.appendChild(btnCopy);\r\n actions.appendChild(btnDelete);\r\n this.appendChild( actions );\r\n };\r\n\r\n node.onmouseleave = function ( event ) {\r\n this.classList.remove( 'wptb-directlyhovered' );\r\n let iter = 0;\r\n while( event.target.querySelector( '.wptb-actions' ) && iter < 5 ) {\r\n event.target.querySelector( '.wptb-actions' ).remove();\r\n iter++;\r\n }\r\n };\r\n \r\n // Change data-title-column if the title was changed\r\n if( element.kind == 'text' ) {\r\n var observer = new MutationObserver( function( mutations ) {\r\n let row = WPTB_Helper.findAncestor( node, 'wptb-row' );\r\n if( row.classList.contains( 'wptb-table-head' ) ) {\r\n let table = WPTB_Helper.findAncestor( row, 'wptb-preview-table' );\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n });\r\n var config = { attributes: true, attributeFilter: ['style'] };\r\n observer.observe( element.getDOMElement(), config );\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 new WPTB_ElementOptions( element, index, kindIndexProt );\r\n\r\n document.counter.increment(element.kind);\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 WPTB_Table();\r\n WPTB_LeftPanel();\r\n WPTB_Settings();\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 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 document.addEventListener('DOMContentLoaded', WPTB_Builder);\r\n})();","var WPTB_Button = function( text, DOMElementProt ) {\r\n \r\n var DOMElement = document.createElement('div'),\r\n elButton = document.createElement('div'),\r\n el_B = document.createElement('a'),\r\n el_BDiv = document.createElement( 'div' ),\r\n kindIndexProt = undefined,\r\n copy = false;\r\n\r\n DOMElement.classList.add('wptb-button-container', 'wptb-size-M', 'wptb-');\r\n elButton.classList.add('wptb-button-wrapper');\r\n el_BDiv.classList.add('wptb-button');\r\n el_BDiv.innerHTML = text != undefined ? text : 'Button Text';\r\n \r\n // Creation of a new button when copying to avoid errors when assigning new event handlers.\r\n if ( DOMElementProt ) {\r\n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\r\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\r\n kindIndexProt = wptbElementMutch[1];\r\n copy = true;\r\n }; \r\n var attributesContainer = [...DOMElementProt.attributes];\r\n if ( attributesContainer.length > 0 ) {\r\n for( let i = 0; i < attributesContainer.length; i++ ) {\r\n DOMElement.setAttribute(attributesContainer[i].name, attributesContainer[i].value);\r\n } \r\n }\r\n \r\n var wptbButtonWrapper = DOMElementProt.querySelector( '.wptb-button-wrapper' );\r\n if ( wptbButtonWrapper ) {\r\n var wptbButtonWrapAttributes = [...wptbButtonWrapper.attributes];\r\n if ( wptbButtonWrapAttributes.length > 0 ) {\r\n for( let i = 0; i < wptbButtonWrapAttributes.length; i++ ) {\r\n if ( wptbButtonWrapAttributes[i].name == 'style') {\r\n elButton.setAttribute( wptbButtonWrapAttributes[i].name, wptbButtonWrapAttributes[i].value );\r\n }\r\n } \r\n }\r\n }\r\n \r\n var wptbButton = DOMElementProt.querySelector( 'a' );\r\n if ( wptbButton ) {\r\n var wptbButtonAttributes = [...wptbButton.attributes];\r\n if ( wptbButtonAttributes.length > 0 ) {\r\n for( let i = 0; i < wptbButtonAttributes.length; i++ ) {\r\n if ( wptbButtonAttributes[i].name == 'style' || \r\n wptbButtonAttributes[i].name == 'href' || \r\n wptbButtonAttributes[i].name == 'target' ) {\r\n el_B.setAttribute( wptbButtonAttributes[i].name, wptbButtonAttributes[i].value );\r\n }\r\n } \r\n }\r\n }\r\n }\r\n \r\n elButton.appendChild(el_B);\r\n el_B.appendChild( el_BDiv );\r\n DOMElement.appendChild(elButton);\r\n \r\n \r\n \r\n this.kind = 'button';\r\n\r\n this.getDOMElement = function () {\r\n return DOMElement;\r\n };\r\n\r\n applyGenericItemSettings( this, kindIndexProt, copy );\r\n\r\n return this;\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 WPTB_innerElementSet( DOMElement );\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\r\n let wptbSpaceBetween = DOMElement.getElementsByClassName( 'wptb-space-between' );\r\n\r\n if ( wptbSpaceBetween.length > 0 ) {\r\n for( let j = 0; j < wptbSpaceBetween.length; j++ ) {\r\n WPTB_Space( wptbSpaceBetween[j] );\r\n }\r\n }\r\n \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 if ( wptbPhElement[i].kind == 'list' ) {\r\n let wptbListItems = wptbPhElement[i].getElementsByTagName( 'li' );\r\n if( wptbListItems.length > 0 ) {\r\n for ( let i = 0; i < wptbListItems.length; i++ ) {\r\n WPTB_ListItem( undefined, wptbListItems[i] );\r\n }\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 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 = parseFloat( this.offsetWidth, 10 ) - \r\n parseFloat( tdPaddingLeft, 10 ) - \r\n parseFloat( tdPaddingRight, 10 ) -\r\n parseFloat( tdBorderLeftWidth, 10 ) -\r\n parseFloat( tdBorderRightWidth, 10 );\r\n \r\n let height = parseFloat( this.offsetHeight, 10 ) - \r\n parseFloat( tdPaddingTop, 10 ) - \r\n parseFloat( tdPaddingBottom, 10 ) -\r\n parseFloat( tdBorderTopWidth, 10 ) -\r\n parseFloat( tdBorderBottomWidth, 10 );\r\n \r\n return {\r\n width: width, \r\n height: height\r\n };\r\n }\r\n\r\n return this;\r\n};","var WPTB_DropHandle = function (thisElem, e) {\r\n \r\n function newElementProxy(el) {\r\n if (el.includes('list')) {\r\n return new WPTB_List();\r\n } else if (el.includes('image')) {\r\n return new WPTB_Image();\r\n } else if (el.includes('text')) {\r\n return new WPTB_Text();\r\n } else if (el.includes('button')) {\r\n return new WPTB_Button();\r\n }\r\n }\r\n \r\n let wptbDropHandle,\r\n wptbDropBorderMarker;\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 let 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 = 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 }\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 == 'Abowe 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( thisRow.classList.contains( 'wptb-table-head' ) ) {\r\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\r\n WPTB_Helper.dataTitleColumnSet( table );\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 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 if( thisRow.classList.contains( 'wptb-table-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 wptbDropHandle.style.width = thisElem.offsetWidth + 'px';\r\n let height = thisElem.offsetHeight,\r\n coordinatesElement = thisElem.getBoundingClientRect(),\r\n left = Number( 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 = Number( coordinatesElement.top ) - Number( 11 );\r\n wptbDropHandle.dataset.text = 'Abowe Element';\r\n if ( y > height/2 ) {\r\n top = Number( 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 = Number( 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 = ( Number( thisElem.offsetWidth ) - Number( 1 ) ) + 'px';\r\n\r\n wptbDropBorderMarkerRight = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-right' );\r\n wptbDropBorderMarkerRight.style.height = ( Number( coordinatesElement.bottom ) - Number( 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_ElementOptions = function ( element, index, kindIndexProt ) {\r\n\r\n var node = element.getDOMElement(), elemIdClass;\r\n\r\n prop = document.querySelector(\".wptb-\" + element.kind + \"-options-prototype\").cloneNode(true);\r\n prop.classList.remove(\"wptb-\" + element.kind + \"-options-prototype\"); // remove prototype from the class\r\n elemIdClass = 'wptb-options-' + element.kind + \"-\" + index;\r\n\r\n var properties = prop.getElementsByClassName('wptb-element-property');\r\n\r\n for (var i = 0; i < properties.length; i++) {\r\n properties[i].dataset.element = elemIdClass;\r\n }\r\n\r\n prop.classList.add(elemIdClass);\r\n document.getElementById(\"element-options-group\").appendChild(prop);\r\n \r\n if ( kindIndexProt ) {\r\n if ( element.kind == 'button' ) {\r\n let affectedEl = document.getElementsByClassName( 'wptb-element-' + kindIndexProt )[0],\r\n wptbButtonWrapper,\r\n wptbButtonA,\r\n wptbButton,\r\n wptbSize;\r\n \r\n if ( affectedEl ) {\r\n wptbSize = affectedEl.className.match(/wptb-size-([a-z]+)/i);\r\n }\r\n \r\n if( wptbSize && Array.isArray( wptbSize ) ) {\r\n var b = prop.getElementsByClassName('wptb-btn-size-btn');\r\n \r\n for ( var i = 0; i < b.length; i++ ) {\r\n b[i].classList.remove( 'selected' );\r\n \r\n if ( b[i].innerHTML == wptbSize[1] ) {\r\n b[i].classList.add( 'selected' );\r\n }\r\n }\r\n }\r\n \r\n if( affectedEl ) {\r\n wptbButtonWrapper = affectedEl.getElementsByClassName( 'wptb-button-wrapper' );\r\n \r\n wptbButtonA = affectedEl.getElementsByTagName( 'a' );\r\n \r\n wptbButton = affectedEl.getElementsByClassName( 'wptb-button' );\r\n }\r\n \r\n if ( wptbButtonWrapper ) {\r\n let buttonAlignment = wptbButtonWrapper[0].style.justifyContent,\r\n buttonAlignmentSelect = prop.querySelector( 'select[data-type=\"button-alignment\"]' ),\r\n selectOption = buttonAlignmentSelect.getElementsByTagName( 'option' ),\r\n selectOptionVal;\r\n \r\n if ( buttonAlignment == 'flex-start' ) {\r\n selectOptionVal = 'left';\r\n } else if ( buttonAlignment == 'center' || ! buttonAlignment ) {\r\n selectOptionVal = 'center';\r\n } else if ( buttonAlignment == 'flex-end' ) {\r\n selectOptionVal = 'right';\r\n }\r\n \r\n for ( let i = 0; i < selectOption.length; i++ ) {\r\n if ( selectOption[i].value == selectOptionVal ) {\r\n selectOption[i].selected = true;\r\n }\r\n }\r\n }\r\n \r\n if ( wptbButtonA.length > 0 ) {\r\n let buttonHref = wptbButtonA[0].getAttribute( 'href' ), \r\n buttonLinkTarget = wptbButtonA[0].getAttribute( 'target' ),\r\n buttonId = wptbButtonA[0].getAttribute( 'id' ),\r\n \r\n \r\n buttonHrefInput = prop.querySelector( 'input[data-type=\"button-link\"]' ),\r\n buttonLinkTargetInput = prop.querySelector( 'input[data-type=\"button-link-target\"]' ),\r\n buttonLinkTargetInputId = buttonLinkTargetInput.getAttribute( 'id' ),\r\n buttonLinkTargetInputLabel = buttonLinkTargetInput.parentNode.getElementsByTagName( 'label' )[0],\r\n \r\n buttotIdInput = prop.querySelector( 'input[data-type=\"button-id\"]' );\r\n\r\n buttonLinkTargetInputId = buttonLinkTargetInputId + '-' + kindIndexProt.split( '-' )[1];\r\n buttonLinkTargetInput.setAttribute( 'id', buttonLinkTargetInputId );\r\n buttonLinkTargetInputLabel.setAttribute( 'for', buttonLinkTargetInputId );\r\n\r\n buttonHrefInput.value = buttonHref;\r\n\r\n if( buttonLinkTarget && buttonLinkTarget == '_blank') {\r\n buttonLinkTargetInput.checked = true;\r\n }\r\n \r\n buttotIdInput.value = buttonId;\r\n }\r\n \r\n if( wptbButton ) {\r\n let buttonTextColor = wptbButton[0].style.color,\r\n buttonColor = wptbButton[0].style.backgroundColor,\r\n buttonTextColorInput = prop.querySelector( 'input[data-type=\"button-text-color\"]' ),\r\n buttonBackgroundColorInput = prop.querySelector( 'input[data-type=\"button-color\"]' );\r\n \r\n \r\n buttonTextColorInput.value = WPTB_Helper.rgbToHex( buttonTextColor );\r\n \r\n buttonBackgroundColorInput.value = WPTB_Helper.rgbToHex( buttonColor );\r\n \r\n }\r\n } else if ( element.kind == 'image' ) {\r\n let affectedEl = document.getElementsByClassName( 'wptb-element-' + kindIndexProt );\r\n if ( affectedEl.length > 0 ) {\r\n let elementsA = affectedEl[0].getElementsByTagName( 'a' );\r\n if ( elementsA.length > 0 ) {\r\n let a = elementsA[0];\r\n\r\n if ( a ) {\r\n a.onclick = function( e ) {\r\n e.preventDefault();\r\n }\r\n // set select according to the alignment of the image\r\n let aTextAlign = a.style.textAlign,\r\n imageAlignmentSelect = prop.querySelector( 'select[data-type=\"image-alignment\"]' ),\r\n selectOption = imageAlignmentSelect.getElementsByTagName( 'option' );\r\n\r\n for ( let i = 0; i < selectOption.length; i++ ) {\r\n if ( selectOption[i].value == aTextAlign ) {\r\n selectOption[i].selected = true;\r\n }\r\n }\r\n\r\n // set text link for input field of setting panel\r\n let imageLinkHref = a.getAttribute( 'href' ),\r\n inputImageLink = prop.querySelector( 'input[data-type=\"image-link\"]' );\r\n if ( imageLinkHref ) {\r\n inputImageLink.value = imageLinkHref;\r\n }\r\n\r\n // set checkbox for target of link \r\n let imageLinkTarget = a.getAttribute( 'target' ),\r\n imageLinkTargetInput = prop.querySelector( 'input[data-type=\"image-link-target\"]' ),\r\n imageLinkTargetInputId = imageLinkTargetInput.getAttribute( 'id' ),\r\n imageLinkTargetInputLabel = imageLinkTargetInput.parentNode.getElementsByTagName( 'label' )[0];\r\n\r\n imageLinkTargetInputId = imageLinkTargetInputId + '-' + kindIndexProt.split( '-' )[1];\r\n\r\n imageLinkTargetInput.setAttribute( 'id', imageLinkTargetInputId );\r\n imageLinkTargetInputLabel.setAttribute( 'for', imageLinkTargetInputId );\r\n\r\n if ( imageLinkTarget && imageLinkTarget == '_blank' ) {\r\n imageLinkTargetInput.checked = true;\r\n }\r\n\r\n let img = a.getElementsByTagName( 'img' );\r\n if ( img.length > 0 ) {\r\n // set value for input fields of image size\r\n let imgWidth = img[0].style.width;\r\n if ( imgWidth ) {\r\n let imageWidthInputRange = prop.querySelector( 'input[type=\"range\"][data-type=\"image-size\"]' ),\r\n imageWidthInputNumber = prop.querySelector( 'input[type=\"number\"][data-type=\"image-size\"]' );\r\n\r\n imageWidthInputRange.value = parseInt( imgWidth );\r\n imageWidthInputNumber.value = parseInt( imgWidth );\r\n }\r\n\r\n // set value for input field of alternative text image\r\n let imgAlternativeText = img[0].getAttribute('alt'),\r\n imageAlternativeTextInput = prop.querySelector( 'input[type=\"text\"][data-type=\"alternative-text\"]' );\r\n\r\n imageAlternativeTextInput.value = imgAlternativeText;\r\n }\r\n }\r\n }\r\n }\r\n } else if ( element.kind == 'text' ) {\r\n let affectedEl = document.getElementsByClassName( 'wptb-element-' + kindIndexProt );\r\n if ( affectedEl.length > 0 ) {\r\n let elementFontSize = affectedEl[0].style.fontSize,\r\n elementTextColor = affectedEl[0].style.color;\r\n let textFontSizeInputRange = prop.querySelector( 'input[type=\"range\"][data-type=\"font-size\"]' ),\r\n textFontSizeInputNumber = prop.querySelector( 'input[type=\"number\"][data-type=\"font-size\"]' ),\r\n textColorInput = prop.querySelector( 'input[type=\"text\"][data-type=\"color\"]' );\r\n\r\n textFontSizeInputRange.value = parseInt( elementFontSize );\r\n textFontSizeInputNumber.value = parseInt( elementFontSize );\r\n textColorInput.value = WPTB_Helper.rgbToHex( elementTextColor );\r\n }\r\n } else if ( element.kind == 'list' ) {\r\n let elementList = document.getElementsByClassName( 'wptb-element-' + kindIndexProt );\r\n if ( elementList.length > 0 ) {\r\n let elementListColor = elementList[0].querySelector( 'p' ).style.color;\r\n let listColorInput = prop.querySelector( 'input[type=\"text\"][data-type=\"list-text-color\"]' );\r\n listColorInput.value = WPTB_Helper.rgbToHex( elementListColor );\r\n \r\n let elementListItem = elementList[0].querySelectorAll( 'li' );\r\n if ( elementListItem.length > 0 ) {\r\n let listItemP = elementListItem[0].querySelector( 'p' );\r\n let listItemPClasses = listItemP.classList;\r\n //listItemPClasses = [...listItemPClasses];\r\n if ( listItemPClasses.length > 0 ) {\r\n let elementListClassSelect = prop.querySelector( 'select[data-type=\"list-class\"]' );\r\n if ( elementListClassSelect ) {\r\n elementListClassSelect.value = 'unordered';\r\n \r\n let listIconSelectLabel = elementListClassSelect.parentNode.nextSibling;\r\n for ( let i = 0; i < 10; i++ ) {\r\n if ( listIconSelectLabel.nodeType == '1' ) {\r\n break;\r\n } else {\r\n listIconSelectLabel = listIconSelectLabel.nextSibling;\r\n }\r\n }\r\n if ( listIconSelectLabel ) {\r\n let listIconSelectLabelId = listIconSelectLabel.getAttribute( 'id' );\r\n listIconSelectLabel.setAttribute( 'id', listIconSelectLabelId + '-' + kindIndexProt );\r\n listIconSelectLabel.style.display = 'flex';\r\n }\r\n \r\n let elementListStyleTypeSelect = prop.querySelector( 'select[data-type=\"list-style-type\"]' );\r\n if ( elementListStyleTypeSelect ) {\r\n elementListStyleTypeSelect.parentNode.style.display = 'flex';\r\n \r\n if( listItemPClasses.contains( 'wptb-list-style-type-disc' ) ) {\r\n elementListStyleTypeSelect.value = 'disc';\r\n } else if( listItemPClasses.contains( 'wptb-list-style-type-circle' ) ) {\r\n elementListStyleTypeSelect.value = 'circle';\r\n } else if( listItemPClasses.contains( 'wptb-list-style-type-square' ) ) {\r\n elementListStyleTypeSelect.value = 'square';\r\n } else if ( listItemPClasses.contains( 'wptb-list-style-type-none' ) ) {\r\n elementListStyleTypeSelect.value = 'none';\r\n }\r\n }\r\n }\r\n }\r\n }\r\n \r\n let elementListItemContent = elementList[0].getElementsByClassName( 'wptb-list-item-content' );\r\n if ( elementListItemContent.length > 0 ) {\r\n let listItemPTextAlignArr = [];\r\n for ( let i = 0; i < elementListItemContent.length; i++ ) {\r\n let p = elementListItemContent[i].querySelector( 'p' );\r\n if ( p ) {\r\n if ( p.style.textAlign ) {\r\n listItemPTextAlignArr.push( p.style.textAlign );\r\n } else {\r\n listItemPTextAlignArr.push( 'left' );\r\n }\r\n }\r\n \r\n }\r\n \r\n let listItemPTextAlignLeftCount = 0,\r\n listItemPTextAlignCenterCount = 0,\r\n listItemPTextAlignRightCount = 0;\r\n \r\n if ( listItemPTextAlignArr.length > 0 ) {\r\n for ( let i = 0; i < listItemPTextAlignArr.length; i++ ) {\r\n if ( listItemPTextAlignArr[i] ) {\r\n if ( listItemPTextAlignArr[i] == 'left' ) {\r\n listItemPTextAlignLeftCount++;\r\n } else if ( listItemPTextAlignArr[i] == 'center' ) {\r\n listItemPTextAlignCenterCount++;\r\n } else if ( listItemPTextAlignArr[i] == 'right' ) {\r\n listItemPTextAlignRightCount++;\r\n }\r\n }\r\n }\r\n }\r\n \r\n let elementListAlignmentSelect = prop.querySelector( 'select[data-type=\"list-alignment\"]' ),\r\n maxListItemTAlLeftC = Math.max( listItemPTextAlignLeftCount, listItemPTextAlignCenterCount, listItemPTextAlignRightCount );\r\n \r\n if ( listItemPTextAlignLeftCount == maxListItemTAlLeftC ) {\r\n elementListAlignmentSelect.value = 'left';\r\n } else if ( listItemPTextAlignCenterCount == maxListItemTAlLeftC ) {\r\n elementListAlignmentSelect.value = 'center';\r\n } else if ( listItemPTextAlignRightCount == maxListItemTAlLeftC ) {\r\n elementListAlignmentSelect.value = 'right';\r\n }\r\n }\r\n } \r\n }\r\n }\r\n\r\n node.onclick = function () {\r\n var infArr = this.className.match(/wptb-element-((.+-)\\d+)/i),\r\n optionsClass = '.wptb-' + infArr[2] + 'options' +\r\n '.wptb-options-' + infArr[1];\r\n\r\n document.getElementsByClassName('wptb-elements-container')[0].style.display = 'none';\r\n document.getElementsByClassName('wptb-settings-section')[0].style.display = 'none';\r\n document.getElementById(\"element-options-group\").style.display = 'block';\r\n\r\n var children = document.getElementById(\"element-options-group\").childNodes;\r\n for (var 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 document.querySelector(optionsClass).style.display = 'block';\r\n\r\n //var listStyleType, textAlign;\r\n\r\n// switch (element.kind) {\r\n\r\n// case 'text':\r\n// jQuery(prop).find('[data-type=color]').wpColorPicker({ defaultColor: node.style.color });\r\n// prop.querySelector('[type=number][data-type=font-size]').value\r\n// = prop.querySelector('[type=range][data-type=font-size]').value\r\n// = node.style.fontSize.substring(0, node.style.fontSize.length - 2);\r\n// break;\r\n// case 'list':\r\n// textAlign = node.querySelector('li p').style.textAlign;\r\n// listStyleType = node.querySelector('li').style.listStyleType;\r\n// if ( prop.querySelector( 'select[data-type=list-class]' ) ) {\r\n// console.log(textAlign);\r\n// console.log(listStyleType);\r\n// console.log(listStyleType);\r\n// console.log(prop);\r\n// prop.querySelector('select[data-type=list-class]').selectedIndex = ( listStyleType == 'decimal' ? 0 : 1 );\r\n// }\r\n// if ( prop.querySelector('select[data-type=list-style-type]') ) {\r\n// prop.querySelector('select[data-type=list-style-type]').selectedIndex = (listStyleType == 'circle' ? 0 : (listStyleType == 'square' ? 1 : 2));\r\n// }\r\n// if ( prop.querySelector('select[data-type=list-alignment]') ) {\r\n// prop.querySelector('select[data-type=list-alignment]').selectedIndex = (textAlign == 'left' ? 0 : (textAlign == 'center' ? 1 : 2));\r\n// }\r\n// break;\r\n// case 'image':\r\n// break;\r\n// case 'button':\r\n// jQuery(prop).find('[data-type=button-color]').wpColorPicker({ defaultColor: node.style.backgroundColor });\r\n// break;\r\n//\r\n// }\r\n };\r\n\r\n if (element.kind == 'button') {\r\n //We must add this special kind of property, since it is triggered with click event\r\n var buttons = prop.getElementsByClassName('wptb-btn-size-btn');\r\n\r\n for (var i = 0; i < buttons.length; i++) {\r\n buttons[i].onclick = function () {\r\n var size = this.innerHTML,\r\n n_Class = this.dataset.element,\r\n infArr = n_Class.match(/wptb-options-(.+)-(\\d+)/i),\r\n type = infArr[1],\r\n num = infArr[2],\r\n affectedEl = document.getElementsByClassName('wptb-element-' + type + '-' + num)[0];\r\n affectedEl.classList.remove('wptb-size-S');\r\n affectedEl.classList.remove('wptb-size-M');\r\n affectedEl.classList.remove('wptb-size-L');\r\n affectedEl.classList.remove('wptb-size-XL');\r\n affectedEl.classList.add('wptb-size-' + size);\r\n var b = this.parentNode.getElementsByClassName('wptb-btn-size-btn');\r\n for (var i = 0; i < b.length; i++) {\r\n b[i].classList.remove('selected');\r\n }\r\n this.classList.add('selected');\r\n }\r\n }\r\n }\r\n\r\n var optionControls = prop.getElementsByClassName('wptb-element-property');\r\n\r\n for (var i = 0; i < optionControls.length; i++) {\r\n if (optionControls[i].classList.contains('wptb-color-picker')) {\r\n jQuery(optionControls[i]).wpColorPicker({\r\n change: function (event, ui) {\r\n var parent = event.target, 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 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 = ui.color.toString();\r\n } else {\r\n affectedEl.getElementsByClassName('wptb-button')[0].style.backgroundColor = ui.color.toString();\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 = ui.color.toString();\r\n }\r\n }\r\n } else {\r\n affectedEl.style.color = ui.color.toString();\r\n }\r\n }\r\n });\r\n }\r\n\r\n if (optionControls[i].dataset.type === 'font-size') {\r\n var slider = optionControls[i].parentNode.parentNode.getElementsByClassName('wptb-text-font-size-slider')[0];\r\n slider.oninput = function () {\r\n this.parentNode.parentNode.getElementsByClassName('wptb-text-font-size-number')[0].value = this.value;\r\n this.parentNode.parentNode.getElementsByClassName('wptb-text-font-size-number')[0].onchange();\r\n }\r\n }\r\n\r\n if (optionControls[i].dataset.type === 'image-size') {\r\n var slider = optionControls[i].parentNode.parentNode.getElementsByClassName('wptb-image-size-slider')[0];\r\n slider.oninput = function () {\r\n this.parentNode.parentNode.getElementsByClassName('wptb-image-width-number')[0].value = this.value;\r\n this.parentNode.parentNode.getElementsByClassName('wptb-image-width-number')[0].onchange();\r\n }\r\n }\r\n\r\n optionControls[i].onchange = function (event) {\r\n\r\n var n_Class = this.dataset.element,\r\n infArr = n_Class.match(/wptb-options-(.+)-(\\d+)/i),\r\n type = infArr[1],\r\n num = infArr[2],\r\n affectedEl = document.getElementsByClassName('wptb-element-' + type + '-' + num)[0],\r\n val = this.value;\r\n\r\n switch (this.dataset.type) {\r\n case 'src':\r\n var img = affectedEl.getElementsByTagName(\"img\")[0];\r\n img.src = this.value;\r\n break;\r\n case 'alternative-text':\r\n var img = affectedEl.getElementsByTagName('img')[0];\r\n img.alt = this.value;\r\n break;\r\n case 'image-link':\r\n affectedEl.getElementsByTagName('a')[0].href = WPTB_Helper.linkHttpCheckChange( this.value );\r\n break;\r\n case 'image-link-target':\r\n if (this.checked == true) {\r\n affectedEl.getElementsByTagName('a')[0].target = '_blank';\r\n } else {\r\n affectedEl.getElementsByTagName('a')[0].target = '_self';\r\n }\r\n break;\r\n case 'image-link-nofollow':\r\n if (this.checked == true) {\r\n affectedEl.getElementsByTagName('a')[0].rel = 'nofollow';\r\n } else {\r\n affectedEl.getElementsByTagName('a')[0].removeAttribute('rel');\r\n }\r\n break;\r\n case 'image-size':\r\n affectedEl.getElementsByTagName('a')[0].style.width = this.value + '%';\r\n affectedEl.getElementsByTagName('a')[0].style.height = 'auto';\r\n this.parentNode.parentNode.getElementsByClassName('wptb-image-size-slider')[0].value = this.value;\r\n break;\r\n case 'image-alignment':\r\n affectedEl.getElementsByClassName( 'wptb-image-wrapper' )[0].style.textAlign = this.value;\r\n break;\r\n case 'font-size':\r\n affectedEl.style.fontSize = val + 'px';\r\n break;\r\n case 'button-alignment':\r\n var jc = '';\r\n if (this.value == 'left') {\r\n jc = 'start';\r\n } else if (this.value == 'right') {\r\n jc = 'flex-end';\r\n } else {\r\n jc = 'center';\r\n }\r\n affectedEl.getElementsByClassName('wptb-button-wrapper')[0].style.justifyContent = jc;\r\n break;\r\n case 'button-link':\r\n if ( this.value ) {\r\n affectedEl.getElementsByTagName( 'a' )[0].href = WPTB_Helper.linkHttpCheckChange( this.value );\r\n } else {\r\n affectedEl.getElementsByTagName( 'a' )[0].removeAttribute( 'href' );\r\n }\r\n break;\r\n case 'button-link-target':\r\n if (this.checked == true) {\r\n affectedEl.getElementsByTagName('a')[0].target = '_blank';\r\n } else {\r\n affectedEl.getElementsByTagName('a')[0].target = '_self';\r\n }\r\n break;\r\n case 'button-link-nofollow':\r\n if (this.checked == true) {\r\n affectedEl.getElementsByTagName('a')[0].rel = 'nofollow';\r\n } else {\r\n affectedEl.getElementsByTagName('a')[0].removeAttribute( 'rel' );\r\n }\r\n break;\r\n case 'button-id':\r\n if( this.value ) {\r\n affectedEl.getElementsByTagName( 'a' )[0].id = this.value;\r\n } else {\r\n affectedEl.getElementsByTagName( 'a' )[0].removeAttribute( 'id' );\r\n }\r\n case 'button-color':\r\n break;\r\n case 'list-alignment':\r\n let listItems = affectedEl.querySelectorAll('li');\r\n for (var i = 0; i < listItems.length; i++) {\r\n let p = listItems[i].querySelector( 'p' );\r\n if ( p ) {\r\n p.style.textAlign = this.value;\r\n }\r\n }\r\n break;\r\n case 'list-class':\r\n let parentNode = event.target\r\n .parentNode\r\n .parentNode\r\n .querySelector('[data-type=list-style-type]')\r\n .parentNode,\r\n parentNodeSettingItem = parentNode.parentNode;\r\n if (val == 'unordered') {\r\n parentNode.style.display = 'flex';\r\n \r\n parentNodeSettingItem.querySelector( '.wptb-list-icon-select-label' ).style.display = 'flex';\r\n let listItem = affectedEl.querySelectorAll('li');\r\n for (var i = 0; i < listItem.length; i++) {\r\n let p = listItem[i].querySelector( 'p' );\r\n p.removeAttribute ( 'class' );\r\n p.classList.add( 'wptb-list-style-type-disc' );\r\n }\r\n parentNodeSettingItem.querySelector('[data-type=list-style-type]').value = 'disc';\r\n } else {\r\n parentNode.style.display = 'none';\r\n parentNodeSettingItem.querySelector( '.wptb-list-icon-select-label' ).style.display = 'none';\r\n var listItem = affectedEl.querySelectorAll('li');\r\n for (var i = 0; i < listItem.length; i++) {\r\n let p = listItem[i].querySelector( 'p' );\r\n p.removeAttribute ( 'class' );\r\n }\r\n }\r\n break;\r\n case 'list-style-type':\r\n var listItem = affectedEl.querySelectorAll('li');\r\n for (var i = 0; i < listItem.length; i++) {\r\n let p = listItem[i].querySelector( 'p' );\r\n p.removeAttribute ( 'class' );\r\n p.classList.add( 'wptb-list-style-type-' + val.toLowerCase() );\r\n }\r\n break;\r\n }\r\n }\r\n }\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 var rgb = rgb.match( /^rgba?[\\s+]?\\([\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?/i );\r\n\r\n return ( rgb && rgb.length === 4 ) ? \"#\" +\r\n ( \"0\" + parseInt( rgb[1],10 ).toString( 16 )).slice( -2 ) +\r\n ( \"0\" + parseInt( rgb[2],10 ).toString( 16 )).slice( -2 ) +\r\n ( \"0\" + parseInt( rgb[3],10 ).toString( 16 )).slice( -2 ) : '';\r\n },\r\n getDragImageCustom: function ( type ) {\r\n let hostName = location.protocol + '//' + location.hostname;\r\n let img = document.createElement( 'img' );\r\n img.src = hostName + '/wp-content/plugins/wp-table-builder/inc/admin/views/builder/icons/' + type + '.png';\r\n return img;\r\n },\r\n dragImagesArr: function() {\r\n return {\r\n text: WPTB_Helper.getDragImageCustom( 'text' ),\r\n image: WPTB_Helper.getDragImageCustom( 'image' ),\r\n button: WPTB_Helper.getDragImageCustom( 'button' ),\r\n list: WPTB_Helper.getDragImageCustom( 'list' )\r\n };\r\n },\r\n listItemsRecalculateIndex: function( ulElem ) {\r\n let par = ulElem.querySelectorAll( 'p' );\r\n if ( par.length > 0 ) {\r\n for ( let i = 0; i < par.length; i++ ) {\r\n par[i].dataset.listStyleTypeIndex = Number( i ) + 1 + '.';\r\n }\r\n }\r\n },\r\n listItemsTinyMceInit: function( listItem ) {\r\n tinyMCE.init({\r\n target: listItem,\r\n inline: true,\r\n plugins: \"link, paste\",\r\n dialog_type: \"modal\",\r\n theme: 'modern',\r\n menubar: false,\r\n fixed_toolbar_container: '#wpcd_fixed_toolbar',\r\n paste_as_text: true,\r\n toolbar: 'bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify',\r\n setup: function(ed) {\r\n ed.on('keydown', function(e) {\r\n let article = e.target.parentNode;\r\n if ( e.keyCode == 13 ) {\r\n e.preventDefault();\r\n let text = e.target.innerHTML;\r\n let duplicate = new WPTB_ListItem( text, article, true );\r\n \r\n article.parentNode.insertBefore( duplicate.getDOMElement(), article );\r\n WPTB_Helper.listItemsTinyMceInit( duplicate.getDOMElement().firstChild );\r\n e.target.querySelector( 'p' ).innerText = 'New List Item';\r\n //tinyMCE.execCommand('mceInsertContent', false, 'New List Item');\r\n WPTB_Helper.listItemsRecalculateIndex( article.parentNode );\r\n \r\n } else if ( e.keyCode == '8' || e.keyCode == '46' ) {\r\n let p = e.target.querySelector( 'p' );\r\n let pText = p.innerHTML.replace(/<[^>]+>/g, '');\r\n pText = pText.replace( /\\s+/g, ' ' ).trim();\r\n pText = pText.replace( / /g, '').trim();\r\n \r\n if( pText == '' ) {\r\n e.preventDefault();\r\n e.target.querySelector( 'p' ).innerText = '\\n';\r\n } else {\r\n let selectedText = WPTB_Helper.getSelectionText();\r\n selectedText = selectedText.replace( /\\s+/g, ' ' ).trim();\r\n selectedText = selectedText.replace( / /g, '' ).trim();\r\n if( selectedText == pText ) {\r\n e.preventDefault();\r\n e.target.querySelector( 'p' ).innerText = '\\n';\r\n }\r\n }\r\n }\r\n });\r\n \r\n ed.on( 'keyup', function( e ) {\r\n \r\n });\r\n },\r\n init_instance_callback: function (editor) {\r\n window.currentEditor = editor;\r\n editor.on('focus', function (e) {\r\n var totalWidth = document.getElementsByClassName('wptb-builder-panel')[0].offsetWidth;\r\n if (window.currentEditor &&\r\n document.getElementById('wptb_builder').scrollTop >= 55 &&\r\n window.currentEditor.bodyElement.style.display != 'none') {\r\n document.getElementById('wpcd_fixed_toolbar').style.position = 'fixed';\r\n document.getElementById('wpcd_fixed_toolbar').style.right = (totalWidth / 2 - document.getElementById('wpcd_fixed_toolbar').offsetWidth / 2) + 'px';\r\n document.getElementById('wpcd_fixed_toolbar').style.top = '100px';\r\n } else {\r\n document.getElementById('wpcd_fixed_toolbar').style.position = 'static';\r\n delete document.getElementById('wpcd_fixed_toolbar').style.right;\r\n delete document.getElementById('wpcd_fixed_toolbar').style.top;\r\n }\r\n });\r\n }\r\n });\r\n },\r\n buttonsTinyMceInit: function( target ) {\r\n tinyMCE.init({\r\n target: target,\r\n inline: true,\r\n plugins: \"link\",\r\n dialog_type: \"modal\",\r\n theme: 'modern',\r\n menubar: false,\r\n fixed_toolbar_container: '#wpcd_fixed_toolbar',\r\n toolbar: 'bold italic strikethrough',\r\n setup : function(ed) {\r\n ed.on('keydown', function(e) {\r\n if (e.keyCode == 13) {\r\n e.preventDefault();\r\n }\r\n });\r\n },\r\n init_instance_callback: function (editor) {\r\n window.currentEditor = editor;\r\n editor.on('focus', function (e) {\r\n var totalWidth = document.getElementsByClassName('wptb-builder-panel')[0].offsetWidth;\r\n if (window.currentEditor &&\r\n document.getElementById('wptb_builder').scrollTop >= 55 &&\r\n window.currentEditor.bodyElement.style.display != 'none') {\r\n document.getElementById('wpcd_fixed_toolbar').style.position = 'fixed';\r\n document.getElementById('wpcd_fixed_toolbar').style.right = (totalWidth / 2 - document.getElementById('wpcd_fixed_toolbar').offsetWidth / 2) + 'px';\r\n document.getElementById('wpcd_fixed_toolbar').style.top = '100px';\r\n } else {\r\n document.getElementById('wpcd_fixed_toolbar').style.position = 'static';\r\n delete document.getElementById('wpcd_fixed_toolbar').style.right;\r\n delete document.getElementById('wpcd_fixed_toolbar').style.top;\r\n }\r\n });\r\n }\r\n });\r\n },\r\n linkHttpCheckChange: function( link ) {\r\n if ( link ) {\r\n 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 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 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 = '';\r\n thisRowChildren[j].dataset.wptbTitleColumnFontSize = '';\r\n thisRowChildren[j].dataset.wptbTitleColumnColor = '';\r\n thisRowChildren[j].dataset.wptbTitleBackgroundColor = '';\r\n thisRowChildren[j].dataset.wptbTitleAlign = '';\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 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 settingsPanelClear: function() {\r\n document.getElementById( 'wptb-top-row-as-header' ).checked = false;\r\n document.getElementById( 'wptb-table-border-slider' ).value = 0;\r\n document.getElementById( 'wptb-table-border-number' ).value = 0;\r\n document.getElementById( 'wptb-inner-border-check' ).checked = false;\r\n document.getElementById( 'wptb-apply-inner-border' ).classList.remove( 'visible' );\r\n document.getElementById( 'wptb-table-inner-border-slider' ).value = 1;\r\n document.getElementById( 'wptb-table-inner-border-number' ).value = 1;\r\n \r\n WPTB_Helper.wpColorPickerClear( 'wptb-table-border-color' );\r\n \r\n WPTB_Helper.wpColorPickerClear( 'wptb-table-header-bg' );\r\n \r\n WPTB_Helper.wpColorPickerClear( 'wptb-even-row-bg' );\r\n \r\n WPTB_Helper.wpColorPickerClear( 'wptb-odd-row-bg' );\r\n \r\n document.getElementById( 'wptb-table-cell-slider' ).value = 15;\r\n document.getElementById( 'wptb-table-cell-number' ).value = 15;\r\n },\r\n wpColorPickerClear: function( inputId ) {\r\n let input = document.getElementById( inputId );\r\n let wpPickerContainer = WPTB_Helper.findAncestor( input, 'wp-picker-container' );\r\n let parent = wpPickerContainer.parentNode;\r\n parent.removeChild( wpPickerContainer );\r\n let newInput = document.createElement( 'input' );\r\n newInput.setAttribute( 'id', inputId );\r\n newInput.value = \"\";\r\n parent.appendChild( newInput );\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}\r\n","var WPTB_Image = function ( src, DOMElementProt ) {\r\n let DOMElement,\r\n elImage,\r\n kindIndexProt = undefined,\r\n copy = false;\r\n if ( DOMElementProt == undefined ) {\r\n DOMElement = document.createElement( 'div' );\r\n elImage = document.createElement( 'div' );\r\n\t let anchor = document.createElement( 'a' ),\r\n\t img = document.createElement( 'img' );\r\n anchor.style.display = 'inline-block';\r\n anchor.appendChild( img );\r\n DOMElement.classList.add( 'wptb-image-container' );\r\n elImage.classList.add( 'wptb-image-wrapper' );\r\n elImage.appendChild( anchor );\r\n DOMElement.appendChild( elImage );\r\n \r\n anchor.onclick = function( e ) {\r\n e.preventDefault();\r\n }\r\n \r\n file_frame = wp.media.frames.file_frame = wp.media({\r\n\t\ttitle: 'Select a image to upload',\r\n\t\tbutton: {\r\n\t\t\ttext: 'Use this image'\r\n\t\t},\r\n\t\tmultiple: false\r\n });\r\n // When an image is selected, run a callback.\r\n file_frame.on('select', function () {\r\n attachment = file_frame.state().get('selection').first().toJSON();\r\n img.src = attachment.url;\r\n });\r\n // Finally, open the modal\r\n if (src == undefined) {\r\n file_frame.open();\r\n } else {\r\n img.src = src;\r\n }\r\n } else {\r\n DOMElement = DOMElementProt.cloneNode( true );\r\n \r\n DOMElement.getElementsByTagName( 'a' )[0].onclick = function(e) {\r\n e.preventDefault();\r\n };\r\n \r\n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\r\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\r\n kindIndexProt = wptbElementMutch[1];\r\n copy = true;\r\n };\r\n }\r\n \r\n this.kind = 'image';\r\n this.getDOMElement = function () {\r\n return DOMElement;\r\n };\r\n\tapplyGenericItemSettings( this, kindIndexProt, copy );\r\n\r\n\treturn this;\r\n};","var WPTB_Initializer = function () {\r\n\r\n const MIN_COLUMNS = 1,\r\n MIN_ROWS = 1,\r\n MAX_COLUMNS = 10,\r\n MAX_ROWS = 10;\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 WPTB_Table(columns, rows);\r\n }\r\n \r\n// if( document.getElementsByClassName( 'wptb-preview-table' ).length == 0 ) {\r\n// WPTB_LeftPanel();\r\n// }\r\n\r\n};\r\n","var WPTB_innerElementSet = function ( element ) {\n \n function newElementProxy(el) {\n if (el == 'list') {\n return new WPTB_List();\n } else if (el == 'image') {\n return new WPTB_Image();\n } else if (el == 'text') {\n return new WPTB_Text();\n } else if (el == 'button') {\n return new WPTB_Button();\n }\n }\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 = 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 == 'Abowe 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 let thisRow = td.parentNode\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\n WPTB_Helper.dataTitleColumnSet( table );\n }\n \n } else {\n return;\n }\n \n wptbDropHandle.style.display = 'none';\n wptbDropBorderMarker.style.display = 'none';\n\n WPTB_innerElementSet( element );\n\n return true;\n }\n element.onmouseover = function(e) {\n element.classList.remove( 'wptb-ondragenter' );\n }\n}","var WPTB_LeftPanel = function () {\r\n\r\n var table = document.getElementsByClassName('wptb-preview-table')[0],\r\n wptbElementButtons = document.getElementsByClassName('wptb-element');\r\n \r\n function wptbTdBgColorSavedSet( inputId, trNumber ) {\r\n if ( trNumber > 3 ) return;\r\n if( table ) {\r\n let tableRows = table.getElementsByTagName('tr');\r\n if ( tableRows.length > trNumber ) {\r\n let trBackgroundColor = tableRows[trNumber].style.backgroundColor;\r\n var wptbEvenRowBg = document.getElementById(inputId);\r\n if ( wptbEvenRowBg && trBackgroundColor ) {\r\n wptbEvenRowBg.value = WPTB_Helper.rgbToHex( trBackgroundColor );\r\n }\r\n }\r\n }\r\n \r\n }\r\n \r\n wptbTdBgColorSavedSet( 'wptb-even-row-bg', 1 );\r\n jQuery('#wptb-even-row-bg').wpColorPicker({\r\n change: function ( event, ui ) {\r\n var tableRows = table.getElementsByTagName('tr');\r\n for ( let i = 1; i < tableRows.length; i += 2 ) {\r\n tableRows[i].style.backgroundColor = ui.color.toString();\r\n }\r\n },\r\n clear: function(){\r\n var tableRows = table.getElementsByTagName('tr');\r\n for ( let i = 1; i < tableRows.length; i += 2 ) {\r\n tableRows[i].style.backgroundColor = '';\r\n let tds = tableRows[i].getElementsByTagName('td');\r\n for ( let j = 0; j < tds.length; j++ ) {\r\n tds[j].style.backgroundColor = '';\r\n }\r\n }\r\n },\r\n\r\n });\r\n \r\n wptbTdBgColorSavedSet( 'wptb-odd-row-bg', 2 );\r\n jQuery('#wptb-odd-row-bg').wpColorPicker({\r\n change: function ( event, ui ) {\r\n var tableRows = table.getElementsByTagName('tr');\r\n for ( let i = 2; i < tableRows.length; i += 2 ) {\r\n tableRows[i].style.backgroundColor = ui.color.toString();\r\n }\r\n },\r\n clear: function(){\r\n var tableRows = table.getElementsByTagName('tr');\r\n for ( let i = 2; i < tableRows.length; i += 2 ) {\r\n tableRows[i].style.backgroundColor = '';\r\n let tds = tableRows[i].getElementsByTagName( 'td' );\r\n for ( var j = 0; j < tds.length; j++ ) {\r\n tds[j].style.backgroundColor = '';\r\n }\r\n }\r\n },\r\n });\r\n \r\n wptbTdBgColorSavedSet( 'wptb-table-header-bg', 0 );\r\n jQuery('#wptb-table-header-bg').wpColorPicker({\r\n change: function (event, ui) {\r\n var tableHeader = table.getElementsByTagName('tr')[0];\r\n tableHeader.style.backgroundColor = ui.color.toString();\r\n },\r\n clear: function(){\r\n var tableHeader = table.getElementsByTagName('tr')[0];\r\n tableHeader.style.backgroundColor = '';\r\n let tds = tableHeader.getElementsByTagName('td');\r\n for (var j = 0; j < tds.length; j++) {\r\n tds[j].style.backgroundColor = '';\r\n }\r\n },\r\n });\r\n \r\n function tableTopRowAsHeadSavedSet( table ) {\r\n let wptbTopRowAsHeader = document.getElementById( 'wptb-top-row-as-header' );\r\n \r\n if( table && table.classList.contains( 'wptb-table-preview-head' ) ) {\r\n wptbTopRowAsHeader.checked = true;\r\n } else {\r\n wptbTopRowAsHeader.checked = false;\r\n }\r\n }\r\n tableTopRowAsHeadSavedSet( table );\r\n \r\n function tableBorderColorWidthSavedSet() {\r\n let table = document.getElementsByClassName('wptb-preview-table');\r\n if ( table.length > 0 ) {\r\n let tableBorderColor = table[0].style.borderColor;\r\n if ( tableBorderColor ) {\r\n let tableBorderColorInput = document.getElementById( 'wptb-table-border-color' );\r\n if ( tableBorderColorInput ) {\r\n tableBorderColorInput.value = WPTB_Helper.rgbToHex( tableBorderColor );\r\n }\r\n }\r\n \r\n let tableBorderWidth = table[0].style.borderWidth;\r\n if ( tableBorderWidth ) {\r\n let wptbTableBorderWidthSlider = document.getElementById('wptb-table-border-slider'),\r\n wptbTableBorderWidthNumber = document.getElementById('wptb-table-border-number');\r\n \r\n if ( wptbTableBorderWidthSlider ) {\r\n wptbTableBorderWidthSlider.value = parseInt( tableBorderWidth );\r\n }\r\n if ( wptbTableBorderWidthNumber ) {\r\n wptbTableBorderWidthNumber.value = parseInt( tableBorderWidth );\r\n }\r\n }\r\n \r\n \r\n let tableTd = table[0].querySelector( 'td' );\r\n let applyInnerBorder = tableTd.style.borderWidth;\r\n if ( applyInnerBorder ) {\r\n let innerBorderCheckInput = document.getElementById( 'wptb-inner-border-check' );\r\n let wptbApplyInnerBorder = document.getElementById( 'wptb-apply-inner-border' );\r\n if ( applyInnerBorder && parseInt( applyInnerBorder ) > 0 ) {\r\n if ( innerBorderCheckInput ) {\r\n innerBorderCheckInput.checked = true;\r\n \r\n if ( wptbApplyInnerBorder ) {\r\n wptbApplyInnerBorder.classList.add( 'visible' );\r\n let wptbTableInnerBorderSlider = document.getElementById( 'wptb-table-inner-border-slider' );\r\n let wptbTableInnerBorderNumber = document.getElementById( 'wptb-table-inner-border-number' );\r\n wptbTableInnerBorderSlider.value = parseInt( applyInnerBorder );\r\n wptbTableInnerBorderNumber.value = parseInt( applyInnerBorder );\r\n }\r\n }\r\n } else {\r\n innerBorderCheckInput.checked = false;\r\n }\r\n }\r\n \r\n if ( ( tableBorderWidth && parseInt( tableBorderWidth ) > 0 ) || ( applyInnerBorder && parseInt( applyInnerBorder ) > 0 ) ) {\r\n document.getElementById( 'wptb-table-border-color-set-area' ).style.display = '';\r\n }\r\n }\r\n }\r\n \r\n tableBorderColorWidthSavedSet();\r\n\r\n jQuery('#wptb-table-border-color').wpColorPicker({\r\n change: function (event, ui) {\r\n var tableCells = table.getElementsByTagName('td');\r\n table.style.border = document.querySelector('#wptb-table-border-number').value + 'px solid ' + ui.color.toString();\r\n\r\n for (var i = 0; i < tableCells.length; i++) {\r\n let tableInnerborderNumber = document.querySelector('#wptb-table-inner-border-number').value;\r\n if ( document.getElementById('wptb-inner-border-check').checked ) {\r\n tableCells[i].style.border = ( tableInnerborderNumber != 0 ? tableInnerborderNumber : 1 ) + 'px solid ' + ui.color.toString();\r\n }\r\n }\r\n },\r\n clear: function() {\r\n var tableCells = table.getElementsByTagName('td');\r\n table.style.borderColor = '';\r\n\r\n for (var i = 0; i < tableCells.length; i++) {\r\n tableCells[i].style.borderColor = '';\r\n }\r\n }\r\n });\r\n\r\n function addInnerBorderSize(value) {\r\n var tableCells = table.getElementsByTagName('td');\r\n for (var i = 0; i < tableCells.length; i++) {\r\n tableCells[i].style.borderWidth = document.querySelector('#wptb-table-inner-border-number').value + 'px';\r\n tableCells[i].style.borderStyle = 'solid';\r\n }\r\n }\r\n\r\n function addCellPadding(value) {\r\n var tableCells = table.getElementsByTagName('td');\r\n for (var i = 0; i < tableCells.length; i++) {\r\n tableCells[i].style.padding = value + 'px';\r\n }\r\n }\r\n\r\n function addInnerBorder( checked ) {\r\n var styles, color = document.querySelector('#wptb-table-border-color').value != undefined ?\r\n document.querySelector('#wptb-table-border-color').value : 'rgb(0,0,0)';\r\n if ( document.querySelector( '#wptb-table-inner-border-slider' ).value == 0 || document.querySelector( '#wptb-table-inner-border-number' ).value == 0 ) {\r\n document.querySelector( '#wptb-table-inner-border-slider' ).value = 1;\r\n document.querySelector( '#wptb-table-inner-border-number' ).value = 1;\r\n }\r\n let width = document.querySelector( '#wptb-table-inner-border-slider' ).value + 'px';\r\n let wptbPreviewTable = document.getElementsByClassName('wptb-preview-table');\r\n if( wptbPreviewTable.length > 0 ) {\r\n if (checked == 'checked') {\r\n document.getElementById('wptb-apply-inner-border').style.marginBottom = '0px';\r\n var tableCells = wptbPreviewTable[0].getElementsByTagName( 'td' );\r\n for (var i = 0; i < tableCells.length; i++) {\r\n tableCells[i].style.border = width + ' solid ' + color;\r\n }\r\n document.getElementById( 'wptb-apply-inner-border' ).classList.add( 'visible' );\r\n } else {\r\n document.getElementById( 'wptb-apply-inner-border' ).classList.remove( 'visible' );\r\n var tableCells = wptbPreviewTable[0].getElementsByTagName( 'td' );\r\n for (var i = 0; i < tableCells.length; i++) {\r\n tableCells[i].style.border = '0px solid ' + color;\r\n tableCells[i].style.border = null;\r\n }\r\n }\r\n }\r\n \r\n }\r\n\r\n function addBorderSize( value ) {\r\n table.style.borderWidth = value + 'px';\r\n table.style.borderStyle = 'solid';\r\n }\r\n \r\n function cellPaddingSavedSet() {\r\n let table = document.getElementsByClassName('wptb-preview-table');\r\n \r\n if ( table.length > 0 ) {\r\n let td = table[0].querySelector( 'td' );\r\n \r\n if ( td ) {\r\n let padding = td.style.padding;\r\n \r\n if ( padding ) {\r\n let wptbTableCellSlider = document.getElementById('wptb-table-cell-slider'),\r\n wptbTableCellNumber = document.getElementById('wptb-table-cell-number');\r\n \r\n if ( wptbTableCellSlider ) {\r\n wptbTableCellSlider.value = parseInt( padding );\r\n }\r\n if ( wptbTableCellNumber ) {\r\n wptbTableCellNumber.value = parseInt( padding );\r\n }\r\n }\r\n }\r\n }\r\n }\r\n \r\n cellPaddingSavedSet();\r\n \r\n function numberImputSize( 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 thisValue = String( thisValue );\r\n if ( thisValue > maxValue ) {\r\n this.value = maxValue;\r\n }\r\n }\r\n }\r\n \r\n let wptbTableBorderNumber = document.getElementById( 'wptb-table-border-number' );\r\n numberImputSize( wptbTableBorderNumber, 1, 50 );\r\n \r\n let wptbTableInnerBorderNumber = document.getElementById( 'wptb-table-inner-border-number' );\r\n numberImputSize( wptbTableInnerBorderNumber, 1, 50 );\r\n \r\n let wptbTableCellNumber = document.getElementById( 'wptb-table-cell-number' );\r\n numberImputSize( wptbTableCellNumber, 1, 50 );\r\n \r\n let wptbTextfontSizeNumber = document.getElementById( 'wptb-text-font-size-number' );\r\n numberImputSize( wptbTextfontSizeNumber, 1, 50 );\r\n \r\n let wptbImageWidthNumber = document.getElementById( 'wptb-image-width-number' );\r\n numberImputSize( wptbImageWidthNumber, 2, 100 );\r\n \r\n let wptbTableColumnWidthNumber = document.getElementById( 'wptb-table-column-width-number' );\r\n numberImputSize( wptbTableColumnWidthNumber, 2, 500 );\r\n \r\n let wptbTableRowHeightNumber = document.getElementById( 'wptb-table-row-height-number' );\r\n numberImputSize( wptbTableRowHeightNumber, 2, 200 );\r\n \r\n \r\n \r\n document.getElementById('wptb-table-cell-slider').oninput = function () {\r\n document.getElementById('wptb-table-cell-number').value = this.value;\r\n addCellPadding(this.value);\r\n table.tdDefaultWidth();\r\n };\r\n\r\n document.getElementById('wptb-table-cell-number').onchange = function () {\r\n document.getElementById('wptb-table-cell-slider').value = this.value;\r\n addCellPadding(this.value);\r\n table.tdDefaultWidth();\r\n };\r\n\r\n document.getElementById('wptb-table-border-slider').oninput = function () {\r\n document.getElementById('wptb-table-border-number').value = this.value;\r\n addBorderSize(this.value);\r\n table.tdDefaultWidth();\r\n \r\n let wptbInnerBorderCheck = document.getElementById('wptb-inner-border-check').checked,\r\n tableBorderColorSetArea = document.getElementById( 'wptb-table-border-color-set-area' );\r\n if ( this.value == 0 && wptbInnerBorderCheck == false ) {\r\n tableBorderColorSetArea.style.display = 'none';\r\n } else {\r\n tableBorderColorSetArea.style.display = '';\r\n }\r\n };\r\n\r\n document.getElementById('wptb-table-border-number').onchange = function () {\r\n document.getElementById('wptb-table-border-slider').value = this.value;\r\n addBorderSize(this.value);\r\n table.tdDefaultWidth();\r\n };\r\n\r\n document.getElementById('wptb-table-inner-border-slider').oninput = function () {\r\n document.getElementById('wptb-table-inner-border-number').value = this.value;\r\n addInnerBorderSize(this.value);\r\n table.tdDefaultWidth();\r\n };\r\n\r\n document.getElementById('wptb-table-inner-border-number').onchange = function () {\r\n document.getElementById('wptb-table-inner-border-slider').value = this.value;\r\n addInnerBorderSize(this.value);\r\n table.tdDefaultWidth();\r\n };\r\n\r\n document.getElementById('wptb-inner-border-check').onchange = function () {\r\n if( table ) {\r\n let val = this.checked ? 'checked' : 'unchecked';\r\n addInnerBorder( val );\r\n let borderWidth = document.getElementById('wptb-table-border-slider').value,\r\n tableBorderColorSetArea = document.getElementById( 'wptb-table-border-color-set-area' );\r\n if( val == 'unchecked' && borderWidth == 0 ) {\r\n tableBorderColorSetArea.style.display = 'none';\r\n } else {\r\n tableBorderColorSetArea.style.display = '';\r\n }\r\n }\r\n \r\n };\r\n \r\n document.getElementById( 'wptb-table-column-width-slider' ).oninput = function () {\r\n document.getElementById( 'wptb-table-column-width-number' ).value = this.value;\r\n table.addColumnWidth( this.value );\r\n };\r\n \r\n document.getElementById( 'wptb-table-column-width-number' ).onchange = function () {\r\n document.getElementById( 'wptb-table-column-width-slider' ).value = this.value;\r\n table.addColumnWidth( this.value );\r\n };\r\n \r\n document.getElementById( 'wptb-table-column-width-auto-fixed' ).onchange = function () {\r\n if( this.checked ) {\r\n let highlighted = table.querySelector( '.wptb-highlighted' );\r\n let width = WPTB_Helper.getColumnWidth( table, highlighted );\r\n table.addColumnWidth( width );\r\n } else {\r\n table.addColumnWidth( false, true );\r\n let highlighted = table.querySelector( '.wptb-highlighted' );\r\n let width = WPTB_Helper.getColumnWidth( table, highlighted );\r\n document.getElementById( 'wptb-table-column-width-number' ).value = width;\r\n document.getElementById( 'wptb-table-column-width-slider' ).value = width;\r\n }\r\n };\r\n\r\n document.getElementById( 'wptb-table-row-height-slider' ).oninput = function () {\r\n document.getElementById( 'wptb-table-row-height-number' ).value = this.value;\r\n table.addRowHeight( this.value );\r\n };\r\n\r\n document.getElementById( 'wptb-table-row-height-number' ).onchange = function () {\r\n document.getElementById( 'wptb-table-row-height-slider' ).value = this.value;\r\n table.addRowHeight( this.value );\r\n };\r\n \r\n document.getElementById( 'wptb-table-row-height-auto-fixed' ).onchange = function () {\r\n if( this.checked ) {\r\n let highlighted = table.querySelector( '.wptb-highlighted' );\r\n let height = WPTB_Helper.getRowHeight( table, highlighted );\r\n table.addRowHeight( height );\r\n } else {\r\n table.addRowHeight( false, true );\r\n let highlighted = table.querySelector( '.wptb-highlighted' );\r\n let height = WPTB_Helper.getRowHeight( table, highlighted );\r\n document.getElementById( 'wptb-table-row-height-number' ).value = height;\r\n document.getElementById( 'wptb-table-row-height-slider' ).value = height;\r\n }\r\n };\r\n \r\n function createMobileHeadForTable( table, thisEvent ) {\r\n \r\n if( thisEvent.checked ) {\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n \r\n table.classList.add( 'wptb-table-preview-head' );\r\n table.rows[0].classList.add( 'wptb-table-head' );\r\n } else {\r\n let rows = table.rows;\r\n table.classList.remove( 'wptb-table-preview-head' );\r\n rows[0].classList.remove( 'wptb-table-head' );\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 thisRowChildren[j].removeAttribute( 'data-wptb-title-column' );\r\n thisRowChildren[j].removeAttribute( 'data-wptb-title-column-font-size' );\r\n thisRowChildren[j].removeAttribute( 'data-wptb-title-column-color' );\r\n thisRowChildren[j].removeAttribute( 'data-wptb-title-background-color' );\r\n thisRowChildren[j].removeAttribute( 'data-wptb-title-align' );\r\n }\r\n }\r\n }\r\n }\r\n \r\n document.getElementById( 'wptb-top-row-as-header' ).onchange = function () {\r\n createMobileHeadForTable( table, this );\r\n }\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 document.getElementById('wptb-activate-cell-management-mode').onclick = table.toggleTableEditMode;\r\n document.getElementById( 'wptb-table-edit-mode-close' ).onclick = table.toggleTableEditMode;\r\n document.getElementById( 'wptb-left-scroll-panel-curtain-close' ).onclick = table.toggleTableEditMode;\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 document.querySelector( '.wptb-left-panel-extend' ).onclick = function() {\r\n let wptbContainer = document.querySelector( '.wptb-container' );\r\n if( wptbContainer ) {\r\n if ( wptbContainer.classList.contains( 'collapsed' ) ) {\r\n wptbContainer.classList.remove( 'collapsed' );\r\n } else {\r\n wptbContainer.classList.add( 'collapsed' );\r\n }\r\n }\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.addEventListener( 'click', 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 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 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 } \r\n }, false);\r\n \r\n};","var WPTB_List = function ( innerElements, DOMElementProt ) {\r\n\r\n var el_L = document.createElement('ul'), item,\r\n DOMElement = document.createElement('div'),\r\n kindIndexProt = undefined,\r\n copy = false;\r\n DOMElement.classList.add( 'wptb-list-item-container' );\r\n\r\n this.kind = 'list';\r\n\r\n if (innerElements === '') {\r\n //Case for edit mode list\r\n } else if ( !innerElements ) {\r\n for (var i = 0; i < 3; i++) {\r\n item = new WPTB_ListItem( '<p>List Item ' + (i + 1) + '</p>');\r\n el_L.appendChild(item.getDOMElement());\r\n }\r\n } else {\r\n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\r\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\r\n kindIndexProt = wptbElementMutch[1];\r\n copy = true;\r\n };\r\n \r\n for ( var i = 0; i < innerElements.length; i++ ) {\r\n let listItem = DOMElementProt.querySelector( 'li' );\r\n item = new WPTB_ListItem( innerElements[i], listItem, true );\r\n el_L.appendChild(item.getDOMElement());\r\n }\r\n }\r\n DOMElement.appendChild(el_L);\r\n //window.addElementOptions('list', elList);\r\n\r\n this.getDOMElement = function () {\r\n return DOMElement;\r\n }\r\n applyGenericItemSettings( this, kindIndexProt, copy );\r\n WPTB_Helper.listItemsRecalculateIndex( el_L );\r\n\r\n return this;\r\n};","var WPTB_ListItem = function ( text, DOMElementProt, copy ) {\r\n let wptbListItemReturn;\r\n if ( DOMElementProt == undefined || ( DOMElementProt && copy )) {\r\n if (text == undefined) text = 'New List Item';\r\n var DOMElement = document.createElement('li'),\r\n //divdot = document.createElement('div'),\r\n divcontent = document.createElement('div');\r\n //libullet = document.createElement('li');\r\n //divdot.classList.add('wptb-list-item-style-dot');\r\n divcontent.classList.add('wptb-list-item-content');\r\n //libullet.classList.add('wptb-bullet');\r\n if ( DOMElementProt ) {\r\n let styleDot = DOMElementProt.getAttribute( 'style' );\r\n if ( styleDot ) {\r\n DOMElement.setAttribute( 'style', styleDot );\r\n }\r\n }\r\n //DOMElement.appendChild(divdot);\r\n DOMElement.appendChild(divcontent);\r\n //divdot.appendChild(libullet);\r\n divcontent.innerHTML = text;\r\n divcontent.onkeyup = window.listItemKeyListener;\r\n \r\n wptbListItemReturn = true;\r\n } else {\r\n var DOMElement = DOMElementProt;\r\n var divcontent = DOMElement.getElementsByClassName( 'wptb-list-item-content' )[0];\r\n \r\n divcontent.onkeyup = window.listItemKeyListener;\r\n \r\n wptbListItemReturn = false;\r\n }\r\n \r\n DOMElement.onmouseenter = function (event) {\r\n\r\n var btnDelete = document.createElement('span'),\r\n btnCopy = document.createElement('span'),\r\n actions = document.createElement('span'),\r\n previous,\r\n i;\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 this.classList.add('wptb-directlyhovered');\r\n\r\n btnDelete.onclick = function () {\r\n var action = this.parentNode, \r\n item = this.parentNode.parentNode,\r\n parent = item.parentNode;\r\n item.removeChild( action );\r\n parent.removeChild( item );\r\n WPTB_Helper.listItemsRecalculateIndex( parent );\r\n };\r\n\r\n btnCopy.onclick = function (event) {\r\n var listItem = event.target.parentNode.parentNode,\r\n content = listItem.querySelector('.wptb-list-item-content'),\r\n html = content.innerHTML;\r\n var duplicate = new WPTB_ListItem( html, listItem, true );\r\n listItem.parentNode.insertBefore( duplicate.getDOMElement(), DOMElement );\r\n WPTB_Helper.listItemsTinyMceInit( duplicate.getDOMElement().firstChild );\r\n setTimeout( function(){\r\n divcontent.innerHTML = html;\r\n WPTB_Helper.listItemsRecalculateIndex( listItem.parentNode );\r\n }, 5 );\r\n };\r\n\r\n actions.append(btnCopy, btnDelete);\r\n this.appendChild(actions);\r\n };\r\n\r\n DOMElement.onmouseleave = function (event) {\r\n this.removeAttribute( 'class' );\r\n let iter = 0;\r\n while( event.target.querySelector( '.wptb-actions' ) && iter < 5 ) {\r\n event.target.querySelector( '.wptb-actions' ).remove();\r\n iter++;\r\n }\r\n };\r\n\r\n this.getDOMElement = function () {\r\n return DOMElement;\r\n };\r\n \r\n if ( wptbListItemReturn ) {\r\n return this;\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) {\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}","var WPTB_Parser2 = function (code) {\r\n if( Array.isArray( code ) ) {\r\n let elementHtml;\r\n \r\n if ( code.length == 1) {\r\n return elementHtml.appendChild( document.createTextNode( code[0] ) );\r\n }\r\n if( 0 in code ) {\r\n let tagName = code[0];\r\n elementHtml = document.createElement( tagName );\r\n \r\n if ( 1 in code ) {\r\n if( Array.isArray( code[1] ) ) {\r\n let attributes = code[1];\r\n \r\n for( let i = 0; i < attributes.length; i++ ) {\r\n if( Array.isArray( attributes[i] ) ) {\r\n elementHtml.setAttribute(attributes[i][0], attributes[i][1]);\r\n }\r\n }\r\n }\r\n }\r\n \r\n if ( 2 in code ) {\r\n if ( Array.isArray( code[2] ) ) {\r\n for ( let i = 0; i < code[2].length; i++ ) {\r\n if ( typeof code[2][i] === 'string' && tagName.toLowerCase() == 'p' ) {\r\n elementHtml.appendChild( document.createTextNode( code[2][i] ) );\r\n continue;\r\n }\r\n if ( ! WPTB_Parser( code[2][i] ) ) continue;\r\n elementHtml.appendChild( WPTB_Parser( code[2][i] ) );\r\n }\r\n } else if( typeof code[2] === 'string' ) {\r\n elementHtml.appendChild( document.createTextNode( code[2] ) );\r\n }\r\n \r\n }\r\n }\r\n \r\n return elementHtml;\r\n } else {\r\n return false;\r\n }\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 let wptbDropHandle = document.querySelector( '.wptb-drop-handle' ),\r\n wptbDropBorderMarker = document.querySelector( '.wptb-drop-border-marker' );\r\n if ( wptbDropHandle || wptbDropBorderMarker ) {\r\n wptbDropHandle.style.display = 'none';\r\n wptbDropBorderMarker.style.display = 'none';\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 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-save-btn' )[0].onclick = function () {\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 table.toggleTableEditMode();\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 = document.getElementsByClassName( 'wptb-preview-table' );\r\n if( code.length > 0 ) {\r\n code = WPTB_Stringifier( code[0] );\r\n code = code.outerHTML;\r\n } else { \r\n code = '';\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 security_code: wptb_admin_object.security_code\r\n };\r\n if (( rs = WPTB_Helper.detectMode() ) || ( rs = document.wptbId )) {\r\n params.id = rs;\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 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 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 } else if( data[0] == 'edited' ) {\r\n messagingArea.innerHTML = '<div class=\"wptb-success wptb-message\">Table \"' + t + '\" was successfully updated.</div>';\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","var WPTB_Space = function ( elSpaceBetween ) {\r\n\r\n function newElementProxy(el) {\r\n if (el.includes('list')) {\r\n return new WPTB_List();\r\n } else if (el.includes('image')) {\r\n return new WPTB_Image();\r\n } else if (el.includes('text')) {\r\n return new WPTB_Text();\r\n } else if (el.includes('button')) {\r\n return new WPTB_Button();\r\n }\r\n }\r\n let spaceBetween;\r\n if ( ! elSpaceBetween ) {\r\n spaceBetween = document.createElement('div'), spaceBetween.classList.add('wptb-space-between');\r\n } else {\r\n spaceBetween = elSpaceBetween;\r\n }\r\n\r\n spaceBetween.ondragenter = function () {\r\n this.classList.add('visible');\r\n };\r\n spaceBetween.ondragover = function (event) {\r\n event.preventDefault();\r\n };\r\n\r\n spaceBetween.ondragleave = function () {\r\n this.classList.remove('visible');\r\n };\r\n\r\n spaceBetween.ondrop = function (event) {\r\n event.stopPropagation();\r\n\r\n var p = event.target.nextSibling,\r\n td = event.target,\r\n element, t_space, spaceParent;\r\n\r\n while ( !td.classList.contains('wptb-droppable') ) {\r\n td = td.parentNode;\r\n }\r\n\r\n if (event.dataTransfer.getData('wptbElement')) {\r\n element = newElementProxy(event.dataTransfer.getData('wptbElement'));\r\n this.classList.remove('visible');\r\n\r\n if (p == null) {\r\n td.appendChild(element.getDOMElement());\r\n td.appendChild(new WPTB_Space());\r\n } else {\r\n td.insertBefore(element.getDOMElement(), p);\r\n td.insertBefore(new WPTB_Space(), p);\r\n }\r\n\r\n } else {\r\n alert(event.dataTransfer.getData('node'));\r\n element = document.getElementsByClassName(event.dataTransfer.getData('node'))[0];\r\n t_space = element.nextSibling;\r\n spaceParent = element.parentNode;\r\n if (t_space != undefined) {\r\n spaceParent.removeChild(t_space);\r\n }\r\n\r\n if (p == null) {\r\n td.appendChild(element);\r\n td.appendChild(new WPTB_Space());\r\n } else {\r\n td.insertBefore(element, p);\r\n td.insertBefore(new WPTB_Space(), p);\r\n }\r\n\r\n }\r\n this.classList.remove('visible');\r\n };\r\n \r\n if ( ! elSpaceBetween ) {\r\n return spaceBetween;\r\n }\r\n};","var WPTB_Stringifier = function ( codeMain ) {\r\n if ( codeMain ) {\r\n let code = codeMain.cloneNode( true );\r\n code.classList.add( 'wptb-table-preview-static-indic' );\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 if ( codeMain.querySelector( 'wptb-table-preview-head' ) ) {\r\n tds[i].removeAttribute( 'data-x-index' );\r\n }\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 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 innerElements[j].classList.remove( 'wptb-directlyhovered' );\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 wptbActions[0].parentNode.removeChild( wptbActions[0] );\r\n wptbActionsLength--;\r\n } \r\n }\r\n }\r\n \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 WPTB_Stringifier2 = function ( node, start = false ) {\r\n\r\n\tif ( node == undefined ) {\r\n\t\treturn '';\r\n\t} else if ( node.tagName == undefined && node.nodeType == 3 ) {\r\n return node.nodeValue;\r\n }\r\n \r\n let code = [],\r\n children,\r\n int_elem_arr = false,\r\n attributes = [...node.attributes],\r\n attributes_list = [],\r\n internal_elements = [];\r\n if ( ( node.parentNode.classList.contains( 'wptb-list-item-content' ) || \r\n node.parentNode.classList.contains( 'mce-content-body' ) ) && \r\n node.tagName.toLowerCase() == 'p' ) {\r\n children = node.childNodes;\r\n int_elem_arr = true;\r\n } else if( node.children.length > 0 ) {\r\n children = node.children;\r\n } else {\r\n children = node.childNodes;\r\n }\r\n if ( attributes.length > 0 ) {\r\n for ( let i = 0; i < attributes.length; i++ ) {\r\n attributes_list[i] = [attributes[i].name, attributes[i].value];\r\n }\r\n } else {\r\n attributes_list = '';\r\n }\r\n \r\n if ( children.length > 0 ) {\r\n for ( let i = 0; i < children.length; i++) {\r\n let inter_elem = WPTB_Stringifier(children[i]);\r\n \r\n if ( Array.isArray( inter_elem ) || int_elem_arr ) {\r\n internal_elements[i] = inter_elem;\r\n } else if ( typeof inter_elem === 'string' && inter_elem ) {\r\n internal_elements = inter_elem;\r\n }\r\n }\r\n } else {\r\n internal_elements = '';\r\n }\r\n \r\n \r\n code.push(node.tagName.toLowerCase(), attributes_list , internal_elements);\r\n \r\n return code;\r\n}","var array = [], WPTB_Table = function (columns, rows) {\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 var rs = this.rowSpan,\r\n cs = this.colSpan,\r\n markedCells,\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(this),\r\n row = position[0],\r\n column = position[1];\r\n if ( ! document.select.isActivated() ) {\r\n return;\r\n }\r\n if (this.className.match(/wptb-highlighted/)) {\r\n this.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 this.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 markedCells = document.getElementsByClassName('wptb-highlighted').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 let cellHighlighted = document.querySelector( '.wptb-highlighted' );\r\n if( cellHighlighted ) {\r\n let wptbTableColumnWidthSlider = document.getElementById( 'wptb-table-column-width-slider' );\r\n let wptbTableColumnWidthNumber = document.getElementById( 'wptb-table-column-width-number' );\r\n let tableColumnWidthAutoFixedCheckbox = document.getElementById( 'wptb-table-column-width-auto-fixed' );\r\n let width = cellHighlighted.style.width;\r\n if( width ) {\r\n wptbTableColumnWidthSlider.value = parseFloat( width, 10 );\r\n wptbTableColumnWidthNumber.value = parseFloat( width, 10 );\r\n tableColumnWidthAutoFixedCheckbox.checked = true;\r\n } else if( cellHighlighted.dataset.wptbFixedWidth ) {\r\n wptbTableColumnWidthSlider.value = cellHighlighted.dataset.wptbFixedWidth;\r\n wptbTableColumnWidthNumber.value = cellHighlighted.dataset.wptbFixedWidth;\r\n tableColumnWidthAutoFixedCheckbox.checked = true;\r\n } else {\r\n let cellWidth = WPTB_Helper.getColumnWidth( table, cellHighlighted );\r\n wptbTableColumnWidthSlider.value = cellWidth;\r\n wptbTableColumnWidthNumber.value = cellWidth;\r\n tableColumnWidthAutoFixedCheckbox.checked = false;\r\n }\r\n \r\n \r\n let wptbTableRowHeightSlider = document.getElementById( 'wptb-table-row-height-slider' );\r\n let wptbTableRowHeightNumber = document.getElementById( 'wptb-table-row-height-number' );\r\n let tableRowHeightAutoFixedCheckbox = document.getElementById( 'wptb-table-row-height-auto-fixed' );\r\n let height = cellHighlighted.style.height;\r\n if( height ) {\r\n wptbTableRowHeightSlider.value = parseFloat( height, 10 );\r\n wptbTableRowHeightNumber.value = parseFloat( height, 10 );\r\n tableRowHeightAutoFixedCheckbox.checked = true;\r\n } else if( cellHighlighted.dataset.wptbFixedHeight ) {\r\n wptbTableRowHeightSlider.value = cellHighlighted.dataset.wptbFixedHeight;\r\n wptbTableRowHeightNumber.value = cellHighlighted.dataset.wptbFixedHeight;\r\n tableRowHeightAutoFixedCheckbox.checked = true;\r\n } else {\r\n let cellHeight = WPTB_Helper.getRowHeight( table, cellHighlighted );\r\n wptbTableRowHeightSlider.value = cellHeight;\r\n wptbTableRowHeightNumber.value = cellHeight;\r\n tableRowHeightAutoFixedCheckbox.checked = false;\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\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 var 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 tds = table.getElementsByClassName('wptb-highlighted');\r\n while (tds.length) {\r\n tds[0].classList.remove('wptb-highlighted');\r\n }\r\n for (var i = 0; i < array.length; i++) {\r\n for (var j = 0; j < array[i].length; j++) {\r\n array[i][j] = 0;\r\n }\r\n }\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 };\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-header-bg').val('');\r\n jQuery('#wptb-even-row-bg').val('');\r\n jQuery('#wptb-odd-row-bg').val('');\r\n jQuery('#wptb-table-border-color').val('');\r\n jQuery('#wptb-table-inner-border-number,#wptb-table-inner-border-slider').val('0');\r\n jQuery('#wptb-table-border-number,#wptb-table-border-slider').val('0');\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' );\r\n table.dataset.reconstraction = 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 row.appendChild(cell.getDOMElement());\r\n }\r\n }\r\n } else {\r\n let wptb_preview_table = document.getElementsByClassName( 'wptb-preview-table' );\r\n\r\n if (wptb_preview_table.length > 0) {\r\n table = wptb_preview_table[0];\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 }\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\r\n table.toggleTableEditMode = function () {\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 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.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 } else {\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.classList.add( 'wptb-preview-table-manage-cells' );\r\n }\r\n }\r\n\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\r\n table.recalculateIndexes = function ( start ) {\r\n let trs = this.getElementsByTagName('tr'), tds, maxCols = 0, maxColsFull = 0,\r\n tdsArr = [];\r\n let wptbTopRowAsHeader = document.getElementById( 'wptb-top-row-as-header' );\r\n \r\n for (var i = 0; i < trs.length; i++) {\r\n if ( i == 0 ) {\r\n if ( start == undefined ) {\r\n trs[i].style.backgroundColor = jQuery('#wptb-table-header-bg').val();\r\n }\r\n if( wptbTopRowAsHeader.checked ) {\r\n if( start == undefined ) {\r\n this.classList.add( 'wptb-table-preview-head' ); \r\n trs[i].classList.add( 'wptb-table-head' )\r\n } ;\r\n } else {\r\n if( start == undefined ) {\r\n this.classList.remove( 'wptb-table-preview-head' );\r\n trs[i].classList.remove( 'wptb-table-head' );\r\n }\r\n }\r\n } else {\r\n if (i % 2 == 0) {\r\n if ( start == undefined ) {\r\n trs[i].style.backgroundColor = jQuery('#wptb-odd-row-bg').val();\r\n }\r\n trs[i].classList.remove( 'wptb-table-head' );\r\n } else {\r\n if ( start == undefined ) {\r\n trs[i].style.backgroundColor = jQuery('#wptb-even-row-bg').val();\r\n }\r\n trs[i].classList.remove( 'wptb-table-head' );\r\n }\r\n }\r\n\r\n tdsArr[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 (var 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 if( i == 0 ) {\r\n maxColsFull = jMainIter;\r\n }\r\n }\r\n if (j > maxCols) {\r\n maxCols = j;\r\n }\r\n }\r\n this.columns = maxCols;\r\n this.maxCols = maxColsFull;\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 let tableColumnWidthAutoFixedCheckbox = document.getElementById( 'wptb-table-column-width-auto-fixed' );\r\n if( ! tableColumnWidthAutoFixedCheckbox.checked ) {\r\n tableColumnWidthAutoFixedCheckbox.checked = true;\r\n }\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 }\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 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[parseInt( td.dataset.xIndex )] && ! arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] ) {\r\n if( td.style.width ) {\r\n arrayCellsWidthFixedHelper[parseInt( 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[parseInt( td.dataset.xIndex )] = 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 if( arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] ) {\r\n arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] += tdPaddingCommon;\r\n arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] += tableTdBorderCommonWidth;\r\n } else {\r\n arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] += tdPaddingCommon;\r\n arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] += tableTdBorderCommonWidth;\r\n }\r\n }\r\n } else if( arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] ) {\r\n if( ! td.dataset.wptbFixedWidth ) {\r\n td.dataset.wptbCssTdAutoWidth = true;\r\n }\r\n } else if( arrayCellsWidthFixedHelper[parseInt( 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 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 tableTdsSumMaxWidth = tableTdsSumMaxWidthFixed + tableTdsSumMaxWidthAuto + tableBorderCommon;\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 - tableBorderCommon;\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 = null;\r\n let tableTdsWidthAutoCommon = wptbTableSetupWidth - tableTdsSumMaxWidthFixed - tableBorderCommon;\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 = null;\r\n table.style.minWidth = null;\r\n table.style.maxWidth = tableTdsSumMaxWidth + 'px';\r\n }\r\n } else {\r\n table.style.maxWidth = null;\r\n table.style.minWidth = tableTdsSumMaxWidth + 'px';\r\n table.style.width = null;\r\n tableTdWidthAuto = '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 \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 let tableColumnHeightAutoFixedCheckbox = document.getElementById( 'wptb-table-row-height-auto-fixed' );\r\n if( ! tableColumnHeightAutoFixedCheckbox.checked ) {\r\n tableColumnHeightAutoFixedCheckbox.checked = true;\r\n }\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 }\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 }\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\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 }\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\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 cellPointer,\r\n cellsBuffer,\r\n cell = document.querySelector('.wptb-highlighted'),\r\n cellStyle = cell.getAttribute('style'),\r\n pos = c_pos != undefined && typeof c_pos === 'number' ? c_pos : getCoords(cell)[1];\r\n \r\n \r\n \r\n if( maxAmountOfCells - pos - cell.colSpan + 1 == 1 ) {\r\n table.addColumnEnd();\r\n } else {\r\n let pendingInsertion = false,\r\n stepsToMove,\r\n td, bro,\r\n carriedRowspans = [],\r\n currentCell;\r\n\r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n carriedRowspans.push(0);\r\n }\r\n\r\n for (var i = 0; i < rows.length; i++) {\r\n cellPointer = 0;\r\n cellsBuffer = rows[i].getElementsByTagName('td');\r\n pendingInsertion = false;\r\n for (var xPosition = 0;\r\n xPosition < maxAmountOfCells;\r\n xPosition += stepsToMove) {\r\n stepsToMove = 1;\r\n\r\n if (pendingInsertion) {\r\n 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 }\r\n if (currentCell && rows[i].contains(currentCell)) {\r\n bro = currentCell.nextSibling;\r\n if (bro) {\r\n rows[i].insertBefore(td.getDOMElement(), bro);\r\n } else {\r\n rows[i].appendChild(td.getDOMElement());\r\n }\r\n } else {\r\n rows[i].insertBefore(td.getDOMElement(), cellsBuffer[0]);\r\n }\r\n break;\r\n } else if (carriedRowspans[xPosition] > 0) {\r\n // If no pending insertion, let's check if no rowspan from upper cells is pending in current position\r\n if (pos == xPosition) {\r\n pendingInsertion = true;\r\n }\r\n } else {\r\n currentCell = cellsBuffer[cellPointer++];\r\n if (currentCell.rowSpan > 1) {\r\n stepsToMove = currentCell.colSpan;\r\n for (var k = 0; k < currentCell.colSpan; k++) {\r\n carriedRowspans[xPosition + k] = currentCell.rowSpan;\r\n if (xPosition + k == pos) {\r\n pendingInsertion = true;\r\n }\r\n }\r\n } else if (currentCell.colSpan > 1) {\r\n stepsToMove = currentCell.colSpan;\r\n for (var k = 0; k < currentCell.colSpan; k++) {\r\n if (xPosition + k == pos) {\r\n pendingInsertion = true;\r\n }\r\n }\r\n } else if (xPosition == pos) {\r\n pendingInsertion = true;\r\n }\r\n }\r\n }\r\n\r\n for (var l = 0; l < maxAmountOfCells; l++) {\r\n if (carriedRowspans[l] > 0)\r\n carriedRowspans[l]--;\r\n }\r\n\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 };\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 currentTableTd,\r\n currentTdStyle;\r\n r.classList.add( 'wptb-row' );\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 < maxAmountOfCells; i++) {\r\n td = new WPTB_Cell(mark);\r\n if (currentTdStyle) {\r\n td.getDOMElement().setAttribute('style', currentTdStyle);\r\n }\r\n r.appendChild(td.getDOMElement());\r\n }\r\n aux = Array.from(array[0]);\r\n array.push(aux);\r\n drawTable(array);\r\n table.recalculateIndexes();\r\n table.addColumnWidth();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\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 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 < maxAmountOfCells; i++) {\r\n td = new WPTB_Cell(mark);\r\n if (currentTdStyle) {\r\n td.getDOMElement().setAttribute('style', currentTdStyle);\r\n }\r\n r.appendChild(td.getDOMElement());\r\n }\r\n aux = Array.from(array[0]);\r\n array.push(aux);\r\n drawTable(array);\r\n table.recalculateIndexes();\r\n table.addColumnWidth();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\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 table.addColumnWidth();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\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\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\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 table.toggleTableEditMode();\r\n wptbTableSetup.innerHTML = '';\r\n WPTB_Helper.settingsPanelClear();\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\r\n }\r\n \r\n table.recalculateIndexes();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n undoSelect();\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 table.toggleTableEditMode();\r\n wptbTableSetup.innerHTML = '';\r\n WPTB_Helper.settingsPanelClear();\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\r\n }\r\n \r\n table.recalculateIndexes();\r\n table.tdDefaultWidth();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n undoSelect();\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 // 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_Text = function ( text , DOMElementProt ) {\r\n let DOMElement = document.createElement('div'),\r\n elText2 = document.createElement('div'),\r\n elP = document.createElement('p'),\r\n kindIndexProt = undefined,\r\n copy = false;\r\n \r\n DOMElement.classList.add( 'wptb-text-container' );\r\n\r\n elP.innerHTML = text != undefined ? text : 'Text';\r\n elText2.appendChild(elP);\r\n DOMElement.appendChild(elText2);\r\n if ( DOMElementProt ) {\r\n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\r\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\r\n kindIndexProt = wptbElementMutch[1];\r\n copy = true;\r\n };\r\n\r\n let attributes = [...DOMElementProt.attributes];\r\n for( let i = 0; i < attributes.length; i++ ) {\r\n DOMElement.setAttribute(attributes[i].name, attributes[i].value);\r\n }\r\n } \r\n\r\n this.kind = 'text';\r\n this.getDOMElement = function () {\r\n return DOMElement;\r\n };\r\n applyGenericItemSettings( this, kindIndexProt, copy );\r\n\r\n return this;\r\n};"]}
|
inc/admin/js/core/WPTB_Settings.js
CHANGED
@@ -19,7 +19,7 @@ var WPTB_Settings = function () {
|
|
19 |
|
20 |
let shortcodePopupWindow = document.getElementsByClassName( 'wptb-popup-window-modal' )[0];
|
21 |
document.getElementsByClassName( 'wptb-embed-btn' )[0].onclick = function () {
|
22 |
-
if( ! this.classList.contains( 'wptb-
|
23 |
shortcodePopupWindow.classList.add( 'wptb-popup-show' );
|
24 |
}
|
25 |
}
|
@@ -85,8 +85,17 @@ var WPTB_Settings = function () {
|
|
85 |
if ( data[0] == 'saved' ) {
|
86 |
document.wptbId = data[1];
|
87 |
messagingArea.innerHTML = '<div class="wptb-success wptb-message">Table "' + t + '" was successfully saved.</div>';
|
88 |
-
document.getElementsByClassName( 'wptb-embed-btn' )[0].classList.remove( 'wptb-
|
89 |
document.getElementById( 'wptb-embed-shortcode' ).value = '[wptb id=' + data[1] + ']';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
} else if( data[0] == 'edited' ) {
|
91 |
messagingArea.innerHTML = '<div class="wptb-success wptb-message">Table "' + t + '" was successfully updated.</div>';
|
92 |
} else {
|
19 |
|
20 |
let shortcodePopupWindow = document.getElementsByClassName( 'wptb-popup-window-modal' )[0];
|
21 |
document.getElementsByClassName( 'wptb-embed-btn' )[0].onclick = function () {
|
22 |
+
if( ! this.classList.contains( 'wptb-button-disable' ) ) {
|
23 |
shortcodePopupWindow.classList.add( 'wptb-popup-show' );
|
24 |
}
|
25 |
}
|
85 |
if ( data[0] == 'saved' ) {
|
86 |
document.wptbId = data[1];
|
87 |
messagingArea.innerHTML = '<div class="wptb-success wptb-message">Table "' + t + '" was successfully saved.</div>';
|
88 |
+
document.getElementsByClassName( 'wptb-embed-btn' )[0].classList.remove( 'wptb-button-disable' );
|
89 |
document.getElementById( 'wptb-embed-shortcode' ).value = '[wptb id=' + data[1] + ']';
|
90 |
+
let wptbPreviewBtn = document.getElementsByClassName( 'wptb-preview-btn' );
|
91 |
+
if( wptbPreviewBtn.length > 0 ) {
|
92 |
+
wptbPreviewBtn = wptbPreviewBtn[0];
|
93 |
+
wptbPreviewBtn.classList.remove( 'wptb-button-disable' );
|
94 |
+
let wptbPreviewBtnHref = wptbPreviewBtn.dataset.previewHref;
|
95 |
+
wptbPreviewBtnHref = wptbPreviewBtnHref.replace( 'empty', data[1] );
|
96 |
+
wptbPreviewBtn.setAttribute( 'href', wptbPreviewBtnHref );
|
97 |
+
}
|
98 |
+
|
99 |
} else if( data[0] == 'edited' ) {
|
100 |
messagingArea.innerHTML = '<div class="wptb-success wptb-message">Table "' + t + '" was successfully updated.</div>';
|
101 |
} else {
|
inc/admin/views/builder/wptb-builder-header.php
CHANGED
@@ -20,12 +20,33 @@
|
|
20 |
|
21 |
</div>
|
22 |
<div class="wptb-right">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
<div class="wptb-embed">
|
24 |
-
<
|
25 |
-
<a href="#" class="wptb-embed-btn <?php echo ! isset( $_GET['table'] ) || ! absint( $_GET['table'] ) || ! get_post_meta( absint( $_GET['table'] ) , '_wptb_content_', true ) ? 'wptb-embed-disable' : '';?>">
|
26 |
<?php esc_html_e( '</> Embed', 'wp-table-builder' ); ?>
|
27 |
</a>
|
28 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
<div class="wptb-save">
|
30 |
<a href="#" class="wptb-save-btn">
|
31 |
<?php esc_html_e( 'Save Table', 'wp-table-builder' ); ?>
|
20 |
|
21 |
</div>
|
22 |
<div class="wptb-right">
|
23 |
+
<?php
|
24 |
+
$wptb_button_disable_class = '';
|
25 |
+
$wptb_preview_button_url_value_id = 'empty';
|
26 |
+
if( ! isset( $_GET['table'] ) || ! absint( $_GET['table'] ) || ! get_post_meta( absint( $_GET['table'] ) , '_wptb_content_', true ) ) {
|
27 |
+
$wptb_button_disable_class = 'wptb-button-disable';
|
28 |
+
} else {
|
29 |
+
$wptb_preview_button_url_value_id = absint( $_GET['table'] );
|
30 |
+
}
|
31 |
+
$wptb_preview_button_url = add_query_arg(
|
32 |
+
array(
|
33 |
+
'wptb_table_preview' => $wptb_preview_button_url_value_id,
|
34 |
+
),
|
35 |
+
home_url()
|
36 |
+
);
|
37 |
+
?>
|
38 |
<div class="wptb-embed">
|
39 |
+
<a href="#" class="wptb-button-grey wptb-embed-btn <?php echo $wptb_button_disable_class; ?>">
|
|
|
40 |
<?php esc_html_e( '</> Embed', 'wp-table-builder' ); ?>
|
41 |
</a>
|
42 |
</div>
|
43 |
+
<div class="wptb-preview">
|
44 |
+
<a href="<?php echo $wptb_preview_button_url_value_id !== 'empty' ? $wptb_preview_button_url : '#'; ?>"
|
45 |
+
target="_blank" class="wptb-button-grey wptb-preview-btn <?php echo $wptb_button_disable_class; ?>"
|
46 |
+
data-preview-href="<?php echo $wptb_preview_button_url_value_id === 'empty' ? $wptb_preview_button_url : '#'; ?>">
|
47 |
+
<?php esc_html_e( 'Preview', 'wp-table-builder' ); ?>
|
48 |
+
</a>
|
49 |
+
</div>
|
50 |
<div class="wptb-save">
|
51 |
<a href="#" class="wptb-save-btn">
|
52 |
<?php esc_html_e( 'Save Table', 'wp-table-builder' ); ?>
|
inc/common/class-helpers.php
CHANGED
@@ -30,7 +30,7 @@ class Helpers {
|
|
30 |
* @return bool
|
31 |
*/
|
32 |
static function wptb_current_user_can() {
|
33 |
-
$capability = wptb_get_capability_manage_options();
|
34 |
return apply_filters( 'wptb_current_user_can', current_user_can( $capability ), $capability );
|
35 |
}
|
36 |
|
30 |
* @return bool
|
31 |
*/
|
32 |
static function wptb_current_user_can() {
|
33 |
+
$capability = self::wptb_get_capability_manage_options();
|
34 |
return apply_filters( 'wptb_current_user_can', current_user_can( $capability ), $capability );
|
35 |
}
|
36 |
|
inc/core/class-preview.php
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
namespace WP_Table_Builder\Inc\Core;
|
|
|
4 |
|
5 |
/**
|
6 |
* Show preview table
|
@@ -77,7 +78,7 @@ class Preview {
|
|
77 |
}
|
78 |
|
79 |
// if the user is authorized and if user rights are valid
|
80 |
-
if ( ! is_user_logged_in() || ! wptb_current_user_can ) {
|
81 |
return false;
|
82 |
}
|
83 |
|
1 |
<?php
|
2 |
|
3 |
namespace WP_Table_Builder\Inc\Core;
|
4 |
+
use WP_Table_Builder\Inc\Common\Helpers;
|
5 |
|
6 |
/**
|
7 |
* Show preview table
|
78 |
}
|
79 |
|
80 |
// if the user is authorized and if user rights are valid
|
81 |
+
if ( ! is_user_logged_in() || ! Helpers::wptb_current_user_can() ) {
|
82 |
return false;
|
83 |
}
|
84 |
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: imtiazrayhan
|
|
3 |
Tags: table, table builder, drag and drop
|
4 |
Requires at least: 4.9
|
5 |
Tested up to: 5.2
|
6 |
-
Stable tag: 1.0.
|
7 |
Requires PHP: 5.6
|
8 |
License: GPL3+
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.txt
|
@@ -59,6 +59,11 @@ That's it. You're done!
|
|
59 |
|
60 |
== Changelog ==
|
61 |
|
|
|
|
|
|
|
|
|
|
|
62 |
= 1.0.2 =
|
63 |
|
64 |
* NEW: Duplicate table functionality.
|
3 |
Tags: table, table builder, drag and drop
|
4 |
Requires at least: 4.9
|
5 |
Tested up to: 5.2
|
6 |
+
Stable tag: 1.0.3
|
7 |
Requires PHP: 5.6
|
8 |
License: GPL3+
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.txt
|
59 |
|
60 |
== Changelog ==
|
61 |
|
62 |
+
= 1.0.3 =
|
63 |
+
|
64 |
+
* FIX: PHP function not declared issue.
|
65 |
+
* NEW: Preview button in the builder.
|
66 |
+
|
67 |
= 1.0.2 =
|
68 |
|
69 |
* NEW: Duplicate table functionality.
|
wp-table-builder.php
CHANGED
@@ -15,7 +15,7 @@
|
|
15 |
* Plugin Name: WP Table Builder
|
16 |
* Plugin URI: https://wptablebuilder.com/
|
17 |
* Description: Drag and Drop Table Builder Plugin for WordPress.
|
18 |
-
* Version: 1.0.
|
19 |
* Author: Imtiaz Rayhan
|
20 |
* Author URI: https://imtiazrayhan.com//
|
21 |
* License: GPL-3.0+
|
@@ -39,7 +39,7 @@ define( __NAMESPACE__ . '\NS', __NAMESPACE__ . '\\' );
|
|
39 |
|
40 |
define( NS . 'WP_TABLE_BUILDER', 'wp-table-builder' );
|
41 |
|
42 |
-
define( NS . 'PLUGIN_VERSION', '1.0.
|
43 |
|
44 |
define( NS . 'WP_TABLE_BUILDER_DIR', plugin_dir_path( __FILE__ ) );
|
45 |
|
15 |
* Plugin Name: WP Table Builder
|
16 |
* Plugin URI: https://wptablebuilder.com/
|
17 |
* Description: Drag and Drop Table Builder Plugin for WordPress.
|
18 |
+
* Version: 1.0.3
|
19 |
* Author: Imtiaz Rayhan
|
20 |
* Author URI: https://imtiazrayhan.com//
|
21 |
* License: GPL-3.0+
|
39 |
|
40 |
define( NS . 'WP_TABLE_BUILDER', 'wp-table-builder' );
|
41 |
|
42 |
+
define( NS . 'PLUGIN_VERSION', '1.0.3' );
|
43 |
|
44 |
define( NS . 'WP_TABLE_BUILDER_DIR', plugin_dir_path( __FILE__ ) );
|
45 |
|