Version Description
- NEW: Alignment Settings for Star Rating.
- NEW: Back button in Element options title to get back to main panel easily.
- FIX: Issue with Undo-Redo functionality.
- FIX: Default text size not matching the settings.
Download this release
Release Info
Developer | imtiazrayhan |
Plugin | WP Table Builder – WordPress Table Plugin |
Version | 1.0.9 |
Comparing to | |
See all releases |
Code changes from version 1.0.8 to 1.0.9
- inc/admin/css/admin.css +10 -1
- inc/admin/js/admin.js +52 -16
- inc/admin/js/admin.js.map +1 -1
- inc/admin/js/admin.min.js +1 -1
inc/admin/css/admin.css
CHANGED
@@ -533,7 +533,7 @@ body>img {
|
|
533 |
|
534 |
.wptb-settings-dropdown {
|
535 |
font-size: 16px;
|
536 |
-
padding: 16px
|
537 |
position: relative;
|
538 |
background-color: #fff;
|
539 |
color: #186cba;
|
@@ -2215,4 +2215,13 @@ td[class*="wptb-fused-cell"] {
|
|
2215 |
|
2216 |
.wptb-cell img {
|
2217 |
max-width: 100%;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2218 |
}
|
533 |
|
534 |
.wptb-settings-dropdown {
|
535 |
font-size: 16px;
|
536 |
+
padding: 16px 20px 16px 20px;
|
537 |
position: relative;
|
538 |
background-color: #fff;
|
539 |
color: #186cba;
|
2215 |
|
2216 |
.wptb-cell img {
|
2217 |
max-width: 100%;
|
2218 |
+
}
|
2219 |
+
.wptb-exit-options{
|
2220 |
+
text-decoration: none;
|
2221 |
+
}
|
2222 |
+
.wptb-back-button{
|
2223 |
+
float: left;
|
2224 |
+
}
|
2225 |
+
.wptb-option-text {
|
2226 |
+
text-align: center;
|
2227 |
}
|
inc/admin/js/admin.js
CHANGED
@@ -1138,14 +1138,32 @@ var WPTB_ElementOptions = function WPTB_ElementOptions(element, index, kindIndex
|
|
1138 |
starsCountInputNumber.value = ratingStars.length;
|
1139 |
}
|
1140 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1141 |
var successBox = _affectedEl3.querySelector('.wptb-success-box');
|
1142 |
if (successBox) {
|
1143 |
var showNumberRatingCheckbox = prop.querySelector('input[type="checkbox"][data-type="show-number-rating"]');
|
1144 |
if (successBox.style.display == 'block') {
|
1145 |
showNumberRatingCheckbox.checked = true;
|
1146 |
var numeralRatingOptionContainers = prop.getElementsByClassName('wptb-numeral-rating-option-container');
|
1147 |
-
for (var
|
1148 |
-
numeralRatingOptionContainers[
|
1149 |
}
|
1150 |
} else {
|
1151 |
showNumberRatingCheckbox.checked = false;
|
@@ -1357,6 +1375,17 @@ var WPTB_ElementOptions = function WPTB_ElementOptions(element, index, kindIndex
|
|
1357 |
}
|
1358 |
affectedEl.getElementsByClassName('wptb-button-wrapper')[0].style.justifyContent = jc;
|
1359 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1360 |
case 'button-link':
|
1361 |
if (this.value) {
|
1362 |
affectedEl.getElementsByTagName('a')[0].href = WPTB_Helper.linkHttpCheckChange(this.value);
|
@@ -1429,10 +1458,10 @@ var WPTB_ElementOptions = function WPTB_ElementOptions(element, index, kindIndex
|
|
1429 |
break;
|
1430 |
case 'star-size':
|
1431 |
var _ratingStar = affectedEl.querySelectorAll('li');
|
1432 |
-
for (var
|
1433 |
-
_ratingStar[
|
1434 |
-
_ratingStar[
|
1435 |
-
var span = _ratingStar[
|
1436 |
for (var j = 0; j < span.length; j++) {
|
1437 |
if (span[j].querySelector('svg')) {
|
1438 |
span[j].style.width = val + 'px';
|
@@ -1452,13 +1481,13 @@ var WPTB_ElementOptions = function WPTB_ElementOptions(element, index, kindIndex
|
|
1452 |
|
1453 |
var _val = this.checked ? 'checked' : 'unchecked';
|
1454 |
if (_val == 'checked') {
|
1455 |
-
for (var
|
1456 |
-
wptbNumeralRatingOptionContainer[
|
1457 |
}
|
1458 |
_wptbTextMessage.parentNode.style.display = 'block';
|
1459 |
} else if (_val == 'unchecked') {
|
1460 |
-
for (var
|
1461 |
-
wptbNumeralRatingOptionContainer[
|
1462 |
}
|
1463 |
_wptbTextMessage.parentNode.style.display = 'none';
|
1464 |
}
|
@@ -1480,11 +1509,11 @@ var WPTB_ElementOptions = function WPTB_ElementOptions(element, index, kindIndex
|
|
1480 |
var starRatingsLast = starRatings[starRatings.length - 1];
|
1481 |
|
1482 |
var parent = starRatingsLast.parentNode;
|
1483 |
-
for (var
|
1484 |
var newStarRating = starRatingsLast.cloneNode(true);
|
1485 |
newStarRating.removeAttribute('class');
|
1486 |
newStarRating.setAttribute('class', 'wptb-rating-star');
|
1487 |
-
newStarRating.dataset.value = parseInt(starRatingsLast.dataset.value) +
|
1488 |
WPTB_Helper.starRatingEventHandlersAdd(newStarRating);
|
1489 |
parent.appendChild(newStarRating);
|
1490 |
}
|
@@ -2722,6 +2751,11 @@ var WPTB_LeftPanel = function WPTB_LeftPanel() {
|
|
2722 |
document.getElementById(wpcdFixedToolbar.getAttribute('data-toolbar-active-id')).classList.remove('toolbar-active');
|
2723 |
}
|
2724 |
}
|
|
|
|
|
|
|
|
|
|
|
2725 |
};
|
2726 |
var WPTB_List = function WPTB_List(innerElements, DOMElementProt) {
|
2727 |
|
@@ -3244,22 +3278,23 @@ var WPTB_StarRating = function WPTB_StarRating(DOMElementProt, countStarts) {
|
|
3244 |
successBox.classList.add('wptb-success-box');
|
3245 |
successBox.style.display = 'none';
|
3246 |
textMessage.classList.add('wptb-text-message');
|
|
|
3247 |
|
3248 |
var filledRatingStarHtml = '<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" \n\
|
3249 |
-
xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="20px" viewBox="0 0 426.667 426.667" \n\
|
3250 |
style="enable-background:new 0 0 426.667 426.667;" xml:space="preserve">\n\
|
3251 |
<polygon points="426.667,165.12 273.28,152.107 213.333,10.667 153.387,152.107 0,165.12 \n\
|
3252 |
116.48,266.027 81.493,416 213.333,336.427 345.173,416 310.187,266.027"/></svg>';
|
3253 |
|
3254 |
var notFilledRatingStarHtml = '<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" \n\
|
3255 |
-
xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="20px" viewBox="0 0 426.667 426.667" \n\
|
3256 |
style="enable-background:new 0 0 426.667 426.667;" xml:space="preserve">\n\
|
3257 |
<path d="M426.667,165.12L273.28,151.893L213.333,10.667l-59.947,141.44L0,165.12l116.48,100.907L81.493,416l131.84-79.573\n\
|
3258 |
L345.173,416L310.4,266.027L426.667,165.12z M213.333,296.533L133.12,344.96l21.333-91.307l-70.827-61.44l93.44-8.107 \n\
|
3259 |
l36.267-85.973l36.48,86.187l93.44,8.107l-70.827,61.44l21.333,91.307L213.333,296.533z"/></svg>';
|
3260 |
|
3261 |
var halfFilledRatingStarHtml = '<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" \n\
|
3262 |
-
xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="20px" viewBox="0 0 426.667 426.667" \n\
|
3263 |
style="enable-background:new 0 0 426.667 426.667;" xml:space="preserve">\n\
|
3264 |
<path d="M426.667,165.12L273.28,151.893L213.333,10.667l-59.947,141.44L0,165.12l116.48,100.907L81.493,416l131.84-79.573 \n\
|
3265 |
L345.173,416L310.4,266.027L426.667,165.12z M213.333,296.533v-198.4l36.48,86.187l93.44,8.107l-70.827,61.44l21.333,91.307 \n\
|
@@ -3268,6 +3303,7 @@ var WPTB_StarRating = function WPTB_StarRating(DOMElementProt, countStarts) {
|
|
3268 |
for (var i = 0; i < countStarts; i++) {
|
3269 |
var ratingStar = document.createElement('li');
|
3270 |
ratingStar.classList.add('wptb-rating-star');
|
|
|
3271 |
var ratingStarZeroSet = '';
|
3272 |
if (i == 0) {
|
3273 |
ratingStarZeroSet = '<span class="wptb-rating-star-zero-set"></span>';
|
@@ -5392,7 +5428,7 @@ var WPTB_TableStateSaveManager = function WPTB_TableStateSaveManager() {
|
|
5392 |
wptbTableSetup = wptbTableSetup[0];
|
5393 |
|
5394 |
wptbTableSetup.innerHTML = '';
|
5395 |
-
wptbTableSetup.
|
5396 |
|
5397 |
if (window.wptbTableStateSaving[window.wptbTableStateNumberShow][1]) {
|
5398 |
var cssForTdsWidthAuto = document.createElement('style');
|
1138 |
starsCountInputNumber.value = ratingStars.length;
|
1139 |
}
|
1140 |
|
1141 |
+
var ratingAlignment = _affectedEl3.style.textAlign,
|
1142 |
+
ratingAlignmentSelect = prop.querySelector('select[data-type="rating-alignment"]'),
|
1143 |
+
_selectOption2 = ratingAlignmentSelect.getElementsByTagName('option'),
|
1144 |
+
_selectOptionVal = void 0;
|
1145 |
+
if (ratingAlignment == 'start') {
|
1146 |
+
_selectOptionVal = 'left';
|
1147 |
+
} else if (ratingAlignment == 'center' || !ratingAlignment) {
|
1148 |
+
_selectOptionVal = 'center';
|
1149 |
+
} else if (ratingAlignment == 'right') {
|
1150 |
+
_selectOptionVal = 'right';
|
1151 |
+
}
|
1152 |
+
|
1153 |
+
for (var _i6 = 0; _i6 < _selectOption2.length; _i6++) {
|
1154 |
+
if (_selectOption2[_i6].value == _selectOptionVal) {
|
1155 |
+
_selectOption2[_i6].selected = true;
|
1156 |
+
}
|
1157 |
+
}
|
1158 |
+
|
1159 |
var successBox = _affectedEl3.querySelector('.wptb-success-box');
|
1160 |
if (successBox) {
|
1161 |
var showNumberRatingCheckbox = prop.querySelector('input[type="checkbox"][data-type="show-number-rating"]');
|
1162 |
if (successBox.style.display == 'block') {
|
1163 |
showNumberRatingCheckbox.checked = true;
|
1164 |
var numeralRatingOptionContainers = prop.getElementsByClassName('wptb-numeral-rating-option-container');
|
1165 |
+
for (var _i7 = 0; _i7 < numeralRatingOptionContainers.length; _i7++) {
|
1166 |
+
numeralRatingOptionContainers[_i7].style.display = 'block';
|
1167 |
}
|
1168 |
} else {
|
1169 |
showNumberRatingCheckbox.checked = false;
|
1375 |
}
|
1376 |
affectedEl.getElementsByClassName('wptb-button-wrapper')[0].style.justifyContent = jc;
|
1377 |
break;
|
1378 |
+
case 'rating-alignment':
|
1379 |
+
var jc = '';
|
1380 |
+
if (this.value == 'left') {
|
1381 |
+
jc = 'start';
|
1382 |
+
} else if (this.value == 'right') {
|
1383 |
+
jc = 'right';
|
1384 |
+
} else {
|
1385 |
+
jc = 'center';
|
1386 |
+
}
|
1387 |
+
affectedEl.style.textAlign = jc;
|
1388 |
+
break;
|
1389 |
case 'button-link':
|
1390 |
if (this.value) {
|
1391 |
affectedEl.getElementsByTagName('a')[0].href = WPTB_Helper.linkHttpCheckChange(this.value);
|
1458 |
break;
|
1459 |
case 'star-size':
|
1460 |
var _ratingStar = affectedEl.querySelectorAll('li');
|
1461 |
+
for (var _i8 = 0; _i8 < _ratingStar.length; _i8++) {
|
1462 |
+
_ratingStar[_i8].style.width = val + 'px';
|
1463 |
+
_ratingStar[_i8].style.height = val + 'px';
|
1464 |
+
var span = _ratingStar[_i8].querySelectorAll('span');
|
1465 |
for (var j = 0; j < span.length; j++) {
|
1466 |
if (span[j].querySelector('svg')) {
|
1467 |
span[j].style.width = val + 'px';
|
1481 |
|
1482 |
var _val = this.checked ? 'checked' : 'unchecked';
|
1483 |
if (_val == 'checked') {
|
1484 |
+
for (var _i9 = 0; _i9 < wptbNumeralRatingOptionContainer.length; _i9++) {
|
1485 |
+
wptbNumeralRatingOptionContainer[_i9].style.display = 'block';
|
1486 |
}
|
1487 |
_wptbTextMessage.parentNode.style.display = 'block';
|
1488 |
} else if (_val == 'unchecked') {
|
1489 |
+
for (var _i10 = 0; _i10 < wptbNumeralRatingOptionContainer.length; _i10++) {
|
1490 |
+
wptbNumeralRatingOptionContainer[_i10].style.display = 'none';
|
1491 |
}
|
1492 |
_wptbTextMessage.parentNode.style.display = 'none';
|
1493 |
}
|
1509 |
var starRatingsLast = starRatings[starRatings.length - 1];
|
1510 |
|
1511 |
var parent = starRatingsLast.parentNode;
|
1512 |
+
for (var _i11 = 0; _i11 < difference; _i11++) {
|
1513 |
var newStarRating = starRatingsLast.cloneNode(true);
|
1514 |
newStarRating.removeAttribute('class');
|
1515 |
newStarRating.setAttribute('class', 'wptb-rating-star');
|
1516 |
+
newStarRating.dataset.value = parseInt(starRatingsLast.dataset.value) + _i11 + 1;
|
1517 |
WPTB_Helper.starRatingEventHandlersAdd(newStarRating);
|
1518 |
parent.appendChild(newStarRating);
|
1519 |
}
|
2751 |
document.getElementById(wpcdFixedToolbar.getAttribute('data-toolbar-active-id')).classList.remove('toolbar-active');
|
2752 |
}
|
2753 |
}
|
2754 |
+
document.querySelector('.wptb-panel-left').addEventListener('click', function (event) {
|
2755 |
+
if (event.target.classList.contains('wptb-exit-options')) {
|
2756 |
+
clickOnFreeSpace();
|
2757 |
+
}
|
2758 |
+
});
|
2759 |
};
|
2760 |
var WPTB_List = function WPTB_List(innerElements, DOMElementProt) {
|
2761 |
|
3278 |
successBox.classList.add('wptb-success-box');
|
3279 |
successBox.style.display = 'none';
|
3280 |
textMessage.classList.add('wptb-text-message');
|
3281 |
+
textMessage.style.fontSize = '25px';
|
3282 |
|
3283 |
var filledRatingStarHtml = '<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" \n\
|
3284 |
+
xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="20px" style="width: 20px;" viewBox="0 0 426.667 426.667" \n\
|
3285 |
style="enable-background:new 0 0 426.667 426.667;" xml:space="preserve">\n\
|
3286 |
<polygon points="426.667,165.12 273.28,152.107 213.333,10.667 153.387,152.107 0,165.12 \n\
|
3287 |
116.48,266.027 81.493,416 213.333,336.427 345.173,416 310.187,266.027"/></svg>';
|
3288 |
|
3289 |
var notFilledRatingStarHtml = '<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" \n\
|
3290 |
+
xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="20px" style="width: 20px;" viewBox="0 0 426.667 426.667" \n\
|
3291 |
style="enable-background:new 0 0 426.667 426.667;" xml:space="preserve">\n\
|
3292 |
<path d="M426.667,165.12L273.28,151.893L213.333,10.667l-59.947,141.44L0,165.12l116.48,100.907L81.493,416l131.84-79.573\n\
|
3293 |
L345.173,416L310.4,266.027L426.667,165.12z M213.333,296.533L133.12,344.96l21.333-91.307l-70.827-61.44l93.44-8.107 \n\
|
3294 |
l36.267-85.973l36.48,86.187l93.44,8.107l-70.827,61.44l21.333,91.307L213.333,296.533z"/></svg>';
|
3295 |
|
3296 |
var halfFilledRatingStarHtml = '<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" \n\
|
3297 |
+
xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="20px" style="width: 20px;" viewBox="0 0 426.667 426.667" \n\
|
3298 |
style="enable-background:new 0 0 426.667 426.667;" xml:space="preserve">\n\
|
3299 |
<path d="M426.667,165.12L273.28,151.893L213.333,10.667l-59.947,141.44L0,165.12l116.48,100.907L81.493,416l131.84-79.573 \n\
|
3300 |
L345.173,416L310.4,266.027L426.667,165.12z M213.333,296.533v-198.4l36.48,86.187l93.44,8.107l-70.827,61.44l21.333,91.307 \n\
|
3303 |
for (var i = 0; i < countStarts; i++) {
|
3304 |
var ratingStar = document.createElement('li');
|
3305 |
ratingStar.classList.add('wptb-rating-star');
|
3306 |
+
ratingStar.style.width = '20px';
|
3307 |
var ratingStarZeroSet = '';
|
3308 |
if (i == 0) {
|
3309 |
ratingStarZeroSet = '<span class="wptb-rating-star-zero-set"></span>';
|
5428 |
wptbTableSetup = wptbTableSetup[0];
|
5429 |
|
5430 |
wptbTableSetup.innerHTML = '';
|
5431 |
+
wptbTableSetup.innerHTML = window.wptbTableStateSaving[window.wptbTableStateNumberShow][0].outerHTML;
|
5432 |
|
5433 |
if (window.wptbTableStateSaving[window.wptbTableStateNumberShow][1]) {
|
5434 |
var cssForTdsWidthAuto = document.createElement('style');
|
inc/admin/js/admin.js.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"sources":["WPTB_ActionsField.js","WPTB_Builder.js","WPTB_Button.js","WPTB_Cell.js","WPTB_DropHandle.js","WPTB_ElementCounters.js","WPTB_ElementOptions.js","WPTB_Helper.js","WPTB_Image.js","WPTB_Initializer.js","WPTB_LeftPanel.js","WPTB_List.js","WPTB_ListItem.js","WPTB_MultipleSelect.js","WPTB_Parser.js","WPTB_Parser2.js","WPTB_Settings.js","WPTB_Space.js","WPTB_StarRating.js","WPTB_Stringifier.js","WPTB_Stringifier2.js","WPTB_Table.js","WPTB_TableStateSaveManager.js","WPTB_Text.js","WPTB_innerElementSet.js","applyGenericItemSettings.js","wptb-builder.js"],"names":["WPTB_ActionsField","wptbActions","document","getElementsByClassName","length","addActionField","actionType","thisNode","body","getElementsByTagName","actions","previousNode","activeElem","classList","remove","parentNode","removeChild","btnDelete","btnCopy","btnMove","createElement","add","draggable","appendChild","type","onclick","event","act","target","el","kind","thisRow","contains","table","WPTB_Helper","findAncestor","dataTitleColumnSet","wptbActionsField","actionsRemove","wptbTableStateSaveManager","WPTB_TableStateSaveManager","tableStateSet","copy","infArr","activeElement","activeElementClone","cloneNode","className","match","td","temp","srcList","querySelectorAll","i","push","innerHTML","WPTB_List","insertBefore","getDOMElement","nextSibling","WPTB_Text","childNodes","WPTB_Image","text","querySelector","WPTB_Button","WPTB_StarRating","WPTB_innerElementSet","setParameters","ondragstart","dragImagesArr","dataTransfer","effectAllowed","setDragImage","setData","actionsHide","style","display","previous","append","wptbDirectlyhovered","action","item","parent","listItemsRecalculateIndex","coordinatesElement","getBoundingClientRect","coordinatesElementTopBegin","top","listItem","content","html","duplicate","WPTB_ListItem","listItemsTinyMceInit","firstChild","divcontent","setTimeout","coordinatesElementTopEnd","wptbContainer","correctTop","parseFloat","removeEventListener","left","right","clientWidth","addEventListener","leaveFromField","node","relatedTarget","onmouseleave","localName","opacity","WPTB_Builder","table_id","detectMode","http","XMLHttpRequest","urlSet","ajaxurl","open","setRequestHeader","onreadystatechange","d","readyState","status","ans","JSON","parse","responseText","getElementById","value","wptbTableSetupEl","WPTB_Parser","WPTB_Table","WPTB_LeftPanel","WPTB_Settings","send","counter","ElementCounters","select","MultipleSelect","initializer","WPTB_Initializer","settings","DOMElementProt","DOMElement","elButton","el_B","el_BDiv","el_BDivP","kindIndexProt","undefined","wptbElementMutch","Array","isArray","attributesContainer","attributes","setAttribute","name","wptbButtonWrapper","wptbButtonWrapAttributes","wptbButtonA","wptbButtonAttributes","wptbButton","applyGenericItemSettings","WPTB_Cell","callback","highlightRow","parentRow","columnCount","parseInt","tds","classToAdd","ttd","highlightColumn","index","rowCount","tr","padding","jQuery","val","innerBorderWidth","border","wptbPhElement","wptbSpaceBetween","j","WPTB_Space","wptbElementTypeClass","wptbTypeElementArr","split","wptbListItems","setCoords","y","x","dataset","yIndex","xIndex","getCoords","coords","appendElement","getCellDimensions","tdStyleObj","window","getComputedStyle","tdPaddingLeft","getPropertyValue","tdPaddingRight","tdBorderLeftWidth","tdBorderRightWidth","tdPaddingTop","tdPaddingBottom","tdBorderTopWidth","tdBorderBottomWidth","width","offsetWidth","height","offsetHeight","WPTB_DropHandle","thisElem","e","wptbDropHandle","wptbDropBorderMarker","wptbDropBorderMarkerTop","wptbDropBorderMarkerRight","wptbDropBorderMarkerBottom","wptbDropBorderMarkerLeft","ondragenter","ondragover","preventDefault","ondragleave","ondrop","element","getData","newElementProxy","wptbMovingMode","getDOMParentElement","nodeName","toLowerCase","innerElement","innerElementNext","console","log","onscroll","indics","types","notDragEnter","indexOf","elementDrag","offsetY","layerY","bottom","priv","increment","key","nextIndex","WPTB_ElementOptions","elemIdClass","prop","properties","affectedEl","wptbSize","b","buttonAlignment","justifyContent","buttonAlignmentSelect","selectOption","selectOptionVal","selected","buttonHref","getAttribute","buttonLinkTarget","buttonId","buttonHrefInput","buttonLinkTargetInput","buttonLinkTargetInputId","buttonLinkTargetInputLabel","buttotIdInput","checked","buttonTextColor","color","buttonColor","backgroundColor","buttonTextColorInput","buttonBackgroundColorInput","rgbToHex","elementsA","a","imgAlign","float","imageAlignmentSelect","imageLinkHref","inputImageLink","imageLinkTarget","imageLinkTargetInput","imageLinkTargetInputId","imageLinkTargetInputLabel","imgWidth","imageWidthInputRange","imageWidthInputNumber","img","imgAlternativeText","imageAlternativeTextInput","elementFontSize","fontSize","elementTextColor","textFontSizeInputRange","textFontSizeInputNumber","textColorInput","elementList","elementListColor","listColorInput","elementListItem","listItemP","listItemPClasses","elementListClassSelect","listIconSelectLabel","nodeType","listIconSelectLabelId","elementListStyleTypeSelect","elementListItemContent","listItemPTextAlignArr","p","textAlign","listItemPTextAlignLeftCount","listItemPTextAlignCenterCount","listItemPTextAlignRightCount","elementListAlignmentSelect","maxListItemTAlLeftC","Math","max","ratingStar","ratingStarSize","starSizeInputRange","starSizeInputNumber","starColorInput","ratingStarColor","fill","ratingStars","starsCountInputNumber","successBox","showNumberRatingCheckbox","numeralRatingOptionContainers","wptbTextMessage","numberRatingSize","numberRatingColor","numberSizeInputRange","numberSizeInputNumber","numberColorInput","optionsClass","children","buttons","size","n_Class","num","optionControls","wpColorPicker","change","ui","wpColorPickerChange","wpColorPickerCheckChangeForTableStateSaving","clear","numberImputSize","slider","oninput","onchange","src","alt","href","linkHttpCheckChange","rel","removeAttribute","wptbImageFloatValue","jc","id","listItems","parentNodeSettingItem","span","wptbNumeralRatingOptionContainer","starRatingTextMessageChenge","wptbTextMessageSize","lineHeight","starRatings","starRatingsCount","difference","starRatingsLast","newStarRating","starRatingEventHandlersAdd","starRatingLength","onmouseup","hexToRgb","hex","result","exec","rgb","toString","slice","getDragImageCustom","hostName","location","protocol","hostname","image","button","list","star_rating","ulElem","par","listStyleTypeIndex","Number","tinyMCE","init","inline","plugins","dialog_type","theme","menubar","fixed_toolbar_container","paste_as_text","toolbar","setup","ed","on","article","keyCode","innerText","pText","replace","trim","selectedText","getSelectionText","wptbListItem","onblur","init_instance_callback","editor","currentEditor","totalWidth","scrollTop","bodyElement","position","buttonsTinyMceInit","wptbButtonContainer","link","linkArr","linkClean","rows","rowHead","computedStyleRowHead","rowHeadChildren","contentsForHeader","tdElements","textContent","thisRowChildren","wptbTitleColumn","wptbTitleColumnFontSize","wptbTitleColumnColor","wptbTitleBackgroundColor","wptbTitleAlign","cls","parentElement","txt","getSelection","selection","createRange","settingsPanelClear","wpColorPickerClear","elementOptionsPanelClear","elementOptionsGroup","originalEvent","wpPickerContainer","irisSquareHandle","uiSliderHandle","attribute","isId","input","newInput","url","regex","RegExp","results","decodeURIComponent","getColumnWidth","cell","xIndexes","cellWidth","getRowHeight","yIndexes","cellHeight","uiColor","classe","ps","number","starRatingSelectHoverSet","starRating","onStar","onmouseover","stopPropagation","onmouseout","wptbStarRatingContainer","wptbNumberInputs","maxCount","maxValue","onkeydown","thisValue","String","substring","onkeyup","starRatingContainer","ratingNumber","wptbTextMessageCommon","wptbTextMessageCommonVal","elImage","anchor","file_frame","wp","media","frames","title","multiple","attachment","state","get","first","toJSON","imgSrc","MIN_COLUMNS","MIN_ROWS","MAX_COLUMNS","MAX_ROWS","tableGenerator","columnsDecrementButton","columnsIncrementButton","rowsDecrementButton","rowsIncrementButton","columnsInput","rowsInput","columns","wptbElementButtons","wptbTdBgColorSavedSet","inputId","trNumber","tableRows","trBackgroundColor","wptbEvenRowBg","tableHeader","tableAdaptiveForMobile","wptbAdaptiveTableCheckbox","wptbAdaptiveTable","tableTopRowAsHeadSavedSet","wptbTopRowAsHeader","tableBorderColorWidthSavedSet","tableBorderColor","borderColor","tableBorderColorInput","tableBorderWidth","borderWidth","wptbTableBorderWidthSlider","wptbTableBorderWidthNumber","tableTd","applyInnerBorder","innerBorderCheckInput","wptbApplyInnerBorder","wptbTableInnerBorderSlider","wptbTableInnerBorderNumber","tableCells","tableInnerborderNumber","addInnerBorderSize","borderStyle","addCellPadding","addInnerBorder","styles","wptbPreviewTable","marginBottom","addBorderSize","cellPaddingSavedSet","wptbTableCellSlider","wptbTableCellNumber","wptbTableBorderNumber","wptbTextfontSizeNumber","wptbImageWidthNumber","wptbTableColumnWidthNumber","wptbTableRowHeightNumber","tdDefaultWidth","wptbInnerBorderCheck","tableBorderColorSetArea","addColumnWidth","highlighted","addRowHeight","createMobileHeadForTable","thisEvent","wptbElement","toggleTableEditMode","addRowToTheEnd","addRowToTheStart","addRowBefore","addRowAfter","addColumnEnd","addColumnStart","addColumnBefore","addColumnAfter","deleteColumn","deleteRow","mergeCells","splitCell","wptbBuilderPanel","clickOnFreeSpace","wptbHeader","wpcdFixedToolbar","hasAttribute","innerElements","el_L","wptbListItemReturn","styleDot","listItemKeyListener","onmouseenter","selectedCells","multipleCellMode","activateMultipleSelectMode","deactivateMultipleSelectMode","isActivated","pushSelectedCell","flushSelectedCells","getFirst","minXIndex","minYIndex","getLast","maxXIndex","maxYIndex","last","removeAllButFirst","code","div","columnTitleMobile","WPTB_Parser2","elementHtml","createTextNode","tagName","elems","ondragend","wptbUndo","tableStateGet","wptbUndoredo","wptbUndoRedoContainer","wptbRedo","shortcodePopupWindow","onbeforeunload","wptbSaveDisabled","wptbTableStateNumberSave","wptbTableStateNumberShow","bar","wptb_admin_object","t","messagingArea","WPTB_Stringifier","outerHTML","messagingAreaText","params","security_code","rs","wptbId","stringify","data","wptbPreviewBtn","wptbPreviewBtnHref","previewHref","wptbSaveBtn","elSpaceBetween","includes","spaceBetween","t_space","spaceParent","alert","countStarts","ratingStarsBox","ratingStarsList","textMessage","filledRatingStarHtml","notFilledRatingStarHtml","halfFilledRatingStarHtml","ratingStarZeroSet","wptbRatingStarsBox","wptbRatingStarsBoxAttributes","wptbRatingStarsOld","wptbRatingStars","iMax","wptbRatingStarsAttributes","wptbRatingStarsOldSpan","wptbRatingStarsSpan","k","wptbRatingStarsOldSpanAttributes","l","wptbRatingStarsOldSvg","wptbRatingStarsOldSvgStyle","wptbSuccessBox","wptbSuccessBoxAttributes","wptbTextMessageAttributes","codeMain","tableColumns","minWidth","maxWidth","mceContentBodys","dataMceStyle","contentEditable","spellCheck","mceIds","wptbActionsLength","columnNameDivContainer","columnNameDiv","WPTB_Stringifier2","start","nodeValue","int_elem_arr","attributes_list","internal_elements","inter_elem","array","wptbTableSetup","row","maxAmountOfCells","maxAmountOfRows","mark","rowSpan","cs","colSpan","markedCells","noCells","singleCells","multipleCells","cellSettings","column","cellHighlighted","wptbTableColumnWidthSlider","tableColumnWidthAutoFixedCheckbox","wptbFixedWidth","wptbTableRowHeightSlider","tableRowHeightAutoFixedCheckbox","wptbFixedHeight","isSquare","realTimeArray","carried","cols","matriz","items","justAssigned","amount","carriedRowspans","cellsBuffer","cellPointer","xPosition","stepsToMove","celda","drawTable","string","undoSelect","fillTableArray","colspansSums","cells","colspanSumInRow","apply","getActualPointsInRow","points","search","skipInCols","reconstraction","insertRow","wptb_preview_table","cellModeBackground","leftScrollPanelCurtain","leftScrollPanelCellSettings","wptbPreviewTableTds","recalculateIndexes","trs","maxCols","maxColsFull","tdsArr","jMainIter","z","cleaner","dataXIndex","tableTdsFor","colspan","widthIsSet","arrayTdsFromPreviousRow","tableTdsSumMaxWidth","tableTdsSumMaxWidthFixed","tableTdsSumMaxWidthAuto","wptbTableSetupWidth","arrayCellsWidthFixedHelper","arrayCellsWidthAutoHelper","tdPaddingCommon","tableTdBorderCommonWidth","cssForTdsWidthAuto","wptbCssTdAutoWidth","tableTdBorderLeftWidth","tableTdBorderRightWidth","CellsWidthAutoCount","tableFullStyleObj","borderLeftWidth","borderRightWidth","tableBorderCommon","wptbTableTdsSumMaxWidth","wptbCellsWidthAutoCount","mergingСellsHorizontally","wptbFixedWidthSize","styleElementCreate","tableTdWidthAuto","tableTdsWidthAutoCommon","head","cssForTdsWidthAutoOld","dataYIndex","rowspan","heightIsSet","arrayTdsPrevious","tableColumnHeightAutoFixedCheckbox","wptbAdaptiveTableChoseBlock","mergingCellsVertically","forBreak","currentTable","currentTableTd","currentTdStyle","firstCell","c_pos","cellStyle","pos","pendingInsertion","bro","currentCell","r","aux","from","cellNew","rowChildren","rowChildrenLength","cellRowSpan","rowAfter","cellsColSpan","tableRowsIChildren","tableRIChildrenLength","rowIRowSpan","rNext","rNextChildren","rNextChildrenLength","rowStart","columnStart","rowEnd","columnEnd","itemsEstimate","dimensions","call","tdsChildrenNew","tdsInternalElements","tdsIntElemLength","firstWidth","firstDataFixedWidth","firstHeight","firstDataFixedHeight","cellStyles","cellXIndex","rowChildInsertBefore","rowNext","findRowspannedCells","actualPoints","addLackingCells","sumRows","totalColspan","nextRow","nextRowChildren","nextRowChildrenLength","tdArr","nextRowChildrenK","jRowChildren","pop","onresize","wptbTableStateSaving","wptbNewPreviewTable","wptbHighlighted","cssForTdsWidthAutoValue","datawptbUndoredo","wptbLeftScrollPanelCellSetting","elText2","elP","classId","wptbElements","elementIndexesArr","elementIndexMax","kindIndexProtArr","force_br_newlines","force_p_newlines","forced_root_block","observer","MutationObserver","mutations","config","attributeFilter","observe","ritingStarZeroSet","ulStarList","node_wptb_element_kind_num"],"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,YAAIC,UAAUR,SAASC,sBAAT,CAAiC,cAAjC,CAAd;AACA,YAAIO,QAAQN,MAAR,IAAkB,CAAtB,EAA0B;AACtB,gBAAIO,eAAeD,QAAQ,CAAR,EAAWE,UAA9B;AACA,gBAAID,YAAJ,EAAmB;AACfA,6BAAaE,SAAb,CAAuBC,MAAvB,CAA+B,sBAA/B;AACH;;AAED,mBAAOJ,QAAQN,MAAR,IAAkB,CAAzB,EAA6B;AACzBM,wBAAQ,CAAR,EAAWK,UAAX,CAAsBC,WAAtB,CAAmCN,QA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AK/F,SAAL,CAAemB,QAAf,CAAyB,iBAAzB,CAAP,EAAsD;AAClD4E,aAAK/F,SAAL,CAAeQ,GAAf,CAAoB,iBAApB;AACA,YAAI,CAAEuF,KAAK/F,SAAL,CAAemB,QAAf,CAAyB,kBAAkBwM,QAAQ1M,IAA1B,GAAiC,GAAjC,GAAuCkJ,KAAhE,CAAN,EAAgF;AAC5EpE,iBAAK/F,SAAL,CAAeQ,GAAf,CAAoB,kBAAkBmN,QAAQ1M,IAA1B,GAAiC,GAAjC,GAAuCkJ,KAA3D;AACH;AACJ,KALD,MAKO;AACH,YAAI,CAAEpE,KAAK/F,SAAL,CAAemB,QAAf,CAAyB,kBAAkBwM,QAAQ1M,IAA1B,GAAiC,GAAjC,GAAuCkJ,KAAhE,CAAN,EAAgF;AAC5EpE,iBAAK/F,SAAL,CAAeQ,GAAf,CAAoB,kBAAkBmN,QAAQ1M,IAA1B,GAAiC,GAAjC,GAAuCkJ,KAA3D;AACH;AACJ;AACD,QAAIgF,mBAAJ,CAAyBxB,OAAzB,EAAkCxD,KAAlC,EAAyCzB,aAAzC;;AAEArJ,aAASwI,OAAT,CAAiBmH,SAAjB,CAA2BrB,QAAQ1M,IAAnC;AACH,CA/LD;ACAA","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, btnMove;\n\n btnDelete = document.createElement( 'span' ),\n btnCopy = document.createElement( 'span' ),\n btnMove = 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 btnMove.classList.add( \"dashicons\", \"dashicons-move\", 'wptb-move-action' );\n btnMove.draggable = true;\n\n actions.appendChild( btnMove );\n actions.appendChild( btnCopy );\n actions.appendChild( btnDelete );\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 el.removeChild(act);\n\n if( act.kind == 'text' ) {\n let thisRow = el.parentNode\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\n WPTB_Helper.dataTitleColumnSet( table );\n }\n }\n\n let wptbActionsField = new WPTB_ActionsField();\n\n wptbActionsField.actionsRemove();\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n\n\n btnCopy.onclick = ( event ) => {\n let copy,\n infArr,\n type;\n let activeElement = event.target.parentNode.activeElem;\n let activeElementClone = activeElement.cloneNode( true );\n activeElementClone.classList.remove( 'wptb-directlyhovered' );\n infArr = activeElement.className.match(/wptb-element-(.+)-(\\d+)/i);\n type = infArr[1];\n let td = activeElement.parentNode;\n if ( type == 'list' ) {\n var temp = [],\n srcList = activeElement.querySelectorAll('ul li .wptb-list-item-content');\n\n for (var i = 0; i < srcList.length; i++) {\n temp.push(srcList[i].innerHTML);\n }\n\n copy = new WPTB_List( temp, activeElementClone );\n\n td.insertBefore( copy.getDOMElement(), activeElement.nextSibling );\n } else if ( type == 'text' ) {\n copy = new WPTB_Text( activeElementClone.childNodes[0].innerHTML, activeElementClone );\n\n td.insertBefore( copy.getDOMElement(), activeElement.nextSibling );\n } else if ( type == 'image' ) {\n copy = new WPTB_Image( '', activeElement );\n \n td.insertBefore( copy.getDOMElement(), activeElement.nextSibling );\n } else if( type == 'button' ) {\n let text = activeElementClone.childNodes[0].querySelector( 'p' ).innerHTML;\n \n copy = new WPTB_Button( text, activeElementClone );\n\n td.insertBefore( copy.getDOMElement(), activeElement.nextSibling );\n } else if( type = 'star_rating' ) {\n copy = new WPTB_StarRating( activeElementClone );\n\n td.insertBefore( copy.getDOMElement(), activeElement.nextSibling );\n }\n\n WPTB_innerElementSet( copy.getDOMElement() );\n\n let wptbActionsField = new WPTB_ActionsField( 1, activeElement );\n \n wptbActionsField.setParameters( activeElement );\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n btnMove.ondragstart = ( event ) => {\n let dragImagesArr = WPTB_Helper.dragImagesArr(),\n actions = event.target.parentNode,\n activeElem = actions.activeElem,\n infArr,\n type;\n infArr = activeElem.className.match(/wptb-element-(.+)-(\\d+)/i);\n type = infArr[1];\n activeElem.classList.add( 'wptb-moving-mode' );\n\n event.dataTransfer.effectAllowed = 'move';\n event.dataTransfer.setDragImage( dragImagesArr[type], 0, 0 );\n event.dataTransfer.setData( 'node', 'wptb-element-' + infArr[1] + '-' + infArr[2] );\n event.dataTransfer.setData( 'wptb-moving-mode', 'wptb-element-' + infArr[1] + '-' + infArr[2] );\n event.dataTransfer.setData( 'wptbElIndic-' + infArr[1], 'wptbElIndic-' + infArr[1] );\n let act = event.target.parentNode.activeElem;\n if( act.kind == 'text' ) {\n let thisRow = act.parentNode.parentNode;\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\n WPTB_Helper.dataTitleColumnSet( table );\n }\n }\n //actions.style.display = 'none';\n this.actionsHide();\n };\n\n //actions.style.right = '-' + parseFloat( thisNode.offsetWidth ) + 'px';\n actions.style.display = 'block';\n\n this.wptbActions = actions;\n } else if( actionType == 2 ) {\n let btnDelete,\n btnCopy,\n previous,\n i;\n\n btnDelete = document.createElement('span'),\n btnCopy = document.createElement('span'),\n actions = document.createElement('span')\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.append( btnCopy, btnDelete );\n body.appendChild( actions );\n\n actions.activeElem = thisNode;\n \n let wptbDirectlyhovered = WPTB_Helper.findAncestor( thisNode, 'wptb-directlyhovered' );\n if( wptbDirectlyhovered ) {\n wptbDirectlyhovered.classList.remove( 'wptb-directlyhovered' );\n }\n\n actions.type = 2;\n\n btnDelete.onclick = ( event ) => {\n var action = event.target.parentNode, \n item = action.activeElem,\n parent = item.parentNode;\n let wptbActionsField = new WPTB_ActionsField( 4 );\n wptbActionsField.actionsRemove();\n parent.removeChild( item );\n WPTB_Helper.listItemsRecalculateIndex( parent );\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n btnCopy.onclick = ( event ) => {\n let coordinatesElement = thisNode.getBoundingClientRect();\n let coordinatesElementTopBegin = coordinatesElement.top;\n\n var listItem = event.target.parentNode.activeElem,\n content = listItem.querySelector( '.wptb-list-item-content' ),\n html = content.innerHTML;\n var duplicate = new WPTB_ListItem( html, listItem, true );\n listItem.parentNode.insertBefore( duplicate.getDOMElement(), thisNode.nextSibling );\n WPTB_Helper.listItemsTinyMceInit( duplicate.getDOMElement().firstChild );\n\n let divcontent = thisNode.getElementsByClassName( 'wptb-list-item-content' );\n if( divcontent.length > 0 ) {\n divcontent = divcontent[0];\n }\n setTimeout( function(){\n divcontent.innerHTML = html;\n WPTB_Helper.listItemsRecalculateIndex( listItem.parentNode );\n }, 5 );\n\n coordinatesElement = thisNode.getBoundingClientRect();\n let coordinatesElementTopEnd = coordinatesElement.top;\n\n if( coordinatesElementTopBegin != coordinatesElementTopEnd ) {\n let wptbActionsField = new WPTB_ActionsField( 2, thisNode );\n wptbActionsField.setParameters( thisNode );\n }\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n actions.style.display = 'block';\n\n this.wptbActions = actions;\n }\n }\n \n this.setParameters = ( thisNode ) => {\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.display = 'block';\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// let wptbBorderMarkerTop = this.wptbBorderMarker.querySelector( '.wptb-border-marker-top' );\n// wptbBorderMarkerTop.style.width = ( parseFloat( thisNode.offsetWidth ) + 3 ) + 'px';\n//\n// let wptbBorderMarkerRight = this.wptbBorderMarker.querySelector( '.wptb-border-marker-right' );\n// wptbBorderMarkerRight.style.height = ( parseFloat( coordinatesElement.bottom ) - parseFloat( coordinatesElement.top ) + 4 ) + 'px';\n// wptbBorderMarkerRight.style.left = ( parseFloat( thisNode.offsetWidth ) + 3 ) + 'px';\n//\n// let wptbBorderMarkerBottom = this.wptbBorderMarker.querySelector( '.wptb-border-marker-bottom' );\n// wptbBorderMarkerBottom.style.width = wptbBorderMarkerTop.style.width;\n// wptbBorderMarkerBottom.style.top = ( parseFloat( coordinatesElement.bottom ) - parseFloat( coordinatesElement.top ) + 3 ) + 'px';;\n//\n// let wptbBorderMarkerLeft = this.wptbBorderMarker.querySelector( '.wptb-border-marker-left' );\n// \n \n //this.wptbBorderMarker.style.display = 'block';\n this.wptbActions.style.display = 'block';\n thisNode.classList.add( 'wptb-directlyhovered' );\n \n wptbContainer.addEventListener( 'scroll', correctTop, false );\n }\n \n// if( actionType == 1 || actionType == 2 ) {\n// this.setParameters( thisNode );\n// }\n// } else {\n// this.wptbActions.style.display = 'block';\n// thisNode.classList.add( 'wptb-directlyhovered' );\n// }\n \n this.leaveFromField = ( event, node, actionType ) => {\n if( event.relatedTarget ) {\n if ( event.relatedTarget.classList.contains( 'wptb-actions' ) ||\n event.relatedTarget.classList.contains( 'wptb-move-action' ) ||\n event.relatedTarget.classList.contains( 'wptb-duplicate-action' ) ||\n event.relatedTarget.classList.contains( 'wptb-delete-action' ) ) {\n if( ! this.wptbActions ) {\n this.wptbActions = document.getElementsByClassName( 'wptb-actions' )[0];\n }\n this.wptbActions.onmouseleave = ( event ) => {\n if( event.relatedTarget != null && event.relatedTarget != this.wptbActions.activeElem &&\n WPTB_Helper.findAncestor( event.relatedTarget, 'wptb-directlyhovered') != this.wptbActions.activeElem ) {\n event.target.activeElem.classList.remove( 'wptb-directlyhovered' );\n this.wptbActions.style.display = 'none';\n\n if( this.wptbActions.type == 2 ) {\n let wptbActionsField = new WPTB_ActionsField();\n\n wptbActionsField.addActionField( 1, event.relatedTarget.parentNode.parentNode );\n\n wptbActionsField.setParameters( event.relatedTarget.parentNode.parentNode );\n }\n } else {\n return;\n }\n }\n\n return;\n } \n// else if( event.relatedTarget.classList.contains( 'wptb-drop-handle' ) ) {\n// let wptbDropHandle = document.getElementsByClassName( 'wptb-drop-handle' );\n// if( wptbDropHandle.length > 0 ) {\n// wptbDropHandle = wptbDropHandle[0];\n// wptbDropHandle.onmouseleave\n// }\n// }\n }\n \n node.classList.remove( 'wptb-directlyhovered' );\n this.wptbActions.style.display = 'none';\n \n if( this.wptbActions.type == 2 ) {\n if( event.relatedTarget ) {\n if( event.relatedTarget.localName == 'ul' ) {\n //let wptbActionsField = new WPTB_ActionsField();\n\n this.addActionField( 1, event.relatedTarget.parentNode );\n\n this.setParameters( event.relatedTarget.parentNode );\n }\n }\n \n }\n }\n \n this.actionsRemove = () => {\n if( ! this.wptbActions ) {\n let actions = document.getElementsByClassName( 'wptb-actions' );\n if( actions.length > 0 ) {\n this.wptbActions = actions[0];\n }\n }\n \n if( this.wptbActions ) {\n this.wptbActions.parentNode.removeChild( this.wptbActions );\n }\n }\n \n this.actionsHide = () => {\n if( ! this.wptbActions ) {\n let actions = document.getElementsByClassName( 'wptb-actions' );\n if( actions.length > 0 ) {\n this.wptbActions = actions[0];\n }\n }\n \n if( this.wptbActions ) {\n this.wptbActions.style.opacity = 0;\n }\n }\n}","(function () {\n var WPTB_Builder = function () {\n var table_id = WPTB_Helper.detectMode();\n if ( table_id ) {\n var http = new XMLHttpRequest(),\n urlSet = ajaxurl + \"?action=get_table\" + '&id=' + table_id;\n http.open('GET', urlSet, true);\n http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');\n http.onreadystatechange = function (d) {\n if (this.readyState == 4 && this.status == 200) {\n var ans = JSON.parse(http.responseText);\n document.getElementById('wptb-setup-name').value = ans[0];\n \n if( ans[1] ) {\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'none';\n let wptbTableSetupEl = document.getElementsByClassName('wptb-table-setup')[0];\n wptbTableSetupEl.appendChild( WPTB_Parser( ans[1] ) );\n WPTB_Table();\n WPTB_LeftPanel();\n WPTB_Settings();\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n } else {\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\n }\n \n return;\n }\n };\n http.send(null);\n } else {\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\n }\n document.counter = new ElementCounters();\n document.select = new MultipleSelect();\n\n var initializer = WPTB_Initializer();\n settings = WPTB_Settings();\n };\n\n document.addEventListener('DOMContentLoaded', WPTB_Builder);\n})();","var WPTB_Button = function( text, DOMElementProt ) {\n \n var DOMElement = document.createElement('div'),\n elButton = document.createElement('div'),\n el_B = document.createElement('a'),\n el_BDiv = document.createElement( 'div' ),\n el_BDivP = document.createElement( 'p' ),\n kindIndexProt = undefined,\n copy = false;\n\n DOMElement.classList.add('wptb-button-container', 'wptb-size-M', 'wptb-');\n elButton.classList.add('wptb-button-wrapper');\n el_BDiv.classList.add('wptb-button');\n el_BDivP.innerHTML = text != undefined ? text : 'Button Text';\n \n // Creation of a new button when copying to avoid errors when assigning new event handlers.\n if ( DOMElementProt ) {\n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\n kindIndexProt = wptbElementMutch[1];\n copy = true;\n }; \n var attributesContainer = [...DOMElementProt.attributes];\n if ( attributesContainer.length > 0 ) {\n for( let i = 0; i < attributesContainer.length; i++ ) {\n DOMElement.setAttribute(attributesContainer[i].name, attributesContainer[i].value);\n } \n }\n \n var wptbButtonWrapper = DOMElementProt.querySelector( '.wptb-button-wrapper' );\n if ( wptbButtonWrapper ) {\n var wptbButtonWrapAttributes = [...wptbButtonWrapper.attributes];\n if ( wptbButtonWrapAttributes.length > 0 ) {\n for( let i = 0; i < wptbButtonWrapAttributes.length; i++ ) {\n if ( wptbButtonWrapAttributes[i].name == 'style') {\n elButton.setAttribute( wptbButtonWrapAttributes[i].name, wptbButtonWrapAttributes[i].value );\n }\n } \n }\n }\n \n var wptbButtonA = DOMElementProt.querySelector( 'a' );\n if ( wptbButtonA ) {\n var wptbButtonAttributes = [...wptbButtonA.attributes];\n if ( wptbButtonAttributes.length > 0 ) {\n for( let i = 0; i < wptbButtonAttributes.length; i++ ) {\n if ( wptbButtonAttributes[i].name == 'style' || \n wptbButtonAttributes[i].name == 'href' || \n wptbButtonAttributes[i].name == 'target' ) {\n el_B.setAttribute( wptbButtonAttributes[i].name, wptbButtonAttributes[i].value );\n }\n } \n }\n }\n \n var wptbButton = DOMElementProt.querySelector( '.wptb-button' );\n if ( wptbButton ) {\n var wptbButtonAttributes = [...wptbButton.attributes];\n if ( wptbButtonAttributes.length > 0 ) {\n for( let i = 0; i < wptbButtonAttributes.length; i++ ) {\n if ( wptbButtonAttributes[i].name == 'style') {\n el_BDiv.setAttribute( wptbButtonAttributes[i].name, wptbButtonAttributes[i].value );\n }\n } \n }\n }\n }\n \n elButton.appendChild(el_B);\n el_B.appendChild( el_BDiv );\n el_BDiv.appendChild( el_BDivP );\n DOMElement.appendChild(elButton);\n \n \n \n this.kind = 'button';\n\n this.getDOMElement = function () {\n return DOMElement;\n };\n\n applyGenericItemSettings( this, kindIndexProt, copy );\n \n return this;\n};","var WPTB_Cell = function (callback, DOMElement) {\n\n function highlightRow(td) {\n var parentRow = td.parentNode,\n columnCount = parseInt(document.getElementById('wptb-columns-number').value),\n tds = document.getElementsByClassName('wptb-preview-table')[0].getElementsByTagName('td');\n for (var i = 0; i < tds.length; i++) {\n tds[i].classList.remove('wptb-highlighted-row-first', 'wptb-highlighted-row-last', 'wptb-highlighted-row-inner', 'wptb-highlighted-column-first', 'wptb-highlighted-column-last', 'wptb-highlighted-column-inner');\n }\n for (var i = 0; i < columnCount; i++) {\n\n var classToAdd = i == 0 ? 'wptb-highlighted-row-first' : i == columnCount - 1 ? 'wptb-highlighted-row-last' : 'wptb-highlighted-row-inner';\n var ttd = parentRow.getElementsByTagName('td')[i];\n if (ttd !== td) {\n ttd.classList.add(classToAdd);\n }\n }\n }\n\n function highlightColumn(td) {\n\n var index,\n parentRow = td.parentNode;\n columnCount = parseInt(document.getElementById('wptb-columns-number').value), rowCount = parseInt(document.getElementById('wptb-rows-number').value), table = document.getElementsByClassName('wptb-preview-table')[0];\n for (var i = 0; i < columnCount; i++) {\n if (parentRow.getElementsByTagName('td')[i] === td) {\n index = i;\n break;\n }\n }\n\n for (var i = 0; i < rowCount; i++) {\n var classToAdd = i == 0 ? 'wptb-highlighted-column-first' : i == rowCount - 1 ? 'wptb-highlighted-column-last' : 'wptb-highlighted-column-inner';\n var tr = table.getElementsByTagName('tr')[i];\n if (tr.getElementsByTagName('td')[index] !== td) {\n tr.getElementsByTagName('td')[index].classList.add(classToAdd);\n }\n }\n }\n \n if( ! DOMElement ) {\n DOMElement = document.createElement(\"td\");\n\n DOMElement.style.padding = jQuery('#wptb-table-padding-number').val() + 'px';\n\n var innerBorderWidth = jQuery('#wptb-table-inner-border-number').val();\n\n if (innerBorderWidth != '' && parseInt(innerBorderWidth) != 0) {\n DOMElement.style.border = innerBorderWidth + 'px solid ' + jQuery('#wptb-table-border-color').val();\n } \n\n DOMElement.classList.add('wptb-droppable', 'wptb-cell');\n }\n\n DOMElement.draggable = false;\n if ( callback ) {\n DOMElement.onclick = callback;\n }\n \n WPTB_innerElementSet( DOMElement );\n \n let wptbPhElement = DOMElement.getElementsByClassName( 'wptb-ph-element' );\n \n if ( wptbPhElement.length > 0 ) {\n for( let i = 0; i < wptbPhElement.length; i++ ) {\n\n let wptbSpaceBetween = DOMElement.getElementsByClassName( 'wptb-space-between' );\n\n if ( wptbSpaceBetween.length > 0 ) {\n for( let j = 0; j < wptbSpaceBetween.length; j++ ) {\n WPTB_Space( wptbSpaceBetween[j] );\n }\n }\n \n wptbPhElement[i].getDOMElement = function() {\n return wptbPhElement[i];\n }\n \n WPTB_innerElementSet( wptbPhElement[i] );\n \n let wptbElementTypeClass = wptbPhElement[i].className.match( /wptb-element-((.+-)\\d+)/i );\n if( wptbElementTypeClass && Array.isArray( wptbElementTypeClass ) ) {\n let wptbTypeElementArr = wptbElementTypeClass[1].split( '-' );\n wptbPhElement[i].kind = wptbTypeElementArr[0];\n applyGenericItemSettings( wptbPhElement[i], wptbElementTypeClass[1] );\n if ( wptbPhElement[i].kind == 'list' ) {\n let wptbListItems = wptbPhElement[i].getElementsByTagName( 'li' );\n if( wptbListItems.length > 0 ) {\n for ( let i = 0; i < wptbListItems.length; i++ ) {\n WPTB_ListItem( undefined, wptbListItems[i] );\n }\n }\n }\n }\n }\n }\n\n this.getDOMElement = function () {\n return DOMElement;\n };\n\n this.setCoords = function (y, x) {\n var el = this.getDOMElement();\n el.dataset.yIndex = y;\n el.dataset.xIndex = x;\n };\n\n this.getCoords = function () {\n var coords,\n el = this.getDOMElement();\n coords.x = el.dataset.xIndex;\n coords.y = el.dataset.yIndex;\n return coords;\n };\n\n this.appendElement = function (node) {\n getDOMElement().appendChild(node);\n };\n \n DOMElement.getCellDimensions = function() {\n let tdStyleObj = window.getComputedStyle( this, null );\n \n let tdPaddingLeft = tdStyleObj.getPropertyValue( 'padding-left' );\n let tdPaddingRight = tdStyleObj.getPropertyValue( 'padding-right' );\n \n let tdBorderLeftWidth = tdStyleObj.getPropertyValue( 'border-left-width' );\n let tdBorderRightWidth = tdStyleObj.getPropertyValue( 'border-right-width' );\n \n let tdPaddingTop = tdStyleObj.getPropertyValue( 'padding-top' );\n let tdPaddingBottom = tdStyleObj.getPropertyValue( 'padding-bottom' );\n \n let tdBorderTopWidth = tdStyleObj.getPropertyValue( 'border-top-width' );\n let tdBorderBottomWidth = tdStyleObj.getPropertyValue( 'border-bottom-width' );\n \n let width = parseFloat( this.offsetWidth, 10 ) - \n parseFloat( tdPaddingLeft, 10 ) - \n parseFloat( tdPaddingRight, 10 ) -\n parseFloat( tdBorderLeftWidth, 10 ) -\n parseFloat( tdBorderRightWidth, 10 );\n \n let height = parseFloat( this.offsetHeight, 10 ) - \n parseFloat( tdPaddingTop, 10 ) - \n parseFloat( tdPaddingBottom, 10 ) -\n parseFloat( tdBorderTopWidth, 10 ) -\n parseFloat( tdBorderBottomWidth, 10 );\n \n return {\n width: width, \n height: height\n };\n }\n\n return this;\n};","var WPTB_DropHandle = function (thisElem, e) {\n \n let wptbDropHandle,\n wptbDropBorderMarker;\n if ( document.getElementsByClassName( 'wptb-drop-handle' ).length == 0 ) {\n wptbDropHandle = document.createElement( 'div' );\n wptbDropHandle.classList.add( 'wptb-drop-handle' );\n \n wptbDropBorderMarker = document.createElement( 'div' );\n wptbDropBorderMarker.classList.add( 'wptb-drop-border-marker' );\n \n let wptbDropBorderMarkerTop = document.createElement( 'div' ),\n wptbDropBorderMarkerRight = document.createElement( 'div' ),\n wptbDropBorderMarkerBottom = document.createElement( 'div' ),\n wptbDropBorderMarkerLeft = document.createElement( 'div' );\n \n wptbDropBorderMarkerTop.classList.add( 'wptb-drop-border-marker-top' );\n wptbDropBorderMarkerRight.classList.add( 'wptb-drop-border-marker-right' );\n wptbDropBorderMarkerBottom.classList.add( 'wptb-drop-border-marker-bottom' );\n wptbDropBorderMarkerLeft.classList.add( 'wptb-drop-border-marker-left' );\n \n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerTop );\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerRight );\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerBottom );\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerLeft );\n \n let body = document.getElementsByTagName( 'body' );\n if ( body.length > 0 ) {\n body[0].appendChild( wptbDropHandle );\n body[0].appendChild( wptbDropBorderMarker );\n }\n \n wptbDropHandle.ondragenter = function () {\n\n }\n\n wptbDropHandle.ondragover = function (e) {\n e.preventDefault();\n }\n\n wptbDropHandle.ondragleave = function () {\n\n }\n wptbDropHandle.ondrop = function (e) {\n e.preventDefault();\n let element;\n \n if ( e.dataTransfer.getData('wptbElement') ) {\n element = WPTB_Helper.newElementProxy( e.dataTransfer.getData('wptbElement') );\n element = element.getDOMElement();\n } else {\n element = document.getElementsByClassName( e.dataTransfer.getData('node') )[0];\n element.classList.remove( 'wptb-moving-mode' );\n element.classList.remove( 'wptb-moving-into-same-elem' );\n element.wptbMovingMode = 1;\n }\n \n let td;\n if( wptbDropHandle.dataset.text == 'Drop Here' ) {\n thisElem = wptbDropHandle.getDOMParentElement();\n if ( thisElem.nodeName.toLowerCase() == 'td' ) {\n td = wptbDropHandle.getDOMParentElement();\n td.appendChild( element );\n }\n } else {\n let innerElement = wptbDropHandle.getDOMParentElement();\n td = innerElement.parentNode;\n \n if( wptbDropHandle.dataset.text == 'Above Element' ) {\n td.insertBefore( element, innerElement );\n } else if( wptbDropHandle.dataset.text == 'Below Element' ) {\n let innerElementNext = innerElement.nextSibling;\n td.insertBefore( element, innerElementNext );\n }\n }\n \n let thisRow = td.parentNode\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\n WPTB_Helper.dataTitleColumnSet( table );\n }\n \n wptbDropHandle.style.display = 'none';\n wptbDropBorderMarker.style.display = 'none';\n \n WPTB_innerElementSet(element);\n console.log(element);\n if( ! element.classList.contains( 'wptb-image-container' ) || element.wptbMovingMode == 1 ) {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n element.wptbMovingMode == undefined;\n }\n }\n let wptbContainer = document.querySelector( '.wptb-container' );\n wptbContainer.onscroll = function() {\n wptbDropHandle.style.display = 'none';\n wptbDropBorderMarker.style.display = 'none';\n }\n } else {\n wptbDropHandle = document.getElementsByClassName( 'wptb-drop-handle' )[0];\n wptbDropBorderMarker = document.getElementsByClassName( 'wptb-drop-border-marker' )[0];\n }\n if( thisElem && thisElem.nodeName.toLowerCase() == 'td' && \n thisElem.getElementsByClassName( 'wptb-ph-element' ).length != 0 ) {\n return;\n }\n \n let thisRow;\n if ( thisElem.localName == 'td' ) {\n thisRow = thisElem.parentNode;\n } else if ( thisElem.localName == 'div' && thisElem.classList.contains( 'wptb-ph-element' ) ) {\n thisRow = thisElem.parentNode.parentNode;\n }\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\n let indics = e.dataTransfer.types;\n let notDragEnter = false;\n for ( let i = 0; i < indics.length; i++ ) {\n let infArr = indics[i].match( /wptbelindic-([a-z]+)/i );\n if ( infArr && infArr[1] != 'text' ) {\n notDragEnter = true;\n break;\n }\n }\n if( notDragEnter ) {\n return;\n }\n }\n \n wptbDropHandle.style.width = thisElem.offsetWidth + 'px';\n let height = thisElem.offsetHeight,\n coordinatesElement = thisElem.getBoundingClientRect(),\n left = 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_ElementOptions = function ( element, index, kindIndexProt ) {\n\n var node = element.getDOMElement(), elemIdClass;\n\n prop = document.querySelector(\".wptb-\" + element.kind + \"-options-prototype\").cloneNode(true);\n prop.classList.remove(\"wptb-\" + element.kind + \"-options-prototype\"); // remove prototype from the class\n elemIdClass = 'wptb-options-' + element.kind + \"-\" + index;\n\n var properties = prop.getElementsByClassName('wptb-element-property');\n\n for (var i = 0; i < properties.length; i++) {\n properties[i].dataset.element = elemIdClass;\n }\n\n prop.classList.add(elemIdClass);\n document.getElementById(\"element-options-group\").appendChild(prop);\n \n if ( kindIndexProt ) {\n if ( element.kind == 'button' ) {\n let affectedEl = document.getElementsByClassName( 'wptb-element-' + kindIndexProt )[0],\n wptbButtonWrapper,\n wptbButtonA,\n wptbButton,\n wptbSize;\n \n if ( affectedEl ) {\n wptbSize = affectedEl.className.match(/wptb-size-([a-z]+)/i);\n }\n \n if( wptbSize && Array.isArray( wptbSize ) ) {\n var b = prop.getElementsByClassName('wptb-btn-size-btn');\n \n for ( var i = 0; i < b.length; i++ ) {\n b[i].classList.remove( 'selected' );\n \n if ( b[i].innerHTML == wptbSize[1] ) {\n b[i].classList.add( 'selected' );\n }\n }\n }\n \n if( affectedEl ) {\n wptbButtonWrapper = affectedEl.getElementsByClassName( 'wptb-button-wrapper' );\n \n wptbButtonA = affectedEl.getElementsByTagName( 'a' );\n \n wptbButton = affectedEl.getElementsByClassName( 'wptb-button' );\n }\n \n if ( wptbButtonWrapper ) {\n let buttonAlignment = wptbButtonWrapper[0].style.justifyContent,\n buttonAlignmentSelect = prop.querySelector( 'select[data-type=\"button-alignment\"]' ),\n selectOption = buttonAlignmentSelect.getElementsByTagName( 'option' ),\n selectOptionVal;\n \n if ( buttonAlignment == 'flex-start' ) {\n selectOptionVal = 'left';\n } else if ( buttonAlignment == 'center' || ! buttonAlignment ) {\n selectOptionVal = 'center';\n } else if ( buttonAlignment == 'flex-end' ) {\n selectOptionVal = 'right';\n }\n \n for ( let i = 0; i < selectOption.length; i++ ) {\n if ( selectOption[i].value == selectOptionVal ) {\n selectOption[i].selected = true;\n }\n }\n }\n \n if ( wptbButtonA.length > 0 ) {\n let buttonHref = wptbButtonA[0].getAttribute( 'href' ), \n buttonLinkTarget = wptbButtonA[0].getAttribute( 'target' ),\n buttonId = wptbButtonA[0].getAttribute( 'id' ),\n \n \n buttonHrefInput = prop.querySelector( 'input[data-type=\"button-link\"]' ),\n buttonLinkTargetInput = prop.querySelector( 'input[data-type=\"button-link-target\"]' ),\n buttonLinkTargetInputId = buttonLinkTargetInput.getAttribute( 'id' ),\n buttonLinkTargetInputLabel = buttonLinkTargetInput.parentNode.getElementsByTagName( 'label' )[0],\n \n buttotIdInput = prop.querySelector( 'input[data-type=\"button-id\"]' );\n\n buttonLinkTargetInputId = buttonLinkTargetInputId + '-' + kindIndexProt.split( '-' )[1];\n buttonLinkTargetInput.setAttribute( 'id', buttonLinkTargetInputId );\n buttonLinkTargetInputLabel.setAttribute( 'for', buttonLinkTargetInputId );\n\n buttonHrefInput.value = buttonHref;\n\n if( buttonLinkTarget && buttonLinkTarget == '_blank') {\n buttonLinkTargetInput.checked = true;\n }\n \n buttotIdInput.value = buttonId;\n }\n \n if( wptbButton ) {\n let buttonTextColor = wptbButton[0].style.color,\n buttonColor = wptbButton[0].style.backgroundColor,\n buttonTextColorInput = prop.querySelector( 'input[data-type=\"button-text-color\"]' ),\n buttonBackgroundColorInput = prop.querySelector( 'input[data-type=\"button-color\"]' );\n \n \n buttonTextColorInput.value = WPTB_Helper.rgbToHex( buttonTextColor );\n \n buttonBackgroundColorInput.value = WPTB_Helper.rgbToHex( buttonColor );\n \n }\n } else if ( element.kind == 'image' ) {\n let affectedEl = document.getElementsByClassName( 'wptb-element-' + kindIndexProt );\n if ( affectedEl.length > 0 ) {\n let elementsA = affectedEl[0].getElementsByTagName( 'a' );\n if ( elementsA.length > 0 ) {\n let a = elementsA[0];\n\n if ( a ) {\n // set select according to the alignment of the image\n let imgAlign;\n if( a.style.float == 'none' ) {\n imgAlign = 'center';\n } else {\n imgAlign = a.style.float;\n }\n let imageAlignmentSelect = prop.querySelector( 'select[data-type=\"image-alignment\"]' ),\n selectOption = imageAlignmentSelect.getElementsByTagName( 'option' );\n\n for ( let i = 0; i < selectOption.length; i++ ) {\n if ( selectOption[i].value == imgAlign ) {\n selectOption[i].selected = true;\n }\n }\n\n a.onclick = function( e ) {\n e.preventDefault();\n }\n\n // set text link for input field of setting panel\n let imageLinkHref = a.getAttribute( 'href' ),\n inputImageLink = prop.querySelector( 'input[data-type=\"image-link\"]' );\n if ( imageLinkHref ) {\n inputImageLink.value = imageLinkHref;\n }\n\n // set checkbox for target of link \n let imageLinkTarget = a.getAttribute( 'target' ),\n imageLinkTargetInput = prop.querySelector( 'input[data-type=\"image-link-target\"]' ),\n imageLinkTargetInputId = imageLinkTargetInput.getAttribute( 'id' ),\n imageLinkTargetInputLabel = imageLinkTargetInput.parentNode.getElementsByTagName( 'label' )[0];\n\n imageLinkTargetInputId = imageLinkTargetInputId + '-' + kindIndexProt.split( '-' )[1];\n\n imageLinkTargetInput.setAttribute( 'id', imageLinkTargetInputId );\n imageLinkTargetInputLabel.setAttribute( 'for', imageLinkTargetInputId );\n\n if ( imageLinkTarget && imageLinkTarget == '_blank' ) {\n imageLinkTargetInput.checked = true;\n }\n\n // set value for input fields of image size\n let imgWidth = a.style.width;\n if ( imgWidth ) {\n let imageWidthInputRange = prop.querySelector( 'input[type=\"range\"][data-type=\"image-size\"]' ),\n imageWidthInputNumber = prop.querySelector( 'input[type=\"number\"][data-type=\"image-size\"]' );\n\n imageWidthInputRange.value = parseInt( imgWidth );\n imageWidthInputNumber.value = parseInt( imgWidth );\n }\n\n let img = a.getElementsByTagName( 'img' );\n if ( img.length > 0 ) {\n // set value for input field of alternative text image\n let imgAlternativeText = img[0].getAttribute('alt'),\n imageAlternativeTextInput = prop.querySelector( 'input[type=\"text\"][data-type=\"alternative-text\"]' );\n\n imageAlternativeTextInput.value = imgAlternativeText;\n }\n }\n }\n }\n } else if ( element.kind == 'text' ) {\n let affectedEl = document.getElementsByClassName( 'wptb-element-' + kindIndexProt );\n if ( affectedEl.length > 0 ) {\n let elementFontSize = affectedEl[0].style.fontSize,\n elementTextColor = affectedEl[0].style.color;\n let textFontSizeInputRange = prop.querySelector( 'input[type=\"range\"][data-type=\"font-size\"]' ),\n textFontSizeInputNumber = prop.querySelector( 'input[type=\"number\"][data-type=\"font-size\"]' ),\n textColorInput = prop.querySelector( 'input[type=\"text\"][data-type=\"color\"]' );\n\n textFontSizeInputRange.value = parseInt( elementFontSize ) ? parseInt( elementFontSize ) : 10;\n textFontSizeInputNumber.value = parseInt( elementFontSize ) ? parseInt( elementFontSize ) : 10;\n textColorInput.value = WPTB_Helper.rgbToHex( elementTextColor );\n }\n } else if ( element.kind == 'list' ) {\n let elementList = document.getElementsByClassName( 'wptb-element-' + kindIndexProt );\n if ( elementList.length > 0 ) {\n let elementListColor = elementList[0].querySelector( 'p' ).style.color;\n let listColorInput = prop.querySelector( 'input[type=\"text\"][data-type=\"list-text-color\"]' );\n listColorInput.value = WPTB_Helper.rgbToHex( elementListColor );\n \n let elementListItem = elementList[0].querySelectorAll( 'li' );\n if ( elementListItem.length > 0 ) {\n let listItemP = elementListItem[0].querySelector( 'p' );\n let listItemPClasses = listItemP.classList;\n //listItemPClasses = [...listItemPClasses];\n if ( listItemPClasses.length > 0 ) {\n let elementListClassSelect = prop.querySelector( 'select[data-type=\"list-class\"]' );\n if ( elementListClassSelect ) {\n elementListClassSelect.value = 'unordered';\n \n let listIconSelectLabel = elementListClassSelect.parentNode.nextSibling;\n for ( let i = 0; i < 10; i++ ) {\n if ( listIconSelectLabel.nodeType == '1' ) {\n break;\n } else {\n listIconSelectLabel = listIconSelectLabel.nextSibling;\n }\n }\n if ( listIconSelectLabel ) {\n let listIconSelectLabelId = listIconSelectLabel.getAttribute( 'id' );\n listIconSelectLabel.setAttribute( 'id', listIconSelectLabelId + '-' + kindIndexProt );\n listIconSelectLabel.style.display = 'flex';\n }\n \n let elementListStyleTypeSelect = prop.querySelector( 'select[data-type=\"list-style-type\"]' );\n if ( elementListStyleTypeSelect ) {\n elementListStyleTypeSelect.parentNode.style.display = 'flex';\n \n if( listItemPClasses.contains( 'wptb-list-style-type-disc' ) ) {\n elementListStyleTypeSelect.value = 'disc';\n } else if( listItemPClasses.contains( 'wptb-list-style-type-circle' ) ) {\n elementListStyleTypeSelect.value = 'circle';\n } else if( listItemPClasses.contains( 'wptb-list-style-type-square' ) ) {\n elementListStyleTypeSelect.value = 'square';\n } else if ( listItemPClasses.contains( 'wptb-list-style-type-none' ) ) {\n elementListStyleTypeSelect.value = 'none';\n }\n }\n }\n }\n }\n \n let elementListItemContent = elementList[0].getElementsByClassName( 'wptb-list-item-content' );\n if ( elementListItemContent.length > 0 ) {\n let listItemPTextAlignArr = [];\n for ( let i = 0; i < elementListItemContent.length; i++ ) {\n let p = elementListItemContent[i].querySelector( 'p' );\n if ( p ) {\n if ( p.style.textAlign ) {\n listItemPTextAlignArr.push( p.style.textAlign );\n } else {\n listItemPTextAlignArr.push( 'left' );\n }\n }\n \n }\n \n let listItemPTextAlignLeftCount = 0,\n listItemPTextAlignCenterCount = 0,\n listItemPTextAlignRightCount = 0;\n \n if ( listItemPTextAlignArr.length > 0 ) {\n for ( let i = 0; i < listItemPTextAlignArr.length; i++ ) {\n if ( listItemPTextAlignArr[i] ) {\n if ( listItemPTextAlignArr[i] == 'left' ) {\n listItemPTextAlignLeftCount++;\n } else if ( listItemPTextAlignArr[i] == 'center' ) {\n listItemPTextAlignCenterCount++;\n } else if ( listItemPTextAlignArr[i] == 'right' ) {\n listItemPTextAlignRightCount++;\n }\n }\n }\n }\n \n let elementListAlignmentSelect = prop.querySelector( 'select[data-type=\"list-alignment\"]' ),\n maxListItemTAlLeftC = Math.max( listItemPTextAlignLeftCount, listItemPTextAlignCenterCount, listItemPTextAlignRightCount );\n \n if ( listItemPTextAlignLeftCount == maxListItemTAlLeftC ) {\n elementListAlignmentSelect.value = 'left';\n } else if ( listItemPTextAlignCenterCount == maxListItemTAlLeftC ) {\n elementListAlignmentSelect.value = 'center';\n } else if ( listItemPTextAlignRightCount == maxListItemTAlLeftC ) {\n elementListAlignmentSelect.value = 'right';\n }\n }\n } \n } else if( element.kind == 'star_rating' ) {\n let affectedEl = document.getElementsByClassName( 'wptb-element-' + kindIndexProt );\n if( affectedEl.length > 0 ) {\n affectedEl = affectedEl[0];\n let ratingStar = affectedEl.querySelector( 'li' );\n if( ratingStar ) {\n let ratingStarSize = ratingStar.style.width;\n let starSizeInputRange = prop.querySelector( 'input[type=\"range\"][data-type=\"star-size\"]' ),\n starSizeInputNumber = prop.querySelector( 'input[type=\"number\"][data-type=\"star-size\"]' );\n\n starSizeInputRange.value = parseInt( ratingStarSize ) ? parseInt( ratingStarSize ) : 10;\n starSizeInputNumber.value = parseInt( ratingStarSize ) ? parseInt( ratingStarSize ) : 10;\n\n if( ratingStar.querySelector( 'span' ) ) {\n let starColorInput = prop.querySelector( 'input[type=\"text\"][data-type=\"star-color\"]' ),\n ratingStarColor = ratingStar.querySelector( 'span' ).style.fill;\n starColorInput.value = WPTB_Helper.rgbToHex( ratingStarColor );\n }\n }\n \n let ratingStars = affectedEl.querySelectorAll( 'li' );\n let starsCountInputNumber = prop.querySelector( 'input[type=\"number\"][data-type=\"stars-count\"]' );\n if( ratingStars.length == 1 && ratingStars[0].style.display == 'none' ) {\n starsCountInputNumber.value = 0;\n } else {\n starsCountInputNumber.value = ratingStars.length;\n }\n\n let successBox = affectedEl.querySelector( '.wptb-success-box' );\n if( successBox ) {\n let showNumberRatingCheckbox = prop.querySelector( 'input[type=\"checkbox\"][data-type=\"show-number-rating\"]' );\n if( successBox.style.display == 'block' ) {\n showNumberRatingCheckbox.checked = true;\n let numeralRatingOptionContainers = prop.getElementsByClassName( 'wptb-numeral-rating-option-container' );\n for( let i = 0; i < numeralRatingOptionContainers.length; i++ ) {\n numeralRatingOptionContainers[i].style.display = 'block';\n }\n } else {\n showNumberRatingCheckbox.checked = false;\n }\n\n let wptbTextMessage = successBox.querySelector( '.wptb-text-message' );\n if( wptbTextMessage ) {\n let numberRatingSize = wptbTextMessage.style.fontSize;\n let numberRatingColor = wptbTextMessage.style.color;\n\n let numberSizeInputRange = prop.querySelector( 'input[type=\"range\"][data-type=\"numeral-rating-size\"]' ),\n numberSizeInputNumber = prop.querySelector( 'input[type=\"number\"][data-type=\"numeral-rating-size\"]' ),\n numberColorInput = prop.querySelector( 'input[type=\"text\"][data-type=\"numeral-rating-color\"]' );\n\n numberSizeInputRange.value = parseInt( numberRatingSize ) ? parseInt( numberRatingSize ) : 10;\n numberSizeInputNumber.value = parseInt( numberRatingSize ) ? parseInt( numberRatingSize ) : 10;\n numberColorInput.value = WPTB_Helper.rgbToHex( numberRatingColor );\n }\n }\n }\n }\n }\n\n node.onclick = function () {\n var infArr = this.className.match(/wptb-element-((.+-)\\d+)/i),\n optionsClass = '.wptb-' + infArr[2] + 'options' +\n '.wptb-options-' + infArr[1];\n\n document.getElementsByClassName('wptb-elements-container')[0].style.display = 'none';\n document.getElementsByClassName('wptb-settings-section')[0].style.display = 'none';\n document.getElementById(\"element-options-group\").style.display = 'block';\n\n var children = document.getElementById(\"element-options-group\").childNodes;\n for (var i = 0; i < children.length; i++) {\n if (children[i].style)\n children[i].style.display = 'none';\n }\n\n document.querySelector(optionsClass).style.display = 'block';\n\n //var listStyleType, textAlign;\n\n// switch (element.kind) {\n\n// case 'text':\n// jQuery(prop).find('[data-type=color]').wpColorPicker({ defaultColor: node.style.color });\n// prop.querySelector('[type=number][data-type=font-size]').value\n// = prop.querySelector('[type=range][data-type=font-size]').value\n// = node.style.fontSize.substring(0, node.style.fontSize.length - 2);\n// break;\n// case 'list':\n// textAlign = node.querySelector('li p').style.textAlign;\n// listStyleType = node.querySelector('li').style.listStyleType;\n// if ( prop.querySelector( 'select[data-type=list-class]' ) ) {\n// console.log(textAlign);\n// console.log(listStyleType);\n// console.log(listStyleType);\n// console.log(prop);\n// prop.querySelector('select[data-type=list-class]').selectedIndex = ( listStyleType == 'decimal' ? 0 : 1 );\n// }\n// if ( prop.querySelector('select[data-type=list-style-type]') ) {\n// prop.querySelector('select[data-type=list-style-type]').selectedIndex = (listStyleType == 'circle' ? 0 : (listStyleType == 'square' ? 1 : 2));\n// }\n// if ( prop.querySelector('select[data-type=list-alignment]') ) {\n// prop.querySelector('select[data-type=list-alignment]').selectedIndex = (textAlign == 'left' ? 0 : (textAlign == 'center' ? 1 : 2));\n// }\n// break;\n// case 'image':\n// break;\n// case 'button':\n// jQuery(prop).find('[data-type=button-color]').wpColorPicker({ defaultColor: node.style.backgroundColor });\n// break;\n//\n// }\n };\n\n if (element.kind == 'button') {\n //We must add this special kind of property, since it is triggered with click event\n var buttons = prop.getElementsByClassName('wptb-btn-size-btn');\n\n for (var i = 0; i < buttons.length; i++) {\n buttons[i].onclick = function () {\n var size = this.innerHTML,\n n_Class = this.dataset.element,\n infArr = n_Class.match(/wptb-options-(.+)-(\\d+)/i),\n type = infArr[1],\n num = infArr[2],\n affectedEl = document.getElementsByClassName('wptb-element-' + type + '-' + num)[0];\n affectedEl.classList.remove('wptb-size-S');\n affectedEl.classList.remove('wptb-size-M');\n affectedEl.classList.remove('wptb-size-L');\n affectedEl.classList.remove('wptb-size-XL');\n affectedEl.classList.add('wptb-size-' + size);\n var b = this.parentNode.getElementsByClassName('wptb-btn-size-btn');\n for (var i = 0; i < b.length; i++) {\n b[i].classList.remove('selected');\n }\n this.classList.add('selected');\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n }\n }\n\n var optionControls = prop.getElementsByClassName('wptb-element-property');\n\n for (var i = 0; i < optionControls.length; i++) {\n if ( optionControls[i].classList.contains( 'wptb-color-picker' ) ) {\n jQuery(optionControls[i]).wpColorPicker({\n change: function ( event, ui ) {\n WPTB_Helper.wpColorPickerChange( event, ui );\n \n //console.log(event);\n WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving( event );\n },\n clear: function( event ) {\n WPTB_Helper.wpColorPickerChange( event );\n }\n });\n }\n \n if( optionControls[i].classList.contains( 'wptb-stars-count-field' ) ) {\n WPTB_Helper.numberImputSize( optionControls[i], 1, 10 );\n }\n\n if ( optionControls[i].dataset.type === 'font-size' || optionControls[i].dataset.type === 'image-size' ||\n optionControls[i].dataset.type === 'star-size' || optionControls[i].dataset.type === 'numeral-rating-size' ) {\n var slider = optionControls[i].parentNode.parentNode.getElementsByClassName('wptb-size-slider')[0];\n slider.oninput = function () {\n this.parentNode.parentNode.getElementsByClassName('wptb-size-number')[0].value = this.value;\n this.parentNode.parentNode.getElementsByClassName('wptb-size-number')[0].onchange( event );\n }\n }\n\n// if (optionControls[i].dataset.type === 'image-size') {\n// var slider = optionControls[i].parentNode.parentNode.getElementsByClassName('wptb-size-slider')[0];\n// slider.oninput = function () {\n// this.parentNode.parentNode.getElementsByClassName('wptb-size-number')[0].value = this.value;\n// this.parentNode.parentNode.getElementsByClassName('wptb-size-number')[0].onchange( event );\n// }\n// }\n// \n// if ( optionControls[i].dataset.type === 'star-size' ) {\n// var slider = optionControls[i].parentNode.parentNode.getElementsByClassName('wptb-size-slider')[0];\n// slider.oninput = function () {\n// this.parentNode.parentNode.getElementsByClassName('wptb-size-number')[0].value = this.value;\n// this.parentNode.parentNode.getElementsByClassName('wptb-size-number')[0].onchange( event );\n// }\n// }\n\n optionControls[i].onchange = function ( event ) {\n var n_Class = this.dataset.element,\n infArr = n_Class.match(/wptb-options-(.+)-(\\d+)/i),\n type = infArr[1],\n num = infArr[2],\n affectedEl = document.getElementsByClassName('wptb-element-' + type + '-' + num)[0],\n val = this.value;\n\n switch ( this.dataset.type ) {\n case 'src':\n var img = affectedEl.getElementsByTagName(\"img\")[0];\n img.src = this.value;\n break;\n case 'alternative-text':\n var img = affectedEl.getElementsByTagName('img')[0];\n img.alt = this.value;\n break;\n case 'image-link':\n affectedEl.getElementsByTagName('a')[0].href = WPTB_Helper.linkHttpCheckChange( this.value );\n break;\n case 'image-link-target':\n if (this.checked == true) {\n affectedEl.getElementsByTagName('a')[0].target = '_blank';\n } else {\n affectedEl.getElementsByTagName('a')[0].target = '_self';\n }\n break;\n case 'image-link-nofollow':\n if (this.checked == true) {\n affectedEl.getElementsByTagName('a')[0].rel = 'nofollow';\n } else {\n affectedEl.getElementsByTagName('a')[0].removeAttribute('rel');\n }\n break;\n case 'image-size':\n affectedEl.getElementsByTagName('a')[0].style.width = this.value + '%';\n affectedEl.getElementsByTagName('a')[0].style.height = 'auto';\n this.parentNode.parentNode.getElementsByClassName('wptb-size-slider')[0].value = this.value;\n break;\n case 'image-alignment':\n let wptbImageFloatValue = '';\n if( this.value == 'center' ) {\n wptbImageFloatValue = 'none';\n } else {\n wptbImageFloatValue = this.value;\n }\n affectedEl.querySelector( '.wptb-image-wrapper a' ).style.float = wptbImageFloatValue;\n break;\n case 'font-size':\n affectedEl.style.fontSize = val + 'px';\n this.parentNode.parentNode.getElementsByClassName('wptb-size-slider')[0].value = this.value;\n break;\n case 'button-alignment':\n var jc = '';\n if (this.value == 'left') {\n jc = 'start';\n } else if (this.value == 'right') {\n jc = 'flex-end';\n } else {\n jc = 'center';\n }\n affectedEl.getElementsByClassName('wptb-button-wrapper')[0].style.justifyContent = jc;\n break;\n case 'button-link':\n if ( this.value ) {\n affectedEl.getElementsByTagName( 'a' )[0].href = WPTB_Helper.linkHttpCheckChange( this.value );\n } else {\n affectedEl.getElementsByTagName( 'a' )[0].removeAttribute( 'href' );\n }\n break;\n case 'button-link-target':\n if (this.checked == true) {\n affectedEl.getElementsByTagName('a')[0].target = '_blank';\n } else {\n affectedEl.getElementsByTagName('a')[0].target = '_self';\n }\n break;\n case 'button-link-nofollow':\n if (this.checked == true) {\n affectedEl.getElementsByTagName('a')[0].rel = 'nofollow';\n } else {\n affectedEl.getElementsByTagName('a')[0].removeAttribute( 'rel' );\n }\n break;\n case 'button-id':\n if( this.value ) {\n affectedEl.getElementsByTagName( 'a' )[0].id = this.value;\n } else {\n affectedEl.getElementsByTagName( 'a' )[0].removeAttribute( 'id' );\n }\n case 'button-color':\n break;\n case 'list-alignment':\n let listItems = affectedEl.querySelectorAll('li');\n for (var i = 0; i < listItems.length; i++) {\n let p = listItems[i].querySelector( 'p' );\n if ( p ) {\n p.style.textAlign = this.value;\n }\n }\n break;\n case 'list-class':\n let parentNode = event.target\n .parentNode\n .parentNode\n .querySelector('[data-type=list-style-type]')\n .parentNode,\n parentNodeSettingItem = parentNode.parentNode;\n if (val == 'unordered') {\n parentNode.style.display = 'flex';\n \n parentNodeSettingItem.querySelector( '.wptb-list-icon-select-label' ).style.display = 'flex';\n let listItem = affectedEl.querySelectorAll('li');\n for (var i = 0; i < listItem.length; i++) {\n let p = listItem[i].querySelector( 'p' );\n p.removeAttribute ( 'class' );\n p.classList.add( 'wptb-list-style-type-disc' );\n }\n parentNodeSettingItem.querySelector('[data-type=list-style-type]').value = 'disc';\n } else {\n parentNode.style.display = 'none';\n parentNodeSettingItem.querySelector( '.wptb-list-icon-select-label' ).style.display = 'none';\n var listItem = affectedEl.querySelectorAll('li');\n for (var i = 0; i < listItem.length; i++) {\n let p = listItem[i].querySelector( 'p' );\n p.removeAttribute ( 'class' );\n }\n }\n break;\n case 'list-style-type':\n var listItem = affectedEl.querySelectorAll('li');\n for (var i = 0; i < listItem.length; i++) {\n let p = listItem[i].querySelector( 'p' );\n p.removeAttribute ( 'class' );\n p.classList.add( 'wptb-list-style-type-' + val.toLowerCase() );\n }\n break;\n case 'star-size':\n let ratingStar = affectedEl.querySelectorAll('li');\n for( let i = 0; i < ratingStar.length; i++ ) {\n ratingStar[i].style.width = val + 'px';\n ratingStar[i].style.height = val + 'px';\n let span = ratingStar[i].querySelectorAll( 'span' );\n for( let j = 0; j < span.length; j++ ) {\n if( span[j].querySelector( 'svg' ) ) {\n span[j].style.width = val + 'px';\n span[j].style.height = val + 'px';\n span[j].querySelector( 'svg' ).style.width = val + 'px';\n }\n }\n }\n break;\n case 'show-number-rating':\n let wptbNumeralRatingOptionContainer = WPTB_Helper.findAncestor( this, 'wptb-star_rating-options' )\n .getElementsByClassName( 'wptb-numeral-rating-option-container' );\n \n WPTB_Helper.starRatingTextMessageChenge( affectedEl );\n \n if( wptbNumeralRatingOptionContainer.length > 0 ) {\n let wptbTextMessage = affectedEl.querySelector( '.wptb-text-message' );\n \n let val = this.checked ? 'checked' : 'unchecked';\n if( val== 'checked' ) {\n for ( let i = 0; i < wptbNumeralRatingOptionContainer.length; i++ ) {\n wptbNumeralRatingOptionContainer[i].style.display = 'block';\n }\n wptbTextMessage.parentNode.style.display = 'block';\n } else if ( val == 'unchecked' ) {\n for ( let i = 0; i < wptbNumeralRatingOptionContainer.length; i++ ) {\n wptbNumeralRatingOptionContainer[i].style.display = 'none';\n }\n wptbTextMessage.parentNode.style.display = 'none';\n }\n }\n break;\n case 'numeral-rating-size':\n let wptbTextMessageSize = affectedEl.querySelector('.wptb-text-message');\n wptbTextMessageSize.style.fontSize = val + 'px';\n wptbTextMessageSize.style.height = val + 'px';\n wptbTextMessageSize.style.lineHeight = val + 'px';\n break;\n case 'stars-count':\n let starRatings = affectedEl.querySelectorAll( 'li' );\n \n let starRatingsCount = starRatings.length;\n \n if( val > starRatingsCount ) {\n let difference = val - starRatingsCount;\n let starRatingsLast = starRatings[starRatings.length - 1];\n \n let parent = starRatingsLast.parentNode;\n for( let i = 0; i < difference; i++ ){\n let newStarRating = starRatingsLast.cloneNode( true );\n newStarRating.removeAttribute( 'class' );\n newStarRating.setAttribute( 'class', 'wptb-rating-star' );\n newStarRating.dataset.value = parseInt(starRatingsLast.dataset.value) + i + 1;\n WPTB_Helper.starRatingEventHandlersAdd( newStarRating );\n parent.appendChild( newStarRating );\n }\n } else if( val < starRatingsCount ) {\n let difference = parseInt( starRatingsCount ) - parseInt( val );\n \n if( val == 0 ) {\n difference--;\n starRatings[0].removeAttribute( 'class' );\n starRatings[0].setAttribute( 'class', 'wptb-rating-star' );\n starRatings[0].style.display = 'none';\n }\n \n let starRatingLength = starRatings.length;\n for( i = 0; i < difference; i++ ) {\n starRatings[0].parentNode.removeChild( starRatings[starRatingLength - i - 1] );\n }\n } else if( val == starRatingsCount && starRatingsCount == 1 ) {\n starRatings[0].style.display = 'inline-block';\n }\n \n WPTB_Helper.starRatingTextMessageChenge( affectedEl );\n \n break;\n }\n \n \n if( event.target.classList.contains( 'wptb-size-slider' ) || event.target.classList.contains( 'wptb-size-slider' ) ) {\n event.target.onmouseup = function() {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n } else {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n }\n }\n};","var WPTB_Helper = {\n hexToRgb: function( hex ) {\n var result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec( hex );\n return result ? 'rgb(' + parseInt( result[1], 16 ) + ',' + parseInt( result[2], 16 ) + ',' + parseInt( result[3], 16 ) + ')' : null;\n },\n rgbToHex: function ( rgb ) {\n var rgb = rgb.match( /^rgba?[\\s+]?\\([\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?/i );\n\n return ( rgb && rgb.length === 4 ) ? \"#\" +\n ( \"0\" + parseInt( rgb[1],10 ).toString( 16 )).slice( -2 ) +\n ( \"0\" + parseInt( rgb[2],10 ).toString( 16 )).slice( -2 ) +\n ( \"0\" + parseInt( rgb[3],10 ).toString( 16 )).slice( -2 ) : '';\n },\n getDragImageCustom: function ( type ) {\n let hostName = location.protocol + '//' + location.hostname;\n let img = document.createElement( 'img' );\n img.src = hostName + '/wp-content/plugins/wp-table-builder/inc/admin/views/builder/icons/' + type + '.png';\n return img;\n },\n dragImagesArr: function() {\n return {\n text: WPTB_Helper.getDragImageCustom( 'text' ),\n image: WPTB_Helper.getDragImageCustom( 'image' ),\n button: WPTB_Helper.getDragImageCustom( 'button' ),\n list: WPTB_Helper.getDragImageCustom( 'list' ),\n star_rating: WPTB_Helper.getDragImageCustom( 'half-filled-rating-star' )\n };\n },\n listItemsRecalculateIndex: function( ulElem ) {\n let par = ulElem.querySelectorAll( 'p' );\n if ( par.length > 0 ) {\n for ( let i = 0; i < par.length; i++ ) {\n par[i].dataset.listStyleTypeIndex = Number( i ) + 1 + '.';\n }\n }\n },\n listItemsTinyMceInit: function( listItem ) {\n tinyMCE.init({\n target: listItem,\n inline: true,\n plugins: \"link, paste\",\n dialog_type: \"modal\",\n theme: 'modern',\n menubar: false,\n fixed_toolbar_container: '#wpcd_fixed_toolbar',\n paste_as_text: true,\n toolbar: 'bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify',\n setup: function(ed) {\n ed.on('keydown', function(e) {\n let article = e.target.parentNode;\n if ( e.keyCode == 13 ) {\n e.preventDefault();\n let text = e.target.innerHTML;\n let duplicate = new WPTB_ListItem( text, article, true );\n \n article.parentNode.insertBefore( duplicate.getDOMElement(), article );\n WPTB_Helper.listItemsTinyMceInit( duplicate.getDOMElement().firstChild );\n e.target.querySelector( 'p' ).innerText = 'New List Item';\n //tinyMCE.execCommand('mceInsertContent', false, 'New List Item');\n WPTB_Helper.listItemsRecalculateIndex( article.parentNode );\n \n return;\n \n } else if ( e.keyCode == '8' || e.keyCode == '46' ) {\n let p = e.target.querySelector( 'p' );\n let pText = p.innerHTML.replace(/<[^>]+>/g, '');\n pText = pText.replace( /\\s+/g, ' ' ).trim();\n pText = pText.replace( / /g, '').trim();\n \n if( pText == '' ) {\n e.preventDefault();\n e.target.querySelector( 'p' ).innerText = '\\n';\n } else {\n let selectedText = WPTB_Helper.getSelectionText();\n selectedText = selectedText.replace( /\\s+/g, ' ' ).trim();\n selectedText = selectedText.replace( / /g, '' ).trim();\n if( selectedText == pText ) {\n e.preventDefault();\n e.target.querySelector( 'p' ).innerText = '\\n';\n }\n }\n }\n \n let wptbListItem = e.target.parentNode;\n let wptbActionsField = new WPTB_ActionsField();\n\n wptbActionsField.addActionField( 2, wptbListItem );\n\n wptbActionsField.setParameters( wptbListItem );\n });\n \n ed.on( 'keyup', function( e ) {\n let wptbListItem = e.target.parentNode;\n let wptbActionsField = new WPTB_ActionsField();\n\n wptbActionsField.addActionField( 2, wptbListItem );\n\n wptbActionsField.setParameters( wptbListItem );\n \n e.target.onblur = function() {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n });\n },\n init_instance_callback: function (editor) {\n window.currentEditor = editor;\n editor.on('focus', function (e) {\n var totalWidth = document.getElementsByClassName('wptb-builder-panel')[0].offsetWidth;\n if (window.currentEditor &&\n document.getElementById('wptb_builder').scrollTop >= 55 &&\n window.currentEditor.bodyElement.style.display != 'none') {\n document.getElementById('wpcd_fixed_toolbar').style.position = 'fixed';\n document.getElementById('wpcd_fixed_toolbar').style.right = (totalWidth / 2 - document.getElementById('wpcd_fixed_toolbar').offsetWidth / 2) + 'px';\n document.getElementById('wpcd_fixed_toolbar').style.top = '100px';\n } else {\n document.getElementById('wpcd_fixed_toolbar').style.position = 'static';\n delete document.getElementById('wpcd_fixed_toolbar').style.right;\n delete document.getElementById('wpcd_fixed_toolbar').style.top;\n }\n });\n }\n });\n },\n buttonsTinyMceInit: function( target ) {\n tinyMCE.init({\n target: target,\n inline: true,\n plugins: \"link\",\n dialog_type: \"modal\",\n theme: 'modern',\n menubar: false,\n fixed_toolbar_container: '#wpcd_fixed_toolbar',\n toolbar: 'bold italic strikethrough',\n setup : function(ed) {\n ed.on( 'keydown', function(e) {\n if (e.keyCode == 13) {\n e.preventDefault();\n }\n let wptbButtonContainer = WPTB_Helper.findAncestor( target, 'wptb-button-container' );\n \n let wptbActionsField = new WPTB_ActionsField();\n\n wptbActionsField.addActionField( 1, wptbButtonContainer );\n\n wptbActionsField.setParameters( wptbButtonContainer );\n });\n \n ed.on( 'keyup', function(e) {\n let wptbButtonContainer = WPTB_Helper.findAncestor( target, 'wptb-button-container' );\n \n let wptbActionsField = new WPTB_ActionsField();\n\n wptbActionsField.addActionField( 1, wptbButtonContainer );\n\n wptbActionsField.setParameters( wptbButtonContainer );\n \n e.target.onblur = function() {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n });\n },\n init_instance_callback: function (editor) {\n window.currentEditor = editor;\n editor.on('focus', function (e) {\n var totalWidth = document.getElementsByClassName('wptb-builder-panel')[0].offsetWidth;\n if (window.currentEditor &&\n document.getElementById('wptb_builder').scrollTop >= 55 &&\n window.currentEditor.bodyElement.style.display != 'none') {\n document.getElementById('wpcd_fixed_toolbar').style.position = 'fixed';\n document.getElementById('wpcd_fixed_toolbar').style.right = (totalWidth / 2 - document.getElementById('wpcd_fixed_toolbar').offsetWidth / 2) + 'px';\n document.getElementById('wpcd_fixed_toolbar').style.top = '100px';\n } else {\n document.getElementById('wpcd_fixed_toolbar').style.position = 'static';\n delete document.getElementById('wpcd_fixed_toolbar').style.right;\n delete document.getElementById('wpcd_fixed_toolbar').style.top;\n }\n });\n }\n });\n },\n linkHttpCheckChange: function( link ) {\n if ( link ) {\n if ( link.indexOf( 'http://' ) == -1 && link.indexOf( 'https://' ) == -1 ) {\n let linkArr = link.split( '/' ),\n linkClean;\n if ( Array.isArray( linkArr ) && linkArr.length > 0 ) {\n linkClean = linkArr[linkArr.length - 1];\n }\n return document.location.protocol + '//' + linkClean;\n } else { \n return link;\n }\n } else {\n return '';\n }\n },\n dataTitleColumnSet: function( table ) {\n let rows = table.rows,\n rowHead = rows[0];\n let computedStyleRowHead = getComputedStyle(rowHead);\n \n let rowHeadChildren = rowHead.children;\n let contentsForHeader = {};\n for( let i = 0; i < rowHeadChildren.length; i++ ) {\n let tdElements = rowHeadChildren[i].children;\n for( let j = 0; j < tdElements.length; j++ ) {\n let element = tdElements[j];\n if( element.classList.contains( 'wptb-ph-element' ) ) {\n let infArr = element.className.match( /wptb-element-(.+)-(\\d+)/i );\n if( infArr[1] == 'text' ) {\n let p = element.querySelector( 'p' ),\n textContent = p.textContent,\n textAlign = p.style.textAlign;\n contentsForHeader[rowHeadChildren[i].dataset.xIndex] = [textContent, element.style.fontSize, \n element.style.color, computedStyleRowHead.backgroundColor, textAlign];\n break;\n }\n }\n }\n if( ! contentsForHeader[rowHeadChildren[i].dataset.xIndex] ) {\n contentsForHeader[rowHeadChildren[i].dataset.xIndex] = ['', '', \n '', computedStyleRowHead.backgroundColor, ''];\n }\n }\n for ( let i = 1; i < rows.length; i++ ) {\n let thisRow = rows[i],\n thisRowChildren = thisRow.children;\n for( let j = 0; j < thisRowChildren.length; j++ ) {\n if ( contentsForHeader[thisRowChildren[j].dataset.xIndex] ) {\n thisRowChildren[j].dataset.wptbTitleColumn = contentsForHeader[thisRowChildren[j].dataset.xIndex][0];\n thisRowChildren[j].dataset.wptbTitleColumnFontSize = contentsForHeader[thisRowChildren[j].dataset.xIndex][1];\n thisRowChildren[j].dataset.wptbTitleColumnColor = contentsForHeader[thisRowChildren[j].dataset.xIndex][2];\n thisRowChildren[j].dataset.wptbTitleBackgroundColor = contentsForHeader[thisRowChildren[j].dataset.xIndex][3];\n thisRowChildren[j].dataset.wptbTitleAlign = contentsForHeader[thisRowChildren[j].dataset.xIndex][4];\n } else {\n thisRowChildren[j].dataset.wptbTitleColumn = '';\n thisRowChildren[j].dataset.wptbTitleColumnFontSize = '';\n thisRowChildren[j].dataset.wptbTitleColumnColor = '';\n thisRowChildren[j].dataset.wptbTitleBackgroundColor = '';\n thisRowChildren[j].dataset.wptbTitleAlign = '';\n }\n }\n }\n },\n findAncestor: function(el, cls) {\n while ((el = el.parentElement) && !el.classList.contains(cls));\n return el;\n },\n getSelectionText: function() {\n var txt = '';\n if (txt = window.getSelection) {\n txt = window.getSelection().toString();\n } else {\n txt = document.selection.createRange().text;\n }\n return txt;\n },\n settingsPanelClear: function() {\n document.getElementById( 'wptb-adaptive-table-checkbox' ).checked = false;\n document.getElementById( 'wptb-top-row-as-header' ).checked = false;\n document.getElementById( 'wptb-table-border-slider' ).value = 0;\n document.getElementById( 'wptb-table-border-number' ).value = 0;\n document.getElementById( 'wptb-inner-border-check' ).checked = false;\n document.getElementById( 'wptb-apply-inner-border' ).classList.remove( 'visible' );\n document.getElementById( 'wptb-table-inner-border-slider' ).value = 1;\n document.getElementById( 'wptb-table-inner-border-number' ).value = 1;\n \n WPTB_Helper.wpColorPickerClear( 'wptb-table-border-color', true );\n \n WPTB_Helper.wpColorPickerClear( 'wptb-table-header-bg', true );\n \n WPTB_Helper.wpColorPickerClear( 'wptb-even-row-bg', true );\n \n WPTB_Helper.wpColorPickerClear( 'wptb-odd-row-bg', true );\n \n document.getElementById( 'wptb-table-cell-slider' ).value = 15;\n document.getElementById( 'wptb-table-cell-number' ).value = 15;\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' ) {\n let irisSquareHandle = wpPickerContainer.getElementsByClassName( 'iris-square-handle' );\n if( irisSquareHandle.length > 0 ) {\n irisSquareHandle = irisSquareHandle[0];\n irisSquareHandle.onmouseup = function() {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n }\n } else if( event.originalEvent.type == 'strip' ) {\n let uiSliderHandle = wpPickerContainer.getElementsByClassName( 'iris-slider-offset' );\n if( uiSliderHandle.length > 0 ) {\n uiSliderHandle = uiSliderHandle[0];\n uiSliderHandle.onmouseup = function() {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n }\n }\n }\n }\n },\n wpColorPickerClear: function( attribute, isId ) {\n let input;\n if( isId ) {\n input = [document.getElementById( attribute )];\n input.length = 1;\n } else {\n input = document.getElementsByClassName( attribute );\n }\n for( let i = 0; i < input.length; i++ ) {\n let wpPickerContainer = WPTB_Helper.findAncestor( input[i], 'wp-picker-container' );\n if( wpPickerContainer ) {\n let parent = wpPickerContainer.parentNode;\n parent.removeChild( wpPickerContainer );\n let newInput = document.createElement( 'input' );\n if( isId ) {\n newInput.setAttribute( 'id', attribute );\n } else {\n newInput.classList.add( 'wptb-element-property', attribute );\n }\n newInput.value = \"\";\n parent.appendChild( newInput );\n }\n }\n },\n detectMode: function() {\n var url = window.location.href,\n regex = new RegExp('[?&]table(=([^&#]*)|&|#|$)'),\n results = regex.exec(url);\n if (!results) return false;\n if (!results[2]) return '';\n return decodeURIComponent(results[2].replace(/\\+/g, ' '));\n },\n getColumnWidth: function( table, cell ) {\n let xIndex = cell.dataset.xIndex;\n let xIndexes = table.querySelectorAll( '[data-x-index=\"' + xIndex + '\"]' );\n let cellWidth = cell.getCellDimensions().width;\n for( let i = 0; i < xIndexes.length; i++ ) {\n if( cellWidth > xIndexes[i].getCellDimensions().width ) {\n cellWidth = xIndexes[i].getCellDimensions().width;\n }\n }\n return cellWidth;\n },\n getRowHeight: function( table, cell ) {\n let yIndex = cell.dataset.yIndex;\n let yIndexes = table.querySelectorAll( '[data-y-index=\"' + yIndex + '\"]' );\n let cellHeight = cell.getCellDimensions().height;\n for( let i = 0; i < yIndexes.length; i++ ) {\n if( cellHeight > yIndexes[i].getCellDimensions().height ) {\n cellHeight = yIndexes[i].getCellDimensions().height;\n }\n }\n return cellHeight;\n },\n newElementProxy: function(el) {\n if ( el == 'list' ) {\n return new WPTB_List();\n } else if ( el == 'image' ) {\n return new WPTB_Image();\n } else if ( el == 'text' ) {\n return new WPTB_Text();\n } else if ( el == 'button' ) {\n return new WPTB_Button();\n } else if( el == 'star_rating' ) {\n return new WPTB_StarRating();\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-text-message');\n wptbTextMessageSize.style.color = uiColor;\n }\n\n } else {\n affectedEl.style.color = uiColor;\n }\n },\n starRatingSelectHoverSet : function( event ) {\n let starRating;\n if( ! event.target.classList.contains( 'wptb-rating-star' ) ) {\n starRating = WPTB_Helper.findAncestor( event.target, 'wptb-rating-star' );\n } else {\n starRating = event.target;\n }\n \n let onStar = parseInt( starRating.dataset.value, 10 ); // The star currently mouse on\n\n // Now highlight all the stars that's not after the current hovered star\n let children = starRating.parentNode.children;\n if( event.type == \"mouseover\" ) {\n for( let j = 0; j < children.length; j++ ) {\n if( j < onStar ) {\n if( j == onStar - 1 ) {\n if ( event.target.classList.contains( 'wptb-rating-star-left-signal-part' ) ) {\n children[j].classList.add( 'wptb-rating-star-hover-half' );\n children[j].classList.remove( 'wptb-rating-star-hover-full' );\n } else if( event.target.classList.contains( 'wptb-rating-star-right-signal-part' ) ) {\n children[j].classList.add( 'wptb-rating-star-hover-full' );\n children[j].classList.remove( 'wptb-rating-star-hover-half' );\n }\n } else {\n children[j].classList.add( 'wptb-rating-star-hover-full' );\n children[j].classList.remove( 'wptb-rating-star-hover-half' );\n }\n } else {\n children[j].classList.remove( 'wptb-rating-star-hover-full' );\n children[j].classList.remove( 'wptb-rating-star-hover-half' );\n }\n }\n } else if ( event.type == \"click\" ) {\n for( let j = 0; j < children.length; j++ ) {\n if( j < onStar ) {\n if( j == onStar - 1 ) {\n if ( event.target.classList.contains( 'wptb-rating-star-left-signal-part' ) ) {\n children[j].classList.add( 'wptb-rating-star-selected-half' );\n children[j].classList.remove( 'wptb-rating-star-selected-full' );\n } else if( event.target.classList.contains( 'wptb-rating-star-right-signal-part' ) ) {\n children[j].classList.add( 'wptb-rating-star-selected-full' );\n children[j].classList.remove( 'wptb-rating-star-selected-half' );\n }\n } else {\n children[j].classList.add( 'wptb-rating-star-selected-full' );\n children[j].classList.remove( 'wptb-rating-star-selected-half' );\n }\n } else {\n children[j].classList.remove( 'wptb-rating-star-selected-full' );\n children[j].classList.remove( 'wptb-rating-star-selected-half' );\n }\n }\n }\n \n },\n starRatingEventHandlersAdd: function( ratingStar ) {\n ratingStar.onmouseover = function( event ) {\n event.stopPropagation();\n WPTB_Helper.starRatingSelectHoverSet( event );\n }\n ratingStar.onmouseout = function() {\n let children = this.parentNode.children;\n for( let j = 0; j < children.length; j++ ) {\n children[j].classList.remove( 'wptb-rating-star-hover-half' );\n children[j].classList.remove( 'wptb-rating-star-hover-full' );\n }\n }\n\n /* 2. Action to perform on click */\n ratingStar.onclick = function( event ) {\n WPTB_Helper.starRatingSelectHoverSet( event );\n \n /* Rating number message */\n let wptbStarRatingContainer = WPTB_Helper.findAncestor( event.target, 'wptb-star_rating-container' );\n\n WPTB_Helper.starRatingTextMessageChenge( wptbStarRatingContainer );\n\n let wptbActionsField = new WPTB_ActionsField( 1, wptbStarRatingContainer );\n\n wptbActionsField.setParameters( wptbStarRatingContainer );\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\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 thisValue = String( thisValue );\n if ( thisValue > maxValue ) {\n this.value = maxValue;\n }\n }\n },\n starRatingTextMessageChenge: function( starRatingContainer ) {\n let ratingNumber = starRatingContainer.getElementsByClassName( 'wptb-rating-star-selected-full' ).length;\n if( starRatingContainer.getElementsByClassName( 'wptb-rating-star-selected-half' ).length > 0 ) {\n ratingNumber = parseInt( ratingNumber ) + 0.5;\n }\n \n let wptbTextMessageCommon = starRatingContainer.querySelectorAll( 'li' ),\n wptbTextMessageCommonVal = wptbTextMessageCommon.length,\n wptbTextMessage = starRatingContainer.querySelector( '.wptb-text-message' );\n if( wptbTextMessageCommonVal == 1 && wptbTextMessageCommon[0].style.display == 'none' ) {\n wptbTextMessage.innerHTML = '';\n return;\n }\n \n wptbTextMessage.innerHTML = ratingNumber + '/' + wptbTextMessageCommonVal;\n }\n}\n","var WPTB_Image = function ( src, DOMElementProt ) {\n let DOMElement,\n elImage,\n kindIndexProt = undefined,\n copy = false;\n if ( DOMElementProt == undefined ) {\n DOMElement = document.createElement( 'div' );\n elImage = document.createElement( 'div' );\n\t let anchor = document.createElement( 'a' ),\n\t img = document.createElement( 'img' );\n anchor.style.display = 'block';\n anchor.appendChild( img );\n DOMElement.classList.add( 'wptb-image-container' );\n elImage.classList.add( 'wptb-image-wrapper' );\n elImage.appendChild( anchor );\n DOMElement.appendChild( elImage );\n \n anchor.onclick = function( e ) {\n e.preventDefault();\n }\n \n file_frame = wp.media.frames.file_frame = wp.media({\n\t\ttitle: 'Select a image to upload',\n\t\tbutton: {\n text: 'Use this image'\n\t\t},\n\t\tmultiple: false\n });\n // When an image is selected, run a callback.\n file_frame.on('select', function () {\n attachment = file_frame.state().get('selection').first().toJSON();\n let imgSrc = attachment.url;\n let linkArr = imgSrc.split( ':' ),\n linkClean;\n if ( Array.isArray( linkArr ) && linkArr.length > 0 ) {\n linkClean = linkArr[linkArr.length - 1];\n }\n img.src = linkClean;\n img.height = attachment.height;\n img.width = attachment.width;\n img.style.width = '100%';\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n });\n // Finally, open the modal\n if (src == undefined) {\n file_frame.open();\n } else {\n img.src = src;\n }\n } else {\n DOMElement = DOMElementProt.cloneNode( true );\n \n DOMElement.getElementsByTagName( 'a' )[0].onclick = function(e) {\n e.preventDefault();\n };\n \n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\n kindIndexProt = wptbElementMutch[1];\n copy = true;\n };\n }\n \n this.kind = 'image';\n this.getDOMElement = function () {\n return DOMElement;\n };\n\tapplyGenericItemSettings( this, kindIndexProt, copy );\n\n\treturn this;\n};","var WPTB_Initializer = function () {\n\n const MIN_COLUMNS = 1,\n MIN_ROWS = 1,\n MAX_COLUMNS = 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 WPTB_Table(columns, rows);\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n\n};\n","var WPTB_LeftPanel = function () {\n\n var table = document.getElementsByClassName('wptb-preview-table')[0],\n wptbElementButtons = document.getElementsByClassName('wptb-element');\n \n function wptbTdBgColorSavedSet( inputId, trNumber ) {\n if ( trNumber > 3 ) return;\n if( table ) {\n let tableRows = table.getElementsByTagName('tr');\n if ( tableRows.length > trNumber ) {\n let trBackgroundColor = tableRows[trNumber].style.backgroundColor;\n var wptbEvenRowBg = document.getElementById(inputId);\n if ( wptbEvenRowBg && trBackgroundColor ) {\n wptbEvenRowBg.value = WPTB_Helper.rgbToHex( trBackgroundColor );\n }\n }\n }\n \n }\n \n wptbTdBgColorSavedSet( 'wptb-even-row-bg', 1 );\n jQuery('#wptb-even-row-bg').wpColorPicker({\n change: function ( event, ui ) {\n var tableRows = table.getElementsByTagName('tr');\n for ( let i = 1; i < tableRows.length; i += 2 ) {\n tableRows[i].style.backgroundColor = ui.color.toString();\n }\n console.log(event);\n console.log(this);\n WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving( event );\n },\n clear: function(){\n var tableRows = table.getElementsByTagName('tr');\n for ( let i = 1; i < tableRows.length; i += 2 ) {\n tableRows[i].style.backgroundColor = '';\n let tds = tableRows[i].getElementsByTagName('td');\n for ( let j = 0; j < tds.length; j++ ) {\n tds[j].style.backgroundColor = '';\n }\n }\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n },\n\n });\n \n wptbTdBgColorSavedSet( 'wptb-odd-row-bg', 2 );\n jQuery('#wptb-odd-row-bg').wpColorPicker({\n change: function ( event, ui ) {\n var tableRows = table.getElementsByTagName('tr');\n for ( let i = 2; i < tableRows.length; i += 2 ) {\n tableRows[i].style.backgroundColor = ui.color.toString();\n }\n \n WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving( event );\n },\n clear: function(){\n var tableRows = table.getElementsByTagName('tr');\n for ( let i = 2; i < tableRows.length; i += 2 ) {\n tableRows[i].style.backgroundColor = '';\n let tds = tableRows[i].getElementsByTagName( 'td' );\n for ( var j = 0; j < tds.length; j++ ) {\n tds[j].style.backgroundColor = '';\n }\n }\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n },\n });\n \n wptbTdBgColorSavedSet( 'wptb-table-header-bg', 0 );\n jQuery('#wptb-table-header-bg').wpColorPicker({\n change: function (event, ui) {\n var tableHeader = table.getElementsByTagName('tr')[0];\n tableHeader.style.backgroundColor = ui.color.toString();\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n },\n clear: function(){\n var tableHeader = table.getElementsByTagName('tr')[0];\n tableHeader.style.backgroundColor = '';\n let tds = tableHeader.getElementsByTagName('td');\n for (var j = 0; j < tds.length; j++) {\n tds[j].style.backgroundColor = '';\n }\n \n WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving( event );\n },\n });\n \n function tableAdaptiveForMobile( table ) {\n let wptbAdaptiveTableCheckbox = document.getElementById( 'wptb-adaptive-table-checkbox' );\n if( table && table.dataset.wptbAdaptiveTable && table.dataset.wptbAdaptiveTable == \"1\" ) {\n wptbAdaptiveTableCheckbox.checked = true;\n } else {\n wptbAdaptiveTableCheckbox.checked = false;\n }\n }\n tableAdaptiveForMobile( table );\n \n function tableTopRowAsHeadSavedSet( table ) {\n let wptbTopRowAsHeader = document.getElementById( 'wptb-top-row-as-header' );\n \n if( table && table.classList.contains( 'wptb-table-preview-head' ) ) {\n wptbTopRowAsHeader.checked = true;\n } else {\n wptbTopRowAsHeader.checked = false;\n }\n }\n tableTopRowAsHeadSavedSet( table );\n \n function tableBorderColorWidthSavedSet() {\n let table = document.getElementsByClassName('wptb-preview-table');\n if ( table.length > 0 ) {\n let tableBorderColor = table[0].style.borderColor;\n if ( tableBorderColor ) {\n let tableBorderColorInput = document.getElementById( 'wptb-table-border-color' );\n if ( tableBorderColorInput ) {\n tableBorderColorInput.value = WPTB_Helper.rgbToHex( tableBorderColor );\n }\n }\n \n let tableBorderWidth = table[0].style.borderWidth;\n if ( tableBorderWidth ) {\n let wptbTableBorderWidthSlider = document.getElementById('wptb-table-border-slider'),\n wptbTableBorderWidthNumber = document.getElementById('wptb-table-border-number');\n \n if ( wptbTableBorderWidthSlider ) {\n wptbTableBorderWidthSlider.value = parseInt( tableBorderWidth );\n }\n if ( wptbTableBorderWidthNumber ) {\n wptbTableBorderWidthNumber.value = parseInt( tableBorderWidth );\n }\n }\n \n \n let tableTd = table[0].querySelector( 'td' );\n let applyInnerBorder = tableTd.style.borderWidth;\n if ( applyInnerBorder ) {\n let innerBorderCheckInput = document.getElementById( 'wptb-inner-border-check' );\n let wptbApplyInnerBorder = document.getElementById( 'wptb-apply-inner-border' );\n if ( applyInnerBorder && parseInt( applyInnerBorder ) > 0 ) {\n if ( innerBorderCheckInput ) {\n innerBorderCheckInput.checked = true;\n \n if ( wptbApplyInnerBorder ) {\n wptbApplyInnerBorder.classList.add( 'visible' );\n let wptbTableInnerBorderSlider = document.getElementById( 'wptb-table-inner-border-slider' );\n let wptbTableInnerBorderNumber = document.getElementById( 'wptb-table-inner-border-number' );\n wptbTableInnerBorderSlider.value = parseInt( applyInnerBorder );\n wptbTableInnerBorderNumber.value = parseInt( applyInnerBorder );\n }\n }\n } else {\n innerBorderCheckInput.checked = false;\n }\n }\n \n if ( ( tableBorderWidth && parseInt( tableBorderWidth ) > 0 ) || ( applyInnerBorder && parseInt( applyInnerBorder ) > 0 ) ) {\n document.getElementById( 'wptb-table-border-color-set-area' ).style.display = '';\n }\n }\n }\n \n tableBorderColorWidthSavedSet();\n\n jQuery('#wptb-table-border-color').wpColorPicker({\n change: function (event, ui) {\n var tableCells = table.getElementsByTagName('td');\n table.style.border = document.querySelector('#wptb-table-border-number').value + 'px solid ' + ui.color.toString();\n\n for (var i = 0; i < tableCells.length; i++) {\n let tableInnerborderNumber = document.querySelector('#wptb-table-inner-border-number').value;\n if ( document.getElementById('wptb-inner-border-check').checked ) {\n tableCells[i].style.border = ( tableInnerborderNumber != 0 ? tableInnerborderNumber : 1 ) + 'px solid ' + ui.color.toString();\n }\n }\n WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving( event );\n },\n clear: function() {\n var tableCells = table.getElementsByTagName('td');\n table.style.borderColor = '';\n\n for (var i = 0; i < tableCells.length; i++) {\n tableCells[i].style.borderColor = '';\n }\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n });\n\n function addInnerBorderSize(value) {\n var tableCells = table.getElementsByTagName('td');\n for (var i = 0; i < tableCells.length; i++) {\n tableCells[i].style.borderWidth = document.querySelector('#wptb-table-inner-border-number').value + 'px';\n tableCells[i].style.borderStyle = 'solid';\n }\n }\n\n function addCellPadding(value) {\n var tableCells = table.getElementsByTagName('td');\n for (var i = 0; i < tableCells.length; i++) {\n tableCells[i].style.padding = value + 'px';\n }\n }\n\n function addInnerBorder( checked ) {\n var styles, color = document.querySelector('#wptb-table-border-color').value != undefined ?\n document.querySelector('#wptb-table-border-color').value : 'rgb(0,0,0)';\n if ( document.querySelector( '#wptb-table-inner-border-slider' ).value == 0 || document.querySelector( '#wptb-table-inner-border-number' ).value == 0 ) {\n document.querySelector( '#wptb-table-inner-border-slider' ).value = 1;\n document.querySelector( '#wptb-table-inner-border-number' ).value = 1;\n }\n let width = document.querySelector( '#wptb-table-inner-border-slider' ).value + 'px';\n let wptbPreviewTable = document.getElementsByClassName('wptb-preview-table');\n if( wptbPreviewTable.length > 0 ) {\n if (checked == 'checked') {\n document.getElementById('wptb-apply-inner-border').style.marginBottom = '0px';\n var tableCells = wptbPreviewTable[0].getElementsByTagName( 'td' );\n for (var i = 0; i < tableCells.length; i++) {\n tableCells[i].style.border = width + ' solid ' + color;\n }\n document.getElementById( 'wptb-apply-inner-border' ).classList.add( 'visible' );\n } else {\n document.getElementById( 'wptb-apply-inner-border' ).classList.remove( 'visible' );\n var tableCells = wptbPreviewTable[0].getElementsByTagName( 'td' );\n for (var i = 0; i < tableCells.length; i++) {\n tableCells[i].style.border = '0px solid ' + color;\n tableCells[i].style.border = null;\n }\n }\n }\n \n }\n\n function addBorderSize( value ) {\n table.style.borderWidth = value + 'px';\n table.style.borderStyle = 'solid';\n }\n \n function cellPaddingSavedSet() {\n let table = document.getElementsByClassName('wptb-preview-table');\n \n if ( table.length > 0 ) {\n let td = table[0].querySelector( 'td' );\n \n if ( td ) {\n let padding = td.style.padding;\n \n if ( padding ) {\n let wptbTableCellSlider = document.getElementById('wptb-table-cell-slider'),\n wptbTableCellNumber = document.getElementById('wptb-table-cell-number');\n \n if ( wptbTableCellSlider ) {\n wptbTableCellSlider.value = parseInt( padding );\n }\n if ( wptbTableCellNumber ) {\n wptbTableCellNumber.value = parseInt( padding );\n }\n }\n }\n }\n }\n \n cellPaddingSavedSet();\n \n let wptbTableBorderNumber = document.getElementById( 'wptb-table-border-number' );\n WPTB_Helper.numberImputSize( wptbTableBorderNumber, 1, 50 );\n \n let wptbTableInnerBorderNumber = document.getElementById( 'wptb-table-inner-border-number' );\n WPTB_Helper.numberImputSize( wptbTableInnerBorderNumber, 1, 50 );\n \n let wptbTableCellNumber = document.getElementById( 'wptb-table-cell-number' );\n WPTB_Helper.numberImputSize( wptbTableCellNumber, 1, 50 );\n \n let wptbTextfontSizeNumber = document.getElementById( 'wptb-size-number' );\n WPTB_Helper.numberImputSize( wptbTextfontSizeNumber, 1, 50 );\n \n let wptbImageWidthNumber = document.getElementById( 'wptb-size-number' );\n WPTB_Helper.numberImputSize( wptbImageWidthNumber, 2, 100 );\n \n let wptbTableColumnWidthNumber = document.getElementById( 'wptb-table-column-width-number' );\n WPTB_Helper.numberImputSize( wptbTableColumnWidthNumber, 2, 500 );\n \n let wptbTableRowHeightNumber = document.getElementById( 'wptb-table-row-height-number' );\n WPTB_Helper.numberImputSize( wptbTableRowHeightNumber, 2, 200 );\n \n \n \n document.getElementById('wptb-table-cell-slider').oninput = function () {\n document.getElementById('wptb-table-cell-number').value = this.value;\n addCellPadding(this.value);\n table.tdDefaultWidth();\n };\n \n document.getElementById('wptb-table-cell-slider').onchange = function() {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n\n document.getElementById('wptb-table-cell-number').onchange = function () {\n document.getElementById('wptb-table-cell-slider').value = this.value;\n addCellPadding(this.value);\n table.tdDefaultWidth();\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n document.getElementById('wptb-table-border-slider').oninput = function () {\n document.getElementById('wptb-table-border-number').value = this.value;\n addBorderSize(this.value);\n table.tdDefaultWidth();\n \n let wptbInnerBorderCheck = document.getElementById('wptb-inner-border-check').checked,\n tableBorderColorSetArea = document.getElementById( 'wptb-table-border-color-set-area' );\n if ( this.value == 0 && wptbInnerBorderCheck == false ) {\n tableBorderColorSetArea.style.display = 'none';\n } else {\n tableBorderColorSetArea.style.display = '';\n }\n };\n \n document.getElementById('wptb-table-border-slider').onchange = function() {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n\n document.getElementById('wptb-table-border-number').onchange = function () {\n document.getElementById('wptb-table-border-slider').value = this.value;\n addBorderSize(this.value);\n table.tdDefaultWidth();\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n document.getElementById('wptb-table-inner-border-slider').oninput = function () {\n document.getElementById('wptb-table-inner-border-number').value = this.value;\n addInnerBorderSize(this.value);\n table.tdDefaultWidth();\n };\n \n document.getElementById('wptb-table-inner-border-slider').onchange = function () {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n\n document.getElementById('wptb-table-inner-border-number').onchange = function () {\n document.getElementById('wptb-table-inner-border-slider').value = this.value;\n addInnerBorderSize(this.value);\n table.tdDefaultWidth();\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n document.getElementById('wptb-inner-border-check').onchange = function () {\n if( table ) {\n let val = this.checked ? 'checked' : 'unchecked';\n addInnerBorder( val );\n let borderWidth = document.getElementById('wptb-table-border-slider').value,\n tableBorderColorSetArea = document.getElementById( 'wptb-table-border-color-set-area' );\n if( val == 'unchecked' && borderWidth == 0 ) {\n tableBorderColorSetArea.style.display = 'none';\n } else {\n tableBorderColorSetArea.style.display = '';\n }\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n };\n \n document.getElementById( 'wptb-table-column-width-slider' ).oninput = function () {\n document.getElementById( 'wptb-table-column-width-number' ).value = this.value;\n table.addColumnWidth( this.value );\n };\n \n document.getElementById( 'wptb-table-column-width-slider' ).onchange = function () {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n \n document.getElementById( 'wptb-table-column-width-number' ).onchange = function () {\n document.getElementById( 'wptb-table-column-width-slider' ).value = this.value;\n table.addColumnWidth( this.value );\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n \n document.getElementById( 'wptb-table-column-width-auto-fixed' ).onchange = function () {\n if( this.checked ) {\n let highlighted = table.querySelector( '.wptb-highlighted' );\n let width = WPTB_Helper.getColumnWidth( table, highlighted );\n table.addColumnWidth( width );\n } else {\n table.addColumnWidth( false, true );\n let highlighted = table.querySelector( '.wptb-highlighted' );\n let width = WPTB_Helper.getColumnWidth( table, highlighted );\n document.getElementById( 'wptb-table-column-width-number' ).value = width;\n document.getElementById( 'wptb-table-column-width-slider' ).value = width;\n }\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n document.getElementById( 'wptb-table-row-height-slider' ).oninput = function () {\n document.getElementById( 'wptb-table-row-height-number' ).value = this.value;\n table.addRowHeight( this.value );\n };\n \n document.getElementById( 'wptb-table-row-height-slider' ).onchange = function () {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n document.getElementById( 'wptb-table-row-height-number' ).onchange = function () {\n document.getElementById( 'wptb-table-row-height-slider' ).value = this.value;\n table.addRowHeight( this.value );\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n \n document.getElementById( 'wptb-table-row-height-auto-fixed' ).onchange = function () {\n if( this.checked ) {\n let highlighted = table.querySelector( '.wptb-highlighted' );\n let height = WPTB_Helper.getRowHeight( table, highlighted );\n table.addRowHeight( height );\n } else {\n table.addRowHeight( false, true );\n let highlighted = table.querySelector( '.wptb-highlighted' );\n let height = WPTB_Helper.getRowHeight( table, highlighted );\n document.getElementById( 'wptb-table-row-height-number' ).value = height;\n document.getElementById( 'wptb-table-row-height-slider' ).value = height;\n }\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n \n document.getElementById( 'wptb-adaptive-table-checkbox' ).onchange = function() {\n if( this.checked ) {\n table.dataset.wptbAdaptiveTable = 1;\n } else {\n table.dataset.wptbAdaptiveTable = 0;\n }\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n \n function createMobileHeadForTable( table, thisEvent ) {\n \n if( thisEvent.checked ) {\n WPTB_Helper.dataTitleColumnSet( table );\n \n table.classList.add( 'wptb-table-preview-head' );\n table.rows[0].classList.add( 'wptb-table-head' );\n } else {\n let rows = table.rows;\n table.classList.remove( 'wptb-table-preview-head' );\n rows[0].classList.remove( 'wptb-table-head' );\n \n for ( let i = 1; i < rows.length; i++ ) {\n let thisRow = rows[i],\n thisRowChildren = thisRow.children;\n for( let j = 0; j < thisRowChildren.length; j++ ) {\n thisRowChildren[j].removeAttribute( 'data-wptb-title-column' );\n thisRowChildren[j].removeAttribute( 'data-wptb-title-column-font-size' );\n thisRowChildren[j].removeAttribute( 'data-wptb-title-column-color' );\n thisRowChildren[j].removeAttribute( 'data-wptb-title-background-color' );\n thisRowChildren[j].removeAttribute( 'data-wptb-title-align' );\n }\n }\n }\n }\n \n document.getElementById( 'wptb-top-row-as-header' ).onchange = function () {\n createMobileHeadForTable( table, this );\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n\n for (var i = 0; i < wptbElementButtons.length; i++) {\n wptbElementButtons[i].ondragstart = function (e) {\n e.dataTransfer.setData('wptbElement', this.dataset.wptbElement);\n e.dataTransfer.setData( 'wptbElIndic-' + this.dataset.wptbElement, 'wptbElIndic-' + this.dataset.wptbElement );\n }\n }\n \n if( table ) {\n document.getElementById('wptb-activate-cell-management-mode').onclick = table.toggleTableEditMode;\n document.getElementById( 'wptb-table-edit-mode-close' ).onclick = table.toggleTableEditMode;\n document.getElementById( 'wptb-left-scroll-panel-curtain-close' ).onclick = table.toggleTableEditMode;\n document.getElementById('wptb-add-end-row').onclick = table.addRowToTheEnd;\n document.getElementById('wptb-add-start-row').onclick = table.addRowToTheStart;\n document.getElementById('wptb-add-row-before').onclick = table.addRowBefore;\n document.getElementById('wptb-add-row-after').onclick = table.addRowAfter;\n document.getElementById('wptb-add-end-column').onclick = table.addColumnEnd;\n document.getElementById('wptb-add-start-column').onclick = table.addColumnStart;\n document.getElementById('wptb-add-column-before').onclick = table.addColumnBefore;\n document.getElementById('wptb-add-column-after').onclick = table.addColumnAfter;\n document.getElementById('wptb-delete-column').onclick = table.deleteColumn;\n document.getElementById('wptb-delete-row').onclick = table.deleteRow;\n document.getElementById('wptb-merge-cells').onclick = table.mergeCells;\n document.getElementById('wptb-split-cell').onclick = table.splitCell;\n }\n \n document.querySelector( '.wptb-left-panel-extend' ).onclick = function() {\n let wptbContainer = document.querySelector( '.wptb-container' );\n if( wptbContainer ) {\n if ( wptbContainer.classList.contains( 'collapsed' ) ) {\n wptbContainer.classList.remove( 'collapsed' );\n } else {\n wptbContainer.classList.add( 'collapsed' );\n }\n }\n };\n \n // this code hides the \"element parameters\" area \n // when clicked outside this element and its \"tinymce\" toolbar \n let wptbBuilderPanel = document.getElementsByClassName( 'wptb-builder-panel' )[0];\n wptbBuilderPanel.onclick = function( e ) {\n if( ! e.target.classList.contains( 'wptb-ph-element' ) && ! WPTB_Helper.findAncestor( e.target, 'wptb-ph-element' ) && \n ! e.target.classList.contains( 'wptb-fixed-toolbar' ) && ! WPTB_Helper.findAncestor( e.target, 'wptb-fixed-toolbar' ) ) {\n clickOnFreeSpace();\n } \n };\n \n let wptbHeader = document.getElementsByClassName( 'wptb-header' );\n if( wptbHeader.length > 0 ) wptbHeader = wptbHeader[0];\n wptbHeader.onclick = function() {\n clickOnFreeSpace();\n }\n \n function clickOnFreeSpace() {\n document.getElementsByClassName( 'wptb-elements-container' )[0].style.display = 'table';\n document.getElementsByClassName( 'wptb-settings-section' )[0].style.display = 'block';\n document.getElementById( 'element-options-group' ).style.display = 'none';\n let wpcdFixedToolbar = document.getElementById( 'wpcd_fixed_toolbar' );\n if( wpcdFixedToolbar.hasAttribute( 'data-toolbar-active-id' ) ) {\n document.getElementById( wpcdFixedToolbar.getAttribute( 'data-toolbar-active-id' ) ).classList.remove( 'toolbar-active' );\n }\n }\n \n};","var WPTB_List = function ( innerElements, DOMElementProt ) {\n\n var el_L = document.createElement('ul'), item,\n DOMElement = document.createElement('div'),\n kindIndexProt = undefined,\n copy = false;\n DOMElement.classList.add( 'wptb-list-item-container' );\n\n this.kind = 'list';\n\n if (innerElements === '') {\n //Case for edit mode list\n } else if ( !innerElements ) {\n for (var i = 0; i < 3; i++) {\n item = new WPTB_ListItem( '<p>List Item ' + (i + 1) + '</p>');\n el_L.appendChild(item.getDOMElement());\n }\n } else {\n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\n kindIndexProt = wptbElementMutch[1];\n copy = true;\n };\n \n for ( var i = 0; i < innerElements.length; i++ ) {\n let listItem = DOMElementProt.querySelector( 'li' );\n item = new WPTB_ListItem( innerElements[i], listItem, true );\n el_L.appendChild(item.getDOMElement());\n }\n }\n DOMElement.appendChild(el_L);\n //window.addElementOptions('list', elList);\n\n this.getDOMElement = function () {\n return DOMElement;\n }\n applyGenericItemSettings( this, kindIndexProt, copy );\n WPTB_Helper.listItemsRecalculateIndex( el_L );\n\n return this;\n};","var WPTB_ListItem = function ( text, DOMElementProt, copy ) {\n let wptbListItemReturn;\n if ( DOMElementProt == undefined || ( DOMElementProt && copy )) {\n if (text == undefined) text = 'New List Item';\n var DOMElement = document.createElement('li'),\n //divdot = document.createElement('div'),\n divcontent = document.createElement('div');\n //libullet = document.createElement('li');\n //divdot.classList.add('wptb-list-item-style-dot');\n divcontent.classList.add('wptb-list-item-content');\n //libullet.classList.add('wptb-bullet');\n if ( DOMElementProt ) {\n let styleDot = DOMElementProt.getAttribute( 'style' );\n if ( styleDot ) {\n DOMElement.setAttribute( 'style', styleDot );\n }\n }\n //DOMElement.appendChild(divdot);\n DOMElement.appendChild(divcontent);\n //divdot.appendChild(libullet);\n divcontent.innerHTML = text;\n divcontent.onkeyup = window.listItemKeyListener;\n \n wptbListItemReturn = true;\n } else {\n var DOMElement = DOMElementProt;\n var divcontent = DOMElement.getElementsByClassName( 'wptb-list-item-content' )[0];\n \n divcontent.onkeyup = window.listItemKeyListener;\n \n wptbListItemReturn = false;\n }\n \n DOMElement.onmouseenter = function ( event ) {\n let wptbActionsField = new WPTB_ActionsField();\n \n wptbActionsField.addActionField( 2, DOMElement );\n \n wptbActionsField.setParameters( DOMElement );\n console.log(DOMElement);\n };\n\n DOMElement.onmouseleave = function ( event ) {\n let wptbActionsField = new WPTB_ActionsField();\n \n wptbActionsField.leaveFromField( event, DOMElement, 2 );\n \n return false;\n };\n\n this.getDOMElement = function () {\n return DOMElement;\n };\n \n if ( wptbListItemReturn ) {\n return this;\n }\n};","var MultipleSelect = function () {\n\n\tvar selectedCells = [],\n\t\tmultipleCellMode = false;\n\n\tthis.activateMultipleSelectMode = function () {\n\t\tselectedCells = [];\n\t\tvar tds = document.getElementsByClassName('wptb-preview-table')[0].getElementsByTagName('td');\n\t\tfor (var i = 0; i < tds.length; i++) {\n\t\t\ttds[i].classList.remove('wptb-highlighted');\n\t\t}\n\t\tmultipleCellMode = true;\n\t}\n\n\tthis.deactivateMultipleSelectMode = function () {\n\t\tmultipleCellMode = false;\n\t}\n\n\tthis.isActivated = function () {\n\t\treturn multipleCellMode;\n\t}\n\n\tthis.pushSelectedCell = function (cell) {\n\t\tif (!multipleCellMode) {\n\t\t\treturn;\n\t\t}\n\t\tselectedCells.push(cell);\n\t\tcell.classList.add('wptb-highlighted');\n\t};\n\n\tthis.selectedCells = function () {\n\t\treturn selectedCells;\n\t}\n\n\tthis.flushSelectedCells = function () {\n\t\tselectedCells = [];\n\t}\n\n\tthis.getFirst = function () {\n\t\tvar minXIndex = 1000, minYIndex = 1000, first;\n\t\tfor (var i = selectedCells.length - 1; i >= 0; i--) {\n\t\t\tif (minXIndex >= selectedCells[i].dataset.xIndex\n\t\t\t\t&& minYIndex >= selectedCells[i].dataset.yIndex) {\n\t\t\t\tfirst = selectedCells[i];\n\t\t\t\tminXIndex = selectedCells[i].dataset.xIndex;\n\t\t\t\tminYIndex = selectedCells[i].dataset.yIndex;\n\t\t\t}\n\t\t}\n\t\treturn first;\n\t}\n\n\tthis.getLast = function () {\n\t\tvar maxXIndex = -1, maxYIndex = -1, last;\n\t\tfor (var i = selectedCells.length - 1; i >= 0; i--) {\n\t\t\tif (maxXIndex <= selectedCells[i].dataset.xIndex\n\t\t\t\t&& maxYIndex <= selectedCells[i].dataset.yIndex) {\n\t\t\t\tlast = selectedCells[i];\n\t\t\t\tmaxXIndex = selectedCells[i].dataset.xIndex;\n\t\t\t\tmaxYIndex = selectedCells[i].dataset.yIndex;\n\t\t\t}\n\t\t}\n\t\treturn last;\n\t}\n\n\tthis.removeAllButFirst = function () {\n\t\tvar td = this.getFirst();\n\t\tfor (var i = 1; i < selectedCells.length; i++) {\n\t\t\tselectedCells[i].classList.add('wptb-fused-cell-' + td.dataset.xIndex + '-' + td.dataset.yIndex);\n\t\t}\n\t}\n\n\treturn this;\n\n};","var WPTB_Parser = function (code) {\n let div = document.createElement( 'div' );\n div.innerHTML = code;\n \n let table = div.children[0];\n let columnTitleMobile = [...table.querySelectorAll( '.wptb-column-title-mobile-container' )];\n \n for( let i = 0; i < columnTitleMobile.length; i++ ) {\n let parent = columnTitleMobile[i].parentNode;\n parent.removeChild( columnTitleMobile[i] );\n }\n \n let tds = table.querySelectorAll( 'td' );\n for ( let i = 0; i < tds.length; i++ ) {\n tds[i].classList.add( 'wptb-droppable' );\n tds[i].classList.remove( 'wptb-column-title-mobile-not-elements' );\n }\n \n return table;\n}","var WPTB_Parser2 = function (code) {\n if( Array.isArray( code ) ) {\n let elementHtml;\n \n if ( code.length == 1) {\n return elementHtml.appendChild( document.createTextNode( code[0] ) );\n }\n if( 0 in code ) {\n let tagName = code[0];\n elementHtml = document.createElement( tagName );\n \n if ( 1 in code ) {\n if( Array.isArray( code[1] ) ) {\n let attributes = code[1];\n \n for( let i = 0; i < attributes.length; i++ ) {\n if( Array.isArray( attributes[i] ) ) {\n elementHtml.setAttribute(attributes[i][0], attributes[i][1]);\n }\n }\n }\n }\n \n if ( 2 in code ) {\n if ( Array.isArray( code[2] ) ) {\n for ( let i = 0; i < code[2].length; i++ ) {\n if ( typeof code[2][i] === 'string' && tagName.toLowerCase() == 'p' ) {\n elementHtml.appendChild( document.createTextNode( code[2][i] ) );\n continue;\n }\n if ( ! WPTB_Parser( code[2][i] ) ) continue;\n elementHtml.appendChild( WPTB_Parser( code[2][i] ) );\n }\n } else if( typeof code[2] === 'string' ) {\n elementHtml.appendChild( document.createTextNode( code[2] ) );\n }\n \n }\n }\n \n return elementHtml;\n } else {\n return false;\n }\n \n}","var WPTB_Settings = function () {\n var elems = document.getElementsByClassName('wptb-element');\n\n for ( var i = 0; i < elems.length; i++ ) {\n elems[i].ondragstart = function ( event ) {\n event.dataTransfer.effectAllowed = 'move';\n event.dataTransfer.setData( 'wptbElement', event.target.dataset.wptbElement );\n event.dataTransfer.setData( 'wptbElIndic-' + event.target.dataset.wptbElement, 'wptbElIndic-' + event.target.dataset.wptbElement );\n }\n elems[i].ondragend = function () {\n let wptbDropHandle = document.querySelector( '.wptb-drop-handle' ),\n wptbDropBorderMarker = document.querySelector( '.wptb-drop-border-marker' );\n if ( wptbDropHandle || wptbDropBorderMarker ) {\n wptbDropHandle.style.display = 'none';\n wptbDropBorderMarker.style.display = 'none';\n }\n }\n };\n \n let 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 WPTB_Table();\n }\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 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 ( e ) {\n if( this.classList.contains( 'wptb-button-disable' ) ) {\n e.preventDefault();\n }\n }\n\n document.getElementsByClassName( 'wptb-save-btn' )[0].onclick = function ( event ) {\n if( ( ! event.target.dataset.wptbTableStateNumberSave && window.wptbTableStateNumberShow == 0 ) || \n window.wptbTableStateNumberShow == event.target.dataset.wptbTableStateNumberSave ) {\n return;\n }\n let bar = document.querySelector( '.wptb-edit-bar' );\n if ( bar && bar.classList.contains( 'visible' ) ) {\n let table = document.getElementsByClassName( 'wptb-preview-table' )[0];\n table.toggleTableEditMode();\n }\n\n let http = new XMLHttpRequest(),\n url = ( wptb_admin_object ? wptb_admin_object.ajaxurl : ajaxurl ) + \"?action=save_table\",\n t = document.getElementById( 'wptb-setup-name' ).value.trim(),\n messagingArea,\n code = document.getElementsByClassName( 'wptb-preview-table' );\n if( code.length > 0 ) {\n code = WPTB_Stringifier( code[0] );\n code = code.outerHTML;\n } else { \n code = '';\n }\n \n if ( t === '' || code === '' ) {\n let messagingAreaText = '';\n if( t === '' ) messagingAreaText += 'You must assign a name to the table before saving it.</br>';\n if( code === '' ) messagingAreaText += 'Table wasn\\'t created';\n messagingArea = document.getElementById( 'wptb-messaging-area' );\n messagingArea.innerHTML = '<div class=\"wptb-error wptb-message\">Error: ' + messagingAreaText + '</div>';\n messagingArea.classList.add( 'wptb-warning' );\n setTimeout(function () {\n messagingArea.removeChild( messagingArea.firstChild );\n }, 4000 );\n return;\n }\n\n let params = {\n title: t,\n content: code,\n security_code: wptb_admin_object.security_code\n };\n if (( rs = WPTB_Helper.detectMode() ) || ( rs = document.wptbId )) {\n params.id = rs;\n }\n params = JSON.stringify( params );\n\n http.open('POST', url, true);\n http.setRequestHeader( 'Content-type', 'application/json; charset=utf-8' );\n\n http.onreadystatechange = function (action) {\n if ( this.readyState == 4 && this.status == 200 ) {\n var data = JSON.parse( http.responseText );\n messagingArea = document.getElementById( 'wptb-messaging-area' );\n\n if ( data[0] == 'saved' ) {\n document.wptbId = data[1];\n messagingArea.innerHTML = '<div class=\"wptb-success wptb-message\">Table \"' + t + '\" was successfully saved.</div>';\n document.getElementsByClassName( 'wptb-embed-btn' )[0].classList.remove( 'wptb-button-disable' );\n document.getElementById( 'wptb-embed-shortcode' ).value = '[wptb id=' + data[1] + ']';\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 } 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 }\n } else {\n messagingArea.innerHTML = '<div class=\"wptb-error wptb-message\">Safety problems</div>';\n }\n messagingArea.classList.add( 'wptb-success' );\n setTimeout( function () {\n messagingArea.removeChild( messagingArea.firstChild );\n }, 4000 );\n }\n }\n http.send( params );\n }\n};\n","var WPTB_Space = function ( elSpaceBetween ) {\n\n function newElementProxy(el) {\n if (el.includes('list')) {\n return new WPTB_List();\n } else if (el.includes('image')) {\n return new WPTB_Image();\n } else if (el.includes('text')) {\n return new WPTB_Text();\n } else if (el.includes('button')) {\n return new WPTB_Button();\n }\n }\n let spaceBetween;\n if ( ! elSpaceBetween ) {\n spaceBetween = document.createElement('div'), spaceBetween.classList.add('wptb-space-between');\n } else {\n spaceBetween = elSpaceBetween;\n }\n\n spaceBetween.ondragenter = function () {\n this.classList.add('visible');\n };\n spaceBetween.ondragover = function (event) {\n event.preventDefault();\n };\n\n spaceBetween.ondragleave = function () {\n this.classList.remove('visible');\n };\n\n spaceBetween.ondrop = function (event) {\n event.stopPropagation();\n\n var p = event.target.nextSibling,\n td = event.target,\n element, t_space, spaceParent;\n\n while ( !td.classList.contains('wptb-droppable') ) {\n td = td.parentNode;\n }\n\n if (event.dataTransfer.getData('wptbElement')) {\n element = newElementProxy(event.dataTransfer.getData('wptbElement'));\n this.classList.remove('visible');\n\n if (p == null) {\n td.appendChild(element.getDOMElement());\n td.appendChild(new WPTB_Space());\n } else {\n td.insertBefore(element.getDOMElement(), p);\n td.insertBefore(new WPTB_Space(), p);\n }\n\n } else {\n alert(event.dataTransfer.getData('node'));\n element = document.getElementsByClassName(event.dataTransfer.getData('node'))[0];\n t_space = element.nextSibling;\n spaceParent = element.parentNode;\n if (t_space != undefined) {\n spaceParent.removeChild(t_space);\n }\n\n if (p == null) {\n td.appendChild(element);\n td.appendChild(new WPTB_Space());\n } else {\n td.insertBefore(element, p);\n td.insertBefore(new WPTB_Space(), p);\n }\n\n }\n this.classList.remove('visible');\n };\n \n if ( ! elSpaceBetween ) {\n return spaceBetween;\n }\n};","var WPTB_StarRating = function ( DOMElementProt, countStarts ) {\n if( ! countStarts ) {\n if( ! DOMElementProt ) {\n countStarts = 5;\n } else {\n countStarts = DOMElementProt.querySelectorAll( 'li' ).length;\n }\n }\n \n let DOMElement = document.createElement('div'),\n ratingStarsBox = document.createElement( 'div' ),\n ratingStarsList = document.createElement( 'ul' ),\n successBox = document.createElement( 'div' ),\n textMessage = document.createElement( 'div' ),\n kindIndexProt = undefined,\n copy = false;\n \n DOMElement.classList.add( 'wptb-star_rating-container' );\n ratingStarsBox.classList.add( 'wptb-rating-stars-box' );\n ratingStarsList.classList.add( 'wptb-rating-stars-list' );\n successBox.classList.add( 'wptb-success-box' );\n successBox.style.display = 'none';\n textMessage.classList.add( 'wptb-text-message' );\n \n let filledRatingStarHtml = '<svg version=\"1.1\" id=\"Capa_1\" xmlns=\"http://www.w3.org/2000/svg\" \\n\\\n xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\" width=\"20px\" viewBox=\"0 0 426.667 426.667\" \\n\\\n style=\"enable-background:new 0 0 426.667 426.667;\" xml:space=\"preserve\">\\n\\\n <polygon points=\"426.667,165.12 273.28,152.107 213.333,10.667 153.387,152.107 0,165.12 \\n\\\n 116.48,266.027 81.493,416 213.333,336.427 345.173,416 310.187,266.027\"/></svg>';\n \n let notFilledRatingStarHtml = '<svg version=\"1.1\" id=\"Capa_1\" xmlns=\"http://www.w3.org/2000/svg\" \\n\\\n xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\" width=\"20px\" viewBox=\"0 0 426.667 426.667\" \\n\\\n style=\"enable-background:new 0 0 426.667 426.667;\" xml:space=\"preserve\">\\n\\\n <path d=\"M426.667,165.12L273.28,151.893L213.333,10.667l-59.947,141.44L0,165.12l116.48,100.907L81.493,416l131.84-79.573\\n\\\n L345.173,416L310.4,266.027L426.667,165.12z M213.333,296.533L133.12,344.96l21.333-91.307l-70.827-61.44l93.44-8.107 \\n\\\n l36.267-85.973l36.48,86.187l93.44,8.107l-70.827,61.44l21.333,91.307L213.333,296.533z\"/></svg>';\n \n let halfFilledRatingStarHtml = '<svg version=\"1.1\" id=\"Capa_1\" xmlns=\"http://www.w3.org/2000/svg\" \\n\\\n xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\" width=\"20px\" viewBox=\"0 0 426.667 426.667\" \\n\\\n style=\"enable-background:new 0 0 426.667 426.667;\" xml:space=\"preserve\">\\n\\\n <path d=\"M426.667,165.12L273.28,151.893L213.333,10.667l-59.947,141.44L0,165.12l116.48,100.907L81.493,416l131.84-79.573 \\n\\\n L345.173,416L310.4,266.027L426.667,165.12z M213.333,296.533v-198.4l36.48,86.187l93.44,8.107l-70.827,61.44l21.333,91.307 \\n\\\n L213.333,296.533z\"/></svg>';\n \n \n for( let i = 0; i < countStarts; i++ ) {\n let ratingStar = document.createElement( 'li' );\n ratingStar.classList.add( 'wptb-rating-star' );\n let ratingStarZeroSet = '';\n if( i == 0 ) {\n ratingStarZeroSet = '<span class=\"wptb-rating-star-zero-set\"></span>';\n }\n \n ratingStar.innerHTML = '<span class=\"wptb-rating-star-left-signal-part\">' + ratingStarZeroSet + '</span><span class=\"wptb-filled-rating-star\">' + filledRatingStarHtml + '</span>'\n + '<span class=\"wptb-not-filled-rating-star\">' + notFilledRatingStarHtml + '</span>'\n + '<span class=\"wptb-half-filled-rating-star\">' + halfFilledRatingStarHtml + '</span><span class=\"wptb-rating-star-right-signal-part\"></span>';\n ratingStar.dataset.value = i + 1;\n ratingStarsList.appendChild( ratingStar );\n }\n\n successBox.appendChild( textMessage );\n ratingStarsBox.appendChild( ratingStarsList );\n ratingStarsBox.appendChild( successBox );\n DOMElement.appendChild( ratingStarsBox );\n \n \n\n \n // Creation of a new star rating when copying to avoid errors when assigning new event handlers.\n if ( DOMElementProt ) {\n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\n kindIndexProt = wptbElementMutch[1];\n copy = true;\n };\n \n var wptbRatingStarsBox = DOMElementProt.querySelector( '.wptb-rating-stars-box' );\n if ( wptbRatingStarsBox ) {\n var wptbRatingStarsBoxAttributes = [...wptbRatingStarsBox.attributes];\n if ( wptbRatingStarsBoxAttributes.length > 0 ) {\n for( let i = 0; i < wptbRatingStarsBoxAttributes.length; i++ ) {\n if ( wptbRatingStarsBoxAttributes[i].name == 'style') {\n ratingStarsBox.setAttribute( wptbRatingStarsBoxAttributes[i].name, wptbRatingStarsBoxAttributes[i].value );\n }\n } \n }\n }\n \n let wptbRatingStarsOld = wptbRatingStarsBox.querySelectorAll( 'li' );\n let wptbRatingStars = ratingStarsList.querySelectorAll( 'li' );\n if ( wptbRatingStarsOld.length > 0 && wptbRatingStars.length > 0 ) {\n let iMax = wptbRatingStarsOld.length < countStarts ? wptbRatingStarsOld.length : countStarts;\n for( let i = 0; i < wptbRatingStarsOld.length; i++ ) {\n let wptbRatingStarsAttributes = [...wptbRatingStarsOld[i].attributes];\n if ( wptbRatingStarsAttributes.length > 0 ) {\n for( let j = 0; j < wptbRatingStarsAttributes.length; j++ ) {\n wptbRatingStars[i].setAttribute( wptbRatingStarsAttributes[j].name, wptbRatingStarsAttributes[j].value );\n } \n }\n \n let wptbRatingStarsOldSpan = wptbRatingStarsOld[i].children;\n let wptbRatingStarsSpan = wptbRatingStars[i].children;\n for( let k = 0; k < wptbRatingStarsOldSpan.length; k++ ){\n let wptbRatingStarsOldSpanAttributes = [...wptbRatingStarsOldSpan[k].attributes];\n if( wptbRatingStarsOldSpanAttributes.length > 0 ) {\n for ( let l = 0; l < wptbRatingStarsOldSpanAttributes.length; l++ ) {\n wptbRatingStarsSpan[k].setAttribute( wptbRatingStarsOldSpanAttributes[l].name, wptbRatingStarsOldSpanAttributes[l].value );\n let wptbRatingStarsOldSvg = wptbRatingStarsOldSpan[k].querySelector( 'svg' );\n if( wptbRatingStarsOldSvg ) {\n let wptbRatingStarsOldSvgStyle = wptbRatingStarsOldSvg.getAttribute( 'style' );\n wptbRatingStarsSpan[k].querySelector( 'svg' ).setAttribute( 'style', wptbRatingStarsOldSvgStyle );\n }\n }\n }\n }\n }\n }\n \n var wptbSuccessBox = wptbRatingStarsBox.querySelector( '.wptb-success-box' );\n if ( wptbSuccessBox ) {\n var wptbSuccessBoxAttributes = [...wptbSuccessBox.attributes];\n for( let i = 0; i < wptbSuccessBoxAttributes.length; i++ ) {\n if ( wptbSuccessBoxAttributes[i].name == 'style') {\n successBox.setAttribute( wptbSuccessBoxAttributes[i].name, wptbSuccessBoxAttributes[i].value );\n }\n } \n }\n \n var wptbTextMessage = wptbSuccessBox.querySelector( '.wptb-text-message' );\n if ( wptbTextMessage ) {\n textMessage.innerHTML = wptbTextMessage.innerHTML;\n var wptbTextMessageAttributes = [...wptbTextMessage.attributes];\n for( let i = 0; i < wptbTextMessageAttributes.length; i++ ) {\n if ( wptbTextMessageAttributes[i].name == 'style') {\n textMessage.setAttribute( wptbTextMessageAttributes[i].name, wptbTextMessageAttributes[i].value );\n }\n } \n }\n }\n \n this.kind = 'star_rating';\n\n this.getDOMElement = function () {\n return DOMElement;\n };\n\n applyGenericItemSettings( this, kindIndexProt, copy );\n \n return this;\n}","var WPTB_Stringifier = function ( codeMain ) {\n if ( codeMain ) {\n let code = codeMain.cloneNode( true );\n code.classList.add( 'wptb-table-preview-static-indic' );\n code.dataset.tableColumns = codeMain.columns;\n code.style.width = null;\n code.style.minWidth = null;\n code.style.maxWidth = null;\n \n let tds = code.getElementsByTagName( 'td' );\n if ( tds.length > 0 ) {\n for ( let i = 0; i < tds.length; i++ ) {\n \n if ( codeMain.querySelector( 'wptb-table-preview-head' ) ) {\n tds[i].removeAttribute( 'data-x-index' );\n }\n tds[i].removeAttribute( 'data-y-index' );\n tds[i].removeAttribute( 'draggable' );\n tds[i].classList.remove( 'wptb-droppable' );\n let innerElements = tds[i].getElementsByClassName( 'wptb-ph-element' );\n \n if ( innerElements.length > 0 ) {\n for ( let j = 0; j < innerElements.length; j++ ) {\n \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 }\n \n if( tds[i].hasAttribute( 'data-wptb-title-column' ) ) {\n let columnNameDivContainer = document.createElement( 'div' ),\n columnNameDiv = document.createElement( 'div' );\n columnNameDivContainer.classList.add( 'wptb-column-title-mobile-container' );\n columnNameDiv.classList.add( 'wptb-column-title-mobile' );\n columnNameDiv.dataset.wptbTitleColumn = tds[i].dataset.wptbTitleColumn;\n columnNameDiv.setAttribute( 'style', 'font-size:' + tds[i].dataset.wptbTitleColumnFontSize + '; \\n\\\n color:' + tds[i].dataset.wptbTitleColumnColor + '; background-color:' + tds[i].dataset.wptbTitleBackgroundColor + '; text-align:' + tds[i].dataset.wptbTitleAlign + ';' );\n columnNameDiv.style.padding = tds[i].style.padding;\n if( tds[i].children.length == 0 ) {\n tds[i].classList.add( 'wptb-column-title-mobile-not-elements' );\n }\n columnNameDivContainer.appendChild( columnNameDiv );\n tds[i].insertBefore( columnNameDivContainer, tds[i].firstChild );\n }\n }\n }\n \n return code;\n }\n}","var WPTB_Stringifier2 = function ( node, start = false ) {\n\n\tif ( node == undefined ) {\n\t\treturn '';\n\t} else if ( node.tagName == undefined && node.nodeType == 3 ) {\n return node.nodeValue;\n }\n \n let code = [],\n children,\n int_elem_arr = false,\n attributes = [...node.attributes],\n attributes_list = [],\n internal_elements = [];\n if ( ( node.parentNode.classList.contains( 'wptb-list-item-content' ) || \n node.parentNode.classList.contains( 'mce-content-body' ) ) && \n node.tagName.toLowerCase() == 'p' ) {\n children = node.childNodes;\n int_elem_arr = true;\n } else if( node.children.length > 0 ) {\n children = node.children;\n } else {\n children = node.childNodes;\n }\n if ( attributes.length > 0 ) {\n for ( let i = 0; i < attributes.length; i++ ) {\n attributes_list[i] = [attributes[i].name, attributes[i].value];\n }\n } else {\n attributes_list = '';\n }\n \n if ( children.length > 0 ) {\n for ( let i = 0; i < children.length; i++) {\n let inter_elem = WPTB_Stringifier(children[i]);\n \n if ( Array.isArray( inter_elem ) || int_elem_arr ) {\n internal_elements[i] = inter_elem;\n } else if ( typeof inter_elem === 'string' && inter_elem ) {\n internal_elements = inter_elem;\n }\n }\n } else {\n internal_elements = '';\n }\n \n \n code.push(node.tagName.toLowerCase(), attributes_list , internal_elements);\n \n return code;\n}","var array = [], WPTB_Table = function (columns, rows) {\n\n /* The members of the class */\n var settings = document.getElementsByClassName('wptb-settings-items'),\n wptbTableSetup = document.getElementsByClassName(\"wptb-table-setup\")[0],\n table, row, cell,\n maxAmountOfCells,\n maxAmountOfRows;\n\n //HERE ARE THE PRIVATE FUNCTIONS\n /*\n * This function toggles buttons visibility in cell edit mode\n * (according to the amount of currently selected cells), and\n * highlights visually the clicked cell if it is not highlighted, or\n * removes highlight if clicked cell is already highlighted. \n * It too toggles the bits of our abstract representation.\n * @param Event this is the event instance of the click performed over a cell.\n */\n var mark = function ( event ) {\n var rs = this.rowSpan,\n cs = this.colSpan,\n markedCells,\n noCells = document.getElementsByClassName('wptb-no-cell-action'),\n singleCells = document.getElementsByClassName('wptb-single-action'),\n multipleCells = document.getElementsByClassName('wptb-multiple-select-action'),\n cellSettings = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ),\n position = getCoords(this),\n row = position[0],\n column = position[1];\n if ( ! document.select.isActivated() ) {\n return;\n }\n if (this.className.match(/wptb-highlighted/)) {\n this.classList.remove('wptb-highlighted');\n for (var i = 0; i < rs; i++) {\n for (var j = 0; j < cs; j++) {\n array[row + i][column + j] = 0;\n }\n }\n } else {\n this.classList.add('wptb-highlighted');\n for (var i = 0; i < rs; i++) {\n for (var j = 0; j < cs; j++) {\n array[row + i][column + j] = 1;\n }\n }\n }\n\n markedCells = document.getElementsByClassName('wptb-highlighted').length;\n if (markedCells === 0) {\n for (var i = 0; i < multipleCells.length; i++) {\n multipleCells[i].classList.remove('visible');\n multipleCells[i].setAttribute('disabled', 'disabled');\n }\n for (var i = 0; i < noCells.length; i++) {\n noCells[i].classList.add('visible');\n noCells[i].removeAttribute('disabled');\n }\n for (var i = 0; i < singleCells.length; i++) {\n singleCells[i].classList.remove('visible');\n singleCells[i].setAttribute('disabled', 'disabled');\n }\n cellSettings.classList.remove( 'visible' );\n } else if (markedCells === 1) {\n for (var i = 0; i < multipleCells.length; i++) {\n multipleCells[i].classList.remove('visible');\n multipleCells[i].setAttribute('disabled', 'disabled');\n }\n for (var i = 0; i < noCells.length; i++) {\n noCells[i].classList.remove('visible');\n noCells[i].setAttribute('disabled', 'disabled');\n }\n for (var i = 0; i < singleCells.length; i++) {\n singleCells[i].classList.add('visible');\n singleCells[i].removeAttribute('disabled');\n }\n let cellHighlighted = document.querySelector( '.wptb-highlighted' );\n if( cellHighlighted ) {\n let wptbTableColumnWidthSlider = document.getElementById( 'wptb-table-column-width-slider' );\n let wptbTableColumnWidthNumber = document.getElementById( 'wptb-table-column-width-number' );\n let tableColumnWidthAutoFixedCheckbox = document.getElementById( 'wptb-table-column-width-auto-fixed' );\n let width = cellHighlighted.style.width;\n if( width ) {\n wptbTableColumnWidthSlider.value = parseFloat( width, 10 );\n wptbTableColumnWidthNumber.value = parseFloat( width, 10 );\n tableColumnWidthAutoFixedCheckbox.checked = true;\n } else if( cellHighlighted.dataset.wptbFixedWidth ) {\n wptbTableColumnWidthSlider.value = cellHighlighted.dataset.wptbFixedWidth;\n wptbTableColumnWidthNumber.value = cellHighlighted.dataset.wptbFixedWidth;\n tableColumnWidthAutoFixedCheckbox.checked = true;\n } else {\n let cellWidth = WPTB_Helper.getColumnWidth( table, cellHighlighted );\n wptbTableColumnWidthSlider.value = cellWidth;\n wptbTableColumnWidthNumber.value = cellWidth;\n tableColumnWidthAutoFixedCheckbox.checked = false;\n }\n \n \n let wptbTableRowHeightSlider = document.getElementById( 'wptb-table-row-height-slider' );\n let wptbTableRowHeightNumber = document.getElementById( 'wptb-table-row-height-number' );\n let tableRowHeightAutoFixedCheckbox = document.getElementById( 'wptb-table-row-height-auto-fixed' );\n let height = cellHighlighted.style.height;\n if( height ) {\n wptbTableRowHeightSlider.value = parseFloat( height, 10 );\n wptbTableRowHeightNumber.value = parseFloat( height, 10 );\n tableRowHeightAutoFixedCheckbox.checked = true;\n } else if( cellHighlighted.dataset.wptbFixedHeight ) {\n wptbTableRowHeightSlider.value = cellHighlighted.dataset.wptbFixedHeight;\n wptbTableRowHeightNumber.value = cellHighlighted.dataset.wptbFixedHeight;\n tableRowHeightAutoFixedCheckbox.checked = true;\n } else {\n let cellHeight = WPTB_Helper.getRowHeight( table, cellHighlighted );\n wptbTableRowHeightSlider.value = cellHeight;\n wptbTableRowHeightNumber.value = cellHeight;\n tableRowHeightAutoFixedCheckbox.checked = false;\n }\n }\n cellSettings.classList.add( 'visible' );\n } else {\n for (var i = 0; i < multipleCells.length; i++) {\n if (table.isSquare(array)) {\n multipleCells[i].classList.add('visible');\n multipleCells[i].removeAttribute('disabled');\n } else {\n multipleCells[i].classList.remove('visible');\n multipleCells[i].setAttribute('disabled', 'disabled');\n }\n }\n for (var i = 0; i < noCells.length; i++) {\n noCells[i].classList.remove('visible');\n noCells[i].setAttribute('disabled', 'disabled');\n }\n for (var i = 0; i < singleCells.length; i++) {\n singleCells[i].classList.remove('visible');\n singleCells[i].setAttribute('disabled', 'disabled');\n }\n cellSettings.classList.remove( 'visible' );\n }\n };\n\n /* \n * This function fills an array with 1's according to the actual design\n * of HTML table.\n * @returns an array of arrays containing an abstract representation\n * of HTML table.\n * @deprecated\n * */\n\n var realTimeArray = function () {\n var carried = [], tds, cols, matriz = [];\n\n for (var i = 0; i < maxAmountOfCells; i++) {\n carried[i] = 0;\n }\n\n for (var i = 0; i < table.rows.length; i++) {\n cols = [];\n\n var tds = table.rows[i].getElementsByTagName('td');\n\n for (items = 0; items < tds.length; items++) {\n\n for (var k = 0; k < tds[items].colSpan; k++) {\n cols.push(1);\n }\n\n if (tds[items].rowSpan > 1) {\n for (var k = 0; k < tds[items].colSpan; k++) {\n carried[items + k] = {\n justAssigned: true,\n amount: tds[items].rowSpan\n };\n }\n }\n }\n\n for (var k = 0; k < maxAmountOfCells; k++) {\n if (typeof carried[k] == 'object' && carried[k].amount > 0) {\n carried[k].amount--;\n if (carried[k].justAssigned) {\n carried[k].justAssigned = false;\n } else {\n cols.push(1);\n }\n }\n }\n\n matriz.push(cols);\n\n }\n return matriz;\n };\n\n /*\n * This function gets the number and position of cell spaces in current row that are occuped \n * by upper rowspanned cells.\n * @param number the number of row where we wish to calculate the carried rowspans up to.\n * @return an array with the remaining rowspans in each column.\n */\n var carriedRowspans = function (row) {\n var carried = [], tds, cols;\n\n for (var i = 0; i < maxAmountOfCells; i++) {\n carried[i] = 0;\n }\n\n if (row == -1) {\n return carried;\n }\n\n for (var i = 0; i <= row; i++) {\n cellsBuffer = table.rows[i].getElementsByTagName('td');\n cellPointer = 0;\n\n for (var xPosition = 0; xPosition < maxAmountOfCells; xPosition += stepsToMove) {\n stepsToMove = 1;\n\n if (carried[xPosition]) {\n carried[xPosition]--;\n } else {\n celda = cellsBuffer[cellPointer++];\n if (celda.rowSpan > 1) {\n for (k = 0; k < celda.colSpan; k++) {\n carried[xPosition + k] = celda.rowSpan - 1;\n }\n stepsToMove = celda.colSpan;\n } else if (celda.colSpan > 1) {\n stepsToMove = celda.colSpan;\n }\n }\n }\n\n }\n return carried;\n };\n\n /*\n * A helpful function for showing\n * the abstract table in console.\n * @param Array our abstract table.\n */\n var drawTable = function (a) {\n var string = 'DRAWING TABLE:\\n';\n for (var i = 0; i < a.length; i++) {\n\n for (var j = 0; j < a[i].length; j++) {\n string += ' ' + a[i][j];\n }\n string += '\\n';\n }\n table.isSquare(a);\n };\n\n /*\n * It resets all the bits of our abstract representation\n * to 0 and removes the highlighting class of all cells.\n */\n\n var undoSelect = function () {\n var noCells = document.getElementsByClassName('wptb-no-cell-action'),\n singleCells = document.getElementsByClassName('wptb-single-action'),\n multipleCells = document.getElementsByClassName('wptb-multiple-select-action'),\n cellSettings = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ),\n tds = table.getElementsByClassName('wptb-highlighted');\n while (tds.length) {\n tds[0].classList.remove('wptb-highlighted');\n }\n cellSettings.classList.remove( 'visible' );\n for (var i = 0; i < array.length; i++) {\n for (var j = 0; j < array[i].length; j++) {\n array[i][j] = 0;\n }\n }\n for (var i = 0; i < multipleCells.length; i++) {\n multipleCells[i].classList.remove('visible');\n multipleCells[i].setAttribute('disabled', 'disabled');\n }\n for (var i = 0; i < noCells.length; i++) {\n noCells[i].classList.add('visible');\n noCells[i].removeAttribute('disabled');\n }\n for (var i = 0; i < singleCells.length; i++) {\n singleCells[i].classList.remove('visible');\n singleCells[i].setAttribute('disabled', 'disabled');\n }\n };\n\n /*\n * This fills the abstract representation of our table with \n * zeros, at the start. the max amount of cells is the greatest sum\n * of all colspans for row.\n */\n\n var fillTableArray = function () {\n var colspansSums = [], a = [];\n\n //calculate max amount of cells inside a row\n for (var i = 0; i < table.rows.length; i++) {\n var cells = table.rows[i].getElementsByTagName('td'),\n colspanSumInRow = 0;\n for (var j = 0; j < cells.length; j++) {\n colspanSumInRow += cells[j].colSpan;\n }\n colspansSums.push(colspanSumInRow);\n }\n\n maxAmountOfCells = Math.max.apply(null, colspansSums);\n //calculate max rows\n var maxAmountOfRows = table.rows.length;\n\n // fill with zeros from both values\n for (var i = 0; i < maxAmountOfRows; i++) {\n a[i] = [];\n for (var j = 0; j < maxAmountOfCells; j++) {\n a[i].push(0);\n }\n }\n drawTable(a);\n return a;\n };\n\n /*\n * This function gets the sum of all colspans in a row.\n * @param number the number of row to be used as reference.\n */\n var getActualPointsInRow = function (row) {\n var tds = table.rows[row].getElementsByTagName('td'),\n points = 0;\n for (var i = 0; i < tds.length; i++) {\n points += tds[i].colSpan;\n }\n return points;\n }\n\n /*\n * This function gets us the exact coordinates of\n * an exact cell, in a more reliable way than xIndex and yIndex,\n * these last ones were meant to be used for getting the cell trough them.\n * @param DOMElement the cell to get the coordinates.\n */\n var getCoords = function (search) {\n var skipInCols = [], cell;\n\n for (var i = 0; i < maxAmountOfCells; i++) {\n skipInCols[i] = 0;\n }\n\n for (var i = 0; i < table.rows.length; i++) {\n var cellsBuffer = table.rows[i].getElementsByTagName('td');\n cellPointer = 0;\n for (var xPosition = 0; xPosition < maxAmountOfCells; xPosition += stepsToMove) {\n stepsToMove = 1;\n\n if (skipInCols[xPosition]) {\n skipInCols[xPosition]--;\n } else {\n var td = cellsBuffer[cellPointer++];\n if (td == search) {\n return [i, xPosition];\n }\n if (td.rowSpan > 1) {\n for ( let k = 0; k < td.colSpan; k++ ) {\n skipInCols[xPosition + k] = td.rowSpan - 1;\n }\n stepsToMove = td.colSpan;\n } else if (td.colSpan > 1) {\n stepsToMove = td.colSpan;\n }\n }\n }\n }\n };\n\n jQuery('#wptb-table-header-bg').val('');\n jQuery('#wptb-even-row-bg').val('');\n jQuery('#wptb-odd-row-bg').val('');\n jQuery('#wptb-table-border-color').val('');\n jQuery('#wptb-table-inner-border-number,#wptb-table-inner-border-slider').val('0');\n jQuery('#wptb-table-border-number,#wptb-table-border-slider').val('0');\n jQuery('#wptb-table-padding-number,#wptb-table-padding-slider').val('15');\n\n if (columns || rows) {\n //END OF PRIVATE FUNCTIONS\n for (var i = 0; i < settings.length; i++) {\n if (settings[i].id !== 'wptb-apply-inner-border') {\n settings[i].classList.add('visible');\n }\n }\n\n //Create a HTML Table element.\n table = document.createElement( 'table' );\n table.classList.add( 'wptb-preview-table' );\n table.dataset.reconstraction = 1;\n 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 row.appendChild(cell.getDOMElement());\n }\n }\n } else {\n let wptb_preview_table = document.getElementsByClassName( 'wptb-preview-table' );\n\n if (wptb_preview_table.length > 0) {\n table = wptb_preview_table[0];\n\n let cells = table.getElementsByTagName('td');\n\n if (cells.length > 0) {\n for (let i = 0; i < cells.length; i++) {\n WPTB_Cell(mark, cells[i]);\n }\n }\n }\n }\n\n /*\n * This just toggles visibility of cell edit bar, and toggles \n * cell selecting mode.\n */\n\n table.toggleTableEditMode = function () {\n let bar = document.getElementsByClassName('wptb-edit-bar'),\n cellModeBackground = document.getElementById('wptb-cell_mode_background'),\n leftScrollPanelCurtain = document.getElementById('wptb-left-scroll-panel-curtain'),\n leftScrollPanelCellSettings = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ),\n wptbPreviewTable = document.getElementsByClassName('wptb-preview-table');\n if (wptbPreviewTable.length > 0) {\n wptbPreviewTable = wptbPreviewTable[0];\n }\n\n if ( bar.length > 0 ) {\n for ( let i = 0; i < bar.length; i++ ) {\n if ( bar[i].classList.contains( 'visible' ) ) {\n document.select.deactivateMultipleSelectMode();\n bar[i].classList.remove( 'visible' );\n cellModeBackground.classList.remove( 'visible' );\n leftScrollPanelCurtain.classList.remove( 'visible' );\n leftScrollPanelCellSettings.classList.remove( 'visible' );\n wptbPreviewTable.parentNode.classList.remove( 'wptb-preview-table-manage-cells' );\n let wptbPreviewTableTds = wptbPreviewTable.getElementsByTagName( 'td' );\n if ( wptbPreviewTableTds.length > 0 ) {\n for ( let i = 0; i < wptbPreviewTableTds.length; i++ ) {\n wptbPreviewTableTds[i].classList.remove( 'wptb-highlighted' );\n }\n }\n } else {\n document.select.activateMultipleSelectMode();\n bar[i].classList.add( 'visible' );\n cellModeBackground.classList.add( 'visible' );\n leftScrollPanelCurtain.classList.add( 'visible' );\n wptbPreviewTable.parentNode.classList.add( 'wptb-preview-table-manage-cells' );\n }\n }\n\n }\n }\n\n /*\n * For assigning to each cell xIndex and y Index attributes,\n * these are the column number and row number of cell in table. \n */\n\n table.recalculateIndexes = function ( start ) {\n let trs = this.getElementsByTagName('tr'), tds, maxCols = 0, maxColsFull = 0,\n tdsArr = [];\n let wptbTopRowAsHeader = document.getElementById( 'wptb-top-row-as-header' );\n \n for (var i = 0; i < trs.length; i++) {\n if ( i == 0 ) {\n if ( start == undefined ) {\n trs[i].style.backgroundColor = jQuery('#wptb-table-header-bg').val();\n }\n if( wptbTopRowAsHeader.checked ) {\n if( start == undefined ) {\n this.classList.add( 'wptb-table-preview-head' ); \n trs[i].classList.add( 'wptb-table-head' )\n } ;\n } else {\n if( start == undefined ) {\n this.classList.remove( 'wptb-table-preview-head' );\n trs[i].classList.remove( 'wptb-table-head' );\n }\n }\n } else {\n if (i % 2 == 0) {\n if ( start == undefined ) {\n trs[i].style.backgroundColor = jQuery('#wptb-odd-row-bg').val();\n }\n trs[i].classList.remove( 'wptb-table-head' );\n } else {\n if ( start == undefined ) {\n trs[i].style.backgroundColor = jQuery('#wptb-even-row-bg').val();\n }\n trs[i].classList.remove( 'wptb-table-head' );\n }\n }\n\n tdsArr[i];\n tds = trs[i].getElementsByTagName('td');\n\n if (tdsArr[i] == undefined) {\n tdsArr[i] = [];\n }\n\n let jMainIter = 0;\n for (var j = 0; j < tds.length; j++) {\n if (tdsArr[i][j] != undefined) {\n for (let y = 0; y < 100; y++) {\n if (tdsArr[i][jMainIter] != undefined) {\n jMainIter++;\n continue;\n }\n tdsArr[i][jMainIter] = tds[j];\n tds[j].dataset.xIndex = jMainIter;\n break;\n }\n } else {\n tdsArr[i][j] = tds[j];\n tds[j].dataset.xIndex = jMainIter;\n }\n tds[j].dataset.yIndex = i;\n\n if (tds[j].colSpan > 1) {\n for (let k = 1; k < tds[j].colSpan; k++) {\n jMainIter++;\n tdsArr[i][jMainIter] = 'tdDummy';\n }\n }\n\n if (tds[j].rowSpan > 1) {\n for (let x = 1; x < tds[j].rowSpan; x++) {\n if (tdsArr[i + x] == undefined) {\n tdsArr[i + x] = [];\n }\n for (let z = 0; z < tds[j].colSpan; z++) {\n tdsArr[i + x][jMainIter - tds[j].colSpan + 1 + z ] = 'tdDummy';\n }\n }\n }\n jMainIter++;\n if( i == 0 ) {\n maxColsFull = jMainIter;\n }\n }\n if (j > maxCols) {\n maxCols = j;\n }\n }\n this.columns = maxCols;\n this.maxCols = maxColsFull;\n }\n \n table.addColumnWidth = function( value, cleaner ) {\n let highlighted = table.getElementsByClassName( 'wptb-highlighted' );\n if( highlighted.length > 0 ) {\n for( let k = 0; k < highlighted.length; k++ ) {\n let dataXIndex = highlighted[k].dataset.xIndex;\n if( dataXIndex ) {\n function tableTdsFor( dataXIndex, colspan ) {\n let tableRows = table.rows;\n let widthIsSet = false;\n let arrayTdsFromPreviousRow = [];\n for( let i = 0; i < tableRows.length; i++ ) {\n let row = tableRows[i];\n let tds = row.children;\n for( let j = 0; j < tds.length; j++ ) {\n let td = tds[j];\n if( td.dataset.xIndex == dataXIndex ) {\n if( value ) {\n if( td.colSpan == colspan ) {\n td.style.width = value + 'px';\n td.removeAttribute( 'data-wptb-fixed-width' );\n widthIsSet = true;\n let tableColumnWidthAutoFixedCheckbox = document.getElementById( 'wptb-table-column-width-auto-fixed' );\n if( ! tableColumnWidthAutoFixedCheckbox.checked ) {\n tableColumnWidthAutoFixedCheckbox.checked = true;\n }\n } else {\n td.style.width = null;\n td.dataset.wptbFixedWidth = value;\n if( i == tableRows.length - 1 && ! widthIsSet ) {\n tableTdsFor( dataXIndex, colspan + 1 );\n }\n }\n } else if( cleaner ) {\n td.style.width = null;\n td.removeAttribute( 'data-wptb-fixed-width' );\n } else {\n if( td.dataset.wptbFixedWidth ) {\n if( td.colSpan == colspan ) {\n td.style.width = td.dataset.wptbFixedWidth + 'px';\n td.removeAttribute( 'data-wptb-fixed-width' );\n } \n } else if( td.style.width ) {\n for( let z = 0; z < arrayTdsFromPreviousRow.length; z++ ) {\n arrayTdsFromPreviousRow[z].style.width = td.style.width;\n }\n arrayTdsFromPreviousRow = [];\n } else {\n arrayTdsFromPreviousRow.push( td );\n }\n }\n break;\n } \n }\n }\n }\n \n tableTdsFor( dataXIndex, 1 );\n }\n }\n \n table.tdDefaultWidth();\n }\n }\n \n table.tdDefaultWidth = function() {\n let rows = table.rows;\n \n let tableTdsSumMaxWidth = 0;\n let tableTdsSumMaxWidthFixed = 0;\n let tableTdsSumMaxWidthAuto = 0;\n \n let wptbTableSetup = document.getElementsByClassName( 'wptb-table-setup' )[0];\n let wptbTableSetupWidth = wptbTableSetup.offsetWidth;\n \n let arrayCellsWidthFixedHelper = [];\n let arrayCellsWidthAutoHelper = [];\n let tdPaddingCommon = 0;\n let tableTdBorderCommonWidth = 0;\n let cssForTdsWidthAuto = '';\n \n for( let i = 0; i < rows.length; i++ ) {\n let tds = rows[i].children;\n for( let j = 0; j < tds.length; j++ ) {\n let td = tds[j];\n \n if( ! arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] && ! arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] ) {\n if( td.style.width ) {\n arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] = parseFloat( td.style.width );\n td.removeAttribute( 'data-wptb-css-td-auto-width' );\n } else {\n if( ! td.dataset.wptbFixedWidth ) {\n arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] = 100;\n td.dataset.wptbCssTdAutoWidth = true;\n }\n }\n \n if( window.getComputedStyle( td, null ) ) {\n let tdStyleObj = window.getComputedStyle( td, null );\n let tdPaddingLeft = tdStyleObj.getPropertyValue( 'padding-left' );\n let tdPaddingRight = tdStyleObj.getPropertyValue( 'padding-right' );\n tdPaddingCommon = parseFloat( tdPaddingLeft, 10 ) + parseFloat( tdPaddingRight, 10 );\n\n let tableTdBorderLeftWidth = tdStyleObj.getPropertyValue( 'border-left-width' );\n let tableTdBorderRightWidth = tdStyleObj.getPropertyValue( 'border-right-width' );\n tableTdBorderCommonWidth = parseFloat( tableTdBorderLeftWidth, 10 ) + parseFloat( tableTdBorderRightWidth, 10 );\n if( arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] ) {\n arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] += tdPaddingCommon;\n arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] += tableTdBorderCommonWidth;\n } else {\n arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] += tdPaddingCommon;\n arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] += tableTdBorderCommonWidth;\n }\n }\n } else if( arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] ) {\n if( ! td.dataset.wptbFixedWidth ) {\n td.dataset.wptbCssTdAutoWidth = true;\n }\n } else if( arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] ) {\n td.removeAttribute( 'data-wptb-css-td-auto-width' );\n }\n }\n }\n \n for( let i = 0; i < arrayCellsWidthFixedHelper.length; i++ ) {\n if( arrayCellsWidthFixedHelper[i] ) {\n tableTdsSumMaxWidthFixed += arrayCellsWidthFixedHelper[i];\n }\n }\n \n let CellsWidthAutoCount = 0;\n for( let i = 0; i < arrayCellsWidthAutoHelper.length; i++ ) {\n if( arrayCellsWidthAutoHelper[i] ) {\n tableTdsSumMaxWidthAuto += arrayCellsWidthAutoHelper[i];\n CellsWidthAutoCount++;\n }\n }\n \n let tableFullStyleObj = window.getComputedStyle( table, null );\n let borderLeftWidth = tableFullStyleObj.getPropertyValue( 'border-left-width' );\n let borderRightWidth = tableFullStyleObj.getPropertyValue( 'border-right-width' );\n let tableBorderCommon = parseFloat( borderLeftWidth, 10 ) + parseFloat( borderRightWidth, 10 );\n tableTdsSumMaxWidth = tableTdsSumMaxWidthFixed + tableTdsSumMaxWidthAuto + tableBorderCommon;\n \n table.dataset.wptbTableTdsSumMaxWidth = tableTdsSumMaxWidth;\n if( CellsWidthAutoCount ) {\n table.dataset.wptbCellsWidthAutoCount = CellsWidthAutoCount;\n if( table.mergingСellsHorizontally ) {\n table.dataset.wptbFixedWidthSize = tableTdsSumMaxWidthFixed - tableBorderCommon;\n } else {\n table.removeAttribute( 'data-wptb-fixed-width-size' );\n }\n } else {\n table.removeAttribute( 'data-wptb-fixed-width-size' );\n table.removeAttribute( 'data-wptb-cells-width-auto-count' );\n }\n \n let styleElementCreate = false;\n let tableTdWidthAuto;\n if( tableTdsSumMaxWidth < wptbTableSetupWidth ) {\n if( CellsWidthAutoCount ) {\n table.style.minWidth = '100%';\n if( table.mergingСellsHorizontally ) {\n table.style.width = null;\n let tableTdsWidthAutoCommon = wptbTableSetupWidth - tableTdsSumMaxWidthFixed - tableBorderCommon;\n tableTdWidthAuto = tableTdsWidthAutoCommon / CellsWidthAutoCount;\n tableTdWidthAuto = tableTdWidthAuto - tdPaddingCommon - tableTdBorderCommonWidth;\n styleElementCreate = true;\n } else {\n table.style.width = '100%';\n }\n } else {\n table.style.width = null;\n table.style.minWidth = null;\n table.style.maxWidth = tableTdsSumMaxWidth + 'px';\n }\n } else {\n table.style.maxWidth = null;\n table.style.minWidth = tableTdsSumMaxWidth + 'px';\n table.style.width = null;\n tableTdWidthAuto = '100'\n styleElementCreate = true;\n }\n \n let head = document.head;\n if( head ) {\n let cssForTdsWidthAutoOld = head.querySelector( 'style[data-wptb-td-auto-width=\"true\"]' );\n if( cssForTdsWidthAutoOld ) {\n head.removeChild( cssForTdsWidthAutoOld );\n }\n }\n \n if( styleElementCreate ) {\n cssForTdsWidthAuto = document.createElement( 'style' );\n cssForTdsWidthAuto.setAttribute( 'data-wptb-td-auto-width', true );\n cssForTdsWidthAuto.innerHTML = '[data-wptb-css-td-auto-width=true]{width:' + tableTdWidthAuto + 'px}';\n if( head ) {\n head.appendChild( cssForTdsWidthAuto );\n }\n }\n }\n \n table.addRowHeight = function( value, cleaner ) {\n let highlighted = table.getElementsByClassName( 'wptb-highlighted' );\n if( highlighted.length > 0 ) {\n for( let k = 0; k < highlighted.length; k++ ) {\n let dataYIndex = highlighted[k].dataset.yIndex;\n if( dataYIndex ) {\n function tableTdsFor( dataYIndex, rowspan ) {\n let tableRows = table.rows;\n let heightIsSet = false;\n let arrayTdsPrevious = [];\n for( let i = 0; i < tableRows.length; i++ ) {\n let row = tableRows[i];\n let tds = row.children;\n for( let j = 0; j < tds.length; j++ ) {\n let td = tds[j];\n if( td.dataset.yIndex == dataYIndex ) {\n if( value ) {\n if( td.rowSpan == rowspan ) {\n td.style.height = value + 'px';\n td.removeAttribute( 'data-wptb-fixed-heidht' );\n heightIsSet = true;\n let tableColumnHeightAutoFixedCheckbox = document.getElementById( 'wptb-table-row-height-auto-fixed' );\n if( ! tableColumnHeightAutoFixedCheckbox.checked ) {\n tableColumnHeightAutoFixedCheckbox.checked = true;\n }\n continue;\n } else {\n td.style.height = null;\n td.dataset.wptbFixedHeight = value;\n if( j == tds.length - 1 && ! heightIsSet ) {\n tableTdsFor( dataYIndex , rowspan + 1 );\n }\n }\n } else if( cleaner ) {\n td.style.height = null;\n td.removeAttribute( 'data-wptb-fixed-heidht' );\n } else {\n if( td.dataset.wptbFixedHeight ) {\n if( td.rowSpan = rowspan ) {\n td.style.height = td.dataset.wptbFixedHeight + 'px';\n td.removeAttribute( 'data-wptb-fixed-width' );\n }\n } else if( td.style.height ) {\n for( let z = 0; z < arrayTdsPrevious.length; z++ ) {\n arrayTdsPrevious[z].style.height = td.style.height;\n }\n arrayTdsPrevious = [];\n } else {\n arrayTdsPrevious.push( td );\n }\n }\n } \n }\n }\n }\n \n tableTdsFor( dataYIndex, 1 );\n }\n }\n }\n }\n \n table.reconstraction = function() {\n let tds = table.getElementsByTagName( 'td' );\n let wptbAdaptiveTableChoseBlock = document.getElementsByClassName( 'wptb-adaptive-table-chose-block' );\n if( wptbAdaptiveTableChoseBlock.length > 0 ) {\n wptbAdaptiveTableChoseBlock = wptbAdaptiveTableChoseBlock[0];\n }\n table.mergingСellsHorizontally = false;\n table.mergingCellsVertically = false;\n table.dataset.reconstraction = 1;\n wptbAdaptiveTableChoseBlock.style.display = 'block';\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 wptbAdaptiveTableChoseBlock.style.display = 'none';\n table.mergingСellsHorizontally = true;\n forBreak++;\n }\n \n if( tds[i].rowSpan > 1 ) {\n table.dataset.reconstraction = 0;\n wptbAdaptiveTableChoseBlock.style.display = 'none';\n table.mergingCellsVertically = true;\n forBreak++;\n }\n \n if( forBreak == 2 ) {\n break;\n }\n }\n }\n\n /*\n * As simple as it is: adds a column to the end of table.\n */\n table.addColumnEnd = function () {\n let td,\n currentTable = document.getElementsByClassName('wptb-preview-table'),\n currentTableTd,\n currentTdStyle;\n if (currentTable.length > 0) {\n currentTableTd = currentTable[0].querySelector('td');\n }\n\n if (currentTableTd) {\n currentTdStyle = currentTableTd.getAttribute('style');\n }\n \n for (var i = 0; i < table.rows.length; i++) {\n td = new WPTB_Cell(mark);\n \n if (currentTdStyle) {\n td.getDOMElement().setAttribute('style', currentTdStyle);\n td.getDOMElement().style.width = null;\n }\n \n table.rows[i].appendChild(td.getDOMElement());\n array[i].push(0);\n }\n \n maxAmountOfCells++;\n table.recalculateIndexes();\n table.tdDefaultWidth();\n table.addRowHeight();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n 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 }\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 let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n /*\n * Well, not so simple as previous functions.\n * It adds a column after a certain column of reference.\n * @param integer the column number to be used as reference.\n *\tIf empty, then the first highlighted cell is used as reference.\n */\n\n table.addColumnAfter = function (c_pos) {\n let rows = table.rows,\n cellPointer,\n cellsBuffer,\n cell = document.querySelector('.wptb-highlighted'),\n cellStyle = cell.getAttribute('style'),\n pos = c_pos != undefined && typeof c_pos === 'number' ? c_pos : getCoords(cell)[1];\n \n \n \n if( maxAmountOfCells - pos - cell.colSpan + 1 == 1 ) {\n table.addColumnEnd();\n } else {\n let pendingInsertion = false,\n stepsToMove,\n td, bro,\n carriedRowspans = [],\n currentCell;\n\n for (var i = 0; i < maxAmountOfCells; i++) {\n carriedRowspans.push(0);\n }\n\n for (var i = 0; i < rows.length; i++) {\n cellPointer = 0;\n cellsBuffer = rows[i].getElementsByTagName('td');\n pendingInsertion = false;\n for (var xPosition = 0;\n xPosition < maxAmountOfCells;\n xPosition += stepsToMove) {\n stepsToMove = 1;\n\n if (pendingInsertion) {\n td = new WPTB_Cell(mark);\n if (cellStyle) {\n td.getDOMElement().setAttribute('style', cellStyle);\n td.getDOMElement().style.width = null;\n }\n if (currentCell && rows[i].contains(currentCell)) {\n bro = currentCell.nextSibling;\n if (bro) {\n rows[i].insertBefore(td.getDOMElement(), bro);\n } else {\n rows[i].appendChild(td.getDOMElement());\n }\n } else {\n rows[i].insertBefore(td.getDOMElement(), cellsBuffer[0]);\n }\n break;\n } else if (carriedRowspans[xPosition] > 0) {\n // If no pending insertion, let's check if no rowspan from upper cells is pending in current position\n if (pos == xPosition) {\n pendingInsertion = true;\n }\n } else {\n currentCell = cellsBuffer[cellPointer++];\n if (currentCell.rowSpan > 1) {\n stepsToMove = currentCell.colSpan;\n for (var k = 0; k < currentCell.colSpan; k++) {\n carriedRowspans[xPosition + k] = currentCell.rowSpan;\n if (xPosition + k == pos) {\n pendingInsertion = true;\n }\n }\n } else if (currentCell.colSpan > 1) {\n stepsToMove = currentCell.colSpan;\n for (var k = 0; k < currentCell.colSpan; k++) {\n if (xPosition + k == pos) {\n pendingInsertion = true;\n }\n }\n } else if (xPosition == pos) {\n pendingInsertion = true;\n }\n }\n }\n\n for (var l = 0; l < maxAmountOfCells; l++) {\n if (carriedRowspans[l] > 0)\n carriedRowspans[l]--;\n }\n\n }\n\n for (var i = 0; i < array.length; i++) {\n array[i].push(0);\n }\n maxAmountOfCells++;\n drawTable(array);\n table.recalculateIndexes();\n table.addColumnWidth();\n table.addRowHeight();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n };\n\n /*\n * For preventing us to take a lot of time,\n * This is just calling the function addColumnAfter, but\n * using the previous column to current one as reference.\n * @see addColumnAfter\n */\n\n table.addColumnBefore = function () {\n var cell = document.querySelector('.wptb-highlighted'),\n pos = getCoords(cell)[1];\n\n if (pos === 0) {\n table.addColumnStart();\n } else {\n table.addColumnAfter(pos - 1);\n }\n };\n\n /*\n * Luckily, thisfunction is simple, \n * it just add a row to the end of table.\n */\n\n table.addRowToTheEnd = function () {\n let r = table.insertRow(-1),\n td,\n aux,\n currentTable = document.getElementsByClassName('wptb-preview-table'),\n currentTableTd,\n currentTdStyle;\n r.classList.add( 'wptb-row' );\n if (currentTable.length > 0) {\n currentTableTd = currentTable[0].querySelector('td');\n }\n\n if (currentTableTd) {\n currentTdStyle = currentTableTd.getAttribute('style');\n }\n\n for (var i = 0; i < maxAmountOfCells; i++) {\n td = new WPTB_Cell(mark);\n if (currentTdStyle) {\n td.getDOMElement().setAttribute('style', currentTdStyle);\n }\n r.appendChild(td.getDOMElement());\n }\n aux = Array.from(array[0]);\n array.push(aux);\n drawTable(array);\n table.recalculateIndexes();\n table.addColumnWidth();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n /*\n * Yet another simple function, \n * it just add a row to the start of table.\n */\n\n table.addRowToTheStart = function () {\n let r = table.insertRow(0),\n td,\n aux,\n currentTable = document.getElementsByClassName('wptb-preview-table'),\n currentTableTd,\n currentTdStyle;\n r.classList.add( 'wptb-row' );\n if (currentTable.length > 0) {\n currentTableTd = currentTable[0].querySelector('td');\n }\n\n if (currentTableTd) {\n currentTdStyle = currentTableTd.getAttribute('style');\n }\n\n for (var i = 0; i < maxAmountOfCells; i++) {\n td = new WPTB_Cell(mark);\n if (currentTdStyle) {\n td.getDOMElement().setAttribute('style', currentTdStyle);\n }\n r.appendChild(td.getDOMElement());\n }\n aux = Array.from(array[0]);\n array.push(aux);\n drawTable(array);\n table.recalculateIndexes();\n table.addColumnWidth();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n /* \n * This function adds a row before the current one.\n * Since the biggest factor of problem is a not-started but ongoing rowspan,\n * the most of the troubles is not here.\n */\n\n table.addRowBefore = function () {\n let cell = document.querySelector('.wptb-highlighted'),\n cellStyle = cell.getAttribute('style'),\n row = getCoords(cell)[0],\n cellNew;\n for( let i = row - 1; i >= 0; i-- ) {\n let rowChildren = table.rows[i].children;\n let rowChildrenLength = rowChildren.length;\n if( rowChildrenLength > 0 ) {\n for( let j = 0; j < rowChildrenLength; j++ ) {\n if( rowChildren[j].rowSpan == 1 ) {\n row = i;\n cellNew = true;\n break;\n }\n }\n }\n if ( cellNew ) {\n break;\n }\n }\n\n if (row === 0) {\n table.addRowToTheStart();\n } else {\n table.addRowAfter( row, cellStyle );\n }\n };\n\n /*\n * Well... by the name convention of the previous 3 functions,\n * it's pretty obvious that this functions attaches a new\n * row after highlighted cell row. The greatest obstacle it was\n * the possibility of a TR not having the exact amount of columns\n * occuped by actual node but rowspanned upper cells. For that purpose\n * it was created the function realTimeArray.\n * @see realTimeArray\n */\n\n table.addRowAfter = function ( row, cellStyle ) {\n let cellRowSpan,\n rowAfter,\n aux;\n \n if ( ( row == undefined || typeof row !== 'number' ) && cellStyle == undefined ) {\n let cell = document.querySelector('.wptb-highlighted');\n cellStyle = cell.getAttribute('style'),\n row = getCoords(cell)[0],\n cellRowSpan = cell.rowSpan,\n rowAfter = row + cellRowSpan - 1;\n } else {\n rowAfter = row;\n }\n \n \n let cellsColSpan = 0;\n if ( rowAfter < table.rows.length -1 ) {\n for( let i = 0; i <= rowAfter ; i++ ) {\n let tableRowsIChildren = table.rows[i].children,\n tableRIChildrenLength = tableRowsIChildren.length;\n if( tableRIChildrenLength > 0 ) {\n for( let j = 0; j < tableRIChildrenLength; j++ ) {\n let rowIRowSpan = tableRowsIChildren[j].rowSpan;\n\n if ( rowIRowSpan - 1 + i > rowAfter ) {\n tableRowsIChildren[j].rowSpan++;\n }\n }\n }\n }\n \n let rNext = table.rows[rowAfter + 1],\n rNextChildren = rNext.children,\n rNextChildrenLength = rNextChildren.length;\n \n if( rNextChildrenLength > 0 ) {\n for ( let i = 0; i < rNextChildrenLength; i++ ) {\n cellsColSpan += rNextChildren[i].colSpan;\n }\n }\n } else {\n cellsColSpan = array[0].length;\n }\n \n let r = table.insertRow( rowAfter + 1 );\n r.classList.add( 'wptb-row' );\n \n for ( j = 0; j < cellsColSpan; j++ ) {\n let td = new WPTB_Cell( mark );\n td.getDOMElement().setAttribute( 'style', cellStyle );\n td.getDOMElement().style.width = null;\n td.getDOMElement().style.height = null;\n r.appendChild( td.getDOMElement() );\n }\n\n aux = Array.from(array[0]);\n array.push(aux);\n drawTable(array);\n table.recalculateIndexes();\n table.addColumnWidth();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n 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 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 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 table.toggleTableEditMode();\n wptbTableSetup.innerHTML = '';\n WPTB_Helper.settingsPanelClear();\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\n }\n \n table.recalculateIndexes();\n WPTB_Helper.dataTitleColumnSet( table );\n }\n \n undoSelect();\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 table.toggleTableEditMode();\n wptbTableSetup.innerHTML = '';\n WPTB_Helper.settingsPanelClear();\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\n }\n \n table.recalculateIndexes();\n table.tdDefaultWidth();\n WPTB_Helper.dataTitleColumnSet( table );\n }\n \n undoSelect();\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'none';\n\n array = fillTableArray();\n\n undoSelect();\n drawTable(array);\n\n wptbTableSetup.appendChild(table);\n //if (columns || rows) {\n table.recalculateIndexes( true );\n //}\n table.reconstraction();\n table.tdDefaultWidth();\n \n wptbTableSetup.onresize = function() {\n table.tdDefaultWidth();\n };\n\n WPTB_LeftPanel();\n \n // this code gets the ID of the active element in the toolbar \n // and stores it in the data attribute of the common container element \"wpcd_fixed_toolbar\"\n// let wptbPhElement = document.getElementsByClassName( 'wptb-ph-element' );\n// let wpcdFixedToolbar = document.getElementById( 'wpcd_fixed_toolbar' );\n// for ( let i = 0; i < wptbPhElement.length; i++ ) {\n// wptbPhElement[i].addEventListener( 'click', function( e ) {\n// let wptbToolbar = document.getElementById( 'wpcd_fixed_toolbar' ).children;\n// for ( let j = 0; j < wptbToolbar.length; j++ ) {\n// let elementStyles = window.getComputedStyle( wptbToolbar[j], 'null' );\n// if( elementStyles.getPropertyValue( 'display' ) == 'block' ) {\n// wpcdFixedToolbar.dataset.toolbarActiveId = wptbToolbar[j].getAttribute( 'id' );\n// }\n// }\n// }, false );\n// }\n \n// let wptbPanelLeft = document.getElementsByClassName( 'wptb-panel-left' );\n// if( wptbPanelLeft.length > 0 ) {\n// wptbPanelLeft[0].addEventListener( 'click', function( e ) {\n// let toolbarActiveElementId = wpcdFixedToolbar.dataset.toolbarActiveId;\n// document.getElementById( toolbarActiveElementId ).style.display = '';\n// }, false );\n// }\n \n// let body = document.getElementsByTagName( 'body' );\n// if( body.length > 0 ) {\n// body[0].addEventListener( 'click', function( e ) {\n// if ( e.target.classList.contains( 'wptb-panel-left' ) || WPTB_Helper.findAncestor( e.target, 'wptb-panel-left' ) ) {\n// let toolbarActiveElementId = wpcdFixedToolbar.dataset.toolbarActiveId;\n// document.getElementById( toolbarActiveElementId ).style.display = '';\n// }\n// }, false );\n// }\n};","var WPTB_TableStateSaveManager = function() {\n this.tableStateSet = () => {\n // get preview table\n let wptbPreviewTable = document.getElementsByClassName( 'wptb-preview-table' );\n if( wptbPreviewTable.length > 0 ) {\n wptbPreviewTable = wptbPreviewTable[0];\n \n // check if a global array doesn't exist with saved versions of the table \n // them create it\n if( ! window.wptbTableStateSaving ) {\n window.wptbTableStateSaving = [];\n } \n \n // remove the extra part of the array after changing the table \n // when it is showed in the not last modified version\n if( window.wptbTableStateSaving.length > window.wptbTableStateNumberShow + 1 ) {\n window.wptbTableStateSaving = window.wptbTableStateSaving.slice( 0, window.wptbTableStateNumberShow + 1 );\n }\n \n //add new state of table\n let wptbNewPreviewTable = wptbPreviewTable.cloneNode( true );\n let wptbHighlighted = wptbNewPreviewTable.getElementsByClassName( 'wptb-highlighted' );\n for( let i = 0; i < wptbHighlighted.length; i++ ) {\n wptbHighlighted[i].classList.remove( 'wptb-highlighted' );\n }\n let wptbDirectlyhovered = wptbNewPreviewTable.getElementsByClassName( 'wptb-directlyhovered' );\n for( let i = 0; i < wptbDirectlyhovered.length; i++ ) {\n wptbDirectlyhovered[i].classList.remove( 'wptb-directlyhovered' );\n }\n \n let cssForTdsWidthAutoValue = '';\n let head = document.head;\n if( head ) {\n let cssForTdsWidthAuto = head.querySelector( 'style[data-wptb-td-auto-width=\"true\"]' );\n if( cssForTdsWidthAuto ) {\n cssForTdsWidthAutoValue = cssForTdsWidthAuto.innerHTML;\n }\n }\n \n let mceContentBodys = wptbNewPreviewTable.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 = wptbNewPreviewTable.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 mceIds = wptbNewPreviewTable.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 window.wptbTableStateSaving.push( [wptbNewPreviewTable, cssForTdsWidthAutoValue] );\n \n // set new number of state which is showed now\n window.wptbTableStateNumberShow = window.wptbTableStateSaving.length - 1;\n \n // make undo arrow active when the table was changed\n if( window.wptbTableStateSaving.length > 1 ) {\n let wptbUndo = document.getElementsByClassName( 'wptb-undo' );\n if( wptbUndo.length > 0 ) {\n wptbUndo = wptbUndo[0];\n\n wptbUndo.classList.remove( 'wptb-undoredo-disabled' );\n }\n }\n \n // make redo arrow not active when the table was changed\n let wptbRedo = document.getElementsByClassName( 'wptb-redo' );\n if( wptbRedo.length > 0 ) {\n wptbRedo = wptbRedo[0];\n \n wptbRedo.classList.add( 'wptb-undoredo-disabled' );\n }\n \n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\n if( wptbSaveBtn.length > 0 ) {\n wptbSaveBtn = wptbSaveBtn[0];\n if( ( ! wptbSaveBtn.dataset.wptbTableStateNumberSave && window.wptbTableStateNumberShow == 0 ) || \n window.wptbTableStateNumberShow == wptbSaveBtn.dataset.wptbTableStateNumberSave ) {\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\n } else {\n wptbSaveBtn.classList.remove( 'wptb-save-disabled' );\n }\n }\n }\n }\n \n this.tableStateGet = ( datawptbUndoredo ) => {\n if( datawptbUndoredo && window.wptbTableStateSaving && window.wptbTableStateSaving.length > 1 ) {\n \n // changes the number of the state which displays now\n if( datawptbUndoredo == 'undo' ) {\n if( window.wptbTableStateNumberShow > 0 ) {\n window.wptbTableStateNumberShow--;\n } else {\n return false;\n }\n } else if( datawptbUndoredo == 'redo' ) {\n if( window.wptbTableStateNumberShow < window.wptbTableStateSaving.length - 1 ) {\n window.wptbTableStateNumberShow++;\n } else {\n return false;\n }\n }\n \n // add or delete class \"wptb-undoredo-disabled\" for undo button\n let wptbUndo = document.getElementsByClassName( 'wptb-undo' );\n if( wptbUndo.length > 0 ) {\n wptbUndo = wptbUndo[0];\n }\n if( window.wptbTableStateNumberShow == 0 ) {\n if( wptbUndo ) {\n wptbUndo.classList.add( 'wptb-undoredo-disabled' )\n }\n } else if( window.wptbTableStateNumberShow > 0 ) {\n if( wptbUndo ) {\n wptbUndo.classList.remove( 'wptb-undoredo-disabled' )\n }\n }\n \n // add or delete class \"wptb-undoredo-disabled\" for redo button\n let wptbRedo = document.getElementsByClassName( 'wptb-redo' );\n if( wptbRedo.length > 0 ) {\n wptbRedo = wptbRedo[0];\n }\n if( window.wptbTableStateNumberShow == window.wptbTableStateSaving.length - 1 ) {\n if( wptbRedo ) {\n wptbRedo.classList.add( 'wptb-undoredo-disabled' )\n }\n } else if( window.wptbTableStateNumberShow < window.wptbTableStateSaving.length - 1 ) {\n if( wptbRedo ) {\n wptbRedo.classList.remove( 'wptb-undoredo-disabled' )\n }\n }\n \n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\n if( wptbSaveBtn.length > 0 ) {\n wptbSaveBtn = wptbSaveBtn[0];\n if( ( ! wptbSaveBtn.dataset.wptbTableStateNumberSave && window.wptbTableStateNumberShow == 0 ) || \n window.wptbTableStateNumberShow == wptbSaveBtn.dataset.wptbTableStateNumberSave ) {\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\n } else {\n wptbSaveBtn.classList.remove( 'wptb-save-disabled' );\n }\n }\n \n // load necessary saved table state\n let wptbTableSetup = document.getElementsByClassName( 'wptb-table-setup' );\n if( wptbTableSetup.length > 0 ) {\n wptbTableSetup = wptbTableSetup[0];\n\n wptbTableSetup.innerHTML = '';\n wptbTableSetup.appendChild( window.wptbTableStateSaving[window.wptbTableStateNumberShow][0] );\n\n if( window.wptbTableStateSaving[window.wptbTableStateNumberShow][1] ) {\n let cssForTdsWidthAuto = document.createElement( 'style' );\n cssForTdsWidthAuto.setAttribute( 'data-wptb-td-auto-width', true );\n cssForTdsWidthAuto.innerHTML = window.wptbTableStateSaving[window.wptbTableStateNumberShow][1];\n 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 head.appendChild( cssForTdsWidthAuto );\n }\n }\n\n WPTB_Helper.settingsPanelClear();\n WPTB_Helper.elementOptionsPanelClear();\n WPTB_LeftPanel();\n\n let wptbLeftScrollPanelCellSetting = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ); \n if( wptbLeftScrollPanelCellSetting ) {\n wptbLeftScrollPanelCellSetting.classList.remove( 'visible' );\n }\n }\n }\n }\n}","var WPTB_Text = function ( text , DOMElementProt ) {\n let DOMElement = document.createElement('div'),\n elText2 = document.createElement('div'),\n elP = document.createElement('p'),\n kindIndexProt = undefined,\n copy = false;\n \n DOMElement.classList.add( 'wptb-text-container' );\n\n elP.innerHTML = text != undefined ? text : 'Text';\n elText2.appendChild(elP);\n DOMElement.appendChild(elText2);\n if ( DOMElementProt ) {\n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\n kindIndexProt = wptbElementMutch[1];\n copy = true;\n };\n\n let attributes = [...DOMElementProt.attributes];\n for( let i = 0; i < attributes.length; i++ ) {\n DOMElement.setAttribute(attributes[i].name, attributes[i].value);\n }\n } \n\n this.kind = 'text';\n this.getDOMElement = function () {\n return DOMElement;\n };\n applyGenericItemSettings( this, kindIndexProt, copy );\n\n return this;\n};","var WPTB_innerElementSet = function ( element ) {\n \n element.ondragenter = function (e) {\n var div;\n if ( e.dataTransfer.types.indexOf( 'wptbelement' ) == -1 && e.dataTransfer.types.indexOf( 'wptb-moving-mode' ) == -1 ) {\n return;\n }\n WPTB_DropHandle(this, e);\n \n element.classList.add( 'wptb-ondragenter' );\n }\n element.ondragover = function (e) {\n e.preventDefault();\n WPTB_DropHandle(this, e);\n }\n element.ondragleave = function () {\n \n }\n element.ondrop = function(e) {\n this.classList.remove( 'wptb-ondragenter' );\n let element, classId;\n e.preventDefault();\n e.stopPropagation();\n\n if (!e.dataTransfer.getData('wptbElement') && !e.dataTransfer.getData('node')) {\n return;\n }\n let wptbDropHandle,\n wptbDropBorderMarker;\n if ( document.getElementsByClassName( 'wptb-drop-handle' ).length > 0 ) {\n wptbDropHandle = document.getElementsByClassName( 'wptb-drop-handle' )[0];\n }\n if( document.getElementsByClassName( 'wptb-drop-border-marker' ).length > 0 ) {\n wptbDropBorderMarker = document.getElementsByClassName( 'wptb-drop-border-marker' )[0];\n }\n\n if ( e.dataTransfer.getData( 'wptbElement' ) ) {\n element = WPTB_Helper.newElementProxy( e.dataTransfer.getData( 'wptbElement' ) );\n element = element.getDOMElement();\n } else {\n classId = e.dataTransfer.getData( 'node' );\n element = document.getElementsByClassName( classId )[0];\n //element.classList.remove( 'wptb-moving-mode' );\n }\n \n if( wptbDropHandle.style.display == 'block' ) {\n let td;\n if( wptbDropHandle.dataset.text == 'Drop Here' ) {\n td = wptbDropHandle.getDOMParentElement();\n td.appendChild( element );\n } else {\n let innerElement = wptbDropHandle.getDOMParentElement();\n td = innerElement.parentNode;\n\n if( wptbDropHandle.dataset.text == 'Above Element' ) {\n td.insertBefore( element, innerElement );\n } else if( wptbDropHandle.dataset.text == 'Below Element' ) {\n let innerElementNext = innerElement.nextSibling;\n td.insertBefore( element, innerElementNext );\n }\n }\n let thisRow = td.parentNode\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\n WPTB_Helper.dataTitleColumnSet( table );\n }\n \n } else {\n return;\n }\n \n wptbDropHandle.style.display = 'none';\n wptbDropBorderMarker.style.display = 'none';\n\n WPTB_innerElementSet( element );\n \n 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 listItems,\n copy;\n \n if ( kindIndexProt == undefined || copy == true ) {\n index = document.counter.nextIndex( element.kind );\n let wptbElements = document.getElementsByClassName( 'wptb-ph-element' );\n let elementIndexesArr = [];\n for( let i = 0; i < wptbElements.length; i++ ) {\n var regex = new RegExp( 'wptb-element-' + element.kind + '-(\\\\d+)', \"i\" );\n let infArr = wptbElements[i].className.match( regex );\n if( infArr ) {\n elementIndexesArr.push( infArr[1] );\n }\n }\n if( elementIndexesArr.length > 0 ) {\n let elementIndexMax = Math.max( ...elementIndexesArr );\n index = elementIndexMax + 1;\n } else { \n index = 1;\n }\n } else if ( kindIndexProt && ! copy ) {\n let kindIndexProtArr = kindIndexProt.split('-');\n index = kindIndexProtArr[kindIndexProtArr.length - 1];\n }\n \n node.onmouseenter = function ( event ) {\n if( event.target.classList.contains( 'wptb-moving-mode' ) ) {\n return;\n }\n \n let i, wptbActionsField = new WPTB_ActionsField();\n \n wptbActionsField.addActionField( 1, node );\n \n wptbActionsField.setParameters( node );\n \n node.classList.remove( 'wptb-ondragenter' );\n \n //wptbActionsField.addActionField( 1, node )\n \n if ( element.kind === 'button' ) {\n let a = node.querySelector( 'a' ),\n target = a.querySelector( 'div' );\n a.onclick = function( e ) {\n e.preventDefault();\n }\n WPTB_Helper.buttonsTinyMceInit( target );\n } else if (element.kind === 'text') {\n tinyMCE.init({\n target: node.childNodes[0],\n inline: true,\n plugins: \"link, paste\",\n dialog_type: \"modal\",\n theme: 'modern',\n menubar: false,\n force_br_newlines : false,\n force_p_newlines : false,\n forced_root_block : '',\n fixed_toolbar_container: '#wpcd_fixed_toolbar',\n paste_as_text: true,\n toolbar: 'bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify',\n setup : function( ed ) {\n ed.on( 'change', function(e) {\n let row = WPTB_Helper.findAncestor( node, 'wptb-row' );\n if( row.classList.contains( 'wptb-table-head' ) ) {\n let table = WPTB_Helper.findAncestor( row, 'wptb-preview-table' );\n WPTB_Helper.dataTitleColumnSet( table );\n }\n \n \n });\n \n ed.on( 'keydown', function(e) {\n let wptbActionsField = new WPTB_ActionsField();\n \n wptbActionsField.addActionField( 1, node );\n \n wptbActionsField.setParameters( node );\n });\n ed.on( 'keyup', function(e) {\n let wptbActionsField = new WPTB_ActionsField();\n \n wptbActionsField.addActionField( 1, node );\n \n wptbActionsField.setParameters( node );\n \n e.target.onblur = function() {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n });\n \n },\n init_instance_callback: function (editor) {\n window.currentEditor = editor;\n //editor.fire('focus');\n editor.on('focus', function (e) {\n var totalWidth = document.getElementsByClassName('wptb-builder-panel')[0].offsetWidth;\n if (window.currentEditor &&\n document.getElementById('wptb_builder').scrollTop >= 55 &&\n window.currentEditor.bodyElement.style.display != 'none') {\n document.getElementById('wpcd_fixed_toolbar').style.position = 'fixed';\n document.getElementById('wpcd_fixed_toolbar').style.right = (totalWidth / 2 - document.getElementById('wpcd_fixed_toolbar').offsetWidth / 2) + 'px';\n document.getElementById('wpcd_fixed_toolbar').style.top = '100px';\n } else {\n document.getElementById('wpcd_fixed_toolbar').style.position = 'static';\n delete document.getElementById('wpcd_fixed_toolbar').style.right;\n delete document.getElementById('wpcd_fixed_toolbar').style.top;\n }\n });\n }\n });\n } else if( element.kind === 'list' ) {\n listItems = node.getElementsByClassName( 'wptb-list-item-content' );\n for ( let i = 0; i < listItems.length; i++ ) {\n WPTB_Helper.listItemsTinyMceInit( listItems[i] );\n }\n } \n };\n \n node.onmouseleave = function ( event ) {\n let wptbActionsField = new WPTB_ActionsField();\n \n if( wptbActionsField.wptbActions && wptbActionsField.wptbActions.type != '1' ) {\n return;\n }\n \n wptbActionsField.leaveFromField( event, node, 1 );\n };\n \n let wptbActions = document.getElementsByClassName( 'wptb-actions' );\n if( wptbActions.length > 0 ) {\n wptbActions = wptbActions[0];\n \n }\n \n // Change data-title-column if the title was changed\n if( element.kind == 'text' ) {\n var observer = new MutationObserver( function( mutations ) {\n let row = WPTB_Helper.findAncestor( node, 'wptb-row' );\n if( row.classList.contains( 'wptb-table-head' ) ) {\n let table = WPTB_Helper.findAncestor( row, 'wptb-preview-table' );\n WPTB_Helper.dataTitleColumnSet( table );\n }\n });\n var config = { attributes: true, attributeFilter: ['style'] };\n observer.observe( element.getDOMElement(), config );\n } else if( element.kind == 'star_rating' ) {\n let ratingStars = node.getElementsByClassName( 'wptb-rating-star' );\n for ( let i = 0; i < ratingStars.length; i++ ) {\n let ratingStar = ratingStars[i];\n \n \n WPTB_Helper.starRatingEventHandlersAdd( ratingStar );\n \n let ritingStarZeroSet = ratingStar.querySelector( '.wptb-rating-star-zero-set' );\n if( ritingStarZeroSet ) {\n ritingStarZeroSet.onclick = function( event ) {\n let ulStarList = WPTB_Helper.findAncestor( event.target, 'wptb-rating-stars-list' );\n if( ulStarList ) {\n let children = ulStarList.children;\n for( let i = 0; i < children.length; i++ ) {\n children[i].classList.remove( 'wptb-rating-star-selected-full' );\n children[i].classList.remove( 'wptb-rating-star-selected-half' );\n }\n }\n }\n }\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 new WPTB_ElementOptions( element, index, kindIndexProt );\n\n document.counter.increment(element.kind);\n};",""]}
|
1 |
+
{"version":3,"sources":["WPTB_ActionsField.js","WPTB_Builder.js","WPTB_Button.js","WPTB_Cell.js","WPTB_DropHandle.js","WPTB_ElementCounters.js","WPTB_ElementOptions.js","WPTB_Helper.js","WPTB_Image.js","WPTB_Initializer.js","WPTB_LeftPanel.js","WPTB_List.js","WPTB_ListItem.js","WPTB_MultipleSelect.js","WPTB_Parser.js","WPTB_Parser2.js","WPTB_Settings.js","WPTB_Space.js","WPTB_StarRating.js","WPTB_Stringifier.js","WPTB_Stringifier2.js","WPTB_Table.js","WPTB_TableStateSaveManager.js","WPTB_Text.js","WPTB_innerElementSet.js","applyGenericItemSettings.js","wptb-builder.js"],"names":["WPTB_ActionsField","wptbActions","document","getElementsByClassName","length","addActionField","actionType","thisNode","body","getElementsByTagName","actions","previousNode","activeElem","classList","remove","parentNode","removeChild","btnDelete","btnCopy","btnMove","createElement","add","draggable","appendChild","type","onclick","event","act","target","el","kind","thisRow","contains","table","WPTB_Helper","findAncestor","dataTitleColumnSet","wptbActionsField","actionsRemove","wptbTableStateSaveManager","WPTB_TableStateSaveManager","tableStateSet","copy","infArr","activeElement","activeElementClone","cloneNode","className","match","td","temp","srcList","querySelectorAll","i","push","innerHTML","WPTB_List","insertBefore","getDOMElement","nextSibling","WPTB_Text","childNodes","WPTB_Image","text","querySelector","WPTB_Button","WPTB_StarRating","WPTB_innerElementSet","setParameters","ondragstart","dragImagesArr","dataTransfer","effectAllowed","setDragImage","setData","actionsHide","style","display","previous","append","wptbDirectlyhovered","action","item","parent","listItemsRecalculateIndex","coordinatesElement","getBoundingClientRect","coordinatesElementTopBegin","top","listItem","content","html","duplicate","WPTB_ListItem","listItemsTinyMceInit","firstChild","divcontent","setTimeout","coordinatesElementTopEnd","wptbContainer","correctTop","parseFloat","removeEventListener","left","right","clientWidth","addEventListener","leaveFromField","node","relatedTarget","onmouseleave","localName","opacity","WPTB_Builder","table_id","detectMode","http","XMLHttpRequest","urlSet","ajaxurl","open","setRequestHeader","onreadystatechange","d","readyState","status","ans","JSON","parse","responseText","getElementById","value","wptbTableSetupEl","WPTB_Parser","WPTB_Table","WPTB_LeftPanel","WPTB_Settings","send","counter","ElementCounters","select","MultipleSelect","initializer","WPTB_Initializer","settings","DOMElementProt","DOMElement","elButton","el_B","el_BDiv","el_BDivP","kindIndexProt","undefined","wptbElementMutch","Array","isArray","attributesContainer","attributes","setAttribute","name","wptbButtonWrapper","wptbButtonWrapAttributes","wptbButtonA","wptbButtonAttributes","wptbButton","applyGenericItemSettings","WPTB_Cell","callback","highlightRow","parentRow","columnCount","parseInt","tds","classToAdd","ttd","highlightColumn","index","rowCount","tr","padding","jQuery","val","innerBorderWidth","border","wptbPhElement","wptbSpaceBetween","j","WPTB_Space","wptbElementTypeClass","wptbTypeElementArr","split","wptbListItems","setCoords","y","x","dataset","yIndex","xIndex","getCoords","coords","appendElement","getCellDimensions","tdStyleObj","window","getComputedStyle","tdPaddingLeft","getPropertyValue","tdPaddingRight","tdBorderLeftWidth","tdBorderRightWidth","tdPaddingTop","tdPaddingBottom","tdBorderTopWidth","tdBorderBottomWidth","width","offsetWidth","height","offsetHeight","WPTB_DropHandle","thisElem","e","wptbDropHandle","wptbDropBorderMarker","wptbDropBorderMarkerTop","wptbDropBorderMarkerRight","wptbDropBorderMarkerBottom","wptbDropBorderMarkerLeft","ondragenter","ondragover","preventDefault","ondragleave","ondrop","element","getData","newElementProxy","wptbMovingMode","getDOMParentElement","nodeName","toLowerCase","innerElement","innerElementNext","console","log","onscroll","indics","types","notDragEnter","indexOf","elementDrag","offsetY","layerY","bottom","priv","increment","key","nextIndex","WPTB_ElementOptions","elemIdClass","prop","properties","affectedEl","wptbSize","b","buttonAlignment","justifyContent","buttonAlignmentSelect","selectOption","selectOptionVal","selected","buttonHref","getAttribute","buttonLinkTarget","buttonId","buttonHrefInput","buttonLinkTargetInput","buttonLinkTargetInputId","buttonLinkTargetInputLabel","buttotIdInput","checked","buttonTextColor","color","buttonColor","backgroundColor","buttonTextColorInput","buttonBackgroundColorInput","rgbToHex","elementsA","a","imgAlign","float","imageAlignmentSelect","imageLinkHref","inputImageLink","imageLinkTarget","imageLinkTargetInput","imageLinkTargetInputId","imageLinkTargetInputLabel","imgWidth","imageWidthInputRange","imageWidthInputNumber","img","imgAlternativeText","imageAlternativeTextInput","elementFontSize","fontSize","elementTextColor","textFontSizeInputRange","textFontSizeInputNumber","textColorInput","elementList","elementListColor","listColorInput","elementListItem","listItemP","listItemPClasses","elementListClassSelect","listIconSelectLabel","nodeType","listIconSelectLabelId","elementListStyleTypeSelect","elementListItemContent","listItemPTextAlignArr","p","textAlign","listItemPTextAlignLeftCount","listItemPTextAlignCenterCount","listItemPTextAlignRightCount","elementListAlignmentSelect","maxListItemTAlLeftC","Math","max","ratingStar","ratingStarSize","starSizeInputRange","starSizeInputNumber","starColorInput","ratingStarColor","fill","ratingStars","starsCountInputNumber","ratingAlignment","ratingAlignmentSelect","successBox","showNumberRatingCheckbox","numeralRatingOptionContainers","wptbTextMessage","numberRatingSize","numberRatingColor","numberSizeInputRange","numberSizeInputNumber","numberColorInput","optionsClass","children","buttons","size","n_Class","num","optionControls","wpColorPicker","change","ui","wpColorPickerChange","wpColorPickerCheckChangeForTableStateSaving","clear","numberImputSize","slider","oninput","onchange","src","alt","href","linkHttpCheckChange","rel","removeAttribute","wptbImageFloatValue","jc","id","listItems","parentNodeSettingItem","span","wptbNumeralRatingOptionContainer","starRatingTextMessageChenge","wptbTextMessageSize","lineHeight","starRatings","starRatingsCount","difference","starRatingsLast","newStarRating","starRatingEventHandlersAdd","starRatingLength","onmouseup","hexToRgb","hex","result","exec","rgb","toString","slice","getDragImageCustom","hostName","location","protocol","hostname","image","button","list","star_rating","ulElem","par","listStyleTypeIndex","Number","tinyMCE","init","inline","plugins","dialog_type","theme","menubar","fixed_toolbar_container","paste_as_text","toolbar","setup","ed","on","article","keyCode","innerText","pText","replace","trim","selectedText","getSelectionText","wptbListItem","onblur","init_instance_callback","editor","currentEditor","totalWidth","scrollTop","bodyElement","position","buttonsTinyMceInit","wptbButtonContainer","link","linkArr","linkClean","rows","rowHead","computedStyleRowHead","rowHeadChildren","contentsForHeader","tdElements","textContent","thisRowChildren","wptbTitleColumn","wptbTitleColumnFontSize","wptbTitleColumnColor","wptbTitleBackgroundColor","wptbTitleAlign","cls","parentElement","txt","getSelection","selection","createRange","settingsPanelClear","wpColorPickerClear","elementOptionsPanelClear","elementOptionsGroup","originalEvent","wpPickerContainer","irisSquareHandle","uiSliderHandle","attribute","isId","input","newInput","url","regex","RegExp","results","decodeURIComponent","getColumnWidth","cell","xIndexes","cellWidth","getRowHeight","yIndexes","cellHeight","uiColor","classe","ps","number","starRatingSelectHoverSet","starRating","onStar","onmouseover","stopPropagation","onmouseout","wptbStarRatingContainer","wptbNumberInputs","maxCount","maxValue","onkeydown","thisValue","String","substring","onkeyup","starRatingContainer","ratingNumber","wptbTextMessageCommon","wptbTextMessageCommonVal","elImage","anchor","file_frame","wp","media","frames","title","multiple","attachment","state","get","first","toJSON","imgSrc","MIN_COLUMNS","MIN_ROWS","MAX_COLUMNS","MAX_ROWS","tableGenerator","columnsDecrementButton","columnsIncrementButton","rowsDecrementButton","rowsIncrementButton","columnsInput","rowsInput","columns","wptbElementButtons","wptbTdBgColorSavedSet","inputId","trNumber","tableRows","trBackgroundColor","wptbEvenRowBg","tableHeader","tableAdaptiveForMobile","wptbAdaptiveTableCheckbox","wptbAdaptiveTable","tableTopRowAsHeadSavedSet","wptbTopRowAsHeader","tableBorderColorWidthSavedSet","tableBorderColor","borderColor","tableBorderColorInput","tableBorderWidth","borderWidth","wptbTableBorderWidthSlider","wptbTableBorderWidthNumber","tableTd","applyInnerBorder","innerBorderCheckInput","wptbApplyInnerBorder","wptbTableInnerBorderSlider","wptbTableInnerBorderNumber","tableCells","tableInnerborderNumber","addInnerBorderSize","borderStyle","addCellPadding","addInnerBorder","styles","wptbPreviewTable","marginBottom","addBorderSize","cellPaddingSavedSet","wptbTableCellSlider","wptbTableCellNumber","wptbTableBorderNumber","wptbTextfontSizeNumber","wptbImageWidthNumber","wptbTableColumnWidthNumber","wptbTableRowHeightNumber","tdDefaultWidth","wptbInnerBorderCheck","tableBorderColorSetArea","addColumnWidth","highlighted","addRowHeight","createMobileHeadForTable","thisEvent","wptbElement","toggleTableEditMode","addRowToTheEnd","addRowToTheStart","addRowBefore","addRowAfter","addColumnEnd","addColumnStart","addColumnBefore","addColumnAfter","deleteColumn","deleteRow","mergeCells","splitCell","wptbBuilderPanel","clickOnFreeSpace","wptbHeader","wpcdFixedToolbar","hasAttribute","innerElements","el_L","wptbListItemReturn","styleDot","listItemKeyListener","onmouseenter","selectedCells","multipleCellMode","activateMultipleSelectMode","deactivateMultipleSelectMode","isActivated","pushSelectedCell","flushSelectedCells","getFirst","minXIndex","minYIndex","getLast","maxXIndex","maxYIndex","last","removeAllButFirst","code","div","columnTitleMobile","WPTB_Parser2","elementHtml","createTextNode","tagName","elems","ondragend","wptbUndo","tableStateGet","wptbUndoredo","wptbUndoRedoContainer","wptbRedo","shortcodePopupWindow","onbeforeunload","wptbSaveDisabled","wptbTableStateNumberSave","wptbTableStateNumberShow","bar","wptb_admin_object","t","messagingArea","WPTB_Stringifier","outerHTML","messagingAreaText","params","security_code","rs","wptbId","stringify","data","wptbPreviewBtn","wptbPreviewBtnHref","previewHref","wptbSaveBtn","elSpaceBetween","includes","spaceBetween","t_space","spaceParent","alert","countStarts","ratingStarsBox","ratingStarsList","textMessage","filledRatingStarHtml","notFilledRatingStarHtml","halfFilledRatingStarHtml","ratingStarZeroSet","wptbRatingStarsBox","wptbRatingStarsBoxAttributes","wptbRatingStarsOld","wptbRatingStars","iMax","wptbRatingStarsAttributes","wptbRatingStarsOldSpan","wptbRatingStarsSpan","k","wptbRatingStarsOldSpanAttributes","l","wptbRatingStarsOldSvg","wptbRatingStarsOldSvgStyle","wptbSuccessBox","wptbSuccessBoxAttributes","wptbTextMessageAttributes","codeMain","tableColumns","minWidth","maxWidth","mceContentBodys","dataMceStyle","contentEditable","spellCheck","mceIds","wptbActionsLength","columnNameDivContainer","columnNameDiv","WPTB_Stringifier2","start","nodeValue","int_elem_arr","attributes_list","internal_elements","inter_elem","array","wptbTableSetup","row","maxAmountOfCells","maxAmountOfRows","mark","rowSpan","cs","colSpan","markedCells","noCells","singleCells","multipleCells","cellSettings","column","cellHighlighted","wptbTableColumnWidthSlider","tableColumnWidthAutoFixedCheckbox","wptbFixedWidth","wptbTableRowHeightSlider","tableRowHeightAutoFixedCheckbox","wptbFixedHeight","isSquare","realTimeArray","carried","cols","matriz","items","justAssigned","amount","carriedRowspans","cellsBuffer","cellPointer","xPosition","stepsToMove","celda","drawTable","string","undoSelect","fillTableArray","colspansSums","cells","colspanSumInRow","apply","getActualPointsInRow","points","search","skipInCols","reconstraction","insertRow","wptb_preview_table","cellModeBackground","leftScrollPanelCurtain","leftScrollPanelCellSettings","wptbPreviewTableTds","recalculateIndexes","trs","maxCols","maxColsFull","tdsArr","jMainIter","z","cleaner","dataXIndex","tableTdsFor","colspan","widthIsSet","arrayTdsFromPreviousRow","tableTdsSumMaxWidth","tableTdsSumMaxWidthFixed","tableTdsSumMaxWidthAuto","wptbTableSetupWidth","arrayCellsWidthFixedHelper","arrayCellsWidthAutoHelper","tdPaddingCommon","tableTdBorderCommonWidth","cssForTdsWidthAuto","wptbCssTdAutoWidth","tableTdBorderLeftWidth","tableTdBorderRightWidth","CellsWidthAutoCount","tableFullStyleObj","borderLeftWidth","borderRightWidth","tableBorderCommon","wptbTableTdsSumMaxWidth","wptbCellsWidthAutoCount","mergingСellsHorizontally","wptbFixedWidthSize","styleElementCreate","tableTdWidthAuto","tableTdsWidthAutoCommon","head","cssForTdsWidthAutoOld","dataYIndex","rowspan","heightIsSet","arrayTdsPrevious","tableColumnHeightAutoFixedCheckbox","wptbAdaptiveTableChoseBlock","mergingCellsVertically","forBreak","currentTable","currentTableTd","currentTdStyle","firstCell","c_pos","cellStyle","pos","pendingInsertion","bro","currentCell","r","aux","from","cellNew","rowChildren","rowChildrenLength","cellRowSpan","rowAfter","cellsColSpan","tableRowsIChildren","tableRIChildrenLength","rowIRowSpan","rNext","rNextChildren","rNextChildrenLength","rowStart","columnStart","rowEnd","columnEnd","itemsEstimate","dimensions","call","tdsChildrenNew","tdsInternalElements","tdsIntElemLength","firstWidth","firstDataFixedWidth","firstHeight","firstDataFixedHeight","cellStyles","cellXIndex","rowChildInsertBefore","rowNext","findRowspannedCells","actualPoints","addLackingCells","sumRows","totalColspan","nextRow","nextRowChildren","nextRowChildrenLength","tdArr","nextRowChildrenK","jRowChildren","pop","onresize","wptbTableStateSaving","wptbNewPreviewTable","wptbHighlighted","cssForTdsWidthAutoValue","datawptbUndoredo","wptbLeftScrollPanelCellSetting","elText2","elP","classId","wptbElements","elementIndexesArr","elementIndexMax","kindIndexProtArr","force_br_newlines","force_p_newlines","forced_root_block","observer","MutationObserver","mutations","config","attributeFilter","observe","ritingStarZeroSet","ulStarList","node_wptb_element_kind_num"],"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,YAAIC,UAAUR,SAASC,sBAAT,CAAiC,cAAjC,CAAd;AACA,YAAIO,QAAQN,MAAR,IAAkB,CAAtB,EAA0B;AACtB,gBAAIO,eAAeD,QAAQ,CAAR,EAAWE,UAA9B;AACA,gBAAID,YAAJ,EAAmB;AACfA,6BAAaE,SAAb,CAAuBC,MAAvB,CAA+B,sBAA/B;AACH;;AAED,mBAAOJ,QAAQN,MAAR,IAAkB,CAAzB,EAA6B;AACzBM,wBAAQ,CAAR,EAAWK,UAAX,CAAsBC,WAAtB,CAAmCN,QAAQ,CAAR,CAAnC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Af,CAAuBq3B,2BAA2B,CAA3B,CAAvB;AACH;AACD,QAAK,CAAEvxB,KAAK/F,SAAL,CAAemB,QAAf,CAAyB,iBAAzB,CAAP,EAAsD;AAClD4E,aAAK/F,SAAL,CAAeQ,GAAf,CAAoB,iBAApB;AACA,YAAI,CAAEuF,KAAK/F,SAAL,CAAemB,QAAf,CAAyB,kBAAkBwM,QAAQ1M,IAA1B,GAAiC,GAAjC,GAAuCkJ,KAAhE,CAAN,EAAgF;AAC5EpE,iBAAK/F,SAAL,CAAeQ,GAAf,CAAoB,kBAAkBmN,QAAQ1M,IAA1B,GAAiC,GAAjC,GAAuCkJ,KAA3D;AACH;AACJ,KALD,MAKO;AACH,YAAI,CAAEpE,KAAK/F,SAAL,CAAemB,QAAf,CAAyB,kBAAkBwM,QAAQ1M,IAA1B,GAAiC,GAAjC,GAAuCkJ,KAAhE,CAAN,EAAgF;AAC5EpE,iBAAK/F,SAAL,CAAeQ,GAAf,CAAoB,kBAAkBmN,QAAQ1M,IAA1B,GAAiC,GAAjC,GAAuCkJ,KAA3D;AACH;AACJ;AACD,QAAIgF,mBAAJ,CAAyBxB,OAAzB,EAAkCxD,KAAlC,EAAyCzB,aAAzC;;AAEArJ,aAASwI,OAAT,CAAiBmH,SAAjB,CAA2BrB,QAAQ1M,IAAnC;AACH,CA/LD;ACAA","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, btnMove;\n\n btnDelete = document.createElement( 'span' ),\n btnCopy = document.createElement( 'span' ),\n btnMove = 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 btnMove.classList.add( \"dashicons\", \"dashicons-move\", 'wptb-move-action' );\n btnMove.draggable = true;\n\n actions.appendChild( btnMove );\n actions.appendChild( btnCopy );\n actions.appendChild( btnDelete );\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 el.removeChild(act);\n\n if( act.kind == 'text' ) {\n let thisRow = el.parentNode\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\n WPTB_Helper.dataTitleColumnSet( table );\n }\n }\n\n let wptbActionsField = new WPTB_ActionsField();\n\n wptbActionsField.actionsRemove();\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n\n\n btnCopy.onclick = ( event ) => {\n let copy,\n infArr,\n type;\n let activeElement = event.target.parentNode.activeElem;\n let activeElementClone = activeElement.cloneNode( true );\n activeElementClone.classList.remove( 'wptb-directlyhovered' );\n infArr = activeElement.className.match(/wptb-element-(.+)-(\\d+)/i);\n type = infArr[1];\n let td = activeElement.parentNode;\n if ( type == 'list' ) {\n var temp = [],\n srcList = activeElement.querySelectorAll('ul li .wptb-list-item-content');\n\n for (var i = 0; i < srcList.length; i++) {\n temp.push(srcList[i].innerHTML);\n }\n\n copy = new WPTB_List( temp, activeElementClone );\n\n td.insertBefore( copy.getDOMElement(), activeElement.nextSibling );\n } else if ( type == 'text' ) {\n copy = new WPTB_Text( activeElementClone.childNodes[0].innerHTML, activeElementClone );\n\n td.insertBefore( copy.getDOMElement(), activeElement.nextSibling );\n } else if ( type == 'image' ) {\n copy = new WPTB_Image( '', activeElement );\n \n td.insertBefore( copy.getDOMElement(), activeElement.nextSibling );\n } else if( type == 'button' ) {\n let text = activeElementClone.childNodes[0].querySelector( 'p' ).innerHTML;\n \n copy = new WPTB_Button( text, activeElementClone );\n\n td.insertBefore( copy.getDOMElement(), activeElement.nextSibling );\n } else if( type = 'star_rating' ) {\n copy = new WPTB_StarRating( activeElementClone );\n\n td.insertBefore( copy.getDOMElement(), activeElement.nextSibling );\n }\n\n WPTB_innerElementSet( copy.getDOMElement() );\n\n let wptbActionsField = new WPTB_ActionsField( 1, activeElement );\n \n wptbActionsField.setParameters( activeElement );\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n btnMove.ondragstart = ( event ) => {\n let dragImagesArr = WPTB_Helper.dragImagesArr(),\n actions = event.target.parentNode,\n activeElem = actions.activeElem,\n infArr,\n type;\n infArr = activeElem.className.match(/wptb-element-(.+)-(\\d+)/i);\n type = infArr[1];\n activeElem.classList.add( 'wptb-moving-mode' );\n\n event.dataTransfer.effectAllowed = 'move';\n event.dataTransfer.setDragImage( dragImagesArr[type], 0, 0 );\n event.dataTransfer.setData( 'node', 'wptb-element-' + infArr[1] + '-' + infArr[2] );\n event.dataTransfer.setData( 'wptb-moving-mode', 'wptb-element-' + infArr[1] + '-' + infArr[2] );\n event.dataTransfer.setData( 'wptbElIndic-' + infArr[1], 'wptbElIndic-' + infArr[1] );\n let act = event.target.parentNode.activeElem;\n if( act.kind == 'text' ) {\n let thisRow = act.parentNode.parentNode;\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\n WPTB_Helper.dataTitleColumnSet( table );\n }\n }\n //actions.style.display = 'none';\n this.actionsHide();\n };\n\n //actions.style.right = '-' + parseFloat( thisNode.offsetWidth ) + 'px';\n actions.style.display = 'block';\n\n this.wptbActions = actions;\n } else if( actionType == 2 ) {\n let btnDelete,\n btnCopy,\n previous,\n i;\n\n btnDelete = document.createElement('span'),\n btnCopy = document.createElement('span'),\n actions = document.createElement('span')\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.append( btnCopy, btnDelete );\n body.appendChild( actions );\n\n actions.activeElem = thisNode;\n \n let wptbDirectlyhovered = WPTB_Helper.findAncestor( thisNode, 'wptb-directlyhovered' );\n if( wptbDirectlyhovered ) {\n wptbDirectlyhovered.classList.remove( 'wptb-directlyhovered' );\n }\n\n actions.type = 2;\n\n btnDelete.onclick = ( event ) => {\n var action = event.target.parentNode, \n item = action.activeElem,\n parent = item.parentNode;\n let wptbActionsField = new WPTB_ActionsField( 4 );\n wptbActionsField.actionsRemove();\n parent.removeChild( item );\n WPTB_Helper.listItemsRecalculateIndex( parent );\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n btnCopy.onclick = ( event ) => {\n let coordinatesElement = thisNode.getBoundingClientRect();\n let coordinatesElementTopBegin = coordinatesElement.top;\n\n var listItem = event.target.parentNode.activeElem,\n content = listItem.querySelector( '.wptb-list-item-content' ),\n html = content.innerHTML;\n var duplicate = new WPTB_ListItem( html, listItem, true );\n listItem.parentNode.insertBefore( duplicate.getDOMElement(), thisNode.nextSibling );\n WPTB_Helper.listItemsTinyMceInit( duplicate.getDOMElement().firstChild );\n\n let divcontent = thisNode.getElementsByClassName( 'wptb-list-item-content' );\n if( divcontent.length > 0 ) {\n divcontent = divcontent[0];\n }\n setTimeout( function(){\n divcontent.innerHTML = html;\n WPTB_Helper.listItemsRecalculateIndex( listItem.parentNode );\n }, 5 );\n\n coordinatesElement = thisNode.getBoundingClientRect();\n let coordinatesElementTopEnd = coordinatesElement.top;\n\n if( coordinatesElementTopBegin != coordinatesElementTopEnd ) {\n let wptbActionsField = new WPTB_ActionsField( 2, thisNode );\n wptbActionsField.setParameters( thisNode );\n }\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n actions.style.display = 'block';\n\n this.wptbActions = actions;\n }\n }\n \n this.setParameters = ( thisNode ) => {\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.display = 'block';\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// let wptbBorderMarkerTop = this.wptbBorderMarker.querySelector( '.wptb-border-marker-top' );\n// wptbBorderMarkerTop.style.width = ( parseFloat( thisNode.offsetWidth ) + 3 ) + 'px';\n//\n// let wptbBorderMarkerRight = this.wptbBorderMarker.querySelector( '.wptb-border-marker-right' );\n// wptbBorderMarkerRight.style.height = ( parseFloat( coordinatesElement.bottom ) - parseFloat( coordinatesElement.top ) + 4 ) + 'px';\n// wptbBorderMarkerRight.style.left = ( parseFloat( thisNode.offsetWidth ) + 3 ) + 'px';\n//\n// let wptbBorderMarkerBottom = this.wptbBorderMarker.querySelector( '.wptb-border-marker-bottom' );\n// wptbBorderMarkerBottom.style.width = wptbBorderMarkerTop.style.width;\n// wptbBorderMarkerBottom.style.top = ( parseFloat( coordinatesElement.bottom ) - parseFloat( coordinatesElement.top ) + 3 ) + 'px';;\n//\n// let wptbBorderMarkerLeft = this.wptbBorderMarker.querySelector( '.wptb-border-marker-left' );\n// \n \n //this.wptbBorderMarker.style.display = 'block';\n this.wptbActions.style.display = 'block';\n thisNode.classList.add( 'wptb-directlyhovered' );\n \n wptbContainer.addEventListener( 'scroll', correctTop, false );\n }\n \n// if( actionType == 1 || actionType == 2 ) {\n// this.setParameters( thisNode );\n// }\n// } else {\n// this.wptbActions.style.display = 'block';\n// thisNode.classList.add( 'wptb-directlyhovered' );\n// }\n \n this.leaveFromField = ( event, node, actionType ) => {\n if( event.relatedTarget ) {\n if ( event.relatedTarget.classList.contains( 'wptb-actions' ) ||\n event.relatedTarget.classList.contains( 'wptb-move-action' ) ||\n event.relatedTarget.classList.contains( 'wptb-duplicate-action' ) ||\n event.relatedTarget.classList.contains( 'wptb-delete-action' ) ) {\n if( ! this.wptbActions ) {\n this.wptbActions = document.getElementsByClassName( 'wptb-actions' )[0];\n }\n this.wptbActions.onmouseleave = ( event ) => {\n if( event.relatedTarget != null && event.relatedTarget != this.wptbActions.activeElem &&\n WPTB_Helper.findAncestor( event.relatedTarget, 'wptb-directlyhovered') != this.wptbActions.activeElem ) {\n event.target.activeElem.classList.remove( 'wptb-directlyhovered' );\n this.wptbActions.style.display = 'none';\n\n if( this.wptbActions.type == 2 ) {\n let wptbActionsField = new WPTB_ActionsField();\n\n wptbActionsField.addActionField( 1, event.relatedTarget.parentNode.parentNode );\n\n wptbActionsField.setParameters( event.relatedTarget.parentNode.parentNode );\n }\n } else {\n return;\n }\n }\n\n return;\n } \n// else if( event.relatedTarget.classList.contains( 'wptb-drop-handle' ) ) {\n// let wptbDropHandle = document.getElementsByClassName( 'wptb-drop-handle' );\n// if( wptbDropHandle.length > 0 ) {\n// wptbDropHandle = wptbDropHandle[0];\n// wptbDropHandle.onmouseleave\n// }\n// }\n }\n \n node.classList.remove( 'wptb-directlyhovered' );\n this.wptbActions.style.display = 'none';\n \n if( this.wptbActions.type == 2 ) {\n if( event.relatedTarget ) {\n if( event.relatedTarget.localName == 'ul' ) {\n //let wptbActionsField = new WPTB_ActionsField();\n\n this.addActionField( 1, event.relatedTarget.parentNode );\n\n this.setParameters( event.relatedTarget.parentNode );\n }\n }\n \n }\n }\n \n this.actionsRemove = () => {\n if( ! this.wptbActions ) {\n let actions = document.getElementsByClassName( 'wptb-actions' );\n if( actions.length > 0 ) {\n this.wptbActions = actions[0];\n }\n }\n \n if( this.wptbActions ) {\n this.wptbActions.parentNode.removeChild( this.wptbActions );\n }\n }\n \n this.actionsHide = () => {\n if( ! this.wptbActions ) {\n let actions = document.getElementsByClassName( 'wptb-actions' );\n if( actions.length > 0 ) {\n this.wptbActions = actions[0];\n }\n }\n \n if( this.wptbActions ) {\n this.wptbActions.style.opacity = 0;\n }\n }\n}","(function () {\n var WPTB_Builder = function () {\n var table_id = WPTB_Helper.detectMode();\n if ( table_id ) {\n var http = new XMLHttpRequest(),\n urlSet = ajaxurl + \"?action=get_table\" + '&id=' + table_id;\n http.open('GET', urlSet, true);\n http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');\n http.onreadystatechange = function (d) {\n if (this.readyState == 4 && this.status == 200) {\n var ans = JSON.parse(http.responseText);\n document.getElementById('wptb-setup-name').value = ans[0];\n \n if( ans[1] ) {\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'none';\n let wptbTableSetupEl = document.getElementsByClassName('wptb-table-setup')[0];\n wptbTableSetupEl.appendChild( WPTB_Parser( ans[1] ) );\n WPTB_Table();\n WPTB_LeftPanel();\n WPTB_Settings();\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n } else {\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\n }\n \n return;\n }\n };\n http.send(null);\n } else {\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\n }\n document.counter = new ElementCounters();\n document.select = new MultipleSelect();\n\n var initializer = WPTB_Initializer();\n settings = WPTB_Settings();\n };\n\n document.addEventListener('DOMContentLoaded', WPTB_Builder);\n})();","var WPTB_Button = function( text, DOMElementProt ) {\n \n var DOMElement = document.createElement('div'),\n elButton = document.createElement('div'),\n el_B = document.createElement('a'),\n el_BDiv = document.createElement( 'div' ),\n el_BDivP = document.createElement( 'p' ),\n kindIndexProt = undefined,\n copy = false;\n\n DOMElement.classList.add('wptb-button-container', 'wptb-size-M', 'wptb-');\n elButton.classList.add('wptb-button-wrapper');\n el_BDiv.classList.add('wptb-button');\n el_BDivP.innerHTML = text != undefined ? text : 'Button Text';\n \n // Creation of a new button when copying to avoid errors when assigning new event handlers.\n if ( DOMElementProt ) {\n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\n kindIndexProt = wptbElementMutch[1];\n copy = true;\n }; \n var attributesContainer = [...DOMElementProt.attributes];\n if ( attributesContainer.length > 0 ) {\n for( let i = 0; i < attributesContainer.length; i++ ) {\n DOMElement.setAttribute(attributesContainer[i].name, attributesContainer[i].value);\n } \n }\n \n var wptbButtonWrapper = DOMElementProt.querySelector( '.wptb-button-wrapper' );\n if ( wptbButtonWrapper ) {\n var wptbButtonWrapAttributes = [...wptbButtonWrapper.attributes];\n if ( wptbButtonWrapAttributes.length > 0 ) {\n for( let i = 0; i < wptbButtonWrapAttributes.length; i++ ) {\n if ( wptbButtonWrapAttributes[i].name == 'style') {\n elButton.setAttribute( wptbButtonWrapAttributes[i].name, wptbButtonWrapAttributes[i].value );\n }\n } \n }\n }\n \n var wptbButtonA = DOMElementProt.querySelector( 'a' );\n if ( wptbButtonA ) {\n var wptbButtonAttributes = [...wptbButtonA.attributes];\n if ( wptbButtonAttributes.length > 0 ) {\n for( let i = 0; i < wptbButtonAttributes.length; i++ ) {\n if ( wptbButtonAttributes[i].name == 'style' || \n wptbButtonAttributes[i].name == 'href' || \n wptbButtonAttributes[i].name == 'target' ) {\n el_B.setAttribute( wptbButtonAttributes[i].name, wptbButtonAttributes[i].value );\n }\n } \n }\n }\n \n var wptbButton = DOMElementProt.querySelector( '.wptb-button' );\n if ( wptbButton ) {\n var wptbButtonAttributes = [...wptbButton.attributes];\n if ( wptbButtonAttributes.length > 0 ) {\n for( let i = 0; i < wptbButtonAttributes.length; i++ ) {\n if ( wptbButtonAttributes[i].name == 'style') {\n el_BDiv.setAttribute( wptbButtonAttributes[i].name, wptbButtonAttributes[i].value );\n }\n } \n }\n }\n }\n \n elButton.appendChild(el_B);\n el_B.appendChild( el_BDiv );\n el_BDiv.appendChild( el_BDivP );\n DOMElement.appendChild(elButton);\n \n \n \n this.kind = 'button';\n\n this.getDOMElement = function () {\n return DOMElement;\n };\n\n applyGenericItemSettings( this, kindIndexProt, copy );\n \n return this;\n};","var WPTB_Cell = function (callback, DOMElement) {\n\n function highlightRow(td) {\n var parentRow = td.parentNode,\n columnCount = parseInt(document.getElementById('wptb-columns-number').value),\n tds = document.getElementsByClassName('wptb-preview-table')[0].getElementsByTagName('td');\n for (var i = 0; i < tds.length; i++) {\n tds[i].classList.remove('wptb-highlighted-row-first', 'wptb-highlighted-row-last', 'wptb-highlighted-row-inner', 'wptb-highlighted-column-first', 'wptb-highlighted-column-last', 'wptb-highlighted-column-inner');\n }\n for (var i = 0; i < columnCount; i++) {\n\n var classToAdd = i == 0 ? 'wptb-highlighted-row-first' : i == columnCount - 1 ? 'wptb-highlighted-row-last' : 'wptb-highlighted-row-inner';\n var ttd = parentRow.getElementsByTagName('td')[i];\n if (ttd !== td) {\n ttd.classList.add(classToAdd);\n }\n }\n }\n\n function highlightColumn(td) {\n\n var index,\n parentRow = td.parentNode;\n columnCount = parseInt(document.getElementById('wptb-columns-number').value), rowCount = parseInt(document.getElementById('wptb-rows-number').value), table = document.getElementsByClassName('wptb-preview-table')[0];\n for (var i = 0; i < columnCount; i++) {\n if (parentRow.getElementsByTagName('td')[i] === td) {\n index = i;\n break;\n }\n }\n\n for (var i = 0; i < rowCount; i++) {\n var classToAdd = i == 0 ? 'wptb-highlighted-column-first' : i == rowCount - 1 ? 'wptb-highlighted-column-last' : 'wptb-highlighted-column-inner';\n var tr = table.getElementsByTagName('tr')[i];\n if (tr.getElementsByTagName('td')[index] !== td) {\n tr.getElementsByTagName('td')[index].classList.add(classToAdd);\n }\n }\n }\n \n if( ! DOMElement ) {\n DOMElement = document.createElement(\"td\");\n\n DOMElement.style.padding = jQuery('#wptb-table-padding-number').val() + 'px';\n\n var innerBorderWidth = jQuery('#wptb-table-inner-border-number').val();\n\n if (innerBorderWidth != '' && parseInt(innerBorderWidth) != 0) {\n DOMElement.style.border = innerBorderWidth + 'px solid ' + jQuery('#wptb-table-border-color').val();\n } \n\n DOMElement.classList.add('wptb-droppable', 'wptb-cell');\n }\n\n DOMElement.draggable = false;\n if ( callback ) {\n DOMElement.onclick = callback;\n }\n \n WPTB_innerElementSet( DOMElement );\n \n let wptbPhElement = DOMElement.getElementsByClassName( 'wptb-ph-element' );\n \n if ( wptbPhElement.length > 0 ) {\n for( let i = 0; i < wptbPhElement.length; i++ ) {\n\n let wptbSpaceBetween = DOMElement.getElementsByClassName( 'wptb-space-between' );\n\n if ( wptbSpaceBetween.length > 0 ) {\n for( let j = 0; j < wptbSpaceBetween.length; j++ ) {\n WPTB_Space( wptbSpaceBetween[j] );\n }\n }\n \n wptbPhElement[i].getDOMElement = function() {\n return wptbPhElement[i];\n }\n \n WPTB_innerElementSet( wptbPhElement[i] );\n \n let wptbElementTypeClass = wptbPhElement[i].className.match( /wptb-element-((.+-)\\d+)/i );\n if( wptbElementTypeClass && Array.isArray( wptbElementTypeClass ) ) {\n let wptbTypeElementArr = wptbElementTypeClass[1].split( '-' );\n wptbPhElement[i].kind = wptbTypeElementArr[0];\n applyGenericItemSettings( wptbPhElement[i], wptbElementTypeClass[1] );\n if ( wptbPhElement[i].kind == 'list' ) {\n let wptbListItems = wptbPhElement[i].getElementsByTagName( 'li' );\n if( wptbListItems.length > 0 ) {\n for ( let i = 0; i < wptbListItems.length; i++ ) {\n WPTB_ListItem( undefined, wptbListItems[i] );\n }\n }\n }\n }\n }\n }\n\n this.getDOMElement = function () {\n return DOMElement;\n };\n\n this.setCoords = function (y, x) {\n var el = this.getDOMElement();\n el.dataset.yIndex = y;\n el.dataset.xIndex = x;\n };\n\n this.getCoords = function () {\n var coords,\n el = this.getDOMElement();\n coords.x = el.dataset.xIndex;\n coords.y = el.dataset.yIndex;\n return coords;\n };\n\n this.appendElement = function (node) {\n getDOMElement().appendChild(node);\n };\n \n DOMElement.getCellDimensions = function() {\n let tdStyleObj = window.getComputedStyle( this, null );\n \n let tdPaddingLeft = tdStyleObj.getPropertyValue( 'padding-left' );\n let tdPaddingRight = tdStyleObj.getPropertyValue( 'padding-right' );\n \n let tdBorderLeftWidth = tdStyleObj.getPropertyValue( 'border-left-width' );\n let tdBorderRightWidth = tdStyleObj.getPropertyValue( 'border-right-width' );\n \n let tdPaddingTop = tdStyleObj.getPropertyValue( 'padding-top' );\n let tdPaddingBottom = tdStyleObj.getPropertyValue( 'padding-bottom' );\n \n let tdBorderTopWidth = tdStyleObj.getPropertyValue( 'border-top-width' );\n let tdBorderBottomWidth = tdStyleObj.getPropertyValue( 'border-bottom-width' );\n \n let width = parseFloat( this.offsetWidth, 10 ) - \n parseFloat( tdPaddingLeft, 10 ) - \n parseFloat( tdPaddingRight, 10 ) -\n parseFloat( tdBorderLeftWidth, 10 ) -\n parseFloat( tdBorderRightWidth, 10 );\n \n let height = parseFloat( this.offsetHeight, 10 ) - \n parseFloat( tdPaddingTop, 10 ) - \n parseFloat( tdPaddingBottom, 10 ) -\n parseFloat( tdBorderTopWidth, 10 ) -\n parseFloat( tdBorderBottomWidth, 10 );\n \n return {\n width: width, \n height: height\n };\n }\n\n return this;\n};","var WPTB_DropHandle = function (thisElem, e) {\n \n let wptbDropHandle,\n wptbDropBorderMarker;\n if ( document.getElementsByClassName( 'wptb-drop-handle' ).length == 0 ) {\n wptbDropHandle = document.createElement( 'div' );\n wptbDropHandle.classList.add( 'wptb-drop-handle' );\n \n wptbDropBorderMarker = document.createElement( 'div' );\n wptbDropBorderMarker.classList.add( 'wptb-drop-border-marker' );\n \n let wptbDropBorderMarkerTop = document.createElement( 'div' ),\n wptbDropBorderMarkerRight = document.createElement( 'div' ),\n wptbDropBorderMarkerBottom = document.createElement( 'div' ),\n wptbDropBorderMarkerLeft = document.createElement( 'div' );\n \n wptbDropBorderMarkerTop.classList.add( 'wptb-drop-border-marker-top' );\n wptbDropBorderMarkerRight.classList.add( 'wptb-drop-border-marker-right' );\n wptbDropBorderMarkerBottom.classList.add( 'wptb-drop-border-marker-bottom' );\n wptbDropBorderMarkerLeft.classList.add( 'wptb-drop-border-marker-left' );\n \n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerTop );\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerRight );\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerBottom );\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerLeft );\n \n let body = document.getElementsByTagName( 'body' );\n if ( body.length > 0 ) {\n body[0].appendChild( wptbDropHandle );\n body[0].appendChild( wptbDropBorderMarker );\n }\n \n wptbDropHandle.ondragenter = function () {\n\n }\n\n wptbDropHandle.ondragover = function (e) {\n e.preventDefault();\n }\n\n wptbDropHandle.ondragleave = function () {\n\n }\n wptbDropHandle.ondrop = function (e) {\n e.preventDefault();\n let element;\n \n if ( e.dataTransfer.getData('wptbElement') ) {\n element = WPTB_Helper.newElementProxy( e.dataTransfer.getData('wptbElement') );\n element = element.getDOMElement();\n } else {\n element = document.getElementsByClassName( e.dataTransfer.getData('node') )[0];\n element.classList.remove( 'wptb-moving-mode' );\n element.classList.remove( 'wptb-moving-into-same-elem' );\n element.wptbMovingMode = 1;\n }\n \n let td;\n if( wptbDropHandle.dataset.text == 'Drop Here' ) {\n thisElem = wptbDropHandle.getDOMParentElement();\n if ( thisElem.nodeName.toLowerCase() == 'td' ) {\n td = wptbDropHandle.getDOMParentElement();\n td.appendChild( element );\n }\n } else {\n let innerElement = wptbDropHandle.getDOMParentElement();\n td = innerElement.parentNode;\n \n if( wptbDropHandle.dataset.text == 'Above Element' ) {\n td.insertBefore( element, innerElement );\n } else if( wptbDropHandle.dataset.text == 'Below Element' ) {\n let innerElementNext = innerElement.nextSibling;\n td.insertBefore( element, innerElementNext );\n }\n }\n \n let thisRow = td.parentNode\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\n WPTB_Helper.dataTitleColumnSet( table );\n }\n \n wptbDropHandle.style.display = 'none';\n wptbDropBorderMarker.style.display = 'none';\n \n WPTB_innerElementSet(element);\n console.log(element);\n if( ! element.classList.contains( 'wptb-image-container' ) || element.wptbMovingMode == 1 ) {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n element.wptbMovingMode == undefined;\n }\n }\n let wptbContainer = document.querySelector( '.wptb-container' );\n wptbContainer.onscroll = function() {\n wptbDropHandle.style.display = 'none';\n wptbDropBorderMarker.style.display = 'none';\n }\n } else {\n wptbDropHandle = document.getElementsByClassName( 'wptb-drop-handle' )[0];\n wptbDropBorderMarker = document.getElementsByClassName( 'wptb-drop-border-marker' )[0];\n }\n if( thisElem && thisElem.nodeName.toLowerCase() == 'td' && \n thisElem.getElementsByClassName( 'wptb-ph-element' ).length != 0 ) {\n return;\n }\n \n let thisRow;\n if ( thisElem.localName == 'td' ) {\n thisRow = thisElem.parentNode;\n } else if ( thisElem.localName == 'div' && thisElem.classList.contains( 'wptb-ph-element' ) ) {\n thisRow = thisElem.parentNode.parentNode;\n }\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\n let indics = e.dataTransfer.types;\n let notDragEnter = false;\n for ( let i = 0; i < indics.length; i++ ) {\n let infArr = indics[i].match( /wptbelindic-([a-z]+)/i );\n if ( infArr && infArr[1] != 'text' ) {\n notDragEnter = true;\n break;\n }\n }\n if( notDragEnter ) {\n return;\n }\n }\n \n wptbDropHandle.style.width = thisElem.offsetWidth + 'px';\n let height = thisElem.offsetHeight,\n coordinatesElement = thisElem.getBoundingClientRect(),\n left = 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_ElementOptions = function ( element, index, kindIndexProt ) {\n\n var node = element.getDOMElement(), elemIdClass;\n\n prop = document.querySelector(\".wptb-\" + element.kind + \"-options-prototype\").cloneNode(true);\n prop.classList.remove(\"wptb-\" + element.kind + \"-options-prototype\"); // remove prototype from the class\n elemIdClass = 'wptb-options-' + element.kind + \"-\" + index;\n\n var properties = prop.getElementsByClassName('wptb-element-property');\n\n for (var i = 0; i < properties.length; i++) {\n properties[i].dataset.element = elemIdClass;\n }\n\n prop.classList.add(elemIdClass);\n document.getElementById(\"element-options-group\").appendChild(prop);\n \n if ( kindIndexProt ) {\n if ( element.kind == 'button' ) {\n let affectedEl = document.getElementsByClassName( 'wptb-element-' + kindIndexProt )[0],\n wptbButtonWrapper,\n wptbButtonA,\n wptbButton,\n wptbSize;\n \n if ( affectedEl ) {\n wptbSize = affectedEl.className.match(/wptb-size-([a-z]+)/i);\n }\n \n if( wptbSize && Array.isArray( wptbSize ) ) {\n var b = prop.getElementsByClassName('wptb-btn-size-btn');\n \n for ( var i = 0; i < b.length; i++ ) {\n b[i].classList.remove( 'selected' );\n \n if ( b[i].innerHTML == wptbSize[1] ) {\n b[i].classList.add( 'selected' );\n }\n }\n }\n \n if( affectedEl ) {\n wptbButtonWrapper = affectedEl.getElementsByClassName( 'wptb-button-wrapper' );\n \n wptbButtonA = affectedEl.getElementsByTagName( 'a' );\n \n wptbButton = affectedEl.getElementsByClassName( 'wptb-button' );\n }\n \n if ( wptbButtonWrapper ) {\n let buttonAlignment = wptbButtonWrapper[0].style.justifyContent,\n buttonAlignmentSelect = prop.querySelector( 'select[data-type=\"button-alignment\"]' ),\n selectOption = buttonAlignmentSelect.getElementsByTagName( 'option' ),\n selectOptionVal;\n \n if ( buttonAlignment == 'flex-start' ) {\n selectOptionVal = 'left';\n } else if ( buttonAlignment == 'center' || ! buttonAlignment ) {\n selectOptionVal = 'center';\n } else if ( buttonAlignment == 'flex-end' ) {\n selectOptionVal = 'right';\n }\n \n for ( let i = 0; i < selectOption.length; i++ ) {\n if ( selectOption[i].value == selectOptionVal ) {\n selectOption[i].selected = true;\n }\n }\n }\n \n if ( wptbButtonA.length > 0 ) {\n let buttonHref = wptbButtonA[0].getAttribute( 'href' ), \n buttonLinkTarget = wptbButtonA[0].getAttribute( 'target' ),\n buttonId = wptbButtonA[0].getAttribute( 'id' ),\n \n \n buttonHrefInput = prop.querySelector( 'input[data-type=\"button-link\"]' ),\n buttonLinkTargetInput = prop.querySelector( 'input[data-type=\"button-link-target\"]' ),\n buttonLinkTargetInputId = buttonLinkTargetInput.getAttribute( 'id' ),\n buttonLinkTargetInputLabel = buttonLinkTargetInput.parentNode.getElementsByTagName( 'label' )[0],\n \n buttotIdInput = prop.querySelector( 'input[data-type=\"button-id\"]' );\n\n buttonLinkTargetInputId = buttonLinkTargetInputId + '-' + kindIndexProt.split( '-' )[1];\n buttonLinkTargetInput.setAttribute( 'id', buttonLinkTargetInputId );\n buttonLinkTargetInputLabel.setAttribute( 'for', buttonLinkTargetInputId );\n\n buttonHrefInput.value = buttonHref;\n\n if( buttonLinkTarget && buttonLinkTarget == '_blank') {\n buttonLinkTargetInput.checked = true;\n }\n \n buttotIdInput.value = buttonId;\n }\n \n if( wptbButton ) {\n let buttonTextColor = wptbButton[0].style.color,\n buttonColor = wptbButton[0].style.backgroundColor,\n buttonTextColorInput = prop.querySelector( 'input[data-type=\"button-text-color\"]' ),\n buttonBackgroundColorInput = prop.querySelector( 'input[data-type=\"button-color\"]' );\n \n \n buttonTextColorInput.value = WPTB_Helper.rgbToHex( buttonTextColor );\n \n buttonBackgroundColorInput.value = WPTB_Helper.rgbToHex( buttonColor );\n \n }\n } else if ( element.kind == 'image' ) {\n let affectedEl = document.getElementsByClassName( 'wptb-element-' + kindIndexProt );\n if ( affectedEl.length > 0 ) {\n let elementsA = affectedEl[0].getElementsByTagName( 'a' );\n if ( elementsA.length > 0 ) {\n let a = elementsA[0];\n\n if ( a ) {\n // set select according to the alignment of the image\n let imgAlign;\n if( a.style.float == 'none' ) {\n imgAlign = 'center';\n } else {\n imgAlign = a.style.float;\n }\n let imageAlignmentSelect = prop.querySelector( 'select[data-type=\"image-alignment\"]' ),\n selectOption = imageAlignmentSelect.getElementsByTagName( 'option' );\n\n for ( let i = 0; i < selectOption.length; i++ ) {\n if ( selectOption[i].value == imgAlign ) {\n selectOption[i].selected = true;\n }\n }\n\n a.onclick = function( e ) {\n e.preventDefault();\n }\n\n // set text link for input field of setting panel\n let imageLinkHref = a.getAttribute( 'href' ),\n inputImageLink = prop.querySelector( 'input[data-type=\"image-link\"]' );\n if ( imageLinkHref ) {\n inputImageLink.value = imageLinkHref;\n }\n\n // set checkbox for target of link \n let imageLinkTarget = a.getAttribute( 'target' ),\n imageLinkTargetInput = prop.querySelector( 'input[data-type=\"image-link-target\"]' ),\n imageLinkTargetInputId = imageLinkTargetInput.getAttribute( 'id' ),\n imageLinkTargetInputLabel = imageLinkTargetInput.parentNode.getElementsByTagName( 'label' )[0];\n\n imageLinkTargetInputId = imageLinkTargetInputId + '-' + kindIndexProt.split( '-' )[1];\n\n imageLinkTargetInput.setAttribute( 'id', imageLinkTargetInputId );\n imageLinkTargetInputLabel.setAttribute( 'for', imageLinkTargetInputId );\n\n if ( imageLinkTarget && imageLinkTarget == '_blank' ) {\n imageLinkTargetInput.checked = true;\n }\n\n // set value for input fields of image size\n let imgWidth = a.style.width;\n if ( imgWidth ) {\n let imageWidthInputRange = prop.querySelector( 'input[type=\"range\"][data-type=\"image-size\"]' ),\n imageWidthInputNumber = prop.querySelector( 'input[type=\"number\"][data-type=\"image-size\"]' );\n\n imageWidthInputRange.value = parseInt( imgWidth );\n imageWidthInputNumber.value = parseInt( imgWidth );\n }\n\n let img = a.getElementsByTagName( 'img' );\n if ( img.length > 0 ) {\n // set value for input field of alternative text image\n let imgAlternativeText = img[0].getAttribute('alt'),\n imageAlternativeTextInput = prop.querySelector( 'input[type=\"text\"][data-type=\"alternative-text\"]' );\n\n imageAlternativeTextInput.value = imgAlternativeText;\n }\n }\n }\n }\n } else if ( element.kind == 'text' ) {\n let affectedEl = document.getElementsByClassName( 'wptb-element-' + kindIndexProt );\n if ( affectedEl.length > 0 ) {\n let elementFontSize = affectedEl[0].style.fontSize,\n elementTextColor = affectedEl[0].style.color;\n let textFontSizeInputRange = prop.querySelector( 'input[type=\"range\"][data-type=\"font-size\"]' ),\n textFontSizeInputNumber = prop.querySelector( 'input[type=\"number\"][data-type=\"font-size\"]' ),\n textColorInput = prop.querySelector( 'input[type=\"text\"][data-type=\"color\"]' );\n\n textFontSizeInputRange.value = parseInt( elementFontSize ) ? parseInt( elementFontSize ) : 10;\n textFontSizeInputNumber.value = parseInt( elementFontSize ) ? parseInt( elementFontSize ) : 10;\n textColorInput.value = WPTB_Helper.rgbToHex( elementTextColor );\n }\n } else if ( element.kind == 'list' ) {\n let elementList = document.getElementsByClassName( 'wptb-element-' + kindIndexProt );\n if ( elementList.length > 0 ) {\n let elementListColor = elementList[0].querySelector( 'p' ).style.color;\n let listColorInput = prop.querySelector( 'input[type=\"text\"][data-type=\"list-text-color\"]' );\n listColorInput.value = WPTB_Helper.rgbToHex( elementListColor );\n \n let elementListItem = elementList[0].querySelectorAll( 'li' );\n if ( elementListItem.length > 0 ) {\n let listItemP = elementListItem[0].querySelector( 'p' );\n let listItemPClasses = listItemP.classList;\n //listItemPClasses = [...listItemPClasses];\n if ( listItemPClasses.length > 0 ) {\n let elementListClassSelect = prop.querySelector( 'select[data-type=\"list-class\"]' );\n if ( elementListClassSelect ) {\n elementListClassSelect.value = 'unordered';\n \n let listIconSelectLabel = elementListClassSelect.parentNode.nextSibling;\n for ( let i = 0; i < 10; i++ ) {\n if ( listIconSelectLabel.nodeType == '1' ) {\n break;\n } else {\n listIconSelectLabel = listIconSelectLabel.nextSibling;\n }\n }\n if ( listIconSelectLabel ) {\n let listIconSelectLabelId = listIconSelectLabel.getAttribute( 'id' );\n listIconSelectLabel.setAttribute( 'id', listIconSelectLabelId + '-' + kindIndexProt );\n listIconSelectLabel.style.display = 'flex';\n }\n \n let elementListStyleTypeSelect = prop.querySelector( 'select[data-type=\"list-style-type\"]' );\n if ( elementListStyleTypeSelect ) {\n elementListStyleTypeSelect.parentNode.style.display = 'flex';\n \n if( listItemPClasses.contains( 'wptb-list-style-type-disc' ) ) {\n elementListStyleTypeSelect.value = 'disc';\n } else if( listItemPClasses.contains( 'wptb-list-style-type-circle' ) ) {\n elementListStyleTypeSelect.value = 'circle';\n } else if( listItemPClasses.contains( 'wptb-list-style-type-square' ) ) {\n elementListStyleTypeSelect.value = 'square';\n } else if ( listItemPClasses.contains( 'wptb-list-style-type-none' ) ) {\n elementListStyleTypeSelect.value = 'none';\n }\n }\n }\n }\n }\n \n let elementListItemContent = elementList[0].getElementsByClassName( 'wptb-list-item-content' );\n if ( elementListItemContent.length > 0 ) {\n let listItemPTextAlignArr = [];\n for ( let i = 0; i < elementListItemContent.length; i++ ) {\n let p = elementListItemContent[i].querySelector( 'p' );\n if ( p ) {\n if ( p.style.textAlign ) {\n listItemPTextAlignArr.push( p.style.textAlign );\n } else {\n listItemPTextAlignArr.push( 'left' );\n }\n }\n \n }\n \n let listItemPTextAlignLeftCount = 0,\n listItemPTextAlignCenterCount = 0,\n listItemPTextAlignRightCount = 0;\n \n if ( listItemPTextAlignArr.length > 0 ) {\n for ( let i = 0; i < listItemPTextAlignArr.length; i++ ) {\n if ( listItemPTextAlignArr[i] ) {\n if ( listItemPTextAlignArr[i] == 'left' ) {\n listItemPTextAlignLeftCount++;\n } else if ( listItemPTextAlignArr[i] == 'center' ) {\n listItemPTextAlignCenterCount++;\n } else if ( listItemPTextAlignArr[i] == 'right' ) {\n listItemPTextAlignRightCount++;\n }\n }\n }\n }\n \n let elementListAlignmentSelect = prop.querySelector( 'select[data-type=\"list-alignment\"]' ),\n maxListItemTAlLeftC = Math.max( listItemPTextAlignLeftCount, listItemPTextAlignCenterCount, listItemPTextAlignRightCount );\n \n if ( listItemPTextAlignLeftCount == maxListItemTAlLeftC ) {\n elementListAlignmentSelect.value = 'left';\n } else if ( listItemPTextAlignCenterCount == maxListItemTAlLeftC ) {\n elementListAlignmentSelect.value = 'center';\n } else if ( listItemPTextAlignRightCount == maxListItemTAlLeftC ) {\n elementListAlignmentSelect.value = 'right';\n }\n }\n } \n } else if( element.kind == 'star_rating' ) {\n let affectedEl = document.getElementsByClassName( 'wptb-element-' + kindIndexProt );\n if( affectedEl.length > 0 ) {\n affectedEl = affectedEl[0];\n let ratingStar = affectedEl.querySelector( 'li' );\n if( ratingStar ) {\n let ratingStarSize = ratingStar.style.width;\n let starSizeInputRange = prop.querySelector( 'input[type=\"range\"][data-type=\"star-size\"]' ),\n starSizeInputNumber = prop.querySelector( 'input[type=\"number\"][data-type=\"star-size\"]' );\n\n starSizeInputRange.value = parseInt( ratingStarSize ) ? parseInt( ratingStarSize ) : 10;\n starSizeInputNumber.value = parseInt( ratingStarSize ) ? parseInt( ratingStarSize ) : 10;\n\n if( ratingStar.querySelector( 'span' ) ) {\n let starColorInput = prop.querySelector( 'input[type=\"text\"][data-type=\"star-color\"]' ),\n ratingStarColor = ratingStar.querySelector( 'span' ).style.fill;\n starColorInput.value = WPTB_Helper.rgbToHex( ratingStarColor );\n }\n }\n \n let ratingStars = affectedEl.querySelectorAll( 'li' );\n let starsCountInputNumber = prop.querySelector( 'input[type=\"number\"][data-type=\"stars-count\"]' );\n if( ratingStars.length == 1 && ratingStars[0].style.display == 'none' ) {\n starsCountInputNumber.value = 0;\n } else {\n starsCountInputNumber.value = ratingStars.length;\n }\n\n\n let ratingAlignment = affectedEl.style.textAlign,\n ratingAlignmentSelect = prop.querySelector( 'select[data-type=\"rating-alignment\"]' ),\n selectOption = ratingAlignmentSelect.getElementsByTagName( 'option' ),\n selectOptionVal;\n if ( ratingAlignment == 'start' ) {\n selectOptionVal = 'left';\n } else if ( ratingAlignment == 'center' || ! ratingAlignment ) {\n selectOptionVal = 'center';\n } else if ( ratingAlignment == 'right' ) {\n selectOptionVal = 'right';\n }\n \n for ( let i = 0; i < selectOption.length; i++ ) {\n if ( selectOption[i].value == selectOptionVal ) {\n selectOption[i].selected = true;\n }\n }\n \n \n\n let successBox = affectedEl.querySelector( '.wptb-success-box' );\n if( successBox ) {\n let showNumberRatingCheckbox = prop.querySelector( 'input[type=\"checkbox\"][data-type=\"show-number-rating\"]' );\n if( successBox.style.display == 'block' ) {\n showNumberRatingCheckbox.checked = true;\n let numeralRatingOptionContainers = prop.getElementsByClassName( 'wptb-numeral-rating-option-container' );\n for( let i = 0; i < numeralRatingOptionContainers.length; i++ ) {\n numeralRatingOptionContainers[i].style.display = 'block';\n }\n } else {\n showNumberRatingCheckbox.checked = false;\n }\n\n let wptbTextMessage = successBox.querySelector( '.wptb-text-message' );\n if( wptbTextMessage ) {\n let numberRatingSize = wptbTextMessage.style.fontSize;\n let numberRatingColor = wptbTextMessage.style.color;\n\n let numberSizeInputRange = prop.querySelector( 'input[type=\"range\"][data-type=\"numeral-rating-size\"]' ),\n numberSizeInputNumber = prop.querySelector( 'input[type=\"number\"][data-type=\"numeral-rating-size\"]' ),\n numberColorInput = prop.querySelector( 'input[type=\"text\"][data-type=\"numeral-rating-color\"]' );\n\n numberSizeInputRange.value = parseInt( numberRatingSize ) ? parseInt( numberRatingSize ) : 10;\n numberSizeInputNumber.value = parseInt( numberRatingSize ) ? parseInt( numberRatingSize ) : 10;\n numberColorInput.value = WPTB_Helper.rgbToHex( numberRatingColor );\n }\n }\n }\n }\n }\n\n node.onclick = function () {\n var infArr = this.className.match(/wptb-element-((.+-)\\d+)/i),\n optionsClass = '.wptb-' + infArr[2] + 'options' +\n '.wptb-options-' + infArr[1];\n\n document.getElementsByClassName('wptb-elements-container')[0].style.display = 'none';\n document.getElementsByClassName('wptb-settings-section')[0].style.display = 'none';\n document.getElementById(\"element-options-group\").style.display = 'block';\n\n var children = document.getElementById(\"element-options-group\").childNodes;\n for (var i = 0; i < children.length; i++) {\n if (children[i].style)\n children[i].style.display = 'none';\n }\n\n document.querySelector(optionsClass).style.display = 'block';\n\n //var listStyleType, textAlign;\n\n// switch (element.kind) {\n\n// case 'text':\n// jQuery(prop).find('[data-type=color]').wpColorPicker({ defaultColor: node.style.color });\n// prop.querySelector('[type=number][data-type=font-size]').value\n// = prop.querySelector('[type=range][data-type=font-size]').value\n// = node.style.fontSize.substring(0, node.style.fontSize.length - 2);\n// break;\n// case 'list':\n// textAlign = node.querySelector('li p').style.textAlign;\n// listStyleType = node.querySelector('li').style.listStyleType;\n// if ( prop.querySelector( 'select[data-type=list-class]' ) ) {\n// console.log(textAlign);\n// console.log(listStyleType);\n// console.log(listStyleType);\n// console.log(prop);\n// prop.querySelector('select[data-type=list-class]').selectedIndex = ( listStyleType == 'decimal' ? 0 : 1 );\n// }\n// if ( prop.querySelector('select[data-type=list-style-type]') ) {\n// prop.querySelector('select[data-type=list-style-type]').selectedIndex = (listStyleType == 'circle' ? 0 : (listStyleType == 'square' ? 1 : 2));\n// }\n// if ( prop.querySelector('select[data-type=list-alignment]') ) {\n// prop.querySelector('select[data-type=list-alignment]').selectedIndex = (textAlign == 'left' ? 0 : (textAlign == 'center' ? 1 : 2));\n// }\n// break;\n// case 'image':\n// break;\n// case 'button':\n// jQuery(prop).find('[data-type=button-color]').wpColorPicker({ defaultColor: node.style.backgroundColor });\n// break;\n//\n// }\n };\n\n if (element.kind == 'button') {\n //We must add this special kind of property, since it is triggered with click event\n var buttons = prop.getElementsByClassName('wptb-btn-size-btn');\n\n for (var i = 0; i < buttons.length; i++) {\n buttons[i].onclick = function () {\n var size = this.innerHTML,\n n_Class = this.dataset.element,\n infArr = n_Class.match(/wptb-options-(.+)-(\\d+)/i),\n type = infArr[1],\n num = infArr[2],\n affectedEl = document.getElementsByClassName('wptb-element-' + type + '-' + num)[0];\n affectedEl.classList.remove('wptb-size-S');\n affectedEl.classList.remove('wptb-size-M');\n affectedEl.classList.remove('wptb-size-L');\n affectedEl.classList.remove('wptb-size-XL');\n affectedEl.classList.add('wptb-size-' + size);\n var b = this.parentNode.getElementsByClassName('wptb-btn-size-btn');\n for (var i = 0; i < b.length; i++) {\n b[i].classList.remove('selected');\n }\n this.classList.add('selected');\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n }\n }\n\n var optionControls = prop.getElementsByClassName('wptb-element-property');\n\n for (var i = 0; i < optionControls.length; i++) {\n if ( optionControls[i].classList.contains( 'wptb-color-picker' ) ) {\n jQuery(optionControls[i]).wpColorPicker({\n change: function ( event, ui ) {\n WPTB_Helper.wpColorPickerChange( event, ui );\n \n //console.log(event);\n WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving( event );\n },\n clear: function( event ) {\n WPTB_Helper.wpColorPickerChange( event );\n }\n });\n }\n \n if( optionControls[i].classList.contains( 'wptb-stars-count-field' ) ) {\n WPTB_Helper.numberImputSize( optionControls[i], 1, 10 );\n }\n\n if ( optionControls[i].dataset.type === 'font-size' || optionControls[i].dataset.type === 'image-size' ||\n optionControls[i].dataset.type === 'star-size' || optionControls[i].dataset.type === 'numeral-rating-size' ) {\n var slider = optionControls[i].parentNode.parentNode.getElementsByClassName('wptb-size-slider')[0];\n slider.oninput = function () {\n this.parentNode.parentNode.getElementsByClassName('wptb-size-number')[0].value = this.value;\n this.parentNode.parentNode.getElementsByClassName('wptb-size-number')[0].onchange( event );\n }\n }\n\n// if (optionControls[i].dataset.type === 'image-size') {\n// var slider = optionControls[i].parentNode.parentNode.getElementsByClassName('wptb-size-slider')[0];\n// slider.oninput = function () {\n// this.parentNode.parentNode.getElementsByClassName('wptb-size-number')[0].value = this.value;\n// this.parentNode.parentNode.getElementsByClassName('wptb-size-number')[0].onchange( event );\n// }\n// }\n// \n// if ( optionControls[i].dataset.type === 'star-size' ) {\n// var slider = optionControls[i].parentNode.parentNode.getElementsByClassName('wptb-size-slider')[0];\n// slider.oninput = function () {\n// this.parentNode.parentNode.getElementsByClassName('wptb-size-number')[0].value = this.value;\n// this.parentNode.parentNode.getElementsByClassName('wptb-size-number')[0].onchange( event );\n// }\n// }\n\n optionControls[i].onchange = function ( event ) {\n var n_Class = this.dataset.element,\n infArr = n_Class.match(/wptb-options-(.+)-(\\d+)/i),\n type = infArr[1],\n num = infArr[2],\n affectedEl = document.getElementsByClassName('wptb-element-' + type + '-' + num)[0],\n val = this.value;\n\n switch ( this.dataset.type ) {\n case 'src':\n var img = affectedEl.getElementsByTagName(\"img\")[0];\n img.src = this.value;\n break;\n case 'alternative-text':\n var img = affectedEl.getElementsByTagName('img')[0];\n img.alt = this.value;\n break;\n case 'image-link':\n affectedEl.getElementsByTagName('a')[0].href = WPTB_Helper.linkHttpCheckChange( this.value );\n break;\n case 'image-link-target':\n if (this.checked == true) {\n affectedEl.getElementsByTagName('a')[0].target = '_blank';\n } else {\n affectedEl.getElementsByTagName('a')[0].target = '_self';\n }\n break;\n case 'image-link-nofollow':\n if (this.checked == true) {\n affectedEl.getElementsByTagName('a')[0].rel = 'nofollow';\n } else {\n affectedEl.getElementsByTagName('a')[0].removeAttribute('rel');\n }\n break;\n case 'image-size':\n affectedEl.getElementsByTagName('a')[0].style.width = this.value + '%';\n affectedEl.getElementsByTagName('a')[0].style.height = 'auto';\n this.parentNode.parentNode.getElementsByClassName('wptb-size-slider')[0].value = this.value;\n break;\n case 'image-alignment':\n let wptbImageFloatValue = '';\n if( this.value == 'center' ) {\n wptbImageFloatValue = 'none';\n } else {\n wptbImageFloatValue = this.value;\n }\n affectedEl.querySelector( '.wptb-image-wrapper a' ).style.float = wptbImageFloatValue;\n break;\n case 'font-size':\n affectedEl.style.fontSize = val + 'px';\n this.parentNode.parentNode.getElementsByClassName('wptb-size-slider')[0].value = this.value;\n break;\n case 'button-alignment':\n var jc = '';\n if (this.value == 'left') {\n jc = 'start';\n } else if (this.value == 'right') {\n jc = 'flex-end';\n } else {\n jc = 'center';\n }\n affectedEl.getElementsByClassName('wptb-button-wrapper')[0].style.justifyContent = jc;\n break;\n case 'rating-alignment':\n var jc = '';\n if (this.value == 'left') {\n jc = 'start';\n } else if (this.value == 'right') {\n jc = 'right';\n } else {\n jc = 'center';\n }\n affectedEl.style.textAlign = jc;\n break;\n case 'button-link':\n if ( this.value ) {\n affectedEl.getElementsByTagName( 'a' )[0].href = WPTB_Helper.linkHttpCheckChange( this.value );\n } else {\n affectedEl.getElementsByTagName( 'a' )[0].removeAttribute( 'href' );\n }\n break;\n case 'button-link-target':\n if (this.checked == true) {\n affectedEl.getElementsByTagName('a')[0].target = '_blank';\n } else {\n affectedEl.getElementsByTagName('a')[0].target = '_self';\n }\n break;\n case 'button-link-nofollow':\n if (this.checked == true) {\n affectedEl.getElementsByTagName('a')[0].rel = 'nofollow';\n } else {\n affectedEl.getElementsByTagName('a')[0].removeAttribute( 'rel' );\n }\n break;\n case 'button-id':\n if( this.value ) {\n affectedEl.getElementsByTagName( 'a' )[0].id = this.value;\n } else {\n affectedEl.getElementsByTagName( 'a' )[0].removeAttribute( 'id' );\n }\n case 'button-color':\n break;\n case 'list-alignment':\n let listItems = affectedEl.querySelectorAll('li');\n for (var i = 0; i < listItems.length; i++) {\n let p = listItems[i].querySelector( 'p' );\n if ( p ) {\n p.style.textAlign = this.value;\n }\n }\n break;\n case 'list-class':\n let parentNode = event.target\n .parentNode\n .parentNode\n .querySelector('[data-type=list-style-type]')\n .parentNode,\n parentNodeSettingItem = parentNode.parentNode;\n if (val == 'unordered') {\n parentNode.style.display = 'flex';\n \n parentNodeSettingItem.querySelector( '.wptb-list-icon-select-label' ).style.display = 'flex';\n let listItem = affectedEl.querySelectorAll('li');\n for (var i = 0; i < listItem.length; i++) {\n let p = listItem[i].querySelector( 'p' );\n p.removeAttribute ( 'class' );\n p.classList.add( 'wptb-list-style-type-disc' );\n }\n parentNodeSettingItem.querySelector('[data-type=list-style-type]').value = 'disc';\n } else {\n parentNode.style.display = 'none';\n parentNodeSettingItem.querySelector( '.wptb-list-icon-select-label' ).style.display = 'none';\n var listItem = affectedEl.querySelectorAll('li');\n for (var i = 0; i < listItem.length; i++) {\n let p = listItem[i].querySelector( 'p' );\n p.removeAttribute ( 'class' );\n }\n }\n break;\n case 'list-style-type':\n var listItem = affectedEl.querySelectorAll('li');\n for (var i = 0; i < listItem.length; i++) {\n let p = listItem[i].querySelector( 'p' );\n p.removeAttribute ( 'class' );\n p.classList.add( 'wptb-list-style-type-' + val.toLowerCase() );\n }\n break;\n case 'star-size':\n let ratingStar = affectedEl.querySelectorAll('li');\n for( let i = 0; i < ratingStar.length; i++ ) {\n ratingStar[i].style.width = val + 'px';\n ratingStar[i].style.height = val + 'px';\n let span = ratingStar[i].querySelectorAll( 'span' );\n for( let j = 0; j < span.length; j++ ) {\n if( span[j].querySelector( 'svg' ) ) {\n span[j].style.width = val + 'px';\n span[j].style.height = val + 'px';\n span[j].querySelector( 'svg' ).style.width = val + 'px';\n }\n }\n }\n break;\n case 'show-number-rating':\n let wptbNumeralRatingOptionContainer = WPTB_Helper.findAncestor( this, 'wptb-star_rating-options' )\n .getElementsByClassName( 'wptb-numeral-rating-option-container' );\n \n WPTB_Helper.starRatingTextMessageChenge( affectedEl );\n \n if( wptbNumeralRatingOptionContainer.length > 0 ) {\n let wptbTextMessage = affectedEl.querySelector( '.wptb-text-message' );\n \n let val = this.checked ? 'checked' : 'unchecked';\n if( val== 'checked' ) {\n for ( let i = 0; i < wptbNumeralRatingOptionContainer.length; i++ ) {\n wptbNumeralRatingOptionContainer[i].style.display = 'block';\n }\n wptbTextMessage.parentNode.style.display = 'block';\n } else if ( val == 'unchecked' ) {\n for ( let i = 0; i < wptbNumeralRatingOptionContainer.length; i++ ) {\n wptbNumeralRatingOptionContainer[i].style.display = 'none';\n }\n wptbTextMessage.parentNode.style.display = 'none';\n }\n }\n break;\n case 'numeral-rating-size':\n let wptbTextMessageSize = affectedEl.querySelector('.wptb-text-message');\n wptbTextMessageSize.style.fontSize = val + 'px';\n wptbTextMessageSize.style.height = val + 'px';\n wptbTextMessageSize.style.lineHeight = val + 'px';\n break;\n case 'stars-count':\n let starRatings = affectedEl.querySelectorAll( 'li' );\n \n let starRatingsCount = starRatings.length;\n \n if( val > starRatingsCount ) {\n let difference = val - starRatingsCount;\n let starRatingsLast = starRatings[starRatings.length - 1];\n \n let parent = starRatingsLast.parentNode;\n for( let i = 0; i < difference; i++ ){\n let newStarRating = starRatingsLast.cloneNode( true );\n newStarRating.removeAttribute( 'class' );\n newStarRating.setAttribute( 'class', 'wptb-rating-star' );\n newStarRating.dataset.value = parseInt(starRatingsLast.dataset.value) + i + 1;\n WPTB_Helper.starRatingEventHandlersAdd( newStarRating );\n parent.appendChild( newStarRating );\n }\n } else if( val < starRatingsCount ) {\n let difference = parseInt( starRatingsCount ) - parseInt( val );\n \n if( val == 0 ) {\n difference--;\n starRatings[0].removeAttribute( 'class' );\n starRatings[0].setAttribute( 'class', 'wptb-rating-star' );\n starRatings[0].style.display = 'none';\n }\n \n let starRatingLength = starRatings.length;\n for( i = 0; i < difference; i++ ) {\n starRatings[0].parentNode.removeChild( starRatings[starRatingLength - i - 1] );\n }\n } else if( val == starRatingsCount && starRatingsCount == 1 ) {\n starRatings[0].style.display = 'inline-block';\n }\n \n WPTB_Helper.starRatingTextMessageChenge( affectedEl );\n \n break;\n }\n \n \n if( event.target.classList.contains( 'wptb-size-slider' ) || event.target.classList.contains( 'wptb-size-slider' ) ) {\n event.target.onmouseup = function() {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n } else {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n }\n }\n};","var WPTB_Helper = {\n hexToRgb: function( hex ) {\n var result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec( hex );\n return result ? 'rgb(' + parseInt( result[1], 16 ) + ',' + parseInt( result[2], 16 ) + ',' + parseInt( result[3], 16 ) + ')' : null;\n },\n rgbToHex: function ( rgb ) {\n var rgb = rgb.match( /^rgba?[\\s+]?\\([\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?/i );\n\n return ( rgb && rgb.length === 4 ) ? \"#\" +\n ( \"0\" + parseInt( rgb[1],10 ).toString( 16 )).slice( -2 ) +\n ( \"0\" + parseInt( rgb[2],10 ).toString( 16 )).slice( -2 ) +\n ( \"0\" + parseInt( rgb[3],10 ).toString( 16 )).slice( -2 ) : '';\n },\n getDragImageCustom: function ( type ) {\n let hostName = location.protocol + '//' + location.hostname;\n let img = document.createElement( 'img' );\n img.src = hostName + '/wp-content/plugins/wp-table-builder/inc/admin/views/builder/icons/' + type + '.png';\n return img;\n },\n dragImagesArr: function() {\n return {\n text: WPTB_Helper.getDragImageCustom( 'text' ),\n image: WPTB_Helper.getDragImageCustom( 'image' ),\n button: WPTB_Helper.getDragImageCustom( 'button' ),\n list: WPTB_Helper.getDragImageCustom( 'list' ),\n star_rating: WPTB_Helper.getDragImageCustom( 'half-filled-rating-star' )\n };\n },\n listItemsRecalculateIndex: function( ulElem ) {\n let par = ulElem.querySelectorAll( 'p' );\n if ( par.length > 0 ) {\n for ( let i = 0; i < par.length; i++ ) {\n par[i].dataset.listStyleTypeIndex = Number( i ) + 1 + '.';\n }\n }\n },\n listItemsTinyMceInit: function( listItem ) {\n tinyMCE.init({\n target: listItem,\n inline: true,\n plugins: \"link, paste\",\n dialog_type: \"modal\",\n theme: 'modern',\n menubar: false,\n fixed_toolbar_container: '#wpcd_fixed_toolbar',\n paste_as_text: true,\n toolbar: 'bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify',\n setup: function(ed) {\n ed.on('keydown', function(e) {\n let article = e.target.parentNode;\n if ( e.keyCode == 13 ) {\n e.preventDefault();\n let text = e.target.innerHTML;\n let duplicate = new WPTB_ListItem( text, article, true );\n \n article.parentNode.insertBefore( duplicate.getDOMElement(), article );\n WPTB_Helper.listItemsTinyMceInit( duplicate.getDOMElement().firstChild );\n e.target.querySelector( 'p' ).innerText = 'New List Item';\n //tinyMCE.execCommand('mceInsertContent', false, 'New List Item');\n WPTB_Helper.listItemsRecalculateIndex( article.parentNode );\n \n return;\n \n } else if ( e.keyCode == '8' || e.keyCode == '46' ) {\n let p = e.target.querySelector( 'p' );\n let pText = p.innerHTML.replace(/<[^>]+>/g, '');\n pText = pText.replace( /\\s+/g, ' ' ).trim();\n pText = pText.replace( / /g, '').trim();\n \n if( pText == '' ) {\n e.preventDefault();\n e.target.querySelector( 'p' ).innerText = '\\n';\n } else {\n let selectedText = WPTB_Helper.getSelectionText();\n selectedText = selectedText.replace( /\\s+/g, ' ' ).trim();\n selectedText = selectedText.replace( / /g, '' ).trim();\n if( selectedText == pText ) {\n e.preventDefault();\n e.target.querySelector( 'p' ).innerText = '\\n';\n }\n }\n }\n \n let wptbListItem = e.target.parentNode;\n let wptbActionsField = new WPTB_ActionsField();\n\n wptbActionsField.addActionField( 2, wptbListItem );\n\n wptbActionsField.setParameters( wptbListItem );\n });\n \n ed.on( 'keyup', function( e ) {\n let wptbListItem = e.target.parentNode;\n let wptbActionsField = new WPTB_ActionsField();\n\n wptbActionsField.addActionField( 2, wptbListItem );\n\n wptbActionsField.setParameters( wptbListItem );\n \n e.target.onblur = function() {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n });\n },\n init_instance_callback: function (editor) {\n window.currentEditor = editor;\n editor.on('focus', function (e) {\n var totalWidth = document.getElementsByClassName('wptb-builder-panel')[0].offsetWidth;\n if (window.currentEditor &&\n document.getElementById('wptb_builder').scrollTop >= 55 &&\n window.currentEditor.bodyElement.style.display != 'none') {\n document.getElementById('wpcd_fixed_toolbar').style.position = 'fixed';\n document.getElementById('wpcd_fixed_toolbar').style.right = (totalWidth / 2 - document.getElementById('wpcd_fixed_toolbar').offsetWidth / 2) + 'px';\n document.getElementById('wpcd_fixed_toolbar').style.top = '100px';\n } else {\n document.getElementById('wpcd_fixed_toolbar').style.position = 'static';\n delete document.getElementById('wpcd_fixed_toolbar').style.right;\n delete document.getElementById('wpcd_fixed_toolbar').style.top;\n }\n });\n }\n });\n },\n buttonsTinyMceInit: function( target ) {\n tinyMCE.init({\n target: target,\n inline: true,\n plugins: \"link\",\n dialog_type: \"modal\",\n theme: 'modern',\n menubar: false,\n fixed_toolbar_container: '#wpcd_fixed_toolbar',\n toolbar: 'bold italic strikethrough',\n setup : function(ed) {\n ed.on( 'keydown', function(e) {\n if (e.keyCode == 13) {\n e.preventDefault();\n }\n let wptbButtonContainer = WPTB_Helper.findAncestor( target, 'wptb-button-container' );\n \n let wptbActionsField = new WPTB_ActionsField();\n\n wptbActionsField.addActionField( 1, wptbButtonContainer );\n\n wptbActionsField.setParameters( wptbButtonContainer );\n });\n \n ed.on( 'keyup', function(e) {\n let wptbButtonContainer = WPTB_Helper.findAncestor( target, 'wptb-button-container' );\n \n let wptbActionsField = new WPTB_ActionsField();\n\n wptbActionsField.addActionField( 1, wptbButtonContainer );\n\n wptbActionsField.setParameters( wptbButtonContainer );\n \n e.target.onblur = function() {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n });\n },\n init_instance_callback: function (editor) {\n window.currentEditor = editor;\n editor.on('focus', function (e) {\n var totalWidth = document.getElementsByClassName('wptb-builder-panel')[0].offsetWidth;\n if (window.currentEditor &&\n document.getElementById('wptb_builder').scrollTop >= 55 &&\n window.currentEditor.bodyElement.style.display != 'none') {\n document.getElementById('wpcd_fixed_toolbar').style.position = 'fixed';\n document.getElementById('wpcd_fixed_toolbar').style.right = (totalWidth / 2 - document.getElementById('wpcd_fixed_toolbar').offsetWidth / 2) + 'px';\n document.getElementById('wpcd_fixed_toolbar').style.top = '100px';\n } else {\n document.getElementById('wpcd_fixed_toolbar').style.position = 'static';\n delete document.getElementById('wpcd_fixed_toolbar').style.right;\n delete document.getElementById('wpcd_fixed_toolbar').style.top;\n }\n });\n }\n });\n },\n linkHttpCheckChange: function( link ) {\n if ( link ) {\n if ( link.indexOf( 'http://' ) == -1 && link.indexOf( 'https://' ) == -1 ) {\n let linkArr = link.split( '/' ),\n linkClean;\n if ( Array.isArray( linkArr ) && linkArr.length > 0 ) {\n linkClean = linkArr[linkArr.length - 1];\n }\n return document.location.protocol + '//' + linkClean;\n } else { \n return link;\n }\n } else {\n return '';\n }\n },\n dataTitleColumnSet: function( table ) {\n let rows = table.rows,\n rowHead = rows[0];\n let computedStyleRowHead = getComputedStyle(rowHead);\n \n let rowHeadChildren = rowHead.children;\n let contentsForHeader = {};\n for( let i = 0; i < rowHeadChildren.length; i++ ) {\n let tdElements = rowHeadChildren[i].children;\n for( let j = 0; j < tdElements.length; j++ ) {\n let element = tdElements[j];\n if( element.classList.contains( 'wptb-ph-element' ) ) {\n let infArr = element.className.match( /wptb-element-(.+)-(\\d+)/i );\n if( infArr[1] == 'text' ) {\n let p = element.querySelector( 'p' ),\n textContent = p.textContent,\n textAlign = p.style.textAlign;\n contentsForHeader[rowHeadChildren[i].dataset.xIndex] = [textContent, element.style.fontSize, \n element.style.color, computedStyleRowHead.backgroundColor, textAlign];\n break;\n }\n }\n }\n if( ! contentsForHeader[rowHeadChildren[i].dataset.xIndex] ) {\n contentsForHeader[rowHeadChildren[i].dataset.xIndex] = ['', '', \n '', computedStyleRowHead.backgroundColor, ''];\n }\n }\n for ( let i = 1; i < rows.length; i++ ) {\n let thisRow = rows[i],\n thisRowChildren = thisRow.children;\n for( let j = 0; j < thisRowChildren.length; j++ ) {\n if ( contentsForHeader[thisRowChildren[j].dataset.xIndex] ) {\n thisRowChildren[j].dataset.wptbTitleColumn = contentsForHeader[thisRowChildren[j].dataset.xIndex][0];\n thisRowChildren[j].dataset.wptbTitleColumnFontSize = contentsForHeader[thisRowChildren[j].dataset.xIndex][1];\n thisRowChildren[j].dataset.wptbTitleColumnColor = contentsForHeader[thisRowChildren[j].dataset.xIndex][2];\n thisRowChildren[j].dataset.wptbTitleBackgroundColor = contentsForHeader[thisRowChildren[j].dataset.xIndex][3];\n thisRowChildren[j].dataset.wptbTitleAlign = contentsForHeader[thisRowChildren[j].dataset.xIndex][4];\n } else {\n thisRowChildren[j].dataset.wptbTitleColumn = '';\n thisRowChildren[j].dataset.wptbTitleColumnFontSize = '';\n thisRowChildren[j].dataset.wptbTitleColumnColor = '';\n thisRowChildren[j].dataset.wptbTitleBackgroundColor = '';\n thisRowChildren[j].dataset.wptbTitleAlign = '';\n }\n }\n }\n },\n findAncestor: function(el, cls) {\n while ((el = el.parentElement) && !el.classList.contains(cls));\n return el;\n },\n getSelectionText: function() {\n var txt = '';\n if (txt = window.getSelection) {\n txt = window.getSelection().toString();\n } else {\n txt = document.selection.createRange().text;\n }\n return txt;\n },\n settingsPanelClear: function() {\n document.getElementById( 'wptb-adaptive-table-checkbox' ).checked = false;\n document.getElementById( 'wptb-top-row-as-header' ).checked = false;\n document.getElementById( 'wptb-table-border-slider' ).value = 0;\n document.getElementById( 'wptb-table-border-number' ).value = 0;\n document.getElementById( 'wptb-inner-border-check' ).checked = false;\n document.getElementById( 'wptb-apply-inner-border' ).classList.remove( 'visible' );\n document.getElementById( 'wptb-table-inner-border-slider' ).value = 1;\n document.getElementById( 'wptb-table-inner-border-number' ).value = 1;\n \n WPTB_Helper.wpColorPickerClear( 'wptb-table-border-color', true );\n \n WPTB_Helper.wpColorPickerClear( 'wptb-table-header-bg', true );\n \n WPTB_Helper.wpColorPickerClear( 'wptb-even-row-bg', true );\n \n WPTB_Helper.wpColorPickerClear( 'wptb-odd-row-bg', true );\n \n document.getElementById( 'wptb-table-cell-slider' ).value = 15;\n document.getElementById( 'wptb-table-cell-number' ).value = 15;\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' ) {\n let irisSquareHandle = wpPickerContainer.getElementsByClassName( 'iris-square-handle' );\n if( irisSquareHandle.length > 0 ) {\n irisSquareHandle = irisSquareHandle[0];\n irisSquareHandle.onmouseup = function() {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n }\n } else if( event.originalEvent.type == 'strip' ) {\n let uiSliderHandle = wpPickerContainer.getElementsByClassName( 'iris-slider-offset' );\n if( uiSliderHandle.length > 0 ) {\n uiSliderHandle = uiSliderHandle[0];\n uiSliderHandle.onmouseup = function() {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n }\n }\n }\n }\n },\n wpColorPickerClear: function( attribute, isId ) {\n let input;\n if( isId ) {\n input = [document.getElementById( attribute )];\n input.length = 1;\n } else {\n input = document.getElementsByClassName( attribute );\n }\n for( let i = 0; i < input.length; i++ ) {\n let wpPickerContainer = WPTB_Helper.findAncestor( input[i], 'wp-picker-container' );\n if( wpPickerContainer ) {\n let parent = wpPickerContainer.parentNode;\n parent.removeChild( wpPickerContainer );\n let newInput = document.createElement( 'input' );\n if( isId ) {\n newInput.setAttribute( 'id', attribute );\n } else {\n newInput.classList.add( 'wptb-element-property', attribute );\n }\n newInput.value = \"\";\n parent.appendChild( newInput );\n }\n }\n },\n detectMode: function() {\n var url = window.location.href,\n regex = new RegExp('[?&]table(=([^&#]*)|&|#|$)'),\n results = regex.exec(url);\n if (!results) return false;\n if (!results[2]) return '';\n return decodeURIComponent(results[2].replace(/\\+/g, ' '));\n },\n getColumnWidth: function( table, cell ) {\n let xIndex = cell.dataset.xIndex;\n let xIndexes = table.querySelectorAll( '[data-x-index=\"' + xIndex + '\"]' );\n let cellWidth = cell.getCellDimensions().width;\n for( let i = 0; i < xIndexes.length; i++ ) {\n if( cellWidth > xIndexes[i].getCellDimensions().width ) {\n cellWidth = xIndexes[i].getCellDimensions().width;\n }\n }\n return cellWidth;\n },\n getRowHeight: function( table, cell ) {\n let yIndex = cell.dataset.yIndex;\n let yIndexes = table.querySelectorAll( '[data-y-index=\"' + yIndex + '\"]' );\n let cellHeight = cell.getCellDimensions().height;\n for( let i = 0; i < yIndexes.length; i++ ) {\n if( cellHeight > yIndexes[i].getCellDimensions().height ) {\n cellHeight = yIndexes[i].getCellDimensions().height;\n }\n }\n return cellHeight;\n },\n newElementProxy: function(el) {\n if ( el == 'list' ) {\n return new WPTB_List();\n } else if ( el == 'image' ) {\n return new WPTB_Image();\n } else if ( el == 'text' ) {\n return new WPTB_Text();\n } else if ( el == 'button' ) {\n return new WPTB_Button();\n } else if( el == 'star_rating' ) {\n return new WPTB_StarRating();\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-text-message');\n wptbTextMessageSize.style.color = uiColor;\n }\n\n } else {\n affectedEl.style.color = uiColor;\n }\n },\n starRatingSelectHoverSet : function( event ) {\n let starRating;\n if( ! event.target.classList.contains( 'wptb-rating-star' ) ) {\n starRating = WPTB_Helper.findAncestor( event.target, 'wptb-rating-star' );\n } else {\n starRating = event.target;\n }\n \n let onStar = parseInt( starRating.dataset.value, 10 ); // The star currently mouse on\n\n // Now highlight all the stars that's not after the current hovered star\n let children = starRating.parentNode.children;\n if( event.type == \"mouseover\" ) {\n for( let j = 0; j < children.length; j++ ) {\n if( j < onStar ) {\n if( j == onStar - 1 ) {\n if ( event.target.classList.contains( 'wptb-rating-star-left-signal-part' ) ) {\n children[j].classList.add( 'wptb-rating-star-hover-half' );\n children[j].classList.remove( 'wptb-rating-star-hover-full' );\n } else if( event.target.classList.contains( 'wptb-rating-star-right-signal-part' ) ) {\n children[j].classList.add( 'wptb-rating-star-hover-full' );\n children[j].classList.remove( 'wptb-rating-star-hover-half' );\n }\n } else {\n children[j].classList.add( 'wptb-rating-star-hover-full' );\n children[j].classList.remove( 'wptb-rating-star-hover-half' );\n }\n } else {\n children[j].classList.remove( 'wptb-rating-star-hover-full' );\n children[j].classList.remove( 'wptb-rating-star-hover-half' );\n }\n }\n } else if ( event.type == \"click\" ) {\n for( let j = 0; j < children.length; j++ ) {\n if( j < onStar ) {\n if( j == onStar - 1 ) {\n if ( event.target.classList.contains( 'wptb-rating-star-left-signal-part' ) ) {\n children[j].classList.add( 'wptb-rating-star-selected-half' );\n children[j].classList.remove( 'wptb-rating-star-selected-full' );\n } else if( event.target.classList.contains( 'wptb-rating-star-right-signal-part' ) ) {\n children[j].classList.add( 'wptb-rating-star-selected-full' );\n children[j].classList.remove( 'wptb-rating-star-selected-half' );\n }\n } else {\n children[j].classList.add( 'wptb-rating-star-selected-full' );\n children[j].classList.remove( 'wptb-rating-star-selected-half' );\n }\n } else {\n children[j].classList.remove( 'wptb-rating-star-selected-full' );\n children[j].classList.remove( 'wptb-rating-star-selected-half' );\n }\n }\n }\n \n },\n starRatingEventHandlersAdd: function( ratingStar ) {\n ratingStar.onmouseover = function( event ) {\n event.stopPropagation();\n WPTB_Helper.starRatingSelectHoverSet( event );\n }\n ratingStar.onmouseout = function() {\n let children = this.parentNode.children;\n for( let j = 0; j < children.length; j++ ) {\n children[j].classList.remove( 'wptb-rating-star-hover-half' );\n children[j].classList.remove( 'wptb-rating-star-hover-full' );\n }\n }\n\n /* 2. Action to perform on click */\n ratingStar.onclick = function( event ) {\n WPTB_Helper.starRatingSelectHoverSet( event );\n \n /* Rating number message */\n let wptbStarRatingContainer = WPTB_Helper.findAncestor( event.target, 'wptb-star_rating-container' );\n\n WPTB_Helper.starRatingTextMessageChenge( wptbStarRatingContainer );\n\n let wptbActionsField = new WPTB_ActionsField( 1, wptbStarRatingContainer );\n\n wptbActionsField.setParameters( wptbStarRatingContainer );\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\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 thisValue = String( thisValue );\n if ( thisValue > maxValue ) {\n this.value = maxValue;\n }\n }\n },\n starRatingTextMessageChenge: function( starRatingContainer ) {\n let ratingNumber = starRatingContainer.getElementsByClassName( 'wptb-rating-star-selected-full' ).length;\n if( starRatingContainer.getElementsByClassName( 'wptb-rating-star-selected-half' ).length > 0 ) {\n ratingNumber = parseInt( ratingNumber ) + 0.5;\n }\n \n let wptbTextMessageCommon = starRatingContainer.querySelectorAll( 'li' ),\n wptbTextMessageCommonVal = wptbTextMessageCommon.length,\n wptbTextMessage = starRatingContainer.querySelector( '.wptb-text-message' );\n if( wptbTextMessageCommonVal == 1 && wptbTextMessageCommon[0].style.display == 'none' ) {\n wptbTextMessage.innerHTML = '';\n return;\n }\n \n wptbTextMessage.innerHTML = ratingNumber + '/' + wptbTextMessageCommonVal;\n }\n}\n","var WPTB_Image = function ( src, DOMElementProt ) {\n let DOMElement,\n elImage,\n kindIndexProt = undefined,\n copy = false;\n if ( DOMElementProt == undefined ) {\n DOMElement = document.createElement( 'div' );\n elImage = document.createElement( 'div' );\n\t let anchor = document.createElement( 'a' ),\n\t img = document.createElement( 'img' );\n anchor.style.display = 'block';\n anchor.appendChild( img );\n DOMElement.classList.add( 'wptb-image-container' );\n elImage.classList.add( 'wptb-image-wrapper' );\n elImage.appendChild( anchor );\n DOMElement.appendChild( elImage );\n \n anchor.onclick = function( e ) {\n e.preventDefault();\n }\n \n file_frame = wp.media.frames.file_frame = wp.media({\n\t\ttitle: 'Select a image to upload',\n\t\tbutton: {\n text: 'Use this image'\n\t\t},\n\t\tmultiple: false\n });\n // When an image is selected, run a callback.\n file_frame.on('select', function () {\n attachment = file_frame.state().get('selection').first().toJSON();\n let imgSrc = attachment.url;\n let linkArr = imgSrc.split( ':' ),\n linkClean;\n if ( Array.isArray( linkArr ) && linkArr.length > 0 ) {\n linkClean = linkArr[linkArr.length - 1];\n }\n img.src = linkClean;\n img.height = attachment.height;\n img.width = attachment.width;\n img.style.width = '100%';\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n });\n // Finally, open the modal\n if (src == undefined) {\n file_frame.open();\n } else {\n img.src = src;\n }\n } else {\n DOMElement = DOMElementProt.cloneNode( true );\n \n DOMElement.getElementsByTagName( 'a' )[0].onclick = function(e) {\n e.preventDefault();\n };\n \n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\n kindIndexProt = wptbElementMutch[1];\n copy = true;\n };\n }\n \n this.kind = 'image';\n this.getDOMElement = function () {\n return DOMElement;\n };\n\tapplyGenericItemSettings( this, kindIndexProt, copy );\n\n\treturn this;\n};","var WPTB_Initializer = function () {\n\n const MIN_COLUMNS = 1,\n MIN_ROWS = 1,\n MAX_COLUMNS = 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 WPTB_Table(columns, rows);\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n\n};\n","var WPTB_LeftPanel = function () {\n\n var table = document.getElementsByClassName('wptb-preview-table')[0],\n wptbElementButtons = document.getElementsByClassName('wptb-element');\n \n function wptbTdBgColorSavedSet( inputId, trNumber ) {\n if ( trNumber > 3 ) return;\n if( table ) {\n let tableRows = table.getElementsByTagName('tr');\n if ( tableRows.length > trNumber ) {\n let trBackgroundColor = tableRows[trNumber].style.backgroundColor;\n var wptbEvenRowBg = document.getElementById(inputId);\n if ( wptbEvenRowBg && trBackgroundColor ) {\n wptbEvenRowBg.value = WPTB_Helper.rgbToHex( trBackgroundColor );\n }\n }\n }\n \n }\n \n wptbTdBgColorSavedSet( 'wptb-even-row-bg', 1 );\n jQuery('#wptb-even-row-bg').wpColorPicker({\n change: function ( event, ui ) {\n var tableRows = table.getElementsByTagName('tr');\n for ( let i = 1; i < tableRows.length; i += 2 ) {\n tableRows[i].style.backgroundColor = ui.color.toString();\n }\n console.log(event);\n console.log(this);\n WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving( event );\n },\n clear: function(){\n var tableRows = table.getElementsByTagName('tr');\n for ( let i = 1; i < tableRows.length; i += 2 ) {\n tableRows[i].style.backgroundColor = '';\n let tds = tableRows[i].getElementsByTagName('td');\n for ( let j = 0; j < tds.length; j++ ) {\n tds[j].style.backgroundColor = '';\n }\n }\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n },\n\n });\n \n wptbTdBgColorSavedSet( 'wptb-odd-row-bg', 2 );\n jQuery('#wptb-odd-row-bg').wpColorPicker({\n change: function ( event, ui ) {\n var tableRows = table.getElementsByTagName('tr');\n for ( let i = 2; i < tableRows.length; i += 2 ) {\n tableRows[i].style.backgroundColor = ui.color.toString();\n }\n \n WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving( event );\n },\n clear: function(){\n var tableRows = table.getElementsByTagName('tr');\n for ( let i = 2; i < tableRows.length; i += 2 ) {\n tableRows[i].style.backgroundColor = '';\n let tds = tableRows[i].getElementsByTagName( 'td' );\n for ( var j = 0; j < tds.length; j++ ) {\n tds[j].style.backgroundColor = '';\n }\n }\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n },\n });\n \n wptbTdBgColorSavedSet( 'wptb-table-header-bg', 0 );\n jQuery('#wptb-table-header-bg').wpColorPicker({\n change: function (event, ui) {\n var tableHeader = table.getElementsByTagName('tr')[0];\n tableHeader.style.backgroundColor = ui.color.toString();\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n },\n clear: function(){\n var tableHeader = table.getElementsByTagName('tr')[0];\n tableHeader.style.backgroundColor = '';\n let tds = tableHeader.getElementsByTagName('td');\n for (var j = 0; j < tds.length; j++) {\n tds[j].style.backgroundColor = '';\n }\n \n WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving( event );\n },\n });\n \n function tableAdaptiveForMobile( table ) {\n let wptbAdaptiveTableCheckbox = document.getElementById( 'wptb-adaptive-table-checkbox' );\n if( table && table.dataset.wptbAdaptiveTable && table.dataset.wptbAdaptiveTable == \"1\" ) {\n wptbAdaptiveTableCheckbox.checked = true;\n } else {\n wptbAdaptiveTableCheckbox.checked = false;\n }\n }\n tableAdaptiveForMobile( table );\n \n function tableTopRowAsHeadSavedSet( table ) {\n let wptbTopRowAsHeader = document.getElementById( 'wptb-top-row-as-header' );\n \n if( table && table.classList.contains( 'wptb-table-preview-head' ) ) {\n wptbTopRowAsHeader.checked = true;\n } else {\n wptbTopRowAsHeader.checked = false;\n }\n }\n tableTopRowAsHeadSavedSet( table );\n \n function tableBorderColorWidthSavedSet() {\n let table = document.getElementsByClassName('wptb-preview-table');\n if ( table.length > 0 ) {\n let tableBorderColor = table[0].style.borderColor;\n if ( tableBorderColor ) {\n let tableBorderColorInput = document.getElementById( 'wptb-table-border-color' );\n if ( tableBorderColorInput ) {\n tableBorderColorInput.value = WPTB_Helper.rgbToHex( tableBorderColor );\n }\n }\n \n let tableBorderWidth = table[0].style.borderWidth;\n if ( tableBorderWidth ) {\n let wptbTableBorderWidthSlider = document.getElementById('wptb-table-border-slider'),\n wptbTableBorderWidthNumber = document.getElementById('wptb-table-border-number');\n \n if ( wptbTableBorderWidthSlider ) {\n wptbTableBorderWidthSlider.value = parseInt( tableBorderWidth );\n }\n if ( wptbTableBorderWidthNumber ) {\n wptbTableBorderWidthNumber.value = parseInt( tableBorderWidth );\n }\n }\n \n \n let tableTd = table[0].querySelector( 'td' );\n let applyInnerBorder = tableTd.style.borderWidth;\n if ( applyInnerBorder ) {\n let innerBorderCheckInput = document.getElementById( 'wptb-inner-border-check' );\n let wptbApplyInnerBorder = document.getElementById( 'wptb-apply-inner-border' );\n if ( applyInnerBorder && parseInt( applyInnerBorder ) > 0 ) {\n if ( innerBorderCheckInput ) {\n innerBorderCheckInput.checked = true;\n \n if ( wptbApplyInnerBorder ) {\n wptbApplyInnerBorder.classList.add( 'visible' );\n let wptbTableInnerBorderSlider = document.getElementById( 'wptb-table-inner-border-slider' );\n let wptbTableInnerBorderNumber = document.getElementById( 'wptb-table-inner-border-number' );\n wptbTableInnerBorderSlider.value = parseInt( applyInnerBorder );\n wptbTableInnerBorderNumber.value = parseInt( applyInnerBorder );\n }\n }\n } else {\n innerBorderCheckInput.checked = false;\n }\n }\n \n if ( ( tableBorderWidth && parseInt( tableBorderWidth ) > 0 ) || ( applyInnerBorder && parseInt( applyInnerBorder ) > 0 ) ) {\n document.getElementById( 'wptb-table-border-color-set-area' ).style.display = '';\n }\n }\n }\n \n tableBorderColorWidthSavedSet();\n\n jQuery('#wptb-table-border-color').wpColorPicker({\n change: function (event, ui) {\n var tableCells = table.getElementsByTagName('td');\n table.style.border = document.querySelector('#wptb-table-border-number').value + 'px solid ' + ui.color.toString();\n\n for (var i = 0; i < tableCells.length; i++) {\n let tableInnerborderNumber = document.querySelector('#wptb-table-inner-border-number').value;\n if ( document.getElementById('wptb-inner-border-check').checked ) {\n tableCells[i].style.border = ( tableInnerborderNumber != 0 ? tableInnerborderNumber : 1 ) + 'px solid ' + ui.color.toString();\n }\n }\n WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving( event );\n },\n clear: function() {\n var tableCells = table.getElementsByTagName('td');\n table.style.borderColor = '';\n\n for (var i = 0; i < tableCells.length; i++) {\n tableCells[i].style.borderColor = '';\n }\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n });\n\n function addInnerBorderSize(value) {\n var tableCells = table.getElementsByTagName('td');\n for (var i = 0; i < tableCells.length; i++) {\n tableCells[i].style.borderWidth = document.querySelector('#wptb-table-inner-border-number').value + 'px';\n tableCells[i].style.borderStyle = 'solid';\n }\n }\n\n function addCellPadding(value) {\n var tableCells = table.getElementsByTagName('td');\n for (var i = 0; i < tableCells.length; i++) {\n tableCells[i].style.padding = value + 'px';\n }\n }\n\n function addInnerBorder( checked ) {\n var styles, color = document.querySelector('#wptb-table-border-color').value != undefined ?\n document.querySelector('#wptb-table-border-color').value : 'rgb(0,0,0)';\n if ( document.querySelector( '#wptb-table-inner-border-slider' ).value == 0 || document.querySelector( '#wptb-table-inner-border-number' ).value == 0 ) {\n document.querySelector( '#wptb-table-inner-border-slider' ).value = 1;\n document.querySelector( '#wptb-table-inner-border-number' ).value = 1;\n }\n let width = document.querySelector( '#wptb-table-inner-border-slider' ).value + 'px';\n let wptbPreviewTable = document.getElementsByClassName('wptb-preview-table');\n if( wptbPreviewTable.length > 0 ) {\n if (checked == 'checked') {\n document.getElementById('wptb-apply-inner-border').style.marginBottom = '0px';\n var tableCells = wptbPreviewTable[0].getElementsByTagName( 'td' );\n for (var i = 0; i < tableCells.length; i++) {\n tableCells[i].style.border = width + ' solid ' + color;\n }\n document.getElementById( 'wptb-apply-inner-border' ).classList.add( 'visible' );\n } else {\n document.getElementById( 'wptb-apply-inner-border' ).classList.remove( 'visible' );\n var tableCells = wptbPreviewTable[0].getElementsByTagName( 'td' );\n for (var i = 0; i < tableCells.length; i++) {\n tableCells[i].style.border = '0px solid ' + color;\n tableCells[i].style.border = null;\n }\n }\n }\n \n }\n\n function addBorderSize( value ) {\n table.style.borderWidth = value + 'px';\n table.style.borderStyle = 'solid';\n }\n \n function cellPaddingSavedSet() {\n let table = document.getElementsByClassName('wptb-preview-table');\n \n if ( table.length > 0 ) {\n let td = table[0].querySelector( 'td' );\n \n if ( td ) {\n let padding = td.style.padding;\n \n if ( padding ) {\n let wptbTableCellSlider = document.getElementById('wptb-table-cell-slider'),\n wptbTableCellNumber = document.getElementById('wptb-table-cell-number');\n \n if ( wptbTableCellSlider ) {\n wptbTableCellSlider.value = parseInt( padding );\n }\n if ( wptbTableCellNumber ) {\n wptbTableCellNumber.value = parseInt( padding );\n }\n }\n }\n }\n }\n \n cellPaddingSavedSet();\n \n let wptbTableBorderNumber = document.getElementById( 'wptb-table-border-number' );\n WPTB_Helper.numberImputSize( wptbTableBorderNumber, 1, 50 );\n \n let wptbTableInnerBorderNumber = document.getElementById( 'wptb-table-inner-border-number' );\n WPTB_Helper.numberImputSize( wptbTableInnerBorderNumber, 1, 50 );\n \n let wptbTableCellNumber = document.getElementById( 'wptb-table-cell-number' );\n WPTB_Helper.numberImputSize( wptbTableCellNumber, 1, 50 );\n \n let wptbTextfontSizeNumber = document.getElementById( 'wptb-size-number' );\n WPTB_Helper.numberImputSize( wptbTextfontSizeNumber, 1, 50 );\n \n let wptbImageWidthNumber = document.getElementById( 'wptb-size-number' );\n WPTB_Helper.numberImputSize( wptbImageWidthNumber, 2, 100 );\n \n let wptbTableColumnWidthNumber = document.getElementById( 'wptb-table-column-width-number' );\n WPTB_Helper.numberImputSize( wptbTableColumnWidthNumber, 2, 500 );\n \n let wptbTableRowHeightNumber = document.getElementById( 'wptb-table-row-height-number' );\n WPTB_Helper.numberImputSize( wptbTableRowHeightNumber, 2, 200 );\n \n \n \n document.getElementById('wptb-table-cell-slider').oninput = function () {\n document.getElementById('wptb-table-cell-number').value = this.value;\n addCellPadding(this.value);\n table.tdDefaultWidth();\n };\n \n document.getElementById('wptb-table-cell-slider').onchange = function() {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n\n document.getElementById('wptb-table-cell-number').onchange = function () {\n document.getElementById('wptb-table-cell-slider').value = this.value;\n addCellPadding(this.value);\n table.tdDefaultWidth();\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n document.getElementById('wptb-table-border-slider').oninput = function () {\n document.getElementById('wptb-table-border-number').value = this.value;\n addBorderSize(this.value);\n table.tdDefaultWidth();\n \n let wptbInnerBorderCheck = document.getElementById('wptb-inner-border-check').checked,\n tableBorderColorSetArea = document.getElementById( 'wptb-table-border-color-set-area' );\n if ( this.value == 0 && wptbInnerBorderCheck == false ) {\n tableBorderColorSetArea.style.display = 'none';\n } else {\n tableBorderColorSetArea.style.display = '';\n }\n };\n \n document.getElementById('wptb-table-border-slider').onchange = function() {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n\n document.getElementById('wptb-table-border-number').onchange = function () {\n document.getElementById('wptb-table-border-slider').value = this.value;\n addBorderSize(this.value);\n table.tdDefaultWidth();\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n document.getElementById('wptb-table-inner-border-slider').oninput = function () {\n document.getElementById('wptb-table-inner-border-number').value = this.value;\n addInnerBorderSize(this.value);\n table.tdDefaultWidth();\n };\n \n document.getElementById('wptb-table-inner-border-slider').onchange = function () {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n\n document.getElementById('wptb-table-inner-border-number').onchange = function () {\n document.getElementById('wptb-table-inner-border-slider').value = this.value;\n addInnerBorderSize(this.value);\n table.tdDefaultWidth();\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n document.getElementById('wptb-inner-border-check').onchange = function () {\n if( table ) {\n let val = this.checked ? 'checked' : 'unchecked';\n addInnerBorder( val );\n let borderWidth = document.getElementById('wptb-table-border-slider').value,\n tableBorderColorSetArea = document.getElementById( 'wptb-table-border-color-set-area' );\n if( val == 'unchecked' && borderWidth == 0 ) {\n tableBorderColorSetArea.style.display = 'none';\n } else {\n tableBorderColorSetArea.style.display = '';\n }\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n };\n \n document.getElementById( 'wptb-table-column-width-slider' ).oninput = function () {\n document.getElementById( 'wptb-table-column-width-number' ).value = this.value;\n table.addColumnWidth( this.value );\n };\n \n document.getElementById( 'wptb-table-column-width-slider' ).onchange = function () {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n \n document.getElementById( 'wptb-table-column-width-number' ).onchange = function () {\n document.getElementById( 'wptb-table-column-width-slider' ).value = this.value;\n table.addColumnWidth( this.value );\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n \n document.getElementById( 'wptb-table-column-width-auto-fixed' ).onchange = function () {\n if( this.checked ) {\n let highlighted = table.querySelector( '.wptb-highlighted' );\n let width = WPTB_Helper.getColumnWidth( table, highlighted );\n table.addColumnWidth( width );\n } else {\n table.addColumnWidth( false, true );\n let highlighted = table.querySelector( '.wptb-highlighted' );\n let width = WPTB_Helper.getColumnWidth( table, highlighted );\n document.getElementById( 'wptb-table-column-width-number' ).value = width;\n document.getElementById( 'wptb-table-column-width-slider' ).value = width;\n }\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n document.getElementById( 'wptb-table-row-height-slider' ).oninput = function () {\n document.getElementById( 'wptb-table-row-height-number' ).value = this.value;\n table.addRowHeight( this.value );\n };\n \n document.getElementById( 'wptb-table-row-height-slider' ).onchange = function () {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n document.getElementById( 'wptb-table-row-height-number' ).onchange = function () {\n document.getElementById( 'wptb-table-row-height-slider' ).value = this.value;\n table.addRowHeight( this.value );\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n \n document.getElementById( 'wptb-table-row-height-auto-fixed' ).onchange = function () {\n if( this.checked ) {\n let highlighted = table.querySelector( '.wptb-highlighted' );\n let height = WPTB_Helper.getRowHeight( table, highlighted );\n table.addRowHeight( height );\n } else {\n table.addRowHeight( false, true );\n let highlighted = table.querySelector( '.wptb-highlighted' );\n let height = WPTB_Helper.getRowHeight( table, highlighted );\n document.getElementById( 'wptb-table-row-height-number' ).value = height;\n document.getElementById( 'wptb-table-row-height-slider' ).value = height;\n }\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n \n document.getElementById( 'wptb-adaptive-table-checkbox' ).onchange = function() {\n if( this.checked ) {\n table.dataset.wptbAdaptiveTable = 1;\n } else {\n table.dataset.wptbAdaptiveTable = 0;\n }\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n \n function createMobileHeadForTable( table, thisEvent ) {\n \n if( thisEvent.checked ) {\n WPTB_Helper.dataTitleColumnSet( table );\n \n table.classList.add( 'wptb-table-preview-head' );\n table.rows[0].classList.add( 'wptb-table-head' );\n } else {\n let rows = table.rows;\n table.classList.remove( 'wptb-table-preview-head' );\n rows[0].classList.remove( 'wptb-table-head' );\n \n for ( let i = 1; i < rows.length; i++ ) {\n let thisRow = rows[i],\n thisRowChildren = thisRow.children;\n for( let j = 0; j < thisRowChildren.length; j++ ) {\n thisRowChildren[j].removeAttribute( 'data-wptb-title-column' );\n thisRowChildren[j].removeAttribute( 'data-wptb-title-column-font-size' );\n thisRowChildren[j].removeAttribute( 'data-wptb-title-column-color' );\n thisRowChildren[j].removeAttribute( 'data-wptb-title-background-color' );\n thisRowChildren[j].removeAttribute( 'data-wptb-title-align' );\n }\n }\n }\n }\n \n document.getElementById( 'wptb-top-row-as-header' ).onchange = function () {\n createMobileHeadForTable( table, this );\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n\n for (var i = 0; i < wptbElementButtons.length; i++) {\n wptbElementButtons[i].ondragstart = function (e) {\n e.dataTransfer.setData('wptbElement', this.dataset.wptbElement);\n e.dataTransfer.setData( 'wptbElIndic-' + this.dataset.wptbElement, 'wptbElIndic-' + this.dataset.wptbElement );\n }\n }\n \n if( table ) {\n document.getElementById('wptb-activate-cell-management-mode').onclick = table.toggleTableEditMode;\n document.getElementById( 'wptb-table-edit-mode-close' ).onclick = table.toggleTableEditMode;\n document.getElementById( 'wptb-left-scroll-panel-curtain-close' ).onclick = table.toggleTableEditMode;\n document.getElementById('wptb-add-end-row').onclick = table.addRowToTheEnd;\n document.getElementById('wptb-add-start-row').onclick = table.addRowToTheStart;\n document.getElementById('wptb-add-row-before').onclick = table.addRowBefore;\n document.getElementById('wptb-add-row-after').onclick = table.addRowAfter;\n document.getElementById('wptb-add-end-column').onclick = table.addColumnEnd;\n document.getElementById('wptb-add-start-column').onclick = table.addColumnStart;\n document.getElementById('wptb-add-column-before').onclick = table.addColumnBefore;\n document.getElementById('wptb-add-column-after').onclick = table.addColumnAfter;\n document.getElementById('wptb-delete-column').onclick = table.deleteColumn;\n document.getElementById('wptb-delete-row').onclick = table.deleteRow;\n document.getElementById('wptb-merge-cells').onclick = table.mergeCells;\n document.getElementById('wptb-split-cell').onclick = table.splitCell;\n }\n \n document.querySelector( '.wptb-left-panel-extend' ).onclick = function() {\n let wptbContainer = document.querySelector( '.wptb-container' );\n if( wptbContainer ) {\n if ( wptbContainer.classList.contains( 'collapsed' ) ) {\n wptbContainer.classList.remove( 'collapsed' );\n } else {\n wptbContainer.classList.add( 'collapsed' );\n }\n }\n };\n \n // this code hides the \"element parameters\" area \n // when clicked outside this element and its \"tinymce\" toolbar \n let wptbBuilderPanel = document.getElementsByClassName( 'wptb-builder-panel' )[0];\n wptbBuilderPanel.onclick = function( e ) {\n if( ! e.target.classList.contains( 'wptb-ph-element' ) && ! WPTB_Helper.findAncestor( e.target, 'wptb-ph-element' ) && \n ! e.target.classList.contains( 'wptb-fixed-toolbar' ) && ! WPTB_Helper.findAncestor( e.target, 'wptb-fixed-toolbar' ) ) {\n clickOnFreeSpace();\n } \n };\n \n let wptbHeader = document.getElementsByClassName( 'wptb-header' );\n if( wptbHeader.length > 0 ) wptbHeader = wptbHeader[0];\n wptbHeader.onclick = function() {\n clickOnFreeSpace();\n }\n \n function clickOnFreeSpace() {\n document.getElementsByClassName( 'wptb-elements-container' )[0].style.display = 'table';\n document.getElementsByClassName( 'wptb-settings-section' )[0].style.display = 'block';\n document.getElementById( 'element-options-group' ).style.display = 'none';\n let wpcdFixedToolbar = document.getElementById( 'wpcd_fixed_toolbar' );\n if( wpcdFixedToolbar.hasAttribute( 'data-toolbar-active-id' ) ) {\n document.getElementById( wpcdFixedToolbar.getAttribute( 'data-toolbar-active-id' ) ).classList.remove( 'toolbar-active' );\n }\n }\n document.querySelector('.wptb-panel-left').addEventListener('click', function (event) {\n if (event.target.classList.contains('wptb-exit-options')) {\n clickOnFreeSpace();\n }\n });\n \n};","var WPTB_List = function ( innerElements, DOMElementProt ) {\n\n var el_L = document.createElement('ul'), item,\n DOMElement = document.createElement('div'),\n kindIndexProt = undefined,\n copy = false;\n DOMElement.classList.add( 'wptb-list-item-container' );\n\n this.kind = 'list';\n\n if (innerElements === '') {\n //Case for edit mode list\n } else if ( !innerElements ) {\n for (var i = 0; i < 3; i++) {\n item = new WPTB_ListItem( '<p>List Item ' + (i + 1) + '</p>');\n el_L.appendChild(item.getDOMElement());\n }\n } else {\n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\n kindIndexProt = wptbElementMutch[1];\n copy = true;\n };\n \n for ( var i = 0; i < innerElements.length; i++ ) {\n let listItem = DOMElementProt.querySelector( 'li' );\n item = new WPTB_ListItem( innerElements[i], listItem, true );\n el_L.appendChild(item.getDOMElement());\n }\n }\n DOMElement.appendChild(el_L);\n //window.addElementOptions('list', elList);\n\n this.getDOMElement = function () {\n return DOMElement;\n }\n applyGenericItemSettings( this, kindIndexProt, copy );\n WPTB_Helper.listItemsRecalculateIndex( el_L );\n\n return this;\n};","var WPTB_ListItem = function ( text, DOMElementProt, copy ) {\n let wptbListItemReturn;\n if ( DOMElementProt == undefined || ( DOMElementProt && copy )) {\n if (text == undefined) text = 'New List Item';\n var DOMElement = document.createElement('li'),\n //divdot = document.createElement('div'),\n divcontent = document.createElement('div');\n //libullet = document.createElement('li');\n //divdot.classList.add('wptb-list-item-style-dot');\n divcontent.classList.add('wptb-list-item-content');\n //libullet.classList.add('wptb-bullet');\n if ( DOMElementProt ) {\n let styleDot = DOMElementProt.getAttribute( 'style' );\n if ( styleDot ) {\n DOMElement.setAttribute( 'style', styleDot );\n }\n }\n //DOMElement.appendChild(divdot);\n DOMElement.appendChild(divcontent);\n //divdot.appendChild(libullet);\n divcontent.innerHTML = text;\n divcontent.onkeyup = window.listItemKeyListener;\n \n wptbListItemReturn = true;\n } else {\n var DOMElement = DOMElementProt;\n var divcontent = DOMElement.getElementsByClassName( 'wptb-list-item-content' )[0];\n \n divcontent.onkeyup = window.listItemKeyListener;\n \n wptbListItemReturn = false;\n }\n \n DOMElement.onmouseenter = function ( event ) {\n let wptbActionsField = new WPTB_ActionsField();\n \n wptbActionsField.addActionField( 2, DOMElement );\n \n wptbActionsField.setParameters( DOMElement );\n console.log(DOMElement);\n };\n\n DOMElement.onmouseleave = function ( event ) {\n let wptbActionsField = new WPTB_ActionsField();\n \n wptbActionsField.leaveFromField( event, DOMElement, 2 );\n \n return false;\n };\n\n this.getDOMElement = function () {\n return DOMElement;\n };\n \n if ( wptbListItemReturn ) {\n return this;\n }\n};","var MultipleSelect = function () {\n\n\tvar selectedCells = [],\n\t\tmultipleCellMode = false;\n\n\tthis.activateMultipleSelectMode = function () {\n\t\tselectedCells = [];\n\t\tvar tds = document.getElementsByClassName('wptb-preview-table')[0].getElementsByTagName('td');\n\t\tfor (var i = 0; i < tds.length; i++) {\n\t\t\ttds[i].classList.remove('wptb-highlighted');\n\t\t}\n\t\tmultipleCellMode = true;\n\t}\n\n\tthis.deactivateMultipleSelectMode = function () {\n\t\tmultipleCellMode = false;\n\t}\n\n\tthis.isActivated = function () {\n\t\treturn multipleCellMode;\n\t}\n\n\tthis.pushSelectedCell = function (cell) {\n\t\tif (!multipleCellMode) {\n\t\t\treturn;\n\t\t}\n\t\tselectedCells.push(cell);\n\t\tcell.classList.add('wptb-highlighted');\n\t};\n\n\tthis.selectedCells = function () {\n\t\treturn selectedCells;\n\t}\n\n\tthis.flushSelectedCells = function () {\n\t\tselectedCells = [];\n\t}\n\n\tthis.getFirst = function () {\n\t\tvar minXIndex = 1000, minYIndex = 1000, first;\n\t\tfor (var i = selectedCells.length - 1; i >= 0; i--) {\n\t\t\tif (minXIndex >= selectedCells[i].dataset.xIndex\n\t\t\t\t&& minYIndex >= selectedCells[i].dataset.yIndex) {\n\t\t\t\tfirst = selectedCells[i];\n\t\t\t\tminXIndex = selectedCells[i].dataset.xIndex;\n\t\t\t\tminYIndex = selectedCells[i].dataset.yIndex;\n\t\t\t}\n\t\t}\n\t\treturn first;\n\t}\n\n\tthis.getLast = function () {\n\t\tvar maxXIndex = -1, maxYIndex = -1, last;\n\t\tfor (var i = selectedCells.length - 1; i >= 0; i--) {\n\t\t\tif (maxXIndex <= selectedCells[i].dataset.xIndex\n\t\t\t\t&& maxYIndex <= selectedCells[i].dataset.yIndex) {\n\t\t\t\tlast = selectedCells[i];\n\t\t\t\tmaxXIndex = selectedCells[i].dataset.xIndex;\n\t\t\t\tmaxYIndex = selectedCells[i].dataset.yIndex;\n\t\t\t}\n\t\t}\n\t\treturn last;\n\t}\n\n\tthis.removeAllButFirst = function () {\n\t\tvar td = this.getFirst();\n\t\tfor (var i = 1; i < selectedCells.length; i++) {\n\t\t\tselectedCells[i].classList.add('wptb-fused-cell-' + td.dataset.xIndex + '-' + td.dataset.yIndex);\n\t\t}\n\t}\n\n\treturn this;\n\n};","var WPTB_Parser = function (code) {\n let div = document.createElement( 'div' );\n div.innerHTML = code;\n \n let table = div.children[0];\n let columnTitleMobile = [...table.querySelectorAll( '.wptb-column-title-mobile-container' )];\n \n for( let i = 0; i < columnTitleMobile.length; i++ ) {\n let parent = columnTitleMobile[i].parentNode;\n parent.removeChild( columnTitleMobile[i] );\n }\n \n let tds = table.querySelectorAll( 'td' );\n for ( let i = 0; i < tds.length; i++ ) {\n tds[i].classList.add( 'wptb-droppable' );\n tds[i].classList.remove( 'wptb-column-title-mobile-not-elements' );\n }\n \n return table;\n}","var WPTB_Parser2 = function (code) {\n if( Array.isArray( code ) ) {\n let elementHtml;\n \n if ( code.length == 1) {\n return elementHtml.appendChild( document.createTextNode( code[0] ) );\n }\n if( 0 in code ) {\n let tagName = code[0];\n elementHtml = document.createElement( tagName );\n \n if ( 1 in code ) {\n if( Array.isArray( code[1] ) ) {\n let attributes = code[1];\n \n for( let i = 0; i < attributes.length; i++ ) {\n if( Array.isArray( attributes[i] ) ) {\n elementHtml.setAttribute(attributes[i][0], attributes[i][1]);\n }\n }\n }\n }\n \n if ( 2 in code ) {\n if ( Array.isArray( code[2] ) ) {\n for ( let i = 0; i < code[2].length; i++ ) {\n if ( typeof code[2][i] === 'string' && tagName.toLowerCase() == 'p' ) {\n elementHtml.appendChild( document.createTextNode( code[2][i] ) );\n continue;\n }\n if ( ! WPTB_Parser( code[2][i] ) ) continue;\n elementHtml.appendChild( WPTB_Parser( code[2][i] ) );\n }\n } else if( typeof code[2] === 'string' ) {\n elementHtml.appendChild( document.createTextNode( code[2] ) );\n }\n \n }\n }\n \n return elementHtml;\n } else {\n return false;\n }\n \n}","var WPTB_Settings = function () {\n var elems = document.getElementsByClassName('wptb-element');\n\n for ( var i = 0; i < elems.length; i++ ) {\n elems[i].ondragstart = function ( event ) {\n event.dataTransfer.effectAllowed = 'move';\n event.dataTransfer.setData( 'wptbElement', event.target.dataset.wptbElement );\n event.dataTransfer.setData( 'wptbElIndic-' + event.target.dataset.wptbElement, 'wptbElIndic-' + event.target.dataset.wptbElement );\n }\n elems[i].ondragend = function () {\n let wptbDropHandle = document.querySelector( '.wptb-drop-handle' ),\n wptbDropBorderMarker = document.querySelector( '.wptb-drop-border-marker' );\n if ( wptbDropHandle || wptbDropBorderMarker ) {\n wptbDropHandle.style.display = 'none';\n wptbDropBorderMarker.style.display = 'none';\n }\n }\n };\n \n let 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 WPTB_Table();\n }\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 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 ( e ) {\n if( this.classList.contains( 'wptb-button-disable' ) ) {\n e.preventDefault();\n }\n }\n\n document.getElementsByClassName( 'wptb-save-btn' )[0].onclick = function ( event ) {\n if( ( ! event.target.dataset.wptbTableStateNumberSave && window.wptbTableStateNumberShow == 0 ) || \n window.wptbTableStateNumberShow == event.target.dataset.wptbTableStateNumberSave ) {\n return;\n }\n let bar = document.querySelector( '.wptb-edit-bar' );\n if ( bar && bar.classList.contains( 'visible' ) ) {\n let table = document.getElementsByClassName( 'wptb-preview-table' )[0];\n table.toggleTableEditMode();\n }\n\n let http = new XMLHttpRequest(),\n url = ( wptb_admin_object ? wptb_admin_object.ajaxurl : ajaxurl ) + \"?action=save_table\",\n t = document.getElementById( 'wptb-setup-name' ).value.trim(),\n messagingArea,\n code = document.getElementsByClassName( 'wptb-preview-table' );\n if( code.length > 0 ) {\n code = WPTB_Stringifier( code[0] );\n code = code.outerHTML;\n } else { \n code = '';\n }\n \n if ( t === '' || code === '' ) {\n let messagingAreaText = '';\n if( t === '' ) messagingAreaText += 'You must assign a name to the table before saving it.</br>';\n if( code === '' ) messagingAreaText += 'Table wasn\\'t created';\n messagingArea = document.getElementById( 'wptb-messaging-area' );\n messagingArea.innerHTML = '<div class=\"wptb-error wptb-message\">Error: ' + messagingAreaText + '</div>';\n messagingArea.classList.add( 'wptb-warning' );\n setTimeout(function () {\n messagingArea.removeChild( messagingArea.firstChild );\n }, 4000 );\n return;\n }\n\n let params = {\n title: t,\n content: code,\n security_code: wptb_admin_object.security_code\n };\n if (( rs = WPTB_Helper.detectMode() ) || ( rs = document.wptbId )) {\n params.id = rs;\n }\n params = JSON.stringify( params );\n\n http.open('POST', url, true);\n http.setRequestHeader( 'Content-type', 'application/json; charset=utf-8' );\n\n http.onreadystatechange = function (action) {\n if ( this.readyState == 4 && this.status == 200 ) {\n var data = JSON.parse( http.responseText );\n messagingArea = document.getElementById( 'wptb-messaging-area' );\n\n if ( data[0] == 'saved' ) {\n document.wptbId = data[1];\n messagingArea.innerHTML = '<div class=\"wptb-success wptb-message\">Table \"' + t + '\" was successfully saved.</div>';\n document.getElementsByClassName( 'wptb-embed-btn' )[0].classList.remove( 'wptb-button-disable' );\n document.getElementById( 'wptb-embed-shortcode' ).value = '[wptb id=' + data[1] + ']';\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 } 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 }\n } else {\n messagingArea.innerHTML = '<div class=\"wptb-error wptb-message\">Safety problems</div>';\n }\n messagingArea.classList.add( 'wptb-success' );\n setTimeout( function () {\n messagingArea.removeChild( messagingArea.firstChild );\n }, 4000 );\n }\n }\n http.send( params );\n }\n};\n","var WPTB_Space = function ( elSpaceBetween ) {\n\n function newElementProxy(el) {\n if (el.includes('list')) {\n return new WPTB_List();\n } else if (el.includes('image')) {\n return new WPTB_Image();\n } else if (el.includes('text')) {\n return new WPTB_Text();\n } else if (el.includes('button')) {\n return new WPTB_Button();\n }\n }\n let spaceBetween;\n if ( ! elSpaceBetween ) {\n spaceBetween = document.createElement('div'), spaceBetween.classList.add('wptb-space-between');\n } else {\n spaceBetween = elSpaceBetween;\n }\n\n spaceBetween.ondragenter = function () {\n this.classList.add('visible');\n };\n spaceBetween.ondragover = function (event) {\n event.preventDefault();\n };\n\n spaceBetween.ondragleave = function () {\n this.classList.remove('visible');\n };\n\n spaceBetween.ondrop = function (event) {\n event.stopPropagation();\n\n var p = event.target.nextSibling,\n td = event.target,\n element, t_space, spaceParent;\n\n while ( !td.classList.contains('wptb-droppable') ) {\n td = td.parentNode;\n }\n\n if (event.dataTransfer.getData('wptbElement')) {\n element = newElementProxy(event.dataTransfer.getData('wptbElement'));\n this.classList.remove('visible');\n\n if (p == null) {\n td.appendChild(element.getDOMElement());\n td.appendChild(new WPTB_Space());\n } else {\n td.insertBefore(element.getDOMElement(), p);\n td.insertBefore(new WPTB_Space(), p);\n }\n\n } else {\n alert(event.dataTransfer.getData('node'));\n element = document.getElementsByClassName(event.dataTransfer.getData('node'))[0];\n t_space = element.nextSibling;\n spaceParent = element.parentNode;\n if (t_space != undefined) {\n spaceParent.removeChild(t_space);\n }\n\n if (p == null) {\n td.appendChild(element);\n td.appendChild(new WPTB_Space());\n } else {\n td.insertBefore(element, p);\n td.insertBefore(new WPTB_Space(), p);\n }\n\n }\n this.classList.remove('visible');\n };\n \n if ( ! elSpaceBetween ) {\n return spaceBetween;\n }\n};","var WPTB_StarRating = function ( DOMElementProt, countStarts ) {\n if( ! countStarts ) {\n if( ! DOMElementProt ) {\n countStarts = 5;\n } else {\n countStarts = DOMElementProt.querySelectorAll( 'li' ).length;\n }\n }\n \n let DOMElement = document.createElement('div'),\n ratingStarsBox = document.createElement( 'div' ),\n ratingStarsList = document.createElement( 'ul' ),\n successBox = document.createElement( 'div' ),\n textMessage = document.createElement( 'div' ),\n kindIndexProt = undefined,\n copy = false;\n \n DOMElement.classList.add( 'wptb-star_rating-container' );\n ratingStarsBox.classList.add( 'wptb-rating-stars-box' );\n ratingStarsList.classList.add( 'wptb-rating-stars-list' );\n successBox.classList.add( 'wptb-success-box' );\n successBox.style.display = 'none';\n textMessage.classList.add( 'wptb-text-message' );\n textMessage.style.fontSize = '25px';\n \n let filledRatingStarHtml = '<svg version=\"1.1\" id=\"Capa_1\" xmlns=\"http://www.w3.org/2000/svg\" \\n\\\n xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\" width=\"20px\" style=\"width: 20px;\" viewBox=\"0 0 426.667 426.667\" \\n\\\n style=\"enable-background:new 0 0 426.667 426.667;\" xml:space=\"preserve\">\\n\\\n <polygon points=\"426.667,165.12 273.28,152.107 213.333,10.667 153.387,152.107 0,165.12 \\n\\\n 116.48,266.027 81.493,416 213.333,336.427 345.173,416 310.187,266.027\"/></svg>';\n \n let notFilledRatingStarHtml = '<svg version=\"1.1\" id=\"Capa_1\" xmlns=\"http://www.w3.org/2000/svg\" \\n\\\n xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\" width=\"20px\" style=\"width: 20px;\" viewBox=\"0 0 426.667 426.667\" \\n\\\n style=\"enable-background:new 0 0 426.667 426.667;\" xml:space=\"preserve\">\\n\\\n <path d=\"M426.667,165.12L273.28,151.893L213.333,10.667l-59.947,141.44L0,165.12l116.48,100.907L81.493,416l131.84-79.573\\n\\\n L345.173,416L310.4,266.027L426.667,165.12z M213.333,296.533L133.12,344.96l21.333-91.307l-70.827-61.44l93.44-8.107 \\n\\\n l36.267-85.973l36.48,86.187l93.44,8.107l-70.827,61.44l21.333,91.307L213.333,296.533z\"/></svg>';\n \n let halfFilledRatingStarHtml = '<svg version=\"1.1\" id=\"Capa_1\" xmlns=\"http://www.w3.org/2000/svg\" \\n\\\n xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\" width=\"20px\" style=\"width: 20px;\" viewBox=\"0 0 426.667 426.667\" \\n\\\n style=\"enable-background:new 0 0 426.667 426.667;\" xml:space=\"preserve\">\\n\\\n <path d=\"M426.667,165.12L273.28,151.893L213.333,10.667l-59.947,141.44L0,165.12l116.48,100.907L81.493,416l131.84-79.573 \\n\\\n L345.173,416L310.4,266.027L426.667,165.12z M213.333,296.533v-198.4l36.48,86.187l93.44,8.107l-70.827,61.44l21.333,91.307 \\n\\\n L213.333,296.533z\"/></svg>';\n \n \n for( let i = 0; i < countStarts; i++ ) {\n let ratingStar = document.createElement( 'li' );\n ratingStar.classList.add( 'wptb-rating-star' );\n ratingStar.style.width = '20px';\n let ratingStarZeroSet = '';\n if( i == 0 ) {\n ratingStarZeroSet = '<span class=\"wptb-rating-star-zero-set\"></span>';\n }\n \n ratingStar.innerHTML = '<span class=\"wptb-rating-star-left-signal-part\">' + ratingStarZeroSet + '</span><span class=\"wptb-filled-rating-star\">' + filledRatingStarHtml + '</span>'\n + '<span class=\"wptb-not-filled-rating-star\">' + notFilledRatingStarHtml + '</span>'\n + '<span class=\"wptb-half-filled-rating-star\">' + halfFilledRatingStarHtml + '</span><span class=\"wptb-rating-star-right-signal-part\"></span>';\n ratingStar.dataset.value = i + 1;\n ratingStarsList.appendChild( ratingStar );\n }\n\n successBox.appendChild( textMessage );\n ratingStarsBox.appendChild( ratingStarsList );\n ratingStarsBox.appendChild( successBox );\n DOMElement.appendChild( ratingStarsBox );\n \n \n\n \n // Creation of a new star rating when copying to avoid errors when assigning new event handlers.\n if ( DOMElementProt ) {\n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\n kindIndexProt = wptbElementMutch[1];\n copy = true;\n };\n \n var wptbRatingStarsBox = DOMElementProt.querySelector( '.wptb-rating-stars-box' );\n if ( wptbRatingStarsBox ) {\n var wptbRatingStarsBoxAttributes = [...wptbRatingStarsBox.attributes];\n if ( wptbRatingStarsBoxAttributes.length > 0 ) {\n for( let i = 0; i < wptbRatingStarsBoxAttributes.length; i++ ) {\n if ( wptbRatingStarsBoxAttributes[i].name == 'style') {\n ratingStarsBox.setAttribute( wptbRatingStarsBoxAttributes[i].name, wptbRatingStarsBoxAttributes[i].value );\n }\n } \n }\n }\n \n let wptbRatingStarsOld = wptbRatingStarsBox.querySelectorAll( 'li' );\n let wptbRatingStars = ratingStarsList.querySelectorAll( 'li' );\n if ( wptbRatingStarsOld.length > 0 && wptbRatingStars.length > 0 ) {\n let iMax = wptbRatingStarsOld.length < countStarts ? wptbRatingStarsOld.length : countStarts;\n for( let i = 0; i < wptbRatingStarsOld.length; i++ ) {\n let wptbRatingStarsAttributes = [...wptbRatingStarsOld[i].attributes];\n if ( wptbRatingStarsAttributes.length > 0 ) {\n for( let j = 0; j < wptbRatingStarsAttributes.length; j++ ) {\n wptbRatingStars[i].setAttribute( wptbRatingStarsAttributes[j].name, wptbRatingStarsAttributes[j].value );\n } \n }\n \n let wptbRatingStarsOldSpan = wptbRatingStarsOld[i].children;\n let wptbRatingStarsSpan = wptbRatingStars[i].children;\n for( let k = 0; k < wptbRatingStarsOldSpan.length; k++ ){\n let wptbRatingStarsOldSpanAttributes = [...wptbRatingStarsOldSpan[k].attributes];\n if( wptbRatingStarsOldSpanAttributes.length > 0 ) {\n for ( let l = 0; l < wptbRatingStarsOldSpanAttributes.length; l++ ) {\n wptbRatingStarsSpan[k].setAttribute( wptbRatingStarsOldSpanAttributes[l].name, wptbRatingStarsOldSpanAttributes[l].value );\n let wptbRatingStarsOldSvg = wptbRatingStarsOldSpan[k].querySelector( 'svg' );\n if( wptbRatingStarsOldSvg ) {\n let wptbRatingStarsOldSvgStyle = wptbRatingStarsOldSvg.getAttribute( 'style' );\n wptbRatingStarsSpan[k].querySelector( 'svg' ).setAttribute( 'style', wptbRatingStarsOldSvgStyle );\n }\n }\n }\n }\n }\n }\n \n var wptbSuccessBox = wptbRatingStarsBox.querySelector( '.wptb-success-box' );\n if ( wptbSuccessBox ) {\n var wptbSuccessBoxAttributes = [...wptbSuccessBox.attributes];\n for( let i = 0; i < wptbSuccessBoxAttributes.length; i++ ) {\n if ( wptbSuccessBoxAttributes[i].name == 'style') {\n successBox.setAttribute( wptbSuccessBoxAttributes[i].name, wptbSuccessBoxAttributes[i].value );\n }\n } \n }\n \n var wptbTextMessage = wptbSuccessBox.querySelector( '.wptb-text-message' );\n if ( wptbTextMessage ) {\n textMessage.innerHTML = wptbTextMessage.innerHTML;\n var wptbTextMessageAttributes = [...wptbTextMessage.attributes];\n for( let i = 0; i < wptbTextMessageAttributes.length; i++ ) {\n if ( wptbTextMessageAttributes[i].name == 'style') {\n textMessage.setAttribute( wptbTextMessageAttributes[i].name, wptbTextMessageAttributes[i].value );\n }\n } \n }\n }\n \n this.kind = 'star_rating';\n\n this.getDOMElement = function () {\n return DOMElement;\n };\n\n applyGenericItemSettings( this, kindIndexProt, copy );\n \n return this;\n}","var WPTB_Stringifier = function ( codeMain ) {\n if ( codeMain ) {\n let code = codeMain.cloneNode( true );\n code.classList.add( 'wptb-table-preview-static-indic' );\n code.dataset.tableColumns = codeMain.columns;\n code.style.width = null;\n code.style.minWidth = null;\n code.style.maxWidth = null;\n \n let tds = code.getElementsByTagName( 'td' );\n if ( tds.length > 0 ) {\n for ( let i = 0; i < tds.length; i++ ) {\n \n if ( codeMain.querySelector( 'wptb-table-preview-head' ) ) {\n tds[i].removeAttribute( 'data-x-index' );\n }\n tds[i].removeAttribute( 'data-y-index' );\n tds[i].removeAttribute( 'draggable' );\n tds[i].classList.remove( 'wptb-droppable' );\n let innerElements = tds[i].getElementsByClassName( 'wptb-ph-element' );\n \n if ( innerElements.length > 0 ) {\n for ( let j = 0; j < innerElements.length; j++ ) {\n \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 }\n \n if( tds[i].hasAttribute( 'data-wptb-title-column' ) ) {\n let columnNameDivContainer = document.createElement( 'div' ),\n columnNameDiv = document.createElement( 'div' );\n columnNameDivContainer.classList.add( 'wptb-column-title-mobile-container' );\n columnNameDiv.classList.add( 'wptb-column-title-mobile' );\n columnNameDiv.dataset.wptbTitleColumn = tds[i].dataset.wptbTitleColumn;\n columnNameDiv.setAttribute( 'style', 'font-size:' + tds[i].dataset.wptbTitleColumnFontSize + '; \\n\\\n color:' + tds[i].dataset.wptbTitleColumnColor + '; background-color:' + tds[i].dataset.wptbTitleBackgroundColor + '; text-align:' + tds[i].dataset.wptbTitleAlign + ';' );\n columnNameDiv.style.padding = tds[i].style.padding;\n if( tds[i].children.length == 0 ) {\n tds[i].classList.add( 'wptb-column-title-mobile-not-elements' );\n }\n columnNameDivContainer.appendChild( columnNameDiv );\n tds[i].insertBefore( columnNameDivContainer, tds[i].firstChild );\n }\n }\n }\n \n return code;\n }\n}","var WPTB_Stringifier2 = function ( node, start = false ) {\n\n\tif ( node == undefined ) {\n\t\treturn '';\n\t} else if ( node.tagName == undefined && node.nodeType == 3 ) {\n return node.nodeValue;\n }\n \n let code = [],\n children,\n int_elem_arr = false,\n attributes = [...node.attributes],\n attributes_list = [],\n internal_elements = [];\n if ( ( node.parentNode.classList.contains( 'wptb-list-item-content' ) || \n node.parentNode.classList.contains( 'mce-content-body' ) ) && \n node.tagName.toLowerCase() == 'p' ) {\n children = node.childNodes;\n int_elem_arr = true;\n } else if( node.children.length > 0 ) {\n children = node.children;\n } else {\n children = node.childNodes;\n }\n if ( attributes.length > 0 ) {\n for ( let i = 0; i < attributes.length; i++ ) {\n attributes_list[i] = [attributes[i].name, attributes[i].value];\n }\n } else {\n attributes_list = '';\n }\n \n if ( children.length > 0 ) {\n for ( let i = 0; i < children.length; i++) {\n let inter_elem = WPTB_Stringifier(children[i]);\n \n if ( Array.isArray( inter_elem ) || int_elem_arr ) {\n internal_elements[i] = inter_elem;\n } else if ( typeof inter_elem === 'string' && inter_elem ) {\n internal_elements = inter_elem;\n }\n }\n } else {\n internal_elements = '';\n }\n \n \n code.push(node.tagName.toLowerCase(), attributes_list , internal_elements);\n \n return code;\n}","var array = [], WPTB_Table = function (columns, rows) {\n\n /* The members of the class */\n var settings = document.getElementsByClassName('wptb-settings-items'),\n wptbTableSetup = document.getElementsByClassName(\"wptb-table-setup\")[0],\n table, row, cell,\n maxAmountOfCells,\n maxAmountOfRows;\n\n //HERE ARE THE PRIVATE FUNCTIONS\n /*\n * This function toggles buttons visibility in cell edit mode\n * (according to the amount of currently selected cells), and\n * highlights visually the clicked cell if it is not highlighted, or\n * removes highlight if clicked cell is already highlighted. \n * It too toggles the bits of our abstract representation.\n * @param Event this is the event instance of the click performed over a cell.\n */\n var mark = function ( event ) {\n var rs = this.rowSpan,\n cs = this.colSpan,\n markedCells,\n noCells = document.getElementsByClassName('wptb-no-cell-action'),\n singleCells = document.getElementsByClassName('wptb-single-action'),\n multipleCells = document.getElementsByClassName('wptb-multiple-select-action'),\n cellSettings = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ),\n position = getCoords(this),\n row = position[0],\n column = position[1];\n if ( ! document.select.isActivated() ) {\n return;\n }\n if (this.className.match(/wptb-highlighted/)) {\n this.classList.remove('wptb-highlighted');\n for (var i = 0; i < rs; i++) {\n for (var j = 0; j < cs; j++) {\n array[row + i][column + j] = 0;\n }\n }\n } else {\n this.classList.add('wptb-highlighted');\n for (var i = 0; i < rs; i++) {\n for (var j = 0; j < cs; j++) {\n array[row + i][column + j] = 1;\n }\n }\n }\n\n markedCells = document.getElementsByClassName('wptb-highlighted').length;\n if (markedCells === 0) {\n for (var i = 0; i < multipleCells.length; i++) {\n multipleCells[i].classList.remove('visible');\n multipleCells[i].setAttribute('disabled', 'disabled');\n }\n for (var i = 0; i < noCells.length; i++) {\n noCells[i].classList.add('visible');\n noCells[i].removeAttribute('disabled');\n }\n for (var i = 0; i < singleCells.length; i++) {\n singleCells[i].classList.remove('visible');\n singleCells[i].setAttribute('disabled', 'disabled');\n }\n cellSettings.classList.remove( 'visible' );\n } else if (markedCells === 1) {\n for (var i = 0; i < multipleCells.length; i++) {\n multipleCells[i].classList.remove('visible');\n multipleCells[i].setAttribute('disabled', 'disabled');\n }\n for (var i = 0; i < noCells.length; i++) {\n noCells[i].classList.remove('visible');\n noCells[i].setAttribute('disabled', 'disabled');\n }\n for (var i = 0; i < singleCells.length; i++) {\n singleCells[i].classList.add('visible');\n singleCells[i].removeAttribute('disabled');\n }\n let cellHighlighted = document.querySelector( '.wptb-highlighted' );\n if( cellHighlighted ) {\n let wptbTableColumnWidthSlider = document.getElementById( 'wptb-table-column-width-slider' );\n let wptbTableColumnWidthNumber = document.getElementById( 'wptb-table-column-width-number' );\n let tableColumnWidthAutoFixedCheckbox = document.getElementById( 'wptb-table-column-width-auto-fixed' );\n let width = cellHighlighted.style.width;\n if( width ) {\n wptbTableColumnWidthSlider.value = parseFloat( width, 10 );\n wptbTableColumnWidthNumber.value = parseFloat( width, 10 );\n tableColumnWidthAutoFixedCheckbox.checked = true;\n } else if( cellHighlighted.dataset.wptbFixedWidth ) {\n wptbTableColumnWidthSlider.value = cellHighlighted.dataset.wptbFixedWidth;\n wptbTableColumnWidthNumber.value = cellHighlighted.dataset.wptbFixedWidth;\n tableColumnWidthAutoFixedCheckbox.checked = true;\n } else {\n let cellWidth = WPTB_Helper.getColumnWidth( table, cellHighlighted );\n wptbTableColumnWidthSlider.value = cellWidth;\n wptbTableColumnWidthNumber.value = cellWidth;\n tableColumnWidthAutoFixedCheckbox.checked = false;\n }\n \n \n let wptbTableRowHeightSlider = document.getElementById( 'wptb-table-row-height-slider' );\n let wptbTableRowHeightNumber = document.getElementById( 'wptb-table-row-height-number' );\n let tableRowHeightAutoFixedCheckbox = document.getElementById( 'wptb-table-row-height-auto-fixed' );\n let height = cellHighlighted.style.height;\n if( height ) {\n wptbTableRowHeightSlider.value = parseFloat( height, 10 );\n wptbTableRowHeightNumber.value = parseFloat( height, 10 );\n tableRowHeightAutoFixedCheckbox.checked = true;\n } else if( cellHighlighted.dataset.wptbFixedHeight ) {\n wptbTableRowHeightSlider.value = cellHighlighted.dataset.wptbFixedHeight;\n wptbTableRowHeightNumber.value = cellHighlighted.dataset.wptbFixedHeight;\n tableRowHeightAutoFixedCheckbox.checked = true;\n } else {\n let cellHeight = WPTB_Helper.getRowHeight( table, cellHighlighted );\n wptbTableRowHeightSlider.value = cellHeight;\n wptbTableRowHeightNumber.value = cellHeight;\n tableRowHeightAutoFixedCheckbox.checked = false;\n }\n }\n cellSettings.classList.add( 'visible' );\n } else {\n for (var i = 0; i < multipleCells.length; i++) {\n if (table.isSquare(array)) {\n multipleCells[i].classList.add('visible');\n multipleCells[i].removeAttribute('disabled');\n } else {\n multipleCells[i].classList.remove('visible');\n multipleCells[i].setAttribute('disabled', 'disabled');\n }\n }\n for (var i = 0; i < noCells.length; i++) {\n noCells[i].classList.remove('visible');\n noCells[i].setAttribute('disabled', 'disabled');\n }\n for (var i = 0; i < singleCells.length; i++) {\n singleCells[i].classList.remove('visible');\n singleCells[i].setAttribute('disabled', 'disabled');\n }\n cellSettings.classList.remove( 'visible' );\n }\n };\n\n /* \n * This function fills an array with 1's according to the actual design\n * of HTML table.\n * @returns an array of arrays containing an abstract representation\n * of HTML table.\n * @deprecated\n * */\n\n var realTimeArray = function () {\n var carried = [], tds, cols, matriz = [];\n\n for (var i = 0; i < maxAmountOfCells; i++) {\n carried[i] = 0;\n }\n\n for (var i = 0; i < table.rows.length; i++) {\n cols = [];\n\n var tds = table.rows[i].getElementsByTagName('td');\n\n for (items = 0; items < tds.length; items++) {\n\n for (var k = 0; k < tds[items].colSpan; k++) {\n cols.push(1);\n }\n\n if (tds[items].rowSpan > 1) {\n for (var k = 0; k < tds[items].colSpan; k++) {\n carried[items + k] = {\n justAssigned: true,\n amount: tds[items].rowSpan\n };\n }\n }\n }\n\n for (var k = 0; k < maxAmountOfCells; k++) {\n if (typeof carried[k] == 'object' && carried[k].amount > 0) {\n carried[k].amount--;\n if (carried[k].justAssigned) {\n carried[k].justAssigned = false;\n } else {\n cols.push(1);\n }\n }\n }\n\n matriz.push(cols);\n\n }\n return matriz;\n };\n\n /*\n * This function gets the number and position of cell spaces in current row that are occuped \n * by upper rowspanned cells.\n * @param number the number of row where we wish to calculate the carried rowspans up to.\n * @return an array with the remaining rowspans in each column.\n */\n var carriedRowspans = function (row) {\n var carried = [], tds, cols;\n\n for (var i = 0; i < maxAmountOfCells; i++) {\n carried[i] = 0;\n }\n\n if (row == -1) {\n return carried;\n }\n\n for (var i = 0; i <= row; i++) {\n cellsBuffer = table.rows[i].getElementsByTagName('td');\n cellPointer = 0;\n\n for (var xPosition = 0; xPosition < maxAmountOfCells; xPosition += stepsToMove) {\n stepsToMove = 1;\n\n if (carried[xPosition]) {\n carried[xPosition]--;\n } else {\n celda = cellsBuffer[cellPointer++];\n if (celda.rowSpan > 1) {\n for (k = 0; k < celda.colSpan; k++) {\n carried[xPosition + k] = celda.rowSpan - 1;\n }\n stepsToMove = celda.colSpan;\n } else if (celda.colSpan > 1) {\n stepsToMove = celda.colSpan;\n }\n }\n }\n\n }\n return carried;\n };\n\n /*\n * A helpful function for showing\n * the abstract table in console.\n * @param Array our abstract table.\n */\n var drawTable = function (a) {\n var string = 'DRAWING TABLE:\\n';\n for (var i = 0; i < a.length; i++) {\n\n for (var j = 0; j < a[i].length; j++) {\n string += ' ' + a[i][j];\n }\n string += '\\n';\n }\n table.isSquare(a);\n };\n\n /*\n * It resets all the bits of our abstract representation\n * to 0 and removes the highlighting class of all cells.\n */\n\n var undoSelect = function () {\n var noCells = document.getElementsByClassName('wptb-no-cell-action'),\n singleCells = document.getElementsByClassName('wptb-single-action'),\n multipleCells = document.getElementsByClassName('wptb-multiple-select-action'),\n cellSettings = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ),\n tds = table.getElementsByClassName('wptb-highlighted');\n while (tds.length) {\n tds[0].classList.remove('wptb-highlighted');\n }\n cellSettings.classList.remove( 'visible' );\n for (var i = 0; i < array.length; i++) {\n for (var j = 0; j < array[i].length; j++) {\n array[i][j] = 0;\n }\n }\n for (var i = 0; i < multipleCells.length; i++) {\n multipleCells[i].classList.remove('visible');\n multipleCells[i].setAttribute('disabled', 'disabled');\n }\n for (var i = 0; i < noCells.length; i++) {\n noCells[i].classList.add('visible');\n noCells[i].removeAttribute('disabled');\n }\n for (var i = 0; i < singleCells.length; i++) {\n singleCells[i].classList.remove('visible');\n singleCells[i].setAttribute('disabled', 'disabled');\n }\n };\n\n /*\n * This fills the abstract representation of our table with \n * zeros, at the start. the max amount of cells is the greatest sum\n * of all colspans for row.\n */\n\n var fillTableArray = function () {\n var colspansSums = [], a = [];\n\n //calculate max amount of cells inside a row\n for (var i = 0; i < table.rows.length; i++) {\n var cells = table.rows[i].getElementsByTagName('td'),\n colspanSumInRow = 0;\n for (var j = 0; j < cells.length; j++) {\n colspanSumInRow += cells[j].colSpan;\n }\n colspansSums.push(colspanSumInRow);\n }\n\n maxAmountOfCells = Math.max.apply(null, colspansSums);\n //calculate max rows\n var maxAmountOfRows = table.rows.length;\n\n // fill with zeros from both values\n for (var i = 0; i < maxAmountOfRows; i++) {\n a[i] = [];\n for (var j = 0; j < maxAmountOfCells; j++) {\n a[i].push(0);\n }\n }\n drawTable(a);\n return a;\n };\n\n /*\n * This function gets the sum of all colspans in a row.\n * @param number the number of row to be used as reference.\n */\n var getActualPointsInRow = function (row) {\n var tds = table.rows[row].getElementsByTagName('td'),\n points = 0;\n for (var i = 0; i < tds.length; i++) {\n points += tds[i].colSpan;\n }\n return points;\n }\n\n /*\n * This function gets us the exact coordinates of\n * an exact cell, in a more reliable way than xIndex and yIndex,\n * these last ones were meant to be used for getting the cell trough them.\n * @param DOMElement the cell to get the coordinates.\n */\n var getCoords = function (search) {\n var skipInCols = [], cell;\n\n for (var i = 0; i < maxAmountOfCells; i++) {\n skipInCols[i] = 0;\n }\n\n for (var i = 0; i < table.rows.length; i++) {\n var cellsBuffer = table.rows[i].getElementsByTagName('td');\n cellPointer = 0;\n for (var xPosition = 0; xPosition < maxAmountOfCells; xPosition += stepsToMove) {\n stepsToMove = 1;\n\n if (skipInCols[xPosition]) {\n skipInCols[xPosition]--;\n } else {\n var td = cellsBuffer[cellPointer++];\n if (td == search) {\n return [i, xPosition];\n }\n if (td.rowSpan > 1) {\n for ( let k = 0; k < td.colSpan; k++ ) {\n skipInCols[xPosition + k] = td.rowSpan - 1;\n }\n stepsToMove = td.colSpan;\n } else if (td.colSpan > 1) {\n stepsToMove = td.colSpan;\n }\n }\n }\n }\n };\n\n jQuery('#wptb-table-header-bg').val('');\n jQuery('#wptb-even-row-bg').val('');\n jQuery('#wptb-odd-row-bg').val('');\n jQuery('#wptb-table-border-color').val('');\n jQuery('#wptb-table-inner-border-number,#wptb-table-inner-border-slider').val('0');\n jQuery('#wptb-table-border-number,#wptb-table-border-slider').val('0');\n jQuery('#wptb-table-padding-number,#wptb-table-padding-slider').val('15');\n\n if (columns || rows) {\n //END OF PRIVATE FUNCTIONS\n for (var i = 0; i < settings.length; i++) {\n if (settings[i].id !== 'wptb-apply-inner-border') {\n settings[i].classList.add('visible');\n }\n }\n\n //Create a HTML Table element.\n table = document.createElement( 'table' );\n table.classList.add( 'wptb-preview-table' );\n table.dataset.reconstraction = 1;\n 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 row.appendChild(cell.getDOMElement());\n }\n }\n } else {\n let wptb_preview_table = document.getElementsByClassName( 'wptb-preview-table' );\n\n if (wptb_preview_table.length > 0) {\n table = wptb_preview_table[0];\n\n let cells = table.getElementsByTagName('td');\n\n if (cells.length > 0) {\n for (let i = 0; i < cells.length; i++) {\n WPTB_Cell(mark, cells[i]);\n }\n }\n }\n }\n\n /*\n * This just toggles visibility of cell edit bar, and toggles \n * cell selecting mode.\n */\n\n table.toggleTableEditMode = function () {\n let bar = document.getElementsByClassName('wptb-edit-bar'),\n cellModeBackground = document.getElementById('wptb-cell_mode_background'),\n leftScrollPanelCurtain = document.getElementById('wptb-left-scroll-panel-curtain'),\n leftScrollPanelCellSettings = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ),\n wptbPreviewTable = document.getElementsByClassName('wptb-preview-table');\n if (wptbPreviewTable.length > 0) {\n wptbPreviewTable = wptbPreviewTable[0];\n }\n\n if ( bar.length > 0 ) {\n for ( let i = 0; i < bar.length; i++ ) {\n if ( bar[i].classList.contains( 'visible' ) ) {\n document.select.deactivateMultipleSelectMode();\n bar[i].classList.remove( 'visible' );\n cellModeBackground.classList.remove( 'visible' );\n leftScrollPanelCurtain.classList.remove( 'visible' );\n leftScrollPanelCellSettings.classList.remove( 'visible' );\n wptbPreviewTable.parentNode.classList.remove( 'wptb-preview-table-manage-cells' );\n let wptbPreviewTableTds = wptbPreviewTable.getElementsByTagName( 'td' );\n if ( wptbPreviewTableTds.length > 0 ) {\n for ( let i = 0; i < wptbPreviewTableTds.length; i++ ) {\n wptbPreviewTableTds[i].classList.remove( 'wptb-highlighted' );\n }\n }\n } else {\n document.select.activateMultipleSelectMode();\n bar[i].classList.add( 'visible' );\n cellModeBackground.classList.add( 'visible' );\n leftScrollPanelCurtain.classList.add( 'visible' );\n wptbPreviewTable.parentNode.classList.add( 'wptb-preview-table-manage-cells' );\n }\n }\n\n }\n }\n\n /*\n * For assigning to each cell xIndex and y Index attributes,\n * these are the column number and row number of cell in table. \n */\n\n table.recalculateIndexes = function ( start ) {\n let trs = this.getElementsByTagName('tr'), tds, maxCols = 0, maxColsFull = 0,\n tdsArr = [];\n let wptbTopRowAsHeader = document.getElementById( 'wptb-top-row-as-header' );\n \n for (var i = 0; i < trs.length; i++) {\n if ( i == 0 ) {\n if ( start == undefined ) {\n trs[i].style.backgroundColor = jQuery('#wptb-table-header-bg').val();\n }\n if( wptbTopRowAsHeader.checked ) {\n if( start == undefined ) {\n this.classList.add( 'wptb-table-preview-head' ); \n trs[i].classList.add( 'wptb-table-head' )\n } ;\n } else {\n if( start == undefined ) {\n this.classList.remove( 'wptb-table-preview-head' );\n trs[i].classList.remove( 'wptb-table-head' );\n }\n }\n } else {\n if (i % 2 == 0) {\n if ( start == undefined ) {\n trs[i].style.backgroundColor = jQuery('#wptb-odd-row-bg').val();\n }\n trs[i].classList.remove( 'wptb-table-head' );\n } else {\n if ( start == undefined ) {\n trs[i].style.backgroundColor = jQuery('#wptb-even-row-bg').val();\n }\n trs[i].classList.remove( 'wptb-table-head' );\n }\n }\n\n tdsArr[i];\n tds = trs[i].getElementsByTagName('td');\n\n if (tdsArr[i] == undefined) {\n tdsArr[i] = [];\n }\n\n let jMainIter = 0;\n for (var j = 0; j < tds.length; j++) {\n if (tdsArr[i][j] != undefined) {\n for (let y = 0; y < 100; y++) {\n if (tdsArr[i][jMainIter] != undefined) {\n jMainIter++;\n continue;\n }\n tdsArr[i][jMainIter] = tds[j];\n tds[j].dataset.xIndex = jMainIter;\n break;\n }\n } else {\n tdsArr[i][j] = tds[j];\n tds[j].dataset.xIndex = jMainIter;\n }\n tds[j].dataset.yIndex = i;\n\n if (tds[j].colSpan > 1) {\n for (let k = 1; k < tds[j].colSpan; k++) {\n jMainIter++;\n tdsArr[i][jMainIter] = 'tdDummy';\n }\n }\n\n if (tds[j].rowSpan > 1) {\n for (let x = 1; x < tds[j].rowSpan; x++) {\n if (tdsArr[i + x] == undefined) {\n tdsArr[i + x] = [];\n }\n for (let z = 0; z < tds[j].colSpan; z++) {\n tdsArr[i + x][jMainIter - tds[j].colSpan + 1 + z ] = 'tdDummy';\n }\n }\n }\n jMainIter++;\n if( i == 0 ) {\n maxColsFull = jMainIter;\n }\n }\n if (j > maxCols) {\n maxCols = j;\n }\n }\n this.columns = maxCols;\n this.maxCols = maxColsFull;\n }\n \n table.addColumnWidth = function( value, cleaner ) {\n let highlighted = table.getElementsByClassName( 'wptb-highlighted' );\n if( highlighted.length > 0 ) {\n for( let k = 0; k < highlighted.length; k++ ) {\n let dataXIndex = highlighted[k].dataset.xIndex;\n if( dataXIndex ) {\n function tableTdsFor( dataXIndex, colspan ) {\n let tableRows = table.rows;\n let widthIsSet = false;\n let arrayTdsFromPreviousRow = [];\n for( let i = 0; i < tableRows.length; i++ ) {\n let row = tableRows[i];\n let tds = row.children;\n for( let j = 0; j < tds.length; j++ ) {\n let td = tds[j];\n if( td.dataset.xIndex == dataXIndex ) {\n if( value ) {\n if( td.colSpan == colspan ) {\n td.style.width = value + 'px';\n td.removeAttribute( 'data-wptb-fixed-width' );\n widthIsSet = true;\n let tableColumnWidthAutoFixedCheckbox = document.getElementById( 'wptb-table-column-width-auto-fixed' );\n if( ! tableColumnWidthAutoFixedCheckbox.checked ) {\n tableColumnWidthAutoFixedCheckbox.checked = true;\n }\n } else {\n td.style.width = null;\n td.dataset.wptbFixedWidth = value;\n if( i == tableRows.length - 1 && ! widthIsSet ) {\n tableTdsFor( dataXIndex, colspan + 1 );\n }\n }\n } else if( cleaner ) {\n td.style.width = null;\n td.removeAttribute( 'data-wptb-fixed-width' );\n } else {\n if( td.dataset.wptbFixedWidth ) {\n if( td.colSpan == colspan ) {\n td.style.width = td.dataset.wptbFixedWidth + 'px';\n td.removeAttribute( 'data-wptb-fixed-width' );\n } \n } else if( td.style.width ) {\n for( let z = 0; z < arrayTdsFromPreviousRow.length; z++ ) {\n arrayTdsFromPreviousRow[z].style.width = td.style.width;\n }\n arrayTdsFromPreviousRow = [];\n } else {\n arrayTdsFromPreviousRow.push( td );\n }\n }\n break;\n } \n }\n }\n }\n \n tableTdsFor( dataXIndex, 1 );\n }\n }\n \n table.tdDefaultWidth();\n }\n }\n \n table.tdDefaultWidth = function() {\n let rows = table.rows;\n \n let tableTdsSumMaxWidth = 0;\n let tableTdsSumMaxWidthFixed = 0;\n let tableTdsSumMaxWidthAuto = 0;\n \n let wptbTableSetup = document.getElementsByClassName( 'wptb-table-setup' )[0];\n let wptbTableSetupWidth = wptbTableSetup.offsetWidth;\n \n let arrayCellsWidthFixedHelper = [];\n let arrayCellsWidthAutoHelper = [];\n let tdPaddingCommon = 0;\n let tableTdBorderCommonWidth = 0;\n let cssForTdsWidthAuto = '';\n \n for( let i = 0; i < rows.length; i++ ) {\n let tds = rows[i].children;\n for( let j = 0; j < tds.length; j++ ) {\n let td = tds[j];\n \n if( ! arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] && ! arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] ) {\n if( td.style.width ) {\n arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] = parseFloat( td.style.width );\n td.removeAttribute( 'data-wptb-css-td-auto-width' );\n } else {\n if( ! td.dataset.wptbFixedWidth ) {\n arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] = 100;\n td.dataset.wptbCssTdAutoWidth = true;\n }\n }\n \n if( window.getComputedStyle( td, null ) ) {\n let tdStyleObj = window.getComputedStyle( td, null );\n let tdPaddingLeft = tdStyleObj.getPropertyValue( 'padding-left' );\n let tdPaddingRight = tdStyleObj.getPropertyValue( 'padding-right' );\n tdPaddingCommon = parseFloat( tdPaddingLeft, 10 ) + parseFloat( tdPaddingRight, 10 );\n\n let tableTdBorderLeftWidth = tdStyleObj.getPropertyValue( 'border-left-width' );\n let tableTdBorderRightWidth = tdStyleObj.getPropertyValue( 'border-right-width' );\n tableTdBorderCommonWidth = parseFloat( tableTdBorderLeftWidth, 10 ) + parseFloat( tableTdBorderRightWidth, 10 );\n if( arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] ) {\n arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] += tdPaddingCommon;\n arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] += tableTdBorderCommonWidth;\n } else {\n arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] += tdPaddingCommon;\n arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] += tableTdBorderCommonWidth;\n }\n }\n } else if( arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] ) {\n if( ! td.dataset.wptbFixedWidth ) {\n td.dataset.wptbCssTdAutoWidth = true;\n }\n } else if( arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] ) {\n td.removeAttribute( 'data-wptb-css-td-auto-width' );\n }\n }\n }\n \n for( let i = 0; i < arrayCellsWidthFixedHelper.length; i++ ) {\n if( arrayCellsWidthFixedHelper[i] ) {\n tableTdsSumMaxWidthFixed += arrayCellsWidthFixedHelper[i];\n }\n }\n \n let CellsWidthAutoCount = 0;\n for( let i = 0; i < arrayCellsWidthAutoHelper.length; i++ ) {\n if( arrayCellsWidthAutoHelper[i] ) {\n tableTdsSumMaxWidthAuto += arrayCellsWidthAutoHelper[i];\n CellsWidthAutoCount++;\n }\n }\n \n let tableFullStyleObj = window.getComputedStyle( table, null );\n let borderLeftWidth = tableFullStyleObj.getPropertyValue( 'border-left-width' );\n let borderRightWidth = tableFullStyleObj.getPropertyValue( 'border-right-width' );\n let tableBorderCommon = parseFloat( borderLeftWidth, 10 ) + parseFloat( borderRightWidth, 10 );\n tableTdsSumMaxWidth = tableTdsSumMaxWidthFixed + tableTdsSumMaxWidthAuto + tableBorderCommon;\n \n table.dataset.wptbTableTdsSumMaxWidth = tableTdsSumMaxWidth;\n if( CellsWidthAutoCount ) {\n table.dataset.wptbCellsWidthAutoCount = CellsWidthAutoCount;\n if( table.mergingСellsHorizontally ) {\n table.dataset.wptbFixedWidthSize = tableTdsSumMaxWidthFixed - tableBorderCommon;\n } else {\n table.removeAttribute( 'data-wptb-fixed-width-size' );\n }\n } else {\n table.removeAttribute( 'data-wptb-fixed-width-size' );\n table.removeAttribute( 'data-wptb-cells-width-auto-count' );\n }\n \n let styleElementCreate = false;\n let tableTdWidthAuto;\n if( tableTdsSumMaxWidth < wptbTableSetupWidth ) {\n if( CellsWidthAutoCount ) {\n table.style.minWidth = '100%';\n if( table.mergingСellsHorizontally ) {\n table.style.width = null;\n let tableTdsWidthAutoCommon = wptbTableSetupWidth - tableTdsSumMaxWidthFixed - tableBorderCommon;\n tableTdWidthAuto = tableTdsWidthAutoCommon / CellsWidthAutoCount;\n tableTdWidthAuto = tableTdWidthAuto - tdPaddingCommon - tableTdBorderCommonWidth;\n styleElementCreate = true;\n } else {\n table.style.width = '100%';\n }\n } else {\n table.style.width = null;\n table.style.minWidth = null;\n table.style.maxWidth = tableTdsSumMaxWidth + 'px';\n }\n } else {\n table.style.maxWidth = null;\n table.style.minWidth = tableTdsSumMaxWidth + 'px';\n table.style.width = null;\n tableTdWidthAuto = '100'\n styleElementCreate = true;\n }\n \n let head = document.head;\n if( head ) {\n let cssForTdsWidthAutoOld = head.querySelector( 'style[data-wptb-td-auto-width=\"true\"]' );\n if( cssForTdsWidthAutoOld ) {\n head.removeChild( cssForTdsWidthAutoOld );\n }\n }\n \n if( styleElementCreate ) {\n cssForTdsWidthAuto = document.createElement( 'style' );\n cssForTdsWidthAuto.setAttribute( 'data-wptb-td-auto-width', true );\n cssForTdsWidthAuto.innerHTML = '[data-wptb-css-td-auto-width=true]{width:' + tableTdWidthAuto + 'px}';\n if( head ) {\n head.appendChild( cssForTdsWidthAuto );\n }\n }\n }\n \n table.addRowHeight = function( value, cleaner ) {\n let highlighted = table.getElementsByClassName( 'wptb-highlighted' );\n if( highlighted.length > 0 ) {\n for( let k = 0; k < highlighted.length; k++ ) {\n let dataYIndex = highlighted[k].dataset.yIndex;\n if( dataYIndex ) {\n function tableTdsFor( dataYIndex, rowspan ) {\n let tableRows = table.rows;\n let heightIsSet = false;\n let arrayTdsPrevious = [];\n for( let i = 0; i < tableRows.length; i++ ) {\n let row = tableRows[i];\n let tds = row.children;\n for( let j = 0; j < tds.length; j++ ) {\n let td = tds[j];\n if( td.dataset.yIndex == dataYIndex ) {\n if( value ) {\n if( td.rowSpan == rowspan ) {\n td.style.height = value + 'px';\n td.removeAttribute( 'data-wptb-fixed-heidht' );\n heightIsSet = true;\n let tableColumnHeightAutoFixedCheckbox = document.getElementById( 'wptb-table-row-height-auto-fixed' );\n if( ! tableColumnHeightAutoFixedCheckbox.checked ) {\n tableColumnHeightAutoFixedCheckbox.checked = true;\n }\n continue;\n } else {\n td.style.height = null;\n td.dataset.wptbFixedHeight = value;\n if( j == tds.length - 1 && ! heightIsSet ) {\n tableTdsFor( dataYIndex , rowspan + 1 );\n }\n }\n } else if( cleaner ) {\n td.style.height = null;\n td.removeAttribute( 'data-wptb-fixed-heidht' );\n } else {\n if( td.dataset.wptbFixedHeight ) {\n if( td.rowSpan = rowspan ) {\n td.style.height = td.dataset.wptbFixedHeight + 'px';\n td.removeAttribute( 'data-wptb-fixed-width' );\n }\n } else if( td.style.height ) {\n for( let z = 0; z < arrayTdsPrevious.length; z++ ) {\n arrayTdsPrevious[z].style.height = td.style.height;\n }\n arrayTdsPrevious = [];\n } else {\n arrayTdsPrevious.push( td );\n }\n }\n } \n }\n }\n }\n \n tableTdsFor( dataYIndex, 1 );\n }\n }\n }\n }\n \n table.reconstraction = function() {\n let tds = table.getElementsByTagName( 'td' );\n let wptbAdaptiveTableChoseBlock = document.getElementsByClassName( 'wptb-adaptive-table-chose-block' );\n if( wptbAdaptiveTableChoseBlock.length > 0 ) {\n wptbAdaptiveTableChoseBlock = wptbAdaptiveTableChoseBlock[0];\n }\n table.mergingСellsHorizontally = false;\n table.mergingCellsVertically = false;\n table.dataset.reconstraction = 1;\n wptbAdaptiveTableChoseBlock.style.display = 'block';\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 wptbAdaptiveTableChoseBlock.style.display = 'none';\n table.mergingСellsHorizontally = true;\n forBreak++;\n }\n \n if( tds[i].rowSpan > 1 ) {\n table.dataset.reconstraction = 0;\n wptbAdaptiveTableChoseBlock.style.display = 'none';\n table.mergingCellsVertically = true;\n forBreak++;\n }\n \n if( forBreak == 2 ) {\n break;\n }\n }\n }\n\n /*\n * As simple as it is: adds a column to the end of table.\n */\n table.addColumnEnd = function () {\n let td,\n currentTable = document.getElementsByClassName('wptb-preview-table'),\n currentTableTd,\n currentTdStyle;\n if (currentTable.length > 0) {\n currentTableTd = currentTable[0].querySelector('td');\n }\n\n if (currentTableTd) {\n currentTdStyle = currentTableTd.getAttribute('style');\n }\n \n for (var i = 0; i < table.rows.length; i++) {\n td = new WPTB_Cell(mark);\n \n if (currentTdStyle) {\n td.getDOMElement().setAttribute('style', currentTdStyle);\n td.getDOMElement().style.width = null;\n }\n \n table.rows[i].appendChild(td.getDOMElement());\n array[i].push(0);\n }\n \n maxAmountOfCells++;\n table.recalculateIndexes();\n table.tdDefaultWidth();\n table.addRowHeight();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n 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 }\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 let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n /*\n * Well, not so simple as previous functions.\n * It adds a column after a certain column of reference.\n * @param integer the column number to be used as reference.\n *\tIf empty, then the first highlighted cell is used as reference.\n */\n\n table.addColumnAfter = function (c_pos) {\n let rows = table.rows,\n cellPointer,\n cellsBuffer,\n cell = document.querySelector('.wptb-highlighted'),\n cellStyle = cell.getAttribute('style'),\n pos = c_pos != undefined && typeof c_pos === 'number' ? c_pos : getCoords(cell)[1];\n \n \n \n if( maxAmountOfCells - pos - cell.colSpan + 1 == 1 ) {\n table.addColumnEnd();\n } else {\n let pendingInsertion = false,\n stepsToMove,\n td, bro,\n carriedRowspans = [],\n currentCell;\n\n for (var i = 0; i < maxAmountOfCells; i++) {\n carriedRowspans.push(0);\n }\n\n for (var i = 0; i < rows.length; i++) {\n cellPointer = 0;\n cellsBuffer = rows[i].getElementsByTagName('td');\n pendingInsertion = false;\n for (var xPosition = 0;\n xPosition < maxAmountOfCells;\n xPosition += stepsToMove) {\n stepsToMove = 1;\n\n if (pendingInsertion) {\n td = new WPTB_Cell(mark);\n if (cellStyle) {\n td.getDOMElement().setAttribute('style', cellStyle);\n td.getDOMElement().style.width = null;\n }\n if (currentCell && rows[i].contains(currentCell)) {\n bro = currentCell.nextSibling;\n if (bro) {\n rows[i].insertBefore(td.getDOMElement(), bro);\n } else {\n rows[i].appendChild(td.getDOMElement());\n }\n } else {\n rows[i].insertBefore(td.getDOMElement(), cellsBuffer[0]);\n }\n break;\n } else if (carriedRowspans[xPosition] > 0) {\n // If no pending insertion, let's check if no rowspan from upper cells is pending in current position\n if (pos == xPosition) {\n pendingInsertion = true;\n }\n } else {\n currentCell = cellsBuffer[cellPointer++];\n if (currentCell.rowSpan > 1) {\n stepsToMove = currentCell.colSpan;\n for (var k = 0; k < currentCell.colSpan; k++) {\n carriedRowspans[xPosition + k] = currentCell.rowSpan;\n if (xPosition + k == pos) {\n pendingInsertion = true;\n }\n }\n } else if (currentCell.colSpan > 1) {\n stepsToMove = currentCell.colSpan;\n for (var k = 0; k < currentCell.colSpan; k++) {\n if (xPosition + k == pos) {\n pendingInsertion = true;\n }\n }\n } else if (xPosition == pos) {\n pendingInsertion = true;\n }\n }\n }\n\n for (var l = 0; l < maxAmountOfCells; l++) {\n if (carriedRowspans[l] > 0)\n carriedRowspans[l]--;\n }\n\n }\n\n for (var i = 0; i < array.length; i++) {\n array[i].push(0);\n }\n maxAmountOfCells++;\n drawTable(array);\n table.recalculateIndexes();\n table.addColumnWidth();\n table.addRowHeight();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n };\n\n /*\n * For preventing us to take a lot of time,\n * This is just calling the function addColumnAfter, but\n * using the previous column to current one as reference.\n * @see addColumnAfter\n */\n\n table.addColumnBefore = function () {\n var cell = document.querySelector('.wptb-highlighted'),\n pos = getCoords(cell)[1];\n\n if (pos === 0) {\n table.addColumnStart();\n } else {\n table.addColumnAfter(pos - 1);\n }\n };\n\n /*\n * Luckily, thisfunction is simple, \n * it just add a row to the end of table.\n */\n\n table.addRowToTheEnd = function () {\n let r = table.insertRow(-1),\n td,\n aux,\n currentTable = document.getElementsByClassName('wptb-preview-table'),\n currentTableTd,\n currentTdStyle;\n r.classList.add( 'wptb-row' );\n if (currentTable.length > 0) {\n currentTableTd = currentTable[0].querySelector('td');\n }\n\n if (currentTableTd) {\n currentTdStyle = currentTableTd.getAttribute('style');\n }\n\n for (var i = 0; i < maxAmountOfCells; i++) {\n td = new WPTB_Cell(mark);\n if (currentTdStyle) {\n td.getDOMElement().setAttribute('style', currentTdStyle);\n }\n r.appendChild(td.getDOMElement());\n }\n aux = Array.from(array[0]);\n array.push(aux);\n drawTable(array);\n table.recalculateIndexes();\n table.addColumnWidth();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n /*\n * Yet another simple function, \n * it just add a row to the start of table.\n */\n\n table.addRowToTheStart = function () {\n let r = table.insertRow(0),\n td,\n aux,\n currentTable = document.getElementsByClassName('wptb-preview-table'),\n currentTableTd,\n currentTdStyle;\n r.classList.add( 'wptb-row' );\n if (currentTable.length > 0) {\n currentTableTd = currentTable[0].querySelector('td');\n }\n\n if (currentTableTd) {\n currentTdStyle = currentTableTd.getAttribute('style');\n }\n\n for (var i = 0; i < maxAmountOfCells; i++) {\n td = new WPTB_Cell(mark);\n if (currentTdStyle) {\n td.getDOMElement().setAttribute('style', currentTdStyle);\n }\n r.appendChild(td.getDOMElement());\n }\n aux = Array.from(array[0]);\n array.push(aux);\n drawTable(array);\n table.recalculateIndexes();\n table.addColumnWidth();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n /* \n * This function adds a row before the current one.\n * Since the biggest factor of problem is a not-started but ongoing rowspan,\n * the most of the troubles is not here.\n */\n\n table.addRowBefore = function () {\n let cell = document.querySelector('.wptb-highlighted'),\n cellStyle = cell.getAttribute('style'),\n row = getCoords(cell)[0],\n cellNew;\n for( let i = row - 1; i >= 0; i-- ) {\n let rowChildren = table.rows[i].children;\n let rowChildrenLength = rowChildren.length;\n if( rowChildrenLength > 0 ) {\n for( let j = 0; j < rowChildrenLength; j++ ) {\n if( rowChildren[j].rowSpan == 1 ) {\n row = i;\n cellNew = true;\n break;\n }\n }\n }\n if ( cellNew ) {\n break;\n }\n }\n\n if (row === 0) {\n table.addRowToTheStart();\n } else {\n table.addRowAfter( row, cellStyle );\n }\n };\n\n /*\n * Well... by the name convention of the previous 3 functions,\n * it's pretty obvious that this functions attaches a new\n * row after highlighted cell row. The greatest obstacle it was\n * the possibility of a TR not having the exact amount of columns\n * occuped by actual node but rowspanned upper cells. For that purpose\n * it was created the function realTimeArray.\n * @see realTimeArray\n */\n\n table.addRowAfter = function ( row, cellStyle ) {\n let cellRowSpan,\n rowAfter,\n aux;\n \n if ( ( row == undefined || typeof row !== 'number' ) && cellStyle == undefined ) {\n let cell = document.querySelector('.wptb-highlighted');\n cellStyle = cell.getAttribute('style'),\n row = getCoords(cell)[0],\n cellRowSpan = cell.rowSpan,\n rowAfter = row + cellRowSpan - 1;\n } else {\n rowAfter = row;\n }\n \n \n let cellsColSpan = 0;\n if ( rowAfter < table.rows.length -1 ) {\n for( let i = 0; i <= rowAfter ; i++ ) {\n let tableRowsIChildren = table.rows[i].children,\n tableRIChildrenLength = tableRowsIChildren.length;\n if( tableRIChildrenLength > 0 ) {\n for( let j = 0; j < tableRIChildrenLength; j++ ) {\n let rowIRowSpan = tableRowsIChildren[j].rowSpan;\n\n if ( rowIRowSpan - 1 + i > rowAfter ) {\n tableRowsIChildren[j].rowSpan++;\n }\n }\n }\n }\n \n let rNext = table.rows[rowAfter + 1],\n rNextChildren = rNext.children,\n rNextChildrenLength = rNextChildren.length;\n \n if( rNextChildrenLength > 0 ) {\n for ( let i = 0; i < rNextChildrenLength; i++ ) {\n cellsColSpan += rNextChildren[i].colSpan;\n }\n }\n } else {\n cellsColSpan = array[0].length;\n }\n \n let r = table.insertRow( rowAfter + 1 );\n r.classList.add( 'wptb-row' );\n \n for ( j = 0; j < cellsColSpan; j++ ) {\n let td = new WPTB_Cell( mark );\n td.getDOMElement().setAttribute( 'style', cellStyle );\n td.getDOMElement().style.width = null;\n td.getDOMElement().style.height = null;\n r.appendChild( td.getDOMElement() );\n }\n\n aux = Array.from(array[0]);\n array.push(aux);\n drawTable(array);\n table.recalculateIndexes();\n table.addColumnWidth();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n 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 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 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 table.toggleTableEditMode();\n wptbTableSetup.innerHTML = '';\n WPTB_Helper.settingsPanelClear();\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\n }\n \n table.recalculateIndexes();\n WPTB_Helper.dataTitleColumnSet( table );\n }\n \n undoSelect();\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 table.toggleTableEditMode();\n wptbTableSetup.innerHTML = '';\n WPTB_Helper.settingsPanelClear();\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\n }\n \n table.recalculateIndexes();\n table.tdDefaultWidth();\n WPTB_Helper.dataTitleColumnSet( table );\n }\n \n undoSelect();\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'none';\n\n array = fillTableArray();\n\n undoSelect();\n drawTable(array);\n\n wptbTableSetup.appendChild(table);\n //if (columns || rows) {\n table.recalculateIndexes( true );\n //}\n table.reconstraction();\n table.tdDefaultWidth();\n \n wptbTableSetup.onresize = function() {\n table.tdDefaultWidth();\n };\n\n WPTB_LeftPanel();\n \n // this code gets the ID of the active element in the toolbar \n // and stores it in the data attribute of the common container element \"wpcd_fixed_toolbar\"\n// let wptbPhElement = document.getElementsByClassName( 'wptb-ph-element' );\n// let wpcdFixedToolbar = document.getElementById( 'wpcd_fixed_toolbar' );\n// for ( let i = 0; i < wptbPhElement.length; i++ ) {\n// wptbPhElement[i].addEventListener( 'click', function( e ) {\n// let wptbToolbar = document.getElementById( 'wpcd_fixed_toolbar' ).children;\n// for ( let j = 0; j < wptbToolbar.length; j++ ) {\n// let elementStyles = window.getComputedStyle( wptbToolbar[j], 'null' );\n// if( elementStyles.getPropertyValue( 'display' ) == 'block' ) {\n// wpcdFixedToolbar.dataset.toolbarActiveId = wptbToolbar[j].getAttribute( 'id' );\n// }\n// }\n// }, false );\n// }\n \n// let wptbPanelLeft = document.getElementsByClassName( 'wptb-panel-left' );\n// if( wptbPanelLeft.length > 0 ) {\n// wptbPanelLeft[0].addEventListener( 'click', function( e ) {\n// let toolbarActiveElementId = wpcdFixedToolbar.dataset.toolbarActiveId;\n// document.getElementById( toolbarActiveElementId ).style.display = '';\n// }, false );\n// }\n \n// let body = document.getElementsByTagName( 'body' );\n// if( body.length > 0 ) {\n// body[0].addEventListener( 'click', function( e ) {\n// if ( e.target.classList.contains( 'wptb-panel-left' ) || WPTB_Helper.findAncestor( e.target, 'wptb-panel-left' ) ) {\n// let toolbarActiveElementId = wpcdFixedToolbar.dataset.toolbarActiveId;\n// document.getElementById( toolbarActiveElementId ).style.display = '';\n// }\n// }, false );\n// }\n};","var WPTB_TableStateSaveManager = function() {\n this.tableStateSet = () => {\n // get preview table\n let wptbPreviewTable = document.getElementsByClassName( 'wptb-preview-table' );\n if( wptbPreviewTable.length > 0 ) {\n wptbPreviewTable = wptbPreviewTable[0];\n \n // check if a global array doesn't exist with saved versions of the table \n // them create it\n if( ! window.wptbTableStateSaving ) {\n window.wptbTableStateSaving = [];\n } \n \n // remove the extra part of the array after changing the table \n // when it is showed in the not last modified version\n if( window.wptbTableStateSaving.length > window.wptbTableStateNumberShow + 1 ) {\n window.wptbTableStateSaving = window.wptbTableStateSaving.slice( 0, window.wptbTableStateNumberShow + 1 );\n }\n \n //add new state of table\n let wptbNewPreviewTable = wptbPreviewTable.cloneNode( true );\n let wptbHighlighted = wptbNewPreviewTable.getElementsByClassName( 'wptb-highlighted' );\n for( let i = 0; i < wptbHighlighted.length; i++ ) {\n wptbHighlighted[i].classList.remove( 'wptb-highlighted' );\n }\n let wptbDirectlyhovered = wptbNewPreviewTable.getElementsByClassName( 'wptb-directlyhovered' );\n for( let i = 0; i < wptbDirectlyhovered.length; i++ ) {\n wptbDirectlyhovered[i].classList.remove( 'wptb-directlyhovered' );\n }\n \n let cssForTdsWidthAutoValue = '';\n let head = document.head;\n if( head ) {\n let cssForTdsWidthAuto = head.querySelector( 'style[data-wptb-td-auto-width=\"true\"]' );\n if( cssForTdsWidthAuto ) {\n cssForTdsWidthAutoValue = cssForTdsWidthAuto.innerHTML;\n }\n }\n \n let mceContentBodys = wptbNewPreviewTable.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 = wptbNewPreviewTable.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 mceIds = wptbNewPreviewTable.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 window.wptbTableStateSaving.push( [wptbNewPreviewTable, cssForTdsWidthAutoValue] );\n \n // set new number of state which is showed now\n window.wptbTableStateNumberShow = window.wptbTableStateSaving.length - 1;\n \n // make undo arrow active when the table was changed\n if( window.wptbTableStateSaving.length > 1 ) {\n let wptbUndo = document.getElementsByClassName( 'wptb-undo' );\n if( wptbUndo.length > 0 ) {\n wptbUndo = wptbUndo[0];\n\n wptbUndo.classList.remove( 'wptb-undoredo-disabled' );\n }\n }\n \n // make redo arrow not active when the table was changed\n let wptbRedo = document.getElementsByClassName( 'wptb-redo' );\n if( wptbRedo.length > 0 ) {\n wptbRedo = wptbRedo[0];\n \n wptbRedo.classList.add( 'wptb-undoredo-disabled' );\n }\n \n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\n if( wptbSaveBtn.length > 0 ) {\n wptbSaveBtn = wptbSaveBtn[0];\n if( ( ! wptbSaveBtn.dataset.wptbTableStateNumberSave && window.wptbTableStateNumberShow == 0 ) || \n window.wptbTableStateNumberShow == wptbSaveBtn.dataset.wptbTableStateNumberSave ) {\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\n } else {\n wptbSaveBtn.classList.remove( 'wptb-save-disabled' );\n }\n }\n }\n }\n \n this.tableStateGet = ( datawptbUndoredo ) => {\n if( datawptbUndoredo && window.wptbTableStateSaving && window.wptbTableStateSaving.length > 1 ) {\n \n // changes the number of the state which displays now\n if( datawptbUndoredo == 'undo' ) {\n if( window.wptbTableStateNumberShow > 0 ) {\n window.wptbTableStateNumberShow--;\n } else {\n return false;\n }\n } else if( datawptbUndoredo == 'redo' ) {\n if( window.wptbTableStateNumberShow < window.wptbTableStateSaving.length - 1 ) {\n window.wptbTableStateNumberShow++;\n } else {\n return false;\n }\n }\n \n // add or delete class \"wptb-undoredo-disabled\" for undo button\n let wptbUndo = document.getElementsByClassName( 'wptb-undo' );\n if( wptbUndo.length > 0 ) {\n wptbUndo = wptbUndo[0];\n }\n if( window.wptbTableStateNumberShow == 0 ) {\n if( wptbUndo ) {\n wptbUndo.classList.add( 'wptb-undoredo-disabled' )\n }\n } else if( window.wptbTableStateNumberShow > 0 ) {\n if( wptbUndo ) {\n wptbUndo.classList.remove( 'wptb-undoredo-disabled' )\n }\n }\n \n // add or delete class \"wptb-undoredo-disabled\" for redo button\n let wptbRedo = document.getElementsByClassName( 'wptb-redo' );\n if( wptbRedo.length > 0 ) {\n wptbRedo = wptbRedo[0];\n }\n if( window.wptbTableStateNumberShow == window.wptbTableStateSaving.length - 1 ) {\n if( wptbRedo ) {\n wptbRedo.classList.add( 'wptb-undoredo-disabled' )\n }\n } else if( window.wptbTableStateNumberShow < window.wptbTableStateSaving.length - 1 ) {\n if( wptbRedo ) {\n wptbRedo.classList.remove( 'wptb-undoredo-disabled' )\n }\n }\n \n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\n if( wptbSaveBtn.length > 0 ) {\n wptbSaveBtn = wptbSaveBtn[0];\n if( ( ! wptbSaveBtn.dataset.wptbTableStateNumberSave && window.wptbTableStateNumberShow == 0 ) || \n window.wptbTableStateNumberShow == wptbSaveBtn.dataset.wptbTableStateNumberSave ) {\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\n } else {\n wptbSaveBtn.classList.remove( 'wptb-save-disabled' );\n }\n }\n \n // load necessary saved table state\n let wptbTableSetup = document.getElementsByClassName( 'wptb-table-setup' );\n if( wptbTableSetup.length > 0 ) {\n wptbTableSetup = wptbTableSetup[0];\n\n wptbTableSetup.innerHTML = '';\n wptbTableSetup.innerHTML = window.wptbTableStateSaving[window.wptbTableStateNumberShow][0].outerHTML;\n\n if( window.wptbTableStateSaving[window.wptbTableStateNumberShow][1] ) {\n let cssForTdsWidthAuto = document.createElement( 'style' );\n cssForTdsWidthAuto.setAttribute( 'data-wptb-td-auto-width', true );\n cssForTdsWidthAuto.innerHTML = window.wptbTableStateSaving[window.wptbTableStateNumberShow][1];\n 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 head.appendChild( cssForTdsWidthAuto );\n }\n }\n\n WPTB_Helper.settingsPanelClear();\n WPTB_Helper.elementOptionsPanelClear();\n WPTB_LeftPanel();\n\n let wptbLeftScrollPanelCellSetting = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ); \n if( wptbLeftScrollPanelCellSetting ) {\n wptbLeftScrollPanelCellSetting.classList.remove( 'visible' );\n }\n }\n }\n }\n}","var WPTB_Text = function ( text , DOMElementProt ) {\n let DOMElement = document.createElement('div'),\n elText2 = document.createElement('div'),\n elP = document.createElement('p'),\n kindIndexProt = undefined,\n copy = false;\n \n DOMElement.classList.add( 'wptb-text-container' );\n\n elP.innerHTML = text != undefined ? text : 'Text';\n elText2.appendChild(elP);\n DOMElement.appendChild(elText2);\n if ( DOMElementProt ) {\n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\n kindIndexProt = wptbElementMutch[1];\n copy = true;\n };\n\n let attributes = [...DOMElementProt.attributes];\n for( let i = 0; i < attributes.length; i++ ) {\n DOMElement.setAttribute(attributes[i].name, attributes[i].value);\n }\n } \n\n this.kind = 'text';\n this.getDOMElement = function () {\n return DOMElement;\n };\n applyGenericItemSettings( this, kindIndexProt, copy );\n\n return this;\n};","var WPTB_innerElementSet = function ( element ) {\n \n element.ondragenter = function (e) {\n var div;\n if ( e.dataTransfer.types.indexOf( 'wptbelement' ) == -1 && e.dataTransfer.types.indexOf( 'wptb-moving-mode' ) == -1 ) {\n return;\n }\n WPTB_DropHandle(this, e);\n \n element.classList.add( 'wptb-ondragenter' );\n }\n element.ondragover = function (e) {\n e.preventDefault();\n WPTB_DropHandle(this, e);\n }\n element.ondragleave = function () {\n \n }\n element.ondrop = function(e) {\n this.classList.remove( 'wptb-ondragenter' );\n let element, classId;\n e.preventDefault();\n e.stopPropagation();\n\n if (!e.dataTransfer.getData('wptbElement') && !e.dataTransfer.getData('node')) {\n return;\n }\n let wptbDropHandle,\n wptbDropBorderMarker;\n if ( document.getElementsByClassName( 'wptb-drop-handle' ).length > 0 ) {\n wptbDropHandle = document.getElementsByClassName( 'wptb-drop-handle' )[0];\n }\n if( document.getElementsByClassName( 'wptb-drop-border-marker' ).length > 0 ) {\n wptbDropBorderMarker = document.getElementsByClassName( 'wptb-drop-border-marker' )[0];\n }\n\n if ( e.dataTransfer.getData( 'wptbElement' ) ) {\n element = WPTB_Helper.newElementProxy( e.dataTransfer.getData( 'wptbElement' ) );\n element = element.getDOMElement();\n } else {\n classId = e.dataTransfer.getData( 'node' );\n element = document.getElementsByClassName( classId )[0];\n //element.classList.remove( 'wptb-moving-mode' );\n }\n \n if( wptbDropHandle.style.display == 'block' ) {\n let td;\n if( wptbDropHandle.dataset.text == 'Drop Here' ) {\n td = wptbDropHandle.getDOMParentElement();\n td.appendChild( element );\n } else {\n let innerElement = wptbDropHandle.getDOMParentElement();\n td = innerElement.parentNode;\n\n if( wptbDropHandle.dataset.text == 'Above Element' ) {\n td.insertBefore( element, innerElement );\n } else if( wptbDropHandle.dataset.text == 'Below Element' ) {\n let innerElementNext = innerElement.nextSibling;\n td.insertBefore( element, innerElementNext );\n }\n }\n let thisRow = td.parentNode\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\n WPTB_Helper.dataTitleColumnSet( table );\n }\n \n } else {\n return;\n }\n \n wptbDropHandle.style.display = 'none';\n wptbDropBorderMarker.style.display = 'none';\n\n WPTB_innerElementSet( element );\n \n 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 listItems,\n copy;\n \n if ( kindIndexProt == undefined || copy == true ) {\n index = document.counter.nextIndex( element.kind );\n let wptbElements = document.getElementsByClassName( 'wptb-ph-element' );\n let elementIndexesArr = [];\n for( let i = 0; i < wptbElements.length; i++ ) {\n var regex = new RegExp( 'wptb-element-' + element.kind + '-(\\\\d+)', \"i\" );\n let infArr = wptbElements[i].className.match( regex );\n if( infArr ) {\n elementIndexesArr.push( infArr[1] );\n }\n }\n if( elementIndexesArr.length > 0 ) {\n let elementIndexMax = Math.max( ...elementIndexesArr );\n index = elementIndexMax + 1;\n } else { \n index = 1;\n }\n } else if ( kindIndexProt && ! copy ) {\n let kindIndexProtArr = kindIndexProt.split('-');\n index = kindIndexProtArr[kindIndexProtArr.length - 1];\n }\n \n node.onmouseenter = function ( event ) {\n if( event.target.classList.contains( 'wptb-moving-mode' ) ) {\n return;\n }\n \n let i, wptbActionsField = new WPTB_ActionsField();\n \n wptbActionsField.addActionField( 1, node );\n \n wptbActionsField.setParameters( node );\n \n node.classList.remove( 'wptb-ondragenter' );\n \n //wptbActionsField.addActionField( 1, node )\n \n if ( element.kind === 'button' ) {\n let a = node.querySelector( 'a' ),\n target = a.querySelector( 'div' );\n a.onclick = function( e ) {\n e.preventDefault();\n }\n WPTB_Helper.buttonsTinyMceInit( target );\n } else if (element.kind === 'text') {\n tinyMCE.init({\n target: node.childNodes[0],\n inline: true,\n plugins: \"link, paste\",\n dialog_type: \"modal\",\n theme: 'modern',\n menubar: false,\n force_br_newlines : false,\n force_p_newlines : false,\n forced_root_block : '',\n fixed_toolbar_container: '#wpcd_fixed_toolbar',\n paste_as_text: true,\n toolbar: 'bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify',\n setup : function( ed ) {\n ed.on( 'change', function(e) {\n let row = WPTB_Helper.findAncestor( node, 'wptb-row' );\n if( row.classList.contains( 'wptb-table-head' ) ) {\n let table = WPTB_Helper.findAncestor( row, 'wptb-preview-table' );\n WPTB_Helper.dataTitleColumnSet( table );\n }\n \n \n });\n \n ed.on( 'keydown', function(e) {\n let wptbActionsField = new WPTB_ActionsField();\n \n wptbActionsField.addActionField( 1, node );\n \n wptbActionsField.setParameters( node );\n });\n ed.on( 'keyup', function(e) {\n let wptbActionsField = new WPTB_ActionsField();\n \n wptbActionsField.addActionField( 1, node );\n \n wptbActionsField.setParameters( node );\n \n e.target.onblur = function() {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n });\n \n },\n init_instance_callback: function (editor) {\n window.currentEditor = editor;\n //editor.fire('focus');\n editor.on('focus', function (e) {\n var totalWidth = document.getElementsByClassName('wptb-builder-panel')[0].offsetWidth;\n if (window.currentEditor &&\n document.getElementById('wptb_builder').scrollTop >= 55 &&\n window.currentEditor.bodyElement.style.display != 'none') {\n document.getElementById('wpcd_fixed_toolbar').style.position = 'fixed';\n document.getElementById('wpcd_fixed_toolbar').style.right = (totalWidth / 2 - document.getElementById('wpcd_fixed_toolbar').offsetWidth / 2) + 'px';\n document.getElementById('wpcd_fixed_toolbar').style.top = '100px';\n } else {\n document.getElementById('wpcd_fixed_toolbar').style.position = 'static';\n delete document.getElementById('wpcd_fixed_toolbar').style.right;\n delete document.getElementById('wpcd_fixed_toolbar').style.top;\n }\n });\n }\n });\n } else if( element.kind === 'list' ) {\n listItems = node.getElementsByClassName( 'wptb-list-item-content' );\n for ( let i = 0; i < listItems.length; i++ ) {\n WPTB_Helper.listItemsTinyMceInit( listItems[i] );\n }\n } \n };\n \n node.onmouseleave = function ( event ) {\n let wptbActionsField = new WPTB_ActionsField();\n \n if( wptbActionsField.wptbActions && wptbActionsField.wptbActions.type != '1' ) {\n return;\n }\n \n wptbActionsField.leaveFromField( event, node, 1 );\n };\n \n let wptbActions = document.getElementsByClassName( 'wptb-actions' );\n if( wptbActions.length > 0 ) {\n wptbActions = wptbActions[0];\n \n }\n \n // Change data-title-column if the title was changed\n if( element.kind == 'text' ) {\n var observer = new MutationObserver( function( mutations ) {\n let row = WPTB_Helper.findAncestor( node, 'wptb-row' );\n if( row.classList.contains( 'wptb-table-head' ) ) {\n let table = WPTB_Helper.findAncestor( row, 'wptb-preview-table' );\n WPTB_Helper.dataTitleColumnSet( table );\n }\n });\n var config = { attributes: true, attributeFilter: ['style'] };\n observer.observe( element.getDOMElement(), config );\n } else if( element.kind == 'star_rating' ) {\n let ratingStars = node.getElementsByClassName( 'wptb-rating-star' );\n for ( let i = 0; i < ratingStars.length; i++ ) {\n let ratingStar = ratingStars[i];\n \n \n WPTB_Helper.starRatingEventHandlersAdd( ratingStar );\n \n let ritingStarZeroSet = ratingStar.querySelector( '.wptb-rating-star-zero-set' );\n if( ritingStarZeroSet ) {\n ritingStarZeroSet.onclick = function( event ) {\n let ulStarList = WPTB_Helper.findAncestor( event.target, 'wptb-rating-stars-list' );\n if( ulStarList ) {\n let children = ulStarList.children;\n for( let i = 0; i < children.length; i++ ) {\n children[i].classList.remove( 'wptb-rating-star-selected-full' );\n children[i].classList.remove( 'wptb-rating-star-selected-half' );\n }\n }\n }\n }\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 new WPTB_ElementOptions( element, index, kindIndexProt );\n\n document.counter.increment(element.kind);\n};",""]}
|
inc/admin/js/admin.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var WPTB_ActionsField=function p(){var m=this;this.wptbActions,0!=document.getElementsByClassName("wptb-actions").length&&(this.wptbActions=document.getElementsByClassName("wptb-actions")[0]),this.addActionField=function(e,i){var t=document.getElementsByTagName("body")[0],a=document.getElementsByClassName("wptb-actions");if(0!=a.length){var n=a[0].activeElem;for(n&&n.classList.remove("wptb-directlyhovered");0!=a.length;)a[0].parentNode.removeChild(a[0])}if(1==e){var l=void 0,r=void 0,o=void 0;l=document.createElement("span"),r=document.createElement("span"),o=document.createElement("span"),(a=document.createElement("div")).classList.add("wptb-actions"),l.classList.add("dashicons","dashicons-trash","wptb-delete-action"),r.classList.add("dashicons","dashicons-admin-page","wptb-duplicate-action"),o.classList.add("dashicons","dashicons-move","wptb-move-action"),o.draggable=!0,a.appendChild(o),a.appendChild(r),a.appendChild(l),t.appendChild(a),a.activeElem=i,a.type=1,l.onclick=function(e){var t=e.target.parentNode.activeElem,a=t.parentNode;if(a.removeChild(t),"text"==t.kind){var n=a.parentNode;if(n.classList.contains("wptb-table-head")){var l=WPTB_Helper.findAncestor(n,"wptb-preview-table");WPTB_Helper.dataTitleColumnSet(l)}}(new p).actionsRemove(),(new WPTB_TableStateSaveManager).tableStateSet()},r.onclick=function(e){var t=void 0,a=void 0,n=e.target.parentNode.activeElem,l=n.cloneNode(!0);l.classList.remove("wptb-directlyhovered"),a=n.className.match(/wptb-element-(.+)-(\d+)/i)[1];var r=n.parentNode;if("list"==a){for(var o=[],i=n.querySelectorAll("ul li .wptb-list-item-content"),s=0;s<i.length;s++)o.push(i[s].innerHTML);t=new WPTB_List(o,l),r.insertBefore(t.getDOMElement(),n.nextSibling)}else if("text"==a)t=new WPTB_Text(l.childNodes[0].innerHTML,l),r.insertBefore(t.getDOMElement(),n.nextSibling);else if("image"==a)t=new WPTB_Image("",n),r.insertBefore(t.getDOMElement(),n.nextSibling);else if("button"==a){var d=l.childNodes[0].querySelector("p").innerHTML;t=new WPTB_Button(d,l),r.insertBefore(t.getDOMElement(),n.nextSibling)}else(a="star_rating")&&(t=new WPTB_StarRating(l),r.insertBefore(t.getDOMElement(),n.nextSibling));WPTB_innerElementSet(t.getDOMElement()),new p(1,n).setParameters(n),(new WPTB_TableStateSaveManager).tableStateSet()},o.ondragstart=function(e){var t,a,n=WPTB_Helper.dragImagesArr(),l=e.target.parentNode.activeElem;a=(t=l.className.match(/wptb-element-(.+)-(\d+)/i))[1],l.classList.add("wptb-moving-mode"),e.dataTransfer.effectAllowed="move",e.dataTransfer.setDragImage(n[a],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 r=e.target.parentNode.activeElem;if("text"==r.kind){var o=r.parentNode.parentNode;if(o.classList.contains("wptb-table-head")){var i=WPTB_Helper.findAncestor(o,"wptb-preview-table");WPTB_Helper.dataTitleColumnSet(i)}}m.actionsHide()},a.style.display="block",m.wptbActions=a}else if(2==e){var s=void 0,d=void 0;s=document.createElement("span"),d=document.createElement("span"),(a=document.createElement("span")).classList.add("wptb-actions"),s.classList.add("dashicons","dashicons-trash","wptb-delete-action"),d.classList.add("dashicons","dashicons-admin-page","wptb-duplicate-action"),a.append(d,s),t.appendChild(a),a.activeElem=i;var c=WPTB_Helper.findAncestor(i,"wptb-directlyhovered");c&&c.classList.remove("wptb-directlyhovered"),a.type=2,s.onclick=function(e){var t=e.target.parentNode.activeElem,a=t.parentNode;new p(4).actionsRemove(),a.removeChild(t),WPTB_Helper.listItemsRecalculateIndex(a),(new WPTB_TableStateSaveManager).tableStateSet()},d.onclick=function(e){var t=i.getBoundingClientRect(),a=t.top,n=e.target.parentNode.activeElem,l=n.querySelector(".wptb-list-item-content").innerHTML,r=new WPTB_ListItem(l,n,!0);n.parentNode.insertBefore(r.getDOMElement(),i.nextSibling),WPTB_Helper.listItemsTinyMceInit(r.getDOMElement().firstChild);var o=i.getElementsByClassName("wptb-list-item-content");(0<o.length&&(o=o[0]),setTimeout(function(){o.innerHTML=l,WPTB_Helper.listItemsRecalculateIndex(n.parentNode)},5),a!=(t=i.getBoundingClientRect()).top)&&new p(2,i).setParameters(i);(new WPTB_TableStateSaveManager).tableStateSet()},a.style.display="block",m.wptbActions=a}},this.setParameters=function(t){if(!m.wptbActions){var e=document.getElementsByClassName("wptb-actions");0<e.length&&(m.wptbActions=e[0])}m.wptbActions&&(m.wptbActions.style.display="block");var a=t.getBoundingClientRect(),n=document.getElementsByClassName("wptb-container")[0],l=function(){var e=t.getBoundingClientRect();m.wptbActions.style.top=parseFloat(e.top)-15+"px"};n.removeEventListener("scroll",l,!1),m.wptbActions.style.top=parseFloat(a.top)-15+"px",m.wptbActions.style.left=parseFloat(a.right)-parseFloat(m.wptbActions.clientWidth)+1+"px",m.wptbActions.style.display="block",t.classList.add("wptb-directlyhovered"),n.addEventListener("scroll",l,!1)},this.leaveFromField=function(e,t,a){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")))return m.wptbActions||(m.wptbActions=document.getElementsByClassName("wptb-actions")[0]),void(m.wptbActions.onmouseleave=function(e){if(null!=e.relatedTarget&&e.relatedTarget!=m.wptbActions.activeElem&&WPTB_Helper.findAncestor(e.relatedTarget,"wptb-directlyhovered")!=m.wptbActions.activeElem&&(e.target.activeElem.classList.remove("wptb-directlyhovered"),m.wptbActions.style.display="none",2==m.wptbActions.type)){var t=new p;t.addActionField(1,e.relatedTarget.parentNode.parentNode),t.setParameters(e.relatedTarget.parentNode.parentNode)}});t.classList.remove("wptb-directlyhovered"),m.wptbActions.style.display="none",2==m.wptbActions.type&&e.relatedTarget&&"ul"==e.relatedTarget.localName&&(m.addActionField(1,e.relatedTarget.parentNode),m.setParameters(e.relatedTarget.parentNode))},this.actionsRemove=function(){if(!m.wptbActions){var e=document.getElementsByClassName("wptb-actions");0<e.length&&(m.wptbActions=e[0])}m.wptbActions&&m.wptbActions.parentNode.removeChild(m.wptbActions)},this.actionsHide=function(){if(!m.wptbActions){var e=document.getElementsByClassName("wptb-actions");0<e.length&&(m.wptbActions=e[0])}m.wptbActions&&(m.wptbActions.style.opacity=0)}};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)}document.addEventListener("DOMContentLoaded",function(){var e=WPTB_Helper.detectMode();if(e){var a=new XMLHttpRequest,t=ajaxurl+"?action=get_table&id="+e;a.open("GET",t,!0),a.setRequestHeader("Content-type","application/x-www-form-urlencoded"),a.onreadystatechange=function(e){if(4!=this.readyState||200!=this.status);else{var t=JSON.parse(a.responseText);document.getElementById("wptb-setup-name").value=t[0],t[1]?(document.getElementsByClassName("wptb-table-generator")[0].style.display="none",document.getElementsByClassName("wptb-table-setup")[0].appendChild(WPTB_Parser(t[1])),WPTB_Table(),WPTB_LeftPanel(),WPTB_Settings(),(new WPTB_TableStateSaveManager).tableStateSet()):document.getElementsByClassName("wptb-table-generator")[0].style.display="table"}},a.send(null)}else document.getElementsByClassName("wptb-table-generator")[0].style.display="table";document.counter=new ElementCounters,document.select=new MultipleSelect,WPTB_Initializer(),settings=WPTB_Settings()});var WPTB_Button=function(e,t){var a=document.createElement("div"),n=document.createElement("div"),l=document.createElement("a"),r=document.createElement("div"),o=document.createElement("p"),i=void 0,s=!1;if(a.classList.add("wptb-button-container","wptb-size-M","wptb-"),n.classList.add("wptb-button-wrapper"),r.classList.add("wptb-button"),o.innerHTML=null!=e?e:"Button Text",t){var d=t.className.match(/wptb-element-((.+-)\d+)/i);d&&Array.isArray(d)&&(i=d[1],s=!0);var c=[].concat(_toConsumableArray(t.attributes));if(0<c.length)for(var p=0;p<c.length;p++)a.setAttribute(c[p].name,c[p].value);var m=t.querySelector(".wptb-button-wrapper");if(m){var u=[].concat(_toConsumableArray(m.attributes));if(0<u.length)for(var b=0;b<u.length;b++)"style"==u[b].name&&n.setAttribute(u[b].name,u[b].value)}var g=t.querySelector("a");if(g)if(0<(v=[].concat(_toConsumableArray(g.attributes))).length)for(var w=0;w<v.length;w++)"style"!=v[w].name&&"href"!=v[w].name&&"target"!=v[w].name||l.setAttribute(v[w].name,v[w].value);var v,h=t.querySelector(".wptb-button");if(h)if(0<(v=[].concat(_toConsumableArray(h.attributes))).length)for(var y=0;y<v.length;y++)"style"==v[y].name&&r.setAttribute(v[y].name,v[y].value)}return n.appendChild(l),l.appendChild(r),r.appendChild(o),a.appendChild(n),this.kind="button",this.getDOMElement=function(){return a},applyGenericItemSettings(this,i,s),this},WPTB_Cell=function(e,i){if(!i){(i=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)&&(i.style.border=t+"px solid "+jQuery("#wptb-table-border-color").val()),i.classList.add("wptb-droppable","wptb-cell")}i.draggable=!1,e&&(i.onclick=e),WPTB_innerElementSet(i);var s=i.getElementsByClassName("wptb-ph-element");if(0<s.length)for(var a=function(e){var t=i.getElementsByClassName("wptb-space-between");if(0<t.length)for(var a=0;a<t.length;a++)WPTB_Space(t[a]);s[e].getDOMElement=function(){return s[e]},WPTB_innerElementSet(s[e]);var n=s[e].className.match(/wptb-element-((.+-)\d+)/i);if(n&&Array.isArray(n)){var l=n[1].split("-");if(s[e].kind=l[0],applyGenericItemSettings(s[e],n[1]),"list"==s[e].kind){var r=s[e].getElementsByTagName("li");if(0<r.length)for(var o=0;o<r.length;o++)WPTB_ListItem(void 0,r[o])}}},n=0;n<s.length;n++)a(n);return this.getDOMElement=function(){return i},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)},i.getCellDimensions=function(){var e=window.getComputedStyle(this,null),t=e.getPropertyValue("padding-left"),a=e.getPropertyValue("padding-right"),n=e.getPropertyValue("border-left-width"),l=e.getPropertyValue("border-right-width"),r=e.getPropertyValue("padding-top"),o=e.getPropertyValue("padding-bottom"),i=e.getPropertyValue("border-top-width"),s=e.getPropertyValue("border-bottom-width");return{width:parseFloat(this.offsetWidth,10)-parseFloat(t,10)-parseFloat(a,10)-parseFloat(n,10)-parseFloat(l,10),height:parseFloat(this.offsetHeight,10)-parseFloat(r,10)-parseFloat(o,10)-parseFloat(i,10)-parseFloat(s,10)}},this},WPTB_DropHandle=function(i,e){var s=void 0,d=void 0;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");var t=document.createElement("div"),a=document.createElement("div"),n=document.createElement("div"),l=document.createElement("div");t.classList.add("wptb-drop-border-marker-top"),a.classList.add("wptb-drop-border-marker-right"),n.classList.add("wptb-drop-border-marker-bottom"),l.classList.add("wptb-drop-border-marker-left"),d.appendChild(t),d.appendChild(a),d.appendChild(n),d.appendChild(l);var r=document.getElementsByTagName("body");0<r.length&&(r[0].appendChild(s),r[0].appendChild(d)),s.ondragenter=function(){},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);else{var n=s.getDOMParentElement();if(a=n.parentNode,"Above Element"==s.dataset.text)a.insertBefore(t,n);else if("Below Element"==s.dataset.text){var l=n.nextSibling;a.insertBefore(t,l)}}var r=a.parentNode;if(r.classList.contains("wptb-table-head")){var o=WPTB_Helper.findAncestor(r,"wptb-preview-table");WPTB_Helper.dataTitleColumnSet(o)}(s.style.display="none",d.style.display="none",WPTB_innerElementSet(t),console.log(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){var o=void 0;if("td"==i.localName?o=i.parentNode:"div"==i.localName&&i.classList.contains("wptb-ph-element")&&(o=i.parentNode.parentNode),o.classList.contains("wptb-table-head")){for(var c=e.dataTransfer.types,p=!1,m=0;m<c.length;m++){var u=c[m].match(/wptbelindic-([a-z]+)/i);if(u&&"text"!=u[1]){p=!0;break}}if(p)return}s.style.width=i.offsetWidth+"px";var b=i.offsetHeight,g=i.getBoundingClientRect(),w=parseFloat(g.left),v=void 0;if(s.style.left=w+"px",-1!=e.dataTransfer.types.indexOf("wptb-moving-mode")){var h=document.getElementsByClassName("wptb-moving-mode")[0];i==h?(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 y=null==e.offsetY?e.layerY:e.offsetY;v=parseFloat(g.top)-parseFloat(11),s.dataset.text="Above Element",b/2<y&&(v=parseFloat(g.top)+b-1,s.dataset.text="Below Element")}else s.dataset.text="Drop Here",v=parseFloat(g.top)+b/2-5;s.style.top=v+"px",d.style.top=g.top+"px",d.style.left=g.left+"px",wptbDropBorderMarkerTop=d.querySelector(".wptb-drop-border-marker-top"),wptbDropBorderMarkerTop.style.width=parseFloat(i.offsetWidth)-parseFloat(1)+"px",wptbDropBorderMarkerRight=d.querySelector(".wptb-drop-border-marker-right"),wptbDropBorderMarkerRight.style.height=parseFloat(g.bottom)-parseFloat(g.top)-1+"px",wptbDropBorderMarkerRight.style.left=wptbDropBorderMarkerTop.style.width,wptbDropBorderMarkerBottom=d.querySelector(".wptb-drop-border-marker-bottom"),wptbDropBorderMarkerBottom.style.width=wptbDropBorderMarkerTop.style.width,wptbDropBorderMarkerBottom.style.top=wptbDropBorderMarkerRight.style.height,wptbDropBorderMarkerLeft=d.querySelector(".wptb-drop-border-marker-left"),wptbDropBorderMarkerLeft.style.height=wptbDropBorderMarkerRight.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_ElementOptions=function(e,t,a){var n,l=e.getDOMElement();prop=document.querySelector(".wptb-"+e.kind+"-options-prototype").cloneNode(!0),prop.classList.remove("wptb-"+e.kind+"-options-prototype"),n="wptb-options-"+e.kind+"-"+t;for(var r=prop.getElementsByClassName("wptb-element-property"),o=0;o<r.length;o++)r[o].dataset.element=n;if(prop.classList.add(n),document.getElementById("element-options-group").appendChild(prop),a)if("button"==e.kind){var i=document.getElementsByClassName("wptb-element-"+a)[0],s=void 0,d=void 0,c=void 0,p=void 0;if(i&&(p=i.className.match(/wptb-size-([a-z]+)/i)),p&&Array.isArray(p)){var m=prop.getElementsByClassName("wptb-btn-size-btn");for(o=0;o<m.length;o++)m[o].classList.remove("selected"),m[o].innerHTML==p[1]&&m[o].classList.add("selected")}if(i&&(s=i.getElementsByClassName("wptb-button-wrapper"),d=i.getElementsByTagName("a"),c=i.getElementsByClassName("wptb-button")),s){var u=s[0].style.justifyContent,b=prop.querySelector('select[data-type="button-alignment"]').getElementsByTagName("option"),g=void 0;"flex-start"==u?g="left":"center"!=u&&u?"flex-end"==u&&(g="right"):g="center";for(var w=0;w<b.length;w++)b[w].value==g&&(b[w].selected=!0)}if(0<d.length){var v=d[0].getAttribute("href"),h=d[0].getAttribute("target"),y=d[0].getAttribute("id"),f=prop.querySelector('input[data-type="button-link"]'),B=prop.querySelector('input[data-type="button-link-target"]'),S=B.getAttribute("id"),T=B.parentNode.getElementsByTagName("label")[0],E=prop.querySelector('input[data-type="button-id"]');S=S+"-"+a.split("-")[1],B.setAttribute("id",S),T.setAttribute("for",S),f.value=v,h&&"_blank"==h&&(B.checked=!0),E.value=y}if(c){var C=c[0].style.color,x=c[0].style.backgroundColor,_=prop.querySelector('input[data-type="button-text-color"]'),N=prop.querySelector('input[data-type="button-color"]');_.value=WPTB_Helper.rgbToHex(C),N.value=WPTB_Helper.rgbToHex(x)}}else if("image"==e.kind){var I=document.getElementsByClassName("wptb-element-"+a);if(0<I.length){var P=I[0].getElementsByTagName("a");if(0<P.length){var A=P[0];if(A){var k=void 0;k="none"==A.style.float?"center":A.style.float;for(var W=prop.querySelector('select[data-type="image-alignment"]').getElementsByTagName("option"),L=0;L<W.length;L++)W[L].value==k&&(W[L].selected=!0);A.onclick=function(e){e.preventDefault()};var M=A.getAttribute("href"),H=prop.querySelector('input[data-type="image-link"]');M&&(H.value=M);var D=A.getAttribute("target"),q=prop.querySelector('input[data-type="image-link-target"]'),F=q.getAttribute("id"),O=q.parentNode.getElementsByTagName("label")[0];F=F+"-"+a.split("-")[1],q.setAttribute("id",F),O.setAttribute("for",F),D&&"_blank"==D&&(q.checked=!0);var R=A.style.width;if(R){var z=prop.querySelector('input[type="range"][data-type="image-size"]'),j=prop.querySelector('input[type="number"][data-type="image-size"]');z.value=parseInt(R),j.value=parseInt(R)}var Q=A.getElementsByTagName("img");if(0<Q.length){var V=Q[0].getAttribute("alt");prop.querySelector('input[type="text"][data-type="alternative-text"]').value=V}}}}}else if("text"==e.kind){var G=document.getElementsByClassName("wptb-element-"+a);if(0<G.length){var J=G[0].style.fontSize,U=G[0].style.color,Y=prop.querySelector('input[type="range"][data-type="font-size"]'),X=prop.querySelector('input[type="number"][data-type="font-size"]'),K=prop.querySelector('input[type="text"][data-type="color"]');Y.value=parseInt(J)?parseInt(J):10,X.value=parseInt(J)?parseInt(J):10,K.value=WPTB_Helper.rgbToHex(U)}}else if("list"==e.kind){var $=document.getElementsByClassName("wptb-element-"+a);if(0<$.length){var Z=$[0].querySelector("p").style.color;prop.querySelector('input[type="text"][data-type="list-text-color"]').value=WPTB_Helper.rgbToHex(Z);var ee=$[0].querySelectorAll("li");if(0<ee.length){var te=ee[0].querySelector("p").classList;if(0<te.length){var ae=prop.querySelector('select[data-type="list-class"]');if(ae){ae.value="unordered";for(var ne=ae.parentNode.nextSibling,le=0;le<10&&"1"!=ne.nodeType;le++)ne=ne.nextSibling;if(ne){var re=ne.getAttribute("id");ne.setAttribute("id",re+"-"+a),ne.style.display="flex"}var oe=prop.querySelector('select[data-type="list-style-type"]');oe&&(oe.parentNode.style.display="flex",te.contains("wptb-list-style-type-disc")?oe.value="disc":te.contains("wptb-list-style-type-circle")?oe.value="circle":te.contains("wptb-list-style-type-square")?oe.value="square":te.contains("wptb-list-style-type-none")&&(oe.value="none"))}}}var ie=$[0].getElementsByClassName("wptb-list-item-content");if(0<ie.length){for(var se=[],de=0;de<ie.length;de++){var ce=ie[de].querySelector("p");ce&&(ce.style.textAlign?se.push(ce.style.textAlign):se.push("left"))}var pe=0,me=0,ue=0;if(0<se.length)for(var be=0;be<se.length;be++)se[be]&&("left"==se[be]?pe++:"center"==se[be]?me++:"right"==se[be]&&ue++);var ge=prop.querySelector('select[data-type="list-alignment"]'),we=Math.max(pe,me,ue);pe==we?ge.value="left":me==we?ge.value="center":ue==we&&(ge.value="right")}}}else if("star_rating"==e.kind){var ve=document.getElementsByClassName("wptb-element-"+a);if(0<ve.length){var he=(ve=ve[0]).querySelector("li");if(he){var ye=he.style.width,fe=prop.querySelector('input[type="range"][data-type="star-size"]'),Be=prop.querySelector('input[type="number"][data-type="star-size"]');if(fe.value=parseInt(ye)?parseInt(ye):10,Be.value=parseInt(ye)?parseInt(ye):10,he.querySelector("span")){var Se=prop.querySelector('input[type="text"][data-type="star-color"]'),Te=he.querySelector("span").style.fill;Se.value=WPTB_Helper.rgbToHex(Te)}}var Ee=ve.querySelectorAll("li"),Ce=prop.querySelector('input[type="number"][data-type="stars-count"]');1==Ee.length&&"none"==Ee[0].style.display?Ce.value=0:Ce.value=Ee.length;var xe=ve.querySelector(".wptb-success-box");if(xe){var _e=prop.querySelector('input[type="checkbox"][data-type="show-number-rating"]');if("block"==xe.style.display){_e.checked=!0;for(var Ne=prop.getElementsByClassName("wptb-numeral-rating-option-container"),Ie=0;Ie<Ne.length;Ie++)Ne[Ie].style.display="block"}else _e.checked=!1;var Pe=xe.querySelector(".wptb-text-message");if(Pe){var Ae=Pe.style.fontSize,ke=Pe.style.color,We=prop.querySelector('input[type="range"][data-type="numeral-rating-size"]'),Le=prop.querySelector('input[type="number"][data-type="numeral-rating-size"]'),Me=prop.querySelector('input[type="text"][data-type="numeral-rating-color"]');We.value=parseInt(Ae)?parseInt(Ae):10,Le.value=parseInt(Ae)?parseInt(Ae):10,Me.value=WPTB_Helper.rgbToHex(ke)}}}}if(l.onclick=function(){var e=this.className.match(/wptb-element-((.+-)\d+)/i),t=".wptb-"+e[2]+"options.wptb-options-"+e[1];document.getElementsByClassName("wptb-elements-container")[0].style.display="none",document.getElementsByClassName("wptb-settings-section")[0].style.display="none",document.getElementById("element-options-group").style.display="block";for(var a=document.getElementById("element-options-group").childNodes,n=0;n<a.length;n++)a[n].style&&(a[n].style.display="none");document.querySelector(t).style.display="block"},"button"==e.kind){var He=prop.getElementsByClassName("wptb-btn-size-btn");for(o=0;o<He.length;o++)He[o].onclick=function(){var e=this.innerHTML,t=this.dataset.element.match(/wptb-options-(.+)-(\d+)/i),a=t[1],n=t[2],l=document.getElementsByClassName("wptb-element-"+a+"-"+n)[0];l.classList.remove("wptb-size-S"),l.classList.remove("wptb-size-M"),l.classList.remove("wptb-size-L"),l.classList.remove("wptb-size-XL"),l.classList.add("wptb-size-"+e);for(var r=this.parentNode.getElementsByClassName("wptb-btn-size-btn"),o=0;o<r.length;o++)r[o].classList.remove("selected");this.classList.add("selected"),(new WPTB_TableStateSaveManager).tableStateSet()}}var De=prop.getElementsByClassName("wptb-element-property");for(o=0;o<De.length;o++){if(De[o].classList.contains("wptb-color-picker")&&jQuery(De[o]).wpColorPicker({change:function(e,t){WPTB_Helper.wpColorPickerChange(e,t),WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving(e)},clear:function(e){WPTB_Helper.wpColorPickerChange(e)}}),De[o].classList.contains("wptb-stars-count-field")&&WPTB_Helper.numberImputSize(De[o],1,10),"font-size"===De[o].dataset.type||"image-size"===De[o].dataset.type||"star-size"===De[o].dataset.type||"numeral-rating-size"===De[o].dataset.type)De[o].parentNode.parentNode.getElementsByClassName("wptb-size-slider")[0].oninput=function(){this.parentNode.parentNode.getElementsByClassName("wptb-size-number")[0].value=this.value,this.parentNode.parentNode.getElementsByClassName("wptb-size-number")[0].onchange(event)};De[o].onchange=function(e){var t=this.dataset.element.match(/wptb-options-(.+)-(\d+)/i),a=t[1],n=t[2],l=document.getElementsByClassName("wptb-element-"+a+"-"+n)[0],r=this.value;switch(this.dataset.type){case"src":l.getElementsByTagName("img")[0].src=this.value;break;case"alternative-text":l.getElementsByTagName("img")[0].alt=this.value;break;case"image-link":l.getElementsByTagName("a")[0].href=WPTB_Helper.linkHttpCheckChange(this.value);break;case"image-link-target":1==this.checked?l.getElementsByTagName("a")[0].target="_blank":l.getElementsByTagName("a")[0].target="_self";break;case"image-link-nofollow":1==this.checked?l.getElementsByTagName("a")[0].rel="nofollow":l.getElementsByTagName("a")[0].removeAttribute("rel");break;case"image-size":l.getElementsByTagName("a")[0].style.width=this.value+"%",l.getElementsByTagName("a")[0].style.height="auto",this.parentNode.parentNode.getElementsByClassName("wptb-size-slider")[0].value=this.value;break;case"image-alignment":var o="";o="center"==this.value?"none":this.value,l.querySelector(".wptb-image-wrapper a").style.float=o;break;case"font-size":l.style.fontSize=r+"px",this.parentNode.parentNode.getElementsByClassName("wptb-size-slider")[0].value=this.value;break;case"button-alignment":var i="";i="left"==this.value?"start":"right"==this.value?"flex-end":"center",l.getElementsByClassName("wptb-button-wrapper")[0].style.justifyContent=i;break;case"button-link":this.value?l.getElementsByTagName("a")[0].href=WPTB_Helper.linkHttpCheckChange(this.value):l.getElementsByTagName("a")[0].removeAttribute("href");break;case"button-link-target":1==this.checked?l.getElementsByTagName("a")[0].target="_blank":l.getElementsByTagName("a")[0].target="_self";break;case"button-link-nofollow":1==this.checked?l.getElementsByTagName("a")[0].rel="nofollow":l.getElementsByTagName("a")[0].removeAttribute("rel");break;case"button-id":this.value?l.getElementsByTagName("a")[0].id=this.value:l.getElementsByTagName("a")[0].removeAttribute("id");case"button-color":break;case"list-alignment":for(var s=l.querySelectorAll("li"),d=0;d<s.length;d++){var c=s[d].querySelector("p");c&&(c.style.textAlign=this.value)}break;case"list-class":var p=e.target.parentNode.parentNode.querySelector("[data-type=list-style-type]").parentNode,m=p.parentNode;if("unordered"==r){p.style.display="flex",m.querySelector(".wptb-list-icon-select-label").style.display="flex";var u=l.querySelectorAll("li");for(d=0;d<u.length;d++){var b=u[d].querySelector("p");b.removeAttribute("class"),b.classList.add("wptb-list-style-type-disc")}m.querySelector("[data-type=list-style-type]").value="disc"}else{p.style.display="none",m.querySelector(".wptb-list-icon-select-label").style.display="none";var g=l.querySelectorAll("li");for(d=0;d<g.length;d++){g[d].querySelector("p").removeAttribute("class")}}break;case"list-style-type":for(g=l.querySelectorAll("li"),d=0;d<g.length;d++){var w=g[d].querySelector("p");w.removeAttribute("class"),w.classList.add("wptb-list-style-type-"+r.toLowerCase())}break;case"star-size":for(var v=l.querySelectorAll("li"),h=0;h<v.length;h++){v[h].style.width=r+"px",v[h].style.height=r+"px";for(var y=v[h].querySelectorAll("span"),f=0;f<y.length;f++)y[f].querySelector("svg")&&(y[f].style.width=r+"px",y[f].style.height=r+"px",y[f].querySelector("svg").style.width=r+"px")}break;case"show-number-rating":var B=WPTB_Helper.findAncestor(this,"wptb-star_rating-options").getElementsByClassName("wptb-numeral-rating-option-container");if(WPTB_Helper.starRatingTextMessageChenge(l),0<B.length){var S=l.querySelector(".wptb-text-message"),T=this.checked?"checked":"unchecked";if("checked"==T){for(var E=0;E<B.length;E++)B[E].style.display="block";S.parentNode.style.display="block"}else if("unchecked"==T){for(var C=0;C<B.length;C++)B[C].style.display="none";S.parentNode.style.display="none"}}break;case"numeral-rating-size":var x=l.querySelector(".wptb-text-message");x.style.fontSize=r+"px",x.style.height=r+"px",x.style.lineHeight=r+"px";break;case"stars-count":var _=l.querySelectorAll("li"),N=_.length;if(N<r)for(var I=r-N,P=_[_.length-1],A=P.parentNode,k=0;k<I;k++){var W=P.cloneNode(!0);W.removeAttribute("class"),W.setAttribute("class","wptb-rating-star"),W.dataset.value=parseInt(P.dataset.value)+k+1,WPTB_Helper.starRatingEventHandlersAdd(W),A.appendChild(W)}else if(r<N){var L=parseInt(N)-parseInt(r);0==r&&(L--,_[0].removeAttribute("class"),_[0].setAttribute("class","wptb-rating-star"),_[0].style.display="none");var M=_.length;for(d=0;d<L;d++)_[0].parentNode.removeChild(_[M-d-1])}else r==N&&1==N&&(_[0].style.display="inline-block");WPTB_Helper.starRatingTextMessageChenge(l)}e.target.classList.contains("wptb-size-slider")||e.target.classList.contains("wptb-size-slider")?e.target.onmouseup=function(){(new WPTB_TableStateSaveManager).tableStateSet()}:(new WPTB_TableStateSaveManager).tableStateSet()}}},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){return(e=e.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i))&&4===e.length?"#"+("0"+parseInt(e[1],10).toString(16)).slice(-2)+("0"+parseInt(e[2],10).toString(16)).slice(-2)+("0"+parseInt(e[3],10).toString(16)).slice(-2):""},getDragImageCustom:function(e){var t=location.protocol+"//"+location.hostname,a=document.createElement("img");return a.src=t+"/wp-content/plugins/wp-table-builder/inc/admin/views/builder/icons/"+e+".png",a},dragImagesArr:function(){return{text:WPTB_Helper.getDragImageCustom("text"),image:WPTB_Helper.getDragImageCustom("image"),button:WPTB_Helper.getDragImageCustom("button"),list:WPTB_Helper.getDragImageCustom("list"),star_rating:WPTB_Helper.getDragImageCustom("half-filled-rating-star")}},listItemsRecalculateIndex:function(e){var t=e.querySelectorAll("p");if(0<t.length)for(var a=0;a<t.length;a++)t[a].dataset.listStyleTypeIndex=Number(a)+1+"."},listItemsTinyMceInit:function(e){tinyMCE.init({target:e,inline:!0,plugins:"link, paste",dialog_type:"modal",theme:"modern",menubar:!1,fixed_toolbar_container:"#wpcd_fixed_toolbar",paste_as_text:!0,toolbar:"bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify",setup:function(e){e.on("keydown",function(e){var t=e.target.parentNode;if(13==e.keyCode){e.preventDefault();var a=e.target.innerHTML,n=new WPTB_ListItem(a,t,!0);return t.parentNode.insertBefore(n.getDOMElement(),t),WPTB_Helper.listItemsTinyMceInit(n.getDOMElement().firstChild),e.target.querySelector("p").innerText="New List Item",void WPTB_Helper.listItemsRecalculateIndex(t.parentNode)}if("8"==e.keyCode||"46"==e.keyCode){var l=e.target.querySelector("p").innerHTML.replace(/<[^>]+>/g,"");if(""==(l=(l=l.replace(/\s+/g," ").trim()).replace(/ /g,"").trim()))e.preventDefault(),e.target.querySelector("p").innerText="\n";else{var r=WPTB_Helper.getSelectionText();(r=(r=r.replace(/\s+/g," ").trim()).replace(/ /g,"").trim())==l&&(e.preventDefault(),e.target.querySelector("p").innerText="\n")}}var o=e.target.parentNode,i=new WPTB_ActionsField;i.addActionField(2,o),i.setParameters(o)}),e.on("keyup",function(e){var t=e.target.parentNode,a=new WPTB_ActionsField;a.addActionField(2,t),a.setParameters(t),e.target.onblur=function(){(new WPTB_TableStateSaveManager).tableStateSet()}})},init_instance_callback:function(e){(window.currentEditor=e).on("focus",function(e){var t=document.getElementsByClassName("wptb-builder-panel")[0].offsetWidth;window.currentEditor&&55<=document.getElementById("wptb_builder").scrollTop&&"none"!=window.currentEditor.bodyElement.style.display?(document.getElementById("wpcd_fixed_toolbar").style.position="fixed",document.getElementById("wpcd_fixed_toolbar").style.right=t/2-document.getElementById("wpcd_fixed_toolbar").offsetWidth/2+"px",document.getElementById("wpcd_fixed_toolbar").style.top="100px"):(document.getElementById("wpcd_fixed_toolbar").style.position="static",delete document.getElementById("wpcd_fixed_toolbar").style.right,delete document.getElementById("wpcd_fixed_toolbar").style.top)})}})},buttonsTinyMceInit:function(n){tinyMCE.init({target:n,inline:!0,plugins:"link",dialog_type:"modal",theme:"modern",menubar:!1,fixed_toolbar_container:"#wpcd_fixed_toolbar",toolbar:"bold italic strikethrough",setup:function(e){e.on("keydown",function(e){13==e.keyCode&&e.preventDefault();var t=WPTB_Helper.findAncestor(n,"wptb-button-container"),a=new WPTB_ActionsField;a.addActionField(1,t),a.setParameters(t)}),e.on("keyup",function(e){var t=WPTB_Helper.findAncestor(n,"wptb-button-container"),a=new WPTB_ActionsField;a.addActionField(1,t),a.setParameters(t),e.target.onblur=function(){(new WPTB_TableStateSaveManager).tableStateSet()}})},init_instance_callback:function(e){(window.currentEditor=e).on("focus",function(e){var t=document.getElementsByClassName("wptb-builder-panel")[0].offsetWidth;window.currentEditor&&55<=document.getElementById("wptb_builder").scrollTop&&"none"!=window.currentEditor.bodyElement.style.display?(document.getElementById("wpcd_fixed_toolbar").style.position="fixed",document.getElementById("wpcd_fixed_toolbar").style.right=t/2-document.getElementById("wpcd_fixed_toolbar").offsetWidth/2+"px",document.getElementById("wpcd_fixed_toolbar").style.top="100px"):(document.getElementById("wpcd_fixed_toolbar").style.position="static",delete document.getElementById("wpcd_fixed_toolbar").style.right,delete document.getElementById("wpcd_fixed_toolbar").style.top)})}})},linkHttpCheckChange:function(e){if(e){if(-1!=e.indexOf("http://")||-1!=e.indexOf("https://"))return e;var t=e.split("/"),a=void 0;return Array.isArray(t)&&0<t.length&&(a=t[t.length-1]),document.location.protocol+"//"+a}return""},dataTitleColumnSet:function(e){for(var t=e.rows,a=t[0],n=getComputedStyle(a),l=a.children,r={},o=0;o<l.length;o++){for(var i=l[o].children,s=0;s<i.length;s++){var d=i[s];if(d.classList.contains("wptb-ph-element"))if("text"==d.className.match(/wptb-element-(.+)-(\d+)/i)[1]){var c=d.querySelector("p"),p=c.textContent,m=c.style.textAlign;r[l[o].dataset.xIndex]=[p,d.style.fontSize,d.style.color,n.backgroundColor,m];break}}r[l[o].dataset.xIndex]||(r[l[o].dataset.xIndex]=["","","",n.backgroundColor,""])}for(var u=1;u<t.length;u++)for(var b=t[u].children,g=0;g<b.length;g++)r[b[g].dataset.xIndex]?(b[g].dataset.wptbTitleColumn=r[b[g].dataset.xIndex][0],b[g].dataset.wptbTitleColumnFontSize=r[b[g].dataset.xIndex][1],b[g].dataset.wptbTitleColumnColor=r[b[g].dataset.xIndex][2],b[g].dataset.wptbTitleBackgroundColor=r[b[g].dataset.xIndex][3],b[g].dataset.wptbTitleAlign=r[b[g].dataset.xIndex][4]):(b[g].dataset.wptbTitleColumn="",b[g].dataset.wptbTitleColumnFontSize="",b[g].dataset.wptbTitleColumnColor="",b[g].dataset.wptbTitleBackgroundColor="",b[g].dataset.wptbTitleAlign="")},findAncestor:function(e,t){for(;(e=e.parentElement)&&!e.classList.contains(t););return e},getSelectionText:function(){return window.getSelection?window.getSelection().toString():document.selection.createRange().text},settingsPanelClear:function(){document.getElementById("wptb-adaptive-table-checkbox").checked=!1,document.getElementById("wptb-top-row-as-header").checked=!1,document.getElementById("wptb-table-border-slider").value=0,document.getElementById("wptb-table-border-number").value=0,document.getElementById("wptb-inner-border-check").checked=!1,document.getElementById("wptb-apply-inner-border").classList.remove("visible"),document.getElementById("wptb-table-inner-border-slider").value=1,document.getElementById("wptb-table-inner-border-number").value=1,WPTB_Helper.wpColorPickerClear("wptb-table-border-color",!0),WPTB_Helper.wpColorPickerClear("wptb-table-header-bg",!0),WPTB_Helper.wpColorPickerClear("wptb-even-row-bg",!0),WPTB_Helper.wpColorPickerClear("wptb-odd-row-bg",!0),document.getElementById("wptb-table-cell-slider").value=15,document.getElementById("wptb-table-cell-number").value=15},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{var t=WPTB_Helper.findAncestor(e.target,"wp-picker-container");if(t)if("square"==e.originalEvent.type){var a=t.getElementsByClassName("iris-square-handle");0<a.length&&((a=a[0]).onmouseup=function(){(new WPTB_TableStateSaveManager).tableStateSet()})}else if("strip"==e.originalEvent.type){var n=t.getElementsByClassName("iris-slider-offset");0<n.length&&((n=n[0]).onmouseup=function(){(new WPTB_TableStateSaveManager).tableStateSet()})}}},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 l=WPTB_Helper.findAncestor(a[n],"wp-picker-container");if(l){var r=l.parentNode;r.removeChild(l);var o=document.createElement("input");t?o.setAttribute("id",e):o.classList.add("wptb-element-property",e),o.value="",r.appendChild(o)}}},detectMode:function(){var e=window.location.href,t=new RegExp("[?&]table(=([^&#]*)|&|#|$)").exec(e);return!!t&&(t[2]?decodeURIComponent(t[2].replace(/\+/g," ")):"")},getColumnWidth:function(e,t){for(var a=t.dataset.xIndex,n=e.querySelectorAll('[data-x-index="'+a+'"]'),l=t.getCellDimensions().width,r=0;r<n.length;r++)l>n[r].getCellDimensions().width&&(l=n[r].getCellDimensions().width);return l},getRowHeight:function(e,t){for(var a=t.dataset.yIndex,n=e.querySelectorAll('[data-y-index="'+a+'"]'),l=t.getCellDimensions().height,r=0;r<n.length;r++)l>n[r].getCellDimensions().height&&(l=n[r].getCellDimensions().height);return l},newElementProxy:function(e){return"list"==e?new WPTB_List:"image"==e?new WPTB_Image:"text"==e?new WPTB_Text:"button"==e?new WPTB_Button:"star_rating"==e?new WPTB_StarRating:void 0},wpColorPickerChange:function(e,t){var a=void 0;a=t?t.color.toString():"";var n,l,r,o=WPTB_Helper.findAncestor(e.target,"wp-picker-input-wrap").getElementsByClassName("wptb-color-picker")[0];l=(n=o.dataset.element.match(/wptb-options-(.+)-(\d+)/i))[1],r=n[2];var i=document.getElementsByClassName("wptb-element-"+l+"-"+r)[0];if("button"==l)"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"==l){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"==l){if("star-color"==o.dataset.type)for(var c=i.querySelectorAll("li"),p=0;p<c.length;p++)for(var m=c[p].getElementsByTagName("span"),u=0;u<m.length;u++)m[u].style.fill=a;else if("numeral-rating-color"==o.dataset.type){i.querySelector(".wptb-text-message").style.color=a}}else i.style.color=a},starRatingSelectHoverSet:function(e){var t=void 0;t=e.target.classList.contains("wptb-rating-star")?e.target:WPTB_Helper.findAncestor(e.target,"wptb-rating-star");var a=parseInt(t.dataset.value,10),n=t.parentNode.children;if("mouseover"==e.type)for(var l=0;l<n.length;l++)l<a?l==a-1?e.target.classList.contains("wptb-rating-star-left-signal-part")?(n[l].classList.add("wptb-rating-star-hover-half"),n[l].classList.remove("wptb-rating-star-hover-full")):e.target.classList.contains("wptb-rating-star-right-signal-part")&&(n[l].classList.add("wptb-rating-star-hover-full"),n[l].classList.remove("wptb-rating-star-hover-half")):(n[l].classList.add("wptb-rating-star-hover-full"),n[l].classList.remove("wptb-rating-star-hover-half")):(n[l].classList.remove("wptb-rating-star-hover-full"),n[l].classList.remove("wptb-rating-star-hover-half"));else if("click"==e.type)for(var r=0;r<n.length;r++)r<a?r==a-1?e.target.classList.contains("wptb-rating-star-left-signal-part")?(n[r].classList.add("wptb-rating-star-selected-half"),n[r].classList.remove("wptb-rating-star-selected-full")):e.target.classList.contains("wptb-rating-star-right-signal-part")&&(n[r].classList.add("wptb-rating-star-selected-full"),n[r].classList.remove("wptb-rating-star-selected-half")):(n[r].classList.add("wptb-rating-star-selected-full"),n[r].classList.remove("wptb-rating-star-selected-half")):(n[r].classList.remove("wptb-rating-star-selected-full"),n[r].classList.remove("wptb-rating-star-selected-half"))},starRatingEventHandlersAdd:function(e){e.onmouseover=function(e){e.stopPropagation(),WPTB_Helper.starRatingSelectHoverSet(e)},e.onmouseout=function(){for(var e=this.parentNode.children,t=0;t<e.length;t++)e[t].classList.remove("wptb-rating-star-hover-half"),e[t].classList.remove("wptb-rating-star-hover-full")},e.onclick=function(e){WPTB_Helper.starRatingSelectHoverSet(e);var t=WPTB_Helper.findAncestor(e.target,"wptb-star_rating-container");WPTB_Helper.starRatingTextMessageChenge(t),new WPTB_ActionsField(1,t).setParameters(t),(new WPTB_TableStateSaveManager).tableStateSet()}},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;e=String(e),a<e&&(this.value=a)}},starRatingTextMessageChenge:function(e){var t=e.getElementsByClassName("wptb-rating-star-selected-full").length;0<e.getElementsByClassName("wptb-rating-star-selected-half").length&&(t=parseInt(t)+.5);var a=e.querySelectorAll("li"),n=a.length,l=e.querySelector(".wptb-text-message");1!=n||"none"!=a[0].style.display?l.innerHTML=t+"/"+n:l.innerHTML=""}},WPTB_Image=function(e,t){var a=void 0,n=void 0,l=void 0,r=!1;if(null==t){a=document.createElement("div"),n=document.createElement("div");var o=document.createElement("a"),i=document.createElement("img");o.style.display="block",o.appendChild(i),a.classList.add("wptb-image-container"),n.classList.add("wptb-image-wrapper"),n.appendChild(o),a.appendChild(n),o.onclick=function(e){e.preventDefault()},file_frame=wp.media.frames.file_frame=wp.media({title:"Select a image to upload",button:{text:"Use this image"},multiple:!1}),file_frame.on("select",function(){attachment=file_frame.state().get("selection").first().toJSON();var e=attachment.url.split(":"),t=void 0;Array.isArray(e)&&0<e.length&&(t=e[e.length-1]),i.src=t,i.height=attachment.height,i.width=attachment.width,i.style.width="100%",(new WPTB_TableStateSaveManager).tableStateSet()}),null==e?file_frame.open():i.src=e}else{(a=t.cloneNode(!0)).getElementsByTagName("a")[0].onclick=function(e){e.preventDefault()};var s=t.className.match(/wptb-element-((.+-)\d+)/i);s&&Array.isArray(s)&&(l=s[1],r=!0)}return this.kind="image",this.getDOMElement=function(){return a},applyGenericItemSettings(this,l,r),this},WPTB_Initializer=function(){var e=document.body;columnsDecrementButton=e.getElementsByClassName("wptb-input-number-decrement")[0],columnsIncrementButton=e.getElementsByClassName("wptb-input-number-increment")[0],rowsDecrementButton=e.getElementsByClassName("wptb-input-number-decrement")[1],rowsIncrementButton=e.getElementsByClassName("wptb-input-number-increment")[1],columnsInput=document.getElementById("wptb-columns-number"),rowsInput=document.getElementById("wptb-rows-number"),columnsDecrementButton.onclick=function(){1<columnsInput.value&&columnsInput.value--},columnsIncrementButton.onclick=function(){columnsInput.value<30&&columnsInput.value++},rowsDecrementButton.onclick=function(){1<rowsInput.value&&rowsInput.value--},rowsIncrementButton.onclick=function(){rowsInput.value<30&&rowsInput.value++},document.getElementById("wptb-generate-table").onclick=function(){var e=document.getElementById("wptb-columns-number").value,t=document.getElementById("wptb-rows-number").value;WPTB_Table(e,t),(new WPTB_TableStateSaveManager).tableStateSet()}},WPTB_LeftPanel=function(){var e,t,a,n,r=document.getElementsByClassName("wptb-preview-table")[0],l=document.getElementsByClassName("wptb-element");function o(e,t){if(!(3<t)&&r){var a=r.getElementsByTagName("tr");if(a.length>t){var n=a[t].style.backgroundColor,l=document.getElementById(e);l&&n&&(l.value=WPTB_Helper.rgbToHex(n))}}}function i(e){for(var t=r.getElementsByTagName("td"),a=0;a<t.length;a++)t[a].style.borderWidth=document.querySelector("#wptb-table-inner-border-number").value+"px",t[a].style.borderStyle="solid"}function s(e){for(var t=r.getElementsByTagName("td"),a=0;a<t.length;a++)t[a].style.padding=e+"px"}function d(e){r.style.borderWidth=e+"px",r.style.borderStyle="solid"}o("wptb-even-row-bg",1),jQuery("#wptb-even-row-bg").wpColorPicker({change:function(e,t){for(var a=r.getElementsByTagName("tr"),n=1;n<a.length;n+=2)a[n].style.backgroundColor=t.color.toString();console.log(e),console.log(this),WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving(e)},clear:function(){for(var e=r.getElementsByTagName("tr"),t=1;t<e.length;t+=2){e[t].style.backgroundColor="";for(var a=e[t].getElementsByTagName("td"),n=0;n<a.length;n++)a[n].style.backgroundColor=""}(new WPTB_TableStateSaveManager).tableStateSet()}}),o("wptb-odd-row-bg",2),jQuery("#wptb-odd-row-bg").wpColorPicker({change:function(e,t){for(var a=r.getElementsByTagName("tr"),n=2;n<a.length;n+=2)a[n].style.backgroundColor=t.color.toString();WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving(e)},clear:function(){for(var e=r.getElementsByTagName("tr"),t=2;t<e.length;t+=2){e[t].style.backgroundColor="";for(var a=e[t].getElementsByTagName("td"),n=0;n<a.length;n++)a[n].style.backgroundColor=""}(new WPTB_TableStateSaveManager).tableStateSet()}}),o("wptb-table-header-bg",0),jQuery("#wptb-table-header-bg").wpColorPicker({change:function(e,t){r.getElementsByTagName("tr")[0].style.backgroundColor=t.color.toString(),(new WPTB_TableStateSaveManager).tableStateSet()},clear:function(){var e=r.getElementsByTagName("tr")[0];e.style.backgroundColor="";for(var t=e.getElementsByTagName("td"),a=0;a<t.length;a++)t[a].style.backgroundColor="";WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving(event)}}),e=r,t=document.getElementById("wptb-adaptive-table-checkbox"),e&&e.dataset.wptbAdaptiveTable&&"1"==e.dataset.wptbAdaptiveTable?t.checked=!0:t.checked=!1,a=r,n=document.getElementById("wptb-top-row-as-header"),a&&a.classList.contains("wptb-table-preview-head")?n.checked=!0:n.checked=!1,function(){var e=document.getElementsByClassName("wptb-preview-table");if(0<e.length){var t=e[0].style.borderColor;if(t){var a=document.getElementById("wptb-table-border-color");a&&(a.value=WPTB_Helper.rgbToHex(t))}var n=e[0].style.borderWidth;if(n){var l=document.getElementById("wptb-table-border-slider"),r=document.getElementById("wptb-table-border-number");l&&(l.value=parseInt(n)),r&&(r.value=parseInt(n))}var o=e[0].querySelector("td").style.borderWidth;if(o){var i=document.getElementById("wptb-inner-border-check"),s=document.getElementById("wptb-apply-inner-border");if(o&&0<parseInt(o)){if(i&&(i.checked=!0,s)){s.classList.add("visible");var d=document.getElementById("wptb-table-inner-border-slider"),c=document.getElementById("wptb-table-inner-border-number");d.value=parseInt(o),c.value=parseInt(o)}}else i.checked=!1}(n&&0<parseInt(n)||o&&0<parseInt(o))&&(document.getElementById("wptb-table-border-color-set-area").style.display="")}}(),jQuery("#wptb-table-border-color").wpColorPicker({change:function(e,t){var a=r.getElementsByTagName("td");r.style.border=document.querySelector("#wptb-table-border-number").value+"px solid "+t.color.toString();for(var n=0;n<a.length;n++){var l=document.querySelector("#wptb-table-inner-border-number").value;document.getElementById("wptb-inner-border-check").checked&&(a[n].style.border=(0!=l?l:1)+"px solid "+t.color.toString())}WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving(e)},clear:function(){var e=r.getElementsByTagName("td");r.style.borderColor="";for(var t=0;t<e.length;t++)e[t].style.borderColor="";(new WPTB_TableStateSaveManager).tableStateSet()}}),function(){var e=document.getElementsByClassName("wptb-preview-table");if(0<e.length){var t=e[0].querySelector("td");if(t){var a=t.style.padding;if(a){var n=document.getElementById("wptb-table-cell-slider"),l=document.getElementById("wptb-table-cell-number");n&&(n.value=parseInt(a)),l&&(l.value=parseInt(a))}}}}();var c=document.getElementById("wptb-table-border-number");WPTB_Helper.numberImputSize(c,1,50);var p=document.getElementById("wptb-table-inner-border-number");WPTB_Helper.numberImputSize(p,1,50);var m=document.getElementById("wptb-table-cell-number");WPTB_Helper.numberImputSize(m,1,50);var u=document.getElementById("wptb-size-number");WPTB_Helper.numberImputSize(u,1,50);var b=document.getElementById("wptb-size-number");WPTB_Helper.numberImputSize(b,2,100);var g=document.getElementById("wptb-table-column-width-number");WPTB_Helper.numberImputSize(g,2,500);var w=document.getElementById("wptb-table-row-height-number");WPTB_Helper.numberImputSize(w,2,200),document.getElementById("wptb-table-cell-slider").oninput=function(){document.getElementById("wptb-table-cell-number").value=this.value,s(this.value),r.tdDefaultWidth()},document.getElementById("wptb-table-cell-slider").onchange=function(){(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-cell-number").onchange=function(){document.getElementById("wptb-table-cell-slider").value=this.value,s(this.value),r.tdDefaultWidth(),(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-border-slider").oninput=function(){document.getElementById("wptb-table-border-number").value=this.value,d(this.value),r.tdDefaultWidth();var e=document.getElementById("wptb-inner-border-check").checked,t=document.getElementById("wptb-table-border-color-set-area");0==this.value&&0==e?t.style.display="none":t.style.display=""},document.getElementById("wptb-table-border-slider").onchange=function(){(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-border-number").onchange=function(){document.getElementById("wptb-table-border-slider").value=this.value,d(this.value),r.tdDefaultWidth(),(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-inner-border-slider").oninput=function(){document.getElementById("wptb-table-inner-border-number").value=this.value,i(this.value),r.tdDefaultWidth()},document.getElementById("wptb-table-inner-border-slider").onchange=function(){(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-inner-border-number").onchange=function(){document.getElementById("wptb-table-inner-border-slider").value=this.value,i(this.value),r.tdDefaultWidth(),(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-inner-border-check").onchange=function(){if(r){var e=this.checked?"checked":"unchecked";!function(e){var t=null!=document.querySelector("#wptb-table-border-color").value?document.querySelector("#wptb-table-border-color").value:"rgb(0,0,0)";0!=document.querySelector("#wptb-table-inner-border-slider").value&&0!=document.querySelector("#wptb-table-inner-border-number").value||(document.querySelector("#wptb-table-inner-border-slider").value=1,document.querySelector("#wptb-table-inner-border-number").value=1);var a=document.querySelector("#wptb-table-inner-border-slider").value+"px",n=document.getElementsByClassName("wptb-preview-table");if(0<n.length)if("checked"==e){document.getElementById("wptb-apply-inner-border").style.marginBottom="0px";for(var l=n[0].getElementsByTagName("td"),r=0;r<l.length;r++)l[r].style.border=a+" solid "+t;document.getElementById("wptb-apply-inner-border").classList.add("visible")}else for(document.getElementById("wptb-apply-inner-border").classList.remove("visible"),l=n[0].getElementsByTagName("td"),r=0;r<l.length;r++)l[r].style.border="0px solid "+t,l[r].style.border=null}(e);var t=document.getElementById("wptb-table-border-slider").value,a=document.getElementById("wptb-table-border-color-set-area");a.style.display="unchecked"==e&&0==t?"none":"",(new WPTB_TableStateSaveManager).tableStateSet()}},document.getElementById("wptb-table-column-width-slider").oninput=function(){document.getElementById("wptb-table-column-width-number").value=this.value,r.addColumnWidth(this.value)},document.getElementById("wptb-table-column-width-slider").onchange=function(){(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-column-width-number").onchange=function(){document.getElementById("wptb-table-column-width-slider").value=this.value,r.addColumnWidth(this.value),(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-column-width-auto-fixed").onchange=function(){if(this.checked){var e=r.querySelector(".wptb-highlighted"),t=WPTB_Helper.getColumnWidth(r,e);r.addColumnWidth(t)}else{r.addColumnWidth(!1,!0);var a=r.querySelector(".wptb-highlighted"),n=WPTB_Helper.getColumnWidth(r,a);document.getElementById("wptb-table-column-width-number").value=n,document.getElementById("wptb-table-column-width-slider").value=n}(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-row-height-slider").oninput=function(){document.getElementById("wptb-table-row-height-number").value=this.value,r.addRowHeight(this.value)},document.getElementById("wptb-table-row-height-slider").onchange=function(){(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-row-height-number").onchange=function(){document.getElementById("wptb-table-row-height-slider").value=this.value,r.addRowHeight(this.value),(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-row-height-auto-fixed").onchange=function(){if(this.checked){var e=r.querySelector(".wptb-highlighted"),t=WPTB_Helper.getRowHeight(r,e);r.addRowHeight(t)}else{r.addRowHeight(!1,!0);var a=r.querySelector(".wptb-highlighted"),n=WPTB_Helper.getRowHeight(r,a);document.getElementById("wptb-table-row-height-number").value=n,document.getElementById("wptb-table-row-height-slider").value=n}(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-adaptive-table-checkbox").onchange=function(){this.checked?r.dataset.wptbAdaptiveTable=1:r.dataset.wptbAdaptiveTable=0,(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-top-row-as-header").onchange=function(){!function(e,t){if(t.checked)WPTB_Helper.dataTitleColumnSet(e),e.classList.add("wptb-table-preview-head"),e.rows[0].classList.add("wptb-table-head");else{var a=e.rows;e.classList.remove("wptb-table-preview-head"),a[0].classList.remove("wptb-table-head");for(var n=1;n<a.length;n++)for(var l=a[n].children,r=0;r<l.length;r++)l[r].removeAttribute("data-wptb-title-column"),l[r].removeAttribute("data-wptb-title-column-font-size"),l[r].removeAttribute("data-wptb-title-column-color"),l[r].removeAttribute("data-wptb-title-background-color"),l[r].removeAttribute("data-wptb-title-align")}}(r,this),(new WPTB_TableStateSaveManager).tableStateSet()};for(var v=0;v<l.length;v++)l[v].ondragstart=function(e){e.dataTransfer.setData("wptbElement",this.dataset.wptbElement),e.dataTransfer.setData("wptbElIndic-"+this.dataset.wptbElement,"wptbElIndic-"+this.dataset.wptbElement)};r&&(document.getElementById("wptb-activate-cell-management-mode").onclick=r.toggleTableEditMode,document.getElementById("wptb-table-edit-mode-close").onclick=r.toggleTableEditMode,document.getElementById("wptb-left-scroll-panel-curtain-close").onclick=r.toggleTableEditMode,document.getElementById("wptb-add-end-row").onclick=r.addRowToTheEnd,document.getElementById("wptb-add-start-row").onclick=r.addRowToTheStart,document.getElementById("wptb-add-row-before").onclick=r.addRowBefore,document.getElementById("wptb-add-row-after").onclick=r.addRowAfter,document.getElementById("wptb-add-end-column").onclick=r.addColumnEnd,document.getElementById("wptb-add-start-column").onclick=r.addColumnStart,document.getElementById("wptb-add-column-before").onclick=r.addColumnBefore,document.getElementById("wptb-add-column-after").onclick=r.addColumnAfter,document.getElementById("wptb-delete-column").onclick=r.deleteColumn,document.getElementById("wptb-delete-row").onclick=r.deleteRow,document.getElementById("wptb-merge-cells").onclick=r.mergeCells,document.getElementById("wptb-split-cell").onclick=r.splitCell),document.querySelector(".wptb-left-panel-extend").onclick=function(){var e=document.querySelector(".wptb-container");e&&(e.classList.contains("collapsed")?e.classList.remove("collapsed"):e.classList.add("collapsed"))},document.getElementsByClassName("wptb-builder-panel")[0].onclick=function(e){e.target.classList.contains("wptb-ph-element")||WPTB_Helper.findAncestor(e.target,"wptb-ph-element")||e.target.classList.contains("wptb-fixed-toolbar")||WPTB_Helper.findAncestor(e.target,"wptb-fixed-toolbar")||y()};var h=document.getElementsByClassName("wptb-header");function y(){document.getElementsByClassName("wptb-elements-container")[0].style.display="table",document.getElementsByClassName("wptb-settings-section")[0].style.display="block",document.getElementById("element-options-group").style.display="none";var e=document.getElementById("wpcd_fixed_toolbar");e.hasAttribute("data-toolbar-active-id")&&document.getElementById(e.getAttribute("data-toolbar-active-id")).classList.remove("toolbar-active")}0<h.length&&(h=h[0]),h.onclick=function(){y()}},WPTB_List=function(e,t){var a,n=document.createElement("ul"),l=document.createElement("div"),r=void 0,o=!1;if(l.classList.add("wptb-list-item-container"),this.kind="list",""===e);else if(e){var i=t.className.match(/wptb-element-((.+-)\d+)/i);i&&Array.isArray(i)&&(r=i[1],o=!0);for(d=0;d<e.length;d++){var s=t.querySelector("li");a=new WPTB_ListItem(e[d],s,!0),n.appendChild(a.getDOMElement())}}else for(var d=0;d<3;d++)a=new WPTB_ListItem("<p>List Item "+(d+1)+"</p>"),n.appendChild(a.getDOMElement());return l.appendChild(n),this.getDOMElement=function(){return l},applyGenericItemSettings(this,r,o),WPTB_Helper.listItemsRecalculateIndex(n),this},WPTB_ListItem=function(e,t,a){var n=void 0;if(null==t||t&&a){null==e&&(e="New List Item");var l=document.createElement("li");if((o=document.createElement("div")).classList.add("wptb-list-item-content"),t){var r=t.getAttribute("style");r&&l.setAttribute("style",r)}l.appendChild(o),o.innerHTML=e,o.onkeyup=window.listItemKeyListener,n=!0}else{var o;(o=(l=t).getElementsByClassName("wptb-list-item-content")[0]).onkeyup=window.listItemKeyListener,n=!1}if(l.onmouseenter=function(e){var t=new WPTB_ActionsField;t.addActionField(2,l),t.setParameters(l),console.log(l)},l.onmouseleave=function(e){return(new WPTB_ActionsField).leaveFromField(e,l,2),!1},this.getDOMElement=function(){return l},n)return this},MultipleSelect=function(){var l=[],a=!1;return this.activateMultipleSelectMode=function(){l=[];for(var e=document.getElementsByClassName("wptb-preview-table")[0].getElementsByTagName("td"),t=0;t<e.length;t++)e[t].classList.remove("wptb-highlighted");a=!0},this.deactivateMultipleSelectMode=function(){a=!1},this.isActivated=function(){return a},this.pushSelectedCell=function(e){a&&(l.push(e),e.classList.add("wptb-highlighted"))},this.selectedCells=function(){return l},this.flushSelectedCells=function(){l=[]},this.getFirst=function(){for(var e,t=1e3,a=1e3,n=l.length-1;0<=n;n--)t>=l[n].dataset.xIndex&&a>=l[n].dataset.yIndex&&(e=l[n],t=l[n].dataset.xIndex,a=l[n].dataset.yIndex);return e},this.getLast=function(){for(var e,t=-1,a=-1,n=l.length-1;0<=n;n--)t<=l[n].dataset.xIndex&&a<=l[n].dataset.yIndex&&(e=l[n],t=l[n].dataset.xIndex,a=l[n].dataset.yIndex);return e},this.removeAllButFirst=function(){for(var e=this.getFirst(),t=1;t<l.length;t++)l[t].classList.add("wptb-fused-cell-"+e.dataset.xIndex+"-"+e.dataset.yIndex)},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_Parser=function(e){var t=document.createElement("div");t.innerHTML=e;for(var a=t.children[0],n=[].concat(_toConsumableArray(a.querySelectorAll(".wptb-column-title-mobile-container"))),l=0;l<n.length;l++){n[l].parentNode.removeChild(n[l])}for(var r=a.querySelectorAll("td"),o=0;o<r.length;o++)r[o].classList.add("wptb-droppable"),r[o].classList.remove("wptb-column-title-mobile-not-elements");return a},WPTB_Parser2=function(e){if(Array.isArray(e)){var t=void 0;if(1==e.length)return t.appendChild(document.createTextNode(e[0]));if(0 in e){var a=e[0];if(t=document.createElement(a),1 in e&&Array.isArray(e[1]))for(var n=e[1],l=0;l<n.length;l++)Array.isArray(n[l])&&t.setAttribute(n[l][0],n[l][1]);if(2 in e)if(Array.isArray(e[2]))for(var r=0;r<e[2].length;r++)"string"!=typeof e[2][r]||"p"!=a.toLowerCase()?WPTB_Parser(e[2][r])&&t.appendChild(WPTB_Parser(e[2][r])):t.appendChild(document.createTextNode(e[2][r]));else"string"==typeof e[2]&&t.appendChild(document.createTextNode(e[2]))}return t}return!1},WPTB_Settings=function(){for(var e=document.getElementsByClassName("wptb-element"),t=0;t<e.length;t++)e[t].ondragstart=function(e){e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("wptbElement",e.target.dataset.wptbElement),e.dataTransfer.setData("wptbElIndic-"+e.target.dataset.wptbElement,"wptbElIndic-"+e.target.dataset.wptbElement)},e[t].ondragend=function(){var e=document.querySelector(".wptb-drop-handle"),t=document.querySelector(".wptb-drop-border-marker");(e||t)&&(e.style.display="none",t.style.display="none")};var a=new WPTB_TableStateSaveManager,n=document.getElementsByClassName("wptb-undo");0<n.length&&((n=n[0]).onclick=function(e){if(!this.classList.contains("wptb-undoredo-disabled")){a.tableStateGet(this.dataset.wptbUndoredo);var t=document.getElementsByClassName("wptb-undo-redo-container");0<t.length&&((t=t[0]).onmouseleave=function(e){e.target.onmouseleave="",WPTB_Table()})}});var l=document.getElementsByClassName("wptb-redo");0<l.length&&((l=l[0]).onclick=function(e){if(!this.classList.contains("wptb-undoredo-disabled")){a.tableStateGet(this.dataset.wptbUndoredo);var t=document.getElementsByClassName("wptb-undo-redo-container");0<t.length&&((t=t[0]).onmouseleave=function(e){e.target.onmouseleave="",WPTB_Table()})}});var r=document.getElementsByClassName("wptb-popup-window-modal")[0];document.getElementsByClassName("wptb-embed-btn")[0].onclick=function(){this.classList.contains("wptb-button-disable")||r.classList.add("wptb-popup-show")},window.onbeforeunload=function(e){return 0==document.getElementsByClassName("wptb-save-disabled").length||null},document.getElementsByClassName("wptb-popup-dark-area")[0].onclick=function(){r.classList.remove("wptb-popup-show")},document.getElementsByClassName("wptb-popup-window-close-icon")[0].onclick=function(){r.classList.remove("wptb-popup-show")},document.getElementsByClassName("wptb-preview-btn")[0].onclick=function(e){this.classList.contains("wptb-button-disable")&&e.preventDefault()},document.getElementsByClassName("wptb-save-btn")[0].onclick=function(r){if((r.target.dataset.wptbTableStateNumberSave||0!=window.wptbTableStateNumberShow)&&window.wptbTableStateNumberShow!=r.target.dataset.wptbTableStateNumberSave){var e=document.querySelector(".wptb-edit-bar");if(e&&e.classList.contains("visible"))document.getElementsByClassName("wptb-preview-table")[0].toggleTableEditMode();var o=new XMLHttpRequest,t=(wptb_admin_object?wptb_admin_object.ajaxurl:ajaxurl)+"?action=save_table",i=document.getElementById("wptb-setup-name").value.trim(),s=void 0,a=document.getElementsByClassName("wptb-preview-table");if(a=0<a.length?(a=WPTB_Stringifier(a[0])).outerHTML:"",""===i||""===a){var n="";return""===i&&(n+="You must assign a name to the table before saving it.</br>"),""===a&&(n+="Table wasn't created"),(s=document.getElementById("wptb-messaging-area")).innerHTML='<div class="wptb-error wptb-message">Error: '+n+"</div>",s.classList.add("wptb-warning"),void setTimeout(function(){s.removeChild(s.firstChild)},4e3)}var l={title:i,content:a,security_code:wptb_admin_object.security_code};((rs=WPTB_Helper.detectMode())||(rs=document.wptbId))&&(l.id=rs),l=JSON.stringify(l),o.open("POST",t,!0),o.setRequestHeader("Content-type","application/json; charset=utf-8"),o.onreadystatechange=function(e){if(4==this.readyState&&200==this.status){var t=JSON.parse(o.responseText);if(s=document.getElementById("wptb-messaging-area"),"saved"==t[0]){document.wptbId=t[1],s.innerHTML='<div class="wptb-success wptb-message">Table "'+i+'" was successfully saved.</div>',document.getElementsByClassName("wptb-embed-btn")[0].classList.remove("wptb-button-disable"),document.getElementById("wptb-embed-shortcode").value="[wptb id="+t[1]+"]";var a=document.getElementsByClassName("wptb-preview-btn");if(0<a.length){(a=a[0]).classList.remove("wptb-button-disable");var n=a.dataset.previewHref;n=n.replace("empty",t[1]),a.setAttribute("href",n)}}else if("edited"==t[0]){s.innerHTML='<div class="wptb-success wptb-message">Table "'+i+'" was successfully updated.</div>',r.target.dataset.wptbTableStateNumberSave=window.wptbTableStateNumberShow;var l=document.getElementsByClassName("wptb-save-btn");0<l.length&&(l=l[0]).classList.add("wptb-save-disabled")}else s.innerHTML='<div class="wptb-error wptb-message">Safety problems</div>';s.classList.add("wptb-success"),setTimeout(function(){s.removeChild(s.firstChild)},4e3)}},o.send(l)}}},WPTB_Space=function i(e){var t=void 0;if(e?t=e:(t=document.createElement("div")).classList.add("wptb-space-between"),t.ondragenter=function(){this.classList.add("visible")},t.ondragover=function(e){e.preventDefault()},t.ondragleave=function(){this.classList.remove("visible")},t.ondrop=function(e){e.stopPropagation();for(var t,a,n,l,r=e.target.nextSibling,o=e.target;!o.classList.contains("wptb-droppable");)o=o.parentNode;e.dataTransfer.getData("wptbElement")?(t=(l=e.dataTransfer.getData("wptbElement")).includes("list")?new WPTB_List:l.includes("image")?new WPTB_Image:l.includes("text")?new WPTB_Text:l.includes("button")?new WPTB_Button:void 0,this.classList.remove("visible"),null==r?(o.appendChild(t.getDOMElement()),o.appendChild(new i)):(o.insertBefore(t.getDOMElement(),r),o.insertBefore(new i,r))):(alert(e.dataTransfer.getData("node")),a=(t=document.getElementsByClassName(e.dataTransfer.getData("node"))[0]).nextSibling,n=t.parentNode,null!=a&&n.removeChild(a),null==r?(o.appendChild(t),o.appendChild(new i)):(o.insertBefore(t,r),o.insertBefore(new i,r))),this.classList.remove("visible")},!e)return t};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_StarRating=function(e,t){t||(t=e?e.querySelectorAll("li").length:5);var a=document.createElement("div"),n=document.createElement("div"),l=document.createElement("ul"),r=document.createElement("div"),o=document.createElement("div"),i=void 0,s=!1;a.classList.add("wptb-star_rating-container"),n.classList.add("wptb-rating-stars-box"),l.classList.add("wptb-rating-stars-list"),r.classList.add("wptb-success-box"),r.style.display="none",o.classList.add("wptb-text-message");for(var d=0;d<t;d++){var c=document.createElement("li");c.classList.add("wptb-rating-star");var p="";0==d&&(p='<span class="wptb-rating-star-zero-set"></span>'),c.innerHTML='<span class="wptb-rating-star-left-signal-part">'+p+'</span><span class="wptb-filled-rating-star"><svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" \n xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="20px" viewBox="0 0 426.667 426.667" \n style="enable-background:new 0 0 426.667 426.667;" xml:space="preserve">\n <polygon points="426.667,165.12 273.28,152.107 213.333,10.667 153.387,152.107 0,165.12 \n 116.48,266.027 81.493,416 213.333,336.427 345.173,416 310.187,266.027"/></svg></span><span class="wptb-not-filled-rating-star"><svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" \n xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="20px" viewBox="0 0 426.667 426.667" \n style="enable-background:new 0 0 426.667 426.667;" xml:space="preserve">\n <path d="M426.667,165.12L273.28,151.893L213.333,10.667l-59.947,141.44L0,165.12l116.48,100.907L81.493,416l131.84-79.573\n L345.173,416L310.4,266.027L426.667,165.12z M213.333,296.533L133.12,344.96l21.333-91.307l-70.827-61.44l93.44-8.107 \n l36.267-85.973l36.48,86.187l93.44,8.107l-70.827,61.44l21.333,91.307L213.333,296.533z"/></svg></span><span class="wptb-half-filled-rating-star"><svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" \n xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="20px" viewBox="0 0 426.667 426.667" \n style="enable-background:new 0 0 426.667 426.667;" xml:space="preserve">\n <path d="M426.667,165.12L273.28,151.893L213.333,10.667l-59.947,141.44L0,165.12l116.48,100.907L81.493,416l131.84-79.573 \n L345.173,416L310.4,266.027L426.667,165.12z M213.333,296.533v-198.4l36.48,86.187l93.44,8.107l-70.827,61.44l21.333,91.307 \n L213.333,296.533z"/></svg></span><span class="wptb-rating-star-right-signal-part"></span>',c.dataset.value=d+1,l.appendChild(c)}if(r.appendChild(o),n.appendChild(l),n.appendChild(r),a.appendChild(n),e){var m=e.className.match(/wptb-element-((.+-)\d+)/i);m&&Array.isArray(m)&&(i=m[1],s=!0);var u=e.querySelector(".wptb-rating-stars-box");if(u){var b=[].concat(_toConsumableArray(u.attributes));if(0<b.length)for(var g=0;g<b.length;g++)"style"==b[g].name&&n.setAttribute(b[g].name,b[g].value)}var w=u.querySelectorAll("li"),v=l.querySelectorAll("li");if(0<w.length&&0<v.length){w.length<t&&w.length;for(var h=0;h<w.length;h++){var y=[].concat(_toConsumableArray(w[h].attributes));if(0<y.length)for(var f=0;f<y.length;f++)v[h].setAttribute(y[f].name,y[f].value);for(var B=w[h].children,S=v[h].children,T=0;T<B.length;T++){var E=[].concat(_toConsumableArray(B[T].attributes));if(0<E.length)for(var C=0;C<E.length;C++){S[T].setAttribute(E[C].name,E[C].value);var x=B[T].querySelector("svg");if(x){var _=x.getAttribute("style");S[T].querySelector("svg").setAttribute("style",_)}}}}}var N=u.querySelector(".wptb-success-box");if(N)for(var I=[].concat(_toConsumableArray(N.attributes)),P=0;P<I.length;P++)"style"==I[P].name&&r.setAttribute(I[P].name,I[P].value);var A=N.querySelector(".wptb-text-message");if(A){o.innerHTML=A.innerHTML;for(var k=[].concat(_toConsumableArray(A.attributes)),W=0;W<k.length;W++)"style"==k[W].name&&o.setAttribute(k[W].name,k[W].value)}}return this.kind="star_rating",this.getDOMElement=function(){return a},applyGenericItemSettings(this,i,s),this},WPTB_Stringifier=function(e){if(e){var t=e.cloneNode(!0);t.classList.add("wptb-table-preview-static-indic"),t.dataset.tableColumns=e.columns,t.style.width=null,t.style.minWidth=null,t.style.maxWidth=null;var a=t.getElementsByTagName("td");if(0<a.length)for(var n=0;n<a.length;n++){e.querySelector("wptb-table-preview-head")&&a[n].removeAttribute("data-x-index"),a[n].removeAttribute("data-y-index"),a[n].removeAttribute("draggable"),a[n].classList.remove("wptb-droppable");var l=a[n].getElementsByClassName("wptb-ph-element");if(0<l.length)for(var r=0;r<l.length;r++){var o=l[r].querySelectorAll(".mce-content-body");if(0<o.length)for(var i=0;i<o.length;i++)o[i].classList.remove("mce-content-body");var s=l[r].querySelectorAll("[data-mce-style]");if(0<s.length)for(var d=0;d<s.length;d++)s[d].removeAttribute("data-mce-style");var c=l[r].querySelectorAll("[contenteditable]");if(0<c.length)for(var p=0;p<c.length;p++)c[p].removeAttribute("contenteditable");var m=l[r].querySelectorAll("[spellcheck]");if(0<m.length)for(var u=0;u<m.length;u++)m[u].removeAttribute("spellcheck");var b=l[r].querySelectorAll("[id^=mce_]");if(0<b.length)for(var g=0;g<b.length;g++)b[g].removeAttribute("id");for(var w=l[r].querySelectorAll(".wptb-actions"),v=w.length;0<v&&w[0]&&w[0].parentNode;)w[0].parentNode.removeChild(w[0]),v--}if(a[n].hasAttribute("data-wptb-title-column")){var h=document.createElement("div"),y=document.createElement("div");h.classList.add("wptb-column-title-mobile-container"),y.classList.add("wptb-column-title-mobile"),y.dataset.wptbTitleColumn=a[n].dataset.wptbTitleColumn,y.setAttribute("style","font-size:"+a[n].dataset.wptbTitleColumnFontSize+"; \n color:"+a[n].dataset.wptbTitleColumnColor+"; background-color:"+a[n].dataset.wptbTitleBackgroundColor+"; text-align:"+a[n].dataset.wptbTitleAlign+";"),y.style.padding=a[n].style.padding,0==a[n].children.length&&a[n].classList.add("wptb-column-title-mobile-not-elements"),h.appendChild(y),a[n].insertBefore(h,a[n].firstChild)}}return t}};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_Stringifier2=function(e){1<arguments.length&&void 0!==arguments[1]&&arguments[1];if(null==e)return"";if(null==e.tagName&&3==e.nodeType)return e.nodeValue;var t=[],a=void 0,n=!1,l=[].concat(_toConsumableArray(e.attributes)),r=[],o=[];if((e.parentNode.classList.contains("wptb-list-item-content")||e.parentNode.classList.contains("mce-content-body"))&&"p"==e.tagName.toLowerCase()?(a=e.childNodes,n=!0):a=0<e.children.length?e.children:e.childNodes,0<l.length)for(var i=0;i<l.length;i++)r[i]=[l[i].name,l[i].value];else r="";if(0<a.length)for(var s=0;s<a.length;s++){var d=WPTB_Stringifier(a[s]);Array.isArray(d)||n?o[s]=d:"string"==typeof d&&d&&(o=d)}else o="";return t.push(e.tagName.toLowerCase(),r,o),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},array=[],WPTB_Table=function(e,t){var P,a,n,v,l=document.getElementsByClassName("wptb-settings-items"),f=document.getElementsByClassName("wptb-table-setup")[0],B=function(e){var t,a=this.rowSpan,n=this.colSpan,l=document.getElementsByClassName("wptb-no-cell-action"),r=document.getElementsByClassName("wptb-single-action"),o=document.getElementsByClassName("wptb-multiple-select-action"),i=document.getElementById("wptb-left-scroll-panel-cell-settings"),s=E(this),d=s[0],c=s[1];if(document.select.isActivated()){if(this.className.match(/wptb-highlighted/)){this.classList.remove("wptb-highlighted");for(var p=0;p<a;p++)for(var m=0;m<n;m++)array[d+p][c+m]=0}else{this.classList.add("wptb-highlighted");for(p=0;p<a;p++)for(m=0;m<n;m++)array[d+p][c+m]=1}if(0===(t=document.getElementsByClassName("wptb-highlighted").length)){for(p=0;p<o.length;p++)o[p].classList.remove("visible"),o[p].setAttribute("disabled","disabled");for(p=0;p<l.length;p++)l[p].classList.add("visible"),l[p].removeAttribute("disabled");for(p=0;p<r.length;p++)r[p].classList.remove("visible"),r[p].setAttribute("disabled","disabled");i.classList.remove("visible")}else if(1===t){for(p=0;p<o.length;p++)o[p].classList.remove("visible"),o[p].setAttribute("disabled","disabled");for(p=0;p<l.length;p++)l[p].classList.remove("visible"),l[p].setAttribute("disabled","disabled");for(p=0;p<r.length;p++)r[p].classList.add("visible"),r[p].removeAttribute("disabled");var u=document.querySelector(".wptb-highlighted");if(u){var b=document.getElementById("wptb-table-column-width-slider"),g=document.getElementById("wptb-table-column-width-number"),w=document.getElementById("wptb-table-column-width-auto-fixed"),v=u.style.width;if(v)b.value=parseFloat(v,10),g.value=parseFloat(v,10),w.checked=!0;else if(u.dataset.wptbFixedWidth)b.value=u.dataset.wptbFixedWidth,g.value=u.dataset.wptbFixedWidth,w.checked=!0;else{var h=WPTB_Helper.getColumnWidth(P,u);b.value=h,g.value=h,w.checked=!1}var y=document.getElementById("wptb-table-row-height-slider"),f=document.getElementById("wptb-table-row-height-number"),B=document.getElementById("wptb-table-row-height-auto-fixed"),S=u.style.height;if(S)y.value=parseFloat(S,10),f.value=parseFloat(S,10),B.checked=!0;else if(u.dataset.wptbFixedHeight)y.value=u.dataset.wptbFixedHeight,f.value=u.dataset.wptbFixedHeight,B.checked=!0;else{var T=WPTB_Helper.getRowHeight(P,u);y.value=T,f.value=T,B.checked=!1}}i.classList.add("visible")}else{for(p=0;p<o.length;p++)P.isSquare(array)?(o[p].classList.add("visible"),o[p].removeAttribute("disabled")):(o[p].classList.remove("visible"),o[p].setAttribute("disabled","disabled"));for(p=0;p<l.length;p++)l[p].classList.remove("visible"),l[p].setAttribute("disabled","disabled");for(p=0;p<r.length;p++)r[p].classList.remove("visible"),r[p].setAttribute("disabled","disabled");i.classList.remove("visible")}}},S=function(e){for(var t=0;t<e.length;t++){for(var a=0;a<e[t].length;a++)" "+e[t][a];"\n"}P.isSquare(e)},T=function(){for(var e=document.getElementsByClassName("wptb-no-cell-action"),t=document.getElementsByClassName("wptb-single-action"),a=document.getElementsByClassName("wptb-multiple-select-action"),n=document.getElementById("wptb-left-scroll-panel-cell-settings"),l=P.getElementsByClassName("wptb-highlighted");l.length;)l[0].classList.remove("wptb-highlighted");n.classList.remove("visible");for(var r=0;r<array.length;r++)for(var o=0;o<array[r].length;o++)array[r][o]=0;for(r=0;r<a.length;r++)a[r].classList.remove("visible"),a[r].setAttribute("disabled","disabled");for(r=0;r<e.length;r++)e[r].classList.add("visible"),e[r].removeAttribute("disabled");for(r=0;r<t.length;r++)t[r].classList.remove("visible"),t[r].setAttribute("disabled","disabled")},E=function(e){for(var t=[],a=0;a<v;a++)t[a]=0;for(a=0;a<P.rows.length;a++)for(var n=P.rows[a].getElementsByTagName("td"),l=cellPointer=0;l<v;l+=stepsToMove)if(stepsToMove=1,t[l])t[l]--;else{var r=n[cellPointer++];if(r==e)return[a,l];if(1<r.rowSpan){for(var o=0;o<r.colSpan;o++)t[l+o]=r.rowSpan-1;stepsToMove=r.colSpan}else 1<r.colSpan&&(stepsToMove=r.colSpan)}};if(jQuery("#wptb-table-header-bg").val(""),jQuery("#wptb-even-row-bg").val(""),jQuery("#wptb-odd-row-bg").val(""),jQuery("#wptb-table-border-color").val(""),jQuery("#wptb-table-inner-border-number,#wptb-table-inner-border-slider").val("0"),jQuery("#wptb-table-border-number,#wptb-table-border-slider").val("0"),jQuery("#wptb-table-padding-number,#wptb-table-padding-slider").val("15"),e||t){for(var r=0;r<l.length;r++)"wptb-apply-inner-border"!==l[r].id&&l[r].classList.add("visible");(P=document.createElement("table")).classList.add("wptb-preview-table"),P.dataset.reconstraction=1,P.dataset.wptbAdaptiveTable=1;for(r=0;r<t;r++){(a=P.insertRow(-1)).classList.add("wptb-row");for(var g=0;g<e;g++)(n=new WPTB_Cell(B)).setCoords(r,g),a.appendChild(n.getDOMElement())}}else{var o=document.getElementsByClassName("wptb-preview-table");if(0<o.length){var i=(P=o[0]).getElementsByTagName("td");if(0<i.length)for(var s=0;s<i.length;s++)WPTB_Cell(B,i[s])}}P.toggleTableEditMode=function(){var e=document.getElementsByClassName("wptb-edit-bar"),t=document.getElementById("wptb-cell_mode_background"),a=document.getElementById("wptb-left-scroll-panel-curtain"),n=document.getElementById("wptb-left-scroll-panel-cell-settings"),l=document.getElementsByClassName("wptb-preview-table");if(0<l.length&&(l=l[0]),0<e.length)for(var r=0;r<e.length;r++)if(e[r].classList.contains("visible")){document.select.deactivateMultipleSelectMode(),e[r].classList.remove("visible"),t.classList.remove("visible"),a.classList.remove("visible"),n.classList.remove("visible"),l.parentNode.classList.remove("wptb-preview-table-manage-cells");var o=l.getElementsByTagName("td");if(0<o.length)for(var i=0;i<o.length;i++)o[i].classList.remove("wptb-highlighted")}else document.select.activateMultipleSelectMode(),e[r].classList.add("visible"),t.classList.add("visible"),a.classList.add("visible"),l.parentNode.classList.add("wptb-preview-table-manage-cells")},P.recalculateIndexes=function(e){for(var t=this.getElementsByTagName("tr"),a=void 0,n=0,l=0,r=[],o=document.getElementById("wptb-top-row-as-header"),i=0;i<t.length;i++){0==i?(null==e&&(t[i].style.backgroundColor=jQuery("#wptb-table-header-bg").val()),o.checked?null==e&&(this.classList.add("wptb-table-preview-head"),t[i].classList.add("wptb-table-head")):null==e&&(this.classList.remove("wptb-table-preview-head"),t[i].classList.remove("wptb-table-head"))):(i%2==0?null==e&&(t[i].style.backgroundColor=jQuery("#wptb-odd-row-bg").val()):null==e&&(t[i].style.backgroundColor=jQuery("#wptb-even-row-bg").val()),t[i].classList.remove("wptb-table-head")),r[i],a=t[i].getElementsByTagName("td"),null==r[i]&&(r[i]=[]);for(var s=0,d=0;d<a.length;d++){if(null!=r[i][d])for(var c=0;c<100;c++){if(null==r[i][s]){r[i][s]=a[d],a[d].dataset.xIndex=s;break}s++}else r[i][d]=a[d],a[d].dataset.xIndex=s;if(a[d].dataset.yIndex=i,1<a[d].colSpan)for(var p=1;p<a[d].colSpan;p++)s++,r[i][s]="tdDummy";if(1<a[d].rowSpan)for(var m=1;m<a[d].rowSpan;m++){null==r[i+m]&&(r[i+m]=[]);for(var u=0;u<a[d].colSpan;u++)r[i+m][s-a[d].colSpan+1+u]="tdDummy"}s++,0==i&&(l=s)}n<d&&(n=d)}this.columns=n,this.maxCols=l},P.addColumnWidth=function(m,u){var e=P.getElementsByClassName("wptb-highlighted");if(0<e.length){for(var t=0;t<e.length;t++){var a=e[t].dataset.xIndex;a&&function e(t,a){for(var n=P.rows,l=!1,r=[],o=0;o<n.length;o++)for(var i=n[o].children,s=0;s<i.length;s++){var d=i[s];if(d.dataset.xIndex==t){if(m)if(d.colSpan==a){d.style.width=m+"px",d.removeAttribute("data-wptb-fixed-width"),l=!0;var c=document.getElementById("wptb-table-column-width-auto-fixed");c.checked||(c.checked=!0)}else d.style.width=null,d.dataset.wptbFixedWidth=m,o!=n.length-1||l||e(t,a+1);else if(u)d.style.width=null,d.removeAttribute("data-wptb-fixed-width");else if(d.dataset.wptbFixedWidth)d.colSpan==a&&(d.style.width=d.dataset.wptbFixedWidth+"px",d.removeAttribute("data-wptb-fixed-width"));else if(d.style.width){for(var p=0;p<r.length;p++)r[p].style.width=d.style.width;r=[]}else r.push(d);break}}}(a,1)}P.tdDefaultWidth()}},P.tdDefaultWidth=function(){for(var e,t=P.rows,a=0,n=0,l=document.getElementsByClassName("wptb-table-setup")[0].offsetWidth,r=[],o=[],i=0,s=0,d="",c=0;c<t.length;c++)for(var p=t[c].children,m=0;m<p.length;m++){var u=p[m];if(r[parseInt(u.dataset.xIndex)]||o[parseInt(u.dataset.xIndex)])o[parseInt(u.dataset.xIndex)]?u.dataset.wptbFixedWidth||(u.dataset.wptbCssTdAutoWidth=!0):r[parseInt(u.dataset.xIndex)]&&u.removeAttribute("data-wptb-css-td-auto-width");else if(u.style.width?(r[parseInt(u.dataset.xIndex)]=parseFloat(u.style.width),u.removeAttribute("data-wptb-css-td-auto-width")):u.dataset.wptbFixedWidth||(o[parseInt(u.dataset.xIndex)]=100,u.dataset.wptbCssTdAutoWidth=!0),window.getComputedStyle(u,null)){var b=window.getComputedStyle(u,null),g=b.getPropertyValue("padding-left"),w=b.getPropertyValue("padding-right");i=parseFloat(g,10)+parseFloat(w,10);var v=b.getPropertyValue("border-left-width"),h=b.getPropertyValue("border-right-width");s=parseFloat(v,10)+parseFloat(h,10),r[parseInt(u.dataset.xIndex)]?(r[parseInt(u.dataset.xIndex)]+=i,r[parseInt(u.dataset.xIndex)]+=s):(o[parseInt(u.dataset.xIndex)]+=i,o[parseInt(u.dataset.xIndex)]+=s)}}for(var y=0;y<r.length;y++)r[y]&&(a+=r[y]);for(var f=0,B=0;B<o.length;B++)o[B]&&(n+=o[B],f++);var S=window.getComputedStyle(P,null),T=S.getPropertyValue("border-left-width"),E=S.getPropertyValue("border-right-width"),C=parseFloat(T,10)+parseFloat(E,10);e=a+n+C,P.dataset.wptbTableTdsSumMaxWidth=e,f?(P.dataset.wptbCellsWidthAutoCount=f,P.mergingСellsHorizontally?P.dataset.wptbFixedWidthSize=a-C:P.removeAttribute("data-wptb-fixed-width-size")):(P.removeAttribute("data-wptb-fixed-width-size"),P.removeAttribute("data-wptb-cells-width-auto-count"));var x=!1,_=void 0;e<l?f?(P.style.minWidth="100%",P.mergingСellsHorizontally?(_=(_=(l-a-C)/f)-i-s,x=!(P.style.width=null)):P.style.width="100%"):(P.style.width=null,P.style.minWidth=null,P.style.maxWidth=e+"px"):(P.style.maxWidth=null,P.style.minWidth=e+"px",_="100",x=!(P.style.width=null));var N=document.head;if(N){var I=N.querySelector('style[data-wptb-td-auto-width="true"]');I&&N.removeChild(I)}x&&((d=document.createElement("style")).setAttribute("data-wptb-td-auto-width",!0),d.innerHTML="[data-wptb-css-td-auto-width=true]{width:"+_+"px}",N&&N.appendChild(d))},P.addRowHeight=function(m,u){var e=P.getElementsByClassName("wptb-highlighted");if(0<e.length)for(var t=0;t<e.length;t++){var a=e[t].dataset.yIndex;a&&function e(t,a){for(var n=P.rows,l=!1,r=[],o=0;o<n.length;o++)for(var i=n[o].children,s=0;s<i.length;s++){var d=i[s];if(d.dataset.yIndex==t)if(m){if(d.rowSpan==a){d.style.height=m+"px",d.removeAttribute("data-wptb-fixed-heidht"),l=!0;var c=document.getElementById("wptb-table-row-height-auto-fixed");c.checked||(c.checked=!0);continue}d.style.height=null,d.dataset.wptbFixedHeight=m,s!=i.length-1||l||e(t,a+1)}else if(u)d.style.height=null,d.removeAttribute("data-wptb-fixed-heidht");else if(d.dataset.wptbFixedHeight)(d.rowSpan=a)&&(d.style.height=d.dataset.wptbFixedHeight+"px",d.removeAttribute("data-wptb-fixed-width"));else if(d.style.height){for(var p=0;p<r.length;p++)r[p].style.height=d.style.height;r=[]}else r.push(d)}}(a,1)}},P.reconstraction=function(){var e=P.getElementsByTagName("td"),t=document.getElementsByClassName("wptb-adaptive-table-chose-block");0<t.length&&(t=t[0]),P.mergingСellsHorizontally=!1,P.mergingCellsVertically=!1,P.dataset.reconstraction=1,t.style.display="block";for(var a=0,n=0;n<e.length&&(1<e[n].colSpan&&(P.dataset.reconstraction=0,t.style.display="none",P.mergingСellsHorizontally=!0,a++),1<e[n].rowSpan&&(P.dataset.reconstraction=0,t.style.display="none",P.mergingCellsVertically=!0,a++),2!=a);n++);},P.addColumnEnd=function(){var e=void 0,t=document.getElementsByClassName("wptb-preview-table"),a=void 0,n=void 0;0<t.length&&(a=t[0].querySelector("td")),a&&(n=a.getAttribute("style"));for(var l=0;l<P.rows.length;l++)e=new WPTB_Cell(B),n&&(e.getDOMElement().setAttribute("style",n),e.getDOMElement().style.width=null),P.rows[l].appendChild(e.getDOMElement()),array[l].push(0);v++,P.recalculateIndexes(),P.tdDefaultWidth(),P.addRowHeight(),WPTB_Helper.dataTitleColumnSet(P),T(),(new WPTB_TableStateSaveManager).tableStateSet()},P.addColumnStart=function(){var e=void 0,t=void 0,a=document.getElementsByClassName("wptb-preview-table"),n=void 0,l=void 0;0<a.length&&(n=a[0].querySelector("td")),n&&(l=n.getAttribute("style"));for(var r=0;r<P.rows.length;r++)e=new WPTB_Cell(B),l&&(e.getDOMElement().setAttribute("style",l),e.getDOMElement().style.width=null),(t=P.rows[r].getElementsByTagName("td")[0])?P.rows[r].insertBefore(e.getDOMElement(),t):P.rows[r].appendChild(e.getDOMElement()),array[r].push(0);v++,P.recalculateIndexes(),P.tdDefaultWidth(),P.addRowHeight(),WPTB_Helper.dataTitleColumnSet(P),T(),(new WPTB_TableStateSaveManager).tableStateSet()},P.addColumnAfter=function(e){var t=P.rows,a=void 0,n=void 0,l=document.querySelector(".wptb-highlighted"),r=l.getAttribute("style"),o=null!=e&&"number"==typeof e?e:E(l)[1];if(v-o-l.colSpan+1==1)P.addColumnEnd();else{for(var i=!1,s=void 0,d=void 0,c=void 0,p=[],m=void 0,u=0;u<v;u++)p.push(0);for(u=0;u<t.length;u++){a=0,n=t[u].getElementsByTagName("td"),i=!1;for(var b=0;b<v;b+=s){if(s=1,i){d=new WPTB_Cell(B),r&&(d.getDOMElement().setAttribute("style",r),d.getDOMElement().style.width=null),m&&t[u].contains(m)?(c=m.nextSibling)?t[u].insertBefore(d.getDOMElement(),c):t[u].appendChild(d.getDOMElement()):t[u].insertBefore(d.getDOMElement(),n[0]);break}if(0<p[b])o==b&&(i=!0);else if(1<(m=n[a++]).rowSpan){s=m.colSpan;for(var g=0;g<m.colSpan;g++)p[b+g]=m.rowSpan,b+g==o&&(i=!0)}else if(1<m.colSpan){s=m.colSpan;for(g=0;g<m.colSpan;g++)b+g==o&&(i=!0)}else b==o&&(i=!0)}for(var w=0;w<v;w++)0<p[w]&&p[w]--}for(u=0;u<array.length;u++)array[u].push(0);v++,S(array),P.recalculateIndexes(),P.addColumnWidth(),P.addRowHeight(),WPTB_Helper.dataTitleColumnSet(P),T(),(new WPTB_TableStateSaveManager).tableStateSet()}},P.addColumnBefore=function(){var e=document.querySelector(".wptb-highlighted"),t=E(e)[1];0===t?P.addColumnStart():P.addColumnAfter(t-1)},P.addRowToTheEnd=function(){var e,t=P.insertRow(-1),a=void 0,n=document.getElementsByClassName("wptb-preview-table"),l=void 0,r=void 0;t.classList.add("wptb-row"),0<n.length&&(l=n[0].querySelector("td")),l&&(r=l.getAttribute("style"));for(var o=0;o<v;o++)a=new WPTB_Cell(B),r&&a.getDOMElement().setAttribute("style",r),t.appendChild(a.getDOMElement());e=Array.from(array[0]),array.push(e),S(array),P.recalculateIndexes(),P.addColumnWidth(),WPTB_Helper.dataTitleColumnSet(P),T(),(new WPTB_TableStateSaveManager).tableStateSet()},P.addRowToTheStart=function(){var e,t=P.insertRow(0),a=void 0,n=document.getElementsByClassName("wptb-preview-table"),l=void 0,r=void 0;t.classList.add("wptb-row"),0<n.length&&(l=n[0].querySelector("td")),l&&(r=l.getAttribute("style"));for(var o=0;o<v;o++)a=new WPTB_Cell(B),r&&a.getDOMElement().setAttribute("style",r),t.appendChild(a.getDOMElement());e=Array.from(array[0]),array.push(e),S(array),P.recalculateIndexes(),P.addColumnWidth(),WPTB_Helper.dataTitleColumnSet(P),T(),(new WPTB_TableStateSaveManager).tableStateSet()},P.addRowBefore=function(){for(var e=document.querySelector(".wptb-highlighted"),t=e.getAttribute("style"),a=E(e)[0],n=void 0,l=a-1;0<=l;l--){var r=P.rows[l].children,o=r.length;if(0<o)for(var i=0;i<o;i++)if(1==r[i].rowSpan){a=l,n=!0;break}if(n)break}0===a?P.addRowToTheStart():P.addRowAfter(a,t)},P.addRowAfter=function(e,t){var a,n=void 0;if(null!=e&&"number"==typeof e||null!=t)n=e;else{var l=document.querySelector(".wptb-highlighted");t=l.getAttribute("style"),n=(e=E(l)[0])+l.rowSpan-1}var r=0;if(n<P.rows.length-1){for(var o=0;o<=n;o++){var i=P.rows[o].children,s=i.length;if(0<s)for(var d=0;d<s;d++){n<i[d].rowSpan-1+o&&i[d].rowSpan++}}var c=P.rows[n+1].children,p=c.length;if(0<p)for(var m=0;m<p;m++)r+=c[m].colSpan}else r=array[0].length;var u=P.insertRow(n+1);for(u.classList.add("wptb-row"),g=0;g<r;g++){var b=new WPTB_Cell(B);b.getDOMElement().setAttribute("style",t),b.getDOMElement().style.width=null,b.getDOMElement().style.height=null,u.appendChild(b.getDOMElement())}a=Array.from(array[0]),array.push(a),S(array),P.recalculateIndexes(),P.addColumnWidth(),WPTB_Helper.dataTitleColumnSet(P),T(),(new WPTB_TableStateSaveManager).tableStateSet()},P.isSquare=function(e){for(var t,a,n=-1,l=-1,r=-1,o=-1,i=0,s=0;s<e.length;s++)for(var d=0;d<e[s].length;d++)1==e[s][d]&&((d<l||-1==l)&&(l=d),(s<n||-1==n)&&(n=s));for(s=e.length-1;-1<s;s--)for(d=e[s].length-1;-1<d;d--)1==e[s][d]&&(o<d&&(o=d),r<s&&(r=s));for(s=n;s<r;s++)for(d=l;d<o;d++)if(0==e[s][d]||null==e[s][d])return!1;for(s=0;s<e.length;s++)for(d=0;d<e[s].length;d++)1==e[s][d]&&i++;return(t=r-n+1)*(a=o-l+1)===i&&[t,a]},P.mergeCells=function(){for(var e=P.isSquare(array),t=e[0],a=e[1],n=document.querySelector(".wptb-highlighted"),l=[].slice.call(document.getElementsByClassName("wptb-highlighted"),1),r=[],o=0;o<l.length;o++){var i=l[o].getElementsByClassName("wptb-ph-element");if(0<i.length)for(var s=i.length,d=0;d<s;d++)r.push(i[d]);l[o].parentNode.removeChild(l[o])}if(0<r.length)for(var c=0;c<r.length;c++)n.appendChild(r[c]);n.colSpan=a,n.rowSpan=t,P.recalculateIndexes(),P.reconstraction();var p=n.style.width,m=n.dataset.wptbFixedWidth;p?P.addColumnWidth(parseFloat(p,10)):m?P.addColumnWidth():P.addColumnWidth(!1,!0);var u=n.style.height,b=n.dataset.wptbFixedHeight;u?P.addRowHeight(parseFloat(u,10)):b?P.addRowHeight():P.addRowHeight(!1,!0),WPTB_Helper.dataTitleColumnSet(P),T(),(new WPTB_TableStateSaveManager).tableStateSet()},P.splitCell=function(){var e=document.getElementsByClassName("wptb-highlighted")[0],t=e.rowSpan,a=e.colSpan,n=e.getAttribute("style"),l=E(e)[0],r=P.rows[l],o=e.dataset.xIndex;e.rowSpan=1;for(var i=e.colSpan=1;i<a;i++){var s=new WPTB_Cell(B);s.getDOMElement().setAttribute("style",n),s.getDOMElement().classList.add("wptb-highlighted"),e.nextSibling?r.insertBefore(s.getDOMElement(),e.nextSibling):r.appendChild(s.getDOMElement())}if(1<t)for(var d=1;d<t;d++){var c=void 0,p=P.rows[l+d],m=p.children,u=m.length;if(0<u)for(var b=0;b<u;b++)if(Number(m[b].dataset.xIndex)>Number(o)){c=m[b];break}for(var g=0;g<a;g++){var w=new WPTB_Cell(B);w.getDOMElement().setAttribute("style",n),null!=c?p.insertBefore(w.getDOMElement(),c):p.appendChild(w.getDOMElement())}}P.recalculateIndexes(),P.reconstraction(),P.addColumnWidth(),P.addRowHeight(),WPTB_Helper.dataTitleColumnSet(P),T(),(new WPTB_TableStateSaveManager).tableStateSet()},P.findRowspannedCells=function(e){var t,a=[];if(actualPoints=function(e){for(var t=P.rows[e].getElementsByTagName("td"),a=0,n=0;n<t.length;n++)a+=t[n].colSpan;return a}(e),actualPoints===v)return[];t=v-actualPoints;for(var n=e-1;0<=n&&t;n--){var l=P.rows[n].getElementsByTagName("td");for(n=0;n<l.length;n++)1<l[n].rowSpan&&(a.push(l[n]),t-=l[n].colSpan)}return a},P.addLackingCells=function(){for(var e=[],t=0;t<P.rows.length;t++)e.push(0);for(t=0;t<P.rows.length;t++)for(var a=P.rows[t].getElementsByTagName("td"),n=0;n<a.length;n++)if(1<a[n].rowSpan)for(var l=1;l<a[n].rowSpan;l++)e[t+l]++;for(t=0;t<P.rows.length;t++){a=P.rows[t].getElementsByTagName("td");var r=0;for(n=0;n<a.length;n++)r+=a[n].colSpan;r+=e[t],difference=v-r;for(n=0;n<difference;n++){var o=new WPTB_Cell(B);P.rows[t].appendChild(o.getDOMElement())}}},P.deleteRow=function(){var e=document.querySelector(".wptb-highlighted"),t=e.getAttribute("style"),a=e.rowSpan,n=E(e)[0],l=void 0;null==a&&(a=1);for(var r=0;r<a;r++){var o=P.rows[n].children,i=P.rows[n+1],s=void 0,d=void 0,c=[];if(null!=i){d=(s=i.children).length;for(var p=0;p<o.length;p++)if(1<o[p].rowSpan){var m=new WPTB_Cell(B);m.getDOMElement().setAttribute("style",t),m.getDOMElement().colSpan=o[p].colSpan,m.getDOMElement().rowSpan=o[p].rowSpan-1;for(var u=void 0,b=0;b<d;b++)if(Number(s[b].dataset.xIndex)>Number(o[p].dataset.xIndex)){u=s[b];break}u?c.push([m,u]):c.push([m])}if(0<c.length)for(var g=0;g<c.length;g++)null!=c[g][1]?i.insertBefore(c[g][0].getDOMElement(),c[g][1]):i.appendChild(c[g][0].getDOMElement())}var w=P.rows;if(0<w.length)for(var v=0;v<n;v++){var h=w[v].children;if(0<h.length)for(var y=0;y<h.length;y++)h[y].rowSpan-1>=n-v&&h[y].rowSpan--}l=Array.from(array[0]),array.pop(l),S(array),P.getElementsByTagName("tbody")[0].removeChild(P.rows[n]),0==P.rows.length&&(P.toggleTableEditMode(),f.innerHTML="",WPTB_Helper.settingsPanelClear(),document.getElementsByClassName("wptb-table-generator")[0].style.display="table"),P.recalculateIndexes(),WPTB_Helper.dataTitleColumnSet(P)}T(),(new WPTB_TableStateSaveManager).tableStateSet()},P.deleteColumn=function(){for(var e=document.querySelector(".wptb-highlighted"),t=e.dataset.xIndex,a=e.colSpan,n=0;n<a;n++){for(var l=0;l<P.rows.length;l++){var r=P.rows[l].children,o=r.length;if(0<o)for(var i=o-1;0<=i;i--){if(Number(r[i].dataset.xIndex)==Number(t)){1<r[i].colSpan?r[i].colSpan--:P.rows[l].removeChild(r[i]);break}if(Number(r[i].dataset.xIndex)<Number(t)&&Number(r[i].dataset.xIndex)+Number(r[i].colSpan-1)>=t){1<r[i].colSpan&&r[i].colSpan--;break}}}for(var s=0;s<P.rows.length;s++)null!=array[s]&&array[s].pop();v--,0==P.querySelectorAll("td").length&&(P.toggleTableEditMode(),f.innerHTML="",WPTB_Helper.settingsPanelClear(),document.getElementsByClassName("wptb-table-generator")[0].style.display="table"),P.recalculateIndexes(),P.tdDefaultWidth(),WPTB_Helper.dataTitleColumnSet(P)}T(),(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementsByClassName("wptb-table-generator")[0].style.display="none",array=function(){for(var e=[],t=[],a=0;a<P.rows.length;a++){for(var n=P.rows[a].getElementsByTagName("td"),l=0,r=0;r<n.length;r++)l+=n[r].colSpan;e.push(l)}v=Math.max.apply(null,e);var o=P.rows.length;for(a=0;a<o;a++)for(t[a]=[],r=0;r<v;r++)t[a].push(0);return S(t),t}(),T(),S(array),f.appendChild(P),P.recalculateIndexes(!0),P.reconstraction(),P.tdDefaultWidth(),f.onresize=function(){P.tdDefaultWidth()},WPTB_LeftPanel()},WPTB_TableStateSaveManager=function(){this.tableStateSet=function(){var e=document.getElementsByClassName("wptb-preview-table");if(0<e.length){e=e[0],window.wptbTableStateSaving||(window.wptbTableStateSaving=[]),window.wptbTableStateSaving.length>window.wptbTableStateNumberShow+1&&(window.wptbTableStateSaving=window.wptbTableStateSaving.slice(0,window.wptbTableStateNumberShow+1));for(var t=e.cloneNode(!0),a=t.getElementsByClassName("wptb-highlighted"),n=0;n<a.length;n++)a[n].classList.remove("wptb-highlighted");for(var l=t.getElementsByClassName("wptb-directlyhovered"),r=0;r<l.length;r++)l[r].classList.remove("wptb-directlyhovered");var o="",i=document.head;if(i){var s=i.querySelector('style[data-wptb-td-auto-width="true"]');s&&(o=s.innerHTML)}var d=t.querySelectorAll(".mce-content-body");if(0<d.length)for(var c=0;c<d.length;c++)d[c].classList.remove("mce-content-body");var p=t.querySelectorAll("[data-mce-style]");if(0<p.length)for(var m=0;m<p.length;m++)p[m].removeAttribute("data-mce-style");var u=t.querySelectorAll("[id^=mce_]");if(0<u.length)for(var b=0;b<u.length;b++)u[b].removeAttribute("id");if(window.wptbTableStateSaving.push([t,o]),window.wptbTableStateNumberShow=window.wptbTableStateSaving.length-1,1<window.wptbTableStateSaving.length){var g=document.getElementsByClassName("wptb-undo");0<g.length&&(g=g[0]).classList.remove("wptb-undoredo-disabled")}var w=document.getElementsByClassName("wptb-redo");0<w.length&&(w=w[0]).classList.add("wptb-undoredo-disabled");var v=document.getElementsByClassName("wptb-save-btn");0<v.length&&(!(v=v[0]).dataset.wptbTableStateNumberSave&&0==window.wptbTableStateNumberShow||window.wptbTableStateNumberShow==v.dataset.wptbTableStateNumberSave?v.classList.add("wptb-save-disabled"):v.classList.remove("wptb-save-disabled"))}},this.tableStateGet=function(e){if(e&&window.wptbTableStateSaving&&1<window.wptbTableStateSaving.length){if("undo"==e){if(!(0<window.wptbTableStateNumberShow))return!1;window.wptbTableStateNumberShow--}else if("redo"==e){if(!(window.wptbTableStateNumberShow<window.wptbTableStateSaving.length-1))return!1;window.wptbTableStateNumberShow++}var t=document.getElementsByClassName("wptb-undo");0<t.length&&(t=t[0]),0==window.wptbTableStateNumberShow?t&&t.classList.add("wptb-undoredo-disabled"):0<window.wptbTableStateNumberShow&&t&&t.classList.remove("wptb-undoredo-disabled");var a=document.getElementsByClassName("wptb-redo");0<a.length&&(a=a[0]),window.wptbTableStateNumberShow==window.wptbTableStateSaving.length-1?a&&a.classList.add("wptb-undoredo-disabled"):window.wptbTableStateNumberShow<window.wptbTableStateSaving.length-1&&a&&a.classList.remove("wptb-undoredo-disabled");var n=document.getElementsByClassName("wptb-save-btn");0<n.length&&(!(n=n[0]).dataset.wptbTableStateNumberSave&&0==window.wptbTableStateNumberShow||window.wptbTableStateNumberShow==n.dataset.wptbTableStateNumberSave?n.classList.add("wptb-save-disabled"):n.classList.remove("wptb-save-disabled"));var l=document.getElementsByClassName("wptb-table-setup");if(0<l.length){if((l=l[0]).innerHTML="",l.appendChild(window.wptbTableStateSaving[window.wptbTableStateNumberShow][0]),window.wptbTableStateSaving[window.wptbTableStateNumberShow][1]){var r=document.createElement("style");r.setAttribute("data-wptb-td-auto-width",!0),r.innerHTML=window.wptbTableStateSaving[window.wptbTableStateNumberShow][1];var o=document.head;if(o){var i=o.querySelector('style[data-wptb-td-auto-width="true"]');i&&o.removeChild(i),o.appendChild(r)}}WPTB_Helper.settingsPanelClear(),WPTB_Helper.elementOptionsPanelClear(),WPTB_LeftPanel();var s=document.getElementById("wptb-left-scroll-panel-cell-settings");s&&s.classList.remove("visible")}}}};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_Text=function(e,t){var a=document.createElement("div"),n=document.createElement("div"),l=document.createElement("p"),r=void 0,o=!1;if(a.classList.add("wptb-text-container"),l.innerHTML=null!=e?e:"Text",n.appendChild(l),a.appendChild(n),t){var i=t.className.match(/wptb-element-((.+-)\d+)/i);i&&Array.isArray(i)&&(r=i[1],o=!0);for(var s=[].concat(_toConsumableArray(t.attributes)),d=0;d<s.length;d++)a.setAttribute(s[d].name,s[d].value)}return this.kind="text",this.getDOMElement=function(){return a},applyGenericItemSettings(this,r,o),this},WPTB_innerElementSet=function c(t){t.ondragenter=function(e){-1==e.dataTransfer.types.indexOf("wptbelement")&&-1==e.dataTransfer.types.indexOf("wptb-moving-mode")||(WPTB_DropHandle(this,e),t.classList.add("wptb-ondragenter"))},t.ondragover=function(e){e.preventDefault(),WPTB_DropHandle(this,e)},t.ondragleave=function(){},t.ondrop=function(e){this.classList.remove("wptb-ondragenter");var t=void 0,a=void 0;if(e.preventDefault(),e.stopPropagation(),e.dataTransfer.getData("wptbElement")||e.dataTransfer.getData("node")){var n=void 0,l=void 0;if(0<document.getElementsByClassName("wptb-drop-handle").length&&(n=document.getElementsByClassName("wptb-drop-handle")[0]),0<document.getElementsByClassName("wptb-drop-border-marker").length&&(l=document.getElementsByClassName("wptb-drop-border-marker")[0]),t=e.dataTransfer.getData("wptbElement")?(t=WPTB_Helper.newElementProxy(e.dataTransfer.getData("wptbElement"))).getDOMElement():(a=e.dataTransfer.getData("node"),document.getElementsByClassName(a)[0]),"block"==n.style.display){var r=void 0;if("Drop Here"==n.dataset.text)(r=n.getDOMParentElement()).appendChild(t);else{var o=n.getDOMParentElement();if(r=o.parentNode,"Above Element"==n.dataset.text)r.insertBefore(t,o);else if("Below Element"==n.dataset.text){var i=o.nextSibling;r.insertBefore(t,i)}}var s=r.parentNode;if(s.classList.contains("wptb-table-head")){var d=WPTB_Helper.findAncestor(s,"wptb-preview-table");WPTB_Helper.dataTitleColumnSet(d)}if(n.style.display="none",l.style.display="none",c(t),!t.classList.contains("wptb-image-container")||t.classList.contains("wptb-moving-mode"))t.classList.remove("wptb-moving-mode"),(new WPTB_TableStateSaveManager).tableStateSet();return!0}}},t.onmouseover=function(e){t.classList.remove("wptb-ondragenter")}},applyGenericItemSettings=function(r,e){var t,o,a=2<arguments.length&&void 0!==arguments[2]&&arguments[2],i=r.getDOMElement();if(null==e||1==a){t=document.counter.nextIndex(r.kind);for(var n=document.getElementsByClassName("wptb-ph-element"),l=[],s=0;s<n.length;s++){var d=new RegExp("wptb-element-"+r.kind+"-(\\d+)","i"),c=n[s].className.match(d);c&&l.push(c[1])}if(0<l.length)t=Math.max.apply(Math,l)+1;else t=1}else if(e&&!a){var p=e.split("-");t=p[p.length-1]}i.onmouseenter=function(e){if(!e.target.classList.contains("wptb-moving-mode")){var t=new WPTB_ActionsField;if(t.addActionField(1,i),t.setParameters(i),i.classList.remove("wptb-ondragenter"),"button"===r.kind){var a=i.querySelector("a"),n=a.querySelector("div");a.onclick=function(e){e.preventDefault()},WPTB_Helper.buttonsTinyMceInit(n)}else if("text"===r.kind)tinyMCE.init({target:i.childNodes[0],inline:!0,plugins:"link, paste",dialog_type:"modal",theme:"modern",menubar:!1,force_br_newlines:!1,force_p_newlines:!1,forced_root_block:"",fixed_toolbar_container:"#wpcd_fixed_toolbar",paste_as_text:!0,toolbar:"bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify",setup:function(e){e.on("change",function(e){var t=WPTB_Helper.findAncestor(i,"wptb-row");if(t.classList.contains("wptb-table-head")){var a=WPTB_Helper.findAncestor(t,"wptb-preview-table");WPTB_Helper.dataTitleColumnSet(a)}}),e.on("keydown",function(e){var t=new WPTB_ActionsField;t.addActionField(1,i),t.setParameters(i)}),e.on("keyup",function(e){var t=new WPTB_ActionsField;t.addActionField(1,i),t.setParameters(i),e.target.onblur=function(){(new WPTB_TableStateSaveManager).tableStateSet()}})},init_instance_callback:function(e){(window.currentEditor=e).on("focus",function(e){var t=document.getElementsByClassName("wptb-builder-panel")[0].offsetWidth;window.currentEditor&&55<=document.getElementById("wptb_builder").scrollTop&&"none"!=window.currentEditor.bodyElement.style.display?(document.getElementById("wpcd_fixed_toolbar").style.position="fixed",document.getElementById("wpcd_fixed_toolbar").style.right=t/2-document.getElementById("wpcd_fixed_toolbar").offsetWidth/2+"px",document.getElementById("wpcd_fixed_toolbar").style.top="100px"):(document.getElementById("wpcd_fixed_toolbar").style.position="static",delete document.getElementById("wpcd_fixed_toolbar").style.right,delete document.getElementById("wpcd_fixed_toolbar").style.top)})}});else if("list"===r.kind){o=i.getElementsByClassName("wptb-list-item-content");for(var l=0;l<o.length;l++)WPTB_Helper.listItemsTinyMceInit(o[l])}}},i.onmouseleave=function(e){var t=new WPTB_ActionsField;t.wptbActions&&"1"!=t.wptbActions.type||t.leaveFromField(e,i,1)};var m=document.getElementsByClassName("wptb-actions");if(0<m.length&&(m=m[0]),"text"==r.kind){new MutationObserver(function(e){var t=WPTB_Helper.findAncestor(i,"wptb-row");if(t.classList.contains("wptb-table-head")){var a=WPTB_Helper.findAncestor(t,"wptb-preview-table");WPTB_Helper.dataTitleColumnSet(a)}}).observe(r.getDOMElement(),{attributes:!0,attributeFilter:["style"]})}else if("star_rating"==r.kind)for(var u=i.getElementsByClassName("wptb-rating-star"),b=0;b<u.length;b++){var g=u[b];WPTB_Helper.starRatingEventHandlersAdd(g);var w=g.querySelector(".wptb-rating-star-zero-set");w&&(w.onclick=function(e){var t=WPTB_Helper.findAncestor(e.target,"wptb-rating-stars-list");if(t)for(var a=t.children,n=0;n<a.length;n++)a[n].classList.remove("wptb-rating-star-selected-full"),a[n].classList.remove("wptb-rating-star-selected-half")})}var v=i.className.match(/wptb-element-(.+)-(\d+)/i);v&&i.classList.remove(v[0]),i.classList.contains("wptb-ph-element")||i.classList.add("wptb-ph-element"),i.classList.contains("wptb-element-"+r.kind+"-"+t)||i.classList.add("wptb-element-"+r.kind+"-"+t),new WPTB_ElementOptions(r,t,e),document.counter.increment(r.kind)};
|
1 |
+
var WPTB_ActionsField=function p(){var m=this;this.wptbActions,0!=document.getElementsByClassName("wptb-actions").length&&(this.wptbActions=document.getElementsByClassName("wptb-actions")[0]),this.addActionField=function(e,i){var t=document.getElementsByTagName("body")[0],a=document.getElementsByClassName("wptb-actions");if(0!=a.length){var n=a[0].activeElem;for(n&&n.classList.remove("wptb-directlyhovered");0!=a.length;)a[0].parentNode.removeChild(a[0])}if(1==e){var l=void 0,r=void 0,o=void 0;l=document.createElement("span"),r=document.createElement("span"),o=document.createElement("span"),(a=document.createElement("div")).classList.add("wptb-actions"),l.classList.add("dashicons","dashicons-trash","wptb-delete-action"),r.classList.add("dashicons","dashicons-admin-page","wptb-duplicate-action"),o.classList.add("dashicons","dashicons-move","wptb-move-action"),o.draggable=!0,a.appendChild(o),a.appendChild(r),a.appendChild(l),t.appendChild(a),a.activeElem=i,a.type=1,l.onclick=function(e){var t=e.target.parentNode.activeElem,a=t.parentNode;if(a.removeChild(t),"text"==t.kind){var n=a.parentNode;if(n.classList.contains("wptb-table-head")){var l=WPTB_Helper.findAncestor(n,"wptb-preview-table");WPTB_Helper.dataTitleColumnSet(l)}}(new p).actionsRemove(),(new WPTB_TableStateSaveManager).tableStateSet()},r.onclick=function(e){var t=void 0,a=void 0,n=e.target.parentNode.activeElem,l=n.cloneNode(!0);l.classList.remove("wptb-directlyhovered"),a=n.className.match(/wptb-element-(.+)-(\d+)/i)[1];var r=n.parentNode;if("list"==a){for(var o=[],i=n.querySelectorAll("ul li .wptb-list-item-content"),s=0;s<i.length;s++)o.push(i[s].innerHTML);t=new WPTB_List(o,l),r.insertBefore(t.getDOMElement(),n.nextSibling)}else if("text"==a)t=new WPTB_Text(l.childNodes[0].innerHTML,l),r.insertBefore(t.getDOMElement(),n.nextSibling);else if("image"==a)t=new WPTB_Image("",n),r.insertBefore(t.getDOMElement(),n.nextSibling);else if("button"==a){var d=l.childNodes[0].querySelector("p").innerHTML;t=new WPTB_Button(d,l),r.insertBefore(t.getDOMElement(),n.nextSibling)}else(a="star_rating")&&(t=new WPTB_StarRating(l),r.insertBefore(t.getDOMElement(),n.nextSibling));WPTB_innerElementSet(t.getDOMElement()),new p(1,n).setParameters(n),(new WPTB_TableStateSaveManager).tableStateSet()},o.ondragstart=function(e){var t,a,n=WPTB_Helper.dragImagesArr(),l=e.target.parentNode.activeElem;a=(t=l.className.match(/wptb-element-(.+)-(\d+)/i))[1],l.classList.add("wptb-moving-mode"),e.dataTransfer.effectAllowed="move",e.dataTransfer.setDragImage(n[a],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 r=e.target.parentNode.activeElem;if("text"==r.kind){var o=r.parentNode.parentNode;if(o.classList.contains("wptb-table-head")){var i=WPTB_Helper.findAncestor(o,"wptb-preview-table");WPTB_Helper.dataTitleColumnSet(i)}}m.actionsHide()},a.style.display="block",m.wptbActions=a}else if(2==e){var s=void 0,d=void 0;s=document.createElement("span"),d=document.createElement("span"),(a=document.createElement("span")).classList.add("wptb-actions"),s.classList.add("dashicons","dashicons-trash","wptb-delete-action"),d.classList.add("dashicons","dashicons-admin-page","wptb-duplicate-action"),a.append(d,s),t.appendChild(a),a.activeElem=i;var c=WPTB_Helper.findAncestor(i,"wptb-directlyhovered");c&&c.classList.remove("wptb-directlyhovered"),a.type=2,s.onclick=function(e){var t=e.target.parentNode.activeElem,a=t.parentNode;new p(4).actionsRemove(),a.removeChild(t),WPTB_Helper.listItemsRecalculateIndex(a),(new WPTB_TableStateSaveManager).tableStateSet()},d.onclick=function(e){var t=i.getBoundingClientRect(),a=t.top,n=e.target.parentNode.activeElem,l=n.querySelector(".wptb-list-item-content").innerHTML,r=new WPTB_ListItem(l,n,!0);n.parentNode.insertBefore(r.getDOMElement(),i.nextSibling),WPTB_Helper.listItemsTinyMceInit(r.getDOMElement().firstChild);var o=i.getElementsByClassName("wptb-list-item-content");(0<o.length&&(o=o[0]),setTimeout(function(){o.innerHTML=l,WPTB_Helper.listItemsRecalculateIndex(n.parentNode)},5),a!=(t=i.getBoundingClientRect()).top)&&new p(2,i).setParameters(i);(new WPTB_TableStateSaveManager).tableStateSet()},a.style.display="block",m.wptbActions=a}},this.setParameters=function(t){if(!m.wptbActions){var e=document.getElementsByClassName("wptb-actions");0<e.length&&(m.wptbActions=e[0])}m.wptbActions&&(m.wptbActions.style.display="block");var a=t.getBoundingClientRect(),n=document.getElementsByClassName("wptb-container")[0],l=function(){var e=t.getBoundingClientRect();m.wptbActions.style.top=parseFloat(e.top)-15+"px"};n.removeEventListener("scroll",l,!1),m.wptbActions.style.top=parseFloat(a.top)-15+"px",m.wptbActions.style.left=parseFloat(a.right)-parseFloat(m.wptbActions.clientWidth)+1+"px",m.wptbActions.style.display="block",t.classList.add("wptb-directlyhovered"),n.addEventListener("scroll",l,!1)},this.leaveFromField=function(e,t,a){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")))return m.wptbActions||(m.wptbActions=document.getElementsByClassName("wptb-actions")[0]),void(m.wptbActions.onmouseleave=function(e){if(null!=e.relatedTarget&&e.relatedTarget!=m.wptbActions.activeElem&&WPTB_Helper.findAncestor(e.relatedTarget,"wptb-directlyhovered")!=m.wptbActions.activeElem&&(e.target.activeElem.classList.remove("wptb-directlyhovered"),m.wptbActions.style.display="none",2==m.wptbActions.type)){var t=new p;t.addActionField(1,e.relatedTarget.parentNode.parentNode),t.setParameters(e.relatedTarget.parentNode.parentNode)}});t.classList.remove("wptb-directlyhovered"),m.wptbActions.style.display="none",2==m.wptbActions.type&&e.relatedTarget&&"ul"==e.relatedTarget.localName&&(m.addActionField(1,e.relatedTarget.parentNode),m.setParameters(e.relatedTarget.parentNode))},this.actionsRemove=function(){if(!m.wptbActions){var e=document.getElementsByClassName("wptb-actions");0<e.length&&(m.wptbActions=e[0])}m.wptbActions&&m.wptbActions.parentNode.removeChild(m.wptbActions)},this.actionsHide=function(){if(!m.wptbActions){var e=document.getElementsByClassName("wptb-actions");0<e.length&&(m.wptbActions=e[0])}m.wptbActions&&(m.wptbActions.style.opacity=0)}};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)}document.addEventListener("DOMContentLoaded",function(){var e=WPTB_Helper.detectMode();if(e){var a=new XMLHttpRequest,t=ajaxurl+"?action=get_table&id="+e;a.open("GET",t,!0),a.setRequestHeader("Content-type","application/x-www-form-urlencoded"),a.onreadystatechange=function(e){if(4!=this.readyState||200!=this.status);else{var t=JSON.parse(a.responseText);document.getElementById("wptb-setup-name").value=t[0],t[1]?(document.getElementsByClassName("wptb-table-generator")[0].style.display="none",document.getElementsByClassName("wptb-table-setup")[0].appendChild(WPTB_Parser(t[1])),WPTB_Table(),WPTB_LeftPanel(),WPTB_Settings(),(new WPTB_TableStateSaveManager).tableStateSet()):document.getElementsByClassName("wptb-table-generator")[0].style.display="table"}},a.send(null)}else document.getElementsByClassName("wptb-table-generator")[0].style.display="table";document.counter=new ElementCounters,document.select=new MultipleSelect,WPTB_Initializer(),settings=WPTB_Settings()});var WPTB_Button=function(e,t){var a=document.createElement("div"),n=document.createElement("div"),l=document.createElement("a"),r=document.createElement("div"),o=document.createElement("p"),i=void 0,s=!1;if(a.classList.add("wptb-button-container","wptb-size-M","wptb-"),n.classList.add("wptb-button-wrapper"),r.classList.add("wptb-button"),o.innerHTML=null!=e?e:"Button Text",t){var d=t.className.match(/wptb-element-((.+-)\d+)/i);d&&Array.isArray(d)&&(i=d[1],s=!0);var c=[].concat(_toConsumableArray(t.attributes));if(0<c.length)for(var p=0;p<c.length;p++)a.setAttribute(c[p].name,c[p].value);var m=t.querySelector(".wptb-button-wrapper");if(m){var u=[].concat(_toConsumableArray(m.attributes));if(0<u.length)for(var b=0;b<u.length;b++)"style"==u[b].name&&n.setAttribute(u[b].name,u[b].value)}var g=t.querySelector("a");if(g)if(0<(v=[].concat(_toConsumableArray(g.attributes))).length)for(var w=0;w<v.length;w++)"style"!=v[w].name&&"href"!=v[w].name&&"target"!=v[w].name||l.setAttribute(v[w].name,v[w].value);var v,h=t.querySelector(".wptb-button");if(h)if(0<(v=[].concat(_toConsumableArray(h.attributes))).length)for(var y=0;y<v.length;y++)"style"==v[y].name&&r.setAttribute(v[y].name,v[y].value)}return n.appendChild(l),l.appendChild(r),r.appendChild(o),a.appendChild(n),this.kind="button",this.getDOMElement=function(){return a},applyGenericItemSettings(this,i,s),this},WPTB_Cell=function(e,i){if(!i){(i=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)&&(i.style.border=t+"px solid "+jQuery("#wptb-table-border-color").val()),i.classList.add("wptb-droppable","wptb-cell")}i.draggable=!1,e&&(i.onclick=e),WPTB_innerElementSet(i);var s=i.getElementsByClassName("wptb-ph-element");if(0<s.length)for(var a=function(e){var t=i.getElementsByClassName("wptb-space-between");if(0<t.length)for(var a=0;a<t.length;a++)WPTB_Space(t[a]);s[e].getDOMElement=function(){return s[e]},WPTB_innerElementSet(s[e]);var n=s[e].className.match(/wptb-element-((.+-)\d+)/i);if(n&&Array.isArray(n)){var l=n[1].split("-");if(s[e].kind=l[0],applyGenericItemSettings(s[e],n[1]),"list"==s[e].kind){var r=s[e].getElementsByTagName("li");if(0<r.length)for(var o=0;o<r.length;o++)WPTB_ListItem(void 0,r[o])}}},n=0;n<s.length;n++)a(n);return this.getDOMElement=function(){return i},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)},i.getCellDimensions=function(){var e=window.getComputedStyle(this,null),t=e.getPropertyValue("padding-left"),a=e.getPropertyValue("padding-right"),n=e.getPropertyValue("border-left-width"),l=e.getPropertyValue("border-right-width"),r=e.getPropertyValue("padding-top"),o=e.getPropertyValue("padding-bottom"),i=e.getPropertyValue("border-top-width"),s=e.getPropertyValue("border-bottom-width");return{width:parseFloat(this.offsetWidth,10)-parseFloat(t,10)-parseFloat(a,10)-parseFloat(n,10)-parseFloat(l,10),height:parseFloat(this.offsetHeight,10)-parseFloat(r,10)-parseFloat(o,10)-parseFloat(i,10)-parseFloat(s,10)}},this},WPTB_DropHandle=function(i,e){var s=void 0,d=void 0;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");var t=document.createElement("div"),a=document.createElement("div"),n=document.createElement("div"),l=document.createElement("div");t.classList.add("wptb-drop-border-marker-top"),a.classList.add("wptb-drop-border-marker-right"),n.classList.add("wptb-drop-border-marker-bottom"),l.classList.add("wptb-drop-border-marker-left"),d.appendChild(t),d.appendChild(a),d.appendChild(n),d.appendChild(l);var r=document.getElementsByTagName("body");0<r.length&&(r[0].appendChild(s),r[0].appendChild(d)),s.ondragenter=function(){},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);else{var n=s.getDOMParentElement();if(a=n.parentNode,"Above Element"==s.dataset.text)a.insertBefore(t,n);else if("Below Element"==s.dataset.text){var l=n.nextSibling;a.insertBefore(t,l)}}var r=a.parentNode;if(r.classList.contains("wptb-table-head")){var o=WPTB_Helper.findAncestor(r,"wptb-preview-table");WPTB_Helper.dataTitleColumnSet(o)}(s.style.display="none",d.style.display="none",WPTB_innerElementSet(t),console.log(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){var o=void 0;if("td"==i.localName?o=i.parentNode:"div"==i.localName&&i.classList.contains("wptb-ph-element")&&(o=i.parentNode.parentNode),o.classList.contains("wptb-table-head")){for(var c=e.dataTransfer.types,p=!1,m=0;m<c.length;m++){var u=c[m].match(/wptbelindic-([a-z]+)/i);if(u&&"text"!=u[1]){p=!0;break}}if(p)return}s.style.width=i.offsetWidth+"px";var b=i.offsetHeight,g=i.getBoundingClientRect(),w=parseFloat(g.left),v=void 0;if(s.style.left=w+"px",-1!=e.dataTransfer.types.indexOf("wptb-moving-mode")){var h=document.getElementsByClassName("wptb-moving-mode")[0];i==h?(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 y=null==e.offsetY?e.layerY:e.offsetY;v=parseFloat(g.top)-parseFloat(11),s.dataset.text="Above Element",b/2<y&&(v=parseFloat(g.top)+b-1,s.dataset.text="Below Element")}else s.dataset.text="Drop Here",v=parseFloat(g.top)+b/2-5;s.style.top=v+"px",d.style.top=g.top+"px",d.style.left=g.left+"px",wptbDropBorderMarkerTop=d.querySelector(".wptb-drop-border-marker-top"),wptbDropBorderMarkerTop.style.width=parseFloat(i.offsetWidth)-parseFloat(1)+"px",wptbDropBorderMarkerRight=d.querySelector(".wptb-drop-border-marker-right"),wptbDropBorderMarkerRight.style.height=parseFloat(g.bottom)-parseFloat(g.top)-1+"px",wptbDropBorderMarkerRight.style.left=wptbDropBorderMarkerTop.style.width,wptbDropBorderMarkerBottom=d.querySelector(".wptb-drop-border-marker-bottom"),wptbDropBorderMarkerBottom.style.width=wptbDropBorderMarkerTop.style.width,wptbDropBorderMarkerBottom.style.top=wptbDropBorderMarkerRight.style.height,wptbDropBorderMarkerLeft=d.querySelector(".wptb-drop-border-marker-left"),wptbDropBorderMarkerLeft.style.height=wptbDropBorderMarkerRight.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_ElementOptions=function(e,t,a){var n,l=e.getDOMElement();prop=document.querySelector(".wptb-"+e.kind+"-options-prototype").cloneNode(!0),prop.classList.remove("wptb-"+e.kind+"-options-prototype"),n="wptb-options-"+e.kind+"-"+t;for(var r=prop.getElementsByClassName("wptb-element-property"),o=0;o<r.length;o++)r[o].dataset.element=n;if(prop.classList.add(n),document.getElementById("element-options-group").appendChild(prop),a)if("button"==e.kind){var i=document.getElementsByClassName("wptb-element-"+a)[0],s=void 0,d=void 0,c=void 0,p=void 0;if(i&&(p=i.className.match(/wptb-size-([a-z]+)/i)),p&&Array.isArray(p)){var m=prop.getElementsByClassName("wptb-btn-size-btn");for(o=0;o<m.length;o++)m[o].classList.remove("selected"),m[o].innerHTML==p[1]&&m[o].classList.add("selected")}if(i&&(s=i.getElementsByClassName("wptb-button-wrapper"),d=i.getElementsByTagName("a"),c=i.getElementsByClassName("wptb-button")),s){var u=s[0].style.justifyContent,b=prop.querySelector('select[data-type="button-alignment"]').getElementsByTagName("option"),g=void 0;"flex-start"==u?g="left":"center"!=u&&u?"flex-end"==u&&(g="right"):g="center";for(var w=0;w<b.length;w++)b[w].value==g&&(b[w].selected=!0)}if(0<d.length){var v=d[0].getAttribute("href"),h=d[0].getAttribute("target"),y=d[0].getAttribute("id"),f=prop.querySelector('input[data-type="button-link"]'),B=prop.querySelector('input[data-type="button-link-target"]'),S=B.getAttribute("id"),T=B.parentNode.getElementsByTagName("label")[0],E=prop.querySelector('input[data-type="button-id"]');S=S+"-"+a.split("-")[1],B.setAttribute("id",S),T.setAttribute("for",S),f.value=v,h&&"_blank"==h&&(B.checked=!0),E.value=y}if(c){var C=c[0].style.color,x=c[0].style.backgroundColor,_=prop.querySelector('input[data-type="button-text-color"]'),N=prop.querySelector('input[data-type="button-color"]');_.value=WPTB_Helper.rgbToHex(C),N.value=WPTB_Helper.rgbToHex(x)}}else if("image"==e.kind){var I=document.getElementsByClassName("wptb-element-"+a);if(0<I.length){var P=I[0].getElementsByTagName("a");if(0<P.length){var A=P[0];if(A){var k=void 0;k="none"==A.style.float?"center":A.style.float;for(var L=prop.querySelector('select[data-type="image-alignment"]').getElementsByTagName("option"),W=0;W<L.length;W++)L[W].value==k&&(L[W].selected=!0);A.onclick=function(e){e.preventDefault()};var M=A.getAttribute("href"),H=prop.querySelector('input[data-type="image-link"]');M&&(H.value=M);var q=A.getAttribute("target"),D=prop.querySelector('input[data-type="image-link-target"]'),F=D.getAttribute("id"),O=D.parentNode.getElementsByTagName("label")[0];F=F+"-"+a.split("-")[1],D.setAttribute("id",F),O.setAttribute("for",F),q&&"_blank"==q&&(D.checked=!0);var z=A.style.width;if(z){var R=prop.querySelector('input[type="range"][data-type="image-size"]'),j=prop.querySelector('input[type="number"][data-type="image-size"]');R.value=parseInt(z),j.value=parseInt(z)}var Q=A.getElementsByTagName("img");if(0<Q.length){var V=Q[0].getAttribute("alt");prop.querySelector('input[type="text"][data-type="alternative-text"]').value=V}}}}}else if("text"==e.kind){var G=document.getElementsByClassName("wptb-element-"+a);if(0<G.length){var J=G[0].style.fontSize,U=G[0].style.color,Y=prop.querySelector('input[type="range"][data-type="font-size"]'),X=prop.querySelector('input[type="number"][data-type="font-size"]'),K=prop.querySelector('input[type="text"][data-type="color"]');Y.value=parseInt(J)?parseInt(J):10,X.value=parseInt(J)?parseInt(J):10,K.value=WPTB_Helper.rgbToHex(U)}}else if("list"==e.kind){var $=document.getElementsByClassName("wptb-element-"+a);if(0<$.length){var Z=$[0].querySelector("p").style.color;prop.querySelector('input[type="text"][data-type="list-text-color"]').value=WPTB_Helper.rgbToHex(Z);var ee=$[0].querySelectorAll("li");if(0<ee.length){var te=ee[0].querySelector("p").classList;if(0<te.length){var ae=prop.querySelector('select[data-type="list-class"]');if(ae){ae.value="unordered";for(var ne=ae.parentNode.nextSibling,le=0;le<10&&"1"!=ne.nodeType;le++)ne=ne.nextSibling;if(ne){var re=ne.getAttribute("id");ne.setAttribute("id",re+"-"+a),ne.style.display="flex"}var oe=prop.querySelector('select[data-type="list-style-type"]');oe&&(oe.parentNode.style.display="flex",te.contains("wptb-list-style-type-disc")?oe.value="disc":te.contains("wptb-list-style-type-circle")?oe.value="circle":te.contains("wptb-list-style-type-square")?oe.value="square":te.contains("wptb-list-style-type-none")&&(oe.value="none"))}}}var ie=$[0].getElementsByClassName("wptb-list-item-content");if(0<ie.length){for(var se=[],de=0;de<ie.length;de++){var ce=ie[de].querySelector("p");ce&&(ce.style.textAlign?se.push(ce.style.textAlign):se.push("left"))}var pe=0,me=0,ue=0;if(0<se.length)for(var be=0;be<se.length;be++)se[be]&&("left"==se[be]?pe++:"center"==se[be]?me++:"right"==se[be]&&ue++);var ge=prop.querySelector('select[data-type="list-alignment"]'),we=Math.max(pe,me,ue);pe==we?ge.value="left":me==we?ge.value="center":ue==we&&(ge.value="right")}}}else if("star_rating"==e.kind){var ve=document.getElementsByClassName("wptb-element-"+a);if(0<ve.length){var he=(ve=ve[0]).querySelector("li");if(he){var ye=he.style.width,fe=prop.querySelector('input[type="range"][data-type="star-size"]'),Be=prop.querySelector('input[type="number"][data-type="star-size"]');if(fe.value=parseInt(ye)?parseInt(ye):10,Be.value=parseInt(ye)?parseInt(ye):10,he.querySelector("span")){var Se=prop.querySelector('input[type="text"][data-type="star-color"]'),Te=he.querySelector("span").style.fill;Se.value=WPTB_Helper.rgbToHex(Te)}}var Ee=ve.querySelectorAll("li"),Ce=prop.querySelector('input[type="number"][data-type="stars-count"]');1==Ee.length&&"none"==Ee[0].style.display?Ce.value=0:Ce.value=Ee.length;var xe=ve.style.textAlign,_e=prop.querySelector('select[data-type="rating-alignment"]').getElementsByTagName("option"),Ne=void 0;"start"==xe?Ne="left":"center"!=xe&&xe?"right"==xe&&(Ne="right"):Ne="center";for(var Ie=0;Ie<_e.length;Ie++)_e[Ie].value==Ne&&(_e[Ie].selected=!0);var Pe=ve.querySelector(".wptb-success-box");if(Pe){var Ae=prop.querySelector('input[type="checkbox"][data-type="show-number-rating"]');if("block"==Pe.style.display){Ae.checked=!0;for(var ke=prop.getElementsByClassName("wptb-numeral-rating-option-container"),Le=0;Le<ke.length;Le++)ke[Le].style.display="block"}else Ae.checked=!1;var We=Pe.querySelector(".wptb-text-message");if(We){var Me=We.style.fontSize,He=We.style.color,qe=prop.querySelector('input[type="range"][data-type="numeral-rating-size"]'),De=prop.querySelector('input[type="number"][data-type="numeral-rating-size"]'),Fe=prop.querySelector('input[type="text"][data-type="numeral-rating-color"]');qe.value=parseInt(Me)?parseInt(Me):10,De.value=parseInt(Me)?parseInt(Me):10,Fe.value=WPTB_Helper.rgbToHex(He)}}}}if(l.onclick=function(){var e=this.className.match(/wptb-element-((.+-)\d+)/i),t=".wptb-"+e[2]+"options.wptb-options-"+e[1];document.getElementsByClassName("wptb-elements-container")[0].style.display="none",document.getElementsByClassName("wptb-settings-section")[0].style.display="none",document.getElementById("element-options-group").style.display="block";for(var a=document.getElementById("element-options-group").childNodes,n=0;n<a.length;n++)a[n].style&&(a[n].style.display="none");document.querySelector(t).style.display="block"},"button"==e.kind){var Oe=prop.getElementsByClassName("wptb-btn-size-btn");for(o=0;o<Oe.length;o++)Oe[o].onclick=function(){var e=this.innerHTML,t=this.dataset.element.match(/wptb-options-(.+)-(\d+)/i),a=t[1],n=t[2],l=document.getElementsByClassName("wptb-element-"+a+"-"+n)[0];l.classList.remove("wptb-size-S"),l.classList.remove("wptb-size-M"),l.classList.remove("wptb-size-L"),l.classList.remove("wptb-size-XL"),l.classList.add("wptb-size-"+e);for(var r=this.parentNode.getElementsByClassName("wptb-btn-size-btn"),o=0;o<r.length;o++)r[o].classList.remove("selected");this.classList.add("selected"),(new WPTB_TableStateSaveManager).tableStateSet()}}var ze=prop.getElementsByClassName("wptb-element-property");for(o=0;o<ze.length;o++){if(ze[o].classList.contains("wptb-color-picker")&&jQuery(ze[o]).wpColorPicker({change:function(e,t){WPTB_Helper.wpColorPickerChange(e,t),WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving(e)},clear:function(e){WPTB_Helper.wpColorPickerChange(e)}}),ze[o].classList.contains("wptb-stars-count-field")&&WPTB_Helper.numberImputSize(ze[o],1,10),"font-size"===ze[o].dataset.type||"image-size"===ze[o].dataset.type||"star-size"===ze[o].dataset.type||"numeral-rating-size"===ze[o].dataset.type)ze[o].parentNode.parentNode.getElementsByClassName("wptb-size-slider")[0].oninput=function(){this.parentNode.parentNode.getElementsByClassName("wptb-size-number")[0].value=this.value,this.parentNode.parentNode.getElementsByClassName("wptb-size-number")[0].onchange(event)};ze[o].onchange=function(e){var t=this.dataset.element.match(/wptb-options-(.+)-(\d+)/i),a=t[1],n=t[2],l=document.getElementsByClassName("wptb-element-"+a+"-"+n)[0],r=this.value;switch(this.dataset.type){case"src":l.getElementsByTagName("img")[0].src=this.value;break;case"alternative-text":l.getElementsByTagName("img")[0].alt=this.value;break;case"image-link":l.getElementsByTagName("a")[0].href=WPTB_Helper.linkHttpCheckChange(this.value);break;case"image-link-target":1==this.checked?l.getElementsByTagName("a")[0].target="_blank":l.getElementsByTagName("a")[0].target="_self";break;case"image-link-nofollow":1==this.checked?l.getElementsByTagName("a")[0].rel="nofollow":l.getElementsByTagName("a")[0].removeAttribute("rel");break;case"image-size":l.getElementsByTagName("a")[0].style.width=this.value+"%",l.getElementsByTagName("a")[0].style.height="auto",this.parentNode.parentNode.getElementsByClassName("wptb-size-slider")[0].value=this.value;break;case"image-alignment":var o="";o="center"==this.value?"none":this.value,l.querySelector(".wptb-image-wrapper a").style.float=o;break;case"font-size":l.style.fontSize=r+"px",this.parentNode.parentNode.getElementsByClassName("wptb-size-slider")[0].value=this.value;break;case"button-alignment":var i="";i="left"==this.value?"start":"right"==this.value?"flex-end":"center",l.getElementsByClassName("wptb-button-wrapper")[0].style.justifyContent=i;break;case"rating-alignment":i="";i="left"==this.value?"start":"right"==this.value?"right":"center",l.style.textAlign=i;break;case"button-link":this.value?l.getElementsByTagName("a")[0].href=WPTB_Helper.linkHttpCheckChange(this.value):l.getElementsByTagName("a")[0].removeAttribute("href");break;case"button-link-target":1==this.checked?l.getElementsByTagName("a")[0].target="_blank":l.getElementsByTagName("a")[0].target="_self";break;case"button-link-nofollow":1==this.checked?l.getElementsByTagName("a")[0].rel="nofollow":l.getElementsByTagName("a")[0].removeAttribute("rel");break;case"button-id":this.value?l.getElementsByTagName("a")[0].id=this.value:l.getElementsByTagName("a")[0].removeAttribute("id");case"button-color":break;case"list-alignment":for(var s=l.querySelectorAll("li"),d=0;d<s.length;d++){var c=s[d].querySelector("p");c&&(c.style.textAlign=this.value)}break;case"list-class":var p=e.target.parentNode.parentNode.querySelector("[data-type=list-style-type]").parentNode,m=p.parentNode;if("unordered"==r){p.style.display="flex",m.querySelector(".wptb-list-icon-select-label").style.display="flex";var u=l.querySelectorAll("li");for(d=0;d<u.length;d++){var b=u[d].querySelector("p");b.removeAttribute("class"),b.classList.add("wptb-list-style-type-disc")}m.querySelector("[data-type=list-style-type]").value="disc"}else{p.style.display="none",m.querySelector(".wptb-list-icon-select-label").style.display="none";var g=l.querySelectorAll("li");for(d=0;d<g.length;d++){g[d].querySelector("p").removeAttribute("class")}}break;case"list-style-type":for(g=l.querySelectorAll("li"),d=0;d<g.length;d++){var w=g[d].querySelector("p");w.removeAttribute("class"),w.classList.add("wptb-list-style-type-"+r.toLowerCase())}break;case"star-size":for(var v=l.querySelectorAll("li"),h=0;h<v.length;h++){v[h].style.width=r+"px",v[h].style.height=r+"px";for(var y=v[h].querySelectorAll("span"),f=0;f<y.length;f++)y[f].querySelector("svg")&&(y[f].style.width=r+"px",y[f].style.height=r+"px",y[f].querySelector("svg").style.width=r+"px")}break;case"show-number-rating":var B=WPTB_Helper.findAncestor(this,"wptb-star_rating-options").getElementsByClassName("wptb-numeral-rating-option-container");if(WPTB_Helper.starRatingTextMessageChenge(l),0<B.length){var S=l.querySelector(".wptb-text-message"),T=this.checked?"checked":"unchecked";if("checked"==T){for(var E=0;E<B.length;E++)B[E].style.display="block";S.parentNode.style.display="block"}else if("unchecked"==T){for(var C=0;C<B.length;C++)B[C].style.display="none";S.parentNode.style.display="none"}}break;case"numeral-rating-size":var x=l.querySelector(".wptb-text-message");x.style.fontSize=r+"px",x.style.height=r+"px",x.style.lineHeight=r+"px";break;case"stars-count":var _=l.querySelectorAll("li"),N=_.length;if(N<r)for(var I=r-N,P=_[_.length-1],A=P.parentNode,k=0;k<I;k++){var L=P.cloneNode(!0);L.removeAttribute("class"),L.setAttribute("class","wptb-rating-star"),L.dataset.value=parseInt(P.dataset.value)+k+1,WPTB_Helper.starRatingEventHandlersAdd(L),A.appendChild(L)}else if(r<N){var W=parseInt(N)-parseInt(r);0==r&&(W--,_[0].removeAttribute("class"),_[0].setAttribute("class","wptb-rating-star"),_[0].style.display="none");var M=_.length;for(d=0;d<W;d++)_[0].parentNode.removeChild(_[M-d-1])}else r==N&&1==N&&(_[0].style.display="inline-block");WPTB_Helper.starRatingTextMessageChenge(l)}e.target.classList.contains("wptb-size-slider")||e.target.classList.contains("wptb-size-slider")?e.target.onmouseup=function(){(new WPTB_TableStateSaveManager).tableStateSet()}:(new WPTB_TableStateSaveManager).tableStateSet()}}},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){return(e=e.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i))&&4===e.length?"#"+("0"+parseInt(e[1],10).toString(16)).slice(-2)+("0"+parseInt(e[2],10).toString(16)).slice(-2)+("0"+parseInt(e[3],10).toString(16)).slice(-2):""},getDragImageCustom:function(e){var t=location.protocol+"//"+location.hostname,a=document.createElement("img");return a.src=t+"/wp-content/plugins/wp-table-builder/inc/admin/views/builder/icons/"+e+".png",a},dragImagesArr:function(){return{text:WPTB_Helper.getDragImageCustom("text"),image:WPTB_Helper.getDragImageCustom("image"),button:WPTB_Helper.getDragImageCustom("button"),list:WPTB_Helper.getDragImageCustom("list"),star_rating:WPTB_Helper.getDragImageCustom("half-filled-rating-star")}},listItemsRecalculateIndex:function(e){var t=e.querySelectorAll("p");if(0<t.length)for(var a=0;a<t.length;a++)t[a].dataset.listStyleTypeIndex=Number(a)+1+"."},listItemsTinyMceInit:function(e){tinyMCE.init({target:e,inline:!0,plugins:"link, paste",dialog_type:"modal",theme:"modern",menubar:!1,fixed_toolbar_container:"#wpcd_fixed_toolbar",paste_as_text:!0,toolbar:"bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify",setup:function(e){e.on("keydown",function(e){var t=e.target.parentNode;if(13==e.keyCode){e.preventDefault();var a=e.target.innerHTML,n=new WPTB_ListItem(a,t,!0);return t.parentNode.insertBefore(n.getDOMElement(),t),WPTB_Helper.listItemsTinyMceInit(n.getDOMElement().firstChild),e.target.querySelector("p").innerText="New List Item",void WPTB_Helper.listItemsRecalculateIndex(t.parentNode)}if("8"==e.keyCode||"46"==e.keyCode){var l=e.target.querySelector("p").innerHTML.replace(/<[^>]+>/g,"");if(""==(l=(l=l.replace(/\s+/g," ").trim()).replace(/ /g,"").trim()))e.preventDefault(),e.target.querySelector("p").innerText="\n";else{var r=WPTB_Helper.getSelectionText();(r=(r=r.replace(/\s+/g," ").trim()).replace(/ /g,"").trim())==l&&(e.preventDefault(),e.target.querySelector("p").innerText="\n")}}var o=e.target.parentNode,i=new WPTB_ActionsField;i.addActionField(2,o),i.setParameters(o)}),e.on("keyup",function(e){var t=e.target.parentNode,a=new WPTB_ActionsField;a.addActionField(2,t),a.setParameters(t),e.target.onblur=function(){(new WPTB_TableStateSaveManager).tableStateSet()}})},init_instance_callback:function(e){(window.currentEditor=e).on("focus",function(e){var t=document.getElementsByClassName("wptb-builder-panel")[0].offsetWidth;window.currentEditor&&55<=document.getElementById("wptb_builder").scrollTop&&"none"!=window.currentEditor.bodyElement.style.display?(document.getElementById("wpcd_fixed_toolbar").style.position="fixed",document.getElementById("wpcd_fixed_toolbar").style.right=t/2-document.getElementById("wpcd_fixed_toolbar").offsetWidth/2+"px",document.getElementById("wpcd_fixed_toolbar").style.top="100px"):(document.getElementById("wpcd_fixed_toolbar").style.position="static",delete document.getElementById("wpcd_fixed_toolbar").style.right,delete document.getElementById("wpcd_fixed_toolbar").style.top)})}})},buttonsTinyMceInit:function(n){tinyMCE.init({target:n,inline:!0,plugins:"link",dialog_type:"modal",theme:"modern",menubar:!1,fixed_toolbar_container:"#wpcd_fixed_toolbar",toolbar:"bold italic strikethrough",setup:function(e){e.on("keydown",function(e){13==e.keyCode&&e.preventDefault();var t=WPTB_Helper.findAncestor(n,"wptb-button-container"),a=new WPTB_ActionsField;a.addActionField(1,t),a.setParameters(t)}),e.on("keyup",function(e){var t=WPTB_Helper.findAncestor(n,"wptb-button-container"),a=new WPTB_ActionsField;a.addActionField(1,t),a.setParameters(t),e.target.onblur=function(){(new WPTB_TableStateSaveManager).tableStateSet()}})},init_instance_callback:function(e){(window.currentEditor=e).on("focus",function(e){var t=document.getElementsByClassName("wptb-builder-panel")[0].offsetWidth;window.currentEditor&&55<=document.getElementById("wptb_builder").scrollTop&&"none"!=window.currentEditor.bodyElement.style.display?(document.getElementById("wpcd_fixed_toolbar").style.position="fixed",document.getElementById("wpcd_fixed_toolbar").style.right=t/2-document.getElementById("wpcd_fixed_toolbar").offsetWidth/2+"px",document.getElementById("wpcd_fixed_toolbar").style.top="100px"):(document.getElementById("wpcd_fixed_toolbar").style.position="static",delete document.getElementById("wpcd_fixed_toolbar").style.right,delete document.getElementById("wpcd_fixed_toolbar").style.top)})}})},linkHttpCheckChange:function(e){if(e){if(-1!=e.indexOf("http://")||-1!=e.indexOf("https://"))return e;var t=e.split("/"),a=void 0;return Array.isArray(t)&&0<t.length&&(a=t[t.length-1]),document.location.protocol+"//"+a}return""},dataTitleColumnSet:function(e){for(var t=e.rows,a=t[0],n=getComputedStyle(a),l=a.children,r={},o=0;o<l.length;o++){for(var i=l[o].children,s=0;s<i.length;s++){var d=i[s];if(d.classList.contains("wptb-ph-element"))if("text"==d.className.match(/wptb-element-(.+)-(\d+)/i)[1]){var c=d.querySelector("p"),p=c.textContent,m=c.style.textAlign;r[l[o].dataset.xIndex]=[p,d.style.fontSize,d.style.color,n.backgroundColor,m];break}}r[l[o].dataset.xIndex]||(r[l[o].dataset.xIndex]=["","","",n.backgroundColor,""])}for(var u=1;u<t.length;u++)for(var b=t[u].children,g=0;g<b.length;g++)r[b[g].dataset.xIndex]?(b[g].dataset.wptbTitleColumn=r[b[g].dataset.xIndex][0],b[g].dataset.wptbTitleColumnFontSize=r[b[g].dataset.xIndex][1],b[g].dataset.wptbTitleColumnColor=r[b[g].dataset.xIndex][2],b[g].dataset.wptbTitleBackgroundColor=r[b[g].dataset.xIndex][3],b[g].dataset.wptbTitleAlign=r[b[g].dataset.xIndex][4]):(b[g].dataset.wptbTitleColumn="",b[g].dataset.wptbTitleColumnFontSize="",b[g].dataset.wptbTitleColumnColor="",b[g].dataset.wptbTitleBackgroundColor="",b[g].dataset.wptbTitleAlign="")},findAncestor:function(e,t){for(;(e=e.parentElement)&&!e.classList.contains(t););return e},getSelectionText:function(){return window.getSelection?window.getSelection().toString():document.selection.createRange().text},settingsPanelClear:function(){document.getElementById("wptb-adaptive-table-checkbox").checked=!1,document.getElementById("wptb-top-row-as-header").checked=!1,document.getElementById("wptb-table-border-slider").value=0,document.getElementById("wptb-table-border-number").value=0,document.getElementById("wptb-inner-border-check").checked=!1,document.getElementById("wptb-apply-inner-border").classList.remove("visible"),document.getElementById("wptb-table-inner-border-slider").value=1,document.getElementById("wptb-table-inner-border-number").value=1,WPTB_Helper.wpColorPickerClear("wptb-table-border-color",!0),WPTB_Helper.wpColorPickerClear("wptb-table-header-bg",!0),WPTB_Helper.wpColorPickerClear("wptb-even-row-bg",!0),WPTB_Helper.wpColorPickerClear("wptb-odd-row-bg",!0),document.getElementById("wptb-table-cell-slider").value=15,document.getElementById("wptb-table-cell-number").value=15},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{var t=WPTB_Helper.findAncestor(e.target,"wp-picker-container");if(t)if("square"==e.originalEvent.type){var a=t.getElementsByClassName("iris-square-handle");0<a.length&&((a=a[0]).onmouseup=function(){(new WPTB_TableStateSaveManager).tableStateSet()})}else if("strip"==e.originalEvent.type){var n=t.getElementsByClassName("iris-slider-offset");0<n.length&&((n=n[0]).onmouseup=function(){(new WPTB_TableStateSaveManager).tableStateSet()})}}},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 l=WPTB_Helper.findAncestor(a[n],"wp-picker-container");if(l){var r=l.parentNode;r.removeChild(l);var o=document.createElement("input");t?o.setAttribute("id",e):o.classList.add("wptb-element-property",e),o.value="",r.appendChild(o)}}},detectMode:function(){var e=window.location.href,t=new RegExp("[?&]table(=([^&#]*)|&|#|$)").exec(e);return!!t&&(t[2]?decodeURIComponent(t[2].replace(/\+/g," ")):"")},getColumnWidth:function(e,t){for(var a=t.dataset.xIndex,n=e.querySelectorAll('[data-x-index="'+a+'"]'),l=t.getCellDimensions().width,r=0;r<n.length;r++)l>n[r].getCellDimensions().width&&(l=n[r].getCellDimensions().width);return l},getRowHeight:function(e,t){for(var a=t.dataset.yIndex,n=e.querySelectorAll('[data-y-index="'+a+'"]'),l=t.getCellDimensions().height,r=0;r<n.length;r++)l>n[r].getCellDimensions().height&&(l=n[r].getCellDimensions().height);return l},newElementProxy:function(e){return"list"==e?new WPTB_List:"image"==e?new WPTB_Image:"text"==e?new WPTB_Text:"button"==e?new WPTB_Button:"star_rating"==e?new WPTB_StarRating:void 0},wpColorPickerChange:function(e,t){var a=void 0;a=t?t.color.toString():"";var n,l,r,o=WPTB_Helper.findAncestor(e.target,"wp-picker-input-wrap").getElementsByClassName("wptb-color-picker")[0];l=(n=o.dataset.element.match(/wptb-options-(.+)-(\d+)/i))[1],r=n[2];var i=document.getElementsByClassName("wptb-element-"+l+"-"+r)[0];if("button"==l)"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"==l){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"==l){if("star-color"==o.dataset.type)for(var c=i.querySelectorAll("li"),p=0;p<c.length;p++)for(var m=c[p].getElementsByTagName("span"),u=0;u<m.length;u++)m[u].style.fill=a;else if("numeral-rating-color"==o.dataset.type){i.querySelector(".wptb-text-message").style.color=a}}else i.style.color=a},starRatingSelectHoverSet:function(e){var t=void 0;t=e.target.classList.contains("wptb-rating-star")?e.target:WPTB_Helper.findAncestor(e.target,"wptb-rating-star");var a=parseInt(t.dataset.value,10),n=t.parentNode.children;if("mouseover"==e.type)for(var l=0;l<n.length;l++)l<a?l==a-1?e.target.classList.contains("wptb-rating-star-left-signal-part")?(n[l].classList.add("wptb-rating-star-hover-half"),n[l].classList.remove("wptb-rating-star-hover-full")):e.target.classList.contains("wptb-rating-star-right-signal-part")&&(n[l].classList.add("wptb-rating-star-hover-full"),n[l].classList.remove("wptb-rating-star-hover-half")):(n[l].classList.add("wptb-rating-star-hover-full"),n[l].classList.remove("wptb-rating-star-hover-half")):(n[l].classList.remove("wptb-rating-star-hover-full"),n[l].classList.remove("wptb-rating-star-hover-half"));else if("click"==e.type)for(var r=0;r<n.length;r++)r<a?r==a-1?e.target.classList.contains("wptb-rating-star-left-signal-part")?(n[r].classList.add("wptb-rating-star-selected-half"),n[r].classList.remove("wptb-rating-star-selected-full")):e.target.classList.contains("wptb-rating-star-right-signal-part")&&(n[r].classList.add("wptb-rating-star-selected-full"),n[r].classList.remove("wptb-rating-star-selected-half")):(n[r].classList.add("wptb-rating-star-selected-full"),n[r].classList.remove("wptb-rating-star-selected-half")):(n[r].classList.remove("wptb-rating-star-selected-full"),n[r].classList.remove("wptb-rating-star-selected-half"))},starRatingEventHandlersAdd:function(e){e.onmouseover=function(e){e.stopPropagation(),WPTB_Helper.starRatingSelectHoverSet(e)},e.onmouseout=function(){for(var e=this.parentNode.children,t=0;t<e.length;t++)e[t].classList.remove("wptb-rating-star-hover-half"),e[t].classList.remove("wptb-rating-star-hover-full")},e.onclick=function(e){WPTB_Helper.starRatingSelectHoverSet(e);var t=WPTB_Helper.findAncestor(e.target,"wptb-star_rating-container");WPTB_Helper.starRatingTextMessageChenge(t),new WPTB_ActionsField(1,t).setParameters(t),(new WPTB_TableStateSaveManager).tableStateSet()}},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;e=String(e),a<e&&(this.value=a)}},starRatingTextMessageChenge:function(e){var t=e.getElementsByClassName("wptb-rating-star-selected-full").length;0<e.getElementsByClassName("wptb-rating-star-selected-half").length&&(t=parseInt(t)+.5);var a=e.querySelectorAll("li"),n=a.length,l=e.querySelector(".wptb-text-message");1!=n||"none"!=a[0].style.display?l.innerHTML=t+"/"+n:l.innerHTML=""}},WPTB_Image=function(e,t){var a=void 0,n=void 0,l=void 0,r=!1;if(null==t){a=document.createElement("div"),n=document.createElement("div");var o=document.createElement("a"),i=document.createElement("img");o.style.display="block",o.appendChild(i),a.classList.add("wptb-image-container"),n.classList.add("wptb-image-wrapper"),n.appendChild(o),a.appendChild(n),o.onclick=function(e){e.preventDefault()},file_frame=wp.media.frames.file_frame=wp.media({title:"Select a image to upload",button:{text:"Use this image"},multiple:!1}),file_frame.on("select",function(){attachment=file_frame.state().get("selection").first().toJSON();var e=attachment.url.split(":"),t=void 0;Array.isArray(e)&&0<e.length&&(t=e[e.length-1]),i.src=t,i.height=attachment.height,i.width=attachment.width,i.style.width="100%",(new WPTB_TableStateSaveManager).tableStateSet()}),null==e?file_frame.open():i.src=e}else{(a=t.cloneNode(!0)).getElementsByTagName("a")[0].onclick=function(e){e.preventDefault()};var s=t.className.match(/wptb-element-((.+-)\d+)/i);s&&Array.isArray(s)&&(l=s[1],r=!0)}return this.kind="image",this.getDOMElement=function(){return a},applyGenericItemSettings(this,l,r),this},WPTB_Initializer=function(){var e=document.body;columnsDecrementButton=e.getElementsByClassName("wptb-input-number-decrement")[0],columnsIncrementButton=e.getElementsByClassName("wptb-input-number-increment")[0],rowsDecrementButton=e.getElementsByClassName("wptb-input-number-decrement")[1],rowsIncrementButton=e.getElementsByClassName("wptb-input-number-increment")[1],columnsInput=document.getElementById("wptb-columns-number"),rowsInput=document.getElementById("wptb-rows-number"),columnsDecrementButton.onclick=function(){1<columnsInput.value&&columnsInput.value--},columnsIncrementButton.onclick=function(){columnsInput.value<30&&columnsInput.value++},rowsDecrementButton.onclick=function(){1<rowsInput.value&&rowsInput.value--},rowsIncrementButton.onclick=function(){rowsInput.value<30&&rowsInput.value++},document.getElementById("wptb-generate-table").onclick=function(){var e=document.getElementById("wptb-columns-number").value,t=document.getElementById("wptb-rows-number").value;WPTB_Table(e,t),(new WPTB_TableStateSaveManager).tableStateSet()}},WPTB_LeftPanel=function(){var e,t,a,n,r=document.getElementsByClassName("wptb-preview-table")[0],l=document.getElementsByClassName("wptb-element");function o(e,t){if(!(3<t)&&r){var a=r.getElementsByTagName("tr");if(a.length>t){var n=a[t].style.backgroundColor,l=document.getElementById(e);l&&n&&(l.value=WPTB_Helper.rgbToHex(n))}}}function i(e){for(var t=r.getElementsByTagName("td"),a=0;a<t.length;a++)t[a].style.borderWidth=document.querySelector("#wptb-table-inner-border-number").value+"px",t[a].style.borderStyle="solid"}function s(e){for(var t=r.getElementsByTagName("td"),a=0;a<t.length;a++)t[a].style.padding=e+"px"}function d(e){r.style.borderWidth=e+"px",r.style.borderStyle="solid"}o("wptb-even-row-bg",1),jQuery("#wptb-even-row-bg").wpColorPicker({change:function(e,t){for(var a=r.getElementsByTagName("tr"),n=1;n<a.length;n+=2)a[n].style.backgroundColor=t.color.toString();console.log(e),console.log(this),WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving(e)},clear:function(){for(var e=r.getElementsByTagName("tr"),t=1;t<e.length;t+=2){e[t].style.backgroundColor="";for(var a=e[t].getElementsByTagName("td"),n=0;n<a.length;n++)a[n].style.backgroundColor=""}(new WPTB_TableStateSaveManager).tableStateSet()}}),o("wptb-odd-row-bg",2),jQuery("#wptb-odd-row-bg").wpColorPicker({change:function(e,t){for(var a=r.getElementsByTagName("tr"),n=2;n<a.length;n+=2)a[n].style.backgroundColor=t.color.toString();WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving(e)},clear:function(){for(var e=r.getElementsByTagName("tr"),t=2;t<e.length;t+=2){e[t].style.backgroundColor="";for(var a=e[t].getElementsByTagName("td"),n=0;n<a.length;n++)a[n].style.backgroundColor=""}(new WPTB_TableStateSaveManager).tableStateSet()}}),o("wptb-table-header-bg",0),jQuery("#wptb-table-header-bg").wpColorPicker({change:function(e,t){r.getElementsByTagName("tr")[0].style.backgroundColor=t.color.toString(),(new WPTB_TableStateSaveManager).tableStateSet()},clear:function(){var e=r.getElementsByTagName("tr")[0];e.style.backgroundColor="";for(var t=e.getElementsByTagName("td"),a=0;a<t.length;a++)t[a].style.backgroundColor="";WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving(event)}}),e=r,t=document.getElementById("wptb-adaptive-table-checkbox"),e&&e.dataset.wptbAdaptiveTable&&"1"==e.dataset.wptbAdaptiveTable?t.checked=!0:t.checked=!1,a=r,n=document.getElementById("wptb-top-row-as-header"),a&&a.classList.contains("wptb-table-preview-head")?n.checked=!0:n.checked=!1,function(){var e=document.getElementsByClassName("wptb-preview-table");if(0<e.length){var t=e[0].style.borderColor;if(t){var a=document.getElementById("wptb-table-border-color");a&&(a.value=WPTB_Helper.rgbToHex(t))}var n=e[0].style.borderWidth;if(n){var l=document.getElementById("wptb-table-border-slider"),r=document.getElementById("wptb-table-border-number");l&&(l.value=parseInt(n)),r&&(r.value=parseInt(n))}var o=e[0].querySelector("td").style.borderWidth;if(o){var i=document.getElementById("wptb-inner-border-check"),s=document.getElementById("wptb-apply-inner-border");if(o&&0<parseInt(o)){if(i&&(i.checked=!0,s)){s.classList.add("visible");var d=document.getElementById("wptb-table-inner-border-slider"),c=document.getElementById("wptb-table-inner-border-number");d.value=parseInt(o),c.value=parseInt(o)}}else i.checked=!1}(n&&0<parseInt(n)||o&&0<parseInt(o))&&(document.getElementById("wptb-table-border-color-set-area").style.display="")}}(),jQuery("#wptb-table-border-color").wpColorPicker({change:function(e,t){var a=r.getElementsByTagName("td");r.style.border=document.querySelector("#wptb-table-border-number").value+"px solid "+t.color.toString();for(var n=0;n<a.length;n++){var l=document.querySelector("#wptb-table-inner-border-number").value;document.getElementById("wptb-inner-border-check").checked&&(a[n].style.border=(0!=l?l:1)+"px solid "+t.color.toString())}WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving(e)},clear:function(){var e=r.getElementsByTagName("td");r.style.borderColor="";for(var t=0;t<e.length;t++)e[t].style.borderColor="";(new WPTB_TableStateSaveManager).tableStateSet()}}),function(){var e=document.getElementsByClassName("wptb-preview-table");if(0<e.length){var t=e[0].querySelector("td");if(t){var a=t.style.padding;if(a){var n=document.getElementById("wptb-table-cell-slider"),l=document.getElementById("wptb-table-cell-number");n&&(n.value=parseInt(a)),l&&(l.value=parseInt(a))}}}}();var c=document.getElementById("wptb-table-border-number");WPTB_Helper.numberImputSize(c,1,50);var p=document.getElementById("wptb-table-inner-border-number");WPTB_Helper.numberImputSize(p,1,50);var m=document.getElementById("wptb-table-cell-number");WPTB_Helper.numberImputSize(m,1,50);var u=document.getElementById("wptb-size-number");WPTB_Helper.numberImputSize(u,1,50);var b=document.getElementById("wptb-size-number");WPTB_Helper.numberImputSize(b,2,100);var g=document.getElementById("wptb-table-column-width-number");WPTB_Helper.numberImputSize(g,2,500);var w=document.getElementById("wptb-table-row-height-number");WPTB_Helper.numberImputSize(w,2,200),document.getElementById("wptb-table-cell-slider").oninput=function(){document.getElementById("wptb-table-cell-number").value=this.value,s(this.value),r.tdDefaultWidth()},document.getElementById("wptb-table-cell-slider").onchange=function(){(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-cell-number").onchange=function(){document.getElementById("wptb-table-cell-slider").value=this.value,s(this.value),r.tdDefaultWidth(),(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-border-slider").oninput=function(){document.getElementById("wptb-table-border-number").value=this.value,d(this.value),r.tdDefaultWidth();var e=document.getElementById("wptb-inner-border-check").checked,t=document.getElementById("wptb-table-border-color-set-area");0==this.value&&0==e?t.style.display="none":t.style.display=""},document.getElementById("wptb-table-border-slider").onchange=function(){(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-border-number").onchange=function(){document.getElementById("wptb-table-border-slider").value=this.value,d(this.value),r.tdDefaultWidth(),(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-inner-border-slider").oninput=function(){document.getElementById("wptb-table-inner-border-number").value=this.value,i(this.value),r.tdDefaultWidth()},document.getElementById("wptb-table-inner-border-slider").onchange=function(){(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-inner-border-number").onchange=function(){document.getElementById("wptb-table-inner-border-slider").value=this.value,i(this.value),r.tdDefaultWidth(),(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-inner-border-check").onchange=function(){if(r){var e=this.checked?"checked":"unchecked";!function(e){var t=null!=document.querySelector("#wptb-table-border-color").value?document.querySelector("#wptb-table-border-color").value:"rgb(0,0,0)";0!=document.querySelector("#wptb-table-inner-border-slider").value&&0!=document.querySelector("#wptb-table-inner-border-number").value||(document.querySelector("#wptb-table-inner-border-slider").value=1,document.querySelector("#wptb-table-inner-border-number").value=1);var a=document.querySelector("#wptb-table-inner-border-slider").value+"px",n=document.getElementsByClassName("wptb-preview-table");if(0<n.length)if("checked"==e){document.getElementById("wptb-apply-inner-border").style.marginBottom="0px";for(var l=n[0].getElementsByTagName("td"),r=0;r<l.length;r++)l[r].style.border=a+" solid "+t;document.getElementById("wptb-apply-inner-border").classList.add("visible")}else for(document.getElementById("wptb-apply-inner-border").classList.remove("visible"),l=n[0].getElementsByTagName("td"),r=0;r<l.length;r++)l[r].style.border="0px solid "+t,l[r].style.border=null}(e);var t=document.getElementById("wptb-table-border-slider").value,a=document.getElementById("wptb-table-border-color-set-area");a.style.display="unchecked"==e&&0==t?"none":"",(new WPTB_TableStateSaveManager).tableStateSet()}},document.getElementById("wptb-table-column-width-slider").oninput=function(){document.getElementById("wptb-table-column-width-number").value=this.value,r.addColumnWidth(this.value)},document.getElementById("wptb-table-column-width-slider").onchange=function(){(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-column-width-number").onchange=function(){document.getElementById("wptb-table-column-width-slider").value=this.value,r.addColumnWidth(this.value),(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-column-width-auto-fixed").onchange=function(){if(this.checked){var e=r.querySelector(".wptb-highlighted"),t=WPTB_Helper.getColumnWidth(r,e);r.addColumnWidth(t)}else{r.addColumnWidth(!1,!0);var a=r.querySelector(".wptb-highlighted"),n=WPTB_Helper.getColumnWidth(r,a);document.getElementById("wptb-table-column-width-number").value=n,document.getElementById("wptb-table-column-width-slider").value=n}(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-row-height-slider").oninput=function(){document.getElementById("wptb-table-row-height-number").value=this.value,r.addRowHeight(this.value)},document.getElementById("wptb-table-row-height-slider").onchange=function(){(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-row-height-number").onchange=function(){document.getElementById("wptb-table-row-height-slider").value=this.value,r.addRowHeight(this.value),(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-row-height-auto-fixed").onchange=function(){if(this.checked){var e=r.querySelector(".wptb-highlighted"),t=WPTB_Helper.getRowHeight(r,e);r.addRowHeight(t)}else{r.addRowHeight(!1,!0);var a=r.querySelector(".wptb-highlighted"),n=WPTB_Helper.getRowHeight(r,a);document.getElementById("wptb-table-row-height-number").value=n,document.getElementById("wptb-table-row-height-slider").value=n}(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-adaptive-table-checkbox").onchange=function(){this.checked?r.dataset.wptbAdaptiveTable=1:r.dataset.wptbAdaptiveTable=0,(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-top-row-as-header").onchange=function(){!function(e,t){if(t.checked)WPTB_Helper.dataTitleColumnSet(e),e.classList.add("wptb-table-preview-head"),e.rows[0].classList.add("wptb-table-head");else{var a=e.rows;e.classList.remove("wptb-table-preview-head"),a[0].classList.remove("wptb-table-head");for(var n=1;n<a.length;n++)for(var l=a[n].children,r=0;r<l.length;r++)l[r].removeAttribute("data-wptb-title-column"),l[r].removeAttribute("data-wptb-title-column-font-size"),l[r].removeAttribute("data-wptb-title-column-color"),l[r].removeAttribute("data-wptb-title-background-color"),l[r].removeAttribute("data-wptb-title-align")}}(r,this),(new WPTB_TableStateSaveManager).tableStateSet()};for(var v=0;v<l.length;v++)l[v].ondragstart=function(e){e.dataTransfer.setData("wptbElement",this.dataset.wptbElement),e.dataTransfer.setData("wptbElIndic-"+this.dataset.wptbElement,"wptbElIndic-"+this.dataset.wptbElement)};r&&(document.getElementById("wptb-activate-cell-management-mode").onclick=r.toggleTableEditMode,document.getElementById("wptb-table-edit-mode-close").onclick=r.toggleTableEditMode,document.getElementById("wptb-left-scroll-panel-curtain-close").onclick=r.toggleTableEditMode,document.getElementById("wptb-add-end-row").onclick=r.addRowToTheEnd,document.getElementById("wptb-add-start-row").onclick=r.addRowToTheStart,document.getElementById("wptb-add-row-before").onclick=r.addRowBefore,document.getElementById("wptb-add-row-after").onclick=r.addRowAfter,document.getElementById("wptb-add-end-column").onclick=r.addColumnEnd,document.getElementById("wptb-add-start-column").onclick=r.addColumnStart,document.getElementById("wptb-add-column-before").onclick=r.addColumnBefore,document.getElementById("wptb-add-column-after").onclick=r.addColumnAfter,document.getElementById("wptb-delete-column").onclick=r.deleteColumn,document.getElementById("wptb-delete-row").onclick=r.deleteRow,document.getElementById("wptb-merge-cells").onclick=r.mergeCells,document.getElementById("wptb-split-cell").onclick=r.splitCell),document.querySelector(".wptb-left-panel-extend").onclick=function(){var e=document.querySelector(".wptb-container");e&&(e.classList.contains("collapsed")?e.classList.remove("collapsed"):e.classList.add("collapsed"))},document.getElementsByClassName("wptb-builder-panel")[0].onclick=function(e){e.target.classList.contains("wptb-ph-element")||WPTB_Helper.findAncestor(e.target,"wptb-ph-element")||e.target.classList.contains("wptb-fixed-toolbar")||WPTB_Helper.findAncestor(e.target,"wptb-fixed-toolbar")||y()};var h=document.getElementsByClassName("wptb-header");function y(){document.getElementsByClassName("wptb-elements-container")[0].style.display="table",document.getElementsByClassName("wptb-settings-section")[0].style.display="block",document.getElementById("element-options-group").style.display="none";var e=document.getElementById("wpcd_fixed_toolbar");e.hasAttribute("data-toolbar-active-id")&&document.getElementById(e.getAttribute("data-toolbar-active-id")).classList.remove("toolbar-active")}0<h.length&&(h=h[0]),h.onclick=function(){y()},document.querySelector(".wptb-panel-left").addEventListener("click",function(e){e.target.classList.contains("wptb-exit-options")&&y()})},WPTB_List=function(e,t){var a,n=document.createElement("ul"),l=document.createElement("div"),r=void 0,o=!1;if(l.classList.add("wptb-list-item-container"),this.kind="list",""===e);else if(e){var i=t.className.match(/wptb-element-((.+-)\d+)/i);i&&Array.isArray(i)&&(r=i[1],o=!0);for(d=0;d<e.length;d++){var s=t.querySelector("li");a=new WPTB_ListItem(e[d],s,!0),n.appendChild(a.getDOMElement())}}else for(var d=0;d<3;d++)a=new WPTB_ListItem("<p>List Item "+(d+1)+"</p>"),n.appendChild(a.getDOMElement());return l.appendChild(n),this.getDOMElement=function(){return l},applyGenericItemSettings(this,r,o),WPTB_Helper.listItemsRecalculateIndex(n),this},WPTB_ListItem=function(e,t,a){var n=void 0;if(null==t||t&&a){null==e&&(e="New List Item");var l=document.createElement("li");if((o=document.createElement("div")).classList.add("wptb-list-item-content"),t){var r=t.getAttribute("style");r&&l.setAttribute("style",r)}l.appendChild(o),o.innerHTML=e,o.onkeyup=window.listItemKeyListener,n=!0}else{var o;(o=(l=t).getElementsByClassName("wptb-list-item-content")[0]).onkeyup=window.listItemKeyListener,n=!1}if(l.onmouseenter=function(e){var t=new WPTB_ActionsField;t.addActionField(2,l),t.setParameters(l),console.log(l)},l.onmouseleave=function(e){return(new WPTB_ActionsField).leaveFromField(e,l,2),!1},this.getDOMElement=function(){return l},n)return this},MultipleSelect=function(){var l=[],a=!1;return this.activateMultipleSelectMode=function(){l=[];for(var e=document.getElementsByClassName("wptb-preview-table")[0].getElementsByTagName("td"),t=0;t<e.length;t++)e[t].classList.remove("wptb-highlighted");a=!0},this.deactivateMultipleSelectMode=function(){a=!1},this.isActivated=function(){return a},this.pushSelectedCell=function(e){a&&(l.push(e),e.classList.add("wptb-highlighted"))},this.selectedCells=function(){return l},this.flushSelectedCells=function(){l=[]},this.getFirst=function(){for(var e,t=1e3,a=1e3,n=l.length-1;0<=n;n--)t>=l[n].dataset.xIndex&&a>=l[n].dataset.yIndex&&(e=l[n],t=l[n].dataset.xIndex,a=l[n].dataset.yIndex);return e},this.getLast=function(){for(var e,t=-1,a=-1,n=l.length-1;0<=n;n--)t<=l[n].dataset.xIndex&&a<=l[n].dataset.yIndex&&(e=l[n],t=l[n].dataset.xIndex,a=l[n].dataset.yIndex);return e},this.removeAllButFirst=function(){for(var e=this.getFirst(),t=1;t<l.length;t++)l[t].classList.add("wptb-fused-cell-"+e.dataset.xIndex+"-"+e.dataset.yIndex)},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_Parser=function(e){var t=document.createElement("div");t.innerHTML=e;for(var a=t.children[0],n=[].concat(_toConsumableArray(a.querySelectorAll(".wptb-column-title-mobile-container"))),l=0;l<n.length;l++){n[l].parentNode.removeChild(n[l])}for(var r=a.querySelectorAll("td"),o=0;o<r.length;o++)r[o].classList.add("wptb-droppable"),r[o].classList.remove("wptb-column-title-mobile-not-elements");return a},WPTB_Parser2=function(e){if(Array.isArray(e)){var t=void 0;if(1==e.length)return t.appendChild(document.createTextNode(e[0]));if(0 in e){var a=e[0];if(t=document.createElement(a),1 in e&&Array.isArray(e[1]))for(var n=e[1],l=0;l<n.length;l++)Array.isArray(n[l])&&t.setAttribute(n[l][0],n[l][1]);if(2 in e)if(Array.isArray(e[2]))for(var r=0;r<e[2].length;r++)"string"!=typeof e[2][r]||"p"!=a.toLowerCase()?WPTB_Parser(e[2][r])&&t.appendChild(WPTB_Parser(e[2][r])):t.appendChild(document.createTextNode(e[2][r]));else"string"==typeof e[2]&&t.appendChild(document.createTextNode(e[2]))}return t}return!1},WPTB_Settings=function(){for(var e=document.getElementsByClassName("wptb-element"),t=0;t<e.length;t++)e[t].ondragstart=function(e){e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("wptbElement",e.target.dataset.wptbElement),e.dataTransfer.setData("wptbElIndic-"+e.target.dataset.wptbElement,"wptbElIndic-"+e.target.dataset.wptbElement)},e[t].ondragend=function(){var e=document.querySelector(".wptb-drop-handle"),t=document.querySelector(".wptb-drop-border-marker");(e||t)&&(e.style.display="none",t.style.display="none")};var a=new WPTB_TableStateSaveManager,n=document.getElementsByClassName("wptb-undo");0<n.length&&((n=n[0]).onclick=function(e){if(!this.classList.contains("wptb-undoredo-disabled")){a.tableStateGet(this.dataset.wptbUndoredo);var t=document.getElementsByClassName("wptb-undo-redo-container");0<t.length&&((t=t[0]).onmouseleave=function(e){e.target.onmouseleave="",WPTB_Table()})}});var l=document.getElementsByClassName("wptb-redo");0<l.length&&((l=l[0]).onclick=function(e){if(!this.classList.contains("wptb-undoredo-disabled")){a.tableStateGet(this.dataset.wptbUndoredo);var t=document.getElementsByClassName("wptb-undo-redo-container");0<t.length&&((t=t[0]).onmouseleave=function(e){e.target.onmouseleave="",WPTB_Table()})}});var r=document.getElementsByClassName("wptb-popup-window-modal")[0];document.getElementsByClassName("wptb-embed-btn")[0].onclick=function(){this.classList.contains("wptb-button-disable")||r.classList.add("wptb-popup-show")},window.onbeforeunload=function(e){return 0==document.getElementsByClassName("wptb-save-disabled").length||null},document.getElementsByClassName("wptb-popup-dark-area")[0].onclick=function(){r.classList.remove("wptb-popup-show")},document.getElementsByClassName("wptb-popup-window-close-icon")[0].onclick=function(){r.classList.remove("wptb-popup-show")},document.getElementsByClassName("wptb-preview-btn")[0].onclick=function(e){this.classList.contains("wptb-button-disable")&&e.preventDefault()},document.getElementsByClassName("wptb-save-btn")[0].onclick=function(r){if((r.target.dataset.wptbTableStateNumberSave||0!=window.wptbTableStateNumberShow)&&window.wptbTableStateNumberShow!=r.target.dataset.wptbTableStateNumberSave){var e=document.querySelector(".wptb-edit-bar");if(e&&e.classList.contains("visible"))document.getElementsByClassName("wptb-preview-table")[0].toggleTableEditMode();var o=new XMLHttpRequest,t=(wptb_admin_object?wptb_admin_object.ajaxurl:ajaxurl)+"?action=save_table",i=document.getElementById("wptb-setup-name").value.trim(),s=void 0,a=document.getElementsByClassName("wptb-preview-table");if(a=0<a.length?(a=WPTB_Stringifier(a[0])).outerHTML:"",""===i||""===a){var n="";return""===i&&(n+="You must assign a name to the table before saving it.</br>"),""===a&&(n+="Table wasn't created"),(s=document.getElementById("wptb-messaging-area")).innerHTML='<div class="wptb-error wptb-message">Error: '+n+"</div>",s.classList.add("wptb-warning"),void setTimeout(function(){s.removeChild(s.firstChild)},4e3)}var l={title:i,content:a,security_code:wptb_admin_object.security_code};((rs=WPTB_Helper.detectMode())||(rs=document.wptbId))&&(l.id=rs),l=JSON.stringify(l),o.open("POST",t,!0),o.setRequestHeader("Content-type","application/json; charset=utf-8"),o.onreadystatechange=function(e){if(4==this.readyState&&200==this.status){var t=JSON.parse(o.responseText);if(s=document.getElementById("wptb-messaging-area"),"saved"==t[0]){document.wptbId=t[1],s.innerHTML='<div class="wptb-success wptb-message">Table "'+i+'" was successfully saved.</div>',document.getElementsByClassName("wptb-embed-btn")[0].classList.remove("wptb-button-disable"),document.getElementById("wptb-embed-shortcode").value="[wptb id="+t[1]+"]";var a=document.getElementsByClassName("wptb-preview-btn");if(0<a.length){(a=a[0]).classList.remove("wptb-button-disable");var n=a.dataset.previewHref;n=n.replace("empty",t[1]),a.setAttribute("href",n)}}else if("edited"==t[0]){s.innerHTML='<div class="wptb-success wptb-message">Table "'+i+'" was successfully updated.</div>',r.target.dataset.wptbTableStateNumberSave=window.wptbTableStateNumberShow;var l=document.getElementsByClassName("wptb-save-btn");0<l.length&&(l=l[0]).classList.add("wptb-save-disabled")}else s.innerHTML='<div class="wptb-error wptb-message">Safety problems</div>';s.classList.add("wptb-success"),setTimeout(function(){s.removeChild(s.firstChild)},4e3)}},o.send(l)}}},WPTB_Space=function i(e){var t=void 0;if(e?t=e:(t=document.createElement("div")).classList.add("wptb-space-between"),t.ondragenter=function(){this.classList.add("visible")},t.ondragover=function(e){e.preventDefault()},t.ondragleave=function(){this.classList.remove("visible")},t.ondrop=function(e){e.stopPropagation();for(var t,a,n,l,r=e.target.nextSibling,o=e.target;!o.classList.contains("wptb-droppable");)o=o.parentNode;e.dataTransfer.getData("wptbElement")?(t=(l=e.dataTransfer.getData("wptbElement")).includes("list")?new WPTB_List:l.includes("image")?new WPTB_Image:l.includes("text")?new WPTB_Text:l.includes("button")?new WPTB_Button:void 0,this.classList.remove("visible"),null==r?(o.appendChild(t.getDOMElement()),o.appendChild(new i)):(o.insertBefore(t.getDOMElement(),r),o.insertBefore(new i,r))):(alert(e.dataTransfer.getData("node")),a=(t=document.getElementsByClassName(e.dataTransfer.getData("node"))[0]).nextSibling,n=t.parentNode,null!=a&&n.removeChild(a),null==r?(o.appendChild(t),o.appendChild(new i)):(o.insertBefore(t,r),o.insertBefore(new i,r))),this.classList.remove("visible")},!e)return t};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_StarRating=function(e,t){t||(t=e?e.querySelectorAll("li").length:5);var a=document.createElement("div"),n=document.createElement("div"),l=document.createElement("ul"),r=document.createElement("div"),o=document.createElement("div"),i=void 0,s=!1;a.classList.add("wptb-star_rating-container"),n.classList.add("wptb-rating-stars-box"),l.classList.add("wptb-rating-stars-list"),r.classList.add("wptb-success-box"),r.style.display="none",o.classList.add("wptb-text-message"),o.style.fontSize="25px";for(var d=0;d<t;d++){var c=document.createElement("li");c.classList.add("wptb-rating-star"),c.style.width="20px";var p="";0==d&&(p='<span class="wptb-rating-star-zero-set"></span>'),c.innerHTML='<span class="wptb-rating-star-left-signal-part">'+p+'</span><span class="wptb-filled-rating-star"><svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" \n xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="20px" style="width: 20px;" viewBox="0 0 426.667 426.667" \n style="enable-background:new 0 0 426.667 426.667;" xml:space="preserve">\n <polygon points="426.667,165.12 273.28,152.107 213.333,10.667 153.387,152.107 0,165.12 \n 116.48,266.027 81.493,416 213.333,336.427 345.173,416 310.187,266.027"/></svg></span><span class="wptb-not-filled-rating-star"><svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" \n xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="20px" style="width: 20px;" viewBox="0 0 426.667 426.667" \n style="enable-background:new 0 0 426.667 426.667;" xml:space="preserve">\n <path d="M426.667,165.12L273.28,151.893L213.333,10.667l-59.947,141.44L0,165.12l116.48,100.907L81.493,416l131.84-79.573\n L345.173,416L310.4,266.027L426.667,165.12z M213.333,296.533L133.12,344.96l21.333-91.307l-70.827-61.44l93.44-8.107 \n l36.267-85.973l36.48,86.187l93.44,8.107l-70.827,61.44l21.333,91.307L213.333,296.533z"/></svg></span><span class="wptb-half-filled-rating-star"><svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" \n xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="20px" style="width: 20px;" viewBox="0 0 426.667 426.667" \n style="enable-background:new 0 0 426.667 426.667;" xml:space="preserve">\n <path d="M426.667,165.12L273.28,151.893L213.333,10.667l-59.947,141.44L0,165.12l116.48,100.907L81.493,416l131.84-79.573 \n L345.173,416L310.4,266.027L426.667,165.12z M213.333,296.533v-198.4l36.48,86.187l93.44,8.107l-70.827,61.44l21.333,91.307 \n L213.333,296.533z"/></svg></span><span class="wptb-rating-star-right-signal-part"></span>',c.dataset.value=d+1,l.appendChild(c)}if(r.appendChild(o),n.appendChild(l),n.appendChild(r),a.appendChild(n),e){var m=e.className.match(/wptb-element-((.+-)\d+)/i);m&&Array.isArray(m)&&(i=m[1],s=!0);var u=e.querySelector(".wptb-rating-stars-box");if(u){var b=[].concat(_toConsumableArray(u.attributes));if(0<b.length)for(var g=0;g<b.length;g++)"style"==b[g].name&&n.setAttribute(b[g].name,b[g].value)}var w=u.querySelectorAll("li"),v=l.querySelectorAll("li");if(0<w.length&&0<v.length){w.length<t&&w.length;for(var h=0;h<w.length;h++){var y=[].concat(_toConsumableArray(w[h].attributes));if(0<y.length)for(var f=0;f<y.length;f++)v[h].setAttribute(y[f].name,y[f].value);for(var B=w[h].children,S=v[h].children,T=0;T<B.length;T++){var E=[].concat(_toConsumableArray(B[T].attributes));if(0<E.length)for(var C=0;C<E.length;C++){S[T].setAttribute(E[C].name,E[C].value);var x=B[T].querySelector("svg");if(x){var _=x.getAttribute("style");S[T].querySelector("svg").setAttribute("style",_)}}}}}var N=u.querySelector(".wptb-success-box");if(N)for(var I=[].concat(_toConsumableArray(N.attributes)),P=0;P<I.length;P++)"style"==I[P].name&&r.setAttribute(I[P].name,I[P].value);var A=N.querySelector(".wptb-text-message");if(A){o.innerHTML=A.innerHTML;for(var k=[].concat(_toConsumableArray(A.attributes)),L=0;L<k.length;L++)"style"==k[L].name&&o.setAttribute(k[L].name,k[L].value)}}return this.kind="star_rating",this.getDOMElement=function(){return a},applyGenericItemSettings(this,i,s),this},WPTB_Stringifier=function(e){if(e){var t=e.cloneNode(!0);t.classList.add("wptb-table-preview-static-indic"),t.dataset.tableColumns=e.columns,t.style.width=null,t.style.minWidth=null,t.style.maxWidth=null;var a=t.getElementsByTagName("td");if(0<a.length)for(var n=0;n<a.length;n++){e.querySelector("wptb-table-preview-head")&&a[n].removeAttribute("data-x-index"),a[n].removeAttribute("data-y-index"),a[n].removeAttribute("draggable"),a[n].classList.remove("wptb-droppable");var l=a[n].getElementsByClassName("wptb-ph-element");if(0<l.length)for(var r=0;r<l.length;r++){var o=l[r].querySelectorAll(".mce-content-body");if(0<o.length)for(var i=0;i<o.length;i++)o[i].classList.remove("mce-content-body");var s=l[r].querySelectorAll("[data-mce-style]");if(0<s.length)for(var d=0;d<s.length;d++)s[d].removeAttribute("data-mce-style");var c=l[r].querySelectorAll("[contenteditable]");if(0<c.length)for(var p=0;p<c.length;p++)c[p].removeAttribute("contenteditable");var m=l[r].querySelectorAll("[spellcheck]");if(0<m.length)for(var u=0;u<m.length;u++)m[u].removeAttribute("spellcheck");var b=l[r].querySelectorAll("[id^=mce_]");if(0<b.length)for(var g=0;g<b.length;g++)b[g].removeAttribute("id");for(var w=l[r].querySelectorAll(".wptb-actions"),v=w.length;0<v&&w[0]&&w[0].parentNode;)w[0].parentNode.removeChild(w[0]),v--}if(a[n].hasAttribute("data-wptb-title-column")){var h=document.createElement("div"),y=document.createElement("div");h.classList.add("wptb-column-title-mobile-container"),y.classList.add("wptb-column-title-mobile"),y.dataset.wptbTitleColumn=a[n].dataset.wptbTitleColumn,y.setAttribute("style","font-size:"+a[n].dataset.wptbTitleColumnFontSize+"; \n color:"+a[n].dataset.wptbTitleColumnColor+"; background-color:"+a[n].dataset.wptbTitleBackgroundColor+"; text-align:"+a[n].dataset.wptbTitleAlign+";"),y.style.padding=a[n].style.padding,0==a[n].children.length&&a[n].classList.add("wptb-column-title-mobile-not-elements"),h.appendChild(y),a[n].insertBefore(h,a[n].firstChild)}}return t}};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_Stringifier2=function(e){1<arguments.length&&void 0!==arguments[1]&&arguments[1];if(null==e)return"";if(null==e.tagName&&3==e.nodeType)return e.nodeValue;var t=[],a=void 0,n=!1,l=[].concat(_toConsumableArray(e.attributes)),r=[],o=[];if((e.parentNode.classList.contains("wptb-list-item-content")||e.parentNode.classList.contains("mce-content-body"))&&"p"==e.tagName.toLowerCase()?(a=e.childNodes,n=!0):a=0<e.children.length?e.children:e.childNodes,0<l.length)for(var i=0;i<l.length;i++)r[i]=[l[i].name,l[i].value];else r="";if(0<a.length)for(var s=0;s<a.length;s++){var d=WPTB_Stringifier(a[s]);Array.isArray(d)||n?o[s]=d:"string"==typeof d&&d&&(o=d)}else o="";return t.push(e.tagName.toLowerCase(),r,o),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},array=[],WPTB_Table=function(e,t){var P,a,n,v,l=document.getElementsByClassName("wptb-settings-items"),f=document.getElementsByClassName("wptb-table-setup")[0],B=function(e){var t,a=this.rowSpan,n=this.colSpan,l=document.getElementsByClassName("wptb-no-cell-action"),r=document.getElementsByClassName("wptb-single-action"),o=document.getElementsByClassName("wptb-multiple-select-action"),i=document.getElementById("wptb-left-scroll-panel-cell-settings"),s=E(this),d=s[0],c=s[1];if(document.select.isActivated()){if(this.className.match(/wptb-highlighted/)){this.classList.remove("wptb-highlighted");for(var p=0;p<a;p++)for(var m=0;m<n;m++)array[d+p][c+m]=0}else{this.classList.add("wptb-highlighted");for(p=0;p<a;p++)for(m=0;m<n;m++)array[d+p][c+m]=1}if(0===(t=document.getElementsByClassName("wptb-highlighted").length)){for(p=0;p<o.length;p++)o[p].classList.remove("visible"),o[p].setAttribute("disabled","disabled");for(p=0;p<l.length;p++)l[p].classList.add("visible"),l[p].removeAttribute("disabled");for(p=0;p<r.length;p++)r[p].classList.remove("visible"),r[p].setAttribute("disabled","disabled");i.classList.remove("visible")}else if(1===t){for(p=0;p<o.length;p++)o[p].classList.remove("visible"),o[p].setAttribute("disabled","disabled");for(p=0;p<l.length;p++)l[p].classList.remove("visible"),l[p].setAttribute("disabled","disabled");for(p=0;p<r.length;p++)r[p].classList.add("visible"),r[p].removeAttribute("disabled");var u=document.querySelector(".wptb-highlighted");if(u){var b=document.getElementById("wptb-table-column-width-slider"),g=document.getElementById("wptb-table-column-width-number"),w=document.getElementById("wptb-table-column-width-auto-fixed"),v=u.style.width;if(v)b.value=parseFloat(v,10),g.value=parseFloat(v,10),w.checked=!0;else if(u.dataset.wptbFixedWidth)b.value=u.dataset.wptbFixedWidth,g.value=u.dataset.wptbFixedWidth,w.checked=!0;else{var h=WPTB_Helper.getColumnWidth(P,u);b.value=h,g.value=h,w.checked=!1}var y=document.getElementById("wptb-table-row-height-slider"),f=document.getElementById("wptb-table-row-height-number"),B=document.getElementById("wptb-table-row-height-auto-fixed"),S=u.style.height;if(S)y.value=parseFloat(S,10),f.value=parseFloat(S,10),B.checked=!0;else if(u.dataset.wptbFixedHeight)y.value=u.dataset.wptbFixedHeight,f.value=u.dataset.wptbFixedHeight,B.checked=!0;else{var T=WPTB_Helper.getRowHeight(P,u);y.value=T,f.value=T,B.checked=!1}}i.classList.add("visible")}else{for(p=0;p<o.length;p++)P.isSquare(array)?(o[p].classList.add("visible"),o[p].removeAttribute("disabled")):(o[p].classList.remove("visible"),o[p].setAttribute("disabled","disabled"));for(p=0;p<l.length;p++)l[p].classList.remove("visible"),l[p].setAttribute("disabled","disabled");for(p=0;p<r.length;p++)r[p].classList.remove("visible"),r[p].setAttribute("disabled","disabled");i.classList.remove("visible")}}},S=function(e){for(var t=0;t<e.length;t++){for(var a=0;a<e[t].length;a++)" "+e[t][a];"\n"}P.isSquare(e)},T=function(){for(var e=document.getElementsByClassName("wptb-no-cell-action"),t=document.getElementsByClassName("wptb-single-action"),a=document.getElementsByClassName("wptb-multiple-select-action"),n=document.getElementById("wptb-left-scroll-panel-cell-settings"),l=P.getElementsByClassName("wptb-highlighted");l.length;)l[0].classList.remove("wptb-highlighted");n.classList.remove("visible");for(var r=0;r<array.length;r++)for(var o=0;o<array[r].length;o++)array[r][o]=0;for(r=0;r<a.length;r++)a[r].classList.remove("visible"),a[r].setAttribute("disabled","disabled");for(r=0;r<e.length;r++)e[r].classList.add("visible"),e[r].removeAttribute("disabled");for(r=0;r<t.length;r++)t[r].classList.remove("visible"),t[r].setAttribute("disabled","disabled")},E=function(e){for(var t=[],a=0;a<v;a++)t[a]=0;for(a=0;a<P.rows.length;a++)for(var n=P.rows[a].getElementsByTagName("td"),l=cellPointer=0;l<v;l+=stepsToMove)if(stepsToMove=1,t[l])t[l]--;else{var r=n[cellPointer++];if(r==e)return[a,l];if(1<r.rowSpan){for(var o=0;o<r.colSpan;o++)t[l+o]=r.rowSpan-1;stepsToMove=r.colSpan}else 1<r.colSpan&&(stepsToMove=r.colSpan)}};if(jQuery("#wptb-table-header-bg").val(""),jQuery("#wptb-even-row-bg").val(""),jQuery("#wptb-odd-row-bg").val(""),jQuery("#wptb-table-border-color").val(""),jQuery("#wptb-table-inner-border-number,#wptb-table-inner-border-slider").val("0"),jQuery("#wptb-table-border-number,#wptb-table-border-slider").val("0"),jQuery("#wptb-table-padding-number,#wptb-table-padding-slider").val("15"),e||t){for(var r=0;r<l.length;r++)"wptb-apply-inner-border"!==l[r].id&&l[r].classList.add("visible");(P=document.createElement("table")).classList.add("wptb-preview-table"),P.dataset.reconstraction=1,P.dataset.wptbAdaptiveTable=1;for(r=0;r<t;r++){(a=P.insertRow(-1)).classList.add("wptb-row");for(var g=0;g<e;g++)(n=new WPTB_Cell(B)).setCoords(r,g),a.appendChild(n.getDOMElement())}}else{var o=document.getElementsByClassName("wptb-preview-table");if(0<o.length){var i=(P=o[0]).getElementsByTagName("td");if(0<i.length)for(var s=0;s<i.length;s++)WPTB_Cell(B,i[s])}}P.toggleTableEditMode=function(){var e=document.getElementsByClassName("wptb-edit-bar"),t=document.getElementById("wptb-cell_mode_background"),a=document.getElementById("wptb-left-scroll-panel-curtain"),n=document.getElementById("wptb-left-scroll-panel-cell-settings"),l=document.getElementsByClassName("wptb-preview-table");if(0<l.length&&(l=l[0]),0<e.length)for(var r=0;r<e.length;r++)if(e[r].classList.contains("visible")){document.select.deactivateMultipleSelectMode(),e[r].classList.remove("visible"),t.classList.remove("visible"),a.classList.remove("visible"),n.classList.remove("visible"),l.parentNode.classList.remove("wptb-preview-table-manage-cells");var o=l.getElementsByTagName("td");if(0<o.length)for(var i=0;i<o.length;i++)o[i].classList.remove("wptb-highlighted")}else document.select.activateMultipleSelectMode(),e[r].classList.add("visible"),t.classList.add("visible"),a.classList.add("visible"),l.parentNode.classList.add("wptb-preview-table-manage-cells")},P.recalculateIndexes=function(e){for(var t=this.getElementsByTagName("tr"),a=void 0,n=0,l=0,r=[],o=document.getElementById("wptb-top-row-as-header"),i=0;i<t.length;i++){0==i?(null==e&&(t[i].style.backgroundColor=jQuery("#wptb-table-header-bg").val()),o.checked?null==e&&(this.classList.add("wptb-table-preview-head"),t[i].classList.add("wptb-table-head")):null==e&&(this.classList.remove("wptb-table-preview-head"),t[i].classList.remove("wptb-table-head"))):(i%2==0?null==e&&(t[i].style.backgroundColor=jQuery("#wptb-odd-row-bg").val()):null==e&&(t[i].style.backgroundColor=jQuery("#wptb-even-row-bg").val()),t[i].classList.remove("wptb-table-head")),r[i],a=t[i].getElementsByTagName("td"),null==r[i]&&(r[i]=[]);for(var s=0,d=0;d<a.length;d++){if(null!=r[i][d])for(var c=0;c<100;c++){if(null==r[i][s]){r[i][s]=a[d],a[d].dataset.xIndex=s;break}s++}else r[i][d]=a[d],a[d].dataset.xIndex=s;if(a[d].dataset.yIndex=i,1<a[d].colSpan)for(var p=1;p<a[d].colSpan;p++)s++,r[i][s]="tdDummy";if(1<a[d].rowSpan)for(var m=1;m<a[d].rowSpan;m++){null==r[i+m]&&(r[i+m]=[]);for(var u=0;u<a[d].colSpan;u++)r[i+m][s-a[d].colSpan+1+u]="tdDummy"}s++,0==i&&(l=s)}n<d&&(n=d)}this.columns=n,this.maxCols=l},P.addColumnWidth=function(m,u){var e=P.getElementsByClassName("wptb-highlighted");if(0<e.length){for(var t=0;t<e.length;t++){var a=e[t].dataset.xIndex;a&&function e(t,a){for(var n=P.rows,l=!1,r=[],o=0;o<n.length;o++)for(var i=n[o].children,s=0;s<i.length;s++){var d=i[s];if(d.dataset.xIndex==t){if(m)if(d.colSpan==a){d.style.width=m+"px",d.removeAttribute("data-wptb-fixed-width"),l=!0;var c=document.getElementById("wptb-table-column-width-auto-fixed");c.checked||(c.checked=!0)}else d.style.width=null,d.dataset.wptbFixedWidth=m,o!=n.length-1||l||e(t,a+1);else if(u)d.style.width=null,d.removeAttribute("data-wptb-fixed-width");else if(d.dataset.wptbFixedWidth)d.colSpan==a&&(d.style.width=d.dataset.wptbFixedWidth+"px",d.removeAttribute("data-wptb-fixed-width"));else if(d.style.width){for(var p=0;p<r.length;p++)r[p].style.width=d.style.width;r=[]}else r.push(d);break}}}(a,1)}P.tdDefaultWidth()}},P.tdDefaultWidth=function(){for(var e,t=P.rows,a=0,n=0,l=document.getElementsByClassName("wptb-table-setup")[0].offsetWidth,r=[],o=[],i=0,s=0,d="",c=0;c<t.length;c++)for(var p=t[c].children,m=0;m<p.length;m++){var u=p[m];if(r[parseInt(u.dataset.xIndex)]||o[parseInt(u.dataset.xIndex)])o[parseInt(u.dataset.xIndex)]?u.dataset.wptbFixedWidth||(u.dataset.wptbCssTdAutoWidth=!0):r[parseInt(u.dataset.xIndex)]&&u.removeAttribute("data-wptb-css-td-auto-width");else if(u.style.width?(r[parseInt(u.dataset.xIndex)]=parseFloat(u.style.width),u.removeAttribute("data-wptb-css-td-auto-width")):u.dataset.wptbFixedWidth||(o[parseInt(u.dataset.xIndex)]=100,u.dataset.wptbCssTdAutoWidth=!0),window.getComputedStyle(u,null)){var b=window.getComputedStyle(u,null),g=b.getPropertyValue("padding-left"),w=b.getPropertyValue("padding-right");i=parseFloat(g,10)+parseFloat(w,10);var v=b.getPropertyValue("border-left-width"),h=b.getPropertyValue("border-right-width");s=parseFloat(v,10)+parseFloat(h,10),r[parseInt(u.dataset.xIndex)]?(r[parseInt(u.dataset.xIndex)]+=i,r[parseInt(u.dataset.xIndex)]+=s):(o[parseInt(u.dataset.xIndex)]+=i,o[parseInt(u.dataset.xIndex)]+=s)}}for(var y=0;y<r.length;y++)r[y]&&(a+=r[y]);for(var f=0,B=0;B<o.length;B++)o[B]&&(n+=o[B],f++);var S=window.getComputedStyle(P,null),T=S.getPropertyValue("border-left-width"),E=S.getPropertyValue("border-right-width"),C=parseFloat(T,10)+parseFloat(E,10);e=a+n+C,P.dataset.wptbTableTdsSumMaxWidth=e,f?(P.dataset.wptbCellsWidthAutoCount=f,P.mergingСellsHorizontally?P.dataset.wptbFixedWidthSize=a-C:P.removeAttribute("data-wptb-fixed-width-size")):(P.removeAttribute("data-wptb-fixed-width-size"),P.removeAttribute("data-wptb-cells-width-auto-count"));var x=!1,_=void 0;e<l?f?(P.style.minWidth="100%",P.mergingСellsHorizontally?(_=(_=(l-a-C)/f)-i-s,x=!(P.style.width=null)):P.style.width="100%"):(P.style.width=null,P.style.minWidth=null,P.style.maxWidth=e+"px"):(P.style.maxWidth=null,P.style.minWi
|