WP Table Builder – WordPress Table Plugin - Version 1.0.5

Version Description

  • NEW: Undo/Redo options for the builder.
  • FIX: Element Actions getting saved with the table.
  • IMPROVE: Element Actions and Border marker.
Download this release

Release Info

Developer imtiazrayhan
Plugin Icon 128x128 WP Table Builder – WordPress Table Plugin
Version 1.0.5
Comparing to
See all releases

Code changes from version 1.0.4 to 1.0.5

inc/admin/css/admin.css CHANGED
@@ -100,6 +100,31 @@ body>img {
100
  font-size: 15px;
101
  }
102
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  .wptb-embed,
104
  .wptb-preview {
105
  display: block;
@@ -1111,7 +1136,7 @@ table.wptb-table {
1111
  width: auto;
1112
  }
1113
 
1114
- .wptb-preview-table.wptb-preview-table-manage-cells tbody>tr>td::after {
1115
  content: '';
1116
  display: block;
1117
  position: absolute;
@@ -1121,7 +1146,7 @@ table.wptb-table {
1121
  bottom: 0;
1122
  }
1123
 
1124
- .wptb-preview-table.wptb-preview-table-manage-cells td:hover::after {
1125
  background: rgba(207, 218, 239, 0.2);
1126
  border-color: inherit;
1127
  }
@@ -1247,8 +1272,8 @@ table.wptb-table {
1247
  .wptb-ph-element {
1248
  position: relative;
1249
  border: 1px solid #fff0;
1250
- margin-top: 7px;
1251
- margin-bottom: 7px;
1252
  }
1253
 
1254
 
@@ -1258,8 +1283,17 @@ table.wptb-table {
1258
 
1259
  .wptb-image-wrapper img {
1260
  width: 100%;
 
 
 
 
1261
  }
1262
 
 
 
 
 
 
1263
 
1264
  /*
1265
  ** Button Style
@@ -1452,7 +1486,7 @@ table.wptb-table {
1452
  .wptb-droppable.wptb-cell ol {
1453
  border: 1px solid transparent;
1454
  margin: 0;
1455
- padding: 1em 0 0 0;
1456
  width: 100%;
1457
  }
1458
 
@@ -1472,6 +1506,7 @@ table.wptb-table {
1472
 
1473
  .wptb-list-item-container ul li {
1474
  list-style: none;
 
1475
  }
1476
 
1477
  .wptb-droppable.wptb-cell li .wptb-list-item-content {
@@ -1515,7 +1550,7 @@ table.wptb-table {
1515
  }
1516
 
1517
  .wptb-droppable.wptb-cell .wptb-directlyhovered {
1518
- border: 1px solid #1ea5e5 !important;
1519
  position: relative;
1520
  /*width: 100%;*/
1521
  }
@@ -1554,20 +1589,19 @@ table.wptb-table {
1554
  background-color: #1ea5e5;
1555
  border-top-left-radius: 4px;
1556
  border-top-right-radius: 4px;
1557
- box-sizing: border-box;
 
1558
  color: white;
1559
- display: flex;
1560
- display: -webkit-flex;
1561
  justify-content: space-between;
1562
  line-height: 1em;
1563
  padding: 0px 5px;
1564
  position: absolute;
1565
- right: 0;
1566
- top: -15px;
1567
  height: 15px;
1568
  font-size: 9pt;
1569
  display: none;
1570
- min-width: 70px;
 
 
1571
  }
1572
 
1573
  .wptb-ph-element:hover .wptb-actions {
@@ -1577,15 +1611,15 @@ table.wptb-table {
1577
  .wptb-actions .dashicons.dashicons-admin-page.wptb-duplicate-action {
1578
  font-size: 10pt;
1579
  margin: 0em 0.05em 0 0.1em;
1580
- width: 15px;
1581
- height: 15px;
1582
  }
1583
 
1584
  .wptb-actions .dashicons.dashicons-trash.wptb-delete-action {
1585
  font-size: 10pt;
1586
  margin: 0em 0.1em 0 0.05em;
1587
- width: 15px;
1588
- height: 15px;
1589
  }
1590
 
1591
  .wptb-cell-management .wptb-button {
@@ -1607,6 +1641,10 @@ table.wptb-table {
1607
  width: 100%;
1608
  }
1609
 
 
 
 
 
1610
  .wptb-ph-element.wptb-ondragenter::before {
1611
  content: "";
1612
  display: block;
@@ -1710,8 +1748,10 @@ table.wptb-table {
1710
  }
1711
 
1712
  .wptb-actions .dashicons.dashicons-move.wptb-move-action {
1713
- font-size: 17px !important;
1714
  cursor: move;
 
 
1715
  }
1716
 
1717
  .wptb-no-cell-action:not(.visible),
@@ -1867,12 +1907,7 @@ td[class*="wptb-fused-cell"] {
1867
  }
1868
  }
1869
 
1870
- @media screen and (max-width: 970px) {
1871
- #wptb-setup-name {
1872
- width: 100%;
1873
- max-width: 420px;
1874
- margin-left: 0px;
1875
- }
1876
  #wptb-messaging-area {
1877
  position: absolute;
1878
  top: 190px;
@@ -1885,6 +1920,14 @@ td[class*="wptb-fused-cell"] {
1885
  }
1886
  }
1887
 
 
 
 
 
 
 
 
 
1888
  @media screen and (max-width: 600px) {
1889
  .wptb-right {
1890
  width: 100%;
100
  font-size: 15px;
101
  }
102
 
103
+ .wptb-undo-redo-container {
104
+ float: left;
105
+ margin-right: 20px;
106
+ margin-top: 30px;
107
+ }
108
+
109
+ .wptb-undo, .wptb-redo {
110
+ display: inline-block;
111
+ cursor: pointer;
112
+ }
113
+
114
+ .wptb-undo {
115
+ margin-right: 7px;
116
+ }
117
+
118
+
119
+ .wptb-undo:hover, .wptb-redo:hover {
120
+
121
+ }
122
+
123
+ .wptb-undoredo-disabled {
124
+ cursor: default;
125
+ opacity: .4;
126
+ }
127
+
128
  .wptb-embed,
129
  .wptb-preview {
130
  display: block;
1136
  width: auto;
1137
  }
1138
 
1139
+ .wptb-preview-table-manage-cells tbody>tr>td::after {
1140
  content: '';
1141
  display: block;
1142
  position: absolute;
1146
  bottom: 0;
1147
  }
1148
 
1149
+ .wptb-preview-table-manage-cells td:hover::after {
1150
  background: rgba(207, 218, 239, 0.2);
1151
  border-color: inherit;
1152
  }
1272
  .wptb-ph-element {
1273
  position: relative;
1274
  border: 1px solid #fff0;
1275
+ margin-top: 15px;
1276
+ margin-bottom: 15px;
1277
  }
1278
 
1279
 
1283
 
1284
  .wptb-image-wrapper img {
1285
  width: 100%;
1286
+ display: block;
1287
+ padding: 0;
1288
+ max-width: 100%;
1289
+ height: auto;
1290
  }
1291
 
1292
+ .wptb-image-wrapper a {
1293
+ display: block !important;
1294
+ max-width: 100%;
1295
+ position: relative;
1296
+ }
1297
 
1298
  /*
1299
  ** Button Style
1486
  .wptb-droppable.wptb-cell ol {
1487
  border: 1px solid transparent;
1488
  margin: 0;
1489
+ padding: 1em 0.2em 0.4em;
1490
  width: 100%;
1491
  }
1492
 
1506
 
1507
  .wptb-list-item-container ul li {
1508
  list-style: none;
1509
+ margin: 0px;
1510
  }
1511
 
1512
  .wptb-droppable.wptb-cell li .wptb-list-item-content {
1550
  }
1551
 
1552
  .wptb-droppable.wptb-cell .wptb-directlyhovered {
1553
+ outline: 1px solid #1ea5e5 !important;
1554
  position: relative;
1555
  /*width: 100%;*/
1556
  }
1589
  background-color: #1ea5e5;
1590
  border-top-left-radius: 4px;
1591
  border-top-right-radius: 4px;
1592
+ /*border-bottom: 3px solid #fff0;*/
1593
+ box-sizing: content-box;
1594
  color: white;
 
 
1595
  justify-content: space-between;
1596
  line-height: 1em;
1597
  padding: 0px 5px;
1598
  position: absolute;
 
 
1599
  height: 15px;
1600
  font-size: 9pt;
1601
  display: none;
1602
+ max-width: 70px;
1603
+ z-index: 100101;
1604
+ box-sizing: border-box;
1605
  }
1606
 
1607
  .wptb-ph-element:hover .wptb-actions {
1611
  .wptb-actions .dashicons.dashicons-admin-page.wptb-duplicate-action {
1612
  font-size: 10pt;
1613
  margin: 0em 0.05em 0 0.1em;
1614
+ width: 16px;
1615
+ height: 16px;
1616
  }
1617
 
1618
  .wptb-actions .dashicons.dashicons-trash.wptb-delete-action {
1619
  font-size: 10pt;
1620
  margin: 0em 0.1em 0 0.05em;
1621
+ width: 16px;
1622
+ height: 16px;
1623
  }
1624
 
1625
  .wptb-cell-management .wptb-button {
1641
  width: 100%;
1642
  }
1643
 
1644
+ .wptb-ph-element.wptb-directlyhovered.wptb-moving-mode {
1645
+ outline: 0px !important;
1646
+ }
1647
+
1648
  .wptb-ph-element.wptb-ondragenter::before {
1649
  content: "";
1650
  display: block;
1748
  }
1749
 
1750
  .wptb-actions .dashicons.dashicons-move.wptb-move-action {
1751
+ font-size: 14px !important;
1752
  cursor: move;
1753
+ width: 16px;
1754
+ height: 16px;
1755
  }
1756
 
1757
  .wptb-no-cell-action:not(.visible),
1907
  }
1908
  }
1909
 
1910
+ @media screen and (max-width: 1070px) {
 
 
 
 
 
1911
  #wptb-messaging-area {
1912
  position: absolute;
1913
  top: 190px;
1920
  }
1921
  }
1922
 
1923
+ @media screen and (max-width: 970px) {
1924
+ #wptb-setup-name {
1925
+ width: 100%;
1926
+ max-width: 420px;
1927
+ margin-left: 0px;
1928
+ }
1929
+ }
1930
+
1931
  @media screen and (max-width: 600px) {
1932
  .wptb-right {
1933
  width: 100%;
inc/admin/js/admin.js CHANGED
@@ -28,89 +28,20 @@ var applyGenericItemSettings = function applyGenericItemSettings(element, kindIn
28
  }
29
 
30
  node.onmouseenter = function (event) {
31
- this.classList.add('wptb-directlyhovered');
32
- var btnDelete = document.createElement('span'),
33
- btnCopy = document.createElement('span'),
34
- btnMove = document.createElement('span'),
35
- actions = document.createElement('span'),
36
- i = void 0;
37
-
38
- actions.classList.add('wptb-actions');
39
- btnDelete.classList.add('dashicons', 'dashicons-trash', 'wptb-delete-action');
40
- btnCopy.classList.add('dashicons', 'dashicons-admin-page', 'wptb-duplicate-action');
41
- btnMove.classList.add("dashicons", "dashicons-move", 'wptb-move-action');
42
- btnMove.draggable = true;
43
- btnDelete.onclick = function (event) {
44
- var act = this.parentNode.parentNode,
45
- el = act.parentNode;
46
- el.removeChild(act);
47
-
48
- if (act.kind == 'text') {
49
- var thisRow = el.parentNode;
50
- if (thisRow.classList.contains('wptb-table-head')) {
51
- var table = WPTB_Helper.findAncestor(thisRow, 'wptb-preview-table');
52
- WPTB_Helper.dataTitleColumnSet(table);
53
- }
54
- }
55
- };
56
- btnCopy.onclick = function (event) {
57
- var copy = void 0;
58
- if (element.kind == 'list') {
59
- var td = event.target.parentNode.parentNode.parentNode,
60
- temp = [],
61
- srcList = event.target.parentNode.parentNode.querySelectorAll('ul li .wptb-list-item-content');
62
-
63
- for (var i = 0; i < srcList.length; i++) {
64
- temp.push(srcList[i].innerHTML);
65
- }
66
-
67
- copy = new WPTB_List(temp, node);
68
 
69
- node.parentNode.insertBefore(copy.getDOMElement(), node.nextSibling);
70
- } else if (element.kind == 'text') {
71
- var td = event.target.parentNode.parentNode.parentNode;
72
- copy = new WPTB_Text(event.target.parentNode.parentNode.childNodes[0].innerHTML, node);
73
 
74
- node.parentNode.insertBefore(copy.getDOMElement(), node.nextSibling);
75
- } else if (element.kind == 'image') {
76
- var td = event.target.parentNode.parentNode.parentNode;
77
- copy = new WPTB_Image(event.target.parentNode.parentNode.children[0].children[0].src, node);
78
 
79
- node.parentNode.insertBefore(copy.getDOMElement(), node.nextSibling);
80
- } else {
81
- var td = event.target.parentNode.parentNode.parentNode,
82
- text = event.target.parentNode.parentNode.childNodes[0].querySelector('p').innerHTML;
83
- copy = new WPTB_Button(text, node);
84
 
85
- node.parentNode.insertBefore(copy.getDOMElement(), node.nextSibling);
86
- }
87
 
88
- WPTB_innerElementSet(copy.getDOMElement());
89
- };
90
- var parent = this,
91
- infArr = void 0,
92
- type = void 0;
93
- infArr = parent.className.match(/wptb-element-(.+)-(\d+)/i);
94
- type = infArr[1];
95
- var dragImagesArr = WPTB_Helper.dragImagesArr();
96
- btnMove.ondragstart = function (event) {
97
- this.parentNode.style.opacity = 0;
98
- parent.classList.remove('wptb-directlyhovered');
99
- parent.classList.add('wptb-moving-mode');
100
-
101
- event.dataTransfer.setDragImage(dragImagesArr[type], 0, 0);
102
- event.dataTransfer.setData('node', 'wptb-element-' + infArr[1] + '-' + infArr[2]);
103
- event.dataTransfer.setData('wptb-moving-mode', 'wptb-element-' + infArr[1] + '-' + infArr[2]);
104
- event.dataTransfer.setData('wptbElIndic-' + infArr[1], 'wptbElIndic-' + infArr[1]);
105
- var act = event.target.parentNode.parentNode;
106
- if (act.kind == 'text') {
107
- var thisRow = el.parentNode;
108
- if (thisRow.classList.contains('wptb-table-head')) {
109
- var table = WPTB_Helper.findAncestor(thisRow, 'wptb-preview-table');
110
- WPTB_Helper.dataTitleColumnSet(table);
111
- }
112
- }
113
- };
114
 
115
  if (element.kind === 'button') {
116
  var a = node.querySelector('a'),
@@ -138,6 +69,26 @@ var applyGenericItemSettings = function applyGenericItemSettings(element, kindIn
138
  WPTB_Helper.dataTitleColumnSet(table);
139
  }
140
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
  },
142
  init_instance_callback: function init_instance_callback(editor) {
143
  window.currentEditor = editor;
@@ -162,22 +113,23 @@ var applyGenericItemSettings = function applyGenericItemSettings(element, kindIn
162
  WPTB_Helper.listItemsTinyMceInit(listItems[_i]);
163
  }
164
  }
165
-
166
- actions.appendChild(btnMove);
167
- actions.appendChild(btnCopy);
168
- actions.appendChild(btnDelete);
169
- this.appendChild(actions);
170
  };
171
 
172
  node.onmouseleave = function (event) {
173
- this.classList.remove('wptb-directlyhovered');
174
- var iter = 0;
175
- while (event.target.querySelector('.wptb-actions') && iter < 5) {
176
- event.target.querySelector('.wptb-actions').remove();
177
- iter++;
178
  }
 
 
179
  };
180
 
 
 
 
 
 
181
  // Change data-title-column if the title was changed
182
  if (element.kind == 'text') {
183
  var observer = new MutationObserver(function (mutations) {
@@ -210,6 +162,355 @@ var applyGenericItemSettings = function applyGenericItemSettings(element, kindIn
210
  document.counter.increment(element.kind);
211
  };
212
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
213
  (function () {
214
  var WPTB_Builder = function WPTB_Builder() {
215
  var table_id = WPTB_Helper.detectMode();
@@ -230,6 +531,9 @@ var applyGenericItemSettings = function applyGenericItemSettings(element, kindIn
230
  WPTB_Table();
231
  WPTB_LeftPanel();
232
  WPTB_Settings();
 
 
 
233
  } else {
234
  document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';
235
  }
@@ -258,13 +562,14 @@ var WPTB_Button = function WPTB_Button(text, DOMElementProt) {
258
  elButton = document.createElement('div'),
259
  el_B = document.createElement('a'),
260
  el_BDiv = document.createElement('div'),
 
261
  kindIndexProt = undefined,
262
  copy = false;
263
 
264
  DOMElement.classList.add('wptb-button-container', 'wptb-size-M', 'wptb-');
265
  elButton.classList.add('wptb-button-wrapper');
266
  el_BDiv.classList.add('wptb-button');
267
- el_BDiv.innerHTML = text != undefined ? text : 'Button Text';
268
 
269
  // Creation of a new button when copying to avoid errors when assigning new event handlers.
270
  if (DOMElementProt) {
@@ -292,9 +597,9 @@ var WPTB_Button = function WPTB_Button(text, DOMElementProt) {
292
  }
293
  }
294
 
295
- var wptbButton = DOMElementProt.querySelector('a');
296
- if (wptbButton) {
297
- var wptbButtonAttributes = [].concat(_toConsumableArray(wptbButton.attributes));
298
  if (wptbButtonAttributes.length > 0) {
299
  for (var _i2 = 0; _i2 < wptbButtonAttributes.length; _i2++) {
300
  if (wptbButtonAttributes[_i2].name == 'style' || wptbButtonAttributes[_i2].name == 'href' || wptbButtonAttributes[_i2].name == 'target') {
@@ -303,10 +608,23 @@ var WPTB_Button = function WPTB_Button(text, DOMElementProt) {
303
  }
304
  }
305
  }
 
 
 
 
 
 
 
 
 
 
 
 
306
  }
307
 
308
  elButton.appendChild(el_B);
309
  el_B.appendChild(el_BDiv);
 
310
  DOMElement.appendChild(elButton);
311
 
312
  this.kind = 'button';
@@ -544,7 +862,7 @@ var WPTB_DropHandle = function WPTB_DropHandle(thisElem, e) {
544
  var innerElement = wptbDropHandle.getDOMParentElement();
545
  td = innerElement.parentNode;
546
 
547
- if (wptbDropHandle.dataset.text == 'Abowe Element') {
548
  td.insertBefore(element, innerElement);
549
  } else if (wptbDropHandle.dataset.text == 'Below Element') {
550
  var innerElementNext = innerElement.nextSibling;
@@ -562,6 +880,11 @@ var WPTB_DropHandle = function WPTB_DropHandle(thisElem, e) {
562
  wptbDropBorderMarker.style.display = 'none';
563
 
564
  WPTB_innerElementSet(element);
 
 
 
 
 
565
  };
566
  var wptbContainer = document.querySelector('.wptb-container');
567
  wptbContainer.onscroll = function () {
@@ -600,7 +923,7 @@ var WPTB_DropHandle = function WPTB_DropHandle(thisElem, e) {
600
  wptbDropHandle.style.width = thisElem.offsetWidth + 'px';
601
  var height = thisElem.offsetHeight,
602
  coordinatesElement = thisElem.getBoundingClientRect(),
603
- left = Number(coordinatesElement.left),
604
  top = void 0;
605
  wptbDropHandle.style.left = left + 'px';
606
 
@@ -623,15 +946,15 @@ var WPTB_DropHandle = function WPTB_DropHandle(thisElem, e) {
623
  wptbDropBorderMarker.style.display = 'block';
624
  if (thisElem.nodeName.toLowerCase() != 'td') {
625
  var y = e.offsetY == undefined ? e.layerY : e.offsetY;
626
- top = Number(coordinatesElement.top) - Number(11);
627
  wptbDropHandle.dataset.text = 'Abowe Element';
628
  if (y > height / 2) {
629
- top = Number(coordinatesElement.top) + height - 1;
630
  wptbDropHandle.dataset.text = 'Below Element';
631
  }
632
  } else {
633
  wptbDropHandle.dataset.text = 'Drop Here';
634
- top = Number(coordinatesElement.top) + height / 2 - 5;
635
  }
636
  wptbDropHandle.style.top = top + 'px';
637
 
@@ -639,10 +962,10 @@ var WPTB_DropHandle = function WPTB_DropHandle(thisElem, e) {
639
  wptbDropBorderMarker.style.left = coordinatesElement.left + 'px';
640
 
641
  wptbDropBorderMarkerTop = wptbDropBorderMarker.querySelector('.wptb-drop-border-marker-top');
642
- wptbDropBorderMarkerTop.style.width = Number(thisElem.offsetWidth) - Number(1) + 'px';
643
 
644
  wptbDropBorderMarkerRight = wptbDropBorderMarker.querySelector('.wptb-drop-border-marker-right');
645
- wptbDropBorderMarkerRight.style.height = Number(coordinatesElement.bottom) - Number(coordinatesElement.top) - 1 + 'px';
646
  wptbDropBorderMarkerRight.style.left = wptbDropBorderMarkerTop.style.width;
647
 
648
  wptbDropBorderMarkerBottom = wptbDropBorderMarker.querySelector('.wptb-drop-border-marker-bottom');
@@ -783,51 +1106,55 @@ var WPTB_ElementOptions = function WPTB_ElementOptions(element, index, kindIndex
783
  } else if (element.kind == 'image') {
784
  var _affectedEl2 = document.getElementsByClassName('wptb-element-' + kindIndexProt);
785
  if (_affectedEl2.length > 0) {
786
- var elementsA = _affectedEl2[0].getElementsByTagName('a');
787
- if (elementsA.length > 0) {
788
- var a = elementsA[0];
789
 
790
- if (a) {
791
- a.onclick = function (e) {
792
- e.preventDefault();
793
- };
794
- // set select according to the alignment of the image
795
- var aTextAlign = a.style.textAlign,
796
- imageAlignmentSelect = prop.querySelector('select[data-type="image-alignment"]'),
797
- _selectOption = imageAlignmentSelect.getElementsByTagName('option');
798
-
799
- for (var _i2 = 0; _i2 < _selectOption.length; _i2++) {
800
- if (_selectOption[_i2].value == aTextAlign) {
801
- _selectOption[_i2].selected = true;
802
- }
803
- }
804
 
805
- // set text link for input field of setting panel
806
- var imageLinkHref = a.getAttribute('href'),
807
- inputImageLink = prop.querySelector('input[data-type="image-link"]');
808
- if (imageLinkHref) {
809
- inputImageLink.value = imageLinkHref;
810
  }
 
 
 
 
 
811
 
812
- // set checkbox for target of link
813
- var imageLinkTarget = a.getAttribute('target'),
814
- imageLinkTargetInput = prop.querySelector('input[data-type="image-link-target"]'),
815
- imageLinkTargetInputId = imageLinkTargetInput.getAttribute('id'),
816
- imageLinkTargetInputLabel = imageLinkTargetInput.parentNode.getElementsByTagName('label')[0];
817
 
818
- imageLinkTargetInputId = imageLinkTargetInputId + '-' + kindIndexProt.split('-')[1];
 
 
 
 
 
819
 
820
- imageLinkTargetInput.setAttribute('id', imageLinkTargetInputId);
821
- imageLinkTargetInputLabel.setAttribute('for', imageLinkTargetInputId);
 
 
 
822
 
823
- if (imageLinkTarget && imageLinkTarget == '_blank') {
824
- imageLinkTargetInput.checked = true;
825
- }
 
 
 
 
 
826
 
827
- var img = a.getElementsByTagName('img');
828
- if (img.length > 0) {
829
  // set value for input fields of image size
830
- var imgWidth = img[0].style.width;
831
  if (imgWidth) {
832
  var imageWidthInputRange = prop.querySelector('input[type="range"][data-type="image-size"]'),
833
  imageWidthInputNumber = prop.querySelector('input[type="number"][data-type="image-size"]');
@@ -836,11 +1163,14 @@ var WPTB_ElementOptions = function WPTB_ElementOptions(element, index, kindIndex
836
  imageWidthInputNumber.value = parseInt(imgWidth);
837
  }
838
 
839
- // set value for input field of alternative text image
840
- var imgAlternativeText = img[0].getAttribute('alt'),
841
- imageAlternativeTextInput = prop.querySelector('input[type="text"][data-type="alternative-text"]');
 
 
842
 
843
- imageAlternativeTextInput.value = imgAlternativeText;
 
844
  }
845
  }
846
  }
@@ -854,8 +1184,8 @@ var WPTB_ElementOptions = function WPTB_ElementOptions(element, index, kindIndex
854
  textFontSizeInputNumber = prop.querySelector('input[type="number"][data-type="font-size"]'),
855
  textColorInput = prop.querySelector('input[type="text"][data-type="color"]');
856
 
857
- textFontSizeInputRange.value = parseInt(elementFontSize);
858
- textFontSizeInputNumber.value = parseInt(elementFontSize);
859
  textColorInput.value = WPTB_Helper.rgbToHex(elementTextColor);
860
  }
861
  } else if (element.kind == 'list') {
@@ -1027,6 +1357,9 @@ var WPTB_ElementOptions = function WPTB_ElementOptions(element, index, kindIndex
1027
  b[i].classList.remove('selected');
1028
  }
1029
  this.classList.add('selected');
 
 
 
1030
  };
1031
  }
1032
  }
@@ -1062,6 +1395,9 @@ var WPTB_ElementOptions = function WPTB_ElementOptions(element, index, kindIndex
1062
  } else {
1063
  affectedEl.style.color = ui.color.toString();
1064
  }
 
 
 
1065
  }
1066
  });
1067
  }
@@ -1070,7 +1406,7 @@ var WPTB_ElementOptions = function WPTB_ElementOptions(element, index, kindIndex
1070
  var slider = optionControls[i].parentNode.parentNode.getElementsByClassName('wptb-text-font-size-slider')[0];
1071
  slider.oninput = function () {
1072
  this.parentNode.parentNode.getElementsByClassName('wptb-text-font-size-number')[0].value = this.value;
1073
- this.parentNode.parentNode.getElementsByClassName('wptb-text-font-size-number')[0].onchange();
1074
  };
1075
  }
1076
 
@@ -1078,12 +1414,11 @@ var WPTB_ElementOptions = function WPTB_ElementOptions(element, index, kindIndex
1078
  var slider = optionControls[i].parentNode.parentNode.getElementsByClassName('wptb-image-size-slider')[0];
1079
  slider.oninput = function () {
1080
  this.parentNode.parentNode.getElementsByClassName('wptb-image-width-number')[0].value = this.value;
1081
- this.parentNode.parentNode.getElementsByClassName('wptb-image-width-number')[0].onchange();
1082
  };
1083
  }
1084
 
1085
  optionControls[i].onchange = function (event) {
1086
-
1087
  var n_Class = this.dataset.element,
1088
  infArr = n_Class.match(/wptb-options-(.+)-(\d+)/i),
1089
  type = infArr[1],
@@ -1127,6 +1462,7 @@ var WPTB_ElementOptions = function WPTB_ElementOptions(element, index, kindIndex
1127
  break;
1128
  case 'font-size':
1129
  affectedEl.style.fontSize = val + 'px';
 
1130
  break;
1131
  case 'button-alignment':
1132
  var jc = '';
@@ -1210,6 +1546,16 @@ var WPTB_ElementOptions = function WPTB_ElementOptions(element, index, kindIndex
1210
  }
1211
  break;
1212
  }
 
 
 
 
 
 
 
 
 
 
1213
  };
1214
  }
1215
  };
@@ -1269,6 +1615,8 @@ var WPTB_Helper = {
1269
  e.target.querySelector('p').innerText = 'New List Item';
1270
  //tinyMCE.execCommand('mceInsertContent', false, 'New List Item');
1271
  WPTB_Helper.listItemsRecalculateIndex(article.parentNode);
 
 
1272
  } else if (e.keyCode == '8' || e.keyCode == '46') {
1273
  var p = e.target.querySelector('p');
1274
  var pText = p.innerHTML.replace(/<[^>]+>/g, '');
@@ -1288,9 +1636,28 @@ var WPTB_Helper = {
1288
  }
1289
  }
1290
  }
 
 
 
 
 
 
 
1291
  });
1292
 
1293
- ed.on('keyup', function (e) {});
 
 
 
 
 
 
 
 
 
 
 
 
1294
  },
1295
  init_instance_callback: function init_instance_callback(editor) {
1296
  window.currentEditor = editor;
@@ -1324,6 +1691,28 @@ var WPTB_Helper = {
1324
  if (e.keyCode == 13) {
1325
  e.preventDefault();
1326
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1327
  });
1328
  },
1329
  init_instance_callback: function init_instance_callback(editor) {
@@ -1428,26 +1817,75 @@ var WPTB_Helper = {
1428
  document.getElementById('wptb-table-inner-border-slider').value = 1;
1429
  document.getElementById('wptb-table-inner-border-number').value = 1;
1430
 
1431
- WPTB_Helper.wpColorPickerClear('wptb-table-border-color');
1432
 
1433
- WPTB_Helper.wpColorPickerClear('wptb-table-header-bg');
1434
 
1435
- WPTB_Helper.wpColorPickerClear('wptb-even-row-bg');
1436
 
1437
- WPTB_Helper.wpColorPickerClear('wptb-odd-row-bg');
1438
 
1439
  document.getElementById('wptb-table-cell-slider').value = 15;
1440
  document.getElementById('wptb-table-cell-number').value = 15;
1441
  },
1442
- wpColorPickerClear: function wpColorPickerClear(inputId) {
1443
- var input = document.getElementById(inputId);
1444
- var wpPickerContainer = WPTB_Helper.findAncestor(input, 'wp-picker-container');
1445
- var parent = wpPickerContainer.parentNode;
1446
- parent.removeChild(wpPickerContainer);
1447
- var newInput = document.createElement('input');
1448
- newInput.setAttribute('id', inputId);
1449
- newInput.value = "";
1450
- parent.appendChild(newInput);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1451
  },
1452
  detectMode: function detectMode() {
1453
  var url = window.location.href,
@@ -1490,7 +1928,7 @@ var WPTB_Image = function WPTB_Image(src, DOMElementProt) {
1490
  elImage = document.createElement('div');
1491
  var anchor = document.createElement('a'),
1492
  img = document.createElement('img');
1493
- anchor.style.display = 'inline-block';
1494
  anchor.appendChild(img);
1495
  DOMElement.classList.add('wptb-image-container');
1496
  elImage.classList.add('wptb-image-wrapper');
@@ -1511,7 +1949,19 @@ var WPTB_Image = function WPTB_Image(src, DOMElementProt) {
1511
  // When an image is selected, run a callback.
1512
  file_frame.on('select', function () {
1513
  attachment = file_frame.state().get('selection').first().toJSON();
1514
- img.src = attachment.url;
 
 
 
 
 
 
 
 
 
 
 
 
1515
  });
1516
  // Finally, open the modal
1517
  if (src == undefined) {
@@ -1580,11 +2030,10 @@ var WPTB_Initializer = function WPTB_Initializer() {
1580
  rows = document.getElementById('wptb-rows-number').value;
1581
 
1582
  WPTB_Table(columns, rows);
1583
- };
1584
 
1585
- // if( document.getElementsByClassName( 'wptb-preview-table' ).length == 0 ) {
1586
- // WPTB_LeftPanel();
1587
- // }
1588
  };
1589
  var WPTB_innerElementSet = function WPTB_innerElementSet(element) {
1590
 
@@ -1639,7 +2088,7 @@ var WPTB_innerElementSet = function WPTB_innerElementSet(element) {
1639
  } else {
1640
  classId = e.dataTransfer.getData('node');
1641
  element = document.getElementsByClassName(classId)[0];
1642
- element.classList.remove('wptb-moving-mode');
1643
  }
1644
 
1645
  if (wptbDropHandle.style.display == 'block') {
@@ -1651,7 +2100,7 @@ var WPTB_innerElementSet = function WPTB_innerElementSet(element) {
1651
  var innerElement = wptbDropHandle.getDOMParentElement();
1652
  td = innerElement.parentNode;
1653
 
1654
- if (wptbDropHandle.dataset.text == 'Abowe Element') {
1655
  td.insertBefore(element, innerElement);
1656
  } else if (wptbDropHandle.dataset.text == 'Below Element') {
1657
  var innerElementNext = innerElement.nextSibling;
@@ -1672,6 +2121,11 @@ var WPTB_innerElementSet = function WPTB_innerElementSet(element) {
1672
 
1673
  WPTB_innerElementSet(element);
1674
 
 
 
 
 
 
1675
  return true;
1676
  };
1677
  element.onmouseover = function (e) {
@@ -1704,6 +2158,9 @@ var WPTB_LeftPanel = function WPTB_LeftPanel() {
1704
  for (var _i = 1; _i < tableRows.length; _i += 2) {
1705
  tableRows[_i].style.backgroundColor = ui.color.toString();
1706
  }
 
 
 
1707
  },
1708
  clear: function clear() {
1709
  var tableRows = table.getElementsByTagName('tr');
@@ -1714,6 +2171,9 @@ var WPTB_LeftPanel = function WPTB_LeftPanel() {
1714
  tds[j].style.backgroundColor = '';
1715
  }
1716
  }
 
 
 
1717
  }
1718
 
1719
  });
@@ -1725,6 +2185,8 @@ var WPTB_LeftPanel = function WPTB_LeftPanel() {
1725
  for (var _i3 = 2; _i3 < tableRows.length; _i3 += 2) {
1726
  tableRows[_i3].style.backgroundColor = ui.color.toString();
1727
  }
 
 
1728
  },
1729
  clear: function clear() {
1730
  var tableRows = table.getElementsByTagName('tr');
@@ -1735,6 +2197,9 @@ var WPTB_LeftPanel = function WPTB_LeftPanel() {
1735
  tds[j].style.backgroundColor = '';
1736
  }
1737
  }
 
 
 
1738
  }
1739
  });
1740
 
@@ -1743,6 +2208,9 @@ var WPTB_LeftPanel = function WPTB_LeftPanel() {
1743
  change: function change(event, ui) {
1744
  var tableHeader = table.getElementsByTagName('tr')[0];
1745
  tableHeader.style.backgroundColor = ui.color.toString();
 
 
 
1746
  },
1747
  clear: function clear() {
1748
  var tableHeader = table.getElementsByTagName('tr')[0];
@@ -1751,12 +2219,14 @@ var WPTB_LeftPanel = function WPTB_LeftPanel() {
1751
  for (var j = 0; j < tds.length; j++) {
1752
  tds[j].style.backgroundColor = '';
1753
  }
 
 
1754
  }
1755
  });
1756
 
1757
  function tableAdaptiveForMobile(table) {
1758
  var wptbAdaptiveTableCheckbox = document.getElementById('wptb-adaptive-table-checkbox');
1759
- if (table && table.dataset.wptbAdaptiveTable) {
1760
  wptbAdaptiveTableCheckbox.checked = true;
1761
  } else {
1762
  wptbAdaptiveTableCheckbox.checked = false;
@@ -1840,6 +2310,7 @@ var WPTB_LeftPanel = function WPTB_LeftPanel() {
1840
  tableCells[i].style.border = (tableInnerborderNumber != 0 ? tableInnerborderNumber : 1) + 'px solid ' + ui.color.toString();
1841
  }
1842
  }
 
1843
  },
1844
  clear: function clear() {
1845
  var tableCells = table.getElementsByTagName('td');
@@ -1848,6 +2319,9 @@ var WPTB_LeftPanel = function WPTB_LeftPanel() {
1848
  for (var i = 0; i < tableCells.length; i++) {
1849
  tableCells[i].style.borderColor = '';
1850
  }
 
 
 
1851
  }
1852
  });
1853
 
@@ -1972,10 +2446,18 @@ var WPTB_LeftPanel = function WPTB_LeftPanel() {
1972
  table.tdDefaultWidth();
1973
  };
1974
 
 
 
 
 
 
1975
  document.getElementById('wptb-table-cell-number').onchange = function () {
1976
  document.getElementById('wptb-table-cell-slider').value = this.value;
1977
  addCellPadding(this.value);
1978
  table.tdDefaultWidth();
 
 
 
1979
  };
1980
 
1981
  document.getElementById('wptb-table-border-slider').oninput = function () {
@@ -1992,10 +2474,17 @@ var WPTB_LeftPanel = function WPTB_LeftPanel() {
1992
  }
1993
  };
1994
 
 
 
 
 
 
1995
  document.getElementById('wptb-table-border-number').onchange = function () {
1996
  document.getElementById('wptb-table-border-slider').value = this.value;
1997
  addBorderSize(this.value);
1998
  table.tdDefaultWidth();
 
 
1999
  };
2000
 
2001
  document.getElementById('wptb-table-inner-border-slider').oninput = function () {
@@ -2004,10 +2493,17 @@ var WPTB_LeftPanel = function WPTB_LeftPanel() {
2004
  table.tdDefaultWidth();
2005
  };
2006
 
 
 
 
 
 
2007
  document.getElementById('wptb-table-inner-border-number').onchange = function () {
2008
  document.getElementById('wptb-table-inner-border-slider').value = this.value;
2009
  addInnerBorderSize(this.value);
2010
  table.tdDefaultWidth();
 
 
2011
  };
2012
 
2013
  document.getElementById('wptb-inner-border-check').onchange = function () {
@@ -2021,6 +2517,9 @@ var WPTB_LeftPanel = function WPTB_LeftPanel() {
2021
  } else {
2022
  tableBorderColorSetArea.style.display = '';
2023
  }
 
 
 
2024
  }
2025
  };
2026
 
@@ -2029,9 +2528,17 @@ var WPTB_LeftPanel = function WPTB_LeftPanel() {
2029
  table.addColumnWidth(this.value);
2030
  };
2031
 
 
 
 
 
 
2032
  document.getElementById('wptb-table-column-width-number').onchange = function () {
2033
  document.getElementById('wptb-table-column-width-slider').value = this.value;
2034
  table.addColumnWidth(this.value);
 
 
 
2035
  };
2036
 
2037
  document.getElementById('wptb-table-column-width-auto-fixed').onchange = function () {
@@ -2046,6 +2553,9 @@ var WPTB_LeftPanel = function WPTB_LeftPanel() {
2046
  document.getElementById('wptb-table-column-width-number').value = _width;
2047
  document.getElementById('wptb-table-column-width-slider').value = _width;
2048
  }
 
 
 
2049
  };
2050
 
2051
  document.getElementById('wptb-table-row-height-slider').oninput = function () {
@@ -2053,9 +2563,17 @@ var WPTB_LeftPanel = function WPTB_LeftPanel() {
2053
  table.addRowHeight(this.value);
2054
  };
2055
 
 
 
 
 
 
2056
  document.getElementById('wptb-table-row-height-number').onchange = function () {
2057
  document.getElementById('wptb-table-row-height-slider').value = this.value;
2058
  table.addRowHeight(this.value);
 
 
 
2059
  };
2060
 
2061
  document.getElementById('wptb-table-row-height-auto-fixed').onchange = function () {
@@ -2070,6 +2588,9 @@ var WPTB_LeftPanel = function WPTB_LeftPanel() {
2070
  document.getElementById('wptb-table-row-height-number').value = _height;
2071
  document.getElementById('wptb-table-row-height-slider').value = _height;
2072
  }
 
 
 
2073
  };
2074
 
2075
  document.getElementById('wptb-adaptive-table-checkbox').onchange = function () {
@@ -2078,6 +2599,8 @@ var WPTB_LeftPanel = function WPTB_LeftPanel() {
2078
  } else {
2079
  table.dataset.wptbAdaptiveTable = 0;
2080
  }
 
 
2081
  };
2082
 
2083
  function createMobileHeadForTable(table, thisEvent) {
@@ -2108,6 +2631,8 @@ var WPTB_LeftPanel = function WPTB_LeftPanel() {
2108
 
2109
  document.getElementById('wptb-top-row-as-header').onchange = function () {
2110
  createMobileHeadForTable(table, this);
 
 
2111
  };
2112
 
2113
  for (var i = 0; i < wptbElementButtons.length; i++) {
@@ -2149,17 +2674,27 @@ var WPTB_LeftPanel = function WPTB_LeftPanel() {
2149
  // this code hides the "element parameters" area
2150
  // when clicked outside this element and its "tinymce" toolbar
2151
  var wptbBuilderPanel = document.getElementsByClassName('wptb-builder-panel')[0];
2152
- wptbBuilderPanel.addEventListener('click', function (e) {
2153
  if (!e.target.classList.contains('wptb-ph-element') && !WPTB_Helper.findAncestor(e.target, 'wptb-ph-element') && !e.target.classList.contains('wptb-fixed-toolbar') && !WPTB_Helper.findAncestor(e.target, 'wptb-fixed-toolbar')) {
2154
- document.getElementsByClassName('wptb-elements-container')[0].style.display = 'table';
2155
- document.getElementsByClassName('wptb-settings-section')[0].style.display = 'block';
2156
- document.getElementById('element-options-group').style.display = 'none';
2157
- var wpcdFixedToolbar = document.getElementById('wpcd_fixed_toolbar');
2158
- if (wpcdFixedToolbar.hasAttribute('data-toolbar-active-id')) {
2159
- document.getElementById(wpcdFixedToolbar.getAttribute('data-toolbar-active-id')).classList.remove('toolbar-active');
2160
- }
2161
  }
2162
- }, false);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2163
  };
2164
  var WPTB_List = function WPTB_List(innerElements, DOMElementProt) {
2165
 
@@ -2238,50 +2773,20 @@ var WPTB_ListItem = function WPTB_ListItem(text, DOMElementProt, copy) {
2238
  }
2239
 
2240
  DOMElement.onmouseenter = function (event) {
 
2241
 
2242
- var btnDelete = document.createElement('span'),
2243
- btnCopy = document.createElement('span'),
2244
- actions = document.createElement('span'),
2245
- previous,
2246
- i;
2247
- actions.classList.add('wptb-actions');
2248
- btnDelete.classList.add('dashicons', 'dashicons-trash', 'wptb-delete-action');
2249
- btnCopy.classList.add('dashicons', 'dashicons-admin-page', 'wptb-duplicate-action');
2250
- this.classList.add('wptb-directlyhovered');
2251
-
2252
- btnDelete.onclick = function () {
2253
- var action = this.parentNode,
2254
- item = this.parentNode.parentNode,
2255
- parent = item.parentNode;
2256
- item.removeChild(action);
2257
- parent.removeChild(item);
2258
- WPTB_Helper.listItemsRecalculateIndex(parent);
2259
- };
2260
-
2261
- btnCopy.onclick = function (event) {
2262
- var listItem = event.target.parentNode.parentNode,
2263
- content = listItem.querySelector('.wptb-list-item-content'),
2264
- html = content.innerHTML;
2265
- var duplicate = new WPTB_ListItem(html, listItem, true);
2266
- listItem.parentNode.insertBefore(duplicate.getDOMElement(), DOMElement);
2267
- WPTB_Helper.listItemsTinyMceInit(duplicate.getDOMElement().firstChild);
2268
- setTimeout(function () {
2269
- divcontent.innerHTML = html;
2270
- WPTB_Helper.listItemsRecalculateIndex(listItem.parentNode);
2271
- }, 5);
2272
- };
2273
 
2274
- actions.append(btnCopy, btnDelete);
2275
- this.appendChild(actions);
2276
  };
2277
 
2278
  DOMElement.onmouseleave = function (event) {
2279
- this.removeAttribute('class');
2280
- var iter = 0;
2281
- while (event.target.querySelector('.wptb-actions') && iter < 5) {
2282
- event.target.querySelector('.wptb-actions').remove();
2283
- iter++;
2284
- }
2285
  };
2286
 
2287
  this.getDOMElement = function () {
@@ -2452,6 +2957,45 @@ var WPTB_Settings = function WPTB_Settings() {
2452
  };
2453
  };
2454
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2455
  var shortcodePopupWindow = document.getElementsByClassName('wptb-popup-window-modal')[0];
2456
  document.getElementsByClassName('wptb-embed-btn')[0].onclick = function () {
2457
  if (!this.classList.contains('wptb-button-disable')) {
@@ -2652,7 +3196,6 @@ var WPTB_Stringifier = function WPTB_Stringifier(codeMain) {
2652
 
2653
  if (innerElements.length > 0) {
2654
  for (var j = 0; j < innerElements.length; j++) {
2655
- innerElements[j].classList.remove('wptb-directlyhovered');
2656
 
2657
  var mceContentBodys = innerElements[j].querySelectorAll('.mce-content-body');
2658
  if (mceContentBodys.length > 0) {
@@ -3044,10 +3587,12 @@ var array = [],
3044
  var noCells = document.getElementsByClassName('wptb-no-cell-action'),
3045
  singleCells = document.getElementsByClassName('wptb-single-action'),
3046
  multipleCells = document.getElementsByClassName('wptb-multiple-select-action'),
 
3047
  tds = table.getElementsByClassName('wptb-highlighted');
3048
  while (tds.length) {
3049
  tds[0].classList.remove('wptb-highlighted');
3050
  }
 
3051
  for (var i = 0; i < array.length; i++) {
3052
  for (var j = 0; j < array[i].length; j++) {
3053
  array[i][j] = 0;
@@ -3227,7 +3772,7 @@ var array = [],
3227
  cellModeBackground.classList.remove('visible');
3228
  leftScrollPanelCurtain.classList.remove('visible');
3229
  leftScrollPanelCellSettings.classList.remove('visible');
3230
- wptbPreviewTable.classList.remove('wptb-preview-table-manage-cells');
3231
  var wptbPreviewTableTds = wptbPreviewTable.getElementsByTagName('td');
3232
  if (wptbPreviewTableTds.length > 0) {
3233
  for (var _i3 = 0; _i3 < wptbPreviewTableTds.length; _i3++) {
@@ -3239,7 +3784,7 @@ var array = [],
3239
  bar[_i2].classList.add('visible');
3240
  cellModeBackground.classList.add('visible');
3241
  leftScrollPanelCurtain.classList.add('visible');
3242
- wptbPreviewTable.classList.add('wptb-preview-table-manage-cells');
3243
  }
3244
  }
3245
  }
@@ -3676,6 +4221,8 @@ var array = [],
3676
  table.addRowHeight();
3677
  WPTB_Helper.dataTitleColumnSet(table);
3678
  undoSelect();
 
 
3679
  };
3680
 
3681
  /*
@@ -3717,6 +4264,8 @@ var array = [],
3717
  table.addRowHeight();
3718
  WPTB_Helper.dataTitleColumnSet(table);
3719
  undoSelect();
 
 
3720
  };
3721
 
3722
  /*
@@ -3815,6 +4364,8 @@ var array = [],
3815
  table.addRowHeight();
3816
  WPTB_Helper.dataTitleColumnSet(table);
3817
  undoSelect();
 
 
3818
  }
3819
  };
3820
 
@@ -3871,6 +4422,8 @@ var array = [],
3871
  table.addColumnWidth();
3872
  WPTB_Helper.dataTitleColumnSet(table);
3873
  undoSelect();
 
 
3874
  };
3875
 
3876
  /*
@@ -3908,6 +4461,8 @@ var array = [],
3908
  table.addColumnWidth();
3909
  WPTB_Helper.dataTitleColumnSet(table);
3910
  undoSelect();
 
 
3911
  };
3912
 
3913
  /*
@@ -4014,6 +4569,8 @@ var array = [],
4014
  table.addColumnWidth();
4015
  WPTB_Helper.dataTitleColumnSet(table);
4016
  undoSelect();
 
 
4017
  };
4018
 
4019
  /*
@@ -4142,6 +4699,8 @@ var array = [],
4142
  }
4143
  WPTB_Helper.dataTitleColumnSet(table);
4144
  undoSelect();
 
 
4145
  };
4146
 
4147
  /*
@@ -4207,10 +4766,8 @@ var array = [],
4207
  table.addRowHeight();
4208
  WPTB_Helper.dataTitleColumnSet(table);
4209
  undoSelect();
4210
- var wptbLeftScrollPanelCellSetting = document.getElementById('wptb-left-scroll-panel-cell-settings');
4211
- if (wptbLeftScrollPanelCellSetting) {
4212
- wptbLeftScrollPanelCellSetting.classList.remove('visible');
4213
- }
4214
  };
4215
 
4216
  /*
@@ -4367,7 +4924,10 @@ var array = [],
4367
  table.recalculateIndexes();
4368
  WPTB_Helper.dataTitleColumnSet(table);
4369
  }
 
4370
  undoSelect();
 
 
4371
  };
4372
 
4373
  /*
@@ -4421,7 +4981,10 @@ var array = [],
4421
  table.tdDefaultWidth();
4422
  WPTB_Helper.dataTitleColumnSet(table);
4423
  }
 
4424
  undoSelect();
 
 
4425
  };
4426
 
4427
  document.getElementsByClassName('wptb-table-generator')[0].style.display = 'none';
@@ -4478,6 +5041,173 @@ var array = [],
4478
  // }, false );
4479
  // }
4480
  };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4481
  function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
4482
 
4483
  var WPTB_Text = function WPTB_Text(text, DOMElementProt) {
28
  }
29
 
30
  node.onmouseenter = function (event) {
31
+ if (event.target.classList.contains('wptb-moving-mode')) {
32
+ return;
33
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
 
35
+ var i = void 0,
36
+ wptbActionsField = new WPTB_ActionsField();
 
 
37
 
38
+ wptbActionsField.addActionField(1, node);
 
 
 
39
 
40
+ wptbActionsField.setParameters(node);
 
 
 
 
41
 
42
+ node.classList.remove('wptb-ondragenter');
 
43
 
44
+ //wptbActionsField.addActionField( 1, node )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
 
46
  if (element.kind === 'button') {
47
  var a = node.querySelector('a'),
69
  WPTB_Helper.dataTitleColumnSet(table);
70
  }
71
  });
72
+
73
+ ed.on('keydown', function (e) {
74
+ var wptbActionsField = new WPTB_ActionsField();
75
+
76
+ wptbActionsField.addActionField(1, node);
77
+
78
+ wptbActionsField.setParameters(node);
79
+ });
80
+ ed.on('keyup', function (e) {
81
+ var wptbActionsField = new WPTB_ActionsField();
82
+
83
+ wptbActionsField.addActionField(1, node);
84
+
85
+ wptbActionsField.setParameters(node);
86
+
87
+ e.target.onblur = function () {
88
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
89
+ wptbTableStateSaveManager.tableStateSet();
90
+ };
91
+ });
92
  },
93
  init_instance_callback: function init_instance_callback(editor) {
94
  window.currentEditor = editor;
113
  WPTB_Helper.listItemsTinyMceInit(listItems[_i]);
114
  }
115
  }
 
 
 
 
 
116
  };
117
 
118
  node.onmouseleave = function (event) {
119
+ var wptbActionsField = new WPTB_ActionsField();
120
+
121
+ if (wptbActionsField.wptbActions && wptbActionsField.wptbActions.type != '1') {
122
+ return;
 
123
  }
124
+
125
+ wptbActionsField.leaveFromField(event, node, 1);
126
  };
127
 
128
+ var wptbActions = document.getElementsByClassName('wptb-actions');
129
+ if (wptbActions.length > 0) {
130
+ wptbActions = wptbActions[0];
131
+ }
132
+
133
  // Change data-title-column if the title was changed
134
  if (element.kind == 'text') {
135
  var observer = new MutationObserver(function (mutations) {
162
  document.counter.increment(element.kind);
163
  };
164
 
165
+ var WPTB_ActionsField = function WPTB_ActionsField() {
166
+ var _this = this;
167
+
168
+ //this.wptbBorderMarker;
169
+ this.wptbActions;
170
+ if (document.getElementsByClassName('wptb-actions').length != 0) {
171
+ this.wptbActions = document.getElementsByClassName('wptb-actions')[0];
172
+ }
173
+
174
+ this.addActionField = function (actionType, thisNode) {
175
+ var body = document.getElementsByTagName('body')[0];
176
+
177
+ var actions = document.getElementsByClassName('wptb-actions');
178
+ if (actions.length != 0) {
179
+ var previousNode = actions[0].activeElem;
180
+ if (previousNode) {
181
+ previousNode.classList.remove('wptb-directlyhovered');
182
+ }
183
+
184
+ while (actions.length != 0) {
185
+ actions[0].parentNode.removeChild(actions[0]);
186
+ }
187
+ }
188
+
189
+ if (actionType == 1) {
190
+
191
+ var btnDelete = void 0,
192
+ btnCopy = void 0,
193
+ btnMove = void 0;
194
+
195
+ btnDelete = document.createElement('span'), btnCopy = document.createElement('span'), btnMove = document.createElement('span'), actions = document.createElement('div');
196
+
197
+ actions.classList.add('wptb-actions');
198
+ btnDelete.classList.add('dashicons', 'dashicons-trash', 'wptb-delete-action');
199
+ btnCopy.classList.add('dashicons', 'dashicons-admin-page', 'wptb-duplicate-action');
200
+ btnMove.classList.add("dashicons", "dashicons-move", 'wptb-move-action');
201
+ btnMove.draggable = true;
202
+
203
+ actions.appendChild(btnMove);
204
+ actions.appendChild(btnCopy);
205
+ actions.appendChild(btnDelete);
206
+ body.appendChild(actions);
207
+
208
+ actions.activeElem = thisNode;
209
+
210
+ actions.type = 1;
211
+
212
+ btnDelete.onclick = function (event) {
213
+ var act = event.target.parentNode.activeElem,
214
+ el = act.parentNode;
215
+ el.removeChild(act);
216
+
217
+ if (act.kind == 'text') {
218
+ var thisRow = el.parentNode;
219
+ if (thisRow.classList.contains('wptb-table-head')) {
220
+ var table = WPTB_Helper.findAncestor(thisRow, 'wptb-preview-table');
221
+ WPTB_Helper.dataTitleColumnSet(table);
222
+ }
223
+ }
224
+
225
+ var wptbActionsField = new WPTB_ActionsField();
226
+
227
+ wptbActionsField.actionsRemove();
228
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
229
+ wptbTableStateSaveManager.tableStateSet();
230
+ };
231
+
232
+ btnCopy.onclick = function (event) {
233
+ var copy = void 0,
234
+ infArr = void 0,
235
+ type = void 0;
236
+ var activeElement = event.target.parentNode.activeElem;
237
+ var activeElementClone = activeElement.cloneNode(true);
238
+ activeElementClone.classList.remove('wptb-directlyhovered');
239
+ infArr = activeElement.className.match(/wptb-element-(.+)-(\d+)/i);
240
+ type = infArr[1];
241
+ var td = activeElement.parentNode;
242
+ if (type == 'list') {
243
+ var temp = [],
244
+ srcList = activeElement.querySelectorAll('ul li .wptb-list-item-content');
245
+
246
+ for (var i = 0; i < srcList.length; i++) {
247
+ temp.push(srcList[i].innerHTML);
248
+ }
249
+
250
+ copy = new WPTB_List(temp, activeElementClone);
251
+
252
+ td.insertBefore(copy.getDOMElement(), activeElement.nextSibling);
253
+ } else if (type == 'text') {
254
+ copy = new WPTB_Text(activeElementClone.childNodes[0].innerHTML, activeElementClone);
255
+
256
+ td.insertBefore(copy.getDOMElement(), activeElement.nextSibling);
257
+ } else if (type == 'image') {
258
+ copy = new WPTB_Image('', activeElement);
259
+
260
+ td.insertBefore(copy.getDOMElement(), activeElement.nextSibling);
261
+ } else {
262
+ var text = activeElementClone.childNodes[0].querySelector('p').innerHTML;
263
+
264
+ copy = new WPTB_Button(text, activeElementClone);
265
+
266
+ td.insertBefore(copy.getDOMElement(), activeElement.nextSibling);
267
+ }
268
+
269
+ WPTB_innerElementSet(copy.getDOMElement());
270
+
271
+ var wptbActionsField = new WPTB_ActionsField(1, activeElement);
272
+
273
+ wptbActionsField.setParameters(activeElement);
274
+
275
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
276
+ wptbTableStateSaveManager.tableStateSet();
277
+ };
278
+
279
+ btnMove.ondragstart = function (event) {
280
+ var dragImagesArr = WPTB_Helper.dragImagesArr(),
281
+ actions = event.target.parentNode,
282
+ activeElem = actions.activeElem,
283
+ infArr = void 0,
284
+ type = void 0;
285
+ infArr = activeElem.className.match(/wptb-element-(.+)-(\d+)/i);
286
+ type = infArr[1];
287
+ activeElem.classList.add('wptb-moving-mode');
288
+
289
+ event.dataTransfer.effectAllowed = 'move';
290
+ event.dataTransfer.setDragImage(dragImagesArr[type], 0, 0);
291
+ event.dataTransfer.setData('node', 'wptb-element-' + infArr[1] + '-' + infArr[2]);
292
+ event.dataTransfer.setData('wptb-moving-mode', 'wptb-element-' + infArr[1] + '-' + infArr[2]);
293
+ event.dataTransfer.setData('wptbElIndic-' + infArr[1], 'wptbElIndic-' + infArr[1]);
294
+ var act = event.target.parentNode.activeElem;
295
+ if (act.kind == 'text') {
296
+ var thisRow = act.parentNode.parentNode;
297
+ if (thisRow.classList.contains('wptb-table-head')) {
298
+ var table = WPTB_Helper.findAncestor(thisRow, 'wptb-preview-table');
299
+ WPTB_Helper.dataTitleColumnSet(table);
300
+ }
301
+ }
302
+ //actions.style.display = 'none';
303
+ _this.actionsHide();
304
+ };
305
+
306
+ //actions.style.right = '-' + parseFloat( thisNode.offsetWidth ) + 'px';
307
+ actions.style.display = 'block';
308
+
309
+ _this.wptbActions = actions;
310
+ } else if (actionType == 2) {
311
+ var _btnDelete = void 0,
312
+ _btnCopy = void 0,
313
+ previous = void 0,
314
+ i = void 0;
315
+
316
+ _btnDelete = document.createElement('span'), _btnCopy = document.createElement('span'), actions = document.createElement('span');
317
+
318
+ actions.classList.add('wptb-actions');
319
+ _btnDelete.classList.add('dashicons', 'dashicons-trash', 'wptb-delete-action');
320
+ _btnCopy.classList.add('dashicons', 'dashicons-admin-page', 'wptb-duplicate-action');
321
+
322
+ actions.append(_btnCopy, _btnDelete);
323
+ body.appendChild(actions);
324
+
325
+ actions.activeElem = thisNode;
326
+
327
+ var wptbDirectlyhovered = WPTB_Helper.findAncestor(thisNode, 'wptb-directlyhovered');
328
+ if (wptbDirectlyhovered) {
329
+ wptbDirectlyhovered.classList.remove('wptb-directlyhovered');
330
+ }
331
+
332
+ actions.type = 2;
333
+
334
+ _btnDelete.onclick = function (event) {
335
+ var action = event.target.parentNode,
336
+ item = action.activeElem,
337
+ parent = item.parentNode;
338
+ var wptbActionsField = new WPTB_ActionsField(4);
339
+ wptbActionsField.actionsRemove();
340
+ parent.removeChild(item);
341
+ WPTB_Helper.listItemsRecalculateIndex(parent);
342
+
343
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
344
+ wptbTableStateSaveManager.tableStateSet();
345
+ };
346
+
347
+ _btnCopy.onclick = function (event) {
348
+ var coordinatesElement = thisNode.getBoundingClientRect();
349
+ var coordinatesElementTopBegin = coordinatesElement.top;
350
+
351
+ var listItem = event.target.parentNode.activeElem,
352
+ content = listItem.querySelector('.wptb-list-item-content'),
353
+ html = content.innerHTML;
354
+ var duplicate = new WPTB_ListItem(html, listItem, true);
355
+ listItem.parentNode.insertBefore(duplicate.getDOMElement(), thisNode.nextSibling);
356
+ WPTB_Helper.listItemsTinyMceInit(duplicate.getDOMElement().firstChild);
357
+
358
+ var divcontent = thisNode.getElementsByClassName('wptb-list-item-content');
359
+ if (divcontent.length > 0) {
360
+ divcontent = divcontent[0];
361
+ }
362
+ setTimeout(function () {
363
+ divcontent.innerHTML = html;
364
+ WPTB_Helper.listItemsRecalculateIndex(listItem.parentNode);
365
+ }, 5);
366
+
367
+ coordinatesElement = thisNode.getBoundingClientRect();
368
+ var coordinatesElementTopEnd = coordinatesElement.top;
369
+
370
+ if (coordinatesElementTopBegin != coordinatesElementTopEnd) {
371
+ var wptbActionsField = new WPTB_ActionsField(2, thisNode);
372
+ wptbActionsField.setParameters(thisNode);
373
+ }
374
+
375
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
376
+ wptbTableStateSaveManager.tableStateSet();
377
+ };
378
+
379
+ actions.style.display = 'block';
380
+
381
+ _this.wptbActions = actions;
382
+ }
383
+ };
384
+
385
+ this.setParameters = function (thisNode) {
386
+ if (!_this.wptbActions) {
387
+ var actions = document.getElementsByClassName('wptb-actions');
388
+ if (actions.length > 0) {
389
+ _this.wptbActions = actions[0];
390
+ }
391
+ }
392
+
393
+ if (_this.wptbActions) {
394
+ _this.wptbActions.style.display = 'block';
395
+ }
396
+
397
+ var coordinatesElement = thisNode.getBoundingClientRect();
398
+
399
+ var wptbContainer = document.getElementsByClassName('wptb-container')[0];
400
+ var correctTop = function correctTop() {
401
+ var coordinatesElement = thisNode.getBoundingClientRect();
402
+ _this.wptbActions.style.top = parseFloat(coordinatesElement.top) - 15 + 'px';
403
+ };
404
+ wptbContainer.removeEventListener('scroll', correctTop, false);
405
+
406
+ _this.wptbActions.style.top = parseFloat(coordinatesElement.top) - 15 + 'px';
407
+ _this.wptbActions.style.left = parseFloat(coordinatesElement.right) - parseFloat(_this.wptbActions.clientWidth) + 1 + 'px';
408
+
409
+ // let wptbBorderMarkerTop = this.wptbBorderMarker.querySelector( '.wptb-border-marker-top' );
410
+ // wptbBorderMarkerTop.style.width = ( parseFloat( thisNode.offsetWidth ) + 3 ) + 'px';
411
+ //
412
+ // let wptbBorderMarkerRight = this.wptbBorderMarker.querySelector( '.wptb-border-marker-right' );
413
+ // wptbBorderMarkerRight.style.height = ( parseFloat( coordinatesElement.bottom ) - parseFloat( coordinatesElement.top ) + 4 ) + 'px';
414
+ // wptbBorderMarkerRight.style.left = ( parseFloat( thisNode.offsetWidth ) + 3 ) + 'px';
415
+ //
416
+ // let wptbBorderMarkerBottom = this.wptbBorderMarker.querySelector( '.wptb-border-marker-bottom' );
417
+ // wptbBorderMarkerBottom.style.width = wptbBorderMarkerTop.style.width;
418
+ // wptbBorderMarkerBottom.style.top = ( parseFloat( coordinatesElement.bottom ) - parseFloat( coordinatesElement.top ) + 3 ) + 'px';;
419
+ //
420
+ // let wptbBorderMarkerLeft = this.wptbBorderMarker.querySelector( '.wptb-border-marker-left' );
421
+ //
422
+
423
+ //this.wptbBorderMarker.style.display = 'block';
424
+ _this.wptbActions.style.display = 'block';
425
+ thisNode.classList.add('wptb-directlyhovered');
426
+
427
+ wptbContainer.addEventListener('scroll', correctTop, false);
428
+ };
429
+
430
+ // if( actionType == 1 || actionType == 2 ) {
431
+ // this.setParameters( thisNode );
432
+ // }
433
+ // } else {
434
+ // this.wptbActions.style.display = 'block';
435
+ // thisNode.classList.add( 'wptb-directlyhovered' );
436
+ // }
437
+
438
+ this.leaveFromField = function (event, node, actionType) {
439
+ if (event.relatedTarget) {
440
+ if (event.relatedTarget.classList.contains('wptb-actions') || event.relatedTarget.classList.contains('wptb-move-action') || event.relatedTarget.classList.contains('wptb-duplicate-action') || event.relatedTarget.classList.contains('wptb-delete-action')) {
441
+ if (!_this.wptbActions) {
442
+ _this.wptbActions = document.getElementsByClassName('wptb-actions')[0];
443
+ }
444
+ _this.wptbActions.onmouseleave = function (event) {
445
+ if (event.relatedTarget != null && event.relatedTarget != _this.wptbActions.activeElem && WPTB_Helper.findAncestor(event.relatedTarget, 'wptb-directlyhovered') != _this.wptbActions.activeElem) {
446
+ event.target.activeElem.classList.remove('wptb-directlyhovered');
447
+ _this.wptbActions.style.display = 'none';
448
+
449
+ if (_this.wptbActions.type == 2) {
450
+ var wptbActionsField = new WPTB_ActionsField();
451
+
452
+ wptbActionsField.addActionField(1, event.relatedTarget.parentNode.parentNode);
453
+
454
+ wptbActionsField.setParameters(event.relatedTarget.parentNode.parentNode);
455
+ }
456
+ } else {
457
+ return;
458
+ }
459
+ };
460
+
461
+ return;
462
+ }
463
+ // else if( event.relatedTarget.classList.contains( 'wptb-drop-handle' ) ) {
464
+ // let wptbDropHandle = document.getElementsByClassName( 'wptb-drop-handle' );
465
+ // if( wptbDropHandle.length > 0 ) {
466
+ // wptbDropHandle = wptbDropHandle[0];
467
+ // wptbDropHandle.onmouseleave
468
+ // }
469
+ // }
470
+ }
471
+
472
+ node.classList.remove('wptb-directlyhovered');
473
+ _this.wptbActions.style.display = 'none';
474
+
475
+ if (_this.wptbActions.type == 2) {
476
+ if (event.relatedTarget) {
477
+ if (event.relatedTarget.localName == 'ul') {
478
+ //let wptbActionsField = new WPTB_ActionsField();
479
+
480
+ _this.addActionField(1, event.relatedTarget.parentNode);
481
+
482
+ _this.setParameters(event.relatedTarget.parentNode);
483
+ }
484
+ }
485
+ }
486
+ };
487
+
488
+ this.actionsRemove = function () {
489
+ if (!_this.wptbActions) {
490
+ var actions = document.getElementsByClassName('wptb-actions');
491
+ if (actions.length > 0) {
492
+ _this.wptbActions = actions[0];
493
+ }
494
+ }
495
+
496
+ if (_this.wptbActions) {
497
+ _this.wptbActions.parentNode.removeChild(_this.wptbActions);
498
+ }
499
+ };
500
+
501
+ this.actionsHide = function () {
502
+ if (!_this.wptbActions) {
503
+ var actions = document.getElementsByClassName('wptb-actions');
504
+ if (actions.length > 0) {
505
+ _this.wptbActions = actions[0];
506
+ }
507
+ }
508
+
509
+ if (_this.wptbActions) {
510
+ _this.wptbActions.style.opacity = 0;
511
+ }
512
+ };
513
+ };
514
  (function () {
515
  var WPTB_Builder = function WPTB_Builder() {
516
  var table_id = WPTB_Helper.detectMode();
531
  WPTB_Table();
532
  WPTB_LeftPanel();
533
  WPTB_Settings();
534
+
535
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
536
+ wptbTableStateSaveManager.tableStateSet();
537
  } else {
538
  document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';
539
  }
562
  elButton = document.createElement('div'),
563
  el_B = document.createElement('a'),
564
  el_BDiv = document.createElement('div'),
565
+ el_BDivP = document.createElement('p'),
566
  kindIndexProt = undefined,
567
  copy = false;
568
 
569
  DOMElement.classList.add('wptb-button-container', 'wptb-size-M', 'wptb-');
570
  elButton.classList.add('wptb-button-wrapper');
571
  el_BDiv.classList.add('wptb-button');
572
+ el_BDivP.innerHTML = text != undefined ? text : 'Button Text';
573
 
574
  // Creation of a new button when copying to avoid errors when assigning new event handlers.
575
  if (DOMElementProt) {
597
  }
598
  }
599
 
600
+ var wptbButtonA = DOMElementProt.querySelector('a');
601
+ if (wptbButtonA) {
602
+ var wptbButtonAttributes = [].concat(_toConsumableArray(wptbButtonA.attributes));
603
  if (wptbButtonAttributes.length > 0) {
604
  for (var _i2 = 0; _i2 < wptbButtonAttributes.length; _i2++) {
605
  if (wptbButtonAttributes[_i2].name == 'style' || wptbButtonAttributes[_i2].name == 'href' || wptbButtonAttributes[_i2].name == 'target') {
608
  }
609
  }
610
  }
611
+
612
+ var wptbButton = DOMElementProt.querySelector('.wptb-button');
613
+ if (wptbButton) {
614
+ var wptbButtonAttributes = [].concat(_toConsumableArray(wptbButton.attributes));
615
+ if (wptbButtonAttributes.length > 0) {
616
+ for (var _i3 = 0; _i3 < wptbButtonAttributes.length; _i3++) {
617
+ if (wptbButtonAttributes[_i3].name == 'style') {
618
+ el_BDiv.setAttribute(wptbButtonAttributes[_i3].name, wptbButtonAttributes[_i3].value);
619
+ }
620
+ }
621
+ }
622
+ }
623
  }
624
 
625
  elButton.appendChild(el_B);
626
  el_B.appendChild(el_BDiv);
627
+ el_BDiv.appendChild(el_BDivP);
628
  DOMElement.appendChild(elButton);
629
 
630
  this.kind = 'button';
862
  var innerElement = wptbDropHandle.getDOMParentElement();
863
  td = innerElement.parentNode;
864
 
865
+ if (wptbDropHandle.dataset.text == 'Above Element') {
866
  td.insertBefore(element, innerElement);
867
  } else if (wptbDropHandle.dataset.text == 'Below Element') {
868
  var innerElementNext = innerElement.nextSibling;
880
  wptbDropBorderMarker.style.display = 'none';
881
 
882
  WPTB_innerElementSet(element);
883
+
884
+ if (!element.classList.contains('wptb-image-container')) {
885
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
886
+ wptbTableStateSaveManager.tableStateSet();
887
+ }
888
  };
889
  var wptbContainer = document.querySelector('.wptb-container');
890
  wptbContainer.onscroll = function () {
923
  wptbDropHandle.style.width = thisElem.offsetWidth + 'px';
924
  var height = thisElem.offsetHeight,
925
  coordinatesElement = thisElem.getBoundingClientRect(),
926
+ left = parseFloat(coordinatesElement.left),
927
  top = void 0;
928
  wptbDropHandle.style.left = left + 'px';
929
 
946
  wptbDropBorderMarker.style.display = 'block';
947
  if (thisElem.nodeName.toLowerCase() != 'td') {
948
  var y = e.offsetY == undefined ? e.layerY : e.offsetY;
949
+ top = parseFloat(coordinatesElement.top) - parseFloat(11);
950
  wptbDropHandle.dataset.text = 'Abowe Element';
951
  if (y > height / 2) {
952
+ top = parseFloat(coordinatesElement.top) + height - 1;
953
  wptbDropHandle.dataset.text = 'Below Element';
954
  }
955
  } else {
956
  wptbDropHandle.dataset.text = 'Drop Here';
957
+ top = parseFloat(coordinatesElement.top) + height / 2 - 5;
958
  }
959
  wptbDropHandle.style.top = top + 'px';
960
 
962
  wptbDropBorderMarker.style.left = coordinatesElement.left + 'px';
963
 
964
  wptbDropBorderMarkerTop = wptbDropBorderMarker.querySelector('.wptb-drop-border-marker-top');
965
+ wptbDropBorderMarkerTop.style.width = parseFloat(thisElem.offsetWidth) - parseFloat(1) + 'px';
966
 
967
  wptbDropBorderMarkerRight = wptbDropBorderMarker.querySelector('.wptb-drop-border-marker-right');
968
+ wptbDropBorderMarkerRight.style.height = parseFloat(coordinatesElement.bottom) - parseFloat(coordinatesElement.top) - 1 + 'px';
969
  wptbDropBorderMarkerRight.style.left = wptbDropBorderMarkerTop.style.width;
970
 
971
  wptbDropBorderMarkerBottom = wptbDropBorderMarker.querySelector('.wptb-drop-border-marker-bottom');
1106
  } else if (element.kind == 'image') {
1107
  var _affectedEl2 = document.getElementsByClassName('wptb-element-' + kindIndexProt);
1108
  if (_affectedEl2.length > 0) {
 
 
 
1109
 
1110
+ var wptbImageWrapper = _affectedEl2[0].getElementsByClassName('wptb-image-wrapper');
1111
+ if (wptbImageWrapper.length > 0) {
1112
+ wptbImageWrapper = wptbImageWrapper[0];
1113
+
1114
+ // set select according to the alignment of the image
1115
+ var imgAlign = wptbImageWrapper.style.textAlign,
1116
+ imageAlignmentSelect = prop.querySelector('select[data-type="image-alignment"]'),
1117
+ _selectOption = imageAlignmentSelect.getElementsByTagName('option');
 
 
 
 
 
 
1118
 
1119
+ for (var _i2 = 0; _i2 < _selectOption.length; _i2++) {
1120
+ if (_selectOption[_i2].value == imgAlign) {
1121
+ _selectOption[_i2].selected = true;
 
 
1122
  }
1123
+ }
1124
+
1125
+ var elementsA = wptbImageWrapper.getElementsByTagName('a');
1126
+ if (elementsA.length > 0) {
1127
+ var a = elementsA[0];
1128
 
1129
+ if (a) {
1130
+ a.onclick = function (e) {
1131
+ e.preventDefault();
1132
+ };
 
1133
 
1134
+ // set text link for input field of setting panel
1135
+ var imageLinkHref = a.getAttribute('href'),
1136
+ inputImageLink = prop.querySelector('input[data-type="image-link"]');
1137
+ if (imageLinkHref) {
1138
+ inputImageLink.value = imageLinkHref;
1139
+ }
1140
 
1141
+ // set checkbox for target of link
1142
+ var imageLinkTarget = a.getAttribute('target'),
1143
+ imageLinkTargetInput = prop.querySelector('input[data-type="image-link-target"]'),
1144
+ imageLinkTargetInputId = imageLinkTargetInput.getAttribute('id'),
1145
+ imageLinkTargetInputLabel = imageLinkTargetInput.parentNode.getElementsByTagName('label')[0];
1146
 
1147
+ imageLinkTargetInputId = imageLinkTargetInputId + '-' + kindIndexProt.split('-')[1];
1148
+
1149
+ imageLinkTargetInput.setAttribute('id', imageLinkTargetInputId);
1150
+ imageLinkTargetInputLabel.setAttribute('for', imageLinkTargetInputId);
1151
+
1152
+ if (imageLinkTarget && imageLinkTarget == '_blank') {
1153
+ imageLinkTargetInput.checked = true;
1154
+ }
1155
 
 
 
1156
  // set value for input fields of image size
1157
+ var imgWidth = a.style.width;
1158
  if (imgWidth) {
1159
  var imageWidthInputRange = prop.querySelector('input[type="range"][data-type="image-size"]'),
1160
  imageWidthInputNumber = prop.querySelector('input[type="number"][data-type="image-size"]');
1163
  imageWidthInputNumber.value = parseInt(imgWidth);
1164
  }
1165
 
1166
+ var img = a.getElementsByTagName('img');
1167
+ if (img.length > 0) {
1168
+ // set value for input field of alternative text image
1169
+ var imgAlternativeText = img[0].getAttribute('alt'),
1170
+ imageAlternativeTextInput = prop.querySelector('input[type="text"][data-type="alternative-text"]');
1171
 
1172
+ imageAlternativeTextInput.value = imgAlternativeText;
1173
+ }
1174
  }
1175
  }
1176
  }
1184
  textFontSizeInputNumber = prop.querySelector('input[type="number"][data-type="font-size"]'),
1185
  textColorInput = prop.querySelector('input[type="text"][data-type="color"]');
1186
 
1187
+ textFontSizeInputRange.value = parseInt(elementFontSize) ? parseInt(elementFontSize) : 10;
1188
+ textFontSizeInputNumber.value = parseInt(elementFontSize) ? parseInt(elementFontSize) : 10;
1189
  textColorInput.value = WPTB_Helper.rgbToHex(elementTextColor);
1190
  }
1191
  } else if (element.kind == 'list') {
1357
  b[i].classList.remove('selected');
1358
  }
1359
  this.classList.add('selected');
1360
+
1361
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
1362
+ wptbTableStateSaveManager.tableStateSet();
1363
  };
1364
  }
1365
  }
1395
  } else {
1396
  affectedEl.style.color = ui.color.toString();
1397
  }
1398
+
1399
+ //console.log(event);
1400
+ WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving(event);
1401
  }
1402
  });
1403
  }
1406
  var slider = optionControls[i].parentNode.parentNode.getElementsByClassName('wptb-text-font-size-slider')[0];
1407
  slider.oninput = function () {
1408
  this.parentNode.parentNode.getElementsByClassName('wptb-text-font-size-number')[0].value = this.value;
1409
+ this.parentNode.parentNode.getElementsByClassName('wptb-text-font-size-number')[0].onchange(event);
1410
  };
1411
  }
1412
 
1414
  var slider = optionControls[i].parentNode.parentNode.getElementsByClassName('wptb-image-size-slider')[0];
1415
  slider.oninput = function () {
1416
  this.parentNode.parentNode.getElementsByClassName('wptb-image-width-number')[0].value = this.value;
1417
+ this.parentNode.parentNode.getElementsByClassName('wptb-image-width-number')[0].onchange(event);
1418
  };
1419
  }
1420
 
1421
  optionControls[i].onchange = function (event) {
 
1422
  var n_Class = this.dataset.element,
1423
  infArr = n_Class.match(/wptb-options-(.+)-(\d+)/i),
1424
  type = infArr[1],
1462
  break;
1463
  case 'font-size':
1464
  affectedEl.style.fontSize = val + 'px';
1465
+ this.parentNode.parentNode.getElementsByClassName('wptb-text-font-size-slider')[0].value = this.value;
1466
  break;
1467
  case 'button-alignment':
1468
  var jc = '';
1546
  }
1547
  break;
1548
  }
1549
+
1550
+ if (event.target.classList.contains('wptb-text-font-size-slider') || event.target.classList.contains('wptb-image-size-slider')) {
1551
+ event.target.onmouseup = function () {
1552
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
1553
+ wptbTableStateSaveManager.tableStateSet();
1554
+ };
1555
+ } else {
1556
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
1557
+ wptbTableStateSaveManager.tableStateSet();
1558
+ }
1559
  };
1560
  }
1561
  };
1615
  e.target.querySelector('p').innerText = 'New List Item';
1616
  //tinyMCE.execCommand('mceInsertContent', false, 'New List Item');
1617
  WPTB_Helper.listItemsRecalculateIndex(article.parentNode);
1618
+
1619
+ return;
1620
  } else if (e.keyCode == '8' || e.keyCode == '46') {
1621
  var p = e.target.querySelector('p');
1622
  var pText = p.innerHTML.replace(/<[^>]+>/g, '');
1636
  }
1637
  }
1638
  }
1639
+
1640
+ var wptbListItem = e.target.parentNode;
1641
+ var wptbActionsField = new WPTB_ActionsField();
1642
+
1643
+ wptbActionsField.addActionField(2, wptbListItem);
1644
+
1645
+ wptbActionsField.setParameters(wptbListItem);
1646
  });
1647
 
1648
+ ed.on('keyup', function (e) {
1649
+ var wptbListItem = e.target.parentNode;
1650
+ var wptbActionsField = new WPTB_ActionsField();
1651
+
1652
+ wptbActionsField.addActionField(2, wptbListItem);
1653
+
1654
+ wptbActionsField.setParameters(wptbListItem);
1655
+
1656
+ e.target.onblur = function () {
1657
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
1658
+ wptbTableStateSaveManager.tableStateSet();
1659
+ };
1660
+ });
1661
  },
1662
  init_instance_callback: function init_instance_callback(editor) {
1663
  window.currentEditor = editor;
1691
  if (e.keyCode == 13) {
1692
  e.preventDefault();
1693
  }
1694
+ var wptbButtonContainer = WPTB_Helper.findAncestor(target, 'wptb-button-container');
1695
+
1696
+ var wptbActionsField = new WPTB_ActionsField();
1697
+
1698
+ wptbActionsField.addActionField(1, wptbButtonContainer);
1699
+
1700
+ wptbActionsField.setParameters(wptbButtonContainer);
1701
+ });
1702
+
1703
+ ed.on('keyup', function (e) {
1704
+ var wptbButtonContainer = WPTB_Helper.findAncestor(target, 'wptb-button-container');
1705
+
1706
+ var wptbActionsField = new WPTB_ActionsField();
1707
+
1708
+ wptbActionsField.addActionField(1, wptbButtonContainer);
1709
+
1710
+ wptbActionsField.setParameters(wptbButtonContainer);
1711
+
1712
+ e.target.onblur = function () {
1713
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
1714
+ wptbTableStateSaveManager.tableStateSet();
1715
+ };
1716
  });
1717
  },
1718
  init_instance_callback: function init_instance_callback(editor) {
1817
  document.getElementById('wptb-table-inner-border-slider').value = 1;
1818
  document.getElementById('wptb-table-inner-border-number').value = 1;
1819
 
1820
+ WPTB_Helper.wpColorPickerClear('wptb-table-border-color', true);
1821
 
1822
+ WPTB_Helper.wpColorPickerClear('wptb-table-header-bg', true);
1823
 
1824
+ WPTB_Helper.wpColorPickerClear('wptb-even-row-bg', true);
1825
 
1826
+ WPTB_Helper.wpColorPickerClear('wptb-odd-row-bg', true);
1827
 
1828
  document.getElementById('wptb-table-cell-slider').value = 15;
1829
  document.getElementById('wptb-table-cell-number').value = 15;
1830
  },
1831
+ elementOptionsPanelClear: function elementOptionsPanelClear() {
1832
+ var elementOptionsGroup = document.getElementById('element-options-group');
1833
+ if (elementOptionsGroup) {
1834
+ elementOptionsGroup.innerHTML = '';
1835
+ }
1836
+ },
1837
+ wpColorPickerCheckChangeForTableStateSaving: function wpColorPickerCheckChangeForTableStateSaving(event) {
1838
+ if (event.originalEvent.type == 'external') {
1839
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
1840
+ wptbTableStateSaveManager.tableStateSet();
1841
+ } else {
1842
+ var wpPickerContainer = WPTB_Helper.findAncestor(event.target, 'wp-picker-container');
1843
+ if (wpPickerContainer) {
1844
+ if (event.originalEvent.type == 'square') {
1845
+ var irisSquareHandle = wpPickerContainer.getElementsByClassName('iris-square-handle');
1846
+ if (irisSquareHandle.length > 0) {
1847
+ irisSquareHandle = irisSquareHandle[0];
1848
+ irisSquareHandle.onmouseup = function () {
1849
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
1850
+ wptbTableStateSaveManager.tableStateSet();
1851
+ };
1852
+ }
1853
+ } else if (event.originalEvent.type == 'strip') {
1854
+ var uiSliderHandle = wpPickerContainer.getElementsByClassName('iris-slider-offset');
1855
+ if (uiSliderHandle.length > 0) {
1856
+ uiSliderHandle = uiSliderHandle[0];
1857
+ uiSliderHandle.onmouseup = function () {
1858
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
1859
+ wptbTableStateSaveManager.tableStateSet();
1860
+ };
1861
+ }
1862
+ }
1863
+ }
1864
+ }
1865
+ },
1866
+ wpColorPickerClear: function wpColorPickerClear(attribute, isId) {
1867
+ var input = void 0;
1868
+ if (isId) {
1869
+ input = [document.getElementById(attribute)];
1870
+ input.length = 1;
1871
+ } else {
1872
+ input = document.getElementsByClassName(attribute);
1873
+ }
1874
+ for (var i = 0; i < input.length; i++) {
1875
+ var wpPickerContainer = WPTB_Helper.findAncestor(input[i], 'wp-picker-container');
1876
+ if (wpPickerContainer) {
1877
+ var parent = wpPickerContainer.parentNode;
1878
+ parent.removeChild(wpPickerContainer);
1879
+ var newInput = document.createElement('input');
1880
+ if (isId) {
1881
+ newInput.setAttribute('id', attribute);
1882
+ } else {
1883
+ newInput.classList.add('wptb-element-property', attribute);
1884
+ }
1885
+ newInput.value = "";
1886
+ parent.appendChild(newInput);
1887
+ }
1888
+ }
1889
  },
1890
  detectMode: function detectMode() {
1891
  var url = window.location.href,
1928
  elImage = document.createElement('div');
1929
  var anchor = document.createElement('a'),
1930
  img = document.createElement('img');
1931
+ anchor.style.display = 'block';
1932
  anchor.appendChild(img);
1933
  DOMElement.classList.add('wptb-image-container');
1934
  elImage.classList.add('wptb-image-wrapper');
1949
  // When an image is selected, run a callback.
1950
  file_frame.on('select', function () {
1951
  attachment = file_frame.state().get('selection').first().toJSON();
1952
+ var imgSrc = attachment.url;
1953
+ var linkArr = imgSrc.split(':'),
1954
+ linkClean = void 0;
1955
+ if (Array.isArray(linkArr) && linkArr.length > 0) {
1956
+ linkClean = linkArr[linkArr.length - 1];
1957
+ }
1958
+ img.src = linkClean;
1959
+ img.height = attachment.height;
1960
+ img.width = attachment.width;
1961
+ img.style.width = '100%';
1962
+
1963
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
1964
+ wptbTableStateSaveManager.tableStateSet();
1965
  });
1966
  // Finally, open the modal
1967
  if (src == undefined) {
2030
  rows = document.getElementById('wptb-rows-number').value;
2031
 
2032
  WPTB_Table(columns, rows);
 
2033
 
2034
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
2035
+ wptbTableStateSaveManager.tableStateSet();
2036
+ };
2037
  };
2038
  var WPTB_innerElementSet = function WPTB_innerElementSet(element) {
2039
 
2088
  } else {
2089
  classId = e.dataTransfer.getData('node');
2090
  element = document.getElementsByClassName(classId)[0];
2091
+ //element.classList.remove( 'wptb-moving-mode' );
2092
  }
2093
 
2094
  if (wptbDropHandle.style.display == 'block') {
2100
  var innerElement = wptbDropHandle.getDOMParentElement();
2101
  td = innerElement.parentNode;
2102
 
2103
+ if (wptbDropHandle.dataset.text == 'Above Element') {
2104
  td.insertBefore(element, innerElement);
2105
  } else if (wptbDropHandle.dataset.text == 'Below Element') {
2106
  var innerElementNext = innerElement.nextSibling;
2121
 
2122
  WPTB_innerElementSet(element);
2123
 
2124
+ if (!element.classList.contains('wptb-image-container') || element.classList.contains('wptb-moving-mode')) {
2125
+ element.classList.remove('wptb-moving-mode');
2126
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
2127
+ wptbTableStateSaveManager.tableStateSet();
2128
+ }
2129
  return true;
2130
  };
2131
  element.onmouseover = function (e) {
2158
  for (var _i = 1; _i < tableRows.length; _i += 2) {
2159
  tableRows[_i].style.backgroundColor = ui.color.toString();
2160
  }
2161
+ console.log(event);
2162
+ console.log(this);
2163
+ WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving(event);
2164
  },
2165
  clear: function clear() {
2166
  var tableRows = table.getElementsByTagName('tr');
2171
  tds[j].style.backgroundColor = '';
2172
  }
2173
  }
2174
+
2175
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
2176
+ wptbTableStateSaveManager.tableStateSet();
2177
  }
2178
 
2179
  });
2185
  for (var _i3 = 2; _i3 < tableRows.length; _i3 += 2) {
2186
  tableRows[_i3].style.backgroundColor = ui.color.toString();
2187
  }
2188
+
2189
+ WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving(event);
2190
  },
2191
  clear: function clear() {
2192
  var tableRows = table.getElementsByTagName('tr');
2197
  tds[j].style.backgroundColor = '';
2198
  }
2199
  }
2200
+
2201
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
2202
+ wptbTableStateSaveManager.tableStateSet();
2203
  }
2204
  });
2205
 
2208
  change: function change(event, ui) {
2209
  var tableHeader = table.getElementsByTagName('tr')[0];
2210
  tableHeader.style.backgroundColor = ui.color.toString();
2211
+
2212
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
2213
+ wptbTableStateSaveManager.tableStateSet();
2214
  },
2215
  clear: function clear() {
2216
  var tableHeader = table.getElementsByTagName('tr')[0];
2219
  for (var j = 0; j < tds.length; j++) {
2220
  tds[j].style.backgroundColor = '';
2221
  }
2222
+
2223
+ WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving(event);
2224
  }
2225
  });
2226
 
2227
  function tableAdaptiveForMobile(table) {
2228
  var wptbAdaptiveTableCheckbox = document.getElementById('wptb-adaptive-table-checkbox');
2229
+ if (table && table.dataset.wptbAdaptiveTable && table.dataset.wptbAdaptiveTable == "1") {
2230
  wptbAdaptiveTableCheckbox.checked = true;
2231
  } else {
2232
  wptbAdaptiveTableCheckbox.checked = false;
2310
  tableCells[i].style.border = (tableInnerborderNumber != 0 ? tableInnerborderNumber : 1) + 'px solid ' + ui.color.toString();
2311
  }
2312
  }
2313
+ WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving(event);
2314
  },
2315
  clear: function clear() {
2316
  var tableCells = table.getElementsByTagName('td');
2319
  for (var i = 0; i < tableCells.length; i++) {
2320
  tableCells[i].style.borderColor = '';
2321
  }
2322
+
2323
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
2324
+ wptbTableStateSaveManager.tableStateSet();
2325
  }
2326
  });
2327
 
2446
  table.tdDefaultWidth();
2447
  };
2448
 
2449
+ document.getElementById('wptb-table-cell-slider').onchange = function () {
2450
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
2451
+ wptbTableStateSaveManager.tableStateSet();
2452
+ };
2453
+
2454
  document.getElementById('wptb-table-cell-number').onchange = function () {
2455
  document.getElementById('wptb-table-cell-slider').value = this.value;
2456
  addCellPadding(this.value);
2457
  table.tdDefaultWidth();
2458
+
2459
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
2460
+ wptbTableStateSaveManager.tableStateSet();
2461
  };
2462
 
2463
  document.getElementById('wptb-table-border-slider').oninput = function () {
2474
  }
2475
  };
2476
 
2477
+ document.getElementById('wptb-table-border-slider').onchange = function () {
2478
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
2479
+ wptbTableStateSaveManager.tableStateSet();
2480
+ };
2481
+
2482
  document.getElementById('wptb-table-border-number').onchange = function () {
2483
  document.getElementById('wptb-table-border-slider').value = this.value;
2484
  addBorderSize(this.value);
2485
  table.tdDefaultWidth();
2486
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
2487
+ wptbTableStateSaveManager.tableStateSet();
2488
  };
2489
 
2490
  document.getElementById('wptb-table-inner-border-slider').oninput = function () {
2493
  table.tdDefaultWidth();
2494
  };
2495
 
2496
+ document.getElementById('wptb-table-inner-border-slider').onchange = function () {
2497
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
2498
+ wptbTableStateSaveManager.tableStateSet();
2499
+ };
2500
+
2501
  document.getElementById('wptb-table-inner-border-number').onchange = function () {
2502
  document.getElementById('wptb-table-inner-border-slider').value = this.value;
2503
  addInnerBorderSize(this.value);
2504
  table.tdDefaultWidth();
2505
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
2506
+ wptbTableStateSaveManager.tableStateSet();
2507
  };
2508
 
2509
  document.getElementById('wptb-inner-border-check').onchange = function () {
2517
  } else {
2518
  tableBorderColorSetArea.style.display = '';
2519
  }
2520
+
2521
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
2522
+ wptbTableStateSaveManager.tableStateSet();
2523
  }
2524
  };
2525
 
2528
  table.addColumnWidth(this.value);
2529
  };
2530
 
2531
+ document.getElementById('wptb-table-column-width-slider').onchange = function () {
2532
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
2533
+ wptbTableStateSaveManager.tableStateSet();
2534
+ };
2535
+
2536
  document.getElementById('wptb-table-column-width-number').onchange = function () {
2537
  document.getElementById('wptb-table-column-width-slider').value = this.value;
2538
  table.addColumnWidth(this.value);
2539
+
2540
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
2541
+ wptbTableStateSaveManager.tableStateSet();
2542
  };
2543
 
2544
  document.getElementById('wptb-table-column-width-auto-fixed').onchange = function () {
2553
  document.getElementById('wptb-table-column-width-number').value = _width;
2554
  document.getElementById('wptb-table-column-width-slider').value = _width;
2555
  }
2556
+
2557
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
2558
+ wptbTableStateSaveManager.tableStateSet();
2559
  };
2560
 
2561
  document.getElementById('wptb-table-row-height-slider').oninput = function () {
2563
  table.addRowHeight(this.value);
2564
  };
2565
 
2566
+ document.getElementById('wptb-table-row-height-slider').onchange = function () {
2567
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
2568
+ wptbTableStateSaveManager.tableStateSet();
2569
+ };
2570
+
2571
  document.getElementById('wptb-table-row-height-number').onchange = function () {
2572
  document.getElementById('wptb-table-row-height-slider').value = this.value;
2573
  table.addRowHeight(this.value);
2574
+
2575
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
2576
+ wptbTableStateSaveManager.tableStateSet();
2577
  };
2578
 
2579
  document.getElementById('wptb-table-row-height-auto-fixed').onchange = function () {
2588
  document.getElementById('wptb-table-row-height-number').value = _height;
2589
  document.getElementById('wptb-table-row-height-slider').value = _height;
2590
  }
2591
+
2592
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
2593
+ wptbTableStateSaveManager.tableStateSet();
2594
  };
2595
 
2596
  document.getElementById('wptb-adaptive-table-checkbox').onchange = function () {
2599
  } else {
2600
  table.dataset.wptbAdaptiveTable = 0;
2601
  }
2602
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
2603
+ wptbTableStateSaveManager.tableStateSet();
2604
  };
2605
 
2606
  function createMobileHeadForTable(table, thisEvent) {
2631
 
2632
  document.getElementById('wptb-top-row-as-header').onchange = function () {
2633
  createMobileHeadForTable(table, this);
2634
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
2635
+ wptbTableStateSaveManager.tableStateSet();
2636
  };
2637
 
2638
  for (var i = 0; i < wptbElementButtons.length; i++) {
2674
  // this code hides the "element parameters" area
2675
  // when clicked outside this element and its "tinymce" toolbar
2676
  var wptbBuilderPanel = document.getElementsByClassName('wptb-builder-panel')[0];
2677
+ wptbBuilderPanel.onclick = function (e) {
2678
  if (!e.target.classList.contains('wptb-ph-element') && !WPTB_Helper.findAncestor(e.target, 'wptb-ph-element') && !e.target.classList.contains('wptb-fixed-toolbar') && !WPTB_Helper.findAncestor(e.target, 'wptb-fixed-toolbar')) {
2679
+ clickOnFreeSpace();
 
 
 
 
 
 
2680
  }
2681
+ };
2682
+
2683
+ var wptbHeader = document.getElementsByClassName('wptb-header');
2684
+ if (wptbHeader.length > 0) wptbHeader = wptbHeader[0];
2685
+ wptbHeader.onclick = function () {
2686
+ clickOnFreeSpace();
2687
+ };
2688
+
2689
+ function clickOnFreeSpace() {
2690
+ document.getElementsByClassName('wptb-elements-container')[0].style.display = 'table';
2691
+ document.getElementsByClassName('wptb-settings-section')[0].style.display = 'block';
2692
+ document.getElementById('element-options-group').style.display = 'none';
2693
+ var wpcdFixedToolbar = document.getElementById('wpcd_fixed_toolbar');
2694
+ if (wpcdFixedToolbar.hasAttribute('data-toolbar-active-id')) {
2695
+ document.getElementById(wpcdFixedToolbar.getAttribute('data-toolbar-active-id')).classList.remove('toolbar-active');
2696
+ }
2697
+ }
2698
  };
2699
  var WPTB_List = function WPTB_List(innerElements, DOMElementProt) {
2700
 
2773
  }
2774
 
2775
  DOMElement.onmouseenter = function (event) {
2776
+ var wptbActionsField = new WPTB_ActionsField();
2777
 
2778
+ wptbActionsField.addActionField(2, DOMElement);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2779
 
2780
+ wptbActionsField.setParameters(DOMElement);
2781
+ console.log(DOMElement);
2782
  };
2783
 
2784
  DOMElement.onmouseleave = function (event) {
2785
+ var wptbActionsField = new WPTB_ActionsField();
2786
+
2787
+ wptbActionsField.leaveFromField(event, DOMElement, 2);
2788
+
2789
+ return false;
 
2790
  };
2791
 
2792
  this.getDOMElement = function () {
2957
  };
2958
  };
2959
 
2960
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
2961
+ var wptbUndo = document.getElementsByClassName('wptb-undo');
2962
+ if (wptbUndo.length > 0) {
2963
+ wptbUndo = wptbUndo[0];
2964
+
2965
+ wptbUndo.onclick = function (event) {
2966
+ if (!this.classList.contains('wptb-undoredo-disabled')) {
2967
+ wptbTableStateSaveManager.tableStateGet(this.dataset.wptbUndoredo);
2968
+ var wptbUndoRedoContainer = document.getElementsByClassName('wptb-undo-redo-container');
2969
+ if (wptbUndoRedoContainer.length > 0) {
2970
+ wptbUndoRedoContainer = wptbUndoRedoContainer[0];
2971
+ wptbUndoRedoContainer.onmouseleave = function (event) {
2972
+ event.target.onmouseleave = '';
2973
+ WPTB_Table();
2974
+ };
2975
+ }
2976
+ }
2977
+ };
2978
+ }
2979
+
2980
+ var wptbRedo = document.getElementsByClassName('wptb-redo');
2981
+ if (wptbRedo.length > 0) {
2982
+ wptbRedo = wptbRedo[0];
2983
+
2984
+ wptbRedo.onclick = function (event) {
2985
+ if (!this.classList.contains('wptb-undoredo-disabled')) {
2986
+ wptbTableStateSaveManager.tableStateGet(this.dataset.wptbUndoredo);
2987
+ var wptbUndoRedoContainer = document.getElementsByClassName('wptb-undo-redo-container');
2988
+ if (wptbUndoRedoContainer.length > 0) {
2989
+ wptbUndoRedoContainer = wptbUndoRedoContainer[0];
2990
+ wptbUndoRedoContainer.onmouseleave = function (event) {
2991
+ event.target.onmouseleave = '';
2992
+ WPTB_Table();
2993
+ };
2994
+ }
2995
+ }
2996
+ };
2997
+ }
2998
+
2999
  var shortcodePopupWindow = document.getElementsByClassName('wptb-popup-window-modal')[0];
3000
  document.getElementsByClassName('wptb-embed-btn')[0].onclick = function () {
3001
  if (!this.classList.contains('wptb-button-disable')) {
3196
 
3197
  if (innerElements.length > 0) {
3198
  for (var j = 0; j < innerElements.length; j++) {
 
3199
 
3200
  var mceContentBodys = innerElements[j].querySelectorAll('.mce-content-body');
3201
  if (mceContentBodys.length > 0) {
3587
  var noCells = document.getElementsByClassName('wptb-no-cell-action'),
3588
  singleCells = document.getElementsByClassName('wptb-single-action'),
3589
  multipleCells = document.getElementsByClassName('wptb-multiple-select-action'),
3590
+ cellSettings = document.getElementById('wptb-left-scroll-panel-cell-settings'),
3591
  tds = table.getElementsByClassName('wptb-highlighted');
3592
  while (tds.length) {
3593
  tds[0].classList.remove('wptb-highlighted');
3594
  }
3595
+ cellSettings.classList.remove('visible');
3596
  for (var i = 0; i < array.length; i++) {
3597
  for (var j = 0; j < array[i].length; j++) {
3598
  array[i][j] = 0;
3772
  cellModeBackground.classList.remove('visible');
3773
  leftScrollPanelCurtain.classList.remove('visible');
3774
  leftScrollPanelCellSettings.classList.remove('visible');
3775
+ wptbPreviewTable.parentNode.classList.remove('wptb-preview-table-manage-cells');
3776
  var wptbPreviewTableTds = wptbPreviewTable.getElementsByTagName('td');
3777
  if (wptbPreviewTableTds.length > 0) {
3778
  for (var _i3 = 0; _i3 < wptbPreviewTableTds.length; _i3++) {
3784
  bar[_i2].classList.add('visible');
3785
  cellModeBackground.classList.add('visible');
3786
  leftScrollPanelCurtain.classList.add('visible');
3787
+ wptbPreviewTable.parentNode.classList.add('wptb-preview-table-manage-cells');
3788
  }
3789
  }
3790
  }
4221
  table.addRowHeight();
4222
  WPTB_Helper.dataTitleColumnSet(table);
4223
  undoSelect();
4224
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
4225
+ wptbTableStateSaveManager.tableStateSet();
4226
  };
4227
 
4228
  /*
4264
  table.addRowHeight();
4265
  WPTB_Helper.dataTitleColumnSet(table);
4266
  undoSelect();
4267
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
4268
+ wptbTableStateSaveManager.tableStateSet();
4269
  };
4270
 
4271
  /*
4364
  table.addRowHeight();
4365
  WPTB_Helper.dataTitleColumnSet(table);
4366
  undoSelect();
4367
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
4368
+ wptbTableStateSaveManager.tableStateSet();
4369
  }
4370
  };
4371
 
4422
  table.addColumnWidth();
4423
  WPTB_Helper.dataTitleColumnSet(table);
4424
  undoSelect();
4425
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
4426
+ wptbTableStateSaveManager.tableStateSet();
4427
  };
4428
 
4429
  /*
4461
  table.addColumnWidth();
4462
  WPTB_Helper.dataTitleColumnSet(table);
4463
  undoSelect();
4464
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
4465
+ wptbTableStateSaveManager.tableStateSet();
4466
  };
4467
 
4468
  /*
4569
  table.addColumnWidth();
4570
  WPTB_Helper.dataTitleColumnSet(table);
4571
  undoSelect();
4572
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
4573
+ wptbTableStateSaveManager.tableStateSet();
4574
  };
4575
 
4576
  /*
4699
  }
4700
  WPTB_Helper.dataTitleColumnSet(table);
4701
  undoSelect();
4702
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
4703
+ wptbTableStateSaveManager.tableStateSet();
4704
  };
4705
 
4706
  /*
4766
  table.addRowHeight();
4767
  WPTB_Helper.dataTitleColumnSet(table);
4768
  undoSelect();
4769
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
4770
+ wptbTableStateSaveManager.tableStateSet();
 
 
4771
  };
4772
 
4773
  /*
4924
  table.recalculateIndexes();
4925
  WPTB_Helper.dataTitleColumnSet(table);
4926
  }
4927
+
4928
  undoSelect();
4929
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
4930
+ wptbTableStateSaveManager.tableStateSet();
4931
  };
4932
 
4933
  /*
4981
  table.tdDefaultWidth();
4982
  WPTB_Helper.dataTitleColumnSet(table);
4983
  }
4984
+
4985
  undoSelect();
4986
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
4987
+ wptbTableStateSaveManager.tableStateSet();
4988
  };
4989
 
4990
  document.getElementsByClassName('wptb-table-generator')[0].style.display = 'none';
5041
  // }, false );
5042
  // }
5043
  };
5044
+ var WPTB_TableStateSaveManager = function WPTB_TableStateSaveManager() {
5045
+ this.tableStateSet = function () {
5046
+ // get preview table
5047
+ var wptbPreviewTable = document.getElementsByClassName('wptb-preview-table');
5048
+ if (wptbPreviewTable.length > 0) {
5049
+ wptbPreviewTable = wptbPreviewTable[0];
5050
+
5051
+ // check if a global array doesn't exist with saved versions of the table
5052
+ // them create it
5053
+ if (!window.wptbTableStateSaving) {
5054
+ window.wptbTableStateSaving = [];
5055
+ }
5056
+
5057
+ // remove the extra part of the array after changing the table
5058
+ // when it is showed in the not last modified version
5059
+ if (window.wptbTableStateSaving.length > window.wptbTableStateNumberShow + 1) {
5060
+ window.wptbTableStateSaving = window.wptbTableStateSaving.slice(0, window.wptbTableStateNumberShow + 1);
5061
+ }
5062
+
5063
+ //add new state of table
5064
+ var wptbNewPreviewTable = wptbPreviewTable.cloneNode(true);
5065
+ var wptbHighlighted = wptbNewPreviewTable.getElementsByClassName('wptb-highlighted');
5066
+ for (var i = 0; i < wptbHighlighted.length; i++) {
5067
+ wptbHighlighted[i].classList.remove('wptb-highlighted');
5068
+ }
5069
+ var wptbDirectlyhovered = wptbNewPreviewTable.getElementsByClassName('wptb-directlyhovered');
5070
+ for (var _i = 0; _i < wptbDirectlyhovered.length; _i++) {
5071
+ wptbDirectlyhovered[_i].classList.remove('wptb-directlyhovered');
5072
+ }
5073
+
5074
+ var cssForTdsWidthAutoValue = '';
5075
+ var head = document.head;
5076
+ if (head) {
5077
+ var cssForTdsWidthAuto = head.querySelector('style[data-wptb-td-auto-width="true"]');
5078
+ if (cssForTdsWidthAuto) {
5079
+ cssForTdsWidthAutoValue = cssForTdsWidthAuto.innerHTML;
5080
+ }
5081
+ }
5082
+
5083
+ var mceContentBodys = wptbNewPreviewTable.querySelectorAll('.mce-content-body');
5084
+ if (mceContentBodys.length > 0) {
5085
+ for (var k = 0; k < mceContentBodys.length; k++) {
5086
+ mceContentBodys[k].classList.remove('mce-content-body');
5087
+ }
5088
+ }
5089
+
5090
+ var dataMceStyle = wptbNewPreviewTable.querySelectorAll('[data-mce-style]');
5091
+ if (dataMceStyle.length > 0) {
5092
+ for (var _k = 0; _k < dataMceStyle.length; _k++) {
5093
+ dataMceStyle[_k].removeAttribute('data-mce-style');
5094
+ }
5095
+ }
5096
+
5097
+ var mceIds = wptbNewPreviewTable.querySelectorAll('[id^=mce_]');
5098
+ if (mceIds.length > 0) {
5099
+ for (var _k2 = 0; _k2 < mceIds.length; _k2++) {
5100
+ mceIds[_k2].removeAttribute('id');
5101
+ }
5102
+ }
5103
+
5104
+ window.wptbTableStateSaving.push([wptbNewPreviewTable, cssForTdsWidthAutoValue]);
5105
+
5106
+ // set new number of state which is showed now
5107
+ window.wptbTableStateNumberShow = window.wptbTableStateSaving.length - 1;
5108
+
5109
+ // make undo arrow active when the table was changed
5110
+ if (window.wptbTableStateSaving.length > 1) {
5111
+ var wptbUndo = document.getElementsByClassName('wptb-undo');
5112
+ if (wptbUndo.length > 0) {
5113
+ wptbUndo = wptbUndo[0];
5114
+
5115
+ wptbUndo.classList.remove('wptb-undoredo-disabled');
5116
+ }
5117
+ }
5118
+
5119
+ // make redo arrow not active when the table was changed
5120
+ var wptbRedo = document.getElementsByClassName('wptb-redo');
5121
+ if (wptbRedo.length > 0) {
5122
+ wptbRedo = wptbRedo[0];
5123
+
5124
+ wptbRedo.classList.add('wptb-undoredo-disabled');
5125
+ }
5126
+ }
5127
+ };
5128
+
5129
+ this.tableStateGet = function (datawptbUndoredo) {
5130
+ if (datawptbUndoredo && window.wptbTableStateSaving && window.wptbTableStateSaving.length > 1) {
5131
+
5132
+ // changes the number of the state which displays now
5133
+ if (datawptbUndoredo == 'undo') {
5134
+ if (window.wptbTableStateNumberShow > 0) {
5135
+ window.wptbTableStateNumberShow--;
5136
+ } else {
5137
+ return false;
5138
+ }
5139
+ } else if (datawptbUndoredo == 'redo') {
5140
+ if (window.wptbTableStateNumberShow < window.wptbTableStateSaving.length - 1) {
5141
+ window.wptbTableStateNumberShow++;
5142
+ } else {
5143
+ return false;
5144
+ }
5145
+ }
5146
+
5147
+ // add or delete class "wptb-undoredo-disabled" for undo button
5148
+ var wptbUndo = document.getElementsByClassName('wptb-undo');
5149
+ if (wptbUndo.length > 0) {
5150
+ wptbUndo = wptbUndo[0];
5151
+ }
5152
+ if (window.wptbTableStateNumberShow == 0) {
5153
+ if (wptbUndo) {
5154
+ wptbUndo.classList.add('wptb-undoredo-disabled');
5155
+ }
5156
+ } else if (window.wptbTableStateNumberShow > 0) {
5157
+ if (wptbUndo) {
5158
+ wptbUndo.classList.remove('wptb-undoredo-disabled');
5159
+ }
5160
+ }
5161
+
5162
+ // add or delete class "wptb-undoredo-disabled" for redo button
5163
+ var wptbRedo = document.getElementsByClassName('wptb-redo');
5164
+ if (wptbRedo.length > 0) {
5165
+ wptbRedo = wptbRedo[0];
5166
+ }
5167
+ if (window.wptbTableStateNumberShow == window.wptbTableStateSaving.length - 1) {
5168
+ if (wptbRedo) {
5169
+ wptbRedo.classList.add('wptb-undoredo-disabled');
5170
+ }
5171
+ } else if (window.wptbTableStateNumberShow < window.wptbTableStateSaving.length - 1) {
5172
+ if (wptbRedo) {
5173
+ wptbRedo.classList.remove('wptb-undoredo-disabled');
5174
+ }
5175
+ }
5176
+
5177
+ // load necessary saved table state
5178
+ var wptbTableSetup = document.getElementsByClassName('wptb-table-setup');
5179
+ if (wptbTableSetup.length > 0) {
5180
+ wptbTableSetup = wptbTableSetup[0];
5181
+
5182
+ wptbTableSetup.innerHTML = '';
5183
+ wptbTableSetup.appendChild(window.wptbTableStateSaving[window.wptbTableStateNumberShow][0]);
5184
+
5185
+ if (window.wptbTableStateSaving[window.wptbTableStateNumberShow][1]) {
5186
+ var cssForTdsWidthAuto = document.createElement('style');
5187
+ cssForTdsWidthAuto.setAttribute('data-wptb-td-auto-width', true);
5188
+ cssForTdsWidthAuto.innerHTML = window.wptbTableStateSaving[window.wptbTableStateNumberShow][1];
5189
+ var head = document.head;
5190
+ if (head) {
5191
+ var cssForTdsWidthAutoOld = head.querySelector('style[data-wptb-td-auto-width="true"]');
5192
+ if (cssForTdsWidthAutoOld) {
5193
+ head.removeChild(cssForTdsWidthAutoOld);
5194
+ }
5195
+ head.appendChild(cssForTdsWidthAuto);
5196
+ }
5197
+ }
5198
+
5199
+ WPTB_Helper.settingsPanelClear();
5200
+ WPTB_Helper.elementOptionsPanelClear();
5201
+ WPTB_LeftPanel();
5202
+
5203
+ var wptbLeftScrollPanelCellSetting = document.getElementById('wptb-left-scroll-panel-cell-settings');
5204
+ if (wptbLeftScrollPanelCellSetting) {
5205
+ wptbLeftScrollPanelCellSetting.classList.remove('visible');
5206
+ }
5207
+ }
5208
+ }
5209
+ };
5210
+ };
5211
  function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
5212
 
5213
  var WPTB_Text = function WPTB_Text(text, DOMElementProt) {
inc/admin/js/admin.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["applyGenericItemSettings.js","wptb-builder.js","WPTB_Builder.js","WPTB_Button.js","WPTB_Cell.js","WPTB_DropHandle.js","WPTB_ElementCounters.js","WPTB_ElementOptions.js","WPTB_Helper.js","WPTB_Image.js","WPTB_Initializer.js","WPTB_innerElementSet.js","WPTB_LeftPanel.js","WPTB_List.js","WPTB_ListItem.js","WPTB_MultipleSelect.js","WPTB_Parser.js","WPTB_Parser2.js","WPTB_Settings.js","WPTB_Space.js","WPTB_Stringifier.js","WPTB_Stringifier2.js","WPTB_Table.js","WPTB_Text.js"],"names":["applyGenericItemSettings","element","kindIndexProt","copy","node","getDOMElement","index","listItems","undefined","document","counter","nextIndex","kind","wptbElements","getElementsByClassName","elementIndexesArr","i","length","regex","RegExp","infArr","className","match","push","elementIndexMax","Math","max","split","onmouseenter","event","classList","add","btnDelete","createElement","btnCopy","btnMove","actions","draggable","onclick","act","parentNode","el","removeChild","thisRow","contains","table","WPTB_Helper","findAncestor","dataTitleColumnSet","td","target","temp","srcList","querySelectorAll","innerHTML","WPTB_List","insertBefore","nextSibling","WPTB_Text","childNodes","WPTB_Image","children","src","text","querySelector","WPTB_Button","WPTB_innerElementSet","parent","type","dragImagesArr","ondragstart","style","opacity","remove","dataTransfer","setDragImage","setData","a","e","preventDefault","buttonsTinyMceInit","tinyMCE","init","inline","plugins","dialog_type","theme","menubar","fixed_toolbar_container","paste_as_text","toolbar","setup","ed","on","row","init_instance_callback","editor","window","currentEditor","totalWidth","offsetWidth","getElementById","scrollTop","bodyElement","display","position","right","top","listItemsTinyMceInit","appendChild","onmouseleave","iter","observer","MutationObserver","mutations","config","attributes","attributeFilter","observe","node_wptb_element_kind_num","WPTB_ElementOptions","increment","WPTB_Builder","table_id","detectMode","http","XMLHttpRequest","urlSet","ajaxurl","open","setRequestHeader","onreadystatechange","d","readyState","status","ans","JSON","parse","responseText","value","wptbTableSetupEl","WPTB_Parser","WPTB_Table","WPTB_LeftPanel","WPTB_Settings","send","ElementCounters","select","MultipleSelect","initializer","WPTB_Initializer","settings","addEventListener","DOMElementProt","DOMElement","elButton","el_B","el_BDiv","wptbElementMutch","Array","isArray","attributesContainer","setAttribute","name","wptbButtonWrapper","wptbButtonWrapAttributes","wptbButton","wptbButtonAttributes","WPTB_Cell","callback","highlightRow","parentRow","columnCount","parseInt","tds","getElementsByTagName","classToAdd","ttd","highlightColumn","rowCount","tr","padding","jQuery","val","innerBorderWidth","border","wptbPhElement","wptbSpaceBetween","j","WPTB_Space","wptbElementTypeClass","wptbTypeElementArr","wptbListItems","WPTB_ListItem","setCoords","y","x","dataset","yIndex","xIndex","getCoords","coords","appendElement","getCellDimensions","tdStyleObj","getComputedStyle","tdPaddingLeft","getPropertyValue","tdPaddingRight","tdBorderLeftWidth","tdBorderRightWidth","tdPaddingTop","tdPaddingBottom","tdBorderTopWidth","tdBorderBottomWidth","width","parseFloat","height","offsetHeight","WPTB_DropHandle","thisElem","newElementProxy","includes","wptbDropHandle","wptbDropBorderMarker","wptbDropBorderMarkerTop","wptbDropBorderMarkerRight","wptbDropBorderMarkerBottom","wptbDropBorderMarkerLeft","body","ondragenter","ondragover","ondragleave","ondrop","getData","getDOMParentElement","nodeName","toLowerCase","innerElement","innerElementNext","wptbContainer","onscroll","localName","indics","types","notDragEnter","coordinatesElement","getBoundingClientRect","left","Number","indexOf","elementDrag","offsetY","layerY","bottom","priv","key","elemIdClass","prop","cloneNode","properties","affectedEl","wptbButtonA","wptbSize","b","buttonAlignment","justifyContent","buttonAlignmentSelect","selectOption","selectOptionVal","selected","buttonHref","getAttribute","buttonLinkTarget","buttonId","buttonHrefInput","buttonLinkTargetInput","buttonLinkTargetInputId","buttonLinkTargetInputLabel","buttotIdInput","checked","buttonTextColor","color","buttonColor","backgroundColor","buttonTextColorInput","buttonBackgroundColorInput","rgbToHex","elementsA","aTextAlign","textAlign","imageAlignmentSelect","imageLinkHref","inputImageLink","imageLinkTarget","imageLinkTargetInput","imageLinkTargetInputId","imageLinkTargetInputLabel","img","imgWidth","imageWidthInputRange","imageWidthInputNumber","imgAlternativeText","imageAlternativeTextInput","elementFontSize","fontSize","elementTextColor","textFontSizeInputRange","textFontSizeInputNumber","textColorInput","elementList","elementListColor","listColorInput","elementListItem","listItemP","listItemPClasses","elementListClassSelect","listIconSelectLabel","nodeType","listIconSelectLabelId","elementListStyleTypeSelect","elementListItemContent","listItemPTextAlignArr","p","listItemPTextAlignLeftCount","listItemPTextAlignCenterCount","listItemPTextAlignRightCount","elementListAlignmentSelect","maxListItemTAlLeftC","optionsClass","buttons","size","n_Class","num","optionControls","wpColorPicker","change","ui","classe","ps","number","toString","slider","oninput","onchange","alt","href","linkHttpCheckChange","rel","removeAttribute","jc","id","parentNodeSettingItem","listItem","hexToRgb","hex","result","exec","rgb","slice","getDragImageCustom","hostName","location","protocol","hostname","image","button","list","listItemsRecalculateIndex","ulElem","par","listStyleTypeIndex","article","keyCode","duplicate","firstChild","innerText","pText","replace","trim","selectedText","getSelectionText","link","linkArr","linkClean","rows","rowHead","computedStyleRowHead","rowHeadChildren","contentsForHeader","tdElements","textContent","thisRowChildren","wptbTitleColumn","wptbTitleColumnFontSize","wptbTitleColumnColor","wptbTitleBackgroundColor","wptbTitleAlign","cls","parentElement","txt","getSelection","selection","createRange","settingsPanelClear","wpColorPickerClear","inputId","input","wpPickerContainer","newInput","url","results","decodeURIComponent","getColumnWidth","cell","xIndexes","cellWidth","getRowHeight","yIndexes","cellHeight","elImage","anchor","file_frame","wp","media","frames","title","multiple","attachment","state","get","first","toJSON","MIN_COLUMNS","MIN_ROWS","MAX_COLUMNS","MAX_ROWS","tableGenerator","columnsDecrementButton","columnsIncrementButton","rowsDecrementButton","rowsIncrementButton","columnsInput","rowsInput","columns","div","classId","stopPropagation","onmouseover","wptbElementButtons","wptbTdBgColorSavedSet","trNumber","tableRows","trBackgroundColor","wptbEvenRowBg","clear","tableHeader","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","numberImputSize","wptbNumberInputs","maxCount","maxValue","onkeydown","thisValue","String","substring","onkeyup","wptbTableBorderNumber","wptbTextfontSizeNumber","wptbImageWidthNumber","wptbTableColumnWidthNumber","wptbTableRowHeightNumber","tdDefaultWidth","wptbInnerBorderCheck","tableBorderColorSetArea","addColumnWidth","highlighted","addRowHeight","createMobileHeadForTable","thisEvent","wptbElement","toggleTableEditMode","addRowToTheEnd","addRowToTheStart","addRowBefore","addRowAfter","addColumnEnd","addColumnStart","addColumnBefore","addColumnAfter","deleteColumn","deleteRow","mergeCells","splitCell","wptbBuilderPanel","wpcdFixedToolbar","hasAttribute","innerElements","el_L","item","wptbListItemReturn","divcontent","styleDot","listItemKeyListener","previous","action","content","html","setTimeout","append","selectedCells","multipleCellMode","activateMultipleSelectMode","deactivateMultipleSelectMode","isActivated","pushSelectedCell","flushSelectedCells","getFirst","minXIndex","minYIndex","getLast","maxXIndex","maxYIndex","last","removeAllButFirst","code","columnTitleMobile","WPTB_Parser2","elementHtml","createTextNode","tagName","elems","effectAllowed","ondragend","shortcodePopupWindow","bar","wptb_admin_object","t","messagingArea","WPTB_Stringifier","outerHTML","messagingAreaText","params","security_code","rs","wptbId","stringify","data","wptbPreviewBtn","wptbPreviewBtnHref","previewHref","elSpaceBetween","spaceBetween","t_space","spaceParent","alert","codeMain","tableColumns","minWidth","maxWidth","mceContentBodys","k","dataMceStyle","contentEditable","spellCheck","mceIds","wptbActions","wptbActionsLength","columnNameDivContainer","columnNameDiv","WPTB_Stringifier2","start","nodeValue","int_elem_arr","attributes_list","internal_elements","inter_elem","array","wptbTableSetup","maxAmountOfCells","maxAmountOfRows","mark","rowSpan","cs","colSpan","markedCells","noCells","singleCells","multipleCells","cellSettings","column","cellHighlighted","wptbTableColumnWidthSlider","tableColumnWidthAutoFixedCheckbox","wptbFixedWidth","wptbTableRowHeightSlider","tableRowHeightAutoFixedCheckbox","wptbFixedHeight","isSquare","realTimeArray","carried","cols","matriz","items","justAssigned","amount","carriedRowspans","cellsBuffer","cellPointer","xPosition","stepsToMove","celda","drawTable","string","undoSelect","fillTableArray","colspansSums","cells","colspanSumInRow","apply","getActualPointsInRow","points","search","skipInCols","reconstraction","insertRow","wptb_preview_table","cellModeBackground","leftScrollPanelCurtain","leftScrollPanelCellSettings","wptbPreviewTableTds","recalculateIndexes","trs","maxCols","maxColsFull","tdsArr","jMainIter","z","cleaner","dataXIndex","tableTdsFor","colspan","widthIsSet","arrayTdsFromPreviousRow","tableTdsSumMaxWidth","tableTdsSumMaxWidthFixed","tableTdsSumMaxWidthAuto","wptbTableSetupWidth","arrayCellsWidthFixedHelper","arrayCellsWidthAutoHelper","tdPaddingCommon","tableTdBorderCommonWidth","cssForTdsWidthAuto","wptbCssTdAutoWidth","tableTdBorderLeftWidth","tableTdBorderRightWidth","CellsWidthAutoCount","tableFullStyleObj","borderLeftWidth","borderRightWidth","tableBorderCommon","wptbTableTdsSumMaxWidth","wptbCellsWidthAutoCount","mergingСellsHorizontally","wptbFixedWidthSize","styleElementCreate","tableTdWidthAuto","tableTdsWidthAutoCommon","head","cssForTdsWidthAutoOld","dataYIndex","rowspan","heightIsSet","arrayTdsPrevious","tableColumnHeightAutoFixedCheckbox","wptbAdaptiveTableChoseBlock","mergingCellsVertically","forBreak","currentTable","currentTableTd","currentTdStyle","firstCell","c_pos","cellStyle","pos","pendingInsertion","bro","currentCell","l","r","aux","from","cellNew","rowChildren","rowChildrenLength","cellRowSpan","rowAfter","cellsColSpan","tableRowsIChildren","tableRIChildrenLength","rowIRowSpan","rNext","rNextChildren","rNextChildrenLength","rowStart","columnStart","rowEnd","columnEnd","itemsEstimate","dimensions","call","tdsChildrenNew","tdsInternalElements","tdsIntElemLength","firstWidth","firstDataFixedWidth","firstHeight","firstDataFixedHeight","cellStyles","cellXIndex","rowChildInsertBefore","rowNext","wptbLeftScrollPanelCellSetting","findRowspannedCells","difference","actualPoints","addLackingCells","sumRows","totalColspan","nextRow","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aAAT,CAAuB,GAAvB,CAFV;AAAA,QAGI/B,gBAAgBM,SAHpB;AAAA,QAIIL,OAAO,KAJX;;AAMIuJ,eAAW5H,SAAX,CAAqBC,GAArB,CAA0B,qBAA1B;;AAEAkuB,QAAI3sB,SAAJ,GAAgBS,QAAQvD,SAAR,GAAoBuD,IAApB,GAA2B,MAA3C;AACAisB,YAAQnpB,WAAR,CAAoBopB,GAApB;AACAvmB,eAAW7C,WAAX,CAAuBmpB,OAAvB;AACJ,QAAKvmB,cAAL,EAAsB;AAClB,YAAIK,mBAAmBL,eAAepI,SAAf,CAAyBC,KAAzB,CAAgC,0BAAhC,CAAvB;AACA,YAAKwI,oBAAoBC,MAAMC,OAAN,CAAeF,gBAAf,CAAzB,EAA6D;AACzD5J,4BAAgB4J,iBAAiB,CAAjB,CAAhB;AACA3J,mBAAO,IAAP;AACH;;AAED,YAAIiH,0CAAiBqC,eAAerC,UAAhC,EAAJ;AACA,aAAK,IAAIpG,IAAI,CAAb,EAAgBA,IAAIoG,WAAWnG,MAA/B,EAAuCD,GAAvC,EAA6C;AACzC0I,uBAAWQ,YAAX,CAAwB9C,WAAWpG,CAAX,EAAcmJ,IAAtC,EAA4C/C,WAAWpG,CAAX,EAAc2H,KAA1D;AACH;AACJ;;AAED,SAAK/H,IAAL,GAAY,MAAZ;AACA,SAAKP,aAAL,GAAqB,YAAY;AAC7B,eAAOqJ,UAAP;AACH,KAFD;AAGA1J,6BAA0B,IAA1B,EAAgCE,aAAhC,EAA+CC,IAA/C;;AAEA,WAAO,IAAP;AACH,CAhCD","file":"admin.js","sourcesContent":["var applyGenericItemSettings = function ( element, kindIndexProt, copy = false ) {\r\n var node = element.getDOMElement(),\r\n index,\r\n listItems,\r\n copy;\r\n \r\n if ( kindIndexProt == undefined || copy == true ) {\r\n index = document.counter.nextIndex( element.kind );\r\n let wptbElements = document.getElementsByClassName( 'wptb-ph-element' );\r\n let elementIndexesArr = [];\r\n for( let i = 0; i < wptbElements.length; i++ ) {\r\n var regex = new RegExp( 'wptb-element-' + element.kind + '-(\\\\d+)', \"i\" );\r\n let infArr = wptbElements[i].className.match( regex );\r\n if( infArr ) {\r\n elementIndexesArr.push( infArr[1] );\r\n }\r\n }\r\n if( elementIndexesArr.length > 0 ) {\r\n let elementIndexMax = Math.max( ...elementIndexesArr );\r\n index = elementIndexMax + 1;\r\n } else { \r\n index = 1;\r\n }\r\n } else if ( kindIndexProt && ! copy ) {\r\n index = kindIndexProt.split('-')[1];\r\n }\r\n \r\n node.onmouseenter = function (event) {\r\n this.classList.add('wptb-directlyhovered');\r\n let btnDelete = document.createElement( 'span' ),\r\n btnCopy = document.createElement( 'span' ),\r\n btnMove = document.createElement( 'span' ),\r\n actions = document.createElement( 'span' ), i;\r\n\r\n actions.classList.add('wptb-actions');\r\n btnDelete.classList.add('dashicons', 'dashicons-trash', 'wptb-delete-action');\r\n btnCopy.classList.add('dashicons', 'dashicons-admin-page', 'wptb-duplicate-action');\r\n btnMove.classList.add(\"dashicons\", \"dashicons-move\", 'wptb-move-action');\r\n btnMove.draggable = true;\r\n btnDelete.onclick = function (event) {\r\n let act = this.parentNode.parentNode,\r\n el = act.parentNode;\r\n el.removeChild(act);\r\n \r\n if( act.kind == 'text' ) {\r\n let thisRow = el.parentNode\r\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\r\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n }\r\n \r\n };\r\n btnCopy.onclick = function (event) {\r\n let copy;\r\n if (element.kind == 'list') {\r\n var td = event.target.parentNode.parentNode.parentNode,\r\n temp = [],\r\n srcList = event.target.parentNode.parentNode.querySelectorAll('ul li .wptb-list-item-content');\r\n\r\n for (var i = 0; i < srcList.length; i++) {\r\n temp.push(srcList[i].innerHTML);\r\n }\r\n\r\n copy = new WPTB_List( temp, node );\r\n\r\n node.parentNode.insertBefore( copy.getDOMElement(), node.nextSibling );\r\n } else if (element.kind == 'text') {\r\n var td = event.target.parentNode.parentNode.parentNode;\r\n copy = new WPTB_Text(event.target.parentNode.parentNode.childNodes[0].innerHTML, node);\r\n\r\n node.parentNode.insertBefore( copy.getDOMElement(), node.nextSibling );\r\n } else if ( element.kind == 'image' ) {\r\n var td = event.target.parentNode.parentNode.parentNode;\r\n copy = new WPTB_Image( event.target.parentNode.parentNode.children[0].children[0].src, node );\r\n\r\n node.parentNode.insertBefore( copy.getDOMElement(), node.nextSibling );\r\n } else {\r\n var td = event.target.parentNode.parentNode.parentNode,\r\n text = event.target.parentNode.parentNode.childNodes[0].querySelector( 'p' ).innerHTML;\r\n copy = new WPTB_Button( text, node );\r\n\r\n node.parentNode.insertBefore( copy.getDOMElement(), node.nextSibling );\r\n }\r\n \r\n WPTB_innerElementSet( copy.getDOMElement() );\r\n };\r\n let parent = this,\r\n infArr,\r\n type;\r\n infArr = parent.className.match(/wptb-element-(.+)-(\\d+)/i);\r\n type = infArr[1];\r\n let dragImagesArr = WPTB_Helper.dragImagesArr();\r\n btnMove.ondragstart = function (event) {\r\n this.parentNode.style.opacity = 0;\r\n parent.classList.remove( 'wptb-directlyhovered' );\r\n parent.classList.add( 'wptb-moving-mode' );\r\n \r\n event.dataTransfer.setDragImage( dragImagesArr[type], 0, 0 );\r\n event.dataTransfer.setData( 'node', 'wptb-element-' + infArr[1] + '-' + infArr[2] );\r\n event.dataTransfer.setData( 'wptb-moving-mode', 'wptb-element-' + infArr[1] + '-' + infArr[2] );\r\n event.dataTransfer.setData( 'wptbElIndic-' + infArr[1], 'wptbElIndic-' + infArr[1] );\r\n let act = event.target.parentNode.parentNode;\r\n if( act.kind == 'text' ) {\r\n let thisRow = el.parentNode\r\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\r\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n }\r\n };\r\n\r\n if (element.kind === 'button') {\r\n let a = node.querySelector( 'a' ),\r\n target = a.querySelector( 'div' );\r\n a.onclick = function( e ) {\r\n e.preventDefault();\r\n }\r\n WPTB_Helper.buttonsTinyMceInit( target );\r\n } else if (element.kind === 'text') {\r\n tinyMCE.init({\r\n target: node.childNodes[0],\r\n inline: true,\r\n plugins: \"link, paste\",\r\n dialog_type: \"modal\",\r\n theme: 'modern',\r\n menubar: false,\r\n fixed_toolbar_container: '#wpcd_fixed_toolbar',\r\n paste_as_text: true,\r\n toolbar: 'bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify',\r\n setup : function( ed ) {\r\n ed.on( 'change', function(e) {\r\n let row = WPTB_Helper.findAncestor( node, 'wptb-row' );\r\n if( row.classList.contains( 'wptb-table-head' ) ) {\r\n let table = WPTB_Helper.findAncestor( row, 'wptb-preview-table' );\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n });\r\n },\r\n init_instance_callback: function (editor) {\r\n window.currentEditor = editor;\r\n //editor.fire('focus');\r\n editor.on('focus', function (e) {\r\n var totalWidth = document.getElementsByClassName('wptb-builder-panel')[0].offsetWidth;\r\n if (window.currentEditor &&\r\n document.getElementById('wptb_builder').scrollTop >= 55 &&\r\n window.currentEditor.bodyElement.style.display != 'none') {\r\n document.getElementById('wpcd_fixed_toolbar').style.position = 'fixed';\r\n document.getElementById('wpcd_fixed_toolbar').style.right = (totalWidth / 2 - document.getElementById('wpcd_fixed_toolbar').offsetWidth / 2) + 'px';\r\n document.getElementById('wpcd_fixed_toolbar').style.top = '100px';\r\n } else {\r\n document.getElementById('wpcd_fixed_toolbar').style.position = 'static';\r\n delete document.getElementById('wpcd_fixed_toolbar').style.right;\r\n delete document.getElementById('wpcd_fixed_toolbar').style.top;\r\n }\r\n });\r\n }\r\n });\r\n \r\n } else {\r\n listItems = node.getElementsByClassName( 'wptb-list-item-content' );\r\n for ( let i = 0; i < listItems.length; i++ ) {\r\n WPTB_Helper.listItemsTinyMceInit( listItems[i] );\r\n }\r\n }\r\n\r\n actions.appendChild(btnMove);\r\n actions.appendChild(btnCopy);\r\n actions.appendChild(btnDelete);\r\n this.appendChild( actions );\r\n };\r\n\r\n node.onmouseleave = function ( event ) {\r\n this.classList.remove( 'wptb-directlyhovered' );\r\n let iter = 0;\r\n while( event.target.querySelector( '.wptb-actions' ) && iter < 5 ) {\r\n event.target.querySelector( '.wptb-actions' ).remove();\r\n iter++;\r\n }\r\n };\r\n \r\n // Change data-title-column if the title was changed\r\n if( element.kind == 'text' ) {\r\n var observer = new MutationObserver( function( mutations ) {\r\n let row = WPTB_Helper.findAncestor( node, 'wptb-row' );\r\n if( row.classList.contains( 'wptb-table-head' ) ) {\r\n let table = WPTB_Helper.findAncestor( row, 'wptb-preview-table' );\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n });\r\n var config = { attributes: true, attributeFilter: ['style'] };\r\n observer.observe( element.getDOMElement(), config );\r\n }\r\n\r\n let node_wptb_element_kind_num = node.className.match(/wptb-element-(.+)-(\\d+)/i);\r\n if ( node_wptb_element_kind_num ) {\r\n node.classList.remove( node_wptb_element_kind_num[0] );\r\n }\r\n if ( ! node.classList.contains( 'wptb-ph-element' ) ) {\r\n node.classList.add( 'wptb-ph-element' );\r\n if( ! node.classList.contains( 'wptb-element-' + element.kind + '-' + index ) ) {\r\n node.classList.add( 'wptb-element-' + element.kind + '-' + index );\r\n }\r\n } else {\r\n if( ! node.classList.contains( 'wptb-element-' + element.kind + '-' + index ) ) {\r\n node.classList.add( 'wptb-element-' + element.kind + '-' + index );\r\n }\r\n }\r\n new WPTB_ElementOptions( element, index, kindIndexProt );\r\n\r\n document.counter.increment(element.kind);\r\n};","","(function () {\r\n var WPTB_Builder = function () {\r\n var table_id = WPTB_Helper.detectMode();\r\n if ( table_id ) {\r\n var http = new XMLHttpRequest(),\r\n urlSet = ajaxurl + \"?action=get_table\" + '&id=' + table_id;\r\n http.open('GET', urlSet, true);\r\n http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');\r\n http.onreadystatechange = function (d) {\r\n if (this.readyState == 4 && this.status == 200) {\r\n var ans = JSON.parse(http.responseText);\r\n document.getElementById('wptb-setup-name').value = ans[0];\r\n \r\n if( ans[1] ) {\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'none';\r\n let wptbTableSetupEl = document.getElementsByClassName('wptb-table-setup')[0];\r\n wptbTableSetupEl.appendChild( WPTB_Parser( ans[1] ) );\r\n WPTB_Table();\r\n WPTB_LeftPanel();\r\n WPTB_Settings();\r\n } else {\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\r\n }\r\n \r\n return;\r\n }\r\n };\r\n http.send(null);\r\n } else {\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\r\n }\r\n document.counter = new ElementCounters();\r\n document.select = new MultipleSelect();\r\n\r\n var initializer = WPTB_Initializer();\r\n settings = WPTB_Settings();\r\n };\r\n\r\n document.addEventListener('DOMContentLoaded', WPTB_Builder);\r\n})();","var WPTB_Button = function( text, DOMElementProt ) {\r\n \r\n var DOMElement = document.createElement('div'),\r\n elButton = document.createElement('div'),\r\n el_B = document.createElement('a'),\r\n el_BDiv = document.createElement( 'div' ),\r\n kindIndexProt = undefined,\r\n copy = false;\r\n\r\n DOMElement.classList.add('wptb-button-container', 'wptb-size-M', 'wptb-');\r\n elButton.classList.add('wptb-button-wrapper');\r\n el_BDiv.classList.add('wptb-button');\r\n el_BDiv.innerHTML = text != undefined ? text : 'Button Text';\r\n \r\n // Creation of a new button when copying to avoid errors when assigning new event handlers.\r\n if ( DOMElementProt ) {\r\n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\r\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\r\n kindIndexProt = wptbElementMutch[1];\r\n copy = true;\r\n }; \r\n var attributesContainer = [...DOMElementProt.attributes];\r\n if ( attributesContainer.length > 0 ) {\r\n for( let i = 0; i < attributesContainer.length; i++ ) {\r\n DOMElement.setAttribute(attributesContainer[i].name, attributesContainer[i].value);\r\n } \r\n }\r\n \r\n var wptbButtonWrapper = DOMElementProt.querySelector( '.wptb-button-wrapper' );\r\n if ( wptbButtonWrapper ) {\r\n var wptbButtonWrapAttributes = [...wptbButtonWrapper.attributes];\r\n if ( wptbButtonWrapAttributes.length > 0 ) {\r\n for( let i = 0; i < wptbButtonWrapAttributes.length; i++ ) {\r\n if ( wptbButtonWrapAttributes[i].name == 'style') {\r\n elButton.setAttribute( wptbButtonWrapAttributes[i].name, wptbButtonWrapAttributes[i].value );\r\n }\r\n } \r\n }\r\n }\r\n \r\n var wptbButton = DOMElementProt.querySelector( 'a' );\r\n if ( wptbButton ) {\r\n var wptbButtonAttributes = [...wptbButton.attributes];\r\n if ( wptbButtonAttributes.length > 0 ) {\r\n for( let i = 0; i < wptbButtonAttributes.length; i++ ) {\r\n if ( wptbButtonAttributes[i].name == 'style' || \r\n wptbButtonAttributes[i].name == 'href' || \r\n wptbButtonAttributes[i].name == 'target' ) {\r\n el_B.setAttribute( wptbButtonAttributes[i].name, wptbButtonAttributes[i].value );\r\n }\r\n } \r\n }\r\n }\r\n }\r\n \r\n elButton.appendChild(el_B);\r\n el_B.appendChild( el_BDiv );\r\n DOMElement.appendChild(elButton);\r\n \r\n \r\n \r\n this.kind = 'button';\r\n\r\n this.getDOMElement = function () {\r\n return DOMElement;\r\n };\r\n\r\n applyGenericItemSettings( this, kindIndexProt, copy );\r\n\r\n return this;\r\n};","var WPTB_Cell = function (callback, DOMElement) {\r\n\r\n function highlightRow(td) {\r\n var parentRow = td.parentNode,\r\n columnCount = parseInt(document.getElementById('wptb-columns-number').value),\r\n tds = document.getElementsByClassName('wptb-preview-table')[0].getElementsByTagName('td');\r\n for (var i = 0; i < tds.length; i++) {\r\n tds[i].classList.remove('wptb-highlighted-row-first', 'wptb-highlighted-row-last', 'wptb-highlighted-row-inner', 'wptb-highlighted-column-first', 'wptb-highlighted-column-last', 'wptb-highlighted-column-inner');\r\n }\r\n for (var i = 0; i < columnCount; i++) {\r\n\r\n var classToAdd = i == 0 ? 'wptb-highlighted-row-first' : i == columnCount - 1 ? 'wptb-highlighted-row-last' : 'wptb-highlighted-row-inner';\r\n var ttd = parentRow.getElementsByTagName('td')[i];\r\n if (ttd !== td) {\r\n ttd.classList.add(classToAdd);\r\n }\r\n }\r\n }\r\n\r\n function highlightColumn(td) {\r\n\r\n var index,\r\n parentRow = td.parentNode;\r\n columnCount = parseInt(document.getElementById('wptb-columns-number').value), rowCount = parseInt(document.getElementById('wptb-rows-number').value), table = document.getElementsByClassName('wptb-preview-table')[0];\r\n for (var i = 0; i < columnCount; i++) {\r\n if (parentRow.getElementsByTagName('td')[i] === td) {\r\n index = i;\r\n break;\r\n }\r\n }\r\n\r\n for (var i = 0; i < rowCount; i++) {\r\n var classToAdd = i == 0 ? 'wptb-highlighted-column-first' : i == rowCount - 1 ? 'wptb-highlighted-column-last' : 'wptb-highlighted-column-inner';\r\n var tr = table.getElementsByTagName('tr')[i];\r\n if (tr.getElementsByTagName('td')[index] !== td) {\r\n tr.getElementsByTagName('td')[index].classList.add(classToAdd);\r\n }\r\n }\r\n }\r\n \r\n if( ! DOMElement ) {\r\n DOMElement = document.createElement(\"td\");\r\n\r\n DOMElement.style.padding = jQuery('#wptb-table-padding-number').val() + 'px';\r\n\r\n var innerBorderWidth = jQuery('#wptb-table-inner-border-number').val();\r\n\r\n if (innerBorderWidth != '' && parseInt(innerBorderWidth) != 0) {\r\n DOMElement.style.border = innerBorderWidth + 'px solid ' + jQuery('#wptb-table-border-color').val();\r\n } \r\n\r\n DOMElement.classList.add('wptb-droppable', 'wptb-cell');\r\n }\r\n\r\n DOMElement.draggable = false;\r\n if ( callback ) {\r\n DOMElement.onclick = callback;\r\n }\r\n \r\n WPTB_innerElementSet( DOMElement );\r\n \r\n let wptbPhElement = DOMElement.getElementsByClassName( 'wptb-ph-element' );\r\n \r\n if ( wptbPhElement.length > 0 ) {\r\n for( let i = 0; i < wptbPhElement.length; i++ ) {\r\n\r\n let wptbSpaceBetween = DOMElement.getElementsByClassName( 'wptb-space-between' );\r\n\r\n if ( wptbSpaceBetween.length > 0 ) {\r\n for( let j = 0; j < wptbSpaceBetween.length; j++ ) {\r\n WPTB_Space( wptbSpaceBetween[j] );\r\n }\r\n }\r\n \r\n wptbPhElement[i].getDOMElement = function() {\r\n return wptbPhElement[i];\r\n }\r\n \r\n WPTB_innerElementSet( wptbPhElement[i] );\r\n \r\n let wptbElementTypeClass = wptbPhElement[i].className.match( /wptb-element-((.+-)\\d+)/i );\r\n if( wptbElementTypeClass && Array.isArray( wptbElementTypeClass ) ) {\r\n let wptbTypeElementArr = wptbElementTypeClass[1].split( '-' );\r\n wptbPhElement[i].kind = wptbTypeElementArr[0];\r\n applyGenericItemSettings( wptbPhElement[i], wptbElementTypeClass[1] );\r\n if ( wptbPhElement[i].kind == 'list' ) {\r\n let wptbListItems = wptbPhElement[i].getElementsByTagName( 'li' );\r\n if( wptbListItems.length > 0 ) {\r\n for ( let i = 0; i < wptbListItems.length; i++ ) {\r\n WPTB_ListItem( undefined, wptbListItems[i] );\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n this.getDOMElement = function () {\r\n return DOMElement;\r\n };\r\n\r\n this.setCoords = function (y, x) {\r\n var el = this.getDOMElement();\r\n el.dataset.yIndex = y;\r\n el.dataset.xIndex = x;\r\n };\r\n\r\n this.getCoords = function () {\r\n var coords,\r\n el = this.getDOMElement();\r\n coords.x = el.dataset.xIndex;\r\n coords.y = el.dataset.yIndex;\r\n return coords;\r\n };\r\n\r\n this.appendElement = function (node) {\r\n getDOMElement().appendChild(node);\r\n };\r\n \r\n DOMElement.getCellDimensions = function() {\r\n let tdStyleObj = window.getComputedStyle( this, null );\r\n \r\n let tdPaddingLeft = tdStyleObj.getPropertyValue( 'padding-left' );\r\n let tdPaddingRight = tdStyleObj.getPropertyValue( 'padding-right' );\r\n \r\n let tdBorderLeftWidth = tdStyleObj.getPropertyValue( 'border-left-width' );\r\n let tdBorderRightWidth = tdStyleObj.getPropertyValue( 'border-right-width' );\r\n \r\n let tdPaddingTop = tdStyleObj.getPropertyValue( 'padding-top' );\r\n let tdPaddingBottom = tdStyleObj.getPropertyValue( 'padding-bottom' );\r\n \r\n let tdBorderTopWidth = tdStyleObj.getPropertyValue( 'border-top-width' );\r\n let tdBorderBottomWidth = tdStyleObj.getPropertyValue( 'border-bottom-width' );\r\n \r\n let width = parseFloat( this.offsetWidth, 10 ) - \r\n parseFloat( tdPaddingLeft, 10 ) - \r\n parseFloat( tdPaddingRight, 10 ) -\r\n parseFloat( tdBorderLeftWidth, 10 ) -\r\n parseFloat( tdBorderRightWidth, 10 );\r\n \r\n let height = parseFloat( this.offsetHeight, 10 ) - \r\n parseFloat( tdPaddingTop, 10 ) - \r\n parseFloat( tdPaddingBottom, 10 ) -\r\n parseFloat( tdBorderTopWidth, 10 ) -\r\n parseFloat( tdBorderBottomWidth, 10 );\r\n \r\n return {\r\n width: width, \r\n height: height\r\n };\r\n }\r\n\r\n return this;\r\n};","var WPTB_DropHandle = function (thisElem, e) {\r\n \r\n function newElementProxy(el) {\r\n if (el.includes('list')) {\r\n return new WPTB_List();\r\n } else if (el.includes('image')) {\r\n return new WPTB_Image();\r\n } else if (el.includes('text')) {\r\n return new WPTB_Text();\r\n } else if (el.includes('button')) {\r\n return new WPTB_Button();\r\n }\r\n }\r\n \r\n let wptbDropHandle,\r\n wptbDropBorderMarker;\r\n if ( document.getElementsByClassName( 'wptb-drop-handle' ).length == 0 ) {\r\n wptbDropHandle = document.createElement( 'div' );\r\n wptbDropHandle.classList.add( 'wptb-drop-handle' );\r\n \r\n wptbDropBorderMarker = document.createElement( 'div' );\r\n wptbDropBorderMarker.classList.add( 'wptb-drop-border-marker' );\r\n \r\n let wptbDropBorderMarkerTop = document.createElement( 'div' ),\r\n wptbDropBorderMarkerRight = document.createElement( 'div' ),\r\n wptbDropBorderMarkerBottom = document.createElement( 'div' ),\r\n wptbDropBorderMarkerLeft = document.createElement( 'div' );\r\n \r\n wptbDropBorderMarkerTop.classList.add( 'wptb-drop-border-marker-top' );\r\n wptbDropBorderMarkerRight.classList.add( 'wptb-drop-border-marker-right' );\r\n wptbDropBorderMarkerBottom.classList.add( 'wptb-drop-border-marker-bottom' );\r\n wptbDropBorderMarkerLeft.classList.add( 'wptb-drop-border-marker-left' );\r\n \r\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerTop );\r\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerRight );\r\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerBottom );\r\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerLeft );\r\n \r\n let body = document.getElementsByTagName( 'body' );\r\n if ( body.length > 0 ) {\r\n body[0].appendChild( wptbDropHandle );\r\n body[0].appendChild( wptbDropBorderMarker );\r\n }\r\n \r\n wptbDropHandle.ondragenter = function () {\r\n\r\n }\r\n\r\n wptbDropHandle.ondragover = function (e) {\r\n e.preventDefault();\r\n }\r\n\r\n wptbDropHandle.ondragleave = function () {\r\n\r\n }\r\n wptbDropHandle.ondrop = function (e) {\r\n e.preventDefault();\r\n let element;\r\n \r\n if ( e.dataTransfer.getData('wptbElement') ) {\r\n element = newElementProxy( e.dataTransfer.getData('wptbElement') );\r\n element = element.getDOMElement();\r\n } else {\r\n element = document.getElementsByClassName( e.dataTransfer.getData('node') )[0];\r\n element.classList.remove( 'wptb-moving-mode' );\r\n element.classList.remove( 'wptb-moving-into-same-elem' );\r\n }\r\n \r\n let td;\r\n if( wptbDropHandle.dataset.text == 'Drop Here' ) {\r\n thisElem = wptbDropHandle.getDOMParentElement();\r\n if ( thisElem.nodeName.toLowerCase() == 'td' ) {\r\n td = wptbDropHandle.getDOMParentElement();\r\n td.appendChild( element );\r\n }\r\n } else {\r\n let innerElement = wptbDropHandle.getDOMParentElement();\r\n td = innerElement.parentNode;\r\n \r\n if( wptbDropHandle.dataset.text == 'Abowe Element' ) {\r\n td.insertBefore( element, innerElement );\r\n } else if( wptbDropHandle.dataset.text == 'Below Element' ) {\r\n let innerElementNext = innerElement.nextSibling;\r\n td.insertBefore( element, innerElementNext );\r\n }\r\n }\r\n \r\n let thisRow = td.parentNode\r\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\r\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n \r\n wptbDropHandle.style.display = 'none';\r\n wptbDropBorderMarker.style.display = 'none';\r\n \r\n WPTB_innerElementSet(element);\r\n }\r\n let wptbContainer = document.querySelector( '.wptb-container' );\r\n wptbContainer.onscroll = function() {\r\n wptbDropHandle.style.display = 'none';\r\n wptbDropBorderMarker.style.display = 'none';\r\n }\r\n } else {\r\n wptbDropHandle = document.getElementsByClassName( 'wptb-drop-handle' )[0];\r\n wptbDropBorderMarker = document.getElementsByClassName( 'wptb-drop-border-marker' )[0];\r\n }\r\n if( thisElem && thisElem.nodeName.toLowerCase() == 'td' && \r\n thisElem.getElementsByClassName( 'wptb-ph-element' ).length != 0 ) {\r\n return;\r\n }\r\n \r\n let thisRow;\r\n if ( thisElem.localName == 'td' ) {\r\n thisRow = thisElem.parentNode;\r\n } else if ( thisElem.localName == 'div' && thisElem.classList.contains( 'wptb-ph-element' ) ) {\r\n thisRow = thisElem.parentNode.parentNode;\r\n }\r\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\r\n let indics = e.dataTransfer.types;\r\n let notDragEnter = false;\r\n for ( let i = 0; i < indics.length; i++ ) {\r\n let infArr = indics[i].match( /wptbelindic-([a-z]+)/i );\r\n if ( infArr && infArr[1] != 'text' ) {\r\n notDragEnter = true;\r\n break;\r\n }\r\n }\r\n if( notDragEnter ) {\r\n return;\r\n }\r\n }\r\n \r\n wptbDropHandle.style.width = thisElem.offsetWidth + 'px';\r\n let height = thisElem.offsetHeight,\r\n coordinatesElement = thisElem.getBoundingClientRect(),\r\n left = Number( coordinatesElement.left ),\r\n top;\r\n wptbDropHandle.style.left = left + 'px';\r\n \r\n if( e.dataTransfer.types.indexOf( 'wptb-moving-mode' ) != -1 ) {\r\n let elementDrag = document.getElementsByClassName( 'wptb-moving-mode' )[0];\r\n if( thisElem == elementDrag ) {\r\n wptbDropHandle.classList.add('wptb-moving-into-same-elem');\r\n wptbDropBorderMarker.classList.add('wptb-moving-into-same-elem');\r\n } else {\r\n wptbDropHandle.classList.remove('wptb-moving-into-same-elem');\r\n wptbDropBorderMarker.classList.remove('wptb-moving-into-same-elem');\r\n }\r\n }\r\n \r\n wptbDropHandle.getDOMParentElement = function() {\r\n return thisElem;\r\n }\r\n \r\n wptbDropHandle.style.display = 'block';\r\n wptbDropBorderMarker.style.display = 'block';\r\n if( thisElem.nodeName.toLowerCase() != 'td' ) {\r\n let y = e.offsetY==undefined?e.layerY:e.offsetY;\r\n top = Number( coordinatesElement.top ) - Number( 11 );\r\n wptbDropHandle.dataset.text = 'Abowe Element';\r\n if ( y > height/2 ) {\r\n top = Number( coordinatesElement.top ) + height - 1;\r\n wptbDropHandle.dataset.text = 'Below Element';\r\n }\r\n } else {\r\n wptbDropHandle.dataset.text = 'Drop Here';\r\n top = Number( coordinatesElement.top ) + height/2 - 5;\r\n }\r\n wptbDropHandle.style.top = top + 'px';\r\n\r\n wptbDropBorderMarker.style.top = coordinatesElement.top + 'px';\r\n wptbDropBorderMarker.style.left = coordinatesElement.left + 'px';\r\n\r\n wptbDropBorderMarkerTop = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-top' );\r\n wptbDropBorderMarkerTop.style.width = ( Number( thisElem.offsetWidth ) - Number( 1 ) ) + 'px';\r\n\r\n wptbDropBorderMarkerRight = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-right' );\r\n wptbDropBorderMarkerRight.style.height = ( Number( coordinatesElement.bottom ) - Number( coordinatesElement.top ) - 1 ) + 'px';\r\n wptbDropBorderMarkerRight.style.left = wptbDropBorderMarkerTop.style.width;\r\n\r\n wptbDropBorderMarkerBottom = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-bottom' );\r\n wptbDropBorderMarkerBottom.style.width = wptbDropBorderMarkerTop.style.width;\r\n wptbDropBorderMarkerBottom.style.top = wptbDropBorderMarkerRight.style.height;\r\n\r\n wptbDropBorderMarkerLeft = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-left' );\r\n wptbDropBorderMarkerLeft.style.height = wptbDropBorderMarkerRight.style.height;\r\n}","var ElementCounters = function () {\r\n\r\n\tvar priv = [];\r\n\tpriv['text'] = 0;\r\n\tpriv['image'] = 0;\r\n\tpriv['list'] = 0;\r\n\tpriv['button'] = 0;\r\n\r\n\tthis.increment = function (key) {\r\n\t\tif (!(key in priv)) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tpriv[key]++;\r\n\t}\r\n\r\n\tthis.nextIndex = function (key) {\r\n\t\tif (!(key in priv)) {\r\n\t\t\treturn undefined;\r\n\t\t}\r\n\t\treturn priv[key] + 1;\r\n\t}\r\n\r\n\treturn this;\r\n\r\n};","var WPTB_ElementOptions = function ( element, index, kindIndexProt ) {\r\n\r\n var node = element.getDOMElement(), elemIdClass;\r\n\r\n prop = document.querySelector(\".wptb-\" + element.kind + \"-options-prototype\").cloneNode(true);\r\n prop.classList.remove(\"wptb-\" + element.kind + \"-options-prototype\"); // remove prototype from the class\r\n elemIdClass = 'wptb-options-' + element.kind + \"-\" + index;\r\n\r\n var properties = prop.getElementsByClassName('wptb-element-property');\r\n\r\n for (var i = 0; i < properties.length; i++) {\r\n properties[i].dataset.element = elemIdClass;\r\n }\r\n\r\n prop.classList.add(elemIdClass);\r\n document.getElementById(\"element-options-group\").appendChild(prop);\r\n \r\n if ( kindIndexProt ) {\r\n if ( element.kind == 'button' ) {\r\n let affectedEl = document.getElementsByClassName( 'wptb-element-' + kindIndexProt )[0],\r\n wptbButtonWrapper,\r\n wptbButtonA,\r\n wptbButton,\r\n wptbSize;\r\n \r\n if ( affectedEl ) {\r\n wptbSize = affectedEl.className.match(/wptb-size-([a-z]+)/i);\r\n }\r\n \r\n if( wptbSize && Array.isArray( wptbSize ) ) {\r\n var b = prop.getElementsByClassName('wptb-btn-size-btn');\r\n \r\n for ( var i = 0; i < b.length; i++ ) {\r\n b[i].classList.remove( 'selected' );\r\n \r\n if ( b[i].innerHTML == wptbSize[1] ) {\r\n b[i].classList.add( 'selected' );\r\n }\r\n }\r\n }\r\n \r\n if( affectedEl ) {\r\n wptbButtonWrapper = affectedEl.getElementsByClassName( 'wptb-button-wrapper' );\r\n \r\n wptbButtonA = affectedEl.getElementsByTagName( 'a' );\r\n \r\n wptbButton = affectedEl.getElementsByClassName( 'wptb-button' );\r\n }\r\n \r\n if ( wptbButtonWrapper ) {\r\n let buttonAlignment = wptbButtonWrapper[0].style.justifyContent,\r\n buttonAlignmentSelect = prop.querySelector( 'select[data-type=\"button-alignment\"]' ),\r\n selectOption = buttonAlignmentSelect.getElementsByTagName( 'option' ),\r\n selectOptionVal;\r\n \r\n if ( buttonAlignment == 'flex-start' ) {\r\n selectOptionVal = 'left';\r\n } else if ( buttonAlignment == 'center' || ! buttonAlignment ) {\r\n selectOptionVal = 'center';\r\n } else if ( buttonAlignment == 'flex-end' ) {\r\n selectOptionVal = 'right';\r\n }\r\n \r\n for ( let i = 0; i < selectOption.length; i++ ) {\r\n if ( selectOption[i].value == selectOptionVal ) {\r\n selectOption[i].selected = true;\r\n }\r\n }\r\n }\r\n \r\n if ( wptbButtonA.length > 0 ) {\r\n let buttonHref = wptbButtonA[0].getAttribute( 'href' ), \r\n buttonLinkTarget = wptbButtonA[0].getAttribute( 'target' ),\r\n buttonId = wptbButtonA[0].getAttribute( 'id' ),\r\n \r\n \r\n buttonHrefInput = prop.querySelector( 'input[data-type=\"button-link\"]' ),\r\n buttonLinkTargetInput = prop.querySelector( 'input[data-type=\"button-link-target\"]' ),\r\n buttonLinkTargetInputId = buttonLinkTargetInput.getAttribute( 'id' ),\r\n buttonLinkTargetInputLabel = buttonLinkTargetInput.parentNode.getElementsByTagName( 'label' )[0],\r\n \r\n buttotIdInput = prop.querySelector( 'input[data-type=\"button-id\"]' );\r\n\r\n buttonLinkTargetInputId = buttonLinkTargetInputId + '-' + kindIndexProt.split( '-' )[1];\r\n buttonLinkTargetInput.setAttribute( 'id', buttonLinkTargetInputId );\r\n buttonLinkTargetInputLabel.setAttribute( 'for', buttonLinkTargetInputId );\r\n\r\n buttonHrefInput.value = buttonHref;\r\n\r\n if( buttonLinkTarget && buttonLinkTarget == '_blank') {\r\n buttonLinkTargetInput.checked = true;\r\n }\r\n \r\n buttotIdInput.value = buttonId;\r\n }\r\n \r\n if( wptbButton ) {\r\n let buttonTextColor = wptbButton[0].style.color,\r\n buttonColor = wptbButton[0].style.backgroundColor,\r\n buttonTextColorInput = prop.querySelector( 'input[data-type=\"button-text-color\"]' ),\r\n buttonBackgroundColorInput = prop.querySelector( 'input[data-type=\"button-color\"]' );\r\n \r\n \r\n buttonTextColorInput.value = WPTB_Helper.rgbToHex( buttonTextColor );\r\n \r\n buttonBackgroundColorInput.value = WPTB_Helper.rgbToHex( buttonColor );\r\n \r\n }\r\n } else if ( element.kind == 'image' ) {\r\n let affectedEl = document.getElementsByClassName( 'wptb-element-' + kindIndexProt );\r\n if ( affectedEl.length > 0 ) {\r\n let elementsA = affectedEl[0].getElementsByTagName( 'a' );\r\n if ( elementsA.length > 0 ) {\r\n let a = elementsA[0];\r\n\r\n if ( a ) {\r\n a.onclick = function( e ) {\r\n e.preventDefault();\r\n }\r\n // set select according to the alignment of the image\r\n let aTextAlign = a.style.textAlign,\r\n imageAlignmentSelect = prop.querySelector( 'select[data-type=\"image-alignment\"]' ),\r\n selectOption = imageAlignmentSelect.getElementsByTagName( 'option' );\r\n\r\n for ( let i = 0; i < selectOption.length; i++ ) {\r\n if ( selectOption[i].value == aTextAlign ) {\r\n selectOption[i].selected = true;\r\n }\r\n }\r\n\r\n // set text link for input field of setting panel\r\n let imageLinkHref = a.getAttribute( 'href' ),\r\n inputImageLink = prop.querySelector( 'input[data-type=\"image-link\"]' );\r\n if ( imageLinkHref ) {\r\n inputImageLink.value = imageLinkHref;\r\n }\r\n\r\n // set checkbox for target of link \r\n let imageLinkTarget = a.getAttribute( 'target' ),\r\n imageLinkTargetInput = prop.querySelector( 'input[data-type=\"image-link-target\"]' ),\r\n imageLinkTargetInputId = imageLinkTargetInput.getAttribute( 'id' ),\r\n imageLinkTargetInputLabel = imageLinkTargetInput.parentNode.getElementsByTagName( 'label' )[0];\r\n\r\n imageLinkTargetInputId = imageLinkTargetInputId + '-' + kindIndexProt.split( '-' )[1];\r\n\r\n imageLinkTargetInput.setAttribute( 'id', imageLinkTargetInputId );\r\n imageLinkTargetInputLabel.setAttribute( 'for', imageLinkTargetInputId );\r\n\r\n if ( imageLinkTarget && imageLinkTarget == '_blank' ) {\r\n imageLinkTargetInput.checked = true;\r\n }\r\n\r\n let img = a.getElementsByTagName( 'img' );\r\n if ( img.length > 0 ) {\r\n // set value for input fields of image size\r\n let imgWidth = img[0].style.width;\r\n if ( imgWidth ) {\r\n let imageWidthInputRange = prop.querySelector( 'input[type=\"range\"][data-type=\"image-size\"]' ),\r\n imageWidthInputNumber = prop.querySelector( 'input[type=\"number\"][data-type=\"image-size\"]' );\r\n\r\n imageWidthInputRange.value = parseInt( imgWidth );\r\n imageWidthInputNumber.value = parseInt( imgWidth );\r\n }\r\n\r\n // set value for input field of alternative text image\r\n let imgAlternativeText = img[0].getAttribute('alt'),\r\n imageAlternativeTextInput = prop.querySelector( 'input[type=\"text\"][data-type=\"alternative-text\"]' );\r\n\r\n imageAlternativeTextInput.value = imgAlternativeText;\r\n }\r\n }\r\n }\r\n }\r\n } else if ( element.kind == 'text' ) {\r\n let affectedEl = document.getElementsByClassName( 'wptb-element-' + kindIndexProt );\r\n if ( affectedEl.length > 0 ) {\r\n let elementFontSize = affectedEl[0].style.fontSize,\r\n elementTextColor = affectedEl[0].style.color;\r\n let textFontSizeInputRange = prop.querySelector( 'input[type=\"range\"][data-type=\"font-size\"]' ),\r\n textFontSizeInputNumber = prop.querySelector( 'input[type=\"number\"][data-type=\"font-size\"]' ),\r\n textColorInput = prop.querySelector( 'input[type=\"text\"][data-type=\"color\"]' );\r\n\r\n textFontSizeInputRange.value = parseInt( elementFontSize );\r\n textFontSizeInputNumber.value = parseInt( elementFontSize );\r\n textColorInput.value = WPTB_Helper.rgbToHex( elementTextColor );\r\n }\r\n } else if ( element.kind == 'list' ) {\r\n let elementList = document.getElementsByClassName( 'wptb-element-' + kindIndexProt );\r\n if ( elementList.length > 0 ) {\r\n let elementListColor = elementList[0].querySelector( 'p' ).style.color;\r\n let listColorInput = prop.querySelector( 'input[type=\"text\"][data-type=\"list-text-color\"]' );\r\n listColorInput.value = WPTB_Helper.rgbToHex( elementListColor );\r\n \r\n let elementListItem = elementList[0].querySelectorAll( 'li' );\r\n if ( elementListItem.length > 0 ) {\r\n let listItemP = elementListItem[0].querySelector( 'p' );\r\n let listItemPClasses = listItemP.classList;\r\n //listItemPClasses = [...listItemPClasses];\r\n if ( listItemPClasses.length > 0 ) {\r\n let elementListClassSelect = prop.querySelector( 'select[data-type=\"list-class\"]' );\r\n if ( elementListClassSelect ) {\r\n elementListClassSelect.value = 'unordered';\r\n \r\n let listIconSelectLabel = elementListClassSelect.parentNode.nextSibling;\r\n for ( let i = 0; i < 10; i++ ) {\r\n if ( listIconSelectLabel.nodeType == '1' ) {\r\n break;\r\n } else {\r\n listIconSelectLabel = listIconSelectLabel.nextSibling;\r\n }\r\n }\r\n if ( listIconSelectLabel ) {\r\n let listIconSelectLabelId = listIconSelectLabel.getAttribute( 'id' );\r\n listIconSelectLabel.setAttribute( 'id', listIconSelectLabelId + '-' + kindIndexProt );\r\n listIconSelectLabel.style.display = 'flex';\r\n }\r\n \r\n let elementListStyleTypeSelect = prop.querySelector( 'select[data-type=\"list-style-type\"]' );\r\n if ( elementListStyleTypeSelect ) {\r\n elementListStyleTypeSelect.parentNode.style.display = 'flex';\r\n \r\n if( listItemPClasses.contains( 'wptb-list-style-type-disc' ) ) {\r\n elementListStyleTypeSelect.value = 'disc';\r\n } else if( listItemPClasses.contains( 'wptb-list-style-type-circle' ) ) {\r\n elementListStyleTypeSelect.value = 'circle';\r\n } else if( listItemPClasses.contains( 'wptb-list-style-type-square' ) ) {\r\n elementListStyleTypeSelect.value = 'square';\r\n } else if ( listItemPClasses.contains( 'wptb-list-style-type-none' ) ) {\r\n elementListStyleTypeSelect.value = 'none';\r\n }\r\n }\r\n }\r\n }\r\n }\r\n \r\n let elementListItemContent = elementList[0].getElementsByClassName( 'wptb-list-item-content' );\r\n if ( elementListItemContent.length > 0 ) {\r\n let listItemPTextAlignArr = [];\r\n for ( let i = 0; i < elementListItemContent.length; i++ ) {\r\n let p = elementListItemContent[i].querySelector( 'p' );\r\n if ( p ) {\r\n if ( p.style.textAlign ) {\r\n listItemPTextAlignArr.push( p.style.textAlign );\r\n } else {\r\n listItemPTextAlignArr.push( 'left' );\r\n }\r\n }\r\n \r\n }\r\n \r\n let listItemPTextAlignLeftCount = 0,\r\n listItemPTextAlignCenterCount = 0,\r\n listItemPTextAlignRightCount = 0;\r\n \r\n if ( listItemPTextAlignArr.length > 0 ) {\r\n for ( let i = 0; i < listItemPTextAlignArr.length; i++ ) {\r\n if ( listItemPTextAlignArr[i] ) {\r\n if ( listItemPTextAlignArr[i] == 'left' ) {\r\n listItemPTextAlignLeftCount++;\r\n } else if ( listItemPTextAlignArr[i] == 'center' ) {\r\n listItemPTextAlignCenterCount++;\r\n } else if ( listItemPTextAlignArr[i] == 'right' ) {\r\n listItemPTextAlignRightCount++;\r\n }\r\n }\r\n }\r\n }\r\n \r\n let elementListAlignmentSelect = prop.querySelector( 'select[data-type=\"list-alignment\"]' ),\r\n maxListItemTAlLeftC = Math.max( listItemPTextAlignLeftCount, listItemPTextAlignCenterCount, listItemPTextAlignRightCount );\r\n \r\n if ( listItemPTextAlignLeftCount == maxListItemTAlLeftC ) {\r\n elementListAlignmentSelect.value = 'left';\r\n } else if ( listItemPTextAlignCenterCount == maxListItemTAlLeftC ) {\r\n elementListAlignmentSelect.value = 'center';\r\n } else if ( listItemPTextAlignRightCount == maxListItemTAlLeftC ) {\r\n elementListAlignmentSelect.value = 'right';\r\n }\r\n }\r\n } \r\n }\r\n }\r\n\r\n node.onclick = function () {\r\n var infArr = this.className.match(/wptb-element-((.+-)\\d+)/i),\r\n optionsClass = '.wptb-' + infArr[2] + 'options' +\r\n '.wptb-options-' + infArr[1];\r\n\r\n document.getElementsByClassName('wptb-elements-container')[0].style.display = 'none';\r\n document.getElementsByClassName('wptb-settings-section')[0].style.display = 'none';\r\n document.getElementById(\"element-options-group\").style.display = 'block';\r\n\r\n var children = document.getElementById(\"element-options-group\").childNodes;\r\n for (var i = 0; i < children.length; i++) {\r\n if (children[i].style)\r\n children[i].style.display = 'none';\r\n }\r\n\r\n document.querySelector(optionsClass).style.display = 'block';\r\n\r\n //var listStyleType, textAlign;\r\n\r\n// switch (element.kind) {\r\n\r\n// case 'text':\r\n// jQuery(prop).find('[data-type=color]').wpColorPicker({ defaultColor: node.style.color });\r\n// prop.querySelector('[type=number][data-type=font-size]').value\r\n// = prop.querySelector('[type=range][data-type=font-size]').value\r\n// = node.style.fontSize.substring(0, node.style.fontSize.length - 2);\r\n// break;\r\n// case 'list':\r\n// textAlign = node.querySelector('li p').style.textAlign;\r\n// listStyleType = node.querySelector('li').style.listStyleType;\r\n// if ( prop.querySelector( 'select[data-type=list-class]' ) ) {\r\n// console.log(textAlign);\r\n// console.log(listStyleType);\r\n// console.log(listStyleType);\r\n// console.log(prop);\r\n// prop.querySelector('select[data-type=list-class]').selectedIndex = ( listStyleType == 'decimal' ? 0 : 1 );\r\n// }\r\n// if ( prop.querySelector('select[data-type=list-style-type]') ) {\r\n// prop.querySelector('select[data-type=list-style-type]').selectedIndex = (listStyleType == 'circle' ? 0 : (listStyleType == 'square' ? 1 : 2));\r\n// }\r\n// if ( prop.querySelector('select[data-type=list-alignment]') ) {\r\n// prop.querySelector('select[data-type=list-alignment]').selectedIndex = (textAlign == 'left' ? 0 : (textAlign == 'center' ? 1 : 2));\r\n// }\r\n// break;\r\n// case 'image':\r\n// break;\r\n// case 'button':\r\n// jQuery(prop).find('[data-type=button-color]').wpColorPicker({ defaultColor: node.style.backgroundColor });\r\n// break;\r\n//\r\n// }\r\n };\r\n\r\n if (element.kind == 'button') {\r\n //We must add this special kind of property, since it is triggered with click event\r\n var buttons = prop.getElementsByClassName('wptb-btn-size-btn');\r\n\r\n for (var i = 0; i < buttons.length; i++) {\r\n buttons[i].onclick = function () {\r\n var size = this.innerHTML,\r\n n_Class = this.dataset.element,\r\n infArr = n_Class.match(/wptb-options-(.+)-(\\d+)/i),\r\n type = infArr[1],\r\n num = infArr[2],\r\n affectedEl = document.getElementsByClassName('wptb-element-' + type + '-' + num)[0];\r\n affectedEl.classList.remove('wptb-size-S');\r\n affectedEl.classList.remove('wptb-size-M');\r\n affectedEl.classList.remove('wptb-size-L');\r\n affectedEl.classList.remove('wptb-size-XL');\r\n affectedEl.classList.add('wptb-size-' + size);\r\n var b = this.parentNode.getElementsByClassName('wptb-btn-size-btn');\r\n for (var i = 0; i < b.length; i++) {\r\n b[i].classList.remove('selected');\r\n }\r\n this.classList.add('selected');\r\n }\r\n }\r\n }\r\n\r\n var optionControls = prop.getElementsByClassName('wptb-element-property');\r\n\r\n for (var i = 0; i < optionControls.length; i++) {\r\n if (optionControls[i].classList.contains('wptb-color-picker')) {\r\n jQuery(optionControls[i]).wpColorPicker({\r\n change: function (event, ui) {\r\n var parent = event.target, classe, type, ps, number;\r\n classe = parent.dataset.element.match(/wptb-options-(.+)-(\\d+)/i);\r\n type = classe[1];\r\n number = classe[2];\r\n affectedEl = document.getElementsByClassName('wptb-element-' + type + '-' + number)[0];\r\n if ( type == 'button' ) {\r\n if (parent.dataset.type == 'button-text-color') {\r\n affectedEl.getElementsByClassName('wptb-button')[0].style.color = ui.color.toString();\r\n } else {\r\n affectedEl.getElementsByClassName('wptb-button')[0].style.backgroundColor = ui.color.toString();\r\n }\r\n } else if( type == 'list' ) {\r\n let ps = affectedEl.querySelectorAll( 'p' );\r\n if( ps.length > 0 ) {\r\n for ( let i = 0; i < ps.length; i++ ) {\r\n ps[i].style.color = ui.color.toString();\r\n }\r\n }\r\n } else {\r\n affectedEl.style.color = ui.color.toString();\r\n }\r\n }\r\n });\r\n }\r\n\r\n if (optionControls[i].dataset.type === 'font-size') {\r\n var slider = optionControls[i].parentNode.parentNode.getElementsByClassName('wptb-text-font-size-slider')[0];\r\n slider.oninput = function () {\r\n this.parentNode.parentNode.getElementsByClassName('wptb-text-font-size-number')[0].value = this.value;\r\n this.parentNode.parentNode.getElementsByClassName('wptb-text-font-size-number')[0].onchange();\r\n }\r\n }\r\n\r\n if (optionControls[i].dataset.type === 'image-size') {\r\n var slider = optionControls[i].parentNode.parentNode.getElementsByClassName('wptb-image-size-slider')[0];\r\n slider.oninput = function () {\r\n this.parentNode.parentNode.getElementsByClassName('wptb-image-width-number')[0].value = this.value;\r\n this.parentNode.parentNode.getElementsByClassName('wptb-image-width-number')[0].onchange();\r\n }\r\n }\r\n\r\n optionControls[i].onchange = function (event) {\r\n\r\n var n_Class = this.dataset.element,\r\n infArr = n_Class.match(/wptb-options-(.+)-(\\d+)/i),\r\n type = infArr[1],\r\n num = infArr[2],\r\n affectedEl = document.getElementsByClassName('wptb-element-' + type + '-' + num)[0],\r\n val = this.value;\r\n\r\n switch (this.dataset.type) {\r\n case 'src':\r\n var img = affectedEl.getElementsByTagName(\"img\")[0];\r\n img.src = this.value;\r\n break;\r\n case 'alternative-text':\r\n var img = affectedEl.getElementsByTagName('img')[0];\r\n img.alt = this.value;\r\n break;\r\n case 'image-link':\r\n affectedEl.getElementsByTagName('a')[0].href = WPTB_Helper.linkHttpCheckChange( this.value );\r\n break;\r\n case 'image-link-target':\r\n if (this.checked == true) {\r\n affectedEl.getElementsByTagName('a')[0].target = '_blank';\r\n } else {\r\n affectedEl.getElementsByTagName('a')[0].target = '_self';\r\n }\r\n break;\r\n case 'image-link-nofollow':\r\n if (this.checked == true) {\r\n affectedEl.getElementsByTagName('a')[0].rel = 'nofollow';\r\n } else {\r\n affectedEl.getElementsByTagName('a')[0].removeAttribute('rel');\r\n }\r\n break;\r\n case 'image-size':\r\n affectedEl.getElementsByTagName('a')[0].style.width = this.value + '%';\r\n affectedEl.getElementsByTagName('a')[0].style.height = 'auto';\r\n this.parentNode.parentNode.getElementsByClassName('wptb-image-size-slider')[0].value = this.value;\r\n break;\r\n case 'image-alignment':\r\n affectedEl.getElementsByClassName( 'wptb-image-wrapper' )[0].style.textAlign = this.value;\r\n break;\r\n case 'font-size':\r\n affectedEl.style.fontSize = val + 'px';\r\n break;\r\n case 'button-alignment':\r\n var jc = '';\r\n if (this.value == 'left') {\r\n jc = 'start';\r\n } else if (this.value == 'right') {\r\n jc = 'flex-end';\r\n } else {\r\n jc = 'center';\r\n }\r\n affectedEl.getElementsByClassName('wptb-button-wrapper')[0].style.justifyContent = jc;\r\n break;\r\n case 'button-link':\r\n if ( this.value ) {\r\n affectedEl.getElementsByTagName( 'a' )[0].href = WPTB_Helper.linkHttpCheckChange( this.value );\r\n } else {\r\n affectedEl.getElementsByTagName( 'a' )[0].removeAttribute( 'href' );\r\n }\r\n break;\r\n case 'button-link-target':\r\n if (this.checked == true) {\r\n affectedEl.getElementsByTagName('a')[0].target = '_blank';\r\n } else {\r\n affectedEl.getElementsByTagName('a')[0].target = '_self';\r\n }\r\n break;\r\n case 'button-link-nofollow':\r\n if (this.checked == true) {\r\n affectedEl.getElementsByTagName('a')[0].rel = 'nofollow';\r\n } else {\r\n affectedEl.getElementsByTagName('a')[0].removeAttribute( 'rel' );\r\n }\r\n break;\r\n case 'button-id':\r\n if( this.value ) {\r\n affectedEl.getElementsByTagName( 'a' )[0].id = this.value;\r\n } else {\r\n affectedEl.getElementsByTagName( 'a' )[0].removeAttribute( 'id' );\r\n }\r\n case 'button-color':\r\n break;\r\n case 'list-alignment':\r\n let listItems = affectedEl.querySelectorAll('li');\r\n for (var i = 0; i < listItems.length; i++) {\r\n let p = listItems[i].querySelector( 'p' );\r\n if ( p ) {\r\n p.style.textAlign = this.value;\r\n }\r\n }\r\n break;\r\n case 'list-class':\r\n let parentNode = event.target\r\n .parentNode\r\n .parentNode\r\n .querySelector('[data-type=list-style-type]')\r\n .parentNode,\r\n parentNodeSettingItem = parentNode.parentNode;\r\n if (val == 'unordered') {\r\n parentNode.style.display = 'flex';\r\n \r\n parentNodeSettingItem.querySelector( '.wptb-list-icon-select-label' ).style.display = 'flex';\r\n let listItem = affectedEl.querySelectorAll('li');\r\n for (var i = 0; i < listItem.length; i++) {\r\n let p = listItem[i].querySelector( 'p' );\r\n p.removeAttribute ( 'class' );\r\n p.classList.add( 'wptb-list-style-type-disc' );\r\n }\r\n parentNodeSettingItem.querySelector('[data-type=list-style-type]').value = 'disc';\r\n } else {\r\n parentNode.style.display = 'none';\r\n parentNodeSettingItem.querySelector( '.wptb-list-icon-select-label' ).style.display = 'none';\r\n var listItem = affectedEl.querySelectorAll('li');\r\n for (var i = 0; i < listItem.length; i++) {\r\n let p = listItem[i].querySelector( 'p' );\r\n p.removeAttribute ( 'class' );\r\n }\r\n }\r\n break;\r\n case 'list-style-type':\r\n var listItem = affectedEl.querySelectorAll('li');\r\n for (var i = 0; i < listItem.length; i++) {\r\n let p = listItem[i].querySelector( 'p' );\r\n p.removeAttribute ( 'class' );\r\n p.classList.add( 'wptb-list-style-type-' + val.toLowerCase() );\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n};","var WPTB_Helper = {\r\n hexToRgb: function( hex ) {\r\n var result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec( hex );\r\n return result ? 'rgb(' + parseInt( result[1], 16 ) + ',' + parseInt( result[2], 16 ) + ',' + parseInt( result[3], 16 ) + ')' : null;\r\n },\r\n rgbToHex: function ( rgb ) {\r\n var rgb = rgb.match( /^rgba?[\\s+]?\\([\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?/i );\r\n\r\n return ( rgb && rgb.length === 4 ) ? \"#\" +\r\n ( \"0\" + parseInt( rgb[1],10 ).toString( 16 )).slice( -2 ) +\r\n ( \"0\" + parseInt( rgb[2],10 ).toString( 16 )).slice( -2 ) +\r\n ( \"0\" + parseInt( rgb[3],10 ).toString( 16 )).slice( -2 ) : '';\r\n },\r\n getDragImageCustom: function ( type ) {\r\n let hostName = location.protocol + '//' + location.hostname;\r\n let img = document.createElement( 'img' );\r\n img.src = hostName + '/wp-content/plugins/wp-table-builder/inc/admin/views/builder/icons/' + type + '.png';\r\n return img;\r\n },\r\n dragImagesArr: function() {\r\n return {\r\n text: WPTB_Helper.getDragImageCustom( 'text' ),\r\n image: WPTB_Helper.getDragImageCustom( 'image' ),\r\n button: WPTB_Helper.getDragImageCustom( 'button' ),\r\n list: WPTB_Helper.getDragImageCustom( 'list' )\r\n };\r\n },\r\n listItemsRecalculateIndex: function( ulElem ) {\r\n let par = ulElem.querySelectorAll( 'p' );\r\n if ( par.length > 0 ) {\r\n for ( let i = 0; i < par.length; i++ ) {\r\n par[i].dataset.listStyleTypeIndex = Number( i ) + 1 + '.';\r\n }\r\n }\r\n },\r\n listItemsTinyMceInit: function( listItem ) {\r\n tinyMCE.init({\r\n target: listItem,\r\n inline: true,\r\n plugins: \"link, paste\",\r\n dialog_type: \"modal\",\r\n theme: 'modern',\r\n menubar: false,\r\n fixed_toolbar_container: '#wpcd_fixed_toolbar',\r\n paste_as_text: true,\r\n toolbar: 'bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify',\r\n setup: function(ed) {\r\n ed.on('keydown', function(e) {\r\n let article = e.target.parentNode;\r\n if ( e.keyCode == 13 ) {\r\n e.preventDefault();\r\n let text = e.target.innerHTML;\r\n let duplicate = new WPTB_ListItem( text, article, true );\r\n \r\n article.parentNode.insertBefore( duplicate.getDOMElement(), article );\r\n WPTB_Helper.listItemsTinyMceInit( duplicate.getDOMElement().firstChild );\r\n e.target.querySelector( 'p' ).innerText = 'New List Item';\r\n //tinyMCE.execCommand('mceInsertContent', false, 'New List Item');\r\n WPTB_Helper.listItemsRecalculateIndex( article.parentNode );\r\n \r\n } else if ( e.keyCode == '8' || e.keyCode == '46' ) {\r\n let p = e.target.querySelector( 'p' );\r\n let pText = p.innerHTML.replace(/<[^>]+>/g, '');\r\n pText = pText.replace( /\\s+/g, ' ' ).trim();\r\n pText = pText.replace( /&nbsp;/g, '').trim();\r\n \r\n if( pText == '' ) {\r\n e.preventDefault();\r\n e.target.querySelector( 'p' ).innerText = '\\n';\r\n } else {\r\n let selectedText = WPTB_Helper.getSelectionText();\r\n selectedText = selectedText.replace( /\\s+/g, ' ' ).trim();\r\n selectedText = selectedText.replace( /&nbsp;/g, '' ).trim();\r\n if( selectedText == pText ) {\r\n e.preventDefault();\r\n e.target.querySelector( 'p' ).innerText = '\\n';\r\n }\r\n }\r\n }\r\n });\r\n \r\n ed.on( 'keyup', function( e ) {\r\n \r\n });\r\n },\r\n init_instance_callback: function (editor) {\r\n window.currentEditor = editor;\r\n editor.on('focus', function (e) {\r\n var totalWidth = document.getElementsByClassName('wptb-builder-panel')[0].offsetWidth;\r\n if (window.currentEditor &&\r\n document.getElementById('wptb_builder').scrollTop >= 55 &&\r\n window.currentEditor.bodyElement.style.display != 'none') {\r\n document.getElementById('wpcd_fixed_toolbar').style.position = 'fixed';\r\n document.getElementById('wpcd_fixed_toolbar').style.right = (totalWidth / 2 - document.getElementById('wpcd_fixed_toolbar').offsetWidth / 2) + 'px';\r\n document.getElementById('wpcd_fixed_toolbar').style.top = '100px';\r\n } else {\r\n document.getElementById('wpcd_fixed_toolbar').style.position = 'static';\r\n delete document.getElementById('wpcd_fixed_toolbar').style.right;\r\n delete document.getElementById('wpcd_fixed_toolbar').style.top;\r\n }\r\n });\r\n }\r\n });\r\n },\r\n buttonsTinyMceInit: function( target ) {\r\n tinyMCE.init({\r\n target: target,\r\n inline: true,\r\n plugins: \"link\",\r\n dialog_type: \"modal\",\r\n theme: 'modern',\r\n menubar: false,\r\n fixed_toolbar_container: '#wpcd_fixed_toolbar',\r\n toolbar: 'bold italic strikethrough',\r\n setup : function(ed) {\r\n ed.on('keydown', function(e) {\r\n if (e.keyCode == 13) {\r\n e.preventDefault();\r\n }\r\n });\r\n },\r\n init_instance_callback: function (editor) {\r\n window.currentEditor = editor;\r\n editor.on('focus', function (e) {\r\n var totalWidth = document.getElementsByClassName('wptb-builder-panel')[0].offsetWidth;\r\n if (window.currentEditor &&\r\n document.getElementById('wptb_builder').scrollTop >= 55 &&\r\n window.currentEditor.bodyElement.style.display != 'none') {\r\n document.getElementById('wpcd_fixed_toolbar').style.position = 'fixed';\r\n document.getElementById('wpcd_fixed_toolbar').style.right = (totalWidth / 2 - document.getElementById('wpcd_fixed_toolbar').offsetWidth / 2) + 'px';\r\n document.getElementById('wpcd_fixed_toolbar').style.top = '100px';\r\n } else {\r\n document.getElementById('wpcd_fixed_toolbar').style.position = 'static';\r\n delete document.getElementById('wpcd_fixed_toolbar').style.right;\r\n delete document.getElementById('wpcd_fixed_toolbar').style.top;\r\n }\r\n });\r\n }\r\n });\r\n },\r\n linkHttpCheckChange: function( link ) {\r\n if ( link ) {\r\n if ( link.indexOf( 'http://' ) == -1 && link.indexOf( 'https://' ) == -1 ) {\r\n let linkArr = link.split( '/' ),\r\n linkClean;\r\n if ( Array.isArray( linkArr ) && linkArr.length > 0 ) {\r\n linkClean = linkArr[linkArr.length - 1];\r\n }\r\n return document.location.protocol + '//' + linkClean;\r\n } else { \r\n return link;\r\n }\r\n } else {\r\n return '';\r\n }\r\n },\r\n dataTitleColumnSet: function( table ) {\r\n let rows = table.rows,\r\n rowHead = rows[0];\r\n let computedStyleRowHead = getComputedStyle(rowHead);\r\n \r\n let rowHeadChildren = rowHead.children;\r\n let contentsForHeader = {};\r\n for( let i = 0; i < rowHeadChildren.length; i++ ) {\r\n let tdElements = rowHeadChildren[i].children;\r\n for( let j = 0; j < tdElements.length; j++ ) {\r\n let element = tdElements[j];\r\n if( element.classList.contains( 'wptb-ph-element' ) ) {\r\n let infArr = element.className.match( /wptb-element-(.+)-(\\d+)/i );\r\n if( infArr[1] == 'text' ) {\r\n let p = element.querySelector( 'p' ),\r\n textContent = p.textContent,\r\n textAlign = p.style.textAlign;\r\n contentsForHeader[rowHeadChildren[i].dataset.xIndex] = [textContent, element.style.fontSize, \r\n element.style.color, computedStyleRowHead.backgroundColor, textAlign];\r\n break;\r\n }\r\n }\r\n }\r\n if( ! contentsForHeader[rowHeadChildren[i].dataset.xIndex] ) {\r\n contentsForHeader[rowHeadChildren[i].dataset.xIndex] = ['', '', \r\n '', computedStyleRowHead.backgroundColor, ''];\r\n }\r\n }\r\n for ( let i = 1; i < rows.length; i++ ) {\r\n let thisRow = rows[i],\r\n thisRowChildren = thisRow.children;\r\n for( let j = 0; j < thisRowChildren.length; j++ ) {\r\n if ( contentsForHeader[thisRowChildren[j].dataset.xIndex] ) {\r\n thisRowChildren[j].dataset.wptbTitleColumn = contentsForHeader[thisRowChildren[j].dataset.xIndex][0];\r\n thisRowChildren[j].dataset.wptbTitleColumnFontSize = contentsForHeader[thisRowChildren[j].dataset.xIndex][1];\r\n thisRowChildren[j].dataset.wptbTitleColumnColor = contentsForHeader[thisRowChildren[j].dataset.xIndex][2];\r\n thisRowChildren[j].dataset.wptbTitleBackgroundColor = contentsForHeader[thisRowChildren[j].dataset.xIndex][3];\r\n thisRowChildren[j].dataset.wptbTitleAlign = contentsForHeader[thisRowChildren[j].dataset.xIndex][4];\r\n } else {\r\n thisRowChildren[j].dataset.wptbTitleColumn = '';\r\n thisRowChildren[j].dataset.wptbTitleColumnFontSize = '';\r\n thisRowChildren[j].dataset.wptbTitleColumnColor = '';\r\n thisRowChildren[j].dataset.wptbTitleBackgroundColor = '';\r\n thisRowChildren[j].dataset.wptbTitleAlign = '';\r\n }\r\n }\r\n }\r\n },\r\n findAncestor: function(el, cls) {\r\n while ((el = el.parentElement) && !el.classList.contains(cls));\r\n return el;\r\n },\r\n getSelectionText: function() {\r\n var txt = '';\r\n if (txt = window.getSelection) {\r\n txt = window.getSelection().toString();\r\n } else {\r\n txt = document.selection.createRange().text;\r\n }\r\n return txt;\r\n },\r\n settingsPanelClear: function() {\r\n document.getElementById( 'wptb-adaptive-table-checkbox' ).checked = false;\r\n document.getElementById( 'wptb-top-row-as-header' ).checked = false;\r\n document.getElementById( 'wptb-table-border-slider' ).value = 0;\r\n document.getElementById( 'wptb-table-border-number' ).value = 0;\r\n document.getElementById( 'wptb-inner-border-check' ).checked = false;\r\n document.getElementById( 'wptb-apply-inner-border' ).classList.remove( 'visible' );\r\n document.getElementById( 'wptb-table-inner-border-slider' ).value = 1;\r\n document.getElementById( 'wptb-table-inner-border-number' ).value = 1;\r\n \r\n WPTB_Helper.wpColorPickerClear( 'wptb-table-border-color' );\r\n \r\n WPTB_Helper.wpColorPickerClear( 'wptb-table-header-bg' );\r\n \r\n WPTB_Helper.wpColorPickerClear( 'wptb-even-row-bg' );\r\n \r\n WPTB_Helper.wpColorPickerClear( 'wptb-odd-row-bg' );\r\n \r\n document.getElementById( 'wptb-table-cell-slider' ).value = 15;\r\n document.getElementById( 'wptb-table-cell-number' ).value = 15;\r\n },\r\n wpColorPickerClear: function( inputId ) {\r\n let input = document.getElementById( inputId );\r\n let wpPickerContainer = WPTB_Helper.findAncestor( input, 'wp-picker-container' );\r\n let parent = wpPickerContainer.parentNode;\r\n parent.removeChild( wpPickerContainer );\r\n let newInput = document.createElement( 'input' );\r\n newInput.setAttribute( 'id', inputId );\r\n newInput.value = \"\";\r\n parent.appendChild( newInput );\r\n },\r\n detectMode: function() {\r\n var url = window.location.href,\r\n regex = new RegExp('[?&]table(=([^&#]*)|&|#|$)'),\r\n results = regex.exec(url);\r\n if (!results) return false;\r\n if (!results[2]) return '';\r\n return decodeURIComponent(results[2].replace(/\\+/g, ' '));\r\n },\r\n getColumnWidth: function( table, cell ) {\r\n let xIndex = cell.dataset.xIndex;\r\n let xIndexes = table.querySelectorAll( '[data-x-index=\"' + xIndex + '\"]' );\r\n let cellWidth = cell.getCellDimensions().width;\r\n for( let i = 0; i < xIndexes.length; i++ ) {\r\n if( cellWidth > xIndexes[i].getCellDimensions().width ) {\r\n cellWidth = xIndexes[i].getCellDimensions().width;\r\n }\r\n }\r\n return cellWidth;\r\n },\r\n getRowHeight: function( table, cell ) {\r\n let yIndex = cell.dataset.yIndex;\r\n let yIndexes = table.querySelectorAll( '[data-y-index=\"' + yIndex + '\"]' );\r\n let cellHeight = cell.getCellDimensions().height;\r\n for( let i = 0; i < yIndexes.length; i++ ) {\r\n if( cellHeight > yIndexes[i].getCellDimensions().height ) {\r\n cellHeight = yIndexes[i].getCellDimensions().height;\r\n }\r\n }\r\n return cellHeight;\r\n }\r\n}\r\n","var WPTB_Image = function ( src, DOMElementProt ) {\r\n let DOMElement,\r\n elImage,\r\n kindIndexProt = undefined,\r\n copy = false;\r\n if ( DOMElementProt == undefined ) {\r\n DOMElement = document.createElement( 'div' );\r\n elImage = document.createElement( 'div' );\r\n\t let anchor = document.createElement( 'a' ),\r\n\t img = document.createElement( 'img' );\r\n anchor.style.display = 'inline-block';\r\n anchor.appendChild( img );\r\n DOMElement.classList.add( 'wptb-image-container' );\r\n elImage.classList.add( 'wptb-image-wrapper' );\r\n elImage.appendChild( anchor );\r\n DOMElement.appendChild( elImage );\r\n \r\n anchor.onclick = function( e ) {\r\n e.preventDefault();\r\n }\r\n \r\n file_frame = wp.media.frames.file_frame = wp.media({\r\n\t\ttitle: 'Select a image to upload',\r\n\t\tbutton: {\r\n\t\t\ttext: 'Use this image'\r\n\t\t},\r\n\t\tmultiple: false\r\n });\r\n // When an image is selected, run a callback.\r\n file_frame.on('select', function () {\r\n attachment = file_frame.state().get('selection').first().toJSON();\r\n img.src = attachment.url;\r\n });\r\n // Finally, open the modal\r\n if (src == undefined) {\r\n file_frame.open();\r\n } else {\r\n img.src = src;\r\n }\r\n } else {\r\n DOMElement = DOMElementProt.cloneNode( true );\r\n \r\n DOMElement.getElementsByTagName( 'a' )[0].onclick = function(e) {\r\n e.preventDefault();\r\n };\r\n \r\n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\r\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\r\n kindIndexProt = wptbElementMutch[1];\r\n copy = true;\r\n };\r\n }\r\n \r\n this.kind = 'image';\r\n this.getDOMElement = function () {\r\n return DOMElement;\r\n };\r\n\tapplyGenericItemSettings( this, kindIndexProt, copy );\r\n\r\n\treturn this;\r\n};","var WPTB_Initializer = function () {\r\n\r\n const MIN_COLUMNS = 1,\r\n MIN_ROWS = 1,\r\n MAX_COLUMNS = 10,\r\n MAX_ROWS = 10;\r\n\r\n var tableGenerator = document.body;\r\n columnsDecrementButton = tableGenerator.getElementsByClassName('wptb-input-number-decrement')[0],\r\n columnsIncrementButton = tableGenerator.getElementsByClassName('wptb-input-number-increment')[0],\r\n rowsDecrementButton = tableGenerator.getElementsByClassName('wptb-input-number-decrement')[1],\r\n rowsIncrementButton = tableGenerator.getElementsByClassName('wptb-input-number-increment')[1],\r\n columnsInput = document.getElementById('wptb-columns-number'),\r\n rowsInput = document.getElementById('wptb-rows-number');\r\n \r\n columnsDecrementButton.onclick = function () {\r\n if (columnsInput.value > MIN_COLUMNS) {\r\n columnsInput.value--;\r\n }\r\n };\r\n\r\n columnsIncrementButton.onclick = function () {\r\n if (columnsInput.value < MAX_COLUMNS) {\r\n columnsInput.value++;\r\n }\r\n };\r\n\r\n rowsDecrementButton.onclick = function () {\r\n if (rowsInput.value > MIN_ROWS) {\r\n rowsInput.value--;\r\n }\r\n };\r\n\r\n rowsIncrementButton.onclick = function () {\r\n if (rowsInput.value < MAX_ROWS) {\r\n rowsInput.value++;\r\n }\r\n };\r\n\r\n document.getElementById('wptb-generate-table').onclick = function () {\r\n var columns = document.getElementById('wptb-columns-number').value,\r\n rows = document.getElementById('wptb-rows-number').value;\r\n\r\n WPTB_Table(columns, rows);\r\n }\r\n \r\n// if( document.getElementsByClassName( 'wptb-preview-table' ).length == 0 ) {\r\n// WPTB_LeftPanel();\r\n// }\r\n\r\n};\r\n","var WPTB_innerElementSet = function ( element ) {\n \n function newElementProxy(el) {\n if (el == 'list') {\n return new WPTB_List();\n } else if (el == 'image') {\n return new WPTB_Image();\n } else if (el == 'text') {\n return new WPTB_Text();\n } else if (el == 'button') {\n return new WPTB_Button();\n }\n }\n \n element.ondragenter = function (e) {\n var div;\n if ( e.dataTransfer.types.indexOf( 'wptbelement' ) == -1 && e.dataTransfer.types.indexOf( 'wptb-moving-mode' ) == -1 ) {\n return;\n }\n WPTB_DropHandle(this, e);\n \n element.classList.add( 'wptb-ondragenter' );\n }\n element.ondragover = function (e) {\n e.preventDefault();\n WPTB_DropHandle(this, e);\n }\n element.ondragleave = function () {\n \n }\n element.ondrop = function(e) {\n this.classList.remove( 'wptb-ondragenter' );\n let element, classId;\n e.preventDefault();\n e.stopPropagation();\n\n if (!e.dataTransfer.getData('wptbElement') && !e.dataTransfer.getData('node')) {\n return;\n }\n let wptbDropHandle,\n wptbDropBorderMarker;\n if ( document.getElementsByClassName( 'wptb-drop-handle' ).length > 0 ) {\n wptbDropHandle = document.getElementsByClassName( 'wptb-drop-handle' )[0];\n }\n if( document.getElementsByClassName( 'wptb-drop-border-marker' ).length > 0 ) {\n wptbDropBorderMarker = document.getElementsByClassName( 'wptb-drop-border-marker' )[0];\n }\n\n if ( e.dataTransfer.getData( 'wptbElement' ) ) {\n element = newElementProxy( e.dataTransfer.getData( 'wptbElement' ) );\n element = element.getDOMElement();\n } else {\n classId = e.dataTransfer.getData( 'node' );\n element = document.getElementsByClassName( classId )[0];\n element.classList.remove( 'wptb-moving-mode' );\n }\n \n if( wptbDropHandle.style.display == 'block' ) {\n let td;\n if( wptbDropHandle.dataset.text == 'Drop Here' ) {\n td = wptbDropHandle.getDOMParentElement();\n td.appendChild( element );\n } else {\n let innerElement = wptbDropHandle.getDOMParentElement();\n td = innerElement.parentNode;\n\n if( wptbDropHandle.dataset.text == 'Abowe Element' ) {\n td.insertBefore( element, innerElement );\n } else if( wptbDropHandle.dataset.text == 'Below Element' ) {\n let innerElementNext = innerElement.nextSibling;\n td.insertBefore( element, innerElementNext );\n }\n }\n let thisRow = td.parentNode\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\n WPTB_Helper.dataTitleColumnSet( table );\n }\n \n } else {\n return;\n }\n \n wptbDropHandle.style.display = 'none';\n wptbDropBorderMarker.style.display = 'none';\n\n WPTB_innerElementSet( element );\n\n return true;\n }\n element.onmouseover = function(e) {\n element.classList.remove( 'wptb-ondragenter' );\n }\n}","var WPTB_LeftPanel = function () {\r\n\r\n var table = document.getElementsByClassName('wptb-preview-table')[0],\r\n wptbElementButtons = document.getElementsByClassName('wptb-element');\r\n \r\n function wptbTdBgColorSavedSet( inputId, trNumber ) {\r\n if ( trNumber > 3 ) return;\r\n if( table ) {\r\n let tableRows = table.getElementsByTagName('tr');\r\n if ( tableRows.length > trNumber ) {\r\n let trBackgroundColor = tableRows[trNumber].style.backgroundColor;\r\n var wptbEvenRowBg = document.getElementById(inputId);\r\n if ( wptbEvenRowBg && trBackgroundColor ) {\r\n wptbEvenRowBg.value = WPTB_Helper.rgbToHex( trBackgroundColor );\r\n }\r\n }\r\n }\r\n \r\n }\r\n \r\n wptbTdBgColorSavedSet( 'wptb-even-row-bg', 1 );\r\n jQuery('#wptb-even-row-bg').wpColorPicker({\r\n change: function ( event, ui ) {\r\n var tableRows = table.getElementsByTagName('tr');\r\n for ( let i = 1; i < tableRows.length; i += 2 ) {\r\n tableRows[i].style.backgroundColor = ui.color.toString();\r\n }\r\n },\r\n clear: function(){\r\n var tableRows = table.getElementsByTagName('tr');\r\n for ( let i = 1; i < tableRows.length; i += 2 ) {\r\n tableRows[i].style.backgroundColor = '';\r\n let tds = tableRows[i].getElementsByTagName('td');\r\n for ( let j = 0; j < tds.length; j++ ) {\r\n tds[j].style.backgroundColor = '';\r\n }\r\n }\r\n },\r\n\r\n });\r\n \r\n wptbTdBgColorSavedSet( 'wptb-odd-row-bg', 2 );\r\n jQuery('#wptb-odd-row-bg').wpColorPicker({\r\n change: function ( event, ui ) {\r\n var tableRows = table.getElementsByTagName('tr');\r\n for ( let i = 2; i < tableRows.length; i += 2 ) {\r\n tableRows[i].style.backgroundColor = ui.color.toString();\r\n }\r\n },\r\n clear: function(){\r\n var tableRows = table.getElementsByTagName('tr');\r\n for ( let i = 2; i < tableRows.length; i += 2 ) {\r\n tableRows[i].style.backgroundColor = '';\r\n let tds = tableRows[i].getElementsByTagName( 'td' );\r\n for ( var j = 0; j < tds.length; j++ ) {\r\n tds[j].style.backgroundColor = '';\r\n }\r\n }\r\n },\r\n });\r\n \r\n wptbTdBgColorSavedSet( 'wptb-table-header-bg', 0 );\r\n jQuery('#wptb-table-header-bg').wpColorPicker({\r\n change: function (event, ui) {\r\n var tableHeader = table.getElementsByTagName('tr')[0];\r\n tableHeader.style.backgroundColor = ui.color.toString();\r\n },\r\n clear: function(){\r\n var tableHeader = table.getElementsByTagName('tr')[0];\r\n tableHeader.style.backgroundColor = '';\r\n let tds = tableHeader.getElementsByTagName('td');\r\n for (var j = 0; j < tds.length; j++) {\r\n tds[j].style.backgroundColor = '';\r\n }\r\n },\r\n });\r\n \r\n function tableAdaptiveForMobile( table ) {\r\n let wptbAdaptiveTableCheckbox = document.getElementById( 'wptb-adaptive-table-checkbox' );\r\n if( table && table.dataset.wptbAdaptiveTable ) {\r\n wptbAdaptiveTableCheckbox.checked = true;\r\n } else {\r\n wptbAdaptiveTableCheckbox.checked = false;\r\n }\r\n }\r\n tableAdaptiveForMobile( table );\r\n \r\n function tableTopRowAsHeadSavedSet( table ) {\r\n let wptbTopRowAsHeader = document.getElementById( 'wptb-top-row-as-header' );\r\n \r\n if( table && table.classList.contains( 'wptb-table-preview-head' ) ) {\r\n wptbTopRowAsHeader.checked = true;\r\n } else {\r\n wptbTopRowAsHeader.checked = false;\r\n }\r\n }\r\n tableTopRowAsHeadSavedSet( table );\r\n \r\n function tableBorderColorWidthSavedSet() {\r\n let table = document.getElementsByClassName('wptb-preview-table');\r\n if ( table.length > 0 ) {\r\n let tableBorderColor = table[0].style.borderColor;\r\n if ( tableBorderColor ) {\r\n let tableBorderColorInput = document.getElementById( 'wptb-table-border-color' );\r\n if ( tableBorderColorInput ) {\r\n tableBorderColorInput.value = WPTB_Helper.rgbToHex( tableBorderColor );\r\n }\r\n }\r\n \r\n let tableBorderWidth = table[0].style.borderWidth;\r\n if ( tableBorderWidth ) {\r\n let wptbTableBorderWidthSlider = document.getElementById('wptb-table-border-slider'),\r\n wptbTableBorderWidthNumber = document.getElementById('wptb-table-border-number');\r\n \r\n if ( wptbTableBorderWidthSlider ) {\r\n wptbTableBorderWidthSlider.value = parseInt( tableBorderWidth );\r\n }\r\n if ( wptbTableBorderWidthNumber ) {\r\n wptbTableBorderWidthNumber.value = parseInt( tableBorderWidth );\r\n }\r\n }\r\n \r\n \r\n let tableTd = table[0].querySelector( 'td' );\r\n let applyInnerBorder = tableTd.style.borderWidth;\r\n if ( applyInnerBorder ) {\r\n let innerBorderCheckInput = document.getElementById( 'wptb-inner-border-check' );\r\n let wptbApplyInnerBorder = document.getElementById( 'wptb-apply-inner-border' );\r\n if ( applyInnerBorder && parseInt( applyInnerBorder ) > 0 ) {\r\n if ( innerBorderCheckInput ) {\r\n innerBorderCheckInput.checked = true;\r\n \r\n if ( wptbApplyInnerBorder ) {\r\n wptbApplyInnerBorder.classList.add( 'visible' );\r\n let wptbTableInnerBorderSlider = document.getElementById( 'wptb-table-inner-border-slider' );\r\n let wptbTableInnerBorderNumber = document.getElementById( 'wptb-table-inner-border-number' );\r\n wptbTableInnerBorderSlider.value = parseInt( applyInnerBorder );\r\n wptbTableInnerBorderNumber.value = parseInt( applyInnerBorder );\r\n }\r\n }\r\n } else {\r\n innerBorderCheckInput.checked = false;\r\n }\r\n }\r\n \r\n if ( ( tableBorderWidth && parseInt( tableBorderWidth ) > 0 ) || ( applyInnerBorder && parseInt( applyInnerBorder ) > 0 ) ) {\r\n document.getElementById( 'wptb-table-border-color-set-area' ).style.display = '';\r\n }\r\n }\r\n }\r\n \r\n tableBorderColorWidthSavedSet();\r\n\r\n jQuery('#wptb-table-border-color').wpColorPicker({\r\n change: function (event, ui) {\r\n var tableCells = table.getElementsByTagName('td');\r\n table.style.border = document.querySelector('#wptb-table-border-number').value + 'px solid ' + ui.color.toString();\r\n\r\n for (var i = 0; i < tableCells.length; i++) {\r\n let tableInnerborderNumber = document.querySelector('#wptb-table-inner-border-number').value;\r\n if ( document.getElementById('wptb-inner-border-check').checked ) {\r\n tableCells[i].style.border = ( tableInnerborderNumber != 0 ? tableInnerborderNumber : 1 ) + 'px solid ' + ui.color.toString();\r\n }\r\n }\r\n },\r\n clear: function() {\r\n var tableCells = table.getElementsByTagName('td');\r\n table.style.borderColor = '';\r\n\r\n for (var i = 0; i < tableCells.length; i++) {\r\n tableCells[i].style.borderColor = '';\r\n }\r\n }\r\n });\r\n\r\n function addInnerBorderSize(value) {\r\n var tableCells = table.getElementsByTagName('td');\r\n for (var i = 0; i < tableCells.length; i++) {\r\n tableCells[i].style.borderWidth = document.querySelector('#wptb-table-inner-border-number').value + 'px';\r\n tableCells[i].style.borderStyle = 'solid';\r\n }\r\n }\r\n\r\n function addCellPadding(value) {\r\n var tableCells = table.getElementsByTagName('td');\r\n for (var i = 0; i < tableCells.length; i++) {\r\n tableCells[i].style.padding = value + 'px';\r\n }\r\n }\r\n\r\n function addInnerBorder( checked ) {\r\n var styles, color = document.querySelector('#wptb-table-border-color').value != undefined ?\r\n document.querySelector('#wptb-table-border-color').value : 'rgb(0,0,0)';\r\n if ( document.querySelector( '#wptb-table-inner-border-slider' ).value == 0 || document.querySelector( '#wptb-table-inner-border-number' ).value == 0 ) {\r\n document.querySelector( '#wptb-table-inner-border-slider' ).value = 1;\r\n document.querySelector( '#wptb-table-inner-border-number' ).value = 1;\r\n }\r\n let width = document.querySelector( '#wptb-table-inner-border-slider' ).value + 'px';\r\n let wptbPreviewTable = document.getElementsByClassName('wptb-preview-table');\r\n if( wptbPreviewTable.length > 0 ) {\r\n if (checked == 'checked') {\r\n document.getElementById('wptb-apply-inner-border').style.marginBottom = '0px';\r\n var tableCells = wptbPreviewTable[0].getElementsByTagName( 'td' );\r\n for (var i = 0; i < tableCells.length; i++) {\r\n tableCells[i].style.border = width + ' solid ' + color;\r\n }\r\n document.getElementById( 'wptb-apply-inner-border' ).classList.add( 'visible' );\r\n } else {\r\n document.getElementById( 'wptb-apply-inner-border' ).classList.remove( 'visible' );\r\n var tableCells = wptbPreviewTable[0].getElementsByTagName( 'td' );\r\n for (var i = 0; i < tableCells.length; i++) {\r\n tableCells[i].style.border = '0px solid ' + color;\r\n tableCells[i].style.border = null;\r\n }\r\n }\r\n }\r\n \r\n }\r\n\r\n function addBorderSize( value ) {\r\n table.style.borderWidth = value + 'px';\r\n table.style.borderStyle = 'solid';\r\n }\r\n \r\n function cellPaddingSavedSet() {\r\n let table = document.getElementsByClassName('wptb-preview-table');\r\n \r\n if ( table.length > 0 ) {\r\n let td = table[0].querySelector( 'td' );\r\n \r\n if ( td ) {\r\n let padding = td.style.padding;\r\n \r\n if ( padding ) {\r\n let wptbTableCellSlider = document.getElementById('wptb-table-cell-slider'),\r\n wptbTableCellNumber = document.getElementById('wptb-table-cell-number');\r\n \r\n if ( wptbTableCellSlider ) {\r\n wptbTableCellSlider.value = parseInt( padding );\r\n }\r\n if ( wptbTableCellNumber ) {\r\n wptbTableCellNumber.value = parseInt( padding );\r\n }\r\n }\r\n }\r\n }\r\n }\r\n \r\n cellPaddingSavedSet();\r\n \r\n function numberImputSize( wptbNumberInputs, maxCount, maxValue ) {\r\n wptbNumberInputs.onkeydown = function() {\r\n let thisValue = this.value;\r\n thisValue = String( thisValue );\r\n if ( thisValue[0] == 0 ) {\r\n this.value = \"\";\r\n } else {\r\n thisValue = thisValue.substring( 0, maxCount );\r\n this.value = thisValue;\r\n }\r\n }\r\n wptbNumberInputs.onkeyup = function() {\r\n let thisValue = this.value;\r\n thisValue = String( thisValue );\r\n if ( thisValue > maxValue ) {\r\n this.value = maxValue;\r\n }\r\n }\r\n }\r\n \r\n let wptbTableBorderNumber = document.getElementById( 'wptb-table-border-number' );\r\n numberImputSize( wptbTableBorderNumber, 1, 50 );\r\n \r\n let wptbTableInnerBorderNumber = document.getElementById( 'wptb-table-inner-border-number' );\r\n numberImputSize( wptbTableInnerBorderNumber, 1, 50 );\r\n \r\n let wptbTableCellNumber = document.getElementById( 'wptb-table-cell-number' );\r\n numberImputSize( wptbTableCellNumber, 1, 50 );\r\n \r\n let wptbTextfontSizeNumber = document.getElementById( 'wptb-text-font-size-number' );\r\n numberImputSize( wptbTextfontSizeNumber, 1, 50 );\r\n \r\n let wptbImageWidthNumber = document.getElementById( 'wptb-image-width-number' );\r\n numberImputSize( wptbImageWidthNumber, 2, 100 );\r\n \r\n let wptbTableColumnWidthNumber = document.getElementById( 'wptb-table-column-width-number' );\r\n numberImputSize( wptbTableColumnWidthNumber, 2, 500 );\r\n \r\n let wptbTableRowHeightNumber = document.getElementById( 'wptb-table-row-height-number' );\r\n numberImputSize( wptbTableRowHeightNumber, 2, 200 );\r\n \r\n \r\n \r\n document.getElementById('wptb-table-cell-slider').oninput = function () {\r\n document.getElementById('wptb-table-cell-number').value = this.value;\r\n addCellPadding(this.value);\r\n table.tdDefaultWidth();\r\n };\r\n\r\n document.getElementById('wptb-table-cell-number').onchange = function () {\r\n document.getElementById('wptb-table-cell-slider').value = this.value;\r\n addCellPadding(this.value);\r\n table.tdDefaultWidth();\r\n };\r\n\r\n document.getElementById('wptb-table-border-slider').oninput = function () {\r\n document.getElementById('wptb-table-border-number').value = this.value;\r\n addBorderSize(this.value);\r\n table.tdDefaultWidth();\r\n \r\n let wptbInnerBorderCheck = document.getElementById('wptb-inner-border-check').checked,\r\n tableBorderColorSetArea = document.getElementById( 'wptb-table-border-color-set-area' );\r\n if ( this.value == 0 && wptbInnerBorderCheck == false ) {\r\n tableBorderColorSetArea.style.display = 'none';\r\n } else {\r\n tableBorderColorSetArea.style.display = '';\r\n }\r\n };\r\n\r\n document.getElementById('wptb-table-border-number').onchange = function () {\r\n document.getElementById('wptb-table-border-slider').value = this.value;\r\n addBorderSize(this.value);\r\n table.tdDefaultWidth();\r\n };\r\n\r\n document.getElementById('wptb-table-inner-border-slider').oninput = function () {\r\n document.getElementById('wptb-table-inner-border-number').value = this.value;\r\n addInnerBorderSize(this.value);\r\n table.tdDefaultWidth();\r\n };\r\n\r\n document.getElementById('wptb-table-inner-border-number').onchange = function () {\r\n document.getElementById('wptb-table-inner-border-slider').value = this.value;\r\n addInnerBorderSize(this.value);\r\n table.tdDefaultWidth();\r\n };\r\n\r\n document.getElementById('wptb-inner-border-check').onchange = function () {\r\n if( table ) {\r\n let val = this.checked ? 'checked' : 'unchecked';\r\n addInnerBorder( val );\r\n let borderWidth = document.getElementById('wptb-table-border-slider').value,\r\n tableBorderColorSetArea = document.getElementById( 'wptb-table-border-color-set-area' );\r\n if( val == 'unchecked' && borderWidth == 0 ) {\r\n tableBorderColorSetArea.style.display = 'none';\r\n } else {\r\n tableBorderColorSetArea.style.display = '';\r\n }\r\n }\r\n \r\n };\r\n \r\n document.getElementById( 'wptb-table-column-width-slider' ).oninput = function () {\r\n document.getElementById( 'wptb-table-column-width-number' ).value = this.value;\r\n table.addColumnWidth( this.value );\r\n };\r\n \r\n document.getElementById( 'wptb-table-column-width-number' ).onchange = function () {\r\n document.getElementById( 'wptb-table-column-width-slider' ).value = this.value;\r\n table.addColumnWidth( this.value );\r\n };\r\n \r\n document.getElementById( 'wptb-table-column-width-auto-fixed' ).onchange = function () {\r\n if( this.checked ) {\r\n let highlighted = table.querySelector( '.wptb-highlighted' );\r\n let width = WPTB_Helper.getColumnWidth( table, highlighted );\r\n table.addColumnWidth( width );\r\n } else {\r\n table.addColumnWidth( false, true );\r\n let highlighted = table.querySelector( '.wptb-highlighted' );\r\n let width = WPTB_Helper.getColumnWidth( table, highlighted );\r\n document.getElementById( 'wptb-table-column-width-number' ).value = width;\r\n document.getElementById( 'wptb-table-column-width-slider' ).value = width;\r\n }\r\n };\r\n\r\n document.getElementById( 'wptb-table-row-height-slider' ).oninput = function () {\r\n document.getElementById( 'wptb-table-row-height-number' ).value = this.value;\r\n table.addRowHeight( this.value );\r\n };\r\n\r\n document.getElementById( 'wptb-table-row-height-number' ).onchange = function () {\r\n document.getElementById( 'wptb-table-row-height-slider' ).value = this.value;\r\n table.addRowHeight( this.value );\r\n };\r\n \r\n document.getElementById( 'wptb-table-row-height-auto-fixed' ).onchange = function () {\r\n if( this.checked ) {\r\n let highlighted = table.querySelector( '.wptb-highlighted' );\r\n let height = WPTB_Helper.getRowHeight( table, highlighted );\r\n table.addRowHeight( height );\r\n } else {\r\n table.addRowHeight( false, true );\r\n let highlighted = table.querySelector( '.wptb-highlighted' );\r\n let height = WPTB_Helper.getRowHeight( table, highlighted );\r\n document.getElementById( 'wptb-table-row-height-number' ).value = height;\r\n document.getElementById( 'wptb-table-row-height-slider' ).value = height;\r\n }\r\n };\r\n \r\n document.getElementById( 'wptb-adaptive-table-checkbox' ).onchange = function() {\r\n if( this.checked ) {\r\n table.dataset.wptbAdaptiveTable = 1;\r\n } else {\r\n table.dataset.wptbAdaptiveTable = 0;\r\n }\r\n };\r\n \r\n function createMobileHeadForTable( table, thisEvent ) {\r\n \r\n if( thisEvent.checked ) {\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n \r\n table.classList.add( 'wptb-table-preview-head' );\r\n table.rows[0].classList.add( 'wptb-table-head' );\r\n } else {\r\n let rows = table.rows;\r\n table.classList.remove( 'wptb-table-preview-head' );\r\n rows[0].classList.remove( 'wptb-table-head' );\r\n \r\n for ( let i = 1; i < rows.length; i++ ) {\r\n let thisRow = rows[i],\r\n thisRowChildren = thisRow.children;\r\n for( let j = 0; j < thisRowChildren.length; j++ ) {\r\n thisRowChildren[j].removeAttribute( 'data-wptb-title-column' );\r\n thisRowChildren[j].removeAttribute( 'data-wptb-title-column-font-size' );\r\n thisRowChildren[j].removeAttribute( 'data-wptb-title-column-color' );\r\n thisRowChildren[j].removeAttribute( 'data-wptb-title-background-color' );\r\n thisRowChildren[j].removeAttribute( 'data-wptb-title-align' );\r\n }\r\n }\r\n }\r\n }\r\n \r\n document.getElementById( 'wptb-top-row-as-header' ).onchange = function () {\r\n createMobileHeadForTable( table, this );\r\n }\r\n\r\n for (var i = 0; i < wptbElementButtons.length; i++) {\r\n wptbElementButtons[i].ondragstart = function (e) {\r\n e.dataTransfer.setData('wptbElement', this.dataset.wptbElement);\r\n e.dataTransfer.setData( 'wptbElIndic-' + this.dataset.wptbElement, 'wptbElIndic-' + this.dataset.wptbElement );\r\n }\r\n }\r\n \r\n if( table ) {\r\n document.getElementById('wptb-activate-cell-management-mode').onclick = table.toggleTableEditMode;\r\n document.getElementById( 'wptb-table-edit-mode-close' ).onclick = table.toggleTableEditMode;\r\n document.getElementById( 'wptb-left-scroll-panel-curtain-close' ).onclick = table.toggleTableEditMode;\r\n document.getElementById('wptb-add-end-row').onclick = table.addRowToTheEnd;\r\n document.getElementById('wptb-add-start-row').onclick = table.addRowToTheStart;\r\n document.getElementById('wptb-add-row-before').onclick = table.addRowBefore;\r\n document.getElementById('wptb-add-row-after').onclick = table.addRowAfter;\r\n document.getElementById('wptb-add-end-column').onclick = table.addColumnEnd;\r\n document.getElementById('wptb-add-start-column').onclick = table.addColumnStart;\r\n document.getElementById('wptb-add-column-before').onclick = table.addColumnBefore;\r\n document.getElementById('wptb-add-column-after').onclick = table.addColumnAfter;\r\n document.getElementById('wptb-delete-column').onclick = table.deleteColumn;\r\n document.getElementById('wptb-delete-row').onclick = table.deleteRow;\r\n document.getElementById('wptb-merge-cells').onclick = table.mergeCells;\r\n document.getElementById('wptb-split-cell').onclick = table.splitCell;\r\n }\r\n \r\n document.querySelector( '.wptb-left-panel-extend' ).onclick = function() {\r\n let wptbContainer = document.querySelector( '.wptb-container' );\r\n if( wptbContainer ) {\r\n if ( wptbContainer.classList.contains( 'collapsed' ) ) {\r\n wptbContainer.classList.remove( 'collapsed' );\r\n } else {\r\n wptbContainer.classList.add( 'collapsed' );\r\n }\r\n }\r\n };\r\n \r\n // this code hides the \"element parameters\" area \r\n // when clicked outside this element and its \"tinymce\" toolbar \r\n let wptbBuilderPanel = document.getElementsByClassName( 'wptb-builder-panel' )[0];\r\n wptbBuilderPanel.addEventListener( 'click', function( e ) {\r\n if( ! e.target.classList.contains( 'wptb-ph-element' ) && ! WPTB_Helper.findAncestor( e.target, 'wptb-ph-element' ) && \r\n ! e.target.classList.contains( 'wptb-fixed-toolbar' ) && ! WPTB_Helper.findAncestor( e.target, 'wptb-fixed-toolbar' ) ) {\r\n document.getElementsByClassName( 'wptb-elements-container' )[0].style.display = 'table';\r\n document.getElementsByClassName( 'wptb-settings-section' )[0].style.display = 'block';\r\n document.getElementById( 'element-options-group' ).style.display = 'none';\r\n let wpcdFixedToolbar = document.getElementById( 'wpcd_fixed_toolbar' );\r\n if( wpcdFixedToolbar.hasAttribute( 'data-toolbar-active-id' ) ) {\r\n document.getElementById( wpcdFixedToolbar.getAttribute( 'data-toolbar-active-id' ) ).classList.remove( 'toolbar-active' );\r\n }\r\n } \r\n }, false);\r\n \r\n};","var WPTB_List = function ( innerElements, DOMElementProt ) {\r\n\r\n var el_L = document.createElement('ul'), item,\r\n DOMElement = document.createElement('div'),\r\n kindIndexProt = undefined,\r\n copy = false;\r\n DOMElement.classList.add( 'wptb-list-item-container' );\r\n\r\n this.kind = 'list';\r\n\r\n if (innerElements === '') {\r\n //Case for edit mode list\r\n } else if ( !innerElements ) {\r\n for (var i = 0; i < 3; i++) {\r\n item = new WPTB_ListItem( '<p>List Item ' + (i + 1) + '</p>');\r\n el_L.appendChild(item.getDOMElement());\r\n }\r\n } else {\r\n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\r\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\r\n kindIndexProt = wptbElementMutch[1];\r\n copy = true;\r\n };\r\n \r\n for ( var i = 0; i < innerElements.length; i++ ) {\r\n let listItem = DOMElementProt.querySelector( 'li' );\r\n item = new WPTB_ListItem( innerElements[i], listItem, true );\r\n el_L.appendChild(item.getDOMElement());\r\n }\r\n }\r\n DOMElement.appendChild(el_L);\r\n //window.addElementOptions('list', elList);\r\n\r\n this.getDOMElement = function () {\r\n return DOMElement;\r\n }\r\n applyGenericItemSettings( this, kindIndexProt, copy );\r\n WPTB_Helper.listItemsRecalculateIndex( el_L );\r\n\r\n return this;\r\n};","var WPTB_ListItem = function ( text, DOMElementProt, copy ) {\r\n let wptbListItemReturn;\r\n if ( DOMElementProt == undefined || ( DOMElementProt && copy )) {\r\n if (text == undefined) text = 'New List Item';\r\n var DOMElement = document.createElement('li'),\r\n //divdot = document.createElement('div'),\r\n divcontent = document.createElement('div');\r\n //libullet = document.createElement('li');\r\n //divdot.classList.add('wptb-list-item-style-dot');\r\n divcontent.classList.add('wptb-list-item-content');\r\n //libullet.classList.add('wptb-bullet');\r\n if ( DOMElementProt ) {\r\n let styleDot = DOMElementProt.getAttribute( 'style' );\r\n if ( styleDot ) {\r\n DOMElement.setAttribute( 'style', styleDot );\r\n }\r\n }\r\n //DOMElement.appendChild(divdot);\r\n DOMElement.appendChild(divcontent);\r\n //divdot.appendChild(libullet);\r\n divcontent.innerHTML = text;\r\n divcontent.onkeyup = window.listItemKeyListener;\r\n \r\n wptbListItemReturn = true;\r\n } else {\r\n var DOMElement = DOMElementProt;\r\n var divcontent = DOMElement.getElementsByClassName( 'wptb-list-item-content' )[0];\r\n \r\n divcontent.onkeyup = window.listItemKeyListener;\r\n \r\n wptbListItemReturn = false;\r\n }\r\n \r\n DOMElement.onmouseenter = function (event) {\r\n\r\n var btnDelete = document.createElement('span'),\r\n btnCopy = document.createElement('span'),\r\n actions = document.createElement('span'),\r\n previous,\r\n i;\r\n actions.classList.add('wptb-actions');\r\n btnDelete.classList.add('dashicons', 'dashicons-trash', 'wptb-delete-action');\r\n btnCopy.classList.add('dashicons', 'dashicons-admin-page', 'wptb-duplicate-action');\r\n this.classList.add('wptb-directlyhovered');\r\n\r\n btnDelete.onclick = function () {\r\n var action = this.parentNode, \r\n item = this.parentNode.parentNode,\r\n parent = item.parentNode;\r\n item.removeChild( action );\r\n parent.removeChild( item );\r\n WPTB_Helper.listItemsRecalculateIndex( parent );\r\n };\r\n\r\n btnCopy.onclick = function (event) {\r\n var listItem = event.target.parentNode.parentNode,\r\n content = listItem.querySelector('.wptb-list-item-content'),\r\n html = content.innerHTML;\r\n var duplicate = new WPTB_ListItem( html, listItem, true );\r\n listItem.parentNode.insertBefore( duplicate.getDOMElement(), DOMElement );\r\n WPTB_Helper.listItemsTinyMceInit( duplicate.getDOMElement().firstChild );\r\n setTimeout( function(){\r\n divcontent.innerHTML = html;\r\n WPTB_Helper.listItemsRecalculateIndex( listItem.parentNode );\r\n }, 5 );\r\n };\r\n\r\n actions.append(btnCopy, btnDelete);\r\n this.appendChild(actions);\r\n };\r\n\r\n DOMElement.onmouseleave = function (event) {\r\n this.removeAttribute( 'class' );\r\n let iter = 0;\r\n while( event.target.querySelector( '.wptb-actions' ) && iter < 5 ) {\r\n event.target.querySelector( '.wptb-actions' ).remove();\r\n iter++;\r\n }\r\n };\r\n\r\n this.getDOMElement = function () {\r\n return DOMElement;\r\n };\r\n \r\n if ( wptbListItemReturn ) {\r\n return this;\r\n }\r\n};","var MultipleSelect = function () {\r\n\r\n\tvar selectedCells = [],\r\n\t\tmultipleCellMode = false;\r\n\r\n\tthis.activateMultipleSelectMode = function () {\r\n\t\tselectedCells = [];\r\n\t\tvar tds = document.getElementsByClassName('wptb-preview-table')[0].getElementsByTagName('td');\r\n\t\tfor (var i = 0; i < tds.length; i++) {\r\n\t\t\ttds[i].classList.remove('wptb-highlighted');\r\n\t\t}\r\n\t\tmultipleCellMode = true;\r\n\t}\r\n\r\n\tthis.deactivateMultipleSelectMode = function () {\r\n\t\tmultipleCellMode = false;\r\n\t}\r\n\r\n\tthis.isActivated = function () {\r\n\t\treturn multipleCellMode;\r\n\t}\r\n\r\n\tthis.pushSelectedCell = function (cell) {\r\n\t\tif (!multipleCellMode) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tselectedCells.push(cell);\r\n\t\tcell.classList.add('wptb-highlighted');\r\n\t};\r\n\r\n\tthis.selectedCells = function () {\r\n\t\treturn selectedCells;\r\n\t}\r\n\r\n\tthis.flushSelectedCells = function () {\r\n\t\tselectedCells = [];\r\n\t}\r\n\r\n\tthis.getFirst = function () {\r\n\t\tvar minXIndex = 1000, minYIndex = 1000, first;\r\n\t\tfor (var i = selectedCells.length - 1; i >= 0; i--) {\r\n\t\t\tif (minXIndex >= selectedCells[i].dataset.xIndex\r\n\t\t\t\t&& minYIndex >= selectedCells[i].dataset.yIndex) {\r\n\t\t\t\tfirst = selectedCells[i];\r\n\t\t\t\tminXIndex = selectedCells[i].dataset.xIndex;\r\n\t\t\t\tminYIndex = selectedCells[i].dataset.yIndex;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn first;\r\n\t}\r\n\r\n\tthis.getLast = function () {\r\n\t\tvar maxXIndex = -1, maxYIndex = -1, last;\r\n\t\tfor (var i = selectedCells.length - 1; i >= 0; i--) {\r\n\t\t\tif (maxXIndex <= selectedCells[i].dataset.xIndex\r\n\t\t\t\t&& maxYIndex <= selectedCells[i].dataset.yIndex) {\r\n\t\t\t\tlast = selectedCells[i];\r\n\t\t\t\tmaxXIndex = selectedCells[i].dataset.xIndex;\r\n\t\t\t\tmaxYIndex = selectedCells[i].dataset.yIndex;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn last;\r\n\t}\r\n\r\n\tthis.removeAllButFirst = function () {\r\n\t\tvar td = this.getFirst();\r\n\t\tfor (var i = 1; i < selectedCells.length; i++) {\r\n\t\t\tselectedCells[i].classList.add('wptb-fused-cell-' + td.dataset.xIndex + '-' + td.dataset.yIndex);\r\n\t\t}\r\n\t}\r\n\r\n\treturn this;\r\n\r\n};","var WPTB_Parser = function (code) {\n let div = document.createElement( 'div' );\n div.innerHTML = code;\n \n let table = div.children[0];\n let columnTitleMobile = [...table.querySelectorAll( '.wptb-column-title-mobile-container' )];\n \n for( let i = 0; i < columnTitleMobile.length; i++ ) {\n let parent = columnTitleMobile[i].parentNode;\n parent.removeChild( columnTitleMobile[i] );\n }\n \n let tds = table.querySelectorAll( 'td' );\n for ( let i = 0; i < tds.length; i++ ) {\n tds[i].classList.add( 'wptb-droppable' );\n tds[i].classList.remove( 'wptb-column-title-mobile-not-elements' );\n }\n \n return table;\n}","var WPTB_Parser2 = function (code) {\r\n if( Array.isArray( code ) ) {\r\n let elementHtml;\r\n \r\n if ( code.length == 1) {\r\n return elementHtml.appendChild( document.createTextNode( code[0] ) );\r\n }\r\n if( 0 in code ) {\r\n let tagName = code[0];\r\n elementHtml = document.createElement( tagName );\r\n \r\n if ( 1 in code ) {\r\n if( Array.isArray( code[1] ) ) {\r\n let attributes = code[1];\r\n \r\n for( let i = 0; i < attributes.length; i++ ) {\r\n if( Array.isArray( attributes[i] ) ) {\r\n elementHtml.setAttribute(attributes[i][0], attributes[i][1]);\r\n }\r\n }\r\n }\r\n }\r\n \r\n if ( 2 in code ) {\r\n if ( Array.isArray( code[2] ) ) {\r\n for ( let i = 0; i < code[2].length; i++ ) {\r\n if ( typeof code[2][i] === 'string' && tagName.toLowerCase() == 'p' ) {\r\n elementHtml.appendChild( document.createTextNode( code[2][i] ) );\r\n continue;\r\n }\r\n if ( ! WPTB_Parser( code[2][i] ) ) continue;\r\n elementHtml.appendChild( WPTB_Parser( code[2][i] ) );\r\n }\r\n } else if( typeof code[2] === 'string' ) {\r\n elementHtml.appendChild( document.createTextNode( code[2] ) );\r\n }\r\n \r\n }\r\n }\r\n \r\n return elementHtml;\r\n } else {\r\n return false;\r\n }\r\n \r\n}","var WPTB_Settings = function () {\r\n var elems = document.getElementsByClassName('wptb-element');\r\n\r\n for ( var i = 0; i < elems.length; i++ ) {\r\n elems[i].ondragstart = function ( event ) {\r\n event.dataTransfer.effectAllowed = 'move';\r\n event.dataTransfer.setData( 'wptbElement', event.target.dataset.wptbElement );\r\n event.dataTransfer.setData( 'wptbElIndic-' + event.target.dataset.wptbElement, 'wptbElIndic-' + event.target.dataset.wptbElement );\r\n }\r\n elems[i].ondragend = function () {\r\n let wptbDropHandle = document.querySelector( '.wptb-drop-handle' ),\r\n wptbDropBorderMarker = document.querySelector( '.wptb-drop-border-marker' );\r\n if ( wptbDropHandle || wptbDropBorderMarker ) {\r\n wptbDropHandle.style.display = 'none';\r\n wptbDropBorderMarker.style.display = 'none';\r\n }\r\n }\r\n };\r\n \r\n let shortcodePopupWindow = document.getElementsByClassName( 'wptb-popup-window-modal' )[0];\r\n document.getElementsByClassName( 'wptb-embed-btn' )[0].onclick = function () {\r\n if( ! this.classList.contains( 'wptb-button-disable' ) ) {\r\n shortcodePopupWindow.classList.add( 'wptb-popup-show' );\r\n }\r\n }\r\n \r\n document.getElementsByClassName( 'wptb-popup-dark-area' )[0].onclick = function () {\r\n shortcodePopupWindow.classList.remove( 'wptb-popup-show' );\r\n }\r\n \r\n document.getElementsByClassName( 'wptb-popup-window-close-icon' )[0].onclick = function () {\r\n shortcodePopupWindow.classList.remove( 'wptb-popup-show' );\r\n }\r\n \r\n document.getElementsByClassName( 'wptb-preview-btn' )[0].onclick = function ( e ) {\r\n if( this.classList.contains( 'wptb-button-disable' ) ) {\r\n e.preventDefault();\r\n }\r\n }\r\n\r\n document.getElementsByClassName( 'wptb-save-btn' )[0].onclick = function () {\r\n let bar = document.querySelector( '.wptb-edit-bar' );\r\n if ( bar && bar.classList.contains( 'visible' ) ) {\r\n let table = document.getElementsByClassName( 'wptb-preview-table' )[0];\r\n table.toggleTableEditMode();\r\n }\r\n\r\n let http = new XMLHttpRequest(),\r\n url = ( wptb_admin_object ? wptb_admin_object.ajaxurl : ajaxurl ) + \"?action=save_table\",\r\n t = document.getElementById( 'wptb-setup-name' ).value.trim(),\r\n messagingArea,\r\n code = document.getElementsByClassName( 'wptb-preview-table' );\r\n if( code.length > 0 ) {\r\n code = WPTB_Stringifier( code[0] );\r\n code = code.outerHTML;\r\n } else { \r\n code = '';\r\n }\r\n \r\n if ( t === '' || code === '' ) {\r\n let messagingAreaText = '';\r\n if( t === '' ) messagingAreaText += 'You must assign a name to the table before saving it.</br>';\r\n if( code === '' ) messagingAreaText += 'Table wasn\\'t created';\r\n messagingArea = document.getElementById( 'wptb-messaging-area' );\r\n messagingArea.innerHTML = '<div class=\"wptb-error wptb-message\">Error: ' + messagingAreaText + '</div>';\r\n messagingArea.classList.add( 'wptb-warning' );\r\n setTimeout(function () {\r\n messagingArea.removeChild( messagingArea.firstChild );\r\n }, 4000 );\r\n return;\r\n }\r\n\r\n let params = {\r\n title: t,\r\n content: code,\r\n security_code: wptb_admin_object.security_code\r\n };\r\n if (( rs = WPTB_Helper.detectMode() ) || ( rs = document.wptbId )) {\r\n params.id = rs;\r\n }\r\n params = JSON.stringify( params );\r\n\r\n http.open('POST', url, true);\r\n http.setRequestHeader( 'Content-type', 'application/json; charset=utf-8' );\r\n\r\n http.onreadystatechange = function (action) {\r\n if ( this.readyState == 4 && this.status == 200 ) {\r\n var data = JSON.parse( http.responseText );\r\n messagingArea = document.getElementById( 'wptb-messaging-area' );\r\n\r\n if ( data[0] == 'saved' ) {\r\n document.wptbId = data[1];\r\n messagingArea.innerHTML = '<div class=\"wptb-success wptb-message\">Table \"' + t + '\" was successfully saved.</div>';\r\n document.getElementsByClassName( 'wptb-embed-btn' )[0].classList.remove( 'wptb-button-disable' );\r\n document.getElementById( 'wptb-embed-shortcode' ).value = '[wptb id=' + data[1] + ']';\r\n let wptbPreviewBtn = document.getElementsByClassName( 'wptb-preview-btn' );\r\n if( wptbPreviewBtn.length > 0 ) {\r\n wptbPreviewBtn = wptbPreviewBtn[0];\r\n wptbPreviewBtn.classList.remove( 'wptb-button-disable' );\r\n let wptbPreviewBtnHref = wptbPreviewBtn.dataset.previewHref;\r\n wptbPreviewBtnHref = wptbPreviewBtnHref.replace( 'empty', data[1] );\r\n wptbPreviewBtn.setAttribute( 'href', wptbPreviewBtnHref );\r\n }\r\n \r\n } else if( data[0] == 'edited' ) {\r\n messagingArea.innerHTML = '<div class=\"wptb-success wptb-message\">Table \"' + t + '\" was successfully updated.</div>';\r\n } else {\r\n messagingArea.innerHTML = '<div class=\"wptb-error wptb-message\">Safety problems</div>';\r\n }\r\n messagingArea.classList.add( 'wptb-success' );\r\n setTimeout( function () {\r\n messagingArea.removeChild( messagingArea.firstChild );\r\n }, 4000 );\r\n }\r\n }\r\n http.send( params );\r\n }\r\n};\r\n","var WPTB_Space = function ( elSpaceBetween ) {\r\n\r\n function newElementProxy(el) {\r\n if (el.includes('list')) {\r\n return new WPTB_List();\r\n } else if (el.includes('image')) {\r\n return new WPTB_Image();\r\n } else if (el.includes('text')) {\r\n return new WPTB_Text();\r\n } else if (el.includes('button')) {\r\n return new WPTB_Button();\r\n }\r\n }\r\n let spaceBetween;\r\n if ( ! elSpaceBetween ) {\r\n spaceBetween = document.createElement('div'), spaceBetween.classList.add('wptb-space-between');\r\n } else {\r\n spaceBetween = elSpaceBetween;\r\n }\r\n\r\n spaceBetween.ondragenter = function () {\r\n this.classList.add('visible');\r\n };\r\n spaceBetween.ondragover = function (event) {\r\n event.preventDefault();\r\n };\r\n\r\n spaceBetween.ondragleave = function () {\r\n this.classList.remove('visible');\r\n };\r\n\r\n spaceBetween.ondrop = function (event) {\r\n event.stopPropagation();\r\n\r\n var p = event.target.nextSibling,\r\n td = event.target,\r\n element, t_space, spaceParent;\r\n\r\n while ( !td.classList.contains('wptb-droppable') ) {\r\n td = td.parentNode;\r\n }\r\n\r\n if (event.dataTransfer.getData('wptbElement')) {\r\n element = newElementProxy(event.dataTransfer.getData('wptbElement'));\r\n this.classList.remove('visible');\r\n\r\n if (p == null) {\r\n td.appendChild(element.getDOMElement());\r\n td.appendChild(new WPTB_Space());\r\n } else {\r\n td.insertBefore(element.getDOMElement(), p);\r\n td.insertBefore(new WPTB_Space(), p);\r\n }\r\n\r\n } else {\r\n alert(event.dataTransfer.getData('node'));\r\n element = document.getElementsByClassName(event.dataTransfer.getData('node'))[0];\r\n t_space = element.nextSibling;\r\n spaceParent = element.parentNode;\r\n if (t_space != undefined) {\r\n spaceParent.removeChild(t_space);\r\n }\r\n\r\n if (p == null) {\r\n td.appendChild(element);\r\n td.appendChild(new WPTB_Space());\r\n } else {\r\n td.insertBefore(element, p);\r\n td.insertBefore(new WPTB_Space(), p);\r\n }\r\n\r\n }\r\n this.classList.remove('visible');\r\n };\r\n \r\n if ( ! elSpaceBetween ) {\r\n return spaceBetween;\r\n }\r\n};","var WPTB_Stringifier = function ( codeMain ) {\r\n if ( codeMain ) {\r\n let code = codeMain.cloneNode( true );\r\n code.classList.add( 'wptb-table-preview-static-indic' );\r\n code.dataset.tableColumns = codeMain.columns;\r\n code.style.width = null;\r\n code.style.minWidth = null;\r\n code.style.maxWidth = null;\r\n \r\n let tds = code.getElementsByTagName( 'td' );\r\n if ( tds.length > 0 ) {\r\n for ( let i = 0; i < tds.length; i++ ) {\r\n \r\n if ( codeMain.querySelector( 'wptb-table-preview-head' ) ) {\r\n tds[i].removeAttribute( 'data-x-index' );\r\n }\r\n tds[i].removeAttribute( 'data-y-index' );\r\n tds[i].removeAttribute( 'draggable' );\r\n tds[i].classList.remove( 'wptb-droppable' );\r\n let innerElements = tds[i].getElementsByClassName( 'wptb-ph-element' );\r\n \r\n if ( innerElements.length > 0 ) {\r\n for ( let j = 0; j < innerElements.length; j++ ) {\r\n innerElements[j].classList.remove( 'wptb-directlyhovered' );\r\n \r\n let mceContentBodys = innerElements[j].querySelectorAll( '.mce-content-body' );\r\n if( mceContentBodys.length > 0 ) {\r\n for ( let k = 0; k < mceContentBodys.length; k++ ) {\r\n mceContentBodys[k].classList.remove( 'mce-content-body' );\r\n }\r\n }\r\n \r\n let dataMceStyle = innerElements[j].querySelectorAll( '[data-mce-style]' );\r\n if ( dataMceStyle.length > 0 ) {\r\n for ( let k = 0; k < dataMceStyle.length; k++ ) {\r\n dataMceStyle[k].removeAttribute( 'data-mce-style' );\r\n }\r\n }\r\n \r\n let contentEditable = innerElements[j].querySelectorAll( '[contenteditable]' );\r\n if ( contentEditable.length > 0 ) {\r\n for ( let k = 0; k < contentEditable.length; k++ ) {\r\n contentEditable[k].removeAttribute( 'contenteditable' );\r\n }\r\n }\r\n \r\n let spellCheck = innerElements[j].querySelectorAll( '[spellcheck]' );\r\n if ( spellCheck.length > 0 ) {\r\n for ( let k = 0; k < spellCheck.length; k++ ) {\r\n spellCheck[k].removeAttribute( 'spellcheck' );\r\n }\r\n }\r\n \r\n let mceIds = innerElements[j].querySelectorAll( '[id^=mce_]' );\r\n if ( mceIds.length > 0 ) {\r\n for ( let k = 0; k < mceIds.length; k++ ) {\r\n mceIds[k].removeAttribute( 'id' );\r\n }\r\n }\r\n \r\n let wptbActions = innerElements[j].querySelectorAll( '.wptb-actions' );\r\n let wptbActionsLength = wptbActions.length;\r\n while ( wptbActionsLength > 0 ) {\r\n if( wptbActions[0] && wptbActions[0].parentNode ) {\r\n wptbActions[0].parentNode.removeChild( wptbActions[0] );\r\n wptbActionsLength--;\r\n } else {\r\n break;\r\n }\r\n \r\n } \r\n }\r\n }\r\n \r\n if( tds[i].hasAttribute( 'data-wptb-title-column' ) ) {\r\n let columnNameDivContainer = document.createElement( 'div' ),\r\n columnNameDiv = document.createElement( 'div' );\r\n columnNameDivContainer.classList.add( 'wptb-column-title-mobile-container' );\r\n columnNameDiv.classList.add( 'wptb-column-title-mobile' );\r\n columnNameDiv.dataset.wptbTitleColumn = tds[i].dataset.wptbTitleColumn;\r\n columnNameDiv.setAttribute( 'style', 'font-size:' + tds[i].dataset.wptbTitleColumnFontSize + '; \\n\\\r\n color:' + tds[i].dataset.wptbTitleColumnColor + '; background-color:' + tds[i].dataset.wptbTitleBackgroundColor + '; text-align:' + tds[i].dataset.wptbTitleAlign + ';' );\r\n columnNameDiv.style.padding = tds[i].style.padding;\r\n if( tds[i].children.length == 0 ) {\r\n tds[i].classList.add( 'wptb-column-title-mobile-not-elements' );\r\n }\r\n columnNameDivContainer.appendChild( columnNameDiv );\r\n tds[i].insertBefore( columnNameDivContainer, tds[i].firstChild );\r\n }\r\n }\r\n }\r\n \r\n return code;\r\n }\r\n}","var WPTB_Stringifier2 = function ( node, start = false ) {\r\n\r\n\tif ( node == undefined ) {\r\n\t\treturn '';\r\n\t} else if ( node.tagName == undefined && node.nodeType == 3 ) {\r\n return node.nodeValue;\r\n }\r\n \r\n let code = [],\r\n children,\r\n int_elem_arr = false,\r\n attributes = [...node.attributes],\r\n attributes_list = [],\r\n internal_elements = [];\r\n if ( ( node.parentNode.classList.contains( 'wptb-list-item-content' ) || \r\n node.parentNode.classList.contains( 'mce-content-body' ) ) && \r\n node.tagName.toLowerCase() == 'p' ) {\r\n children = node.childNodes;\r\n int_elem_arr = true;\r\n } else if( node.children.length > 0 ) {\r\n children = node.children;\r\n } else {\r\n children = node.childNodes;\r\n }\r\n if ( attributes.length > 0 ) {\r\n for ( let i = 0; i < attributes.length; i++ ) {\r\n attributes_list[i] = [attributes[i].name, attributes[i].value];\r\n }\r\n } else {\r\n attributes_list = '';\r\n }\r\n \r\n if ( children.length > 0 ) {\r\n for ( let i = 0; i < children.length; i++) {\r\n let inter_elem = WPTB_Stringifier(children[i]);\r\n \r\n if ( Array.isArray( inter_elem ) || int_elem_arr ) {\r\n internal_elements[i] = inter_elem;\r\n } else if ( typeof inter_elem === 'string' && inter_elem ) {\r\n internal_elements = inter_elem;\r\n }\r\n }\r\n } else {\r\n internal_elements = '';\r\n }\r\n \r\n \r\n code.push(node.tagName.toLowerCase(), attributes_list , internal_elements);\r\n \r\n return code;\r\n}","var array = [], WPTB_Table = function (columns, rows) {\r\n\r\n /* The members of the class */\r\n var settings = document.getElementsByClassName('wptb-settings-items'),\r\n wptbTableSetup = document.getElementsByClassName(\"wptb-table-setup\")[0],\r\n table, row, cell,\r\n maxAmountOfCells,\r\n maxAmountOfRows;\r\n\r\n //HERE ARE THE PRIVATE FUNCTIONS\r\n /*\r\n * This function toggles buttons visibility in cell edit mode\r\n * (according to the amount of currently selected cells), and\r\n * highlights visually the clicked cell if it is not highlighted, or\r\n * removes highlight if clicked cell is already highlighted. \r\n * It too toggles the bits of our abstract representation.\r\n * @param Event this is the event instance of the click performed over a cell.\r\n */\r\n var mark = function ( event ) {\r\n var rs = this.rowSpan,\r\n cs = this.colSpan,\r\n markedCells,\r\n noCells = document.getElementsByClassName('wptb-no-cell-action'),\r\n singleCells = document.getElementsByClassName('wptb-single-action'),\r\n multipleCells = document.getElementsByClassName('wptb-multiple-select-action'),\r\n cellSettings = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ),\r\n position = getCoords(this),\r\n row = position[0],\r\n column = position[1];\r\n if ( ! document.select.isActivated() ) {\r\n return;\r\n }\r\n if (this.className.match(/wptb-highlighted/)) {\r\n this.classList.remove('wptb-highlighted');\r\n for (var i = 0; i < rs; i++) {\r\n for (var j = 0; j < cs; j++) {\r\n array[row + i][column + j] = 0;\r\n }\r\n }\r\n } else {\r\n this.classList.add('wptb-highlighted');\r\n for (var i = 0; i < rs; i++) {\r\n for (var j = 0; j < cs; j++) {\r\n array[row + i][column + j] = 1;\r\n }\r\n }\r\n }\r\n\r\n markedCells = document.getElementsByClassName('wptb-highlighted').length;\r\n if (markedCells === 0) {\r\n for (var i = 0; i < multipleCells.length; i++) {\r\n multipleCells[i].classList.remove('visible');\r\n multipleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n for (var i = 0; i < noCells.length; i++) {\r\n noCells[i].classList.add('visible');\r\n noCells[i].removeAttribute('disabled');\r\n }\r\n for (var i = 0; i < singleCells.length; i++) {\r\n singleCells[i].classList.remove('visible');\r\n singleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n cellSettings.classList.remove( 'visible' );\r\n } else if (markedCells === 1) {\r\n for (var i = 0; i < multipleCells.length; i++) {\r\n multipleCells[i].classList.remove('visible');\r\n multipleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n for (var i = 0; i < noCells.length; i++) {\r\n noCells[i].classList.remove('visible');\r\n noCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n for (var i = 0; i < singleCells.length; i++) {\r\n singleCells[i].classList.add('visible');\r\n singleCells[i].removeAttribute('disabled');\r\n }\r\n let cellHighlighted = document.querySelector( '.wptb-highlighted' );\r\n if( cellHighlighted ) {\r\n let wptbTableColumnWidthSlider = document.getElementById( 'wptb-table-column-width-slider' );\r\n let wptbTableColumnWidthNumber = document.getElementById( 'wptb-table-column-width-number' );\r\n let tableColumnWidthAutoFixedCheckbox = document.getElementById( 'wptb-table-column-width-auto-fixed' );\r\n let width = cellHighlighted.style.width;\r\n if( width ) {\r\n wptbTableColumnWidthSlider.value = parseFloat( width, 10 );\r\n wptbTableColumnWidthNumber.value = parseFloat( width, 10 );\r\n tableColumnWidthAutoFixedCheckbox.checked = true;\r\n } else if( cellHighlighted.dataset.wptbFixedWidth ) {\r\n wptbTableColumnWidthSlider.value = cellHighlighted.dataset.wptbFixedWidth;\r\n wptbTableColumnWidthNumber.value = cellHighlighted.dataset.wptbFixedWidth;\r\n tableColumnWidthAutoFixedCheckbox.checked = true;\r\n } else {\r\n let cellWidth = WPTB_Helper.getColumnWidth( table, cellHighlighted );\r\n wptbTableColumnWidthSlider.value = cellWidth;\r\n wptbTableColumnWidthNumber.value = cellWidth;\r\n tableColumnWidthAutoFixedCheckbox.checked = false;\r\n }\r\n \r\n \r\n let wptbTableRowHeightSlider = document.getElementById( 'wptb-table-row-height-slider' );\r\n let wptbTableRowHeightNumber = document.getElementById( 'wptb-table-row-height-number' );\r\n let tableRowHeightAutoFixedCheckbox = document.getElementById( 'wptb-table-row-height-auto-fixed' );\r\n let height = cellHighlighted.style.height;\r\n if( height ) {\r\n wptbTableRowHeightSlider.value = parseFloat( height, 10 );\r\n wptbTableRowHeightNumber.value = parseFloat( height, 10 );\r\n tableRowHeightAutoFixedCheckbox.checked = true;\r\n } else if( cellHighlighted.dataset.wptbFixedHeight ) {\r\n wptbTableRowHeightSlider.value = cellHighlighted.dataset.wptbFixedHeight;\r\n wptbTableRowHeightNumber.value = cellHighlighted.dataset.wptbFixedHeight;\r\n tableRowHeightAutoFixedCheckbox.checked = true;\r\n } else {\r\n let cellHeight = WPTB_Helper.getRowHeight( table, cellHighlighted );\r\n wptbTableRowHeightSlider.value = cellHeight;\r\n wptbTableRowHeightNumber.value = cellHeight;\r\n tableRowHeightAutoFixedCheckbox.checked = false;\r\n }\r\n }\r\n cellSettings.classList.add( 'visible' );\r\n } else {\r\n for (var i = 0; i < multipleCells.length; i++) {\r\n if (table.isSquare(array)) {\r\n multipleCells[i].classList.add('visible');\r\n multipleCells[i].removeAttribute('disabled');\r\n } else {\r\n multipleCells[i].classList.remove('visible');\r\n multipleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n }\r\n for (var i = 0; i < noCells.length; i++) {\r\n noCells[i].classList.remove('visible');\r\n noCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n for (var i = 0; i < singleCells.length; i++) {\r\n singleCells[i].classList.remove('visible');\r\n singleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n cellSettings.classList.remove( 'visible' );\r\n }\r\n };\r\n\r\n /* \r\n * This function fills an array with 1's according to the actual design\r\n * of HTML table.\r\n * @returns an array of arrays containing an abstract representation\r\n * of HTML table.\r\n * @deprecated\r\n * */\r\n\r\n var realTimeArray = function () {\r\n var carried = [], tds, cols, matriz = [];\r\n\r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n carried[i] = 0;\r\n }\r\n\r\n for (var i = 0; i < table.rows.length; i++) {\r\n cols = [];\r\n\r\n var tds = table.rows[i].getElementsByTagName('td');\r\n\r\n for (items = 0; items < tds.length; items++) {\r\n\r\n for (var k = 0; k < tds[items].colSpan; k++) {\r\n cols.push(1);\r\n }\r\n\r\n if (tds[items].rowSpan > 1) {\r\n for (var k = 0; k < tds[items].colSpan; k++) {\r\n carried[items + k] = {\r\n justAssigned: true,\r\n amount: tds[items].rowSpan\r\n };\r\n }\r\n }\r\n }\r\n\r\n for (var k = 0; k < maxAmountOfCells; k++) {\r\n if (typeof carried[k] == 'object' && carried[k].amount > 0) {\r\n carried[k].amount--;\r\n if (carried[k].justAssigned) {\r\n carried[k].justAssigned = false;\r\n } else {\r\n cols.push(1);\r\n }\r\n }\r\n }\r\n\r\n matriz.push(cols);\r\n\r\n }\r\n return matriz;\r\n };\r\n\r\n /*\r\n * This function gets the number and position of cell spaces in current row that are occuped \r\n * by upper rowspanned cells.\r\n * @param number the number of row where we wish to calculate the carried rowspans up to.\r\n * @return an array with the remaining rowspans in each column.\r\n */\r\n var carriedRowspans = function (row) {\r\n var carried = [], tds, cols;\r\n\r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n carried[i] = 0;\r\n }\r\n\r\n if (row == -1) {\r\n return carried;\r\n }\r\n\r\n for (var i = 0; i <= row; i++) {\r\n cellsBuffer = table.rows[i].getElementsByTagName('td');\r\n cellPointer = 0;\r\n\r\n for (var xPosition = 0; xPosition < maxAmountOfCells; xPosition += stepsToMove) {\r\n stepsToMove = 1;\r\n\r\n if (carried[xPosition]) {\r\n carried[xPosition]--;\r\n } else {\r\n celda = cellsBuffer[cellPointer++];\r\n if (celda.rowSpan > 1) {\r\n for (k = 0; k < celda.colSpan; k++) {\r\n carried[xPosition + k] = celda.rowSpan - 1;\r\n }\r\n stepsToMove = celda.colSpan;\r\n } else if (celda.colSpan > 1) {\r\n stepsToMove = celda.colSpan;\r\n }\r\n }\r\n }\r\n\r\n }\r\n return carried;\r\n };\r\n\r\n /*\r\n * A helpful function for showing\r\n * the abstract table in console.\r\n * @param Array our abstract table.\r\n */\r\n var drawTable = function (a) {\r\n var string = 'DRAWING TABLE:\\n';\r\n for (var i = 0; i < a.length; i++) {\r\n\r\n for (var j = 0; j < a[i].length; j++) {\r\n string += ' ' + a[i][j];\r\n }\r\n string += '\\n';\r\n }\r\n table.isSquare(a);\r\n };\r\n\r\n /*\r\n * It resets all the bits of our abstract representation\r\n * to 0 and removes the highlighting class of all cells.\r\n */\r\n\r\n var undoSelect = function () {\r\n var noCells = document.getElementsByClassName('wptb-no-cell-action'),\r\n singleCells = document.getElementsByClassName('wptb-single-action'),\r\n multipleCells = document.getElementsByClassName('wptb-multiple-select-action'),\r\n tds = table.getElementsByClassName('wptb-highlighted');\r\n while (tds.length) {\r\n tds[0].classList.remove('wptb-highlighted');\r\n }\r\n for (var i = 0; i < array.length; i++) {\r\n for (var j = 0; j < array[i].length; j++) {\r\n array[i][j] = 0;\r\n }\r\n }\r\n for (var i = 0; i < multipleCells.length; i++) {\r\n multipleCells[i].classList.remove('visible');\r\n multipleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n for (var i = 0; i < noCells.length; i++) {\r\n noCells[i].classList.add('visible');\r\n noCells[i].removeAttribute('disabled');\r\n }\r\n for (var i = 0; i < singleCells.length; i++) {\r\n singleCells[i].classList.remove('visible');\r\n singleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n };\r\n\r\n /*\r\n * This fills the abstract representation of our table with \r\n * zeros, at the start. the max amount of cells is the greatest sum\r\n * of all colspans for row.\r\n */\r\n\r\n var fillTableArray = function () {\r\n var colspansSums = [], a = [];\r\n\r\n //calculate max amount of cells inside a row\r\n for (var i = 0; i < table.rows.length; i++) {\r\n var cells = table.rows[i].getElementsByTagName('td'),\r\n colspanSumInRow = 0;\r\n for (var j = 0; j < cells.length; j++) {\r\n colspanSumInRow += cells[j].colSpan;\r\n }\r\n colspansSums.push(colspanSumInRow);\r\n }\r\n\r\n maxAmountOfCells = Math.max.apply(null, colspansSums);\r\n //calculate max rows\r\n var maxAmountOfRows = table.rows.length;\r\n\r\n // fill with zeros from both values\r\n for (var i = 0; i < maxAmountOfRows; i++) {\r\n a[i] = [];\r\n for (var j = 0; j < maxAmountOfCells; j++) {\r\n a[i].push(0);\r\n }\r\n }\r\n drawTable(a);\r\n return a;\r\n };\r\n\r\n /*\r\n * This function gets the sum of all colspans in a row.\r\n * @param number the number of row to be used as reference.\r\n */\r\n var getActualPointsInRow = function (row) {\r\n var tds = table.rows[row].getElementsByTagName('td'),\r\n points = 0;\r\n for (var i = 0; i < tds.length; i++) {\r\n points += tds[i].colSpan;\r\n }\r\n return points;\r\n }\r\n\r\n /*\r\n * This function gets us the exact coordinates of\r\n * an exact cell, in a more reliable way than xIndex and yIndex,\r\n * these last ones were meant to be used for getting the cell trough them.\r\n * @param DOMElement the cell to get the coordinates.\r\n */\r\n var getCoords = function (search) {\r\n var skipInCols = [], cell;\r\n\r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n skipInCols[i] = 0;\r\n }\r\n\r\n for (var i = 0; i < table.rows.length; i++) {\r\n var cellsBuffer = table.rows[i].getElementsByTagName('td');\r\n cellPointer = 0;\r\n for (var xPosition = 0; xPosition < maxAmountOfCells; xPosition += stepsToMove) {\r\n stepsToMove = 1;\r\n\r\n if (skipInCols[xPosition]) {\r\n skipInCols[xPosition]--;\r\n } else {\r\n var td = cellsBuffer[cellPointer++];\r\n if (td == search) {\r\n return [i, xPosition];\r\n }\r\n if (td.rowSpan > 1) {\r\n for ( let k = 0; k < td.colSpan; k++ ) {\r\n skipInCols[xPosition + k] = td.rowSpan - 1;\r\n }\r\n stepsToMove = td.colSpan;\r\n } else if (td.colSpan > 1) {\r\n stepsToMove = td.colSpan;\r\n }\r\n }\r\n }\r\n }\r\n };\r\n\r\n jQuery('#wptb-table-header-bg').val('');\r\n jQuery('#wptb-even-row-bg').val('');\r\n jQuery('#wptb-odd-row-bg').val('');\r\n jQuery('#wptb-table-border-color').val('');\r\n jQuery('#wptb-table-inner-border-number,#wptb-table-inner-border-slider').val('0');\r\n jQuery('#wptb-table-border-number,#wptb-table-border-slider').val('0');\r\n jQuery('#wptb-table-padding-number,#wptb-table-padding-slider').val('15');\r\n\r\n if (columns || rows) {\r\n //END OF PRIVATE FUNCTIONS\r\n for (var i = 0; i < settings.length; i++) {\r\n if (settings[i].id !== 'wptb-apply-inner-border') {\r\n settings[i].classList.add('visible');\r\n }\r\n }\r\n\r\n //Create a HTML Table element.\r\n table = document.createElement( 'table' );\r\n table.classList.add( 'wptb-preview-table' );\r\n table.dataset.reconstraction = 1;\r\n table.dataset.wptbAdaptiveTable = 1;\r\n //Add the data rows.\r\n for (var i = 0; i < rows; i++) {\r\n\r\n row = table.insertRow(-1);\r\n row.classList.add( 'wptb-row' );\r\n\r\n for (var j = 0; j < columns; j++) {\r\n cell = new WPTB_Cell(mark);\r\n cell.setCoords(i, j);\r\n row.appendChild(cell.getDOMElement());\r\n }\r\n }\r\n } else {\r\n let wptb_preview_table = document.getElementsByClassName( 'wptb-preview-table' );\r\n\r\n if (wptb_preview_table.length > 0) {\r\n table = wptb_preview_table[0];\r\n\r\n let cells = table.getElementsByTagName('td');\r\n\r\n if (cells.length > 0) {\r\n for (let i = 0; i < cells.length; i++) {\r\n WPTB_Cell(mark, cells[i]);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /*\r\n * This just toggles visibility of cell edit bar, and toggles \r\n * cell selecting mode.\r\n */\r\n\r\n table.toggleTableEditMode = function () {\r\n let bar = document.getElementsByClassName('wptb-edit-bar'),\r\n cellModeBackground = document.getElementById('wptb-cell_mode_background'),\r\n leftScrollPanelCurtain = document.getElementById('wptb-left-scroll-panel-curtain'),\r\n leftScrollPanelCellSettings = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ),\r\n wptbPreviewTable = document.getElementsByClassName('wptb-preview-table');\r\n if (wptbPreviewTable.length > 0) {\r\n wptbPreviewTable = wptbPreviewTable[0];\r\n }\r\n\r\n if ( bar.length > 0 ) {\r\n for ( let i = 0; i < bar.length; i++ ) {\r\n if ( bar[i].classList.contains( 'visible' ) ) {\r\n document.select.deactivateMultipleSelectMode();\r\n bar[i].classList.remove( 'visible' );\r\n cellModeBackground.classList.remove( 'visible' );\r\n leftScrollPanelCurtain.classList.remove( 'visible' );\r\n leftScrollPanelCellSettings.classList.remove( 'visible' );\r\n wptbPreviewTable.classList.remove( 'wptb-preview-table-manage-cells' );\r\n let wptbPreviewTableTds = wptbPreviewTable.getElementsByTagName( 'td' );\r\n if ( wptbPreviewTableTds.length > 0 ) {\r\n for ( let i = 0; i < wptbPreviewTableTds.length; i++ ) {\r\n wptbPreviewTableTds[i].classList.remove( 'wptb-highlighted' );\r\n }\r\n }\r\n } else {\r\n document.select.activateMultipleSelectMode();\r\n bar[i].classList.add( 'visible' );\r\n cellModeBackground.classList.add( 'visible' );\r\n leftScrollPanelCurtain.classList.add( 'visible' );\r\n wptbPreviewTable.classList.add( 'wptb-preview-table-manage-cells' );\r\n }\r\n }\r\n\r\n }\r\n }\r\n\r\n /*\r\n * For assigning to each cell xIndex and y Index attributes,\r\n * these are the column number and row number of cell in table. \r\n */\r\n\r\n table.recalculateIndexes = function ( start ) {\r\n let trs = this.getElementsByTagName('tr'), tds, maxCols = 0, maxColsFull = 0,\r\n tdsArr = [];\r\n let wptbTopRowAsHeader = document.getElementById( 'wptb-top-row-as-header' );\r\n \r\n for (var i = 0; i < trs.length; i++) {\r\n if ( i == 0 ) {\r\n if ( start == undefined ) {\r\n trs[i].style.backgroundColor = jQuery('#wptb-table-header-bg').val();\r\n }\r\n if( wptbTopRowAsHeader.checked ) {\r\n if( start == undefined ) {\r\n this.classList.add( 'wptb-table-preview-head' ); \r\n trs[i].classList.add( 'wptb-table-head' )\r\n } ;\r\n } else {\r\n if( start == undefined ) {\r\n this.classList.remove( 'wptb-table-preview-head' );\r\n trs[i].classList.remove( 'wptb-table-head' );\r\n }\r\n }\r\n } else {\r\n if (i % 2 == 0) {\r\n if ( start == undefined ) {\r\n trs[i].style.backgroundColor = jQuery('#wptb-odd-row-bg').val();\r\n }\r\n trs[i].classList.remove( 'wptb-table-head' );\r\n } else {\r\n if ( start == undefined ) {\r\n trs[i].style.backgroundColor = jQuery('#wptb-even-row-bg').val();\r\n }\r\n trs[i].classList.remove( 'wptb-table-head' );\r\n }\r\n }\r\n\r\n tdsArr[i];\r\n tds = trs[i].getElementsByTagName('td');\r\n\r\n if (tdsArr[i] == undefined) {\r\n tdsArr[i] = [];\r\n }\r\n\r\n let jMainIter = 0;\r\n for (var j = 0; j < tds.length; j++) {\r\n if (tdsArr[i][j] != undefined) {\r\n for (let y = 0; y < 100; y++) {\r\n if (tdsArr[i][jMainIter] != undefined) {\r\n jMainIter++;\r\n continue;\r\n }\r\n tdsArr[i][jMainIter] = tds[j];\r\n tds[j].dataset.xIndex = jMainIter;\r\n break;\r\n }\r\n } else {\r\n tdsArr[i][j] = tds[j];\r\n tds[j].dataset.xIndex = jMainIter;\r\n }\r\n tds[j].dataset.yIndex = i;\r\n\r\n if (tds[j].colSpan > 1) {\r\n for (let k = 1; k < tds[j].colSpan; k++) {\r\n jMainIter++;\r\n tdsArr[i][jMainIter] = 'tdDummy';\r\n }\r\n }\r\n\r\n if (tds[j].rowSpan > 1) {\r\n for (let x = 1; x < tds[j].rowSpan; x++) {\r\n if (tdsArr[i + x] == undefined) {\r\n tdsArr[i + x] = [];\r\n }\r\n for (let z = 0; z < tds[j].colSpan; z++) {\r\n tdsArr[i + x][jMainIter - tds[j].colSpan + 1 + z ] = 'tdDummy';\r\n }\r\n }\r\n }\r\n jMainIter++;\r\n if( i == 0 ) {\r\n maxColsFull = jMainIter;\r\n }\r\n }\r\n if (j > maxCols) {\r\n maxCols = j;\r\n }\r\n }\r\n this.columns = maxCols;\r\n this.maxCols = maxColsFull;\r\n }\r\n \r\n table.addColumnWidth = function( value, cleaner ) {\r\n let highlighted = table.getElementsByClassName( 'wptb-highlighted' );\r\n if( highlighted.length > 0 ) {\r\n for( let k = 0; k < highlighted.length; k++ ) {\r\n let dataXIndex = highlighted[k].dataset.xIndex;\r\n if( dataXIndex ) {\r\n function tableTdsFor( dataXIndex, colspan ) {\r\n let tableRows = table.rows;\r\n let widthIsSet = false;\r\n let arrayTdsFromPreviousRow = [];\r\n for( let i = 0; i < tableRows.length; i++ ) {\r\n let row = tableRows[i];\r\n let tds = row.children;\r\n for( let j = 0; j < tds.length; j++ ) {\r\n let td = tds[j];\r\n if( td.dataset.xIndex == dataXIndex ) {\r\n if( value ) {\r\n if( td.colSpan == colspan ) {\r\n td.style.width = value + 'px';\r\n td.removeAttribute( 'data-wptb-fixed-width' );\r\n widthIsSet = true;\r\n let tableColumnWidthAutoFixedCheckbox = document.getElementById( 'wptb-table-column-width-auto-fixed' );\r\n if( ! tableColumnWidthAutoFixedCheckbox.checked ) {\r\n tableColumnWidthAutoFixedCheckbox.checked = true;\r\n }\r\n } else {\r\n td.style.width = null;\r\n td.dataset.wptbFixedWidth = value;\r\n if( i == tableRows.length - 1 && ! widthIsSet ) {\r\n tableTdsFor( dataXIndex, colspan + 1 );\r\n }\r\n }\r\n } else if( cleaner ) {\r\n td.style.width = null;\r\n td.removeAttribute( 'data-wptb-fixed-width' );\r\n } else {\r\n if( td.dataset.wptbFixedWidth ) {\r\n if( td.colSpan == colspan ) {\r\n td.style.width = td.dataset.wptbFixedWidth + 'px';\r\n td.removeAttribute( 'data-wptb-fixed-width' );\r\n } \r\n } else if( td.style.width ) {\r\n for( let z = 0; z < arrayTdsFromPreviousRow.length; z++ ) {\r\n arrayTdsFromPreviousRow[z].style.width = td.style.width;\r\n }\r\n arrayTdsFromPreviousRow = [];\r\n } else {\r\n arrayTdsFromPreviousRow.push( td );\r\n }\r\n }\r\n break;\r\n } \r\n }\r\n }\r\n }\r\n \r\n tableTdsFor( dataXIndex, 1 );\r\n }\r\n }\r\n \r\n table.tdDefaultWidth();\r\n }\r\n }\r\n \r\n table.tdDefaultWidth = function() {\r\n let rows = table.rows;\r\n \r\n let tableTdsSumMaxWidth = 0;\r\n let tableTdsSumMaxWidthFixed = 0;\r\n let tableTdsSumMaxWidthAuto = 0;\r\n \r\n let wptbTableSetup = document.getElementsByClassName( 'wptb-table-setup' )[0];\r\n let wptbTableSetupWidth = wptbTableSetup.offsetWidth;\r\n \r\n let arrayCellsWidthFixedHelper = [];\r\n let arrayCellsWidthAutoHelper = [];\r\n let tdPaddingCommon = 0;\r\n let tableTdBorderCommonWidth = 0;\r\n let cssForTdsWidthAuto = '';\r\n \r\n for( let i = 0; i < rows.length; i++ ) {\r\n let tds = rows[i].children;\r\n for( let j = 0; j < tds.length; j++ ) {\r\n let td = tds[j];\r\n \r\n if( ! arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] && ! arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] ) {\r\n if( td.style.width ) {\r\n arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] = parseFloat( td.style.width );\r\n td.removeAttribute( 'data-wptb-css-td-auto-width' );\r\n } else {\r\n if( ! td.dataset.wptbFixedWidth ) {\r\n arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] = 100;\r\n td.dataset.wptbCssTdAutoWidth = true;\r\n }\r\n }\r\n \r\n if( window.getComputedStyle( td, null ) ) {\r\n let tdStyleObj = window.getComputedStyle( td, null );\r\n let tdPaddingLeft = tdStyleObj.getPropertyValue( 'padding-left' );\r\n let tdPaddingRight = tdStyleObj.getPropertyValue( 'padding-right' );\r\n tdPaddingCommon = parseFloat( tdPaddingLeft, 10 ) + parseFloat( tdPaddingRight, 10 );\r\n\r\n let tableTdBorderLeftWidth = tdStyleObj.getPropertyValue( 'border-left-width' );\r\n let tableTdBorderRightWidth = tdStyleObj.getPropertyValue( 'border-right-width' );\r\n tableTdBorderCommonWidth = parseFloat( tableTdBorderLeftWidth, 10 ) + parseFloat( tableTdBorderRightWidth, 10 );\r\n if( arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] ) {\r\n arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] += tdPaddingCommon;\r\n arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] += tableTdBorderCommonWidth;\r\n } else {\r\n arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] += tdPaddingCommon;\r\n arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] += tableTdBorderCommonWidth;\r\n }\r\n }\r\n } else if( arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] ) {\r\n if( ! td.dataset.wptbFixedWidth ) {\r\n td.dataset.wptbCssTdAutoWidth = true;\r\n }\r\n } else if( arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] ) {\r\n td.removeAttribute( 'data-wptb-css-td-auto-width' );\r\n }\r\n }\r\n }\r\n \r\n for( let i = 0; i < arrayCellsWidthFixedHelper.length; i++ ) {\r\n if( arrayCellsWidthFixedHelper[i] ) {\r\n tableTdsSumMaxWidthFixed += arrayCellsWidthFixedHelper[i];\r\n }\r\n }\r\n \r\n let CellsWidthAutoCount = 0;\r\n for( let i = 0; i < arrayCellsWidthAutoHelper.length; i++ ) {\r\n if( arrayCellsWidthAutoHelper[i] ) {\r\n tableTdsSumMaxWidthAuto += arrayCellsWidthAutoHelper[i];\r\n CellsWidthAutoCount++;\r\n }\r\n }\r\n \r\n let tableFullStyleObj = window.getComputedStyle( table, null );\r\n let borderLeftWidth = tableFullStyleObj.getPropertyValue( 'border-left-width' );\r\n let borderRightWidth = tableFullStyleObj.getPropertyValue( 'border-right-width' );\r\n let tableBorderCommon = parseFloat( borderLeftWidth, 10 ) + parseFloat( borderRightWidth, 10 );\r\n tableTdsSumMaxWidth = tableTdsSumMaxWidthFixed + tableTdsSumMaxWidthAuto + tableBorderCommon;\r\n \r\n table.dataset.wptbTableTdsSumMaxWidth = tableTdsSumMaxWidth;\r\n if( CellsWidthAutoCount ) {\r\n table.dataset.wptbCellsWidthAutoCount = CellsWidthAutoCount;\r\n if( table.mergingСellsHorizontally ) {\r\n table.dataset.wptbFixedWidthSize = tableTdsSumMaxWidthFixed - tableBorderCommon;\r\n } else {\r\n table.removeAttribute( 'data-wptb-fixed-width-size' );\r\n }\r\n } else {\r\n table.removeAttribute( 'data-wptb-fixed-width-size' );\r\n table.removeAttribute( 'data-wptb-cells-width-auto-count' );\r\n }\r\n \r\n let styleElementCreate = false;\r\n let tableTdWidthAuto;\r\n if( tableTdsSumMaxWidth < wptbTableSetupWidth ) {\r\n if( CellsWidthAutoCount ) {\r\n table.style.minWidth = '100%';\r\n if( table.mergingСellsHorizontally ) {\r\n table.style.width = null;\r\n let tableTdsWidthAutoCommon = wptbTableSetupWidth - tableTdsSumMaxWidthFixed - tableBorderCommon;\r\n tableTdWidthAuto = tableTdsWidthAutoCommon / CellsWidthAutoCount;\r\n tableTdWidthAuto = tableTdWidthAuto - tdPaddingCommon - tableTdBorderCommonWidth;\r\n styleElementCreate = true;\r\n } else {\r\n table.style.width = '100%';\r\n }\r\n } else {\r\n table.style.width = null;\r\n table.style.minWidth = null;\r\n table.style.maxWidth = tableTdsSumMaxWidth + 'px';\r\n }\r\n } else {\r\n table.style.maxWidth = null;\r\n table.style.minWidth = tableTdsSumMaxWidth + 'px';\r\n table.style.width = null;\r\n tableTdWidthAuto = '100'\r\n styleElementCreate = true;\r\n }\r\n \r\n let head = document.head;\r\n if( head ) {\r\n let cssForTdsWidthAutoOld = head.querySelector( 'style[data-wptb-td-auto-width=\"true\"]' );\r\n if( cssForTdsWidthAutoOld ) {\r\n head.removeChild( cssForTdsWidthAutoOld );\r\n }\r\n }\r\n \r\n if( styleElementCreate ) {\r\n cssForTdsWidthAuto = document.createElement( 'style' );\r\n cssForTdsWidthAuto.setAttribute( 'data-wptb-td-auto-width', true );\r\n cssForTdsWidthAuto.innerHTML = '[data-wptb-css-td-auto-width=true]{width:' + tableTdWidthAuto + 'px}';\r\n if( head ) {\r\n head.appendChild( cssForTdsWidthAuto );\r\n }\r\n }\r\n }\r\n \r\n table.addRowHeight = function( value, cleaner ) {\r\n let highlighted = table.getElementsByClassName( 'wptb-highlighted' );\r\n if( highlighted.length > 0 ) {\r\n for( let k = 0; k < highlighted.length; k++ ) {\r\n let dataYIndex = highlighted[k].dataset.yIndex;\r\n if( dataYIndex ) {\r\n function tableTdsFor( dataYIndex, rowspan ) {\r\n let tableRows = table.rows;\r\n let heightIsSet = false;\r\n let arrayTdsPrevious = [];\r\n for( let i = 0; i < tableRows.length; i++ ) {\r\n let row = tableRows[i];\r\n let tds = row.children;\r\n for( let j = 0; j < tds.length; j++ ) {\r\n let td = tds[j];\r\n if( td.dataset.yIndex == dataYIndex ) {\r\n if( value ) {\r\n if( td.rowSpan == rowspan ) {\r\n td.style.height = value + 'px';\r\n td.removeAttribute( 'data-wptb-fixed-heidht' );\r\n heightIsSet = true;\r\n let tableColumnHeightAutoFixedCheckbox = document.getElementById( 'wptb-table-row-height-auto-fixed' );\r\n if( ! tableColumnHeightAutoFixedCheckbox.checked ) {\r\n tableColumnHeightAutoFixedCheckbox.checked = true;\r\n }\r\n continue;\r\n } else {\r\n td.style.height = null;\r\n td.dataset.wptbFixedHeight = value;\r\n if( j == tds.length - 1 && ! heightIsSet ) {\r\n tableTdsFor( dataYIndex , rowspan + 1 );\r\n }\r\n }\r\n } else if( cleaner ) {\r\n td.style.height = null;\r\n td.removeAttribute( 'data-wptb-fixed-heidht' );\r\n } else {\r\n if( td.dataset.wptbFixedHeight ) {\r\n if( td.rowSpan = rowspan ) {\r\n td.style.height = td.dataset.wptbFixedHeight + 'px';\r\n td.removeAttribute( 'data-wptb-fixed-width' );\r\n }\r\n } else if( td.style.height ) {\r\n for( let z = 0; z < arrayTdsPrevious.length; z++ ) {\r\n arrayTdsPrevious[z].style.height = td.style.height;\r\n }\r\n arrayTdsPrevious = [];\r\n } else {\r\n arrayTdsPrevious.push( td );\r\n }\r\n }\r\n } \r\n }\r\n }\r\n }\r\n \r\n tableTdsFor( dataYIndex, 1 );\r\n }\r\n }\r\n }\r\n }\r\n \r\n table.reconstraction = function() {\r\n let tds = table.getElementsByTagName( 'td' );\r\n let wptbAdaptiveTableChoseBlock = document.getElementsByClassName( 'wptb-adaptive-table-chose-block' );\r\n if( wptbAdaptiveTableChoseBlock.length > 0 ) {\r\n wptbAdaptiveTableChoseBlock = wptbAdaptiveTableChoseBlock[0];\r\n }\r\n table.mergingСellsHorizontally = false;\r\n table.mergingCellsVertically = false;\r\n table.dataset.reconstraction = 1;\r\n wptbAdaptiveTableChoseBlock.style.display = 'block';\r\n let forBreak = 0;\r\n for( let i = 0; i < tds.length; i++ ) {\r\n if( tds[i].colSpan > 1 ) {\r\n table.dataset.reconstraction = 0;\r\n wptbAdaptiveTableChoseBlock.style.display = 'none';\r\n table.mergingСellsHorizontally = true;\r\n forBreak++;\r\n }\r\n \r\n if( tds[i].rowSpan > 1 ) {\r\n table.dataset.reconstraction = 0;\r\n wptbAdaptiveTableChoseBlock.style.display = 'none';\r\n table.mergingCellsVertically = true;\r\n forBreak++;\r\n }\r\n \r\n if( forBreak == 2 ) {\r\n break;\r\n }\r\n }\r\n }\r\n\r\n /*\r\n * As simple as it is: adds a column to the end of table.\r\n */\r\n table.addColumnEnd = function () {\r\n let td,\r\n currentTable = document.getElementsByClassName('wptb-preview-table'),\r\n currentTableTd,\r\n currentTdStyle;\r\n if (currentTable.length > 0) {\r\n currentTableTd = currentTable[0].querySelector('td');\r\n }\r\n\r\n if (currentTableTd) {\r\n currentTdStyle = currentTableTd.getAttribute('style');\r\n }\r\n \r\n for (var i = 0; i < table.rows.length; i++) {\r\n td = new WPTB_Cell(mark);\r\n \r\n if (currentTdStyle) {\r\n td.getDOMElement().setAttribute('style', currentTdStyle);\r\n td.getDOMElement().style.width = null;\r\n }\r\n \r\n table.rows[i].appendChild(td.getDOMElement());\r\n array[i].push(0);\r\n }\r\n \r\n maxAmountOfCells++;\r\n table.recalculateIndexes();\r\n table.tdDefaultWidth();\r\n table.addRowHeight();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n };\r\n\r\n /*\r\n * As simple as it looks: adds a column to the start of table.\r\n */\r\n\r\n table.addColumnStart = function () {\r\n let td,\r\n firstCell,\r\n currentTable = document.getElementsByClassName('wptb-preview-table'),\r\n currentTableTd,\r\n currentTdStyle;\r\n if ( currentTable.length > 0 ) {\r\n currentTableTd = currentTable[0].querySelector('td');\r\n }\r\n\r\n if ( currentTableTd ) {\r\n currentTdStyle = currentTableTd.getAttribute('style');\r\n }\r\n \r\n for (var i = 0; i < table.rows.length; i++) {\r\n td = new WPTB_Cell(mark);\r\n if (currentTdStyle) {\r\n td.getDOMElement().setAttribute('style', currentTdStyle);\r\n td.getDOMElement().style.width = null;\r\n }\r\n firstCell = table.rows[i].getElementsByTagName('td')[0];\r\n if (firstCell) {\r\n table.rows[i].insertBefore(td.getDOMElement(), firstCell);\r\n } else {\r\n table.rows[i].appendChild(td.getDOMElement());\r\n }\r\n array[i].push(0);\r\n }\r\n\r\n maxAmountOfCells++;\r\n table.recalculateIndexes();\r\n table.tdDefaultWidth();\r\n table.addRowHeight();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n };\r\n\r\n /*\r\n * Well, not so simple as previous functions.\r\n * It adds a column after a certain column of reference.\r\n * @param integer the column number to be used as reference.\r\n *\tIf empty, then the first highlighted cell is used as reference.\r\n */\r\n\r\n table.addColumnAfter = function (c_pos) {\r\n let rows = table.rows,\r\n cellPointer,\r\n cellsBuffer,\r\n cell = document.querySelector('.wptb-highlighted'),\r\n cellStyle = cell.getAttribute('style'),\r\n pos = c_pos != undefined && typeof c_pos === 'number' ? c_pos : getCoords(cell)[1];\r\n \r\n \r\n \r\n if( maxAmountOfCells - pos - cell.colSpan + 1 == 1 ) {\r\n table.addColumnEnd();\r\n } else {\r\n let pendingInsertion = false,\r\n stepsToMove,\r\n td, bro,\r\n carriedRowspans = [],\r\n currentCell;\r\n\r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n carriedRowspans.push(0);\r\n }\r\n\r\n for (var i = 0; i < rows.length; i++) {\r\n cellPointer = 0;\r\n cellsBuffer = rows[i].getElementsByTagName('td');\r\n pendingInsertion = false;\r\n for (var xPosition = 0;\r\n xPosition < maxAmountOfCells;\r\n xPosition += stepsToMove) {\r\n stepsToMove = 1;\r\n\r\n if (pendingInsertion) {\r\n td = new WPTB_Cell(mark);\r\n if (cellStyle) {\r\n td.getDOMElement().setAttribute('style', cellStyle);\r\n td.getDOMElement().style.width = null;\r\n }\r\n if (currentCell && rows[i].contains(currentCell)) {\r\n bro = currentCell.nextSibling;\r\n if (bro) {\r\n rows[i].insertBefore(td.getDOMElement(), bro);\r\n } else {\r\n rows[i].appendChild(td.getDOMElement());\r\n }\r\n } else {\r\n rows[i].insertBefore(td.getDOMElement(), cellsBuffer[0]);\r\n }\r\n break;\r\n } else if (carriedRowspans[xPosition] > 0) {\r\n // If no pending insertion, let's check if no rowspan from upper cells is pending in current position\r\n if (pos == xPosition) {\r\n pendingInsertion = true;\r\n }\r\n } else {\r\n currentCell = cellsBuffer[cellPointer++];\r\n if (currentCell.rowSpan > 1) {\r\n stepsToMove = currentCell.colSpan;\r\n for (var k = 0; k < currentCell.colSpan; k++) {\r\n carriedRowspans[xPosition + k] = currentCell.rowSpan;\r\n if (xPosition + k == pos) {\r\n pendingInsertion = true;\r\n }\r\n }\r\n } else if (currentCell.colSpan > 1) {\r\n stepsToMove = currentCell.colSpan;\r\n for (var k = 0; k < currentCell.colSpan; k++) {\r\n if (xPosition + k == pos) {\r\n pendingInsertion = true;\r\n }\r\n }\r\n } else if (xPosition == pos) {\r\n pendingInsertion = true;\r\n }\r\n }\r\n }\r\n\r\n for (var l = 0; l < maxAmountOfCells; l++) {\r\n if (carriedRowspans[l] > 0)\r\n carriedRowspans[l]--;\r\n }\r\n\r\n }\r\n\r\n for (var i = 0; i < array.length; i++) {\r\n array[i].push(0);\r\n }\r\n maxAmountOfCells++;\r\n drawTable(array);\r\n table.recalculateIndexes();\r\n table.addColumnWidth();\r\n table.addRowHeight();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n }\r\n };\r\n\r\n /*\r\n * For preventing us to take a lot of time,\r\n * This is just calling the function addColumnAfter, but\r\n * using the previous column to current one as reference.\r\n * @see addColumnAfter\r\n */\r\n\r\n table.addColumnBefore = function () {\r\n var cell = document.querySelector('.wptb-highlighted'),\r\n pos = getCoords(cell)[1];\r\n\r\n if (pos === 0) {\r\n table.addColumnStart();\r\n } else {\r\n table.addColumnAfter(pos - 1);\r\n }\r\n };\r\n\r\n /*\r\n * Luckily, thisfunction is simple, \r\n * it just add a row to the end of table.\r\n */\r\n\r\n table.addRowToTheEnd = function () {\r\n let r = table.insertRow(-1),\r\n td,\r\n aux,\r\n currentTable = document.getElementsByClassName('wptb-preview-table'),\r\n currentTableTd,\r\n currentTdStyle;\r\n r.classList.add( 'wptb-row' );\r\n if (currentTable.length > 0) {\r\n currentTableTd = currentTable[0].querySelector('td');\r\n }\r\n\r\n if (currentTableTd) {\r\n currentTdStyle = currentTableTd.getAttribute('style');\r\n }\r\n\r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n td = new WPTB_Cell(mark);\r\n if (currentTdStyle) {\r\n td.getDOMElement().setAttribute('style', currentTdStyle);\r\n }\r\n r.appendChild(td.getDOMElement());\r\n }\r\n aux = Array.from(array[0]);\r\n array.push(aux);\r\n drawTable(array);\r\n table.recalculateIndexes();\r\n table.addColumnWidth();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n };\r\n\r\n /*\r\n * Yet another simple function, \r\n * it just add a row to the start of table.\r\n */\r\n\r\n table.addRowToTheStart = function () {\r\n let r = table.insertRow(0),\r\n td,\r\n aux,\r\n currentTable = document.getElementsByClassName('wptb-preview-table'),\r\n currentTableTd,\r\n currentTdStyle;\r\n r.classList.add( 'wptb-row' );\r\n if (currentTable.length > 0) {\r\n currentTableTd = currentTable[0].querySelector('td');\r\n }\r\n\r\n if (currentTableTd) {\r\n currentTdStyle = currentTableTd.getAttribute('style');\r\n }\r\n\r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n td = new WPTB_Cell(mark);\r\n if (currentTdStyle) {\r\n td.getDOMElement().setAttribute('style', currentTdStyle);\r\n }\r\n r.appendChild(td.getDOMElement());\r\n }\r\n aux = Array.from(array[0]);\r\n array.push(aux);\r\n drawTable(array);\r\n table.recalculateIndexes();\r\n table.addColumnWidth();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n };\r\n\r\n /* \r\n * This function adds a row before the current one.\r\n * Since the biggest factor of problem is a not-started but ongoing rowspan,\r\n * the most of the troubles is not here.\r\n */\r\n\r\n table.addRowBefore = function () {\r\n let cell = document.querySelector('.wptb-highlighted'),\r\n cellStyle = cell.getAttribute('style'),\r\n row = getCoords(cell)[0],\r\n cellNew;\r\n for( let i = row - 1; i >= 0; i-- ) {\r\n let rowChildren = table.rows[i].children;\r\n let rowChildrenLength = rowChildren.length;\r\n if( rowChildrenLength > 0 ) {\r\n for( let j = 0; j < rowChildrenLength; j++ ) {\r\n if( rowChildren[j].rowSpan == 1 ) {\r\n row = i;\r\n cellNew = true;\r\n break;\r\n }\r\n }\r\n }\r\n if ( cellNew ) {\r\n break;\r\n }\r\n }\r\n\r\n if (row === 0) {\r\n table.addRowToTheStart();\r\n } else {\r\n table.addRowAfter( row, cellStyle );\r\n }\r\n };\r\n\r\n /*\r\n * Well... by the name convention of the previous 3 functions,\r\n * it's pretty obvious that this functions attaches a new\r\n * row after highlighted cell row. The greatest obstacle it was\r\n * the possibility of a TR not having the exact amount of columns\r\n * occuped by actual node but rowspanned upper cells. For that purpose\r\n * it was created the function realTimeArray.\r\n * @see realTimeArray\r\n */\r\n\r\n table.addRowAfter = function ( row, cellStyle ) {\r\n let cellRowSpan,\r\n rowAfter,\r\n aux;\r\n \r\n if ( ( row == undefined || typeof row !== 'number' ) && cellStyle == undefined ) {\r\n let cell = document.querySelector('.wptb-highlighted');\r\n cellStyle = cell.getAttribute('style'),\r\n row = getCoords(cell)[0],\r\n cellRowSpan = cell.rowSpan,\r\n rowAfter = row + cellRowSpan - 1;\r\n } else {\r\n rowAfter = row;\r\n }\r\n \r\n \r\n let cellsColSpan = 0;\r\n if ( rowAfter < table.rows.length -1 ) {\r\n for( let i = 0; i <= rowAfter ; i++ ) {\r\n let tableRowsIChildren = table.rows[i].children,\r\n tableRIChildrenLength = tableRowsIChildren.length;\r\n if( tableRIChildrenLength > 0 ) {\r\n for( let j = 0; j < tableRIChildrenLength; j++ ) {\r\n let rowIRowSpan = tableRowsIChildren[j].rowSpan;\r\n\r\n if ( rowIRowSpan - 1 + i > rowAfter ) {\r\n tableRowsIChildren[j].rowSpan++;\r\n }\r\n }\r\n }\r\n }\r\n \r\n let rNext = table.rows[rowAfter + 1],\r\n rNextChildren = rNext.children,\r\n rNextChildrenLength = rNextChildren.length;\r\n \r\n if( rNextChildrenLength > 0 ) {\r\n for ( let i = 0; i < rNextChildrenLength; i++ ) {\r\n cellsColSpan += rNextChildren[i].colSpan;\r\n }\r\n }\r\n } else {\r\n cellsColSpan = array[0].length;\r\n }\r\n \r\n let r = table.insertRow( rowAfter + 1 );\r\n r.classList.add( 'wptb-row' );\r\n \r\n for ( j = 0; j < cellsColSpan; j++ ) {\r\n let td = new WPTB_Cell( mark );\r\n td.getDOMElement().setAttribute( 'style', cellStyle );\r\n td.getDOMElement().style.width = null;\r\n td.getDOMElement().style.height = null;\r\n r.appendChild( td.getDOMElement() );\r\n }\r\n\r\n aux = Array.from(array[0]);\r\n array.push(aux);\r\n drawTable(array);\r\n table.recalculateIndexes();\r\n table.addColumnWidth();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n };\r\n\r\n /*\r\n * This function checks the current selected cells\r\n * make a rectangular shape.\r\n * @param Array the abstract table.\r\n * @return false, if not making a rectangle, or\r\n *\tArray an array containing number of rows and columns, if selection makes a rectangle.\r\n */\r\n\r\n table.isSquare = function (a) {\r\n var rowStart = -1,\r\n columnStart = -1,\r\n rowEnd = -1,\r\n columnEnd = -1,\r\n height,\r\n width,\r\n itemsEstimate = 0,\r\n items = 0;\r\n\r\n for (var i = 0; i < a.length; i++) {\r\n for (var j = 0; j < a[i].length; j++) {\r\n if (a[i][j] == 1) {\r\n if ( j < columnStart || columnStart == -1 ) {\r\n columnStart = j;\r\n }\r\n if ( i < rowStart || rowStart == -1 ) {\r\n rowStart = i;\r\n }\r\n }\r\n }\r\n \r\n }\r\n\r\n for (var i = a.length - 1; i > -1; i--) {\r\n for (var j = a[i].length - 1; j > -1; j--) {\r\n if (a[i][j] == 1) {\r\n if ( j > columnEnd ) {\r\n columnEnd = j;\r\n }\r\n if ( i > rowEnd ) {\r\n rowEnd = i;\r\n }\r\n }\r\n }\r\n }\r\n\r\n for (var i = rowStart; i < rowEnd; i++) {\r\n for (var j = columnStart; j < columnEnd; j++) {\r\n if (a[i][j] == 0 || a[i][j] == undefined) {\r\n return false;\r\n }\r\n }\r\n }\r\n\r\n for (var i = 0; i < a.length; i++) {\r\n for (var j = 0; j < a[i].length; j++) {\r\n if (a[i][j] == 1) {\r\n items++;\r\n }\r\n }\r\n }\r\n\r\n height = rowEnd - rowStart + 1;\r\n width = columnEnd - columnStart + 1;\r\n itemsEstimate = height * width;\r\n\r\n if (itemsEstimate !== items) {\r\n return false;\r\n }\r\n return [height, width];\r\n };\r\n\r\n /*\r\n * This function merges all selected cells.\r\n * Well, actually sets the colspan and rowspan of first \r\n * upper left cell in selection and deletes the another selected cells.\r\n */\r\n\r\n table.mergeCells = function () {\r\n var dimensions = table.isSquare(array),\r\n rowspan = dimensions[0],\r\n colspan = dimensions[1],\r\n first = document.querySelector('.wptb-highlighted'),\r\n tds = [].slice.call(document.getElementsByClassName('wptb-highlighted'), 1),\r\n tdsChildrenNew = [];\r\n\r\n for (let i = 0; i < tds.length; i++) {\r\n let tdsInternalElements = tds[i].getElementsByClassName('wptb-ph-element');\r\n if (tdsInternalElements.length > 0) {\r\n let tdsIntElemLength = tdsInternalElements.length;\r\n for (let j = 0; j < tdsIntElemLength; j++) {\r\n tdsChildrenNew.push(tdsInternalElements[j]);\r\n }\r\n }\r\n let p = tds[i].parentNode;\r\n p.removeChild(tds[i]);\r\n }\r\n if (tdsChildrenNew.length > 0) {\r\n for (let i = 0; i < tdsChildrenNew.length; i++) {\r\n first.appendChild(tdsChildrenNew[i]);\r\n }\r\n }\r\n\r\n first.colSpan = colspan;\r\n first.rowSpan = rowspan;\r\n table.recalculateIndexes();\r\n table.reconstraction();\r\n let firstWidth = first.style.width;\r\n let firstDataFixedWidth = first.dataset.wptbFixedWidth;\r\n if( firstWidth ) {\r\n table.addColumnWidth( parseFloat( firstWidth, 10 ) );\r\n } else if( firstDataFixedWidth ) {\r\n table.addColumnWidth();\r\n } else {\r\n table.addColumnWidth( false, true );\r\n }\r\n \r\n let firstHeight = first.style.height;\r\n let firstDataFixedHeight = first.dataset.wptbFixedHeight;\r\n if( firstHeight ) {\r\n table.addRowHeight( parseFloat( firstHeight, 10 ) );\r\n } else if( firstDataFixedHeight ) {\r\n table.addRowHeight();\r\n } else {\r\n table.addRowHeight( false, true );\r\n }\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n };\r\n\r\n /*\r\n * This functions makes the exact inverse as above.\r\n * It resets colspan and rowspan and appends \r\n * the same amount in cells to the table.\r\n * @bug\r\n */\r\n\r\n table.splitCell = function () {\r\n var cell = document.getElementsByClassName('wptb-highlighted')[0],\r\n rowspan = cell.rowSpan,\r\n colspan = cell.colSpan,\r\n cellStyles = cell.getAttribute('style'),\r\n row = getCoords(cell)[0],\r\n thisRow = table.rows[row],\r\n cellXIndex =cell.dataset.xIndex;\r\n \r\n cell.rowSpan = 1;\r\n cell.colSpan = 1;\r\n \r\n for (let i = 1; i < colspan; i++) {\r\n let td = new WPTB_Cell(mark);\r\n td.getDOMElement().setAttribute('style', cellStyles);\r\n td.getDOMElement().classList.add( 'wptb-highlighted' );\r\n if ( cell.nextSibling ) {\r\n thisRow.insertBefore( td.getDOMElement(), cell.nextSibling );\r\n } else {\r\n thisRow.appendChild( td.getDOMElement() );\r\n }\r\n \r\n }\r\n\r\n if (rowspan > 1) {\r\n for (let i = 1; i < rowspan; i++) {\r\n let rowChildInsertBefore = undefined,\r\n rowNext = table.rows[row + i],\r\n rowChildren = rowNext.children,\r\n rowChildrenLength = rowChildren.length;\r\n \r\n if ( rowChildrenLength > 0 ) {\r\n for ( let k = 0; k < rowChildrenLength; k++ ) {\r\n if ( Number( rowChildren[k].dataset.xIndex ) > Number( cellXIndex ) ) {\r\n rowChildInsertBefore = rowChildren[k];\r\n break;\r\n } \r\n }\r\n }\r\n for ( let j = 0; j < colspan; j++ ) {\r\n let td = new WPTB_Cell( mark );\r\n td.getDOMElement().setAttribute( 'style', cellStyles );\r\n if ( rowChildInsertBefore != undefined ) {\r\n rowNext.insertBefore( td.getDOMElement(), rowChildInsertBefore );\r\n } else {\r\n rowNext.appendChild( td.getDOMElement() );\r\n }\r\n }\r\n }\r\n }\r\n\r\n table.recalculateIndexes();\r\n table.reconstraction();\r\n table.addColumnWidth();\r\n table.addRowHeight();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n let wptbLeftScrollPanelCellSetting = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ); \r\n if( wptbLeftScrollPanelCellSetting ) {\r\n wptbLeftScrollPanelCellSetting.classList.remove( 'visible' );\r\n }\r\n };\r\n\r\n /*\r\n * Searches for rowspanned cells up to row number meeting it.\r\n * @param number the number of row where the function\r\n * must search up to.\r\n */\r\n\r\n table.findRowspannedCells = function (row) {\r\n var array = [],\r\n difference;\r\n actualPoints = getActualPointsInRow(row);\r\n if (actualPoints === maxAmountOfCells) {\r\n return [];\r\n }\r\n difference = maxAmountOfCells - actualPoints;\r\n\r\n for (var i = row - 1; i >= 0 && difference; i--) {\r\n var tds = table.rows[i].getElementsByTagName('td');\r\n for (var i = 0; i < tds.length; i++) {\r\n if (tds[i].rowSpan > 1) {\r\n array.push(tds[i]);\r\n difference -= tds[i].colSpan;\r\n }\r\n }\r\n }\r\n return array;\r\n\r\n }\r\n\r\n /*\r\n * This function explores the table and adds \r\n * a cell for each lacking one for each row\r\n * to meet an even amount of cells.\r\n */\r\n\r\n table.addLackingCells = function () {\r\n var sumRows = [];\r\n for (var i = 0; i < table.rows.length; i++) {\r\n sumRows.push(0);\r\n }\r\n\r\n for (var i = 0; i < table.rows.length; i++) {\r\n var tds = table.rows[i].getElementsByTagName('td');\r\n for (var j = 0; j < tds.length; j++) {\r\n if (tds[j].rowSpan > 1) {\r\n for (var k = 1; k < tds[j].rowSpan; k++) {\r\n sumRows[i + k]++;\r\n }\r\n }\r\n }\r\n }\r\n\r\n for (var i = 0; i < table.rows.length; i++) {\r\n var tds = table.rows[i].getElementsByTagName('td'),\r\n totalColspan = 0;\r\n for (var j = 0; j < tds.length; j++) {\r\n totalColspan += tds[j].colSpan;\r\n }\r\n totalColspan += sumRows[i];\r\n difference = maxAmountOfCells - totalColspan;\r\n for (var j = 0; j < difference; j++) {\r\n var td = new WPTB_Cell(mark);\r\n table.rows[i].appendChild(td.getDOMElement());\r\n //table.rows[i].insertBefore( td.getDOMElement(), rows[i].nextSibling );\r\n }\r\n }\r\n };\r\n\r\n /*\r\n * This function deletes the row of currently\r\n * selected cell. \r\n */\r\n\r\n table.deleteRow = function () {\r\n let cell = document.querySelector('.wptb-highlighted'),\r\n cellStyles = cell.getAttribute('style'),\r\n rowspan = cell.rowSpan,\r\n row = getCoords(cell)[0],\r\n thisRow,\r\n aux;\r\n \r\n if ( rowspan == undefined ) rowspan = 1;\r\n \r\n for ( let i = 0; i < rowspan; i++ ) {\r\n thisRow = table.rows[row];\r\n let thisRowChildren = thisRow.children,\r\n nextRow = table.rows[row + 1],\r\n nextRowChildren,\r\n nextRowChildrenLength,\r\n tdArr = [];\r\n\r\n if( nextRow != undefined ) {\r\n nextRowChildren = nextRow.children;\r\n nextRowChildrenLength = nextRowChildren.length;\r\n for (let j = 0; j < thisRowChildren.length; j++) {\r\n if ( thisRowChildren[j].rowSpan > 1 ) {\r\n let td = new WPTB_Cell(mark);\r\n td.getDOMElement().setAttribute('style', cellStyles);\r\n td.getDOMElement().colSpan = thisRowChildren[j].colSpan;\r\n td.getDOMElement().rowSpan = thisRowChildren[j].rowSpan - 1;\r\n\r\n let nextRowChildrenK = undefined;\r\n for ( let k = 0; k < nextRowChildrenLength; k++ ) {\r\n if ( Number( nextRowChildren[k].dataset.xIndex ) > Number( thisRowChildren[j].dataset.xIndex ) ) {\r\n nextRowChildrenK = nextRowChildren[k];\r\n break;\r\n } \r\n }\r\n\r\n if ( nextRowChildrenK ) {\r\n tdArr.push( [td, nextRowChildrenK] );\r\n } else {\r\n tdArr.push( [td] );\r\n }\r\n }\r\n }\r\n\r\n if ( tdArr.length > 0 ) {\r\n for ( let k = 0; k < tdArr.length; k++ ) {\r\n if ( tdArr[k][1] != undefined ) {\r\n nextRow.insertBefore( tdArr[k][0].getDOMElement(), tdArr[k][1] );\r\n } else {\r\n nextRow.appendChild( tdArr[k][0].getDOMElement() );\r\n }\r\n }\r\n }\r\n }\r\n \r\n let tableRows = table.rows;\r\n if ( tableRows.length > 0 ) {\r\n for ( let j = 0; j < row; j++ ) {\r\n let jRowChildren = tableRows[j].children;\r\n if ( jRowChildren.length > 0 ) {\r\n for ( let x = 0; x < jRowChildren.length; x++ ) {\r\n if ( jRowChildren[x].rowSpan - 1 >= row - j ) {\r\n jRowChildren[x].rowSpan--;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n aux = Array.from(array[0]);\r\n array.pop(aux);\r\n drawTable(array);\r\n table.getElementsByTagName('tbody')[0].removeChild(table.rows[row]);\r\n \r\n if( table.rows.length == 0 ) {\r\n table.toggleTableEditMode();\r\n wptbTableSetup.innerHTML = '';\r\n WPTB_Helper.settingsPanelClear();\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\r\n }\r\n \r\n table.recalculateIndexes();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n undoSelect();\r\n }\r\n\r\n /*\r\n * This function deletes the column of currently\r\n * selected cell. Again, this is way more complicated than\r\n * delete row case.\r\n */\r\n\r\n table.deleteColumn = function () {\r\n let cell = document.querySelector('.wptb-highlighted'),\r\n cellXIndex = cell.dataset.xIndex,\r\n colspan = cell.colSpan;\r\n \r\n for ( let i = 0; i < colspan; i++ ) {\r\n for ( let j = 0; j < table.rows.length; j++ ) {\r\n let rowChildren = table.rows[j].children;\r\n let rowChildrenLength = rowChildren.length;\r\n if( rowChildrenLength > 0 ) {\r\n for ( let k = rowChildrenLength - 1; k >= 0; k-- ) {\r\n if ( Number( rowChildren[k].dataset.xIndex ) == Number( cellXIndex ) ) {\r\n if ( rowChildren[k].colSpan > 1 ) {\r\n rowChildren[k].colSpan--;\r\n } else {\r\n table.rows[j].removeChild( rowChildren[k] );\r\n }\r\n break;\r\n } else if( Number( rowChildren[k].dataset.xIndex ) < Number( cellXIndex ) && \r\n Number( rowChildren[k].dataset.xIndex ) + \r\n Number( rowChildren[k].colSpan -1 ) >= cellXIndex ) {\r\n if ( rowChildren[k].colSpan > 1 ) {\r\n rowChildren[k].colSpan--;\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n \r\n for ( let j = 0; j < table.rows.length; j++ ) {\r\n if (array[j] != undefined)\r\n array[j].pop();\r\n }\r\n \r\n maxAmountOfCells--;\r\n \r\n if( table.querySelectorAll( 'td' ).length == 0 ) {\r\n table.toggleTableEditMode();\r\n wptbTableSetup.innerHTML = '';\r\n WPTB_Helper.settingsPanelClear();\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\r\n }\r\n \r\n table.recalculateIndexes();\r\n table.tdDefaultWidth();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n undoSelect();\r\n };\r\n\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'none';\r\n\r\n array = fillTableArray();\r\n\r\n undoSelect();\r\n drawTable(array);\r\n\r\n wptbTableSetup.appendChild(table);\r\n //if (columns || rows) {\r\n table.recalculateIndexes( true );\r\n //}\r\n table.reconstraction();\r\n table.tdDefaultWidth();\r\n \r\n wptbTableSetup.onresize = function() {\r\n table.tdDefaultWidth();\r\n };\r\n\r\n WPTB_LeftPanel();\r\n \r\n // this code gets the ID of the active element in the toolbar \r\n // and stores it in the data attribute of the common container element \"wpcd_fixed_toolbar\"\r\n// let wptbPhElement = document.getElementsByClassName( 'wptb-ph-element' );\r\n// let wpcdFixedToolbar = document.getElementById( 'wpcd_fixed_toolbar' );\r\n// for ( let i = 0; i < wptbPhElement.length; i++ ) {\r\n// wptbPhElement[i].addEventListener( 'click', function( e ) {\r\n// let wptbToolbar = document.getElementById( 'wpcd_fixed_toolbar' ).children;\r\n// for ( let j = 0; j < wptbToolbar.length; j++ ) {\r\n// let elementStyles = window.getComputedStyle( wptbToolbar[j], 'null' );\r\n// if( elementStyles.getPropertyValue( 'display' ) == 'block' ) {\r\n// wpcdFixedToolbar.dataset.toolbarActiveId = wptbToolbar[j].getAttribute( 'id' );\r\n// }\r\n// }\r\n// }, false );\r\n// }\r\n \r\n// let wptbPanelLeft = document.getElementsByClassName( 'wptb-panel-left' );\r\n// if( wptbPanelLeft.length > 0 ) {\r\n// wptbPanelLeft[0].addEventListener( 'click', function( e ) {\r\n// let toolbarActiveElementId = wpcdFixedToolbar.dataset.toolbarActiveId;\r\n// document.getElementById( toolbarActiveElementId ).style.display = '';\r\n// }, false );\r\n// }\r\n \r\n// let body = document.getElementsByTagName( 'body' );\r\n// if( body.length > 0 ) {\r\n// body[0].addEventListener( 'click', function( e ) {\r\n// if ( e.target.classList.contains( 'wptb-panel-left' ) || WPTB_Helper.findAncestor( e.target, 'wptb-panel-left' ) ) {\r\n// let toolbarActiveElementId = wpcdFixedToolbar.dataset.toolbarActiveId;\r\n// document.getElementById( toolbarActiveElementId ).style.display = '';\r\n// }\r\n// }, false );\r\n// }\r\n};","var WPTB_Text = function ( text , DOMElementProt ) {\r\n let DOMElement = document.createElement('div'),\r\n elText2 = document.createElement('div'),\r\n elP = document.createElement('p'),\r\n kindIndexProt = undefined,\r\n copy = false;\r\n \r\n DOMElement.classList.add( 'wptb-text-container' );\r\n\r\n elP.innerHTML = text != undefined ? text : 'Text';\r\n elText2.appendChild(elP);\r\n DOMElement.appendChild(elText2);\r\n if ( DOMElementProt ) {\r\n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\r\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\r\n kindIndexProt = wptbElementMutch[1];\r\n copy = true;\r\n };\r\n\r\n let attributes = [...DOMElementProt.attributes];\r\n for( let i = 0; i < attributes.length; i++ ) {\r\n DOMElement.setAttribute(attributes[i].name, attributes[i].value);\r\n }\r\n } \r\n\r\n this.kind = 'text';\r\n this.getDOMElement = function () {\r\n return DOMElement;\r\n };\r\n applyGenericItemSettings( this, kindIndexProt, copy );\r\n\r\n return this;\r\n};"]}
1
+ {"version":3,"sources":["applyGenericItemSettings.js","wptb-builder.js","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_innerElementSet.js","WPTB_LeftPanel.js","WPTB_List.js","WPTB_ListItem.js","WPTB_MultipleSelect.js","WPTB_Parser.js","WPTB_Parser2.js","WPTB_Settings.js","WPTB_Space.js","WPTB_Stringifier.js","WPTB_Stringifier2.js","WPTB_Table.js","WPTB_TableStateSaveManager.js","WPTB_Text.js"],"names":["applyGenericItemSettings","element","kindIndexProt","copy","node","getDOMElement","index","listItems","undefined","document","counter","nextIndex","kind","wptbElements","getElementsByClassName","elementIndexesArr","i","length","regex","RegExp","infArr","className","match","push","elementIndexMax","Math","max","split","onmouseenter","event","target","classList","contains","wptbActionsField","WPTB_ActionsField","addActionField","setParameters","remove","a","querySelector","onclick","e","preventDefault","WPTB_Helper","buttonsTinyMceInit","tinyMCE","init","childNodes","inline","plugins","dialog_type","theme","menubar","fixed_toolbar_container","paste_as_text","toolbar","setup","ed","on","row","findAncestor","table","dataTitleColumnSet","onblur","wptbTableStateSaveManager","WPTB_TableStateSaveManager","tableStateSet","init_instance_callback","editor","window","currentEditor","totalWidth","offsetWidth","getElementById","scrollTop","bodyElement","style","display","position","right","top","listItemsTinyMceInit","onmouseleave","wptbActions","type","leaveFromField","observer","MutationObserver","mutations","config","attributes","attributeFilter","observe","node_wptb_element_kind_num","add","WPTB_ElementOptions","increment","actionType","thisNode","body","getElementsByTagName","actions","previousNode","activeElem","parentNode","removeChild","btnDelete","btnCopy","btnMove","createElement","draggable","appendChild","act","el","thisRow","actionsRemove","activeElement","activeElementClone","cloneNode","td","temp","srcList","querySelectorAll","innerHTML","WPTB_List","insertBefore","nextSibling","WPTB_Text","WPTB_Image","text","WPTB_Button","WPTB_innerElementSet","ondragstart","dragImagesArr","dataTransfer","effectAllowed","setDragImage","setData","actionsHide","previous","append","wptbDirectlyhovered","action","item","parent","listItemsRecalculateIndex","coordinatesElement","getBoundingClientRect","coordinatesElementTopBegin","listItem","content","html","duplicate","WPTB_ListItem","firstChild","divcontent","setTimeout","coordinatesElementTopEnd","wptbContainer","correctTop","parseFloat","removeEventListener","left","clientWidth","addEventListener","relatedTarget","localName","opacity","WPTB_Builder","table_id","detectMode","http","XMLHttpRequest","urlSet","ajaxurl","open","setRequestHeader","onreadystatechange","d","readyState","status","ans","JSON","parse","responseText","value","wptbTableSetupEl","WPTB_Parser","WPTB_Table","WPTB_LeftPanel","WPTB_Settings","send","ElementCounters","select","MultipleSelect","initializer","WPTB_Initializer","settings","DOMElementProt","DOMElement","elButton","el_B","el_BDiv","el_BDivP","wptbElementMutch","Array","isArray","attributesContainer","setAttribute","name","wptbButtonWrapper","wptbButtonWrapAttributes","wptbButtonA","wptbButtonAttributes","wptbButton","WPTB_Cell","callback","highlightRow","parentRow","columnCount","parseInt","tds","classToAdd","ttd","highlightColumn","rowCount","tr","padding","jQuery","val","innerBorderWidth","border","wptbPhElement","wptbSpaceBetween","j","WPTB_Space","wptbElementTypeClass","wptbTypeElementArr","wptbListItems","setCoords","y","x","dataset","yIndex","xIndex","getCoords","coords","appendElement","getCellDimensions","tdStyleObj","getComputedStyle","tdPaddingLeft","getPropertyValue","tdPaddingRight","tdBorderLeftWidth","tdBorderRightWidth","tdPaddingTop","tdPaddingBottom","tdBorderTopWidth","tdBorderBottomWidth","width","height","offsetHeight","WPTB_DropHandle","thisElem","newElementProxy","includes","wptbDropHandle","wptbDropBorderMarker","wptbDropBorderMarkerTop","wptbDropBorderMarkerRight","wptbDropBorderMarkerBottom","wptbDropBorderMarkerLeft","ondragenter","ondragover","ondragleave","ondrop","getData","getDOMParentElement","nodeName","toLowerCase","innerElement","innerElementNext","onscroll","indics","types","notDragEnter","indexOf","elementDrag","offsetY","layerY","bottom","priv","key","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","wptbImageWrapper","imgAlign","textAlign","imageAlignmentSelect","elementsA","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","listItemPTextAlignLeftCount","listItemPTextAlignCenterCount","listItemPTextAlignRightCount","elementListAlignmentSelect","maxListItemTAlLeftC","optionsClass","children","buttons","size","n_Class","num","optionControls","wpColorPicker","change","ui","classe","ps","number","toString","wpColorPickerCheckChangeForTableStateSaving","slider","oninput","onchange","src","alt","href","linkHttpCheckChange","rel","removeAttribute","jc","id","parentNodeSettingItem","onmouseup","hexToRgb","hex","result","exec","rgb","slice","getDragImageCustom","hostName","location","protocol","hostname","image","button","list","ulElem","par","listStyleTypeIndex","Number","article","keyCode","innerText","pText","replace","trim","selectedText","getSelectionText","wptbListItem","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","results","decodeURIComponent","getColumnWidth","cell","xIndexes","cellWidth","getRowHeight","yIndexes","cellHeight","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","div","classId","stopPropagation","onmouseover","wptbElementButtons","wptbTdBgColorSavedSet","inputId","trNumber","tableRows","trBackgroundColor","wptbEvenRowBg","console","log","clear","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","numberImputSize","wptbNumberInputs","maxCount","maxValue","onkeydown","thisValue","String","substring","onkeyup","wptbTableBorderNumber","wptbTextfontSizeNumber","wptbImageWidthNumber","wptbTableColumnWidthNumber","wptbTableRowHeightNumber","tdDefaultWidth","wptbInnerBorderCheck","tableBorderColorSetArea","addColumnWidth","highlighted","addRowHeight","createMobileHeadForTable","thisEvent","wptbElement","toggleTableEditMode","addRowToTheEnd","addRowToTheStart","addRowBefore","addRowAfter","addColumnEnd","addColumnStart","addColumnBefore","addColumnAfter","deleteColumn","deleteRow","mergeCells","splitCell","wptbBuilderPanel","clickOnFreeSpace","wptbHeader","wpcdFixedToolbar","hasAttribute","innerElements","el_L","wptbListItemReturn","styleDot","listItemKeyListener","selectedCells","multipleCellMode","activateMultipleSelectMode","deactivateMultipleSelectMode","isActivated","pushSelectedCell","flushSelectedCells","getFirst","minXIndex","minYIndex","getLast","maxXIndex","maxYIndex","last","removeAllButFirst","code","columnTitleMobile","WPTB_Parser2","elementHtml","createTextNode","tagName","elems","ondragend","wptbUndo","tableStateGet","wptbUndoredo","wptbUndoRedoContainer","wptbRedo","shortcodePopupWindow","bar","wptb_admin_object","t","messagingArea","WPTB_Stringifier","outerHTML","messagingAreaText","params","security_code","rs","wptbId","stringify","data","wptbPreviewBtn","wptbPreviewBtnHref","previewHref","elSpaceBetween","spaceBetween","t_space","spaceParent","alert","codeMain","tableColumns","minWidth","maxWidth","mceContentBodys","k","dataMceStyle","contentEditable","spellCheck","mceIds","wptbActionsLength","columnNameDivContainer","columnNameDiv","WPTB_Stringifier2","start","nodeValue","int_elem_arr","attributes_list","internal_elements","inter_elem","array","wptbTableSetup","maxAmountOfCells","maxAmountOfRows","mark","rowSpan","cs","colSpan","markedCells","noCells","singleCells","multipleCells","cellSettings","column","cellHighlighted","wptbTableColumnWidthSlider","tableColumnWidthAutoFixedCheckbox","wptbFixedWidth","wptbTableRowHeightSlider","tableRowHeightAutoFixedCheckbox","wptbFixedHeight","isSquare","realTimeArray","carried","cols","matriz","items","justAssigned","amount","carriedRowspans","cellsBuffer","cellPointer","xPosition","stepsToMove","celda","drawTable","string","undoSelect","fillTableArray","colspansSums","cells","colspanSumInRow","apply","getActualPointsInRow","points","search","skipInCols","reconstraction","insertRow","wptb_preview_table","cellModeBackground","leftScrollPanelCurtain","leftScrollPanelCellSettings","wptbPreviewTableTds","recalculateIndexes","trs","maxCols","maxColsFull","tdsArr","jMainIter","z","cleaner","dataXIndex","tableTdsFor","colspan","widthIsSet","arrayTdsFromPreviousRow","tableTdsSumMaxWidth","tableTdsSumMaxWidthFixed","tableTdsSumMaxWidthAuto","wptbTableSetupWidth","arrayCellsWidthFixedHelper","arrayCellsWidthAutoHelper","tdPaddingCommon","tableTdBorderCommonWidth","cssForTdsWidthAuto","wptbCssTdAutoWidth","tableTdBorderLeftWidth","tableTdBorderRightWidth","CellsWidthAutoCount","tableFullStyleObj","borderLeftWidth","borderRightWidth","tableBorderCommon","wptbTableTdsSumMaxWidth","wptbCellsWidthAutoCount","mergingСellsHorizontally","wptbFixedWidthSize","styleElementCreate","tableTdWidthAuto","tableTdsWidthAutoCommon","head","cssForTdsWidthAutoOld","dataYIndex","rowspan","heightIsSet","arrayTdsPrevious","tableColumnHeightAutoFixedCheckbox","wptbAdaptiveTableChoseBlock","mergingCellsVertically","forBreak","currentTable","currentTableTd","currentTdStyle","firstCell","c_pos","cellStyle","pos","pendingInsertion","bro","currentCell","l","r","aux","from","cellNew","rowChildren","rowChildrenLength","cellRowSpan","rowAfter","cellsColSpan","tableRowsIChildren","tableRIChildrenLength","rowIRowSpan","rNext","rNextChildren","rNextChildrenLength","rowStart","columnStart","rowEnd","columnEnd","itemsEstimate","dimensions","call","tdsChildrenNew","tdsInternalElements","tdsIntElemLength","firstWidth","firstDataFixedWidth","firstHeight","firstDataFixedHeight","cellStyles","cellXIndex","rowChildInsertBefore","rowNext","findRowspannedCells","difference","actualPoints","addLackingCells","sumRows","totalColspan","nextRow","nextRowChildren","nextRowChildrenLength","tdArr","nextRowChildrenK","jRowChildren","pop","onresize","wptbTableStateSaving","wptbTableStateNumberShow","wptbNewP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AAO,KAJX;;AAMIoM,eAAWxK,SAAX,CAAqB+D,GAArB,CAA0B,qBAA1B;;AAEAutB,QAAI1rB,SAAJ,GAAgBM,QAAQzH,SAAR,GAAoByH,IAApB,GAA2B,MAA3C;AACAmrB,YAAQrsB,WAAR,CAAoBssB,GAApB;AACA9mB,eAAWxF,WAAX,CAAuBqsB,OAAvB;AACJ,QAAK9mB,cAAL,EAAsB;AAClB,YAAIM,mBAAmBN,eAAejL,SAAf,CAAyBC,KAAzB,CAAgC,0BAAhC,CAAvB;AACA,YAAKsL,oBAAoBC,MAAMC,OAAN,CAAeF,gBAAf,CAAzB,EAA6D;AACzD1M,4BAAgB0M,iBAAiB,CAAjB,CAAhB;AACAzM,mBAAO,IAAP;AACH;;AAED,YAAIuF,0CAAiB4G,eAAe5G,UAAhC,EAAJ;AACA,aAAK,IAAI1E,IAAI,CAAb,EAAgBA,IAAI0E,WAAWzE,MAA/B,EAAuCD,GAAvC,EAA6C;AACzCuL,uBAAWS,YAAX,CAAwBtH,WAAW1E,CAAX,EAAciM,IAAtC,EAA4CvH,WAAW1E,CAAX,EAAcyK,KAA1D;AACH;AACJ;;AAED,SAAK7K,IAAL,GAAY,MAAZ;AACA,SAAKP,aAAL,GAAqB,YAAY;AAC7B,eAAOkM,UAAP;AACH,KAFD;AAGAvM,6BAA0B,IAA1B,EAAgCE,aAAhC,EAA+CC,IAA/C;;AAEA,WAAO,IAAP;AACH,CAhCD","file":"admin.js","sourcesContent":["var applyGenericItemSettings = function ( element, kindIndexProt, copy = false ) {\r\n var node = element.getDOMElement(),\r\n index,\r\n listItems,\r\n copy;\r\n \r\n if ( kindIndexProt == undefined || copy == true ) {\r\n index = document.counter.nextIndex( element.kind );\r\n let wptbElements = document.getElementsByClassName( 'wptb-ph-element' );\r\n let elementIndexesArr = [];\r\n for( let i = 0; i < wptbElements.length; i++ ) {\r\n var regex = new RegExp( 'wptb-element-' + element.kind + '-(\\\\d+)', \"i\" );\r\n let infArr = wptbElements[i].className.match( regex );\r\n if( infArr ) {\r\n elementIndexesArr.push( infArr[1] );\r\n }\r\n }\r\n if( elementIndexesArr.length > 0 ) {\r\n let elementIndexMax = Math.max( ...elementIndexesArr );\r\n index = elementIndexMax + 1;\r\n } else { \r\n index = 1;\r\n }\r\n } else if ( kindIndexProt && ! copy ) {\r\n index = kindIndexProt.split('-')[1];\r\n }\r\n \r\n node.onmouseenter = function ( event ) {\r\n if( event.target.classList.contains( 'wptb-moving-mode' ) ) {\r\n return;\r\n }\r\n \r\n let i, wptbActionsField = new WPTB_ActionsField();\r\n \r\n wptbActionsField.addActionField( 1, node );\r\n \r\n wptbActionsField.setParameters( node );\r\n \r\n node.classList.remove( 'wptb-ondragenter' );\r\n \r\n //wptbActionsField.addActionField( 1, node )\r\n \r\n if ( element.kind === 'button' ) {\r\n let a = node.querySelector( 'a' ),\r\n target = a.querySelector( 'div' );\r\n a.onclick = function( e ) {\r\n e.preventDefault();\r\n }\r\n WPTB_Helper.buttonsTinyMceInit( target );\r\n } else if (element.kind === 'text') {\r\n tinyMCE.init({\r\n target: node.childNodes[0],\r\n inline: true,\r\n plugins: \"link, paste\",\r\n dialog_type: \"modal\",\r\n theme: 'modern',\r\n menubar: false,\r\n fixed_toolbar_container: '#wpcd_fixed_toolbar',\r\n paste_as_text: true,\r\n toolbar: 'bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify',\r\n setup : function( ed ) {\r\n ed.on( 'change', function(e) {\r\n let row = WPTB_Helper.findAncestor( node, 'wptb-row' );\r\n if( row.classList.contains( 'wptb-table-head' ) ) {\r\n let table = WPTB_Helper.findAncestor( row, 'wptb-preview-table' );\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n \r\n \r\n });\r\n \r\n ed.on( 'keydown', function(e) {\r\n let wptbActionsField = new WPTB_ActionsField();\r\n \r\n wptbActionsField.addActionField( 1, node );\r\n \r\n wptbActionsField.setParameters( node );\r\n });\r\n ed.on( 'keyup', function(e) {\r\n let wptbActionsField = new WPTB_ActionsField();\r\n \r\n wptbActionsField.addActionField( 1, node );\r\n \r\n wptbActionsField.setParameters( node );\r\n \r\n e.target.onblur = function() {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n });\r\n \r\n },\r\n init_instance_callback: function (editor) {\r\n window.currentEditor = editor;\r\n //editor.fire('focus');\r\n editor.on('focus', function (e) {\r\n var totalWidth = document.getElementsByClassName('wptb-builder-panel')[0].offsetWidth;\r\n if (window.currentEditor &&\r\n document.getElementById('wptb_builder').scrollTop >= 55 &&\r\n window.currentEditor.bodyElement.style.display != 'none') {\r\n document.getElementById('wpcd_fixed_toolbar').style.position = 'fixed';\r\n document.getElementById('wpcd_fixed_toolbar').style.right = (totalWidth / 2 - document.getElementById('wpcd_fixed_toolbar').offsetWidth / 2) + 'px';\r\n document.getElementById('wpcd_fixed_toolbar').style.top = '100px';\r\n } else {\r\n document.getElementById('wpcd_fixed_toolbar').style.position = 'static';\r\n delete document.getElementById('wpcd_fixed_toolbar').style.right;\r\n delete document.getElementById('wpcd_fixed_toolbar').style.top;\r\n }\r\n });\r\n }\r\n });\r\n \r\n } else {\r\n listItems = node.getElementsByClassName( 'wptb-list-item-content' );\r\n for ( let i = 0; i < listItems.length; i++ ) {\r\n WPTB_Helper.listItemsTinyMceInit( listItems[i] );\r\n }\r\n }\r\n\r\n \r\n };\r\n \r\n node.onmouseleave = function ( event ) {\r\n let wptbActionsField = new WPTB_ActionsField();\r\n \r\n if( wptbActionsField.wptbActions && wptbActionsField.wptbActions.type != '1' ) {\r\n return;\r\n }\r\n \r\n wptbActionsField.leaveFromField( event, node, 1 );\r\n };\r\n \r\n let wptbActions = document.getElementsByClassName( 'wptb-actions' );\r\n if( wptbActions.length > 0 ) {\r\n wptbActions = wptbActions[0];\r\n \r\n }\r\n \r\n // Change data-title-column if the title was changed\r\n if( element.kind == 'text' ) {\r\n var observer = new MutationObserver( function( mutations ) {\r\n let row = WPTB_Helper.findAncestor( node, 'wptb-row' );\r\n if( row.classList.contains( 'wptb-table-head' ) ) {\r\n let table = WPTB_Helper.findAncestor( row, 'wptb-preview-table' );\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n });\r\n var config = { attributes: true, attributeFilter: ['style'] };\r\n observer.observe( element.getDOMElement(), config );\r\n }\r\n\r\n let node_wptb_element_kind_num = node.className.match(/wptb-element-(.+)-(\\d+)/i);\r\n if ( node_wptb_element_kind_num ) {\r\n node.classList.remove( node_wptb_element_kind_num[0] );\r\n }\r\n if ( ! node.classList.contains( 'wptb-ph-element' ) ) {\r\n node.classList.add( 'wptb-ph-element' );\r\n if( ! node.classList.contains( 'wptb-element-' + element.kind + '-' + index ) ) {\r\n node.classList.add( 'wptb-element-' + element.kind + '-' + index );\r\n }\r\n } else {\r\n if( ! node.classList.contains( 'wptb-element-' + element.kind + '-' + index ) ) {\r\n node.classList.add( 'wptb-element-' + element.kind + '-' + index );\r\n }\r\n }\r\n new WPTB_ElementOptions( element, index, kindIndexProt );\r\n\r\n document.counter.increment(element.kind);\r\n};","","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 {\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 }\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 () {\r\n var WPTB_Builder = function () {\r\n var table_id = WPTB_Helper.detectMode();\r\n if ( table_id ) {\r\n var http = new XMLHttpRequest(),\r\n urlSet = ajaxurl + \"?action=get_table\" + '&id=' + table_id;\r\n http.open('GET', urlSet, true);\r\n http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');\r\n http.onreadystatechange = function (d) {\r\n if (this.readyState == 4 && this.status == 200) {\r\n var ans = JSON.parse(http.responseText);\r\n document.getElementById('wptb-setup-name').value = ans[0];\r\n \r\n if( ans[1] ) {\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'none';\r\n let wptbTableSetupEl = document.getElementsByClassName('wptb-table-setup')[0];\r\n wptbTableSetupEl.appendChild( WPTB_Parser( ans[1] ) );\r\n WPTB_Table();\r\n WPTB_LeftPanel();\r\n WPTB_Settings();\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n } else {\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\r\n }\r\n \r\n return;\r\n }\r\n };\r\n http.send(null);\r\n } else {\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\r\n }\r\n document.counter = new ElementCounters();\r\n document.select = new MultipleSelect();\r\n\r\n var initializer = WPTB_Initializer();\r\n settings = WPTB_Settings();\r\n };\r\n\r\n document.addEventListener('DOMContentLoaded', WPTB_Builder);\r\n})();","var WPTB_Button = function( text, DOMElementProt ) {\r\n \r\n var DOMElement = document.createElement('div'),\r\n elButton = document.createElement('div'),\r\n el_B = document.createElement('a'),\r\n el_BDiv = document.createElement( 'div' ),\r\n el_BDivP = document.createElement( 'p' ),\r\n kindIndexProt = undefined,\r\n copy = false;\r\n\r\n DOMElement.classList.add('wptb-button-container', 'wptb-size-M', 'wptb-');\r\n elButton.classList.add('wptb-button-wrapper');\r\n el_BDiv.classList.add('wptb-button');\r\n el_BDivP.innerHTML = text != undefined ? text : 'Button Text';\r\n \r\n // Creation of a new button when copying to avoid errors when assigning new event handlers.\r\n if ( DOMElementProt ) {\r\n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\r\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\r\n kindIndexProt = wptbElementMutch[1];\r\n copy = true;\r\n }; \r\n var attributesContainer = [...DOMElementProt.attributes];\r\n if ( attributesContainer.length > 0 ) {\r\n for( let i = 0; i < attributesContainer.length; i++ ) {\r\n DOMElement.setAttribute(attributesContainer[i].name, attributesContainer[i].value);\r\n } \r\n }\r\n \r\n var wptbButtonWrapper = DOMElementProt.querySelector( '.wptb-button-wrapper' );\r\n if ( wptbButtonWrapper ) {\r\n var wptbButtonWrapAttributes = [...wptbButtonWrapper.attributes];\r\n if ( wptbButtonWrapAttributes.length > 0 ) {\r\n for( let i = 0; i < wptbButtonWrapAttributes.length; i++ ) {\r\n if ( wptbButtonWrapAttributes[i].name == 'style') {\r\n elButton.setAttribute( wptbButtonWrapAttributes[i].name, wptbButtonWrapAttributes[i].value );\r\n }\r\n } \r\n }\r\n }\r\n \r\n var wptbButtonA = DOMElementProt.querySelector( 'a' );\r\n if ( wptbButtonA ) {\r\n var wptbButtonAttributes = [...wptbButtonA.attributes];\r\n if ( wptbButtonAttributes.length > 0 ) {\r\n for( let i = 0; i < wptbButtonAttributes.length; i++ ) {\r\n if ( wptbButtonAttributes[i].name == 'style' || \r\n wptbButtonAttributes[i].name == 'href' || \r\n wptbButtonAttributes[i].name == 'target' ) {\r\n el_B.setAttribute( wptbButtonAttributes[i].name, wptbButtonAttributes[i].value );\r\n }\r\n } \r\n }\r\n }\r\n \r\n var wptbButton = DOMElementProt.querySelector( '.wptb-button' );\r\n if ( wptbButton ) {\r\n var wptbButtonAttributes = [...wptbButton.attributes];\r\n if ( wptbButtonAttributes.length > 0 ) {\r\n for( let i = 0; i < wptbButtonAttributes.length; i++ ) {\r\n if ( wptbButtonAttributes[i].name == 'style') {\r\n el_BDiv.setAttribute( wptbButtonAttributes[i].name, wptbButtonAttributes[i].value );\r\n }\r\n } \r\n }\r\n }\r\n }\r\n \r\n elButton.appendChild(el_B);\r\n el_B.appendChild( el_BDiv );\r\n el_BDiv.appendChild( el_BDivP );\r\n DOMElement.appendChild(elButton);\r\n \r\n \r\n \r\n this.kind = 'button';\r\n\r\n this.getDOMElement = function () {\r\n return DOMElement;\r\n };\r\n\r\n applyGenericItemSettings( this, kindIndexProt, copy );\r\n \r\n return this;\r\n};","var WPTB_Cell = function (callback, DOMElement) {\r\n\r\n function highlightRow(td) {\r\n var parentRow = td.parentNode,\r\n columnCount = parseInt(document.getElementById('wptb-columns-number').value),\r\n tds = document.getElementsByClassName('wptb-preview-table')[0].getElementsByTagName('td');\r\n for (var i = 0; i < tds.length; i++) {\r\n tds[i].classList.remove('wptb-highlighted-row-first', 'wptb-highlighted-row-last', 'wptb-highlighted-row-inner', 'wptb-highlighted-column-first', 'wptb-highlighted-column-last', 'wptb-highlighted-column-inner');\r\n }\r\n for (var i = 0; i < columnCount; i++) {\r\n\r\n var classToAdd = i == 0 ? 'wptb-highlighted-row-first' : i == columnCount - 1 ? 'wptb-highlighted-row-last' : 'wptb-highlighted-row-inner';\r\n var ttd = parentRow.getElementsByTagName('td')[i];\r\n if (ttd !== td) {\r\n ttd.classList.add(classToAdd);\r\n }\r\n }\r\n }\r\n\r\n function highlightColumn(td) {\r\n\r\n var index,\r\n parentRow = td.parentNode;\r\n columnCount = parseInt(document.getElementById('wptb-columns-number').value), rowCount = parseInt(document.getElementById('wptb-rows-number').value), table = document.getElementsByClassName('wptb-preview-table')[0];\r\n for (var i = 0; i < columnCount; i++) {\r\n if (parentRow.getElementsByTagName('td')[i] === td) {\r\n index = i;\r\n break;\r\n }\r\n }\r\n\r\n for (var i = 0; i < rowCount; i++) {\r\n var classToAdd = i == 0 ? 'wptb-highlighted-column-first' : i == rowCount - 1 ? 'wptb-highlighted-column-last' : 'wptb-highlighted-column-inner';\r\n var tr = table.getElementsByTagName('tr')[i];\r\n if (tr.getElementsByTagName('td')[index] !== td) {\r\n tr.getElementsByTagName('td')[index].classList.add(classToAdd);\r\n }\r\n }\r\n }\r\n \r\n if( ! DOMElement ) {\r\n DOMElement = document.createElement(\"td\");\r\n\r\n DOMElement.style.padding = jQuery('#wptb-table-padding-number').val() + 'px';\r\n\r\n var innerBorderWidth = jQuery('#wptb-table-inner-border-number').val();\r\n\r\n if (innerBorderWidth != '' && parseInt(innerBorderWidth) != 0) {\r\n DOMElement.style.border = innerBorderWidth + 'px solid ' + jQuery('#wptb-table-border-color').val();\r\n } \r\n\r\n DOMElement.classList.add('wptb-droppable', 'wptb-cell');\r\n }\r\n\r\n DOMElement.draggable = false;\r\n if ( callback ) {\r\n DOMElement.onclick = callback;\r\n }\r\n \r\n WPTB_innerElementSet( DOMElement );\r\n \r\n let wptbPhElement = DOMElement.getElementsByClassName( 'wptb-ph-element' );\r\n \r\n if ( wptbPhElement.length > 0 ) {\r\n for( let i = 0; i < wptbPhElement.length; i++ ) {\r\n\r\n let wptbSpaceBetween = DOMElement.getElementsByClassName( 'wptb-space-between' );\r\n\r\n if ( wptbSpaceBetween.length > 0 ) {\r\n for( let j = 0; j < wptbSpaceBetween.length; j++ ) {\r\n WPTB_Space( wptbSpaceBetween[j] );\r\n }\r\n }\r\n \r\n wptbPhElement[i].getDOMElement = function() {\r\n return wptbPhElement[i];\r\n }\r\n \r\n WPTB_innerElementSet( wptbPhElement[i] );\r\n \r\n let wptbElementTypeClass = wptbPhElement[i].className.match( /wptb-element-((.+-)\\d+)/i );\r\n if( wptbElementTypeClass && Array.isArray( wptbElementTypeClass ) ) {\r\n let wptbTypeElementArr = wptbElementTypeClass[1].split( '-' );\r\n wptbPhElement[i].kind = wptbTypeElementArr[0];\r\n applyGenericItemSettings( wptbPhElement[i], wptbElementTypeClass[1] );\r\n if ( wptbPhElement[i].kind == 'list' ) {\r\n let wptbListItems = wptbPhElement[i].getElementsByTagName( 'li' );\r\n if( wptbListItems.length > 0 ) {\r\n for ( let i = 0; i < wptbListItems.length; i++ ) {\r\n WPTB_ListItem( undefined, wptbListItems[i] );\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n this.getDOMElement = function () {\r\n return DOMElement;\r\n };\r\n\r\n this.setCoords = function (y, x) {\r\n var el = this.getDOMElement();\r\n el.dataset.yIndex = y;\r\n el.dataset.xIndex = x;\r\n };\r\n\r\n this.getCoords = function () {\r\n var coords,\r\n el = this.getDOMElement();\r\n coords.x = el.dataset.xIndex;\r\n coords.y = el.dataset.yIndex;\r\n return coords;\r\n };\r\n\r\n this.appendElement = function (node) {\r\n getDOMElement().appendChild(node);\r\n };\r\n \r\n DOMElement.getCellDimensions = function() {\r\n let tdStyleObj = window.getComputedStyle( this, null );\r\n \r\n let tdPaddingLeft = tdStyleObj.getPropertyValue( 'padding-left' );\r\n let tdPaddingRight = tdStyleObj.getPropertyValue( 'padding-right' );\r\n \r\n let tdBorderLeftWidth = tdStyleObj.getPropertyValue( 'border-left-width' );\r\n let tdBorderRightWidth = tdStyleObj.getPropertyValue( 'border-right-width' );\r\n \r\n let tdPaddingTop = tdStyleObj.getPropertyValue( 'padding-top' );\r\n let tdPaddingBottom = tdStyleObj.getPropertyValue( 'padding-bottom' );\r\n \r\n let tdBorderTopWidth = tdStyleObj.getPropertyValue( 'border-top-width' );\r\n let tdBorderBottomWidth = tdStyleObj.getPropertyValue( 'border-bottom-width' );\r\n \r\n let width = parseFloat( this.offsetWidth, 10 ) - \r\n parseFloat( tdPaddingLeft, 10 ) - \r\n parseFloat( tdPaddingRight, 10 ) -\r\n parseFloat( tdBorderLeftWidth, 10 ) -\r\n parseFloat( tdBorderRightWidth, 10 );\r\n \r\n let height = parseFloat( this.offsetHeight, 10 ) - \r\n parseFloat( tdPaddingTop, 10 ) - \r\n parseFloat( tdPaddingBottom, 10 ) -\r\n parseFloat( tdBorderTopWidth, 10 ) -\r\n parseFloat( tdBorderBottomWidth, 10 );\r\n \r\n return {\r\n width: width, \r\n height: height\r\n };\r\n }\r\n\r\n return this;\r\n};","var WPTB_DropHandle = function (thisElem, e) {\r\n \r\n function newElementProxy(el) {\r\n if (el.includes('list')) {\r\n return new WPTB_List();\r\n } else if (el.includes('image')) {\r\n return new WPTB_Image();\r\n } else if (el.includes('text')) {\r\n return new WPTB_Text();\r\n } else if (el.includes('button')) {\r\n return new WPTB_Button();\r\n }\r\n }\r\n \r\n let wptbDropHandle,\r\n wptbDropBorderMarker;\r\n if ( document.getElementsByClassName( 'wptb-drop-handle' ).length == 0 ) {\r\n wptbDropHandle = document.createElement( 'div' );\r\n wptbDropHandle.classList.add( 'wptb-drop-handle' );\r\n \r\n wptbDropBorderMarker = document.createElement( 'div' );\r\n wptbDropBorderMarker.classList.add( 'wptb-drop-border-marker' );\r\n \r\n let wptbDropBorderMarkerTop = document.createElement( 'div' ),\r\n wptbDropBorderMarkerRight = document.createElement( 'div' ),\r\n wptbDropBorderMarkerBottom = document.createElement( 'div' ),\r\n wptbDropBorderMarkerLeft = document.createElement( 'div' );\r\n \r\n wptbDropBorderMarkerTop.classList.add( 'wptb-drop-border-marker-top' );\r\n wptbDropBorderMarkerRight.classList.add( 'wptb-drop-border-marker-right' );\r\n wptbDropBorderMarkerBottom.classList.add( 'wptb-drop-border-marker-bottom' );\r\n wptbDropBorderMarkerLeft.classList.add( 'wptb-drop-border-marker-left' );\r\n \r\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerTop );\r\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerRight );\r\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerBottom );\r\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerLeft );\r\n \r\n let body = document.getElementsByTagName( 'body' );\r\n if ( body.length > 0 ) {\r\n body[0].appendChild( wptbDropHandle );\r\n body[0].appendChild( wptbDropBorderMarker );\r\n }\r\n \r\n wptbDropHandle.ondragenter = function () {\r\n\r\n }\r\n\r\n wptbDropHandle.ondragover = function (e) {\r\n e.preventDefault();\r\n }\r\n\r\n wptbDropHandle.ondragleave = function () {\r\n\r\n }\r\n wptbDropHandle.ondrop = function (e) {\r\n e.preventDefault();\r\n let element;\r\n \r\n if ( e.dataTransfer.getData('wptbElement') ) {\r\n element = newElementProxy( e.dataTransfer.getData('wptbElement') );\r\n element = element.getDOMElement();\r\n } else {\r\n element = document.getElementsByClassName( e.dataTransfer.getData('node') )[0];\r\n element.classList.remove( 'wptb-moving-mode' );\r\n element.classList.remove( 'wptb-moving-into-same-elem' );\r\n }\r\n \r\n let td;\r\n if( wptbDropHandle.dataset.text == 'Drop Here' ) {\r\n thisElem = wptbDropHandle.getDOMParentElement();\r\n if ( thisElem.nodeName.toLowerCase() == 'td' ) {\r\n td = wptbDropHandle.getDOMParentElement();\r\n td.appendChild( element );\r\n }\r\n } else {\r\n let innerElement = wptbDropHandle.getDOMParentElement();\r\n td = innerElement.parentNode;\r\n \r\n if( wptbDropHandle.dataset.text == 'Above Element' ) {\r\n td.insertBefore( element, innerElement );\r\n } else if( wptbDropHandle.dataset.text == 'Below Element' ) {\r\n let innerElementNext = innerElement.nextSibling;\r\n td.insertBefore( element, innerElementNext );\r\n }\r\n }\r\n \r\n let thisRow = td.parentNode\r\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\r\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n \r\n wptbDropHandle.style.display = 'none';\r\n wptbDropBorderMarker.style.display = 'none';\r\n \r\n WPTB_innerElementSet(element);\r\n \r\n if( ! element.classList.contains( 'wptb-image-container' ) ) {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n }\r\n let wptbContainer = document.querySelector( '.wptb-container' );\r\n wptbContainer.onscroll = function() {\r\n wptbDropHandle.style.display = 'none';\r\n wptbDropBorderMarker.style.display = 'none';\r\n }\r\n } else {\r\n wptbDropHandle = document.getElementsByClassName( 'wptb-drop-handle' )[0];\r\n wptbDropBorderMarker = document.getElementsByClassName( 'wptb-drop-border-marker' )[0];\r\n }\r\n if( thisElem && thisElem.nodeName.toLowerCase() == 'td' && \r\n thisElem.getElementsByClassName( 'wptb-ph-element' ).length != 0 ) {\r\n return;\r\n }\r\n \r\n let thisRow;\r\n if ( thisElem.localName == 'td' ) {\r\n thisRow = thisElem.parentNode;\r\n } else if ( thisElem.localName == 'div' && thisElem.classList.contains( 'wptb-ph-element' ) ) {\r\n thisRow = thisElem.parentNode.parentNode;\r\n }\r\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\r\n let indics = e.dataTransfer.types;\r\n let notDragEnter = false;\r\n for ( let i = 0; i < indics.length; i++ ) {\r\n let infArr = indics[i].match( /wptbelindic-([a-z]+)/i );\r\n if ( infArr && infArr[1] != 'text' ) {\r\n notDragEnter = true;\r\n break;\r\n }\r\n }\r\n if( notDragEnter ) {\r\n return;\r\n }\r\n }\r\n \r\n wptbDropHandle.style.width = thisElem.offsetWidth + 'px';\r\n let height = thisElem.offsetHeight,\r\n coordinatesElement = thisElem.getBoundingClientRect(),\r\n left = parseFloat( coordinatesElement.left ),\r\n top;\r\n wptbDropHandle.style.left = left + 'px';\r\n \r\n if( e.dataTransfer.types.indexOf( 'wptb-moving-mode' ) != -1 ) {\r\n let elementDrag = document.getElementsByClassName( 'wptb-moving-mode' )[0];\r\n if( thisElem == elementDrag ) {\r\n wptbDropHandle.classList.add('wptb-moving-into-same-elem');\r\n wptbDropBorderMarker.classList.add('wptb-moving-into-same-elem');\r\n } else {\r\n wptbDropHandle.classList.remove('wptb-moving-into-same-elem');\r\n wptbDropBorderMarker.classList.remove('wptb-moving-into-same-elem');\r\n }\r\n }\r\n \r\n wptbDropHandle.getDOMParentElement = function() {\r\n return thisElem;\r\n }\r\n \r\n wptbDropHandle.style.display = 'block';\r\n wptbDropBorderMarker.style.display = 'block';\r\n if( thisElem.nodeName.toLowerCase() != 'td' ) {\r\n let y = e.offsetY==undefined?e.layerY:e.offsetY;\r\n top = parseFloat( coordinatesElement.top ) - parseFloat( 11 );\r\n wptbDropHandle.dataset.text = 'Abowe Element';\r\n if ( y > height/2 ) {\r\n top = parseFloat( coordinatesElement.top ) + height - 1;\r\n wptbDropHandle.dataset.text = 'Below Element';\r\n }\r\n } else {\r\n wptbDropHandle.dataset.text = 'Drop Here';\r\n top = parseFloat( coordinatesElement.top ) + height/2 - 5;\r\n }\r\n wptbDropHandle.style.top = top + 'px';\r\n\r\n wptbDropBorderMarker.style.top = coordinatesElement.top + 'px';\r\n wptbDropBorderMarker.style.left = coordinatesElement.left + 'px';\r\n\r\n wptbDropBorderMarkerTop = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-top' );\r\n wptbDropBorderMarkerTop.style.width = ( parseFloat( thisElem.offsetWidth ) - parseFloat( 1 ) ) + 'px';\r\n\r\n wptbDropBorderMarkerRight = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-right' );\r\n wptbDropBorderMarkerRight.style.height = ( parseFloat( coordinatesElement.bottom ) - parseFloat( coordinatesElement.top ) - 1 ) + 'px';\r\n wptbDropBorderMarkerRight.style.left = wptbDropBorderMarkerTop.style.width;\r\n\r\n wptbDropBorderMarkerBottom = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-bottom' );\r\n wptbDropBorderMarkerBottom.style.width = wptbDropBorderMarkerTop.style.width;\r\n wptbDropBorderMarkerBottom.style.top = wptbDropBorderMarkerRight.style.height;\r\n\r\n wptbDropBorderMarkerLeft = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-left' );\r\n wptbDropBorderMarkerLeft.style.height = wptbDropBorderMarkerRight.style.height;\r\n}","var ElementCounters = function () {\r\n\r\n\tvar priv = [];\r\n\tpriv['text'] = 0;\r\n\tpriv['image'] = 0;\r\n\tpriv['list'] = 0;\r\n\tpriv['button'] = 0;\r\n\r\n\tthis.increment = function (key) {\r\n\t\tif (!(key in priv)) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tpriv[key]++;\r\n\t}\r\n\r\n\tthis.nextIndex = function (key) {\r\n\t\tif (!(key in priv)) {\r\n\t\t\treturn undefined;\r\n\t\t}\r\n\t\treturn priv[key] + 1;\r\n\t}\r\n\r\n\treturn this;\r\n\r\n};","var WPTB_ElementOptions = function ( element, index, kindIndexProt ) {\r\n\r\n var node = element.getDOMElement(), elemIdClass;\r\n\r\n prop = document.querySelector(\".wptb-\" + element.kind + \"-options-prototype\").cloneNode(true);\r\n prop.classList.remove(\"wptb-\" + element.kind + \"-options-prototype\"); // remove prototype from the class\r\n elemIdClass = 'wptb-options-' + element.kind + \"-\" + index;\r\n\r\n var properties = prop.getElementsByClassName('wptb-element-property');\r\n\r\n for (var i = 0; i < properties.length; i++) {\r\n properties[i].dataset.element = elemIdClass;\r\n }\r\n\r\n prop.classList.add(elemIdClass);\r\n document.getElementById(\"element-options-group\").appendChild(prop);\r\n \r\n if ( kindIndexProt ) {\r\n if ( element.kind == 'button' ) {\r\n let affectedEl = document.getElementsByClassName( 'wptb-element-' + kindIndexProt )[0],\r\n wptbButtonWrapper,\r\n wptbButtonA,\r\n wptbButton,\r\n wptbSize;\r\n \r\n if ( affectedEl ) {\r\n wptbSize = affectedEl.className.match(/wptb-size-([a-z]+)/i);\r\n }\r\n \r\n if( wptbSize && Array.isArray( wptbSize ) ) {\r\n var b = prop.getElementsByClassName('wptb-btn-size-btn');\r\n \r\n for ( var i = 0; i < b.length; i++ ) {\r\n b[i].classList.remove( 'selected' );\r\n \r\n if ( b[i].innerHTML == wptbSize[1] ) {\r\n b[i].classList.add( 'selected' );\r\n }\r\n }\r\n }\r\n \r\n if( affectedEl ) {\r\n wptbButtonWrapper = affectedEl.getElementsByClassName( 'wptb-button-wrapper' );\r\n \r\n wptbButtonA = affectedEl.getElementsByTagName( 'a' );\r\n \r\n wptbButton = affectedEl.getElementsByClassName( 'wptb-button' );\r\n }\r\n \r\n if ( wptbButtonWrapper ) {\r\n let buttonAlignment = wptbButtonWrapper[0].style.justifyContent,\r\n buttonAlignmentSelect = prop.querySelector( 'select[data-type=\"button-alignment\"]' ),\r\n selectOption = buttonAlignmentSelect.getElementsByTagName( 'option' ),\r\n selectOptionVal;\r\n \r\n if ( buttonAlignment == 'flex-start' ) {\r\n selectOptionVal = 'left';\r\n } else if ( buttonAlignment == 'center' || ! buttonAlignment ) {\r\n selectOptionVal = 'center';\r\n } else if ( buttonAlignment == 'flex-end' ) {\r\n selectOptionVal = 'right';\r\n }\r\n \r\n for ( let i = 0; i < selectOption.length; i++ ) {\r\n if ( selectOption[i].value == selectOptionVal ) {\r\n selectOption[i].selected = true;\r\n }\r\n }\r\n }\r\n \r\n if ( wptbButtonA.length > 0 ) {\r\n let buttonHref = wptbButtonA[0].getAttribute( 'href' ), \r\n buttonLinkTarget = wptbButtonA[0].getAttribute( 'target' ),\r\n buttonId = wptbButtonA[0].getAttribute( 'id' ),\r\n \r\n \r\n buttonHrefInput = prop.querySelector( 'input[data-type=\"button-link\"]' ),\r\n buttonLinkTargetInput = prop.querySelector( 'input[data-type=\"button-link-target\"]' ),\r\n buttonLinkTargetInputId = buttonLinkTargetInput.getAttribute( 'id' ),\r\n buttonLinkTargetInputLabel = buttonLinkTargetInput.parentNode.getElementsByTagName( 'label' )[0],\r\n \r\n buttotIdInput = prop.querySelector( 'input[data-type=\"button-id\"]' );\r\n\r\n buttonLinkTargetInputId = buttonLinkTargetInputId + '-' + kindIndexProt.split( '-' )[1];\r\n buttonLinkTargetInput.setAttribute( 'id', buttonLinkTargetInputId );\r\n buttonLinkTargetInputLabel.setAttribute( 'for', buttonLinkTargetInputId );\r\n\r\n buttonHrefInput.value = buttonHref;\r\n\r\n if( buttonLinkTarget && buttonLinkTarget == '_blank') {\r\n buttonLinkTargetInput.checked = true;\r\n }\r\n \r\n buttotIdInput.value = buttonId;\r\n }\r\n \r\n if( wptbButton ) {\r\n let buttonTextColor = wptbButton[0].style.color,\r\n buttonColor = wptbButton[0].style.backgroundColor,\r\n buttonTextColorInput = prop.querySelector( 'input[data-type=\"button-text-color\"]' ),\r\n buttonBackgroundColorInput = prop.querySelector( 'input[data-type=\"button-color\"]' );\r\n \r\n \r\n buttonTextColorInput.value = WPTB_Helper.rgbToHex( buttonTextColor );\r\n \r\n buttonBackgroundColorInput.value = WPTB_Helper.rgbToHex( buttonColor );\r\n \r\n }\r\n } else if ( element.kind == 'image' ) {\r\n let affectedEl = document.getElementsByClassName( 'wptb-element-' + kindIndexProt );\r\n if ( affectedEl.length > 0 ) {\r\n \r\n let wptbImageWrapper = affectedEl[0].getElementsByClassName( 'wptb-image-wrapper' );\r\n if( wptbImageWrapper.length > 0 ) {\r\n wptbImageWrapper = wptbImageWrapper[0];\r\n \r\n // set select according to the alignment of the image\r\n let imgAlign = wptbImageWrapper.style.textAlign,\r\n imageAlignmentSelect = prop.querySelector( 'select[data-type=\"image-alignment\"]' ),\r\n selectOption = imageAlignmentSelect.getElementsByTagName( 'option' );\r\n\r\n for ( let i = 0; i < selectOption.length; i++ ) {\r\n if ( selectOption[i].value == imgAlign ) {\r\n selectOption[i].selected = true;\r\n }\r\n }\r\n \r\n \r\n let elementsA = wptbImageWrapper.getElementsByTagName( 'a' );\r\n if ( elementsA.length > 0 ) {\r\n let a = elementsA[0];\r\n\r\n if ( a ) {\r\n a.onclick = function( e ) {\r\n e.preventDefault();\r\n }\r\n\r\n // set text link for input field of setting panel\r\n let imageLinkHref = a.getAttribute( 'href' ),\r\n inputImageLink = prop.querySelector( 'input[data-type=\"image-link\"]' );\r\n if ( imageLinkHref ) {\r\n inputImageLink.value = imageLinkHref;\r\n }\r\n\r\n // set checkbox for target of link \r\n let imageLinkTarget = a.getAttribute( 'target' ),\r\n imageLinkTargetInput = prop.querySelector( 'input[data-type=\"image-link-target\"]' ),\r\n imageLinkTargetInputId = imageLinkTargetInput.getAttribute( 'id' ),\r\n imageLinkTargetInputLabel = imageLinkTargetInput.parentNode.getElementsByTagName( 'label' )[0];\r\n\r\n imageLinkTargetInputId = imageLinkTargetInputId + '-' + kindIndexProt.split( '-' )[1];\r\n\r\n imageLinkTargetInput.setAttribute( 'id', imageLinkTargetInputId );\r\n imageLinkTargetInputLabel.setAttribute( 'for', imageLinkTargetInputId );\r\n\r\n if ( imageLinkTarget && imageLinkTarget == '_blank' ) {\r\n imageLinkTargetInput.checked = true;\r\n }\r\n\r\n // set value for input fields of image size\r\n let imgWidth = a.style.width;\r\n if ( imgWidth ) {\r\n let imageWidthInputRange = prop.querySelector( 'input[type=\"range\"][data-type=\"image-size\"]' ),\r\n imageWidthInputNumber = prop.querySelector( 'input[type=\"number\"][data-type=\"image-size\"]' );\r\n\r\n imageWidthInputRange.value = parseInt( imgWidth );\r\n imageWidthInputNumber.value = parseInt( imgWidth );\r\n }\r\n\r\n let img = a.getElementsByTagName( 'img' );\r\n if ( img.length > 0 ) {\r\n // set value for input field of alternative text image\r\n let imgAlternativeText = img[0].getAttribute('alt'),\r\n imageAlternativeTextInput = prop.querySelector( 'input[type=\"text\"][data-type=\"alternative-text\"]' );\r\n\r\n imageAlternativeTextInput.value = imgAlternativeText;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n } else if ( element.kind == 'text' ) {\r\n let affectedEl = document.getElementsByClassName( 'wptb-element-' + kindIndexProt );\r\n if ( affectedEl.length > 0 ) {\r\n let elementFontSize = affectedEl[0].style.fontSize,\r\n elementTextColor = affectedEl[0].style.color;\r\n let textFontSizeInputRange = prop.querySelector( 'input[type=\"range\"][data-type=\"font-size\"]' ),\r\n textFontSizeInputNumber = prop.querySelector( 'input[type=\"number\"][data-type=\"font-size\"]' ),\r\n textColorInput = prop.querySelector( 'input[type=\"text\"][data-type=\"color\"]' );\r\n\r\n textFontSizeInputRange.value = parseInt( elementFontSize ) ? parseInt( elementFontSize ) : 10;\r\n textFontSizeInputNumber.value = parseInt( elementFontSize ) ? parseInt( elementFontSize ) : 10;\r\n textColorInput.value = WPTB_Helper.rgbToHex( elementTextColor );\r\n }\r\n } else if ( element.kind == 'list' ) {\r\n let elementList = document.getElementsByClassName( 'wptb-element-' + kindIndexProt );\r\n if ( elementList.length > 0 ) {\r\n let elementListColor = elementList[0].querySelector( 'p' ).style.color;\r\n let listColorInput = prop.querySelector( 'input[type=\"text\"][data-type=\"list-text-color\"]' );\r\n listColorInput.value = WPTB_Helper.rgbToHex( elementListColor );\r\n \r\n let elementListItem = elementList[0].querySelectorAll( 'li' );\r\n if ( elementListItem.length > 0 ) {\r\n let listItemP = elementListItem[0].querySelector( 'p' );\r\n let listItemPClasses = listItemP.classList;\r\n //listItemPClasses = [...listItemPClasses];\r\n if ( listItemPClasses.length > 0 ) {\r\n let elementListClassSelect = prop.querySelector( 'select[data-type=\"list-class\"]' );\r\n if ( elementListClassSelect ) {\r\n elementListClassSelect.value = 'unordered';\r\n \r\n let listIconSelectLabel = elementListClassSelect.parentNode.nextSibling;\r\n for ( let i = 0; i < 10; i++ ) {\r\n if ( listIconSelectLabel.nodeType == '1' ) {\r\n break;\r\n } else {\r\n listIconSelectLabel = listIconSelectLabel.nextSibling;\r\n }\r\n }\r\n if ( listIconSelectLabel ) {\r\n let listIconSelectLabelId = listIconSelectLabel.getAttribute( 'id' );\r\n listIconSelectLabel.setAttribute( 'id', listIconSelectLabelId + '-' + kindIndexProt );\r\n listIconSelectLabel.style.display = 'flex';\r\n }\r\n \r\n let elementListStyleTypeSelect = prop.querySelector( 'select[data-type=\"list-style-type\"]' );\r\n if ( elementListStyleTypeSelect ) {\r\n elementListStyleTypeSelect.parentNode.style.display = 'flex';\r\n \r\n if( listItemPClasses.contains( 'wptb-list-style-type-disc' ) ) {\r\n elementListStyleTypeSelect.value = 'disc';\r\n } else if( listItemPClasses.contains( 'wptb-list-style-type-circle' ) ) {\r\n elementListStyleTypeSelect.value = 'circle';\r\n } else if( listItemPClasses.contains( 'wptb-list-style-type-square' ) ) {\r\n elementListStyleTypeSelect.value = 'square';\r\n } else if ( listItemPClasses.contains( 'wptb-list-style-type-none' ) ) {\r\n elementListStyleTypeSelect.value = 'none';\r\n }\r\n }\r\n }\r\n }\r\n }\r\n \r\n let elementListItemContent = elementList[0].getElementsByClassName( 'wptb-list-item-content' );\r\n if ( elementListItemContent.length > 0 ) {\r\n let listItemPTextAlignArr = [];\r\n for ( let i = 0; i < elementListItemContent.length; i++ ) {\r\n let p = elementListItemContent[i].querySelector( 'p' );\r\n if ( p ) {\r\n if ( p.style.textAlign ) {\r\n listItemPTextAlignArr.push( p.style.textAlign );\r\n } else {\r\n listItemPTextAlignArr.push( 'left' );\r\n }\r\n }\r\n \r\n }\r\n \r\n let listItemPTextAlignLeftCount = 0,\r\n listItemPTextAlignCenterCount = 0,\r\n listItemPTextAlignRightCount = 0;\r\n \r\n if ( listItemPTextAlignArr.length > 0 ) {\r\n for ( let i = 0; i < listItemPTextAlignArr.length; i++ ) {\r\n if ( listItemPTextAlignArr[i] ) {\r\n if ( listItemPTextAlignArr[i] == 'left' ) {\r\n listItemPTextAlignLeftCount++;\r\n } else if ( listItemPTextAlignArr[i] == 'center' ) {\r\n listItemPTextAlignCenterCount++;\r\n } else if ( listItemPTextAlignArr[i] == 'right' ) {\r\n listItemPTextAlignRightCount++;\r\n }\r\n }\r\n }\r\n }\r\n \r\n let elementListAlignmentSelect = prop.querySelector( 'select[data-type=\"list-alignment\"]' ),\r\n maxListItemTAlLeftC = Math.max( listItemPTextAlignLeftCount, listItemPTextAlignCenterCount, listItemPTextAlignRightCount );\r\n \r\n if ( listItemPTextAlignLeftCount == maxListItemTAlLeftC ) {\r\n elementListAlignmentSelect.value = 'left';\r\n } else if ( listItemPTextAlignCenterCount == maxListItemTAlLeftC ) {\r\n elementListAlignmentSelect.value = 'center';\r\n } else if ( listItemPTextAlignRightCount == maxListItemTAlLeftC ) {\r\n elementListAlignmentSelect.value = 'right';\r\n }\r\n }\r\n } \r\n }\r\n }\r\n\r\n node.onclick = function () {\r\n var infArr = this.className.match(/wptb-element-((.+-)\\d+)/i),\r\n optionsClass = '.wptb-' + infArr[2] + 'options' +\r\n '.wptb-options-' + infArr[1];\r\n\r\n document.getElementsByClassName('wptb-elements-container')[0].style.display = 'none';\r\n document.getElementsByClassName('wptb-settings-section')[0].style.display = 'none';\r\n document.getElementById(\"element-options-group\").style.display = 'block';\r\n\r\n var children = document.getElementById(\"element-options-group\").childNodes;\r\n for (var i = 0; i < children.length; i++) {\r\n if (children[i].style)\r\n children[i].style.display = 'none';\r\n }\r\n\r\n document.querySelector(optionsClass).style.display = 'block';\r\n\r\n //var listStyleType, textAlign;\r\n\r\n// switch (element.kind) {\r\n\r\n// case 'text':\r\n// jQuery(prop).find('[data-type=color]').wpColorPicker({ defaultColor: node.style.color });\r\n// prop.querySelector('[type=number][data-type=font-size]').value\r\n// = prop.querySelector('[type=range][data-type=font-size]').value\r\n// = node.style.fontSize.substring(0, node.style.fontSize.length - 2);\r\n// break;\r\n// case 'list':\r\n// textAlign = node.querySelector('li p').style.textAlign;\r\n// listStyleType = node.querySelector('li').style.listStyleType;\r\n// if ( prop.querySelector( 'select[data-type=list-class]' ) ) {\r\n// console.log(textAlign);\r\n// console.log(listStyleType);\r\n// console.log(listStyleType);\r\n// console.log(prop);\r\n// prop.querySelector('select[data-type=list-class]').selectedIndex = ( listStyleType == 'decimal' ? 0 : 1 );\r\n// }\r\n// if ( prop.querySelector('select[data-type=list-style-type]') ) {\r\n// prop.querySelector('select[data-type=list-style-type]').selectedIndex = (listStyleType == 'circle' ? 0 : (listStyleType == 'square' ? 1 : 2));\r\n// }\r\n// if ( prop.querySelector('select[data-type=list-alignment]') ) {\r\n// prop.querySelector('select[data-type=list-alignment]').selectedIndex = (textAlign == 'left' ? 0 : (textAlign == 'center' ? 1 : 2));\r\n// }\r\n// break;\r\n// case 'image':\r\n// break;\r\n// case 'button':\r\n// jQuery(prop).find('[data-type=button-color]').wpColorPicker({ defaultColor: node.style.backgroundColor });\r\n// break;\r\n//\r\n// }\r\n };\r\n\r\n if (element.kind == 'button') {\r\n //We must add this special kind of property, since it is triggered with click event\r\n var buttons = prop.getElementsByClassName('wptb-btn-size-btn');\r\n\r\n for (var i = 0; i < buttons.length; i++) {\r\n buttons[i].onclick = function () {\r\n var size = this.innerHTML,\r\n n_Class = this.dataset.element,\r\n infArr = n_Class.match(/wptb-options-(.+)-(\\d+)/i),\r\n type = infArr[1],\r\n num = infArr[2],\r\n affectedEl = document.getElementsByClassName('wptb-element-' + type + '-' + num)[0];\r\n affectedEl.classList.remove('wptb-size-S');\r\n affectedEl.classList.remove('wptb-size-M');\r\n affectedEl.classList.remove('wptb-size-L');\r\n affectedEl.classList.remove('wptb-size-XL');\r\n affectedEl.classList.add('wptb-size-' + size);\r\n var b = this.parentNode.getElementsByClassName('wptb-btn-size-btn');\r\n for (var i = 0; i < b.length; i++) {\r\n b[i].classList.remove('selected');\r\n }\r\n this.classList.add('selected');\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n }\r\n }\r\n\r\n var optionControls = prop.getElementsByClassName('wptb-element-property');\r\n\r\n for (var i = 0; i < optionControls.length; i++) {\r\n if (optionControls[i].classList.contains('wptb-color-picker')) {\r\n jQuery(optionControls[i]).wpColorPicker({\r\n change: function (event, ui) {\r\n var parent = event.target, classe, type, ps, number;\r\n classe = parent.dataset.element.match(/wptb-options-(.+)-(\\d+)/i);\r\n type = classe[1];\r\n number = classe[2];\r\n affectedEl = document.getElementsByClassName('wptb-element-' + type + '-' + number)[0];\r\n if ( type == 'button' ) {\r\n if (parent.dataset.type == 'button-text-color') {\r\n affectedEl.getElementsByClassName('wptb-button')[0].style.color = ui.color.toString();\r\n } else {\r\n affectedEl.getElementsByClassName('wptb-button')[0].style.backgroundColor = ui.color.toString();\r\n }\r\n } else if( type == 'list' ) {\r\n let ps = affectedEl.querySelectorAll( 'p' );\r\n if( ps.length > 0 ) {\r\n for ( let i = 0; i < ps.length; i++ ) {\r\n ps[i].style.color = ui.color.toString();\r\n }\r\n }\r\n } else {\r\n affectedEl.style.color = ui.color.toString();\r\n }\r\n \r\n //console.log(event);\r\n WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving( event );\r\n }\r\n });\r\n }\r\n\r\n if ( optionControls[i].dataset.type === 'font-size' ) {\r\n var slider = optionControls[i].parentNode.parentNode.getElementsByClassName('wptb-text-font-size-slider')[0];\r\n slider.oninput = function () {\r\n this.parentNode.parentNode.getElementsByClassName('wptb-text-font-size-number')[0].value = this.value;\r\n this.parentNode.parentNode.getElementsByClassName('wptb-text-font-size-number')[0].onchange( event );\r\n }\r\n }\r\n\r\n if (optionControls[i].dataset.type === 'image-size') {\r\n var slider = optionControls[i].parentNode.parentNode.getElementsByClassName('wptb-image-size-slider')[0];\r\n slider.oninput = function () {\r\n this.parentNode.parentNode.getElementsByClassName('wptb-image-width-number')[0].value = this.value;\r\n this.parentNode.parentNode.getElementsByClassName('wptb-image-width-number')[0].onchange( event );\r\n }\r\n }\r\n\r\n optionControls[i].onchange = function ( event ) {\r\n var n_Class = this.dataset.element,\r\n infArr = n_Class.match(/wptb-options-(.+)-(\\d+)/i),\r\n type = infArr[1],\r\n num = infArr[2],\r\n affectedEl = document.getElementsByClassName('wptb-element-' + type + '-' + num)[0],\r\n val = this.value;\r\n\r\n switch ( this.dataset.type ) {\r\n case 'src':\r\n var img = affectedEl.getElementsByTagName(\"img\")[0];\r\n img.src = this.value;\r\n break;\r\n case 'alternative-text':\r\n var img = affectedEl.getElementsByTagName('img')[0];\r\n img.alt = this.value;\r\n break;\r\n case 'image-link':\r\n affectedEl.getElementsByTagName('a')[0].href = WPTB_Helper.linkHttpCheckChange( this.value );\r\n break;\r\n case 'image-link-target':\r\n if (this.checked == true) {\r\n affectedEl.getElementsByTagName('a')[0].target = '_blank';\r\n } else {\r\n affectedEl.getElementsByTagName('a')[0].target = '_self';\r\n }\r\n break;\r\n case 'image-link-nofollow':\r\n if (this.checked == true) {\r\n affectedEl.getElementsByTagName('a')[0].rel = 'nofollow';\r\n } else {\r\n affectedEl.getElementsByTagName('a')[0].removeAttribute('rel');\r\n }\r\n break;\r\n case 'image-size':\r\n affectedEl.getElementsByTagName('a')[0].style.width = this.value + '%';\r\n affectedEl.getElementsByTagName('a')[0].style.height = 'auto';\r\n this.parentNode.parentNode.getElementsByClassName('wptb-image-size-slider')[0].value = this.value;\r\n break;\r\n case 'image-alignment':\r\n affectedEl.getElementsByClassName( 'wptb-image-wrapper' )[0].style.textAlign = this.value;\r\n break;\r\n case 'font-size':\r\n affectedEl.style.fontSize = val + 'px';\r\n this.parentNode.parentNode.getElementsByClassName('wptb-text-font-size-slider')[0].value = this.value;\r\n break;\r\n case 'button-alignment':\r\n var jc = '';\r\n if (this.value == 'left') {\r\n jc = 'start';\r\n } else if (this.value == 'right') {\r\n jc = 'flex-end';\r\n } else {\r\n jc = 'center';\r\n }\r\n affectedEl.getElementsByClassName('wptb-button-wrapper')[0].style.justifyContent = jc;\r\n break;\r\n case 'button-link':\r\n if ( this.value ) {\r\n affectedEl.getElementsByTagName( 'a' )[0].href = WPTB_Helper.linkHttpCheckChange( this.value );\r\n } else {\r\n affectedEl.getElementsByTagName( 'a' )[0].removeAttribute( 'href' );\r\n }\r\n break;\r\n case 'button-link-target':\r\n if (this.checked == true) {\r\n affectedEl.getElementsByTagName('a')[0].target = '_blank';\r\n } else {\r\n affectedEl.getElementsByTagName('a')[0].target = '_self';\r\n }\r\n break;\r\n case 'button-link-nofollow':\r\n if (this.checked == true) {\r\n affectedEl.getElementsByTagName('a')[0].rel = 'nofollow';\r\n } else {\r\n affectedEl.getElementsByTagName('a')[0].removeAttribute( 'rel' );\r\n }\r\n break;\r\n case 'button-id':\r\n if( this.value ) {\r\n affectedEl.getElementsByTagName( 'a' )[0].id = this.value;\r\n } else {\r\n affectedEl.getElementsByTagName( 'a' )[0].removeAttribute( 'id' );\r\n }\r\n case 'button-color':\r\n break;\r\n case 'list-alignment':\r\n let listItems = affectedEl.querySelectorAll('li');\r\n for (var i = 0; i < listItems.length; i++) {\r\n let p = listItems[i].querySelector( 'p' );\r\n if ( p ) {\r\n p.style.textAlign = this.value;\r\n }\r\n }\r\n break;\r\n case 'list-class':\r\n let parentNode = event.target\r\n .parentNode\r\n .parentNode\r\n .querySelector('[data-type=list-style-type]')\r\n .parentNode,\r\n parentNodeSettingItem = parentNode.parentNode;\r\n if (val == 'unordered') {\r\n parentNode.style.display = 'flex';\r\n \r\n parentNodeSettingItem.querySelector( '.wptb-list-icon-select-label' ).style.display = 'flex';\r\n let listItem = affectedEl.querySelectorAll('li');\r\n for (var i = 0; i < listItem.length; i++) {\r\n let p = listItem[i].querySelector( 'p' );\r\n p.removeAttribute ( 'class' );\r\n p.classList.add( 'wptb-list-style-type-disc' );\r\n }\r\n parentNodeSettingItem.querySelector('[data-type=list-style-type]').value = 'disc';\r\n } else {\r\n parentNode.style.display = 'none';\r\n parentNodeSettingItem.querySelector( '.wptb-list-icon-select-label' ).style.display = 'none';\r\n var listItem = affectedEl.querySelectorAll('li');\r\n for (var i = 0; i < listItem.length; i++) {\r\n let p = listItem[i].querySelector( 'p' );\r\n p.removeAttribute ( 'class' );\r\n }\r\n }\r\n break;\r\n case 'list-style-type':\r\n var listItem = affectedEl.querySelectorAll('li');\r\n for (var i = 0; i < listItem.length; i++) {\r\n let p = listItem[i].querySelector( 'p' );\r\n p.removeAttribute ( 'class' );\r\n p.classList.add( 'wptb-list-style-type-' + val.toLowerCase() );\r\n }\r\n break;\r\n }\r\n \r\n \r\n if( event.target.classList.contains( 'wptb-text-font-size-slider' ) || event.target.classList.contains( 'wptb-image-size-slider' ) ) {\r\n event.target.onmouseup = function() {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n } else {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n }\r\n }\r\n};","var WPTB_Helper = {\r\n hexToRgb: function( hex ) {\r\n var result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec( hex );\r\n return result ? 'rgb(' + parseInt( result[1], 16 ) + ',' + parseInt( result[2], 16 ) + ',' + parseInt( result[3], 16 ) + ')' : null;\r\n },\r\n rgbToHex: function ( rgb ) {\r\n var rgb = rgb.match( /^rgba?[\\s+]?\\([\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?/i );\r\n\r\n return ( rgb && rgb.length === 4 ) ? \"#\" +\r\n ( \"0\" + parseInt( rgb[1],10 ).toString( 16 )).slice( -2 ) +\r\n ( \"0\" + parseInt( rgb[2],10 ).toString( 16 )).slice( -2 ) +\r\n ( \"0\" + parseInt( rgb[3],10 ).toString( 16 )).slice( -2 ) : '';\r\n },\r\n getDragImageCustom: function ( type ) {\r\n let hostName = location.protocol + '//' + location.hostname;\r\n let img = document.createElement( 'img' );\r\n img.src = hostName + '/wp-content/plugins/wp-table-builder/inc/admin/views/builder/icons/' + type + '.png';\r\n return img;\r\n },\r\n dragImagesArr: function() {\r\n return {\r\n text: WPTB_Helper.getDragImageCustom( 'text' ),\r\n image: WPTB_Helper.getDragImageCustom( 'image' ),\r\n button: WPTB_Helper.getDragImageCustom( 'button' ),\r\n list: WPTB_Helper.getDragImageCustom( 'list' )\r\n };\r\n },\r\n listItemsRecalculateIndex: function( ulElem ) {\r\n let par = ulElem.querySelectorAll( 'p' );\r\n if ( par.length > 0 ) {\r\n for ( let i = 0; i < par.length; i++ ) {\r\n par[i].dataset.listStyleTypeIndex = Number( i ) + 1 + '.';\r\n }\r\n }\r\n },\r\n listItemsTinyMceInit: function( listItem ) {\r\n tinyMCE.init({\r\n target: listItem,\r\n inline: true,\r\n plugins: \"link, paste\",\r\n dialog_type: \"modal\",\r\n theme: 'modern',\r\n menubar: false,\r\n fixed_toolbar_container: '#wpcd_fixed_toolbar',\r\n paste_as_text: true,\r\n toolbar: 'bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify',\r\n setup: function(ed) {\r\n ed.on('keydown', function(e) {\r\n let article = e.target.parentNode;\r\n if ( e.keyCode == 13 ) {\r\n e.preventDefault();\r\n let text = e.target.innerHTML;\r\n let duplicate = new WPTB_ListItem( text, article, true );\r\n \r\n article.parentNode.insertBefore( duplicate.getDOMElement(), article );\r\n WPTB_Helper.listItemsTinyMceInit( duplicate.getDOMElement().firstChild );\r\n e.target.querySelector( 'p' ).innerText = 'New List Item';\r\n //tinyMCE.execCommand('mceInsertContent', false, 'New List Item');\r\n WPTB_Helper.listItemsRecalculateIndex( article.parentNode );\r\n \r\n return;\r\n \r\n } else if ( e.keyCode == '8' || e.keyCode == '46' ) {\r\n let p = e.target.querySelector( 'p' );\r\n let pText = p.innerHTML.replace(/<[^>]+>/g, '');\r\n pText = pText.replace( /\\s+/g, ' ' ).trim();\r\n pText = pText.replace( /&nbsp;/g, '').trim();\r\n \r\n if( pText == '' ) {\r\n e.preventDefault();\r\n e.target.querySelector( 'p' ).innerText = '\\n';\r\n } else {\r\n let selectedText = WPTB_Helper.getSelectionText();\r\n selectedText = selectedText.replace( /\\s+/g, ' ' ).trim();\r\n selectedText = selectedText.replace( /&nbsp;/g, '' ).trim();\r\n if( selectedText == pText ) {\r\n e.preventDefault();\r\n e.target.querySelector( 'p' ).innerText = '\\n';\r\n }\r\n }\r\n }\r\n \r\n let wptbListItem = e.target.parentNode;\r\n let wptbActionsField = new WPTB_ActionsField();\r\n\r\n wptbActionsField.addActionField( 2, wptbListItem );\r\n\r\n wptbActionsField.setParameters( wptbListItem );\r\n });\r\n \r\n ed.on( 'keyup', function( e ) {\r\n let wptbListItem = e.target.parentNode;\r\n let wptbActionsField = new WPTB_ActionsField();\r\n\r\n wptbActionsField.addActionField( 2, wptbListItem );\r\n\r\n wptbActionsField.setParameters( wptbListItem );\r\n \r\n e.target.onblur = function() {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n });\r\n },\r\n init_instance_callback: function (editor) {\r\n window.currentEditor = editor;\r\n editor.on('focus', function (e) {\r\n var totalWidth = document.getElementsByClassName('wptb-builder-panel')[0].offsetWidth;\r\n if (window.currentEditor &&\r\n document.getElementById('wptb_builder').scrollTop >= 55 &&\r\n window.currentEditor.bodyElement.style.display != 'none') {\r\n document.getElementById('wpcd_fixed_toolbar').style.position = 'fixed';\r\n document.getElementById('wpcd_fixed_toolbar').style.right = (totalWidth / 2 - document.getElementById('wpcd_fixed_toolbar').offsetWidth / 2) + 'px';\r\n document.getElementById('wpcd_fixed_toolbar').style.top = '100px';\r\n } else {\r\n document.getElementById('wpcd_fixed_toolbar').style.position = 'static';\r\n delete document.getElementById('wpcd_fixed_toolbar').style.right;\r\n delete document.getElementById('wpcd_fixed_toolbar').style.top;\r\n }\r\n });\r\n }\r\n });\r\n },\r\n buttonsTinyMceInit: function( target ) {\r\n tinyMCE.init({\r\n target: target,\r\n inline: true,\r\n plugins: \"link\",\r\n dialog_type: \"modal\",\r\n theme: 'modern',\r\n menubar: false,\r\n fixed_toolbar_container: '#wpcd_fixed_toolbar',\r\n toolbar: 'bold italic strikethrough',\r\n setup : function(ed) {\r\n ed.on( 'keydown', function(e) {\r\n if (e.keyCode == 13) {\r\n e.preventDefault();\r\n }\r\n let wptbButtonContainer = WPTB_Helper.findAncestor( target, 'wptb-button-container' );\r\n \r\n let wptbActionsField = new WPTB_ActionsField();\r\n\r\n wptbActionsField.addActionField( 1, wptbButtonContainer );\r\n\r\n wptbActionsField.setParameters( wptbButtonContainer );\r\n });\r\n \r\n ed.on( 'keyup', function(e) {\r\n let wptbButtonContainer = WPTB_Helper.findAncestor( target, 'wptb-button-container' );\r\n \r\n let wptbActionsField = new WPTB_ActionsField();\r\n\r\n wptbActionsField.addActionField( 1, wptbButtonContainer );\r\n\r\n wptbActionsField.setParameters( wptbButtonContainer );\r\n \r\n e.target.onblur = function() {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n });\r\n },\r\n init_instance_callback: function (editor) {\r\n window.currentEditor = editor;\r\n editor.on('focus', function (e) {\r\n var totalWidth = document.getElementsByClassName('wptb-builder-panel')[0].offsetWidth;\r\n if (window.currentEditor &&\r\n document.getElementById('wptb_builder').scrollTop >= 55 &&\r\n window.currentEditor.bodyElement.style.display != 'none') {\r\n document.getElementById('wpcd_fixed_toolbar').style.position = 'fixed';\r\n document.getElementById('wpcd_fixed_toolbar').style.right = (totalWidth / 2 - document.getElementById('wpcd_fixed_toolbar').offsetWidth / 2) + 'px';\r\n document.getElementById('wpcd_fixed_toolbar').style.top = '100px';\r\n } else {\r\n document.getElementById('wpcd_fixed_toolbar').style.position = 'static';\r\n delete document.getElementById('wpcd_fixed_toolbar').style.right;\r\n delete document.getElementById('wpcd_fixed_toolbar').style.top;\r\n }\r\n });\r\n }\r\n });\r\n },\r\n linkHttpCheckChange: function( link ) {\r\n if ( link ) {\r\n if ( link.indexOf( 'http://' ) == -1 && link.indexOf( 'https://' ) == -1 ) {\r\n let linkArr = link.split( '/' ),\r\n linkClean;\r\n if ( Array.isArray( linkArr ) && linkArr.length > 0 ) {\r\n linkClean = linkArr[linkArr.length - 1];\r\n }\r\n return document.location.protocol + '//' + linkClean;\r\n } else { \r\n return link;\r\n }\r\n } else {\r\n return '';\r\n }\r\n },\r\n dataTitleColumnSet: function( table ) {\r\n let rows = table.rows,\r\n rowHead = rows[0];\r\n let computedStyleRowHead = getComputedStyle(rowHead);\r\n \r\n let rowHeadChildren = rowHead.children;\r\n let contentsForHeader = {};\r\n for( let i = 0; i < rowHeadChildren.length; i++ ) {\r\n let tdElements = rowHeadChildren[i].children;\r\n for( let j = 0; j < tdElements.length; j++ ) {\r\n let element = tdElements[j];\r\n if( element.classList.contains( 'wptb-ph-element' ) ) {\r\n let infArr = element.className.match( /wptb-element-(.+)-(\\d+)/i );\r\n if( infArr[1] == 'text' ) {\r\n let p = element.querySelector( 'p' ),\r\n textContent = p.textContent,\r\n textAlign = p.style.textAlign;\r\n contentsForHeader[rowHeadChildren[i].dataset.xIndex] = [textContent, element.style.fontSize, \r\n element.style.color, computedStyleRowHead.backgroundColor, textAlign];\r\n break;\r\n }\r\n }\r\n }\r\n if( ! contentsForHeader[rowHeadChildren[i].dataset.xIndex] ) {\r\n contentsForHeader[rowHeadChildren[i].dataset.xIndex] = ['', '', \r\n '', computedStyleRowHead.backgroundColor, ''];\r\n }\r\n }\r\n for ( let i = 1; i < rows.length; i++ ) {\r\n let thisRow = rows[i],\r\n thisRowChildren = thisRow.children;\r\n for( let j = 0; j < thisRowChildren.length; j++ ) {\r\n if ( contentsForHeader[thisRowChildren[j].dataset.xIndex] ) {\r\n thisRowChildren[j].dataset.wptbTitleColumn = contentsForHeader[thisRowChildren[j].dataset.xIndex][0];\r\n thisRowChildren[j].dataset.wptbTitleColumnFontSize = contentsForHeader[thisRowChildren[j].dataset.xIndex][1];\r\n thisRowChildren[j].dataset.wptbTitleColumnColor = contentsForHeader[thisRowChildren[j].dataset.xIndex][2];\r\n thisRowChildren[j].dataset.wptbTitleBackgroundColor = contentsForHeader[thisRowChildren[j].dataset.xIndex][3];\r\n thisRowChildren[j].dataset.wptbTitleAlign = contentsForHeader[thisRowChildren[j].dataset.xIndex][4];\r\n } else {\r\n thisRowChildren[j].dataset.wptbTitleColumn = '';\r\n thisRowChildren[j].dataset.wptbTitleColumnFontSize = '';\r\n thisRowChildren[j].dataset.wptbTitleColumnColor = '';\r\n thisRowChildren[j].dataset.wptbTitleBackgroundColor = '';\r\n thisRowChildren[j].dataset.wptbTitleAlign = '';\r\n }\r\n }\r\n }\r\n },\r\n findAncestor: function(el, cls) {\r\n while ((el = el.parentElement) && !el.classList.contains(cls));\r\n return el;\r\n },\r\n getSelectionText: function() {\r\n var txt = '';\r\n if (txt = window.getSelection) {\r\n txt = window.getSelection().toString();\r\n } else {\r\n txt = document.selection.createRange().text;\r\n }\r\n return txt;\r\n },\r\n settingsPanelClear: function() {\r\n document.getElementById( 'wptb-adaptive-table-checkbox' ).checked = false;\r\n document.getElementById( 'wptb-top-row-as-header' ).checked = false;\r\n document.getElementById( 'wptb-table-border-slider' ).value = 0;\r\n document.getElementById( 'wptb-table-border-number' ).value = 0;\r\n document.getElementById( 'wptb-inner-border-check' ).checked = false;\r\n document.getElementById( 'wptb-apply-inner-border' ).classList.remove( 'visible' );\r\n document.getElementById( 'wptb-table-inner-border-slider' ).value = 1;\r\n document.getElementById( 'wptb-table-inner-border-number' ).value = 1;\r\n \r\n WPTB_Helper.wpColorPickerClear( 'wptb-table-border-color', true );\r\n \r\n WPTB_Helper.wpColorPickerClear( 'wptb-table-header-bg', true );\r\n \r\n WPTB_Helper.wpColorPickerClear( 'wptb-even-row-bg', true );\r\n \r\n WPTB_Helper.wpColorPickerClear( 'wptb-odd-row-bg', true );\r\n \r\n document.getElementById( 'wptb-table-cell-slider' ).value = 15;\r\n document.getElementById( 'wptb-table-cell-number' ).value = 15;\r\n },\r\n elementOptionsPanelClear: function() {\r\n let elementOptionsGroup = document.getElementById( 'element-options-group' );\r\n if( elementOptionsGroup ) {\r\n elementOptionsGroup.innerHTML = '';\r\n }\r\n },\r\n wpColorPickerCheckChangeForTableStateSaving: function( event ) {\r\n if( event.originalEvent.type == 'external' ) {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n } else {\r\n let wpPickerContainer = WPTB_Helper.findAncestor( event.target, 'wp-picker-container' );\r\n if( wpPickerContainer ) {\r\n if( event.originalEvent.type == 'square' ) {\r\n let irisSquareHandle = wpPickerContainer.getElementsByClassName( 'iris-square-handle' );\r\n if( irisSquareHandle.length > 0 ) {\r\n irisSquareHandle = irisSquareHandle[0];\r\n irisSquareHandle.onmouseup = function() {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n }\r\n } else if( event.originalEvent.type == 'strip' ) {\r\n let uiSliderHandle = wpPickerContainer.getElementsByClassName( 'iris-slider-offset' );\r\n if( uiSliderHandle.length > 0 ) {\r\n uiSliderHandle = uiSliderHandle[0];\r\n uiSliderHandle.onmouseup = function() {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n },\r\n wpColorPickerClear: function( attribute, isId ) {\r\n let input;\r\n if( isId ) {\r\n input = [document.getElementById( attribute )];\r\n input.length = 1;\r\n } else {\r\n input = document.getElementsByClassName( attribute );\r\n }\r\n for( let i = 0; i < input.length; i++ ) {\r\n let wpPickerContainer = WPTB_Helper.findAncestor( input[i], 'wp-picker-container' );\r\n if( wpPickerContainer ) {\r\n let parent = wpPickerContainer.parentNode;\r\n parent.removeChild( wpPickerContainer );\r\n let newInput = document.createElement( 'input' );\r\n if( isId ) {\r\n newInput.setAttribute( 'id', attribute );\r\n } else {\r\n newInput.classList.add( 'wptb-element-property', attribute );\r\n }\r\n newInput.value = \"\";\r\n parent.appendChild( newInput );\r\n }\r\n }\r\n },\r\n detectMode: function() {\r\n var url = window.location.href,\r\n regex = new RegExp('[?&]table(=([^&#]*)|&|#|$)'),\r\n results = regex.exec(url);\r\n if (!results) return false;\r\n if (!results[2]) return '';\r\n return decodeURIComponent(results[2].replace(/\\+/g, ' '));\r\n },\r\n getColumnWidth: function( table, cell ) {\r\n let xIndex = cell.dataset.xIndex;\r\n let xIndexes = table.querySelectorAll( '[data-x-index=\"' + xIndex + '\"]' );\r\n let cellWidth = cell.getCellDimensions().width;\r\n for( let i = 0; i < xIndexes.length; i++ ) {\r\n if( cellWidth > xIndexes[i].getCellDimensions().width ) {\r\n cellWidth = xIndexes[i].getCellDimensions().width;\r\n }\r\n }\r\n return cellWidth;\r\n },\r\n getRowHeight: function( table, cell ) {\r\n let yIndex = cell.dataset.yIndex;\r\n let yIndexes = table.querySelectorAll( '[data-y-index=\"' + yIndex + '\"]' );\r\n let cellHeight = cell.getCellDimensions().height;\r\n for( let i = 0; i < yIndexes.length; i++ ) {\r\n if( cellHeight > yIndexes[i].getCellDimensions().height ) {\r\n cellHeight = yIndexes[i].getCellDimensions().height;\r\n }\r\n }\r\n return cellHeight;\r\n }\r\n}\r\n","var WPTB_Image = function ( src, DOMElementProt ) {\r\n let DOMElement,\r\n elImage,\r\n kindIndexProt = undefined,\r\n copy = false;\r\n if ( DOMElementProt == undefined ) {\r\n DOMElement = document.createElement( 'div' );\r\n elImage = document.createElement( 'div' );\r\n\t let anchor = document.createElement( 'a' ),\r\n\t img = document.createElement( 'img' );\r\n anchor.style.display = 'block';\r\n anchor.appendChild( img );\r\n DOMElement.classList.add( 'wptb-image-container' );\r\n elImage.classList.add( 'wptb-image-wrapper' );\r\n elImage.appendChild( anchor );\r\n DOMElement.appendChild( elImage );\r\n \r\n anchor.onclick = function( e ) {\r\n e.preventDefault();\r\n }\r\n \r\n file_frame = wp.media.frames.file_frame = wp.media({\r\n\t\ttitle: 'Select a image to upload',\r\n\t\tbutton: {\r\n text: 'Use this image'\r\n\t\t},\r\n\t\tmultiple: false\r\n });\r\n // When an image is selected, run a callback.\r\n file_frame.on('select', function () {\r\n attachment = file_frame.state().get('selection').first().toJSON();\r\n let imgSrc = attachment.url;\r\n let linkArr = imgSrc.split( ':' ),\r\n linkClean;\r\n if ( Array.isArray( linkArr ) && linkArr.length > 0 ) {\r\n linkClean = linkArr[linkArr.length - 1];\r\n }\r\n img.src = linkClean;\r\n img.height = attachment.height;\r\n img.width = attachment.width;\r\n img.style.width = '100%';\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n });\r\n // Finally, open the modal\r\n if (src == undefined) {\r\n file_frame.open();\r\n } else {\r\n img.src = src;\r\n }\r\n } else {\r\n DOMElement = DOMElementProt.cloneNode( true );\r\n \r\n DOMElement.getElementsByTagName( 'a' )[0].onclick = function(e) {\r\n e.preventDefault();\r\n };\r\n \r\n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\r\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\r\n kindIndexProt = wptbElementMutch[1];\r\n copy = true;\r\n };\r\n }\r\n \r\n this.kind = 'image';\r\n this.getDOMElement = function () {\r\n return DOMElement;\r\n };\r\n\tapplyGenericItemSettings( this, kindIndexProt, copy );\r\n\r\n\treturn this;\r\n};","var WPTB_Initializer = function () {\r\n\r\n const MIN_COLUMNS = 1,\r\n MIN_ROWS = 1,\r\n MAX_COLUMNS = 10,\r\n MAX_ROWS = 10;\r\n\r\n var tableGenerator = document.body;\r\n columnsDecrementButton = tableGenerator.getElementsByClassName('wptb-input-number-decrement')[0],\r\n columnsIncrementButton = tableGenerator.getElementsByClassName('wptb-input-number-increment')[0],\r\n rowsDecrementButton = tableGenerator.getElementsByClassName('wptb-input-number-decrement')[1],\r\n rowsIncrementButton = tableGenerator.getElementsByClassName('wptb-input-number-increment')[1],\r\n columnsInput = document.getElementById('wptb-columns-number'),\r\n rowsInput = document.getElementById('wptb-rows-number');\r\n \r\n columnsDecrementButton.onclick = function () {\r\n if (columnsInput.value > MIN_COLUMNS) {\r\n columnsInput.value--;\r\n }\r\n };\r\n\r\n columnsIncrementButton.onclick = function () {\r\n if (columnsInput.value < MAX_COLUMNS) {\r\n columnsInput.value++;\r\n }\r\n };\r\n\r\n rowsDecrementButton.onclick = function () {\r\n if (rowsInput.value > MIN_ROWS) {\r\n rowsInput.value--;\r\n }\r\n };\r\n\r\n rowsIncrementButton.onclick = function () {\r\n if (rowsInput.value < MAX_ROWS) {\r\n rowsInput.value++;\r\n }\r\n };\r\n\r\n document.getElementById('wptb-generate-table').onclick = function () {\r\n var columns = document.getElementById('wptb-columns-number').value,\r\n rows = document.getElementById('wptb-rows-number').value;\r\n\r\n WPTB_Table(columns, rows);\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n\r\n};\r\n","var WPTB_innerElementSet = function ( element ) {\r\n \r\n function newElementProxy(el) {\r\n if (el == 'list') {\r\n return new WPTB_List();\r\n } else if (el == 'image') {\r\n return new WPTB_Image();\r\n } else if (el == 'text') {\r\n return new WPTB_Text();\r\n } else if (el == 'button') {\r\n return new WPTB_Button();\r\n }\r\n }\r\n \r\n element.ondragenter = function (e) {\r\n var div;\r\n if ( e.dataTransfer.types.indexOf( 'wptbelement' ) == -1 && e.dataTransfer.types.indexOf( 'wptb-moving-mode' ) == -1 ) {\r\n return;\r\n }\r\n WPTB_DropHandle(this, e);\r\n \r\n element.classList.add( 'wptb-ondragenter' );\r\n }\r\n element.ondragover = function (e) {\r\n e.preventDefault();\r\n WPTB_DropHandle(this, e);\r\n }\r\n element.ondragleave = function () {\r\n \r\n }\r\n element.ondrop = function(e) {\r\n this.classList.remove( 'wptb-ondragenter' );\r\n let element, classId;\r\n e.preventDefault();\r\n e.stopPropagation();\r\n\r\n if (!e.dataTransfer.getData('wptbElement') && !e.dataTransfer.getData('node')) {\r\n return;\r\n }\r\n let wptbDropHandle,\r\n wptbDropBorderMarker;\r\n if ( document.getElementsByClassName( 'wptb-drop-handle' ).length > 0 ) {\r\n wptbDropHandle = document.getElementsByClassName( 'wptb-drop-handle' )[0];\r\n }\r\n if( document.getElementsByClassName( 'wptb-drop-border-marker' ).length > 0 ) {\r\n wptbDropBorderMarker = document.getElementsByClassName( 'wptb-drop-border-marker' )[0];\r\n }\r\n\r\n if ( e.dataTransfer.getData( 'wptbElement' ) ) {\r\n element = newElementProxy( e.dataTransfer.getData( 'wptbElement' ) );\r\n element = element.getDOMElement();\r\n } else {\r\n classId = e.dataTransfer.getData( 'node' );\r\n element = document.getElementsByClassName( classId )[0];\r\n //element.classList.remove( 'wptb-moving-mode' );\r\n }\r\n \r\n if( wptbDropHandle.style.display == 'block' ) {\r\n let td;\r\n if( wptbDropHandle.dataset.text == 'Drop Here' ) {\r\n td = wptbDropHandle.getDOMParentElement();\r\n td.appendChild( element );\r\n } else {\r\n let innerElement = wptbDropHandle.getDOMParentElement();\r\n td = innerElement.parentNode;\r\n\r\n if( wptbDropHandle.dataset.text == 'Above Element' ) {\r\n td.insertBefore( element, innerElement );\r\n } else if( wptbDropHandle.dataset.text == 'Below Element' ) {\r\n let innerElementNext = innerElement.nextSibling;\r\n td.insertBefore( element, innerElementNext );\r\n }\r\n }\r\n let thisRow = td.parentNode\r\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\r\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n \r\n } else {\r\n return;\r\n }\r\n \r\n wptbDropHandle.style.display = 'none';\r\n wptbDropBorderMarker.style.display = 'none';\r\n\r\n WPTB_innerElementSet( element );\r\n \r\n if( ! element.classList.contains( 'wptb-image-container' ) || element.classList.contains( 'wptb-moving-mode' ) ) {\r\n element.classList.remove( 'wptb-moving-mode' );\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n } \r\n return true;\r\n }\r\n element.onmouseover = function(e) {\r\n element.classList.remove( 'wptb-ondragenter' );\r\n }\r\n}","var WPTB_LeftPanel = function () {\r\n\r\n var table = document.getElementsByClassName('wptb-preview-table')[0],\r\n wptbElementButtons = document.getElementsByClassName('wptb-element');\r\n \r\n function wptbTdBgColorSavedSet( inputId, trNumber ) {\r\n if ( trNumber > 3 ) return;\r\n if( table ) {\r\n let tableRows = table.getElementsByTagName('tr');\r\n if ( tableRows.length > trNumber ) {\r\n let trBackgroundColor = tableRows[trNumber].style.backgroundColor;\r\n var wptbEvenRowBg = document.getElementById(inputId);\r\n if ( wptbEvenRowBg && trBackgroundColor ) {\r\n wptbEvenRowBg.value = WPTB_Helper.rgbToHex( trBackgroundColor );\r\n }\r\n }\r\n }\r\n \r\n }\r\n \r\n wptbTdBgColorSavedSet( 'wptb-even-row-bg', 1 );\r\n jQuery('#wptb-even-row-bg').wpColorPicker({\r\n change: function ( event, ui ) {\r\n var tableRows = table.getElementsByTagName('tr');\r\n for ( let i = 1; i < tableRows.length; i += 2 ) {\r\n tableRows[i].style.backgroundColor = ui.color.toString();\r\n }\r\n console.log(event);\r\n console.log(this);\r\n WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving( event );\r\n },\r\n clear: function(){\r\n var tableRows = table.getElementsByTagName('tr');\r\n for ( let i = 1; i < tableRows.length; i += 2 ) {\r\n tableRows[i].style.backgroundColor = '';\r\n let tds = tableRows[i].getElementsByTagName('td');\r\n for ( let j = 0; j < tds.length; j++ ) {\r\n tds[j].style.backgroundColor = '';\r\n }\r\n }\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n },\r\n\r\n });\r\n \r\n wptbTdBgColorSavedSet( 'wptb-odd-row-bg', 2 );\r\n jQuery('#wptb-odd-row-bg').wpColorPicker({\r\n change: function ( event, ui ) {\r\n var tableRows = table.getElementsByTagName('tr');\r\n for ( let i = 2; i < tableRows.length; i += 2 ) {\r\n tableRows[i].style.backgroundColor = ui.color.toString();\r\n }\r\n \r\n WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving( event );\r\n },\r\n clear: function(){\r\n var tableRows = table.getElementsByTagName('tr');\r\n for ( let i = 2; i < tableRows.length; i += 2 ) {\r\n tableRows[i].style.backgroundColor = '';\r\n let tds = tableRows[i].getElementsByTagName( 'td' );\r\n for ( var j = 0; j < tds.length; j++ ) {\r\n tds[j].style.backgroundColor = '';\r\n }\r\n }\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n },\r\n });\r\n \r\n wptbTdBgColorSavedSet( 'wptb-table-header-bg', 0 );\r\n jQuery('#wptb-table-header-bg').wpColorPicker({\r\n change: function (event, ui) {\r\n var tableHeader = table.getElementsByTagName('tr')[0];\r\n tableHeader.style.backgroundColor = ui.color.toString();\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n },\r\n clear: function(){\r\n var tableHeader = table.getElementsByTagName('tr')[0];\r\n tableHeader.style.backgroundColor = '';\r\n let tds = tableHeader.getElementsByTagName('td');\r\n for (var j = 0; j < tds.length; j++) {\r\n tds[j].style.backgroundColor = '';\r\n }\r\n \r\n WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving( event );\r\n },\r\n });\r\n \r\n function tableAdaptiveForMobile( table ) {\r\n let wptbAdaptiveTableCheckbox = document.getElementById( 'wptb-adaptive-table-checkbox' );\r\n if( table && table.dataset.wptbAdaptiveTable && table.dataset.wptbAdaptiveTable == \"1\" ) {\r\n wptbAdaptiveTableCheckbox.checked = true;\r\n } else {\r\n wptbAdaptiveTableCheckbox.checked = false;\r\n }\r\n }\r\n tableAdaptiveForMobile( table );\r\n \r\n function tableTopRowAsHeadSavedSet( table ) {\r\n let wptbTopRowAsHeader = document.getElementById( 'wptb-top-row-as-header' );\r\n \r\n if( table && table.classList.contains( 'wptb-table-preview-head' ) ) {\r\n wptbTopRowAsHeader.checked = true;\r\n } else {\r\n wptbTopRowAsHeader.checked = false;\r\n }\r\n }\r\n tableTopRowAsHeadSavedSet( table );\r\n \r\n function tableBorderColorWidthSavedSet() {\r\n let table = document.getElementsByClassName('wptb-preview-table');\r\n if ( table.length > 0 ) {\r\n let tableBorderColor = table[0].style.borderColor;\r\n if ( tableBorderColor ) {\r\n let tableBorderColorInput = document.getElementById( 'wptb-table-border-color' );\r\n if ( tableBorderColorInput ) {\r\n tableBorderColorInput.value = WPTB_Helper.rgbToHex( tableBorderColor );\r\n }\r\n }\r\n \r\n let tableBorderWidth = table[0].style.borderWidth;\r\n if ( tableBorderWidth ) {\r\n let wptbTableBorderWidthSlider = document.getElementById('wptb-table-border-slider'),\r\n wptbTableBorderWidthNumber = document.getElementById('wptb-table-border-number');\r\n \r\n if ( wptbTableBorderWidthSlider ) {\r\n wptbTableBorderWidthSlider.value = parseInt( tableBorderWidth );\r\n }\r\n if ( wptbTableBorderWidthNumber ) {\r\n wptbTableBorderWidthNumber.value = parseInt( tableBorderWidth );\r\n }\r\n }\r\n \r\n \r\n let tableTd = table[0].querySelector( 'td' );\r\n let applyInnerBorder = tableTd.style.borderWidth;\r\n if ( applyInnerBorder ) {\r\n let innerBorderCheckInput = document.getElementById( 'wptb-inner-border-check' );\r\n let wptbApplyInnerBorder = document.getElementById( 'wptb-apply-inner-border' );\r\n if ( applyInnerBorder && parseInt( applyInnerBorder ) > 0 ) {\r\n if ( innerBorderCheckInput ) {\r\n innerBorderCheckInput.checked = true;\r\n \r\n if ( wptbApplyInnerBorder ) {\r\n wptbApplyInnerBorder.classList.add( 'visible' );\r\n let wptbTableInnerBorderSlider = document.getElementById( 'wptb-table-inner-border-slider' );\r\n let wptbTableInnerBorderNumber = document.getElementById( 'wptb-table-inner-border-number' );\r\n wptbTableInnerBorderSlider.value = parseInt( applyInnerBorder );\r\n wptbTableInnerBorderNumber.value = parseInt( applyInnerBorder );\r\n }\r\n }\r\n } else {\r\n innerBorderCheckInput.checked = false;\r\n }\r\n }\r\n \r\n if ( ( tableBorderWidth && parseInt( tableBorderWidth ) > 0 ) || ( applyInnerBorder && parseInt( applyInnerBorder ) > 0 ) ) {\r\n document.getElementById( 'wptb-table-border-color-set-area' ).style.display = '';\r\n }\r\n }\r\n }\r\n \r\n tableBorderColorWidthSavedSet();\r\n\r\n jQuery('#wptb-table-border-color').wpColorPicker({\r\n change: function (event, ui) {\r\n var tableCells = table.getElementsByTagName('td');\r\n table.style.border = document.querySelector('#wptb-table-border-number').value + 'px solid ' + ui.color.toString();\r\n\r\n for (var i = 0; i < tableCells.length; i++) {\r\n let tableInnerborderNumber = document.querySelector('#wptb-table-inner-border-number').value;\r\n if ( document.getElementById('wptb-inner-border-check').checked ) {\r\n tableCells[i].style.border = ( tableInnerborderNumber != 0 ? tableInnerborderNumber : 1 ) + 'px solid ' + ui.color.toString();\r\n }\r\n }\r\n WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving( event );\r\n },\r\n clear: function() {\r\n var tableCells = table.getElementsByTagName('td');\r\n table.style.borderColor = '';\r\n\r\n for (var i = 0; i < tableCells.length; i++) {\r\n tableCells[i].style.borderColor = '';\r\n }\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n });\r\n\r\n function addInnerBorderSize(value) {\r\n var tableCells = table.getElementsByTagName('td');\r\n for (var i = 0; i < tableCells.length; i++) {\r\n tableCells[i].style.borderWidth = document.querySelector('#wptb-table-inner-border-number').value + 'px';\r\n tableCells[i].style.borderStyle = 'solid';\r\n }\r\n }\r\n\r\n function addCellPadding(value) {\r\n var tableCells = table.getElementsByTagName('td');\r\n for (var i = 0; i < tableCells.length; i++) {\r\n tableCells[i].style.padding = value + 'px';\r\n }\r\n }\r\n\r\n function addInnerBorder( checked ) {\r\n var styles, color = document.querySelector('#wptb-table-border-color').value != undefined ?\r\n document.querySelector('#wptb-table-border-color').value : 'rgb(0,0,0)';\r\n if ( document.querySelector( '#wptb-table-inner-border-slider' ).value == 0 || document.querySelector( '#wptb-table-inner-border-number' ).value == 0 ) {\r\n document.querySelector( '#wptb-table-inner-border-slider' ).value = 1;\r\n document.querySelector( '#wptb-table-inner-border-number' ).value = 1;\r\n }\r\n let width = document.querySelector( '#wptb-table-inner-border-slider' ).value + 'px';\r\n let wptbPreviewTable = document.getElementsByClassName('wptb-preview-table');\r\n if( wptbPreviewTable.length > 0 ) {\r\n if (checked == 'checked') {\r\n document.getElementById('wptb-apply-inner-border').style.marginBottom = '0px';\r\n var tableCells = wptbPreviewTable[0].getElementsByTagName( 'td' );\r\n for (var i = 0; i < tableCells.length; i++) {\r\n tableCells[i].style.border = width + ' solid ' + color;\r\n }\r\n document.getElementById( 'wptb-apply-inner-border' ).classList.add( 'visible' );\r\n } else {\r\n document.getElementById( 'wptb-apply-inner-border' ).classList.remove( 'visible' );\r\n var tableCells = wptbPreviewTable[0].getElementsByTagName( 'td' );\r\n for (var i = 0; i < tableCells.length; i++) {\r\n tableCells[i].style.border = '0px solid ' + color;\r\n tableCells[i].style.border = null;\r\n }\r\n }\r\n }\r\n \r\n }\r\n\r\n function addBorderSize( value ) {\r\n table.style.borderWidth = value + 'px';\r\n table.style.borderStyle = 'solid';\r\n }\r\n \r\n function cellPaddingSavedSet() {\r\n let table = document.getElementsByClassName('wptb-preview-table');\r\n \r\n if ( table.length > 0 ) {\r\n let td = table[0].querySelector( 'td' );\r\n \r\n if ( td ) {\r\n let padding = td.style.padding;\r\n \r\n if ( padding ) {\r\n let wptbTableCellSlider = document.getElementById('wptb-table-cell-slider'),\r\n wptbTableCellNumber = document.getElementById('wptb-table-cell-number');\r\n \r\n if ( wptbTableCellSlider ) {\r\n wptbTableCellSlider.value = parseInt( padding );\r\n }\r\n if ( wptbTableCellNumber ) {\r\n wptbTableCellNumber.value = parseInt( padding );\r\n }\r\n }\r\n }\r\n }\r\n }\r\n \r\n cellPaddingSavedSet();\r\n \r\n function numberImputSize( wptbNumberInputs, maxCount, maxValue ) {\r\n wptbNumberInputs.onkeydown = function() {\r\n let thisValue = this.value;\r\n thisValue = String( thisValue );\r\n if ( thisValue[0] == 0 ) {\r\n this.value = \"\";\r\n } else {\r\n thisValue = thisValue.substring( 0, maxCount );\r\n this.value = thisValue;\r\n }\r\n }\r\n wptbNumberInputs.onkeyup = function() {\r\n let thisValue = this.value;\r\n thisValue = String( thisValue );\r\n if ( thisValue > maxValue ) {\r\n this.value = maxValue;\r\n }\r\n }\r\n }\r\n \r\n let wptbTableBorderNumber = document.getElementById( 'wptb-table-border-number' );\r\n numberImputSize( wptbTableBorderNumber, 1, 50 );\r\n \r\n let wptbTableInnerBorderNumber = document.getElementById( 'wptb-table-inner-border-number' );\r\n numberImputSize( wptbTableInnerBorderNumber, 1, 50 );\r\n \r\n let wptbTableCellNumber = document.getElementById( 'wptb-table-cell-number' );\r\n numberImputSize( wptbTableCellNumber, 1, 50 );\r\n \r\n let wptbTextfontSizeNumber = document.getElementById( 'wptb-text-font-size-number' );\r\n numberImputSize( wptbTextfontSizeNumber, 1, 50 );\r\n \r\n let wptbImageWidthNumber = document.getElementById( 'wptb-image-width-number' );\r\n numberImputSize( wptbImageWidthNumber, 2, 100 );\r\n \r\n let wptbTableColumnWidthNumber = document.getElementById( 'wptb-table-column-width-number' );\r\n numberImputSize( wptbTableColumnWidthNumber, 2, 500 );\r\n \r\n let wptbTableRowHeightNumber = document.getElementById( 'wptb-table-row-height-number' );\r\n numberImputSize( wptbTableRowHeightNumber, 2, 200 );\r\n \r\n \r\n \r\n document.getElementById('wptb-table-cell-slider').oninput = function () {\r\n document.getElementById('wptb-table-cell-number').value = this.value;\r\n addCellPadding(this.value);\r\n table.tdDefaultWidth();\r\n };\r\n \r\n document.getElementById('wptb-table-cell-slider').onchange = function() {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n\r\n document.getElementById('wptb-table-cell-number').onchange = function () {\r\n document.getElementById('wptb-table-cell-slider').value = this.value;\r\n addCellPadding(this.value);\r\n table.tdDefaultWidth();\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n document.getElementById('wptb-table-border-slider').oninput = function () {\r\n document.getElementById('wptb-table-border-number').value = this.value;\r\n addBorderSize(this.value);\r\n table.tdDefaultWidth();\r\n \r\n let wptbInnerBorderCheck = document.getElementById('wptb-inner-border-check').checked,\r\n tableBorderColorSetArea = document.getElementById( 'wptb-table-border-color-set-area' );\r\n if ( this.value == 0 && wptbInnerBorderCheck == false ) {\r\n tableBorderColorSetArea.style.display = 'none';\r\n } else {\r\n tableBorderColorSetArea.style.display = '';\r\n }\r\n };\r\n \r\n document.getElementById('wptb-table-border-slider').onchange = function() {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n\r\n document.getElementById('wptb-table-border-number').onchange = function () {\r\n document.getElementById('wptb-table-border-slider').value = this.value;\r\n addBorderSize(this.value);\r\n table.tdDefaultWidth();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n document.getElementById('wptb-table-inner-border-slider').oninput = function () {\r\n document.getElementById('wptb-table-inner-border-number').value = this.value;\r\n addInnerBorderSize(this.value);\r\n table.tdDefaultWidth();\r\n };\r\n \r\n document.getElementById('wptb-table-inner-border-slider').onchange = function () {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n\r\n document.getElementById('wptb-table-inner-border-number').onchange = function () {\r\n document.getElementById('wptb-table-inner-border-slider').value = this.value;\r\n addInnerBorderSize(this.value);\r\n table.tdDefaultWidth();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n document.getElementById('wptb-inner-border-check').onchange = function () {\r\n if( table ) {\r\n let val = this.checked ? 'checked' : 'unchecked';\r\n addInnerBorder( val );\r\n let borderWidth = document.getElementById('wptb-table-border-slider').value,\r\n tableBorderColorSetArea = document.getElementById( 'wptb-table-border-color-set-area' );\r\n if( val == 'unchecked' && borderWidth == 0 ) {\r\n tableBorderColorSetArea.style.display = 'none';\r\n } else {\r\n tableBorderColorSetArea.style.display = '';\r\n }\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n };\r\n \r\n document.getElementById( 'wptb-table-column-width-slider' ).oninput = function () {\r\n document.getElementById( 'wptb-table-column-width-number' ).value = this.value;\r\n table.addColumnWidth( this.value );\r\n };\r\n \r\n document.getElementById( 'wptb-table-column-width-slider' ).onchange = function () {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n \r\n document.getElementById( 'wptb-table-column-width-number' ).onchange = function () {\r\n document.getElementById( 'wptb-table-column-width-slider' ).value = this.value;\r\n table.addColumnWidth( this.value );\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n \r\n document.getElementById( 'wptb-table-column-width-auto-fixed' ).onchange = function () {\r\n if( this.checked ) {\r\n let highlighted = table.querySelector( '.wptb-highlighted' );\r\n let width = WPTB_Helper.getColumnWidth( table, highlighted );\r\n table.addColumnWidth( width );\r\n } else {\r\n table.addColumnWidth( false, true );\r\n let highlighted = table.querySelector( '.wptb-highlighted' );\r\n let width = WPTB_Helper.getColumnWidth( table, highlighted );\r\n document.getElementById( 'wptb-table-column-width-number' ).value = width;\r\n document.getElementById( 'wptb-table-column-width-slider' ).value = width;\r\n }\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n document.getElementById( 'wptb-table-row-height-slider' ).oninput = function () {\r\n document.getElementById( 'wptb-table-row-height-number' ).value = this.value;\r\n table.addRowHeight( this.value );\r\n };\r\n \r\n document.getElementById( 'wptb-table-row-height-slider' ).onchange = function () {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n document.getElementById( 'wptb-table-row-height-number' ).onchange = function () {\r\n document.getElementById( 'wptb-table-row-height-slider' ).value = this.value;\r\n table.addRowHeight( this.value );\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n \r\n document.getElementById( 'wptb-table-row-height-auto-fixed' ).onchange = function () {\r\n if( this.checked ) {\r\n let highlighted = table.querySelector( '.wptb-highlighted' );\r\n let height = WPTB_Helper.getRowHeight( table, highlighted );\r\n table.addRowHeight( height );\r\n } else {\r\n table.addRowHeight( false, true );\r\n let highlighted = table.querySelector( '.wptb-highlighted' );\r\n let height = WPTB_Helper.getRowHeight( table, highlighted );\r\n document.getElementById( 'wptb-table-row-height-number' ).value = height;\r\n document.getElementById( 'wptb-table-row-height-slider' ).value = height;\r\n }\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n \r\n document.getElementById( 'wptb-adaptive-table-checkbox' ).onchange = function() {\r\n if( this.checked ) {\r\n table.dataset.wptbAdaptiveTable = 1;\r\n } else {\r\n table.dataset.wptbAdaptiveTable = 0;\r\n }\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n \r\n function createMobileHeadForTable( table, thisEvent ) {\r\n \r\n if( thisEvent.checked ) {\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n \r\n table.classList.add( 'wptb-table-preview-head' );\r\n table.rows[0].classList.add( 'wptb-table-head' );\r\n } else {\r\n let rows = table.rows;\r\n table.classList.remove( 'wptb-table-preview-head' );\r\n rows[0].classList.remove( 'wptb-table-head' );\r\n \r\n for ( let i = 1; i < rows.length; i++ ) {\r\n let thisRow = rows[i],\r\n thisRowChildren = thisRow.children;\r\n for( let j = 0; j < thisRowChildren.length; j++ ) {\r\n thisRowChildren[j].removeAttribute( 'data-wptb-title-column' );\r\n thisRowChildren[j].removeAttribute( 'data-wptb-title-column-font-size' );\r\n thisRowChildren[j].removeAttribute( 'data-wptb-title-column-color' );\r\n thisRowChildren[j].removeAttribute( 'data-wptb-title-background-color' );\r\n thisRowChildren[j].removeAttribute( 'data-wptb-title-align' );\r\n }\r\n }\r\n }\r\n }\r\n \r\n document.getElementById( 'wptb-top-row-as-header' ).onchange = function () {\r\n createMobileHeadForTable( table, this );\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n\r\n for (var i = 0; i < wptbElementButtons.length; i++) {\r\n wptbElementButtons[i].ondragstart = function (e) {\r\n e.dataTransfer.setData('wptbElement', this.dataset.wptbElement);\r\n e.dataTransfer.setData( 'wptbElIndic-' + this.dataset.wptbElement, 'wptbElIndic-' + this.dataset.wptbElement );\r\n }\r\n }\r\n \r\n if( table ) {\r\n document.getElementById('wptb-activate-cell-management-mode').onclick = table.toggleTableEditMode;\r\n document.getElementById( 'wptb-table-edit-mode-close' ).onclick = table.toggleTableEditMode;\r\n document.getElementById( 'wptb-left-scroll-panel-curtain-close' ).onclick = table.toggleTableEditMode;\r\n document.getElementById('wptb-add-end-row').onclick = table.addRowToTheEnd;\r\n document.getElementById('wptb-add-start-row').onclick = table.addRowToTheStart;\r\n document.getElementById('wptb-add-row-before').onclick = table.addRowBefore;\r\n document.getElementById('wptb-add-row-after').onclick = table.addRowAfter;\r\n document.getElementById('wptb-add-end-column').onclick = table.addColumnEnd;\r\n document.getElementById('wptb-add-start-column').onclick = table.addColumnStart;\r\n document.getElementById('wptb-add-column-before').onclick = table.addColumnBefore;\r\n document.getElementById('wptb-add-column-after').onclick = table.addColumnAfter;\r\n document.getElementById('wptb-delete-column').onclick = table.deleteColumn;\r\n document.getElementById('wptb-delete-row').onclick = table.deleteRow;\r\n document.getElementById('wptb-merge-cells').onclick = table.mergeCells;\r\n document.getElementById('wptb-split-cell').onclick = table.splitCell;\r\n }\r\n \r\n document.querySelector( '.wptb-left-panel-extend' ).onclick = function() {\r\n let wptbContainer = document.querySelector( '.wptb-container' );\r\n if( wptbContainer ) {\r\n if ( wptbContainer.classList.contains( 'collapsed' ) ) {\r\n wptbContainer.classList.remove( 'collapsed' );\r\n } else {\r\n wptbContainer.classList.add( 'collapsed' );\r\n }\r\n }\r\n };\r\n \r\n // this code hides the \"element parameters\" area \r\n // when clicked outside this element and its \"tinymce\" toolbar \r\n let wptbBuilderPanel = document.getElementsByClassName( 'wptb-builder-panel' )[0];\r\n wptbBuilderPanel.onclick = function( e ) {\r\n if( ! e.target.classList.contains( 'wptb-ph-element' ) && ! WPTB_Helper.findAncestor( e.target, 'wptb-ph-element' ) && \r\n ! e.target.classList.contains( 'wptb-fixed-toolbar' ) && ! WPTB_Helper.findAncestor( e.target, 'wptb-fixed-toolbar' ) ) {\r\n clickOnFreeSpace();\r\n } \r\n };\r\n \r\n let wptbHeader = document.getElementsByClassName( 'wptb-header' );\r\n if( wptbHeader.length > 0 ) wptbHeader = wptbHeader[0];\r\n wptbHeader.onclick = function() {\r\n clickOnFreeSpace();\r\n }\r\n \r\n function clickOnFreeSpace() {\r\n document.getElementsByClassName( 'wptb-elements-container' )[0].style.display = 'table';\r\n document.getElementsByClassName( 'wptb-settings-section' )[0].style.display = 'block';\r\n document.getElementById( 'element-options-group' ).style.display = 'none';\r\n let wpcdFixedToolbar = document.getElementById( 'wpcd_fixed_toolbar' );\r\n if( wpcdFixedToolbar.hasAttribute( 'data-toolbar-active-id' ) ) {\r\n document.getElementById( wpcdFixedToolbar.getAttribute( 'data-toolbar-active-id' ) ).classList.remove( 'toolbar-active' );\r\n }\r\n }\r\n \r\n};","var WPTB_List = function ( innerElements, DOMElementProt ) {\r\n\r\n var el_L = document.createElement('ul'), item,\r\n DOMElement = document.createElement('div'),\r\n kindIndexProt = undefined,\r\n copy = false;\r\n DOMElement.classList.add( 'wptb-list-item-container' );\r\n\r\n this.kind = 'list';\r\n\r\n if (innerElements === '') {\r\n //Case for edit mode list\r\n } else if ( !innerElements ) {\r\n for (var i = 0; i < 3; i++) {\r\n item = new WPTB_ListItem( '<p>List Item ' + (i + 1) + '</p>');\r\n el_L.appendChild(item.getDOMElement());\r\n }\r\n } else {\r\n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\r\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\r\n kindIndexProt = wptbElementMutch[1];\r\n copy = true;\r\n };\r\n \r\n for ( var i = 0; i < innerElements.length; i++ ) {\r\n let listItem = DOMElementProt.querySelector( 'li' );\r\n item = new WPTB_ListItem( innerElements[i], listItem, true );\r\n el_L.appendChild(item.getDOMElement());\r\n }\r\n }\r\n DOMElement.appendChild(el_L);\r\n //window.addElementOptions('list', elList);\r\n\r\n this.getDOMElement = function () {\r\n return DOMElement;\r\n }\r\n applyGenericItemSettings( this, kindIndexProt, copy );\r\n WPTB_Helper.listItemsRecalculateIndex( el_L );\r\n\r\n return this;\r\n};","var WPTB_ListItem = function ( text, DOMElementProt, copy ) {\r\n let wptbListItemReturn;\r\n if ( DOMElementProt == undefined || ( DOMElementProt && copy )) {\r\n if (text == undefined) text = 'New List Item';\r\n var DOMElement = document.createElement('li'),\r\n //divdot = document.createElement('div'),\r\n divcontent = document.createElement('div');\r\n //libullet = document.createElement('li');\r\n //divdot.classList.add('wptb-list-item-style-dot');\r\n divcontent.classList.add('wptb-list-item-content');\r\n //libullet.classList.add('wptb-bullet');\r\n if ( DOMElementProt ) {\r\n let styleDot = DOMElementProt.getAttribute( 'style' );\r\n if ( styleDot ) {\r\n DOMElement.setAttribute( 'style', styleDot );\r\n }\r\n }\r\n //DOMElement.appendChild(divdot);\r\n DOMElement.appendChild(divcontent);\r\n //divdot.appendChild(libullet);\r\n divcontent.innerHTML = text;\r\n divcontent.onkeyup = window.listItemKeyListener;\r\n \r\n wptbListItemReturn = true;\r\n } else {\r\n var DOMElement = DOMElementProt;\r\n var divcontent = DOMElement.getElementsByClassName( 'wptb-list-item-content' )[0];\r\n \r\n divcontent.onkeyup = window.listItemKeyListener;\r\n \r\n wptbListItemReturn = false;\r\n }\r\n \r\n DOMElement.onmouseenter = function ( event ) {\r\n let wptbActionsField = new WPTB_ActionsField();\r\n \r\n wptbActionsField.addActionField( 2, DOMElement );\r\n \r\n wptbActionsField.setParameters( DOMElement );\r\n console.log(DOMElement);\r\n };\r\n\r\n DOMElement.onmouseleave = function ( event ) {\r\n let wptbActionsField = new WPTB_ActionsField();\r\n \r\n wptbActionsField.leaveFromField( event, DOMElement, 2 );\r\n \r\n return false;\r\n };\r\n\r\n this.getDOMElement = function () {\r\n return DOMElement;\r\n };\r\n \r\n if ( wptbListItemReturn ) {\r\n return this;\r\n }\r\n};","var MultipleSelect = function () {\r\n\r\n\tvar selectedCells = [],\r\n\t\tmultipleCellMode = false;\r\n\r\n\tthis.activateMultipleSelectMode = function () {\r\n\t\tselectedCells = [];\r\n\t\tvar tds = document.getElementsByClassName('wptb-preview-table')[0].getElementsByTagName('td');\r\n\t\tfor (var i = 0; i < tds.length; i++) {\r\n\t\t\ttds[i].classList.remove('wptb-highlighted');\r\n\t\t}\r\n\t\tmultipleCellMode = true;\r\n\t}\r\n\r\n\tthis.deactivateMultipleSelectMode = function () {\r\n\t\tmultipleCellMode = false;\r\n\t}\r\n\r\n\tthis.isActivated = function () {\r\n\t\treturn multipleCellMode;\r\n\t}\r\n\r\n\tthis.pushSelectedCell = function (cell) {\r\n\t\tif (!multipleCellMode) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tselectedCells.push(cell);\r\n\t\tcell.classList.add('wptb-highlighted');\r\n\t};\r\n\r\n\tthis.selectedCells = function () {\r\n\t\treturn selectedCells;\r\n\t}\r\n\r\n\tthis.flushSelectedCells = function () {\r\n\t\tselectedCells = [];\r\n\t}\r\n\r\n\tthis.getFirst = function () {\r\n\t\tvar minXIndex = 1000, minYIndex = 1000, first;\r\n\t\tfor (var i = selectedCells.length - 1; i >= 0; i--) {\r\n\t\t\tif (minXIndex >= selectedCells[i].dataset.xIndex\r\n\t\t\t\t&& minYIndex >= selectedCells[i].dataset.yIndex) {\r\n\t\t\t\tfirst = selectedCells[i];\r\n\t\t\t\tminXIndex = selectedCells[i].dataset.xIndex;\r\n\t\t\t\tminYIndex = selectedCells[i].dataset.yIndex;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn first;\r\n\t}\r\n\r\n\tthis.getLast = function () {\r\n\t\tvar maxXIndex = -1, maxYIndex = -1, last;\r\n\t\tfor (var i = selectedCells.length - 1; i >= 0; i--) {\r\n\t\t\tif (maxXIndex <= selectedCells[i].dataset.xIndex\r\n\t\t\t\t&& maxYIndex <= selectedCells[i].dataset.yIndex) {\r\n\t\t\t\tlast = selectedCells[i];\r\n\t\t\t\tmaxXIndex = selectedCells[i].dataset.xIndex;\r\n\t\t\t\tmaxYIndex = selectedCells[i].dataset.yIndex;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn last;\r\n\t}\r\n\r\n\tthis.removeAllButFirst = function () {\r\n\t\tvar td = this.getFirst();\r\n\t\tfor (var i = 1; i < selectedCells.length; i++) {\r\n\t\t\tselectedCells[i].classList.add('wptb-fused-cell-' + td.dataset.xIndex + '-' + td.dataset.yIndex);\r\n\t\t}\r\n\t}\r\n\r\n\treturn this;\r\n\r\n};","var WPTB_Parser = function (code) {\n let div = document.createElement( 'div' );\n div.innerHTML = code;\n \n let table = div.children[0];\n let columnTitleMobile = [...table.querySelectorAll( '.wptb-column-title-mobile-container' )];\n \n for( let i = 0; i < columnTitleMobile.length; i++ ) {\n let parent = columnTitleMobile[i].parentNode;\n parent.removeChild( columnTitleMobile[i] );\n }\n \n let tds = table.querySelectorAll( 'td' );\n for ( let i = 0; i < tds.length; i++ ) {\n tds[i].classList.add( 'wptb-droppable' );\n tds[i].classList.remove( 'wptb-column-title-mobile-not-elements' );\n }\n \n return table;\n}","var WPTB_Parser2 = function (code) {\r\n if( Array.isArray( code ) ) {\r\n let elementHtml;\r\n \r\n if ( code.length == 1) {\r\n return elementHtml.appendChild( document.createTextNode( code[0] ) );\r\n }\r\n if( 0 in code ) {\r\n let tagName = code[0];\r\n elementHtml = document.createElement( tagName );\r\n \r\n if ( 1 in code ) {\r\n if( Array.isArray( code[1] ) ) {\r\n let attributes = code[1];\r\n \r\n for( let i = 0; i < attributes.length; i++ ) {\r\n if( Array.isArray( attributes[i] ) ) {\r\n elementHtml.setAttribute(attributes[i][0], attributes[i][1]);\r\n }\r\n }\r\n }\r\n }\r\n \r\n if ( 2 in code ) {\r\n if ( Array.isArray( code[2] ) ) {\r\n for ( let i = 0; i < code[2].length; i++ ) {\r\n if ( typeof code[2][i] === 'string' && tagName.toLowerCase() == 'p' ) {\r\n elementHtml.appendChild( document.createTextNode( code[2][i] ) );\r\n continue;\r\n }\r\n if ( ! WPTB_Parser( code[2][i] ) ) continue;\r\n elementHtml.appendChild( WPTB_Parser( code[2][i] ) );\r\n }\r\n } else if( typeof code[2] === 'string' ) {\r\n elementHtml.appendChild( document.createTextNode( code[2] ) );\r\n }\r\n \r\n }\r\n }\r\n \r\n return elementHtml;\r\n } else {\r\n return false;\r\n }\r\n \r\n}","var WPTB_Settings = function () {\r\n var elems = document.getElementsByClassName('wptb-element');\r\n\r\n for ( var i = 0; i < elems.length; i++ ) {\r\n elems[i].ondragstart = function ( event ) {\r\n event.dataTransfer.effectAllowed = 'move';\r\n event.dataTransfer.setData( 'wptbElement', event.target.dataset.wptbElement );\r\n event.dataTransfer.setData( 'wptbElIndic-' + event.target.dataset.wptbElement, 'wptbElIndic-' + event.target.dataset.wptbElement );\r\n }\r\n elems[i].ondragend = function () {\r\n let wptbDropHandle = document.querySelector( '.wptb-drop-handle' ),\r\n wptbDropBorderMarker = document.querySelector( '.wptb-drop-border-marker' );\r\n if ( wptbDropHandle || wptbDropBorderMarker ) {\r\n wptbDropHandle.style.display = 'none';\r\n wptbDropBorderMarker.style.display = 'none';\r\n }\r\n }\r\n };\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n let wptbUndo = document.getElementsByClassName( 'wptb-undo' );\r\n if( wptbUndo.length > 0 ) {\r\n wptbUndo = wptbUndo[0];\r\n \r\n wptbUndo.onclick = function( event ) {\r\n if( ! this.classList.contains( 'wptb-undoredo-disabled' ) ) {\r\n wptbTableStateSaveManager.tableStateGet( this.dataset.wptbUndoredo );\r\n let wptbUndoRedoContainer = document.getElementsByClassName( 'wptb-undo-redo-container' );\r\n if( wptbUndoRedoContainer.length > 0 ) {\r\n wptbUndoRedoContainer = wptbUndoRedoContainer[0];\r\n wptbUndoRedoContainer.onmouseleave = function( event ) {\r\n event.target.onmouseleave = '';\r\n WPTB_Table();\r\n }\r\n }\r\n }\r\n \r\n }\r\n }\r\n \r\n let wptbRedo = document.getElementsByClassName( 'wptb-redo' );\r\n if( wptbRedo.length > 0 ) {\r\n wptbRedo = wptbRedo[0];\r\n \r\n wptbRedo.onclick = function( event ) {\r\n if( ! this.classList.contains( 'wptb-undoredo-disabled' ) ) {\r\n wptbTableStateSaveManager.tableStateGet( this.dataset.wptbUndoredo );\r\n let wptbUndoRedoContainer = document.getElementsByClassName( 'wptb-undo-redo-container' );\r\n if( wptbUndoRedoContainer.length > 0 ) {\r\n wptbUndoRedoContainer = wptbUndoRedoContainer[0];\r\n wptbUndoRedoContainer.onmouseleave = function( event ) {\r\n event.target.onmouseleave = '';\r\n WPTB_Table();\r\n }\r\n }\r\n }\r\n \r\n }\r\n }\r\n \r\n let shortcodePopupWindow = document.getElementsByClassName( 'wptb-popup-window-modal' )[0];\r\n document.getElementsByClassName( 'wptb-embed-btn' )[0].onclick = function () {\r\n if( ! this.classList.contains( 'wptb-button-disable' ) ) {\r\n shortcodePopupWindow.classList.add( 'wptb-popup-show' );\r\n }\r\n }\r\n \r\n document.getElementsByClassName( 'wptb-popup-dark-area' )[0].onclick = function () {\r\n shortcodePopupWindow.classList.remove( 'wptb-popup-show' );\r\n }\r\n \r\n document.getElementsByClassName( 'wptb-popup-window-close-icon' )[0].onclick = function () {\r\n shortcodePopupWindow.classList.remove( 'wptb-popup-show' );\r\n }\r\n \r\n document.getElementsByClassName( 'wptb-preview-btn' )[0].onclick = function ( e ) {\r\n if( this.classList.contains( 'wptb-button-disable' ) ) {\r\n e.preventDefault();\r\n }\r\n }\r\n\r\n document.getElementsByClassName( 'wptb-save-btn' )[0].onclick = function () {\r\n let bar = document.querySelector( '.wptb-edit-bar' );\r\n if ( bar && bar.classList.contains( 'visible' ) ) {\r\n let table = document.getElementsByClassName( 'wptb-preview-table' )[0];\r\n table.toggleTableEditMode();\r\n }\r\n\r\n let http = new XMLHttpRequest(),\r\n url = ( wptb_admin_object ? wptb_admin_object.ajaxurl : ajaxurl ) + \"?action=save_table\",\r\n t = document.getElementById( 'wptb-setup-name' ).value.trim(),\r\n messagingArea,\r\n code = document.getElementsByClassName( 'wptb-preview-table' );\r\n if( code.length > 0 ) {\r\n code = WPTB_Stringifier( code[0] );\r\n code = code.outerHTML;\r\n } else { \r\n code = '';\r\n }\r\n \r\n if ( t === '' || code === '' ) {\r\n let messagingAreaText = '';\r\n if( t === '' ) messagingAreaText += 'You must assign a name to the table before saving it.</br>';\r\n if( code === '' ) messagingAreaText += 'Table wasn\\'t created';\r\n messagingArea = document.getElementById( 'wptb-messaging-area' );\r\n messagingArea.innerHTML = '<div class=\"wptb-error wptb-message\">Error: ' + messagingAreaText + '</div>';\r\n messagingArea.classList.add( 'wptb-warning' );\r\n setTimeout(function () {\r\n messagingArea.removeChild( messagingArea.firstChild );\r\n }, 4000 );\r\n return;\r\n }\r\n\r\n let params = {\r\n title: t,\r\n content: code,\r\n security_code: wptb_admin_object.security_code\r\n };\r\n if (( rs = WPTB_Helper.detectMode() ) || ( rs = document.wptbId )) {\r\n params.id = rs;\r\n }\r\n params = JSON.stringify( params );\r\n\r\n http.open('POST', url, true);\r\n http.setRequestHeader( 'Content-type', 'application/json; charset=utf-8' );\r\n\r\n http.onreadystatechange = function (action) {\r\n if ( this.readyState == 4 && this.status == 200 ) {\r\n var data = JSON.parse( http.responseText );\r\n messagingArea = document.getElementById( 'wptb-messaging-area' );\r\n\r\n if ( data[0] == 'saved' ) {\r\n document.wptbId = data[1];\r\n messagingArea.innerHTML = '<div class=\"wptb-success wptb-message\">Table \"' + t + '\" was successfully saved.</div>';\r\n document.getElementsByClassName( 'wptb-embed-btn' )[0].classList.remove( 'wptb-button-disable' );\r\n document.getElementById( 'wptb-embed-shortcode' ).value = '[wptb id=' + data[1] + ']';\r\n let wptbPreviewBtn = document.getElementsByClassName( 'wptb-preview-btn' );\r\n if( wptbPreviewBtn.length > 0 ) {\r\n wptbPreviewBtn = wptbPreviewBtn[0];\r\n wptbPreviewBtn.classList.remove( 'wptb-button-disable' );\r\n let wptbPreviewBtnHref = wptbPreviewBtn.dataset.previewHref;\r\n wptbPreviewBtnHref = wptbPreviewBtnHref.replace( 'empty', data[1] );\r\n wptbPreviewBtn.setAttribute( 'href', wptbPreviewBtnHref );\r\n }\r\n \r\n } else if( data[0] == 'edited' ) {\r\n messagingArea.innerHTML = '<div class=\"wptb-success wptb-message\">Table \"' + t + '\" was successfully updated.</div>';\r\n } else {\r\n messagingArea.innerHTML = '<div class=\"wptb-error wptb-message\">Safety problems</div>';\r\n }\r\n messagingArea.classList.add( 'wptb-success' );\r\n setTimeout( function () {\r\n messagingArea.removeChild( messagingArea.firstChild );\r\n }, 4000 );\r\n }\r\n }\r\n http.send( params );\r\n }\r\n};\r\n","var WPTB_Space = function ( elSpaceBetween ) {\r\n\r\n function newElementProxy(el) {\r\n if (el.includes('list')) {\r\n return new WPTB_List();\r\n } else if (el.includes('image')) {\r\n return new WPTB_Image();\r\n } else if (el.includes('text')) {\r\n return new WPTB_Text();\r\n } else if (el.includes('button')) {\r\n return new WPTB_Button();\r\n }\r\n }\r\n let spaceBetween;\r\n if ( ! elSpaceBetween ) {\r\n spaceBetween = document.createElement('div'), spaceBetween.classList.add('wptb-space-between');\r\n } else {\r\n spaceBetween = elSpaceBetween;\r\n }\r\n\r\n spaceBetween.ondragenter = function () {\r\n this.classList.add('visible');\r\n };\r\n spaceBetween.ondragover = function (event) {\r\n event.preventDefault();\r\n };\r\n\r\n spaceBetween.ondragleave = function () {\r\n this.classList.remove('visible');\r\n };\r\n\r\n spaceBetween.ondrop = function (event) {\r\n event.stopPropagation();\r\n\r\n var p = event.target.nextSibling,\r\n td = event.target,\r\n element, t_space, spaceParent;\r\n\r\n while ( !td.classList.contains('wptb-droppable') ) {\r\n td = td.parentNode;\r\n }\r\n\r\n if (event.dataTransfer.getData('wptbElement')) {\r\n element = newElementProxy(event.dataTransfer.getData('wptbElement'));\r\n this.classList.remove('visible');\r\n\r\n if (p == null) {\r\n td.appendChild(element.getDOMElement());\r\n td.appendChild(new WPTB_Space());\r\n } else {\r\n td.insertBefore(element.getDOMElement(), p);\r\n td.insertBefore(new WPTB_Space(), p);\r\n }\r\n\r\n } else {\r\n alert(event.dataTransfer.getData('node'));\r\n element = document.getElementsByClassName(event.dataTransfer.getData('node'))[0];\r\n t_space = element.nextSibling;\r\n spaceParent = element.parentNode;\r\n if (t_space != undefined) {\r\n spaceParent.removeChild(t_space);\r\n }\r\n\r\n if (p == null) {\r\n td.appendChild(element);\r\n td.appendChild(new WPTB_Space());\r\n } else {\r\n td.insertBefore(element, p);\r\n td.insertBefore(new WPTB_Space(), p);\r\n }\r\n\r\n }\r\n this.classList.remove('visible');\r\n };\r\n \r\n if ( ! elSpaceBetween ) {\r\n return spaceBetween;\r\n }\r\n};","var WPTB_Stringifier = function ( codeMain ) {\r\n if ( codeMain ) {\r\n let code = codeMain.cloneNode( true );\r\n code.classList.add( 'wptb-table-preview-static-indic' );\r\n code.dataset.tableColumns = codeMain.columns;\r\n code.style.width = null;\r\n code.style.minWidth = null;\r\n code.style.maxWidth = null;\r\n \r\n let tds = code.getElementsByTagName( 'td' );\r\n if ( tds.length > 0 ) {\r\n for ( let i = 0; i < tds.length; i++ ) {\r\n \r\n if ( codeMain.querySelector( 'wptb-table-preview-head' ) ) {\r\n tds[i].removeAttribute( 'data-x-index' );\r\n }\r\n tds[i].removeAttribute( 'data-y-index' );\r\n tds[i].removeAttribute( 'draggable' );\r\n tds[i].classList.remove( 'wptb-droppable' );\r\n let innerElements = tds[i].getElementsByClassName( 'wptb-ph-element' );\r\n \r\n if ( innerElements.length > 0 ) {\r\n for ( let j = 0; j < innerElements.length; j++ ) {\r\n \r\n let mceContentBodys = innerElements[j].querySelectorAll( '.mce-content-body' );\r\n if( mceContentBodys.length > 0 ) {\r\n for ( let k = 0; k < mceContentBodys.length; k++ ) {\r\n mceContentBodys[k].classList.remove( 'mce-content-body' );\r\n }\r\n }\r\n \r\n let dataMceStyle = innerElements[j].querySelectorAll( '[data-mce-style]' );\r\n if ( dataMceStyle.length > 0 ) {\r\n for ( let k = 0; k < dataMceStyle.length; k++ ) {\r\n dataMceStyle[k].removeAttribute( 'data-mce-style' );\r\n }\r\n }\r\n \r\n let contentEditable = innerElements[j].querySelectorAll( '[contenteditable]' );\r\n if ( contentEditable.length > 0 ) {\r\n for ( let k = 0; k < contentEditable.length; k++ ) {\r\n contentEditable[k].removeAttribute( 'contenteditable' );\r\n }\r\n }\r\n \r\n let spellCheck = innerElements[j].querySelectorAll( '[spellcheck]' );\r\n if ( spellCheck.length > 0 ) {\r\n for ( let k = 0; k < spellCheck.length; k++ ) {\r\n spellCheck[k].removeAttribute( 'spellcheck' );\r\n }\r\n }\r\n \r\n let mceIds = innerElements[j].querySelectorAll( '[id^=mce_]' );\r\n if ( mceIds.length > 0 ) {\r\n for ( let k = 0; k < mceIds.length; k++ ) {\r\n mceIds[k].removeAttribute( 'id' );\r\n }\r\n }\r\n \r\n let wptbActions = innerElements[j].querySelectorAll( '.wptb-actions' );\r\n let wptbActionsLength = wptbActions.length;\r\n while ( wptbActionsLength > 0 ) {\r\n if( wptbActions[0] && wptbActions[0].parentNode ) {\r\n wptbActions[0].parentNode.removeChild( wptbActions[0] );\r\n wptbActionsLength--;\r\n } else {\r\n break;\r\n }\r\n \r\n } \r\n }\r\n }\r\n \r\n if( tds[i].hasAttribute( 'data-wptb-title-column' ) ) {\r\n let columnNameDivContainer = document.createElement( 'div' ),\r\n columnNameDiv = document.createElement( 'div' );\r\n columnNameDivContainer.classList.add( 'wptb-column-title-mobile-container' );\r\n columnNameDiv.classList.add( 'wptb-column-title-mobile' );\r\n columnNameDiv.dataset.wptbTitleColumn = tds[i].dataset.wptbTitleColumn;\r\n columnNameDiv.setAttribute( 'style', 'font-size:' + tds[i].dataset.wptbTitleColumnFontSize + '; \\n\\\r\n color:' + tds[i].dataset.wptbTitleColumnColor + '; background-color:' + tds[i].dataset.wptbTitleBackgroundColor + '; text-align:' + tds[i].dataset.wptbTitleAlign + ';' );\r\n columnNameDiv.style.padding = tds[i].style.padding;\r\n if( tds[i].children.length == 0 ) {\r\n tds[i].classList.add( 'wptb-column-title-mobile-not-elements' );\r\n }\r\n columnNameDivContainer.appendChild( columnNameDiv );\r\n tds[i].insertBefore( columnNameDivContainer, tds[i].firstChild );\r\n }\r\n }\r\n }\r\n \r\n return code;\r\n }\r\n}","var WPTB_Stringifier2 = function ( node, start = false ) {\r\n\r\n\tif ( node == undefined ) {\r\n\t\treturn '';\r\n\t} else if ( node.tagName == undefined && node.nodeType == 3 ) {\r\n return node.nodeValue;\r\n }\r\n \r\n let code = [],\r\n children,\r\n int_elem_arr = false,\r\n attributes = [...node.attributes],\r\n attributes_list = [],\r\n internal_elements = [];\r\n if ( ( node.parentNode.classList.contains( 'wptb-list-item-content' ) || \r\n node.parentNode.classList.contains( 'mce-content-body' ) ) && \r\n node.tagName.toLowerCase() == 'p' ) {\r\n children = node.childNodes;\r\n int_elem_arr = true;\r\n } else if( node.children.length > 0 ) {\r\n children = node.children;\r\n } else {\r\n children = node.childNodes;\r\n }\r\n if ( attributes.length > 0 ) {\r\n for ( let i = 0; i < attributes.length; i++ ) {\r\n attributes_list[i] = [attributes[i].name, attributes[i].value];\r\n }\r\n } else {\r\n attributes_list = '';\r\n }\r\n \r\n if ( children.length > 0 ) {\r\n for ( let i = 0; i < children.length; i++) {\r\n let inter_elem = WPTB_Stringifier(children[i]);\r\n \r\n if ( Array.isArray( inter_elem ) || int_elem_arr ) {\r\n internal_elements[i] = inter_elem;\r\n } else if ( typeof inter_elem === 'string' && inter_elem ) {\r\n internal_elements = inter_elem;\r\n }\r\n }\r\n } else {\r\n internal_elements = '';\r\n }\r\n \r\n \r\n code.push(node.tagName.toLowerCase(), attributes_list , internal_elements);\r\n \r\n return code;\r\n}","var array = [], WPTB_Table = function (columns, rows) {\r\n\r\n /* The members of the class */\r\n var settings = document.getElementsByClassName('wptb-settings-items'),\r\n wptbTableSetup = document.getElementsByClassName(\"wptb-table-setup\")[0],\r\n table, row, cell,\r\n maxAmountOfCells,\r\n maxAmountOfRows;\r\n\r\n //HERE ARE THE PRIVATE FUNCTIONS\r\n /*\r\n * This function toggles buttons visibility in cell edit mode\r\n * (according to the amount of currently selected cells), and\r\n * highlights visually the clicked cell if it is not highlighted, or\r\n * removes highlight if clicked cell is already highlighted. \r\n * It too toggles the bits of our abstract representation.\r\n * @param Event this is the event instance of the click performed over a cell.\r\n */\r\n var mark = function ( event ) {\r\n var rs = this.rowSpan,\r\n cs = this.colSpan,\r\n markedCells,\r\n noCells = document.getElementsByClassName('wptb-no-cell-action'),\r\n singleCells = document.getElementsByClassName('wptb-single-action'),\r\n multipleCells = document.getElementsByClassName('wptb-multiple-select-action'),\r\n cellSettings = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ),\r\n position = getCoords(this),\r\n row = position[0],\r\n column = position[1];\r\n if ( ! document.select.isActivated() ) {\r\n return;\r\n }\r\n if (this.className.match(/wptb-highlighted/)) {\r\n this.classList.remove('wptb-highlighted');\r\n for (var i = 0; i < rs; i++) {\r\n for (var j = 0; j < cs; j++) {\r\n array[row + i][column + j] = 0;\r\n }\r\n }\r\n } else {\r\n this.classList.add('wptb-highlighted');\r\n for (var i = 0; i < rs; i++) {\r\n for (var j = 0; j < cs; j++) {\r\n array[row + i][column + j] = 1;\r\n }\r\n }\r\n }\r\n\r\n markedCells = document.getElementsByClassName('wptb-highlighted').length;\r\n if (markedCells === 0) {\r\n for (var i = 0; i < multipleCells.length; i++) {\r\n multipleCells[i].classList.remove('visible');\r\n multipleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n for (var i = 0; i < noCells.length; i++) {\r\n noCells[i].classList.add('visible');\r\n noCells[i].removeAttribute('disabled');\r\n }\r\n for (var i = 0; i < singleCells.length; i++) {\r\n singleCells[i].classList.remove('visible');\r\n singleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n cellSettings.classList.remove( 'visible' );\r\n } else if (markedCells === 1) {\r\n for (var i = 0; i < multipleCells.length; i++) {\r\n multipleCells[i].classList.remove('visible');\r\n multipleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n for (var i = 0; i < noCells.length; i++) {\r\n noCells[i].classList.remove('visible');\r\n noCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n for (var i = 0; i < singleCells.length; i++) {\r\n singleCells[i].classList.add('visible');\r\n singleCells[i].removeAttribute('disabled');\r\n }\r\n let cellHighlighted = document.querySelector( '.wptb-highlighted' );\r\n if( cellHighlighted ) {\r\n let wptbTableColumnWidthSlider = document.getElementById( 'wptb-table-column-width-slider' );\r\n let wptbTableColumnWidthNumber = document.getElementById( 'wptb-table-column-width-number' );\r\n let tableColumnWidthAutoFixedCheckbox = document.getElementById( 'wptb-table-column-width-auto-fixed' );\r\n let width = cellHighlighted.style.width;\r\n if( width ) {\r\n wptbTableColumnWidthSlider.value = parseFloat( width, 10 );\r\n wptbTableColumnWidthNumber.value = parseFloat( width, 10 );\r\n tableColumnWidthAutoFixedCheckbox.checked = true;\r\n } else if( cellHighlighted.dataset.wptbFixedWidth ) {\r\n wptbTableColumnWidthSlider.value = cellHighlighted.dataset.wptbFixedWidth;\r\n wptbTableColumnWidthNumber.value = cellHighlighted.dataset.wptbFixedWidth;\r\n tableColumnWidthAutoFixedCheckbox.checked = true;\r\n } else {\r\n let cellWidth = WPTB_Helper.getColumnWidth( table, cellHighlighted );\r\n wptbTableColumnWidthSlider.value = cellWidth;\r\n wptbTableColumnWidthNumber.value = cellWidth;\r\n tableColumnWidthAutoFixedCheckbox.checked = false;\r\n }\r\n \r\n \r\n let wptbTableRowHeightSlider = document.getElementById( 'wptb-table-row-height-slider' );\r\n let wptbTableRowHeightNumber = document.getElementById( 'wptb-table-row-height-number' );\r\n let tableRowHeightAutoFixedCheckbox = document.getElementById( 'wptb-table-row-height-auto-fixed' );\r\n let height = cellHighlighted.style.height;\r\n if( height ) {\r\n wptbTableRowHeightSlider.value = parseFloat( height, 10 );\r\n wptbTableRowHeightNumber.value = parseFloat( height, 10 );\r\n tableRowHeightAutoFixedCheckbox.checked = true;\r\n } else if( cellHighlighted.dataset.wptbFixedHeight ) {\r\n wptbTableRowHeightSlider.value = cellHighlighted.dataset.wptbFixedHeight;\r\n wptbTableRowHeightNumber.value = cellHighlighted.dataset.wptbFixedHeight;\r\n tableRowHeightAutoFixedCheckbox.checked = true;\r\n } else {\r\n let cellHeight = WPTB_Helper.getRowHeight( table, cellHighlighted );\r\n wptbTableRowHeightSlider.value = cellHeight;\r\n wptbTableRowHeightNumber.value = cellHeight;\r\n tableRowHeightAutoFixedCheckbox.checked = false;\r\n }\r\n }\r\n cellSettings.classList.add( 'visible' );\r\n } else {\r\n for (var i = 0; i < multipleCells.length; i++) {\r\n if (table.isSquare(array)) {\r\n multipleCells[i].classList.add('visible');\r\n multipleCells[i].removeAttribute('disabled');\r\n } else {\r\n multipleCells[i].classList.remove('visible');\r\n multipleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n }\r\n for (var i = 0; i < noCells.length; i++) {\r\n noCells[i].classList.remove('visible');\r\n noCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n for (var i = 0; i < singleCells.length; i++) {\r\n singleCells[i].classList.remove('visible');\r\n singleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n cellSettings.classList.remove( 'visible' );\r\n }\r\n };\r\n\r\n /* \r\n * This function fills an array with 1's according to the actual design\r\n * of HTML table.\r\n * @returns an array of arrays containing an abstract representation\r\n * of HTML table.\r\n * @deprecated\r\n * */\r\n\r\n var realTimeArray = function () {\r\n var carried = [], tds, cols, matriz = [];\r\n\r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n carried[i] = 0;\r\n }\r\n\r\n for (var i = 0; i < table.rows.length; i++) {\r\n cols = [];\r\n\r\n var tds = table.rows[i].getElementsByTagName('td');\r\n\r\n for (items = 0; items < tds.length; items++) {\r\n\r\n for (var k = 0; k < tds[items].colSpan; k++) {\r\n cols.push(1);\r\n }\r\n\r\n if (tds[items].rowSpan > 1) {\r\n for (var k = 0; k < tds[items].colSpan; k++) {\r\n carried[items + k] = {\r\n justAssigned: true,\r\n amount: tds[items].rowSpan\r\n };\r\n }\r\n }\r\n }\r\n\r\n for (var k = 0; k < maxAmountOfCells; k++) {\r\n if (typeof carried[k] == 'object' && carried[k].amount > 0) {\r\n carried[k].amount--;\r\n if (carried[k].justAssigned) {\r\n carried[k].justAssigned = false;\r\n } else {\r\n cols.push(1);\r\n }\r\n }\r\n }\r\n\r\n matriz.push(cols);\r\n\r\n }\r\n return matriz;\r\n };\r\n\r\n /*\r\n * This function gets the number and position of cell spaces in current row that are occuped \r\n * by upper rowspanned cells.\r\n * @param number the number of row where we wish to calculate the carried rowspans up to.\r\n * @return an array with the remaining rowspans in each column.\r\n */\r\n var carriedRowspans = function (row) {\r\n var carried = [], tds, cols;\r\n\r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n carried[i] = 0;\r\n }\r\n\r\n if (row == -1) {\r\n return carried;\r\n }\r\n\r\n for (var i = 0; i <= row; i++) {\r\n cellsBuffer = table.rows[i].getElementsByTagName('td');\r\n cellPointer = 0;\r\n\r\n for (var xPosition = 0; xPosition < maxAmountOfCells; xPosition += stepsToMove) {\r\n stepsToMove = 1;\r\n\r\n if (carried[xPosition]) {\r\n carried[xPosition]--;\r\n } else {\r\n celda = cellsBuffer[cellPointer++];\r\n if (celda.rowSpan > 1) {\r\n for (k = 0; k < celda.colSpan; k++) {\r\n carried[xPosition + k] = celda.rowSpan - 1;\r\n }\r\n stepsToMove = celda.colSpan;\r\n } else if (celda.colSpan > 1) {\r\n stepsToMove = celda.colSpan;\r\n }\r\n }\r\n }\r\n\r\n }\r\n return carried;\r\n };\r\n\r\n /*\r\n * A helpful function for showing\r\n * the abstract table in console.\r\n * @param Array our abstract table.\r\n */\r\n var drawTable = function (a) {\r\n var string = 'DRAWING TABLE:\\n';\r\n for (var i = 0; i < a.length; i++) {\r\n\r\n for (var j = 0; j < a[i].length; j++) {\r\n string += ' ' + a[i][j];\r\n }\r\n string += '\\n';\r\n }\r\n table.isSquare(a);\r\n };\r\n\r\n /*\r\n * It resets all the bits of our abstract representation\r\n * to 0 and removes the highlighting class of all cells.\r\n */\r\n\r\n var undoSelect = function () {\r\n var noCells = document.getElementsByClassName('wptb-no-cell-action'),\r\n singleCells = document.getElementsByClassName('wptb-single-action'),\r\n multipleCells = document.getElementsByClassName('wptb-multiple-select-action'),\r\n cellSettings = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ),\r\n tds = table.getElementsByClassName('wptb-highlighted');\r\n while (tds.length) {\r\n tds[0].classList.remove('wptb-highlighted');\r\n }\r\n cellSettings.classList.remove( 'visible' );\r\n for (var i = 0; i < array.length; i++) {\r\n for (var j = 0; j < array[i].length; j++) {\r\n array[i][j] = 0;\r\n }\r\n }\r\n for (var i = 0; i < multipleCells.length; i++) {\r\n multipleCells[i].classList.remove('visible');\r\n multipleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n for (var i = 0; i < noCells.length; i++) {\r\n noCells[i].classList.add('visible');\r\n noCells[i].removeAttribute('disabled');\r\n }\r\n for (var i = 0; i < singleCells.length; i++) {\r\n singleCells[i].classList.remove('visible');\r\n singleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n };\r\n\r\n /*\r\n * This fills the abstract representation of our table with \r\n * zeros, at the start. the max amount of cells is the greatest sum\r\n * of all colspans for row.\r\n */\r\n\r\n var fillTableArray = function () {\r\n var colspansSums = [], a = [];\r\n\r\n //calculate max amount of cells inside a row\r\n for (var i = 0; i < table.rows.length; i++) {\r\n var cells = table.rows[i].getElementsByTagName('td'),\r\n colspanSumInRow = 0;\r\n for (var j = 0; j < cells.length; j++) {\r\n colspanSumInRow += cells[j].colSpan;\r\n }\r\n colspansSums.push(colspanSumInRow);\r\n }\r\n\r\n maxAmountOfCells = Math.max.apply(null, colspansSums);\r\n //calculate max rows\r\n var maxAmountOfRows = table.rows.length;\r\n\r\n // fill with zeros from both values\r\n for (var i = 0; i < maxAmountOfRows; i++) {\r\n a[i] = [];\r\n for (var j = 0; j < maxAmountOfCells; j++) {\r\n a[i].push(0);\r\n }\r\n }\r\n drawTable(a);\r\n return a;\r\n };\r\n\r\n /*\r\n * This function gets the sum of all colspans in a row.\r\n * @param number the number of row to be used as reference.\r\n */\r\n var getActualPointsInRow = function (row) {\r\n var tds = table.rows[row].getElementsByTagName('td'),\r\n points = 0;\r\n for (var i = 0; i < tds.length; i++) {\r\n points += tds[i].colSpan;\r\n }\r\n return points;\r\n }\r\n\r\n /*\r\n * This function gets us the exact coordinates of\r\n * an exact cell, in a more reliable way than xIndex and yIndex,\r\n * these last ones were meant to be used for getting the cell trough them.\r\n * @param DOMElement the cell to get the coordinates.\r\n */\r\n var getCoords = function (search) {\r\n var skipInCols = [], cell;\r\n\r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n skipInCols[i] = 0;\r\n }\r\n\r\n for (var i = 0; i < table.rows.length; i++) {\r\n var cellsBuffer = table.rows[i].getElementsByTagName('td');\r\n cellPointer = 0;\r\n for (var xPosition = 0; xPosition < maxAmountOfCells; xPosition += stepsToMove) {\r\n stepsToMove = 1;\r\n\r\n if (skipInCols[xPosition]) {\r\n skipInCols[xPosition]--;\r\n } else {\r\n var td = cellsBuffer[cellPointer++];\r\n if (td == search) {\r\n return [i, xPosition];\r\n }\r\n if (td.rowSpan > 1) {\r\n for ( let k = 0; k < td.colSpan; k++ ) {\r\n skipInCols[xPosition + k] = td.rowSpan - 1;\r\n }\r\n stepsToMove = td.colSpan;\r\n } else if (td.colSpan > 1) {\r\n stepsToMove = td.colSpan;\r\n }\r\n }\r\n }\r\n }\r\n };\r\n\r\n jQuery('#wptb-table-header-bg').val('');\r\n jQuery('#wptb-even-row-bg').val('');\r\n jQuery('#wptb-odd-row-bg').val('');\r\n jQuery('#wptb-table-border-color').val('');\r\n jQuery('#wptb-table-inner-border-number,#wptb-table-inner-border-slider').val('0');\r\n jQuery('#wptb-table-border-number,#wptb-table-border-slider').val('0');\r\n jQuery('#wptb-table-padding-number,#wptb-table-padding-slider').val('15');\r\n\r\n if (columns || rows) {\r\n //END OF PRIVATE FUNCTIONS\r\n for (var i = 0; i < settings.length; i++) {\r\n if (settings[i].id !== 'wptb-apply-inner-border') {\r\n settings[i].classList.add('visible');\r\n }\r\n }\r\n\r\n //Create a HTML Table element.\r\n table = document.createElement( 'table' );\r\n table.classList.add( 'wptb-preview-table' );\r\n table.dataset.reconstraction = 1;\r\n table.dataset.wptbAdaptiveTable = 1;\r\n //Add the data rows.\r\n for (var i = 0; i < rows; i++) {\r\n\r\n row = table.insertRow(-1);\r\n row.classList.add( 'wptb-row' );\r\n\r\n for (var j = 0; j < columns; j++) {\r\n cell = new WPTB_Cell(mark);\r\n cell.setCoords(i, j);\r\n row.appendChild(cell.getDOMElement());\r\n }\r\n }\r\n } else {\r\n let wptb_preview_table = document.getElementsByClassName( 'wptb-preview-table' );\r\n\r\n if (wptb_preview_table.length > 0) {\r\n table = wptb_preview_table[0];\r\n\r\n let cells = table.getElementsByTagName('td');\r\n\r\n if (cells.length > 0) {\r\n for (let i = 0; i < cells.length; i++) {\r\n WPTB_Cell(mark, cells[i]);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /*\r\n * This just toggles visibility of cell edit bar, and toggles \r\n * cell selecting mode.\r\n */\r\n\r\n table.toggleTableEditMode = function () {\r\n let bar = document.getElementsByClassName('wptb-edit-bar'),\r\n cellModeBackground = document.getElementById('wptb-cell_mode_background'),\r\n leftScrollPanelCurtain = document.getElementById('wptb-left-scroll-panel-curtain'),\r\n leftScrollPanelCellSettings = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ),\r\n wptbPreviewTable = document.getElementsByClassName('wptb-preview-table');\r\n if (wptbPreviewTable.length > 0) {\r\n wptbPreviewTable = wptbPreviewTable[0];\r\n }\r\n\r\n if ( bar.length > 0 ) {\r\n for ( let i = 0; i < bar.length; i++ ) {\r\n if ( bar[i].classList.contains( 'visible' ) ) {\r\n document.select.deactivateMultipleSelectMode();\r\n bar[i].classList.remove( 'visible' );\r\n cellModeBackground.classList.remove( 'visible' );\r\n leftScrollPanelCurtain.classList.remove( 'visible' );\r\n leftScrollPanelCellSettings.classList.remove( 'visible' );\r\n wptbPreviewTable.parentNode.classList.remove( 'wptb-preview-table-manage-cells' );\r\n let wptbPreviewTableTds = wptbPreviewTable.getElementsByTagName( 'td' );\r\n if ( wptbPreviewTableTds.length > 0 ) {\r\n for ( let i = 0; i < wptbPreviewTableTds.length; i++ ) {\r\n wptbPreviewTableTds[i].classList.remove( 'wptb-highlighted' );\r\n }\r\n }\r\n } else {\r\n document.select.activateMultipleSelectMode();\r\n bar[i].classList.add( 'visible' );\r\n cellModeBackground.classList.add( 'visible' );\r\n leftScrollPanelCurtain.classList.add( 'visible' );\r\n wptbPreviewTable.parentNode.classList.add( 'wptb-preview-table-manage-cells' );\r\n }\r\n }\r\n\r\n }\r\n }\r\n\r\n /*\r\n * For assigning to each cell xIndex and y Index attributes,\r\n * these are the column number and row number of cell in table. \r\n */\r\n\r\n table.recalculateIndexes = function ( start ) {\r\n let trs = this.getElementsByTagName('tr'), tds, maxCols = 0, maxColsFull = 0,\r\n tdsArr = [];\r\n let wptbTopRowAsHeader = document.getElementById( 'wptb-top-row-as-header' );\r\n \r\n for (var i = 0; i < trs.length; i++) {\r\n if ( i == 0 ) {\r\n if ( start == undefined ) {\r\n trs[i].style.backgroundColor = jQuery('#wptb-table-header-bg').val();\r\n }\r\n if( wptbTopRowAsHeader.checked ) {\r\n if( start == undefined ) {\r\n this.classList.add( 'wptb-table-preview-head' ); \r\n trs[i].classList.add( 'wptb-table-head' )\r\n } ;\r\n } else {\r\n if( start == undefined ) {\r\n this.classList.remove( 'wptb-table-preview-head' );\r\n trs[i].classList.remove( 'wptb-table-head' );\r\n }\r\n }\r\n } else {\r\n if (i % 2 == 0) {\r\n if ( start == undefined ) {\r\n trs[i].style.backgroundColor = jQuery('#wptb-odd-row-bg').val();\r\n }\r\n trs[i].classList.remove( 'wptb-table-head' );\r\n } else {\r\n if ( start == undefined ) {\r\n trs[i].style.backgroundColor = jQuery('#wptb-even-row-bg').val();\r\n }\r\n trs[i].classList.remove( 'wptb-table-head' );\r\n }\r\n }\r\n\r\n tdsArr[i];\r\n tds = trs[i].getElementsByTagName('td');\r\n\r\n if (tdsArr[i] == undefined) {\r\n tdsArr[i] = [];\r\n }\r\n\r\n let jMainIter = 0;\r\n for (var j = 0; j < tds.length; j++) {\r\n if (tdsArr[i][j] != undefined) {\r\n for (let y = 0; y < 100; y++) {\r\n if (tdsArr[i][jMainIter] != undefined) {\r\n jMainIter++;\r\n continue;\r\n }\r\n tdsArr[i][jMainIter] = tds[j];\r\n tds[j].dataset.xIndex = jMainIter;\r\n break;\r\n }\r\n } else {\r\n tdsArr[i][j] = tds[j];\r\n tds[j].dataset.xIndex = jMainIter;\r\n }\r\n tds[j].dataset.yIndex = i;\r\n\r\n if (tds[j].colSpan > 1) {\r\n for (let k = 1; k < tds[j].colSpan; k++) {\r\n jMainIter++;\r\n tdsArr[i][jMainIter] = 'tdDummy';\r\n }\r\n }\r\n\r\n if (tds[j].rowSpan > 1) {\r\n for (let x = 1; x < tds[j].rowSpan; x++) {\r\n if (tdsArr[i + x] == undefined) {\r\n tdsArr[i + x] = [];\r\n }\r\n for (let z = 0; z < tds[j].colSpan; z++) {\r\n tdsArr[i + x][jMainIter - tds[j].colSpan + 1 + z ] = 'tdDummy';\r\n }\r\n }\r\n }\r\n jMainIter++;\r\n if( i == 0 ) {\r\n maxColsFull = jMainIter;\r\n }\r\n }\r\n if (j > maxCols) {\r\n maxCols = j;\r\n }\r\n }\r\n this.columns = maxCols;\r\n this.maxCols = maxColsFull;\r\n }\r\n \r\n table.addColumnWidth = function( value, cleaner ) {\r\n let highlighted = table.getElementsByClassName( 'wptb-highlighted' );\r\n if( highlighted.length > 0 ) {\r\n for( let k = 0; k < highlighted.length; k++ ) {\r\n let dataXIndex = highlighted[k].dataset.xIndex;\r\n if( dataXIndex ) {\r\n function tableTdsFor( dataXIndex, colspan ) {\r\n let tableRows = table.rows;\r\n let widthIsSet = false;\r\n let arrayTdsFromPreviousRow = [];\r\n for( let i = 0; i < tableRows.length; i++ ) {\r\n let row = tableRows[i];\r\n let tds = row.children;\r\n for( let j = 0; j < tds.length; j++ ) {\r\n let td = tds[j];\r\n if( td.dataset.xIndex == dataXIndex ) {\r\n if( value ) {\r\n if( td.colSpan == colspan ) {\r\n td.style.width = value + 'px';\r\n td.removeAttribute( 'data-wptb-fixed-width' );\r\n widthIsSet = true;\r\n let tableColumnWidthAutoFixedCheckbox = document.getElementById( 'wptb-table-column-width-auto-fixed' );\r\n if( ! tableColumnWidthAutoFixedCheckbox.checked ) {\r\n tableColumnWidthAutoFixedCheckbox.checked = true;\r\n }\r\n } else {\r\n td.style.width = null;\r\n td.dataset.wptbFixedWidth = value;\r\n if( i == tableRows.length - 1 && ! widthIsSet ) {\r\n tableTdsFor( dataXIndex, colspan + 1 );\r\n }\r\n }\r\n } else if( cleaner ) {\r\n td.style.width = null;\r\n td.removeAttribute( 'data-wptb-fixed-width' );\r\n } else {\r\n if( td.dataset.wptbFixedWidth ) {\r\n if( td.colSpan == colspan ) {\r\n td.style.width = td.dataset.wptbFixedWidth + 'px';\r\n td.removeAttribute( 'data-wptb-fixed-width' );\r\n } \r\n } else if( td.style.width ) {\r\n for( let z = 0; z < arrayTdsFromPreviousRow.length; z++ ) {\r\n arrayTdsFromPreviousRow[z].style.width = td.style.width;\r\n }\r\n arrayTdsFromPreviousRow = [];\r\n } else {\r\n arrayTdsFromPreviousRow.push( td );\r\n }\r\n }\r\n break;\r\n } \r\n }\r\n }\r\n }\r\n \r\n tableTdsFor( dataXIndex, 1 );\r\n }\r\n }\r\n \r\n table.tdDefaultWidth();\r\n }\r\n }\r\n \r\n table.tdDefaultWidth = function() {\r\n let rows = table.rows;\r\n \r\n let tableTdsSumMaxWidth = 0;\r\n let tableTdsSumMaxWidthFixed = 0;\r\n let tableTdsSumMaxWidthAuto = 0;\r\n \r\n let wptbTableSetup = document.getElementsByClassName( 'wptb-table-setup' )[0];\r\n let wptbTableSetupWidth = wptbTableSetup.offsetWidth;\r\n \r\n let arrayCellsWidthFixedHelper = [];\r\n let arrayCellsWidthAutoHelper = [];\r\n let tdPaddingCommon = 0;\r\n let tableTdBorderCommonWidth = 0;\r\n let cssForTdsWidthAuto = '';\r\n \r\n for( let i = 0; i < rows.length; i++ ) {\r\n let tds = rows[i].children;\r\n for( let j = 0; j < tds.length; j++ ) {\r\n let td = tds[j];\r\n \r\n if( ! arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] && ! arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] ) {\r\n if( td.style.width ) {\r\n arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] = parseFloat( td.style.width );\r\n td.removeAttribute( 'data-wptb-css-td-auto-width' );\r\n } else {\r\n if( ! td.dataset.wptbFixedWidth ) {\r\n arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] = 100;\r\n td.dataset.wptbCssTdAutoWidth = true;\r\n }\r\n }\r\n \r\n if( window.getComputedStyle( td, null ) ) {\r\n let tdStyleObj = window.getComputedStyle( td, null );\r\n let tdPaddingLeft = tdStyleObj.getPropertyValue( 'padding-left' );\r\n let tdPaddingRight = tdStyleObj.getPropertyValue( 'padding-right' );\r\n tdPaddingCommon = parseFloat( tdPaddingLeft, 10 ) + parseFloat( tdPaddingRight, 10 );\r\n\r\n let tableTdBorderLeftWidth = tdStyleObj.getPropertyValue( 'border-left-width' );\r\n let tableTdBorderRightWidth = tdStyleObj.getPropertyValue( 'border-right-width' );\r\n tableTdBorderCommonWidth = parseFloat( tableTdBorderLeftWidth, 10 ) + parseFloat( tableTdBorderRightWidth, 10 );\r\n if( arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] ) {\r\n arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] += tdPaddingCommon;\r\n arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] += tableTdBorderCommonWidth;\r\n } else {\r\n arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] += tdPaddingCommon;\r\n arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] += tableTdBorderCommonWidth;\r\n }\r\n }\r\n } else if( arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] ) {\r\n if( ! td.dataset.wptbFixedWidth ) {\r\n td.dataset.wptbCssTdAutoWidth = true;\r\n }\r\n } else if( arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] ) {\r\n td.removeAttribute( 'data-wptb-css-td-auto-width' );\r\n }\r\n }\r\n }\r\n \r\n for( let i = 0; i < arrayCellsWidthFixedHelper.length; i++ ) {\r\n if( arrayCellsWidthFixedHelper[i] ) {\r\n tableTdsSumMaxWidthFixed += arrayCellsWidthFixedHelper[i];\r\n }\r\n }\r\n \r\n let CellsWidthAutoCount = 0;\r\n for( let i = 0; i < arrayCellsWidthAutoHelper.length; i++ ) {\r\n if( arrayCellsWidthAutoHelper[i] ) {\r\n tableTdsSumMaxWidthAuto += arrayCellsWidthAutoHelper[i];\r\n CellsWidthAutoCount++;\r\n }\r\n }\r\n \r\n let tableFullStyleObj = window.getComputedStyle( table, null );\r\n let borderLeftWidth = tableFullStyleObj.getPropertyValue( 'border-left-width' );\r\n let borderRightWidth = tableFullStyleObj.getPropertyValue( 'border-right-width' );\r\n let tableBorderCommon = parseFloat( borderLeftWidth, 10 ) + parseFloat( borderRightWidth, 10 );\r\n tableTdsSumMaxWidth = tableTdsSumMaxWidthFixed + tableTdsSumMaxWidthAuto + tableBorderCommon;\r\n \r\n table.dataset.wptbTableTdsSumMaxWidth = tableTdsSumMaxWidth;\r\n if( CellsWidthAutoCount ) {\r\n table.dataset.wptbCellsWidthAutoCount = CellsWidthAutoCount;\r\n if( table.mergingСellsHorizontally ) {\r\n table.dataset.wptbFixedWidthSize = tableTdsSumMaxWidthFixed - tableBorderCommon;\r\n } else {\r\n table.removeAttribute( 'data-wptb-fixed-width-size' );\r\n }\r\n } else {\r\n table.removeAttribute( 'data-wptb-fixed-width-size' );\r\n table.removeAttribute( 'data-wptb-cells-width-auto-count' );\r\n }\r\n \r\n let styleElementCreate = false;\r\n let tableTdWidthAuto;\r\n if( tableTdsSumMaxWidth < wptbTableSetupWidth ) {\r\n if( CellsWidthAutoCount ) {\r\n table.style.minWidth = '100%';\r\n if( table.mergingСellsHorizontally ) {\r\n table.style.width = null;\r\n let tableTdsWidthAutoCommon = wptbTableSetupWidth - tableTdsSumMaxWidthFixed - tableBorderCommon;\r\n tableTdWidthAuto = tableTdsWidthAutoCommon / CellsWidthAutoCount;\r\n tableTdWidthAuto = tableTdWidthAuto - tdPaddingCommon - tableTdBorderCommonWidth;\r\n styleElementCreate = true;\r\n } else {\r\n table.style.width = '100%';\r\n }\r\n } else {\r\n table.style.width = null;\r\n table.style.minWidth = null;\r\n table.style.maxWidth = tableTdsSumMaxWidth + 'px';\r\n }\r\n } else {\r\n table.style.maxWidth = null;\r\n table.style.minWidth = tableTdsSumMaxWidth + 'px';\r\n table.style.width = null;\r\n tableTdWidthAuto = '100'\r\n styleElementCreate = true;\r\n }\r\n \r\n let head = document.head;\r\n if( head ) {\r\n let cssForTdsWidthAutoOld = head.querySelector( 'style[data-wptb-td-auto-width=\"true\"]' );\r\n if( cssForTdsWidthAutoOld ) {\r\n head.removeChild( cssForTdsWidthAutoOld );\r\n }\r\n }\r\n \r\n if( styleElementCreate ) {\r\n cssForTdsWidthAuto = document.createElement( 'style' );\r\n cssForTdsWidthAuto.setAttribute( 'data-wptb-td-auto-width', true );\r\n cssForTdsWidthAuto.innerHTML = '[data-wptb-css-td-auto-width=true]{width:' + tableTdWidthAuto + 'px}';\r\n if( head ) {\r\n head.appendChild( cssForTdsWidthAuto );\r\n }\r\n }\r\n }\r\n \r\n table.addRowHeight = function( value, cleaner ) {\r\n let highlighted = table.getElementsByClassName( 'wptb-highlighted' );\r\n if( highlighted.length > 0 ) {\r\n for( let k = 0; k < highlighted.length; k++ ) {\r\n let dataYIndex = highlighted[k].dataset.yIndex;\r\n if( dataYIndex ) {\r\n function tableTdsFor( dataYIndex, rowspan ) {\r\n let tableRows = table.rows;\r\n let heightIsSet = false;\r\n let arrayTdsPrevious = [];\r\n for( let i = 0; i < tableRows.length; i++ ) {\r\n let row = tableRows[i];\r\n let tds = row.children;\r\n for( let j = 0; j < tds.length; j++ ) {\r\n let td = tds[j];\r\n if( td.dataset.yIndex == dataYIndex ) {\r\n if( value ) {\r\n if( td.rowSpan == rowspan ) {\r\n td.style.height = value + 'px';\r\n td.removeAttribute( 'data-wptb-fixed-heidht' );\r\n heightIsSet = true;\r\n let tableColumnHeightAutoFixedCheckbox = document.getElementById( 'wptb-table-row-height-auto-fixed' );\r\n if( ! tableColumnHeightAutoFixedCheckbox.checked ) {\r\n tableColumnHeightAutoFixedCheckbox.checked = true;\r\n }\r\n continue;\r\n } else {\r\n td.style.height = null;\r\n td.dataset.wptbFixedHeight = value;\r\n if( j == tds.length - 1 && ! heightIsSet ) {\r\n tableTdsFor( dataYIndex , rowspan + 1 );\r\n }\r\n }\r\n } else if( cleaner ) {\r\n td.style.height = null;\r\n td.removeAttribute( 'data-wptb-fixed-heidht' );\r\n } else {\r\n if( td.dataset.wptbFixedHeight ) {\r\n if( td.rowSpan = rowspan ) {\r\n td.style.height = td.dataset.wptbFixedHeight + 'px';\r\n td.removeAttribute( 'data-wptb-fixed-width' );\r\n }\r\n } else if( td.style.height ) {\r\n for( let z = 0; z < arrayTdsPrevious.length; z++ ) {\r\n arrayTdsPrevious[z].style.height = td.style.height;\r\n }\r\n arrayTdsPrevious = [];\r\n } else {\r\n arrayTdsPrevious.push( td );\r\n }\r\n }\r\n } \r\n }\r\n }\r\n }\r\n \r\n tableTdsFor( dataYIndex, 1 );\r\n }\r\n }\r\n }\r\n }\r\n \r\n table.reconstraction = function() {\r\n let tds = table.getElementsByTagName( 'td' );\r\n let wptbAdaptiveTableChoseBlock = document.getElementsByClassName( 'wptb-adaptive-table-chose-block' );\r\n if( wptbAdaptiveTableChoseBlock.length > 0 ) {\r\n wptbAdaptiveTableChoseBlock = wptbAdaptiveTableChoseBlock[0];\r\n }\r\n table.mergingСellsHorizontally = false;\r\n table.mergingCellsVertically = false;\r\n table.dataset.reconstraction = 1;\r\n wptbAdaptiveTableChoseBlock.style.display = 'block';\r\n let forBreak = 0;\r\n for( let i = 0; i < tds.length; i++ ) {\r\n if( tds[i].colSpan > 1 ) {\r\n table.dataset.reconstraction = 0;\r\n wptbAdaptiveTableChoseBlock.style.display = 'none';\r\n table.mergingСellsHorizontally = true;\r\n forBreak++;\r\n }\r\n \r\n if( tds[i].rowSpan > 1 ) {\r\n table.dataset.reconstraction = 0;\r\n wptbAdaptiveTableChoseBlock.style.display = 'none';\r\n table.mergingCellsVertically = true;\r\n forBreak++;\r\n }\r\n \r\n if( forBreak == 2 ) {\r\n break;\r\n }\r\n }\r\n }\r\n\r\n /*\r\n * As simple as it is: adds a column to the end of table.\r\n */\r\n table.addColumnEnd = function () {\r\n let td,\r\n currentTable = document.getElementsByClassName('wptb-preview-table'),\r\n currentTableTd,\r\n currentTdStyle;\r\n if (currentTable.length > 0) {\r\n currentTableTd = currentTable[0].querySelector('td');\r\n }\r\n\r\n if (currentTableTd) {\r\n currentTdStyle = currentTableTd.getAttribute('style');\r\n }\r\n \r\n for (var i = 0; i < table.rows.length; i++) {\r\n td = new WPTB_Cell(mark);\r\n \r\n if (currentTdStyle) {\r\n td.getDOMElement().setAttribute('style', currentTdStyle);\r\n td.getDOMElement().style.width = null;\r\n }\r\n \r\n table.rows[i].appendChild(td.getDOMElement());\r\n array[i].push(0);\r\n }\r\n \r\n maxAmountOfCells++;\r\n table.recalculateIndexes();\r\n table.tdDefaultWidth();\r\n table.addRowHeight();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n /*\r\n * As simple as it looks: adds a column to the start of table.\r\n */\r\n\r\n table.addColumnStart = function () {\r\n let td,\r\n firstCell,\r\n currentTable = document.getElementsByClassName('wptb-preview-table'),\r\n currentTableTd,\r\n currentTdStyle;\r\n if ( currentTable.length > 0 ) {\r\n currentTableTd = currentTable[0].querySelector('td');\r\n }\r\n\r\n if ( currentTableTd ) {\r\n currentTdStyle = currentTableTd.getAttribute('style');\r\n }\r\n \r\n for (var i = 0; i < table.rows.length; i++) {\r\n td = new WPTB_Cell(mark);\r\n if (currentTdStyle) {\r\n td.getDOMElement().setAttribute('style', currentTdStyle);\r\n td.getDOMElement().style.width = null;\r\n }\r\n firstCell = table.rows[i].getElementsByTagName('td')[0];\r\n if (firstCell) {\r\n table.rows[i].insertBefore(td.getDOMElement(), firstCell);\r\n } else {\r\n table.rows[i].appendChild(td.getDOMElement());\r\n }\r\n array[i].push(0);\r\n }\r\n\r\n maxAmountOfCells++;\r\n table.recalculateIndexes();\r\n table.tdDefaultWidth();\r\n table.addRowHeight();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n /*\r\n * Well, not so simple as previous functions.\r\n * It adds a column after a certain column of reference.\r\n * @param integer the column number to be used as reference.\r\n *\tIf empty, then the first highlighted cell is used as reference.\r\n */\r\n\r\n table.addColumnAfter = function (c_pos) {\r\n let rows = table.rows,\r\n cellPointer,\r\n cellsBuffer,\r\n cell = document.querySelector('.wptb-highlighted'),\r\n cellStyle = cell.getAttribute('style'),\r\n pos = c_pos != undefined && typeof c_pos === 'number' ? c_pos : getCoords(cell)[1];\r\n \r\n \r\n \r\n if( maxAmountOfCells - pos - cell.colSpan + 1 == 1 ) {\r\n table.addColumnEnd();\r\n } else {\r\n let pendingInsertion = false,\r\n stepsToMove,\r\n td, bro,\r\n carriedRowspans = [],\r\n currentCell;\r\n\r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n carriedRowspans.push(0);\r\n }\r\n\r\n for (var i = 0; i < rows.length; i++) {\r\n cellPointer = 0;\r\n cellsBuffer = rows[i].getElementsByTagName('td');\r\n pendingInsertion = false;\r\n for (var xPosition = 0;\r\n xPosition < maxAmountOfCells;\r\n xPosition += stepsToMove) {\r\n stepsToMove = 1;\r\n\r\n if (pendingInsertion) {\r\n td = new WPTB_Cell(mark);\r\n if (cellStyle) {\r\n td.getDOMElement().setAttribute('style', cellStyle);\r\n td.getDOMElement().style.width = null;\r\n }\r\n if (currentCell && rows[i].contains(currentCell)) {\r\n bro = currentCell.nextSibling;\r\n if (bro) {\r\n rows[i].insertBefore(td.getDOMElement(), bro);\r\n } else {\r\n rows[i].appendChild(td.getDOMElement());\r\n }\r\n } else {\r\n rows[i].insertBefore(td.getDOMElement(), cellsBuffer[0]);\r\n }\r\n break;\r\n } else if (carriedRowspans[xPosition] > 0) {\r\n // If no pending insertion, let's check if no rowspan from upper cells is pending in current position\r\n if (pos == xPosition) {\r\n pendingInsertion = true;\r\n }\r\n } else {\r\n currentCell = cellsBuffer[cellPointer++];\r\n if (currentCell.rowSpan > 1) {\r\n stepsToMove = currentCell.colSpan;\r\n for (var k = 0; k < currentCell.colSpan; k++) {\r\n carriedRowspans[xPosition + k] = currentCell.rowSpan;\r\n if (xPosition + k == pos) {\r\n pendingInsertion = true;\r\n }\r\n }\r\n } else if (currentCell.colSpan > 1) {\r\n stepsToMove = currentCell.colSpan;\r\n for (var k = 0; k < currentCell.colSpan; k++) {\r\n if (xPosition + k == pos) {\r\n pendingInsertion = true;\r\n }\r\n }\r\n } else if (xPosition == pos) {\r\n pendingInsertion = true;\r\n }\r\n }\r\n }\r\n\r\n for (var l = 0; l < maxAmountOfCells; l++) {\r\n if (carriedRowspans[l] > 0)\r\n carriedRowspans[l]--;\r\n }\r\n\r\n }\r\n\r\n for (var i = 0; i < array.length; i++) {\r\n array[i].push(0);\r\n }\r\n maxAmountOfCells++;\r\n drawTable(array);\r\n table.recalculateIndexes();\r\n table.addColumnWidth();\r\n table.addRowHeight();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n };\r\n\r\n /*\r\n * For preventing us to take a lot of time,\r\n * This is just calling the function addColumnAfter, but\r\n * using the previous column to current one as reference.\r\n * @see addColumnAfter\r\n */\r\n\r\n table.addColumnBefore = function () {\r\n var cell = document.querySelector('.wptb-highlighted'),\r\n pos = getCoords(cell)[1];\r\n\r\n if (pos === 0) {\r\n table.addColumnStart();\r\n } else {\r\n table.addColumnAfter(pos - 1);\r\n }\r\n };\r\n\r\n /*\r\n * Luckily, thisfunction is simple, \r\n * it just add a row to the end of table.\r\n */\r\n\r\n table.addRowToTheEnd = function () {\r\n let r = table.insertRow(-1),\r\n td,\r\n aux,\r\n currentTable = document.getElementsByClassName('wptb-preview-table'),\r\n currentTableTd,\r\n currentTdStyle;\r\n r.classList.add( 'wptb-row' );\r\n if (currentTable.length > 0) {\r\n currentTableTd = currentTable[0].querySelector('td');\r\n }\r\n\r\n if (currentTableTd) {\r\n currentTdStyle = currentTableTd.getAttribute('style');\r\n }\r\n\r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n td = new WPTB_Cell(mark);\r\n if (currentTdStyle) {\r\n td.getDOMElement().setAttribute('style', currentTdStyle);\r\n }\r\n r.appendChild(td.getDOMElement());\r\n }\r\n aux = Array.from(array[0]);\r\n array.push(aux);\r\n drawTable(array);\r\n table.recalculateIndexes();\r\n table.addColumnWidth();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n /*\r\n * Yet another simple function, \r\n * it just add a row to the start of table.\r\n */\r\n\r\n table.addRowToTheStart = function () {\r\n let r = table.insertRow(0),\r\n td,\r\n aux,\r\n currentTable = document.getElementsByClassName('wptb-preview-table'),\r\n currentTableTd,\r\n currentTdStyle;\r\n r.classList.add( 'wptb-row' );\r\n if (currentTable.length > 0) {\r\n currentTableTd = currentTable[0].querySelector('td');\r\n }\r\n\r\n if (currentTableTd) {\r\n currentTdStyle = currentTableTd.getAttribute('style');\r\n }\r\n\r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n td = new WPTB_Cell(mark);\r\n if (currentTdStyle) {\r\n td.getDOMElement().setAttribute('style', currentTdStyle);\r\n }\r\n r.appendChild(td.getDOMElement());\r\n }\r\n aux = Array.from(array[0]);\r\n array.push(aux);\r\n drawTable(array);\r\n table.recalculateIndexes();\r\n table.addColumnWidth();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n /* \r\n * This function adds a row before the current one.\r\n * Since the biggest factor of problem is a not-started but ongoing rowspan,\r\n * the most of the troubles is not here.\r\n */\r\n\r\n table.addRowBefore = function () {\r\n let cell = document.querySelector('.wptb-highlighted'),\r\n cellStyle = cell.getAttribute('style'),\r\n row = getCoords(cell)[0],\r\n cellNew;\r\n for( let i = row - 1; i >= 0; i-- ) {\r\n let rowChildren = table.rows[i].children;\r\n let rowChildrenLength = rowChildren.length;\r\n if( rowChildrenLength > 0 ) {\r\n for( let j = 0; j < rowChildrenLength; j++ ) {\r\n if( rowChildren[j].rowSpan == 1 ) {\r\n row = i;\r\n cellNew = true;\r\n break;\r\n }\r\n }\r\n }\r\n if ( cellNew ) {\r\n break;\r\n }\r\n }\r\n\r\n if (row === 0) {\r\n table.addRowToTheStart();\r\n } else {\r\n table.addRowAfter( row, cellStyle );\r\n }\r\n };\r\n\r\n /*\r\n * Well... by the name convention of the previous 3 functions,\r\n * it's pretty obvious that this functions attaches a new\r\n * row after highlighted cell row. The greatest obstacle it was\r\n * the possibility of a TR not having the exact amount of columns\r\n * occuped by actual node but rowspanned upper cells. For that purpose\r\n * it was created the function realTimeArray.\r\n * @see realTimeArray\r\n */\r\n\r\n table.addRowAfter = function ( row, cellStyle ) {\r\n let cellRowSpan,\r\n rowAfter,\r\n aux;\r\n \r\n if ( ( row == undefined || typeof row !== 'number' ) && cellStyle == undefined ) {\r\n let cell = document.querySelector('.wptb-highlighted');\r\n cellStyle = cell.getAttribute('style'),\r\n row = getCoords(cell)[0],\r\n cellRowSpan = cell.rowSpan,\r\n rowAfter = row + cellRowSpan - 1;\r\n } else {\r\n rowAfter = row;\r\n }\r\n \r\n \r\n let cellsColSpan = 0;\r\n if ( rowAfter < table.rows.length -1 ) {\r\n for( let i = 0; i <= rowAfter ; i++ ) {\r\n let tableRowsIChildren = table.rows[i].children,\r\n tableRIChildrenLength = tableRowsIChildren.length;\r\n if( tableRIChildrenLength > 0 ) {\r\n for( let j = 0; j < tableRIChildrenLength; j++ ) {\r\n let rowIRowSpan = tableRowsIChildren[j].rowSpan;\r\n\r\n if ( rowIRowSpan - 1 + i > rowAfter ) {\r\n tableRowsIChildren[j].rowSpan++;\r\n }\r\n }\r\n }\r\n }\r\n \r\n let rNext = table.rows[rowAfter + 1],\r\n rNextChildren = rNext.children,\r\n rNextChildrenLength = rNextChildren.length;\r\n \r\n if( rNextChildrenLength > 0 ) {\r\n for ( let i = 0; i < rNextChildrenLength; i++ ) {\r\n cellsColSpan += rNextChildren[i].colSpan;\r\n }\r\n }\r\n } else {\r\n cellsColSpan = array[0].length;\r\n }\r\n \r\n let r = table.insertRow( rowAfter + 1 );\r\n r.classList.add( 'wptb-row' );\r\n \r\n for ( j = 0; j < cellsColSpan; j++ ) {\r\n let td = new WPTB_Cell( mark );\r\n td.getDOMElement().setAttribute( 'style', cellStyle );\r\n td.getDOMElement().style.width = null;\r\n td.getDOMElement().style.height = null;\r\n r.appendChild( td.getDOMElement() );\r\n }\r\n\r\n aux = Array.from(array[0]);\r\n array.push(aux);\r\n drawTable(array);\r\n table.recalculateIndexes();\r\n table.addColumnWidth();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n /*\r\n * This function checks the current selected cells\r\n * make a rectangular shape.\r\n * @param Array the abstract table.\r\n * @return false, if not making a rectangle, or\r\n *\tArray an array containing number of rows and columns, if selection makes a rectangle.\r\n */\r\n\r\n table.isSquare = function (a) {\r\n var rowStart = -1,\r\n columnStart = -1,\r\n rowEnd = -1,\r\n columnEnd = -1,\r\n height,\r\n width,\r\n itemsEstimate = 0,\r\n items = 0;\r\n\r\n for (var i = 0; i < a.length; i++) {\r\n for (var j = 0; j < a[i].length; j++) {\r\n if (a[i][j] == 1) {\r\n if ( j < columnStart || columnStart == -1 ) {\r\n columnStart = j;\r\n }\r\n if ( i < rowStart || rowStart == -1 ) {\r\n rowStart = i;\r\n }\r\n }\r\n }\r\n \r\n }\r\n\r\n for (var i = a.length - 1; i > -1; i--) {\r\n for (var j = a[i].length - 1; j > -1; j--) {\r\n if (a[i][j] == 1) {\r\n if ( j > columnEnd ) {\r\n columnEnd = j;\r\n }\r\n if ( i > rowEnd ) {\r\n rowEnd = i;\r\n }\r\n }\r\n }\r\n }\r\n\r\n for (var i = rowStart; i < rowEnd; i++) {\r\n for (var j = columnStart; j < columnEnd; j++) {\r\n if (a[i][j] == 0 || a[i][j] == undefined) {\r\n return false;\r\n }\r\n }\r\n }\r\n\r\n for (var i = 0; i < a.length; i++) {\r\n for (var j = 0; j < a[i].length; j++) {\r\n if (a[i][j] == 1) {\r\n items++;\r\n }\r\n }\r\n }\r\n\r\n height = rowEnd - rowStart + 1;\r\n width = columnEnd - columnStart + 1;\r\n itemsEstimate = height * width;\r\n\r\n if (itemsEstimate !== items) {\r\n return false;\r\n }\r\n return [height, width];\r\n };\r\n\r\n /*\r\n * This function merges all selected cells.\r\n * Well, actually sets the colspan and rowspan of first \r\n * upper left cell in selection and deletes the another selected cells.\r\n */\r\n\r\n table.mergeCells = function () {\r\n var dimensions = table.isSquare(array),\r\n rowspan = dimensions[0],\r\n colspan = dimensions[1],\r\n first = document.querySelector('.wptb-highlighted'),\r\n tds = [].slice.call(document.getElementsByClassName('wptb-highlighted'), 1),\r\n tdsChildrenNew = [];\r\n\r\n for (let i = 0; i < tds.length; i++) {\r\n let tdsInternalElements = tds[i].getElementsByClassName('wptb-ph-element');\r\n if (tdsInternalElements.length > 0) {\r\n let tdsIntElemLength = tdsInternalElements.length;\r\n for (let j = 0; j < tdsIntElemLength; j++) {\r\n tdsChildrenNew.push(tdsInternalElements[j]);\r\n }\r\n }\r\n let p = tds[i].parentNode;\r\n p.removeChild(tds[i]);\r\n }\r\n if (tdsChildrenNew.length > 0) {\r\n for (let i = 0; i < tdsChildrenNew.length; i++) {\r\n first.appendChild(tdsChildrenNew[i]);\r\n }\r\n }\r\n\r\n first.colSpan = colspan;\r\n first.rowSpan = rowspan;\r\n table.recalculateIndexes();\r\n table.reconstraction();\r\n let firstWidth = first.style.width;\r\n let firstDataFixedWidth = first.dataset.wptbFixedWidth;\r\n if( firstWidth ) {\r\n table.addColumnWidth( parseFloat( firstWidth, 10 ) );\r\n } else if( firstDataFixedWidth ) {\r\n table.addColumnWidth();\r\n } else {\r\n table.addColumnWidth( false, true );\r\n }\r\n \r\n let firstHeight = first.style.height;\r\n let firstDataFixedHeight = first.dataset.wptbFixedHeight;\r\n if( firstHeight ) {\r\n table.addRowHeight( parseFloat( firstHeight, 10 ) );\r\n } else if( firstDataFixedHeight ) {\r\n table.addRowHeight();\r\n } else {\r\n table.addRowHeight( false, true );\r\n }\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n /*\r\n * This functions makes the exact inverse as above.\r\n * It resets colspan and rowspan and appends \r\n * the same amount in cells to the table.\r\n * @bug\r\n */\r\n\r\n table.splitCell = function () {\r\n var cell = document.getElementsByClassName('wptb-highlighted')[0],\r\n rowspan = cell.rowSpan,\r\n colspan = cell.colSpan,\r\n cellStyles = cell.getAttribute('style'),\r\n row = getCoords(cell)[0],\r\n thisRow = table.rows[row],\r\n cellXIndex =cell.dataset.xIndex;\r\n \r\n cell.rowSpan = 1;\r\n cell.colSpan = 1;\r\n \r\n for (let i = 1; i < colspan; i++) {\r\n let td = new WPTB_Cell(mark);\r\n td.getDOMElement().setAttribute('style', cellStyles);\r\n td.getDOMElement().classList.add( 'wptb-highlighted' );\r\n if ( cell.nextSibling ) {\r\n thisRow.insertBefore( td.getDOMElement(), cell.nextSibling );\r\n } else {\r\n thisRow.appendChild( td.getDOMElement() );\r\n }\r\n \r\n }\r\n\r\n if (rowspan > 1) {\r\n for (let i = 1; i < rowspan; i++) {\r\n let rowChildInsertBefore = undefined,\r\n rowNext = table.rows[row + i],\r\n rowChildren = rowNext.children,\r\n rowChildrenLength = rowChildren.length;\r\n \r\n if ( rowChildrenLength > 0 ) {\r\n for ( let k = 0; k < rowChildrenLength; k++ ) {\r\n if ( Number( rowChildren[k].dataset.xIndex ) > Number( cellXIndex ) ) {\r\n rowChildInsertBefore = rowChildren[k];\r\n break;\r\n } \r\n }\r\n }\r\n for ( let j = 0; j < colspan; j++ ) {\r\n let td = new WPTB_Cell( mark );\r\n td.getDOMElement().setAttribute( 'style', cellStyles );\r\n if ( rowChildInsertBefore != undefined ) {\r\n rowNext.insertBefore( td.getDOMElement(), rowChildInsertBefore );\r\n } else {\r\n rowNext.appendChild( td.getDOMElement() );\r\n }\r\n }\r\n }\r\n }\r\n\r\n table.recalculateIndexes();\r\n table.reconstraction();\r\n table.addColumnWidth();\r\n table.addRowHeight();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n /*\r\n * Searches for rowspanned cells up to row number meeting it.\r\n * @param number the number of row where the function\r\n * must search up to.\r\n */\r\n\r\n table.findRowspannedCells = function (row) {\r\n var array = [],\r\n difference;\r\n actualPoints = getActualPointsInRow(row);\r\n if (actualPoints === maxAmountOfCells) {\r\n return [];\r\n }\r\n difference = maxAmountOfCells - actualPoints;\r\n\r\n for (var i = row - 1; i >= 0 && difference; i--) {\r\n var tds = table.rows[i].getElementsByTagName('td');\r\n for (var i = 0; i < tds.length; i++) {\r\n if (tds[i].rowSpan > 1) {\r\n array.push(tds[i]);\r\n difference -= tds[i].colSpan;\r\n }\r\n }\r\n }\r\n return array;\r\n\r\n }\r\n\r\n /*\r\n * This function explores the table and adds \r\n * a cell for each lacking one for each row\r\n * to meet an even amount of cells.\r\n */\r\n\r\n table.addLackingCells = function () {\r\n var sumRows = [];\r\n for (var i = 0; i < table.rows.length; i++) {\r\n sumRows.push(0);\r\n }\r\n\r\n for (var i = 0; i < table.rows.length; i++) {\r\n var tds = table.rows[i].getElementsByTagName('td');\r\n for (var j = 0; j < tds.length; j++) {\r\n if (tds[j].rowSpan > 1) {\r\n for (var k = 1; k < tds[j].rowSpan; k++) {\r\n sumRows[i + k]++;\r\n }\r\n }\r\n }\r\n }\r\n\r\n for (var i = 0; i < table.rows.length; i++) {\r\n var tds = table.rows[i].getElementsByTagName('td'),\r\n totalColspan = 0;\r\n for (var j = 0; j < tds.length; j++) {\r\n totalColspan += tds[j].colSpan;\r\n }\r\n totalColspan += sumRows[i];\r\n difference = maxAmountOfCells - totalColspan;\r\n for (var j = 0; j < difference; j++) {\r\n var td = new WPTB_Cell(mark);\r\n table.rows[i].appendChild(td.getDOMElement());\r\n //table.rows[i].insertBefore( td.getDOMElement(), rows[i].nextSibling );\r\n }\r\n }\r\n };\r\n\r\n /*\r\n * This function deletes the row of currently\r\n * selected cell. \r\n */\r\n\r\n table.deleteRow = function () {\r\n let cell = document.querySelector('.wptb-highlighted'),\r\n cellStyles = cell.getAttribute('style'),\r\n rowspan = cell.rowSpan,\r\n row = getCoords(cell)[0],\r\n thisRow,\r\n aux;\r\n \r\n if ( rowspan == undefined ) rowspan = 1;\r\n \r\n for ( let i = 0; i < rowspan; i++ ) {\r\n thisRow = table.rows[row];\r\n let thisRowChildren = thisRow.children,\r\n nextRow = table.rows[row + 1],\r\n nextRowChildren,\r\n nextRowChildrenLength,\r\n tdArr = [];\r\n\r\n if( nextRow != undefined ) {\r\n nextRowChildren = nextRow.children;\r\n nextRowChildrenLength = nextRowChildren.length;\r\n for (let j = 0; j < thisRowChildren.length; j++) {\r\n if ( thisRowChildren[j].rowSpan > 1 ) {\r\n let td = new WPTB_Cell(mark);\r\n td.getDOMElement().setAttribute('style', cellStyles);\r\n td.getDOMElement().colSpan = thisRowChildren[j].colSpan;\r\n td.getDOMElement().rowSpan = thisRowChildren[j].rowSpan - 1;\r\n\r\n let nextRowChildrenK = undefined;\r\n for ( let k = 0; k < nextRowChildrenLength; k++ ) {\r\n if ( Number( nextRowChildren[k].dataset.xIndex ) > Number( thisRowChildren[j].dataset.xIndex ) ) {\r\n nextRowChildrenK = nextRowChildren[k];\r\n break;\r\n } \r\n }\r\n\r\n if ( nextRowChildrenK ) {\r\n tdArr.push( [td, nextRowChildrenK] );\r\n } else {\r\n tdArr.push( [td] );\r\n }\r\n }\r\n }\r\n\r\n if ( tdArr.length > 0 ) {\r\n for ( let k = 0; k < tdArr.length; k++ ) {\r\n if ( tdArr[k][1] != undefined ) {\r\n nextRow.insertBefore( tdArr[k][0].getDOMElement(), tdArr[k][1] );\r\n } else {\r\n nextRow.appendChild( tdArr[k][0].getDOMElement() );\r\n }\r\n }\r\n }\r\n }\r\n \r\n let tableRows = table.rows;\r\n if ( tableRows.length > 0 ) {\r\n for ( let j = 0; j < row; j++ ) {\r\n let jRowChildren = tableRows[j].children;\r\n if ( jRowChildren.length > 0 ) {\r\n for ( let x = 0; x < jRowChildren.length; x++ ) {\r\n if ( jRowChildren[x].rowSpan - 1 >= row - j ) {\r\n jRowChildren[x].rowSpan--;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n aux = Array.from(array[0]);\r\n array.pop(aux);\r\n drawTable(array);\r\n table.getElementsByTagName('tbody')[0].removeChild(table.rows[row]);\r\n \r\n if( table.rows.length == 0 ) {\r\n table.toggleTableEditMode();\r\n wptbTableSetup.innerHTML = '';\r\n WPTB_Helper.settingsPanelClear();\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\r\n }\r\n \r\n table.recalculateIndexes();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n \r\n undoSelect();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n\r\n /*\r\n * This function deletes the column of currently\r\n * selected cell. Again, this is way more complicated than\r\n * delete row case.\r\n */\r\n\r\n table.deleteColumn = function () {\r\n let cell = document.querySelector('.wptb-highlighted'),\r\n cellXIndex = cell.dataset.xIndex,\r\n colspan = cell.colSpan;\r\n \r\n for ( let i = 0; i < colspan; i++ ) {\r\n for ( let j = 0; j < table.rows.length; j++ ) {\r\n let rowChildren = table.rows[j].children;\r\n let rowChildrenLength = rowChildren.length;\r\n if( rowChildrenLength > 0 ) {\r\n for ( let k = rowChildrenLength - 1; k >= 0; k-- ) {\r\n if ( Number( rowChildren[k].dataset.xIndex ) == Number( cellXIndex ) ) {\r\n if ( rowChildren[k].colSpan > 1 ) {\r\n rowChildren[k].colSpan--;\r\n } else {\r\n table.rows[j].removeChild( rowChildren[k] );\r\n }\r\n break;\r\n } else if( Number( rowChildren[k].dataset.xIndex ) < Number( cellXIndex ) && \r\n Number( rowChildren[k].dataset.xIndex ) + \r\n Number( rowChildren[k].colSpan -1 ) >= cellXIndex ) {\r\n if ( rowChildren[k].colSpan > 1 ) {\r\n rowChildren[k].colSpan--;\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n \r\n for ( let j = 0; j < table.rows.length; j++ ) {\r\n if (array[j] != undefined)\r\n array[j].pop();\r\n }\r\n \r\n maxAmountOfCells--;\r\n \r\n if( table.querySelectorAll( 'td' ).length == 0 ) {\r\n table.toggleTableEditMode();\r\n wptbTableSetup.innerHTML = '';\r\n WPTB_Helper.settingsPanelClear();\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\r\n }\r\n \r\n table.recalculateIndexes();\r\n table.tdDefaultWidth();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n \r\n undoSelect();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'none';\r\n\r\n array = fillTableArray();\r\n\r\n undoSelect();\r\n drawTable(array);\r\n\r\n wptbTableSetup.appendChild(table);\r\n //if (columns || rows) {\r\n table.recalculateIndexes( true );\r\n //}\r\n table.reconstraction();\r\n table.tdDefaultWidth();\r\n \r\n wptbTableSetup.onresize = function() {\r\n table.tdDefaultWidth();\r\n };\r\n\r\n WPTB_LeftPanel();\r\n \r\n // this code gets the ID of the active element in the toolbar \r\n // and stores it in the data attribute of the common container element \"wpcd_fixed_toolbar\"\r\n// let wptbPhElement = document.getElementsByClassName( 'wptb-ph-element' );\r\n// let wpcdFixedToolbar = document.getElementById( 'wpcd_fixed_toolbar' );\r\n// for ( let i = 0; i < wptbPhElement.length; i++ ) {\r\n// wptbPhElement[i].addEventListener( 'click', function( e ) {\r\n// let wptbToolbar = document.getElementById( 'wpcd_fixed_toolbar' ).children;\r\n// for ( let j = 0; j < wptbToolbar.length; j++ ) {\r\n// let elementStyles = window.getComputedStyle( wptbToolbar[j], 'null' );\r\n// if( elementStyles.getPropertyValue( 'display' ) == 'block' ) {\r\n// wpcdFixedToolbar.dataset.toolbarActiveId = wptbToolbar[j].getAttribute( 'id' );\r\n// }\r\n// }\r\n// }, false );\r\n// }\r\n \r\n// let wptbPanelLeft = document.getElementsByClassName( 'wptb-panel-left' );\r\n// if( wptbPanelLeft.length > 0 ) {\r\n// wptbPanelLeft[0].addEventListener( 'click', function( e ) {\r\n// let toolbarActiveElementId = wpcdFixedToolbar.dataset.toolbarActiveId;\r\n// document.getElementById( toolbarActiveElementId ).style.display = '';\r\n// }, false );\r\n// }\r\n \r\n// let body = document.getElementsByTagName( 'body' );\r\n// if( body.length > 0 ) {\r\n// body[0].addEventListener( 'click', function( e ) {\r\n// if ( e.target.classList.contains( 'wptb-panel-left' ) || WPTB_Helper.findAncestor( e.target, 'wptb-panel-left' ) ) {\r\n// let toolbarActiveElementId = wpcdFixedToolbar.dataset.toolbarActiveId;\r\n// document.getElementById( toolbarActiveElementId ).style.display = '';\r\n// }\r\n// }, false );\r\n// }\r\n};","var WPTB_TableStateSaveManager = function() {\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 }\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 // 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 ) {\r\n let DOMElement = document.createElement('div'),\r\n elText2 = document.createElement('div'),\r\n elP = document.createElement('p'),\r\n kindIndexProt = undefined,\r\n copy = false;\r\n \r\n DOMElement.classList.add( 'wptb-text-container' );\r\n\r\n elP.innerHTML = text != undefined ? text : 'Text';\r\n elText2.appendChild(elP);\r\n DOMElement.appendChild(elText2);\r\n if ( DOMElementProt ) {\r\n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\r\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\r\n kindIndexProt = wptbElementMutch[1];\r\n copy = true;\r\n };\r\n\r\n let attributes = [...DOMElementProt.attributes];\r\n for( let i = 0; i < attributes.length; i++ ) {\r\n DOMElement.setAttribute(attributes[i].name, attributes[i].value);\r\n }\r\n } \r\n\r\n this.kind = 'text';\r\n this.getDOMElement = function () {\r\n return DOMElement;\r\n };\r\n applyGenericItemSettings( this, kindIndexProt, copy );\r\n\r\n return this;\r\n};"]}
inc/admin/js/admin.min.js CHANGED
@@ -1 +1 @@
1
- function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}document.addEventListener("DOMContentLoaded",function(){var e=WPTB_Helper.detectMode();if(e){var n=new XMLHttpRequest,t=ajaxurl+"?action=get_table&id="+e;n.open("GET",t,!0),n.setRequestHeader("Content-type","application/x-www-form-urlencoded"),n.onreadystatechange=function(e){if(4!=this.readyState||200!=this.status);else{var t=JSON.parse(n.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()):document.getElementsByClassName("wptb-table-generator")[0].style.display="table"}},n.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 n=document.createElement("div"),a=document.createElement("div"),l=document.createElement("a"),r=document.createElement("div"),o=void 0,i=!1;if(n.classList.add("wptb-button-container","wptb-size-M","wptb-"),a.classList.add("wptb-button-wrapper"),r.classList.add("wptb-button"),r.innerHTML=null!=e?e:"Button Text",t){var s=t.className.match(/wptb-element-((.+-)\d+)/i);s&&Array.isArray(s)&&(o=s[1],i=!0);var d=[].concat(_toConsumableArray(t.attributes));if(0<d.length)for(var c=0;c<d.length;c++)n.setAttribute(d[c].name,d[c].value);var p=t.querySelector(".wptb-button-wrapper");if(p){var m=[].concat(_toConsumableArray(p.attributes));if(0<m.length)for(var u=0;u<m.length;u++)"style"==m[u].name&&a.setAttribute(m[u].name,m[u].value)}var b=t.querySelector("a");if(b){var g=[].concat(_toConsumableArray(b.attributes));if(0<g.length)for(var h=0;h<g.length;h++)"style"!=g[h].name&&"href"!=g[h].name&&"target"!=g[h].name||l.setAttribute(g[h].name,g[h].value)}}return a.appendChild(l),l.appendChild(r),n.appendChild(a),this.kind="button",this.getDOMElement=function(){return n},applyGenericItemSettings(this,o,i),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 n=function(e){var t=i.getElementsByClassName("wptb-space-between");if(0<t.length)for(var n=0;n<t.length;n++)WPTB_Space(t[n]);s[e].getDOMElement=function(){return s[e]},WPTB_innerElementSet(s[e]);var a=s[e].className.match(/wptb-element-((.+-)\d+)/i);if(a&&Array.isArray(a)){var l=a[1].split("-");if(s[e].kind=l[0],applyGenericItemSettings(s[e],a[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])}}},a=0;a<s.length;a++)n(a);return this.getDOMElement=function(){return i},this.setCoords=function(e,t){var n=this.getDOMElement();n.dataset.yIndex=e,n.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"),n=e.getPropertyValue("padding-right"),a=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(n,10)-parseFloat(a,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(s,e){var d=void 0,c=void 0;if(0==document.getElementsByClassName("wptb-drop-handle").length){(d=document.createElement("div")).classList.add("wptb-drop-handle"),(c=document.createElement("div")).classList.add("wptb-drop-border-marker");var t=document.createElement("div"),n=document.createElement("div"),a=document.createElement("div"),l=document.createElement("div");t.classList.add("wptb-drop-border-marker-top"),n.classList.add("wptb-drop-border-marker-right"),a.classList.add("wptb-drop-border-marker-bottom"),l.classList.add("wptb-drop-border-marker-left"),c.appendChild(t),c.appendChild(n),c.appendChild(a),c.appendChild(l);var r=document.getElementsByTagName("body");0<r.length&&(r[0].appendChild(d),r[0].appendChild(c)),d.ondragenter=function(){},d.ondragover=function(e){e.preventDefault()},d.ondragleave=function(){},d.ondrop=function(e){e.preventDefault();var t,n=void 0;e.dataTransfer.getData("wptbElement")?n=(n=(t=e.dataTransfer.getData("wptbElement")).includes("list")?new WPTB_List:t.includes("image")?new WPTB_Image:t.includes("text")?new WPTB_Text:t.includes("button")?new WPTB_Button:void 0).getDOMElement():((n=document.getElementsByClassName(e.dataTransfer.getData("node"))[0]).classList.remove("wptb-moving-mode"),n.classList.remove("wptb-moving-into-same-elem"));var a=void 0;if("Drop Here"==d.dataset.text)"td"==(s=d.getDOMParentElement()).nodeName.toLowerCase()&&(a=d.getDOMParentElement()).appendChild(n);else{var l=d.getDOMParentElement();if(a=l.parentNode,"Abowe Element"==d.dataset.text)a.insertBefore(n,l);else if("Below Element"==d.dataset.text){var r=l.nextSibling;a.insertBefore(n,r)}}var o=a.parentNode;if(o.classList.contains("wptb-table-head")){var i=WPTB_Helper.findAncestor(o,"wptb-preview-table");WPTB_Helper.dataTitleColumnSet(i)}d.style.display="none",c.style.display="none",WPTB_innerElementSet(n)},document.querySelector(".wptb-container").onscroll=function(){d.style.display="none",c.style.display="none"}}else d=document.getElementsByClassName("wptb-drop-handle")[0],c=document.getElementsByClassName("wptb-drop-border-marker")[0];if(!s||"td"!=s.nodeName.toLowerCase()||0==s.getElementsByClassName("wptb-ph-element").length){var o=void 0;if("td"==s.localName?o=s.parentNode:"div"==s.localName&&s.classList.contains("wptb-ph-element")&&(o=s.parentNode.parentNode),o.classList.contains("wptb-table-head")){for(var i=e.dataTransfer.types,p=!1,m=0;m<i.length;m++){var u=i[m].match(/wptbelindic-([a-z]+)/i);if(u&&"text"!=u[1]){p=!0;break}}if(p)return}d.style.width=s.offsetWidth+"px";var b=s.offsetHeight,g=s.getBoundingClientRect(),h=Number(g.left),w=void 0;if(d.style.left=h+"px",-1!=e.dataTransfer.types.indexOf("wptb-moving-mode")){var y=document.getElementsByClassName("wptb-moving-mode")[0];s==y?(d.classList.add("wptb-moving-into-same-elem"),c.classList.add("wptb-moving-into-same-elem")):(d.classList.remove("wptb-moving-into-same-elem"),c.classList.remove("wptb-moving-into-same-elem"))}if(d.getDOMParentElement=function(){return s},d.style.display="block",c.style.display="block","td"!=s.nodeName.toLowerCase()){var f=null==e.offsetY?e.layerY:e.offsetY;w=Number(g.top)-Number(11),d.dataset.text="Abowe Element",b/2<f&&(w=Number(g.top)+b-1,d.dataset.text="Below Element")}else d.dataset.text="Drop Here",w=Number(g.top)+b/2-5;d.style.top=w+"px",c.style.top=g.top+"px",c.style.left=g.left+"px",wptbDropBorderMarkerTop=c.querySelector(".wptb-drop-border-marker-top"),wptbDropBorderMarkerTop.style.width=Number(s.offsetWidth)-Number(1)+"px",wptbDropBorderMarkerRight=c.querySelector(".wptb-drop-border-marker-right"),wptbDropBorderMarkerRight.style.height=Number(g.bottom)-Number(g.top)-1+"px",wptbDropBorderMarkerRight.style.left=wptbDropBorderMarkerTop.style.width,wptbDropBorderMarkerBottom=c.querySelector(".wptb-drop-border-marker-bottom"),wptbDropBorderMarkerBottom.style.width=wptbDropBorderMarkerTop.style.width,wptbDropBorderMarkerBottom.style.top=wptbDropBorderMarkerRight.style.height,wptbDropBorderMarkerLeft=c.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,n){var a,l=e.getDOMElement();prop=document.querySelector(".wptb-"+e.kind+"-options-prototype").cloneNode(!0),prop.classList.remove("wptb-"+e.kind+"-options-prototype"),a="wptb-options-"+e.kind+"-"+t;for(var r=prop.getElementsByClassName("wptb-element-property"),o=0;o<r.length;o++)r[o].dataset.element=a;if(prop.classList.add(a),document.getElementById("element-options-group").appendChild(prop),n)if("button"==e.kind){var i=document.getElementsByClassName("wptb-element-"+n)[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 h=0;h<b.length;h++)b[h].value==g&&(b[h].selected=!0)}if(0<d.length){var w=d[0].getAttribute("href"),y=d[0].getAttribute("target"),f=d[0].getAttribute("id"),v=prop.querySelector('input[data-type="button-link"]'),B=prop.querySelector('input[data-type="button-link-target"]'),E=B.getAttribute("id"),C=B.parentNode.getElementsByTagName("label")[0],T=prop.querySelector('input[data-type="button-id"]');E=E+"-"+n.split("-")[1],B.setAttribute("id",E),C.setAttribute("for",E),v.value=w,y&&"_blank"==y&&(B.checked=!0),T.value=f}if(c){var x=c[0].style.color,I=c[0].style.backgroundColor,N=prop.querySelector('input[data-type="button-text-color"]'),S=prop.querySelector('input[data-type="button-color"]');N.value=WPTB_Helper.rgbToHex(x),S.value=WPTB_Helper.rgbToHex(I)}}else if("image"==e.kind){var k=document.getElementsByClassName("wptb-element-"+n);if(0<k.length){var _=k[0].getElementsByTagName("a");if(0<_.length){var L=_[0];if(L){L.onclick=function(e){e.preventDefault()};for(var A=L.style.textAlign,W=prop.querySelector('select[data-type="image-alignment"]').getElementsByTagName("option"),P=0;P<W.length;P++)W[P].value==A&&(W[P].selected=!0);var D=L.getAttribute("href"),M=prop.querySelector('input[data-type="image-link"]');D&&(M.value=D);var H=L.getAttribute("target"),q=prop.querySelector('input[data-type="image-link-target"]'),O=q.getAttribute("id"),R=q.parentNode.getElementsByTagName("label")[0];O=O+"-"+n.split("-")[1],q.setAttribute("id",O),R.setAttribute("for",O),H&&"_blank"==H&&(q.checked=!0);var F=L.getElementsByTagName("img");if(0<F.length){var z=F[0].style.width;if(z){var j=prop.querySelector('input[type="range"][data-type="image-size"]'),Q=prop.querySelector('input[type="number"][data-type="image-size"]');j.value=parseInt(z),Q.value=parseInt(z)}var V=F[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-"+n);if(0<G.length){var J=G[0].style.fontSize,Y=G[0].style.color,X=prop.querySelector('input[type="range"][data-type="font-size"]'),K=prop.querySelector('input[type="number"][data-type="font-size"]'),U=prop.querySelector('input[type="text"][data-type="color"]');X.value=parseInt(J),K.value=parseInt(J),U.value=WPTB_Helper.rgbToHex(Y)}}else if("list"==e.kind){var $=document.getElementsByClassName("wptb-element-"+n);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 ne=prop.querySelector('select[data-type="list-class"]');if(ne){ne.value="unordered";for(var ae=ne.parentNode.nextSibling,le=0;le<10&&"1"!=ae.nodeType;le++)ae=ae.nextSibling;if(ae){var re=ae.getAttribute("id");ae.setAttribute("id",re+"-"+n),ae.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"]'),he=Math.max(pe,me,ue);pe==he?ge.value="left":me==he?ge.value="center":ue==he&&(ge.value="right")}}}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 n=document.getElementById("element-options-group").childNodes,a=0;a<n.length;a++)n[a].style&&(n[a].style.display="none");document.querySelector(t).style.display="block"},"button"==e.kind){var we=prop.getElementsByClassName("wptb-btn-size-btn");for(o=0;o<we.length;o++)we[o].onclick=function(){var e=this.innerHTML,t=this.dataset.element.match(/wptb-options-(.+)-(\d+)/i),n=t[1],a=t[2],l=document.getElementsByClassName("wptb-element-"+n+"-"+a)[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")}}var ye=prop.getElementsByClassName("wptb-element-property");for(o=0;o<ye.length;o++){if(ye[o].classList.contains("wptb-color-picker")&&jQuery(ye[o]).wpColorPicker({change:function(e,t){var n,a,l,r=e.target;if(a=(n=r.dataset.element.match(/wptb-options-(.+)-(\d+)/i))[1],l=n[2],affectedEl=document.getElementsByClassName("wptb-element-"+a+"-"+l)[0],"button"==a)"button-text-color"==r.dataset.type?affectedEl.getElementsByClassName("wptb-button")[0].style.color=t.color.toString():affectedEl.getElementsByClassName("wptb-button")[0].style.backgroundColor=t.color.toString();else if("list"==a){var o=affectedEl.querySelectorAll("p");if(0<o.length)for(var i=0;i<o.length;i++)o[i].style.color=t.color.toString()}else affectedEl.style.color=t.color.toString()}}),"font-size"===ye[o].dataset.type)ye[o].parentNode.parentNode.getElementsByClassName("wptb-text-font-size-slider")[0].oninput=function(){this.parentNode.parentNode.getElementsByClassName("wptb-text-font-size-number")[0].value=this.value,this.parentNode.parentNode.getElementsByClassName("wptb-text-font-size-number")[0].onchange()};if("image-size"===ye[o].dataset.type)ye[o].parentNode.parentNode.getElementsByClassName("wptb-image-size-slider")[0].oninput=function(){this.parentNode.parentNode.getElementsByClassName("wptb-image-width-number")[0].value=this.value,this.parentNode.parentNode.getElementsByClassName("wptb-image-width-number")[0].onchange()};ye[o].onchange=function(e){var t=this.dataset.element.match(/wptb-options-(.+)-(\d+)/i),n=t[1],a=t[2],l=document.getElementsByClassName("wptb-element-"+n+"-"+a)[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-image-size-slider")[0].value=this.value;break;case"image-alignment":l.getElementsByClassName("wptb-image-wrapper")[0].style.textAlign=this.value;break;case"font-size":l.style.fontSize=r+"px";break;case"button-alignment":var o="";o="left"==this.value?"start":"right"==this.value?"flex-end":"center",l.getElementsByClassName("wptb-button-wrapper")[0].style.justifyContent=o;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 i=l.querySelectorAll("li"),s=0;s<i.length;s++){var d=i[s].querySelector("p");d&&(d.style.textAlign=this.value)}break;case"list-class":var c=e.target.parentNode.parentNode.querySelector("[data-type=list-style-type]").parentNode,p=c.parentNode;if("unordered"==r){c.style.display="flex",p.querySelector(".wptb-list-icon-select-label").style.display="flex";var m=l.querySelectorAll("li");for(s=0;s<m.length;s++){var u=m[s].querySelector("p");u.removeAttribute("class"),u.classList.add("wptb-list-style-type-disc")}p.querySelector("[data-type=list-style-type]").value="disc"}else{c.style.display="none",p.querySelector(".wptb-list-icon-select-label").style.display="none";var b=l.querySelectorAll("li");for(s=0;s<b.length;s++){b[s].querySelector("p").removeAttribute("class")}}break;case"list-style-type":for(b=l.querySelectorAll("li"),s=0;s<b.length;s++){var g=b[s].querySelector("p");g.removeAttribute("class"),g.classList.add("wptb-list-style-type-"+r.toLowerCase())}}}}},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,n=document.createElement("img");return n.src=t+"/wp-content/plugins/wp-table-builder/inc/admin/views/builder/icons/"+e+".png",n},dragImagesArr:function(){return{text:WPTB_Helper.getDragImageCustom("text"),image:WPTB_Helper.getDragImageCustom("image"),button:WPTB_Helper.getDragImageCustom("button"),list:WPTB_Helper.getDragImageCustom("list")}},listItemsRecalculateIndex:function(e){var t=e.querySelectorAll("p");if(0<t.length)for(var n=0;n<t.length;n++)t[n].dataset.listStyleTypeIndex=Number(n)+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 n=e.target.innerHTML,a=new WPTB_ListItem(n,t,!0);t.parentNode.insertBefore(a.getDOMElement(),t),WPTB_Helper.listItemsTinyMceInit(a.getDOMElement().firstChild),e.target.querySelector("p").innerText="New List Item",WPTB_Helper.listItemsRecalculateIndex(t.parentNode)}else 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(/&nbsp;/g,"").trim()))e.preventDefault(),e.target.querySelector("p").innerText="\n";else{var r=WPTB_Helper.getSelectionText();(r=(r=r.replace(/\s+/g," ").trim()).replace(/&nbsp;/g,"").trim())==l&&(e.preventDefault(),e.target.querySelector("p").innerText="\n")}}}),e.on("keyup",function(e){})},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(e){tinyMCE.init({target:e,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()})},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("/"),n=void 0;return Array.isArray(t)&&0<t.length&&(n=t[t.length-1]),document.location.protocol+"//"+n}return""},dataTitleColumnSet:function(e){for(var t=e.rows,n=t[0],a=getComputedStyle(n),l=n.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,a.backgroundColor,m];break}}r[l[o].dataset.xIndex]||(r[l[o].dataset.xIndex]=["","","",a.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-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"),WPTB_Helper.wpColorPickerClear("wptb-table-header-bg"),WPTB_Helper.wpColorPickerClear("wptb-even-row-bg"),WPTB_Helper.wpColorPickerClear("wptb-odd-row-bg"),document.getElementById("wptb-table-cell-slider").value=15,document.getElementById("wptb-table-cell-number").value=15},wpColorPickerClear:function(e){var t=document.getElementById(e),n=WPTB_Helper.findAncestor(t,"wp-picker-container"),a=n.parentNode;a.removeChild(n);var l=document.createElement("input");l.setAttribute("id",e),l.value="",a.appendChild(l)},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 n=t.dataset.xIndex,a=e.querySelectorAll('[data-x-index="'+n+'"]'),l=t.getCellDimensions().width,r=0;r<a.length;r++)l>a[r].getCellDimensions().width&&(l=a[r].getCellDimensions().width);return l},getRowHeight:function(e,t){for(var n=t.dataset.yIndex,a=e.querySelectorAll('[data-y-index="'+n+'"]'),l=t.getCellDimensions().height,r=0;r<a.length;r++)l>a[r].getCellDimensions().height&&(l=a[r].getCellDimensions().height);return l}},WPTB_Image=function(e,t){var n=void 0,a=void 0,l=void 0,r=!1;if(null==t){n=document.createElement("div"),a=document.createElement("div");var o=document.createElement("a"),i=document.createElement("img");o.style.display="inline-block",o.appendChild(i),n.classList.add("wptb-image-container"),a.classList.add("wptb-image-wrapper"),a.appendChild(o),n.appendChild(a),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(),i.src=attachment.url}),null==e?file_frame.open():i.src=e}else{(n=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 n},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<10&&columnsInput.value++},rowsDecrementButton.onclick=function(){1<rowsInput.value&&rowsInput.value--},rowsIncrementButton.onclick=function(){rowsInput.value<10&&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)}},WPTB_LeftPanel=function(){var e,t,r=document.getElementsByClassName("wptb-preview-table")[0],n=document.getElementsByClassName("wptb-element");function a(e,t){if(!(3<t)&&r){var n=r.getElementsByTagName("tr");if(n.length>t){var a=n[t].style.backgroundColor,l=document.getElementById(e);l&&a&&(l.value=WPTB_Helper.rgbToHex(a))}}}function l(e){for(var t=r.getElementsByTagName("td"),n=0;n<t.length;n++)t[n].style.borderWidth=document.querySelector("#wptb-table-inner-border-number").value+"px",t[n].style.borderStyle="solid"}function o(e){for(var t=r.getElementsByTagName("td"),n=0;n<t.length;n++)t[n].style.padding=e+"px"}function i(e){r.style.borderWidth=e+"px",r.style.borderStyle="solid"}function s(e,t,n){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),n<e&&(this.value=n)}}a("wptb-even-row-bg",1),jQuery("#wptb-even-row-bg").wpColorPicker({change:function(e,t){for(var n=r.getElementsByTagName("tr"),a=1;a<n.length;a+=2)n[a].style.backgroundColor=t.color.toString()},clear:function(){for(var e=r.getElementsByTagName("tr"),t=1;t<e.length;t+=2){e[t].style.backgroundColor="";for(var n=e[t].getElementsByTagName("td"),a=0;a<n.length;a++)n[a].style.backgroundColor=""}}}),a("wptb-odd-row-bg",2),jQuery("#wptb-odd-row-bg").wpColorPicker({change:function(e,t){for(var n=r.getElementsByTagName("tr"),a=2;a<n.length;a+=2)n[a].style.backgroundColor=t.color.toString()},clear:function(){for(var e=r.getElementsByTagName("tr"),t=2;t<e.length;t+=2){e[t].style.backgroundColor="";for(var n=e[t].getElementsByTagName("td"),a=0;a<n.length;a++)n[a].style.backgroundColor=""}}}),a("wptb-table-header-bg",0),jQuery("#wptb-table-header-bg").wpColorPicker({change:function(e,t){r.getElementsByTagName("tr")[0].style.backgroundColor=t.color.toString()},clear:function(){var e=r.getElementsByTagName("tr")[0];e.style.backgroundColor="";for(var t=e.getElementsByTagName("td"),n=0;n<t.length;n++)t[n].style.backgroundColor=""}}),e=r,t=document.getElementById("wptb-top-row-as-header"),e&&e.classList.contains("wptb-table-preview-head")?t.checked=!0:t.checked=!1,function(){var e=document.getElementsByClassName("wptb-preview-table");if(0<e.length){var t=e[0].style.borderColor;if(t){var n=document.getElementById("wptb-table-border-color");n&&(n.value=WPTB_Helper.rgbToHex(t))}var a=e[0].style.borderWidth;if(a){var l=document.getElementById("wptb-table-border-slider"),r=document.getElementById("wptb-table-border-number");l&&(l.value=parseInt(a)),r&&(r.value=parseInt(a))}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}(a&&0<parseInt(a)||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 n=r.getElementsByTagName("td");r.style.border=document.querySelector("#wptb-table-border-number").value+"px solid "+t.color.toString();for(var a=0;a<n.length;a++){var l=document.querySelector("#wptb-table-inner-border-number").value;document.getElementById("wptb-inner-border-check").checked&&(n[a].style.border=(0!=l?l:1)+"px solid "+t.color.toString())}},clear:function(){var e=r.getElementsByTagName("td");r.style.borderColor="";for(var t=0;t<e.length;t++)e[t].style.borderColor=""}}),function(){var e=document.getElementsByClassName("wptb-preview-table");if(0<e.length){var t=e[0].querySelector("td");if(t){var n=t.style.padding;if(n){var a=document.getElementById("wptb-table-cell-slider"),l=document.getElementById("wptb-table-cell-number");a&&(a.value=parseInt(n)),l&&(l.value=parseInt(n))}}}}(),s(document.getElementById("wptb-table-border-number"),1,50),s(document.getElementById("wptb-table-inner-border-number"),1,50),s(document.getElementById("wptb-table-cell-number"),1,50),s(document.getElementById("wptb-text-font-size-number"),1,50),s(document.getElementById("wptb-image-width-number"),2,100),s(document.getElementById("wptb-table-column-width-number"),2,500),s(document.getElementById("wptb-table-row-height-number"),2,200),document.getElementById("wptb-table-cell-slider").oninput=function(){document.getElementById("wptb-table-cell-number").value=this.value,o(this.value),r.tdDefaultWidth()},document.getElementById("wptb-table-cell-number").onchange=function(){document.getElementById("wptb-table-cell-slider").value=this.value,o(this.value),r.tdDefaultWidth()},document.getElementById("wptb-table-border-slider").oninput=function(){document.getElementById("wptb-table-border-number").value=this.value,i(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-number").onchange=function(){document.getElementById("wptb-table-border-slider").value=this.value,i(this.value),r.tdDefaultWidth()},document.getElementById("wptb-table-inner-border-slider").oninput=function(){document.getElementById("wptb-table-inner-border-number").value=this.value,l(this.value),r.tdDefaultWidth()},document.getElementById("wptb-table-inner-border-number").onchange=function(){document.getElementById("wptb-table-inner-border-slider").value=this.value,l(this.value),r.tdDefaultWidth()},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 n=document.querySelector("#wptb-table-inner-border-slider").value+"px",a=document.getElementsByClassName("wptb-preview-table");if(0<a.length)if("checked"==e){document.getElementById("wptb-apply-inner-border").style.marginBottom="0px";for(var l=a[0].getElementsByTagName("td"),r=0;r<l.length;r++)l[r].style.border=n+" solid "+t;document.getElementById("wptb-apply-inner-border").classList.add("visible")}else for(document.getElementById("wptb-apply-inner-border").classList.remove("visible"),l=a[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,n=document.getElementById("wptb-table-border-color-set-area");n.style.display="unchecked"==e&&0==t?"none":""}},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-number").onchange=function(){document.getElementById("wptb-table-column-width-slider").value=this.value,r.addColumnWidth(this.value)},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 n=r.querySelector(".wptb-highlighted"),a=WPTB_Helper.getColumnWidth(r,n);document.getElementById("wptb-table-column-width-number").value=a,document.getElementById("wptb-table-column-width-slider").value=a}},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-number").onchange=function(){document.getElementById("wptb-table-row-height-slider").value=this.value,r.addRowHeight(this.value)},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 n=r.querySelector(".wptb-highlighted"),a=WPTB_Helper.getRowHeight(r,n);document.getElementById("wptb-table-row-height-number").value=a,document.getElementById("wptb-table-row-height-slider").value=a}},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 n=e.rows;e.classList.remove("wptb-table-preview-head"),n[0].classList.remove("wptb-table-head");for(var a=1;a<n.length;a++)for(var l=n[a].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)};for(var d=0;d<n.length;d++)n[d].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].addEventListener("click",function(e){if(!(e.target.classList.contains("wptb-ph-element")||WPTB_Helper.findAncestor(e.target,"wptb-ph-element")||e.target.classList.contains("wptb-fixed-toolbar")||WPTB_Helper.findAncestor(e.target,"wptb-fixed-toolbar"))){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 t=document.getElementById("wpcd_fixed_toolbar");t.hasAttribute("data-toolbar-active-id")&&document.getElementById(t.getAttribute("data-toolbar-active-id")).classList.remove("toolbar-active")}},!1)},WPTB_List=function(e,t){var n,a=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");n=new WPTB_ListItem(e[d],s,!0),a.appendChild(n.getDOMElement())}}else for(var d=0;d<3;d++)n=new WPTB_ListItem("<p>List Item "+(d+1)+"</p>"),a.appendChild(n.getDOMElement());return l.appendChild(a),this.getDOMElement=function(){return l},applyGenericItemSettings(this,r,o),WPTB_Helper.listItemsRecalculateIndex(a),this},WPTB_ListItem=function l(e,t,n){var a=void 0;if(null==t||t&&n){null==e&&(e="New List Item");var r=document.createElement("li");if((i=document.createElement("div")).classList.add("wptb-list-item-content"),t){var o=t.getAttribute("style");o&&r.setAttribute("style",o)}r.appendChild(i),i.innerHTML=e,i.onkeyup=window.listItemKeyListener,a=!0}else{var i;(i=(r=t).getElementsByClassName("wptb-list-item-content")[0]).onkeyup=window.listItemKeyListener,a=!1}if(r.onmouseenter=function(e){var t=document.createElement("span"),n=document.createElement("span"),a=document.createElement("span");a.classList.add("wptb-actions"),t.classList.add("dashicons","dashicons-trash","wptb-delete-action"),n.classList.add("dashicons","dashicons-admin-page","wptb-duplicate-action"),this.classList.add("wptb-directlyhovered"),t.onclick=function(){var e=this.parentNode,t=this.parentNode.parentNode,n=t.parentNode;t.removeChild(e),n.removeChild(t),WPTB_Helper.listItemsRecalculateIndex(n)},n.onclick=function(e){var t=e.target.parentNode.parentNode,n=t.querySelector(".wptb-list-item-content").innerHTML,a=new l(n,t,!0);t.parentNode.insertBefore(a.getDOMElement(),r),WPTB_Helper.listItemsTinyMceInit(a.getDOMElement().firstChild),setTimeout(function(){i.innerHTML=n,WPTB_Helper.listItemsRecalculateIndex(t.parentNode)},5)},a.append(n,t),this.appendChild(a)},r.onmouseleave=function(e){this.removeAttribute("class");for(var t=0;e.target.querySelector(".wptb-actions")&&t<5;)e.target.querySelector(".wptb-actions").remove(),t++},this.getDOMElement=function(){return r},a)return this},MultipleSelect=function(){var l=[],n=!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");n=!0},this.deactivateMultipleSelectMode=function(){n=!1},this.isActivated=function(){return n},this.pushSelectedCell=function(e){n&&(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,n=1e3,a=l.length-1;0<=a;a--)t>=l[a].dataset.xIndex&&n>=l[a].dataset.yIndex&&(e=l[a],t=l[a].dataset.xIndex,n=l[a].dataset.yIndex);return e},this.getLast=function(){for(var e,t=-1,n=-1,a=l.length-1;0<=a;a--)t<=l[a].dataset.xIndex&&n<=l[a].dataset.yIndex&&(e=l[a],t=l[a].dataset.xIndex,n=l[a].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,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var WPTB_Parser=function(e){var t=document.createElement("div");t.innerHTML=e;for(var n=t.children[0],a=[].concat(_toConsumableArray(n.querySelectorAll(".wptb-column-title-mobile-container"))),l=0;l<a.length;l++){a[l].parentNode.removeChild(a[l])}for(var r=n.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 n},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 n=e[0];if(t=document.createElement(n),1 in e&&Array.isArray(e[1]))for(var a=e[1],l=0;l<a.length;l++)Array.isArray(a[l])&&t.setAttribute(a[l][0],a[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"!=n.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 n=document.getElementsByClassName("wptb-popup-window-modal")[0];document.getElementsByClassName("wptb-embed-btn")[0].onclick=function(){this.classList.contains("wptb-embed-disable")||n.classList.add("wptb-popup-show")},document.getElementsByClassName("wptb-popup-dark-area")[0].onclick=function(){n.classList.remove("wptb-popup-show")},document.getElementsByClassName("wptb-popup-window-close-icon")[0].onclick=function(){n.classList.remove("wptb-popup-show")},document.getElementsByClassName("wptb-save-btn")[0].onclick=function(){var e=document.querySelector(".wptb-edit-bar");e&&e.classList.contains("visible")&&document.getElementsByClassName("wptb-preview-table")[0].toggleTableEditMode();var n=new XMLHttpRequest,t=(wptb_admin_object?wptb_admin_object.ajaxurl:ajaxurl)+"?action=save_table",a=document.getElementById("wptb-setup-name").value.trim(),l=void 0,r=document.getElementsByClassName("wptb-preview-table");if(r=0<r.length?(r=WPTB_Stringifier(r[0])).outerHTML:"",""===a||""===r){var o="";return""===a&&(o+="You must assign a name to the table before saving it.</br>"),""===r&&(o+="Table wasn't created"),(l=document.getElementById("wptb-messaging-area")).innerHTML='<div class="wptb-error wptb-message">Error: '+o+"</div>",l.classList.add("wptb-warning"),void setTimeout(function(){l.removeChild(l.firstChild)},4e3)}var i={title:a,content:r,security_code:wptb_admin_object.security_code};((rs=WPTB_Helper.detectMode())||(rs=document.wptbId))&&(i.id=rs),i=JSON.stringify(i),n.open("POST",t,!0),n.setRequestHeader("Content-type","application/json; charset=utf-8"),n.onreadystatechange=function(e){if(4==this.readyState&&200==this.status){var t=JSON.parse(n.responseText);l=document.getElementById("wptb-messaging-area"),"saved"==t[0]?(document.wptbId=t[1],l.innerHTML='<div class="wptb-success wptb-message">Table "'+a+'" was successfully saved.</div>',document.getElementsByClassName("wptb-embed-btn")[0].classList.remove("wptb-embed-disable"),document.getElementById("wptb-embed-shortcode").value="[wptb id="+t[1]+"]"):"edited"==t[0]?l.innerHTML='<div class="wptb-success wptb-message">Table "'+a+'" was successfully updated.</div>':l.innerHTML='<div class="wptb-error wptb-message">Safety problems</div>',l.classList.add("wptb-success"),setTimeout(function(){l.removeChild(l.firstChild)},4e3)}},n.send(i)}},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,n,a,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")),n=(t=document.getElementsByClassName(e.dataTransfer.getData("node"))[0]).nextSibling,a=t.parentNode,null!=n&&a.removeChild(n),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},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 n=t.getElementsByTagName("td");if(0<n.length)for(var a=0;a<n.length;a++){e.querySelector("wptb-table-preview-head")&&n[a].removeAttribute("data-x-index"),n[a].removeAttribute("data-y-index"),n[a].removeAttribute("draggable"),n[a].classList.remove("wptb-droppable");var l=n[a].getElementsByClassName("wptb-ph-element");if(0<l.length)for(var r=0;r<l.length;r++){l[r].classList.remove("wptb-directlyhovered");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 h=l[r].querySelectorAll(".wptb-actions"),w=h.length;0<w;)h[0].parentNode.removeChild(h[0]),w--}if(n[a].hasAttribute("data-wptb-title-column")){var y=document.createElement("div"),f=document.createElement("div");y.classList.add("wptb-column-title-mobile-container"),f.classList.add("wptb-column-title-mobile"),f.dataset.wptbTitleColumn=n[a].dataset.wptbTitleColumn,f.setAttribute("style","font-size:"+n[a].dataset.wptbTitleColumnFontSize+"; \n color:"+n[a].dataset.wptbTitleColumnColor+"; background-color:"+n[a].dataset.wptbTitleBackgroundColor+"; text-align:"+n[a].dataset.wptbTitleAlign+";"),f.style.padding=n[a].style.padding,0==n[a].children.length&&n[a].classList.add("wptb-column-title-mobile-not-elements"),y.appendChild(f),n[a].insertBefore(y,n[a].firstChild)}}return t}};function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}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=[],n=void 0,a=!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()?(n=e.childNodes,a=!0):n=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<n.length)for(var s=0;s<n.length;s++){var d=WPTB_Stringifier(n[s]);Array.isArray(d)||a?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 _,n,a,w,l=document.getElementsByClassName("wptb-settings-items"),v=document.getElementsByClassName("wptb-table-setup")[0],B=function(e){var t,n=this.rowSpan,a=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=T(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<n;p++)for(var m=0;m<a;m++)array[d+p][c+m]=0}else{this.classList.add("wptb-highlighted");for(p=0;p<n;p++)for(m=0;m<a;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"),h=document.getElementById("wptb-table-column-width-auto-fixed"),w=u.style.width;if(w)b.value=parseFloat(w,10),g.value=parseFloat(w,10),h.checked=!0;else if(u.dataset.wptbFixedWidth)b.value=u.dataset.wptbFixedWidth,g.value=u.dataset.wptbFixedWidth,h.checked=!0;else{var y=WPTB_Helper.getColumnWidth(_,u);b.value=y,g.value=y,h.checked=!1}var f=document.getElementById("wptb-table-row-height-slider"),v=document.getElementById("wptb-table-row-height-number"),B=document.getElementById("wptb-table-row-height-auto-fixed"),E=u.style.height;if(E)f.value=parseFloat(E,10),v.value=parseFloat(E,10),B.checked=!0;else if(u.dataset.wptbFixedHeight)f.value=u.dataset.wptbFixedHeight,v.value=u.dataset.wptbFixedHeight,B.checked=!0;else{var C=WPTB_Helper.getRowHeight(_,u);f.value=C,v.value=C,B.checked=!1}}i.classList.add("visible")}else{for(p=0;p<o.length;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")}}},E=function(e){for(var t=0;t<e.length;t++){for(var n=0;n<e[t].length;n++)" "+e[t][n];"\n"}_.isSquare(e)},C=function(){for(var e=document.getElementsByClassName("wptb-no-cell-action"),t=document.getElementsByClassName("wptb-single-action"),n=document.getElementsByClassName("wptb-multiple-select-action"),a=_.getElementsByClassName("wptb-highlighted");a.length;)a[0].classList.remove("wptb-highlighted");for(var l=0;l<array.length;l++)for(var r=0;r<array[l].length;r++)array[l][r]=0;for(l=0;l<n.length;l++)n[l].classList.remove("visible"),n[l].setAttribute("disabled","disabled");for(l=0;l<e.length;l++)e[l].classList.add("visible"),e[l].removeAttribute("disabled");for(l=0;l<t.length;l++)t[l].classList.remove("visible"),t[l].setAttribute("disabled","disabled")},T=function(e){for(var t=[],n=0;n<w;n++)t[n]=0;for(n=0;n<_.rows.length;n++)for(var a=_.rows[n].getElementsByTagName("td"),l=cellPointer=0;l<w;l+=stepsToMove)if(stepsToMove=1,t[l])t[l]--;else{var r=a[cellPointer++];if(r==e)return[n,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");(_=document.createElement("table")).classList.add("wptb-preview-table"),_.dataset.reconstraction=1;for(r=0;r<t;r++){(n=_.insertRow(-1)).classList.add("wptb-row");for(var g=0;g<e;g++)(a=new WPTB_Cell(B)).setCoords(r,g),n.appendChild(a.getDOMElement())}}else{var o=document.getElementsByClassName("wptb-preview-table");if(0<o.length){var i=(_=o[0]).getElementsByTagName("td");if(0<i.length)for(var s=0;s<i.length;s++)WPTB_Cell(B,i[s])}}_.toggleTableEditMode=function(){var e=document.getElementsByClassName("wptb-edit-bar"),t=document.getElementById("wptb-cell_mode_background"),n=document.getElementById("wptb-left-scroll-panel-curtain"),a=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"),n.classList.remove("visible"),a.classList.remove("visible"),l.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"),n.classList.add("visible"),l.classList.add("wptb-preview-table-manage-cells")},_.recalculateIndexes=function(e){for(var t=this.getElementsByTagName("tr"),n=void 0,a=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],n=t[i].getElementsByTagName("td"),null==r[i]&&(r[i]=[]);for(var s=0,d=0;d<n.length;d++){if(null!=r[i][d])for(var c=0;c<100;c++){if(null==r[i][s]){r[i][s]=n[d],n[d].dataset.xIndex=s;break}s++}else r[i][d]=n[d],n[d].dataset.xIndex=s;if(n[d].dataset.yIndex=i,1<n[d].colSpan)for(var p=1;p<n[d].colSpan;p++)s++,r[i][s]="tdDummy";if(1<n[d].rowSpan)for(var m=1;m<n[d].rowSpan;m++){null==r[i+m]&&(r[i+m]=[]);for(var u=0;u<n[d].colSpan;u++)r[i+m][s-n[d].colSpan+1+u]="tdDummy"}s++,0==i&&(l=s)}a<d&&(a=d)}this.columns=a,this.maxCols=l},_.addColumnWidth=function(m,u){var e=_.getElementsByClassName("wptb-highlighted");if(0<e.length){for(var t=0;t<e.length;t++){var n=e[t].dataset.xIndex;n&&function e(t,n){for(var a=_.rows,l=!1,r=[],o=0;o<a.length;o++)for(var i=a[o].children,s=0;s<i.length;s++){var d=i[s];if(d.dataset.xIndex==t){if(m)if(d.colSpan==n){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!=a.length-1||l||e(t,n+1);else if(u)d.style.width=null,d.removeAttribute("data-wptb-fixed-width");else if(d.dataset.wptbFixedWidth)d.colSpan==n&&(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}}}(n,1)}_.tdDefaultWidth()}},_.tdDefaultWidth=function(){for(var e,t=_.rows,n=0,a=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"),h=b.getPropertyValue("padding-right");i=parseFloat(g,10)+parseFloat(h,10);var w=b.getPropertyValue("border-left-width"),y=b.getPropertyValue("border-right-width");s=parseFloat(w,10)+parseFloat(y,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 f=0;f<r.length;f++)r[f]&&(n+=r[f]);for(var v=0,B=0;B<o.length;B++)o[B]&&(a+=o[B],v++);var E=window.getComputedStyle(_,null),C=E.getPropertyValue("border-left-width"),T=E.getPropertyValue("border-right-width"),x=parseFloat(C,10)+parseFloat(T,10);e=n+a+x,_.dataset.wptbTableTdsSumMaxWidth=e,v?(_.dataset.wptbCellsWidthAutoCount=v,_.mergingСellsHorizontally?_.dataset.wptbFixedWidthSize=n-x:_.removeAttribute("data-wptb-fixed-width-size")):(_.removeAttribute("data-wptb-fixed-width-size"),_.removeAttribute("data-wptb-cells-width-auto-count"));var I=!1,N=void 0;e<l?v?(_.style.minWidth="100%",_.mergingСellsHorizontally?(N=(N=(l-n-x)/v)-i-s,I=!(_.style.width=null)):_.style.width="100%"):(_.style.width=null,_.style.minWidth=null,_.style.maxWidth=e+"px"):(_.style.maxWidth=null,_.style.minWidth=e+"px",N="100",I=!(_.style.width=null));var S=document.head;if(S){var k=S.querySelector('style[data-wptb-td-auto-width="true"]');k&&S.removeChild(k)}I&&((d=document.createElement("style")).setAttribute("data-wptb-td-auto-width",!0),d.innerHTML="[data-wptb-css-td-auto-width=true]{width:"+N+"px}",S&&S.appendChild(d))},_.addRowHeight=function(m,u){var e=_.getElementsByClassName("wptb-highlighted");if(0<e.length)for(var t=0;t<e.length;t++){var n=e[t].dataset.yIndex;n&&function e(t,n){for(var a=_.rows,l=!1,r=[],o=0;o<a.length;o++)for(var i=a[o].children,s=0;s<i.length;s++){var d=i[s];if(d.dataset.yIndex==t)if(m){if(d.rowSpan==n){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,n+1)}else if(u)d.style.height=null,d.removeAttribute("data-wptb-fixed-heidht");else if(d.dataset.wptbFixedHeight)(d.rowSpan=n)&&(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)}}(n,1)}},_.reconstraction=function(){var e=_.getElementsByTagName("td");_.mergingСellsHorizontally=!1,_.mergingCellsVertically=!1,_.dataset.reconstraction=1;for(var t=0,n=0;n<e.length&&(1<e[n].colSpan&&(_.dataset.reconstraction=0,_.mergingСellsHorizontally=!0,t++),1<e[n].rowSpan&&(_.dataset.reconstraction=0,_.mergingCellsVertically=!0,t++),2!=t);n++);},_.addColumnEnd=function(){var e=void 0,t=document.getElementsByClassName("wptb-preview-table"),n=void 0,a=void 0;0<t.length&&(n=t[0].querySelector("td")),n&&(a=n.getAttribute("style"));for(var l=0;l<_.rows.length;l++)e=new WPTB_Cell(B),a&&(e.getDOMElement().setAttribute("style",a),e.getDOMElement().style.width=null),_.rows[l].appendChild(e.getDOMElement()),array[l].push(0);w++,_.recalculateIndexes(),_.tdDefaultWidth(),_.addRowHeight(),WPTB_Helper.dataTitleColumnSet(_),C()},_.addColumnStart=function(){var e=void 0,t=void 0,n=document.getElementsByClassName("wptb-preview-table"),a=void 0,l=void 0;0<n.length&&(a=n[0].querySelector("td")),a&&(l=a.getAttribute("style"));for(var r=0;r<_.rows.length;r++)e=new WPTB_Cell(B),l&&(e.getDOMElement().setAttribute("style",l),e.getDOMElement().style.width=null),(t=_.rows[r].getElementsByTagName("td")[0])?_.rows[r].insertBefore(e.getDOMElement(),t):_.rows[r].appendChild(e.getDOMElement()),array[r].push(0);w++,_.recalculateIndexes(),_.tdDefaultWidth(),_.addRowHeight(),WPTB_Helper.dataTitleColumnSet(_),C()},_.addColumnAfter=function(e){var t=_.rows,n=void 0,a=void 0,l=document.querySelector(".wptb-highlighted"),r=l.getAttribute("style"),o=null!=e&&"number"==typeof e?e:T(l)[1];if(w-o-l.colSpan+1==1)_.addColumnEnd();else{for(var i=!1,s=void 0,d=void 0,c=void 0,p=[],m=void 0,u=0;u<w;u++)p.push(0);for(u=0;u<t.length;u++){n=0,a=t[u].getElementsByTagName("td"),i=!1;for(var b=0;b<w;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(),a[0]);break}if(0<p[b])o==b&&(i=!0);else if(1<(m=a[n++]).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 h=0;h<w;h++)0<p[h]&&p[h]--}for(u=0;u<array.length;u++)array[u].push(0);w++,E(array),_.recalculateIndexes(),_.addColumnWidth(),_.addRowHeight(),WPTB_Helper.dataTitleColumnSet(_),C()}},_.addColumnBefore=function(){var e=document.querySelector(".wptb-highlighted"),t=T(e)[1];0===t?_.addColumnStart():_.addColumnAfter(t-1)},_.addRowToTheEnd=function(){var e,t=_.insertRow(-1),n=void 0,a=document.getElementsByClassName("wptb-preview-table"),l=void 0,r=void 0;t.classList.add("wptb-row"),0<a.length&&(l=a[0].querySelector("td")),l&&(r=l.getAttribute("style"));for(var o=0;o<w;o++)n=new WPTB_Cell(B),r&&n.getDOMElement().setAttribute("style",r),t.appendChild(n.getDOMElement());e=Array.from(array[0]),array.push(e),E(array),_.recalculateIndexes(),_.addColumnWidth(),WPTB_Helper.dataTitleColumnSet(_),C()},_.addRowToTheStart=function(){var e,t=_.insertRow(0),n=void 0,a=document.getElementsByClassName("wptb-preview-table"),l=void 0,r=void 0;t.classList.add("wptb-row"),0<a.length&&(l=a[0].querySelector("td")),l&&(r=l.getAttribute("style"));for(var o=0;o<w;o++)n=new WPTB_Cell(B),r&&n.getDOMElement().setAttribute("style",r),t.appendChild(n.getDOMElement());e=Array.from(array[0]),array.push(e),E(array),_.recalculateIndexes(),_.addColumnWidth(),WPTB_Helper.dataTitleColumnSet(_),C()},_.addRowBefore=function(){for(var e=document.querySelector(".wptb-highlighted"),t=e.getAttribute("style"),n=T(e)[0],a=void 0,l=n-1;0<=l;l--){var r=_.rows[l].children,o=r.length;if(0<o)for(var i=0;i<o;i++)if(1==r[i].rowSpan){n=l,a=!0;break}if(a)break}0===n?_.addRowToTheStart():_.addRowAfter(n,t)},_.addRowAfter=function(e,t){var n,a=void 0;if(null!=e&&"number"==typeof e||null!=t)a=e;else{var l=document.querySelector(".wptb-highlighted");t=l.getAttribute("style"),a=(e=T(l)[0])+l.rowSpan-1}var r=0;if(a<_.rows.length-1){for(var o=0;o<=a;o++){var i=_.rows[o].children,s=i.length;if(0<s)for(var d=0;d<s;d++){a<i[d].rowSpan-1+o&&i[d].rowSpan++}}var c=_.rows[a+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=_.insertRow(a+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())}n=Array.from(array[0]),array.push(n),E(array),_.recalculateIndexes(),_.addColumnWidth(),WPTB_Helper.dataTitleColumnSet(_),C()},_.isSquare=function(e){for(var t,n,a=-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<a||-1==a)&&(a=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=a;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-a+1)*(n=o-l+1)===i&&[t,n]},_.mergeCells=function(){for(var e=_.isSquare(array),t=e[0],n=e[1],a=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++)a.appendChild(r[c]);a.colSpan=n,a.rowSpan=t,_.recalculateIndexes(),_.reconstraction();var p=a.style.width,m=a.dataset.wptbFixedWidth;p?_.addColumnWidth(parseFloat(p,10)):m?_.addColumnWidth():_.addColumnWidth(!1,!0);var u=a.style.height,b=a.dataset.wptbFixedHeight;u?_.addRowHeight(parseFloat(u,10)):b?_.addRowHeight():_.addRowHeight(!1,!0),WPTB_Helper.dataTitleColumnSet(_),C()},_.splitCell=function(){var e=document.getElementsByClassName("wptb-highlighted")[0],t=e.rowSpan,n=e.colSpan,a=e.getAttribute("style"),l=T(e)[0],r=_.rows[l],o=e.dataset.xIndex;e.rowSpan=1;for(var i=e.colSpan=1;i<n;i++){var s=new WPTB_Cell(B);s.getDOMElement().setAttribute("style",a),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=_.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<n;g++){var h=new WPTB_Cell(B);h.getDOMElement().setAttribute("style",a),null!=c?p.insertBefore(h.getDOMElement(),c):p.appendChild(h.getDOMElement())}}_.recalculateIndexes(),_.reconstraction(),_.addColumnWidth(),_.addRowHeight(),WPTB_Helper.dataTitleColumnSet(_),C()},_.findRowspannedCells=function(e){var t,n=[];if(actualPoints=function(e){for(var t=_.rows[e].getElementsByTagName("td"),n=0,a=0;a<t.length;a++)n+=t[a].colSpan;return n}(e),actualPoints===w)return[];t=w-actualPoints;for(var a=e-1;0<=a&&t;a--){var l=_.rows[a].getElementsByTagName("td");for(a=0;a<l.length;a++)1<l[a].rowSpan&&(n.push(l[a]),t-=l[a].colSpan)}return n},_.addLackingCells=function(){for(var e=[],t=0;t<_.rows.length;t++)e.push(0);for(t=0;t<_.rows.length;t++)for(var n=_.rows[t].getElementsByTagName("td"),a=0;a<n.length;a++)if(1<n[a].rowSpan)for(var l=1;l<n[a].rowSpan;l++)e[t+l]++;for(t=0;t<_.rows.length;t++){n=_.rows[t].getElementsByTagName("td");var r=0;for(a=0;a<n.length;a++)r+=n[a].colSpan;r+=e[t],difference=w-r;for(a=0;a<difference;a++){var o=new WPTB_Cell(B);_.rows[t].appendChild(o.getDOMElement())}}},_.deleteRow=function(){var e=document.querySelector(".wptb-highlighted"),t=e.getAttribute("style"),n=e.rowSpan,a=T(e)[0],l=void 0;null==n&&(n=1);for(var r=0;r<n;r++){var o=_.rows[a].children,i=_.rows[a+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 h=_.rows;if(0<h.length)for(var w=0;w<a;w++){var y=h[w].children;if(0<y.length)for(var f=0;f<y.length;f++)y[f].rowSpan-1>=a-w&&y[f].rowSpan--}l=Array.from(array[0]),array.pop(l),E(array),_.getElementsByTagName("tbody")[0].removeChild(_.rows[a]),0==_.rows.length&&(_.toggleTableEditMode(),v.innerHTML="",WPTB_Helper.settingsPanelClear(),document.getElementsByClassName("wptb-table-generator")[0].style.display="table"),_.recalculateIndexes(),WPTB_Helper.dataTitleColumnSet(_)}C()},_.deleteColumn=function(){for(var e=document.querySelector(".wptb-highlighted"),t=e.dataset.xIndex,n=e.colSpan,a=0;a<n;a++){for(var l=0;l<_.rows.length;l++){var r=_.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--:_.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<_.rows.length;s++)null!=array[s]&&array[s].pop();w--,0==_.querySelectorAll("td").length&&(_.toggleTableEditMode(),v.innerHTML="",WPTB_Helper.settingsPanelClear(),document.getElementsByClassName("wptb-table-generator")[0].style.display="table"),_.recalculateIndexes(),_.tdDefaultWidth(),WPTB_Helper.dataTitleColumnSet(_)}C()},document.getElementsByClassName("wptb-table-generator")[0].style.display="none",array=function(){for(var e=[],t=[],n=0;n<_.rows.length;n++){for(var a=_.rows[n].getElementsByTagName("td"),l=0,r=0;r<a.length;r++)l+=a[r].colSpan;e.push(l)}w=Math.max.apply(null,e);var o=_.rows.length;for(n=0;n<o;n++)for(t[n]=[],r=0;r<w;r++)t[n].push(0);return E(t),t}(),C(),E(array),v.appendChild(_),_.recalculateIndexes(!0),_.reconstraction(),_.tdDefaultWidth(),v.onresize=function(){_.tdDefaultWidth()},WPTB_LeftPanel()};function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var WPTB_Text=function(e,t){var n=document.createElement("div"),a=document.createElement("div"),l=document.createElement("p"),r=void 0,o=!1;if(n.classList.add("wptb-text-container"),l.innerHTML=null!=e?e:"Text",a.appendChild(l),n.appendChild(a),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++)n.setAttribute(s[d].name,s[d].value)}return this.kind="text",this.getDOMElement=function(){return n},applyGenericItemSettings(this,r,o),this},WPTB_innerElementSet=function p(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,n=void 0;if(e.preventDefault(),e.stopPropagation(),e.dataTransfer.getData("wptbElement")||e.dataTransfer.getData("node")){var a,l=void 0,r=void 0;if(0<document.getElementsByClassName("wptb-drop-handle").length&&(l=document.getElementsByClassName("wptb-drop-handle")[0]),0<document.getElementsByClassName("wptb-drop-border-marker").length&&(r=document.getElementsByClassName("wptb-drop-border-marker")[0]),e.dataTransfer.getData("wptbElement")?t=(t="list"==(a=e.dataTransfer.getData("wptbElement"))?new WPTB_List:"image"==a?new WPTB_Image:"text"==a?new WPTB_Text:"button"==a?new WPTB_Button:void 0).getDOMElement():(n=e.dataTransfer.getData("node"),(t=document.getElementsByClassName(n)[0]).classList.remove("wptb-moving-mode")),"block"==l.style.display){var o=void 0;if("Drop Here"==l.dataset.text)(o=l.getDOMParentElement()).appendChild(t);else{var i=l.getDOMParentElement();if(o=i.parentNode,"Abowe Element"==l.dataset.text)o.insertBefore(t,i);else if("Below Element"==l.dataset.text){var s=i.nextSibling;o.insertBefore(t,s)}}var d=o.parentNode;if(d.classList.contains("wptb-table-head")){var c=WPTB_Helper.findAncestor(d,"wptb-preview-table");WPTB_Helper.dataTitleColumnSet(c)}return l.style.display="none",r.style.display="none",p(t),!0}}},t.onmouseover=function(e){t.classList.remove("wptb-ondragenter")}},applyGenericItemSettings=function(m,e){var t,u,n=2<arguments.length&&void 0!==arguments[2]&&arguments[2],b=m.getDOMElement();if(null==e||1==n){t=document.counter.nextIndex(m.kind);for(var a=document.getElementsByClassName("wptb-ph-element"),l=[],r=0;r<a.length;r++){var o=new RegExp("wptb-element-"+m.kind+"-(\\d+)","i"),i=a[r].className.match(o);i&&l.push(i[1])}if(0<l.length)t=Math.max.apply(Math,l)+1;else t=1}else e&&!n&&(t=e.split("-")[1]);if(b.onmouseenter=function(e){this.classList.add("wptb-directlyhovered");var t=document.createElement("span"),n=document.createElement("span"),a=document.createElement("span"),l=document.createElement("span");l.classList.add("wptb-actions"),t.classList.add("dashicons","dashicons-trash","wptb-delete-action"),n.classList.add("dashicons","dashicons-admin-page","wptb-duplicate-action"),a.classList.add("dashicons","dashicons-move","wptb-move-action"),a.draggable=!0,t.onclick=function(e){var t=this.parentNode.parentNode,n=t.parentNode;if(n.removeChild(t),"text"==t.kind){var a=n.parentNode;if(a.classList.contains("wptb-table-head")){var l=WPTB_Helper.findAncestor(a,"wptb-preview-table");WPTB_Helper.dataTitleColumnSet(l)}}},n.onclick=function(e){var t=void 0;if("list"==m.kind){e.target.parentNode.parentNode.parentNode;for(var n=[],a=e.target.parentNode.parentNode.querySelectorAll("ul li .wptb-list-item-content"),l=0;l<a.length;l++)n.push(a[l].innerHTML);t=new WPTB_List(n,b),b.parentNode.insertBefore(t.getDOMElement(),b.nextSibling)}else if("text"==m.kind){e.target.parentNode.parentNode.parentNode;t=new WPTB_Text(e.target.parentNode.parentNode.childNodes[0].innerHTML,b),b.parentNode.insertBefore(t.getDOMElement(),b.nextSibling)}else if("image"==m.kind){e.target.parentNode.parentNode.parentNode;t=new WPTB_Image(e.target.parentNode.parentNode.children[0].children[0].src,b),b.parentNode.insertBefore(t.getDOMElement(),b.nextSibling)}else{e.target.parentNode.parentNode.parentNode;var r=e.target.parentNode.parentNode.childNodes[0].querySelector("p").innerHTML;t=new WPTB_Button(r,b),b.parentNode.insertBefore(t.getDOMElement(),b.nextSibling)}WPTB_innerElementSet(t.getDOMElement())};var r,o,i=this;r=i.className.match(/wptb-element-(.+)-(\d+)/i),o=r[1];var s=WPTB_Helper.dragImagesArr();if(a.ondragstart=function(e){if(this.parentNode.style.opacity=0,i.classList.remove("wptb-directlyhovered"),i.classList.add("wptb-moving-mode"),e.dataTransfer.setDragImage(s[o],0,0),e.dataTransfer.setData("node","wptb-element-"+r[1]+"-"+r[2]),e.dataTransfer.setData("wptb-moving-mode","wptb-element-"+r[1]+"-"+r[2]),e.dataTransfer.setData("wptbElIndic-"+r[1],"wptbElIndic-"+r[1]),"text"==e.target.parentNode.parentNode.kind){var t=el.parentNode;if(t.classList.contains("wptb-table-head")){var n=WPTB_Helper.findAncestor(t,"wptb-preview-table");WPTB_Helper.dataTitleColumnSet(n)}}},"button"===m.kind){var d=b.querySelector("a"),c=d.querySelector("div");d.onclick=function(e){e.preventDefault()},WPTB_Helper.buttonsTinyMceInit(c)}else if("text"===m.kind)tinyMCE.init({target:b.childNodes[0],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("change",function(e){var t=WPTB_Helper.findAncestor(b,"wptb-row");if(t.classList.contains("wptb-table-head")){var n=WPTB_Helper.findAncestor(t,"wptb-preview-table");WPTB_Helper.dataTitleColumnSet(n)}})},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{u=b.getElementsByClassName("wptb-list-item-content");for(var p=0;p<u.length;p++)WPTB_Helper.listItemsTinyMceInit(u[p])}l.appendChild(a),l.appendChild(n),l.appendChild(t),this.appendChild(l)},b.onmouseleave=function(e){this.classList.remove("wptb-directlyhovered");for(var t=0;e.target.querySelector(".wptb-actions")&&t<5;)e.target.querySelector(".wptb-actions").remove(),t++},"text"==m.kind){new MutationObserver(function(e){var t=WPTB_Helper.findAncestor(b,"wptb-row");if(t.classList.contains("wptb-table-head")){var n=WPTB_Helper.findAncestor(t,"wptb-preview-table");WPTB_Helper.dataTitleColumnSet(n)}}).observe(m.getDOMElement(),{attributes:!0,attributeFilter:["style"]})}var s=b.className.match(/wptb-element-(.+)-(\d+)/i);s&&b.classList.remove(s[0]),b.classList.contains("wptb-ph-element")||b.classList.add("wptb-ph-element"),b.classList.contains("wptb-element-"+m.kind+"-"+t)||b.classList.add("wptb-element-"+m.kind+"-"+t),new WPTB_ElementOptions(m,t,e),document.counter.increment(m.kind)};
1
+ var WPTB_BorderMarkerActionsField=function c(){var s=this;if(this.wptbBorderMarker,this.wptbActions,0==document.getElementsByClassName("wptb-border-marker").length){var e=document.getElementsByTagName("body")[0];this.wptbBorderMarker=document.createElement("div"),this.wptbBorderMarker.classList.add("wptb-border-marker");var t=document.createElement("div"),a=document.createElement("div"),n=document.createElement("div"),l=document.createElement("div");t.classList.add("wptb-border-marker-top"),a.classList.add("wptb-border-marker-right"),n.classList.add("wptb-border-marker-bottom"),l.classList.add("wptb-border-marker-left"),this.wptbBorderMarker.appendChild(t),this.wptbBorderMarker.appendChild(a),this.wptbBorderMarker.appendChild(n),this.wptbBorderMarker.appendChild(l),e.appendChild(this.wptbBorderMarker)}else this.wptbBorderMarker=document.getElementsByClassName("wptb-border-marker")[0];0!=document.getElementsByClassName("wptb-actions").length&&(this.wptbActions=document.getElementsByClassName("wptb-actions")[0]),this.addActionField=function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,d=arguments[1];if(1==e){var t=void 0,a=void 0,n=void 0,l=void 0;if(0!=(l=document.getElementsByClassName("wptb-actions")).length)for(;0!=l.length;)l[0].parentNode.removeChild(l[0]);t=document.createElement("span"),a=document.createElement("span"),n=document.createElement("span"),(l=document.createElement("div")).classList.add("wptb-actions"),t.classList.add("dashicons","dashicons-trash","wptb-delete-action"),a.classList.add("dashicons","dashicons-admin-page","wptb-duplicate-action"),n.classList.add("dashicons","dashicons-move","wptb-move-action"),n.draggable=!0,l.appendChild(n),l.appendChild(a),l.appendChild(t),s.wptbBorderMarker.insertBefore(l,s.wptbBorderMarker.firstChild),l.activeElem=d,l.type=1,t.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 c(4).borderMarkerHide()},a.onclick=function(e){var t,a=void 0,n=e.target.parentNode.activeElem;t=n.className.match(/wptb-element-(.+)-(\d+)/i)[1];var l=n.parentNode;if("list"==t){for(var r=[],o=n.querySelectorAll("ul li .wptb-list-item-content"),i=0;i<o.length;i++)r.push(o[i].innerHTML);a=new WPTB_List(r,n),l.insertBefore(a.getDOMElement(),n.nextSibling)}else if("text"==t)a=new WPTB_Text(n.childNodes[0].innerHTML,n),l.insertBefore(a.getDOMElement(),n.nextSibling);else if("image"==t)a=new WPTB_Image(n.children[0].children[0].src,d),l.insertBefore(a.getDOMElement(),n.nextSibling);else{var s=n.childNodes[0].querySelector("p").innerHTML;a=new WPTB_Button(s,n),l.insertBefore(a.getDOMElement(),n.nextSibling)}WPTB_innerElementSet(a.getDOMElement()),new c(1,n).setParameters(n)},n.ondragstart=function(e){var t,a,n=WPTB_Helper.dragImagesArr(),l=e.target.parentNode,r=l.activeElem;a=(t=r.className.match(/wptb-element-(.+)-(\d+)/i))[1],l.style.opacity=0,r.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 o=e.target.parentNode.activeElem;if("text"==o.kind){var i=o.parentNode.parentNode;if(i.classList.contains("wptb-table-head")){var s=WPTB_Helper.findAncestor(i,"wptb-preview-table");WPTB_Helper.dataTitleColumnSet(s)}}},l.style.right="-"+(parseFloat(d.offsetWidth)+3)+"px",l.style.display="block",s.wptbActions=l}else if(2==e){var r=void 0,o=void 0,i=void 0;if(0!=(i=document.getElementsByClassName("wptb-actions")).length)for(;0!=i.length;)i[0].parentNode.removeChild(i[0]);r=document.createElement("span"),o=document.createElement("span"),(i=document.createElement("span")).classList.add("wptb-actions"),r.classList.add("dashicons","dashicons-trash","wptb-delete-action"),o.classList.add("dashicons","dashicons-admin-page","wptb-duplicate-action"),i.append(o,r),s.wptbBorderMarker.insertBefore(i,s.wptbBorderMarker.firstChild),i.activeElem=d,i.type=2,r.onclick=function(e){var t=e.target.parentNode,a=t.activeElem,n=a.parentNode;new c(4).wptbBorderMarker.removeChild(t),n.removeChild(a),WPTB_Helper.listItemsRecalculateIndex(n)},o.onclick=function(e){var t=d.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(),d.nextSibling),WPTB_Helper.listItemsTinyMceInit(r.getDOMElement().firstChild);var o=d.getElementsByClassName("wptb-list-item-content");(0<o.length&&(o=o[0]),setTimeout(function(){o.innerHTML=l,WPTB_Helper.listItemsRecalculateIndex(n.parentNode)},5),a!=(t=d.getBoundingClientRect()).top)&&new c(2,d).setParameters(d)},i.style.right="-"+(parseFloat(d.offsetWidth)+3)+"px",i.style.display="block",s.wptbActions=i}},this.setParameters=function(t){var e=t.getBoundingClientRect(),a=document.getElementsByClassName("wptb-container")[0],n=function(){var e=t.getBoundingClientRect();s.wptbBorderMarker.style.top=e.top+"px"};a.removeEventListener("scroll",n,!1),s.wptbBorderMarker.style.top=parseFloat(e.top)-2+"px",s.wptbBorderMarker.style.left=parseFloat(e.left)-2+"px";var l=s.wptbBorderMarker.querySelector(".wptb-border-marker-top");l.style.width=parseFloat(t.offsetWidth)+3+"px";var r=s.wptbBorderMarker.querySelector(".wptb-border-marker-right");r.style.height=parseFloat(e.bottom)-parseFloat(e.top)+4+"px",r.style.left=parseFloat(t.offsetWidth)+3+"px";var o=s.wptbBorderMarker.querySelector(".wptb-border-marker-bottom");o.style.width=l.style.width,o.style.top=parseFloat(e.bottom)-parseFloat(e.top)+3+"px",s.wptbBorderMarker.querySelector(".wptb-border-marker-left").style.height=r.style.height,s.wptbBorderMarker.style.display="block",a.addEventListener("scroll",n,!1)},this.leaveFromField=function(e,n,t){if(null!=e.relatedTarget)if(e.relatedTarget.classList.contains("wptb-border-marker")||e.relatedTarget.classList.contains("wptb-border-marker-top")||e.relatedTarget.classList.contains("wptb-border-marker-right")||e.relatedTarget.classList.contains("wptb-border-marker-bottom")||e.relatedTarget.classList.contains("wptb-border-marker-left")||"td"==e.relatedTarget.localName){if(s.wptbBorderMarker.style.display="none",s.wptbActions.style.display="none",2==s.wptbActions.type){var a=WPTB_Helper.findAncestor(n,"wptb-list-item-container"),l=new c;l.addActionField(1,a),l.setParameters(a)}}else(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"))&&(s.wptbActions.onmouseleave=function(e){if(null!=e.relatedTarget&&"td"==e.relatedTarget.localName&&(s.wptbBorderMarker.style.display="none",s.wptbActions.style.display="none",2==s.wptbActions.type)){var t=WPTB_Helper.findAncestor(n,"wptb-list-item-container"),a=new c;a.addActionField(1,t),a.setParameters(t)}})},this.borderMarkerHide=function(){s.wptbBorderMarker.style.display="none"},this.actionsRemove=function(){var e=s.wptbBorderMarker.getElementsByClassName("wptb-actions");0<e.length&&(e=e[0],s.wptbBorderMarker.removeChild(e))}};function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,a=Array(e.length);t<e.length;t++)a[t]=e[t];return a}return Array.from(e)}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()):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<(h=[].concat(_toConsumableArray(g.attributes))).length)for(var w=0;w<h.length;w++)"style"!=h[w].name&&"href"!=h[w].name&&"target"!=h[w].name||l.setAttribute(h[w].name,h[w].value);var h,y=t.querySelector(".wptb-button");if(y)if(0<(h=[].concat(_toConsumableArray(y.attributes))).length)for(var v=0;v<h.length;v++)"style"==h[v].name&&r.setAttribute(h[v].name,h[v].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(s,e){var d=void 0,c=new WPTB_BorderMarkerActionsField;if(c.actionsRemove(),0==document.getElementsByClassName("wptb-drop-handle").length){var t=document.getElementsByTagName("body")[0];(d=document.createElement("div")).classList.add("wptb-drop-handle"),t.appendChild(d),d.ondragenter=function(){},d.ondragover=function(e){e.preventDefault()},d.ondragleave=function(){},d.ondrop=function(e){e.preventDefault();var t,a=void 0;e.dataTransfer.getData("wptbElement")?a=(a=(t=e.dataTransfer.getData("wptbElement")).includes("list")?new WPTB_List:t.includes("image")?new WPTB_Image:t.includes("text")?new WPTB_Text:t.includes("button")?new WPTB_Button:void 0).getDOMElement():((a=document.getElementsByClassName(e.dataTransfer.getData("node"))[0]).classList.remove("wptb-moving-mode"),a.classList.remove("wptb-moving-into-same-elem")),a.classList.remove("wptb-ondragenter");var n=void 0;if("Drop Here"==d.dataset.text)"td"==(s=d.getDOMParentElement()).nodeName.toLowerCase()&&(n=d.getDOMParentElement()).appendChild(a);else{var l=d.getDOMParentElement();if(n=l.parentNode,"Above Element"==d.dataset.text)n.insertBefore(a,l);else if("Below Element"==d.dataset.text){var r=l.nextSibling;n.insertBefore(a,r)}}var o=n.parentNode;if(o.classList.contains("wptb-table-head")){var i=WPTB_Helper.findAncestor(o,"wptb-preview-table");WPTB_Helper.dataTitleColumnSet(i)}d.style.display="none",c.borderMarkerHide(),WPTB_innerElementSet(a)}}else d=document.getElementsByClassName("wptb-drop-handle")[0];if(!s||"td"!=s.nodeName.toLowerCase()||0==s.getElementsByClassName("wptb-ph-element").length){var a=void 0;if("td"==s.localName?a=s.parentNode:"div"==s.localName&&s.classList.contains("wptb-ph-element")&&(a=s.parentNode.parentNode),a.classList.contains("wptb-table-head")){for(var n=e.dataTransfer.types,l=!1,r=0;r<n.length;r++){var o=n[r].match(/wptbelindic-([a-z]+)/i);if(o&&"text"!=o[1]){l=!0;break}}if(l)return}d.style.width=s.offsetWidth+4+"px";var i=s.offsetHeight,p=s.getBoundingClientRect(),m=Number(p.left),u=void 0;if(d.style.left=m-2+"px",-1!=e.dataTransfer.types.indexOf("wptb-moving-mode")){var b=document.getElementsByClassName("wptb-moving-mode")[0];s==b?(d.classList.add("wptb-moving-into-same-elem"),c.wptbBorderMarker.classList.add("wptb-moving-into-same-elem")):(d.classList.remove("wptb-moving-into-same-elem"),c.wptbBorderMarker.classList.remove("wptb-moving-into-same-elem"))}d.getDOMParentElement=function(){return s},d.style.display="block";var g=c.wptbActions;g&&(g.style.display="none");var w=document.getElementsByClassName("wptb-container")[0],h=function(){var e=s.getBoundingClientRect();c.wptbBorderMarker.style.top=e.top+"px"};if(w.removeEventListener("scroll",h,!1),"td"!=s.nodeName.toLowerCase()){var y=null==e.offsetY?e.layerY:e.offsetY;u=parseFloat(p.top)-parseFloat(13),d.dataset.text="Above Element",i/2<y&&(u=parseFloat(p.top)+i+1,d.dataset.text="Below Element")}else d.dataset.text="Drop Here",u=parseFloat(p.top)+i/2-5;d.style.top=u+"px",w.addEventListener("scroll",h,!1),c.setParameters(s)}},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 h=d[0].getAttribute("href"),y=d[0].getAttribute("target"),v=d[0].getAttribute("id"),f=prop.querySelector('input[data-type="button-link"]'),B=prop.querySelector('input[data-type="button-link-target"]'),E=B.getAttribute("id"),C=B.parentNode.getElementsByTagName("label")[0],T=prop.querySelector('input[data-type="button-id"]');E=E+"-"+a.split("-")[1],B.setAttribute("id",E),C.setAttribute("for",E),f.value=h,y&&"_blank"==y&&(B.checked=!0),T.value=v}if(c){var x=c[0].style.color,I=c[0].style.backgroundColor,k=prop.querySelector('input[data-type="button-text-color"]'),N=prop.querySelector('input[data-type="button-color"]');k.value=WPTB_Helper.rgbToHex(x),N.value=WPTB_Helper.rgbToHex(I)}}else if("image"==e.kind){var S=document.getElementsByClassName("wptb-element-"+a);if(0<S.length){var _=S[0].getElementsByClassName("wptb-image-wrapper");if(0<_.length){for(var A=(_=_[0]).style.textAlign,L=prop.querySelector('select[data-type="image-alignment"]').getElementsByTagName("option"),W=0;W<L.length;W++)L[W].value==A&&(L[W].selected=!0);var P=_.getElementsByTagName("a");if(0<P.length){var M=P[0];if(M){M.onclick=function(e){e.preventDefault()};var H=M.getAttribute("href"),D=prop.querySelector('input[data-type="image-link"]');H&&(D.value=H);var q=M.getAttribute("target"),F=prop.querySelector('input[data-type="image-link-target"]'),O=F.getAttribute("id"),R=F.parentNode.getElementsByTagName("label")[0];O=O+"-"+a.split("-")[1],F.setAttribute("id",O),R.setAttribute("for",O),q&&"_blank"==q&&(F.checked=!0);var z=M.style.width;if(z){var j=prop.querySelector('input[type="range"][data-type="image-size"]'),Q=prop.querySelector('input[type="number"][data-type="image-size"]');j.value=parseInt(z),Q.value=parseInt(z)}var V=M.getElementsByTagName("img");if(0<V.length){var G=V[0].getAttribute("alt");prop.querySelector('input[type="text"][data-type="alternative-text"]').value=G}}}}}}else if("text"==e.kind){var J=document.getElementsByClassName("wptb-element-"+a);if(0<J.length){var Y=J[0].style.fontSize,K=J[0].style.color,X=prop.querySelector('input[type="range"][data-type="font-size"]'),U=prop.querySelector('input[type="number"][data-type="font-size"]'),$=prop.querySelector('input[type="text"][data-type="color"]');X.value=parseInt(Y)?parseInt(Y):10,U.value=parseInt(Y)?parseInt(Y):10,$.value=WPTB_Helper.rgbToHex(K)}}else if("list"==e.kind){var Z=document.getElementsByClassName("wptb-element-"+a);if(0<Z.length){var ee=Z[0].querySelector("p").style.color;prop.querySelector('input[type="text"][data-type="list-text-color"]').value=WPTB_Helper.rgbToHex(ee);var te=Z[0].querySelectorAll("li");if(0<te.length){var ae=te[0].querySelector("p").classList;if(0<ae.length){var ne=prop.querySelector('select[data-type="list-class"]');if(ne){ne.value="unordered";for(var le=ne.parentNode.nextSibling,re=0;re<10&&"1"!=le.nodeType;re++)le=le.nextSibling;if(le){var oe=le.getAttribute("id");le.setAttribute("id",oe+"-"+a),le.style.display="flex"}var ie=prop.querySelector('select[data-type="list-style-type"]');ie&&(ie.parentNode.style.display="flex",ae.contains("wptb-list-style-type-disc")?ie.value="disc":ae.contains("wptb-list-style-type-circle")?ie.value="circle":ae.contains("wptb-list-style-type-square")?ie.value="square":ae.contains("wptb-list-style-type-none")&&(ie.value="none"))}}}var se=Z[0].getElementsByClassName("wptb-list-item-content");if(0<se.length){for(var de=[],ce=0;ce<se.length;ce++){var pe=se[ce].querySelector("p");pe&&(pe.style.textAlign?de.push(pe.style.textAlign):de.push("left"))}var me=0,ue=0,be=0;if(0<de.length)for(var ge=0;ge<de.length;ge++)de[ge]&&("left"==de[ge]?me++:"center"==de[ge]?ue++:"right"==de[ge]&&be++);var we=prop.querySelector('select[data-type="list-alignment"]'),he=Math.max(me,ue,be);me==he?we.value="left":ue==he?we.value="center":be==he&&(we.value="right")}}}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 ye=prop.getElementsByClassName("wptb-btn-size-btn");for(o=0;o<ye.length;o++)ye[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")}}var ve=prop.getElementsByClassName("wptb-element-property");for(o=0;o<ve.length;o++){if(ve[o].classList.contains("wptb-color-picker")&&jQuery(ve[o]).wpColorPicker({change:function(e,t){var a,n,l,r=e.target;if(n=(a=r.dataset.element.match(/wptb-options-(.+)-(\d+)/i))[1],l=a[2],affectedEl=document.getElementsByClassName("wptb-element-"+n+"-"+l)[0],"button"==n)"button-text-color"==r.dataset.type?affectedEl.getElementsByClassName("wptb-button")[0].style.color=t.color.toString():affectedEl.getElementsByClassName("wptb-button")[0].style.backgroundColor=t.color.toString();else if("list"==n){var o=affectedEl.querySelectorAll("p");if(0<o.length)for(var i=0;i<o.length;i++)o[i].style.color=t.color.toString()}else affectedEl.style.color=t.color.toString()}}),"font-size"===ve[o].dataset.type)ve[o].parentNode.parentNode.getElementsByClassName("wptb-text-font-size-slider")[0].oninput=function(){this.parentNode.parentNode.getElementsByClassName("wptb-text-font-size-number")[0].value=this.value,this.parentNode.parentNode.getElementsByClassName("wptb-text-font-size-number")[0].onchange()};if("image-size"===ve[o].dataset.type)ve[o].parentNode.parentNode.getElementsByClassName("wptb-image-size-slider")[0].oninput=function(){this.parentNode.parentNode.getElementsByClassName("wptb-image-width-number")[0].value=this.value,this.parentNode.parentNode.getElementsByClassName("wptb-image-width-number")[0].onchange()};ve[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-image-size-slider")[0].value=this.value;break;case"image-alignment":l.getElementsByClassName("wptb-image-wrapper")[0].style.textAlign=this.value;break;case"font-size":l.style.fontSize=r+"px",this.parentNode.parentNode.getElementsByClassName("wptb-text-font-size-slider")[0].value=this.value;break;case"button-alignment":var o="";o="left"==this.value?"start":"right"==this.value?"flex-end":"center",l.getElementsByClassName("wptb-button-wrapper")[0].style.justifyContent=o;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 i=l.querySelectorAll("li"),s=0;s<i.length;s++){var d=i[s].querySelector("p");d&&(d.style.textAlign=this.value)}break;case"list-class":var c=e.target.parentNode.parentNode.querySelector("[data-type=list-style-type]").parentNode,p=c.parentNode;if("unordered"==r){c.style.display="flex",p.querySelector(".wptb-list-icon-select-label").style.display="flex";var m=l.querySelectorAll("li");for(s=0;s<m.length;s++){var u=m[s].querySelector("p");u.removeAttribute("class"),u.classList.add("wptb-list-style-type-disc")}p.querySelector("[data-type=list-style-type]").value="disc"}else{c.style.display="none",p.querySelector(".wptb-list-icon-select-label").style.display="none";var b=l.querySelectorAll("li");for(s=0;s<b.length;s++){b[s].querySelector("p").removeAttribute("class")}}break;case"list-style-type":for(b=l.querySelectorAll("li"),s=0;s<b.length;s++){var g=b[s].querySelector("p");g.removeAttribute("class"),g.classList.add("wptb-list-style-type-"+r.toLowerCase())}}}}},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")}},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);t.parentNode.insertBefore(n.getDOMElement(),t),WPTB_Helper.listItemsTinyMceInit(n.getDOMElement().firstChild),e.target.querySelector("p").innerText="New List Item",WPTB_Helper.listItemsRecalculateIndex(t.parentNode)}else 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(/&nbsp;/g,"").trim()))e.preventDefault(),e.target.querySelector("p").innerText="\n";else{var r=WPTB_Helper.getSelectionText();(r=(r=r.replace(/\s+/g," ").trim()).replace(/&nbsp;/g,"").trim())==l&&(e.preventDefault(),e.target.querySelector("p").innerText="\n")}}var o=e.target.parentNode;new WPTB_BorderMarkerActionsField(2,o).setParameters(o)}),e.on("keyup",function(e){var t=e.target.parentNode;new WPTB_BorderMarkerActionsField(2,t).setParameters(t)})},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(a){tinyMCE.init({target:a,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(a,"wptb-button-container");new WPTB_BorderMarkerActionsField(1,t).setParameters(t)}),e.on("keyup",function(e){var t=WPTB_Helper.findAncestor(a,"wptb-button-container");new WPTB_BorderMarkerActionsField(1,t).setParameters(t)})},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"),WPTB_Helper.wpColorPickerClear("wptb-table-header-bg"),WPTB_Helper.wpColorPickerClear("wptb-even-row-bg"),WPTB_Helper.wpColorPickerClear("wptb-odd-row-bg"),document.getElementById("wptb-table-cell-slider").value=15,document.getElementById("wptb-table-cell-number").value=15},wpColorPickerClear:function(e){var t=document.getElementById(e),a=WPTB_Helper.findAncestor(t,"wp-picker-container"),n=a.parentNode;n.removeChild(a);var l=document.createElement("input");l.setAttribute("id",e),l.value="",n.appendChild(l)},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}},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="inline-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(),i.src=attachment.url}),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<10&&columnsInput.value++},rowsDecrementButton.onclick=function(){1<rowsInput.value&&rowsInput.value--},rowsIncrementButton.onclick=function(){rowsInput.value<10&&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)}},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"}function c(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)}}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()},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=""}}}),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()},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=""}}}),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()},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=""}}),e=r,t=document.getElementById("wptb-adaptive-table-checkbox"),e&&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())}},clear:function(){var e=r.getElementsByTagName("td");r.style.borderColor="";for(var t=0;t<e.length;t++)e[t].style.borderColor=""}}),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))}}}}(),c(document.getElementById("wptb-table-border-number"),1,50),c(document.getElementById("wptb-table-inner-border-number"),1,50),c(document.getElementById("wptb-table-cell-number"),1,50),c(document.getElementById("wptb-text-font-size-number"),1,50),c(document.getElementById("wptb-image-width-number"),2,100),c(document.getElementById("wptb-table-column-width-number"),2,500),c(document.getElementById("wptb-table-row-height-number"),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-number").onchange=function(){document.getElementById("wptb-table-cell-slider").value=this.value,s(this.value),r.tdDefaultWidth()},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-number").onchange=function(){document.getElementById("wptb-table-border-slider").value=this.value,d(this.value),r.tdDefaultWidth()},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-number").onchange=function(){document.getElementById("wptb-table-inner-border-slider").value=this.value,i(this.value),r.tdDefaultWidth()},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":""}},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-number").onchange=function(){document.getElementById("wptb-table-column-width-slider").value=this.value,r.addColumnWidth(this.value)},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}},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-number").onchange=function(){document.getElementById("wptb-table-row-height-slider").value=this.value,r.addRowHeight(this.value)},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}},document.getElementById("wptb-adaptive-table-checkbox").onchange=function(){this.checked?r.dataset.wptbAdaptiveTable=1:r.dataset.wptbAdaptiveTable=0},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)};for(var p=0;p<l.length;p++)l[p].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].addEventListener("click",function(e){if(!(e.target.classList.contains("wptb-ph-element")||WPTB_Helper.findAncestor(e.target,"wptb-ph-element")||e.target.classList.contains("wptb-fixed-toolbar")||WPTB_Helper.findAncestor(e.target,"wptb-fixed-toolbar"))){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 t=document.getElementById("wpcd_fixed_toolbar");t.hasAttribute("data-toolbar-active-id")&&document.getElementById(t.getAttribute("data-toolbar-active-id")).classList.remove("toolbar-active")}},!1)},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_BorderMarkerActionsField;t.addActionField(2,l),t.setParameters(l)},l.onmouseleave=function(e){return(new WPTB_BorderMarkerActionsField).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-border-marker");(e||t)&&(e.style.display="none",t.style.display="none")};var a=document.getElementsByClassName("wptb-popup-window-modal")[0];document.getElementsByClassName("wptb-embed-btn")[0].onclick=function(){this.classList.contains("wptb-button-disable")||a.classList.add("wptb-popup-show")},document.getElementsByClassName("wptb-popup-dark-area")[0].onclick=function(){a.classList.remove("wptb-popup-show")},document.getElementsByClassName("wptb-popup-window-close-icon")[0].onclick=function(){a.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(){var e=document.querySelector(".wptb-edit-bar");e&&e.classList.contains("visible")&&document.getElementsByClassName("wptb-preview-table")[0].toggleTableEditMode();var l=new XMLHttpRequest,t=(wptb_admin_object?wptb_admin_object.ajaxurl:ajaxurl)+"?action=save_table",r=document.getElementById("wptb-setup-name").value.trim(),o=void 0,a=document.getElementsByClassName("wptb-preview-table");if(a=0<a.length?(a=WPTB_Stringifier(a[0])).outerHTML:"",""===r||""===a){var n="";return""===r&&(n+="You must assign a name to the table before saving it.</br>"),""===a&&(n+="Table wasn't created"),(o=document.getElementById("wptb-messaging-area")).innerHTML='<div class="wptb-error wptb-message">Error: '+n+"</div>",o.classList.add("wptb-warning"),void setTimeout(function(){o.removeChild(o.firstChild)},4e3)}var i={title:r,content:a,security_code:wptb_admin_object.security_code};((rs=WPTB_Helper.detectMode())||(rs=document.wptbId))&&(i.id=rs),i=JSON.stringify(i),l.open("POST",t,!0),l.setRequestHeader("Content-type","application/json; charset=utf-8"),l.onreadystatechange=function(e){if(4==this.readyState&&200==this.status){var t=JSON.parse(l.responseText);if(o=document.getElementById("wptb-messaging-area"),"saved"==t[0]){document.wptbId=t[1],o.innerHTML='<div class="wptb-success wptb-message">Table "'+r+'" 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"edited"==t[0]?o.innerHTML='<div class="wptb-success wptb-message">Table "'+r+'" was successfully updated.</div>':o.innerHTML='<div class="wptb-error wptb-message">Safety problems</div>';o.classList.add("wptb-success"),setTimeout(function(){o.removeChild(o.firstChild)},4e3)}},l.send(i)}},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},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"),h=w.length;0<h&&w[0]&&w[0].parentNode;)w[0].parentNode.removeChild(w[0]),h--}if(a[n].hasAttribute("data-wptb-title-column")){var y=document.createElement("div"),v=document.createElement("div");y.classList.add("wptb-column-title-mobile-container"),v.classList.add("wptb-column-title-mobile"),v.dataset.wptbTitleColumn=a[n].dataset.wptbTitleColumn,v.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+";"),v.style.padding=a[n].style.padding,0==a[n].children.length&&a[n].classList.add("wptb-column-title-mobile-not-elements"),y.appendChild(v),a[n].insertBefore(y,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 _,a,n,h,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=T(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"),h=u.style.width;if(h)b.value=parseFloat(h,10),g.value=parseFloat(h,10),w.checked=!0;else if(u.dataset.wptbFixedWidth)b.value=u.dataset.wptbFixedWidth,g.value=u.dataset.wptbFixedWidth,w.checked=!0;else{var y=WPTB_Helper.getColumnWidth(_,u);b.value=y,g.value=y,w.checked=!1}var v=document.getElementById("wptb-table-row-height-slider"),f=document.getElementById("wptb-table-row-height-number"),B=document.getElementById("wptb-table-row-height-auto-fixed"),E=u.style.height;if(E)v.value=parseFloat(E,10),f.value=parseFloat(E,10),B.checked=!0;else if(u.dataset.wptbFixedHeight)v.value=u.dataset.wptbFixedHeight,f.value=u.dataset.wptbFixedHeight,B.checked=!0;else{var C=WPTB_Helper.getRowHeight(_,u);v.value=C,f.value=C,B.checked=!1}}i.classList.add("visible")}else{for(p=0;p<o.length;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")}}},E=function(e){for(var t=0;t<e.length;t++){for(var a=0;a<e[t].length;a++)" "+e[t][a];"\n"}_.isSquare(e)},C=function(){for(var e=document.getElementsByClassName("wptb-no-cell-action"),t=document.getElementsByClassName("wptb-single-action"),a=document.getElementsByClassName("wptb-multiple-select-action"),n=_.getElementsByClassName("wptb-highlighted");n.length;)n[0].classList.remove("wptb-highlighted");for(var l=0;l<array.length;l++)for(var r=0;r<array[l].length;r++)array[l][r]=0;for(l=0;l<a.length;l++)a[l].classList.remove("visible"),a[l].setAttribute("disabled","disabled");for(l=0;l<e.length;l++)e[l].classList.add("visible"),e[l].removeAttribute("disabled");for(l=0;l<t.length;l++)t[l].classList.remove("visible"),t[l].setAttribute("disabled","disabled")},T=function(e){for(var t=[],a=0;a<h;a++)t[a]=0;for(a=0;a<_.rows.length;a++)for(var n=_.rows[a].getElementsByTagName("td"),l=cellPointer=0;l<h;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");(_=document.createElement("table")).classList.add("wptb-preview-table"),_.dataset.reconstraction=1,_.dataset.wptbAdaptiveTable=1;for(r=0;r<t;r++){(a=_.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=(_=o[0]).getElementsByTagName("td");if(0<i.length)for(var s=0;s<i.length;s++)WPTB_Cell(B,i[s])}}_.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.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.classList.add("wptb-preview-table-manage-cells")},_.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},_.addColumnWidth=function(m,u){var e=_.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=_.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)}_.tdDefaultWidth()}},_.tdDefaultWidth=function(){for(var e,t=_.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 h=b.getPropertyValue("border-left-width"),y=b.getPropertyValue("border-right-width");s=parseFloat(h,10)+parseFloat(y,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 v=0;v<r.length;v++)r[v]&&(a+=r[v]);for(var f=0,B=0;B<o.length;B++)o[B]&&(n+=o[B],f++);var E=window.getComputedStyle(_,null),C=E.getPropertyValue("border-left-width"),T=E.getPropertyValue("border-right-width"),x=parseFloat(C,10)+parseFloat(T,10);e=a+n+x,_.dataset.wptbTableTdsSumMaxWidth=e,f?(_.dataset.wptbCellsWidthAutoCount=f,_.mergingСellsHorizontally?_.dataset.wptbFixedWidthSize=a-x:_.removeAttribute("data-wptb-fixed-width-size")):(_.removeAttribute("data-wptb-fixed-width-size"),_.removeAttribute("data-wptb-cells-width-auto-count"));var I=!1,k=void 0;e<l?f?(_.style.minWidth="100%",_.mergingСellsHorizontally?(k=(k=(l-a-x)/f)-i-s,I=!(_.style.width=null)):_.style.width="100%"):(_.style.width=null,_.style.minWidth=null,_.style.maxWidth=e+"px"):(_.style.maxWidth=null,_.style.minWidth=e+"px",k="100",I=!(_.style.width=null));var N=document.head;if(N){var S=N.querySelector('style[data-wptb-td-auto-width="true"]');S&&N.removeChild(S)}I&&((d=document.createElement("style")).setAttribute("data-wptb-td-auto-width",!0),d.innerHTML="[data-wptb-css-td-auto-width=true]{width:"+k+"px}",N&&N.appendChild(d))},_.addRowHeight=function(m,u){var e=_.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=_.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)}},_.reconstraction=function(){var e=_.getElementsByTagName("td"),t=document.getElementsByClassName("wptb-adaptive-table-chose-block");0<t.length&&(t=t[0]),_.mergingСellsHorizontally=!1,_.mergingCellsVertically=!1,_.dataset.reconstraction=1,t.style.display="block";for(var a=0,n=0;n<e.length&&(1<e[n].colSpan&&(_.dataset.reconstraction=0,t.style.display="none",_.mergingСellsHorizontally=!0,a++),1<e[n].rowSpan&&(_.dataset.reconstraction=0,t.style.display="none",_.mergingCellsVertically=!0,a++),2!=a);n++);},_.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<_.rows.length;l++)e=new WPTB_Cell(B),n&&(e.getDOMElement().setAttribute("style",n),e.getDOMElement().style.width=null),_.rows[l].appendChild(e.getDOMElement()),array[l].push(0);h++,_.recalculateIndexes(),_.tdDefaultWidth(),_.addRowHeight(),WPTB_Helper.dataTitleColumnSet(_),C()},_.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<_.rows.length;r++)e=new WPTB_Cell(B),l&&(e.getDOMElement().setAttribute("style",l),e.getDOMElement().style.width=null),(t=_.rows[r].getElementsByTagName("td")[0])?_.rows[r].insertBefore(e.getDOMElement(),t):_.rows[r].appendChild(e.getDOMElement()),array[r].push(0);h++,_.recalculateIndexes(),_.tdDefaultWidth(),_.addRowHeight(),WPTB_Helper.dataTitleColumnSet(_),C()},_.addColumnAfter=function(e){var t=_.rows,a=void 0,n=void 0,l=document.querySelector(".wptb-highlighted"),r=l.getAttribute("style"),o=null!=e&&"number"==typeof e?e:T(l)[1];if(h-o-l.colSpan+1==1)_.addColumnEnd();else{for(var i=!1,s=void 0,d=void 0,c=void 0,p=[],m=void 0,u=0;u<h;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<h;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<h;w++)0<p[w]&&p[w]--}for(u=0;u<array.length;u++)array[u].push(0);h++,E(array),_.recalculateIndexes(),_.addColumnWidth(),_.addRowHeight(),WPTB_Helper.dataTitleColumnSet(_),C()}},_.addColumnBefore=function(){var e=document.querySelector(".wptb-highlighted"),t=T(e)[1];0===t?_.addColumnStart():_.addColumnAfter(t-1)},_.addRowToTheEnd=function(){var e,t=_.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<h;o++)a=new WPTB_Cell(B),r&&a.getDOMElement().setAttribute("style",r),t.appendChild(a.getDOMElement());e=Array.from(array[0]),array.push(e),E(array),_.recalculateIndexes(),_.addColumnWidth(),WPTB_Helper.dataTitleColumnSet(_),C()},_.addRowToTheStart=function(){var e,t=_.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<h;o++)a=new WPTB_Cell(B),r&&a.getDOMElement().setAttribute("style",r),t.appendChild(a.getDOMElement());e=Array.from(array[0]),array.push(e),E(array),_.recalculateIndexes(),_.addColumnWidth(),WPTB_Helper.dataTitleColumnSet(_),C()},_.addRowBefore=function(){for(var e=document.querySelector(".wptb-highlighted"),t=e.getAttribute("style"),a=T(e)[0],n=void 0,l=a-1;0<=l;l--){var r=_.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?_.addRowToTheStart():_.addRowAfter(a,t)},_.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=T(l)[0])+l.rowSpan-1}var r=0;if(n<_.rows.length-1){for(var o=0;o<=n;o++){var i=_.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=_.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=_.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),E(array),_.recalculateIndexes(),_.addColumnWidth(),WPTB_Helper.dataTitleColumnSet(_),C()},_.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]},_.mergeCells=function(){for(var e=_.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,_.recalculateIndexes(),_.reconstraction();var p=n.style.width,m=n.dataset.wptbFixedWidth;p?_.addColumnWidth(parseFloat(p,10)):m?_.addColumnWidth():_.addColumnWidth(!1,!0);var u=n.style.height,b=n.dataset.wptbFixedHeight;u?_.addRowHeight(parseFloat(u,10)):b?_.addRowHeight():_.addRowHeight(!1,!0),WPTB_Helper.dataTitleColumnSet(_),C()},_.splitCell=function(){var e=document.getElementsByClassName("wptb-highlighted")[0],t=e.rowSpan,a=e.colSpan,n=e.getAttribute("style"),l=T(e)[0],r=_.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=_.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())}}_.recalculateIndexes(),_.reconstraction(),_.addColumnWidth(),_.addRowHeight(),WPTB_Helper.dataTitleColumnSet(_),C();var h=document.getElementById("wptb-left-scroll-panel-cell-settings");h&&h.classList.remove("visible")},_.findRowspannedCells=function(e){var t,a=[];if(actualPoints=function(e){for(var t=_.rows[e].getElementsByTagName("td"),a=0,n=0;n<t.length;n++)a+=t[n].colSpan;return a}(e),actualPoints===h)return[];t=h-actualPoints;for(var n=e-1;0<=n&&t;n--){var l=_.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},_.addLackingCells=function(){for(var e=[],t=0;t<_.rows.length;t++)e.push(0);for(t=0;t<_.rows.length;t++)for(var a=_.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<_.rows.length;t++){a=_.rows[t].getElementsByTagName("td");var r=0;for(n=0;n<a.length;n++)r+=a[n].colSpan;r+=e[t],difference=h-r;for(n=0;n<difference;n++){var o=new WPTB_Cell(B);_.rows[t].appendChild(o.getDOMElement())}}},_.deleteRow=function(){var e=document.querySelector(".wptb-highlighted"),t=e.getAttribute("style"),a=e.rowSpan,n=T(e)[0],l=void 0;null==a&&(a=1);for(var r=0;r<a;r++){var o=_.rows[n].children,i=_.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=_.rows;if(0<w.length)for(var h=0;h<n;h++){var y=w[h].children;if(0<y.length)for(var v=0;v<y.length;v++)y[v].rowSpan-1>=n-h&&y[v].rowSpan--}l=Array.from(array[0]),array.pop(l),E(array),_.getElementsByTagName("tbody")[0].removeChild(_.rows[n]),0==_.rows.length&&(_.toggleTableEditMode(),f.innerHTML="",WPTB_Helper.settingsPanelClear(),document.getElementsByClassName("wptb-table-generator")[0].style.display="table"),_.recalculateIndexes(),WPTB_Helper.dataTitleColumnSet(_)}C()},_.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<_.rows.length;l++){var r=_.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--:_.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<_.rows.length;s++)null!=array[s]&&array[s].pop();h--,0==_.querySelectorAll("td").length&&(_.toggleTableEditMode(),f.innerHTML="",WPTB_Helper.settingsPanelClear(),document.getElementsByClassName("wptb-table-generator")[0].style.display="table"),_.recalculateIndexes(),_.tdDefaultWidth(),WPTB_Helper.dataTitleColumnSet(_)}C()},document.getElementsByClassName("wptb-table-generator")[0].style.display="none",array=function(){for(var e=[],t=[],a=0;a<_.rows.length;a++){for(var n=_.rows[a].getElementsByTagName("td"),l=0,r=0;r<n.length;r++)l+=n[r].colSpan;e.push(l)}h=Math.max.apply(null,e);var o=_.rows.length;for(a=0;a<o;a++)for(t[a]=[],r=0;r<h;r++)t[a].push(0);return E(t),t}(),C(),E(array),f.appendChild(_),_.recalculateIndexes(!0),_.reconstraction(),_.tdDefaultWidth(),f.onresize=function(){_.tdDefaultWidth()},WPTB_LeftPanel()},WPTB_TableStateSaving=function(){var e=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,t=document.querySelector(".wptb-preview-table");new e(function(e){e.forEach(function(e){})}).observe(t,{attributes:!0,childList:!0,characterData:!0,subtree:!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)}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 p(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){var t=void 0,a=void 0;if(e.preventDefault(),e.stopPropagation(),e.dataTransfer.getData("wptbElement")||e.dataTransfer.getData("node")){var n,l=void 0,r=new WPTB_BorderMarkerActionsField;if(0<document.getElementsByClassName("wptb-drop-handle").length&&(l=document.getElementsByClassName("wptb-drop-handle")[0]),e.dataTransfer.getData("wptbElement")?t=(t="list"==(n=e.dataTransfer.getData("wptbElement"))?new WPTB_List:"image"==n?new WPTB_Image:"text"==n?new WPTB_Text:"button"==n?new WPTB_Button:void 0).getDOMElement():(a=e.dataTransfer.getData("node"),(t=document.getElementsByClassName(a)[0]).classList.remove("wptb-moving-mode"),l.classList.remove("wptb-moving-into-same-elem"),r.wptbBorderMarker.classList.remove("wptb-moving-into-same-elem")),t.classList.remove("wptb-ondragenter"),"block"==l.style.display){var o=void 0;if("Drop Here"==l.dataset.text)(o=l.getDOMParentElement()).appendChild(t);else{var i=l.getDOMParentElement();if(o=i.parentNode,"Above Element"==l.dataset.text)o.insertBefore(t,i);else if("Below Element"==l.dataset.text){var s=i.nextSibling;o.insertBefore(t,s)}}var d=o.parentNode;if(d.classList.contains("wptb-table-head")){var c=WPTB_Helper.findAncestor(d,"wptb-preview-table");WPTB_Helper.dataTitleColumnSet(c)}return l.style.display="none",r.borderMarkerHide(),p(t),!0}}},t.mouseenter=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 e&&!a&&(t=e.split("-")[1]);i.onmouseenter=function(e){var t=new WPTB_BorderMarkerActionsField;if(t.addActionField(1,i),t.setParameters(this),"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,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){new WPTB_BorderMarkerActionsField(1,i).setParameters(i)}),e.on("keyup",function(e){new WPTB_BorderMarkerActionsField(1,i).setParameters(i)})},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{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_BorderMarkerActionsField;t.wptbActions&&"1"!=t.wptbActions.type||t.leaveFromField(e,i,1)};var p=document.getElementsByClassName("wptb-actions");if(0<p.length&&(p=p[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"]})}var m=i.className.match(/wptb-element-(.+)-(\d+)/i);m&&i.classList.remove(m[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)};
inc/admin/js/core/WPTB_ActionsField.js ADDED
@@ -0,0 +1,357 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var WPTB_ActionsField = function() {
2
+ //this.wptbBorderMarker;
3
+ this.wptbActions;
4
+ if( document.getElementsByClassName( 'wptb-actions' ).length != 0 ) {
5
+ this.wptbActions = document.getElementsByClassName( 'wptb-actions' )[0];
6
+ }
7
+
8
+ this.addActionField = ( actionType, thisNode ) => {
9
+ let body = document.getElementsByTagName( 'body' )[0];
10
+
11
+ let actions = document.getElementsByClassName( 'wptb-actions' );
12
+ if( actions.length != 0 ) {
13
+ let previousNode = actions[0].activeElem;
14
+ if( previousNode ) {
15
+ previousNode.classList.remove( 'wptb-directlyhovered' );
16
+ }
17
+
18
+ while( actions.length != 0 ) {
19
+ actions[0].parentNode.removeChild( actions[0] );
20
+ }
21
+ }
22
+
23
+ if( actionType == 1 ) {
24
+
25
+ let btnDelete, btnCopy, btnMove;
26
+
27
+ btnDelete = document.createElement( 'span' ),
28
+ btnCopy = document.createElement( 'span' ),
29
+ btnMove = document.createElement( 'span' ),
30
+ actions = document.createElement( 'div' );
31
+
32
+ actions.classList.add( 'wptb-actions' );
33
+ btnDelete.classList.add( 'dashicons', 'dashicons-trash', 'wptb-delete-action' );
34
+ btnCopy.classList.add( 'dashicons', 'dashicons-admin-page', 'wptb-duplicate-action' );
35
+ btnMove.classList.add( "dashicons", "dashicons-move", 'wptb-move-action' );
36
+ btnMove.draggable = true;
37
+
38
+ actions.appendChild( btnMove );
39
+ actions.appendChild( btnCopy );
40
+ actions.appendChild( btnDelete );
41
+ body.appendChild( actions );
42
+
43
+ actions.activeElem = thisNode;
44
+
45
+ actions.type = 1;
46
+
47
+ btnDelete.onclick = function( event ) {
48
+ let act = event.target.parentNode.activeElem,
49
+ el = act.parentNode;
50
+ el.removeChild(act);
51
+
52
+ if( act.kind == 'text' ) {
53
+ let thisRow = el.parentNode
54
+ if( thisRow.classList.contains( 'wptb-table-head' ) ) {
55
+ let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );
56
+ WPTB_Helper.dataTitleColumnSet( table );
57
+ }
58
+ }
59
+
60
+ let wptbActionsField = new WPTB_ActionsField();
61
+
62
+ wptbActionsField.actionsRemove();
63
+ let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
64
+ wptbTableStateSaveManager.tableStateSet();
65
+ };
66
+
67
+
68
+
69
+ btnCopy.onclick = ( event ) => {
70
+ let copy,
71
+ infArr,
72
+ type;
73
+ let activeElement = event.target.parentNode.activeElem;
74
+ let activeElementClone = activeElement.cloneNode( true );
75
+ activeElementClone.classList.remove( 'wptb-directlyhovered' );
76
+ infArr = activeElement.className.match(/wptb-element-(.+)-(\d+)/i);
77
+ type = infArr[1];
78
+ let td = activeElement.parentNode;
79
+ if ( type == 'list' ) {
80
+ var temp = [],
81
+ srcList = activeElement.querySelectorAll('ul li .wptb-list-item-content');
82
+
83
+ for (var i = 0; i < srcList.length; i++) {
84
+ temp.push(srcList[i].innerHTML);
85
+ }
86
+
87
+ copy = new WPTB_List( temp, activeElementClone );
88
+
89
+ td.insertBefore( copy.getDOMElement(), activeElement.nextSibling );
90
+ } else if ( type == 'text' ) {
91
+ copy = new WPTB_Text( activeElementClone.childNodes[0].innerHTML, activeElementClone );
92
+
93
+ td.insertBefore( copy.getDOMElement(), activeElement.nextSibling );
94
+ } else if ( type == 'image' ) {
95
+ copy = new WPTB_Image( '', activeElement );
96
+
97
+ td.insertBefore( copy.getDOMElement(), activeElement.nextSibling );
98
+ } else {
99
+ let text = activeElementClone.childNodes[0].querySelector( 'p' ).innerHTML;
100
+
101
+ copy = new WPTB_Button( text, activeElementClone );
102
+
103
+ td.insertBefore( copy.getDOMElement(), activeElement.nextSibling );
104
+ }
105
+
106
+ WPTB_innerElementSet( copy.getDOMElement() );
107
+
108
+ let wptbActionsField = new WPTB_ActionsField( 1, activeElement );
109
+
110
+ wptbActionsField.setParameters( activeElement );
111
+
112
+ let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
113
+ wptbTableStateSaveManager.tableStateSet();
114
+ };
115
+
116
+ btnMove.ondragstart = ( event ) => {
117
+ let dragImagesArr = WPTB_Helper.dragImagesArr(),
118
+ actions = event.target.parentNode,
119
+ activeElem = actions.activeElem,
120
+ infArr,
121
+ type;
122
+ infArr = activeElem.className.match(/wptb-element-(.+)-(\d+)/i);
123
+ type = infArr[1];
124
+ activeElem.classList.add( 'wptb-moving-mode' );
125
+
126
+ event.dataTransfer.effectAllowed = 'move';
127
+ event.dataTransfer.setDragImage( dragImagesArr[type], 0, 0 );
128
+ event.dataTransfer.setData( 'node', 'wptb-element-' + infArr[1] + '-' + infArr[2] );
129
+ event.dataTransfer.setData( 'wptb-moving-mode', 'wptb-element-' + infArr[1] + '-' + infArr[2] );
130
+ event.dataTransfer.setData( 'wptbElIndic-' + infArr[1], 'wptbElIndic-' + infArr[1] );
131
+ let act = event.target.parentNode.activeElem;
132
+ if( act.kind == 'text' ) {
133
+ let thisRow = act.parentNode.parentNode;
134
+ if( thisRow.classList.contains( 'wptb-table-head' ) ) {
135
+ let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );
136
+ WPTB_Helper.dataTitleColumnSet( table );
137
+ }
138
+ }
139
+ //actions.style.display = 'none';
140
+ this.actionsHide();
141
+ };
142
+
143
+ //actions.style.right = '-' + parseFloat( thisNode.offsetWidth ) + 'px';
144
+ actions.style.display = 'block';
145
+
146
+ this.wptbActions = actions;
147
+ } else if( actionType == 2 ) {
148
+ let btnDelete,
149
+ btnCopy,
150
+ previous,
151
+ i;
152
+
153
+ btnDelete = document.createElement('span'),
154
+ btnCopy = document.createElement('span'),
155
+ actions = document.createElement('span')
156
+
157
+ actions.classList.add('wptb-actions');
158
+ btnDelete.classList.add('dashicons', 'dashicons-trash', 'wptb-delete-action');
159
+ btnCopy.classList.add('dashicons', 'dashicons-admin-page', 'wptb-duplicate-action');
160
+
161
+ actions.append( btnCopy, btnDelete );
162
+ body.appendChild( actions );
163
+
164
+ actions.activeElem = thisNode;
165
+
166
+ let wptbDirectlyhovered = WPTB_Helper.findAncestor( thisNode, 'wptb-directlyhovered' );
167
+ if( wptbDirectlyhovered ) {
168
+ wptbDirectlyhovered.classList.remove( 'wptb-directlyhovered' );
169
+ }
170
+
171
+ actions.type = 2;
172
+
173
+ btnDelete.onclick = ( event ) => {
174
+ var action = event.target.parentNode,
175
+ item = action.activeElem,
176
+ parent = item.parentNode;
177
+ let wptbActionsField = new WPTB_ActionsField( 4 );
178
+ wptbActionsField.actionsRemove();
179
+ parent.removeChild( item );
180
+ WPTB_Helper.listItemsRecalculateIndex( parent );
181
+
182
+ let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
183
+ wptbTableStateSaveManager.tableStateSet();
184
+ };
185
+
186
+ btnCopy.onclick = ( event ) => {
187
+ let coordinatesElement = thisNode.getBoundingClientRect();
188
+ let coordinatesElementTopBegin = coordinatesElement.top;
189
+
190
+ var listItem = event.target.parentNode.activeElem,
191
+ content = listItem.querySelector( '.wptb-list-item-content' ),
192
+ html = content.innerHTML;
193
+ var duplicate = new WPTB_ListItem( html, listItem, true );
194
+ listItem.parentNode.insertBefore( duplicate.getDOMElement(), thisNode.nextSibling );
195
+ WPTB_Helper.listItemsTinyMceInit( duplicate.getDOMElement().firstChild );
196
+
197
+ let divcontent = thisNode.getElementsByClassName( 'wptb-list-item-content' );
198
+ if( divcontent.length > 0 ) {
199
+ divcontent = divcontent[0];
200
+ }
201
+ setTimeout( function(){
202
+ divcontent.innerHTML = html;
203
+ WPTB_Helper.listItemsRecalculateIndex( listItem.parentNode );
204
+ }, 5 );
205
+
206
+ coordinatesElement = thisNode.getBoundingClientRect();
207
+ let coordinatesElementTopEnd = coordinatesElement.top;
208
+
209
+ if( coordinatesElementTopBegin != coordinatesElementTopEnd ) {
210
+ let wptbActionsField = new WPTB_ActionsField( 2, thisNode );
211
+ wptbActionsField.setParameters( thisNode );
212
+ }
213
+
214
+ let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
215
+ wptbTableStateSaveManager.tableStateSet();
216
+ };
217
+
218
+ actions.style.display = 'block';
219
+
220
+ this.wptbActions = actions;
221
+ }
222
+ }
223
+
224
+ this.setParameters = ( thisNode ) => {
225
+ if( ! this.wptbActions ) {
226
+ let actions = document.getElementsByClassName( 'wptb-actions' );
227
+ if( actions.length > 0 ) {
228
+ this.wptbActions = actions[0];
229
+ }
230
+ }
231
+
232
+ if( this.wptbActions ) {
233
+ this.wptbActions.style.display = 'block';
234
+ }
235
+
236
+ let coordinatesElement = thisNode.getBoundingClientRect();
237
+
238
+ let wptbContainer = document.getElementsByClassName( 'wptb-container' )[0];
239
+ let correctTop = () => {
240
+ let coordinatesElement = thisNode.getBoundingClientRect();
241
+ this.wptbActions.style.top = parseFloat( coordinatesElement.top ) - 15 + 'px';
242
+ }
243
+ wptbContainer.removeEventListener( 'scroll', correctTop, false );
244
+
245
+ this.wptbActions.style.top = parseFloat( coordinatesElement.top ) - 15 + 'px';
246
+ this.wptbActions.style.left = ( parseFloat( coordinatesElement.right ) - parseFloat( this.wptbActions.clientWidth ) ) + 1 + 'px';
247
+
248
+ // let wptbBorderMarkerTop = this.wptbBorderMarker.querySelector( '.wptb-border-marker-top' );
249
+ // wptbBorderMarkerTop.style.width = ( parseFloat( thisNode.offsetWidth ) + 3 ) + 'px';
250
+ //
251
+ // let wptbBorderMarkerRight = this.wptbBorderMarker.querySelector( '.wptb-border-marker-right' );
252
+ // wptbBorderMarkerRight.style.height = ( parseFloat( coordinatesElement.bottom ) - parseFloat( coordinatesElement.top ) + 4 ) + 'px';
253
+ // wptbBorderMarkerRight.style.left = ( parseFloat( thisNode.offsetWidth ) + 3 ) + 'px';
254
+ //
255
+ // let wptbBorderMarkerBottom = this.wptbBorderMarker.querySelector( '.wptb-border-marker-bottom' );
256
+ // wptbBorderMarkerBottom.style.width = wptbBorderMarkerTop.style.width;
257
+ // wptbBorderMarkerBottom.style.top = ( parseFloat( coordinatesElement.bottom ) - parseFloat( coordinatesElement.top ) + 3 ) + 'px';;
258
+ //
259
+ // let wptbBorderMarkerLeft = this.wptbBorderMarker.querySelector( '.wptb-border-marker-left' );
260
+ //
261
+
262
+ //this.wptbBorderMarker.style.display = 'block';
263
+ this.wptbActions.style.display = 'block';
264
+ thisNode.classList.add( 'wptb-directlyhovered' );
265
+
266
+ wptbContainer.addEventListener( 'scroll', correctTop, false );
267
+ }
268
+
269
+ // if( actionType == 1 || actionType == 2 ) {
270
+ // this.setParameters( thisNode );
271
+ // }
272
+ // } else {
273
+ // this.wptbActions.style.display = 'block';
274
+ // thisNode.classList.add( 'wptb-directlyhovered' );
275
+ // }
276
+
277
+ this.leaveFromField = ( event, node, actionType ) => {
278
+ if( event.relatedTarget ) {
279
+ if ( event.relatedTarget.classList.contains( 'wptb-actions' ) ||
280
+ event.relatedTarget.classList.contains( 'wptb-move-action' ) ||
281
+ event.relatedTarget.classList.contains( 'wptb-duplicate-action' ) ||
282
+ event.relatedTarget.classList.contains( 'wptb-delete-action' ) ) {
283
+ if( ! this.wptbActions ) {
284
+ this.wptbActions = document.getElementsByClassName( 'wptb-actions' )[0];
285
+ }
286
+ this.wptbActions.onmouseleave = ( event ) => {
287
+ if( event.relatedTarget != null && event.relatedTarget != this.wptbActions.activeElem &&
288
+ WPTB_Helper.findAncestor( event.relatedTarget, 'wptb-directlyhovered') != this.wptbActions.activeElem ) {
289
+ event.target.activeElem.classList.remove( 'wptb-directlyhovered' );
290
+ this.wptbActions.style.display = 'none';
291
+
292
+ if( this.wptbActions.type == 2 ) {
293
+ let wptbActionsField = new WPTB_ActionsField();
294
+
295
+ wptbActionsField.addActionField( 1, event.relatedTarget.parentNode.parentNode );
296
+
297
+ wptbActionsField.setParameters( event.relatedTarget.parentNode.parentNode );
298
+ }
299
+ } else {
300
+ return;
301
+ }
302
+ }
303
+
304
+ return;
305
+ }
306
+ // else if( event.relatedTarget.classList.contains( 'wptb-drop-handle' ) ) {
307
+ // let wptbDropHandle = document.getElementsByClassName( 'wptb-drop-handle' );
308
+ // if( wptbDropHandle.length > 0 ) {
309
+ // wptbDropHandle = wptbDropHandle[0];
310
+ // wptbDropHandle.onmouseleave
311
+ // }
312
+ // }
313
+ }
314
+
315
+ node.classList.remove( 'wptb-directlyhovered' );
316
+ this.wptbActions.style.display = 'none';
317
+
318
+ if( this.wptbActions.type == 2 ) {
319
+ if( event.relatedTarget ) {
320
+ if( event.relatedTarget.localName == 'ul' ) {
321
+ //let wptbActionsField = new WPTB_ActionsField();
322
+
323
+ this.addActionField( 1, event.relatedTarget.parentNode );
324
+
325
+ this.setParameters( event.relatedTarget.parentNode );
326
+ }
327
+ }
328
+
329
+ }
330
+ }
331
+
332
+ this.actionsRemove = () => {
333
+ if( ! this.wptbActions ) {
334
+ let actions = document.getElementsByClassName( 'wptb-actions' );
335
+ if( actions.length > 0 ) {
336
+ this.wptbActions = actions[0];
337
+ }
338
+ }
339
+
340
+ if( this.wptbActions ) {
341
+ this.wptbActions.parentNode.removeChild( this.wptbActions );
342
+ }
343
+ }
344
+
345
+ this.actionsHide = () => {
346
+ if( ! this.wptbActions ) {
347
+ let actions = document.getElementsByClassName( 'wptb-actions' );
348
+ if( actions.length > 0 ) {
349
+ this.wptbActions = actions[0];
350
+ }
351
+ }
352
+
353
+ if( this.wptbActions ) {
354
+ this.wptbActions.style.opacity = 0;
355
+ }
356
+ }
357
+ }
inc/admin/js/core/WPTB_Builder.js CHANGED
@@ -18,6 +18,9 @@
18
  WPTB_Table();
19
  WPTB_LeftPanel();
20
  WPTB_Settings();
 
 
 
21
  } else {
22
  document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';
23
  }
18
  WPTB_Table();
19
  WPTB_LeftPanel();
20
  WPTB_Settings();
21
+
22
+ let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
23
+ wptbTableStateSaveManager.tableStateSet();
24
  } else {
25
  document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';
26
  }
inc/admin/js/core/WPTB_Button.js CHANGED
@@ -4,13 +4,14 @@ var WPTB_Button = function( text, DOMElementProt ) {
4
  elButton = document.createElement('div'),
5
  el_B = document.createElement('a'),
6
  el_BDiv = document.createElement( 'div' ),
 
7
  kindIndexProt = undefined,
8
  copy = false;
9
 
10
  DOMElement.classList.add('wptb-button-container', 'wptb-size-M', 'wptb-');
11
  elButton.classList.add('wptb-button-wrapper');
12
  el_BDiv.classList.add('wptb-button');
13
- el_BDiv.innerHTML = text != undefined ? text : 'Button Text';
14
 
15
  // Creation of a new button when copying to avoid errors when assigning new event handlers.
16
  if ( DOMElementProt ) {
@@ -38,9 +39,9 @@ var WPTB_Button = function( text, DOMElementProt ) {
38
  }
39
  }
40
 
41
- var wptbButton = DOMElementProt.querySelector( 'a' );
42
- if ( wptbButton ) {
43
- var wptbButtonAttributes = [...wptbButton.attributes];
44
  if ( wptbButtonAttributes.length > 0 ) {
45
  for( let i = 0; i < wptbButtonAttributes.length; i++ ) {
46
  if ( wptbButtonAttributes[i].name == 'style' ||
@@ -51,10 +52,23 @@ var WPTB_Button = function( text, DOMElementProt ) {
51
  }
52
  }
53
  }
 
 
 
 
 
 
 
 
 
 
 
 
54
  }
55
 
56
  elButton.appendChild(el_B);
57
  el_B.appendChild( el_BDiv );
 
58
  DOMElement.appendChild(elButton);
59
 
60
 
@@ -66,6 +80,6 @@ var WPTB_Button = function( text, DOMElementProt ) {
66
  };
67
 
68
  applyGenericItemSettings( this, kindIndexProt, copy );
69
-
70
  return this;
71
  };
4
  elButton = document.createElement('div'),
5
  el_B = document.createElement('a'),
6
  el_BDiv = document.createElement( 'div' ),
7
+ el_BDivP = document.createElement( 'p' ),
8
  kindIndexProt = undefined,
9
  copy = false;
10
 
11
  DOMElement.classList.add('wptb-button-container', 'wptb-size-M', 'wptb-');
12
  elButton.classList.add('wptb-button-wrapper');
13
  el_BDiv.classList.add('wptb-button');
14
+ el_BDivP.innerHTML = text != undefined ? text : 'Button Text';
15
 
16
  // Creation of a new button when copying to avoid errors when assigning new event handlers.
17
  if ( DOMElementProt ) {
39
  }
40
  }
41
 
42
+ var wptbButtonA = DOMElementProt.querySelector( 'a' );
43
+ if ( wptbButtonA ) {
44
+ var wptbButtonAttributes = [...wptbButtonA.attributes];
45
  if ( wptbButtonAttributes.length > 0 ) {
46
  for( let i = 0; i < wptbButtonAttributes.length; i++ ) {
47
  if ( wptbButtonAttributes[i].name == 'style' ||
52
  }
53
  }
54
  }
55
+
56
+ var wptbButton = DOMElementProt.querySelector( '.wptb-button' );
57
+ if ( wptbButton ) {
58
+ var wptbButtonAttributes = [...wptbButton.attributes];
59
+ if ( wptbButtonAttributes.length > 0 ) {
60
+ for( let i = 0; i < wptbButtonAttributes.length; i++ ) {
61
+ if ( wptbButtonAttributes[i].name == 'style') {
62
+ el_BDiv.setAttribute( wptbButtonAttributes[i].name, wptbButtonAttributes[i].value );
63
+ }
64
+ }
65
+ }
66
+ }
67
  }
68
 
69
  elButton.appendChild(el_B);
70
  el_B.appendChild( el_BDiv );
71
+ el_BDiv.appendChild( el_BDivP );
72
  DOMElement.appendChild(elButton);
73
 
74
 
80
  };
81
 
82
  applyGenericItemSettings( this, kindIndexProt, copy );
83
+
84
  return this;
85
  };
inc/admin/js/core/{WPTB_DropHandle.js → } RENAMED
File without changes