Version Description
- FIX: Fixed an issue affecting browser caches, forcing them to use old version of js files.
Download this release
Release Info
Developer | imtiazrayhan |
Plugin | WP Table Builder – WordPress Table Plugin |
Version | 1.2.8 |
Comparing to | |
See all releases |
Code changes from version 1.2.7 to 1.2.8
- inc/admin/js/admin.js +199 -199
- inc/admin/js/admin.js.map +1 -1
- inc/admin/js/admin.min.js +0 -1
inc/admin/js/admin.js
CHANGED
@@ -1,95 +1,5 @@
|
|
1 |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
2 |
|
3 |
-
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
|
4 |
-
|
5 |
-
var applyGenericItemSettings = function applyGenericItemSettings(element, kindIndexProt) {
|
6 |
-
var copy = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
7 |
-
|
8 |
-
var node = element.getDOMElement(),
|
9 |
-
index,
|
10 |
-
copy;
|
11 |
-
if (node.classList.contains('wptb-ph-element')) {
|
12 |
-
if (kindIndexProt == undefined || copy == true) {
|
13 |
-
//index = document.counter.nextIndex( element.kind );
|
14 |
-
var wptbElements = document.getElementsByClassName('wptb-ph-element');
|
15 |
-
var elementIndexesArr = [];
|
16 |
-
for (var i = 0; i < wptbElements.length; i++) {
|
17 |
-
var regex = new RegExp('wptb-element-' + element.kind + '-(\\d+)', "i");
|
18 |
-
var infArr = wptbElements[i].className.match(regex);
|
19 |
-
if (infArr) {
|
20 |
-
elementIndexesArr.push(infArr[1]);
|
21 |
-
}
|
22 |
-
}
|
23 |
-
if (elementIndexesArr.length > 0) {
|
24 |
-
var elementIndexMax = Math.max.apply(Math, elementIndexesArr);
|
25 |
-
index = elementIndexMax + 1;
|
26 |
-
} else {
|
27 |
-
index = 1;
|
28 |
-
}
|
29 |
-
|
30 |
-
if (copy) {
|
31 |
-
// change all data-elements which save parameters for different controls
|
32 |
-
var wptbNodeattributes = [].concat(_toConsumableArray(node.attributes));
|
33 |
-
for (var _i = 0; _i < wptbNodeattributes.length; _i++) {
|
34 |
-
if (wptbNodeattributes[_i] && _typeof(wptbNodeattributes[_i]) === 'object' && wptbNodeattributes[_i].nodeName) {
|
35 |
-
var regularText = new RegExp('data-wptb-el-' + element.kind + '-(\\d+)-([a-zA-Z0-9_-]+)', "i");
|
36 |
-
var attr = wptbNodeattributes[_i].nodeName.match(regularText);
|
37 |
-
if (attr && Array.isArray(attr)) {
|
38 |
-
var newDataAttributeName = wptbNodeattributes[_i].nodeName.replace(element.kind + '-' + attr[1], element.kind + '-' + index);
|
39 |
-
var newDataAttributeValue = wptbNodeattributes[_i].nodeValue;
|
40 |
-
node.removeAttribute(wptbNodeattributes[_i].nodeName);
|
41 |
-
node.setAttribute(newDataAttributeName, newDataAttributeValue);
|
42 |
-
}
|
43 |
-
}
|
44 |
-
}
|
45 |
-
}
|
46 |
-
} else if (kindIndexProt && !copy) {
|
47 |
-
var kindIndexProtArr = kindIndexProt.split('-');
|
48 |
-
index = kindIndexProtArr[kindIndexProtArr.length - 1];
|
49 |
-
// start element javascript if element is new
|
50 |
-
}
|
51 |
-
|
52 |
-
var node_wptb_element_kind_num = node.className.match(/wptb-element-(.+)-(\d+)/i);
|
53 |
-
if (node_wptb_element_kind_num) {
|
54 |
-
node.classList.remove(node_wptb_element_kind_num[0]);
|
55 |
-
}
|
56 |
-
if (!node.classList.contains('wptb-ph-element')) {
|
57 |
-
node.classList.add('wptb-ph-element');
|
58 |
-
if (!node.classList.contains('wptb-element-' + element.kind + '-' + index)) {
|
59 |
-
node.classList.add('wptb-element-' + element.kind + '-' + index);
|
60 |
-
}
|
61 |
-
} else {
|
62 |
-
if (!node.classList.contains('wptb-element-' + element.kind + '-' + index)) {
|
63 |
-
node.classList.add('wptb-element-' + element.kind + '-' + index);
|
64 |
-
}
|
65 |
-
}
|
66 |
-
WPTB_Helper.elementStartScript(element.getDOMElement());
|
67 |
-
new WPTB_ElementOptions(element, index, kindIndexProt);
|
68 |
-
document.counter.increment(element.kind);
|
69 |
-
}
|
70 |
-
|
71 |
-
node.onmouseenter = function (event) {
|
72 |
-
if (event.target.classList.contains('wptb-moving-mode')) {
|
73 |
-
return;
|
74 |
-
}
|
75 |
-
|
76 |
-
var wptbActionsField = new WPTB_ActionsField();
|
77 |
-
|
78 |
-
wptbActionsField.addActionField(1, node);
|
79 |
-
|
80 |
-
wptbActionsField.setParameters(node);
|
81 |
-
|
82 |
-
node.classList.remove('wptb-ondragenter');
|
83 |
-
};
|
84 |
-
|
85 |
-
node.onmouseleave = function (event) {
|
86 |
-
var wptbActionsField = new WPTB_ActionsField();
|
87 |
-
|
88 |
-
wptbActionsField.leaveFromField(event, node);
|
89 |
-
};
|
90 |
-
};
|
91 |
-
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
92 |
-
|
93 |
var WPTB_ActionsField = function WPTB_ActionsField() {
|
94 |
var _this = this;
|
95 |
|
@@ -3461,115 +3371,6 @@ var WPTB_Initializer = function WPTB_Initializer() {
|
|
3461 |
WPTB_Helper.activateSection('elements');
|
3462 |
});
|
3463 |
};
|
3464 |
-
var WPTB_innerElementSet = function WPTB_innerElementSet(element) {
|
3465 |
-
|
3466 |
-
element.ondragenter = function (e) {
|
3467 |
-
var div;
|
3468 |
-
if (e.dataTransfer.types.indexOf('wptbelement') == -1 && e.dataTransfer.types.indexOf('wptb-moving-mode') == -1) {
|
3469 |
-
return;
|
3470 |
-
}
|
3471 |
-
WPTB_DropHandle(this, e);
|
3472 |
-
|
3473 |
-
element.classList.add('wptb-ondragenter');
|
3474 |
-
};
|
3475 |
-
element.ondragover = function (e) {
|
3476 |
-
e.preventDefault();
|
3477 |
-
WPTB_DropHandle(this, e);
|
3478 |
-
};
|
3479 |
-
element.ondragleave = function (e) {
|
3480 |
-
WPTB_DropHandle(this, e, true);
|
3481 |
-
};
|
3482 |
-
element.ondrop = function (e) {
|
3483 |
-
this.classList.remove('wptb-ondragenter');
|
3484 |
-
var element = void 0,
|
3485 |
-
classId = void 0;
|
3486 |
-
e.preventDefault();
|
3487 |
-
e.stopPropagation();
|
3488 |
-
|
3489 |
-
if (!e.dataTransfer.getData('wptbElement') && !e.dataTransfer.getData('node')) {
|
3490 |
-
return;
|
3491 |
-
}
|
3492 |
-
var wptbDropHandle = void 0,
|
3493 |
-
wptbDropBorderMarker = void 0;
|
3494 |
-
if (document.getElementsByClassName('wptb-drop-handle').length > 0) {
|
3495 |
-
wptbDropHandle = document.getElementsByClassName('wptb-drop-handle')[0];
|
3496 |
-
}
|
3497 |
-
if (document.getElementsByClassName('wptb-drop-border-marker').length > 0) {
|
3498 |
-
wptbDropBorderMarker = document.getElementsByClassName('wptb-drop-border-marker')[0];
|
3499 |
-
}
|
3500 |
-
|
3501 |
-
if (e.dataTransfer.getData('wptbElement')) {
|
3502 |
-
element = WPTB_Helper.newElementProxy(e.dataTransfer.getData('wptbElement'));
|
3503 |
-
element = element.getDOMElement();
|
3504 |
-
} else {
|
3505 |
-
classId = e.dataTransfer.getData('node');
|
3506 |
-
element = document.getElementsByClassName(classId)[0];
|
3507 |
-
//element.classList.remove( 'wptb-moving-mode' );
|
3508 |
-
}
|
3509 |
-
|
3510 |
-
if (WPTB_Helper.getDragRelativeType() === 'td_relative') {
|
3511 |
-
WPTB_DropHandle(this, e, true);
|
3512 |
-
var parentCell = WPTB_Helper.getParentOfType('td', e.target);
|
3513 |
-
|
3514 |
-
parentCell.appendChild(element);
|
3515 |
-
WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);
|
3516 |
-
} else if (wptbDropHandle.style.display == 'block') {
|
3517 |
-
var td = void 0;
|
3518 |
-
if (wptbDropHandle.dataset.text == 'Drop Here') {
|
3519 |
-
td = wptbDropHandle.getDOMParentElement();
|
3520 |
-
td.appendChild(element);
|
3521 |
-
WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);
|
3522 |
-
} else {
|
3523 |
-
var innerElement = wptbDropHandle.getDOMParentElement();
|
3524 |
-
td = innerElement.parentNode;
|
3525 |
-
|
3526 |
-
if (wptbDropHandle.dataset.text == 'Above Element') {
|
3527 |
-
td.insertBefore(element, innerElement);
|
3528 |
-
WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);
|
3529 |
-
} else if (wptbDropHandle.dataset.text == 'Below Element') {
|
3530 |
-
var innerElementNext = innerElement.nextSibling;
|
3531 |
-
td.insertBefore(element, innerElementNext);
|
3532 |
-
WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);
|
3533 |
-
}
|
3534 |
-
}
|
3535 |
-
|
3536 |
-
var thisRow = td.parentNode;
|
3537 |
-
if (WPTB_Helper.rowIsTop(thisRow)) {
|
3538 |
-
var table = WPTB_Helper.findAncestor(thisRow, 'wptb-preview-table');
|
3539 |
-
|
3540 |
-
if (table.classList.contains('wptb-table-preview-head')) {
|
3541 |
-
WPTB_Helper.dataTitleColumnSet(table);
|
3542 |
-
}
|
3543 |
-
}
|
3544 |
-
|
3545 |
-
// start item javascript if item is new
|
3546 |
-
var infArr = element.className.match(/wptb-element-(.+)-(\d+)/i);
|
3547 |
-
var elemKind = infArr[1];
|
3548 |
-
if (e.dataTransfer.getData('wptbElement') && (elemKind == 'text' || elemKind == 'button' || elemKind == 'image' || elemKind == 'star_rating' || elemKind == 'list')) {
|
3549 |
-
//WPTB_Helper.elementStartScript( element );
|
3550 |
-
}
|
3551 |
-
} else {
|
3552 |
-
return;
|
3553 |
-
}
|
3554 |
-
|
3555 |
-
if (wptbDropHandle) {
|
3556 |
-
wptbDropHandle.style.display = 'none';
|
3557 |
-
wptbDropBorderMarker.style.display = 'none';
|
3558 |
-
}
|
3559 |
-
|
3560 |
-
WPTB_innerElementSet(element);
|
3561 |
-
|
3562 |
-
if (!element.classList.contains('wptb-image-container') || element.classList.contains('wptb-moving-mode')) {
|
3563 |
-
element.classList.remove('wptb-moving-mode');
|
3564 |
-
var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
|
3565 |
-
wptbTableStateSaveManager.tableStateSet();
|
3566 |
-
}
|
3567 |
-
return true;
|
3568 |
-
};
|
3569 |
-
element.onmouseover = function (e) {
|
3570 |
-
element.classList.remove('wptb-ondragenter');
|
3571 |
-
};
|
3572 |
-
};
|
3573 |
var WPTB_LeftPanel = function WPTB_LeftPanel() {
|
3574 |
|
3575 |
var table = document.getElementsByClassName('wptb-preview-table')[0],
|
@@ -6609,4 +6410,203 @@ var WPTB_TableStateSaveManager = function WPTB_TableStateSaveManager() {
|
|
6609 |
}
|
6610 |
};
|
6611 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6612 |
//# sourceMappingURL=admin.js.map
|
1 |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
var WPTB_ActionsField = function WPTB_ActionsField() {
|
4 |
var _this = this;
|
5 |
|
3371 |
WPTB_Helper.activateSection('elements');
|
3372 |
});
|
3373 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3374 |
var WPTB_LeftPanel = function WPTB_LeftPanel() {
|
3375 |
|
3376 |
var table = document.getElementsByClassName('wptb-preview-table')[0],
|
6410 |
}
|
6411 |
};
|
6412 |
};
|
6413 |
+
var WPTB_innerElementSet = function WPTB_innerElementSet(element) {
|
6414 |
+
|
6415 |
+
element.ondragenter = function (e) {
|
6416 |
+
var div;
|
6417 |
+
if (e.dataTransfer.types.indexOf('wptbelement') == -1 && e.dataTransfer.types.indexOf('wptb-moving-mode') == -1) {
|
6418 |
+
return;
|
6419 |
+
}
|
6420 |
+
WPTB_DropHandle(this, e);
|
6421 |
+
|
6422 |
+
element.classList.add('wptb-ondragenter');
|
6423 |
+
};
|
6424 |
+
element.ondragover = function (e) {
|
6425 |
+
e.preventDefault();
|
6426 |
+
WPTB_DropHandle(this, e);
|
6427 |
+
};
|
6428 |
+
element.ondragleave = function (e) {
|
6429 |
+
WPTB_DropHandle(this, e, true);
|
6430 |
+
};
|
6431 |
+
element.ondrop = function (e) {
|
6432 |
+
this.classList.remove('wptb-ondragenter');
|
6433 |
+
var element = void 0,
|
6434 |
+
classId = void 0;
|
6435 |
+
e.preventDefault();
|
6436 |
+
e.stopPropagation();
|
6437 |
+
|
6438 |
+
if (!e.dataTransfer.getData('wptbElement') && !e.dataTransfer.getData('node')) {
|
6439 |
+
return;
|
6440 |
+
}
|
6441 |
+
var wptbDropHandle = void 0,
|
6442 |
+
wptbDropBorderMarker = void 0;
|
6443 |
+
if (document.getElementsByClassName('wptb-drop-handle').length > 0) {
|
6444 |
+
wptbDropHandle = document.getElementsByClassName('wptb-drop-handle')[0];
|
6445 |
+
}
|
6446 |
+
if (document.getElementsByClassName('wptb-drop-border-marker').length > 0) {
|
6447 |
+
wptbDropBorderMarker = document.getElementsByClassName('wptb-drop-border-marker')[0];
|
6448 |
+
}
|
6449 |
+
|
6450 |
+
if (e.dataTransfer.getData('wptbElement')) {
|
6451 |
+
element = WPTB_Helper.newElementProxy(e.dataTransfer.getData('wptbElement'));
|
6452 |
+
element = element.getDOMElement();
|
6453 |
+
} else {
|
6454 |
+
classId = e.dataTransfer.getData('node');
|
6455 |
+
element = document.getElementsByClassName(classId)[0];
|
6456 |
+
//element.classList.remove( 'wptb-moving-mode' );
|
6457 |
+
}
|
6458 |
+
|
6459 |
+
if (WPTB_Helper.getDragRelativeType() === 'td_relative') {
|
6460 |
+
WPTB_DropHandle(this, e, true);
|
6461 |
+
var parentCell = WPTB_Helper.getParentOfType('td', e.target);
|
6462 |
+
|
6463 |
+
parentCell.appendChild(element);
|
6464 |
+
WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);
|
6465 |
+
} else if (wptbDropHandle.style.display == 'block') {
|
6466 |
+
var td = void 0;
|
6467 |
+
if (wptbDropHandle.dataset.text == 'Drop Here') {
|
6468 |
+
td = wptbDropHandle.getDOMParentElement();
|
6469 |
+
td.appendChild(element);
|
6470 |
+
WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);
|
6471 |
+
} else {
|
6472 |
+
var innerElement = wptbDropHandle.getDOMParentElement();
|
6473 |
+
td = innerElement.parentNode;
|
6474 |
+
|
6475 |
+
if (wptbDropHandle.dataset.text == 'Above Element') {
|
6476 |
+
td.insertBefore(element, innerElement);
|
6477 |
+
WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);
|
6478 |
+
} else if (wptbDropHandle.dataset.text == 'Below Element') {
|
6479 |
+
var innerElementNext = innerElement.nextSibling;
|
6480 |
+
td.insertBefore(element, innerElementNext);
|
6481 |
+
WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);
|
6482 |
+
}
|
6483 |
+
}
|
6484 |
+
|
6485 |
+
var thisRow = td.parentNode;
|
6486 |
+
if (WPTB_Helper.rowIsTop(thisRow)) {
|
6487 |
+
var table = WPTB_Helper.findAncestor(thisRow, 'wptb-preview-table');
|
6488 |
+
|
6489 |
+
if (table.classList.contains('wptb-table-preview-head')) {
|
6490 |
+
WPTB_Helper.dataTitleColumnSet(table);
|
6491 |
+
}
|
6492 |
+
}
|
6493 |
+
|
6494 |
+
// start item javascript if item is new
|
6495 |
+
var infArr = element.className.match(/wptb-element-(.+)-(\d+)/i);
|
6496 |
+
var elemKind = infArr[1];
|
6497 |
+
if (e.dataTransfer.getData('wptbElement') && (elemKind == 'text' || elemKind == 'button' || elemKind == 'image' || elemKind == 'star_rating' || elemKind == 'list')) {
|
6498 |
+
//WPTB_Helper.elementStartScript( element );
|
6499 |
+
}
|
6500 |
+
} else {
|
6501 |
+
return;
|
6502 |
+
}
|
6503 |
+
|
6504 |
+
if (wptbDropHandle) {
|
6505 |
+
wptbDropHandle.style.display = 'none';
|
6506 |
+
wptbDropBorderMarker.style.display = 'none';
|
6507 |
+
}
|
6508 |
+
|
6509 |
+
WPTB_innerElementSet(element);
|
6510 |
+
|
6511 |
+
if (!element.classList.contains('wptb-image-container') || element.classList.contains('wptb-moving-mode')) {
|
6512 |
+
element.classList.remove('wptb-moving-mode');
|
6513 |
+
var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
|
6514 |
+
wptbTableStateSaveManager.tableStateSet();
|
6515 |
+
}
|
6516 |
+
return true;
|
6517 |
+
};
|
6518 |
+
element.onmouseover = function (e) {
|
6519 |
+
element.classList.remove('wptb-ondragenter');
|
6520 |
+
};
|
6521 |
+
};
|
6522 |
+
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
6523 |
+
|
6524 |
+
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
|
6525 |
+
|
6526 |
+
var applyGenericItemSettings = function applyGenericItemSettings(element, kindIndexProt) {
|
6527 |
+
var copy = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
6528 |
+
|
6529 |
+
var node = element.getDOMElement(),
|
6530 |
+
index,
|
6531 |
+
copy;
|
6532 |
+
if (node.classList.contains('wptb-ph-element')) {
|
6533 |
+
if (kindIndexProt == undefined || copy == true) {
|
6534 |
+
//index = document.counter.nextIndex( element.kind );
|
6535 |
+
var wptbElements = document.getElementsByClassName('wptb-ph-element');
|
6536 |
+
var elementIndexesArr = [];
|
6537 |
+
for (var i = 0; i < wptbElements.length; i++) {
|
6538 |
+
var regex = new RegExp('wptb-element-' + element.kind + '-(\\d+)', "i");
|
6539 |
+
var infArr = wptbElements[i].className.match(regex);
|
6540 |
+
if (infArr) {
|
6541 |
+
elementIndexesArr.push(infArr[1]);
|
6542 |
+
}
|
6543 |
+
}
|
6544 |
+
if (elementIndexesArr.length > 0) {
|
6545 |
+
var elementIndexMax = Math.max.apply(Math, elementIndexesArr);
|
6546 |
+
index = elementIndexMax + 1;
|
6547 |
+
} else {
|
6548 |
+
index = 1;
|
6549 |
+
}
|
6550 |
+
|
6551 |
+
if (copy) {
|
6552 |
+
// change all data-elements which save parameters for different controls
|
6553 |
+
var wptbNodeattributes = [].concat(_toConsumableArray(node.attributes));
|
6554 |
+
for (var _i = 0; _i < wptbNodeattributes.length; _i++) {
|
6555 |
+
if (wptbNodeattributes[_i] && _typeof(wptbNodeattributes[_i]) === 'object' && wptbNodeattributes[_i].nodeName) {
|
6556 |
+
var regularText = new RegExp('data-wptb-el-' + element.kind + '-(\\d+)-([a-zA-Z0-9_-]+)', "i");
|
6557 |
+
var attr = wptbNodeattributes[_i].nodeName.match(regularText);
|
6558 |
+
if (attr && Array.isArray(attr)) {
|
6559 |
+
var newDataAttributeName = wptbNodeattributes[_i].nodeName.replace(element.kind + '-' + attr[1], element.kind + '-' + index);
|
6560 |
+
var newDataAttributeValue = wptbNodeattributes[_i].nodeValue;
|
6561 |
+
node.removeAttribute(wptbNodeattributes[_i].nodeName);
|
6562 |
+
node.setAttribute(newDataAttributeName, newDataAttributeValue);
|
6563 |
+
}
|
6564 |
+
}
|
6565 |
+
}
|
6566 |
+
}
|
6567 |
+
} else if (kindIndexProt && !copy) {
|
6568 |
+
var kindIndexProtArr = kindIndexProt.split('-');
|
6569 |
+
index = kindIndexProtArr[kindIndexProtArr.length - 1];
|
6570 |
+
// start element javascript if element is new
|
6571 |
+
}
|
6572 |
+
|
6573 |
+
var node_wptb_element_kind_num = node.className.match(/wptb-element-(.+)-(\d+)/i);
|
6574 |
+
if (node_wptb_element_kind_num) {
|
6575 |
+
node.classList.remove(node_wptb_element_kind_num[0]);
|
6576 |
+
}
|
6577 |
+
if (!node.classList.contains('wptb-ph-element')) {
|
6578 |
+
node.classList.add('wptb-ph-element');
|
6579 |
+
if (!node.classList.contains('wptb-element-' + element.kind + '-' + index)) {
|
6580 |
+
node.classList.add('wptb-element-' + element.kind + '-' + index);
|
6581 |
+
}
|
6582 |
+
} else {
|
6583 |
+
if (!node.classList.contains('wptb-element-' + element.kind + '-' + index)) {
|
6584 |
+
node.classList.add('wptb-element-' + element.kind + '-' + index);
|
6585 |
+
}
|
6586 |
+
}
|
6587 |
+
WPTB_Helper.elementStartScript(element.getDOMElement());
|
6588 |
+
new WPTB_ElementOptions(element, index, kindIndexProt);
|
6589 |
+
document.counter.increment(element.kind);
|
6590 |
+
}
|
6591 |
+
|
6592 |
+
node.onmouseenter = function (event) {
|
6593 |
+
if (event.target.classList.contains('wptb-moving-mode')) {
|
6594 |
+
return;
|
6595 |
+
}
|
6596 |
+
|
6597 |
+
var wptbActionsField = new WPTB_ActionsField();
|
6598 |
+
|
6599 |
+
wptbActionsField.addActionField(1, node);
|
6600 |
+
|
6601 |
+
wptbActionsField.setParameters(node);
|
6602 |
+
|
6603 |
+
node.classList.remove('wptb-ondragenter');
|
6604 |
+
};
|
6605 |
+
|
6606 |
+
node.onmouseleave = function (event) {
|
6607 |
+
var wptbActionsField = new WPTB_ActionsField();
|
6608 |
+
|
6609 |
+
wptbActionsField.leaveFromField(event, node);
|
6610 |
+
};
|
6611 |
+
};
|
6612 |
//# sourceMappingURL=admin.js.map
|
inc/admin/js/admin.js.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"sources":["applyGenericItemSettings.js","WPTB_ActionsField.js","WPTB_Builder.js","WPTB_Cell.js","WPTB_CutGlueTable.js","WPTB_DropHandle.js","WPTB_ElementCounters.js","WPTB_ElementObject.js","WPTB_ElementOptions.js","WPTB_HeaderToolbox.js","WPTB_Helper.js","WPTB_Initializer.js","WPTB_innerElementSet.js","WPTB_LeftPanel.js","WPTB_MultipleSelect.js","WPTB_Parser.js","WPTB_Polyfills.js","WPTB_RecalculateIndexes.js","WPTB_Responsive.js","WPTB_Settings.js","WPTB_SortableTable.js","WPTB_Stringifier.js","WPTB_Table.js","WPTB_TableSettingsData.js","WPTB_TableStateSaveManager.js"],"names":["applyGenericItemSettings","element","kindIndexProt","copy","node","getDOMElement","index","classList","contains","undefined","wptbElements","document","getElementsByClassName","elementIndexesArr","i","length","regex","RegExp","kind","infArr","className","match","push","elementIndexMax","Math","max","wptbNodeattributes","attributes","nodeName","regularText","attr","Array","isArray","newDataAttributeName","replace","newDataAttributeValue","nodeValue","removeAttribute","setAttribute","kindIndexProtArr","split","node_wptb_element_kind_num","remove","add","WPTB_Helper","elementStartScript","WPTB_ElementOptions","counter","increment","onmouseenter","event","target","wptbActionsField","WPTB_ActionsField","addActionField","setParameters","onmouseleave","leaveFromField","wptbActions","actionType","thisNode","body","getElementsByTagName","actions","previousNode","activeElem","parentNode","removeChild","btnDelete","btnCopy","createElement","appendChild","type","onclick","act","el","hasOwnProperty","thisRow","rowIsTop","table","findAncestor","dataTitleColumnSet","actionsRemove","wptbTableStateSaveManager","WPTB_TableStateSaveManager","tableStateSet","wptbDocumentEventGenerate","activeElement","activeElemParent","data","elemProt","tinyMceClear","WPTB_ElementObject","insertBefore","nextSibling","elementCopy","cloneNode","WPTB_innerElementSet","btnMove","draggable","ondragstart","wptbElementIconsDirectories","tmplIconsDirectories","wp","template","jsonIconsDirectories","IconsDirectories","JSON","parse","dragImages","getElementIcon","dataTransfer","effectAllowed","setDragImage","setData","style","display","actionsHide","ondragend","elementDragEndClear","coordinatesElement","getBoundingClientRect","wptbContainer","correctTop","top","parseFloat","removeEventListener","left","right","clientWidth","addEventListener","relatedTarget","opacity","WPTB_Builder","table_id","detectMode","http","XMLHttpRequest","urlSet","ajaxurl","open","setRequestHeader","onreadystatechange","d","readyState","status","ans","responseText","getElementById","value","wptbTableSetupEl","WPTB_Parser","WPTB_Table","querySelector","dataset","wptbTableContainerMaxWidth","maxWidth","tdDefaultWidth","WPTB_Settings","send","ElementCounters","select","MultipleSelect","initializer","WPTB_Initializer","settings","url","window","location","href","results","exec","WPTB_Cell","callback","DOMElement","highlightRow","td","parentRow","columnCount","parseInt","tds","classToAdd","ttd","highlightColumn","rowCount","tr","padding","jQuery","val","innerBorderWidth","border","ondblclick","stopPropagation","wptbTableSetup","yIndex","wptbSortableTable","currentTarget","newElementProxy","wptbPhElement","wptbElementTypeClass","wptbTypeElementArr","wptbInternalActiveElement","j","wptbInternalActiveElementObj","setCoords","y","x","xIndex","getCoords","coords","appendElement","getCellDimensions","tdStyleObj","getComputedStyle","tdPaddingLeft","getPropertyValue","tdPaddingRight","tdBorderLeftWidth","tdBorderRightWidth","tdPaddingTop","tdPaddingBottom","tdBorderTopWidth","tdBorderBottomWidth","width","offsetWidth","height","offsetHeight","borderCollapse","tableFullStyleObj","tableBorderLeft","tableBorderRight","tableBorderTop","tableBorderBottom","toLowerCase","firstChild","lastChild","WPTB_CutGlueTable","cutTableHorizontally","rowBefore","rows","tableRowsIChildren","children","rowSpan","newTdRowspan","sameCellBeforeDivision","wptbCell","mark","tdTopStyle","getAttribute","colSpan","dataXIndex","dataXIndexNext","beforeTd","maxCols","WPTB_RecalculateIndexes","glueTableHorizontally","hasAttribute","dataSameCellBeforeDivision","tdsSameBeforeDivision","querySelectorAll","tdsSameBeforeDivisionJPlusChildren","k","nextRow","cutTableVertically","col","rowChildren","rowChildrenLength","afterTd","rowSpanNewTd","colSpanOld","colSpanNewTd","tdLeftStyle","tdAnalogThisX","tdAnalogThisY","glueTableVertically","jFirstTdGlue","WPTB_DropHandle","thisElem","e","hide","wptbDropHandle","wptbDropBorderMarker","wptbDropBorderMarkerTop","wptbDropBorderMarkerRight","wptbDropBorderMarkerBottom","wptbDropBorderMarkerLeft","toPx","getDragRelativeType","cellRelatedDropHandle","range","createRange","setStart","shadowRoot","createContextualFragment","parentTd","getParentOfType","ondragenter","preventDefault","ondragover","ondragleave","ondrop","getData","wptbMovingMode","text","getDOMParentElement","innerElement","innerElementNext","onscroll","localName","indics","types","notDragEnter","indexOf","elementDrag","offsetY","layerY","bottom","priv","key","nextIndex","wpTemplateId","itemHtml","trim","innerHTML","wptbElementMutch","elementClearFromTinyMce","inElems","inElemObj","elementOptionsSet","capture","WPTB_HeaderToolbox","wrapperQuery","topMargin","assignButtons","manageCellsButton","activateSection","toggleToolboxVisibility","show","init","detail","hexToRgb","hex","result","rgbToHex","rgb","isHex","rgbm","round","toString","toUpperCase","slice","test","icon_directory","hostName","protocol","hostname","img","src","wptbDropHandles","wptbDropBorderMarkers","linkHttpCheckChange","link","convertToAbs","currentLocation","origin","linkArr","linkClean","cls","parentElement","row","parent","getSelectionText","txt","getSelection","selection","elementOptionsPanelClear","elementOptionsGroup","wpColorPickerCheckChangeForTableStateSaving","originalEvent","wpPickerContainer","irisStripMouseUpStateSaveManager","wpColorPickerClear","attribute","isId","input","newInput","decodeURIComponent","getTableId","tableId","getColumnWidth","cell","xIndexes","cellWidth","getRowHeight","yIndexes","cellHeight","wpColorPickerChange","ui","uiColor","color","classe","ps","number","affectedEl","backgroundColor","ratingStar","span","fill","wptbTextMessageSize","numberImputSize","wptbNumberInputs","maxCount","maxValue","onkeydown","thisValue","String","substring","onkeyup","ucfirst","str","charAt","eventName","details","CustomEvent","bubbles","dispatchEvent","WPTB_ElementsScriptsLauncher","deleteEventHandlers","off","elementChildren","replaceAll","string","search","join","mceContentBodys","dataMceStyle","mceEditFocus","contentEditable","spellCheck","mceIds","elementOptionContainerCustomClassSet","targetInput","customClassForContainer","containerElement","elementOptionContainerAdditionalStyles","containerAdditionalStyles","containerStylesArrOne","containerStylesSet","containerStyleStr","containerStyleStrArr","controlsInclude","functionHandler","acceptEventValues","controlConnectFunctionsName","name","elementKind","elementOptionsGroupIds","optionsGroupIds","elementOptionsGroupId","controlActiveElements","map","controlInfArr","controlActiveElement","controlUnicClassName","controls","controlName","control","targetControlValue","targetControlValueGet","targetValue","eventValue","oneControlInclude","wptbContrlStacksConfigId","tmplControlsConfig","container","jsonControlsConfigJson","jsonControlsConfig","controlClassName","innerElementCopyIncludeHandler","valueDependOnControl","dependOnControlName","targetControlElementClass","valueDependOnControlCorrect","dependOnControlDataGet","dependOnControlElementsArr","dependOnControlElements","valueDependOnControlCorrectObj","s","dependOnControlElementClass","dependOnControlData","Object","keys","forEach","unicClass","appearDependOnControl","dependOnMain","dependOnControlElementChangeHandler","controlContainerElem","dependOnControlElementsValue","dependOn","dependOnControlElementValue","showHideTargetControlElement","prototype","call","targetControlElement","dependOnControlElement","bind","controlsStateManager","targetControlClass","controlChangeIndic","targetControls","selectorElement","elementsSettingsTemplatesJs","elementSettings","elementsSettings","stringify","checked","alignmentValue","elementControlsStateCopy","elementProt","copyElem","infArrProt","infArrCopy","elemProtKind","elemCopyKind","elementsSettingsTemplateJs","elementSettingsProt","elementSettingsCopy","elementSettingValue","elementSettingKeyCopy","elementControlsStateDelete","nameControl","wptbElementDatas","elementContainerClass","elementOptionClassIndic","controlElementParent","elementOptionsScriptsContainer","cellEditActiveClass","startsWith","wptbelementOptionClass","childNodes","controlsConfigJson","controlsConfig","elementOptionsGroupIdsInvolved","elementOptionsGroupInvolved","elementOptionsContainerInvolved","controlScriptsObj","controlappearDependOnControl","controlValueDependOnControl","elementOptionsScriptsContainerIndic","controlsConfigNew","controlKey","tmplControlTemplate","elemContainer","elementControlTargetUnicClass","controlParamCalculateValue","controlTemplate","elementOptionsContainerInvolvedGet","elementOptionsContainer","elementOptionsGroupChildren","elementOptionsContainerOn","elementOptionContainerOn","elementOptionContainer","elementOptionClass","controlContainerElemParent","helperJavascriptElem","helperJavascriptCode","innerText","script","controlScriptsArr","id","unicClassP","controlParamCalculateValueCreateFunction","handlerFunction","managerExternalCssStyles","elementContainer","selector","cssName","cssValue","head","cssForThisElement","cssText","cssTextArrFirst","pop","selectorExists","cssTextArrSecond","cssTextArrThird","cssNameExists","cssTextArrFourth","splice","registerSections","sections","currentSection","sectionElement","sectionDataId","displayType","triggerSectionEvent","visibility","getCurrentSection","getSectionFromUrl","parsedUrl","URL","urlSection","searchParams","get","some","setupSectionButtons","sectionButtons","from","vm","sectionName","wptbSectionButton","wptbSectionDisplayType","setupPanelToggleButtons","$","each","find","click","slideToggle","toggleClass","sectionEvent","setupSidebarToggle","toggleSelector","toggleButton","toggle","externalCssStylesDelete","externalCssStylesCopy","copyElement","activeElemClass","cssForActiveElement","cssForNewElement","infArrCopyEl","cssForActiveElementInnerHTML","cssForNewElementInnerHTML","elementsStylesConvertToObject","stylesElements","stylesObj","styleElemId","elementsStylesSetFromObject","jsonObject","styleCss","saveTable","startSaving","previewSaving","wptbTableStateNumberSave","wptbTableStateNumberShow","bar","toggleTableEditMode","wptb_admin_object","t","messagingArea","code","datas","postId","rs","wptbId","paramIdsNecessaryChange","codeClone","columns","WPTB_Stringifier","outerHTML","datas_containers","styleObjJson","messagingAreaText","setTimeout","params","title","content","elements_datas","elements_styles","security_code","preview_saving","action","builderPageUrl","history","pushState","wptbPreviewTable","wptbPreviewBtn","wptbPreviewBtnHref","previewHref","wptbSaveBtn","clickOnFreeSpace","cellModeBackground","wpcdFixedToolbar","elementAjax","dataAjaxData","element_name","element_ajax_data","close","leftScrollPanelCurtain","leftScrollPanelCellSettings","toggleEditMode","deactivateMultipleSelectMode","wptbPreviewTableTds","activateMultipleSelectMode","checkingDimensionValue","dimension","searchIndex","checkSetGetStyleSizeValue","styleName","computedStyleName","elemStyleValue","elementStyles","checkSetGetStyleColorValue","set","elemStyleColorValue","checkSetGetStyleValue","getValueMaxCountSameElementsInArray","arr","check","countEmpty","maxPropName","recalculateIndexes","tableRowsColorsReinstall","tableIndex","tableHeaderBackground","tableEvenRowBackground","tableOddRowBackground","parentType","dragRelativeType","setDragRelativeType","getElementColorStylesHex","showControlsOnElementMount","showElementsListOnRemove","blockTinyMCEManageCells","addBlocker","blockerElement","removeBlocker","cells","MIN_COLUMNS","MIN_ROWS","MAX_COLUMNS","MAX_ROWS","tableGenerator","columnsDecrementButton","columnsIncrementButton","rowsDecrementButton","rowsIncrementButton","columnsInput","rowsInput","WptbResponsive","div","classId","parentCell","elemKind","onmouseover","WPTB_LeftPanel","wptbElementButtons","wptbElement","wptbTablesEditModeCloseButton","wptbBuilderPanel","wptbHeader","selectedCells","multipleCellMode","isActivated","pushSelectedCell","flushSelectedCells","getFirst","minXIndex","minYIndex","first","getLast","maxXIndex","maxYIndex","last","removeAllButFirst","columnTitleMobile","hasDontEnumBug","propertyIsEnumerable","dontEnums","dontEnumsLength","obj","TypeError","prop","trs","maxColsFull","tdsArr","jMainIter","z","responsiveWrapperId","mainContainerQuery","responsiveTable","loaded","addContainerToDom","responsiveContainer","mainContainer","Error","responsiveElement","load","WPTB_ControlsManager","callControlScript","startUp","tablePreview","elems","wptbRelativeElements","wptbUndo","tableStateGet","wptbUndoredo","wptbUndoRedoContainer","wptbRedo","shortcodePopupWindow","onbeforeunload","wptbSaveDisabled","previewId","floor","random","newHref","tableTitleField","onchange","WPTB_SortableTable","topRow","sortModeSwitcher","active","sortableTableVerticalStart","sortingCellMouseMoveSwitcher","wptbSortableTableVertical","sortableTableHorizontalStart","wptbSortableTableHorizontal","sortableTableInitialization","sortingCellMouseMoveVertical","tdMouseLeave","sortingCellMouseMoveHorizontal","sortingCellMouseMov","tagName","offsetX","layerX","xMatch","clientHeight","sortableTable","tableWasSorted","rowspan","rowNum","rowsValuesArr","rowsTdFirst","tdYCoordsRowSpanPrevious","tdsChanged","changeSortingTdsCollection","tdRowspan","textElementsValues","textElementsValuesGet","rowsTd","orderBy","setSortedAscDataAttr","sort","prev","next","sortOrder","unshift","tBody","rowsValObj","colspan","colNum","columnsValuesArr","columnsTdFirst","tdXCoordsColSpanPrevious","tdColspan","columnsTd","tdsColumn","columnsValObj","removeCellsAttrAfterDivision","tableSM","dataAttr","prevValue","nextValue","textElements","p","tdIndexSpanPrev","tdsCollectionChanged","collectionTds","collectionTdsJSpan","collectionTdsJSpanProperty","indexName","indexNameCamelCase","indexNamePerpendicularCamelCase","tdSpanProperty","tableGroupCount","tdSpan","tdsAll","codeMain","tableColumns","minWidth","innerElements","wptbActionsLength","dataMceBogus","array","wptb_preview_table","maxAmountOfCells","maxAmountOfRows","cs","noCells","singleCells","multipleCells","cellSettings","position","column","cellHighlighted","markedCells","controlElemIds","elementControlSizeUnicClass","elementControlSizeFixedUnicClass","sizeName","getSizeFunctionName","size","cellSizeInputs","cellSizeFixedInput","isSquare","settingId","settingElem","countMarkedCells","realTimeArray","carried","cols","matriz","items","justAssigned","amount","carriedRowspans","cellsBuffer","cellPointer","xPosition","stepsToMove","celda","drawTable","a","undoSelect","fillTableArray","colspansSums","colspanSumInRow","apply","getActualPointsInRow","points","skipInCols","reconstraction","insertRow","borderWidth","setMaxAmountOfCells","getMaxAmountOfCells","addColumnWidth","cleaner","highlighted","tableTdsFor","tableRows","widthIsSet","arrayTdsFromPreviousRow","wptbFixedWidth","tableTdsSumMaxWidth","tableTdsSumMaxWidthFixed","tableTdsSumMaxWidthAuto","wptbTableSetupWidth","arrayCellsWidthFixedHelper","arrayCellsWidthAutoHelper","tdPaddingCommon","tableTdBorderCommonWidth","cssForTdsWidthAuto","borderLeftWidth","borderRightWidth","tableBorderCommon","wptbTdWidthAuto","wptbCssTdAutoWidth","tableTdBorderLeftWidth","tableTdBorderRightWidth","CellsWidthAutoCount","wptbTableTdsSumMaxWidth","wptbCellsWidthAutoCount","mergingСellsHorizontally","wptbFixedWidthSize","styleElementCreate","tableTdWidthAuto","tableTdsWidthAutoCommon","cssForTdsWidthAutoOld","wptbTableAlignment","float","addRowHeight","dataYIndex","heightIsSet","arrayTdsPrevious","wptbFixedHeight","mergingCellsVertically","forBreak","addColumnEnd","currentTable","currentTableTd","currentTdStyle","borderColor","WPTB_TableSettingsData","getTableSetting","addColumnStart","firstCell","addColumnAfter","c_pos","cellStyle","pos","newTd","nextSib","addColumnBefore","addRowToTheEnd","r","aux","addRowToTheStart","addRowBefore","cellNew","addRowAfter","cellRowSpan","rowAfter","cellsColSpan","tableRIChildrenLength","rowIRowSpan","rNext","rNextChildren","rNextChildrenLength","rowStart","columnStart","rowEnd","columnEnd","itemsEstimate","mergeCells","dimensions","tdsChildrenNew","tdsInternalElements","tdsIntElemLength","firstWidth","firstDataFixedWidth","firstHeight","firstDataFixedHeight","splitCell","cellStyles","cellXIndex","rowChildInsertBefore","rowNext","Number","findRowspannedCells","difference","actualPoints","addLackingCells","sumRows","totalColspan","deleteRow","thisRowChildren","nextRowChildren","nextRowChildrenLength","tdArr","nextRowChildrenK","jRowChildren","deleteColumn","onresize","setTableSetting","generate","wptbTableStateSaving","wptbNewTableSetup","wptbHighlighted","wptbDirectlyhovered","cssForTdsWidthAutoValue","wptbTableTitle","wptbSetupName","datawptbUndoredo","wptbTableSetupNew","wptbLeftScrollPanelCellSetting","tableStateClear"],"mappings":";;;;AAAA,IAAIA,2BAA2B,SAA3BA,wBAA2B,CAAWC,OAAX,EAAoBC,aAApB,EAAkD;AAAA,QAAfC,IAAe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AA4Bh3B,OAAO8d,wBAAnC,EAA6D,CAA7D,CAAtB;AACD;AACD;;AAED,QAAIxkB,OAAOlD,SAASmD,oBAAT,CAA8B,MAA9B,CAAX;AACA,QAAID,KAAK9C,MAAL,GAAc,CAAlB,EAAqB;AACpB8C,YAAOA,KAAK,CAAL,CAAP;AACA;;AAEDjB,gBAAY2U,wBAAZ;AACAmX;;AAEA,QAAMsT,iCAAiCrhC,SAASyI,cAAT,CAAwB,sCAAxB,CAAvC;AACA,QAAI44B,8BAAJ,EAAoC;AACnCA,oCAA+BzhC,SAA/B,CAAyCmC,MAAzC,CAAgD,SAAhD;AACA;AACD;AACD;AACD,EAlID;;AAoIA,MAAKu/B,eAAL,GAAuB,YAAY;AAClC,SAAO13B,OAAOg3B,oBAAd;AACA,SAAOh3B,OAAO8d,wBAAd;;AAEA,MAAImC,cAAc7pB,SAASC,sBAAT,CAAgC,eAAhC,CAAlB;AACA,MAAI4pB,YAAYzpB,MAAZ,GAAqB,CAAzB,EAA4B;AAC3BypB,iBAAcA,YAAY,CAAZ,CAAd;;AAEAA,eAAYnoB,eAAZ,CAA4B,mCAA5B;AACA;;AAED,MAAIsvB,WAAWhxB,SAASC,sBAAT,CAAgC,WAAhC,CAAf;AACA,MAAI+wB,SAAS5wB,MAAT,GAAkB,CAAtB,EAAyB;AACxB4wB,cAAWA,SAAS,CAAT,CAAX;;AAEAA,YAASpxB,SAAT,CAAmBoC,GAAnB,CAAuB,wBAAvB;AACA;;AAED,MAAIovB,WAAWpxB,SAASC,sBAAT,CAAgC,WAAhC,CAAf;AACA,MAAImxB,SAAShxB,MAAT,GAAkB,CAAtB,EAAyB;AACxBgxB,cAAWA,SAAS,CAAT,CAAX;;AAEAA,YAASxxB,SAAT,CAAmBoC,GAAnB,CAAuB,wBAAvB;AACA;AACD,EAxBD;AAyBA,CA/QD","file":"admin.js","sourcesContent":["var applyGenericItemSettings = function ( element, kindIndexProt, copy = false ) {\r\n var node = element.getDOMElement(),\r\n index,\r\n copy;\r\n if( node.classList.contains( 'wptb-ph-element' ) ) {\r\n if ( kindIndexProt == undefined || copy == true ) {\r\n //index = document.counter.nextIndex( element.kind );\r\n let wptbElements = document.getElementsByClassName( 'wptb-ph-element' );\r\n let elementIndexesArr = [];\r\n for( let i = 0; i < wptbElements.length; i++ ) {\r\n var regex = new RegExp( 'wptb-element-' + element.kind + '-(\\\\d+)', \"i\" );\r\n let infArr = wptbElements[i].className.match( regex );\r\n if( infArr ) {\r\n elementIndexesArr.push( infArr[1] );\r\n }\r\n }\r\n if( elementIndexesArr.length > 0 ) {\r\n let elementIndexMax = Math.max( ...elementIndexesArr );\r\n index = elementIndexMax + 1;\r\n } else { \r\n index = 1;\r\n }\r\n\r\n if( copy ) {\r\n // change all data-elements which save parameters for different controls\r\n let wptbNodeattributes = [...node.attributes];\r\n for( let i = 0; i < wptbNodeattributes.length; i++ ) {\r\n if( wptbNodeattributes[i] && typeof wptbNodeattributes[i] === 'object' && wptbNodeattributes[i].nodeName ) {\r\n let regularText = new RegExp( 'data-wptb-el-' + element.kind + '-(\\\\d+)-([a-zA-Z0-9_-]+)', \"i\" );\r\n let attr = wptbNodeattributes[i].nodeName.match( regularText );\r\n if( attr && Array.isArray( attr ) ) {\r\n let newDataAttributeName = wptbNodeattributes[i].nodeName.replace( element.kind + '-' + attr[1], element.kind + '-' + index );\r\n let newDataAttributeValue = wptbNodeattributes[i].nodeValue;\r\n node.removeAttribute( wptbNodeattributes[i].nodeName );\r\n node.setAttribute( newDataAttributeName, newDataAttributeValue );\r\n }\r\n }\r\n }\r\n }\r\n } else if ( kindIndexProt && ! copy ) {\r\n let kindIndexProtArr = kindIndexProt.split('-');\r\n index = kindIndexProtArr[kindIndexProtArr.length - 1];\r\n // start element javascript if element is new\r\n \r\n }\r\n\r\n let node_wptb_element_kind_num = node.className.match(/wptb-element-(.+)-(\\d+)/i);\r\n if ( node_wptb_element_kind_num ) {\r\n node.classList.remove( node_wptb_element_kind_num[0] );\r\n }\r\n if ( ! node.classList.contains( 'wptb-ph-element' ) ) {\r\n node.classList.add( 'wptb-ph-element' );\r\n if( ! node.classList.contains( 'wptb-element-' + element.kind + '-' + index ) ) {\r\n node.classList.add( 'wptb-element-' + element.kind + '-' + index );\r\n }\r\n } else {\r\n if( ! node.classList.contains( 'wptb-element-' + element.kind + '-' + index ) ) {\r\n node.classList.add( 'wptb-element-' + element.kind + '-' + index );\r\n }\r\n }\r\n WPTB_Helper.elementStartScript( element.getDOMElement() );\r\n new WPTB_ElementOptions( element, index, kindIndexProt );\r\n document.counter.increment(element.kind);\r\n }\r\n \r\n node.onmouseenter = function ( event ) {\r\n if( event.target.classList.contains( 'wptb-moving-mode' ) ) {\r\n return;\r\n }\r\n \r\n let wptbActionsField = new WPTB_ActionsField();\r\n \r\n wptbActionsField.addActionField( 1, node );\r\n \r\n wptbActionsField.setParameters( node );\r\n \r\n node.classList.remove( 'wptb-ondragenter' );\r\n };\r\n \r\n node.onmouseleave = function ( event ) {\r\n let wptbActionsField = new WPTB_ActionsField();\r\n \r\n wptbActionsField.leaveFromField( event, node );\r\n };\r\n};","var WPTB_ActionsField = function() {\r\n //this.wptbBorderMarker;\r\n this.wptbActions;\r\n if( document.getElementsByClassName( 'wptb-actions' ).length != 0 ) {\r\n this.wptbActions = document.getElementsByClassName( 'wptb-actions' )[0];\r\n }\r\n \r\n this.addActionField = ( actionType, thisNode ) => {\r\n let body = document.getElementsByTagName( 'body' )[0];\r\n \r\n let actions = document.getElementsByClassName( 'wptb-actions' );\r\n if( actions.length != 0 ) {\r\n let previousNode = actions[0].activeElem;\r\n if( previousNode ) {\r\n previousNode.classList.remove( 'wptb-directlyhovered' );\r\n }\r\n \r\n while( actions.length != 0 ) {\r\n actions[0].parentNode.removeChild( actions[0] );\r\n }\r\n }\r\n \r\n if( actionType == 1 ) {\r\n \r\n let btnDelete, btnCopy;\r\n\r\n btnDelete = document.createElement( 'span' ),\r\n btnCopy = document.createElement( 'span' ),\r\n actions = document.createElement( 'div' );\r\n\r\n actions.classList.add( 'wptb-actions' );\r\n btnDelete.classList.add( 'dashicons', 'dashicons-trash', 'wptb-delete-action' );\r\n btnCopy.classList.add( 'dashicons', 'dashicons-admin-page', 'wptb-duplicate-action' );\r\n \r\n actions.appendChild( btnCopy );\r\n actions.appendChild( btnDelete );\r\n \r\n body.appendChild( actions );\r\n\r\n actions.activeElem = thisNode;\r\n\r\n actions.type = 1;\r\n\r\n btnDelete.onclick = function( event ) {\r\n let act = event.target.parentNode.activeElem,\r\n el = act.parentNode;\r\n let infArr = act.className.match( /wptb-element-(.+)-(\\d+)/i );\r\n// if( act && infArr && Array.isArray( infArr ) ) {\r\n// WPTB_Helper.elementControlsStateDelete( act );\r\n// WPTB_Helper.externalCssStylesDelete( infArr[0] );\r\n// }\r\n \r\n if( act ) {\r\n el.removeChild( act );\r\n }\r\n\r\n if( act && typeof act === 'object' && act.hasOwnProperty( 'kind' ) && act.kind == 'text' ) {\r\n let thisRow = el.parentNode;\r\n \r\n if( WPTB_Helper.rowIsTop( thisRow ) ) {\r\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\r\n\r\n if( table.classList.contains( 'wptb-table-preview-head' ) ) {\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n }\r\n }\r\n\r\n let wptbActionsField = new WPTB_ActionsField();\r\n wptbActionsField.actionsRemove();\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('element:removed:dom', document, act);\r\n };\r\n\r\n btnCopy.onclick = ( event ) => {\r\n let copy,\r\n infArr,\r\n type;\r\n let activeElement = event.target.parentNode.activeElem;\r\n let activeElemParent = activeElement.parentNode;\r\n infArr = activeElement.className.match( /wptb-element-(.+)-(\\d+)/i );\r\n if( infArr && Array.isArray( infArr ) ) {\r\n type = infArr[1];\r\n let data = {};\r\n data.kind = type;\r\n data.elemProt = activeElement;\r\n data.tinyMceClear = true;\r\n copy = new WPTB_ElementObject( data );\r\n //WPTB_Helper.elementControlsStateCopy( activeElement, copy.getDOMElement() );\r\n //WPTB_Helper.externalCssStylesCopy( activeElement, copy.getDOMElement() );\r\n //WPTB_Helper.elementStartScript( copy.getDOMElement() );\r\n \r\n activeElemParent.insertBefore( copy.getDOMElement(), activeElement.nextSibling );\r\n } else {\r\n copy = {};\r\n let elementCopy = activeElement.cloneNode( true );\r\n elementCopy.classList.remove( 'wptb-directlyhovered' );\r\n \r\n copy.getDOMElement = function() {\r\n return elementCopy;\r\n }\r\n \r\n applyGenericItemSettings( copy );\r\n \r\n activeElemParent.insertBefore( copy.getDOMElement(), activeElement.nextSibling );\r\n \r\n WPTB_Helper.wptbDocumentEventGenerate( 'wptb-inner-element:copy', activeElement, copy.getDOMElement() );\r\n }\r\n \r\n WPTB_innerElementSet( copy.getDOMElement() );\r\n\r\n let wptbActionsField = new WPTB_ActionsField( 1, activeElement );\r\n wptbActionsField.setParameters( activeElement );\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n \r\n \r\n if( thisNode.classList.contains( 'wptb-ph-element' ) ) {\r\n let btnMove;\r\n btnMove = document.createElement( 'span' );\r\n btnMove.classList.add( \"dashicons\", \"dashicons-move\", 'wptb-move-action' );\r\n btnMove.draggable = true;\r\n actions.appendChild( btnMove );\r\n \r\n btnMove.ondragstart = ( event ) => {\r\n let wptbElementIconsDirectories = 'wptb-element-icons-directories';\r\n let tmplIconsDirectories = wp.template( wptbElementIconsDirectories );\r\n let data = {};\r\n let jsonIconsDirectories = tmplIconsDirectories( data );\r\n let IconsDirectories = JSON.parse( jsonIconsDirectories );\r\n\r\n let dragImages,\r\n actions = event.target.parentNode,\r\n activeElem = actions.activeElem,\r\n infArr,\r\n type;\r\n infArr = activeElem.className.match( /wptb-element-(.+)-(\\d+)/i );\r\n if( infArr && Array.isArray( infArr ) ) {\r\n type = infArr[1];\r\n activeElem.classList.add( 'wptb-moving-mode' );\r\n\r\n if( IconsDirectories && typeof IconsDirectories === 'object' && IconsDirectories[type] ) {\r\n dragImages = WPTB_Helper.getElementIcon( IconsDirectories[type] );\r\n }\r\n\r\n event.dataTransfer.effectAllowed = 'move';\r\n event.dataTransfer.setDragImage( dragImages, 0, 0 );\r\n event.dataTransfer.setData( 'node', 'wptb-element-' + infArr[1] + '-' + infArr[2] );\r\n event.dataTransfer.setData( 'wptb-moving-mode', 'wptb-element-' + infArr[1] + '-' + infArr[2] );\r\n event.dataTransfer.setData( 'wptbElIndic-' + infArr[1], 'wptbElIndic-' + infArr[1] );\r\n let act = event.target.parentNode.activeElem;\r\n if( act.kind == 'text' ) {\r\n let thisRow = act.parentNode.parentNode;\r\n \r\n if( WPTB_Helper.rowIsTop( thisRow ) ) {\r\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\r\n\r\n if( table.classList.contains( 'wptb-table-preview-head' ) ) {\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n }\r\n }\r\n } else {\r\n this.style.display = 'none';\r\n }\r\n\r\n this.actionsHide();\r\n };\r\n\r\n btnMove.ondragend = ( event ) => {\r\n WPTB_Helper.elementDragEndClear();\r\n }\r\n }\r\n\r\n actions.style.display = 'flex';\r\n\r\n this.wptbActions = actions;\r\n }\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('wptb:actionfield:generated', document);\r\n }\r\n \r\n this.setParameters = ( thisNode ) => {\r\n \r\n if( ! this.wptbActions ) {\r\n let actions = document.getElementsByClassName( 'wptb-actions' );\r\n if( actions.length > 0 ) {\r\n this.wptbActions = actions[0];\r\n } else {\r\n this.wptbActions = false;\r\n }\r\n }\r\n \r\n if( this.wptbActions && this.wptbActions.classList.contains( 'wptb-actions' ) ) {\r\n this.wptbActions.style.display = 'flex';\r\n } else {\r\n return;\r\n }\r\n \r\n let coordinatesElement = thisNode.getBoundingClientRect();\r\n \r\n let wptbContainer = document.getElementsByClassName( 'wptb-container' )[0];\r\n let correctTop = () => {\r\n let coordinatesElement = thisNode.getBoundingClientRect();\r\n this.wptbActions.style.top = parseFloat( coordinatesElement.top ) - 15 + 'px';\r\n }\r\n wptbContainer.removeEventListener( 'scroll', correctTop, false );\r\n \r\n this.wptbActions.style.top = parseFloat( coordinatesElement.top ) - 15 + 'px';\r\n this.wptbActions.style.left = ( parseFloat( coordinatesElement.right ) - parseFloat( this.wptbActions.clientWidth ) ) + 1 + 'px';\r\n \r\n this.wptbActions.style.display = 'flex';\r\n thisNode.classList.add( 'wptb-directlyhovered' );\r\n \r\n wptbContainer.addEventListener( 'scroll', correctTop, false );\r\n }\r\n \r\n this.leaveFromField = ( event, node, actionType ) => {\r\n if( ! this.wptbActions ) {\r\n let actions = document.getElementsByClassName( 'wptb-actions' );\r\n if( actions.length > 0 ) {\r\n this.wptbActions = actions[0];\r\n } else {\r\n this.wptbActions = false;\r\n }\r\n }\r\n \r\n if( ! this.wptbActions ) {\r\n return;\r\n }\r\n \r\n if( event.relatedTarget ) {\r\n if ( event.relatedTarget.classList.contains( 'wptb-actions' ) ||\r\n event.relatedTarget.classList.contains( 'wptb-move-action' ) ||\r\n event.relatedTarget.classList.contains( 'wptb-duplicate-action' ) ||\r\n event.relatedTarget.classList.contains( 'wptb-delete-action' ) || event.relatedTarget.classList.contains( 'wptb-prebuilt-mark-action' ) )\r\n {\r\n if( ! this.wptbActions ) {\r\n this.wptbActions = document.getElementsByClassName( 'wptb-actions' )[0];\r\n }\r\n this.wptbActions.onmouseleave = ( event ) => {\r\n if( event.relatedTarget != null && ( event.relatedTarget.classList.contains( 'wptb-ph-element' ) || \r\n WPTB_Helper.findAncestor( event.relatedTarget, 'wptb-ph-element') ) && event.relatedTarget != this.wptbActions.activeElem &&\r\n WPTB_Helper.findAncestor( event.relatedTarget, 'wptb-directlyhovered' ) != this.wptbActions.activeElem ) {\r\n \r\n// this.wptbActions.style.display = 'none';\r\n// event.relatedTarget.parentNode.parentNode.classList.remove( 'wptb-directlyhovered' );\r\n//\r\n// let wptbActionsField = new WPTB_ActionsField();\r\n//\r\n// wptbActionsField.addActionField( 1, event.relatedTarget.parentNode.parentNode );\r\n//\r\n// wptbActionsField.setParameters( event.relatedTarget.parentNode.parentNode );\r\n } else {\r\n \r\n }\r\n \r\n let wptbActionsField = new WPTB_ActionsField();\r\n\r\n wptbActionsField.leaveFromField( event, event.relatedTarget.parentNode.parentNode );\r\n \r\n event.target.activeElem.classList.remove( 'wptb-directlyhovered' );\r\n }\r\n\r\n return;\r\n } \r\n }\r\n \r\n node.classList.remove( 'wptb-directlyhovered' );\r\n this.wptbActions.style.display = 'none';\r\n \r\n if( event.relatedTarget ) {\r\n if( event.relatedTarget.classList.contains( 'wptb-ph-element' ) || WPTB_Helper.findAncestor( event.relatedTarget, 'wptb-ph-element' ) ) {\r\n this.addActionField( 1, event.relatedTarget.parentNode );\r\n\r\n this.setParameters( event.relatedTarget.parentNode );\r\n }\r\n }\r\n }\r\n \r\n this.actionsRemove = () => {\r\n if( ! this.wptbActions ) {\r\n let actions = document.getElementsByClassName( 'wptb-actions' );\r\n if( actions.length > 0 ) {\r\n this.wptbActions = actions[0];\r\n }\r\n }\r\n \r\n if( this.wptbActions ) {\r\n this.wptbActions.parentNode.removeChild( this.wptbActions );\r\n }\r\n }\r\n \r\n this.actionsHide = () => {\r\n if( ! this.wptbActions ) {\r\n let actions = document.getElementsByClassName( 'wptb-actions' );\r\n if( actions.length > 0 ) {\r\n this.wptbActions = actions[0];\r\n }\r\n }\r\n \r\n if( this.wptbActions ) {\r\n this.wptbActions.style.opacity = 0;\r\n }\r\n }\r\n}","(function () {\r\n var WPTB_Builder = function () {\r\n var table_id = WPTB_Helper.detectMode();\r\n if ( table_id ) {\r\n var http = new XMLHttpRequest(),\r\n urlSet = ajaxurl + \"?action=get_table\" + '&id=' + table_id;\r\n http.open('GET', urlSet, true);\r\n http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');\r\n http.onreadystatechange = function (d) {\r\n if (this.readyState == 4 && this.status == 200) {\r\n var ans = JSON.parse( http.responseText );\r\n document.getElementById('wptb-setup-name').value = ans[0];\r\n \r\n if( ans[1] ) {\r\n // @deprecated old generate logic\r\n // document.getElementsByClassName('wptb-table-generator')[0].style.display = 'none';\r\n let wptbTableSetupEl = document.getElementsByClassName('wptb-table-setup')[0];\r\n wptbTableSetupEl.appendChild( WPTB_Parser( ans[1] ) );\r\n \r\n let body = document.getElementsByTagName('body')[0];\r\n \r\n WPTB_Table();\r\n let element = document.querySelector( '.wptb-preview-table' );\r\n if( element ) {\r\n let infArr = element.className.match( /wptb-element-((.+-)\\d+)/i );\r\n if( ! infArr ) {\r\n element.classList.add( 'wptb-element-main-table_setting-' + table_id );\r\n }\r\n \r\n if( element.dataset.wptbTableContainerMaxWidth ) {\r\n wptbTableSetupEl.style.maxWidth = element.dataset.wptbTableContainerMaxWidth + 'px';\r\n \r\n element.tdDefaultWidth();\r\n }\r\n }\r\n \r\n //WPTB_LeftPanel();\r\n WPTB_Settings();\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n } else {\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\r\n }\r\n \r\n return;\r\n }\r\n };\r\n http.send(null);\r\n } else {\r\n // @deprecated old generate logic\r\n // document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n document.counter = new ElementCounters();\r\n document.select = new MultipleSelect();\r\n\r\n var initializer = WPTB_Initializer();\r\n settings = WPTB_Settings();\r\n };\r\n\r\n let url = window.location.href,\r\n regex = new RegExp('[?&]page=wptb-builder'),\r\n results = regex.exec( url );\r\n if ( results ) {\r\n document.addEventListener('DOMContentLoaded', WPTB_Builder);\r\n }\r\n})();","var WPTB_Cell = function ( callback, DOMElement ) {\r\n\r\n function highlightRow(td) {\r\n var parentRow = td.parentNode,\r\n columnCount = parseInt(document.getElementById('wptb-columns-number').value),\r\n tds = document.getElementsByClassName('wptb-preview-table')[0].getElementsByTagName('td');\r\n for (var i = 0; i < tds.length; i++) {\r\n tds[i].classList.remove('wptb-highlighted-row-first', 'wptb-highlighted-row-last', 'wptb-highlighted-row-inner', 'wptb-highlighted-column-first', 'wptb-highlighted-column-last', 'wptb-highlighted-column-inner');\r\n }\r\n for (var i = 0; i < columnCount; i++) {\r\n\r\n var classToAdd = i == 0 ? 'wptb-highlighted-row-first' : i == columnCount - 1 ? 'wptb-highlighted-row-last' : 'wptb-highlighted-row-inner';\r\n var ttd = parentRow.getElementsByTagName('td')[i];\r\n if (ttd !== td) {\r\n ttd.classList.add(classToAdd);\r\n }\r\n }\r\n }\r\n\r\n function highlightColumn(td) {\r\n\r\n var index,\r\n parentRow = td.parentNode,\r\n columnCount = parseInt(document.getElementById('wptb-columns-number').value), rowCount = parseInt(document.getElementById('wptb-rows-number').value), table = document.getElementsByClassName('wptb-preview-table')[0];\r\n for (var i = 0; i < columnCount; i++) {\r\n if (parentRow.getElementsByTagName('td')[i] === td) {\r\n index = i;\r\n break;\r\n }\r\n }\r\n\r\n for (var i = 0; i < rowCount; i++) {\r\n var classToAdd = i == 0 ? 'wptb-highlighted-column-first' : i == rowCount - 1 ? 'wptb-highlighted-column-last' : 'wptb-highlighted-column-inner';\r\n var tr = table.getElementsByTagName('tr')[i];\r\n if (tr.getElementsByTagName('td')[index] !== td) {\r\n tr.getElementsByTagName('td')[index].classList.add(classToAdd);\r\n }\r\n }\r\n }\r\n\r\n if( ! DOMElement ) {\r\n DOMElement = document.createElement(\"td\");\r\n\r\n DOMElement.style.padding = jQuery('#wptb-table-padding-number').val() + 'px';\r\n\r\n var innerBorderWidth = jQuery('#wptb-table-inner-border-number').val();\r\n\r\n if (innerBorderWidth != '' && parseInt(innerBorderWidth) != 0) {\r\n DOMElement.style.border = innerBorderWidth + 'px solid ' + jQuery('#wptb-table-border-color').val();\r\n }\r\n\r\n DOMElement.classList.add('wptb-droppable', 'wptb-cell');\r\n }\r\n\r\n DOMElement.draggable = false;\r\n if ( callback ) {\r\n DOMElement.onclick = callback;\r\n }\r\n\r\n // Cell double click handler\r\n DOMElement.ondblclick = function( event ) {\r\n event.stopPropagation();\r\n let wptbTableSetup = document.querySelector('.wptb-table-setup')\r\n if(wptbTableSetup && !wptbTableSetup.classList.contains('wptb-preview-table-manage-cells') &&\r\n (event.target.dataset.yIndex !== '0' || wptbTableSetup.dataset.wptbSortableTable !== '1') &&\r\n event.target == event.currentTarget) {\r\n WPTB_Helper.wptbDocumentEventGenerate( 'table:cell:dblclick', event.target )\r\n\r\n let element = WPTB_Helper.newElementProxy( 'text' )\r\n element = element.getDOMElement()\r\n\r\n DOMElement.appendChild( element )\r\n\r\n WPTB_innerElementSet( element );\r\n }\r\n }\r\n\r\n WPTB_innerElementSet( DOMElement );\r\n\r\n WPTB_Helper.elementStartScript( DOMElement, 'table_cell_setting' );\r\n\r\n let wptbPhElement = DOMElement.getElementsByClassName( 'wptb-ph-element' );\r\n\r\n if ( wptbPhElement.length > 0 ) {\r\n for( let i = 0; i < wptbPhElement.length; i++ ) {\r\n wptbPhElement[i].getDOMElement = function() {\r\n return wptbPhElement[i];\r\n }\r\n\r\n WPTB_innerElementSet( wptbPhElement[i] );\r\n\r\n let wptbElementTypeClass = wptbPhElement[i].className.match( /wptb-element-((.+-)\\d+)/i );\r\n if( wptbElementTypeClass && Array.isArray( wptbElementTypeClass ) ) {\r\n let wptbTypeElementArr = wptbElementTypeClass[1].split( '-' );\r\n wptbPhElement[i].kind = wptbTypeElementArr[0];\r\n applyGenericItemSettings( wptbPhElement[i], wptbElementTypeClass[1] );\r\n let wptbInternalActiveElement = wptbPhElement[i].getElementsByClassName( 'wptb-in-element' );\r\n if ( wptbInternalActiveElement.length > 0 ) {\r\n for ( let j = 0; j < wptbInternalActiveElement.length; j++ ) {\r\n let wptbInternalActiveElementObj = {};\r\n wptbInternalActiveElementObj.getDOMElement = function() {\r\n return wptbInternalActiveElement[j];\r\n }\r\n\r\n applyGenericItemSettings( wptbInternalActiveElementObj );\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n this.getDOMElement = function () {\r\n return DOMElement;\r\n };\r\n\r\n this.setCoords = function (y, x) {\r\n var el = this.getDOMElement();\r\n el.dataset.yIndex = y;\r\n el.dataset.xIndex = x;\r\n };\r\n\r\n this.getCoords = function () {\r\n var coords,\r\n el = this.getDOMElement();\r\n coords.x = el.dataset.xIndex;\r\n coords.y = el.dataset.yIndex;\r\n return coords;\r\n };\r\n\r\n this.appendElement = function (node) {\r\n getDOMElement().appendChild(node);\r\n };\r\n\r\n DOMElement.getCellDimensions = function() {\r\n\r\n let tdStyleObj = window.getComputedStyle( this, null );\r\n\r\n let tdPaddingLeft = tdStyleObj.getPropertyValue( 'padding-left' );\r\n let tdPaddingRight = tdStyleObj.getPropertyValue( 'padding-right' );\r\n\r\n let tdBorderLeftWidth = tdStyleObj.getPropertyValue( 'border-left-width' );\r\n let tdBorderRightWidth = tdStyleObj.getPropertyValue( 'border-right-width' );\r\n\r\n let tdPaddingTop = tdStyleObj.getPropertyValue( 'padding-top' );\r\n let tdPaddingBottom = tdStyleObj.getPropertyValue( 'padding-bottom' );\r\n\r\n let tdBorderTopWidth = tdStyleObj.getPropertyValue( 'border-top-width' );\r\n let tdBorderBottomWidth = tdStyleObj.getPropertyValue( 'border-bottom-width' );\r\n\r\n let width = parseInt( this.offsetWidth, 10 ) -\r\n parseInt( tdPaddingLeft, 10 ) -\r\n parseInt( tdPaddingRight, 10 );\r\n\r\n let height = parseInt( this.offsetHeight, 10 ) -\r\n parseInt( tdPaddingTop, 10 ) -\r\n parseInt( tdPaddingBottom, 10 );\r\n let table = WPTB_Helper.findAncestor( this, 'wptb-preview-table' );\r\n if(table) {\r\n if(table.style.borderCollapse === 'collapse') {\r\n width = width - ( parseInt( tdBorderLeftWidth, 10 ) / 2 ) -\r\n ( parseInt( tdBorderRightWidth, 10 ) / 2 );\r\n height = height - ( parseInt( tdBorderTopWidth, 10 ) / 2 ) -\r\n ( parseInt( tdBorderBottomWidth, 10 ) / 2 );\r\n let tableFullStyleObj = window.getComputedStyle( table, null );\r\n let tableBorderLeft = tableFullStyleObj.getPropertyValue( 'border-left-width' );\r\n let tableBorderRight = tableFullStyleObj.getPropertyValue( 'border-right-width' );\r\n let tableBorderTop = tableFullStyleObj.getPropertyValue( 'border-top-width' );\r\n let tableBorderBottom = tableFullStyleObj.getPropertyValue( 'border-bottom-width' );\r\n\r\n let tr = this.parentNode;\r\n if( tr && tr.nodeName.toLowerCase() === 'tr' ) {\r\n if( tr.firstChild && tr.firstChild.dataset.xIndex === this.dataset.xIndex ) {\r\n if( parseInt( tableBorderLeft, 10 ) > parseInt( tdBorderLeftWidth, 10 ) ) {\r\n width += -( parseInt( tableBorderLeft, 10 ) - parseInt( tdBorderLeftWidth, 10 ) ) / 2;\r\n }\r\n }\r\n\r\n if( tr.lastChild && tr.lastChild.dataset.xIndex === this.dataset.xIndex ) {\r\n if( parseInt( tableBorderRight, 10 ) > parseInt( tdBorderRightWidth, 10 ) ) {\r\n width += -( parseInt( tableBorderRight, 10 ) - parseInt( tdBorderRightWidth, 10 ) ) / 2;\r\n }\r\n }\r\n\r\n let body = tr.parentNode;\r\n if( body && body.nodeName.toLowerCase() === 'body' ) {\r\n if( body.firstChild && body.firstChild.firstChild.dataset.yIndex === this.dataset.yIndex ) {\r\n if( parseInt( tableBorderTop, 10 ) > parseInt( tdBorderTopWidth, 10 ) ) {\r\n height += ( parseInt( tableBorderTop, 10 ) - parseInt( tdBorderTopWidth, 10 ) ) / 2;\r\n }\r\n }\r\n\r\n if( body.lastChild && body.lastChild.firstChild.dataset.yIndex === this.dataset.yIndex ) {\r\n if( parseInt( tableBorderBottom, 10 ) > parseInt( tdBorderBottomWidth, 10 ) ) {\r\n height += ( parseInt( tableBorderBottom, 10 ) - parseInt( tdBorderBottomWidth, 10 ) ) / 2;\r\n }\r\n }\r\n }\r\n }\r\n } else if(table.style.borderCollapse === 'separate') {\r\n width = width - parseInt( tdBorderLeftWidth, 10 ) -\r\n parseInt( tdBorderRightWidth, 10 );\r\n height = height - parseInt( tdBorderTopWidth, 10 ) -\r\n parseInt( tdBorderBottomWidth, 10 );\r\n }\r\n }\r\n\r\n return {\r\n width: parseInt( width ),\r\n height: parseInt( height )\r\n };\r\n }\r\n\r\n return this;\r\n};\r\n","let WPTB_CutGlueTable = {\n cutTableHorizontally: function (rowBefore, table) {\n if( table && table.rows[rowBefore] ) {\n for( let i = 0; i < rowBefore; i++ ) {\n let tableRowsIChildren = table.rows[i].children;\n\n for( let j = 0; j < tableRowsIChildren.length; j++ ) {\n if ( tableRowsIChildren[j].rowSpan > 1 && tableRowsIChildren[j].rowSpan > rowBefore - i ) {\n let newTdRowspan = tableRowsIChildren[j].rowSpan - rowBefore + i;\n tableRowsIChildren[j].rowSpan = rowBefore - i;\n if( ! tableRowsIChildren[j].dataset.sameCellBeforeDivision ) {\n tableRowsIChildren[j].dataset.sameCellBeforeDivision = 'r' + i + 'c' + j;\n }\n\n let td;\n if(table.hasOwnProperty('wptbCell')) {\n td = new table.wptbCell( table.mark );\n td = td.getDOMElement();\n } else {\n td = document.createElement('td');\n }\n\n let tdTopStyle = tableRowsIChildren[j].getAttribute( 'style' );\n td.setAttribute( 'style', tdTopStyle );\n td.colSpan = tableRowsIChildren[j].colSpan;\n td.rowSpan = newTdRowspan;\n td.dataset.sameCellBeforeDivision = tableRowsIChildren[j].dataset.sameCellBeforeDivision;\n\n let dataXIndex = tableRowsIChildren[j].dataset.xIndex;\n let dataXIndexNext = parseInt( dataXIndex ) + parseInt( tableRowsIChildren[j].colSpan );\n let beforeTd;\n while( ! beforeTd && dataXIndexNext < table.maxCols ) {\n beforeTd = table.rows[rowBefore].querySelector( '[data-x-index=\"' + dataXIndexNext + '\"]' );\n dataXIndexNext++;\n }\n table.rows[rowBefore].insertBefore( td, beforeTd );\n\n WPTB_RecalculateIndexes(table);\n }\n }\n }\n }\n },\n glueTableHorizontally: function (table) {\n if(table) {\n let tds = [...table.getElementsByTagName( 'td' )];\n for( let i = 0; i < tds.length; i++ ) {\n if( tds[i].hasAttribute( 'data-same-cell-before-division' ) ) {\n let dataSameCellBeforeDivision = tds[i].dataset.sameCellBeforeDivision;\n let tdsSameBeforeDivision = table.querySelectorAll( '[data-same-cell-before-division=\"' + dataSameCellBeforeDivision + '\"]' );\n for( let j = 0; j < tdsSameBeforeDivision.length; j++ ) {\n if( tdsSameBeforeDivision[j] && tdsSameBeforeDivision[j + 1] ) {\n if( tdsSameBeforeDivision[j].parentNode && tdsSameBeforeDivision[j + 1].parentNode &&\n ! tdsSameBeforeDivision[j].parentNode.classList.contains( 'wptb-row-moving' ) &&\n ! tdsSameBeforeDivision[j + 1].parentNode.classList.contains( 'wptb-row-moving' ) ) {\n if( ( tdsSameBeforeDivision[j + 1].dataset.yIndex == parseInt( tdsSameBeforeDivision[j].dataset.yIndex ) +\n parseInt( tdsSameBeforeDivision[j].rowSpan ) ) ) {\n tdsSameBeforeDivision[j].rowSpan += tdsSameBeforeDivision[j + 1].rowSpan;\n\n let tdsSameBeforeDivisionJPlusChildren = [...tdsSameBeforeDivision[j + 1].children];\n\n for( let k = 0; k < tdsSameBeforeDivisionJPlusChildren.length; k++ ) {\n tdsSameBeforeDivision[j].appendChild( tdsSameBeforeDivisionJPlusChildren[k] );\n }\n\n let nextRow = tdsSameBeforeDivision[j + 1].parentNode;\n nextRow.removeChild( tdsSameBeforeDivision[j + 1] );\n }\n }\n }\n }\n }\n }\n\n WPTB_RecalculateIndexes(table);\n }\n },\n cutTableVertically: function (col, table) {\n for ( let i = 0; i < table.rows.length; i++ ) {\n if( col < table.maxCols ) {\n if( col != 0 && ( ! table.rows[i].querySelector( '[data-x-index=\"' + col + '\"]' ) ) ) {\n let rowChildren = table.rows[i].children;\n\n let td,\n rowChildrenLength = rowChildren.length,\n afterTd,\n rowSpanNewTd,\n colSpanOld,\n colSpanNewTd;\n for( let j = 0; j < rowChildrenLength; j++ ) {\n if( rowChildren[j].colSpan > 1 && parseInt( rowChildren[j].dataset.xIndex ) < col &&\n parseInt( rowChildren[j].dataset.xIndex ) + parseInt( rowChildren[j].colSpan ) > col ) {\n if(table.hasOwnProperty('wptbCell')) {\n td = new table.wptbCell( table.mark );\n td = td.getDOMElement();\n } else {\n td = document.createElement('td');\n }\n\n rowSpanNewTd = rowChildren[j].rowSpan;\n colSpanOld = rowChildren[j].colSpan;\n rowChildren[j].colSpan = col - rowChildren[j].dataset.xIndex;\n colSpanNewTd = colSpanOld - rowChildren[j].colSpan;\n\n if( ! rowChildren[j].dataset.sameCellBeforeDivision ) {\n rowChildren[j].dataset.sameCellBeforeDivision = 'r' + i + 'c' + j;\n }\n\n let tdLeftStyle = rowChildren[j].getAttribute( 'style' );\n td.setAttribute( 'style', tdLeftStyle );\n\n let tdAnalogThisX = table.querySelector( '[data-x-index=\"' + col + '\"]' );\n if( tdAnalogThisX ) {\n td.style.width = tdAnalogThisX.style.width;\n }\n\n let tdAnalogThisY = table.querySelector( '[data-y-index=\"' + i + '\"]' );\n if( tdAnalogThisY ) {\n td.style.height = tdAnalogThisY.style.height;\n }\n if( rowChildren[j + 1] ) {\n afterTd = rowChildren[j + 1];\n } else {\n afterTd = null;\n }\n\n table.rows[i].insertBefore( td, afterTd );\n td.colSpan = colSpanNewTd;\n td.rowSpan = rowSpanNewTd;\n td.dataset.sameCellBeforeDivision = rowChildren[j].dataset.sameCellBeforeDivision;\n i += rowSpanNewTd - 1;\n break\n }\n }\n }\n }\n WPTB_RecalculateIndexes(table);\n }\n },\n glueTableVertically: function (table) {\n if( table ) {\n let tds = [...table.getElementsByTagName( 'td' )];\n for( let i = 0; i < tds.length; i++ ) {\n if( tds[i].hasAttribute( 'data-same-cell-before-division' ) ) {\n let dataSameCellBeforeDivision = tds[i].dataset.sameCellBeforeDivision;\n let tdsSameBeforeDivision = [...table.querySelectorAll( '[data-same-cell-before-division=\"' + dataSameCellBeforeDivision + '\"]' )];\n\n let jFirstTdGlue = null;\n for( let j = 0; j < tdsSameBeforeDivision.length; j++ ) {\n if( tdsSameBeforeDivision[j] && tdsSameBeforeDivision[j + 1] &&\n ! tdsSameBeforeDivision[j].classList.contains( 'wptb-column-moving' ) &&\n ! tdsSameBeforeDivision[j + 1].classList.contains( 'wptb-column-moving' ) ) {\n if( ( tdsSameBeforeDivision[j + 1].dataset.xIndex == parseInt( tdsSameBeforeDivision[j].dataset.xIndex ) +\n parseInt( tdsSameBeforeDivision[j].colSpan ) ) ) {\n if( jFirstTdGlue == null ) {\n jFirstTdGlue = j;\n }\n tdsSameBeforeDivision[jFirstTdGlue].colSpan += tdsSameBeforeDivision[j + 1].colSpan;\n\n let tdsSameBeforeDivisionJPlusChildren = [...tdsSameBeforeDivision[j + 1].children];\n\n for( let k = 0; k < tdsSameBeforeDivisionJPlusChildren.length; k++ ) {\n tdsSameBeforeDivision[jFirstTdGlue].appendChild( tdsSameBeforeDivisionJPlusChildren[k] );\n }\n\n let thisRow = tdsSameBeforeDivision[j + 1].parentNode;\n thisRow.removeChild( tdsSameBeforeDivision[j + 1] );\n }\n }\n }\n }\n }\n\n WPTB_RecalculateIndexes(table);\n }\n }\n}\n","var WPTB_DropHandle = function (thisElem, e, hide = false) {\r\n\r\n let wptbDropHandle,\r\n wptbDropBorderMarker,\r\n wptbDropBorderMarkerTop,\r\n wptbDropBorderMarkerRight,\r\n wptbDropBorderMarkerBottom,\r\n wptbDropBorderMarkerLeft;\r\n\r\n /**\r\n * Add px suffix to a value\r\n *\r\n * @param {any} val value\r\n * @returns {string} string value suffixed with px\r\n */\r\n function toPx(val){\r\n return `${val}px`;\r\n }\r\n\r\n if(WPTB_Helper.getDragRelativeType() === 'td_relative'){\r\n let cellRelatedDropHandle = document.querySelector('.wptb-cell-related-drop-handle');\r\n if(hide && cellRelatedDropHandle ){\r\n cellRelatedDropHandle.style.display = 'none';\r\n return;\r\n }\r\n if(cellRelatedDropHandle === null){\r\n const range = document.createRange();\r\n range.setStart(document.body , 0);\r\n\r\n const shadowRoot = range.createContextualFragment('<div class=\"wptb-cell-related-drop-handle\">Add to cell</div>').children[0];\r\n\r\n document.body.appendChild(shadowRoot);\r\n cellRelatedDropHandle = shadowRoot.children[0];\r\n }\r\n\r\n const parentTd = WPTB_Helper.getParentOfType('td', thisElem);\r\n const {top,left,width,height} = parentTd.getBoundingClientRect();\r\n\r\n if(!cellRelatedDropHandle){\r\n return;\r\n }\r\n\r\n cellRelatedDropHandle.style.display = 'flex';\r\n cellRelatedDropHandle.style.top = toPx(top);\r\n cellRelatedDropHandle.style.width = toPx(width);\r\n cellRelatedDropHandle.style.height = toPx(height);\r\n cellRelatedDropHandle.style.left = toPx(left);\r\n\r\n return;\r\n }\r\n\r\n if ( document.getElementsByClassName( 'wptb-drop-handle' ).length == 0 ) {\r\n wptbDropHandle = document.createElement( 'div' );\r\n wptbDropHandle.classList.add( 'wptb-drop-handle' );\r\n \r\n wptbDropBorderMarker = document.createElement( 'div' );\r\n wptbDropBorderMarker.classList.add( 'wptb-drop-border-marker' );\r\n \r\n wptbDropBorderMarkerTop = document.createElement( 'div' ),\r\n wptbDropBorderMarkerRight = document.createElement( 'div' ),\r\n wptbDropBorderMarkerBottom = document.createElement( 'div' ),\r\n wptbDropBorderMarkerLeft = document.createElement( 'div' );\r\n \r\n wptbDropBorderMarkerTop.classList.add( 'wptb-drop-border-marker-top' );\r\n wptbDropBorderMarkerRight.classList.add( 'wptb-drop-border-marker-right' );\r\n wptbDropBorderMarkerBottom.classList.add( 'wptb-drop-border-marker-bottom' );\r\n wptbDropBorderMarkerLeft.classList.add( 'wptb-drop-border-marker-left' );\r\n \r\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerTop );\r\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerRight );\r\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerBottom );\r\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerLeft );\r\n \r\n let body = document.getElementsByTagName( 'body' );\r\n if ( body.length > 0 ) {\r\n body[0].appendChild( wptbDropHandle );\r\n body[0].appendChild( wptbDropBorderMarker );\r\n }\r\n \r\n wptbDropHandle.ondragenter = function () {\r\n if (e.target.classList.contains('wptb-empty')) {\r\n e.preventDefault();\r\n return false;\r\n }\r\n }\r\n\r\n wptbDropHandle.ondragover = function (e) {\r\n e.preventDefault(); \r\n }\r\n\r\n wptbDropHandle.ondragleave = function () {\r\n\r\n }\r\n wptbDropHandle.ondrop = function (e) {\r\n e.preventDefault();\r\n let element;\r\n \r\n if ( e.dataTransfer.getData('wptbElement') ) {\r\n element = WPTB_Helper.newElementProxy( e.dataTransfer.getData('wptbElement') );\r\n element = element.getDOMElement();\r\n } else {\r\n element = document.getElementsByClassName( e.dataTransfer.getData('node') )[0];\r\n element.classList.remove( 'wptb-moving-mode' );\r\n element.classList.remove( 'wptb-moving-into-same-elem' );\r\n element.wptbMovingMode = 1;\r\n }\r\n \r\n let td;\r\n if( wptbDropHandle.dataset.text == 'Drop Here' ) {\r\n thisElem = wptbDropHandle.getDOMParentElement();\r\n if ( thisElem.nodeName.toLowerCase() == 'td' ) {\r\n td = wptbDropHandle.getDOMParentElement();\r\n td.appendChild( element );\r\n WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);\r\n }\r\n } else {\r\n let innerElement = wptbDropHandle.getDOMParentElement();\r\n td = innerElement.parentNode;\r\n \r\n if( wptbDropHandle.dataset.text == 'Above Element' ) {\r\n td.insertBefore( element, innerElement );\r\n WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);\r\n } else if( wptbDropHandle.dataset.text == 'Below Element' ) {\r\n let innerElementNext = innerElement.nextSibling;\r\n td.insertBefore( element, innerElementNext );\r\n WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);\r\n }\r\n }\r\n \r\n let thisRow = td.parentNode;\r\n if( WPTB_Helper.rowIsTop( thisRow ) ) {\r\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\r\n\r\n if( table.classList.contains( 'wptb-table-preview-head' ) ) {\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n }\r\n \r\n wptbDropHandle.style.display = 'none';\r\n wptbDropBorderMarker.style.display = 'none';\r\n \r\n WPTB_innerElementSet( element );\r\n if( ! element.classList.contains( 'wptb-image-container' ) || element.wptbMovingMode == 1 ) {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n element.wptbMovingMode == undefined;\r\n }\r\n }\r\n let wptbContainer = document.querySelector( '.wptb-container' );\r\n wptbContainer.onscroll = function() {\r\n wptbDropHandle.style.display = 'none';\r\n wptbDropBorderMarker.style.display = 'none';\r\n }\r\n } else {\r\n wptbDropHandle = document.getElementsByClassName( 'wptb-drop-handle' )[0];\r\n wptbDropBorderMarker = document.getElementsByClassName( 'wptb-drop-border-marker' )[0];\r\n }\r\n if( thisElem && thisElem.nodeName.toLowerCase() == 'td' && \r\n thisElem.getElementsByClassName( 'wptb-ph-element' ).length != 0) {\r\n return;\r\n }\r\n\r\n if( thisElem && thisElem.nodeName.toLowerCase() == 'td' && \r\n thisElem.classList.contains('wptb-empty')) {\r\n return;\r\n }\r\n \r\n let thisRow;\r\n if ( thisElem.localName == 'td' ) {\r\n thisRow = thisElem.parentNode;\r\n } else if ( thisElem.localName == 'div' && thisElem.classList.contains( 'wptb-ph-element' ) ) {\r\n thisRow = thisElem.parentNode.parentNode;\r\n }\r\n \r\n if( WPTB_Helper.rowIsTop( thisRow ) ) {\r\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\r\n \r\n if( table.classList.contains( 'wptb-table-preview-head' ) ) {\r\n let indics = e.dataTransfer.types;\r\n let notDragEnter = false;\r\n for ( let i = 0; i < indics.length; i++ ) {\r\n let infArr = indics[i].match( /wptbelindic-([a-z]+)/i );\r\n if ( infArr && infArr[1] != 'text' ) {\r\n notDragEnter = true;\r\n break;\r\n }\r\n }\r\n if( notDragEnter ) {\r\n return;\r\n }\r\n }\r\n }\r\n \r\n wptbDropHandle.style.width = thisElem.offsetWidth + 'px';\r\n let height = thisElem.offsetHeight,\r\n coordinatesElement = thisElem.getBoundingClientRect(),\r\n left = parseFloat( coordinatesElement.left ),\r\n top;\r\n wptbDropHandle.style.left = left + 'px';\r\n \r\n if( e.dataTransfer.types.indexOf( 'wptb-moving-mode' ) != -1 ) {\r\n let elementDrag = document.getElementsByClassName( 'wptb-moving-mode' )[0];\r\n if( thisElem == elementDrag ) {\r\n wptbDropHandle.classList.add('wptb-moving-into-same-elem');\r\n wptbDropBorderMarker.classList.add('wptb-moving-into-same-elem');\r\n } else {\r\n wptbDropHandle.classList.remove('wptb-moving-into-same-elem');\r\n wptbDropBorderMarker.classList.remove('wptb-moving-into-same-elem');\r\n }\r\n }\r\n \r\n wptbDropHandle.getDOMParentElement = function() {\r\n return thisElem;\r\n }\r\n \r\n wptbDropHandle.style.display = 'block';\r\n wptbDropBorderMarker.style.display = 'block';\r\n if( thisElem.nodeName.toLowerCase() != 'td' ) {\r\n let y = e.offsetY==undefined?e.layerY:e.offsetY;\r\n top = parseFloat( coordinatesElement.top ) - parseFloat( 11 );\r\n wptbDropHandle.dataset.text = 'Above Element';\r\n if ( y > height/2 ) {\r\n top = parseFloat( coordinatesElement.top ) + height - 1;\r\n wptbDropHandle.dataset.text = 'Below Element';\r\n }\r\n } else {\r\n wptbDropHandle.dataset.text = 'Drop Here';\r\n top = parseFloat( coordinatesElement.top ) + height/2 - 5;\r\n }\r\n wptbDropHandle.style.top = top + 'px';\r\n\r\n wptbDropBorderMarker.style.top = coordinatesElement.top + 'px';\r\n wptbDropBorderMarker.style.left = coordinatesElement.left + 'px';\r\n\r\n wptbDropBorderMarkerTop = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-top' );\r\n wptbDropBorderMarkerTop.style.width = ( parseFloat( thisElem.offsetWidth ) - parseFloat( 1 ) ) + 'px';\r\n\r\n wptbDropBorderMarkerRight = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-right' );\r\n wptbDropBorderMarkerRight.style.height = ( parseFloat( coordinatesElement.bottom ) - parseFloat( coordinatesElement.top ) - 1 ) + 'px';\r\n wptbDropBorderMarkerRight.style.left = wptbDropBorderMarkerTop.style.width;\r\n\r\n wptbDropBorderMarkerBottom = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-bottom' );\r\n wptbDropBorderMarkerBottom.style.width = wptbDropBorderMarkerTop.style.width;\r\n wptbDropBorderMarkerBottom.style.top = wptbDropBorderMarkerRight.style.height;\r\n\r\n wptbDropBorderMarkerLeft = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-left' );\r\n wptbDropBorderMarkerLeft.style.height = wptbDropBorderMarkerRight.style.height;\r\n}","var ElementCounters = function () {\r\n\r\n\tvar priv = [];\r\n\tpriv['text'] = 0;\r\n\tpriv['image'] = 0;\r\n\tpriv['list'] = 0;\r\n\tpriv['button'] = 0;\r\n\r\n\tthis.increment = function (key) {\r\n\t\tif (!(key in priv)) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tpriv[key]++;\r\n\t}\r\n\r\n\tthis.nextIndex = function (key) {\r\n\t\tif (!(key in priv)) {\r\n\t\t\treturn undefined;\r\n\t\t}\r\n\t\treturn priv[key] + 1;\r\n\t}\r\n\r\n\treturn this;\r\n\r\n};","var WPTB_ElementObject = function ( data ) {\r\n let DOMElement, kindIndexProt, copy;\r\n if( ! data.elemProt ) {\r\n DOMElement = document.createElement('div'),\r\n kindIndexProt = undefined,\r\n copy = false;\r\n DOMElement.classList.add( 'wptb-' + data.kind + '-container', 'wptb-ph-element' );\r\n \r\n let wpTemplateId = 'wptb-' + data.kind + '-content';\r\n let template = wp.template( wpTemplateId );\r\n data.node = DOMElement;\r\n let itemHtml = template( data );\r\n\r\n itemHtml = itemHtml.replace(/\\r|\\n|\\t/g, '').trim();\r\n DOMElement.innerHTML = itemHtml;\r\n } else {\r\n DOMElement = data.elemProt.cloneNode( true );\r\n DOMElement.classList.remove( 'wptb-directlyhovered' );\r\n let wptbElementMutch = data.elemProt.className.match( /wptb-element-((.+-)\\d+)/i );\r\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\r\n kindIndexProt = wptbElementMutch[1];\r\n };\r\n copy = true;\r\n \r\n if( data.tinyMceClear ) {\r\n DOMElement = WPTB_Helper.elementClearFromTinyMce( DOMElement );\r\n }\r\n }\r\n \r\n let inElems = DOMElement.querySelectorAll( '.wptb-in-element' );\r\n if( inElems.length > 0 ) {\r\n for ( let i = 0; i < inElems.length; i++ ) {\r\n let inElemObj = {};\r\n inElemObj.getDOMElement = function() {\r\n return inElems[i];\r\n }\r\n \r\n applyGenericItemSettings( inElemObj );\r\n }\r\n }\r\n \r\n window.addEventListener( 'item:onmouseenter', function( event ) {\r\n //console.log( event );\r\n }, false);\r\n \r\n \r\n this.kind = data.kind;\r\n this.getDOMElement = function () {\r\n return DOMElement;\r\n };\r\n \r\n applyGenericItemSettings( this, kindIndexProt, copy );\r\n return this;\r\n}\r\n\r\n\r\n","var WPTB_ElementOptions = function ( element, index, kindIndexProt ) {\r\n\r\n var node = element.getDOMElement();\r\n node.addEventListener( 'click', function() {\r\n WPTB_Helper.elementOptionsSet( element.kind, this );\r\n }, {capture: true} );\r\n};","/**\r\n * WPTB_HeaderToolbox\r\n *\r\n * @param {string} wrapperQuery wrapper query for toolbox items\r\n * @return {object} header toolbox object\r\n * @constructor\r\n */\r\n// eslint-disable-next-line camelcase,no-unused-vars\r\nconst WPTB_HeaderToolbox = function (wrapperQuery) {\r\n\tthis.wrapperQuery = wrapperQuery;\r\n\tthis.element = document.querySelector(wrapperQuery);\r\n\tthis.topMargin = 2;\r\n\r\n\t/**\r\n\t * Assign events to toolbox buttons\r\n\t */\r\n\tconst assignButtons = () => {\r\n\t\tconst manageCellsButton = this.element.querySelector('[data-button-type=\"table_settings_menu\"]');\r\n\r\n\t\tif (manageCellsButton) {\r\n\t\t\tmanageCellsButton.addEventListener('click', () => {\r\n\t\t\t\tWPTB_Helper.activateSection('manage_cells');\r\n\t\t\t});\r\n\t\t}\r\n\t};\r\n\r\n\t/**\r\n\t * Toggle visibility of toolbox with the given argument.\r\n\t *\r\n\t * @param {boolean} show show toolbox\r\n\t */\r\n\tconst toggleToolboxVisibility = (show = false) => {\r\n\t\tlet { height } = this.element.getBoundingClientRect();\r\n\r\n\t\tif (show) {\r\n\t\t\theight = 0;\r\n\t\t}\r\n\r\n\t\tthis.element.style.top = `calc( 100% - ${height + this.topMargin}px)`;\r\n\t};\r\n\r\n\t/**\r\n\t * Initialize header toolbox.\r\n\t */\r\n\tconst init = () => {\r\n\t\tassignButtons();\r\n\t\t// bind toolbox to table generated event\r\n\t\tdocument.addEventListener('wptb:table:generated', () => {\r\n\t\t\tthis.element.style.display = 'unset';\r\n\t\t\tconst { width } = this.element.getBoundingClientRect();\r\n\t\t\tthis.element.style.left = `calc( 50% - ${width / 2}px)`;\r\n\r\n\t\t\t// hide toolbox at manage cells and responsive menus\r\n\t\t\tdocument.addEventListener('wptbSectionChanged', ({ detail }) => {\r\n\t\t\t\ttoggleToolboxVisibility(\r\n\t\t\t\t\tdetail !== 'manage_cells' && detail !== 'table_responsive_menu' && detail !== 'cell_settings'\r\n\t\t\t\t);\r\n\t\t\t});\r\n\t\t});\r\n\t};\r\n\r\n\treturn { init };\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 if( rgb ) {\r\n if( WPTB_Helper.isHex( rgb ) ) return rgb;\r\n\r\n let rgbm = rgb.match(/^rgba?[\\s+]?\\([\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?((?:[0-9]*[.])?[0-9]+)[\\s+]?\\)/i);\r\n if ( rgbm && rgbm.length === 5) {\r\n return \"#\" +\r\n ('0' + Math.round(parseFloat(rgbm[4], 10) * 255).toString(16).toUpperCase()).slice(-2) +\r\n (\"0\" + parseInt(rgbm[1], 10).toString(16).toUpperCase()).slice(-2) +\r\n (\"0\" + parseInt(rgbm[2], 10).toString(16).toUpperCase()).slice(-2) +\r\n (\"0\" + parseInt(rgbm[3], 10).toString(16).toUpperCase()).slice(-2);\r\n } else {\r\n rgbm = rgb.match(/^rgba?[\\s+]?\\([\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?/i);\r\n if (rgbm && rgbm.length === 4) {\r\n return \"#\" +\r\n (\"0\" + parseInt(rgbm[1], 10).toString(16).toUpperCase()).slice(-2) +\r\n (\"0\" + parseInt(rgbm[2], 10).toString(16).toUpperCase()).slice(-2) +\r\n (\"0\" + parseInt(rgbm[3], 10).toString(16).toUpperCase()).slice(-2);\r\n } else {\r\n return '';\r\n }\r\n }\r\n } else {\r\n return '';\r\n }\r\n\r\n },\r\n isHex: function( hex ) {\r\n let regex = new RegExp('^#(?:[A-Fa-f0-9]{3}){1,2}$');\r\n return regex.test( hex );\r\n },\r\n getElementIcon: function ( icon_directory ) {\r\n let hostName = location.protocol + '//' + location.hostname;\r\n let img = document.createElement( 'img' );\r\n img.src = icon_directory;\r\n return img;\r\n },\r\n elementDragEndClear: function() {\r\n let wptbMovingMode = document.getElementsByClassName( 'wptb-moving-mode' );\r\n if ( wptbMovingMode.length > 0 ) {\r\n for( let i = 0; i < wptbMovingMode.length; i++ ) {\r\n wptbMovingMode[i].classList.remove( 'wptb-moving-mode' );\r\n }\r\n }\r\n\r\n let wptbDropHandles = document.getElementsByClassName( 'wptb-drop-handle' );\r\n if ( wptbDropHandles.length > 0 ) {\r\n for( let i = 0; i < wptbDropHandles.length; i++ ) {\r\n wptbDropHandles[i].style.display = 'none';\r\n }\r\n }\r\n\r\n let wptbDropBorderMarkers = document.getElementsByClassName( 'wptb-drop-border-marker' );\r\n if ( wptbDropBorderMarkers.length > 0 ) {\r\n for( let i = 0; i < wptbDropBorderMarkers.length; i++ ) {\r\n wptbDropBorderMarkers[i].style.display = 'none';\r\n }\r\n }\r\n },\r\n linkHttpCheckChange: function( link, convertToAbs = false ) {\r\n if ( link ) {\r\n // even though it is not a best practice and a huge security risk, sometimes our users use javascript tag at href attributes, this check will make sure those tags will not be modified and returned as they are\r\n if(link.match(/^(javascript:)(.+)$/)){\r\n return link;\r\n }\r\n // relative link checking\r\n // if link starts with '/', assume it is a relative link to the origin of the current site\r\n else if( link.match(/^\\/([\\S]+)$/) ){\r\n if (convertToAbs) {\r\n const currentLocation = document.location;\r\n let {origin} = currentLocation;\r\n\r\n\r\n // strip out the '/' at the end of the origin name if there is any\r\n if (origin.match(/^(.+)\\/$/)) {\r\n origin = origin.slice(-1);\r\n }\r\n\r\n return `${origin}${link}`;\r\n }else{\r\n return link;\r\n }\r\n }\r\n else if ( link.indexOf( 'http://' ) == -1 && link.indexOf( 'https://' ) == -1 ) {\r\n let linkArr = link.split( '/' ),\r\n linkClean;\r\n if ( Array.isArray( linkArr ) && linkArr.length > 0 ) {\r\n linkClean = linkArr[linkArr.length - 1];\r\n }\r\n return document.location.protocol + '//' + linkClean;\r\n } else {\r\n return link;\r\n }\r\n } else {\r\n return '';\r\n }\r\n },\r\n dataTitleColumnSet: function( table ) {\r\n // TODO dataTitleColumnSet\r\n // let rows = table.rows,\r\n // rowHead = rows[0];\r\n // let computedStyleRowHead = getComputedStyle( rowHead );\r\n //\r\n // let rowHeadChildren = rowHead.children;\r\n // let contentsForHeader = {};\r\n // for( let i = 0; i < rowHeadChildren.length; i++ ) {\r\n // let tdElements = rowHeadChildren[i].children;\r\n //\r\n // for( let j = 0; j < tdElements.length; j++ ) {\r\n // let element = tdElements[j];\r\n // if( element.classList.contains( 'wptb-ph-element' ) ) {\r\n // let infArr = element.className.match( /wptb-element-(.+)-(\\d+)/i );\r\n // if( infArr[1] == 'text' ) {\r\n // let p = element.querySelector( 'p' ),\r\n // textContent = p.textContent,\r\n // textAlign = p.style.textAlign;\r\n // contentsForHeader[rowHeadChildren[i].dataset.xIndex] = [textContent, element.style.fontSize,\r\n // element.style.color, computedStyleRowHead.backgroundColor, textAlign];\r\n // break;\r\n // }\r\n // }\r\n // }\r\n // if( ! contentsForHeader[rowHeadChildren[i].dataset.xIndex] ) {\r\n // contentsForHeader[rowHeadChildren[i].dataset.xIndex] = ['', '',\r\n // '', computedStyleRowHead.backgroundColor, ''];\r\n // }\r\n // }\r\n // for ( let i = 1; i < rows.length; i++ ) {\r\n // let thisRow = rows[i],\r\n // thisRowChildren = thisRow.children;\r\n // for( let j = 0; j < thisRowChildren.length; j++ ) {\r\n // if ( contentsForHeader[thisRowChildren[j].dataset.xIndex] ) {\r\n // thisRowChildren[j].dataset.wptbTitleColumn = contentsForHeader[thisRowChildren[j].dataset.xIndex][0];\r\n // thisRowChildren[j].dataset.wptbTitleColumnFontSize = contentsForHeader[thisRowChildren[j].dataset.xIndex][1];\r\n // thisRowChildren[j].dataset.wptbTitleColumnColor = contentsForHeader[thisRowChildren[j].dataset.xIndex][2];\r\n // thisRowChildren[j].dataset.wptbTitleBackgroundColor = contentsForHeader[thisRowChildren[j].dataset.xIndex][3];\r\n // thisRowChildren[j].dataset.wptbTitleAlign = contentsForHeader[thisRowChildren[j].dataset.xIndex][4];\r\n // } else {\r\n // thisRowChildren[j].dataset.wptbTitleColumn = null;\r\n // thisRowChildren[j].dataset.wptbTitleColumnFontSize = null;\r\n // thisRowChildren[j].dataset.wptbTitleColumnColor = null;\r\n // thisRowChildren[j].dataset.wptbTitleBackgroundColor = null;\r\n // thisRowChildren[j].dataset.wptbTitleAlign = null;\r\n // }\r\n // }\r\n // }\r\n },\r\n findAncestor: function( el, cls ) {\r\n while ( ( el = el.parentElement ) && !el.classList.contains( cls ) );\r\n return el;\r\n },\r\n rowIsTop: function( row ) {\r\n var parent = row.parentNode;\r\n if( parent.children[0] == row ) {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n },\r\n getSelectionText: function() {\r\n var txt = '';\r\n if (txt = window.getSelection) {\r\n txt = window.getSelection().toString();\r\n } else {\r\n txt = document.selection.createRange().text;\r\n }\r\n return txt;\r\n },\r\n elementOptionsPanelClear: function() {\r\n let elementOptionsGroup = document.getElementById( 'element-options-group' );\r\n if( elementOptionsGroup ) {\r\n elementOptionsGroup.innerHTML = '';\r\n }\r\n },\r\n wpColorPickerCheckChangeForTableStateSaving: function( event ) {\r\n if( event.originalEvent.type == 'external' ) {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n } else {\r\n let wpPickerContainer = WPTB_Helper.findAncestor( event.target, 'wp-picker-container' );\r\n if( wpPickerContainer ) {\r\n if( event.originalEvent.type == 'square' || event.originalEvent.type == 'strip' ) {\r\n let body = document.getElementsByTagName( 'body' )[0];\r\n body.removeEventListener( 'mouseup', WPTB_Helper.irisStripMouseUpStateSaveManager, false );\r\n body.addEventListener( 'mouseup', WPTB_Helper.irisStripMouseUpStateSaveManager, false );\r\n }\r\n }\r\n }\r\n },\r\n irisStripMouseUpStateSaveManager: function() {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n\r\n let body = document.getElementsByTagName( 'body' )[0];\r\n body.removeEventListener( 'mouseup', WPTB_Helper.irisStripMouseUpStateSaveManager, false );\r\n },\r\n wpColorPickerClear: function( attribute, isId ) {\r\n let input;\r\n if( isId ) {\r\n input = [document.getElementById( attribute )];\r\n input.length = 1;\r\n } else {\r\n input = document.getElementsByClassName( attribute );\r\n }\r\n for( let i = 0; i < input.length; i++ ) {\r\n let wpPickerContainer = WPTB_Helper.findAncestor( input[i], 'wp-picker-container' );\r\n if( wpPickerContainer ) {\r\n let parent = wpPickerContainer.parentNode;\r\n parent.removeChild( wpPickerContainer );\r\n let newInput = document.createElement( 'input' );\r\n if( isId ) {\r\n newInput.setAttribute( 'id', attribute );\r\n } else {\r\n newInput.classList.add( 'wptb-element-property', attribute );\r\n }\r\n newInput.value = \"\";\r\n parent.appendChild( newInput );\r\n }\r\n }\r\n },\r\n detectMode: function() {\r\n var url = window.location.href,\r\n regex = new RegExp('[?&]table(=([^&#]*)|&|#|$)'),\r\n results = regex.exec(url);\r\n if ( ! results ) return false;\r\n if ( ! results[2] ) return '';\r\n return decodeURIComponent( results[2].replace(/\\+/g, ' ') );\r\n },\r\n getTableId() {\r\n let tableId = WPTB_Helper.detectMode();\r\n if (!tableId) {\r\n tableId = 'startedid-0';\r\n }\r\n\r\n return tableId;\r\n },\r\n getColumnWidth: function( table, cell ) {\r\n let xIndex = cell.dataset.xIndex;\r\n let xIndexes = table.querySelectorAll( '[data-x-index=\"' + xIndex + '\"]' );\r\n let cellWidth = cell.getCellDimensions().width;\r\n for( let i = 0; i < xIndexes.length; i++ ) {\r\n if( cellWidth > xIndexes[i].getCellDimensions().width ) {\r\n cellWidth = xIndexes[i].getCellDimensions().width;\r\n }\r\n }\r\n return cellWidth;\r\n },\r\n getRowHeight: function( table, cell ) {\r\n let yIndex = cell.dataset.yIndex;\r\n let yIndexes = table.querySelectorAll( '[data-y-index=\"' + yIndex + '\"]' );\r\n let cellHeight = cell.getCellDimensions().height;\r\n for( let i = 0; i < yIndexes.length; i++ ) {\r\n if( cellHeight > yIndexes[i].getCellDimensions().height ) {\r\n cellHeight = yIndexes[i].getCellDimensions().height;\r\n }\r\n }\r\n return cellHeight;\r\n },\r\n newElementProxy: function( el ) {\r\n if( el ) {\r\n let data = {kind: el};\r\n return new WPTB_ElementObject( data );\r\n }\r\n },\r\n wpColorPickerChange: function( event, ui ) {\r\n let uiColor;\r\n if( ui ) {\r\n uiColor = ui.color.toString();\r\n } else {\r\n uiColor = '';\r\n }\r\n\r\n let parent = WPTB_Helper.findAncestor( event.target, 'wp-picker-input-wrap' ).getElementsByClassName( 'wptb-color-picker' )[0], classe, type, ps, number;\r\n classe = parent.dataset.element.match(/wptb-options-(.+)-(\\d+)/i);\r\n type = classe[1];\r\n number = classe[2];\r\n let affectedEl = document.getElementsByClassName( 'wptb-element-' + type + '-' + number )[0];\r\n if ( type == 'button' ) {\r\n if ( parent.dataset.type == 'button-text-color' ) {\r\n affectedEl.getElementsByClassName( 'wptb-button' )[0].style.color = uiColor;\r\n } else {\r\n affectedEl.getElementsByClassName( 'wptb-button' )[0].style.backgroundColor = uiColor;\r\n }\r\n } else if( type == 'list' ) {\r\n let ps = affectedEl.querySelectorAll( 'p' );\r\n if( ps.length > 0 ) {\r\n for ( let i = 0; i < ps.length; i++ ) {\r\n ps[i].style.color = uiColor;\r\n }\r\n }\r\n } else if( type == 'star_rating' ) {\r\n if ( parent.dataset.type == 'star-color' ) {\r\n let ratingStar = affectedEl.querySelectorAll('li');\r\n for( let i = 0; i < ratingStar.length; i++ ) {\r\n let span = ratingStar[i].getElementsByTagName( 'span' );\r\n for( let j = 0; j < span.length; j++ ) {\r\n span[j].style.fill = uiColor;\r\n }\r\n }\r\n } else if( parent.dataset.type == 'numeral-rating-color' ) {\r\n let wptbTextMessageSize = affectedEl.querySelector('.wptb-number-rating');\r\n wptbTextMessageSize.style.color = uiColor;\r\n }\r\n\r\n } else {\r\n affectedEl.style.color = uiColor;\r\n }\r\n },\r\n numberImputSize: function ( wptbNumberInputs, maxCount, maxValue ) {\r\n wptbNumberInputs.onkeydown = function() {\r\n let thisValue = this.value;\r\n thisValue = String( thisValue );\r\n if ( thisValue[0] == 0 ) {\r\n this.value = \"\";\r\n } else {\r\n thisValue = thisValue.substring( 0, maxCount );\r\n this.value = thisValue;\r\n }\r\n }\r\n wptbNumberInputs.onkeyup = function( ) {\r\n let thisValue = this.value;\r\n if ( parseInt( thisValue, 10 ) > parseInt( maxValue, 10 ) ) {\r\n this.value = maxValue;\r\n }\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n },\r\n ucfirst: function( str ) {\r\n return str.charAt(0).toUpperCase() + str.slice(1);\r\n },\r\n wptbDocumentEventGenerate: function( eventName, element, details ) {\r\n if( eventName && element ) {\r\n if( ! details ) {\r\n details = true;\r\n }\r\n let event = new CustomEvent( eventName, { detail: details, bubbles: true } );\r\n element.dispatchEvent( event );\r\n }\r\n },\r\n // run script for the pointed element\r\n elementStartScript: function( element, kind ) {\r\n //let script = element.getElementsByTagName( 'script' );\r\n if(!kind) {\r\n let infArr = element.className.match(/wptb-element-(.+)-(\\d+)/i);\r\n if( infArr && Array.isArray( infArr ) ) {\r\n kind = infArr[1];\r\n }\r\n }\r\n\r\n if( kind ) {\r\n// let wpTemplateId = 'wptb-' + kind + '-script';\r\n// let template = wp.template( wpTemplateId );\r\n// let data = {elemClass: infArr[0]};\r\n// let elementScriptText = template( data );\r\n// elementScriptText = elementScriptText.replace(/\\r|\\n|\\t/g, '').trim();\r\n//\r\n// let scriptNew = document.createElement( 'script' );\r\n// scriptNew.setAttribute( 'type', 'text/javascript' );\r\n// scriptNew.innerHTML = elementScriptText;\r\n// element.parentNode.appendChild( scriptNew );\r\n\r\n// element.parentNode.removeChild( scriptNew );\r\n if( kind in WPTB_ElementsScriptsLauncher ) {\r\n WPTB_ElementsScriptsLauncher[kind]( element );\r\n }\r\n }\r\n },\r\n // deletes event handlers from the pointed option element and from all his daughter elements\r\n deleteEventHandlers: function( element ) {\r\n if( element ) {\r\n jQuery( element ).off();\r\n let elementChildren = element.children;\r\n if( elementChildren ) {\r\n for ( let i = 0; i < elementChildren.length; i++ ) {\r\n WPTB_Helper.deleteEventHandlers( elementChildren[i] );\r\n }\r\n }\r\n } else {\r\n return;\r\n }\r\n },\r\n // replace all occurrences in a string\r\n replaceAll: function( string, search, replace ){\r\n return string.split( search ).join( replace );\r\n },\r\n // clears code from TinyMCE attributes\r\n elementClearFromTinyMce: function( element ) {\r\n let mceContentBodys = element.querySelectorAll( '.mce-content-body' );\r\n if( mceContentBodys.length > 0 ) {\r\n for ( let k = 0; k < mceContentBodys.length; k++ ) {\r\n mceContentBodys[k].classList.remove( 'mce-content-body' );\r\n }\r\n }\r\n\r\n let dataMceStyle = element.querySelectorAll( '[data-mce-style]' );\r\n if ( dataMceStyle.length > 0 ) {\r\n for ( let k = 0; k < dataMceStyle.length; k++ ) {\r\n dataMceStyle[k].removeAttribute( 'data-mce-style' );\r\n }\r\n }\r\n\r\n let mceEditFocus = element.querySelectorAll( '.mce-edit-focus' );\r\n if( mceEditFocus.length > 0 ) {\r\n for ( let k = 0; k < mceEditFocus.length; k++ ) {\r\n mceEditFocus[k].classList.remove( 'mce-edit-focus' );\r\n }\r\n }\r\n\r\n let contentEditable = element.querySelectorAll( '[contenteditable]' );\r\n if ( contentEditable.length > 0 ) {\r\n for ( let k = 0; k < contentEditable.length; k++ ) {\r\n contentEditable[k].removeAttribute( 'contenteditable' );\r\n }\r\n }\r\n\r\n let spellCheck = element.querySelectorAll( '[spellcheck]' );\r\n if ( spellCheck.length > 0 ) {\r\n for ( let k = 0; k < spellCheck.length; k++ ) {\r\n spellCheck[k].removeAttribute( 'spellcheck' );\r\n }\r\n }\r\n\r\n let mceIds = element.querySelectorAll( '[id^=mce_]' );\r\n if ( mceIds.length > 0 ) {\r\n for ( let k = 0; k < mceIds.length; k++ ) {\r\n mceIds[k].removeAttribute( 'id' );\r\n }\r\n }\r\n\r\n return element;\r\n },\r\n elementOptionContainerCustomClassSet: function( targetInput, customClassForContainer ) {\r\n if( targetInput && customClassForContainer ) {\r\n let containerElement = WPTB_Helper.findAncestor( targetInput, 'wptb-element-option' );\r\n if( containerElement ) {\r\n containerElement.classList.add( customClassForContainer );\r\n }\r\n }\r\n },\r\n elementOptionContainerAdditionalStyles: function( targetInput, containerAdditionalStyles ) {\r\n if( targetInput && containerAdditionalStyles ) {\r\n let containerElement = WPTB_Helper.findAncestor( targetInput, 'wptb-element-option' );\r\n let containerStylesArrOne = containerAdditionalStyles.split( ';' );\r\n\r\n if( containerElement && containerStylesArrOne ) {\r\n function containerStylesSet( containerStyleStr, containerElement ) {\r\n if( containerStyleStr ) {\r\n containerStyleStrArr = containerStyleStr.split( ':' );\r\n\r\n if( containerStyleStrArr && Array.isArray( containerStyleStrArr ) ) {\r\n containerElement.style[containerStyleStrArr[0]] = containerStyleStrArr[1];\r\n }\r\n }\r\n }\r\n if( containerStylesArrOne && Array.isArray( containerStylesArrOne ) ) {\r\n for( let i = 0; i < containerStylesArrOne.length; i++ ) {\r\n if( containerStylesArrOne[i] ) {\r\n containerStylesSet( containerStylesArrOne[i], containerElement );\r\n }\r\n }\r\n } else {\r\n containerStylesSet( containerStylesArrOne, containerElement );\r\n }\r\n }\r\n }\r\n },\r\n // function which set handler for event of changes of control\r\n controlsInclude: function( element, functionHandler, acceptEventValues = false ) {\r\n if( element && typeof element === 'object' && typeof functionHandler === 'function' ) {\r\n element.addEventListener( 'element:controls:active', function() {\r\n if(!element.hasOwnProperty('controlConnectFunctionsName') ||\r\n !Array.isArray(element.controlConnectFunctionsName) ||\r\n element.controlConnectFunctionsName.indexOf(functionHandler.name) == -1) {\r\n let infArr = element.className.match( /wptb-element-(.+)-(\\d+)/i ),\r\n elementKind;\r\n\r\n if( infArr && Array.isArray( infArr ) ) {\r\n elementKind = infArr[1];\r\n }\r\n\r\n// if( ! element.hasOwnProperty( 'сontrolsConnectIndic' ) || element.сontrolsConnectIndic !== true && elementKind ) {\r\n// let elementsSettingsTemplateJs = document.getElementsByClassName( 'wptb-element-datas' );\r\n// if( elementsSettingsTemplateJs.length > 0 ) {\r\n// elementsSettingsTemplateJs = elementsSettingsTemplateJs[0];\r\n//\r\n// let elementsSettings = elementsSettingsTemplateJs.innerHTML;\r\n// let controlClassesNames = [];\r\n// if( elementsSettings ) {\r\n// elementsSettings = elementsSettings.trim();\r\n// elementsSettings = JSON.parse( elementsSettings );\r\n// if( elementsSettings && typeof elementsSettings === 'object' ) {\r\n// if( 'tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2] in elementsSettings ) {\r\n// let elementSettings = elementsSettings['tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2]];\r\n// if( elementSettings && typeof elementSettings === 'object' ) {\r\n// Object.keys( elementSettings ).forEach( function( key ) {\r\n// let regularText = new RegExp( 'data-wptb-el-' + elementKind + '-(\\\\d+)-([a-zA-Z0-9_-]+)', \"i\" );\r\n// let keyInfArr = key.match( regularText );\r\n// if( keyInfArr && Array.isArray( keyInfArr ) ) {\r\n// let controlClass = key.replace( 'data-', '' );\r\n// controlClassesNames.push( [controlClass, keyInfArr[2]] );\r\n// }\r\n// });\r\n// }\r\n// }\r\n// }\r\n// }\r\n// }\r\n// }\r\n if( elementKind ){\r\n let elementOptionsGroupIds = element.optionsGroupIds;\r\n if(elementOptionsGroupIds && Array.isArray(elementOptionsGroupIds)) {\r\n for(let i = 0; i < elementOptionsGroupIds.length; i++) {\r\n let elementOptionsGroupId = elementOptionsGroupIds[i];\r\n\r\n let elementOptionsGroup = document.getElementById(elementOptionsGroupId);\r\n\r\n let controlActiveElements = elementOptionsGroup.querySelectorAll('.wptb-element-property');\r\n controlActiveElements = [...controlActiveElements];\r\n\r\n controlActiveElements.map(controlActiveElement => {\r\n let regularText = new RegExp( 'wptb-el-' + elementKind + '-(\\\\d+)-([a-zA-Z0-9_-]+)', \"i\" );\r\n let controlInfArr = controlActiveElement.className.match( regularText );\r\n if( controlInfArr && Array.isArray( controlInfArr ) ) {\r\n let controlUnicClassName = controlInfArr[0];\r\n\r\n element.addEventListener( 'wptb-control:' + controlUnicClassName, function(e) {\r\n let controls = {};\r\n let controlName = controlInfArr[2];\r\n let control = document.getElementsByClassName( controlUnicClassName );\r\n if( control.length > 0 && controlName ) {\r\n let targetControlValue = WPTB_Helper.targetControlValueGet( control );\r\n\r\n if(acceptEventValues) {\r\n controls[controlName] = {\r\n targetValue: targetControlValue,\r\n eventValue: e.detail.value\r\n }\r\n }else {\r\n controls[controlName] = targetControlValue;\r\n }\r\n }\r\n functionHandler( controls, element );\r\n }, false );\r\n }\r\n });\r\n }\r\n }\r\n //let elementOptionsContainer = document.querySelector( '.wptb-element-options.wptb-options-' + infArr[1] + '-' + infArr[2] );\r\n\r\n // from time to time depend on table cells hierarchy, cell td items may catch mouse clicks which are intended for elements. since the active section is not cell management, this will gives and unharmfull error of not found element, simple check for null equality will be sufficient for now.\r\n // if(!elementOptionsContainer){\r\n // return;\r\n // }\r\n\r\n // let elementOptions = elementOptionsContainer.querySelectorAll( '.wptb-element-option' );\r\n // let controlActiveElements = elementOptions[i].querySelector( '.wptb-element-property' );\r\n //\r\n //\r\n // for( let i = 0; i < elementOptions.length; i++ ) {\r\n // let controlActiveElement = elementOptions[i].querySelector( '.wptb-element-property' );\r\n // if( controlActiveElement ) {\r\n //\r\n // }\r\n // }\r\n\r\n if(!element.controlConnectFunctionsName && !Array.isArray(element.controlConnectFunctionsName)) {\r\n element.controlConnectFunctionsName = [];\r\n }\r\n\r\n element.controlConnectFunctionsName.push( functionHandler.name );\r\n }\r\n }\r\n }, false );\r\n }\r\n },\r\n oneControlInclude: function( element, functionHandler, controlName ) {\r\n if( element && typeof element === 'object' && typeof functionHandler === 'function' && typeof controlName === 'string' ) {\r\n let infArr = element.className.match( /wptb-element-((.+-)\\d+)/i ),\r\n elementKind;\r\n\r\n if( infArr && Array.isArray( infArr ) ) {\r\n elementKind = infArr[1].split( '-' )[0];\r\n\r\n let wptbContrlStacksConfigId = 'wptb-' + elementKind + '-control-stack';\r\n let tmplControlsConfig = wp.template( wptbContrlStacksConfigId );\r\n let data = {\r\n container: '.' + infArr[0]\r\n };\r\n let jsonControlsConfigJson = tmplControlsConfig( data );\r\n let jsonControlsConfig = JSON.parse( jsonControlsConfigJson );\r\n\r\n if( jsonControlsConfig && typeof jsonControlsConfig === 'object' && jsonControlsConfig.hasOwnProperty( controlName ) ) {\r\n let controlClassName = 'wptb-el-' + infArr[1] + '-' + controlName;\r\n\r\n element.addEventListener( 'wptb-control:' + controlClassName, function( event ) {\r\n let control = document.getElementsByClassName( controlClassName );\r\n if( control.length > 0 ) {\r\n let targetControlValue = WPTB_Helper.targetControlValueGet( control );\r\n\r\n functionHandler( targetControlValue, element );\r\n }\r\n }, false );\r\n }\r\n }\r\n } else {\r\n return false;\r\n }\r\n },\r\n //\r\n innerElementCopyIncludeHandler: function( element, functionHandler ) {\r\n if( element && typeof element === 'object' && typeof functionHandler === 'function' ) {\r\n element.addEventListener( 'wptb-inner-element:copy', function( event ) {\r\n let innerElement = event.detail;\r\n if( innerElement ) {\r\n WPTB_Helper.elementClearFromTinyMce( innerElement );\r\n functionHandler( innerElement, element );\r\n }\r\n }, false );\r\n }\r\n },\r\n /**\r\n * Sets the control elements when changing which to will restart this control\r\n * @param {array} dependOnControlName\r\n * @param {string} targetControlElementClass\r\n * @param {array} valueDependOnControlCorrect\r\n * @param {string} kind\r\n * @param {HTMLElement} element\r\n */\r\n valueDependOnControl: function(dependOnControlName, targetControlElementClass, valueDependOnControlCorrect, kind, element) {\r\n function dependOnControlDataGet(dependOnControlName, targetControlElementClass, valueDependOnControlCorrect) {\r\n if(typeof dependOnControlName === 'string') {\r\n dependOnControlName = [dependOnControlName];\r\n }\r\n let infArr = targetControlElementClass.match(/wptb-el-((.+-)\\d+)-(.+)/i);\r\n let valueDependOnControl = {};\r\n let dependOnControlElementsArr = [];\r\n if (infArr && Array.isArray(infArr)) {\r\n let controlName = infArr[3];\r\n let dependOnControlElements;\r\n let valueDependOnControlCorrectObj = {};\r\n if(Array.isArray(valueDependOnControlCorrect)) {\r\n if(Array.isArray(valueDependOnControlCorrect[0])) {\r\n valueDependOnControlCorrect.map(s => {\r\n valueDependOnControlCorrectObj[s[0]] = [s[1], s[2]];\r\n });\r\n } else {\r\n valueDependOnControlCorrectObj[valueDependOnControlCorrect[0]] = [valueDependOnControlCorrect[1], valueDependOnControlCorrect[2]];\r\n }\r\n }\r\n dependOnControlName.map(s => {\r\n let dependOnControlElementClass = targetControlElementClass.replace(controlName, s);\r\n if(dependOnControlElementClass) {\r\n dependOnControlElements = document.getElementsByClassName(dependOnControlElementClass);\r\n if(dependOnControlElements.length > 0 && dependOnControlElements[0].type) {\r\n valueDependOnControl[s] = dependOnControlElements[0].value;\r\n if(s in valueDependOnControlCorrectObj) {\r\n if(valueDependOnControlCorrectObj[s][1] === 'integer') {\r\n valueDependOnControl[s] = parseInt(valueDependOnControl[s]) + parseInt(valueDependOnControlCorrectObj[s][0]);\r\n } else if(valueDependOnControlCorrectObj[s][1] === 'string') {\r\n valueDependOnControl[s] = valueDependOnControl[s] + valueDependOnControlCorrectObj[s][0];\r\n }\r\n }\r\n dependOnControlElementsArr.push(dependOnControlElements[0]);\r\n }\r\n }\r\n });\r\n }\r\n\r\n return [valueDependOnControl, dependOnControlElementsArr];\r\n }\r\n\r\n let dependOnControlData = dependOnControlDataGet(dependOnControlName, targetControlElementClass, valueDependOnControlCorrect);\r\n WPTB_Helper.elementOptionsSet(kind, element, dependOnControlData[0], targetControlElementClass);\r\n\r\n Object.keys(dependOnControlData[0]).forEach(function (key) {\r\n let infArr = element.className.match( /wptb-element-((.+-)\\d+)/i );\r\n let unicClass = 'wptb-el-' + infArr[1] + '-' + [key];\r\n element.addEventListener(`wptb-control:${unicClass}`, function(event){\r\n let dependOnControlData = dependOnControlDataGet(dependOnControlName, targetControlElementClass, valueDependOnControlCorrect);\r\n WPTB_Helper.elementOptionsSet(kind, element, dependOnControlData[0], targetControlElementClass);\r\n }, false);\r\n });\r\n },\r\n /**\r\n * Sets the visibility of one control to depend on the state of other controls\r\n * @param dependOnMain\r\n * @param targetControlElementClass\r\n */\r\n appearDependOnControl: function( dependOnMain, targetControlElementClass ) {\r\n if( Array.isArray( dependOnMain ) ) {\r\n if(typeof dependOnMain[0] === 'string') {\r\n dependOnMain = [dependOnMain];\r\n } else if(!Array.isArray(dependOnMain[0])) {\r\n return;\r\n }\r\n let dependOnControlElementsValue = {};\r\n for(let i = 0; i < dependOnMain.length; i++) {\r\n let dependOn = dependOnMain[i];\r\n let dependOnControlName = dependOn[0];\r\n let infArr = targetControlElementClass.match(/wptb-el-((.+-)\\d+)-(.+)/i);\r\n\r\n if (infArr && Array.isArray(infArr)) {\r\n let controlName = infArr[3];\r\n\r\n let dependOnControlElementClass = targetControlElementClass.replace(controlName, dependOnControlName);\r\n if(dependOnControlElementClass) {\r\n let dependOnControlElements = document.getElementsByClassName(dependOnControlElementClass);\r\n if(dependOnControlElements.length > 0) {\r\n dependOnControlElementsValue[dependOn[0]] = [dependOnControlElementValue(dependOnControlElements, dependOn), dependOnControlElements, dependOn];\r\n }\r\n }\r\n }\r\n }\r\n\r\n let targetControlElement = document.getElementsByClassName( targetControlElementClass );\r\n if( targetControlElement.length > 0 ) {\r\n targetControlElement = targetControlElement[0];\r\n let controlContainerElem = WPTB_Helper.findAncestor( targetControlElement, 'wptb-element-option' );\r\n\r\n if( controlContainerElem ) {\r\n showHideTargetControlElement(controlContainerElem, dependOnControlElementsValue);\r\n\r\n Object.keys(dependOnControlElementsValue).map(k => {\r\n if (Object.prototype.hasOwnProperty.call(dependOnControlElementsValue, k)) {\r\n let dependOnControlElements = dependOnControlElementsValue[k][1];\r\n let dependOnControlElement = dependOnControlElements[0];\r\n dependOnControlElement.addEventListener( 'change', dependOnControlElementChangeHandler.bind(null, controlContainerElem, dependOnControlElementsValue, k), false );\r\n }\r\n });\r\n }\r\n }\r\n\r\n function dependOnControlElementChangeHandler(controlContainerElem, dependOnControlElementsValue, k) {\r\n let dependOn = dependOnControlElementsValue[k][2];\r\n let dependOnControlElements = dependOnControlElementsValue[k][1];\r\n dependOnControlElementsValue[dependOn[0]] = [dependOnControlElementValue(dependOnControlElements, dependOn), dependOnControlElements, dependOn];\r\n showHideTargetControlElement(controlContainerElem, dependOnControlElementsValue)\r\n }\r\n\r\n function showHideTargetControlElement(controlContainerElem, dependOnControlElementsValue) {\r\n let display = 'block';\r\n Object.keys(dependOnControlElementsValue).map(k => {\r\n if (Object.prototype.hasOwnProperty.call(dependOnControlElementsValue, k)) {\r\n if(dependOnControlElementsValue[k][0] === false){\r\n display = 'none';\r\n }\r\n }\r\n })\r\n\r\n controlContainerElem.style.display = display;\r\n }\r\n\r\n function dependOnControlElementValue(dependOnControlElements, dependOn) {\r\n let targetControlValue = WPTB_Helper.targetControlValueGet(dependOnControlElements);\r\n\r\n if(dependOn[1] && Array.isArray(dependOn[1]) &&\r\n (dependOn[1].indexOf(targetControlValue) !== -1 )) {\r\n return true;\r\n // let childCheck = controlContainerElem.querySelector('input[type=\"checkbox\"]')\r\n // if (childCheck) {\r\n // childCheck.checked = true;\r\n // }\r\n } else if(dependOn[2] && Array.isArray(dependOn[2]) &&\r\n (dependOn[2].indexOf(targetControlValue) !== -1)) {\r\n return false;\r\n }\r\n }\r\n }\r\n },\r\n //\r\n controlsStateManager: function ( targetControlClass, controlChangeIndic ) {\r\n let targetControls = document.getElementsByClassName( targetControlClass );\r\n if( targetControls.length > 0 ) {\r\n //targetControls = targetControls[0];\r\n\r\n let infArr = targetControlClass.match( /wptb-el-((.+-)\\d+)-(.+)/i );\r\n\r\n if( infArr && Array.isArray( infArr ) ) {\r\n let selectorElement;\r\n selectorElement = document.querySelector( '.wptb-element-' + infArr[1] );\r\n\r\n if( selectorElement ) {\r\n let elementsSettingsTemplatesJs;\r\n let elementSettings = {};\r\n let elementsSettings;\r\n elementsSettingsTemplatesJs = document.getElementsByClassName( 'wptb-element-datas' );\r\n if( elementsSettingsTemplatesJs.length == 0 || elementsSettingsTemplatesJs[0].innerHTML == '' ) {\r\n let targetControlValue = WPTB_Helper.targetControlValueGet( targetControls );\r\n elementSettings['data-' + targetControlClass] = targetControlValue;\r\n\r\n elementsSettings = {};\r\n elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] = elementSettings;\r\n elementsSettings = JSON.stringify( elementsSettings );\r\n\r\n if( elementsSettingsTemplatesJs.length == 0 ) {\r\n elementsSettingsTemplatesJs = document.createElement( 'script' );\r\n elementsSettingsTemplatesJs.setAttribute( 'type', 'text/html' );\r\n elementsSettingsTemplatesJs.setAttribute( 'class', 'wptb-element-datas' );\r\n } else {\r\n elementsSettingsTemplatesJs = elementsSettingsTemplatesJs[0];\r\n }\r\n\r\n elementsSettingsTemplatesJs.innerHTML = elementsSettings;\r\n\r\n let body = document.getElementsByTagName('body')[0];\r\n body.appendChild( elementsSettingsTemplatesJs );\r\n } else {\r\n elementsSettingsTemplatesJs = elementsSettingsTemplatesJs[0];\r\n elementsSettings = elementsSettingsTemplatesJs.innerHTML;\r\n if( elementsSettings ) {\r\n elementsSettings = elementsSettings.trim();\r\n elementsSettings = JSON.parse( elementsSettings );\r\n\r\n if( elementsSettings && typeof elementsSettings === 'object' ) {\r\n\r\n\r\n if( controlChangeIndic ) {\r\n let targetControlValue = WPTB_Helper.targetControlValueGet( targetControls );\r\n if( ! ( ( 'tmpl-wptb-el-datas-' + infArr[1] ) in elementsSettings ) ||\r\n typeof elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] !== 'object') {\r\n elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] = {};\r\n }\r\n elementsSettings['tmpl-wptb-el-datas-' + infArr[1]]['data-' + targetControlClass] = targetControlValue;\r\n elementsSettingsTemplatesJs.innerHTML = JSON.stringify( elementsSettings );\r\n } else if( ! ( ( ( 'tmpl-wptb-el-datas-' + infArr[1] ) in elementsSettings ) &&\r\n typeof elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] === 'object' &&\r\n ( 'data-' + targetControlClass ) in elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] ) ) {\r\n let targetControlValue = WPTB_Helper.targetControlValueGet( targetControls );\r\n if( ! ( ( 'tmpl-wptb-el-datas-' + infArr[1] ) in elementsSettings ) ||\r\n typeof elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] !== 'object') {\r\n elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] = {};\r\n }\r\n elementsSettings['tmpl-wptb-el-datas-' + infArr[1]]['data-' + targetControlClass] = targetControlValue;\r\n elementsSettingsTemplatesJs.innerHTML = JSON.stringify( elementsSettings );\r\n } else if( ( ( 'tmpl-wptb-el-datas-' + infArr[1] ) in elementsSettings ) &&\r\n typeof elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] === 'object' &&\r\n ( 'data-' + targetControlClass ) in elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] ) {\r\n for( let i = 0; i < targetControls.length; i++ ) {\r\n if( targetControls[i].type == 'checkbox' ) {\r\n let targetControlValue;\r\n if( targetControls[i].name ) {\r\n targetControlValue = elementsSettings['tmpl-wptb-el-datas-' + infArr[1]]['data-' + targetControlClass][targetControls[i].name];\r\n } else {\r\n targetControlValue = elementsSettings['tmpl-wptb-el-datas-' + infArr[1]]['data-' + targetControlClass];\r\n }\r\n\r\n if( targetControlValue == 'checked' ) {\r\n targetControls[i].checked = true;\r\n } else if( targetControlValue == 'unchecked' ) {\r\n targetControls[i].checked = false;\r\n }\r\n } else {\r\n targetControls[i].value = elementsSettings['tmpl-wptb-el-datas-' + infArr[1]]['data-' + targetControlClass];\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n },\r\n //\r\n targetControlValueGet: function( targetControls ) {\r\n let targetControlValue;\r\n for( let i = 0; i < targetControls.length; i++ ) {\r\n if( targetControls[i].type == 'checkbox' && targetControls[i].name ) {\r\n if( ! targetControlValue ) targetControlValue = {};\r\n if( targetControls[i].checked == true ) {\r\n targetControlValue[targetControls[i].name] = 'checked';\r\n } else {\r\n targetControlValue[targetControls[i].name] = 'unchecked';\r\n }\r\n } else if( targetControls[i].type == 'checkbox' ) {\r\n if( targetControls[i].checked == true ) {\r\n targetControlValue = 'checked';\r\n } else {\r\n targetControlValue = 'unchecked';\r\n }\r\n } else if( targetControls[i].type ) {\r\n targetControlValue = targetControls[i].value;\r\n } else if( targetControls[i].dataset.alignmentValue && targetControls[i].classList.contains( 'selected' ) ){\r\n targetControlValue = targetControls[i].dataset.alignmentValue;\r\n }\r\n }\r\n return targetControlValue;\r\n },\r\n //\r\n elementControlsStateCopy: function( elementProt, copyElem ) {\r\n if( elementProt && copyElem ) {\r\n let infArrProt = elementProt.className.match( /wptb-element-((.+-)\\d+)/i );\r\n let infArrCopy = copyElem.className.match( /wptb-element-((.+-)\\d+)/i );\r\n if( infArrProt && Array.isArray( infArrProt ) &&\r\n infArrCopy && Array.isArray( infArrCopy )) {\r\n let elemProtKind = infArrProt[1];\r\n let elemCopyKind = infArrCopy[1];\r\n let elementsSettingsTemplateJs = document.getElementsByClassName( 'wptb-element-datas' );\r\n if( elementsSettingsTemplateJs.length > 0 ) {\r\n elementsSettingsTemplateJs = elementsSettingsTemplateJs[0];\r\n\r\n let elementsSettings = elementsSettingsTemplateJs.innerHTML;\r\n if( elementsSettings ) {\r\n elementsSettings = elementsSettings.trim();\r\n elementsSettings = JSON.parse( elementsSettings );\r\n\r\n if( elementsSettings && typeof elementsSettings === 'object' ) {\r\n let elementSettingsProt = elementsSettings['tmpl-wptb-el-datas-' + elemProtKind];\r\n if( elementSettingsProt && typeof elementSettingsProt === 'object' ) {\r\n let elementSettingsCopy = {};\r\n\r\n Object.keys( elementSettingsProt ).forEach( function( key ) {\r\n let elementSettingValue = elementSettingsProt[key];\r\n let elementSettingKeyCopy = key.replace( elemProtKind, elemCopyKind );\r\n elementSettingsCopy[elementSettingKeyCopy] = elementSettingValue;\r\n });\r\n\r\n if( Object.keys( elementSettingsCopy ).length > 0 ) {\r\n elementsSettings['tmpl-wptb-el-datas-' + elemCopyKind] = elementSettingsCopy;\r\n\r\n elementsSettings = JSON.stringify( elementsSettings );\r\n elementsSettingsTemplateJs.innerHTML = elementsSettings;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n },\r\n //\r\n elementControlsStateDelete: function( element, nameControl ) {\r\n let infArr = element.className.match( /wptb-element-(.+)-(\\d+)/i );\r\n let body = document.getElementsByTagName( 'body' )[0];\r\n let wptbElementDatas = body.getElementsByClassName( 'wptb-element-datas' );\r\n if( infArr && Array.isArray( infArr ) && wptbElementDatas.length > 0 ) {\r\n wptbElementDatas = wptbElementDatas[0];\r\n let elementsSettings = wptbElementDatas.innerHTML;\r\n if( elementsSettings ) {\r\n elementsSettings = elementsSettings.trim();\r\n elementsSettings = JSON.parse( elementsSettings );\r\n if( elementsSettings && typeof elementsSettings === 'object' &&\r\n ( ( 'tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2] ) in elementsSettings ) ) {\r\n if( ! nameControl ) {\r\n delete elementsSettings['tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2]];\r\n } else {\r\n if( elementsSettings['tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2]] &&\r\n typeof elementsSettings['tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2]] === 'object' &&\r\n ( 'data-wptb-el-' + infArr[1] + '-' + infArr[2] + '-' + nameControl ) in elementsSettings['tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2]] ) {\r\n delete elementsSettings['tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2]]['data-wptb-el-' + infArr[1] + '-' + infArr[2] + '-' + nameControl];\r\n }\r\n }\r\n\r\n if( Object.keys( elementsSettings ).length == 0 ) {\r\n body.removeChild( wptbElementDatas );\r\n } else {\r\n elementsSettings = JSON.stringify( elementsSettings );\r\n wptbElementDatas.innerHTML = elementsSettings;\r\n }\r\n }\r\n }\r\n }\r\n },\r\n //\r\n elementOptionsSet: function( kind, element, valueDependOnControl, targetControlElementClass ) {\r\n // get controls config for this element\r\n let wptbContrlStacksConfigId = 'wptb-' + kind + '-control-stack';\r\n let tmplControlsConfig = wp.template( wptbContrlStacksConfigId );\r\n let data;\r\n let elementContainerClass;\r\n let elementOptionClassIndic;\r\n let elementOptionsGroup;\r\n\r\n let controlElementParent;\r\n let elementOptionsScriptsContainer;\r\n\r\n let infArr = element.className.match( /wptb-element-((.+-)\\d+)/i );\r\n if( ! infArr ) {\r\n let table_id = WPTB_Helper.detectMode();\r\n if (!table_id) {\r\n table_id = 'startedid-0';\r\n }\r\n if( element.classList.contains( 'wptb-preview-table' ) ) {\r\n element.classList.add( 'wptb-element-main-table_setting-' + table_id );\r\n } else if( element.classList.contains( 'wptb-cell' ) ) {\r\n let cellEditActiveClass = document.querySelector('.wptb-element-table_cell_setting-' + element.dataset.xIndex + '-' + element.dataset.yIndex);\r\n if( ! cellEditActiveClass ) element.classList.add('wptb-element-table_cell_setting-' + element.dataset.xIndex + '-' + element.dataset.yIndex);\r\n }else if (element.classList.contains('wptb-responsive')){\r\n // if table id parsed from url is starting with 'wptb-team', it means it is team built prebuilt table with a unique id that doesn't fit infArr match regex, in that case, use default id for elements options\r\n if(table_id.startsWith('wptb_team')){\r\n table_id = 'startedid-0';\r\n }\r\n element.classList.add('wptb-element-table_responsive_setting-' + table_id);\r\n }\r\n\r\n infArr = element.className.match( /wptb-element-((.+-)\\d+)/i );\r\n }\r\n\r\n data = {\r\n container: '.' + infArr[0]\r\n };\r\n let controlName;\r\n data.valueDependOnControl = {};\r\n if(valueDependOnControl) {\r\n Object.keys(valueDependOnControl).forEach(function (key) {\r\n data.valueDependOnControl[key] = valueDependOnControl[key];\r\n });\r\n }\r\n if(targetControlElementClass) {\r\n let infArr = targetControlElementClass.match(/wptb-el-((.+-)\\d+)-(.+)/i);\r\n\r\n if (infArr && Array.isArray(infArr)) {\r\n controlName = infArr[3];\r\n }\r\n }\r\n\r\n elementContainerClass = infArr[0];\r\n elementOptionClassIndic = infArr[1];\r\n\r\n if( element.classList.contains( 'wptb-preview-table' ) ) {\r\n\r\n } else if( element.classList.contains( 'wptb-cell' ) ) {\r\n this.activateSection('cell_settings');\r\n }else if (element.classList.contains('wptb-responsive')){\r\n elementOptionsGroupId = 'table-responsive-group';\r\n wptbelementOptionClass = 'wptb-element-option';\r\n }\r\n else {\r\n let children = document.getElementById( 'element-options-group' ).childNodes;\r\n for ( let i = 0; i < children.length; i++) {\r\n if ( children[i].style )\r\n children[i].style.display = 'none';\r\n }\r\n this.activateSection('options_group');\r\n }\r\n\r\n let controlsConfigJson = tmplControlsConfig( data );\r\n let controlsConfig = JSON.parse( controlsConfigJson );\r\n\r\n let elementOptionsGroupIdsInvolved = [],\r\n elementOptionsGroupInvolved = {},\r\n elementOptionsContainerInvolved = {};\r\n\r\n // object for save all scrips for each controls\r\n let controlScriptsObj = {};\r\n\r\n // array for keep \"appear depend on\" params\r\n let controlappearDependOnControl = [];\r\n\r\n // array for keep \"value depend on\" params\r\n let controlValueDependOnControl = [];\r\n\r\n // create controls\r\n let elementOptionsScriptsContainerIndic = false;\r\n if(controlName) {\r\n let controlsConfigNew = {};\r\n controlsConfigNew[controlName] = controlsConfig[controlName];\r\n controlsConfig = controlsConfigNew;\r\n }\r\n let i = 0;\r\n Object.keys( controlsConfig ).forEach( function( key ) {\r\n let data = controlsConfig[key];\r\n data.controlKey = key;\r\n\r\n // get necessary wp js template\r\n let tmplControlTemplate = wp.template( 'wptb-' + data.type + '-control' );\r\n\r\n data.elemContainer = elementContainerClass;\r\n data.elementControlTargetUnicClass = 'wptb-el-' + elementOptionClassIndic + '-' + data.controlKey;\r\n Object.keys(data).map(k => {\r\n if (Object.prototype.hasOwnProperty.call(data, k) && data[k] === 'control_param_calculate_value') {\r\n data[k] = WPTB_Helper.controlParamCalculateValue(data.elementControlTargetUnicClass, k);\r\n }\r\n });\r\n let controlTemplate = tmplControlTemplate( data );\r\n if( 'appearDependOnControl' in data ) {\r\n if( Array.isArray( data.appearDependOnControl ) ) {\r\n controlappearDependOnControl.push( [data.appearDependOnControl, data.elementControlTargetUnicClass] );\r\n }\r\n }\r\n\r\n if('valueDependOnControl' in data && !valueDependOnControl && !targetControlElementClass) {\r\n let valueDependOnControlCorrect = '';\r\n if(data.valueDependOnControlCorrect) valueDependOnControlCorrect = data.valueDependOnControlCorrect;\r\n controlValueDependOnControl.push([data.valueDependOnControl, data.elementControlTargetUnicClass, valueDependOnControlCorrect]);\r\n }\r\n\r\n function elementOptionsContainerInvolvedGet(elementOptionsGroupId, elementOptionsContainerInvolved) {\r\n if(!elementOptionsContainerInvolved[elementOptionsGroupId]){\r\n let elementOptionsContainer = document.createElement( 'div' );\r\n elementOptionsContainer.classList.add( 'wptb-element-options', 'wptb-options-' + infArr[1] );\r\n document.getElementById( elementOptionsGroupId ).appendChild(elementOptionsContainer);\r\n elementOptionsContainerInvolved[elementOptionsGroupId] = elementOptionsContainer;\r\n }\r\n\r\n return elementOptionsContainerInvolved[elementOptionsGroupId];\r\n }\r\n\r\n if(elementOptionsGroupIdsInvolved.indexOf(data.elementOptionsGroupId) == -1 && !controlName) {\r\n elementOptionsGroupIdsInvolved.push(data.elementOptionsGroupId);\r\n // clear elements from options group\r\n //document.getElementById( 'element-options-group' ).innerHTML = '';\r\n elementOptionsGroup = document.getElementById(data.elementOptionsGroupId);\r\n let elementOptionsGroupChildren = [...elementOptionsGroup.children];\r\n for( let i = 0; i < elementOptionsGroupChildren.length; i++ ) {\r\n elementOptionsGroup.removeChild( elementOptionsGroupChildren[i] );\r\n }\r\n elementOptionsGroupInvolved[data.elementOptionsGroupId] = elementOptionsGroup;\r\n }\r\n\r\n controlElementParent = elementOptionsGroupInvolved[data.elementOptionsGroupId];\r\n\r\n if(data.elementOptionsContainerOn === 'true' && !controlName) {\r\n controlElementParent = elementOptionsContainerInvolvedGet(data.elementOptionsGroupId, elementOptionsContainerInvolved);\r\n }\r\n\r\n\r\n if(data.elementOptionContainerOn === 'true') {\r\n let elementOptionContainer = document.createElement( 'div' );\r\n elementOptionContainer.classList.add( data.elementOptionClass, 'wptb-settings-items' );\r\n\r\n if( data.customClassForContainer ) {\r\n elementOptionContainer.classList.add( data.customClassForContainer );\r\n }\r\n\r\n if( data.containerAdditionalStyles ) {\r\n elementOptionContainer.setAttribute( 'style', data.containerAdditionalStyles );\r\n }\r\n\r\n if(targetControlElementClass) {\r\n let targetControlElement = document.getElementsByClassName( targetControlElementClass );\r\n if( targetControlElement.length > 0 ) {\r\n targetControlElement = targetControlElement[0];\r\n let controlContainerElem = WPTB_Helper.findAncestor(targetControlElement, 'wptb-element-option');\r\n\r\n if (controlContainerElem) {\r\n let controlContainerElemParent = controlContainerElem.parentNode;\r\n controlContainerElemParent.insertBefore(elementOptionContainer, controlContainerElem);\r\n controlContainerElemParent.removeChild(controlContainerElem);\r\n }\r\n }\r\n } else {\r\n controlElementParent.appendChild( elementOptionContainer );\r\n }\r\n controlElementParent = elementOptionContainer;\r\n }\r\n controlElementParent.innerHTML = controlElementParent.innerHTML + controlTemplate;\r\n\r\n let helperJavascriptElem = controlElementParent.getElementsByTagName( 'wptb-template-script' );\r\n if( helperJavascriptElem.length > 0 ) {\r\n helperJavascriptElem = helperJavascriptElem[0];\r\n let helperJavascriptCode = helperJavascriptElem.innerText;\r\n controlElementParent.removeChild( helperJavascriptElem );\r\n let script = document.createElement( 'script' );\r\n script.setAttribute( 'type', 'text/javascript' );\r\n script.setAttribute('id', kind + '-' + data.controlKey);\r\n script.innerHTML = helperJavascriptCode.replace(/\\r|\\n|\\t/g, '').trim();\r\n if(!controlScriptsObj[data.elementOptionsGroupId] || !Array.isArray(controlScriptsObj[data.elementOptionsGroupId])) {\r\n controlScriptsObj[data.elementOptionsGroupId] = [];\r\n }\r\n controlScriptsObj[data.elementOptionsGroupId].push( script );\r\n }\r\n\r\n i++;\r\n });\r\n\r\n element.optionsGroupIds = elementOptionsGroupIdsInvolved;\r\n\r\n Object.keys( controlScriptsObj ).forEach( function( elementOptionsGroupId ) {\r\n if(!targetControlElementClass) {\r\n elementOptionsScriptsContainer = document.createElement( 'div' );\r\n elementOptionsScriptsContainer.classList.add( 'wptb-element-options-scripts', 'wptb-options-' + infArr[1] );\r\n elementOptionsGroupInvolved[elementOptionsGroupId].appendChild(elementOptionsScriptsContainer);\r\n }\r\n\r\n let controlScriptsArr = controlScriptsObj[elementOptionsGroupId];\r\n if( controlScriptsArr.length > 0 ) {\r\n for( let i = 0; i < controlScriptsArr.length; i++ ) {\r\n if(targetControlElementClass) {\r\n let id = kind + '-' + controlName;\r\n let script = document.getElementById(id);\r\n elementOptionsScriptsContainer = script.parentNode;\r\n elementOptionsScriptsContainer.insertBefore(controlScriptsArr[i], script);\r\n elementOptionsScriptsContainer.removeChild(script);\r\n } else {\r\n elementOptionsScriptsContainer.appendChild(controlScriptsArr[i]);\r\n }\r\n }\r\n }\r\n });\r\n\r\n // run the scripts of controls\r\n\r\n // run appearDependOnControl function\r\n for ( let i = 0; i < controlappearDependOnControl.length; i++ ) {\r\n WPTB_Helper.appearDependOnControl( controlappearDependOnControl[i][0], controlappearDependOnControl[i][1] );\r\n }\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate( 'element:controls:active', element );\r\n // run valueDependOnControl function\r\n for (let i = 0; i < controlValueDependOnControl.length; i++) {\r\n WPTB_Helper.valueDependOnControl(controlValueDependOnControl[i][0], controlValueDependOnControl[i][1], controlValueDependOnControl[i][2], kind, element);\r\n }\r\n\r\n },\r\n\r\n /**\r\n *\r\n * @param unicClass\r\n * @param controlKey\r\n * @param key\r\n * @returns {*}\r\n */\r\n controlParamCalculateValue: function(unicClass, key) {\r\n let unicClassP = WPTB_Helper.replaceAll(unicClass, '-', '_');\r\n if (window['paramCalculateValue_' + unicClassP + '_' + key] && typeof (window['paramCalculateValue_' + unicClassP + '_' + key]) === \"function\") {\r\n return window['paramCalculateValue_' + unicClassP + '_' + key]();\r\n }\r\n },\r\n\r\n controlParamCalculateValueCreateFunction: function(element, controlKey, key, handlerFunction) {\r\n const infArr = element.className.match( /wptb-element-((.+-)\\d+)/i );\r\n const unicClass = 'wptb-el-' + infArr[1] + '-' + controlKey;\r\n let unicClassP = WPTB_Helper.replaceAll(unicClass, '-', '_');\r\n window['paramCalculateValue_' + unicClassP + '_' + key] = function () {\r\n return handlerFunction(element);\r\n };\r\n },\r\n\r\n /**\r\n * function for create, update css for element\r\n *\r\n * @param elementContainer\r\n * @param selector\r\n * @param cssName\r\n * @param cssValue\r\n */\r\n managerExternalCssStyles: function( elementContainer, selector, cssName, cssValue ) {\r\n let infArr = elementContainer.match( /wptb-element-main(.+)-(\\d+)/i );\r\n if( ! infArr || ! Array.isArray( infArr ) ) {\r\n let table = document.getElementsByClassName( 'wptb-preview-table' );\r\n\r\n if( table.length > 0 ) {\r\n table = table[0];\r\n\r\n let infArr = table.className.match( /wptb-element-main(.+)-(\\d+)/i );\r\n if( infArr && Array.isArray( infArr ) ) {\r\n selector = '.' + infArr[0] + ' ' + selector;\r\n }\r\n }\r\n }\r\n\r\n let head = document.head;\r\n if( head ) {\r\n let cssForThisElement = head.querySelector( '#styles-' + elementContainer );\r\n if( cssForThisElement ) {\r\n let cssText = cssForThisElement.innerHTML;\r\n if( cssText ) {\r\n let cssTextArrFirst = cssText.split( '}' );\r\n cssTextArrFirst.pop();\r\n let selectorExists = false;\r\n for( let i = 0; i < cssTextArrFirst.length; i++ ) {\r\n let cssTextArrSecond = cssTextArrFirst[i].split( '{' );\r\n if( cssTextArrSecond[0] === selector ) {\r\n let cssTextArrThird = cssTextArrSecond[1].split( ';' );\r\n cssTextArrThird.pop();\r\n let cssNameExists = false;\r\n for( let j = 0; j < cssTextArrThird.length; j++ ) {\r\n let cssTextArrFourth = cssTextArrThird[j].split( ':' );\r\n if( cssTextArrFourth[0] === cssName ) {\r\n if( cssValue ) {\r\n cssTextArrThird[j] = cssName + ':' + cssValue;\r\n } else {\r\n cssTextArrThird.splice( j, 1 );\r\n }\r\n\r\n cssTextArrSecond[1] = cssTextArrThird.join( ';' ) ? cssTextArrThird.join( ';' ) + ';' : '';\r\n cssNameExists = true;\r\n break;\r\n }\r\n }\r\n if( ! cssNameExists ) {\r\n if( cssValue ) {\r\n cssTextArrSecond[1] += cssName + ':' + cssValue + ';';\r\n }\r\n }\r\n if( cssTextArrSecond[1] ) {\r\n cssTextArrFirst[i] = cssTextArrSecond[0] + '{' + cssTextArrSecond[1]\r\n } else {\r\n cssTextArrFirst.splice( i, 1 );\r\n }\r\n if( cssTextArrFirst.join( '}' ) ) {\r\n cssForThisElement.innerHTML = cssTextArrFirst.join( '}' ) + '}';\r\n } else {\r\n head.removeChild( cssForThisElement );\r\n }\r\n\r\n selectorExists = true;\r\n break;\r\n }\r\n }\r\n\r\n if( ! selectorExists ) {\r\n if( cssValue ) {\r\n cssForThisElement.innerHTML = cssText + selector + '{' + cssName + ':' + cssValue + ';}';\r\n } else {\r\n cssForThisElement.innerHTML = cssText;\r\n }\r\n }\r\n } else {\r\n if( cssValue ) {\r\n cssForThisElement.innerHTML = selector + '{' + cssName + ':' + cssValue + ';}';\r\n } else {\r\n head.removeChild( cssForThisElement );\r\n }\r\n }\r\n } else {\r\n if( cssValue ) {\r\n let cssForThisElement = document.createElement( 'style' );\r\n cssForThisElement.setAttribute( 'id', 'styles-' + elementContainer );\r\n cssForThisElement.classList.add( 'styles-wptb-elements' );\r\n cssForThisElement.innerHTML = selector + '{' + cssName + ':' + cssValue + ';}';\r\n head.appendChild( cssForThisElement );\r\n }\r\n }\r\n }\r\n },\r\n /**\r\n *\r\n * Register section parts for sidebar\r\n *\r\n * @param {array} sections an array of section names\r\n */\r\n registerSections(sections) {\r\n this.sections = {};\r\n this.currentSection = '';\r\n if (!Array.isArray(sections)) {\r\n sections = [sections];\r\n }\r\n\r\n sections.map(s => {\r\n const sectionElement = document.querySelector(`[data-wptb-section=${s}]`);\r\n if (sectionElement) {\r\n this.sections[s] = sectionElement;\r\n }\r\n })\r\n },\r\n /**\r\n * Activate a registered section and deactivates others\r\n *\r\n * @param {string} sectionDataId section name to be activated\r\n * @param {string} displayType display type override for section to be used in its display style property\r\n */\r\n activateSection(sectionDataId, displayType = 'block') {\r\n this.currentSection=sectionDataId;\r\n this.triggerSectionEvent(sectionDataId);\r\n Object.keys(this.sections).map(k => {\r\n if (Object.prototype.hasOwnProperty.call(this.sections, k)) {\r\n const visibility = sectionDataId === k ? displayType : 'none';\r\n this.sections[k].style = `display: ${visibility} !important`;\r\n }\r\n })\r\n },\r\n /**\r\n * Get id of current active section\r\n *\r\n * @returns {string} active section i\r\n */\r\n getCurrentSection(){\r\n return this.currentSection;\r\n },\r\n /**\r\n * Get current section from search parameter 'wptb-builder-section' of window location\r\n */\r\n getSectionFromUrl(){\r\n const parsedUrl = new URL(window.location.href);\r\n const urlSection = parsedUrl.searchParams.get('wptb-builder-section');\r\n if(urlSection){\r\n if(Object.keys(this.sections).some(key => key===urlSection)){\r\n this.activateSection(urlSection);\r\n }\r\n }\r\n },\r\n /**\r\n * Set up related buttons and links to trigger certain elements\r\n */\r\n setupSectionButtons() {\r\n const sectionButtons = Array.from( document.querySelectorAll('[data-wptb-section-button'));\r\n const vm = this;\r\n\r\n sectionButtons.map(s => {\r\n const sectionName = s.dataset.wptbSectionButton;\r\n s.addEventListener('click', function() {\r\n const displayType = s.dataset.wptbSectionDisplayType;\r\n vm.activateSection(sectionName, displayType);\r\n })\r\n\r\n document.addEventListener('wptbSectionChanged', (e)=> {\r\n if(e.detail === sectionName){\r\n s.classList.remove('disabled');\r\n s.classList.add('active');\r\n }else{\r\n s.classList.remove('active');\r\n s.classList.add('disabled');\r\n }\r\n })\r\n })\r\n },\r\n setupPanelToggleButtons(){\r\n const $ = jQuery;\r\n\r\n $('.wptb-panel-toggle-group').each(function(){\r\n const vm = $(this);\r\n $(this).find('.toggle-icon').click(() => {\r\n vm.find('.wptb-panel-toggle-target').slideToggle();\r\n vm.toggleClass('wptb-panel-toggle-content');\r\n })\r\n })\r\n },\r\n /**\r\n * Trigger a section change event\r\n *\r\n * @param {string} sectionName section name\r\n */\r\n triggerSectionEvent(sectionName){\r\n const sectionEvent = new CustomEvent('wptbSectionChanged', {detail: sectionName});\r\n\r\n document.dispatchEvent(sectionEvent);\r\n },\r\n /**\r\n * Setup sidebar toggle element\r\n *\r\n * @param {string} toggleSelector query selector for drawer toggle element\r\n */\r\n setupSidebarToggle(toggleSelector){\r\n const toggleButton = document.querySelector(toggleSelector);\r\n if(toggleButton){\r\n toggleButton.addEventListener('click', (e)=>{\r\n e.preventDefault();\r\n document.body.classList.toggle('collapsed');\r\n })\r\n }\r\n },\r\n // function for deleting all external CSS for the element\r\n externalCssStylesDelete: function( elementContainerClass ) {\r\n let head = document.head;\r\n if( head ) {\r\n let cssForThisElement = head.querySelector( '#styles-' + elementContainerClass );\r\n\r\n if( cssForThisElement ) {\r\n head.removeChild( cssForThisElement );\r\n }\r\n }\r\n },\r\n // function for copy all external CSS for the element\r\n externalCssStylesCopy: function( activeElement, copyElement ) {\r\n if( activeElement ) {\r\n let infArr = activeElement.className.match( /wptb-element-(.+)-(\\d+)/i );\r\n if( infArr && Array.isArray( infArr ) ) {\r\n let activeElemClass = infArr[0];\r\n\r\n let head = document.head;\r\n if( head ) {\r\n let cssForActiveElement = head.querySelector( '#styles-' + activeElemClass );\r\n\r\n if( cssForActiveElement ) {\r\n let cssForNewElement = cssForActiveElement.cloneNode( true );\r\n\r\n cssForNewElement.removeAttribute( 'id', 'styles-' + activeElemClass );\r\n\r\n let infArrCopyEl = copyElement.className.match( /wptb-element-(.+)-(\\d+)/i );\r\n if( infArrCopyEl && Array.isArray( infArrCopyEl ) ) {\r\n cssForNewElement.setAttribute( 'id', 'styles-' + infArrCopyEl[0] );\r\n let cssForActiveElementInnerHTML = cssForActiveElement.innerHTML;\r\n let cssForNewElementInnerHTML = WPTB_Helper.replaceAll( cssForActiveElementInnerHTML, activeElemClass, infArrCopyEl[0] );\r\n cssForNewElement.innerHTML = cssForNewElementInnerHTML;\r\n head.appendChild( cssForNewElement );\r\n }\r\n }\r\n }\r\n }\r\n }\r\n },\r\n // function for convertation elements stiles in json\r\n elementsStylesConvertToObject: function() {\r\n let head = document.head;\r\n let stylesElements = head.querySelectorAll( '.styles-wptb-elements' );\r\n let stylesObj = {};\r\n for( let i = 0; i < stylesElements.length; i++ ) {\r\n let styleElemId = stylesElements[i].getAttribute( 'id' );\r\n if( styleElemId && stylesElements[i].innerHTML ) {\r\n stylesObj[styleElemId] = stylesElements[i].innerHTML;\r\n }\r\n }\r\n\r\n if( Object.keys( stylesObj ).length != 0 ) {\r\n return JSON.stringify( stylesObj );\r\n }\r\n return '';\r\n },\r\n // function for set scc styles tags to head\r\n elementsStylesSetFromObject: function( jsonObject ) {\r\n let head = document.head;\r\n if( head ) {\r\n let stylesElements = head.querySelectorAll( '.styles-wptb-elements' );\r\n if( stylesElements.length > 0 ) {\r\n stylesElements = [...stylesElements];\r\n for( let i = 0; i < stylesElements.length; i++ ) {\r\n head.removeChild( stylesElements[i] );\r\n }\r\n }\r\n if( jsonObject ) {\r\n let stylesObj = JSON.parse( jsonObject );\r\n if( Object.keys( stylesObj ).length != 0 ) {\r\n Object.keys( stylesObj ).forEach( function( key ) {\r\n let cssText = stylesObj[key];\r\n let styleCss = document.createElement( 'style' );\r\n styleCss.setAttribute( 'id', key );\r\n styleCss.classList.add( 'styles-wptb-elements' );\r\n styleCss.innerHTML = cssText;\r\n head.appendChild( styleCss );\r\n });\r\n }\r\n }\r\n }\r\n },\r\n // function for table saving\r\n saveTable: function( event, startSaving, previewSaving ) {\r\n if( ! previewSaving && ! startSaving ) {\r\n if( ( ! event.target.dataset.wptbTableStateNumberSave && window.wptbTableStateNumberShow == 0 ) ||\r\n window.wptbTableStateNumberShow == event.target.dataset.wptbTableStateNumberSave ) {\r\n //return;\r\n }\r\n }\r\n\r\n if( ! previewSaving ) {\r\n let bar = document.querySelector( '.wptb-edit-bar' );\r\n if ( bar && bar.classList.contains( 'visible' ) ) {\r\n let table = document.getElementsByClassName( 'wptb-preview-table' )[0];\r\n WPTB_Helper.toggleTableEditMode();\r\n }\r\n }\r\n\r\n // before save event trigger\r\n WPTB_Helper.wptbDocumentEventGenerate('wptb:save:before', document);\r\n\r\n let http = new XMLHttpRequest(),\r\n url = ( wptb_admin_object ? wptb_admin_object.ajaxurl : ajaxurl ) + \"?action=save_table\",\r\n t = document.getElementById( 'wptb-setup-name' ).value.trim(),\r\n messagingArea,\r\n code,\r\n datas;\r\n\r\n code = document.getElementsByClassName( 'wptb-preview-table' );\r\n\r\n let postId;\r\n if (( rs = WPTB_Helper.detectMode() ) || ( rs = document.wptbId )) {\r\n postId = rs;\r\n }\r\n let paramIdsNecessaryChange = false;\r\n if( code.length > 0 ) {\r\n code = code[0];\r\n let codeClone = code.cloneNode( true );\r\n if( postId ) {\r\n if( codeClone.classList.contains( 'wptb-element-main-table_setting-startedid-0' ) ) {\r\n codeClone.classList.remove( 'wptb-element-main-table_setting-startedid-0' );\r\n codeClone.classList.add( 'wptb-element-main-table_setting-' + postId );\r\n let wptbTableSetup = document.querySelector('.wptb-table-setup');\r\n if(wptbTableSetup) {\r\n wptbTableSetup.innerHTML = '';\r\n wptbTableSetup.appendChild(codeClone);\r\n WPTB_Table();\r\n }\r\n paramIdsNecessaryChange = true;\r\n }\r\n }\r\n codeClone.columns = code.columns;\r\n code = WPTB_Stringifier( codeClone );\r\n code = code.outerHTML;\r\n } else {\r\n code = '';\r\n }\r\n\r\n if( ! previewSaving ) {\r\n datas = '';\r\n let datas_containers = document.getElementsByClassName( 'wptb-element-datas' );\r\n\r\n if( datas_containers.length > 0 ) {\r\n if( datas_containers[0].innerHTML ) {\r\n datas = datas_containers[0].innerHTML;\r\n\r\n if( paramIdsNecessaryChange ) {\r\n datas = WPTB_Helper.replaceAll( datas, 'tmpl-wptb-el-datas-main-table_setting-startedid-0',\r\n 'tmpl-wptb-el-datas-main-table_setting-' + postId );\r\n\r\n datas = WPTB_Helper.replaceAll( datas, 'data-wptb-el-main-table_setting-startedid-0',\r\n 'data-wptb-el-main-table_setting-' + postId );\r\n }\r\n }\r\n }\r\n }\r\n\r\n let styleObjJson = WPTB_Helper.elementsStylesConvertToObject();\r\n if( paramIdsNecessaryChange ) {\r\n styleObjJson = WPTB_Helper.replaceAll( styleObjJson, '.wptb-element-main-table_setting-startedid-0',\r\n '.wptb-element-main-table_setting-' + postId );\r\n }\r\n\r\n if ( t === '' && code === '' ) {\r\n let messagingAreaText = '';\r\n if( t === '' ) messagingAreaText += 'You must assign a name to the table before saving it.</br>';\r\n if( code === '' ) messagingAreaText += 'Table wasn\\'t created';\r\n messagingArea = document.getElementById( 'wptb-messaging-area' );\r\n messagingArea.innerHTML = '<div class=\"wptb-error wptb-message\">Error: ' + messagingAreaText + '</div>';\r\n messagingArea.classList.add( 'wptb-warning' );\r\n setTimeout(function () {\r\n messagingArea.removeChild( messagingArea.firstChild );\r\n }, 4000 );\r\n return;\r\n }\r\n\r\n let params = {\r\n title: t,\r\n content: code,\r\n elements_datas: datas,\r\n elements_styles: styleObjJson,\r\n security_code: wptb_admin_object.security_code\r\n };\r\n\r\n\r\n if( previewSaving ) {\r\n params.preview_saving = previewSaving;\r\n }\r\n\r\n if ( postId ) {\r\n params.id = postId;\r\n }\r\n\r\n // wptb save before event\r\n WPTB_Helper.wptbDocumentEventGenerate('wptb:save:before', document, params);\r\n\r\n params = JSON.stringify( params );\r\n\r\n http.open('POST', url, true);\r\n http.setRequestHeader( 'Content-type', 'application/json; charset=utf-8' );\r\n\r\n http.onreadystatechange = function ( action ) {\r\n if ( this.readyState == 4 && this.status == 200 ) {\r\n var data = JSON.parse( http.responseText );\r\n messagingArea = document.getElementById( 'wptb-messaging-area' );\r\n\r\n if ( data[0] == 'saved' ) {\r\n let builderPageUrl = document.location.href.replace( '#', '' );\r\n let regex = new RegExp( '&table=(.+)', \"i\" );\r\n builderPageUrl = builderPageUrl.replace( regex, '' );\r\n window.history.pushState( null, null, builderPageUrl + '&table=' + data[1] );\r\n\r\n document.wptbId = data[1];\r\n messagingArea.innerHTML = '<div class=\"wptb-success wptb-message\">Table \"' + t + '\" was successfully saved.</div>';\r\n document.getElementsByClassName( 'wptb-embed-btn' )[0].classList.remove( 'wptb-button-disable' );\r\n document.getElementById( 'wptb-embed-shortcode' ).value = '[wptb id=' + data[1] + ']';\r\n let wptbPreviewTable = document.querySelector( '.wptb-preview-table' );\r\n let wptbPreviewBtn = document.getElementsByClassName( 'wptb-preview-btn' );\r\n if( wptbPreviewBtn.length > 0 ) {\r\n wptbPreviewBtn = wptbPreviewBtn[0];\r\n wptbPreviewBtn.classList.remove( 'wptb-button-disable' );\r\n let wptbPreviewBtnHref = wptbPreviewBtn.dataset.previewHref;\r\n wptbPreviewBtnHref = wptbPreviewBtnHref.replace( 'empty', data[1] );\r\n wptbPreviewBtn.setAttribute( 'href', wptbPreviewBtnHref );\r\n }\r\n\r\n event.target.dataset.wptbTableStateNumberSave = window.wptbTableStateNumberShow;\r\n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\r\n if( wptbSaveBtn.length > 0 ) {\r\n wptbSaveBtn = wptbSaveBtn[0];\r\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\r\n wptbSaveBtn.classList.remove('active');\r\n }\r\n // WPTB_Helper.saveTable( event, true );\r\n return;\r\n } else if( data[0] == 'edited' && startSaving ) {\r\n document.wptbId = data[1];\r\n messagingArea.innerHTML = '<div class=\"wptb-success wptb-message\">Table \"' + t + '\" was successfully saved.</div>';\r\n document.getElementsByClassName( 'wptb-embed-btn' )[0].classList.remove( 'wptb-button-disable' );\r\n document.getElementById( 'wptb-embed-shortcode' ).value = '[wptb id=' + data[1] + ']';\r\n let wptbPreviewTable = document.querySelector( '.wptb-preview-table' );\r\n let wptbPreviewBtn = document.getElementsByClassName( 'wptb-preview-btn' );\r\n if( wptbPreviewBtn.length > 0 ) {\r\n wptbPreviewBtn = wptbPreviewBtn[0];\r\n wptbPreviewBtn.classList.remove( 'wptb-button-disable' );\r\n let wptbPreviewBtnHref = wptbPreviewBtn.dataset.previewHref;\r\n wptbPreviewBtnHref = wptbPreviewBtnHref.replace( 'empty', data[1] );\r\n wptbPreviewBtn.setAttribute( 'href', wptbPreviewBtnHref );\r\n }\r\n\r\n event.target.dataset.wptbTableStateNumberSave = window.wptbTableStateNumberShow;\r\n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\r\n if( wptbSaveBtn.length > 0 ) {\r\n wptbSaveBtn = wptbSaveBtn[0];\r\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\r\n wptbSaveBtn.classList.remove('active');\r\n }\r\n } else if( data[0] == 'edited' ) {\r\n messagingArea.innerHTML = '<div class=\"wptb-success wptb-message\">Table \"' + t + '\" was successfully updated.</div>';\r\n event.target.dataset.wptbTableStateNumberSave = window.wptbTableStateNumberShow;\r\n\r\n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\r\n if( wptbSaveBtn.length > 0 ) {\r\n wptbSaveBtn = wptbSaveBtn[0];\r\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\r\n wptbSaveBtn.classList.remove('active');\r\n }\r\n } else if( data[0] == 'preview_edited' ) {\r\n return;\r\n } else {\r\n messagingArea.innerHTML = '<div class=\"wptb-error wptb-message\">Safety problems</div>';\r\n }\r\n messagingArea.classList.add( 'wptb-success' );\r\n setTimeout( function () {\r\n messagingArea.removeChild( messagingArea.firstChild );\r\n }, 4000 );\r\n }\r\n }\r\n http.send( params );\r\n },\r\n //\r\n clickOnFreeSpace: function() {\r\n // if current active section is responsive menu, ignore this functionality\r\n if(this.getCurrentSection() === 'table_responsive_menu'){\r\n return;\r\n }\r\n\r\n let cellModeBackground = document.querySelector( '#wptb-cell_mode_background' );\r\n if( cellModeBackground && cellModeBackground.classList.contains( 'visible' ) ) {\r\n return;\r\n }\r\n // document.getElementsByClassName( 'wptb-elements-container' )[0].style.display = 'table';\r\n // document.getElementsByClassName( 'wptb-settings-section' )[0].style.display = 'block';\r\n // document.getElementById( 'element-options-group' ).style.display = 'none';\r\n this.activateSection('elements');\r\n\r\n let wpcdFixedToolbar = document.getElementById( 'wpcd_fixed_toolbar' );\r\n if( wpcdFixedToolbar.hasAttribute( 'data-toolbar-active-id' ) ) {\r\n document.getElementById( wpcdFixedToolbar.getAttribute( 'data-toolbar-active-id' ) ).classList.remove( 'toolbar-active' );\r\n }\r\n let element = document.querySelector( '.wptb-preview-table' );\r\n if( element ) {\r\n WPTB_Helper.elementOptionsSet( 'table_setting', element );\r\n }\r\n },\r\n\r\n /*\r\n * function for sending of element ajax request\r\n */\r\n elementAjax: function( dataAjaxData, element ) {\r\n let http = new XMLHttpRequest(),\r\n url = ( wptb_admin_object ? wptb_admin_object.ajaxurl : ajaxurl ) + \"?action=wptb_element_ajax\";\r\n let element_name;\r\n let infArr = element.className.match( /wptb-element-(.+)-(\\d+)/i );\r\n if( infArr && Array.isArray( infArr ) ) {\r\n element_name = infArr[1];\r\n }\r\n\r\n let params = {\r\n element_ajax_data: dataAjaxData,\r\n element_name: element_name,\r\n security_code: wptb_admin_object.security_code\r\n };\r\n params = JSON.stringify( params );\r\n\r\n http.open( 'POST', url, true );\r\n http.setRequestHeader( 'Content-type', 'application/json; charset=utf-8' );\r\n\r\n http.onreadystatechange = function ( action ) {\r\n if ( this.readyState == 4 && this.status == 200 ) {\r\n var data = JSON.parse( http.responseText );\r\n let detail;\r\n if ( data && Array.isArray( data ) && data[0] == 'element_ajax_responce' ) {\r\n detail = {value: data[1]};\r\n } else {\r\n detail = '';\r\n }\r\n WPTB_Helper.wptbDocumentEventGenerate( 'wptb-element:ajax-response', element, detail );\r\n }\r\n }\r\n http.send( params );\r\n },\r\n\r\n /*\r\n * This just toggles visibility of cell edit bar, and toggles\r\n * cell selecting mode.\r\n */\r\n toggleTableEditMode: function ( close = false ) {\r\n let bar = document.getElementsByClassName('wptb-edit-bar'),\r\n cellModeBackground = document.getElementById('wptb-cell_mode_background'),\r\n leftScrollPanelCurtain = document.getElementById('wptb-left-scroll-panel-curtain'),\r\n leftScrollPanelCellSettings = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ),\r\n wptbPreviewTable = document.getElementsByClassName('wptb-preview-table');\r\n if (wptbPreviewTable.length > 0) {\r\n wptbPreviewTable = wptbPreviewTable[0];\r\n }\r\n\r\n if ( bar.length > 0 ) {\r\n let toggleEditMode = '';\r\n for ( let i = 0; i < bar.length; i++ ) {\r\n if ( bar[i].classList.contains( 'visible' ) ) {\r\n document.select.deactivateMultipleSelectMode();\r\n bar[i].classList.remove( 'visible' );\r\n cellModeBackground.classList.remove( 'visible' );\r\n leftScrollPanelCurtain.classList.remove( 'visible' );\r\n leftScrollPanelCellSettings.classList.remove( 'visible' );\r\n wptbPreviewTable.parentNode.classList.remove( 'wptb-preview-table-manage-cells' );\r\n let wptbPreviewTableTds = wptbPreviewTable.getElementsByTagName( 'td' );\r\n if ( wptbPreviewTableTds.length > 0 ) {\r\n for ( let i = 0; i < wptbPreviewTableTds.length; i++ ) {\r\n wptbPreviewTableTds[i].classList.remove( 'wptb-highlighted' );\r\n }\r\n }\r\n toggleEditMode = 'closed';\r\n WPTB_Helper.activateSection('elements')\r\n\r\n } else if( ! close ) {\r\n document.select.activateMultipleSelectMode();\r\n bar[i].classList.add( 'visible' );\r\n cellModeBackground.classList.add( 'visible' );\r\n leftScrollPanelCurtain.classList.add( 'visible' );\r\n wptbPreviewTable.parentNode.classList.add( 'wptb-preview-table-manage-cells' );\r\n\r\n toggleEditMode = 'opened';\r\n }\r\n }\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-edit-mode/' + toggleEditMode, wptbPreviewTable)\r\n }\r\n },\r\n\r\n /*\r\n * checking of dimension of value\r\n */\r\n checkingDimensionValue: function ( value, dimension ) {\r\n value = String( value );\r\n dimension = String( dimension );\r\n if( value && dimension ) {\r\n let searchIndex = value.indexOf( dimension );\r\n if ( searchIndex != -1 && searchIndex == ( value.length - dimension.length ) ) {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n } else {\r\n return false;\r\n }\r\n },\r\n\r\n /*\r\n * if dimension is included - checking and if it necessary setting value\r\n * without dimension - return value\r\n */\r\n checkSetGetStyleSizeValue: function( element, styleName, computedStyleName, dimension ) {\r\n let elemStyleValue = element.style[styleName];\r\n elemStyleValue = String( elemStyleValue );\r\n\r\n if( ! elemStyleValue || dimension ? ! ( WPTB_Helper.checkingDimensionValue( elemStyleValue, dimension ) ) : false ){\r\n let elementStyles = window.getComputedStyle( element );\r\n if( computedStyleName && elementStyles.getPropertyValue( computedStyleName ) && dimension ? WPTB_Helper.checkingDimensionValue( elementStyles.getPropertyValue( computedStyleName ), dimension ) : true ) {\r\n if( ! dimension ) {\r\n return elementStyles.getPropertyValue( computedStyleName );\r\n } else {\r\n element.style[styleName] = elementStyles.getPropertyValue( computedStyleName );\r\n }\r\n } else {\r\n if( ! dimension ) {\r\n return false;\r\n } else {\r\n element.style[styleName] = null;\r\n }\r\n }\r\n } else if( ! dimension ) {\r\n return elemStyleValue;\r\n }\r\n\r\n return element.style[styleName];\r\n },\r\n\r\n /*\r\n * function checking that element has the style\r\n * if this style is present - checking the format color\r\n * if param set is true - setting style for element (consider hex format of color)\r\n * if param set is false - getting style from element\r\n */\r\n checkSetGetStyleColorValue: function ( element, styleName, computedStyleName, set = false ) {\r\n let elemStyleColorValue = element.style[styleName];\r\n\r\n if( ! elemStyleColorValue ) {\r\n let elementStyles = window.getComputedStyle( element, null );\r\n\r\n if( elementStyles && elementStyles.getPropertyValue( computedStyleName ) ) {\r\n\r\n if( set ) {\r\n elemStyleColorValue = WPTB_Helper.rgbToHex( elementStyles.getPropertyValue( computedStyleName ) );\r\n if( WPTB_Helper.isHex( elemStyleColorValue ) ) {\r\n element.style[styleName] = elemStyleColorValue;\r\n } else {\r\n element.style[styleName] = '';\r\n }\r\n } else {\r\n return elementStyles.getPropertyValue( computedStyleName );\r\n }\r\n\r\n } else {\r\n if( set ) {\r\n element.style[styleName] = '';\r\n } else {\r\n return '';\r\n }\r\n }\r\n } else if( ! set ) {\r\n return elemStyleColorValue;\r\n }\r\n },\r\n\r\n /*\r\n * function checking that element has the style\r\n * if this style is present - checking the format color\r\n * if param set is true - setting style for element (consider hex format of color)\r\n * if param set is false - getting style from element\r\n */\r\n checkSetGetStyleValue: function ( element, styleName, computedStyleName, set = false ) {\r\n let elemStyleColorValue = element.style[styleName];\r\n\r\n if( ! elemStyleColorValue ) {\r\n let elementStyles = window.getComputedStyle( element, null );\r\n\r\n if( elementStyles && elementStyles.getPropertyValue( computedStyleName ) ) {\r\n\r\n if( set ) {\r\n element.style[styleName] = elementStyles.getPropertyValue( computedStyleName );\r\n } else {\r\n return elementStyles.getPropertyValue( computedStyleName );\r\n }\r\n\r\n } else if( ! set ) {\r\n return '';\r\n }\r\n } else if( ! set ) {\r\n return elemStyleColorValue;\r\n }\r\n },\r\n\r\n /*\r\n * get the value of the same elements that have the most count\r\n */\r\n getValueMaxCountSameElementsInArray: function ( arr ) {\r\n if( arr && Array.isArray( arr ) ) {\r\n let check = {};\r\n let countEmpty = 0;\r\n for( let i = 0; i < arr.length; i++ ) {\r\n if(arr[i]) {\r\n if( check[arr[i]] ) {\r\n check[arr[i]]++;\r\n } else {\r\n check[arr[i]] = 1;\r\n }\r\n } else {\r\n countEmpty++;\r\n }\r\n }\r\n\r\n let maxPropName;\r\n for ( let key in check ) {\r\n if( ! maxPropName ) {\r\n maxPropName = key;\r\n continue;\r\n } else {\r\n if( check[maxPropName] < check[key] ) {\r\n maxPropName = key;\r\n }\r\n }\r\n }\r\n\r\n return check[maxPropName] >= countEmpty ? maxPropName : '';\r\n }\r\n },\r\n\r\n /*\r\n * For assigning to each cell xIndex and y Index attributes,\r\n * these are the column number and row number of cell in table.\r\n */\r\n recalculateIndexes: function ( table ) {\r\n WPTB_RecalculateIndexes(table);\r\n },\r\n\r\n /**\r\n * Table Rows colors reinstall\r\n */\r\n tableRowsColorsReinstall: function ( table ) {\r\n let infArr = table.className.match( /wptb-element-main(.+)-(\\d+)/i );\r\n if( infArr && Array.isArray( infArr ) ) {\r\n let tableIndex = '';\r\n if( infArr[infArr.length -1] == '0' ) {\r\n tableIndex = 'startedid-0';\r\n } else {\r\n tableIndex = infArr[infArr.length -1];\r\n }\r\n\r\n let tableHeaderBackground = document.querySelector('.wptb-el-main-table_setting-' + tableIndex + '-tableHeaderBackground' );\r\n if( tableHeaderBackground ) {\r\n let details = {value: tableHeaderBackground.value};\r\n WPTB_Helper.wptbDocumentEventGenerate( 'controlColor:change', tableHeaderBackground, details );\r\n }\r\n\r\n let tableEvenRowBackground = document.querySelector('.wptb-el-main-table_setting-' + tableIndex + '-tableEvenRowBackground' );\r\n if( tableEvenRowBackground ) {\r\n let details = {value: tableEvenRowBackground.value};\r\n WPTB_Helper.wptbDocumentEventGenerate( 'controlColor:change', tableEvenRowBackground, details );\r\n }\r\n\r\n let tableOddRowBackground = document.querySelector('.wptb-el-main-table_setting-' + tableIndex + '-tableOddRowBackground' );\r\n if( tableOddRowBackground ) {\r\n let details = {value: tableOddRowBackground.value};\r\n WPTB_Helper.wptbDocumentEventGenerate( 'controlColor:change', tableOddRowBackground, details );\r\n }\r\n }\r\n },\r\n /**\r\n * Get parent html element of given type\r\n *\r\n * @param {string} parentType type of parent element\r\n * @param {HTMLElement} el current element\r\n * @returns {*} html element of type\r\n */\r\n getParentOfType: (parentType, el) => {\r\n if(el.nodeName === parentType.toUpperCase()) {\r\n return el;\r\n }\r\n\r\n return WPTB_Helper.getParentOfType(parentType , el.parentElement);\r\n },\r\n // current relative type of drag element\r\n // this type is used on differentiating certain elements based on their positioning on table\r\n dragRelativeType : '',\r\n /**\r\n *\r\n * @param {string} val drag relative type\r\n */\r\n setDragRelativeType: function (val){\r\n this.dragRelativeType = val;\r\n },\r\n // get drag relative type\r\n getDragRelativeType : function(){\r\n return this.dragRelativeType;\r\n },\r\n /**\r\n *\r\n * @param {HTMLElement} element\r\n * @param {string} styleName\r\n */\r\n getElementColorStylesHex: function (element, styleName) {\r\n let color = element.style[styleName];\r\n color = WPTB_Helper.rgbToHex( color );\r\n if( ! WPTB_Helper.isHex( color ) ) {\r\n color = '';\r\n }\r\n return color;\r\n },\r\n /**\r\n * Show element controls on adding them to table.\r\n */\r\n showControlsOnElementMount(){\r\n document.addEventListener('element:mounted:dom', function(e){\r\n e.target.click();\r\n });\r\n },\r\n /**\r\n * Show elements list menu on left panel on removing element from table\r\n */\r\n showElementsListOnRemove(){\r\n document.addEventListener('element:removed:dom', function(){\r\n WPTB_Helper.activateSection('elements');\r\n })\r\n },\r\n blockTinyMCEManageCells: function (){\r\n const addBlocker = (parent) => {\r\n const blockerElement = document.createElement('div');\r\n blockerElement.classList.add('wptb-plugin-blocker-element');\r\n parent.appendChild(blockerElement);\r\n }\r\n\r\n const removeBlocker = (parent) => {\r\n const blockerElement = parent.querySelector('.wptb-plugin-blocker-element');\r\n if(blockerElement){\r\n blockerElement.remove();\r\n }\r\n }\r\n document.addEventListener('wptbSectionChanged' , ({detail}) => {\r\n const table = document.querySelector('.wptb-table-setup table.wptb-preview-table');\r\n const cells = Array.from(table.querySelectorAll('td'));\r\n\r\n cells.map(removeBlocker);\r\n\r\n if(detail === 'manage_cells' || detail === 'cell_settings'){\r\n cells.map(addBlocker);\r\n }\r\n })\r\n\r\n document.addEventListener('wptb:save:before' , () => {\r\n const table = document.querySelector('.wptb-table-setup table.wptb-preview-table');\r\n const cells = Array.from(table.querySelectorAll('td'));\r\n\r\n cells.map(removeBlocker);\r\n })\r\n }\r\n}\r\n","var WPTB_Initializer = function () {\r\n\r\n const MIN_COLUMNS = 1,\r\n MIN_ROWS = 1,\r\n MAX_COLUMNS = 30,\r\n MAX_ROWS = 30;\r\n\r\n var tableGenerator = document.body;\r\n columnsDecrementButton = tableGenerator.getElementsByClassName('wptb-input-number-decrement')[0],\r\n columnsIncrementButton = tableGenerator.getElementsByClassName('wptb-input-number-increment')[0],\r\n rowsDecrementButton = tableGenerator.getElementsByClassName('wptb-input-number-decrement')[1],\r\n rowsIncrementButton = tableGenerator.getElementsByClassName('wptb-input-number-increment')[1],\r\n columnsInput = document.getElementById('wptb-columns-number'),\r\n rowsInput = document.getElementById('wptb-rows-number');\r\n \r\n // columnsDecrementButton.onclick = function () {\r\n // if (columnsInput.value > MIN_COLUMNS) {\r\n // columnsInput.value--;\r\n // }\r\n // };\r\n //\r\n // columnsIncrementButton.onclick = function () {\r\n // if (columnsInput.value < MAX_COLUMNS) {\r\n // columnsInput.value++;\r\n // }\r\n // };\r\n //\r\n // rowsDecrementButton.onclick = function () {\r\n // if (rowsInput.value > MIN_ROWS) {\r\n // rowsInput.value--;\r\n // }\r\n // };\r\n //\r\n // rowsIncrementButton.onclick = function () {\r\n // if (rowsInput.value < MAX_ROWS) {\r\n // rowsInput.value++;\r\n // }\r\n // };\r\n\r\n // document.getElementById( 'wptb-generate-table' ).onclick = function ( ) {\r\n // var columns = document.getElementById('wptb-columns-number').value,\r\n // rows = document.getElementById('wptb-rows-number').value;\r\n //\r\n // //wptbTableStateSaveManager.tableStateClear();\r\n //\r\n // WPTB_Table(columns, rows);\r\n //\r\n // let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n // wptbTableStateSaveManager.tableStateSet();\r\n // }\r\n\r\n // register and setup section buttons\r\n WPTB_Helper.registerSections(['elements', 'table_settings', 'cell_settings', 'options_group' , 'table_responsive_menu', 'manage_cells']);\r\n WPTB_Helper.setupSectionButtons();\r\n\r\n // activate elements section for startup\r\n WPTB_Helper.activateSection('elements');\r\n\r\n // side bar toggle setup\r\n WPTB_Helper.setupSidebarToggle('.wptb-panel-toggle-section .wptb-panel-drawer-icon');\r\n\r\n // setup panel sections that have the ability to be toggled on/off\r\n WPTB_Helper.setupPanelToggleButtons();\r\n\r\n // setup responsive menu both at left and builder panel\r\n new WptbResponsive('table_responsive_menu', 'wptbResponsiveApp', '.wptb-builder-content');\r\n\r\n // get builder section from url parameter for easy switch at page load\r\n WPTB_Helper.getSectionFromUrl();\r\n\r\n // automatically show element controls when dropped to table\r\n WPTB_Helper.showControlsOnElementMount();\r\n\r\n // show elements list menu on left panel on removing elements from table\r\n WPTB_Helper.showElementsListOnRemove();\r\n\r\n // block tinyMCE from activation at manage cells menu\r\n WPTB_Helper.blockTinyMCEManageCells();\r\n // initialize header toolbox\r\n new WPTB_HeaderToolbox('.wptb-plugin-header-toolbar').init();\r\n\r\n // redirect active menu to elements after closing manage cells menu\r\n document.addEventListener('wp-table-builder/table-edit-mode/closed', () => {\r\n WPTB_Helper.activateSection('elements');\r\n })\r\n};\r\n","var WPTB_innerElementSet = function ( element ) {\r\n \r\n element.ondragenter = function (e) {\r\n var div;\r\n if ( e.dataTransfer.types.indexOf( 'wptbelement' ) == -1 && e.dataTransfer.types.indexOf( 'wptb-moving-mode' ) == -1 ) {\r\n return;\r\n }\r\n WPTB_DropHandle(this, e);\r\n \r\n element.classList.add( 'wptb-ondragenter' );\r\n }\r\n element.ondragover = function (e) {\r\n e.preventDefault();\r\n WPTB_DropHandle(this, e);\r\n }\r\n element.ondragleave = function (e) {\r\n WPTB_DropHandle(this, e, true);\r\n\r\n }\r\n element.ondrop = function(e) {\r\n this.classList.remove( 'wptb-ondragenter' );\r\n let element, classId;\r\n e.preventDefault();\r\n e.stopPropagation();\r\n\r\n if (!e.dataTransfer.getData('wptbElement') && !e.dataTransfer.getData('node')) {\r\n return;\r\n }\r\n let wptbDropHandle,\r\n wptbDropBorderMarker;\r\n if ( document.getElementsByClassName( 'wptb-drop-handle' ).length > 0 ) {\r\n wptbDropHandle = document.getElementsByClassName( 'wptb-drop-handle' )[0];\r\n }\r\n if( document.getElementsByClassName( 'wptb-drop-border-marker' ).length > 0 ) {\r\n wptbDropBorderMarker = document.getElementsByClassName( 'wptb-drop-border-marker' )[0];\r\n }\r\n\r\n if ( e.dataTransfer.getData( 'wptbElement' ) ) {\r\n element = WPTB_Helper.newElementProxy( e.dataTransfer.getData( 'wptbElement' ) );\r\n element = element.getDOMElement();\r\n } else {\r\n classId = e.dataTransfer.getData( 'node' );\r\n element = document.getElementsByClassName( classId )[0];\r\n //element.classList.remove( 'wptb-moving-mode' );\r\n }\r\n\r\n if(WPTB_Helper.getDragRelativeType() === 'td_relative'){\r\n WPTB_DropHandle(this, e, true);\r\n const parentCell = WPTB_Helper.getParentOfType('td', e.target);\r\n\r\n parentCell.appendChild(element);\r\n WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);\r\n\r\n }else if( wptbDropHandle.style.display == 'block' ) {\r\n let td;\r\n if( wptbDropHandle.dataset.text == 'Drop Here' ) {\r\n td = wptbDropHandle.getDOMParentElement();\r\n td.appendChild( element );\r\n WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);\r\n } else {\r\n let innerElement = wptbDropHandle.getDOMParentElement();\r\n td = innerElement.parentNode;\r\n\r\n if( wptbDropHandle.dataset.text == 'Above Element' ) {\r\n td.insertBefore( element, innerElement );\r\n WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);\r\n } else if( wptbDropHandle.dataset.text == 'Below Element' ) {\r\n let innerElementNext = innerElement.nextSibling;\r\n td.insertBefore( element, innerElementNext );\r\n WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);\r\n }\r\n }\r\n \r\n let thisRow = td.parentNode;\r\n if( WPTB_Helper.rowIsTop( thisRow ) ) { \r\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\r\n \r\n if( table.classList.contains( 'wptb-table-preview-head' ) ) {\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n }\r\n \r\n // start item javascript if item is new\r\n let infArr = element.className.match(/wptb-element-(.+)-(\\d+)/i);\r\n let elemKind = infArr[1];\r\n if ( e.dataTransfer.getData( 'wptbElement' ) && ( elemKind == 'text' || elemKind == 'button' || elemKind == 'image' || elemKind == 'star_rating' || elemKind == 'list' ) ) {\r\n //WPTB_Helper.elementStartScript( element );\r\n }\r\n } else {\r\n return;\r\n }\r\n\r\n if(wptbDropHandle){\r\n wptbDropHandle.style.display = 'none';\r\n wptbDropBorderMarker.style.display = 'none';\r\n }\r\n\r\n WPTB_innerElementSet( element );\r\n \r\n if( ! element.classList.contains( 'wptb-image-container' ) || element.classList.contains( 'wptb-moving-mode' ) ) {\r\n element.classList.remove( 'wptb-moving-mode' );\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n } \r\n return true;\r\n }\r\n element.onmouseover = function(e) {\r\n element.classList.remove( 'wptb-ondragenter' );\r\n }\r\n}","var WPTB_LeftPanel = function () {\r\n\r\n let table = document.getElementsByClassName('wptb-preview-table')[0],\r\n wptbElementButtons = document.getElementsByClassName('wptb-element');\r\n\r\n for (var i = 0; i < wptbElementButtons.length; i++) {\r\n wptbElementButtons[i].ondragstart = function (e) {\r\n e.dataTransfer.setData('wptbElement', this.dataset.wptbElement);\r\n e.dataTransfer.setData( 'wptbElIndic-' + this.dataset.wptbElement, 'wptbElIndic-' + this.dataset.wptbElement );\r\n }\r\n };\r\n \r\n if( table ) {\r\n let wptbTablesEditModeCloseButton = document.getElementsByClassName( 'wptb-table-edit-mode-close' );\r\n for ( let i = 0; i < wptbTablesEditModeCloseButton.length; i++ ) {\r\n wptbTablesEditModeCloseButton[i].onclick = WPTB_Helper.toggleTableEditMode;\r\n }\r\n };\r\n\r\n // this code hides the \"element parameters\" area\r\n // when clicked outside this element and its \"tinymce\" toolbar \r\n let wptbBuilderPanel = document.getElementsByClassName( 'wptb-builder-panel' )[0];\r\n wptbBuilderPanel.onclick = function( e ) {\r\n if( ! e.target.classList.contains( 'wptb-ph-element' ) && ! WPTB_Helper.findAncestor( e.target, 'wptb-ph-element' ) && \r\n ! e.target.classList.contains( 'wptb-fixed-toolbar' ) && ! WPTB_Helper.findAncestor( e.target, 'wptb-fixed-toolbar' ) ) {\r\n WPTB_Helper.clickOnFreeSpace();\r\n } \r\n };\r\n \r\n let wptbHeader = document.getElementsByClassName( 'wptb-header' );\r\n if( wptbHeader.length > 0 ) wptbHeader = wptbHeader[0];\r\n wptbHeader.onclick = function() {\r\n WPTB_Helper.clickOnFreeSpace();\r\n };\r\n};","var MultipleSelect = function () {\r\n\r\n\tvar selectedCells = [],\r\n\t\tmultipleCellMode = false;\r\n\r\n\tthis.activateMultipleSelectMode = function () {\r\n\t\tselectedCells = [];\r\n\t\tvar tds = document.getElementsByClassName('wptb-preview-table')[0].getElementsByTagName('td');\r\n\t\tfor (var i = 0; i < tds.length; i++) {\r\n\t\t\ttds[i].classList.remove('wptb-highlighted');\r\n\t\t}\r\n\t\tmultipleCellMode = true;\r\n\t}\r\n\r\n\tthis.deactivateMultipleSelectMode = function () {\r\n\t\tmultipleCellMode = false;\r\n\t}\r\n\r\n\tthis.isActivated = function () {\r\n\t\treturn multipleCellMode;\r\n\t}\r\n\r\n\tthis.pushSelectedCell = function (cell) {\r\n\t\tif (!multipleCellMode) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tselectedCells.push(cell);\r\n\t\tcell.classList.add('wptb-highlighted');\r\n\t};\r\n\r\n\tthis.selectedCells = function () {\r\n\t\treturn selectedCells;\r\n\t}\r\n\r\n\tthis.flushSelectedCells = function () {\r\n\t\tselectedCells = [];\r\n\t}\r\n\r\n\tthis.getFirst = function () {\r\n\t\tvar minXIndex = 1000, minYIndex = 1000, first;\r\n\t\tfor (var i = selectedCells.length - 1; i >= 0; i--) {\r\n\t\t\tif (minXIndex >= selectedCells[i].dataset.xIndex\r\n\t\t\t\t&& minYIndex >= selectedCells[i].dataset.yIndex) {\r\n\t\t\t\tfirst = selectedCells[i];\r\n\t\t\t\tminXIndex = selectedCells[i].dataset.xIndex;\r\n\t\t\t\tminYIndex = selectedCells[i].dataset.yIndex;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn first;\r\n\t}\r\n\r\n\tthis.getLast = function () {\r\n\t\tvar maxXIndex = -1, maxYIndex = -1, last;\r\n\t\tfor (var i = selectedCells.length - 1; i >= 0; i--) {\r\n\t\t\tif (maxXIndex <= selectedCells[i].dataset.xIndex\r\n\t\t\t\t&& maxYIndex <= selectedCells[i].dataset.yIndex) {\r\n\t\t\t\tlast = selectedCells[i];\r\n\t\t\t\tmaxXIndex = selectedCells[i].dataset.xIndex;\r\n\t\t\t\tmaxYIndex = selectedCells[i].dataset.yIndex;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn last;\r\n\t}\r\n\r\n\tthis.removeAllButFirst = function () {\r\n\t\tvar td = this.getFirst();\r\n\t\tfor (var i = 1; i < selectedCells.length; i++) {\r\n\t\t\tselectedCells[i].classList.add('wptb-fused-cell-' + td.dataset.xIndex + '-' + td.dataset.yIndex);\r\n\t\t}\r\n\t}\r\n\r\n\treturn this;\r\n\r\n};","var WPTB_Parser = function ( code ) {\r\n let div = document.createElement( 'div' );\r\n div.innerHTML = code;\r\n \r\n let table = div.children[0];\r\n let columnTitleMobile = [...table.querySelectorAll( '.wptb-column-title-mobile-container' )];\r\n \r\n for( let i = 0; i < columnTitleMobile.length; i++ ) {\r\n let parent = columnTitleMobile[i].parentNode;\r\n parent.removeChild( columnTitleMobile[i] );\r\n }\r\n \r\n let tds = table.querySelectorAll( 'td' );\r\n for ( let i = 0; i < tds.length; i++ ) {\r\n tds[i].classList.add( 'wptb-droppable' );\r\n tds[i].classList.remove( 'wptb-column-title-mobile-not-elements' );\r\n }\r\n \r\n return table;\r\n}","// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys\r\nif (!Object.keys) {\r\n Object.keys = (function () {\r\n 'use strict';\r\n var hasOwnProperty = Object.prototype.hasOwnProperty,\r\n hasDontEnumBug = !({toString: null}).propertyIsEnumerable('toString'),\r\n dontEnums = [\r\n 'toString',\r\n 'toLocaleString',\r\n 'valueOf',\r\n 'hasOwnProperty',\r\n 'isPrototypeOf',\r\n 'propertyIsEnumerable',\r\n 'constructor'\r\n ],\r\n dontEnumsLength = dontEnums.length;\r\n\r\n return function (obj) {\r\n if (typeof obj !== 'object' && (typeof obj !== 'function' || obj === null)) {\r\n throw new TypeError('Object.keys called on non-object');\r\n }\r\n\r\n var result = [], prop, i;\r\n\r\n for (prop in obj) {\r\n if (hasOwnProperty.call(obj, prop)) {\r\n result.push(prop);\r\n }\r\n }\r\n\r\n if (hasDontEnumBug) {\r\n for (i = 0; i < dontEnumsLength; i++) {\r\n if (hasOwnProperty.call(obj, dontEnums[i])) {\r\n result.push(dontEnums[i]);\r\n }\r\n }\r\n }\r\n return result;\r\n };\r\n }());\r\n}","const WPTB_RecalculateIndexes = function (table) {\r\n let trs = table.getElementsByTagName( 'tr' ),\r\n tds, maxCols = 0, maxColsFull = 0, tdsArr = [];\r\n\r\n for ( let i = 0; i < trs.length; i++ ) {\r\n tds = trs[i].getElementsByTagName( 'td' );\r\n\r\n if ( tdsArr[i] == undefined ) {\r\n tdsArr[i] = [];\r\n }\r\n\r\n let jMainIter = 0;\r\n for ( let j = 0; j < tds.length; j++ ) {\r\n if ( tdsArr[i][j] != undefined ) {\r\n for ( let y = 0; y < 100; y++ ) {\r\n if ( tdsArr[i][jMainIter] != undefined ) {\r\n jMainIter++;\r\n continue;\r\n }\r\n tdsArr[i][jMainIter] = tds[j];\r\n tds[j].dataset.xIndex = jMainIter;\r\n break;\r\n }\r\n } else {\r\n tdsArr[i][j] = tds[j];\r\n tds[j].dataset.xIndex = jMainIter;\r\n }\r\n tds[j].dataset.yIndex = i;\r\n\r\n if ( tds[j].colSpan > 1 ) {\r\n for ( let k = 1; k < tds[j].colSpan; k++ ) {\r\n jMainIter++;\r\n tdsArr[i][jMainIter] = 'tdDummy';\r\n }\r\n }\r\n\r\n if ( tds[j].rowSpan > 1 ) {\r\n for ( let x = 1; x < tds[j].rowSpan; x++ ) {\r\n if ( tdsArr[i + x] == undefined ) {\r\n tdsArr[i + x] = [];\r\n }\r\n for ( let z = 0; z < tds[j].colSpan; z++ ) {\r\n tdsArr[i + x][jMainIter - tds[j].colSpan + 1 + z ] = 'tdDummy';\r\n }\r\n }\r\n }\r\n jMainIter++;\r\n }\r\n\r\n if ( tds.length > maxCols ) {\r\n maxCols = tds.length;\r\n }\r\n\r\n if( i == 0 ) {\r\n maxColsFull = jMainIter;\r\n }\r\n }\r\n table.columns = maxCols;\r\n table.maxCols = maxColsFull;\r\n}\r\n","/**\r\n * Responsive menu and options class.\r\n *\r\n * This class will be called and instanced at table builder menu to add it the responsive menu and its controls.\r\n *\r\n * @param {string} sectionName section name\r\n * @param {string} responsiveWrapperId id for mount point\r\n * @param {string} mainContainerQuery query to find parent container for responsive menu\r\n * @throws {Error} will throw an error if mainContainerQuery failed to find any element\r\n * @constructor\r\n */\r\n// eslint-disable-next-line no-unused-vars\r\nfunction WptbResponsive(sectionName, responsiveWrapperId, mainContainerQuery) {\r\n\tthis.sectionName = sectionName;\r\n\tthis.responsiveWrapperId = responsiveWrapperId;\r\n\tthis.responsiveTable = null;\r\n\tthis.loaded = false;\r\n\r\n\t/**\r\n\t * Add responsive container to dom.\r\n\t */\r\n\tthis.addContainerToDom = () => {\r\n\t\tconst responsiveContainer = document.querySelector(`#${this.responsiveWrapperId}`);\r\n\t\tif (!responsiveContainer) {\r\n\t\t\tconst mainContainer = document.querySelector(mainContainerQuery);\r\n\r\n\t\t\t// parent container not found, throw error\r\n\t\t\tif (!mainContainer) {\r\n\t\t\t\tthrow new Error(\r\n\t\t\t\t\t`[WPTB_Responsive]: no parent container is found with the given query of [${mainContainerQuery}]`\r\n\t\t\t\t);\r\n\t\t\t}\r\n\r\n\t\t\tconst range = document.createRange();\r\n\t\t\trange.setStart(mainContainer, 0);\r\n\r\n\t\t\tconst responsiveElement = range.createContextualFragment(\r\n\t\t\t\t`<div class=\"wptb-responsive\" id=\"${this.responsiveWrapperId}\">responsive element</div>`\r\n\t\t\t);\r\n\t\t\tmainContainer.appendChild(responsiveElement);\r\n\t\t\tthis.loaded = true;\r\n\t\t}\r\n\r\n\t\tthis.responsiveTable = document.querySelector(`#${this.responsiveWrapperId}`);\r\n\t};\r\n\r\n\t/**\r\n\t * Load and make necessary mount preparations for component.\r\n\t */\r\n\tthis.load = () => {\r\n\t\tif (!this.loaded) {\r\n\t\t\tthis.addContainerToDom();\r\n\r\n\t\t\tWPTB_Helper.elementStartScript(this.responsiveTable, 'table_responsive_menu');\r\n\t\t\tWPTB_Helper.elementOptionsSet('table_responsive_menu', this.responsiveTable);\r\n\t\t\tWPTB_ControlsManager.callControlScript('ResponsiveTable', this.responsiveWrapperId);\r\n\t\t}\r\n\t};\r\n\r\n\t/**\r\n\t * Startup hook for the component.\r\n\t */\r\n\tthis.startUp = () => {\r\n\t\t// event listener for section change events\r\n\t\tdocument.addEventListener('wptbSectionChanged', (e) => {\r\n\t\t\tconst tablePreview = document.querySelector('.wptb-preview-table');\r\n\r\n\t\t\t// check if activated section is related to responsive and there is a main table already in the view\r\n\t\t\tif (e.detail === this.sectionName && tablePreview) {\r\n\t\t\t\tthis.load();\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\t// event listener for table ready signal\r\n\t\tdocument.addEventListener('wptb:table:generated', () => {\r\n\t\t\t// check current section to be sure that responsive menu is the active one before calling load related scripts\r\n\t\t\tif (WPTB_Helper.getCurrentSection() === 'table_responsive_menu') {\r\n\t\t\t\tthis.load();\r\n\t\t\t}\r\n\t\t});\r\n\t};\r\n\r\n\tthis.startUp();\r\n}\r\n","var WPTB_Settings = function () {\r\n var elems = document.getElementsByClassName('wptb-element');\r\n\r\n for ( var i = 0; i < elems.length; i++ ) {\r\n elems[i].ondragstart = function ( event ) {\r\n event.dataTransfer.effectAllowed = 'move';\r\n event.dataTransfer.setData( 'wptbElement', event.target.dataset.wptbElement );\r\n event.dataTransfer.setData( 'wptbElIndic-' + event.target.dataset.wptbElement, 'wptbElIndic-' + event.target.dataset.wptbElement );\r\n\r\n // set drag relative helper field for future use\r\n WPTB_Helper.setDragRelativeType(this.dataset.wptbRelativeElements || '');\r\n }\r\n elems[i].ondragend = function () {\r\n WPTB_Helper.elementDragEndClear();\r\n }\r\n };\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n let wptbUndo = document.getElementsByClassName( 'wptb-undo' );\r\n if( wptbUndo.length > 0 ) {\r\n wptbUndo = wptbUndo[0];\r\n \r\n wptbUndo.onclick = function( event ) {\r\n if( ! this.classList.contains( 'wptb-undoredo-disabled' ) ) {\r\n wptbTableStateSaveManager.tableStateGet( this.dataset.wptbUndoredo );\r\n let wptbUndoRedoContainer = document.getElementsByClassName( 'wptb-undo-redo-container' );\r\n if(wptbUndoRedoContainer.length > 0) {\r\n wptbUndoRedoContainer = wptbUndoRedoContainer[0];\r\n wptbUndoRedoContainer.onmouseleave = function( event ) {\r\n event.target.onmouseleave = '';\r\n let table = document.querySelector( '.wptb-preview-table' );\r\n WPTB_Table();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n \r\n let wptbRedo = document.getElementsByClassName( 'wptb-redo' );\r\n if( wptbRedo.length > 0 ) {\r\n wptbRedo = wptbRedo[0];\r\n \r\n wptbRedo.onclick = function( event ) {\r\n if( ! this.classList.contains( 'wptb-undoredo-disabled' ) ) {\r\n wptbTableStateSaveManager.tableStateGet( this.dataset.wptbUndoredo );\r\n let wptbUndoRedoContainer = document.getElementsByClassName( 'wptb-undo-redo-container' );\r\n if(wptbUndoRedoContainer.length > 0) {\r\n wptbUndoRedoContainer = wptbUndoRedoContainer[0];\r\n wptbUndoRedoContainer.onmouseleave = function( event ) {\r\n event.target.onmouseleave = '';\r\n let table = document.querySelector( '.wptb-preview-table' );\r\n WPTB_Table();\r\n }\r\n }\r\n }\r\n \r\n }\r\n }\r\n \r\n let shortcodePopupWindow = document.getElementsByClassName( 'wptb-popup-window-modal' )[0];\r\n document.getElementsByClassName( 'wptb-embed-btn' )[0].onclick = function () {\r\n if( ! this.classList.contains( 'wptb-button-disable' ) ) {\r\n shortcodePopupWindow.classList.add( 'wptb-popup-show' );\r\n }\r\n }\r\n \r\n window.onbeforeunload = function(e) {\r\n let wptbSaveDisabled = document.getElementsByClassName( 'wptb-save-disabled' );\r\n if( wptbSaveDisabled.length == 0 ) {\r\n return true;\r\n } else {\r\n return null;\r\n }\r\n };\r\n \r\n \r\n document.getElementsByClassName( 'wptb-popup-dark-area' )[0].onclick = function () {\r\n shortcodePopupWindow.classList.remove( 'wptb-popup-show' );\r\n }\r\n \r\n document.getElementsByClassName( 'wptb-popup-window-close-icon' )[0].onclick = function () {\r\n shortcodePopupWindow.classList.remove( 'wptb-popup-show' );\r\n }\r\n \r\n document.getElementsByClassName( 'wptb-preview-btn' )[0].onclick = function ( event ) {\r\n if( this.classList.contains( 'wptb-button-disable' ) ) {\r\n return;\r\n } \r\n \r\n let previewId = Math.floor( Math.random() * 10000 );\r\n \r\n var newHref = new URL( event.target.href );\r\n newHref.searchParams.set( 'preview_id', previewId );\r\n event.target.href = newHref.toString();\r\n WPTB_Helper.saveTable( event, false, previewId );\r\n }\r\n\r\n document.getElementsByClassName( 'wptb-save-btn' )[0].onclick = function ( event ) {\r\n if( ! this.classList.contains( 'wptb-save-disabled' ) ) {\r\n WPTB_Helper.saveTable( event );\r\n }\r\n }\r\n\r\n let tableTitleField = document.querySelector( '#wptb-setup-name' );\r\n if( tableTitleField ) {\r\n tableTitleField.onchange = function () {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n }\r\n};\r\n","const WPTB_SortableTable = function (table) {\n\tthis.table = table;\n\tthis.topRow = table.rows.length ? table.rows[0] : null;\n\n\t/**\n\t * sets the table to sort mode\n\t * @param type\n\t * @param active\n\t */\n\tthis.sortModeSwitcher = function (type, active) {\n\t\tif (type === 'vertical') {\n\t\t\tthis.table.removeEventListener('click', this.sortableTableVerticalStart, false);\n\n\t\t\tif (active) {\n\t\t\t\tthis.sortModeSwitcher('horizontal', false);\n\t\t\t\tthis.sortingCellMouseMoveSwitcher('vertical', true);\n\t\t\t\tthis.table.addEventListener('click', this.sortableTableVerticalStart, false);\n\t\t\t\tthis.table.dataset.wptbSortableTableVertical = '1';\n\t\t\t} else {\n\t\t\t\tthis.sortingCellMouseMoveSwitcher('vertical', false);\n\t\t\t\tdelete this.table.dataset.wptbSortableTableVertical;\n\t\t\t}\n\t\t} else if (type === 'horizontal') {\n\t\t\tthis.table.removeEventListener('click', this.sortableTableHorizontalStart, false);\n\n\t\t\tif (active) {\n\t\t\t\tthis.sortModeSwitcher('vertical', false);\n\t\t\t\tthis.sortingCellMouseMoveSwitcher('horizontal', true);\n\t\t\t\tthis.table.addEventListener('click', this.sortableTableHorizontalStart, false);\n\t\t\t\tthis.table.dataset.wptbSortableTableHorizontal = '1';\n\t\t\t} else {\n\t\t\t\tthis.sortingCellMouseMoveSwitcher('horizontal', false);\n\t\t\t\tdelete this.table.dataset.wptbSortableTableHorizontal;\n\t\t\t}\n\t\t}\n\t};\n\n\t/**\n\t * checks whether the table should be in the sort state\n\t * and connects the necessary handlers\n\t */\n\tthis.sortableTableInitialization = function () {\n\t\tif (this.table.dataset.wptbSortableTableVertical && this.table.dataset.wptbSortableTableVertical === '1') {\n\t\t\tthis.sortModeSwitcher('vertical', true);\n\t\t} else if (\n\t\t\tthis.table.dataset.wptbSortableTableHorizontal &&\n\t\t\tthis.table.dataset.wptbSortableTableHorizontal === '1'\n\t\t) {\n\t\t\tthis.sortModeSwitcher('horizontal', true);\n\t\t}\n\t};\n\n\tthis.sortingCellMouseMoveSwitcher = function (type, active) {\n\t\tif (type === 'vertical') {\n\t\t\tlet tds = this.topRow ? this.topRow.querySelectorAll('td') : null;\n\t\t\ttds = [...tds];\n\t\t\ttds.map((td) => {\n\t\t\t\ttd.removeEventListener('mousemove', sortingCellMouseMoveVertical, false);\n\t\t\t\ttd.removeEventListener('mouseleave', tdMouseLeave, false);\n\t\t\t\tif (active) {\n\t\t\t\t\ttd.addEventListener('mousemove', sortingCellMouseMoveVertical, false);\n\t\t\t\t\ttd.addEventListener('mouseleave', tdMouseLeave, false);\n\t\t\t\t}\n\t\t\t});\n\t\t} else if (type === 'horizontal') {\n\t\t\tlet tds = this.table.querySelectorAll('[data-x-index=\"0\"]');\n\t\t\ttds = [...tds];\n\t\t\ttds.map((td) => {\n\t\t\t\ttd.removeEventListener('mousemove', sortingCellMouseMoveHorizontal, false);\n\t\t\t\ttd.removeEventListener('mouseleave', tdMouseLeave, false);\n\t\t\t\tif (active) {\n\t\t\t\t\ttd.addEventListener('mousemove', sortingCellMouseMoveHorizontal, false);\n\t\t\t\t\ttd.addEventListener('mouseleave', tdMouseLeave, false);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t};\n\n\tfunction sortingCellMouseMov(e, type, element) {\n\t\tif (e.target.tagName === 'TD') {\n\t\t\tconst x = e.offsetX == undefined ? e.layerX : e.offsetX;\n\t\t\tconst y = e.offsetY == undefined ? e.layerY : e.offsetY;\n\t\t\tlet xMatch = false;\n\t\t\tif ((type === 'vertical' && e.target.clientWidth - x <= 35) || (type === 'horizontal' && x <= 35)) {\n\t\t\t\txMatch = true;\n\t\t\t}\n\t\t\tif (xMatch && (e.target.clientHeight - 35) / 2 < y && (e.target.clientHeight + 35) / 2 > y) {\n\t\t\t\telement.classList.add('sortable-hover');\n\t\t\t} else {\n\t\t\t\telement.classList.remove('sortable-hover');\n\t\t\t}\n\t\t} else {\n\t\t\telement.classList.remove('sortable-hover');\n\t\t}\n\t}\n\n\tfunction sortingCellMouseMoveVertical(e) {\n\t\tsortingCellMouseMov(e, 'vertical', this);\n\t}\n\n\tfunction sortingCellMouseMoveHorizontal(e) {\n\t\tsortingCellMouseMov(e, 'horizontal', this);\n\t}\n\n\tfunction tdMouseLeave() {\n\t\tthis.classList.remove('sortable-hover');\n\t}\n\n\t/**\n\t * function for sorting the table vertically by the numeric content of cells\n\t *\n\t * @param e\n\t * @param table\n\t */\n\tfunction sortableTable(e, table, type) {\n\t\tif (\n\t\t\te.target &&\n\t\t\te.target.tagName === 'TD' &&\n\t\t\t!table.classList.contains('wptb-plugin-responsive-base') &&\n\t\t\t!table.parentNode.classList.contains('wptb-preview-table-manage-cells')\n\t\t) {\n\t\t\tlet tableWasSorted = false;\n\t\t\tif (type === 'vertical' && e.target.dataset.yIndex === '0') {\n\t\t\t\tlet tds = table.querySelectorAll(`[data-x-index=\"${e.target.dataset.xIndex}\"]`);\n\t\t\t\ttds = [...tds];\n\n\t\t\t\t// preparing table for sorting\n\t\t\t\tlet rowspan;\n\t\t\t\tlet rowNum;\n\t\t\t\ttds.map((td) => {\n\t\t\t\t\tif (!(rowspan = parseInt(td.rowSpan, 10))) {\n\t\t\t\t\t\trowspan = 1;\n\t\t\t\t\t}\n\t\t\t\t\trowNum = td.dataset.yIndex;\n\t\t\t\t\tWPTB_CutGlueTable.cutTableHorizontally(rowNum, table);\n\t\t\t\t\trowNum += rowspan;\n\t\t\t\t\tWPTB_CutGlueTable.cutTableHorizontally(rowNum, table);\n\t\t\t\t});\n\n\t\t\t\tconst rowsValuesArr = [];\n\t\t\t\tlet rowsTdFirst;\n\t\t\t\tlet tdYCoordsRowSpanPrevious = 0;\n\t\t\t\tfor (let i = 0; i < tds.length; i++) {\n\t\t\t\t\tconst tdsChanged = changeSortingTdsCollection(\n\t\t\t\t\t\te,\n\t\t\t\t\t\ttable,\n\t\t\t\t\t\ttds,\n\t\t\t\t\t\ti,\n\t\t\t\t\t\ttdYCoordsRowSpanPrevious,\n\t\t\t\t\t\t'vertical'\n\t\t\t\t\t);\n\t\t\t\t\tif (tdsChanged && tdsChanged.hasOwnProperty('i')) {\n\t\t\t\t\t\ttds = tdsChanged.tds;\n\t\t\t\t\t\ti = tdsChanged.i;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t} else if (tdsChanged) {\n\t\t\t\t\t\ttds = tdsChanged.tds;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst td = tds[i];\n\n\t\t\t\t\tlet tdRowspan = parseInt(td.rowSpan, 10);\n\t\t\t\t\tif (!tdRowspan) tdRowspan = 1;\n\n\t\t\t\t\ttdYCoordsRowSpanPrevious = parseInt(td.dataset.yIndex, 10) + tdRowspan;\n\n\t\t\t\t\tconst textElementsValues = textElementsValuesGet(td);\n\n\t\t\t\t\tconst rowsTd = [];\n\t\t\t\t\tfor (let j = 0; j < tdRowspan; j++) {\n\t\t\t\t\t\trowsTd.push(table.rows[parseInt(td.dataset.yIndex, 10) + j]);\n\t\t\t\t\t}\n\t\t\t\t\tif (td.dataset.yIndex > 0) {\n\t\t\t\t\t\trowsValuesArr.push({\n\t\t\t\t\t\t\trowsTd,\n\t\t\t\t\t\t\tvalue: textElementsValues,\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\trowsTdFirst = rowsTd;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst orderBy = setSortedAscDataAttr(e, 'sortedVertical');\n\t\t\t\tif (!orderBy) return;\n\n\t\t\t\tif (rowsValuesArr.length) rowsValuesArr.sort((prev, next) => sortOrder(orderBy, prev, next));\n\n\t\t\t\trowsValuesArr.unshift({ rowsTd: rowsTdFirst });\n\n\t\t\t\tconst tBody = table.querySelector('tbody');\n\t\t\t\ttBody.innerHTML = '';\n\n\t\t\t\trowsValuesArr.map((rowsValObj) => {\n\t\t\t\t\trowsValObj.rowsTd.map((row) => {\n\t\t\t\t\t\ttBody.appendChild(row);\n\t\t\t\t\t});\n\t\t\t\t});\n\n\t\t\t\tWPTB_RecalculateIndexes(table);\n\n\t\t\t\tWPTB_CutGlueTable.glueTableHorizontally(table);\n\n\t\t\t\ttableWasSorted = true;\n\t\t\t} else if (type === 'horizontal' && e.target.dataset.xIndex === '0') {\n\t\t\t\tlet tds = table.querySelectorAll(`[data-y-index=\"${e.target.dataset.yIndex}\"]`);\n\t\t\t\ttds = [...tds];\n\n\t\t\t\t// preparing table for sorting\n\t\t\t\tlet colspan;\n\t\t\t\tlet colNum;\n\t\t\t\ttds.map((td) => {\n\t\t\t\t\tif (!(colspan = parseInt(td.colSpan, 10))) {\n\t\t\t\t\t\tcolspan = 1;\n\t\t\t\t\t}\n\t\t\t\t\tcolNum = td.dataset.xIndex;\n\t\t\t\t\tWPTB_CutGlueTable.cutTableVertically(colNum, table);\n\t\t\t\t\tcolNum += colspan;\n\t\t\t\t\tWPTB_CutGlueTable.cutTableVertically(colNum, table);\n\t\t\t\t});\n\n\t\t\t\tconst columnsValuesArr = [];\n\t\t\t\tlet columnsTdFirst;\n\n\t\t\t\tlet tdXCoordsColSpanPrevious = 0;\n\t\t\t\tfor (let i = 0; i < tds.length; i++) {\n\t\t\t\t\tconst tdsChanged = changeSortingTdsCollection(\n\t\t\t\t\t\te,\n\t\t\t\t\t\ttable,\n\t\t\t\t\t\ttds,\n\t\t\t\t\t\ti,\n\t\t\t\t\t\ttdXCoordsColSpanPrevious,\n\t\t\t\t\t\t'horizontal'\n\t\t\t\t\t);\n\t\t\t\t\tif (tdsChanged && tdsChanged.hasOwnProperty('i')) {\n\t\t\t\t\t\ttds = tdsChanged.tds;\n\t\t\t\t\t\ti = tdsChanged.i;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t} else if (tdsChanged) {\n\t\t\t\t\t\ttds = tdsChanged.tds;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst td = tds[i];\n\t\t\t\t\tlet tdColspan = parseInt(td.colSpan, 10);\n\t\t\t\t\tif (!tdColspan) tdColspan = 1;\n\n\t\t\t\t\ttdXCoordsColSpanPrevious = parseInt(td.dataset.xIndex, 10) + tdColspan;\n\n\t\t\t\t\tconst textElementsValues = textElementsValuesGet(td);\n\t\t\t\t\tconst columnsTd = [];\n\t\t\t\t\tfor (let j = 0; j < tdColspan; j++) {\n\t\t\t\t\t\tconst tdsColumn = [\n\t\t\t\t\t\t\t...table.querySelectorAll(`[data-x-index=\"${parseInt(td.dataset.xIndex, 10) + j}\"]`),\n\t\t\t\t\t\t];\n\t\t\t\t\t\tcolumnsTd.push(tdsColumn);\n\t\t\t\t\t}\n\t\t\t\t\tif (td.dataset.xIndex > 0) {\n\t\t\t\t\t\tcolumnsValuesArr.push({\n\t\t\t\t\t\t\tcolumnsTd,\n\t\t\t\t\t\t\tvalue: textElementsValues,\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcolumnsTdFirst = columnsTd;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst orderBy = setSortedAscDataAttr(e, 'sortedHorizontal');\n\t\t\t\tif (!orderBy) return;\n\n\t\t\t\tif (columnsValuesArr.length) columnsValuesArr.sort((prev, next) => sortOrder(orderBy, prev, next));\n\n\t\t\t\tcolumnsValuesArr.unshift({ columnsTd: columnsTdFirst });\n\n\t\t\t\tfor (let i = 0; i < table.rows.length; i++) {\n\t\t\t\t\ttable.rows[i].innerHTML = '';\n\t\t\t\t}\n\n\t\t\t\tcolumnsValuesArr.map((columnsValObj) => {\n\t\t\t\t\tcolumnsValObj.columnsTd.map((tdsColumn) => {\n\t\t\t\t\t\ttdsColumn.map((td) => {\n\t\t\t\t\t\t\ttable.rows[td.dataset.yIndex].appendChild(td);\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t});\n\n\t\t\t\tWPTB_RecalculateIndexes(table);\n\n\t\t\t\tWPTB_CutGlueTable.glueTableVertically(table);\n\n\t\t\t\ttableWasSorted = true;\n\t\t\t}\n\n\t\t\tif (tableWasSorted) {\n\t\t\t\tremoveCellsAttrAfterDivision(table);\n\n\t\t\t\tif (table.hasOwnProperty('tableSM')) {\n\t\t\t\t\tconst tableSM = table.tableSM();\n\t\t\t\t\tnew tableSM().tableStateSet();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Function that sets the data-attribute with the number of the row or column\n\t * that the table was sorted by. Returns the number of a row or column\n\t *\n\t * @param e\n\t * @param dataAttr\n\t * @returns {null|boolean}\n\t */\n\tfunction setSortedAscDataAttr(e, dataAttr) {\n\t\tif (e.currentTarget && e.currentTarget.classList.contains('wptb-preview-table')) {\n\t\t\tif (!e.target.dataset[dataAttr] || e.target.dataset[dataAttr] === 'ask') {\n\t\t\t\te.target.dataset[dataAttr] = 'desk';\n\t\t\t} else {\n\t\t\t\te.target.dataset[dataAttr] = 'ask';\n\t\t\t}\n\n\t\t\treturn e.target.dataset[dataAttr];\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * defines the sorting order\n\t *\n\t * @param orderBy\n\t * @param prev\n\t * @param next\n\t * @returns {number}\n\t */\n\tfunction sortOrder(orderBy = 'ask', prev, next) {\n\t\tlet prevValue = prev.value;\n\t\tlet nextValue = next.value;\n\t\tif (parseInt(prevValue) && parseInt(nextValue)) {\n\t\t\tprevValue = parseInt(prevValue);\n\t\t\tnextValue = parseInt(nextValue);\n\t\t}\n\n\t\tif (orderBy === 'ask') {\n\t\t\tif (prevValue < nextValue) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\tif (prevValue === nextValue) {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\treturn 1;\n\t\t}\n\t\tif (prevValue < nextValue) {\n\t\t\treturn 1;\n\t\t}\n\t\tif (prevValue === nextValue) {\n\t\t\treturn 0;\n\t\t}\n\t\treturn -1;\n\t}\n\n\t/**\n\t * return cell text elements values\n\t *\n\t * @param cell {HTMLElement}\n\t * @returns {string}\n\t */\n\tfunction textElementsValuesGet(cell) {\n\t\tlet textElements = cell.querySelectorAll('.wptb-text-container');\n\t\ttextElements = [...textElements];\n\t\tlet value = '';\n\t\tfor (let j = 0; j < textElements.length; j++) {\n\t\t\tconst p = textElements[j].querySelector('p');\n\t\t\tvalue += p.innerText;\n\t\t\tif (j !== textElements.length - 1) value += ' ';\n\t\t}\n\n\t\treturn value;\n\t}\n\n\t/**\n\t * adds cells to the collection of cells in the row or column that the table is sorted by.\n\t * These added cells are not originally were added in the collection,\n\t * because they are combined with cells from higher rows or left-side columns\n\t *\n\t * @param table\n\t * @param tds\n\t * @param i\n\t * @param tdIndexSpanPrev\n\t * @returns {{tds: *}|boolean|{tds: *, i: *}}\n\t */\n\tfunction changeSortingTdsCollection(e, table, tds, i, tdIndexSpanPrev, type) {\n\t\tconst td = tds[i];\n\t\tlet tdsCollectionChanged = false;\n\t\tlet collectionTds;\n\t\tlet collectionTdsJSpan;\n\t\tlet collectionTdsJSpanProperty;\n\t\tlet indexName;\n\t\tlet indexNameCamelCase;\n\t\tlet indexNamePerpendicularCamelCase;\n\t\tlet tdSpanProperty;\n\t\t// max rows or columns column\n\t\tlet tableGroupCount;\n\n\t\tif (type === 'vertical') {\n\t\t\tcollectionTdsJSpanProperty = 'colSpan';\n\t\t\tindexName = 'data-y-index';\n\t\t\tindexNameCamelCase = 'yIndex';\n\t\t\tindexNamePerpendicularCamelCase = 'xIndex';\n\t\t\ttdSpanProperty = 'rowSpan';\n\t\t\ttableGroupCount = table.rows.length;\n\t\t} else if (type === 'horizontal') {\n\t\t\tcollectionTdsJSpanProperty = 'rowSpan';\n\t\t\tindexName = 'data-x-index';\n\t\t\tindexNameCamelCase = 'xIndex';\n\t\t\tindexNamePerpendicularCamelCase = 'yIndex';\n\t\t\ttdSpanProperty = 'colSpan';\n\t\t\ttableGroupCount = table.maxCols;\n\t\t}\n\n\t\tif (td.dataset[indexNameCamelCase] - tdIndexSpanPrev > 0) {\n\t\t\tcollectionTds = table.querySelectorAll(`[${indexName}=\"${tdIndexSpanPrev}\"]`);\n\n\t\t\tfor (let j = 0; j < collectionTds.length; j++) {\n\t\t\t\tcollectionTdsJSpan = collectionTds[j][collectionTdsJSpanProperty];\n\t\t\t\tif (!collectionTdsJSpan) collectionTdsJSpan = 1;\n\n\t\t\t\tif (\n\t\t\t\t\tcollectionTds[j].dataset[indexNamePerpendicularCamelCase] <\n\t\t\t\t\t\te.target.dataset[indexNamePerpendicularCamelCase] &&\n\t\t\t\t\tparseInt(collectionTds[j].dataset[indexNamePerpendicularCamelCase], 10) +\n\t\t\t\t\t\tparseInt(collectionTdsJSpan, 10) >=\n\t\t\t\t\t\te.target.dataset[indexNamePerpendicularCamelCase]\n\t\t\t\t) {\n\t\t\t\t\ttds.splice(i, 0, collectionTds[j]);\n\t\t\t\t\ttdsCollectionChanged = true;\n\t\t\t\t\ti--;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (tdsCollectionChanged) return { tds, i };\n\n\t\tlet tdSpan = parseInt(td[tdSpanProperty], 10);\n\t\tif (!tdSpan) tdSpan = 1;\n\t\tif (i == tds.length - 1 && parseInt(td.dataset[indexNameCamelCase], 10) + tdSpan < tableGroupCount) {\n\t\t\tcollectionTds = table.querySelectorAll(\n\t\t\t\t`[${indexName}=\"${parseInt(td.dataset[indexNameCamelCase], 10) + tdSpan}\"]`\n\t\t\t);\n\t\t\tfor (let j = 0; j < collectionTds.length; j++) {\n\t\t\t\tcollectionTdsJSpan = collectionTds[j][collectionTdsJSpanProperty];\n\t\t\t\tif (!collectionTdsJSpan) collectionTdsJSpan = 1;\n\n\t\t\t\tif (\n\t\t\t\t\tcollectionTds[j].dataset[indexNamePerpendicularCamelCase] <\n\t\t\t\t\t\te.target.dataset[indexNamePerpendicularCamelCase] &&\n\t\t\t\t\tparseInt(collectionTds[j].dataset[indexNamePerpendicularCamelCase], 10) +\n\t\t\t\t\t\tparseInt(collectionTdsJSpan, 10) >=\n\t\t\t\t\t\te.target.dataset[indexNamePerpendicularCamelCase]\n\t\t\t\t) {\n\t\t\t\t\ttds.push(collectionTds[j]);\n\t\t\t\t\ttdsCollectionChanged = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (tdsCollectionChanged) return { tds };\n\t\treturn false;\n\t}\n\n\t/**\n\t * remove cells attributes which were used for division table\n\t *\n\t * @param table\n\t */\n\tfunction removeCellsAttrAfterDivision(table) {\n\t\tconst tdsAll = [...table.getElementsByTagName('td')];\n\t\tfor (let i = 0; i < tdsAll.length; i++) {\n\t\t\tif (tdsAll[i].hasAttribute('data-same-cell-before-division')) {\n\t\t\t\ttdsAll[i].removeAttribute('data-same-cell-before-division');\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * function for run sorting table vertically\n\t *\n\t * @param e\n\t */\n\tthis.sortableTableVerticalStart = function (e) {\n\t\tsortableTable(e, table, 'vertical');\n\t};\n\n\t/**\n\t * function for run sorting table horizontally\n\t *\n\t * @param e\n\t */\n\tthis.sortableTableHorizontalStart = function (e) {\n\t\tsortableTable(e, table, 'horizontal');\n\t};\n};\n","var WPTB_Stringifier = function ( codeMain ) {\r\n if ( codeMain ) {\r\n let code = codeMain.cloneNode( true );\r\n code.dataset.tableColumns = codeMain.columns;\r\n code.style.width = null;\r\n code.style.minWidth = null;\r\n code.style.maxWidth = null;\r\n\r\n let tds = code.getElementsByTagName( 'td' );\r\n if ( tds.length > 0 ) {\r\n for ( let i = 0; i < tds.length; i++ ) {\r\n\r\n // tds[i].removeAttribute( 'data-x-index' );\r\n // tds[i].removeAttribute( 'data-y-index' );\r\n tds[i].removeAttribute( 'draggable' );\r\n tds[i].classList.remove( 'wptb-droppable' );\r\n let infArr = tds[i].className.match( /wptb-element-((.+-)\\d+)/i );\r\n if(infArr) tds[i].classList.remove(infArr[0]);\r\n let innerElements = tds[i].getElementsByClassName( 'wptb-ph-element' );\r\n\r\n if ( innerElements.length > 0 ) {\r\n for ( let j = 0; j < innerElements.length; j++ ) {\r\n\r\n let mceContentBodys = innerElements[j].querySelectorAll( '.mce-content-body' );\r\n if( mceContentBodys.length > 0 ) {\r\n for ( let k = 0; k < mceContentBodys.length; k++ ) {\r\n mceContentBodys[k].classList.remove( 'mce-content-body' );\r\n }\r\n }\r\n\r\n let dataMceStyle = innerElements[j].querySelectorAll( '[data-mce-style]' );\r\n if ( dataMceStyle.length > 0 ) {\r\n for ( let k = 0; k < dataMceStyle.length; k++ ) {\r\n dataMceStyle[k].removeAttribute( 'data-mce-style' );\r\n }\r\n }\r\n\r\n let contentEditable = innerElements[j].querySelectorAll( '[contenteditable]' );\r\n if ( contentEditable.length > 0 ) {\r\n for ( let k = 0; k < contentEditable.length; k++ ) {\r\n contentEditable[k].removeAttribute( 'contenteditable' );\r\n }\r\n }\r\n\r\n let spellCheck = innerElements[j].querySelectorAll( '[spellcheck]' );\r\n if ( spellCheck.length > 0 ) {\r\n for ( let k = 0; k < spellCheck.length; k++ ) {\r\n spellCheck[k].removeAttribute( 'spellcheck' );\r\n }\r\n }\r\n\r\n let mceIds = innerElements[j].querySelectorAll( '[id^=mce_]' );\r\n if ( mceIds.length > 0 ) {\r\n for ( let k = 0; k < mceIds.length; k++ ) {\r\n mceIds[k].removeAttribute( 'id' );\r\n }\r\n }\r\n\r\n let wptbActions = innerElements[j].querySelectorAll( '.wptb-actions' );\r\n let wptbActionsLength = wptbActions.length;\r\n while ( wptbActionsLength > 0 ) {\r\n if( wptbActions[0] && wptbActions[0].parentNode ) {\r\n wptbActions[0].parentNode.removeChild( wptbActions[0] );\r\n wptbActionsLength--;\r\n } else {\r\n break;\r\n }\r\n\r\n }\r\n\r\n let dataMceBogus = innerElements[j].querySelectorAll( '[data-mce-bogus]' );\r\n if( dataMceBogus.length > 0 ) {\r\n dataMceBogus = [...dataMceBogus];\r\n for( let k = 0; k < dataMceBogus.length; k++ ) {\r\n if( dataMceBogus[k] && dataMceBogus[k].parentNode ) {\r\n dataMceBogus[k].parentNode.removeChild( dataMceBogus[k] );\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n // TODO dataTitleColumnSet\r\n // if( tds[i].hasAttribute( 'data-wptb-title-column' ) ) {\r\n // let columnNameDivContainer = document.createElement( 'div' ),\r\n // columnNameDiv = document.createElement( 'div' );\r\n // columnNameDivContainer.classList.add( 'wptb-column-title-mobile-container' );\r\n // columnNameDiv.classList.add( 'wptb-column-title-mobile' );\r\n // columnNameDiv.dataset.wptbTitleColumn = tds[i].dataset.wptbTitleColumn;\r\n // columnNameDiv.setAttribute( 'style', 'font-size:' + tds[i].dataset.wptbTitleColumnFontSize + '; \\n\\\r\n // color:' + tds[i].dataset.wptbTitleColumnColor + '; background-color:' + tds[i].dataset.wptbTitleBackgroundColor + '; text-align:' + tds[i].dataset.wptbTitleAlign + ';' );\r\n // columnNameDiv.style.padding = tds[i].style.padding;\r\n // if( tds[i].children.length == 0 ) {\r\n // tds[i].classList.add( 'wptb-column-title-mobile-not-elements' );\r\n // }\r\n // columnNameDivContainer.appendChild( columnNameDiv );\r\n // tds[i].insertBefore( columnNameDivContainer, tds[i].firstChild );\r\n // }\r\n }\r\n }\r\n\r\n return code;\r\n }\r\n}\r\n","var array = [], WPTB_Table = function ( columns, rows, wptb_preview_table ) {\r\n\r\n /* The members of the class */\r\n var settings = document.getElementsByClassName('wptb-settings-items'),\r\n wptbTableSetup = document.getElementsByClassName(\"wptb-table-setup\")[0],\r\n table, row, cell,\r\n maxAmountOfCells,\r\n maxAmountOfRows;\r\n\r\n //HERE ARE THE PRIVATE FUNCTIONS\r\n /*\r\n * This function toggles buttons visibility in cell edit mode\r\n * (according to the amount of currently selected cells), and\r\n * highlights visually the clicked cell if it is not highlighted, or\r\n * removes highlight if clicked cell is already highlighted.\r\n * It too toggles the bits of our abstract representation.\r\n * @param Event this is the event instance of the click performed over a cell.\r\n */\r\n var mark = function ( event ) {\r\n let thisElem = event.currentTarget;\r\n let rs = thisElem.rowSpan,\r\n cs = thisElem.colSpan,\r\n noCells = document.getElementsByClassName('wptb-no-cell-action'),\r\n singleCells = document.getElementsByClassName('wptb-single-action'),\r\n multipleCells = document.getElementsByClassName('wptb-multiple-select-action'),\r\n cellSettings = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ),\r\n position = getCoords(thisElem),\r\n row = position[0],\r\n column = position[1];\r\n if ( ! document.select.isActivated() ) {\r\n return;\r\n }\r\n if (thisElem.className.match(/wptb-highlighted/)) {\r\n thisElem.classList.remove('wptb-highlighted');\r\n for (var i = 0; i < rs; i++) {\r\n for (var j = 0; j < cs; j++) {\r\n array[row + i][column + j] = 0;\r\n }\r\n }\r\n } else {\r\n thisElem.classList.add('wptb-highlighted');\r\n for (var i = 0; i < rs; i++) {\r\n for (var j = 0; j < cs; j++) {\r\n array[row + i][column + j] = 1;\r\n }\r\n }\r\n }\r\n\r\n let cellHighlighted = document.getElementsByClassName('wptb-highlighted'),\r\n markedCells = cellHighlighted.length;\r\n if (markedCells === 0) {\r\n for (var i = 0; i < multipleCells.length; i++) {\r\n multipleCells[i].classList.remove('visible');\r\n multipleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n for (var i = 0; i < noCells.length; i++) {\r\n noCells[i].classList.add('visible');\r\n noCells[i].removeAttribute('disabled');\r\n }\r\n for (var i = 0; i < singleCells.length; i++) {\r\n singleCells[i].classList.remove('visible');\r\n singleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n cellSettings.classList.remove( 'visible' );\r\n } else if (markedCells === 1) {\r\n for (var i = 0; i < multipleCells.length; i++) {\r\n multipleCells[i].classList.remove('visible');\r\n multipleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n for (var i = 0; i < noCells.length; i++) {\r\n noCells[i].classList.remove('visible');\r\n noCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n for (var i = 0; i < singleCells.length; i++) {\r\n singleCells[i].classList.add('visible');\r\n singleCells[i].removeAttribute('disabled');\r\n }\r\n\r\n cellHighlighted = cellHighlighted[0];\r\n WPTB_Helper.elementOptionsSet( 'table_cell_setting', cellHighlighted );\r\n\r\n let infArr = cellHighlighted.className.match( /wptb-element-((.+-)\\d+)/i );\r\n\r\n const controlElemIds = ['cellWidth', 'cellHeight'];\r\n\r\n controlElemIds.map(s => {\r\n let elementControlSizeUnicClass = `wptb-el-${infArr[1]}-${s}`,\r\n elementControlSizeFixedUnicClass = `wptb-el-${infArr[1]}-${s}Fixed`;\r\n if(s === 'cellWidth' || s === 'cellHeight') {\r\n let sizeName = '',\r\n getSizeFunctionName = '';\r\n if(s === 'cellWidth') {\r\n sizeName = 'width';\r\n getSizeFunctionName = 'getColumnWidth';\r\n } else if(s === 'cellHeight') {\r\n sizeName = 'height';\r\n getSizeFunctionName = 'getRowHeight';\r\n }\r\n let size = cellHighlighted.style[sizeName],\r\n cellSizeInputs = document.querySelectorAll( '.' + elementControlSizeUnicClass ),\r\n cellSizeFixedInput = document.querySelector( '.' + elementControlSizeFixedUnicClass );\r\n cellSizeInputs = [...cellSizeInputs];\r\n\r\n if(!size && !cellHighlighted.dataset[`wptbFixed${sizeName.toUpperCase()}`]) {\r\n size = WPTB_Helper[getSizeFunctionName](table, cellHighlighted);\r\n cellSizeInputs.map(s => {\r\n s.value = size;\r\n });\r\n\r\n cellSizeFixedInput.checked = false;\r\n } else {\r\n cellSizeInputs.map(s => {\r\n if( size ) {\r\n s.value = parseFloat( size, 10 );\r\n } else if( cellHighlighted.dataset[`wptbFixed${sizeName.toUpperCase()}`] ) {\r\n s.value = cellHighlighted.dataset[`wptbFixed${sizeName.toUpperCase()}`];\r\n }\r\n });\r\n\r\n cellSizeFixedInput.checked = true;\r\n }\r\n }\r\n });\r\n\r\n cellSettings.classList.add( 'visible' );\r\n } else {\r\n for (var i = 0; i < multipleCells.length; i++) {\r\n if (table.isSquare(array)) {\r\n multipleCells[i].classList.add('visible');\r\n multipleCells[i].removeAttribute('disabled');\r\n } else {\r\n multipleCells[i].classList.remove('visible');\r\n multipleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n }\r\n for (var i = 0; i < noCells.length; i++) {\r\n noCells[i].classList.remove('visible');\r\n noCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n for (var i = 0; i < singleCells.length; i++) {\r\n singleCells[i].classList.remove('visible');\r\n singleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n cellSettings.classList.remove( 'visible' );\r\n }\r\n\r\n /**\r\n * empty cell setting\r\n */\r\n // let emptySetting = document.\r\n const infArr = thisElem.className.match(/wptb-element-table_cell_setting-((.+-)\\d+)/i);\r\n if (infArr && infArr.length > 1) {\r\n const controlKey = 'emptyCell';\r\n const settingId = `wptb-el-table_cell_setting-${infArr[1]}-${controlKey}`;\r\n const settingElem = document.getElementById(settingId);\r\n if (settingElem) {\r\n settingElem.querySelector('input[type=\"checkbox\"]').checked = thisElem.classList.contains('wptb-empty')\r\n }\r\n }\r\n\r\n\r\n let details = {countMarkedCells:markedCells};\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/cell/mark', thisElem, details);\r\n };\r\n\r\n /*\r\n * This function fills an array with 1's according to the actual design\r\n * of HTML table.\r\n * @returns an array of arrays containing an abstract representation\r\n * of HTML table.\r\n * @deprecated\r\n * */\r\n\r\n var realTimeArray = function () {\r\n var carried = [], tds, cols, matriz = [];\r\n\r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n carried[i] = 0;\r\n }\r\n\r\n for (var i = 0; i < table.rows.length; i++) {\r\n cols = [];\r\n\r\n var tds = table.rows[i].getElementsByTagName('td');\r\n\r\n for (items = 0; items < tds.length; items++) {\r\n\r\n for (var k = 0; k < tds[items].colSpan; k++) {\r\n cols.push(1);\r\n }\r\n\r\n if (tds[items].rowSpan > 1) {\r\n for (var k = 0; k < tds[items].colSpan; k++) {\r\n carried[items + k] = {\r\n justAssigned: true,\r\n amount: tds[items].rowSpan\r\n };\r\n }\r\n }\r\n }\r\n\r\n for (var k = 0; k < maxAmountOfCells; k++) {\r\n if (typeof carried[k] == 'object' && carried[k].amount > 0) {\r\n carried[k].amount--;\r\n if (carried[k].justAssigned) {\r\n carried[k].justAssigned = false;\r\n } else {\r\n cols.push(1);\r\n }\r\n }\r\n }\r\n\r\n matriz.push(cols);\r\n\r\n }\r\n return matriz;\r\n };\r\n\r\n /*\r\n * This function gets the number and position of cell spaces in current row that are occuped\r\n * by upper rowspanned cells.\r\n * @param number the number of row where we wish to calculate the carried rowspans up to.\r\n * @return an array with the remaining rowspans in each column.\r\n */\r\n var carriedRowspans = function (row) {\r\n var carried = [], tds, cols;\r\n\r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n carried[i] = 0;\r\n }\r\n\r\n if (row == -1) {\r\n return carried;\r\n }\r\n\r\n for (var i = 0; i <= row; i++) {\r\n cellsBuffer = table.rows[i].getElementsByTagName('td');\r\n cellPointer = 0;\r\n\r\n for (var xPosition = 0; xPosition < maxAmountOfCells; xPosition += stepsToMove) {\r\n stepsToMove = 1;\r\n\r\n if (carried[xPosition]) {\r\n carried[xPosition]--;\r\n } else {\r\n celda = cellsBuffer[cellPointer++];\r\n if (celda.rowSpan > 1) {\r\n for (k = 0; k < celda.colSpan; k++) {\r\n carried[xPosition + k] = celda.rowSpan - 1;\r\n }\r\n stepsToMove = celda.colSpan;\r\n } else if (celda.colSpan > 1) {\r\n stepsToMove = celda.colSpan;\r\n }\r\n }\r\n }\r\n\r\n }\r\n return carried;\r\n };\r\n\r\n /*\r\n * A helpful function for showing\r\n * the abstract table in console.\r\n * @param Array our abstract table.\r\n */\r\n var drawTable = function (a) {\r\n var string = 'DRAWING TABLE:\\n';\r\n for (var i = 0; i < a.length; i++) {\r\n\r\n for (var j = 0; j < a[i].length; j++) {\r\n string += ' ' + a[i][j];\r\n }\r\n string += '\\n';\r\n }\r\n table.isSquare(a);\r\n };\r\n\r\n /*\r\n * It resets all the bits of our abstract representation\r\n * to 0 and removes the highlighting class of all cells.\r\n */\r\n\r\n var undoSelect = function () {\r\n let noCells = document.getElementsByClassName('wptb-no-cell-action'),\r\n singleCells = document.getElementsByClassName('wptb-single-action'),\r\n multipleCells = document.getElementsByClassName('wptb-multiple-select-action'),\r\n cellSettings = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ),\r\n tds = table.getElementsByClassName('wptb-highlighted');\r\n while (tds.length) {\r\n tds[0].classList.remove('wptb-highlighted');\r\n }\r\n cellSettings.classList.remove( 'visible' );\r\n for (let i = 0; i < array.length; i++) {\r\n for (let j = 0; j < array[i].length; j++) {\r\n array[i][j] = 0;\r\n }\r\n }\r\n for (let i = 0; i < multipleCells.length; i++) {\r\n multipleCells[i].classList.remove('visible');\r\n multipleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n for (let i = 0; i < noCells.length; i++) {\r\n noCells[i].classList.add('visible');\r\n noCells[i].removeAttribute('disabled');\r\n }\r\n for (let i = 0; i < singleCells.length; i++) {\r\n singleCells[i].classList.remove('visible');\r\n singleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/undo-select/active', table);\r\n };\r\n\r\n /*\r\n * This fills the abstract representation of our table with\r\n * zeros, at the start. the max amount of cells is the greatest sum\r\n * of all colspans for row.\r\n */\r\n\r\n var fillTableArray = function () {\r\n var colspansSums = [], a = [];\r\n\r\n //calculate max amount of cells inside a row\r\n for (var i = 0; i < table.rows.length; i++) {\r\n var cells = table.rows[i].getElementsByTagName('td'),\r\n colspanSumInRow = 0;\r\n for (var j = 0; j < cells.length; j++) {\r\n colspanSumInRow += cells[j].colSpan;\r\n }\r\n colspansSums.push(colspanSumInRow);\r\n }\r\n\r\n maxAmountOfCells = Math.max.apply(null, colspansSums);\r\n //calculate max rows\r\n var maxAmountOfRows = table.rows.length;\r\n\r\n // fill with zeros from both values\r\n for (var i = 0; i < maxAmountOfRows; i++) {\r\n a[i] = [];\r\n for (var j = 0; j < maxAmountOfCells; j++) {\r\n a[i].push(0);\r\n }\r\n }\r\n drawTable(a);\r\n return a;\r\n };\r\n\r\n /*\r\n * This function gets the sum of all colspans in a row.\r\n * @param number the number of row to be used as reference.\r\n */\r\n var getActualPointsInRow = function (row) {\r\n var tds = table.rows[row].getElementsByTagName('td'),\r\n points = 0;\r\n for (var i = 0; i < tds.length; i++) {\r\n points += tds[i].colSpan;\r\n }\r\n return points;\r\n }\r\n\r\n /*\r\n * This function gets us the exact coordinates of\r\n * an exact cell, in a more reliable way than xIndex and yIndex,\r\n * these last ones were meant to be used for getting the cell trough them.\r\n * @param DOMElement the cell to get the coordinates.\r\n */\r\n var getCoords = function (search) {\r\n var skipInCols = [], cell;\r\n\r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n skipInCols[i] = 0;\r\n }\r\n\r\n for (var i = 0; i < table.rows.length; i++) {\r\n var cellsBuffer = table.rows[i].getElementsByTagName('td');\r\n cellPointer = 0;\r\n for (var xPosition = 0; xPosition < maxAmountOfCells; xPosition += stepsToMove) {\r\n stepsToMove = 1;\r\n\r\n if (skipInCols[xPosition]) {\r\n skipInCols[xPosition]--;\r\n } else {\r\n var td = cellsBuffer[cellPointer++];\r\n if (td == search) {\r\n return [i, xPosition];\r\n }\r\n if (td.rowSpan > 1) {\r\n for ( let k = 0; k < td.colSpan; k++ ) {\r\n skipInCols[xPosition + k] = td.rowSpan - 1;\r\n }\r\n stepsToMove = td.colSpan;\r\n } else if (td.colSpan > 1) {\r\n stepsToMove = td.colSpan;\r\n }\r\n }\r\n }\r\n }\r\n };\r\n\r\n jQuery('#wptb-table-border-color').val('');\r\n jQuery('#wptb-table-padding-number,#wptb-table-padding-slider').val('15');\r\n\r\n if ( columns || rows ) {\r\n //END OF PRIVATE FUNCTIONS\r\n for (var i = 0; i < settings.length; i++) {\r\n if (settings[i].id !== 'wptb-apply-inner-border') {\r\n settings[i].classList.add('visible');\r\n }\r\n }\r\n\r\n //Create a HTML Table element.\r\n table = document.createElement( 'table' );\r\n table.classList.add( 'wptb-preview-table', 'wptb-element-main-table_setting-startedid-0' );\r\n table.style.border = '0px solid';\r\n table.dataset.reconstraction = 1;\r\n //table.dataset.wptbAdaptiveTable = 1;\r\n //Add the data rows.\r\n for (var i = 0; i < rows; i++) {\r\n\r\n row = table.insertRow(-1);\r\n row.classList.add( 'wptb-row' );\r\n\r\n for (var j = 0; j < columns; j++) {\r\n cell = new WPTB_Cell(mark);\r\n cell.setCoords(i, j);\r\n cell.getDOMElement().style.borderWidth = '1px';\r\n row.appendChild(cell.getDOMElement());\r\n }\r\n }\r\n } else {\r\n if( ! wptb_preview_table ) wptb_preview_table = document.querySelector( '.wptb-preview-table' );\r\n\r\n if ( wptb_preview_table ) {\r\n table = wptb_preview_table;\r\n\r\n let cells = table.getElementsByTagName('td');\r\n\r\n if (cells.length > 0) {\r\n for (let i = 0; i < cells.length; i++) {\r\n WPTB_Cell(mark, cells[i]);\r\n }\r\n }\r\n } else {\r\n return;\r\n }\r\n }\r\n\r\n /**\r\n * this method run \"mark\" method of WPTB_Table object\r\n * @param event\r\n */\r\n table.mark = (event) => {\r\n mark(event);\r\n }\r\n\r\n table.wptbCell = (callback, DOMElement) => {\r\n return WPTB_Cell(callback, DOMElement);\r\n }\r\n\r\n table.tableSM = () => {\r\n return WPTB_TableStateSaveManager;\r\n }\r\n\r\n /**\r\n * this method run \"undoSelect\" method of WPTB_Table object\r\n * @param event\r\n */\r\n table.undoSelect = () => {\r\n undoSelect();\r\n }\r\n\r\n /**\r\n * method for set value for maxAmountOfCells\r\n * @param value\r\n */\r\n table.setMaxAmountOfCells = (value) => {\r\n maxAmountOfCells = value;\r\n }\r\n\r\n /**\r\n * this method return maxAmountOfCells value\r\n * @returns {*}\r\n */\r\n table.getMaxAmountOfCells = () => {\r\n return maxAmountOfCells;\r\n }\r\n\r\n /**\r\n * this method run \"fillTableArray\" method of WPTB_Table object\r\n * @returns {[]}\r\n */\r\n table.fillTableArray = () => {\r\n return fillTableArray();\r\n }\r\n /*\r\n * For assigning to each cell xIndex and y Index attributes,\r\n * these are the column number and row number of cell in table.\r\n */\r\n\r\n table.recalculateIndexes = function () {\r\n WPTB_Helper.recalculateIndexes( this );\r\n }\r\n\r\n table.addColumnWidth = function( value, cleaner ) {\r\n let highlighted = table.getElementsByClassName( 'wptb-highlighted' );\r\n if( highlighted.length > 0 ) {\r\n for( let k = 0; k < highlighted.length; k++ ) {\r\n let dataXIndex = highlighted[k].dataset.xIndex;\r\n if( dataXIndex ) {\r\n function tableTdsFor( dataXIndex, colspan ) {\r\n let tableRows = table.rows;\r\n let widthIsSet = false;\r\n let arrayTdsFromPreviousRow = [];\r\n for( let i = 0; i < tableRows.length; i++ ) {\r\n let row = tableRows[i];\r\n let tds = row.children;\r\n for( let j = 0; j < tds.length; j++ ) {\r\n let td = tds[j];\r\n if( td.dataset.xIndex == dataXIndex ) {\r\n if( value ) {\r\n if( td.colSpan == colspan ) {\r\n td.style.width = value + 'px';\r\n td.removeAttribute( 'data-wptb-fixed-width' );\r\n widthIsSet = true;\r\n } else {\r\n td.style.width = null;\r\n td.dataset.wptbFixedWidth = value;\r\n if( i == tableRows.length - 1 && ! widthIsSet ) {\r\n tableTdsFor( dataXIndex, colspan + 1 );\r\n }\r\n }\r\n } else if( cleaner ) {\r\n td.style.width = null;\r\n td.removeAttribute( 'data-wptb-fixed-width' );\r\n } else {\r\n if( td.dataset.wptbFixedWidth ) {\r\n if( td.colSpan == colspan ) {\r\n td.style.width = td.dataset.wptbFixedWidth + 'px';\r\n td.removeAttribute( 'data-wptb-fixed-width' );\r\n }\r\n } else if( td.style.width ) {\r\n for( let z = 0; z < arrayTdsFromPreviousRow.length; z++ ) {\r\n arrayTdsFromPreviousRow[z].style.width = td.style.width;\r\n }\r\n arrayTdsFromPreviousRow = [];\r\n } else {\r\n arrayTdsFromPreviousRow.push( td );\r\n }\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n tableTdsFor( dataXIndex, 1 );\r\n }\r\n }\r\n\r\n table.tdDefaultWidth();\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\r\n }\r\n }\r\n\r\n table.tdDefaultWidth = function() {\r\n let rows = table.rows;\r\n\r\n let tableTdsSumMaxWidth = 0;\r\n let tableTdsSumMaxWidthFixed = 0;\r\n let tableTdsSumMaxWidthAuto = 0;\r\n\r\n let wptbTableSetup = document.getElementsByClassName( 'wptb-table-setup' )[0];\r\n let wptbTableSetupWidth = wptbTableSetup.offsetWidth;\r\n\r\n let arrayCellsWidthFixedHelper = [];\r\n let arrayCellsWidthAutoHelper = [];\r\n let tdPaddingCommon = 0;\r\n let tableTdBorderCommonWidth = 0;\r\n let cssForTdsWidthAuto = '';\r\n\r\n\r\n let tableFullStyleObj = window.getComputedStyle( table, null );\r\n let borderLeftWidth = tableFullStyleObj.getPropertyValue( 'border-left-width' );\r\n let borderRightWidth = tableFullStyleObj.getPropertyValue( 'border-right-width' );\r\n let tableBorderCommon = parseFloat( borderLeftWidth, 10 ) + parseFloat( borderRightWidth, 10 );\r\n\r\n for( let i = 0; i < rows.length; i++ ) {\r\n let tds = rows[i].children;\r\n for( let j = 0; j < tds.length; j++ ) {\r\n let td = tds[j];\r\n\r\n if( ! arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] && ! arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] ) {\r\n if( td.style.width ) {\r\n arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] = parseFloat( td.style.width );\r\n td.removeAttribute( 'data-wptb-css-td-auto-width' );\r\n } else {\r\n if( ! td.dataset.wptbFixedWidth ) {\r\n arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] = table.dataset.wptbTdWidthAuto ? parseFloat( table.dataset.wptbTdWidthAuto, 10 ) : 100;\r\n td.dataset.wptbCssTdAutoWidth = true;\r\n }\r\n }\r\n\r\n if( window.getComputedStyle( td, null ) ) {\r\n let tdStyleObj = window.getComputedStyle( td, null );\r\n let tdPaddingLeft = tdStyleObj.getPropertyValue( 'padding-left' );\r\n let tdPaddingRight = tdStyleObj.getPropertyValue( 'padding-right' );\r\n tdPaddingCommon = parseFloat( tdPaddingLeft, 10 ) + parseFloat( tdPaddingRight, 10 );\r\n\r\n let tableTdBorderLeftWidth = tdStyleObj.getPropertyValue( 'border-left-width' );\r\n let tableTdBorderRightWidth = tdStyleObj.getPropertyValue( 'border-right-width' );\r\n tableTdBorderCommonWidth = parseFloat( tableTdBorderLeftWidth, 10 ) + parseFloat( tableTdBorderRightWidth, 10 );\r\n tableTdBorderCommonWidth = tableTdBorderCommonWidth / 2;\r\n\r\n if( arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] ) {\r\n arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] += tdPaddingCommon;\r\n arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] += tableTdBorderCommonWidth;\r\n\r\n if( j == 0 && ( tableBorderCommon / 2 ) <= parseFloat( tableTdBorderLeftWidth, 10 ) ) {\r\n arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] += parseFloat( tableTdBorderLeftWidth, 10 ) / 2;\r\n } else if( j == 0 && ( tableBorderCommon / 2 ) > parseFloat( tableTdBorderLeftWidth, 10 ) ) {\r\n arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] += ( ( tableBorderCommon / 2 ) - ( parseFloat( tableTdBorderRightWidth, 10 ) / 2 ) );\r\n }\r\n\r\n if( j == tds.length - 1 && ( tableBorderCommon / 2 ) <= parseFloat( tableTdBorderRightWidth, 10 ) ) {\r\n arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] += parseFloat( tableTdBorderRightWidth, 10 ) / 2;\r\n } else if( j == tds.length - 1 && ( tableBorderCommon / 2 ) > parseFloat( tableTdBorderRightWidth, 10 ) ) {\r\n arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] += ( ( tableBorderCommon / 2 ) - ( parseFloat( tableTdBorderRightWidth, 10 ) / 2 ) );\r\n }\r\n } else if( arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] ) {\r\n arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] += tdPaddingCommon;\r\n arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] += tableTdBorderCommonWidth;\r\n\r\n if( j == 0 && ( tableBorderCommon / 2 ) <= parseFloat( tableTdBorderLeftWidth, 10 ) ) {\r\n arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] += parseFloat( tableTdBorderLeftWidth, 10 ) / 2;\r\n } else if( j == 0 && ( tableBorderCommon / 2 ) > parseFloat( tableTdBorderLeftWidth, 10 ) ) {\r\n arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] += ( ( tableBorderCommon / 2 ) - ( parseFloat( tableTdBorderLeftWidth, 10 ) / 2 ) );\r\n }\r\n\r\n if( j == tds.length - 1 && ( tableBorderCommon / 2 ) <= parseFloat( tableTdBorderRightWidth, 10 ) ) {\r\n arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] += parseFloat( tableTdBorderRightWidth, 10 ) / 2;\r\n } else if( j == tds.length - 1 && ( tableBorderCommon / 2 ) > parseFloat( tableTdBorderRightWidth, 10 ) ) {\r\n arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] += ( ( tableBorderCommon / 2 ) - ( parseFloat( tableTdBorderLeftWidth, 10 ) / 2 ) );\r\n }\r\n }\r\n }\r\n } else if( arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] ) {\r\n if( ! td.dataset.wptbFixedWidth ) {\r\n td.dataset.wptbCssTdAutoWidth = true;\r\n }\r\n } else if( arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] ) {\r\n td.removeAttribute( 'data-wptb-css-td-auto-width' );\r\n }\r\n }\r\n }\r\n\r\n for( let i = 0; i < arrayCellsWidthFixedHelper.length; i++ ) {\r\n if( arrayCellsWidthFixedHelper[i] ) {\r\n tableTdsSumMaxWidthFixed += arrayCellsWidthFixedHelper[i];\r\n }\r\n }\r\n\r\n let CellsWidthAutoCount = 0;\r\n for( let i = 0; i < arrayCellsWidthAutoHelper.length; i++ ) {\r\n if( arrayCellsWidthAutoHelper[i] ) {\r\n tableTdsSumMaxWidthAuto += arrayCellsWidthAutoHelper[i];\r\n CellsWidthAutoCount++;\r\n }\r\n }\r\n\r\n tableTdsSumMaxWidth = tableTdsSumMaxWidthFixed + tableTdsSumMaxWidthAuto;\r\n\r\n table.dataset.wptbTableTdsSumMaxWidth = tableTdsSumMaxWidth;\r\n if( CellsWidthAutoCount ) {\r\n table.dataset.wptbCellsWidthAutoCount = CellsWidthAutoCount;\r\n if( table.mergingСellsHorizontally ) {\r\n table.dataset.wptbFixedWidthSize = tableTdsSumMaxWidthFixed;\r\n } else {\r\n table.removeAttribute( 'data-wptb-fixed-width-size' );\r\n }\r\n } else {\r\n table.removeAttribute( 'data-wptb-fixed-width-size' );\r\n table.removeAttribute( 'data-wptb-cells-width-auto-count' );\r\n }\r\n\r\n let styleElementCreate = false;\r\n let tableTdWidthAuto;\r\n if( tableTdsSumMaxWidth < wptbTableSetupWidth ) {\r\n if( CellsWidthAutoCount ) {\r\n table.style.minWidth = '100%';\r\n if( table.mergingСellsHorizontally ) {\r\n table.style.width = 'auto';\r\n let tableTdsWidthAutoCommon = wptbTableSetupWidth - tableTdsSumMaxWidthFixed;\r\n tableTdWidthAuto = tableTdsWidthAutoCommon / CellsWidthAutoCount;\r\n tableTdWidthAuto = tableTdWidthAuto - tdPaddingCommon - tableTdBorderCommonWidth;\r\n styleElementCreate = true;\r\n } else {\r\n table.style.width = '100%';\r\n }\r\n } else {\r\n table.style.width = 'auto';\r\n table.style.minWidth = null;\r\n table.style.maxWidth = null;\r\n }\r\n } else {\r\n table.style.maxWidth = null;\r\n table.style.minWidth = tableTdsSumMaxWidth + 'px';\r\n table.style.width = 'auto';\r\n tableTdWidthAuto = table.dataset.wptbTdWidthAuto ? table.dataset.wptbTdWidthAuto : '100';\r\n styleElementCreate = true;\r\n }\r\n\r\n let head = document.head;\r\n if( head ) {\r\n let cssForTdsWidthAutoOld = head.querySelector( 'style[data-wptb-td-auto-width=\"true\"]' );\r\n if( cssForTdsWidthAutoOld ) {\r\n head.removeChild( cssForTdsWidthAutoOld );\r\n }\r\n }\r\n\r\n if( styleElementCreate ) {\r\n cssForTdsWidthAuto = document.createElement( 'style' );\r\n cssForTdsWidthAuto.setAttribute( 'data-wptb-td-auto-width', true );\r\n cssForTdsWidthAuto.innerHTML = '[data-wptb-css-td-auto-width=true]{width:' + tableTdWidthAuto + 'px}';\r\n if( head ) {\r\n head.appendChild( cssForTdsWidthAuto );\r\n }\r\n }\r\n\r\n if( table.dataset.wptbTableAlignment ) {\r\n let wptbTableAlignment = table.dataset.wptbTableAlignment;\r\n\r\n let wptbTableSetupWidth = wptbTableSetup.offsetWidth;\r\n if( wptbTableSetupWidth < table.offsetWidth ) {\r\n table.style.float = null;\r\n } else {\r\n if( wptbTableAlignment == 'center' ) {\r\n table.style.float = null;\r\n } else {\r\n table.style.float = wptbTableAlignment;\r\n }\r\n }\r\n\r\n if( wptbTableAlignment == 'center' ) {\r\n wptbTableSetup.style.float = null;\r\n } else {\r\n wptbTableSetup.style.float = wptbTableAlignment;\r\n }\r\n\r\n if( tableTdWidthAuto && table.dataset.wptbTableContainerMaxWidth && table.offsetWidth < table.dataset.wptbTableContainerMaxWidth ) {\r\n table.style.width = '100%';\r\n }\r\n } else {\r\n table.style.float = null;\r\n }\r\n }\r\n\r\n table.addRowHeight = function( value, cleaner ) {\r\n let highlighted = table.getElementsByClassName( 'wptb-highlighted' );\r\n if( highlighted.length > 0 ) {\r\n for( let k = 0; k < highlighted.length; k++ ) {\r\n let dataYIndex = highlighted[k].dataset.yIndex;\r\n if( dataYIndex ) {\r\n function tableTdsFor( dataYIndex, rowspan ) {\r\n let tableRows = table.rows;\r\n let heightIsSet = false;\r\n let arrayTdsPrevious = [];\r\n for( let i = 0; i < tableRows.length; i++ ) {\r\n let row = tableRows[i];\r\n let tds = row.children;\r\n for( let j = 0; j < tds.length; j++ ) {\r\n let td = tds[j];\r\n if( td.dataset.yIndex == dataYIndex ) {\r\n if( value ) {\r\n if( td.rowSpan == rowspan ) {\r\n td.style.height = value + 'px';\r\n td.removeAttribute( 'data-wptb-fixed-heidht' );\r\n heightIsSet = true;\r\n continue;\r\n } else {\r\n td.style.height = null;\r\n td.dataset.wptbFixedHeight = value;\r\n if( j == tds.length - 1 && ! heightIsSet ) {\r\n tableTdsFor( dataYIndex , rowspan + 1 );\r\n }\r\n }\r\n } else if( cleaner ) {\r\n td.style.height = null;\r\n td.removeAttribute( 'data-wptb-fixed-heidht' );\r\n } else {\r\n if( td.dataset.wptbFixedHeight ) {\r\n if( td.rowSpan = rowspan ) {\r\n td.style.height = td.dataset.wptbFixedHeight + 'px';\r\n td.removeAttribute( 'data-wptb-fixed-width' );\r\n }\r\n } else if( td.style.height ) {\r\n for( let z = 0; z < arrayTdsPrevious.length; z++ ) {\r\n arrayTdsPrevious[z].style.height = td.style.height;\r\n }\r\n arrayTdsPrevious = [];\r\n } else {\r\n arrayTdsPrevious.push( td );\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n tableTdsFor( dataYIndex, 1 );\r\n }\r\n }\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\r\n }\r\n }\r\n\r\n table.reconstraction = function() {\r\n let tds = table.getElementsByTagName( 'td' );\r\n table.mergingСellsHorizontally = false;\r\n table.mergingCellsVertically = false;\r\n table.dataset.reconstraction = 1;\r\n let forBreak = 0;\r\n for( let i = 0; i < tds.length; i++ ) {\r\n if( tds[i].colSpan > 1 ) {\r\n table.dataset.reconstraction = 0;\r\n table.mergingСellsHorizontally = true;\r\n forBreak++;\r\n }\r\n\r\n if( tds[i].rowSpan > 1 ) {\r\n table.dataset.reconstraction = 0;\r\n table.mergingCellsVertically = true;\r\n forBreak++;\r\n }\r\n\r\n if( forBreak == 2 ) {\r\n break;\r\n }\r\n }\r\n }\r\n\r\n /*\r\n * As simple as it is: adds a column to the end of table.\r\n */\r\n table.addColumnEnd = function () {\r\n let td,\r\n currentTable = document.getElementsByClassName('wptb-preview-table'),\r\n currentTableTd,\r\n currentTdStyle;\r\n if (currentTable.length > 0) {\r\n currentTableTd = currentTable[0].querySelector('td');\r\n }\r\n\r\n if (currentTableTd) {\r\n currentTdStyle = currentTableTd.getAttribute('style');\r\n }\r\n\r\n for (var i = 0; i < table.rows.length; i++) {\r\n td = new WPTB_Cell(mark);\r\n\r\n if (currentTdStyle) {\r\n td.getDOMElement().setAttribute('style', currentTdStyle);\r\n td.getDOMElement().style.width = null;\r\n td.getDOMElement().style.height = null;\r\n td.getDOMElement().style.borderColor = WPTB_TableSettingsData.getTableSetting('borderColor');\r\n }\r\n\r\n table.rows[i].appendChild(td.getDOMElement());\r\n array[i].push(0);\r\n }\r\n\r\n maxAmountOfCells++;\r\n table.recalculateIndexes();\r\n table.tdDefaultWidth();\r\n table.addRowHeight();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n /*\r\n * As simple as it looks: adds a column to the start of table.\r\n */\r\n\r\n table.addColumnStart = function () {\r\n let td,\r\n firstCell,\r\n currentTable = document.getElementsByClassName('wptb-preview-table'),\r\n currentTableTd,\r\n currentTdStyle;\r\n if ( currentTable.length > 0 ) {\r\n currentTableTd = currentTable[0].querySelector('td');\r\n }\r\n\r\n if ( currentTableTd ) {\r\n currentTdStyle = currentTableTd.getAttribute('style');\r\n }\r\n\r\n for (var i = 0; i < table.rows.length; i++) {\r\n td = new WPTB_Cell(mark);\r\n if (currentTdStyle) {\r\n td.getDOMElement().setAttribute('style', currentTdStyle);\r\n td.getDOMElement().style.width = null;\r\n td.getDOMElement().style.height = null;\r\n td.getDOMElement().style.borderColor = WPTB_TableSettingsData.getTableSetting('borderColor');\r\n }\r\n firstCell = table.rows[i].getElementsByTagName('td')[0];\r\n if (firstCell) {\r\n table.rows[i].insertBefore(td.getDOMElement(), firstCell);\r\n } else {\r\n table.rows[i].appendChild(td.getDOMElement());\r\n }\r\n array[i].push(0);\r\n }\r\n\r\n maxAmountOfCells++;\r\n table.recalculateIndexes();\r\n table.tdDefaultWidth();\r\n table.addRowHeight();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n /*\r\n * Well, not so simple as previous functions.\r\n * It adds a column after a certain column of reference.\r\n * @param integer the column number to be used as reference.\r\n *\tIf empty, then the first highlighted cell is used as reference.\r\n */\r\n\r\n table.addColumnAfter = function (c_pos) {\r\n let rows = table.rows,\r\n cell,\r\n cellStyle,\r\n pos;\r\n\r\n if(c_pos != undefined && typeof c_pos === 'number') {\r\n pos = c_pos;\r\n cell = document.querySelector('[data-x-index=\"' + pos + '\"]');\r\n } else {\r\n cell = document.querySelector('.wptb-highlighted');\r\n pos = getCoords(cell)[1];\r\n }\r\n\r\n if(cell) {\r\n cellStyle = cell.getAttribute('style');\r\n\r\n if( maxAmountOfCells - pos - cell.colSpan + 1 == 1 ) {\r\n table.addColumnEnd();\r\n } else {\r\n for(let i = 0; i < rows.length; i++) {\r\n let tds = rows[i].children;\r\n for(let j = 0; j < tds.length; j++) {\r\n if(parseInt(tds[j].dataset.xIndex) <= pos) {\r\n if(parseInt(tds[j].dataset.xIndex) + tds[j].colSpan == pos + cell.colSpan) {\r\n let td = newTd(cellStyle);\r\n let nextSib = tds[j].nextSibling;\r\n if (nextSib) {\r\n rows[i].insertBefore(td.getDOMElement(), nextSib);\r\n } else {\r\n rows[i].appendChild(td.getDOMElement());\r\n }\r\n\r\n break;\r\n } else if(parseInt(tds[j].dataset.xIndex) + tds[j].colSpan > pos + cell.colSpan) {\r\n tds[j].colSpan++;\r\n if(tds[j].rowSpan > 1) i += tds[j].rowSpan - 1;\r\n break;\r\n }\r\n } else if(parseInt(tds[j].dataset.xIndex) > pos) {\r\n let td = newTd(cellStyle);\r\n rows[i].insertBefore(td.getDOMElement(), tds[j]);\r\n break;\r\n }\r\n }\r\n }\r\n\r\n function newTd(cellStyle) {\r\n let td = new WPTB_Cell(mark);\r\n if (cellStyle) {\r\n td.getDOMElement().setAttribute('style', cellStyle);\r\n td.getDOMElement().style.width = null;\r\n td.getDOMElement().style.height = null;\r\n }\r\n td.getDOMElement().style.borderColor = WPTB_TableSettingsData.getTableSetting('borderColor');\r\n return td;\r\n }\r\n\r\n for (var i = 0; i < array.length; i++) {\r\n array[i].push(0);\r\n }\r\n maxAmountOfCells++;\r\n drawTable(array);\r\n table.recalculateIndexes();\r\n table.addColumnWidth();\r\n table.addRowHeight();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n }\r\n };\r\n\r\n /*\r\n * For preventing us to take a lot of time,\r\n * This is just calling the function addColumnAfter, but\r\n * using the previous column to current one as reference.\r\n * @see addColumnAfter\r\n */\r\n\r\n table.addColumnBefore = function () {\r\n var cell = document.querySelector('.wptb-highlighted'),\r\n pos = getCoords(cell)[1];\r\n\r\n if (pos === 0) {\r\n table.addColumnStart();\r\n } else {\r\n table.addColumnAfter(pos - 1);\r\n }\r\n };\r\n\r\n /*\r\n * Luckily, thisfunction is simple,\r\n * it just add a row to the end of table.\r\n */\r\n\r\n table.addRowToTheEnd = function () {\r\n let r = table.insertRow(-1),\r\n td,\r\n aux,\r\n currentTable = document.getElementsByClassName('wptb-preview-table');\r\n r.classList.add( 'wptb-row' );\r\n if (currentTable.length > 0) {\r\n currentTable = currentTable[0];\r\n\r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n td = new WPTB_Cell(mark);\r\n let currentTableTd = currentTable.querySelector('[data-x-index=\"' + i + '\"]');\r\n if( currentTableTd ) {\r\n let currentTdStyle = currentTableTd.getAttribute( 'style' );\r\n\r\n td.getDOMElement().setAttribute( 'style', currentTdStyle );\r\n td.getDOMElement().style.height = null;\r\n }\r\n r.appendChild(td.getDOMElement());\r\n }\r\n\r\n aux = Array.from(array[0]);\r\n array.push(aux);\r\n drawTable(array);\r\n table.recalculateIndexes();\r\n WPTB_Helper.tableRowsColorsReinstall( table );\r\n table.addColumnWidth();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n };\r\n\r\n /*\r\n * Yet another simple function,\r\n * it just add a row to the start of table.\r\n */\r\n\r\n table.addRowToTheStart = function () {\r\n let r = table.insertRow(0),\r\n td,\r\n aux,\r\n currentTable = document.getElementsByClassName('wptb-preview-table'),\r\n currentTableTd,\r\n currentTdStyle;\r\n r.classList.add( 'wptb-row' );\r\n if (currentTable.length > 0) {\r\n currentTable = currentTable[0];\r\n\r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n td = new WPTB_Cell(mark);\r\n let currentTableTd = currentTable.querySelector('[data-x-index=\"' + i + '\"]');\r\n if( currentTableTd ) {\r\n let currentTdStyle = currentTableTd.getAttribute( 'style' );\r\n\r\n td.getDOMElement().setAttribute( 'style', currentTdStyle );\r\n td.getDOMElement().style.height = null;\r\n }\r\n r.appendChild(td.getDOMElement());\r\n }\r\n\r\n aux = Array.from(array[0]);\r\n array.push(aux);\r\n drawTable(array);\r\n table.recalculateIndexes();\r\n WPTB_Helper.tableRowsColorsReinstall( table );\r\n table.addColumnWidth();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n };\r\n\r\n /*\r\n * This function adds a row before the current one.\r\n * Since the biggest factor of problem is a not-started but ongoing rowspan,\r\n * the most of the troubles is not here.\r\n */\r\n\r\n table.addRowBefore = function () {\r\n let cell = document.querySelector('.wptb-highlighted'),\r\n cellStyle = cell.getAttribute('style'),\r\n row = getCoords(cell)[0],\r\n cellNew;\r\n for( let i = row - 1; i >= 0; i-- ) {\r\n let rowChildren = table.rows[i].children;\r\n let rowChildrenLength = rowChildren.length;\r\n if( rowChildrenLength > 0 ) {\r\n for( let j = 0; j < rowChildrenLength; j++ ) {\r\n if( rowChildren[j].rowSpan == 1 ) {\r\n row = i;\r\n cellNew = true;\r\n break;\r\n }\r\n }\r\n }\r\n if ( cellNew ) {\r\n break;\r\n }\r\n }\r\n\r\n if (row === 0) {\r\n table.addRowToTheStart();\r\n } else {\r\n table.addRowAfter( row, cellStyle );\r\n }\r\n };\r\n\r\n /*\r\n * Well... by the name convention of the previous 3 functions,\r\n * it's pretty obvious that this functions attaches a new\r\n * row after highlighted cell row. The greatest obstacle it was\r\n * the possibility of a TR not having the exact amount of columns\r\n * occuped by actual node but rowspanned upper cells. For that purpose\r\n * it was created the function realTimeArray.\r\n * @see realTimeArray\r\n */\r\n\r\n table.addRowAfter = function ( row, cellStyle ) {\r\n let cellRowSpan,\r\n rowAfter,\r\n aux;\r\n\r\n if ( ( row == undefined || typeof row !== 'number' ) && cellStyle == undefined ) {\r\n let cell = document.querySelector('.wptb-highlighted');\r\n cellStyle = cell.getAttribute('style'),\r\n row = getCoords(cell)[0],\r\n cellRowSpan = cell.rowSpan,\r\n rowAfter = row + cellRowSpan - 1;\r\n } else {\r\n rowAfter = row;\r\n }\r\n\r\n\r\n let cellsColSpan = 0;\r\n if ( rowAfter < table.rows.length -1 ) {\r\n for( let i = 0; i <= rowAfter ; i++ ) {\r\n let tableRowsIChildren = table.rows[i].children,\r\n tableRIChildrenLength = tableRowsIChildren.length;\r\n if( tableRIChildrenLength > 0 ) {\r\n for( let j = 0; j < tableRIChildrenLength; j++ ) {\r\n let rowIRowSpan = tableRowsIChildren[j].rowSpan;\r\n\r\n if ( rowIRowSpan - 1 + i > rowAfter ) {\r\n tableRowsIChildren[j].rowSpan++;\r\n }\r\n }\r\n }\r\n }\r\n\r\n let rNext = table.rows[rowAfter + 1],\r\n rNextChildren = rNext.children,\r\n rNextChildrenLength = rNextChildren.length;\r\n\r\n if( rNextChildrenLength > 0 ) {\r\n for ( let i = 0; i < rNextChildrenLength; i++ ) {\r\n cellsColSpan += rNextChildren[i].colSpan;\r\n }\r\n }\r\n } else {\r\n cellsColSpan = array[0].length;\r\n }\r\n\r\n let r = table.insertRow( rowAfter + 1 );\r\n r.classList.add( 'wptb-row' );\r\n\r\n for ( j = 0; j < cellsColSpan; j++ ) {\r\n let td = new WPTB_Cell( mark );\r\n let currentTableTd = table.querySelector('[data-x-index=\"' + j + '\"]');\r\n if( currentTableTd ) {\r\n let currentTdStyle = currentTableTd.getAttribute( 'style' );\r\n\r\n td.getDOMElement().setAttribute( 'style', currentTdStyle );\r\n td.getDOMElement().style.height = null;\r\n }\r\n r.appendChild( td.getDOMElement() );\r\n }\r\n\r\n aux = Array.from(array[0]);\r\n array.push(aux);\r\n drawTable(array);\r\n table.recalculateIndexes();\r\n WPTB_Helper.tableRowsColorsReinstall( table );\r\n table.addColumnWidth();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after');\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n /*\r\n * This function checks the current selected cells\r\n * make a rectangular shape.\r\n * @param Array the abstract table.\r\n * @return false, if not making a rectangle, or\r\n *\tArray an array containing number of rows and columns, if selection makes a rectangle.\r\n */\r\n\r\n table.isSquare = function (a) {\r\n var rowStart = -1,\r\n columnStart = -1,\r\n rowEnd = -1,\r\n columnEnd = -1,\r\n height,\r\n width,\r\n itemsEstimate = 0,\r\n items = 0;\r\n\r\n for (var i = 0; i < a.length; i++) {\r\n for (var j = 0; j < a[i].length; j++) {\r\n if (a[i][j] == 1) {\r\n if ( j < columnStart || columnStart == -1 ) {\r\n columnStart = j;\r\n }\r\n if ( i < rowStart || rowStart == -1 ) {\r\n rowStart = i;\r\n }\r\n }\r\n }\r\n\r\n }\r\n\r\n for (var i = a.length - 1; i > -1; i--) {\r\n for (var j = a[i].length - 1; j > -1; j--) {\r\n if (a[i][j] == 1) {\r\n if ( j > columnEnd ) {\r\n columnEnd = j;\r\n }\r\n if ( i > rowEnd ) {\r\n rowEnd = i;\r\n }\r\n }\r\n }\r\n }\r\n\r\n for (var i = rowStart; i < rowEnd; i++) {\r\n for (var j = columnStart; j < columnEnd; j++) {\r\n if (a[i][j] == 0 || a[i][j] == undefined) {\r\n return false;\r\n }\r\n }\r\n }\r\n\r\n for (var i = 0; i < a.length; i++) {\r\n for (var j = 0; j < a[i].length; j++) {\r\n if (a[i][j] == 1) {\r\n items++;\r\n }\r\n }\r\n }\r\n\r\n height = rowEnd - rowStart + 1;\r\n width = columnEnd - columnStart + 1;\r\n itemsEstimate = height * width;\r\n\r\n if (itemsEstimate !== items) {\r\n return false;\r\n }\r\n return [height, width];\r\n };\r\n\r\n /*\r\n * This function merges all selected cells.\r\n * Well, actually sets the colspan and rowspan of first\r\n * upper left cell in selection and deletes the another selected cells.\r\n */\r\n\r\n table.mergeCells = function () {\r\n var dimensions = table.isSquare(array),\r\n rowspan = dimensions[0],\r\n colspan = dimensions[1],\r\n first = document.querySelector('.wptb-highlighted'),\r\n tds = [].slice.call(document.getElementsByClassName('wptb-highlighted'), 1),\r\n tdsChildrenNew = [];\r\n\r\n for (let i = 0; i < tds.length; i++) {\r\n let tdsInternalElements = tds[i].getElementsByClassName('wptb-ph-element');\r\n if (tdsInternalElements.length > 0) {\r\n let tdsIntElemLength = tdsInternalElements.length;\r\n for (let j = 0; j < tdsIntElemLength; j++) {\r\n tdsChildrenNew.push(tdsInternalElements[j]);\r\n }\r\n }\r\n let p = tds[i].parentNode;\r\n p.removeChild(tds[i]);\r\n }\r\n if (tdsChildrenNew.length > 0) {\r\n for (let i = 0; i < tdsChildrenNew.length; i++) {\r\n first.appendChild(tdsChildrenNew[i]);\r\n }\r\n }\r\n\r\n first.colSpan = colspan;\r\n first.rowSpan = rowspan;\r\n table.recalculateIndexes();\r\n table.reconstraction();\r\n let firstWidth = first.style.width;\r\n let firstDataFixedWidth = first.dataset.wptbFixedWidth;\r\n if( firstWidth ) {\r\n table.addColumnWidth( parseFloat( firstWidth, 10 ) );\r\n } else if( firstDataFixedWidth ) {\r\n table.addColumnWidth();\r\n } else {\r\n table.addColumnWidth( false, true );\r\n }\r\n\r\n let firstHeight = first.style.height;\r\n let firstDataFixedHeight = first.dataset.wptbFixedHeight;\r\n if( firstHeight ) {\r\n table.addRowHeight( parseFloat( firstHeight, 10 ) );\r\n } else if( firstDataFixedHeight ) {\r\n table.addRowHeight();\r\n } else {\r\n table.addRowHeight( false, true );\r\n }\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n /*\r\n * This functions makes the exact inverse as above.\r\n * It resets colspan and rowspan and appends\r\n * the same amount in cells to the table.\r\n * @bug\r\n */\r\n\r\n table.splitCell = function () {\r\n var cell = document.getElementsByClassName('wptb-highlighted')[0],\r\n rowspan = cell.rowSpan,\r\n colspan = cell.colSpan,\r\n cellStyles = cell.getAttribute('style'),\r\n row = getCoords(cell)[0],\r\n thisRow = table.rows[row],\r\n cellXIndex =cell.dataset.xIndex;\r\n\r\n cell.rowSpan = 1;\r\n cell.colSpan = 1;\r\n\r\n for (let i = 1; i < colspan; i++) {\r\n let td = new WPTB_Cell(mark);\r\n td.getDOMElement().setAttribute('style', cellStyles);\r\n td.getDOMElement().classList.add( 'wptb-highlighted' );\r\n if ( cell.nextSibling ) {\r\n thisRow.insertBefore( td.getDOMElement(), cell.nextSibling );\r\n } else {\r\n thisRow.appendChild( td.getDOMElement() );\r\n }\r\n\r\n }\r\n\r\n if (rowspan > 1) {\r\n for (let i = 1; i < rowspan; i++) {\r\n let rowChildInsertBefore = undefined,\r\n rowNext = table.rows[row + i],\r\n rowChildren = rowNext.children,\r\n rowChildrenLength = rowChildren.length;\r\n\r\n if ( rowChildrenLength > 0 ) {\r\n for ( let k = 0; k < rowChildrenLength; k++ ) {\r\n if ( Number( rowChildren[k].dataset.xIndex ) > Number( cellXIndex ) ) {\r\n rowChildInsertBefore = rowChildren[k];\r\n break;\r\n }\r\n }\r\n }\r\n for ( let j = 0; j < colspan; j++ ) {\r\n let td = new WPTB_Cell( mark );\r\n td.getDOMElement().setAttribute( 'style', cellStyles );\r\n if ( rowChildInsertBefore != undefined ) {\r\n rowNext.insertBefore( td.getDOMElement(), rowChildInsertBefore );\r\n } else {\r\n rowNext.appendChild( td.getDOMElement() );\r\n }\r\n }\r\n }\r\n }\r\n\r\n table.recalculateIndexes();\r\n table.reconstraction();\r\n table.addColumnWidth();\r\n table.addRowHeight();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n /*\r\n * Searches for rowspanned cells up to row number meeting it.\r\n * @param number the number of row where the function\r\n * must search up to.\r\n */\r\n\r\n table.findRowspannedCells = function (row) {\r\n var array = [],\r\n difference;\r\n actualPoints = getActualPointsInRow(row);\r\n if (actualPoints === maxAmountOfCells) {\r\n return [];\r\n }\r\n difference = maxAmountOfCells - actualPoints;\r\n\r\n for (var i = row - 1; i >= 0 && difference; i--) {\r\n var tds = table.rows[i].getElementsByTagName('td');\r\n for (var i = 0; i < tds.length; i++) {\r\n if (tds[i].rowSpan > 1) {\r\n array.push(tds[i]);\r\n difference -= tds[i].colSpan;\r\n }\r\n }\r\n }\r\n return array;\r\n\r\n }\r\n\r\n /*\r\n * This function explores the table and adds\r\n * a cell for each lacking one for each row\r\n * to meet an even amount of cells.\r\n */\r\n\r\n table.addLackingCells = function () {\r\n var sumRows = [];\r\n for (var i = 0; i < table.rows.length; i++) {\r\n sumRows.push(0);\r\n }\r\n\r\n for (var i = 0; i < table.rows.length; i++) {\r\n var tds = table.rows[i].getElementsByTagName('td');\r\n for (var j = 0; j < tds.length; j++) {\r\n if (tds[j].rowSpan > 1) {\r\n for (var k = 1; k < tds[j].rowSpan; k++) {\r\n sumRows[i + k]++;\r\n }\r\n }\r\n }\r\n }\r\n\r\n for (var i = 0; i < table.rows.length; i++) {\r\n var tds = table.rows[i].getElementsByTagName('td'),\r\n totalColspan = 0;\r\n for (var j = 0; j < tds.length; j++) {\r\n totalColspan += tds[j].colSpan;\r\n }\r\n totalColspan += sumRows[i];\r\n difference = maxAmountOfCells - totalColspan;\r\n for (var j = 0; j < difference; j++) {\r\n var td = new WPTB_Cell(mark);\r\n table.rows[i].appendChild(td.getDOMElement());\r\n //table.rows[i].insertBefore( td.getDOMElement(), rows[i].nextSibling );\r\n }\r\n }\r\n };\r\n\r\n /*\r\n * This function deletes the row of currently\r\n * selected cell.\r\n */\r\n\r\n table.deleteRow = function () {\r\n let cell = document.querySelector('.wptb-highlighted'),\r\n cellStyles = cell.getAttribute('style'),\r\n rowspan = cell.rowSpan,\r\n row = getCoords(cell)[0],\r\n thisRow,\r\n aux;\r\n\r\n if ( rowspan == undefined ) rowspan = 1;\r\n\r\n for ( let i = 0; i < rowspan; i++ ) {\r\n thisRow = table.rows[row];\r\n let thisRowChildren = thisRow.children,\r\n nextRow = table.rows[row + 1],\r\n nextRowChildren,\r\n nextRowChildrenLength,\r\n tdArr = [];\r\n\r\n if( nextRow != undefined ) {\r\n nextRowChildren = nextRow.children;\r\n nextRowChildrenLength = nextRowChildren.length;\r\n for (let j = 0; j < thisRowChildren.length; j++) {\r\n if ( thisRowChildren[j].rowSpan > 1 ) {\r\n let td = new WPTB_Cell(mark);\r\n td.getDOMElement().setAttribute('style', cellStyles);\r\n td.getDOMElement().colSpan = thisRowChildren[j].colSpan;\r\n td.getDOMElement().rowSpan = thisRowChildren[j].rowSpan - 1;\r\n\r\n let nextRowChildrenK = undefined;\r\n for ( let k = 0; k < nextRowChildrenLength; k++ ) {\r\n if ( Number( nextRowChildren[k].dataset.xIndex ) > Number( thisRowChildren[j].dataset.xIndex ) ) {\r\n nextRowChildrenK = nextRowChildren[k];\r\n break;\r\n }\r\n }\r\n\r\n if ( nextRowChildrenK ) {\r\n tdArr.push( [td, nextRowChildrenK] );\r\n } else {\r\n tdArr.push( [td] );\r\n }\r\n }\r\n }\r\n\r\n if ( tdArr.length > 0 ) {\r\n for ( let k = 0; k < tdArr.length; k++ ) {\r\n if ( tdArr[k][1] != undefined ) {\r\n nextRow.insertBefore( tdArr[k][0].getDOMElement(), tdArr[k][1] );\r\n } else {\r\n nextRow.appendChild( tdArr[k][0].getDOMElement() );\r\n }\r\n }\r\n }\r\n }\r\n\r\n let tableRows = table.rows;\r\n if ( tableRows.length > 0 ) {\r\n for ( let j = 0; j < row; j++ ) {\r\n let jRowChildren = tableRows[j].children;\r\n if ( jRowChildren.length > 0 ) {\r\n for ( let x = 0; x < jRowChildren.length; x++ ) {\r\n if ( jRowChildren[x].rowSpan - 1 >= row - j ) {\r\n jRowChildren[x].rowSpan--;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n aux = Array.from(array[0]);\r\n array.pop(aux);\r\n drawTable(array);\r\n table.getElementsByTagName('tbody')[0].removeChild(table.rows[row]);\r\n\r\n if( table.rows.length == 0 ) {\r\n WPTB_Helper.toggleTableEditMode();\r\n wptbTableSetup.innerHTML = '';\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\r\n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\r\n if( wptbSaveBtn.length > 0 ) {\r\n wptbSaveBtn = wptbSaveBtn[0];\r\n\r\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\r\n wptbSaveBtn.classList.remove('active');\r\n }\r\n } else {\r\n table.recalculateIndexes();\r\n WPTB_Helper.tableRowsColorsReinstall( table );\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n table.reconstraction();\r\n }\r\n }\r\n\r\n undoSelect();\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n\r\n /*\r\n * This function deletes the column of currently\r\n * selected cell. Again, this is way more complicated than\r\n * delete row case.\r\n */\r\n\r\n table.deleteColumn = function () {\r\n let cell = document.querySelector('.wptb-highlighted'),\r\n cellXIndex = cell.dataset.xIndex,\r\n colspan = cell.colSpan;\r\n\r\n for ( let i = 0; i < colspan; i++ ) {\r\n for ( let j = 0; j < table.rows.length; j++ ) {\r\n let rowChildren = table.rows[j].children;\r\n let rowChildrenLength = rowChildren.length;\r\n if( rowChildrenLength > 0 ) {\r\n for ( let k = rowChildrenLength - 1; k >= 0; k-- ) {\r\n if ( Number( rowChildren[k].dataset.xIndex ) == Number( cellXIndex ) ) {\r\n if ( rowChildren[k].colSpan > 1 ) {\r\n rowChildren[k].colSpan--;\r\n } else {\r\n table.rows[j].removeChild( rowChildren[k] );\r\n }\r\n break;\r\n } else if( Number( rowChildren[k].dataset.xIndex ) < Number( cellXIndex ) &&\r\n Number( rowChildren[k].dataset.xIndex ) +\r\n Number( rowChildren[k].colSpan -1 ) >= cellXIndex ) {\r\n if ( rowChildren[k].colSpan > 1 ) {\r\n rowChildren[k].colSpan--;\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n for ( let j = 0; j < table.rows.length; j++ ) {\r\n if (array[j] != undefined)\r\n array[j].pop();\r\n }\r\n\r\n maxAmountOfCells--;\r\n\r\n if( table.querySelectorAll( 'td' ).length == 0 ) {\r\n WPTB_Helper.toggleTableEditMode();\r\n wptbTableSetup.innerHTML = '';\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\r\n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\r\n if( wptbSaveBtn.length > 0 ) {\r\n wptbSaveBtn = wptbSaveBtn[0];\r\n\r\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\r\n wptbSaveBtn.classList.remove('active');\r\n }\r\n } else {\r\n table.recalculateIndexes();\r\n table.tdDefaultWidth();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n table.reconstraction();\r\n }\r\n }\r\n\r\n undoSelect();\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n // @deprecated old generate logic\r\n // document.getElementsByClassName('wptb-table-generator')[0].style.display = 'none';\r\n\r\n array = fillTableArray();\r\n\r\n undoSelect();\r\n drawTable(array);\r\n\r\n wptbTableSetup.appendChild(table);\r\n //if (columns || rows) {\r\n table.recalculateIndexes( true );\r\n //}\r\n table.reconstraction();\r\n table.tdDefaultWidth();\r\n\r\n wptbTableSetup.onresize = function() {\r\n table.tdDefaultWidth();\r\n };\r\n\r\n WPTB_LeftPanel();\r\n\r\n // event hook to signal that table is generated and ready to be used\r\n WPTB_Helper.wptbDocumentEventGenerate('wptb:table:generated', document);\r\n\r\n WPTB_Helper.elementStartScript( table, 'table_setting' );\r\n WPTB_Helper.elementOptionsSet( 'table_setting', table );\r\n\r\n // this code gets the ID of the active element in the toolbar\r\n // and stores it in the data attribute of the common container element \"wpcd_fixed_toolbar\"\r\n// let wptbPhElement = document.getElementsByClassName( 'wptb-ph-element' );\r\n// let wpcdFixedToolbar = document.getElementById( 'wpcd_fixed_toolbar' );\r\n// for ( let i = 0; i < wptbPhElement.length; i++ ) {\r\n// wptbPhElement[i].addEventListener( 'click', function( e ) {\r\n// let wptbToolbar = document.getElementById( 'wpcd_fixed_toolbar' ).children;\r\n// for ( let j = 0; j < wptbToolbar.length; j++ ) {\r\n// let elementStyles = window.getComputedStyle( wptbToolbar[j], 'null' );\r\n// if( elementStyles.getPropertyValue( 'display' ) == 'block' ) {\r\n// wpcdFixedToolbar.dataset.toolbarActiveId = wptbToolbar[j].getAttribute( 'id' );\r\n// }\r\n// }\r\n// }, false );\r\n// }\r\n\r\n// let wptbPanelLeft = document.getElementsByClassName( 'wptb-panel-left' );\r\n// if( wptbPanelLeft.length > 0 ) {\r\n// wptbPanelLeft[0].addEventListener( 'click', function( e ) {\r\n// let toolbarActiveElementId = wpcdFixedToolbar.dataset.toolbarActiveId;\r\n// document.getElementById( toolbarActiveElementId ).style.display = '';\r\n// }, false );\r\n// }\r\n\r\n// let body = document.getElementsByTagName( 'body' );\r\n// if( body.length > 0 ) {\r\n// body[0].addEventListener( 'click', function( e ) {\r\n// if ( e.target.classList.contains( 'wptb-panel-left' ) || WPTB_Helper.findAncestor( e.target, 'wptb-panel-left' ) ) {\r\n// let toolbarActiveElementId = wpcdFixedToolbar.dataset.toolbarActiveId;\r\n// document.getElementById( toolbarActiveElementId ).style.display = '';\r\n// }\r\n// }, false );\r\n// }\r\n};\r\n","const WPTB_TableSettingsData = {\r\n borderColor: '',\r\n /**\r\n *\r\n * @param {string} name\r\n * @param {string} value\r\n */\r\n setTableSetting: function(name, value){\r\n this[name] = value;\r\n },\r\n /**\r\n *\r\n * @param {string} name\r\n * @returns {*}\r\n */\r\n getTableSetting: function (name) {\r\n return this[name];\r\n }\r\n}\r\n\r\n","const WPTB_TableStateSaveManager = function () {\r\n\tthis.tableStateSet = (generate) => {\r\n\t\tif (generate && window.wptbTableStateSaving && Array.isArray(window.wptbTableStateSaving)) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// get table setup\r\n\t\tlet wptbTableSetup = document.getElementsByClassName('wptb-table-setup');\r\n\t\tlet wptbPreviewTable = '';\r\n\t\tif (wptbTableSetup.length > 0) {\r\n\t\t\twptbTableSetup = wptbTableSetup[0];\r\n\r\n\t\t\twptbPreviewTable = wptbTableSetup.querySelector('.wptb-preview-table');\r\n\t\t} else {\r\n\t\t\twptbTableSetup = '';\r\n\t\t}\r\n\r\n\t\t// check if a global array doesn't exist with saved versions of the table\r\n\t\t// them create it\r\n\t\tif (!window.wptbTableStateSaving && !Array.isArray(window.wptbTableStateSaving)) {\r\n\t\t\twindow.wptbTableStateSaving = [];\r\n\t\t}\r\n\r\n\t\t// remove the extra part of the array after changing the table\r\n\t\t// when it is showed in the not last modified version\r\n\t\tif (window.wptbTableStateSaving.length > window.wptbTableStateNumberShow) {\r\n\t\t\twindow.wptbTableStateSaving = window.wptbTableStateSaving.slice(0, window.wptbTableStateNumberShow + 1);\r\n\t\t}\r\n\r\n\t\t// add new state of table\r\n\t\tlet wptbNewTableSetup = '';\r\n\t\tif (wptbTableSetup) {\r\n\t\t\twptbNewTableSetup = wptbTableSetup.cloneNode(true);\r\n\t\t\tconst wptbHighlighted = wptbNewTableSetup.getElementsByClassName('wptb-highlighted');\r\n\t\t\tfor (let i = 0; i < wptbHighlighted.length; i++) {\r\n\t\t\t\twptbHighlighted[i].classList.remove('wptb-highlighted');\r\n\t\t\t}\r\n\t\t\tconst wptbDirectlyhovered = wptbNewTableSetup.getElementsByClassName('wptb-directlyhovered');\r\n\t\t\tfor (let i = 0; i < wptbDirectlyhovered.length; i++) {\r\n\t\t\t\twptbDirectlyhovered[i].classList.remove('wptb-directlyhovered');\r\n\t\t\t}\r\n\t\t\tconst mceContentBodys = wptbNewTableSetup.querySelectorAll('.mce-content-body');\r\n\t\t\tif (mceContentBodys.length > 0) {\r\n\t\t\t\tfor (let k = 0; k < mceContentBodys.length; k++) {\r\n\t\t\t\t\tmceContentBodys[k].classList.remove('mce-content-body');\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tconst dataMceStyle = wptbNewTableSetup.querySelectorAll('[data-mce-style]');\r\n\t\t\tif (dataMceStyle.length > 0) {\r\n\t\t\t\tfor (let k = 0; k < dataMceStyle.length; k++) {\r\n\t\t\t\t\tdataMceStyle[k].removeAttribute('data-mce-style');\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tconst mceIds = wptbNewTableSetup.querySelectorAll('[id^=mce_]');\r\n\t\t\tif (mceIds.length > 0) {\r\n\t\t\t\tfor (let k = 0; k < mceIds.length; k++) {\r\n\t\t\t\t\tmceIds[k].removeAttribute('id');\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tlet cssForTdsWidthAutoValue = '';\r\n\t\tconst { head } = document;\r\n\t\tif (head) {\r\n\t\t\tconst cssForTdsWidthAuto = head.querySelector('style[data-wptb-td-auto-width=\"true\"]');\r\n\t\t\tif (cssForTdsWidthAuto) {\r\n\t\t\t\tcssForTdsWidthAutoValue = cssForTdsWidthAuto.innerHTML;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tlet wptbTableTitle = '';\r\n\t\tconst wptbSetupName = document.getElementById('wptb-setup-name');\r\n\t\tif (wptbSetupName) wptbTableTitle = wptbSetupName.value;\r\n\r\n\t\twindow.wptbTableStateSaving.push([wptbNewTableSetup, cssForTdsWidthAutoValue, wptbTableTitle]);\r\n\r\n\t\t// set new number of state which is showed now\r\n\t\twindow.wptbTableStateNumberShow = window.wptbTableStateSaving.length - 1;\r\n\r\n\t\t// make undo arrow active when the table was changed\r\n\t\tif (window.wptbTableStateSaving.length - 1 > 0) {\r\n\t\t\tlet wptbUndo = document.getElementsByClassName('wptb-undo');\r\n\t\t\tif (wptbUndo.length > 0) {\r\n\t\t\t\twptbUndo = wptbUndo[0];\r\n\r\n\t\t\t\twptbUndo.classList.remove('wptb-undoredo-disabled');\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// make redo arrow not active when the table was changed\r\n\t\tlet wptbRedo = document.getElementsByClassName('wptb-redo');\r\n\t\tif (wptbRedo.length > 0) {\r\n\t\t\twptbRedo = wptbRedo[0];\r\n\r\n\t\t\twptbRedo.classList.add('wptb-undoredo-disabled');\r\n\t\t}\r\n\r\n\t\tlet wptbSaveBtn = document.getElementsByClassName('wptb-save-btn');\r\n\t\tif (wptbSaveBtn.length > 0) {\r\n\t\t\twptbSaveBtn = wptbSaveBtn[0];\r\n\t\t\tif (\r\n\t\t\t\t(!wptbSaveBtn.dataset.wptbTableStateNumberSave && window.wptbTableStateNumberShow == 0) ||\r\n\t\t\t\twindow.wptbTableStateNumberShow == wptbSaveBtn.dataset.wptbTableStateNumberSave ||\r\n\t\t\t\t!wptbPreviewTable\r\n\t\t\t) {\r\n\t\t\t\twptbSaveBtn.classList.add('wptb-save-disabled');\r\n\t\t\t\twptbSaveBtn.classList.remove('active');\r\n\t\t\t} else {\r\n\t\t\t\twptbSaveBtn.classList.remove('wptb-save-disabled');\r\n\t\t\t\twptbSaveBtn.classList.add('active');\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\tthis.tableStateGet = (datawptbUndoredo) => {\r\n\t\tif (datawptbUndoredo && window.wptbTableStateSaving && window.wptbTableStateSaving.length > 0) {\r\n\t\t\t// changes the number of the state which displays now\r\n\t\t\tif (datawptbUndoredo == 'undo') {\r\n\t\t\t\tif (window.wptbTableStateNumberShow > 0) {\r\n\t\t\t\t\twindow.wptbTableStateNumberShow--;\r\n\t\t\t\t} else {\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t} else if (datawptbUndoredo == 'redo') {\r\n\t\t\t\tif (window.wptbTableStateNumberShow < window.wptbTableStateSaving.length) {\r\n\t\t\t\t\twindow.wptbTableStateNumberShow++;\r\n\t\t\t\t} else {\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// add or delete class \"wptb-undoredo-disabled\" for undo button\r\n\t\t\tlet wptbUndo = document.getElementsByClassName('wptb-undo');\r\n\t\t\tif (wptbUndo.length > 0) {\r\n\t\t\t\twptbUndo = wptbUndo[0];\r\n\r\n\t\t\t\tif (window.wptbTableStateNumberShow == 0) {\r\n\t\t\t\t\tif (wptbUndo) {\r\n\t\t\t\t\t\twptbUndo.classList.add('wptb-undoredo-disabled');\r\n\t\t\t\t\t}\r\n\t\t\t\t} else if (window.wptbTableStateNumberShow > 0) {\r\n\t\t\t\t\tif (wptbUndo) {\r\n\t\t\t\t\t\twptbUndo.classList.remove('wptb-undoredo-disabled');\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// add or delete class \"wptb-undoredo-disabled\" for redo button\r\n\t\t\tlet wptbRedo = document.getElementsByClassName('wptb-redo');\r\n\t\t\tif (wptbRedo.length > 0) {\r\n\t\t\t\twptbRedo = wptbRedo[0];\r\n\r\n\t\t\t\tif (window.wptbTableStateNumberShow == window.wptbTableStateSaving.length - 1) {\r\n\t\t\t\t\tif (wptbRedo) {\r\n\t\t\t\t\t\twptbRedo.classList.add('wptb-undoredo-disabled');\r\n\t\t\t\t\t}\r\n\t\t\t\t} else if (window.wptbTableStateNumberShow < window.wptbTableStateSaving.length - 1) {\r\n\t\t\t\t\tif (wptbRedo) {\r\n\t\t\t\t\t\twptbRedo.classList.remove('wptb-undoredo-disabled');\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// add or delete class \"wptb-save-disabled\" for save button\r\n\t\t\tlet wptbSaveBtn = document.getElementsByClassName('wptb-save-btn');\r\n\t\t\tif (wptbSaveBtn.length > 0) {\r\n\t\t\t\twptbSaveBtn = wptbSaveBtn[0];\r\n\t\t\t\tif (\r\n\t\t\t\t\t(!wptbSaveBtn.dataset.wptbTableStateNumberSave && window.wptbTableStateNumberShow == 0) ||\r\n\t\t\t\t\twindow.wptbTableStateNumberShow == wptbSaveBtn.dataset.wptbTableStateNumberSave\r\n\t\t\t\t) {\r\n\t\t\t\t\twptbSaveBtn.classList.add('wptb-save-disabled');\r\n\t\t\t\t\twptbSaveBtn.classList.remove('active');\r\n\t\t\t\t} else {\r\n\t\t\t\t\twptbSaveBtn.classList.add('active');\r\n\t\t\t\t\twptbSaveBtn.classList.remove('wptb-save-disabled');\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// load necessary saved table state\r\n\t\t\tlet wptbTableSetup = document.getElementsByClassName('wptb-table-setup');\r\n\t\t\tif (wptbTableSetup.length > 0) {\r\n\t\t\t\twptbTableSetup = wptbTableSetup[0];\r\n\r\n\t\t\t\t// wptbTableSetup.outerHTML = '';\r\n\t\t\t\tif (window.wptbTableStateSaving[window.wptbTableStateNumberShow]) {\r\n\t\t\t\t\tif (\r\n\t\t\t\t\t\twindow.wptbTableStateSaving[window.wptbTableStateNumberShow][0] &&\r\n\t\t\t\t\t\ttypeof window.wptbTableStateSaving[window.wptbTableStateNumberShow][0] === 'object'\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\tif ('outerHTML' in window.wptbTableStateSaving[window.wptbTableStateNumberShow][0]) {\r\n\t\t\t\t\t\t\twptbTableSetup.outerHTML =\r\n\t\t\t\t\t\t\t\twindow.wptbTableStateSaving[window.wptbTableStateNumberShow][0].outerHTML;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tconst wptbTableSetupNew = document.querySelector('.wptb-table-setup');\r\n\t\t\t\t\tif (wptbTableSetupNew && wptbTableSetupNew.children.length == 0) {\r\n\t\t\t\t\t\tdocument.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\r\n\t\t\t\t\t\twptbSaveBtn.classList.add('wptb-save-disabled');\r\n\t\t\t\t\t\twptbSaveBtn.classList.remove('active');\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tdocument.getElementsByClassName('wptb-table-generator')[0].style.display = 'none';\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// add or change or delete style element in the head for table cells who have auto width\r\n\t\t\t\t\tconst { head } = document;\r\n\t\t\t\t\tif (head) {\r\n\t\t\t\t\t\tconst cssForTdsWidthAutoOld = head.querySelector('style[data-wptb-td-auto-width=\"true\"]');\r\n\t\t\t\t\t\tif (cssForTdsWidthAutoOld) {\r\n\t\t\t\t\t\t\thead.removeChild(cssForTdsWidthAutoOld);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif (window.wptbTableStateSaving[window.wptbTableStateNumberShow][1]) {\r\n\t\t\t\t\t\t\tconst cssForTdsWidthAuto = document.createElement('style');\r\n\t\t\t\t\t\t\tcssForTdsWidthAuto.setAttribute('data-wptb-td-auto-width', true);\r\n\t\t\t\t\t\t\tcssForTdsWidthAuto.innerHTML =\r\n\t\t\t\t\t\t\t\twindow.wptbTableStateSaving[window.wptbTableStateNumberShow][1];\r\n\t\t\t\t\t\t\thead.appendChild(cssForTdsWidthAuto);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// change value of table title field\r\n\t\t\t\t\tconst wptbSetupName = document.getElementById('wptb-setup-name');\r\n\t\t\t\t\tif (typeof window.wptbTableStateSaving[window.wptbTableStateNumberShow][2] !== 'undefined') {\r\n\t\t\t\t\t\tif (wptbSetupName)\r\n\t\t\t\t\t\t\twptbSetupName.value = window.wptbTableStateSaving[window.wptbTableStateNumberShow][2];\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tlet body = document.getElementsByTagName('body');\r\n\t\t\t\tif (body.length > 0) {\r\n\t\t\t\t\tbody = body[0];\r\n\t\t\t\t}\r\n\r\n\t\t\t\tWPTB_Helper.elementOptionsPanelClear();\r\n\t\t\t\tWPTB_LeftPanel();\r\n\r\n\t\t\t\tconst wptbLeftScrollPanelCellSetting = document.getElementById('wptb-left-scroll-panel-cell-settings');\r\n\t\t\t\tif (wptbLeftScrollPanelCellSetting) {\r\n\t\t\t\t\twptbLeftScrollPanelCellSetting.classList.remove('visible');\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\tthis.tableStateClear = function () {\r\n\t\tdelete window.wptbTableStateSaving;\r\n\t\tdelete window.wptbTableStateNumberShow;\r\n\r\n\t\tlet wptbSaveBtn = document.getElementsByClassName('wptb-save-btn');\r\n\t\tif (wptbSaveBtn.length > 0) {\r\n\t\t\twptbSaveBtn = wptbSaveBtn[0];\r\n\r\n\t\t\twptbSaveBtn.removeAttribute('data-wptb-table-state-number-save');\r\n\t\t}\r\n\r\n\t\tlet wptbUndo = document.getElementsByClassName('wptb-undo');\r\n\t\tif (wptbUndo.length > 0) {\r\n\t\t\twptbUndo = wptbUndo[0];\r\n\r\n\t\t\twptbUndo.classList.add('wptb-undoredo-disabled');\r\n\t\t}\r\n\r\n\t\tlet wptbRedo = document.getElementsByClassName('wptb-redo');\r\n\t\tif (wptbRedo.length > 0) {\r\n\t\t\twptbRedo = wptbRedo[0];\r\n\r\n\t\t\twptbRedo.classList.add('wptb-undoredo-disabled');\r\n\t\t}\r\n\t};\r\n};\r\n"]}
|
1 |
+
{"version":3,"sources":["WPTB_ActionsField.js","WPTB_Builder.js","WPTB_Cell.js","WPTB_CutGlueTable.js","WPTB_DropHandle.js","WPTB_ElementCounters.js","WPTB_ElementObject.js","WPTB_ElementOptions.js","WPTB_HeaderToolbox.js","WPTB_Helper.js","WPTB_Initializer.js","WPTB_LeftPanel.js","WPTB_MultipleSelect.js","WPTB_Parser.js","WPTB_Polyfills.js","WPTB_RecalculateIndexes.js","WPTB_Responsive.js","WPTB_Settings.js","WPTB_SortableTable.js","WPTB_Stringifier.js","WPTB_Table.js","WPTB_TableSettingsData.js","WPTB_TableStateSaveManager.js","WPTB_innerElementSet.js","applyGenericItemSettings.js"],"names":["WPTB_ActionsField","wptbActions","document","getElementsByClassName","length","addActionField","actionType","thisNode","body","getElementsByTagName","actions","previousNode","activeElem","classList","remove","parentNode","removeChild","btnDelete","btnCopy","createElement","add","appendChild","type","onclick","event","act","target","el","infArr","className","match","hasOwnProperty","kind","thisRow","WPTB_Helper","rowIsTop","table","findAncestor","contains","dataTitleColumnSet","wptbActionsField","actionsRemove","wptbTableStateSaveManager","WPTB_TableStateSaveManager","tableStateSet","wptbDocumentEventGenerate","copy","activeElement","activeElemParent","Array","isArray","data","elemProt","tinyMceClear","WPTB_ElementObject","insertBefore","getDOMElement","nextSibling","elementCopy","cloneNode","applyGenericItemSettings","WPTB_innerElementSet","setParameters","btnMove","draggable","ondragstart","wptbElementIconsDirectories","tmplIconsDirectories","wp","template","jsonIconsDirectories","IconsDirectories","JSON","parse","dragImages","getElementIcon","dataTransfer","effectAllowed","setDragImage","setData","style","display","actionsHide","ondragend","elementDragEndClear","coordinatesElement","getBoundingClientRect","wptbContainer","correctTop","top","parseFloat","removeEventListener","left","right","clientWidth","addEventListener","leaveFromField","node","relatedTarget","onmouseleave","opacity","WPTB_Builder","table_id","detectMode","http","XMLHttpRequest","urlSet","ajaxurl","open","setRequestHeader","onreadystatechange","d","readyState","status","ans","responseText","getElementById","value","wptbTableSetupEl","WPTB_Parser","WPTB_Table","element","querySelector","dataset","wptbTableContainerMaxWidth","maxWidth","tdDefaultWidth","WPTB_Settings","send","counter","ElementCounters","select","MultipleSelect","initializer","WPTB_Initializer","settings","url","window","location","href","regex","RegExp","results","exec","WPTB_Cell","callback","DOMElement","highlightRow","td","parentRow","columnCount","parseInt","tds","i","classToAdd","ttd","highlightColumn","index","rowCount","tr","padding","jQuery","val","innerBorderWidth","border","ondblclick","stopPropagation","wptbTableSetup","yIndex","wptbSortableTable","currentTarget","newElementProxy","elementStartScript","wptbPhElement","wptbElementTypeClass","wptbTypeElementArr","split","wptbInternalActiveElement","j","wptbInternalActiveElementObj","setCoords","y","x","xIndex","getCoords","coords","appendElement","getCellDimensions","tdStyleObj","getComputedStyle","tdPaddingLeft","getPropertyValue","tdPaddingRight","tdBorderLeftWidth","tdBorderRightWidth","tdPaddingTop","tdPaddingBottom","tdBorderTopWidth","tdBorderBottomWidth","width","offsetWidth","height","offsetHeight","borderCollapse","tableFullStyleObj","tableBorderLeft","tableBorderRight","tableBorderTop","tableBorderBottom","nodeName","toLowerCase","firstChild","lastChild","WPTB_CutGlueTable","cutTableHorizontally","rowBefore","rows","tableRowsIChildren","children","rowSpan","newTdRowspan","sameCellBeforeDivision","wptbCell","mark","tdTopStyle","getAttribute","setAttribute","colSpan","dataXIndex","dataXIndexNext","beforeTd","maxCols","WPTB_RecalculateIndexes","glueTableHorizontally","hasAttribute","dataSameCellBeforeDivision","tdsSameBeforeDivision","querySelectorAll","tdsSameBeforeDivisionJPlusChildren","k","nextRow","cutTableVertically","col","rowChildren","rowChildrenLength","afterTd","rowSpanNewTd","colSpanOld","colSpanNewTd","tdLeftStyle","tdAnalogThisX","tdAnalogThisY","glueTableVertically","jFirstTdGlue","WPTB_DropHandle","thisElem","e","hide","wptbDropHandle","wptbDropBorderMarker","wptbDropBorderMarkerTop","wptbDropBorderMarkerRight","wptbDropBorderMarkerBottom","wptbDropBorderMarkerLeft","toPx","getDragRelativeType","cellRelatedDropHandle","range","createRange","setStart","shadowRoot","createContextualFragment","parentTd","getParentOfType","ondragenter","preventDefault","ondragover","ondragleave","ondrop","getData","wptbMovingMode","text","getDOMParentElement","innerElement","innerElementNext","undefined","onscroll","localName","indics","types","notDragEnter","indexOf","elementDrag","offsetY","layerY","bottom","priv","increment","key","nextIndex","kindIndexProt","wpTemplateId","itemHtml","replace","trim","innerHTML","wptbElementMutch","elementClearFromTinyMce","inElems","inElemObj","WPTB_ElementOptions","elementOptionsSet","capture","WPTB_HeaderToolbox","wrapperQuery","topMargin","assignButtons","manageCellsButton","activateSection","toggleToolboxVisibility","show","init","detail","hexToRgb","hex","result","rgbToHex","rgb","isHex","rgbm","Math","round","toString","toUpperCase","slice","test","icon_directory","hostName","protocol","hostname","img","src","wptbDropHandles","wptbDropBorderMarkers","linkHttpCheckChange","link","convertToAbs","currentLocation","origin","linkArr","linkClean","cls","parentElement","row","parent","getSelectionText","txt","getSelection","selection","elementOptionsPanelClear","elementOptionsGroup","wpColorPickerCheckChangeForTableStateSaving","originalEvent","wpPickerContainer","irisStripMouseUpStateSaveManager","wpColorPickerClear","attribute","isId","input","newInput","decodeURIComponent","getTableId","tableId","getColumnWidth","cell","xIndexes","cellWidth","getRowHeight","yIndexes","cellHeight","wpColorPickerChange","ui","uiColor","color","classe","ps","number","affectedEl","backgroundColor","ratingStar","span","fill","wptbTextMessageSize","numberImputSize","wptbNumberInputs","maxCount","maxValue","onkeydown","thisValue","String","substring","onkeyup","ucfirst","str","charAt","eventName","details","CustomEvent","bubbles","dispatchEvent","WPTB_ElementsScriptsLauncher","deleteEventHandlers","off","elementChildren","replaceAll","string","search","join","mceContentBodys","dataMceStyle","removeAttribute","mceEditFocus","contentEditable","spellCheck","mceIds","elementOptionContainerCustomClassSet","targetInput","customClassForContainer","containerElement","elementOptionContainerAdditionalStyles","containerAdditionalStyles","containerStylesArrOne","containerStylesSet","containerStyleStr","containerStyleStrArr","controlsInclude","functionHandler","acceptEventValues","controlConnectFunctionsName","name","elementKind","elementOptionsGroupIds","optionsGroupIds","elementOptionsGroupId","controlActiveElements","map","regularText","controlInfArr","controlActiveElement","controlUnicClassName","controls","controlName","control","targetControlValue","targetControlValueGet","targetValue","eventValue","push","oneControlInclude","wptbContrlStacksConfigId","tmplControlsConfig","container","jsonControlsConfigJson","jsonControlsConfig","controlClassName","innerElementCopyIncludeHandler","valueDependOnControl","dependOnControlName","targetControlElementClass","valueDependOnControlCorrect","dependOnControlDataGet","dependOnControlElementsArr","dependOnControlElements","valueDependOnControlCorrectObj","s","dependOnControlElementClass","dependOnControlData","Object","keys","forEach","unicClass","appearDependOnControl","dependOnMain","dependOnControlElementChangeHandler","controlContainerElem","dependOnControlElementsValue","dependOn","dependOnControlElementValue","showHideTargetControlElement","prototype","call","targetControlElement","dependOnControlElement","bind","controlsStateManager","targetControlClass","controlChangeIndic","targetControls","selectorElement","elementsSettingsTemplatesJs","elementSettings","elementsSettings","stringify","checked","alignmentValue","elementControlsStateCopy","elementProt","copyElem","infArrProt","infArrCopy","elemProtKind","elemCopyKind","elementsSettingsTemplateJs","elementSettingsProt","elementSettingsCopy","elementSettingValue","elementSettingKeyCopy","elementControlsStateDelete","nameControl","wptbElementDatas","elementContainerClass","elementOptionClassIndic","controlElementParent","elementOptionsScriptsContainer","cellEditActiveClass","startsWith","wptbelementOptionClass","childNodes","controlsConfigJson","controlsConfig","elementOptionsGroupIdsInvolved","elementOptionsGroupInvolved","elementOptionsContainerInvolved","controlScriptsObj","controlappearDependOnControl","controlValueDependOnControl","elementOptionsScriptsContainerIndic","controlsConfigNew","controlKey","tmplControlTemplate","elemContainer","elementControlTargetUnicClass","controlParamCalculateValue","controlTemplate","elementOptionsContainerInvolvedGet","elementOptionsContainer","elementOptionsGroupChildren","elementOptionsContainerOn","elementOptionContainerOn","elementOptionContainer","elementOptionClass","controlContainerElemParent","helperJavascriptElem","helperJavascriptCode","innerText","script","controlScriptsArr","id","unicClassP","controlParamCalculateValueCreateFunction","handlerFunction","managerExternalCssStyles","elementContainer","selector","cssName","cssValue","head","cssForThisElement","cssText","cssTextArrFirst","pop","selectorExists","cssTextArrSecond","cssTextArrThird","cssNameExists","cssTextArrFourth","splice","registerSections","sections","currentSection","sectionElement","sectionDataId","displayType","triggerSectionEvent","visibility","getCurrentSection","getSectionFromUrl","parsedUrl","URL","urlSection","searchParams","get","some","setupSectionButtons","sectionButtons","from","vm","sectionName","wptbSectionButton","wptbSectionDisplayType","setupPanelToggleButtons","$","each","find","click","slideToggle","toggleClass","sectionEvent","setupSidebarToggle","toggleSelector","toggleButton","toggle","externalCssStylesDelete","externalCssStylesCopy","copyElement","activeElemClass","cssForActiveElement","cssForNewElement","infArrCopyEl","cssForActiveElementInnerHTML","cssForNewElementInnerHTML","elementsStylesConvertToObject","stylesElements","stylesObj","styleElemId","elementsStylesSetFromObject","jsonObject","styleCss","saveTable","startSaving","previewSaving","wptbTableStateNumberSave","wptbTableStateNumberShow","bar","toggleTableEditMode","wptb_admin_object","t","messagingArea","code","datas","postId","rs","wptbId","paramIdsNecessaryChange","codeClone","columns","WPTB_Stringifier","outerHTML","datas_containers","styleObjJson","messagingAreaText","setTimeout","params","title","content","elements_datas","elements_styles","security_code","preview_saving","action","builderPageUrl","history","pushState","wptbPreviewTable","wptbPreviewBtn","wptbPreviewBtnHref","previewHref","wptbSaveBtn","clickOnFreeSpace","cellModeBackground","wpcdFixedToolbar","elementAjax","dataAjaxData","element_name","element_ajax_data","close","leftScrollPanelCurtain","leftScrollPanelCellSettings","toggleEditMode","deactivateMultipleSelectMode","wptbPreviewTableTds","activateMultipleSelectMode","checkingDimensionValue","dimension","searchIndex","checkSetGetStyleSizeValue","styleName","computedStyleName","elemStyleValue","elementStyles","checkSetGetStyleColorValue","set","elemStyleColorValue","checkSetGetStyleValue","getValueMaxCountSameElementsInArray","arr","check","countEmpty","maxPropName","recalculateIndexes","tableRowsColorsReinstall","tableIndex","tableHeaderBackground","tableEvenRowBackground","tableOddRowBackground","parentType","dragRelativeType","setDragRelativeType","getElementColorStylesHex","showControlsOnElementMount","showElementsListOnRemove","blockTinyMCEManageCells","addBlocker","blockerElement","removeBlocker","cells","MIN_COLUMNS","MIN_ROWS","MAX_COLUMNS","MAX_ROWS","tableGenerator","columnsDecrementButton","columnsIncrementButton","rowsDecrementButton","rowsIncrementButton","columnsInput","rowsInput","WptbResponsive","WPTB_LeftPanel","wptbElementButtons","wptbElement","wptbTablesEditModeCloseButton","wptbBuilderPanel","wptbHeader","selectedCells","multipleCellMode","isActivated","pushSelectedCell","flushSelectedCells","getFirst","minXIndex","minYIndex","first","getLast","maxXIndex","maxYIndex","last","removeAllButFirst","div","columnTitleMobile","hasDontEnumBug","propertyIsEnumerable","dontEnums","dontEnumsLength","obj","TypeError","prop","trs","maxColsFull","tdsArr","jMainIter","z","responsiveWrapperId","mainContainerQuery","responsiveTable","loaded","addContainerToDom","responsiveContainer","mainContainer","Error","responsiveElement","load","WPTB_ControlsManager","callControlScript","startUp","tablePreview","elems","wptbRelativeElements","wptbUndo","tableStateGet","wptbUndoredo","wptbUndoRedoContainer","wptbRedo","shortcodePopupWindow","onbeforeunload","wptbSaveDisabled","previewId","floor","random","newHref","tableTitleField","onchange","WPTB_SortableTable","topRow","sortModeSwitcher","active","sortableTableVerticalStart","sortingCellMouseMoveSwitcher","wptbSortableTableVertical","sortableTableHorizontalStart","wptbSortableTableHorizontal","sortableTableInitialization","sortingCellMouseMoveVertical","tdMouseLeave","sortingCellMouseMoveHorizontal","sortingCellMouseMov","tagName","offsetX","layerX","xMatch","clientHeight","sortableTable","tableWasSorted","rowspan","rowNum","rowsValuesArr","rowsTdFirst","tdYCoordsRowSpanPrevious","tdsChanged","changeSortingTdsCollection","tdRowspan","textElementsValues","textElementsValuesGet","rowsTd","orderBy","setSortedAscDataAttr","sort","prev","next","sortOrder","unshift","tBody","rowsValObj","colspan","colNum","columnsValuesArr","columnsTdFirst","tdXCoordsColSpanPrevious","tdColspan","columnsTd","tdsColumn","columnsValObj","removeCellsAttrAfterDivision","tableSM","dataAttr","prevValue","nextValue","textElements","p","tdIndexSpanPrev","tdsCollectionChanged","collectionTds","collectionTdsJSpan","collectionTdsJSpanProperty","indexName","indexNameCamelCase","indexNamePerpendicularCamelCase","tdSpanProperty","tableGroupCount","tdSpan","tdsAll","codeMain","tableColumns","minWidth","innerElements","wptbActionsLength","dataMceBogus","array","wptb_preview_table","maxAmountOfCells","maxAmountOfRows","cs","noCells","singleCells","multipleCells","cellSettings","position","column","cellHighlighted","markedCells","controlElemIds","elementControlSizeUnicClass","elementControlSizeFixedUnicClass","sizeName","getSizeFunctionName","size","cellSizeInputs","cellSizeFixedInput","isSquare","settingId","settingElem","countMarkedCells","realTimeArray","carried","cols","matriz","items","justAssigned","amount","carriedRowspans","cellsBuffer","cellPointer","xPosition","stepsToMove","celda","drawTable","a","undoSelect","fillTableArray","colspansSums","colspanSumInRow","max","apply","getActualPointsInRow","points","skipInCols","reconstraction","insertRow","borderWidth","setMaxAmountOfCells","getMaxAmountOfCells","addColumnWidth","cleaner","highlighted","tableTdsFor","tableRows","widthIsSet","arrayTdsFromPreviousRow","wptbFixedWidth","tableTdsSumMaxWidth","tableTdsSumMaxWidthFixed","tableTdsSumMaxWidthAuto","wptbTableSetupWidth","arrayCellsWidthFixedHelper","arrayCellsWidthAutoHelper","tdPaddingCommon","tableTdBorderCommonWidth","cssForTdsWidthAuto","borderLeftWidth","borderRightWidth","tableBorderCommon","wptbTdWidthAuto","wptbCssTdAutoWidth","tableTdBorderLeftWidth","tableTdBorderRightWidth","CellsWidthAutoCount","wptbTableTdsSumMaxWidth","wptbCellsWidthAutoCount","mergingСellsHorizontally","wptbFixedWidthSize","styleElementCreate","tableTdWidthAuto","tableTdsWidthAutoCommon","cssForTdsWidthAutoOld","wptbTableAlignment","float","addRowHeight","dataYIndex","heightIsSet","arrayTdsPrevious","wptbFixedHeight","mergingCellsVertically","forBreak","addColumnEnd","currentTable","currentTableTd","currentTdStyle","borderColor","WPTB_TableSettingsData","getTableSetting","addColumnStart","firstCell","addColumnAfter","c_pos","cellStyle","pos","newTd","nextSib","addColumnBefore","addRowToTheEnd","r","aux","addRowToTheStart","addRowBefore","cellNew","addRowAfter","cellRowSpan","rowAfter","cellsColSpan","tableRIChildrenLength","rowIRowSpan","rNext","rNextChildren","rNextChildrenLength","rowStart","columnStart","rowEnd","columnEnd","itemsEstimate","mergeCells","dimensions","tdsChildrenNew","tdsInternalElements","tdsIntElemLength","firstWidth","firstDataFixedWidth","firstHeight","firstDataFixedHeight","splitCell","cellStyles","cellXIndex","rowChildInsertBefore","rowNext","Number","findRowspannedCells","difference","actualPoints","addLackingCells","sumRows","totalColspan","deleteRow","thisRowChildren","nextRowChildren","nextRowChildrenLength","tdArr","nextRowChildrenK","jRowChildren","deleteColumn","onresize","setTableSetting","generate","wptbTableStateSaving","wptbNewTableSetup","wptbHighlighted","wptbDirectlyhovered","cssForTdsWidthAutoValue","wptbTableTitle","wptbSetupName","datawptbUndoredo","wptbTableSetupNew","wptbLeftScrollPanelCellSetting","tableStateClear","classId","parentCell","elemKind","onmouseover","wptbElements","elementIndexesArr","elementIndexMax","wptbNodeattributes","attributes","attr","newDataAttributeName","newDataAttributeValue","nodeValue","kindIndexProtArr","node_wptb_element_kind_num","onmouseenter"],"mappings":";;AAAA,IAAIA,oBAAoB,SAApBA,iBAAoB,GAAW;AAAA;;AAC/B;AACA,SAAKC,WAAL;AACA,QAAIC,SAASC,sBAAT,CAAiC,cAAjC,EAAkDC,MAAlD,IAA4D,CAAhE,EAAoE;AAChE,aAAKH,WAAL,GAAmBC,SAASC,sBAAT,CAAiC,cAAjC,EAAkD,CAAlD,CAAnB;AACH;;AAED,SAAKE,cAAL,GAAsB,UAAEC,UAAF,EAAcC,QAAd,EAA4B;AAC9C,YAAIC,OAAON,SAASO,oBAAT,CAA+B,MAA/B,EAAwC,CAAxC,CAAX;;AAEA,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ACD3H,oBAAY0I,kBAAZ,CAAgCnD,QAAQjE,aAAR,EAAhC;AACA,YAAI8P,mBAAJ,CAAyB7L,OAAzB,EAAkCoC,KAAlC,EAAyC+I,aAAzC;AACA1S,iBAAS+H,OAAT,CAAiBwK,SAAjB,CAA2BhL,QAAQzF,IAAnC;AACH;;AAEDiE,SAAKg8B,YAAL,GAAoB,UAAWzgC,KAAX,EAAmB;AACnC,YAAIA,MAAME,MAAN,CAAab,SAAb,CAAuByB,QAAvB,CAAiC,kBAAjC,CAAJ,EAA4D;AACxD;AACH;;AAED,YAAIE,mBAAmB,IAAIxC,iBAAJ,EAAvB;;AAEAwC,yBAAiBnC,cAAjB,CAAiC,CAAjC,EAAoC4F,IAApC;;AAEAzD,yBAAiBsB,aAAjB,CAAgCmC,IAAhC;;AAEAA,aAAKpF,SAAL,CAAeC,MAAf,CAAuB,kBAAvB;AACH,KAZD;;AAcAmF,SAAKE,YAAL,GAAoB,UAAW3E,KAAX,EAAmB;AACnC,YAAIgB,mBAAmB,IAAIxC,iBAAJ,EAAvB;;AAEAwC,yBAAiBwD,cAAjB,CAAiCxE,KAAjC,EAAwCyE,IAAxC;AACH,KAJD;AAKH,CApFD","file":"admin.js","sourcesContent":["var WPTB_ActionsField = function() {\n //this.wptbBorderMarker;\n this.wptbActions;\n if( document.getElementsByClassName( 'wptb-actions' ).length != 0 ) {\n this.wptbActions = document.getElementsByClassName( 'wptb-actions' )[0];\n }\n \n this.addActionField = ( actionType, thisNode ) => {\n let body = document.getElementsByTagName( 'body' )[0];\n \n let actions = document.getElementsByClassName( 'wptb-actions' );\n if( actions.length != 0 ) {\n let previousNode = actions[0].activeElem;\n if( previousNode ) {\n previousNode.classList.remove( 'wptb-directlyhovered' );\n }\n \n while( actions.length != 0 ) {\n actions[0].parentNode.removeChild( actions[0] );\n }\n }\n \n if( actionType == 1 ) {\n \n let btnDelete, btnCopy;\n\n btnDelete = document.createElement( 'span' ),\n btnCopy = document.createElement( 'span' ),\n actions = document.createElement( 'div' );\n\n actions.classList.add( 'wptb-actions' );\n btnDelete.classList.add( 'dashicons', 'dashicons-trash', 'wptb-delete-action' );\n btnCopy.classList.add( 'dashicons', 'dashicons-admin-page', 'wptb-duplicate-action' );\n \n actions.appendChild( btnCopy );\n actions.appendChild( btnDelete );\n \n body.appendChild( actions );\n\n actions.activeElem = thisNode;\n\n actions.type = 1;\n\n btnDelete.onclick = function( event ) {\n let act = event.target.parentNode.activeElem,\n el = act.parentNode;\n let infArr = act.className.match( /wptb-element-(.+)-(\\d+)/i );\n// if( act && infArr && Array.isArray( infArr ) ) {\n// WPTB_Helper.elementControlsStateDelete( act );\n// WPTB_Helper.externalCssStylesDelete( infArr[0] );\n// }\n \n if( act ) {\n el.removeChild( act );\n }\n\n if( act && typeof act === 'object' && act.hasOwnProperty( 'kind' ) && act.kind == 'text' ) {\n let thisRow = el.parentNode;\n \n if( WPTB_Helper.rowIsTop( thisRow ) ) {\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\n\n if( table.classList.contains( 'wptb-table-preview-head' ) ) {\n WPTB_Helper.dataTitleColumnSet( table );\n }\n }\n }\n\n let wptbActionsField = new WPTB_ActionsField();\n wptbActionsField.actionsRemove();\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n\n WPTB_Helper.wptbDocumentEventGenerate('element:removed:dom', document, act);\n };\n\n btnCopy.onclick = ( event ) => {\n let copy,\n infArr,\n type;\n let activeElement = event.target.parentNode.activeElem;\n let activeElemParent = activeElement.parentNode;\n infArr = activeElement.className.match( /wptb-element-(.+)-(\\d+)/i );\n if( infArr && Array.isArray( infArr ) ) {\n type = infArr[1];\n let data = {};\n data.kind = type;\n data.elemProt = activeElement;\n data.tinyMceClear = true;\n copy = new WPTB_ElementObject( data );\n //WPTB_Helper.elementControlsStateCopy( activeElement, copy.getDOMElement() );\n //WPTB_Helper.externalCssStylesCopy( activeElement, copy.getDOMElement() );\n //WPTB_Helper.elementStartScript( copy.getDOMElement() );\n \n activeElemParent.insertBefore( copy.getDOMElement(), activeElement.nextSibling );\n } else {\n copy = {};\n let elementCopy = activeElement.cloneNode( true );\n elementCopy.classList.remove( 'wptb-directlyhovered' );\n \n copy.getDOMElement = function() {\n return elementCopy;\n }\n \n applyGenericItemSettings( copy );\n \n activeElemParent.insertBefore( copy.getDOMElement(), activeElement.nextSibling );\n \n WPTB_Helper.wptbDocumentEventGenerate( 'wptb-inner-element:copy', activeElement, copy.getDOMElement() );\n }\n \n WPTB_innerElementSet( copy.getDOMElement() );\n\n let wptbActionsField = new WPTB_ActionsField( 1, activeElement );\n wptbActionsField.setParameters( activeElement );\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n \n \n if( thisNode.classList.contains( 'wptb-ph-element' ) ) {\n let btnMove;\n btnMove = document.createElement( 'span' );\n btnMove.classList.add( \"dashicons\", \"dashicons-move\", 'wptb-move-action' );\n btnMove.draggable = true;\n actions.appendChild( btnMove );\n \n btnMove.ondragstart = ( event ) => {\n let wptbElementIconsDirectories = 'wptb-element-icons-directories';\n let tmplIconsDirectories = wp.template( wptbElementIconsDirectories );\n let data = {};\n let jsonIconsDirectories = tmplIconsDirectories( data );\n let IconsDirectories = JSON.parse( jsonIconsDirectories );\n\n let dragImages,\n actions = event.target.parentNode,\n activeElem = actions.activeElem,\n infArr,\n type;\n infArr = activeElem.className.match( /wptb-element-(.+)-(\\d+)/i );\n if( infArr && Array.isArray( infArr ) ) {\n type = infArr[1];\n activeElem.classList.add( 'wptb-moving-mode' );\n\n if( IconsDirectories && typeof IconsDirectories === 'object' && IconsDirectories[type] ) {\n dragImages = WPTB_Helper.getElementIcon( IconsDirectories[type] );\n }\n\n event.dataTransfer.effectAllowed = 'move';\n event.dataTransfer.setDragImage( dragImages, 0, 0 );\n event.dataTransfer.setData( 'node', 'wptb-element-' + infArr[1] + '-' + infArr[2] );\n event.dataTransfer.setData( 'wptb-moving-mode', 'wptb-element-' + infArr[1] + '-' + infArr[2] );\n event.dataTransfer.setData( 'wptbElIndic-' + infArr[1], 'wptbElIndic-' + infArr[1] );\n let act = event.target.parentNode.activeElem;\n if( act.kind == 'text' ) {\n let thisRow = act.parentNode.parentNode;\n \n if( WPTB_Helper.rowIsTop( thisRow ) ) {\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\n\n if( table.classList.contains( 'wptb-table-preview-head' ) ) {\n WPTB_Helper.dataTitleColumnSet( table );\n }\n }\n }\n } else {\n this.style.display = 'none';\n }\n\n this.actionsHide();\n };\n\n btnMove.ondragend = ( event ) => {\n WPTB_Helper.elementDragEndClear();\n }\n }\n\n actions.style.display = 'flex';\n\n this.wptbActions = actions;\n }\n\n WPTB_Helper.wptbDocumentEventGenerate('wptb:actionfield:generated', document);\n }\n \n this.setParameters = ( thisNode ) => {\n \n if( ! this.wptbActions ) {\n let actions = document.getElementsByClassName( 'wptb-actions' );\n if( actions.length > 0 ) {\n this.wptbActions = actions[0];\n } else {\n this.wptbActions = false;\n }\n }\n \n if( this.wptbActions && this.wptbActions.classList.contains( 'wptb-actions' ) ) {\n this.wptbActions.style.display = 'flex';\n } else {\n return;\n }\n \n let coordinatesElement = thisNode.getBoundingClientRect();\n \n let wptbContainer = document.getElementsByClassName( 'wptb-container' )[0];\n let correctTop = () => {\n let coordinatesElement = thisNode.getBoundingClientRect();\n this.wptbActions.style.top = parseFloat( coordinatesElement.top ) - 15 + 'px';\n }\n wptbContainer.removeEventListener( 'scroll', correctTop, false );\n \n this.wptbActions.style.top = parseFloat( coordinatesElement.top ) - 15 + 'px';\n this.wptbActions.style.left = ( parseFloat( coordinatesElement.right ) - parseFloat( this.wptbActions.clientWidth ) ) + 1 + 'px';\n \n this.wptbActions.style.display = 'flex';\n thisNode.classList.add( 'wptb-directlyhovered' );\n \n wptbContainer.addEventListener( 'scroll', correctTop, false );\n }\n \n this.leaveFromField = ( event, node, actionType ) => {\n if( ! this.wptbActions ) {\n let actions = document.getElementsByClassName( 'wptb-actions' );\n if( actions.length > 0 ) {\n this.wptbActions = actions[0];\n } else {\n this.wptbActions = false;\n }\n }\n \n if( ! this.wptbActions ) {\n return;\n }\n \n if( event.relatedTarget ) {\n if ( event.relatedTarget.classList.contains( 'wptb-actions' ) ||\n event.relatedTarget.classList.contains( 'wptb-move-action' ) ||\n event.relatedTarget.classList.contains( 'wptb-duplicate-action' ) ||\n event.relatedTarget.classList.contains( 'wptb-delete-action' ) || event.relatedTarget.classList.contains( 'wptb-prebuilt-mark-action' ) )\n {\n if( ! this.wptbActions ) {\n this.wptbActions = document.getElementsByClassName( 'wptb-actions' )[0];\n }\n this.wptbActions.onmouseleave = ( event ) => {\n if( event.relatedTarget != null && ( event.relatedTarget.classList.contains( 'wptb-ph-element' ) || \n WPTB_Helper.findAncestor( event.relatedTarget, 'wptb-ph-element') ) && event.relatedTarget != this.wptbActions.activeElem &&\n WPTB_Helper.findAncestor( event.relatedTarget, 'wptb-directlyhovered' ) != this.wptbActions.activeElem ) {\n \n// this.wptbActions.style.display = 'none';\n// event.relatedTarget.parentNode.parentNode.classList.remove( 'wptb-directlyhovered' );\n//\n// let wptbActionsField = new WPTB_ActionsField();\n//\n// wptbActionsField.addActionField( 1, event.relatedTarget.parentNode.parentNode );\n//\n// wptbActionsField.setParameters( event.relatedTarget.parentNode.parentNode );\n } else {\n \n }\n \n let wptbActionsField = new WPTB_ActionsField();\n\n wptbActionsField.leaveFromField( event, event.relatedTarget.parentNode.parentNode );\n \n event.target.activeElem.classList.remove( 'wptb-directlyhovered' );\n }\n\n return;\n } \n }\n \n node.classList.remove( 'wptb-directlyhovered' );\n this.wptbActions.style.display = 'none';\n \n if( event.relatedTarget ) {\n if( event.relatedTarget.classList.contains( 'wptb-ph-element' ) || WPTB_Helper.findAncestor( event.relatedTarget, 'wptb-ph-element' ) ) {\n this.addActionField( 1, event.relatedTarget.parentNode );\n\n this.setParameters( event.relatedTarget.parentNode );\n }\n }\n }\n \n this.actionsRemove = () => {\n if( ! this.wptbActions ) {\n let actions = document.getElementsByClassName( 'wptb-actions' );\n if( actions.length > 0 ) {\n this.wptbActions = actions[0];\n }\n }\n \n if( this.wptbActions ) {\n this.wptbActions.parentNode.removeChild( this.wptbActions );\n }\n }\n \n this.actionsHide = () => {\n if( ! this.wptbActions ) {\n let actions = document.getElementsByClassName( 'wptb-actions' );\n if( actions.length > 0 ) {\n this.wptbActions = actions[0];\n }\n }\n \n if( this.wptbActions ) {\n this.wptbActions.style.opacity = 0;\n }\n }\n}","(function () {\n var WPTB_Builder = function () {\n var table_id = WPTB_Helper.detectMode();\n if ( table_id ) {\n var http = new XMLHttpRequest(),\n urlSet = ajaxurl + \"?action=get_table\" + '&id=' + table_id;\n http.open('GET', urlSet, true);\n http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');\n http.onreadystatechange = function (d) {\n if (this.readyState == 4 && this.status == 200) {\n var ans = JSON.parse( http.responseText );\n document.getElementById('wptb-setup-name').value = ans[0];\n \n if( ans[1] ) {\n // @deprecated old generate logic\n // document.getElementsByClassName('wptb-table-generator')[0].style.display = 'none';\n let wptbTableSetupEl = document.getElementsByClassName('wptb-table-setup')[0];\n wptbTableSetupEl.appendChild( WPTB_Parser( ans[1] ) );\n \n let body = document.getElementsByTagName('body')[0];\n \n WPTB_Table();\n let element = document.querySelector( '.wptb-preview-table' );\n if( element ) {\n let infArr = element.className.match( /wptb-element-((.+-)\\d+)/i );\n if( ! infArr ) {\n element.classList.add( 'wptb-element-main-table_setting-' + table_id );\n }\n \n if( element.dataset.wptbTableContainerMaxWidth ) {\n wptbTableSetupEl.style.maxWidth = element.dataset.wptbTableContainerMaxWidth + 'px';\n \n element.tdDefaultWidth();\n }\n }\n \n //WPTB_LeftPanel();\n WPTB_Settings();\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n } else {\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\n }\n \n return;\n }\n };\n http.send(null);\n } else {\n // @deprecated old generate logic\n // document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n document.counter = new ElementCounters();\n document.select = new MultipleSelect();\n\n var initializer = WPTB_Initializer();\n settings = WPTB_Settings();\n };\n\n let url = window.location.href,\n regex = new RegExp('[?&]page=wptb-builder'),\n results = regex.exec( url );\n if ( results ) {\n document.addEventListener('DOMContentLoaded', WPTB_Builder);\n }\n})();","var WPTB_Cell = function ( callback, DOMElement ) {\n\n function highlightRow(td) {\n var parentRow = td.parentNode,\n columnCount = parseInt(document.getElementById('wptb-columns-number').value),\n tds = document.getElementsByClassName('wptb-preview-table')[0].getElementsByTagName('td');\n for (var i = 0; i < tds.length; i++) {\n tds[i].classList.remove('wptb-highlighted-row-first', 'wptb-highlighted-row-last', 'wptb-highlighted-row-inner', 'wptb-highlighted-column-first', 'wptb-highlighted-column-last', 'wptb-highlighted-column-inner');\n }\n for (var i = 0; i < columnCount; i++) {\n\n var classToAdd = i == 0 ? 'wptb-highlighted-row-first' : i == columnCount - 1 ? 'wptb-highlighted-row-last' : 'wptb-highlighted-row-inner';\n var ttd = parentRow.getElementsByTagName('td')[i];\n if (ttd !== td) {\n ttd.classList.add(classToAdd);\n }\n }\n }\n\n function highlightColumn(td) {\n\n var index,\n parentRow = td.parentNode,\n columnCount = parseInt(document.getElementById('wptb-columns-number').value), rowCount = parseInt(document.getElementById('wptb-rows-number').value), table = document.getElementsByClassName('wptb-preview-table')[0];\n for (var i = 0; i < columnCount; i++) {\n if (parentRow.getElementsByTagName('td')[i] === td) {\n index = i;\n break;\n }\n }\n\n for (var i = 0; i < rowCount; i++) {\n var classToAdd = i == 0 ? 'wptb-highlighted-column-first' : i == rowCount - 1 ? 'wptb-highlighted-column-last' : 'wptb-highlighted-column-inner';\n var tr = table.getElementsByTagName('tr')[i];\n if (tr.getElementsByTagName('td')[index] !== td) {\n tr.getElementsByTagName('td')[index].classList.add(classToAdd);\n }\n }\n }\n\n if( ! DOMElement ) {\n DOMElement = document.createElement(\"td\");\n\n DOMElement.style.padding = jQuery('#wptb-table-padding-number').val() + 'px';\n\n var innerBorderWidth = jQuery('#wptb-table-inner-border-number').val();\n\n if (innerBorderWidth != '' && parseInt(innerBorderWidth) != 0) {\n DOMElement.style.border = innerBorderWidth + 'px solid ' + jQuery('#wptb-table-border-color').val();\n }\n\n DOMElement.classList.add('wptb-droppable', 'wptb-cell');\n }\n\n DOMElement.draggable = false;\n if ( callback ) {\n DOMElement.onclick = callback;\n }\n\n // Cell double click handler\n DOMElement.ondblclick = function( event ) {\n event.stopPropagation();\n let wptbTableSetup = document.querySelector('.wptb-table-setup')\n if(wptbTableSetup && !wptbTableSetup.classList.contains('wptb-preview-table-manage-cells') &&\n (event.target.dataset.yIndex !== '0' || wptbTableSetup.dataset.wptbSortableTable !== '1') &&\n event.target == event.currentTarget) {\n WPTB_Helper.wptbDocumentEventGenerate( 'table:cell:dblclick', event.target )\n\n let element = WPTB_Helper.newElementProxy( 'text' )\n element = element.getDOMElement()\n\n DOMElement.appendChild( element )\n\n WPTB_innerElementSet( element );\n }\n }\n\n WPTB_innerElementSet( DOMElement );\n\n WPTB_Helper.elementStartScript( DOMElement, 'table_cell_setting' );\n\n let wptbPhElement = DOMElement.getElementsByClassName( 'wptb-ph-element' );\n\n if ( wptbPhElement.length > 0 ) {\n for( let i = 0; i < wptbPhElement.length; i++ ) {\n wptbPhElement[i].getDOMElement = function() {\n return wptbPhElement[i];\n }\n\n WPTB_innerElementSet( wptbPhElement[i] );\n\n let wptbElementTypeClass = wptbPhElement[i].className.match( /wptb-element-((.+-)\\d+)/i );\n if( wptbElementTypeClass && Array.isArray( wptbElementTypeClass ) ) {\n let wptbTypeElementArr = wptbElementTypeClass[1].split( '-' );\n wptbPhElement[i].kind = wptbTypeElementArr[0];\n applyGenericItemSettings( wptbPhElement[i], wptbElementTypeClass[1] );\n let wptbInternalActiveElement = wptbPhElement[i].getElementsByClassName( 'wptb-in-element' );\n if ( wptbInternalActiveElement.length > 0 ) {\n for ( let j = 0; j < wptbInternalActiveElement.length; j++ ) {\n let wptbInternalActiveElementObj = {};\n wptbInternalActiveElementObj.getDOMElement = function() {\n return wptbInternalActiveElement[j];\n }\n\n applyGenericItemSettings( wptbInternalActiveElementObj );\n }\n }\n }\n }\n }\n\n this.getDOMElement = function () {\n return DOMElement;\n };\n\n this.setCoords = function (y, x) {\n var el = this.getDOMElement();\n el.dataset.yIndex = y;\n el.dataset.xIndex = x;\n };\n\n this.getCoords = function () {\n var coords,\n el = this.getDOMElement();\n coords.x = el.dataset.xIndex;\n coords.y = el.dataset.yIndex;\n return coords;\n };\n\n this.appendElement = function (node) {\n getDOMElement().appendChild(node);\n };\n\n DOMElement.getCellDimensions = function() {\n\n let tdStyleObj = window.getComputedStyle( this, null );\n\n let tdPaddingLeft = tdStyleObj.getPropertyValue( 'padding-left' );\n let tdPaddingRight = tdStyleObj.getPropertyValue( 'padding-right' );\n\n let tdBorderLeftWidth = tdStyleObj.getPropertyValue( 'border-left-width' );\n let tdBorderRightWidth = tdStyleObj.getPropertyValue( 'border-right-width' );\n\n let tdPaddingTop = tdStyleObj.getPropertyValue( 'padding-top' );\n let tdPaddingBottom = tdStyleObj.getPropertyValue( 'padding-bottom' );\n\n let tdBorderTopWidth = tdStyleObj.getPropertyValue( 'border-top-width' );\n let tdBorderBottomWidth = tdStyleObj.getPropertyValue( 'border-bottom-width' );\n\n let width = parseInt( this.offsetWidth, 10 ) -\n parseInt( tdPaddingLeft, 10 ) -\n parseInt( tdPaddingRight, 10 );\n\n let height = parseInt( this.offsetHeight, 10 ) -\n parseInt( tdPaddingTop, 10 ) -\n parseInt( tdPaddingBottom, 10 );\n let table = WPTB_Helper.findAncestor( this, 'wptb-preview-table' );\n if(table) {\n if(table.style.borderCollapse === 'collapse') {\n width = width - ( parseInt( tdBorderLeftWidth, 10 ) / 2 ) -\n ( parseInt( tdBorderRightWidth, 10 ) / 2 );\n height = height - ( parseInt( tdBorderTopWidth, 10 ) / 2 ) -\n ( parseInt( tdBorderBottomWidth, 10 ) / 2 );\n let tableFullStyleObj = window.getComputedStyle( table, null );\n let tableBorderLeft = tableFullStyleObj.getPropertyValue( 'border-left-width' );\n let tableBorderRight = tableFullStyleObj.getPropertyValue( 'border-right-width' );\n let tableBorderTop = tableFullStyleObj.getPropertyValue( 'border-top-width' );\n let tableBorderBottom = tableFullStyleObj.getPropertyValue( 'border-bottom-width' );\n\n let tr = this.parentNode;\n if( tr && tr.nodeName.toLowerCase() === 'tr' ) {\n if( tr.firstChild && tr.firstChild.dataset.xIndex === this.dataset.xIndex ) {\n if( parseInt( tableBorderLeft, 10 ) > parseInt( tdBorderLeftWidth, 10 ) ) {\n width += -( parseInt( tableBorderLeft, 10 ) - parseInt( tdBorderLeftWidth, 10 ) ) / 2;\n }\n }\n\n if( tr.lastChild && tr.lastChild.dataset.xIndex === this.dataset.xIndex ) {\n if( parseInt( tableBorderRight, 10 ) > parseInt( tdBorderRightWidth, 10 ) ) {\n width += -( parseInt( tableBorderRight, 10 ) - parseInt( tdBorderRightWidth, 10 ) ) / 2;\n }\n }\n\n let body = tr.parentNode;\n if( body && body.nodeName.toLowerCase() === 'body' ) {\n if( body.firstChild && body.firstChild.firstChild.dataset.yIndex === this.dataset.yIndex ) {\n if( parseInt( tableBorderTop, 10 ) > parseInt( tdBorderTopWidth, 10 ) ) {\n height += ( parseInt( tableBorderTop, 10 ) - parseInt( tdBorderTopWidth, 10 ) ) / 2;\n }\n }\n\n if( body.lastChild && body.lastChild.firstChild.dataset.yIndex === this.dataset.yIndex ) {\n if( parseInt( tableBorderBottom, 10 ) > parseInt( tdBorderBottomWidth, 10 ) ) {\n height += ( parseInt( tableBorderBottom, 10 ) - parseInt( tdBorderBottomWidth, 10 ) ) / 2;\n }\n }\n }\n }\n } else if(table.style.borderCollapse === 'separate') {\n width = width - parseInt( tdBorderLeftWidth, 10 ) -\n parseInt( tdBorderRightWidth, 10 );\n height = height - parseInt( tdBorderTopWidth, 10 ) -\n parseInt( tdBorderBottomWidth, 10 );\n }\n }\n\n return {\n width: parseInt( width ),\n height: parseInt( height )\n };\n }\n\n return this;\n};\n","let WPTB_CutGlueTable = {\n cutTableHorizontally: function (rowBefore, table) {\n if( table && table.rows[rowBefore] ) {\n for( let i = 0; i < rowBefore; i++ ) {\n let tableRowsIChildren = table.rows[i].children;\n\n for( let j = 0; j < tableRowsIChildren.length; j++ ) {\n if ( tableRowsIChildren[j].rowSpan > 1 && tableRowsIChildren[j].rowSpan > rowBefore - i ) {\n let newTdRowspan = tableRowsIChildren[j].rowSpan - rowBefore + i;\n tableRowsIChildren[j].rowSpan = rowBefore - i;\n if( ! tableRowsIChildren[j].dataset.sameCellBeforeDivision ) {\n tableRowsIChildren[j].dataset.sameCellBeforeDivision = 'r' + i + 'c' + j;\n }\n\n let td;\n if(table.hasOwnProperty('wptbCell')) {\n td = new table.wptbCell( table.mark );\n td = td.getDOMElement();\n } else {\n td = document.createElement('td');\n }\n\n let tdTopStyle = tableRowsIChildren[j].getAttribute( 'style' );\n td.setAttribute( 'style', tdTopStyle );\n td.colSpan = tableRowsIChildren[j].colSpan;\n td.rowSpan = newTdRowspan;\n td.dataset.sameCellBeforeDivision = tableRowsIChildren[j].dataset.sameCellBeforeDivision;\n\n let dataXIndex = tableRowsIChildren[j].dataset.xIndex;\n let dataXIndexNext = parseInt( dataXIndex ) + parseInt( tableRowsIChildren[j].colSpan );\n let beforeTd;\n while( ! beforeTd && dataXIndexNext < table.maxCols ) {\n beforeTd = table.rows[rowBefore].querySelector( '[data-x-index=\"' + dataXIndexNext + '\"]' );\n dataXIndexNext++;\n }\n table.rows[rowBefore].insertBefore( td, beforeTd );\n\n WPTB_RecalculateIndexes(table);\n }\n }\n }\n }\n },\n glueTableHorizontally: function (table) {\n if(table) {\n let tds = [...table.getElementsByTagName( 'td' )];\n for( let i = 0; i < tds.length; i++ ) {\n if( tds[i].hasAttribute( 'data-same-cell-before-division' ) ) {\n let dataSameCellBeforeDivision = tds[i].dataset.sameCellBeforeDivision;\n let tdsSameBeforeDivision = table.querySelectorAll( '[data-same-cell-before-division=\"' + dataSameCellBeforeDivision + '\"]' );\n for( let j = 0; j < tdsSameBeforeDivision.length; j++ ) {\n if( tdsSameBeforeDivision[j] && tdsSameBeforeDivision[j + 1] ) {\n if( tdsSameBeforeDivision[j].parentNode && tdsSameBeforeDivision[j + 1].parentNode &&\n ! tdsSameBeforeDivision[j].parentNode.classList.contains( 'wptb-row-moving' ) &&\n ! tdsSameBeforeDivision[j + 1].parentNode.classList.contains( 'wptb-row-moving' ) ) {\n if( ( tdsSameBeforeDivision[j + 1].dataset.yIndex == parseInt( tdsSameBeforeDivision[j].dataset.yIndex ) +\n parseInt( tdsSameBeforeDivision[j].rowSpan ) ) ) {\n tdsSameBeforeDivision[j].rowSpan += tdsSameBeforeDivision[j + 1].rowSpan;\n\n let tdsSameBeforeDivisionJPlusChildren = [...tdsSameBeforeDivision[j + 1].children];\n\n for( let k = 0; k < tdsSameBeforeDivisionJPlusChildren.length; k++ ) {\n tdsSameBeforeDivision[j].appendChild( tdsSameBeforeDivisionJPlusChildren[k] );\n }\n\n let nextRow = tdsSameBeforeDivision[j + 1].parentNode;\n nextRow.removeChild( tdsSameBeforeDivision[j + 1] );\n }\n }\n }\n }\n }\n }\n\n WPTB_RecalculateIndexes(table);\n }\n },\n cutTableVertically: function (col, table) {\n for ( let i = 0; i < table.rows.length; i++ ) {\n if( col < table.maxCols ) {\n if( col != 0 && ( ! table.rows[i].querySelector( '[data-x-index=\"' + col + '\"]' ) ) ) {\n let rowChildren = table.rows[i].children;\n\n let td,\n rowChildrenLength = rowChildren.length,\n afterTd,\n rowSpanNewTd,\n colSpanOld,\n colSpanNewTd;\n for( let j = 0; j < rowChildrenLength; j++ ) {\n if( rowChildren[j].colSpan > 1 && parseInt( rowChildren[j].dataset.xIndex ) < col &&\n parseInt( rowChildren[j].dataset.xIndex ) + parseInt( rowChildren[j].colSpan ) > col ) {\n if(table.hasOwnProperty('wptbCell')) {\n td = new table.wptbCell( table.mark );\n td = td.getDOMElement();\n } else {\n td = document.createElement('td');\n }\n\n rowSpanNewTd = rowChildren[j].rowSpan;\n colSpanOld = rowChildren[j].colSpan;\n rowChildren[j].colSpan = col - rowChildren[j].dataset.xIndex;\n colSpanNewTd = colSpanOld - rowChildren[j].colSpan;\n\n if( ! rowChildren[j].dataset.sameCellBeforeDivision ) {\n rowChildren[j].dataset.sameCellBeforeDivision = 'r' + i + 'c' + j;\n }\n\n let tdLeftStyle = rowChildren[j].getAttribute( 'style' );\n td.setAttribute( 'style', tdLeftStyle );\n\n let tdAnalogThisX = table.querySelector( '[data-x-index=\"' + col + '\"]' );\n if( tdAnalogThisX ) {\n td.style.width = tdAnalogThisX.style.width;\n }\n\n let tdAnalogThisY = table.querySelector( '[data-y-index=\"' + i + '\"]' );\n if( tdAnalogThisY ) {\n td.style.height = tdAnalogThisY.style.height;\n }\n if( rowChildren[j + 1] ) {\n afterTd = rowChildren[j + 1];\n } else {\n afterTd = null;\n }\n\n table.rows[i].insertBefore( td, afterTd );\n td.colSpan = colSpanNewTd;\n td.rowSpan = rowSpanNewTd;\n td.dataset.sameCellBeforeDivision = rowChildren[j].dataset.sameCellBeforeDivision;\n i += rowSpanNewTd - 1;\n break\n }\n }\n }\n }\n WPTB_RecalculateIndexes(table);\n }\n },\n glueTableVertically: function (table) {\n if( table ) {\n let tds = [...table.getElementsByTagName( 'td' )];\n for( let i = 0; i < tds.length; i++ ) {\n if( tds[i].hasAttribute( 'data-same-cell-before-division' ) ) {\n let dataSameCellBeforeDivision = tds[i].dataset.sameCellBeforeDivision;\n let tdsSameBeforeDivision = [...table.querySelectorAll( '[data-same-cell-before-division=\"' + dataSameCellBeforeDivision + '\"]' )];\n\n let jFirstTdGlue = null;\n for( let j = 0; j < tdsSameBeforeDivision.length; j++ ) {\n if( tdsSameBeforeDivision[j] && tdsSameBeforeDivision[j + 1] &&\n ! tdsSameBeforeDivision[j].classList.contains( 'wptb-column-moving' ) &&\n ! tdsSameBeforeDivision[j + 1].classList.contains( 'wptb-column-moving' ) ) {\n if( ( tdsSameBeforeDivision[j + 1].dataset.xIndex == parseInt( tdsSameBeforeDivision[j].dataset.xIndex ) +\n parseInt( tdsSameBeforeDivision[j].colSpan ) ) ) {\n if( jFirstTdGlue == null ) {\n jFirstTdGlue = j;\n }\n tdsSameBeforeDivision[jFirstTdGlue].colSpan += tdsSameBeforeDivision[j + 1].colSpan;\n\n let tdsSameBeforeDivisionJPlusChildren = [...tdsSameBeforeDivision[j + 1].children];\n\n for( let k = 0; k < tdsSameBeforeDivisionJPlusChildren.length; k++ ) {\n tdsSameBeforeDivision[jFirstTdGlue].appendChild( tdsSameBeforeDivisionJPlusChildren[k] );\n }\n\n let thisRow = tdsSameBeforeDivision[j + 1].parentNode;\n thisRow.removeChild( tdsSameBeforeDivision[j + 1] );\n }\n }\n }\n }\n }\n\n WPTB_RecalculateIndexes(table);\n }\n }\n}\n","var WPTB_DropHandle = function (thisElem, e, hide = false) {\n\n let wptbDropHandle,\n wptbDropBorderMarker,\n wptbDropBorderMarkerTop,\n wptbDropBorderMarkerRight,\n wptbDropBorderMarkerBottom,\n wptbDropBorderMarkerLeft;\n\n /**\n * Add px suffix to a value\n *\n * @param {any} val value\n * @returns {string} string value suffixed with px\n */\n function toPx(val){\n return `${val}px`;\n }\n\n if(WPTB_Helper.getDragRelativeType() === 'td_relative'){\n let cellRelatedDropHandle = document.querySelector('.wptb-cell-related-drop-handle');\n if(hide && cellRelatedDropHandle ){\n cellRelatedDropHandle.style.display = 'none';\n return;\n }\n if(cellRelatedDropHandle === null){\n const range = document.createRange();\n range.setStart(document.body , 0);\n\n const shadowRoot = range.createContextualFragment('<div class=\"wptb-cell-related-drop-handle\">Add to cell</div>').children[0];\n\n document.body.appendChild(shadowRoot);\n cellRelatedDropHandle = shadowRoot.children[0];\n }\n\n const parentTd = WPTB_Helper.getParentOfType('td', thisElem);\n const {top,left,width,height} = parentTd.getBoundingClientRect();\n\n if(!cellRelatedDropHandle){\n return;\n }\n\n cellRelatedDropHandle.style.display = 'flex';\n cellRelatedDropHandle.style.top = toPx(top);\n cellRelatedDropHandle.style.width = toPx(width);\n cellRelatedDropHandle.style.height = toPx(height);\n cellRelatedDropHandle.style.left = toPx(left);\n\n return;\n }\n\n if ( document.getElementsByClassName( 'wptb-drop-handle' ).length == 0 ) {\n wptbDropHandle = document.createElement( 'div' );\n wptbDropHandle.classList.add( 'wptb-drop-handle' );\n \n wptbDropBorderMarker = document.createElement( 'div' );\n wptbDropBorderMarker.classList.add( 'wptb-drop-border-marker' );\n \n wptbDropBorderMarkerTop = document.createElement( 'div' ),\n wptbDropBorderMarkerRight = document.createElement( 'div' ),\n wptbDropBorderMarkerBottom = document.createElement( 'div' ),\n wptbDropBorderMarkerLeft = document.createElement( 'div' );\n \n wptbDropBorderMarkerTop.classList.add( 'wptb-drop-border-marker-top' );\n wptbDropBorderMarkerRight.classList.add( 'wptb-drop-border-marker-right' );\n wptbDropBorderMarkerBottom.classList.add( 'wptb-drop-border-marker-bottom' );\n wptbDropBorderMarkerLeft.classList.add( 'wptb-drop-border-marker-left' );\n \n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerTop );\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerRight );\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerBottom );\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerLeft );\n \n let body = document.getElementsByTagName( 'body' );\n if ( body.length > 0 ) {\n body[0].appendChild( wptbDropHandle );\n body[0].appendChild( wptbDropBorderMarker );\n }\n \n wptbDropHandle.ondragenter = function () {\n if (e.target.classList.contains('wptb-empty')) {\n e.preventDefault();\n return false;\n }\n }\n\n wptbDropHandle.ondragover = function (e) {\n e.preventDefault(); \n }\n\n wptbDropHandle.ondragleave = function () {\n\n }\n wptbDropHandle.ondrop = function (e) {\n e.preventDefault();\n let element;\n \n if ( e.dataTransfer.getData('wptbElement') ) {\n element = WPTB_Helper.newElementProxy( e.dataTransfer.getData('wptbElement') );\n element = element.getDOMElement();\n } else {\n element = document.getElementsByClassName( e.dataTransfer.getData('node') )[0];\n element.classList.remove( 'wptb-moving-mode' );\n element.classList.remove( 'wptb-moving-into-same-elem' );\n element.wptbMovingMode = 1;\n }\n \n let td;\n if( wptbDropHandle.dataset.text == 'Drop Here' ) {\n thisElem = wptbDropHandle.getDOMParentElement();\n if ( thisElem.nodeName.toLowerCase() == 'td' ) {\n td = wptbDropHandle.getDOMParentElement();\n td.appendChild( element );\n WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);\n }\n } else {\n let innerElement = wptbDropHandle.getDOMParentElement();\n td = innerElement.parentNode;\n \n if( wptbDropHandle.dataset.text == 'Above Element' ) {\n td.insertBefore( element, innerElement );\n WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);\n } else if( wptbDropHandle.dataset.text == 'Below Element' ) {\n let innerElementNext = innerElement.nextSibling;\n td.insertBefore( element, innerElementNext );\n WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);\n }\n }\n \n let thisRow = td.parentNode;\n if( WPTB_Helper.rowIsTop( thisRow ) ) {\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\n\n if( table.classList.contains( 'wptb-table-preview-head' ) ) {\n WPTB_Helper.dataTitleColumnSet( table );\n }\n }\n \n wptbDropHandle.style.display = 'none';\n wptbDropBorderMarker.style.display = 'none';\n \n WPTB_innerElementSet( element );\n if( ! element.classList.contains( 'wptb-image-container' ) || element.wptbMovingMode == 1 ) {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n element.wptbMovingMode == undefined;\n }\n }\n let wptbContainer = document.querySelector( '.wptb-container' );\n wptbContainer.onscroll = function() {\n wptbDropHandle.style.display = 'none';\n wptbDropBorderMarker.style.display = 'none';\n }\n } else {\n wptbDropHandle = document.getElementsByClassName( 'wptb-drop-handle' )[0];\n wptbDropBorderMarker = document.getElementsByClassName( 'wptb-drop-border-marker' )[0];\n }\n if( thisElem && thisElem.nodeName.toLowerCase() == 'td' && \n thisElem.getElementsByClassName( 'wptb-ph-element' ).length != 0) {\n return;\n }\n\n if( thisElem && thisElem.nodeName.toLowerCase() == 'td' && \n thisElem.classList.contains('wptb-empty')) {\n return;\n }\n \n let thisRow;\n if ( thisElem.localName == 'td' ) {\n thisRow = thisElem.parentNode;\n } else if ( thisElem.localName == 'div' && thisElem.classList.contains( 'wptb-ph-element' ) ) {\n thisRow = thisElem.parentNode.parentNode;\n }\n \n if( WPTB_Helper.rowIsTop( thisRow ) ) {\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\n \n if( table.classList.contains( 'wptb-table-preview-head' ) ) {\n let indics = e.dataTransfer.types;\n let notDragEnter = false;\n for ( let i = 0; i < indics.length; i++ ) {\n let infArr = indics[i].match( /wptbelindic-([a-z]+)/i );\n if ( infArr && infArr[1] != 'text' ) {\n notDragEnter = true;\n break;\n }\n }\n if( notDragEnter ) {\n return;\n }\n }\n }\n \n wptbDropHandle.style.width = thisElem.offsetWidth + 'px';\n let height = thisElem.offsetHeight,\n coordinatesElement = thisElem.getBoundingClientRect(),\n left = parseFloat( coordinatesElement.left ),\n top;\n wptbDropHandle.style.left = left + 'px';\n \n if( e.dataTransfer.types.indexOf( 'wptb-moving-mode' ) != -1 ) {\n let elementDrag = document.getElementsByClassName( 'wptb-moving-mode' )[0];\n if( thisElem == elementDrag ) {\n wptbDropHandle.classList.add('wptb-moving-into-same-elem');\n wptbDropBorderMarker.classList.add('wptb-moving-into-same-elem');\n } else {\n wptbDropHandle.classList.remove('wptb-moving-into-same-elem');\n wptbDropBorderMarker.classList.remove('wptb-moving-into-same-elem');\n }\n }\n \n wptbDropHandle.getDOMParentElement = function() {\n return thisElem;\n }\n \n wptbDropHandle.style.display = 'block';\n wptbDropBorderMarker.style.display = 'block';\n if( thisElem.nodeName.toLowerCase() != 'td' ) {\n let y = e.offsetY==undefined?e.layerY:e.offsetY;\n top = parseFloat( coordinatesElement.top ) - parseFloat( 11 );\n wptbDropHandle.dataset.text = 'Above Element';\n if ( y > height/2 ) {\n top = parseFloat( coordinatesElement.top ) + height - 1;\n wptbDropHandle.dataset.text = 'Below Element';\n }\n } else {\n wptbDropHandle.dataset.text = 'Drop Here';\n top = parseFloat( coordinatesElement.top ) + height/2 - 5;\n }\n wptbDropHandle.style.top = top + 'px';\n\n wptbDropBorderMarker.style.top = coordinatesElement.top + 'px';\n wptbDropBorderMarker.style.left = coordinatesElement.left + 'px';\n\n wptbDropBorderMarkerTop = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-top' );\n wptbDropBorderMarkerTop.style.width = ( parseFloat( thisElem.offsetWidth ) - parseFloat( 1 ) ) + 'px';\n\n wptbDropBorderMarkerRight = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-right' );\n wptbDropBorderMarkerRight.style.height = ( parseFloat( coordinatesElement.bottom ) - parseFloat( coordinatesElement.top ) - 1 ) + 'px';\n wptbDropBorderMarkerRight.style.left = wptbDropBorderMarkerTop.style.width;\n\n wptbDropBorderMarkerBottom = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-bottom' );\n wptbDropBorderMarkerBottom.style.width = wptbDropBorderMarkerTop.style.width;\n wptbDropBorderMarkerBottom.style.top = wptbDropBorderMarkerRight.style.height;\n\n wptbDropBorderMarkerLeft = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-left' );\n wptbDropBorderMarkerLeft.style.height = wptbDropBorderMarkerRight.style.height;\n}","var ElementCounters = function () {\n\n\tvar priv = [];\n\tpriv['text'] = 0;\n\tpriv['image'] = 0;\n\tpriv['list'] = 0;\n\tpriv['button'] = 0;\n\n\tthis.increment = function (key) {\n\t\tif (!(key in priv)) {\n\t\t\treturn;\n\t\t}\n\t\tpriv[key]++;\n\t}\n\n\tthis.nextIndex = function (key) {\n\t\tif (!(key in priv)) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn priv[key] + 1;\n\t}\n\n\treturn this;\n\n};","var WPTB_ElementObject = function ( data ) {\n let DOMElement, kindIndexProt, copy;\n if( ! data.elemProt ) {\n DOMElement = document.createElement('div'),\n kindIndexProt = undefined,\n copy = false;\n DOMElement.classList.add( 'wptb-' + data.kind + '-container', 'wptb-ph-element' );\n \n let wpTemplateId = 'wptb-' + data.kind + '-content';\n let template = wp.template( wpTemplateId );\n data.node = DOMElement;\n let itemHtml = template( data );\n\n itemHtml = itemHtml.replace(/\\r|\\n|\\t/g, '').trim();\n DOMElement.innerHTML = itemHtml;\n } else {\n DOMElement = data.elemProt.cloneNode( true );\n DOMElement.classList.remove( 'wptb-directlyhovered' );\n let wptbElementMutch = data.elemProt.className.match( /wptb-element-((.+-)\\d+)/i );\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\n kindIndexProt = wptbElementMutch[1];\n };\n copy = true;\n \n if( data.tinyMceClear ) {\n DOMElement = WPTB_Helper.elementClearFromTinyMce( DOMElement );\n }\n }\n \n let inElems = DOMElement.querySelectorAll( '.wptb-in-element' );\n if( inElems.length > 0 ) {\n for ( let i = 0; i < inElems.length; i++ ) {\n let inElemObj = {};\n inElemObj.getDOMElement = function() {\n return inElems[i];\n }\n \n applyGenericItemSettings( inElemObj );\n }\n }\n \n window.addEventListener( 'item:onmouseenter', function( event ) {\n //console.log( event );\n }, false);\n \n \n this.kind = data.kind;\n this.getDOMElement = function () {\n return DOMElement;\n };\n \n applyGenericItemSettings( this, kindIndexProt, copy );\n return this;\n}\n\n\n","var WPTB_ElementOptions = function ( element, index, kindIndexProt ) {\n\n var node = element.getDOMElement();\n node.addEventListener( 'click', function() {\n WPTB_Helper.elementOptionsSet( element.kind, this );\n }, {capture: true} );\n};","/**\n * WPTB_HeaderToolbox\n *\n * @param {string} wrapperQuery wrapper query for toolbox items\n * @return {object} header toolbox object\n * @constructor\n */\n// eslint-disable-next-line camelcase,no-unused-vars\nconst WPTB_HeaderToolbox = function (wrapperQuery) {\n\tthis.wrapperQuery = wrapperQuery;\n\tthis.element = document.querySelector(wrapperQuery);\n\tthis.topMargin = 2;\n\n\t/**\n\t * Assign events to toolbox buttons\n\t */\n\tconst assignButtons = () => {\n\t\tconst manageCellsButton = this.element.querySelector('[data-button-type=\"table_settings_menu\"]');\n\n\t\tif (manageCellsButton) {\n\t\t\tmanageCellsButton.addEventListener('click', () => {\n\t\t\t\tWPTB_Helper.activateSection('manage_cells');\n\t\t\t});\n\t\t}\n\t};\n\n\t/**\n\t * Toggle visibility of toolbox with the given argument.\n\t *\n\t * @param {boolean} show show toolbox\n\t */\n\tconst toggleToolboxVisibility = (show = false) => {\n\t\tlet { height } = this.element.getBoundingClientRect();\n\n\t\tif (show) {\n\t\t\theight = 0;\n\t\t}\n\n\t\tthis.element.style.top = `calc( 100% - ${height + this.topMargin}px)`;\n\t};\n\n\t/**\n\t * Initialize header toolbox.\n\t */\n\tconst init = () => {\n\t\tassignButtons();\n\t\t// bind toolbox to table generated event\n\t\tdocument.addEventListener('wptb:table:generated', () => {\n\t\t\tthis.element.style.display = 'unset';\n\t\t\tconst { width } = this.element.getBoundingClientRect();\n\t\t\tthis.element.style.left = `calc( 50% - ${width / 2}px)`;\n\n\t\t\t// hide toolbox at manage cells and responsive menus\n\t\t\tdocument.addEventListener('wptbSectionChanged', ({ detail }) => {\n\t\t\t\ttoggleToolboxVisibility(\n\t\t\t\t\tdetail !== 'manage_cells' && detail !== 'table_responsive_menu' && detail !== 'cell_settings'\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\t};\n\n\treturn { init };\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 if( rgb ) {\n if( WPTB_Helper.isHex( rgb ) ) return rgb;\n\n let rgbm = rgb.match(/^rgba?[\\s+]?\\([\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?((?:[0-9]*[.])?[0-9]+)[\\s+]?\\)/i);\n if ( rgbm && rgbm.length === 5) {\n return \"#\" +\n ('0' + Math.round(parseFloat(rgbm[4], 10) * 255).toString(16).toUpperCase()).slice(-2) +\n (\"0\" + parseInt(rgbm[1], 10).toString(16).toUpperCase()).slice(-2) +\n (\"0\" + parseInt(rgbm[2], 10).toString(16).toUpperCase()).slice(-2) +\n (\"0\" + parseInt(rgbm[3], 10).toString(16).toUpperCase()).slice(-2);\n } else {\n rgbm = rgb.match(/^rgba?[\\s+]?\\([\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?/i);\n if (rgbm && rgbm.length === 4) {\n return \"#\" +\n (\"0\" + parseInt(rgbm[1], 10).toString(16).toUpperCase()).slice(-2) +\n (\"0\" + parseInt(rgbm[2], 10).toString(16).toUpperCase()).slice(-2) +\n (\"0\" + parseInt(rgbm[3], 10).toString(16).toUpperCase()).slice(-2);\n } else {\n return '';\n }\n }\n } else {\n return '';\n }\n\n },\n isHex: function( hex ) {\n let regex = new RegExp('^#(?:[A-Fa-f0-9]{3}){1,2}$');\n return regex.test( hex );\n },\n getElementIcon: function ( icon_directory ) {\n let hostName = location.protocol + '//' + location.hostname;\n let img = document.createElement( 'img' );\n img.src = icon_directory;\n return img;\n },\n elementDragEndClear: function() {\n let wptbMovingMode = document.getElementsByClassName( 'wptb-moving-mode' );\n if ( wptbMovingMode.length > 0 ) {\n for( let i = 0; i < wptbMovingMode.length; i++ ) {\n wptbMovingMode[i].classList.remove( 'wptb-moving-mode' );\n }\n }\n\n let wptbDropHandles = document.getElementsByClassName( 'wptb-drop-handle' );\n if ( wptbDropHandles.length > 0 ) {\n for( let i = 0; i < wptbDropHandles.length; i++ ) {\n wptbDropHandles[i].style.display = 'none';\n }\n }\n\n let wptbDropBorderMarkers = document.getElementsByClassName( 'wptb-drop-border-marker' );\n if ( wptbDropBorderMarkers.length > 0 ) {\n for( let i = 0; i < wptbDropBorderMarkers.length; i++ ) {\n wptbDropBorderMarkers[i].style.display = 'none';\n }\n }\n },\n linkHttpCheckChange: function( link, convertToAbs = false ) {\n if ( link ) {\n // even though it is not a best practice and a huge security risk, sometimes our users use javascript tag at href attributes, this check will make sure those tags will not be modified and returned as they are\n if(link.match(/^(javascript:)(.+)$/)){\n return link;\n }\n // relative link checking\n // if link starts with '/', assume it is a relative link to the origin of the current site\n else if( link.match(/^\\/([\\S]+)$/) ){\n if (convertToAbs) {\n const currentLocation = document.location;\n let {origin} = currentLocation;\n\n\n // strip out the '/' at the end of the origin name if there is any\n if (origin.match(/^(.+)\\/$/)) {\n origin = origin.slice(-1);\n }\n\n return `${origin}${link}`;\n }else{\n return link;\n }\n }\n else if ( link.indexOf( 'http://' ) == -1 && link.indexOf( 'https://' ) == -1 ) {\n let linkArr = link.split( '/' ),\n linkClean;\n if ( Array.isArray( linkArr ) && linkArr.length > 0 ) {\n linkClean = linkArr[linkArr.length - 1];\n }\n return document.location.protocol + '//' + linkClean;\n } else {\n return link;\n }\n } else {\n return '';\n }\n },\n dataTitleColumnSet: function( table ) {\n // TODO dataTitleColumnSet\n // let rows = table.rows,\n // rowHead = rows[0];\n // let computedStyleRowHead = getComputedStyle( rowHead );\n //\n // let rowHeadChildren = rowHead.children;\n // let contentsForHeader = {};\n // for( let i = 0; i < rowHeadChildren.length; i++ ) {\n // let tdElements = rowHeadChildren[i].children;\n //\n // for( let j = 0; j < tdElements.length; j++ ) {\n // let element = tdElements[j];\n // if( element.classList.contains( 'wptb-ph-element' ) ) {\n // let infArr = element.className.match( /wptb-element-(.+)-(\\d+)/i );\n // if( infArr[1] == 'text' ) {\n // let p = element.querySelector( 'p' ),\n // textContent = p.textContent,\n // textAlign = p.style.textAlign;\n // contentsForHeader[rowHeadChildren[i].dataset.xIndex] = [textContent, element.style.fontSize,\n // element.style.color, computedStyleRowHead.backgroundColor, textAlign];\n // break;\n // }\n // }\n // }\n // if( ! contentsForHeader[rowHeadChildren[i].dataset.xIndex] ) {\n // contentsForHeader[rowHeadChildren[i].dataset.xIndex] = ['', '',\n // '', computedStyleRowHead.backgroundColor, ''];\n // }\n // }\n // for ( let i = 1; i < rows.length; i++ ) {\n // let thisRow = rows[i],\n // thisRowChildren = thisRow.children;\n // for( let j = 0; j < thisRowChildren.length; j++ ) {\n // if ( contentsForHeader[thisRowChildren[j].dataset.xIndex] ) {\n // thisRowChildren[j].dataset.wptbTitleColumn = contentsForHeader[thisRowChildren[j].dataset.xIndex][0];\n // thisRowChildren[j].dataset.wptbTitleColumnFontSize = contentsForHeader[thisRowChildren[j].dataset.xIndex][1];\n // thisRowChildren[j].dataset.wptbTitleColumnColor = contentsForHeader[thisRowChildren[j].dataset.xIndex][2];\n // thisRowChildren[j].dataset.wptbTitleBackgroundColor = contentsForHeader[thisRowChildren[j].dataset.xIndex][3];\n // thisRowChildren[j].dataset.wptbTitleAlign = contentsForHeader[thisRowChildren[j].dataset.xIndex][4];\n // } else {\n // thisRowChildren[j].dataset.wptbTitleColumn = null;\n // thisRowChildren[j].dataset.wptbTitleColumnFontSize = null;\n // thisRowChildren[j].dataset.wptbTitleColumnColor = null;\n // thisRowChildren[j].dataset.wptbTitleBackgroundColor = null;\n // thisRowChildren[j].dataset.wptbTitleAlign = null;\n // }\n // }\n // }\n },\n findAncestor: function( el, cls ) {\n while ( ( el = el.parentElement ) && !el.classList.contains( cls ) );\n return el;\n },\n rowIsTop: function( row ) {\n var parent = row.parentNode;\n if( parent.children[0] == row ) {\n return true;\n } else {\n return false;\n }\n },\n getSelectionText: function() {\n var txt = '';\n if (txt = window.getSelection) {\n txt = window.getSelection().toString();\n } else {\n txt = document.selection.createRange().text;\n }\n return txt;\n },\n elementOptionsPanelClear: function() {\n let elementOptionsGroup = document.getElementById( 'element-options-group' );\n if( elementOptionsGroup ) {\n elementOptionsGroup.innerHTML = '';\n }\n },\n wpColorPickerCheckChangeForTableStateSaving: function( event ) {\n if( event.originalEvent.type == 'external' ) {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n } else {\n let wpPickerContainer = WPTB_Helper.findAncestor( event.target, 'wp-picker-container' );\n if( wpPickerContainer ) {\n if( event.originalEvent.type == 'square' || event.originalEvent.type == 'strip' ) {\n let body = document.getElementsByTagName( 'body' )[0];\n body.removeEventListener( 'mouseup', WPTB_Helper.irisStripMouseUpStateSaveManager, false );\n body.addEventListener( 'mouseup', WPTB_Helper.irisStripMouseUpStateSaveManager, false );\n }\n }\n }\n },\n irisStripMouseUpStateSaveManager: function() {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n\n let body = document.getElementsByTagName( 'body' )[0];\n body.removeEventListener( 'mouseup', WPTB_Helper.irisStripMouseUpStateSaveManager, false );\n },\n wpColorPickerClear: function( attribute, isId ) {\n let input;\n if( isId ) {\n input = [document.getElementById( attribute )];\n input.length = 1;\n } else {\n input = document.getElementsByClassName( attribute );\n }\n for( let i = 0; i < input.length; i++ ) {\n let wpPickerContainer = WPTB_Helper.findAncestor( input[i], 'wp-picker-container' );\n if( wpPickerContainer ) {\n let parent = wpPickerContainer.parentNode;\n parent.removeChild( wpPickerContainer );\n let newInput = document.createElement( 'input' );\n if( isId ) {\n newInput.setAttribute( 'id', attribute );\n } else {\n newInput.classList.add( 'wptb-element-property', attribute );\n }\n newInput.value = \"\";\n parent.appendChild( newInput );\n }\n }\n },\n detectMode: function() {\n var url = window.location.href,\n regex = new RegExp('[?&]table(=([^&#]*)|&|#|$)'),\n results = regex.exec(url);\n if ( ! results ) return false;\n if ( ! results[2] ) return '';\n return decodeURIComponent( results[2].replace(/\\+/g, ' ') );\n },\n getTableId() {\n let tableId = WPTB_Helper.detectMode();\n if (!tableId) {\n tableId = 'startedid-0';\n }\n\n return tableId;\n },\n getColumnWidth: function( table, cell ) {\n let xIndex = cell.dataset.xIndex;\n let xIndexes = table.querySelectorAll( '[data-x-index=\"' + xIndex + '\"]' );\n let cellWidth = cell.getCellDimensions().width;\n for( let i = 0; i < xIndexes.length; i++ ) {\n if( cellWidth > xIndexes[i].getCellDimensions().width ) {\n cellWidth = xIndexes[i].getCellDimensions().width;\n }\n }\n return cellWidth;\n },\n getRowHeight: function( table, cell ) {\n let yIndex = cell.dataset.yIndex;\n let yIndexes = table.querySelectorAll( '[data-y-index=\"' + yIndex + '\"]' );\n let cellHeight = cell.getCellDimensions().height;\n for( let i = 0; i < yIndexes.length; i++ ) {\n if( cellHeight > yIndexes[i].getCellDimensions().height ) {\n cellHeight = yIndexes[i].getCellDimensions().height;\n }\n }\n return cellHeight;\n },\n newElementProxy: function( el ) {\n if( el ) {\n let data = {kind: el};\n return new WPTB_ElementObject( data );\n }\n },\n wpColorPickerChange: function( event, ui ) {\n let uiColor;\n if( ui ) {\n uiColor = ui.color.toString();\n } else {\n uiColor = '';\n }\n\n let parent = WPTB_Helper.findAncestor( event.target, 'wp-picker-input-wrap' ).getElementsByClassName( 'wptb-color-picker' )[0], classe, type, ps, number;\n classe = parent.dataset.element.match(/wptb-options-(.+)-(\\d+)/i);\n type = classe[1];\n number = classe[2];\n let affectedEl = document.getElementsByClassName( 'wptb-element-' + type + '-' + number )[0];\n if ( type == 'button' ) {\n if ( parent.dataset.type == 'button-text-color' ) {\n affectedEl.getElementsByClassName( 'wptb-button' )[0].style.color = uiColor;\n } else {\n affectedEl.getElementsByClassName( 'wptb-button' )[0].style.backgroundColor = uiColor;\n }\n } else if( type == 'list' ) {\n let ps = affectedEl.querySelectorAll( 'p' );\n if( ps.length > 0 ) {\n for ( let i = 0; i < ps.length; i++ ) {\n ps[i].style.color = uiColor;\n }\n }\n } else if( type == 'star_rating' ) {\n if ( parent.dataset.type == 'star-color' ) {\n let ratingStar = affectedEl.querySelectorAll('li');\n for( let i = 0; i < ratingStar.length; i++ ) {\n let span = ratingStar[i].getElementsByTagName( 'span' );\n for( let j = 0; j < span.length; j++ ) {\n span[j].style.fill = uiColor;\n }\n }\n } else if( parent.dataset.type == 'numeral-rating-color' ) {\n let wptbTextMessageSize = affectedEl.querySelector('.wptb-number-rating');\n wptbTextMessageSize.style.color = uiColor;\n }\n\n } else {\n affectedEl.style.color = uiColor;\n }\n },\n numberImputSize: function ( wptbNumberInputs, maxCount, maxValue ) {\n wptbNumberInputs.onkeydown = function() {\n let thisValue = this.value;\n thisValue = String( thisValue );\n if ( thisValue[0] == 0 ) {\n this.value = \"\";\n } else {\n thisValue = thisValue.substring( 0, maxCount );\n this.value = thisValue;\n }\n }\n wptbNumberInputs.onkeyup = function( ) {\n let thisValue = this.value;\n if ( parseInt( thisValue, 10 ) > parseInt( maxValue, 10 ) ) {\n this.value = maxValue;\n }\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n },\n ucfirst: function( str ) {\n return str.charAt(0).toUpperCase() + str.slice(1);\n },\n wptbDocumentEventGenerate: function( eventName, element, details ) {\n if( eventName && element ) {\n if( ! details ) {\n details = true;\n }\n let event = new CustomEvent( eventName, { detail: details, bubbles: true } );\n element.dispatchEvent( event );\n }\n },\n // run script for the pointed element\n elementStartScript: function( element, kind ) {\n //let script = element.getElementsByTagName( 'script' );\n if(!kind) {\n let infArr = element.className.match(/wptb-element-(.+)-(\\d+)/i);\n if( infArr && Array.isArray( infArr ) ) {\n kind = infArr[1];\n }\n }\n\n if( kind ) {\n// let wpTemplateId = 'wptb-' + kind + '-script';\n// let template = wp.template( wpTemplateId );\n// let data = {elemClass: infArr[0]};\n// let elementScriptText = template( data );\n// elementScriptText = elementScriptText.replace(/\\r|\\n|\\t/g, '').trim();\n//\n// let scriptNew = document.createElement( 'script' );\n// scriptNew.setAttribute( 'type', 'text/javascript' );\n// scriptNew.innerHTML = elementScriptText;\n// element.parentNode.appendChild( scriptNew );\n\n// element.parentNode.removeChild( scriptNew );\n if( kind in WPTB_ElementsScriptsLauncher ) {\n WPTB_ElementsScriptsLauncher[kind]( element );\n }\n }\n },\n // deletes event handlers from the pointed option element and from all his daughter elements\n deleteEventHandlers: function( element ) {\n if( element ) {\n jQuery( element ).off();\n let elementChildren = element.children;\n if( elementChildren ) {\n for ( let i = 0; i < elementChildren.length; i++ ) {\n WPTB_Helper.deleteEventHandlers( elementChildren[i] );\n }\n }\n } else {\n return;\n }\n },\n // replace all occurrences in a string\n replaceAll: function( string, search, replace ){\n return string.split( search ).join( replace );\n },\n // clears code from TinyMCE attributes\n elementClearFromTinyMce: function( element ) {\n let mceContentBodys = element.querySelectorAll( '.mce-content-body' );\n if( mceContentBodys.length > 0 ) {\n for ( let k = 0; k < mceContentBodys.length; k++ ) {\n mceContentBodys[k].classList.remove( 'mce-content-body' );\n }\n }\n\n let dataMceStyle = element.querySelectorAll( '[data-mce-style]' );\n if ( dataMceStyle.length > 0 ) {\n for ( let k = 0; k < dataMceStyle.length; k++ ) {\n dataMceStyle[k].removeAttribute( 'data-mce-style' );\n }\n }\n\n let mceEditFocus = element.querySelectorAll( '.mce-edit-focus' );\n if( mceEditFocus.length > 0 ) {\n for ( let k = 0; k < mceEditFocus.length; k++ ) {\n mceEditFocus[k].classList.remove( 'mce-edit-focus' );\n }\n }\n\n let contentEditable = element.querySelectorAll( '[contenteditable]' );\n if ( contentEditable.length > 0 ) {\n for ( let k = 0; k < contentEditable.length; k++ ) {\n contentEditable[k].removeAttribute( 'contenteditable' );\n }\n }\n\n let spellCheck = element.querySelectorAll( '[spellcheck]' );\n if ( spellCheck.length > 0 ) {\n for ( let k = 0; k < spellCheck.length; k++ ) {\n spellCheck[k].removeAttribute( 'spellcheck' );\n }\n }\n\n let mceIds = element.querySelectorAll( '[id^=mce_]' );\n if ( mceIds.length > 0 ) {\n for ( let k = 0; k < mceIds.length; k++ ) {\n mceIds[k].removeAttribute( 'id' );\n }\n }\n\n return element;\n },\n elementOptionContainerCustomClassSet: function( targetInput, customClassForContainer ) {\n if( targetInput && customClassForContainer ) {\n let containerElement = WPTB_Helper.findAncestor( targetInput, 'wptb-element-option' );\n if( containerElement ) {\n containerElement.classList.add( customClassForContainer );\n }\n }\n },\n elementOptionContainerAdditionalStyles: function( targetInput, containerAdditionalStyles ) {\n if( targetInput && containerAdditionalStyles ) {\n let containerElement = WPTB_Helper.findAncestor( targetInput, 'wptb-element-option' );\n let containerStylesArrOne = containerAdditionalStyles.split( ';' );\n\n if( containerElement && containerStylesArrOne ) {\n function containerStylesSet( containerStyleStr, containerElement ) {\n if( containerStyleStr ) {\n containerStyleStrArr = containerStyleStr.split( ':' );\n\n if( containerStyleStrArr && Array.isArray( containerStyleStrArr ) ) {\n containerElement.style[containerStyleStrArr[0]] = containerStyleStrArr[1];\n }\n }\n }\n if( containerStylesArrOne && Array.isArray( containerStylesArrOne ) ) {\n for( let i = 0; i < containerStylesArrOne.length; i++ ) {\n if( containerStylesArrOne[i] ) {\n containerStylesSet( containerStylesArrOne[i], containerElement );\n }\n }\n } else {\n containerStylesSet( containerStylesArrOne, containerElement );\n }\n }\n }\n },\n // function which set handler for event of changes of control\n controlsInclude: function( element, functionHandler, acceptEventValues = false ) {\n if( element && typeof element === 'object' && typeof functionHandler === 'function' ) {\n element.addEventListener( 'element:controls:active', function() {\n if(!element.hasOwnProperty('controlConnectFunctionsName') ||\n !Array.isArray(element.controlConnectFunctionsName) ||\n element.controlConnectFunctionsName.indexOf(functionHandler.name) == -1) {\n let infArr = element.className.match( /wptb-element-(.+)-(\\d+)/i ),\n elementKind;\n\n if( infArr && Array.isArray( infArr ) ) {\n elementKind = infArr[1];\n }\n\n// if( ! element.hasOwnProperty( 'сontrolsConnectIndic' ) || element.сontrolsConnectIndic !== true && elementKind ) {\n// let elementsSettingsTemplateJs = document.getElementsByClassName( 'wptb-element-datas' );\n// if( elementsSettingsTemplateJs.length > 0 ) {\n// elementsSettingsTemplateJs = elementsSettingsTemplateJs[0];\n//\n// let elementsSettings = elementsSettingsTemplateJs.innerHTML;\n// let controlClassesNames = [];\n// if( elementsSettings ) {\n// elementsSettings = elementsSettings.trim();\n// elementsSettings = JSON.parse( elementsSettings );\n// if( elementsSettings && typeof elementsSettings === 'object' ) {\n// if( 'tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2] in elementsSettings ) {\n// let elementSettings = elementsSettings['tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2]];\n// if( elementSettings && typeof elementSettings === 'object' ) {\n// Object.keys( elementSettings ).forEach( function( key ) {\n// let regularText = new RegExp( 'data-wptb-el-' + elementKind + '-(\\\\d+)-([a-zA-Z0-9_-]+)', \"i\" );\n// let keyInfArr = key.match( regularText );\n// if( keyInfArr && Array.isArray( keyInfArr ) ) {\n// let controlClass = key.replace( 'data-', '' );\n// controlClassesNames.push( [controlClass, keyInfArr[2]] );\n// }\n// });\n// }\n// }\n// }\n// }\n// }\n// }\n if( elementKind ){\n let elementOptionsGroupIds = element.optionsGroupIds;\n if(elementOptionsGroupIds && Array.isArray(elementOptionsGroupIds)) {\n for(let i = 0; i < elementOptionsGroupIds.length; i++) {\n let elementOptionsGroupId = elementOptionsGroupIds[i];\n\n let elementOptionsGroup = document.getElementById(elementOptionsGroupId);\n\n let controlActiveElements = elementOptionsGroup.querySelectorAll('.wptb-element-property');\n controlActiveElements = [...controlActiveElements];\n\n controlActiveElements.map(controlActiveElement => {\n let regularText = new RegExp( 'wptb-el-' + elementKind + '-(\\\\d+)-([a-zA-Z0-9_-]+)', \"i\" );\n let controlInfArr = controlActiveElement.className.match( regularText );\n if( controlInfArr && Array.isArray( controlInfArr ) ) {\n let controlUnicClassName = controlInfArr[0];\n\n element.addEventListener( 'wptb-control:' + controlUnicClassName, function(e) {\n let controls = {};\n let controlName = controlInfArr[2];\n let control = document.getElementsByClassName( controlUnicClassName );\n if( control.length > 0 && controlName ) {\n let targetControlValue = WPTB_Helper.targetControlValueGet( control );\n\n if(acceptEventValues) {\n controls[controlName] = {\n targetValue: targetControlValue,\n eventValue: e.detail.value\n }\n }else {\n controls[controlName] = targetControlValue;\n }\n }\n functionHandler( controls, element );\n }, false );\n }\n });\n }\n }\n //let elementOptionsContainer = document.querySelector( '.wptb-element-options.wptb-options-' + infArr[1] + '-' + infArr[2] );\n\n // from time to time depend on table cells hierarchy, cell td items may catch mouse clicks which are intended for elements. since the active section is not cell management, this will gives and unharmfull error of not found element, simple check for null equality will be sufficient for now.\n // if(!elementOptionsContainer){\n // return;\n // }\n\n // let elementOptions = elementOptionsContainer.querySelectorAll( '.wptb-element-option' );\n // let controlActiveElements = elementOptions[i].querySelector( '.wptb-element-property' );\n //\n //\n // for( let i = 0; i < elementOptions.length; i++ ) {\n // let controlActiveElement = elementOptions[i].querySelector( '.wptb-element-property' );\n // if( controlActiveElement ) {\n //\n // }\n // }\n\n if(!element.controlConnectFunctionsName && !Array.isArray(element.controlConnectFunctionsName)) {\n element.controlConnectFunctionsName = [];\n }\n\n element.controlConnectFunctionsName.push( functionHandler.name );\n }\n }\n }, false );\n }\n },\n oneControlInclude: function( element, functionHandler, controlName ) {\n if( element && typeof element === 'object' && typeof functionHandler === 'function' && typeof controlName === 'string' ) {\n let infArr = element.className.match( /wptb-element-((.+-)\\d+)/i ),\n elementKind;\n\n if( infArr && Array.isArray( infArr ) ) {\n elementKind = infArr[1].split( '-' )[0];\n\n let wptbContrlStacksConfigId = 'wptb-' + elementKind + '-control-stack';\n let tmplControlsConfig = wp.template( wptbContrlStacksConfigId );\n let data = {\n container: '.' + infArr[0]\n };\n let jsonControlsConfigJson = tmplControlsConfig( data );\n let jsonControlsConfig = JSON.parse( jsonControlsConfigJson );\n\n if( jsonControlsConfig && typeof jsonControlsConfig === 'object' && jsonControlsConfig.hasOwnProperty( controlName ) ) {\n let controlClassName = 'wptb-el-' + infArr[1] + '-' + controlName;\n\n element.addEventListener( 'wptb-control:' + controlClassName, function( event ) {\n let control = document.getElementsByClassName( controlClassName );\n if( control.length > 0 ) {\n let targetControlValue = WPTB_Helper.targetControlValueGet( control );\n\n functionHandler( targetControlValue, element );\n }\n }, false );\n }\n }\n } else {\n return false;\n }\n },\n //\n innerElementCopyIncludeHandler: function( element, functionHandler ) {\n if( element && typeof element === 'object' && typeof functionHandler === 'function' ) {\n element.addEventListener( 'wptb-inner-element:copy', function( event ) {\n let innerElement = event.detail;\n if( innerElement ) {\n WPTB_Helper.elementClearFromTinyMce( innerElement );\n functionHandler( innerElement, element );\n }\n }, false );\n }\n },\n /**\n * Sets the control elements when changing which to will restart this control\n * @param {array} dependOnControlName\n * @param {string} targetControlElementClass\n * @param {array} valueDependOnControlCorrect\n * @param {string} kind\n * @param {HTMLElement} element\n */\n valueDependOnControl: function(dependOnControlName, targetControlElementClass, valueDependOnControlCorrect, kind, element) {\n function dependOnControlDataGet(dependOnControlName, targetControlElementClass, valueDependOnControlCorrect) {\n if(typeof dependOnControlName === 'string') {\n dependOnControlName = [dependOnControlName];\n }\n let infArr = targetControlElementClass.match(/wptb-el-((.+-)\\d+)-(.+)/i);\n let valueDependOnControl = {};\n let dependOnControlElementsArr = [];\n if (infArr && Array.isArray(infArr)) {\n let controlName = infArr[3];\n let dependOnControlElements;\n let valueDependOnControlCorrectObj = {};\n if(Array.isArray(valueDependOnControlCorrect)) {\n if(Array.isArray(valueDependOnControlCorrect[0])) {\n valueDependOnControlCorrect.map(s => {\n valueDependOnControlCorrectObj[s[0]] = [s[1], s[2]];\n });\n } else {\n valueDependOnControlCorrectObj[valueDependOnControlCorrect[0]] = [valueDependOnControlCorrect[1], valueDependOnControlCorrect[2]];\n }\n }\n dependOnControlName.map(s => {\n let dependOnControlElementClass = targetControlElementClass.replace(controlName, s);\n if(dependOnControlElementClass) {\n dependOnControlElements = document.getElementsByClassName(dependOnControlElementClass);\n if(dependOnControlElements.length > 0 && dependOnControlElements[0].type) {\n valueDependOnControl[s] = dependOnControlElements[0].value;\n if(s in valueDependOnControlCorrectObj) {\n if(valueDependOnControlCorrectObj[s][1] === 'integer') {\n valueDependOnControl[s] = parseInt(valueDependOnControl[s]) + parseInt(valueDependOnControlCorrectObj[s][0]);\n } else if(valueDependOnControlCorrectObj[s][1] === 'string') {\n valueDependOnControl[s] = valueDependOnControl[s] + valueDependOnControlCorrectObj[s][0];\n }\n }\n dependOnControlElementsArr.push(dependOnControlElements[0]);\n }\n }\n });\n }\n\n return [valueDependOnControl, dependOnControlElementsArr];\n }\n\n let dependOnControlData = dependOnControlDataGet(dependOnControlName, targetControlElementClass, valueDependOnControlCorrect);\n WPTB_Helper.elementOptionsSet(kind, element, dependOnControlData[0], targetControlElementClass);\n\n Object.keys(dependOnControlData[0]).forEach(function (key) {\n let infArr = element.className.match( /wptb-element-((.+-)\\d+)/i );\n let unicClass = 'wptb-el-' + infArr[1] + '-' + [key];\n element.addEventListener(`wptb-control:${unicClass}`, function(event){\n let dependOnControlData = dependOnControlDataGet(dependOnControlName, targetControlElementClass, valueDependOnControlCorrect);\n WPTB_Helper.elementOptionsSet(kind, element, dependOnControlData[0], targetControlElementClass);\n }, false);\n });\n },\n /**\n * Sets the visibility of one control to depend on the state of other controls\n * @param dependOnMain\n * @param targetControlElementClass\n */\n appearDependOnControl: function( dependOnMain, targetControlElementClass ) {\n if( Array.isArray( dependOnMain ) ) {\n if(typeof dependOnMain[0] === 'string') {\n dependOnMain = [dependOnMain];\n } else if(!Array.isArray(dependOnMain[0])) {\n return;\n }\n let dependOnControlElementsValue = {};\n for(let i = 0; i < dependOnMain.length; i++) {\n let dependOn = dependOnMain[i];\n let dependOnControlName = dependOn[0];\n let infArr = targetControlElementClass.match(/wptb-el-((.+-)\\d+)-(.+)/i);\n\n if (infArr && Array.isArray(infArr)) {\n let controlName = infArr[3];\n\n let dependOnControlElementClass = targetControlElementClass.replace(controlName, dependOnControlName);\n if(dependOnControlElementClass) {\n let dependOnControlElements = document.getElementsByClassName(dependOnControlElementClass);\n if(dependOnControlElements.length > 0) {\n dependOnControlElementsValue[dependOn[0]] = [dependOnControlElementValue(dependOnControlElements, dependOn), dependOnControlElements, dependOn];\n }\n }\n }\n }\n\n let targetControlElement = document.getElementsByClassName( targetControlElementClass );\n if( targetControlElement.length > 0 ) {\n targetControlElement = targetControlElement[0];\n let controlContainerElem = WPTB_Helper.findAncestor( targetControlElement, 'wptb-element-option' );\n\n if( controlContainerElem ) {\n showHideTargetControlElement(controlContainerElem, dependOnControlElementsValue);\n\n Object.keys(dependOnControlElementsValue).map(k => {\n if (Object.prototype.hasOwnProperty.call(dependOnControlElementsValue, k)) {\n let dependOnControlElements = dependOnControlElementsValue[k][1];\n let dependOnControlElement = dependOnControlElements[0];\n dependOnControlElement.addEventListener( 'change', dependOnControlElementChangeHandler.bind(null, controlContainerElem, dependOnControlElementsValue, k), false );\n }\n });\n }\n }\n\n function dependOnControlElementChangeHandler(controlContainerElem, dependOnControlElementsValue, k) {\n let dependOn = dependOnControlElementsValue[k][2];\n let dependOnControlElements = dependOnControlElementsValue[k][1];\n dependOnControlElementsValue[dependOn[0]] = [dependOnControlElementValue(dependOnControlElements, dependOn), dependOnControlElements, dependOn];\n showHideTargetControlElement(controlContainerElem, dependOnControlElementsValue)\n }\n\n function showHideTargetControlElement(controlContainerElem, dependOnControlElementsValue) {\n let display = 'block';\n Object.keys(dependOnControlElementsValue).map(k => {\n if (Object.prototype.hasOwnProperty.call(dependOnControlElementsValue, k)) {\n if(dependOnControlElementsValue[k][0] === false){\n display = 'none';\n }\n }\n })\n\n controlContainerElem.style.display = display;\n }\n\n function dependOnControlElementValue(dependOnControlElements, dependOn) {\n let targetControlValue = WPTB_Helper.targetControlValueGet(dependOnControlElements);\n\n if(dependOn[1] && Array.isArray(dependOn[1]) &&\n (dependOn[1].indexOf(targetControlValue) !== -1 )) {\n return true;\n // let childCheck = controlContainerElem.querySelector('input[type=\"checkbox\"]')\n // if (childCheck) {\n // childCheck.checked = true;\n // }\n } else if(dependOn[2] && Array.isArray(dependOn[2]) &&\n (dependOn[2].indexOf(targetControlValue) !== -1)) {\n return false;\n }\n }\n }\n },\n //\n controlsStateManager: function ( targetControlClass, controlChangeIndic ) {\n let targetControls = document.getElementsByClassName( targetControlClass );\n if( targetControls.length > 0 ) {\n //targetControls = targetControls[0];\n\n let infArr = targetControlClass.match( /wptb-el-((.+-)\\d+)-(.+)/i );\n\n if( infArr && Array.isArray( infArr ) ) {\n let selectorElement;\n selectorElement = document.querySelector( '.wptb-element-' + infArr[1] );\n\n if( selectorElement ) {\n let elementsSettingsTemplatesJs;\n let elementSettings = {};\n let elementsSettings;\n elementsSettingsTemplatesJs = document.getElementsByClassName( 'wptb-element-datas' );\n if( elementsSettingsTemplatesJs.length == 0 || elementsSettingsTemplatesJs[0].innerHTML == '' ) {\n let targetControlValue = WPTB_Helper.targetControlValueGet( targetControls );\n elementSettings['data-' + targetControlClass] = targetControlValue;\n\n elementsSettings = {};\n elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] = elementSettings;\n elementsSettings = JSON.stringify( elementsSettings );\n\n if( elementsSettingsTemplatesJs.length == 0 ) {\n elementsSettingsTemplatesJs = document.createElement( 'script' );\n elementsSettingsTemplatesJs.setAttribute( 'type', 'text/html' );\n elementsSettingsTemplatesJs.setAttribute( 'class', 'wptb-element-datas' );\n } else {\n elementsSettingsTemplatesJs = elementsSettingsTemplatesJs[0];\n }\n\n elementsSettingsTemplatesJs.innerHTML = elementsSettings;\n\n let body = document.getElementsByTagName('body')[0];\n body.appendChild( elementsSettingsTemplatesJs );\n } else {\n elementsSettingsTemplatesJs = elementsSettingsTemplatesJs[0];\n elementsSettings = elementsSettingsTemplatesJs.innerHTML;\n if( elementsSettings ) {\n elementsSettings = elementsSettings.trim();\n elementsSettings = JSON.parse( elementsSettings );\n\n if( elementsSettings && typeof elementsSettings === 'object' ) {\n\n\n if( controlChangeIndic ) {\n let targetControlValue = WPTB_Helper.targetControlValueGet( targetControls );\n if( ! ( ( 'tmpl-wptb-el-datas-' + infArr[1] ) in elementsSettings ) ||\n typeof elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] !== 'object') {\n elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] = {};\n }\n elementsSettings['tmpl-wptb-el-datas-' + infArr[1]]['data-' + targetControlClass] = targetControlValue;\n elementsSettingsTemplatesJs.innerHTML = JSON.stringify( elementsSettings );\n } else if( ! ( ( ( 'tmpl-wptb-el-datas-' + infArr[1] ) in elementsSettings ) &&\n typeof elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] === 'object' &&\n ( 'data-' + targetControlClass ) in elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] ) ) {\n let targetControlValue = WPTB_Helper.targetControlValueGet( targetControls );\n if( ! ( ( 'tmpl-wptb-el-datas-' + infArr[1] ) in elementsSettings ) ||\n typeof elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] !== 'object') {\n elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] = {};\n }\n elementsSettings['tmpl-wptb-el-datas-' + infArr[1]]['data-' + targetControlClass] = targetControlValue;\n elementsSettingsTemplatesJs.innerHTML = JSON.stringify( elementsSettings );\n } else if( ( ( 'tmpl-wptb-el-datas-' + infArr[1] ) in elementsSettings ) &&\n typeof elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] === 'object' &&\n ( 'data-' + targetControlClass ) in elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] ) {\n for( let i = 0; i < targetControls.length; i++ ) {\n if( targetControls[i].type == 'checkbox' ) {\n let targetControlValue;\n if( targetControls[i].name ) {\n targetControlValue = elementsSettings['tmpl-wptb-el-datas-' + infArr[1]]['data-' + targetControlClass][targetControls[i].name];\n } else {\n targetControlValue = elementsSettings['tmpl-wptb-el-datas-' + infArr[1]]['data-' + targetControlClass];\n }\n\n if( targetControlValue == 'checked' ) {\n targetControls[i].checked = true;\n } else if( targetControlValue == 'unchecked' ) {\n targetControls[i].checked = false;\n }\n } else {\n targetControls[i].value = elementsSettings['tmpl-wptb-el-datas-' + infArr[1]]['data-' + targetControlClass];\n }\n }\n }\n }\n }\n }\n }\n }\n }\n },\n //\n targetControlValueGet: function( targetControls ) {\n let targetControlValue;\n for( let i = 0; i < targetControls.length; i++ ) {\n if( targetControls[i].type == 'checkbox' && targetControls[i].name ) {\n if( ! targetControlValue ) targetControlValue = {};\n if( targetControls[i].checked == true ) {\n targetControlValue[targetControls[i].name] = 'checked';\n } else {\n targetControlValue[targetControls[i].name] = 'unchecked';\n }\n } else if( targetControls[i].type == 'checkbox' ) {\n if( targetControls[i].checked == true ) {\n targetControlValue = 'checked';\n } else {\n targetControlValue = 'unchecked';\n }\n } else if( targetControls[i].type ) {\n targetControlValue = targetControls[i].value;\n } else if( targetControls[i].dataset.alignmentValue && targetControls[i].classList.contains( 'selected' ) ){\n targetControlValue = targetControls[i].dataset.alignmentValue;\n }\n }\n return targetControlValue;\n },\n //\n elementControlsStateCopy: function( elementProt, copyElem ) {\n if( elementProt && copyElem ) {\n let infArrProt = elementProt.className.match( /wptb-element-((.+-)\\d+)/i );\n let infArrCopy = copyElem.className.match( /wptb-element-((.+-)\\d+)/i );\n if( infArrProt && Array.isArray( infArrProt ) &&\n infArrCopy && Array.isArray( infArrCopy )) {\n let elemProtKind = infArrProt[1];\n let elemCopyKind = infArrCopy[1];\n let elementsSettingsTemplateJs = document.getElementsByClassName( 'wptb-element-datas' );\n if( elementsSettingsTemplateJs.length > 0 ) {\n elementsSettingsTemplateJs = elementsSettingsTemplateJs[0];\n\n let elementsSettings = elementsSettingsTemplateJs.innerHTML;\n if( elementsSettings ) {\n elementsSettings = elementsSettings.trim();\n elementsSettings = JSON.parse( elementsSettings );\n\n if( elementsSettings && typeof elementsSettings === 'object' ) {\n let elementSettingsProt = elementsSettings['tmpl-wptb-el-datas-' + elemProtKind];\n if( elementSettingsProt && typeof elementSettingsProt === 'object' ) {\n let elementSettingsCopy = {};\n\n Object.keys( elementSettingsProt ).forEach( function( key ) {\n let elementSettingValue = elementSettingsProt[key];\n let elementSettingKeyCopy = key.replace( elemProtKind, elemCopyKind );\n elementSettingsCopy[elementSettingKeyCopy] = elementSettingValue;\n });\n\n if( Object.keys( elementSettingsCopy ).length > 0 ) {\n elementsSettings['tmpl-wptb-el-datas-' + elemCopyKind] = elementSettingsCopy;\n\n elementsSettings = JSON.stringify( elementsSettings );\n elementsSettingsTemplateJs.innerHTML = elementsSettings;\n }\n }\n }\n }\n }\n }\n }\n },\n //\n elementControlsStateDelete: function( element, nameControl ) {\n let infArr = element.className.match( /wptb-element-(.+)-(\\d+)/i );\n let body = document.getElementsByTagName( 'body' )[0];\n let wptbElementDatas = body.getElementsByClassName( 'wptb-element-datas' );\n if( infArr && Array.isArray( infArr ) && wptbElementDatas.length > 0 ) {\n wptbElementDatas = wptbElementDatas[0];\n let elementsSettings = wptbElementDatas.innerHTML;\n if( elementsSettings ) {\n elementsSettings = elementsSettings.trim();\n elementsSettings = JSON.parse( elementsSettings );\n if( elementsSettings && typeof elementsSettings === 'object' &&\n ( ( 'tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2] ) in elementsSettings ) ) {\n if( ! nameControl ) {\n delete elementsSettings['tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2]];\n } else {\n if( elementsSettings['tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2]] &&\n typeof elementsSettings['tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2]] === 'object' &&\n ( 'data-wptb-el-' + infArr[1] + '-' + infArr[2] + '-' + nameControl ) in elementsSettings['tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2]] ) {\n delete elementsSettings['tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2]]['data-wptb-el-' + infArr[1] + '-' + infArr[2] + '-' + nameControl];\n }\n }\n\n if( Object.keys( elementsSettings ).length == 0 ) {\n body.removeChild( wptbElementDatas );\n } else {\n elementsSettings = JSON.stringify( elementsSettings );\n wptbElementDatas.innerHTML = elementsSettings;\n }\n }\n }\n }\n },\n //\n elementOptionsSet: function( kind, element, valueDependOnControl, targetControlElementClass ) {\n // get controls config for this element\n let wptbContrlStacksConfigId = 'wptb-' + kind + '-control-stack';\n let tmplControlsConfig = wp.template( wptbContrlStacksConfigId );\n let data;\n let elementContainerClass;\n let elementOptionClassIndic;\n let elementOptionsGroup;\n\n let controlElementParent;\n let elementOptionsScriptsContainer;\n\n let infArr = element.className.match( /wptb-element-((.+-)\\d+)/i );\n if( ! infArr ) {\n let table_id = WPTB_Helper.detectMode();\n if (!table_id) {\n table_id = 'startedid-0';\n }\n if( element.classList.contains( 'wptb-preview-table' ) ) {\n element.classList.add( 'wptb-element-main-table_setting-' + table_id );\n } else if( element.classList.contains( 'wptb-cell' ) ) {\n let cellEditActiveClass = document.querySelector('.wptb-element-table_cell_setting-' + element.dataset.xIndex + '-' + element.dataset.yIndex);\n if( ! cellEditActiveClass ) element.classList.add('wptb-element-table_cell_setting-' + element.dataset.xIndex + '-' + element.dataset.yIndex);\n }else if (element.classList.contains('wptb-responsive')){\n // if table id parsed from url is starting with 'wptb-team', it means it is team built prebuilt table with a unique id that doesn't fit infArr match regex, in that case, use default id for elements options\n if(table_id.startsWith('wptb_team')){\n table_id = 'startedid-0';\n }\n element.classList.add('wptb-element-table_responsive_setting-' + table_id);\n }\n\n infArr = element.className.match( /wptb-element-((.+-)\\d+)/i );\n }\n\n data = {\n container: '.' + infArr[0]\n };\n let controlName;\n data.valueDependOnControl = {};\n if(valueDependOnControl) {\n Object.keys(valueDependOnControl).forEach(function (key) {\n data.valueDependOnControl[key] = valueDependOnControl[key];\n });\n }\n if(targetControlElementClass) {\n let infArr = targetControlElementClass.match(/wptb-el-((.+-)\\d+)-(.+)/i);\n\n if (infArr && Array.isArray(infArr)) {\n controlName = infArr[3];\n }\n }\n\n elementContainerClass = infArr[0];\n elementOptionClassIndic = infArr[1];\n\n if( element.classList.contains( 'wptb-preview-table' ) ) {\n\n } else if( element.classList.contains( 'wptb-cell' ) ) {\n this.activateSection('cell_settings');\n }else if (element.classList.contains('wptb-responsive')){\n elementOptionsGroupId = 'table-responsive-group';\n wptbelementOptionClass = 'wptb-element-option';\n }\n else {\n let children = document.getElementById( 'element-options-group' ).childNodes;\n for ( let i = 0; i < children.length; i++) {\n if ( children[i].style )\n children[i].style.display = 'none';\n }\n this.activateSection('options_group');\n }\n\n let controlsConfigJson = tmplControlsConfig( data );\n let controlsConfig = JSON.parse( controlsConfigJson );\n\n let elementOptionsGroupIdsInvolved = [],\n elementOptionsGroupInvolved = {},\n elementOptionsContainerInvolved = {};\n\n // object for save all scrips for each controls\n let controlScriptsObj = {};\n\n // array for keep \"appear depend on\" params\n let controlappearDependOnControl = [];\n\n // array for keep \"value depend on\" params\n let controlValueDependOnControl = [];\n\n // create controls\n let elementOptionsScriptsContainerIndic = false;\n if(controlName) {\n let controlsConfigNew = {};\n controlsConfigNew[controlName] = controlsConfig[controlName];\n controlsConfig = controlsConfigNew;\n }\n let i = 0;\n Object.keys( controlsConfig ).forEach( function( key ) {\n let data = controlsConfig[key];\n data.controlKey = key;\n\n // get necessary wp js template\n let tmplControlTemplate = wp.template( 'wptb-' + data.type + '-control' );\n\n data.elemContainer = elementContainerClass;\n data.elementControlTargetUnicClass = 'wptb-el-' + elementOptionClassIndic + '-' + data.controlKey;\n Object.keys(data).map(k => {\n if (Object.prototype.hasOwnProperty.call(data, k) && data[k] === 'control_param_calculate_value') {\n data[k] = WPTB_Helper.controlParamCalculateValue(data.elementControlTargetUnicClass, k);\n }\n });\n let controlTemplate = tmplControlTemplate( data );\n if( 'appearDependOnControl' in data ) {\n if( Array.isArray( data.appearDependOnControl ) ) {\n controlappearDependOnControl.push( [data.appearDependOnControl, data.elementControlTargetUnicClass] );\n }\n }\n\n if('valueDependOnControl' in data && !valueDependOnControl && !targetControlElementClass) {\n let valueDependOnControlCorrect = '';\n if(data.valueDependOnControlCorrect) valueDependOnControlCorrect = data.valueDependOnControlCorrect;\n controlValueDependOnControl.push([data.valueDependOnControl, data.elementControlTargetUnicClass, valueDependOnControlCorrect]);\n }\n\n function elementOptionsContainerInvolvedGet(elementOptionsGroupId, elementOptionsContainerInvolved) {\n if(!elementOptionsContainerInvolved[elementOptionsGroupId]){\n let elementOptionsContainer = document.createElement( 'div' );\n elementOptionsContainer.classList.add( 'wptb-element-options', 'wptb-options-' + infArr[1] );\n document.getElementById( elementOptionsGroupId ).appendChild(elementOptionsContainer);\n elementOptionsContainerInvolved[elementOptionsGroupId] = elementOptionsContainer;\n }\n\n return elementOptionsContainerInvolved[elementOptionsGroupId];\n }\n\n if(elementOptionsGroupIdsInvolved.indexOf(data.elementOptionsGroupId) == -1 && !controlName) {\n elementOptionsGroupIdsInvolved.push(data.elementOptionsGroupId);\n // clear elements from options group\n //document.getElementById( 'element-options-group' ).innerHTML = '';\n elementOptionsGroup = document.getElementById(data.elementOptionsGroupId);\n let elementOptionsGroupChildren = [...elementOptionsGroup.children];\n for( let i = 0; i < elementOptionsGroupChildren.length; i++ ) {\n elementOptionsGroup.removeChild( elementOptionsGroupChildren[i] );\n }\n elementOptionsGroupInvolved[data.elementOptionsGroupId] = elementOptionsGroup;\n }\n\n controlElementParent = elementOptionsGroupInvolved[data.elementOptionsGroupId];\n\n if(data.elementOptionsContainerOn === 'true' && !controlName) {\n controlElementParent = elementOptionsContainerInvolvedGet(data.elementOptionsGroupId, elementOptionsContainerInvolved);\n }\n\n\n if(data.elementOptionContainerOn === 'true') {\n let elementOptionContainer = document.createElement( 'div' );\n elementOptionContainer.classList.add( data.elementOptionClass, 'wptb-settings-items' );\n\n if( data.customClassForContainer ) {\n elementOptionContainer.classList.add( data.customClassForContainer );\n }\n\n if( data.containerAdditionalStyles ) {\n elementOptionContainer.setAttribute( 'style', data.containerAdditionalStyles );\n }\n\n if(targetControlElementClass) {\n let targetControlElement = document.getElementsByClassName( targetControlElementClass );\n if( targetControlElement.length > 0 ) {\n targetControlElement = targetControlElement[0];\n let controlContainerElem = WPTB_Helper.findAncestor(targetControlElement, 'wptb-element-option');\n\n if (controlContainerElem) {\n let controlContainerElemParent = controlContainerElem.parentNode;\n controlContainerElemParent.insertBefore(elementOptionContainer, controlContainerElem);\n controlContainerElemParent.removeChild(controlContainerElem);\n }\n }\n } else {\n controlElementParent.appendChild( elementOptionContainer );\n }\n controlElementParent = elementOptionContainer;\n }\n controlElementParent.innerHTML = controlElementParent.innerHTML + controlTemplate;\n\n let helperJavascriptElem = controlElementParent.getElementsByTagName( 'wptb-template-script' );\n if( helperJavascriptElem.length > 0 ) {\n helperJavascriptElem = helperJavascriptElem[0];\n let helperJavascriptCode = helperJavascriptElem.innerText;\n controlElementParent.removeChild( helperJavascriptElem );\n let script = document.createElement( 'script' );\n script.setAttribute( 'type', 'text/javascript' );\n script.setAttribute('id', kind + '-' + data.controlKey);\n script.innerHTML = helperJavascriptCode.replace(/\\r|\\n|\\t/g, '').trim();\n if(!controlScriptsObj[data.elementOptionsGroupId] || !Array.isArray(controlScriptsObj[data.elementOptionsGroupId])) {\n controlScriptsObj[data.elementOptionsGroupId] = [];\n }\n controlScriptsObj[data.elementOptionsGroupId].push( script );\n }\n\n i++;\n });\n\n element.optionsGroupIds = elementOptionsGroupIdsInvolved;\n\n Object.keys( controlScriptsObj ).forEach( function( elementOptionsGroupId ) {\n if(!targetControlElementClass) {\n elementOptionsScriptsContainer = document.createElement( 'div' );\n elementOptionsScriptsContainer.classList.add( 'wptb-element-options-scripts', 'wptb-options-' + infArr[1] );\n elementOptionsGroupInvolved[elementOptionsGroupId].appendChild(elementOptionsScriptsContainer);\n }\n\n let controlScriptsArr = controlScriptsObj[elementOptionsGroupId];\n if( controlScriptsArr.length > 0 ) {\n for( let i = 0; i < controlScriptsArr.length; i++ ) {\n if(targetControlElementClass) {\n let id = kind + '-' + controlName;\n let script = document.getElementById(id);\n elementOptionsScriptsContainer = script.parentNode;\n elementOptionsScriptsContainer.insertBefore(controlScriptsArr[i], script);\n elementOptionsScriptsContainer.removeChild(script);\n } else {\n elementOptionsScriptsContainer.appendChild(controlScriptsArr[i]);\n }\n }\n }\n });\n\n // run the scripts of controls\n\n // run appearDependOnControl function\n for ( let i = 0; i < controlappearDependOnControl.length; i++ ) {\n WPTB_Helper.appearDependOnControl( controlappearDependOnControl[i][0], controlappearDependOnControl[i][1] );\n }\n\n WPTB_Helper.wptbDocumentEventGenerate( 'element:controls:active', element );\n // run valueDependOnControl function\n for (let i = 0; i < controlValueDependOnControl.length; i++) {\n WPTB_Helper.valueDependOnControl(controlValueDependOnControl[i][0], controlValueDependOnControl[i][1], controlValueDependOnControl[i][2], kind, element);\n }\n\n },\n\n /**\n *\n * @param unicClass\n * @param controlKey\n * @param key\n * @returns {*}\n */\n controlParamCalculateValue: function(unicClass, key) {\n let unicClassP = WPTB_Helper.replaceAll(unicClass, '-', '_');\n if (window['paramCalculateValue_' + unicClassP + '_' + key] && typeof (window['paramCalculateValue_' + unicClassP + '_' + key]) === \"function\") {\n return window['paramCalculateValue_' + unicClassP + '_' + key]();\n }\n },\n\n controlParamCalculateValueCreateFunction: function(element, controlKey, key, handlerFunction) {\n const infArr = element.className.match( /wptb-element-((.+-)\\d+)/i );\n const unicClass = 'wptb-el-' + infArr[1] + '-' + controlKey;\n let unicClassP = WPTB_Helper.replaceAll(unicClass, '-', '_');\n window['paramCalculateValue_' + unicClassP + '_' + key] = function () {\n return handlerFunction(element);\n };\n },\n\n /**\n * function for create, update css for element\n *\n * @param elementContainer\n * @param selector\n * @param cssName\n * @param cssValue\n */\n managerExternalCssStyles: function( elementContainer, selector, cssName, cssValue ) {\n let infArr = elementContainer.match( /wptb-element-main(.+)-(\\d+)/i );\n if( ! infArr || ! Array.isArray( infArr ) ) {\n let table = document.getElementsByClassName( 'wptb-preview-table' );\n\n if( table.length > 0 ) {\n table = table[0];\n\n let infArr = table.className.match( /wptb-element-main(.+)-(\\d+)/i );\n if( infArr && Array.isArray( infArr ) ) {\n selector = '.' + infArr[0] + ' ' + selector;\n }\n }\n }\n\n let head = document.head;\n if( head ) {\n let cssForThisElement = head.querySelector( '#styles-' + elementContainer );\n if( cssForThisElement ) {\n let cssText = cssForThisElement.innerHTML;\n if( cssText ) {\n let cssTextArrFirst = cssText.split( '}' );\n cssTextArrFirst.pop();\n let selectorExists = false;\n for( let i = 0; i < cssTextArrFirst.length; i++ ) {\n let cssTextArrSecond = cssTextArrFirst[i].split( '{' );\n if( cssTextArrSecond[0] === selector ) {\n let cssTextArrThird = cssTextArrSecond[1].split( ';' );\n cssTextArrThird.pop();\n let cssNameExists = false;\n for( let j = 0; j < cssTextArrThird.length; j++ ) {\n let cssTextArrFourth = cssTextArrThird[j].split( ':' );\n if( cssTextArrFourth[0] === cssName ) {\n if( cssValue ) {\n cssTextArrThird[j] = cssName + ':' + cssValue;\n } else {\n cssTextArrThird.splice( j, 1 );\n }\n\n cssTextArrSecond[1] = cssTextArrThird.join( ';' ) ? cssTextArrThird.join( ';' ) + ';' : '';\n cssNameExists = true;\n break;\n }\n }\n if( ! cssNameExists ) {\n if( cssValue ) {\n cssTextArrSecond[1] += cssName + ':' + cssValue + ';';\n }\n }\n if( cssTextArrSecond[1] ) {\n cssTextArrFirst[i] = cssTextArrSecond[0] + '{' + cssTextArrSecond[1]\n } else {\n cssTextArrFirst.splice( i, 1 );\n }\n if( cssTextArrFirst.join( '}' ) ) {\n cssForThisElement.innerHTML = cssTextArrFirst.join( '}' ) + '}';\n } else {\n head.removeChild( cssForThisElement );\n }\n\n selectorExists = true;\n break;\n }\n }\n\n if( ! selectorExists ) {\n if( cssValue ) {\n cssForThisElement.innerHTML = cssText + selector + '{' + cssName + ':' + cssValue + ';}';\n } else {\n cssForThisElement.innerHTML = cssText;\n }\n }\n } else {\n if( cssValue ) {\n cssForThisElement.innerHTML = selector + '{' + cssName + ':' + cssValue + ';}';\n } else {\n head.removeChild( cssForThisElement );\n }\n }\n } else {\n if( cssValue ) {\n let cssForThisElement = document.createElement( 'style' );\n cssForThisElement.setAttribute( 'id', 'styles-' + elementContainer );\n cssForThisElement.classList.add( 'styles-wptb-elements' );\n cssForThisElement.innerHTML = selector + '{' + cssName + ':' + cssValue + ';}';\n head.appendChild( cssForThisElement );\n }\n }\n }\n },\n /**\n *\n * Register section parts for sidebar\n *\n * @param {array} sections an array of section names\n */\n registerSections(sections) {\n this.sections = {};\n this.currentSection = '';\n if (!Array.isArray(sections)) {\n sections = [sections];\n }\n\n sections.map(s => {\n const sectionElement = document.querySelector(`[data-wptb-section=${s}]`);\n if (sectionElement) {\n this.sections[s] = sectionElement;\n }\n })\n },\n /**\n * Activate a registered section and deactivates others\n *\n * @param {string} sectionDataId section name to be activated\n * @param {string} displayType display type override for section to be used in its display style property\n */\n activateSection(sectionDataId, displayType = 'block') {\n this.currentSection=sectionDataId;\n this.triggerSectionEvent(sectionDataId);\n Object.keys(this.sections).map(k => {\n if (Object.prototype.hasOwnProperty.call(this.sections, k)) {\n const visibility = sectionDataId === k ? displayType : 'none';\n this.sections[k].style = `display: ${visibility} !important`;\n }\n })\n },\n /**\n * Get id of current active section\n *\n * @returns {string} active section i\n */\n getCurrentSection(){\n return this.currentSection;\n },\n /**\n * Get current section from search parameter 'wptb-builder-section' of window location\n */\n getSectionFromUrl(){\n const parsedUrl = new URL(window.location.href);\n const urlSection = parsedUrl.searchParams.get('wptb-builder-section');\n if(urlSection){\n if(Object.keys(this.sections).some(key => key===urlSection)){\n this.activateSection(urlSection);\n }\n }\n },\n /**\n * Set up related buttons and links to trigger certain elements\n */\n setupSectionButtons() {\n const sectionButtons = Array.from( document.querySelectorAll('[data-wptb-section-button'));\n const vm = this;\n\n sectionButtons.map(s => {\n const sectionName = s.dataset.wptbSectionButton;\n s.addEventListener('click', function() {\n const displayType = s.dataset.wptbSectionDisplayType;\n vm.activateSection(sectionName, displayType);\n })\n\n document.addEventListener('wptbSectionChanged', (e)=> {\n if(e.detail === sectionName){\n s.classList.remove('disabled');\n s.classList.add('active');\n }else{\n s.classList.remove('active');\n s.classList.add('disabled');\n }\n })\n })\n },\n setupPanelToggleButtons(){\n const $ = jQuery;\n\n $('.wptb-panel-toggle-group').each(function(){\n const vm = $(this);\n $(this).find('.toggle-icon').click(() => {\n vm.find('.wptb-panel-toggle-target').slideToggle();\n vm.toggleClass('wptb-panel-toggle-content');\n })\n })\n },\n /**\n * Trigger a section change event\n *\n * @param {string} sectionName section name\n */\n triggerSectionEvent(sectionName){\n const sectionEvent = new CustomEvent('wptbSectionChanged', {detail: sectionName});\n\n document.dispatchEvent(sectionEvent);\n },\n /**\n * Setup sidebar toggle element\n *\n * @param {string} toggleSelector query selector for drawer toggle element\n */\n setupSidebarToggle(toggleSelector){\n const toggleButton = document.querySelector(toggleSelector);\n if(toggleButton){\n toggleButton.addEventListener('click', (e)=>{\n e.preventDefault();\n document.body.classList.toggle('collapsed');\n })\n }\n },\n // function for deleting all external CSS for the element\n externalCssStylesDelete: function( elementContainerClass ) {\n let head = document.head;\n if( head ) {\n let cssForThisElement = head.querySelector( '#styles-' + elementContainerClass );\n\n if( cssForThisElement ) {\n head.removeChild( cssForThisElement );\n }\n }\n },\n // function for copy all external CSS for the element\n externalCssStylesCopy: function( activeElement, copyElement ) {\n if( activeElement ) {\n let infArr = activeElement.className.match( /wptb-element-(.+)-(\\d+)/i );\n if( infArr && Array.isArray( infArr ) ) {\n let activeElemClass = infArr[0];\n\n let head = document.head;\n if( head ) {\n let cssForActiveElement = head.querySelector( '#styles-' + activeElemClass );\n\n if( cssForActiveElement ) {\n let cssForNewElement = cssForActiveElement.cloneNode( true );\n\n cssForNewElement.removeAttribute( 'id', 'styles-' + activeElemClass );\n\n let infArrCopyEl = copyElement.className.match( /wptb-element-(.+)-(\\d+)/i );\n if( infArrCopyEl && Array.isArray( infArrCopyEl ) ) {\n cssForNewElement.setAttribute( 'id', 'styles-' + infArrCopyEl[0] );\n let cssForActiveElementInnerHTML = cssForActiveElement.innerHTML;\n let cssForNewElementInnerHTML = WPTB_Helper.replaceAll( cssForActiveElementInnerHTML, activeElemClass, infArrCopyEl[0] );\n cssForNewElement.innerHTML = cssForNewElementInnerHTML;\n head.appendChild( cssForNewElement );\n }\n }\n }\n }\n }\n },\n // function for convertation elements stiles in json\n elementsStylesConvertToObject: function() {\n let head = document.head;\n let stylesElements = head.querySelectorAll( '.styles-wptb-elements' );\n let stylesObj = {};\n for( let i = 0; i < stylesElements.length; i++ ) {\n let styleElemId = stylesElements[i].getAttribute( 'id' );\n if( styleElemId && stylesElements[i].innerHTML ) {\n stylesObj[styleElemId] = stylesElements[i].innerHTML;\n }\n }\n\n if( Object.keys( stylesObj ).length != 0 ) {\n return JSON.stringify( stylesObj );\n }\n return '';\n },\n // function for set scc styles tags to head\n elementsStylesSetFromObject: function( jsonObject ) {\n let head = document.head;\n if( head ) {\n let stylesElements = head.querySelectorAll( '.styles-wptb-elements' );\n if( stylesElements.length > 0 ) {\n stylesElements = [...stylesElements];\n for( let i = 0; i < stylesElements.length; i++ ) {\n head.removeChild( stylesElements[i] );\n }\n }\n if( jsonObject ) {\n let stylesObj = JSON.parse( jsonObject );\n if( Object.keys( stylesObj ).length != 0 ) {\n Object.keys( stylesObj ).forEach( function( key ) {\n let cssText = stylesObj[key];\n let styleCss = document.createElement( 'style' );\n styleCss.setAttribute( 'id', key );\n styleCss.classList.add( 'styles-wptb-elements' );\n styleCss.innerHTML = cssText;\n head.appendChild( styleCss );\n });\n }\n }\n }\n },\n // function for table saving\n saveTable: function( event, startSaving, previewSaving ) {\n if( ! previewSaving && ! startSaving ) {\n if( ( ! event.target.dataset.wptbTableStateNumberSave && window.wptbTableStateNumberShow == 0 ) ||\n window.wptbTableStateNumberShow == event.target.dataset.wptbTableStateNumberSave ) {\n //return;\n }\n }\n\n if( ! previewSaving ) {\n let bar = document.querySelector( '.wptb-edit-bar' );\n if ( bar && bar.classList.contains( 'visible' ) ) {\n let table = document.getElementsByClassName( 'wptb-preview-table' )[0];\n WPTB_Helper.toggleTableEditMode();\n }\n }\n\n // before save event trigger\n WPTB_Helper.wptbDocumentEventGenerate('wptb:save:before', document);\n\n let http = new XMLHttpRequest(),\n url = ( wptb_admin_object ? wptb_admin_object.ajaxurl : ajaxurl ) + \"?action=save_table\",\n t = document.getElementById( 'wptb-setup-name' ).value.trim(),\n messagingArea,\n code,\n datas;\n\n code = document.getElementsByClassName( 'wptb-preview-table' );\n\n let postId;\n if (( rs = WPTB_Helper.detectMode() ) || ( rs = document.wptbId )) {\n postId = rs;\n }\n let paramIdsNecessaryChange = false;\n if( code.length > 0 ) {\n code = code[0];\n let codeClone = code.cloneNode( true );\n if( postId ) {\n if( codeClone.classList.contains( 'wptb-element-main-table_setting-startedid-0' ) ) {\n codeClone.classList.remove( 'wptb-element-main-table_setting-startedid-0' );\n codeClone.classList.add( 'wptb-element-main-table_setting-' + postId );\n let wptbTableSetup = document.querySelector('.wptb-table-setup');\n if(wptbTableSetup) {\n wptbTableSetup.innerHTML = '';\n wptbTableSetup.appendChild(codeClone);\n WPTB_Table();\n }\n paramIdsNecessaryChange = true;\n }\n }\n codeClone.columns = code.columns;\n code = WPTB_Stringifier( codeClone );\n code = code.outerHTML;\n } else {\n code = '';\n }\n\n if( ! previewSaving ) {\n datas = '';\n let datas_containers = document.getElementsByClassName( 'wptb-element-datas' );\n\n if( datas_containers.length > 0 ) {\n if( datas_containers[0].innerHTML ) {\n datas = datas_containers[0].innerHTML;\n\n if( paramIdsNecessaryChange ) {\n datas = WPTB_Helper.replaceAll( datas, 'tmpl-wptb-el-datas-main-table_setting-startedid-0',\n 'tmpl-wptb-el-datas-main-table_setting-' + postId );\n\n datas = WPTB_Helper.replaceAll( datas, 'data-wptb-el-main-table_setting-startedid-0',\n 'data-wptb-el-main-table_setting-' + postId );\n }\n }\n }\n }\n\n let styleObjJson = WPTB_Helper.elementsStylesConvertToObject();\n if( paramIdsNecessaryChange ) {\n styleObjJson = WPTB_Helper.replaceAll( styleObjJson, '.wptb-element-main-table_setting-startedid-0',\n '.wptb-element-main-table_setting-' + postId );\n }\n\n if ( t === '' && code === '' ) {\n let messagingAreaText = '';\n if( t === '' ) messagingAreaText += 'You must assign a name to the table before saving it.</br>';\n if( code === '' ) messagingAreaText += 'Table wasn\\'t created';\n messagingArea = document.getElementById( 'wptb-messaging-area' );\n messagingArea.innerHTML = '<div class=\"wptb-error wptb-message\">Error: ' + messagingAreaText + '</div>';\n messagingArea.classList.add( 'wptb-warning' );\n setTimeout(function () {\n messagingArea.removeChild( messagingArea.firstChild );\n }, 4000 );\n return;\n }\n\n let params = {\n title: t,\n content: code,\n elements_datas: datas,\n elements_styles: styleObjJson,\n security_code: wptb_admin_object.security_code\n };\n\n\n if( previewSaving ) {\n params.preview_saving = previewSaving;\n }\n\n if ( postId ) {\n params.id = postId;\n }\n\n // wptb save before event\n WPTB_Helper.wptbDocumentEventGenerate('wptb:save:before', document, params);\n\n params = JSON.stringify( params );\n\n http.open('POST', url, true);\n http.setRequestHeader( 'Content-type', 'application/json; charset=utf-8' );\n\n http.onreadystatechange = function ( action ) {\n if ( this.readyState == 4 && this.status == 200 ) {\n var data = JSON.parse( http.responseText );\n messagingArea = document.getElementById( 'wptb-messaging-area' );\n\n if ( data[0] == 'saved' ) {\n let builderPageUrl = document.location.href.replace( '#', '' );\n let regex = new RegExp( '&table=(.+)', \"i\" );\n builderPageUrl = builderPageUrl.replace( regex, '' );\n window.history.pushState( null, null, builderPageUrl + '&table=' + data[1] );\n\n document.wptbId = data[1];\n messagingArea.innerHTML = '<div class=\"wptb-success wptb-message\">Table \"' + t + '\" was successfully saved.</div>';\n document.getElementsByClassName( 'wptb-embed-btn' )[0].classList.remove( 'wptb-button-disable' );\n document.getElementById( 'wptb-embed-shortcode' ).value = '[wptb id=' + data[1] + ']';\n let wptbPreviewTable = document.querySelector( '.wptb-preview-table' );\n let wptbPreviewBtn = document.getElementsByClassName( 'wptb-preview-btn' );\n if( wptbPreviewBtn.length > 0 ) {\n wptbPreviewBtn = wptbPreviewBtn[0];\n wptbPreviewBtn.classList.remove( 'wptb-button-disable' );\n let wptbPreviewBtnHref = wptbPreviewBtn.dataset.previewHref;\n wptbPreviewBtnHref = wptbPreviewBtnHref.replace( 'empty', data[1] );\n wptbPreviewBtn.setAttribute( 'href', wptbPreviewBtnHref );\n }\n\n event.target.dataset.wptbTableStateNumberSave = window.wptbTableStateNumberShow;\n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\n if( wptbSaveBtn.length > 0 ) {\n wptbSaveBtn = wptbSaveBtn[0];\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\n wptbSaveBtn.classList.remove('active');\n }\n // WPTB_Helper.saveTable( event, true );\n return;\n } else if( data[0] == 'edited' && startSaving ) {\n document.wptbId = data[1];\n messagingArea.innerHTML = '<div class=\"wptb-success wptb-message\">Table \"' + t + '\" was successfully saved.</div>';\n document.getElementsByClassName( 'wptb-embed-btn' )[0].classList.remove( 'wptb-button-disable' );\n document.getElementById( 'wptb-embed-shortcode' ).value = '[wptb id=' + data[1] + ']';\n let wptbPreviewTable = document.querySelector( '.wptb-preview-table' );\n let wptbPreviewBtn = document.getElementsByClassName( 'wptb-preview-btn' );\n if( wptbPreviewBtn.length > 0 ) {\n wptbPreviewBtn = wptbPreviewBtn[0];\n wptbPreviewBtn.classList.remove( 'wptb-button-disable' );\n let wptbPreviewBtnHref = wptbPreviewBtn.dataset.previewHref;\n wptbPreviewBtnHref = wptbPreviewBtnHref.replace( 'empty', data[1] );\n wptbPreviewBtn.setAttribute( 'href', wptbPreviewBtnHref );\n }\n\n event.target.dataset.wptbTableStateNumberSave = window.wptbTableStateNumberShow;\n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\n if( wptbSaveBtn.length > 0 ) {\n wptbSaveBtn = wptbSaveBtn[0];\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\n wptbSaveBtn.classList.remove('active');\n }\n } else if( data[0] == 'edited' ) {\n messagingArea.innerHTML = '<div class=\"wptb-success wptb-message\">Table \"' + t + '\" was successfully updated.</div>';\n event.target.dataset.wptbTableStateNumberSave = window.wptbTableStateNumberShow;\n\n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\n if( wptbSaveBtn.length > 0 ) {\n wptbSaveBtn = wptbSaveBtn[0];\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\n wptbSaveBtn.classList.remove('active');\n }\n } else if( data[0] == 'preview_edited' ) {\n return;\n } else {\n messagingArea.innerHTML = '<div class=\"wptb-error wptb-message\">Safety problems</div>';\n }\n messagingArea.classList.add( 'wptb-success' );\n setTimeout( function () {\n messagingArea.removeChild( messagingArea.firstChild );\n }, 4000 );\n }\n }\n http.send( params );\n },\n //\n clickOnFreeSpace: function() {\n // if current active section is responsive menu, ignore this functionality\n if(this.getCurrentSection() === 'table_responsive_menu'){\n return;\n }\n\n let cellModeBackground = document.querySelector( '#wptb-cell_mode_background' );\n if( cellModeBackground && cellModeBackground.classList.contains( 'visible' ) ) {\n return;\n }\n // document.getElementsByClassName( 'wptb-elements-container' )[0].style.display = 'table';\n // document.getElementsByClassName( 'wptb-settings-section' )[0].style.display = 'block';\n // document.getElementById( 'element-options-group' ).style.display = 'none';\n this.activateSection('elements');\n\n let wpcdFixedToolbar = document.getElementById( 'wpcd_fixed_toolbar' );\n if( wpcdFixedToolbar.hasAttribute( 'data-toolbar-active-id' ) ) {\n document.getElementById( wpcdFixedToolbar.getAttribute( 'data-toolbar-active-id' ) ).classList.remove( 'toolbar-active' );\n }\n let element = document.querySelector( '.wptb-preview-table' );\n if( element ) {\n WPTB_Helper.elementOptionsSet( 'table_setting', element );\n }\n },\n\n /*\n * function for sending of element ajax request\n */\n elementAjax: function( dataAjaxData, element ) {\n let http = new XMLHttpRequest(),\n url = ( wptb_admin_object ? wptb_admin_object.ajaxurl : ajaxurl ) + \"?action=wptb_element_ajax\";\n let element_name;\n let infArr = element.className.match( /wptb-element-(.+)-(\\d+)/i );\n if( infArr && Array.isArray( infArr ) ) {\n element_name = infArr[1];\n }\n\n let params = {\n element_ajax_data: dataAjaxData,\n element_name: element_name,\n security_code: wptb_admin_object.security_code\n };\n params = JSON.stringify( params );\n\n http.open( 'POST', url, true );\n http.setRequestHeader( 'Content-type', 'application/json; charset=utf-8' );\n\n http.onreadystatechange = function ( action ) {\n if ( this.readyState == 4 && this.status == 200 ) {\n var data = JSON.parse( http.responseText );\n let detail;\n if ( data && Array.isArray( data ) && data[0] == 'element_ajax_responce' ) {\n detail = {value: data[1]};\n } else {\n detail = '';\n }\n WPTB_Helper.wptbDocumentEventGenerate( 'wptb-element:ajax-response', element, detail );\n }\n }\n http.send( params );\n },\n\n /*\n * This just toggles visibility of cell edit bar, and toggles\n * cell selecting mode.\n */\n toggleTableEditMode: function ( close = false ) {\n let bar = document.getElementsByClassName('wptb-edit-bar'),\n cellModeBackground = document.getElementById('wptb-cell_mode_background'),\n leftScrollPanelCurtain = document.getElementById('wptb-left-scroll-panel-curtain'),\n leftScrollPanelCellSettings = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ),\n wptbPreviewTable = document.getElementsByClassName('wptb-preview-table');\n if (wptbPreviewTable.length > 0) {\n wptbPreviewTable = wptbPreviewTable[0];\n }\n\n if ( bar.length > 0 ) {\n let toggleEditMode = '';\n for ( let i = 0; i < bar.length; i++ ) {\n if ( bar[i].classList.contains( 'visible' ) ) {\n document.select.deactivateMultipleSelectMode();\n bar[i].classList.remove( 'visible' );\n cellModeBackground.classList.remove( 'visible' );\n leftScrollPanelCurtain.classList.remove( 'visible' );\n leftScrollPanelCellSettings.classList.remove( 'visible' );\n wptbPreviewTable.parentNode.classList.remove( 'wptb-preview-table-manage-cells' );\n let wptbPreviewTableTds = wptbPreviewTable.getElementsByTagName( 'td' );\n if ( wptbPreviewTableTds.length > 0 ) {\n for ( let i = 0; i < wptbPreviewTableTds.length; i++ ) {\n wptbPreviewTableTds[i].classList.remove( 'wptb-highlighted' );\n }\n }\n toggleEditMode = 'closed';\n WPTB_Helper.activateSection('elements')\n\n } else if( ! close ) {\n document.select.activateMultipleSelectMode();\n bar[i].classList.add( 'visible' );\n cellModeBackground.classList.add( 'visible' );\n leftScrollPanelCurtain.classList.add( 'visible' );\n wptbPreviewTable.parentNode.classList.add( 'wptb-preview-table-manage-cells' );\n\n toggleEditMode = 'opened';\n }\n }\n\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-edit-mode/' + toggleEditMode, wptbPreviewTable)\n }\n },\n\n /*\n * checking of dimension of value\n */\n checkingDimensionValue: function ( value, dimension ) {\n value = String( value );\n dimension = String( dimension );\n if( value && dimension ) {\n let searchIndex = value.indexOf( dimension );\n if ( searchIndex != -1 && searchIndex == ( value.length - dimension.length ) ) {\n return true;\n } else {\n return false;\n }\n } else {\n return false;\n }\n },\n\n /*\n * if dimension is included - checking and if it necessary setting value\n * without dimension - return value\n */\n checkSetGetStyleSizeValue: function( element, styleName, computedStyleName, dimension ) {\n let elemStyleValue = element.style[styleName];\n elemStyleValue = String( elemStyleValue );\n\n if( ! elemStyleValue || dimension ? ! ( WPTB_Helper.checkingDimensionValue( elemStyleValue, dimension ) ) : false ){\n let elementStyles = window.getComputedStyle( element );\n if( computedStyleName && elementStyles.getPropertyValue( computedStyleName ) && dimension ? WPTB_Helper.checkingDimensionValue( elementStyles.getPropertyValue( computedStyleName ), dimension ) : true ) {\n if( ! dimension ) {\n return elementStyles.getPropertyValue( computedStyleName );\n } else {\n element.style[styleName] = elementStyles.getPropertyValue( computedStyleName );\n }\n } else {\n if( ! dimension ) {\n return false;\n } else {\n element.style[styleName] = null;\n }\n }\n } else if( ! dimension ) {\n return elemStyleValue;\n }\n\n return element.style[styleName];\n },\n\n /*\n * function checking that element has the style\n * if this style is present - checking the format color\n * if param set is true - setting style for element (consider hex format of color)\n * if param set is false - getting style from element\n */\n checkSetGetStyleColorValue: function ( element, styleName, computedStyleName, set = false ) {\n let elemStyleColorValue = element.style[styleName];\n\n if( ! elemStyleColorValue ) {\n let elementStyles = window.getComputedStyle( element, null );\n\n if( elementStyles && elementStyles.getPropertyValue( computedStyleName ) ) {\n\n if( set ) {\n elemStyleColorValue = WPTB_Helper.rgbToHex( elementStyles.getPropertyValue( computedStyleName ) );\n if( WPTB_Helper.isHex( elemStyleColorValue ) ) {\n element.style[styleName] = elemStyleColorValue;\n } else {\n element.style[styleName] = '';\n }\n } else {\n return elementStyles.getPropertyValue( computedStyleName );\n }\n\n } else {\n if( set ) {\n element.style[styleName] = '';\n } else {\n return '';\n }\n }\n } else if( ! set ) {\n return elemStyleColorValue;\n }\n },\n\n /*\n * function checking that element has the style\n * if this style is present - checking the format color\n * if param set is true - setting style for element (consider hex format of color)\n * if param set is false - getting style from element\n */\n checkSetGetStyleValue: function ( element, styleName, computedStyleName, set = false ) {\n let elemStyleColorValue = element.style[styleName];\n\n if( ! elemStyleColorValue ) {\n let elementStyles = window.getComputedStyle( element, null );\n\n if( elementStyles && elementStyles.getPropertyValue( computedStyleName ) ) {\n\n if( set ) {\n element.style[styleName] = elementStyles.getPropertyValue( computedStyleName );\n } else {\n return elementStyles.getPropertyValue( computedStyleName );\n }\n\n } else if( ! set ) {\n return '';\n }\n } else if( ! set ) {\n return elemStyleColorValue;\n }\n },\n\n /*\n * get the value of the same elements that have the most count\n */\n getValueMaxCountSameElementsInArray: function ( arr ) {\n if( arr && Array.isArray( arr ) ) {\n let check = {};\n let countEmpty = 0;\n for( let i = 0; i < arr.length; i++ ) {\n if(arr[i]) {\n if( check[arr[i]] ) {\n check[arr[i]]++;\n } else {\n check[arr[i]] = 1;\n }\n } else {\n countEmpty++;\n }\n }\n\n let maxPropName;\n for ( let key in check ) {\n if( ! maxPropName ) {\n maxPropName = key;\n continue;\n } else {\n if( check[maxPropName] < check[key] ) {\n maxPropName = key;\n }\n }\n }\n\n return check[maxPropName] >= countEmpty ? maxPropName : '';\n }\n },\n\n /*\n * For assigning to each cell xIndex and y Index attributes,\n * these are the column number and row number of cell in table.\n */\n recalculateIndexes: function ( table ) {\n WPTB_RecalculateIndexes(table);\n },\n\n /**\n * Table Rows colors reinstall\n */\n tableRowsColorsReinstall: function ( table ) {\n let infArr = table.className.match( /wptb-element-main(.+)-(\\d+)/i );\n if( infArr && Array.isArray( infArr ) ) {\n let tableIndex = '';\n if( infArr[infArr.length -1] == '0' ) {\n tableIndex = 'startedid-0';\n } else {\n tableIndex = infArr[infArr.length -1];\n }\n\n let tableHeaderBackground = document.querySelector('.wptb-el-main-table_setting-' + tableIndex + '-tableHeaderBackground' );\n if( tableHeaderBackground ) {\n let details = {value: tableHeaderBackground.value};\n WPTB_Helper.wptbDocumentEventGenerate( 'controlColor:change', tableHeaderBackground, details );\n }\n\n let tableEvenRowBackground = document.querySelector('.wptb-el-main-table_setting-' + tableIndex + '-tableEvenRowBackground' );\n if( tableEvenRowBackground ) {\n let details = {value: tableEvenRowBackground.value};\n WPTB_Helper.wptbDocumentEventGenerate( 'controlColor:change', tableEvenRowBackground, details );\n }\n\n let tableOddRowBackground = document.querySelector('.wptb-el-main-table_setting-' + tableIndex + '-tableOddRowBackground' );\n if( tableOddRowBackground ) {\n let details = {value: tableOddRowBackground.value};\n WPTB_Helper.wptbDocumentEventGenerate( 'controlColor:change', tableOddRowBackground, details );\n }\n }\n },\n /**\n * Get parent html element of given type\n *\n * @param {string} parentType type of parent element\n * @param {HTMLElement} el current element\n * @returns {*} html element of type\n */\n getParentOfType: (parentType, el) => {\n if(el.nodeName === parentType.toUpperCase()) {\n return el;\n }\n\n return WPTB_Helper.getParentOfType(parentType , el.parentElement);\n },\n // current relative type of drag element\n // this type is used on differentiating certain elements based on their positioning on table\n dragRelativeType : '',\n /**\n *\n * @param {string} val drag relative type\n */\n setDragRelativeType: function (val){\n this.dragRelativeType = val;\n },\n // get drag relative type\n getDragRelativeType : function(){\n return this.dragRelativeType;\n },\n /**\n *\n * @param {HTMLElement} element\n * @param {string} styleName\n */\n getElementColorStylesHex: function (element, styleName) {\n let color = element.style[styleName];\n color = WPTB_Helper.rgbToHex( color );\n if( ! WPTB_Helper.isHex( color ) ) {\n color = '';\n }\n return color;\n },\n /**\n * Show element controls on adding them to table.\n */\n showControlsOnElementMount(){\n document.addEventListener('element:mounted:dom', function(e){\n e.target.click();\n });\n },\n /**\n * Show elements list menu on left panel on removing element from table\n */\n showElementsListOnRemove(){\n document.addEventListener('element:removed:dom', function(){\n WPTB_Helper.activateSection('elements');\n })\n },\n blockTinyMCEManageCells: function (){\n const addBlocker = (parent) => {\n const blockerElement = document.createElement('div');\n blockerElement.classList.add('wptb-plugin-blocker-element');\n parent.appendChild(blockerElement);\n }\n\n const removeBlocker = (parent) => {\n const blockerElement = parent.querySelector('.wptb-plugin-blocker-element');\n if(blockerElement){\n blockerElement.remove();\n }\n }\n document.addEventListener('wptbSectionChanged' , ({detail}) => {\n const table = document.querySelector('.wptb-table-setup table.wptb-preview-table');\n const cells = Array.from(table.querySelectorAll('td'));\n\n cells.map(removeBlocker);\n\n if(detail === 'manage_cells' || detail === 'cell_settings'){\n cells.map(addBlocker);\n }\n })\n\n document.addEventListener('wptb:save:before' , () => {\n const table = document.querySelector('.wptb-table-setup table.wptb-preview-table');\n const cells = Array.from(table.querySelectorAll('td'));\n\n cells.map(removeBlocker);\n })\n }\n}\n","var WPTB_Initializer = function () {\n\n const MIN_COLUMNS = 1,\n MIN_ROWS = 1,\n MAX_COLUMNS = 30,\n MAX_ROWS = 30;\n\n var tableGenerator = document.body;\n columnsDecrementButton = tableGenerator.getElementsByClassName('wptb-input-number-decrement')[0],\n columnsIncrementButton = tableGenerator.getElementsByClassName('wptb-input-number-increment')[0],\n rowsDecrementButton = tableGenerator.getElementsByClassName('wptb-input-number-decrement')[1],\n rowsIncrementButton = tableGenerator.getElementsByClassName('wptb-input-number-increment')[1],\n columnsInput = document.getElementById('wptb-columns-number'),\n rowsInput = document.getElementById('wptb-rows-number');\n \n // columnsDecrementButton.onclick = function () {\n // if (columnsInput.value > MIN_COLUMNS) {\n // columnsInput.value--;\n // }\n // };\n //\n // columnsIncrementButton.onclick = function () {\n // if (columnsInput.value < MAX_COLUMNS) {\n // columnsInput.value++;\n // }\n // };\n //\n // rowsDecrementButton.onclick = function () {\n // if (rowsInput.value > MIN_ROWS) {\n // rowsInput.value--;\n // }\n // };\n //\n // rowsIncrementButton.onclick = function () {\n // if (rowsInput.value < MAX_ROWS) {\n // rowsInput.value++;\n // }\n // };\n\n // document.getElementById( 'wptb-generate-table' ).onclick = function ( ) {\n // var columns = document.getElementById('wptb-columns-number').value,\n // rows = document.getElementById('wptb-rows-number').value;\n //\n // //wptbTableStateSaveManager.tableStateClear();\n //\n // WPTB_Table(columns, rows);\n //\n // let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n // wptbTableStateSaveManager.tableStateSet();\n // }\n\n // register and setup section buttons\n WPTB_Helper.registerSections(['elements', 'table_settings', 'cell_settings', 'options_group' , 'table_responsive_menu', 'manage_cells']);\n WPTB_Helper.setupSectionButtons();\n\n // activate elements section for startup\n WPTB_Helper.activateSection('elements');\n\n // side bar toggle setup\n WPTB_Helper.setupSidebarToggle('.wptb-panel-toggle-section .wptb-panel-drawer-icon');\n\n // setup panel sections that have the ability to be toggled on/off\n WPTB_Helper.setupPanelToggleButtons();\n\n // setup responsive menu both at left and builder panel\n new WptbResponsive('table_responsive_menu', 'wptbResponsiveApp', '.wptb-builder-content');\n\n // get builder section from url parameter for easy switch at page load\n WPTB_Helper.getSectionFromUrl();\n\n // automatically show element controls when dropped to table\n WPTB_Helper.showControlsOnElementMount();\n\n // show elements list menu on left panel on removing elements from table\n WPTB_Helper.showElementsListOnRemove();\n\n // block tinyMCE from activation at manage cells menu\n WPTB_Helper.blockTinyMCEManageCells();\n // initialize header toolbox\n new WPTB_HeaderToolbox('.wptb-plugin-header-toolbar').init();\n\n // redirect active menu to elements after closing manage cells menu\n document.addEventListener('wp-table-builder/table-edit-mode/closed', () => {\n WPTB_Helper.activateSection('elements');\n })\n};\n","var WPTB_LeftPanel = function () {\r\n\r\n let table = document.getElementsByClassName('wptb-preview-table')[0],\r\n wptbElementButtons = document.getElementsByClassName('wptb-element');\r\n\r\n for (var i = 0; i < wptbElementButtons.length; i++) {\r\n wptbElementButtons[i].ondragstart = function (e) {\r\n e.dataTransfer.setData('wptbElement', this.dataset.wptbElement);\r\n e.dataTransfer.setData( 'wptbElIndic-' + this.dataset.wptbElement, 'wptbElIndic-' + this.dataset.wptbElement );\r\n }\r\n };\r\n \r\n if( table ) {\r\n let wptbTablesEditModeCloseButton = document.getElementsByClassName( 'wptb-table-edit-mode-close' );\r\n for ( let i = 0; i < wptbTablesEditModeCloseButton.length; i++ ) {\r\n wptbTablesEditModeCloseButton[i].onclick = WPTB_Helper.toggleTableEditMode;\r\n }\r\n };\r\n\r\n // this code hides the \"element parameters\" area\r\n // when clicked outside this element and its \"tinymce\" toolbar \r\n let wptbBuilderPanel = document.getElementsByClassName( 'wptb-builder-panel' )[0];\r\n wptbBuilderPanel.onclick = function( e ) {\r\n if( ! e.target.classList.contains( 'wptb-ph-element' ) && ! WPTB_Helper.findAncestor( e.target, 'wptb-ph-element' ) && \r\n ! e.target.classList.contains( 'wptb-fixed-toolbar' ) && ! WPTB_Helper.findAncestor( e.target, 'wptb-fixed-toolbar' ) ) {\r\n WPTB_Helper.clickOnFreeSpace();\r\n } \r\n };\r\n \r\n let wptbHeader = document.getElementsByClassName( 'wptb-header' );\r\n if( wptbHeader.length > 0 ) wptbHeader = wptbHeader[0];\r\n wptbHeader.onclick = function() {\r\n WPTB_Helper.clickOnFreeSpace();\r\n };\r\n};","var MultipleSelect = function () {\n\n\tvar selectedCells = [],\n\t\tmultipleCellMode = false;\n\n\tthis.activateMultipleSelectMode = function () {\n\t\tselectedCells = [];\n\t\tvar tds = document.getElementsByClassName('wptb-preview-table')[0].getElementsByTagName('td');\n\t\tfor (var i = 0; i < tds.length; i++) {\n\t\t\ttds[i].classList.remove('wptb-highlighted');\n\t\t}\n\t\tmultipleCellMode = true;\n\t}\n\n\tthis.deactivateMultipleSelectMode = function () {\n\t\tmultipleCellMode = false;\n\t}\n\n\tthis.isActivated = function () {\n\t\treturn multipleCellMode;\n\t}\n\n\tthis.pushSelectedCell = function (cell) {\n\t\tif (!multipleCellMode) {\n\t\t\treturn;\n\t\t}\n\t\tselectedCells.push(cell);\n\t\tcell.classList.add('wptb-highlighted');\n\t};\n\n\tthis.selectedCells = function () {\n\t\treturn selectedCells;\n\t}\n\n\tthis.flushSelectedCells = function () {\n\t\tselectedCells = [];\n\t}\n\n\tthis.getFirst = function () {\n\t\tvar minXIndex = 1000, minYIndex = 1000, first;\n\t\tfor (var i = selectedCells.length - 1; i >= 0; i--) {\n\t\t\tif (minXIndex >= selectedCells[i].dataset.xIndex\n\t\t\t\t&& minYIndex >= selectedCells[i].dataset.yIndex) {\n\t\t\t\tfirst = selectedCells[i];\n\t\t\t\tminXIndex = selectedCells[i].dataset.xIndex;\n\t\t\t\tminYIndex = selectedCells[i].dataset.yIndex;\n\t\t\t}\n\t\t}\n\t\treturn first;\n\t}\n\n\tthis.getLast = function () {\n\t\tvar maxXIndex = -1, maxYIndex = -1, last;\n\t\tfor (var i = selectedCells.length - 1; i >= 0; i--) {\n\t\t\tif (maxXIndex <= selectedCells[i].dataset.xIndex\n\t\t\t\t&& maxYIndex <= selectedCells[i].dataset.yIndex) {\n\t\t\t\tlast = selectedCells[i];\n\t\t\t\tmaxXIndex = selectedCells[i].dataset.xIndex;\n\t\t\t\tmaxYIndex = selectedCells[i].dataset.yIndex;\n\t\t\t}\n\t\t}\n\t\treturn last;\n\t}\n\n\tthis.removeAllButFirst = function () {\n\t\tvar td = this.getFirst();\n\t\tfor (var i = 1; i < selectedCells.length; i++) {\n\t\t\tselectedCells[i].classList.add('wptb-fused-cell-' + td.dataset.xIndex + '-' + td.dataset.yIndex);\n\t\t}\n\t}\n\n\treturn this;\n\n};","var WPTB_Parser = function ( code ) {\n let div = document.createElement( 'div' );\n div.innerHTML = code;\n \n let table = div.children[0];\n let columnTitleMobile = [...table.querySelectorAll( '.wptb-column-title-mobile-container' )];\n \n for( let i = 0; i < columnTitleMobile.length; i++ ) {\n let parent = columnTitleMobile[i].parentNode;\n parent.removeChild( columnTitleMobile[i] );\n }\n \n let tds = table.querySelectorAll( 'td' );\n for ( let i = 0; i < tds.length; i++ ) {\n tds[i].classList.add( 'wptb-droppable' );\n tds[i].classList.remove( 'wptb-column-title-mobile-not-elements' );\n }\n \n return table;\n}","// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys\nif (!Object.keys) {\n Object.keys = (function () {\n 'use strict';\n var hasOwnProperty = Object.prototype.hasOwnProperty,\n hasDontEnumBug = !({toString: null}).propertyIsEnumerable('toString'),\n dontEnums = [\n 'toString',\n 'toLocaleString',\n 'valueOf',\n 'hasOwnProperty',\n 'isPrototypeOf',\n 'propertyIsEnumerable',\n 'constructor'\n ],\n dontEnumsLength = dontEnums.length;\n\n return function (obj) {\n if (typeof obj !== 'object' && (typeof obj !== 'function' || obj === null)) {\n throw new TypeError('Object.keys called on non-object');\n }\n\n var result = [], prop, i;\n\n for (prop in obj) {\n if (hasOwnProperty.call(obj, prop)) {\n result.push(prop);\n }\n }\n\n if (hasDontEnumBug) {\n for (i = 0; i < dontEnumsLength; i++) {\n if (hasOwnProperty.call(obj, dontEnums[i])) {\n result.push(dontEnums[i]);\n }\n }\n }\n return result;\n };\n }());\n}","const WPTB_RecalculateIndexes = function (table) {\n let trs = table.getElementsByTagName( 'tr' ),\n tds, maxCols = 0, maxColsFull = 0, tdsArr = [];\n\n for ( let i = 0; i < trs.length; i++ ) {\n tds = trs[i].getElementsByTagName( 'td' );\n\n if ( tdsArr[i] == undefined ) {\n tdsArr[i] = [];\n }\n\n let jMainIter = 0;\n for ( let j = 0; j < tds.length; j++ ) {\n if ( tdsArr[i][j] != undefined ) {\n for ( let y = 0; y < 100; y++ ) {\n if ( tdsArr[i][jMainIter] != undefined ) {\n jMainIter++;\n continue;\n }\n tdsArr[i][jMainIter] = tds[j];\n tds[j].dataset.xIndex = jMainIter;\n break;\n }\n } else {\n tdsArr[i][j] = tds[j];\n tds[j].dataset.xIndex = jMainIter;\n }\n tds[j].dataset.yIndex = i;\n\n if ( tds[j].colSpan > 1 ) {\n for ( let k = 1; k < tds[j].colSpan; k++ ) {\n jMainIter++;\n tdsArr[i][jMainIter] = 'tdDummy';\n }\n }\n\n if ( tds[j].rowSpan > 1 ) {\n for ( let x = 1; x < tds[j].rowSpan; x++ ) {\n if ( tdsArr[i + x] == undefined ) {\n tdsArr[i + x] = [];\n }\n for ( let z = 0; z < tds[j].colSpan; z++ ) {\n tdsArr[i + x][jMainIter - tds[j].colSpan + 1 + z ] = 'tdDummy';\n }\n }\n }\n jMainIter++;\n }\n\n if ( tds.length > maxCols ) {\n maxCols = tds.length;\n }\n\n if( i == 0 ) {\n maxColsFull = jMainIter;\n }\n }\n table.columns = maxCols;\n table.maxCols = maxColsFull;\n}\n","/**\n * Responsive menu and options class.\n *\n * This class will be called and instanced at table builder menu to add it the responsive menu and its controls.\n *\n * @param {string} sectionName section name\n * @param {string} responsiveWrapperId id for mount point\n * @param {string} mainContainerQuery query to find parent container for responsive menu\n * @throws {Error} will throw an error if mainContainerQuery failed to find any element\n * @constructor\n */\n// eslint-disable-next-line no-unused-vars\nfunction WptbResponsive(sectionName, responsiveWrapperId, mainContainerQuery) {\n\tthis.sectionName = sectionName;\n\tthis.responsiveWrapperId = responsiveWrapperId;\n\tthis.responsiveTable = null;\n\tthis.loaded = false;\n\n\t/**\n\t * Add responsive container to dom.\n\t */\n\tthis.addContainerToDom = () => {\n\t\tconst responsiveContainer = document.querySelector(`#${this.responsiveWrapperId}`);\n\t\tif (!responsiveContainer) {\n\t\t\tconst mainContainer = document.querySelector(mainContainerQuery);\n\n\t\t\t// parent container not found, throw error\n\t\t\tif (!mainContainer) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`[WPTB_Responsive]: no parent container is found with the given query of [${mainContainerQuery}]`\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst range = document.createRange();\n\t\t\trange.setStart(mainContainer, 0);\n\n\t\t\tconst responsiveElement = range.createContextualFragment(\n\t\t\t\t`<div class=\"wptb-responsive\" id=\"${this.responsiveWrapperId}\">responsive element</div>`\n\t\t\t);\n\t\t\tmainContainer.appendChild(responsiveElement);\n\t\t\tthis.loaded = true;\n\t\t}\n\n\t\tthis.responsiveTable = document.querySelector(`#${this.responsiveWrapperId}`);\n\t};\n\n\t/**\n\t * Load and make necessary mount preparations for component.\n\t */\n\tthis.load = () => {\n\t\tif (!this.loaded) {\n\t\t\tthis.addContainerToDom();\n\n\t\t\tWPTB_Helper.elementStartScript(this.responsiveTable, 'table_responsive_menu');\n\t\t\tWPTB_Helper.elementOptionsSet('table_responsive_menu', this.responsiveTable);\n\t\t\tWPTB_ControlsManager.callControlScript('ResponsiveTable', this.responsiveWrapperId);\n\t\t}\n\t};\n\n\t/**\n\t * Startup hook for the component.\n\t */\n\tthis.startUp = () => {\n\t\t// event listener for section change events\n\t\tdocument.addEventListener('wptbSectionChanged', (e) => {\n\t\t\tconst tablePreview = document.querySelector('.wptb-preview-table');\n\n\t\t\t// check if activated section is related to responsive and there is a main table already in the view\n\t\t\tif (e.detail === this.sectionName && tablePreview) {\n\t\t\t\tthis.load();\n\t\t\t}\n\t\t});\n\n\t\t// event listener for table ready signal\n\t\tdocument.addEventListener('wptb:table:generated', () => {\n\t\t\t// check current section to be sure that responsive menu is the active one before calling load related scripts\n\t\t\tif (WPTB_Helper.getCurrentSection() === 'table_responsive_menu') {\n\t\t\t\tthis.load();\n\t\t\t}\n\t\t});\n\t};\n\n\tthis.startUp();\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 // set drag relative helper field for future use\n WPTB_Helper.setDragRelativeType(this.dataset.wptbRelativeElements || '');\n }\n elems[i].ondragend = function () {\n WPTB_Helper.elementDragEndClear();\n }\n };\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n let wptbUndo = document.getElementsByClassName( 'wptb-undo' );\n if( wptbUndo.length > 0 ) {\n wptbUndo = wptbUndo[0];\n \n wptbUndo.onclick = function( event ) {\n if( ! this.classList.contains( 'wptb-undoredo-disabled' ) ) {\n wptbTableStateSaveManager.tableStateGet( this.dataset.wptbUndoredo );\n let wptbUndoRedoContainer = document.getElementsByClassName( 'wptb-undo-redo-container' );\n if(wptbUndoRedoContainer.length > 0) {\n wptbUndoRedoContainer = wptbUndoRedoContainer[0];\n wptbUndoRedoContainer.onmouseleave = function( event ) {\n event.target.onmouseleave = '';\n let table = document.querySelector( '.wptb-preview-table' );\n WPTB_Table();\n }\n }\n }\n }\n }\n \n let wptbRedo = document.getElementsByClassName( 'wptb-redo' );\n if( wptbRedo.length > 0 ) {\n wptbRedo = wptbRedo[0];\n \n wptbRedo.onclick = function( event ) {\n if( ! this.classList.contains( 'wptb-undoredo-disabled' ) ) {\n wptbTableStateSaveManager.tableStateGet( this.dataset.wptbUndoredo );\n let wptbUndoRedoContainer = document.getElementsByClassName( 'wptb-undo-redo-container' );\n if(wptbUndoRedoContainer.length > 0) {\n wptbUndoRedoContainer = wptbUndoRedoContainer[0];\n wptbUndoRedoContainer.onmouseleave = function( event ) {\n event.target.onmouseleave = '';\n let table = document.querySelector( '.wptb-preview-table' );\n WPTB_Table();\n }\n }\n }\n \n }\n }\n \n let shortcodePopupWindow = document.getElementsByClassName( 'wptb-popup-window-modal' )[0];\n document.getElementsByClassName( 'wptb-embed-btn' )[0].onclick = function () {\n if( ! this.classList.contains( 'wptb-button-disable' ) ) {\n shortcodePopupWindow.classList.add( 'wptb-popup-show' );\n }\n }\n \n window.onbeforeunload = function(e) {\n let wptbSaveDisabled = document.getElementsByClassName( 'wptb-save-disabled' );\n if( wptbSaveDisabled.length == 0 ) {\n return true;\n } else {\n return null;\n }\n };\n \n \n document.getElementsByClassName( 'wptb-popup-dark-area' )[0].onclick = function () {\n shortcodePopupWindow.classList.remove( 'wptb-popup-show' );\n }\n \n document.getElementsByClassName( 'wptb-popup-window-close-icon' )[0].onclick = function () {\n shortcodePopupWindow.classList.remove( 'wptb-popup-show' );\n }\n \n document.getElementsByClassName( 'wptb-preview-btn' )[0].onclick = function ( event ) {\n if( this.classList.contains( 'wptb-button-disable' ) ) {\n return;\n } \n \n let previewId = Math.floor( Math.random() * 10000 );\n \n var newHref = new URL( event.target.href );\n newHref.searchParams.set( 'preview_id', previewId );\n event.target.href = newHref.toString();\n WPTB_Helper.saveTable( event, false, previewId );\n }\n\n document.getElementsByClassName( 'wptb-save-btn' )[0].onclick = function ( event ) {\n if( ! this.classList.contains( 'wptb-save-disabled' ) ) {\n WPTB_Helper.saveTable( event );\n }\n }\n\n let tableTitleField = document.querySelector( '#wptb-setup-name' );\n if( tableTitleField ) {\n tableTitleField.onchange = function () {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n }\n};\n","const WPTB_SortableTable = function (table) {\n\tthis.table = table;\n\tthis.topRow = table.rows.length ? table.rows[0] : null;\n\n\t/**\n\t * sets the table to sort mode\n\t * @param type\n\t * @param active\n\t */\n\tthis.sortModeSwitcher = function (type, active) {\n\t\tif (type === 'vertical') {\n\t\t\tthis.table.removeEventListener('click', this.sortableTableVerticalStart, false);\n\n\t\t\tif (active) {\n\t\t\t\tthis.sortModeSwitcher('horizontal', false);\n\t\t\t\tthis.sortingCellMouseMoveSwitcher('vertical', true);\n\t\t\t\tthis.table.addEventListener('click', this.sortableTableVerticalStart, false);\n\t\t\t\tthis.table.dataset.wptbSortableTableVertical = '1';\n\t\t\t} else {\n\t\t\t\tthis.sortingCellMouseMoveSwitcher('vertical', false);\n\t\t\t\tdelete this.table.dataset.wptbSortableTableVertical;\n\t\t\t}\n\t\t} else if (type === 'horizontal') {\n\t\t\tthis.table.removeEventListener('click', this.sortableTableHorizontalStart, false);\n\n\t\t\tif (active) {\n\t\t\t\tthis.sortModeSwitcher('vertical', false);\n\t\t\t\tthis.sortingCellMouseMoveSwitcher('horizontal', true);\n\t\t\t\tthis.table.addEventListener('click', this.sortableTableHorizontalStart, false);\n\t\t\t\tthis.table.dataset.wptbSortableTableHorizontal = '1';\n\t\t\t} else {\n\t\t\t\tthis.sortingCellMouseMoveSwitcher('horizontal', false);\n\t\t\t\tdelete this.table.dataset.wptbSortableTableHorizontal;\n\t\t\t}\n\t\t}\n\t};\n\n\t/**\n\t * checks whether the table should be in the sort state\n\t * and connects the necessary handlers\n\t */\n\tthis.sortableTableInitialization = function () {\n\t\tif (this.table.dataset.wptbSortableTableVertical && this.table.dataset.wptbSortableTableVertical === '1') {\n\t\t\tthis.sortModeSwitcher('vertical', true);\n\t\t} else if (\n\t\t\tthis.table.dataset.wptbSortableTableHorizontal &&\n\t\t\tthis.table.dataset.wptbSortableTableHorizontal === '1'\n\t\t) {\n\t\t\tthis.sortModeSwitcher('horizontal', true);\n\t\t}\n\t};\n\n\tthis.sortingCellMouseMoveSwitcher = function (type, active) {\n\t\tif (type === 'vertical') {\n\t\t\tlet tds = this.topRow ? this.topRow.querySelectorAll('td') : null;\n\t\t\ttds = [...tds];\n\t\t\ttds.map((td) => {\n\t\t\t\ttd.removeEventListener('mousemove', sortingCellMouseMoveVertical, false);\n\t\t\t\ttd.removeEventListener('mouseleave', tdMouseLeave, false);\n\t\t\t\tif (active) {\n\t\t\t\t\ttd.addEventListener('mousemove', sortingCellMouseMoveVertical, false);\n\t\t\t\t\ttd.addEventListener('mouseleave', tdMouseLeave, false);\n\t\t\t\t}\n\t\t\t});\n\t\t} else if (type === 'horizontal') {\n\t\t\tlet tds = this.table.querySelectorAll('[data-x-index=\"0\"]');\n\t\t\ttds = [...tds];\n\t\t\ttds.map((td) => {\n\t\t\t\ttd.removeEventListener('mousemove', sortingCellMouseMoveHorizontal, false);\n\t\t\t\ttd.removeEventListener('mouseleave', tdMouseLeave, false);\n\t\t\t\tif (active) {\n\t\t\t\t\ttd.addEventListener('mousemove', sortingCellMouseMoveHorizontal, false);\n\t\t\t\t\ttd.addEventListener('mouseleave', tdMouseLeave, false);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t};\n\n\tfunction sortingCellMouseMov(e, type, element) {\n\t\tif (e.target.tagName === 'TD') {\n\t\t\tconst x = e.offsetX == undefined ? e.layerX : e.offsetX;\n\t\t\tconst y = e.offsetY == undefined ? e.layerY : e.offsetY;\n\t\t\tlet xMatch = false;\n\t\t\tif ((type === 'vertical' && e.target.clientWidth - x <= 35) || (type === 'horizontal' && x <= 35)) {\n\t\t\t\txMatch = true;\n\t\t\t}\n\t\t\tif (xMatch && (e.target.clientHeight - 35) / 2 < y && (e.target.clientHeight + 35) / 2 > y) {\n\t\t\t\telement.classList.add('sortable-hover');\n\t\t\t} else {\n\t\t\t\telement.classList.remove('sortable-hover');\n\t\t\t}\n\t\t} else {\n\t\t\telement.classList.remove('sortable-hover');\n\t\t}\n\t}\n\n\tfunction sortingCellMouseMoveVertical(e) {\n\t\tsortingCellMouseMov(e, 'vertical', this);\n\t}\n\n\tfunction sortingCellMouseMoveHorizontal(e) {\n\t\tsortingCellMouseMov(e, 'horizontal', this);\n\t}\n\n\tfunction tdMouseLeave() {\n\t\tthis.classList.remove('sortable-hover');\n\t}\n\n\t/**\n\t * function for sorting the table vertically by the numeric content of cells\n\t *\n\t * @param e\n\t * @param table\n\t */\n\tfunction sortableTable(e, table, type) {\n\t\tif (\n\t\t\te.target &&\n\t\t\te.target.tagName === 'TD' &&\n\t\t\t!table.classList.contains('wptb-plugin-responsive-base') &&\n\t\t\t!table.parentNode.classList.contains('wptb-preview-table-manage-cells')\n\t\t) {\n\t\t\tlet tableWasSorted = false;\n\t\t\tif (type === 'vertical' && e.target.dataset.yIndex === '0') {\n\t\t\t\tlet tds = table.querySelectorAll(`[data-x-index=\"${e.target.dataset.xIndex}\"]`);\n\t\t\t\ttds = [...tds];\n\n\t\t\t\t// preparing table for sorting\n\t\t\t\tlet rowspan;\n\t\t\t\tlet rowNum;\n\t\t\t\ttds.map((td) => {\n\t\t\t\t\tif (!(rowspan = parseInt(td.rowSpan, 10))) {\n\t\t\t\t\t\trowspan = 1;\n\t\t\t\t\t}\n\t\t\t\t\trowNum = td.dataset.yIndex;\n\t\t\t\t\tWPTB_CutGlueTable.cutTableHorizontally(rowNum, table);\n\t\t\t\t\trowNum += rowspan;\n\t\t\t\t\tWPTB_CutGlueTable.cutTableHorizontally(rowNum, table);\n\t\t\t\t});\n\n\t\t\t\tconst rowsValuesArr = [];\n\t\t\t\tlet rowsTdFirst;\n\t\t\t\tlet tdYCoordsRowSpanPrevious = 0;\n\t\t\t\tfor (let i = 0; i < tds.length; i++) {\n\t\t\t\t\tconst tdsChanged = changeSortingTdsCollection(\n\t\t\t\t\t\te,\n\t\t\t\t\t\ttable,\n\t\t\t\t\t\ttds,\n\t\t\t\t\t\ti,\n\t\t\t\t\t\ttdYCoordsRowSpanPrevious,\n\t\t\t\t\t\t'vertical'\n\t\t\t\t\t);\n\t\t\t\t\tif (tdsChanged && tdsChanged.hasOwnProperty('i')) {\n\t\t\t\t\t\ttds = tdsChanged.tds;\n\t\t\t\t\t\ti = tdsChanged.i;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t} else if (tdsChanged) {\n\t\t\t\t\t\ttds = tdsChanged.tds;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst td = tds[i];\n\n\t\t\t\t\tlet tdRowspan = parseInt(td.rowSpan, 10);\n\t\t\t\t\tif (!tdRowspan) tdRowspan = 1;\n\n\t\t\t\t\ttdYCoordsRowSpanPrevious = parseInt(td.dataset.yIndex, 10) + tdRowspan;\n\n\t\t\t\t\tconst textElementsValues = textElementsValuesGet(td);\n\n\t\t\t\t\tconst rowsTd = [];\n\t\t\t\t\tfor (let j = 0; j < tdRowspan; j++) {\n\t\t\t\t\t\trowsTd.push(table.rows[parseInt(td.dataset.yIndex, 10) + j]);\n\t\t\t\t\t}\n\t\t\t\t\tif (td.dataset.yIndex > 0) {\n\t\t\t\t\t\trowsValuesArr.push({\n\t\t\t\t\t\t\trowsTd,\n\t\t\t\t\t\t\tvalue: textElementsValues,\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\trowsTdFirst = rowsTd;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst orderBy = setSortedAscDataAttr(e, 'sortedVertical');\n\t\t\t\tif (!orderBy) return;\n\n\t\t\t\tif (rowsValuesArr.length) rowsValuesArr.sort((prev, next) => sortOrder(orderBy, prev, next));\n\n\t\t\t\trowsValuesArr.unshift({ rowsTd: rowsTdFirst });\n\n\t\t\t\tconst tBody = table.querySelector('tbody');\n\t\t\t\ttBody.innerHTML = '';\n\n\t\t\t\trowsValuesArr.map((rowsValObj) => {\n\t\t\t\t\trowsValObj.rowsTd.map((row) => {\n\t\t\t\t\t\ttBody.appendChild(row);\n\t\t\t\t\t});\n\t\t\t\t});\n\n\t\t\t\tWPTB_RecalculateIndexes(table);\n\n\t\t\t\tWPTB_CutGlueTable.glueTableHorizontally(table);\n\n\t\t\t\ttableWasSorted = true;\n\t\t\t} else if (type === 'horizontal' && e.target.dataset.xIndex === '0') {\n\t\t\t\tlet tds = table.querySelectorAll(`[data-y-index=\"${e.target.dataset.yIndex}\"]`);\n\t\t\t\ttds = [...tds];\n\n\t\t\t\t// preparing table for sorting\n\t\t\t\tlet colspan;\n\t\t\t\tlet colNum;\n\t\t\t\ttds.map((td) => {\n\t\t\t\t\tif (!(colspan = parseInt(td.colSpan, 10))) {\n\t\t\t\t\t\tcolspan = 1;\n\t\t\t\t\t}\n\t\t\t\t\tcolNum = td.dataset.xIndex;\n\t\t\t\t\tWPTB_CutGlueTable.cutTableVertically(colNum, table);\n\t\t\t\t\tcolNum += colspan;\n\t\t\t\t\tWPTB_CutGlueTable.cutTableVertically(colNum, table);\n\t\t\t\t});\n\n\t\t\t\tconst columnsValuesArr = [];\n\t\t\t\tlet columnsTdFirst;\n\n\t\t\t\tlet tdXCoordsColSpanPrevious = 0;\n\t\t\t\tfor (let i = 0; i < tds.length; i++) {\n\t\t\t\t\tconst tdsChanged = changeSortingTdsCollection(\n\t\t\t\t\t\te,\n\t\t\t\t\t\ttable,\n\t\t\t\t\t\ttds,\n\t\t\t\t\t\ti,\n\t\t\t\t\t\ttdXCoordsColSpanPrevious,\n\t\t\t\t\t\t'horizontal'\n\t\t\t\t\t);\n\t\t\t\t\tif (tdsChanged && tdsChanged.hasOwnProperty('i')) {\n\t\t\t\t\t\ttds = tdsChanged.tds;\n\t\t\t\t\t\ti = tdsChanged.i;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t} else if (tdsChanged) {\n\t\t\t\t\t\ttds = tdsChanged.tds;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst td = tds[i];\n\t\t\t\t\tlet tdColspan = parseInt(td.colSpan, 10);\n\t\t\t\t\tif (!tdColspan) tdColspan = 1;\n\n\t\t\t\t\ttdXCoordsColSpanPrevious = parseInt(td.dataset.xIndex, 10) + tdColspan;\n\n\t\t\t\t\tconst textElementsValues = textElementsValuesGet(td);\n\t\t\t\t\tconst columnsTd = [];\n\t\t\t\t\tfor (let j = 0; j < tdColspan; j++) {\n\t\t\t\t\t\tconst tdsColumn = [\n\t\t\t\t\t\t\t...table.querySelectorAll(`[data-x-index=\"${parseInt(td.dataset.xIndex, 10) + j}\"]`),\n\t\t\t\t\t\t];\n\t\t\t\t\t\tcolumnsTd.push(tdsColumn);\n\t\t\t\t\t}\n\t\t\t\t\tif (td.dataset.xIndex > 0) {\n\t\t\t\t\t\tcolumnsValuesArr.push({\n\t\t\t\t\t\t\tcolumnsTd,\n\t\t\t\t\t\t\tvalue: textElementsValues,\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcolumnsTdFirst = columnsTd;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst orderBy = setSortedAscDataAttr(e, 'sortedHorizontal');\n\t\t\t\tif (!orderBy) return;\n\n\t\t\t\tif (columnsValuesArr.length) columnsValuesArr.sort((prev, next) => sortOrder(orderBy, prev, next));\n\n\t\t\t\tcolumnsValuesArr.unshift({ columnsTd: columnsTdFirst });\n\n\t\t\t\tfor (let i = 0; i < table.rows.length; i++) {\n\t\t\t\t\ttable.rows[i].innerHTML = '';\n\t\t\t\t}\n\n\t\t\t\tcolumnsValuesArr.map((columnsValObj) => {\n\t\t\t\t\tcolumnsValObj.columnsTd.map((tdsColumn) => {\n\t\t\t\t\t\ttdsColumn.map((td) => {\n\t\t\t\t\t\t\ttable.rows[td.dataset.yIndex].appendChild(td);\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t});\n\n\t\t\t\tWPTB_RecalculateIndexes(table);\n\n\t\t\t\tWPTB_CutGlueTable.glueTableVertically(table);\n\n\t\t\t\ttableWasSorted = true;\n\t\t\t}\n\n\t\t\tif (tableWasSorted) {\n\t\t\t\tremoveCellsAttrAfterDivision(table);\n\n\t\t\t\tif (table.hasOwnProperty('tableSM')) {\n\t\t\t\t\tconst tableSM = table.tableSM();\n\t\t\t\t\tnew tableSM().tableStateSet();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Function that sets the data-attribute with the number of the row or column\n\t * that the table was sorted by. Returns the number of a row or column\n\t *\n\t * @param e\n\t * @param dataAttr\n\t * @returns {null|boolean}\n\t */\n\tfunction setSortedAscDataAttr(e, dataAttr) {\n\t\tif (e.currentTarget && e.currentTarget.classList.contains('wptb-preview-table')) {\n\t\t\tif (!e.target.dataset[dataAttr] || e.target.dataset[dataAttr] === 'ask') {\n\t\t\t\te.target.dataset[dataAttr] = 'desk';\n\t\t\t} else {\n\t\t\t\te.target.dataset[dataAttr] = 'ask';\n\t\t\t}\n\n\t\t\treturn e.target.dataset[dataAttr];\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * defines the sorting order\n\t *\n\t * @param orderBy\n\t * @param prev\n\t * @param next\n\t * @returns {number}\n\t */\n\tfunction sortOrder(orderBy = 'ask', prev, next) {\n\t\tlet prevValue = prev.value;\n\t\tlet nextValue = next.value;\n\t\tif (parseInt(prevValue) && parseInt(nextValue)) {\n\t\t\tprevValue = parseInt(prevValue);\n\t\t\tnextValue = parseInt(nextValue);\n\t\t}\n\n\t\tif (orderBy === 'ask') {\n\t\t\tif (prevValue < nextValue) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\tif (prevValue === nextValue) {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\treturn 1;\n\t\t}\n\t\tif (prevValue < nextValue) {\n\t\t\treturn 1;\n\t\t}\n\t\tif (prevValue === nextValue) {\n\t\t\treturn 0;\n\t\t}\n\t\treturn -1;\n\t}\n\n\t/**\n\t * return cell text elements values\n\t *\n\t * @param cell {HTMLElement}\n\t * @returns {string}\n\t */\n\tfunction textElementsValuesGet(cell) {\n\t\tlet textElements = cell.querySelectorAll('.wptb-text-container');\n\t\ttextElements = [...textElements];\n\t\tlet value = '';\n\t\tfor (let j = 0; j < textElements.length; j++) {\n\t\t\tconst p = textElements[j].querySelector('p');\n\t\t\tvalue += p.innerText;\n\t\t\tif (j !== textElements.length - 1) value += ' ';\n\t\t}\n\n\t\treturn value;\n\t}\n\n\t/**\n\t * adds cells to the collection of cells in the row or column that the table is sorted by.\n\t * These added cells are not originally were added in the collection,\n\t * because they are combined with cells from higher rows or left-side columns\n\t *\n\t * @param table\n\t * @param tds\n\t * @param i\n\t * @param tdIndexSpanPrev\n\t * @returns {{tds: *}|boolean|{tds: *, i: *}}\n\t */\n\tfunction changeSortingTdsCollection(e, table, tds, i, tdIndexSpanPrev, type) {\n\t\tconst td = tds[i];\n\t\tlet tdsCollectionChanged = false;\n\t\tlet collectionTds;\n\t\tlet collectionTdsJSpan;\n\t\tlet collectionTdsJSpanProperty;\n\t\tlet indexName;\n\t\tlet indexNameCamelCase;\n\t\tlet indexNamePerpendicularCamelCase;\n\t\tlet tdSpanProperty;\n\t\t// max rows or columns column\n\t\tlet tableGroupCount;\n\n\t\tif (type === 'vertical') {\n\t\t\tcollectionTdsJSpanProperty = 'colSpan';\n\t\t\tindexName = 'data-y-index';\n\t\t\tindexNameCamelCase = 'yIndex';\n\t\t\tindexNamePerpendicularCamelCase = 'xIndex';\n\t\t\ttdSpanProperty = 'rowSpan';\n\t\t\ttableGroupCount = table.rows.length;\n\t\t} else if (type === 'horizontal') {\n\t\t\tcollectionTdsJSpanProperty = 'rowSpan';\n\t\t\tindexName = 'data-x-index';\n\t\t\tindexNameCamelCase = 'xIndex';\n\t\t\tindexNamePerpendicularCamelCase = 'yIndex';\n\t\t\ttdSpanProperty = 'colSpan';\n\t\t\ttableGroupCount = table.maxCols;\n\t\t}\n\n\t\tif (td.dataset[indexNameCamelCase] - tdIndexSpanPrev > 0) {\n\t\t\tcollectionTds = table.querySelectorAll(`[${indexName}=\"${tdIndexSpanPrev}\"]`);\n\n\t\t\tfor (let j = 0; j < collectionTds.length; j++) {\n\t\t\t\tcollectionTdsJSpan = collectionTds[j][collectionTdsJSpanProperty];\n\t\t\t\tif (!collectionTdsJSpan) collectionTdsJSpan = 1;\n\n\t\t\t\tif (\n\t\t\t\t\tcollectionTds[j].dataset[indexNamePerpendicularCamelCase] <\n\t\t\t\t\t\te.target.dataset[indexNamePerpendicularCamelCase] &&\n\t\t\t\t\tparseInt(collectionTds[j].dataset[indexNamePerpendicularCamelCase], 10) +\n\t\t\t\t\t\tparseInt(collectionTdsJSpan, 10) >=\n\t\t\t\t\t\te.target.dataset[indexNamePerpendicularCamelCase]\n\t\t\t\t) {\n\t\t\t\t\ttds.splice(i, 0, collectionTds[j]);\n\t\t\t\t\ttdsCollectionChanged = true;\n\t\t\t\t\ti--;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (tdsCollectionChanged) return { tds, i };\n\n\t\tlet tdSpan = parseInt(td[tdSpanProperty], 10);\n\t\tif (!tdSpan) tdSpan = 1;\n\t\tif (i == tds.length - 1 && parseInt(td.dataset[indexNameCamelCase], 10) + tdSpan < tableGroupCount) {\n\t\t\tcollectionTds = table.querySelectorAll(\n\t\t\t\t`[${indexName}=\"${parseInt(td.dataset[indexNameCamelCase], 10) + tdSpan}\"]`\n\t\t\t);\n\t\t\tfor (let j = 0; j < collectionTds.length; j++) {\n\t\t\t\tcollectionTdsJSpan = collectionTds[j][collectionTdsJSpanProperty];\n\t\t\t\tif (!collectionTdsJSpan) collectionTdsJSpan = 1;\n\n\t\t\t\tif (\n\t\t\t\t\tcollectionTds[j].dataset[indexNamePerpendicularCamelCase] <\n\t\t\t\t\t\te.target.dataset[indexNamePerpendicularCamelCase] &&\n\t\t\t\t\tparseInt(collectionTds[j].dataset[indexNamePerpendicularCamelCase], 10) +\n\t\t\t\t\t\tparseInt(collectionTdsJSpan, 10) >=\n\t\t\t\t\t\te.target.dataset[indexNamePerpendicularCamelCase]\n\t\t\t\t) {\n\t\t\t\t\ttds.push(collectionTds[j]);\n\t\t\t\t\ttdsCollectionChanged = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (tdsCollectionChanged) return { tds };\n\t\treturn false;\n\t}\n\n\t/**\n\t * remove cells attributes which were used for division table\n\t *\n\t * @param table\n\t */\n\tfunction removeCellsAttrAfterDivision(table) {\n\t\tconst tdsAll = [...table.getElementsByTagName('td')];\n\t\tfor (let i = 0; i < tdsAll.length; i++) {\n\t\t\tif (tdsAll[i].hasAttribute('data-same-cell-before-division')) {\n\t\t\t\ttdsAll[i].removeAttribute('data-same-cell-before-division');\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * function for run sorting table vertically\n\t *\n\t * @param e\n\t */\n\tthis.sortableTableVerticalStart = function (e) {\n\t\tsortableTable(e, table, 'vertical');\n\t};\n\n\t/**\n\t * function for run sorting table horizontally\n\t *\n\t * @param e\n\t */\n\tthis.sortableTableHorizontalStart = function (e) {\n\t\tsortableTable(e, table, 'horizontal');\n\t};\n};\n","var WPTB_Stringifier = function ( codeMain ) {\n if ( codeMain ) {\n let code = codeMain.cloneNode( true );\n code.dataset.tableColumns = codeMain.columns;\n code.style.width = null;\n code.style.minWidth = null;\n code.style.maxWidth = null;\n\n let tds = code.getElementsByTagName( 'td' );\n if ( tds.length > 0 ) {\n for ( let i = 0; i < tds.length; i++ ) {\n\n // tds[i].removeAttribute( 'data-x-index' );\n // tds[i].removeAttribute( 'data-y-index' );\n tds[i].removeAttribute( 'draggable' );\n tds[i].classList.remove( 'wptb-droppable' );\n let infArr = tds[i].className.match( /wptb-element-((.+-)\\d+)/i );\n if(infArr) tds[i].classList.remove(infArr[0]);\n let innerElements = tds[i].getElementsByClassName( 'wptb-ph-element' );\n\n if ( innerElements.length > 0 ) {\n for ( let j = 0; j < innerElements.length; j++ ) {\n\n let mceContentBodys = innerElements[j].querySelectorAll( '.mce-content-body' );\n if( mceContentBodys.length > 0 ) {\n for ( let k = 0; k < mceContentBodys.length; k++ ) {\n mceContentBodys[k].classList.remove( 'mce-content-body' );\n }\n }\n\n let dataMceStyle = innerElements[j].querySelectorAll( '[data-mce-style]' );\n if ( dataMceStyle.length > 0 ) {\n for ( let k = 0; k < dataMceStyle.length; k++ ) {\n dataMceStyle[k].removeAttribute( 'data-mce-style' );\n }\n }\n\n let contentEditable = innerElements[j].querySelectorAll( '[contenteditable]' );\n if ( contentEditable.length > 0 ) {\n for ( let k = 0; k < contentEditable.length; k++ ) {\n contentEditable[k].removeAttribute( 'contenteditable' );\n }\n }\n\n let spellCheck = innerElements[j].querySelectorAll( '[spellcheck]' );\n if ( spellCheck.length > 0 ) {\n for ( let k = 0; k < spellCheck.length; k++ ) {\n spellCheck[k].removeAttribute( 'spellcheck' );\n }\n }\n\n let mceIds = innerElements[j].querySelectorAll( '[id^=mce_]' );\n if ( mceIds.length > 0 ) {\n for ( let k = 0; k < mceIds.length; k++ ) {\n mceIds[k].removeAttribute( 'id' );\n }\n }\n\n let wptbActions = innerElements[j].querySelectorAll( '.wptb-actions' );\n let wptbActionsLength = wptbActions.length;\n while ( wptbActionsLength > 0 ) {\n if( wptbActions[0] && wptbActions[0].parentNode ) {\n wptbActions[0].parentNode.removeChild( wptbActions[0] );\n wptbActionsLength--;\n } else {\n break;\n }\n\n }\n\n let dataMceBogus = innerElements[j].querySelectorAll( '[data-mce-bogus]' );\n if( dataMceBogus.length > 0 ) {\n dataMceBogus = [...dataMceBogus];\n for( let k = 0; k < dataMceBogus.length; k++ ) {\n if( dataMceBogus[k] && dataMceBogus[k].parentNode ) {\n dataMceBogus[k].parentNode.removeChild( dataMceBogus[k] );\n }\n }\n }\n }\n }\n\n // TODO dataTitleColumnSet\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}\n","var array = [], WPTB_Table = function ( columns, rows, wptb_preview_table ) {\n\n /* The members of the class */\n var settings = document.getElementsByClassName('wptb-settings-items'),\n wptbTableSetup = document.getElementsByClassName(\"wptb-table-setup\")[0],\n table, row, cell,\n maxAmountOfCells,\n maxAmountOfRows;\n\n //HERE ARE THE PRIVATE FUNCTIONS\n /*\n * This function toggles buttons visibility in cell edit mode\n * (according to the amount of currently selected cells), and\n * highlights visually the clicked cell if it is not highlighted, or\n * removes highlight if clicked cell is already highlighted.\n * It too toggles the bits of our abstract representation.\n * @param Event this is the event instance of the click performed over a cell.\n */\n var mark = function ( event ) {\n let thisElem = event.currentTarget;\n let rs = thisElem.rowSpan,\n cs = thisElem.colSpan,\n noCells = document.getElementsByClassName('wptb-no-cell-action'),\n singleCells = document.getElementsByClassName('wptb-single-action'),\n multipleCells = document.getElementsByClassName('wptb-multiple-select-action'),\n cellSettings = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ),\n position = getCoords(thisElem),\n row = position[0],\n column = position[1];\n if ( ! document.select.isActivated() ) {\n return;\n }\n if (thisElem.className.match(/wptb-highlighted/)) {\n thisElem.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 thisElem.classList.add('wptb-highlighted');\n for (var i = 0; i < rs; i++) {\n for (var j = 0; j < cs; j++) {\n array[row + i][column + j] = 1;\n }\n }\n }\n\n let cellHighlighted = document.getElementsByClassName('wptb-highlighted'),\n markedCells = cellHighlighted.length;\n if (markedCells === 0) {\n for (var i = 0; i < multipleCells.length; i++) {\n multipleCells[i].classList.remove('visible');\n multipleCells[i].setAttribute('disabled', 'disabled');\n }\n for (var i = 0; i < noCells.length; i++) {\n noCells[i].classList.add('visible');\n noCells[i].removeAttribute('disabled');\n }\n for (var i = 0; i < singleCells.length; i++) {\n singleCells[i].classList.remove('visible');\n singleCells[i].setAttribute('disabled', 'disabled');\n }\n cellSettings.classList.remove( 'visible' );\n } else if (markedCells === 1) {\n for (var i = 0; i < multipleCells.length; i++) {\n multipleCells[i].classList.remove('visible');\n multipleCells[i].setAttribute('disabled', 'disabled');\n }\n for (var i = 0; i < noCells.length; i++) {\n noCells[i].classList.remove('visible');\n noCells[i].setAttribute('disabled', 'disabled');\n }\n for (var i = 0; i < singleCells.length; i++) {\n singleCells[i].classList.add('visible');\n singleCells[i].removeAttribute('disabled');\n }\n\n cellHighlighted = cellHighlighted[0];\n WPTB_Helper.elementOptionsSet( 'table_cell_setting', cellHighlighted );\n\n let infArr = cellHighlighted.className.match( /wptb-element-((.+-)\\d+)/i );\n\n const controlElemIds = ['cellWidth', 'cellHeight'];\n\n controlElemIds.map(s => {\n let elementControlSizeUnicClass = `wptb-el-${infArr[1]}-${s}`,\n elementControlSizeFixedUnicClass = `wptb-el-${infArr[1]}-${s}Fixed`;\n if(s === 'cellWidth' || s === 'cellHeight') {\n let sizeName = '',\n getSizeFunctionName = '';\n if(s === 'cellWidth') {\n sizeName = 'width';\n getSizeFunctionName = 'getColumnWidth';\n } else if(s === 'cellHeight') {\n sizeName = 'height';\n getSizeFunctionName = 'getRowHeight';\n }\n let size = cellHighlighted.style[sizeName],\n cellSizeInputs = document.querySelectorAll( '.' + elementControlSizeUnicClass ),\n cellSizeFixedInput = document.querySelector( '.' + elementControlSizeFixedUnicClass );\n cellSizeInputs = [...cellSizeInputs];\n\n if(!size && !cellHighlighted.dataset[`wptbFixed${sizeName.toUpperCase()}`]) {\n size = WPTB_Helper[getSizeFunctionName](table, cellHighlighted);\n cellSizeInputs.map(s => {\n s.value = size;\n });\n\n cellSizeFixedInput.checked = false;\n } else {\n cellSizeInputs.map(s => {\n if( size ) {\n s.value = parseFloat( size, 10 );\n } else if( cellHighlighted.dataset[`wptbFixed${sizeName.toUpperCase()}`] ) {\n s.value = cellHighlighted.dataset[`wptbFixed${sizeName.toUpperCase()}`];\n }\n });\n\n cellSizeFixedInput.checked = true;\n }\n }\n });\n\n cellSettings.classList.add( 'visible' );\n } else {\n for (var i = 0; i < multipleCells.length; i++) {\n if (table.isSquare(array)) {\n multipleCells[i].classList.add('visible');\n multipleCells[i].removeAttribute('disabled');\n } else {\n multipleCells[i].classList.remove('visible');\n multipleCells[i].setAttribute('disabled', 'disabled');\n }\n }\n for (var i = 0; i < noCells.length; i++) {\n noCells[i].classList.remove('visible');\n noCells[i].setAttribute('disabled', 'disabled');\n }\n for (var i = 0; i < singleCells.length; i++) {\n singleCells[i].classList.remove('visible');\n singleCells[i].setAttribute('disabled', 'disabled');\n }\n cellSettings.classList.remove( 'visible' );\n }\n\n /**\n * empty cell setting\n */\n // let emptySetting = document.\n const infArr = thisElem.className.match(/wptb-element-table_cell_setting-((.+-)\\d+)/i);\n if (infArr && infArr.length > 1) {\n const controlKey = 'emptyCell';\n const settingId = `wptb-el-table_cell_setting-${infArr[1]}-${controlKey}`;\n const settingElem = document.getElementById(settingId);\n if (settingElem) {\n settingElem.querySelector('input[type=\"checkbox\"]').checked = thisElem.classList.contains('wptb-empty')\n }\n }\n\n\n let details = {countMarkedCells:markedCells};\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/cell/mark', thisElem, details);\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 let noCells = document.getElementsByClassName('wptb-no-cell-action'),\n singleCells = document.getElementsByClassName('wptb-single-action'),\n multipleCells = document.getElementsByClassName('wptb-multiple-select-action'),\n cellSettings = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ),\n tds = table.getElementsByClassName('wptb-highlighted');\n while (tds.length) {\n tds[0].classList.remove('wptb-highlighted');\n }\n cellSettings.classList.remove( 'visible' );\n for (let i = 0; i < array.length; i++) {\n for (let j = 0; j < array[i].length; j++) {\n array[i][j] = 0;\n }\n }\n for (let i = 0; i < multipleCells.length; i++) {\n multipleCells[i].classList.remove('visible');\n multipleCells[i].setAttribute('disabled', 'disabled');\n }\n for (let i = 0; i < noCells.length; i++) {\n noCells[i].classList.add('visible');\n noCells[i].removeAttribute('disabled');\n }\n for (let i = 0; i < singleCells.length; i++) {\n singleCells[i].classList.remove('visible');\n singleCells[i].setAttribute('disabled', 'disabled');\n }\n\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/undo-select/active', table);\n };\n\n /*\n * This fills the abstract representation of our table with\n * zeros, at the start. the max amount of cells is the greatest sum\n * of all colspans for row.\n */\n\n var fillTableArray = function () {\n var colspansSums = [], a = [];\n\n //calculate max amount of cells inside a row\n for (var i = 0; i < table.rows.length; i++) {\n var cells = table.rows[i].getElementsByTagName('td'),\n colspanSumInRow = 0;\n for (var j = 0; j < cells.length; j++) {\n colspanSumInRow += cells[j].colSpan;\n }\n colspansSums.push(colspanSumInRow);\n }\n\n maxAmountOfCells = Math.max.apply(null, colspansSums);\n //calculate max rows\n var maxAmountOfRows = table.rows.length;\n\n // fill with zeros from both values\n for (var i = 0; i < maxAmountOfRows; i++) {\n a[i] = [];\n for (var j = 0; j < maxAmountOfCells; j++) {\n a[i].push(0);\n }\n }\n drawTable(a);\n return a;\n };\n\n /*\n * This function gets the sum of all colspans in a row.\n * @param number the number of row to be used as reference.\n */\n var getActualPointsInRow = function (row) {\n var tds = table.rows[row].getElementsByTagName('td'),\n points = 0;\n for (var i = 0; i < tds.length; i++) {\n points += tds[i].colSpan;\n }\n return points;\n }\n\n /*\n * This function gets us the exact coordinates of\n * an exact cell, in a more reliable way than xIndex and yIndex,\n * these last ones were meant to be used for getting the cell trough them.\n * @param DOMElement the cell to get the coordinates.\n */\n var getCoords = function (search) {\n var skipInCols = [], cell;\n\n for (var i = 0; i < maxAmountOfCells; i++) {\n skipInCols[i] = 0;\n }\n\n for (var i = 0; i < table.rows.length; i++) {\n var cellsBuffer = table.rows[i].getElementsByTagName('td');\n cellPointer = 0;\n for (var xPosition = 0; xPosition < maxAmountOfCells; xPosition += stepsToMove) {\n stepsToMove = 1;\n\n if (skipInCols[xPosition]) {\n skipInCols[xPosition]--;\n } else {\n var td = cellsBuffer[cellPointer++];\n if (td == search) {\n return [i, xPosition];\n }\n if (td.rowSpan > 1) {\n for ( let k = 0; k < td.colSpan; k++ ) {\n skipInCols[xPosition + k] = td.rowSpan - 1;\n }\n stepsToMove = td.colSpan;\n } else if (td.colSpan > 1) {\n stepsToMove = td.colSpan;\n }\n }\n }\n }\n };\n\n jQuery('#wptb-table-border-color').val('');\n jQuery('#wptb-table-padding-number,#wptb-table-padding-slider').val('15');\n\n if ( columns || rows ) {\n //END OF PRIVATE FUNCTIONS\n for (var i = 0; i < settings.length; i++) {\n if (settings[i].id !== 'wptb-apply-inner-border') {\n settings[i].classList.add('visible');\n }\n }\n\n //Create a HTML Table element.\n table = document.createElement( 'table' );\n table.classList.add( 'wptb-preview-table', 'wptb-element-main-table_setting-startedid-0' );\n table.style.border = '0px solid';\n table.dataset.reconstraction = 1;\n //table.dataset.wptbAdaptiveTable = 1;\n //Add the data rows.\n for (var i = 0; i < rows; i++) {\n\n row = table.insertRow(-1);\n row.classList.add( 'wptb-row' );\n\n for (var j = 0; j < columns; j++) {\n cell = new WPTB_Cell(mark);\n cell.setCoords(i, j);\n cell.getDOMElement().style.borderWidth = '1px';\n row.appendChild(cell.getDOMElement());\n }\n }\n } else {\n if( ! wptb_preview_table ) wptb_preview_table = document.querySelector( '.wptb-preview-table' );\n\n if ( wptb_preview_table ) {\n table = wptb_preview_table;\n\n let cells = table.getElementsByTagName('td');\n\n if (cells.length > 0) {\n for (let i = 0; i < cells.length; i++) {\n WPTB_Cell(mark, cells[i]);\n }\n }\n } else {\n return;\n }\n }\n\n /**\n * this method run \"mark\" method of WPTB_Table object\n * @param event\n */\n table.mark = (event) => {\n mark(event);\n }\n\n table.wptbCell = (callback, DOMElement) => {\n return WPTB_Cell(callback, DOMElement);\n }\n\n table.tableSM = () => {\n return WPTB_TableStateSaveManager;\n }\n\n /**\n * this method run \"undoSelect\" method of WPTB_Table object\n * @param event\n */\n table.undoSelect = () => {\n undoSelect();\n }\n\n /**\n * method for set value for maxAmountOfCells\n * @param value\n */\n table.setMaxAmountOfCells = (value) => {\n maxAmountOfCells = value;\n }\n\n /**\n * this method return maxAmountOfCells value\n * @returns {*}\n */\n table.getMaxAmountOfCells = () => {\n return maxAmountOfCells;\n }\n\n /**\n * this method run \"fillTableArray\" method of WPTB_Table object\n * @returns {[]}\n */\n table.fillTableArray = () => {\n return fillTableArray();\n }\n /*\n * For assigning to each cell xIndex and y Index attributes,\n * these are the column number and row number of cell in table.\n */\n\n table.recalculateIndexes = function () {\n WPTB_Helper.recalculateIndexes( this );\n }\n\n table.addColumnWidth = function( value, cleaner ) {\n let highlighted = table.getElementsByClassName( 'wptb-highlighted' );\n if( highlighted.length > 0 ) {\n for( let k = 0; k < highlighted.length; k++ ) {\n let dataXIndex = highlighted[k].dataset.xIndex;\n if( dataXIndex ) {\n function tableTdsFor( dataXIndex, colspan ) {\n let tableRows = table.rows;\n let widthIsSet = false;\n let arrayTdsFromPreviousRow = [];\n for( let i = 0; i < tableRows.length; i++ ) {\n let row = tableRows[i];\n let tds = row.children;\n for( let j = 0; j < tds.length; j++ ) {\n let td = tds[j];\n if( td.dataset.xIndex == dataXIndex ) {\n if( value ) {\n if( td.colSpan == colspan ) {\n td.style.width = value + 'px';\n td.removeAttribute( 'data-wptb-fixed-width' );\n widthIsSet = true;\n } else {\n td.style.width = null;\n td.dataset.wptbFixedWidth = value;\n if( i == tableRows.length - 1 && ! widthIsSet ) {\n tableTdsFor( dataXIndex, colspan + 1 );\n }\n }\n } else if( cleaner ) {\n td.style.width = null;\n td.removeAttribute( 'data-wptb-fixed-width' );\n } else {\n if( td.dataset.wptbFixedWidth ) {\n if( td.colSpan == colspan ) {\n td.style.width = td.dataset.wptbFixedWidth + 'px';\n td.removeAttribute( 'data-wptb-fixed-width' );\n }\n } else if( td.style.width ) {\n for( let z = 0; z < arrayTdsFromPreviousRow.length; z++ ) {\n arrayTdsFromPreviousRow[z].style.width = td.style.width;\n }\n arrayTdsFromPreviousRow = [];\n } else {\n arrayTdsFromPreviousRow.push( td );\n }\n }\n break;\n }\n }\n }\n }\n\n tableTdsFor( dataXIndex, 1 );\n }\n }\n\n table.tdDefaultWidth();\n\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\n }\n }\n\n table.tdDefaultWidth = function() {\n let rows = table.rows;\n\n let tableTdsSumMaxWidth = 0;\n let tableTdsSumMaxWidthFixed = 0;\n let tableTdsSumMaxWidthAuto = 0;\n\n let wptbTableSetup = document.getElementsByClassName( 'wptb-table-setup' )[0];\n let wptbTableSetupWidth = wptbTableSetup.offsetWidth;\n\n let arrayCellsWidthFixedHelper = [];\n let arrayCellsWidthAutoHelper = [];\n let tdPaddingCommon = 0;\n let tableTdBorderCommonWidth = 0;\n let cssForTdsWidthAuto = '';\n\n\n let tableFullStyleObj = window.getComputedStyle( table, null );\n let borderLeftWidth = tableFullStyleObj.getPropertyValue( 'border-left-width' );\n let borderRightWidth = tableFullStyleObj.getPropertyValue( 'border-right-width' );\n let tableBorderCommon = parseFloat( borderLeftWidth, 10 ) + parseFloat( borderRightWidth, 10 );\n\n for( let i = 0; i < rows.length; i++ ) {\n let tds = rows[i].children;\n for( let j = 0; j < tds.length; j++ ) {\n let td = tds[j];\n\n if( ! arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] && ! arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] ) {\n if( td.style.width ) {\n arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] = parseFloat( td.style.width );\n td.removeAttribute( 'data-wptb-css-td-auto-width' );\n } else {\n if( ! td.dataset.wptbFixedWidth ) {\n arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] = table.dataset.wptbTdWidthAuto ? parseFloat( table.dataset.wptbTdWidthAuto, 10 ) : 100;\n td.dataset.wptbCssTdAutoWidth = true;\n }\n }\n\n if( window.getComputedStyle( td, null ) ) {\n let tdStyleObj = window.getComputedStyle( td, null );\n let tdPaddingLeft = tdStyleObj.getPropertyValue( 'padding-left' );\n let tdPaddingRight = tdStyleObj.getPropertyValue( 'padding-right' );\n tdPaddingCommon = parseFloat( tdPaddingLeft, 10 ) + parseFloat( tdPaddingRight, 10 );\n\n let tableTdBorderLeftWidth = tdStyleObj.getPropertyValue( 'border-left-width' );\n let tableTdBorderRightWidth = tdStyleObj.getPropertyValue( 'border-right-width' );\n tableTdBorderCommonWidth = parseFloat( tableTdBorderLeftWidth, 10 ) + parseFloat( tableTdBorderRightWidth, 10 );\n tableTdBorderCommonWidth = tableTdBorderCommonWidth / 2;\n\n if( arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] ) {\n arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] += tdPaddingCommon;\n arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] += tableTdBorderCommonWidth;\n\n if( j == 0 && ( tableBorderCommon / 2 ) <= parseFloat( tableTdBorderLeftWidth, 10 ) ) {\n arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] += parseFloat( tableTdBorderLeftWidth, 10 ) / 2;\n } else if( j == 0 && ( tableBorderCommon / 2 ) > parseFloat( tableTdBorderLeftWidth, 10 ) ) {\n arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] += ( ( tableBorderCommon / 2 ) - ( parseFloat( tableTdBorderRightWidth, 10 ) / 2 ) );\n }\n\n if( j == tds.length - 1 && ( tableBorderCommon / 2 ) <= parseFloat( tableTdBorderRightWidth, 10 ) ) {\n arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] += parseFloat( tableTdBorderRightWidth, 10 ) / 2;\n } else if( j == tds.length - 1 && ( tableBorderCommon / 2 ) > parseFloat( tableTdBorderRightWidth, 10 ) ) {\n arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] += ( ( tableBorderCommon / 2 ) - ( parseFloat( tableTdBorderRightWidth, 10 ) / 2 ) );\n }\n } else if( arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] ) {\n arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] += tdPaddingCommon;\n arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] += tableTdBorderCommonWidth;\n\n if( j == 0 && ( tableBorderCommon / 2 ) <= parseFloat( tableTdBorderLeftWidth, 10 ) ) {\n arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] += parseFloat( tableTdBorderLeftWidth, 10 ) / 2;\n } else if( j == 0 && ( tableBorderCommon / 2 ) > parseFloat( tableTdBorderLeftWidth, 10 ) ) {\n arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] += ( ( tableBorderCommon / 2 ) - ( parseFloat( tableTdBorderLeftWidth, 10 ) / 2 ) );\n }\n\n if( j == tds.length - 1 && ( tableBorderCommon / 2 ) <= parseFloat( tableTdBorderRightWidth, 10 ) ) {\n arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] += parseFloat( tableTdBorderRightWidth, 10 ) / 2;\n } else if( j == tds.length - 1 && ( tableBorderCommon / 2 ) > parseFloat( tableTdBorderRightWidth, 10 ) ) {\n arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] += ( ( tableBorderCommon / 2 ) - ( parseFloat( tableTdBorderLeftWidth, 10 ) / 2 ) );\n }\n }\n }\n } else if( arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] ) {\n if( ! td.dataset.wptbFixedWidth ) {\n td.dataset.wptbCssTdAutoWidth = true;\n }\n } else if( arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] ) {\n td.removeAttribute( 'data-wptb-css-td-auto-width' );\n }\n }\n }\n\n for( let i = 0; i < arrayCellsWidthFixedHelper.length; i++ ) {\n if( arrayCellsWidthFixedHelper[i] ) {\n tableTdsSumMaxWidthFixed += arrayCellsWidthFixedHelper[i];\n }\n }\n\n let CellsWidthAutoCount = 0;\n for( let i = 0; i < arrayCellsWidthAutoHelper.length; i++ ) {\n if( arrayCellsWidthAutoHelper[i] ) {\n tableTdsSumMaxWidthAuto += arrayCellsWidthAutoHelper[i];\n CellsWidthAutoCount++;\n }\n }\n\n tableTdsSumMaxWidth = tableTdsSumMaxWidthFixed + tableTdsSumMaxWidthAuto;\n\n table.dataset.wptbTableTdsSumMaxWidth = tableTdsSumMaxWidth;\n if( CellsWidthAutoCount ) {\n table.dataset.wptbCellsWidthAutoCount = CellsWidthAutoCount;\n if( table.mergingСellsHorizontally ) {\n table.dataset.wptbFixedWidthSize = tableTdsSumMaxWidthFixed;\n } else {\n table.removeAttribute( 'data-wptb-fixed-width-size' );\n }\n } else {\n table.removeAttribute( 'data-wptb-fixed-width-size' );\n table.removeAttribute( 'data-wptb-cells-width-auto-count' );\n }\n\n let styleElementCreate = false;\n let tableTdWidthAuto;\n if( tableTdsSumMaxWidth < wptbTableSetupWidth ) {\n if( CellsWidthAutoCount ) {\n table.style.minWidth = '100%';\n if( table.mergingСellsHorizontally ) {\n table.style.width = 'auto';\n let tableTdsWidthAutoCommon = wptbTableSetupWidth - tableTdsSumMaxWidthFixed;\n tableTdWidthAuto = tableTdsWidthAutoCommon / CellsWidthAutoCount;\n tableTdWidthAuto = tableTdWidthAuto - tdPaddingCommon - tableTdBorderCommonWidth;\n styleElementCreate = true;\n } else {\n table.style.width = '100%';\n }\n } else {\n table.style.width = 'auto';\n table.style.minWidth = null;\n table.style.maxWidth = null;\n }\n } else {\n table.style.maxWidth = null;\n table.style.minWidth = tableTdsSumMaxWidth + 'px';\n table.style.width = 'auto';\n tableTdWidthAuto = table.dataset.wptbTdWidthAuto ? table.dataset.wptbTdWidthAuto : '100';\n styleElementCreate = true;\n }\n\n let head = document.head;\n if( head ) {\n let cssForTdsWidthAutoOld = head.querySelector( 'style[data-wptb-td-auto-width=\"true\"]' );\n if( cssForTdsWidthAutoOld ) {\n head.removeChild( cssForTdsWidthAutoOld );\n }\n }\n\n if( styleElementCreate ) {\n cssForTdsWidthAuto = document.createElement( 'style' );\n cssForTdsWidthAuto.setAttribute( 'data-wptb-td-auto-width', true );\n cssForTdsWidthAuto.innerHTML = '[data-wptb-css-td-auto-width=true]{width:' + tableTdWidthAuto + 'px}';\n if( head ) {\n head.appendChild( cssForTdsWidthAuto );\n }\n }\n\n if( table.dataset.wptbTableAlignment ) {\n let wptbTableAlignment = table.dataset.wptbTableAlignment;\n\n let wptbTableSetupWidth = wptbTableSetup.offsetWidth;\n if( wptbTableSetupWidth < table.offsetWidth ) {\n table.style.float = null;\n } else {\n if( wptbTableAlignment == 'center' ) {\n table.style.float = null;\n } else {\n table.style.float = wptbTableAlignment;\n }\n }\n\n if( wptbTableAlignment == 'center' ) {\n wptbTableSetup.style.float = null;\n } else {\n wptbTableSetup.style.float = wptbTableAlignment;\n }\n\n if( tableTdWidthAuto && table.dataset.wptbTableContainerMaxWidth && table.offsetWidth < table.dataset.wptbTableContainerMaxWidth ) {\n table.style.width = '100%';\n }\n } else {\n table.style.float = null;\n }\n }\n\n table.addRowHeight = function( value, cleaner ) {\n let highlighted = table.getElementsByClassName( 'wptb-highlighted' );\n if( highlighted.length > 0 ) {\n for( let k = 0; k < highlighted.length; k++ ) {\n let dataYIndex = highlighted[k].dataset.yIndex;\n if( dataYIndex ) {\n function tableTdsFor( dataYIndex, rowspan ) {\n let tableRows = table.rows;\n let heightIsSet = false;\n let arrayTdsPrevious = [];\n for( let i = 0; i < tableRows.length; i++ ) {\n let row = tableRows[i];\n let tds = row.children;\n for( let j = 0; j < tds.length; j++ ) {\n let td = tds[j];\n if( td.dataset.yIndex == dataYIndex ) {\n if( value ) {\n if( td.rowSpan == rowspan ) {\n td.style.height = value + 'px';\n td.removeAttribute( 'data-wptb-fixed-heidht' );\n heightIsSet = true;\n continue;\n } else {\n td.style.height = null;\n td.dataset.wptbFixedHeight = value;\n if( j == tds.length - 1 && ! heightIsSet ) {\n tableTdsFor( dataYIndex , rowspan + 1 );\n }\n }\n } else if( cleaner ) {\n td.style.height = null;\n td.removeAttribute( 'data-wptb-fixed-heidht' );\n } else {\n if( td.dataset.wptbFixedHeight ) {\n if( td.rowSpan = rowspan ) {\n td.style.height = td.dataset.wptbFixedHeight + 'px';\n td.removeAttribute( 'data-wptb-fixed-width' );\n }\n } else if( td.style.height ) {\n for( let z = 0; z < arrayTdsPrevious.length; z++ ) {\n arrayTdsPrevious[z].style.height = td.style.height;\n }\n arrayTdsPrevious = [];\n } else {\n arrayTdsPrevious.push( td );\n }\n }\n }\n }\n }\n }\n\n tableTdsFor( dataYIndex, 1 );\n }\n }\n\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\n }\n }\n\n table.reconstraction = function() {\n let tds = table.getElementsByTagName( 'td' );\n table.mergingСellsHorizontally = false;\n table.mergingCellsVertically = false;\n table.dataset.reconstraction = 1;\n let forBreak = 0;\n for( let i = 0; i < tds.length; i++ ) {\n if( tds[i].colSpan > 1 ) {\n table.dataset.reconstraction = 0;\n table.mergingСellsHorizontally = true;\n forBreak++;\n }\n\n if( tds[i].rowSpan > 1 ) {\n table.dataset.reconstraction = 0;\n table.mergingCellsVertically = true;\n forBreak++;\n }\n\n if( forBreak == 2 ) {\n break;\n }\n }\n }\n\n /*\n * As simple as it is: adds a column to the end of table.\n */\n table.addColumnEnd = function () {\n let td,\n currentTable = document.getElementsByClassName('wptb-preview-table'),\n currentTableTd,\n currentTdStyle;\n if (currentTable.length > 0) {\n currentTableTd = currentTable[0].querySelector('td');\n }\n\n if (currentTableTd) {\n currentTdStyle = currentTableTd.getAttribute('style');\n }\n\n for (var i = 0; i < table.rows.length; i++) {\n td = new WPTB_Cell(mark);\n\n if (currentTdStyle) {\n td.getDOMElement().setAttribute('style', currentTdStyle);\n td.getDOMElement().style.width = null;\n td.getDOMElement().style.height = null;\n td.getDOMElement().style.borderColor = WPTB_TableSettingsData.getTableSetting('borderColor');\n }\n\n table.rows[i].appendChild(td.getDOMElement());\n array[i].push(0);\n }\n\n maxAmountOfCells++;\n table.recalculateIndexes();\n table.tdDefaultWidth();\n table.addRowHeight();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n /*\n * As simple as it looks: adds a column to the start of table.\n */\n\n table.addColumnStart = function () {\n let td,\n firstCell,\n currentTable = document.getElementsByClassName('wptb-preview-table'),\n currentTableTd,\n currentTdStyle;\n if ( currentTable.length > 0 ) {\n currentTableTd = currentTable[0].querySelector('td');\n }\n\n if ( currentTableTd ) {\n currentTdStyle = currentTableTd.getAttribute('style');\n }\n\n for (var i = 0; i < table.rows.length; i++) {\n td = new WPTB_Cell(mark);\n if (currentTdStyle) {\n td.getDOMElement().setAttribute('style', currentTdStyle);\n td.getDOMElement().style.width = null;\n td.getDOMElement().style.height = null;\n td.getDOMElement().style.borderColor = WPTB_TableSettingsData.getTableSetting('borderColor');\n }\n firstCell = table.rows[i].getElementsByTagName('td')[0];\n if (firstCell) {\n table.rows[i].insertBefore(td.getDOMElement(), firstCell);\n } else {\n table.rows[i].appendChild(td.getDOMElement());\n }\n array[i].push(0);\n }\n\n maxAmountOfCells++;\n table.recalculateIndexes();\n table.tdDefaultWidth();\n table.addRowHeight();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n /*\n * Well, not so simple as previous functions.\n * It adds a column after a certain column of reference.\n * @param integer the column number to be used as reference.\n *\tIf empty, then the first highlighted cell is used as reference.\n */\n\n table.addColumnAfter = function (c_pos) {\n let rows = table.rows,\n cell,\n cellStyle,\n pos;\n\n if(c_pos != undefined && typeof c_pos === 'number') {\n pos = c_pos;\n cell = document.querySelector('[data-x-index=\"' + pos + '\"]');\n } else {\n cell = document.querySelector('.wptb-highlighted');\n pos = getCoords(cell)[1];\n }\n\n if(cell) {\n cellStyle = cell.getAttribute('style');\n\n if( maxAmountOfCells - pos - cell.colSpan + 1 == 1 ) {\n table.addColumnEnd();\n } else {\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 if(parseInt(tds[j].dataset.xIndex) <= pos) {\n if(parseInt(tds[j].dataset.xIndex) + tds[j].colSpan == pos + cell.colSpan) {\n let td = newTd(cellStyle);\n let nextSib = tds[j].nextSibling;\n if (nextSib) {\n rows[i].insertBefore(td.getDOMElement(), nextSib);\n } else {\n rows[i].appendChild(td.getDOMElement());\n }\n\n break;\n } else if(parseInt(tds[j].dataset.xIndex) + tds[j].colSpan > pos + cell.colSpan) {\n tds[j].colSpan++;\n if(tds[j].rowSpan > 1) i += tds[j].rowSpan - 1;\n break;\n }\n } else if(parseInt(tds[j].dataset.xIndex) > pos) {\n let td = newTd(cellStyle);\n rows[i].insertBefore(td.getDOMElement(), tds[j]);\n break;\n }\n }\n }\n\n function newTd(cellStyle) {\n let td = new WPTB_Cell(mark);\n if (cellStyle) {\n td.getDOMElement().setAttribute('style', cellStyle);\n td.getDOMElement().style.width = null;\n td.getDOMElement().style.height = null;\n }\n td.getDOMElement().style.borderColor = WPTB_TableSettingsData.getTableSetting('borderColor');\n return td;\n }\n\n for (var i = 0; i < array.length; i++) {\n array[i].push(0);\n }\n maxAmountOfCells++;\n drawTable(array);\n table.recalculateIndexes();\n table.addColumnWidth();\n table.addRowHeight();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n }\n };\n\n /*\n * For preventing us to take a lot of time,\n * This is just calling the function addColumnAfter, but\n * using the previous column to current one as reference.\n * @see addColumnAfter\n */\n\n table.addColumnBefore = function () {\n var cell = document.querySelector('.wptb-highlighted'),\n pos = getCoords(cell)[1];\n\n if (pos === 0) {\n table.addColumnStart();\n } else {\n table.addColumnAfter(pos - 1);\n }\n };\n\n /*\n * Luckily, thisfunction is simple,\n * it just add a row to the end of table.\n */\n\n table.addRowToTheEnd = function () {\n let r = table.insertRow(-1),\n td,\n aux,\n currentTable = document.getElementsByClassName('wptb-preview-table');\n r.classList.add( 'wptb-row' );\n if (currentTable.length > 0) {\n currentTable = currentTable[0];\n\n for (var i = 0; i < maxAmountOfCells; i++) {\n td = new WPTB_Cell(mark);\n let currentTableTd = currentTable.querySelector('[data-x-index=\"' + i + '\"]');\n if( currentTableTd ) {\n let currentTdStyle = currentTableTd.getAttribute( 'style' );\n\n td.getDOMElement().setAttribute( 'style', currentTdStyle );\n td.getDOMElement().style.height = null;\n }\n r.appendChild(td.getDOMElement());\n }\n\n aux = Array.from(array[0]);\n array.push(aux);\n drawTable(array);\n table.recalculateIndexes();\n WPTB_Helper.tableRowsColorsReinstall( table );\n table.addColumnWidth();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n };\n\n /*\n * Yet another simple function,\n * it just add a row to the start of table.\n */\n\n table.addRowToTheStart = function () {\n let r = table.insertRow(0),\n td,\n aux,\n currentTable = document.getElementsByClassName('wptb-preview-table'),\n currentTableTd,\n currentTdStyle;\n r.classList.add( 'wptb-row' );\n if (currentTable.length > 0) {\n currentTable = currentTable[0];\n\n for (var i = 0; i < maxAmountOfCells; i++) {\n td = new WPTB_Cell(mark);\n let currentTableTd = currentTable.querySelector('[data-x-index=\"' + i + '\"]');\n if( currentTableTd ) {\n let currentTdStyle = currentTableTd.getAttribute( 'style' );\n\n td.getDOMElement().setAttribute( 'style', currentTdStyle );\n td.getDOMElement().style.height = null;\n }\n r.appendChild(td.getDOMElement());\n }\n\n aux = Array.from(array[0]);\n array.push(aux);\n drawTable(array);\n table.recalculateIndexes();\n WPTB_Helper.tableRowsColorsReinstall( table );\n table.addColumnWidth();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n };\n\n /*\n * This function adds a row before the current one.\n * Since the biggest factor of problem is a not-started but ongoing rowspan,\n * the most of the troubles is not here.\n */\n\n table.addRowBefore = function () {\n let cell = document.querySelector('.wptb-highlighted'),\n cellStyle = cell.getAttribute('style'),\n row = getCoords(cell)[0],\n cellNew;\n for( let i = row - 1; i >= 0; i-- ) {\n let rowChildren = table.rows[i].children;\n let rowChildrenLength = rowChildren.length;\n if( rowChildrenLength > 0 ) {\n for( let j = 0; j < rowChildrenLength; j++ ) {\n if( rowChildren[j].rowSpan == 1 ) {\n row = i;\n cellNew = true;\n break;\n }\n }\n }\n if ( cellNew ) {\n break;\n }\n }\n\n if (row === 0) {\n table.addRowToTheStart();\n } else {\n table.addRowAfter( row, cellStyle );\n }\n };\n\n /*\n * Well... by the name convention of the previous 3 functions,\n * it's pretty obvious that this functions attaches a new\n * row after highlighted cell row. The greatest obstacle it was\n * the possibility of a TR not having the exact amount of columns\n * occuped by actual node but rowspanned upper cells. For that purpose\n * it was created the function realTimeArray.\n * @see realTimeArray\n */\n\n table.addRowAfter = function ( row, cellStyle ) {\n let cellRowSpan,\n rowAfter,\n aux;\n\n if ( ( row == undefined || typeof row !== 'number' ) && cellStyle == undefined ) {\n let cell = document.querySelector('.wptb-highlighted');\n cellStyle = cell.getAttribute('style'),\n row = getCoords(cell)[0],\n cellRowSpan = cell.rowSpan,\n rowAfter = row + cellRowSpan - 1;\n } else {\n rowAfter = row;\n }\n\n\n let cellsColSpan = 0;\n if ( rowAfter < table.rows.length -1 ) {\n for( let i = 0; i <= rowAfter ; i++ ) {\n let tableRowsIChildren = table.rows[i].children,\n tableRIChildrenLength = tableRowsIChildren.length;\n if( tableRIChildrenLength > 0 ) {\n for( let j = 0; j < tableRIChildrenLength; j++ ) {\n let rowIRowSpan = tableRowsIChildren[j].rowSpan;\n\n if ( rowIRowSpan - 1 + i > rowAfter ) {\n tableRowsIChildren[j].rowSpan++;\n }\n }\n }\n }\n\n let rNext = table.rows[rowAfter + 1],\n rNextChildren = rNext.children,\n rNextChildrenLength = rNextChildren.length;\n\n if( rNextChildrenLength > 0 ) {\n for ( let i = 0; i < rNextChildrenLength; i++ ) {\n cellsColSpan += rNextChildren[i].colSpan;\n }\n }\n } else {\n cellsColSpan = array[0].length;\n }\n\n let r = table.insertRow( rowAfter + 1 );\n r.classList.add( 'wptb-row' );\n\n for ( j = 0; j < cellsColSpan; j++ ) {\n let td = new WPTB_Cell( mark );\n let currentTableTd = table.querySelector('[data-x-index=\"' + j + '\"]');\n if( currentTableTd ) {\n let currentTdStyle = currentTableTd.getAttribute( 'style' );\n\n td.getDOMElement().setAttribute( 'style', currentTdStyle );\n td.getDOMElement().style.height = null;\n }\n r.appendChild( td.getDOMElement() );\n }\n\n aux = Array.from(array[0]);\n array.push(aux);\n drawTable(array);\n table.recalculateIndexes();\n WPTB_Helper.tableRowsColorsReinstall( table );\n table.addColumnWidth();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after');\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n /*\n * This function checks the current selected cells\n * make a rectangular shape.\n * @param Array the abstract table.\n * @return false, if not making a rectangle, or\n *\tArray an array containing number of rows and columns, if selection makes a rectangle.\n */\n\n table.isSquare = function (a) {\n var rowStart = -1,\n columnStart = -1,\n rowEnd = -1,\n columnEnd = -1,\n height,\n width,\n itemsEstimate = 0,\n items = 0;\n\n for (var i = 0; i < a.length; i++) {\n for (var j = 0; j < a[i].length; j++) {\n if (a[i][j] == 1) {\n if ( j < columnStart || columnStart == -1 ) {\n columnStart = j;\n }\n if ( i < rowStart || rowStart == -1 ) {\n rowStart = i;\n }\n }\n }\n\n }\n\n for (var i = a.length - 1; i > -1; i--) {\n for (var j = a[i].length - 1; j > -1; j--) {\n if (a[i][j] == 1) {\n if ( j > columnEnd ) {\n columnEnd = j;\n }\n if ( i > rowEnd ) {\n rowEnd = i;\n }\n }\n }\n }\n\n for (var i = rowStart; i < rowEnd; i++) {\n for (var j = columnStart; j < columnEnd; j++) {\n if (a[i][j] == 0 || a[i][j] == undefined) {\n return false;\n }\n }\n }\n\n for (var i = 0; i < a.length; i++) {\n for (var j = 0; j < a[i].length; j++) {\n if (a[i][j] == 1) {\n items++;\n }\n }\n }\n\n height = rowEnd - rowStart + 1;\n width = columnEnd - columnStart + 1;\n itemsEstimate = height * width;\n\n if (itemsEstimate !== items) {\n return false;\n }\n return [height, width];\n };\n\n /*\n * This function merges all selected cells.\n * Well, actually sets the colspan and rowspan of first\n * upper left cell in selection and deletes the another selected cells.\n */\n\n table.mergeCells = function () {\n var dimensions = table.isSquare(array),\n rowspan = dimensions[0],\n colspan = dimensions[1],\n first = document.querySelector('.wptb-highlighted'),\n tds = [].slice.call(document.getElementsByClassName('wptb-highlighted'), 1),\n tdsChildrenNew = [];\n\n for (let i = 0; i < tds.length; i++) {\n let tdsInternalElements = tds[i].getElementsByClassName('wptb-ph-element');\n if (tdsInternalElements.length > 0) {\n let tdsIntElemLength = tdsInternalElements.length;\n for (let j = 0; j < tdsIntElemLength; j++) {\n tdsChildrenNew.push(tdsInternalElements[j]);\n }\n }\n let p = tds[i].parentNode;\n p.removeChild(tds[i]);\n }\n if (tdsChildrenNew.length > 0) {\n for (let i = 0; i < tdsChildrenNew.length; i++) {\n first.appendChild(tdsChildrenNew[i]);\n }\n }\n\n first.colSpan = colspan;\n first.rowSpan = rowspan;\n table.recalculateIndexes();\n table.reconstraction();\n let firstWidth = first.style.width;\n let firstDataFixedWidth = first.dataset.wptbFixedWidth;\n if( firstWidth ) {\n table.addColumnWidth( parseFloat( firstWidth, 10 ) );\n } else if( firstDataFixedWidth ) {\n table.addColumnWidth();\n } else {\n table.addColumnWidth( false, true );\n }\n\n let firstHeight = first.style.height;\n let firstDataFixedHeight = first.dataset.wptbFixedHeight;\n if( firstHeight ) {\n table.addRowHeight( parseFloat( firstHeight, 10 ) );\n } else if( firstDataFixedHeight ) {\n table.addRowHeight();\n } else {\n table.addRowHeight( false, true );\n }\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n /*\n * This functions makes the exact inverse as above.\n * It resets colspan and rowspan and appends\n * the same amount in cells to the table.\n * @bug\n */\n\n table.splitCell = function () {\n var cell = document.getElementsByClassName('wptb-highlighted')[0],\n rowspan = cell.rowSpan,\n colspan = cell.colSpan,\n cellStyles = cell.getAttribute('style'),\n row = getCoords(cell)[0],\n thisRow = table.rows[row],\n cellXIndex =cell.dataset.xIndex;\n\n cell.rowSpan = 1;\n cell.colSpan = 1;\n\n for (let i = 1; i < colspan; i++) {\n let td = new WPTB_Cell(mark);\n td.getDOMElement().setAttribute('style', cellStyles);\n td.getDOMElement().classList.add( 'wptb-highlighted' );\n if ( cell.nextSibling ) {\n thisRow.insertBefore( td.getDOMElement(), cell.nextSibling );\n } else {\n thisRow.appendChild( td.getDOMElement() );\n }\n\n }\n\n if (rowspan > 1) {\n for (let i = 1; i < rowspan; i++) {\n let rowChildInsertBefore = undefined,\n rowNext = table.rows[row + i],\n rowChildren = rowNext.children,\n rowChildrenLength = rowChildren.length;\n\n if ( rowChildrenLength > 0 ) {\n for ( let k = 0; k < rowChildrenLength; k++ ) {\n if ( Number( rowChildren[k].dataset.xIndex ) > Number( cellXIndex ) ) {\n rowChildInsertBefore = rowChildren[k];\n break;\n }\n }\n }\n for ( let j = 0; j < colspan; j++ ) {\n let td = new WPTB_Cell( mark );\n td.getDOMElement().setAttribute( 'style', cellStyles );\n if ( rowChildInsertBefore != undefined ) {\n rowNext.insertBefore( td.getDOMElement(), rowChildInsertBefore );\n } else {\n rowNext.appendChild( td.getDOMElement() );\n }\n }\n }\n }\n\n table.recalculateIndexes();\n table.reconstraction();\n table.addColumnWidth();\n table.addRowHeight();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n /*\n * Searches for rowspanned cells up to row number meeting it.\n * @param number the number of row where the function\n * must search up to.\n */\n\n table.findRowspannedCells = function (row) {\n var array = [],\n difference;\n actualPoints = getActualPointsInRow(row);\n if (actualPoints === maxAmountOfCells) {\n return [];\n }\n difference = maxAmountOfCells - actualPoints;\n\n for (var i = row - 1; i >= 0 && difference; i--) {\n var tds = table.rows[i].getElementsByTagName('td');\n for (var i = 0; i < tds.length; i++) {\n if (tds[i].rowSpan > 1) {\n array.push(tds[i]);\n difference -= tds[i].colSpan;\n }\n }\n }\n return array;\n\n }\n\n /*\n * This function explores the table and adds\n * a cell for each lacking one for each row\n * to meet an even amount of cells.\n */\n\n table.addLackingCells = function () {\n var sumRows = [];\n for (var i = 0; i < table.rows.length; i++) {\n sumRows.push(0);\n }\n\n for (var i = 0; i < table.rows.length; i++) {\n var tds = table.rows[i].getElementsByTagName('td');\n for (var j = 0; j < tds.length; j++) {\n if (tds[j].rowSpan > 1) {\n for (var k = 1; k < tds[j].rowSpan; k++) {\n sumRows[i + k]++;\n }\n }\n }\n }\n\n for (var i = 0; i < table.rows.length; i++) {\n var tds = table.rows[i].getElementsByTagName('td'),\n totalColspan = 0;\n for (var j = 0; j < tds.length; j++) {\n totalColspan += tds[j].colSpan;\n }\n totalColspan += sumRows[i];\n difference = maxAmountOfCells - totalColspan;\n for (var j = 0; j < difference; j++) {\n var td = new WPTB_Cell(mark);\n table.rows[i].appendChild(td.getDOMElement());\n //table.rows[i].insertBefore( td.getDOMElement(), rows[i].nextSibling );\n }\n }\n };\n\n /*\n * This function deletes the row of currently\n * selected cell.\n */\n\n table.deleteRow = function () {\n let cell = document.querySelector('.wptb-highlighted'),\n cellStyles = cell.getAttribute('style'),\n rowspan = cell.rowSpan,\n row = getCoords(cell)[0],\n thisRow,\n aux;\n\n if ( rowspan == undefined ) rowspan = 1;\n\n for ( let i = 0; i < rowspan; i++ ) {\n thisRow = table.rows[row];\n let thisRowChildren = thisRow.children,\n nextRow = table.rows[row + 1],\n nextRowChildren,\n nextRowChildrenLength,\n tdArr = [];\n\n if( nextRow != undefined ) {\n nextRowChildren = nextRow.children;\n nextRowChildrenLength = nextRowChildren.length;\n for (let j = 0; j < thisRowChildren.length; j++) {\n if ( thisRowChildren[j].rowSpan > 1 ) {\n let td = new WPTB_Cell(mark);\n td.getDOMElement().setAttribute('style', cellStyles);\n td.getDOMElement().colSpan = thisRowChildren[j].colSpan;\n td.getDOMElement().rowSpan = thisRowChildren[j].rowSpan - 1;\n\n let nextRowChildrenK = undefined;\n for ( let k = 0; k < nextRowChildrenLength; k++ ) {\n if ( Number( nextRowChildren[k].dataset.xIndex ) > Number( thisRowChildren[j].dataset.xIndex ) ) {\n nextRowChildrenK = nextRowChildren[k];\n break;\n }\n }\n\n if ( nextRowChildrenK ) {\n tdArr.push( [td, nextRowChildrenK] );\n } else {\n tdArr.push( [td] );\n }\n }\n }\n\n if ( tdArr.length > 0 ) {\n for ( let k = 0; k < tdArr.length; k++ ) {\n if ( tdArr[k][1] != undefined ) {\n nextRow.insertBefore( tdArr[k][0].getDOMElement(), tdArr[k][1] );\n } else {\n nextRow.appendChild( tdArr[k][0].getDOMElement() );\n }\n }\n }\n }\n\n let tableRows = table.rows;\n if ( tableRows.length > 0 ) {\n for ( let j = 0; j < row; j++ ) {\n let jRowChildren = tableRows[j].children;\n if ( jRowChildren.length > 0 ) {\n for ( let x = 0; x < jRowChildren.length; x++ ) {\n if ( jRowChildren[x].rowSpan - 1 >= row - j ) {\n jRowChildren[x].rowSpan--;\n }\n }\n }\n }\n }\n aux = Array.from(array[0]);\n array.pop(aux);\n drawTable(array);\n table.getElementsByTagName('tbody')[0].removeChild(table.rows[row]);\n\n if( table.rows.length == 0 ) {\n WPTB_Helper.toggleTableEditMode();\n wptbTableSetup.innerHTML = '';\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\n if( wptbSaveBtn.length > 0 ) {\n wptbSaveBtn = wptbSaveBtn[0];\n\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\n wptbSaveBtn.classList.remove('active');\n }\n } else {\n table.recalculateIndexes();\n WPTB_Helper.tableRowsColorsReinstall( table );\n WPTB_Helper.dataTitleColumnSet( table );\n table.reconstraction();\n }\n }\n\n undoSelect();\n\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n\n /*\n * This function deletes the column of currently\n * selected cell. Again, this is way more complicated than\n * delete row case.\n */\n\n table.deleteColumn = function () {\n let cell = document.querySelector('.wptb-highlighted'),\n cellXIndex = cell.dataset.xIndex,\n colspan = cell.colSpan;\n\n for ( let i = 0; i < colspan; i++ ) {\n for ( let j = 0; j < table.rows.length; j++ ) {\n let rowChildren = table.rows[j].children;\n let rowChildrenLength = rowChildren.length;\n if( rowChildrenLength > 0 ) {\n for ( let k = rowChildrenLength - 1; k >= 0; k-- ) {\n if ( Number( rowChildren[k].dataset.xIndex ) == Number( cellXIndex ) ) {\n if ( rowChildren[k].colSpan > 1 ) {\n rowChildren[k].colSpan--;\n } else {\n table.rows[j].removeChild( rowChildren[k] );\n }\n break;\n } else if( Number( rowChildren[k].dataset.xIndex ) < Number( cellXIndex ) &&\n Number( rowChildren[k].dataset.xIndex ) +\n Number( rowChildren[k].colSpan -1 ) >= cellXIndex ) {\n if ( rowChildren[k].colSpan > 1 ) {\n rowChildren[k].colSpan--;\n }\n break;\n }\n }\n }\n }\n\n for ( let j = 0; j < table.rows.length; j++ ) {\n if (array[j] != undefined)\n array[j].pop();\n }\n\n maxAmountOfCells--;\n\n if( table.querySelectorAll( 'td' ).length == 0 ) {\n WPTB_Helper.toggleTableEditMode();\n wptbTableSetup.innerHTML = '';\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\n if( wptbSaveBtn.length > 0 ) {\n wptbSaveBtn = wptbSaveBtn[0];\n\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\n wptbSaveBtn.classList.remove('active');\n }\n } else {\n table.recalculateIndexes();\n table.tdDefaultWidth();\n WPTB_Helper.dataTitleColumnSet( table );\n table.reconstraction();\n }\n }\n\n undoSelect();\n\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n // @deprecated old generate logic\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 // event hook to signal that table is generated and ready to be used\n WPTB_Helper.wptbDocumentEventGenerate('wptb:table:generated', document);\n\n WPTB_Helper.elementStartScript( table, 'table_setting' );\n WPTB_Helper.elementOptionsSet( 'table_setting', table );\n\n // this code gets the ID of the active element in the toolbar\n // and stores it in the data attribute of the common container element \"wpcd_fixed_toolbar\"\n// let wptbPhElement = document.getElementsByClassName( 'wptb-ph-element' );\n// let wpcdFixedToolbar = document.getElementById( 'wpcd_fixed_toolbar' );\n// for ( let i = 0; i < wptbPhElement.length; i++ ) {\n// wptbPhElement[i].addEventListener( 'click', function( e ) {\n// let wptbToolbar = document.getElementById( 'wpcd_fixed_toolbar' ).children;\n// for ( let j = 0; j < wptbToolbar.length; j++ ) {\n// let elementStyles = window.getComputedStyle( wptbToolbar[j], 'null' );\n// if( elementStyles.getPropertyValue( 'display' ) == 'block' ) {\n// wpcdFixedToolbar.dataset.toolbarActiveId = wptbToolbar[j].getAttribute( 'id' );\n// }\n// }\n// }, false );\n// }\n\n// let wptbPanelLeft = document.getElementsByClassName( 'wptb-panel-left' );\n// if( wptbPanelLeft.length > 0 ) {\n// wptbPanelLeft[0].addEventListener( 'click', function( e ) {\n// let toolbarActiveElementId = wpcdFixedToolbar.dataset.toolbarActiveId;\n// document.getElementById( toolbarActiveElementId ).style.display = '';\n// }, false );\n// }\n\n// let body = document.getElementsByTagName( 'body' );\n// if( body.length > 0 ) {\n// body[0].addEventListener( 'click', function( e ) {\n// if ( e.target.classList.contains( 'wptb-panel-left' ) || WPTB_Helper.findAncestor( e.target, 'wptb-panel-left' ) ) {\n// let toolbarActiveElementId = wpcdFixedToolbar.dataset.toolbarActiveId;\n// document.getElementById( toolbarActiveElementId ).style.display = '';\n// }\n// }, false );\n// }\n};\n","const WPTB_TableSettingsData = {\n borderColor: '',\n /**\n *\n * @param {string} name\n * @param {string} value\n */\n setTableSetting: function(name, value){\n this[name] = value;\n },\n /**\n *\n * @param {string} name\n * @returns {*}\n */\n getTableSetting: function (name) {\n return this[name];\n }\n}\n\n","const WPTB_TableStateSaveManager = function () {\n\tthis.tableStateSet = (generate) => {\n\t\tif (generate && window.wptbTableStateSaving && Array.isArray(window.wptbTableStateSaving)) {\n\t\t\treturn;\n\t\t}\n\n\t\t// get table setup\n\t\tlet wptbTableSetup = document.getElementsByClassName('wptb-table-setup');\n\t\tlet wptbPreviewTable = '';\n\t\tif (wptbTableSetup.length > 0) {\n\t\t\twptbTableSetup = wptbTableSetup[0];\n\n\t\t\twptbPreviewTable = wptbTableSetup.querySelector('.wptb-preview-table');\n\t\t} else {\n\t\t\twptbTableSetup = '';\n\t\t}\n\n\t\t// check if a global array doesn't exist with saved versions of the table\n\t\t// them create it\n\t\tif (!window.wptbTableStateSaving && !Array.isArray(window.wptbTableStateSaving)) {\n\t\t\twindow.wptbTableStateSaving = [];\n\t\t}\n\n\t\t// remove the extra part of the array after changing the table\n\t\t// when it is showed in the not last modified version\n\t\tif (window.wptbTableStateSaving.length > window.wptbTableStateNumberShow) {\n\t\t\twindow.wptbTableStateSaving = window.wptbTableStateSaving.slice(0, window.wptbTableStateNumberShow + 1);\n\t\t}\n\n\t\t// add new state of table\n\t\tlet wptbNewTableSetup = '';\n\t\tif (wptbTableSetup) {\n\t\t\twptbNewTableSetup = wptbTableSetup.cloneNode(true);\n\t\t\tconst wptbHighlighted = wptbNewTableSetup.getElementsByClassName('wptb-highlighted');\n\t\t\tfor (let i = 0; i < wptbHighlighted.length; i++) {\n\t\t\t\twptbHighlighted[i].classList.remove('wptb-highlighted');\n\t\t\t}\n\t\t\tconst wptbDirectlyhovered = wptbNewTableSetup.getElementsByClassName('wptb-directlyhovered');\n\t\t\tfor (let i = 0; i < wptbDirectlyhovered.length; i++) {\n\t\t\t\twptbDirectlyhovered[i].classList.remove('wptb-directlyhovered');\n\t\t\t}\n\t\t\tconst mceContentBodys = wptbNewTableSetup.querySelectorAll('.mce-content-body');\n\t\t\tif (mceContentBodys.length > 0) {\n\t\t\t\tfor (let k = 0; k < mceContentBodys.length; k++) {\n\t\t\t\t\tmceContentBodys[k].classList.remove('mce-content-body');\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst dataMceStyle = wptbNewTableSetup.querySelectorAll('[data-mce-style]');\n\t\t\tif (dataMceStyle.length > 0) {\n\t\t\t\tfor (let k = 0; k < dataMceStyle.length; k++) {\n\t\t\t\t\tdataMceStyle[k].removeAttribute('data-mce-style');\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst mceIds = wptbNewTableSetup.querySelectorAll('[id^=mce_]');\n\t\t\tif (mceIds.length > 0) {\n\t\t\t\tfor (let k = 0; k < mceIds.length; k++) {\n\t\t\t\t\tmceIds[k].removeAttribute('id');\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tlet cssForTdsWidthAutoValue = '';\n\t\tconst { head } = document;\n\t\tif (head) {\n\t\t\tconst cssForTdsWidthAuto = head.querySelector('style[data-wptb-td-auto-width=\"true\"]');\n\t\t\tif (cssForTdsWidthAuto) {\n\t\t\t\tcssForTdsWidthAutoValue = cssForTdsWidthAuto.innerHTML;\n\t\t\t}\n\t\t}\n\n\t\tlet wptbTableTitle = '';\n\t\tconst wptbSetupName = document.getElementById('wptb-setup-name');\n\t\tif (wptbSetupName) wptbTableTitle = wptbSetupName.value;\n\n\t\twindow.wptbTableStateSaving.push([wptbNewTableSetup, cssForTdsWidthAutoValue, wptbTableTitle]);\n\n\t\t// set new number of state which is showed now\n\t\twindow.wptbTableStateNumberShow = window.wptbTableStateSaving.length - 1;\n\n\t\t// make undo arrow active when the table was changed\n\t\tif (window.wptbTableStateSaving.length - 1 > 0) {\n\t\t\tlet wptbUndo = document.getElementsByClassName('wptb-undo');\n\t\t\tif (wptbUndo.length > 0) {\n\t\t\t\twptbUndo = wptbUndo[0];\n\n\t\t\t\twptbUndo.classList.remove('wptb-undoredo-disabled');\n\t\t\t}\n\t\t}\n\n\t\t// make redo arrow not active when the table was changed\n\t\tlet wptbRedo = document.getElementsByClassName('wptb-redo');\n\t\tif (wptbRedo.length > 0) {\n\t\t\twptbRedo = wptbRedo[0];\n\n\t\t\twptbRedo.classList.add('wptb-undoredo-disabled');\n\t\t}\n\n\t\tlet wptbSaveBtn = document.getElementsByClassName('wptb-save-btn');\n\t\tif (wptbSaveBtn.length > 0) {\n\t\t\twptbSaveBtn = wptbSaveBtn[0];\n\t\t\tif (\n\t\t\t\t(!wptbSaveBtn.dataset.wptbTableStateNumberSave && window.wptbTableStateNumberShow == 0) ||\n\t\t\t\twindow.wptbTableStateNumberShow == wptbSaveBtn.dataset.wptbTableStateNumberSave ||\n\t\t\t\t!wptbPreviewTable\n\t\t\t) {\n\t\t\t\twptbSaveBtn.classList.add('wptb-save-disabled');\n\t\t\t\twptbSaveBtn.classList.remove('active');\n\t\t\t} else {\n\t\t\t\twptbSaveBtn.classList.remove('wptb-save-disabled');\n\t\t\t\twptbSaveBtn.classList.add('active');\n\t\t\t}\n\t\t}\n\t};\n\n\tthis.tableStateGet = (datawptbUndoredo) => {\n\t\tif (datawptbUndoredo && window.wptbTableStateSaving && window.wptbTableStateSaving.length > 0) {\n\t\t\t// changes the number of the state which displays now\n\t\t\tif (datawptbUndoredo == 'undo') {\n\t\t\t\tif (window.wptbTableStateNumberShow > 0) {\n\t\t\t\t\twindow.wptbTableStateNumberShow--;\n\t\t\t\t} else {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t} else if (datawptbUndoredo == 'redo') {\n\t\t\t\tif (window.wptbTableStateNumberShow < window.wptbTableStateSaving.length) {\n\t\t\t\t\twindow.wptbTableStateNumberShow++;\n\t\t\t\t} else {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// add or delete class \"wptb-undoredo-disabled\" for undo button\n\t\t\tlet wptbUndo = document.getElementsByClassName('wptb-undo');\n\t\t\tif (wptbUndo.length > 0) {\n\t\t\t\twptbUndo = wptbUndo[0];\n\n\t\t\t\tif (window.wptbTableStateNumberShow == 0) {\n\t\t\t\t\tif (wptbUndo) {\n\t\t\t\t\t\twptbUndo.classList.add('wptb-undoredo-disabled');\n\t\t\t\t\t}\n\t\t\t\t} else if (window.wptbTableStateNumberShow > 0) {\n\t\t\t\t\tif (wptbUndo) {\n\t\t\t\t\t\twptbUndo.classList.remove('wptb-undoredo-disabled');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// add or delete class \"wptb-undoredo-disabled\" for redo button\n\t\t\tlet wptbRedo = document.getElementsByClassName('wptb-redo');\n\t\t\tif (wptbRedo.length > 0) {\n\t\t\t\twptbRedo = wptbRedo[0];\n\n\t\t\t\tif (window.wptbTableStateNumberShow == window.wptbTableStateSaving.length - 1) {\n\t\t\t\t\tif (wptbRedo) {\n\t\t\t\t\t\twptbRedo.classList.add('wptb-undoredo-disabled');\n\t\t\t\t\t}\n\t\t\t\t} else if (window.wptbTableStateNumberShow < window.wptbTableStateSaving.length - 1) {\n\t\t\t\t\tif (wptbRedo) {\n\t\t\t\t\t\twptbRedo.classList.remove('wptb-undoredo-disabled');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// add or delete class \"wptb-save-disabled\" for save button\n\t\t\tlet wptbSaveBtn = document.getElementsByClassName('wptb-save-btn');\n\t\t\tif (wptbSaveBtn.length > 0) {\n\t\t\t\twptbSaveBtn = wptbSaveBtn[0];\n\t\t\t\tif (\n\t\t\t\t\t(!wptbSaveBtn.dataset.wptbTableStateNumberSave && window.wptbTableStateNumberShow == 0) ||\n\t\t\t\t\twindow.wptbTableStateNumberShow == wptbSaveBtn.dataset.wptbTableStateNumberSave\n\t\t\t\t) {\n\t\t\t\t\twptbSaveBtn.classList.add('wptb-save-disabled');\n\t\t\t\t\twptbSaveBtn.classList.remove('active');\n\t\t\t\t} else {\n\t\t\t\t\twptbSaveBtn.classList.add('active');\n\t\t\t\t\twptbSaveBtn.classList.remove('wptb-save-disabled');\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// load necessary saved table state\n\t\t\tlet wptbTableSetup = document.getElementsByClassName('wptb-table-setup');\n\t\t\tif (wptbTableSetup.length > 0) {\n\t\t\t\twptbTableSetup = wptbTableSetup[0];\n\n\t\t\t\t// wptbTableSetup.outerHTML = '';\n\t\t\t\tif (window.wptbTableStateSaving[window.wptbTableStateNumberShow]) {\n\t\t\t\t\tif (\n\t\t\t\t\t\twindow.wptbTableStateSaving[window.wptbTableStateNumberShow][0] &&\n\t\t\t\t\t\ttypeof window.wptbTableStateSaving[window.wptbTableStateNumberShow][0] === 'object'\n\t\t\t\t\t) {\n\t\t\t\t\t\tif ('outerHTML' in window.wptbTableStateSaving[window.wptbTableStateNumberShow][0]) {\n\t\t\t\t\t\t\twptbTableSetup.outerHTML =\n\t\t\t\t\t\t\t\twindow.wptbTableStateSaving[window.wptbTableStateNumberShow][0].outerHTML;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tconst wptbTableSetupNew = document.querySelector('.wptb-table-setup');\n\t\t\t\t\tif (wptbTableSetupNew && wptbTableSetupNew.children.length == 0) {\n\t\t\t\t\t\tdocument.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\n\t\t\t\t\t\twptbSaveBtn.classList.add('wptb-save-disabled');\n\t\t\t\t\t\twptbSaveBtn.classList.remove('active');\n\t\t\t\t\t} else {\n\t\t\t\t\t\tdocument.getElementsByClassName('wptb-table-generator')[0].style.display = 'none';\n\t\t\t\t\t}\n\n\t\t\t\t\t// add or change or delete style element in the head for table cells who have auto width\n\t\t\t\t\tconst { head } = document;\n\t\t\t\t\tif (head) {\n\t\t\t\t\t\tconst cssForTdsWidthAutoOld = head.querySelector('style[data-wptb-td-auto-width=\"true\"]');\n\t\t\t\t\t\tif (cssForTdsWidthAutoOld) {\n\t\t\t\t\t\t\thead.removeChild(cssForTdsWidthAutoOld);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (window.wptbTableStateSaving[window.wptbTableStateNumberShow][1]) {\n\t\t\t\t\t\t\tconst cssForTdsWidthAuto = document.createElement('style');\n\t\t\t\t\t\t\tcssForTdsWidthAuto.setAttribute('data-wptb-td-auto-width', true);\n\t\t\t\t\t\t\tcssForTdsWidthAuto.innerHTML =\n\t\t\t\t\t\t\t\twindow.wptbTableStateSaving[window.wptbTableStateNumberShow][1];\n\t\t\t\t\t\t\thead.appendChild(cssForTdsWidthAuto);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// change value of table title field\n\t\t\t\t\tconst wptbSetupName = document.getElementById('wptb-setup-name');\n\t\t\t\t\tif (typeof window.wptbTableStateSaving[window.wptbTableStateNumberShow][2] !== 'undefined') {\n\t\t\t\t\t\tif (wptbSetupName)\n\t\t\t\t\t\t\twptbSetupName.value = window.wptbTableStateSaving[window.wptbTableStateNumberShow][2];\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tlet body = document.getElementsByTagName('body');\n\t\t\t\tif (body.length > 0) {\n\t\t\t\t\tbody = body[0];\n\t\t\t\t}\n\n\t\t\t\tWPTB_Helper.elementOptionsPanelClear();\n\t\t\t\tWPTB_LeftPanel();\n\n\t\t\t\tconst wptbLeftScrollPanelCellSetting = document.getElementById('wptb-left-scroll-panel-cell-settings');\n\t\t\t\tif (wptbLeftScrollPanelCellSetting) {\n\t\t\t\t\twptbLeftScrollPanelCellSetting.classList.remove('visible');\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n\n\tthis.tableStateClear = function () {\n\t\tdelete window.wptbTableStateSaving;\n\t\tdelete window.wptbTableStateNumberShow;\n\n\t\tlet wptbSaveBtn = document.getElementsByClassName('wptb-save-btn');\n\t\tif (wptbSaveBtn.length > 0) {\n\t\t\twptbSaveBtn = wptbSaveBtn[0];\n\n\t\t\twptbSaveBtn.removeAttribute('data-wptb-table-state-number-save');\n\t\t}\n\n\t\tlet wptbUndo = document.getElementsByClassName('wptb-undo');\n\t\tif (wptbUndo.length > 0) {\n\t\t\twptbUndo = wptbUndo[0];\n\n\t\t\twptbUndo.classList.add('wptb-undoredo-disabled');\n\t\t}\n\n\t\tlet wptbRedo = document.getElementsByClassName('wptb-redo');\n\t\tif (wptbRedo.length > 0) {\n\t\t\twptbRedo = wptbRedo[0];\n\n\t\t\twptbRedo.classList.add('wptb-undoredo-disabled');\n\t\t}\n\t};\n};\n","var WPTB_innerElementSet = function ( element ) {\n \n element.ondragenter = function (e) {\n var div;\n if ( e.dataTransfer.types.indexOf( 'wptbelement' ) == -1 && e.dataTransfer.types.indexOf( 'wptb-moving-mode' ) == -1 ) {\n return;\n }\n WPTB_DropHandle(this, e);\n \n element.classList.add( 'wptb-ondragenter' );\n }\n element.ondragover = function (e) {\n e.preventDefault();\n WPTB_DropHandle(this, e);\n }\n element.ondragleave = function (e) {\n WPTB_DropHandle(this, e, true);\n\n }\n element.ondrop = function(e) {\n this.classList.remove( 'wptb-ondragenter' );\n let element, classId;\n e.preventDefault();\n e.stopPropagation();\n\n if (!e.dataTransfer.getData('wptbElement') && !e.dataTransfer.getData('node')) {\n return;\n }\n let wptbDropHandle,\n wptbDropBorderMarker;\n if ( document.getElementsByClassName( 'wptb-drop-handle' ).length > 0 ) {\n wptbDropHandle = document.getElementsByClassName( 'wptb-drop-handle' )[0];\n }\n if( document.getElementsByClassName( 'wptb-drop-border-marker' ).length > 0 ) {\n wptbDropBorderMarker = document.getElementsByClassName( 'wptb-drop-border-marker' )[0];\n }\n\n if ( e.dataTransfer.getData( 'wptbElement' ) ) {\n element = WPTB_Helper.newElementProxy( e.dataTransfer.getData( 'wptbElement' ) );\n element = element.getDOMElement();\n } else {\n classId = e.dataTransfer.getData( 'node' );\n element = document.getElementsByClassName( classId )[0];\n //element.classList.remove( 'wptb-moving-mode' );\n }\n\n if(WPTB_Helper.getDragRelativeType() === 'td_relative'){\n WPTB_DropHandle(this, e, true);\n const parentCell = WPTB_Helper.getParentOfType('td', e.target);\n\n parentCell.appendChild(element);\n WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);\n\n }else if( wptbDropHandle.style.display == 'block' ) {\n let td;\n if( wptbDropHandle.dataset.text == 'Drop Here' ) {\n td = wptbDropHandle.getDOMParentElement();\n td.appendChild( element );\n WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);\n } else {\n let innerElement = wptbDropHandle.getDOMParentElement();\n td = innerElement.parentNode;\n\n if( wptbDropHandle.dataset.text == 'Above Element' ) {\n td.insertBefore( element, innerElement );\n WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);\n } else if( wptbDropHandle.dataset.text == 'Below Element' ) {\n let innerElementNext = innerElement.nextSibling;\n td.insertBefore( element, innerElementNext );\n WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);\n }\n }\n \n let thisRow = td.parentNode;\n if( WPTB_Helper.rowIsTop( thisRow ) ) { \n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\n \n if( table.classList.contains( 'wptb-table-preview-head' ) ) {\n WPTB_Helper.dataTitleColumnSet( table );\n }\n }\n \n // start item javascript if item is new\n let infArr = element.className.match(/wptb-element-(.+)-(\\d+)/i);\n let elemKind = infArr[1];\n if ( e.dataTransfer.getData( 'wptbElement' ) && ( elemKind == 'text' || elemKind == 'button' || elemKind == 'image' || elemKind == 'star_rating' || elemKind == 'list' ) ) {\n //WPTB_Helper.elementStartScript( element );\n }\n } else {\n return;\n }\n\n if(wptbDropHandle){\n wptbDropHandle.style.display = 'none';\n wptbDropBorderMarker.style.display = 'none';\n }\n\n WPTB_innerElementSet( element );\n \n if( ! element.classList.contains( 'wptb-image-container' ) || element.classList.contains( 'wptb-moving-mode' ) ) {\n element.classList.remove( 'wptb-moving-mode' );\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n } \n return true;\n }\n element.onmouseover = function(e) {\n element.classList.remove( 'wptb-ondragenter' );\n }\n}","var applyGenericItemSettings = function ( element, kindIndexProt, copy = false ) {\n var node = element.getDOMElement(),\n index,\n copy;\n if( node.classList.contains( 'wptb-ph-element' ) ) {\n if ( kindIndexProt == undefined || copy == true ) {\n //index = document.counter.nextIndex( element.kind );\n let wptbElements = document.getElementsByClassName( 'wptb-ph-element' );\n let elementIndexesArr = [];\n for( let i = 0; i < wptbElements.length; i++ ) {\n var regex = new RegExp( 'wptb-element-' + element.kind + '-(\\\\d+)', \"i\" );\n let infArr = wptbElements[i].className.match( regex );\n if( infArr ) {\n elementIndexesArr.push( infArr[1] );\n }\n }\n if( elementIndexesArr.length > 0 ) {\n let elementIndexMax = Math.max( ...elementIndexesArr );\n index = elementIndexMax + 1;\n } else { \n index = 1;\n }\n\n if( copy ) {\n // change all data-elements which save parameters for different controls\n let wptbNodeattributes = [...node.attributes];\n for( let i = 0; i < wptbNodeattributes.length; i++ ) {\n if( wptbNodeattributes[i] && typeof wptbNodeattributes[i] === 'object' && wptbNodeattributes[i].nodeName ) {\n let regularText = new RegExp( 'data-wptb-el-' + element.kind + '-(\\\\d+)-([a-zA-Z0-9_-]+)', \"i\" );\n let attr = wptbNodeattributes[i].nodeName.match( regularText );\n if( attr && Array.isArray( attr ) ) {\n let newDataAttributeName = wptbNodeattributes[i].nodeName.replace( element.kind + '-' + attr[1], element.kind + '-' + index );\n let newDataAttributeValue = wptbNodeattributes[i].nodeValue;\n node.removeAttribute( wptbNodeattributes[i].nodeName );\n node.setAttribute( newDataAttributeName, newDataAttributeValue );\n }\n }\n }\n }\n } else if ( kindIndexProt && ! copy ) {\n let kindIndexProtArr = kindIndexProt.split('-');\n index = kindIndexProtArr[kindIndexProtArr.length - 1];\n // start element javascript if element is new\n \n }\n\n let node_wptb_element_kind_num = node.className.match(/wptb-element-(.+)-(\\d+)/i);\n if ( node_wptb_element_kind_num ) {\n node.classList.remove( node_wptb_element_kind_num[0] );\n }\n if ( ! node.classList.contains( 'wptb-ph-element' ) ) {\n node.classList.add( 'wptb-ph-element' );\n if( ! node.classList.contains( 'wptb-element-' + element.kind + '-' + index ) ) {\n node.classList.add( 'wptb-element-' + element.kind + '-' + index );\n }\n } else {\n if( ! node.classList.contains( 'wptb-element-' + element.kind + '-' + index ) ) {\n node.classList.add( 'wptb-element-' + element.kind + '-' + index );\n }\n }\n WPTB_Helper.elementStartScript( element.getDOMElement() );\n new WPTB_ElementOptions( element, index, kindIndexProt );\n document.counter.increment(element.kind);\n }\n \n node.onmouseenter = function ( event ) {\n if( event.target.classList.contains( 'wptb-moving-mode' ) ) {\n return;\n }\n \n let wptbActionsField = new WPTB_ActionsField();\n \n wptbActionsField.addActionField( 1, node );\n \n wptbActionsField.setParameters( node );\n \n node.classList.remove( 'wptb-ondragenter' );\n };\n \n node.onmouseleave = function ( event ) {\n let wptbActionsField = new WPTB_ActionsField();\n \n wptbActionsField.leaveFromField( event, node );\n };\n};"]}
|
inc/admin/js/admin.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},WPTB_ActionsField=function s(){var p=this;this.wptbActions,0!=document.getElementsByClassName("wptb-actions").length&&(this.wptbActions=document.getElementsByClassName("wptb-actions")[0]),this.addActionField=function(e,t){var a=document.getElementsByTagName("body")[0],n=document.getElementsByClassName("wptb-actions");if(0!=n.length){var r=n[0].activeElem;for(r&&r.classList.remove("wptb-directlyhovered");0!=n.length;)n[0].parentNode.removeChild(n[0])}if(1==e){var l=void 0,o=void 0;if(l=document.createElement("span"),o=document.createElement("span"),(n=document.createElement("div")).classList.add("wptb-actions"),l.classList.add("dashicons","dashicons-trash","wptb-delete-action"),o.classList.add("dashicons","dashicons-admin-page","wptb-duplicate-action"),n.appendChild(o),n.appendChild(l),a.appendChild(n),n.activeElem=t,n.type=1,l.onclick=function(e){var t=e.target.parentNode.activeElem,a=t.parentNode;t.className.match(/wptb-element-(.+)-(\d+)/i);if(t&&a.removeChild(t),t&&"object"===(void 0===t?"undefined":_typeof(t))&&t.hasOwnProperty("kind")&&"text"==t.kind){var n=a.parentNode;if(WPTB_Helper.rowIsTop(n)){var r=WPTB_Helper.findAncestor(n,"wptb-preview-table");r.classList.contains("wptb-table-preview-head")&&WPTB_Helper.dataTitleColumnSet(r)}}(new s).actionsRemove(),(new WPTB_TableStateSaveManager).tableStateSet(),WPTB_Helper.wptbDocumentEventGenerate("element:removed:dom",document,t)},o.onclick=function(e){var t,a=void 0,n=void 0,r=e.target.parentNode.activeElem,l=r.parentNode;if((t=r.className.match(/wptb-element-(.+)-(\d+)/i))&&Array.isArray(t)){n=t[1];var o={};o.kind=n,o.elemProt=r,o.tinyMceClear=!0,a=new WPTB_ElementObject(o),l.insertBefore(a.getDOMElement(),r.nextSibling)}else{a={};var i=r.cloneNode(!0);i.classList.remove("wptb-directlyhovered"),a.getDOMElement=function(){return i},applyGenericItemSettings(a),l.insertBefore(a.getDOMElement(),r.nextSibling),WPTB_Helper.wptbDocumentEventGenerate("wptb-inner-element:copy",r,a.getDOMElement())}WPTB_innerElementSet(a.getDOMElement()),new s(1,r).setParameters(r),(new WPTB_TableStateSaveManager).tableStateSet()},t.classList.contains("wptb-ph-element")){var i=void 0;(i=document.createElement("span")).classList.add("dashicons","dashicons-move","wptb-move-action"),i.draggable=!0,n.appendChild(i),i.ondragstart=function(e){var t,a=wp.template("wptb-element-icons-directories")({}),n=JSON.parse(a),r=void 0,l=e.target.parentNode.activeElem,o=void 0;if((t=l.className.match(/wptb-element-(.+)-(\d+)/i))&&Array.isArray(t)){o=t[1],l.classList.add("wptb-moving-mode"),n&&"object"===(void 0===n?"undefined":_typeof(n))&&n[o]&&(r=WPTB_Helper.getElementIcon(n[o])),e.dataTransfer.effectAllowed="move",e.dataTransfer.setDragImage(r,0,0),e.dataTransfer.setData("node","wptb-element-"+t[1]+"-"+t[2]),e.dataTransfer.setData("wptb-moving-mode","wptb-element-"+t[1]+"-"+t[2]),e.dataTransfer.setData("wptbElIndic-"+t[1],"wptbElIndic-"+t[1]);var i=e.target.parentNode.activeElem;if("text"==i.kind){var s=i.parentNode.parentNode;if(WPTB_Helper.rowIsTop(s)){var d=WPTB_Helper.findAncestor(s,"wptb-preview-table");d.classList.contains("wptb-table-preview-head")&&WPTB_Helper.dataTitleColumnSet(d)}}}else p.style.display="none";p.actionsHide()},i.ondragend=function(e){WPTB_Helper.elementDragEndClear()}}n.style.display="flex",p.wptbActions=n}WPTB_Helper.wptbDocumentEventGenerate("wptb:actionfield:generated",document)},this.setParameters=function(t){if(!p.wptbActions){var e=document.getElementsByClassName("wptb-actions");0<e.length?p.wptbActions=e[0]:p.wptbActions=!1}if(p.wptbActions&&p.wptbActions.classList.contains("wptb-actions")){p.wptbActions.style.display="flex";var a=t.getBoundingClientRect(),n=document.getElementsByClassName("wptb-container")[0],r=function(){var e=t.getBoundingClientRect();p.wptbActions.style.top=parseFloat(e.top)-15+"px"};n.removeEventListener("scroll",r,!1),p.wptbActions.style.top=parseFloat(a.top)-15+"px",p.wptbActions.style.left=parseFloat(a.right)-parseFloat(p.wptbActions.clientWidth)+1+"px",p.wptbActions.style.display="flex",t.classList.add("wptb-directlyhovered"),n.addEventListener("scroll",r,!1)}},this.leaveFromField=function(e,t,a){if(!p.wptbActions){var n=document.getElementsByClassName("wptb-actions");0<n.length?p.wptbActions=n[0]:p.wptbActions=!1}if(p.wptbActions){if(e.relatedTarget&&(e.relatedTarget.classList.contains("wptb-actions")||e.relatedTarget.classList.contains("wptb-move-action")||e.relatedTarget.classList.contains("wptb-duplicate-action")||e.relatedTarget.classList.contains("wptb-delete-action")||e.relatedTarget.classList.contains("wptb-prebuilt-mark-action")))return p.wptbActions||(p.wptbActions=document.getElementsByClassName("wptb-actions")[0]),void(p.wptbActions.onmouseleave=function(e){null!=e.relatedTarget&&(e.relatedTarget.classList.contains("wptb-ph-element")||WPTB_Helper.findAncestor(e.relatedTarget,"wptb-ph-element"))&&e.relatedTarget!=p.wptbActions.activeElem&&(WPTB_Helper.findAncestor(e.relatedTarget,"wptb-directlyhovered"),p.wptbActions.activeElem),(new s).leaveFromField(e,e.relatedTarget.parentNode.parentNode),e.target.activeElem.classList.remove("wptb-directlyhovered")});t.classList.remove("wptb-directlyhovered"),p.wptbActions.style.display="none",e.relatedTarget&&(e.relatedTarget.classList.contains("wptb-ph-element")||WPTB_Helper.findAncestor(e.relatedTarget,"wptb-ph-element"))&&(p.addActionField(1,e.relatedTarget.parentNode),p.setParameters(e.relatedTarget.parentNode))}},this.actionsRemove=function(){if(!p.wptbActions){var e=document.getElementsByClassName("wptb-actions");0<e.length&&(p.wptbActions=e[0])}p.wptbActions&&p.wptbActions.parentNode.removeChild(p.wptbActions)},this.actionsHide=function(){if(!p.wptbActions){var e=document.getElementsByClassName("wptb-actions");0<e.length&&(p.wptbActions=e[0])}p.wptbActions&&(p.wptbActions.style.opacity=0)}};!function(){var e=window.location.href;new RegExp("[?&]page=wptb-builder").exec(e)&&document.addEventListener("DOMContentLoaded",function(){var r=WPTB_Helper.detectMode();if(r){var l=new XMLHttpRequest,e=ajaxurl+"?action=get_table&id="+r;l.open("GET",e,!0),l.setRequestHeader("Content-type","application/x-www-form-urlencoded"),l.onreadystatechange=function(e){if(4!=this.readyState||200!=this.status);else{var t=JSON.parse(l.responseText);if(document.getElementById("wptb-setup-name").value=t[0],t[1]){var a=document.getElementsByClassName("wptb-table-setup")[0];a.appendChild(WPTB_Parser(t[1])),document.getElementsByTagName("body")[0],WPTB_Table();var n=document.querySelector(".wptb-preview-table");n&&(n.className.match(/wptb-element-((.+-)\d+)/i)||n.classList.add("wptb-element-main-table_setting-"+r),n.dataset.wptbTableContainerMaxWidth&&(a.style.maxWidth=n.dataset.wptbTableContainerMaxWidth+"px",n.tdDefaultWidth())),WPTB_Settings(),(new WPTB_TableStateSaveManager).tableStateSet()}else document.getElementsByClassName("wptb-table-generator")[0].style.display="table"}},l.send(null)}else(new WPTB_TableStateSaveManager).tableStateSet();document.counter=new ElementCounters,document.select=new MultipleSelect;WPTB_Initializer();settings=WPTB_Settings()})}();var WPTB_Cell=function(e,n){if(!n){(n=document.createElement("td")).style.padding=jQuery("#wptb-table-padding-number").val()+"px";var t=jQuery("#wptb-table-inner-border-number").val();""!=t&&0!=parseInt(t)&&(n.style.border=t+"px solid "+jQuery("#wptb-table-border-color").val()),n.classList.add("wptb-droppable","wptb-cell")}n.draggable=!1,e&&(n.onclick=e),n.ondblclick=function(e){e.stopPropagation();var t=document.querySelector(".wptb-table-setup");if(t&&!t.classList.contains("wptb-preview-table-manage-cells")&&("0"!==e.target.dataset.yIndex||"1"!==t.dataset.wptbSortableTable)&&e.target==e.currentTarget){WPTB_Helper.wptbDocumentEventGenerate("table:cell:dblclick",e.target);var a=WPTB_Helper.newElementProxy("text");a=a.getDOMElement(),n.appendChild(a),WPTB_innerElementSet(a)}},WPTB_innerElementSet(n),WPTB_Helper.elementStartScript(n,"table_cell_setting");var o=n.getElementsByClassName("wptb-ph-element");if(0<o.length)for(var a=function(r){o[r].getDOMElement=function(){return o[r]},WPTB_innerElementSet(o[r]);var l=o[r].className.match(/wptb-element-((.+-)\d+)/i);l&&Array.isArray(l)&&function(){var e=l[1].split("-");o[r].kind=e[0],applyGenericItemSettings(o[r],l[1]);var a=o[r].getElementsByClassName("wptb-in-element");if(0<a.length)for(var t=function(e){var t={getDOMElement:function(){return a[e]}};applyGenericItemSettings(t)},n=0;n<a.length;n++)t(n)}()},r=0;r<o.length;r++)a(r);return this.getDOMElement=function(){return n},this.setCoords=function(e,t){var a=this.getDOMElement();a.dataset.yIndex=e,a.dataset.xIndex=t},this.getCoords=function(){var e,t=this.getDOMElement();return e.x=t.dataset.xIndex,e.y=t.dataset.yIndex,e},this.appendElement=function(e){getDOMElement().appendChild(e)},n.getCellDimensions=function(){var e=window.getComputedStyle(this,null),t=e.getPropertyValue("padding-left"),a=e.getPropertyValue("padding-right"),n=e.getPropertyValue("border-left-width"),r=e.getPropertyValue("border-right-width"),l=e.getPropertyValue("padding-top"),o=e.getPropertyValue("padding-bottom"),i=e.getPropertyValue("border-top-width"),s=e.getPropertyValue("border-bottom-width"),d=parseInt(this.offsetWidth,10)-parseInt(t,10)-parseInt(a,10),p=parseInt(this.offsetHeight,10)-parseInt(l,10)-parseInt(o,10),c=WPTB_Helper.findAncestor(this,"wptb-preview-table");if(c)if("collapse"===c.style.borderCollapse){d=d-parseInt(n,10)/2-parseInt(r,10)/2,p=p-parseInt(i,10)/2-parseInt(s,10)/2;var m=window.getComputedStyle(c,null),u=m.getPropertyValue("border-left-width"),b=m.getPropertyValue("border-right-width"),v=m.getPropertyValue("border-top-width"),w=m.getPropertyValue("border-bottom-width"),g=this.parentNode;if(g&&"tr"===g.nodeName.toLowerCase()){g.firstChild&&g.firstChild.dataset.xIndex===this.dataset.xIndex&&parseInt(u,10)>parseInt(n,10)&&(d+=-(parseInt(u,10)-parseInt(n,10))/2),g.lastChild&&g.lastChild.dataset.xIndex===this.dataset.xIndex&&parseInt(b,10)>parseInt(r,10)&&(d+=-(parseInt(b,10)-parseInt(r,10))/2);var f=g.parentNode;f&&"body"===f.nodeName.toLowerCase()&&(f.firstChild&&f.firstChild.firstChild.dataset.yIndex===this.dataset.yIndex&&parseInt(v,10)>parseInt(i,10)&&(p+=(parseInt(v,10)-parseInt(i,10))/2),f.lastChild&&f.lastChild.firstChild.dataset.yIndex===this.dataset.yIndex&&parseInt(w,10)>parseInt(s,10)&&(p+=(parseInt(w,10)-parseInt(s,10))/2))}}else"separate"===c.style.borderCollapse&&(d=d-parseInt(n,10)-parseInt(r,10),p=p-parseInt(i,10)-parseInt(s,10));return{width:parseInt(d),height:parseInt(p)}},this};function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,a=Array(e.length);t<e.length;t++)a[t]=e[t];return a}return Array.from(e)}var WPTB_CutGlueTable={cutTableHorizontally:function(e,t){if(t&&t.rows[e])for(var a=0;a<e;a++)for(var n=t.rows[a].children,r=0;r<n.length;r++)if(1<n[r].rowSpan&&n[r].rowSpan>e-a){var l=n[r].rowSpan-e+a;n[r].rowSpan=e-a,n[r].dataset.sameCellBeforeDivision||(n[r].dataset.sameCellBeforeDivision="r"+a+"c"+r);var o=new WPTB_Cell(t.mark),i=n[r].getAttribute("style");o.getDOMElement().setAttribute("style",i),o.getDOMElement().colSpan=n[r].colSpan,o.getDOMElement().rowSpan=l,o.getDOMElement().dataset.sameCellBeforeDivision=n[r].dataset.sameCellBeforeDivision;for(var s=n[r].dataset.xIndex,d=parseInt(s)+parseInt(n[r].colSpan),p=void 0;!p&&d<t.maxCols;)p=t.rows[e].querySelector('[data-x-index="'+d+'"]'),d++;t.rows[e].insertBefore(o.getDOMElement(),p),t.recalculateIndexes()}},glueTableHorizontally:function(e){if(e){for(var t=[].concat(_toConsumableArray(e.getElementsByTagName("td"))),a=0;a<t.length;a++)if(t[a].hasAttribute("data-same-cell-before-division"))for(var n=t[a].dataset.sameCellBeforeDivision,r=e.querySelectorAll('[data-same-cell-before-division="'+n+'"]'),l=0;l<r.length;l++)if(r[l]&&r[l+1]&&r[l].parentNode&&r[l+1].parentNode&&!r[l].parentNode.classList.contains("wptb-row-moving")&&!r[l+1].parentNode.classList.contains("wptb-row-moving")&&r[l+1].dataset.yIndex==parseInt(r[l].dataset.yIndex)+parseInt(r[l].rowSpan)){r[l].rowSpan+=r[l+1].rowSpan;for(var o=[].concat(_toConsumableArray(r[l+1].children)),i=0;i<o.length;i++)r[l].appendChild(o[i]);r[l+1].parentNode.removeChild(r[l+1])}e.recalculateIndexes()}},cutTableVertically:function(e,t){for(var a=0;a<t.rows.length;a++){if(e<t.maxCols&&0!=e&&!t.rows[a].querySelector('[data-x-index="'+e+'"]'))for(var n=t.rows[a].children,r=void 0,l=n.length,o=void 0,i=void 0,s=void 0,d=void 0,p=0;p<l;p++)if(1<n[p].colSpan&&parseInt(n[p].dataset.xIndex)<e&&parseInt(n[p].dataset.xIndex)+parseInt(n[p].colSpan)>e){r=new WPTB_Cell(t.mark),i=n[p].rowSpan,s=n[p].colSpan,n[p].colSpan=e-n[p].dataset.xIndex,d=s-n[p].colSpan,n[p].dataset.sameCellBeforeDivision||(n[p].dataset.sameCellBeforeDivision="r"+a+"c"+p);var c=n[p].getAttribute("style");r.getDOMElement().setAttribute("style",c);var m=t.querySelector('[data-x-index="'+e+'"]');m&&(r.getDOMElement().style.width=m.style.width);var u=t.querySelector('[data-y-index="'+a+'"]');u&&(r.getDOMElement().style.height=u.style.height),o=n[p+1]?n[p+1]:null,t.rows[a].insertBefore(r.getDOMElement(),o),r.getDOMElement().colSpan=d,r.getDOMElement().rowSpan=i,r.getDOMElement().dataset.sameCellBeforeDivision=n[p].dataset.sameCellBeforeDivision,a+=i-1;break}t.recalculateIndexes()}},glueTableVertically:function(e){if(e){for(var t=[].concat(_toConsumableArray(e.getElementsByTagName("td"))),a=0;a<t.length;a++)if(t[a].hasAttribute("data-same-cell-before-division"))for(var n=t[a].dataset.sameCellBeforeDivision,r=[].concat(_toConsumableArray(e.querySelectorAll('[data-same-cell-before-division="'+n+'"]'))),l=null,o=0;o<r.length;o++)if(r[o]&&r[o+1]&&!r[o].classList.contains("wptb-column-moving")&&!r[o+1].classList.contains("wptb-column-moving")&&r[o+1].dataset.xIndex==parseInt(r[o].dataset.xIndex)+parseInt(r[o].colSpan)){null==l&&(l=o),r[l].colSpan+=r[o+1].colSpan;for(var i=[].concat(_toConsumableArray(r[o+1].children)),s=0;s<i.length;s++)r[l].appendChild(i[s]);r[o+1].parentNode.removeChild(r[o+1])}e.recalculateIndexes()}}},WPTB_DropHandle=function(i,e){var t=2<arguments.length&&void 0!==arguments[2]&&arguments[2],s=void 0,d=void 0,a=void 0,n=void 0,r=void 0,l=void 0;function o(e){return e+"px"}if("td_relative"===WPTB_Helper.getDragRelativeType()){var p=document.querySelector(".wptb-cell-related-drop-handle");if(t&&p)return void(p.style.display="none");if(null===p){var c=document.createRange();c.setStart(document.body,0);var m=c.createContextualFragment('<div class="wptb-cell-related-drop-handle">Add to cell</div>').children[0];document.body.appendChild(m),p=m.children[0]}var u=WPTB_Helper.getParentOfType("td",i).getBoundingClientRect(),b=u.top,v=u.left,w=u.width,g=u.height;if(!p)return;return p.style.display="flex",p.style.top=o(b),p.style.width=o(w),p.style.height=o(g),void(p.style.left=o(v))}if(0==document.getElementsByClassName("wptb-drop-handle").length){(s=document.createElement("div")).classList.add("wptb-drop-handle"),(d=document.createElement("div")).classList.add("wptb-drop-border-marker"),a=document.createElement("div"),n=document.createElement("div"),r=document.createElement("div"),l=document.createElement("div"),a.classList.add("wptb-drop-border-marker-top"),n.classList.add("wptb-drop-border-marker-right"),r.classList.add("wptb-drop-border-marker-bottom"),l.classList.add("wptb-drop-border-marker-left"),d.appendChild(a),d.appendChild(n),d.appendChild(r),d.appendChild(l);var f=document.getElementsByTagName("body");0<f.length&&(f[0].appendChild(s),f[0].appendChild(d)),s.ondragenter=function(){if(e.target.classList.contains("wptb-empty"))return e.preventDefault(),!1},s.ondragover=function(e){e.preventDefault()},s.ondragleave=function(){},s.ondrop=function(e){e.preventDefault();var t=void 0;e.dataTransfer.getData("wptbElement")?t=(t=WPTB_Helper.newElementProxy(e.dataTransfer.getData("wptbElement"))).getDOMElement():((t=document.getElementsByClassName(e.dataTransfer.getData("node"))[0]).classList.remove("wptb-moving-mode"),t.classList.remove("wptb-moving-into-same-elem"),t.wptbMovingMode=1);var a=void 0;if("Drop Here"==s.dataset.text)"td"==(i=s.getDOMParentElement()).nodeName.toLowerCase()&&((a=s.getDOMParentElement()).appendChild(t),WPTB_Helper.wptbDocumentEventGenerate("element:mounted:dom",t));else{var n=s.getDOMParentElement();if(a=n.parentNode,"Above Element"==s.dataset.text)a.insertBefore(t,n),WPTB_Helper.wptbDocumentEventGenerate("element:mounted:dom",t);else if("Below Element"==s.dataset.text){var r=n.nextSibling;a.insertBefore(t,r),WPTB_Helper.wptbDocumentEventGenerate("element:mounted:dom",t)}}var l=a.parentNode;if(WPTB_Helper.rowIsTop(l)){var o=WPTB_Helper.findAncestor(l,"wptb-preview-table");o.classList.contains("wptb-table-preview-head")&&WPTB_Helper.dataTitleColumnSet(o)}(s.style.display="none",d.style.display="none",WPTB_innerElementSet(t),t.classList.contains("wptb-image-container")&&1!=t.wptbMovingMode)||((new WPTB_TableStateSaveManager).tableStateSet(),t.wptbMovingMode)},document.querySelector(".wptb-container").onscroll=function(){s.style.display="none",d.style.display="none"}}else s=document.getElementsByClassName("wptb-drop-handle")[0],d=document.getElementsByClassName("wptb-drop-border-marker")[0];if(!(i&&"td"==i.nodeName.toLowerCase()&&0!=i.getElementsByClassName("wptb-ph-element").length||i&&"td"==i.nodeName.toLowerCase()&&i.classList.contains("wptb-empty"))){var h=void 0;if("td"==i.localName?h=i.parentNode:"div"==i.localName&&i.classList.contains("wptb-ph-element")&&(h=i.parentNode.parentNode),WPTB_Helper.rowIsTop(h))if(WPTB_Helper.findAncestor(h,"wptb-preview-table").classList.contains("wptb-table-preview-head")){for(var y=e.dataTransfer.types,S=!1,T=0;T<y.length;T++){var C=y[T].match(/wptbelindic-([a-z]+)/i);if(C&&"text"!=C[1]){S=!0;break}}if(S)return}s.style.width=i.offsetWidth+"px";var B=i.offsetHeight,E=i.getBoundingClientRect(),_=parseFloat(E.left),A=void 0;if(s.style.left=_+"px",-1!=e.dataTransfer.types.indexOf("wptb-moving-mode")){var x=document.getElementsByClassName("wptb-moving-mode")[0];i==x?(s.classList.add("wptb-moving-into-same-elem"),d.classList.add("wptb-moving-into-same-elem")):(s.classList.remove("wptb-moving-into-same-elem"),d.classList.remove("wptb-moving-into-same-elem"))}if(s.getDOMParentElement=function(){return i},s.style.display="block",d.style.display="block","td"!=i.nodeName.toLowerCase()){var P=null==e.offsetY?e.layerY:e.offsetY;A=parseFloat(E.top)-parseFloat(11),s.dataset.text="Above Element",B/2<P&&(A=parseFloat(E.top)+B-1,s.dataset.text="Below Element")}else s.dataset.text="Drop Here",A=parseFloat(E.top)+B/2-5;s.style.top=A+"px",d.style.top=E.top+"px",d.style.left=E.left+"px",(a=d.querySelector(".wptb-drop-border-marker-top")).style.width=parseFloat(i.offsetWidth)-parseFloat(1)+"px",(n=d.querySelector(".wptb-drop-border-marker-right")).style.height=parseFloat(E.bottom)-parseFloat(E.top)-1+"px",n.style.left=a.style.width,(r=d.querySelector(".wptb-drop-border-marker-bottom")).style.width=a.style.width,r.style.top=n.style.height,(l=d.querySelector(".wptb-drop-border-marker-left")).style.height=n.style.height}},ElementCounters=function(){var t=[];return t.text=0,t.image=0,t.list=0,t.button=0,this.increment=function(e){e in t&&t[e]++},this.nextIndex=function(e){if(e in t)return t[e]+1},this},WPTB_ElementObject=function(e){var t=void 0,a=void 0,n=void 0;if(e.elemProt){(t=e.elemProt.cloneNode(!0)).classList.remove("wptb-directlyhovered");var r=e.elemProt.className.match(/wptb-element-((.+-)\d+)/i);r&&Array.isArray(r)&&(a=r[1]),n=!0,e.tinyMceClear&&(t=WPTB_Helper.elementClearFromTinyMce(t))}else{a=void 0,n=!1,(t=document.createElement("div")).classList.add("wptb-"+e.kind+"-container","wptb-ph-element");var l="wptb-"+e.kind+"-content",o=wp.template(l);e.node=t;var i=o(e);i=i.replace(/\r|\n|\t/g,"").trim(),t.innerHTML=i}var s=t.querySelectorAll(".wptb-in-element");if(0<s.length)for(var d=function(e){var t={getDOMElement:function(){return s[e]}};applyGenericItemSettings(t)},p=0;p<s.length;p++)d(p);return window.addEventListener("item:onmouseenter",function(e){},!1),this.kind=e.kind,this.getDOMElement=function(){return t},applyGenericItemSettings(this,a,n),this},WPTB_ElementOptions=function(e,t,a){e.getDOMElement().addEventListener("click",function(){WPTB_Helper.elementOptionsSet(e.kind,this)},{capture:!0})},WPTB_HeaderToolbox=function(e){var a=this;this.wrapperQuery=e,this.element=document.querySelector(e),this.topMargin=2;return{init:function(){var e;(e=a.element.querySelector('[data-button-type="table_settings_menu"]'))&&e.addEventListener("click",function(){WPTB_Helper.activateSection("manage_cells")}),document.addEventListener("wptb:table:generated",function(){a.element.style.display="unset";var e=a.element.getBoundingClientRect().width;a.element.style.left="calc( 50% - "+e/2+"px)",document.addEventListener("wptbSectionChanged",function(e){var t=e.detail;!function(){var e=0<arguments.length&&void 0!==arguments[0]&&arguments[0],t=a.element.getBoundingClientRect().height;e&&(t=0),a.element.style.top="calc( 100% - "+(t+a.topMargin)+"px)"}("manage_cells"!==t&&"table_responsive_menu"!==t&&"cell_settings"!==t)})})}}};_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,a=Array(e.length);t<e.length;t++)a[t]=e[t];return a}return Array.from(e)}var WPTB_Helper={hexToRgb:function(e){var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?"rgb("+parseInt(t[1],16)+","+parseInt(t[2],16)+","+parseInt(t[3],16)+")":null},rgbToHex:function(e){if(e){if(WPTB_Helper.isHex(e))return e;var t=e.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?((?:[0-9]*[.])?[0-9]+)[\s+]?\)/i);return t&&5===t.length?"#"+("0"+Math.round(255*parseFloat(t[4],10)).toString(16).toUpperCase()).slice(-2)+("0"+parseInt(t[1],10).toString(16).toUpperCase()).slice(-2)+("0"+parseInt(t[2],10).toString(16).toUpperCase()).slice(-2)+("0"+parseInt(t[3],10).toString(16).toUpperCase()).slice(-2):(t=e.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i))&&4===t.length?"#"+("0"+parseInt(t[1],10).toString(16).toUpperCase()).slice(-2)+("0"+parseInt(t[2],10).toString(16).toUpperCase()).slice(-2)+("0"+parseInt(t[3],10).toString(16).toUpperCase()).slice(-2):""}return""},isHex:function(e){return new RegExp("^#(?:[A-Fa-f0-9]{3}){1,2}$").test(e)},getElementIcon:function(e){location.protocol,location.hostname;var t=document.createElement("img");return t.src=e,t},elementDragEndClear:function(){var e=document.getElementsByClassName("wptb-moving-mode");if(0<e.length)for(var t=0;t<e.length;t++)e[t].classList.remove("wptb-moving-mode");var a=document.getElementsByClassName("wptb-drop-handle");if(0<a.length)for(var n=0;n<a.length;n++)a[n].style.display="none";var r=document.getElementsByClassName("wptb-drop-border-marker");if(0<r.length)for(var l=0;l<r.length;l++)r[l].style.display="none"},linkHttpCheckChange:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];if(e){if(e.match(/^(javascript:)(.+)$/))return e;if(e.match(/^\/([\S]+)$/)){if(t){var a=document.location.origin;return a.match(/^(.+)\/$/)&&(a=a.slice(-1)),""+a+e}return e}if(-1!=e.indexOf("http://")||-1!=e.indexOf("https://"))return e;var n=e.split("/"),r=void 0;return Array.isArray(n)&&0<n.length&&(r=n[n.length-1]),document.location.protocol+"//"+r}return""},dataTitleColumnSet:function(e){},findAncestor:function(e,t){for(;(e=e.parentElement)&&!e.classList.contains(t););return e},rowIsTop:function(e){return e.parentNode.children[0]==e},getSelectionText:function(){return window.getSelection?window.getSelection().toString():document.selection.createRange().text},elementOptionsPanelClear:function(){var e=document.getElementById("element-options-group");e&&(e.innerHTML="")},wpColorPickerCheckChangeForTableStateSaving:function(e){if("external"==e.originalEvent.type)(new WPTB_TableStateSaveManager).tableStateSet();else if(WPTB_Helper.findAncestor(e.target,"wp-picker-container")&&("square"==e.originalEvent.type||"strip"==e.originalEvent.type)){var t=document.getElementsByTagName("body")[0];t.removeEventListener("mouseup",WPTB_Helper.irisStripMouseUpStateSaveManager,!1),t.addEventListener("mouseup",WPTB_Helper.irisStripMouseUpStateSaveManager,!1)}},irisStripMouseUpStateSaveManager:function(){(new WPTB_TableStateSaveManager).tableStateSet(),document.getElementsByTagName("body")[0].removeEventListener("mouseup",WPTB_Helper.irisStripMouseUpStateSaveManager,!1)},wpColorPickerClear:function(e,t){var a=void 0;t?(a=[document.getElementById(e)]).length=1:a=document.getElementsByClassName(e);for(var n=0;n<a.length;n++){var r=WPTB_Helper.findAncestor(a[n],"wp-picker-container");if(r){var l=r.parentNode;l.removeChild(r);var o=document.createElement("input");t?o.setAttribute("id",e):o.classList.add("wptb-element-property",e),o.value="",l.appendChild(o)}}},detectMode:function(){var e=window.location.href,t=new RegExp("[?&]table(=([^&#]*)|&|#|$)").exec(e);return!!t&&(t[2]?decodeURIComponent(t[2].replace(/\+/g," ")):"")},getTableId:function(){var e=WPTB_Helper.detectMode();return e||(e="startedid-0"),e},getColumnWidth:function(e,t){for(var a=t.dataset.xIndex,n=e.querySelectorAll('[data-x-index="'+a+'"]'),r=t.getCellDimensions().width,l=0;l<n.length;l++)r>n[l].getCellDimensions().width&&(r=n[l].getCellDimensions().width);return r},getRowHeight:function(e,t){for(var a=t.dataset.yIndex,n=e.querySelectorAll('[data-y-index="'+a+'"]'),r=t.getCellDimensions().height,l=0;l<n.length;l++)r>n[l].getCellDimensions().height&&(r=n[l].getCellDimensions().height);return r},newElementProxy:function(e){if(e)return new WPTB_ElementObject({kind:e})},wpColorPickerChange:function(e,t){var a=void 0;a=t?t.color.toString():"";var n,r,l,o=WPTB_Helper.findAncestor(e.target,"wp-picker-input-wrap").getElementsByClassName("wptb-color-picker")[0];r=(n=o.dataset.element.match(/wptb-options-(.+)-(\d+)/i))[1],l=n[2];var i=document.getElementsByClassName("wptb-element-"+r+"-"+l)[0];if("button"==r)"button-text-color"==o.dataset.type?i.getElementsByClassName("wptb-button")[0].style.color=a:i.getElementsByClassName("wptb-button")[0].style.backgroundColor=a;else if("list"==r){var s=i.querySelectorAll("p");if(0<s.length)for(var d=0;d<s.length;d++)s[d].style.color=a}else if("star_rating"==r){if("star-color"==o.dataset.type)for(var p=i.querySelectorAll("li"),c=0;c<p.length;c++)for(var m=p[c].getElementsByTagName("span"),u=0;u<m.length;u++)m[u].style.fill=a;else if("numeral-rating-color"==o.dataset.type){i.querySelector(".wptb-number-rating").style.color=a}}else i.style.color=a},numberImputSize:function(e,t,a){e.onkeydown=function(){var e=this.value;0==(e=String(e))[0]?this.value="":(e=e.substring(0,t),this.value=e)},e.onkeyup=function(){var e=this.value;parseInt(e,10)>parseInt(a,10)&&(this.value=a),(new WPTB_TableStateSaveManager).tableStateSet()}},ucfirst:function(e){return e.charAt(0).toUpperCase()+e.slice(1)},wptbDocumentEventGenerate:function(e,t,a){if(e&&t){a||(a=!0);var n=new CustomEvent(e,{detail:a,bubbles:!0});t.dispatchEvent(n)}},elementStartScript:function(e,t){if(!t){var a=e.className.match(/wptb-element-(.+)-(\d+)/i);a&&Array.isArray(a)&&(t=a[1])}t&&t in WPTB_ElementsScriptsLauncher&&WPTB_ElementsScriptsLauncher[t](e)},deleteEventHandlers:function(e){if(e){jQuery(e).off();var t=e.children;if(t)for(var a=0;a<t.length;a++)WPTB_Helper.deleteEventHandlers(t[a])}},replaceAll:function(e,t,a){return e.split(t).join(a)},elementClearFromTinyMce:function(e){var t=e.querySelectorAll(".mce-content-body");if(0<t.length)for(var a=0;a<t.length;a++)t[a].classList.remove("mce-content-body");var n=e.querySelectorAll("[data-mce-style]");if(0<n.length)for(var r=0;r<n.length;r++)n[r].removeAttribute("data-mce-style");var l=e.querySelectorAll(".mce-edit-focus");if(0<l.length)for(var o=0;o<l.length;o++)l[o].classList.remove("mce-edit-focus");var i=e.querySelectorAll("[contenteditable]");if(0<i.length)for(var s=0;s<i.length;s++)i[s].removeAttribute("contenteditable");var d=e.querySelectorAll("[spellcheck]");if(0<d.length)for(var p=0;p<d.length;p++)d[p].removeAttribute("spellcheck");var c=e.querySelectorAll("[id^=mce_]");if(0<c.length)for(var m=0;m<c.length;m++)c[m].removeAttribute("id");return e},elementOptionContainerCustomClassSet:function(e,t){if(e&&t){var a=WPTB_Helper.findAncestor(e,"wptb-element-option");a&&a.classList.add(t)}},elementOptionContainerAdditionalStyles:function(e,t){if(e&&t){var a=WPTB_Helper.findAncestor(e,"wptb-element-option"),n=t.split(";");if(a&&n){var r=function(e,t){e&&(containerStyleStrArr=e.split(":"),containerStyleStrArr&&Array.isArray(containerStyleStrArr)&&(t.style[containerStyleStrArr[0]]=containerStyleStrArr[1]))};if(n&&Array.isArray(n))for(var l=0;l<n.length;l++)n[l]&&r(n[l],a);else r(n,a)}}},controlsInclude:function(i,s){var d=2<arguments.length&&void 0!==arguments[2]&&arguments[2];i&&"object"===(void 0===i?"undefined":_typeof(i))&&"function"==typeof s&&i.addEventListener("element:controls:active",function(){i.hasOwnProperty("controlConnectFunctionsName")&&Array.isArray(i.controlConnectFunctionsName)&&-1!=i.controlConnectFunctionsName.indexOf(s.name)||function(){var e=i.className.match(/wptb-element-(.+)-(\d+)/i),a=void 0;if(e&&Array.isArray(e)&&(a=e[1]),a){var t=i.optionsGroupIds;if(t&&Array.isArray(t))for(var n=0;n<t.length;n++){var r=t[n],l=document.getElementById(r).querySelectorAll(".wptb-element-property");(l=[].concat(_toConsumableArray(l))).map(function(e){var t=new RegExp("wptb-el-"+a+"-(\\d+)-([a-zA-Z0-9_-]+)","i"),l=e.className.match(t);if(l&&Array.isArray(l)){var o=l[0];i.addEventListener("wptb-control:"+o,function(e){var t={},a=l[2],n=document.getElementsByClassName(o);if(0<n.length&&a){var r=WPTB_Helper.targetControlValueGet(n);t[a]=d?{targetValue:r,eventValue:e.detail.value}:r}s(t,i)},!1)}})}i.controlConnectFunctionsName||Array.isArray(i.controlConnectFunctionsName)||(i.controlConnectFunctionsName=[]),i.controlConnectFunctionsName.push(s.name)}}()},!1)},oneControlInclude:function(n,r,e){if(!n||"object"!==(void 0===n?"undefined":_typeof(n))||"function"!=typeof r||"string"!=typeof e)return!1;var t=n.className.match(/wptb-element-((.+-)\d+)/i);if(t&&Array.isArray(t)){var a="wptb-"+t[1].split("-")[0]+"-control-stack",l=wp.template(a)({container:"."+t[0]}),o=JSON.parse(l);if(o&&"object"===(void 0===o?"undefined":_typeof(o))&&o.hasOwnProperty(e)){var i="wptb-el-"+t[1]+"-"+e;n.addEventListener("wptb-control:"+i,function(e){var t=document.getElementsByClassName(i);if(0<t.length){var a=WPTB_Helper.targetControlValueGet(t);r(a,n)}},!1)}}},innerElementCopyIncludeHandler:function(a,n){a&&"object"===(void 0===a?"undefined":_typeof(a))&&"function"==typeof n&&a.addEventListener("wptb-inner-element:copy",function(e){var t=e.detail;t&&(WPTB_Helper.elementClearFromTinyMce(t),n(t,a))},!1)},valueDependOnControl:function(a,n,r,l,o){function i(e,a,t){"string"==typeof e&&(e=[e]);var n=a.match(/wptb-el-((.+-)\d+)-(.+)/i),r={},l=[];if(n&&Array.isArray(n)){var o=n[3],i=void 0,s={};Array.isArray(t)&&(Array.isArray(t[0])?t.map(function(e){s[e[0]]=[e[1],e[2]]}):s[t[0]]=[t[1],t[2]]),e.map(function(e){var t=a.replace(o,e);t&&0<(i=document.getElementsByClassName(t)).length&&i[0].type&&(r[e]=i[0].value,e in s&&("integer"===s[e][1]?r[e]=parseInt(r[e])+parseInt(s[e][0]):"string"===s[e][1]&&(r[e]=r[e]+s[e][0])),l.push(i[0]))})}return[r,l]}var e=i(a,n,r);WPTB_Helper.elementOptionsSet(l,o,e[0],n),Object.keys(e[0]).forEach(function(e){var t="wptb-el-"+o.className.match(/wptb-element-((.+-)\d+)/i)[1]+"-"+[e];o.addEventListener("wptb-control:"+t,function(e){var t=i(a,n,r);WPTB_Helper.elementOptionsSet(l,o,t[0],n)},!1)})},appearDependOnControl:function(e,t){if(Array.isArray(e)){var l=function(e,t){var a="block";Object.keys(t).map(function(e){Object.prototype.hasOwnProperty.call(t,e)&&!1===t[e][0]&&(a="none")}),e.style.display=a},o=function(e,t){var a=WPTB_Helper.targetControlValueGet(e);return!(!t[1]||!Array.isArray(t[1])||-1===t[1].indexOf(a))||(!t[2]||!Array.isArray(t[2])||-1===t[2].indexOf(a))&&void 0};if("string"==typeof e[0])e=[e];else if(!Array.isArray(e[0]))return;for(var a={},n=0;n<e.length;n++){var r=e[n],i=r[0],s=t.match(/wptb-el-((.+-)\d+)-(.+)/i);if(s&&Array.isArray(s)){var d=s[3],p=t.replace(d,i);if(p){var c=document.getElementsByClassName(p);0<c.length&&(a[r[0]]=[o(c,r),c,r])}}}var m=document.getElementsByClassName(t);if(0<m.length){m=m[0];var u=WPTB_Helper.findAncestor(m,"wptb-element-option");u&&(l(u,a),Object.keys(a).map(function(e){Object.prototype.hasOwnProperty.call(a,e)&&a[e][1][0].addEventListener("change",function(e,t,a){var n=t[a][2],r=t[a][1];t[n[0]]=[o(r,n),r,n],l(e,t)}.bind(null,u,a,e),!1)}))}}},controlsStateManager:function(e,t){var a=document.getElementsByClassName(e);if(0<a.length){var n=e.match(/wptb-el-((.+-)\d+)-(.+)/i);if(n&&Array.isArray(n)){if(document.querySelector(".wptb-element-"+n[1])){var r=void 0,l={},o=void 0;if(0==(r=document.getElementsByClassName("wptb-element-datas")).length||""==r[0].innerHTML){var i=WPTB_Helper.targetControlValueGet(a);l["data-"+e]=i,(o={})["tmpl-wptb-el-datas-"+n[1]]=l,o=JSON.stringify(o),0==r.length?((r=document.createElement("script")).setAttribute("type","text/html"),r.setAttribute("class","wptb-element-datas")):r=r[0],r.innerHTML=o,document.getElementsByTagName("body")[0].appendChild(r)}else if((o=(r=r[0]).innerHTML)&&(o=o.trim(),(o=JSON.parse(o))&&"object"===(void 0===o?"undefined":_typeof(o))))if(t){var s=WPTB_Helper.targetControlValueGet(a);"tmpl-wptb-el-datas-"+n[1]in o&&"object"===_typeof(o["tmpl-wptb-el-datas-"+n[1]])||(o["tmpl-wptb-el-datas-"+n[1]]={}),o["tmpl-wptb-el-datas-"+n[1]]["data-"+e]=s,r.innerHTML=JSON.stringify(o)}else if("tmpl-wptb-el-datas-"+n[1]in o&&"object"===_typeof(o["tmpl-wptb-el-datas-"+n[1]])&&"data-"+e in o["tmpl-wptb-el-datas-"+n[1]]){if("tmpl-wptb-el-datas-"+n[1]in o&&"object"===_typeof(o["tmpl-wptb-el-datas-"+n[1]])&&"data-"+e in o["tmpl-wptb-el-datas-"+n[1]])for(var d=0;d<a.length;d++)if("checkbox"==a[d].type){var p=void 0;"checked"==(p=a[d].name?o["tmpl-wptb-el-datas-"+n[1]]["data-"+e][a[d].name]:o["tmpl-wptb-el-datas-"+n[1]]["data-"+e])?a[d].checked=!0:"unchecked"==p&&(a[d].checked=!1)}else a[d].value=o["tmpl-wptb-el-datas-"+n[1]]["data-"+e]}else{var c=WPTB_Helper.targetControlValueGet(a);"tmpl-wptb-el-datas-"+n[1]in o&&"object"===_typeof(o["tmpl-wptb-el-datas-"+n[1]])||(o["tmpl-wptb-el-datas-"+n[1]]={}),o["tmpl-wptb-el-datas-"+n[1]]["data-"+e]=c,r.innerHTML=JSON.stringify(o)}}}}},targetControlValueGet:function(e){for(var t=void 0,a=0;a<e.length;a++)"checkbox"==e[a].type&&e[a].name?(t||(t={}),1==e[a].checked?t[e[a].name]="checked":t[e[a].name]="unchecked"):"checkbox"==e[a].type?t=1==e[a].checked?"checked":"unchecked":e[a].type?t=e[a].value:e[a].dataset.alignmentValue&&e[a].classList.contains("selected")&&(t=e[a].dataset.alignmentValue);return t},elementControlsStateCopy:function(e,t){if(e&&t){var a=e.className.match(/wptb-element-((.+-)\d+)/i),n=t.className.match(/wptb-element-((.+-)\d+)/i);if(a&&Array.isArray(a)&&n&&Array.isArray(n)){var r=a[1],l=n[1],o=document.getElementsByClassName("wptb-element-datas");if(0<o.length){var i=(o=o[0]).innerHTML;if(i&&(i=i.trim(),(i=JSON.parse(i))&&"object"===(void 0===i?"undefined":_typeof(i)))){var s=i["tmpl-wptb-el-datas-"+r];if(s&&"object"===(void 0===s?"undefined":_typeof(s))){var d={};Object.keys(s).forEach(function(e){var t=s[e],a=e.replace(r,l);d[a]=t}),0<Object.keys(d).length&&(i["tmpl-wptb-el-datas-"+l]=d,i=JSON.stringify(i),o.innerHTML=i)}}}}}},elementControlsStateDelete:function(e,t){var a=e.className.match(/wptb-element-(.+)-(\d+)/i),n=document.getElementsByTagName("body")[0],r=n.getElementsByClassName("wptb-element-datas");if(a&&Array.isArray(a)&&0<r.length){var l=(r=r[0]).innerHTML;l&&(l=l.trim(),(l=JSON.parse(l))&&"object"===(void 0===l?"undefined":_typeof(l))&&"tmpl-wptb-el-datas-"+a[1]+"-"+a[2]in l&&(t?l["tmpl-wptb-el-datas-"+a[1]+"-"+a[2]]&&"object"===_typeof(l["tmpl-wptb-el-datas-"+a[1]+"-"+a[2]])&&"data-wptb-el-"+a[1]+"-"+a[2]+"-"+t in l["tmpl-wptb-el-datas-"+a[1]+"-"+a[2]]&&delete l["tmpl-wptb-el-datas-"+a[1]+"-"+a[2]]["data-wptb-el-"+a[1]+"-"+a[2]+"-"+t]:delete l["tmpl-wptb-el-datas-"+a[1]+"-"+a[2]],0==Object.keys(l).length?n.removeChild(r):(l=JSON.stringify(l),r.innerHTML=l)))}},elementOptionsSet:function(b,e,v,w){var g,f,t="wptb-"+b+"-control-stack",a=wp.template(t),n=void 0,h=void 0,y=void 0,l=void 0,S=e.className.match(/wptb-element-((.+-)\d+)/i);if(!S){var r=WPTB_Helper.detectMode();if(r||(r="startedid-0"),e.classList.contains("wptb-preview-table"))e.classList.add("wptb-element-main-table_setting-"+r);else if(e.classList.contains("wptb-cell")){document.querySelector(".wptb-element-table_cell_setting-"+e.dataset.xIndex+"-"+e.dataset.yIndex)||e.classList.add("wptb-element-table_cell_setting-"+e.dataset.xIndex+"-"+e.dataset.yIndex)}else e.classList.contains("wptb-responsive")&&(r.startsWith("wptb_team")&&(r="startedid-0"),e.classList.add("wptb-element-table_responsive_setting-"+r));S=e.className.match(/wptb-element-((.+-)\d+)/i)}n={container:"."+S[0]};var T=void 0;if(n.valueDependOnControl={},v&&Object.keys(v).forEach(function(e){n.valueDependOnControl[e]=v[e]}),w){var o=w.match(/wptb-el-((.+-)\d+)-(.+)/i);o&&Array.isArray(o)&&(T=o[3])}if(g=S[0],f=S[1],e.classList.contains("wptb-preview-table"));else if(e.classList.contains("wptb-cell"))this.activateSection("cell_settings");else if(e.classList.contains("wptb-responsive"))elementOptionsGroupId="table-responsive-group",wptbelementOptionClass="wptb-element-option";else{for(var i=document.getElementById("element-options-group").childNodes,s=0;s<i.length;s++)i[s].style&&(i[s].style.display="none");this.activateSection("options_group")}var d=a(n),C=JSON.parse(d),B=[],E={},_={},A={},x=[],P=[];if(
|
|