WP Table Builder – WordPress Table Plugin - Version 1.0.8

Version Description

  • NEW: Star Rating Element.
Download this release

Release Info

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

Code changes from version 1.0.7 to 1.0.8

inc/admin/class-tables.php CHANGED
@@ -106,7 +106,7 @@ class Tables {
106
  //$html = json_decode( $html );
107
  $html = '<div class="wptb-table-container"><div class="wptb-table-container-matrix">' . $html . '</div></div>';
108
  $html .= '<script>'
109
- . 'let wptbPreviewTable = document.getElementsByClassName( "wptb-preview-table" );'
110
  . 'if( wptbPreviewTable.length > 0 ) {'
111
  . ' wptbPreviewTable[0].classList.remove( "wptb-table-preview-static-indic" );'
112
  . ' wptbPreviewTable[0].style.display = "none";'
106
  //$html = json_decode( $html );
107
  $html = '<div class="wptb-table-container"><div class="wptb-table-container-matrix">' . $html . '</div></div>';
108
  $html .= '<script>'
109
+ . 'var wptbPreviewTable = document.getElementsByClassName( "wptb-preview-table" );'
110
  . 'if( wptbPreviewTable.length > 0 ) {'
111
  . ' wptbPreviewTable[0].classList.remove( "wptb-table-preview-static-indic" );'
112
  . ' wptbPreviewTable[0].style.display = "none";'
inc/admin/css/admin.css CHANGED
@@ -1924,6 +1924,211 @@ td[class*="wptb-fused-cell"] {
1924
  display: none;
1925
  }
1926
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1927
  @media screen and (max-width: 1375px) {
1928
  #wptb-messaging-area {
1929
  position: relative;
1924
  display: none;
1925
  }
1926
 
1927
+ /* Star Rating */
1928
+ .wptb-star_rating-container {
1929
+ text-align: center;
1930
+ }
1931
+ .wptb-rating-stars-box {
1932
+ text-align: center;
1933
+ display: inline-block;
1934
+ padding: 7px;
1935
+ }
1936
+
1937
+ .wptb-rating-stars-box ul {
1938
+ list-style-type:none;
1939
+ padding:0;
1940
+
1941
+ -moz-user-select:none;
1942
+ -webkit-user-select:none;
1943
+ padding: 0.5em 0.2em 0.2em;
1944
+ }
1945
+
1946
+ .wptb-rating-stars-box ul li {
1947
+ display: inline-block;
1948
+ }
1949
+
1950
+ .wptb-rating-stars-box ul > li.wptb-rating-star {
1951
+ color: #ccc;
1952
+ cursor: pointer;
1953
+ margin: 0px;
1954
+ position: relative;
1955
+ width: 20px;
1956
+ height: 20px;
1957
+ }
1958
+
1959
+ .wptb-rating-stars-box ul > li.wptb-rating-star span {
1960
+ position: absolute;
1961
+ height: 100%;
1962
+ width: 100%;
1963
+ top: 0px;
1964
+ left: 0px;
1965
+ z-index: 10;
1966
+ }
1967
+ .wptb-rating-stars-box ul > li.wptb-rating-star span.wptb-rating-star-left-signal-part,
1968
+ .wptb-rating-stars-box ul > li.wptb-rating-star span.wptb-rating-star-right-signal-part{
1969
+ height: 100%;
1970
+ width: 50%;
1971
+ z-index: 20;
1972
+ }
1973
+
1974
+ .wptb-rating-stars-box ul > li.wptb-rating-star span.wptb-rating-star-left-signal-part {
1975
+ left: 0px;
1976
+ }
1977
+
1978
+ .wptb-rating-stars-box ul > li.wptb-rating-star span.wptb-rating-star-left-signal-part span.wptb-rating-star-zero-set {
1979
+ left: 0px;
1980
+ width: 40%;
1981
+ height: 100%;
1982
+ top: 0px;
1983
+ z-index: 30px;
1984
+ }
1985
+
1986
+ .wptb-rating-stars-box ul > li.wptb-rating-star span.wptb-rating-star-right-signal-part {
1987
+ right: 0px;
1988
+ left: auto;
1989
+ }
1990
+
1991
+ .wptb-rating-stars-box ul > li.wptb-rating-star span {
1992
+ display: block;
1993
+ }
1994
+
1995
+ .wptb-rating-stars-box ul > li.wptb-rating-star span.wptb-filled-rating-star {
1996
+ display: none;
1997
+ }
1998
+
1999
+ .wptb-rating-stars-box ul > li.wptb-rating-star span.wptb-half-filled-rating-star {
2000
+ display: none;
2001
+ }
2002
+
2003
+ .wptb-rating-stars-box ul > li.wptb-rating-star span.wptb-not-filled-rating-star {
2004
+ fill: #ccc;
2005
+ }
2006
+
2007
+
2008
+
2009
+ .wptb-rating-stars-box ul > li.wptb-rating-star.wptb-rating-star-hover-half span.wptb-not-filled-rating-star {
2010
+ display: none;
2011
+ }
2012
+
2013
+ .wptb-rating-stars-box ul > li.wptb-rating-star.wptb-rating-star-hover-half span.wptb-half-filled-rating-star {
2014
+ display: block;
2015
+ fill: #FF912C;
2016
+ opacity: 0.5;
2017
+ }
2018
+
2019
+ .wptb-rating-stars-box ul > li.wptb-rating-star.wptb-rating-star-hover-half span.wptb-filled-rating-star {
2020
+ display: none;
2021
+ }
2022
+
2023
+
2024
+ .wptb-rating-stars-box ul > li.wptb-rating-star.wptb-rating-star-hover-full span.wptb-not-filled-rating-star {
2025
+ display: none;
2026
+ }
2027
+
2028
+ .wptb-rating-stars-box ul > li.wptb-rating-star.wptb-rating-star-hover-full span.wptb-half-filled-rating-star {
2029
+ display: none;
2030
+ }
2031
+
2032
+ .wptb-rating-stars-box ul > li.wptb-rating-star.wptb-rating-star-hover-full span.wptb-filled-rating-star {
2033
+ display: block;
2034
+ fill: #FF912C;
2035
+ opacity: 0.5;
2036
+ }
2037
+
2038
+
2039
+ .wptb-rating-stars-box ul > li.wptb-rating-star.wptb-rating-star-selected-half.wptb-rating-star-hover-half span,
2040
+ .wptb-rating-stars-box ul > li.wptb-rating-star.wptb-rating-star-selected-half.wptb-rating-star-hover-full span,
2041
+ .wptb-rating-stars-box ul > li.wptb-rating-star.wptb-rating-star-selected-full.wptb-rating-star-hover-half span,
2042
+ .wptb-rating-stars-box ul > li.wptb-rating-star.wptb-rating-star-selected-full.wptb-rating-star-hover-full span{
2043
+ opacity: 1;
2044
+ }
2045
+
2046
+
2047
+
2048
+
2049
+
2050
+ .wptb-rating-stars-box ul > li.wptb-rating-star.wptb-rating-star-selected-half span.wptb-filled-rating-star {
2051
+ display: none;
2052
+ }
2053
+
2054
+ .wptb-rating-stars-box ul > li.wptb-rating-star.wptb-rating-star-selected-half.wptb-rating-star-hover-full span.wptb-filled-rating-star {
2055
+ display: block;
2056
+ fill: #FF912C;
2057
+ opacity: 0.5;
2058
+ }
2059
+
2060
+ .wptb-rating-stars-box ul > li.wptb-rating-star.wptb-rating-star-selected-half span.wptb-not-filled-rating-star {
2061
+ display: none;
2062
+ }
2063
+
2064
+ .wptb-rating-stars-box ul > li.wptb-rating-star.wptb-rating-star-selected-half span.wptb-half-filled-rating-star {
2065
+ display: block;
2066
+ fill: #FF912C;
2067
+ }
2068
+
2069
+ .wptb-rating-stars-box ul > li.wptb-rating-star.wptb-rating-star-selected-full span.wptb-filled-rating-star {
2070
+ display: block;
2071
+ fill: #FF912C;
2072
+ }
2073
+
2074
+ .wptb-rating-stars-box ul > li.wptb-rating-star.wptb-rating-star-selected-full span.wptb-not-filled-rating-star {
2075
+ display: none;
2076
+ }
2077
+
2078
+ .wptb-rating-stars-box ul > li.wptb-rating-star.wptb-rating-star-selected-full span.wptb-half-filled-rating-star {
2079
+ display: none;
2080
+ }
2081
+
2082
+
2083
+ /*.wptb-rating-stars-box ul > li.wptb-rating-star.wptb-rating-star-hover {
2084
+ color:#FF912C;
2085
+ opacity: 0.4;
2086
+ }
2087
+
2088
+ .wptb-rating-stars-box ul > li.wptb-rating-star.wptb-rating-star-selected {
2089
+ color:#FF912C;
2090
+ }
2091
+
2092
+
2093
+ .wptb-rating-stars-box ul > li.wptb-rating-star.wptb-rating-star-selected.wptb-rating-star-hover {
2094
+ opacity: 1;
2095
+ }
2096
+
2097
+ .wptb-rating-stars-box ul > li.wptb-rating-star:before {
2098
+ content: "☆";
2099
+ font-size: inherit;
2100
+ height: inherit;
2101
+ line-height: inherit;
2102
+ color: #ccc;
2103
+ font-style: normal;
2104
+ display: block;
2105
+ }
2106
+
2107
+ .wptb-rating-stars-box ul > li.wptb-rating-star.wptb-rating-star-hover:before {
2108
+ content: "★";
2109
+ color: inherit;
2110
+ }
2111
+
2112
+ .wptb-rating-stars-box ul > li.wptb-rating-star.wptb-rating-star-selected:before {
2113
+ content: "★";
2114
+ color: inherit;
2115
+ }*/
2116
+
2117
+ .wptb-success-box {
2118
+ text-align: center;
2119
+ font-size: 20px;
2120
+ }
2121
+
2122
+ .wptb-success-box > div {
2123
+ vertical-align:top;
2124
+ display:inline-block;
2125
+ color:#888;
2126
+ text-align: center;
2127
+ height: 25px;
2128
+ font-size: 25px;
2129
+ line-height: 25px;
2130
+ }
2131
+
2132
  @media screen and (max-width: 1375px) {
2133
  #wptb-messaging-area {
2134
  position: relative;
inc/admin/js/admin.js CHANGED
@@ -1,167 +1,3 @@
1
- var applyGenericItemSettings = function applyGenericItemSettings(element, kindIndexProt) {
2
- var copy = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
3
-
4
- var node = element.getDOMElement(),
5
- index,
6
- listItems,
7
- copy;
8
-
9
- if (kindIndexProt == undefined || copy == true) {
10
- index = document.counter.nextIndex(element.kind);
11
- var wptbElements = document.getElementsByClassName('wptb-ph-element');
12
- var elementIndexesArr = [];
13
- for (var i = 0; i < wptbElements.length; i++) {
14
- var regex = new RegExp('wptb-element-' + element.kind + '-(\\d+)', "i");
15
- var infArr = wptbElements[i].className.match(regex);
16
- if (infArr) {
17
- elementIndexesArr.push(infArr[1]);
18
- }
19
- }
20
- if (elementIndexesArr.length > 0) {
21
- var elementIndexMax = Math.max.apply(Math, elementIndexesArr);
22
- index = elementIndexMax + 1;
23
- } else {
24
- index = 1;
25
- }
26
- } else if (kindIndexProt && !copy) {
27
- index = kindIndexProt.split('-')[1];
28
- }
29
-
30
- node.onmouseenter = function (event) {
31
- 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'),
48
- target = a.querySelector('div');
49
- a.onclick = function (e) {
50
- e.preventDefault();
51
- };
52
- WPTB_Helper.buttonsTinyMceInit(target);
53
- } else if (element.kind === 'text') {
54
- tinyMCE.init({
55
- target: node.childNodes[0],
56
- inline: true,
57
- plugins: "link, paste",
58
- dialog_type: "modal",
59
- theme: 'modern',
60
- menubar: false,
61
- fixed_toolbar_container: '#wpcd_fixed_toolbar',
62
- paste_as_text: true,
63
- toolbar: 'bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify',
64
- setup: function setup(ed) {
65
- ed.on('change', function (e) {
66
- var row = WPTB_Helper.findAncestor(node, 'wptb-row');
67
- if (row.classList.contains('wptb-table-head')) {
68
- var table = WPTB_Helper.findAncestor(row, 'wptb-preview-table');
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;
95
- //editor.fire('focus');
96
- editor.on('focus', function (e) {
97
- var totalWidth = document.getElementsByClassName('wptb-builder-panel')[0].offsetWidth;
98
- if (window.currentEditor && document.getElementById('wptb_builder').scrollTop >= 55 && window.currentEditor.bodyElement.style.display != 'none') {
99
- document.getElementById('wpcd_fixed_toolbar').style.position = 'fixed';
100
- document.getElementById('wpcd_fixed_toolbar').style.right = totalWidth / 2 - document.getElementById('wpcd_fixed_toolbar').offsetWidth / 2 + 'px';
101
- document.getElementById('wpcd_fixed_toolbar').style.top = '100px';
102
- } else {
103
- document.getElementById('wpcd_fixed_toolbar').style.position = 'static';
104
- delete document.getElementById('wpcd_fixed_toolbar').style.right;
105
- delete document.getElementById('wpcd_fixed_toolbar').style.top;
106
- }
107
- });
108
- }
109
- });
110
- } else {
111
- listItems = node.getElementsByClassName('wptb-list-item-content');
112
- for (var _i = 0; _i < listItems.length; _i++) {
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) {
136
- var row = WPTB_Helper.findAncestor(node, 'wptb-row');
137
- if (row.classList.contains('wptb-table-head')) {
138
- var table = WPTB_Helper.findAncestor(row, 'wptb-preview-table');
139
- WPTB_Helper.dataTitleColumnSet(table);
140
- }
141
- });
142
- var config = { attributes: true, attributeFilter: ['style'] };
143
- observer.observe(element.getDOMElement(), config);
144
- }
145
-
146
- var node_wptb_element_kind_num = node.className.match(/wptb-element-(.+)-(\d+)/i);
147
- if (node_wptb_element_kind_num) {
148
- node.classList.remove(node_wptb_element_kind_num[0]);
149
- }
150
- if (!node.classList.contains('wptb-ph-element')) {
151
- node.classList.add('wptb-ph-element');
152
- if (!node.classList.contains('wptb-element-' + element.kind + '-' + index)) {
153
- node.classList.add('wptb-element-' + element.kind + '-' + index);
154
- }
155
- } else {
156
- if (!node.classList.contains('wptb-element-' + element.kind + '-' + index)) {
157
- node.classList.add('wptb-element-' + element.kind + '-' + index);
158
- }
159
- }
160
- new WPTB_ElementOptions(element, index, kindIndexProt);
161
-
162
- document.counter.increment(element.kind);
163
- };
164
-
165
  var WPTB_ActionsField = function WPTB_ActionsField() {
166
  var _this = this;
167
 
@@ -258,11 +94,15 @@ var WPTB_ActionsField = function WPTB_ActionsField() {
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
 
@@ -789,18 +629,6 @@ var WPTB_Cell = function WPTB_Cell(callback, DOMElement) {
789
  };
790
  var WPTB_DropHandle = function WPTB_DropHandle(thisElem, e) {
791
 
792
- function newElementProxy(el) {
793
- if (el.includes('list')) {
794
- return new WPTB_List();
795
- } else if (el.includes('image')) {
796
- return new WPTB_Image();
797
- } else if (el.includes('text')) {
798
- return new WPTB_Text();
799
- } else if (el.includes('button')) {
800
- return new WPTB_Button();
801
- }
802
- }
803
-
804
  var wptbDropHandle = void 0,
805
  wptbDropBorderMarker = void 0;
806
  if (document.getElementsByClassName('wptb-drop-handle').length == 0) {
@@ -843,7 +671,7 @@ var WPTB_DropHandle = function WPTB_DropHandle(thisElem, e) {
843
  var element = void 0;
844
 
845
  if (e.dataTransfer.getData('wptbElement')) {
846
- element = newElementProxy(e.dataTransfer.getData('wptbElement'));
847
  element = element.getDOMElement();
848
  } else {
849
  element = document.getElementsByClassName(e.dataTransfer.getData('node'))[0];
@@ -1021,14 +849,14 @@ var WPTB_ElementOptions = function WPTB_ElementOptions(element, index, kindIndex
1021
 
1022
  if (kindIndexProt) {
1023
  if (element.kind == 'button') {
1024
- var _affectedEl = document.getElementsByClassName('wptb-element-' + kindIndexProt)[0],
1025
  wptbButtonWrapper = void 0,
1026
  wptbButtonA = void 0,
1027
  wptbButton = void 0,
1028
  wptbSize = void 0;
1029
 
1030
- if (_affectedEl) {
1031
- wptbSize = _affectedEl.className.match(/wptb-size-([a-z]+)/i);
1032
  }
1033
 
1034
  if (wptbSize && Array.isArray(wptbSize)) {
@@ -1043,12 +871,12 @@ var WPTB_ElementOptions = function WPTB_ElementOptions(element, index, kindIndex
1043
  }
1044
  }
1045
 
1046
- if (_affectedEl) {
1047
- wptbButtonWrapper = _affectedEl.getElementsByClassName('wptb-button-wrapper');
1048
 
1049
- wptbButtonA = _affectedEl.getElementsByTagName('a');
1050
 
1051
- wptbButton = _affectedEl.getElementsByClassName('wptb-button');
1052
  }
1053
 
1054
  if (wptbButtonWrapper) {
@@ -1106,9 +934,9 @@ var WPTB_ElementOptions = function WPTB_ElementOptions(element, index, kindIndex
1106
  buttonBackgroundColorInput.value = WPTB_Helper.rgbToHex(buttonColor);
1107
  }
1108
  } else if (element.kind == 'image') {
1109
- var _affectedEl2 = document.getElementsByClassName('wptb-element-' + kindIndexProt);
1110
- if (_affectedEl2.length > 0) {
1111
- var elementsA = _affectedEl2[0].getElementsByTagName('a');
1112
  if (elementsA.length > 0) {
1113
  var a = elementsA[0];
1114
 
@@ -1177,10 +1005,10 @@ var WPTB_ElementOptions = function WPTB_ElementOptions(element, index, kindIndex
1177
  }
1178
  }
1179
  } else if (element.kind == 'text') {
1180
- var _affectedEl3 = document.getElementsByClassName('wptb-element-' + kindIndexProt);
1181
- if (_affectedEl3.length > 0) {
1182
- var elementFontSize = _affectedEl3[0].style.fontSize,
1183
- elementTextColor = _affectedEl3[0].style.color;
1184
  var textFontSizeInputRange = prop.querySelector('input[type="range"][data-type="font-size"]'),
1185
  textFontSizeInputNumber = prop.querySelector('input[type="number"][data-type="font-size"]'),
1186
  textColorInput = prop.querySelector('input[type="text"][data-type="color"]');
@@ -1282,6 +1110,62 @@ var WPTB_ElementOptions = function WPTB_ElementOptions(element, index, kindIndex
1282
  }
1283
  }
1284
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1285
  }
1286
  }
1287
 
@@ -1371,54 +1255,45 @@ var WPTB_ElementOptions = function WPTB_ElementOptions(element, index, kindIndex
1371
  if (optionControls[i].classList.contains('wptb-color-picker')) {
1372
  jQuery(optionControls[i]).wpColorPicker({
1373
  change: function change(event, ui) {
1374
- var parent = event.target,
1375
- classe,
1376
- type,
1377
- ps,
1378
- number;
1379
- classe = parent.dataset.element.match(/wptb-options-(.+)-(\d+)/i);
1380
- type = classe[1];
1381
- number = classe[2];
1382
- affectedEl = document.getElementsByClassName('wptb-element-' + type + '-' + number)[0];
1383
- if (type == 'button') {
1384
- if (parent.dataset.type == 'button-text-color') {
1385
- affectedEl.getElementsByClassName('wptb-button')[0].style.color = ui.color.toString();
1386
- } else {
1387
- affectedEl.getElementsByClassName('wptb-button')[0].style.backgroundColor = ui.color.toString();
1388
- }
1389
- } else if (type == 'list') {
1390
- var _ps = affectedEl.querySelectorAll('p');
1391
- if (_ps.length > 0) {
1392
- for (var _i6 = 0; _i6 < _ps.length; _i6++) {
1393
- _ps[_i6].style.color = ui.color.toString();
1394
- }
1395
- }
1396
- } else {
1397
- affectedEl.style.color = ui.color.toString();
1398
- }
1399
 
1400
  //console.log(event);
1401
  WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving(event);
 
 
 
1402
  }
1403
  });
1404
  }
1405
 
1406
- if (optionControls[i].dataset.type === 'font-size') {
1407
- var slider = optionControls[i].parentNode.parentNode.getElementsByClassName('wptb-text-font-size-slider')[0];
1408
- slider.oninput = function () {
1409
- this.parentNode.parentNode.getElementsByClassName('wptb-text-font-size-number')[0].value = this.value;
1410
- this.parentNode.parentNode.getElementsByClassName('wptb-text-font-size-number')[0].onchange(event);
1411
- };
1412
  }
1413
 
1414
- if (optionControls[i].dataset.type === 'image-size') {
1415
- var slider = optionControls[i].parentNode.parentNode.getElementsByClassName('wptb-image-size-slider')[0];
1416
  slider.oninput = function () {
1417
- this.parentNode.parentNode.getElementsByClassName('wptb-image-width-number')[0].value = this.value;
1418
- this.parentNode.parentNode.getElementsByClassName('wptb-image-width-number')[0].onchange(event);
1419
  };
1420
  }
1421
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1422
  optionControls[i].onchange = function (event) {
1423
  var n_Class = this.dataset.element,
1424
  infArr = n_Class.match(/wptb-options-(.+)-(\d+)/i),
@@ -1456,7 +1331,7 @@ var WPTB_ElementOptions = function WPTB_ElementOptions(element, index, kindIndex
1456
  case 'image-size':
1457
  affectedEl.getElementsByTagName('a')[0].style.width = this.value + '%';
1458
  affectedEl.getElementsByTagName('a')[0].style.height = 'auto';
1459
- this.parentNode.parentNode.getElementsByClassName('wptb-image-size-slider')[0].value = this.value;
1460
  break;
1461
  case 'image-alignment':
1462
  var wptbImageFloatValue = '';
@@ -1469,7 +1344,7 @@ var WPTB_ElementOptions = function WPTB_ElementOptions(element, index, kindIndex
1469
  break;
1470
  case 'font-size':
1471
  affectedEl.style.fontSize = val + 'px';
1472
- this.parentNode.parentNode.getElementsByClassName('wptb-text-font-size-slider')[0].value = this.value;
1473
  break;
1474
  case 'button-alignment':
1475
  var jc = '';
@@ -1551,10 +1426,92 @@ var WPTB_ElementOptions = function WPTB_ElementOptions(element, index, kindIndex
1551
  _p4.removeAttribute('class');
1552
  _p4.classList.add('wptb-list-style-type-' + val.toLowerCase());
1553
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1554
  break;
1555
  }
1556
 
1557
- if (event.target.classList.contains('wptb-text-font-size-slider') || event.target.classList.contains('wptb-image-size-slider')) {
1558
  event.target.onmouseup = function () {
1559
  var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
1560
  wptbTableStateSaveManager.tableStateSet();
@@ -1587,7 +1544,8 @@ var WPTB_Helper = {
1587
  text: WPTB_Helper.getDragImageCustom('text'),
1588
  image: WPTB_Helper.getDragImageCustom('image'),
1589
  button: WPTB_Helper.getDragImageCustom('button'),
1590
- list: WPTB_Helper.getDragImageCustom('list')
 
1591
  };
1592
  },
1593
  listItemsRecalculateIndex: function listItemsRecalculateIndex(ulElem) {
@@ -1923,6 +1881,185 @@ var WPTB_Helper = {
1923
  }
1924
  }
1925
  return cellHeight;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1926
  }
1927
  };
1928
  var WPTB_Image = function WPTB_Image(src, DOMElementProt) {
@@ -2042,103 +2179,6 @@ var WPTB_Initializer = function WPTB_Initializer() {
2042
  wptbTableStateSaveManager.tableStateSet();
2043
  };
2044
  };
2045
- var WPTB_innerElementSet = function WPTB_innerElementSet(element) {
2046
-
2047
- function newElementProxy(el) {
2048
- if (el == 'list') {
2049
- return new WPTB_List();
2050
- } else if (el == 'image') {
2051
- return new WPTB_Image();
2052
- } else if (el == 'text') {
2053
- return new WPTB_Text();
2054
- } else if (el == 'button') {
2055
- return new WPTB_Button();
2056
- }
2057
- }
2058
-
2059
- element.ondragenter = function (e) {
2060
- var div;
2061
- if (e.dataTransfer.types.indexOf('wptbelement') == -1 && e.dataTransfer.types.indexOf('wptb-moving-mode') == -1) {
2062
- return;
2063
- }
2064
- WPTB_DropHandle(this, e);
2065
-
2066
- element.classList.add('wptb-ondragenter');
2067
- };
2068
- element.ondragover = function (e) {
2069
- e.preventDefault();
2070
- WPTB_DropHandle(this, e);
2071
- };
2072
- element.ondragleave = function () {};
2073
- element.ondrop = function (e) {
2074
- this.classList.remove('wptb-ondragenter');
2075
- var element = void 0,
2076
- classId = void 0;
2077
- e.preventDefault();
2078
- e.stopPropagation();
2079
-
2080
- if (!e.dataTransfer.getData('wptbElement') && !e.dataTransfer.getData('node')) {
2081
- return;
2082
- }
2083
- var wptbDropHandle = void 0,
2084
- wptbDropBorderMarker = void 0;
2085
- if (document.getElementsByClassName('wptb-drop-handle').length > 0) {
2086
- wptbDropHandle = document.getElementsByClassName('wptb-drop-handle')[0];
2087
- }
2088
- if (document.getElementsByClassName('wptb-drop-border-marker').length > 0) {
2089
- wptbDropBorderMarker = document.getElementsByClassName('wptb-drop-border-marker')[0];
2090
- }
2091
-
2092
- if (e.dataTransfer.getData('wptbElement')) {
2093
- element = newElementProxy(e.dataTransfer.getData('wptbElement'));
2094
- element = element.getDOMElement();
2095
- } else {
2096
- classId = e.dataTransfer.getData('node');
2097
- element = document.getElementsByClassName(classId)[0];
2098
- //element.classList.remove( 'wptb-moving-mode' );
2099
- }
2100
-
2101
- if (wptbDropHandle.style.display == 'block') {
2102
- var td = void 0;
2103
- if (wptbDropHandle.dataset.text == 'Drop Here') {
2104
- td = wptbDropHandle.getDOMParentElement();
2105
- td.appendChild(element);
2106
- } else {
2107
- var innerElement = wptbDropHandle.getDOMParentElement();
2108
- td = innerElement.parentNode;
2109
-
2110
- if (wptbDropHandle.dataset.text == 'Above Element') {
2111
- td.insertBefore(element, innerElement);
2112
- } else if (wptbDropHandle.dataset.text == 'Below Element') {
2113
- var innerElementNext = innerElement.nextSibling;
2114
- td.insertBefore(element, innerElementNext);
2115
- }
2116
- }
2117
- var thisRow = td.parentNode;
2118
- if (thisRow.classList.contains('wptb-table-head')) {
2119
- var table = WPTB_Helper.findAncestor(thisRow, 'wptb-preview-table');
2120
- WPTB_Helper.dataTitleColumnSet(table);
2121
- }
2122
- } else {
2123
- return;
2124
- }
2125
-
2126
- wptbDropHandle.style.display = 'none';
2127
- wptbDropBorderMarker.style.display = 'none';
2128
-
2129
- WPTB_innerElementSet(element);
2130
-
2131
- if (!element.classList.contains('wptb-image-container') || element.classList.contains('wptb-moving-mode')) {
2132
- element.classList.remove('wptb-moving-mode');
2133
- var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
2134
- wptbTableStateSaveManager.tableStateSet();
2135
- }
2136
- return true;
2137
- };
2138
- element.onmouseover = function (e) {
2139
- element.classList.remove('wptb-ondragenter');
2140
- };
2141
- };
2142
  var WPTB_LeftPanel = function WPTB_LeftPanel() {
2143
 
2144
  var table = document.getElementsByClassName('wptb-preview-table')[0],
@@ -2406,46 +2446,26 @@ var WPTB_LeftPanel = function WPTB_LeftPanel() {
2406
 
2407
  cellPaddingSavedSet();
2408
 
2409
- function numberImputSize(wptbNumberInputs, maxCount, maxValue) {
2410
- wptbNumberInputs.onkeydown = function () {
2411
- var thisValue = this.value;
2412
- thisValue = String(thisValue);
2413
- if (thisValue[0] == 0) {
2414
- this.value = "";
2415
- } else {
2416
- thisValue = thisValue.substring(0, maxCount);
2417
- this.value = thisValue;
2418
- }
2419
- };
2420
- wptbNumberInputs.onkeyup = function () {
2421
- var thisValue = this.value;
2422
- thisValue = String(thisValue);
2423
- if (thisValue > maxValue) {
2424
- this.value = maxValue;
2425
- }
2426
- };
2427
- }
2428
-
2429
  var wptbTableBorderNumber = document.getElementById('wptb-table-border-number');
2430
- numberImputSize(wptbTableBorderNumber, 1, 50);
2431
 
2432
  var wptbTableInnerBorderNumber = document.getElementById('wptb-table-inner-border-number');
2433
- numberImputSize(wptbTableInnerBorderNumber, 1, 50);
2434
 
2435
  var wptbTableCellNumber = document.getElementById('wptb-table-cell-number');
2436
- numberImputSize(wptbTableCellNumber, 1, 50);
2437
 
2438
- var wptbTextfontSizeNumber = document.getElementById('wptb-text-font-size-number');
2439
- numberImputSize(wptbTextfontSizeNumber, 1, 50);
2440
 
2441
- var wptbImageWidthNumber = document.getElementById('wptb-image-width-number');
2442
- numberImputSize(wptbImageWidthNumber, 2, 100);
2443
 
2444
  var wptbTableColumnWidthNumber = document.getElementById('wptb-table-column-width-number');
2445
- numberImputSize(wptbTableColumnWidthNumber, 2, 500);
2446
 
2447
  var wptbTableRowHeightNumber = document.getElementById('wptb-table-row-height-number');
2448
- numberImputSize(wptbTableRowHeightNumber, 2, 200);
2449
 
2450
  document.getElementById('wptb-table-cell-slider').oninput = function () {
2451
  document.getElementById('wptb-table-cell-number').value = this.value;
@@ -3195,9 +3215,155 @@ var WPTB_Space = function WPTB_Space(elSpaceBetween) {
3195
  this.classList.remove('visible');
3196
  };
3197
 
3198
- if (!elSpaceBetween) {
3199
- return spaceBetween;
3200
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3201
  };
3202
  var WPTB_Stringifier = function WPTB_Stringifier(codeMain) {
3203
  if (codeMain) {
@@ -5289,4 +5455,278 @@ var WPTB_Text = function WPTB_Text(text, DOMElementProt) {
5289
 
5290
  return this;
5291
  };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5292
  //# sourceMappingURL=admin.js.map
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  var WPTB_ActionsField = function WPTB_ActionsField() {
2
  var _this = this;
3
 
94
  copy = new WPTB_Image('', activeElement);
95
 
96
  td.insertBefore(copy.getDOMElement(), activeElement.nextSibling);
97
+ } else if (type == 'button') {
98
  var text = activeElementClone.childNodes[0].querySelector('p').innerHTML;
99
 
100
  copy = new WPTB_Button(text, activeElementClone);
101
 
102
+ td.insertBefore(copy.getDOMElement(), activeElement.nextSibling);
103
+ } else if (type = 'star_rating') {
104
+ copy = new WPTB_StarRating(activeElementClone);
105
+
106
  td.insertBefore(copy.getDOMElement(), activeElement.nextSibling);
107
  }
108
 
629
  };
630
  var WPTB_DropHandle = function WPTB_DropHandle(thisElem, e) {
631
 
 
 
 
 
 
 
 
 
 
 
 
 
632
  var wptbDropHandle = void 0,
633
  wptbDropBorderMarker = void 0;
634
  if (document.getElementsByClassName('wptb-drop-handle').length == 0) {
671
  var element = void 0;
672
 
673
  if (e.dataTransfer.getData('wptbElement')) {
674
+ element = WPTB_Helper.newElementProxy(e.dataTransfer.getData('wptbElement'));
675
  element = element.getDOMElement();
676
  } else {
677
  element = document.getElementsByClassName(e.dataTransfer.getData('node'))[0];
849
 
850
  if (kindIndexProt) {
851
  if (element.kind == 'button') {
852
+ var affectedEl = document.getElementsByClassName('wptb-element-' + kindIndexProt)[0],
853
  wptbButtonWrapper = void 0,
854
  wptbButtonA = void 0,
855
  wptbButton = void 0,
856
  wptbSize = void 0;
857
 
858
+ if (affectedEl) {
859
+ wptbSize = affectedEl.className.match(/wptb-size-([a-z]+)/i);
860
  }
861
 
862
  if (wptbSize && Array.isArray(wptbSize)) {
871
  }
872
  }
873
 
874
+ if (affectedEl) {
875
+ wptbButtonWrapper = affectedEl.getElementsByClassName('wptb-button-wrapper');
876
 
877
+ wptbButtonA = affectedEl.getElementsByTagName('a');
878
 
879
+ wptbButton = affectedEl.getElementsByClassName('wptb-button');
880
  }
881
 
882
  if (wptbButtonWrapper) {
934
  buttonBackgroundColorInput.value = WPTB_Helper.rgbToHex(buttonColor);
935
  }
936
  } else if (element.kind == 'image') {
937
+ var _affectedEl = document.getElementsByClassName('wptb-element-' + kindIndexProt);
938
+ if (_affectedEl.length > 0) {
939
+ var elementsA = _affectedEl[0].getElementsByTagName('a');
940
  if (elementsA.length > 0) {
941
  var a = elementsA[0];
942
 
1005
  }
1006
  }
1007
  } else if (element.kind == 'text') {
1008
+ var _affectedEl2 = document.getElementsByClassName('wptb-element-' + kindIndexProt);
1009
+ if (_affectedEl2.length > 0) {
1010
+ var elementFontSize = _affectedEl2[0].style.fontSize,
1011
+ elementTextColor = _affectedEl2[0].style.color;
1012
  var textFontSizeInputRange = prop.querySelector('input[type="range"][data-type="font-size"]'),
1013
  textFontSizeInputNumber = prop.querySelector('input[type="number"][data-type="font-size"]'),
1014
  textColorInput = prop.querySelector('input[type="text"][data-type="color"]');
1110
  }
1111
  }
1112
  }
1113
+ } else if (element.kind == 'star_rating') {
1114
+ var _affectedEl3 = document.getElementsByClassName('wptb-element-' + kindIndexProt);
1115
+ if (_affectedEl3.length > 0) {
1116
+ _affectedEl3 = _affectedEl3[0];
1117
+ var ratingStar = _affectedEl3.querySelector('li');
1118
+ if (ratingStar) {
1119
+ var ratingStarSize = ratingStar.style.width;
1120
+ var starSizeInputRange = prop.querySelector('input[type="range"][data-type="star-size"]'),
1121
+ starSizeInputNumber = prop.querySelector('input[type="number"][data-type="star-size"]');
1122
+
1123
+ starSizeInputRange.value = parseInt(ratingStarSize) ? parseInt(ratingStarSize) : 10;
1124
+ starSizeInputNumber.value = parseInt(ratingStarSize) ? parseInt(ratingStarSize) : 10;
1125
+
1126
+ if (ratingStar.querySelector('span')) {
1127
+ var starColorInput = prop.querySelector('input[type="text"][data-type="star-color"]'),
1128
+ ratingStarColor = ratingStar.querySelector('span').style.fill;
1129
+ starColorInput.value = WPTB_Helper.rgbToHex(ratingStarColor);
1130
+ }
1131
+ }
1132
+
1133
+ var ratingStars = _affectedEl3.querySelectorAll('li');
1134
+ var starsCountInputNumber = prop.querySelector('input[type="number"][data-type="stars-count"]');
1135
+ if (ratingStars.length == 1 && ratingStars[0].style.display == 'none') {
1136
+ starsCountInputNumber.value = 0;
1137
+ } else {
1138
+ starsCountInputNumber.value = ratingStars.length;
1139
+ }
1140
+
1141
+ var successBox = _affectedEl3.querySelector('.wptb-success-box');
1142
+ if (successBox) {
1143
+ var showNumberRatingCheckbox = prop.querySelector('input[type="checkbox"][data-type="show-number-rating"]');
1144
+ if (successBox.style.display == 'block') {
1145
+ showNumberRatingCheckbox.checked = true;
1146
+ var numeralRatingOptionContainers = prop.getElementsByClassName('wptb-numeral-rating-option-container');
1147
+ for (var _i6 = 0; _i6 < numeralRatingOptionContainers.length; _i6++) {
1148
+ numeralRatingOptionContainers[_i6].style.display = 'block';
1149
+ }
1150
+ } else {
1151
+ showNumberRatingCheckbox.checked = false;
1152
+ }
1153
+
1154
+ var wptbTextMessage = successBox.querySelector('.wptb-text-message');
1155
+ if (wptbTextMessage) {
1156
+ var numberRatingSize = wptbTextMessage.style.fontSize;
1157
+ var numberRatingColor = wptbTextMessage.style.color;
1158
+
1159
+ var numberSizeInputRange = prop.querySelector('input[type="range"][data-type="numeral-rating-size"]'),
1160
+ numberSizeInputNumber = prop.querySelector('input[type="number"][data-type="numeral-rating-size"]'),
1161
+ numberColorInput = prop.querySelector('input[type="text"][data-type="numeral-rating-color"]');
1162
+
1163
+ numberSizeInputRange.value = parseInt(numberRatingSize) ? parseInt(numberRatingSize) : 10;
1164
+ numberSizeInputNumber.value = parseInt(numberRatingSize) ? parseInt(numberRatingSize) : 10;
1165
+ numberColorInput.value = WPTB_Helper.rgbToHex(numberRatingColor);
1166
+ }
1167
+ }
1168
+ }
1169
  }
1170
  }
1171
 
1255
  if (optionControls[i].classList.contains('wptb-color-picker')) {
1256
  jQuery(optionControls[i]).wpColorPicker({
1257
  change: function change(event, ui) {
1258
+ WPTB_Helper.wpColorPickerChange(event, ui);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1259
 
1260
  //console.log(event);
1261
  WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving(event);
1262
+ },
1263
+ clear: function clear(event) {
1264
+ WPTB_Helper.wpColorPickerChange(event);
1265
  }
1266
  });
1267
  }
1268
 
1269
+ if (optionControls[i].classList.contains('wptb-stars-count-field')) {
1270
+ WPTB_Helper.numberImputSize(optionControls[i], 1, 10);
 
 
 
 
1271
  }
1272
 
1273
+ if (optionControls[i].dataset.type === 'font-size' || optionControls[i].dataset.type === 'image-size' || optionControls[i].dataset.type === 'star-size' || optionControls[i].dataset.type === 'numeral-rating-size') {
1274
+ var slider = optionControls[i].parentNode.parentNode.getElementsByClassName('wptb-size-slider')[0];
1275
  slider.oninput = function () {
1276
+ this.parentNode.parentNode.getElementsByClassName('wptb-size-number')[0].value = this.value;
1277
+ this.parentNode.parentNode.getElementsByClassName('wptb-size-number')[0].onchange(event);
1278
  };
1279
  }
1280
 
1281
+ // if (optionControls[i].dataset.type === 'image-size') {
1282
+ // var slider = optionControls[i].parentNode.parentNode.getElementsByClassName('wptb-size-slider')[0];
1283
+ // slider.oninput = function () {
1284
+ // this.parentNode.parentNode.getElementsByClassName('wptb-size-number')[0].value = this.value;
1285
+ // this.parentNode.parentNode.getElementsByClassName('wptb-size-number')[0].onchange( event );
1286
+ // }
1287
+ // }
1288
+ //
1289
+ // if ( optionControls[i].dataset.type === 'star-size' ) {
1290
+ // var slider = optionControls[i].parentNode.parentNode.getElementsByClassName('wptb-size-slider')[0];
1291
+ // slider.oninput = function () {
1292
+ // this.parentNode.parentNode.getElementsByClassName('wptb-size-number')[0].value = this.value;
1293
+ // this.parentNode.parentNode.getElementsByClassName('wptb-size-number')[0].onchange( event );
1294
+ // }
1295
+ // }
1296
+
1297
  optionControls[i].onchange = function (event) {
1298
  var n_Class = this.dataset.element,
1299
  infArr = n_Class.match(/wptb-options-(.+)-(\d+)/i),
1331
  case 'image-size':
1332
  affectedEl.getElementsByTagName('a')[0].style.width = this.value + '%';
1333
  affectedEl.getElementsByTagName('a')[0].style.height = 'auto';
1334
+ this.parentNode.parentNode.getElementsByClassName('wptb-size-slider')[0].value = this.value;
1335
  break;
1336
  case 'image-alignment':
1337
  var wptbImageFloatValue = '';
1344
  break;
1345
  case 'font-size':
1346
  affectedEl.style.fontSize = val + 'px';
1347
+ this.parentNode.parentNode.getElementsByClassName('wptb-size-slider')[0].value = this.value;
1348
  break;
1349
  case 'button-alignment':
1350
  var jc = '';
1426
  _p4.removeAttribute('class');
1427
  _p4.classList.add('wptb-list-style-type-' + val.toLowerCase());
1428
  }
1429
+ break;
1430
+ case 'star-size':
1431
+ var _ratingStar = affectedEl.querySelectorAll('li');
1432
+ for (var _i7 = 0; _i7 < _ratingStar.length; _i7++) {
1433
+ _ratingStar[_i7].style.width = val + 'px';
1434
+ _ratingStar[_i7].style.height = val + 'px';
1435
+ var span = _ratingStar[_i7].querySelectorAll('span');
1436
+ for (var j = 0; j < span.length; j++) {
1437
+ if (span[j].querySelector('svg')) {
1438
+ span[j].style.width = val + 'px';
1439
+ span[j].style.height = val + 'px';
1440
+ span[j].querySelector('svg').style.width = val + 'px';
1441
+ }
1442
+ }
1443
+ }
1444
+ break;
1445
+ case 'show-number-rating':
1446
+ var wptbNumeralRatingOptionContainer = WPTB_Helper.findAncestor(this, 'wptb-star_rating-options').getElementsByClassName('wptb-numeral-rating-option-container');
1447
+
1448
+ WPTB_Helper.starRatingTextMessageChenge(affectedEl);
1449
+
1450
+ if (wptbNumeralRatingOptionContainer.length > 0) {
1451
+ var _wptbTextMessage = affectedEl.querySelector('.wptb-text-message');
1452
+
1453
+ var _val = this.checked ? 'checked' : 'unchecked';
1454
+ if (_val == 'checked') {
1455
+ for (var _i8 = 0; _i8 < wptbNumeralRatingOptionContainer.length; _i8++) {
1456
+ wptbNumeralRatingOptionContainer[_i8].style.display = 'block';
1457
+ }
1458
+ _wptbTextMessage.parentNode.style.display = 'block';
1459
+ } else if (_val == 'unchecked') {
1460
+ for (var _i9 = 0; _i9 < wptbNumeralRatingOptionContainer.length; _i9++) {
1461
+ wptbNumeralRatingOptionContainer[_i9].style.display = 'none';
1462
+ }
1463
+ _wptbTextMessage.parentNode.style.display = 'none';
1464
+ }
1465
+ }
1466
+ break;
1467
+ case 'numeral-rating-size':
1468
+ var wptbTextMessageSize = affectedEl.querySelector('.wptb-text-message');
1469
+ wptbTextMessageSize.style.fontSize = val + 'px';
1470
+ wptbTextMessageSize.style.height = val + 'px';
1471
+ wptbTextMessageSize.style.lineHeight = val + 'px';
1472
+ break;
1473
+ case 'stars-count':
1474
+ var starRatings = affectedEl.querySelectorAll('li');
1475
+
1476
+ var starRatingsCount = starRatings.length;
1477
+
1478
+ if (val > starRatingsCount) {
1479
+ var difference = val - starRatingsCount;
1480
+ var starRatingsLast = starRatings[starRatings.length - 1];
1481
+
1482
+ var parent = starRatingsLast.parentNode;
1483
+ for (var _i10 = 0; _i10 < difference; _i10++) {
1484
+ var newStarRating = starRatingsLast.cloneNode(true);
1485
+ newStarRating.removeAttribute('class');
1486
+ newStarRating.setAttribute('class', 'wptb-rating-star');
1487
+ newStarRating.dataset.value = parseInt(starRatingsLast.dataset.value) + _i10 + 1;
1488
+ WPTB_Helper.starRatingEventHandlersAdd(newStarRating);
1489
+ parent.appendChild(newStarRating);
1490
+ }
1491
+ } else if (val < starRatingsCount) {
1492
+ var _difference = parseInt(starRatingsCount) - parseInt(val);
1493
+
1494
+ if (val == 0) {
1495
+ _difference--;
1496
+ starRatings[0].removeAttribute('class');
1497
+ starRatings[0].setAttribute('class', 'wptb-rating-star');
1498
+ starRatings[0].style.display = 'none';
1499
+ }
1500
+
1501
+ var starRatingLength = starRatings.length;
1502
+ for (i = 0; i < _difference; i++) {
1503
+ starRatings[0].parentNode.removeChild(starRatings[starRatingLength - i - 1]);
1504
+ }
1505
+ } else if (val == starRatingsCount && starRatingsCount == 1) {
1506
+ starRatings[0].style.display = 'inline-block';
1507
+ }
1508
+
1509
+ WPTB_Helper.starRatingTextMessageChenge(affectedEl);
1510
+
1511
  break;
1512
  }
1513
 
1514
+ if (event.target.classList.contains('wptb-size-slider') || event.target.classList.contains('wptb-size-slider')) {
1515
  event.target.onmouseup = function () {
1516
  var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
1517
  wptbTableStateSaveManager.tableStateSet();
1544
  text: WPTB_Helper.getDragImageCustom('text'),
1545
  image: WPTB_Helper.getDragImageCustom('image'),
1546
  button: WPTB_Helper.getDragImageCustom('button'),
1547
+ list: WPTB_Helper.getDragImageCustom('list'),
1548
+ star_rating: WPTB_Helper.getDragImageCustom('half-filled-rating-star')
1549
  };
1550
  },
1551
  listItemsRecalculateIndex: function listItemsRecalculateIndex(ulElem) {
1881
  }
1882
  }
1883
  return cellHeight;
1884
+ },
1885
+ newElementProxy: function newElementProxy(el) {
1886
+ if (el == 'list') {
1887
+ return new WPTB_List();
1888
+ } else if (el == 'image') {
1889
+ return new WPTB_Image();
1890
+ } else if (el == 'text') {
1891
+ return new WPTB_Text();
1892
+ } else if (el == 'button') {
1893
+ return new WPTB_Button();
1894
+ } else if (el == 'star_rating') {
1895
+ return new WPTB_StarRating();
1896
+ }
1897
+ },
1898
+ wpColorPickerChange: function wpColorPickerChange(event, ui) {
1899
+ var uiColor = void 0;
1900
+ if (ui) {
1901
+ uiColor = ui.color.toString();
1902
+ } else {
1903
+ uiColor = '';
1904
+ }
1905
+
1906
+ var parent = WPTB_Helper.findAncestor(event.target, 'wp-picker-input-wrap').getElementsByClassName('wptb-color-picker')[0],
1907
+ classe = void 0,
1908
+ type = void 0,
1909
+ ps = void 0,
1910
+ number = void 0;
1911
+ classe = parent.dataset.element.match(/wptb-options-(.+)-(\d+)/i);
1912
+ type = classe[1];
1913
+ number = classe[2];
1914
+ var affectedEl = document.getElementsByClassName('wptb-element-' + type + '-' + number)[0];
1915
+ if (type == 'button') {
1916
+ if (parent.dataset.type == 'button-text-color') {
1917
+ affectedEl.getElementsByClassName('wptb-button')[0].style.color = uiColor;
1918
+ } else {
1919
+ affectedEl.getElementsByClassName('wptb-button')[0].style.backgroundColor = uiColor;
1920
+ }
1921
+ } else if (type == 'list') {
1922
+ var _ps = affectedEl.querySelectorAll('p');
1923
+ if (_ps.length > 0) {
1924
+ for (var i = 0; i < _ps.length; i++) {
1925
+ _ps[i].style.color = uiColor;
1926
+ }
1927
+ }
1928
+ } else if (type == 'star_rating') {
1929
+ if (parent.dataset.type == 'star-color') {
1930
+ var ratingStar = affectedEl.querySelectorAll('li');
1931
+ for (var _i2 = 0; _i2 < ratingStar.length; _i2++) {
1932
+ var span = ratingStar[_i2].getElementsByTagName('span');
1933
+ for (var j = 0; j < span.length; j++) {
1934
+ span[j].style.fill = uiColor;
1935
+ }
1936
+ }
1937
+ } else if (parent.dataset.type == 'numeral-rating-color') {
1938
+ var wptbTextMessageSize = affectedEl.querySelector('.wptb-text-message');
1939
+ wptbTextMessageSize.style.color = uiColor;
1940
+ }
1941
+ } else {
1942
+ affectedEl.style.color = uiColor;
1943
+ }
1944
+ },
1945
+ starRatingSelectHoverSet: function starRatingSelectHoverSet(event) {
1946
+ var starRating = void 0;
1947
+ if (!event.target.classList.contains('wptb-rating-star')) {
1948
+ starRating = WPTB_Helper.findAncestor(event.target, 'wptb-rating-star');
1949
+ } else {
1950
+ starRating = event.target;
1951
+ }
1952
+
1953
+ var onStar = parseInt(starRating.dataset.value, 10); // The star currently mouse on
1954
+
1955
+ // Now highlight all the stars that's not after the current hovered star
1956
+ var children = starRating.parentNode.children;
1957
+ if (event.type == "mouseover") {
1958
+ for (var j = 0; j < children.length; j++) {
1959
+ if (j < onStar) {
1960
+ if (j == onStar - 1) {
1961
+ if (event.target.classList.contains('wptb-rating-star-left-signal-part')) {
1962
+ children[j].classList.add('wptb-rating-star-hover-half');
1963
+ children[j].classList.remove('wptb-rating-star-hover-full');
1964
+ } else if (event.target.classList.contains('wptb-rating-star-right-signal-part')) {
1965
+ children[j].classList.add('wptb-rating-star-hover-full');
1966
+ children[j].classList.remove('wptb-rating-star-hover-half');
1967
+ }
1968
+ } else {
1969
+ children[j].classList.add('wptb-rating-star-hover-full');
1970
+ children[j].classList.remove('wptb-rating-star-hover-half');
1971
+ }
1972
+ } else {
1973
+ children[j].classList.remove('wptb-rating-star-hover-full');
1974
+ children[j].classList.remove('wptb-rating-star-hover-half');
1975
+ }
1976
+ }
1977
+ } else if (event.type == "click") {
1978
+ for (var _j2 = 0; _j2 < children.length; _j2++) {
1979
+ if (_j2 < onStar) {
1980
+ if (_j2 == onStar - 1) {
1981
+ if (event.target.classList.contains('wptb-rating-star-left-signal-part')) {
1982
+ children[_j2].classList.add('wptb-rating-star-selected-half');
1983
+ children[_j2].classList.remove('wptb-rating-star-selected-full');
1984
+ } else if (event.target.classList.contains('wptb-rating-star-right-signal-part')) {
1985
+ children[_j2].classList.add('wptb-rating-star-selected-full');
1986
+ children[_j2].classList.remove('wptb-rating-star-selected-half');
1987
+ }
1988
+ } else {
1989
+ children[_j2].classList.add('wptb-rating-star-selected-full');
1990
+ children[_j2].classList.remove('wptb-rating-star-selected-half');
1991
+ }
1992
+ } else {
1993
+ children[_j2].classList.remove('wptb-rating-star-selected-full');
1994
+ children[_j2].classList.remove('wptb-rating-star-selected-half');
1995
+ }
1996
+ }
1997
+ }
1998
+ },
1999
+ starRatingEventHandlersAdd: function starRatingEventHandlersAdd(ratingStar) {
2000
+ ratingStar.onmouseover = function (event) {
2001
+ event.stopPropagation();
2002
+ WPTB_Helper.starRatingSelectHoverSet(event);
2003
+ };
2004
+ ratingStar.onmouseout = function () {
2005
+ var children = this.parentNode.children;
2006
+ for (var j = 0; j < children.length; j++) {
2007
+ children[j].classList.remove('wptb-rating-star-hover-half');
2008
+ children[j].classList.remove('wptb-rating-star-hover-full');
2009
+ }
2010
+ };
2011
+
2012
+ /* 2. Action to perform on click */
2013
+ ratingStar.onclick = function (event) {
2014
+ WPTB_Helper.starRatingSelectHoverSet(event);
2015
+
2016
+ /* Rating number message */
2017
+ var wptbStarRatingContainer = WPTB_Helper.findAncestor(event.target, 'wptb-star_rating-container');
2018
+
2019
+ WPTB_Helper.starRatingTextMessageChenge(wptbStarRatingContainer);
2020
+
2021
+ var wptbActionsField = new WPTB_ActionsField(1, wptbStarRatingContainer);
2022
+
2023
+ wptbActionsField.setParameters(wptbStarRatingContainer);
2024
+
2025
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
2026
+ wptbTableStateSaveManager.tableStateSet();
2027
+ };
2028
+ },
2029
+ numberImputSize: function numberImputSize(wptbNumberInputs, maxCount, maxValue) {
2030
+ wptbNumberInputs.onkeydown = function () {
2031
+ var thisValue = this.value;
2032
+ thisValue = String(thisValue);
2033
+ if (thisValue[0] == 0) {
2034
+ this.value = "";
2035
+ } else {
2036
+ thisValue = thisValue.substring(0, maxCount);
2037
+ this.value = thisValue;
2038
+ }
2039
+ };
2040
+ wptbNumberInputs.onkeyup = function () {
2041
+ var thisValue = this.value;
2042
+ thisValue = String(thisValue);
2043
+ if (thisValue > maxValue) {
2044
+ this.value = maxValue;
2045
+ }
2046
+ };
2047
+ },
2048
+ starRatingTextMessageChenge: function starRatingTextMessageChenge(starRatingContainer) {
2049
+ var ratingNumber = starRatingContainer.getElementsByClassName('wptb-rating-star-selected-full').length;
2050
+ if (starRatingContainer.getElementsByClassName('wptb-rating-star-selected-half').length > 0) {
2051
+ ratingNumber = parseInt(ratingNumber) + 0.5;
2052
+ }
2053
+
2054
+ var wptbTextMessageCommon = starRatingContainer.querySelectorAll('li'),
2055
+ wptbTextMessageCommonVal = wptbTextMessageCommon.length,
2056
+ wptbTextMessage = starRatingContainer.querySelector('.wptb-text-message');
2057
+ if (wptbTextMessageCommonVal == 1 && wptbTextMessageCommon[0].style.display == 'none') {
2058
+ wptbTextMessage.innerHTML = '';
2059
+ return;
2060
+ }
2061
+
2062
+ wptbTextMessage.innerHTML = ratingNumber + '/' + wptbTextMessageCommonVal;
2063
  }
2064
  };
2065
  var WPTB_Image = function WPTB_Image(src, DOMElementProt) {
2179
  wptbTableStateSaveManager.tableStateSet();
2180
  };
2181
  };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2182
  var WPTB_LeftPanel = function WPTB_LeftPanel() {
2183
 
2184
  var table = document.getElementsByClassName('wptb-preview-table')[0],
2446
 
2447
  cellPaddingSavedSet();
2448
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2449
  var wptbTableBorderNumber = document.getElementById('wptb-table-border-number');
2450
+ WPTB_Helper.numberImputSize(wptbTableBorderNumber, 1, 50);
2451
 
2452
  var wptbTableInnerBorderNumber = document.getElementById('wptb-table-inner-border-number');
2453
+ WPTB_Helper.numberImputSize(wptbTableInnerBorderNumber, 1, 50);
2454
 
2455
  var wptbTableCellNumber = document.getElementById('wptb-table-cell-number');
2456
+ WPTB_Helper.numberImputSize(wptbTableCellNumber, 1, 50);
2457
 
2458
+ var wptbTextfontSizeNumber = document.getElementById('wptb-size-number');
2459
+ WPTB_Helper.numberImputSize(wptbTextfontSizeNumber, 1, 50);
2460
 
2461
+ var wptbImageWidthNumber = document.getElementById('wptb-size-number');
2462
+ WPTB_Helper.numberImputSize(wptbImageWidthNumber, 2, 100);
2463
 
2464
  var wptbTableColumnWidthNumber = document.getElementById('wptb-table-column-width-number');
2465
+ WPTB_Helper.numberImputSize(wptbTableColumnWidthNumber, 2, 500);
2466
 
2467
  var wptbTableRowHeightNumber = document.getElementById('wptb-table-row-height-number');
2468
+ WPTB_Helper.numberImputSize(wptbTableRowHeightNumber, 2, 200);
2469
 
2470
  document.getElementById('wptb-table-cell-slider').oninput = function () {
2471
  document.getElementById('wptb-table-cell-number').value = this.value;
3215
  this.classList.remove('visible');
3216
  };
3217
 
3218
+ if (!elSpaceBetween) {
3219
+ return spaceBetween;
3220
+ }
3221
+ };
3222
+ 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); } }
3223
+
3224
+ var WPTB_StarRating = function WPTB_StarRating(DOMElementProt, countStarts) {
3225
+ if (!countStarts) {
3226
+ if (!DOMElementProt) {
3227
+ countStarts = 5;
3228
+ } else {
3229
+ countStarts = DOMElementProt.querySelectorAll('li').length;
3230
+ }
3231
+ }
3232
+
3233
+ var DOMElement = document.createElement('div'),
3234
+ ratingStarsBox = document.createElement('div'),
3235
+ ratingStarsList = document.createElement('ul'),
3236
+ successBox = document.createElement('div'),
3237
+ textMessage = document.createElement('div'),
3238
+ kindIndexProt = undefined,
3239
+ copy = false;
3240
+
3241
+ DOMElement.classList.add('wptb-star_rating-container');
3242
+ ratingStarsBox.classList.add('wptb-rating-stars-box');
3243
+ ratingStarsList.classList.add('wptb-rating-stars-list');
3244
+ successBox.classList.add('wptb-success-box');
3245
+ successBox.style.display = 'none';
3246
+ textMessage.classList.add('wptb-text-message');
3247
+
3248
+ var filledRatingStarHtml = '<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" \n\
3249
+ xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="20px" viewBox="0 0 426.667 426.667" \n\
3250
+ style="enable-background:new 0 0 426.667 426.667;" xml:space="preserve">\n\
3251
+ <polygon points="426.667,165.12 273.28,152.107 213.333,10.667 153.387,152.107 0,165.12 \n\
3252
+ 116.48,266.027 81.493,416 213.333,336.427 345.173,416 310.187,266.027"/></svg>';
3253
+
3254
+ var notFilledRatingStarHtml = '<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" \n\
3255
+ xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="20px" viewBox="0 0 426.667 426.667" \n\
3256
+ style="enable-background:new 0 0 426.667 426.667;" xml:space="preserve">\n\
3257
+ <path d="M426.667,165.12L273.28,151.893L213.333,10.667l-59.947,141.44L0,165.12l116.48,100.907L81.493,416l131.84-79.573\n\
3258
+ L345.173,416L310.4,266.027L426.667,165.12z M213.333,296.533L133.12,344.96l21.333-91.307l-70.827-61.44l93.44-8.107 \n\
3259
+ l36.267-85.973l36.48,86.187l93.44,8.107l-70.827,61.44l21.333,91.307L213.333,296.533z"/></svg>';
3260
+
3261
+ var halfFilledRatingStarHtml = '<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" \n\
3262
+ xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="20px" viewBox="0 0 426.667 426.667" \n\
3263
+ style="enable-background:new 0 0 426.667 426.667;" xml:space="preserve">\n\
3264
+ <path d="M426.667,165.12L273.28,151.893L213.333,10.667l-59.947,141.44L0,165.12l116.48,100.907L81.493,416l131.84-79.573 \n\
3265
+ L345.173,416L310.4,266.027L426.667,165.12z M213.333,296.533v-198.4l36.48,86.187l93.44,8.107l-70.827,61.44l21.333,91.307 \n\
3266
+ L213.333,296.533z"/></svg>';
3267
+
3268
+ for (var i = 0; i < countStarts; i++) {
3269
+ var ratingStar = document.createElement('li');
3270
+ ratingStar.classList.add('wptb-rating-star');
3271
+ var ratingStarZeroSet = '';
3272
+ if (i == 0) {
3273
+ ratingStarZeroSet = '<span class="wptb-rating-star-zero-set"></span>';
3274
+ }
3275
+
3276
+ ratingStar.innerHTML = '<span class="wptb-rating-star-left-signal-part">' + ratingStarZeroSet + '</span><span class="wptb-filled-rating-star">' + filledRatingStarHtml + '</span>' + '<span class="wptb-not-filled-rating-star">' + notFilledRatingStarHtml + '</span>' + '<span class="wptb-half-filled-rating-star">' + halfFilledRatingStarHtml + '</span><span class="wptb-rating-star-right-signal-part"></span>';
3277
+ ratingStar.dataset.value = i + 1;
3278
+ ratingStarsList.appendChild(ratingStar);
3279
+ }
3280
+
3281
+ successBox.appendChild(textMessage);
3282
+ ratingStarsBox.appendChild(ratingStarsList);
3283
+ ratingStarsBox.appendChild(successBox);
3284
+ DOMElement.appendChild(ratingStarsBox);
3285
+
3286
+ // Creation of a new star rating when copying to avoid errors when assigning new event handlers.
3287
+ if (DOMElementProt) {
3288
+ var wptbElementMutch = DOMElementProt.className.match(/wptb-element-((.+-)\d+)/i);
3289
+ if (wptbElementMutch && Array.isArray(wptbElementMutch)) {
3290
+ kindIndexProt = wptbElementMutch[1];
3291
+ copy = true;
3292
+ };
3293
+
3294
+ var wptbRatingStarsBox = DOMElementProt.querySelector('.wptb-rating-stars-box');
3295
+ if (wptbRatingStarsBox) {
3296
+ var wptbRatingStarsBoxAttributes = [].concat(_toConsumableArray(wptbRatingStarsBox.attributes));
3297
+ if (wptbRatingStarsBoxAttributes.length > 0) {
3298
+ for (var _i = 0; _i < wptbRatingStarsBoxAttributes.length; _i++) {
3299
+ if (wptbRatingStarsBoxAttributes[_i].name == 'style') {
3300
+ ratingStarsBox.setAttribute(wptbRatingStarsBoxAttributes[_i].name, wptbRatingStarsBoxAttributes[_i].value);
3301
+ }
3302
+ }
3303
+ }
3304
+ }
3305
+
3306
+ var wptbRatingStarsOld = wptbRatingStarsBox.querySelectorAll('li');
3307
+ var wptbRatingStars = ratingStarsList.querySelectorAll('li');
3308
+ if (wptbRatingStarsOld.length > 0 && wptbRatingStars.length > 0) {
3309
+ var iMax = wptbRatingStarsOld.length < countStarts ? wptbRatingStarsOld.length : countStarts;
3310
+ for (var _i2 = 0; _i2 < wptbRatingStarsOld.length; _i2++) {
3311
+ var wptbRatingStarsAttributes = [].concat(_toConsumableArray(wptbRatingStarsOld[_i2].attributes));
3312
+ if (wptbRatingStarsAttributes.length > 0) {
3313
+ for (var j = 0; j < wptbRatingStarsAttributes.length; j++) {
3314
+ wptbRatingStars[_i2].setAttribute(wptbRatingStarsAttributes[j].name, wptbRatingStarsAttributes[j].value);
3315
+ }
3316
+ }
3317
+
3318
+ var wptbRatingStarsOldSpan = wptbRatingStarsOld[_i2].children;
3319
+ var wptbRatingStarsSpan = wptbRatingStars[_i2].children;
3320
+ for (var k = 0; k < wptbRatingStarsOldSpan.length; k++) {
3321
+ var wptbRatingStarsOldSpanAttributes = [].concat(_toConsumableArray(wptbRatingStarsOldSpan[k].attributes));
3322
+ if (wptbRatingStarsOldSpanAttributes.length > 0) {
3323
+ for (var l = 0; l < wptbRatingStarsOldSpanAttributes.length; l++) {
3324
+ wptbRatingStarsSpan[k].setAttribute(wptbRatingStarsOldSpanAttributes[l].name, wptbRatingStarsOldSpanAttributes[l].value);
3325
+ var wptbRatingStarsOldSvg = wptbRatingStarsOldSpan[k].querySelector('svg');
3326
+ if (wptbRatingStarsOldSvg) {
3327
+ var wptbRatingStarsOldSvgStyle = wptbRatingStarsOldSvg.getAttribute('style');
3328
+ wptbRatingStarsSpan[k].querySelector('svg').setAttribute('style', wptbRatingStarsOldSvgStyle);
3329
+ }
3330
+ }
3331
+ }
3332
+ }
3333
+ }
3334
+ }
3335
+
3336
+ var wptbSuccessBox = wptbRatingStarsBox.querySelector('.wptb-success-box');
3337
+ if (wptbSuccessBox) {
3338
+ var wptbSuccessBoxAttributes = [].concat(_toConsumableArray(wptbSuccessBox.attributes));
3339
+ for (var _i3 = 0; _i3 < wptbSuccessBoxAttributes.length; _i3++) {
3340
+ if (wptbSuccessBoxAttributes[_i3].name == 'style') {
3341
+ successBox.setAttribute(wptbSuccessBoxAttributes[_i3].name, wptbSuccessBoxAttributes[_i3].value);
3342
+ }
3343
+ }
3344
+ }
3345
+
3346
+ var wptbTextMessage = wptbSuccessBox.querySelector('.wptb-text-message');
3347
+ if (wptbTextMessage) {
3348
+ textMessage.innerHTML = wptbTextMessage.innerHTML;
3349
+ var wptbTextMessageAttributes = [].concat(_toConsumableArray(wptbTextMessage.attributes));
3350
+ for (var _i4 = 0; _i4 < wptbTextMessageAttributes.length; _i4++) {
3351
+ if (wptbTextMessageAttributes[_i4].name == 'style') {
3352
+ textMessage.setAttribute(wptbTextMessageAttributes[_i4].name, wptbTextMessageAttributes[_i4].value);
3353
+ }
3354
+ }
3355
+ }
3356
+ }
3357
+
3358
+ this.kind = 'star_rating';
3359
+
3360
+ this.getDOMElement = function () {
3361
+ return DOMElement;
3362
+ };
3363
+
3364
+ applyGenericItemSettings(this, kindIndexProt, copy);
3365
+
3366
+ return this;
3367
  };
3368
  var WPTB_Stringifier = function WPTB_Stringifier(codeMain) {
3369
  if (codeMain) {
5455
 
5456
  return this;
5457
  };
5458
+ var WPTB_innerElementSet = function WPTB_innerElementSet(element) {
5459
+
5460
+ element.ondragenter = function (e) {
5461
+ var div;
5462
+ if (e.dataTransfer.types.indexOf('wptbelement') == -1 && e.dataTransfer.types.indexOf('wptb-moving-mode') == -1) {
5463
+ return;
5464
+ }
5465
+ WPTB_DropHandle(this, e);
5466
+
5467
+ element.classList.add('wptb-ondragenter');
5468
+ };
5469
+ element.ondragover = function (e) {
5470
+ e.preventDefault();
5471
+ WPTB_DropHandle(this, e);
5472
+ };
5473
+ element.ondragleave = function () {};
5474
+ element.ondrop = function (e) {
5475
+ this.classList.remove('wptb-ondragenter');
5476
+ var element = void 0,
5477
+ classId = void 0;
5478
+ e.preventDefault();
5479
+ e.stopPropagation();
5480
+
5481
+ if (!e.dataTransfer.getData('wptbElement') && !e.dataTransfer.getData('node')) {
5482
+ return;
5483
+ }
5484
+ var wptbDropHandle = void 0,
5485
+ wptbDropBorderMarker = void 0;
5486
+ if (document.getElementsByClassName('wptb-drop-handle').length > 0) {
5487
+ wptbDropHandle = document.getElementsByClassName('wptb-drop-handle')[0];
5488
+ }
5489
+ if (document.getElementsByClassName('wptb-drop-border-marker').length > 0) {
5490
+ wptbDropBorderMarker = document.getElementsByClassName('wptb-drop-border-marker')[0];
5491
+ }
5492
+
5493
+ if (e.dataTransfer.getData('wptbElement')) {
5494
+ element = WPTB_Helper.newElementProxy(e.dataTransfer.getData('wptbElement'));
5495
+ element = element.getDOMElement();
5496
+ } else {
5497
+ classId = e.dataTransfer.getData('node');
5498
+ element = document.getElementsByClassName(classId)[0];
5499
+ //element.classList.remove( 'wptb-moving-mode' );
5500
+ }
5501
+
5502
+ if (wptbDropHandle.style.display == 'block') {
5503
+ var td = void 0;
5504
+ if (wptbDropHandle.dataset.text == 'Drop Here') {
5505
+ td = wptbDropHandle.getDOMParentElement();
5506
+ td.appendChild(element);
5507
+ } else {
5508
+ var innerElement = wptbDropHandle.getDOMParentElement();
5509
+ td = innerElement.parentNode;
5510
+
5511
+ if (wptbDropHandle.dataset.text == 'Above Element') {
5512
+ td.insertBefore(element, innerElement);
5513
+ } else if (wptbDropHandle.dataset.text == 'Below Element') {
5514
+ var innerElementNext = innerElement.nextSibling;
5515
+ td.insertBefore(element, innerElementNext);
5516
+ }
5517
+ }
5518
+ var thisRow = td.parentNode;
5519
+ if (thisRow.classList.contains('wptb-table-head')) {
5520
+ var table = WPTB_Helper.findAncestor(thisRow, 'wptb-preview-table');
5521
+ WPTB_Helper.dataTitleColumnSet(table);
5522
+ }
5523
+ } else {
5524
+ return;
5525
+ }
5526
+
5527
+ wptbDropHandle.style.display = 'none';
5528
+ wptbDropBorderMarker.style.display = 'none';
5529
+
5530
+ WPTB_innerElementSet(element);
5531
+
5532
+ if (!element.classList.contains('wptb-image-container') || element.classList.contains('wptb-moving-mode')) {
5533
+ element.classList.remove('wptb-moving-mode');
5534
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
5535
+ wptbTableStateSaveManager.tableStateSet();
5536
+ }
5537
+ return true;
5538
+ };
5539
+ element.onmouseover = function (e) {
5540
+ element.classList.remove('wptb-ondragenter');
5541
+ };
5542
+ };
5543
+ var applyGenericItemSettings = function applyGenericItemSettings(element, kindIndexProt) {
5544
+ var copy = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
5545
+
5546
+ var node = element.getDOMElement(),
5547
+ index,
5548
+ listItems,
5549
+ copy;
5550
+
5551
+ if (kindIndexProt == undefined || copy == true) {
5552
+ index = document.counter.nextIndex(element.kind);
5553
+ var wptbElements = document.getElementsByClassName('wptb-ph-element');
5554
+ var elementIndexesArr = [];
5555
+ for (var i = 0; i < wptbElements.length; i++) {
5556
+ var regex = new RegExp('wptb-element-' + element.kind + '-(\\d+)', "i");
5557
+ var infArr = wptbElements[i].className.match(regex);
5558
+ if (infArr) {
5559
+ elementIndexesArr.push(infArr[1]);
5560
+ }
5561
+ }
5562
+ if (elementIndexesArr.length > 0) {
5563
+ var elementIndexMax = Math.max.apply(Math, elementIndexesArr);
5564
+ index = elementIndexMax + 1;
5565
+ } else {
5566
+ index = 1;
5567
+ }
5568
+ } else if (kindIndexProt && !copy) {
5569
+ var kindIndexProtArr = kindIndexProt.split('-');
5570
+ index = kindIndexProtArr[kindIndexProtArr.length - 1];
5571
+ }
5572
+
5573
+ node.onmouseenter = function (event) {
5574
+ if (event.target.classList.contains('wptb-moving-mode')) {
5575
+ return;
5576
+ }
5577
+
5578
+ var i = void 0,
5579
+ wptbActionsField = new WPTB_ActionsField();
5580
+
5581
+ wptbActionsField.addActionField(1, node);
5582
+
5583
+ wptbActionsField.setParameters(node);
5584
+
5585
+ node.classList.remove('wptb-ondragenter');
5586
+
5587
+ //wptbActionsField.addActionField( 1, node )
5588
+
5589
+ if (element.kind === 'button') {
5590
+ var a = node.querySelector('a'),
5591
+ target = a.querySelector('div');
5592
+ a.onclick = function (e) {
5593
+ e.preventDefault();
5594
+ };
5595
+ WPTB_Helper.buttonsTinyMceInit(target);
5596
+ } else if (element.kind === 'text') {
5597
+ tinyMCE.init({
5598
+ target: node.childNodes[0],
5599
+ inline: true,
5600
+ plugins: "link, paste",
5601
+ dialog_type: "modal",
5602
+ theme: 'modern',
5603
+ menubar: false,
5604
+ force_br_newlines: false,
5605
+ force_p_newlines: false,
5606
+ forced_root_block: '',
5607
+ fixed_toolbar_container: '#wpcd_fixed_toolbar',
5608
+ paste_as_text: true,
5609
+ toolbar: 'bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify',
5610
+ setup: function setup(ed) {
5611
+ ed.on('change', function (e) {
5612
+ var row = WPTB_Helper.findAncestor(node, 'wptb-row');
5613
+ if (row.classList.contains('wptb-table-head')) {
5614
+ var table = WPTB_Helper.findAncestor(row, 'wptb-preview-table');
5615
+ WPTB_Helper.dataTitleColumnSet(table);
5616
+ }
5617
+ });
5618
+
5619
+ ed.on('keydown', function (e) {
5620
+ var wptbActionsField = new WPTB_ActionsField();
5621
+
5622
+ wptbActionsField.addActionField(1, node);
5623
+
5624
+ wptbActionsField.setParameters(node);
5625
+ });
5626
+ ed.on('keyup', function (e) {
5627
+ var wptbActionsField = new WPTB_ActionsField();
5628
+
5629
+ wptbActionsField.addActionField(1, node);
5630
+
5631
+ wptbActionsField.setParameters(node);
5632
+
5633
+ e.target.onblur = function () {
5634
+ var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
5635
+ wptbTableStateSaveManager.tableStateSet();
5636
+ };
5637
+ });
5638
+ },
5639
+ init_instance_callback: function init_instance_callback(editor) {
5640
+ window.currentEditor = editor;
5641
+ //editor.fire('focus');
5642
+ editor.on('focus', function (e) {
5643
+ var totalWidth = document.getElementsByClassName('wptb-builder-panel')[0].offsetWidth;
5644
+ if (window.currentEditor && document.getElementById('wptb_builder').scrollTop >= 55 && window.currentEditor.bodyElement.style.display != 'none') {
5645
+ document.getElementById('wpcd_fixed_toolbar').style.position = 'fixed';
5646
+ document.getElementById('wpcd_fixed_toolbar').style.right = totalWidth / 2 - document.getElementById('wpcd_fixed_toolbar').offsetWidth / 2 + 'px';
5647
+ document.getElementById('wpcd_fixed_toolbar').style.top = '100px';
5648
+ } else {
5649
+ document.getElementById('wpcd_fixed_toolbar').style.position = 'static';
5650
+ delete document.getElementById('wpcd_fixed_toolbar').style.right;
5651
+ delete document.getElementById('wpcd_fixed_toolbar').style.top;
5652
+ }
5653
+ });
5654
+ }
5655
+ });
5656
+ } else if (element.kind === 'list') {
5657
+ listItems = node.getElementsByClassName('wptb-list-item-content');
5658
+ for (var _i = 0; _i < listItems.length; _i++) {
5659
+ WPTB_Helper.listItemsTinyMceInit(listItems[_i]);
5660
+ }
5661
+ }
5662
+ };
5663
+
5664
+ node.onmouseleave = function (event) {
5665
+ var wptbActionsField = new WPTB_ActionsField();
5666
+
5667
+ if (wptbActionsField.wptbActions && wptbActionsField.wptbActions.type != '1') {
5668
+ return;
5669
+ }
5670
+
5671
+ wptbActionsField.leaveFromField(event, node, 1);
5672
+ };
5673
+
5674
+ var wptbActions = document.getElementsByClassName('wptb-actions');
5675
+ if (wptbActions.length > 0) {
5676
+ wptbActions = wptbActions[0];
5677
+ }
5678
+
5679
+ // Change data-title-column if the title was changed
5680
+ if (element.kind == 'text') {
5681
+ var observer = new MutationObserver(function (mutations) {
5682
+ var row = WPTB_Helper.findAncestor(node, 'wptb-row');
5683
+ if (row.classList.contains('wptb-table-head')) {
5684
+ var table = WPTB_Helper.findAncestor(row, 'wptb-preview-table');
5685
+ WPTB_Helper.dataTitleColumnSet(table);
5686
+ }
5687
+ });
5688
+ var config = { attributes: true, attributeFilter: ['style'] };
5689
+ observer.observe(element.getDOMElement(), config);
5690
+ } else if (element.kind == 'star_rating') {
5691
+ var ratingStars = node.getElementsByClassName('wptb-rating-star');
5692
+ for (var _i2 = 0; _i2 < ratingStars.length; _i2++) {
5693
+ var ratingStar = ratingStars[_i2];
5694
+
5695
+ WPTB_Helper.starRatingEventHandlersAdd(ratingStar);
5696
+
5697
+ var ritingStarZeroSet = ratingStar.querySelector('.wptb-rating-star-zero-set');
5698
+ if (ritingStarZeroSet) {
5699
+ ritingStarZeroSet.onclick = function (event) {
5700
+ var ulStarList = WPTB_Helper.findAncestor(event.target, 'wptb-rating-stars-list');
5701
+ if (ulStarList) {
5702
+ var children = ulStarList.children;
5703
+ for (var _i3 = 0; _i3 < children.length; _i3++) {
5704
+ children[_i3].classList.remove('wptb-rating-star-selected-full');
5705
+ children[_i3].classList.remove('wptb-rating-star-selected-half');
5706
+ }
5707
+ }
5708
+ };
5709
+ }
5710
+ }
5711
+ }
5712
+
5713
+ var node_wptb_element_kind_num = node.className.match(/wptb-element-(.+)-(\d+)/i);
5714
+ if (node_wptb_element_kind_num) {
5715
+ node.classList.remove(node_wptb_element_kind_num[0]);
5716
+ }
5717
+ if (!node.classList.contains('wptb-ph-element')) {
5718
+ node.classList.add('wptb-ph-element');
5719
+ if (!node.classList.contains('wptb-element-' + element.kind + '-' + index)) {
5720
+ node.classList.add('wptb-element-' + element.kind + '-' + index);
5721
+ }
5722
+ } else {
5723
+ if (!node.classList.contains('wptb-element-' + element.kind + '-' + index)) {
5724
+ node.classList.add('wptb-element-' + element.kind + '-' + index);
5725
+ }
5726
+ }
5727
+ new WPTB_ElementOptions(element, index, kindIndexProt);
5728
+
5729
+ document.counter.increment(element.kind);
5730
+ };
5731
+
5732
  //# sourceMappingURL=admin.js.map
inc/admin/js/admin.js.map CHANGED
@@ -1 +1 @@
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","wptbMovingMode","getDOMParentElement","nodeName","toLowerCase","innerElement","innerElementNext","console","log","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","elementsA","imgAlign","float","imageAlignmentSelect","imageLinkHref","inputImageLink","imageLinkTarget","imageLinkTargetInput","imageLinkTargetInputId","imageLinkTargetInputLabel","imgWidth","imageWidthInputRange","imageWidthInputNumber","img","imgAlternativeText","imageAlternativeTextInput","elementFontSize","fontSize","elementTextColor","textFontSizeInputRange","textFontSizeInputNumber","textColorInput","elementList","elementListColor","listColorInput","elementListItem","listItemP","listItemPClasses","elementListClassSelect","listIconSelectLabel","nodeType","listIconSelectLabelId","elementListStyleTypeSelect","elementListItemContent","listItemPTextAlignArr","p","textAlign","listItemPTextAlignLeftCount","listItemPTextAlignCenterCount","listItemPTextAlignRightCount","elementListAlignmentSelect","maxListItemTAlLeftC","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","wptbImageFloatValue","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","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","onbeforeunload","wptbSaveDisabled","wptbTableStateNumberSave","wptbTableStateNumberShow","bar","wptb_admin_object","t","messagingArea","WPTB_Stringifier","outerHTML","messagingAreaText","params","security_code","rs","wptbId","stringify","data","wptbPreviewBtn","wptbPreviewBtnHref","previewHref","wptbSaveBtn","elSpaceBetween","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","wptbNewPreviewTable","wptbHighlighted","cssForTdsWidthAutoValue","datawptbUndoredo","wptbLeftScrollPanelCellSetting","elText2","elP"],"mappings":"AAAA,IAAIA,2BAA2B,SAA3BA,wBAA2B,CAAWC,OAAX,EAAoBC,aAApB,EAAkD;AAAA,QAAfC,IAAe,uEAAR,KAAQ;;AAC7E,QAAIC,OAAOH,QAAQI,aAAR,EAAX;AAAA,QACIC,KADJ;AAAA,QAEIC,SAFJ;AAAA,QAGIJ,IAHJ;;AAKA,QAAKD,iBAAiBM,SAAjB,IAA8BL,QAAQ,IAA3C,EAAkD;AAC9CG,gBAAQG,SAASC,OAAT,CAAiBC,SAAjB,CAA4BV,QAAQW,IAApC,CAAR;AACA,YAAIC,eAAeJ,SAASK,sBAAT,CAAiC,iBAAjC,CAAnB;AACA,YAAIC,oBAAoB,EAAxB;AACA,aAAK,IAAIC,IAAI,CAAb,EAAgBA,IAAIH,aAAaI,MAAjC,EAAyCD,GAAzC,EAA+C;AAC3C,gBAAIE,QAAQ,IAAIC,MAAJ,CAAY,kBAAkBlB,QAAQW,IAA1B,GAAiC,SAA7C,EAAwD,GAAxD,CAAZ;AACA,gBAAIQ,SAASP,aAAaG,CAAb,EAAgBK,SAAhB,CAA0BC,KAA1B,CAAiCJ,KAAjC,CAAb;AACA,gBAAIE,MAAJ,EAAa;AACTL,kCAAkBQ,IAAlB,CAAwBH,OAAO,CAAP,CAAxB;AACH;AACJ;AACD,YAAIL,kBAAkBE,MAAlB,GAA2B,CAA/B,EAAmC;AAC/B,gBAAIO,kBAAkBC,KAAKC,GAAL,aAAaX,iBAAb,CAAtB;AACAT,oBAA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,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 element.wptbMovingMode = 1;\r\n }\r\n \r\n let td;\r\n if( wptbDropHandle.dataset.text == 'Drop Here' ) {\r\n thisElem = wptbDropHandle.getDOMParentElement();\r\n if ( thisElem.nodeName.toLowerCase() == 'td' ) {\r\n td = wptbDropHandle.getDOMParentElement();\r\n td.appendChild( element );\r\n }\r\n } else {\r\n let innerElement = wptbDropHandle.getDOMParentElement();\r\n td = innerElement.parentNode;\r\n \r\n if( wptbDropHandle.dataset.text == 'Above Element' ) {\r\n td.insertBefore( element, innerElement );\r\n } else if( wptbDropHandle.dataset.text == 'Below Element' ) {\r\n let innerElementNext = innerElement.nextSibling;\r\n td.insertBefore( element, innerElementNext );\r\n }\r\n }\r\n \r\n let thisRow = td.parentNode\r\n if( 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 console.log(element);\r\n if( ! element.classList.contains( 'wptb-image-container' ) || element.wptbMovingMode == 1 ) {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n element.wptbMovingMode == undefined;\r\n }\r\n }\r\n let wptbContainer = document.querySelector( '.wptb-container' );\r\n wptbContainer.onscroll = function() {\r\n wptbDropHandle.style.display = 'none';\r\n wptbDropBorderMarker.style.display = 'none';\r\n }\r\n } else {\r\n wptbDropHandle = document.getElementsByClassName( 'wptb-drop-handle' )[0];\r\n wptbDropBorderMarker = document.getElementsByClassName( 'wptb-drop-border-marker' )[0];\r\n }\r\n if( thisElem && thisElem.nodeName.toLowerCase() == 'td' && \r\n thisElem.getElementsByClassName( 'wptb-ph-element' ).length != 0 ) {\r\n return;\r\n }\r\n \r\n let thisRow;\r\n if ( thisElem.localName == 'td' ) {\r\n thisRow = thisElem.parentNode;\r\n } else if ( thisElem.localName == 'div' && thisElem.classList.contains( 'wptb-ph-element' ) ) {\r\n thisRow = thisElem.parentNode.parentNode;\r\n }\r\n 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 = 'Above Element';\r\n if ( y > height/2 ) {\r\n top = parseFloat( coordinatesElement.top ) + height - 1;\r\n wptbDropHandle.dataset.text = 'Below Element';\r\n }\r\n } else {\r\n wptbDropHandle.dataset.text = 'Drop Here';\r\n top = parseFloat( coordinatesElement.top ) + height/2 - 5;\r\n }\r\n wptbDropHandle.style.top = top + 'px';\r\n\r\n wptbDropBorderMarker.style.top = coordinatesElement.top + 'px';\r\n wptbDropBorderMarker.style.left = coordinatesElement.left + 'px';\r\n\r\n wptbDropBorderMarkerTop = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-top' );\r\n wptbDropBorderMarkerTop.style.width = ( parseFloat( thisElem.offsetWidth ) - parseFloat( 1 ) ) + 'px';\r\n\r\n wptbDropBorderMarkerRight = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-right' );\r\n wptbDropBorderMarkerRight.style.height = ( parseFloat( coordinatesElement.bottom ) - parseFloat( coordinatesElement.top ) - 1 ) + 'px';\r\n wptbDropBorderMarkerRight.style.left = wptbDropBorderMarkerTop.style.width;\r\n\r\n wptbDropBorderMarkerBottom = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-bottom' );\r\n wptbDropBorderMarkerBottom.style.width = wptbDropBorderMarkerTop.style.width;\r\n wptbDropBorderMarkerBottom.style.top = wptbDropBorderMarkerRight.style.height;\r\n\r\n wptbDropBorderMarkerLeft = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-left' );\r\n wptbDropBorderMarkerLeft.style.height = wptbDropBorderMarkerRight.style.height;\r\n}","var ElementCounters = function () {\r\n\r\n\tvar priv = [];\r\n\tpriv['text'] = 0;\r\n\tpriv['image'] = 0;\r\n\tpriv['list'] = 0;\r\n\tpriv['button'] = 0;\r\n\r\n\tthis.increment = function (key) {\r\n\t\tif (!(key in priv)) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tpriv[key]++;\r\n\t}\r\n\r\n\tthis.nextIndex = function (key) {\r\n\t\tif (!(key in priv)) {\r\n\t\t\treturn undefined;\r\n\t\t}\r\n\t\treturn priv[key] + 1;\r\n\t}\r\n\r\n\treturn this;\r\n\r\n};","var WPTB_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 // set select according to the alignment of the image\r\n let imgAlign;\r\n if( a.style.float == 'none' ) {\r\n imgAlign = 'center';\r\n } else {\r\n imgAlign = a.style.float;\r\n }\r\n let 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 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 } 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 let wptbImageFloatValue = '';\r\n if( this.value == 'center' ) {\r\n wptbImageFloatValue = 'none';\r\n } else {\r\n wptbImageFloatValue = this.value;\r\n }\r\n affectedEl.querySelector( '.wptb-image-wrapper a' ).style.float = wptbImageFloatValue;\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 = 30,\r\n MAX_ROWS = 30;\r\n\r\n var tableGenerator = document.body;\r\n columnsDecrementButton = tableGenerator.getElementsByClassName('wptb-input-number-decrement')[0],\r\n columnsIncrementButton = tableGenerator.getElementsByClassName('wptb-input-number-increment')[0],\r\n rowsDecrementButton = tableGenerator.getElementsByClassName('wptb-input-number-decrement')[1],\r\n rowsIncrementButton = tableGenerator.getElementsByClassName('wptb-input-number-increment')[1],\r\n columnsInput = document.getElementById('wptb-columns-number'),\r\n rowsInput = document.getElementById('wptb-rows-number');\r\n \r\n columnsDecrementButton.onclick = function () {\r\n if (columnsInput.value > MIN_COLUMNS) {\r\n columnsInput.value--;\r\n }\r\n };\r\n\r\n columnsIncrementButton.onclick = function () {\r\n if (columnsInput.value < MAX_COLUMNS) {\r\n columnsInput.value++;\r\n }\r\n };\r\n\r\n rowsDecrementButton.onclick = function () {\r\n if (rowsInput.value > MIN_ROWS) {\r\n rowsInput.value--;\r\n }\r\n };\r\n\r\n rowsIncrementButton.onclick = function () {\r\n if (rowsInput.value < MAX_ROWS) {\r\n rowsInput.value++;\r\n }\r\n };\r\n\r\n document.getElementById('wptb-generate-table').onclick = function () {\r\n var columns = document.getElementById('wptb-columns-number').value,\r\n rows = document.getElementById('wptb-rows-number').value;\r\n\r\n 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 window.onbeforeunload = function(e) {\r\n let wptbSaveDisabled = document.getElementsByClassName( 'wptb-save-disabled' );\r\n if( wptbSaveDisabled.length == 0 ) {\r\n return true;\r\n } else {\r\n return null;\r\n }\r\n };\r\n \r\n \r\n document.getElementsByClassName( 'wptb-popup-dark-area' )[0].onclick = function () {\r\n shortcodePopupWindow.classList.remove( 'wptb-popup-show' );\r\n }\r\n \r\n document.getElementsByClassName( 'wptb-popup-window-close-icon' )[0].onclick = function () {\r\n shortcodePopupWindow.classList.remove( 'wptb-popup-show' );\r\n }\r\n \r\n document.getElementsByClassName( 'wptb-preview-btn' )[0].onclick = function ( 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 ( event ) {\r\n if( ( ! event.target.dataset.wptbTableStateNumberSave && window.wptbTableStateNumberShow == 0 ) || \r\n window.wptbTableStateNumberShow == event.target.dataset.wptbTableStateNumberSave ) {\r\n return;\r\n }\r\n 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 event.target.dataset.wptbTableStateNumberSave = window.wptbTableStateNumberShow;\r\n \r\n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\r\n if( wptbSaveBtn.length > 0 ) {\r\n wptbSaveBtn = wptbSaveBtn[0];\r\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\r\n }\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 let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\n if( wptbSaveBtn.length > 0 ) {\n wptbSaveBtn = wptbSaveBtn[0];\n if( ( ! wptbSaveBtn.dataset.wptbTableStateNumberSave && window.wptbTableStateNumberShow == 0 ) || \n window.wptbTableStateNumberShow == wptbSaveBtn.dataset.wptbTableStateNumberSave ) {\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\n } else {\n wptbSaveBtn.classList.remove( 'wptb-save-disabled' );\n }\n }\n }\n }\n \n this.tableStateGet = ( datawptbUndoredo ) => {\n if( datawptbUndoredo && window.wptbTableStateSaving && window.wptbTableStateSaving.length > 1 ) {\n \n // changes the number of the state which displays now\n if( datawptbUndoredo == 'undo' ) {\n if( window.wptbTableStateNumberShow > 0 ) {\n window.wptbTableStateNumberShow--;\n } else {\n return false;\n }\n } else if( datawptbUndoredo == 'redo' ) {\n if( window.wptbTableStateNumberShow < window.wptbTableStateSaving.length - 1 ) {\n window.wptbTableStateNumberShow++;\n } else {\n return false;\n }\n }\n \n // add or delete class \"wptb-undoredo-disabled\" for undo button\n let wptbUndo = document.getElementsByClassName( 'wptb-undo' );\n if( wptbUndo.length > 0 ) {\n wptbUndo = wptbUndo[0];\n }\n if( window.wptbTableStateNumberShow == 0 ) {\n if( wptbUndo ) {\n wptbUndo.classList.add( 'wptb-undoredo-disabled' )\n }\n } else if( window.wptbTableStateNumberShow > 0 ) {\n if( wptbUndo ) {\n wptbUndo.classList.remove( 'wptb-undoredo-disabled' )\n }\n }\n \n // add or delete class \"wptb-undoredo-disabled\" for redo button\n let wptbRedo = document.getElementsByClassName( 'wptb-redo' );\n if( wptbRedo.length > 0 ) {\n wptbRedo = wptbRedo[0];\n }\n if( window.wptbTableStateNumberShow == window.wptbTableStateSaving.length - 1 ) {\n if( wptbRedo ) {\n wptbRedo.classList.add( 'wptb-undoredo-disabled' )\n }\n } else if( window.wptbTableStateNumberShow < window.wptbTableStateSaving.length - 1 ) {\n if( wptbRedo ) {\n wptbRedo.classList.remove( 'wptb-undoredo-disabled' )\n }\n }\n \n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\n if( wptbSaveBtn.length > 0 ) {\n wptbSaveBtn = wptbSaveBtn[0];\n if( ( ! wptbSaveBtn.dataset.wptbTableStateNumberSave && window.wptbTableStateNumberShow == 0 ) || \n window.wptbTableStateNumberShow == wptbSaveBtn.dataset.wptbTableStateNumberSave ) {\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\n } else {\n wptbSaveBtn.classList.remove( 'wptb-save-disabled' );\n }\n }\n \n // load necessary saved table state\n let wptbTableSetup = document.getElementsByClassName( 'wptb-table-setup' );\n if( wptbTableSetup.length > 0 ) {\n wptbTableSetup = wptbTableSetup[0];\n\n wptbTableSetup.innerHTML = '';\n wptbTableSetup.appendChild( window.wptbTableStateSaving[window.wptbTableStateNumberShow][0] );\n\n if( window.wptbTableStateSaving[window.wptbTableStateNumberShow][1] ) {\n let cssForTdsWidthAuto = document.createElement( 'style' );\n cssForTdsWidthAuto.setAttribute( 'data-wptb-td-auto-width', true );\n cssForTdsWidthAuto.innerHTML = window.wptbTableStateSaving[window.wptbTableStateNumberShow][1];\n let head = document.head;\n if( head ) {\n let cssForTdsWidthAutoOld = head.querySelector( 'style[data-wptb-td-auto-width=\"true\"]' );\n if( cssForTdsWidthAutoOld ) {\n head.removeChild( cssForTdsWidthAutoOld );\n }\n head.appendChild( cssForTdsWidthAuto );\n }\n }\n\n WPTB_Helper.settingsPanelClear();\n WPTB_Helper.elementOptionsPanelClear();\n WPTB_LeftPanel();\n\n let wptbLeftScrollPanelCellSetting = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ); \n if( wptbLeftScrollPanelCellSetting ) {\n wptbLeftScrollPanelCellSetting.classList.remove( 'visible' );\n }\n }\n }\n }\n}","var WPTB_Text = function ( text , DOMElementProt ) {\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":["WPTB_ActionsField.js","WPTB_Builder.js","WPTB_Button.js","WPTB_Cell.js","WPTB_DropHandle.js","WPTB_ElementCounters.js","WPTB_ElementOptions.js","WPTB_Helper.js","WPTB_Image.js","WPTB_Initializer.js","WPTB_LeftPanel.js","WPTB_List.js","WPTB_ListItem.js","WPTB_MultipleSelect.js","WPTB_Parser.js","WPTB_Parser2.js","WPTB_Settings.js","WPTB_Space.js","WPTB_StarRating.js","WPTB_Stringifier.js","WPTB_Stringifier2.js","WPTB_Table.js","WPTB_TableStateSaveManager.js","WPTB_Text.js","WPTB_innerElementSet.js","applyGenericItemSettings.js","wptb-builder.js"],"names":["WPTB_ActionsField","wptbActions","document","getElementsByClassName","length","addActionField","actionType","thisNode","body","getElementsByTagName","actions","previousNode","activeElem","classList","remove","parentNode","removeChild","btnDelete","btnCopy","btnMove","createElement","add","draggable","appendChild","type","onclick","event","act","target","el","kind","thisRow","contains","table","WPTB_Helper","findAncestor","dataTitleColumnSet","wptbActionsField","actionsRemove","wptbTableStateSaveManager","WPTB_TableStateSaveManager","tableStateSet","copy","infArr","activeElement","activeElementClone","cloneNode","className","match","td","temp","srcList","querySelectorAll","i","push","innerHTML","WPTB_List","insertBefore","getDOMElement","nextSibling","WPTB_Text","childNodes","WPTB_Image","text","querySelector","WPTB_Button","WPTB_StarRating","WPTB_innerElementSet","setParameters","ondragstart","dragImagesArr","dataTransfer","effectAllowed","setDragImage","setData","actionsHide","style","display","previous","append","wptbDirectlyhovered","action","item","parent","listItemsRecalculateIndex","coordinatesElement","getBoundingClientRect","coordinatesElementTopBegin","top","listItem","content","html","duplicate","WPTB_ListItem","listItemsTinyMceInit","firstChild","divcontent","setTimeout","coordinatesElementTopEnd","wptbContainer","correctTop","parseFloat","removeEventListener","left","right","clientWidth","addEventListener","leaveFromField","node","relatedTarget","onmouseleave","localName","opacity","WPTB_Builder","table_id","detectMode","http","XMLHttpRequest","urlSet","ajaxurl","open","setRequestHeader","onreadystatechange","d","readyState","status","ans","JSON","parse","responseText","getElementById","value","wptbTableSetupEl","WPTB_Parser","WPTB_Table","WPTB_LeftPanel","WPTB_Settings","send","counter","ElementCounters","select","MultipleSelect","initializer","WPTB_Initializer","settings","DOMElementProt","DOMElement","elButton","el_B","el_BDiv","el_BDivP","kindIndexProt","undefined","wptbElementMutch","Array","isArray","attributesContainer","attributes","setAttribute","name","wptbButtonWrapper","wptbButtonWrapAttributes","wptbButtonA","wptbButtonAttributes","wptbButton","applyGenericItemSettings","WPTB_Cell","callback","highlightRow","parentRow","columnCount","parseInt","tds","classToAdd","ttd","highlightColumn","index","rowCount","tr","padding","jQuery","val","innerBorderWidth","border","wptbPhElement","wptbSpaceBetween","j","WPTB_Space","wptbElementTypeClass","wptbTypeElementArr","split","wptbListItems","setCoords","y","x","dataset","yIndex","xIndex","getCoords","coords","appendElement","getCellDimensions","tdStyleObj","window","getComputedStyle","tdPaddingLeft","getPropertyValue","tdPaddingRight","tdBorderLeftWidth","tdBorderRightWidth","tdPaddingTop","tdPaddingBottom","tdBorderTopWidth","tdBorderBottomWidth","width","offsetWidth","height","offsetHeight","WPTB_DropHandle","thisElem","e","wptbDropHandle","wptbDropBorderMarker","wptbDropBorderMarkerTop","wptbDropBorderMarkerRight","wptbDropBorderMarkerBottom","wptbDropBorderMarkerLeft","ondragenter","ondragover","preventDefault","ondragleave","ondrop","element","getData","newElementProxy","wptbMovingMode","getDOMParentElement","nodeName","toLowerCase","innerElement","innerElementNext","console","log","onscroll","indics","types","notDragEnter","indexOf","elementDrag","offsetY","layerY","bottom","priv","increment","key","nextIndex","WPTB_ElementOptions","elemIdClass","prop","properties","affectedEl","wptbSize","b","buttonAlignment","justifyContent","buttonAlignmentSelect","selectOption","selectOptionVal","selected","buttonHref","getAttribute","buttonLinkTarget","buttonId","buttonHrefInput","buttonLinkTargetInput","buttonLinkTargetInputId","buttonLinkTargetInputLabel","buttotIdInput","checked","buttonTextColor","color","buttonColor","backgroundColor","buttonTextColorInput","buttonBackgroundColorInput","rgbToHex","elementsA","a","imgAlign","float","imageAlignmentSelect","imageLinkHref","inputImageLink","imageLinkTarget","imageLinkTargetInput","imageLinkTargetInputId","imageLinkTargetInputLabel","imgWidth","imageWidthInputRange","imageWidthInputNumber","img","imgAlternativeText","imageAlternativeTextInput","elementFontSize","fontSize","elementTextColor","textFontSizeInputRange","textFontSizeInputNumber","textColorInput","elementList","elementListColor","listColorInput","elementListItem","listItemP","listItemPClasses","elementListClassSelect","listIconSelectLabel","nodeType","listIconSelectLabelId","elementListStyleTypeSelect","elementListItemContent","listItemPTextAlignArr","p","textAlign","listItemPTextAlignLeftCount","listItemPTextAlignCenterCount","listItemPTextAlignRightCount","elementListAlignmentSelect","maxListItemTAlLeftC","Math","max","ratingStar","ratingStarSize","starSizeInputRange","starSizeInputNumber","starColorInput","ratingStarColor","fill","ratingStars","starsCountInputNumber","successBox","showNumberRatingCheckbox","numeralRatingOptionContainers","wptbTextMessage","numberRatingSize","numberRatingColor","numberSizeInputRange","numberSizeInputNumber","numberColorInput","optionsClass","children","buttons","size","n_Class","num","optionControls","wpColorPicker","change","ui","wpColorPickerChange","wpColorPickerCheckChangeForTableStateSaving","clear","numberImputSize","slider","oninput","onchange","src","alt","href","linkHttpCheckChange","rel","removeAttribute","wptbImageFloatValue","jc","id","listItems","parentNodeSettingItem","span","wptbNumeralRatingOptionContainer","starRatingTextMessageChenge","wptbTextMessageSize","lineHeight","starRatings","starRatingsCount","difference","starRatingsLast","newStarRating","starRatingEventHandlersAdd","starRatingLength","onmouseup","hexToRgb","hex","result","exec","rgb","toString","slice","getDragImageCustom","hostName","location","protocol","hostname","image","button","list","star_rating","ulElem","par","listStyleTypeIndex","Number","tinyMCE","init","inline","plugins","dialog_type","theme","menubar","fixed_toolbar_container","paste_as_text","toolbar","setup","ed","on","article","keyCode","innerText","pText","replace","trim","selectedText","getSelectionText","wptbListItem","onblur","init_instance_callback","editor","currentEditor","totalWidth","scrollTop","bodyElement","position","buttonsTinyMceInit","wptbButtonContainer","link","linkArr","linkClean","rows","rowHead","computedStyleRowHead","rowHeadChildren","contentsForHeader","tdElements","textContent","thisRowChildren","wptbTitleColumn","wptbTitleColumnFontSize","wptbTitleColumnColor","wptbTitleBackgroundColor","wptbTitleAlign","cls","parentElement","txt","getSelection","selection","createRange","settingsPanelClear","wpColorPickerClear","elementOptionsPanelClear","elementOptionsGroup","originalEvent","wpPickerContainer","irisSquareHandle","uiSliderHandle","attribute","isId","input","newInput","url","regex","RegExp","results","decodeURIComponent","getColumnWidth","cell","xIndexes","cellWidth","getRowHeight","yIndexes","cellHeight","uiColor","classe","ps","number","starRatingSelectHoverSet","starRating","onStar","onmouseover","stopPropagation","onmouseout","wptbStarRatingContainer","wptbNumberInputs","maxCount","maxValue","onkeydown","thisValue","String","substring","onkeyup","starRatingContainer","ratingNumber","wptbTextMessageCommon","wptbTextMessageCommonVal","elImage","anchor","file_frame","wp","media","frames","title","multiple","attachment","state","get","first","toJSON","imgSrc","MIN_COLUMNS","MIN_ROWS","MAX_COLUMNS","MAX_ROWS","tableGenerator","columnsDecrementButton","columnsIncrementButton","rowsDecrementButton","rowsIncrementButton","columnsInput","rowsInput","columns","wptbElementButtons","wptbTdBgColorSavedSet","inputId","trNumber","tableRows","trBackgroundColor","wptbEvenRowBg","tableHeader","tableAdaptiveForMobile","wptbAdaptiveTableCheckbox","wptbAdaptiveTable","tableTopRowAsHeadSavedSet","wptbTopRowAsHeader","tableBorderColorWidthSavedSet","tableBorderColor","borderColor","tableBorderColorInput","tableBorderWidth","borderWidth","wptbTableBorderWidthSlider","wptbTableBorderWidthNumber","tableTd","applyInnerBorder","innerBorderCheckInput","wptbApplyInnerBorder","wptbTableInnerBorderSlider","wptbTableInnerBorderNumber","tableCells","tableInnerborderNumber","addInnerBorderSize","borderStyle","addCellPadding","addInnerBorder","styles","wptbPreviewTable","marginBottom","addBorderSize","cellPaddingSavedSet","wptbTableCellSlider","wptbTableCellNumber","wptbTableBorderNumber","wptbTextfontSizeNumber","wptbImageWidthNumber","wptbTableColumnWidthNumber","wptbTableRowHeightNumber","tdDefaultWidth","wptbInnerBorderCheck","tableBorderColorSetArea","addColumnWidth","highlighted","addRowHeight","createMobileHeadForTable","thisEvent","wptbElement","toggleTableEditMode","addRowToTheEnd","addRowToTheStart","addRowBefore","addRowAfter","addColumnEnd","addColumnStart","addColumnBefore","addColumnAfter","deleteColumn","deleteRow","mergeCells","splitCell","wptbBuilderPanel","clickOnFreeSpace","wptbHeader","wpcdFixedToolbar","hasAttribute","innerElements","el_L","wptbListItemReturn","styleDot","listItemKeyListener","onmouseenter","selectedCells","multipleCellMode","activateMultipleSelectMode","deactivateMultipleSelectMode","isActivated","pushSelectedCell","flushSelectedCells","getFirst","minXIndex","minYIndex","getLast","maxXIndex","maxYIndex","last","removeAllButFirst","code","div","columnTitleMobile","WPTB_Parser2","elementHtml","createTextNode","tagName","elems","ondragend","wptbUndo","tableStateGet","wptbUndoredo","wptbUndoRedoContainer","wptbRedo","shortcodePopupWindow","onbeforeunload","wptbSaveDisabled","wptbTableStateNumberSave","wptbTableStateNumberShow","bar","wptb_admin_object","t","messagingArea","WPTB_Stringifier","outerHTML","messagingAreaText","params","security_code","rs","wptbId","stringify","data","wptbPreviewBtn","wptbPreviewBtnHref","previewHref","wptbSaveBtn","elSpaceBetween","includes","spaceBetween","t_space","spaceParent","alert","countStarts","ratingStarsBox","ratingStarsList","textMessage","filledRatingStarHtml","notFilledRatingStarHtml","halfFilledRatingStarHtml","ratingStarZeroSet","wptbRatingStarsBox","wptbRatingStarsBoxAttributes","wptbRatingStarsOld","wptbRatingStars","iMax","wptbRatingStarsAttributes","wptbRatingStarsOldSpan","wptbRatingStarsSpan","k","wptbRatingStarsOldSpanAttributes","l","wptbRatingStarsOldSvg","wptbRatingStarsOldSvgStyle","wptbSuccessBox","wptbSuccessBoxAttributes","wptbTextMessageAttributes","codeMain","tableColumns","minWidth","maxWidth","mceContentBodys","dataMceStyle","contentEditable","spellCheck","mceIds","wptbActionsLength","columnNameDivContainer","columnNameDiv","WPTB_Stringifier2","start","nodeValue","int_elem_arr","attributes_list","internal_elements","inter_elem","array","wptbTableSetup","row","maxAmountOfCells","maxAmountOfRows","mark","rowSpan","cs","colSpan","markedCells","noCells","singleCells","multipleCells","cellSettings","column","cellHighlighted","wptbTableColumnWidthSlider","tableColumnWidthAutoFixedCheckbox","wptbFixedWidth","wptbTableRowHeightSlider","tableRowHeightAutoFixedCheckbox","wptbFixedHeight","isSquare","realTimeArray","carried","cols","matriz","items","justAssigned","amount","carriedRowspans","cellsBuffer","cellPointer","xPosition","stepsToMove","celda","drawTable","string","undoSelect","fillTableArray","colspansSums","cells","colspanSumInRow","apply","getActualPointsInRow","points","search","skipInCols","reconstraction","insertRow","wptb_preview_table","cellModeBackground","leftScrollPanelCurtain","leftScrollPanelCellSettings","wptbPreviewTableTds","recalculateIndexes","trs","maxCols","maxColsFull","tdsArr","jMainIter","z","cleaner","dataXIndex","tableTdsFor","colspan","widthIsSet","arrayTdsFromPreviousRow","tableTdsSumMaxWidth","tableTdsSumMaxWidthFixed","tableTdsSumMaxWidthAuto","wptbTableSetupWidth","arrayCellsWidthFixedHelper","arrayCellsWidthAutoHelper","tdPaddingCommon","tableTdBorderCommonWidth","cssForTdsWidthAuto","wptbCssTdAutoWidth","tableTdBorderLeftWidth","tableTdBorderRightWidth","CellsWidthAutoCount","tableFullStyleObj","borderLeftWidth","borderRightWidth","tableBorderCommon","wptbTableTdsSumMaxWidth","wptbCellsWidthAutoCount","mergingСellsHorizontally","wptbFixedWidthSize","styleElementCreate","tableTdWidthAuto","tableTdsWidthAutoCommon","head","cssForTdsWidthAutoOld","dataYIndex","rowspan","heightIsSet","arrayTdsPrevious","tableColumnHeightAutoFixedCheckbox","wptbAdaptiveTableChoseBlock","mergingCellsVertically","forBreak","currentTable","currentTableTd","currentTdStyle","firstCell","c_pos","cellStyle","pos","pendingInsertion","bro","currentCell","r","aux","from","cellNew","rowChildren","rowChildrenLength","cellRowSpan","rowAfter","cellsColSpan","tableRowsIChildren","tableRIChildrenLength","rowIRowSpan","rNext","rNextChildren","rNextChildrenLength","rowStart","columnStart","rowEnd","columnEnd","itemsEstimate","dimensions","call","tdsChildrenNew","tdsInternalElements","tdsIntElemLength","firstWidth","firstDataFixedWidth","firstHeight","firstDataFixedHeight","cellStyles","cellXIndex","rowChildInsertBefore","rowNext","findRowspannedCells","actualPoints","addLackingCells","sumRows","totalColspan","nextRow","nextRowChildren","nextRowChildrenLength","tdArr","nextRowChildrenK","jRowChildren","pop","onresize","wptbTableStateSaving","wptbNewPreviewTable","wptbHighlighted","cssForTdsWidthAutoValue","datawptbUndoredo","wptbLeftScrollPanelCellSetting","elText2","elP","classId","wptbElements","elementIndexesArr","elementIndexMax","kindIndexProtArr","force_br_newlines","force_p_newlines","forced_root_block","observer","MutationObserver","mutations","config","attributeFilter","observe","ritingStarZeroSet","ulStarList","node_wptb_element_kind_num"],"mappings":"AAAA,IAAIA,oBAAoB,SAApBA,iBAAoB,GAAW;AAAA;;AAC/B;AACA,SAAKC,WAAL;AACA,QAAIC,SAASC,sBAAT,CAAiC,cAAjC,EAAkDC,MAAlD,IAA4D,CAAhE,EAAoE;AAChE,aAAKH,WAAL,GAAmBC,SAASC,sBAAT,CAAiC,cAAjC,EAAkD,CAAlD,CAAnB;AACH;;AAED,SAAKE,cAAL,GAAsB,UAAEC,UAAF,EAAcC,QAAd,EAA4B;AAC9C,YAAIC,OAAON,SAASO,oBAAT,CAA+B,MAA/B,EAAwC,CAAxC,CAAX;;AAEA,YAAIC,UAAUR,SAASC,sBAAT,CAAiC,cAAjC,CAAd;AACA,YAAIO,QAAQN,MAAR,IAAkB,CAAtB,EAA0B;AACtB,gBAAIO,eAAeD,QAAQ,CAAR,EAAWE,UAA9B;AACA,gBAAID,YAAJ,EAAmB;AACfA,6BAAaE,SAAb,CAAuBC,MAAvB,CAA+B,sBAA/B;AACH;;AAED,mBAAOJ,QAAQN,MAAR,IAAkB,CAAzB,EAA6B;AACzBM,wBAAQ,CAAR,EAAWK,UAAX,CAAsBC,WAAtB,CAAmCN,QAAQ,CAAR,CAAnC;AACH;AACJ;;AAED,YAAIJ,cAAc,CAAlB,EAAsB;;AAElB,gBAAIW,kBAAJ;AAAA,gBAAeC,gBAAf;AAAA,gBAAwBC,gBAAxB;;AAEAF,wBAAYf,SAASkB,aAAT,CAAwB,MAAxB,CAAZ,EACAF,UAAUhB,SAASkB,aAAT,CAAwB,MAAxB,CADV,EAEAD,UAAUjB,SAASkB,aAAT,CAAwB,MAAxB,CAFV,EAGAV,UAAUR,SAASkB,aAAT,CAAwB,KAAxB,CAHV;;AAKAV,oBAAQG,SAAR,CAAkBQ,GAAlB,CAAuB,cAAvB;AACAJ,sBAAUJ,SAAV,CAAoBQ,GAApB,CAAyB,W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Q1M,IAA1B,GAAiC,GAAjC,GAAuCkJ,KAAhE,CAAN,EAAgF;AAC5EpE,iBAAK/F,SAAL,CAAeQ,GAAf,CAAoB,kBAAkBmN,QAAQ1M,IAA1B,GAAiC,GAAjC,GAAuCkJ,KAA3D;AACH;AACJ;AACD,QAAIgF,mBAAJ,CAAyBxB,OAAzB,EAAkCxD,KAAlC,EAAyCzB,aAAzC;;AAEArJ,aAASwI,OAAT,CAAiBmH,SAAjB,CAA2BrB,QAAQ1M,IAAnC;AACH,CA/LD;ACAA","file":"admin.js","sourcesContent":["var WPTB_ActionsField = function() {\n //this.wptbBorderMarker;\n this.wptbActions;\n if( document.getElementsByClassName( 'wptb-actions' ).length != 0 ) {\n this.wptbActions = document.getElementsByClassName( 'wptb-actions' )[0];\n }\n \n this.addActionField = ( actionType, thisNode ) => {\n let body = document.getElementsByTagName( 'body' )[0];\n \n let actions = document.getElementsByClassName( 'wptb-actions' );\n if( actions.length != 0 ) {\n let previousNode = actions[0].activeElem;\n if( previousNode ) {\n previousNode.classList.remove( 'wptb-directlyhovered' );\n }\n \n while( actions.length != 0 ) {\n actions[0].parentNode.removeChild( actions[0] );\n }\n }\n \n if( actionType == 1 ) {\n \n let btnDelete, btnCopy, btnMove;\n\n btnDelete = document.createElement( 'span' ),\n btnCopy = document.createElement( 'span' ),\n btnMove = document.createElement( 'span' ),\n actions = document.createElement( 'div' );\n\n actions.classList.add( 'wptb-actions' );\n btnDelete.classList.add( 'dashicons', 'dashicons-trash', 'wptb-delete-action' );\n btnCopy.classList.add( 'dashicons', 'dashicons-admin-page', 'wptb-duplicate-action' );\n btnMove.classList.add( \"dashicons\", \"dashicons-move\", 'wptb-move-action' );\n btnMove.draggable = true;\n\n actions.appendChild( btnMove );\n actions.appendChild( btnCopy );\n actions.appendChild( btnDelete );\n body.appendChild( actions );\n\n actions.activeElem = thisNode;\n\n actions.type = 1;\n\n btnDelete.onclick = function( event ) {\n let act = event.target.parentNode.activeElem,\n el = act.parentNode;\n el.removeChild(act);\n\n if( act.kind == 'text' ) {\n let thisRow = el.parentNode\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\n WPTB_Helper.dataTitleColumnSet( table );\n }\n }\n\n let wptbActionsField = new WPTB_ActionsField();\n\n wptbActionsField.actionsRemove();\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n\n\n btnCopy.onclick = ( event ) => {\n let copy,\n infArr,\n type;\n let activeElement = event.target.parentNode.activeElem;\n let activeElementClone = activeElement.cloneNode( true );\n activeElementClone.classList.remove( 'wptb-directlyhovered' );\n infArr = activeElement.className.match(/wptb-element-(.+)-(\\d+)/i);\n type = infArr[1];\n let td = activeElement.parentNode;\n if ( type == 'list' ) {\n var temp = [],\n srcList = activeElement.querySelectorAll('ul li .wptb-list-item-content');\n\n for (var i = 0; i < srcList.length; i++) {\n temp.push(srcList[i].innerHTML);\n }\n\n copy = new WPTB_List( temp, activeElementClone );\n\n td.insertBefore( copy.getDOMElement(), activeElement.nextSibling );\n } else if ( type == 'text' ) {\n copy = new WPTB_Text( activeElementClone.childNodes[0].innerHTML, activeElementClone );\n\n td.insertBefore( copy.getDOMElement(), activeElement.nextSibling );\n } else if ( type == 'image' ) {\n copy = new WPTB_Image( '', activeElement );\n \n td.insertBefore( copy.getDOMElement(), activeElement.nextSibling );\n } else if( type == 'button' ) {\n let text = activeElementClone.childNodes[0].querySelector( 'p' ).innerHTML;\n \n copy = new WPTB_Button( text, activeElementClone );\n\n td.insertBefore( copy.getDOMElement(), activeElement.nextSibling );\n } else if( type = 'star_rating' ) {\n copy = new WPTB_StarRating( activeElementClone );\n\n td.insertBefore( copy.getDOMElement(), activeElement.nextSibling );\n }\n\n WPTB_innerElementSet( copy.getDOMElement() );\n\n let wptbActionsField = new WPTB_ActionsField( 1, activeElement );\n \n wptbActionsField.setParameters( activeElement );\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n btnMove.ondragstart = ( event ) => {\n let dragImagesArr = WPTB_Helper.dragImagesArr(),\n actions = event.target.parentNode,\n activeElem = actions.activeElem,\n infArr,\n type;\n infArr = activeElem.className.match(/wptb-element-(.+)-(\\d+)/i);\n type = infArr[1];\n activeElem.classList.add( 'wptb-moving-mode' );\n\n event.dataTransfer.effectAllowed = 'move';\n event.dataTransfer.setDragImage( dragImagesArr[type], 0, 0 );\n event.dataTransfer.setData( 'node', 'wptb-element-' + infArr[1] + '-' + infArr[2] );\n event.dataTransfer.setData( 'wptb-moving-mode', 'wptb-element-' + infArr[1] + '-' + infArr[2] );\n event.dataTransfer.setData( 'wptbElIndic-' + infArr[1], 'wptbElIndic-' + infArr[1] );\n let act = event.target.parentNode.activeElem;\n if( act.kind == 'text' ) {\n let thisRow = act.parentNode.parentNode;\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\n WPTB_Helper.dataTitleColumnSet( table );\n }\n }\n //actions.style.display = 'none';\n this.actionsHide();\n };\n\n //actions.style.right = '-' + parseFloat( thisNode.offsetWidth ) + 'px';\n actions.style.display = 'block';\n\n this.wptbActions = actions;\n } else if( actionType == 2 ) {\n let btnDelete,\n btnCopy,\n previous,\n i;\n\n btnDelete = document.createElement('span'),\n btnCopy = document.createElement('span'),\n actions = document.createElement('span')\n\n actions.classList.add('wptb-actions');\n btnDelete.classList.add('dashicons', 'dashicons-trash', 'wptb-delete-action');\n btnCopy.classList.add('dashicons', 'dashicons-admin-page', 'wptb-duplicate-action');\n\n actions.append( btnCopy, btnDelete );\n body.appendChild( actions );\n\n actions.activeElem = thisNode;\n \n let wptbDirectlyhovered = WPTB_Helper.findAncestor( thisNode, 'wptb-directlyhovered' );\n if( wptbDirectlyhovered ) {\n wptbDirectlyhovered.classList.remove( 'wptb-directlyhovered' );\n }\n\n actions.type = 2;\n\n btnDelete.onclick = ( event ) => {\n var action = event.target.parentNode, \n item = action.activeElem,\n parent = item.parentNode;\n let wptbActionsField = new WPTB_ActionsField( 4 );\n wptbActionsField.actionsRemove();\n parent.removeChild( item );\n WPTB_Helper.listItemsRecalculateIndex( parent );\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n btnCopy.onclick = ( event ) => {\n let coordinatesElement = thisNode.getBoundingClientRect();\n let coordinatesElementTopBegin = coordinatesElement.top;\n\n var listItem = event.target.parentNode.activeElem,\n content = listItem.querySelector( '.wptb-list-item-content' ),\n html = content.innerHTML;\n var duplicate = new WPTB_ListItem( html, listItem, true );\n listItem.parentNode.insertBefore( duplicate.getDOMElement(), thisNode.nextSibling );\n WPTB_Helper.listItemsTinyMceInit( duplicate.getDOMElement().firstChild );\n\n let divcontent = thisNode.getElementsByClassName( 'wptb-list-item-content' );\n if( divcontent.length > 0 ) {\n divcontent = divcontent[0];\n }\n setTimeout( function(){\n divcontent.innerHTML = html;\n WPTB_Helper.listItemsRecalculateIndex( listItem.parentNode );\n }, 5 );\n\n coordinatesElement = thisNode.getBoundingClientRect();\n let coordinatesElementTopEnd = coordinatesElement.top;\n\n if( coordinatesElementTopBegin != coordinatesElementTopEnd ) {\n let wptbActionsField = new WPTB_ActionsField( 2, thisNode );\n wptbActionsField.setParameters( thisNode );\n }\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n actions.style.display = 'block';\n\n this.wptbActions = actions;\n }\n }\n \n this.setParameters = ( thisNode ) => {\n if( ! this.wptbActions ) {\n let actions = document.getElementsByClassName( 'wptb-actions' );\n if( actions.length > 0 ) {\n this.wptbActions = actions[0];\n }\n }\n \n if( this.wptbActions ) {\n this.wptbActions.style.display = 'block';\n }\n \n let coordinatesElement = thisNode.getBoundingClientRect();\n \n let wptbContainer = document.getElementsByClassName( 'wptb-container' )[0];\n let correctTop = () => {\n let coordinatesElement = thisNode.getBoundingClientRect();\n this.wptbActions.style.top = parseFloat( coordinatesElement.top ) - 15 + 'px';\n }\n wptbContainer.removeEventListener( 'scroll', correctTop, false );\n \n this.wptbActions.style.top = parseFloat( coordinatesElement.top ) - 15 + 'px';\n this.wptbActions.style.left = ( parseFloat( coordinatesElement.right ) - parseFloat( this.wptbActions.clientWidth ) ) + 1 + 'px';\n\n// let wptbBorderMarkerTop = this.wptbBorderMarker.querySelector( '.wptb-border-marker-top' );\n// wptbBorderMarkerTop.style.width = ( parseFloat( thisNode.offsetWidth ) + 3 ) + 'px';\n//\n// let wptbBorderMarkerRight = this.wptbBorderMarker.querySelector( '.wptb-border-marker-right' );\n// wptbBorderMarkerRight.style.height = ( parseFloat( coordinatesElement.bottom ) - parseFloat( coordinatesElement.top ) + 4 ) + 'px';\n// wptbBorderMarkerRight.style.left = ( parseFloat( thisNode.offsetWidth ) + 3 ) + 'px';\n//\n// let wptbBorderMarkerBottom = this.wptbBorderMarker.querySelector( '.wptb-border-marker-bottom' );\n// wptbBorderMarkerBottom.style.width = wptbBorderMarkerTop.style.width;\n// wptbBorderMarkerBottom.style.top = ( parseFloat( coordinatesElement.bottom ) - parseFloat( coordinatesElement.top ) + 3 ) + 'px';;\n//\n// let wptbBorderMarkerLeft = this.wptbBorderMarker.querySelector( '.wptb-border-marker-left' );\n// \n \n //this.wptbBorderMarker.style.display = 'block';\n this.wptbActions.style.display = 'block';\n thisNode.classList.add( 'wptb-directlyhovered' );\n \n wptbContainer.addEventListener( 'scroll', correctTop, false );\n }\n \n// if( actionType == 1 || actionType == 2 ) {\n// this.setParameters( thisNode );\n// }\n// } else {\n// this.wptbActions.style.display = 'block';\n// thisNode.classList.add( 'wptb-directlyhovered' );\n// }\n \n this.leaveFromField = ( event, node, actionType ) => {\n if( event.relatedTarget ) {\n if ( event.relatedTarget.classList.contains( 'wptb-actions' ) ||\n event.relatedTarget.classList.contains( 'wptb-move-action' ) ||\n event.relatedTarget.classList.contains( 'wptb-duplicate-action' ) ||\n event.relatedTarget.classList.contains( 'wptb-delete-action' ) ) {\n if( ! this.wptbActions ) {\n this.wptbActions = document.getElementsByClassName( 'wptb-actions' )[0];\n }\n this.wptbActions.onmouseleave = ( event ) => {\n if( event.relatedTarget != null && event.relatedTarget != this.wptbActions.activeElem &&\n WPTB_Helper.findAncestor( event.relatedTarget, 'wptb-directlyhovered') != this.wptbActions.activeElem ) {\n event.target.activeElem.classList.remove( 'wptb-directlyhovered' );\n this.wptbActions.style.display = 'none';\n\n if( this.wptbActions.type == 2 ) {\n let wptbActionsField = new WPTB_ActionsField();\n\n wptbActionsField.addActionField( 1, event.relatedTarget.parentNode.parentNode );\n\n wptbActionsField.setParameters( event.relatedTarget.parentNode.parentNode );\n }\n } else {\n return;\n }\n }\n\n return;\n } \n// else if( event.relatedTarget.classList.contains( 'wptb-drop-handle' ) ) {\n// let wptbDropHandle = document.getElementsByClassName( 'wptb-drop-handle' );\n// if( wptbDropHandle.length > 0 ) {\n// wptbDropHandle = wptbDropHandle[0];\n// wptbDropHandle.onmouseleave\n// }\n// }\n }\n \n node.classList.remove( 'wptb-directlyhovered' );\n this.wptbActions.style.display = 'none';\n \n if( this.wptbActions.type == 2 ) {\n if( event.relatedTarget ) {\n if( event.relatedTarget.localName == 'ul' ) {\n //let wptbActionsField = new WPTB_ActionsField();\n\n this.addActionField( 1, event.relatedTarget.parentNode );\n\n this.setParameters( event.relatedTarget.parentNode );\n }\n }\n \n }\n }\n \n this.actionsRemove = () => {\n if( ! this.wptbActions ) {\n let actions = document.getElementsByClassName( 'wptb-actions' );\n if( actions.length > 0 ) {\n this.wptbActions = actions[0];\n }\n }\n \n if( this.wptbActions ) {\n this.wptbActions.parentNode.removeChild( this.wptbActions );\n }\n }\n \n this.actionsHide = () => {\n if( ! this.wptbActions ) {\n let actions = document.getElementsByClassName( 'wptb-actions' );\n if( actions.length > 0 ) {\n this.wptbActions = actions[0];\n }\n }\n \n if( this.wptbActions ) {\n this.wptbActions.style.opacity = 0;\n }\n }\n}","(function () {\n var WPTB_Builder = function () {\n var table_id = WPTB_Helper.detectMode();\n if ( table_id ) {\n var http = new XMLHttpRequest(),\n urlSet = ajaxurl + \"?action=get_table\" + '&id=' + table_id;\n http.open('GET', urlSet, true);\n http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');\n http.onreadystatechange = function (d) {\n if (this.readyState == 4 && this.status == 200) {\n var ans = JSON.parse(http.responseText);\n document.getElementById('wptb-setup-name').value = ans[0];\n \n if( ans[1] ) {\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'none';\n let wptbTableSetupEl = document.getElementsByClassName('wptb-table-setup')[0];\n wptbTableSetupEl.appendChild( WPTB_Parser( ans[1] ) );\n WPTB_Table();\n WPTB_LeftPanel();\n WPTB_Settings();\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n } else {\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\n }\n \n return;\n }\n };\n http.send(null);\n } else {\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\n }\n document.counter = new ElementCounters();\n document.select = new MultipleSelect();\n\n var initializer = WPTB_Initializer();\n settings = WPTB_Settings();\n };\n\n document.addEventListener('DOMContentLoaded', WPTB_Builder);\n})();","var WPTB_Button = function( text, DOMElementProt ) {\n \n var DOMElement = document.createElement('div'),\n elButton = document.createElement('div'),\n el_B = document.createElement('a'),\n el_BDiv = document.createElement( 'div' ),\n el_BDivP = document.createElement( 'p' ),\n kindIndexProt = undefined,\n copy = false;\n\n DOMElement.classList.add('wptb-button-container', 'wptb-size-M', 'wptb-');\n elButton.classList.add('wptb-button-wrapper');\n el_BDiv.classList.add('wptb-button');\n el_BDivP.innerHTML = text != undefined ? text : 'Button Text';\n \n // Creation of a new button when copying to avoid errors when assigning new event handlers.\n if ( DOMElementProt ) {\n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\n kindIndexProt = wptbElementMutch[1];\n copy = true;\n }; \n var attributesContainer = [...DOMElementProt.attributes];\n if ( attributesContainer.length > 0 ) {\n for( let i = 0; i < attributesContainer.length; i++ ) {\n DOMElement.setAttribute(attributesContainer[i].name, attributesContainer[i].value);\n } \n }\n \n var wptbButtonWrapper = DOMElementProt.querySelector( '.wptb-button-wrapper' );\n if ( wptbButtonWrapper ) {\n var wptbButtonWrapAttributes = [...wptbButtonWrapper.attributes];\n if ( wptbButtonWrapAttributes.length > 0 ) {\n for( let i = 0; i < wptbButtonWrapAttributes.length; i++ ) {\n if ( wptbButtonWrapAttributes[i].name == 'style') {\n elButton.setAttribute( wptbButtonWrapAttributes[i].name, wptbButtonWrapAttributes[i].value );\n }\n } \n }\n }\n \n var wptbButtonA = DOMElementProt.querySelector( 'a' );\n if ( wptbButtonA ) {\n var wptbButtonAttributes = [...wptbButtonA.attributes];\n if ( wptbButtonAttributes.length > 0 ) {\n for( let i = 0; i < wptbButtonAttributes.length; i++ ) {\n if ( wptbButtonAttributes[i].name == 'style' || \n wptbButtonAttributes[i].name == 'href' || \n wptbButtonAttributes[i].name == 'target' ) {\n el_B.setAttribute( wptbButtonAttributes[i].name, wptbButtonAttributes[i].value );\n }\n } \n }\n }\n \n var wptbButton = DOMElementProt.querySelector( '.wptb-button' );\n if ( wptbButton ) {\n var wptbButtonAttributes = [...wptbButton.attributes];\n if ( wptbButtonAttributes.length > 0 ) {\n for( let i = 0; i < wptbButtonAttributes.length; i++ ) {\n if ( wptbButtonAttributes[i].name == 'style') {\n el_BDiv.setAttribute( wptbButtonAttributes[i].name, wptbButtonAttributes[i].value );\n }\n } \n }\n }\n }\n \n elButton.appendChild(el_B);\n el_B.appendChild( el_BDiv );\n el_BDiv.appendChild( el_BDivP );\n DOMElement.appendChild(elButton);\n \n \n \n this.kind = 'button';\n\n this.getDOMElement = function () {\n return DOMElement;\n };\n\n applyGenericItemSettings( this, kindIndexProt, copy );\n \n return this;\n};","var WPTB_Cell = function (callback, DOMElement) {\n\n function highlightRow(td) {\n var parentRow = td.parentNode,\n columnCount = parseInt(document.getElementById('wptb-columns-number').value),\n tds = document.getElementsByClassName('wptb-preview-table')[0].getElementsByTagName('td');\n for (var i = 0; i < tds.length; i++) {\n tds[i].classList.remove('wptb-highlighted-row-first', 'wptb-highlighted-row-last', 'wptb-highlighted-row-inner', 'wptb-highlighted-column-first', 'wptb-highlighted-column-last', 'wptb-highlighted-column-inner');\n }\n for (var i = 0; i < columnCount; i++) {\n\n var classToAdd = i == 0 ? 'wptb-highlighted-row-first' : i == columnCount - 1 ? 'wptb-highlighted-row-last' : 'wptb-highlighted-row-inner';\n var ttd = parentRow.getElementsByTagName('td')[i];\n if (ttd !== td) {\n ttd.classList.add(classToAdd);\n }\n }\n }\n\n function highlightColumn(td) {\n\n var index,\n parentRow = td.parentNode;\n columnCount = parseInt(document.getElementById('wptb-columns-number').value), rowCount = parseInt(document.getElementById('wptb-rows-number').value), table = document.getElementsByClassName('wptb-preview-table')[0];\n for (var i = 0; i < columnCount; i++) {\n if (parentRow.getElementsByTagName('td')[i] === td) {\n index = i;\n break;\n }\n }\n\n for (var i = 0; i < rowCount; i++) {\n var classToAdd = i == 0 ? 'wptb-highlighted-column-first' : i == rowCount - 1 ? 'wptb-highlighted-column-last' : 'wptb-highlighted-column-inner';\n var tr = table.getElementsByTagName('tr')[i];\n if (tr.getElementsByTagName('td')[index] !== td) {\n tr.getElementsByTagName('td')[index].classList.add(classToAdd);\n }\n }\n }\n \n if( ! DOMElement ) {\n DOMElement = document.createElement(\"td\");\n\n DOMElement.style.padding = jQuery('#wptb-table-padding-number').val() + 'px';\n\n var innerBorderWidth = jQuery('#wptb-table-inner-border-number').val();\n\n if (innerBorderWidth != '' && parseInt(innerBorderWidth) != 0) {\n DOMElement.style.border = innerBorderWidth + 'px solid ' + jQuery('#wptb-table-border-color').val();\n } \n\n DOMElement.classList.add('wptb-droppable', 'wptb-cell');\n }\n\n DOMElement.draggable = false;\n if ( callback ) {\n DOMElement.onclick = callback;\n }\n \n WPTB_innerElementSet( DOMElement );\n \n let wptbPhElement = DOMElement.getElementsByClassName( 'wptb-ph-element' );\n \n if ( wptbPhElement.length > 0 ) {\n for( let i = 0; i < wptbPhElement.length; i++ ) {\n\n let wptbSpaceBetween = DOMElement.getElementsByClassName( 'wptb-space-between' );\n\n if ( wptbSpaceBetween.length > 0 ) {\n for( let j = 0; j < wptbSpaceBetween.length; j++ ) {\n WPTB_Space( wptbSpaceBetween[j] );\n }\n }\n \n wptbPhElement[i].getDOMElement = function() {\n return wptbPhElement[i];\n }\n \n WPTB_innerElementSet( wptbPhElement[i] );\n \n let wptbElementTypeClass = wptbPhElement[i].className.match( /wptb-element-((.+-)\\d+)/i );\n if( wptbElementTypeClass && Array.isArray( wptbElementTypeClass ) ) {\n let wptbTypeElementArr = wptbElementTypeClass[1].split( '-' );\n wptbPhElement[i].kind = wptbTypeElementArr[0];\n applyGenericItemSettings( wptbPhElement[i], wptbElementTypeClass[1] );\n if ( wptbPhElement[i].kind == 'list' ) {\n let wptbListItems = wptbPhElement[i].getElementsByTagName( 'li' );\n if( wptbListItems.length > 0 ) {\n for ( let i = 0; i < wptbListItems.length; i++ ) {\n WPTB_ListItem( undefined, wptbListItems[i] );\n }\n }\n }\n }\n }\n }\n\n this.getDOMElement = function () {\n return DOMElement;\n };\n\n this.setCoords = function (y, x) {\n var el = this.getDOMElement();\n el.dataset.yIndex = y;\n el.dataset.xIndex = x;\n };\n\n this.getCoords = function () {\n var coords,\n el = this.getDOMElement();\n coords.x = el.dataset.xIndex;\n coords.y = el.dataset.yIndex;\n return coords;\n };\n\n this.appendElement = function (node) {\n getDOMElement().appendChild(node);\n };\n \n DOMElement.getCellDimensions = function() {\n let tdStyleObj = window.getComputedStyle( this, null );\n \n let tdPaddingLeft = tdStyleObj.getPropertyValue( 'padding-left' );\n let tdPaddingRight = tdStyleObj.getPropertyValue( 'padding-right' );\n \n let tdBorderLeftWidth = tdStyleObj.getPropertyValue( 'border-left-width' );\n let tdBorderRightWidth = tdStyleObj.getPropertyValue( 'border-right-width' );\n \n let tdPaddingTop = tdStyleObj.getPropertyValue( 'padding-top' );\n let tdPaddingBottom = tdStyleObj.getPropertyValue( 'padding-bottom' );\n \n let tdBorderTopWidth = tdStyleObj.getPropertyValue( 'border-top-width' );\n let tdBorderBottomWidth = tdStyleObj.getPropertyValue( 'border-bottom-width' );\n \n let width = parseFloat( this.offsetWidth, 10 ) - \n parseFloat( tdPaddingLeft, 10 ) - \n parseFloat( tdPaddingRight, 10 ) -\n parseFloat( tdBorderLeftWidth, 10 ) -\n parseFloat( tdBorderRightWidth, 10 );\n \n let height = parseFloat( this.offsetHeight, 10 ) - \n parseFloat( tdPaddingTop, 10 ) - \n parseFloat( tdPaddingBottom, 10 ) -\n parseFloat( tdBorderTopWidth, 10 ) -\n parseFloat( tdBorderBottomWidth, 10 );\n \n return {\n width: width, \n height: height\n };\n }\n\n return this;\n};","var WPTB_DropHandle = function (thisElem, e) {\n \n let wptbDropHandle,\n wptbDropBorderMarker;\n if ( document.getElementsByClassName( 'wptb-drop-handle' ).length == 0 ) {\n wptbDropHandle = document.createElement( 'div' );\n wptbDropHandle.classList.add( 'wptb-drop-handle' );\n \n wptbDropBorderMarker = document.createElement( 'div' );\n wptbDropBorderMarker.classList.add( 'wptb-drop-border-marker' );\n \n let wptbDropBorderMarkerTop = document.createElement( 'div' ),\n wptbDropBorderMarkerRight = document.createElement( 'div' ),\n wptbDropBorderMarkerBottom = document.createElement( 'div' ),\n wptbDropBorderMarkerLeft = document.createElement( 'div' );\n \n wptbDropBorderMarkerTop.classList.add( 'wptb-drop-border-marker-top' );\n wptbDropBorderMarkerRight.classList.add( 'wptb-drop-border-marker-right' );\n wptbDropBorderMarkerBottom.classList.add( 'wptb-drop-border-marker-bottom' );\n wptbDropBorderMarkerLeft.classList.add( 'wptb-drop-border-marker-left' );\n \n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerTop );\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerRight );\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerBottom );\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerLeft );\n \n let body = document.getElementsByTagName( 'body' );\n if ( body.length > 0 ) {\n body[0].appendChild( wptbDropHandle );\n body[0].appendChild( wptbDropBorderMarker );\n }\n \n wptbDropHandle.ondragenter = function () {\n\n }\n\n wptbDropHandle.ondragover = function (e) {\n e.preventDefault();\n }\n\n wptbDropHandle.ondragleave = function () {\n\n }\n wptbDropHandle.ondrop = function (e) {\n e.preventDefault();\n let element;\n \n if ( e.dataTransfer.getData('wptbElement') ) {\n element = WPTB_Helper.newElementProxy( e.dataTransfer.getData('wptbElement') );\n element = element.getDOMElement();\n } else {\n element = document.getElementsByClassName( e.dataTransfer.getData('node') )[0];\n element.classList.remove( 'wptb-moving-mode' );\n element.classList.remove( 'wptb-moving-into-same-elem' );\n element.wptbMovingMode = 1;\n }\n \n let td;\n if( wptbDropHandle.dataset.text == 'Drop Here' ) {\n thisElem = wptbDropHandle.getDOMParentElement();\n if ( thisElem.nodeName.toLowerCase() == 'td' ) {\n td = wptbDropHandle.getDOMParentElement();\n td.appendChild( element );\n }\n } else {\n let innerElement = wptbDropHandle.getDOMParentElement();\n td = innerElement.parentNode;\n \n if( wptbDropHandle.dataset.text == 'Above Element' ) {\n td.insertBefore( element, innerElement );\n } else if( wptbDropHandle.dataset.text == 'Below Element' ) {\n let innerElementNext = innerElement.nextSibling;\n td.insertBefore( element, innerElementNext );\n }\n }\n \n let thisRow = td.parentNode\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\n WPTB_Helper.dataTitleColumnSet( table );\n }\n \n wptbDropHandle.style.display = 'none';\n wptbDropBorderMarker.style.display = 'none';\n \n WPTB_innerElementSet(element);\n console.log(element);\n if( ! element.classList.contains( 'wptb-image-container' ) || element.wptbMovingMode == 1 ) {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n element.wptbMovingMode == undefined;\n }\n }\n let wptbContainer = document.querySelector( '.wptb-container' );\n wptbContainer.onscroll = function() {\n wptbDropHandle.style.display = 'none';\n wptbDropBorderMarker.style.display = 'none';\n }\n } else {\n wptbDropHandle = document.getElementsByClassName( 'wptb-drop-handle' )[0];\n wptbDropBorderMarker = document.getElementsByClassName( 'wptb-drop-border-marker' )[0];\n }\n if( thisElem && thisElem.nodeName.toLowerCase() == 'td' && \n thisElem.getElementsByClassName( 'wptb-ph-element' ).length != 0 ) {\n return;\n }\n \n let thisRow;\n if ( thisElem.localName == 'td' ) {\n thisRow = thisElem.parentNode;\n } else if ( thisElem.localName == 'div' && thisElem.classList.contains( 'wptb-ph-element' ) ) {\n thisRow = thisElem.parentNode.parentNode;\n }\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\n let indics = e.dataTransfer.types;\n let notDragEnter = false;\n for ( let i = 0; i < indics.length; i++ ) {\n let infArr = indics[i].match( /wptbelindic-([a-z]+)/i );\n if ( infArr && infArr[1] != 'text' ) {\n notDragEnter = true;\n break;\n }\n }\n if( notDragEnter ) {\n return;\n }\n }\n \n wptbDropHandle.style.width = thisElem.offsetWidth + 'px';\n let height = thisElem.offsetHeight,\n coordinatesElement = thisElem.getBoundingClientRect(),\n left = parseFloat( coordinatesElement.left ),\n top;\n wptbDropHandle.style.left = left + 'px';\n \n if( e.dataTransfer.types.indexOf( 'wptb-moving-mode' ) != -1 ) {\n let elementDrag = document.getElementsByClassName( 'wptb-moving-mode' )[0];\n if( thisElem == elementDrag ) {\n wptbDropHandle.classList.add('wptb-moving-into-same-elem');\n wptbDropBorderMarker.classList.add('wptb-moving-into-same-elem');\n } else {\n wptbDropHandle.classList.remove('wptb-moving-into-same-elem');\n wptbDropBorderMarker.classList.remove('wptb-moving-into-same-elem');\n }\n }\n \n wptbDropHandle.getDOMParentElement = function() {\n return thisElem;\n }\n \n wptbDropHandle.style.display = 'block';\n wptbDropBorderMarker.style.display = 'block';\n if( thisElem.nodeName.toLowerCase() != 'td' ) {\n let y = e.offsetY==undefined?e.layerY:e.offsetY;\n top = parseFloat( coordinatesElement.top ) - parseFloat( 11 );\n wptbDropHandle.dataset.text = 'Above Element';\n if ( y > height/2 ) {\n top = parseFloat( coordinatesElement.top ) + height - 1;\n wptbDropHandle.dataset.text = 'Below Element';\n }\n } else {\n wptbDropHandle.dataset.text = 'Drop Here';\n top = parseFloat( coordinatesElement.top ) + height/2 - 5;\n }\n wptbDropHandle.style.top = top + 'px';\n\n wptbDropBorderMarker.style.top = coordinatesElement.top + 'px';\n wptbDropBorderMarker.style.left = coordinatesElement.left + 'px';\n\n wptbDropBorderMarkerTop = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-top' );\n wptbDropBorderMarkerTop.style.width = ( parseFloat( thisElem.offsetWidth ) - parseFloat( 1 ) ) + 'px';\n\n wptbDropBorderMarkerRight = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-right' );\n wptbDropBorderMarkerRight.style.height = ( parseFloat( coordinatesElement.bottom ) - parseFloat( coordinatesElement.top ) - 1 ) + 'px';\n wptbDropBorderMarkerRight.style.left = wptbDropBorderMarkerTop.style.width;\n\n wptbDropBorderMarkerBottom = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-bottom' );\n wptbDropBorderMarkerBottom.style.width = wptbDropBorderMarkerTop.style.width;\n wptbDropBorderMarkerBottom.style.top = wptbDropBorderMarkerRight.style.height;\n\n wptbDropBorderMarkerLeft = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-left' );\n wptbDropBorderMarkerLeft.style.height = wptbDropBorderMarkerRight.style.height;\n}","var ElementCounters = function () {\n\n\tvar priv = [];\n\tpriv['text'] = 0;\n\tpriv['image'] = 0;\n\tpriv['list'] = 0;\n\tpriv['button'] = 0;\n\n\tthis.increment = function (key) {\n\t\tif (!(key in priv)) {\n\t\t\treturn;\n\t\t}\n\t\tpriv[key]++;\n\t}\n\n\tthis.nextIndex = function (key) {\n\t\tif (!(key in priv)) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn priv[key] + 1;\n\t}\n\n\treturn this;\n\n};","var WPTB_ElementOptions = function ( element, index, kindIndexProt ) {\n\n var node = element.getDOMElement(), elemIdClass;\n\n prop = document.querySelector(\".wptb-\" + element.kind + \"-options-prototype\").cloneNode(true);\n prop.classList.remove(\"wptb-\" + element.kind + \"-options-prototype\"); // remove prototype from the class\n elemIdClass = 'wptb-options-' + element.kind + \"-\" + index;\n\n var properties = prop.getElementsByClassName('wptb-element-property');\n\n for (var i = 0; i < properties.length; i++) {\n properties[i].dataset.element = elemIdClass;\n }\n\n prop.classList.add(elemIdClass);\n document.getElementById(\"element-options-group\").appendChild(prop);\n \n if ( kindIndexProt ) {\n if ( element.kind == 'button' ) {\n let affectedEl = document.getElementsByClassName( 'wptb-element-' + kindIndexProt )[0],\n wptbButtonWrapper,\n wptbButtonA,\n wptbButton,\n wptbSize;\n \n if ( affectedEl ) {\n wptbSize = affectedEl.className.match(/wptb-size-([a-z]+)/i);\n }\n \n if( wptbSize && Array.isArray( wptbSize ) ) {\n var b = prop.getElementsByClassName('wptb-btn-size-btn');\n \n for ( var i = 0; i < b.length; i++ ) {\n b[i].classList.remove( 'selected' );\n \n if ( b[i].innerHTML == wptbSize[1] ) {\n b[i].classList.add( 'selected' );\n }\n }\n }\n \n if( affectedEl ) {\n wptbButtonWrapper = affectedEl.getElementsByClassName( 'wptb-button-wrapper' );\n \n wptbButtonA = affectedEl.getElementsByTagName( 'a' );\n \n wptbButton = affectedEl.getElementsByClassName( 'wptb-button' );\n }\n \n if ( wptbButtonWrapper ) {\n let buttonAlignment = wptbButtonWrapper[0].style.justifyContent,\n buttonAlignmentSelect = prop.querySelector( 'select[data-type=\"button-alignment\"]' ),\n selectOption = buttonAlignmentSelect.getElementsByTagName( 'option' ),\n selectOptionVal;\n \n if ( buttonAlignment == 'flex-start' ) {\n selectOptionVal = 'left';\n } else if ( buttonAlignment == 'center' || ! buttonAlignment ) {\n selectOptionVal = 'center';\n } else if ( buttonAlignment == 'flex-end' ) {\n selectOptionVal = 'right';\n }\n \n for ( let i = 0; i < selectOption.length; i++ ) {\n if ( selectOption[i].value == selectOptionVal ) {\n selectOption[i].selected = true;\n }\n }\n }\n \n if ( wptbButtonA.length > 0 ) {\n let buttonHref = wptbButtonA[0].getAttribute( 'href' ), \n buttonLinkTarget = wptbButtonA[0].getAttribute( 'target' ),\n buttonId = wptbButtonA[0].getAttribute( 'id' ),\n \n \n buttonHrefInput = prop.querySelector( 'input[data-type=\"button-link\"]' ),\n buttonLinkTargetInput = prop.querySelector( 'input[data-type=\"button-link-target\"]' ),\n buttonLinkTargetInputId = buttonLinkTargetInput.getAttribute( 'id' ),\n buttonLinkTargetInputLabel = buttonLinkTargetInput.parentNode.getElementsByTagName( 'label' )[0],\n \n buttotIdInput = prop.querySelector( 'input[data-type=\"button-id\"]' );\n\n buttonLinkTargetInputId = buttonLinkTargetInputId + '-' + kindIndexProt.split( '-' )[1];\n buttonLinkTargetInput.setAttribute( 'id', buttonLinkTargetInputId );\n buttonLinkTargetInputLabel.setAttribute( 'for', buttonLinkTargetInputId );\n\n buttonHrefInput.value = buttonHref;\n\n if( buttonLinkTarget && buttonLinkTarget == '_blank') {\n buttonLinkTargetInput.checked = true;\n }\n \n buttotIdInput.value = buttonId;\n }\n \n if( wptbButton ) {\n let buttonTextColor = wptbButton[0].style.color,\n buttonColor = wptbButton[0].style.backgroundColor,\n buttonTextColorInput = prop.querySelector( 'input[data-type=\"button-text-color\"]' ),\n buttonBackgroundColorInput = prop.querySelector( 'input[data-type=\"button-color\"]' );\n \n \n buttonTextColorInput.value = WPTB_Helper.rgbToHex( buttonTextColor );\n \n buttonBackgroundColorInput.value = WPTB_Helper.rgbToHex( buttonColor );\n \n }\n } else if ( element.kind == 'image' ) {\n let affectedEl = document.getElementsByClassName( 'wptb-element-' + kindIndexProt );\n if ( affectedEl.length > 0 ) {\n let elementsA = affectedEl[0].getElementsByTagName( 'a' );\n if ( elementsA.length > 0 ) {\n let a = elementsA[0];\n\n if ( a ) {\n // set select according to the alignment of the image\n let imgAlign;\n if( a.style.float == 'none' ) {\n imgAlign = 'center';\n } else {\n imgAlign = a.style.float;\n }\n let imageAlignmentSelect = prop.querySelector( 'select[data-type=\"image-alignment\"]' ),\n selectOption = imageAlignmentSelect.getElementsByTagName( 'option' );\n\n for ( let i = 0; i < selectOption.length; i++ ) {\n if ( selectOption[i].value == imgAlign ) {\n selectOption[i].selected = true;\n }\n }\n\n a.onclick = function( e ) {\n e.preventDefault();\n }\n\n // set text link for input field of setting panel\n let imageLinkHref = a.getAttribute( 'href' ),\n inputImageLink = prop.querySelector( 'input[data-type=\"image-link\"]' );\n if ( imageLinkHref ) {\n inputImageLink.value = imageLinkHref;\n }\n\n // set checkbox for target of link \n let imageLinkTarget = a.getAttribute( 'target' ),\n imageLinkTargetInput = prop.querySelector( 'input[data-type=\"image-link-target\"]' ),\n imageLinkTargetInputId = imageLinkTargetInput.getAttribute( 'id' ),\n imageLinkTargetInputLabel = imageLinkTargetInput.parentNode.getElementsByTagName( 'label' )[0];\n\n imageLinkTargetInputId = imageLinkTargetInputId + '-' + kindIndexProt.split( '-' )[1];\n\n imageLinkTargetInput.setAttribute( 'id', imageLinkTargetInputId );\n imageLinkTargetInputLabel.setAttribute( 'for', imageLinkTargetInputId );\n\n if ( imageLinkTarget && imageLinkTarget == '_blank' ) {\n imageLinkTargetInput.checked = true;\n }\n\n // set value for input fields of image size\n let imgWidth = a.style.width;\n if ( imgWidth ) {\n let imageWidthInputRange = prop.querySelector( 'input[type=\"range\"][data-type=\"image-size\"]' ),\n imageWidthInputNumber = prop.querySelector( 'input[type=\"number\"][data-type=\"image-size\"]' );\n\n imageWidthInputRange.value = parseInt( imgWidth );\n imageWidthInputNumber.value = parseInt( imgWidth );\n }\n\n let img = a.getElementsByTagName( 'img' );\n if ( img.length > 0 ) {\n // set value for input field of alternative text image\n let imgAlternativeText = img[0].getAttribute('alt'),\n imageAlternativeTextInput = prop.querySelector( 'input[type=\"text\"][data-type=\"alternative-text\"]' );\n\n imageAlternativeTextInput.value = imgAlternativeText;\n }\n }\n }\n }\n } else if ( element.kind == 'text' ) {\n let affectedEl = document.getElementsByClassName( 'wptb-element-' + kindIndexProt );\n if ( affectedEl.length > 0 ) {\n let elementFontSize = affectedEl[0].style.fontSize,\n elementTextColor = affectedEl[0].style.color;\n let textFontSizeInputRange = prop.querySelector( 'input[type=\"range\"][data-type=\"font-size\"]' ),\n textFontSizeInputNumber = prop.querySelector( 'input[type=\"number\"][data-type=\"font-size\"]' ),\n textColorInput = prop.querySelector( 'input[type=\"text\"][data-type=\"color\"]' );\n\n textFontSizeInputRange.value = parseInt( elementFontSize ) ? parseInt( elementFontSize ) : 10;\n textFontSizeInputNumber.value = parseInt( elementFontSize ) ? parseInt( elementFontSize ) : 10;\n textColorInput.value = WPTB_Helper.rgbToHex( elementTextColor );\n }\n } else if ( element.kind == 'list' ) {\n let elementList = document.getElementsByClassName( 'wptb-element-' + kindIndexProt );\n if ( elementList.length > 0 ) {\n let elementListColor = elementList[0].querySelector( 'p' ).style.color;\n let listColorInput = prop.querySelector( 'input[type=\"text\"][data-type=\"list-text-color\"]' );\n listColorInput.value = WPTB_Helper.rgbToHex( elementListColor );\n \n let elementListItem = elementList[0].querySelectorAll( 'li' );\n if ( elementListItem.length > 0 ) {\n let listItemP = elementListItem[0].querySelector( 'p' );\n let listItemPClasses = listItemP.classList;\n //listItemPClasses = [...listItemPClasses];\n if ( listItemPClasses.length > 0 ) {\n let elementListClassSelect = prop.querySelector( 'select[data-type=\"list-class\"]' );\n if ( elementListClassSelect ) {\n elementListClassSelect.value = 'unordered';\n \n let listIconSelectLabel = elementListClassSelect.parentNode.nextSibling;\n for ( let i = 0; i < 10; i++ ) {\n if ( listIconSelectLabel.nodeType == '1' ) {\n break;\n } else {\n listIconSelectLabel = listIconSelectLabel.nextSibling;\n }\n }\n if ( listIconSelectLabel ) {\n let listIconSelectLabelId = listIconSelectLabel.getAttribute( 'id' );\n listIconSelectLabel.setAttribute( 'id', listIconSelectLabelId + '-' + kindIndexProt );\n listIconSelectLabel.style.display = 'flex';\n }\n \n let elementListStyleTypeSelect = prop.querySelector( 'select[data-type=\"list-style-type\"]' );\n if ( elementListStyleTypeSelect ) {\n elementListStyleTypeSelect.parentNode.style.display = 'flex';\n \n if( listItemPClasses.contains( 'wptb-list-style-type-disc' ) ) {\n elementListStyleTypeSelect.value = 'disc';\n } else if( listItemPClasses.contains( 'wptb-list-style-type-circle' ) ) {\n elementListStyleTypeSelect.value = 'circle';\n } else if( listItemPClasses.contains( 'wptb-list-style-type-square' ) ) {\n elementListStyleTypeSelect.value = 'square';\n } else if ( listItemPClasses.contains( 'wptb-list-style-type-none' ) ) {\n elementListStyleTypeSelect.value = 'none';\n }\n }\n }\n }\n }\n \n let elementListItemContent = elementList[0].getElementsByClassName( 'wptb-list-item-content' );\n if ( elementListItemContent.length > 0 ) {\n let listItemPTextAlignArr = [];\n for ( let i = 0; i < elementListItemContent.length; i++ ) {\n let p = elementListItemContent[i].querySelector( 'p' );\n if ( p ) {\n if ( p.style.textAlign ) {\n listItemPTextAlignArr.push( p.style.textAlign );\n } else {\n listItemPTextAlignArr.push( 'left' );\n }\n }\n \n }\n \n let listItemPTextAlignLeftCount = 0,\n listItemPTextAlignCenterCount = 0,\n listItemPTextAlignRightCount = 0;\n \n if ( listItemPTextAlignArr.length > 0 ) {\n for ( let i = 0; i < listItemPTextAlignArr.length; i++ ) {\n if ( listItemPTextAlignArr[i] ) {\n if ( listItemPTextAlignArr[i] == 'left' ) {\n listItemPTextAlignLeftCount++;\n } else if ( listItemPTextAlignArr[i] == 'center' ) {\n listItemPTextAlignCenterCount++;\n } else if ( listItemPTextAlignArr[i] == 'right' ) {\n listItemPTextAlignRightCount++;\n }\n }\n }\n }\n \n let elementListAlignmentSelect = prop.querySelector( 'select[data-type=\"list-alignment\"]' ),\n maxListItemTAlLeftC = Math.max( listItemPTextAlignLeftCount, listItemPTextAlignCenterCount, listItemPTextAlignRightCount );\n \n if ( listItemPTextAlignLeftCount == maxListItemTAlLeftC ) {\n elementListAlignmentSelect.value = 'left';\n } else if ( listItemPTextAlignCenterCount == maxListItemTAlLeftC ) {\n elementListAlignmentSelect.value = 'center';\n } else if ( listItemPTextAlignRightCount == maxListItemTAlLeftC ) {\n elementListAlignmentSelect.value = 'right';\n }\n }\n } \n } else if( element.kind == 'star_rating' ) {\n let affectedEl = document.getElementsByClassName( 'wptb-element-' + kindIndexProt );\n if( affectedEl.length > 0 ) {\n affectedEl = affectedEl[0];\n let ratingStar = affectedEl.querySelector( 'li' );\n if( ratingStar ) {\n let ratingStarSize = ratingStar.style.width;\n let starSizeInputRange = prop.querySelector( 'input[type=\"range\"][data-type=\"star-size\"]' ),\n starSizeInputNumber = prop.querySelector( 'input[type=\"number\"][data-type=\"star-size\"]' );\n\n starSizeInputRange.value = parseInt( ratingStarSize ) ? parseInt( ratingStarSize ) : 10;\n starSizeInputNumber.value = parseInt( ratingStarSize ) ? parseInt( ratingStarSize ) : 10;\n\n if( ratingStar.querySelector( 'span' ) ) {\n let starColorInput = prop.querySelector( 'input[type=\"text\"][data-type=\"star-color\"]' ),\n ratingStarColor = ratingStar.querySelector( 'span' ).style.fill;\n starColorInput.value = WPTB_Helper.rgbToHex( ratingStarColor );\n }\n }\n \n let ratingStars = affectedEl.querySelectorAll( 'li' );\n let starsCountInputNumber = prop.querySelector( 'input[type=\"number\"][data-type=\"stars-count\"]' );\n if( ratingStars.length == 1 && ratingStars[0].style.display == 'none' ) {\n starsCountInputNumber.value = 0;\n } else {\n starsCountInputNumber.value = ratingStars.length;\n }\n\n let successBox = affectedEl.querySelector( '.wptb-success-box' );\n if( successBox ) {\n let showNumberRatingCheckbox = prop.querySelector( 'input[type=\"checkbox\"][data-type=\"show-number-rating\"]' );\n if( successBox.style.display == 'block' ) {\n showNumberRatingCheckbox.checked = true;\n let numeralRatingOptionContainers = prop.getElementsByClassName( 'wptb-numeral-rating-option-container' );\n for( let i = 0; i < numeralRatingOptionContainers.length; i++ ) {\n numeralRatingOptionContainers[i].style.display = 'block';\n }\n } else {\n showNumberRatingCheckbox.checked = false;\n }\n\n let wptbTextMessage = successBox.querySelector( '.wptb-text-message' );\n if( wptbTextMessage ) {\n let numberRatingSize = wptbTextMessage.style.fontSize;\n let numberRatingColor = wptbTextMessage.style.color;\n\n let numberSizeInputRange = prop.querySelector( 'input[type=\"range\"][data-type=\"numeral-rating-size\"]' ),\n numberSizeInputNumber = prop.querySelector( 'input[type=\"number\"][data-type=\"numeral-rating-size\"]' ),\n numberColorInput = prop.querySelector( 'input[type=\"text\"][data-type=\"numeral-rating-color\"]' );\n\n numberSizeInputRange.value = parseInt( numberRatingSize ) ? parseInt( numberRatingSize ) : 10;\n numberSizeInputNumber.value = parseInt( numberRatingSize ) ? parseInt( numberRatingSize ) : 10;\n numberColorInput.value = WPTB_Helper.rgbToHex( numberRatingColor );\n }\n }\n }\n }\n }\n\n node.onclick = function () {\n var infArr = this.className.match(/wptb-element-((.+-)\\d+)/i),\n optionsClass = '.wptb-' + infArr[2] + 'options' +\n '.wptb-options-' + infArr[1];\n\n document.getElementsByClassName('wptb-elements-container')[0].style.display = 'none';\n document.getElementsByClassName('wptb-settings-section')[0].style.display = 'none';\n document.getElementById(\"element-options-group\").style.display = 'block';\n\n var children = document.getElementById(\"element-options-group\").childNodes;\n for (var i = 0; i < children.length; i++) {\n if (children[i].style)\n children[i].style.display = 'none';\n }\n\n document.querySelector(optionsClass).style.display = 'block';\n\n //var listStyleType, textAlign;\n\n// switch (element.kind) {\n\n// case 'text':\n// jQuery(prop).find('[data-type=color]').wpColorPicker({ defaultColor: node.style.color });\n// prop.querySelector('[type=number][data-type=font-size]').value\n// = prop.querySelector('[type=range][data-type=font-size]').value\n// = node.style.fontSize.substring(0, node.style.fontSize.length - 2);\n// break;\n// case 'list':\n// textAlign = node.querySelector('li p').style.textAlign;\n// listStyleType = node.querySelector('li').style.listStyleType;\n// if ( prop.querySelector( 'select[data-type=list-class]' ) ) {\n// console.log(textAlign);\n// console.log(listStyleType);\n// console.log(listStyleType);\n// console.log(prop);\n// prop.querySelector('select[data-type=list-class]').selectedIndex = ( listStyleType == 'decimal' ? 0 : 1 );\n// }\n// if ( prop.querySelector('select[data-type=list-style-type]') ) {\n// prop.querySelector('select[data-type=list-style-type]').selectedIndex = (listStyleType == 'circle' ? 0 : (listStyleType == 'square' ? 1 : 2));\n// }\n// if ( prop.querySelector('select[data-type=list-alignment]') ) {\n// prop.querySelector('select[data-type=list-alignment]').selectedIndex = (textAlign == 'left' ? 0 : (textAlign == 'center' ? 1 : 2));\n// }\n// break;\n// case 'image':\n// break;\n// case 'button':\n// jQuery(prop).find('[data-type=button-color]').wpColorPicker({ defaultColor: node.style.backgroundColor });\n// break;\n//\n// }\n };\n\n if (element.kind == 'button') {\n //We must add this special kind of property, since it is triggered with click event\n var buttons = prop.getElementsByClassName('wptb-btn-size-btn');\n\n for (var i = 0; i < buttons.length; i++) {\n buttons[i].onclick = function () {\n var size = this.innerHTML,\n n_Class = this.dataset.element,\n infArr = n_Class.match(/wptb-options-(.+)-(\\d+)/i),\n type = infArr[1],\n num = infArr[2],\n affectedEl = document.getElementsByClassName('wptb-element-' + type + '-' + num)[0];\n affectedEl.classList.remove('wptb-size-S');\n affectedEl.classList.remove('wptb-size-M');\n affectedEl.classList.remove('wptb-size-L');\n affectedEl.classList.remove('wptb-size-XL');\n affectedEl.classList.add('wptb-size-' + size);\n var b = this.parentNode.getElementsByClassName('wptb-btn-size-btn');\n for (var i = 0; i < b.length; i++) {\n b[i].classList.remove('selected');\n }\n this.classList.add('selected');\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n }\n }\n\n var optionControls = prop.getElementsByClassName('wptb-element-property');\n\n for (var i = 0; i < optionControls.length; i++) {\n if ( optionControls[i].classList.contains( 'wptb-color-picker' ) ) {\n jQuery(optionControls[i]).wpColorPicker({\n change: function ( event, ui ) {\n WPTB_Helper.wpColorPickerChange( event, ui );\n \n //console.log(event);\n WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving( event );\n },\n clear: function( event ) {\n WPTB_Helper.wpColorPickerChange( event );\n }\n });\n }\n \n if( optionControls[i].classList.contains( 'wptb-stars-count-field' ) ) {\n WPTB_Helper.numberImputSize( optionControls[i], 1, 10 );\n }\n\n if ( optionControls[i].dataset.type === 'font-size' || optionControls[i].dataset.type === 'image-size' ||\n optionControls[i].dataset.type === 'star-size' || optionControls[i].dataset.type === 'numeral-rating-size' ) {\n var slider = optionControls[i].parentNode.parentNode.getElementsByClassName('wptb-size-slider')[0];\n slider.oninput = function () {\n this.parentNode.parentNode.getElementsByClassName('wptb-size-number')[0].value = this.value;\n this.parentNode.parentNode.getElementsByClassName('wptb-size-number')[0].onchange( event );\n }\n }\n\n// if (optionControls[i].dataset.type === 'image-size') {\n// var slider = optionControls[i].parentNode.parentNode.getElementsByClassName('wptb-size-slider')[0];\n// slider.oninput = function () {\n// this.parentNode.parentNode.getElementsByClassName('wptb-size-number')[0].value = this.value;\n// this.parentNode.parentNode.getElementsByClassName('wptb-size-number')[0].onchange( event );\n// }\n// }\n// \n// if ( optionControls[i].dataset.type === 'star-size' ) {\n// var slider = optionControls[i].parentNode.parentNode.getElementsByClassName('wptb-size-slider')[0];\n// slider.oninput = function () {\n// this.parentNode.parentNode.getElementsByClassName('wptb-size-number')[0].value = this.value;\n// this.parentNode.parentNode.getElementsByClassName('wptb-size-number')[0].onchange( event );\n// }\n// }\n\n optionControls[i].onchange = function ( event ) {\n var n_Class = this.dataset.element,\n infArr = n_Class.match(/wptb-options-(.+)-(\\d+)/i),\n type = infArr[1],\n num = infArr[2],\n affectedEl = document.getElementsByClassName('wptb-element-' + type + '-' + num)[0],\n val = this.value;\n\n switch ( this.dataset.type ) {\n case 'src':\n var img = affectedEl.getElementsByTagName(\"img\")[0];\n img.src = this.value;\n break;\n case 'alternative-text':\n var img = affectedEl.getElementsByTagName('img')[0];\n img.alt = this.value;\n break;\n case 'image-link':\n affectedEl.getElementsByTagName('a')[0].href = WPTB_Helper.linkHttpCheckChange( this.value );\n break;\n case 'image-link-target':\n if (this.checked == true) {\n affectedEl.getElementsByTagName('a')[0].target = '_blank';\n } else {\n affectedEl.getElementsByTagName('a')[0].target = '_self';\n }\n break;\n case 'image-link-nofollow':\n if (this.checked == true) {\n affectedEl.getElementsByTagName('a')[0].rel = 'nofollow';\n } else {\n affectedEl.getElementsByTagName('a')[0].removeAttribute('rel');\n }\n break;\n case 'image-size':\n affectedEl.getElementsByTagName('a')[0].style.width = this.value + '%';\n affectedEl.getElementsByTagName('a')[0].style.height = 'auto';\n this.parentNode.parentNode.getElementsByClassName('wptb-size-slider')[0].value = this.value;\n break;\n case 'image-alignment':\n let wptbImageFloatValue = '';\n if( this.value == 'center' ) {\n wptbImageFloatValue = 'none';\n } else {\n wptbImageFloatValue = this.value;\n }\n affectedEl.querySelector( '.wptb-image-wrapper a' ).style.float = wptbImageFloatValue;\n break;\n case 'font-size':\n affectedEl.style.fontSize = val + 'px';\n this.parentNode.parentNode.getElementsByClassName('wptb-size-slider')[0].value = this.value;\n break;\n case 'button-alignment':\n var jc = '';\n if (this.value == 'left') {\n jc = 'start';\n } else if (this.value == 'right') {\n jc = 'flex-end';\n } else {\n jc = 'center';\n }\n affectedEl.getElementsByClassName('wptb-button-wrapper')[0].style.justifyContent = jc;\n break;\n case 'button-link':\n if ( this.value ) {\n affectedEl.getElementsByTagName( 'a' )[0].href = WPTB_Helper.linkHttpCheckChange( this.value );\n } else {\n affectedEl.getElementsByTagName( 'a' )[0].removeAttribute( 'href' );\n }\n break;\n case 'button-link-target':\n if (this.checked == true) {\n affectedEl.getElementsByTagName('a')[0].target = '_blank';\n } else {\n affectedEl.getElementsByTagName('a')[0].target = '_self';\n }\n break;\n case 'button-link-nofollow':\n if (this.checked == true) {\n affectedEl.getElementsByTagName('a')[0].rel = 'nofollow';\n } else {\n affectedEl.getElementsByTagName('a')[0].removeAttribute( 'rel' );\n }\n break;\n case 'button-id':\n if( this.value ) {\n affectedEl.getElementsByTagName( 'a' )[0].id = this.value;\n } else {\n affectedEl.getElementsByTagName( 'a' )[0].removeAttribute( 'id' );\n }\n case 'button-color':\n break;\n case 'list-alignment':\n let listItems = affectedEl.querySelectorAll('li');\n for (var i = 0; i < listItems.length; i++) {\n let p = listItems[i].querySelector( 'p' );\n if ( p ) {\n p.style.textAlign = this.value;\n }\n }\n break;\n case 'list-class':\n let parentNode = event.target\n .parentNode\n .parentNode\n .querySelector('[data-type=list-style-type]')\n .parentNode,\n parentNodeSettingItem = parentNode.parentNode;\n if (val == 'unordered') {\n parentNode.style.display = 'flex';\n \n parentNodeSettingItem.querySelector( '.wptb-list-icon-select-label' ).style.display = 'flex';\n let listItem = affectedEl.querySelectorAll('li');\n for (var i = 0; i < listItem.length; i++) {\n let p = listItem[i].querySelector( 'p' );\n p.removeAttribute ( 'class' );\n p.classList.add( 'wptb-list-style-type-disc' );\n }\n parentNodeSettingItem.querySelector('[data-type=list-style-type]').value = 'disc';\n } else {\n parentNode.style.display = 'none';\n parentNodeSettingItem.querySelector( '.wptb-list-icon-select-label' ).style.display = 'none';\n var listItem = affectedEl.querySelectorAll('li');\n for (var i = 0; i < listItem.length; i++) {\n let p = listItem[i].querySelector( 'p' );\n p.removeAttribute ( 'class' );\n }\n }\n break;\n case 'list-style-type':\n var listItem = affectedEl.querySelectorAll('li');\n for (var i = 0; i < listItem.length; i++) {\n let p = listItem[i].querySelector( 'p' );\n p.removeAttribute ( 'class' );\n p.classList.add( 'wptb-list-style-type-' + val.toLowerCase() );\n }\n break;\n case 'star-size':\n let ratingStar = affectedEl.querySelectorAll('li');\n for( let i = 0; i < ratingStar.length; i++ ) {\n ratingStar[i].style.width = val + 'px';\n ratingStar[i].style.height = val + 'px';\n let span = ratingStar[i].querySelectorAll( 'span' );\n for( let j = 0; j < span.length; j++ ) {\n if( span[j].querySelector( 'svg' ) ) {\n span[j].style.width = val + 'px';\n span[j].style.height = val + 'px';\n span[j].querySelector( 'svg' ).style.width = val + 'px';\n }\n }\n }\n break;\n case 'show-number-rating':\n let wptbNumeralRatingOptionContainer = WPTB_Helper.findAncestor( this, 'wptb-star_rating-options' )\n .getElementsByClassName( 'wptb-numeral-rating-option-container' );\n \n WPTB_Helper.starRatingTextMessageChenge( affectedEl );\n \n if( wptbNumeralRatingOptionContainer.length > 0 ) {\n let wptbTextMessage = affectedEl.querySelector( '.wptb-text-message' );\n \n let val = this.checked ? 'checked' : 'unchecked';\n if( val== 'checked' ) {\n for ( let i = 0; i < wptbNumeralRatingOptionContainer.length; i++ ) {\n wptbNumeralRatingOptionContainer[i].style.display = 'block';\n }\n wptbTextMessage.parentNode.style.display = 'block';\n } else if ( val == 'unchecked' ) {\n for ( let i = 0; i < wptbNumeralRatingOptionContainer.length; i++ ) {\n wptbNumeralRatingOptionContainer[i].style.display = 'none';\n }\n wptbTextMessage.parentNode.style.display = 'none';\n }\n }\n break;\n case 'numeral-rating-size':\n let wptbTextMessageSize = affectedEl.querySelector('.wptb-text-message');\n wptbTextMessageSize.style.fontSize = val + 'px';\n wptbTextMessageSize.style.height = val + 'px';\n wptbTextMessageSize.style.lineHeight = val + 'px';\n break;\n case 'stars-count':\n let starRatings = affectedEl.querySelectorAll( 'li' );\n \n let starRatingsCount = starRatings.length;\n \n if( val > starRatingsCount ) {\n let difference = val - starRatingsCount;\n let starRatingsLast = starRatings[starRatings.length - 1];\n \n let parent = starRatingsLast.parentNode;\n for( let i = 0; i < difference; i++ ){\n let newStarRating = starRatingsLast.cloneNode( true );\n newStarRating.removeAttribute( 'class' );\n newStarRating.setAttribute( 'class', 'wptb-rating-star' );\n newStarRating.dataset.value = parseInt(starRatingsLast.dataset.value) + i + 1;\n WPTB_Helper.starRatingEventHandlersAdd( newStarRating );\n parent.appendChild( newStarRating );\n }\n } else if( val < starRatingsCount ) {\n let difference = parseInt( starRatingsCount ) - parseInt( val );\n \n if( val == 0 ) {\n difference--;\n starRatings[0].removeAttribute( 'class' );\n starRatings[0].setAttribute( 'class', 'wptb-rating-star' );\n starRatings[0].style.display = 'none';\n }\n \n let starRatingLength = starRatings.length;\n for( i = 0; i < difference; i++ ) {\n starRatings[0].parentNode.removeChild( starRatings[starRatingLength - i - 1] );\n }\n } else if( val == starRatingsCount && starRatingsCount == 1 ) {\n starRatings[0].style.display = 'inline-block';\n }\n \n WPTB_Helper.starRatingTextMessageChenge( affectedEl );\n \n break;\n }\n \n \n if( event.target.classList.contains( 'wptb-size-slider' ) || event.target.classList.contains( 'wptb-size-slider' ) ) {\n event.target.onmouseup = function() {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n } else {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n }\n }\n};","var WPTB_Helper = {\n hexToRgb: function( hex ) {\n var result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec( hex );\n return result ? 'rgb(' + parseInt( result[1], 16 ) + ',' + parseInt( result[2], 16 ) + ',' + parseInt( result[3], 16 ) + ')' : null;\n },\n rgbToHex: function ( rgb ) {\n var rgb = rgb.match( /^rgba?[\\s+]?\\([\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?/i );\n\n return ( rgb && rgb.length === 4 ) ? \"#\" +\n ( \"0\" + parseInt( rgb[1],10 ).toString( 16 )).slice( -2 ) +\n ( \"0\" + parseInt( rgb[2],10 ).toString( 16 )).slice( -2 ) +\n ( \"0\" + parseInt( rgb[3],10 ).toString( 16 )).slice( -2 ) : '';\n },\n getDragImageCustom: function ( type ) {\n let hostName = location.protocol + '//' + location.hostname;\n let img = document.createElement( 'img' );\n img.src = hostName + '/wp-content/plugins/wp-table-builder/inc/admin/views/builder/icons/' + type + '.png';\n return img;\n },\n dragImagesArr: function() {\n return {\n text: WPTB_Helper.getDragImageCustom( 'text' ),\n image: WPTB_Helper.getDragImageCustom( 'image' ),\n button: WPTB_Helper.getDragImageCustom( 'button' ),\n list: WPTB_Helper.getDragImageCustom( 'list' ),\n star_rating: WPTB_Helper.getDragImageCustom( 'half-filled-rating-star' )\n };\n },\n listItemsRecalculateIndex: function( ulElem ) {\n let par = ulElem.querySelectorAll( 'p' );\n if ( par.length > 0 ) {\n for ( let i = 0; i < par.length; i++ ) {\n par[i].dataset.listStyleTypeIndex = Number( i ) + 1 + '.';\n }\n }\n },\n listItemsTinyMceInit: function( listItem ) {\n tinyMCE.init({\n target: listItem,\n inline: true,\n plugins: \"link, paste\",\n dialog_type: \"modal\",\n theme: 'modern',\n menubar: false,\n fixed_toolbar_container: '#wpcd_fixed_toolbar',\n paste_as_text: true,\n toolbar: 'bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify',\n setup: function(ed) {\n ed.on('keydown', function(e) {\n let article = e.target.parentNode;\n if ( e.keyCode == 13 ) {\n e.preventDefault();\n let text = e.target.innerHTML;\n let duplicate = new WPTB_ListItem( text, article, true );\n \n article.parentNode.insertBefore( duplicate.getDOMElement(), article );\n WPTB_Helper.listItemsTinyMceInit( duplicate.getDOMElement().firstChild );\n e.target.querySelector( 'p' ).innerText = 'New List Item';\n //tinyMCE.execCommand('mceInsertContent', false, 'New List Item');\n WPTB_Helper.listItemsRecalculateIndex( article.parentNode );\n \n return;\n \n } else if ( e.keyCode == '8' || e.keyCode == '46' ) {\n let p = e.target.querySelector( 'p' );\n let pText = p.innerHTML.replace(/<[^>]+>/g, '');\n pText = pText.replace( /\\s+/g, ' ' ).trim();\n pText = pText.replace( /&nbsp;/g, '').trim();\n \n if( pText == '' ) {\n e.preventDefault();\n e.target.querySelector( 'p' ).innerText = '\\n';\n } else {\n let selectedText = WPTB_Helper.getSelectionText();\n selectedText = selectedText.replace( /\\s+/g, ' ' ).trim();\n selectedText = selectedText.replace( /&nbsp;/g, '' ).trim();\n if( selectedText == pText ) {\n e.preventDefault();\n e.target.querySelector( 'p' ).innerText = '\\n';\n }\n }\n }\n \n let wptbListItem = e.target.parentNode;\n let wptbActionsField = new WPTB_ActionsField();\n\n wptbActionsField.addActionField( 2, wptbListItem );\n\n wptbActionsField.setParameters( wptbListItem );\n });\n \n ed.on( 'keyup', function( e ) {\n let wptbListItem = e.target.parentNode;\n let wptbActionsField = new WPTB_ActionsField();\n\n wptbActionsField.addActionField( 2, wptbListItem );\n\n wptbActionsField.setParameters( wptbListItem );\n \n e.target.onblur = function() {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n });\n },\n init_instance_callback: function (editor) {\n window.currentEditor = editor;\n editor.on('focus', function (e) {\n var totalWidth = document.getElementsByClassName('wptb-builder-panel')[0].offsetWidth;\n if (window.currentEditor &&\n document.getElementById('wptb_builder').scrollTop >= 55 &&\n window.currentEditor.bodyElement.style.display != 'none') {\n document.getElementById('wpcd_fixed_toolbar').style.position = 'fixed';\n document.getElementById('wpcd_fixed_toolbar').style.right = (totalWidth / 2 - document.getElementById('wpcd_fixed_toolbar').offsetWidth / 2) + 'px';\n document.getElementById('wpcd_fixed_toolbar').style.top = '100px';\n } else {\n document.getElementById('wpcd_fixed_toolbar').style.position = 'static';\n delete document.getElementById('wpcd_fixed_toolbar').style.right;\n delete document.getElementById('wpcd_fixed_toolbar').style.top;\n }\n });\n }\n });\n },\n buttonsTinyMceInit: function( target ) {\n tinyMCE.init({\n target: target,\n inline: true,\n plugins: \"link\",\n dialog_type: \"modal\",\n theme: 'modern',\n menubar: false,\n fixed_toolbar_container: '#wpcd_fixed_toolbar',\n toolbar: 'bold italic strikethrough',\n setup : function(ed) {\n ed.on( 'keydown', function(e) {\n if (e.keyCode == 13) {\n e.preventDefault();\n }\n let wptbButtonContainer = WPTB_Helper.findAncestor( target, 'wptb-button-container' );\n \n let wptbActionsField = new WPTB_ActionsField();\n\n wptbActionsField.addActionField( 1, wptbButtonContainer );\n\n wptbActionsField.setParameters( wptbButtonContainer );\n });\n \n ed.on( 'keyup', function(e) {\n let wptbButtonContainer = WPTB_Helper.findAncestor( target, 'wptb-button-container' );\n \n let wptbActionsField = new WPTB_ActionsField();\n\n wptbActionsField.addActionField( 1, wptbButtonContainer );\n\n wptbActionsField.setParameters( wptbButtonContainer );\n \n e.target.onblur = function() {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n });\n },\n init_instance_callback: function (editor) {\n window.currentEditor = editor;\n editor.on('focus', function (e) {\n var totalWidth = document.getElementsByClassName('wptb-builder-panel')[0].offsetWidth;\n if (window.currentEditor &&\n document.getElementById('wptb_builder').scrollTop >= 55 &&\n window.currentEditor.bodyElement.style.display != 'none') {\n document.getElementById('wpcd_fixed_toolbar').style.position = 'fixed';\n document.getElementById('wpcd_fixed_toolbar').style.right = (totalWidth / 2 - document.getElementById('wpcd_fixed_toolbar').offsetWidth / 2) + 'px';\n document.getElementById('wpcd_fixed_toolbar').style.top = '100px';\n } else {\n document.getElementById('wpcd_fixed_toolbar').style.position = 'static';\n delete document.getElementById('wpcd_fixed_toolbar').style.right;\n delete document.getElementById('wpcd_fixed_toolbar').style.top;\n }\n });\n }\n });\n },\n linkHttpCheckChange: function( link ) {\n if ( link ) {\n if ( link.indexOf( 'http://' ) == -1 && link.indexOf( 'https://' ) == -1 ) {\n let linkArr = link.split( '/' ),\n linkClean;\n if ( Array.isArray( linkArr ) && linkArr.length > 0 ) {\n linkClean = linkArr[linkArr.length - 1];\n }\n return document.location.protocol + '//' + linkClean;\n } else { \n return link;\n }\n } else {\n return '';\n }\n },\n dataTitleColumnSet: function( table ) {\n let rows = table.rows,\n rowHead = rows[0];\n let computedStyleRowHead = getComputedStyle(rowHead);\n \n let rowHeadChildren = rowHead.children;\n let contentsForHeader = {};\n for( let i = 0; i < rowHeadChildren.length; i++ ) {\n let tdElements = rowHeadChildren[i].children;\n for( let j = 0; j < tdElements.length; j++ ) {\n let element = tdElements[j];\n if( element.classList.contains( 'wptb-ph-element' ) ) {\n let infArr = element.className.match( /wptb-element-(.+)-(\\d+)/i );\n if( infArr[1] == 'text' ) {\n let p = element.querySelector( 'p' ),\n textContent = p.textContent,\n textAlign = p.style.textAlign;\n contentsForHeader[rowHeadChildren[i].dataset.xIndex] = [textContent, element.style.fontSize, \n element.style.color, computedStyleRowHead.backgroundColor, textAlign];\n break;\n }\n }\n }\n if( ! contentsForHeader[rowHeadChildren[i].dataset.xIndex] ) {\n contentsForHeader[rowHeadChildren[i].dataset.xIndex] = ['', '', \n '', computedStyleRowHead.backgroundColor, ''];\n }\n }\n for ( let i = 1; i < rows.length; i++ ) {\n let thisRow = rows[i],\n thisRowChildren = thisRow.children;\n for( let j = 0; j < thisRowChildren.length; j++ ) {\n if ( contentsForHeader[thisRowChildren[j].dataset.xIndex] ) {\n thisRowChildren[j].dataset.wptbTitleColumn = contentsForHeader[thisRowChildren[j].dataset.xIndex][0];\n thisRowChildren[j].dataset.wptbTitleColumnFontSize = contentsForHeader[thisRowChildren[j].dataset.xIndex][1];\n thisRowChildren[j].dataset.wptbTitleColumnColor = contentsForHeader[thisRowChildren[j].dataset.xIndex][2];\n thisRowChildren[j].dataset.wptbTitleBackgroundColor = contentsForHeader[thisRowChildren[j].dataset.xIndex][3];\n thisRowChildren[j].dataset.wptbTitleAlign = contentsForHeader[thisRowChildren[j].dataset.xIndex][4];\n } else {\n thisRowChildren[j].dataset.wptbTitleColumn = '';\n thisRowChildren[j].dataset.wptbTitleColumnFontSize = '';\n thisRowChildren[j].dataset.wptbTitleColumnColor = '';\n thisRowChildren[j].dataset.wptbTitleBackgroundColor = '';\n thisRowChildren[j].dataset.wptbTitleAlign = '';\n }\n }\n }\n },\n findAncestor: function(el, cls) {\n while ((el = el.parentElement) && !el.classList.contains(cls));\n return el;\n },\n getSelectionText: function() {\n var txt = '';\n if (txt = window.getSelection) {\n txt = window.getSelection().toString();\n } else {\n txt = document.selection.createRange().text;\n }\n return txt;\n },\n settingsPanelClear: function() {\n document.getElementById( 'wptb-adaptive-table-checkbox' ).checked = false;\n document.getElementById( 'wptb-top-row-as-header' ).checked = false;\n document.getElementById( 'wptb-table-border-slider' ).value = 0;\n document.getElementById( 'wptb-table-border-number' ).value = 0;\n document.getElementById( 'wptb-inner-border-check' ).checked = false;\n document.getElementById( 'wptb-apply-inner-border' ).classList.remove( 'visible' );\n document.getElementById( 'wptb-table-inner-border-slider' ).value = 1;\n document.getElementById( 'wptb-table-inner-border-number' ).value = 1;\n \n WPTB_Helper.wpColorPickerClear( 'wptb-table-border-color', true );\n \n WPTB_Helper.wpColorPickerClear( 'wptb-table-header-bg', true );\n \n WPTB_Helper.wpColorPickerClear( 'wptb-even-row-bg', true );\n \n WPTB_Helper.wpColorPickerClear( 'wptb-odd-row-bg', true );\n \n document.getElementById( 'wptb-table-cell-slider' ).value = 15;\n document.getElementById( 'wptb-table-cell-number' ).value = 15;\n },\n elementOptionsPanelClear: function() {\n let elementOptionsGroup = document.getElementById( 'element-options-group' );\n if( elementOptionsGroup ) {\n elementOptionsGroup.innerHTML = '';\n }\n },\n wpColorPickerCheckChangeForTableStateSaving: function( event ) {\n if( event.originalEvent.type == 'external' ) {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n } else {\n let wpPickerContainer = WPTB_Helper.findAncestor( event.target, 'wp-picker-container' );\n if( wpPickerContainer ) {\n if( event.originalEvent.type == 'square' ) {\n let irisSquareHandle = wpPickerContainer.getElementsByClassName( 'iris-square-handle' );\n if( irisSquareHandle.length > 0 ) {\n irisSquareHandle = irisSquareHandle[0];\n irisSquareHandle.onmouseup = function() {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n }\n } else if( event.originalEvent.type == 'strip' ) {\n let uiSliderHandle = wpPickerContainer.getElementsByClassName( 'iris-slider-offset' );\n if( uiSliderHandle.length > 0 ) {\n uiSliderHandle = uiSliderHandle[0];\n uiSliderHandle.onmouseup = function() {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n }\n }\n }\n }\n },\n wpColorPickerClear: function( attribute, isId ) {\n let input;\n if( isId ) {\n input = [document.getElementById( attribute )];\n input.length = 1;\n } else {\n input = document.getElementsByClassName( attribute );\n }\n for( let i = 0; i < input.length; i++ ) {\n let wpPickerContainer = WPTB_Helper.findAncestor( input[i], 'wp-picker-container' );\n if( wpPickerContainer ) {\n let parent = wpPickerContainer.parentNode;\n parent.removeChild( wpPickerContainer );\n let newInput = document.createElement( 'input' );\n if( isId ) {\n newInput.setAttribute( 'id', attribute );\n } else {\n newInput.classList.add( 'wptb-element-property', attribute );\n }\n newInput.value = \"\";\n parent.appendChild( newInput );\n }\n }\n },\n detectMode: function() {\n var url = window.location.href,\n regex = new RegExp('[?&]table(=([^&#]*)|&|#|$)'),\n results = regex.exec(url);\n if (!results) return false;\n if (!results[2]) return '';\n return decodeURIComponent(results[2].replace(/\\+/g, ' '));\n },\n getColumnWidth: function( table, cell ) {\n let xIndex = cell.dataset.xIndex;\n let xIndexes = table.querySelectorAll( '[data-x-index=\"' + xIndex + '\"]' );\n let cellWidth = cell.getCellDimensions().width;\n for( let i = 0; i < xIndexes.length; i++ ) {\n if( cellWidth > xIndexes[i].getCellDimensions().width ) {\n cellWidth = xIndexes[i].getCellDimensions().width;\n }\n }\n return cellWidth;\n },\n getRowHeight: function( table, cell ) {\n let yIndex = cell.dataset.yIndex;\n let yIndexes = table.querySelectorAll( '[data-y-index=\"' + yIndex + '\"]' );\n let cellHeight = cell.getCellDimensions().height;\n for( let i = 0; i < yIndexes.length; i++ ) {\n if( cellHeight > yIndexes[i].getCellDimensions().height ) {\n cellHeight = yIndexes[i].getCellDimensions().height;\n }\n }\n return cellHeight;\n },\n newElementProxy: function(el) {\n if ( el == 'list' ) {\n return new WPTB_List();\n } else if ( el == 'image' ) {\n return new WPTB_Image();\n } else if ( el == 'text' ) {\n return new WPTB_Text();\n } else if ( el == 'button' ) {\n return new WPTB_Button();\n } else if( el == 'star_rating' ) {\n return new WPTB_StarRating();\n }\n },\n wpColorPickerChange: function( event, ui ) {\n let uiColor;\n if( ui ) {\n uiColor = ui.color.toString();\n } else {\n uiColor = '';\n }\n \n let parent = WPTB_Helper.findAncestor( event.target, 'wp-picker-input-wrap' ).getElementsByClassName( 'wptb-color-picker' )[0], classe, type, ps, number;\n classe = parent.dataset.element.match(/wptb-options-(.+)-(\\d+)/i);\n type = classe[1];\n number = classe[2];\n let affectedEl = document.getElementsByClassName( 'wptb-element-' + type + '-' + number )[0];\n if ( type == 'button' ) {\n if ( parent.dataset.type == 'button-text-color' ) {\n affectedEl.getElementsByClassName( 'wptb-button' )[0].style.color = uiColor;\n } else {\n affectedEl.getElementsByClassName( 'wptb-button' )[0].style.backgroundColor = uiColor;\n }\n } else if( type == 'list' ) {\n let ps = affectedEl.querySelectorAll( 'p' );\n if( ps.length > 0 ) {\n for ( let i = 0; i < ps.length; i++ ) {\n ps[i].style.color = uiColor;\n }\n }\n } else if( type == 'star_rating' ) {\n if ( parent.dataset.type == 'star-color' ) {\n let ratingStar = affectedEl.querySelectorAll('li');\n for( let i = 0; i < ratingStar.length; i++ ) {\n let span = ratingStar[i].getElementsByTagName( 'span' );\n for( let j = 0; j < span.length; j++ ) {\n span[j].style.fill = uiColor;\n }\n }\n } else if( parent.dataset.type == 'numeral-rating-color' ) {\n let wptbTextMessageSize = affectedEl.querySelector('.wptb-text-message');\n wptbTextMessageSize.style.color = uiColor;\n }\n\n } else {\n affectedEl.style.color = uiColor;\n }\n },\n starRatingSelectHoverSet : function( event ) {\n let starRating;\n if( ! event.target.classList.contains( 'wptb-rating-star' ) ) {\n starRating = WPTB_Helper.findAncestor( event.target, 'wptb-rating-star' );\n } else {\n starRating = event.target;\n }\n \n let onStar = parseInt( starRating.dataset.value, 10 ); // The star currently mouse on\n\n // Now highlight all the stars that's not after the current hovered star\n let children = starRating.parentNode.children;\n if( event.type == \"mouseover\" ) {\n for( let j = 0; j < children.length; j++ ) {\n if( j < onStar ) {\n if( j == onStar - 1 ) {\n if ( event.target.classList.contains( 'wptb-rating-star-left-signal-part' ) ) {\n children[j].classList.add( 'wptb-rating-star-hover-half' );\n children[j].classList.remove( 'wptb-rating-star-hover-full' );\n } else if( event.target.classList.contains( 'wptb-rating-star-right-signal-part' ) ) {\n children[j].classList.add( 'wptb-rating-star-hover-full' );\n children[j].classList.remove( 'wptb-rating-star-hover-half' );\n }\n } else {\n children[j].classList.add( 'wptb-rating-star-hover-full' );\n children[j].classList.remove( 'wptb-rating-star-hover-half' );\n }\n } else {\n children[j].classList.remove( 'wptb-rating-star-hover-full' );\n children[j].classList.remove( 'wptb-rating-star-hover-half' );\n }\n }\n } else if ( event.type == \"click\" ) {\n for( let j = 0; j < children.length; j++ ) {\n if( j < onStar ) {\n if( j == onStar - 1 ) {\n if ( event.target.classList.contains( 'wptb-rating-star-left-signal-part' ) ) {\n children[j].classList.add( 'wptb-rating-star-selected-half' );\n children[j].classList.remove( 'wptb-rating-star-selected-full' );\n } else if( event.target.classList.contains( 'wptb-rating-star-right-signal-part' ) ) {\n children[j].classList.add( 'wptb-rating-star-selected-full' );\n children[j].classList.remove( 'wptb-rating-star-selected-half' );\n }\n } else {\n children[j].classList.add( 'wptb-rating-star-selected-full' );\n children[j].classList.remove( 'wptb-rating-star-selected-half' );\n }\n } else {\n children[j].classList.remove( 'wptb-rating-star-selected-full' );\n children[j].classList.remove( 'wptb-rating-star-selected-half' );\n }\n }\n }\n \n },\n starRatingEventHandlersAdd: function( ratingStar ) {\n ratingStar.onmouseover = function( event ) {\n event.stopPropagation();\n WPTB_Helper.starRatingSelectHoverSet( event );\n }\n ratingStar.onmouseout = function() {\n let children = this.parentNode.children;\n for( let j = 0; j < children.length; j++ ) {\n children[j].classList.remove( 'wptb-rating-star-hover-half' );\n children[j].classList.remove( 'wptb-rating-star-hover-full' );\n }\n }\n\n /* 2. Action to perform on click */\n ratingStar.onclick = function( event ) {\n WPTB_Helper.starRatingSelectHoverSet( event );\n \n /* Rating number message */\n let wptbStarRatingContainer = WPTB_Helper.findAncestor( event.target, 'wptb-star_rating-container' );\n\n WPTB_Helper.starRatingTextMessageChenge( wptbStarRatingContainer );\n\n let wptbActionsField = new WPTB_ActionsField( 1, wptbStarRatingContainer );\n\n wptbActionsField.setParameters( wptbStarRatingContainer );\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n },\n numberImputSize: function ( wptbNumberInputs, maxCount, maxValue ) {\n wptbNumberInputs.onkeydown = function() {\n let thisValue = this.value;\n thisValue = String( thisValue );\n if ( thisValue[0] == 0 ) {\n this.value = \"\";\n } else {\n thisValue = thisValue.substring( 0, maxCount );\n this.value = thisValue;\n }\n }\n wptbNumberInputs.onkeyup = function() {\n let thisValue = this.value;\n thisValue = String( thisValue );\n if ( thisValue > maxValue ) {\n this.value = maxValue;\n }\n }\n },\n starRatingTextMessageChenge: function( starRatingContainer ) {\n let ratingNumber = starRatingContainer.getElementsByClassName( 'wptb-rating-star-selected-full' ).length;\n if( starRatingContainer.getElementsByClassName( 'wptb-rating-star-selected-half' ).length > 0 ) {\n ratingNumber = parseInt( ratingNumber ) + 0.5;\n }\n \n let wptbTextMessageCommon = starRatingContainer.querySelectorAll( 'li' ),\n wptbTextMessageCommonVal = wptbTextMessageCommon.length,\n wptbTextMessage = starRatingContainer.querySelector( '.wptb-text-message' );\n if( wptbTextMessageCommonVal == 1 && wptbTextMessageCommon[0].style.display == 'none' ) {\n wptbTextMessage.innerHTML = '';\n return;\n }\n \n wptbTextMessage.innerHTML = ratingNumber + '/' + wptbTextMessageCommonVal;\n }\n}\n","var WPTB_Image = function ( src, DOMElementProt ) {\n let DOMElement,\n elImage,\n kindIndexProt = undefined,\n copy = false;\n if ( DOMElementProt == undefined ) {\n DOMElement = document.createElement( 'div' );\n elImage = document.createElement( 'div' );\n\t let anchor = document.createElement( 'a' ),\n\t img = document.createElement( 'img' );\n anchor.style.display = 'block';\n anchor.appendChild( img );\n DOMElement.classList.add( 'wptb-image-container' );\n elImage.classList.add( 'wptb-image-wrapper' );\n elImage.appendChild( anchor );\n DOMElement.appendChild( elImage );\n \n anchor.onclick = function( e ) {\n e.preventDefault();\n }\n \n file_frame = wp.media.frames.file_frame = wp.media({\n\t\ttitle: 'Select a image to upload',\n\t\tbutton: {\n text: 'Use this image'\n\t\t},\n\t\tmultiple: false\n });\n // When an image is selected, run a callback.\n file_frame.on('select', function () {\n attachment = file_frame.state().get('selection').first().toJSON();\n let imgSrc = attachment.url;\n let linkArr = imgSrc.split( ':' ),\n linkClean;\n if ( Array.isArray( linkArr ) && linkArr.length > 0 ) {\n linkClean = linkArr[linkArr.length - 1];\n }\n img.src = linkClean;\n img.height = attachment.height;\n img.width = attachment.width;\n img.style.width = '100%';\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n });\n // Finally, open the modal\n if (src == undefined) {\n file_frame.open();\n } else {\n img.src = src;\n }\n } else {\n DOMElement = DOMElementProt.cloneNode( true );\n \n DOMElement.getElementsByTagName( 'a' )[0].onclick = function(e) {\n e.preventDefault();\n };\n \n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\n kindIndexProt = wptbElementMutch[1];\n copy = true;\n };\n }\n \n this.kind = 'image';\n this.getDOMElement = function () {\n return DOMElement;\n };\n\tapplyGenericItemSettings( this, kindIndexProt, copy );\n\n\treturn this;\n};","var WPTB_Initializer = function () {\n\n const MIN_COLUMNS = 1,\n MIN_ROWS = 1,\n MAX_COLUMNS = 30,\n MAX_ROWS = 30;\n\n var tableGenerator = document.body;\n columnsDecrementButton = tableGenerator.getElementsByClassName('wptb-input-number-decrement')[0],\n columnsIncrementButton = tableGenerator.getElementsByClassName('wptb-input-number-increment')[0],\n rowsDecrementButton = tableGenerator.getElementsByClassName('wptb-input-number-decrement')[1],\n rowsIncrementButton = tableGenerator.getElementsByClassName('wptb-input-number-increment')[1],\n columnsInput = document.getElementById('wptb-columns-number'),\n rowsInput = document.getElementById('wptb-rows-number');\n \n columnsDecrementButton.onclick = function () {\n if (columnsInput.value > MIN_COLUMNS) {\n columnsInput.value--;\n }\n };\n\n columnsIncrementButton.onclick = function () {\n if (columnsInput.value < MAX_COLUMNS) {\n columnsInput.value++;\n }\n };\n\n rowsDecrementButton.onclick = function () {\n if (rowsInput.value > MIN_ROWS) {\n rowsInput.value--;\n }\n };\n\n rowsIncrementButton.onclick = function () {\n if (rowsInput.value < MAX_ROWS) {\n rowsInput.value++;\n }\n };\n\n document.getElementById('wptb-generate-table').onclick = function () {\n var columns = document.getElementById('wptb-columns-number').value,\n rows = document.getElementById('wptb-rows-number').value;\n\n WPTB_Table(columns, rows);\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n\n};\n","var WPTB_LeftPanel = function () {\n\n var table = document.getElementsByClassName('wptb-preview-table')[0],\n wptbElementButtons = document.getElementsByClassName('wptb-element');\n \n function wptbTdBgColorSavedSet( inputId, trNumber ) {\n if ( trNumber > 3 ) return;\n if( table ) {\n let tableRows = table.getElementsByTagName('tr');\n if ( tableRows.length > trNumber ) {\n let trBackgroundColor = tableRows[trNumber].style.backgroundColor;\n var wptbEvenRowBg = document.getElementById(inputId);\n if ( wptbEvenRowBg && trBackgroundColor ) {\n wptbEvenRowBg.value = WPTB_Helper.rgbToHex( trBackgroundColor );\n }\n }\n }\n \n }\n \n wptbTdBgColorSavedSet( 'wptb-even-row-bg', 1 );\n jQuery('#wptb-even-row-bg').wpColorPicker({\n change: function ( event, ui ) {\n var tableRows = table.getElementsByTagName('tr');\n for ( let i = 1; i < tableRows.length; i += 2 ) {\n tableRows[i].style.backgroundColor = ui.color.toString();\n }\n console.log(event);\n console.log(this);\n WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving( event );\n },\n clear: function(){\n var tableRows = table.getElementsByTagName('tr');\n for ( let i = 1; i < tableRows.length; i += 2 ) {\n tableRows[i].style.backgroundColor = '';\n let tds = tableRows[i].getElementsByTagName('td');\n for ( let j = 0; j < tds.length; j++ ) {\n tds[j].style.backgroundColor = '';\n }\n }\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n },\n\n });\n \n wptbTdBgColorSavedSet( 'wptb-odd-row-bg', 2 );\n jQuery('#wptb-odd-row-bg').wpColorPicker({\n change: function ( event, ui ) {\n var tableRows = table.getElementsByTagName('tr');\n for ( let i = 2; i < tableRows.length; i += 2 ) {\n tableRows[i].style.backgroundColor = ui.color.toString();\n }\n \n WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving( event );\n },\n clear: function(){\n var tableRows = table.getElementsByTagName('tr');\n for ( let i = 2; i < tableRows.length; i += 2 ) {\n tableRows[i].style.backgroundColor = '';\n let tds = tableRows[i].getElementsByTagName( 'td' );\n for ( var j = 0; j < tds.length; j++ ) {\n tds[j].style.backgroundColor = '';\n }\n }\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n },\n });\n \n wptbTdBgColorSavedSet( 'wptb-table-header-bg', 0 );\n jQuery('#wptb-table-header-bg').wpColorPicker({\n change: function (event, ui) {\n var tableHeader = table.getElementsByTagName('tr')[0];\n tableHeader.style.backgroundColor = ui.color.toString();\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n },\n clear: function(){\n var tableHeader = table.getElementsByTagName('tr')[0];\n tableHeader.style.backgroundColor = '';\n let tds = tableHeader.getElementsByTagName('td');\n for (var j = 0; j < tds.length; j++) {\n tds[j].style.backgroundColor = '';\n }\n \n WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving( event );\n },\n });\n \n function tableAdaptiveForMobile( table ) {\n let wptbAdaptiveTableCheckbox = document.getElementById( 'wptb-adaptive-table-checkbox' );\n if( table && table.dataset.wptbAdaptiveTable && table.dataset.wptbAdaptiveTable == \"1\" ) {\n wptbAdaptiveTableCheckbox.checked = true;\n } else {\n wptbAdaptiveTableCheckbox.checked = false;\n }\n }\n tableAdaptiveForMobile( table );\n \n function tableTopRowAsHeadSavedSet( table ) {\n let wptbTopRowAsHeader = document.getElementById( 'wptb-top-row-as-header' );\n \n if( table && table.classList.contains( 'wptb-table-preview-head' ) ) {\n wptbTopRowAsHeader.checked = true;\n } else {\n wptbTopRowAsHeader.checked = false;\n }\n }\n tableTopRowAsHeadSavedSet( table );\n \n function tableBorderColorWidthSavedSet() {\n let table = document.getElementsByClassName('wptb-preview-table');\n if ( table.length > 0 ) {\n let tableBorderColor = table[0].style.borderColor;\n if ( tableBorderColor ) {\n let tableBorderColorInput = document.getElementById( 'wptb-table-border-color' );\n if ( tableBorderColorInput ) {\n tableBorderColorInput.value = WPTB_Helper.rgbToHex( tableBorderColor );\n }\n }\n \n let tableBorderWidth = table[0].style.borderWidth;\n if ( tableBorderWidth ) {\n let wptbTableBorderWidthSlider = document.getElementById('wptb-table-border-slider'),\n wptbTableBorderWidthNumber = document.getElementById('wptb-table-border-number');\n \n if ( wptbTableBorderWidthSlider ) {\n wptbTableBorderWidthSlider.value = parseInt( tableBorderWidth );\n }\n if ( wptbTableBorderWidthNumber ) {\n wptbTableBorderWidthNumber.value = parseInt( tableBorderWidth );\n }\n }\n \n \n let tableTd = table[0].querySelector( 'td' );\n let applyInnerBorder = tableTd.style.borderWidth;\n if ( applyInnerBorder ) {\n let innerBorderCheckInput = document.getElementById( 'wptb-inner-border-check' );\n let wptbApplyInnerBorder = document.getElementById( 'wptb-apply-inner-border' );\n if ( applyInnerBorder && parseInt( applyInnerBorder ) > 0 ) {\n if ( innerBorderCheckInput ) {\n innerBorderCheckInput.checked = true;\n \n if ( wptbApplyInnerBorder ) {\n wptbApplyInnerBorder.classList.add( 'visible' );\n let wptbTableInnerBorderSlider = document.getElementById( 'wptb-table-inner-border-slider' );\n let wptbTableInnerBorderNumber = document.getElementById( 'wptb-table-inner-border-number' );\n wptbTableInnerBorderSlider.value = parseInt( applyInnerBorder );\n wptbTableInnerBorderNumber.value = parseInt( applyInnerBorder );\n }\n }\n } else {\n innerBorderCheckInput.checked = false;\n }\n }\n \n if ( ( tableBorderWidth && parseInt( tableBorderWidth ) > 0 ) || ( applyInnerBorder && parseInt( applyInnerBorder ) > 0 ) ) {\n document.getElementById( 'wptb-table-border-color-set-area' ).style.display = '';\n }\n }\n }\n \n tableBorderColorWidthSavedSet();\n\n jQuery('#wptb-table-border-color').wpColorPicker({\n change: function (event, ui) {\n var tableCells = table.getElementsByTagName('td');\n table.style.border = document.querySelector('#wptb-table-border-number').value + 'px solid ' + ui.color.toString();\n\n for (var i = 0; i < tableCells.length; i++) {\n let tableInnerborderNumber = document.querySelector('#wptb-table-inner-border-number').value;\n if ( document.getElementById('wptb-inner-border-check').checked ) {\n tableCells[i].style.border = ( tableInnerborderNumber != 0 ? tableInnerborderNumber : 1 ) + 'px solid ' + ui.color.toString();\n }\n }\n WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving( event );\n },\n clear: function() {\n var tableCells = table.getElementsByTagName('td');\n table.style.borderColor = '';\n\n for (var i = 0; i < tableCells.length; i++) {\n tableCells[i].style.borderColor = '';\n }\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n });\n\n function addInnerBorderSize(value) {\n var tableCells = table.getElementsByTagName('td');\n for (var i = 0; i < tableCells.length; i++) {\n tableCells[i].style.borderWidth = document.querySelector('#wptb-table-inner-border-number').value + 'px';\n tableCells[i].style.borderStyle = 'solid';\n }\n }\n\n function addCellPadding(value) {\n var tableCells = table.getElementsByTagName('td');\n for (var i = 0; i < tableCells.length; i++) {\n tableCells[i].style.padding = value + 'px';\n }\n }\n\n function addInnerBorder( checked ) {\n var styles, color = document.querySelector('#wptb-table-border-color').value != undefined ?\n document.querySelector('#wptb-table-border-color').value : 'rgb(0,0,0)';\n if ( document.querySelector( '#wptb-table-inner-border-slider' ).value == 0 || document.querySelector( '#wptb-table-inner-border-number' ).value == 0 ) {\n document.querySelector( '#wptb-table-inner-border-slider' ).value = 1;\n document.querySelector( '#wptb-table-inner-border-number' ).value = 1;\n }\n let width = document.querySelector( '#wptb-table-inner-border-slider' ).value + 'px';\n let wptbPreviewTable = document.getElementsByClassName('wptb-preview-table');\n if( wptbPreviewTable.length > 0 ) {\n if (checked == 'checked') {\n document.getElementById('wptb-apply-inner-border').style.marginBottom = '0px';\n var tableCells = wptbPreviewTable[0].getElementsByTagName( 'td' );\n for (var i = 0; i < tableCells.length; i++) {\n tableCells[i].style.border = width + ' solid ' + color;\n }\n document.getElementById( 'wptb-apply-inner-border' ).classList.add( 'visible' );\n } else {\n document.getElementById( 'wptb-apply-inner-border' ).classList.remove( 'visible' );\n var tableCells = wptbPreviewTable[0].getElementsByTagName( 'td' );\n for (var i = 0; i < tableCells.length; i++) {\n tableCells[i].style.border = '0px solid ' + color;\n tableCells[i].style.border = null;\n }\n }\n }\n \n }\n\n function addBorderSize( value ) {\n table.style.borderWidth = value + 'px';\n table.style.borderStyle = 'solid';\n }\n \n function cellPaddingSavedSet() {\n let table = document.getElementsByClassName('wptb-preview-table');\n \n if ( table.length > 0 ) {\n let td = table[0].querySelector( 'td' );\n \n if ( td ) {\n let padding = td.style.padding;\n \n if ( padding ) {\n let wptbTableCellSlider = document.getElementById('wptb-table-cell-slider'),\n wptbTableCellNumber = document.getElementById('wptb-table-cell-number');\n \n if ( wptbTableCellSlider ) {\n wptbTableCellSlider.value = parseInt( padding );\n }\n if ( wptbTableCellNumber ) {\n wptbTableCellNumber.value = parseInt( padding );\n }\n }\n }\n }\n }\n \n cellPaddingSavedSet();\n \n let wptbTableBorderNumber = document.getElementById( 'wptb-table-border-number' );\n WPTB_Helper.numberImputSize( wptbTableBorderNumber, 1, 50 );\n \n let wptbTableInnerBorderNumber = document.getElementById( 'wptb-table-inner-border-number' );\n WPTB_Helper.numberImputSize( wptbTableInnerBorderNumber, 1, 50 );\n \n let wptbTableCellNumber = document.getElementById( 'wptb-table-cell-number' );\n WPTB_Helper.numberImputSize( wptbTableCellNumber, 1, 50 );\n \n let wptbTextfontSizeNumber = document.getElementById( 'wptb-size-number' );\n WPTB_Helper.numberImputSize( wptbTextfontSizeNumber, 1, 50 );\n \n let wptbImageWidthNumber = document.getElementById( 'wptb-size-number' );\n WPTB_Helper.numberImputSize( wptbImageWidthNumber, 2, 100 );\n \n let wptbTableColumnWidthNumber = document.getElementById( 'wptb-table-column-width-number' );\n WPTB_Helper.numberImputSize( wptbTableColumnWidthNumber, 2, 500 );\n \n let wptbTableRowHeightNumber = document.getElementById( 'wptb-table-row-height-number' );\n WPTB_Helper.numberImputSize( wptbTableRowHeightNumber, 2, 200 );\n \n \n \n document.getElementById('wptb-table-cell-slider').oninput = function () {\n document.getElementById('wptb-table-cell-number').value = this.value;\n addCellPadding(this.value);\n table.tdDefaultWidth();\n };\n \n document.getElementById('wptb-table-cell-slider').onchange = function() {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n\n document.getElementById('wptb-table-cell-number').onchange = function () {\n document.getElementById('wptb-table-cell-slider').value = this.value;\n addCellPadding(this.value);\n table.tdDefaultWidth();\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n document.getElementById('wptb-table-border-slider').oninput = function () {\n document.getElementById('wptb-table-border-number').value = this.value;\n addBorderSize(this.value);\n table.tdDefaultWidth();\n \n let wptbInnerBorderCheck = document.getElementById('wptb-inner-border-check').checked,\n tableBorderColorSetArea = document.getElementById( 'wptb-table-border-color-set-area' );\n if ( this.value == 0 && wptbInnerBorderCheck == false ) {\n tableBorderColorSetArea.style.display = 'none';\n } else {\n tableBorderColorSetArea.style.display = '';\n }\n };\n \n document.getElementById('wptb-table-border-slider').onchange = function() {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n\n document.getElementById('wptb-table-border-number').onchange = function () {\n document.getElementById('wptb-table-border-slider').value = this.value;\n addBorderSize(this.value);\n table.tdDefaultWidth();\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n document.getElementById('wptb-table-inner-border-slider').oninput = function () {\n document.getElementById('wptb-table-inner-border-number').value = this.value;\n addInnerBorderSize(this.value);\n table.tdDefaultWidth();\n };\n \n document.getElementById('wptb-table-inner-border-slider').onchange = function () {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n\n document.getElementById('wptb-table-inner-border-number').onchange = function () {\n document.getElementById('wptb-table-inner-border-slider').value = this.value;\n addInnerBorderSize(this.value);\n table.tdDefaultWidth();\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n document.getElementById('wptb-inner-border-check').onchange = function () {\n if( table ) {\n let val = this.checked ? 'checked' : 'unchecked';\n addInnerBorder( val );\n let borderWidth = document.getElementById('wptb-table-border-slider').value,\n tableBorderColorSetArea = document.getElementById( 'wptb-table-border-color-set-area' );\n if( val == 'unchecked' && borderWidth == 0 ) {\n tableBorderColorSetArea.style.display = 'none';\n } else {\n tableBorderColorSetArea.style.display = '';\n }\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n };\n \n document.getElementById( 'wptb-table-column-width-slider' ).oninput = function () {\n document.getElementById( 'wptb-table-column-width-number' ).value = this.value;\n table.addColumnWidth( this.value );\n };\n \n document.getElementById( 'wptb-table-column-width-slider' ).onchange = function () {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n \n document.getElementById( 'wptb-table-column-width-number' ).onchange = function () {\n document.getElementById( 'wptb-table-column-width-slider' ).value = this.value;\n table.addColumnWidth( this.value );\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n \n document.getElementById( 'wptb-table-column-width-auto-fixed' ).onchange = function () {\n if( this.checked ) {\n let highlighted = table.querySelector( '.wptb-highlighted' );\n let width = WPTB_Helper.getColumnWidth( table, highlighted );\n table.addColumnWidth( width );\n } else {\n table.addColumnWidth( false, true );\n let highlighted = table.querySelector( '.wptb-highlighted' );\n let width = WPTB_Helper.getColumnWidth( table, highlighted );\n document.getElementById( 'wptb-table-column-width-number' ).value = width;\n document.getElementById( 'wptb-table-column-width-slider' ).value = width;\n }\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n document.getElementById( 'wptb-table-row-height-slider' ).oninput = function () {\n document.getElementById( 'wptb-table-row-height-number' ).value = this.value;\n table.addRowHeight( this.value );\n };\n \n document.getElementById( 'wptb-table-row-height-slider' ).onchange = function () {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n document.getElementById( 'wptb-table-row-height-number' ).onchange = function () {\n document.getElementById( 'wptb-table-row-height-slider' ).value = this.value;\n table.addRowHeight( this.value );\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n \n document.getElementById( 'wptb-table-row-height-auto-fixed' ).onchange = function () {\n if( this.checked ) {\n let highlighted = table.querySelector( '.wptb-highlighted' );\n let height = WPTB_Helper.getRowHeight( table, highlighted );\n table.addRowHeight( height );\n } else {\n table.addRowHeight( false, true );\n let highlighted = table.querySelector( '.wptb-highlighted' );\n let height = WPTB_Helper.getRowHeight( table, highlighted );\n document.getElementById( 'wptb-table-row-height-number' ).value = height;\n document.getElementById( 'wptb-table-row-height-slider' ).value = height;\n }\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n \n document.getElementById( 'wptb-adaptive-table-checkbox' ).onchange = function() {\n if( this.checked ) {\n table.dataset.wptbAdaptiveTable = 1;\n } else {\n table.dataset.wptbAdaptiveTable = 0;\n }\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n \n function createMobileHeadForTable( table, thisEvent ) {\n \n if( thisEvent.checked ) {\n WPTB_Helper.dataTitleColumnSet( table );\n \n table.classList.add( 'wptb-table-preview-head' );\n table.rows[0].classList.add( 'wptb-table-head' );\n } else {\n let rows = table.rows;\n table.classList.remove( 'wptb-table-preview-head' );\n rows[0].classList.remove( 'wptb-table-head' );\n \n for ( let i = 1; i < rows.length; i++ ) {\n let thisRow = rows[i],\n thisRowChildren = thisRow.children;\n for( let j = 0; j < thisRowChildren.length; j++ ) {\n thisRowChildren[j].removeAttribute( 'data-wptb-title-column' );\n thisRowChildren[j].removeAttribute( 'data-wptb-title-column-font-size' );\n thisRowChildren[j].removeAttribute( 'data-wptb-title-column-color' );\n thisRowChildren[j].removeAttribute( 'data-wptb-title-background-color' );\n thisRowChildren[j].removeAttribute( 'data-wptb-title-align' );\n }\n }\n }\n }\n \n document.getElementById( 'wptb-top-row-as-header' ).onchange = function () {\n createMobileHeadForTable( table, this );\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n\n for (var i = 0; i < wptbElementButtons.length; i++) {\n wptbElementButtons[i].ondragstart = function (e) {\n e.dataTransfer.setData('wptbElement', this.dataset.wptbElement);\n e.dataTransfer.setData( 'wptbElIndic-' + this.dataset.wptbElement, 'wptbElIndic-' + this.dataset.wptbElement );\n }\n }\n \n if( table ) {\n document.getElementById('wptb-activate-cell-management-mode').onclick = table.toggleTableEditMode;\n document.getElementById( 'wptb-table-edit-mode-close' ).onclick = table.toggleTableEditMode;\n document.getElementById( 'wptb-left-scroll-panel-curtain-close' ).onclick = table.toggleTableEditMode;\n document.getElementById('wptb-add-end-row').onclick = table.addRowToTheEnd;\n document.getElementById('wptb-add-start-row').onclick = table.addRowToTheStart;\n document.getElementById('wptb-add-row-before').onclick = table.addRowBefore;\n document.getElementById('wptb-add-row-after').onclick = table.addRowAfter;\n document.getElementById('wptb-add-end-column').onclick = table.addColumnEnd;\n document.getElementById('wptb-add-start-column').onclick = table.addColumnStart;\n document.getElementById('wptb-add-column-before').onclick = table.addColumnBefore;\n document.getElementById('wptb-add-column-after').onclick = table.addColumnAfter;\n document.getElementById('wptb-delete-column').onclick = table.deleteColumn;\n document.getElementById('wptb-delete-row').onclick = table.deleteRow;\n document.getElementById('wptb-merge-cells').onclick = table.mergeCells;\n document.getElementById('wptb-split-cell').onclick = table.splitCell;\n }\n \n document.querySelector( '.wptb-left-panel-extend' ).onclick = function() {\n let wptbContainer = document.querySelector( '.wptb-container' );\n if( wptbContainer ) {\n if ( wptbContainer.classList.contains( 'collapsed' ) ) {\n wptbContainer.classList.remove( 'collapsed' );\n } else {\n wptbContainer.classList.add( 'collapsed' );\n }\n }\n };\n \n // this code hides the \"element parameters\" area \n // when clicked outside this element and its \"tinymce\" toolbar \n let wptbBuilderPanel = document.getElementsByClassName( 'wptb-builder-panel' )[0];\n wptbBuilderPanel.onclick = function( e ) {\n if( ! e.target.classList.contains( 'wptb-ph-element' ) && ! WPTB_Helper.findAncestor( e.target, 'wptb-ph-element' ) && \n ! e.target.classList.contains( 'wptb-fixed-toolbar' ) && ! WPTB_Helper.findAncestor( e.target, 'wptb-fixed-toolbar' ) ) {\n clickOnFreeSpace();\n } \n };\n \n let wptbHeader = document.getElementsByClassName( 'wptb-header' );\n if( wptbHeader.length > 0 ) wptbHeader = wptbHeader[0];\n wptbHeader.onclick = function() {\n clickOnFreeSpace();\n }\n \n function clickOnFreeSpace() {\n document.getElementsByClassName( 'wptb-elements-container' )[0].style.display = 'table';\n document.getElementsByClassName( 'wptb-settings-section' )[0].style.display = 'block';\n document.getElementById( 'element-options-group' ).style.display = 'none';\n let wpcdFixedToolbar = document.getElementById( 'wpcd_fixed_toolbar' );\n if( wpcdFixedToolbar.hasAttribute( 'data-toolbar-active-id' ) ) {\n document.getElementById( wpcdFixedToolbar.getAttribute( 'data-toolbar-active-id' ) ).classList.remove( 'toolbar-active' );\n }\n }\n \n};","var WPTB_List = function ( innerElements, DOMElementProt ) {\n\n var el_L = document.createElement('ul'), item,\n DOMElement = document.createElement('div'),\n kindIndexProt = undefined,\n copy = false;\n DOMElement.classList.add( 'wptb-list-item-container' );\n\n this.kind = 'list';\n\n if (innerElements === '') {\n //Case for edit mode list\n } else if ( !innerElements ) {\n for (var i = 0; i < 3; i++) {\n item = new WPTB_ListItem( '<p>List Item ' + (i + 1) + '</p>');\n el_L.appendChild(item.getDOMElement());\n }\n } else {\n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\n kindIndexProt = wptbElementMutch[1];\n copy = true;\n };\n \n for ( var i = 0; i < innerElements.length; i++ ) {\n let listItem = DOMElementProt.querySelector( 'li' );\n item = new WPTB_ListItem( innerElements[i], listItem, true );\n el_L.appendChild(item.getDOMElement());\n }\n }\n DOMElement.appendChild(el_L);\n //window.addElementOptions('list', elList);\n\n this.getDOMElement = function () {\n return DOMElement;\n }\n applyGenericItemSettings( this, kindIndexProt, copy );\n WPTB_Helper.listItemsRecalculateIndex( el_L );\n\n return this;\n};","var WPTB_ListItem = function ( text, DOMElementProt, copy ) {\n let wptbListItemReturn;\n if ( DOMElementProt == undefined || ( DOMElementProt && copy )) {\n if (text == undefined) text = 'New List Item';\n var DOMElement = document.createElement('li'),\n //divdot = document.createElement('div'),\n divcontent = document.createElement('div');\n //libullet = document.createElement('li');\n //divdot.classList.add('wptb-list-item-style-dot');\n divcontent.classList.add('wptb-list-item-content');\n //libullet.classList.add('wptb-bullet');\n if ( DOMElementProt ) {\n let styleDot = DOMElementProt.getAttribute( 'style' );\n if ( styleDot ) {\n DOMElement.setAttribute( 'style', styleDot );\n }\n }\n //DOMElement.appendChild(divdot);\n DOMElement.appendChild(divcontent);\n //divdot.appendChild(libullet);\n divcontent.innerHTML = text;\n divcontent.onkeyup = window.listItemKeyListener;\n \n wptbListItemReturn = true;\n } else {\n var DOMElement = DOMElementProt;\n var divcontent = DOMElement.getElementsByClassName( 'wptb-list-item-content' )[0];\n \n divcontent.onkeyup = window.listItemKeyListener;\n \n wptbListItemReturn = false;\n }\n \n DOMElement.onmouseenter = function ( event ) {\n let wptbActionsField = new WPTB_ActionsField();\n \n wptbActionsField.addActionField( 2, DOMElement );\n \n wptbActionsField.setParameters( DOMElement );\n console.log(DOMElement);\n };\n\n DOMElement.onmouseleave = function ( event ) {\n let wptbActionsField = new WPTB_ActionsField();\n \n wptbActionsField.leaveFromField( event, DOMElement, 2 );\n \n return false;\n };\n\n this.getDOMElement = function () {\n return DOMElement;\n };\n \n if ( wptbListItemReturn ) {\n return this;\n }\n};","var MultipleSelect = function () {\n\n\tvar selectedCells = [],\n\t\tmultipleCellMode = false;\n\n\tthis.activateMultipleSelectMode = function () {\n\t\tselectedCells = [];\n\t\tvar tds = document.getElementsByClassName('wptb-preview-table')[0].getElementsByTagName('td');\n\t\tfor (var i = 0; i < tds.length; i++) {\n\t\t\ttds[i].classList.remove('wptb-highlighted');\n\t\t}\n\t\tmultipleCellMode = true;\n\t}\n\n\tthis.deactivateMultipleSelectMode = function () {\n\t\tmultipleCellMode = false;\n\t}\n\n\tthis.isActivated = function () {\n\t\treturn multipleCellMode;\n\t}\n\n\tthis.pushSelectedCell = function (cell) {\n\t\tif (!multipleCellMode) {\n\t\t\treturn;\n\t\t}\n\t\tselectedCells.push(cell);\n\t\tcell.classList.add('wptb-highlighted');\n\t};\n\n\tthis.selectedCells = function () {\n\t\treturn selectedCells;\n\t}\n\n\tthis.flushSelectedCells = function () {\n\t\tselectedCells = [];\n\t}\n\n\tthis.getFirst = function () {\n\t\tvar minXIndex = 1000, minYIndex = 1000, first;\n\t\tfor (var i = selectedCells.length - 1; i >= 0; i--) {\n\t\t\tif (minXIndex >= selectedCells[i].dataset.xIndex\n\t\t\t\t&& minYIndex >= selectedCells[i].dataset.yIndex) {\n\t\t\t\tfirst = selectedCells[i];\n\t\t\t\tminXIndex = selectedCells[i].dataset.xIndex;\n\t\t\t\tminYIndex = selectedCells[i].dataset.yIndex;\n\t\t\t}\n\t\t}\n\t\treturn first;\n\t}\n\n\tthis.getLast = function () {\n\t\tvar maxXIndex = -1, maxYIndex = -1, last;\n\t\tfor (var i = selectedCells.length - 1; i >= 0; i--) {\n\t\t\tif (maxXIndex <= selectedCells[i].dataset.xIndex\n\t\t\t\t&& maxYIndex <= selectedCells[i].dataset.yIndex) {\n\t\t\t\tlast = selectedCells[i];\n\t\t\t\tmaxXIndex = selectedCells[i].dataset.xIndex;\n\t\t\t\tmaxYIndex = selectedCells[i].dataset.yIndex;\n\t\t\t}\n\t\t}\n\t\treturn last;\n\t}\n\n\tthis.removeAllButFirst = function () {\n\t\tvar td = this.getFirst();\n\t\tfor (var i = 1; i < selectedCells.length; i++) {\n\t\t\tselectedCells[i].classList.add('wptb-fused-cell-' + td.dataset.xIndex + '-' + td.dataset.yIndex);\n\t\t}\n\t}\n\n\treturn this;\n\n};","var WPTB_Parser = function (code) {\n let div = document.createElement( 'div' );\n div.innerHTML = code;\n \n let table = div.children[0];\n let columnTitleMobile = [...table.querySelectorAll( '.wptb-column-title-mobile-container' )];\n \n for( let i = 0; i < columnTitleMobile.length; i++ ) {\n let parent = columnTitleMobile[i].parentNode;\n parent.removeChild( columnTitleMobile[i] );\n }\n \n let tds = table.querySelectorAll( 'td' );\n for ( let i = 0; i < tds.length; i++ ) {\n tds[i].classList.add( 'wptb-droppable' );\n tds[i].classList.remove( 'wptb-column-title-mobile-not-elements' );\n }\n \n return table;\n}","var WPTB_Parser2 = function (code) {\n if( Array.isArray( code ) ) {\n let elementHtml;\n \n if ( code.length == 1) {\n return elementHtml.appendChild( document.createTextNode( code[0] ) );\n }\n if( 0 in code ) {\n let tagName = code[0];\n elementHtml = document.createElement( tagName );\n \n if ( 1 in code ) {\n if( Array.isArray( code[1] ) ) {\n let attributes = code[1];\n \n for( let i = 0; i < attributes.length; i++ ) {\n if( Array.isArray( attributes[i] ) ) {\n elementHtml.setAttribute(attributes[i][0], attributes[i][1]);\n }\n }\n }\n }\n \n if ( 2 in code ) {\n if ( Array.isArray( code[2] ) ) {\n for ( let i = 0; i < code[2].length; i++ ) {\n if ( typeof code[2][i] === 'string' && tagName.toLowerCase() == 'p' ) {\n elementHtml.appendChild( document.createTextNode( code[2][i] ) );\n continue;\n }\n if ( ! WPTB_Parser( code[2][i] ) ) continue;\n elementHtml.appendChild( WPTB_Parser( code[2][i] ) );\n }\n } else if( typeof code[2] === 'string' ) {\n elementHtml.appendChild( document.createTextNode( code[2] ) );\n }\n \n }\n }\n \n return elementHtml;\n } else {\n return false;\n }\n \n}","var WPTB_Settings = function () {\n var elems = document.getElementsByClassName('wptb-element');\n\n for ( var i = 0; i < elems.length; i++ ) {\n elems[i].ondragstart = function ( event ) {\n event.dataTransfer.effectAllowed = 'move';\n event.dataTransfer.setData( 'wptbElement', event.target.dataset.wptbElement );\n event.dataTransfer.setData( 'wptbElIndic-' + event.target.dataset.wptbElement, 'wptbElIndic-' + event.target.dataset.wptbElement );\n }\n elems[i].ondragend = function () {\n let wptbDropHandle = document.querySelector( '.wptb-drop-handle' ),\n wptbDropBorderMarker = document.querySelector( '.wptb-drop-border-marker' );\n if ( wptbDropHandle || wptbDropBorderMarker ) {\n wptbDropHandle.style.display = 'none';\n wptbDropBorderMarker.style.display = 'none';\n }\n }\n };\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n let wptbUndo = document.getElementsByClassName( 'wptb-undo' );\n if( wptbUndo.length > 0 ) {\n wptbUndo = wptbUndo[0];\n \n wptbUndo.onclick = function( event ) {\n if( ! this.classList.contains( 'wptb-undoredo-disabled' ) ) {\n wptbTableStateSaveManager.tableStateGet( this.dataset.wptbUndoredo );\n let wptbUndoRedoContainer = document.getElementsByClassName( 'wptb-undo-redo-container' );\n if( wptbUndoRedoContainer.length > 0 ) {\n wptbUndoRedoContainer = wptbUndoRedoContainer[0];\n wptbUndoRedoContainer.onmouseleave = function( event ) {\n event.target.onmouseleave = '';\n WPTB_Table();\n }\n }\n }\n \n }\n }\n \n let wptbRedo = document.getElementsByClassName( 'wptb-redo' );\n if( wptbRedo.length > 0 ) {\n wptbRedo = wptbRedo[0];\n \n wptbRedo.onclick = function( event ) {\n if( ! this.classList.contains( 'wptb-undoredo-disabled' ) ) {\n wptbTableStateSaveManager.tableStateGet( this.dataset.wptbUndoredo );\n let wptbUndoRedoContainer = document.getElementsByClassName( 'wptb-undo-redo-container' );\n if( wptbUndoRedoContainer.length > 0 ) {\n wptbUndoRedoContainer = wptbUndoRedoContainer[0];\n wptbUndoRedoContainer.onmouseleave = function( event ) {\n event.target.onmouseleave = '';\n WPTB_Table();\n }\n }\n }\n \n }\n }\n \n let shortcodePopupWindow = document.getElementsByClassName( 'wptb-popup-window-modal' )[0];\n document.getElementsByClassName( 'wptb-embed-btn' )[0].onclick = function () {\n if( ! this.classList.contains( 'wptb-button-disable' ) ) {\n shortcodePopupWindow.classList.add( 'wptb-popup-show' );\n }\n }\n \n window.onbeforeunload = function(e) {\n let wptbSaveDisabled = document.getElementsByClassName( 'wptb-save-disabled' );\n if( wptbSaveDisabled.length == 0 ) {\n return true;\n } else {\n return null;\n }\n };\n \n \n document.getElementsByClassName( 'wptb-popup-dark-area' )[0].onclick = function () {\n shortcodePopupWindow.classList.remove( 'wptb-popup-show' );\n }\n \n document.getElementsByClassName( 'wptb-popup-window-close-icon' )[0].onclick = function () {\n shortcodePopupWindow.classList.remove( 'wptb-popup-show' );\n }\n \n document.getElementsByClassName( 'wptb-preview-btn' )[0].onclick = function ( e ) {\n if( this.classList.contains( 'wptb-button-disable' ) ) {\n e.preventDefault();\n }\n }\n\n document.getElementsByClassName( 'wptb-save-btn' )[0].onclick = function ( event ) {\n if( ( ! event.target.dataset.wptbTableStateNumberSave && window.wptbTableStateNumberShow == 0 ) || \n window.wptbTableStateNumberShow == event.target.dataset.wptbTableStateNumberSave ) {\n return;\n }\n let bar = document.querySelector( '.wptb-edit-bar' );\n if ( bar && bar.classList.contains( 'visible' ) ) {\n let table = document.getElementsByClassName( 'wptb-preview-table' )[0];\n table.toggleTableEditMode();\n }\n\n let http = new XMLHttpRequest(),\n url = ( wptb_admin_object ? wptb_admin_object.ajaxurl : ajaxurl ) + \"?action=save_table\",\n t = document.getElementById( 'wptb-setup-name' ).value.trim(),\n messagingArea,\n code = document.getElementsByClassName( 'wptb-preview-table' );\n if( code.length > 0 ) {\n code = WPTB_Stringifier( code[0] );\n code = code.outerHTML;\n } else { \n code = '';\n }\n \n if ( t === '' || code === '' ) {\n let messagingAreaText = '';\n if( t === '' ) messagingAreaText += 'You must assign a name to the table before saving it.</br>';\n if( code === '' ) messagingAreaText += 'Table wasn\\'t created';\n messagingArea = document.getElementById( 'wptb-messaging-area' );\n messagingArea.innerHTML = '<div class=\"wptb-error wptb-message\">Error: ' + messagingAreaText + '</div>';\n messagingArea.classList.add( 'wptb-warning' );\n setTimeout(function () {\n messagingArea.removeChild( messagingArea.firstChild );\n }, 4000 );\n return;\n }\n\n let params = {\n title: t,\n content: code,\n security_code: wptb_admin_object.security_code\n };\n if (( rs = WPTB_Helper.detectMode() ) || ( rs = document.wptbId )) {\n params.id = rs;\n }\n params = JSON.stringify( params );\n\n http.open('POST', url, true);\n http.setRequestHeader( 'Content-type', 'application/json; charset=utf-8' );\n\n http.onreadystatechange = function (action) {\n if ( this.readyState == 4 && this.status == 200 ) {\n var data = JSON.parse( http.responseText );\n messagingArea = document.getElementById( 'wptb-messaging-area' );\n\n if ( data[0] == 'saved' ) {\n document.wptbId = data[1];\n messagingArea.innerHTML = '<div class=\"wptb-success wptb-message\">Table \"' + t + '\" was successfully saved.</div>';\n document.getElementsByClassName( 'wptb-embed-btn' )[0].classList.remove( 'wptb-button-disable' );\n document.getElementById( 'wptb-embed-shortcode' ).value = '[wptb id=' + data[1] + ']';\n let wptbPreviewBtn = document.getElementsByClassName( 'wptb-preview-btn' );\n if( wptbPreviewBtn.length > 0 ) {\n wptbPreviewBtn = wptbPreviewBtn[0];\n wptbPreviewBtn.classList.remove( 'wptb-button-disable' );\n let wptbPreviewBtnHref = wptbPreviewBtn.dataset.previewHref;\n wptbPreviewBtnHref = wptbPreviewBtnHref.replace( 'empty', data[1] );\n wptbPreviewBtn.setAttribute( 'href', wptbPreviewBtnHref );\n }\n \n } else if( data[0] == 'edited' ) {\n messagingArea.innerHTML = '<div class=\"wptb-success wptb-message\">Table \"' + t + '\" was successfully updated.</div>';\n event.target.dataset.wptbTableStateNumberSave = window.wptbTableStateNumberShow;\n \n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\n if( wptbSaveBtn.length > 0 ) {\n wptbSaveBtn = wptbSaveBtn[0];\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\n }\n } else {\n messagingArea.innerHTML = '<div class=\"wptb-error wptb-message\">Safety problems</div>';\n }\n messagingArea.classList.add( 'wptb-success' );\n setTimeout( function () {\n messagingArea.removeChild( messagingArea.firstChild );\n }, 4000 );\n }\n }\n http.send( params );\n }\n};\n","var WPTB_Space = function ( elSpaceBetween ) {\n\n function newElementProxy(el) {\n if (el.includes('list')) {\n return new WPTB_List();\n } else if (el.includes('image')) {\n return new WPTB_Image();\n } else if (el.includes('text')) {\n return new WPTB_Text();\n } else if (el.includes('button')) {\n return new WPTB_Button();\n }\n }\n let spaceBetween;\n if ( ! elSpaceBetween ) {\n spaceBetween = document.createElement('div'), spaceBetween.classList.add('wptb-space-between');\n } else {\n spaceBetween = elSpaceBetween;\n }\n\n spaceBetween.ondragenter = function () {\n this.classList.add('visible');\n };\n spaceBetween.ondragover = function (event) {\n event.preventDefault();\n };\n\n spaceBetween.ondragleave = function () {\n this.classList.remove('visible');\n };\n\n spaceBetween.ondrop = function (event) {\n event.stopPropagation();\n\n var p = event.target.nextSibling,\n td = event.target,\n element, t_space, spaceParent;\n\n while ( !td.classList.contains('wptb-droppable') ) {\n td = td.parentNode;\n }\n\n if (event.dataTransfer.getData('wptbElement')) {\n element = newElementProxy(event.dataTransfer.getData('wptbElement'));\n this.classList.remove('visible');\n\n if (p == null) {\n td.appendChild(element.getDOMElement());\n td.appendChild(new WPTB_Space());\n } else {\n td.insertBefore(element.getDOMElement(), p);\n td.insertBefore(new WPTB_Space(), p);\n }\n\n } else {\n alert(event.dataTransfer.getData('node'));\n element = document.getElementsByClassName(event.dataTransfer.getData('node'))[0];\n t_space = element.nextSibling;\n spaceParent = element.parentNode;\n if (t_space != undefined) {\n spaceParent.removeChild(t_space);\n }\n\n if (p == null) {\n td.appendChild(element);\n td.appendChild(new WPTB_Space());\n } else {\n td.insertBefore(element, p);\n td.insertBefore(new WPTB_Space(), p);\n }\n\n }\n this.classList.remove('visible');\n };\n \n if ( ! elSpaceBetween ) {\n return spaceBetween;\n }\n};","var WPTB_StarRating = function ( DOMElementProt, countStarts ) {\n if( ! countStarts ) {\n if( ! DOMElementProt ) {\n countStarts = 5;\n } else {\n countStarts = DOMElementProt.querySelectorAll( 'li' ).length;\n }\n }\n \n let DOMElement = document.createElement('div'),\n ratingStarsBox = document.createElement( 'div' ),\n ratingStarsList = document.createElement( 'ul' ),\n successBox = document.createElement( 'div' ),\n textMessage = document.createElement( 'div' ),\n kindIndexProt = undefined,\n copy = false;\n \n DOMElement.classList.add( 'wptb-star_rating-container' );\n ratingStarsBox.classList.add( 'wptb-rating-stars-box' );\n ratingStarsList.classList.add( 'wptb-rating-stars-list' );\n successBox.classList.add( 'wptb-success-box' );\n successBox.style.display = 'none';\n textMessage.classList.add( 'wptb-text-message' );\n \n let filledRatingStarHtml = '<svg version=\"1.1\" id=\"Capa_1\" xmlns=\"http://www.w3.org/2000/svg\" \\n\\\n xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\" width=\"20px\" viewBox=\"0 0 426.667 426.667\" \\n\\\n style=\"enable-background:new 0 0 426.667 426.667;\" xml:space=\"preserve\">\\n\\\n <polygon points=\"426.667,165.12 273.28,152.107 213.333,10.667 153.387,152.107 0,165.12 \\n\\\n 116.48,266.027 81.493,416 213.333,336.427 345.173,416 310.187,266.027\"/></svg>';\n \n let notFilledRatingStarHtml = '<svg version=\"1.1\" id=\"Capa_1\" xmlns=\"http://www.w3.org/2000/svg\" \\n\\\n xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\" width=\"20px\" viewBox=\"0 0 426.667 426.667\" \\n\\\n style=\"enable-background:new 0 0 426.667 426.667;\" xml:space=\"preserve\">\\n\\\n <path d=\"M426.667,165.12L273.28,151.893L213.333,10.667l-59.947,141.44L0,165.12l116.48,100.907L81.493,416l131.84-79.573\\n\\\n L345.173,416L310.4,266.027L426.667,165.12z M213.333,296.533L133.12,344.96l21.333-91.307l-70.827-61.44l93.44-8.107 \\n\\\n l36.267-85.973l36.48,86.187l93.44,8.107l-70.827,61.44l21.333,91.307L213.333,296.533z\"/></svg>';\n \n let halfFilledRatingStarHtml = '<svg version=\"1.1\" id=\"Capa_1\" xmlns=\"http://www.w3.org/2000/svg\" \\n\\\n xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\" width=\"20px\" viewBox=\"0 0 426.667 426.667\" \\n\\\n style=\"enable-background:new 0 0 426.667 426.667;\" xml:space=\"preserve\">\\n\\\n <path d=\"M426.667,165.12L273.28,151.893L213.333,10.667l-59.947,141.44L0,165.12l116.48,100.907L81.493,416l131.84-79.573 \\n\\\n L345.173,416L310.4,266.027L426.667,165.12z M213.333,296.533v-198.4l36.48,86.187l93.44,8.107l-70.827,61.44l21.333,91.307 \\n\\\n L213.333,296.533z\"/></svg>';\n \n \n for( let i = 0; i < countStarts; i++ ) {\n let ratingStar = document.createElement( 'li' );\n ratingStar.classList.add( 'wptb-rating-star' );\n let ratingStarZeroSet = '';\n if( i == 0 ) {\n ratingStarZeroSet = '<span class=\"wptb-rating-star-zero-set\"></span>';\n }\n \n ratingStar.innerHTML = '<span class=\"wptb-rating-star-left-signal-part\">' + ratingStarZeroSet + '</span><span class=\"wptb-filled-rating-star\">' + filledRatingStarHtml + '</span>'\n + '<span class=\"wptb-not-filled-rating-star\">' + notFilledRatingStarHtml + '</span>'\n + '<span class=\"wptb-half-filled-rating-star\">' + halfFilledRatingStarHtml + '</span><span class=\"wptb-rating-star-right-signal-part\"></span>';\n ratingStar.dataset.value = i + 1;\n ratingStarsList.appendChild( ratingStar );\n }\n\n successBox.appendChild( textMessage );\n ratingStarsBox.appendChild( ratingStarsList );\n ratingStarsBox.appendChild( successBox );\n DOMElement.appendChild( ratingStarsBox );\n \n \n\n \n // Creation of a new star rating when copying to avoid errors when assigning new event handlers.\n if ( DOMElementProt ) {\n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\n kindIndexProt = wptbElementMutch[1];\n copy = true;\n };\n \n var wptbRatingStarsBox = DOMElementProt.querySelector( '.wptb-rating-stars-box' );\n if ( wptbRatingStarsBox ) {\n var wptbRatingStarsBoxAttributes = [...wptbRatingStarsBox.attributes];\n if ( wptbRatingStarsBoxAttributes.length > 0 ) {\n for( let i = 0; i < wptbRatingStarsBoxAttributes.length; i++ ) {\n if ( wptbRatingStarsBoxAttributes[i].name == 'style') {\n ratingStarsBox.setAttribute( wptbRatingStarsBoxAttributes[i].name, wptbRatingStarsBoxAttributes[i].value );\n }\n } \n }\n }\n \n let wptbRatingStarsOld = wptbRatingStarsBox.querySelectorAll( 'li' );\n let wptbRatingStars = ratingStarsList.querySelectorAll( 'li' );\n if ( wptbRatingStarsOld.length > 0 && wptbRatingStars.length > 0 ) {\n let iMax = wptbRatingStarsOld.length < countStarts ? wptbRatingStarsOld.length : countStarts;\n for( let i = 0; i < wptbRatingStarsOld.length; i++ ) {\n let wptbRatingStarsAttributes = [...wptbRatingStarsOld[i].attributes];\n if ( wptbRatingStarsAttributes.length > 0 ) {\n for( let j = 0; j < wptbRatingStarsAttributes.length; j++ ) {\n wptbRatingStars[i].setAttribute( wptbRatingStarsAttributes[j].name, wptbRatingStarsAttributes[j].value );\n } \n }\n \n let wptbRatingStarsOldSpan = wptbRatingStarsOld[i].children;\n let wptbRatingStarsSpan = wptbRatingStars[i].children;\n for( let k = 0; k < wptbRatingStarsOldSpan.length; k++ ){\n let wptbRatingStarsOldSpanAttributes = [...wptbRatingStarsOldSpan[k].attributes];\n if( wptbRatingStarsOldSpanAttributes.length > 0 ) {\n for ( let l = 0; l < wptbRatingStarsOldSpanAttributes.length; l++ ) {\n wptbRatingStarsSpan[k].setAttribute( wptbRatingStarsOldSpanAttributes[l].name, wptbRatingStarsOldSpanAttributes[l].value );\n let wptbRatingStarsOldSvg = wptbRatingStarsOldSpan[k].querySelector( 'svg' );\n if( wptbRatingStarsOldSvg ) {\n let wptbRatingStarsOldSvgStyle = wptbRatingStarsOldSvg.getAttribute( 'style' );\n wptbRatingStarsSpan[k].querySelector( 'svg' ).setAttribute( 'style', wptbRatingStarsOldSvgStyle );\n }\n }\n }\n }\n }\n }\n \n var wptbSuccessBox = wptbRatingStarsBox.querySelector( '.wptb-success-box' );\n if ( wptbSuccessBox ) {\n var wptbSuccessBoxAttributes = [...wptbSuccessBox.attributes];\n for( let i = 0; i < wptbSuccessBoxAttributes.length; i++ ) {\n if ( wptbSuccessBoxAttributes[i].name == 'style') {\n successBox.setAttribute( wptbSuccessBoxAttributes[i].name, wptbSuccessBoxAttributes[i].value );\n }\n } \n }\n \n var wptbTextMessage = wptbSuccessBox.querySelector( '.wptb-text-message' );\n if ( wptbTextMessage ) {\n textMessage.innerHTML = wptbTextMessage.innerHTML;\n var wptbTextMessageAttributes = [...wptbTextMessage.attributes];\n for( let i = 0; i < wptbTextMessageAttributes.length; i++ ) {\n if ( wptbTextMessageAttributes[i].name == 'style') {\n textMessage.setAttribute( wptbTextMessageAttributes[i].name, wptbTextMessageAttributes[i].value );\n }\n } \n }\n }\n \n this.kind = 'star_rating';\n\n this.getDOMElement = function () {\n return DOMElement;\n };\n\n applyGenericItemSettings( this, kindIndexProt, copy );\n \n return this;\n}","var WPTB_Stringifier = function ( codeMain ) {\n if ( codeMain ) {\n let code = codeMain.cloneNode( true );\n code.classList.add( 'wptb-table-preview-static-indic' );\n code.dataset.tableColumns = codeMain.columns;\n code.style.width = null;\n code.style.minWidth = null;\n code.style.maxWidth = null;\n \n let tds = code.getElementsByTagName( 'td' );\n if ( tds.length > 0 ) {\n for ( let i = 0; i < tds.length; i++ ) {\n \n if ( codeMain.querySelector( 'wptb-table-preview-head' ) ) {\n tds[i].removeAttribute( 'data-x-index' );\n }\n tds[i].removeAttribute( 'data-y-index' );\n tds[i].removeAttribute( 'draggable' );\n tds[i].classList.remove( 'wptb-droppable' );\n let innerElements = tds[i].getElementsByClassName( 'wptb-ph-element' );\n \n if ( innerElements.length > 0 ) {\n for ( let j = 0; j < innerElements.length; j++ ) {\n \n let mceContentBodys = innerElements[j].querySelectorAll( '.mce-content-body' );\n if( mceContentBodys.length > 0 ) {\n for ( let k = 0; k < mceContentBodys.length; k++ ) {\n mceContentBodys[k].classList.remove( 'mce-content-body' );\n }\n }\n \n let dataMceStyle = innerElements[j].querySelectorAll( '[data-mce-style]' );\n if ( dataMceStyle.length > 0 ) {\n for ( let k = 0; k < dataMceStyle.length; k++ ) {\n dataMceStyle[k].removeAttribute( 'data-mce-style' );\n }\n }\n \n let contentEditable = innerElements[j].querySelectorAll( '[contenteditable]' );\n if ( contentEditable.length > 0 ) {\n for ( let k = 0; k < contentEditable.length; k++ ) {\n contentEditable[k].removeAttribute( 'contenteditable' );\n }\n }\n \n let spellCheck = innerElements[j].querySelectorAll( '[spellcheck]' );\n if ( spellCheck.length > 0 ) {\n for ( let k = 0; k < spellCheck.length; k++ ) {\n spellCheck[k].removeAttribute( 'spellcheck' );\n }\n }\n \n let mceIds = innerElements[j].querySelectorAll( '[id^=mce_]' );\n if ( mceIds.length > 0 ) {\n for ( let k = 0; k < mceIds.length; k++ ) {\n mceIds[k].removeAttribute( 'id' );\n }\n }\n \n let wptbActions = innerElements[j].querySelectorAll( '.wptb-actions' );\n let wptbActionsLength = wptbActions.length;\n while ( wptbActionsLength > 0 ) {\n if( wptbActions[0] && wptbActions[0].parentNode ) {\n wptbActions[0].parentNode.removeChild( wptbActions[0] );\n wptbActionsLength--;\n } else {\n break;\n }\n \n } \n }\n }\n \n if( tds[i].hasAttribute( 'data-wptb-title-column' ) ) {\n let columnNameDivContainer = document.createElement( 'div' ),\n columnNameDiv = document.createElement( 'div' );\n columnNameDivContainer.classList.add( 'wptb-column-title-mobile-container' );\n columnNameDiv.classList.add( 'wptb-column-title-mobile' );\n columnNameDiv.dataset.wptbTitleColumn = tds[i].dataset.wptbTitleColumn;\n columnNameDiv.setAttribute( 'style', 'font-size:' + tds[i].dataset.wptbTitleColumnFontSize + '; \\n\\\n color:' + tds[i].dataset.wptbTitleColumnColor + '; background-color:' + tds[i].dataset.wptbTitleBackgroundColor + '; text-align:' + tds[i].dataset.wptbTitleAlign + ';' );\n columnNameDiv.style.padding = tds[i].style.padding;\n if( tds[i].children.length == 0 ) {\n tds[i].classList.add( 'wptb-column-title-mobile-not-elements' );\n }\n columnNameDivContainer.appendChild( columnNameDiv );\n tds[i].insertBefore( columnNameDivContainer, tds[i].firstChild );\n }\n }\n }\n \n return code;\n }\n}","var WPTB_Stringifier2 = function ( node, start = false ) {\n\n\tif ( node == undefined ) {\n\t\treturn '';\n\t} else if ( node.tagName == undefined && node.nodeType == 3 ) {\n return node.nodeValue;\n }\n \n let code = [],\n children,\n int_elem_arr = false,\n attributes = [...node.attributes],\n attributes_list = [],\n internal_elements = [];\n if ( ( node.parentNode.classList.contains( 'wptb-list-item-content' ) || \n node.parentNode.classList.contains( 'mce-content-body' ) ) && \n node.tagName.toLowerCase() == 'p' ) {\n children = node.childNodes;\n int_elem_arr = true;\n } else if( node.children.length > 0 ) {\n children = node.children;\n } else {\n children = node.childNodes;\n }\n if ( attributes.length > 0 ) {\n for ( let i = 0; i < attributes.length; i++ ) {\n attributes_list[i] = [attributes[i].name, attributes[i].value];\n }\n } else {\n attributes_list = '';\n }\n \n if ( children.length > 0 ) {\n for ( let i = 0; i < children.length; i++) {\n let inter_elem = WPTB_Stringifier(children[i]);\n \n if ( Array.isArray( inter_elem ) || int_elem_arr ) {\n internal_elements[i] = inter_elem;\n } else if ( typeof inter_elem === 'string' && inter_elem ) {\n internal_elements = inter_elem;\n }\n }\n } else {\n internal_elements = '';\n }\n \n \n code.push(node.tagName.toLowerCase(), attributes_list , internal_elements);\n \n return code;\n}","var array = [], WPTB_Table = function (columns, rows) {\n\n /* The members of the class */\n var settings = document.getElementsByClassName('wptb-settings-items'),\n wptbTableSetup = document.getElementsByClassName(\"wptb-table-setup\")[0],\n table, row, cell,\n maxAmountOfCells,\n maxAmountOfRows;\n\n //HERE ARE THE PRIVATE FUNCTIONS\n /*\n * This function toggles buttons visibility in cell edit mode\n * (according to the amount of currently selected cells), and\n * highlights visually the clicked cell if it is not highlighted, or\n * removes highlight if clicked cell is already highlighted. \n * It too toggles the bits of our abstract representation.\n * @param Event this is the event instance of the click performed over a cell.\n */\n var mark = function ( event ) {\n var rs = this.rowSpan,\n cs = this.colSpan,\n markedCells,\n noCells = document.getElementsByClassName('wptb-no-cell-action'),\n singleCells = document.getElementsByClassName('wptb-single-action'),\n multipleCells = document.getElementsByClassName('wptb-multiple-select-action'),\n cellSettings = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ),\n position = getCoords(this),\n row = position[0],\n column = position[1];\n if ( ! document.select.isActivated() ) {\n return;\n }\n if (this.className.match(/wptb-highlighted/)) {\n this.classList.remove('wptb-highlighted');\n for (var i = 0; i < rs; i++) {\n for (var j = 0; j < cs; j++) {\n array[row + i][column + j] = 0;\n }\n }\n } else {\n this.classList.add('wptb-highlighted');\n for (var i = 0; i < rs; i++) {\n for (var j = 0; j < cs; j++) {\n array[row + i][column + j] = 1;\n }\n }\n }\n\n markedCells = document.getElementsByClassName('wptb-highlighted').length;\n if (markedCells === 0) {\n for (var i = 0; i < multipleCells.length; i++) {\n multipleCells[i].classList.remove('visible');\n multipleCells[i].setAttribute('disabled', 'disabled');\n }\n for (var i = 0; i < noCells.length; i++) {\n noCells[i].classList.add('visible');\n noCells[i].removeAttribute('disabled');\n }\n for (var i = 0; i < singleCells.length; i++) {\n singleCells[i].classList.remove('visible');\n singleCells[i].setAttribute('disabled', 'disabled');\n }\n cellSettings.classList.remove( 'visible' );\n } else if (markedCells === 1) {\n for (var i = 0; i < multipleCells.length; i++) {\n multipleCells[i].classList.remove('visible');\n multipleCells[i].setAttribute('disabled', 'disabled');\n }\n for (var i = 0; i < noCells.length; i++) {\n noCells[i].classList.remove('visible');\n noCells[i].setAttribute('disabled', 'disabled');\n }\n for (var i = 0; i < singleCells.length; i++) {\n singleCells[i].classList.add('visible');\n singleCells[i].removeAttribute('disabled');\n }\n let cellHighlighted = document.querySelector( '.wptb-highlighted' );\n if( cellHighlighted ) {\n let wptbTableColumnWidthSlider = document.getElementById( 'wptb-table-column-width-slider' );\n let wptbTableColumnWidthNumber = document.getElementById( 'wptb-table-column-width-number' );\n let tableColumnWidthAutoFixedCheckbox = document.getElementById( 'wptb-table-column-width-auto-fixed' );\n let width = cellHighlighted.style.width;\n if( width ) {\n wptbTableColumnWidthSlider.value = parseFloat( width, 10 );\n wptbTableColumnWidthNumber.value = parseFloat( width, 10 );\n tableColumnWidthAutoFixedCheckbox.checked = true;\n } else if( cellHighlighted.dataset.wptbFixedWidth ) {\n wptbTableColumnWidthSlider.value = cellHighlighted.dataset.wptbFixedWidth;\n wptbTableColumnWidthNumber.value = cellHighlighted.dataset.wptbFixedWidth;\n tableColumnWidthAutoFixedCheckbox.checked = true;\n } else {\n let cellWidth = WPTB_Helper.getColumnWidth( table, cellHighlighted );\n wptbTableColumnWidthSlider.value = cellWidth;\n wptbTableColumnWidthNumber.value = cellWidth;\n tableColumnWidthAutoFixedCheckbox.checked = false;\n }\n \n \n let wptbTableRowHeightSlider = document.getElementById( 'wptb-table-row-height-slider' );\n let wptbTableRowHeightNumber = document.getElementById( 'wptb-table-row-height-number' );\n let tableRowHeightAutoFixedCheckbox = document.getElementById( 'wptb-table-row-height-auto-fixed' );\n let height = cellHighlighted.style.height;\n if( height ) {\n wptbTableRowHeightSlider.value = parseFloat( height, 10 );\n wptbTableRowHeightNumber.value = parseFloat( height, 10 );\n tableRowHeightAutoFixedCheckbox.checked = true;\n } else if( cellHighlighted.dataset.wptbFixedHeight ) {\n wptbTableRowHeightSlider.value = cellHighlighted.dataset.wptbFixedHeight;\n wptbTableRowHeightNumber.value = cellHighlighted.dataset.wptbFixedHeight;\n tableRowHeightAutoFixedCheckbox.checked = true;\n } else {\n let cellHeight = WPTB_Helper.getRowHeight( table, cellHighlighted );\n wptbTableRowHeightSlider.value = cellHeight;\n wptbTableRowHeightNumber.value = cellHeight;\n tableRowHeightAutoFixedCheckbox.checked = false;\n }\n }\n cellSettings.classList.add( 'visible' );\n } else {\n for (var i = 0; i < multipleCells.length; i++) {\n if (table.isSquare(array)) {\n multipleCells[i].classList.add('visible');\n multipleCells[i].removeAttribute('disabled');\n } else {\n multipleCells[i].classList.remove('visible');\n multipleCells[i].setAttribute('disabled', 'disabled');\n }\n }\n for (var i = 0; i < noCells.length; i++) {\n noCells[i].classList.remove('visible');\n noCells[i].setAttribute('disabled', 'disabled');\n }\n for (var i = 0; i < singleCells.length; i++) {\n singleCells[i].classList.remove('visible');\n singleCells[i].setAttribute('disabled', 'disabled');\n }\n cellSettings.classList.remove( 'visible' );\n }\n };\n\n /* \n * This function fills an array with 1's according to the actual design\n * of HTML table.\n * @returns an array of arrays containing an abstract representation\n * of HTML table.\n * @deprecated\n * */\n\n var realTimeArray = function () {\n var carried = [], tds, cols, matriz = [];\n\n for (var i = 0; i < maxAmountOfCells; i++) {\n carried[i] = 0;\n }\n\n for (var i = 0; i < table.rows.length; i++) {\n cols = [];\n\n var tds = table.rows[i].getElementsByTagName('td');\n\n for (items = 0; items < tds.length; items++) {\n\n for (var k = 0; k < tds[items].colSpan; k++) {\n cols.push(1);\n }\n\n if (tds[items].rowSpan > 1) {\n for (var k = 0; k < tds[items].colSpan; k++) {\n carried[items + k] = {\n justAssigned: true,\n amount: tds[items].rowSpan\n };\n }\n }\n }\n\n for (var k = 0; k < maxAmountOfCells; k++) {\n if (typeof carried[k] == 'object' && carried[k].amount > 0) {\n carried[k].amount--;\n if (carried[k].justAssigned) {\n carried[k].justAssigned = false;\n } else {\n cols.push(1);\n }\n }\n }\n\n matriz.push(cols);\n\n }\n return matriz;\n };\n\n /*\n * This function gets the number and position of cell spaces in current row that are occuped \n * by upper rowspanned cells.\n * @param number the number of row where we wish to calculate the carried rowspans up to.\n * @return an array with the remaining rowspans in each column.\n */\n var carriedRowspans = function (row) {\n var carried = [], tds, cols;\n\n for (var i = 0; i < maxAmountOfCells; i++) {\n carried[i] = 0;\n }\n\n if (row == -1) {\n return carried;\n }\n\n for (var i = 0; i <= row; i++) {\n cellsBuffer = table.rows[i].getElementsByTagName('td');\n cellPointer = 0;\n\n for (var xPosition = 0; xPosition < maxAmountOfCells; xPosition += stepsToMove) {\n stepsToMove = 1;\n\n if (carried[xPosition]) {\n carried[xPosition]--;\n } else {\n celda = cellsBuffer[cellPointer++];\n if (celda.rowSpan > 1) {\n for (k = 0; k < celda.colSpan; k++) {\n carried[xPosition + k] = celda.rowSpan - 1;\n }\n stepsToMove = celda.colSpan;\n } else if (celda.colSpan > 1) {\n stepsToMove = celda.colSpan;\n }\n }\n }\n\n }\n return carried;\n };\n\n /*\n * A helpful function for showing\n * the abstract table in console.\n * @param Array our abstract table.\n */\n var drawTable = function (a) {\n var string = 'DRAWING TABLE:\\n';\n for (var i = 0; i < a.length; i++) {\n\n for (var j = 0; j < a[i].length; j++) {\n string += ' ' + a[i][j];\n }\n string += '\\n';\n }\n table.isSquare(a);\n };\n\n /*\n * It resets all the bits of our abstract representation\n * to 0 and removes the highlighting class of all cells.\n */\n\n var undoSelect = function () {\n var noCells = document.getElementsByClassName('wptb-no-cell-action'),\n singleCells = document.getElementsByClassName('wptb-single-action'),\n multipleCells = document.getElementsByClassName('wptb-multiple-select-action'),\n cellSettings = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ),\n tds = table.getElementsByClassName('wptb-highlighted');\n while (tds.length) {\n tds[0].classList.remove('wptb-highlighted');\n }\n cellSettings.classList.remove( 'visible' );\n for (var i = 0; i < array.length; i++) {\n for (var j = 0; j < array[i].length; j++) {\n array[i][j] = 0;\n }\n }\n for (var i = 0; i < multipleCells.length; i++) {\n multipleCells[i].classList.remove('visible');\n multipleCells[i].setAttribute('disabled', 'disabled');\n }\n for (var i = 0; i < noCells.length; i++) {\n noCells[i].classList.add('visible');\n noCells[i].removeAttribute('disabled');\n }\n for (var i = 0; i < singleCells.length; i++) {\n singleCells[i].classList.remove('visible');\n singleCells[i].setAttribute('disabled', 'disabled');\n }\n };\n\n /*\n * This fills the abstract representation of our table with \n * zeros, at the start. the max amount of cells is the greatest sum\n * of all colspans for row.\n */\n\n var fillTableArray = function () {\n var colspansSums = [], a = [];\n\n //calculate max amount of cells inside a row\n for (var i = 0; i < table.rows.length; i++) {\n var cells = table.rows[i].getElementsByTagName('td'),\n colspanSumInRow = 0;\n for (var j = 0; j < cells.length; j++) {\n colspanSumInRow += cells[j].colSpan;\n }\n colspansSums.push(colspanSumInRow);\n }\n\n maxAmountOfCells = Math.max.apply(null, colspansSums);\n //calculate max rows\n var maxAmountOfRows = table.rows.length;\n\n // fill with zeros from both values\n for (var i = 0; i < maxAmountOfRows; i++) {\n a[i] = [];\n for (var j = 0; j < maxAmountOfCells; j++) {\n a[i].push(0);\n }\n }\n drawTable(a);\n return a;\n };\n\n /*\n * This function gets the sum of all colspans in a row.\n * @param number the number of row to be used as reference.\n */\n var getActualPointsInRow = function (row) {\n var tds = table.rows[row].getElementsByTagName('td'),\n points = 0;\n for (var i = 0; i < tds.length; i++) {\n points += tds[i].colSpan;\n }\n return points;\n }\n\n /*\n * This function gets us the exact coordinates of\n * an exact cell, in a more reliable way than xIndex and yIndex,\n * these last ones were meant to be used for getting the cell trough them.\n * @param DOMElement the cell to get the coordinates.\n */\n var getCoords = function (search) {\n var skipInCols = [], cell;\n\n for (var i = 0; i < maxAmountOfCells; i++) {\n skipInCols[i] = 0;\n }\n\n for (var i = 0; i < table.rows.length; i++) {\n var cellsBuffer = table.rows[i].getElementsByTagName('td');\n cellPointer = 0;\n for (var xPosition = 0; xPosition < maxAmountOfCells; xPosition += stepsToMove) {\n stepsToMove = 1;\n\n if (skipInCols[xPosition]) {\n skipInCols[xPosition]--;\n } else {\n var td = cellsBuffer[cellPointer++];\n if (td == search) {\n return [i, xPosition];\n }\n if (td.rowSpan > 1) {\n for ( let k = 0; k < td.colSpan; k++ ) {\n skipInCols[xPosition + k] = td.rowSpan - 1;\n }\n stepsToMove = td.colSpan;\n } else if (td.colSpan > 1) {\n stepsToMove = td.colSpan;\n }\n }\n }\n }\n };\n\n jQuery('#wptb-table-header-bg').val('');\n jQuery('#wptb-even-row-bg').val('');\n jQuery('#wptb-odd-row-bg').val('');\n jQuery('#wptb-table-border-color').val('');\n jQuery('#wptb-table-inner-border-number,#wptb-table-inner-border-slider').val('0');\n jQuery('#wptb-table-border-number,#wptb-table-border-slider').val('0');\n jQuery('#wptb-table-padding-number,#wptb-table-padding-slider').val('15');\n\n if (columns || rows) {\n //END OF PRIVATE FUNCTIONS\n for (var i = 0; i < settings.length; i++) {\n if (settings[i].id !== 'wptb-apply-inner-border') {\n settings[i].classList.add('visible');\n }\n }\n\n //Create a HTML Table element.\n table = document.createElement( 'table' );\n table.classList.add( 'wptb-preview-table' );\n table.dataset.reconstraction = 1;\n table.dataset.wptbAdaptiveTable = 1;\n //Add the data rows.\n for (var i = 0; i < rows; i++) {\n\n row = table.insertRow(-1);\n row.classList.add( 'wptb-row' );\n\n for (var j = 0; j < columns; j++) {\n cell = new WPTB_Cell(mark);\n cell.setCoords(i, j);\n row.appendChild(cell.getDOMElement());\n }\n }\n } else {\n let wptb_preview_table = document.getElementsByClassName( 'wptb-preview-table' );\n\n if (wptb_preview_table.length > 0) {\n table = wptb_preview_table[0];\n\n let cells = table.getElementsByTagName('td');\n\n if (cells.length > 0) {\n for (let i = 0; i < cells.length; i++) {\n WPTB_Cell(mark, cells[i]);\n }\n }\n }\n }\n\n /*\n * This just toggles visibility of cell edit bar, and toggles \n * cell selecting mode.\n */\n\n table.toggleTableEditMode = function () {\n let bar = document.getElementsByClassName('wptb-edit-bar'),\n cellModeBackground = document.getElementById('wptb-cell_mode_background'),\n leftScrollPanelCurtain = document.getElementById('wptb-left-scroll-panel-curtain'),\n leftScrollPanelCellSettings = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ),\n wptbPreviewTable = document.getElementsByClassName('wptb-preview-table');\n if (wptbPreviewTable.length > 0) {\n wptbPreviewTable = wptbPreviewTable[0];\n }\n\n if ( bar.length > 0 ) {\n for ( let i = 0; i < bar.length; i++ ) {\n if ( bar[i].classList.contains( 'visible' ) ) {\n document.select.deactivateMultipleSelectMode();\n bar[i].classList.remove( 'visible' );\n cellModeBackground.classList.remove( 'visible' );\n leftScrollPanelCurtain.classList.remove( 'visible' );\n leftScrollPanelCellSettings.classList.remove( 'visible' );\n wptbPreviewTable.parentNode.classList.remove( 'wptb-preview-table-manage-cells' );\n let wptbPreviewTableTds = wptbPreviewTable.getElementsByTagName( 'td' );\n if ( wptbPreviewTableTds.length > 0 ) {\n for ( let i = 0; i < wptbPreviewTableTds.length; i++ ) {\n wptbPreviewTableTds[i].classList.remove( 'wptb-highlighted' );\n }\n }\n } else {\n document.select.activateMultipleSelectMode();\n bar[i].classList.add( 'visible' );\n cellModeBackground.classList.add( 'visible' );\n leftScrollPanelCurtain.classList.add( 'visible' );\n wptbPreviewTable.parentNode.classList.add( 'wptb-preview-table-manage-cells' );\n }\n }\n\n }\n }\n\n /*\n * For assigning to each cell xIndex and y Index attributes,\n * these are the column number and row number of cell in table. \n */\n\n table.recalculateIndexes = function ( start ) {\n let trs = this.getElementsByTagName('tr'), tds, maxCols = 0, maxColsFull = 0,\n tdsArr = [];\n let wptbTopRowAsHeader = document.getElementById( 'wptb-top-row-as-header' );\n \n for (var i = 0; i < trs.length; i++) {\n if ( i == 0 ) {\n if ( start == undefined ) {\n trs[i].style.backgroundColor = jQuery('#wptb-table-header-bg').val();\n }\n if( wptbTopRowAsHeader.checked ) {\n if( start == undefined ) {\n this.classList.add( 'wptb-table-preview-head' ); \n trs[i].classList.add( 'wptb-table-head' )\n } ;\n } else {\n if( start == undefined ) {\n this.classList.remove( 'wptb-table-preview-head' );\n trs[i].classList.remove( 'wptb-table-head' );\n }\n }\n } else {\n if (i % 2 == 0) {\n if ( start == undefined ) {\n trs[i].style.backgroundColor = jQuery('#wptb-odd-row-bg').val();\n }\n trs[i].classList.remove( 'wptb-table-head' );\n } else {\n if ( start == undefined ) {\n trs[i].style.backgroundColor = jQuery('#wptb-even-row-bg').val();\n }\n trs[i].classList.remove( 'wptb-table-head' );\n }\n }\n\n tdsArr[i];\n tds = trs[i].getElementsByTagName('td');\n\n if (tdsArr[i] == undefined) {\n tdsArr[i] = [];\n }\n\n let jMainIter = 0;\n for (var j = 0; j < tds.length; j++) {\n if (tdsArr[i][j] != undefined) {\n for (let y = 0; y < 100; y++) {\n if (tdsArr[i][jMainIter] != undefined) {\n jMainIter++;\n continue;\n }\n tdsArr[i][jMainIter] = tds[j];\n tds[j].dataset.xIndex = jMainIter;\n break;\n }\n } else {\n tdsArr[i][j] = tds[j];\n tds[j].dataset.xIndex = jMainIter;\n }\n tds[j].dataset.yIndex = i;\n\n if (tds[j].colSpan > 1) {\n for (let k = 1; k < tds[j].colSpan; k++) {\n jMainIter++;\n tdsArr[i][jMainIter] = 'tdDummy';\n }\n }\n\n if (tds[j].rowSpan > 1) {\n for (let x = 1; x < tds[j].rowSpan; x++) {\n if (tdsArr[i + x] == undefined) {\n tdsArr[i + x] = [];\n }\n for (let z = 0; z < tds[j].colSpan; z++) {\n tdsArr[i + x][jMainIter - tds[j].colSpan + 1 + z ] = 'tdDummy';\n }\n }\n }\n jMainIter++;\n if( i == 0 ) {\n maxColsFull = jMainIter;\n }\n }\n if (j > maxCols) {\n maxCols = j;\n }\n }\n this.columns = maxCols;\n this.maxCols = maxColsFull;\n }\n \n table.addColumnWidth = function( value, cleaner ) {\n let highlighted = table.getElementsByClassName( 'wptb-highlighted' );\n if( highlighted.length > 0 ) {\n for( let k = 0; k < highlighted.length; k++ ) {\n let dataXIndex = highlighted[k].dataset.xIndex;\n if( dataXIndex ) {\n function tableTdsFor( dataXIndex, colspan ) {\n let tableRows = table.rows;\n let widthIsSet = false;\n let arrayTdsFromPreviousRow = [];\n for( let i = 0; i < tableRows.length; i++ ) {\n let row = tableRows[i];\n let tds = row.children;\n for( let j = 0; j < tds.length; j++ ) {\n let td = tds[j];\n if( td.dataset.xIndex == dataXIndex ) {\n if( value ) {\n if( td.colSpan == colspan ) {\n td.style.width = value + 'px';\n td.removeAttribute( 'data-wptb-fixed-width' );\n widthIsSet = true;\n let tableColumnWidthAutoFixedCheckbox = document.getElementById( 'wptb-table-column-width-auto-fixed' );\n if( ! tableColumnWidthAutoFixedCheckbox.checked ) {\n tableColumnWidthAutoFixedCheckbox.checked = true;\n }\n } else {\n td.style.width = null;\n td.dataset.wptbFixedWidth = value;\n if( i == tableRows.length - 1 && ! widthIsSet ) {\n tableTdsFor( dataXIndex, colspan + 1 );\n }\n }\n } else if( cleaner ) {\n td.style.width = null;\n td.removeAttribute( 'data-wptb-fixed-width' );\n } else {\n if( td.dataset.wptbFixedWidth ) {\n if( td.colSpan == colspan ) {\n td.style.width = td.dataset.wptbFixedWidth + 'px';\n td.removeAttribute( 'data-wptb-fixed-width' );\n } \n } else if( td.style.width ) {\n for( let z = 0; z < arrayTdsFromPreviousRow.length; z++ ) {\n arrayTdsFromPreviousRow[z].style.width = td.style.width;\n }\n arrayTdsFromPreviousRow = [];\n } else {\n arrayTdsFromPreviousRow.push( td );\n }\n }\n break;\n } \n }\n }\n }\n \n tableTdsFor( dataXIndex, 1 );\n }\n }\n \n table.tdDefaultWidth();\n }\n }\n \n table.tdDefaultWidth = function() {\n let rows = table.rows;\n \n let tableTdsSumMaxWidth = 0;\n let tableTdsSumMaxWidthFixed = 0;\n let tableTdsSumMaxWidthAuto = 0;\n \n let wptbTableSetup = document.getElementsByClassName( 'wptb-table-setup' )[0];\n let wptbTableSetupWidth = wptbTableSetup.offsetWidth;\n \n let arrayCellsWidthFixedHelper = [];\n let arrayCellsWidthAutoHelper = [];\n let tdPaddingCommon = 0;\n let tableTdBorderCommonWidth = 0;\n let cssForTdsWidthAuto = '';\n \n for( let i = 0; i < rows.length; i++ ) {\n let tds = rows[i].children;\n for( let j = 0; j < tds.length; j++ ) {\n let td = tds[j];\n \n if( ! arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] && ! arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] ) {\n if( td.style.width ) {\n arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] = parseFloat( td.style.width );\n td.removeAttribute( 'data-wptb-css-td-auto-width' );\n } else {\n if( ! td.dataset.wptbFixedWidth ) {\n arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] = 100;\n td.dataset.wptbCssTdAutoWidth = true;\n }\n }\n \n if( window.getComputedStyle( td, null ) ) {\n let tdStyleObj = window.getComputedStyle( td, null );\n let tdPaddingLeft = tdStyleObj.getPropertyValue( 'padding-left' );\n let tdPaddingRight = tdStyleObj.getPropertyValue( 'padding-right' );\n tdPaddingCommon = parseFloat( tdPaddingLeft, 10 ) + parseFloat( tdPaddingRight, 10 );\n\n let tableTdBorderLeftWidth = tdStyleObj.getPropertyValue( 'border-left-width' );\n let tableTdBorderRightWidth = tdStyleObj.getPropertyValue( 'border-right-width' );\n tableTdBorderCommonWidth = parseFloat( tableTdBorderLeftWidth, 10 ) + parseFloat( tableTdBorderRightWidth, 10 );\n if( arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] ) {\n arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] += tdPaddingCommon;\n arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] += tableTdBorderCommonWidth;\n } else {\n arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] += tdPaddingCommon;\n arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] += tableTdBorderCommonWidth;\n }\n }\n } else if( arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] ) {\n if( ! td.dataset.wptbFixedWidth ) {\n td.dataset.wptbCssTdAutoWidth = true;\n }\n } else if( arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] ) {\n td.removeAttribute( 'data-wptb-css-td-auto-width' );\n }\n }\n }\n \n for( let i = 0; i < arrayCellsWidthFixedHelper.length; i++ ) {\n if( arrayCellsWidthFixedHelper[i] ) {\n tableTdsSumMaxWidthFixed += arrayCellsWidthFixedHelper[i];\n }\n }\n \n let CellsWidthAutoCount = 0;\n for( let i = 0; i < arrayCellsWidthAutoHelper.length; i++ ) {\n if( arrayCellsWidthAutoHelper[i] ) {\n tableTdsSumMaxWidthAuto += arrayCellsWidthAutoHelper[i];\n CellsWidthAutoCount++;\n }\n }\n \n let tableFullStyleObj = window.getComputedStyle( table, null );\n let borderLeftWidth = tableFullStyleObj.getPropertyValue( 'border-left-width' );\n let borderRightWidth = tableFullStyleObj.getPropertyValue( 'border-right-width' );\n let tableBorderCommon = parseFloat( borderLeftWidth, 10 ) + parseFloat( borderRightWidth, 10 );\n tableTdsSumMaxWidth = tableTdsSumMaxWidthFixed + tableTdsSumMaxWidthAuto + tableBorderCommon;\n \n table.dataset.wptbTableTdsSumMaxWidth = tableTdsSumMaxWidth;\n if( CellsWidthAutoCount ) {\n table.dataset.wptbCellsWidthAutoCount = CellsWidthAutoCount;\n if( table.mergingСellsHorizontally ) {\n table.dataset.wptbFixedWidthSize = tableTdsSumMaxWidthFixed - tableBorderCommon;\n } else {\n table.removeAttribute( 'data-wptb-fixed-width-size' );\n }\n } else {\n table.removeAttribute( 'data-wptb-fixed-width-size' );\n table.removeAttribute( 'data-wptb-cells-width-auto-count' );\n }\n \n let styleElementCreate = false;\n let tableTdWidthAuto;\n if( tableTdsSumMaxWidth < wptbTableSetupWidth ) {\n if( CellsWidthAutoCount ) {\n table.style.minWidth = '100%';\n if( table.mergingСellsHorizontally ) {\n table.style.width = null;\n let tableTdsWidthAutoCommon = wptbTableSetupWidth - tableTdsSumMaxWidthFixed - tableBorderCommon;\n tableTdWidthAuto = tableTdsWidthAutoCommon / CellsWidthAutoCount;\n tableTdWidthAuto = tableTdWidthAuto - tdPaddingCommon - tableTdBorderCommonWidth;\n styleElementCreate = true;\n } else {\n table.style.width = '100%';\n }\n } else {\n table.style.width = null;\n table.style.minWidth = null;\n table.style.maxWidth = tableTdsSumMaxWidth + 'px';\n }\n } else {\n table.style.maxWidth = null;\n table.style.minWidth = tableTdsSumMaxWidth + 'px';\n table.style.width = null;\n tableTdWidthAuto = '100'\n styleElementCreate = true;\n }\n \n let head = document.head;\n if( head ) {\n let cssForTdsWidthAutoOld = head.querySelector( 'style[data-wptb-td-auto-width=\"true\"]' );\n if( cssForTdsWidthAutoOld ) {\n head.removeChild( cssForTdsWidthAutoOld );\n }\n }\n \n if( styleElementCreate ) {\n cssForTdsWidthAuto = document.createElement( 'style' );\n cssForTdsWidthAuto.setAttribute( 'data-wptb-td-auto-width', true );\n cssForTdsWidthAuto.innerHTML = '[data-wptb-css-td-auto-width=true]{width:' + tableTdWidthAuto + 'px}';\n if( head ) {\n head.appendChild( cssForTdsWidthAuto );\n }\n }\n }\n \n table.addRowHeight = function( value, cleaner ) {\n let highlighted = table.getElementsByClassName( 'wptb-highlighted' );\n if( highlighted.length > 0 ) {\n for( let k = 0; k < highlighted.length; k++ ) {\n let dataYIndex = highlighted[k].dataset.yIndex;\n if( dataYIndex ) {\n function tableTdsFor( dataYIndex, rowspan ) {\n let tableRows = table.rows;\n let heightIsSet = false;\n let arrayTdsPrevious = [];\n for( let i = 0; i < tableRows.length; i++ ) {\n let row = tableRows[i];\n let tds = row.children;\n for( let j = 0; j < tds.length; j++ ) {\n let td = tds[j];\n if( td.dataset.yIndex == dataYIndex ) {\n if( value ) {\n if( td.rowSpan == rowspan ) {\n td.style.height = value + 'px';\n td.removeAttribute( 'data-wptb-fixed-heidht' );\n heightIsSet = true;\n let tableColumnHeightAutoFixedCheckbox = document.getElementById( 'wptb-table-row-height-auto-fixed' );\n if( ! tableColumnHeightAutoFixedCheckbox.checked ) {\n tableColumnHeightAutoFixedCheckbox.checked = true;\n }\n continue;\n } else {\n td.style.height = null;\n td.dataset.wptbFixedHeight = value;\n if( j == tds.length - 1 && ! heightIsSet ) {\n tableTdsFor( dataYIndex , rowspan + 1 );\n }\n }\n } else if( cleaner ) {\n td.style.height = null;\n td.removeAttribute( 'data-wptb-fixed-heidht' );\n } else {\n if( td.dataset.wptbFixedHeight ) {\n if( td.rowSpan = rowspan ) {\n td.style.height = td.dataset.wptbFixedHeight + 'px';\n td.removeAttribute( 'data-wptb-fixed-width' );\n }\n } else if( td.style.height ) {\n for( let z = 0; z < arrayTdsPrevious.length; z++ ) {\n arrayTdsPrevious[z].style.height = td.style.height;\n }\n arrayTdsPrevious = [];\n } else {\n arrayTdsPrevious.push( td );\n }\n }\n } \n }\n }\n }\n \n tableTdsFor( dataYIndex, 1 );\n }\n }\n }\n }\n \n table.reconstraction = function() {\n let tds = table.getElementsByTagName( 'td' );\n let wptbAdaptiveTableChoseBlock = document.getElementsByClassName( 'wptb-adaptive-table-chose-block' );\n if( wptbAdaptiveTableChoseBlock.length > 0 ) {\n wptbAdaptiveTableChoseBlock = wptbAdaptiveTableChoseBlock[0];\n }\n table.mergingСellsHorizontally = false;\n table.mergingCellsVertically = false;\n table.dataset.reconstraction = 1;\n wptbAdaptiveTableChoseBlock.style.display = 'block';\n let forBreak = 0;\n for( let i = 0; i < tds.length; i++ ) {\n if( tds[i].colSpan > 1 ) {\n table.dataset.reconstraction = 0;\n wptbAdaptiveTableChoseBlock.style.display = 'none';\n table.mergingСellsHorizontally = true;\n forBreak++;\n }\n \n if( tds[i].rowSpan > 1 ) {\n table.dataset.reconstraction = 0;\n wptbAdaptiveTableChoseBlock.style.display = 'none';\n table.mergingCellsVertically = true;\n forBreak++;\n }\n \n if( forBreak == 2 ) {\n break;\n }\n }\n }\n\n /*\n * As simple as it is: adds a column to the end of table.\n */\n table.addColumnEnd = function () {\n let td,\n currentTable = document.getElementsByClassName('wptb-preview-table'),\n currentTableTd,\n currentTdStyle;\n if (currentTable.length > 0) {\n currentTableTd = currentTable[0].querySelector('td');\n }\n\n if (currentTableTd) {\n currentTdStyle = currentTableTd.getAttribute('style');\n }\n \n for (var i = 0; i < table.rows.length; i++) {\n td = new WPTB_Cell(mark);\n \n if (currentTdStyle) {\n td.getDOMElement().setAttribute('style', currentTdStyle);\n td.getDOMElement().style.width = null;\n }\n \n table.rows[i].appendChild(td.getDOMElement());\n array[i].push(0);\n }\n \n maxAmountOfCells++;\n table.recalculateIndexes();\n table.tdDefaultWidth();\n table.addRowHeight();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n /*\n * As simple as it looks: adds a column to the start of table.\n */\n\n table.addColumnStart = function () {\n let td,\n firstCell,\n currentTable = document.getElementsByClassName('wptb-preview-table'),\n currentTableTd,\n currentTdStyle;\n if ( currentTable.length > 0 ) {\n currentTableTd = currentTable[0].querySelector('td');\n }\n\n if ( currentTableTd ) {\n currentTdStyle = currentTableTd.getAttribute('style');\n }\n \n for (var i = 0; i < table.rows.length; i++) {\n td = new WPTB_Cell(mark);\n if (currentTdStyle) {\n td.getDOMElement().setAttribute('style', currentTdStyle);\n td.getDOMElement().style.width = null;\n }\n firstCell = table.rows[i].getElementsByTagName('td')[0];\n if (firstCell) {\n table.rows[i].insertBefore(td.getDOMElement(), firstCell);\n } else {\n table.rows[i].appendChild(td.getDOMElement());\n }\n array[i].push(0);\n }\n\n maxAmountOfCells++;\n table.recalculateIndexes();\n table.tdDefaultWidth();\n table.addRowHeight();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n /*\n * Well, not so simple as previous functions.\n * It adds a column after a certain column of reference.\n * @param integer the column number to be used as reference.\n *\tIf empty, then the first highlighted cell is used as reference.\n */\n\n table.addColumnAfter = function (c_pos) {\n let rows = table.rows,\n cellPointer,\n cellsBuffer,\n cell = document.querySelector('.wptb-highlighted'),\n cellStyle = cell.getAttribute('style'),\n pos = c_pos != undefined && typeof c_pos === 'number' ? c_pos : getCoords(cell)[1];\n \n \n \n if( maxAmountOfCells - pos - cell.colSpan + 1 == 1 ) {\n table.addColumnEnd();\n } else {\n let pendingInsertion = false,\n stepsToMove,\n td, bro,\n carriedRowspans = [],\n currentCell;\n\n for (var i = 0; i < maxAmountOfCells; i++) {\n carriedRowspans.push(0);\n }\n\n for (var i = 0; i < rows.length; i++) {\n cellPointer = 0;\n cellsBuffer = rows[i].getElementsByTagName('td');\n pendingInsertion = false;\n for (var xPosition = 0;\n xPosition < maxAmountOfCells;\n xPosition += stepsToMove) {\n stepsToMove = 1;\n\n if (pendingInsertion) {\n td = new WPTB_Cell(mark);\n if (cellStyle) {\n td.getDOMElement().setAttribute('style', cellStyle);\n td.getDOMElement().style.width = null;\n }\n if (currentCell && rows[i].contains(currentCell)) {\n bro = currentCell.nextSibling;\n if (bro) {\n rows[i].insertBefore(td.getDOMElement(), bro);\n } else {\n rows[i].appendChild(td.getDOMElement());\n }\n } else {\n rows[i].insertBefore(td.getDOMElement(), cellsBuffer[0]);\n }\n break;\n } else if (carriedRowspans[xPosition] > 0) {\n // If no pending insertion, let's check if no rowspan from upper cells is pending in current position\n if (pos == xPosition) {\n pendingInsertion = true;\n }\n } else {\n currentCell = cellsBuffer[cellPointer++];\n if (currentCell.rowSpan > 1) {\n stepsToMove = currentCell.colSpan;\n for (var k = 0; k < currentCell.colSpan; k++) {\n carriedRowspans[xPosition + k] = currentCell.rowSpan;\n if (xPosition + k == pos) {\n pendingInsertion = true;\n }\n }\n } else if (currentCell.colSpan > 1) {\n stepsToMove = currentCell.colSpan;\n for (var k = 0; k < currentCell.colSpan; k++) {\n if (xPosition + k == pos) {\n pendingInsertion = true;\n }\n }\n } else if (xPosition == pos) {\n pendingInsertion = true;\n }\n }\n }\n\n for (var l = 0; l < maxAmountOfCells; l++) {\n if (carriedRowspans[l] > 0)\n carriedRowspans[l]--;\n }\n\n }\n\n for (var i = 0; i < array.length; i++) {\n array[i].push(0);\n }\n maxAmountOfCells++;\n drawTable(array);\n table.recalculateIndexes();\n table.addColumnWidth();\n table.addRowHeight();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n };\n\n /*\n * For preventing us to take a lot of time,\n * This is just calling the function addColumnAfter, but\n * using the previous column to current one as reference.\n * @see addColumnAfter\n */\n\n table.addColumnBefore = function () {\n var cell = document.querySelector('.wptb-highlighted'),\n pos = getCoords(cell)[1];\n\n if (pos === 0) {\n table.addColumnStart();\n } else {\n table.addColumnAfter(pos - 1);\n }\n };\n\n /*\n * Luckily, thisfunction is simple, \n * it just add a row to the end of table.\n */\n\n table.addRowToTheEnd = function () {\n let r = table.insertRow(-1),\n td,\n aux,\n currentTable = document.getElementsByClassName('wptb-preview-table'),\n currentTableTd,\n currentTdStyle;\n r.classList.add( 'wptb-row' );\n if (currentTable.length > 0) {\n currentTableTd = currentTable[0].querySelector('td');\n }\n\n if (currentTableTd) {\n currentTdStyle = currentTableTd.getAttribute('style');\n }\n\n for (var i = 0; i < maxAmountOfCells; i++) {\n td = new WPTB_Cell(mark);\n if (currentTdStyle) {\n td.getDOMElement().setAttribute('style', currentTdStyle);\n }\n r.appendChild(td.getDOMElement());\n }\n aux = Array.from(array[0]);\n array.push(aux);\n drawTable(array);\n table.recalculateIndexes();\n table.addColumnWidth();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n /*\n * Yet another simple function, \n * it just add a row to the start of table.\n */\n\n table.addRowToTheStart = function () {\n let r = table.insertRow(0),\n td,\n aux,\n currentTable = document.getElementsByClassName('wptb-preview-table'),\n currentTableTd,\n currentTdStyle;\n r.classList.add( 'wptb-row' );\n if (currentTable.length > 0) {\n currentTableTd = currentTable[0].querySelector('td');\n }\n\n if (currentTableTd) {\n currentTdStyle = currentTableTd.getAttribute('style');\n }\n\n for (var i = 0; i < maxAmountOfCells; i++) {\n td = new WPTB_Cell(mark);\n if (currentTdStyle) {\n td.getDOMElement().setAttribute('style', currentTdStyle);\n }\n r.appendChild(td.getDOMElement());\n }\n aux = Array.from(array[0]);\n array.push(aux);\n drawTable(array);\n table.recalculateIndexes();\n table.addColumnWidth();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n /* \n * This function adds a row before the current one.\n * Since the biggest factor of problem is a not-started but ongoing rowspan,\n * the most of the troubles is not here.\n */\n\n table.addRowBefore = function () {\n let cell = document.querySelector('.wptb-highlighted'),\n cellStyle = cell.getAttribute('style'),\n row = getCoords(cell)[0],\n cellNew;\n for( let i = row - 1; i >= 0; i-- ) {\n let rowChildren = table.rows[i].children;\n let rowChildrenLength = rowChildren.length;\n if( rowChildrenLength > 0 ) {\n for( let j = 0; j < rowChildrenLength; j++ ) {\n if( rowChildren[j].rowSpan == 1 ) {\n row = i;\n cellNew = true;\n break;\n }\n }\n }\n if ( cellNew ) {\n break;\n }\n }\n\n if (row === 0) {\n table.addRowToTheStart();\n } else {\n table.addRowAfter( row, cellStyle );\n }\n };\n\n /*\n * Well... by the name convention of the previous 3 functions,\n * it's pretty obvious that this functions attaches a new\n * row after highlighted cell row. The greatest obstacle it was\n * the possibility of a TR not having the exact amount of columns\n * occuped by actual node but rowspanned upper cells. For that purpose\n * it was created the function realTimeArray.\n * @see realTimeArray\n */\n\n table.addRowAfter = function ( row, cellStyle ) {\n let cellRowSpan,\n rowAfter,\n aux;\n \n if ( ( row == undefined || typeof row !== 'number' ) && cellStyle == undefined ) {\n let cell = document.querySelector('.wptb-highlighted');\n cellStyle = cell.getAttribute('style'),\n row = getCoords(cell)[0],\n cellRowSpan = cell.rowSpan,\n rowAfter = row + cellRowSpan - 1;\n } else {\n rowAfter = row;\n }\n \n \n let cellsColSpan = 0;\n if ( rowAfter < table.rows.length -1 ) {\n for( let i = 0; i <= rowAfter ; i++ ) {\n let tableRowsIChildren = table.rows[i].children,\n tableRIChildrenLength = tableRowsIChildren.length;\n if( tableRIChildrenLength > 0 ) {\n for( let j = 0; j < tableRIChildrenLength; j++ ) {\n let rowIRowSpan = tableRowsIChildren[j].rowSpan;\n\n if ( rowIRowSpan - 1 + i > rowAfter ) {\n tableRowsIChildren[j].rowSpan++;\n }\n }\n }\n }\n \n let rNext = table.rows[rowAfter + 1],\n rNextChildren = rNext.children,\n rNextChildrenLength = rNextChildren.length;\n \n if( rNextChildrenLength > 0 ) {\n for ( let i = 0; i < rNextChildrenLength; i++ ) {\n cellsColSpan += rNextChildren[i].colSpan;\n }\n }\n } else {\n cellsColSpan = array[0].length;\n }\n \n let r = table.insertRow( rowAfter + 1 );\n r.classList.add( 'wptb-row' );\n \n for ( j = 0; j < cellsColSpan; j++ ) {\n let td = new WPTB_Cell( mark );\n td.getDOMElement().setAttribute( 'style', cellStyle );\n td.getDOMElement().style.width = null;\n td.getDOMElement().style.height = null;\n r.appendChild( td.getDOMElement() );\n }\n\n aux = Array.from(array[0]);\n array.push(aux);\n drawTable(array);\n table.recalculateIndexes();\n table.addColumnWidth();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n /*\n * This function checks the current selected cells\n * make a rectangular shape.\n * @param Array the abstract table.\n * @return false, if not making a rectangle, or\n *\tArray an array containing number of rows and columns, if selection makes a rectangle.\n */\n\n table.isSquare = function (a) {\n var rowStart = -1,\n columnStart = -1,\n rowEnd = -1,\n columnEnd = -1,\n height,\n width,\n itemsEstimate = 0,\n items = 0;\n\n for (var i = 0; i < a.length; i++) {\n for (var j = 0; j < a[i].length; j++) {\n if (a[i][j] == 1) {\n if ( j < columnStart || columnStart == -1 ) {\n columnStart = j;\n }\n if ( i < rowStart || rowStart == -1 ) {\n rowStart = i;\n }\n }\n }\n \n }\n\n for (var i = a.length - 1; i > -1; i--) {\n for (var j = a[i].length - 1; j > -1; j--) {\n if (a[i][j] == 1) {\n if ( j > columnEnd ) {\n columnEnd = j;\n }\n if ( i > rowEnd ) {\n rowEnd = i;\n }\n }\n }\n }\n\n for (var i = rowStart; i < rowEnd; i++) {\n for (var j = columnStart; j < columnEnd; j++) {\n if (a[i][j] == 0 || a[i][j] == undefined) {\n return false;\n }\n }\n }\n\n for (var i = 0; i < a.length; i++) {\n for (var j = 0; j < a[i].length; j++) {\n if (a[i][j] == 1) {\n items++;\n }\n }\n }\n\n height = rowEnd - rowStart + 1;\n width = columnEnd - columnStart + 1;\n itemsEstimate = height * width;\n\n if (itemsEstimate !== items) {\n return false;\n }\n return [height, width];\n };\n\n /*\n * This function merges all selected cells.\n * Well, actually sets the colspan and rowspan of first \n * upper left cell in selection and deletes the another selected cells.\n */\n\n table.mergeCells = function () {\n var dimensions = table.isSquare(array),\n rowspan = dimensions[0],\n colspan = dimensions[1],\n first = document.querySelector('.wptb-highlighted'),\n tds = [].slice.call(document.getElementsByClassName('wptb-highlighted'), 1),\n tdsChildrenNew = [];\n\n for (let i = 0; i < tds.length; i++) {\n let tdsInternalElements = tds[i].getElementsByClassName('wptb-ph-element');\n if (tdsInternalElements.length > 0) {\n let tdsIntElemLength = tdsInternalElements.length;\n for (let j = 0; j < tdsIntElemLength; j++) {\n tdsChildrenNew.push(tdsInternalElements[j]);\n }\n }\n let p = tds[i].parentNode;\n p.removeChild(tds[i]);\n }\n if (tdsChildrenNew.length > 0) {\n for (let i = 0; i < tdsChildrenNew.length; i++) {\n first.appendChild(tdsChildrenNew[i]);\n }\n }\n\n first.colSpan = colspan;\n first.rowSpan = rowspan;\n table.recalculateIndexes();\n table.reconstraction();\n let firstWidth = first.style.width;\n let firstDataFixedWidth = first.dataset.wptbFixedWidth;\n if( firstWidth ) {\n table.addColumnWidth( parseFloat( firstWidth, 10 ) );\n } else if( firstDataFixedWidth ) {\n table.addColumnWidth();\n } else {\n table.addColumnWidth( false, true );\n }\n \n let firstHeight = first.style.height;\n let firstDataFixedHeight = first.dataset.wptbFixedHeight;\n if( firstHeight ) {\n table.addRowHeight( parseFloat( firstHeight, 10 ) );\n } else if( firstDataFixedHeight ) {\n table.addRowHeight();\n } else {\n table.addRowHeight( false, true );\n }\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n /*\n * This functions makes the exact inverse as above.\n * It resets colspan and rowspan and appends \n * the same amount in cells to the table.\n * @bug\n */\n\n table.splitCell = function () {\n var cell = document.getElementsByClassName('wptb-highlighted')[0],\n rowspan = cell.rowSpan,\n colspan = cell.colSpan,\n cellStyles = cell.getAttribute('style'),\n row = getCoords(cell)[0],\n thisRow = table.rows[row],\n cellXIndex =cell.dataset.xIndex;\n \n cell.rowSpan = 1;\n cell.colSpan = 1;\n \n for (let i = 1; i < colspan; i++) {\n let td = new WPTB_Cell(mark);\n td.getDOMElement().setAttribute('style', cellStyles);\n td.getDOMElement().classList.add( 'wptb-highlighted' );\n if ( cell.nextSibling ) {\n thisRow.insertBefore( td.getDOMElement(), cell.nextSibling );\n } else {\n thisRow.appendChild( td.getDOMElement() );\n }\n \n }\n\n if (rowspan > 1) {\n for (let i = 1; i < rowspan; i++) {\n let rowChildInsertBefore = undefined,\n rowNext = table.rows[row + i],\n rowChildren = rowNext.children,\n rowChildrenLength = rowChildren.length;\n \n if ( rowChildrenLength > 0 ) {\n for ( let k = 0; k < rowChildrenLength; k++ ) {\n if ( Number( rowChildren[k].dataset.xIndex ) > Number( cellXIndex ) ) {\n rowChildInsertBefore = rowChildren[k];\n break;\n } \n }\n }\n for ( let j = 0; j < colspan; j++ ) {\n let td = new WPTB_Cell( mark );\n td.getDOMElement().setAttribute( 'style', cellStyles );\n if ( rowChildInsertBefore != undefined ) {\n rowNext.insertBefore( td.getDOMElement(), rowChildInsertBefore );\n } else {\n rowNext.appendChild( td.getDOMElement() );\n }\n }\n }\n }\n\n table.recalculateIndexes();\n table.reconstraction();\n table.addColumnWidth();\n table.addRowHeight();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n /*\n * Searches for rowspanned cells up to row number meeting it.\n * @param number the number of row where the function\n * must search up to.\n */\n\n table.findRowspannedCells = function (row) {\n var array = [],\n difference;\n actualPoints = getActualPointsInRow(row);\n if (actualPoints === maxAmountOfCells) {\n return [];\n }\n difference = maxAmountOfCells - actualPoints;\n\n for (var i = row - 1; i >= 0 && difference; i--) {\n var tds = table.rows[i].getElementsByTagName('td');\n for (var i = 0; i < tds.length; i++) {\n if (tds[i].rowSpan > 1) {\n array.push(tds[i]);\n difference -= tds[i].colSpan;\n }\n }\n }\n return array;\n\n }\n\n /*\n * This function explores the table and adds \n * a cell for each lacking one for each row\n * to meet an even amount of cells.\n */\n\n table.addLackingCells = function () {\n var sumRows = [];\n for (var i = 0; i < table.rows.length; i++) {\n sumRows.push(0);\n }\n\n for (var i = 0; i < table.rows.length; i++) {\n var tds = table.rows[i].getElementsByTagName('td');\n for (var j = 0; j < tds.length; j++) {\n if (tds[j].rowSpan > 1) {\n for (var k = 1; k < tds[j].rowSpan; k++) {\n sumRows[i + k]++;\n }\n }\n }\n }\n\n for (var i = 0; i < table.rows.length; i++) {\n var tds = table.rows[i].getElementsByTagName('td'),\n totalColspan = 0;\n for (var j = 0; j < tds.length; j++) {\n totalColspan += tds[j].colSpan;\n }\n totalColspan += sumRows[i];\n difference = maxAmountOfCells - totalColspan;\n for (var j = 0; j < difference; j++) {\n var td = new WPTB_Cell(mark);\n table.rows[i].appendChild(td.getDOMElement());\n //table.rows[i].insertBefore( td.getDOMElement(), rows[i].nextSibling );\n }\n }\n };\n\n /*\n * This function deletes the row of currently\n * selected cell. \n */\n\n table.deleteRow = function () {\n let cell = document.querySelector('.wptb-highlighted'),\n cellStyles = cell.getAttribute('style'),\n rowspan = cell.rowSpan,\n row = getCoords(cell)[0],\n thisRow,\n aux;\n \n if ( rowspan == undefined ) rowspan = 1;\n \n for ( let i = 0; i < rowspan; i++ ) {\n thisRow = table.rows[row];\n let thisRowChildren = thisRow.children,\n nextRow = table.rows[row + 1],\n nextRowChildren,\n nextRowChildrenLength,\n tdArr = [];\n\n if( nextRow != undefined ) {\n nextRowChildren = nextRow.children;\n nextRowChildrenLength = nextRowChildren.length;\n for (let j = 0; j < thisRowChildren.length; j++) {\n if ( thisRowChildren[j].rowSpan > 1 ) {\n let td = new WPTB_Cell(mark);\n td.getDOMElement().setAttribute('style', cellStyles);\n td.getDOMElement().colSpan = thisRowChildren[j].colSpan;\n td.getDOMElement().rowSpan = thisRowChildren[j].rowSpan - 1;\n\n let nextRowChildrenK = undefined;\n for ( let k = 0; k < nextRowChildrenLength; k++ ) {\n if ( Number( nextRowChildren[k].dataset.xIndex ) > Number( thisRowChildren[j].dataset.xIndex ) ) {\n nextRowChildrenK = nextRowChildren[k];\n break;\n } \n }\n\n if ( nextRowChildrenK ) {\n tdArr.push( [td, nextRowChildrenK] );\n } else {\n tdArr.push( [td] );\n }\n }\n }\n\n if ( tdArr.length > 0 ) {\n for ( let k = 0; k < tdArr.length; k++ ) {\n if ( tdArr[k][1] != undefined ) {\n nextRow.insertBefore( tdArr[k][0].getDOMElement(), tdArr[k][1] );\n } else {\n nextRow.appendChild( tdArr[k][0].getDOMElement() );\n }\n }\n }\n }\n \n let tableRows = table.rows;\n if ( tableRows.length > 0 ) {\n for ( let j = 0; j < row; j++ ) {\n let jRowChildren = tableRows[j].children;\n if ( jRowChildren.length > 0 ) {\n for ( let x = 0; x < jRowChildren.length; x++ ) {\n if ( jRowChildren[x].rowSpan - 1 >= row - j ) {\n jRowChildren[x].rowSpan--;\n }\n }\n }\n }\n }\n aux = Array.from(array[0]);\n array.pop(aux);\n drawTable(array);\n table.getElementsByTagName('tbody')[0].removeChild(table.rows[row]);\n \n if( table.rows.length == 0 ) {\n table.toggleTableEditMode();\n wptbTableSetup.innerHTML = '';\n WPTB_Helper.settingsPanelClear();\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\n }\n \n table.recalculateIndexes();\n WPTB_Helper.dataTitleColumnSet( table );\n }\n \n undoSelect();\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n\n /*\n * This function deletes the column of currently\n * selected cell. Again, this is way more complicated than\n * delete row case.\n */\n\n table.deleteColumn = function () {\n let cell = document.querySelector('.wptb-highlighted'),\n cellXIndex = cell.dataset.xIndex,\n colspan = cell.colSpan;\n \n for ( let i = 0; i < colspan; i++ ) {\n for ( let j = 0; j < table.rows.length; j++ ) {\n let rowChildren = table.rows[j].children;\n let rowChildrenLength = rowChildren.length;\n if( rowChildrenLength > 0 ) {\n for ( let k = rowChildrenLength - 1; k >= 0; k-- ) {\n if ( Number( rowChildren[k].dataset.xIndex ) == Number( cellXIndex ) ) {\n if ( rowChildren[k].colSpan > 1 ) {\n rowChildren[k].colSpan--;\n } else {\n table.rows[j].removeChild( rowChildren[k] );\n }\n break;\n } else if( Number( rowChildren[k].dataset.xIndex ) < Number( cellXIndex ) && \n Number( rowChildren[k].dataset.xIndex ) + \n Number( rowChildren[k].colSpan -1 ) >= cellXIndex ) {\n if ( rowChildren[k].colSpan > 1 ) {\n rowChildren[k].colSpan--;\n }\n break;\n }\n }\n }\n }\n \n for ( let j = 0; j < table.rows.length; j++ ) {\n if (array[j] != undefined)\n array[j].pop();\n }\n \n maxAmountOfCells--;\n \n if( table.querySelectorAll( 'td' ).length == 0 ) {\n table.toggleTableEditMode();\n wptbTableSetup.innerHTML = '';\n WPTB_Helper.settingsPanelClear();\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\n }\n \n table.recalculateIndexes();\n table.tdDefaultWidth();\n WPTB_Helper.dataTitleColumnSet( table );\n }\n \n undoSelect();\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'none';\n\n array = fillTableArray();\n\n undoSelect();\n drawTable(array);\n\n wptbTableSetup.appendChild(table);\n //if (columns || rows) {\n table.recalculateIndexes( true );\n //}\n table.reconstraction();\n table.tdDefaultWidth();\n \n wptbTableSetup.onresize = function() {\n table.tdDefaultWidth();\n };\n\n WPTB_LeftPanel();\n \n // this code gets the ID of the active element in the toolbar \n // and stores it in the data attribute of the common container element \"wpcd_fixed_toolbar\"\n// let wptbPhElement = document.getElementsByClassName( 'wptb-ph-element' );\n// let wpcdFixedToolbar = document.getElementById( 'wpcd_fixed_toolbar' );\n// for ( let i = 0; i < wptbPhElement.length; i++ ) {\n// wptbPhElement[i].addEventListener( 'click', function( e ) {\n// let wptbToolbar = document.getElementById( 'wpcd_fixed_toolbar' ).children;\n// for ( let j = 0; j < wptbToolbar.length; j++ ) {\n// let elementStyles = window.getComputedStyle( wptbToolbar[j], 'null' );\n// if( elementStyles.getPropertyValue( 'display' ) == 'block' ) {\n// wpcdFixedToolbar.dataset.toolbarActiveId = wptbToolbar[j].getAttribute( 'id' );\n// }\n// }\n// }, false );\n// }\n \n// let wptbPanelLeft = document.getElementsByClassName( 'wptb-panel-left' );\n// if( wptbPanelLeft.length > 0 ) {\n// wptbPanelLeft[0].addEventListener( 'click', function( e ) {\n// let toolbarActiveElementId = wpcdFixedToolbar.dataset.toolbarActiveId;\n// document.getElementById( toolbarActiveElementId ).style.display = '';\n// }, false );\n// }\n \n// let body = document.getElementsByTagName( 'body' );\n// if( body.length > 0 ) {\n// body[0].addEventListener( 'click', function( e ) {\n// if ( e.target.classList.contains( 'wptb-panel-left' ) || WPTB_Helper.findAncestor( e.target, 'wptb-panel-left' ) ) {\n// let toolbarActiveElementId = wpcdFixedToolbar.dataset.toolbarActiveId;\n// document.getElementById( toolbarActiveElementId ).style.display = '';\n// }\n// }, false );\n// }\n};","var WPTB_TableStateSaveManager = function() {\n this.tableStateSet = () => {\n // get preview table\n let wptbPreviewTable = document.getElementsByClassName( 'wptb-preview-table' );\n if( wptbPreviewTable.length > 0 ) {\n wptbPreviewTable = wptbPreviewTable[0];\n \n // check if a global array doesn't exist with saved versions of the table \n // them create it\n if( ! window.wptbTableStateSaving ) {\n window.wptbTableStateSaving = [];\n } \n \n // remove the extra part of the array after changing the table \n // when it is showed in the not last modified version\n if( window.wptbTableStateSaving.length > window.wptbTableStateNumberShow + 1 ) {\n window.wptbTableStateSaving = window.wptbTableStateSaving.slice( 0, window.wptbTableStateNumberShow + 1 );\n }\n \n //add new state of table\n let wptbNewPreviewTable = wptbPreviewTable.cloneNode( true );\n let wptbHighlighted = wptbNewPreviewTable.getElementsByClassName( 'wptb-highlighted' );\n for( let i = 0; i < wptbHighlighted.length; i++ ) {\n wptbHighlighted[i].classList.remove( 'wptb-highlighted' );\n }\n let wptbDirectlyhovered = wptbNewPreviewTable.getElementsByClassName( 'wptb-directlyhovered' );\n for( let i = 0; i < wptbDirectlyhovered.length; i++ ) {\n wptbDirectlyhovered[i].classList.remove( 'wptb-directlyhovered' );\n }\n \n let cssForTdsWidthAutoValue = '';\n let head = document.head;\n if( head ) {\n let cssForTdsWidthAuto = head.querySelector( 'style[data-wptb-td-auto-width=\"true\"]' );\n if( cssForTdsWidthAuto ) {\n cssForTdsWidthAutoValue = cssForTdsWidthAuto.innerHTML;\n }\n }\n \n let mceContentBodys = wptbNewPreviewTable.querySelectorAll( '.mce-content-body' );\n if( mceContentBodys.length > 0 ) {\n for ( let k = 0; k < mceContentBodys.length; k++ ) {\n mceContentBodys[k].classList.remove( 'mce-content-body' );\n }\n }\n\n let dataMceStyle = wptbNewPreviewTable.querySelectorAll( '[data-mce-style]' );\n if ( dataMceStyle.length > 0 ) {\n for ( let k = 0; k < dataMceStyle.length; k++ ) {\n dataMceStyle[k].removeAttribute( 'data-mce-style' );\n }\n }\n\n let mceIds = wptbNewPreviewTable.querySelectorAll( '[id^=mce_]' );\n if ( mceIds.length > 0 ) {\n for ( let k = 0; k < mceIds.length; k++ ) {\n mceIds[k].removeAttribute( 'id' );\n }\n }\n \n window.wptbTableStateSaving.push( [wptbNewPreviewTable, cssForTdsWidthAutoValue] );\n \n // set new number of state which is showed now\n window.wptbTableStateNumberShow = window.wptbTableStateSaving.length - 1;\n \n // make undo arrow active when the table was changed\n if( window.wptbTableStateSaving.length > 1 ) {\n let wptbUndo = document.getElementsByClassName( 'wptb-undo' );\n if( wptbUndo.length > 0 ) {\n wptbUndo = wptbUndo[0];\n\n wptbUndo.classList.remove( 'wptb-undoredo-disabled' );\n }\n }\n \n // make redo arrow not active when the table was changed\n let wptbRedo = document.getElementsByClassName( 'wptb-redo' );\n if( wptbRedo.length > 0 ) {\n wptbRedo = wptbRedo[0];\n \n wptbRedo.classList.add( 'wptb-undoredo-disabled' );\n }\n \n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\n if( wptbSaveBtn.length > 0 ) {\n wptbSaveBtn = wptbSaveBtn[0];\n if( ( ! wptbSaveBtn.dataset.wptbTableStateNumberSave && window.wptbTableStateNumberShow == 0 ) || \n window.wptbTableStateNumberShow == wptbSaveBtn.dataset.wptbTableStateNumberSave ) {\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\n } else {\n wptbSaveBtn.classList.remove( 'wptb-save-disabled' );\n }\n }\n }\n }\n \n this.tableStateGet = ( datawptbUndoredo ) => {\n if( datawptbUndoredo && window.wptbTableStateSaving && window.wptbTableStateSaving.length > 1 ) {\n \n // changes the number of the state which displays now\n if( datawptbUndoredo == 'undo' ) {\n if( window.wptbTableStateNumberShow > 0 ) {\n window.wptbTableStateNumberShow--;\n } else {\n return false;\n }\n } else if( datawptbUndoredo == 'redo' ) {\n if( window.wptbTableStateNumberShow < window.wptbTableStateSaving.length - 1 ) {\n window.wptbTableStateNumberShow++;\n } else {\n return false;\n }\n }\n \n // add or delete class \"wptb-undoredo-disabled\" for undo button\n let wptbUndo = document.getElementsByClassName( 'wptb-undo' );\n if( wptbUndo.length > 0 ) {\n wptbUndo = wptbUndo[0];\n }\n if( window.wptbTableStateNumberShow == 0 ) {\n if( wptbUndo ) {\n wptbUndo.classList.add( 'wptb-undoredo-disabled' )\n }\n } else if( window.wptbTableStateNumberShow > 0 ) {\n if( wptbUndo ) {\n wptbUndo.classList.remove( 'wptb-undoredo-disabled' )\n }\n }\n \n // add or delete class \"wptb-undoredo-disabled\" for redo button\n let wptbRedo = document.getElementsByClassName( 'wptb-redo' );\n if( wptbRedo.length > 0 ) {\n wptbRedo = wptbRedo[0];\n }\n if( window.wptbTableStateNumberShow == window.wptbTableStateSaving.length - 1 ) {\n if( wptbRedo ) {\n wptbRedo.classList.add( 'wptb-undoredo-disabled' )\n }\n } else if( window.wptbTableStateNumberShow < window.wptbTableStateSaving.length - 1 ) {\n if( wptbRedo ) {\n wptbRedo.classList.remove( 'wptb-undoredo-disabled' )\n }\n }\n \n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\n if( wptbSaveBtn.length > 0 ) {\n wptbSaveBtn = wptbSaveBtn[0];\n if( ( ! wptbSaveBtn.dataset.wptbTableStateNumberSave && window.wptbTableStateNumberShow == 0 ) || \n window.wptbTableStateNumberShow == wptbSaveBtn.dataset.wptbTableStateNumberSave ) {\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\n } else {\n wptbSaveBtn.classList.remove( 'wptb-save-disabled' );\n }\n }\n \n // load necessary saved table state\n let wptbTableSetup = document.getElementsByClassName( 'wptb-table-setup' );\n if( wptbTableSetup.length > 0 ) {\n wptbTableSetup = wptbTableSetup[0];\n\n wptbTableSetup.innerHTML = '';\n wptbTableSetup.appendChild( window.wptbTableStateSaving[window.wptbTableStateNumberShow][0] );\n\n if( window.wptbTableStateSaving[window.wptbTableStateNumberShow][1] ) {\n let cssForTdsWidthAuto = document.createElement( 'style' );\n cssForTdsWidthAuto.setAttribute( 'data-wptb-td-auto-width', true );\n cssForTdsWidthAuto.innerHTML = window.wptbTableStateSaving[window.wptbTableStateNumberShow][1];\n let head = document.head;\n if( head ) {\n let cssForTdsWidthAutoOld = head.querySelector( 'style[data-wptb-td-auto-width=\"true\"]' );\n if( cssForTdsWidthAutoOld ) {\n head.removeChild( cssForTdsWidthAutoOld );\n }\n head.appendChild( cssForTdsWidthAuto );\n }\n }\n\n WPTB_Helper.settingsPanelClear();\n WPTB_Helper.elementOptionsPanelClear();\n WPTB_LeftPanel();\n\n let wptbLeftScrollPanelCellSetting = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ); \n if( wptbLeftScrollPanelCellSetting ) {\n wptbLeftScrollPanelCellSetting.classList.remove( 'visible' );\n }\n }\n }\n }\n}","var WPTB_Text = function ( text , DOMElementProt ) {\n let DOMElement = document.createElement('div'),\n elText2 = document.createElement('div'),\n elP = document.createElement('p'),\n kindIndexProt = undefined,\n copy = false;\n \n DOMElement.classList.add( 'wptb-text-container' );\n\n elP.innerHTML = text != undefined ? text : 'Text';\n elText2.appendChild(elP);\n DOMElement.appendChild(elText2);\n if ( DOMElementProt ) {\n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\n kindIndexProt = wptbElementMutch[1];\n copy = true;\n };\n\n let attributes = [...DOMElementProt.attributes];\n for( let i = 0; i < attributes.length; i++ ) {\n DOMElement.setAttribute(attributes[i].name, attributes[i].value);\n }\n } \n\n this.kind = 'text';\n this.getDOMElement = function () {\n return DOMElement;\n };\n applyGenericItemSettings( this, kindIndexProt, copy );\n\n return this;\n};","var WPTB_innerElementSet = function ( element ) {\n \n element.ondragenter = function (e) {\n var div;\n if ( e.dataTransfer.types.indexOf( 'wptbelement' ) == -1 && e.dataTransfer.types.indexOf( 'wptb-moving-mode' ) == -1 ) {\n return;\n }\n WPTB_DropHandle(this, e);\n \n element.classList.add( 'wptb-ondragenter' );\n }\n element.ondragover = function (e) {\n e.preventDefault();\n WPTB_DropHandle(this, e);\n }\n element.ondragleave = function () {\n \n }\n element.ondrop = function(e) {\n this.classList.remove( 'wptb-ondragenter' );\n let element, classId;\n e.preventDefault();\n e.stopPropagation();\n\n if (!e.dataTransfer.getData('wptbElement') && !e.dataTransfer.getData('node')) {\n return;\n }\n let wptbDropHandle,\n wptbDropBorderMarker;\n if ( document.getElementsByClassName( 'wptb-drop-handle' ).length > 0 ) {\n wptbDropHandle = document.getElementsByClassName( 'wptb-drop-handle' )[0];\n }\n if( document.getElementsByClassName( 'wptb-drop-border-marker' ).length > 0 ) {\n wptbDropBorderMarker = document.getElementsByClassName( 'wptb-drop-border-marker' )[0];\n }\n\n if ( e.dataTransfer.getData( 'wptbElement' ) ) {\n element = WPTB_Helper.newElementProxy( e.dataTransfer.getData( 'wptbElement' ) );\n element = element.getDOMElement();\n } else {\n classId = e.dataTransfer.getData( 'node' );\n element = document.getElementsByClassName( classId )[0];\n //element.classList.remove( 'wptb-moving-mode' );\n }\n \n if( wptbDropHandle.style.display == 'block' ) {\n let td;\n if( wptbDropHandle.dataset.text == 'Drop Here' ) {\n td = wptbDropHandle.getDOMParentElement();\n td.appendChild( element );\n } else {\n let innerElement = wptbDropHandle.getDOMParentElement();\n td = innerElement.parentNode;\n\n if( wptbDropHandle.dataset.text == 'Above Element' ) {\n td.insertBefore( element, innerElement );\n } else if( wptbDropHandle.dataset.text == 'Below Element' ) {\n let innerElementNext = innerElement.nextSibling;\n td.insertBefore( element, innerElementNext );\n }\n }\n let thisRow = td.parentNode\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\n WPTB_Helper.dataTitleColumnSet( table );\n }\n \n } else {\n return;\n }\n \n wptbDropHandle.style.display = 'none';\n wptbDropBorderMarker.style.display = 'none';\n\n WPTB_innerElementSet( element );\n \n if( ! element.classList.contains( 'wptb-image-container' ) || element.classList.contains( 'wptb-moving-mode' ) ) {\n element.classList.remove( 'wptb-moving-mode' );\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n } \n return true;\n }\n element.onmouseover = function(e) {\n element.classList.remove( 'wptb-ondragenter' );\n }\n}","var applyGenericItemSettings = function ( element, kindIndexProt, copy = false ) {\n var node = element.getDOMElement(),\n index,\n listItems,\n copy;\n \n if ( kindIndexProt == undefined || copy == true ) {\n index = document.counter.nextIndex( element.kind );\n let wptbElements = document.getElementsByClassName( 'wptb-ph-element' );\n let elementIndexesArr = [];\n for( let i = 0; i < wptbElements.length; i++ ) {\n var regex = new RegExp( 'wptb-element-' + element.kind + '-(\\\\d+)', \"i\" );\n let infArr = wptbElements[i].className.match( regex );\n if( infArr ) {\n elementIndexesArr.push( infArr[1] );\n }\n }\n if( elementIndexesArr.length > 0 ) {\n let elementIndexMax = Math.max( ...elementIndexesArr );\n index = elementIndexMax + 1;\n } else { \n index = 1;\n }\n } else if ( kindIndexProt && ! copy ) {\n let kindIndexProtArr = kindIndexProt.split('-');\n index = kindIndexProtArr[kindIndexProtArr.length - 1];\n }\n \n node.onmouseenter = function ( event ) {\n if( event.target.classList.contains( 'wptb-moving-mode' ) ) {\n return;\n }\n \n let i, wptbActionsField = new WPTB_ActionsField();\n \n wptbActionsField.addActionField( 1, node );\n \n wptbActionsField.setParameters( node );\n \n node.classList.remove( 'wptb-ondragenter' );\n \n //wptbActionsField.addActionField( 1, node )\n \n if ( element.kind === 'button' ) {\n let a = node.querySelector( 'a' ),\n target = a.querySelector( 'div' );\n a.onclick = function( e ) {\n e.preventDefault();\n }\n WPTB_Helper.buttonsTinyMceInit( target );\n } else if (element.kind === 'text') {\n tinyMCE.init({\n target: node.childNodes[0],\n inline: true,\n plugins: \"link, paste\",\n dialog_type: \"modal\",\n theme: 'modern',\n menubar: false,\n force_br_newlines : false,\n force_p_newlines : false,\n forced_root_block : '',\n fixed_toolbar_container: '#wpcd_fixed_toolbar',\n paste_as_text: true,\n toolbar: 'bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify',\n setup : function( ed ) {\n ed.on( 'change', function(e) {\n let row = WPTB_Helper.findAncestor( node, 'wptb-row' );\n if( row.classList.contains( 'wptb-table-head' ) ) {\n let table = WPTB_Helper.findAncestor( row, 'wptb-preview-table' );\n WPTB_Helper.dataTitleColumnSet( table );\n }\n \n \n });\n \n ed.on( 'keydown', function(e) {\n let wptbActionsField = new WPTB_ActionsField();\n \n wptbActionsField.addActionField( 1, node );\n \n wptbActionsField.setParameters( node );\n });\n ed.on( 'keyup', function(e) {\n let wptbActionsField = new WPTB_ActionsField();\n \n wptbActionsField.addActionField( 1, node );\n \n wptbActionsField.setParameters( node );\n \n e.target.onblur = function() {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n });\n \n },\n init_instance_callback: function (editor) {\n window.currentEditor = editor;\n //editor.fire('focus');\n editor.on('focus', function (e) {\n var totalWidth = document.getElementsByClassName('wptb-builder-panel')[0].offsetWidth;\n if (window.currentEditor &&\n document.getElementById('wptb_builder').scrollTop >= 55 &&\n window.currentEditor.bodyElement.style.display != 'none') {\n document.getElementById('wpcd_fixed_toolbar').style.position = 'fixed';\n document.getElementById('wpcd_fixed_toolbar').style.right = (totalWidth / 2 - document.getElementById('wpcd_fixed_toolbar').offsetWidth / 2) + 'px';\n document.getElementById('wpcd_fixed_toolbar').style.top = '100px';\n } else {\n document.getElementById('wpcd_fixed_toolbar').style.position = 'static';\n delete document.getElementById('wpcd_fixed_toolbar').style.right;\n delete document.getElementById('wpcd_fixed_toolbar').style.top;\n }\n });\n }\n });\n } else if( element.kind === 'list' ) {\n listItems = node.getElementsByClassName( 'wptb-list-item-content' );\n for ( let i = 0; i < listItems.length; i++ ) {\n WPTB_Helper.listItemsTinyMceInit( listItems[i] );\n }\n } \n };\n \n node.onmouseleave = function ( event ) {\n let wptbActionsField = new WPTB_ActionsField();\n \n if( wptbActionsField.wptbActions && wptbActionsField.wptbActions.type != '1' ) {\n return;\n }\n \n wptbActionsField.leaveFromField( event, node, 1 );\n };\n \n let wptbActions = document.getElementsByClassName( 'wptb-actions' );\n if( wptbActions.length > 0 ) {\n wptbActions = wptbActions[0];\n \n }\n \n // Change data-title-column if the title was changed\n if( element.kind == 'text' ) {\n var observer = new MutationObserver( function( mutations ) {\n let row = WPTB_Helper.findAncestor( node, 'wptb-row' );\n if( row.classList.contains( 'wptb-table-head' ) ) {\n let table = WPTB_Helper.findAncestor( row, 'wptb-preview-table' );\n WPTB_Helper.dataTitleColumnSet( table );\n }\n });\n var config = { attributes: true, attributeFilter: ['style'] };\n observer.observe( element.getDOMElement(), config );\n } else if( element.kind == 'star_rating' ) {\n let ratingStars = node.getElementsByClassName( 'wptb-rating-star' );\n for ( let i = 0; i < ratingStars.length; i++ ) {\n let ratingStar = ratingStars[i];\n \n \n WPTB_Helper.starRatingEventHandlersAdd( ratingStar );\n \n let ritingStarZeroSet = ratingStar.querySelector( '.wptb-rating-star-zero-set' );\n if( ritingStarZeroSet ) {\n ritingStarZeroSet.onclick = function( event ) {\n let ulStarList = WPTB_Helper.findAncestor( event.target, 'wptb-rating-stars-list' );\n if( ulStarList ) {\n let children = ulStarList.children;\n for( let i = 0; i < children.length; i++ ) {\n children[i].classList.remove( 'wptb-rating-star-selected-full' );\n children[i].classList.remove( 'wptb-rating-star-selected-half' );\n }\n }\n }\n }\n }\n }\n\n let node_wptb_element_kind_num = node.className.match(/wptb-element-(.+)-(\\d+)/i);\n if ( node_wptb_element_kind_num ) {\n node.classList.remove( node_wptb_element_kind_num[0] );\n }\n if ( ! node.classList.contains( 'wptb-ph-element' ) ) {\n node.classList.add( 'wptb-ph-element' );\n if( ! node.classList.contains( 'wptb-element-' + element.kind + '-' + index ) ) {\n node.classList.add( 'wptb-element-' + element.kind + '-' + index );\n }\n } else {\n if( ! node.classList.contains( 'wptb-element-' + element.kind + '-' + index ) ) {\n node.classList.add( 'wptb-element-' + element.kind + '-' + index );\n }\n }\n new WPTB_ElementOptions( element, index, kindIndexProt );\n\n document.counter.increment(element.kind);\n};",""]}
inc/admin/js/admin.min.js CHANGED
@@ -1 +1 @@
1
- var WPTB_ActionsField=function p(){var m=this;this.wptbActions,0!=document.getElementsByClassName("wptb-actions").length&&(this.wptbActions=document.getElementsByClassName("wptb-actions")[0]),this.addActionField=function(e,i){var t=document.getElementsByTagName("body")[0],a=document.getElementsByClassName("wptb-actions");if(0!=a.length){var n=a[0].activeElem;for(n&&n.classList.remove("wptb-directlyhovered");0!=a.length;)a[0].parentNode.removeChild(a[0])}if(1==e){var l=void 0,r=void 0,o=void 0;l=document.createElement("span"),r=document.createElement("span"),o=document.createElement("span"),(a=document.createElement("div")).classList.add("wptb-actions"),l.classList.add("dashicons","dashicons-trash","wptb-delete-action"),r.classList.add("dashicons","dashicons-admin-page","wptb-duplicate-action"),o.classList.add("dashicons","dashicons-move","wptb-move-action"),o.draggable=!0,a.appendChild(o),a.appendChild(r),a.appendChild(l),t.appendChild(a),a.activeElem=i,a.type=1,l.onclick=function(e){var t=e.target.parentNode.activeElem,a=t.parentNode;if(a.removeChild(t),"text"==t.kind){var n=a.parentNode;if(n.classList.contains("wptb-table-head")){var l=WPTB_Helper.findAncestor(n,"wptb-preview-table");WPTB_Helper.dataTitleColumnSet(l)}}(new p).actionsRemove(),(new WPTB_TableStateSaveManager).tableStateSet()},r.onclick=function(e){var t,a=void 0,n=e.target.parentNode.activeElem,l=n.cloneNode(!0);l.classList.remove("wptb-directlyhovered"),t=n.className.match(/wptb-element-(.+)-(\d+)/i)[1];var r=n.parentNode;if("list"==t){for(var o=[],i=n.querySelectorAll("ul li .wptb-list-item-content"),s=0;s<i.length;s++)o.push(i[s].innerHTML);a=new WPTB_List(o,l),r.insertBefore(a.getDOMElement(),n.nextSibling)}else if("text"==t)a=new WPTB_Text(l.childNodes[0].innerHTML,l),r.insertBefore(a.getDOMElement(),n.nextSibling);else if("image"==t)a=new WPTB_Image("",n),r.insertBefore(a.getDOMElement(),n.nextSibling);else{var d=l.childNodes[0].querySelector("p").innerHTML;a=new WPTB_Button(d,l),r.insertBefore(a.getDOMElement(),n.nextSibling)}WPTB_innerElementSet(a.getDOMElement()),new p(1,n).setParameters(n),(new WPTB_TableStateSaveManager).tableStateSet()},o.ondragstart=function(e){var t,a,n=WPTB_Helper.dragImagesArr(),l=e.target.parentNode.activeElem;a=(t=l.className.match(/wptb-element-(.+)-(\d+)/i))[1],l.classList.add("wptb-moving-mode"),e.dataTransfer.effectAllowed="move",e.dataTransfer.setDragImage(n[a],0,0),e.dataTransfer.setData("node","wptb-element-"+t[1]+"-"+t[2]),e.dataTransfer.setData("wptb-moving-mode","wptb-element-"+t[1]+"-"+t[2]),e.dataTransfer.setData("wptbElIndic-"+t[1],"wptbElIndic-"+t[1]);var r=e.target.parentNode.activeElem;if("text"==r.kind){var o=r.parentNode.parentNode;if(o.classList.contains("wptb-table-head")){var i=WPTB_Helper.findAncestor(o,"wptb-preview-table");WPTB_Helper.dataTitleColumnSet(i)}}m.actionsHide()},a.style.display="block",m.wptbActions=a}else if(2==e){var s=void 0,d=void 0;s=document.createElement("span"),d=document.createElement("span"),(a=document.createElement("span")).classList.add("wptb-actions"),s.classList.add("dashicons","dashicons-trash","wptb-delete-action"),d.classList.add("dashicons","dashicons-admin-page","wptb-duplicate-action"),a.append(d,s),t.appendChild(a),a.activeElem=i;var c=WPTB_Helper.findAncestor(i,"wptb-directlyhovered");c&&c.classList.remove("wptb-directlyhovered"),a.type=2,s.onclick=function(e){var t=e.target.parentNode.activeElem,a=t.parentNode;new p(4).actionsRemove(),a.removeChild(t),WPTB_Helper.listItemsRecalculateIndex(a),(new WPTB_TableStateSaveManager).tableStateSet()},d.onclick=function(e){var t=i.getBoundingClientRect(),a=t.top,n=e.target.parentNode.activeElem,l=n.querySelector(".wptb-list-item-content").innerHTML,r=new WPTB_ListItem(l,n,!0);n.parentNode.insertBefore(r.getDOMElement(),i.nextSibling),WPTB_Helper.listItemsTinyMceInit(r.getDOMElement().firstChild);var o=i.getElementsByClassName("wptb-list-item-content");(0<o.length&&(o=o[0]),setTimeout(function(){o.innerHTML=l,WPTB_Helper.listItemsRecalculateIndex(n.parentNode)},5),a!=(t=i.getBoundingClientRect()).top)&&new p(2,i).setParameters(i);(new WPTB_TableStateSaveManager).tableStateSet()},a.style.display="block",m.wptbActions=a}},this.setParameters=function(t){if(!m.wptbActions){var e=document.getElementsByClassName("wptb-actions");0<e.length&&(m.wptbActions=e[0])}m.wptbActions&&(m.wptbActions.style.display="block");var a=t.getBoundingClientRect(),n=document.getElementsByClassName("wptb-container")[0],l=function(){var e=t.getBoundingClientRect();m.wptbActions.style.top=parseFloat(e.top)-15+"px"};n.removeEventListener("scroll",l,!1),m.wptbActions.style.top=parseFloat(a.top)-15+"px",m.wptbActions.style.left=parseFloat(a.right)-parseFloat(m.wptbActions.clientWidth)+1+"px",m.wptbActions.style.display="block",t.classList.add("wptb-directlyhovered"),n.addEventListener("scroll",l,!1)},this.leaveFromField=function(e,t,a){if(e.relatedTarget&&(e.relatedTarget.classList.contains("wptb-actions")||e.relatedTarget.classList.contains("wptb-move-action")||e.relatedTarget.classList.contains("wptb-duplicate-action")||e.relatedTarget.classList.contains("wptb-delete-action")))return m.wptbActions||(m.wptbActions=document.getElementsByClassName("wptb-actions")[0]),void(m.wptbActions.onmouseleave=function(e){if(null!=e.relatedTarget&&e.relatedTarget!=m.wptbActions.activeElem&&WPTB_Helper.findAncestor(e.relatedTarget,"wptb-directlyhovered")!=m.wptbActions.activeElem&&(e.target.activeElem.classList.remove("wptb-directlyhovered"),m.wptbActions.style.display="none",2==m.wptbActions.type)){var t=new p;t.addActionField(1,e.relatedTarget.parentNode.parentNode),t.setParameters(e.relatedTarget.parentNode.parentNode)}});t.classList.remove("wptb-directlyhovered"),m.wptbActions.style.display="none",2==m.wptbActions.type&&e.relatedTarget&&"ul"==e.relatedTarget.localName&&(m.addActionField(1,e.relatedTarget.parentNode),m.setParameters(e.relatedTarget.parentNode))},this.actionsRemove=function(){if(!m.wptbActions){var e=document.getElementsByClassName("wptb-actions");0<e.length&&(m.wptbActions=e[0])}m.wptbActions&&m.wptbActions.parentNode.removeChild(m.wptbActions)},this.actionsHide=function(){if(!m.wptbActions){var e=document.getElementsByClassName("wptb-actions");0<e.length&&(m.wptbActions=e[0])}m.wptbActions&&(m.wptbActions.style.opacity=0)}};function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,a=Array(e.length);t<e.length;t++)a[t]=e[t];return a}return Array.from(e)}document.addEventListener("DOMContentLoaded",function(){var e=WPTB_Helper.detectMode();if(e){var a=new XMLHttpRequest,t=ajaxurl+"?action=get_table&id="+e;a.open("GET",t,!0),a.setRequestHeader("Content-type","application/x-www-form-urlencoded"),a.onreadystatechange=function(e){if(4!=this.readyState||200!=this.status);else{var t=JSON.parse(a.responseText);document.getElementById("wptb-setup-name").value=t[0],t[1]?(document.getElementsByClassName("wptb-table-generator")[0].style.display="none",document.getElementsByClassName("wptb-table-setup")[0].appendChild(WPTB_Parser(t[1])),WPTB_Table(),WPTB_LeftPanel(),WPTB_Settings(),(new WPTB_TableStateSaveManager).tableStateSet()):document.getElementsByClassName("wptb-table-generator")[0].style.display="table"}},a.send(null)}else document.getElementsByClassName("wptb-table-generator")[0].style.display="table";document.counter=new ElementCounters,document.select=new MultipleSelect,WPTB_Initializer(),settings=WPTB_Settings()});var WPTB_Button=function(e,t){var a=document.createElement("div"),n=document.createElement("div"),l=document.createElement("a"),r=document.createElement("div"),o=document.createElement("p"),i=void 0,s=!1;if(a.classList.add("wptb-button-container","wptb-size-M","wptb-"),n.classList.add("wptb-button-wrapper"),r.classList.add("wptb-button"),o.innerHTML=null!=e?e:"Button Text",t){var d=t.className.match(/wptb-element-((.+-)\d+)/i);d&&Array.isArray(d)&&(i=d[1],s=!0);var c=[].concat(_toConsumableArray(t.attributes));if(0<c.length)for(var p=0;p<c.length;p++)a.setAttribute(c[p].name,c[p].value);var m=t.querySelector(".wptb-button-wrapper");if(m){var u=[].concat(_toConsumableArray(m.attributes));if(0<u.length)for(var b=0;b<u.length;b++)"style"==u[b].name&&n.setAttribute(u[b].name,u[b].value)}var g=t.querySelector("a");if(g)if(0<(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,v=t.querySelector(".wptb-button");if(v)if(0<(h=[].concat(_toConsumableArray(v.attributes))).length)for(var y=0;y<h.length;y++)"style"==h[y].name&&r.setAttribute(h[y].name,h[y].value)}return n.appendChild(l),l.appendChild(r),r.appendChild(o),a.appendChild(n),this.kind="button",this.getDOMElement=function(){return a},applyGenericItemSettings(this,i,s),this},WPTB_Cell=function(e,i){if(!i){(i=document.createElement("td")).style.padding=jQuery("#wptb-table-padding-number").val()+"px";var t=jQuery("#wptb-table-inner-border-number").val();""!=t&&0!=parseInt(t)&&(i.style.border=t+"px solid "+jQuery("#wptb-table-border-color").val()),i.classList.add("wptb-droppable","wptb-cell")}i.draggable=!1,e&&(i.onclick=e),WPTB_innerElementSet(i);var s=i.getElementsByClassName("wptb-ph-element");if(0<s.length)for(var a=function(e){var t=i.getElementsByClassName("wptb-space-between");if(0<t.length)for(var a=0;a<t.length;a++)WPTB_Space(t[a]);s[e].getDOMElement=function(){return s[e]},WPTB_innerElementSet(s[e]);var n=s[e].className.match(/wptb-element-((.+-)\d+)/i);if(n&&Array.isArray(n)){var l=n[1].split("-");if(s[e].kind=l[0],applyGenericItemSettings(s[e],n[1]),"list"==s[e].kind){var r=s[e].getElementsByTagName("li");if(0<r.length)for(var o=0;o<r.length;o++)WPTB_ListItem(void 0,r[o])}}},n=0;n<s.length;n++)a(n);return this.getDOMElement=function(){return i},this.setCoords=function(e,t){var a=this.getDOMElement();a.dataset.yIndex=e,a.dataset.xIndex=t},this.getCoords=function(){var e,t=this.getDOMElement();return e.x=t.dataset.xIndex,e.y=t.dataset.yIndex,e},this.appendElement=function(e){getDOMElement().appendChild(e)},i.getCellDimensions=function(){var e=window.getComputedStyle(this,null),t=e.getPropertyValue("padding-left"),a=e.getPropertyValue("padding-right"),n=e.getPropertyValue("border-left-width"),l=e.getPropertyValue("border-right-width"),r=e.getPropertyValue("padding-top"),o=e.getPropertyValue("padding-bottom"),i=e.getPropertyValue("border-top-width"),s=e.getPropertyValue("border-bottom-width");return{width:parseFloat(this.offsetWidth,10)-parseFloat(t,10)-parseFloat(a,10)-parseFloat(n,10)-parseFloat(l,10),height:parseFloat(this.offsetHeight,10)-parseFloat(r,10)-parseFloat(o,10)-parseFloat(i,10)-parseFloat(s,10)}},this},WPTB_DropHandle=function(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"),a=document.createElement("div"),n=document.createElement("div"),l=document.createElement("div");t.classList.add("wptb-drop-border-marker-top"),a.classList.add("wptb-drop-border-marker-right"),n.classList.add("wptb-drop-border-marker-bottom"),l.classList.add("wptb-drop-border-marker-left"),c.appendChild(t),c.appendChild(a),c.appendChild(n),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,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.wptbMovingMode=1);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.style.display="none",WPTB_innerElementSet(a),console.log(a),a.classList.contains("wptb-image-container")&&1!=a.wptbMovingMode)||((new WPTB_TableStateSaveManager).tableStateSet(),a.wptbMovingMode)},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(),w=parseFloat(g.left),h=void 0;if(d.style.left=w+"px",-1!=e.dataTransfer.types.indexOf("wptb-moving-mode")){var v=document.getElementsByClassName("wptb-moving-mode")[0];s==v?(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 y=null==e.offsetY?e.layerY:e.offsetY;h=parseFloat(g.top)-parseFloat(11),d.dataset.text="Above Element",b/2<y&&(h=parseFloat(g.top)+b-1,d.dataset.text="Below Element")}else d.dataset.text="Drop Here",h=parseFloat(g.top)+b/2-5;d.style.top=h+"px",c.style.top=g.top+"px",c.style.left=g.left+"px",wptbDropBorderMarkerTop=c.querySelector(".wptb-drop-border-marker-top"),wptbDropBorderMarkerTop.style.width=parseFloat(s.offsetWidth)-parseFloat(1)+"px",wptbDropBorderMarkerRight=c.querySelector(".wptb-drop-border-marker-right"),wptbDropBorderMarkerRight.style.height=parseFloat(g.bottom)-parseFloat(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,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"),v=d[0].getAttribute("target"),y=d[0].getAttribute("id"),f=prop.querySelector('input[data-type="button-link"]'),B=prop.querySelector('input[data-type="button-link-target"]'),S=B.getAttribute("id"),T=B.parentNode.getElementsByTagName("label")[0],E=prop.querySelector('input[data-type="button-id"]');S=S+"-"+a.split("-")[1],B.setAttribute("id",S),T.setAttribute("for",S),f.value=h,v&&"_blank"==v&&(B.checked=!0),E.value=y}if(c){var C=c[0].style.color,N=c[0].style.backgroundColor,x=prop.querySelector('input[data-type="button-text-color"]'),_=prop.querySelector('input[data-type="button-color"]');x.value=WPTB_Helper.rgbToHex(C),_.value=WPTB_Helper.rgbToHex(N)}}else if("image"==e.kind){var I=document.getElementsByClassName("wptb-element-"+a);if(0<I.length){var P=I[0].getElementsByTagName("a");if(0<P.length){var W=P[0];if(W){var k=void 0;k="none"==W.style.float?"center":W.style.float;for(var A=prop.querySelector('select[data-type="image-alignment"]').getElementsByTagName("option"),L=0;L<A.length;L++)A[L].value==k&&(A[L].selected=!0);W.onclick=function(e){e.preventDefault()};var M=W.getAttribute("href"),D=prop.querySelector('input[data-type="image-link"]');M&&(D.value=M);var H=W.getAttribute("target"),q=prop.querySelector('input[data-type="image-link-target"]'),F=q.getAttribute("id"),O=q.parentNode.getElementsByTagName("label")[0];F=F+"-"+a.split("-")[1],q.setAttribute("id",F),O.setAttribute("for",F),H&&"_blank"==H&&(q.checked=!0);var R=W.style.width;if(R){var z=prop.querySelector('input[type="range"][data-type="image-size"]'),j=prop.querySelector('input[type="number"][data-type="image-size"]');z.value=parseInt(R),j.value=parseInt(R)}var Q=W.getElementsByTagName("img");if(0<Q.length){var V=Q[0].getAttribute("alt");prop.querySelector('input[type="text"][data-type="alternative-text"]').value=V}}}}}else if("text"==e.kind){var G=document.getElementsByClassName("wptb-element-"+a);if(0<G.length){var J=G[0].style.fontSize,U=G[0].style.color,Y=prop.querySelector('input[type="range"][data-type="font-size"]'),X=prop.querySelector('input[type="number"][data-type="font-size"]'),K=prop.querySelector('input[type="text"][data-type="color"]');Y.value=parseInt(J)?parseInt(J):10,X.value=parseInt(J)?parseInt(J):10,K.value=WPTB_Helper.rgbToHex(U)}}else if("list"==e.kind){var $=document.getElementsByClassName("wptb-element-"+a);if(0<$.length){var Z=$[0].querySelector("p").style.color;prop.querySelector('input[type="text"][data-type="list-text-color"]').value=WPTB_Helper.rgbToHex(Z);var ee=$[0].querySelectorAll("li");if(0<ee.length){var te=ee[0].querySelector("p").classList;if(0<te.length){var ae=prop.querySelector('select[data-type="list-class"]');if(ae){ae.value="unordered";for(var ne=ae.parentNode.nextSibling,le=0;le<10&&"1"!=ne.nodeType;le++)ne=ne.nextSibling;if(ne){var re=ne.getAttribute("id");ne.setAttribute("id",re+"-"+a),ne.style.display="flex"}var oe=prop.querySelector('select[data-type="list-style-type"]');oe&&(oe.parentNode.style.display="flex",te.contains("wptb-list-style-type-disc")?oe.value="disc":te.contains("wptb-list-style-type-circle")?oe.value="circle":te.contains("wptb-list-style-type-square")?oe.value="square":te.contains("wptb-list-style-type-none")&&(oe.value="none"))}}}var ie=$[0].getElementsByClassName("wptb-list-item-content");if(0<ie.length){for(var se=[],de=0;de<ie.length;de++){var ce=ie[de].querySelector("p");ce&&(ce.style.textAlign?se.push(ce.style.textAlign):se.push("left"))}var pe=0,me=0,ue=0;if(0<se.length)for(var be=0;be<se.length;be++)se[be]&&("left"==se[be]?pe++:"center"==se[be]?me++:"right"==se[be]&&ue++);var ge=prop.querySelector('select[data-type="list-alignment"]'),we=Math.max(pe,me,ue);pe==we?ge.value="left":me==we?ge.value="center":ue==we&&(ge.value="right")}}}if(l.onclick=function(){var e=this.className.match(/wptb-element-((.+-)\d+)/i),t=".wptb-"+e[2]+"options.wptb-options-"+e[1];document.getElementsByClassName("wptb-elements-container")[0].style.display="none",document.getElementsByClassName("wptb-settings-section")[0].style.display="none",document.getElementById("element-options-group").style.display="block";for(var a=document.getElementById("element-options-group").childNodes,n=0;n<a.length;n++)a[n].style&&(a[n].style.display="none");document.querySelector(t).style.display="block"},"button"==e.kind){var he=prop.getElementsByClassName("wptb-btn-size-btn");for(o=0;o<he.length;o++)he[o].onclick=function(){var e=this.innerHTML,t=this.dataset.element.match(/wptb-options-(.+)-(\d+)/i),a=t[1],n=t[2],l=document.getElementsByClassName("wptb-element-"+a+"-"+n)[0];l.classList.remove("wptb-size-S"),l.classList.remove("wptb-size-M"),l.classList.remove("wptb-size-L"),l.classList.remove("wptb-size-XL"),l.classList.add("wptb-size-"+e);for(var r=this.parentNode.getElementsByClassName("wptb-btn-size-btn"),o=0;o<r.length;o++)r[o].classList.remove("selected");this.classList.add("selected"),(new WPTB_TableStateSaveManager).tableStateSet()}}var 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();WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving(e)}}),"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(event)};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(event)};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":var o="";o="center"==this.value?"none":this.value,l.querySelector(".wptb-image-wrapper a").style.float=o;break;case"font-size":l.style.fontSize=r+"px",this.parentNode.parentNode.getElementsByClassName("wptb-text-font-size-slider")[0].value=this.value;break;case"button-alignment":var i="";i="left"==this.value?"start":"right"==this.value?"flex-end":"center",l.getElementsByClassName("wptb-button-wrapper")[0].style.justifyContent=i;break;case"button-link":this.value?l.getElementsByTagName("a")[0].href=WPTB_Helper.linkHttpCheckChange(this.value):l.getElementsByTagName("a")[0].removeAttribute("href");break;case"button-link-target":1==this.checked?l.getElementsByTagName("a")[0].target="_blank":l.getElementsByTagName("a")[0].target="_self";break;case"button-link-nofollow":1==this.checked?l.getElementsByTagName("a")[0].rel="nofollow":l.getElementsByTagName("a")[0].removeAttribute("rel");break;case"button-id":this.value?l.getElementsByTagName("a")[0].id=this.value:l.getElementsByTagName("a")[0].removeAttribute("id");case"button-color":break;case"list-alignment":for(var s=l.querySelectorAll("li"),d=0;d<s.length;d++){var c=s[d].querySelector("p");c&&(c.style.textAlign=this.value)}break;case"list-class":var p=e.target.parentNode.parentNode.querySelector("[data-type=list-style-type]").parentNode,m=p.parentNode;if("unordered"==r){p.style.display="flex",m.querySelector(".wptb-list-icon-select-label").style.display="flex";var u=l.querySelectorAll("li");for(d=0;d<u.length;d++){var b=u[d].querySelector("p");b.removeAttribute("class"),b.classList.add("wptb-list-style-type-disc")}m.querySelector("[data-type=list-style-type]").value="disc"}else{p.style.display="none",m.querySelector(".wptb-list-icon-select-label").style.display="none";var g=l.querySelectorAll("li");for(d=0;d<g.length;d++){g[d].querySelector("p").removeAttribute("class")}}break;case"list-style-type":for(g=l.querySelectorAll("li"),d=0;d<g.length;d++){var w=g[d].querySelector("p");w.removeAttribute("class"),w.classList.add("wptb-list-style-type-"+r.toLowerCase())}}e.target.classList.contains("wptb-text-font-size-slider")||e.target.classList.contains("wptb-image-size-slider")?e.target.onmouseup=function(){(new WPTB_TableStateSaveManager).tableStateSet()}:(new WPTB_TableStateSaveManager).tableStateSet()}}},WPTB_Helper={hexToRgb:function(e){var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?"rgb("+parseInt(t[1],16)+","+parseInt(t[2],16)+","+parseInt(t[3],16)+")":null},rgbToHex:function(e){return(e=e.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i))&&4===e.length?"#"+("0"+parseInt(e[1],10).toString(16)).slice(-2)+("0"+parseInt(e[2],10).toString(16)).slice(-2)+("0"+parseInt(e[3],10).toString(16)).slice(-2):""},getDragImageCustom:function(e){var t=location.protocol+"//"+location.hostname,a=document.createElement("img");return a.src=t+"/wp-content/plugins/wp-table-builder/inc/admin/views/builder/icons/"+e+".png",a},dragImagesArr:function(){return{text:WPTB_Helper.getDragImageCustom("text"),image:WPTB_Helper.getDragImageCustom("image"),button:WPTB_Helper.getDragImageCustom("button"),list:WPTB_Helper.getDragImageCustom("list")}},listItemsRecalculateIndex:function(e){var t=e.querySelectorAll("p");if(0<t.length)for(var a=0;a<t.length;a++)t[a].dataset.listStyleTypeIndex=Number(a)+1+"."},listItemsTinyMceInit:function(e){tinyMCE.init({target:e,inline:!0,plugins:"link, paste",dialog_type:"modal",theme:"modern",menubar:!1,fixed_toolbar_container:"#wpcd_fixed_toolbar",paste_as_text:!0,toolbar:"bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify",setup:function(e){e.on("keydown",function(e){var t=e.target.parentNode;if(13==e.keyCode){e.preventDefault();var a=e.target.innerHTML,n=new WPTB_ListItem(a,t,!0);return t.parentNode.insertBefore(n.getDOMElement(),t),WPTB_Helper.listItemsTinyMceInit(n.getDOMElement().firstChild),e.target.querySelector("p").innerText="New List Item",void WPTB_Helper.listItemsRecalculateIndex(t.parentNode)}if("8"==e.keyCode||"46"==e.keyCode){var l=e.target.querySelector("p").innerHTML.replace(/<[^>]+>/g,"");if(""==(l=(l=l.replace(/\s+/g," ").trim()).replace(/&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,i=new WPTB_ActionsField;i.addActionField(2,o),i.setParameters(o)}),e.on("keyup",function(e){var t=e.target.parentNode,a=new WPTB_ActionsField;a.addActionField(2,t),a.setParameters(t),e.target.onblur=function(){(new WPTB_TableStateSaveManager).tableStateSet()}})},init_instance_callback:function(e){(window.currentEditor=e).on("focus",function(e){var t=document.getElementsByClassName("wptb-builder-panel")[0].offsetWidth;window.currentEditor&&55<=document.getElementById("wptb_builder").scrollTop&&"none"!=window.currentEditor.bodyElement.style.display?(document.getElementById("wpcd_fixed_toolbar").style.position="fixed",document.getElementById("wpcd_fixed_toolbar").style.right=t/2-document.getElementById("wpcd_fixed_toolbar").offsetWidth/2+"px",document.getElementById("wpcd_fixed_toolbar").style.top="100px"):(document.getElementById("wpcd_fixed_toolbar").style.position="static",delete document.getElementById("wpcd_fixed_toolbar").style.right,delete document.getElementById("wpcd_fixed_toolbar").style.top)})}})},buttonsTinyMceInit:function(n){tinyMCE.init({target:n,inline:!0,plugins:"link",dialog_type:"modal",theme:"modern",menubar:!1,fixed_toolbar_container:"#wpcd_fixed_toolbar",toolbar:"bold italic strikethrough",setup:function(e){e.on("keydown",function(e){13==e.keyCode&&e.preventDefault();var t=WPTB_Helper.findAncestor(n,"wptb-button-container"),a=new WPTB_ActionsField;a.addActionField(1,t),a.setParameters(t)}),e.on("keyup",function(e){var t=WPTB_Helper.findAncestor(n,"wptb-button-container"),a=new WPTB_ActionsField;a.addActionField(1,t),a.setParameters(t),e.target.onblur=function(){(new WPTB_TableStateSaveManager).tableStateSet()}})},init_instance_callback:function(e){(window.currentEditor=e).on("focus",function(e){var t=document.getElementsByClassName("wptb-builder-panel")[0].offsetWidth;window.currentEditor&&55<=document.getElementById("wptb_builder").scrollTop&&"none"!=window.currentEditor.bodyElement.style.display?(document.getElementById("wpcd_fixed_toolbar").style.position="fixed",document.getElementById("wpcd_fixed_toolbar").style.right=t/2-document.getElementById("wpcd_fixed_toolbar").offsetWidth/2+"px",document.getElementById("wpcd_fixed_toolbar").style.top="100px"):(document.getElementById("wpcd_fixed_toolbar").style.position="static",delete document.getElementById("wpcd_fixed_toolbar").style.right,delete document.getElementById("wpcd_fixed_toolbar").style.top)})}})},linkHttpCheckChange:function(e){if(e){if(-1!=e.indexOf("http://")||-1!=e.indexOf("https://"))return e;var t=e.split("/"),a=void 0;return Array.isArray(t)&&0<t.length&&(a=t[t.length-1]),document.location.protocol+"//"+a}return""},dataTitleColumnSet:function(e){for(var t=e.rows,a=t[0],n=getComputedStyle(a),l=a.children,r={},o=0;o<l.length;o++){for(var i=l[o].children,s=0;s<i.length;s++){var d=i[s];if(d.classList.contains("wptb-ph-element"))if("text"==d.className.match(/wptb-element-(.+)-(\d+)/i)[1]){var c=d.querySelector("p"),p=c.textContent,m=c.style.textAlign;r[l[o].dataset.xIndex]=[p,d.style.fontSize,d.style.color,n.backgroundColor,m];break}}r[l[o].dataset.xIndex]||(r[l[o].dataset.xIndex]=["","","",n.backgroundColor,""])}for(var u=1;u<t.length;u++)for(var b=t[u].children,g=0;g<b.length;g++)r[b[g].dataset.xIndex]?(b[g].dataset.wptbTitleColumn=r[b[g].dataset.xIndex][0],b[g].dataset.wptbTitleColumnFontSize=r[b[g].dataset.xIndex][1],b[g].dataset.wptbTitleColumnColor=r[b[g].dataset.xIndex][2],b[g].dataset.wptbTitleBackgroundColor=r[b[g].dataset.xIndex][3],b[g].dataset.wptbTitleAlign=r[b[g].dataset.xIndex][4]):(b[g].dataset.wptbTitleColumn="",b[g].dataset.wptbTitleColumnFontSize="",b[g].dataset.wptbTitleColumnColor="",b[g].dataset.wptbTitleBackgroundColor="",b[g].dataset.wptbTitleAlign="")},findAncestor:function(e,t){for(;(e=e.parentElement)&&!e.classList.contains(t););return e},getSelectionText:function(){return window.getSelection?window.getSelection().toString():document.selection.createRange().text},settingsPanelClear:function(){document.getElementById("wptb-adaptive-table-checkbox").checked=!1,document.getElementById("wptb-top-row-as-header").checked=!1,document.getElementById("wptb-table-border-slider").value=0,document.getElementById("wptb-table-border-number").value=0,document.getElementById("wptb-inner-border-check").checked=!1,document.getElementById("wptb-apply-inner-border").classList.remove("visible"),document.getElementById("wptb-table-inner-border-slider").value=1,document.getElementById("wptb-table-inner-border-number").value=1,WPTB_Helper.wpColorPickerClear("wptb-table-border-color",!0),WPTB_Helper.wpColorPickerClear("wptb-table-header-bg",!0),WPTB_Helper.wpColorPickerClear("wptb-even-row-bg",!0),WPTB_Helper.wpColorPickerClear("wptb-odd-row-bg",!0),document.getElementById("wptb-table-cell-slider").value=15,document.getElementById("wptb-table-cell-number").value=15},elementOptionsPanelClear:function(){var e=document.getElementById("element-options-group");e&&(e.innerHTML="")},wpColorPickerCheckChangeForTableStateSaving:function(e){if("external"==e.originalEvent.type){(new WPTB_TableStateSaveManager).tableStateSet()}else{var t=WPTB_Helper.findAncestor(e.target,"wp-picker-container");if(t)if("square"==e.originalEvent.type){var a=t.getElementsByClassName("iris-square-handle");0<a.length&&((a=a[0]).onmouseup=function(){(new WPTB_TableStateSaveManager).tableStateSet()})}else if("strip"==e.originalEvent.type){var n=t.getElementsByClassName("iris-slider-offset");0<n.length&&((n=n[0]).onmouseup=function(){(new WPTB_TableStateSaveManager).tableStateSet()})}}},wpColorPickerClear:function(e,t){var a=void 0;t?(a=[document.getElementById(e)]).length=1:a=document.getElementsByClassName(e);for(var n=0;n<a.length;n++){var l=WPTB_Helper.findAncestor(a[n],"wp-picker-container");if(l){var r=l.parentNode;r.removeChild(l);var o=document.createElement("input");t?o.setAttribute("id",e):o.classList.add("wptb-element-property",e),o.value="",r.appendChild(o)}}},detectMode:function(){var e=window.location.href,t=new RegExp("[?&]table(=([^&#]*)|&|#|$)").exec(e);return!!t&&(t[2]?decodeURIComponent(t[2].replace(/\+/g," ")):"")},getColumnWidth:function(e,t){for(var a=t.dataset.xIndex,n=e.querySelectorAll('[data-x-index="'+a+'"]'),l=t.getCellDimensions().width,r=0;r<n.length;r++)l>n[r].getCellDimensions().width&&(l=n[r].getCellDimensions().width);return l},getRowHeight:function(e,t){for(var a=t.dataset.yIndex,n=e.querySelectorAll('[data-y-index="'+a+'"]'),l=t.getCellDimensions().height,r=0;r<n.length;r++)l>n[r].getCellDimensions().height&&(l=n[r].getCellDimensions().height);return l}},WPTB_Image=function(e,t){var a=void 0,n=void 0,l=void 0,r=!1;if(null==t){a=document.createElement("div"),n=document.createElement("div");var o=document.createElement("a"),i=document.createElement("img");o.style.display="block",o.appendChild(i),a.classList.add("wptb-image-container"),n.classList.add("wptb-image-wrapper"),n.appendChild(o),a.appendChild(n),o.onclick=function(e){e.preventDefault()},file_frame=wp.media.frames.file_frame=wp.media({title:"Select a image to upload",button:{text:"Use this image"},multiple:!1}),file_frame.on("select",function(){attachment=file_frame.state().get("selection").first().toJSON();var e=attachment.url.split(":"),t=void 0;Array.isArray(e)&&0<e.length&&(t=e[e.length-1]),i.src=t,i.height=attachment.height,i.width=attachment.width,i.style.width="100%",(new WPTB_TableStateSaveManager).tableStateSet()}),null==e?file_frame.open():i.src=e}else{(a=t.cloneNode(!0)).getElementsByTagName("a")[0].onclick=function(e){e.preventDefault()};var s=t.className.match(/wptb-element-((.+-)\d+)/i);s&&Array.isArray(s)&&(l=s[1],r=!0)}return this.kind="image",this.getDOMElement=function(){return a},applyGenericItemSettings(this,l,r),this},WPTB_Initializer=function(){var e=document.body;columnsDecrementButton=e.getElementsByClassName("wptb-input-number-decrement")[0],columnsIncrementButton=e.getElementsByClassName("wptb-input-number-increment")[0],rowsDecrementButton=e.getElementsByClassName("wptb-input-number-decrement")[1],rowsIncrementButton=e.getElementsByClassName("wptb-input-number-increment")[1],columnsInput=document.getElementById("wptb-columns-number"),rowsInput=document.getElementById("wptb-rows-number"),columnsDecrementButton.onclick=function(){1<columnsInput.value&&columnsInput.value--},columnsIncrementButton.onclick=function(){columnsInput.value<30&&columnsInput.value++},rowsDecrementButton.onclick=function(){1<rowsInput.value&&rowsInput.value--},rowsIncrementButton.onclick=function(){rowsInput.value<30&&rowsInput.value++},document.getElementById("wptb-generate-table").onclick=function(){var e=document.getElementById("wptb-columns-number").value,t=document.getElementById("wptb-rows-number").value;WPTB_Table(e,t),(new WPTB_TableStateSaveManager).tableStateSet()}},WPTB_LeftPanel=function(){var e,t,a,n,r=document.getElementsByClassName("wptb-preview-table")[0],l=document.getElementsByClassName("wptb-element");function o(e,t){if(!(3<t)&&r){var a=r.getElementsByTagName("tr");if(a.length>t){var n=a[t].style.backgroundColor,l=document.getElementById(e);l&&n&&(l.value=WPTB_Helper.rgbToHex(n))}}}function i(e){for(var t=r.getElementsByTagName("td"),a=0;a<t.length;a++)t[a].style.borderWidth=document.querySelector("#wptb-table-inner-border-number").value+"px",t[a].style.borderStyle="solid"}function s(e){for(var t=r.getElementsByTagName("td"),a=0;a<t.length;a++)t[a].style.padding=e+"px"}function d(e){r.style.borderWidth=e+"px",r.style.borderStyle="solid"}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();console.log(e),console.log(this),WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving(e)},clear:function(){for(var e=r.getElementsByTagName("tr"),t=1;t<e.length;t+=2){e[t].style.backgroundColor="";for(var a=e[t].getElementsByTagName("td"),n=0;n<a.length;n++)a[n].style.backgroundColor=""}(new WPTB_TableStateSaveManager).tableStateSet()}}),o("wptb-odd-row-bg",2),jQuery("#wptb-odd-row-bg").wpColorPicker({change:function(e,t){for(var a=r.getElementsByTagName("tr"),n=2;n<a.length;n+=2)a[n].style.backgroundColor=t.color.toString();WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving(e)},clear:function(){for(var e=r.getElementsByTagName("tr"),t=2;t<e.length;t+=2){e[t].style.backgroundColor="";for(var a=e[t].getElementsByTagName("td"),n=0;n<a.length;n++)a[n].style.backgroundColor=""}(new WPTB_TableStateSaveManager).tableStateSet()}}),o("wptb-table-header-bg",0),jQuery("#wptb-table-header-bg").wpColorPicker({change:function(e,t){r.getElementsByTagName("tr")[0].style.backgroundColor=t.color.toString(),(new WPTB_TableStateSaveManager).tableStateSet()},clear:function(){var e=r.getElementsByTagName("tr")[0];e.style.backgroundColor="";for(var t=e.getElementsByTagName("td"),a=0;a<t.length;a++)t[a].style.backgroundColor="";WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving(event)}}),e=r,t=document.getElementById("wptb-adaptive-table-checkbox"),e&&e.dataset.wptbAdaptiveTable&&"1"==e.dataset.wptbAdaptiveTable?t.checked=!0:t.checked=!1,a=r,n=document.getElementById("wptb-top-row-as-header"),a&&a.classList.contains("wptb-table-preview-head")?n.checked=!0:n.checked=!1,function(){var e=document.getElementsByClassName("wptb-preview-table");if(0<e.length){var t=e[0].style.borderColor;if(t){var a=document.getElementById("wptb-table-border-color");a&&(a.value=WPTB_Helper.rgbToHex(t))}var n=e[0].style.borderWidth;if(n){var l=document.getElementById("wptb-table-border-slider"),r=document.getElementById("wptb-table-border-number");l&&(l.value=parseInt(n)),r&&(r.value=parseInt(n))}var o=e[0].querySelector("td").style.borderWidth;if(o){var i=document.getElementById("wptb-inner-border-check"),s=document.getElementById("wptb-apply-inner-border");if(o&&0<parseInt(o)){if(i&&(i.checked=!0,s)){s.classList.add("visible");var d=document.getElementById("wptb-table-inner-border-slider"),c=document.getElementById("wptb-table-inner-border-number");d.value=parseInt(o),c.value=parseInt(o)}}else i.checked=!1}(n&&0<parseInt(n)||o&&0<parseInt(o))&&(document.getElementById("wptb-table-border-color-set-area").style.display="")}}(),jQuery("#wptb-table-border-color").wpColorPicker({change:function(e,t){var a=r.getElementsByTagName("td");r.style.border=document.querySelector("#wptb-table-border-number").value+"px solid "+t.color.toString();for(var n=0;n<a.length;n++){var l=document.querySelector("#wptb-table-inner-border-number").value;document.getElementById("wptb-inner-border-check").checked&&(a[n].style.border=(0!=l?l:1)+"px solid "+t.color.toString())}WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving(e)},clear:function(){var e=r.getElementsByTagName("td");r.style.borderColor="";for(var t=0;t<e.length;t++)e[t].style.borderColor="";(new WPTB_TableStateSaveManager).tableStateSet()}}),function(){var e=document.getElementsByClassName("wptb-preview-table");if(0<e.length){var t=e[0].querySelector("td");if(t){var a=t.style.padding;if(a){var n=document.getElementById("wptb-table-cell-slider"),l=document.getElementById("wptb-table-cell-number");n&&(n.value=parseInt(a)),l&&(l.value=parseInt(a))}}}}(),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-slider").onchange=function(){(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-cell-number").onchange=function(){document.getElementById("wptb-table-cell-slider").value=this.value,s(this.value),r.tdDefaultWidth(),(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-border-slider").oninput=function(){document.getElementById("wptb-table-border-number").value=this.value,d(this.value),r.tdDefaultWidth();var e=document.getElementById("wptb-inner-border-check").checked,t=document.getElementById("wptb-table-border-color-set-area");0==this.value&&0==e?t.style.display="none":t.style.display=""},document.getElementById("wptb-table-border-slider").onchange=function(){(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-border-number").onchange=function(){document.getElementById("wptb-table-border-slider").value=this.value,d(this.value),r.tdDefaultWidth(),(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-inner-border-slider").oninput=function(){document.getElementById("wptb-table-inner-border-number").value=this.value,i(this.value),r.tdDefaultWidth()},document.getElementById("wptb-table-inner-border-slider").onchange=function(){(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-inner-border-number").onchange=function(){document.getElementById("wptb-table-inner-border-slider").value=this.value,i(this.value),r.tdDefaultWidth(),(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-inner-border-check").onchange=function(){if(r){var e=this.checked?"checked":"unchecked";!function(e){var t=null!=document.querySelector("#wptb-table-border-color").value?document.querySelector("#wptb-table-border-color").value:"rgb(0,0,0)";0!=document.querySelector("#wptb-table-inner-border-slider").value&&0!=document.querySelector("#wptb-table-inner-border-number").value||(document.querySelector("#wptb-table-inner-border-slider").value=1,document.querySelector("#wptb-table-inner-border-number").value=1);var a=document.querySelector("#wptb-table-inner-border-slider").value+"px",n=document.getElementsByClassName("wptb-preview-table");if(0<n.length)if("checked"==e){document.getElementById("wptb-apply-inner-border").style.marginBottom="0px";for(var l=n[0].getElementsByTagName("td"),r=0;r<l.length;r++)l[r].style.border=a+" solid "+t;document.getElementById("wptb-apply-inner-border").classList.add("visible")}else for(document.getElementById("wptb-apply-inner-border").classList.remove("visible"),l=n[0].getElementsByTagName("td"),r=0;r<l.length;r++)l[r].style.border="0px solid "+t,l[r].style.border=null}(e);var t=document.getElementById("wptb-table-border-slider").value,a=document.getElementById("wptb-table-border-color-set-area");a.style.display="unchecked"==e&&0==t?"none":"",(new WPTB_TableStateSaveManager).tableStateSet()}},document.getElementById("wptb-table-column-width-slider").oninput=function(){document.getElementById("wptb-table-column-width-number").value=this.value,r.addColumnWidth(this.value)},document.getElementById("wptb-table-column-width-slider").onchange=function(){(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-column-width-number").onchange=function(){document.getElementById("wptb-table-column-width-slider").value=this.value,r.addColumnWidth(this.value),(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-column-width-auto-fixed").onchange=function(){if(this.checked){var e=r.querySelector(".wptb-highlighted"),t=WPTB_Helper.getColumnWidth(r,e);r.addColumnWidth(t)}else{r.addColumnWidth(!1,!0);var a=r.querySelector(".wptb-highlighted"),n=WPTB_Helper.getColumnWidth(r,a);document.getElementById("wptb-table-column-width-number").value=n,document.getElementById("wptb-table-column-width-slider").value=n}(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-row-height-slider").oninput=function(){document.getElementById("wptb-table-row-height-number").value=this.value,r.addRowHeight(this.value)},document.getElementById("wptb-table-row-height-slider").onchange=function(){(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-row-height-number").onchange=function(){document.getElementById("wptb-table-row-height-slider").value=this.value,r.addRowHeight(this.value),(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-row-height-auto-fixed").onchange=function(){if(this.checked){var e=r.querySelector(".wptb-highlighted"),t=WPTB_Helper.getRowHeight(r,e);r.addRowHeight(t)}else{r.addRowHeight(!1,!0);var a=r.querySelector(".wptb-highlighted"),n=WPTB_Helper.getRowHeight(r,a);document.getElementById("wptb-table-row-height-number").value=n,document.getElementById("wptb-table-row-height-slider").value=n}(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-adaptive-table-checkbox").onchange=function(){this.checked?r.dataset.wptbAdaptiveTable=1:r.dataset.wptbAdaptiveTable=0,(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-top-row-as-header").onchange=function(){!function(e,t){if(t.checked)WPTB_Helper.dataTitleColumnSet(e),e.classList.add("wptb-table-preview-head"),e.rows[0].classList.add("wptb-table-head");else{var a=e.rows;e.classList.remove("wptb-table-preview-head"),a[0].classList.remove("wptb-table-head");for(var n=1;n<a.length;n++)for(var l=a[n].children,r=0;r<l.length;r++)l[r].removeAttribute("data-wptb-title-column"),l[r].removeAttribute("data-wptb-title-column-font-size"),l[r].removeAttribute("data-wptb-title-column-color"),l[r].removeAttribute("data-wptb-title-background-color"),l[r].removeAttribute("data-wptb-title-align")}}(r,this),(new WPTB_TableStateSaveManager).tableStateSet()};for(var 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].onclick=function(e){e.target.classList.contains("wptb-ph-element")||WPTB_Helper.findAncestor(e.target,"wptb-ph-element")||e.target.classList.contains("wptb-fixed-toolbar")||WPTB_Helper.findAncestor(e.target,"wptb-fixed-toolbar")||u()};var m=document.getElementsByClassName("wptb-header");function u(){document.getElementsByClassName("wptb-elements-container")[0].style.display="table",document.getElementsByClassName("wptb-settings-section")[0].style.display="block",document.getElementById("element-options-group").style.display="none";var e=document.getElementById("wpcd_fixed_toolbar");e.hasAttribute("data-toolbar-active-id")&&document.getElementById(e.getAttribute("data-toolbar-active-id")).classList.remove("toolbar-active")}0<m.length&&(m=m[0]),m.onclick=function(){u()}},WPTB_List=function(e,t){var a,n=document.createElement("ul"),l=document.createElement("div"),r=void 0,o=!1;if(l.classList.add("wptb-list-item-container"),this.kind="list",""===e);else if(e){var i=t.className.match(/wptb-element-((.+-)\d+)/i);i&&Array.isArray(i)&&(r=i[1],o=!0);for(d=0;d<e.length;d++){var s=t.querySelector("li");a=new WPTB_ListItem(e[d],s,!0),n.appendChild(a.getDOMElement())}}else for(var d=0;d<3;d++)a=new WPTB_ListItem("<p>List Item "+(d+1)+"</p>"),n.appendChild(a.getDOMElement());return l.appendChild(n),this.getDOMElement=function(){return l},applyGenericItemSettings(this,r,o),WPTB_Helper.listItemsRecalculateIndex(n),this},WPTB_ListItem=function(e,t,a){var n=void 0;if(null==t||t&&a){null==e&&(e="New List Item");var l=document.createElement("li");if((o=document.createElement("div")).classList.add("wptb-list-item-content"),t){var r=t.getAttribute("style");r&&l.setAttribute("style",r)}l.appendChild(o),o.innerHTML=e,o.onkeyup=window.listItemKeyListener,n=!0}else{var o;(o=(l=t).getElementsByClassName("wptb-list-item-content")[0]).onkeyup=window.listItemKeyListener,n=!1}if(l.onmouseenter=function(e){var t=new WPTB_ActionsField;t.addActionField(2,l),t.setParameters(l),console.log(l)},l.onmouseleave=function(e){return(new WPTB_ActionsField).leaveFromField(e,l,2),!1},this.getDOMElement=function(){return l},n)return this},MultipleSelect=function(){var l=[],a=!1;return this.activateMultipleSelectMode=function(){l=[];for(var e=document.getElementsByClassName("wptb-preview-table")[0].getElementsByTagName("td"),t=0;t<e.length;t++)e[t].classList.remove("wptb-highlighted");a=!0},this.deactivateMultipleSelectMode=function(){a=!1},this.isActivated=function(){return a},this.pushSelectedCell=function(e){a&&(l.push(e),e.classList.add("wptb-highlighted"))},this.selectedCells=function(){return l},this.flushSelectedCells=function(){l=[]},this.getFirst=function(){for(var e,t=1e3,a=1e3,n=l.length-1;0<=n;n--)t>=l[n].dataset.xIndex&&a>=l[n].dataset.yIndex&&(e=l[n],t=l[n].dataset.xIndex,a=l[n].dataset.yIndex);return e},this.getLast=function(){for(var e,t=-1,a=-1,n=l.length-1;0<=n;n--)t<=l[n].dataset.xIndex&&a<=l[n].dataset.yIndex&&(e=l[n],t=l[n].dataset.xIndex,a=l[n].dataset.yIndex);return e},this.removeAllButFirst=function(){for(var e=this.getFirst(),t=1;t<l.length;t++)l[t].classList.add("wptb-fused-cell-"+e.dataset.xIndex+"-"+e.dataset.yIndex)},this};function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,a=Array(e.length);t<e.length;t++)a[t]=e[t];return a}return Array.from(e)}var WPTB_Parser=function(e){var t=document.createElement("div");t.innerHTML=e;for(var a=t.children[0],n=[].concat(_toConsumableArray(a.querySelectorAll(".wptb-column-title-mobile-container"))),l=0;l<n.length;l++){n[l].parentNode.removeChild(n[l])}for(var r=a.querySelectorAll("td"),o=0;o<r.length;o++)r[o].classList.add("wptb-droppable"),r[o].classList.remove("wptb-column-title-mobile-not-elements");return a},WPTB_Parser2=function(e){if(Array.isArray(e)){var t=void 0;if(1==e.length)return t.appendChild(document.createTextNode(e[0]));if(0 in e){var a=e[0];if(t=document.createElement(a),1 in e&&Array.isArray(e[1]))for(var n=e[1],l=0;l<n.length;l++)Array.isArray(n[l])&&t.setAttribute(n[l][0],n[l][1]);if(2 in e)if(Array.isArray(e[2]))for(var r=0;r<e[2].length;r++)"string"!=typeof e[2][r]||"p"!=a.toLowerCase()?WPTB_Parser(e[2][r])&&t.appendChild(WPTB_Parser(e[2][r])):t.appendChild(document.createTextNode(e[2][r]));else"string"==typeof e[2]&&t.appendChild(document.createTextNode(e[2]))}return t}return!1},WPTB_Settings=function(){for(var e=document.getElementsByClassName("wptb-element"),t=0;t<e.length;t++)e[t].ondragstart=function(e){e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("wptbElement",e.target.dataset.wptbElement),e.dataTransfer.setData("wptbElIndic-"+e.target.dataset.wptbElement,"wptbElIndic-"+e.target.dataset.wptbElement)},e[t].ondragend=function(){var e=document.querySelector(".wptb-drop-handle"),t=document.querySelector(".wptb-drop-border-marker");(e||t)&&(e.style.display="none",t.style.display="none")};var a=new WPTB_TableStateSaveManager,n=document.getElementsByClassName("wptb-undo");0<n.length&&((n=n[0]).onclick=function(e){if(!this.classList.contains("wptb-undoredo-disabled")){a.tableStateGet(this.dataset.wptbUndoredo);var t=document.getElementsByClassName("wptb-undo-redo-container");0<t.length&&((t=t[0]).onmouseleave=function(e){e.target.onmouseleave="",WPTB_Table()})}});var l=document.getElementsByClassName("wptb-redo");0<l.length&&((l=l[0]).onclick=function(e){if(!this.classList.contains("wptb-undoredo-disabled")){a.tableStateGet(this.dataset.wptbUndoredo);var t=document.getElementsByClassName("wptb-undo-redo-container");0<t.length&&((t=t[0]).onmouseleave=function(e){e.target.onmouseleave="",WPTB_Table()})}});var r=document.getElementsByClassName("wptb-popup-window-modal")[0];document.getElementsByClassName("wptb-embed-btn")[0].onclick=function(){this.classList.contains("wptb-button-disable")||r.classList.add("wptb-popup-show")},window.onbeforeunload=function(e){return 0==document.getElementsByClassName("wptb-save-disabled").length||null},document.getElementsByClassName("wptb-popup-dark-area")[0].onclick=function(){r.classList.remove("wptb-popup-show")},document.getElementsByClassName("wptb-popup-window-close-icon")[0].onclick=function(){r.classList.remove("wptb-popup-show")},document.getElementsByClassName("wptb-preview-btn")[0].onclick=function(e){this.classList.contains("wptb-button-disable")&&e.preventDefault()},document.getElementsByClassName("wptb-save-btn")[0].onclick=function(r){if((r.target.dataset.wptbTableStateNumberSave||0!=window.wptbTableStateNumberShow)&&window.wptbTableStateNumberShow!=r.target.dataset.wptbTableStateNumberSave){var e=document.querySelector(".wptb-edit-bar");if(e&&e.classList.contains("visible"))document.getElementsByClassName("wptb-preview-table")[0].toggleTableEditMode();var o=new XMLHttpRequest,t=(wptb_admin_object?wptb_admin_object.ajaxurl:ajaxurl)+"?action=save_table",i=document.getElementById("wptb-setup-name").value.trim(),s=void 0,a=document.getElementsByClassName("wptb-preview-table");if(a=0<a.length?(a=WPTB_Stringifier(a[0])).outerHTML:"",""===i||""===a){var n="";return""===i&&(n+="You must assign a name to the table before saving it.</br>"),""===a&&(n+="Table wasn't created"),(s=document.getElementById("wptb-messaging-area")).innerHTML='<div class="wptb-error wptb-message">Error: '+n+"</div>",s.classList.add("wptb-warning"),void setTimeout(function(){s.removeChild(s.firstChild)},4e3)}var l={title:i,content:a,security_code:wptb_admin_object.security_code};((rs=WPTB_Helper.detectMode())||(rs=document.wptbId))&&(l.id=rs),l=JSON.stringify(l),o.open("POST",t,!0),o.setRequestHeader("Content-type","application/json; charset=utf-8"),o.onreadystatechange=function(e){if(4==this.readyState&&200==this.status){var t=JSON.parse(o.responseText);if(s=document.getElementById("wptb-messaging-area"),"saved"==t[0]){document.wptbId=t[1],s.innerHTML='<div class="wptb-success wptb-message">Table "'+i+'" was successfully saved.</div>',document.getElementsByClassName("wptb-embed-btn")[0].classList.remove("wptb-button-disable"),document.getElementById("wptb-embed-shortcode").value="[wptb id="+t[1]+"]";var a=document.getElementsByClassName("wptb-preview-btn");if(0<a.length){(a=a[0]).classList.remove("wptb-button-disable");var n=a.dataset.previewHref;n=n.replace("empty",t[1]),a.setAttribute("href",n)}}else if("edited"==t[0]){s.innerHTML='<div class="wptb-success wptb-message">Table "'+i+'" was successfully updated.</div>',r.target.dataset.wptbTableStateNumberSave=window.wptbTableStateNumberShow;var l=document.getElementsByClassName("wptb-save-btn");0<l.length&&(l=l[0]).classList.add("wptb-save-disabled")}else s.innerHTML='<div class="wptb-error wptb-message">Safety problems</div>';s.classList.add("wptb-success"),setTimeout(function(){s.removeChild(s.firstChild)},4e3)}},o.send(l)}}},WPTB_Space=function i(e){var t=void 0;if(e?t=e:(t=document.createElement("div")).classList.add("wptb-space-between"),t.ondragenter=function(){this.classList.add("visible")},t.ondragover=function(e){e.preventDefault()},t.ondragleave=function(){this.classList.remove("visible")},t.ondrop=function(e){e.stopPropagation();for(var t,a,n,l,r=e.target.nextSibling,o=e.target;!o.classList.contains("wptb-droppable");)o=o.parentNode;e.dataTransfer.getData("wptbElement")?(t=(l=e.dataTransfer.getData("wptbElement")).includes("list")?new WPTB_List:l.includes("image")?new WPTB_Image:l.includes("text")?new WPTB_Text:l.includes("button")?new WPTB_Button:void 0,this.classList.remove("visible"),null==r?(o.appendChild(t.getDOMElement()),o.appendChild(new i)):(o.insertBefore(t.getDOMElement(),r),o.insertBefore(new i,r))):(alert(e.dataTransfer.getData("node")),a=(t=document.getElementsByClassName(e.dataTransfer.getData("node"))[0]).nextSibling,n=t.parentNode,null!=a&&n.removeChild(a),null==r?(o.appendChild(t),o.appendChild(new i)):(o.insertBefore(t,r),o.insertBefore(new i,r))),this.classList.remove("visible")},!e)return t},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 v=document.createElement("div"),y=document.createElement("div");v.classList.add("wptb-column-title-mobile-container"),y.classList.add("wptb-column-title-mobile"),y.dataset.wptbTitleColumn=a[n].dataset.wptbTitleColumn,y.setAttribute("style","font-size:"+a[n].dataset.wptbTitleColumnFontSize+"; \n color:"+a[n].dataset.wptbTitleColumnColor+"; background-color:"+a[n].dataset.wptbTitleBackgroundColor+"; text-align:"+a[n].dataset.wptbTitleAlign+";"),y.style.padding=a[n].style.padding,0==a[n].children.length&&a[n].classList.add("wptb-column-title-mobile-not-elements"),v.appendChild(y),a[n].insertBefore(v,a[n].firstChild)}}return t}};function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,a=Array(e.length);t<e.length;t++)a[t]=e[t];return a}return Array.from(e)}var WPTB_Stringifier2=function(e){1<arguments.length&&void 0!==arguments[1]&&arguments[1];if(null==e)return"";if(null==e.tagName&&3==e.nodeType)return e.nodeValue;var t=[],a=void 0,n=!1,l=[].concat(_toConsumableArray(e.attributes)),r=[],o=[];if((e.parentNode.classList.contains("wptb-list-item-content")||e.parentNode.classList.contains("mce-content-body"))&&"p"==e.tagName.toLowerCase()?(a=e.childNodes,n=!0):a=0<e.children.length?e.children:e.childNodes,0<l.length)for(var i=0;i<l.length;i++)r[i]=[l[i].name,l[i].value];else r="";if(0<a.length)for(var s=0;s<a.length;s++){var d=WPTB_Stringifier(a[s]);Array.isArray(d)||n?o[s]=d:"string"==typeof d&&d&&(o=d)}else o="";return t.push(e.tagName.toLowerCase(),r,o),t},_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},array=[],WPTB_Table=function(e,t){var P,a,n,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=E(this),d=s[0],c=s[1];if(document.select.isActivated()){if(this.className.match(/wptb-highlighted/)){this.classList.remove("wptb-highlighted");for(var p=0;p<a;p++)for(var m=0;m<n;m++)array[d+p][c+m]=0}else{this.classList.add("wptb-highlighted");for(p=0;p<a;p++)for(m=0;m<n;m++)array[d+p][c+m]=1}if(0===(t=document.getElementsByClassName("wptb-highlighted").length)){for(p=0;p<o.length;p++)o[p].classList.remove("visible"),o[p].setAttribute("disabled","disabled");for(p=0;p<l.length;p++)l[p].classList.add("visible"),l[p].removeAttribute("disabled");for(p=0;p<r.length;p++)r[p].classList.remove("visible"),r[p].setAttribute("disabled","disabled");i.classList.remove("visible")}else if(1===t){for(p=0;p<o.length;p++)o[p].classList.remove("visible"),o[p].setAttribute("disabled","disabled");for(p=0;p<l.length;p++)l[p].classList.remove("visible"),l[p].setAttribute("disabled","disabled");for(p=0;p<r.length;p++)r[p].classList.add("visible"),r[p].removeAttribute("disabled");var u=document.querySelector(".wptb-highlighted");if(u){var b=document.getElementById("wptb-table-column-width-slider"),g=document.getElementById("wptb-table-column-width-number"),w=document.getElementById("wptb-table-column-width-auto-fixed"),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 v=WPTB_Helper.getColumnWidth(P,u);b.value=v,g.value=v,w.checked=!1}var y=document.getElementById("wptb-table-row-height-slider"),f=document.getElementById("wptb-table-row-height-number"),B=document.getElementById("wptb-table-row-height-auto-fixed"),S=u.style.height;if(S)y.value=parseFloat(S,10),f.value=parseFloat(S,10),B.checked=!0;else if(u.dataset.wptbFixedHeight)y.value=u.dataset.wptbFixedHeight,f.value=u.dataset.wptbFixedHeight,B.checked=!0;else{var T=WPTB_Helper.getRowHeight(P,u);y.value=T,f.value=T,B.checked=!1}}i.classList.add("visible")}else{for(p=0;p<o.length;p++)P.isSquare(array)?(o[p].classList.add("visible"),o[p].removeAttribute("disabled")):(o[p].classList.remove("visible"),o[p].setAttribute("disabled","disabled"));for(p=0;p<l.length;p++)l[p].classList.remove("visible"),l[p].setAttribute("disabled","disabled");for(p=0;p<r.length;p++)r[p].classList.remove("visible"),r[p].setAttribute("disabled","disabled");i.classList.remove("visible")}}},S=function(e){for(var t=0;t<e.length;t++){for(var a=0;a<e[t].length;a++)" "+e[t][a];"\n"}P.isSquare(e)},T=function(){for(var e=document.getElementsByClassName("wptb-no-cell-action"),t=document.getElementsByClassName("wptb-single-action"),a=document.getElementsByClassName("wptb-multiple-select-action"),n=document.getElementById("wptb-left-scroll-panel-cell-settings"),l=P.getElementsByClassName("wptb-highlighted");l.length;)l[0].classList.remove("wptb-highlighted");n.classList.remove("visible");for(var r=0;r<array.length;r++)for(var o=0;o<array[r].length;o++)array[r][o]=0;for(r=0;r<a.length;r++)a[r].classList.remove("visible"),a[r].setAttribute("disabled","disabled");for(r=0;r<e.length;r++)e[r].classList.add("visible"),e[r].removeAttribute("disabled");for(r=0;r<t.length;r++)t[r].classList.remove("visible"),t[r].setAttribute("disabled","disabled")},E=function(e){for(var t=[],a=0;a<h;a++)t[a]=0;for(a=0;a<P.rows.length;a++)for(var n=P.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");(P=document.createElement("table")).classList.add("wptb-preview-table"),P.dataset.reconstraction=1,P.dataset.wptbAdaptiveTable=1;for(r=0;r<t;r++){(a=P.insertRow(-1)).classList.add("wptb-row");for(var g=0;g<e;g++)(n=new WPTB_Cell(B)).setCoords(r,g),a.appendChild(n.getDOMElement())}}else{var o=document.getElementsByClassName("wptb-preview-table");if(0<o.length){var i=(P=o[0]).getElementsByTagName("td");if(0<i.length)for(var s=0;s<i.length;s++)WPTB_Cell(B,i[s])}}P.toggleTableEditMode=function(){var e=document.getElementsByClassName("wptb-edit-bar"),t=document.getElementById("wptb-cell_mode_background"),a=document.getElementById("wptb-left-scroll-panel-curtain"),n=document.getElementById("wptb-left-scroll-panel-cell-settings"),l=document.getElementsByClassName("wptb-preview-table");if(0<l.length&&(l=l[0]),0<e.length)for(var r=0;r<e.length;r++)if(e[r].classList.contains("visible")){document.select.deactivateMultipleSelectMode(),e[r].classList.remove("visible"),t.classList.remove("visible"),a.classList.remove("visible"),n.classList.remove("visible"),l.parentNode.classList.remove("wptb-preview-table-manage-cells");var o=l.getElementsByTagName("td");if(0<o.length)for(var i=0;i<o.length;i++)o[i].classList.remove("wptb-highlighted")}else document.select.activateMultipleSelectMode(),e[r].classList.add("visible"),t.classList.add("visible"),a.classList.add("visible"),l.parentNode.classList.add("wptb-preview-table-manage-cells")},P.recalculateIndexes=function(e){for(var t=this.getElementsByTagName("tr"),a=void 0,n=0,l=0,r=[],o=document.getElementById("wptb-top-row-as-header"),i=0;i<t.length;i++){0==i?(null==e&&(t[i].style.backgroundColor=jQuery("#wptb-table-header-bg").val()),o.checked?null==e&&(this.classList.add("wptb-table-preview-head"),t[i].classList.add("wptb-table-head")):null==e&&(this.classList.remove("wptb-table-preview-head"),t[i].classList.remove("wptb-table-head"))):(i%2==0?null==e&&(t[i].style.backgroundColor=jQuery("#wptb-odd-row-bg").val()):null==e&&(t[i].style.backgroundColor=jQuery("#wptb-even-row-bg").val()),t[i].classList.remove("wptb-table-head")),r[i],a=t[i].getElementsByTagName("td"),null==r[i]&&(r[i]=[]);for(var s=0,d=0;d<a.length;d++){if(null!=r[i][d])for(var c=0;c<100;c++){if(null==r[i][s]){r[i][s]=a[d],a[d].dataset.xIndex=s;break}s++}else r[i][d]=a[d],a[d].dataset.xIndex=s;if(a[d].dataset.yIndex=i,1<a[d].colSpan)for(var p=1;p<a[d].colSpan;p++)s++,r[i][s]="tdDummy";if(1<a[d].rowSpan)for(var m=1;m<a[d].rowSpan;m++){null==r[i+m]&&(r[i+m]=[]);for(var u=0;u<a[d].colSpan;u++)r[i+m][s-a[d].colSpan+1+u]="tdDummy"}s++,0==i&&(l=s)}n<d&&(n=d)}this.columns=n,this.maxCols=l},P.addColumnWidth=function(m,u){var e=P.getElementsByClassName("wptb-highlighted");if(0<e.length){for(var t=0;t<e.length;t++){var a=e[t].dataset.xIndex;a&&function e(t,a){for(var n=P.rows,l=!1,r=[],o=0;o<n.length;o++)for(var i=n[o].children,s=0;s<i.length;s++){var d=i[s];if(d.dataset.xIndex==t){if(m)if(d.colSpan==a){d.style.width=m+"px",d.removeAttribute("data-wptb-fixed-width"),l=!0;var c=document.getElementById("wptb-table-column-width-auto-fixed");c.checked||(c.checked=!0)}else d.style.width=null,d.dataset.wptbFixedWidth=m,o!=n.length-1||l||e(t,a+1);else if(u)d.style.width=null,d.removeAttribute("data-wptb-fixed-width");else if(d.dataset.wptbFixedWidth)d.colSpan==a&&(d.style.width=d.dataset.wptbFixedWidth+"px",d.removeAttribute("data-wptb-fixed-width"));else if(d.style.width){for(var p=0;p<r.length;p++)r[p].style.width=d.style.width;r=[]}else r.push(d);break}}}(a,1)}P.tdDefaultWidth()}},P.tdDefaultWidth=function(){for(var e,t=P.rows,a=0,n=0,l=document.getElementsByClassName("wptb-table-setup")[0].offsetWidth,r=[],o=[],i=0,s=0,d="",c=0;c<t.length;c++)for(var p=t[c].children,m=0;m<p.length;m++){var u=p[m];if(r[parseInt(u.dataset.xIndex)]||o[parseInt(u.dataset.xIndex)])o[parseInt(u.dataset.xIndex)]?u.dataset.wptbFixedWidth||(u.dataset.wptbCssTdAutoWidth=!0):r[parseInt(u.dataset.xIndex)]&&u.removeAttribute("data-wptb-css-td-auto-width");else if(u.style.width?(r[parseInt(u.dataset.xIndex)]=parseFloat(u.style.width),u.removeAttribute("data-wptb-css-td-auto-width")):u.dataset.wptbFixedWidth||(o[parseInt(u.dataset.xIndex)]=100,u.dataset.wptbCssTdAutoWidth=!0),window.getComputedStyle(u,null)){var b=window.getComputedStyle(u,null),g=b.getPropertyValue("padding-left"),w=b.getPropertyValue("padding-right");i=parseFloat(g,10)+parseFloat(w,10);var h=b.getPropertyValue("border-left-width"),v=b.getPropertyValue("border-right-width");s=parseFloat(h,10)+parseFloat(v,10),r[parseInt(u.dataset.xIndex)]?(r[parseInt(u.dataset.xIndex)]+=i,r[parseInt(u.dataset.xIndex)]+=s):(o[parseInt(u.dataset.xIndex)]+=i,o[parseInt(u.dataset.xIndex)]+=s)}}for(var y=0;y<r.length;y++)r[y]&&(a+=r[y]);for(var f=0,B=0;B<o.length;B++)o[B]&&(n+=o[B],f++);var S=window.getComputedStyle(P,null),T=S.getPropertyValue("border-left-width"),E=S.getPropertyValue("border-right-width"),C=parseFloat(T,10)+parseFloat(E,10);e=a+n+C,P.dataset.wptbTableTdsSumMaxWidth=e,f?(P.dataset.wptbCellsWidthAutoCount=f,P.mergingСellsHorizontally?P.dataset.wptbFixedWidthSize=a-C:P.removeAttribute("data-wptb-fixed-width-size")):(P.removeAttribute("data-wptb-fixed-width-size"),P.removeAttribute("data-wptb-cells-width-auto-count"));var N=!1,x=void 0;e<l?f?(P.style.minWidth="100%",P.mergingСellsHorizontally?(x=(x=(l-a-C)/f)-i-s,N=!(P.style.width=null)):P.style.width="100%"):(P.style.width=null,P.style.minWidth=null,P.style.maxWidth=e+"px"):(P.style.maxWidth=null,P.style.minWidth=e+"px",x="100",N=!(P.style.width=null));var _=document.head;if(_){var I=_.querySelector('style[data-wptb-td-auto-width="true"]');I&&_.removeChild(I)}N&&((d=document.createElement("style")).setAttribute("data-wptb-td-auto-width",!0),d.innerHTML="[data-wptb-css-td-auto-width=true]{width:"+x+"px}",_&&_.appendChild(d))},P.addRowHeight=function(m,u){var e=P.getElementsByClassName("wptb-highlighted");if(0<e.length)for(var t=0;t<e.length;t++){var a=e[t].dataset.yIndex;a&&function e(t,a){for(var n=P.rows,l=!1,r=[],o=0;o<n.length;o++)for(var i=n[o].children,s=0;s<i.length;s++){var d=i[s];if(d.dataset.yIndex==t)if(m){if(d.rowSpan==a){d.style.height=m+"px",d.removeAttribute("data-wptb-fixed-heidht"),l=!0;var c=document.getElementById("wptb-table-row-height-auto-fixed");c.checked||(c.checked=!0);continue}d.style.height=null,d.dataset.wptbFixedHeight=m,s!=i.length-1||l||e(t,a+1)}else if(u)d.style.height=null,d.removeAttribute("data-wptb-fixed-heidht");else if(d.dataset.wptbFixedHeight)(d.rowSpan=a)&&(d.style.height=d.dataset.wptbFixedHeight+"px",d.removeAttribute("data-wptb-fixed-width"));else if(d.style.height){for(var p=0;p<r.length;p++)r[p].style.height=d.style.height;r=[]}else r.push(d)}}(a,1)}},P.reconstraction=function(){var e=P.getElementsByTagName("td"),t=document.getElementsByClassName("wptb-adaptive-table-chose-block");0<t.length&&(t=t[0]),P.mergingСellsHorizontally=!1,P.mergingCellsVertically=!1,P.dataset.reconstraction=1,t.style.display="block";for(var a=0,n=0;n<e.length&&(1<e[n].colSpan&&(P.dataset.reconstraction=0,t.style.display="none",P.mergingСellsHorizontally=!0,a++),1<e[n].rowSpan&&(P.dataset.reconstraction=0,t.style.display="none",P.mergingCellsVertically=!0,a++),2!=a);n++);},P.addColumnEnd=function(){var e=void 0,t=document.getElementsByClassName("wptb-preview-table"),a=void 0,n=void 0;0<t.length&&(a=t[0].querySelector("td")),a&&(n=a.getAttribute("style"));for(var l=0;l<P.rows.length;l++)e=new WPTB_Cell(B),n&&(e.getDOMElement().setAttribute("style",n),e.getDOMElement().style.width=null),P.rows[l].appendChild(e.getDOMElement()),array[l].push(0);h++,P.recalculateIndexes(),P.tdDefaultWidth(),P.addRowHeight(),WPTB_Helper.dataTitleColumnSet(P),T(),(new WPTB_TableStateSaveManager).tableStateSet()},P.addColumnStart=function(){var e=void 0,t=void 0,a=document.getElementsByClassName("wptb-preview-table"),n=void 0,l=void 0;0<a.length&&(n=a[0].querySelector("td")),n&&(l=n.getAttribute("style"));for(var r=0;r<P.rows.length;r++)e=new WPTB_Cell(B),l&&(e.getDOMElement().setAttribute("style",l),e.getDOMElement().style.width=null),(t=P.rows[r].getElementsByTagName("td")[0])?P.rows[r].insertBefore(e.getDOMElement(),t):P.rows[r].appendChild(e.getDOMElement()),array[r].push(0);h++,P.recalculateIndexes(),P.tdDefaultWidth(),P.addRowHeight(),WPTB_Helper.dataTitleColumnSet(P),T(),(new WPTB_TableStateSaveManager).tableStateSet()},P.addColumnAfter=function(e){var t=P.rows,a=void 0,n=void 0,l=document.querySelector(".wptb-highlighted"),r=l.getAttribute("style"),o=null!=e&&"number"==typeof e?e:E(l)[1];if(h-o-l.colSpan+1==1)P.addColumnEnd();else{for(var i=!1,s=void 0,d=void 0,c=void 0,p=[],m=void 0,u=0;u<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++,S(array),P.recalculateIndexes(),P.addColumnWidth(),P.addRowHeight(),WPTB_Helper.dataTitleColumnSet(P),T(),(new WPTB_TableStateSaveManager).tableStateSet()}},P.addColumnBefore=function(){var e=document.querySelector(".wptb-highlighted"),t=E(e)[1];0===t?P.addColumnStart():P.addColumnAfter(t-1)},P.addRowToTheEnd=function(){var e,t=P.insertRow(-1),a=void 0,n=document.getElementsByClassName("wptb-preview-table"),l=void 0,r=void 0;t.classList.add("wptb-row"),0<n.length&&(l=n[0].querySelector("td")),l&&(r=l.getAttribute("style"));for(var o=0;o<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),S(array),P.recalculateIndexes(),P.addColumnWidth(),WPTB_Helper.dataTitleColumnSet(P),T(),(new WPTB_TableStateSaveManager).tableStateSet()},P.addRowToTheStart=function(){var e,t=P.insertRow(0),a=void 0,n=document.getElementsByClassName("wptb-preview-table"),l=void 0,r=void 0;t.classList.add("wptb-row"),0<n.length&&(l=n[0].querySelector("td")),l&&(r=l.getAttribute("style"));for(var o=0;o<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),S(array),P.recalculateIndexes(),P.addColumnWidth(),WPTB_Helper.dataTitleColumnSet(P),T(),(new WPTB_TableStateSaveManager).tableStateSet()},P.addRowBefore=function(){for(var e=document.querySelector(".wptb-highlighted"),t=e.getAttribute("style"),a=E(e)[0],n=void 0,l=a-1;0<=l;l--){var r=P.rows[l].children,o=r.length;if(0<o)for(var i=0;i<o;i++)if(1==r[i].rowSpan){a=l,n=!0;break}if(n)break}0===a?P.addRowToTheStart():P.addRowAfter(a,t)},P.addRowAfter=function(e,t){var a,n=void 0;if(null!=e&&"number"==typeof e||null!=t)n=e;else{var l=document.querySelector(".wptb-highlighted");t=l.getAttribute("style"),n=(e=E(l)[0])+l.rowSpan-1}var r=0;if(n<P.rows.length-1){for(var o=0;o<=n;o++){var i=P.rows[o].children,s=i.length;if(0<s)for(var d=0;d<s;d++){n<i[d].rowSpan-1+o&&i[d].rowSpan++}}var c=P.rows[n+1].children,p=c.length;if(0<p)for(var m=0;m<p;m++)r+=c[m].colSpan}else r=array[0].length;var u=P.insertRow(n+1);for(u.classList.add("wptb-row"),g=0;g<r;g++){var b=new WPTB_Cell(B);b.getDOMElement().setAttribute("style",t),b.getDOMElement().style.width=null,b.getDOMElement().style.height=null,u.appendChild(b.getDOMElement())}a=Array.from(array[0]),array.push(a),S(array),P.recalculateIndexes(),P.addColumnWidth(),WPTB_Helper.dataTitleColumnSet(P),T(),(new WPTB_TableStateSaveManager).tableStateSet()},P.isSquare=function(e){for(var t,a,n=-1,l=-1,r=-1,o=-1,i=0,s=0;s<e.length;s++)for(var d=0;d<e[s].length;d++)1==e[s][d]&&((d<l||-1==l)&&(l=d),(s<n||-1==n)&&(n=s));for(s=e.length-1;-1<s;s--)for(d=e[s].length-1;-1<d;d--)1==e[s][d]&&(o<d&&(o=d),r<s&&(r=s));for(s=n;s<r;s++)for(d=l;d<o;d++)if(0==e[s][d]||null==e[s][d])return!1;for(s=0;s<e.length;s++)for(d=0;d<e[s].length;d++)1==e[s][d]&&i++;return(t=r-n+1)*(a=o-l+1)===i&&[t,a]},P.mergeCells=function(){for(var e=P.isSquare(array),t=e[0],a=e[1],n=document.querySelector(".wptb-highlighted"),l=[].slice.call(document.getElementsByClassName("wptb-highlighted"),1),r=[],o=0;o<l.length;o++){var i=l[o].getElementsByClassName("wptb-ph-element");if(0<i.length)for(var s=i.length,d=0;d<s;d++)r.push(i[d]);l[o].parentNode.removeChild(l[o])}if(0<r.length)for(var c=0;c<r.length;c++)n.appendChild(r[c]);n.colSpan=a,n.rowSpan=t,P.recalculateIndexes(),P.reconstraction();var p=n.style.width,m=n.dataset.wptbFixedWidth;p?P.addColumnWidth(parseFloat(p,10)):m?P.addColumnWidth():P.addColumnWidth(!1,!0);var u=n.style.height,b=n.dataset.wptbFixedHeight;u?P.addRowHeight(parseFloat(u,10)):b?P.addRowHeight():P.addRowHeight(!1,!0),WPTB_Helper.dataTitleColumnSet(P),T(),(new WPTB_TableStateSaveManager).tableStateSet()},P.splitCell=function(){var e=document.getElementsByClassName("wptb-highlighted")[0],t=e.rowSpan,a=e.colSpan,n=e.getAttribute("style"),l=E(e)[0],r=P.rows[l],o=e.dataset.xIndex;e.rowSpan=1;for(var i=e.colSpan=1;i<a;i++){var s=new WPTB_Cell(B);s.getDOMElement().setAttribute("style",n),s.getDOMElement().classList.add("wptb-highlighted"),e.nextSibling?r.insertBefore(s.getDOMElement(),e.nextSibling):r.appendChild(s.getDOMElement())}if(1<t)for(var d=1;d<t;d++){var c=void 0,p=P.rows[l+d],m=p.children,u=m.length;if(0<u)for(var b=0;b<u;b++)if(Number(m[b].dataset.xIndex)>Number(o)){c=m[b];break}for(var g=0;g<a;g++){var w=new WPTB_Cell(B);w.getDOMElement().setAttribute("style",n),null!=c?p.insertBefore(w.getDOMElement(),c):p.appendChild(w.getDOMElement())}}P.recalculateIndexes(),P.reconstraction(),P.addColumnWidth(),P.addRowHeight(),WPTB_Helper.dataTitleColumnSet(P),T(),(new WPTB_TableStateSaveManager).tableStateSet()},P.findRowspannedCells=function(e){var t,a=[];if(actualPoints=function(e){for(var t=P.rows[e].getElementsByTagName("td"),a=0,n=0;n<t.length;n++)a+=t[n].colSpan;return a}(e),actualPoints===h)return[];t=h-actualPoints;for(var n=e-1;0<=n&&t;n--){var l=P.rows[n].getElementsByTagName("td");for(n=0;n<l.length;n++)1<l[n].rowSpan&&(a.push(l[n]),t-=l[n].colSpan)}return a},P.addLackingCells=function(){for(var e=[],t=0;t<P.rows.length;t++)e.push(0);for(t=0;t<P.rows.length;t++)for(var a=P.rows[t].getElementsByTagName("td"),n=0;n<a.length;n++)if(1<a[n].rowSpan)for(var l=1;l<a[n].rowSpan;l++)e[t+l]++;for(t=0;t<P.rows.length;t++){a=P.rows[t].getElementsByTagName("td");var r=0;for(n=0;n<a.length;n++)r+=a[n].colSpan;r+=e[t],difference=h-r;for(n=0;n<difference;n++){var o=new WPTB_Cell(B);P.rows[t].appendChild(o.getDOMElement())}}},P.deleteRow=function(){var e=document.querySelector(".wptb-highlighted"),t=e.getAttribute("style"),a=e.rowSpan,n=E(e)[0],l=void 0;null==a&&(a=1);for(var r=0;r<a;r++){var o=P.rows[n].children,i=P.rows[n+1],s=void 0,d=void 0,c=[];if(null!=i){d=(s=i.children).length;for(var p=0;p<o.length;p++)if(1<o[p].rowSpan){var m=new WPTB_Cell(B);m.getDOMElement().setAttribute("style",t),m.getDOMElement().colSpan=o[p].colSpan,m.getDOMElement().rowSpan=o[p].rowSpan-1;for(var u=void 0,b=0;b<d;b++)if(Number(s[b].dataset.xIndex)>Number(o[p].dataset.xIndex)){u=s[b];break}u?c.push([m,u]):c.push([m])}if(0<c.length)for(var g=0;g<c.length;g++)null!=c[g][1]?i.insertBefore(c[g][0].getDOMElement(),c[g][1]):i.appendChild(c[g][0].getDOMElement())}var w=P.rows;if(0<w.length)for(var h=0;h<n;h++){var v=w[h].children;if(0<v.length)for(var y=0;y<v.length;y++)v[y].rowSpan-1>=n-h&&v[y].rowSpan--}l=Array.from(array[0]),array.pop(l),S(array),P.getElementsByTagName("tbody")[0].removeChild(P.rows[n]),0==P.rows.length&&(P.toggleTableEditMode(),f.innerHTML="",WPTB_Helper.settingsPanelClear(),document.getElementsByClassName("wptb-table-generator")[0].style.display="table"),P.recalculateIndexes(),WPTB_Helper.dataTitleColumnSet(P)}T(),(new WPTB_TableStateSaveManager).tableStateSet()},P.deleteColumn=function(){for(var e=document.querySelector(".wptb-highlighted"),t=e.dataset.xIndex,a=e.colSpan,n=0;n<a;n++){for(var l=0;l<P.rows.length;l++){var r=P.rows[l].children,o=r.length;if(0<o)for(var i=o-1;0<=i;i--){if(Number(r[i].dataset.xIndex)==Number(t)){1<r[i].colSpan?r[i].colSpan--:P.rows[l].removeChild(r[i]);break}if(Number(r[i].dataset.xIndex)<Number(t)&&Number(r[i].dataset.xIndex)+Number(r[i].colSpan-1)>=t){1<r[i].colSpan&&r[i].colSpan--;break}}}for(var s=0;s<P.rows.length;s++)null!=array[s]&&array[s].pop();h--,0==P.querySelectorAll("td").length&&(P.toggleTableEditMode(),f.innerHTML="",WPTB_Helper.settingsPanelClear(),document.getElementsByClassName("wptb-table-generator")[0].style.display="table"),P.recalculateIndexes(),P.tdDefaultWidth(),WPTB_Helper.dataTitleColumnSet(P)}T(),(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementsByClassName("wptb-table-generator")[0].style.display="none",array=function(){for(var e=[],t=[],a=0;a<P.rows.length;a++){for(var n=P.rows[a].getElementsByTagName("td"),l=0,r=0;r<n.length;r++)l+=n[r].colSpan;e.push(l)}h=Math.max.apply(null,e);var o=P.rows.length;for(a=0;a<o;a++)for(t[a]=[],r=0;r<h;r++)t[a].push(0);return S(t),t}(),T(),S(array),f.appendChild(P),P.recalculateIndexes(!0),P.reconstraction(),P.tdDefaultWidth(),f.onresize=function(){P.tdDefaultWidth()},WPTB_LeftPanel()},WPTB_TableStateSaveManager=function(){this.tableStateSet=function(){var e=document.getElementsByClassName("wptb-preview-table");if(0<e.length){e=e[0],window.wptbTableStateSaving||(window.wptbTableStateSaving=[]),window.wptbTableStateSaving.length>window.wptbTableStateNumberShow+1&&(window.wptbTableStateSaving=window.wptbTableStateSaving.slice(0,window.wptbTableStateNumberShow+1));for(var t=e.cloneNode(!0),a=t.getElementsByClassName("wptb-highlighted"),n=0;n<a.length;n++)a[n].classList.remove("wptb-highlighted");for(var l=t.getElementsByClassName("wptb-directlyhovered"),r=0;r<l.length;r++)l[r].classList.remove("wptb-directlyhovered");var o="",i=document.head;if(i){var s=i.querySelector('style[data-wptb-td-auto-width="true"]');s&&(o=s.innerHTML)}var d=t.querySelectorAll(".mce-content-body");if(0<d.length)for(var c=0;c<d.length;c++)d[c].classList.remove("mce-content-body");var p=t.querySelectorAll("[data-mce-style]");if(0<p.length)for(var m=0;m<p.length;m++)p[m].removeAttribute("data-mce-style");var u=t.querySelectorAll("[id^=mce_]");if(0<u.length)for(var b=0;b<u.length;b++)u[b].removeAttribute("id");if(window.wptbTableStateSaving.push([t,o]),window.wptbTableStateNumberShow=window.wptbTableStateSaving.length-1,1<window.wptbTableStateSaving.length){var g=document.getElementsByClassName("wptb-undo");0<g.length&&(g=g[0]).classList.remove("wptb-undoredo-disabled")}var w=document.getElementsByClassName("wptb-redo");0<w.length&&(w=w[0]).classList.add("wptb-undoredo-disabled");var h=document.getElementsByClassName("wptb-save-btn");0<h.length&&(!(h=h[0]).dataset.wptbTableStateNumberSave&&0==window.wptbTableStateNumberShow||window.wptbTableStateNumberShow==h.dataset.wptbTableStateNumberSave?h.classList.add("wptb-save-disabled"):h.classList.remove("wptb-save-disabled"))}},this.tableStateGet=function(e){if(e&&window.wptbTableStateSaving&&1<window.wptbTableStateSaving.length){if("undo"==e){if(!(0<window.wptbTableStateNumberShow))return!1;window.wptbTableStateNumberShow--}else if("redo"==e){if(!(window.wptbTableStateNumberShow<window.wptbTableStateSaving.length-1))return!1;window.wptbTableStateNumberShow++}var t=document.getElementsByClassName("wptb-undo");0<t.length&&(t=t[0]),0==window.wptbTableStateNumberShow?t&&t.classList.add("wptb-undoredo-disabled"):0<window.wptbTableStateNumberShow&&t&&t.classList.remove("wptb-undoredo-disabled");var a=document.getElementsByClassName("wptb-redo");0<a.length&&(a=a[0]),window.wptbTableStateNumberShow==window.wptbTableStateSaving.length-1?a&&a.classList.add("wptb-undoredo-disabled"):window.wptbTableStateNumberShow<window.wptbTableStateSaving.length-1&&a&&a.classList.remove("wptb-undoredo-disabled");var n=document.getElementsByClassName("wptb-save-btn");0<n.length&&(!(n=n[0]).dataset.wptbTableStateNumberSave&&0==window.wptbTableStateNumberShow||window.wptbTableStateNumberShow==n.dataset.wptbTableStateNumberSave?n.classList.add("wptb-save-disabled"):n.classList.remove("wptb-save-disabled"));var l=document.getElementsByClassName("wptb-table-setup");if(0<l.length){if((l=l[0]).innerHTML="",l.appendChild(window.wptbTableStateSaving[window.wptbTableStateNumberShow][0]),window.wptbTableStateSaving[window.wptbTableStateNumberShow][1]){var r=document.createElement("style");r.setAttribute("data-wptb-td-auto-width",!0),r.innerHTML=window.wptbTableStateSaving[window.wptbTableStateNumberShow][1];var o=document.head;if(o){var i=o.querySelector('style[data-wptb-td-auto-width="true"]');i&&o.removeChild(i),o.appendChild(r)}}WPTB_Helper.settingsPanelClear(),WPTB_Helper.elementOptionsPanelClear(),WPTB_LeftPanel();var s=document.getElementById("wptb-left-scroll-panel-cell-settings");s&&s.classList.remove("visible")}}}};function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,a=Array(e.length);t<e.length;t++)a[t]=e[t];return a}return Array.from(e)}var WPTB_Text=function(e,t){var a=document.createElement("div"),n=document.createElement("div"),l=document.createElement("p"),r=void 0,o=!1;if(a.classList.add("wptb-text-container"),l.innerHTML=null!=e?e:"Text",n.appendChild(l),a.appendChild(n),t){var i=t.className.match(/wptb-element-((.+-)\d+)/i);i&&Array.isArray(i)&&(r=i[1],o=!0);for(var s=[].concat(_toConsumableArray(t.attributes)),d=0;d<s.length;d++)a.setAttribute(s[d].name,s[d].value)}return this.kind="text",this.getDOMElement=function(){return a},applyGenericItemSettings(this,r,o),this},WPTB_innerElementSet=function 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,a=void 0;if(e.preventDefault(),e.stopPropagation(),e.dataTransfer.getData("wptbElement")||e.dataTransfer.getData("node")){var n,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]),t=e.dataTransfer.getData("wptbElement")?(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"),document.getElementsByClassName(a)[0]),"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)}if(l.style.display="none",r.style.display="none",p(t),!t.classList.contains("wptb-image-container")||t.classList.contains("wptb-moving-mode"))t.classList.remove("wptb-moving-mode"),(new WPTB_TableStateSaveManager).tableStateSet();return!0}}},t.onmouseover=function(e){t.classList.remove("wptb-ondragenter")}},applyGenericItemSettings=function(r,e){var t,o,a=2<arguments.length&&void 0!==arguments[2]&&arguments[2],i=r.getDOMElement();if(null==e||1==a){t=document.counter.nextIndex(r.kind);for(var n=document.getElementsByClassName("wptb-ph-element"),l=[],s=0;s<n.length;s++){var d=new RegExp("wptb-element-"+r.kind+"-(\\d+)","i"),c=n[s].className.match(d);c&&l.push(c[1])}if(0<l.length)t=Math.max.apply(Math,l)+1;else t=1}else e&&!a&&(t=e.split("-")[1]);i.onmouseenter=function(e){if(!e.target.classList.contains("wptb-moving-mode")){var t=new WPTB_ActionsField;if(t.addActionField(1,i),t.setParameters(i),i.classList.remove("wptb-ondragenter"),"button"===r.kind){var a=i.querySelector("a"),n=a.querySelector("div");a.onclick=function(e){e.preventDefault()},WPTB_Helper.buttonsTinyMceInit(n)}else if("text"===r.kind)tinyMCE.init({target:i.childNodes[0],inline:!0,plugins:"link, paste",dialog_type:"modal",theme:"modern",menubar:!1,fixed_toolbar_container:"#wpcd_fixed_toolbar",paste_as_text:!0,toolbar:"bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify",setup:function(e){e.on("change",function(e){var t=WPTB_Helper.findAncestor(i,"wptb-row");if(t.classList.contains("wptb-table-head")){var a=WPTB_Helper.findAncestor(t,"wptb-preview-table");WPTB_Helper.dataTitleColumnSet(a)}}),e.on("keydown",function(e){var t=new WPTB_ActionsField;t.addActionField(1,i),t.setParameters(i)}),e.on("keyup",function(e){var t=new WPTB_ActionsField;t.addActionField(1,i),t.setParameters(i),e.target.onblur=function(){(new WPTB_TableStateSaveManager).tableStateSet()}})},init_instance_callback:function(e){(window.currentEditor=e).on("focus",function(e){var t=document.getElementsByClassName("wptb-builder-panel")[0].offsetWidth;window.currentEditor&&55<=document.getElementById("wptb_builder").scrollTop&&"none"!=window.currentEditor.bodyElement.style.display?(document.getElementById("wpcd_fixed_toolbar").style.position="fixed",document.getElementById("wpcd_fixed_toolbar").style.right=t/2-document.getElementById("wpcd_fixed_toolbar").offsetWidth/2+"px",document.getElementById("wpcd_fixed_toolbar").style.top="100px"):(document.getElementById("wpcd_fixed_toolbar").style.position="static",delete document.getElementById("wpcd_fixed_toolbar").style.right,delete document.getElementById("wpcd_fixed_toolbar").style.top)})}});else{o=i.getElementsByClassName("wptb-list-item-content");for(var l=0;l<o.length;l++)WPTB_Helper.listItemsTinyMceInit(o[l])}}},i.onmouseleave=function(e){var t=new WPTB_ActionsField;t.wptbActions&&"1"!=t.wptbActions.type||t.leaveFromField(e,i,1)};var 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)};
1
+ var WPTB_ActionsField=function p(){var m=this;this.wptbActions,0!=document.getElementsByClassName("wptb-actions").length&&(this.wptbActions=document.getElementsByClassName("wptb-actions")[0]),this.addActionField=function(e,i){var t=document.getElementsByTagName("body")[0],a=document.getElementsByClassName("wptb-actions");if(0!=a.length){var n=a[0].activeElem;for(n&&n.classList.remove("wptb-directlyhovered");0!=a.length;)a[0].parentNode.removeChild(a[0])}if(1==e){var l=void 0,r=void 0,o=void 0;l=document.createElement("span"),r=document.createElement("span"),o=document.createElement("span"),(a=document.createElement("div")).classList.add("wptb-actions"),l.classList.add("dashicons","dashicons-trash","wptb-delete-action"),r.classList.add("dashicons","dashicons-admin-page","wptb-duplicate-action"),o.classList.add("dashicons","dashicons-move","wptb-move-action"),o.draggable=!0,a.appendChild(o),a.appendChild(r),a.appendChild(l),t.appendChild(a),a.activeElem=i,a.type=1,l.onclick=function(e){var t=e.target.parentNode.activeElem,a=t.parentNode;if(a.removeChild(t),"text"==t.kind){var n=a.parentNode;if(n.classList.contains("wptb-table-head")){var l=WPTB_Helper.findAncestor(n,"wptb-preview-table");WPTB_Helper.dataTitleColumnSet(l)}}(new p).actionsRemove(),(new WPTB_TableStateSaveManager).tableStateSet()},r.onclick=function(e){var t=void 0,a=void 0,n=e.target.parentNode.activeElem,l=n.cloneNode(!0);l.classList.remove("wptb-directlyhovered"),a=n.className.match(/wptb-element-(.+)-(\d+)/i)[1];var r=n.parentNode;if("list"==a){for(var o=[],i=n.querySelectorAll("ul li .wptb-list-item-content"),s=0;s<i.length;s++)o.push(i[s].innerHTML);t=new WPTB_List(o,l),r.insertBefore(t.getDOMElement(),n.nextSibling)}else if("text"==a)t=new WPTB_Text(l.childNodes[0].innerHTML,l),r.insertBefore(t.getDOMElement(),n.nextSibling);else if("image"==a)t=new WPTB_Image("",n),r.insertBefore(t.getDOMElement(),n.nextSibling);else if("button"==a){var d=l.childNodes[0].querySelector("p").innerHTML;t=new WPTB_Button(d,l),r.insertBefore(t.getDOMElement(),n.nextSibling)}else(a="star_rating")&&(t=new WPTB_StarRating(l),r.insertBefore(t.getDOMElement(),n.nextSibling));WPTB_innerElementSet(t.getDOMElement()),new p(1,n).setParameters(n),(new WPTB_TableStateSaveManager).tableStateSet()},o.ondragstart=function(e){var t,a,n=WPTB_Helper.dragImagesArr(),l=e.target.parentNode.activeElem;a=(t=l.className.match(/wptb-element-(.+)-(\d+)/i))[1],l.classList.add("wptb-moving-mode"),e.dataTransfer.effectAllowed="move",e.dataTransfer.setDragImage(n[a],0,0),e.dataTransfer.setData("node","wptb-element-"+t[1]+"-"+t[2]),e.dataTransfer.setData("wptb-moving-mode","wptb-element-"+t[1]+"-"+t[2]),e.dataTransfer.setData("wptbElIndic-"+t[1],"wptbElIndic-"+t[1]);var r=e.target.parentNode.activeElem;if("text"==r.kind){var o=r.parentNode.parentNode;if(o.classList.contains("wptb-table-head")){var i=WPTB_Helper.findAncestor(o,"wptb-preview-table");WPTB_Helper.dataTitleColumnSet(i)}}m.actionsHide()},a.style.display="block",m.wptbActions=a}else if(2==e){var s=void 0,d=void 0;s=document.createElement("span"),d=document.createElement("span"),(a=document.createElement("span")).classList.add("wptb-actions"),s.classList.add("dashicons","dashicons-trash","wptb-delete-action"),d.classList.add("dashicons","dashicons-admin-page","wptb-duplicate-action"),a.append(d,s),t.appendChild(a),a.activeElem=i;var c=WPTB_Helper.findAncestor(i,"wptb-directlyhovered");c&&c.classList.remove("wptb-directlyhovered"),a.type=2,s.onclick=function(e){var t=e.target.parentNode.activeElem,a=t.parentNode;new p(4).actionsRemove(),a.removeChild(t),WPTB_Helper.listItemsRecalculateIndex(a),(new WPTB_TableStateSaveManager).tableStateSet()},d.onclick=function(e){var t=i.getBoundingClientRect(),a=t.top,n=e.target.parentNode.activeElem,l=n.querySelector(".wptb-list-item-content").innerHTML,r=new WPTB_ListItem(l,n,!0);n.parentNode.insertBefore(r.getDOMElement(),i.nextSibling),WPTB_Helper.listItemsTinyMceInit(r.getDOMElement().firstChild);var o=i.getElementsByClassName("wptb-list-item-content");(0<o.length&&(o=o[0]),setTimeout(function(){o.innerHTML=l,WPTB_Helper.listItemsRecalculateIndex(n.parentNode)},5),a!=(t=i.getBoundingClientRect()).top)&&new p(2,i).setParameters(i);(new WPTB_TableStateSaveManager).tableStateSet()},a.style.display="block",m.wptbActions=a}},this.setParameters=function(t){if(!m.wptbActions){var e=document.getElementsByClassName("wptb-actions");0<e.length&&(m.wptbActions=e[0])}m.wptbActions&&(m.wptbActions.style.display="block");var a=t.getBoundingClientRect(),n=document.getElementsByClassName("wptb-container")[0],l=function(){var e=t.getBoundingClientRect();m.wptbActions.style.top=parseFloat(e.top)-15+"px"};n.removeEventListener("scroll",l,!1),m.wptbActions.style.top=parseFloat(a.top)-15+"px",m.wptbActions.style.left=parseFloat(a.right)-parseFloat(m.wptbActions.clientWidth)+1+"px",m.wptbActions.style.display="block",t.classList.add("wptb-directlyhovered"),n.addEventListener("scroll",l,!1)},this.leaveFromField=function(e,t,a){if(e.relatedTarget&&(e.relatedTarget.classList.contains("wptb-actions")||e.relatedTarget.classList.contains("wptb-move-action")||e.relatedTarget.classList.contains("wptb-duplicate-action")||e.relatedTarget.classList.contains("wptb-delete-action")))return m.wptbActions||(m.wptbActions=document.getElementsByClassName("wptb-actions")[0]),void(m.wptbActions.onmouseleave=function(e){if(null!=e.relatedTarget&&e.relatedTarget!=m.wptbActions.activeElem&&WPTB_Helper.findAncestor(e.relatedTarget,"wptb-directlyhovered")!=m.wptbActions.activeElem&&(e.target.activeElem.classList.remove("wptb-directlyhovered"),m.wptbActions.style.display="none",2==m.wptbActions.type)){var t=new p;t.addActionField(1,e.relatedTarget.parentNode.parentNode),t.setParameters(e.relatedTarget.parentNode.parentNode)}});t.classList.remove("wptb-directlyhovered"),m.wptbActions.style.display="none",2==m.wptbActions.type&&e.relatedTarget&&"ul"==e.relatedTarget.localName&&(m.addActionField(1,e.relatedTarget.parentNode),m.setParameters(e.relatedTarget.parentNode))},this.actionsRemove=function(){if(!m.wptbActions){var e=document.getElementsByClassName("wptb-actions");0<e.length&&(m.wptbActions=e[0])}m.wptbActions&&m.wptbActions.parentNode.removeChild(m.wptbActions)},this.actionsHide=function(){if(!m.wptbActions){var e=document.getElementsByClassName("wptb-actions");0<e.length&&(m.wptbActions=e[0])}m.wptbActions&&(m.wptbActions.style.opacity=0)}};function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,a=Array(e.length);t<e.length;t++)a[t]=e[t];return a}return Array.from(e)}document.addEventListener("DOMContentLoaded",function(){var e=WPTB_Helper.detectMode();if(e){var a=new XMLHttpRequest,t=ajaxurl+"?action=get_table&id="+e;a.open("GET",t,!0),a.setRequestHeader("Content-type","application/x-www-form-urlencoded"),a.onreadystatechange=function(e){if(4!=this.readyState||200!=this.status);else{var t=JSON.parse(a.responseText);document.getElementById("wptb-setup-name").value=t[0],t[1]?(document.getElementsByClassName("wptb-table-generator")[0].style.display="none",document.getElementsByClassName("wptb-table-setup")[0].appendChild(WPTB_Parser(t[1])),WPTB_Table(),WPTB_LeftPanel(),WPTB_Settings(),(new WPTB_TableStateSaveManager).tableStateSet()):document.getElementsByClassName("wptb-table-generator")[0].style.display="table"}},a.send(null)}else document.getElementsByClassName("wptb-table-generator")[0].style.display="table";document.counter=new ElementCounters,document.select=new MultipleSelect,WPTB_Initializer(),settings=WPTB_Settings()});var WPTB_Button=function(e,t){var a=document.createElement("div"),n=document.createElement("div"),l=document.createElement("a"),r=document.createElement("div"),o=document.createElement("p"),i=void 0,s=!1;if(a.classList.add("wptb-button-container","wptb-size-M","wptb-"),n.classList.add("wptb-button-wrapper"),r.classList.add("wptb-button"),o.innerHTML=null!=e?e:"Button Text",t){var d=t.className.match(/wptb-element-((.+-)\d+)/i);d&&Array.isArray(d)&&(i=d[1],s=!0);var c=[].concat(_toConsumableArray(t.attributes));if(0<c.length)for(var p=0;p<c.length;p++)a.setAttribute(c[p].name,c[p].value);var m=t.querySelector(".wptb-button-wrapper");if(m){var u=[].concat(_toConsumableArray(m.attributes));if(0<u.length)for(var b=0;b<u.length;b++)"style"==u[b].name&&n.setAttribute(u[b].name,u[b].value)}var g=t.querySelector("a");if(g)if(0<(v=[].concat(_toConsumableArray(g.attributes))).length)for(var w=0;w<v.length;w++)"style"!=v[w].name&&"href"!=v[w].name&&"target"!=v[w].name||l.setAttribute(v[w].name,v[w].value);var v,h=t.querySelector(".wptb-button");if(h)if(0<(v=[].concat(_toConsumableArray(h.attributes))).length)for(var y=0;y<v.length;y++)"style"==v[y].name&&r.setAttribute(v[y].name,v[y].value)}return n.appendChild(l),l.appendChild(r),r.appendChild(o),a.appendChild(n),this.kind="button",this.getDOMElement=function(){return a},applyGenericItemSettings(this,i,s),this},WPTB_Cell=function(e,i){if(!i){(i=document.createElement("td")).style.padding=jQuery("#wptb-table-padding-number").val()+"px";var t=jQuery("#wptb-table-inner-border-number").val();""!=t&&0!=parseInt(t)&&(i.style.border=t+"px solid "+jQuery("#wptb-table-border-color").val()),i.classList.add("wptb-droppable","wptb-cell")}i.draggable=!1,e&&(i.onclick=e),WPTB_innerElementSet(i);var s=i.getElementsByClassName("wptb-ph-element");if(0<s.length)for(var a=function(e){var t=i.getElementsByClassName("wptb-space-between");if(0<t.length)for(var a=0;a<t.length;a++)WPTB_Space(t[a]);s[e].getDOMElement=function(){return s[e]},WPTB_innerElementSet(s[e]);var n=s[e].className.match(/wptb-element-((.+-)\d+)/i);if(n&&Array.isArray(n)){var l=n[1].split("-");if(s[e].kind=l[0],applyGenericItemSettings(s[e],n[1]),"list"==s[e].kind){var r=s[e].getElementsByTagName("li");if(0<r.length)for(var o=0;o<r.length;o++)WPTB_ListItem(void 0,r[o])}}},n=0;n<s.length;n++)a(n);return this.getDOMElement=function(){return i},this.setCoords=function(e,t){var a=this.getDOMElement();a.dataset.yIndex=e,a.dataset.xIndex=t},this.getCoords=function(){var e,t=this.getDOMElement();return e.x=t.dataset.xIndex,e.y=t.dataset.yIndex,e},this.appendElement=function(e){getDOMElement().appendChild(e)},i.getCellDimensions=function(){var e=window.getComputedStyle(this,null),t=e.getPropertyValue("padding-left"),a=e.getPropertyValue("padding-right"),n=e.getPropertyValue("border-left-width"),l=e.getPropertyValue("border-right-width"),r=e.getPropertyValue("padding-top"),o=e.getPropertyValue("padding-bottom"),i=e.getPropertyValue("border-top-width"),s=e.getPropertyValue("border-bottom-width");return{width:parseFloat(this.offsetWidth,10)-parseFloat(t,10)-parseFloat(a,10)-parseFloat(n,10)-parseFloat(l,10),height:parseFloat(this.offsetHeight,10)-parseFloat(r,10)-parseFloat(o,10)-parseFloat(i,10)-parseFloat(s,10)}},this},WPTB_DropHandle=function(i,e){var s=void 0,d=void 0;if(0==document.getElementsByClassName("wptb-drop-handle").length){(s=document.createElement("div")).classList.add("wptb-drop-handle"),(d=document.createElement("div")).classList.add("wptb-drop-border-marker");var t=document.createElement("div"),a=document.createElement("div"),n=document.createElement("div"),l=document.createElement("div");t.classList.add("wptb-drop-border-marker-top"),a.classList.add("wptb-drop-border-marker-right"),n.classList.add("wptb-drop-border-marker-bottom"),l.classList.add("wptb-drop-border-marker-left"),d.appendChild(t),d.appendChild(a),d.appendChild(n),d.appendChild(l);var r=document.getElementsByTagName("body");0<r.length&&(r[0].appendChild(s),r[0].appendChild(d)),s.ondragenter=function(){},s.ondragover=function(e){e.preventDefault()},s.ondragleave=function(){},s.ondrop=function(e){e.preventDefault();var t=void 0;e.dataTransfer.getData("wptbElement")?t=(t=WPTB_Helper.newElementProxy(e.dataTransfer.getData("wptbElement"))).getDOMElement():((t=document.getElementsByClassName(e.dataTransfer.getData("node"))[0]).classList.remove("wptb-moving-mode"),t.classList.remove("wptb-moving-into-same-elem"),t.wptbMovingMode=1);var a=void 0;if("Drop Here"==s.dataset.text)"td"==(i=s.getDOMParentElement()).nodeName.toLowerCase()&&(a=s.getDOMParentElement()).appendChild(t);else{var n=s.getDOMParentElement();if(a=n.parentNode,"Above Element"==s.dataset.text)a.insertBefore(t,n);else if("Below Element"==s.dataset.text){var l=n.nextSibling;a.insertBefore(t,l)}}var r=a.parentNode;if(r.classList.contains("wptb-table-head")){var o=WPTB_Helper.findAncestor(r,"wptb-preview-table");WPTB_Helper.dataTitleColumnSet(o)}(s.style.display="none",d.style.display="none",WPTB_innerElementSet(t),console.log(t),t.classList.contains("wptb-image-container")&&1!=t.wptbMovingMode)||((new WPTB_TableStateSaveManager).tableStateSet(),t.wptbMovingMode)},document.querySelector(".wptb-container").onscroll=function(){s.style.display="none",d.style.display="none"}}else s=document.getElementsByClassName("wptb-drop-handle")[0],d=document.getElementsByClassName("wptb-drop-border-marker")[0];if(!i||"td"!=i.nodeName.toLowerCase()||0==i.getElementsByClassName("wptb-ph-element").length){var o=void 0;if("td"==i.localName?o=i.parentNode:"div"==i.localName&&i.classList.contains("wptb-ph-element")&&(o=i.parentNode.parentNode),o.classList.contains("wptb-table-head")){for(var c=e.dataTransfer.types,p=!1,m=0;m<c.length;m++){var u=c[m].match(/wptbelindic-([a-z]+)/i);if(u&&"text"!=u[1]){p=!0;break}}if(p)return}s.style.width=i.offsetWidth+"px";var b=i.offsetHeight,g=i.getBoundingClientRect(),w=parseFloat(g.left),v=void 0;if(s.style.left=w+"px",-1!=e.dataTransfer.types.indexOf("wptb-moving-mode")){var h=document.getElementsByClassName("wptb-moving-mode")[0];i==h?(s.classList.add("wptb-moving-into-same-elem"),d.classList.add("wptb-moving-into-same-elem")):(s.classList.remove("wptb-moving-into-same-elem"),d.classList.remove("wptb-moving-into-same-elem"))}if(s.getDOMParentElement=function(){return i},s.style.display="block",d.style.display="block","td"!=i.nodeName.toLowerCase()){var y=null==e.offsetY?e.layerY:e.offsetY;v=parseFloat(g.top)-parseFloat(11),s.dataset.text="Above Element",b/2<y&&(v=parseFloat(g.top)+b-1,s.dataset.text="Below Element")}else s.dataset.text="Drop Here",v=parseFloat(g.top)+b/2-5;s.style.top=v+"px",d.style.top=g.top+"px",d.style.left=g.left+"px",wptbDropBorderMarkerTop=d.querySelector(".wptb-drop-border-marker-top"),wptbDropBorderMarkerTop.style.width=parseFloat(i.offsetWidth)-parseFloat(1)+"px",wptbDropBorderMarkerRight=d.querySelector(".wptb-drop-border-marker-right"),wptbDropBorderMarkerRight.style.height=parseFloat(g.bottom)-parseFloat(g.top)-1+"px",wptbDropBorderMarkerRight.style.left=wptbDropBorderMarkerTop.style.width,wptbDropBorderMarkerBottom=d.querySelector(".wptb-drop-border-marker-bottom"),wptbDropBorderMarkerBottom.style.width=wptbDropBorderMarkerTop.style.width,wptbDropBorderMarkerBottom.style.top=wptbDropBorderMarkerRight.style.height,wptbDropBorderMarkerLeft=d.querySelector(".wptb-drop-border-marker-left"),wptbDropBorderMarkerLeft.style.height=wptbDropBorderMarkerRight.style.height}},ElementCounters=function(){var t=[];return t.text=0,t.image=0,t.list=0,t.button=0,this.increment=function(e){e in t&&t[e]++},this.nextIndex=function(e){if(e in t)return t[e]+1},this},WPTB_ElementOptions=function(e,t,a){var n,l=e.getDOMElement();prop=document.querySelector(".wptb-"+e.kind+"-options-prototype").cloneNode(!0),prop.classList.remove("wptb-"+e.kind+"-options-prototype"),n="wptb-options-"+e.kind+"-"+t;for(var r=prop.getElementsByClassName("wptb-element-property"),o=0;o<r.length;o++)r[o].dataset.element=n;if(prop.classList.add(n),document.getElementById("element-options-group").appendChild(prop),a)if("button"==e.kind){var i=document.getElementsByClassName("wptb-element-"+a)[0],s=void 0,d=void 0,c=void 0,p=void 0;if(i&&(p=i.className.match(/wptb-size-([a-z]+)/i)),p&&Array.isArray(p)){var m=prop.getElementsByClassName("wptb-btn-size-btn");for(o=0;o<m.length;o++)m[o].classList.remove("selected"),m[o].innerHTML==p[1]&&m[o].classList.add("selected")}if(i&&(s=i.getElementsByClassName("wptb-button-wrapper"),d=i.getElementsByTagName("a"),c=i.getElementsByClassName("wptb-button")),s){var u=s[0].style.justifyContent,b=prop.querySelector('select[data-type="button-alignment"]').getElementsByTagName("option"),g=void 0;"flex-start"==u?g="left":"center"!=u&&u?"flex-end"==u&&(g="right"):g="center";for(var w=0;w<b.length;w++)b[w].value==g&&(b[w].selected=!0)}if(0<d.length){var v=d[0].getAttribute("href"),h=d[0].getAttribute("target"),y=d[0].getAttribute("id"),f=prop.querySelector('input[data-type="button-link"]'),B=prop.querySelector('input[data-type="button-link-target"]'),S=B.getAttribute("id"),T=B.parentNode.getElementsByTagName("label")[0],E=prop.querySelector('input[data-type="button-id"]');S=S+"-"+a.split("-")[1],B.setAttribute("id",S),T.setAttribute("for",S),f.value=v,h&&"_blank"==h&&(B.checked=!0),E.value=y}if(c){var C=c[0].style.color,x=c[0].style.backgroundColor,_=prop.querySelector('input[data-type="button-text-color"]'),N=prop.querySelector('input[data-type="button-color"]');_.value=WPTB_Helper.rgbToHex(C),N.value=WPTB_Helper.rgbToHex(x)}}else if("image"==e.kind){var I=document.getElementsByClassName("wptb-element-"+a);if(0<I.length){var P=I[0].getElementsByTagName("a");if(0<P.length){var A=P[0];if(A){var k=void 0;k="none"==A.style.float?"center":A.style.float;for(var W=prop.querySelector('select[data-type="image-alignment"]').getElementsByTagName("option"),L=0;L<W.length;L++)W[L].value==k&&(W[L].selected=!0);A.onclick=function(e){e.preventDefault()};var M=A.getAttribute("href"),H=prop.querySelector('input[data-type="image-link"]');M&&(H.value=M);var D=A.getAttribute("target"),q=prop.querySelector('input[data-type="image-link-target"]'),F=q.getAttribute("id"),O=q.parentNode.getElementsByTagName("label")[0];F=F+"-"+a.split("-")[1],q.setAttribute("id",F),O.setAttribute("for",F),D&&"_blank"==D&&(q.checked=!0);var R=A.style.width;if(R){var z=prop.querySelector('input[type="range"][data-type="image-size"]'),j=prop.querySelector('input[type="number"][data-type="image-size"]');z.value=parseInt(R),j.value=parseInt(R)}var Q=A.getElementsByTagName("img");if(0<Q.length){var V=Q[0].getAttribute("alt");prop.querySelector('input[type="text"][data-type="alternative-text"]').value=V}}}}}else if("text"==e.kind){var G=document.getElementsByClassName("wptb-element-"+a);if(0<G.length){var J=G[0].style.fontSize,U=G[0].style.color,Y=prop.querySelector('input[type="range"][data-type="font-size"]'),X=prop.querySelector('input[type="number"][data-type="font-size"]'),K=prop.querySelector('input[type="text"][data-type="color"]');Y.value=parseInt(J)?parseInt(J):10,X.value=parseInt(J)?parseInt(J):10,K.value=WPTB_Helper.rgbToHex(U)}}else if("list"==e.kind){var $=document.getElementsByClassName("wptb-element-"+a);if(0<$.length){var Z=$[0].querySelector("p").style.color;prop.querySelector('input[type="text"][data-type="list-text-color"]').value=WPTB_Helper.rgbToHex(Z);var ee=$[0].querySelectorAll("li");if(0<ee.length){var te=ee[0].querySelector("p").classList;if(0<te.length){var ae=prop.querySelector('select[data-type="list-class"]');if(ae){ae.value="unordered";for(var ne=ae.parentNode.nextSibling,le=0;le<10&&"1"!=ne.nodeType;le++)ne=ne.nextSibling;if(ne){var re=ne.getAttribute("id");ne.setAttribute("id",re+"-"+a),ne.style.display="flex"}var oe=prop.querySelector('select[data-type="list-style-type"]');oe&&(oe.parentNode.style.display="flex",te.contains("wptb-list-style-type-disc")?oe.value="disc":te.contains("wptb-list-style-type-circle")?oe.value="circle":te.contains("wptb-list-style-type-square")?oe.value="square":te.contains("wptb-list-style-type-none")&&(oe.value="none"))}}}var ie=$[0].getElementsByClassName("wptb-list-item-content");if(0<ie.length){for(var se=[],de=0;de<ie.length;de++){var ce=ie[de].querySelector("p");ce&&(ce.style.textAlign?se.push(ce.style.textAlign):se.push("left"))}var pe=0,me=0,ue=0;if(0<se.length)for(var be=0;be<se.length;be++)se[be]&&("left"==se[be]?pe++:"center"==se[be]?me++:"right"==se[be]&&ue++);var ge=prop.querySelector('select[data-type="list-alignment"]'),we=Math.max(pe,me,ue);pe==we?ge.value="left":me==we?ge.value="center":ue==we&&(ge.value="right")}}}else if("star_rating"==e.kind){var ve=document.getElementsByClassName("wptb-element-"+a);if(0<ve.length){var he=(ve=ve[0]).querySelector("li");if(he){var ye=he.style.width,fe=prop.querySelector('input[type="range"][data-type="star-size"]'),Be=prop.querySelector('input[type="number"][data-type="star-size"]');if(fe.value=parseInt(ye)?parseInt(ye):10,Be.value=parseInt(ye)?parseInt(ye):10,he.querySelector("span")){var Se=prop.querySelector('input[type="text"][data-type="star-color"]'),Te=he.querySelector("span").style.fill;Se.value=WPTB_Helper.rgbToHex(Te)}}var Ee=ve.querySelectorAll("li"),Ce=prop.querySelector('input[type="number"][data-type="stars-count"]');1==Ee.length&&"none"==Ee[0].style.display?Ce.value=0:Ce.value=Ee.length;var xe=ve.querySelector(".wptb-success-box");if(xe){var _e=prop.querySelector('input[type="checkbox"][data-type="show-number-rating"]');if("block"==xe.style.display){_e.checked=!0;for(var Ne=prop.getElementsByClassName("wptb-numeral-rating-option-container"),Ie=0;Ie<Ne.length;Ie++)Ne[Ie].style.display="block"}else _e.checked=!1;var Pe=xe.querySelector(".wptb-text-message");if(Pe){var Ae=Pe.style.fontSize,ke=Pe.style.color,We=prop.querySelector('input[type="range"][data-type="numeral-rating-size"]'),Le=prop.querySelector('input[type="number"][data-type="numeral-rating-size"]'),Me=prop.querySelector('input[type="text"][data-type="numeral-rating-color"]');We.value=parseInt(Ae)?parseInt(Ae):10,Le.value=parseInt(Ae)?parseInt(Ae):10,Me.value=WPTB_Helper.rgbToHex(ke)}}}}if(l.onclick=function(){var e=this.className.match(/wptb-element-((.+-)\d+)/i),t=".wptb-"+e[2]+"options.wptb-options-"+e[1];document.getElementsByClassName("wptb-elements-container")[0].style.display="none",document.getElementsByClassName("wptb-settings-section")[0].style.display="none",document.getElementById("element-options-group").style.display="block";for(var a=document.getElementById("element-options-group").childNodes,n=0;n<a.length;n++)a[n].style&&(a[n].style.display="none");document.querySelector(t).style.display="block"},"button"==e.kind){var He=prop.getElementsByClassName("wptb-btn-size-btn");for(o=0;o<He.length;o++)He[o].onclick=function(){var e=this.innerHTML,t=this.dataset.element.match(/wptb-options-(.+)-(\d+)/i),a=t[1],n=t[2],l=document.getElementsByClassName("wptb-element-"+a+"-"+n)[0];l.classList.remove("wptb-size-S"),l.classList.remove("wptb-size-M"),l.classList.remove("wptb-size-L"),l.classList.remove("wptb-size-XL"),l.classList.add("wptb-size-"+e);for(var r=this.parentNode.getElementsByClassName("wptb-btn-size-btn"),o=0;o<r.length;o++)r[o].classList.remove("selected");this.classList.add("selected"),(new WPTB_TableStateSaveManager).tableStateSet()}}var De=prop.getElementsByClassName("wptb-element-property");for(o=0;o<De.length;o++){if(De[o].classList.contains("wptb-color-picker")&&jQuery(De[o]).wpColorPicker({change:function(e,t){WPTB_Helper.wpColorPickerChange(e,t),WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving(e)},clear:function(e){WPTB_Helper.wpColorPickerChange(e)}}),De[o].classList.contains("wptb-stars-count-field")&&WPTB_Helper.numberImputSize(De[o],1,10),"font-size"===De[o].dataset.type||"image-size"===De[o].dataset.type||"star-size"===De[o].dataset.type||"numeral-rating-size"===De[o].dataset.type)De[o].parentNode.parentNode.getElementsByClassName("wptb-size-slider")[0].oninput=function(){this.parentNode.parentNode.getElementsByClassName("wptb-size-number")[0].value=this.value,this.parentNode.parentNode.getElementsByClassName("wptb-size-number")[0].onchange(event)};De[o].onchange=function(e){var t=this.dataset.element.match(/wptb-options-(.+)-(\d+)/i),a=t[1],n=t[2],l=document.getElementsByClassName("wptb-element-"+a+"-"+n)[0],r=this.value;switch(this.dataset.type){case"src":l.getElementsByTagName("img")[0].src=this.value;break;case"alternative-text":l.getElementsByTagName("img")[0].alt=this.value;break;case"image-link":l.getElementsByTagName("a")[0].href=WPTB_Helper.linkHttpCheckChange(this.value);break;case"image-link-target":1==this.checked?l.getElementsByTagName("a")[0].target="_blank":l.getElementsByTagName("a")[0].target="_self";break;case"image-link-nofollow":1==this.checked?l.getElementsByTagName("a")[0].rel="nofollow":l.getElementsByTagName("a")[0].removeAttribute("rel");break;case"image-size":l.getElementsByTagName("a")[0].style.width=this.value+"%",l.getElementsByTagName("a")[0].style.height="auto",this.parentNode.parentNode.getElementsByClassName("wptb-size-slider")[0].value=this.value;break;case"image-alignment":var o="";o="center"==this.value?"none":this.value,l.querySelector(".wptb-image-wrapper a").style.float=o;break;case"font-size":l.style.fontSize=r+"px",this.parentNode.parentNode.getElementsByClassName("wptb-size-slider")[0].value=this.value;break;case"button-alignment":var i="";i="left"==this.value?"start":"right"==this.value?"flex-end":"center",l.getElementsByClassName("wptb-button-wrapper")[0].style.justifyContent=i;break;case"button-link":this.value?l.getElementsByTagName("a")[0].href=WPTB_Helper.linkHttpCheckChange(this.value):l.getElementsByTagName("a")[0].removeAttribute("href");break;case"button-link-target":1==this.checked?l.getElementsByTagName("a")[0].target="_blank":l.getElementsByTagName("a")[0].target="_self";break;case"button-link-nofollow":1==this.checked?l.getElementsByTagName("a")[0].rel="nofollow":l.getElementsByTagName("a")[0].removeAttribute("rel");break;case"button-id":this.value?l.getElementsByTagName("a")[0].id=this.value:l.getElementsByTagName("a")[0].removeAttribute("id");case"button-color":break;case"list-alignment":for(var s=l.querySelectorAll("li"),d=0;d<s.length;d++){var c=s[d].querySelector("p");c&&(c.style.textAlign=this.value)}break;case"list-class":var p=e.target.parentNode.parentNode.querySelector("[data-type=list-style-type]").parentNode,m=p.parentNode;if("unordered"==r){p.style.display="flex",m.querySelector(".wptb-list-icon-select-label").style.display="flex";var u=l.querySelectorAll("li");for(d=0;d<u.length;d++){var b=u[d].querySelector("p");b.removeAttribute("class"),b.classList.add("wptb-list-style-type-disc")}m.querySelector("[data-type=list-style-type]").value="disc"}else{p.style.display="none",m.querySelector(".wptb-list-icon-select-label").style.display="none";var g=l.querySelectorAll("li");for(d=0;d<g.length;d++){g[d].querySelector("p").removeAttribute("class")}}break;case"list-style-type":for(g=l.querySelectorAll("li"),d=0;d<g.length;d++){var w=g[d].querySelector("p");w.removeAttribute("class"),w.classList.add("wptb-list-style-type-"+r.toLowerCase())}break;case"star-size":for(var v=l.querySelectorAll("li"),h=0;h<v.length;h++){v[h].style.width=r+"px",v[h].style.height=r+"px";for(var y=v[h].querySelectorAll("span"),f=0;f<y.length;f++)y[f].querySelector("svg")&&(y[f].style.width=r+"px",y[f].style.height=r+"px",y[f].querySelector("svg").style.width=r+"px")}break;case"show-number-rating":var B=WPTB_Helper.findAncestor(this,"wptb-star_rating-options").getElementsByClassName("wptb-numeral-rating-option-container");if(WPTB_Helper.starRatingTextMessageChenge(l),0<B.length){var S=l.querySelector(".wptb-text-message"),T=this.checked?"checked":"unchecked";if("checked"==T){for(var E=0;E<B.length;E++)B[E].style.display="block";S.parentNode.style.display="block"}else if("unchecked"==T){for(var C=0;C<B.length;C++)B[C].style.display="none";S.parentNode.style.display="none"}}break;case"numeral-rating-size":var x=l.querySelector(".wptb-text-message");x.style.fontSize=r+"px",x.style.height=r+"px",x.style.lineHeight=r+"px";break;case"stars-count":var _=l.querySelectorAll("li"),N=_.length;if(N<r)for(var I=r-N,P=_[_.length-1],A=P.parentNode,k=0;k<I;k++){var W=P.cloneNode(!0);W.removeAttribute("class"),W.setAttribute("class","wptb-rating-star"),W.dataset.value=parseInt(P.dataset.value)+k+1,WPTB_Helper.starRatingEventHandlersAdd(W),A.appendChild(W)}else if(r<N){var L=parseInt(N)-parseInt(r);0==r&&(L--,_[0].removeAttribute("class"),_[0].setAttribute("class","wptb-rating-star"),_[0].style.display="none");var M=_.length;for(d=0;d<L;d++)_[0].parentNode.removeChild(_[M-d-1])}else r==N&&1==N&&(_[0].style.display="inline-block");WPTB_Helper.starRatingTextMessageChenge(l)}e.target.classList.contains("wptb-size-slider")||e.target.classList.contains("wptb-size-slider")?e.target.onmouseup=function(){(new WPTB_TableStateSaveManager).tableStateSet()}:(new WPTB_TableStateSaveManager).tableStateSet()}}},WPTB_Helper={hexToRgb:function(e){var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?"rgb("+parseInt(t[1],16)+","+parseInt(t[2],16)+","+parseInt(t[3],16)+")":null},rgbToHex:function(e){return(e=e.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i))&&4===e.length?"#"+("0"+parseInt(e[1],10).toString(16)).slice(-2)+("0"+parseInt(e[2],10).toString(16)).slice(-2)+("0"+parseInt(e[3],10).toString(16)).slice(-2):""},getDragImageCustom:function(e){var t=location.protocol+"//"+location.hostname,a=document.createElement("img");return a.src=t+"/wp-content/plugins/wp-table-builder/inc/admin/views/builder/icons/"+e+".png",a},dragImagesArr:function(){return{text:WPTB_Helper.getDragImageCustom("text"),image:WPTB_Helper.getDragImageCustom("image"),button:WPTB_Helper.getDragImageCustom("button"),list:WPTB_Helper.getDragImageCustom("list"),star_rating:WPTB_Helper.getDragImageCustom("half-filled-rating-star")}},listItemsRecalculateIndex:function(e){var t=e.querySelectorAll("p");if(0<t.length)for(var a=0;a<t.length;a++)t[a].dataset.listStyleTypeIndex=Number(a)+1+"."},listItemsTinyMceInit:function(e){tinyMCE.init({target:e,inline:!0,plugins:"link, paste",dialog_type:"modal",theme:"modern",menubar:!1,fixed_toolbar_container:"#wpcd_fixed_toolbar",paste_as_text:!0,toolbar:"bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify",setup:function(e){e.on("keydown",function(e){var t=e.target.parentNode;if(13==e.keyCode){e.preventDefault();var a=e.target.innerHTML,n=new WPTB_ListItem(a,t,!0);return t.parentNode.insertBefore(n.getDOMElement(),t),WPTB_Helper.listItemsTinyMceInit(n.getDOMElement().firstChild),e.target.querySelector("p").innerText="New List Item",void WPTB_Helper.listItemsRecalculateIndex(t.parentNode)}if("8"==e.keyCode||"46"==e.keyCode){var l=e.target.querySelector("p").innerHTML.replace(/<[^>]+>/g,"");if(""==(l=(l=l.replace(/\s+/g," ").trim()).replace(/&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,i=new WPTB_ActionsField;i.addActionField(2,o),i.setParameters(o)}),e.on("keyup",function(e){var t=e.target.parentNode,a=new WPTB_ActionsField;a.addActionField(2,t),a.setParameters(t),e.target.onblur=function(){(new WPTB_TableStateSaveManager).tableStateSet()}})},init_instance_callback:function(e){(window.currentEditor=e).on("focus",function(e){var t=document.getElementsByClassName("wptb-builder-panel")[0].offsetWidth;window.currentEditor&&55<=document.getElementById("wptb_builder").scrollTop&&"none"!=window.currentEditor.bodyElement.style.display?(document.getElementById("wpcd_fixed_toolbar").style.position="fixed",document.getElementById("wpcd_fixed_toolbar").style.right=t/2-document.getElementById("wpcd_fixed_toolbar").offsetWidth/2+"px",document.getElementById("wpcd_fixed_toolbar").style.top="100px"):(document.getElementById("wpcd_fixed_toolbar").style.position="static",delete document.getElementById("wpcd_fixed_toolbar").style.right,delete document.getElementById("wpcd_fixed_toolbar").style.top)})}})},buttonsTinyMceInit:function(n){tinyMCE.init({target:n,inline:!0,plugins:"link",dialog_type:"modal",theme:"modern",menubar:!1,fixed_toolbar_container:"#wpcd_fixed_toolbar",toolbar:"bold italic strikethrough",setup:function(e){e.on("keydown",function(e){13==e.keyCode&&e.preventDefault();var t=WPTB_Helper.findAncestor(n,"wptb-button-container"),a=new WPTB_ActionsField;a.addActionField(1,t),a.setParameters(t)}),e.on("keyup",function(e){var t=WPTB_Helper.findAncestor(n,"wptb-button-container"),a=new WPTB_ActionsField;a.addActionField(1,t),a.setParameters(t),e.target.onblur=function(){(new WPTB_TableStateSaveManager).tableStateSet()}})},init_instance_callback:function(e){(window.currentEditor=e).on("focus",function(e){var t=document.getElementsByClassName("wptb-builder-panel")[0].offsetWidth;window.currentEditor&&55<=document.getElementById("wptb_builder").scrollTop&&"none"!=window.currentEditor.bodyElement.style.display?(document.getElementById("wpcd_fixed_toolbar").style.position="fixed",document.getElementById("wpcd_fixed_toolbar").style.right=t/2-document.getElementById("wpcd_fixed_toolbar").offsetWidth/2+"px",document.getElementById("wpcd_fixed_toolbar").style.top="100px"):(document.getElementById("wpcd_fixed_toolbar").style.position="static",delete document.getElementById("wpcd_fixed_toolbar").style.right,delete document.getElementById("wpcd_fixed_toolbar").style.top)})}})},linkHttpCheckChange:function(e){if(e){if(-1!=e.indexOf("http://")||-1!=e.indexOf("https://"))return e;var t=e.split("/"),a=void 0;return Array.isArray(t)&&0<t.length&&(a=t[t.length-1]),document.location.protocol+"//"+a}return""},dataTitleColumnSet:function(e){for(var t=e.rows,a=t[0],n=getComputedStyle(a),l=a.children,r={},o=0;o<l.length;o++){for(var i=l[o].children,s=0;s<i.length;s++){var d=i[s];if(d.classList.contains("wptb-ph-element"))if("text"==d.className.match(/wptb-element-(.+)-(\d+)/i)[1]){var c=d.querySelector("p"),p=c.textContent,m=c.style.textAlign;r[l[o].dataset.xIndex]=[p,d.style.fontSize,d.style.color,n.backgroundColor,m];break}}r[l[o].dataset.xIndex]||(r[l[o].dataset.xIndex]=["","","",n.backgroundColor,""])}for(var u=1;u<t.length;u++)for(var b=t[u].children,g=0;g<b.length;g++)r[b[g].dataset.xIndex]?(b[g].dataset.wptbTitleColumn=r[b[g].dataset.xIndex][0],b[g].dataset.wptbTitleColumnFontSize=r[b[g].dataset.xIndex][1],b[g].dataset.wptbTitleColumnColor=r[b[g].dataset.xIndex][2],b[g].dataset.wptbTitleBackgroundColor=r[b[g].dataset.xIndex][3],b[g].dataset.wptbTitleAlign=r[b[g].dataset.xIndex][4]):(b[g].dataset.wptbTitleColumn="",b[g].dataset.wptbTitleColumnFontSize="",b[g].dataset.wptbTitleColumnColor="",b[g].dataset.wptbTitleBackgroundColor="",b[g].dataset.wptbTitleAlign="")},findAncestor:function(e,t){for(;(e=e.parentElement)&&!e.classList.contains(t););return e},getSelectionText:function(){return window.getSelection?window.getSelection().toString():document.selection.createRange().text},settingsPanelClear:function(){document.getElementById("wptb-adaptive-table-checkbox").checked=!1,document.getElementById("wptb-top-row-as-header").checked=!1,document.getElementById("wptb-table-border-slider").value=0,document.getElementById("wptb-table-border-number").value=0,document.getElementById("wptb-inner-border-check").checked=!1,document.getElementById("wptb-apply-inner-border").classList.remove("visible"),document.getElementById("wptb-table-inner-border-slider").value=1,document.getElementById("wptb-table-inner-border-number").value=1,WPTB_Helper.wpColorPickerClear("wptb-table-border-color",!0),WPTB_Helper.wpColorPickerClear("wptb-table-header-bg",!0),WPTB_Helper.wpColorPickerClear("wptb-even-row-bg",!0),WPTB_Helper.wpColorPickerClear("wptb-odd-row-bg",!0),document.getElementById("wptb-table-cell-slider").value=15,document.getElementById("wptb-table-cell-number").value=15},elementOptionsPanelClear:function(){var e=document.getElementById("element-options-group");e&&(e.innerHTML="")},wpColorPickerCheckChangeForTableStateSaving:function(e){if("external"==e.originalEvent.type){(new WPTB_TableStateSaveManager).tableStateSet()}else{var t=WPTB_Helper.findAncestor(e.target,"wp-picker-container");if(t)if("square"==e.originalEvent.type){var a=t.getElementsByClassName("iris-square-handle");0<a.length&&((a=a[0]).onmouseup=function(){(new WPTB_TableStateSaveManager).tableStateSet()})}else if("strip"==e.originalEvent.type){var n=t.getElementsByClassName("iris-slider-offset");0<n.length&&((n=n[0]).onmouseup=function(){(new WPTB_TableStateSaveManager).tableStateSet()})}}},wpColorPickerClear:function(e,t){var a=void 0;t?(a=[document.getElementById(e)]).length=1:a=document.getElementsByClassName(e);for(var n=0;n<a.length;n++){var l=WPTB_Helper.findAncestor(a[n],"wp-picker-container");if(l){var r=l.parentNode;r.removeChild(l);var o=document.createElement("input");t?o.setAttribute("id",e):o.classList.add("wptb-element-property",e),o.value="",r.appendChild(o)}}},detectMode:function(){var e=window.location.href,t=new RegExp("[?&]table(=([^&#]*)|&|#|$)").exec(e);return!!t&&(t[2]?decodeURIComponent(t[2].replace(/\+/g," ")):"")},getColumnWidth:function(e,t){for(var a=t.dataset.xIndex,n=e.querySelectorAll('[data-x-index="'+a+'"]'),l=t.getCellDimensions().width,r=0;r<n.length;r++)l>n[r].getCellDimensions().width&&(l=n[r].getCellDimensions().width);return l},getRowHeight:function(e,t){for(var a=t.dataset.yIndex,n=e.querySelectorAll('[data-y-index="'+a+'"]'),l=t.getCellDimensions().height,r=0;r<n.length;r++)l>n[r].getCellDimensions().height&&(l=n[r].getCellDimensions().height);return l},newElementProxy:function(e){return"list"==e?new WPTB_List:"image"==e?new WPTB_Image:"text"==e?new WPTB_Text:"button"==e?new WPTB_Button:"star_rating"==e?new WPTB_StarRating:void 0},wpColorPickerChange:function(e,t){var a=void 0;a=t?t.color.toString():"";var n,l,r,o=WPTB_Helper.findAncestor(e.target,"wp-picker-input-wrap").getElementsByClassName("wptb-color-picker")[0];l=(n=o.dataset.element.match(/wptb-options-(.+)-(\d+)/i))[1],r=n[2];var i=document.getElementsByClassName("wptb-element-"+l+"-"+r)[0];if("button"==l)"button-text-color"==o.dataset.type?i.getElementsByClassName("wptb-button")[0].style.color=a:i.getElementsByClassName("wptb-button")[0].style.backgroundColor=a;else if("list"==l){var s=i.querySelectorAll("p");if(0<s.length)for(var d=0;d<s.length;d++)s[d].style.color=a}else if("star_rating"==l){if("star-color"==o.dataset.type)for(var c=i.querySelectorAll("li"),p=0;p<c.length;p++)for(var m=c[p].getElementsByTagName("span"),u=0;u<m.length;u++)m[u].style.fill=a;else if("numeral-rating-color"==o.dataset.type){i.querySelector(".wptb-text-message").style.color=a}}else i.style.color=a},starRatingSelectHoverSet:function(e){var t=void 0;t=e.target.classList.contains("wptb-rating-star")?e.target:WPTB_Helper.findAncestor(e.target,"wptb-rating-star");var a=parseInt(t.dataset.value,10),n=t.parentNode.children;if("mouseover"==e.type)for(var l=0;l<n.length;l++)l<a?l==a-1?e.target.classList.contains("wptb-rating-star-left-signal-part")?(n[l].classList.add("wptb-rating-star-hover-half"),n[l].classList.remove("wptb-rating-star-hover-full")):e.target.classList.contains("wptb-rating-star-right-signal-part")&&(n[l].classList.add("wptb-rating-star-hover-full"),n[l].classList.remove("wptb-rating-star-hover-half")):(n[l].classList.add("wptb-rating-star-hover-full"),n[l].classList.remove("wptb-rating-star-hover-half")):(n[l].classList.remove("wptb-rating-star-hover-full"),n[l].classList.remove("wptb-rating-star-hover-half"));else if("click"==e.type)for(var r=0;r<n.length;r++)r<a?r==a-1?e.target.classList.contains("wptb-rating-star-left-signal-part")?(n[r].classList.add("wptb-rating-star-selected-half"),n[r].classList.remove("wptb-rating-star-selected-full")):e.target.classList.contains("wptb-rating-star-right-signal-part")&&(n[r].classList.add("wptb-rating-star-selected-full"),n[r].classList.remove("wptb-rating-star-selected-half")):(n[r].classList.add("wptb-rating-star-selected-full"),n[r].classList.remove("wptb-rating-star-selected-half")):(n[r].classList.remove("wptb-rating-star-selected-full"),n[r].classList.remove("wptb-rating-star-selected-half"))},starRatingEventHandlersAdd:function(e){e.onmouseover=function(e){e.stopPropagation(),WPTB_Helper.starRatingSelectHoverSet(e)},e.onmouseout=function(){for(var e=this.parentNode.children,t=0;t<e.length;t++)e[t].classList.remove("wptb-rating-star-hover-half"),e[t].classList.remove("wptb-rating-star-hover-full")},e.onclick=function(e){WPTB_Helper.starRatingSelectHoverSet(e);var t=WPTB_Helper.findAncestor(e.target,"wptb-star_rating-container");WPTB_Helper.starRatingTextMessageChenge(t),new WPTB_ActionsField(1,t).setParameters(t),(new WPTB_TableStateSaveManager).tableStateSet()}},numberImputSize:function(e,t,a){e.onkeydown=function(){var e=this.value;0==(e=String(e))[0]?this.value="":(e=e.substring(0,t),this.value=e)},e.onkeyup=function(){var e=this.value;e=String(e),a<e&&(this.value=a)}},starRatingTextMessageChenge:function(e){var t=e.getElementsByClassName("wptb-rating-star-selected-full").length;0<e.getElementsByClassName("wptb-rating-star-selected-half").length&&(t=parseInt(t)+.5);var a=e.querySelectorAll("li"),n=a.length,l=e.querySelector(".wptb-text-message");1!=n||"none"!=a[0].style.display?l.innerHTML=t+"/"+n:l.innerHTML=""}},WPTB_Image=function(e,t){var a=void 0,n=void 0,l=void 0,r=!1;if(null==t){a=document.createElement("div"),n=document.createElement("div");var o=document.createElement("a"),i=document.createElement("img");o.style.display="block",o.appendChild(i),a.classList.add("wptb-image-container"),n.classList.add("wptb-image-wrapper"),n.appendChild(o),a.appendChild(n),o.onclick=function(e){e.preventDefault()},file_frame=wp.media.frames.file_frame=wp.media({title:"Select a image to upload",button:{text:"Use this image"},multiple:!1}),file_frame.on("select",function(){attachment=file_frame.state().get("selection").first().toJSON();var e=attachment.url.split(":"),t=void 0;Array.isArray(e)&&0<e.length&&(t=e[e.length-1]),i.src=t,i.height=attachment.height,i.width=attachment.width,i.style.width="100%",(new WPTB_TableStateSaveManager).tableStateSet()}),null==e?file_frame.open():i.src=e}else{(a=t.cloneNode(!0)).getElementsByTagName("a")[0].onclick=function(e){e.preventDefault()};var s=t.className.match(/wptb-element-((.+-)\d+)/i);s&&Array.isArray(s)&&(l=s[1],r=!0)}return this.kind="image",this.getDOMElement=function(){return a},applyGenericItemSettings(this,l,r),this},WPTB_Initializer=function(){var e=document.body;columnsDecrementButton=e.getElementsByClassName("wptb-input-number-decrement")[0],columnsIncrementButton=e.getElementsByClassName("wptb-input-number-increment")[0],rowsDecrementButton=e.getElementsByClassName("wptb-input-number-decrement")[1],rowsIncrementButton=e.getElementsByClassName("wptb-input-number-increment")[1],columnsInput=document.getElementById("wptb-columns-number"),rowsInput=document.getElementById("wptb-rows-number"),columnsDecrementButton.onclick=function(){1<columnsInput.value&&columnsInput.value--},columnsIncrementButton.onclick=function(){columnsInput.value<30&&columnsInput.value++},rowsDecrementButton.onclick=function(){1<rowsInput.value&&rowsInput.value--},rowsIncrementButton.onclick=function(){rowsInput.value<30&&rowsInput.value++},document.getElementById("wptb-generate-table").onclick=function(){var e=document.getElementById("wptb-columns-number").value,t=document.getElementById("wptb-rows-number").value;WPTB_Table(e,t),(new WPTB_TableStateSaveManager).tableStateSet()}},WPTB_LeftPanel=function(){var e,t,a,n,r=document.getElementsByClassName("wptb-preview-table")[0],l=document.getElementsByClassName("wptb-element");function o(e,t){if(!(3<t)&&r){var a=r.getElementsByTagName("tr");if(a.length>t){var n=a[t].style.backgroundColor,l=document.getElementById(e);l&&n&&(l.value=WPTB_Helper.rgbToHex(n))}}}function i(e){for(var t=r.getElementsByTagName("td"),a=0;a<t.length;a++)t[a].style.borderWidth=document.querySelector("#wptb-table-inner-border-number").value+"px",t[a].style.borderStyle="solid"}function s(e){for(var t=r.getElementsByTagName("td"),a=0;a<t.length;a++)t[a].style.padding=e+"px"}function d(e){r.style.borderWidth=e+"px",r.style.borderStyle="solid"}o("wptb-even-row-bg",1),jQuery("#wptb-even-row-bg").wpColorPicker({change:function(e,t){for(var a=r.getElementsByTagName("tr"),n=1;n<a.length;n+=2)a[n].style.backgroundColor=t.color.toString();console.log(e),console.log(this),WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving(e)},clear:function(){for(var e=r.getElementsByTagName("tr"),t=1;t<e.length;t+=2){e[t].style.backgroundColor="";for(var a=e[t].getElementsByTagName("td"),n=0;n<a.length;n++)a[n].style.backgroundColor=""}(new WPTB_TableStateSaveManager).tableStateSet()}}),o("wptb-odd-row-bg",2),jQuery("#wptb-odd-row-bg").wpColorPicker({change:function(e,t){for(var a=r.getElementsByTagName("tr"),n=2;n<a.length;n+=2)a[n].style.backgroundColor=t.color.toString();WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving(e)},clear:function(){for(var e=r.getElementsByTagName("tr"),t=2;t<e.length;t+=2){e[t].style.backgroundColor="";for(var a=e[t].getElementsByTagName("td"),n=0;n<a.length;n++)a[n].style.backgroundColor=""}(new WPTB_TableStateSaveManager).tableStateSet()}}),o("wptb-table-header-bg",0),jQuery("#wptb-table-header-bg").wpColorPicker({change:function(e,t){r.getElementsByTagName("tr")[0].style.backgroundColor=t.color.toString(),(new WPTB_TableStateSaveManager).tableStateSet()},clear:function(){var e=r.getElementsByTagName("tr")[0];e.style.backgroundColor="";for(var t=e.getElementsByTagName("td"),a=0;a<t.length;a++)t[a].style.backgroundColor="";WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving(event)}}),e=r,t=document.getElementById("wptb-adaptive-table-checkbox"),e&&e.dataset.wptbAdaptiveTable&&"1"==e.dataset.wptbAdaptiveTable?t.checked=!0:t.checked=!1,a=r,n=document.getElementById("wptb-top-row-as-header"),a&&a.classList.contains("wptb-table-preview-head")?n.checked=!0:n.checked=!1,function(){var e=document.getElementsByClassName("wptb-preview-table");if(0<e.length){var t=e[0].style.borderColor;if(t){var a=document.getElementById("wptb-table-border-color");a&&(a.value=WPTB_Helper.rgbToHex(t))}var n=e[0].style.borderWidth;if(n){var l=document.getElementById("wptb-table-border-slider"),r=document.getElementById("wptb-table-border-number");l&&(l.value=parseInt(n)),r&&(r.value=parseInt(n))}var o=e[0].querySelector("td").style.borderWidth;if(o){var i=document.getElementById("wptb-inner-border-check"),s=document.getElementById("wptb-apply-inner-border");if(o&&0<parseInt(o)){if(i&&(i.checked=!0,s)){s.classList.add("visible");var d=document.getElementById("wptb-table-inner-border-slider"),c=document.getElementById("wptb-table-inner-border-number");d.value=parseInt(o),c.value=parseInt(o)}}else i.checked=!1}(n&&0<parseInt(n)||o&&0<parseInt(o))&&(document.getElementById("wptb-table-border-color-set-area").style.display="")}}(),jQuery("#wptb-table-border-color").wpColorPicker({change:function(e,t){var a=r.getElementsByTagName("td");r.style.border=document.querySelector("#wptb-table-border-number").value+"px solid "+t.color.toString();for(var n=0;n<a.length;n++){var l=document.querySelector("#wptb-table-inner-border-number").value;document.getElementById("wptb-inner-border-check").checked&&(a[n].style.border=(0!=l?l:1)+"px solid "+t.color.toString())}WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving(e)},clear:function(){var e=r.getElementsByTagName("td");r.style.borderColor="";for(var t=0;t<e.length;t++)e[t].style.borderColor="";(new WPTB_TableStateSaveManager).tableStateSet()}}),function(){var e=document.getElementsByClassName("wptb-preview-table");if(0<e.length){var t=e[0].querySelector("td");if(t){var a=t.style.padding;if(a){var n=document.getElementById("wptb-table-cell-slider"),l=document.getElementById("wptb-table-cell-number");n&&(n.value=parseInt(a)),l&&(l.value=parseInt(a))}}}}();var c=document.getElementById("wptb-table-border-number");WPTB_Helper.numberImputSize(c,1,50);var p=document.getElementById("wptb-table-inner-border-number");WPTB_Helper.numberImputSize(p,1,50);var m=document.getElementById("wptb-table-cell-number");WPTB_Helper.numberImputSize(m,1,50);var u=document.getElementById("wptb-size-number");WPTB_Helper.numberImputSize(u,1,50);var b=document.getElementById("wptb-size-number");WPTB_Helper.numberImputSize(b,2,100);var g=document.getElementById("wptb-table-column-width-number");WPTB_Helper.numberImputSize(g,2,500);var w=document.getElementById("wptb-table-row-height-number");WPTB_Helper.numberImputSize(w,2,200),document.getElementById("wptb-table-cell-slider").oninput=function(){document.getElementById("wptb-table-cell-number").value=this.value,s(this.value),r.tdDefaultWidth()},document.getElementById("wptb-table-cell-slider").onchange=function(){(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-cell-number").onchange=function(){document.getElementById("wptb-table-cell-slider").value=this.value,s(this.value),r.tdDefaultWidth(),(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-border-slider").oninput=function(){document.getElementById("wptb-table-border-number").value=this.value,d(this.value),r.tdDefaultWidth();var e=document.getElementById("wptb-inner-border-check").checked,t=document.getElementById("wptb-table-border-color-set-area");0==this.value&&0==e?t.style.display="none":t.style.display=""},document.getElementById("wptb-table-border-slider").onchange=function(){(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-border-number").onchange=function(){document.getElementById("wptb-table-border-slider").value=this.value,d(this.value),r.tdDefaultWidth(),(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-inner-border-slider").oninput=function(){document.getElementById("wptb-table-inner-border-number").value=this.value,i(this.value),r.tdDefaultWidth()},document.getElementById("wptb-table-inner-border-slider").onchange=function(){(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-inner-border-number").onchange=function(){document.getElementById("wptb-table-inner-border-slider").value=this.value,i(this.value),r.tdDefaultWidth(),(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-inner-border-check").onchange=function(){if(r){var e=this.checked?"checked":"unchecked";!function(e){var t=null!=document.querySelector("#wptb-table-border-color").value?document.querySelector("#wptb-table-border-color").value:"rgb(0,0,0)";0!=document.querySelector("#wptb-table-inner-border-slider").value&&0!=document.querySelector("#wptb-table-inner-border-number").value||(document.querySelector("#wptb-table-inner-border-slider").value=1,document.querySelector("#wptb-table-inner-border-number").value=1);var a=document.querySelector("#wptb-table-inner-border-slider").value+"px",n=document.getElementsByClassName("wptb-preview-table");if(0<n.length)if("checked"==e){document.getElementById("wptb-apply-inner-border").style.marginBottom="0px";for(var l=n[0].getElementsByTagName("td"),r=0;r<l.length;r++)l[r].style.border=a+" solid "+t;document.getElementById("wptb-apply-inner-border").classList.add("visible")}else for(document.getElementById("wptb-apply-inner-border").classList.remove("visible"),l=n[0].getElementsByTagName("td"),r=0;r<l.length;r++)l[r].style.border="0px solid "+t,l[r].style.border=null}(e);var t=document.getElementById("wptb-table-border-slider").value,a=document.getElementById("wptb-table-border-color-set-area");a.style.display="unchecked"==e&&0==t?"none":"",(new WPTB_TableStateSaveManager).tableStateSet()}},document.getElementById("wptb-table-column-width-slider").oninput=function(){document.getElementById("wptb-table-column-width-number").value=this.value,r.addColumnWidth(this.value)},document.getElementById("wptb-table-column-width-slider").onchange=function(){(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-column-width-number").onchange=function(){document.getElementById("wptb-table-column-width-slider").value=this.value,r.addColumnWidth(this.value),(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-column-width-auto-fixed").onchange=function(){if(this.checked){var e=r.querySelector(".wptb-highlighted"),t=WPTB_Helper.getColumnWidth(r,e);r.addColumnWidth(t)}else{r.addColumnWidth(!1,!0);var a=r.querySelector(".wptb-highlighted"),n=WPTB_Helper.getColumnWidth(r,a);document.getElementById("wptb-table-column-width-number").value=n,document.getElementById("wptb-table-column-width-slider").value=n}(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-row-height-slider").oninput=function(){document.getElementById("wptb-table-row-height-number").value=this.value,r.addRowHeight(this.value)},document.getElementById("wptb-table-row-height-slider").onchange=function(){(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-row-height-number").onchange=function(){document.getElementById("wptb-table-row-height-slider").value=this.value,r.addRowHeight(this.value),(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-row-height-auto-fixed").onchange=function(){if(this.checked){var e=r.querySelector(".wptb-highlighted"),t=WPTB_Helper.getRowHeight(r,e);r.addRowHeight(t)}else{r.addRowHeight(!1,!0);var a=r.querySelector(".wptb-highlighted"),n=WPTB_Helper.getRowHeight(r,a);document.getElementById("wptb-table-row-height-number").value=n,document.getElementById("wptb-table-row-height-slider").value=n}(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-adaptive-table-checkbox").onchange=function(){this.checked?r.dataset.wptbAdaptiveTable=1:r.dataset.wptbAdaptiveTable=0,(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-top-row-as-header").onchange=function(){!function(e,t){if(t.checked)WPTB_Helper.dataTitleColumnSet(e),e.classList.add("wptb-table-preview-head"),e.rows[0].classList.add("wptb-table-head");else{var a=e.rows;e.classList.remove("wptb-table-preview-head"),a[0].classList.remove("wptb-table-head");for(var n=1;n<a.length;n++)for(var l=a[n].children,r=0;r<l.length;r++)l[r].removeAttribute("data-wptb-title-column"),l[r].removeAttribute("data-wptb-title-column-font-size"),l[r].removeAttribute("data-wptb-title-column-color"),l[r].removeAttribute("data-wptb-title-background-color"),l[r].removeAttribute("data-wptb-title-align")}}(r,this),(new WPTB_TableStateSaveManager).tableStateSet()};for(var v=0;v<l.length;v++)l[v].ondragstart=function(e){e.dataTransfer.setData("wptbElement",this.dataset.wptbElement),e.dataTransfer.setData("wptbElIndic-"+this.dataset.wptbElement,"wptbElIndic-"+this.dataset.wptbElement)};r&&(document.getElementById("wptb-activate-cell-management-mode").onclick=r.toggleTableEditMode,document.getElementById("wptb-table-edit-mode-close").onclick=r.toggleTableEditMode,document.getElementById("wptb-left-scroll-panel-curtain-close").onclick=r.toggleTableEditMode,document.getElementById("wptb-add-end-row").onclick=r.addRowToTheEnd,document.getElementById("wptb-add-start-row").onclick=r.addRowToTheStart,document.getElementById("wptb-add-row-before").onclick=r.addRowBefore,document.getElementById("wptb-add-row-after").onclick=r.addRowAfter,document.getElementById("wptb-add-end-column").onclick=r.addColumnEnd,document.getElementById("wptb-add-start-column").onclick=r.addColumnStart,document.getElementById("wptb-add-column-before").onclick=r.addColumnBefore,document.getElementById("wptb-add-column-after").onclick=r.addColumnAfter,document.getElementById("wptb-delete-column").onclick=r.deleteColumn,document.getElementById("wptb-delete-row").onclick=r.deleteRow,document.getElementById("wptb-merge-cells").onclick=r.mergeCells,document.getElementById("wptb-split-cell").onclick=r.splitCell),document.querySelector(".wptb-left-panel-extend").onclick=function(){var e=document.querySelector(".wptb-container");e&&(e.classList.contains("collapsed")?e.classList.remove("collapsed"):e.classList.add("collapsed"))},document.getElementsByClassName("wptb-builder-panel")[0].onclick=function(e){e.target.classList.contains("wptb-ph-element")||WPTB_Helper.findAncestor(e.target,"wptb-ph-element")||e.target.classList.contains("wptb-fixed-toolbar")||WPTB_Helper.findAncestor(e.target,"wptb-fixed-toolbar")||y()};var h=document.getElementsByClassName("wptb-header");function y(){document.getElementsByClassName("wptb-elements-container")[0].style.display="table",document.getElementsByClassName("wptb-settings-section")[0].style.display="block",document.getElementById("element-options-group").style.display="none";var e=document.getElementById("wpcd_fixed_toolbar");e.hasAttribute("data-toolbar-active-id")&&document.getElementById(e.getAttribute("data-toolbar-active-id")).classList.remove("toolbar-active")}0<h.length&&(h=h[0]),h.onclick=function(){y()}},WPTB_List=function(e,t){var a,n=document.createElement("ul"),l=document.createElement("div"),r=void 0,o=!1;if(l.classList.add("wptb-list-item-container"),this.kind="list",""===e);else if(e){var i=t.className.match(/wptb-element-((.+-)\d+)/i);i&&Array.isArray(i)&&(r=i[1],o=!0);for(d=0;d<e.length;d++){var s=t.querySelector("li");a=new WPTB_ListItem(e[d],s,!0),n.appendChild(a.getDOMElement())}}else for(var d=0;d<3;d++)a=new WPTB_ListItem("<p>List Item "+(d+1)+"</p>"),n.appendChild(a.getDOMElement());return l.appendChild(n),this.getDOMElement=function(){return l},applyGenericItemSettings(this,r,o),WPTB_Helper.listItemsRecalculateIndex(n),this},WPTB_ListItem=function(e,t,a){var n=void 0;if(null==t||t&&a){null==e&&(e="New List Item");var l=document.createElement("li");if((o=document.createElement("div")).classList.add("wptb-list-item-content"),t){var r=t.getAttribute("style");r&&l.setAttribute("style",r)}l.appendChild(o),o.innerHTML=e,o.onkeyup=window.listItemKeyListener,n=!0}else{var o;(o=(l=t).getElementsByClassName("wptb-list-item-content")[0]).onkeyup=window.listItemKeyListener,n=!1}if(l.onmouseenter=function(e){var t=new WPTB_ActionsField;t.addActionField(2,l),t.setParameters(l),console.log(l)},l.onmouseleave=function(e){return(new WPTB_ActionsField).leaveFromField(e,l,2),!1},this.getDOMElement=function(){return l},n)return this},MultipleSelect=function(){var l=[],a=!1;return this.activateMultipleSelectMode=function(){l=[];for(var e=document.getElementsByClassName("wptb-preview-table")[0].getElementsByTagName("td"),t=0;t<e.length;t++)e[t].classList.remove("wptb-highlighted");a=!0},this.deactivateMultipleSelectMode=function(){a=!1},this.isActivated=function(){return a},this.pushSelectedCell=function(e){a&&(l.push(e),e.classList.add("wptb-highlighted"))},this.selectedCells=function(){return l},this.flushSelectedCells=function(){l=[]},this.getFirst=function(){for(var e,t=1e3,a=1e3,n=l.length-1;0<=n;n--)t>=l[n].dataset.xIndex&&a>=l[n].dataset.yIndex&&(e=l[n],t=l[n].dataset.xIndex,a=l[n].dataset.yIndex);return e},this.getLast=function(){for(var e,t=-1,a=-1,n=l.length-1;0<=n;n--)t<=l[n].dataset.xIndex&&a<=l[n].dataset.yIndex&&(e=l[n],t=l[n].dataset.xIndex,a=l[n].dataset.yIndex);return e},this.removeAllButFirst=function(){for(var e=this.getFirst(),t=1;t<l.length;t++)l[t].classList.add("wptb-fused-cell-"+e.dataset.xIndex+"-"+e.dataset.yIndex)},this};function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,a=Array(e.length);t<e.length;t++)a[t]=e[t];return a}return Array.from(e)}var WPTB_Parser=function(e){var t=document.createElement("div");t.innerHTML=e;for(var a=t.children[0],n=[].concat(_toConsumableArray(a.querySelectorAll(".wptb-column-title-mobile-container"))),l=0;l<n.length;l++){n[l].parentNode.removeChild(n[l])}for(var r=a.querySelectorAll("td"),o=0;o<r.length;o++)r[o].classList.add("wptb-droppable"),r[o].classList.remove("wptb-column-title-mobile-not-elements");return a},WPTB_Parser2=function(e){if(Array.isArray(e)){var t=void 0;if(1==e.length)return t.appendChild(document.createTextNode(e[0]));if(0 in e){var a=e[0];if(t=document.createElement(a),1 in e&&Array.isArray(e[1]))for(var n=e[1],l=0;l<n.length;l++)Array.isArray(n[l])&&t.setAttribute(n[l][0],n[l][1]);if(2 in e)if(Array.isArray(e[2]))for(var r=0;r<e[2].length;r++)"string"!=typeof e[2][r]||"p"!=a.toLowerCase()?WPTB_Parser(e[2][r])&&t.appendChild(WPTB_Parser(e[2][r])):t.appendChild(document.createTextNode(e[2][r]));else"string"==typeof e[2]&&t.appendChild(document.createTextNode(e[2]))}return t}return!1},WPTB_Settings=function(){for(var e=document.getElementsByClassName("wptb-element"),t=0;t<e.length;t++)e[t].ondragstart=function(e){e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("wptbElement",e.target.dataset.wptbElement),e.dataTransfer.setData("wptbElIndic-"+e.target.dataset.wptbElement,"wptbElIndic-"+e.target.dataset.wptbElement)},e[t].ondragend=function(){var e=document.querySelector(".wptb-drop-handle"),t=document.querySelector(".wptb-drop-border-marker");(e||t)&&(e.style.display="none",t.style.display="none")};var a=new WPTB_TableStateSaveManager,n=document.getElementsByClassName("wptb-undo");0<n.length&&((n=n[0]).onclick=function(e){if(!this.classList.contains("wptb-undoredo-disabled")){a.tableStateGet(this.dataset.wptbUndoredo);var t=document.getElementsByClassName("wptb-undo-redo-container");0<t.length&&((t=t[0]).onmouseleave=function(e){e.target.onmouseleave="",WPTB_Table()})}});var l=document.getElementsByClassName("wptb-redo");0<l.length&&((l=l[0]).onclick=function(e){if(!this.classList.contains("wptb-undoredo-disabled")){a.tableStateGet(this.dataset.wptbUndoredo);var t=document.getElementsByClassName("wptb-undo-redo-container");0<t.length&&((t=t[0]).onmouseleave=function(e){e.target.onmouseleave="",WPTB_Table()})}});var r=document.getElementsByClassName("wptb-popup-window-modal")[0];document.getElementsByClassName("wptb-embed-btn")[0].onclick=function(){this.classList.contains("wptb-button-disable")||r.classList.add("wptb-popup-show")},window.onbeforeunload=function(e){return 0==document.getElementsByClassName("wptb-save-disabled").length||null},document.getElementsByClassName("wptb-popup-dark-area")[0].onclick=function(){r.classList.remove("wptb-popup-show")},document.getElementsByClassName("wptb-popup-window-close-icon")[0].onclick=function(){r.classList.remove("wptb-popup-show")},document.getElementsByClassName("wptb-preview-btn")[0].onclick=function(e){this.classList.contains("wptb-button-disable")&&e.preventDefault()},document.getElementsByClassName("wptb-save-btn")[0].onclick=function(r){if((r.target.dataset.wptbTableStateNumberSave||0!=window.wptbTableStateNumberShow)&&window.wptbTableStateNumberShow!=r.target.dataset.wptbTableStateNumberSave){var e=document.querySelector(".wptb-edit-bar");if(e&&e.classList.contains("visible"))document.getElementsByClassName("wptb-preview-table")[0].toggleTableEditMode();var o=new XMLHttpRequest,t=(wptb_admin_object?wptb_admin_object.ajaxurl:ajaxurl)+"?action=save_table",i=document.getElementById("wptb-setup-name").value.trim(),s=void 0,a=document.getElementsByClassName("wptb-preview-table");if(a=0<a.length?(a=WPTB_Stringifier(a[0])).outerHTML:"",""===i||""===a){var n="";return""===i&&(n+="You must assign a name to the table before saving it.</br>"),""===a&&(n+="Table wasn't created"),(s=document.getElementById("wptb-messaging-area")).innerHTML='<div class="wptb-error wptb-message">Error: '+n+"</div>",s.classList.add("wptb-warning"),void setTimeout(function(){s.removeChild(s.firstChild)},4e3)}var l={title:i,content:a,security_code:wptb_admin_object.security_code};((rs=WPTB_Helper.detectMode())||(rs=document.wptbId))&&(l.id=rs),l=JSON.stringify(l),o.open("POST",t,!0),o.setRequestHeader("Content-type","application/json; charset=utf-8"),o.onreadystatechange=function(e){if(4==this.readyState&&200==this.status){var t=JSON.parse(o.responseText);if(s=document.getElementById("wptb-messaging-area"),"saved"==t[0]){document.wptbId=t[1],s.innerHTML='<div class="wptb-success wptb-message">Table "'+i+'" was successfully saved.</div>',document.getElementsByClassName("wptb-embed-btn")[0].classList.remove("wptb-button-disable"),document.getElementById("wptb-embed-shortcode").value="[wptb id="+t[1]+"]";var a=document.getElementsByClassName("wptb-preview-btn");if(0<a.length){(a=a[0]).classList.remove("wptb-button-disable");var n=a.dataset.previewHref;n=n.replace("empty",t[1]),a.setAttribute("href",n)}}else if("edited"==t[0]){s.innerHTML='<div class="wptb-success wptb-message">Table "'+i+'" was successfully updated.</div>',r.target.dataset.wptbTableStateNumberSave=window.wptbTableStateNumberShow;var l=document.getElementsByClassName("wptb-save-btn");0<l.length&&(l=l[0]).classList.add("wptb-save-disabled")}else s.innerHTML='<div class="wptb-error wptb-message">Safety problems</div>';s.classList.add("wptb-success"),setTimeout(function(){s.removeChild(s.firstChild)},4e3)}},o.send(l)}}},WPTB_Space=function i(e){var t=void 0;if(e?t=e:(t=document.createElement("div")).classList.add("wptb-space-between"),t.ondragenter=function(){this.classList.add("visible")},t.ondragover=function(e){e.preventDefault()},t.ondragleave=function(){this.classList.remove("visible")},t.ondrop=function(e){e.stopPropagation();for(var t,a,n,l,r=e.target.nextSibling,o=e.target;!o.classList.contains("wptb-droppable");)o=o.parentNode;e.dataTransfer.getData("wptbElement")?(t=(l=e.dataTransfer.getData("wptbElement")).includes("list")?new WPTB_List:l.includes("image")?new WPTB_Image:l.includes("text")?new WPTB_Text:l.includes("button")?new WPTB_Button:void 0,this.classList.remove("visible"),null==r?(o.appendChild(t.getDOMElement()),o.appendChild(new i)):(o.insertBefore(t.getDOMElement(),r),o.insertBefore(new i,r))):(alert(e.dataTransfer.getData("node")),a=(t=document.getElementsByClassName(e.dataTransfer.getData("node"))[0]).nextSibling,n=t.parentNode,null!=a&&n.removeChild(a),null==r?(o.appendChild(t),o.appendChild(new i)):(o.insertBefore(t,r),o.insertBefore(new i,r))),this.classList.remove("visible")},!e)return t};function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,a=Array(e.length);t<e.length;t++)a[t]=e[t];return a}return Array.from(e)}var WPTB_StarRating=function(e,t){t||(t=e?e.querySelectorAll("li").length:5);var a=document.createElement("div"),n=document.createElement("div"),l=document.createElement("ul"),r=document.createElement("div"),o=document.createElement("div"),i=void 0,s=!1;a.classList.add("wptb-star_rating-container"),n.classList.add("wptb-rating-stars-box"),l.classList.add("wptb-rating-stars-list"),r.classList.add("wptb-success-box"),r.style.display="none",o.classList.add("wptb-text-message");for(var d=0;d<t;d++){var c=document.createElement("li");c.classList.add("wptb-rating-star");var p="";0==d&&(p='<span class="wptb-rating-star-zero-set"></span>'),c.innerHTML='<span class="wptb-rating-star-left-signal-part">'+p+'</span><span class="wptb-filled-rating-star"><svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" \n xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="20px" viewBox="0 0 426.667 426.667" \n style="enable-background:new 0 0 426.667 426.667;" xml:space="preserve">\n <polygon points="426.667,165.12 273.28,152.107 213.333,10.667 153.387,152.107 0,165.12 \n 116.48,266.027 81.493,416 213.333,336.427 345.173,416 310.187,266.027"/></svg></span><span class="wptb-not-filled-rating-star"><svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" \n xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="20px" viewBox="0 0 426.667 426.667" \n style="enable-background:new 0 0 426.667 426.667;" xml:space="preserve">\n <path d="M426.667,165.12L273.28,151.893L213.333,10.667l-59.947,141.44L0,165.12l116.48,100.907L81.493,416l131.84-79.573\n L345.173,416L310.4,266.027L426.667,165.12z M213.333,296.533L133.12,344.96l21.333-91.307l-70.827-61.44l93.44-8.107 \n l36.267-85.973l36.48,86.187l93.44,8.107l-70.827,61.44l21.333,91.307L213.333,296.533z"/></svg></span><span class="wptb-half-filled-rating-star"><svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" \n xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="20px" viewBox="0 0 426.667 426.667" \n style="enable-background:new 0 0 426.667 426.667;" xml:space="preserve">\n <path d="M426.667,165.12L273.28,151.893L213.333,10.667l-59.947,141.44L0,165.12l116.48,100.907L81.493,416l131.84-79.573 \n L345.173,416L310.4,266.027L426.667,165.12z M213.333,296.533v-198.4l36.48,86.187l93.44,8.107l-70.827,61.44l21.333,91.307 \n L213.333,296.533z"/></svg></span><span class="wptb-rating-star-right-signal-part"></span>',c.dataset.value=d+1,l.appendChild(c)}if(r.appendChild(o),n.appendChild(l),n.appendChild(r),a.appendChild(n),e){var m=e.className.match(/wptb-element-((.+-)\d+)/i);m&&Array.isArray(m)&&(i=m[1],s=!0);var u=e.querySelector(".wptb-rating-stars-box");if(u){var b=[].concat(_toConsumableArray(u.attributes));if(0<b.length)for(var g=0;g<b.length;g++)"style"==b[g].name&&n.setAttribute(b[g].name,b[g].value)}var w=u.querySelectorAll("li"),v=l.querySelectorAll("li");if(0<w.length&&0<v.length){w.length<t&&w.length;for(var h=0;h<w.length;h++){var y=[].concat(_toConsumableArray(w[h].attributes));if(0<y.length)for(var f=0;f<y.length;f++)v[h].setAttribute(y[f].name,y[f].value);for(var B=w[h].children,S=v[h].children,T=0;T<B.length;T++){var E=[].concat(_toConsumableArray(B[T].attributes));if(0<E.length)for(var C=0;C<E.length;C++){S[T].setAttribute(E[C].name,E[C].value);var x=B[T].querySelector("svg");if(x){var _=x.getAttribute("style");S[T].querySelector("svg").setAttribute("style",_)}}}}}var N=u.querySelector(".wptb-success-box");if(N)for(var I=[].concat(_toConsumableArray(N.attributes)),P=0;P<I.length;P++)"style"==I[P].name&&r.setAttribute(I[P].name,I[P].value);var A=N.querySelector(".wptb-text-message");if(A){o.innerHTML=A.innerHTML;for(var k=[].concat(_toConsumableArray(A.attributes)),W=0;W<k.length;W++)"style"==k[W].name&&o.setAttribute(k[W].name,k[W].value)}}return this.kind="star_rating",this.getDOMElement=function(){return a},applyGenericItemSettings(this,i,s),this},WPTB_Stringifier=function(e){if(e){var t=e.cloneNode(!0);t.classList.add("wptb-table-preview-static-indic"),t.dataset.tableColumns=e.columns,t.style.width=null,t.style.minWidth=null,t.style.maxWidth=null;var a=t.getElementsByTagName("td");if(0<a.length)for(var n=0;n<a.length;n++){e.querySelector("wptb-table-preview-head")&&a[n].removeAttribute("data-x-index"),a[n].removeAttribute("data-y-index"),a[n].removeAttribute("d